diff options
Diffstat (limited to 'packages/kernel/src/runtime/events.ts')
| -rw-r--r-- | packages/kernel/src/runtime/events.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/kernel/src/runtime/events.ts b/packages/kernel/src/runtime/events.ts index 300e711..b194577 100644 --- a/packages/kernel/src/runtime/events.ts +++ b/packages/kernel/src/runtime/events.ts @@ -127,16 +127,29 @@ export function doneEvent( reason: string, durationMs?: number, usage?: Usage, + contextSize?: number, ): AgentEvent { + if (durationMs !== undefined && usage !== undefined && contextSize !== undefined) { + return { type: "done", conversationId, turnId, reason, durationMs, usage, contextSize }; + } if (durationMs !== undefined && usage !== undefined) { return { type: "done", conversationId, turnId, reason, durationMs, usage }; } + if (durationMs !== undefined && contextSize !== undefined) { + return { type: "done", conversationId, turnId, reason, durationMs, contextSize }; + } + if (usage !== undefined && contextSize !== undefined) { + return { type: "done", conversationId, turnId, reason, usage, contextSize }; + } if (durationMs !== undefined) { return { type: "done", conversationId, turnId, reason, durationMs }; } if (usage !== undefined) { return { type: "done", conversationId, turnId, reason, usage }; } + if (contextSize !== undefined) { + return { type: "done", conversationId, turnId, reason, contextSize }; + } return { type: "done", conversationId, turnId, reason }; } |
