@proagentstore/cli 0.4.118 → 0.4.120

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
@@ -8,7 +8,7 @@ import {
8
8
  newestPayload,
9
9
  olderThan,
10
10
  payloadAt
11
- } from "./chunk-LQ57ADUG.js";
11
+ } from "./chunk-NNA7VZ6W.js";
12
12
 
13
13
  // src/bootstrap.ts
14
14
  import { existsSync } from "fs";
@@ -55,8 +55,14 @@ const PAGINATION_NAME = /^(next|previous|prev|more|load more|show more|see more|
55
55
  const STEP_NAME = /^(next|continue|back|previous|add( another)?|upload|attach|browse|choose( a)? file|select( a)? file|remove|edit|expand|collapse|show more)\b/i;
56
56
  /** A tick that is a legal or privacy agreement: the owner's call, not the CLI's. */
57
57
  const CONSENT_NAME = /\b(agree|consent|terms|privacy|acknowledge|certify|accept|declaration|gdpr)\b/i;
58
- /** A field that is a credential: a sign-in, never an application answer. */
59
- const CREDENTIAL_NAME = /password|passcode|one[- ]?time|\botp\b|verification code|security code|2fa|two[- ]factor/i;
58
+ /**
59
+ * A field that is a credential: a sign-in, never an application answer. It includes the box an emailed or texted
60
+ * one-time code goes into (#1014) — "Enter the 6-digit code we emailed you", "Sign-in code" — which has no password
61
+ * field beside it, so the page check never sees a sign-in: the CLI is stopped at the field and the owner takes the
62
+ * exact session over (#1013). The Runner holds no mailbox access and never reads, asks for or types a code itself.
63
+ * Ordinary "code" answers (a postcode, a promo or referral code) are not credentials.
64
+ */
65
+ export const CREDENTIAL_NAME = /password|passcode|one[- ]?time|\botp\b|2fa|two[- ]factor|\b(?:verification|security|sign[- ]?in|log[- ]?in|login|access|authentication|confirmation) code\b|\b\d[- ]?digit code\b|\bcode (?:that )?we (?:sent|emailed|texted)\b|\bcode (?:sent|emailed|texted) to\b/i;
60
66
  /** Keys that move between fields without entering or activating anything. */
61
67
  const SAFE_KEYS = /^(Tab|Shift\+Tab|Arrow(Up|Down|Left|Right)|Escape|Home|End|PageUp|PageDown)$/;
62
68
  /**
@@ -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 latestPublishedVersion(timeoutMs = 3e4, signal) {
73
+ async function latestPublishedRelease(timeoutMs = 3e4, signal, deps = {}) {
74
74
  try {
75
- const { stdout } = await runNpm(["view", CLI_PACKAGE, "version"], { timeout: timeoutMs, signal });
76
- return stdout.trim() || null;
77
- } catch {
78
- return null;
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
- latestPublishedVersion,
7
+ latestPublishedRelease,
8
8
  olderThan,
9
9
  runNpm
10
- } from "./chunk-LQ57ADUG.js";
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.`, retryable: true };
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: await latestPublishedVersion(void 0, signal),
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proagentstore/cli",
3
- "version": "0.4.118",
3
+ "version": "0.4.120",
4
4
  "description": "CLI for creating, publishing, and running ProAgentStore agents",
5
5
  "license": "MIT",
6
6
  "type": "module",