owlrunkit 0.25.0 → 0.25.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.
@@ -20,6 +20,7 @@ import {
20
20
  validateExecutionPin,
21
21
  validateLeaseOwnedPaths,
22
22
  } from "./core-contract.mjs";
23
+ import { acquireRunKitControlLock } from "./control-transaction-lock.mjs";
23
24
  import { buildCoverageIndex } from "./coverage-adoption.mjs";
24
25
  import { validateVerificationReceiptGate } from "./verification-receipt-gate.mjs";
25
26
  import {
@@ -103,14 +104,7 @@ function acquireResumeLock(workspaceRoot) {
103
104
  const runtimeRoot = path.join(workspaceRoot, RUNTIME_ROOT);
104
105
  assertSafeDirectory(workspaceRoot, runtimeRoot, "RunKit runtime root");
105
106
  assertSafeDirectory(runtimeRoot, path.join(runtimeRoot, "executions"), "Executions directory");
106
- const lockPath = path.join(runtimeRoot, "control.lock");
107
- try {
108
- mkdirSync(lockPath);
109
- } catch (error) {
110
- if (error?.code === "EEXIST") throw new Error("Another RunKit control transaction is already active.");
111
- throw error;
112
- }
113
- return () => rmSync(lockPath, { recursive: true, force: true });
107
+ return acquireRunKitControlLock(runtimeRoot);
114
108
  }
115
109
 
116
110
  function activeRunIds(workspaceRoot) {
@@ -95,6 +95,7 @@ import { buildHookRecoveryV1 } from "./hook-recovery.mjs";
95
95
  import {
96
96
  createPeerRecoveryTask,
97
97
  inspectPeerRecoveryTask,
98
+ recoverAndRunPeerTask,
98
99
  recoverPeerTask,
99
100
  runPeerTask,
100
101
  } from "./peer-recovery.mjs";
@@ -2454,7 +2455,7 @@ const PEER_HELP = `Usage:
2454
2455
  owlrunkit peer create --workspace <dir> --task <id> --request <json>
2455
2456
  owlrunkit peer inspect --workspace <dir> --task <id>
2456
2457
  owlrunkit peer run --workspace <dir> --task <id> --agent <id> --generation <n> -- /absolute/worker [args]
2457
- owlrunkit peer recover --workspace <dir> --task <id> --agent <id> --generation <n> --revision <n> [--wait-ms <n>]
2458
+ owlrunkit peer recover --workspace <dir> --task <id> --agent <id> --generation <n> --revision <n> [--wait-ms <n>] [-- /absolute/worker [args]]
2458
2459
  `;
2459
2460
 
2460
2461
  function runPeerCommand(rest) {
@@ -2468,10 +2469,10 @@ function runPeerCommand(rest) {
2468
2469
  create: ["request"], inspect: [], run: ["agent", "generation"],
2469
2470
  recover: ["agent", "generation", "revision", "wait-ms"],
2470
2471
  };
2471
- if (!Object.hasOwn(flags, action) || (separator !== -1 && action !== "run")) {
2472
+ if (!Object.hasOwn(flags, action) || (separator !== -1 && !["run", "recover"].includes(action))) {
2472
2473
  throw new Error(PEER_HELP);
2473
2474
  }
2474
- const options = parseOptions(optionArgs);
2475
+ const options = parseOptions(optionArgs, { boolean: ["json"] });
2475
2476
  const allowed = new Set(["workspace", "task", "json", ...flags[action]]);
2476
2477
  if (Object.keys(options).some(key => !allowed.has(key))) throw new Error(PEER_HELP);
2477
2478
  const task = { workspaceRoot: workspace(options), taskId: requireOption(options, "task") };
@@ -2489,11 +2490,13 @@ function runPeerCommand(rest) {
2489
2490
  if (separator === -1) throw new Error(PEER_HELP);
2490
2491
  return runPeerTask({ ...peer, command: args.slice(separator + 1) });
2491
2492
  }
2492
- return recoverPeerTask({ ...peer,
2493
+ const recovery = { ...peer,
2493
2494
  revision: parseCanonicalNonnegativeSafeInteger(requireOption(options, "revision"), "revision"),
2494
2495
  waitMs: options["wait-ms"] === undefined ? undefined
2495
2496
  : parseCanonicalNonnegativeSafeInteger(options["wait-ms"], "wait-ms"),
2496
- });
2497
+ };
2498
+ return separator === -1 ? recoverPeerTask(recovery)
2499
+ : recoverAndRunPeerTask(recovery, args.slice(separator + 1));
2497
2500
  }
2498
2501
 
2499
2502
  export async function runCli(argv = process.argv.slice(2), runtimeHooks = {}) {