agent-afk 5.26.4 → 5.27.0

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.
@@ -9,6 +9,7 @@ export type UsageLimitClassification = {
9
9
  } | {
10
10
  kind: 'credit-exhausted';
11
11
  };
12
+ export declare const RATE_LIMIT_TRANSIENT_MAX_RETRY_AFTER_MS: number;
12
13
  export declare function parseRetryAfterMs(error: unknown): number | undefined;
13
14
  export declare function classifyUsageLimitError(error: Error): UsageLimitClassification | null;
14
15
  export interface WaitForResetOpts {
@@ -0,0 +1,62 @@
1
+ import type { ExecFileFn } from '../../worktree-sweep.js';
2
+ export declare const defaultExecFile: ExecFileFn;
3
+ export interface RepoContext {
4
+ repoRoot: string;
5
+ afkWorktreesRoot: string;
6
+ }
7
+ export declare function resolveRepoContext(execFile: ExecFileFn, cwd: string): Promise<RepoContext>;
8
+ export declare function sanitizeSlug(name: string): string;
9
+ export interface CreateManagedWorktreeArgs {
10
+ execFile: ExecFileFn;
11
+ repoRoot: string;
12
+ worktreePath: string;
13
+ branch: string;
14
+ baseRef: string;
15
+ owner?: string;
16
+ }
17
+ export interface ManagedWorktreeInfo {
18
+ path: string;
19
+ branch: string;
20
+ baseRef: string;
21
+ baseSha: string;
22
+ }
23
+ export declare function createManagedWorktree(args: CreateManagedWorktreeArgs): Promise<ManagedWorktreeInfo>;
24
+ export declare function isManagedWorktreeDirty(execFile: ExecFileFn, worktreePath: string): Promise<boolean>;
25
+ export declare function managedWorktreeCommitsAhead(execFile: ExecFileFn, repoRoot: string, worktreePath: string): Promise<number>;
26
+ export type GuardedRemoveOutcome = {
27
+ removed: true;
28
+ branchPreserved: string | null;
29
+ } | {
30
+ removed: false;
31
+ reason: 'dirty';
32
+ } | {
33
+ removed: false;
34
+ reason: 'commits-ahead';
35
+ commitsAhead: number;
36
+ };
37
+ export interface RemoveManagedWorktreeArgs {
38
+ execFile: ExecFileFn;
39
+ repoRoot: string;
40
+ worktreePath: string;
41
+ branch?: string | null;
42
+ force?: boolean;
43
+ }
44
+ export declare function removeManagedWorktreeGuarded(args: RemoveManagedWorktreeArgs): Promise<GuardedRemoveOutcome>;
45
+ export declare function createIsolatedWorktree(args: {
46
+ execFile?: ExecFileFn;
47
+ cwd: string;
48
+ slugHint: string;
49
+ baseRef?: string;
50
+ }): Promise<ManagedWorktreeInfo & {
51
+ repoRoot: string;
52
+ }>;
53
+ export interface IsolatedTeardownResult {
54
+ removed: boolean;
55
+ preserved: boolean;
56
+ reason?: 'dirty' | 'commits-ahead';
57
+ }
58
+ export declare function teardownIsolatedWorktree(args: {
59
+ execFile?: ExecFileFn;
60
+ repoRoot: string;
61
+ worktreePath: string;
62
+ }): Promise<IsolatedTeardownResult>;
@@ -37,5 +37,6 @@ export interface BuildChildConfigResult {
37
37
  childConfig: AgentConfig;
38
38
  childParentSession: ChildParentSession | undefined;
39
39
  childManager: SubagentManager | undefined;
40
+ childWriteCapable: boolean;
40
41
  }
41
42
  export declare function buildChildConfig(args: BuildChildConfigArgs): BuildChildConfigResult;
@@ -26,6 +26,10 @@ export interface RunForegroundArgs {
26
26
  activeForegroundHandles: Map<string, {
27
27
  cancel: () => Promise<void>;
28
28
  }>;
29
+ isolationTeardown?: {
30
+ repoRoot: string;
31
+ worktreePath: string;
32
+ };
29
33
  }
30
34
  export declare function runForegroundWithPromotion(args: RunForegroundArgs): Promise<ToolResult>;
31
35
  export {};
@@ -10,5 +10,6 @@ export interface AgentInput {
10
10
  agent_type?: string;
11
11
  mode: AgentExecutionMode;
12
12
  cwd?: string;
13
+ isolation?: 'worktree';
13
14
  }
14
15
  export declare function parseAgentInput(input: unknown): AgentInput;
@@ -45,6 +45,7 @@ export interface SubagentControl {
45
45
  export declare class SubagentExecutor implements SubagentControl {
46
46
  private readonly ctx;
47
47
  private currentCwd;
48
+ private isolationCounter;
48
49
  constructor(ctx: SubagentExecutorContext);
49
50
  setCwd(cwd: string): void;
50
51
  describeAgentTool(): AnthropicToolDef;