agent-afk 5.84.6 → 5.84.8

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.
@@ -0,0 +1 @@
1
+ export declare function isSafeInWorkspaceRm(cmd: string, resolveBase: string, workspaceRoot: string): boolean;
@@ -0,0 +1,49 @@
1
+ import type { CanUseTool } from '../../types/sdk-types.js';
2
+ import type { PlanExitControls } from '../../types/config-types.js';
3
+ import type { HookRegistry } from '../../hooks.js';
4
+ import type { MemoryStore } from '../../memory/index.js';
5
+ import type { SubagentExecutor } from '../../tools/subagent-executor.js';
6
+ import type { SkillExecutor } from '../../tools/skill-executor.js';
7
+ import type { ComposeExecutor } from '../../tools/compose-executor.js';
8
+ import type { TraceWriter } from '../../trace/index.js';
9
+ import type { AnthropicToolDef, ToolHandler } from '../../tools/types.js';
10
+ import type { CustomToolDef } from '../../tools/custom-tool.js';
11
+ import type { GrantManager } from '../../../cli/slash/commands/allow-dir.js';
12
+ import type { RuntimeStateSource } from '../../awareness/index.js';
13
+ import { SessionToolDispatcher } from '../../tools/dispatcher.js';
14
+ import { type ToolPermissionConfig } from '../../tools/permissions.js';
15
+ export interface BuildDispatcherOptions {
16
+ cwd?: string;
17
+ readRoots?: string[];
18
+ writeRoots?: string[];
19
+ env?: Record<string, string>;
20
+ sessionId?: string;
21
+ parentSessionId?: string;
22
+ subagentId?: string;
23
+ subagentToolOutputCapBytes?: number;
24
+ traceWriter?: TraceWriter;
25
+ runtimeStateSource?: RuntimeStateSource;
26
+ hookRegistry?: HookRegistry;
27
+ planExitControls?: PlanExitControls;
28
+ }
29
+ export interface BuildDispatcherDeps {
30
+ memoryStore: MemoryStore;
31
+ surface: string;
32
+ readOnlyMemory: boolean;
33
+ readOnlyBash: boolean;
34
+ customTools: readonly CustomToolDef[];
35
+ mcpManager: import('../../mcp/index.js').McpManager | undefined;
36
+ schemas: readonly AnthropicToolDef[];
37
+ hookRegistry: HookRegistry | undefined;
38
+ permissions: ToolPermissionConfig | undefined;
39
+ canUseTool: CanUseTool | undefined;
40
+ subagentExecutor: SubagentExecutor | undefined;
41
+ skillExecutor: SkillExecutor | undefined;
42
+ composeExecutor: ComposeExecutor | undefined;
43
+ sessionGrantManager: GrantManager;
44
+ getMcpToolsCache: () => AnthropicToolDef[] | null;
45
+ setMcpToolsCache: (value: AnthropicToolDef[] | null) => void;
46
+ getMcpHandlersCache: () => Map<string, ToolHandler> | null;
47
+ setMcpHandlersCache: (value: Map<string, ToolHandler> | null) => void;
48
+ }
49
+ export declare function buildDispatcher(deps: BuildDispatcherDeps, permissionMode: string, opts?: BuildDispatcherOptions): SessionToolDispatcher;
@@ -1,39 +1,7 @@
1
- import Anthropic from '@anthropic-ai/sdk';
2
- import type { CanUseTool } from '../../types/sdk-types.js';
3
1
  import type { ModelProvider, ProviderQuery, ProviderQueryArgs, ProviderCompleteArgs } from '../../provider.js';
4
2
  export { resolveEffort, resolveMaxTokens, resolveThinkingParam } from './resolve-params.js';
