agent-afk 5.23.2 → 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.
@@ -1,2 +1,3 @@
1
1
  import type { HookContext, HookDecision } from './hooks.js';
2
+ export declare function createShadowVerifyNudge(): (context: HookContext) => HookDecision;
2
3
  export declare function shadowVerifyNudge(context: HookContext): HookDecision;
@@ -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;
@@ -131,6 +131,7 @@ export type AgentDefinition = {
131
131
  skills?: string[];
132
132
  initialPrompt?: string;
133
133
  maxTurns?: number;
134
+ maxToolUseIterations?: number;
134
135
  background?: boolean;
135
136
  memory?: 'user' | 'project' | 'local';
136
137
  effort?: EffortLevel | number;
@@ -21,7 +21,7 @@ export interface CliOptions {
21
21
  model: AgentModelInput;
22
22
  maxTurns: string;
23
23
  thinking?: string;
24
- thinkingUi: ThinkingUiMode;
24
+ thinkingUi?: ThinkingUiMode;
25
25
  effort?: string;
26
26
  maxOutputTokens?: string;
27
27
  resume?: 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;
@@ -49,6 +49,7 @@ export interface CliConfig {
49
49
  worktreeBranchPrefix?: string;
50
50
  worktreeBase?: string;
51
51
  suggestGhost?: boolean;
52
+ thinkingUi?: 'summary' | 'live' | 'digest' | 'off';
52
53
  };
53
54
  updatePolicy: 'notify' | 'auto' | 'off';
54
55
  autoResumeOnUsageLimit?: boolean;