agent-afk 5.83.8 → 5.84.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/index.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/overload-pause.d.ts +11 -0
- package/dist/agent/providers/anthropic-direct/query/retry-layer.d.ts +3 -0
- package/dist/agent/providers/anthropic-direct/query.d.ts +1 -0
- package/dist/agent/trace/events.d.ts +8 -0
- package/dist/agent/trace/types.d.ts +1 -1
- package/dist/bundled-plugins/awa-bundled/skills/intent-lock/SKILL.md +22 -3
- package/dist/cli/commands/interactive/turn-text-seam.d.ts +1 -0
- package/dist/cli.mjs +510 -507
- package/dist/config/env.d.ts +1 -0
- package/dist/index.mjs +187 -187
- package/dist/telegram.mjs +244 -244
- package/package.json +1 -1
|
@@ -47,6 +47,7 @@ export declare class AnthropicDirectProvider implements ModelProvider {
|
|
|
47
47
|
private readonly subagentExecutor;
|
|
48
48
|
private readonly composeExecutor;
|
|
49
49
|
private readonly surface;
|
|
50
|
+
private readonly declaredSurface;
|
|
50
51
|
private readonly readOnlyMemory;
|
|
51
52
|
private readonly readOnlyBash;
|
|
52
53
|
private readonly mcpManager;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../provider.js';
|
|
2
|
+
export declare const OVERLOAD_EXHAUSTED = "overload_exhausted";
|
|
3
|
+
export declare const OVERLOAD_EXHAUSTED_NOTICE: string;
|
|
4
|
+
export declare const OVERLOAD_PAUSE_CEILING_MS: number;
|
|
5
|
+
export declare const OVERLOAD_PAUSE_MAX_MS: number;
|
|
6
|
+
export declare const OVERLOAD_PROBE_MIN_MS: number;
|
|
7
|
+
export declare const OVERLOAD_PROBE_MAX_MS: number;
|
|
8
|
+
export declare function jitterBackoff(baseMs: number, random?: () => number): number;
|
|
9
|
+
export declare function nextProbeDelayMs(random?: () => number): number;
|
|
10
|
+
export declare function classifyOverloadExhaustion(event: ProviderEvent): boolean;
|
|
11
|
+
export declare function resolveOverloadPauseCeilingMs(surface: string | undefined): number;
|
|
@@ -11,6 +11,7 @@ export interface RetryLayerOptions {
|
|
|
11
11
|
baseUrl?: string;
|
|
12
12
|
tokenRefresher?: () => Promise<Anthropic | null>;
|
|
13
13
|
autoResumeOnUsageLimit: boolean;
|
|
14
|
+
surface?: string;
|
|
14
15
|
}
|
|
15
16
|
export declare class RetryLayer {
|
|
16
17
|
private _client;
|
|
@@ -19,6 +20,7 @@ export declare class RetryLayer {
|
|
|
19
20
|
private readonly baseUrl?;
|
|
20
21
|
private readonly tokenRefresher?;
|
|
21
22
|
private readonly autoResumeOnUsageLimit;
|
|
23
|
+
private readonly surface?;
|
|
22
24
|
private refreshPromise;
|
|
23
25
|
private usageLimitWaitPromise;
|
|
24
26
|
constructor(opts: RetryLayerOptions);
|
|
@@ -30,6 +32,7 @@ export declare class RetryLayer {
|
|
|
30
32
|
swapped: boolean;
|
|
31
33
|
} | null>;
|
|
32
34
|
turnWithRetries(runInput: RunTurnInput, isClosed: () => boolean): AsyncGenerator<ProviderEvent, void, void>;
|
|
35
|
+
private turnWithOverloadPause;
|
|
33
36
|
private turnWithUsageLimitRetry;
|
|
34
37
|
private turnWithAuthRetry;
|
|
35
38
|
private isRetryableAuth;
|
|
@@ -26,6 +26,7 @@ export interface AnthropicDirectQueryOptions {
|
|
|
26
26
|
traceWriter?: import('../../trace/index.js').TraceWriter;
|
|
27
27
|
subagentId?: string;
|
|
28
28
|
autoResumeOnUsageLimit?: boolean;
|
|
29
|
+
surface?: string;
|
|
29
30
|
cwdDependentsFactory?: (cwd: string) => {
|
|
30
31
|
userSystem: string;
|
|
31
32
|
dispatcher: ToolDispatcher;
|
|
@@ -492,6 +492,8 @@ export declare const SessionPhaseNameSchema: z.ZodEnum<{
|
|
|
492
492
|
ttfb_timeout: "ttfb_timeout";
|
|
493
493
|
usage_limit_pause: "usage_limit_pause";
|
|
494
494
|
usage_limit_resume: "usage_limit_resume";
|
|
495
|
+
overload_pause: "overload_pause";
|
|
496
|
+
overload_resume: "overload_resume";
|
|
495
497
|
idle_watchdog_fired: "idle_watchdog_fired";
|
|
496
498
|
suspected_loop: "suspected_loop";
|
|
497
499
|
compaction_disabled: "compaction_disabled";
|
|
@@ -514,6 +516,8 @@ export declare const SessionPhasePayloadSchema: z.ZodObject<{
|
|
|
514
516
|
ttfb_timeout: "ttfb_timeout";
|
|
515
517
|
usage_limit_pause: "usage_limit_pause";
|
|
516
518
|
usage_limit_resume: "usage_limit_resume";
|
|
519
|
+
overload_pause: "overload_pause";
|
|
520
|
+
overload_resume: "overload_resume";
|
|
517
521
|
idle_watchdog_fired: "idle_watchdog_fired";
|
|
518
522
|
suspected_loop: "suspected_loop";
|
|
519
523
|
compaction_disabled: "compaction_disabled";
|
|
@@ -846,6 +850,8 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
846
850
|
ttfb_timeout: "ttfb_timeout";
|
|
847
851
|
usage_limit_pause: "usage_limit_pause";
|
|
848
852
|
usage_limit_resume: "usage_limit_resume";
|
|
853
|
+
overload_pause: "overload_pause";
|
|
854
|
+
overload_resume: "overload_resume";
|
|
849
855
|
idle_watchdog_fired: "idle_watchdog_fired";
|
|
850
856
|
suspected_loop: "suspected_loop";
|
|
851
857
|
compaction_disabled: "compaction_disabled";
|
|
@@ -1186,6 +1192,8 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1186
1192
|
ttfb_timeout: "ttfb_timeout";
|
|
1187
1193
|
usage_limit_pause: "usage_limit_pause";
|
|
1188
1194
|
usage_limit_resume: "usage_limit_resume";
|
|
1195
|
+
overload_pause: "overload_pause";
|
|
1196
|
+
overload_resume: "overload_resume";
|
|
1189
1197
|
idle_watchdog_fired: "idle_watchdog_fired";
|
|
1190
1198
|
suspected_loop: "suspected_loop";
|
|
1191
1199
|
compaction_disabled: "compaction_disabled";
|
|
@@ -205,7 +205,7 @@ export interface BrowserEventPayload {
|
|
|
205
205
|
};
|
|
206
206
|
durationMs: number;
|
|
207
207
|
}
|
|
208
|
-
export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'interrupt_halt' | 'rate_limit' | 'ttfb_timeout' | 'usage_limit_pause' | 'usage_limit_resume' | 'idle_watchdog_fired' | 'suspected_loop' | 'compaction_disabled';
|
|
208
|
+
export type SessionPhaseName = 'bootstrap_start' | 'bootstrap_done' | 'session_init_start' | 'session_init_done' | 'mcp_connect_start' | 'mcp_connect_done' | 'mcp_server_start' | 'mcp_server_done' | 'loop_start' | 'loop_end' | 'model_ttfb' | 'interrupt_halt' | 'rate_limit' | 'ttfb_timeout' | 'usage_limit_pause' | 'usage_limit_resume' | 'overload_pause' | 'overload_resume' | 'idle_watchdog_fired' | 'suspected_loop' | 'compaction_disabled';
|
|
209
209
|
export interface SessionPhasePayload {
|
|
210
210
|
phase: SessionPhaseName;
|
|
211
211
|
durationMs?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: intent-lock
|
|
3
|
-
description: "Fires before multi-step work when the user's request contains ambiguous referents ('the text', 'her Y'), characterizations of unverified entities ('the meeting is substantive'),
|
|
3
|
+
description: "Fires before multi-step work when the user's request contains ambiguous referents ('the text', 'her Y'), characterizations of unverified entities ('the meeting is substantive'), identity assumptions (which contact = the user), code-vs-runtime dual referents, or no task statement at all (a bare path, URL, noun phrase, or pasted trace). Emits a one-sentence interpretation lock for fast async correction; escalates when interpretation gates an irreversible action AND multiple plausible reads exist."
|
|
4
4
|
context: load
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -31,12 +31,19 @@ Check for these signal classes before starting any multi-step task:
|
|
|
31
31
|
- "tool" / "skill" / "plugin" — the project's loadable units OR the agent's available tools
|
|
32
32
|
- "MCP" / "terminal" / "REPL" — primitives the project implements that the agent also has
|
|
33
33
|
|
|
34
|
+
**No task statement at all** — the request is a bare fragment with no imperative verb, so the referent to resolve is the *goal itself* rather than a noun inside it:
|
|
35
|
+
- A lone path, repo URL, or issue/PR link with no stated ask
|
|
36
|
+
- A bare noun phrase: "the 429s", "usage indicators", "that timeout"
|
|
37
|
+
- A continuation cue whose carried-over goal is not uniquely established: "same as before", "and the 429s?"
|
|
38
|
+
- A pasted error, log line, stack trace, or diff with no question attached
|
|
39
|
+
|
|
34
40
|
**Skip when:**
|
|
35
41
|
- Referent resolves unambiguously from immediately prior context (file was just read this turn, entity was named and confirmed, prior message established the binding).
|
|
36
42
|
- Request is reversible, exploratory, and any misread is immediately correctable without cost.
|
|
37
43
|
- User has already provided the interpretation explicitly ("I mean X by 'the text'", "agent-afk's memory", "my session", "this codebase's hooks").
|
|
38
44
|
- Single-step clarification would cost more than simply proceeding and correcting.
|
|
39
45
|
- Dual-referent term has no matching symbol in cwd — no parity risk, standard interpretation applies.
|
|
46
|
+
- Fragment's goal is fixed by the immediately prior turn (agent just proposed two options and the user named one) — the task statement carries over intact.
|
|
40
47
|
|
|
41
48
|
---
|
|
42
49
|
|
|
@@ -44,7 +51,9 @@ Check for these signal classes before starting any multi-step task:
|
|
|
44
51
|
|
|
45
52
|
### Step 1 — Scan
|
|
46
53
|
|
|
47
|
-
Before acting, scan the request for signal classes above. List every ambiguous referent, unverified characterization, identity assumption,
|
|
54
|
+
Before acting, scan the request for signal classes above. List every ambiguous referent, unverified characterization, identity assumption, code-vs-runtime dual referent, or missing task statement found. If zero are found, skip this skill entirely.
|
|
55
|
+
|
|
56
|
+
**When the finding is a missing task statement**, reconstruct the candidate goal from ambient evidence before classifying it — recent commits, branch name, open diff, the named file's contents, the prior turn. Cite the evidence the reconstruction rests on, so a wrong read is visibly wrong rather than silently load-bearing. Resolve this in-context; dispatch one sub-agent with one focused reconstruction question only when in-context reasoning cannot produce a single confident reading, and do not permit a follow-up dispatch. The reconstructed goal is then classified by Step 2 exactly like any other finding.
|
|
48
57
|
|
|
49
58
|
### Step 2 — Classify each finding
|
|
50
59
|
|
|
@@ -62,6 +71,8 @@ For each finding, determine:
|
|
|
62
71
|
| Multiple plausible reads, reversible action | **Lock** — emit most-likely read with explicit note, proceed |
|
|
63
72
|
| Multiple plausible reads, irreversible action | **Asking** — stop, ask one question |
|
|
64
73
|
|
|
74
|
+
Use **Asking** only when the current surface can receive an answer. On a daemon, scheduled, one-shot, or other non-interactive surface, multiple plausible reads that gate an irreversible action require **Blocked** — take no action and record the exact question whose answer would unblock it.
|
|
75
|
+
|
|
65
76
|
**Multiple plausible reads** means two or more interpretations that would produce materially different outcomes. "the text" pointing to one of two equally recent documents = multiple. "the text" when only one document was discussed this session = single.
|
|
66
77
|
|
|
67
78
|
### Step 4 — Emit the lock
|
|
@@ -72,6 +83,10 @@ For each finding, determine:
|
|
|
72
83
|
|
|
73
84
|
One sentence. No preamble. Append to the start of the work output, not as a standalone turn. The user can correct asynchronously; work continues.
|
|
74
85
|
|
|
86
|
+
**Lock format (reconstructed goal):**
|
|
87
|
+
|
|
88
|
+
> Reading [fragment] as: [reconstructed task statement] (from [evidence]). Proceeding on that basis — correct me if wrong.
|
|
89
|
+
|
|
75
90
|
**If multiple locks needed:** stack them, one per line, before the work output.
|
|
76
91
|
|
|
77
92
|
**Asking format (irreversible + multiple reads only):**
|
|
@@ -88,13 +103,17 @@ One question. State what it unlocks. Do not proceed until answered.
|
|
|
88
103
|
|
|
89
104
|
**ground-state** fires before implementation to survey repo state. Intent-lock fires before *any* multi-step work on requests with ambiguous inputs — including non-implementation work like drafting, research, or messaging. They can both fire on the same request (ground-state runs after intent-lock resolves).
|
|
90
105
|
|
|
106
|
+
In agent-afk, the `ask_question` hook enforces the reachability rule; where that hook is absent, apply the rule inline. Never emit an unreachable question: on a non-interactive surface, proceed only on a safe assumption or end Blocked without acting when the next action is irreversible. **trajectory-check** is a user-scope skill that may not exist in this installation — reference it only if present, and never block on it. When a session-end goal-vs-execution check is wanted, invoke it with the locked statement from Step 4 as its canonical-goal input, not the original fragment. Do not reimplement that check here.
|
|
107
|
+
|
|
91
108
|
**premise-gate** checks named-entity and status-claim pairs during research and analysis. Intent-lock fires *before* work begins on the request itself. They address the same underlying hazard at different points in the pipeline: intent-lock at request intake, premise-gate during execution.
|
|
92
109
|
|
|
93
110
|
---
|
|
94
111
|
|
|
95
112
|
## Exit criteria
|
|
96
113
|
|
|
97
|
-
- Every ambiguous referent, unverified characterization, identity assumption,
|
|
114
|
+
- Every ambiguous referent, unverified characterization, identity assumption, code-vs-runtime dual referent, and missing task statement is either locked (one-sentence interpretation emitted), escalated to Asking, or ended Blocked on a non-interactive surface.
|
|
115
|
+
- A reconstructed goal is never acted on silently — the lock names both the reading and the evidence it rests on.
|
|
98
116
|
- No multi-step work begins on a request whose interpretation gates an irreversible action when multiple plausible reads exist.
|
|
117
|
+
- On a non-interactive surface, an unresolved interpretation that gates an irreversible action ends Blocked with no action and the exact unblock question recorded.
|
|
99
118
|
- Lock statements are visible in the turn output before the work they govern.
|
|
100
119
|
- Asking state contains exactly one question and states what it unlocks.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function joinAtRoundSeam(accumulated: string, next: string): string;
|