agent-afk 5.107.0 → 5.107.2

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.
@@ -3,6 +3,7 @@ export { resolveEffort, resolveMaxTokens, resolveThinkingParam } from './resolve
3
3
  import { type AnthropicDirectProviderOptions } from './provider-options.js';
4
4
  export { __setAnthropicClientFactory, type AnthropicClientFactory, type AnthropicDirectProviderOptions, } from './provider-options.js';
5
5
  export { resolveUserSystem } from './provider-query-setup.js';
6
+ export declare const DEFAULT_MODEL = "claude-sonnet-4-6";
6
7
  export declare class AnthropicDirectProvider implements ModelProvider {
7
8
  readonly name = "anthropic-direct";
8
9
  private readonly externalTools;
@@ -0,0 +1,11 @@
1
+ import type { ToolFailureClass } from '../../trace/types.js';
2
+ export interface GrepSettleResult {
3
+ content: string;
4
+ isError?: boolean;
5
+ truncated?: boolean;
6
+ failureClass?: ToolFailureClass;
7
+ }
8
+ export type RgExit2Result = GrepSettleResult & {
9
+ isError: true;
10
+ };
11
+ export declare function classifyRgExit2(stderr: string, searchPath: string): RgExit2Result;
@@ -16,6 +16,7 @@ export declare const ToolFailureClassSchema: z.ZodEnum<{
16
16
  "elicitation-declined": "elicitation-declined";
17
17
  "denial-breaker": "denial-breaker";
18
18
  "repeat-failure": "repeat-failure";
19
+ "no-such-target": "no-such-target";
19
20
  }>;
20
21
  export declare const ToolCallCompletedPayloadSchema: z.ZodObject<{
21
22
  phase: z.ZodLiteral<"completed">;
@@ -38,6 +39,7 @@ export declare const ToolCallCompletedPayloadSchema: z.ZodObject<{
38
39
  "elicitation-declined": "elicitation-declined";
39
40
  "denial-breaker": "denial-breaker";
40
41
  "repeat-failure": "repeat-failure";
42
+ "no-such-target": "no-such-target";
41
43
  }>>;
42
44
  batchIndex: z.ZodOptional<z.ZodNumber>;
43
45
  batchSize: z.ZodOptional<z.ZodNumber>;
@@ -70,6 +72,7 @@ export declare const ToolCallPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject
70
72
  "elicitation-declined": "elicitation-declined";
71
73
  "denial-breaker": "denial-breaker";
72
74
  "repeat-failure": "repeat-failure";
75
+ "no-such-target": "no-such-target";
73
76
  }>>;
74
77
  batchIndex: z.ZodOptional<z.ZodNumber>;
75
78
  batchSize: z.ZodOptional<z.ZodNumber>;
@@ -147,6 +150,7 @@ export declare const SubagentFailedPayloadSchema: z.ZodObject<{
147
150
  "elicitation-declined": "elicitation-declined";
148
151
  "denial-breaker": "denial-breaker";
149
152
  "repeat-failure": "repeat-failure";
153
+ "no-such-target": "no-such-target";
150
154
  }>>;
151
155
  }, z.core.$strip>;
152
156
  export declare const SubagentCancelledPayloadSchema: z.ZodObject<{
@@ -192,6 +196,7 @@ export declare const SubagentLifecyclePayloadSchema: z.ZodDiscriminatedUnion<[z.
192
196
  "elicitation-declined": "elicitation-declined";
193
197
  "denial-breaker": "denial-breaker";
194
198
  "repeat-failure": "repeat-failure";
199
+ "no-such-target": "no-such-target";
195
200
  }>>;
196
201
  }, z.core.$strip>, z.ZodObject<{
197
202
  transition: z.ZodLiteral<"cancelled">;
@@ -604,6 +609,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
604
609
  "elicitation-declined": "elicitation-declined";
605
610
  "denial-breaker": "denial-breaker";
606
611
  "repeat-failure": "repeat-failure";
612
+ "no-such-target": "no-such-target";
607
613
  }>>;
608
614
  batchIndex: z.ZodOptional<z.ZodNumber>;
609
615
  batchSize: z.ZodOptional<z.ZodNumber>;
@@ -674,6 +680,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
674
680
  "elicitation-declined": "elicitation-declined";
