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