summaryrefslogtreecommitdiffhomepage
path: root/packages/kernel/src/runtime/dispatch.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-05 01:35:50 +0900
committerAdam Malczewski <[email protected]>2026-06-05 01:35:50 +0900
commit94dd5334b0277f3cf3b0588150a6615af86a32b3 (patch)
tree53b1b327790ae43bd3b7cbabe555b832f3e27248 /packages/kernel/src/runtime/dispatch.ts
parent977ca522736bba53172e010494de5ac59fdb2a4a (diff)
downloaddispatch-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/dispatch.ts')
-rw-r--r--packages/kernel/src/runtime/dispatch.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/kernel/src/runtime/dispatch.ts b/packages/kernel/src/runtime/dispatch.ts
index c6c5f8e..626b333 100644
--- a/packages/kernel/src/runtime/dispatch.ts
+++ b/packages/kernel/src/runtime/dispatch.ts
@@ -13,7 +13,7 @@ export async function executeToolCall(
tool: ToolContract | undefined,
signal: AbortSignal,
emit: EventEmitter,
- tabId: string,
+ conversationId: string,
turnId: string,
): Promise<ToolResult> {
if (tool === undefined) {
@@ -26,7 +26,7 @@ export async function executeToolCall(
toolCallId: call.id,
signal,
onOutput: (data, stream) => {
- emit(toolOutputEvent(tabId, turnId, call.id, data, stream));
+ emit(toolOutputEvent(conversationId, turnId, call.id, data, stream));
},
};
try {
@@ -48,7 +48,7 @@ export function createStepDispatcher(
policy: ToolDispatchPolicy,
signal: AbortSignal,
emit: EventEmitter,
- tabId: string,
+ conversationId: string,
turnId: string,
): StepDispatcher {
let activeCount = 0;
@@ -78,7 +78,14 @@ export function createStepDispatcher(
}
async function runAndResolve(entry: QueueEntry): Promise<void> {
- const result = await executeToolCall(entry.call, entry.tool, signal, emit, tabId, turnId);
+ const result = await executeToolCall(
+ entry.call,
+ entry.tool,
+ signal,
+ emit,
+ conversationId,
+ turnId,
+ );
activeCount--;
if (entry.tool?.concurrencySafe === false) unsafeRunning = false;
entry.resolve(result);