@k-leumas/queque-cli 0.8.2 → 0.9.1

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/cli/app.js CHANGED
@@ -60002,9 +60002,14 @@ var ipcResponseSchema = external_exports.discriminatedUnion("kind", [
60002
60002
  // prompt to Claude even when the user pinned a local provider.
60003
60003
  providerPin: external_exports.literal(true).optional(),
60004
60004
  // Daemon buffers `telemetry-event` and answers `telemetry-show`/`telemetry-reset` (phase
60005
- // 10). Informational only: ensureDaemon never replaces a daemon for lacking it, because
60006
- // telemetry is optional and replacement goes through replaceStaleListener.
60007
- telemetry: external_exports.literal(true).optional()
60005
+ // 10). The flag alone never triggers a replacement, but a daemon that lacks it is from an
60006
+ // older build, and it is replaced for the build mismatch (quick 261030-tq3).
60007
+ telemetry: external_exports.literal(true).optional(),
60008
+ // The daemon's `__QUEQUE_BUILD_ID__` (quick 261030-tq3). Absent on daemons from before
60009
+ // 261030-tq3. A malformed value becomes undefined (read as another build) instead of
60010
+ // rejecting the pong: a rejected pong would read as 'unknown', and an 'unknown' daemon is
60011
+ // kept.
60012
+ build: external_exports.string().max(128).optional().catch(void 0)
60008
60013
  }),
60009
60014
  external_exports.object({
60010
60015
  kind: external_exports.literal("session-ready"),
@@ -60131,8 +60136,21 @@ function pingDaemonFetchCap(socketPath2) {
60131
60136
  done("unknown");
60132
60137
  return;
60133
60138
  }
60134
- const current2 = response.data.fetchCandidates === true && response.data.installedTools === true && response.data.streamCandidates === true && response.data.providerPin === true;
60135
- done(current2 ? "yes" : "no");
60139
+ const flags = response.data.fetchCandidates === true && response.data.installedTools === true && response.data.streamCandidates === true && response.data.providerPin === true;
60140
+ if (!flags) {
60141
+ done("no");
60142
+ return;
60143
+ }
60144
+ const build = response.data.build;
60145
+ if (build === "0.9.1+284a166.mw0pcnpa") {
60146
+ done("yes");
60147
+ return;
60148
+ }
60149
+ void appendDebugLog("daemon", "daemon build differs", {
60150
+ daemonBuild: build ?? null,
60151
+ clientBuild: "0.9.1+284a166.mw0pcnpa"
60152
+ });
60153
+ done("no");
60136
60154
  });
60137
60155
  client.on("error", () => {
60138
60156
  done("unknown");
@@ -61710,7 +61728,7 @@ function CandidateSelect({
61710
61728
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: legend.slice(MISSING_TOOL_MARK.length) })
61711
61729
  ] }),
61712
61730
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ControlsLine, {}),
61713
- process.env.QQ_DEV_ROOT != null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: `dev v${"0.8.2"} ${"a180650"}` }) })
61731
+ process.env.QQ_DEV_ROOT != null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: `dev v${"0.9.1"} ${"284a166"}` }) })
61714
61732
  ] });
61715
61733
  }
61716
61734
 
@@ -62529,7 +62547,8 @@ function startDaemonServer(socketPath2, options = {}) {
62529
62547
  installedTools: true,
62530
62548
  streamCandidates: true,
62531
62549
  providerPin: true,
62532
- telemetry: true
62550
+ telemetry: true,
62551
+ build: "0.9.1+284a166.mw0pcnpa"
62533
62552
  });
62534
62553
  void appendDebugLog("daemon", "replied pong");
62535
62554
  break;
@@ -62697,7 +62716,7 @@ function createTelemetryBuffer(deps = {}) {
62697
62716
  const readState = deps.readState ?? (() => readTelemetryState());
62698
62717
  const env3 = deps.env ?? (() => process.env);
62699
62718
  const endpointFor = deps.endpoint ?? resolveTelemetryEndpoint;
62700
- const version3 = deps.version ?? "0.8.2";
62719
+ const version3 = deps.version ?? "0.9.1";
62701
62720
  let events = [];
62702
62721
  let lastSent = null;
62703
62722
  let lastEnvironment = null;
@@ -62911,7 +62930,17 @@ function shutdownDaemon(server, connections, options = {}) {
62911
62930
  }
62912
62931
  async function daemonCommand(options) {
62913
62932
  const sock = options.socket ?? socketPath();
62914
- void appendDebugLog("daemon", "command start", { socket: sock, ensure: options.ensure });
62933
+ void appendDebugLog("daemon", "command start", {
62934
+ socket: sock,
62935
+ ensure: options.ensure,
62936
+ restart: options.restart
62937
+ });
62938
+ if (options.restart) {
62939
+ await restartDaemon(sock);
62940
+ void appendDebugLog("daemon", "restart command complete", { socket: sock });
62941
+ process.stdout.write("daemon restarted\n");
62942
+ return;
62943
+ }
62915
62944
  if (options.ensure) {
62916
62945
  await ensureDaemon(sock);
62917
62946
  void appendDebugLog("daemon", "ensure command complete", { socket: sock });
@@ -63206,7 +63235,7 @@ function defaultDoctorDeps() {
63206
63235
  uid: process.getuid?.() ?? 0,
63207
63236
  socketPath: socketPath(),
63208
63237
  nodeVersion: process.versions.node,
63209
- qqVersion: "0.8.2",
63238
+ qqVersion: "0.9.1",
63210
63239
  which: (name) => whichOnPath(name, env3.PATH),
63211
63240
  zshVersion: async () => {
63212
63241
  const out = await captureStdout(
@@ -63852,6 +63881,8 @@ import * as net5 from "net";
63852
63881
  var DAEMON_REQUEST_TIMEOUT_MS = 500;
63853
63882
  var USAGE = "usage: qq telemetry [status|on|off|show]";
63854
63883
  var DAEMON_NOT_RUNNING = "daemon not running: nothing buffered";
63884
+ var DAEMON_NO_ANSWER = "the daemon did not answer (it may be outdated)";
63885
+ var DAEMON_RESTART_HINT = "restart it: qq daemon --restart";
63855
63886
  var NO_KEY_NOTE = "note: this build has no project key, so nothing is sent";
63856
63887
  function requestDaemonOnce(socketPath2, request, timeoutMs = DAEMON_REQUEST_TIMEOUT_MS) {
63857
63888
  return new Promise((resolve6) => {
@@ -63905,6 +63936,9 @@ function defaultTelemetryCliDeps() {
63905
63936
  socketPath: socket,
63906
63937
  endpoint: () => resolveTelemetryEndpoint(process.env),
63907
63938
  requestDaemon: (request) => requestDaemonOnce(socket, request),
63939
+ // An arrow wrapper reads the bootstrap binding at call time: tests/client-result.test.ts
63940
+ // mocks daemon/bootstrap.js with ensureDaemon only (see init-provider.ts).
63941
+ socketConnectable: (path5) => tryConnect(path5),
63908
63942
  out: (text) => {
63909
63943
  process.stdout.write(text);
63910
63944
  },
@@ -63924,6 +63958,13 @@ function endpointHost(deps, endpoint) {
63924
63958
  }
63925
63959
  return "not configured";
63926
63960
  }
63961
+ async function daemonIsSilent(deps) {
63962
+ try {
63963
+ return await deps.socketConnectable(deps.socketPath);
63964
+ } catch {
63965
+ return false;
63966
+ }
63967
+ }
63927
63968
  function printStatus(deps, configPath) {
63928
63969
  const blockedBy = telemetryBlockedBy(deps.env);
63929
63970
  const state = readTelemetryState(configPath);
@@ -63964,6 +64005,8 @@ async function turnOff(deps, configPath) {
63964
64005
  const lines = ["telemetry: off", "install id deleted"];
63965
64006
  if (reply?.kind === "telemetry-buffer") {
63966
64007
  lines.push("daemon buffer cleared");
64008
+ } else if (reply === null && await daemonIsSilent(deps)) {
64009
+ lines.push(`${DAEMON_NO_ANSWER}: its buffer was not cleared`, DAEMON_RESTART_HINT);
63967
64010
  }
63968
64011
  deps.out(`${lines.join("\n")}
63969
64012
  `);
@@ -63971,12 +64014,22 @@ async function turnOff(deps, configPath) {
63971
64014
  async function show(deps) {
63972
64015
  const reply = await deps.requestDaemon({ kind: "telemetry-show" });
63973
64016
  if (reply === null) {
64017
+ if (await daemonIsSilent(deps)) {
64018
+ deps.out(`${DAEMON_NO_ANSWER}: nothing shown
64019
+ ${DAEMON_RESTART_HINT}
64020
+ `);
64021
+ return;
64022
+ }
63974
64023
  deps.out(`${DAEMON_NOT_RUNNING}
63975
64024
  `);
63976
64025
  return;
63977
64026
  }
63978
64027
  if (reply.kind !== "telemetry-buffer") {
63979
- deps.out("the daemon did not return a telemetry buffer (it may be outdated): nothing shown\n");
64028
+ deps.out(
64029
+ `the daemon did not return a telemetry buffer (it may be outdated): nothing shown
64030
+ ${DAEMON_RESTART_HINT}
64031
+ `
64032
+ );
63980
64033
  return;
63981
64034
  }
63982
64035
  deps.out(`pending:
@@ -64071,7 +64124,7 @@ async function main(argv = process.argv.slice(2)) {
64071
64124
  cli.command("telemetry [action]", "Anonymous usage and error counts: status, on, off or show").action(async (action) => {
64072
64125
  await telemetryCommand(action);
64073
64126
  });
64074
- cli.command("daemon").option("--socket <path>", "Unix socket path for the daemon").option("--ensure", "Ensure the daemon is running before returning").action(async (options) => {
64127
+ cli.command("daemon").option("--socket <path>", "Unix socket path for the daemon").option("--ensure", "Ensure the daemon is running before returning").option("--restart", "Stop the running daemon and start a fresh one from this qq").action(async (options) => {
64075
64128
  await daemonCommand(options);
64076
64129
  });
64077
64130
  cli.help();