MCPcopy
hub / github.com/coder/mux / pinnedTodoStreamEvents

Function pinnedTodoStreamEvents

src/browser/stores/WorkspaceStore.test.ts:309–369  ·  view source on GitHub ↗

* Build the canonical 4-event "todo-write inside a stream" sequence used by * pinned-todo tests. Pass a terminator to choose between stream-end / stream-abort.

(
  workspaceId: string,
  todos: TodoItem[],
  terminator: StreamTerminator
)

Source from the content-addressed store, hash-verified

307 * pinned-todo tests. Pass a terminator to choose between stream-end / stream-abort.
308 */
309function pinnedTodoStreamEvents(
310 workspaceId: string,
311 todos: TodoItem[],
312 terminator: StreamTerminator
313): WorkspaceChatMessage[] {
314 const messageId = terminator.messageId;
315 const toolCallId = `${messageId}-todo-write`;
316 const events: WorkspaceChatMessage[] = [
317 {
318 type: "stream-start",
319 workspaceId,
320 messageId,
321 historySequence: 1,
322 model: "claude-sonnet-4",
323 startTime: 1_000,
324 },
325 {
326 type: "tool-call-start",
327 workspaceId,
328 messageId,
329 toolCallId,
330 toolName: "todo_write",
331 args: { todos },
332 tokens: 10,
333 timestamp: 1_001,
334 },
335 {
336 type: "tool-call-end",
337 workspaceId,
338 messageId,
339 toolCallId,
340 toolName: "todo_write",
341 result: { success: true },
342 timestamp: 1_002,
343 },
344 ];
345
346 if (terminator.kind === "stream-end") {
347 events.push({
348 type: "stream-end",
349 workspaceId,
350 messageId,
351 metadata: {
352 model: terminator.model,
353 historySequence: 1,
354 timestamp: 1_003,
355 },
356 parts: [],
357 });
358 } else {
359 events.push({
360 type: "stream-abort",
361 workspaceId,
362 messageId,
363 abortReason: "user",
364 metadata: {},
365 });
366 }

Callers 1

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected