@agentproto/worktree 0.13.0 → 0.14.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.
- package/README.md +35 -0
- package/dist/bin/worktree-agent.mjs +2 -2
- package/dist/{chunk-YMDOSMMD.mjs → chunk-FC3I5NTS.mjs} +3 -3
- package/dist/{chunk-YMDOSMMD.mjs.map → chunk-FC3I5NTS.mjs.map} +1 -1
- package/dist/{chunk-MYH5XOX6.mjs → chunk-IEW2O3PF.mjs} +493 -144
- package/dist/chunk-IEW2O3PF.mjs.map +1 -0
- package/dist/index.d.ts +190 -15
- package/dist/index.mjs +3 -3
- package/dist/provider/index.mjs +1 -1
- package/package.json +7 -7
- package/dist/chunk-MYH5XOX6.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -233,6 +233,18 @@ interface ExecResult {
|
|
|
233
233
|
/** Extra `AGENTPROTO_*` (or any) vars, merged onto `process.env` for the child. */
|
|
234
234
|
interface ExecOptions {
|
|
235
235
|
env?: Record<string, string>;
|
|
236
|
+
/**
|
|
237
|
+
* Cancels the child. When given, the child is spawned as the leader of its
|
|
238
|
+
* own process group (POSIX), and an abort signals the WHOLE group, so a
|
|
239
|
+
* `sh -c "pnpm install"` takes its `pnpm` and every worker underneath it
|
|
240
|
+
* down too instead of orphaning them. SIGTERM first, SIGKILL after
|
|
241
|
+
* {@link killGraceMs}. Already-aborted signals reject before spawning.
|
|
242
|
+
* The promise still resolves (with the child's real exit code) once the
|
|
243
|
+
* tree is gone; callers decide what an aborted run means.
|
|
244
|
+
*/
|
|
245
|
+
signal?: AbortSignal;
|
|
246
|
+
/** Grace between SIGTERM and SIGKILL on abort. Default 5000ms. */
|
|
247
|
+
killGraceMs?: number;
|
|
236
248
|
}
|
|
237
249
|
/** Run an argv (no shell — args pass through verbatim, no injection risk). */
|
|
238
250
|
declare function execArgv(command: string, args: readonly string[], cwd: string, opts?: ExecOptions): Promise<ExecResult>;
|
|
@@ -262,18 +274,21 @@ declare function execGit(repoRoot: string, args: readonly string[]): Promise<Exe
|
|
|
262
274
|
* are authorized to die; only the cost is being moved.
|
|
263
275
|
* 2. `git worktree prune` — git forgets the (now missing) registration.
|
|
264
276
|
* The worktree disappears from `git worktree list` immediately.
|
|
265
|
-
* 3. `rm -rf` on the trash
|
|
266
|
-
* (`
|
|
267
|
-
*
|
|
268
|
-
* of unlinks,
|
|
277
|
+
* 3. `rm -rf` on the trash dirs runs in ONE DETACHED, serialized deleter
|
|
278
|
+
* per pool (`ensureTrashDeleter`; a `.trash/.deleting` pid file stops a
|
|
279
|
+
* second one spawning while it lives) — the parent never waits for the
|
|
280
|
+
* hundreds of thousands of unlinks, survives its own exit, and a burst
|
|
281
|
+
* of reclaims doesn't storm the disk with parallel `rm`s. The next `gc` apply also
|
|
269
282
|
* sweeps stale `.trash` dirs (`sweepWorktreeTrash`) so nothing leaks
|
|
270
283
|
* even if a child is killed mid-delete.
|
|
271
284
|
*
|
|
272
285
|
* SAFETY — the plain/forced `git worktree remove` semantics this must not
|
|
273
|
-
* weaken, verified empirically against git
|
|
274
|
-
* -
|
|
275
|
-
* `
|
|
276
|
-
*
|
|
286
|
+
* weaken, verified empirically against git:
|
|
287
|
+
* - Plain `git worktree remove` ACCEPTS gitignored files (`node_modules`,
|
|
288
|
+
* `dist`) and refuses only modified/staged tracked files, unignored
|
|
289
|
+
* untracked files, dirty submodules and locked worktrees. A non-force
|
|
290
|
+
* `removeWorktreeFast` gates on `git status --porcelain
|
|
291
|
+
* --ignore-submodules=none` (no `--ignored`) plus a locked check, and
|
|
277
292
|
* throws (leaving the worktree in place) rather than renaming dirt away.
|
|
278
293
|
* - A forced removal is only ever passed after a salvage snapshot or an
|
|
279
294
|
* explicit user-granted discard flag upstream — this module doesn't
|
|
@@ -288,7 +303,7 @@ declare const WORKTREE_TRASH_DIRNAME = ".trash";
|
|
|
288
303
|
interface RemoveWorktreeFastOptions {
|
|
289
304
|
/**
|
|
290
305
|
* `false` (default): re-verify the tree is clean via `git status
|
|
291
|
-
* --porcelain` and refuse (throw) on any dirt — the same refusal a plain
|
|
306
|
+
* --porcelain --untracked-files=normal --ignore-submodules=none` and refuse (throw) on any dirt — the same refusal a plain
|
|
292
307
|
* `git worktree remove` performs. `true`: skip the cleanliness gate,
|
|
293
308
|
* exactly like `git worktree remove --force` — only pass this when dirt
|
|
294
309
|
* has been authorized (salvage snapshot durable / discard flags granted)
|
|
@@ -301,11 +316,18 @@ interface RemoveWorktreeFastOptions {
|
|
|
301
316
|
*/
|
|
302
317
|
now?: () => number;
|
|
303
318
|
/**
|
|
304
|
-
* Test seam — overrides
|
|
305
|
-
* spy). Receives the trash dir path. Default:
|
|
306
|
-
*
|
|
319
|
+
* Test seam — overrides background deletion per trash dir (e.g. an
|
|
320
|
+
* in-process spy). Receives the trash dir path. Default: one detached,
|
|
321
|
+
* serialized deleter per pool (`ensureTrashDeleter`) the parent never
|
|
322
|
+
* waits on.
|
|
307
323
|
*/
|
|
308
324
|
spawnRemoval?: (trashDir: string) => void;
|
|
325
|
+
/**
|
|
326
|
+
* Test seam — replaces spawning the pool's single serialized background
|
|
327
|
+
* deleter (see `ensureTrashDeleter`). Receives the `.trash` parent and
|
|
328
|
+
* returns the spawned pid. Ignored when `spawnRemoval` is set.
|
|
329
|
+
*/
|
|
330
|
+
spawnDeleter?: (trashParent: string) => number | undefined;
|
|
309
331
|
}
|
|
310
332
|
/**
|
|
311
333
|
* Remove a linked git worktree instantly: validate → rename to trash →
|
|
@@ -323,6 +345,7 @@ declare function removeWorktreeFast(repoRoot: string, path: string, options?: Re
|
|
|
323
345
|
*/
|
|
324
346
|
declare function sweepWorktreeTrash(root: string, options?: {
|
|
325
347
|
spawnRemoval?: (dir: string) => void;
|
|
348
|
+
spawnDeleter?: (trashParent: string) => number | undefined;
|
|
326
349
|
}): void;
|
|
327
350
|
|
|
328
351
|
/** Compile a `/`-separated glob (supporting `*`, `?`, `**`) into an anchored regex. */
|
|
@@ -357,9 +380,156 @@ declare function expandCloneGlob(root: string, pattern: string): Promise<string[
|
|
|
357
380
|
* the package manager runs — turning `depsCmd` into a quick verify/repair
|
|
358
381
|
* instead of a full reinstall. Skips an entry whose destination already
|
|
359
382
|
* exists — same never-clobber rule `linkPaths`/`writeFiles` follow in
|
|
360
|
-
* `provision-worktree.body.ts`.
|
|
383
|
+
* `provision-worktree.body.ts`. `signal` cancels mid-copy (the `cp` process
|
|
384
|
+
* group is killed) with {@link ProvisionCancelledError}.
|
|
361
385
|
*/
|
|
362
|
-
declare function cloneEntries(repoRoot: string, cwd: string, patterns: readonly string[]): Promise<void>;
|
|
386
|
+
declare function cloneEntries(repoRoot: string, cwd: string, patterns: readonly string[], signal?: AbortSignal): Promise<void>;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Daemon-wide scheduler for the HEAVY phases of worktree provisioning
|
|
390
|
+
* (`cloneGlobs`, `depsCmd`, `copyGlobs`, the `worktree.setup` hooks).
|
|
391
|
+
*
|
|
392
|
+
* Incident 2026-09-28: five `agent_start({worktree})` spawns provisioned at
|
|
393
|
+
* once, each ran a full `pnpm install` against one pnpm store on one SSD, the
|
|
394
|
+
* load average hit 170, and every install took ~14 min instead of ~4 while the
|
|
395
|
+
* sessions sat in `starting` looking stalled. The cure is admission control:
|
|
396
|
+
* at most N heavy segments run at once, the rest wait in a queue that can be
|
|
397
|
+
* observed and cancelled.
|
|
398
|
+
*
|
|
399
|
+
* One provisioning takes ONE slot for its whole heavy segment (clone → deps →
|
|
400
|
+
* copy → setup) rather than one per phase, so a half-built worktree never
|
|
401
|
+
* re-queues behind newer arrivals. `git worktree add` and the cheap steps
|
|
402
|
+
* around it stay outside the slot.
|
|
403
|
+
*
|
|
404
|
+
* Dispatch order is FIFO with a fair-share tiebreak: among the waiters whose
|
|
405
|
+
* repo is under its cap, the next one is the waiter whose CALLER currently
|
|
406
|
+
* holds the fewest running slots, oldest first on ties. One caller that
|
|
407
|
+
* spawns ten worktrees therefore cannot starve another caller's single spawn,
|
|
408
|
+
* and with a single caller this is plain FIFO.
|
|
409
|
+
*/
|
|
410
|
+
/** Default cap on concurrently running heavy segments. */
|
|
411
|
+
declare const DEFAULT_PROVISION_CONCURRENCY = 2;
|
|
412
|
+
/** Env override for the global cap; wins over `worktrees.provisionConcurrency`. */
|
|
413
|
+
declare const PROVISION_CONCURRENCY_ENV = "AGENTPROTO_WORKTREES_PROVISION_CONCURRENCY";
|
|
414
|
+
/** The phases a provisioning moves through, in order. `worktree` is the
|
|
415
|
+
* unthrottled `git worktree add` + cheap prep; the rest are the heavy ones. */
|
|
416
|
+
type ProvisionPhase = "worktree" | "clone" | "deps" | "copy" | "setup";
|
|
417
|
+
/** Resolved, validated scheduler limits. `Infinity` means "no cap". */
|
|
418
|
+
interface ProvisionLimits {
|
|
419
|
+
/** Max heavy segments running at once, across every repo. */
|
|
420
|
+
concurrency: number;
|
|
421
|
+
/** Extra per-repo caps (also bounded by `concurrency`). Keys are absolute
|
|
422
|
+
* repo-root paths or bare repo directory names. */
|
|
423
|
+
perRepo: Readonly<Record<string, number>>;
|
|
424
|
+
/** Load guard: hold back a new heavy segment while the 1-minute load
|
|
425
|
+
* average exceeds `cores x loadFactor`. `0` = off (the default). */
|
|
426
|
+
loadFactor: number;
|
|
427
|
+
}
|
|
428
|
+
declare const DEFAULT_PROVISION_LIMITS: ProvisionLimits;
|
|
429
|
+
/**
|
|
430
|
+
* Parse the `worktrees` section of `~/.agentproto/config.json` (plus env)
|
|
431
|
+
* into {@link ProvisionLimits}. Never throws: an invalid value falls back to
|
|
432
|
+
* the default for that field so a typo can't take provisioning down.
|
|
433
|
+
*
|
|
434
|
+
* - `provisionConcurrency`: integer >= 0 (`0` = unlimited). Env
|
|
435
|
+
* `AGENTPROTO_WORKTREES_PROVISION_CONCURRENCY` wins over the config field.
|
|
436
|
+
* - `provisionConcurrencyByRepo`: `{ "<repo path or dir name>": cap }`.
|
|
437
|
+
* - `provisionLoadFactor`: number > 0 enables the load guard.
|
|
438
|
+
*/
|
|
439
|
+
declare function parseProvisionLimits(raw: unknown, env?: Readonly<Record<string, string | undefined>>): ProvisionLimits;
|
|
440
|
+
/** Thrown when a provisioning is cancelled: while queued (its slot request is
|
|
441
|
+
* dropped) or while running (its child process tree is killed). */
|
|
442
|
+
declare class ProvisionCancelledError extends Error {
|
|
443
|
+
constructor(message?: string);
|
|
444
|
+
}
|
|
445
|
+
/** Progress a provisioning reports to whoever spawned it. `queued` repeats
|
|
446
|
+
* whenever the projected position moves. */
|
|
447
|
+
type ProvisionProgress = {
|
|
448
|
+
kind: "queued";
|
|
449
|
+
position: number;
|
|
450
|
+
phase: ProvisionPhase;
|
|
451
|
+
} | {
|
|
452
|
+
kind: "started";
|
|
453
|
+
phase: ProvisionPhase;
|
|
454
|
+
} | {
|
|
455
|
+
kind: "phase";
|
|
456
|
+
phase: ProvisionPhase;
|
|
457
|
+
} | {
|
|
458
|
+
kind: "done";
|
|
459
|
+
outcome: "ok" | "failed" | "cancelled";
|
|
460
|
+
};
|
|
461
|
+
/** Ambient, per-provisioning context. Carried through `AsyncLocalStorage`
|
|
462
|
+
* because the `worktree.provision` tool contract has no room for callbacks,
|
|
463
|
+
* and the runner's own abort signal is bound to the tool's 30s default
|
|
464
|
+
* timeout, which must never cancel a multi-minute install. */
|
|
465
|
+
interface ProvisionRunContext {
|
|
466
|
+
/** Whose spawn this is, for fair-share. Typically the parent session id. */
|
|
467
|
+
callerKey?: string;
|
|
468
|
+
/** Cancels this provisioning (queued or running). */
|
|
469
|
+
signal?: AbortSignal;
|
|
470
|
+
onProgress?: (progress: ProvisionProgress) => void;
|
|
471
|
+
}
|
|
472
|
+
declare function runWithProvisionContext<T>(ctx: ProvisionRunContext, fn: () => T): T;
|
|
473
|
+
declare function currentProvisionContext(): ProvisionRunContext | undefined;
|
|
474
|
+
interface AcquireRequest {
|
|
475
|
+
/** Absolute repo root; matched against `perRepo` caps. */
|
|
476
|
+
repoKey: string;
|
|
477
|
+
callerKey?: string;
|
|
478
|
+
signal?: AbortSignal;
|
|
479
|
+
/** Called with the projected 1-based queue position when this request
|
|
480
|
+
* starts waiting and whenever its position changes. Never called when the
|
|
481
|
+
* slot is granted immediately. */
|
|
482
|
+
onQueued?: (position: number) => void;
|
|
483
|
+
}
|
|
484
|
+
/** A held slot. `release` is idempotent. */
|
|
485
|
+
interface ProvisionLease {
|
|
486
|
+
release(): void;
|
|
487
|
+
}
|
|
488
|
+
interface SchedulerOptions {
|
|
489
|
+
limits?: ProvisionLimits;
|
|
490
|
+
/** Test seams. */
|
|
491
|
+
loadavg1?: () => number;
|
|
492
|
+
cpuCount?: () => number;
|
|
493
|
+
/** How often a load-guarded queue re-checks the load. Default 5000ms. */
|
|
494
|
+
loadPollMs?: number;
|
|
495
|
+
}
|
|
496
|
+
interface SchedulerSnapshot {
|
|
497
|
+
running: number;
|
|
498
|
+
queued: number;
|
|
499
|
+
limit: number;
|
|
500
|
+
}
|
|
501
|
+
declare class ProvisionScheduler {
|
|
502
|
+
private limits;
|
|
503
|
+
private readonly queue;
|
|
504
|
+
private readonly running;
|
|
505
|
+
private seq;
|
|
506
|
+
private loadTimer;
|
|
507
|
+
private readonly loadavg1;
|
|
508
|
+
private readonly cpuCount;
|
|
509
|
+
private readonly loadPollMs;
|
|
510
|
+
constructor(opts?: SchedulerOptions);
|
|
511
|
+
/** Replace the limits (config is re-read per provision). Raising a cap
|
|
512
|
+
* admits waiters immediately; lowering one never interrupts a running
|
|
513
|
+
* segment, it just delays the next admission. */
|
|
514
|
+
configure(limits: ProvisionLimits): void;
|
|
515
|
+
snapshot(): SchedulerSnapshot;
|
|
516
|
+
/**
|
|
517
|
+
* Request a heavy-phase slot. Resolves with a lease once admitted; rejects
|
|
518
|
+
* with {@link ProvisionCancelledError} when `signal` aborts first (the
|
|
519
|
+
* queue entry is dropped, so a cancelled spawn never occupies a slot).
|
|
520
|
+
*/
|
|
521
|
+
acquire(req: AcquireRequest): Promise<ProvisionLease>;
|
|
522
|
+
private repoCap;
|
|
523
|
+
private runningFor;
|
|
524
|
+
/** Waiters in the order they would be admitted absent per-repo caps. */
|
|
525
|
+
private projectedOrder;
|
|
526
|
+
private loadGuardBlocks;
|
|
527
|
+
private pump;
|
|
528
|
+
private notifyPositions;
|
|
529
|
+
private armLoadTimer;
|
|
530
|
+
}
|
|
531
|
+
/** The process-wide (daemon-wide) scheduler every worktree provisioning shares. */
|
|
532
|
+
declare const provisionScheduler: ProvisionScheduler;
|
|
363
533
|
|
|
364
534
|
/**
|
|
365
535
|
* `agentproto.json` — the declarative per-repo worktree lifecycle.
|
|
@@ -644,10 +814,15 @@ declare class HookError extends Error {
|
|
|
644
814
|
* Both attempts are logged (when `logPath` is given); the thrown
|
|
645
815
|
* `HookError` carries the RETRY's own result, since that's the one the
|
|
646
816
|
* caller is actually giving up on.
|
|
817
|
+
*
|
|
818
|
+
* `opts.signal` cancels the run: the running hook's whole process tree is
|
|
819
|
+
* killed (see `ExecOptions.signal`) and {@link ProvisionCancelledError} is
|
|
820
|
+
* thrown instead of a `HookError`, with no retry.
|
|
647
821
|
*/
|
|
648
822
|
declare function runSetup(config: AgentprotoConfig, ctx: WorktreeEnvContext, opts?: {
|
|
649
823
|
logPath?: string;
|
|
650
824
|
retryOnFailure?: boolean;
|
|
825
|
+
signal?: AbortSignal;
|
|
651
826
|
}): Promise<HookRun[]>;
|
|
652
827
|
/**
|
|
653
828
|
* Run the `worktree.teardown` hooks sequentially. Unlike setup, a failing
|
|
@@ -2253,4 +2428,4 @@ declare function recordBranchVerdict(input: {
|
|
|
2253
2428
|
now?: () => string;
|
|
2254
2429
|
}): Promise<BranchVerdictRecord>;
|
|
2255
2430
|
|
|
2256
|
-
export { type AgentprotoConfig, type ApplyBranchGcOptions, type ApplyGcOptions, BRANCH_GC_SCOPES, BRANCH_GC_STATE_DIR, BRANCH_TRIAGE_VERDICTS, BRANCH_VERDICTS_PATH, type BaseDivergence, type BranchCoverage, type BranchGcApplyOutcome, type BranchGcApplyResult, type BranchGcClass, type BranchGcHoldReason, type BranchGcPlan, type BranchGcPlanEntry, type BranchGcReclaimReason, type BranchGcRestoreEntry, type BranchGcRestoreLog, type BranchGcSummary, type BranchHistory, type BranchPushState, type BranchRef, type BranchRefKind, type BranchReviewCandidate, type BranchReviewQueue, type BranchStatus, type BranchTriageVerdict, type BranchVerdict, BranchVerdictError, type BranchVerdictRecord, type BranchVerdictStore, type BranchVerdictSummary, CONFIG_FILENAME, type Classification, type ClassifyForGcOptions, type ComputeProvenanceOptions, type ComputeTreeStateOptions, type ComputeWorktreeStatusInput, ConfigError, DEFAULT_BRANCH_GC_MIN_AGE_DAYS, DEFAULT_GC_NOISE_PATHS, DEFAULT_PROXY_PORT, type DaemonAgentSessionHost, type DaemonClient, ENV_VARS, type ExecOptions, type ExecResult, FileBranchVerdictStore, FileVerdictMemoStore, type ForgeClient, type ForgePullRequestRef, ForgeUnavailableError, type GateState, type GcApplyOutcome, type GcClass, type GcHoldReason, type GcPlanEntry, type GcReclaimReason, GhCliForgeClient, type GitWorktreeRef, GlobTraversalError, HookError, type HookRun, type HostnameParts, type InBaseReclaimReason, InMemoryBranchVerdictStore, InMemoryVerdictMemoStore, type IntegrationState, LOCAL_WORKTREE_CONFIG_REL, type LadderContext, type ListWorktreeStatusesInput, type LivenessState, type LocalWorktreeConfig, type LocalWriteFileEntry, type NamedScript, type PeerService, type PlanBranchGcInput, type PlanGcInput, type ProvenanceConfidence, type ProvenanceInfo, ProxyTable, type ReconcileIntegrationInput, type RemoveWorktreeFastOptions, type ResolveGcClassOptions, type ResolveSupervisorInput, type ResolvedGcClass, type ResolvedWorktreeRuntime, RestForgeClient, type RunningProxy, SALVAGE_ROOT, SESSIONS_BUCKETS_ROOT, SESSIONS_FILE_PATH, type SalvageManifest, type SalvageResult, type SalvageWorktreeInput, type ScriptConfig, type ServiceRuntime, type ServiceStatus, ServiceSupervisor, type SessionRef, type SupervisorOptions, type TipClassification, type TreeIndex, type TreeState, UnreachableForgeClient, VERDICT_MEMO_PATH, type VerdictMemoRecord, type VerdictMemoStore, WORKTREES_TURBO_CACHE_DIR_ENV, WORKTREE_TRASH_DIRNAME, type WorktreeAgentInput, type WorktreeClass, type WorktreeEnvContext, type WorktreeMarker, WorktreeNotRemovableError, type WorktreeStatusEntry, allocatePort, applyBranchGc, applyGc, applySlugPlaceholder, branchReviewQueue, branchVerdictSchema, classify, classifyForGc, classifyTip, classifyTipAgainstBase, cloneEntries, computeBaseDivergence, computeLiveness, computeProvenance, computeTreeState, computeWorktreeStatus, connectDaemonAgentSessionHost, createForgeClient, createLadderContext, createProxyServer, detectAnchor, detectDefaultBranch, disposeSupervisor, ephemeralPort, execArgv, execGit, execShell, expandCloneGlob, expandGlob, getScript, getSupervisor, globToRegExp, hookEnv, isMechanicalDepBumpRange, isPortFree, listGitWorktrees, listScripts, listServices, listWorktreeStatuses, loadConfigFromBase, loadLocalWorktreeConfig, makeDaemonAgentSessionHost, normalizeHook, parseConfig, parseGithubOwnerRepo, parseLocalWorktreeConfig, peerEnv, peerEnvKey, planBranchGc, planGc, readBranchGcRestoreLog, readSessionsRegistry, readWorktreeMarker, reclaimOneWorktree, reconcileIntegration, recordBranchVerdict, removeWorktreeFast, repoLabel, resolveGcClass, resolveLocalWriteFiles, resolveSupervisor, resolveWorktreesTurboCacheDir, runSetup, runTeardown, salvageWorktree, serviceEnv, serviceEnvToken, serviceHostname, serviceUrl, sessionInWorktree, sharedProxyTable, slugify, startProxy, stripPort, summarizeBranchGcPlan, sweepWorktreeTrash, worktreeAgentInputSchema, worktreeAgentWorkflow, writeWorktreeMarker };
|
|
2431
|
+
export { type AcquireRequest, type AgentprotoConfig, type ApplyBranchGcOptions, type ApplyGcOptions, BRANCH_GC_SCOPES, BRANCH_GC_STATE_DIR, BRANCH_TRIAGE_VERDICTS, BRANCH_VERDICTS_PATH, type BaseDivergence, type BranchCoverage, type BranchGcApplyOutcome, type BranchGcApplyResult, type BranchGcClass, type BranchGcHoldReason, type BranchGcPlan, type BranchGcPlanEntry, type BranchGcReclaimReason, type BranchGcRestoreEntry, type BranchGcRestoreLog, type BranchGcSummary, type BranchHistory, type BranchPushState, type BranchRef, type BranchRefKind, type BranchReviewCandidate, type BranchReviewQueue, type BranchStatus, type BranchTriageVerdict, type BranchVerdict, BranchVerdictError, type BranchVerdictRecord, type BranchVerdictStore, type BranchVerdictSummary, CONFIG_FILENAME, type Classification, type ClassifyForGcOptions, type ComputeProvenanceOptions, type ComputeTreeStateOptions, type ComputeWorktreeStatusInput, ConfigError, DEFAULT_BRANCH_GC_MIN_AGE_DAYS, DEFAULT_GC_NOISE_PATHS, DEFAULT_PROVISION_CONCURRENCY, DEFAULT_PROVISION_LIMITS, DEFAULT_PROXY_PORT, type DaemonAgentSessionHost, type DaemonClient, ENV_VARS, type ExecOptions, type ExecResult, FileBranchVerdictStore, FileVerdictMemoStore, type ForgeClient, type ForgePullRequestRef, ForgeUnavailableError, type GateState, type GcApplyOutcome, type GcClass, type GcHoldReason, type GcPlanEntry, type GcReclaimReason, GhCliForgeClient, type GitWorktreeRef, GlobTraversalError, HookError, type HookRun, type HostnameParts, type InBaseReclaimReason, InMemoryBranchVerdictStore, InMemoryVerdictMemoStore, type IntegrationState, LOCAL_WORKTREE_CONFIG_REL, type LadderContext, type ListWorktreeStatusesInput, type LivenessState, type LocalWorktreeConfig, type LocalWriteFileEntry, type NamedScript, PROVISION_CONCURRENCY_ENV, type PeerService, type PlanBranchGcInput, type PlanGcInput, type ProvenanceConfidence, type ProvenanceInfo, ProvisionCancelledError, type ProvisionLease, type ProvisionLimits, type ProvisionPhase, type ProvisionProgress, type ProvisionRunContext, ProvisionScheduler, ProxyTable, type ReconcileIntegrationInput, type RemoveWorktreeFastOptions, type ResolveGcClassOptions, type ResolveSupervisorInput, type ResolvedGcClass, type ResolvedWorktreeRuntime, RestForgeClient, type RunningProxy, SALVAGE_ROOT, SESSIONS_BUCKETS_ROOT, SESSIONS_FILE_PATH, type SalvageManifest, type SalvageResult, type SalvageWorktreeInput, type SchedulerOptions, type SchedulerSnapshot, type ScriptConfig, type ServiceRuntime, type ServiceStatus, ServiceSupervisor, type SessionRef, type SupervisorOptions, type TipClassification, type TreeIndex, type TreeState, UnreachableForgeClient, VERDICT_MEMO_PATH, type VerdictMemoRecord, type VerdictMemoStore, WORKTREES_TURBO_CACHE_DIR_ENV, WORKTREE_TRASH_DIRNAME, type WorktreeAgentInput, type WorktreeClass, type WorktreeEnvContext, type WorktreeMarker, WorktreeNotRemovableError, type WorktreeStatusEntry, allocatePort, applyBranchGc, applyGc, applySlugPlaceholder, branchReviewQueue, branchVerdictSchema, classify, classifyForGc, classifyTip, classifyTipAgainstBase, cloneEntries, computeBaseDivergence, computeLiveness, computeProvenance, computeTreeState, computeWorktreeStatus, connectDaemonAgentSessionHost, createForgeClient, createLadderContext, createProxyServer, currentProvisionContext, detectAnchor, detectDefaultBranch, disposeSupervisor, ephemeralPort, execArgv, execGit, execShell, expandCloneGlob, expandGlob, getScript, getSupervisor, globToRegExp, hookEnv, isMechanicalDepBumpRange, isPortFree, listGitWorktrees, listScripts, listServices, listWorktreeStatuses, loadConfigFromBase, loadLocalWorktreeConfig, makeDaemonAgentSessionHost, normalizeHook, parseConfig, parseGithubOwnerRepo, parseLocalWorktreeConfig, parseProvisionLimits, peerEnv, peerEnvKey, planBranchGc, planGc, provisionScheduler, readBranchGcRestoreLog, readSessionsRegistry, readWorktreeMarker, reclaimOneWorktree, reconcileIntegration, recordBranchVerdict, removeWorktreeFast, repoLabel, resolveGcClass, resolveLocalWriteFiles, resolveSupervisor, resolveWorktreesTurboCacheDir, runSetup, runTeardown, runWithProvisionContext, salvageWorktree, serviceEnv, serviceEnvToken, serviceHostname, serviceUrl, sessionInWorktree, sharedProxyTable, slugify, startProxy, stripPort, summarizeBranchGcPlan, sweepWorktreeTrash, worktreeAgentInputSchema, worktreeAgentWorkflow, writeWorktreeMarker };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { connectDaemonAgentSessionHost, makeDaemonAgentSessionHost, worktreeAgentInputSchema, worktreeAgentWorkflow } from './chunk-
|
|
1
|
+
export { connectDaemonAgentSessionHost, makeDaemonAgentSessionHost, worktreeAgentInputSchema, worktreeAgentWorkflow } from './chunk-FC3I5NTS.mjs';
|
|
2
2
|
import './chunk-E3EM24BS.mjs';
|
|
3
|
-
import { computeProvenance, execArgv, classify, computeWorktreeStatus, sweepWorktreeTrash, listGitWorktrees, execGit, worktreeProvider } from './chunk-
|
|
4
|
-
export { CONFIG_FILENAME, ConfigError, DEFAULT_PROXY_PORT, ENV_VARS, FileVerdictMemoStore, GlobTraversalError, HookError, InMemoryVerdictMemoStore, LOCAL_WORKTREE_CONFIG_REL, ProxyTable, SESSIONS_BUCKETS_ROOT, SESSIONS_FILE_PATH, ServiceSupervisor, VERDICT_MEMO_PATH, WORKTREES_TURBO_CACHE_DIR_ENV, WORKTREE_TRASH_DIRNAME, WorktreeNotRemovableError, allocatePort, applySlugPlaceholder, classify, cloneEntries, computeBaseDivergence, computeLiveness, computeProvenance, computeTreeState, computeWorktreeStatus, detectDefaultBranch, disposeSupervisor, ephemeralPort, execArgv, execGit, execShell, expandCloneGlob, expandGlob, getScript, getSupervisor, globToRegExp, hookEnv, isPortFree, listGitWorktrees, listScripts, listServices, listWorktreeStatuses, loadConfigFromBase, loadLocalWorktreeConfig, normalizeHook, parseConfig, parseLocalWorktreeConfig, peerEnv, peerEnvKey, readSessionsRegistry, readWorktreeMarker, reconcileIntegration, removeWorktreeFast, repoLabel, resolveLocalWriteFiles, resolveSupervisor, resolveWorktreesTurboCacheDir, runSetup, runTeardown, serviceEnv, serviceEnvToken, serviceHostname, serviceUrl, sessionInWorktree, sharedProxyTable, slugify, stripPort, sweepWorktreeTrash, worktreeProvider, writeWorktreeMarker } from './chunk-
|
|
3
|
+
import { computeProvenance, execArgv, classify, computeWorktreeStatus, sweepWorktreeTrash, listGitWorktrees, execGit, worktreeProvider } from './chunk-IEW2O3PF.mjs';
|
|
4
|
+
export { CONFIG_FILENAME, ConfigError, DEFAULT_PROVISION_CONCURRENCY, DEFAULT_PROVISION_LIMITS, DEFAULT_PROXY_PORT, ENV_VARS, FileVerdictMemoStore, GlobTraversalError, HookError, InMemoryVerdictMemoStore, LOCAL_WORKTREE_CONFIG_REL, PROVISION_CONCURRENCY_ENV, ProvisionCancelledError, ProvisionScheduler, ProxyTable, SESSIONS_BUCKETS_ROOT, SESSIONS_FILE_PATH, ServiceSupervisor, VERDICT_MEMO_PATH, WORKTREES_TURBO_CACHE_DIR_ENV, WORKTREE_TRASH_DIRNAME, WorktreeNotRemovableError, allocatePort, applySlugPlaceholder, classify, cloneEntries, computeBaseDivergence, computeLiveness, computeProvenance, computeTreeState, computeWorktreeStatus, currentProvisionContext, detectDefaultBranch, disposeSupervisor, ephemeralPort, execArgv, execGit, execShell, expandCloneGlob, expandGlob, getScript, getSupervisor, globToRegExp, hookEnv, isPortFree, listGitWorktrees, listScripts, listServices, listWorktreeStatuses, loadConfigFromBase, loadLocalWorktreeConfig, normalizeHook, parseConfig, parseLocalWorktreeConfig, parseProvisionLimits, peerEnv, peerEnvKey, provisionScheduler, readSessionsRegistry, readWorktreeMarker, reconcileIntegration, removeWorktreeFast, repoLabel, resolveLocalWriteFiles, resolveSupervisor, resolveWorktreesTurboCacheDir, runSetup, runTeardown, runWithProvisionContext, serviceEnv, serviceEnvToken, serviceHostname, serviceUrl, sessionInWorktree, sharedProxyTable, slugify, stripPort, sweepWorktreeTrash, worktreeProvider, writeWorktreeMarker } from './chunk-IEW2O3PF.mjs';
|
|
5
5
|
import { cleanupWorktreeTool } from './chunk-3FZWPMLF.mjs';
|
|
6
6
|
export { cleanupWorktreeTool, listServicesTool, provisionWorktreeTool, runGateTool, runScriptTool, serviceStatusSchema, startServiceTool, stopServiceTool } from './chunk-3FZWPMLF.mjs';
|
|
7
7
|
import { mkdir, copyFile, readFile, writeFile, open, rename, readdir, realpath, rm, stat } from 'fs/promises';
|
package/dist/provider/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentproto/worktree",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "AIP-14 TOOL contracts + builtin AIP-30 PROVIDER for provisioning, gating, and cleaning up a git worktree — the primitive an AgentStep binds its `cwd` to for a launch-agent-in-a-worktree workflow.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentproto",
|
|
@@ -57,19 +57,19 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@modelcontextprotocol/sdk": "^1.30.
|
|
60
|
+
"@modelcontextprotocol/sdk": "^1.30.1",
|
|
61
61
|
"zod": "^4.6.5",
|
|
62
|
-
"@agentproto/driver": "0.
|
|
63
|
-
"@agentproto/harness": "0.4.
|
|
64
|
-
"@agentproto/
|
|
65
|
-
"@agentproto/
|
|
62
|
+
"@agentproto/driver": "0.3.0",
|
|
63
|
+
"@agentproto/harness": "0.4.7",
|
|
64
|
+
"@agentproto/workflow-runtime": "0.16.0",
|
|
65
|
+
"@agentproto/tool": "0.4.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/node": "^25.9.5",
|
|
69
69
|
"tsup": "^8.5.1",
|
|
70
70
|
"typescript": "^5.9.3",
|
|
71
71
|
"vitest": "^3.2.7",
|
|
72
|
-
"@agentproto/routine": "0.3.
|
|
72
|
+
"@agentproto/routine": "0.3.1",
|
|
73
73
|
"@agentproto/tooling": "0.1.0"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|