agent-afk 5.313.3 → 5.313.5
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/daemon/session-spawn.d.ts +4 -0
- package/dist/agent/providers/anthropic-direct/build-dispatcher.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/provider-context.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/provider-query-setup.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query/cwd-dependents.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query/dispatcher-wiring.d.ts +5 -0
- package/dist/agent/providers/anthropic-direct/query-options.d.ts +5 -0
- package/dist/agent/providers/anthropic-direct/query-runtime.d.ts +4 -1
- package/dist/agent/providers/openai-compatible/index.dispatcher-opts.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/index.query-dispatcher.d.ts +17 -0
- package/dist/agent/providers/openai-compatible/query/build-query.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/query-options.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/tool-catalog.d.ts +3 -0
- package/dist/agent/providers/openai-compatible/query.d.ts +4 -3
- package/dist/agent/subagent/handle.d.ts +2 -2
- package/dist/agent/subagent/handle.run-success.d.ts +4 -0
- package/dist/agent/tools/handlers/bash.close.d.ts +21 -0
- package/dist/agent/tools/handlers/bash.error.d.ts +14 -0
- package/dist/agent/tools/handlers/bash.overflow.d.ts +27 -0
- package/dist/agent/tools/handlers/bash.spawn.d.ts +3 -0
- package/dist/agent/tools/operator-denied-dispatcher.d.ts +1 -0
- package/dist/agent/tools/operator-denied.slots.d.ts +4 -0
- package/dist/agent/tools/permissions-compose.d.ts +1 -1
- package/dist/cli/commands/interactive/bootstrap-config.d.ts +1 -0
- package/dist/cli/commands/interactive/bootstrap-session-builder.d.ts +2 -0
- package/dist/cli/config/types.d.ts +1 -0
- package/dist/cli/shared-helpers.d.ts +1 -0
- package/dist/cli.mjs +426 -426
- package/dist/index.mjs +183 -183
- package/dist/telegram/session-context.d.ts +1 -0
- package/dist/telegram.mjs +205 -205
- package/package.json +1 -1
|
@@ -16,6 +16,10 @@ export interface DaemonSpawnOptions {
|
|
|
16
16
|
export declare function daemonTraceLabel(taskId: string): string;
|
|
17
17
|
export declare function _resetDaemonDefaultCwdCache(): void;
|
|
18
18
|
export declare function daemonDefaultCwd(): string;
|
|
19
|
+
export declare function parseDaemonEnvLimits(rawMaxToolIters: string | undefined, rawMaxBudget: string | undefined): {
|
|
20
|
+
parsedMaxToolIters: number | undefined;
|
|
21
|
+
parsedMaxBudget: number | undefined;
|
|
22
|
+
};
|
|
19
23
|
export declare function spawnDaemonSession(taskId: string, options: DaemonSpawnOptions): Promise<{
|
|
20
24
|
session: AgentSession;
|
|
21
25
|
memoryStore: MemoryStore;
|
|
@@ -17,6 +17,7 @@ import { SessionToolDispatcher } from '../../tools/dispatcher.js';
|
|
|
17
17
|
import type { ToolPermissionConfig } from '../../tools/permissions.js';
|
|
18
18
|
export interface BuildDispatcherOptions {
|
|
19
19
|
cwd?: string;
|
|
20
|
+
slotModel?: string;
|
|
20
21
|
readRoots?: string[];
|
|
21
22
|
writeRoots?: string[];
|
|
22
23
|
env?: Record<string, string>;
|
|
@@ -6,6 +6,7 @@ import type { AnthropicClientFactory } from './provider-options.js';
|
|
|
6
6
|
import type { BuildDispatcherOptions } from './build-dispatcher.js';
|
|
7
7
|
export interface ProviderQueryContext {
|
|
8
8
|
readonly externalTools: ToolDispatcher | undefined;
|
|
9
|
+
readonly customToolSchemas?: readonly import('../../tools/types.js').AnthropicToolDef[];
|
|
9
10
|
readonly providerFactory: AnthropicClientFactory | undefined;
|
|
10
11
|
readonly skillExecutor: SkillExecutor | undefined;
|
|
11
12
|
readonly subagentExecutor: import('../../tools/subagent-executor.js').SubagentExecutor | undefined;
|
|
@@ -18,6 +18,7 @@ export interface QuerySetupResult {
|
|
|
18
18
|
queryDispatcher: ReturnType<typeof wireQueryDispatcher>['queryDispatcher'];
|
|
19
19
|
runtimeStateSource: ReturnType<typeof wireQueryDispatcher>['runtimeStateSource'];
|
|
20
20
|
toolDefs: ReturnType<typeof wireQueryDispatcher>['toolDefs'];
|
|
21
|
+
modelToolsFactory: ReturnType<typeof wireQueryDispatcher>['modelToolsFactory'];
|
|
21
22
|
resolvedSessionId: ReturnType<typeof wireQueryDispatcher>['resolvedSessionId'];
|
|
22
23
|
stableSystemPrefix: ReturnType<typeof assembleQueryPrompt>['stableSystemPrefix'];
|
|
23
24
|
toolSystemAppend: ReturnType<typeof assembleQueryPrompt>['toolSystemAppend'];
|
|
@@ -24,6 +24,7 @@ export interface CwdDependentsFactoryArgs {
|
|
|
24
24
|
composeExecutor: ComposeExecutor | undefined;
|
|
25
25
|
buildDispatcher: (permissionMode: string, opts: {
|
|
26
26
|
cwd?: string;
|
|
27
|
+
slotModel?: string;
|
|
27
28
|
env?: Record<string, string>;
|
|
28
29
|
readRoots?: string[];
|
|
29
30
|
writeRoots?: string[];
|
|
@@ -12,6 +12,7 @@ export interface DispatcherWiringArgs {
|
|
|
12
12
|
surface: string;
|
|
13
13
|
providerName: string;
|
|
14
14
|
externalTools: ToolDispatcher | undefined;
|
|
15
|
+
customToolSchemas?: readonly AnthropicToolDef[] | undefined;
|
|
15
16
|
sharedReadRoots: string[] | undefined;
|
|
16
17
|
sharedWriteRoots: string[] | undefined;
|
|
17
18
|
getCwd: () => string;
|
|
@@ -33,5 +34,9 @@ export interface DispatcherWiring {
|
|
|
33
34
|
runtimeStateSource: RuntimeStateSource;
|
|
34
35
|
toolDefs: AnthropicToolDef[];
|
|
35
36
|
resolvedSessionId: string | undefined;
|
|
37
|
+
modelToolsFactory: (model: string, permissionMode: string) => {
|
|
38
|
+
dispatcher: ToolDispatcher;
|
|
39
|
+
tools: AnthropicToolDef[];
|
|
40
|
+
};
|
|
36
41
|
}
|
|
37
42
|
export declare function wireQueryDispatcher(args: DispatcherWiringArgs): DispatcherWiring;
|
|
@@ -19,6 +19,11 @@ export interface AnthropicDirectQueryOptions {
|
|
|
19
19
|
permissionMode?: string;
|
|
20
20
|
maxTokens: number;
|
|
21
21
|
tools: AnthropicToolDef[] | null;
|
|
22
|
+
modelToolsFactory?: (model: string, permissionMode: string) => {
|
|
23
|
+
dispatcher: ToolDispatcher;
|
|
24
|
+
tools: AnthropicToolDef[];
|
|
25
|
+
};
|
|
26
|
+
onModelChange?: (model: string) => void;
|
|
22
27
|
userSystem: string | null;
|
|
23
28
|
systemPrefix: ContentBlockParam[] | null;
|
|
24
29
|
tokenRefresher?: () => Promise<Anthropic | null>;
|
|
@@ -6,7 +6,10 @@ export declare class AnthropicDirectQuery implements ProviderQuery {
|
|
|
6
6
|
private readonly initSessionId;
|
|
7
7
|
private readonly promptStream;
|
|
8
8
|
private readonly maxTokens;
|
|
9
|
-
private
|
|
9
|
+
private tools;
|
|
10
|
+
private currentSlotDenyKey;
|
|
11
|
+
private readonly modelToolsFactory;
|
|
12
|
+
private readonly onModelChange;
|
|
10
13
|
private readonly systemPrefix;
|
|
11
14
|
private readonly thinking?;
|
|
12
15
|
private readonly rawThinkingConfig?;
|
|
@@ -2,6 +2,7 @@ import type { AgentConfig, PlanExitControls } from '../../types/config-types.js'
|
|
|
2
2
|
import type { RuntimeStateSource } from '../../awareness/index.js';
|
|
3
3
|
export interface BuildDispatcherOpts {
|
|
4
4
|
cwd?: string;
|
|
5
|
+
slotModel?: string;
|
|
5
6
|
readRoots?: string[];
|
|
6
7
|
writeRoots?: string[];
|
|
7
8
|
sessionId?: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentConfig } from '../../types/config-types.js';
|
|
2
|
+
import type { ToolDispatcher } from '../anthropic-direct/tool-dispatcher.js';
|
|
3
|
+
import type { AnthropicToolDef } from '../anthropic-direct/types.js';
|
|
4
|
+
import { type RuntimeStateSource } from '../../awareness/index.js';
|
|
5
|
+
import { type BuildDispatcherOpts } from './index.dispatcher-opts.js';
|
|
6
|
+
export declare function buildQueryDispatcher(args: {
|
|
7
|
+
config: AgentConfig;
|
|
8
|
+
permissionMode: string;
|
|
9
|
+
externalTools: ToolDispatcher | undefined;
|
|
10
|
+
customNames: readonly string[];
|
|
11
|
+
schemas: AnthropicToolDef[];
|
|
12
|
+
runtimeStateSource: RuntimeStateSource;
|
|
13
|
+
readRoots: string[] | undefined;
|
|
14
|
+
writeRoots: string[] | undefined;
|
|
15
|
+
sessionId: string | undefined;
|
|
16
|
+
buildDispatcher: (mode: string, opts: BuildDispatcherOpts) => ToolDispatcher;
|
|
17
|
+
}): ToolDispatcher;
|
|
@@ -8,6 +8,7 @@ export declare function buildQueryFromConfig(config: AgentConfig, promptStream:
|
|
|
8
8
|
baseURL?: string;
|
|
9
9
|
defaultHeaders?: Record<string, string>;
|
|
10
10
|
toolDispatcher?: ToolDispatcher;
|
|
11
|
+
modelDispatcherFactory?: (model: string, permissionMode: string) => ToolDispatcher;
|
|
11
12
|
onPermissionMode?: (mode: string) => void;
|
|
12
13
|
onCwdChange?: (cwd: string) => void;
|
|
13
14
|
systemPromptRebuildFactory?: (basePrompt: string | undefined) => string;
|
|
@@ -13,6 +13,7 @@ export interface OpenAICompatibleQueryOptions {
|
|
|
13
13
|
promptStream: AsyncIterable<ProviderUserTurn>;
|
|
14
14
|
config: AgentConfig;
|
|
15
15
|
toolDispatcher?: ToolDispatcher;
|
|
16
|
+
modelDispatcherFactory?: (model: string, permissionMode: string) => ToolDispatcher;
|
|
16
17
|
onPermissionMode?: (mode: string) => void;
|
|
17
18
|
onCwdChange?: (cwd: string) => void;
|
|
18
19
|
systemPromptRebuildFactory?: (basePrompt: string | undefined) => string;
|
|
@@ -2,7 +2,7 @@ import OpenAI from 'openai';
|
|
|
2
2
|
import type { TraceSink } from '../../trace/index.js';
|
|
3
3
|
import type { ProviderQuery, ProviderEvent, ProviderContextUsage, ProviderRewindResult, ProviderModelInfo, ProviderCommandInfo, ProviderAgentInfo, ProviderMcpServerStatus, ProviderAccountInfo, ProviderUsage, ProviderCompactResult } from '../../provider.js';
|
|
4
4
|
import { type OpenAIMessage } from './messages.js';
|
|
5
|
-
import {
|
|
5
|
+
import type { OpenAIFunctionTool } from './loop.js';
|
|
6
6
|
import { type WireMode } from './responses-config.js';
|
|
7
7
|
import type { ToolDispatcher } from '../anthropic-direct/tool-dispatcher.js';
|
|
8
8
|
import { AbortCoordinator } from '../shared/abort-coordinator.js';
|
|
@@ -26,7 +26,7 @@ export declare class OpenAICompatibleQuery implements ProviderQuery, TurnDriverC
|
|
|
26
26
|
get client(): OpenAI;
|
|
27
27
|
readonly opts: OpenAICompatibleQueryOptions;
|
|
28
28
|
readonly initSessionId: string;
|
|
29
|
-
|
|
29
|
+
toolDispatcher: ToolDispatcher | undefined;
|
|
30
30
|
private readonly onPermissionMode?;
|
|
31
31
|
private readonly onCwdChange?;
|
|
32
32
|
private readonly systemPromptRebuildFactory?;
|
|
@@ -37,7 +37,8 @@ export declare class OpenAICompatibleQuery implements ProviderQuery, TurnDriverC
|
|
|
37
37
|
get beforeTurnEnd(): ((continuation: number, assistantText?: string) => Promise<{
|
|
38
38
|
continueWith?: string;
|
|
39
39
|
} | undefined>) | undefined;
|
|
40
|
-
private
|
|
40
|
+
private openAITools;
|
|
41
|
+
private currentSlotDenyKey;
|
|
41
42
|
readonly wireMode: WireMode;
|
|
42
43
|
readonly useOpenAIPricing: boolean;
|
|
43
44
|
readonly traceWriter: TraceSink | undefined;
|
|
@@ -38,7 +38,7 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
|
|
|
38
38
|
readonly _parentAbortSignal?: AbortSignal | undefined;
|
|
39
39
|
readonly _agentType?: string | undefined;
|
|
40
40
|
readonly _traceWriter?: TraceSink | undefined;
|
|
41
|
-
|
|
41
|
+
readonly onSubagentSucceeded?: ((usage: SubagentTrace["usage"], costUsd: number | undefined) => void) | undefined;
|
|
42
42
|
readonly _idleTimeoutMs: number;
|
|
43
43
|
_currentStatus: SubagentStatus;
|
|
44
44
|
private inFlight;
|
|
@@ -69,7 +69,7 @@ export declare class SubagentHandleImpl<T> implements SubagentHandle<T> {
|
|
|
69
69
|
}): Promise<void>;
|
|
70
70
|
getLastStopInjectContext(): string | undefined;
|
|
71
71
|
readonly _pendingUserMessages: string[];
|
|
72
|
-
|
|
72
|
+
_drainingMessages: boolean;
|
|
73
73
|
sendMessage(text: string): void;
|
|
74
74
|
readonly _steeringMessages: string[];
|
|
75
75
|
readonly _progressEvents: import('../tools/subagent/emit-progress.js').ProgressEventPayload[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SubagentProgressSink } from '../types/session-types.js';
|
|
2
|
+
import type { Message } from '../types.js';
|
|
3
|
+
import type { SubagentHandleImpl } from './handle.js';
|
|
4
|
+
export declare function drainAndEmitSuccess<T>(handle: SubagentHandleImpl<T>, firstMsg: Message, startTime: number, sinkOverride: SubagentProgressSink | undefined): Promise<Message>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ToolHandlerContext } from '../types.js';
|
|
2
|
+
import type { OverflowState } from './bash.overflow.js';
|
|
3
|
+
export interface HandleCloseParams {
|
|
4
|
+
code: number | null;
|
|
5
|
+
state: OverflowState;
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
context: ToolHandlerContext | undefined;
|
|
8
|
+
startedAt: number;
|
|
9
|
+
timeout_ms: number;
|
|
10
|
+
deregisterOnClose: (() => void) | undefined;
|
|
11
|
+
settle: (result: {
|
|
12
|
+
content: string;
|
|
13
|
+
isError?: boolean;
|
|
14
|
+
truncated?: boolean;
|
|
15
|
+
capturePath?: string;
|
|
16
|
+
durationMs?: number;
|
|
17
|
+
exitCode?: number;
|
|
18
|
+
testResult?: import('./test-runner-detector.js').TestResult;
|
|
19
|
+
}) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function handleClose(params: HandleCloseParams): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { ToolHandlerContext } from '../types.js';
|
|
3
|
+
export interface AttachErrorHandlerParams {
|
|
4
|
+
proc: ChildProcess;
|
|
5
|
+
context: ToolHandlerContext | undefined;
|
|
6
|
+
cwd: string | undefined;
|
|
7
|
+
startedAt: number;
|
|
8
|
+
settle: (result: {
|
|
9
|
+
content: string;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
durationMs?: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function attachErrorHandler(params: AttachErrorHandlerParams): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { RollingTailBuffer } from './_rolling-tail.js';
|
|
3
|
+
export interface OverflowState {
|
|
4
|
+
stdout: string;
|
|
5
|
+
stderr: string;
|
|
6
|
+
totalBytes: number;
|
|
7
|
+
overflowKilled: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface AttachStreamHandlersParams {
|
|
10
|
+
proc: ChildProcess;
|
|
11
|
+
state: OverflowState;
|
|
12
|
+
tailBuffer: RollingTailBuffer | undefined;
|
|
13
|
+
resolved: () => boolean;
|
|
14
|
+
deregisterOnClose: () => (() => void) | undefined;
|
|
15
|
+
settle: (result: {
|
|
16
|
+
content: string;
|
|
17
|
+
isError?: boolean;
|
|
18
|
+
truncated?: boolean;
|
|
19
|
+
capturePath?: string;
|
|
20
|
+
durationMs?: number;
|
|
21
|
+
exitCode?: number;
|
|
22
|
+
testResult?: import('./test-runner-detector.js').TestResult;
|
|
23
|
+
}) => void;
|
|
24
|
+
startedAt: number;
|
|
25
|
+
command: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function attachStreamHandlers(params: AttachStreamHandlersParams): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ToolPermissionConfig } from './permissions.js';
|
|
2
2
|
import type { AnthropicToolDef, ToolDispatcher } from '../providers/anthropic-direct/types.js';
|
|
3
3
|
export declare function withOperatorDeniedDispatcher(inner: ToolDispatcher | undefined, permissions: ToolPermissionConfig | undefined): ToolDispatcher | undefined;
|
|
4
|
+
export declare function withSlotDeniedDispatcher(inner: ToolDispatcher | undefined, model: unknown, customNames?: readonly string[]): ToolDispatcher | undefined;
|
|
4
5
|
export declare function snapshotOperatorOptions<T extends {
|
|
5
6
|
permissions?: ToolPermissionConfig;
|
|
6
7
|
tools?: ToolDispatcher;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type SlotName } from '../session/model-slots.js';
|
|
2
|
+
export declare function slotForActiveModel(model: unknown): SlotName | undefined;
|
|
3
|
+
export declare function resolveSlotDeniedTools(model: unknown, customNames?: readonly string[]): string[];
|
|
4
|
+
export declare function slotDenyKey(model: unknown): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type ToolPermissionConfig } from './permissions.js';
|
|
2
|
-
export declare function composeDispatcherPermissions(base: ToolPermissionConfig | undefined, mcpWireNames: readonly string[] | undefined, customToolNames: readonly string[]): ToolPermissionConfig | undefined;
|
|
2
|
+
export declare function composeDispatcherPermissions(base: ToolPermissionConfig | undefined, mcpWireNames: readonly string[] | undefined, customToolNames: readonly string[], slotModel?: unknown): ToolPermissionConfig | undefined;
|
|
@@ -11,6 +11,7 @@ export interface BootstrapConfig {
|
|
|
11
11
|
effort: EffortLevel | undefined;
|
|
12
12
|
maxOutputTokens: number | undefined;
|
|
13
13
|
maxToolUseIterations: number | undefined;
|
|
14
|
+
maxBudgetUsd: number | undefined;
|
|
14
15
|
basePrompt: string | undefined;
|
|
15
16
|
operatorOverlay: string | undefined;
|
|
16
17
|
systemPrompt: string | undefined;
|
|
@@ -18,6 +18,7 @@ export interface BuildAgentSessionDeps {
|
|
|
18
18
|
effort: EffortLevel | undefined;
|
|
19
19
|
maxOutputTokens: number | undefined;
|
|
20
20
|
maxToolUseIterations: number | undefined;
|
|
21
|
+
maxBudgetUsd: number | undefined;
|
|
21
22
|
providerFactory: (model: string | undefined) => ModelProvider;
|
|
22
23
|
hookRegistry: HookRegistry;
|
|
23
24
|
traceWriter: TraceWriter | undefined;
|
|
@@ -43,6 +44,7 @@ export declare function buildSharedDeps(a: {
|
|
|
43
44
|
effort: EffortLevel | undefined;
|
|
44
45
|
maxOutputTokens: number | undefined;
|
|
45
46
|
maxToolUseIterations: number | undefined;
|
|
47
|
+
maxBudgetUsd: number | undefined;
|
|
46
48
|
cliConfig: CliConfig;
|
|
47
49
|
providerFactory: (m: string | undefined) => ModelProvider;
|
|
48
50
|
hookRegistry: HookRegistry;
|
|
@@ -15,6 +15,7 @@ export declare function parseEffort(raw: string | undefined): EffortLevel | unde
|
|
|
15
15
|
export declare function getThinking(): ThinkingConfig | undefined;
|
|
16
16
|
export declare function getEffort(): EffortLevel | undefined;
|
|
17
17
|
export declare function parseBudget(raw: string | undefined): number | undefined;
|
|
18
|
+
export declare function parseBudgetEnv(raw: string | undefined, varName: string): number | undefined;
|
|
18
19
|
export declare function getMaxBudgetUsd(): number | undefined;
|
|
19
20
|
export declare function getTaskBudget(): number | undefined;
|
|
20
21
|
export declare function parseMaxOutputTokens(raw: string | undefined): number | undefined;
|