agent-afk 5.27.0 → 5.27.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.
@@ -64,6 +64,7 @@ export declare class AnthropicDirectProvider implements ModelProvider {
64
64
  close(): void;
65
65
  complete(args: ProviderCompleteArgs): Promise<string>;
66
66
  private ensureSharedRoots;
67
+ private readonly grantManager;
67
68
  addReadRoot(absPath: string, source?: 'slash' | 'tool', sessionId?: string): void;
68
69
  addWriteRoot(absPath: string, source?: 'slash' | 'tool', sessionId?: string): void;
69
70
  revokeRoot(absPath: string, source?: 'slash' | 'tool', sessionId?: string): void;
@@ -73,7 +74,6 @@ export declare class AnthropicDirectProvider implements ModelProvider {
73
74
  writeRoots: string[];
74
75
  allowAll: boolean;
75
76
  };
76
- private appendProviderAuditLog;
77
77
  query(args: ProviderQueryArgs): ProviderQuery;
78
78
  }
79
79
  export declare const anthropicDirectProvider: ModelProvider;
@@ -37,6 +37,7 @@ export declare class OpenAICompatibleProvider implements ModelProvider {
37
37
  query(args: ProviderQueryArgs): ProviderQuery;
38
38
  private buildDispatcher;
39
39
  private ensureSharedRoots;
40
+ private readonly grantManager;
40
41
  addReadRoot(absPath: string, source?: 'slash' | 'tool', sessionId?: string): void;
41
42
  addWriteRoot(absPath: string, source?: 'slash' | 'tool', sessionId?: string): void;
42
43
  revokeRoot(absPath: string, source?: 'slash' | 'tool', sessionId?: string): void;
@@ -46,7 +47,6 @@ export declare class OpenAICompatibleProvider implements ModelProvider {
46
47
  writeRoots: string[];
47
48
  allowAll: boolean;
48
49
  };
49
- private appendProviderAuditLog;
50
50
  close(): void;
51
51
  complete(args: ProviderCompleteArgs): Promise<string>;
52
52
  }
@@ -8,6 +8,7 @@ import type { ComposeExecutor } from './compose-executor.js';
8
8
  import type { ToolHandler, ConcurrencyClassifier } from './types.js';
9
9
  import { type ToolPermissionConfig } from './permissions.js';
10
10
  import type { CanUseTool } from '../types/sdk-types.js';
11
+ import { type GrantSnapshot } from './grant-manager.js';
11
12
  import type { TraceWriter } from '../trace/index.js';
12
13
  export declare function defaultConcurrencyClassifier(toolName: string): boolean;
13
14
  export declare const REPEAT_CIRCUIT_BREAKER_THRESHOLD = 8;
