@proagentstore/cli 0.4.110 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1107,7 +1107,7 @@ import { Command as Command7 } from "commander";
1107
1107
  // src/commands/runner/process.ts
1108
1108
  import { spawn as spawn2 } from "child_process";
1109
1109
  import { existsSync as existsSync6 } from "fs";
1110
- import { resolve as resolve4 } from "path";
1110
+ import { resolve as resolve4, win32 } from "path";
1111
1111
  import { createServer as createServer2 } from "net";
1112
1112
  import { fileURLToPath as fileURLToPath2 } from "url";
1113
1113
  import { createRequire } from "module";
@@ -1156,6 +1156,9 @@ function runsFromSource() {
1156
1156
  function bundledRunnerPath() {
1157
1157
  return fileURLToPath2(new URL("./browser-runner/index.js", import.meta.url));
1158
1158
  }
1159
+ function spawnNeedsShell(command, platform = process.platform) {
1160
+ return platform === "win32" && !win32.isAbsolute(command);
1161
+ }
1159
1162
  function runnerSpawnSpec(opts) {
1160
1163
  const root = findWorkspaceRoot();
1161
1164
  const localPackage = resolve4(root, "packages", "browser-runner", "src", "index.ts");
@@ -1172,7 +1175,7 @@ function runnerSpawnSpec(opts) {
1172
1175
  command = process.execPath;
1173
1176
  args = [bundledPackage, ...runnerArgs];
1174
1177
  }
1175
- return { command, args, cwd };
1178
+ return { command, args, cwd, shell: spawnNeedsShell(command) };
1176
1179
  }
1177
1180
  function startRunnerForeground(opts) {
1178
1181
  const spec = runnerSpawnSpec(opts);
@@ -1180,7 +1183,7 @@ function startRunnerForeground(opts) {
1180
1183
  const child = spawn2(spec.command, spec.args, {
1181
1184
  cwd: spec.cwd,
1182
1185
  stdio: "inherit",
1183
- shell: process.platform === "win32"
1186
+ shell: spec.shell
1184
1187
  });
1185
1188
  child.on("error", reject);
1186
1189
  child.on("exit", (code) => {
@@ -1636,7 +1639,8 @@ function parseRecovery(raw) {
1636
1639
  const r = raw;
1637
1640
  if (!r || typeof r.target !== "string" || r.target.length > 80 || typeof r.at !== "string" || !Array.isArray(r.attachments)) return void 0;
1638
1641
  if (r.attachments.length > 200 || !r.attachments.every((a) => typeof a === "string" && a.length > 0 && a.length <= 128)) return void 0;
1639
- return { target: r.target, attachments: [...r.attachments], at: r.at };
1642
+ const verifiedAt = typeof r.verifiedAt === "string" && r.verifiedAt ? r.verifiedAt : void 0;
1643
+ return { target: r.target, attachments: [...r.attachments], at: r.at, ...verifiedAt ? { verifiedAt } : {} };
1640
1644
  }
1641
1645
  var statuses = /* @__PURE__ */ new Set([
1642
1646
  "enabled",
@@ -1785,6 +1789,7 @@ async function boundedWork(work, bound = {}) {
1785
1789
  function updateVerdict(attempt, facts, attachedNow = []) {
1786
1790
  if (!isVersion(facts.current) || !isVersion(facts.latest)) return { kind: "unverified", reason: `the running (${facts.current}) or published (${facts.latest}) version could not be read` };
1787
1791
  const cycle = attempt.recovery;
1792
+ if (cycle?.verifiedAt) return { kind: "completed" };
1788
1793
  if (!cycle) {
1789
1794
  if (attempt.status === "running" || attempt.status === "restarting") return { kind: "unknown", reason: "an update attempt was recorded by an older runner without the record needed to verify it" };
1790
1795
  return { kind: "current" };
@@ -1936,8 +1941,11 @@ var AutomaticUpdateController = class {
1936
1941
  const plan = this.deps.plan(facts);
1937
1942
  this.decisionAt = this.now();
1938
1943
  this.blockerClass = plan.action === "wait" ? blockerClassFor(plan.waitingFor) : null;
1939
- if (plan.action === "up-to-date") {
1940
- const verdict = updateVerdict(this.deps.policy().value, facts, this.deps.attachments?.() ?? []);
1944
+ const policy = this.deps.policy().value;
1945
+ const open = policy.recovery && !policy.recovery.verifiedAt ? policy.recovery : void 0;
1946
+ const reached = !!open && isVersion(open.target) && isVersion(facts.current) && !olderThan(facts.current, open.target);
1947
+ if (plan.action === "up-to-date" || reached) {
1948
+ const verdict = updateVerdict(policy, facts, this.deps.attachments?.() ?? []);
1941
1949
  if (verdict.kind === "unverified") {
1942
1950
  this.failures++;
1943
1951
  this.deps.status("failure", { reason: `Not verified: ${verdict.reason}.` });
@@ -1946,7 +1954,8 @@ var AutomaticUpdateController = class {
1946
1954
  this.deps.status("enabled", { latestVersion: facts.latest ?? void 0, reason: `Not verified: ${verdict.reason}.` });
1947
1955
  } else {
1948
1956
  this.failures = 0;
1949
- this.deps.status(verdict.kind === "verified" ? "verified-success" : "enabled", { latestVersion: facts.latest ?? void 0, reason: void 0, recovery: void 0 });
1957
+ const resolved = verdict.kind === "verified" && policy.recovery ? { recovery: { ...policy.recovery, verifiedAt: new Date(this.now()).toISOString() } } : {};
1958
+ this.deps.status(verdict.kind === "current" ? "enabled" : "verified-success", { latestVersion: facts.latest ?? void 0, reason: void 0, ...resolved });
1950
1959
  }
1951
1960
  this.schedule();
1952
1961
  return;
@@ -1961,14 +1970,17 @@ var AutomaticUpdateController = class {
1961
1970
  this.defer();
1962
1971
  return;
1963
1972
  }
1964
- this.deps.status("running", { latestVersion: plan.latest, reason: void 0, recovery: { target: plan.latest, attachments: [...this.deps.attachments?.() ?? []], at: new Date(this.now()).toISOString() } });
1965
- const restarted = await this.install(plan, true);
1973
+ const target = open && isVersion(open.target) ? open.target : plan.latest;
1974
+ const attempt = { ...plan, latest: target };
1975
+ const recovery = open ?? { target, attachments: [...this.deps.attachments?.() ?? []], at: new Date(this.now()).toISOString() };
1976
+ this.deps.status("running", { latestVersion: target, reason: void 0, recovery });
1977
+ const restarted = await this.install(attempt, true);
1966
1978
  if (restarted) {
1967
- this.deps.status("restarting", { latestVersion: plan.latest, reason: void 0 });
1979
+ this.deps.status("restarting", { latestVersion: target, reason: void 0 });
1968
1980
  return;
1969
1981
  }
1970
1982
  this.blockerClass = "idle_wait";
1971
- this.defer(plan.latest);
1983
+ this.defer(target);
1972
1984
  }
1973
1985
  defer(latest) {
1974
1986
  if (this.waiting) return;
@@ -2788,7 +2800,7 @@ function createRunnerCommand() {
2788
2800
  const runner = spawn4(spec.command, spec.args, {
2789
2801
  cwd: spec.cwd,
2790
2802
  stdio: ["ignore", "pipe", "pipe"],
2791
- shell: process.platform === "win32",
2803
+ shell: spec.shell,
2792
2804
  // #896: the runtime answers `/health` with the lock's identity and stops for a
2793
2805
  // request quoting its nonce — so a contender can prove who is on that port, and a
2794
2806
  // replace is an authorisation rather than a signal aimed at a name pattern.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proagentstore/cli",
3
- "version": "0.4.110",
3
+ "version": "0.4.112",
4
4
  "description": "CLI for creating, publishing, and running ProAgentStore agents",
5
5
  "license": "MIT",
6
6
  "type": "module",