agent-afk 5.302.4 → 5.302.6
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/session/wire-executors.d.ts +2 -0
- package/dist/agent/shell-jobs/process-jobs.d.ts +4 -1
- package/dist/agent/shell-jobs/process-jobs.sweep.d.ts +1 -1
- package/dist/agent/tools/detach-bash.d.ts +1 -0
- package/dist/agent/tools/subagent/background-branch.d.ts +2 -0
- package/dist/agent/tools/subagent/background-delivery.d.ts +14 -0
- package/dist/agent/tools/subagent/foreground-promotion.d.ts +2 -0
- package/dist/agent/tools/subagent-executor/types.d.ts +2 -0
- package/dist/agent/trace/events.d.ts +4 -0
- package/dist/agent/trace/events.session-phase.d.ts +4 -0
- package/dist/agent/trace/types.session-phase.d.ts +1 -1
- package/dist/cli/commands/interactive/bg-result-notifier.d.ts +1 -0
- package/dist/cli/commands/interactive/bootstrap-resume.d.ts +1 -1
- package/dist/cli/commands/interactive/process-job-notifier.d.ts +1 -0
- package/dist/cli.mjs +349 -349
- package/dist/index.mjs +141 -141
- package/dist/telegram.mjs +169 -169
- package/package.json +1 -1
|
@@ -25,6 +25,8 @@ export interface WireExecutorsOptions {
|
|
|
25
25
|
traceWriter?: TraceSink;
|
|
26
26
|
skillTraceWriter?: TraceSink;
|
|
27
27
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
28
|
+
backgroundAutoWake?: () => boolean;
|
|
29
|
+
backgroundAutoDeliver?: () => boolean;
|
|
28
30
|
agentRegistryWarn?: (message: string) => void;
|
|
29
31
|
workspaceStore?: WorkspaceStore;
|
|
30
32
|
sessionLabel?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
+
import type { TraceSink } from '../trace/index.js';
|
|
2
3
|
export type ProcessJobStatus = 'running' | 'completed' | 'failed' | 'timed_out' | 'cancelled';
|
|
3
4
|
export type ProcessCancelSource = 'model' | 'user' | 'teardown';
|
|
4
5
|
export declare const PROCESS_JOB_ID_PREFIX = "proc-";
|
|
@@ -34,6 +35,7 @@ export interface ProcessJobRegistryOptions {
|
|
|
34
35
|
closeGraceMs?: number;
|
|
35
36
|
reapGraceMs?: number;
|
|
36
37
|
sweep?: boolean;
|
|
38
|
+
traceWriter?: TraceSink;
|
|
37
39
|
}
|
|
38
40
|
export interface StartProcessJobArgs {
|
|
39
41
|
command: string;
|
|
@@ -54,7 +56,7 @@ export declare class ProcessJobRegistry extends EventEmitter<ProcessJobRegistryE
|
|
|
54
56
|
readonly sessionLabel: string;
|
|
55
57
|
readonly logDir: string;
|
|
56
58
|
readonly maxConcurrent: number;
|
|
57
|
-
private
|
|
59
|
+
private opts;
|
|
58
60
|
private readonly jobs;
|
|
59
61
|
private counter;
|
|
60
62
|
private closed;
|
|
@@ -71,6 +73,7 @@ export declare class ProcessJobRegistry extends EventEmitter<ProcessJobRegistryE
|
|
|
71
73
|
emitCancelTimeout(id: string): void;
|
|
72
74
|
waitFor(id: string): Promise<ProcessJobSnapshot | undefined>;
|
|
73
75
|
killAll(graceMs?: number): Promise<readonly ProcessJobSnapshot[]>;
|
|
76
|
+
setTraceWriter(writer: TraceSink | undefined): void;
|
|
74
77
|
dispose(): void;
|
|
75
78
|
private onSettled;
|
|
76
79
|
private installExitHook;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function enforceSessionQuota(dir: string, quotaBytes: number, liveLogPaths: ReadonlySet<string>): void;
|
|
2
|
-
export declare function sweepProcessJobDirs(currentLabel: string, now?: number, maxAgeMs?: number): void;
|
|
2
|
+
export declare function sweepProcessJobDirs(currentLabel: string, now?: number, maxAgeMs?: number, rootOverride?: string): void;
|
|
3
3
|
export declare function scheduleProcessJobSweep(currentLabel: string): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DetachableToolRegistry, DetachToken, DetachedToolResult } from './detach-registry.js';
|
|
2
2
|
export declare const SETTLE_AFTER_KILL_MS = 5000;
|
|
3
3
|
export declare function bashDetachLabel(command: string): string;
|
|
4
|
+
export declare const BASH_SETTLE_TIMEOUT_SENTINEL = "SETTLE_TIMEOUT";
|
|
4
5
|
export declare function buildBashDelivery(toolUseId: string, label: string, output: string, closeCode: number | null, closeSignal: string | null, startedAt: number): DetachedToolResult;
|
|
5
6
|
export declare function applyBashDetach(registry: DetachableToolRegistry, toolUseId: string, command: string, onDetach: (token: DetachToken, label: string) => void): DetachToken;
|
|
6
7
|
export interface OnDetachParams {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type BackgroundAgentRegistry } from '../../background-registry.js';
|
|
2
2
|
import type { SubagentManager } from '../../subagent.js';
|
|
3
3
|
import type { ToolResult } from '../types.js';
|
|
4
|
+
import { type BackgroundDelivery } from './background-delivery.js';
|
|
4
5
|
type ForkedHandle = Awaited<ReturnType<SubagentManager['forkSubagent']>>;
|
|
5
6
|
export interface RunBackgroundBranchArgs {
|
|
6
7
|
handle: ForkedHandle;
|
|
@@ -15,6 +16,7 @@ export interface RunBackgroundBranchArgs {
|
|
|
15
16
|
repoRoot: string;
|
|
16
17
|
worktreePath: string;
|
|
17
18
|
};
|
|
19
|
+
delivery?: BackgroundDelivery;
|
|
18
20
|
}
|
|
19
21
|
export declare function runBackgroundBranch(args: RunBackgroundBranchArgs): Promise<ToolResult>;
|
|
20
22
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BackgroundAgentRegistry } from '../../background-registry.js';
|
|
2
|
+
export type BackgroundDelivery = 'auto-wake' | 'next-message' | 'manual-join' | 'root-session';
|
|
3
|
+
export interface BackgroundDeliveryContext {
|
|
4
|
+
depth: number;
|
|
5
|
+
backgroundRegistry?: BackgroundAgentRegistry;
|
|
6
|
+
backgroundAutoWake?: () => boolean;
|
|
7
|
+
backgroundAutoDeliver?: () => boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveBackgroundDelivery(ctx: BackgroundDeliveryContext): BackgroundDelivery;
|
|
10
|
+
export declare function backgroundTarget(ctx: BackgroundDeliveryContext): {
|
|
11
|
+
registry: BackgroundAgentRegistry | undefined;
|
|
12
|
+
delivery: BackgroundDelivery;
|
|
13
|
+
};
|
|
14
|
+
export declare function backgroundDeliveryNote(delivery: BackgroundDelivery | undefined, jobId: string): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
2
2
|
import type { BackgroundAgentRegistry } from '../../background-registry.js';
|
|
3
|
+
import { type BackgroundDelivery } from './background-delivery.js';
|
|
3
4
|
import type { SubagentManager } from '../../subagent.js';
|
|
4
5
|
import type { TraceOrigin, TraceActor } from '../../session/session-identity.js';
|
|
5
6
|
import type { TraceSink } from '../../trace/index.js';
|
|
@@ -34,6 +35,7 @@ export interface RunForegroundArgs {
|
|
|
34
35
|
depth: number;
|
|
35
36
|
parentSessionId: string | undefined;
|
|
36
37
|
registry: BackgroundAgentRegistry | undefined;
|
|
38
|
+
delivery?: BackgroundDelivery;
|
|
37
39
|
promotionTriggers: Map<string, PromotionTrigger>;
|
|
38
40
|
activeForegroundHandles: Map<string, {
|
|
39
41
|
cancel: () => Promise<void>;
|
|
@@ -27,6 +27,8 @@ export interface SubagentExecutorContext {
|
|
|
27
27
|
depth: number;
|
|
28
28
|
maxDepth?: number;
|
|
29
29
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
30
|
+
backgroundAutoWake?: () => boolean;
|
|
31
|
+
backgroundAutoDeliver?: () => boolean;
|
|
30
32
|
cwd?: string;
|
|
31
33
|
traceWriter?: TraceSink;
|
|
32
34
|
workspaceStore?: import('../../workspace/index.js').WorkspaceStore;
|
|
@@ -639,6 +639,8 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
639
639
|
stop_hook_continuation: "stop_hook_continuation";
|
|
640
640
|
stop_hook_cap_reached: "stop_hook_cap_reached";
|
|
641
641
|
orphan_repair: "orphan_repair";
|
|
642
|
+
background_process_started: "background_process_started";
|
|
643
|
+
background_process_settled: "background_process_settled";
|
|
642
644
|
}>;
|
|
643
645
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
644
646
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1049,6 +1051,8 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1049
1051
|
stop_hook_continuation: "stop_hook_continuation";
|
|
1050
1052
|
stop_hook_cap_reached: "stop_hook_cap_reached";
|
|
1051
1053
|
orphan_repair: "orphan_repair";
|
|
1054
|
+
background_process_started: "background_process_started";
|
|
1055
|
+
background_process_settled: "background_process_settled";
|
|
1052
1056
|
}>;
|
|
1053
1057
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
1054
1058
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -37,6 +37,8 @@ export declare const SessionPhaseNameSchema: z.ZodEnum<{
|
|
|
37
37
|
stop_hook_continuation: "stop_hook_continuation";
|
|
38
38
|
stop_hook_cap_reached: "stop_hook_cap_reached";
|
|
39
39
|
orphan_repair: "orphan_repair";
|
|
40
|
+
background_process_started: "background_process_started";
|
|
41
|
+
background_process_settled: "background_process_settled";
|
|
40
42
|
}>;
|
|
41
43
|
export declare const SessionPhasePayloadSchema: z.ZodObject<{
|
|
42
44
|
phase: z.ZodEnum<{
|
|
@@ -77,6 +79,8 @@ export declare const SessionPhasePayloadSchema: z.ZodObject<{
|
|
|
77
79
|
stop_hook_continuation: "stop_hook_continuation";
|
|
78
80
|
stop_hook_cap_reached: "stop_hook_cap_reached";
|
|
79
81
|
orphan_repair: "orphan_repair";
|
|
82
|
+
background_process_started: "background_process_started";
|
|
83
|
+
background_process_settled: "background_process_settled";
|
|
80
84
|
}>;
|
|
81
85
|
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
82
86
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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' | 'pause_extension_granted' | 'suspected_loop' | 'compaction_disabled' | 'boot_warning' | 'workspace_subscribed' | 'workspace_delivery' | 'gate_shape' | 'session_id_assigned' | 'many_image_degraded' | 'stream_accepted_after_drop' | 'connection_retry' | 'usage_notice' | 'tool_degraded' | 'strategy_nudge_fired' | 'stop_inject_dropped' | 'stop_hook_continuation' | 'stop_hook_cap_reached' | 'orphan_repair';
|
|
1
|
+
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' | 'pause_extension_granted' | 'suspected_loop' | 'compaction_disabled' | 'boot_warning' | 'workspace_subscribed' | 'workspace_delivery' | 'gate_shape' | 'session_id_assigned' | 'many_image_degraded' | 'stream_accepted_after_drop' | 'connection_retry' | 'usage_notice' | 'tool_degraded' | 'strategy_nudge_fired' | 'stop_inject_dropped' | 'stop_hook_continuation' | 'stop_hook_cap_reached' | 'orphan_repair' | 'background_process_started' | 'background_process_settled';
|
|
2
2
|
export interface SessionPhasePayload {
|
|
3
3
|
phase: SessionPhaseName;
|
|
4
4
|
durationMs?: number;
|
|
@@ -6,6 +6,7 @@ export interface PendingBgAgentNotification {
|
|
|
6
6
|
export declare function formatBgResultBody(job: BackgroundJob): string;
|
|
7
7
|
export declare function buildBgResultInjection(job: BackgroundJob): string;
|
|
8
8
|
export declare function isAutoDeliverEnabled(raw: string | undefined): boolean;
|
|
9
|
+
export declare function replCanAutoWake(): boolean;
|
|
9
10
|
export declare class BgResultNotifier {
|
|
10
11
|
private readonly registry;
|
|
11
12
|
private pendingInjections;
|
|
@@ -8,4 +8,4 @@ import type { createBootstrapInfra } from './bootstrap-infra.js';
|
|
|
8
8
|
export declare function rebindResumeTraceWriter(ctx: Pick<InteractiveCtx, 'traceWriter'>, writer: TraceWriter | undefined, holders: readonly {
|
|
9
9
|
setTraceWriter(writer: TraceWriter | undefined): void;
|
|
10
10
|
}[]): void;
|
|
11
|
-
export declare function createResumeRequest(getCtx: () => InteractiveCtx, sessionRef: SessionRef, sharedDeps: ReturnType<typeof buildSharedDeps>, infra: Pick<ReturnType<typeof createBootstrapInfra>, 'subagentExecutor' | 'skillExecutor' | 'composeExecutor' | 'rootManager' | 'backgroundRegistry'>, clearTrustedSkills: () => void, maxTurns: number): (target: ResolvedResumeTarget) => ReturnType<typeof performResumeSwap>;
|
|
11
|
+
export declare function createResumeRequest(getCtx: () => InteractiveCtx, sessionRef: SessionRef, sharedDeps: ReturnType<typeof buildSharedDeps>, infra: Pick<ReturnType<typeof createBootstrapInfra>, 'subagentExecutor' | 'skillExecutor' | 'composeExecutor' | 'rootManager' | 'backgroundRegistry' | 'processJobs'>, clearTrustedSkills: () => void, maxTurns: number): (target: ResolvedResumeTarget) => ReturnType<typeof performResumeSwap>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProcessJobRegistry, ProcessJobSnapshot } from '../../../agent/shell-jobs/process-jobs.js';
|
|
2
|
+
export declare function escapeXmlAttr(text: string): string;
|
|
2
3
|
export declare function buildProcessResultInjection(job: ProcessJobSnapshot): string;
|
|
3
4
|
export declare function formatProcessNotice(job: ProcessJobSnapshot): string;
|
|
4
5
|
export declare class ProcessJobNotifier {
|