agent-afk 5.24.0 → 5.25.1

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 +1,2 @@
1
1
  export declare function supportsVision(model: string | undefined): boolean;
2
+ export declare function isOSeriesModel(model: string | undefined): boolean;
@@ -1,6 +1,6 @@
1
1
  import type { ProviderEvent } from '../../provider.js';
2
2
  import type { AnthropicToolDef, RunTurnInput, WireToolDef } from './types.js';
3
- export declare const DEFAULT_MAX_TOOL_USE_ITERATIONS = 0;
3
+ export { DEFAULT_MAX_TOOL_USE_ITERATIONS } from '../shared/tool-loop-cap.js';
4
4
  export declare function toWireTool(tool: AnthropicToolDef): WireToolDef;
5
5
  export declare const OVERLOAD_MAX_RETRIES = 3;
6
6
  export declare function isTransientServerError(err: Error): boolean;
@@ -0,0 +1,37 @@
1
+ import type { AgentConfig } from '../../../types/config-types.js';
2
+ import type { SubagentExecutor } from '../../../tools/subagent-executor.js';
3
+ import type { SkillExecutor } from '../../../tools/skill-executor.js';
4
+ import type { ComposeExecutor } from '../../../tools/compose-executor.js';
5
+ import type { ToolDispatcher } from '../tool-dispatcher.js';
6
+ import { type RuntimeStateSource } from '../../../awareness/index.js';
7
+ export type CwdDependentsFactory = (newCwd: string) => {
8
+ userSystem: string;
9
+ dispatcher: ToolDispatcher;
10
+ };
11
+ export interface CwdDependentsFactoryArgs {
12
+ stableSystemPrefix: string[];
13
+ config: AgentConfig;
14
+ surface: string;
15
+ runtimeStateSource: RuntimeStateSource;
16
+ getCurrentCwd: () => string | undefined;
17
+ setCurrentCwd: (cwd: string) => void;
18
+ getCurrentPermissionMode: () => string;
19
+ sharedReadRoots: string[] | undefined;
20
+ sharedWriteRoots: string[] | undefined;
21
+ subagentExecutor: SubagentExecutor | undefined;
22
+ skillExecutor: SkillExecutor | undefined;
23
+ composeExecutor: ComposeExecutor | undefined;
24
+ buildDispatcher: (permissionMode: string, opts: {
25
+ cwd?: string;
26
+ env?: Record<string, string>;
27
+ readRoots?: string[];
28
+ writeRoots?: string[];
29
+ sessionId?: string;
30
+ parentSessionId?: string;
31
+ traceWriter?: AgentConfig['traceWriter'];
32
+ runtimeStateSource?: RuntimeStateSource;
33
+ hookRegistry?: AgentConfig['hookRegistry'];
34
+ planExitControls?: AgentConfig['planExitControls'];
35
+ }) => ToolDispatcher;
36
+ }
37
+ export declare function createCwdDependentsFactory(args: CwdDependentsFactoryArgs): CwdDependentsFactory;
@@ -0,0 +1,13 @@
1
+ import { type RuntimeStateSource } from '../../../awareness/index.js';
2
+ export interface PresenceLifecycleArgs {
3
+ depth: number | undefined;
4
+ parentSessionId: string | undefined;
5
+ sessionId: string | undefined;
6
+ currentPresenceSessionId: string | null;
7
+ runtimeStateSource: RuntimeStateSource;
8
+ surface: string;
9
+ cwd: string | undefined;
10
+ providerName: string;
11
+ model: string;
12
+ }
13
+ export declare function registerPresenceLifecycle(args: PresenceLifecycleArgs): string | null;
@@ -0,0 +1,6 @@
1
+ import type { AgentConfig } from '../../../types/config-types.js';
2
+ export interface ResolvedQueryToken {
3
+ localMode: boolean;
4
+ token: string;
5
+ }
6
+ export declare function resolveQueryToken(config: AgentConfig): ResolvedQueryToken;
@@ -0,0 +1,15 @@
1
+ import type { TraceWriter } from '../../../trace/index.js';
2
+ import type { ProviderEvent } from '../../../provider.js';
3
+ import type { ToolDispatcher } from '../../anthropic-direct/tool-dispatcher.js';
4
+ import type { OpenAIMessage } from '../messages.js';
5
+ import type { StreamState } from '../translate.js';
6
+ export interface DispatchAndAppendInput {
7
+ state: StreamState;
8
+ signal: AbortSignal;
9
+ vision: boolean;
10
+ toolDispatcher: ToolDispatcher | undefined;
11
+ traceWriter: TraceWriter | undefined;
12
+ priorTurns: OpenAIMessage[];
13
+ sessionId: string;
14
+ }
15
+ export declare function dispatchAndAppendToolCalls({ state, signal, vision, toolDispatcher, traceWriter, priorTurns, sessionId, }: DispatchAndAppendInput): AsyncGenerator<ProviderEvent>;
@@ -1,7 +1,8 @@
1
1
  import type { EffortLevel } from '../../../types/sdk-types.js';
