@proagentstore/cli 0.4.117 → 0.4.119
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/bootstrap.js
CHANGED
|
@@ -24,7 +24,9 @@ export class CodingRuntime {
|
|
|
24
24
|
*/
|
|
25
25
|
liveWork() {
|
|
26
26
|
return [...this.sessions.entries()].flatMap(([sessionId, s]) => {
|
|
27
|
-
|
|
27
|
+
// The engine lives on the session's CONFIG (#1053): reading a top-level `clientType` — which a
|
|
28
|
+
// HeadlessSession does not have — labelled every live Claude turn "coding turn is lost on a restart".
|
|
29
|
+
const engine = s.config?.clientType ?? "";
|
|
28
30
|
const consequence = engine === "claude" ? "Claude conversation resumes after a restart" : `${engine || "coding"} turn is lost on a restart`;
|
|
29
31
|
try {
|
|
30
32
|
// `alive: false` is an observed inactive session. Any other answer (including a
|
|
@@ -70,14 +70,26 @@ function runNpm(args, options) {
|
|
|
70
70
|
const npm = npmInvocation(args);
|
|
71
71
|
return run(npm.file, npm.args, { ...options, ...npm.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {} });
|
|
72
72
|
}
|
|
73
|
-
async function
|
|
73
|
+
async function latestPublishedRelease(timeoutMs = 3e4, signal, deps = {}) {
|
|
74
74
|
try {
|
|
75
|
-
const { stdout } = await runNpm(["view", CLI_PACKAGE, "version"], { timeout: timeoutMs, signal });
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const { stdout } = await (deps.runNpm ?? runNpm)(["view", CLI_PACKAGE, "version"], { timeout: timeoutMs, signal });
|
|
76
|
+
const version = String(stdout).trim();
|
|
77
|
+
return version ? { version } : { error: "npm printed no version" };
|
|
78
|
+
} catch (e) {
|
|
79
|
+
return { error: npmFailure(e) };
|
|
79
80
|
}
|
|
80
81
|
}
|
|
82
|
+
function npmFailure(e) {
|
|
83
|
+
const err = e;
|
|
84
|
+
const stderr = String(err?.stderr ?? "").split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
|
|
85
|
+
const npmErrors = stderr.filter((l) => /npm (ERR!|error)/i.test(l));
|
|
86
|
+
const why = npmErrors.slice(0, 2).join(" ") || stderr.at(-1) || (err?.killed || err?.signal ? `npm did not answer in time (${String(err.signal ?? "killed")})` : "") || (typeof err?.code === "string" ? `npm could not be started (${err.code}: ${String(err.message ?? "")})` : "") || String(err?.message ?? e);
|
|
87
|
+
return why.replace(/\s+/g, " ").trim().slice(0, 300);
|
|
88
|
+
}
|
|
89
|
+
async function latestPublishedVersion(timeoutMs = 3e4, signal) {
|
|
90
|
+
const r = await latestPublishedRelease(timeoutMs, signal);
|
|
91
|
+
return "version" in r ? r.version : null;
|
|
92
|
+
}
|
|
81
93
|
async function npmInstallInto(dir, version) {
|
|
82
94
|
try {
|
|
83
95
|
await runNpm(["install", "--prefix", dir, "--omit=dev", "--no-audit", "--no-fund", "--no-save", `${CLI_PACKAGE}@${version}`], { timeout: 5 * 6e4 });
|
|
@@ -120,6 +132,7 @@ export {
|
|
|
120
132
|
cachedPayloads,
|
|
121
133
|
newestPayload,
|
|
122
134
|
runNpm,
|
|
135
|
+
latestPublishedRelease,
|
|
123
136
|
latestPublishedVersion,
|
|
124
137
|
installPayload
|
|
125
138
|
};
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
CLI_PACKAGE,
|
|
5
5
|
installPayload,
|
|
6
6
|
isVersion,
|
|
7
|
-
|
|
7
|
+
latestPublishedRelease,
|
|
8
8
|
olderThan,
|
|
9
9
|
runNpm
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NNA7VZ6W.js";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
import { createRequire as createRequire3 } from "module";
|
|
@@ -1305,7 +1305,7 @@ function restartUpArgs(opts) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
function planRunnerUpdate(f) {
|
|
1307
1307
|
if (f.fromSource) return { action: "refused", current: f.current, reason: "This runner runs from a source checkout \u2014 update it with `git pull` there, not npm." };
|
|
1308
|
-
if (!f.latest) return { action: "refused", current: f.current, reason: `npm could not be asked for the latest ${CLI_PACKAGE} from this machine
|
|
1308
|
+
if (!f.latest) return { action: "refused", current: f.current, reason: `npm could not be asked for the latest ${CLI_PACKAGE} from this machine${f.latestError ? `: ${f.latestError}` : "."}`, retryable: true };
|
|
1309
1309
|
if (!olderThan(f.current, f.latest)) return { action: "up-to-date", current: f.current };
|
|
1310
1310
|
if (!f.restarter) {
|
|
1311
1311
|
return {
|
|
@@ -2341,10 +2341,12 @@ async function connectViaRelay(instanceIds, localUrl, runnerToken, opts, force =
|
|
|
2341
2341
|
};
|
|
2342
2342
|
const updateFacts = async (signal) => {
|
|
2343
2343
|
const { busy, observations } = await workLook(signal);
|
|
2344
|
+
const release = await latestPublishedRelease(void 0, signal);
|
|
2344
2345
|
return {
|
|
2345
2346
|
observations,
|
|
2346
2347
|
current: CLI_VERSION,
|
|
2347
|
-
latest:
|
|
2348
|
+
latest: "version" in release ? release.version : null,
|
|
2349
|
+
..."error" in release ? { latestError: release.error } : {},
|
|
2348
2350
|
fromSource: runsFromSource(),
|
|
2349
2351
|
restarter: restarterFrom(process.env),
|
|
2350
2352
|
// A restart ends browser/application work too. Give these durable names to the same
|