@@ -54,21 +55,16 @@ export declare class SessionToolDispatcher implements ToolDispatcher {
54
55
  private readonly traceWriter;
55
56
  private readonly readOnlyBash;
56
57
  private repeatBreaker;
58
+ private readonly grantManager;
57
59
  constructor(opts: SessionToolDispatcherOptions);
58
60
  private get handlerContext();
59
61
  private callHandlerContext;
60
62
  addReadRoot(absPath: string, source?: 'slash' | 'tool'): void;
61
63
  addWriteRoot(absPath: string, source?: 'slash' | 'tool'): void;
62
64
  revokeRoot(absPath: string, source?: 'slash' | 'tool'): void;
63
- getGrants(): {
64
- resolveBase: string | undefined;
65
- readRoots: string[];
66
- writeRoots: string[];
67
- allowAll: boolean;
68
- };
65
+ getGrants(): GrantSnapshot;
69
66
  setAllowAll(allow: boolean): void;
70
67
  setResolveBase(newCwd: string): void;
71
- private appendAuditLog;
72
68
  get toolDefs(): readonly AnthropicToolDef[];
73
69
  private checkReadOnlyBash;
74
70
  private checkRepeatCircuitBreaker;
@@ -0,0 +1,25 @@
1
+ export type GrantAuditAction = 'grant-read' | 'grant-write' | 'revoke';
2
+ export type GrantSource = 'slash' | 'tool';
3
+ export interface GrantSnapshot {
4
+ resolveBase: string | undefined;
5
+ readRoots: string[];
6
+ writeRoots: string[];
7
+ allowAll: boolean;
8
+ }
9
+ export interface PathGrantManagerHooks {
10
+ getReadRoots(): string[] | undefined;
11
+ getWriteRoots(): string[] | undefined;
12
+ ensureInitialized?(): void;
13
+ getProtectedRoot(): string | undefined;
14
+ getAllowAll(): boolean;
15
+ getDefaultSessionId?(): string | undefined;
16
+ }
17
+ export declare class PathGrantManager {
18
+ private readonly hooks;
19
+ constructor(hooks: PathGrantManagerHooks);
20
+ addReadRoot(absPath: string, source?: GrantSource, sessionId?: string): void;
21
+ addWriteRoot(absPath: string, source?: GrantSource, sessionId?: string): void;
22
+ revokeRoot(absPath: string, source?: GrantSource, sessionId?: string): void;
23
+ getGrants(): GrantSnapshot;
24
+ private appendAuditLog;
25
+ }
@@ -0,0 +1,7 @@
1
+ import { SubagentManager } from '../../subagent.js';
2
+ import type { AgentConfig } from '../../types/config-types.js';
3
+ import type { SkillExecutorInternals } from './types.js';
4
+ export declare function buildForkedChildConfig(internals: SkillExecutorInternals, baseConfig: AgentConfig, signal: AbortSignal, readOnly?: boolean, allowedTools?: string[]): {
5
+ childConfig: AgentConfig;
6
+ childManager: SubagentManager | undefined;
7
+ };
@@ -0,0 +1,22 @@
1
+ import { SubagentManager } from '../../subagent.js';
2
+ import type { ToolCall, ToolResult } from '../types.js';
3
+ import type { AgentConfig } from '../../types/config-types.js';
4
+ import type { SkillExecutorInternals } from './types.js';
5
+ export declare function executeForkedRegistrySkill(internals: SkillExecutorInternals, skill: {
6
+ name: string;
7
+ context?: 'inline' | 'fork' | 'load';
8
+ model?: string;
9
+ readOnly?: boolean;
10
+ }, args: string | undefined, call: ToolCall): Promise<ToolResult>;
11
+ export declare function executePluginSkill(internals: SkillExecutorInternals, skillName: string, body: string, pluginPath: string, args: string | undefined, call: ToolCall, readOnly?: boolean, allowedTools?: string[]): Promise<ToolResult>;
12
+ export declare function runForkedSkillToResult(internals: SkillExecutorInternals, params: {
13
+ manager: SubagentManager;
14
+ childManager: SubagentManager | undefined;
15
+ childConfig: AgentConfig;
16
+ label: string;
17
+ idPrefix: string;
18
+ parentId: string;
19
+ args: string | undefined;
20
+ noOutputError: string;
21
+ errorPrefix: string;
22
+ }): Promise<ToolResult>;
@@ -0,0 +1,11 @@
1
+ import type { ToolCall, ToolResult } from '../types.js';
2
+ import type { SkillExecutorInternals } from './types.js';
3
+ export declare function formatLoadedSkillResult(name: string, body: string, args: string | undefined): ToolResult;
4
+ export declare function emitLoadTelemetry(internals: SkillExecutorInternals, name: string, contentChars: number, durationMs: number, model: string | undefined): void;
5
+ export declare function executeLoadedRegistrySkill(internals: SkillExecutorInternals, skill: {
6
+ name: string;
7
+ model?: string;
8
+ loadBody?: string;
9
+ }, args: string | undefined, call: ToolCall): ToolResult;
10
+ export declare function executeLoadedPluginSkill(internals: SkillExecutorInternals, skillName: string, body: string, args: string | undefined, call: ToolCall): ToolResult;
11
+ export declare function substituteSkillArgs(body: string, args: string | undefined): string;
@@ -0,0 +1,10 @@
1
+ import { type TraceOrigin, type TraceActor } from '../../session/session-identity.js';
2
+ import type { SkillExecutorContext } from './types.js';
3
+ export declare const GATE_SKILLS: Set<string>;
4
+ export declare function isGateSkill(name: string): boolean;
5
+ export declare const MAX_TELEMETRY_ERROR_CHARS = 240;
6
+ export declare function truncateTelemetryString(s: string, max?: number): string;
7
+ export declare function sessionIdentity(ctx: SkillExecutorContext): {
8
+ origin?: TraceOrigin;
9
+ actor?: TraceActor;
10
+ };
@@ -0,0 +1,35 @@
1
+ import type { AgentModelInput, IAgentSession } from '../../types.js';
2
+ import type { ModelProvider } from '../../provider.js';
3
+ import type { TraceWriter } from '../../trace/index.js';
4
+ import type { BackgroundAgentRegistry } from '../../background-registry.js';
5
+ import type { SdkPluginConfig } from '../../types/sdk-types.js';
6
+ import type { ChildProviderFactoryArgs } from '../nesting.js';
7
+ import type { Surface } from '../../awareness/types.js';
8
+ import type { SkillExecutor } from '../skill-executor.js';
9
+ export interface SkillExecutorContext {
10
+ parentSession: Pick<IAgentSession, 'sessionId' | 'getInputStreamRef' | 'abortSignal'> & Partial<Pick<IAgentSession, 'hookRegistry'>>;
11
+ defaultModel?: string;
12
+ surface?: Surface;
13
+ defaultSubagentModel?: AgentModelInput;
14
+ apiKey?: string;
15
+ resolveApiKeyForModel?: (model: string) => string | undefined;
16
+ baseUrl?: string;
17
+ openaiBaseUrl?: string;
18
+ pluginConfigs?: SdkPluginConfig[];
19
+ depth?: number;
20
+ maxDepth?: number;
21
+ childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
22
+ childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string) => SkillExecutor;
23
+ traceWriter?: TraceWriter;
24
+ backgroundRegistry?: BackgroundAgentRegistry;
25
+ cwd?: string;
26
+ agentRegistry?: import('../../agents/index.js').AgentRegistry;
27
+ }
28
+ export interface SkillInput {
29
+ name: string;
30
+ arguments?: string;
31
+ }
32
+ export interface SkillExecutorInternals {
33
+ readonly ctx: SkillExecutorContext;
34
+ readonly currentCwd: string | undefined;
35
+ }
@@ -1,48 +1,15 @@
1
- import type { AgentModelInput, IAgentSession } from '../types.js';
2
- import type { ModelProvider } from '../provider.js';
3
1
  import type { ToolCall, ToolResult } from './types.js';
