diff options
| author | Adam Malczewski <[email protected]> | 2026-06-05 01:35:50 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-05 01:35:50 +0900 |
| commit | 94dd5334b0277f3cf3b0588150a6615af86a32b3 (patch) | |
| tree | 53b1b327790ae43bd3b7cbabe555b832f3e27248 /packages/kernel/src/runtime/run-turn.test.ts | |
| parent | 977ca522736bba53172e010494de5ac59fdb2a4a (diff) | |
| download | dispatch-94dd5334b0277f3cf3b0588150a6615af86a32b3.tar.gz dispatch-94dd5334b0277f3cf3b0588150a6615af86a32b3.zip | |
refactor(kernel): rename tabId → conversationId across contracts + consumers (218 tests)
Step 4 of the post-MVP backlog: resolve the last vocab drift. The canonical
term for a thread of turns is `conversationId` (GLOSSARY), but `AgentEvent`
variants and `RunTurnInput` still used the legacy `tabId` from the old frontend
"tab" concept, with session-orchestrator bridging `conversationId → tabId`.
Atomic, type-driven rename across the full 10-file consumer set:
- contracts/events.ts: all 11 AgentEvent variants tabId → conversationId
- contracts/runtime.ts: RunTurnInput.tabId → conversationId
- runtime/{events,run-turn,dispatch}.ts: factory params, ctx field, locals
- session-orchestrator: drop the redundant `tabId: conversationId` bridge line
- transport-http: emit wiring; external /chat field + X-Conversation-Id header
unchanged (already canonical) — only the emitted NDJSON event field flips
- tests (run-turn, app, logic): inputs + assertions now use conversationId
Pure rename, zero behavior change: typecheck clean, 218 tests pass (unchanged
count), biome clean, `grep tabId packages/` → zero matches. Verified live:
multi-turn curl emits conversationId-keyed NDJSON and threads history correctly.
GLOSSARY drift note removed. Closes the post-MVP backlog (Steps 1–4).
Diffstat (limited to 'packages/kernel/src/runtime/run-turn.test.ts')
| -rw-r--r-- | packages/kernel/src/runtime/run-turn.test.ts | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/packages/kernel/src/runtime/run-turn.test.ts b/packages/kernel/src/runtime/run-turn.test.ts index 1ea6406..696a385 100644 --- a/packages/kernel/src/runtime/run-turn.test.ts +++ b/packages/kernel/src/runtime/run-turn.test.ts @@ -52,7 +52,7 @@ const userMessage: ChatMessage = { }; describe("runTurn", () => { - it("emits events with the tabId and turnId from input", async () => { + it("emits events with the conversationId and turnId from input", async () => { const provider = createFakeProvider([ [ { type: "text-delta", delta: "hi" }, @@ -68,14 +68,14 @@ describe("runTurn", () => { messages: [userMessage], tools: [], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "conv-42", + conversationId: "conv-42", turnId: "turn-99", emit, }); expect(events.length).toBeGreaterThan(0); for (const event of events) { - expect(event.tabId).toBe("conv-42"); + expect(event.conversationId).toBe("conv-42"); if (event.type !== "status") { expect(event.turnId).toBe("turn-99"); } @@ -100,7 +100,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit, }); @@ -143,7 +143,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [tool], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit, }); @@ -201,7 +201,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [tool], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, }); @@ -250,7 +250,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [toolA, toolB], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, }); @@ -294,7 +294,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [toolA, toolB], dispatch: { maxConcurrent: 2, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, }); @@ -352,7 +352,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [toolA, toolB, toolC], dispatch: { maxConcurrent: 0, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, }); @@ -413,7 +413,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [tool], dispatch: { maxConcurrent: 1, eager: true }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, }); @@ -464,7 +464,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [tool], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, }); @@ -513,7 +513,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [tool], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit, signal: ac.signal, @@ -545,7 +545,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, signal: ac.signal, @@ -583,7 +583,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [tool], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit, }); @@ -657,7 +657,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [unsafeTool, safeTool], dispatch: { maxConcurrent: 5, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, }); @@ -691,7 +691,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit, }); @@ -724,7 +724,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit, }); @@ -759,7 +759,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [tool], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit: () => {}, }); @@ -797,7 +797,7 @@ describe("runTurn", () => { messages: [userMessage], tools: [tool], dispatch: { maxConcurrent: 1, eager: false }, - tabId: "tab-test", + conversationId: "tab-test", turnId: "turn-test", emit, }); |
