agent-afk 5.308.5 → 5.308.7
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/afk-mode-gate.d.ts +1 -0
- package/dist/agent/background-registry.d.ts +0 -1
- package/dist/agent/background-registry.mark-terminal.d.ts +29 -0
- package/dist/agent/daemon/gates.d.ts +1 -1
- package/dist/agent/daemon/schedule-store.d.ts +5 -1
- package/dist/agent/daemon/scheduler.d.ts +2 -1
- package/dist/agent/daemon/scheduler.execute-agent-task.d.ts +3 -1
- package/dist/agent/daemon/scheduler.overlap-guard.d.ts +2 -0
- package/dist/agent/daemon/scheduler.runat-gate.d.ts +13 -0
- package/dist/agent/daemon/session-spawn.d.ts +3 -0
- package/dist/agent/daemon/triggers.d.ts +2 -0
- package/dist/agent/default-hook-registry.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/index.d.ts +2 -31
- package/dist/agent/providers/openai-compatible/index.options.d.ts +31 -0
- package/dist/agent/providers/shared/transient-retry.d.ts +1 -0
- package/dist/agent/providers/xai/oauth-http.d.ts +1 -0
- package/dist/agent/risk-classifier.d.ts +1 -0
- package/dist/agent/subagent.abort-wiring.d.ts +1 -0
- package/dist/agent/subagent.drain.d.ts +11 -0
- package/dist/agent/tools/compose-executor.context.d.ts +29 -0
- package/dist/agent/tools/compose-executor.d.ts +2 -28
- package/dist/agent/tools/compose-executor.wave-manifest.d.ts +14 -0
- package/dist/agent/tools/subagent-executor.d.ts +2 -2
- package/dist/agent/tools/subagent-executor.execute-once.d.ts +22 -0
- package/dist/agent/tools/subagent-executor.execute-once.helpers.d.ts +103 -0
- package/dist/cli/commands/config-command.env.d.ts +2 -0
- package/dist/cli/commands/interactive/bootstrap-session-builder.d.ts +9 -0
- package/dist/cli/commands/marketplace.subcommands.d.ts +14 -0
- package/dist/cli/config/json-tier-parse.interactive.d.ts +4 -0
- package/dist/cli/config/json-tier-parse.telegram.d.ts +4 -0
- package/dist/cli/markdown-stream-buffer.d.ts +2 -11
- package/dist/cli/markdown-stream-format.d.ts +0 -8
- package/dist/cli/markdown-stream.d.ts +0 -2
- package/dist/cli/slash/commands/info.mcp.d.ts +2 -0
- package/dist/cli.mjs +383 -384
- package/dist/improve/schemas.d.ts +2 -2
- package/dist/index.mjs +169 -169
- package/dist/telegram.mjs +192 -192
- package/package.json +1 -2
|
@@ -12,5 +12,6 @@ export interface AfkModeGateOptions {
|
|
|
12
12
|
}) => Promise<ElicitationResult>;
|
|
13
13
|
sessionId?: string;
|
|
14
14
|
traceWriter?: TraceSink;
|
|
15
|
+
daemonTaskId?: string;
|
|
15
16
|
}
|
|
16
17
|
export declare function createAfkModeGate(getMode: () => PermissionMode, cwd?: string, getCwd?: () => string | undefined, opts?: AfkModeGateOptions): HookHandler;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BgJobLogWriter, BgJobMeta } from './bg-job-log.js';
|
|
2
|
+
import type { SubagentResult, SubagentStatus } from './subagent.js';
|
|
3
|
+
import type { TraceSink } from './trace/index.js';
|
|
4
|
+
import type { BackgroundJobStatus } from './background-registry.types.js';
|
|
5
|
+
export interface MarkTerminalJob {
|
|
6
|
+
jobId: string;
|
|
7
|
+
subagentId: string;
|
|
8
|
+
status: BackgroundJobStatus;
|
|
9
|
+
startedAt: number;
|
|
10
|
+
endedAt?: number;
|
|
11
|
+
result?: SubagentResult;
|
|
12
|
+
provenance: 'user' | 'model';
|
|
13
|
+
parentSessionId?: string;
|
|
14
|
+
cancelSource?: 'explicit' | 'cascade';
|
|
15
|
+
modelCancelReason?: string;
|
|
16
|
+
transcriptTail: string;
|
|
17
|
+
touchedFiles: string[];
|
|
18
|
+
handle: {
|
|
19
|
+
teardown(): Promise<void>;
|
|
20
|
+
cancel(): Promise<void>;
|
|
21
|
+
};
|
|
22
|
+
settle: (r: SubagentResult) => void;
|
|
23
|
+
onCleanup?: () => Promise<void>;
|
|
24
|
+
onSettled?: () => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function statusFromResult(s: SubagentStatus): BackgroundJobStatus;
|
|
27
|
+
export declare function appendTranscript(job: MarkTerminalJob, chunk: string): void;
|
|
28
|
+
export declare function recordTouched(job: MarkTerminalJob, rawInput: unknown): void;
|
|
29
|
+
export declare function markTerminalImpl(job: MarkTerminalJob, result: SubagentResult, emit: (job: MarkTerminalJob) => void, evict: (jobId: string) => void, traceWriter: TraceSink | undefined, writer?: BgJobLogWriter, openMeta?: BgJobMeta): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const DEFAULT_SESSIONSTART_COOLDOWN_MS: number;
|
|
2
|
-
export type SessionStartSkipReason = 'cooldown' | 'overlap' | 'budget-over' | 'telemetry-unwritable';
|
|
2
|
+
export type SessionStartSkipReason = 'cooldown' | 'overlap' | 'budget-over' | 'telemetry-unwritable' | 'expired' | 'not-yet';
|
|
3
3
|
export interface GateDecision {
|
|
4
4
|
fire: boolean;
|
|
5
5
|
skipReason?: SessionStartSkipReason;
|
|
@@ -12,6 +12,8 @@ export interface ScheduledTaskConfig {
|
|
|
12
12
|
notifyChat?: number | string;
|
|
13
13
|
maxAttempts?: number;
|
|
14
14
|
retryDelayMs?: number;
|
|
15
|
+
runAt?: string;
|
|
16
|
+
expiresAt?: string;
|
|
15
17
|
createdAt: string;
|
|
16
18
|
updatedAt: string;
|
|
17
19
|
}
|
|
@@ -20,8 +22,10 @@ export declare function saveSchedules(configs: ScheduledTaskConfig[], path?: str
|
|
|
20
22
|
export declare function addSchedule(config: Omit<ScheduledTaskConfig, 'id' | 'createdAt' | 'updatedAt'>, path?: string): ScheduledTaskConfig;
|
|
21
23
|
export declare function removeSchedule(id: string, path?: string): boolean;
|
|
22
24
|
export declare function getSchedule(id: string, path?: string): ScheduledTaskConfig | undefined;
|
|
23
|
-
export type SchedulePatch = Partial<Omit<ScheduledTaskConfig, 'id' | 'createdAt' | 'updatedAt' | 'cwd'>> & {
|
|
25
|
+
export type SchedulePatch = Partial<Omit<ScheduledTaskConfig, 'id' | 'createdAt' | 'updatedAt' | 'cwd' | 'runAt' | 'expiresAt'>> & {
|
|
24
26
|
cwd?: string | null;
|
|
27
|
+
runAt?: string | null;
|
|
28
|
+
expiresAt?: string | null;
|
|
25
29
|
};
|
|
26
30
|
export declare function updateSchedule(id: string, patch: SchedulePatch, path?: string): ScheduledTaskConfig | undefined;
|
|
27
31
|
export declare function toggleScheduleEnabled(id: string, enabled: boolean, path?: string): ScheduledTaskConfig | undefined;
|
|
@@ -28,7 +28,7 @@ export interface SchedulerOptions {
|
|
|
28
28
|
retrySleep?: (ms: number, signal: AbortSignal) => Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
export type TelemetryTrigger = 'cron' | 'sessionstart' | 'pull';
|
|
31
|
-
type TelemetryStatus = 'success' | 'error' | 'skipped';
|
|
31
|
+
type TelemetryStatus = 'success' | 'error' | 'skipped' | 'blocked';
|
|
32
32
|
export interface TelemetryRecord {
|
|
33
33
|
taskId: string;
|
|
34
34
|
command: string;
|
|
@@ -43,6 +43,7 @@ export interface TelemetryRecord {
|
|
|
43
43
|
name?: string;
|
|
44
44
|
doneUnverified?: boolean;
|
|
45
45
|
attempts?: number;
|
|
46
|
+
gateBlocks?: number;
|
|
46
47
|
}
|
|
47
48
|
export interface TaskCompletionDetails {
|
|
48
49
|
responseText?: string;
|
|
@@ -29,7 +29,9 @@ export interface AgentTaskContext {
|
|
|
29
29
|
queueDir: string;
|
|
30
30
|
idleDetector: IdleDetector;
|
|
31
31
|
now: () => number;
|
|
32
|
-
spawnSession: (task: ScheduledTask, trigger: TelemetryTrigger
|
|
32
|
+
spawnSession: (task: ScheduledTask, trigger: TelemetryTrigger, gateBlockCounter?: {
|
|
33
|
+
count: number;
|
|
34
|
+
}) => Promise<{
|
|
33
35
|
session: AgentSession;
|
|
34
36
|
memoryStore: MemoryStore;
|
|
35
37
|
stateStore: StateStore;
|
|
@@ -6,6 +6,8 @@ export declare function makeOverlapSkipRecord(task: ScheduledTask, trigger: Tele
|
|
|
6
6
|
export declare function makeBudgetSkipRecord(task: ScheduledTask, trigger: TelemetryTrigger, nowMs: number, skip: BudgetGateSkip): TelemetryRecord;
|
|
7
7
|
export declare function makeTelemetryUnwritableSkipRecord(task: ScheduledTask, nowMs: number, errorDescription: string): TelemetryRecord;
|
|
8
8
|
export declare function makeSessionStartSkipRecord(task: ScheduledTask, decision: GateDecision, nowMs: number): TelemetryRecord;
|
|
9
|
+
export declare function makeExpiredSkipRecord(task: ScheduledTask, trigger: TelemetryTrigger, nowMs: number): TelemetryRecord;
|
|
10
|
+
export declare function makeNotYetSkipRecord(task: ScheduledTask, trigger: TelemetryTrigger, nowMs: number): TelemetryRecord;
|
|
9
11
|
export declare class OverlapAlertLatch {
|
|
10
12
|
private readonly alerted;
|
|
11
13
|
shouldAlert(taskId: string): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ScheduledTask } from './triggers.js';
|
|
2
|
+
import type { TelemetryRecord, TelemetryTrigger } from './scheduler.js';
|
|
3
|
+
export type RunAtGateResult = {
|
|
4
|
+
kind: 'pass';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'not-yet';
|
|
7
|
+
record: TelemetryRecord;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'expired';
|
|
10
|
+
record: TelemetryRecord;
|
|
11
|
+
};
|
|
12
|
+
export declare function evaluateRunAtGate(task: ScheduledTask, trigger: TelemetryTrigger, nowMs: number): RunAtGateResult;
|
|
13
|
+
export declare function applyAutoDisable(taskId: string, unregister: (id: string) => void): void;
|
|
@@ -9,6 +9,9 @@ export interface DaemonSpawnOptions {
|
|
|
9
9
|
sessionFactory?: (config: AgentConfig, ownedTraceWriter?: TraceWriter) => AgentSession;
|
|
10
10
|
trigger?: 'cron' | 'sessionstart' | 'pull';
|
|
11
11
|
taskCwd?: string;
|
|
12
|
+
gateBlockCounter?: {
|
|
13
|
+
count: number;
|
|
14
|
+
};
|
|
12
15
|
}
|
|
13
16
|
export declare function daemonTraceLabel(taskId: string): string;
|
|
14
17
|
export declare function _resetDaemonDefaultCwdCache(): void;
|
|
@@ -22,4 +22,5 @@ export declare function createDefaultHookRegistry(onSubagentComplete?: (info: Su
|
|
|
22
22
|
traceWriter?: TraceSink;
|
|
23
23
|
afkPromptForApproval?: boolean;
|
|
24
24
|
getTranscriptPath?: () => string | null;
|
|
25
|
+
daemonTaskId?: string;
|
|
25
26
|
}, getCwd?: () => string | undefined): DefaultHookRegistryResult;
|
|
@@ -1,35 +1,6 @@
|
|
|
1
1
|
import type { ModelProvider, ProviderQuery, ProviderQueryArgs, ProviderCompleteArgs } from '../../provider.js';
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
import type { SkillExecutor } from '../../tools/skill-executor.js';
|
|
5
|
-
import type { ComposeExecutor } from '../../tools/compose-executor.js';
|
|
6
|
-
import type { ToolPermissionConfig } from '../../tools/permissions.js';
|
|
7
|
-
import type { CanUseTool } from '../../types/sdk-types.js';
|
|
8
|
-
import type { ToolDispatcher } from '../anthropic-direct/tool-dispatcher.js';
|
|
9
|
-
import { MemoryStore } from '../../memory/index.js';
|
|
10
|
-
import { WorkspaceStore } from '../../workspace/index.js';
|
|
11
|
-
import { StateStore } from '../../state/state-store.js';
|
|
12
|
-
import { type ChildSessionOptions } from './index.child-session.js';
|
|
13
|
-
export interface OpenAICompatibleProviderOptions extends ChildSessionOptions {
|
|
14
|
-
baseURL?: string;
|
|
15
|
-
defaultHeaders?: Record<string, string>;
|
|
16
|
-
hookRegistry?: HookRegistry;
|
|
17
|
-
permissions?: ToolPermissionConfig;
|
|
18
|
-
canUseTool?: CanUseTool;
|
|
19
|
-
subagentExecutor?: SubagentExecutor;
|
|
20
|
-
skillExecutor?: SkillExecutor;
|
|
21
|
-
composeExecutor?: ComposeExecutor;
|
|
22
|
-
memoryStore?: MemoryStore;
|
|
23
|
-
workspaceStore?: WorkspaceStore;
|
|
24
|
-
stateStore?: StateStore;
|
|
25
|
-
surface?: string;
|
|
26
|
-
readOnlyMemory?: boolean;
|
|
27
|
-
readOnlyBash?: boolean;
|
|
28
|
-
tools?: ToolDispatcher;
|
|
29
|
-
mcpManager?: import('../../mcp/index.js').McpManager;
|
|
30
|
-
customTools?: import('../../tools/custom-tool.js').CustomToolDef[];
|
|
31
|
-
fastModeController?: import('../../fast-mode.js').FastModeController;
|
|
32
|
-
}
|
|
2
|
+
import { type OpenAICompatibleProviderOptions } from './index.options.js';
|
|
3
|
+
export type { OpenAICompatibleProviderOptions } from './index.options.js';
|
|
33
4
|
export declare class OpenAICompatibleProvider implements ModelProvider {
|
|
34
5
|
readonly name = "openai-compatible";
|
|
35
6
|
private readonly providerOpts;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HookRegistry } from '../../hooks.js';
|
|
2
|
+
import type { SubagentExecutor } from '../../tools/subagent-executor.js';
|
|
3
|
+
import type { SkillExecutor } from '../../tools/skill-executor.js';
|
|
4
|
+
import type { ComposeExecutor } from '../../tools/compose-executor.js';
|
|
5
|
+
import type { ToolPermissionConfig } from '../../tools/permissions.js';
|
|
6
|
+
import type { CanUseTool } from '../../types/sdk-types.js';
|
|
7
|
+
import type { ToolDispatcher } from '../anthropic-direct/tool-dispatcher.js';
|
|
8
|
+
import { MemoryStore } from '../../memory/index.js';
|
|
9
|
+
import { WorkspaceStore } from '../../workspace/index.js';
|
|
10
|
+
import { StateStore } from '../../state/state-store.js';
|
|
11
|
+
import type { ChildSessionOptions } from './index.child-session.js';
|
|
12
|
+
export interface OpenAICompatibleProviderOptions extends ChildSessionOptions {
|
|
13
|
+
baseURL?: string;
|
|
14
|
+
defaultHeaders?: Record<string, string>;
|
|
15
|
+
hookRegistry?: HookRegistry;
|
|
16
|
+
permissions?: ToolPermissionConfig;
|
|
17
|
+
canUseTool?: CanUseTool;
|
|
18
|
+
subagentExecutor?: SubagentExecutor;
|
|
19
|
+
skillExecutor?: SkillExecutor;
|
|
20
|
+
composeExecutor?: ComposeExecutor;
|
|
21
|
+
memoryStore?: MemoryStore;
|
|
22
|
+
workspaceStore?: WorkspaceStore;
|
|
23
|
+
stateStore?: StateStore;
|
|
24
|
+
surface?: string;
|
|
25
|
+
readOnlyMemory?: boolean;
|
|
26
|
+
readOnlyBash?: boolean;
|
|
27
|
+
tools?: ToolDispatcher;
|
|
28
|
+
mcpManager?: import('../../mcp/index.js').McpManager;
|
|
29
|
+
customTools?: import('../../tools/custom-tool.js').CustomToolDef[];
|
|
30
|
+
fastModeController?: import('../../fast-mode.js').FastModeController;
|
|
31
|
+
}
|
|
@@ -16,5 +16,6 @@ export interface TransientRetryOpts {
|
|
|
16
16
|
onExhausted?: (info: RetryInfo) => void;
|
|
17
17
|
sleep?: (ms: number, signal: AbortSignal) => Promise<void>;
|
|
18
18
|
}
|
|
19
|
+
export declare function isTransientOauthOrg403(err: unknown): boolean;
|
|
19
20
|
export declare function isTransientError(err: unknown): boolean;
|
|
20
21
|
export declare function withTransientRetry<T>(attempt: () => Promise<T>, opts?: TransientRetryOpts): Promise<T>;
|
|
@@ -20,4 +20,5 @@ export declare function safeText(res: Response): Promise<string>;
|
|
|
20
20
|
export declare function clearOidcCache(): void;
|
|
21
21
|
export declare function discoverXaiOidc(deps?: OAuthHttpDeps): Promise<XaiOidcDiscovery>;
|
|
22
22
|
export declare function discoverXaiOidcCached(deps?: OAuthHttpDeps): Promise<XaiOidcDiscovery>;
|
|
23
|
+
export declare function postOAuthForm(url: string, params: Record<string, string>, errPrefix: string, fetchFn?: FetchFn): Promise<Record<string, unknown>>;
|
|
23
24
|
export declare function tokenResponseToBundle(json: Record<string, unknown>, nowSeconds?: () => number, fallbackRefresh?: string): XaiTokenBundle | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function wireParentAbortSignal(parentSignal: AbortSignal, rootController: AbortController): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AbortOrigin } from './trace/index.js';
|
|
2
|
+
import type { AbortGraph } from './abort-graph.js';
|
|
3
|
+
import { SUBAGENT_DRAIN_TIMEOUT_MS } from './subagent/constants.js';
|
|
4
|
+
export interface DrainHandle {
|
|
5
|
+
cancel(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare function abortAllAndDrainImpl(active: ReadonlyMap<string, DrainHandle>, abortGraph: AbortGraph, rootId: string, reason: unknown, origin: AbortOrigin, timeoutMs: number, rearm: boolean, doRearm: () => void): Promise<{
|
|
8
|
+
drained: number;
|
|
9
|
+
timedOut: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export { SUBAGENT_DRAIN_TIMEOUT_MS };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentModelInput, IAgentSession } from '../types.js';
|
|
2
|
+
import type { Surface } from '../awareness/types.js';
|
|
3
|
+
import type { WorkspaceStore } from '../workspace/index.js';
|
|
4
|
+
import type { TraceSink } from '../trace/index.js';
|
|
5
|
+
import type { ReadScopeInputs } from '../subagent-read-scope.js';
|
|
6
|
+
import type { AgentRegistry } from '../agents/index.js';
|
|
7
|
+
import type { InboundAttachmentReader } from '../content/attachment-registry.js';
|
|
8
|
+
export interface ComposeExecutorContext {
|
|
9
|
+
parentSession: Pick<IAgentSession, 'sessionId' | 'abortSignal'> & import('../subagent/fork-types.js').JournalParent;
|
|
10
|
+
defaultModel?: AgentModelInput;
|
|
11
|
+
defaultSubagentModel: AgentModelInput;
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
resolveApiKeyForModel?: (model: string) => string | undefined;
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
openaiBaseUrl?: string;
|
|
16
|
+
systemPrompt: string;
|
|
17
|
+
cwd?: string;
|
|
18
|
+
traceWriter?: TraceSink;
|
|
19
|
+
surface?: Surface;
|
|
20
|
+
depth?: number;
|
|
21
|
+
maxDepth?: number;
|
|
22
|
+
getReadScopeInputs?: () => ReadScopeInputs;
|
|
23
|
+
workspaceStore?: WorkspaceStore;
|
|
24
|
+
agentRegistry?: AgentRegistry;
|
|
25
|
+
delegationBudget?: import('./delegation-budget.js').DelegationBudget;
|
|
26
|
+
inboundAttachmentRegistry?: InboundAttachmentReader;
|
|
27
|
+
onSubagentSucceeded?: (usage: import('../subagent/result.js').SubagentTrace['usage'], costUsd: number | undefined) => void;
|
|
28
|
+
credentialModel?: AgentModelInput;
|
|
29
|
+
}
|
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
import { type ReadScopeInputs } from '../subagent-read-scope.js';
|
|
2
|
-
import type { AgentModelInput, IAgentSession } from '../types.js';
|
|
3
|
-
import type { Surface } from '../awareness/types.js';
|
|
4
|
-
import type { WorkspaceStore } from '../workspace/index.js';
|
|
5
1
|
import type { TraceSink } from '../trace/index.js';
|
|
6
2
|
import type { ToolCall, ToolResult } from './types.js';
|
|
3
|
+
import { type ComposeExecutorContext } from './compose-executor.context.js';
|
|
4
|
+
export type { ComposeExecutorContext } from './compose-executor.context.js';
|
|
7
5
|
import { cleanupComposeSpills } from './compose-executor.format.js';
|
|
8
6
|
export { cleanupComposeSpills };
|
|
9
|
-
import type { InboundAttachmentReader } from '../content/attachment-registry.js';
|
|
10
|
-
import type { AgentRegistry } from '../agents/index.js';
|
|
11
7
|
import type { DetachableToolRegistry } from './detach-registry.js';
|
|
12
|
-
export interface ComposeExecutorContext {
|
|
13
|
-
parentSession: Pick<IAgentSession, 'sessionId' | 'abortSignal'> & import('../subagent/fork-types.js').JournalParent;
|
|
14
|
-
defaultModel?: AgentModelInput;
|
|
15
|
-
defaultSubagentModel: AgentModelInput;
|
|
16
|
-
apiKey?: string;
|
|
17
|
-
resolveApiKeyForModel?: (model: string) => string | undefined;
|
|
18
|
-
baseUrl?: string;
|
|
19
|
-
openaiBaseUrl?: string;
|
|
20
|
-
systemPrompt: string;
|
|
21
|
-
cwd?: string;
|
|
22
|
-
traceWriter?: TraceSink;
|
|
23
|
-
surface?: Surface;
|
|
24
|
-
depth?: number;
|
|
25
|
-
maxDepth?: number;
|
|
26
|
-
getReadScopeInputs?: () => ReadScopeInputs;
|
|
27
|
-
workspaceStore?: WorkspaceStore;
|
|
28
|
-
agentRegistry?: AgentRegistry;
|
|
29
|
-
delegationBudget?: import('./delegation-budget.js').DelegationBudget;
|
|
30
|
-
inboundAttachmentRegistry?: InboundAttachmentReader;
|
|
31
|
-
onSubagentSucceeded?: (usage: import('../subagent/result.js').SubagentTrace['usage'], costUsd: number | undefined) => void;
|
|
32
|
-
credentialModel?: AgentModelInput;
|
|
33
|
-
}
|
|
34
8
|
export declare class ComposeExecutor {
|
|
35
9
|
private readonly ctx;
|
|
36
10
|
private currentCwd;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComposeInput } from './compose-input-parse.js';
|
|
2
|
+
import type { AgentModelInput } from '../types.js';
|
|
3
|
+
import type { AgentRegistry } from '../agents/index.js';
|
|
4
|
+
export interface BuildComposeWaveManifestArgs {
|
|
5
|
+
parsed: ComposeInput;
|
|
6
|
+
dagNodeCount: number;
|
|
7
|
+
depth: number | undefined;
|
|
8
|
+
currentCwd: string | undefined;
|
|
9
|
+
defaultModel: AgentModelInput | undefined;
|
|
10
|
+
defaultSubagentModel: AgentModelInput;
|
|
11
|
+
parentSessionId: string | undefined;
|
|
12
|
+
agentRegistry: AgentRegistry | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare function buildComposeWaveManifest(args: BuildComposeWaveManifestArgs): string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TraceSink } from '../trace/index.js';
|
|
2
2
|
import type { AnthropicToolDef, ToolCall, ToolResult } from './types.js';
|
|
3
|
-
import {
|
|
3
|
+
import type { AgentExecutionMode } from './subagent/input-parse.js';
|
|
4
4
|
import { buildSubagentsLite } from './subagent-executor.lite-snapshot.js';
|
|
5
5
|
import type { SubagentExecutorContext, SubagentControl } from './subagent-executor/types.js';
|
|
6
6
|
import type { QueuedNoteClaim, PromotedSubagentInfo } from './subagent-executor/types.js';
|
|
@@ -11,7 +11,7 @@ export type { PromotedSubagentInfo } from './subagent/foreground-promotion.js';
|
|
|
11
11
|
export declare class SubagentExecutor implements SubagentControl {
|
|
12
12
|
private readonly ctx;
|
|
13
13
|
private currentCwd;
|
|
14
|
-
private
|
|
14
|
+
private readonly isolationCounterRef;
|
|
15
15
|
constructor(ctx: SubagentExecutorContext);
|
|
16
16
|
setCwd(cwd: string): void;
|
|
17
17
|
setTraceWriter(writer: TraceSink | undefined): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ToolCall, ToolResult } from './types.js';
|
|
2
|
+
import { type BuildChildConfigArgs } from './subagent/child-config.js';
|
|
3
|
+
import { type PromotionTrigger } from './subagent/foreground-promotion.js';
|
|
4
|
+
import type { StreamCutProbe } from '../subagent/stream-cut-retry.js';
|
|
5
|
+
import { WaveManifestTracker } from './subagent-executor.wave-manifest.js';
|
|
6
|
+
import type { SubagentExecutorContext } from './subagent-executor/types.js';
|
|
7
|
+
export interface ExecuteOnceArgs {
|
|
8
|
+
ctx: SubagentExecutorContext;
|
|
9
|
+
currentCwd: string | undefined;
|
|
10
|
+
isolationCounterRef: {
|
|
11
|
+
value: number;
|
|
12
|
+
};
|
|
13
|
+
waveTracker: WaveManifestTracker;
|
|
14
|
+
promotionTriggers: Map<string, PromotionTrigger>;
|
|
15
|
+
activeForegroundHandles: Map<string, {
|
|
16
|
+
cancel: () => Promise<void>;
|
|
17
|
+
}>;
|
|
18
|
+
getCancelGeneration: () => number;
|
|
19
|
+
inheritedChildConfigArgs: () => Partial<BuildChildConfigArgs>;
|
|
20
|
+
updateCurrentWaveUnit: (callId: string, status: 'running' | 'done' | 'failed', error?: string, cwd?: string) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function executeOnce(call: ToolCall, args: ExecuteOnceArgs, probe?: StreamCutProbe, retryCancelGeneration?: number): Promise<ToolResult>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { SubagentManager } from '../subagent.js';
|
|
2
|
+
import type { AgentInput } from './subagent/input-parse.js';
|
|
3
|
+
import type { StreamCutProbe } from '../subagent/stream-cut-retry.js';
|
|
4
|
+
import { type InboundAttachmentReader } from '../content/attachment-registry.js';
|
|
5
|
+
import type { SpawnReceipt } from './delegation-budget.js';
|
|
6
|
+
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
|
|
7
|
+
import type { RegisteredAgent } from '../agents/index.js';
|
|
8
|
+
import type { SubagentExecutorContext } from './subagent-executor/types.js';
|
|
9
|
+
import type { TraceOrigin, TraceActor } from '../session/session-identity.js';
|
|
10
|
+
import type { AgentConfig } from '../types/config-types.js';
|
|
11
|
+
import type { ToolResult } from './types.js';
|
|
12
|
+
import type { TraceSink } from '../trace/index.js';
|
|
13
|
+
export interface IsolationWorktreeResult {
|
|
14
|
+
teardown: {
|
|
15
|
+
repoRoot: string;
|
|
16
|
+
worktreePath: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface SetupIsolationWorktreeArgs {
|
|
20
|
+
parsed: AgentInput;
|
|
21
|
+
currentCwd: string | undefined;
|
|
22
|
+
isolationCounterRef: {
|
|
23
|
+
value: number;
|
|
24
|
+
};
|
|
25
|
+
childConfig: AgentConfig;
|
|
26
|
+
childWriteCapable: boolean;
|
|
27
|
+
probe: StreamCutProbe | undefined;
|
|
28
|
+
budgetReceipt: SpawnReceipt | undefined;
|
|
29
|
+
}
|
|
30
|
+
export declare function setupIsolationWorktree(args: SetupIsolationWorktreeArgs): Promise<IsolationWorktreeResult | {
|
|
31
|
+
skipped: true;
|
|
32
|
+
} | {
|
|
33
|
+
error: ToolResult;
|
|
34
|
+
}>;
|
|
35
|
+
export interface ForkAndCheckCancelArgs {
|
|
36
|
+
ctx: SubagentExecutorContext;
|
|
37
|
+
parsed: AgentInput;
|
|
38
|
+
childConfig: AgentConfig;
|
|
39
|
+
namedAgent: RegisteredAgent | undefined;
|
|
40
|
+
nestedAgentAllowlist: string[] | undefined;
|
|
41
|
+
isolationTeardown: {
|
|
42
|
+
repoRoot: string;
|
|
43
|
+
worktreePath: string;
|
|
44
|
+
} | undefined;
|
|
45
|
+
getCancelGeneration: () => number;
|
|
46
|
+
retryCancelGeneration: number | undefined;
|
|
47
|
+
budgetReceipt: SpawnReceipt | undefined;
|
|
48
|
+
childManager: {
|
|
49
|
+
teardownAll: () => Promise<void>;
|
|
50
|
+
} | undefined;
|
|
51
|
+
identity: {
|
|
52
|
+
origin?: TraceOrigin;
|
|
53
|
+
actor?: TraceActor;
|
|
54
|
+
};
|
|
55
|
+
depth: number;
|
|
56
|
+
updateCurrentWaveUnit: (callId: string, status: 'running' | 'done' | 'failed', error?: string, cwd?: string) => void;
|
|
57
|
+
callId: string;
|
|
58
|
+
}
|
|
59
|
+
export type ForkResult = {
|
|
60
|
+
handle: Awaited<ReturnType<SubagentManager['forkSubagent']>>;
|
|
61
|
+
cancelled: false;
|
|
62
|
+
} | {
|
|
63
|
+
cancelled: true;
|
|
64
|
+
result: ToolResult;
|
|
65
|
+
} | {
|
|
66
|
+
forkError: true;
|
|
67
|
+
result: ToolResult;
|
|
68
|
+
};
|
|
69
|
+
export declare function forkAndCheckCancel(args: ForkAndCheckCancelArgs): Promise<ForkResult>;
|
|
70
|
+
export interface ResolveChildPromptArgs {
|
|
71
|
+
parsed: AgentInput;
|
|
72
|
+
childScopeInputs: {
|
|
73
|
+
parentReadRoots: string[] | undefined;
|
|
74
|
+
parentCwd: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
currentCwd: string | undefined;
|
|
77
|
+
sessionId: string | undefined;
|
|
78
|
+
attachmentRegistry?: InboundAttachmentReader;
|
|
79
|
+
}
|
|
80
|
+
export type ResolveChildPromptResult = {
|
|
81
|
+
prompt: string | ContentBlockParam[];
|
|
82
|
+
error?: never;
|
|
83
|
+
} | {
|
|
84
|
+
error: ToolResult;
|
|
85
|
+
prompt?: never;
|
|
86
|
+
};
|
|
87
|
+
export declare function resolveChildPrompt(args: ResolveChildPromptArgs): Promise<ResolveChildPromptResult>;
|
|
88
|
+
export interface RunBackgroundDispatchArgs {
|
|
89
|
+
handle: Awaited<ReturnType<SubagentManager['forkSubagent']>>;
|
|
90
|
+
ctx: SubagentExecutorContext;
|
|
91
|
+
parsed: AgentInput;
|
|
92
|
+
childConfig: AgentConfig;
|
|
93
|
+
waveId: string | undefined;
|
|
94
|
+
callId: string;
|
|
95
|
+
budgetRelease: (() => void) | undefined;
|
|
96
|
+
isolationTeardown: {
|
|
97
|
+
repoRoot: string;
|
|
98
|
+
worktreePath: string;
|
|
99
|
+
} | undefined;
|
|
100
|
+
traceWriter: TraceSink | undefined;
|
|
101
|
+
}
|
|
102
|
+
export declare function runBackgroundDispatch(args: RunBackgroundDispatchArgs): Promise<ToolResult>;
|
|
103
|
+
export declare function checkNestedScope(nestedScope: readonly string[], requestedType: string | undefined): ToolResult | undefined;
|
|
@@ -53,3 +53,12 @@ export declare function buildSharedDeps(a: {
|
|
|
53
53
|
initialPermissionMode: PermissionMode | undefined;
|
|
54
54
|
explicitProvider?: string;
|
|
55
55
|
}): BuildAgentSessionDeps;
|
|
56
|
+
import { MemoryStore } from '../../../agent/memory/index.js';
|
|
57
|
+
import { StateStore } from '../../../agent/state/state-store.js';
|
|
58
|
+
import { WorkspaceStore } from '../../../agent/workspace/workspace-store.js';
|
|
59
|
+
export interface BootstrapSharedStores {
|
|
60
|
+
sharedWorkspaceStore: WorkspaceStore | undefined;
|
|
61
|
+
sharedMemoryStore: MemoryStore;
|
|
62
|
+
sharedStateStore: StateStore;
|
|
63
|
+
}
|
|
64
|
+
export declare function createBootstrapSharedStores(): BootstrapSharedStores;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import { type InstallFromMarketplaceDeps } from '../../agent/marketplaces/resolve.js';
|
|
4
|
+
import { type UpdateMarketplaceDeps, type UpdateMarketplaceOutcome } from '../../agent/marketplaces/update.js';
|
|
5
|
+
export interface MarketplaceSubDeps extends InstallFromMarketplaceDeps, UpdateMarketplaceDeps {
|
|
6
|
+
logger?: Pick<Console, 'log' | 'error'>;
|
|
7
|
+
cacheDir: string;
|
|
8
|
+
indexPath: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function registerMarketplaceInstallPlugin(market: Command, moduleDeps: MarketplaceSubDeps): void;
|
|
11
|
+
export declare function registerMarketplaceRemove(market: Command, moduleDeps: MarketplaceSubDeps, logger: Pick<Console, 'log' | 'error'>): void;
|
|
12
|
+
export declare function formatOutcome(o: UpdateMarketplaceOutcome): string;
|
|
13
|
+
export declare function printOutcome(o: UpdateMarketplaceOutcome, spinner: ReturnType<typeof ora>): void;
|
|
14
|
+
export declare function registerMarketplaceUpdate(market: Command, moduleDeps: MarketplaceSubDeps, logger: Pick<Console, 'log' | 'error'>): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CliConfig, ConfigFileSchema } from './types.js';
|
|
2
|
+
type InteractiveConfig = NonNullable<CliConfig['interactive']>;
|
|
3
|
+
export declare function parseInteractiveBlock(raw: ConfigFileSchema['interactive'], configPath: string): InteractiveConfig | undefined;
|
|
4
|
+
export {};
|
|
@@ -16,20 +16,13 @@ export interface ParsePipelineCallbacks {
|
|
|
16
16
|
onScheduleRepaint(): void;
|
|
17
17
|
}
|
|
18
18
|
export declare function runParsePipeline(buffer: string, chunk: string, callbacks: ParsePipelineCallbacks): string;
|
|
19
|
-
export interface LogUpdateFunction {
|
|
20
|
-
(str: string): void;
|
|
21
|
-
clear: () => void;
|
|
22
|
-
}
|
|
23
19
|
export interface RepaintParams {
|
|
24
20
|
flushing: boolean;
|
|
25
21
|
overlayComposer: OverlayComposerLike | null | undefined;
|
|
26
22
|
compositor: CompositorLike | null;
|
|
27
|
-
logUpdate: LogUpdateFunction | null;
|
|
28
23
|
renderPending(): string;
|
|
29
|
-
initLogUpdate(): Promise<LogUpdateFunction | null>;
|
|
30
|
-
onLogUpdateReady(fn: LogUpdateFunction | null): void;
|
|
31
24
|
}
|
|
32
|
-
export declare function executeRepaint(p: RepaintParams):
|
|
25
|
+
export declare function executeRepaint(p: RepaintParams): void;
|
|
33
26
|
export interface CompositorLike {
|
|
34
27
|
setOverlay(str: string): void;
|
|
35
28
|
}
|
|
@@ -37,7 +30,5 @@ export interface OverlayComposerLike {
|
|
|
37
30
|
markDirty(slot: string): void;
|
|
38
31
|
flush(): void;
|
|
39
32
|
}
|
|
40
|
-
export declare function clearOverlay(overlayComposer: OverlayComposerLike | null | undefined, compositor: CompositorLike | null
|
|
41
|
-
clear(): void;
|
|
42
|
-
} | null): void;
|
|
33
|
+
export declare function clearOverlay(overlayComposer: OverlayComposerLike | null | undefined, compositor: CompositorLike | null): void;
|
|
43
34
|
export declare function syncPendingOverlay(overlayComposer: OverlayComposerLike | null | undefined, compositor: CompositorLike | null, renderPending: () => string): void;
|
|
@@ -9,10 +9,6 @@ export declare function hasMarkdownContent(text: string): boolean;
|
|
|
9
9
|
export declare function isInOpenCodeFence(text: string): boolean;
|
|
10
10
|
export declare function isInOpenTable(text: string): boolean;
|
|
11
11
|
export declare function findBlockBoundary(text: string): number;
|
|
12
|
-
export declare function initLogUpdateModule(): Promise<{
|
|
13
|
-
(str: string): void;
|
|
14
|
-
clear: () => void;
|
|
15
|
-
} | null>;
|
|
16
12
|
export interface OverlayRoutingParams {
|
|
17
13
|
indented: string;
|
|
18
14
|
overlayComposer: {
|
|
@@ -22,10 +18,6 @@ export interface OverlayRoutingParams {
|
|
|
22
18
|
compositor: {
|
|
23
19
|
setOverlay(str: string): void;
|
|
24
20
|
} | null;
|
|
25
|
-
logUpdate: {
|
|
26
|
-
(str: string): void;
|
|
27
|
-
clear: () => void;
|
|
28
|
-
} | null;
|
|
29
21
|
}
|
|
30
22
|
export declare function routeOverlayOutput(params: OverlayRoutingParams): boolean;
|
|
31
23
|
export declare function accumulateCommitted(current: string, trimmed: string): string;
|
|
@@ -17,7 +17,6 @@ export declare class StreamingMarkdownRenderer {
|
|
|
17
17
|
private committed;
|
|
18
18
|
private throttleTimer;
|
|
19
19
|
private lastPaintTime;
|
|
20
|
-
private logUpdate;
|
|
21
20
|
private isTTY;
|
|
22
21
|
private flushing;
|
|
23
22
|
private compositor;
|
|
@@ -27,7 +26,6 @@ export declare class StreamingMarkdownRenderer {
|
|
|
27
26
|
private inputState;
|
|
28
27
|
private smoke;
|
|
29
28
|
constructor(opts?: StreamingMarkdownRendererOptions);
|
|
30
|
-
private initLogUpdate;
|
|
31
29
|
private commitBlock;
|
|
32
30
|
private scheduleRepaint;
|
|
33
31
|
renderPending(): string;
|