agent-afk 5.296.4 → 5.296.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/tools/hooks/path-approval-hook.d.ts +13 -1
- package/dist/agent/tools/hooks/path-approval-hook.prompt.d.ts +18 -0
- package/dist/agent/tools/readonly-bash.d.ts +1 -0
- package/dist/agent/tools/readonly-bash.tokenizer.d.ts +10 -0
- package/dist/agent/trace/receipt.d.ts +1 -1
- package/dist/agent/trace/receipt.render.d.ts +2 -0
- package/dist/agent/worktree/worktree-sweep.classify.d.ts +43 -0
- package/dist/agent/worktree/worktree-sweep.d.ts +2 -3
- package/dist/agent/worktree/worktree-sweep.lock.d.ts +5 -0
- package/dist/cli.mjs +414 -414
- package/dist/index.mjs +154 -154
- package/dist/telegram.mjs +199 -199
- package/package.json +1 -1
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GrantManager } from '../grant-manager.js';
|
|
2
|
+
import type { HookDecision, HookHandler } from '../../hooks.js';
|
|
3
|
+
export { extractCandidatePath, extractAllPaths } from './path-approval-hook.prompt.js';
|
|
2
4
|
export type PathApprovalSurface = 'repl' | 'telegram' | 'web' | 'unknown';
|
|
3
5
|
export interface PathApprovalHookOptions {
|
|
4
6
|
getCwd: () => string | undefined;
|
|
5
7
|
surface: PathApprovalSurface;
|
|
6
8
|
}
|
|
9
|
+
export interface PathApprovalState {
|
|
10
|
+
sessionApproved: Set<string>;
|
|
11
|
+
onceApproved: Map<string, {
|
|
12
|
+
resolvedPath: string;
|
|
13
|
+
mode: 'read' | 'write';
|
|
14
|
+
capturedCwd: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
inFlight: Map<string, Promise<HookDecision>>;
|
|
17
|
+
lastSeenGrantManager: GrantManager | undefined;
|
|
18
|
+
}
|
|
7
19
|
export interface PathApprovalHookHandlers {
|
|
8
20
|
preToolUse: HookHandler;
|
|
9
21
|
postToolUse: HookHandler;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GrantManager } from '../grant-manager.js';
|
|
2
|
+
import type { HookDecision } from '../../hooks.js';
|
|
3
|
+
import type { PathApprovalState, PathApprovalSurface } from './path-approval-hook.js';
|
|
4
|
+
export declare function extractCandidatePath(toolName: string, input: Record<string, unknown>): string | undefined;
|
|
5
|
+
export declare function extractAllPaths(toolName: string, input: Record<string, unknown>): string[];
|
|
6
|
+
export declare function pathApprovalKey(mode: 'read' | 'write', resolvedPath: string): string;
|
|
7
|
+
export declare function promptForApproval(args: {
|
|
8
|
+
toolName: string;
|
|
9
|
+
resolvedPath: string;
|
|
10
|
+
allPaths?: string[];
|
|
11
|
+
capturedCwd: string | undefined;
|
|
12
|
+
mode: 'read' | 'write';
|
|
13
|
+
grantManager: GrantManager;
|
|
14
|
+
state: PathApprovalState;
|
|
15
|
+
surface: PathApprovalSurface;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
sessionId?: string;
|
|
18
|
+
}): Promise<HookDecision>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CmdSegment {
|
|
2
|
+
readonly command: string;
|
|
3
|
+
readonly argv: readonly string[];
|
|
4
|
+
}
|
|
5
|
+
export declare function baseName(cmd: string): string;
|
|
6
|
+
export declare function tokenizeSegments(command: string): string[][];
|
|
7
|
+
export declare function resolveSegment(rawTokens: readonly string[], vars: Map<string, string>): CmdSegment | null;
|
|
8
|
+
export declare function gitSegmentReason(argv: readonly string[]): string | null;
|
|
9
|
+
export declare function curlSegmentMutating(seg: CmdSegment): boolean;
|
|
10
|
+
export declare function tokenizedSegmentReason(command: string): string | null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { renderReceiptMarkdown } from './receipt.render.js';
|
|
1
2
|
import type { HookHandler } from '../hooks.js';
|
|
2
3
|
import { type ClosureReason, type ToolFailureClass, type TraceEvent, type TraceEventKind } from './types.js';
|
|
3
4
|
export declare const RECEIPT_SCHEMA_VERSION: 1;
|
|
@@ -78,7 +79,6 @@ export declare function receiptPathsFor(tracePath: string): {
|
|
|
78
79
|
mdPath: string;
|
|
79
80
|
};
|
|
80
81
|
export declare function generateReceipt(events: TraceEvent[], meta: ReceiptMeta): RunReceipt;
|
|
81
|
-
export declare function renderReceiptMarkdown(r: RunReceipt): string;
|
|
82
82
|
export interface WriteRunReceiptOptions {
|
|
83
83
|
tracePath: string;
|
|
84
84
|
sessionId?: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const MIN_EMPTY_AGE_MS = 3600000;
|
|
2
|
+
export type DirtyReason = 'clean' | 'uncommitted changes' | 'git status failed' | `non-rebuildable ignored files: ${string}` | 'ignored-file probe failed';
|
|
3
|
+
export interface WorktreeMeta {
|
|
4
|
+
owner: 'interactive' | 'diagnose' | string;
|
|
5
|
+
pid?: number;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
baseSha?: string;
|
|
8
|
+
baseBranch?: string;
|
|
9
|
+
preservedReason?: 'dirty' | 'commits-ahead' | 'ignored-local-state';
|
|
10
|
+
preservedAt?: string;
|
|
11
|
+
commitsAheadAtPreserve?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface WorktreeCandidate {
|
|
14
|
+
path: string;
|
|
15
|
+
head?: string;
|
|
16
|
+
branch?: string;
|
|
17
|
+
locked: boolean;
|
|
18
|
+
prunable: boolean;
|
|
19
|
+
meta?: WorktreeMeta;
|
|
20
|
+
ageMs: number;
|
|
21
|
+
isDirty: boolean;
|
|
22
|
+
dirtyReason: DirtyReason;
|
|
23
|
+
commitsAhead: number;
|
|
24
|
+
commitsUnpushed: number;
|
|
25
|
+
ownerLiveness: 'alive' | 'dead' | 'unknown';
|
|
26
|
+
}
|
|
27
|
+
export type WorktreeVerdict = 'empty' | 'stale-clean' | 'stale-dirty' | 'locked' | 'active' | 'orphaned-dir' | 'orphaned-dir-preserved' | 'orphaned-registration' | 'dead-owner';
|
|
28
|
+
export declare const MAX_TRUSTED_PID_AGE_MS: number;
|
|
29
|
+
export { isProcessAlive } from '../process-liveness.js';
|
|
30
|
+
export declare function realpathSafe(p: string): string;
|
|
31
|
+
export declare function isPathWithin(child: string, parent: string): boolean;
|
|
32
|
+
export declare function shortBranchName(branch: string): string;
|
|
33
|
+
export interface ParsedWorktree {
|
|
34
|
+
path: string;
|
|
35
|
+
head: string;
|
|
36
|
+
branch: string;
|
|
37
|
+
locked: boolean;
|
|
38
|
+
lockReason?: string;
|
|
39
|
+
prunable: boolean;
|
|
40
|
+
isBare: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare function parseWorktreeList(stdout: string): ParsedWorktree[];
|
|
43
|
+
export declare function classifyCandidate(candidate: WorktreeCandidate, maxAgeDaysClean: number, maxAgeDaysDirty: number): WorktreeVerdict;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type PresenceRecord } from '../awareness/presence.js';
|
|
2
|
+
import { type WorktreeVerdict } from './worktree-sweep.classify.js';
|
|
3
|
+
export { MIN_EMPTY_AGE_MS } from './worktree-sweep.classify.js';
|
|
2
4
|
export type ExecFileFn = (file: string, args: string[], opts?: {
|
|
3
5
|
cwd?: string;
|
|
4
6
|
maxBuffer?: number;
|
|
@@ -7,7 +9,6 @@ export type ExecFileFn = (file: string, args: string[], opts?: {
|
|
|
7
9
|
stdout: string;
|
|
8
10
|
stderr: string;
|
|
9
11
|
}>;
|
|
10
|
-
type WorktreeVerdict = 'empty' | 'stale-clean' | 'stale-dirty' | 'locked' | 'active' | 'orphaned-dir' | 'orphaned-dir-preserved' | 'orphaned-registration' | 'dead-owner';
|
|
11
12
|
export interface SweepOptions {
|
|
12
13
|
execFile: ExecFileFn;
|
|
13
14
|
repoRoot: string;
|
|
@@ -33,6 +34,4 @@ export interface SweepResult {
|
|
|
33
34
|
candidates: SweepCandidateSummary[];
|
|
34
35
|
contested?: boolean;
|
|
35
36
|
}
|
|
36
|
-
export declare const MIN_EMPTY_AGE_MS = 3600000;
|
|
37
37
|
export declare function runSweep(options: SweepOptions): Promise<SweepResult>;
|
|
38
|
-
export {};
|