agent-afk 5.302.12 → 5.303.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/agent/abort-graph.d.ts +2 -1
  2. package/dist/agent/afk-mode-gate.d.ts +0 -1
  3. package/dist/agent/agents/index.d.ts +2 -4
  4. package/dist/agent/auth/model-availability.d.ts +2 -1
  5. package/dist/agent/branch/branch-prune.d.ts +2 -2
  6. package/dist/agent/companion/index.d.ts +1 -1
  7. package/dist/agent/daemon/budget-gate.d.ts +2 -1
  8. package/dist/agent/daemon/handoff-store.d.ts +2 -1
  9. package/dist/agent/daemon/scheduler.d.ts +1 -1
  10. package/dist/agent/daemon/scheduler.execute-agent-task.d.ts +2 -1
  11. package/dist/agent/daemon/scheduler.pull-tick.d.ts +1 -2
  12. package/dist/agent/daemon/tool-health-task.d.ts +0 -1
  13. package/dist/agent/daemon/triggers.d.ts +0 -2
  14. package/dist/agent/effect-ledger/index.d.ts +0 -3
  15. package/dist/agent/facets/yield-probe.d.ts +1 -1
  16. package/dist/agent/index.d.ts +1 -1
  17. package/dist/agent/journal/journal-file.d.ts +1 -0
  18. package/dist/agent/journal/types.d.ts +1 -0
  19. package/dist/agent/outcomes/schema.d.ts +1 -1
  20. package/dist/agent/provider.d.ts +2 -0
  21. package/dist/agent/providers/anthropic-direct/loop/connection-create.d.ts +19 -0
  22. package/dist/agent/providers/anthropic-direct/loop/round-request.d.ts +2 -11
  23. package/dist/agent/providers/openai-compatible/query/stream-drive.connection.d.ts +1 -1
  24. package/dist/agent/providers/openai-compatible/query/stream-drive.d.ts +1 -0
  25. package/dist/agent/providers/shared/connection-loop-lag.d.ts +4 -0
  26. package/dist/agent/providers/shared/connection-retry-budget.d.ts +10 -0
  27. package/dist/agent/providers/shared/tool-loop-cap.d.ts +1 -0
  28. package/dist/agent/subagent/capped-handoff.d.ts +26 -0
  29. package/dist/agent/subagent/result.d.ts +2 -1
  30. package/dist/agent/trace/events.d.ts +6 -0
  31. package/dist/agent/trace/events.session-phase.d.ts +6 -0
  32. package/dist/agent/trace/types.d.ts +6 -0
  33. package/dist/agent/trace/types.session-phase.d.ts +1 -1
  34. package/dist/agent/types/session-types.d.ts +2 -0
  35. package/dist/cli.mjs +355 -350
  36. package/dist/config/env.d.ts +7 -0
  37. package/dist/config/env.model.d.ts +7 -0
  38. package/dist/index.mjs +146 -141
  39. package/dist/telegram.mjs +171 -166
  40. package/package.json +1 -2
  41. package/dist/cli/commands/interactive/task-view.d.ts +0 -11
@@ -1,5 +1,5 @@
1
1
  import type { AbortOrigin, TraceSink } from './trace/index.js';