2
+ import { isOSeriesModel } from '../../../model-capabilities.js';
2
3
  export declare function resolveEffectiveMaxOutputTokens(model: string, configMaxOutput: number | undefined): number;
3
4
  export declare function resolveStreamingMaxTokens(model: string, configMaxOutput: number | undefined): Record<string, number>;
4
5
  export declare function normalizePermissionMode(mode: string | undefined): string;
5
- export declare function isOSeriesModel(model: string): boolean;
6
+ export { isOSeriesModel };
6
7
  export declare function mapEffortForOpenAI(effort: EffortLevel): 'low' | 'medium' | 'high';
7
8
  export declare function resolveReasoningEffort(effort: EffortLevel | undefined, model: string): 'low' | 'medium' | 'high' | undefined;
@@ -0,0 +1,5 @@
1
+ export declare const TOOL_USE_LOOP_CAPPED = "tool_use_loop_capped";
2
+ export declare const DEFAULT_MAX_TOOL_USE_ITERATIONS = 0;
3
+ export declare const WIND_DOWN_NOTE: string;
4
+ export declare function resolveMaxToolIterations(configured: number | undefined): number;
5
+ export declare function shouldWindDown(completedRounds: number, maxIterations: number): boolean;
@@ -12,6 +12,8 @@ import type { SubagentStatus, SubagentResult, SubagentTrace } from './subagent/r
12
12
  export type { SubagentStatus, SubagentResult, SubagentTrace, SubagentHandle };
13
13
  export declare const DENY_ELICITATION: NonNullable<AgentConfig['onElicitation']>;
14
14
  export declare const SUBAGENT_DEFAULT_MAX_TOOL_USE_ITERATIONS = 50;
15
+ export declare const SUBAGENT_DEFAULT_TIMEOUT_MS: number;
16
+ export declare const SUBAGENT_BACKGROUND_TIMEOUT_MS: number;
15
17
  export interface ForkParent {
16
18
  sessionId?: string;
17
19
  id?: string;
@@ -14,6 +14,7 @@ interface BuildAgentSessionDeps {
14
14
  thinking: ThinkingConfig | undefined;
15
15
  effort: EffortLevel | undefined;
16
16
  maxOutputTokens: number | undefined;
17
+ maxToolUseIterations: number | undefined;
17
18
  providerFactory: (model: string | undefined) => ModelProvider;
18
19
  hookRegistry: HookRegistry;
19
20
  traceWriter: TraceWriter | undefined;
@@ -0,0 +1,35 @@
1
+ export interface NumberValidationOptions {
2
+ allowSkip: boolean;
3
+ min?: number;
4
+ max?: number;
5
+ emptyError: string;
6
+ }
7
+ export type NumberValidationOutcome = {
8
+ ok: true;
9
+ skip: true;
10
+ } | {
11
+ ok: true;
12
+ skip: false;
13
+ value: number;
14
+ } | {
15
+ ok: false;
16
+ error: string;
17
+ };
18
+ export declare function validateNumberField(input: string, opts: NumberValidationOptions): NumberValidationOutcome;
19
+ export interface TextValidationOptions {
20
+ allowSkip: boolean;
21
+ minLength?: number;
22
+ maxLength?: number;
23
+ emptyError: string;
24
+ }
25
+ export type TextValidationOutcome = {
26
+ ok: true;
27
+ skip: true;
28
+ } | {
29
+ ok: true;
30
+ skip: false;
31
+ } | {
32
+ ok: false;
33
+ error: string;
34
+ };
35
+ export declare function validateTextField(input: string, opts: TextValidationOptions): TextValidationOutcome;
@@ -23,6 +23,8 @@ export declare function getMaxBudgetUsd(): number | undefined;
23
23
  export declare function getTaskBudget(): number | undefined;
24
24
  export declare function parseMaxOutputTokens(raw: string | undefined): number | undefined;
25
25
  export declare function getMaxOutputTokens(): number | undefined;
26
+ export declare function parseMaxToolUseIterations(raw: string | undefined): number | undefined;
27
+ export declare function getMaxToolUseIterations(): number | undefined;
26
28
  export declare function parseProvider(raw: string | undefined, opts?: {
27
29
  subagentExecutor?: import('../agent/tools/subagent-executor.js').SubagentExecutor;
28
30
  skillExecutor?: import('../agent/tools/skill-executor.js').SkillExecutor;