@kynver-app/runtime 0.1.106 → 0.1.112

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.
@@ -0,0 +1,5 @@
1
+ /** Per-sweep memo for cheap ahead-of-main probes during worktree guard passes. */
2
+ export declare class CleanupGitRevCache {
3
+ private readonly aheadOfMain;
4
+ countAheadOfMain(worktreePath: string, base?: string): number | null;
5
+ }
@@ -0,0 +1,5 @@
1
+ /** Per-sweep memo so dependency-cache guards do not re-run git per cache dir. */
2
+ export declare class CleanupGitStatusCache {
3
+ private readonly cache;
4
+ porcelain(worktreePath: string): string[];
5
+ }
@@ -1,3 +1,4 @@
1
+ import type { CleanupGitStatusCache } from "./cleanup-git-status-cache.js";
1
2
  import type { CleanupSkipReason, WorktreeRemovalGuardHook } from "./cleanup-types.js";
2
3
  import type { IndexedWorktree } from "./cleanup-worktree-index.js";
3
4
  import type { CleanupRunLivenessContext } from "./cleanup-run-liveness.js";
@@ -35,6 +36,7 @@ export interface DependencyCacheGuardInput extends NodeModulesGuardInput {
35
36
  worktreePath: string;
36
37
  activeWorktreePaths: Set<string>;
37
38
  diskPressure?: boolean;
39
+ gitStatusCache?: CleanupGitStatusCache;
38
40
  }
39
41
  /**
40
42
  * Dependency caches (`node_modules`, `.next`) are safe to drop when the worker
@@ -1,4 +1,6 @@
1
1
  import { type RawHarnessWorkerStatus } from "./status.js";
2
+ import type { CleanupGitStatusCache } from "./cleanup-git-status-cache.js";
3
+ import type { CleanupRunLivenessContext } from "./cleanup-run-liveness.js";
2
4
  import type { IndexedWorktree } from "./cleanup-worktree-index.js";
3
5
  /** Lazily compute worker status — avoids git/stream work for every indexed worker up front. */
4
6
  export declare function indexedWorktreeStatus(entry: IndexedWorktree): RawHarnessWorkerStatus;
@@ -6,4 +8,9 @@ export declare function indexedWorktreeStatus(entry: IndexedWorktree): RawHarnes
6
8
  * Porcelain-only dirty probe for dependency-cache guards. Skips ancestry/stream
7
9
  * work that whole-worktree removal needs but `node_modules` GC does not.
8
10
  */
9
- export declare function indexedWorktreeHasMaterialChanges(entry: IndexedWorktree): boolean;
11
+ export declare function indexedWorktreeHasMaterialChanges(entry: IndexedWorktree, gitStatusCache?: CleanupGitStatusCache): boolean;
12
+ /**
13
+ * Guard-oriented status: avoids stdout/heartbeat stream parsing for terminal workers
14
+ * while preserving salvage semantics (dirty / PR / landing checks).
15
+ */
16
+ export declare function resolveWorktreeGuardStatus(entry: IndexedWorktree, ctx?: CleanupRunLivenessContext): RawHarnessWorkerStatus;
@@ -1,9 +1,16 @@
1
1
  import type { IndexedWorktree } from "./cleanup-worktree-index.js";
2
+ import type { CleanupGitRevCache } from "./cleanup-git-rev-cache.js";
3
+ import type { CleanupGitStatusCache } from "./cleanup-git-status-cache.js";
2
4
  import type { CleanupRunTerminalCache } from "./cleanup-run-terminal-cache.js";
3
5
  export interface CleanupRunLivenessContext {
4
6
  runTerminalCache: CleanupRunTerminalCache;
7
+ gitStatusCache: CleanupGitStatusCache;
8
+ gitRevCache: CleanupGitRevCache;
5
9
  }
6
- /** True when the worker process is still live or marked running in worker.json. */
10
+ /**
11
+ * True when the worker process is still live. Broad cleanup scans use worker.json
12
+ * terminal hints before falling back to full `computeWorkerStatus` (expensive).
13
+ */
7
14
  export declare function isWorkerProcessLive(indexed: IndexedWorktree): boolean;
8
15
  /**
9
16
  * Run record still marked active but every worker is finished — safe to treat as