@nice-code/commander 0.82.0 → 0.84.0

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/build/cli.cjs CHANGED
@@ -148,7 +148,7 @@ function validStartStamp(value) {
148
148
  function isInstanceRecord(value) {
149
149
  if (value == null || typeof value !== "object" || Array.isArray(value)) return false;
150
150
  const record = value;
151
- return record.service === "nice-commander" && boundedString(record.instanceId) && boundedInt(record.generation, 0, Number.MAX_SAFE_INTEGER) && boundedInt(record.pid, 1, Number.MAX_SAFE_INTEGER) && boundedInt(record.port, 1, 65535) && boundedString(record.token) && boundedString(record.configKey) && boundedString(record.configRevisionHash) && boundedString(record.configPath) && boundedString(record.packageVersion) && boundedString(record.realmSchemaHash) && validStartStamp(record.startStamp) && record.protocolVersion === 3;
151
+ return record.service === "nice-commander" && boundedString(record.instanceId) && boundedInt(record.generation, 0, Number.MAX_SAFE_INTEGER) && boundedInt(record.pid, 1, Number.MAX_SAFE_INTEGER) && boundedInt(record.port, 1, 65535) && boundedString(record.token) && boundedString(record.configKey) && boundedString(record.configRevisionHash) && boundedString(record.configPath) && boundedString(record.packageVersion) && boundedString(record.realmSchemaHash) && validStartStamp(record.startStamp) && record.protocolVersion === 4;
152
152
  }
153
153
  async function writeInstanceRecord(path, record) {
154
154
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(path), {
@@ -198,7 +198,7 @@ async function readSkewedInstanceRecord(path, expectedRealmSchemaHash) {
198
198
  if (!boundedInt(record["protocolVersion"], 0, Number.MAX_SAFE_INTEGER)) return null;
199
199
  if (!boundedInt(record["pid"], 1, Number.MAX_SAFE_INTEGER)) return null;
200
200
  if (!boundedInt(record["port"], 1, 65535)) return null;
201
- const sameProtocol = record["protocolVersion"] === 3;
201
+ const sameProtocol = record["protocolVersion"] === 4;
202
202
  const sameRealm = boundedString(record["realmSchemaHash"]) && record["realmSchemaHash"] === expectedRealmSchemaHash;
203
203
  if (sameProtocol && sameRealm) return null;
204
204
  return {
@@ -23092,6 +23092,7 @@ const commanderStatusRealm = defineRealm({
23092
23092
  avatars: { viewer: { persistentId: t.string() } },
23093
23093
  state: {
23094
23094
  generation: t.number(),
23095
+ configName: t.string(),
23095
23096
  configRevisionHash: t.string(),
23096
23097
  configError: t.array(t.string()),
23097
23098
  processes: t.record(t.id("processId"), t.object({
@@ -23288,7 +23289,7 @@ var CommanderDaemonBootError = class extends Error {
23288
23289
  * a live dev environment, and an upgrade must never be the thing that kills one.
23289
23290
  */
23290
23291
  async function replaceSkewedDaemon(paths, skewed) {
23291
- const daemonLabel = `the daemon for this config (pid ${skewed.pid}, build ${skewed.packageVersion}, protocol v${skewed.protocolVersion}) predates this CLI (protocol v3${skewed.skew === "realm-schema" ? ", different status schema" : ""})`;
23292
+ const daemonLabel = `the daemon for this config (pid ${skewed.pid}, build ${skewed.packageVersion}, protocol v${skewed.protocolVersion}) predates this CLI (protocol v4${skewed.skew === "realm-schema" ? ", different status schema" : ""})`;
23292
23293
  let liveIds = [];
23293
23294
  try {
23294
23295
  liveIds = (await (0, _nice_code_process.openProcessLedger)({
@@ -23608,7 +23609,7 @@ async function findDaemon(config) {
23608
23609
  async function findSkewedDaemon(config) {
23609
23610
  const skewed = await readSkewedInstanceRecord(commanderStatePaths(resolveCommanderDataDir(), config.configKey).instanceRecordPath, commanderStatusRealm.schemaHash);
23610
23611
  if (skewed == null || !pidAlive$1(skewed.pid)) return null;
23611
- const difference = skewed.skew === "protocol" ? `speaks protocol v${skewed.protocolVersion}; this build speaks v3` : "was started before an upgrade changed the status schema";
23612
+ const difference = skewed.skew === "protocol" ? `speaks protocol v${skewed.protocolVersion}; this build speaks v4` : "was started before an upgrade changed the status schema";
23612
23613
  return {
23613
23614
  message: `the daemon for this config (pid ${skewed.pid}, port ${skewed.port}, build ${skewed.packageVersion}) ${difference} — this CLI (build ${await commanderPackageVersion()}) cannot talk to it. Run \`nice-commander shutdown\` (it stops a daemon from any build), then retry.`,
23614
23615
  pid: skewed.pid,
@@ -23704,7 +23705,7 @@ async function connectDaemon(handle) {
23704
23705
  const payload = await (await runtime.handleActionPayload(request)).waitForResultPayload();
23705
23706
  if (!payload.result.ok) throw new CliExit(EXIT.failure, `action "${action}" rejected by the daemon`);
23706
23707
  const report = parseActionReport(payload.result.output);
23707
- if (report == null) throw new CliExit(EXIT.failure, `the daemon answered "${action}" with something this CLI does not recognise — protocol ${record.protocolVersion} vs 3`);
23708
+ if (report == null) throw new CliExit(EXIT.failure, `the daemon answered "${action}" with something this CLI does not recognise — protocol ${record.protocolVersion} vs 4`);
23708
23709
  return report;
23709
23710
  },
23710
23711
  setEnv: async (input) => {
@@ -25064,7 +25065,7 @@ function renderTable(out, state) {
25064
25065
  String(proc.restarts),
25065
25066
  notesFor(proc, now)
25066
25067
  ]);
25067
- const head = `generation ${state.generation} · revision ${state.configRevisionHash}`;
25068
+ const head = `${state.configName} · generation ${state.generation} · revision ${state.configRevisionHash}`;
25068
25069
  const configError = state.configError.length > 0 ? `\nconfig error (last-good kept): ${state.configError[0]}` : "";
25069
25070
  return `${out.paint("gray", head)}\n${out.table([
25070
25071
  "ID",
@@ -25273,7 +25274,7 @@ async function withTimeout(ctx, run) {
25273
25274
  async function main() {
25274
25275
  const argv = process.argv.slice(2);
25275
25276
  if (argv[0] === "daemon") {
25276
- const { runCommanderDaemon } = await Promise.resolve().then(() => require("./main-D1Qv8v0t.cjs"));
25277
+ const { runCommanderDaemon } = await Promise.resolve().then(() => require("./main-BXxko_iD.cjs"));
25277
25278
  return runCommanderDaemon(argv.slice(1));
25278
25279
  }
25279
25280
  const parsed = parseCliArgs(argv);