675
681
  "denial-breaker": "denial-breaker";
676
682
  "repeat-failure": "repeat-failure";
683
+ "no-such-target": "no-such-target";
677
684
  }>>;
678
685
  }, z.core.$strip>, z.ZodObject<{
679
686
  transition: z.ZodLiteral<"cancelled">;
@@ -936,6 +943,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
936
943
  "elicitation-declined": "elicitation-declined";
937
944
  "denial-breaker": "denial-breaker";
938
945
  "repeat-failure": "repeat-failure";
946
+ "no-such-target": "no-such-target";
939
947
  }>>;
940
948
  batchIndex: z.ZodOptional<z.ZodNumber>;
941
949
  batchSize: z.ZodOptional<z.ZodNumber>;
@@ -1010,6 +1018,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1010
1018
  "elicitation-declined": "elicitation-declined";
1011
1019
  "denial-breaker": "denial-breaker";
1012
1020
  "repeat-failure": "repeat-failure";
1021
+ "no-such-target": "no-such-target";
1013
1022
  }>>;
1014
1023
  }, z.core.$strip>, z.ZodObject<{
1015
1024
  transition: z.ZodLiteral<"cancelled">;
@@ -1,5 +1,5 @@
1
1
  import type { HookHandler } from '../hooks.js';
2
- import type { ClosureReason, ToolFailureClass, TraceEvent, TraceEventKind } from './types.js';
2
+ import { type ClosureReason, type ToolFailureClass, type TraceEvent, type TraceEventKind } from './types.js';
3
3
  export declare const RECEIPT_SCHEMA_VERSION: 1;
4
4
  export interface ReceiptToolFailure {
5
5
  toolUseId: string;
@@ -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", "budget", "permission-denied", "hook-block", "abort", "elicitation-declined", "denial-breaker", "repeat-failure"];
9
+ export declare const TOOL_FAILURE_CLASSES: readonly ["policy-refusal", "timeout", "budget", "permission-denied", "hook-block", "abort", "elicitation-declined", "denial-breaker", "repeat-failure", "no-such-target"];
10
10
  export type ToolFailureClass = (typeof TOOL_FAILURE_CLASSES)[number];
11
11
  export declare const BENIGN_FAILURE_CLASSES: ReadonlySet<ToolFailureClass>;
12
12
  export interface ToolCallCompletedPayload {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: shadow-verify
3
- description: "Dispatch a parallel adversarial verifier wave after any high-stakes sub-agent investigation (code reviews, audits, findings reports, large refactors) — or whenever a sub-agent asserts a claim with high-confidence language (confident, certain, clearly, ≥80%), since confidence is a trigger, not a verdict. Shadow verifiers independently re-derive 2–3 key claims from scratch using tool calls only, returning CONFIRMED/REFUTED/UNVERIFIABLE, and flag disagreements before the user acts. Use when sub-agent output will drive decisions, file changes, commits, or external side-effects."
3
+ description: "Dispatch a parallel adversarial verifier wave after any high-stakes sub-agent investigation (code reviews, audits, findings reports, large refactors) — or whenever a sub-agent asserts a claim with high-confidence language (\"confident\", \"certain\", \"clearly\", \u226580%), since confidence is a trigger, not a verdict. Shadow verifiers independently re-derive 2–3 key claims from scratch using tool calls only, returning CONFIRMED/REFUTED/UNVERIFIABLE, and flag disagreements before the user acts. Use when sub-agent output will drive decisions, file changes, commits, or external side-effects."
4
4
  context: load
5
5
  ---
6
6
 
@@ -11,13 +11,17 @@ When a sub-agent (or wave) returns investigation findings, code-review conclusio
11
11
 
12
12
  **Wave 2 — Adversarial verifiers (parallel, independent):**
13
13
  1. Extract 2–3 concrete, re-checkable claims from the returned report (e.g., "X function is unused", "file Y exceeds 300 lines", "PR targets main", "no tests cover Z").
14
- 2. Dispatch one shadow sub-agent per claim, in parallel. Each receives ONLY the claim + the user's original goal — never the original agent's reasoning or cited evidence. **Default to `subagent_type: "research-agent"` (mechanically locked to Read/Grep/Glob/WebFetch/WebSearch cannot Edit/commit/push).** If the claim requires Bash to verify (running a failing test, `gh pr view`, `git log origin/...`), fall back to a Bash-capable subagent type with `isolation: "worktree"` and prepend this prefix to the prompt: *"Verifier sub-agent do not Edit, Write, commit, push, `gh pr create`, or `curl`. Return findings only."*
14
+ 2. Dispatch one shadow sub-agent per claim, in parallel. Each receives the claim + the user's original goal + **the search surface** the inventory of files, directories, or URLs the original investigation touched. It must NOT receive the original agent's reasoning, verdict, confidence language, or the specific line/region it concluded from. **Withhold the conclusion, not the map.** Withholding the map too does not buy extra independence — the verifier still has to reach the same evidence, it just spends its budget guessing paths to get there. Measured: one verifier denied the inventory spent 70 `grep` + 18 `read_file` calls re-locating files the parent already had paths for, guessed 5 nonexistent paths on the way, and hit its tool-loop ceiling before finishing. The independence that matters is epistemic (re-deriving the verdict), not navigational.
15
+ - The inventory is a **starting surface, not a boundary**: it does not satisfy the composition-axis guard below, and a verifier that reads only inside it still returns `evidence_base: artifact-internal`. At least one primary source outside that surface is still required for `independent-rederivation`.
16
+ - **Default to `subagent_type: "research-agent"` (mechanically locked to Read/Grep/Glob/WebFetch/WebSearch — cannot Edit/commit/push).** If the claim requires Bash to verify (running a failing test, `gh pr view`, `git log origin/...`), fall back to a Bash-capable subagent type with `isolation: "worktree"` and prepend this prefix to the prompt: *"Verifier sub-agent — do not Edit, Write, commit, push, `gh pr create`, or `curl`. Return findings only."*
17
+ - **Every verifier dispatch carries an explicit budget** — `max_tool_use_iterations` (a wave of 2–3 claim checks needs ~15–25 rounds each, not 50) plus the cheapest sufficient model. An unbudgeted verifier does not fail loudly: it exhausts the default tool-round ceiling, terminates `stopReason: "tool_use_loop_capped"`, and emits its verdict from a tools-stripped wind-down round built on partial evidence. A `CONFIRMED` produced that way is indistinguishable from a real one and silently defeats the entire point of the wave. Check each returned verifier's stop reason before merging its verdict; treat a capped or wind-down verifier as `UNVERIFIABLE`, not as a verdict.
15
18
  3. Each verifier re-derives the verdict independently using tool calls only — never re-reading the original report's reasoning. Returns `{claim, verifier_verdict, evidence_pointer, evidence_base}`, where `verifier_verdict` is one of `CONFIRMED`, `REFUTED`, or `UNVERIFIABLE`, and `evidence_base` is `independent-rederivation` (read primary sources *outside* the cited artifact's boundary) or `artifact-internal` (re-read only the cited file/region). On `REFUTED`, the verifier also emits a corrected finding.
16
19
 
17
20
  **Merge:**
18
21
  - `CONFIRMED` → surface the claim as validated.
19
22
  - `REFUTED` → replace the claim with the verifier's corrected finding, annotated `[was: confident, now: refuted]`, and show it alongside the original with evidence. Do not act until the conflict is resolved.
20
23
  - `UNVERIFIABLE` → surface with a `[needs-human-review]` tag rather than passing it through silently.
24
+ - **Budget-exhausted verifier** (`stopReason` of `tool_use_loop_capped` / `soft_deadline_wind_down`, or a `timeout`/`429` failure) → its verdict was produced without finishing the evidence gathering, so it is not a verdict. Downgrade to `UNVERIFIABLE [budget-exhausted]` and re-dispatch that one claim with a narrower scope and the search surface attached; this re-dispatch counts as the next verification round (and must respect the invoking workflow's round budget — e.g. `/review` permits one round with no repeats). If the loop cap (3 rounds total) is already reached, or the caller's budget forbids another round, escalate to the user instead of re-dispatching. Never merge a capped `CONFIRMED`.
21
25
 
22
26
  *The two verdicts below are **not** emitted by individual verifiers — they are produced by the Composition-axis guard (defined below) and handled here:*
23
27
  - `UNVERIFIED-COMPOSITION` → surface with `[needs-human-review: composition boundary unchecked]`; do not act until a boundary read confirms or refutes the claim.