4
- import type { TraceWriter } from '../trace/index.js';
5
- import type { BackgroundAgentRegistry } from '../background-registry.js';
6
- import type { SdkPluginConfig } from '../types/sdk-types.js';
7
- import { type ChildProviderFactoryArgs } from './nesting.js';
8
- import type { Surface } from '../awareness/types.js';
9
- export interface SkillExecutorContext {
10
- parentSession: Pick<IAgentSession, 'sessionId' | 'getInputStreamRef' | 'abortSignal'> & Partial<Pick<IAgentSession, 'hookRegistry'>>;
11
- defaultModel?: string;
12
- surface?: Surface;
13
- defaultSubagentModel?: AgentModelInput;
14
- apiKey?: string;
15
- resolveApiKeyForModel?: (model: string) => string | undefined;
16
- baseUrl?: string;
17
- openaiBaseUrl?: string;
18
- pluginConfigs?: SdkPluginConfig[];
19
- depth?: number;
20
- maxDepth?: number;
21
- childProviderFactory?: (args: ChildProviderFactoryArgs) => ModelProvider;
22
- childSkillExecutorFactory?: (depth: number, maxDepth: number, signal: AbortSignal, inheritedCwd?: string) => SkillExecutor;
23
- traceWriter?: TraceWriter;
24
- backgroundRegistry?: BackgroundAgentRegistry;
25
- cwd?: string;
26
- agentRegistry?: import('../agents/index.js').AgentRegistry;
27
- }
2
+ import type { SkillExecutorContext } from './skill-executor/types.js';
3
+ export type { SkillExecutorContext } from './skill-executor/types.js';
28
4
  export declare class SkillExecutor {
29
5
  private readonly ctx;
30
6
  private pluginBodies;
31
7
  private currentCwd;
32
8
  constructor(ctx: SkillExecutorContext);
33
9
  setCwd(cwd: string): void;
34
- private sessionIdentity;
10
+ private internals;
35
11
  execute(call: ToolCall): Promise<ToolResult>;
36
12
  private executeRegistrySkill;
37
- private buildForkedChildConfig;
38
- private executeForkedRegistrySkill;
39
- private formatLoadedSkillResult;
40
- private emitLoadTelemetry;
41
- private executeLoadedRegistrySkill;
42
- private executeLoadedPluginSkill;
43
- private substituteSkillArgs;
44
- private executePluginSkill;
45
- private runForkedSkillToResult;
46
13
  private getPluginSkillBody;
47
14
  private createDispatchSkillCallback;
48
15
  }