@proagentstore/cli 0.4.110 → 0.4.111
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/dist/index.js +17 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1636,7 +1636,8 @@ function parseRecovery(raw) {
|
|
|
1636
1636
|
const r = raw;
|
|
1637
1637
|
if (!r || typeof r.target !== "string" || r.target.length > 80 || typeof r.at !== "string" || !Array.isArray(r.attachments)) return void 0;
|
|
1638
1638
|
if (r.attachments.length > 200 || !r.attachments.every((a) => typeof a === "string" && a.length > 0 && a.length <= 128)) return void 0;
|
|
1639
|
-
|
|
1639
|
+
const verifiedAt = typeof r.verifiedAt === "string" && r.verifiedAt ? r.verifiedAt : void 0;
|
|
1640
|
+
return { target: r.target, attachments: [...r.attachments], at: r.at, ...verifiedAt ? { verifiedAt } : {} };
|
|
1640
1641
|
}
|
|
1641
1642
|
var statuses = /* @__PURE__ */ new Set([
|
|
1642
1643
|
"enabled",
|
|
@@ -1785,6 +1786,7 @@ async function boundedWork(work, bound = {}) {
|
|
|
1785
1786
|
function updateVerdict(attempt, facts, attachedNow = []) {
|
|
1786
1787
|
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
1788
|
const cycle = attempt.recovery;
|
|
1789
|
+
if (cycle?.verifiedAt) return { kind: "completed" };
|
|
1788
1790
|
if (!cycle) {
|
|
1789
1791
|
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
1792
|
return { kind: "current" };
|
|
@@ -1936,8 +1938,11 @@ var AutomaticUpdateController = class {
|
|
|
1936
1938
|
const plan = this.deps.plan(facts);
|
|
1937
1939
|
this.decisionAt = this.now();
|
|
1938
1940
|
this.blockerClass = plan.action === "wait" ? blockerClassFor(plan.waitingFor) : null;
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
+
const policy = this.deps.policy().value;
|
|
1942
|
+
const open = policy.recovery && !policy.recovery.verifiedAt ? policy.recovery : void 0;
|
|
1943
|
+
const reached = !!open && isVersion(open.target) && isVersion(facts.current) && !olderThan(facts.current, open.target);
|
|
1944
|
+
if (plan.action === "up-to-date" || reached) {
|
|
1945
|
+
const verdict = updateVerdict(policy, facts, this.deps.attachments?.() ?? []);
|
|
1941
1946
|
if (verdict.kind === "unverified") {
|
|
1942
1947
|
this.failures++;
|
|
1943
1948
|
this.deps.status("failure", { reason: `Not verified: ${verdict.reason}.` });
|
|
@@ -1946,7 +1951,8 @@ var AutomaticUpdateController = class {
|
|
|
1946
1951
|
this.deps.status("enabled", { latestVersion: facts.latest ?? void 0, reason: `Not verified: ${verdict.reason}.` });
|
|
1947
1952
|
} else {
|
|
1948
1953
|
this.failures = 0;
|
|
1949
|
-
|
|
1954
|
+
const resolved = verdict.kind === "verified" && policy.recovery ? { recovery: { ...policy.recovery, verifiedAt: new Date(this.now()).toISOString() } } : {};
|
|
1955
|
+
this.deps.status(verdict.kind === "current" ? "enabled" : "verified-success", { latestVersion: facts.latest ?? void 0, reason: void 0, ...resolved });
|
|
1950
1956
|
}
|
|
1951
1957
|
this.schedule();
|
|
1952
1958
|
return;
|
|
@@ -1961,14 +1967,17 @@ var AutomaticUpdateController = class {
|
|
|
1961
1967
|
this.defer();
|
|
1962
1968
|
return;
|
|
1963
1969
|
}
|
|
1964
|
-
|
|
1965
|
-
const
|
|
1970
|
+
const target = open && isVersion(open.target) ? open.target : plan.latest;
|
|
1971
|
+
const attempt = { ...plan, latest: target };
|
|
1972
|
+
const recovery = open ?? { target, attachments: [...this.deps.attachments?.() ?? []], at: new Date(this.now()).toISOString() };
|
|
1973
|
+
this.deps.status("running", { latestVersion: target, reason: void 0, recovery });
|
|
1974
|
+
const restarted = await this.install(attempt, true);
|
|
1966
1975
|
if (restarted) {
|
|
1967
|
-
this.deps.status("restarting", { latestVersion:
|
|
1976
|
+
this.deps.status("restarting", { latestVersion: target, reason: void 0 });
|
|
1968
1977
|
return;
|
|
1969
1978
|
}
|
|
1970
1979
|
this.blockerClass = "idle_wait";
|
|
1971
|
-
this.defer(
|
|
1980
|
+
this.defer(target);
|
|
1972
1981
|
}
|
|
1973
1982
|
defer(latest) {
|
|
1974
1983
|
if (this.waiting) return;
|