agent-afk 5.297.0 → 5.298.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.
- package/dist/agent/hooks.d.ts +1 -0
- package/dist/agent/peer/inbox-store.d.ts +12 -4
- package/dist/agent/peer/inbox-store.orphan.d.ts +2 -0
- package/dist/agent/providers/anthropic-direct/build-dispatcher.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query/cwd-dependents.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/index.dispatcher-opts.d.ts +21 -0
- package/dist/agent/spine/spine-hook.diff.d.ts +9 -0
- package/dist/agent/subagent/fork-child-config.d.ts +2 -0
- package/dist/agent/subagent/fork-types.d.ts +2 -0
- package/dist/agent/subagent/worktree-main-root-cache.d.ts +5 -0
- package/dist/agent/subagent.d.ts +2 -0
- package/dist/agent/tools/dispatcher.core-exec.d.ts +1 -0
- package/dist/agent/tools/dispatcher.d.ts +2 -0
- package/dist/agent/tools/handlers/bash.d.ts +1 -1
- package/dist/agent/tools/nesting.d.ts +1 -1
- package/dist/agent/tools/skill-executor/fork-child-config.d.ts +1 -0
- package/dist/agent/tools/skill-executor/types.d.ts +2 -1
- package/dist/agent/tools/subagent/child-config.d.ts +2 -1
- package/dist/agent/tools/subagent-executor/types.d.ts +2 -1
- package/dist/agent/tools/subagent-executor.d.ts +2 -2
- package/dist/agent/tools/subagent-executor.wave-manifest.d.ts +9 -0
- package/dist/agent/types/config-types.d.ts +1 -0
- package/dist/cli/commands/interactive/peer-inbox-notifier.d.ts +1 -0
- package/dist/cli/commands/interactive/peer-inbox-scan.d.ts +12 -5
- package/dist/cli.mjs +439 -437
- package/dist/index.mjs +144 -145
- package/dist/paths.spine.d.ts +1 -0
- package/dist/telegram.mjs +186 -184
- package/package.json +4 -2
package/dist/agent/hooks.d.ts
CHANGED
|
@@ -10,13 +10,21 @@ export declare function envelopeFilename(env: Pick<PeerEnvelope, 'ts' | 'message
|
|
|
10
10
|
export declare function writeEnvelope(env: PeerEnvelope): Promise<void>;
|
|
11
11
|
export declare function listPending(sessionId: string): Promise<string[]>;
|
|
12
12
|
export declare function claimPending(sessionId: string, file: string): Promise<PeerEnvelope | null>;
|
|
13
|
-
export
|
|
14
|
-
export declare function peekPending(sessionId: string, file: string): Promise<PeerEnvelope |
|
|
13
|
+
export { checkOrphanPending, clearDeliveredReceipt } from './inbox-store.orphan.js';
|
|
14
|
+
export declare function peekPending(sessionId: string, file: string): Promise<PeerEnvelope | 'vanished' | 'unparseable'>;
|
|
15
15
|
export declare function holdPending(sessionId: string, file: string): Promise<boolean>;
|
|
16
|
-
export
|
|
16
|
+
export interface HeldEntryOk {
|
|
17
17
|
file: string;
|
|
18
18
|
envelope: PeerEnvelope;
|
|
19
|
-
|
|
19
|
+
corrupt?: never;
|
|
20
|
+
}
|
|
21
|
+
export interface HeldEntryCorrupt {
|
|
22
|
+
file: string;
|
|
23
|
+
corrupt: true;
|
|
24
|
+
envelope?: never;
|
|
25
|
+
}
|
|
26
|
+
export type HeldEntry = HeldEntryOk | HeldEntryCorrupt;
|
|
27
|
+
export declare function listHeld(sessionId: string): Promise<HeldEntry[]>;
|
|
20
28
|
export declare function releaseHeld(sessionId: string, file: string): Promise<boolean>;
|
|
21
29
|
export declare function dropHeld(sessionId: string, file: string): Promise<boolean>;
|
|
22
30
|
export declare function countPending(sessionId: string): Promise<number>;
|
|
@@ -29,6 +29,7 @@ export interface CwdDependentsFactoryArgs {
|
|
|
29
29
|
writeRoots?: string[];
|
|
30
30
|
sessionId?: string;
|
|
31
31
|
parentSessionId?: string;
|
|
32
|
+
rootSessionId?: string;
|
|
32
33
|
traceWriter?: AgentConfig['traceWriter'];
|
|
33
34
|
runtimeStateSource?: RuntimeStateSource;
|
|
34
35
|
hookRegistry?: AgentConfig['hookRegistry'];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PlanExitControls } from '../../types/config-types.js';
|
|
2
|
+
import type { RuntimeStateSource } from '../../awareness/index.js';
|
|
3
|
+
export interface BuildDispatcherOpts {
|
|
4
|
+
cwd?: string;
|
|
5
|
+
readRoots?: string[];
|
|
6
|
+
writeRoots?: string[];
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
parentSessionId?: string;
|
|
9
|
+
rootSessionId?: string;
|
|
10
|
+
subagentId?: string;
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
subagentToolOutputCapBytes?: number;
|
|
13
|
+
traceWriter?: import('../../trace/index.js').TraceSink;
|
|
14
|
+
bashOutputTailReporter?: (toolUseId: string) => (tail: string | undefined) => void;
|
|
15
|
+
detachRegistry?: import('../../tools/detach-registry.js').DetachableToolRegistry;
|
|
16
|
+
runtimeStateSource?: RuntimeStateSource;
|
|
17
|
+
isSkillDispatch?: boolean;
|
|
18
|
+
isNonInteractive?: boolean;
|
|
19
|
+
hookRegistry?: import('../../hooks.js').HookRegistry;
|
|
20
|
+
planExitControls?: PlanExitControls;
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DiffResult {
|
|
2
|
+
diff: string;
|
|
3
|
+
fingerprint: string;
|
|
4
|
+
worktreeRoot: string;
|
|
5
|
+
skipped: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function getClassifiableDiff(worktreeCwd: string, fallbackRoot: string): DiffResult;
|
|
8
|
+
export declare function isDuplicateDiff(fingerprint: string, worktreeRoot: string): boolean;
|
|
9
|
+
export declare function persistDiffFingerprint(fingerprint: string, worktreeRoot: string): void;
|
|
@@ -24,6 +24,8 @@ export interface AssembleChildConfigArgs<T> {
|
|
|
24
24
|
parentTraceWriter: TraceSink | undefined;
|
|
25
25
|
parentSurface: Surface | undefined;
|
|
26
26
|
parentCanUseTool: CanUseTool | undefined;
|
|
27
|
+
parentRootSessionId: string | undefined;
|
|
27
28
|
nestedAgentAllowlist?: readonly string[];
|
|
28
29
|
}
|
|
30
|
+
export type ParentForkFields = Pick<AssembleChildConfigArgs<unknown>, 'parentCwd' | 'parentApiKey' | 'parentBaseUrl' | 'parentProvider' | 'parentTraceWriter' | 'parentSurface' | 'parentCanUseTool' | 'parentRootSessionId'>;
|
|
29
31
|
export declare function assembleChildConfig<T>(args: AssembleChildConfigArgs<T>): AgentConfig;
|
|
@@ -15,6 +15,7 @@ export interface ForkParent {
|
|
|
15
15
|
}
|
|
16
16
|
export interface JournalParent {
|
|
17
17
|
readonly messageJournal?: MessageJournal;
|
|
18
|
+
readonly sessionId?: string | undefined;
|
|
18
19
|
}
|
|
19
20
|
export interface ForkSubagentOptions<T = unknown> {
|
|
20
21
|
parent: Pick<IAgentSession, 'sessionId'> & Partial<Pick<IAgentSession, 'getInputStreamRef' | 'abortSignal' | 'hookRegistry'>> & JournalParent;
|
|
@@ -45,6 +46,7 @@ export interface SubagentManagerOptions {
|
|
|
45
46
|
parentModel?: string;
|
|
46
47
|
cwd?: string;
|
|
47
48
|
parentReadRoots?: string[];
|
|
49
|
+
parentRootSessionId?: string;
|
|
48
50
|
traceWriter?: TraceSink;
|
|
49
51
|
surface?: Surface;
|
|
50
52
|
onSubagentSucceeded?: (usage: import('./result.js').SubagentTrace['usage'], costUsd: number | undefined) => void;
|
package/dist/agent/subagent.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare class SubagentManager {
|
|
|
23
23
|
private readonly parentModel;
|
|
24
24
|
private parentCwd;
|
|
25
25
|
private readonly parentReadRoots;
|
|
26
|
+
private readonly parentRootSessionId;
|
|
26
27
|
private readonly worktreeMainRootCache;
|
|
27
28
|
private parentTraceWriter;
|
|
28
29
|
private readonly parentSurface;
|
|
@@ -46,6 +47,7 @@ export declare class SubagentManager {
|
|
|
46
47
|
setCwd(cwd: string): void;
|
|
47
48
|
setTraceWriter(writer: TraceSink | undefined): void;
|
|
48
49
|
getReadScopeInputs(): ReadScopeInputs;
|
|
50
|
+
private parentForkFields;
|
|
49
51
|
private resolveMainRootForCwd;
|
|
50
52
|
abortAll(reason?: unknown, origin?: AbortOrigin): void;
|
|
51
53
|
forkSubagent<T = unknown>(options: ForkSubagentOptions<T>): Promise<SubagentHandle<T>>;
|
|
@@ -14,6 +14,7 @@ export interface CoreExecDeps {
|
|
|
14
14
|
hookRegistry: HookRegistry | undefined;
|
|
15
15
|
sessionId: string | undefined;
|
|
16
16
|
parentSessionId: string | undefined;
|
|
17
|
+
rootSessionId: string | undefined;
|
|
17
18
|
sessionGrantManager: GrantManager | undefined;
|
|
18
19
|
traceWriter: TraceSink | undefined;
|
|
19
20
|
maxOutputBytes: number | undefined;
|
|
@@ -36,6 +36,7 @@ export interface SessionToolDispatcherOptions {
|
|
|
36
36
|
env?: Record<string, string>;
|
|
37
37
|
sessionId?: string;
|
|
38
38
|
parentSessionId?: string;
|
|
39
|
+
rootSessionId?: string;
|
|
39
40
|
subagentId?: string;
|
|
40
41
|
sessionGrantManager?: GrantManager;
|
|
41
42
|
traceWriter?: TraceSink;
|
|
@@ -64,6 +65,7 @@ export declare class SessionToolDispatcher implements ToolDispatcher {
|
|
|
64
65
|
private readonly _env;
|
|
65
66
|
private readonly sessionId;
|
|
66
67
|
private readonly parentSessionId;
|
|
68
|
+
private readonly rootSessionId;
|
|
67
69
|
private readonly subagentId;
|
|
68
70
|
private readonly sessionGrantManager;
|
|
69
71
|
private readonly traceWriter;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ToolHandler } from '../types.js';
|
|
2
|
-
export declare function createBashHandler(
|
|
2
|
+
export declare function createBashHandler(_permissionMode: string, cwd?: string): ToolHandler;
|
|
3
3
|
export declare const bashHandler: ToolHandler;
|
|
@@ -34,7 +34,7 @@ export interface CreateChildProviderFactoryOptions {
|
|
|
34
34
|
export declare function createChildProviderFactory(opts?: CreateChildProviderFactoryOptions): (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
35
35
|
export declare function buildReadOnlyReconProvider(model: AgentModelInput | undefined, openaiBaseUrl?: string, allowedTools?: readonly string[]): ModelProvider;
|
|
36
36
|
export declare function buildComposeNodeProvider(model: AgentModelInput | undefined, workspaceStore: WorkspaceStore, openaiBaseUrl?: string, readOnlyBash?: boolean): ModelProvider;
|
|
37
|
-
export declare function createChildSkillExecutorFactory(defaultModel: AgentModelInput, apiKey: string | undefined, childProviderFactory: (args: ChildProviderFactoryArgs) => ModelProvider, baseUrl?: string, traceWriter?: TraceSink, backgroundRegistry?: BackgroundAgentRegistry, cwd?: string, resolveApiKeyForModel?: (model: string) => string | undefined, surface?: Surface, defaultSubagentModel?: AgentModelInput, agentRegistry?: AgentRegistry, openaiBaseUrl?: string, xaiBaseUrl?: string, workspaceStore?: WorkspaceStore, delegationBudget?: import('./delegation-budget.js').DelegationBudget): (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent) => SkillExecutor;
|
|
37
|
+
export declare function createChildSkillExecutorFactory(defaultModel: AgentModelInput, apiKey: string | undefined, childProviderFactory: (args: ChildProviderFactoryArgs) => ModelProvider, baseUrl?: string, traceWriter?: TraceSink, backgroundRegistry?: BackgroundAgentRegistry, cwd?: string, resolveApiKeyForModel?: (model: string) => string | undefined, surface?: Surface, defaultSubagentModel?: AgentModelInput, agentRegistry?: AgentRegistry, openaiBaseUrl?: string, xaiBaseUrl?: string, workspaceStore?: WorkspaceStore, delegationBudget?: import('./delegation-budget.js').DelegationBudget): (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent, rootSessionId?: string) => SkillExecutor;
|
|
38
38
|
export type PhaseRole = 'read-only' | 'read-write';
|
|
39
39
|
export declare function buildSkillRestrictedProvider(allowedTools: string[], model: AgentModelInput | undefined, readOnlyBash?: boolean, openaiBaseUrl?: string, workspaceStore?: WorkspaceStore): ModelProvider;
|
|
40
40
|
export declare function buildPhaseRestrictedProvider(_role: 'read-only', model: AgentModelInput | undefined): ModelProvider;
|
|
@@ -4,6 +4,7 @@ import type { SkillExecutorInternals } from './types.js';
|
|
|
4
4
|
import type { MessageJournal } from '../../journal/types.js';
|
|
5
5
|
export interface JournalParentHolder {
|
|
6
6
|
messageJournal?: MessageJournal;
|
|
7
|
+
sessionId?: string | undefined;
|
|
7
8
|
}
|
|
8
9
|
export declare function buildForkedChildConfig(internals: SkillExecutorInternals, baseConfig: AgentConfig, signal: AbortSignal, readOnly?: boolean, allowedTools?: string[], journalView?: JournalParentHolder): {
|
|
9
10
|
childConfig: AgentConfig;
|
|
@@ -22,7 +22,7 @@ export interface SkillExecutorContext {
|
|
|
22
22
|
depth?: number;
|
|
23
23
|
maxDepth?: number;
|
|
24
24
|
childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
25
|
-
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent) => SkillExecutor;
|
|
25
|
+
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent, rootSessionId?: string) => SkillExecutor;
|
|
26
26
|
traceWriter?: TraceSink;
|
|
27
27
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
28
28
|
cwd?: string;
|
|
@@ -31,6 +31,7 @@ export interface SkillExecutorContext {
|
|
|
31
31
|
skillDispatchName?: string;
|
|
32
32
|
workspaceStore?: import('../../workspace/index.js').WorkspaceStore;
|
|
33
33
|
delegationBudget?: import('../../tools/delegation-budget.js').DelegationBudget;
|
|
34
|
+
parentRootSessionId?: string;
|
|
34
35
|
}
|
|
35
36
|
export interface SkillInput {
|
|
36
37
|
name: string;
|
|
@@ -29,7 +29,7 @@ export interface BuildChildConfigArgs {
|
|
|
29
29
|
resolveApiKeyForModel?: (model: string) => string | undefined;
|
|
30
30
|
defaultSubagentModel: AgentModelInput;
|
|
31
31
|
childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
32
|
-
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent) => SkillExecutor;
|
|
32
|
+
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent, rootSessionId?: string) => SkillExecutor;
|
|
33
33
|
surface?: Surface;
|
|
34
34
|
allowedTools?: string[];
|
|
35
35
|
readOnlyBash?: boolean;
|
|
@@ -38,6 +38,7 @@ export interface BuildChildConfigArgs {
|
|
|
38
38
|
traceWriter?: TraceSink;
|
|
39
39
|
workspaceStore?: import('../../workspace/index.js').WorkspaceStore;
|
|
40
40
|
delegationBudget?: import('../../tools/delegation-budget.js').DelegationBudget;
|
|
41
|
+
parentRootSessionId?: string;
|
|
41
42
|
createChildExecutor: (ctx: SubagentExecutorContext) => SubagentExecutor;
|
|
42
43
|
}
|
|
43
44
|
export interface BuildChildConfigResult {
|
|
@@ -23,7 +23,7 @@ export interface SubagentExecutorContext {
|
|
|
23
23
|
resolveApiKeyForModel?: (model: string) => string | undefined;
|
|
24
24
|
defaultSubagentModel: AgentModelInput;
|
|
25
25
|
childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
|
|
26
|
-
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent) => SkillExecutor;
|
|
26
|
+
childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string, inheritedReadScope?: ReadScopeInputs, skillDispatchName?: string, journalParent?: JournalParent, rootSessionId?: string) => SkillExecutor;
|
|
27
27
|
depth: number;
|
|
28
28
|
maxDepth?: number;
|
|
29
29
|
backgroundRegistry?: BackgroundAgentRegistry;
|
|
@@ -37,6 +37,7 @@ export interface SubagentExecutorContext {
|
|
|
37
37
|
agentRegistry?: AgentRegistry;
|
|
38
38
|
inboundAttachmentRegistry?: InboundAttachmentReader;
|
|
39
39
|
parentModel?: AgentModelInput;
|
|
40
|
+
parentRootSessionId?: string;
|
|
40
41
|
}
|
|
41
42
|
export interface SubagentControl {
|
|
42
43
|
hasPromotableForeground(): boolean;
|
|
@@ -18,11 +18,11 @@ export declare class SubagentExecutor implements SubagentControl {
|
|
|
18
18
|
describeAgentTool(): AnthropicToolDef;
|
|
19
19
|
private readonly promotionTriggers;
|
|
20
20
|
private readonly activeForegroundHandles;
|
|
21
|
-
private
|
|
22
|
-
private currentWaveCallIds;
|
|
21
|
+
private readonly waveTracker;
|
|
23
22
|
notifyWaveStart(calls: ReadonlyArray<ToolCall>, sessionId: string, traceLabel: string | null): void;
|
|
24
23
|
notifyWaveEnd(): void;
|
|
25
24
|
private updateCurrentWaveUnit;
|
|
25
|
+
private inheritedChildConfigArgs;
|
|
26
26
|
supportsBackgroundJobs(): boolean;
|
|
27
27
|
hasPromotableForeground(): boolean;
|
|
28
28
|
cancelBackgroundJob(call: ToolCall): Promise<ToolResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolCall } from './types.js';
|
|
2
|
+
export declare class WaveManifestTracker {
|
|
3
|
+
private currentWaveId;
|
|
4
|
+
private currentWaveCallIds;
|
|
5
|
+
notifyWaveStart(calls: ReadonlyArray<ToolCall>, sessionId: string, traceLabel: string | null, depth: number, currentCwd: string | undefined): void;
|
|
6
|
+
notifyWaveEnd(): void;
|
|
7
|
+
updateUnit(callId: string, status: 'running' | 'done' | 'failed', error?: string, cwd?: string): void;
|
|
8
|
+
get waveId(): string | undefined;
|
|
9
|
+
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import type { PeerInboundMode } from '../../../agent/peer/inbound-mode.js';
|
|
2
2
|
import type { WakeBudget } from '../../../agent/peer/guards.js';
|
|
3
3
|
import type { PeerEnvelope } from '../../../agent/peer/envelope.js';
|
|
4
|
-
export type HeldReason = 'inbound-hold' | 'wake-budget';
|
|
4
|
+
export type HeldReason = 'inbound-hold' | 'wake-budget' | 'corrupt';
|
|
5
|
+
export interface HeldEntryOk {
|
|
6
|
+
envelope: PeerEnvelope;
|
|
7
|
+
reason: Exclude<HeldReason, 'corrupt'>;
|
|
8
|
+
}
|
|
9
|
+
export interface HeldEntryCorrupt {
|
|
10
|
+
envelope?: never;
|
|
11
|
+
reason: 'corrupt';
|
|
12
|
+
file: string;
|
|
13
|
+
}
|
|
14
|
+
export type HeldEntry = HeldEntryOk | HeldEntryCorrupt;
|
|
5
15
|
export interface PeerScanResult {
|
|
6
16
|
claimed: PeerEnvelope[];
|
|
7
|
-
held:
|
|
8
|
-
envelope: PeerEnvelope;
|
|
9
|
-
reason: HeldReason;
|
|
10
|
-
}>;
|
|
17
|
+
held: HeldEntry[];
|
|
11
18
|
}
|
|
12
19
|
export interface PeerScanArgs {
|
|
13
20
|
sessionId: string;
|