@kynver-app/runtime 0.1.62 → 0.1.69
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 +4 -3
- package/dist/box-resource-snapshot-shared.d.ts +2 -0
- package/dist/box-resource-snapshot.d.ts +45 -0
- package/dist/cleanup-active-worktrees.d.ts +14 -0
- package/dist/cleanup-build-cache-paths.d.ts +5 -0
- package/dist/cleanup-dependency-scan.d.ts +12 -0
- package/dist/cleanup-disk-pressure.d.ts +15 -0
- package/dist/cleanup-duplicate-worktrees.d.ts +7 -0
- package/dist/cleanup-execute.d.ts +4 -0
- package/dist/cleanup-guards-helpers.d.ts +1 -1
- package/dist/cleanup-guards.d.ts +13 -0
- package/dist/cleanup-harness-roots.d.ts +6 -0
- package/dist/cleanup-retention-config.d.ts +3 -0
- package/dist/cleanup-scan.d.ts +1 -0
- package/dist/cleanup-types.d.ts +12 -1
- package/dist/cleanup-worktree-index.d.ts +2 -0
- package/dist/cli.js +1639 -558
- package/dist/cli.js.map +4 -4
- package/dist/harness-notice/harness-notice.auto-complete.d.ts +3 -0
- package/dist/harness-notice/harness-notice.monitor-tick.d.ts +6 -0
- package/dist/harness-notice/harness-notice.parse.d.ts +3 -0
- package/dist/harness-notice/harness-notice.tool-response.d.ts +3 -0
- package/dist/harness-notice/harness-notice.types.d.ts +17 -0
- package/dist/harness-notice/harness-notice.worker-complete.d.ts +3 -0
- package/dist/harness-notice/harness-notice.worker-status.d.ts +2 -0
- package/dist/harness-notice/index.d.ts +7 -0
- package/dist/harness-repair-target.d.ts +23 -0
- package/dist/heartbeat.d.ts +3 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +2079 -700
- package/dist/index.js.map +4 -4
- package/dist/landing-contract-gate.d.ts +3 -1
- package/dist/model-routing.d.ts +2 -0
- package/dist/pr-handoff/pr-handoff-assess.d.ts +2 -0
- package/dist/pr-handoff/pr-handoff.types.d.ts +1 -1
- package/dist/prompt.d.ts +2 -0
- package/dist/repair-target-worktree.d.ts +4 -0
- package/dist/resource-gate.d.ts +5 -0
- package/dist/run-list.d.ts +38 -0
- package/dist/run-store.d.ts +2 -0
- package/dist/runner-identity.d.ts +12 -0
- package/dist/scheduler-cutover-cli.d.ts +2 -0
- package/dist/scheduler-cutover.d.ts +22 -0
- package/dist/status.d.ts +3 -0
- package/dist/supervisor.d.ts +2 -0
- package/dist/vercel/index.d.ts +1 -1
- package/dist/vercel/vercel-url.d.ts +2 -0
- package/dist/worker-provider-policy.d.ts +26 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,10 +41,11 @@ Set once in `kynver setup --provider claude|cursor` (stored in `~/.kynver/config
|
|
|
41
41
|
|
|
42
42
|
| Provider | CLI | Auth |
|
|
43
43
|
| --- | --- | --- |
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
44
|
+
| `cursor` (default) | `agent` on PATH ([Cursor Agent CLI](https://cursor.com/docs/cli/headless)) | `agent login` (OAuth) **or** `CURSOR_API_KEY` for headless runners. |
|
|
45
|
+
| `codex` (BYO OAuth, low-cost orchestration) | `codex` on PATH ([Codex CLI](https://developers.openai.com/codex/)) | `codex login` (OAuth) **or** `CODEX_API_KEY` for headless runners. Kynver never stores raw OAuth tokens — binding is local-only with fingerprint audit. Low-risk orchestration routes here when bound; privileged actions escalate to Cursor. |
|
|
46
|
+
| `claude` (operator override) | `claude` on PATH | `claude login` (OAuth). Use `--provider claude` on dispatch/worker start, or set `executorRef: provider:claude` / `[worker-provider: claude]` on the board task. Legacy `workerProvider: "claude"` in config is normalized to Cursor at dispatch. |
|
|
46
47
|
|
|
47
|
-
Override per invocation: `kynver worker start ... --provider
|
|
48
|
+
Override per invocation: `kynver worker start ... --provider claude` (requires operator intent; default dispatches stay on Cursor)
|
|
48
49
|
|
|
49
50
|
Install Cursor CLI (Windows PowerShell): `irm 'https://cursor.com/install?win32=true' | iex`
|
|
50
51
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { RunnerResourceGateShape } from "./resource-gate.js";
|
|
2
|
+
export interface RuntimeBoxResourceSnapshot {
|
|
3
|
+
boxId: string;
|
|
4
|
+
boxKind: string;
|
|
5
|
+
displayName?: string | null;
|
|
6
|
+
hostLabel?: string | null;
|
|
7
|
+
observedAt: string;
|
|
8
|
+
totalMemBytes: number;
|
|
9
|
+
freeMemBytes: number;
|
|
10
|
+
activeWorkers: number;
|
|
11
|
+
maxConcurrentWorkers: number;
|
|
12
|
+
autoCap: number;
|
|
13
|
+
slotsAvailable: number;
|
|
14
|
+
harnessRunId?: string | null;
|
|
15
|
+
queuedTasks?: number | null;
|
|
16
|
+
reason?: string | null;
|
|
17
|
+
prEvidence?: RuntimeBoxResourceSnapshotPrEvidence[];
|
|
18
|
+
}
|
|
19
|
+
export interface RuntimeBoxResourceSnapshotPrEvidence {
|
|
20
|
+
prUrl: string;
|
|
21
|
+
headSha?: string | null;
|
|
22
|
+
mergeable?: string | null;
|
|
23
|
+
observedAt: string;
|
|
24
|
+
source: "heartbeat" | "operator_tick" | "completion" | "handoff";
|
|
25
|
+
}
|
|
26
|
+
export declare function buildBoxResourceSnapshotFromGate(gate: RunnerResourceGateShape, input?: {
|
|
27
|
+
boxKind?: string | null;
|
|
28
|
+
boxId?: string | null;
|
|
29
|
+
displayName?: string | null;
|
|
30
|
+
hostLabel?: string | null;
|
|
31
|
+
harnessRunId?: string | null;
|
|
32
|
+
queuedTasks?: number | null;
|
|
33
|
+
prEvidence?: RuntimeBoxResourceSnapshotPrEvidence[];
|
|
34
|
+
observedAt?: string;
|
|
35
|
+
}): RuntimeBoxResourceSnapshot;
|
|
36
|
+
export interface HeartbeatLineInput {
|
|
37
|
+
ts?: string;
|
|
38
|
+
phase: string;
|
|
39
|
+
summary: string;
|
|
40
|
+
changedFiles?: string[];
|
|
41
|
+
blocker?: string | null;
|
|
42
|
+
boxResourceSnapshot?: RuntimeBoxResourceSnapshot;
|
|
43
|
+
prEvidence?: RuntimeBoxResourceSnapshotPrEvidence[];
|
|
44
|
+
}
|
|
45
|
+
export declare function formatHeartbeatLine(input: HeartbeatLineInput): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ActiveWorktreeGuardSnapshot {
|
|
2
|
+
/** Resolved worktree paths that must keep dependency caches. */
|
|
3
|
+
activeWorktreePaths: Set<string>;
|
|
4
|
+
/** `${harnessRoot}\0${runId}` keys for runs with at least one live worker. */
|
|
5
|
+
liveRunKeys: Set<string>;
|
|
6
|
+
}
|
|
7
|
+
/** Collect worktrees/runs that still have live worker processes (current-run guard). */
|
|
8
|
+
export declare function collectActiveWorktreeGuards(harnessRoots: string[]): ActiveWorktreeGuardSnapshot;
|
|
9
|
+
/** True when a worktree path still exists under a live run (belt-and-suspenders). */
|
|
10
|
+
export declare function isWorktreeOnLiveRun(worktreePath: string, harnessRoot: string, runId: string | undefined, liveRunKeys: Set<string>): boolean;
|
|
11
|
+
export declare function worktreesDirForRoot(harnessRoot: string): string;
|
|
12
|
+
export declare function runsDirForRoot(harnessRoot: string): string;
|
|
13
|
+
export declare function harnessRootExists(harnessRoot: string): boolean;
|
|
14
|
+
export declare function listWorktreeRunIds(worktreesDir: string): string[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Generated install/build trees safe to delete under a harness worktree. */
|
|
2
|
+
export declare const HARNESS_BUILD_CACHE_RELATIVE_PATHS: readonly [".next", ".turbo", "dist", "build", ".cache", "node_modules/.cache"];
|
|
3
|
+
export type HarnessBuildCacheRelativePath = (typeof HARNESS_BUILD_CACHE_RELATIVE_PATHS)[number];
|
|
4
|
+
/** True when a porcelain path is only generated build/install noise. */
|
|
5
|
+
export declare function isGeneratedHarnessPath(pathPart: string): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CleanupCandidate } from "./cleanup-types.js";
|
|
2
|
+
import type { IndexedWorktree } from "./cleanup-worktree-index.js";
|
|
3
|
+
export interface ScanDependencyCacheOptions {
|
|
4
|
+
harnessRoot: string;
|
|
5
|
+
worktreesDir: string;
|
|
6
|
+
nodeModulesAgeMs: number;
|
|
7
|
+
runIdFilter?: string;
|
|
8
|
+
index: Map<string, IndexedWorktree>;
|
|
9
|
+
now: number;
|
|
10
|
+
}
|
|
11
|
+
/** Scan indexed + on-disk worktrees for generated dependency caches. */
|
|
12
|
+
export declare function scanDependencyCacheCandidates(opts: ScanDependencyCacheOptions): CleanupCandidate[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DispatchNextDiskGateShape } from "./callbacks.js";
|
|
2
|
+
import { type ObserveDiskGateInput } from "./disk-gate.js";
|
|
3
|
+
import type { ResolvedHarnessRetention } from "./cleanup-retention-config.js";
|
|
4
|
+
export interface CleanupDiskPressureShape {
|
|
5
|
+
diskGate: DispatchNextDiskGateShape;
|
|
6
|
+
/** Root filesystem (or override) is at/above the guard threshold. */
|
|
7
|
+
pressured: boolean;
|
|
8
|
+
maxUsedPercent: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function observeCleanupDiskPressure(input?: ObserveDiskGateInput): CleanupDiskPressureShape;
|
|
11
|
+
/**
|
|
12
|
+
* Under disk pressure, reclaim generated dependency caches aggressively while
|
|
13
|
+
* keeping source worktrees and stricter worktree deletion rules unchanged.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyDiskPressureToRetention(retention: ResolvedHarnessRetention, pressure: CleanupDiskPressureShape): ResolvedHarnessRetention;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CleanupCandidate } from "./cleanup-types.js";
|
|
2
|
+
import type { ScanHarnessOptions } from "./cleanup-scan.js";
|
|
3
|
+
/**
|
|
4
|
+
* Secondary git worktrees under the harness layout that are clean but not indexed
|
|
5
|
+
* (aborted duplicate attempts). Uses `git worktree remove` during execute.
|
|
6
|
+
*/
|
|
7
|
+
export declare function scanDuplicateWorktreeCandidates(opts: ScanHarnessOptions): CleanupCandidate[];
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { CleanupAction, CleanupCandidate, CleanupSkipReason } from "./cleanup-types.js";
|
|
2
2
|
export declare function removeNodeModules(candidate: CleanupCandidate, execute: boolean): CleanupAction;
|
|
3
|
+
export declare function removeNextCache(candidate: CleanupCandidate, execute: boolean): CleanupAction;
|
|
4
|
+
export declare function removeBuildCache(candidate: CleanupCandidate, execute: boolean): CleanupAction;
|
|
3
5
|
export declare function removeWorktree(candidate: CleanupCandidate, execute: boolean): CleanupAction;
|
|
4
6
|
export declare function isHarnessNodeModulesPath(targetPath: string, harnessRoot: string, worktreesDir: string): CleanupSkipReason | null;
|
|
7
|
+
export declare function isHarnessNextCachePath(targetPath: string, harnessRoot: string, worktreesDir: string): CleanupSkipReason | null;
|
|
8
|
+
export declare function isHarnessBuildCachePath(targetPath: string, harnessRoot: string, worktreesDir: string): CleanupSkipReason | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** Strip generated install trees from porcelain — they are what cleanup removes. */
|
|
1
|
+
/** Strip generated install/build trees from porcelain — they are what cleanup removes. */
|
|
2
2
|
export declare function materialWorktreeChanges(changedFiles: string[]): string[];
|
package/dist/cleanup-guards.d.ts
CHANGED
|
@@ -29,4 +29,17 @@ export interface NodeModulesGuardInput {
|
|
|
29
29
|
nodeModulesAgeMs: number;
|
|
30
30
|
ageMs: number;
|
|
31
31
|
}
|
|
32
|
+
export interface DependencyCacheGuardInput extends NodeModulesGuardInput {
|
|
33
|
+
worktreePath: string;
|
|
34
|
+
activeWorktreePaths: Set<string>;
|
|
35
|
+
diskPressure?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Dependency caches (`node_modules`, `.next`) are safe to drop when the worker
|
|
39
|
+
* process is dead and source files remain — even if the board still shows
|
|
40
|
+
* completion/landing/PR blockers. Whole-worktree removal stays strict.
|
|
41
|
+
*/
|
|
42
|
+
export declare function skipDependencyCacheRemoval(input: DependencyCacheGuardInput): CleanupSkipReason | null;
|
|
43
|
+
/** Build caches (`.turbo`, `dist`, etc.) use the same relaxed guards as dependency caches. */
|
|
44
|
+
export declare function skipBuildCacheRemoval(input: DependencyCacheGuardInput): CleanupSkipReason | null;
|
|
32
45
|
export declare function skipNodeModulesRemoval(input: NodeModulesGuardInput): CleanupSkipReason | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Operator-known harness trees that accumulate stale dependency caches. */
|
|
2
|
+
export declare const WELL_KNOWN_HARNESS_SCAN_ROOTS: readonly ["/var/tmp/kynver-harness", string];
|
|
3
|
+
export declare function resolveHarnessScanRoots(options?: {
|
|
4
|
+
harnessRoot?: string;
|
|
5
|
+
scanWellKnown?: boolean;
|
|
6
|
+
}): string[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatchNextDiskGateShape } from "./callbacks.js";
|
|
1
2
|
import { type HarnessCleanupOptions } from "./cleanup-types.js";
|
|
2
3
|
export interface ResolvedHarnessRetention {
|
|
3
4
|
execute: boolean;
|
|
@@ -7,6 +8,8 @@ export interface ResolvedHarnessRetention {
|
|
|
7
8
|
includeOrphans: boolean;
|
|
8
9
|
runIdFilter?: string;
|
|
9
10
|
accountBytes: boolean;
|
|
11
|
+
diskPressure?: boolean;
|
|
12
|
+
diskGate?: DispatchNextDiskGateShape;
|
|
10
13
|
}
|
|
11
14
|
/** Merge CLI options with operator env defaults (pipeline + `kynver cleanup`). */
|
|
12
15
|
export declare function resolveHarnessRetention(options?: HarnessCleanupOptions): ResolvedHarnessRetention;
|
package/dist/cleanup-scan.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export interface ScanHarnessOptions {
|
|
|
11
11
|
now: number;
|
|
12
12
|
}
|
|
13
13
|
export declare function scanNodeModulesCandidates(opts: ScanHarnessOptions): CleanupCandidate[];
|
|
14
|
+
export declare function scanBuildCacheCandidates(opts: ScanHarnessOptions): CleanupCandidate[];
|
|
14
15
|
export declare function scanWorktreeCandidates(opts: ScanHarnessOptions): CleanupCandidate[];
|
package/dist/cleanup-types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CleanupActionKind = "remove_node_modules" | "remove_worktree";
|
|
1
|
+
export type CleanupActionKind = "remove_node_modules" | "remove_next_cache" | "remove_build_cache" | "remove_worktree";
|
|
2
2
|
export type CleanupSkipReason = "dry_run" | "below_age_threshold" | "active_worker" | "dirty_worktree" | "landing_blocked" | "pr_or_unmerged_commits" | "completion_blocked" | "run_still_active" | "path_outside_harness" | "worktrees_disabled" | "orphan_without_flag" | "missing_worktree" | "remove_failed"
|
|
3
3
|
/** AgentOS / operator lifecycle overlay blocked removal (see `detail`). */
|
|
4
4
|
| "board_lifecycle_blocked";
|
|
@@ -6,6 +6,7 @@ export interface CleanupCandidate {
|
|
|
6
6
|
kind: CleanupActionKind;
|
|
7
7
|
path: string;
|
|
8
8
|
bytes: number | null;
|
|
9
|
+
harnessRoot?: string;
|
|
9
10
|
runId?: string;
|
|
10
11
|
worker?: string;
|
|
11
12
|
repo?: string;
|
|
@@ -33,11 +34,21 @@ export interface HarnessStorageSnapshotShape {
|
|
|
33
34
|
}
|
|
34
35
|
export interface HarnessCleanupSummary {
|
|
35
36
|
harnessRoot: string;
|
|
37
|
+
/** Every harness tree scanned (primary + well-known extras). */
|
|
38
|
+
scanRoots: string[];
|
|
36
39
|
dryRun: boolean;
|
|
37
40
|
execute: boolean;
|
|
38
41
|
nodeModulesAgeMs: number;
|
|
39
42
|
worktreesAgeMs: number;
|
|
40
43
|
includeOrphans: boolean;
|
|
44
|
+
diskPressure?: boolean;
|
|
45
|
+
diskGate?: {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
path: string;
|
|
48
|
+
freeBytes: number;
|
|
49
|
+
usedPercent: number;
|
|
50
|
+
reason: string | null;
|
|
51
|
+
};
|
|
41
52
|
scannedAt: string;
|
|
42
53
|
finalizedRuns: RunFinalizeSummary[];
|
|
43
54
|
actions: CleanupAction[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type HarnessRunRecord } from "./run-store.js";
|
|
2
2
|
import { type HarnessWorkerRecord, type RawHarnessWorkerStatus } from "./status.js";
|
|
3
3
|
export interface IndexedWorktree {
|
|
4
|
+
harnessRoot?: string;
|
|
4
5
|
worktreePath: string;
|
|
5
6
|
runId: string;
|
|
6
7
|
workerName: string;
|
|
@@ -9,5 +10,6 @@ export interface IndexedWorktree {
|
|
|
9
10
|
status: RawHarnessWorkerStatus;
|
|
10
11
|
}
|
|
11
12
|
export declare function buildWorktreeIndex(): Map<string, IndexedWorktree>;
|
|
13
|
+
export declare function buildWorktreeIndexAt(harnessRoot: string): Map<string, IndexedWorktree>;
|
|
12
14
|
/** Load worker when index miss but path is known from disk layout. */
|
|
13
15
|
export declare function loadIndexedWorker(runId: string, workerName: string): HarnessWorkerRecord | null;
|