5
- import type { ToolDispatcher } from './tool-dispatcher.js';
6
- import { type ToolPermissionConfig } from '../../tools/permissions.js';
7
- import type { HookRegistry } from '../../hooks.js';
8
- import type { SubagentExecutor } from '../../tools/subagent-executor.js';
9
- import type { SkillExecutor } from '../../tools/skill-executor.js';
10
- import type { ComposeExecutor } from '../../tools/compose-executor.js';
11
- import { MemoryStore } from '../../memory/index.js';
12
- export type AnthropicClientFactory = (opts: ({
13
- authToken: string;
14
- } | {
15
- apiKey: string;
16
- }) & {
17
- baseURL?: string;
18
- fetch?: typeof fetch;
19
- }) => Anthropic;
20
- export declare function __setAnthropicClientFactory(factory: AnthropicClientFactory | null): void;
21
- export interface AnthropicDirectProviderOptions {
22
- tools?: ToolDispatcher;
23
- hookRegistry?: HookRegistry;
24
- permissions?: ToolPermissionConfig;
25
- canUseTool?: CanUseTool;
26
- clientFactory?: AnthropicClientFactory;
27
- subagentExecutor?: SubagentExecutor;
28
- skillExecutor?: SkillExecutor;
29
- composeExecutor?: ComposeExecutor;
30
- memoryStore?: MemoryStore;
31
- surface?: string;
32
- readOnlyMemory?: boolean;
33
- readOnlyBash?: boolean;
34
- mcpManager?: import('../../mcp/index.js').McpManager;
35
- customTools?: import('../../tools/custom-tool.js').CustomToolDef[];
36
- }
3
+ import { type AnthropicDirectProviderOptions } from './provider-options.js';
4
+ export { __setAnthropicClientFactory, type AnthropicClientFactory, type AnthropicDirectProviderOptions, } from './provider-options.js';
37
5
  export declare class AnthropicDirectProvider implements ModelProvider {
38
6
  readonly name = "anthropic-direct";
39
7
  private readonly externalTools;
@@ -0,0 +1,35 @@
1
+ import type Anthropic from '@anthropic-ai/sdk';
2
+ import type { CanUseTool } from '../../types/sdk-types.js';
3
+ import type { HookRegistry } from '../../hooks.js';
4
+ import type { MemoryStore } from '../../memory/index.js';
5
+ import type { SubagentExecutor } from '../../tools/subagent-executor.js';
6
+ import type { SkillExecutor } from '../../tools/skill-executor.js';
7
+ import type { ComposeExecutor } from '../../tools/compose-executor.js';
8
+ import type { ToolPermissionConfig } from '../../tools/permissions.js';
9
+ import type { ToolDispatcher } from './tool-dispatcher.js';
10
+ export type AnthropicClientFactory = (opts: ({
11
+ authToken: string;
12
+ } | {
13
+ apiKey: string;
14
+ }) & {
15
+ baseURL?: string;
16
+ fetch?: typeof fetch;
17
+ }) => Anthropic;
18
+ export declare function __setAnthropicClientFactory(factory: AnthropicClientFactory | null): void;
19
+ export declare function getClientFactory(): AnthropicClientFactory | null;
20
+ export interface AnthropicDirectProviderOptions {
21
+ tools?: ToolDispatcher;
22
+ hookRegistry?: HookRegistry;
23
+ permissions?: ToolPermissionConfig;
24
+ canUseTool?: CanUseTool;
25
+ clientFactory?: AnthropicClientFactory;
26
+ subagentExecutor?: SubagentExecutor;
27
+ skillExecutor?: SkillExecutor;
28
+ composeExecutor?: ComposeExecutor;
29
+ memoryStore?: MemoryStore;
30
+ surface?: string;
31
+ readOnlyMemory?: boolean;
32
+ readOnlyBash?: boolean;
33
+ mcpManager?: import('../../mcp/index.js').McpManager;
34
+ customTools?: import('../../tools/custom-tool.js').CustomToolDef[];
35
+ }
@@ -0,0 +1,22 @@
1
+ import type Anthropic from '@anthropic-ai/sdk';
2
+ import type { AgentConfig } from '../../../types/config-types.js';
3
+ import type { ContentBlockParam } from '@anthropic-ai/sdk/resources';
4
+ import { buildClientOptions } from '../auth.js';
5
+ import type { AuthMode } from '../types.js';
6
+ import { ThrottleQueue } from '../throttle-queue.js';
7
+ import type { AnthropicClientFactory } from '../provider-options.js';
8
+ export interface ClientSetupArgs {
9
+ config: AgentConfig;
10
+ token: string;
11
+ authMode: AuthMode;
12
+ localMode: boolean;
13
+ factory: AnthropicClientFactory | null | undefined;
14
+ createClient: (opts: ReturnType<typeof buildClientOptions>) => Anthropic;
15
+ }
16
+ export interface ClientSetup {
17
+ client: Anthropic;
18
+ throttleQueue: ThrottleQueue | undefined;
19
+ systemPrefix: ContentBlockParam[] | null;
20
+ tokenRefresher?: (() => Promise<Anthropic | null>) | undefined;
21
+ }
22
+ export declare function setUpQueryClient(args: ClientSetupArgs): ClientSetup;
@@ -0,0 +1,31 @@
1
+ import type { AgentConfig } from '../../../types/config-types.js';
2
+ import type { AnthropicToolDef } from '../../../tools/types.js';
3
+ import type { ToolDispatcher } from '../tool-dispatcher.js';
4
+ import { SessionToolDispatcher } from '../../../tools/dispatcher.js';
5
+ import { type RuntimeStateSource } from '../../../awareness/index.js';
6
+ import type { BuildDispatcherOptions } from '../build-dispatcher.js';
7
+ import type { RuntimeSubagents } from '../../../awareness/index.js';
8
+ export interface DispatcherWiringArgs {
9
+ config: AgentConfig;
10
+ model: string;
11
+ permissionMode: string;
12
+ surface: string;
13
+ providerName: string;
14
+ externalTools: ToolDispatcher | undefined;
15
+ sharedReadRoots: string[] | undefined;
16
+ sharedWriteRoots: string[] | undefined;
17
+ getMcpTools: () => readonly AnthropicToolDef[];
18
+ getSubagents: () => RuntimeSubagents;
19
+ getMintedSessionId: () => string | null;
20
+ setMintedSessionId: (value: string | null) => void;
21
+ getPresenceSessionId: () => string | null;
22
+ setPresenceSessionId: (value: string | null) => void;
23
+ buildDispatcher: (permissionMode: string, opts: BuildDispatcherOptions) => SessionToolDispatcher;
24
+ }
25
+ export interface DispatcherWiring {
26
+ queryDispatcher: ToolDispatcher;
27
+ runtimeStateSource: RuntimeStateSource;
28
+ toolDefs: AnthropicToolDef[];
29
+ resolvedSessionId: string | undefined;
30
+ }
31
+ export declare function wireQueryDispatcher(args: DispatcherWiringArgs): DispatcherWiring;
@@ -0,0 +1,17 @@
1
+ import type { AgentConfig } from '../../../types/config-types.js';
2
+ import type { RuntimeStateSource } from '../../../awareness/index.js';
3
+ import { type StableSystemParts } from './system-prompt.js';
4
+ export interface PromptAssemblyArgs {
5
+ config: AgentConfig;
6
+ cwd: string;
7
+ surface: string;
8
+ readOnlyMemory: boolean;
9
+ hasSkillExecutor: boolean;
10
+ runtimeStateSource: RuntimeStateSource;
11
+ userSystem: string | null;
12
+ }
13
+ export interface AssembledPrompt {
14
+ stableSystemPrefix: StableSystemParts;
15
+ toolSystemAppend: string;
16
+ }
17
+ export declare function assembleQueryPrompt(args: PromptAssemblyArgs): AssembledPrompt;
@@ -0,0 +1,34 @@
1
+ import { SubagentManager } from '../subagent.js';
2
+ import { SubagentExecutor } from '../tools/subagent-executor.js';
3
+ import { SkillExecutor } from '../tools/skill-executor.js';
4
+ import { ComposeExecutor } from '../tools/compose-executor.js';
5
+ import type { SubagentExecutorContext } from '../tools/subagent-executor.js';
6
+ import type { BackgroundAgentRegistry } from '../background-registry.js';
7
+ import type { TraceWriter } from '../trace/writer.js';
8
+ import type { Surface } from '../awareness/types.js';
9
+ import type { AgentModelInput } from '../types.js';
10
+ export interface WireExecutorsOptions {
11
+ surface: Surface;
12
+ parentSession: SubagentExecutorContext['parentSession'];
13
+ apiKey: string | undefined;
14
+ model: AgentModelInput;
15
+ managerParentModel: AgentModelInput;
16
+ defaultSubagentModel: AgentModelInput;
17
+ resolveApiKeyForModel: (model: string) => string | undefined;
18
+ systemPrompt?: string;
19
+ baseUrl?: string;
20
+ openaiBaseUrl?: string;
21
+ cwd?: string;
22
+ nestedCwd?: string;
23
+ traceWriter?: TraceWriter;
24
+ skillTraceWriter?: TraceWriter;
25
+ backgroundRegistry?: BackgroundAgentRegistry;
26
+ agentRegistryWarn?: (message: string) => void;
27
+ }
28
+ export interface WiredExecutors {
29
+ rootManager: SubagentManager;
30
+ subagentExecutor: SubagentExecutor;
31
+ skillExecutor: SkillExecutor;
32
+ composeExecutor: ComposeExecutor;
33
+ }
34
+ export declare function wireExecutors(opts: WireExecutorsOptions): WiredExecutors;
@@ -99,6 +99,7 @@ export declare const HookDecisionPayloadSchema: z.ZodObject<{
99
99
  durationMs: z.ZodOptional<z.ZodNumber>;
100
100
  approvalOutcome: z.ZodOptional<z.ZodEnum<{
101
101
  timeout: "timeout";
102
+ "carve-out": "carve-out";
102
103
  approved: "approved";
103
104
  denied: "denied";
104
105
  unrecognised: "unrecognised";
@@ -616,6 +617,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
616
617
  durationMs: z.ZodOptional<z.ZodNumber>;
617
618
  approvalOutcome: z.ZodOptional<z.ZodEnum<{
618
619
  timeout: "timeout";
620
+ "carve-out": "carve-out";
619
621
  approved: "approved";
620
622
  denied: "denied";
621
623
  unrecognised: "unrecognised";
@@ -939,6 +941,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
939
941
  durationMs: z.ZodOptional<z.ZodNumber>;
940
942
  approvalOutcome: z.ZodOptional<z.ZodEnum<{
941
943
  timeout: "timeout";
944
+ "carve-out": "carve-out";
942
945
  approved: "approved";
943
946
  denied: "denied";
944
947
  unrecognised: "unrecognised";
@@ -26,7 +26,7 @@ export interface ToolCallCompletedPayload {
26
26
  }
27
27
  export type ToolCallPayload = ToolCallStartedPayload | ToolCallCompletedPayload;
28
28
  export type HookEventName = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'SessionStart' | 'SessionEnd' | 'SubagentStart' | 'SubagentStop';
29
- export type AfkApprovalOutcome = 'approved' | 'denied' | 'unrecognised' | 'timeout' | 'decline' | 'cancel' | 'hard-block';
29
+ export type AfkApprovalOutcome = 'carve-out' | 'approved' | 'denied' | 'unrecognised' | 'timeout' | 'decline' | 'cancel' | 'hard-block';
30
30
  export interface HookDecisionPayload {
31
31
  hookEvent: HookEventName;
32
32
  decision?: 'block' | 'approve';