agent-afk 5.23.1 → 5.24.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.
- package/dist/agent/providers/anthropic-direct/query/retry-layer.d.ts +2 -0
- package/dist/agent/shadow-verify-nudge.d.ts +1 -0
- package/dist/agent/subagent/handle.d.ts +1 -0
- package/dist/agent/subagent/result.d.ts +3 -2
- package/dist/agent/tools/subagent/background-branch.d.ts +13 -0
- package/dist/agent/tools/subagent/child-config.d.ts +39 -0
- package/dist/agent/tools/subagent/failure-payload.d.ts +18 -0
- package/dist/agent/tools/subagent/foreground-promotion.d.ts +31 -0
- package/dist/agent/tools/subagent/input-parse.d.ts +14 -0
- package/dist/agent/tools/subagent-executor.d.ts +2 -1
- package/dist/agent/types/sdk-types.d.ts +1 -0
- package/dist/cli/commands/interactive/shared.d.ts +1 -1
- package/dist/cli/commands/interactive.d.ts +2 -1
- package/dist/cli/config.d.ts +1 -0
- package/dist/cli.mjs +479 -479
- package/dist/config/env.d.ts +1 -0
- package/dist/index.mjs +196 -196
- package/dist/telegram.mjs +247 -247
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type Anthropic from '@anthropic-ai/sdk';
|
|
2
2
|
import type { ProviderEvent } from '../../../provider.js';
|
|
3
3
|
import type { AuthMode, RunTurnInput } from '../types.js';
|
|
4
|
+
export declare const RATE_LIMIT_TRANSIENT_MAX_RETRIES = 3;
|
|
5
|
+
export declare const RATE_LIMIT_RETRY_MAX_WAIT_MS = 120000;
|
|
4
6
|
export interface RetryLayerOptions {
|
|
5
7
|
client: Anthropic;
|
|
6
8
|
authMode: AuthMode;
|
|
@@ -43,6 +43,7 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
|
|
|
43
43
|
private parentId;
|
|
44
44
|
private currentTrace;
|
|
45
45
|
private lastStreamedContent;
|
|
46
|
+
private lastStopReason;
|
|
46
47
|
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?: TraceWriter | undefined, onSubagentSucceeded?: ((usage: SubagentTrace["usage"], costUsd: number | undefined) => void) | undefined);
|
|
47
48
|
get status(): SubagentStatus;
|
|
48
49
|
run(prompt: string, sinkOverride?: SubagentProgressSink): Promise<Message>;
|
|
@@ -37,9 +37,10 @@ export interface SubagentResult<T = unknown> {
|
|
|
37
37
|
completionPercent?: number;
|
|
38
38
|
trace?: SubagentTrace;
|
|
39
39
|
signal?: Signal;
|
|
40
|
+
stopReason?: string;
|
|
40
41
|
}
|
|
41
|
-
export declare function buildResultFromMessage<T>(id: string, status: SubagentStatus, message: Message, outputSchema: ZodType<T> | undefined, trace?: SubagentTrace): SubagentResult<T>;
|
|
42
|
-
export declare function buildResultFromError<T>(id: string, status: SubagentStatus, err: unknown, trace?: SubagentTrace): SubagentResult<T>;
|
|
42
|
+
export declare function buildResultFromMessage<T>(id: string, status: SubagentStatus, message: Message, outputSchema: ZodType<T> | undefined, trace?: SubagentTrace, stopReason?: string): SubagentResult<T>;
|
|
43
|
+
export declare function buildResultFromError<T>(id: string, status: SubagentStatus, err: unknown, trace?: SubagentTrace, stopReason?: string): SubagentResult<T>;
|
|
43
44
|
export declare function describeFailure(result: Pick<SubagentResult, 'status' | 'error'>): string;
|
|
44
45
|
export interface SubagentExecutionError extends Error {
|
|
45
46
|
partialOutput?: unknown;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type BackgroundAgentRegistry } from '../../background-registry.js';
|
|
2
|
+
import type { SubagentManager } from '../../subagent.js';
|
|
3
|
+
import type { ToolResult } from '../types.js';
|
|
4
|
+
type ForkedHandle = Awaited<ReturnType<SubagentManager['forkSubagent']>>;
|
|
5
|
+
export interface RunBackgroundBranchArgs {
|
|
6
|
+
handle: ForkedHandle;
|
|
7
|
+
registry: BackgroundAgentRegistry | undefined;
|
|
8
|
+
prompt: string;
|
|
9
|
+
model: string | undefined;
|
|
10
|
+
parentSessionId: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare function runBackgroundBranch(args: RunBackgroundBranchArgs): Promise<ToolResult>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SubagentManager } from '../../subagent.js';
|
|
2
|
+
import type { ModelProvider } from '../../provider.js';
|
|
3
|
+
import type { AgentModelInput } from '../../types.js';
|
|
4
|
+
import type { AgentConfig } from '../../types/config-types.js';
|
|
5
|
+
import { createStubParentSession, type ChildProviderFactoryArgs } from '../nesting.js';
|
|
6
|
+
import type { RegisteredAgent } from '../../agents/index.js';
|
|
7
|
+
import type { AgentRegistry } from '../../agents/index.js';
|
|
8
|
+
import type { SkillExecutor } from '../skill-executor.js';
|
|
9
|
+
import type { Surface } from '../../awareness/types.js';
|
|
10
|
+
import type { SubagentExecutor, SubagentExecutorContext } from '../subagent-executor.js';
|
|
11
|
+
import type { AgentInput } from './input-parse.js';
|
|
12
|
+
export type ChildParentSession = ReturnType<typeof createStubParentSession> & {
|
|
13
|
+
sessionId: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export interface BuildChildConfigArgs {
|
|
16
|
+
parsed: AgentInput;
|
|
17
|
+
namedAgent: RegisteredAgent | undefined;
|
|
18
|
+
depth: number;
|
|
19
|
+
maxDepth: number;
|
|
20
|
+
currentCwd: string | undefined;
|
|
21
|
+
signal: AbortSignal;
|
|
22
|
+
defaultConfig: Pick<AgentConfig, 'apiKey' | 'systemPrompt' | 'baseUrl' | 'openaiBaseUrl'>;
|
|
23
|
+
resolveApiKeyForModel?: (model: string) => string | undefined;
|
|
24
|
+
defaultSubagentModel?: AgentModelInput;
|
|
25
|
+
childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
26
|
+
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string) => SkillExecutor;
|
|
27
|
+
surface?: Surface;
|
|
28
|
+
allowedTools?: string[];
|
|
29
|
+
readOnlyBash?: boolean;
|
|
30
|
+
agentRegistry?: AgentRegistry;
|
|
31
|
+
parentModel?: AgentModelInput;
|
|
32
|
+
createChildExecutor: (ctx: SubagentExecutorContext) => SubagentExecutor;
|
|
33
|
+
}
|
|
34
|
+
export interface BuildChildConfigResult {
|
|
35
|
+
childConfig: AgentConfig;
|
|
36
|
+
childParentSession: ChildParentSession | undefined;
|
|
37
|
+
childManager: SubagentManager | undefined;
|
|
38
|
+
}
|
|
39
|
+
export declare function buildChildConfig(args: BuildChildConfigArgs): BuildChildConfigResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { appendRoutingDecision } from '../../routing-telemetry.js';
|
|
2
|
+
export declare function emitTelemetry(entry: Parameters<typeof appendRoutingDecision>[0]): Promise<void>;
|
|
3
|
+
export declare function truncate(s: string, max?: number): string;
|
|
4
|
+
export declare function measurePartial(partial: unknown): number | undefined;
|
|
5
|
+
export interface StructuredFailurePayload {
|
|
6
|
+
status: string;
|
|
7
|
+
error: string;
|
|
8
|
+
schemaError?: string;
|
|
9
|
+
partialOutput?: unknown;
|
|
10
|
+
subagent_id: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function buildFailurePayload(args: {
|
|
13
|
+
status: string;
|
|
14
|
+
errorMessage: string;
|
|
15
|
+
schemaErrorMessage?: string;
|
|
16
|
+
partialOutput?: unknown;
|
|
17
|
+
subagentId: string;
|
|
18
|
+
}): StructuredFailurePayload;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { BackgroundAgentRegistry } from '../../background-registry.js';
|
|
2
|
+
import type { SubagentManager } from '../../subagent.js';
|
|
3
|
+
import type { TraceOrigin, TraceActor } from '../../session/session-identity.js';
|
|
4
|
+
import type { ToolResult } from '../types.js';
|
|
5
|
+
import type { PromotedSubagentInfo } from '../subagent-executor.js';
|
|
6
|
+
type ForkedHandle = Awaited<ReturnType<SubagentManager['forkSubagent']>>;
|
|
7
|
+
export interface PromotionTrigger {
|
|
8
|
+
fire: () => void;
|
|
9
|
+
ready: Promise<PromotedSubagentInfo | null>;
|
|
10
|
+
}
|
|
11
|
+
export interface RunForegroundArgs {
|
|
12
|
+
handle: ForkedHandle;
|
|
13
|
+
signal: AbortSignal;
|
|
14
|
+
prompt: string;
|
|
15
|
+
idPrefix: string | undefined;
|
|
16
|
+
model: string | undefined;
|
|
17
|
+
childManager: SubagentManager | undefined;
|
|
18
|
+
identity: {
|
|
19
|
+
origin?: TraceOrigin;
|
|
20
|
+
actor?: TraceActor;
|
|
21
|
+
};
|
|
22
|
+
depth: number;
|
|
23
|
+
parentSessionId: string | undefined;
|
|
24
|
+
registry: BackgroundAgentRegistry | undefined;
|
|
25
|
+
promotionTriggers: Map<string, PromotionTrigger>;
|
|
26
|
+
activeForegroundHandles: Map<string, {
|
|
27
|
+
cancel: () => Promise<void>;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export declare function runForegroundWithPromotion(args: RunForegroundArgs): Promise<ToolResult>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type AgentExecutionMode = 'foreground' | 'background';
|
|
2
|
+
export interface AgentInput {
|
|
3
|
+
prompt: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
max_turns?: number;
|
|
6
|
+
max_turns_explicit: boolean;
|
|
7
|
+
max_tool_use_iterations?: number;
|
|
8
|
+
max_tool_use_iterations_explicit: boolean;
|
|
9
|
+
id_prefix?: string;
|
|
10
|
+
agent_type?: string;
|
|
11
|
+
mode: AgentExecutionMode;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseAgentInput(input: unknown): AgentInput;
|
|
@@ -8,7 +8,9 @@ import { type ChildProviderFactoryArgs } from './nesting.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 AgentExecutionMode } from './subagent/input-parse.js';
|
|
11
12
|
export { DEFAULT_MAX_NESTING_DEPTH, type ChildProviderFactoryArgs } from './nesting.js';
|
|
13
|
+
export type { AgentExecutionMode };
|
|
12
14
|
export interface SubagentExecutorContext {
|
|
13
15
|
subagentManager: SubagentManager;
|
|
14
16
|
parentSession: Pick<IAgentSession, 'sessionId' | 'getInputStreamRef' | 'abortSignal'> & Partial<Pick<IAgentSession, 'hookRegistry'>>;
|
|
@@ -28,7 +30,6 @@ export interface SubagentExecutorContext {
|
|
|
28
30
|
agentRegistry?: AgentRegistry;
|
|
29
31
|
parentModel?: AgentModelInput;
|
|
30
32
|
}
|
|
31
|
-
export type AgentExecutionMode = 'foreground' | 'background';
|
|
32
33
|
export interface PromotedSubagentInfo {
|
|
33
34
|
jobId: string;
|
|
34
35
|
label: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { type SkipReason } from './interactive/worktree-autoname.js';
|
|
3
3
|
import { type CliConfig } from '../config.js';
|
|
4
|
-
import type { CliOptions } from './interactive/shared.js';
|
|
4
|
+
import type { CliOptions, ThinkingUiMode } from './interactive/shared.js';
|
|
5
5
|
import { type UpdateInfo } from '../update-checker.js';
|
|
6
6
|
export { formatToolResultLine } from './interactive/tool-lane.js';
|
|
7
7
|
export declare function setInteractiveUpdateNotices(updateInfo: UpdateInfo | null, pendingMessage: string | null): void;
|
|
8
8
|
export declare function formatAutonameSkipReason(reason: SkipReason | 'create-failed' | 'unknown', detail: string | undefined): string | undefined;
|
|
9
9
|
export declare function isAutonameEnabled(options: CliOptions, config: CliConfig): boolean;
|
|
10
|
+
export declare function resolveThinkingUi(options: CliOptions, config: CliConfig): ThinkingUiMode;
|
|
10
11
|
export declare function startupHintLine(): string;
|
|
11
12
|
export declare function registerInteractiveCommand(program: Command): void;
|
package/dist/cli/config.d.ts
CHANGED