agent-afk 5.42.1 → 5.43.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,6 +1,7 @@
1
1
  import type { TraceWriter } from '../../../trace/index.js';
2
2
  import type { ProviderEvent } from '../../../provider.js';
3
3
  import type { ToolDispatcher } from '../../anthropic-direct/tool-dispatcher.js';
4
+ import type { ToolResult } from '../../anthropic-direct/types.js';
4
5
  import type { OpenAIMessage } from '../messages.js';
5
6
  import type { StreamState } from '../translate.js';
6
7
  export interface DispatchAndAppendInput {
@@ -12,4 +13,4 @@ export interface DispatchAndAppendInput {
12
13
  priorTurns: OpenAIMessage[];
13
14
  sessionId: string;
14
15
  }
15
- export declare function dispatchAndAppendToolCalls({ state, signal, vision, toolDispatcher, traceWriter, priorTurns, sessionId, }: DispatchAndAppendInput): AsyncGenerator<ProviderEvent>;
16
+ export declare function dispatchAndAppendToolCalls({ state, signal, vision, toolDispatcher, traceWriter, priorTurns, sessionId, }: DispatchAndAppendInput): AsyncGenerator<ProviderEvent, ToolResult | undefined>;
@@ -0,0 +1,9 @@
1
+ import type { ToolCall } from '../providers/anthropic-direct/types.js';
2
+ import type { ToolFailureClass } from '../trace/types.js';
3
+ export declare const DENIAL_CIRCUIT_BREAKER_THRESHOLD = 5;
4
+ export declare const DENIAL_BREAKER_FAILURE_CLASS: ToolFailureClass;
5
+ export declare const READ_PATH_TOOLS: ReadonlySet<string>;
6
+ export declare const SUBAGENT_PATH_DENIAL_REASON_PREFIX = "Sub-agent path access denied:";
7
+ export declare function isSubagentContainmentDenial(reason: string | undefined): boolean;
8
+ export declare function extractDeniedReadPath(call: ToolCall): string;
9
+ export declare function buildDenialBreakerMessage(deniedPaths: readonly string[], count: number): string;
@@ -58,6 +58,7 @@ export declare class SessionToolDispatcher implements ToolDispatcher {
58
58
  private readonly traceWriter;
59
59
  private readonly readOnlyBash;
60
60
  private repeatBreaker;
61
+ private denialBreaker;
61
62
  private readonly grantManager;
62
63
  constructor(opts: SessionToolDispatcherOptions);
63
64
  private get handlerContext();
@@ -71,6 +72,8 @@ export declare class SessionToolDispatcher implements ToolDispatcher {
71
72
  get toolDefs(): readonly AnthropicToolDef[];
72
73
  private checkReadOnlyBash;
73
74
  private checkRepeatCircuitBreaker;
75
+ private recordForkReadDenial;
76
+ private resetDenialBreaker;
74
77
  private runCanUseTool;
75
78
  execute(call: ToolCall): Promise<ToolResult>;
76
79
  executeBatch(calls: ToolCall[]): Promise<ToolResult[]>;
@@ -13,6 +13,7 @@ export declare const ToolFailureClassSchema: z.ZodEnum<{
13
13
  "permission-denied": "permission-denied";
14
14
  "hook-block": "hook-block";
15
15
  "elicitation-declined": "elicitation-declined";
16
+ "denial-breaker": "denial-breaker";
16
17
  }>;
17
18
  export declare const ToolCallCompletedPayloadSchema: z.ZodObject<{
18
19
  phase: z.ZodLiteral<"completed">;
@@ -30,6 +31,7 @@ export declare const ToolCallCompletedPayloadSchema: z.ZodObject<{
30
31
  "permission-denied": "permission-denied";
31
32
  "hook-block": "hook-block";
32
33
  "elicitation-declined": "elicitation-declined";
34
+ "denial-breaker": "denial-breaker";
33
35
  }>>;
34
36
  batchIndex: z.ZodOptional<z.ZodNumber>;
35
37
  batchSize: z.ZodOptional<z.ZodNumber>;
@@ -57,6 +59,7 @@ export declare const ToolCallPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject
57
59
  "permission-denied": "permission-denied";
58
60
  "hook-block": "hook-block";
59
61
  "elicitation-declined": "elicitation-declined";
62
+ "denial-breaker": "denial-breaker";
60
63
  }>>;
61
64
  batchIndex: z.ZodOptional<z.ZodNumber>;
62
65
  batchSize: z.ZodOptional<z.ZodNumber>;
@@ -527,6 +530,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
527
530
  "permission-denied": "permission-denied";
528
531
  "hook-block": "hook-block";
529
532
  "elicitation-declined": "elicitation-declined";
533
+ "denial-breaker": "denial-breaker";
530
534
  }>>;
531
535
  batchIndex: z.ZodOptional<z.ZodNumber>;
532
536
  batchSize: z.ZodOptional<z.ZodNumber>;
@@ -818,6 +822,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
818
822
  "permission-denied": "permission-denied";
819
823
  "hook-block": "hook-block";
820
824
  "elicitation-declined": "elicitation-declined";
825
+ "denial-breaker": "denial-breaker";
821
826
  }>>;
822
827
  batchIndex: z.ZodOptional<z.ZodNumber>;
823
828
  batchSize: z.ZodOptional<z.ZodNumber>;
@@ -6,7 +6,7 @@ export interface ToolCallStartedPayload {
6
6
  inputBytes: number;
7
7
  subagentId?: string;
8
8
  }
9
- export declare const TOOL_FAILURE_CLASSES: readonly ["policy-refusal", "timeout", "permission-denied", "hook-block", "abort", "elicitation-declined"];
9
+ export declare const TOOL_FAILURE_CLASSES: readonly ["policy-refusal", "timeout", "permission-denied", "hook-block", "abort", "elicitation-declined", "denial-breaker"];
10
10
  export type ToolFailureClass = (typeof TOOL_FAILURE_CLASSES)[number];
11
11
  export interface ToolCallCompletedPayload {
12
12
  phase: 'completed';
@@ -15,7 +15,6 @@ export interface ReplElicitationDeps {
15
15
  }) => Promise<readonly string[] | null>;
16
16
  readTextOverlay?: (opts: {
17
17
  header: readonly string[];
18
- initial?: string;
19
18
  help?: string;
20
19
  validate?: (value: string) => string | null;
21
20
  signal: AbortSignal;