2
- export interface ChildAbortedEvent {
2
+ interface ChildAbortedEvent {
3
3
  parentId: string;
4
4
  childId: string;
5
5
  reason?: unknown;
@@ -21,3 +21,4 @@ export declare class AbortGraph {
21
21
  abort(id: string, reason?: unknown, origin?: AbortOrigin): void;
22
22
  dispose(id: string): void;
23
23
  }
24
+ export {};
@@ -2,7 +2,6 @@ import type { HookHandler } from './hooks.js';
2
2
  import type { PermissionMode } from './types/sdk-types.js';
3
3
  import type { ElicitationRequest, ElicitationResult } from './types/sdk-types.js';
4
4
  import type { TraceSink } from './trace/index.js';
5
- export declare const AFK_HARNESS_SERVER_NAME = "agent-afk";
6
5
  export interface AfkModeGateOptions {
7
6
  approvalTimeoutMs?: number;
8
7
  promptForApproval?: boolean;
@@ -1,6 +1,4 @@
1
- export type { AgentRegistry, AgentSource, RegisteredAgent, ResolvedAgentToolAccess, } from './types.js';
2
- export { parseAgentMarkdown, type ParsedAgentFile } from './parser.js';
1
+ export type { AgentRegistry, RegisteredAgent, } from './types.js';
3
2
  export { resolveAgentToolAccess } from './resolve.js';
4
- export { builtinAgents } from './builtins.js';
5
- export { loadAgentRegistry, type LoadAgentRegistryOptions } from './registry.js';
3
+ export { loadAgentRegistry } from './registry.js';
6
4
  export { buildAgentToolDef } from './tool-def.js';
@@ -1,5 +1,5 @@
1
1
  import { type ModelSlots } from '../session/model-slots.js';
2
- export type AvailabilityNeed = 'anthropic' | 'openai' | 'chatgpt-oauth' | 'xai' | 'xai-oauth' | 'local' | 'unknown';
2
+ type AvailabilityNeed = 'anthropic' | 'openai' | 'chatgpt-oauth' | 'xai' | 'xai-oauth' | 'local' | 'unknown';
3
3
  export interface ModelAvailability {
4
4
  available: boolean;
5
5
  needs: AvailabilityNeed;
@@ -7,3 +7,4 @@ export interface ModelAvailability {
7
7
  }
8
8
  export declare function modelAvailability(model: string | undefined, bindings?: ModelSlots): ModelAvailability;
9
9
  export declare function isModelAvailable(model: string | undefined, bindings?: ModelSlots): boolean;
10
+ export {};
@@ -5,7 +5,7 @@ export type ExecForBranchPrune = (file: string, args: string[], opts?: {
5
5
  stderr: string;
6
6
  }>;
7
7
  export type PrState = 'open' | 'merged' | 'closed' | 'none';
8
- export type BranchVerdict = 'prune' | 'keep' | 'error';
8
+ type BranchVerdict = 'prune' | 'keep' | 'error';
9
9
  export interface BranchCandidate {
10
10
  remoteBranch: string;
11
11
  shortName: string;
@@ -32,5 +32,5 @@ export interface BranchPruneOptions {
32
32
  export declare function parseGhPrState(ghOutput: string): PrState;
33
33
  export declare function parseCommitsAhead(revListOutput: string): number;
34
34
  export declare function classify(prState: PrState, commitsAhead: number): Pick<BranchCandidate, 'verdict' | 'reason'>;
35
- export declare function listRemoteBranches(execFn: ExecForBranchPrune, remote: string, branchPrefix: string, cwd: string): Promise<string[]>;
36
35
  export declare function runBranchPrune(options: BranchPruneOptions): Promise<BranchPruneResult>;
36
+ export {};
@@ -1 +1 @@
1
- export { loadCompanionPrimer, injectCompanionPrimer, MAX_PRIMER_CHARS, } from './primer-loader.js';
1
+ export { injectCompanionPrimer, } from './primer-loader.js';
@@ -1,6 +1,6 @@
1
1
  import type { FetchSubscriptionUsageOptions, UsageResult } from '../subscription-usage.js';
2
2
  import { type BindingWindow } from '../usage/usage-budget.js';
3
- export interface BudgetGatePass {
3
+ interface BudgetGatePass {
4
4
  readonly skip: false;
5
5
  }
6
6
  export interface BudgetGateSkip {
@@ -29,3 +29,4 @@ export declare class BudgetAlertLatch {
29
29
  shouldAlert(skip: BudgetGateSkip): boolean;
30
30
  clear(): void;
31
31
  }
32
+ export {};
@@ -1,4 +1,4 @@
1
- export type HandoffRequestType = 'ask_question' | 'mcp' | 'path_approval';
1
+ type HandoffRequestType = 'ask_question' | 'mcp' | 'path_approval';
2
2
  export interface HandoffRoute {
3
3
  chatId: number;
4
4
  threadId?: number;
@@ -27,3 +27,4 @@ export declare function deleteHandoff(taskId: string, handoffsDir?: string): Pro
27
27
  export declare function listPendingHandoffs(handoffsDir?: string): Promise<HandoffRecord[]>;
28
28
  export declare function withHandoffLock<T>(taskId: string, handoffsDir: string, cb: () => Promise<T>): Promise<T | null>;
29
29
  export declare function updateHandoffAnswer(taskId: string, answer: unknown, source: string, handoffsDir?: string): Promise<UpdateHandoffResult>;
30
+ export {};
@@ -25,7 +25,7 @@ export interface SchedulerOptions {
25
25
  budgetGate?: () => Promise<import('./budget-gate.js').BudgetGateResult>;
26
26
  }
27
27
  export type TelemetryTrigger = 'cron' | 'sessionstart' | 'pull';
28
- export type TelemetryStatus = 'success' | 'error' | 'skipped';
28
+ type TelemetryStatus = 'success' | 'error' | 'skipped';
29
29
  export interface TelemetryRecord {
30
30
  taskId: string;
31
31
  command: string;
@@ -6,7 +6,7 @@ import type { StateStore } from '../state/state-store.js';
6
6
  import type { ScheduledTask } from './triggers.js';
7
7
  import type { TelemetryRecord, TelemetryTrigger, TaskCompletionDetails } from './scheduler.js';
8
8
  import type { Telegraf } from 'telegraf';
9
- export interface AgentTaskOptions {
9
+ interface AgentTaskOptions {
10
10
  bot?: Telegraf;
11
11
  primaryChatId?: number;
12
12
  primaryThreadId?: number;
@@ -30,3 +30,4 @@ export interface AgentTaskContext {
30
30
  writeTelemetry: (record: TelemetryRecord, task: ScheduledTask, details?: TaskCompletionDetails) => void;
31
31
  }
32
32
  export declare function executeAgentTask(ctx: AgentTaskContext, task: ScheduledTask, trigger: TelemetryTrigger): Promise<TelemetryRecord>;
33
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { ScheduledTask } from './triggers.js';
2
- import type { TelemetryRecord, TelemetryTrigger, TaskCompletionDetails } from './scheduler.js';
2
+ import type { TelemetryRecord, TaskCompletionDetails } from './scheduler.js';
3
3
  export interface PullTickContext {
4
4
  queueDir: string;
5
5
  isIdle: () => boolean;
@@ -13,4 +13,3 @@ export interface FireOnTaskCompleteOptions {
13
13
  onTaskComplete?: (record: TelemetryRecord, details?: TaskCompletionDetails) => void | Promise<void>;
14
14
  }
15
15
  export declare function fireOnTaskComplete(record: TelemetryRecord, options: FireOnTaskCompleteOptions, task?: ScheduledTask, details?: TaskCompletionDetails): void;
16
- export type { TelemetryTrigger };
@@ -3,7 +3,6 @@ export declare function _resetToolHealthAlertCooldownForTests(): void;
3
3
  export declare const TOOL_HEALTH_LOOKBACK_MS: number;
4
4
  export declare const TOOL_HEALTH_MIN_SESSIONS = 2;
5
5
  export declare const TOOL_HEALTH_COOLDOWN_MS: number;
6
- export declare const TOOL_HEALTH_MAX_FILES = 200;
7
6
  export interface ToolHealthTaskOptions {
8
7
  now: () => number;
9
8
  telemetryPath: () => string;
@@ -1,7 +1,5 @@
1
1
  export type TriggerMode = 'cron' | 'sessionstart' | 'both' | 'pull';
2
2
  export type TaskExecutor = 'agent' | 'shell' | 'builtin';
3
- export declare const KNOWN_BUILTINS: readonly ["worktree-prune", "tool-health"];
4
- export type BuiltinTaskName = (typeof KNOWN_BUILTINS)[number];
5
3
  export interface ScheduledTask {
6
4
  taskId: string;
7
5
  command: string;
@@ -1,6 +1,3 @@
1
- export { EffectStore } from './store.js';
2
- export { classifyToolCall } from './classifier.js';
3
- export { computeIdempotencyKey } from './idempotency.js';
4
1
  export { createEffectLedgerPostHook, createEffectLedgerPreHook } from './hook.js';
5
2
  export type { EffectRecord, EffectStatus, EffectQuery, PendingEffectInput, ExecuteEffectInput, } from './types.js';
6
3
  export type { Classification } from './classifier.js';
@@ -9,4 +9,4 @@ export declare function getCurrentBranch(execFn: ExecFnYield, cwd?: string): Pro
9
9
  export declare function queryPrState(execFn: ExecFnYield, branch: string, cwd?: string): Promise<'merged' | 'open' | 'closed' | 'none' | 'error'>;
10
10
  export declare function queryPrStateByUrl(execFn: ExecFnYield, prUrl: string, cwd?: string): Promise<'merged' | 'open' | 'closed' | 'error'>;
11
11
  export declare function patchYieldFields(sessionId: string, produced_pr: boolean, pr_merged: boolean | null, cacheDir?: string, pr_url?: string | null): void;
12
- export declare function writeFacetYield(sessionId: string, execFn: ExecFnYield, cwd?: string): Promise<void>;
12
+ export declare function writeFacetYield(sessionId: string, execFn: ExecFnYield, cwd?: string, cacheDir?: string): Promise<void>;
@@ -14,7 +14,7 @@ export type { BundledProviderName } from './providers/index.js';
14
14
  export type { AccountInfo, AgentConfig, AgentModelInput, CanUseTool, ClaudeModel, IAgentSession, McpServerStatus, Message, MessageChunk, MessageRole, ModelInfo, OutputEvent, PermissionBubbler, PermissionMode, ResponseMetadata, SDKStatus, SendMessageOptions, StructuredMessageOptions, SessionIdentity, SessionMetadata, SessionState, SlashCommand, ToolConfig, ToolDiffChunk, ToolResultChunk, } from './types.js';
15
15
  export type { CanUseToolContext, PermissionDecision, ToolPermission, ToolPermissionMode, ToolPermissionRules, } from './permissions.js';
16
16
  export type { ForkSubagentOptions, SubagentHandle, SubagentManagerOptions, SubagentResult, SubagentStatus, } from './subagent.js';
17
- export type { ChildAbortedEvent, ChildAbortedListener } from './abort-graph.js';
17
+ export type { ChildAbortedListener } from './abort-graph.js';
18
18
  export type { WithTimeoutOptions } from './timeout.js';
19
19
  export { runDAG, validateDAG } from './dag.js';
20
20
  export { runSubagentDAG } from './dag-subagent.js';
@@ -26,6 +26,7 @@ export declare class JournalFileWriter {
26
26
  private len;
27
27
  constructor(shared: JournalSessionShared, subagentId?: string | undefined);
28
28
  get length(): number;
29
+ get path(): string | undefined;
29
30
  get isClosed(): boolean;
30
31
  record(input: JournalRecordInput): void;
31
32
  private recordUnsafe;
@@ -121,6 +121,7 @@ export type JournalRecordInput = Omit<Extract<JournalRecord, {
121
121
  kind: 'mark';
122
122
  }>, 'v' | 'ts'>;
123
123
  export interface MessageJournal {
124
+ readonly path?: string;
124
125
  readonly length: number;
125
126
  append(index: number, message: JournalMessage): void;
126
127
  truncate(length: number, reason?: JournalTruncateReason): void;
@@ -56,9 +56,9 @@ export declare const VerifiedOutcomeSchema: z.ZodObject<{
56
56
  self_report: z.ZodEnum<{
57
57
  done: "done";
58
58
  blocked: "blocked";
59
+ none: "none";
59
60
  asking: "asking";
60
61
  interrupted: "interrupted";
61
- none: "none";
62
62
  }>;
63
63
  artifacts: z.ZodObject<{
64
64
  commits: z.ZodArray<z.ZodString>;
@@ -44,6 +44,8 @@ export interface ProviderProgress {
44
44
  taskId: string;
45
45
  description: string;
46
46
  summary?: string;
47
+ roundsUsed?: number;
48
+ budget?: number;
47
49
  lastToolName?: string;
48
50
  totalTokens: number;
49
51
  toolUses: number;
@@ -0,0 +1,19 @@
1
+ import type { AnthropicMessagesCreateParams } from '../types.js';
2
+ export declare class ConnectionOverloadExhaustedError extends Error {
3
+ constructor();
4
+ }
5
+ export interface ConnectionRetryInfo {
6
+ attempt: number;
7
+ delayMs: number;
8
+ error: Error;
9
+ }
10
+ export interface ConnectionLifecycleInfo {
11
+ phase: 'connection_failure' | 'connection_recovered' | 'connection_budget_exhausted';
12
+ metadata: Record<string, string | number | boolean>;
13
+ }
14
+ export declare function createWithRetry(client: {
15
+ messages: {
16
+ create(params: unknown, opts: unknown): unknown;
17
+ };
18
+ baseURL?: string;
19
+ }, params: AnthropicMessagesCreateParams, headers: Record<string, string>, requestSignal: AbortSignal, turnSignal: AbortSignal, onConnectionRetry?: (info: ConnectionRetryInfo) => void, onLifecycle?: (info: ConnectionLifecycleInfo) => void): Promise<AsyncIterable<unknown>>;
@@ -2,19 +2,10 @@ import type { ProviderEvent } from '../../../provider.js';
2
2
  import type { AnthropicMessagesCreateParams, AnthropicToolDef, RunTurnInput, WireToolDef } from '../types.js';
3
3
  import { type FirstByteTimeoutHandle } from '../../shared/first-byte-timeout.js';
4
4
  import { type StreamStallHandle } from '../../shared/stream-stall-timeout.js';
5
- import { type RoundRetryBudget } from './retry-budget.js';
5
+ import type { RoundRetryBudget } from './retry-budget.js';
6
6
  import type { TurnAccumulator } from './turn-accumulator.js';
7
7
  export declare function toWireTool(tool: AnthropicToolDef): WireToolDef;
8
- export declare function createWithRetry(client: {
9
- messages: {
10
- create(params: unknown, opts: unknown): unknown;
11
- };
12
- }, params: AnthropicMessagesCreateParams, headers: Record<string, string>, requestSignal: AbortSignal, turnSignal: AbortSignal, onConnectionRetry?: (info: ConnectionRetryInfo) => void): Promise<AsyncIterable<unknown>>;
13
- export interface ConnectionRetryInfo {
14
- attempt: number;
15
- delayMs: number;
16
- error: Error;
17
- }
8
+ export { createWithRetry, type ConnectionRetryInfo } from './connection-create.js';
18
9
  export interface OpenRoundTransport {
19
10
  kind: 'opened';
20
11
  events: AsyncIterable<unknown>;
@@ -6,4 +6,4 @@ export type ConnectionOutcome<TEvent> = {
6
6
  ok: false;
7
7
  error: unknown;
8
8
  };
9
- export declare function runConnectionPhase<TEvent>(createStream: (signal: AbortSignal) => Promise<AsyncIterable<TEvent>>, streamSignal: AbortSignal, userSignal: AbortSignal, traceWriter: TraceSink | undefined, resolvedModel: string): Promise<ConnectionOutcome<TEvent>>;
9
+ export declare function runConnectionPhase<TEvent>(createStream: (signal: AbortSignal) => Promise<AsyncIterable<TEvent>>, streamSignal: AbortSignal, userSignal: AbortSignal, traceWriter: TraceSink | undefined, resolvedModel: string, endpoint?: string): Promise<ConnectionOutcome<TEvent>>;
@@ -17,6 +17,7 @@ export interface StreamDriveContext {
17
17
  traceWriter: TraceSink | undefined;
18
18
  initSessionId: string;
19
19
  currentModel: string;
20
+ endpoint?: string;
20
21
  isClosed: () => boolean;
21
22
  ttfbTimeoutMs?: number;
22
23
  stallTimeoutMs?: number;
@@ -0,0 +1,4 @@
1
+ export declare function connectionLoopLag(): {
2
+ loopLagP99Ms: number;
3
+ loopLagMaxMs: number;
4
+ };
@@ -0,0 +1,10 @@
1
+ export declare const CONNECT_WAIT_CAP_MS = 8000;
2
+ export declare function connectRetryBudgetMs(): number | undefined;
3
+ export declare class ConnectionRetryBudget {
4
+ readonly startedAt: number;
5
+ readonly budgetMs: number | undefined;
6
+ elapsedMs(): number;
7
+ canRetry(attempt: number, legacyMax: number): boolean;
8
+ delay(legacyDelay: number, baseMs: number, attempt: number): number;
9
+ }
10
+ export declare function connectionFailureMetadata(error: unknown, budget: ConnectionRetryBudget, endpoint?: string): Record<string, string | number | boolean>;
@@ -4,3 +4,4 @@ export declare const WIND_DOWN_NOTE: string;
4
4
  export declare function resolveMaxToolIterations(configured: number | undefined): number;
5
5
  export declare function shouldWindDown(completedRounds: number, maxIterations: number): boolean;
6
6
  export declare function formatRoundLabel(round: number, maxIterations: number): string;
7
+ export declare function roundDeliveryNotice(completedRounds: number, budget: number): string | null;
@@ -0,0 +1,26 @@
1
+ import type { Message, IAgentSession, OutputEvent } from '../types.js';
2
+ import type { SubagentHandleImpl } from './handle.js';
3
+ import { TOOL_USE_LOOP_CAPPED } from '../providers/shared/tool-loop-cap.js';
4
+ export declare function isNarrationOnly(text: string): boolean;
5
+ export declare class CappedHandoffAccumulator {
6
+ private priorText;
7
+ private roundText;
8
+ private lastMessage;
9
+ private roundsUsed;
10
+ private budget;
11
+ private historyLengthAtStart;
12
+ setHistoryBaseline(length: number): void;
13
+ onEvent(event: OutputEvent): void;
14
+ finish(finalMessage: Message | undefined, session: IAgentSession): Message;
15
+ }
16
+ export declare function emitSuccessfulHandoff<T>(handle: SubagentHandleImpl<T>, message: Message, startTime: number): Promise<void>;
17
+ export interface CappedHandoff {
18
+ incomplete: true;
19
+ incompleteReason: typeof TOOL_USE_LOOP_CAPPED;
20
+ roundsUsed?: number;
21
+ budget?: number;
22
+ journalPath?: string;
23
+ salvaged?: true;
24
+ }
25
+ export declare function cappedHandoffFields(message: Message, stopReason: string | undefined): Partial<CappedHandoff>;
26
+ export declare function salvageCappedMessage(finalMessage: Message | undefined, buffered: string, priorText: string, fields: Omit<CappedHandoff, 'incomplete' | 'incompleteReason'>): Message;
@@ -1,5 +1,6 @@
1
1
  import type { ZodError, ZodType } from 'zod';
2
2
  import type { Message } from '../types.js';
3
+ import { type CappedHandoff } from './capped-handoff.js';
3
4
  import { type Signal } from '../signal-block.js';
4
5
  export type SubagentStatus = 'idle' | 'running' | 'succeeded' | 'failed' | 'cancelled';
5
6
  export declare const STREAM_INCOMPLETE = "stream_incomplete";
@@ -33,7 +34,7 @@ export interface SubagentTrace {
33
34
  };
34
35
  }
35
36
  export declare function createEmptyTrace(): SubagentTrace;
36
- export interface SubagentResult<T = unknown> {
37
+ export interface SubagentResult<T = unknown> extends Partial<CappedHandoff> {
37
38
  id: string;
38
39
  status: SubagentStatus;
39
40
  message?: Message;
@@ -633,6 +633,9 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
633
633
  stream_accepted_after_drop: "stream_accepted_after_drop";
634
634
  connection_retry: "connection_retry";
635
635
  connection_retry_exhausted: "connection_retry_exhausted";
636
+ connection_failure: "connection_failure";
637
+ connection_recovered: "connection_recovered";
638
+ connection_budget_exhausted: "connection_budget_exhausted";
636
639
  usage_notice: "usage_notice";
637
640
  tool_degraded: "tool_degraded";
638
641
  strategy_nudge_fired: "strategy_nudge_fired";
@@ -1046,6 +1049,9 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1046
1049
  stream_accepted_after_drop: "stream_accepted_after_drop";
1047
1050
  connection_retry: "connection_retry";
1048
1051
  connection_retry_exhausted: "connection_retry_exhausted";
1052
+ connection_failure: "connection_failure";
1053
+ connection_recovered: "connection_recovered";
1054
+ connection_budget_exhausted: "connection_budget_exhausted";
1049
1055
  usage_notice: "usage_notice";
1050
1056
  tool_degraded: "tool_degraded";
1051
1057
  strategy_nudge_fired: "strategy_nudge_fired";
@@ -31,6 +31,9 @@ export declare const SessionPhaseNameSchema: z.ZodEnum<{
31
31
  stream_accepted_after_drop: "stream_accepted_after_drop";
32
32
  connection_retry: "connection_retry";
33
33
  connection_retry_exhausted: "connection_retry_exhausted";
34
+ connection_failure: "connection_failure";
35
+ connection_recovered: "connection_recovered";
36
+ connection_budget_exhausted: "connection_budget_exhausted";
34
37
  usage_notice: "usage_notice";
35
38
  tool_degraded: "tool_degraded";
36
39
  strategy_nudge_fired: "strategy_nudge_fired";
@@ -74,6 +77,9 @@ export declare const SessionPhasePayloadSchema: z.ZodObject<{
74
77
  stream_accepted_after_drop: "stream_accepted_after_drop";
75
78
  connection_retry: "connection_retry";
76
79
  connection_retry_exhausted: "connection_retry_exhausted";
80
+ connection_failure: "connection_failure";
81
+ connection_recovered: "connection_recovered";
82
+ connection_budget_exhausted: "connection_budget_exhausted";
77
83
  usage_notice: "usage_notice";
78
84
  tool_degraded: "tool_degraded";
79
85
  strategy_nudge_fired: "strategy_nudge_fired";
@@ -55,6 +55,12 @@ export interface SubagentStartedPayload {
55
55
  maxToolUseIterations?: number;
56
56
  }
57
57
  export interface SubagentSucceededPayload {
58
+ incomplete?: true;
59
+ incompleteReason?: string;
60
+ roundsUsed?: number;
61
+ budget?: number;
62
+ journalPath?: string;
63
+ salvaged?: true;
58
64
  transition: 'succeeded';
59
65
  subagentId: string;
60
66
  durationMs: number;
@@ -1,4 +1,4 @@
1
- export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'interrupt_halt' | 'rate_limit' | 'ttfb_timeout' | 'usage_limit_pause' | 'usage_limit_resume' | 'overload_pause' | 'overload_resume' | 'idle_watchdog_fired' | 'pause_extension_granted' | 'suspected_loop' | 'compaction_disabled' | 'boot_warning' | 'workspace_subscribed' | 'workspace_delivery' | 'gate_shape' | 'session_id_assigned' | 'many_image_degraded' | 'stream_accepted_after_drop' | 'connection_retry' | 'connection_retry_exhausted' | 'usage_notice' | 'tool_degraded' | 'strategy_nudge_fired' | 'stop_inject_dropped' | 'stop_hook_continuation' | 'stop_hook_cap_reached' | 'orphan_repair' | 'background_process_started' | 'background_process_settled';
1
+ export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'interrupt_halt' | 'rate_limit' | 'ttfb_timeout' | 'usage_limit_pause' | 'usage_limit_resume' | 'overload_pause' | 'overload_resume' | 'idle_watchdog_fired' | 'pause_extension_granted' | 'suspected_loop' | 'compaction_disabled' | 'boot_warning' | 'workspace_subscribed' | 'workspace_delivery' | 'gate_shape' | 'session_id_assigned' | 'many_image_degraded' | 'stream_accepted_after_drop' | 'connection_retry' | 'connection_retry_exhausted' | 'connection_failure' | 'connection_recovered' | 'connection_budget_exhausted' | 'usage_notice' | 'tool_degraded' | 'strategy_nudge_fired' | 'stop_inject_dropped' | 'stop_hook_continuation' | 'stop_hook_cap_reached' | 'orphan_repair' | 'background_process_started' | 'background_process_settled';
2
2
  export interface SessionPhasePayload {
3
3
  phase: SessionPhaseName;
4
4
  durationMs?: number;
@@ -120,6 +120,8 @@ export interface ProgressEvent {
120
120
  taskId: string;
121
121
  description: string;
122
122
  summary?: string;
123
+ roundsUsed?: number;
124
+ budget?: number;
123
125
  lastToolName?: string;
124
126
  totalTokens: number;
125
127
  toolUses: number;