@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.
Files changed (49) hide show
  1. package/README.md +4 -3
  2. package/dist/box-resource-snapshot-shared.d.ts +2 -0
  3. package/dist/box-resource-snapshot.d.ts +45 -0
  4. package/dist/cleanup-active-worktrees.d.ts +14 -0
  5. package/dist/cleanup-build-cache-paths.d.ts +5 -0
  6. package/dist/cleanup-dependency-scan.d.ts +12 -0
  7. package/dist/cleanup-disk-pressure.d.ts +15 -0
  8. package/dist/cleanup-duplicate-worktrees.d.ts +7 -0
  9. package/dist/cleanup-execute.d.ts +4 -0
  10. package/dist/cleanup-guards-helpers.d.ts +1 -1
  11. package/dist/cleanup-guards.d.ts +13 -0
  12. package/dist/cleanup-harness-roots.d.ts +6 -0
  13. package/dist/cleanup-retention-config.d.ts +3 -0
  14. package/dist/cleanup-scan.d.ts +1 -0
  15. package/dist/cleanup-types.d.ts +12 -1
  16. package/dist/cleanup-worktree-index.d.ts +2 -0
  17. package/dist/cli.js +1639 -558
  18. package/dist/cli.js.map +4 -4
  19. package/dist/harness-notice/harness-notice.auto-complete.d.ts +3 -0
  20. package/dist/harness-notice/harness-notice.monitor-tick.d.ts +6 -0
  21. package/dist/harness-notice/harness-notice.parse.d.ts +3 -0
  22. package/dist/harness-notice/harness-notice.tool-response.d.ts +3 -0
  23. package/dist/harness-notice/harness-notice.types.d.ts +17 -0
  24. package/dist/harness-notice/harness-notice.worker-complete.d.ts +3 -0
  25. package/dist/harness-notice/harness-notice.worker-status.d.ts +2 -0
  26. package/dist/harness-notice/index.d.ts +7 -0
  27. package/dist/harness-repair-target.d.ts +23 -0
  28. package/dist/heartbeat.d.ts +3 -0
  29. package/dist/index.d.ts +9 -2
  30. package/dist/index.js +2079 -700
  31. package/dist/index.js.map +4 -4
  32. package/dist/landing-contract-gate.d.ts +3 -1
  33. package/dist/model-routing.d.ts +2 -0
  34. package/dist/pr-handoff/pr-handoff-assess.d.ts +2 -0
  35. package/dist/pr-handoff/pr-handoff.types.d.ts +1 -1
  36. package/dist/prompt.d.ts +2 -0
  37. package/dist/repair-target-worktree.d.ts +4 -0
  38. package/dist/resource-gate.d.ts +5 -0
  39. package/dist/run-list.d.ts +38 -0
  40. package/dist/run-store.d.ts +2 -0
  41. package/dist/runner-identity.d.ts +12 -0
  42. package/dist/scheduler-cutover-cli.d.ts +2 -0
  43. package/dist/scheduler-cutover.d.ts +22 -0
  44. package/dist/status.d.ts +3 -0
  45. package/dist/supervisor.d.ts +2 -0
  46. package/dist/vercel/index.d.ts +1 -1
  47. package/dist/vercel/vercel-url.d.ts +2 -0
  48. package/dist/worker-provider-policy.d.ts +26 -0
  49. package/package.json +1 -1
