@kynver-app/runtime 0.1.90 → 0.1.91

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.
Files changed (54) hide show
  1. package/dist/box-resource-snapshot-shared.d.ts +1 -0
  2. package/dist/cleanup-active-worktrees.d.ts +1 -1
  3. package/dist/cleanup-dependency-scan.d.ts +1 -0
  4. package/dist/cleanup-dir-size.d.ts +2 -1
  5. package/dist/cleanup-guards.d.ts +5 -0
  6. package/dist/cleanup-index-status.d.ts +9 -0
  7. package/dist/cleanup-progress.d.ts +2 -0
  8. package/dist/cleanup-retention-config.d.ts +4 -0
  9. package/dist/cleanup-run-liveness.d.ts +6 -2
  10. package/dist/cleanup-run-terminal-cache.d.ts +6 -0
  11. package/dist/cleanup-summary.d.ts +29 -0
  12. package/dist/cleanup-types.d.ts +7 -1
  13. package/dist/cleanup-worktree-index.d.ts +3 -2
  14. package/dist/cli.js +2276 -793
  15. package/dist/cli.js.map +4 -4
  16. package/dist/completion-ack.d.ts +8 -0
  17. package/dist/completion-response.d.ts +1 -1
  18. package/dist/db-credential-env-paths.d.ts +13 -0
  19. package/dist/db-credential-resolver.d.ts +2 -1
  20. package/dist/default-repo-cli.d.ts +20 -0
  21. package/dist/dispatch-claim-release.d.ts +17 -0
  22. package/dist/dispatch-lane-normalization.d.ts +14 -0
  23. package/dist/dispatch.d.ts +4 -1
  24. package/dist/doctor/doctor.types.d.ts +2 -0
  25. package/dist/doctor/runtime-takeover-cli.d.ts +1 -1
  26. package/dist/doctor/runtime-takeover-scheduler.d.ts +3 -1
  27. package/dist/heartbeat-final-result.d.ts +5 -0
  28. package/dist/heartbeat.d.ts +3 -1
  29. package/dist/index.d.ts +7 -1
  30. package/dist/index.js +2634 -971
  31. package/dist/index.js.map +4 -4
  32. package/dist/landing-contract-pr-classify.d.ts +4 -0
  33. package/dist/memory-cost-package-version-guard-enforce.d.ts +10 -0
  34. package/dist/memory-cost-package-version-guard.d.ts +49 -0
  35. package/dist/orchestration-enforcement/config.d.ts +5 -0
  36. package/dist/orchestration-enforcement/evaluator.d.ts +6 -0
  37. package/dist/orchestration-enforcement/idempotency.d.ts +8 -0
  38. package/dist/orchestration-enforcement/index.d.ts +4 -0
  39. package/dist/orchestration-enforcement/types.d.ts +24 -0
  40. package/dist/prompt.d.ts +2 -0
  41. package/dist/repo-search.d.ts +40 -0
  42. package/dist/run-worker-index.d.ts +10 -0
  43. package/dist/runner-identity.d.ts +2 -0
  44. package/dist/shell-command-outcome.d.ts +1 -1
  45. package/dist/status.d.ts +13 -0
  46. package/dist/supervisor.d.ts +3 -1
  47. package/dist/validate.d.ts +10 -0
  48. package/dist/worker-final-result-embed.d.ts +1 -0
  49. package/dist/worker-ops.d.ts +22 -1
  50. package/dist/worker-persona-catalog.d.ts +24 -0
  51. package/dist/worker-persona-catalog.js +138 -0
  52. package/dist/worker-persona-catalog.js.map +7 -0
  53. package/dist/workspace-runtime-config.d.ts +2 -0
  54. package/package.json +1 -1
@@ -1,2 +1,3 @@
1
+ export declare function normalizeWorkerPoolBoxKind(raw: string | null | undefined): "ghost" | "forge";
1
2
  export declare function resolveBoxKindFromEnv(env?: NodeJS.ProcessEnv): string;
2
3
  export declare function defaultBoxId(boxKind: string, hostLabel?: string | null): string;
@@ -5,7 +5,7 @@ export interface ActiveWorktreeGuardSnapshot {
5
5
  liveRunKeys: Set<string>;
6
6
  }
7
7
  /** Collect worktrees/runs that still have live worker processes (current-run guard). */
8
- export declare function collectActiveWorktreeGuards(harnessRoots: string[]): ActiveWorktreeGuardSnapshot;
8
+ export declare function collectActiveWorktreeGuards(harnessRoots: string[], now?: number): ActiveWorktreeGuardSnapshot;
9
9
  /** True when a worktree path still exists under a live run (belt-and-suspenders). */
10
10
  export declare function isWorktreeOnLiveRun(worktreePath: string, harnessRoot: string, runId: string | undefined, liveRunKeys: Set<string>): boolean;
