summaryrefslogtreecommitdiffhomepage
path: root/packages/kernel/src/contracts
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/contracts
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/contracts')
-rw-r--r--packages/kernel/src/contracts/events.ts24
-rw-r--r--packages/kernel/src/contracts/runtime.ts6
2 files changed, 15 insertions, 15 deletions
diff --git a/packages/kernel/src/contracts/events.ts b/packages/kernel/src/contracts/events.ts
index ce1dae4..74e23fd 100644
--- a/packages/kernel/src/contracts/events.ts
+++ b/packages/kernel/src/contracts/events.ts
@@ -25,24 +25,24 @@ export type AgentEvent =
| TurnDoneEvent
| TurnSealedEvent;
-/** Status change for a tab / session (e.g. idle → running). */
+/** Status change for a conversation (e.g. idle → running). */
export interface StatusEvent {
readonly type: "status";
- readonly tabId: string;
+ readonly conversationId: string;
readonly status: string;
}
/** A turn has begun. */
export interface TurnStartEvent {
readonly type: "turn-start";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
}
/** Incremental text content from the model during a turn. */
export interface TurnTextDeltaEvent {
readonly type: "text-delta";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
readonly delta: string;
}
@@ -50,7 +50,7 @@ export interface TurnTextDeltaEvent {
/** Incremental reasoning / thinking content during a turn. */
export interface TurnReasoningDeltaEvent {
readonly type: "reasoning-delta";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
readonly delta: string;
}
@@ -58,7 +58,7 @@ export interface TurnReasoningDeltaEvent {
/** The model has requested a tool to be run. */
export interface TurnToolCallEvent {
readonly type: "tool-call";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
readonly toolCallId: string;
readonly toolName: string;
@@ -68,7 +68,7 @@ export interface TurnToolCallEvent {
/** A tool has completed execution. */
export interface TurnToolResultEvent {
readonly type: "tool-result";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
readonly toolCallId: string;
readonly toolName: string;
@@ -79,7 +79,7 @@ export interface TurnToolResultEvent {
/** Streaming output from a tool execution (e.g. shell stdout/stderr). */
export interface TurnToolOutputEvent {
readonly type: "tool-output";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
readonly toolCallId: string;
readonly data: string;
@@ -89,7 +89,7 @@ export interface TurnToolOutputEvent {
/** Token usage for the current step or turn. */
export interface TurnUsageEvent {
readonly type: "usage";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
readonly usage: Usage;
}
@@ -97,7 +97,7 @@ export interface TurnUsageEvent {
/** An error occurred during the turn. */
export interface TurnErrorEvent {
readonly type: "error";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
readonly message: string;
readonly code?: string;
@@ -106,7 +106,7 @@ export interface TurnErrorEvent {
/** The turn has completed (model finished generating). */
export interface TurnDoneEvent {
readonly type: "done";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
readonly reason: string;
}
@@ -117,6 +117,6 @@ export interface TurnDoneEvent {
*/
export interface TurnSealedEvent {
readonly type: "turn-sealed";
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
}
diff --git a/packages/kernel/src/contracts/runtime.ts b/packages/kernel/src/contracts/runtime.ts
index ff994af..68c0444 100644
--- a/packages/kernel/src/contracts/runtime.ts
+++ b/packages/kernel/src/contracts/runtime.ts
@@ -57,10 +57,10 @@ export interface RunTurnInput {
/**
* Identifiers used to attribute every emitted `AgentEvent`. The kernel does
- * not generate these — the session-orchestrator owns turn/tab identity and
- * passes them in, so events are traceable to their conversation.
+ * not generate these — the session-orchestrator owns turn/conversation identity
+ * and passes them in, so events are traceable to their conversation.
*/
- readonly tabId: string;
+ readonly conversationId: string;
readonly turnId: string;
/**