@@ -9,8 +9,10 @@ export interface TargetPrReconciliation {
9
9
  export interface WorkerLandingContract {
10
10
  landingOnly: boolean;
11
11
  targetPrUrls: string[];
12
+ targetPrUrl?: string | null;
13
+ repairEnforceOriginalPr?: boolean;
12
14
  }
13
- export type WorkerLandingContractBlockReason = "unrelated_implementation_pr" | "missing_target_pr_reconciliation" | "incomplete_target_pr_landing";
15
+ export type WorkerLandingContractBlockReason = "unrelated_implementation_pr" | "missing_target_pr_reconciliation" | "incomplete_target_pr_landing" | "duplicate_repair_pr" | "missing_repair_target_reconciliation";
14
16
  export interface WorkerLandingContractVerdict {
15
17
  blocked: boolean;
16
18
  reason?: WorkerLandingContractBlockReason;
@@ -23,6 +23,8 @@ export declare function inferModelRoutingFromTask(task: Record<string, unknown>)
23
23
  export declare function resolveWorkerLaunch(input: {
24
24
  explicitModel?: string;
25
25
  explicitProvider?: string;
26
+ /** When true, `--provider claude` is honored without a task-level override. */
27
+ explicitProviderIsOperatorOverride?: boolean;
26
28
  task?: Record<string, unknown>;
27
29
  }): ModelRoutingDecision;
28
30
  /** Fallback chain tail after provider start — never hard-code Opus here. */
@@ -29,6 +29,8 @@ export declare function assessPrHandoffRequirement(input: {
29
29
  parentTaskId?: string | null;
30
30
  /** Target PR on the board task row (review workers inherit parent prUrl). */
31
31
  taskPrUrl?: string | null;
32
+ /** Repair worker canonical target — never auto-open a new PR. */
33
+ repairTargetPrUrl?: string | null;
32
34
  }): PrHandoffRequirement;
33
35
  export declare function buildPrHandoffSnapshotFromStatus(status: {
34
36
  changedFiles: string[];
@@ -11,7 +11,7 @@ export interface PrHandoffSnapshot {
11
11
  gitAncestry: GitAncestry;
12
12
  finalResult: unknown;
13
13
  }
14
- export type PrHandoffSkipReason = "not_dispatched" | "review_lane" | "expert_review_task" | "review_artifact" | "no_remote_branch_delta" | "already_has_pr" | "no_work_product" | "patch_or_bundle";
14
+ export type PrHandoffSkipReason = "not_dispatched" | "review_lane" | "expert_review_task" | "review_artifact" | "no_remote_branch_delta" | "already_has_pr" | "no_work_product" | "patch_or_bundle" | "repair_target_pr";
15
15
  export interface PrHandoffNotRequired {
16
16
  required: false;
17
17
  reason: PrHandoffSkipReason;
package/dist/prompt.d.ts CHANGED
@@ -11,4 +11,6 @@ export declare function buildPrompt(input: {
11
11
  personaMarkdown?: string | null;
12
12
  /** When set, Haiku/compact models get a shorter harness instruction block. */
13
13
  model?: string;
14
+ repairTargetPrUrl?: string;
15
+ repairTargetBranch?: string;
14
16
  }): string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Add a worktree checked out at an existing remote branch (repair-target checkout).
3
+ */
4
+ export declare function addWorktreeForRepairBranch(repo: string, worktreePath: string, branch: string): void;
@@ -1,4 +1,5 @@
1
1
  import { type KynverUserConfig } from "./config.js";
2
+ import type { DispatchNextDiskGateShape } from "./callbacks.js";
2
3
  /** Default RAM budget per worker (~500 MiB, dogfood measured). Internal — not a setup knob. */
3
4
  export declare const DEFAULT_PER_WORKER_MEM_BYTES: number;
4
5
  /** Keep headroom for OS / IDE. Internal — not a setup knob. */
@@ -20,6 +21,8 @@ export interface RunnerResourceGateShape {
20
21
  activeWorkers: number;
21
22
  slotsAvailable: number;
22
23
  reason: string | null;
24
+ /** Present unless `KYNVER_RESOURCE_GATE_SKIP_DISK=1`. */
25
+ diskGate?: DispatchNextDiskGateShape;
23
26
  }
24
27
  export interface ObserveResourceGateInput {
25
28
  runId: string;
@@ -30,6 +33,8 @@ export interface ObserveResourceGateInput {
30
33
  activeWorkers?: number;
31
34
  totalMemBytes?: number;
32
35
  freeMemBytes?: number;
36
+ diskPath?: string;
37
+ skipDiskGate?: boolean;
33
38
  }
34
39
  /** How many workers this host could run from RAM alone (before a user cap). */
35
40
  export declare function computeAutoMaxWorkers(totalMemBytes: number, opts?: {
@@ -0,0 +1,38 @@
1
+ export interface RunListWorkerEvidence {
2
+ worker: string;
3
+ workerStatus: string;
4
+ attention: string;
5
+ attentionReason?: string;
6
+ missingHeartbeat: boolean;
7
+ missingFinalResult: boolean;
8
+ landingBlocked: boolean;
9
+ completionBlocked: boolean;
10
+ }
11
+ export type RunListFinalizeBlockedReason = "landing_blocked" | "completion_blocked" | "active_workers" | null;
12
+ export interface RunListRow {
13
+ id: string;
14
+ name: string;
15
+ /** Persisted `run.json` status (updated by `finalizeStaleRuns` after reconcile). */
16
+ status: string;
17
+ /** Derived from worker attention/status — aligns with operator board semantics. */
18
+ effectiveStatus: string;
19
+ repo: string;
20
+ createdAt: string;
21
+ /** Workers still alive without a terminal result. */
22
+ openWorkerCount: number;
23
+ /** Highest-severity attention across workers (matches board rollup semantics). */
24
+ attention: "ok" | "done" | "stale" | "needs_attention" | "blocked";
25
+ attentionReason?: string;
26
+ /** Why `finalizeStaleRuns` may keep `status` active while workers are dead. */
27
+ finalizeBlockedReason: RunListFinalizeBlockedReason;
28
+ evidence: {
29
+ missingHeartbeatWorkers: string[];
30
+ missingFinalResultWorkers: string[];
31
+ landingBlockedWorkers: string[];
32
+ completionBlockedWorkers: string[];
33
+ workers: RunListWorkerEvidence[];
34
+ };
35
+ }
36
+ export declare function buildRunListRows(): RunListRow[];
37
+ /** `kynver run list` — reconciles stale workers first, then prints run rows (JSON array). */
38
+ export declare function listRunsCli(): void;
@@ -24,7 +24,9 @@ export declare function loadRun(id: string): HarnessRunRecord;
24
24
  * iterates the whole set). Unreadable/partial run dirs are skipped.
25
25
  */
26
26
  export declare function listRunRecords(): HarnessRunRecord[];
27
+ export declare function listRunRecordsForHarnessRoot(harnessRoot: string): HarnessRunRecord[];
27
28
  export declare function loadWorker(runId: string, name: string): HarnessWorkerRecord;
28
29
  export declare function saveRun(run: HarnessRunRecord): void;
29
30
  export declare function saveWorker(runId: string, worker: HarnessWorkerRecord): void;
30
31
  export declare function runDirectory(id: string): string;
32
+ export declare function runDirectoryAt(harnessRoot: string, id: string): string;
@@ -0,0 +1,12 @@
1
+ export interface RunnerPresencePayload {
2
+ runnerId: string;
3
+ hostname: string | null;
4
+ profile: string | null;
5
+ harnessRepo: string | null;
6
+ runId?: string | null;
7
+ }
8
+ /** Stable runner identity for multi-box AgentOS coordination. */
9
+ export declare function resolveRunnerPresencePayload(input?: {
10
+ runId?: string | null;
11
+ env?: NodeJS.ProcessEnv;
12
+ }): RunnerPresencePayload;
@@ -0,0 +1,2 @@
1
+ export declare function runSchedulerCutoverCheckCli(json?: boolean): void;
2
+ export declare function runSchedulerAttestCutoverCli(json?: boolean): void;
@@ -0,0 +1,22 @@
1
+ import type { KynverUserConfig } from "./config.js";
2
+ export type DeploymentSchedulerProvider = "qstash" | "kynver-cron" | "openclaw-cron";
3
+ export declare const SCHEDULER_CUTOVER_RUNNER_ENV_KEYS: readonly ["KYNVER_SCHEDULER_PROVIDER", "OPENCLAW_CRON_STORE_PATH", "OPENCLAW_CRON_SECRET", "OPENCLAW_CRON_FIRE_BASE_URL"];
4
+ export interface SchedulerCutoverEnvSnapshot {
5
+ kynverSchedulerProvider: string | null;
6
+ openclawCronStorePath: string | null;
7
+ openclawCronSecret: boolean;
8
+ openclawCronFireBaseUrl: string | null;
9
+ }
10
+ export interface SchedulerCutoverReport {
11
+ ok: boolean;
12
+ blockers: string[];
13
+ runnerEnv: SchedulerCutoverEnvSnapshot;
14
+ deploymentSchedulerProvider: DeploymentSchedulerProvider | null;
15
+ deploymentSteps: string[];
16
+ runnerSteps: string[];
17
+ }
18
+ export declare const DEPLOYMENT_SCHEDULER_CUTOVER_STEPS: readonly ["Vercel/hosted: set KYNVER_SCHEDULER_PROVIDER=qstash", "Vercel/hosted: ensure QSTASH_TOKEN (and QStash signing keys) are configured", "Vercel/hosted: unset OPENCLAW_CRON_STORE_PATH if present"];
19
+ export declare const RUNNER_SCHEDULER_CUTOVER_STEPS: readonly ["User runner: unset KYNVER_SCHEDULER_PROVIDER (scheduling is deployment-owned)", "User runner: unset OPENCLAW_CRON_STORE_PATH, OPENCLAW_CRON_SECRET, OPENCLAW_CRON_FIRE_BASE_URL", "User runner: after deployment cutover, run `kynver scheduler attest-cutover` (or set deploymentSchedulerProvider to \"qstash\" in ~/.kynver/config.json)", "Verify: kynver doctor runtime-takeover — hotspot_openclaw_scheduler should pass"];
20
+ export declare function readSchedulerCutoverEnv(env?: NodeJS.ProcessEnv): SchedulerCutoverEnvSnapshot;
21
+ export declare function assessSchedulerCutover(config: Pick<KynverUserConfig, "deploymentSchedulerProvider">, env?: SchedulerCutoverEnvSnapshot): SchedulerCutoverReport;
22
+ export declare function applySchedulerCutoverAttestation(config: KynverUserConfig): KynverUserConfig;
package/dist/status.d.ts CHANGED
@@ -69,6 +69,9 @@ export interface HarnessWorkerRecord {
69
69
  parentTaskId?: string;
70
70
  taskTitle?: string;
71
71
  taskPrUrl?: string;
72
+ /** Canonical target PR for repair workers (must not spawn duplicate PRs). */
73
+ repairTargetPrUrl?: string;
74
+ repairTargetBranch?: string;
72
75
  /** Set when stale-reconcile patches a dead/stale worker record. */
73
76
  reconciledAt?: string;
74
77
  reconcileReason?: string;
@@ -25,6 +25,8 @@ export interface SpawnWorkerOptions {
25
25
  parentTaskId?: string;
26
26
  taskTitle?: string;
27
27
  taskPrUrl?: string;
28
+ repairTargetPrUrl?: string;
29
+ repairTargetBranch?: string;
28
30
  }
29
31
  export declare function spawnWorkerProcess(run: HarnessRunRecord, opts: SpawnWorkerOptions): HarnessWorkerRecord;
30
32
  export declare function startWorker(args: Record<string, string | boolean>): Promise<void>;
@@ -1,3 +1,3 @@
1
- export { classifyVercelUrl, isDashboardVercelUrl, type ClassifiedVercelUrl, type VercelUrlKind, } from "./vercel-url.js";
1
+ export { classifyVercelUrl, isDashboardVercelUrl, isInspectableVercelTarget, type ClassifiedVercelUrl, type VercelUrlKind, } from "./vercel-url.js";
2
2
  export { isVercelStatusContext, normalizeGitHubStatusState, pickVercelStatusContext, type GitHubCommitStatusRow, type GitHubStatusState, type GitHubVercelStatusContext, } from "./vercel-github-status.js";
3
3
  export { collectVercelEvidence, evidenceFromGitHubVercelStatus, resolveVercelInspectTarget, type CollectVercelEvidenceInput, type RunVercelInspect, type VercelEvidenceResult, type VercelEvidenceStatus, type VercelInspectCommandResult, } from "./vercel-evidence.js";
@@ -8,6 +8,8 @@ export interface ClassifiedVercelUrl {
8
8
  /** Deployment id extracted from dashboard paths when present. */
9
9
  deploymentId: string | null;
10
10
  }
11
+ /** True when the string is safe to pass to `vercel inspect` (never a dashboard page URL). */
12
+ export declare function isInspectableVercelTarget(target: string): boolean;
11
13
  /**
12
14
  * Classify a Vercel-related URL from GitHub commit status target_url.
13
15
  * `vercel inspect` accepts deployment ids and `*.vercel.app` hosts — not vercel.com dashboard links.
@@ -0,0 +1,26 @@
1
+ import type { ModelRoutingDecision } from "./model-routing.js";
2
+ /** Default harness worker CLI provider unless an operator override allows Claude. */
3
+ export declare const DEFAULT_WORKER_PROVIDER = "cursor";
4
+ export declare function isClaudeFamilyProvider(provider: string | null | undefined): boolean;
5
+ /**
6
+ * True when the board row explicitly opts into a Claude/Opus worker
7
+ * (operator override on the task).
8
+ */
9
+ export declare function taskAllowsClaudeWorker(task: Record<string, unknown> | null | undefined): boolean;
10
+ export interface EnforceCursorWorkerProviderInput {
11
+ routing: ModelRoutingDecision;
12
+ task?: Record<string, unknown> | null;
13
+ /** Per-invocation `--provider` from the harness CLI. */
14
+ explicitProvider?: string | null;
15
+ /** When true, `--provider claude` is treated as an operator run override. */
16
+ explicitProviderIsOperatorOverride?: boolean;
17
+ }
18
+ /**
19
+ * Rewrites Claude/Opus routing to Cursor unless the task or an explicit operator
20
+ * run override allows Claude workers.
21
+ */
22
+ export declare function enforceCursorWorkerProvider(input: EnforceCursorWorkerProviderInput): ModelRoutingDecision;
23
+ /** Normalize config/registry defaults — legacy `claude` configs map to Cursor unless overridden. */
24
+ export declare function resolveConfiguredWorkerProvider(configured: string | null | undefined, fallback?: string): string;
25
+ /** Plan / Command Center executor lists — Cursor wins when both families appear. */
26
+ export declare function preferCursorExecutor(executors: string[]): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kynver-app/runtime",
3
- "version": "0.1.62",
3
+ "version": "0.1.69",
4
4
  "description": "Kynver AgentOS local execution runtime and CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",