11
11
  export declare function worktreesDirForRoot(harnessRoot: string): string;
@@ -4,6 +4,7 @@ export interface ScanDependencyCacheOptions {
4
4
  harnessRoot: string;
5
5
  worktreesDir: string;
6
6
  nodeModulesAgeMs: number;
7
+ includeOrphans?: boolean;
7
8
  runIdFilter?: string;
8
9
  index: Map<string, IndexedWorktree>;
9
10
  now: number;
@@ -1,4 +1,5 @@
1
1
  /**
2
- * Best-effort directory size. Returns null when entry cap is exceeded (huge trees).
2
+ * Best-effort directory size. Prefers `du -sb` (fast on large `node_modules`);
3
+ * falls back to a capped walk. Returns null when entry cap is exceeded.
3
4
  */
4
5
  export declare function directorySizeBytes(root: string, maxEntries?: number): number | null;
@@ -1,7 +1,11 @@
1
1
  import type { CleanupSkipReason, WorktreeRemovalGuardHook } from "./cleanup-types.js";
2
2
  import type { IndexedWorktree } from "./cleanup-worktree-index.js";
3
+ import type { CleanupRunLivenessContext } from "./cleanup-run-liveness.js";
4
+ import type { GitAncestry } from "./git.js";
3
5
  import type { RawHarnessWorkerStatus } from "./status.js";
4
6
  export { materialWorktreeChanges } from "./cleanup-guards-helpers.js";
7
+ /** True when git ancestry shows the worker branch is fully landed on the run base. */
8
+ export declare function isLandedGitAncestry(ancestry: GitAncestry | null | undefined): boolean;
5
9
  /** Blocks whole-worktree removal when commits are not landed or tree is dirty. */
6
10
  export declare function isPrOrUnmergedWork(status: RawHarnessWorkerStatus): boolean;
7
11
  export interface WorktreeGuardInput {
@@ -19,6 +23,7 @@ export interface WorktreeGuardInput {
19
23
  */
20
24
  orphanSafety?: CleanupSkipReason | null;
21
25
  worktreeRemovalGuard?: WorktreeRemovalGuardHook;
26
+ liveness?: CleanupRunLivenessContext;
22
27
  }
23
28
  export type WorktreeGuardSkip = CleanupSkipReason | {
24
29
  reason: CleanupSkipReason;
@@ -0,0 +1,9 @@
1
+ import { type RawHarnessWorkerStatus } from "./status.js";
2
+ import type { IndexedWorktree } from "./cleanup-worktree-index.js";
3
+ /** Lazily compute worker status — avoids git/stream work for every indexed worker up front. */
4
+ export declare function indexedWorktreeStatus(entry: IndexedWorktree): RawHarnessWorkerStatus;
5
+ /**
6
+ * Porcelain-only dirty probe for dependency-cache guards. Skips ancestry/stream
7
+ * work that whole-worktree removal needs but `node_modules` GC does not.
8
+ */
9
+ export declare function indexedWorktreeHasMaterialChanges(entry: IndexedWorktree): boolean;
@@ -0,0 +1,2 @@
1
+ /** stderr progress lines so broad cleanup scans do not appear hung before JSON output. */
2
+ export declare function emitCleanupProgress(phase: string, detail?: string): void;
@@ -11,6 +11,10 @@ export interface ResolvedHarnessRetention {
11
11
  includeOrphans: boolean;
12
12
  runIdFilter?: string;
13
13
  accountBytes: boolean;
14
+ /** Cap filesystem walk depth per run dir in `harnessStorageSnapshot` (0 = counts only). */
15
+ storagePerRunEntryCap: number | null;
16
+ /** Per-candidate walk cap when `du` is unavailable (default 2k). */
17
+ byteAccountingEntryCap: number;
14
18
  diskPressure?: boolean;
15
19
  diskGate?: DispatchNextDiskGateShape;
16
20
  }
@@ -1,13 +1,17 @@
1
1
  import type { IndexedWorktree } from "./cleanup-worktree-index.js";
2
+ import type { CleanupRunTerminalCache } from "./cleanup-run-terminal-cache.js";
3
+ export interface CleanupRunLivenessContext {
4
+ runTerminalCache: CleanupRunTerminalCache;
5
+ }
2
6
  /** True when the worker process is still live or marked running in worker.json. */
3
7
  export declare function isWorkerProcessLive(indexed: IndexedWorktree): boolean;
4
8
  /**
5
9
  * Run record still marked active but every worker is finished — safe to treat as
6
10
  * terminal for GC after `finalizeStaleRuns()` (or when deriveTerminalRunStatus is set).
7
11
  */
8
- export declare function isRunStaleActive(indexed: IndexedWorktree): boolean;
12
+ export declare function isRunStaleActive(indexed: IndexedWorktree, ctx?: CleanupRunLivenessContext): boolean;
9
13
  /**
10
14
  * Whether the harness run still has unfinished work that should block whole-worktree removal.
11
15
  * Does not block per-worker `node_modules` when only this worker is finished.
12
16
  */
13
- export declare function runBlocksWorktreeRemoval(indexed: IndexedWorktree): boolean;
17
+ export declare function runBlocksWorktreeRemoval(indexed: IndexedWorktree, ctx?: CleanupRunLivenessContext): boolean;
@@ -0,0 +1,6 @@
1
+ import type { HarnessRunRecord } from "./run-store.js";
2
+ /** Per-sweep memo so worktree guards do not re-derive terminal status for every worker in a run. */
3
+ export declare class CleanupRunTerminalCache {
4
+ private readonly cache;
5
+ derive(run: HarnessRunRecord): string | null;
6
+ }
@@ -0,0 +1,29 @@
1
+ import type { CleanupActionKind, HarnessCleanupSummary, HarnessStorageSnapshotShape } from "./cleanup-types.js";
2
+ export interface CleanupCompactSummary {
3
+ harnessRoot: string;
4
+ scanRoots: string[];
5
+ dryRun: boolean;
6
+ execute: boolean;
7
+ scannedAt: string;
8
+ finalizedRuns: number;
9
+ actionCount: number;
10
+ actionKinds: Partial<Record<CleanupActionKind, number>>;
11
+ totals: HarnessCleanupSummary["totals"];
12
+ storage?: HarnessStorageSnapshotShape;
13
+ preservedLivePaths?: HarnessCleanupSummary["preservedLivePaths"];
14
+ removedRunDirectories?: number;
15
+ sampleActions: Array<{
16
+ kind: CleanupActionKind;
17
+ path: string;
18
+ skipReason?: string;
19
+ bytes?: number | null;
20
+ runId?: string;
21
+ worker?: string;
22
+ }>;
23
+ sampleSkips: HarnessCleanupSummary["skips"];
24
+ }
25
+ /** Operator-facing rollup — bounded samples, no per-path megabyte JSON dumps. */
26
+ export declare function buildCleanupCompactSummary(summary: HarnessCleanupSummary, options?: {
27
+ maxSampleActions?: number;
28
+ maxSampleSkips?: number;
29
+ }): CleanupCompactSummary;
@@ -77,6 +77,8 @@ export interface HarnessCleanupSummary {
77
77
  }>;
78
78
  /** Empty harness worktree run directories removed after worker worktrees were reclaimed. */
79
79
  removedRunDirectories?: number;
80
+ /** Bounded operator rollup (always attached; use `kynver cleanup --compact` to emit alone). */
81
+ compactSummary?: import("./cleanup-summary.js").CleanupCompactSummary;
80
82
  }
81
83
  export interface WorktreeRemovalGuardInput {
82
84
  worktreePath: string;
@@ -96,8 +98,12 @@ export interface HarnessCleanupOptions {
96
98
  execute?: boolean;
97
99
  /** When true (default), call `finalizeStaleRuns()` before scanning. */
98
100
  finalizeStaleRuns?: boolean;
99
- /** When true (default), estimate candidate bytes in dry-run summaries. */
101
+ /** When true, estimate candidate bytes for guard-passing removals only. CLI defaults false. */
100
102
  accountBytes?: boolean;
103
+ /** Per-run entry cap for storage snapshot byte totals (`0` = counts only). */
104
+ storagePerRunEntryCap?: number | null;
105
+ /** Per-candidate filesystem walk cap when `du` is unavailable. */
106
+ byteAccountingEntryCap?: number;
101
107
  /** Minimum age before removing generated `node_modules` (default 6h). */
102
108
  nodeModulesAgeMs?: number;
103
109
  /** When 0 or unset, worktree removal is disabled. */
@@ -1,5 +1,5 @@
1
1
  import { type HarnessRunRecord } from "./run-store.js";
2
- import { type HarnessWorkerRecord, type RawHarnessWorkerStatus } from "./status.js";
2
+ import type { HarnessWorkerRecord, RawHarnessWorkerStatus } from "./status.js";
3
3
  export interface IndexedWorktree {
4
4
  harnessRoot?: string;
5
5
  worktreePath: string;
@@ -7,7 +7,8 @@ export interface IndexedWorktree {
7
7
  workerName: string;
8
8
  run: HarnessRunRecord;
9
9
  worker: HarnessWorkerRecord;
10
- status: RawHarnessWorkerStatus;
10
+ /** Populated lazily via `indexedWorktreeStatus()` during guard evaluation. */
11
+ status?: RawHarnessWorkerStatus;
11
12
  }
12
13
  export declare function buildWorktreeIndex(): Map<string, IndexedWorktree>;
13
14
  export declare function buildWorktreeIndexAt(harnessRoot: string): Map<string, IndexedWorktree>;