agent-afk 5.115.2 → 5.115.4
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.
- package/dist/agent/abort-graph.d.ts +3 -3
- package/dist/agent/afk-mode-gate.d.ts +2 -2
- package/dist/agent/background-registry.d.ts +3 -3
- package/dist/agent/daemon/scheduler.d.ts +2 -1
- package/dist/agent/default-hook-registry.d.ts +2 -2
- package/dist/agent/mcp/manager.d.ts +2 -2
- package/dist/agent/providers/anthropic-direct/build-dispatcher.d.ts +2 -2
- package/dist/agent/providers/anthropic-direct/query/compact-handler.d.ts +1 -1
- package/dist/agent/providers/anthropic-direct/query-maintenance.d.ts +1 -1
- package/dist/agent/providers/anthropic-direct/query-options.d.ts +1 -1
- package/dist/agent/providers/anthropic-direct/query-turn-driver.d.ts +1 -1
- package/dist/agent/providers/anthropic-direct/request-types.d.ts +1 -1
- package/dist/agent/providers/anthropic-direct/tracing-fetch.d.ts +2 -2
- package/dist/agent/providers/openai-compatible/compact.d.ts +2 -2
- package/dist/agent/providers/openai-compatible/query/dispatch-append.d.ts +2 -2
- package/dist/agent/providers/openai-compatible/query/stream-drive.d.ts +2 -2
- package/dist/agent/providers/openai-compatible/query.d.ts +2 -2
- package/dist/agent/providers/shared/turn-trace.d.ts +2 -2
- package/dist/agent/query.d.ts +2 -0
- package/dist/agent/session/agent-session.d.ts +3 -2
- package/dist/agent/session/closure-emitter.d.ts +2 -2
- package/dist/agent/session/hooks-dispatch.d.ts +2 -2
- package/dist/agent/session/stream-consumer.d.ts +2 -2
- package/dist/agent/session/wire-executors.d.ts +3 -3
- package/dist/agent/subagent/fork-types.d.ts +2 -2
- package/dist/agent/subagent/handle.d.ts +2 -2
- package/dist/agent/subagent-hooks.d.ts +2 -2
- package/dist/agent/subagent.d.ts +2 -2
- package/dist/agent/tools/compose-executor.d.ts +3 -3
- package/dist/agent/tools/dispatcher.d.ts +2 -2
- package/dist/agent/tools/nesting.d.ts +2 -2
- package/dist/agent/tools/skill-executor/types.d.ts +2 -2
- package/dist/agent/tools/skill-executor.d.ts +2 -2
- package/dist/agent/tools/subagent/child-config.d.ts +2 -2
- package/dist/agent/tools/subagent/foreground-promotion.d.ts +2 -2
- package/dist/agent/tools/subagent-executor.d.ts +3 -3
- package/dist/agent/tools/types.d.ts +2 -2
- package/dist/agent/trace/emit.d.ts +13 -13
- package/dist/agent/trace/index.d.ts +1 -1
- package/dist/agent/trace/writer.d.ts +3 -1
- package/dist/agent/types/config-types.d.ts +2 -2
- package/dist/cli/commands/daemon.d.ts +1 -1
- package/dist/cli/commands/interactive/boot-warning-recorder.d.ts +2 -2
- package/dist/cli/commands/interactive/bootstrap-hooks.d.ts +2 -2
- package/dist/cli/commands/interactive/bootstrap-mcp.d.ts +2 -2
- package/dist/cli.mjs +349 -349
- package/dist/index.mjs +4 -4
- package/dist/skills/index.d.ts +2 -2
- package/dist/skills/mint/_phases/build.d.ts +2 -2
- package/dist/skills/mint/_phases/heal.d.ts +2 -2
- package/dist/skills/mint/_phases/parallelize-dispatch.d.ts +2 -2
- package/dist/skills/mint/_phases/plan.d.ts +2 -2
- package/dist/skills/mint/_phases/research.d.ts +2 -2
- package/dist/skills/mint/_phases/ship.d.ts +2 -2
- package/dist/skills/mint/_phases/spec.d.ts +2 -2
- package/dist/skills/mint/_phases/verify.d.ts +2 -2
- package/dist/telegram/construct-session.d.ts +1 -1
- package/dist/telegram.mjs +5 -5
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbortOrigin,
|
|
1
|
+
import type { AbortOrigin, TraceSink } from './trace/index.js';
|
|
2
2
|
export interface ChildAbortedEvent {
|
|
3
3
|
parentId: string;
|
|
4
4
|
childId: string;
|
|
@@ -8,8 +8,8 @@ export type ChildAbortedListener = (event: ChildAbortedEvent) => void;
|
|
|
8
8
|
export declare class AbortGraph {
|
|
9
9
|
private readonly nodes;
|
|
10
10
|
private traceWriter;
|
|
11
|
-
constructor(traceWriter?:
|
|
12
|
-
setTraceWriter(writer:
|
|
11
|
+
constructor(traceWriter?: TraceSink);
|
|
12
|
+
setTraceWriter(writer: TraceSink | undefined): void;
|
|
13
13
|
register(id: string, controller: AbortController): void;
|
|
14
14
|
rearm(id: string, controller: AbortController): void;
|
|
15
15
|
has(id: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import type {
|
|
4
|
+
import type { TraceSink } from './trace/index.js';
|
|
5
5
|
export interface AfkModeGateOptions {
|
|
6
6
|
approvalTimeoutMs?: number;
|
|
7
7
|
promptForApproval?: boolean;
|
|
@@ -11,6 +11,6 @@ export interface AfkModeGateOptions {
|
|
|
11
11
|
sessionId?: string;
|
|
12
12
|
}) => Promise<ElicitationResult>;
|
|
13
13
|
sessionId?: string;
|
|
14
|
-
traceWriter?:
|
|
14
|
+
traceWriter?: TraceSink;
|
|
15
15
|
}
|
|
16
16
|
export declare function createAfkModeGate(getMode: () => PermissionMode, cwd?: string, getCwd?: () => string | undefined, opts?: AfkModeGateOptions): HookHandler;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
import type { SubagentHandle, SubagentResult } from './subagent.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TraceSink } from './trace/index.js';
|
|
4
4
|
export type BackgroundJobStatus = 'running' | 'completed' | 'failed' | 'cancelled';
|
|
5
5
|
export interface BackgroundJob {
|
|
6
6
|
readonly jobId: string;
|
|
@@ -14,7 +14,7 @@ export interface BackgroundJob {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const MAX_TRANSCRIPT_TAIL_BYTES = 4096;
|
|
16
16
|
export interface BackgroundRegistryOptions {
|
|
17
|
-
traceWriter?:
|
|
17
|
+
traceWriter?: TraceSink | undefined;
|
|
18
18
|
maxConcurrentJobs?: number;
|
|
19
19
|
}
|
|
20
20
|
export interface RegisterArgs {
|
|
@@ -37,7 +37,7 @@ export declare class BackgroundAgentRegistry extends EventEmitter<BackgroundRegi
|
|
|
37
37
|
private traceWriter;
|
|
38
38
|
private readonly maxConcurrentJobs;
|
|
39
39
|
constructor(options?: BackgroundRegistryOptions);
|
|
40
|
-
setTraceWriter(writer:
|
|
40
|
+
setTraceWriter(writer: TraceSink | undefined): void;
|
|
41
41
|
register(args: RegisterArgs): BackgroundJob;
|
|
42
42
|
adoptRunning(args: RegisterArgs & {
|
|
43
43
|
runPromise: Promise<SubagentResult>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExecFileFn } from '../worktree-sweep.js';
|
|
2
2
|
import { AgentSession } from '../session/agent-session.js';
|
|
3
|
+
import type { TraceWriter } from '../trace/index.js';
|
|
3
4
|
import type { AgentConfig } from '../types.js';
|
|
4
5
|
import { ScheduledTask } from './triggers.js';
|
|
5
6
|
import { type SessionStartSkipReason } from './gates.js';
|
|
@@ -8,7 +9,7 @@ export declare function daemonTraceLabel(taskId: string): string;
|
|
|
8
9
|
export interface SchedulerOptions {
|
|
9
10
|
sessionConfig?: Partial<AgentConfig>;
|
|
10
11
|
telemetryPath?: string;
|
|
11
|
-
sessionFactory?: (config: AgentConfig) => AgentSession;
|
|
12
|
+
sessionFactory?: (config: AgentConfig, ownedTraceWriter?: TraceWriter) => AgentSession;
|
|
12
13
|
cooldownMs?: number;
|
|
13
14
|
now?: () => number;
|
|
14
15
|
onTaskComplete?: (record: TelemetryRecord, details?: TaskCompletionDetails) => void | Promise<void>;
|
|
@@ -2,7 +2,7 @@ import { type HookRegistry } from './hooks.js';
|
|
|
2
2
|
import { MemoryStore } from './memory/index.js';
|
|
3
3
|
import type { GrantManager } from '../cli/slash/commands/allow-dir.js';
|
|
4
4
|
import type { PermissionMode } from './types/sdk-types.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { TraceSink } from './trace/index.js';
|
|
6
6
|
import type { LoadedHooksConfig } from './hooks/config-loader.js';
|
|
7
7
|
export interface SubagentCompleteInfo {
|
|
8
8
|
subagentId: string;
|
|
@@ -21,6 +21,6 @@ export declare function _resetWarningForTests(): void;
|
|
|
21
21
|
export declare function createDefaultHookRegistry(onSubagentComplete?: (info: SubagentCompleteInfo) => void, surface?: string, memoryStore?: MemoryStore, getPermissionMode?: () => PermissionMode, hookConfig?: LoadedHooksConfig, agentOptions?: {
|
|
22
22
|
cwd?: string;
|
|
23
23
|
sessionId?: string;
|
|
24
|
-
traceWriter?:
|
|
24
|
+
traceWriter?: TraceSink;
|
|
25
25
|
afkPromptForApproval?: boolean;
|
|
26
26
|
}, getCwd?: () => string | undefined): DefaultHookRegistryResult;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AnthropicToolDef, ToolHandler } from '../tools/types.js';
|
|
2
2
|
import type { McpClientState, McpServerConfig } from './types.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TraceSink } from '../trace/index.js';
|
|
4
4
|
export interface McpManagerInitOptions {
|
|
5
5
|
warnings?: string[];
|
|
6
|
-
traceWriter?:
|
|
6
|
+
traceWriter?: TraceSink;
|
|
7
7
|
}
|
|
8
8
|
export declare class McpManager {
|
|
9
9
|
private readonly records;
|
|
@@ -5,7 +5,7 @@ import type { MemoryStore } from '../../memory/index.js';
|
|
|
5
5
|
import type { SubagentExecutor } from '../../tools/subagent-executor.js';
|
|
6
6
|
import type { SkillExecutor } from '../../tools/skill-executor.js';
|
|
7
7
|
import type { ComposeExecutor } from '../../tools/compose-executor.js';
|
|
8
|
-
import type {
|
|
8
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
9
9
|
import type { AnthropicToolDef, ToolHandler } from '../../tools/types.js';
|
|
10
10
|
import type { CustomToolDef } from '../../tools/custom-tool.js';
|
|
11
11
|
import type { GrantManager } from '../../../cli/slash/commands/allow-dir.js';
|
|
@@ -21,7 +21,7 @@ export interface BuildDispatcherOptions {
|
|
|
21
21
|
parentSessionId?: string;
|
|
22
22
|
subagentId?: string;
|
|
23
23
|
subagentToolOutputCapBytes?: number;
|
|
24
|
-
traceWriter?:
|
|
24
|
+
traceWriter?: TraceSink;
|
|
25
25
|
runtimeStateSource?: RuntimeStateSource;
|
|
26
26
|
hookRegistry?: HookRegistry;
|
|
27
27
|
planExitControls?: PlanExitControls;
|
|
@@ -7,6 +7,6 @@ export interface CompactHandlerDeps {
|
|
|
7
7
|
abort: AbortCoordinator;
|
|
8
8
|
retry: RetryLayer;
|
|
9
9
|
initSessionId: string;
|
|
10
|
-
traceWriter?: import('../../../trace/index.js').
|
|
10
|
+
traceWriter?: import('../../../trace/index.js').TraceSink;
|
|
11
11
|
}
|
|
12
12
|
export declare function compactHistory(deps: CompactHandlerDeps): Promise<ProviderCompactResult>;
|
|
@@ -7,7 +7,7 @@ export declare function compactQueryHistory(options: {
|
|
|
7
7
|
abort: AbortCoordinator;
|
|
8
8
|
retry: RetryLayer;
|
|
9
9
|
initSessionId: string;
|
|
10
|
-
traceWriter?: import('../../trace/index.js').
|
|
10
|
+
traceWriter?: import('../../trace/index.js').TraceSink;
|
|
11
11
|
}): Promise<ProviderCompactResult>;
|
|
12
12
|
export declare function queryRewindTargets(state: SessionState): RewindTarget[];
|
|
13
13
|
export declare function rewindQueryConversation(state: SessionState, abort: AbortCoordinator, turnIndex: number): ProviderRewindConversationResult;
|
|
@@ -24,7 +24,7 @@ export interface AnthropicDirectQueryOptions {
|
|
|
24
24
|
baseUrl?: string;
|
|
25
25
|
maxToolUseIterations?: number;
|
|
26
26
|
softDeadlineMs?: number;
|
|
27
|
-
traceWriter?: import('../../trace/index.js').
|
|
27
|
+
traceWriter?: import('../../trace/index.js').TraceSink;
|
|
28
28
|
subagentId?: string;
|
|
29
29
|
autoResumeOnUsageLimit?: boolean;
|
|
30
30
|
surface?: string;
|
|
@@ -18,7 +18,7 @@ export interface TurnDriverContext {
|
|
|
18
18
|
readonly baseUrl: string | undefined;
|
|
19
19
|
readonly maxToolUseIterations: number | undefined;
|
|
20
20
|
readonly softDeadlineMs: number | undefined;
|
|
21
|
-
readonly traceWriter: import('../../trace/index.js').
|
|
21
|
+
readonly traceWriter: import('../../trace/index.js').TraceSink | undefined;
|
|
22
22
|
readonly subagentId: string | undefined;
|
|
23
23
|
readonly mcpManager: import('../../mcp/index.js').McpManager | undefined;
|
|
24
24
|
readonly hookRegistry: HookRegistry | undefined;
|
|
@@ -18,7 +18,7 @@ export interface RunTurnInput {
|
|
|
18
18
|
effort?: import('../../types/sdk-types.js').EffortLevel;
|
|
19
19
|
fastMode?: boolean;
|
|
20
20
|
baseUrl?: string;
|
|
21
|
-
traceWriter?: import('../../trace/index.js').
|
|
21
|
+
traceWriter?: import('../../trace/index.js').TraceSink;
|
|
22
22
|
subagentId?: string;
|
|
23
23
|
onUsageProgress?: (usage: ProviderUsage) => void;
|
|
24
24
|
throttleQueue?: import('./throttle-queue.js').ThrottleQueue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
2
2
|
export interface ThrottleInfo {
|
|
3
3
|
status: number;
|
|
4
4
|
retryAfterMs?: number;
|
|
5
5
|
}
|
|
6
|
-
export declare function makeTracingFetch(writer:
|
|
6
|
+
export declare function makeTracingFetch(writer: TraceSink | undefined, baseFetch?: typeof fetch, onThrottle?: (info: ThrottleInfo) => void, onQuota?: (headers: Headers) => void): typeof fetch;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderCompactResult } from '../../provider.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
3
3
|
import type { CompactionTrigger } from '../../trace/types.js';
|
|
4
4
|
import { type CompactionOps, type MicrocompactOps, type MicrocompactOptions, type MicrocompactResult } from '../shared/compaction.js';
|
|
5
5
|
import type { OpenAIMessage } from './messages.js';
|
|
@@ -17,7 +17,7 @@ export interface CompactOpenAIHistoryDeps {
|
|
|
17
17
|
beginAbort: () => AbortController;
|
|
18
18
|
clearAbort: (controller: AbortController) => void;
|
|
19
19
|
trigger?: CompactionTrigger;
|
|
20
|
-
traceWriter?:
|
|
20
|
+
traceWriter?: TraceSink;
|
|
21
21
|
usedFraction?: number;
|
|
22
22
|
shrinkAtFraction?: number;
|
|
23
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TraceSink } from '../../../trace/index.js';
|
|
2
2
|
import type { ProviderEvent } from '../../../provider.js';
|
|
3
3
|
import type { ToolDispatcher } from '../../anthropic-direct/tool-dispatcher.js';
|
|
4
4
|
import type { ToolResult } from '../../anthropic-direct/types.js';
|
|
@@ -9,7 +9,7 @@ export interface DispatchAndAppendInput {
|
|
|
9
9
|
signal: AbortSignal;
|
|
10
10
|
vision: boolean;
|
|
11
11
|
toolDispatcher: ToolDispatcher | undefined;
|
|
12
|
-
traceWriter:
|
|
12
|
+
traceWriter: TraceSink | undefined;
|
|
13
13
|
priorTurns: OpenAIMessage[];
|
|
14
14
|
sessionId: string;
|
|
15
15
|
subagentId?: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TraceSink } from '../../../trace/index.js';
|
|
3
3
|
import { type StreamState } from '../translate.js';
|
|
4
4
|
export interface IterationResult {
|
|
5
5
|
state: StreamState;
|
|
@@ -14,7 +14,7 @@ export interface StreamDriveStrategy<TEvent> {
|
|
|
14
14
|
}
|
|
15
15
|
export interface StreamDriveContext {
|
|
16
16
|
controller: AbortController;
|
|
17
|
-
traceWriter:
|
|
17
|
+
traceWriter: TraceSink | undefined;
|
|
18
18
|
initSessionId: string;
|
|
19
19
|
currentModel: string;
|
|
20
20
|
isClosed: () => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentConfig } from '../../types/config-types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
3
3
|
import type { ProviderQuery, ProviderEvent, ProviderUserTurn, ProviderContextUsage, ProviderRewindResult, ProviderModelInfo, ProviderCommandInfo, ProviderAgentInfo, ProviderMcpServerStatus, ProviderAccountInfo, ProviderCompactResult } from '../../provider.js';
|
|
4
4
|
import { type OpenAIAuthResolution, type AuthResolverDeps } from './auth.js';
|
|
5
5
|
import type { ToolDispatcher } from '../anthropic-direct/tool-dispatcher.js';
|
|
@@ -21,7 +21,7 @@ export interface OpenAICompatibleQueryOptions {
|
|
|
21
21
|
onCwdChange?: (cwd: string) => void;
|
|
22
22
|
mcpManager?: import('../../mcp/index.js').McpManager;
|
|
23
23
|
useResponsesApi?: boolean;
|
|
24
|
-
traceWriter?:
|
|
24
|
+
traceWriter?: TraceSink;
|
|
25
25
|
}
|
|
26
26
|
export declare class OpenAICompatibleQuery implements ProviderQuery {
|
|
27
27
|
private readonly client;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
2
2
|
export declare class TurnTrace {
|
|
3
3
|
private readonly signal;
|
|
4
4
|
private readonly traceWriter;
|
|
5
5
|
private readonly provider;
|
|
6
6
|
private interruptedAt;
|
|
7
|
-
constructor(signal: AbortSignal, traceWriter:
|
|
7
|
+
constructor(signal: AbortSignal, traceWriter: TraceSink | undefined, provider: 'anthropic-direct' | 'openai-compatible');
|
|
8
8
|
private readonly onInterrupt;
|
|
9
9
|
finish(turnElapsedMs: number): void;
|
|
10
10
|
}
|
package/dist/agent/query.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ZodType } from 'zod';
|
|
2
2
|
import type { AgentConfig, AgentModelInput, OutputEvent } from './types.js';
|
|
3
|
+
import type { TraceWriter } from './trace/index.js';
|
|
3
4
|
export type QueryOptions = Partial<Omit<AgentConfig, 'model'>> & {
|
|
4
5
|
model?: AgentModelInput;
|
|
6
|
+
ownedTraceWriter?: TraceWriter;
|
|
5
7
|
};
|
|
6
8
|
export declare function query(prompt: string, options?: QueryOptions): AsyncGenerator<OutputEvent, void, void>;
|
|
7
9
|
export declare function queryText(prompt: string, options?: QueryOptions): Promise<string>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
2
|
+
import type { TraceWriter } from '../trace/writer.js';
|
|
2
3
|
import type { HookRegistry } from '../hooks.js';
|
|
3
4
|
import type { ProviderCompactResult, ProviderQuery, ProviderRewindConversationResult, RewindTarget } from '../provider.js';
|
|
4
5
|
import { type ZodType } from 'zod';
|
|
5
6
|
import type { AccountInfo, AgentConfig, AgentInfo, AgentModelInput, IAgentSession, InputStreamRef, McpServerStatus, Message, ModelInfo, OutputEvent, PermissionMode, ResponseMetadata, RewindFilesResult, SDKControlGetContextUsageResponse, SendMessageOptions, SessionIdentity, SessionMetadata, SessionState, SlashCommand, StructuredMessageOptions } from '../types.js';
|
|
6
7
|
import type { ElicitationRequest } from '../types/sdk-types.js';
|
|
7
8
|
export declare class AgentSession implements IAgentSession {
|
|
8
|
-
private
|
|
9
|
+
private readonly ownedTraceWriter;
|
|
9
10
|
private config;
|
|
10
11
|
private readonly planExit;
|
|
11
12
|
private currentState;
|
|
@@ -35,7 +36,7 @@ export declare class AgentSession implements IAgentSession {
|
|
|
35
36
|
private subagentRunningTokens;
|
|
36
37
|
private subagentRunningCostUsd;
|
|
37
38
|
private readonly ledger;
|
|
38
|
-
constructor(config: AgentConfig);
|
|
39
|
+
constructor(config: AgentConfig, ownedTraceWriter?: TraceWriter);
|
|
39
40
|
private initSdkLifecycle;
|
|
40
41
|
private pullInitialization;
|
|
41
42
|
private buildTransformDeps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClosureReason } from '../trace/index.js';
|
|
1
|
+
import type { ClosureReason, TraceSink } from '../trace/index.js';
|
|
2
2
|
import type { TraceWriter } from '../trace/writer.js';
|
|
3
3
|
export interface ClosureTokenCounters {
|
|
4
4
|
input: number;
|
|
@@ -23,7 +23,7 @@ export interface ClosureTotals {
|
|
|
23
23
|
export interface EmitClosureInput extends ClosureSignals, ClosureTotals {
|
|
24
24
|
runningTokens: ClosureTokenCounters;
|
|
25
25
|
}
|
|
26
|
-
export declare function emitClosureEvent(writer:
|
|
26
|
+
export declare function emitClosureEvent(writer: TraceSink | undefined, input: EmitClosureInput): Promise<void>;
|
|
27
27
|
export interface SealTraceInput extends ClosureSignals, ClosureTotals {
|
|
28
28
|
subagentCompletedCount: number;
|
|
29
29
|
subagentRunningTokens: ClosureTokenCounters;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { HookRegistry, SessionEndContext, SessionStartContext } from '../hooks.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TraceSink } from '../trace/index.js';
|
|
3
3
|
export interface SessionHookDispatchOptions {
|
|
4
4
|
signal?: AbortSignal;
|
|
5
5
|
onError?: (err: Error) => void;
|
|
6
|
-
traceWriter?:
|
|
6
|
+
traceWriter?: TraceSink;
|
|
7
7
|
}
|
|
8
8
|
export declare function dispatchSessionStart(registry: HookRegistry | undefined, context: SessionStartContext, options?: SessionHookDispatchOptions): Promise<string | undefined>;
|
|
9
9
|
export declare function dispatchSessionEnd(registry: HookRegistry | undefined, context: SessionEndContext, options?: SessionHookDispatchOptions): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ProviderEvent, ProviderUsage } from '../provider.js';
|
|
2
2
|
import type { Message, OutputEvent, ResponseMetadata, SessionMetadata } from '../types.js';
|
|
3
3
|
import { BudgetExceededError } from '../../utils/errors.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TraceSink } from '../trace/index.js';
|
|
5
5
|
export type TransformDeps = {
|
|
6
6
|
conversationHistory: Message[];
|
|
7
7
|
getSessionMetadata: () => SessionMetadata;
|
|
@@ -13,7 +13,7 @@ export type TransformDeps = {
|
|
|
13
13
|
abortBudget?: (reason: BudgetExceededError) => void;
|
|
14
14
|
_runningCostUsd?: number;
|
|
15
15
|
_successfulToolNames?: string[];
|
|
16
|
-
traceWriter?:
|
|
16
|
+
traceWriter?: TraceSink;
|
|
17
17
|
};
|
|
18
18
|
export declare function parsePersistedOutput(content: string): {
|
|
19
19
|
sizeLabel: string;
|
|
@@ -4,7 +4,7 @@ import { SkillExecutor } from '../tools/skill-executor.js';
|
|
|
4
4
|
import { ComposeExecutor } from '../tools/compose-executor.js';
|
|
5
5
|
import type { SubagentExecutorContext } from '../tools/subagent-executor.js';
|
|
6
6
|
import type { BackgroundAgentRegistry } from '../background-registry.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { TraceSink } from '../trace/writer.js';
|
|
8
8
|
import type { Surface } from '../awareness/types.js';
|
|
9
9
|
import type { AgentModelInput } from '../types.js';
|
|
10
10
|
export interface WireExecutorsOptions {
|
|
@@ -20,8 +20,8 @@ export interface WireExecutorsOptions {
|
|
|
20
20
|
openaiBaseUrl?: string;
|
|
21
21
|
cwd?: string;
|
|
22
22
|
nestedCwd?: string;
|
|
23
|
-
traceWriter?:
|
|
24
|
-
skillTraceWriter?:
|
|
23
|
+
traceWriter?: TraceSink;
|
|
24
|
+
skillTraceWriter?: TraceSink;
|
|
25
25
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
26
26
|
agentRegistryWarn?: (message: string) => void;
|
|
27
27
|
}
|
|
@@ -3,7 +3,7 @@ import type { CanUseTool } from '../types/sdk-types.js';
|
|
|
3
3
|
import type { HookRegistry } from '../hooks.js';
|
|
4
4
|
import type { AgentConfig, IAgentSession } from '../types.js';
|
|
5
5
|
import type { SubagentProgressSink } from '../types/session-types.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { TraceSink } from '../trace/index.js';
|
|
7
7
|
import type { Surface } from '../awareness/types.js';
|
|
8
8
|
import type { PhaseRole } from '../tools/nesting.js';
|
|
9
9
|
export interface ForkParent {
|
|
@@ -32,7 +32,7 @@ export interface SubagentManagerOptions {
|
|
|
32
32
|
parentModel?: string;
|
|
33
33
|
cwd?: string;
|
|
34
34
|
parentReadRoots?: string[];
|
|
35
|
-
traceWriter?:
|
|
35
|
+
traceWriter?: TraceSink;
|
|
36
36
|
surface?: Surface;
|
|
37
37
|
onSubagentSucceeded?: (usage: import('./result.js').SubagentTrace['usage'], costUsd: number | undefined) => void;
|
|
38
38
|
}
|
|
@@ -4,7 +4,7 @@ import { AbortGraph } from '../abort-graph.js';
|
|
|
4
4
|
import type { HookRegistry } from '../hooks.js';
|
|
5
5
|
import type { IAgentSession, Message } from '../types.js';
|
|
6
6
|
import type { OutputEvent, SubagentProgressSink } from '../types/session-types.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { TraceSink } from '../trace/index.js';
|
|
8
8
|
import { type SubagentResult, type SubagentStatus, type SubagentTrace } from './result.js';
|
|
9
9
|
export interface SubagentHandle<T = unknown> {
|
|
10
10
|
readonly id: string;
|
|
@@ -47,7 +47,7 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
|
|
|
47
47
|
private lastStreamedContent;
|
|
48
48
|
private pauseCeiling;
|
|
49
49
|
private lastStopReason;
|
|
50
|
-
constructor(id: string, session: IAgentSession, controller: AbortController, abortGraph: AbortGraph, outputSchema: ZodType<T> | undefined, timeoutMs: number, hookRegistry: HookRegistry | undefined, onTerminal: () => void, parentInputStreamRef?: ReturnType<IAgentSession["getInputStreamRef"]> | undefined, parentAbortSignal?: AbortSignal | undefined, agentType?: string | undefined, progressSink?: SubagentProgressSink, parentId?: string, traceWriter?:
|
|
50
|
+
constructor(id: string, session: IAgentSession, controller: AbortController, abortGraph: AbortGraph, outputSchema: ZodType<T> | undefined, timeoutMs: number, hookRegistry: HookRegistry | undefined, onTerminal: () => void, parentInputStreamRef?: ReturnType<IAgentSession["getInputStreamRef"]> | undefined, parentAbortSignal?: AbortSignal | undefined, agentType?: string | undefined, progressSink?: SubagentProgressSink, parentId?: string, traceWriter?: TraceSink | undefined, onSubagentSucceeded?: ((usage: SubagentTrace["usage"], costUsd: number | undefined) => void) | undefined, idleTimeoutMs?: number);
|
|
51
51
|
get status(): SubagentStatus;
|
|
52
52
|
run(prompt: string | ContentBlockParam[], sinkOverride?: SubagentProgressSink): Promise<Message>;
|
|
53
53
|
private streamToFinalMessage;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { HookDecision, HookRegistry, PostToolUseContext, PostToolUseFailureContext, PreToolUseContext, SubagentStartContext, SubagentStopContext } from './hooks.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TraceSink } from './trace/index.js';
|
|
3
3
|
export interface SubagentHookDispatchOptions {
|
|
4
4
|
signal?: AbortSignal;
|
|
5
5
|
onError?: (err: Error) => void;
|
|
6
|
-
traceWriter?:
|
|
6
|
+
traceWriter?: TraceSink;
|
|
7
7
|
}
|
|
8
8
|
export declare function dispatchSubagentStart(registry: HookRegistry | undefined, context: SubagentStartContext, options?: SubagentHookDispatchOptions): Promise<void>;
|
|
9
9
|
export declare function dispatchSubagentStop(registry: HookRegistry | undefined, context: SubagentStopContext, options?: SubagentHookDispatchOptions): Promise<HookDecision>;
|
package/dist/agent/subagent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ChildAbortedListener } from './abort-graph.js';
|
|
2
|
-
import type { AbortOrigin,
|
|
2
|
+
import type { AbortOrigin, TraceSink } from './trace/index.js';
|
|
3
3
|
import { type ReadScopeInputs } from './subagent-read-scope.js';
|
|
4
4
|
import { type SubagentHandle } from './subagent/handle.js';
|
|
5
5
|
import type { SubagentStatus, SubagentResult, SubagentTrace } from './subagent/result.js';
|
|
@@ -34,7 +34,7 @@ export declare class SubagentManager {
|
|
|
34
34
|
onChildAborted(listener: ChildAbortedListener): () => void;
|
|
35
35
|
setOnSubagentSucceeded(cb: (usage: import('./subagent/result.js').SubagentTrace['usage'], costUsd: number | undefined) => void): void;
|
|
36
36
|
setCwd(cwd: string): void;
|
|
37
|
-
setTraceWriter(writer:
|
|
37
|
+
setTraceWriter(writer: TraceSink | undefined): void;
|
|
38
38
|
getReadScopeInputs(): ReadScopeInputs;
|
|
39
39
|
private resolveMainRootForCwd;
|
|
40
40
|
abortAll(reason?: unknown, origin?: AbortOrigin): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReadScopeInputs } from '../subagent-read-scope.js';
|
|
2
2
|
import type { AgentModelInput, IAgentSession } from '../types.js';
|
|
3
3
|
import type { Surface } from '../awareness/types.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { TraceSink } from '../trace/index.js';
|
|
5
5
|
import type { ToolCall, ToolResult } from './types.js';
|
|
6
6
|
export interface ComposeExecutorContext {
|
|
7
7
|
parentSession: Pick<IAgentSession, 'sessionId' | 'abortSignal'>;
|
|
@@ -12,7 +12,7 @@ export interface ComposeExecutorContext {
|
|
|
12
12
|
baseUrl?: string;
|
|
13
13
|
systemPrompt: string;
|
|
14
14
|
cwd?: string;
|
|
15
|
-
traceWriter?:
|
|
15
|
+
traceWriter?: TraceSink;
|
|
16
16
|
surface?: Surface;
|
|
17
17
|
depth?: number;
|
|
18
18
|
maxDepth?: number;
|
|
@@ -30,6 +30,6 @@ export declare class ComposeExecutor {
|
|
|
30
30
|
private currentCwd;
|
|
31
31
|
constructor(ctx: ComposeExecutorContext);
|
|
32
32
|
setCwd(cwd: string): void;
|
|
33
|
-
setTraceWriter(writer:
|
|
33
|
+
setTraceWriter(writer: TraceSink | undefined): void;
|
|
34
34
|
execute(call: ToolCall): Promise<ToolResult>;
|
|
35
35
|
}
|
|
@@ -11,7 +11,7 @@ import { type ToolPermissionConfig } from './permissions.js';
|
|
|
11
11
|
import type { CanUseTool } from '../types/sdk-types.js';
|
|
12
12
|
import { type GrantSnapshot } from './grant-manager.js';
|
|
13
13
|
import type { GrantManager } from '../../cli/slash/commands/allow-dir.js';
|
|
14
|
-
import type {
|
|
14
|
+
import type { TraceSink } from '../trace/index.js';
|
|
15
15
|
export { defaultConcurrencyClassifier } from './dispatch-batching.js';
|
|
16
16
|
export declare const REPEAT_CIRCUIT_BREAKER_THRESHOLD = 8;
|
|
17
17
|
export { DEFAULT_MAX_CONCURRENT_SAFE_TOOL_CALLS, resolveMaxConcurrentSafeToolCalls };
|
|
@@ -35,7 +35,7 @@ export interface SessionToolDispatcherOptions {
|
|
|
35
35
|
parentSessionId?: string;
|
|
36
36
|
subagentId?: string;
|
|
37
37
|
sessionGrantManager?: GrantManager;
|
|
38
|
-
traceWriter?:
|
|
38
|
+
traceWriter?: TraceSink;
|
|
39
39
|
readOnlyBash?: boolean;
|
|
40
40
|
maxOutputBytes?: number;
|
|
41
41
|
}
|
|
@@ -5,7 +5,7 @@ import type { Surface } from '../awareness/types.js';
|
|
|
5
5
|
import type { ReadScopeInputs } from '../subagent-read-scope.js';
|
|
6
6
|
import { SkillExecutor } from './skill-executor.js';
|
|
7
7
|
import type { SubagentExecutor } from './subagent-executor.js';
|
|
8
|
-
import type {
|
|
8
|
+
import type { TraceSink } from '../trace/index.js';
|
|
9
9
|
import type { BackgroundAgentRegistry } from '../background-registry.js';
|
|
10
10
|
import type { AgentRegistry } from '../agents/types.js';
|
|
11
11
|
export declare const DEFAULT_MAX_NESTING_DEPTH = 3;
|
|
@@ -27,7 +27,7 @@ export interface CreateChildProviderFactoryOptions {
|
|
|
27
27
|
}
|
|
28
28
|
export declare function createChildProviderFactory(opts?: CreateChildProviderFactoryOptions): (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
29
29
|
export declare function buildReadOnlyReconProvider(model: AgentModelInput | undefined, openaiBaseUrl?: string, allowedTools?: readonly string[]): ModelProvider;
|
|
30
|
-
export declare function createChildSkillExecutorFactory(defaultModel: AgentModelInput, apiKey: string | undefined, childProviderFactory: (args: ChildProviderFactoryArgs) => ModelProvider, baseUrl?: string, traceWriter?:
|
|
30
|
+
export declare function createChildSkillExecutorFactory(defaultModel: AgentModelInput, apiKey: string | undefined, childProviderFactory: (args: ChildProviderFactoryArgs) => ModelProvider, baseUrl?: string, traceWriter?: TraceSink, backgroundRegistry?: BackgroundAgentRegistry, cwd?: string, resolveApiKeyForModel?: (model: string) => string | undefined, surface?: Surface, defaultSubagentModel?: AgentModelInput, agentRegistry?: AgentRegistry, openaiBaseUrl?: string): (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string) => SkillExecutor;
|
|
31
31
|
export type PhaseRole = 'read-only' | 'read-write';
|
|
32
32
|
export declare function buildSkillRestrictedProvider(allowedTools: string[], model: AgentModelInput | undefined, readOnlyBash?: boolean, openaiBaseUrl?: string): ModelProvider;
|
|
33
33
|
export declare function buildPhaseRestrictedProvider(_role: 'read-only', model: AgentModelInput | undefined): ModelProvider;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentModelInput, IAgentSession } from '../../types.js';
|
|
2
2
|
import type { ModelProvider } from '../../provider.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
4
4
|
import type { BackgroundAgentRegistry } from '../../background-registry.js';
|
|
5
5
|
import type { SdkPluginConfig } from '../../types/sdk-types.js';
|
|
6
6
|
import type { ChildProviderFactoryArgs } from '../nesting.js';
|
|
@@ -21,7 +21,7 @@ export interface SkillExecutorContext {
|
|
|
21
21
|
maxDepth?: number;
|
|
22
22
|
childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
23
23
|
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string) => SkillExecutor;
|
|
24
|
-
traceWriter?:
|
|
24
|
+
traceWriter?: TraceSink;
|
|
25
25
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
26
26
|
cwd?: string;
|
|
27
27
|
getReadScopeInputs?: () => ReadScopeInputs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToolCall, ToolResult } from './types.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TraceSink } from '../trace/index.js';
|
|
3
3
|
import type { SkillExecutorContext } from './skill-executor/types.js';
|
|
4
4
|
export type { SkillExecutorContext } from './skill-executor/types.js';
|
|
5
5
|
export declare class SkillExecutor {
|
|
@@ -8,7 +8,7 @@ export declare class SkillExecutor {
|
|
|
8
8
|
private currentCwd;
|
|
9
9
|
constructor(ctx: SkillExecutorContext);
|
|
10
10
|
setCwd(cwd: string): void;
|
|
11
|
-
setTraceWriter(writer:
|
|
11
|
+
setTraceWriter(writer: TraceSink | undefined): void;
|
|
12
12
|
private internals;
|
|
13
13
|
execute(call: ToolCall): Promise<ToolResult>;
|
|
14
14
|
private executeRegistrySkill;
|
|
@@ -8,7 +8,7 @@ import type { RegisteredAgent } from '../../agents/index.js';
|
|
|
8
8
|
import type { AgentRegistry } from '../../agents/index.js';
|
|
9
9
|
import type { SkillExecutor } from '../skill-executor.js';
|
|
10
10
|
import type { Surface } from '../../awareness/types.js';
|
|
11
|
-
import type {
|
|
11
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
12
12
|
import type { SubagentExecutor, SubagentExecutorContext } from '../subagent-executor.js';
|
|
13
13
|
import type { AgentInput } from './input-parse.js';
|
|
14
14
|
export type ChildParentSession = ReturnType<typeof createStubParentSession> & {
|
|
@@ -32,7 +32,7 @@ export interface BuildChildConfigArgs {
|
|
|
32
32
|
readOnlyBash?: boolean;
|
|
33
33
|
agentRegistry?: AgentRegistry;
|
|
34
34
|
parentModel?: AgentModelInput;
|
|
35
|
-
traceWriter?:
|
|
35
|
+
traceWriter?: TraceSink;
|
|
36
36
|
createChildExecutor: (ctx: SubagentExecutorContext) => SubagentExecutor;
|
|
37
37
|
}
|
|
38
38
|
export interface BuildChildConfigResult {
|
|
@@ -2,7 +2,7 @@ import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
|
2
2
|
import type { BackgroundAgentRegistry } from '../../background-registry.js';
|
|
3
3
|
import type { SubagentManager } from '../../subagent.js';
|
|
4
4
|
import type { TraceOrigin, TraceActor } from '../../session/session-identity.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { TraceSink } from '../../trace/index.js';
|
|
6
6
|
import type { ToolResult } from '../types.js';
|
|
7
7
|
import type { PromotedSubagentInfo } from '../subagent-executor.js';
|
|
8
8
|
import { type QueuedNoteClaim } from './queued-note.js';
|
|
@@ -24,7 +24,7 @@ export interface RunForegroundArgs {
|
|
|
24
24
|
origin?: TraceOrigin;
|
|
25
25
|
actor?: TraceActor;
|
|
26
26
|
};
|
|
27
|
-
traceWriter?:
|
|
27
|
+
traceWriter?: TraceSink;
|
|
28
28
|
depth: number;
|
|
29
29
|
parentSessionId: string | undefined;
|
|
30
30
|
registry: BackgroundAgentRegistry | undefined;
|
|
@@ -9,7 +9,7 @@ import { type ChildProviderFactoryArgs } from './nesting.js';
|
|
|
9
9
|
import type { AgentRegistry } from '../agents/index.js';
|
|
10
10
|
import type { SkillExecutor } from './skill-executor.js';
|
|
11
11
|
import type { Surface } from '../awareness/types.js';
|
|
12
|
-
import type {
|
|
12
|
+
import type { TraceSink } from '../trace/index.js';
|
|
13
13
|
import { type AgentExecutionMode } from './subagent/input-parse.js';
|
|
14
14
|
import type { QueuedNoteClaim } from './subagent/queued-note.js';
|
|
15
15
|
import { type InboundAttachmentReader } from '../content/attachment-registry.js';
|
|
@@ -28,7 +28,7 @@ export interface SubagentExecutorContext {
|
|
|
28
28
|
maxDepth?: number;
|
|
29
29
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
30
30
|
cwd?: string;
|
|
31
|
-
traceWriter?:
|
|
31
|
+
traceWriter?: TraceSink;
|
|
32
32
|
allowedTools?: string[];
|
|
33
33
|
readOnlyBash?: boolean;
|
|
34
34
|
nestedAgentAllowlist?: readonly string[];
|
|
@@ -52,7 +52,7 @@ export declare class SubagentExecutor implements SubagentControl {
|
|
|
52
52
|
private isolationCounter;
|
|
53
53
|
constructor(ctx: SubagentExecutorContext);
|
|
54
54
|
setCwd(cwd: string): void;
|
|
55
|
-
setTraceWriter(writer:
|
|
55
|
+
setTraceWriter(writer: TraceSink | undefined): void;
|
|
56
56
|
describeAgentTool(): AnthropicToolDef;
|
|
57
57
|
private readonly promotionTriggers;
|
|
58
58
|
private readonly activeForegroundHandles;
|
|
@@ -3,7 +3,7 @@ export type { ToolResult, RenderHints } from '../providers/shared/tool-result.js
|
|
|
3
3
|
export type { AnthropicToolDef } from '../providers/anthropic-direct/types.js';
|
|
4
4
|
export type { ToolDispatcher } from '../providers/anthropic-direct/tool-dispatcher.js';
|
|
5
5
|
import type { ToolResult } from '../providers/shared/tool-result.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { TraceSink } from '../trace/index.js';
|
|
7
7
|
export interface ToolHandlerContext {
|
|
8
8
|
cwd?: string;
|
|
9
9
|
resolveBase?: string;
|
|
@@ -11,7 +11,7 @@ export interface ToolHandlerContext {
|
|
|
11
11
|
writeRoots?: string[];
|
|
12
12
|
env?: Record<string, string>;
|
|
13
13
|
allowAll?: boolean;
|
|
14
|
-
traceWriter?:
|
|
14
|
+
traceWriter?: TraceSink;
|
|
15
15
|
toolUseId?: string;
|
|
16
16
|
sessionId?: string;
|
|
17
17
|
}
|