agent-afk 5.303.7 → 5.303.9
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/README.md +1 -1
- package/dist/agent/peer/inbound-mode.d.ts +1 -0
- package/dist/agent/peer/xml-escape.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/types.d.ts +1 -1
- package/dist/agent/providers/openai-compatible/journal-adapter.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/journal-wiring.d.ts +2 -1
- package/dist/agent/tool-category.d.ts +1 -0
- package/dist/agent/tools/handlers/bash-kill.d.ts +4 -0
- package/dist/agent/tools/subagent-executor.write-intent.d.ts +0 -2
- package/dist/agent/trace/events.d.ts +1 -13
- package/dist/cli/commands/daemon-builtin-tasks.d.ts +2 -4
- package/dist/cli/commands/interactive/loop-stage.d.ts +3 -0
- package/dist/cli/health-rail.d.ts +3 -0
- package/dist/cli/terminal-compositor.d.ts +9 -0
- package/dist/cli/terminal-compositor.frame.d.ts +1 -0
- package/dist/cli/terminal-compositor.input-dispatch.d.ts +1 -0
- package/dist/cli/terminal-compositor.lifecycle.cpr.d.ts +38 -0
- package/dist/cli/terminal-compositor.lifecycle.d.ts +9 -0
- package/dist/cli/terminal-compositor.reset.d.ts +1 -0
- package/dist/cli/tool-category.d.ts +2 -2
- package/dist/cli.mjs +378 -374
- package/dist/index.mjs +149 -149
- package/dist/telegram.mjs +180 -180
- package/dist/utils/atomic-write.d.ts +1 -1
- package/dist/utils/kill-process-group.d.ts +7 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Open source. Runs locally. Works with any model provider, including local models
|
|
|
22
22
|
## Quick Start
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install -g agent-afk # Node
|
|
25
|
+
npm install -g agent-afk # Node 22.22.2+, 24.15+, or 26+
|
|
26
26
|
afk login # authenticate (auto-detects Claude Code / Codex creds)
|
|
27
27
|
afk doctor # verify everything works
|
|
28
28
|
afk chat "hello" # first real conversation
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function escapeXml(text: string): string;
|
|
@@ -30,7 +30,7 @@ export interface TurnResult {
|
|
|
30
30
|
usage: Usage | null;
|
|
31
31
|
text: string;
|
|
32
32
|
}
|
|
33
|
-
export type ToolCategory = 'read' | 'write' | 'shell' | 'subagent' | 'skill' | 'dag' | 'mcp' | 'web' | 'browser' | 'planning' | 'schedule' | 'other';
|
|
33
|
+
export type ToolCategory = 'read' | 'write' | 'shell' | 'subagent' | 'peer' | 'skill' | 'dag' | 'mcp' | 'web' | 'browser' | 'planning' | 'schedule' | 'other';
|
|
34
34
|
export interface AnthropicToolDef {
|
|
35
35
|
name: string;
|
|
36
36
|
description?: string;
|
|
@@ -3,3 +3,4 @@ import type { OpenAIMessage } from './messages.js';
|
|
|
3
3
|
export declare const OPENAI_COMPATIBLE_ORIGIN = "openai-compatible";
|
|
4
4
|
export declare const INTERRUPTED_TOOL_RESULT: string;
|
|
5
5
|
export declare const openAIJournalAdapter: JournalAdapter<OpenAIMessage>;
|
|
6
|
+
export declare function openAIJournalAdapterForEndpoint(baseURL?: string): JournalAdapter<OpenAIMessage>;
|
|
@@ -5,7 +5,8 @@ import type { JournalMessage } from '../../../journal/index.js';
|
|
|
5
5
|
export declare class OpenAIJournalWiring {
|
|
6
6
|
private readonly config;
|
|
7
7
|
private readonly journalSync;
|
|
8
|
-
|
|
8
|
+
private readonly adapter;
|
|
9
|
+
constructor(config: AgentConfig, baseURL?: string);
|
|
9
10
|
initialTurns(): OpenAIMessage[];
|
|
10
11
|
resumedUsage(): ProviderUsage | null;
|
|
11
12
|
legacyResumeHistory(): {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ToolCategory } from './providers/anthropic-direct/types.js';
|
|
2
2
|
export type { ToolCategory };
|
|
3
3
|
export declare const SUBAGENT_TOOLS: Set<string>;
|
|
4
|
+
export declare const PEER_TOOLS: Set<string>;
|
|
4
5
|
export declare const SKILL_TOOLS: Set<string>;
|
|
5
6
|
export declare const DAG_TOOLS: Set<string>;
|
|
6
7
|
export declare const NESTING_TOOLS: Set<string>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChildProcess } from 'node:child_process';
|
|
2
|
+
import { killProcessGroup } from '../../../utils/kill-process-group.js';
|
|
3
|
+
export declare const BASH_KILL_PIPE_GRACE_MS = 5000;
|
|
4
|
+
export declare function killBashProcess(proc: ChildProcess, platform?: NodeJS.Platform, kill?: typeof killProcessGroup): void;
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import type { ToolResult } from './types.js';
|
|
2
1
|
export declare function collectPostRunWarnings(model: string, hasAttachments: boolean, agentName: string | undefined, prompt: string, childWriteCapable: boolean, supportsVisionFn: (m: string) => boolean): string;
|
|
3
|
-
export declare function applyPostRunNotices(result: ToolResult, model: string, hasAttachments: boolean, agentName: string | undefined, prompt: string, childWriteCapable: boolean, usageNotice: string | undefined): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export { BackgroundAgentCancelledPayloadSchema, BackgroundAgentCompletedPayloadSchema, BackgroundAgentDeliveredPayloadSchema, BackgroundAgentFailedPayloadSchema, BackgroundAgentJoinedPayloadSchema, BackgroundAgentStartedPayloadSchema, } from './background-agent-schema.js';
|
|
3
|
-
export { SubagentStartedPayloadSchema, SubagentSucceededPayloadSchema, SubagentFailedPayloadSchema, SubagentCancelledPayloadSchema, SubagentLifecyclePayloadSchema, } from './events.subagent-lifecycle.js';
|
|
3
|
+
export { ToolFailureClassSchema, SubagentStartedPayloadSchema, SubagentSucceededPayloadSchema, SubagentFailedPayloadSchema, SubagentCancelledPayloadSchema, SubagentLifecyclePayloadSchema, } from './events.subagent-lifecycle.js';
|
|
4
4
|
export { BrowserEventToolSchema, BrowserActActionSchema, BrowserEventTargetSchema, BrowserEventPayloadSchema, } from './events.browser.js';
|
|
5
5
|
export { CompactionTriggerSchema, CompactionSidecarRefSchema, CompactionPayloadInputSchema, CompactionPayloadPersistedSchema, } from './events.compaction.js';
|
|
6
6
|
export { SessionPhaseNameSchema, SessionPhasePayloadSchema } from './events.session-phase.js';
|
|
@@ -13,18 +13,6 @@ export declare const ToolCallStartedPayloadSchema: z.ZodObject<{
|
|
|
13
13
|
resourceFingerprint: z.ZodOptional<z.ZodString>;
|
|
14
14
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
|
-
export declare const ToolFailureClassSchema: z.ZodEnum<{
|
|
17
|
-
budget: "budget";
|
|
18
|
-
abort: "abort";
|
|
19
|
-
"policy-refusal": "policy-refusal";
|
|
20
|
-
timeout: "timeout";
|
|
21
|
-
"permission-denied": "permission-denied";
|
|
22
|
-
"hook-block": "hook-block";
|
|
23
|
-
"elicitation-declined": "elicitation-declined";
|
|
24
|
-
"denial-breaker": "denial-breaker";
|
|
25
|
-
"repeat-failure": "repeat-failure";
|
|
26
|
-
"no-such-target": "no-such-target";
|
|
27
|
-
}>;
|
|
28
16
|
export declare const ToolCallCompletedPayloadSchema: z.ZodObject<{
|
|
29
17
|
phase: z.ZodLiteral<"completed">;
|
|
30
18
|
toolUseId: z.ZodString;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import type { ScheduledTask } from '../../agent/daemon/triggers.js';
|
|
2
2
|
import type { CliConfig } from '../config/types.js';
|
|
3
|
+
import type { EnvObject } from '../../config/env.js';
|
|
3
4
|
export declare function buildWorktreePruneTask(cron: string): ScheduledTask;
|
|
4
5
|
export declare function buildToolHealthTask(cron: string): ScheduledTask;
|
|
5
6
|
export declare function appendBuiltinTasks(tasks: ScheduledTask[], config: {
|
|
6
7
|
daemon?: CliConfig['daemon'];
|
|
7
|
-
}, env: {
|
|
8
|
-
AFK_WORKTREE_PRUNE_DISABLE?: string;
|
|
9
|
-
AFK_TOOL_HEALTH_DISABLE?: string;
|
|
10
|
-
}): {
|
|
8
|
+
}, env: Pick<EnvObject, 'AFK_WORKTREE_PRUNE_DISABLE' | 'AFK_TOOL_HEALTH_DISABLE'>): {
|
|
11
9
|
worktreePruneCron: string;
|
|
12
10
|
toolHealthCron: string;
|
|
13
11
|
worktreePruneEnabled: boolean;
|
|
@@ -23,7 +23,10 @@ export declare class LoopStageBar {
|
|
|
23
23
|
private started;
|
|
24
24
|
private currentStage;
|
|
25
25
|
private resizeUnsub;
|
|
26
|
+
private resizeImmediateUnsub;
|
|
26
27
|
private onRowCountChange?;
|
|
28
|
+
private lastPaintedRow;
|
|
29
|
+
private preResizePaintedRow;
|
|
27
30
|
constructor(opts: {
|
|
28
31
|
getExtraRows: () => number;
|
|
29
32
|
stream?: NodeJS.WriteStream;
|
|
@@ -18,7 +18,10 @@ export declare class HealthRail {
|
|
|
18
18
|
private snapshot;
|
|
19
19
|
private onRowCountChange?;
|
|
20
20
|
private resizeUnsub;
|
|
21
|
+
private resizeImmediateUnsub;
|
|
21
22
|
private tickInterval;
|
|
23
|
+
private lastPaintedRow;
|
|
24
|
+
private preResizePaintedRow;
|
|
22
25
|
private totalBgSubsEver;
|
|
23
26
|
private totalFgSubsEver;
|
|
24
27
|
constructor(opts: HealthRailOptions);
|
|
@@ -91,6 +91,15 @@ export declare class TerminalCompositor {
|
|
|
91
91
|
top: number;
|
|
92
92
|
bottom: number;
|
|
93
93
|
} | null;
|
|
94
|
+
cprPending: boolean;
|
|
95
|
+
cprBurst: {
|
|
96
|
+
dirty: boolean;
|
|
97
|
+
originalExpectedRow: number;
|
|
98
|
+
currentRows: number;
|
|
99
|
+
growTotal: number;
|
|
100
|
+
shrinkTotal: number;
|
|
101
|
+
requeryCt: number;
|
|
102
|
+
} | null;
|
|
94
103
|
bandGeometryStale: boolean;
|
|
95
104
|
lifecycleStateDirty: boolean;
|
|
96
105
|
commitInFlight: boolean;
|
|
@@ -49,6 +49,7 @@ export interface KeyDispatchHost {
|
|
|
49
49
|
readonly onOpenEditor?: () => void;
|
|
50
50
|
readonly onOpenOutputViewer?: () => void;
|
|
51
51
|
readonly onSubmit?: (payload: SubmissionPayload) => void;
|
|
52
|
+
readonly cprPending: boolean;
|
|
52
53
|
}
|
|
53
54
|
export declare function applyEdit(self: KeyDispatchHost, next: InputCoreState): boolean;
|
|
54
55
|
export declare function dispatchKey(self: KeyDispatchHost, char: string | undefined, key: KeyInfo): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const CPR_REPLY_RE: RegExp;
|
|
2
|
+
export declare function parseCprReply(s: string): {
|
|
3
|
+
row: number;
|
|
4
|
+
col: number;
|
|
5
|
+
} | null;
|
|
6
|
+
export declare const CPR_REQUEST = "\u001B[6n";
|
|
7
|
+
export declare const CPR_TIMEOUT_MS = 120;
|
|
8
|
+
export declare const CPR_MAX_REQUERY = 8;
|
|
9
|
+
export interface CprHost {
|
|
10
|
+
readonly stdout: NodeJS.WriteStream;
|
|
11
|
+
readonly stdin: NodeJS.ReadStream;
|
|
12
|
+
readonly armed: boolean;
|
|
13
|
+
cprPending: boolean;
|
|
14
|
+
cprBurst: {
|
|
15
|
+
dirty: boolean;
|
|
16
|
+
originalExpectedRow: number;
|
|
17
|
+
currentRows: number;
|
|
18
|
+
growTotal: number;
|
|
19
|
+
shrinkTotal: number;
|
|
20
|
+
requeryCt: number;
|
|
21
|
+
} | null;
|
|
22
|
+
lastMeasuredFrameTop: number;
|
|
23
|
+
lastMeasuredFrameBottom: number;
|
|
24
|
+
committedBandTopRow: number;
|
|
25
|
+
committedBandBottomRow: number;
|
|
26
|
+
pendingResizeErase: {
|
|
27
|
+
top: number;
|
|
28
|
+
bottom: number;
|
|
29
|
+
} | null;
|
|
30
|
+
logUpdate: {
|
|
31
|
+
topRow?: number;
|
|
32
|
+
resetGeometry?: () => void;
|
|
33
|
+
} | null;
|
|
34
|
+
anchorRow: number | undefined;
|
|
35
|
+
repaint(): void;
|
|
36
|
+
}
|
|
37
|
+
export declare function requestCprOrMarkDirty(self: CprHost, expectedRow: number, newRows: number, rowDelta: number): void;
|
|
38
|
+
export declare function requestCprAndApplyDelta(self: CprHost, expectedRow: number, newRows: number, rowDelta: number): void;
|
|
@@ -35,6 +35,15 @@ export interface LifecycleHost {
|
|
|
35
35
|
top: number;
|
|
36
36
|
bottom: number;
|
|
37
37
|
} | null;
|
|
38
|
+
cprPending: boolean;
|
|
39
|
+
cprBurst: {
|
|
40
|
+
dirty: boolean;
|
|
41
|
+
originalExpectedRow: number;
|
|
42
|
+
currentRows: number;
|
|
43
|
+
growTotal: number;
|
|
44
|
+
shrinkTotal: number;
|
|
45
|
+
requeryCt: number;
|
|
46
|
+
} | null;
|
|
38
47
|
committedBand: string[];
|
|
39
48
|
committedBandMeta: BandRowMeta[];
|
|
40
49
|
committedBandTopRow: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ChalkInstance } from 'chalk';
|
|
2
|
-
import { categorizeTool, dispatchTagForCategory, SUBAGENT_TOOLS, SKILL_TOOLS, DAG_TOOLS, NESTING_TOOLS, type ToolCategory } from '../agent/tool-category.js';
|
|
3
|
-
export { categorizeTool, dispatchTagForCategory, SUBAGENT_TOOLS, SKILL_TOOLS, DAG_TOOLS, NESTING_TOOLS, type ToolCategory, };
|
|
2
|
+
import { categorizeTool, dispatchTagForCategory, SUBAGENT_TOOLS, PEER_TOOLS, SKILL_TOOLS, DAG_TOOLS, NESTING_TOOLS, type ToolCategory } from '../agent/tool-category.js';
|
|
3
|
+
export { categorizeTool, dispatchTagForCategory, SUBAGENT_TOOLS, PEER_TOOLS, SKILL_TOOLS, DAG_TOOLS, NESTING_TOOLS, type ToolCategory, };
|
|
4
4
|
export declare const CATEGORY_HUMAN_VERB: Record<ToolCategory, string>;
|
|
5
5
|
export declare const TOOL_VERB_OVERRIDES: Partial<Record<string, string>>;
|
|
6
6
|
export declare function humanVerbForTool(toolName: string): string;
|