commonswarm 0.1.46 → 0.1.47

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.
Files changed (2) hide show
  1. package/cswarm.cjs +243 -177
  2. package/package.json +1 -1
package/cswarm.cjs CHANGED
@@ -163,11 +163,11 @@ function __metadata(metadataKey, metadataValue) {
163
163
  }
164
164
  function __awaiter(thisArg, _arguments, P, generator) {
165
165
  function adopt(value) {
166
- return value instanceof P ? value : new P(function(resolve2) {
167
- resolve2(value);
166
+ return value instanceof P ? value : new P(function(resolve3) {
167
+ resolve3(value);
168
168
  });
169
169
  }
170
- return new (P || (P = Promise))(function(resolve2, reject) {
170
+ return new (P || (P = Promise))(function(resolve3, reject) {
171
171
  function fulfilled(value) {
172
172
  try {
173
173
  step(generator.next(value));
@@ -183,7 +183,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
183
183
  }
184
184
  }
185
185
  function step(result) {
186
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
186
+ result.done ? resolve3(result.value) : adopt(result.value).then(fulfilled, rejected);
187
187
  }
188
188
  step((generator = generator.apply(thisArg, _arguments || [])).next());
189
189
  });
@@ -374,14 +374,14 @@ function __asyncValues(o) {
374
374
  }, i);
375
375
  function verb(n) {
376
376
  i[n] = o[n] && function(v) {
377
- return new Promise(function(resolve2, reject) {
378
- v = o[n](v), settle(resolve2, reject, v.done, v.value);
377
+ return new Promise(function(resolve3, reject) {
378
+ v = o[n](v), settle(resolve3, reject, v.done, v.value);
379
379
  });
380
380
  };
381
381
  }
382
- function settle(resolve2, reject, d, v) {
382
+ function settle(resolve3, reject, d, v) {
383
383
  Promise.resolve(v).then(function(v2) {
384
- resolve2({ value: v2, done: d });
384
+ resolve3({ value: v2, done: d });
385
385
  }, reject);
386
386
  }
387
387
  }
@@ -4262,15 +4262,15 @@ var require_RealtimeChannel = __commonJS({
4262
4262
  }
4263
4263
  }
4264
4264
  } else {
4265
- return new Promise((resolve2) => {
4265
+ return new Promise((resolve3) => {
4266
4266
  var _a2, _b2, _c;
4267
4267
  const push = this.channelAdapter.push(args.type, args, opts.timeout || this.timeout);
4268
4268
  if (args.type === "broadcast" && !((_c = (_b2 = (_a2 = this.params) === null || _a2 === void 0 ? void 0 : _a2.config) === null || _b2 === void 0 ? void 0 : _b2.broadcast) === null || _c === void 0 ? void 0 : _c.ack)) {
4269
- resolve2("ok");
4269
+ resolve3("ok");
4270
4270
  }
4271
- push.receive("ok", () => resolve2("ok"));
4272
- push.receive("error", () => resolve2("error"));
4273
- push.receive("timeout", () => resolve2("timed out"));
4271
+ push.receive("ok", () => resolve3("ok"));
4272
+ push.receive("error", () => resolve3("error"));
4273
+ push.receive("timeout", () => resolve3("timed out"));
4274
4274
  });
4275
4275
  }
4276
4276
  }
@@ -4295,8 +4295,8 @@ var require_RealtimeChannel = __commonJS({
4295
4295
  * @category Realtime
4296
4296
  */
4297
4297
  async unsubscribe(timeout = this.timeout) {
4298
- return new Promise((resolve2) => {
4299
- this.channelAdapter.unsubscribe(timeout).receive("ok", () => resolve2("ok")).receive("timeout", () => resolve2("timed out")).receive("error", () => resolve2("error"));
4298
+ return new Promise((resolve3) => {
4299
+ this.channelAdapter.unsubscribe(timeout).receive("ok", () => resolve3("ok")).receive("timeout", () => resolve3("timed out")).receive("error", () => resolve3("error"));
4300
4300
  });
4301
4301
  }
4302
4302
  /**
@@ -4504,11 +4504,11 @@ var require_socketAdapter = __commonJS({
4504
4504
  this.socket.connect();
4505
4505
  }
4506
4506
  disconnect(callback, code, reason, timeout = 1e4) {
4507
- return new Promise((resolve2) => {
4508
- setTimeout(() => resolve2("timeout"), timeout);
4507
+ return new Promise((resolve3) => {
4508
+ setTimeout(() => resolve3("timeout"), timeout);
4509
4509
  this.socket.disconnect(() => {
4510
4510
  callback();
4511
- resolve2("ok");
4511
+ resolve3("ok");
4512
4512
  }, code, reason);
4513
4513
  });
4514
4514
  }
@@ -13522,7 +13522,7 @@ __export(cli_exports, {
13522
13522
  resolveTurnBudgetOrDefer: () => resolveTurnBudgetOrDefer
13523
13523
  });
13524
13524
  module.exports = __toCommonJS(cli_exports);
13525
- var import_node_crypto21 = require("node:crypto");
13525
+ var import_node_crypto22 = require("node:crypto");
13526
13526
  var import_node_child_process9 = require("node:child_process");
13527
13527
  var import_node_fs7 = require("node:fs");
13528
13528
  var import_promises12 = require("node:fs/promises");
@@ -13591,18 +13591,18 @@ var PostgrestError = class extends Error {
13591
13591
  }
13592
13592
  };
13593
13593
  function sleep(ms, signal) {
13594
- return new Promise((resolve2) => {
13594
+ return new Promise((resolve3) => {
13595
13595
  if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
13596
- resolve2();
13596
+ resolve3();
13597
13597
  return;
13598
13598
  }
13599
13599
  const id = setTimeout(() => {
13600
13600
  signal === null || signal === void 0 || signal.removeEventListener("abort", onAbort);
13601
- resolve2();
13601
+ resolve3();
13602
13602
  }, ms);
13603
13603
  function onAbort() {
13604
13604
  clearTimeout(id);
13605
- resolve2();
13605
+ resolve3();
13606
13606
  }
13607
13607
  signal === null || signal === void 0 || signal.addEventListener("abort", onAbort);
13608
13608
  });
@@ -18040,7 +18040,7 @@ var _getRequestParams = (method, options, parameters, body) => {
18040
18040
  return _objectSpread22(_objectSpread22({}, params), parameters);
18041
18041
  };
18042
18042
  async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
18043
- return new Promise((resolve2, reject) => {
18043
+ return new Promise((resolve3, reject) => {
18044
18044
  fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
18045
18045
  if (!result.ok) throw result;
18046
18046
  if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
@@ -18050,7 +18050,7 @@ async function _handleRequest(fetcher, method, url, options, parameters, body, n
18050
18050
  if (!contentType || !contentType.includes("application/json")) return {};
18051
18051
  }
18052
18052
  return result.json();
18053
- }).then((data) => resolve2(data)).catch((error) => handleError(error, reject, options, namespace));
18053
+ }).then((data) => resolve3(data)).catch((error) => handleError(error, reject, options, namespace));
18054
18054
  });
18055
18055
  }
18056
18056
  function createFetchApi(namespace = "storage") {
@@ -20693,11 +20693,11 @@ var DEFAULT_TRACE_PROPAGATION_OPTIONS = {
20693
20693
  };
20694
20694
  function __awaiter2(thisArg, _arguments, P, generator) {
20695
20695
  function adopt(value) {
20696
- return value instanceof P ? value : new P(function(resolve2) {
20697
- resolve2(value);
20696
+ return value instanceof P ? value : new P(function(resolve3) {
20697
+ resolve3(value);
20698
20698
  });
20699
20699
  }
20700
- return new (P || (P = Promise))(function(resolve2, reject) {
20700
+ return new (P || (P = Promise))(function(resolve3, reject) {
20701
20701
  function fulfilled(value) {
20702
20702
  try {
20703
20703
  step(generator.next(value));
@@ -20713,7 +20713,7 @@ function __awaiter2(thisArg, _arguments, P, generator) {
20713
20713
  }
20714
20714
  }
20715
20715
  function step(result) {
20716
- result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
20716
+ result.done ? resolve3(result.value) : adopt(result.value).then(fulfilled, rejected);
20717
20717
  }
20718
20718
  step((generator = generator.apply(thisArg, _arguments || [])).next());
20719
20719
  });
@@ -21501,14 +21501,14 @@ function validateCallbackUrl(raw, expectedOrigin, expectedState) {
21501
21501
  return code;
21502
21502
  }
21503
21503
  function listen(server, port) {
21504
- return new Promise((resolve2, reject) => {
21504
+ return new Promise((resolve3, reject) => {
21505
21505
  const onError = (error) => {
21506
21506
  server.off("listening", onListening);
21507
21507
  reject(error);
21508
21508
  };
21509
21509
  const onListening = () => {
21510
21510
  server.off("error", onError);
21511
- resolve2();
21511
+ resolve3();
21512
21512
  };
21513
21513
  server.once("error", onError);
21514
21514
  server.once("listening", onListening);
@@ -21517,8 +21517,8 @@ function listen(server, port) {
21517
21517
  }
21518
21518
  function closeServer(server) {
21519
21519
  if (!server.listening) return Promise.resolve();
21520
- const closed = new Promise((resolve2, reject) => {
21521
- server.close((error) => error ? reject(error) : resolve2());
21520
+ const closed = new Promise((resolve3, reject) => {
21521
+ server.close((error) => error ? reject(error) : resolve3());
21522
21522
  });
21523
21523
  server.closeAllConnections();
21524
21524
  return closed;
@@ -21526,8 +21526,8 @@ function closeServer(server) {
21526
21526
  async function callbackReceiver(expectedState) {
21527
21527
  let resolveCode;
21528
21528
  let rejectCode;
21529
- const result = new Promise((resolve2, reject) => {
21530
- resolveCode = resolve2;
21529
+ const result = new Promise((resolve3, reject) => {
21530
+ resolveCode = resolve3;
21531
21531
  rejectCode = reject;
21532
21532
  });
21533
21533
  let origin = "";
@@ -21612,23 +21612,23 @@ function authClient(target2, storage) {
21612
21612
  async function openExternalBrowser(url) {
21613
21613
  const command2 = process.platform === "darwin" ? { executable: "open", args: [url] } : process.platform === "linux" ? { executable: "xdg-open", args: [url] } : null;
21614
21614
  if (!command2) return false;
21615
- return await new Promise((resolve2) => {
21615
+ return await new Promise((resolve3) => {
21616
21616
  const child = (0, import_node_child_process.spawn)(command2.executable, command2.args, {
21617
21617
  detached: true,
21618
21618
  stdio: "ignore"
21619
21619
  });
21620
- child.once("error", () => resolve2(false));
21620
+ child.once("error", () => resolve3(false));
21621
21621
  child.once("spawn", () => {
21622
21622
  child.unref();
21623
- resolve2(true);
21623
+ resolve3(true);
21624
21624
  });
21625
21625
  });
21626
21626
  }
21627
21627
  function pastedCallback(input, output, origin, state) {
21628
21628
  if (!input) return null;
21629
21629
  let resolveCode;
21630
- const promise = new Promise((resolve2) => {
21631
- resolveCode = resolve2;
21630
+ const promise = new Promise((resolve3) => {
21631
+ resolveCode = resolve3;
21632
21632
  });
21633
21633
  let pending = "";
21634
21634
  const onData = (chunk) => {
@@ -21659,14 +21659,14 @@ function pastedCallback(input, output, origin, state) {
21659
21659
  async function waitForCode(receiver, state, input, output, timeoutMs, pasteFallbackDelayMs) {
21660
21660
  const activePastes = [];
21661
21661
  let pasteTimer = null;
21662
- const paste = input ? new Promise((resolve2) => {
21662
+ const paste = input ? new Promise((resolve3) => {
21663
21663
  pasteTimer = setTimeout(() => {
21664
21664
  output.write(
21665
21665
  "If the browser cannot reach the loopback callback, paste the complete callback URL here:\n"
21666
21666
  );
21667
21667
  const pasted = pastedCallback(input, output, receiver.origin, state);
21668
21668
  if (pasted) activePastes.push(pasted);
21669
- pasted?.promise.then(resolve2);
21669
+ pasted?.promise.then(resolve3);
21670
21670
  }, pasteFallbackDelayMs);
21671
21671
  }) : null;
21672
21672
  let timer2 = null;
@@ -22394,8 +22394,8 @@ function signalRetryDelayMs(retry, baseMs, random) {
22394
22394
  async function waitForSignalRetry(delayMs, deadline, callerAbort) {
22395
22395
  if (delayMs === 0) return "elapsed";
22396
22396
  let timer2;
22397
- const elapsed = new Promise((resolve2) => {
22398
- timer2 = setTimeout(() => resolve2("elapsed"), delayMs);
22397
+ const elapsed = new Promise((resolve3) => {
22398
+ timer2 = setTimeout(() => resolve3("elapsed"), delayMs);
22399
22399
  });
22400
22400
  try {
22401
22401
  const outcome = await raceSignalDeadline(elapsed, deadline, callerAbort);
@@ -22704,12 +22704,12 @@ var ThinCommandClient = class {
22704
22704
  }
22705
22705
  const controller = new AbortController();
22706
22706
  let releaseDeadline;
22707
- const deadline = new Promise((resolve2) => {
22708
- releaseDeadline = resolve2;
22707
+ const deadline = new Promise((resolve3) => {
22708
+ releaseDeadline = resolve3;
22709
22709
  });
22710
22710
  let releaseCallerAbort;
22711
- const callerAbort = new Promise((resolve2) => {
22712
- releaseCallerAbort = resolve2;
22711
+ const callerAbort = new Promise((resolve3) => {
22712
+ releaseCallerAbort = resolve3;
22713
22713
  });
22714
22714
  let deadlineReached = false;
22715
22715
  const timer2 = setTimeout(() => {
@@ -23582,7 +23582,7 @@ async function deleteSecureJsonFile(path) {
23582
23582
  }
23583
23583
  }
23584
23584
  async function run(executable, args, input, detached = false) {
23585
- return await new Promise((resolve2, reject) => {
23585
+ return await new Promise((resolve3, reject) => {
23586
23586
  const child = (0, import_node_child_process2.spawn)(executable, args, {
23587
23587
  stdio: ["pipe", "pipe", "pipe"],
23588
23588
  env: process.env,
@@ -23599,7 +23599,7 @@ async function run(executable, args, input, detached = false) {
23599
23599
  stderr += chunk;
23600
23600
  });
23601
23601
  child.on("error", reject);
23602
- child.on("close", (code) => resolve2({ code: code ?? 1, stdout, stderr }));
23602
+ child.on("close", (code) => resolve3({ code: code ?? 1, stdout, stderr }));
23603
23603
  if (input !== void 0) child.stdin.end(`${input}
23604
23604
  `);
23605
23605
  else child.stdin.end();
@@ -24028,9 +24028,9 @@ var originError = /* @__PURE__ */ Symbol("OriginError");
24028
24028
  var CLOSE = {};
24029
24029
  var Query = class extends Promise {
24030
24030
  constructor(strings, args, handler, canceller, options = {}) {
24031
- let resolve2, reject;
24031
+ let resolve3, reject;
24032
24032
  super((a, b2) => {
24033
- resolve2 = a;
24033
+ resolve3 = a;
24034
24034
  reject = b2;
24035
24035
  });
24036
24036
  this.tagged = Array.isArray(strings.raw);
@@ -24041,7 +24041,7 @@ var Query = class extends Promise {
24041
24041
  this.options = options;
24042
24042
  this.state = null;
24043
24043
  this.statement = null;
24044
- this.resolve = (x) => (this.active = false, resolve2(x));
24044
+ this.resolve = (x) => (this.active = false, resolve3(x));
24045
24045
  this.reject = (x) => (this.active = false, reject(x));
24046
24046
  this.active = false;
24047
24047
  this.cancelled = null;
@@ -24089,12 +24089,12 @@ var Query = class extends Promise {
24089
24089
  if (this.executed && !this.active)
24090
24090
  return { done: true };
24091
24091
  prev && prev();
24092
- const promise = new Promise((resolve2, reject) => {
24092
+ const promise = new Promise((resolve3, reject) => {
24093
24093
  this.cursorFn = (value) => {
24094
- resolve2({ value, done: false });
24094
+ resolve3({ value, done: false });
24095
24095
  return new Promise((r) => prev = r);
24096
24096
  };
24097
- this.resolve = () => (this.active = false, resolve2({ done: true }));
24097
+ this.resolve = () => (this.active = false, resolve3({ done: true }));
24098
24098
  this.reject = (x) => (this.active = false, reject(x));
24099
24099
  });
24100
24100
  this.execute();
@@ -24721,12 +24721,12 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
24721
24721
  x.on("drain", drain);
24722
24722
  return x;
24723
24723
  }
24724
- async function cancel({ pid, secret }, resolve2, reject) {
24724
+ async function cancel({ pid, secret }, resolve3, reject) {
24725
24725
  try {
24726
24726
  cancelMessage = bytes_default().i32(16).i32(80877102).i32(pid).i32(secret).end(16);
24727
24727
  await connect();
24728
24728
  socket.once("error", reject);
24729
- socket.once("close", resolve2);
24729
+ socket.once("close", resolve3);
24730
24730
  } catch (error2) {
24731
24731
  reject(error2);
24732
24732
  }
@@ -25673,7 +25673,7 @@ function parseEvent(x) {
25673
25673
  // node_modules/postgres/src/large.js
25674
25674
  var import_stream2 = __toESM(require("stream"), 1);
25675
25675
  function largeObject(sql, oid, mode3 = 131072 | 262144) {
25676
- return new Promise(async (resolve2, reject) => {
25676
+ return new Promise(async (resolve3, reject) => {
25677
25677
  await sql.begin(async (sql2) => {
25678
25678
  let finish;
25679
25679
  !oid && ([{ oid }] = await sql2`select lo_creat(-1) as oid`);
@@ -25699,7 +25699,7 @@ function largeObject(sql, oid, mode3 = 131072 | 262144) {
25699
25699
  ) seek
25700
25700
  `
25701
25701
  };
25702
- resolve2(lo);
25702
+ resolve3(lo);
25703
25703
  return new Promise(async (r) => finish = r);
25704
25704
  async function readable({
25705
25705
  highWaterMark = 2048 * 8,
@@ -25873,8 +25873,8 @@ function Postgres(a, b2) {
25873
25873
  }
25874
25874
  async function reserve() {
25875
25875
  const queue = queue_default();
25876
- const c = open6.length ? open6.shift() : await new Promise((resolve2, reject) => {
25877
- const query = { reserve: resolve2, reject };
25876
+ const c = open6.length ? open6.shift() : await new Promise((resolve3, reject) => {
25877
+ const query = { reserve: resolve3, reject };
25878
25878
  queries.push(query);
25879
25879
  closed.length && connect(closed.shift(), query);
25880
25880
  });
@@ -25911,9 +25911,9 @@ function Postgres(a, b2) {
25911
25911
  let uncaughtError, result;
25912
25912
  name && await sql2`savepoint ${sql2(name)}`;
25913
25913
  try {
25914
- result = await new Promise((resolve2, reject) => {
25914
+ result = await new Promise((resolve3, reject) => {
25915
25915
  const x = fn2(sql2);
25916
- Promise.resolve(Array.isArray(x) ? Promise.all(x) : x).then(resolve2, reject);
25916
+ Promise.resolve(Array.isArray(x) ? Promise.all(x) : x).then(resolve3, reject);
25917
25917
  });
25918
25918
  if (uncaughtError)
25919
25919
  throw uncaughtError;
@@ -25970,8 +25970,8 @@ function Postgres(a, b2) {
25970
25970
  return c.execute(query) ? move(c, busy) : move(c, full);
25971
25971
  }
25972
25972
  function cancel(query) {
25973
- return new Promise((resolve2, reject) => {
25974
- query.state ? query.active ? connection_default(options).cancel(query.state, resolve2, reject) : query.cancelled = { resolve: resolve2, reject } : (queries.remove(query), query.cancelled = true, query.reject(Errors.generic("57014", "canceling statement due to user request")), resolve2());
25973
+ return new Promise((resolve3, reject) => {
25974
+ query.state ? query.active ? connection_default(options).cancel(query.state, resolve3, reject) : query.cancelled = { resolve: resolve3, reject } : (queries.remove(query), query.cancelled = true, query.reject(Errors.generic("57014", "canceling statement due to user request")), resolve3());
25975
25975
  });
25976
25976
  }
25977
25977
  async function end({ timeout = null } = {}) {
@@ -25990,11 +25990,11 @@ function Postgres(a, b2) {
25990
25990
  async function close() {
25991
25991
  await Promise.all(connections.map((c) => c.end()));
25992
25992
  }
25993
- async function destroy(resolve2) {
25993
+ async function destroy(resolve3) {
25994
25994
  await Promise.all(connections.map((c) => c.terminate()));
25995
25995
  while (queries.length)
25996
25996
  queries.shift().reject(Errors.connection("CONNECTION_DESTROYED", options));
25997
- resolve2();
25997
+ resolve3();
25998
25998
  }
25999
25999
  function connect(c, query) {
26000
26000
  move(c, connecting);
@@ -29127,8 +29127,8 @@ async function fetchSignalRead(fetcher, input, init, timeoutMs = SIGNAL_READ_TIM
29127
29127
  const signal = init.signal ? AbortSignal.any([init.signal, deadlineController.signal]) : deadlineController.signal;
29128
29128
  let onAbort = () => {
29129
29129
  };
29130
- const aborted = new Promise((resolve2) => {
29131
- onAbort = () => resolve2("timeout");
29130
+ const aborted = new Promise((resolve3) => {
29131
+ onAbort = () => resolve3("timeout");
29132
29132
  if (signal.aborted) {
29133
29133
  onAbort();
29134
29134
  } else {
@@ -29185,7 +29185,7 @@ async function fetchSignalRead(fetcher, input, init, timeoutMs = SIGNAL_READ_TIM
29185
29185
  }
29186
29186
  var READ_RETRY_ATTEMPTS = 2;
29187
29187
  var READ_RETRY_BASE_MS = 250;
29188
- async function fetchSignalReadRetrying(fetcher, input, init, timeoutMs = SIGNAL_READ_TIMEOUT_MS, sleep2 = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms))) {
29188
+ async function fetchSignalReadRetrying(fetcher, input, init, timeoutMs = SIGNAL_READ_TIMEOUT_MS, sleep2 = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms))) {
29189
29189
  let result = await fetchSignalRead(fetcher, input, init, timeoutMs);
29190
29190
  for (let attempt = 1; attempt <= READ_RETRY_ATTEMPTS; attempt += 1) {
29191
29191
  if (result === null || result.response.ok) return result;
@@ -29507,7 +29507,7 @@ function nextWaitSleepMs(nowMs, deadlineMs, pollMs = SIGNAL_WAIT_POLL_MS) {
29507
29507
  }
29508
29508
  async function pollForSignals(options) {
29509
29509
  const now = options.now ?? Date.now;
29510
- const sleep2 = options.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
29510
+ const sleep2 = options.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
29511
29511
  const pollMs = options.pollMs ?? SIGNAL_WAIT_POLL_MS;
29512
29512
  const probe = async () => {
29513
29513
  try {
@@ -29885,14 +29885,14 @@ async function runInboxFollow(options) {
29885
29885
  let timer2;
29886
29886
  let onAbort;
29887
29887
  try {
29888
- await new Promise((resolve2) => {
29888
+ await new Promise((resolve3) => {
29889
29889
  let settled = false;
29890
29890
  const finish = () => {
29891
29891
  if (settled) return;
29892
29892
  settled = true;
29893
29893
  if (timer2 !== void 0) clearTimeout(timer2);
29894
29894
  if (onAbort && abort) abort.removeEventListener("abort", onAbort);
29895
- resolve2();
29895
+ resolve3();
29896
29896
  };
29897
29897
  if (abort) {
29898
29898
  if (abort.aborted) {
@@ -30179,7 +30179,7 @@ function notifyWriteError(error) {
30179
30179
  return error.code === "EPIPE" ? new NotifyStdoutClosedError() : error;
30180
30180
  }
30181
30181
  async function writeArrivalMonitorLine(line, stream2 = process.stdout) {
30182
- await new Promise((resolve2, reject) => {
30182
+ await new Promise((resolve3, reject) => {
30183
30183
  let settled = false;
30184
30184
  const finish = (error) => {
30185
30185
  if (settled) return;
@@ -30189,7 +30189,7 @@ async function writeArrivalMonitorLine(line, stream2 = process.stdout) {
30189
30189
  reject(notifyWriteError(error));
30190
30190
  } else {
30191
30191
  stream2.off("error", onError);
30192
- resolve2();
30192
+ resolve3();
30193
30193
  }
30194
30194
  };
30195
30195
  const onError = (error) => finish(error);
@@ -30224,15 +30224,15 @@ async function runArrivalWatch(options) {
30224
30224
  await options.sleep(ms);
30225
30225
  return;
30226
30226
  }
30227
- await new Promise((resolve2) => {
30227
+ await new Promise((resolve3) => {
30228
30228
  let timer2;
30229
30229
  const finish = () => {
30230
30230
  if (timer2 !== void 0) clearTimeout(timer2);
30231
30231
  options.signal?.removeEventListener("abort", finish);
30232
- resolve2();
30232
+ resolve3();
30233
30233
  };
30234
30234
  if (cancelled() || ms <= 0) {
30235
- resolve2();
30235
+ resolve3();
30236
30236
  return;
30237
30237
  }
30238
30238
  options.signal?.addEventListener("abort", finish, { once: true });
@@ -31296,12 +31296,12 @@ var AcpTransport = class extends import_node_events.EventEmitter {
31296
31296
  method,
31297
31297
  ...params !== void 0 ? { params } : {}
31298
31298
  };
31299
- return new Promise((resolve2, reject) => {
31299
+ return new Promise((resolve3, reject) => {
31300
31300
  const timer2 = setTimeout(() => {
31301
31301
  this.pending.delete(key2);
31302
31302
  reject(new AcpTimeoutError(`ACP request timed out: ${method}`));
31303
31303
  }, timeoutMs ?? this.requestTimeoutMs);
31304
- this.pending.set(key2, { resolve: resolve2, reject, timer: timer2, method });
31304
+ this.pending.set(key2, { resolve: resolve3, reject, timer: timer2, method });
31305
31305
  try {
31306
31306
  this.writeFrame(frame);
31307
31307
  } catch (err) {
@@ -32306,7 +32306,7 @@ async function assertOpenCodeVersionFloor(executable, options) {
32306
32306
  const lastMeasuredVersion = options?.lastMeasuredVersion ?? OPENCODE_LAST_MEASURED_VERSION;
32307
32307
  const timeoutMs = options?.timeoutMs ?? ACP_VERSION_CHECK_TIMEOUT_MS;
32308
32308
  const env = sanitizeChildEnv(options?.env ?? process.env);
32309
- const stdout = await new Promise((resolve2, reject) => {
32309
+ const stdout = await new Promise((resolve3, reject) => {
32310
32310
  (0, import_node_child_process3.execFile)(
32311
32311
  executable,
32312
32312
  ["--version"],
@@ -32320,7 +32320,7 @@ async function assertOpenCodeVersionFloor(executable, options) {
32320
32320
  );
32321
32321
  return;
32322
32322
  }
32323
- resolve2(out);
32323
+ resolve3(out);
32324
32324
  }
32325
32325
  );
32326
32326
  });
@@ -32505,7 +32505,7 @@ async function assertOpenCodeEffectiveConfig(options) {
32505
32505
  `,
32506
32506
  { mode: 384 }
32507
32507
  );
32508
- const stdout = await new Promise((resolve2, reject) => {
32508
+ const stdout = await new Promise((resolve3, reject) => {
32509
32509
  (0, import_node_child_process3.execFile)(
32510
32510
  options.executable,
32511
32511
  ["debug", "config", "--pure"],
@@ -32525,7 +32525,7 @@ async function assertOpenCodeEffectiveConfig(options) {
32525
32525
  );
32526
32526
  return;
32527
32527
  }
32528
- resolve2(out);
32528
+ resolve3(out);
32529
32529
  }
32530
32530
  );
32531
32531
  });
@@ -32644,11 +32644,11 @@ function waitForChildExit(child, timeoutMs) {
32644
32644
  if (child.exitCode !== null || child.signalCode !== null) {
32645
32645
  return Promise.resolve();
32646
32646
  }
32647
- return new Promise((resolve2) => {
32648
- const timer2 = setTimeout(() => resolve2(), timeoutMs);
32647
+ return new Promise((resolve3) => {
32648
+ const timer2 = setTimeout(() => resolve3(), timeoutMs);
32649
32649
  child.once("exit", () => {
32650
32650
  clearTimeout(timer2);
32651
- resolve2();
32651
+ resolve3();
32652
32652
  });
32653
32653
  });
32654
32654
  }
@@ -32949,7 +32949,7 @@ async function readClaudeVersionOutput(executable, options) {
32949
32949
  const timeoutMs = options?.timeoutMs ?? ACP_VERSION_CHECK_TIMEOUT_MS;
32950
32950
  const env = options?.env ?? sanitizeChildEnv(process.env);
32951
32951
  const launch = buildClaudeLaunch(executable, ["--version"], options?.platform);
32952
- return await new Promise((resolve2, reject) => {
32952
+ return await new Promise((resolve3, reject) => {
32953
32953
  (0, import_node_child_process4.execFile)(
32954
32954
  launch.command,
32955
32955
  launch.args,
@@ -32963,7 +32963,7 @@ async function readClaudeVersionOutput(executable, options) {
32963
32963
  );
32964
32964
  return;
32965
32965
  }
32966
- resolve2(out);
32966
+ resolve3(out);
32967
32967
  }
32968
32968
  );
32969
32969
  });
@@ -32998,11 +32998,11 @@ function waitForChildExit2(child, timeoutMs) {
32998
32998
  if (child.exitCode !== null || child.signalCode !== null) {
32999
32999
  return Promise.resolve();
33000
33000
  }
33001
- return new Promise((resolve2) => {
33002
- const timer2 = setTimeout(resolve2, timeoutMs);
33001
+ return new Promise((resolve3) => {
33002
+ const timer2 = setTimeout(resolve3, timeoutMs);
33003
33003
  child.once("exit", () => {
33004
33004
  clearTimeout(timer2);
33005
- resolve2();
33005
+ resolve3();
33006
33006
  });
33007
33007
  });
33008
33008
  }
@@ -33322,7 +33322,7 @@ async function assertCodexVersionFloor(executable, options) {
33322
33322
  const timeoutMs = options?.timeoutMs ?? ACP_VERSION_CHECK_TIMEOUT_MS;
33323
33323
  const env = options?.env ?? sanitizeChildEnv(process.env);
33324
33324
  const launch = buildCodexLaunch(executable, ["--version"], options?.platform);
33325
- const stdout = await new Promise((resolve2, reject) => {
33325
+ const stdout = await new Promise((resolve3, reject) => {
33326
33326
  (0, import_node_child_process5.execFile)(
33327
33327
  launch.command,
33328
33328
  launch.args,
@@ -33336,7 +33336,7 @@ async function assertCodexVersionFloor(executable, options) {
33336
33336
  );
33337
33337
  return;
33338
33338
  }
33339
- resolve2(out);
33339
+ resolve3(out);
33340
33340
  }
33341
33341
  );
33342
33342
  });
@@ -33376,11 +33376,11 @@ function waitForChildExit3(child, timeoutMs) {
33376
33376
  if (child.exitCode !== null || child.signalCode !== null) {
33377
33377
  return Promise.resolve();
33378
33378
  }
33379
- return new Promise((resolve2) => {
33380
- const timer2 = setTimeout(resolve2, timeoutMs);
33379
+ return new Promise((resolve3) => {
33380
+ const timer2 = setTimeout(resolve3, timeoutMs);
33381
33381
  child.once("exit", () => {
33382
33382
  clearTimeout(timer2);
33383
- resolve2();
33383
+ resolve3();
33384
33384
  });
33385
33385
  });
33386
33386
  }
@@ -34373,7 +34373,7 @@ async function assertGrokVersionFloor(executable, options) {
34373
34373
  const minimumVersion = options?.minimumVersion ?? GROK_MIN_VERSION;
34374
34374
  const lastMeasuredVersion = options?.lastMeasuredVersion ?? GROK_LAST_MEASURED_VERSION;
34375
34375
  const timeoutMs = options?.timeoutMs ?? ACP_VERSION_CHECK_TIMEOUT_MS;
34376
- const stdout = await new Promise((resolve2, reject) => {
34376
+ const stdout = await new Promise((resolve3, reject) => {
34377
34377
  (0, import_node_child_process6.execFile)(
34378
34378
  executable,
34379
34379
  ["--version"],
@@ -34387,7 +34387,7 @@ async function assertGrokVersionFloor(executable, options) {
34387
34387
  );
34388
34388
  return;
34389
34389
  }
34390
- resolve2(out);
34390
+ resolve3(out);
34391
34391
  }
34392
34392
  );
34393
34393
  });
@@ -34430,11 +34430,11 @@ function waitForChildExit4(child, timeoutMs) {
34430
34430
  if (child.exitCode !== null || child.signalCode !== null) {
34431
34431
  return Promise.resolve();
34432
34432
  }
34433
- return new Promise((resolve2) => {
34434
- const timer2 = setTimeout(resolve2, timeoutMs);
34433
+ return new Promise((resolve3) => {
34434
+ const timer2 = setTimeout(resolve3, timeoutMs);
34435
34435
  child.once("exit", () => {
34436
34436
  clearTimeout(timer2);
34437
- resolve2();
34437
+ resolve3();
34438
34438
  });
34439
34439
  });
34440
34440
  }
@@ -34845,10 +34845,10 @@ var OpenCodeListenerModel = class {
34845
34845
  try {
34846
34846
  await Promise.race([
34847
34847
  entry.settlePromise,
34848
- new Promise((resolve2) => {
34848
+ new Promise((resolve3) => {
34849
34849
  entry.timer = setTimeout(() => {
34850
34850
  timedOut = true;
34851
- resolve2();
34851
+ resolve3();
34852
34852
  }, this.pendingOpenWaitMs);
34853
34853
  })
34854
34854
  ]);
@@ -34956,10 +34956,10 @@ var OpenCodeListenerModel = class {
34956
34956
  });
34957
34957
  this.workerHome = home;
34958
34958
  let markSettled;
34959
- const settlePromise = new Promise((resolve2, reject) => {
34959
+ const settlePromise = new Promise((resolve3, reject) => {
34960
34960
  markSettled = (err) => {
34961
34961
  if (err) reject(err);
34962
- else resolve2();
34962
+ else resolve3();
34963
34963
  };
34964
34964
  });
34965
34965
  void settlePromise.catch(() => void 0);
@@ -35995,8 +35995,8 @@ var DeliveryCommandClient = class {
35995
35995
  const signal = deadlineController.signal;
35996
35996
  let onAbort = () => {
35997
35997
  };
35998
- const aborted = new Promise((resolve2) => {
35999
- onAbort = () => resolve2("timeout");
35998
+ const aborted = new Promise((resolve3) => {
35999
+ onAbort = () => resolve3("timeout");
36000
36000
  if (signal.aborted) {
36001
36001
  onAbort();
36002
36002
  } else {
@@ -36476,12 +36476,12 @@ function eventTime(now) {
36476
36476
  }
36477
36477
  async function defaultSleep(ms, signal) {
36478
36478
  if (signal?.aborted) return;
36479
- await new Promise((resolve2) => {
36479
+ await new Promise((resolve3) => {
36480
36480
  let timer2;
36481
36481
  const finish = () => {
36482
36482
  if (timer2 !== void 0) clearTimeout(timer2);
36483
36483
  signal?.removeEventListener("abort", finish);
36484
- resolve2();
36484
+ resolve3();
36485
36485
  };
36486
36486
  signal?.addEventListener("abort", finish, { once: true });
36487
36487
  timer2 = setTimeout(finish, ms);
@@ -37729,6 +37729,7 @@ function summarizeListenerReadHealth(health, readyAt, nowMs) {
37729
37729
  }
37730
37730
 
37731
37731
  // src/listener/control.ts
37732
+ var import_node_crypto19 = require("node:crypto");
37732
37733
  var import_node_net = require("node:net");
37733
37734
  var import_promises9 = require("node:fs/promises");
37734
37735
  var import_node_path16 = require("node:path");
@@ -37746,15 +37747,19 @@ var ListenerAlreadyRunningError = class extends Error {
37746
37747
  }
37747
37748
  };
37748
37749
  function listenerPaths(options) {
37749
- const root = options.stateDirectory ?? defaultListenerStateDirectory();
37750
+ const defaultRoot = defaultListenerStateDirectory();
37751
+ const root = options.stateDirectory ?? defaultRoot;
37750
37752
  if (!(0, import_node_path16.isAbsolute)(root)) {
37751
37753
  throw new Error("listener state directory must be absolute");
37752
37754
  }
37753
37755
  const key2 = listenerInstanceKey(options);
37754
37756
  const instanceDirectory = (0, import_node_path16.join)(root, key2);
37755
37757
  const uid2 = typeof process.getuid === "function" ? process.getuid() : process.pid;
37756
- const controlDirectory = process.platform === "win32" ? "" : (0, import_node_path16.join)("/tmp", `cswarm-control-${uid2}`);
37757
- const socketPath = process.platform === "win32" ? `\\\\.\\pipe\\cswarm-${key2}` : (0, import_node_path16.join)(controlDirectory, `${key2.slice(0, 32)}.sock`);
37758
+ const stateNamespace = (0, import_node_path16.resolve)(root) === (0, import_node_path16.resolve)(defaultRoot) ? "" : `-${(0, import_node_crypto19.createHash)("sha256").update((0, import_node_path16.resolve)(root)).digest("hex").slice(0, 16)}`;
37759
+ const platform = options.platform ?? process.platform;
37760
+ const socketKey = stateNamespace.length === 0 ? platform === "win32" ? key2 : key2.slice(0, 32) : `${key2.slice(0, 32)}${stateNamespace}`;
37761
+ const controlDirectory = platform === "win32" ? "" : (0, import_node_path16.join)("/tmp", `cswarm-control-${uid2}`);
37762
+ const socketPath = platform === "win32" ? `\\\\.\\pipe\\cswarm-${socketKey}` : (0, import_node_path16.join)(controlDirectory, `${socketKey}.sock`);
37758
37763
  return {
37759
37764
  key: key2,
37760
37765
  instanceDirectory,
@@ -37803,7 +37808,16 @@ var STATUS_ALLOWED_KEYS = /* @__PURE__ */ new Set([
37803
37808
  "droppedForMainCount",
37804
37809
  "readHealth",
37805
37810
  "connectionsOpened",
37806
- "connectionReuseRatio"
37811
+ "connectionReuseRatio",
37812
+ "activityPublishFailures",
37813
+ "activityLastErrorCode"
37814
+ ]);
37815
+ var STATUS_ACTIVITY_ERROR_CODES = /* @__PURE__ */ new Set([
37816
+ "activity_credential_failed",
37817
+ "activity_request_timeout",
37818
+ "activity_transport_failed",
37819
+ "activity_http_rejected",
37820
+ "activity_publish_unknown"
37807
37821
  ]);
37808
37822
  var STATUS_SENSITIVE_KEYS = /* @__PURE__ */ new Set([
37809
37823
  "leaseId",
@@ -37852,7 +37866,9 @@ function parseStatus(raw, rejectUnknownKeys = false) {
37852
37866
  const nullableCount = (candidate) => candidate === null || typeof candidate === "number" && Number.isSafeInteger(candidate) && candidate >= 0;
37853
37867
  const nullableTimestamp3 = (candidate) => candidate === null || typeof candidate === "string" && Number.isFinite(Date.parse(candidate));
37854
37868
  const readHealth = row.readHealth === void 0 ? void 0 : parseListenerReadHealth(row.readHealth, rejectUnknownKeys);
37855
- if (row.version !== 1 || typeof row.instanceId !== "string" || !UUID_RE17.test(row.instanceId) || row.provider !== "grok" && row.provider !== "opencode" && row.provider !== "claude" && row.provider !== "codex" || typeof row.profileId !== "string" || typeof row.workspaceId !== "string" || !UUID_RE17.test(row.workspaceId) || typeof row.principalId !== "string" || !UUID_RE17.test(row.principalId) || !Number.isSafeInteger(row.pid) || row.pid < 1 || typeof row.state !== "string" || !["starting", "ready", "stopping", "stopped", "failed"].includes(row.state) || typeof row.startedAt !== "string" || !Number.isFinite(Date.parse(row.startedAt)) || !(row.readyAt === null || typeof row.readyAt === "string" && Number.isFinite(Date.parse(row.readyAt))) || typeof row.updatedAt !== "string" || !Number.isFinite(Date.parse(row.updatedAt)) || !(row.stoppedAt === null || typeof row.stoppedAt === "string" && Number.isFinite(Date.parse(row.stoppedAt))) || !nullableUuid3(row.lastSignalId) || !(row.lastErrorCode === null || typeof row.lastErrorCode === "string" && /^[a-z0-9_-]{1,96}$/.test(row.lastErrorCode)) || !(row.lastErrorDetail === void 0 || row.lastErrorDetail === null || typeof row.lastErrorDetail === "string" && row.lastErrorDetail.length > 0 && row.lastErrorDetail.length <= 2048 && !/swm_(?:agt|inv|cap)_/i.test(row.lastErrorDetail)) || !(row.lastErrorReasonCode === void 0 || row.lastErrorReasonCode === null || typeof row.lastErrorReasonCode === "string" && /^[a-z0-9_-]{1,96}$/.test(row.lastErrorReasonCode)) || !(row.providerExecutable === void 0 || row.providerExecutable === null || typeof row.providerExecutable === "string" && (0, import_node_path16.isAbsolute)(row.providerExecutable)) || !(row.providerVersion === void 0 || row.providerVersion === null || typeof row.providerVersion === "string" && SEMVER_RE2.test(row.providerVersion)) || !(row.providerLastMeasuredVersion === void 0 || row.providerLastMeasuredVersion === null || typeof row.providerLastMeasuredVersion === "string" && SEMVER_RE2.test(row.providerLastMeasuredVersion)) || !(row.providerBundledAgentSdkVersion === void 0 || row.providerBundledAgentSdkVersion === null || typeof row.providerBundledAgentSdkVersion === "string" && SEMVER_RE2.test(row.providerBundledAgentSdkVersion)) || !(row.providerBundledClaudeCodeVersion === void 0 || row.providerBundledClaudeCodeVersion === null || typeof row.providerBundledClaudeCodeVersion === "string" && SEMVER_RE2.test(row.providerBundledClaudeCodeVersion)) || !(row.providerMinimumRequiredVersion === void 0 || row.providerMinimumRequiredVersion === null || typeof row.providerMinimumRequiredVersion === "string" && SEMVER_RE2.test(row.providerMinimumRequiredVersion)) || !(row.cswarmVersion === void 0 || row.cswarmVersion === null || typeof row.cswarmVersion === "string" && SEMVER_RE2.test(row.cswarmVersion)) || (row.providerVersion === null || row.providerVersion === void 0) !== (row.providerLastMeasuredVersion === null || row.providerLastMeasuredVersion === void 0) || !(row.lastWorkerStderrTail === void 0 || row.lastWorkerStderrTail === null || typeof row.lastWorkerStderrTail === "string" && row.lastWorkerStderrTail.length > 0 && row.lastWorkerStderrTail.length <= 2048 && !/swm_(?:agt|inv|cap)_/i.test(row.lastWorkerStderrTail)) || typeof row.logPath !== "string" || !(0, import_node_path16.isAbsolute)(row.logPath) || !(row.deliveryMode === void 0 || row.deliveryMode === null || typeof row.deliveryMode === "string" && STATUS_DELIVERY_MODES.has(row.deliveryMode)) || !(row.pendingDeliveryCount === void 0 || nullableCount(row.pendingDeliveryCount)) || !(row.lastTerminalDeliveryFailureCount === void 0 || nullableCount(row.lastTerminalDeliveryFailureCount)) || !(row.lastTerminalDeliveryFailureAt === void 0 || nullableTimestamp3(row.lastTerminalDeliveryFailureAt)) || !(row.lastClaimAt === void 0 || nullableTimestamp3(row.lastClaimAt)) || !(row.lastAckAt === void 0 || nullableTimestamp3(row.lastAckAt)) || !(row.routeMode === void 0 || row.routeMode === "worker" || row.routeMode === "main" || row.routeMode === "split") || !(row.deferOverChars === void 0 || row.deferOverChars === null || typeof row.deferOverChars === "number" && Number.isSafeInteger(row.deferOverChars) && row.deferOverChars >= 1 && row.deferOverChars <= 1e4) || !(row.pendingForMainCount === void 0 || typeof row.pendingForMainCount === "number" && Number.isSafeInteger(row.pendingForMainCount) && row.pendingForMainCount >= 0) || !(row.droppedForMainCount === void 0 || typeof row.droppedForMainCount === "number" && Number.isSafeInteger(row.droppedForMainCount) && row.droppedForMainCount >= 0) || readHealth === null || !(row.connectionsOpened === void 0 || typeof row.connectionsOpened === "number" && Number.isSafeInteger(row.connectionsOpened) && row.connectionsOpened >= 0) || !(row.connectionReuseRatio === void 0 || typeof row.connectionReuseRatio === "number" && Number.isFinite(row.connectionReuseRatio) && row.connectionReuseRatio >= 0)) {
37869
+ if (row.version !== 1 || typeof row.instanceId !== "string" || !UUID_RE17.test(row.instanceId) || row.provider !== "grok" && row.provider !== "opencode" && row.provider !== "claude" && row.provider !== "codex" || typeof row.profileId !== "string" || typeof row.workspaceId !== "string" || !UUID_RE17.test(row.workspaceId) || typeof row.principalId !== "string" || !UUID_RE17.test(row.principalId) || !Number.isSafeInteger(row.pid) || row.pid < 1 || typeof row.state !== "string" || !["starting", "ready", "stopping", "stopped", "failed"].includes(row.state) || typeof row.startedAt !== "string" || !Number.isFinite(Date.parse(row.startedAt)) || !(row.readyAt === null || typeof row.readyAt === "string" && Number.isFinite(Date.parse(row.readyAt))) || typeof row.updatedAt !== "string" || !Number.isFinite(Date.parse(row.updatedAt)) || !(row.stoppedAt === null || typeof row.stoppedAt === "string" && Number.isFinite(Date.parse(row.stoppedAt))) || !nullableUuid3(row.lastSignalId) || !(row.lastErrorCode === null || typeof row.lastErrorCode === "string" && /^[a-z0-9_-]{1,96}$/.test(row.lastErrorCode)) || !(row.lastErrorDetail === void 0 || row.lastErrorDetail === null || typeof row.lastErrorDetail === "string" && row.lastErrorDetail.length > 0 && row.lastErrorDetail.length <= 2048 && !/swm_(?:agt|inv|cap)_/i.test(row.lastErrorDetail)) || !(row.lastErrorReasonCode === void 0 || row.lastErrorReasonCode === null || typeof row.lastErrorReasonCode === "string" && /^[a-z0-9_-]{1,96}$/.test(row.lastErrorReasonCode)) || !(row.providerExecutable === void 0 || row.providerExecutable === null || typeof row.providerExecutable === "string" && (0, import_node_path16.isAbsolute)(row.providerExecutable)) || !(row.providerVersion === void 0 || row.providerVersion === null || typeof row.providerVersion === "string" && SEMVER_RE2.test(row.providerVersion)) || !(row.providerLastMeasuredVersion === void 0 || row.providerLastMeasuredVersion === null || typeof row.providerLastMeasuredVersion === "string" && SEMVER_RE2.test(row.providerLastMeasuredVersion)) || !(row.providerBundledAgentSdkVersion === void 0 || row.providerBundledAgentSdkVersion === null || typeof row.providerBundledAgentSdkVersion === "string" && SEMVER_RE2.test(row.providerBundledAgentSdkVersion)) || !(row.providerBundledClaudeCodeVersion === void 0 || row.providerBundledClaudeCodeVersion === null || typeof row.providerBundledClaudeCodeVersion === "string" && SEMVER_RE2.test(row.providerBundledClaudeCodeVersion)) || !(row.providerMinimumRequiredVersion === void 0 || row.providerMinimumRequiredVersion === null || typeof row.providerMinimumRequiredVersion === "string" && SEMVER_RE2.test(row.providerMinimumRequiredVersion)) || !(row.cswarmVersion === void 0 || row.cswarmVersion === null || typeof row.cswarmVersion === "string" && SEMVER_RE2.test(row.cswarmVersion)) || (row.providerVersion === null || row.providerVersion === void 0) !== (row.providerLastMeasuredVersion === null || row.providerLastMeasuredVersion === void 0) || !(row.lastWorkerStderrTail === void 0 || row.lastWorkerStderrTail === null || typeof row.lastWorkerStderrTail === "string" && row.lastWorkerStderrTail.length > 0 && row.lastWorkerStderrTail.length <= 2048 && !/swm_(?:agt|inv|cap)_/i.test(row.lastWorkerStderrTail)) || typeof row.logPath !== "string" || !(0, import_node_path16.isAbsolute)(row.logPath) || !(row.deliveryMode === void 0 || row.deliveryMode === null || typeof row.deliveryMode === "string" && STATUS_DELIVERY_MODES.has(row.deliveryMode)) || !(row.pendingDeliveryCount === void 0 || nullableCount(row.pendingDeliveryCount)) || !(row.lastTerminalDeliveryFailureCount === void 0 || nullableCount(row.lastTerminalDeliveryFailureCount)) || !(row.lastTerminalDeliveryFailureAt === void 0 || nullableTimestamp3(row.lastTerminalDeliveryFailureAt)) || !(row.lastClaimAt === void 0 || nullableTimestamp3(row.lastClaimAt)) || !(row.lastAckAt === void 0 || nullableTimestamp3(row.lastAckAt)) || !(row.routeMode === void 0 || row.routeMode === "worker" || row.routeMode === "main" || row.routeMode === "split") || !(row.deferOverChars === void 0 || row.deferOverChars === null || typeof row.deferOverChars === "number" && Number.isSafeInteger(row.deferOverChars) && row.deferOverChars >= 1 && row.deferOverChars <= 1e4) || !(row.pendingForMainCount === void 0 || typeof row.pendingForMainCount === "number" && Number.isSafeInteger(row.pendingForMainCount) && row.pendingForMainCount >= 0) || !(row.droppedForMainCount === void 0 || typeof row.droppedForMainCount === "number" && Number.isSafeInteger(row.droppedForMainCount) && row.droppedForMainCount >= 0) || readHealth === null || !(row.connectionsOpened === void 0 || typeof row.connectionsOpened === "number" && Number.isSafeInteger(row.connectionsOpened) && row.connectionsOpened >= 0) || !(row.connectionReuseRatio === void 0 || typeof row.connectionReuseRatio === "number" && Number.isFinite(row.connectionReuseRatio) && row.connectionReuseRatio >= 0) || !(row.activityPublishFailures === void 0 || typeof row.activityPublishFailures === "number" && Number.isSafeInteger(row.activityPublishFailures) && row.activityPublishFailures >= 0) || !(row.activityLastErrorCode === void 0 || row.activityLastErrorCode === null || typeof row.activityLastErrorCode === "string" && STATUS_ACTIVITY_ERROR_CODES.has(
37870
+ row.activityLastErrorCode
37871
+ ))) {
37856
37872
  throw new Error("stored listener status is malformed");
37857
37873
  }
37858
37874
  const routeMode = row.routeMode ?? "worker";
@@ -38111,7 +38127,7 @@ async function startupLock(paths) {
38111
38127
  await (0, import_promises9.unlink)(lockPath).catch(() => void 0);
38112
38128
  continue;
38113
38129
  }
38114
- await new Promise((resolve2) => setTimeout(resolve2, 25));
38130
+ await new Promise((resolve3) => setTimeout(resolve3, 25));
38115
38131
  continue;
38116
38132
  }
38117
38133
  try {
@@ -38185,14 +38201,14 @@ async function startListenerControlServer(options) {
38185
38201
  if (options.initialize) {
38186
38202
  await options.initialize();
38187
38203
  }
38188
- await new Promise((resolve2, reject) => {
38204
+ await new Promise((resolve3, reject) => {
38189
38205
  const onError = (error) => {
38190
38206
  server.off("listening", onListening);
38191
38207
  reject(error);
38192
38208
  };
38193
38209
  const onListening = () => {
38194
38210
  server.off("error", onError);
38195
- resolve2();
38211
+ resolve3();
38196
38212
  };
38197
38213
  server.once("error", onError);
38198
38214
  server.once("listening", onListening);
@@ -38203,7 +38219,7 @@ async function startListenerControlServer(options) {
38203
38219
  }
38204
38220
  } catch (error) {
38205
38221
  if (server.listening) {
38206
- await new Promise((resolve2) => server.close(() => resolve2()));
38222
+ await new Promise((resolve3) => server.close(() => resolve3()));
38207
38223
  if (process.platform !== "win32") {
38208
38224
  await (0, import_promises9.unlink)(options.paths.socketPath).catch(() => void 0);
38209
38225
  }
@@ -38214,7 +38230,7 @@ async function startListenerControlServer(options) {
38214
38230
  }
38215
38231
  return {
38216
38232
  close: async () => {
38217
- await new Promise((resolve2) => server.close(() => resolve2()));
38233
+ await new Promise((resolve3) => server.close(() => resolve3()));
38218
38234
  if (process.platform !== "win32") {
38219
38235
  await (0, import_promises9.unlink)(options.paths.socketPath).catch(() => void 0);
38220
38236
  }
@@ -38222,7 +38238,7 @@ async function startListenerControlServer(options) {
38222
38238
  };
38223
38239
  }
38224
38240
  async function queryListenerControl(paths, command2, timeoutMs = CONTROL_TIMEOUT_MS) {
38225
- return await new Promise((resolve2, reject) => {
38241
+ return await new Promise((resolve3, reject) => {
38226
38242
  const socket = (0, import_node_net.createConnection)(paths.socketPath);
38227
38243
  let input = "";
38228
38244
  let settled = false;
@@ -38236,7 +38252,7 @@ async function queryListenerControl(paths, command2, timeoutMs = CONTROL_TIMEOUT
38236
38252
  clearTimeout(timer2);
38237
38253
  socket.destroy();
38238
38254
  if (error) reject(error);
38239
- else resolve2(status);
38255
+ else resolve3(status);
38240
38256
  };
38241
38257
  socket.setEncoding("utf8");
38242
38258
  socket.once("error", (error) => finish(error));
@@ -38267,7 +38283,7 @@ async function queryListenerControl(paths, command2, timeoutMs = CONTROL_TIMEOUT
38267
38283
  }
38268
38284
 
38269
38285
  // src/listener/supervisor.ts
38270
- var import_node_crypto19 = require("node:crypto");
38286
+ var import_node_crypto20 = require("node:crypto");
38271
38287
  var UUID_RE18 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
38272
38288
  var LISTENER_RESTART_MAX_ATTEMPTS = 5;
38273
38289
  var LISTENER_RESTART_INITIAL_MS = 1e3;
@@ -38281,11 +38297,11 @@ function nextListenerRestartMs(attempt, policy = {}, random = Math.random) {
38281
38297
  }
38282
38298
  async function defaultRestartSleep(ms, signal) {
38283
38299
  if (ms <= 0 || signal.aborted) return;
38284
- await new Promise((resolve2) => {
38300
+ await new Promise((resolve3) => {
38285
38301
  const finish = () => {
38286
38302
  clearTimeout(timer2);
38287
38303
  signal.removeEventListener("abort", finish);
38288
- resolve2();
38304
+ resolve3();
38289
38305
  };
38290
38306
  const timer2 = setTimeout(finish, ms);
38291
38307
  signal.addEventListener("abort", finish, { once: true });
@@ -38365,7 +38381,7 @@ async function runListenerSupervisor(options) {
38365
38381
  const now = options.now ?? Date.now;
38366
38382
  const startedAt = iso2(now);
38367
38383
  const controller = new AbortController();
38368
- const proposedInstanceId = (0, import_node_crypto19.randomUUID)();
38384
+ const proposedInstanceId = (0, import_node_crypto20.randomUUID)();
38369
38385
  let status = {
38370
38386
  version: 1,
38371
38387
  instanceId: proposedInstanceId,
@@ -38405,6 +38421,8 @@ async function runListenerSupervisor(options) {
38405
38421
  readHealth: emptyListenerReadHealth(),
38406
38422
  connectionsOpened: 0,
38407
38423
  connectionReuseRatio: 0,
38424
+ activityPublishFailures: 0,
38425
+ activityLastErrorCode: null,
38408
38426
  logPath: options.paths.logPath
38409
38427
  };
38410
38428
  let writes = Promise.resolve();
@@ -38585,6 +38603,16 @@ async function runListenerSupervisor(options) {
38585
38603
  });
38586
38604
  return;
38587
38605
  }
38606
+ if (event.type === "activity_publish_failure") {
38607
+ status = {
38608
+ ...status,
38609
+ activityPublishFailures: (status.activityPublishFailures ?? 0) + 1,
38610
+ activityLastErrorCode: event.code,
38611
+ updatedAt: event.ts
38612
+ };
38613
+ persist();
38614
+ return;
38615
+ }
38588
38616
  if (event.type === "model_declared") {
38589
38617
  log({
38590
38618
  ts: event.ts,
@@ -38843,7 +38871,7 @@ async function waitForListenerReady(paths, options = {}) {
38843
38871
  const timeoutMs = options.timeoutMs ?? 12e4;
38844
38872
  const pollMs = options.pollMs ?? 100;
38845
38873
  const now = options.now ?? Date.now;
38846
- const sleep2 = options.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
38874
+ const sleep2 = options.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms)));
38847
38875
  const deadline = now() + timeoutMs;
38848
38876
  let last = null;
38849
38877
  let processExitObservedAt = null;
@@ -39715,12 +39743,12 @@ async function spawnDetachedListener(options) {
39715
39743
  child.kill();
39716
39744
  throw new Error("detached listener child has no credential pipe");
39717
39745
  }
39718
- await new Promise((resolve2, reject) => {
39746
+ await new Promise((resolve3, reject) => {
39719
39747
  const onError = (error) => reject(error);
39720
39748
  child.once("error", onError);
39721
39749
  child.stdin.end(options.credentialArtifact, "utf8", () => {
39722
39750
  child.off("error", onError);
39723
- resolve2();
39751
+ resolve3();
39724
39752
  });
39725
39753
  });
39726
39754
  child.unref();
@@ -40511,10 +40539,10 @@ async function runListenerHookCheck(options = {}) {
40511
40539
  signal: controller.signal,
40512
40540
  deadlineMs
40513
40541
  });
40514
- const timedOut = new Promise((resolve2) => {
40542
+ const timedOut = new Promise((resolve3) => {
40515
40543
  timer2 = setTimeout(() => {
40516
40544
  controller.abort();
40517
- resolve2("");
40545
+ resolve3("");
40518
40546
  }, HOOK_CHECK_TIMEOUT_MS);
40519
40547
  });
40520
40548
  return await Promise.race([checking, timedOut]);
@@ -40584,7 +40612,7 @@ async function logEvidence(path, signalId) {
40584
40612
  }
40585
40613
  async function runListenerAttendanceCanary(options) {
40586
40614
  const now = options.now ?? Date.now;
40587
- const sleep2 = options.sleep ?? ((milliseconds) => new Promise((resolve2) => setTimeout(resolve2, milliseconds)));
40615
+ const sleep2 = options.sleep ?? ((milliseconds) => new Promise((resolve3) => setTimeout(resolve3, milliseconds)));
40588
40616
  const startedAt = now();
40589
40617
  const deadlineMs = startedAt + options.waitMs;
40590
40618
  const client = new ThinCommandClient(options.target, options.fetcher, {
@@ -40698,11 +40726,22 @@ function renderListenerAttendanceCanary(result, workspaceId2, principalId) {
40698
40726
  }
40699
40727
 
40700
40728
  // src/listener/activity.ts
40701
- var import_node_crypto20 = require("node:crypto");
40729
+ var import_node_crypto21 = require("node:crypto");
40702
40730
  var ACTIVITY_FRAME_INTERVAL_MS = 750;
40703
40731
  var ACTIVITY_HEARTBEAT_MS = 15e3;
40704
40732
  var ACTIVITY_TOOL_TITLE_MAX = 160;
40705
40733
  var ACTIVITY_REQUEST_TIMEOUT_MS = 5e3;
40734
+ var AgentActivityPublishError = class extends Error {
40735
+ constructor(code, cause) {
40736
+ super("activity frame publish failed", { cause });
40737
+ this.code = code;
40738
+ this.name = "AgentActivityPublishError";
40739
+ }
40740
+ code;
40741
+ };
40742
+ function activityPublishErrorCode(error) {
40743
+ return error instanceof AgentActivityPublishError ? error.code : "activity_publish_unknown";
40744
+ }
40706
40745
  var SYSTEM_CLOCK = {
40707
40746
  now: Date.now,
40708
40747
  setTimer: (callback, delayMs) => setTimeout(callback, delayMs),
@@ -40716,41 +40755,57 @@ var TERMINAL_TOOL_STATUSES = /* @__PURE__ */ new Set([
40716
40755
  "rejected"
40717
40756
  ]);
40718
40757
  var AgentActivityEndpointTransport = class {
40719
- constructor(target2, credentialSession, fetcher) {
40758
+ constructor(target2, credentialSession, fetcher, requestTimeoutMs = ACTIVITY_REQUEST_TIMEOUT_MS) {
40720
40759
  this.target = target2;
40721
40760
  this.credentialSession = credentialSession;
40761
+ this.requestTimeoutMs = requestTimeoutMs;
40722
40762
  this.fetcher = fetcher ?? fetch;
40723
40763
  }
40724
40764
  target;
40725
40765
  credentialSession;
40766
+ requestTimeoutMs;
40726
40767
  fetcher;
40727
40768
  async publish(frame) {
40728
- const credential = await this.credentialSession.bearer();
40729
- const response = await this.fetcher(
40730
- `${this.target.url}/functions/v1/activity`,
40731
- {
40732
- method: "POST",
40733
- headers: {
40734
- authorization: `Bearer ${credential}`,
40735
- apikey: this.target.anonKey,
40736
- "content-type": "application/json"
40737
- },
40738
- body: JSON.stringify({
40739
- version: frame.version,
40740
- workspace_id: frame.workspaceId,
40741
- stream_id: frame.streamId,
40742
- sequence: frame.sequence,
40743
- phase: frame.phase,
40744
- signal_id: frame.signalId,
40745
- tool_title: frame.toolTitle,
40746
- elapsed_ms: frame.elapsedMs
40747
- }),
40748
- signal: AbortSignal.timeout(ACTIVITY_REQUEST_TIMEOUT_MS)
40749
- }
40750
- );
40751
- await response.body?.cancel();
40769
+ let credential;
40770
+ try {
40771
+ credential = await this.credentialSession.bearer();
40772
+ } catch (error) {
40773
+ throw new AgentActivityPublishError("activity_credential_failed", error);
40774
+ }
40775
+ const timeoutSignal = AbortSignal.timeout(this.requestTimeoutMs);
40776
+ let response;
40777
+ try {
40778
+ response = await this.fetcher(
40779
+ `${this.target.url}/functions/v1/activity`,
40780
+ {
40781
+ method: "POST",
40782
+ headers: {
40783
+ authorization: `Bearer ${credential}`,
40784
+ apikey: this.target.anonKey,
40785
+ "content-type": "application/json"
40786
+ },
40787
+ body: JSON.stringify({
40788
+ version: frame.version,
40789
+ workspace_id: frame.workspaceId,
40790
+ stream_id: frame.streamId,
40791
+ sequence: frame.sequence,
40792
+ phase: frame.phase,
40793
+ signal_id: frame.signalId,
40794
+ tool_title: frame.toolTitle,
40795
+ elapsed_ms: frame.elapsedMs
40796
+ }),
40797
+ signal: timeoutSignal
40798
+ }
40799
+ );
40800
+ } catch (error) {
40801
+ throw new AgentActivityPublishError(
40802
+ timeoutSignal.aborted ? "activity_request_timeout" : "activity_transport_failed",
40803
+ error
40804
+ );
40805
+ }
40806
+ await response.body?.cancel().catch(() => void 0);
40752
40807
  if (!response.ok) {
40753
- throw new Error(`activity publish failed (${response.status})`);
40808
+ throw new AgentActivityPublishError("activity_http_rejected");
40754
40809
  }
40755
40810
  }
40756
40811
  };
@@ -40758,7 +40813,7 @@ var ListenerActivityController = class {
40758
40813
  constructor(options) {
40759
40814
  this.options = options;
40760
40815
  this.clock = options.clock ?? SYSTEM_CLOCK;
40761
- this.streamId = options.streamId ?? (0, import_node_crypto20.randomUUID)();
40816
+ this.streamId = options.streamId ?? (0, import_node_crypto21.randomUUID)();
40762
40817
  this.events = { update: (update) => this.onSessionUpdate(update) };
40763
40818
  }
40764
40819
  options;
@@ -40899,7 +40954,8 @@ var ListenerActivityController = class {
40899
40954
  };
40900
40955
  try {
40901
40956
  await this.options.transport.publish(frame);
40902
- } catch {
40957
+ } catch (error) {
40958
+ this.options.onPublishFailure?.(activityPublishErrorCode(error));
40903
40959
  } finally {
40904
40960
  this.sending = false;
40905
40961
  if (this.dirty) this.schedule();
@@ -41086,7 +41142,7 @@ var ListenerHttpClient = class {
41086
41142
  finished = true;
41087
41143
  this.finishRequest();
41088
41144
  };
41089
- return await new Promise((resolve2, reject) => {
41145
+ return await new Promise((resolve3, reject) => {
41090
41146
  const send = options.url.protocol === "https:" ? import_node_https.request : import_node_http2.request;
41091
41147
  const agent = options.url.protocol === "https:" ? this.httpsAgent : this.httpAgent;
41092
41148
  let request;
@@ -41141,7 +41197,7 @@ var ListenerHttpClient = class {
41141
41197
  redirected: { value: options.redirected },
41142
41198
  url: { value: options.url.href }
41143
41199
  });
41144
- resolve2(response);
41200
+ resolve3(response);
41145
41201
  } catch (error) {
41146
41202
  reject(error);
41147
41203
  }
@@ -41164,13 +41220,13 @@ var ListenerHttpClient = class {
41164
41220
  // src/resume.ts
41165
41221
  var import_node_child_process8 = require("node:child_process");
41166
41222
  function execFileText(file, args) {
41167
- return new Promise((resolve2, reject) => {
41223
+ return new Promise((resolve3, reject) => {
41168
41224
  (0, import_node_child_process8.execFile)(file, [...args], {
41169
41225
  encoding: "utf8",
41170
41226
  maxBuffer: 4 * 1024 * 1024
41171
41227
  }, (error, stdout) => {
41172
41228
  if (error) reject(error);
41173
- else resolve2(stdout);
41229
+ else resolve3(stdout);
41174
41230
  });
41175
41231
  });
41176
41232
  }
@@ -41576,8 +41632,8 @@ var ACCEPTED_AGENT_CREDENTIAL_MESSAGES = [
41576
41632
  AGENT_CREDENTIAL_MESSAGE_D088
41577
41633
  ];
41578
41634
  function packageVersion() {
41579
- if ("0.1.46".length > 0) {
41580
- return "0.1.46";
41635
+ if ("0.1.47".length > 0) {
41636
+ return "0.1.47";
41581
41637
  }
41582
41638
  try {
41583
41639
  const value = JSON.parse(
@@ -42201,7 +42257,7 @@ async function runNew(args) {
42201
42257
  assertWorkspaceName(name);
42202
42258
  const cloud = await target(args);
42203
42259
  const human = await humanCredential(args, cloud);
42204
- const proposedId = (0, import_node_crypto21.randomUUID)();
42260
+ const proposedId = (0, import_node_crypto22.randomUUID)();
42205
42261
  let result;
42206
42262
  try {
42207
42263
  result = await new ThinCommandClient(cloud).sendConnect({
@@ -43533,8 +43589,8 @@ function prepareSignalAttachments(localPaths) {
43533
43589
  name,
43534
43590
  bytes,
43535
43591
  contentType,
43536
- fileId: (0, import_node_crypto21.randomUUID)(),
43537
- versionId: (0, import_node_crypto21.randomUUID)(),
43592
+ fileId: (0, import_node_crypto22.randomUUID)(),
43593
+ versionId: (0, import_node_crypto22.randomUUID)(),
43538
43594
  createCommandId: newCommandId(),
43539
43595
  commitCommandId: newCommandId()
43540
43596
  };
@@ -44760,6 +44816,8 @@ function listenerStatusJson(status, permissionMode, evidence = {
44760
44816
  droppedForMainCount: status.droppedForMainCount ?? 0,
44761
44817
  connectionsOpened: status.connectionsOpened ?? null,
44762
44818
  connectionReuseRatio: status.connectionReuseRatio ?? null,
44819
+ activityPublishFailures: status.activityPublishFailures ?? null,
44820
+ activityLastErrorCode: status.activityLastErrorCode ?? null,
44763
44821
  ...mode3 ? {
44764
44822
  permission_mode: mode3,
44765
44823
  /* "allowed once" alone overstates it: allowOnceOrDeny selects allow_once only when the
@@ -44793,6 +44851,8 @@ function renderListenerStatus(status, evidence = {
44793
44851
  `Provider executable: ${status.providerExecutable ?? "not measured"}.`,
44794
44852
  `Connections opened: ${status.connectionsOpened ?? "not measured"}.`,
44795
44853
  `Connection reuse ratio: ${status.connectionReuseRatio ?? "not measured"}.`,
44854
+ ...status.activityPublishFailures !== void 0 && status.activityPublishFailures > 0 ? [`Activity publish failures: ${status.activityPublishFailures}.`] : [],
44855
+ ...status.activityLastErrorCode ? [`Last activity publish error code: ${status.activityLastErrorCode}.`] : [],
44796
44856
  status.readyAt ? `Ready since: ${status.readyAt}.` : "Not ready yet.",
44797
44857
  status.lastSignalId ? pendingForMainCount > 0 ? `Last claimed and queued signal: ${status.lastSignalId}. It is not handled yet.` : routeMode === "worker" ? `Last handled signal: ${status.lastSignalId}.` : `Last listener signal: ${status.lastSignalId}. Local status does not prove its final observed receipt.` : "No signal has been handled yet.",
44798
44858
  status.lastErrorCode ? `Last status code: ${status.lastErrorCode}.` : "No listener process error is recorded.",
@@ -45211,6 +45271,7 @@ async function runConfiguredListener(options) {
45211
45271
  let providerVersionNotice = null;
45212
45272
  const onVersionNotice = (notice) => {
45213
45273
  providerVersionNotice = {
45274
+ ...providerVersionNotice ?? {},
45214
45275
  runningVersion: notice.runningVersion,
45215
45276
  lastMeasuredVersion: notice.lastMeasuredVersion
45216
45277
  };
@@ -45341,7 +45402,12 @@ async function runConfiguredListener(options) {
45341
45402
  options.cloud,
45342
45403
  credentialSession,
45343
45404
  httpClient.fetch
45344
- )
45405
+ ),
45406
+ onPublishFailure: (code) => onEvent({
45407
+ type: "activity_publish_failure",
45408
+ code,
45409
+ ts: (/* @__PURE__ */ new Date()).toISOString()
45410
+ })
45345
45411
  });
45346
45412
  const instrumentedModel = activity.instrumentModel(
45347
45413
  newModel(onCanaryAttempt, activity.events)
@@ -46072,11 +46138,11 @@ async function runHook(args) {
46072
46138
  ...principalIds.length === 0 ? {} : { principalIds },
46073
46139
  fetcher: httpClient.fetch,
46074
46140
  write: async (output) => {
46075
- await new Promise((resolve2, reject) => {
46141
+ await new Promise((resolve3, reject) => {
46076
46142
  process.stdout.write(`${output}
46077
46143
  `, (error) => {
46078
46144
  if (error) reject(error);
46079
- else resolve2();
46145
+ else resolve3();
46080
46146
  });
46081
46147
  });
46082
46148
  }
@@ -46209,8 +46275,8 @@ async function uploadNamedFile(context, name, bytes) {
46209
46275
  workspaceId: context.selected.selectedWorkspace,
46210
46276
  credential: context.selected.bearer
46211
46277
  };
46212
- const fileId = (0, import_node_crypto21.randomUUID)();
46213
- const versionId = (0, import_node_crypto21.randomUUID)();
46278
+ const fileId = (0, import_node_crypto22.randomUUID)();
46279
+ const versionId = (0, import_node_crypto22.randomUUID)();
46214
46280
  const createCommandId = newCommandId();
46215
46281
  const commitCommandId = newCommandId();
46216
46282
  const created = await onceRetried(
@@ -46621,7 +46687,7 @@ async function runDogfood(args) {
46621
46687
  const { selectedWorkspace, bearer } = await commandWorkspaceAndCredential(args, cloud);
46622
46688
  const client = new ThinCommandClient(cloud);
46623
46689
  const route = stream(args);
46624
- const taskId = args.optional("task-id") ?? (0, import_node_crypto21.randomUUID)();
46690
+ const taskId = args.optional("task-id") ?? (0, import_node_crypto22.randomUUID)();
46625
46691
  const ttl = Number(args.optional("ttl-ms") ?? "3600000");
46626
46692
  if (!Number.isSafeInteger(ttl) || ttl <= 0 || ttl > 144e5) {
46627
46693
  throw new Error("--ttl-ms must be an integer in 1..14400000");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commonswarm",
3
- "version": "0.1.46",
3
+ "version": "0.1.47",
4
4
  "description": "CommonSwarm CLI — coordination for teams where people and AI agents work side by side.",
5
5
  "bin": {
6
6
  "cswarm": "cswarm.cjs"