refactor(events): add stable conversation correlation ids

This commit is contained in:
imccyu
2026-08-09 18:13:00 +08:00
parent dc825be8d8
commit aa623b6e7a
23 changed files with 347 additions and 41 deletions
+3 -1
View File
@@ -37,6 +37,8 @@ export interface CommandInputDescriptor {
/** Invocation passed to one registered command handler. */
export interface CommandInvocation {
/** Pairing id already written to this invocation's `command/run` event. */
readonly commandId: CommandId
/** Exact agent whose human-facing surface received the command. */
readonly agent: Agent
/** Exact text following the registered command name, including separator whitespace. */
@@ -389,7 +391,7 @@ export class CommandService extends Service {
...command.definition.recordInput === false ? {} : { args: parsed.rawInput },
source: { kind: 'user' },
})
const invocation = Object.freeze({ agent, rawInput: parsed.rawInput, signal })
const invocation = Object.freeze({ commandId, agent, rawInput: parsed.rawInput, signal })
let result: CommandResult
try {
const output = command.definition.handler(invocation)