diff --git a/src/agent/agent.ts b/src/agent/agent.ts index 7b38df5..928950b 100644 --- a/src/agent/agent.ts +++ b/src/agent/agent.ts @@ -175,6 +175,7 @@ export class Agent { * * Use this for multi-turn interactions. */ + // TODO(#18): accept optional RunOptions to forward trace context async prompt(message: string): Promise { const userMessage: LLMMessage = { role: 'user', @@ -198,6 +199,7 @@ export class Agent { * * Like {@link run}, this does not use or update the persistent history. */ + // TODO(#18): accept optional RunOptions to forward trace context async *stream(prompt: string): AsyncGenerator { const messages: LLMMessage[] = [ { role: 'user', content: [{ type: 'text', text: prompt }] }, diff --git a/src/index.ts b/src/index.ts index 7518ec3..e849cd5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -162,6 +162,7 @@ export type { OrchestratorEvent, // Trace + TraceEventBase, TraceEvent, LLMCallTrace, ToolCallTrace, diff --git a/src/orchestrator/orchestrator.ts b/src/orchestrator/orchestrator.ts index f03dc75..86f16c0 100644 --- a/src/orchestrator/orchestrator.ts +++ b/src/orchestrator/orchestrator.ts @@ -354,7 +354,7 @@ async function executeQueue( () => pool.run(assignee, prompt, traceOptions), task, (retryData) => { - retryCount = retryData.attempt + retryCount++ config.onProgress?.({ type: 'task_retry', task: task.id, diff --git a/src/types.ts b/src/types.ts index 6d69270..0f3ebff 100644 --- a/src/types.ts +++ b/src/types.ts @@ -324,7 +324,7 @@ export interface OrchestratorConfig { // --------------------------------------------------------------------------- /** Shared fields present on every trace event. */ -interface TraceEventBase { +export interface TraceEventBase { /** Unique identifier for the entire run (runTeam / runTasks / runAgent call). */ readonly runId: string readonly type: string @@ -335,7 +335,7 @@ interface TraceEventBase { /** Wall-clock duration in milliseconds (`endMs - startMs`). */ readonly durationMs: number /** Agent name associated with this span. */ - readonly agent?: string + readonly agent: string /** Task ID associated with this span. */ readonly taskId?: string } @@ -344,7 +344,7 @@ interface TraceEventBase { export interface LLMCallTrace extends TraceEventBase { readonly type: 'llm_call' readonly agent: string - readonly model?: string + readonly model: string readonly turn: number readonly tokens: TokenUsage }