@lazehq/cli 0.1.79 → 0.1.81

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/dist/laze.mjs +936 -637
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -3224,8 +3224,8 @@ var require_websocket = __commonJS({
3224
3224
  var http = __require("http");
3225
3225
  var net = __require("net");
3226
3226
  var tls = __require("tls");
3227
- var { randomBytes: randomBytes5, createHash: createHash7 } = __require("crypto");
3228
- var { Duplex, Readable } = __require("stream");
3227
+ var { randomBytes: randomBytes5, createHash: createHash8 } = __require("crypto");
3228
+ var { Duplex, Readable: Readable2 } = __require("stream");
3229
3229
  var { URL: URL3 } = __require("url");
3230
3230
  var PerMessageDeflate2 = require_permessage_deflate();
3231
3231
  var Receiver2 = require_receiver();
@@ -3892,7 +3892,7 @@ var require_websocket = __commonJS({
3892
3892
  abortHandshake(websocket, socket, "Invalid Upgrade header");
3893
3893
  return;
3894
3894
  }
3895
- const digest = createHash7("sha1").update(key + GUID).digest("base64");
3895
+ const digest = createHash8("sha1").update(key + GUID).digest("base64");
3896
3896
  if (res.headers["sec-websocket-accept"] !== digest) {
3897
3897
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
3898
3898
  return;
@@ -4261,7 +4261,7 @@ var require_websocket_server = __commonJS({
4261
4261
  var EventEmitter = __require("events");
4262
4262
  var http = __require("http");
4263
4263
  var { Duplex } = __require("stream");
4264
- var { createHash: createHash7 } = __require("crypto");
4264
+ var { createHash: createHash8 } = __require("crypto");
4265
4265
  var extension2 = require_extension();
4266
4266
  var PerMessageDeflate2 = require_permessage_deflate();
4267
4267
  var subprotocol2 = require_subprotocol();
@@ -4568,7 +4568,7 @@ var require_websocket_server = __commonJS({
4568
4568
  );
4569
4569
  }
4570
4570
  if (this._state > RUNNING) return abortHandshake(socket, 503);
4571
- const digest = createHash7("sha1").update(key + GUID).digest("base64");
4571
+ const digest = createHash8("sha1").update(key + GUID).digest("base64");
4572
4572
  const headers = [
4573
4573
  "HTTP/1.1 101 Switching Protocols",
4574
4574
  "Upgrade: websocket",
@@ -7454,14 +7454,14 @@ var require_connect = __commonJS({
7454
7454
  const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions);
7455
7455
  timeout = timeout == null ? 1e4 : timeout;
7456
7456
  allowH2 = allowH2 != null ? allowH2 : true;
7457
- return function connect8({ hostname: hostname7, host: host2, protocol, port, servername, localAddress, httpSocket }, callback) {
7457
+ return function connect8({ hostname: hostname8, host: host2, protocol, port, servername, localAddress, httpSocket }, callback) {
7458
7458
  let socket;
7459
7459
  if (protocol === "https:") {
7460
7460
  if (!tls) {
7461
7461
  tls = __require("node:tls");
7462
7462
  }
7463
7463
  servername = servername || options.servername || util.getServerName(host2) || null;
7464
- const sessionKey = servername || hostname7;
7464
+ const sessionKey = servername || hostname8;
7465
7465
  assert2(sessionKey);
7466
7466
  const session = customSession || sessionCache.get(sessionKey) || null;
7467
7467
  port = port || 443;
@@ -7476,7 +7476,7 @@ var require_connect = __commonJS({
7476
7476
  socket: httpSocket,
7477
7477
  // upgrade socket connection
7478
7478
  port,
7479
- host: hostname7
7479
+ host: hostname8
7480
7480
  });
7481
7481
  socket.on("session", function(session2) {
7482
7482
  sessionCache.set(sessionKey, session2);
@@ -7490,16 +7490,16 @@ var require_connect = __commonJS({
7490
7490
  ...options,
7491
7491
  localAddress,
7492
7492
  port,
7493
- host: hostname7
7493
+ host: hostname8
7494
7494
  };
7495
- const family = net.isIP(hostname7);
7496
- if (family !== 0 && servername && servername !== hostname7) {
7495
+ const family = net.isIP(hostname8);
7496
+ if (family !== 0 && servername && servername !== hostname8) {
7497
7497
  connectOptions.host = servername;
7498
7498
  connectOptions.lookup = (_hostname, lookupOptions, cb) => {
7499
7499
  if (lookupOptions.all) {
7500
- cb(null, [{ address: hostname7, family }]);
7500
+ cb(null, [{ address: hostname8, family }]);
7501
7501
  } else {
7502
- cb(null, hostname7, family);
7502
+ cb(null, hostname8, family);
7503
7503
  }
7504
7504
  };
7505
7505
  }
@@ -7512,7 +7512,7 @@ var require_connect = __commonJS({
7512
7512
  const keepAliveInitialDelay = options.keepAliveInitialDelay === void 0 ? 6e4 : options.keepAliveInitialDelay;
7513
7513
  socket.setKeepAlive(true, keepAliveInitialDelay);
7514
7514
  }
7515
- const clearConnectTimeout = util.setupConnectTimeout(new WeakRef(socket), { timeout, hostname: hostname7, port });
7515
+ const clearConnectTimeout = util.setupConnectTimeout(new WeakRef(socket), { timeout, hostname: hostname8, port });
7516
7516
  socket.setNoDelay(true).once(protocol === "https:" ? "secureConnect" : "connect", function() {
7517
7517
  queueMicrotask(clearConnectTimeout);
7518
7518
  if (callback) {
@@ -7525,7 +7525,7 @@ var require_connect = __commonJS({
7525
7525
  if (callback) {
7526
7526
  const cb = callback;
7527
7527
  callback = null;
7528
- cb(maybeNormalizeConnectError(err, this, { timeout, hostname: hostname7, port }));
7528
+ cb(maybeNormalizeConnectError(err, this, { timeout, hostname: hostname8, port }));
7529
7529
  }
7530
7530
  });
7531
7531
  return socket;
@@ -9497,7 +9497,7 @@ var require_webidl = __commonJS({
9497
9497
  var require_util2 = __commonJS({
9498
9498
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/web/fetch/util.js"(exports, module) {
9499
9499
  "use strict";
9500
- var { Transform } = __require("node:stream");
9500
+ var { Transform: Transform2 } = __require("node:stream");
9501
9501
  var zlib = __require("node:zlib");
9502
9502
  var { redirectStatusSet, referrerPolicyTokens, badPortsSet } = require_constants4();
9503
9503
  var { getGlobalOrigin } = require_global();
@@ -10088,7 +10088,7 @@ var require_util2 = __commonJS({
10088
10088
  contentRange += isomorphicEncode(`${fullLength}`);
10089
10089
  return contentRange;
10090
10090
  }
10091
- var InflateStream = class extends Transform {
10091
+ var InflateStream = class extends Transform2 {
10092
10092
  #zlibOptions;
10093
10093
  /** @param {zlib.ZlibOptions} [zlibOptions] */
10094
10094
  constructor(zlibOptions) {
@@ -12455,7 +12455,7 @@ var require_client_h2 = __commonJS({
12455
12455
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/dispatcher/client-h2.js"(exports, module) {
12456
12456
  "use strict";
12457
12457
  var assert2 = __require("node:assert");
12458
- var { pipeline } = __require("node:stream");
12458
+ var { pipeline: pipeline2 } = __require("node:stream");
12459
12459
  var util = require_util();
12460
12460
  var {
12461
12461
  RequestContentLengthMismatchError,
@@ -13602,7 +13602,7 @@ var require_client_h2 = __commonJS({
13602
13602
  }
13603
13603
  function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) {
13604
13604
  assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
13605
- const pipe2 = pipeline(
13605
+ const pipe2 = pipeline2(
13606
13606
  body,
13607
13607
  h2stream,
13608
13608
  (err) => {
@@ -14077,20 +14077,20 @@ var require_client = __commonJS({
14077
14077
  function connect8(client) {
14078
14078
  assert2(!client[kConnecting]);
14079
14079
  assert2(!client[kHTTPContext]);
14080
- let { host: host2, hostname: hostname7, protocol, port } = client[kUrl];
14081
- if (hostname7[0] === "[") {
14082
- const idx = hostname7.indexOf("]");
14080
+ let { host: host2, hostname: hostname8, protocol, port } = client[kUrl];
14081
+ if (hostname8[0] === "[") {
14082
+ const idx = hostname8.indexOf("]");
14083
14083
  assert2(idx !== -1);
14084
- const ip2 = hostname7.substring(1, idx);
14084
+ const ip2 = hostname8.substring(1, idx);
14085
14085
  assert2(net.isIPv6(ip2));
14086
- hostname7 = ip2;
14086
+ hostname8 = ip2;
14087
14087
  }
14088
14088
  client[kConnecting] = true;
14089
14089
  if (channels3.beforeConnect.hasSubscribers) {
14090
14090
  channels3.beforeConnect.publish({
14091
14091
  connectParams: {
14092
14092
  host: host2,
14093
- hostname: hostname7,
14093
+ hostname: hostname8,
14094
14094
  protocol,
14095
14095
  port,
14096
14096
  version: client[kHTTPContext]?.version,
@@ -14103,14 +14103,14 @@ var require_client = __commonJS({
14103
14103
  try {
14104
14104
  client[kConnector]({
14105
14105
  host: host2,
14106
- hostname: hostname7,
14106
+ hostname: hostname8,
14107
14107
  protocol,
14108
14108
  port,
14109
14109
  servername: client[kServerName],
14110
14110
  localAddress: client[kLocalAddress]
14111
14111
  }, (err, socket) => {
14112
14112
  if (err) {
14113
- handleConnectError(client, err, { host: host2, hostname: hostname7, protocol, port });
14113
+ handleConnectError(client, err, { host: host2, hostname: hostname8, protocol, port });
14114
14114
  client[kResume]();
14115
14115
  return;
14116
14116
  }
@@ -14124,7 +14124,7 @@ var require_client = __commonJS({
14124
14124
  client[kHTTPContext] = socket.alpnProtocol === "h2" ? connectH2(client, socket) : connectH1(client, socket);
14125
14125
  } catch (err2) {
14126
14126
  socket.destroy().on("error", noop2);
14127
- handleConnectError(client, err2, { host: host2, hostname: hostname7, protocol, port });
14127
+ handleConnectError(client, err2, { host: host2, hostname: hostname8, protocol, port });
14128
14128
  client[kResume]();
14129
14129
  return;
14130
14130
  }
@@ -14137,7 +14137,7 @@ var require_client = __commonJS({
14137
14137
  channels3.connected.publish({
14138
14138
  connectParams: {
14139
14139
  host: host2,
14140
- hostname: hostname7,
14140
+ hostname: hostname8,
14141
14141
  protocol,
14142
14142
  port,
14143
14143
  version: client[kHTTPContext]?.version,
@@ -14152,11 +14152,11 @@ var require_client = __commonJS({
14152
14152
  client[kResume]();
14153
14153
  });
14154
14154
  } catch (err) {
14155
- handleConnectError(client, err, { host: host2, hostname: hostname7, protocol, port });
14155
+ handleConnectError(client, err, { host: host2, hostname: hostname8, protocol, port });
14156
14156
  client[kResume]();
14157
14157
  }
14158
14158
  }
14159
- function handleConnectError(client, err, { host: host2, hostname: hostname7, protocol, port }) {
14159
+ function handleConnectError(client, err, { host: host2, hostname: hostname8, protocol, port }) {
14160
14160
  if (client.destroyed) {
14161
14161
  return;
14162
14162
  }
@@ -14165,7 +14165,7 @@ var require_client = __commonJS({
14165
14165
  channels3.connectError.publish({
14166
14166
  connectParams: {
14167
14167
  host: host2,
14168
- hostname: hostname7,
14168
+ hostname: hostname8,
14169
14169
  protocol,
14170
14170
  port,
14171
14171
  version: client[kHTTPContext]?.version,
@@ -16220,10 +16220,10 @@ var require_env_http_proxy_agent = __commonJS({
16220
16220
  ]);
16221
16221
  }
16222
16222
  #getProxyAgentForUrl(url2) {
16223
- let { protocol, host: hostname7, port } = url2;
16224
- hostname7 = hostname7.replace(/:\d*$/, "").replace(/^\[(.+)\]$/, "$1").toLowerCase();
16223
+ let { protocol, host: hostname8, port } = url2;
16224
+ hostname8 = hostname8.replace(/:\d*$/, "").replace(/^\[(.+)\]$/, "$1").toLowerCase();
16225
16225
  port = Number.parseInt(port, 10) || DEFAULT_PORTS[protocol] || 0;
16226
- if (!this.#shouldProxy(hostname7, port)) {
16226
+ if (!this.#shouldProxy(hostname8, port)) {
16227
16227
  return this[kNoProxyAgent];
16228
16228
  }
16229
16229
  if (protocol === "https:") {
@@ -16231,7 +16231,7 @@ var require_env_http_proxy_agent = __commonJS({
16231
16231
  }
16232
16232
  return this[kHttpProxyAgent];
16233
16233
  }
16234
- #shouldProxy(hostname7, port) {
16234
+ #shouldProxy(hostname8, port) {
16235
16235
  if (this.#noProxyChanged) {
16236
16236
  this.#parseNoProxy();
16237
16237
  }
@@ -16246,10 +16246,10 @@ var require_env_http_proxy_agent = __commonJS({
16246
16246
  if (entry.port && entry.port !== port) {
16247
16247
  continue;
16248
16248
  }
16249
- if (hostname7 === entry.hostname) {
16249
+ if (hostname8 === entry.hostname) {
16250
16250
  return false;
16251
16251
  }
16252
- if (hostname7.slice(-(entry.hostname.length + 1)) === `.${entry.hostname}`) {
16252
+ if (hostname8.slice(-(entry.hostname.length + 1)) === `.${entry.hostname}`) {
16253
16253
  return false;
16254
16254
  }
16255
16255
  }
@@ -16264,21 +16264,21 @@ var require_env_http_proxy_agent = __commonJS({
16264
16264
  if (!entry) {
16265
16265
  continue;
16266
16266
  }
16267
- let hostname7, port;
16267
+ let hostname8, port;
16268
16268
  const ipv6WithPort = entry.match(/^\[(.+)\]:(\d+)$/);
16269
16269
  if (ipv6WithPort) {
16270
- hostname7 = ipv6WithPort[1];
16270
+ hostname8 = ipv6WithPort[1];
16271
16271
  port = Number.parseInt(ipv6WithPort[2], 10);
16272
16272
  } else {
16273
16273
  const unbracketed = entry.replace(/^\[(.+)\]$/, "$1");
16274
16274
  const colonCount = (unbracketed.match(/:/g) || []).length;
16275
16275
  const parsed = colonCount === 1 && unbracketed.match(/^(.+):(\d+)$/);
16276
- hostname7 = parsed ? parsed[1] : unbracketed;
16276
+ hostname8 = parsed ? parsed[1] : unbracketed;
16277
16277
  port = parsed ? Number.parseInt(parsed[2], 10) : 0;
16278
16278
  }
16279
16279
  noProxyEntries.push({
16280
16280
  // strip leading dot or asterisk with dot
16281
- hostname: hostname7.replace(/^\*?\./, "").toLowerCase(),
16281
+ hostname: hostname8.replace(/^\*?\./, "").toLowerCase(),
16282
16282
  port
16283
16283
  });
16284
16284
  }
@@ -16757,7 +16757,7 @@ var require_readable = __commonJS({
16757
16757
  "use strict";
16758
16758
  var assert2 = __require("node:assert");
16759
16759
  var { addAbortListener } = __require("node:events");
16760
- var { Readable } = __require("node:stream");
16760
+ var { Readable: Readable2 } = __require("node:stream");
16761
16761
  var { RequestAbortedError, NotSupportedError, InvalidArgumentError, AbortError } = require_errors();
16762
16762
  var util = require_util();
16763
16763
  var { ReadableStreamFrom } = require_util();
@@ -16771,7 +16771,7 @@ var require_readable = __commonJS({
16771
16771
  var kBytesRead = /* @__PURE__ */ Symbol("kBytesRead");
16772
16772
  var noop2 = () => {
16773
16773
  };
16774
- var BodyReadable = class extends Readable {
16774
+ var BodyReadable = class extends Readable2 {
16775
16775
  /**
16776
16776
  * @param {object} opts
16777
16777
  * @param {(this: Readable, size: number) => void} opts.resume
@@ -17170,7 +17170,7 @@ var require_api_request = __commonJS({
17170
17170
  "use strict";
17171
17171
  var assert2 = __require("node:assert");
17172
17172
  var { AsyncResource } = __require("node:async_hooks");
17173
- var { Readable } = require_readable();
17173
+ var { Readable: Readable2 } = require_readable();
17174
17174
  var { InvalidArgumentError, RequestAbortedError } = require_errors();
17175
17175
  var util = require_util();
17176
17176
  function noop2() {
@@ -17256,7 +17256,7 @@ var require_api_request = __commonJS({
17256
17256
  const parsedHeaders = headers;
17257
17257
  const contentType = parsedHeaders?.["content-type"];
17258
17258
  const contentLength = parsedHeaders?.["content-length"];
17259
- const res = new Readable({
17259
+ const res = new Readable2({
17260
17260
  resume: () => controller.resume(),
17261
17261
  abort: (reason2) => controller.abort(reason2),
17262
17262
  contentType,
@@ -17632,7 +17632,7 @@ var require_api_pipeline = __commonJS({
17632
17632
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/api/api-pipeline.js"(exports, module) {
17633
17633
  "use strict";
17634
17634
  var {
17635
- Readable,
17635
+ Readable: Readable2,
17636
17636
  Duplex,
17637
17637
  PassThrough
17638
17638
  } = __require("node:stream");
@@ -17649,7 +17649,7 @@ var require_api_pipeline = __commonJS({
17649
17649
  function noop2() {
17650
17650
  }
17651
17651
  var kResume = /* @__PURE__ */ Symbol("resume");
17652
- var PipelineRequest = class extends Readable {
17652
+ var PipelineRequest = class extends Readable2 {
17653
17653
  constructor() {
17654
17654
  super({ autoDestroy: true });
17655
17655
  this[kResume] = null;
@@ -17667,7 +17667,7 @@ var require_api_pipeline = __commonJS({
17667
17667
  callback(err);
17668
17668
  }
17669
17669
  };
17670
- var PipelineResponse = class extends Readable {
17670
+ var PipelineResponse = class extends Readable2 {
17671
17671
  constructor(resume) {
17672
17672
  super({ autoDestroy: true });
17673
17673
  this[kResume] = resume;
@@ -17821,7 +17821,7 @@ var require_api_pipeline = __commonJS({
17821
17821
  util.destroy(ret, err);
17822
17822
  }
17823
17823
  };
17824
- function pipeline(opts, handler) {
17824
+ function pipeline2(opts, handler) {
17825
17825
  try {
17826
17826
  const pipelineHandler = new PipelineHandler(opts, handler);
17827
17827
  this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler);
@@ -17830,7 +17830,7 @@ var require_api_pipeline = __commonJS({
17830
17830
  return new PassThrough().destroy(err);
17831
17831
  }
17832
17832
  }
17833
- module.exports = pipeline;
17833
+ module.exports = pipeline2;
17834
17834
  }
17835
17835
  });
17836
17836
 
@@ -19155,13 +19155,13 @@ var require_mock_pool = __commonJS({
19155
19155
  var require_pending_interceptors_formatter = __commonJS({
19156
19156
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/pending-interceptors-formatter.js"(exports, module) {
19157
19157
  "use strict";
19158
- var { Transform } = __require("node:stream");
19158
+ var { Transform: Transform2 } = __require("node:stream");
19159
19159
  var { Console } = __require("node:console");
19160
19160
  var PERSISTENT = process.versions.icu ? "\u2705" : "Y ";
19161
19161
  var NOT_PERSISTENT = process.versions.icu ? "\u274C" : "N ";
19162
19162
  module.exports = class PendingInterceptorsFormatter {
19163
19163
  constructor({ disableColors } = {}) {
19164
- this.transform = new Transform({
19164
+ this.transform = new Transform2({
19165
19165
  transform(chunk, _enc, cb) {
19166
19166
  cb(null, chunk);
19167
19167
  }
@@ -19466,8 +19466,8 @@ var require_snapshot_utils = __commonJS({
19466
19466
  var require_snapshot_recorder = __commonJS({
19467
19467
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
19468
19468
  "use strict";
19469
- var { writeFile: writeFile27, readFile: readFile48, mkdir: mkdir26 } = __require("node:fs/promises");
19470
- var { dirname: dirname28, resolve: resolve24 } = __require("node:path");
19469
+ var { writeFile: writeFile27, readFile: readFile49, mkdir: mkdir28 } = __require("node:fs/promises");
19470
+ var { dirname: dirname30, resolve: resolve24 } = __require("node:path");
19471
19471
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
19472
19472
  var { InvalidArgumentError, UndiciError } = require_errors();
19473
19473
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -19683,7 +19683,7 @@ var require_snapshot_recorder = __commonJS({
19683
19683
  throw new InvalidArgumentError("Snapshot path is required");
19684
19684
  }
19685
19685
  try {
19686
- const data = await readFile48(resolve24(path), "utf8");
19686
+ const data = await readFile49(resolve24(path), "utf8");
19687
19687
  const parsed = JSON.parse(data);
19688
19688
  if (Array.isArray(parsed)) {
19689
19689
  this.#snapshots.clear();
@@ -19713,7 +19713,7 @@ var require_snapshot_recorder = __commonJS({
19713
19713
  throw new InvalidArgumentError("Snapshot path is required");
19714
19714
  }
19715
19715
  const resolvedPath = resolve24(path);
19716
- await mkdir26(dirname28(resolvedPath), { recursive: true });
19716
+ await mkdir28(dirname30(resolvedPath), { recursive: true });
19717
19717
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
19718
19718
  hash: hash2,
19719
19719
  snapshot
@@ -20745,14 +20745,14 @@ var require_dns = __commonJS({
20745
20745
  get size() {
20746
20746
  return this.#records.size;
20747
20747
  }
20748
- get(hostname7) {
20749
- return this.#records.get(hostname7) ?? null;
20748
+ get(hostname8) {
20749
+ return this.#records.get(hostname8) ?? null;
20750
20750
  }
20751
- set(hostname7, records) {
20752
- this.#records.set(hostname7, records);
20751
+ set(hostname8, records) {
20752
+ this.#records.set(hostname8, records);
20753
20753
  }
20754
- delete(hostname7) {
20755
- this.#records.delete(hostname7);
20754
+ delete(hostname8) {
20755
+ this.#records.delete(hostname8);
20756
20756
  }
20757
20757
  // Delegate to storage decide can we do more lookups or not
20758
20758
  full() {
@@ -22948,7 +22948,7 @@ var require_cache2 = __commonJS({
22948
22948
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/interceptor/cache.js"(exports, module) {
22949
22949
  "use strict";
22950
22950
  var assert2 = __require("node:assert");
22951
- var { Readable } = __require("node:stream");
22951
+ var { Readable: Readable2 } = __require("node:stream");
22952
22952
  var util = require_util();
22953
22953
  var CacheHandler = require_cache_handler();
22954
22954
  var MemoryCacheStore = require_memory_cache_store();
@@ -23124,7 +23124,7 @@ var require_cache2 = __commonJS({
23124
23124
  return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
23125
23125
  }
23126
23126
  function sendCachedValue(handler, opts, result2, age, context, isStale2) {
23127
- const stream = util.isStream(result2.body) ? result2.body : Readable.from(result2.body ?? []);
23127
+ const stream = util.isStream(result2.body) ? result2.body : Readable2.from(result2.body ?? []);
23128
23128
  assert2(!stream.destroyed, "stream should not be destroyed");
23129
23129
  assert2(!stream.readableDidRead, "stream should not be readableDidRead");
23130
23130
  const controller = {
@@ -23369,7 +23369,7 @@ var require_decompress = __commonJS({
23369
23369
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/interceptor/decompress.js"(exports, module) {
23370
23370
  "use strict";
23371
23371
  var { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress } = __require("node:zlib");
23372
- var { pipeline } = __require("node:stream");
23372
+ var { pipeline: pipeline2 } = __require("node:stream");
23373
23373
  var DecoratorHandler = require_decorator_handler();
23374
23374
  var supportedEncodings = {
23375
23375
  gzip: createGunzip,
@@ -23479,7 +23479,7 @@ var require_decompress = __commonJS({
23479
23479
  #setupMultipleDecompressors(controller) {
23480
23480
  const lastDecompressor = this.#decompressors[this.#decompressors.length - 1];
23481
23481
  this.#setupDecompressorEvents(lastDecompressor, controller);
23482
- pipeline(this.#decompressors, (err) => {
23482
+ pipeline2(this.#decompressors, (err) => {
23483
23483
  if (err) {
23484
23484
  super.onResponseError(controller, err);
23485
23485
  return;
@@ -26273,7 +26273,7 @@ var require_fetch = __commonJS({
26273
26273
  subresourceSet
26274
26274
  } = require_constants4();
26275
26275
  var EE = __require("node:events");
26276
- var { Readable, pipeline, finished, isErrored, isReadable } = __require("node:stream");
26276
+ var { Readable: Readable2, pipeline: pipeline2, finished, isErrored, isReadable } = __require("node:stream");
26277
26277
  var { addAbortListener, bufferToLowerCasedHeaderName } = require_util();
26278
26278
  var { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = require_data_url();
26279
26279
  var { getGlobalDispatcher } = require_global2();
@@ -27249,7 +27249,7 @@ var require_fetch = __commonJS({
27249
27249
  const headersList = new HeadersList();
27250
27250
  appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders);
27251
27251
  const location = headersList.get("location", true);
27252
- this.body = new Readable({ read: () => controller.resume() });
27252
+ this.body = new Readable2({ read: () => controller.resume() });
27253
27253
  const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status11);
27254
27254
  const decoders = [];
27255
27255
  if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status11) && !willFollow) {
@@ -27297,7 +27297,7 @@ var require_fetch = __commonJS({
27297
27297
  status: status11,
27298
27298
  statusText,
27299
27299
  headersList,
27300
- body: decoders.length ? pipeline(this.body, ...decoders, (err) => {
27300
+ body: decoders.length ? pipeline2(this.body, ...decoders, (err) => {
27301
27301
  if (err) {
27302
27302
  this.onResponseError(controller, err);
27303
27303
  }
@@ -28452,7 +28452,7 @@ var require_cookies = __commonJS({
28452
28452
  if (!cookies) {
28453
28453
  return [];
28454
28454
  }
28455
- return cookies.map((pair2) => parseSetCookie(pair2));
28455
+ return cookies.map((pair) => parseSetCookie(pair));
28456
28456
  }
28457
28457
  function parseCookie(cookie) {
28458
28458
  cookie = webidl.converters.DOMString(cookie);
@@ -28954,8 +28954,8 @@ var require_util5 = __commonJS({
28954
28954
  const position = { position: 0 };
28955
28955
  const extensionList = /* @__PURE__ */ new Map();
28956
28956
  while (position.position < extensions.length) {
28957
- const pair2 = collectASequenceOfCodePointsFast(";", extensions, position);
28958
- const [name3, value = ""] = pair2.split("=", 2);
28957
+ const pair = collectASequenceOfCodePointsFast(";", extensions, position);
28958
+ const [name3, value = ""] = pair.split("=", 2);
28959
28959
  extensionList.set(
28960
28960
  removeHTTPWhitespace(name3, true, false),
28961
28961
  removeHTTPWhitespace(value, false, true)
@@ -30768,7 +30768,7 @@ var require_util6 = __commonJS({
30768
30768
  var require_eventsource_stream = __commonJS({
30769
30769
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/web/eventsource/eventsource-stream.js"(exports, module) {
30770
30770
  "use strict";
30771
- var { Transform } = __require("node:stream");
30771
+ var { Transform: Transform2 } = __require("node:stream");
30772
30772
  var { isASCIINumber, isValidLastEventId } = require_util6();
30773
30773
  var BOM = [239, 187, 191];
30774
30774
  var LF = 10;
@@ -30809,7 +30809,7 @@ var require_eventsource_stream = __commonJS({
30809
30809
  }
30810
30810
  return true;
30811
30811
  }
30812
- var EventSourceStream = class extends Transform {
30812
+ var EventSourceStream = class extends Transform2 {
30813
30813
  /**
30814
30814
  * @type {eventSourceSettings}
30815
30815
  */
@@ -31109,7 +31109,7 @@ ${value}`;
31109
31109
  var require_eventsource = __commonJS({
31110
31110
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/web/eventsource/eventsource.js"(exports, module) {
31111
31111
  "use strict";
31112
- var { pipeline } = __require("node:stream");
31112
+ var { pipeline: pipeline2 } = __require("node:stream");
31113
31113
  var { fetching } = require_fetch();
31114
31114
  var { webidl } = require_webidl();
31115
31115
  var { EventSourceStream } = require_eventsource_stream();
@@ -31259,7 +31259,7 @@ var require_eventsource = __commonJS({
31259
31259
  ));
31260
31260
  }
31261
31261
  });
31262
- pipeline(
31262
+ pipeline2(
31263
31263
  response.body.stream,
31264
31264
  eventSourceStream,
31265
31265
  (error63) => {
@@ -31617,6 +31617,7 @@ import { createInterface as createInterface5 } from "node:readline/promises";
31617
31617
 
31618
31618
  // ../../packages/secret-guard/src/detector/laze-id.ts
31619
31619
  var LAZE_ID = /^(?:[a-z\d]+_)?[a-z\d]+_([0-9A-Za-z]{29})$/;
31620
+ var LAZE_ID_INSIDE = /(?<![A-Za-z0-9])(?:[a-z\d]+_)?[a-z\d]+_[0-9A-Za-z]{29}(?![A-Za-z0-9])/g;
31620
31621
  var BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
31621
31622
  var FIRST_SECOND = 1577836800n;
31622
31623
  var LAST_SECOND = 4102444800n;
@@ -31624,6 +31625,8 @@ var SEPARATOR = /[/?&=#]/;
31624
31625
  var WORD = /^[A-Za-z-]{0,40}$/;
31625
31626
  var FILE_NAME = /^[A-Za-z0-9 ._-]{1,120}\.[A-Za-z0-9]{1,8}$/;
31626
31627
  var SLACK_ID = /^[A-Z][A-Z0-9]{7,12}$/;
31628
+ var KEY_RUN_MIN = 16;
31629
+ var KEY_RUN_MIN_DISTINCT = 10;
31627
31630
  function isLazeId(token2) {
31628
31631
  const body = LAZE_ID.exec(token2)?.[1];
31629
31632
  if (!body) return false;
@@ -31642,6 +31645,26 @@ function isLazeIdText(text3) {
31642
31645
  (segment, index) => isLazeId(segment) || WORD.test(segment) || SLACK_ID.test(segment) || index > 0 && isLazeId(segments[index - 1] ?? "") && FILE_NAME.test(segment)
31643
31646
  );
31644
31647
  }
31648
+ function holdsKeyRun(word3) {
31649
+ return word3.split(/[-_.+]/).some((run4) => {
31650
+ if (run4.length < KEY_RUN_MIN || new Set(run4).size < KEY_RUN_MIN_DISTINCT) return false;
31651
+ const mixedCase = /[a-z].*[a-z]/.test(run4) && /[A-Z].*[A-Z]/.test(run4);
31652
+ return mixedCase || /\d.*\d/.test(run4) && /[A-Za-z].*[A-Za-z]/.test(run4);
31653
+ });
31654
+ }
31655
+ function withoutLazeIds(text3) {
31656
+ let held = false;
31657
+ const rest = text3.replace(LAZE_ID_INSIDE, (id4) => {
31658
+ if (!isLazeId(id4)) return id4;
31659
+ held = true;
31660
+ return "/";
31661
+ });
31662
+ return { rest, held };
31663
+ }
31664
+ function isPathAroundLazeId(text3) {
31665
+ const { rest, held } = withoutLazeIds(text3);
31666
+ return held && !rest.split(SEPARATOR).some(holdsKeyRun);
31667
+ }
31645
31668
 
31646
31669
  // ../../packages/secret-guard/src/detector/url-values.ts
31647
31670
  var URL2 = /\b[a-z][a-z0-9+.-]{0,30}:\/\/[^\s<>"'`()[\]{}]+/gi;
@@ -31683,10 +31706,10 @@ function pairsIn({
31683
31706
  while (at < end) {
31684
31707
  const next = text3.indexOf("&", at);
31685
31708
  const stop3 = next === -1 || next > end ? end : next;
31686
- const pair2 = text3.slice(at, stop3);
31687
- const equals = pair2.indexOf("=");
31709
+ const pair = text3.slice(at, stop3);
31710
+ const equals = pair.indexOf("=");
31688
31711
  if (equals === -1) out.push({ start: at, end: stop3, name: "" });
31689
- else out.push({ start: at + equals + 1, end: stop3, name: pair2.slice(0, equals) });
31712
+ else out.push({ start: at + equals + 1, end: stop3, name: pair.slice(0, equals) });
31690
31713
  at = stop3 + 1;
31691
31714
  }
31692
31715
  }
@@ -32318,7 +32341,7 @@ function matchSlice({
32318
32341
  if (ruleIds && !ruleIds.has(rule.id)) continue;
32319
32342
  if (rule.precondition && !rule.precondition(text3)) continue;
32320
32343
  const matches = rawMatches(rule, text3);
32321
- found.push(...matches.filter((match) => !isLazeIdText(withExtension({ text: text3, match }))));
32344
+ found.push(...matches.filter((match) => !isIdOrIdPath({ text: text3, match })));
32322
32345
  }
32323
32346
  const urlValues = urlValuesIn(text3);
32324
32347
  const placed = urlValues.length === 0 ? found : inLinkValues({ text: text3, found, urlValues, ruleIds });
@@ -32333,6 +32356,10 @@ function matchSlice({
32333
32356
  };
32334
32357
  });
32335
32358
  }
32359
+ function isIdOrIdPath({ text: text3, match }) {
32360
+ const value = withExtension({ text: text3, match });
32361
+ return isLazeIdText(value) || match.ruleId === "shaped_api_key" && isPathAroundLazeId(value);
32362
+ }
32336
32363
  var SHAPE_RULE_IDS = /* @__PURE__ */ new Set(["shaped_api_key", "named_key", "sensitive_assignment"]);
32337
32364
  function inLinkValues({
32338
32365
  text: text3,
@@ -36310,8 +36337,8 @@ var Duration = /* @__PURE__ */ defineTemporalClass(DurationBranding, class {
36310
36337
  round(roundTo) {
36311
36338
  return createDuration(roundDuration(refinePublicRelativeTo, getDurationSlots(this), roundTo));
36312
36339
  }
36313
- total(totalOf) {
36314
- return totalDuration(refinePublicRelativeTo, getDurationSlots(this), totalOf);
36340
+ total(totalOf2) {
36341
+ return totalDuration(refinePublicRelativeTo, getDurationSlots(this), totalOf2);
36315
36342
  }
36316
36343
  toLocaleString(locales = void 0, options) {
36317
36344
  const slots = getDurationSlots(this);
@@ -36928,7 +36955,7 @@ function flagText({
36928
36955
  }
36929
36956
 
36930
36957
  // src/rules/cli-version.rules.ts
36931
- var STAMPED = "0.1.79";
36958
+ var STAMPED = "0.1.81";
36932
36959
  function cliVersionOf({ stamped = STAMPED } = {}) {
36933
36960
  return stamped.startsWith("__") ? "dev" : stamped;
36934
36961
  }
@@ -36950,7 +36977,7 @@ var ProfileMigratedError = class extends Error {
36950
36977
  };
36951
36978
 
36952
36979
  // src/services/session.service.ts
36953
- import { readFile as readFile2 } from "node:fs/promises";
36980
+ import { readFile as readFile4 } from "node:fs/promises";
36954
36981
 
36955
36982
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
36956
36983
  var external_exports = {};
@@ -39765,9 +39792,9 @@ var asciiTabOrNewline = /[\t\n\r]/g;
39765
39792
  function stripTabAndNewline(value) {
39766
39793
  return value.replace(asciiTabOrNewline, "");
39767
39794
  }
39768
- function urlHostnameOk(url2, hostname7) {
39769
- hostname7.lastIndex = 0;
39770
- return hostname7.test(url2.hostname);
39795
+ function urlHostnameOk(url2, hostname8) {
39796
+ hostname8.lastIndex = 0;
39797
+ return hostname8.test(url2.hostname);
39771
39798
  }
39772
39799
  function urlProtocolOk(url2, protocol) {
39773
39800
  protocol.lastIndex = 0;
@@ -57709,10 +57736,10 @@ var HandledErrorRuntime = class _HandledErrorRuntime extends Error {
57709
57736
  }
57710
57737
  };
57711
57738
  function handledErrorConstructor() {
57712
- const scope2 = globalThis;
57713
- const existing = scope2[HANDLED_ERROR_RUNTIME];
57739
+ const scope3 = globalThis;
57740
+ const existing = scope3[HANDLED_ERROR_RUNTIME];
57714
57741
  if (existing) return existing;
57715
- Object.defineProperty(scope2, HANDLED_ERROR_RUNTIME, {
57742
+ Object.defineProperty(scope3, HANDLED_ERROR_RUNTIME, {
57716
57743
  configurable: false,
57717
57744
  enumerable: false,
57718
57745
  value: HandledErrorRuntime,
@@ -58875,10 +58902,10 @@ var MIRRORED_KEY_SEGMENT = "mirrored";
58875
58902
  function mirroredQueryKey({
58876
58903
  path,
58877
58904
  workspaceId,
58878
- scope: scope2
58905
+ scope: scope3
58879
58906
  }) {
58880
58907
  const key = [path.split("."), workspaceId, MIRRORED_KEY_SEGMENT];
58881
- return scope2 === void 0 ? key : [...key, scope2];
58908
+ return scope3 === void 0 ? key : [...key, scope3];
58882
58909
  }
58883
58910
  function contractBuilder(namespace, members3) {
58884
58911
  const member = (name3, kind2, read4 = {}) => ({
@@ -59941,6 +59968,8 @@ var vaultConnectionSchemaDefinition = external_exports.object({
59941
59968
  connector: vaultConnectorDetailsSchema.nullable(),
59942
59969
  /** Sealed to its owner's devices: the server cannot open it. */
59943
59970
  sealed: external_exports.boolean().default(false),
59971
+ /** Laze opens it itself for its owner's background work, so it never seals to devices. */
59972
+ serverOpens: external_exports.boolean().optional(),
59944
59973
  /** False for a sealed connection no enrolled device can open any more. */
59945
59974
  openable: external_exports.boolean().default(true),
59946
59975
  createdByUserId: external_exports.string(),
@@ -60767,9 +60796,9 @@ async function decryptFrom(input2) {
60767
60796
  return gcmOpen({ key, sealed: fromBase64Url(input2.sealed), aad: input2.aad });
60768
60797
  }
60769
60798
  async function generateEcdhKeys() {
60770
- const pair2 = await subtle().generateKey(P256, true, ["deriveBits"]);
60771
- const raw = new Uint8Array(await subtle().exportKey("raw", pair2.publicKey));
60772
- return { publicKey: toBase64Url(raw), privateKey: pair2.privateKey };
60799
+ const pair = await subtle().generateKey(P256, true, ["deriveBits"]);
60800
+ const raw = new Uint8Array(await subtle().exportKey("raw", pair.publicKey));
60801
+ return { publicKey: toBase64Url(raw), privateKey: pair.privateKey };
60773
60802
  }
60774
60803
  function fieldsOf(value) {
60775
60804
  if (typeof value !== "object" || value === null) throw new VaultSealMismatchError();
@@ -62363,16 +62392,18 @@ var feedCardSchemaDefinition = external_exports.object({
62363
62392
  itemId: idSchema4,
62364
62393
  changeId: idSchema4
62365
62394
  });
62395
+ var failureRetrySchemaDefinition = external_exports.object({
62396
+ agentId: idSchema4,
62397
+ messageId: idSchema4,
62398
+ /** The attempt that failed; a later one stored means it was already tried again. */
62399
+ attempt: external_exports.number().int().min(1).optional()
62400
+ });
62366
62401
  var failureCardSchemaDefinition = external_exports.object({
62367
62402
  type: external_exports.literal("failure"),
62368
- details: external_exports.string().min(1).max(NOTICE_DETAILS_MAX),
62369
- /** An agent's failed turn: Try again sends this person's message to the agent again. */
62370
- retry: external_exports.object({
62371
- agentId: idSchema4,
62372
- messageId: idSchema4,
62373
- /** The attempt that failed; a later one stored means it was already tried again. */
62374
- attempt: external_exports.number().int().min(1).optional()
62375
- }).optional()
62403
+ /** Empty when there is no reason to show: a turn that ended without answering. */
62404
+ details: external_exports.string().max(NOTICE_DETAILS_MAX),
62405
+ /** An agent's unanswered turn: Try again sends this person's message to the agent again. */
62406
+ retry: failureRetrySchemaDefinition.optional()
62376
62407
  });
62377
62408
  var welcomeCardActionSchema = external_exports.enum(["slides", "connect_agent", "new_channel", "invite"]);
62378
62409
  var welcomeCardSchemaDefinition = external_exports.object({
@@ -62861,6 +62892,8 @@ var postNoticeInputSchemaDefinition = external_exports.object({
62861
62892
  compaction: messageCompactionSchemaDefinition.optional(),
62862
62893
  /** The raw reason behind the line, such as a provider's error, shown only under Details. */
62863
62894
  details: external_exports.string().trim().min(1).max(NOTICE_DETAILS_MAX).optional(),
62895
+ /** Try again under the notice, for the message the agent did not answer. */
62896
+ retry: failureRetrySchemaDefinition.optional(),
62864
62897
  /** One notice per key: a second post with it answers the first. */
62865
62898
  clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
62866
62899
  });
@@ -63187,6 +63220,7 @@ var attachmentTextSchemaDefinition = external_exports.object({
63187
63220
  text: external_exports.string(),
63188
63221
  truncated: external_exports.boolean()
63189
63222
  });
63223
+ var ATTACHMENT_MAX_BYTES = 1024 * 1024 * 1024;
63190
63224
  var attachmentBytesSchemaDefinition = external_exports.object({
63191
63225
  attachment: attachmentSchemaDefinition,
63192
63226
  bytes: external_exports.custom((value) => value instanceof Uint8Array),
@@ -63473,6 +63507,25 @@ var saveDraftInputSchemaDefinition = external_exports.object({
63473
63507
  var saveDraftInputSchema = saveDraftInputSchemaDefinition;
63474
63508
  var draftSavedSchemaDefinition = external_exports.object({ saved: external_exports.boolean() });
63475
63509
  var draftSavedSchema = draftSavedSchemaDefinition;
63510
+ var cardDraftSchemaDefinition = external_exports.object({
63511
+ cardId: idSchema4,
63512
+ text: external_exports.string().max(MESSAGE_BODY_MAX),
63513
+ /** The writer's clock when they typed it; the newest save wins. */
63514
+ savedAt: external_exports.iso.datetime()
63515
+ });
63516
+ var clearedCardDraftSchemaDefinition = cardDraftSchemaDefinition.pick({
63517
+ cardId: true,
63518
+ savedAt: true
63519
+ });
63520
+ var cardDraftListSchemaDefinition = external_exports.object({
63521
+ drafts: external_exports.array(cardDraftSchemaDefinition),
63522
+ /** Comments sent or deleted, and when, so a copy saved before that is dropped. */
63523
+ cleared: external_exports.array(clearedCardDraftSchemaDefinition)
63524
+ });
63525
+ var saveCardDraftInputSchemaDefinition = external_exports.object({
63526
+ ...cardDraftSchemaDefinition.shape,
63527
+ workspaceId: workspaceIdSchema
63528
+ });
63476
63529
  var draftsParamsSchemaDefinition = external_exports.object({ workspaceId: workspaceIdSchema });
63477
63530
  var draftPlaceParamsSchemaDefinition = external_exports.object({
63478
63531
  workspaceId: workspaceIdSchema,
@@ -63828,6 +63881,12 @@ var FEED_PUSH_KINDS = ["approvals", "urgent", "replies", "wakeups", "groups"];
63828
63881
  var feedPushKindSchema = external_exports.enum(FEED_PUSH_KINDS);
63829
63882
  var PHONE_PUSH_DELAYS = [0, 1, 2, 5, 10, 15, 30];
63830
63883
  var phonePushDelaySchema = external_exports.literal(PHONE_PUSH_DELAYS);
63884
+ var mirrorNotifyLevelSchema = external_exports.enum(["everywhere", "desktop", "off"]);
63885
+ var mirrorNotifySchemaDefinition = external_exports.object({
63886
+ slack: mirrorNotifyLevelSchema.default("everywhere"),
63887
+ discord: mirrorNotifyLevelSchema.default("everywhere"),
63888
+ whatsapp: mirrorNotifyLevelSchema.default("desktop")
63889
+ });
63831
63890
  var notificationSettingsSchemaDefinition = external_exports.object({
63832
63891
  channelDefault: channelDefaultSchema,
63833
63892
  /** Words that notify like a mention, matched whole and case-blind. */
@@ -63855,11 +63914,19 @@ var notificationSettingsSchemaDefinition = external_exports.object({
63855
63914
  /** Skips Saturday and Sunday. */
63856
63915
  digestWeekdaysOnly: external_exports.boolean(),
63857
63916
  /** Minutes without input on the web or the desktop app before notices reach the phone. */
63858
- phonePushAfterMinutes: phonePushDelaySchema
63917
+ phonePushAfterMinutes: phonePushDelaySchema,
63918
+ /** Where each mirrored app's messages reach the person. */
63919
+ mirrorNotify: mirrorNotifySchemaDefinition
63859
63920
  });
63860
63921
  var notificationSettingsSchema = notificationSettingsSchemaDefinition;
63861
63922
  var updateSettingsInputSchemaDefinition = external_exports.object({
63862
63923
  ...notificationSettingsSchemaDefinition.omit({ snoozeUntil: true }).partial().shape,
63924
+ /** Only the apps named here change. */
63925
+ mirrorNotify: external_exports.object({
63926
+ slack: mirrorNotifyLevelSchema.optional(),
63927
+ discord: mirrorNotifyLevelSchema.optional(),
63928
+ whatsapp: mirrorNotifyLevelSchema.optional()
63929
+ }).optional(),
63863
63930
  workspaceId: workspaceIdSchema2,
63864
63931
  timeZone: external_exports.string().min(1).max(64).refine((zone) => {
63865
63932
  try {
@@ -63920,6 +63987,8 @@ var messageNoticeSchema = external_exports.object({
63920
63987
  urgent: external_exports.boolean().optional(),
63921
63988
  /** It came in through a mirror such as Slack, whose own app already rings: Laze stays silent. */
63922
63989
  mirrored: external_exports.boolean().optional(),
63990
+ /** The mirrored app it came from, whose level in the person's settings decides where it goes. */
63991
+ mirrorApp: external_exports.enum(["slack", "discord", "whatsapp"]).optional(),
63923
63992
  /** An @channel or @here raised it, not the conversation's every-message level. */
63924
63993
  broadcast: external_exports.boolean().optional(),
63925
63994
  /** The person's Notifications count, from chat: the iPhone's icon badge shows it. */
@@ -64265,6 +64334,7 @@ var feedDigestIntentSchemaDefinition = external_exports.object({
64265
64334
  var notificationUi = uiTokens("notification");
64266
64335
  var NotificationPauseHooksToken = notificationUi.hooks("pause");
64267
64336
  var NotificationDefaultHooksToken = notificationUi.hooks("channel-default");
64337
+ var MirrorNotifySettingSlot = notificationUi.component("mirror-notify-setting");
64268
64338
  var NotificationPauseDialogSlot = notificationUi.component("pause-dialog");
64269
64339
 
64270
64340
  // ../../modules/chat/contract/src/chat.events.ts
@@ -64529,7 +64599,7 @@ var chatConfig = Config.define((c) => ({
64529
64599
  /** The largest upload on any plan; a plan may allow less. */
64530
64600
  maxUploadBytes: c.env(
64531
64601
  "CHAT_MAX_UPLOAD_BYTES",
64532
- external_exports.coerce.number().int().positive().default(1024 * 1024 * 1024)
64602
+ external_exports.coerce.number().int().positive().default(ATTACHMENT_MAX_BYTES)
64533
64603
  ),
64534
64604
  /** Where links in notifications and emails point. */
64535
64605
  publicBaseUrl
@@ -65002,6 +65072,8 @@ var deliverMessageInputSchemaDefinition = external_exports.object({
65002
65072
  text: external_exports.string().min(1),
65003
65073
  /** Busy agents: `queue` waits for the turn, `steer` joins it, `interrupt` stops it. */
65004
65074
  mode: deliveryModeSchema.default("queue"),
65075
+ /** Try again's count, from the second attempt on. */
65076
+ attempt: external_exports.number().int().min(2).optional(),
65005
65077
  /** The vault turn of the person who asked; the CLI presents it on vault calls. */
65006
65078
  turnToken: external_exports.string().min(1).optional(),
65007
65079
  /** The thread the message is in; a turn joins only messages of one channel and thread. */
@@ -65139,7 +65211,9 @@ var setEgressRouteInputDefinition = external_exports.object({
65139
65211
  route: external_exports.object({
65140
65212
  /** The `human_only` connection in the owner's keychain holding host, port and credentials. */
65141
65213
  vaultConnectionId: external_exports.string().min(1),
65142
- domains: external_exports.array(external_exports.string().min(1)).min(1).max(50)
65214
+ domains: external_exports.array(external_exports.string().min(1)).min(1).max(50),
65215
+ /** All web traffic, not only the domains. */
65216
+ all: external_exports.boolean().default(false)
65143
65217
  }).nullable()
65144
65218
  });
65145
65219
  var AgentRuntimeApi = moduleApi()("agent-runtime");
@@ -65228,6 +65302,8 @@ var hostFrameSchemaDefinition = external_exports.discriminatedUnion("type", [
65228
65302
  messageId: external_exports.string().min(1),
65229
65303
  text: external_exports.string().min(1),
65230
65304
  mode: deliveryModeSchema,
65305
+ /** Try again's count: a later attempt is new work, not a resend of a message already seen. */
65306
+ attempt: external_exports.number().int().min(2).optional(),
65231
65307
  turnToken: external_exports.string().min(1).optional(),
65232
65308
  threadRootId: external_exports.string().min(1).optional(),
65233
65309
  files: external_exports.array(deliveredFileSchema).max(10).default([]),
@@ -65531,8 +65607,11 @@ var agentRuntimeConfig = Config.define((c) => ({
65531
65607
  "AGENT_RUNTIME_COMPUTER_IDLE_EXIT_SECONDS",
65532
65608
  positive.int().default(60)
65533
65609
  ),
65534
- /** A computer from an older release that stays busy is rolled after this long anyway. */
65535
- computerRollCapMinutes: c.env("AGENT_RUNTIME_COMPUTER_ROLL_CAP_MINUTES", positive.default(30)),
65610
+ /**
65611
+ * A computer from an older release that stays busy is rolled after this long anyway. A roll
65612
+ * ends what runs in it, so the cap sits above any job an agent leaves running in a working day.
65613
+ */
65614
+ computerRollCapMinutes: c.env("AGENT_RUNTIME_COMPUTER_ROLL_CAP_MINUTES", positive.default(720)),
65536
65615
  /** A cold start waits while computers reserve more than host memory times this. */
65537
65616
  computerHostOvercommit: c.env("AGENT_RUNTIME_COMPUTER_HOST_OVERCOMMIT", positive.default(2)),
65538
65617
  /** The host's memory for that check; unset, the total memory of this box. */
@@ -65813,7 +65892,11 @@ var agentReconnectSchemaDefinition = external_exports.discriminatedUnion("connec
65813
65892
  /** The owner's name for anyone else; null once they left the workspace. */
65814
65893
  ownerName: external_exports.string().nullable(),
65815
65894
  /** The session's folder and machine, for its owner alone; null when unknown. */
65816
- where: external_exports.string().nullable()
65895
+ where: external_exports.string().nullable(),
65896
+ /** The session's folder, for its owner alone; null when unknown. */
65897
+ folder: external_exports.string().nullable(),
65898
+ /** The session's machine, for its owner alone; null when unknown. */
65899
+ machine: external_exports.string().nullable()
65817
65900
  })
65818
65901
  ]);
65819
65902
  var agentReconnectSchema = agentReconnectSchemaDefinition;
@@ -68682,6 +68765,7 @@ var callerSearchResultSchemaDefinition = external_exports.object({
68682
68765
  channels: external_exports.array(external_exports.object({ id: idSchema17, name: external_exports.string() }))
68683
68766
  })
68684
68767
  });
68768
+ var agentMachineInputSchemaDefinition = external_exports.object({ host: external_exports.string().trim().min(1).max(200) });
68685
68769
  var agentActivityInputSchemaDefinition = external_exports.object({
68686
68770
  /** The session the report is about, so a resent report is recorded once. */
68687
68771
  sessionId: external_exports.string().min(1).max(120),
@@ -69766,6 +69850,116 @@ function errorOf({ status: status11, body }) {
69766
69850
  return error63;
69767
69851
  }
69768
69852
 
69853
+ // src/services/machine-report.service.ts
69854
+ import { createHash } from "node:crypto";
69855
+ import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
69856
+ import { hostname as hostname3 } from "node:os";
69857
+ import { dirname as dirname3 } from "node:path";
69858
+
69859
+ // src/services/inbox-spool.service.ts
69860
+ import { mkdir as mkdir2, readFile as readFile2, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
69861
+ import { dirname as dirname2, join as join2 } from "node:path";
69862
+ var PUSH_GRACE_MS = 3 * 6e4;
69863
+ var IN_FLIGHT_MS = 35e3;
69864
+ function fileNameOf({ profile }) {
69865
+ return profile.replace(/[^a-zA-Z0-9_-]/g, "_");
69866
+ }
69867
+ function statePathOf({
69868
+ context,
69869
+ kind: kind2,
69870
+ profile,
69871
+ extension: extension2 = "json"
69872
+ }) {
69873
+ const directory = join2(dirname2(context.environment.configPath), kind2);
69874
+ return join2(directory, `${fileNameOf({ profile })}.${extension2}`);
69875
+ }
69876
+ async function readSpool({ path }) {
69877
+ return readFile2(path, "utf8").then(
69878
+ (text3) => JSON.parse(text3),
69879
+ () => []
69880
+ );
69881
+ }
69882
+ async function writeSpool({ path, entries }) {
69883
+ await mkdir2(dirname2(path), { recursive: true, mode: 448 });
69884
+ const temporary = `${path}.${process.pid}.tmp`;
69885
+ await writeFile2(temporary, JSON.stringify(entries), { mode: 384 });
69886
+ await rename2(temporary, path);
69887
+ }
69888
+ async function keepTaken({
69889
+ context,
69890
+ profile,
69891
+ messages,
69892
+ pushed = false
69893
+ }) {
69894
+ if (messages.length === 0) return;
69895
+ const path = statePathOf({ context, kind: "spool", profile });
69896
+ const ids = new Set(messages.map((message2) => message2.messageId));
69897
+ const kept = (await readSpool({ path })).filter((entry) => !ids.has(entry.message.messageId));
69898
+ const now = context.nowMs();
69899
+ const taken = messages.map((message2) => ({
69900
+ message: message2,
69901
+ takenAt: now,
69902
+ ...pushed ? { pushedAt: now } : {}
69903
+ }));
69904
+ await writeSpool({ path, entries: [...kept, ...taken] });
69905
+ }
69906
+ async function dropFromSpool({
69907
+ context,
69908
+ profile,
69909
+ messageIds
69910
+ }) {
69911
+ if (messageIds.length === 0) return;
69912
+ const path = statePathOf({ context, kind: "spool", profile });
69913
+ const entries = await readSpool({ path });
69914
+ const ids = new Set(messageIds);
69915
+ const kept = entries.filter((entry) => !ids.has(entry.message.messageId));
69916
+ if (kept.length !== entries.length) await writeSpool({ path, entries: kept });
69917
+ }
69918
+ async function dueFromSpool({
69919
+ context,
69920
+ profile,
69921
+ seen,
69922
+ pushedToo,
69923
+ settledOnly = false
69924
+ }) {
69925
+ const path = statePathOf({ context, kind: "spool", profile });
69926
+ const entries = await readSpool({ path });
69927
+ const pushed = entries.some((entry) => entry.pushedAt !== void 0);
69928
+ const text3 = pushed ? await seen().catch(() => "") : "";
69929
+ const shown2 = entries.filter(
69930
+ (entry) => entry.pushedAt !== void 0 && text3.includes(entry.message.messageId)
69931
+ );
69932
+ await dropFromSpool({
69933
+ context,
69934
+ profile,
69935
+ messageIds: shown2.map((entry) => entry.message.messageId)
69936
+ });
69937
+ const late = context.nowMs() - PUSH_GRACE_MS;
69938
+ const settled2 = context.nowMs() - IN_FLIGHT_MS;
69939
+ return entries.filter((entry) => !shown2.includes(entry)).filter((entry) => !settledOnly || entry.takenAt <= settled2).filter((entry) => entry.pushedAt === void 0 || pushedToo && entry.pushedAt <= late).map((entry) => entry.message);
69940
+ }
69941
+
69942
+ // src/services/machine-report.service.ts
69943
+ async function reportMachine({
69944
+ context,
69945
+ profile,
69946
+ token: token2,
69947
+ client
69948
+ }) {
69949
+ const host2 = hostname3().trim().slice(0, 200);
69950
+ if (!host2) return;
69951
+ const stamp = createHash("sha256").update(`${token2}:${host2}`).digest("hex");
69952
+ const path = statePathOf({ context, kind: "machine", profile });
69953
+ if (await readFile3(path, "utf8").catch(() => "") === stamp) return;
69954
+ try {
69955
+ await client.post("/api/agents/me/machine", { host: host2 });
69956
+ await mkdir3(dirname3(path), { recursive: true, mode: 448 });
69957
+ await writeFile3(path, stamp, { mode: 384 });
69958
+ } catch {
69959
+ return;
69960
+ }
69961
+ }
69962
+
69769
69963
  // src/services/session.service.ts
69770
69964
  function markMigratedOn({ context, profile }) {
69771
69965
  return async ({ notice, link: link2 }) => context.store.markMigrated({ name: profile, migrated: { at: context.nowMs(), link: link2, notice } });
@@ -69782,7 +69976,7 @@ async function turnTokenOf({ context }) {
69782
69976
  const pinned = env.LAZE_TURN_TOKEN?.trim();
69783
69977
  if (pinned) return pinned;
69784
69978
  if (!env.LAZE_TURN_FILE) return "";
69785
- return readFile2(env.LAZE_TURN_FILE, "utf8").then(
69979
+ return readFile4(env.LAZE_TURN_FILE, "utf8").then(
69786
69980
  (text3) => text3.trim(),
69787
69981
  () => ""
69788
69982
  );
@@ -69815,6 +70009,10 @@ async function signedIn({
69815
70009
  return { name: chosen.name, profile: chosen.profile, client };
69816
70010
  await namingFirst({ client, args });
69817
70011
  const turn = await turnTokenOf({ context });
70012
+ if (!turn) {
70013
+ const { name: name3, profile } = chosen;
70014
+ await reportMachine({ context, profile: name3, token: profile.token, client });
70015
+ }
69818
70016
  return {
69819
70017
  name: chosen.name,
69820
70018
  profile: chosen.profile,
@@ -70049,7 +70247,7 @@ async function copyAgent({
70049
70247
  }
70050
70248
 
70051
70249
  // src/services/agent-commands.service.ts
70052
- import { mkdir as mkdir16, readFile as readFile17, writeFile as writeFile15 } from "node:fs/promises";
70250
+ import { mkdir as mkdir17, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
70053
70251
  import { join as join17, resolve as resolve5 } from "node:path";
70054
70252
 
70055
70253
  // src/rules/agent-profile.rules.ts
@@ -71334,13 +71532,13 @@ function formatSearch({
71334
71532
  }
71335
71533
 
71336
71534
  // src/services/claude-turn.service.ts
71337
- import { mkdir as mkdir4, readFile as readFile6, rm, writeFile as writeFile4 } from "node:fs/promises";
71338
- import { dirname as dirname4, join as join5 } from "node:path";
71535
+ import { mkdir as mkdir5, readFile as readFile7, rm, writeFile as writeFile5 } from "node:fs/promises";
71536
+ import { dirname as dirname5, join as join5 } from "node:path";
71339
71537
 
71340
71538
  // src/services/harness-session.service.ts
71341
- import { mkdir as mkdir3, open as open2, readdir, readFile as readFile4, stat, writeFile as writeFile3 } from "node:fs/promises";
71342
- import { homedir as homedir2, hostname as hostname3 } from "node:os";
71343
- import { dirname as dirname3, join as join3 } from "node:path";
71539
+ import { mkdir as mkdir4, open as open2, readdir, readFile as readFile5, stat, writeFile as writeFile4 } from "node:fs/promises";
71540
+ import { homedir as homedir2, hostname as hostname4 } from "node:os";
71541
+ import { dirname as dirname4, join as join3 } from "node:path";
71344
71542
 
71345
71543
  // src/rules/claude-subagent.rules.ts
71346
71544
  function lastCallAtOf({ text: text3, command }) {
@@ -71472,89 +71670,6 @@ async function claudeProjectOf({
71472
71670
  return candidates.find((folder) => holds({ folder, inner: context.cwd })) ?? resolve2(context.cwd);
71473
71671
  }
71474
71672
 
71475
- // src/services/inbox-spool.service.ts
71476
- import { mkdir as mkdir2, readFile as readFile3, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
71477
- import { dirname as dirname2, join as join2 } from "node:path";
71478
- var PUSH_GRACE_MS = 3 * 6e4;
71479
- var IN_FLIGHT_MS = 35e3;
71480
- function fileNameOf({ profile }) {
71481
- return profile.replace(/[^a-zA-Z0-9_-]/g, "_");
71482
- }
71483
- function statePathOf({
71484
- context,
71485
- kind: kind2,
71486
- profile,
71487
- extension: extension2 = "json"
71488
- }) {
71489
- const directory = join2(dirname2(context.environment.configPath), kind2);
71490
- return join2(directory, `${fileNameOf({ profile })}.${extension2}`);
71491
- }
71492
- async function readSpool({ path }) {
71493
- return readFile3(path, "utf8").then(
71494
- (text3) => JSON.parse(text3),
71495
- () => []
71496
- );
71497
- }
71498
- async function writeSpool({ path, entries }) {
71499
- await mkdir2(dirname2(path), { recursive: true, mode: 448 });
71500
- const temporary = `${path}.${process.pid}.tmp`;
71501
- await writeFile2(temporary, JSON.stringify(entries), { mode: 384 });
71502
- await rename2(temporary, path);
71503
- }
71504
- async function keepTaken({
71505
- context,
71506
- profile,
71507
- messages,
71508
- pushed = false
71509
- }) {
71510
- if (messages.length === 0) return;
71511
- const path = statePathOf({ context, kind: "spool", profile });
71512
- const ids = new Set(messages.map((message2) => message2.messageId));
71513
- const kept = (await readSpool({ path })).filter((entry) => !ids.has(entry.message.messageId));
71514
- const now = context.nowMs();
71515
- const taken = messages.map((message2) => ({
71516
- message: message2,
71517
- takenAt: now,
71518
- ...pushed ? { pushedAt: now } : {}
71519
- }));
71520
- await writeSpool({ path, entries: [...kept, ...taken] });
71521
- }
71522
- async function dropFromSpool({
71523
- context,
71524
- profile,
71525
- messageIds
71526
- }) {
71527
- if (messageIds.length === 0) return;
71528
- const path = statePathOf({ context, kind: "spool", profile });
71529
- const entries = await readSpool({ path });
71530
- const ids = new Set(messageIds);
71531
- const kept = entries.filter((entry) => !ids.has(entry.message.messageId));
71532
- if (kept.length !== entries.length) await writeSpool({ path, entries: kept });
71533
- }
71534
- async function dueFromSpool({
71535
- context,
71536
- profile,
71537
- seen,
71538
- pushedToo,
71539
- settledOnly = false
71540
- }) {
71541
- const path = statePathOf({ context, kind: "spool", profile });
71542
- const entries = await readSpool({ path });
71543
- const pushed = entries.some((entry) => entry.pushedAt !== void 0);
71544
- const text3 = pushed ? await seen().catch(() => "") : "";
71545
- const shown2 = entries.filter(
71546
- (entry) => entry.pushedAt !== void 0 && text3.includes(entry.message.messageId)
71547
- );
71548
- await dropFromSpool({
71549
- context,
71550
- profile,
71551
- messageIds: shown2.map((entry) => entry.message.messageId)
71552
- });
71553
- const late = context.nowMs() - PUSH_GRACE_MS;
71554
- const settled2 = context.nowMs() - IN_FLIGHT_MS;
71555
- return entries.filter((entry) => !shown2.includes(entry)).filter((entry) => !settledOnly || entry.takenAt <= settled2).filter((entry) => entry.pushedAt === void 0 || pushedToo && entry.pushedAt <= late).map((entry) => entry.message);
71556
- }
71557
-
71558
71673
  // src/services/harness-session.service.ts
71559
71674
  function sessionOf({
71560
71675
  context,
@@ -71568,7 +71683,7 @@ function sessionOf({
71568
71683
  harness,
71569
71684
  sessionId,
71570
71685
  folder: displayFolderOf({ folder, home: inherited.HOME }),
71571
- host: hostname3()
71686
+ host: hostname4()
71572
71687
  };
71573
71688
  }
71574
71689
  function forSession({
@@ -71584,9 +71699,9 @@ async function rememberSession({
71584
71699
  }) {
71585
71700
  if (!session || !claudePid) return;
71586
71701
  const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
71587
- await mkdir3(dirname3(path), { recursive: true, mode: 448 });
71702
+ await mkdir4(dirname4(path), { recursive: true, mode: 448 });
71588
71703
  const launch = launchEnvOf({ inherited: context.environment.inherited });
71589
- await writeFile3(path, JSON.stringify({ ...session, launch }), { mode: 384 });
71704
+ await writeFile4(path, JSON.stringify({ ...session, launch }), { mode: 384 });
71590
71705
  }
71591
71706
  async function currentSessionOf({
71592
71707
  context,
@@ -71605,7 +71720,7 @@ async function currentSessionOf({
71605
71720
  const nearest = await nearestHarnessOf({ context });
71606
71721
  if (!nearest) return void 0;
71607
71722
  const path = statePathOf({ context, kind: "sessions", profile: String(nearest.pid) });
71608
- return readFile4(path, "utf8").then(
71723
+ return readFile5(path, "utf8").then(
71609
71724
  (text3) => JSON.parse(text3),
71610
71725
  () => void 0
71611
71726
  );
@@ -71658,11 +71773,11 @@ async function liveElsewhere({
71658
71773
  asleepCounts = true
71659
71774
  }) {
71660
71775
  if (await rushKeeps({ context, key, claudePid, asleepCounts })) return true;
71661
- const folder = dirname3(statePathOf({ context, kind: "sessions", profile: "x" }));
71776
+ const folder = dirname4(statePathOf({ context, kind: "sessions", profile: "x" }));
71662
71777
  for (const file3 of await readdir(folder).catch(() => [])) {
71663
71778
  const pid = Number(file3.replace(/\.json$/, ""));
71664
71779
  if (!pid || pid === claudePid || !context.processes.alive(pid)) continue;
71665
- const noted = await readFile4(join3(folder, file3), "utf8").then(
71780
+ const noted = await readFile5(join3(folder, file3), "utf8").then(
71666
71781
  (text3) => JSON.parse(text3),
71667
71782
  () => void 0
71668
71783
  );
@@ -71710,7 +71825,7 @@ async function runsInSubagent({ context, command }) {
71710
71825
  if (!sessionId) return false;
71711
71826
  const { path } = await claudeTranscriptOf({ context, sessionId });
71712
71827
  if (!path) return false;
71713
- const folder = join3(dirname3(path), sessionId, "subagents");
71828
+ const folder = join3(dirname4(path), sessionId, "subagents");
71714
71829
  const files2 = await readdir(folder).catch(() => []);
71715
71830
  const subagents = await Promise.all(
71716
71831
  files2.filter((file3) => file3.endsWith(".jsonl")).map(
@@ -71774,13 +71889,13 @@ async function notBoundNotice({
71774
71889
  }
71775
71890
  const key = session ? sessionKeyOf({ session }) : "unknown";
71776
71891
  const path = statePathOf({ context, kind: "told", profile: key });
71777
- const told = await readFile4(path, "utf8").then(
71892
+ const told = await readFile5(path, "utf8").then(
71778
71893
  () => true,
71779
71894
  () => false
71780
71895
  );
71781
71896
  if (told) return { notice: void 0 };
71782
- await mkdir3(dirname3(path), { recursive: true, mode: 448 });
71783
- await writeFile3(path, String(context.nowMs()), { mode: 384 });
71897
+ await mkdir4(dirname4(path), { recursive: true, mode: 448 });
71898
+ await writeFile4(path, String(context.nowMs()), { mode: 384 });
71784
71899
  const agent3 = (await context.store.read()).profiles[profile]?.name;
71785
71900
  return {
71786
71901
  notice: notBoundText({ meta: meta3, agent: agent3, configPath: context.environment.configPath })
@@ -71788,7 +71903,7 @@ async function notBoundNotice({
71788
71903
  }
71789
71904
 
71790
71905
  // src/services/plugin-hook.service.ts
71791
- import { readFile as readFile5 } from "node:fs/promises";
71906
+ import { readFile as readFile6 } from "node:fs/promises";
71792
71907
  import { join as join4 } from "node:path";
71793
71908
  async function agentProfileHere({
71794
71909
  context,
@@ -71811,7 +71926,7 @@ async function agentProfileHere({
71811
71926
  async function projectHooksHere({ context }) {
71812
71927
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR || context.cwd;
71813
71928
  const path = join4(directory, ".claude", "settings.local.json");
71814
- return readFile5(path, "utf8").then(
71929
+ return readFile6(path, "utf8").then(
71815
71930
  (text3) => hasLazeHooks({ settings: JSON.parse(text3) }),
71816
71931
  () => false
71817
71932
  );
@@ -71832,10 +71947,10 @@ async function pluginHookArgs({
71832
71947
  var PRE_TOOL_TIMEOUT_MS = 3e3;
71833
71948
  function statePath({ context, agent: agent3 }) {
71834
71949
  const safe = agent3.replace(/[^a-zA-Z0-9_-]/g, "_");
71835
- return join5(dirname4(context.environment.configPath), "turns", `${safe}.json`);
71950
+ return join5(dirname5(context.environment.configPath), "turns", `${safe}.json`);
71836
71951
  }
71837
71952
  async function readState({ context, agent: agent3 }) {
71838
- return readFile6(statePath({ context, agent: agent3 }), "utf8").then(
71953
+ return readFile7(statePath({ context, agent: agent3 }), "utf8").then(
71839
71954
  (text3) => JSON.parse(text3),
71840
71955
  () => void 0
71841
71956
  );
@@ -71871,8 +71986,8 @@ async function turnStarted({
71871
71986
  await beat({ client, state: before, working: false }).catch(() => void 0);
71872
71987
  }
71873
71988
  const path = statePath({ context, agent: agent3 });
71874
- await mkdir4(dirname4(path), { recursive: true, mode: 448 });
71875
- await writeFile4(path, JSON.stringify(state));
71989
+ await mkdir5(dirname5(path), { recursive: true, mode: 448 });
71990
+ await writeFile5(path, JSON.stringify(state));
71876
71991
  await beat({ client, state, working: true }).catch(() => void 0);
71877
71992
  }
71878
71993
  async function turnEnded({
@@ -71930,7 +72045,7 @@ async function preToolHook({ context, args }) {
71930
72045
  }
71931
72046
 
71932
72047
  // src/services/message-files.service.ts
71933
- import { readFile as readFile7, stat as stat2 } from "node:fs/promises";
72048
+ import { readFile as readFile8, stat as stat2 } from "node:fs/promises";
71934
72049
  import { basename as basename3, resolve as resolve3 } from "node:path";
71935
72050
 
71936
72051
  // src/rules/file-types.rules.ts
@@ -72059,7 +72174,7 @@ async function local({ full }) {
72059
72174
  return {
72060
72175
  fileName,
72061
72176
  contentType: contentTypeOf(fileName),
72062
- bytes: new Uint8Array(await readFile7(full))
72177
+ bytes: new Uint8Array(await readFile8(full))
72063
72178
  };
72064
72179
  }
72065
72180
  async function attachmentIdsOf({
@@ -72682,13 +72797,13 @@ function channelLabelIn(channel) {
72682
72797
  }
72683
72798
 
72684
72799
  // src/services/claude-wait.service.ts
72685
- import { readFile as readFile13, rm as rm4, writeFile as writeFile10, mkdir as mkdir11 } from "node:fs/promises";
72686
- import { dirname as dirname12 } from "node:path";
72800
+ import { readFile as readFile14, rm as rm4, writeFile as writeFile11, mkdir as mkdir12 } from "node:fs/promises";
72801
+ import { dirname as dirname13 } from "node:path";
72687
72802
 
72688
72803
  // src/services/connect-service.service.ts
72689
- import { createHash } from "node:crypto";
72690
- import { mkdir as mkdir10, rm as rm3, writeFile as writeFile9 } from "node:fs/promises";
72691
- import { dirname as dirname11, join as join13 } from "node:path";
72804
+ import { createHash as createHash2 } from "node:crypto";
72805
+ import { mkdir as mkdir11, rm as rm3, writeFile as writeFile10 } from "node:fs/promises";
72806
+ import { dirname as dirname12, join as join13 } from "node:path";
72692
72807
 
72693
72808
  // src/rules/connect-service.rules.ts
72694
72809
  function systemdWordOf(word3) {
@@ -72810,9 +72925,9 @@ function rolloutEventOf({
72810
72925
  }
72811
72926
 
72812
72927
  // src/services/connect-delivery.service.ts
72813
- import { mkdir as mkdir9, readFile as readFile12, rename as rename3, rm as rm2, stat as stat4, writeFile as writeFile8 } from "node:fs/promises";
72814
- import { homedir as homedir3, hostname as hostname4 } from "node:os";
72815
- import { dirname as dirname10, join as join12 } from "node:path";
72928
+ import { mkdir as mkdir10, readFile as readFile13, rename as rename3, rm as rm2, stat as stat4, writeFile as writeFile9 } from "node:fs/promises";
72929
+ import { homedir as homedir3, hostname as hostname5 } from "node:os";
72930
+ import { dirname as dirname11, join as join12 } from "node:path";
72816
72931
 
72817
72932
  // src/services/codex-turn-watch.service.ts
72818
72933
  import { open as open3, readdir as readdir2 } from "node:fs/promises";
@@ -72917,8 +73032,8 @@ var CodexTurnWatch = class _CodexTurnWatch {
72917
73032
  };
72918
73033
 
72919
73034
  // src/services/mcp-relay.service.ts
72920
- import { chmod as chmod2, mkdir as mkdir5, readFile as readFile8, writeFile as writeFile5 } from "node:fs/promises";
72921
- import { dirname as dirname5, join as join7 } from "node:path";
73035
+ import { chmod as chmod2, mkdir as mkdir6, readFile as readFile9, writeFile as writeFile6 } from "node:fs/promises";
73036
+ import { dirname as dirname6, join as join7 } from "node:path";
72922
73037
 
72923
73038
  // ../../node_modules/.pnpm/ws@8.21.3_bufferutil@4.1.0/node_modules/ws/wrapper.mjs
72924
73039
  var import_stream = __toESM(require_stream(), 1);
@@ -73254,11 +73369,11 @@ var STOPS = /* @__PURE__ */ new Map([
73254
73369
  [CONNECTOR_RELAY_CLOSE.replaced.code, "another relay for this server took over"]
73255
73370
  ]);
73256
73371
  function mcpRelaysPathOf({ context }) {
73257
- return join7(dirname5(context.environment.configPath), "connect", "mcp-relays.json");
73372
+ return join7(dirname6(context.environment.configPath), "connect", "mcp-relays.json");
73258
73373
  }
73259
73374
  async function readMcpRelays({ context }) {
73260
73375
  try {
73261
- return JSON.parse(await readFile8(mcpRelaysPathOf({ context }), "utf8"));
73376
+ return JSON.parse(await readFile9(mcpRelaysPathOf({ context }), "utf8"));
73262
73377
  } catch {
73263
73378
  return {};
73264
73379
  }
@@ -73268,8 +73383,8 @@ async function saveMcpRelays({
73268
73383
  relays
73269
73384
  }) {
73270
73385
  const path = mcpRelaysPathOf({ context });
73271
- await mkdir5(dirname5(path), { recursive: true, mode: 448 });
73272
- await writeFile5(path, `${JSON.stringify(relays, null, 2)}
73386
+ await mkdir6(dirname6(path), { recursive: true, mode: 448 });
73387
+ await writeFile6(path, `${JSON.stringify(relays, null, 2)}
73273
73388
  `, { mode: 384 });
73274
73389
  await chmod2(path, 384);
73275
73390
  }
@@ -73298,10 +73413,10 @@ function outcomeOf(input2) {
73298
73413
  return { kind: "dropped", openMs: input2.openMs };
73299
73414
  }
73300
73415
  var McpRelaySession = class {
73301
- constructor(relay2, context, report4) {
73416
+ constructor(relay2, context, report3) {
73302
73417
  this.relay = relay2;
73303
73418
  this.context = context;
73304
- this.report = report4;
73419
+ this.report = report3;
73305
73420
  }
73306
73421
  relay;
73307
73422
  context;
@@ -73360,29 +73475,29 @@ async function serveMcpRelay({
73360
73475
  context,
73361
73476
  relay: relay2,
73362
73477
  signal,
73363
- report: report4
73478
+ report: report3
73364
73479
  }) {
73365
73480
  let wait = 1;
73366
- await report4("connecting");
73481
+ await report3("connecting");
73367
73482
  while (!signal.aborted) {
73368
- const outcome = await new McpRelaySession(relay2, context, report4).run(signal);
73483
+ const outcome = await new McpRelaySession(relay2, context, report3).run(signal);
73369
73484
  if (outcome.kind === "stopped") {
73370
- await report4(`stopped: ${outcome.why}`);
73485
+ await report3(`stopped: ${outcome.why}`);
73371
73486
  if (!signal.aborted)
73372
73487
  context.err(`${relay2.target.kind} relay ${relay2.label}: ${outcome.why}
73373
73488
  `);
73374
73489
  return;
73375
73490
  }
73376
73491
  if (outcome.openMs >= STEADY_MS) wait = 1;
73377
- await report4(`reconnecting in ${wait}s`);
73492
+ await report3(`reconnecting in ${wait}s`);
73378
73493
  await context.sleep(wait * 1e3, signal);
73379
73494
  wait = Math.min(MAX_RETRY_SECONDS, wait * 2);
73380
73495
  }
73381
73496
  }
73382
73497
  var McpRelayLoops = class _McpRelayLoops {
73383
- constructor(context, report4) {
73498
+ constructor(context, report3) {
73384
73499
  this.context = context;
73385
- this.report = report4;
73500
+ this.report = report3;
73386
73501
  }
73387
73502
  context;
73388
73503
  report;
@@ -73421,8 +73536,8 @@ var McpRelayLoops = class _McpRelayLoops {
73421
73536
  };
73422
73537
 
73423
73538
  // src/services/openclaw-relay.service.ts
73424
- import { chmod as chmod3, mkdir as mkdir6, readFile as readFile9, writeFile as writeFile6 } from "node:fs/promises";
73425
- import { dirname as dirname6, join as join8 } from "node:path";
73539
+ import { chmod as chmod3, mkdir as mkdir7, readFile as readFile10, writeFile as writeFile7 } from "node:fs/promises";
73540
+ import { dirname as dirname7, join as join8 } from "node:path";
73426
73541
 
73427
73542
  // ../../modules/openclaw/contract/src/openclaw.ts
73428
73543
  var workspaceIdSchema18 = external_exports.string().min(1);
@@ -73643,11 +73758,11 @@ var STOPS2 = /* @__PURE__ */ new Map([
73643
73758
  [OPENCLAW_RELAY_CLOSE.replaced.code, "another relay for this gateway took over"]
73644
73759
  ]);
73645
73760
  function relaysPathOf({ context }) {
73646
- return join8(dirname6(context.environment.configPath), "connect", "openclaw-relays.json");
73761
+ return join8(dirname7(context.environment.configPath), "connect", "openclaw-relays.json");
73647
73762
  }
73648
73763
  async function readRelays({ context }) {
73649
73764
  try {
73650
- return JSON.parse(await readFile9(relaysPathOf({ context }), "utf8"));
73765
+ return JSON.parse(await readFile10(relaysPathOf({ context }), "utf8"));
73651
73766
  } catch {
73652
73767
  return {};
73653
73768
  }
@@ -73657,8 +73772,8 @@ async function saveRelays({
73657
73772
  relays
73658
73773
  }) {
73659
73774
  const path = relaysPathOf({ context });
73660
- await mkdir6(dirname6(path), { recursive: true, mode: 448 });
73661
- await writeFile6(path, `${JSON.stringify(relays, null, 2)}
73775
+ await mkdir7(dirname7(path), { recursive: true, mode: 448 });
73776
+ await writeFile7(path, `${JSON.stringify(relays, null, 2)}
73662
73777
  `, { mode: 384 });
73663
73778
  await chmod3(path, 384);
73664
73779
  }
@@ -73684,10 +73799,10 @@ function send(input2) {
73684
73799
  }
73685
73800
  }
73686
73801
  var RelaySession = class {
73687
- constructor(relay2, context, report4) {
73802
+ constructor(relay2, context, report3) {
73688
73803
  this.relay = relay2;
73689
73804
  this.context = context;
73690
- this.report = report4;
73805
+ this.report = report3;
73691
73806
  }
73692
73807
  relay;
73693
73808
  context;
@@ -73783,28 +73898,28 @@ async function serveRelay({
73783
73898
  context,
73784
73899
  relay: relay2,
73785
73900
  signal,
73786
- report: report4
73901
+ report: report3
73787
73902
  }) {
73788
73903
  let wait = 1;
73789
- await report4("connecting");
73904
+ await report3("connecting");
73790
73905
  while (!signal.aborted) {
73791
- const outcome = await new RelaySession(relay2, context, report4).run(signal);
73906
+ const outcome = await new RelaySession(relay2, context, report3).run(signal);
73792
73907
  if (outcome.kind === "stopped") {
73793
- await report4(`stopped: ${outcome.why}`);
73908
+ await report3(`stopped: ${outcome.why}`);
73794
73909
  if (!signal.aborted) context.err(`openclaw relay ${relay2.label}: ${outcome.why}
73795
73910
  `);
73796
73911
  return;
73797
73912
  }
73798
73913
  if (outcome.openMs >= STEADY_MS2) wait = 1;
73799
- await report4(`reconnecting in ${wait}s`);
73914
+ await report3(`reconnecting in ${wait}s`);
73800
73915
  await context.sleep(wait * 1e3, signal);
73801
73916
  wait = Math.min(MAX_RETRY_SECONDS2, wait * 2);
73802
73917
  }
73803
73918
  }
73804
73919
  var RelayLoops = class _RelayLoops {
73805
- constructor(context, report4) {
73920
+ constructor(context, report3) {
73806
73921
  this.context = context;
73807
- this.report = report4;
73922
+ this.report = report3;
73808
73923
  }
73809
73924
  context;
73810
73925
  report;
@@ -73843,12 +73958,12 @@ var RelayLoops = class _RelayLoops {
73843
73958
  };
73844
73959
 
73845
73960
  // src/services/rush-listeners.service.ts
73846
- import { readFile as readFile11, readdir as readdir3, stat as stat3 } from "node:fs/promises";
73847
- import { dirname as dirname8, join as join10 } from "node:path";
73961
+ import { readFile as readFile12, readdir as readdir3, stat as stat3 } from "node:fs/promises";
73962
+ import { dirname as dirname9, join as join10 } from "node:path";
73848
73963
 
73849
73964
  // src/services/rush-host.service.ts
73850
- import { mkdir as mkdir7, readFile as readFile10, writeFile as writeFile7 } from "node:fs/promises";
73851
- import { dirname as dirname7, join as join9 } from "node:path";
73965
+ import { mkdir as mkdir8, readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
73966
+ import { dirname as dirname8, join as join9 } from "node:path";
73852
73967
  async function rushAboveOf({
73853
73968
  context,
73854
73969
  from = context.processes.pid
@@ -73862,7 +73977,7 @@ async function rushAboveOf({
73862
73977
  return void 0;
73863
73978
  }
73864
73979
  function guardPathOf({ context, claudePid }) {
73865
- return join9(dirname7(context.environment.configPath), "rush-guards", `${claudePid}.json`);
73980
+ return join9(dirname8(context.environment.configPath), "rush-guards", `${claudePid}.json`);
73866
73981
  }
73867
73982
  async function startRushGuard({
73868
73983
  context,
@@ -73875,7 +73990,7 @@ async function startRushGuard({
73875
73990
  if (holder && context.processes.alive(holder.pid)) return;
73876
73991
  const flags2 = ["--profile", profile, "--claude-pid", String(claudePid), "--rush-id", rush.id];
73877
73992
  const argv = [...context.program, "hook", "rush-wake", ...flags2, "--rush-program", rush.program];
73878
- const logPath = join9(dirname7(context.environment.configPath), "rush-guards", "guard.log");
73993
+ const logPath = join9(dirname8(context.environment.configPath), "rush-guards", "guard.log");
73879
73994
  context.processes.spawnDetached({ argv: ["sh", "-c", '"$@" &', "sh", ...argv], logPath });
73880
73995
  }
73881
73996
  async function claimRushGuard({
@@ -73886,12 +74001,12 @@ async function claimRushGuard({
73886
74001
  const holder = await guardHolderOf({ path });
73887
74002
  const self2 = context.processes.pid;
73888
74003
  if (holder && holder.pid !== self2 && context.processes.alive(holder.pid)) return false;
73889
- await mkdir7(dirname7(path), { recursive: true, mode: 448 });
73890
- await writeFile7(path, JSON.stringify({ pid: self2, claudePid }), { mode: 384 });
74004
+ await mkdir8(dirname8(path), { recursive: true, mode: 448 });
74005
+ await writeFile8(path, JSON.stringify({ pid: self2, claudePid }), { mode: 384 });
73891
74006
  return true;
73892
74007
  }
73893
74008
  function guardHolderOf({ path }) {
73894
- return readFile10(path, "utf8").then(
74009
+ return readFile11(path, "utf8").then(
73895
74010
  (text3) => JSON.parse(text3),
73896
74011
  () => void 0
73897
74012
  );
@@ -73899,13 +74014,13 @@ function guardHolderOf({ path }) {
73899
74014
 
73900
74015
  // src/services/rush-listeners.service.ts
73901
74016
  async function jsonOf(path) {
73902
- return readFile11(path, "utf8").then(
74017
+ return readFile12(path, "utf8").then(
73903
74018
  (text3) => JSON.parse(text3),
73904
74019
  () => void 0
73905
74020
  );
73906
74021
  }
73907
74022
  async function notesOf({ context }) {
73908
- const folder = dirname8(statePathOf({ context, kind: "sessions", profile: "x" }));
74023
+ const folder = dirname9(statePathOf({ context, kind: "sessions", profile: "x" }));
73909
74024
  const files2 = await readdir3(folder).catch(() => []);
73910
74025
  const notes = await Promise.all(
73911
74026
  files2.map(async (file3) => {
@@ -73991,8 +74106,8 @@ async function rearmRushGuards({ context }) {
73991
74106
  }
73992
74107
 
73993
74108
  // src/services/rush-watchdog.service.ts
73994
- import { appendFile, mkdir as mkdir8 } from "node:fs/promises";
73995
- import { dirname as dirname9, join as join11 } from "node:path";
74109
+ import { appendFile, mkdir as mkdir9 } from "node:fs/promises";
74110
+ import { dirname as dirname10, join as join11 } from "node:path";
73996
74111
  var UNDELIVERED_AFTER_MS = 6e4;
73997
74112
  var CHECK_TIMEOUT_MS = 5e3;
73998
74113
  function clientOf({ context, profile }) {
@@ -74021,12 +74136,12 @@ function boundAwayOf({ waiting, key }) {
74021
74136
  return `${sessionLabelOf(bound)} (${bound.harness}:${bound.sessionId})`;
74022
74137
  }
74023
74138
  async function logDelivery({ context, line }) {
74024
- const folder = join11(dirname9(context.environment.configPath), "connect");
74139
+ const folder = join11(dirname10(context.environment.configPath), "connect");
74025
74140
  const at = Temporal3.Instant.fromEpochMilliseconds(context.nowMs());
74026
74141
  const stamped = `${at.toString({ smallestUnit: "second" })} ${line}
74027
74142
  `;
74028
74143
  context.out(stamped);
74029
- await mkdir8(folder, { recursive: true, mode: 448 });
74144
+ await mkdir9(folder, { recursive: true, mode: 448 });
74030
74145
  await appendFile(join11(folder, "delivery.log"), stamped, { mode: 384 });
74031
74146
  }
74032
74147
  async function claimFor({
@@ -74103,14 +74218,14 @@ async function watchRushDelivery({
74103
74218
 
74104
74219
  // src/services/connect-delivery.service.ts
74105
74220
  function connectFolderOf({ context }) {
74106
- return join12(dirname10(context.environment.configPath), "connect");
74221
+ return join12(dirname11(context.environment.configPath), "connect");
74107
74222
  }
74108
74223
  function runStatePathOf({ context }) {
74109
74224
  return join12(connectFolderOf({ context }), "run.json");
74110
74225
  }
74111
74226
  async function readJson({ path }) {
74112
74227
  try {
74113
- return JSON.parse(await readFile12(path, "utf8"));
74228
+ return JSON.parse(await readFile13(path, "utf8"));
74114
74229
  } catch {
74115
74230
  return void 0;
74116
74231
  }
@@ -74169,7 +74284,7 @@ async function takeRound({
74169
74284
  harness: "codex",
74170
74285
  sessionId: delivery.threadId,
74171
74286
  folder: displayFolderOf({ folder: delivery.cwd, home: homedir3() }),
74172
- host: hostname4()
74287
+ host: hostname5()
74173
74288
  };
74174
74289
  try {
74175
74290
  return await client.withHeaders(sessionHeadersOf({ session })).post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS }, { signal });
@@ -74211,7 +74326,7 @@ async function serveAgent({
74211
74326
  profile,
74212
74327
  entry,
74213
74328
  signal,
74214
- report: report4
74329
+ report: report3
74215
74330
  }) {
74216
74331
  const client = LazeClient.create({
74217
74332
  baseUrl: entry.url,
@@ -74223,7 +74338,7 @@ async function serveAgent({
74223
74338
  const ended = new AbortController();
74224
74339
  const watching = watch.run({ signal: AbortSignal.any([signal, ended.signal]) });
74225
74340
  try {
74226
- await serveRounds({ context, client, profile, entry, signal, report: report4, watch });
74341
+ await serveRounds({ context, client, profile, entry, signal, report: report3, watch });
74227
74342
  } finally {
74228
74343
  ended.abort();
74229
74344
  await watching;
@@ -74235,11 +74350,11 @@ async function serveRounds({
74235
74350
  profile,
74236
74351
  entry,
74237
74352
  signal,
74238
- report: report4,
74353
+ report: report3,
74239
74354
  watch
74240
74355
  }) {
74241
74356
  let wait = 1;
74242
- await report4(profile, "listening");
74357
+ await report3(profile, "listening");
74243
74358
  while (!signal.aborted) {
74244
74359
  try {
74245
74360
  const delivered = await deliverRound({
@@ -74250,25 +74365,25 @@ async function serveRounds({
74250
74365
  signal,
74251
74366
  watch
74252
74367
  });
74253
- if (wait > 1) await report4(profile, "listening");
74368
+ if (wait > 1) await report3(profile, "listening");
74254
74369
  wait = 1;
74255
74370
  if (delivered === 0) await context.sleep(1e3, signal);
74256
74371
  } catch (error63) {
74257
74372
  const migrated = migratedNoticeOf(error63);
74258
74373
  if (migrated) {
74259
- await report4(profile, "stopped: the agent moved into Laze");
74374
+ await report3(profile, "stopped: the agent moved into Laze");
74260
74375
  context.err(`${profile}: ${migrated.notice}
74261
74376
  `);
74262
74377
  return;
74263
74378
  }
74264
74379
  if (error63 instanceof LazeApiError && error63.status === 401) {
74265
- await report4(profile, "stopped: Laze refused the agent's key; link the session again");
74380
+ await report3(profile, "stopped: Laze refused the agent's key; link the session again");
74266
74381
  context.err(`${profile}: Laze refused the key; this agent is no longer served
74267
74382
  `);
74268
74383
  return;
74269
74384
  }
74270
74385
  const state = stateOfError({ error: error63, delivery: entry.delivery });
74271
- await report4(profile, state);
74386
+ await report3(profile, state);
74272
74387
  context.err(`${profile}: ${state}; trying again in ${wait}s
74273
74388
  `);
74274
74389
  await context.sleep(wait * 1e3, signal);
@@ -74278,9 +74393,9 @@ async function serveRounds({
74278
74393
  }
74279
74394
  var saves = 0;
74280
74395
  async function save(run4) {
74281
- await mkdir9(dirname10(run4.path), { recursive: true, mode: 448 });
74396
+ await mkdir10(dirname11(run4.path), { recursive: true, mode: 448 });
74282
74397
  const temporary = `${run4.path}.${run4.self}.${saves += 1}.tmp`;
74283
- await writeFile8(temporary, JSON.stringify(run4.state));
74398
+ await writeFile9(temporary, JSON.stringify(run4.state));
74284
74399
  await rename3(temporary, run4.path);
74285
74400
  }
74286
74401
  async function holdsLock(run4) {
@@ -74302,19 +74417,19 @@ async function syncLoops(run4) {
74302
74417
  setAgent(run4, profile, void 0);
74303
74418
  }
74304
74419
  const linked = Object.entries(config2.profiles).filter(
74305
- (pair2) => pair2[1].delivery?.harness === "codex" && pair2[1].kind === "agent" && !pair2[1].migrated
74420
+ (pair) => pair[1].delivery?.harness === "codex" && pair[1].kind === "agent" && !pair[1].migrated
74306
74421
  );
74307
74422
  for (const [profile, entry] of linked.filter(([name3]) => !run4.served.has(name3))) {
74308
74423
  const { threadId } = entry.delivery;
74309
74424
  setAgent(run4, profile, { agent: entry.name, threadId, state: "starting" });
74310
74425
  const stop3 = new AbortController();
74311
- const report4 = async (name3, line) => {
74426
+ const report3 = async (name3, line) => {
74312
74427
  const agent3 = run4.state.agents[name3];
74313
74428
  if (!agent3) return;
74314
74429
  setAgent(run4, name3, { ...agent3, state: line });
74315
74430
  if (await holdsLock(run4)) await save(run4);
74316
74431
  };
74317
- const done = serveAgent({ context: run4.context, profile, entry, signal: stop3.signal, report: report4 });
74432
+ const done = serveAgent({ context: run4.context, profile, entry, signal: stop3.signal, report: report3 });
74318
74433
  run4.served.set(profile, { token: entry.token, threadId, stop: stop3, done });
74319
74434
  }
74320
74435
  }
@@ -74403,12 +74518,12 @@ function logPathOf({ context }) {
74403
74518
  return join13(connectFolderOf({ context }), "connect.log");
74404
74519
  }
74405
74520
  function homeOf({ context }) {
74406
- return context.environment.inherited.HOME ?? dirname11(dirname11(context.environment.configPath));
74521
+ return context.environment.inherited.HOME ?? dirname12(dirname12(context.environment.configPath));
74407
74522
  }
74408
74523
  function serviceNameOf({ context }) {
74409
74524
  const { configPath } = context.environment;
74410
74525
  if (configPath === join13(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
74411
- return `laze-connect-${createHash("sha256").update(configPath).digest("hex").slice(0, 8)}`;
74526
+ return `laze-connect-${createHash2("sha256").update(configPath).digest("hex").slice(0, 8)}`;
74412
74527
  }
74413
74528
  function serviceEnvOf({ context }) {
74414
74529
  const path = context.environment.inherited.PATH;
@@ -74432,8 +74547,8 @@ async function installSystemd({ context }) {
74432
74547
  const env = context.environment.inherited;
74433
74548
  const base = env.XDG_CONFIG_HOME || join13(homeOf({ context }), ".config");
74434
74549
  const file3 = join13(base, "systemd", "user", `${name3}.service`);
74435
- await mkdir10(dirname11(file3), { recursive: true });
74436
- await writeFile9(
74550
+ await mkdir11(dirname12(file3), { recursive: true });
74551
+ await writeFile10(
74437
74552
  file3,
74438
74553
  systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
74439
74554
  );
@@ -74448,8 +74563,8 @@ async function installLaunchd({ context }) {
74448
74563
  const label3 = `ai.laze.${name3}`;
74449
74564
  const file3 = join13(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
74450
74565
  const log = logPathOf({ context });
74451
- await mkdir10(dirname11(file3), { recursive: true });
74452
- await writeFile9(
74566
+ await mkdir11(dirname12(file3), { recursive: true });
74567
+ await writeFile10(
74453
74568
  file3,
74454
74569
  launchAgentOf({
74455
74570
  label: label3,
@@ -74501,8 +74616,8 @@ async function installConnectService({ context }) {
74501
74616
  const manager = await managerOf({ context });
74502
74617
  const install = { systemd: installSystemd, launchd: installLaunchd, detached: installDetached };
74503
74618
  const installed = await install[manager]({ context });
74504
- await mkdir10(dirname11(path), { recursive: true, mode: 448 });
74505
- await writeFile9(path, JSON.stringify(installed));
74619
+ await mkdir11(dirname12(path), { recursive: true, mode: 448 });
74620
+ await writeFile10(path, JSON.stringify(installed));
74506
74621
  return describeInstalled({ installed });
74507
74622
  }
74508
74623
  async function ensureConnectService({ context }) {
@@ -74652,7 +74767,7 @@ var ROUND_SECONDS2 = 50;
74652
74767
  var WATCH_MS = 2e3;
74653
74768
  var CHANNEL_CHECK_MS = 5e3;
74654
74769
  async function holderOf({ path }) {
74655
- return readFile13(path, "utf8").then(
74770
+ return readFile14(path, "utf8").then(
74656
74771
  (text3) => JSON.parse(text3),
74657
74772
  () => void 0
74658
74773
  );
@@ -74676,8 +74791,8 @@ async function takeLock({
74676
74791
  if (served && context.processes.alive(served) && !mine4) return false;
74677
74792
  context.processes.stop(holder.pid);
74678
74793
  }
74679
- await mkdir11(dirname12(path), { recursive: true, mode: 448 });
74680
- await writeFile10(
74794
+ await mkdir12(dirname13(path), { recursive: true, mode: 448 });
74795
+ await writeFile11(
74681
74796
  path,
74682
74797
  JSON.stringify({
74683
74798
  pid: self2,
@@ -74795,7 +74910,7 @@ async function waitForMessages({ context, args }) {
74795
74910
  if (rush) await healRushDelivery({ context });
74796
74911
  const lock = statePathOf({ context, kind: "waiters", profile: name3 });
74797
74912
  if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
74798
- const seen = () => input2.transcript_path ? readFile13(input2.transcript_path, "utf8") : Promise.resolve("");
74913
+ const seen = () => input2.transcript_path ? readFile14(input2.transcript_path, "utf8") : Promise.resolve("");
74799
74914
  const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
74800
74915
  try {
74801
74916
  while (context.nowMs() < deadline) {
@@ -74852,8 +74967,8 @@ import { createInterface as createInterface2 } from "node:readline";
74852
74967
 
74853
74968
  // src/services/codex-adopt.service.ts
74854
74969
  import { spawn as spawn2 } from "node:child_process";
74855
- import { mkdir as mkdir12, readdir as readdir4, readFile as readFile14, rm as rm5, stat as stat5, writeFile as writeFile11 } from "node:fs/promises";
74856
- import { dirname as dirname13, join as join14 } from "node:path";
74970
+ import { mkdir as mkdir13, readdir as readdir4, readFile as readFile15, rm as rm5, stat as stat5, writeFile as writeFile12 } from "node:fs/promises";
74971
+ import { dirname as dirname14, join as join14 } from "node:path";
74857
74972
  import { createInterface } from "node:readline";
74858
74973
 
74859
74974
  // src/rules/codex-requests.rules.ts
@@ -75052,7 +75167,7 @@ async function answer2({
75052
75167
  var MAX_RESTART_WAIT_SECONDS = 60;
75053
75168
  var HEALTHY_RUN_MS = 6e4;
75054
75169
  async function recordOf({ path }) {
75055
- return readFile14(path, "utf8").then(
75170
+ return readFile15(path, "utf8").then(
75056
75171
  (text3) => JSON.parse(text3),
75057
75172
  () => void 0
75058
75173
  );
@@ -75074,8 +75189,8 @@ async function startAdoptInBackground({
75074
75189
  const adopt = ["adopt", "codex", "--profile", profile, ...threadFlag({ thread: thread2 })];
75075
75190
  const argv = [...context.program, ...adopt, "--supervise"];
75076
75191
  const pid = context.processes.spawnDetached({ argv, logPath: log });
75077
- await mkdir12(dirname13(path), { recursive: true, mode: 448 });
75078
- await writeFile11(path, JSON.stringify({ pid, thread: thread2, log, startedAt: context.nowMs() }));
75192
+ await mkdir13(dirname14(path), { recursive: true, mode: 448 });
75193
+ await writeFile12(path, JSON.stringify({ pid, thread: thread2, log, startedAt: context.nowMs() }));
75079
75194
  return [
75080
75195
  `Started \`${laze} adopt codex\` in the background (pid ${pid}). It answers each Laze message`,
75081
75196
  `as a turn in ${thread2 ? `this Codex thread (${thread2})` : "the newest Codex thread"}, and starts again if it stops.`,
@@ -75159,7 +75274,7 @@ async function adoptedThreadOf({
75159
75274
  );
75160
75275
  if (!held) return threadId;
75161
75276
  const path = statePathOf({ context, kind: "adopt", profile, extension: "forks.json" });
75162
- const forks = await readFile14(path, "utf8").then(
75277
+ const forks = await readFile15(path, "utf8").then(
75163
75278
  (text3) => JSON.parse(text3),
75164
75279
  () => ({})
75165
75280
  );
@@ -75174,8 +75289,8 @@ async function adoptedThreadOf({
75174
75289
  }
75175
75290
  const forked = record3((await codex.call("thread/fork", { threadId })).thread).id;
75176
75291
  if (typeof forked !== "string") throw new Error("thread/fork answered no thread id");
75177
- await mkdir12(dirname13(path), { recursive: true, mode: 448 });
75178
- await writeFile11(path, JSON.stringify({ ...forks, [threadId]: forked }));
75292
+ await mkdir13(dirname14(path), { recursive: true, mode: 448 });
75293
+ await writeFile12(path, JSON.stringify({ ...forks, [threadId]: forked }));
75179
75294
  context.out(
75180
75295
  `Codex holds thread ${threadId} open elsewhere; answering in its new fork ${forked}.
75181
75296
  `
@@ -75322,9 +75437,9 @@ async function linkCodexSession({
75322
75437
  }
75323
75438
 
75324
75439
  // src/services/laze-plugin.service.ts
75325
- import { mkdir as mkdir13, readFile as readFile15, writeFile as writeFile12 } from "node:fs/promises";
75440
+ import { mkdir as mkdir14, readFile as readFile16, writeFile as writeFile13 } from "node:fs/promises";
75326
75441
  import { homedir as homedir4 } from "node:os";
75327
- import { dirname as dirname14, join as join16 } from "node:path";
75442
+ import { dirname as dirname15, join as join16 } from "node:path";
75328
75443
 
75329
75444
  // src/rules/laze-plugin.rules.ts
75330
75445
  var LAZE_PLUGIN = "laze";
@@ -75389,6 +75504,9 @@ without a recap; the person's DM already shows your messages elsewhere.
75389
75504
 
75390
75505
  ## The feed
75391
75506
 
75507
+ Claude Code background commands stop after 30 minutes by default. For longer work pass a longer
75508
+ timeout (2 hours at most) or use a schedule.
75509
+
75392
75510
  A schedule that only polls for changes should not run a turn each time: give it a check with
75393
75511
  \`laze schedule add|update ... --check <script>\`. The script prints something to wake you with
75394
75512
  that output, prints nothing to let you sleep, and keeps its own state in a file.
@@ -75421,7 +75539,10 @@ guide first: https://laze.so/docs/agents/apps.md. The short version:
75421
75539
 
75422
75540
  - Create it where it was asked for: \`laze app create "<Name>" --channel <channel>\`. It starts
75423
75541
  empty: build it from scratch and design it for its subject. Be visual and creative (a diagram,
75424
- a map, a timeline, something to explore), not stat tiles and bullet lists.
75542
+ a map, a timeline, something to explore), not stat tiles and bullet lists. Be very visual:
75543
+ motion graphics and flows where you can, guiding people one step at a time until they fully
75544
+ understand. Never walls of text: where you need words, use simple, short sentences. An app is
75545
+ for people to understand, not for your own brain dump.
75425
75546
  - The slides template is only for a new deck. Sent files that already are a page or a deck (an
75426
75547
  HTML export, a zip with index.html, a static site): unpack them as they are into a new app
75427
75548
  with no template (\`laze app create "<Name>" --channel <channel>\`), index.html at the top of
@@ -75534,11 +75655,11 @@ function lazePluginFiles({
75534
75655
  var REGISTER_LIMIT_MS = 6e4;
75535
75656
  var quote2 = (value) => `'${value.replaceAll("'", "'\\''")}'`;
75536
75657
  function pluginFolderOf({ context }) {
75537
- return join16(dirname14(context.environment.configPath), "plugins");
75658
+ return join16(dirname15(context.environment.configPath), "plugins");
75538
75659
  }
75539
75660
  async function pluginIsCurrent({ context }) {
75540
75661
  const manifest = join16(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
75541
- const written = await readFile15(manifest, "utf8").then(
75662
+ const written = await readFile16(manifest, "utf8").then(
75542
75663
  (text3) => JSON.parse(text3).version,
75543
75664
  () => void 0
75544
75665
  );
@@ -75553,8 +75674,8 @@ async function writeLazePlugin({ context }) {
75553
75674
  });
75554
75675
  for (const [path, text3] of Object.entries(files2)) {
75555
75676
  const target = join16(folder, path);
75556
- await mkdir13(dirname14(target), { recursive: true });
75557
- await writeFile12(target, text3);
75677
+ await mkdir14(dirname15(target), { recursive: true });
75678
+ await writeFile13(target, text3);
75558
75679
  }
75559
75680
  return folder;
75560
75681
  }
@@ -75585,7 +75706,7 @@ async function cachedPluginOf({ context }) {
75585
75706
  const inherited = context.environment.inherited;
75586
75707
  const home = inherited.HOME || homedir4();
75587
75708
  const claude = inherited.CLAUDE_CONFIG_DIR || join16(home, ".claude");
75588
- const listed = await readFile15(join16(claude, "plugins", "installed_plugins.json"), "utf8").then(
75709
+ const listed = await readFile16(join16(claude, "plugins", "installed_plugins.json"), "utf8").then(
75589
75710
  (text3) => JSON.parse(text3),
75590
75711
  () => void 0
75591
75712
  );
@@ -75594,7 +75715,7 @@ async function cachedPluginOf({ context }) {
75594
75715
  async function refreshStaleCache({ context, folder }) {
75595
75716
  const cached2 = await cachedPluginOf({ context });
75596
75717
  if (!cached2) return true;
75597
- const read4 = (path) => readFile15(path, "utf8").catch(() => "");
75718
+ const read4 = (path) => readFile16(path, "utf8").catch(() => "");
75598
75719
  for (const file3 of RUN_FILES) {
75599
75720
  const ours = await read4(join16(folder, LAZE_PLUGIN, file3));
75600
75721
  if (ours === await read4(join16(cached2, file3))) continue;
@@ -75611,7 +75732,7 @@ function registeredMarkOf({ context }) {
75611
75732
  return join16(pluginFolderOf({ context }), "registered");
75612
75733
  }
75613
75734
  async function pluginRegistered({ context }) {
75614
- return readFile15(registeredMarkOf({ context }), "utf8").then(
75735
+ return readFile16(registeredMarkOf({ context }), "utf8").then(
75615
75736
  () => true,
75616
75737
  () => false
75617
75738
  );
@@ -75619,7 +75740,7 @@ async function pluginRegistered({ context }) {
75619
75740
  async function installLazePlugin({ context }) {
75620
75741
  const folder = await writeLazePlugin({ context });
75621
75742
  const registered = await registerWithClaude({ context, folder }) && await refreshStaleCache({ context, folder });
75622
- if (registered) await writeFile12(registeredMarkOf({ context }), cliVersionOf());
75743
+ if (registered) await writeFile13(registeredMarkOf({ context }), cliVersionOf());
75623
75744
  return { folder, registered };
75624
75745
  }
75625
75746
  async function plugin({ context, args }) {
@@ -75643,8 +75764,8 @@ async function plugin({ context, args }) {
75643
75764
  }
75644
75765
 
75645
75766
  // src/services/mcp-channel.service.ts
75646
- import { mkdir as mkdir14, rm as rm7, writeFile as writeFile13 } from "node:fs/promises";
75647
- import { dirname as dirname15 } from "node:path";
75767
+ import { mkdir as mkdir15, rm as rm7, writeFile as writeFile14 } from "node:fs/promises";
75768
+ import { dirname as dirname16 } from "node:path";
75648
75769
  var LAZE_MCP_SERVER = "laze";
75649
75770
  var DEV_CHANNELS_FLAG = "--dangerously-load-development-channels";
75650
75771
  var ROUND_SECONDS3 = 50;
@@ -75734,8 +75855,8 @@ async function pushInbox({
75734
75855
  signal
75735
75856
  }) {
75736
75857
  const marker = statePathOf({ context, kind: "channels", profile });
75737
- await mkdir14(dirname15(marker), { recursive: true, mode: 448 });
75738
- await writeFile13(marker, JSON.stringify({ pid: context.processes.pid }));
75858
+ await mkdir15(dirname16(marker), { recursive: true, mode: 448 });
75859
+ await writeFile14(marker, JSON.stringify({ pid: context.processes.pid }));
75739
75860
  try {
75740
75861
  while (!signal.aborted) {
75741
75862
  const messages = await client.post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS3 }, { signal }).catch(async (error63) => {
@@ -75769,8 +75890,8 @@ async function pushInbox({
75769
75890
  }
75770
75891
 
75771
75892
  // src/services/plugin-tip.service.ts
75772
- import { mkdir as mkdir15, readFile as readFile16, writeFile as writeFile14 } from "node:fs/promises";
75773
- import { dirname as dirname16 } from "node:path";
75893
+ import { mkdir as mkdir16, readFile as readFile17, writeFile as writeFile15 } from "node:fs/promises";
75894
+ import { dirname as dirname17 } from "node:path";
75774
75895
  var RELOAD_TIP = "Laze: the Laze plugin is installed in Claude Code, and this session has not loaded it yet. Tell the user once, in one plain line, that it is optional: typing /reload-plugins makes Laze messages arrive right away; until then they still arrive through the hooks.";
75775
75896
  var LINK_RELOAD_TIP = "Tell the user once, in one plain line, that it is optional: typing /reload-plugins makes Laze messages arrive right away; until then they still arrive through the hooks.";
75776
75897
  function monitorsRunHere({ context }) {
@@ -75804,8 +75925,8 @@ async function markReloadTipTold({
75804
75925
  }) {
75805
75926
  if (!session) return;
75806
75927
  const path = toldPathOf({ context, session });
75807
- await mkdir15(dirname16(path), { recursive: true, mode: 448 });
75808
- await writeFile14(path, String(context.nowMs()), { mode: 384 });
75928
+ await mkdir16(dirname17(path), { recursive: true, mode: 448 });
75929
+ await writeFile15(path, String(context.nowMs()), { mode: 384 });
75809
75930
  }
75810
75931
  async function reloadTipOnce({
75811
75932
  context,
@@ -75813,7 +75934,7 @@ async function reloadTipOnce({
75813
75934
  }) {
75814
75935
  if (!session || !monitorsRunHere({ context })) return void 0;
75815
75936
  if (!await pluginRegistered({ context })) return void 0;
75816
- const told = await readFile16(toldPathOf({ context, session }), "utf8").then(
75937
+ const told = await readFile17(toldPathOf({ context, session }), "utf8").then(
75817
75938
  () => true,
75818
75939
  () => false
75819
75940
  );
@@ -75881,7 +76002,7 @@ async function installHooks({
75881
76002
  }) {
75882
76003
  const folder = join17(directory, ".claude");
75883
76004
  const path = join17(folder, "settings.local.json");
75884
- const current3 = await readFile17(path, "utf8").then(
76005
+ const current3 = await readFile18(path, "utf8").then(
75885
76006
  (text3) => JSON.parse(text3),
75886
76007
  () => ({})
75887
76008
  );
@@ -75892,8 +76013,8 @@ async function installHooks({
75892
76013
  waitCommand: command("wait"),
75893
76014
  preToolCommand: command("pre-tool")
75894
76015
  });
75895
- await mkdir16(folder, { recursive: true });
75896
- await writeFile15(path, `${JSON.stringify(settings3, null, 2)}
76016
+ await mkdir17(folder, { recursive: true });
76017
+ await writeFile16(path, `${JSON.stringify(settings3, null, 2)}
75897
76018
  `);
75898
76019
  return path;
75899
76020
  }
@@ -76120,7 +76241,7 @@ async function reportTranscript({
76120
76241
  input: input2
76121
76242
  }) {
76122
76243
  if (!input2.transcript_path || !input2.session_id) return;
76123
- const lines2 = (await readFile17(input2.transcript_path, "utf8")).split("\n");
76244
+ const lines2 = (await readFile18(input2.transcript_path, "utf8")).split("\n");
76124
76245
  const context = readTranscript({ lines: lines2 });
76125
76246
  await client.post("/api/agents/me/activity", {
76126
76247
  sessionId: input2.session_id,
@@ -76159,7 +76280,7 @@ async function handOver({ context, args }) {
76159
76280
  const kept = await dueFromSpool({
76160
76281
  context,
76161
76282
  profile: agent3,
76162
- seen: () => input2.transcript_path ? readFile17(input2.transcript_path, "utf8") : Promise.resolve(""),
76283
+ seen: () => input2.transcript_path ? readFile18(input2.transcript_path, "utf8") : Promise.resolve(""),
76163
76284
  pushedToo: false,
76164
76285
  settledOnly: true
76165
76286
  });
@@ -76201,7 +76322,7 @@ async function addSessionStartWaiter({ context, args }) {
76201
76322
  const profile = flagText({ args, name: "profile" });
76202
76323
  if (!directory || !profile) return;
76203
76324
  const path = join17(directory, ".claude", "settings.local.json");
76204
- const settings3 = await readFile17(path, "utf8").then(
76325
+ const settings3 = await readFile18(path, "utf8").then(
76205
76326
  (text3) => JSON.parse(text3),
76206
76327
  () => void 0
76207
76328
  );
@@ -76231,7 +76352,7 @@ async function stopHook({ context, args }) {
76231
76352
  }
76232
76353
 
76233
76354
  // src/services/agent-manage-commands.service.ts
76234
- import { readFile as readFile18 } from "node:fs/promises";
76355
+ import { readFile as readFile19 } from "node:fs/promises";
76235
76356
  import { extname, resolve as resolve6 } from "node:path";
76236
76357
 
76237
76358
  // src/rules/login-format.rules.ts
@@ -76248,8 +76369,8 @@ function usageOf2({
76248
76369
  limitedUntil,
76249
76370
  nowMs
76250
76371
  }) {
76251
- const limited = ahead({ iso: limitedUntil, nowMs });
76252
- if (limited) return `out of usage until ${utcTimeOf(limited)}`;
76372
+ const limited2 = ahead({ iso: limitedUntil, nowMs });
76373
+ if (limited2) return `out of usage until ${utcTimeOf(limited2)}`;
76253
76374
  if (usedPercent === null) return "no usage reading yet";
76254
76375
  const resets = ahead({ iso: resetsAt, nowMs });
76255
76376
  const used = `${Math.round(usedPercent)}% used`;
@@ -76369,7 +76490,7 @@ async function avatarOf({
76369
76490
  return emoji4;
76370
76491
  }
76371
76492
  if (!path) return void 0;
76372
- const bytes = await readFile18(resolve6(context.cwd, path)).catch(() => {
76493
+ const bytes = await readFile19(resolve6(context.cwd, path)).catch(() => {
76373
76494
  throw new CliUsageError(`laze: cannot read the avatar file ${path}.`);
76374
76495
  });
76375
76496
  const uploaded = await client.post("/api/agents/avatars", {
@@ -77085,11 +77206,11 @@ async function setAgentRunsOn({
77085
77206
  }
77086
77207
 
77087
77208
  // src/services/agent-migrate-commands.service.ts
77088
- import { readFile as readFile19, stat as stat7 } from "node:fs/promises";
77209
+ import { readFile as readFile20, stat as stat7 } from "node:fs/promises";
77089
77210
  import { basename as basename5, join as join18, resolve as resolve7 } from "node:path";
77090
77211
 
77091
77212
  // src/rules/migration-upload.rules.ts
77092
- import { createHash as createHash2 } from "node:crypto";
77213
+ import { createHash as createHash3 } from "node:crypto";
77093
77214
  function markersIn(text3) {
77094
77215
  return text3.split(REDACTION_MARKER).length - 1;
77095
77216
  }
@@ -77108,7 +77229,7 @@ async function redactTranscript({
77108
77229
  return { text: redacted.text, redactions };
77109
77230
  }
77110
77231
  function sha256Of({ text: text3 }) {
77111
- return createHash2("sha256").update(text3, "utf8").digest("hex");
77232
+ return createHash3("sha256").update(text3, "utf8").digest("hex");
77112
77233
  }
77113
77234
  var bytesOf2 = (text3) => Buffer.byteLength(text3, "utf8");
77114
77235
  function piecesOf({ line, maxBytes }) {
@@ -77375,7 +77496,7 @@ async function uploadTranscript({ context, args, client }) {
77375
77496
  `The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
77376
77497
  );
77377
77498
  }
77378
- const raw = await readFile19(found.path, "utf8");
77499
+ const raw = await readFile20(found.path, "utf8");
77379
77500
  if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
77380
77501
  const redacted = await redactTranscript({ text: raw });
77381
77502
  const { parts, truncated } = transcriptPartsOf({
@@ -77629,8 +77750,8 @@ async function requestAgent({ context, args }) {
77629
77750
  }
77630
77751
 
77631
77752
  // src/services/app-commands.service.ts
77632
- import { mkdir as mkdir17, readdir as readdir6, readFile as readFile21, writeFile as writeFile17 } from "node:fs/promises";
77633
- import { dirname as dirname17, join as join21, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
77753
+ import { mkdir as mkdir18, readdir as readdir6, readFile as readFile22, writeFile as writeFile18 } from "node:fs/promises";
77754
+ import { dirname as dirname18, join as join21, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
77634
77755
 
77635
77756
  // ../../modules/app/contract/src/app.connections.ts
77636
77757
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -80080,7 +80201,7 @@ async function appPinsCommand({
80080
80201
 
80081
80202
  // src/services/app-script-check.service.ts
80082
80203
  import { execFile } from "node:child_process";
80083
- import { mkdtemp, rm as rm8, writeFile as writeFile16 } from "node:fs/promises";
80204
+ import { mkdtemp, rm as rm8, writeFile as writeFile17 } from "node:fs/promises";
80084
80205
  import { tmpdir } from "node:os";
80085
80206
  import { join as join19 } from "node:path";
80086
80207
  import { promisify } from "node:util";
@@ -80116,7 +80237,7 @@ async function scriptErrorsOf({
80116
80237
  const errors = await Promise.all(
80117
80238
  scripts.map(async (script, index) => {
80118
80239
  const file3 = join19(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
80119
- await writeFile16(file3, script.code);
80240
+ await writeFile17(file3, script.code);
80120
80241
  try {
80121
80242
  await run2(process.execPath, ["--check", file3]);
80122
80243
  return null;
@@ -80133,7 +80254,7 @@ async function scriptErrorsOf({
80133
80254
  }
80134
80255
 
80135
80256
  // src/services/app-serve.service.ts
80136
- import { readFile as readFile20, stat as stat8 } from "node:fs/promises";
80257
+ import { readFile as readFile21, stat as stat8 } from "node:fs/promises";
80137
80258
  import { createServer } from "node:http";
80138
80259
  import { extname as extname2, join as join20, normalize, sep as sep2 } from "node:path";
80139
80260
  var TYPES2 = {
@@ -80192,7 +80313,7 @@ async function staticFile({
80192
80313
  const info = await stat8(target).catch(() => void 0);
80193
80314
  if (!info?.isFile()) continue;
80194
80315
  const type = TYPES2[extname2(target).toLowerCase()] ?? "application/octet-stream";
80195
- const body = await readFile20(target);
80316
+ const body = await readFile21(target);
80196
80317
  if (extname2(target) === ".html") {
80197
80318
  return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
80198
80319
  }
@@ -80425,7 +80546,7 @@ async function turnTokenOf2({
80425
80546
  const pinned = env.LAZE_TURN_TOKEN?.trim();
80426
80547
  if (pinned) return pinned;
80427
80548
  if (env.LAZE_TURN_FILE) {
80428
- return readFile21(env.LAZE_TURN_FILE, "utf8").then(
80549
+ return readFile22(env.LAZE_TURN_FILE, "utf8").then(
80429
80550
  (text3) => text3.trim(),
80430
80551
  () => ""
80431
80552
  );
@@ -80455,7 +80576,7 @@ function folderOf({ context, word: word3 }) {
80455
80576
  return resolve8(context.cwd, word3 ?? ".");
80456
80577
  }
80457
80578
  async function readManifest(folder) {
80458
- const text3 = await readFile21(join21(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
80579
+ const text3 = await readFile22(join21(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
80459
80580
  if (text3 === void 0) return void 0;
80460
80581
  const parsed = appManifestSchema.safeParse(JSON.parse(text3));
80461
80582
  if (!parsed.success) {
@@ -80490,7 +80611,7 @@ async function jsonFlag({
80490
80611
  }) {
80491
80612
  const raw = flagText({ args, name: name3 });
80492
80613
  if (!raw) return void 0;
80493
- const text3 = raw.startsWith("@") ? await readFile21(resolve8(context.cwd, raw.slice(1)), "utf8") : raw;
80614
+ const text3 = raw.startsWith("@") ? await readFile22(resolve8(context.cwd, raw.slice(1)), "utf8") : raw;
80494
80615
  try {
80495
80616
  return JSON.parse(text3);
80496
80617
  } catch {
@@ -80539,12 +80660,12 @@ var appCreate = async ({ context, args }) => {
80539
80660
  ...template ? { template } : {}
80540
80661
  });
80541
80662
  const folder = resolve8(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
80542
- await mkdir17(folder, { recursive: true });
80663
+ await mkdir18(folder, { recursive: true });
80543
80664
  const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
80544
80665
  for (const file3 of start2?.files ?? []) {
80545
80666
  const target = join21(folder, ...file3.path.split("/"));
80546
- await mkdir17(dirname17(target), { recursive: true });
80547
- await writeFile17(
80667
+ await mkdir18(dirname18(target), { recursive: true });
80668
+ await writeFile18(
80548
80669
  target,
80549
80670
  file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
80550
80671
  );
@@ -80555,7 +80676,7 @@ var appCreate = async ({ context, args }) => {
80555
80676
  views: [...start2?.template.views ?? []],
80556
80677
  seed: { ...start2?.template.seed }
80557
80678
  };
80558
- await writeFile17(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
80679
+ await writeFile18(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
80559
80680
  `);
80560
80681
  const where = relative3(context.cwd, folder) || ".";
80561
80682
  print5({
@@ -80627,7 +80748,7 @@ var appPush = async ({ context, args }) => {
80627
80748
  paths.map(
80628
80749
  async (path) => buildFileOf({
80629
80750
  path: relative3(folder, path).split(sep3).join("/"),
80630
- bytes: await readFile21(path)
80751
+ bytes: await readFile22(path)
80631
80752
  })
80632
80753
  )
80633
80754
  );
@@ -80697,7 +80818,7 @@ var appWrite = async ({ context, args }) => {
80697
80818
  const path = resolve8(context.cwd, word3);
80698
80819
  const { bytes: _bytes, ...file3 } = buildFileOf({
80699
80820
  path: relative3(folder, path).split(sep3).join("/"),
80700
- bytes: await readFile21(path)
80821
+ bytes: await readFile22(path)
80701
80822
  });
80702
80823
  return file3;
80703
80824
  })
@@ -80825,8 +80946,8 @@ var appPull = async ({ context, args }) => {
80825
80946
  }
80826
80947
  for (const file3 of pulled.files) {
80827
80948
  const target = join21(folder, ...file3.path.split("/"));
80828
- await mkdir17(dirname17(target), { recursive: true });
80829
- await writeFile17(
80949
+ await mkdir18(dirname18(target), { recursive: true });
80950
+ await writeFile18(
80830
80951
  target,
80831
80952
  file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
80832
80953
  );
@@ -80843,7 +80964,7 @@ var appPull = async ({ context, args }) => {
80843
80964
  ])
80844
80965
  )
80845
80966
  };
80846
- await writeFile17(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
80967
+ await writeFile18(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
80847
80968
  `);
80848
80969
  const names = pulled.collections.map((collection) => collection.name);
80849
80970
  const where = relative3(context.cwd, folder) || ".";
@@ -81150,7 +81271,7 @@ var appExport = async ({ context, args }) => {
81150
81271
  const out = flagText({ args, name: "out" });
81151
81272
  if (!out) return context.out(exported.body);
81152
81273
  const target = resolve8(context.cwd, out);
81153
- await writeFile17(target, exported.body);
81274
+ await writeFile18(target, exported.body);
81154
81275
  context.out(`Wrote ${exported.rows} records to ${relative3(context.cwd, target)}
81155
81276
  `);
81156
81277
  };
@@ -81158,7 +81279,7 @@ var appImport = async ({ context, args }) => {
81158
81279
  const words = args.words.slice(2);
81159
81280
  const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
81160
81281
  if (!collection || !file3) throw new CliUsageError(USAGE5);
81161
- const csv = await readFile21(resolve8(context.cwd, file3), "utf8").catch(() => {
81282
+ const csv = await readFile22(resolve8(context.cwd, file3), "utf8").catch(() => {
81162
81283
  throw new CliUsageError(`Cannot read ${file3}`);
81163
81284
  });
81164
81285
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
@@ -81176,7 +81297,7 @@ var appImport = async ({ context, args }) => {
81176
81297
  });
81177
81298
  const refusedOut = flagText({ args, name: "refused" });
81178
81299
  if (refusedOut && result2.refusedCsv) {
81179
- await writeFile17(resolve8(context.cwd, refusedOut), result2.refusedCsv);
81300
+ await writeFile18(resolve8(context.cwd, refusedOut), result2.refusedCsv);
81180
81301
  }
81181
81302
  const fitting = result2.rows - result2.refused.length;
81182
81303
  const skipped = result2.refused.slice(0, 20).map((row) => ` line ${row.line}: ${row.reason}
@@ -81569,14 +81690,14 @@ async function app({ context, args }) {
81569
81690
  }
81570
81691
 
81571
81692
  // src/services/auth-commands.service.ts
81572
- import { hostname as hostname5 } from "node:os";
81693
+ import { hostname as hostname6 } from "node:os";
81573
81694
 
81574
81695
  // src/rules/machine-proof.rules.ts
81575
- import { createHash as createHash3, randomBytes } from "node:crypto";
81696
+ import { createHash as createHash4, randomBytes } from "node:crypto";
81576
81697
  var b64url3 = (bytes) => Buffer.from(bytes).toString("base64url");
81577
81698
  function thumbprintOf({ jwk }) {
81578
81699
  const canonical = JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y });
81579
- return b64url3(createHash3("sha256").update(canonical).digest());
81700
+ return b64url3(createHash4("sha256").update(canonical).digest());
81580
81701
  }
81581
81702
  function lazeTokenOf({ authorization }) {
81582
81703
  const match = /^Bearer (lz_\S+)$/.exec(authorization ?? "");
@@ -81600,7 +81721,7 @@ function machineProofOf({
81600
81721
  htu: url2,
81601
81722
  iat: Math.floor(nowMs / 1e3),
81602
81723
  jti,
81603
- ath: b64url3(createHash3("sha256").update(credential).digest()),
81724
+ ath: b64url3(createHash4("sha256").update(credential).digest()),
81604
81725
  lz_tier: tier,
81605
81726
  ...tailscaleNodeId ? { lz_ts: tailscaleNodeId } : {}
81606
81727
  })
@@ -81673,7 +81794,7 @@ async function deviceToken({
81673
81794
  clientName: flagText({
81674
81795
  args,
81675
81796
  name: "client",
81676
- fallback: `laze CLI on ${hostname5()}`.slice(0, 80)
81797
+ fallback: `laze CLI on ${hostname6()}`.slice(0, 80)
81677
81798
  }),
81678
81799
  ...machineKey ? { machineKey } : {}
81679
81800
  });
@@ -82017,11 +82138,11 @@ async function billing({ context, args }) {
82017
82138
 
82018
82139
  // src/services/browser-commands.service.ts
82019
82140
  import { randomBytes as randomBytes2 } from "node:crypto";
82020
- import { mkdir as mkdir20, readFile as readFile23, writeFile as writeFile20 } from "node:fs/promises";
82021
- import { dirname as dirname19, join as join24 } from "node:path";
82141
+ import { mkdir as mkdir21, readFile as readFile24, writeFile as writeFile21 } from "node:fs/promises";
82142
+ import { dirname as dirname20, join as join24 } from "node:path";
82022
82143
 
82023
82144
  // src/services/browser-tab-commands.service.ts
82024
- import { mkdir as mkdir19, writeFile as writeFile19 } from "node:fs/promises";
82145
+ import { mkdir as mkdir20, writeFile as writeFile20 } from "node:fs/promises";
82025
82146
  import { tmpdir as tmpdir3 } from "node:os";
82026
82147
  import { join as join23 } from "node:path";
82027
82148
 
@@ -82053,10 +82174,10 @@ function loginValuesOf({
82053
82174
  }
82054
82175
 
82055
82176
  // src/services/vault-commands.service.ts
82056
- import { createHash as createHash4 } from "node:crypto";
82057
- import { mkdir as mkdir18, readFile as readFile22, rm as rm9, writeFile as writeFile18 } from "node:fs/promises";
82058
- import { hostname as hostname6, tmpdir as tmpdir2 } from "node:os";
82059
- import { dirname as dirname18, join as join22 } from "node:path";
82177
+ import { createHash as createHash5 } from "node:crypto";
82178
+ import { mkdir as mkdir19, readFile as readFile23, rm as rm9, writeFile as writeFile19 } from "node:fs/promises";
82179
+ import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
82180
+ import { dirname as dirname19, join as join22 } from "node:path";
82060
82181
 
82061
82182
  // src/rules/vault-session.rules.ts
82062
82183
  function vaultSessionOf({
@@ -82121,7 +82242,7 @@ async function turnTokenOf3({
82121
82242
  if (pinned) return pinned;
82122
82243
  if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
82123
82244
  try {
82124
- return (await readFile22(turnFile, "utf8")).trim();
82245
+ return (await readFile23(turnFile, "utf8")).trim();
82125
82246
  } catch {
82126
82247
  throw new CliUsageError(`${command} works only during an agent's turn`);
82127
82248
  }
@@ -82131,12 +82252,12 @@ function runKeyPathOf({
82131
82252
  connection,
82132
82253
  profile = ""
82133
82254
  }) {
82134
- const name3 = createHash4("sha256").update(connection).digest("hex");
82135
- const base = turnFile ? dirname18(turnFile) : join22(tmpdir2(), "laze-vault", profile);
82255
+ const name3 = createHash5("sha256").update(connection).digest("hex");
82256
+ const base = turnFile ? dirname19(turnFile) : join22(tmpdir2(), "laze-vault", profile);
82136
82257
  return join22(base, "vault-run-keys", `${name3}.json`);
82137
82258
  }
82138
82259
  async function runKeyAt({ path }) {
82139
- const saved3 = await readFile22(path, "utf8").then(
82260
+ const saved3 = await readFile23(path, "utf8").then(
82140
82261
  (text3) => JSON.parse(text3),
82141
82262
  () => void 0
82142
82263
  );
@@ -82146,8 +82267,8 @@ async function runKeyAt({ path }) {
82146
82267
  }
82147
82268
  const fresh = await generateEcdhKeys();
82148
82269
  const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
82149
- await mkdir18(dirname18(path), { recursive: true, mode: 448 });
82150
- await writeFile18(path, JSON.stringify({ publicKey: fresh.publicKey, privateKey: jwk }), {
82270
+ await mkdir19(dirname19(path), { recursive: true, mode: 448 });
82271
+ await writeFile19(path, JSON.stringify({ publicKey: fresh.publicKey, privateKey: jwk }), {
82151
82272
  mode: 384
82152
82273
  });
82153
82274
  return fresh;
@@ -82340,7 +82461,7 @@ async function vaultSessionFor({
82340
82461
  harnessSession,
82341
82462
  inherited: context.environment.inherited,
82342
82463
  cwd: context.cwd,
82343
- host: hostname6(),
82464
+ host: hostname7(),
82344
82465
  named: flagText({ args, name: "as" }),
82345
82466
  shellPid: await context.processes.parentOf(context.processes.pid),
82346
82467
  terminal: context.stdoutIsTerminal === true
@@ -82663,9 +82784,9 @@ async function savedScreenshot({
82663
82784
  nowMs
82664
82785
  }) {
82665
82786
  const folder = join23(tmpdir3(), "laze-browser");
82666
- await mkdir19(folder, { recursive: true, mode: 448 });
82787
+ await mkdir20(folder, { recursive: true, mode: 448 });
82667
82788
  const path = join23(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
82668
- await writeFile19(path, Buffer.from(data, "base64"), { mode: 384 });
82789
+ await writeFile20(path, Buffer.from(data, "base64"), { mode: 384 });
82669
82790
  return path;
82670
82791
  }
82671
82792
  async function shareTab({ args, client, channel, print: print9 }) {
@@ -83141,7 +83262,7 @@ async function turnTokenOf4({
83141
83262
  const pinned = env.LAZE_TURN_TOKEN?.trim();
83142
83263
  if (pinned) return pinned;
83143
83264
  if (env.LAZE_TURN_FILE) {
83144
- return readFile23(env.LAZE_TURN_FILE, "utf8").then(
83265
+ return readFile24(env.LAZE_TURN_FILE, "utf8").then(
83145
83266
  (text3) => text3.trim(),
83146
83267
  () => ""
83147
83268
  );
@@ -83231,7 +83352,7 @@ async function answering({
83231
83352
  }
83232
83353
  function bridgeStatePath({ context, machine: machine2 }) {
83233
83354
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
83234
- return join24(dirname19(context.environment.configPath), "bridges", `${safe}.json`);
83355
+ return join24(dirname20(context.environment.configPath), "bridges", `${safe}.json`);
83235
83356
  }
83236
83357
  async function bridgePort({
83237
83358
  context,
@@ -83239,7 +83360,7 @@ async function bridgePort({
83239
83360
  access
83240
83361
  }) {
83241
83362
  const path = bridgeStatePath({ context, machine: machine2 });
83242
- const live = await readFile23(path, "utf8").then(
83363
+ const live = await readFile24(path, "utf8").then(
83243
83364
  (text3) => JSON.parse(text3),
83244
83365
  () => void 0
83245
83366
  );
@@ -83252,8 +83373,8 @@ async function bridgePort({
83252
83373
  key,
83253
83374
  ...target
83254
83375
  });
83255
- await mkdir20(dirname19(path), { recursive: true, mode: 448 });
83256
- await writeFile20(path, JSON.stringify({ port, key }), { mode: 384 });
83376
+ await mkdir21(dirname20(path), { recursive: true, mode: 448 });
83377
+ await writeFile21(path, JSON.stringify({ port, key }), { mode: 384 });
83257
83378
  return port;
83258
83379
  }
83259
83380
  async function bridge({ context }) {
@@ -83949,8 +84070,145 @@ async function channelSettings({ context, args }) {
83949
84070
  }
83950
84071
 
83951
84072
  // src/services/chat-actions-commands.service.ts
83952
- import { readFile as readFile24 } from "node:fs/promises";
83953
- import { basename as basename6, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve9 } from "node:path";
84073
+ import { readFile as readFile25 } from "node:fs/promises";
84074
+ import { basename as basename7, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve10 } from "node:path";
84075
+
84076
+ // src/services/file-download.service.ts
84077
+ import { createWriteStream } from "node:fs";
84078
+ import { mkdir as mkdir22, rename as rename5, rm as rm10, stat as stat9, truncate } from "node:fs/promises";
84079
+ import { basename as basename6, dirname as dirname21, resolve as resolve9 } from "node:path";
84080
+ import { Readable, Transform } from "node:stream";
84081
+ import { pipeline } from "node:stream/promises";
84082
+ var NOT_READY_WAIT_MS = 5e3;
84083
+ var NOT_READY_TRIES = 24;
84084
+ var STALLED_TRIES = 4;
84085
+ var RETRY_WAIT_MS = 1e3;
84086
+ var LIMIT_LINE = `This file is over the ${ATTACHMENT_MAX_BYTES / 1024 ** 3} GB limit`;
84087
+ async function linkOf({
84088
+ context,
84089
+ client,
84090
+ attachmentId
84091
+ }) {
84092
+ for (let tries = 1; ; tries += 1) {
84093
+ try {
84094
+ return await client.post(CHAT_KEY_PATHS.fileLink, { attachmentId, download: true });
84095
+ } catch (error63) {
84096
+ const processing = error63 instanceof LazeApiError && error63.code === "file_not_ready";
84097
+ if (!processing || tries >= NOT_READY_TRIES) throw error63;
84098
+ await context.sleep(NOT_READY_WAIT_MS);
84099
+ }
84100
+ }
84101
+ }
84102
+ function nameFrom({ response, attachmentId }) {
84103
+ const header = response.headers.get("content-disposition") ?? "";
84104
+ const encoded = /filename\*=UTF-8''([^;]+)/i.exec(header)?.[1];
84105
+ const plain3 = /filename="?([^";]+)"?/i.exec(header)?.[1];
84106
+ const name3 = encoded ? decodeURIComponent(encoded) : plain3;
84107
+ const safe = name3 ? basename6(name3.replaceAll("\\", "/")) : "";
84108
+ return safe && safe !== "." && safe !== ".." ? safe : attachmentId;
84109
+ }
84110
+ function limited({ start: start2 }) {
84111
+ let total = start2;
84112
+ return new Transform({
84113
+ transform(chunk, _encoding, done) {
84114
+ total += chunk.byteLength;
84115
+ if (total > ATTACHMENT_MAX_BYTES) done(new CliUsageError(LIMIT_LINE));
84116
+ else done(null, chunk);
84117
+ }
84118
+ });
84119
+ }
84120
+ function totalOf({ response, start: start2 }) {
84121
+ const ranged = /\/(\d+)$/.exec(response.headers.get("content-range") ?? "")?.[1];
84122
+ if (ranged) return Number(ranged);
84123
+ const length = response.headers.get("content-length");
84124
+ if (length === null) return void 0;
84125
+ return Number(length) + (response.status === 206 ? start2 : 0);
84126
+ }
84127
+ var sizeOnDisk = (path) => stat9(path).then(
84128
+ (found) => found.size,
84129
+ () => 0
84130
+ );
84131
+ async function fetchInto({
84132
+ context,
84133
+ url: url2,
84134
+ part,
84135
+ attachmentId,
84136
+ out
84137
+ }) {
84138
+ const had = await sizeOnDisk(part);
84139
+ const response = await context.fetcher(url2, {
84140
+ headers: had > 0 ? { range: `bytes=${had}-` } : {}
84141
+ });
84142
+ if (response.status === 416) return { done: true, path: void 0 };
84143
+ if (response.status >= 500) return { done: false, path: void 0 };
84144
+ if (!response.ok || !response.body) {
84145
+ throw new CliUsageError(`The file store refused the download (${response.status})`);
84146
+ }
84147
+ const start2 = response.status === 206 ? had : 0;
84148
+ if (start2 === 0) await truncate(part, 0).catch(() => void 0);
84149
+ const total = totalOf({ response, start: start2 });
84150
+ if (total !== void 0 && total > ATTACHMENT_MAX_BYTES) {
84151
+ await response.body.cancel();
84152
+ throw new CliUsageError(LIMIT_LINE);
84153
+ }
84154
+ const path = out ? void 0 : nameFrom({ response, attachmentId });
84155
+ await pipeline(
84156
+ Readable.fromWeb(response.body),
84157
+ limited({ start: start2 }),
84158
+ createWriteStream(part, { flags: "a" })
84159
+ );
84160
+ const size = await sizeOnDisk(part);
84161
+ if (total !== void 0 && size > total) {
84162
+ throw new CliUsageError("The file changed during the download; try again");
84163
+ }
84164
+ return { done: total === void 0 || size === total, path };
84165
+ }
84166
+ var retryable = (error63) => !(error63 instanceof CliUsageError || error63 instanceof LazeApiError) && !isDiskError(error63);
84167
+ function isDiskError(error63) {
84168
+ const code = error63?.code;
84169
+ return ["ENOSPC", "EACCES", "EROFS", "EISDIR", "ENOTDIR", "EDQUOT"].includes(String(code));
84170
+ }
84171
+ async function fetchWhole(input2) {
84172
+ const { context, client, attachmentId, part, out } = input2;
84173
+ let named;
84174
+ let stalled = 0;
84175
+ for (; ; ) {
84176
+ const before = await sizeOnDisk(part);
84177
+ try {
84178
+ const { url: url2 } = await linkOf({ context, client, attachmentId });
84179
+ const { done, path } = await fetchInto({ context, url: url2, part, attachmentId, out });
84180
+ named = path ?? named;
84181
+ if (done) return named;
84182
+ } catch (error63) {
84183
+ if (!retryable(error63)) throw error63;
84184
+ }
84185
+ stalled = await sizeOnDisk(part) > before ? 0 : stalled + 1;
84186
+ if (stalled >= STALLED_TRIES) {
84187
+ throw new CliUsageError(`The download of ${attachmentId} kept failing; try again`);
84188
+ }
84189
+ await context.sleep(RETRY_WAIT_MS);
84190
+ }
84191
+ }
84192
+ async function downloadFile({
84193
+ context,
84194
+ client,
84195
+ attachmentId,
84196
+ out
84197
+ }) {
84198
+ const asked = out ? resolve9(context.cwd, out) : void 0;
84199
+ const part = resolve9(asked ? dirname21(asked) : context.cwd, `.${attachmentId}.part`);
84200
+ await mkdir22(dirname21(part), { recursive: true });
84201
+ const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
84202
+ async (error63) => {
84203
+ await rm10(part, { force: true });
84204
+ if (!isDiskError(error63)) throw error63;
84205
+ throw new CliUsageError(`Could not write ${attachmentId} to disk: ${String(error63)}`);
84206
+ }
84207
+ );
84208
+ const path = asked ?? resolve9(context.cwd, named ?? attachmentId);
84209
+ await rename5(part, path);
84210
+ return { path, sizeBytes: await sizeOnDisk(path) };
84211
+ }
83954
84212
 
83955
84213
  // src/services/thread-wait-commands.service.ts
83956
84214
  var USAGE7 = "Usage: laze thread <message-id> --wait-reply [--timeout <1-3600 seconds>]";
@@ -84005,6 +84263,7 @@ var CHAT_ACTIONS_USAGE = `Usage:
84005
84263
  laze channel unread <channel> [--seq <n>] mark it unread from a message, or its last one
84006
84264
  laze files <channel> [--before <fileId>] [--limit <n>] its files, newest first
84007
84265
  laze file link <fileId> [--variant original|thumbnail|poster|preview] [--download]
84266
+ laze file download <fileId> [--out <path>] save a file to disk, up to 1 GB
84008
84267
  laze file rename <fileId> <name> rename a file you posted
84009
84268
  laze file upload <channel> <path> [--name <name>] [--type <content-type>] upload a file; post it with its id
84010
84269
  laze saved [--done] [--limit <n>] | laze saved marks your saved messages (people)
@@ -84205,11 +84464,11 @@ var files = async ({ context, args, client }) => {
84205
84464
  };
84206
84465
  function uploadNameOf({ cwd, path }) {
84207
84466
  const inside = relative4(cwd, path);
84208
- return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename6(path);
84467
+ return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename7(path);
84209
84468
  }
84210
84469
  var fileUpload = async ({ context, args, client }) => {
84211
- const path = resolve9(context.cwd, wordAt(args, 3));
84212
- const bytes = new Uint8Array(await readFile24(path));
84470
+ const path = resolve10(context.cwd, wordAt(args, 3));
84471
+ const bytes = new Uint8Array(await readFile25(path));
84213
84472
  const answer6 = await uploadFile({
84214
84473
  context,
84215
84474
  client,
@@ -84240,6 +84499,17 @@ var FILE_VERBS = {
84240
84499
  download: Boolean(args.flags.download)
84241
84500
  });
84242
84501
  print6({ context, args, answer: answer6, text: (it) => `${it.url}
84502
+ ` });
84503
+ },
84504
+ download: async ({ context, args, client }) => {
84505
+ const out = flagText({ args, name: "out" });
84506
+ const answer6 = await downloadFile({
84507
+ context,
84508
+ client,
84509
+ attachmentId: wordAt(args, 2),
84510
+ ...out && { out }
84511
+ });
84512
+ print6({ context, args, answer: answer6, text: (it) => `Saved ${it.path} (${it.sizeBytes} bytes).
84243
84513
  ` });
84244
84514
  },
84245
84515
  rename: async ({ context, args, client }) => {
@@ -84382,7 +84652,7 @@ async function chatActions({
84382
84652
  }
84383
84653
 
84384
84654
  // src/services/claude-monitor.service.ts
84385
- import { readFile as readFile25, rm as rm10 } from "node:fs/promises";
84655
+ import { readFile as readFile26, rm as rm11 } from "node:fs/promises";
84386
84656
  var MONITOR_IDLE_MS = 3e4;
84387
84657
  var MONITOR_OUTRANKED_MS = 3e3;
84388
84658
  async function deliverOnce({
@@ -84450,7 +84720,7 @@ async function monitorRound(turn) {
84450
84720
  async function release({ context, profile }) {
84451
84721
  const lock = statePathOf({ context, kind: "waiters", profile });
84452
84722
  if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
84453
- await rm10(lock, { force: true });
84723
+ await rm11(lock, { force: true });
84454
84724
  }
84455
84725
  async function monitorHook({ context, args }) {
84456
84726
  const claudePid = await claudePidOf({ context });
@@ -84489,7 +84759,7 @@ async function monitorSessionOf({
84489
84759
  const fromEnv = sessionOf({ context, harness: "claude-code", sessionId });
84490
84760
  if (fromEnv || !claudePid) return fromEnv;
84491
84761
  const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
84492
- return readFile25(path, "utf8").then(
84762
+ return readFile26(path, "utf8").then(
84493
84763
  (text3) => JSON.parse(text3),
84494
84764
  () => void 0
84495
84765
  );
@@ -84822,7 +85092,7 @@ var COMPUTER_SIZES = [
84822
85092
  units: 8
84823
85093
  })
84824
85094
  ];
84825
- var DEDICATED_IP_TERMS = { monthlyCost: 2.5, monthlyPrice: 3 };
85095
+ var DEDICATED_IP_TERMS = { monthlyCost: 3.59, monthlyPrice: 4 };
84826
85096
  var DEDICATED_IP_MARKUP = DEDICATED_IP_TERMS.monthlyPrice / DEDICATED_IP_TERMS.monthlyCost;
84827
85097
  var CREDIT_TERMS = {
84828
85098
  minTopUp: 10,
@@ -85527,7 +85797,17 @@ var computerChangedDefinition = external_exports.object({
85527
85797
 
85528
85798
  // ../../modules/compute/contract/src/dedicated-ip.ts
85529
85799
  var DEDICATED_IP_MAX_DOMAINS = 50;
85800
+ var dedicatedIpScopeSchema = external_exports.enum(["all", "sites"]);
85530
85801
  var DEDICATED_IP_MONTHLY_PRICE = DEDICATED_IP_TERMS.monthlyPrice;
85802
+ var adoptDedicatedAddressInputDefinition = external_exports.object({
85803
+ workspaceId: external_exports.string().min(1),
85804
+ userId: external_exports.string().min(1),
85805
+ orderId: external_exports.string().min(1),
85806
+ ip: external_exports.string().min(1),
85807
+ countryCode: external_exports.string().length(2),
85808
+ coveredThrough: external_exports.iso.date(),
85809
+ reason: external_exports.string().trim().min(3).max(500)
85810
+ });
85531
85811
  var countryDefinition = external_exports.object({
85532
85812
  /** ISO 3166-1 alpha-2, upper case. */
85533
85813
  code: external_exports.string().length(2),
@@ -85545,6 +85825,9 @@ var dedicatedIpStatusDefinition = external_exports.object({
85545
85825
  address: external_exports.string().nullable(),
85546
85826
  domains: external_exports.array(external_exports.string()),
85547
85827
  defaultDomains: external_exports.array(external_exports.string()),
85828
+ scope: dedicatedIpScopeSchema,
85829
+ /** When the health check found it stopped working; null while it works. */
85830
+ troubleSince: external_exports.iso.datetime().nullable(),
85548
85831
  currency: currencySchema,
85549
85832
  monthlyPrice: external_exports.number().nonnegative(),
85550
85833
  /** Why Laze turned it off: credits ran out, or its owner left the workspace. */
@@ -85590,7 +85873,8 @@ var setDedicatedIpDomainsInputDefinition = external_exports.object({
85590
85873
  add: external_exports.array(external_exports.string().max(300)).max(DEDICATED_IP_MAX_DOMAINS).default([]),
85591
85874
  remove: external_exports.array(external_exports.string().max(300)).max(DEDICATED_IP_MAX_DOMAINS).default([]),
85592
85875
  /** Back to the defaults, before any add or remove. */
85593
- reset: external_exports.boolean().default(false)
85876
+ reset: external_exports.boolean().default(false),
85877
+ scope: dedicatedIpScopeSchema.optional()
85594
85878
  });
85595
85879
  var setDedicatedIpDomainsInputSchema = setDedicatedIpDomainsInputDefinition;
85596
85880
  var dedicatedIpOfferInputDefinition = external_exports.object({
@@ -85745,7 +86029,7 @@ var whatsappSendDefinition = external_exports.object({
85745
86029
  var whatsappPairingDefinition = external_exports.object({
85746
86030
  pairingId: external_exports.string(),
85747
86031
  machineId: external_exports.string(),
85748
- state: external_exports.enum(["starting", "scan", "paired", "failed"]),
86032
+ state: external_exports.enum(["starting", "scan", "linking", "paired", "failed"]),
85749
86033
  /** The code as an SVG data URL, while `state` is `scan`. */
85750
86034
  qrSvg: external_exports.string().nullable(),
85751
86035
  /** The code to type on the phone, when the pairing named a phone number. */
@@ -85762,11 +86046,19 @@ var pairInputDefinition = external_exports.object({
85762
86046
  });
85763
86047
  var whatsappPairInputSchema = pairInputDefinition;
85764
86048
  var whatsappOnlineModeSchema = external_exports.enum(["never", "active"]);
86049
+ var whatsappVisitEveryDefinition = external_exports.union([
86050
+ external_exports.literal(5),
86051
+ external_exports.literal(15),
86052
+ external_exports.literal(30),
86053
+ external_exports.literal(60)
86054
+ ]);
86055
+ var whatsappVisitEverySchema = whatsappVisitEveryDefinition;
85765
86056
  var mirrorSettingsDefinition = external_exports.object({
85766
86057
  machineId: external_exports.string(),
85767
86058
  mirrorOn: external_exports.boolean(),
85768
86059
  onlineMode: whatsappOnlineModeSchema,
85769
- agentsRead: external_exports.boolean()
86060
+ agentsRead: external_exports.boolean(),
86061
+ visitEveryMinutes: whatsappVisitEverySchema
85770
86062
  });
85771
86063
  var whatsappMirrorSettingsSchema = mirrorSettingsDefinition;
85772
86064
  var setMirrorSettingsDefinition = external_exports.object({
@@ -85774,9 +86066,20 @@ var setMirrorSettingsDefinition = external_exports.object({
85774
86066
  machine: machineRefText2,
85775
86067
  mirrorOn: external_exports.boolean().optional(),
85776
86068
  onlineMode: whatsappOnlineModeSchema.optional(),
85777
- agentsRead: external_exports.boolean().optional()
86069
+ agentsRead: external_exports.boolean().optional(),
86070
+ visitEveryMinutes: whatsappVisitEverySchema.optional()
85778
86071
  });
85779
86072
  var setWhatsappMirrorInputSchema = setMirrorSettingsDefinition;
86073
+ var whatsappComputerDefinition = external_exports.object({
86074
+ offered: external_exports.boolean(),
86075
+ machineId: external_exports.string().nullable(),
86076
+ machine: external_exports.string().nullable(),
86077
+ linked: external_exports.boolean(),
86078
+ nextVisitAt: external_exports.string().nullable()
86079
+ });
86080
+ var whatsappComputerSchema = whatsappComputerDefinition;
86081
+ var whatsappComputerInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20 });
86082
+ var whatsappComputerInputSchema = whatsappComputerInputDefinition;
85780
86083
  var whatsappChangeDefinition = external_exports.object({
85781
86084
  chat: external_exports.string().min(1).max(200),
85782
86085
  chatName: external_exports.string().max(500),
@@ -85804,9 +86107,6 @@ var COMPUTE_WHATSAPP_REST_PATHS = {
85804
86107
  read: "/api/compute/whatsapp/read",
85805
86108
  send: "/api/compute/whatsapp/send",
85806
86109
  sendStatus: "/api/compute/whatsapp/send-status",
85807
- pair: "/api/compute/whatsapp/pair",
85808
- pairing: "/api/compute/whatsapp/pairing",
85809
- cancelPairing: "/api/compute/whatsapp/cancel-pairing",
85810
86110
  unpair: "/api/compute/whatsapp/unpair"
85811
86111
  };
85812
86112
 
@@ -86118,7 +86418,7 @@ var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
86118
86418
  var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, machineId: idSchema23 });
86119
86419
  var ComputeApi = moduleApi()("compute");
86120
86420
  var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
86121
- var computeFleetTrpc = defineTrpcContract("compute").query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
86421
+ var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
86122
86422
  var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
86123
86423
  var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
86124
86424
  var restRenameInputDefinition = external_exports.object({
@@ -86186,6 +86486,7 @@ var machineWatchStateDefinition = external_exports.object({
86186
86486
 
86187
86487
  // ../../modules/compute/contract/src/compute.ui.ts
86188
86488
  var computeUi = uiTokens("compute");
86489
+ var ComputeWhatsappMessagingSlot = computeUi.component("whatsapp-messaging");
86189
86490
  var ComputeBrowserTabSlot = computeUi.component("browser-tab");
86190
86491
  var ComputeOpenBrowserSlot = computeUi.component("open-browser");
86191
86492
  var ComputeBrowserLinkOfferSlot = computeUi.component("browser-link-offer");
@@ -86277,9 +86578,9 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
86277
86578
  });
86278
86579
 
86279
86580
  // src/services/computer-copy-commands.service.ts
86280
- import { mkdtemp as mkdtemp2, open as open4, rm as rm11, stat as stat9 } from "node:fs/promises";
86581
+ import { mkdtemp as mkdtemp2, open as open4, rm as rm12, stat as stat10 } from "node:fs/promises";
86281
86582
  import { tmpdir as tmpdir4 } from "node:os";
86282
- import { basename as basename7, dirname as dirname20, resolve as resolve10 } from "node:path";
86583
+ import { basename as basename8, dirname as dirname22, resolve as resolve11 } from "node:path";
86283
86584
  var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
86284
86585
  copy a local file or folder into your hosted agent's work folder
86285
86586
  (its owner only, up to 2 GiB packed); <folder> is relative to the
@@ -86293,9 +86594,9 @@ function stringFlag(args, name3) {
86293
86594
  }
86294
86595
  function packingOf({ path, isDirectory }) {
86295
86596
  const contents = isDirectory && path.endsWith("/");
86296
- const absolute = resolve10(path);
86297
- const name3 = basename7(absolute);
86298
- return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname20(absolute), entry: name3 };
86597
+ const absolute = resolve11(path);
86598
+ const name3 = basename8(absolute);
86599
+ return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname22(absolute), entry: name3 };
86299
86600
  }
86300
86601
  async function sendParts2({
86301
86602
  context,
@@ -86339,22 +86640,22 @@ async function copy({ context, args }) {
86339
86640
  if (!path || !agent3) throw new CliUsageError(`Usage:
86340
86641
  ${COMPUTER_COPY_USAGE}`);
86341
86642
  const to = stringFlag(args, "to") ?? ".";
86342
- const full = resolve10(context.cwd, path);
86343
- const found = await stat9(full).catch(() => void 0);
86643
+ const full = resolve11(context.cwd, path);
86644
+ const found = await stat10(full).catch(() => void 0);
86344
86645
  if (!found) throw new CliUsageError(`${path} does not exist`);
86345
86646
  const { name: name3, parent, entry } = packingOf({
86346
86647
  path: path.endsWith("/") ? `${full}/` : full,
86347
86648
  isDirectory: found.isDirectory()
86348
86649
  });
86349
- const dir = await mkdtemp2(resolve10(tmpdir4(), "laze-copy-"));
86350
- const archive2 = resolve10(dir, `${name3}.tar.gz`);
86650
+ const dir = await mkdtemp2(resolve11(tmpdir4(), "laze-copy-"));
86651
+ const archive2 = resolve11(dir, `${name3}.tar.gz`);
86351
86652
  try {
86352
86653
  const code = await context.runCommand({
86353
86654
  command: ["tar", "-czf", archive2, "-C", parent, entry],
86354
86655
  env: { COPYFILE_DISABLE: "1" }
86355
86656
  });
86356
86657
  if (code !== 0) throw new CliUsageError(`tar could not pack ${path} (exit ${code})`);
86357
- const sizeBytes = (await stat9(archive2)).size;
86658
+ const sizeBytes = (await stat10(archive2)).size;
86358
86659
  if (sizeBytes > COMPUTER_COPY_MAX_BYTES)
86359
86660
  throw new CliUsageError(`${path} packs to ${mb(sizeBytes)}; a copy holds at most 2 GiB`);
86360
86661
  const client = await computeClient({ context, args });
@@ -86378,7 +86679,7 @@ It lands before ${done.agentName}'s next turn.
86378
86679
  `
86379
86680
  );
86380
86681
  } finally {
86381
- await rm11(dir, { recursive: true, force: true });
86682
+ await rm12(dir, { recursive: true, force: true });
86382
86683
  }
86383
86684
  }
86384
86685
 
@@ -86669,10 +86970,10 @@ async function computer({ context, args }) {
86669
86970
  }
86670
86971
 
86671
86972
  // src/services/connect-commands.service.ts
86672
- import { readFile as readFile27 } from "node:fs/promises";
86973
+ import { readFile as readFile28 } from "node:fs/promises";
86673
86974
 
86674
86975
  // src/services/mcp-gateway.service.ts
86675
- import { readFile as readFile26 } from "node:fs/promises";
86976
+ import { readFile as readFile27 } from "node:fs/promises";
86676
86977
  import { createInterface as createInterface3 } from "node:readline";
86677
86978
  var TURN_HEADER = "x-laze-turn";
86678
86979
  function serveMcpGateway({
@@ -86715,7 +87016,7 @@ async function relayMcpLines({
86715
87016
  const github3 = env.LAZE_GITHUB_CONNECTION;
86716
87017
  const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
86717
87018
  const turnFile = env.LAZE_TURN_FILE;
86718
- const readTurn = () => readFile26(turnFile, "utf8").then(
87019
+ const readTurn = () => readFile27(turnFile, "utf8").then(
86719
87020
  (text3) => text3.trim(),
86720
87021
  () => ""
86721
87022
  );
@@ -86805,7 +87106,7 @@ async function turnOf({ context }) {
86805
87106
  const pinned = env.LAZE_TURN_TOKEN?.trim();
86806
87107
  if (pinned) return pinned;
86807
87108
  const file3 = env.LAZE_TURN_FILE;
86808
- const turn = file3 ? await readFile27(file3, "utf8").then(
87109
+ const turn = file3 ? await readFile28(file3, "utf8").then(
86809
87110
  (text3) => text3.trim(),
86810
87111
  () => ""
86811
87112
  ) : "";
@@ -86863,11 +87164,11 @@ async function connect({
86863
87164
  }
86864
87165
 
86865
87166
  // src/services/connector-commands.service.ts
86866
- import { readFile as readFile29 } from "node:fs/promises";
86867
- import { resolve as resolve11 } from "node:path";
87167
+ import { readFile as readFile30 } from "node:fs/promises";
87168
+ import { resolve as resolve12 } from "node:path";
86868
87169
 
86869
87170
  // src/services/vault-keychain-commands.service.ts
86870
- import { readFile as readFile28 } from "node:fs/promises";
87171
+ import { readFile as readFile29 } from "node:fs/promises";
86871
87172
 
86872
87173
  // src/rules/vault-input.rules.ts
86873
87174
  function secondsOf(text3) {
@@ -87285,7 +87586,7 @@ async function secretText({ context, args }) {
87285
87586
  );
87286
87587
  }
87287
87588
  const file3 = flagText({ args, name: "from-file" });
87288
- const text3 = file3 ? await readFile28(file3, "utf8") : await context.readStdin();
87589
+ const text3 = file3 ? await readFile29(file3, "utf8") : await context.readStdin();
87289
87590
  const trimmed = text3.replace(/\r?\n$/, "");
87290
87591
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
87291
87592
  return trimmed;
@@ -87518,7 +87819,7 @@ async function keyText({ context, args }) {
87518
87819
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
87519
87820
  }
87520
87821
  const file3 = flagText({ args, name: "from-file" });
87521
- const text3 = file3 ? await readFile29(resolve11(context.cwd, file3), "utf8") : await context.readStdin();
87822
+ const text3 = file3 ? await readFile30(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
87522
87823
  const trimmed = text3.trim();
87523
87824
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
87524
87825
  return trimmed;
@@ -87839,8 +88140,8 @@ async function conversationDelete({ context, args }) {
87839
88140
  }
87840
88141
 
87841
88142
  // src/services/discord-commands.service.ts
87842
- import { readFile as readFile30 } from "node:fs/promises";
87843
- import { resolve as resolve12 } from "node:path";
88143
+ import { readFile as readFile31 } from "node:fs/promises";
88144
+ import { resolve as resolve13 } from "node:path";
87844
88145
 
87845
88146
  // ../../modules/discord/contract/src/discord.ts
87846
88147
  var workspaceIdSchema24 = external_exports.string().min(1).max(64);
@@ -88161,7 +88462,7 @@ async function secretsOf({ context, args }) {
88161
88462
  const fromConnection = flagText({ args, name: "from-vault" });
88162
88463
  if (fromConnection) return { fromConnection };
88163
88464
  const file3 = flagText({ args, name: "from-file" });
88164
- const text3 = file3 ? await readFile30(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
88465
+ const text3 = file3 ? await readFile31(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
88165
88466
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
88166
88467
  if (lines2.length !== 2) {
88167
88468
  throw new CliUsageError(
@@ -88464,8 +88765,8 @@ async function domains({ context, args }) {
88464
88765
  }
88465
88766
 
88466
88767
  // src/services/emoji-commands.service.ts
88467
- import { readFile as readFile31 } from "node:fs/promises";
88468
- import { resolve as resolve13 } from "node:path";
88768
+ import { readFile as readFile32 } from "node:fs/promises";
88769
+ import { resolve as resolve14 } from "node:path";
88469
88770
  var EMOJI_USAGE = `Usage:
88470
88771
  laze emoji list [--json] the workspace's custom emoji, aliases and who added each
88471
88772
  laze emoji add <name> <file> [--alias <a,b>] add a PNG, JPEG or GIF as :name: (made 128px square)
@@ -88505,7 +88806,7 @@ async function addEmoji({ context, args, client }) {
88505
88806
  const file3 = wordAt4(args, 3);
88506
88807
  let bytes;
88507
88808
  try {
88508
- bytes = new Uint8Array(await readFile31(resolve13(context.cwd, file3)));
88809
+ bytes = new Uint8Array(await readFile32(resolve14(context.cwd, file3)));
88509
88810
  } catch {
88510
88811
  throw new CliUsageError(`Cannot read ${file3}.`);
88511
88812
  }
@@ -88821,8 +89122,8 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
88821
89122
  var ExternalSharingHooksToken = externalUi.hooks("sharing");
88822
89123
 
88823
89124
  // src/services/workspace-commands.service.ts
88824
- import { readFile as readFile32 } from "node:fs/promises";
88825
- import { resolve as resolve14 } from "node:path";
89125
+ import { readFile as readFile33 } from "node:fs/promises";
89126
+ import { resolve as resolve15 } from "node:path";
88826
89127
  var ROLE_NAMES2 = {
88827
89128
  OWNER: "Owner",
88828
89129
  ADMIN: "Admin",
@@ -88865,7 +89166,7 @@ async function mine2({ context, args }) {
88865
89166
  `).join("") || "No workspaces.\n"
88866
89167
  });
88867
89168
  }
88868
- async function rename5({ context, args }) {
89169
+ async function rename6({ context, args }) {
88869
89170
  const name3 = args.words.slice(2).join(" ").trim();
88870
89171
  if (!name3) throw new CliUsageError("Usage: laze workspace rename <name>");
88871
89172
  const { client } = await signedIn({ context, args });
@@ -89004,7 +89305,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
89004
89305
  async function readLogo({ context, file: file3 }) {
89005
89306
  let bytes;
89006
89307
  try {
89007
- bytes = new Uint8Array(await readFile32(resolve14(context.cwd, file3)));
89308
+ bytes = new Uint8Array(await readFile33(resolve15(context.cwd, file3)));
89008
89309
  } catch {
89009
89310
  throw new CliUsageError(`No file to read at ${file3}.`);
89010
89311
  }
@@ -89044,7 +89345,7 @@ var WORKSPACE_COMMANDS = {
89044
89345
  switch: switchTo,
89045
89346
  logo,
89046
89347
  mine: mine2,
89047
- rename: rename5,
89348
+ rename: rename6,
89048
89349
  create,
89049
89350
  leave,
89050
89351
  delete: scheduleDeletion,
@@ -89604,8 +89905,8 @@ async function agentFeedAccess({
89604
89905
  }
89605
89906
 
89606
89907
  // src/services/feed-commands.service.ts
89607
- import { readFile as readFile33 } from "node:fs/promises";
89608
- import { resolve as resolve15 } from "node:path";
89908
+ import { readFile as readFile34 } from "node:fs/promises";
89909
+ import { resolve as resolve16 } from "node:path";
89609
89910
 
89610
89911
  // ../../modules/feed/contract/src/feed.delegate.ts
89611
89912
  var feedDelegateSchemaDefinition = external_exports.object({
@@ -90105,6 +90406,21 @@ var commentFeedItemInputSchemaDefinition = external_exports.object({
90105
90406
  after: feedCommentAfterSchemaDefinition.nullable().default(null)
90106
90407
  });
90107
90408
  var commentFeedItemInputSchema = commentFeedItemInputSchemaDefinition;
90409
+ var saveCommentDraftInputSchemaDefinition = external_exports.object({
90410
+ ...itemRef.shape,
90411
+ text: external_exports.string().max(MESSAGE_BODY_MAX),
90412
+ /** The writer's clock when they typed it; the newest save wins. */
90413
+ savedAt: external_exports.iso.datetime()
90414
+ });
90415
+ var saveCommentDraftInputSchema = saveCommentDraftInputSchemaDefinition;
90416
+ var commentDraftSavedSchemaDefinition = external_exports.object({ saved: external_exports.boolean() });
90417
+ var commentDraftSavedSchema = commentDraftSavedSchemaDefinition;
90418
+ var commentDraftListSchemaDefinition = external_exports.object({
90419
+ drafts: external_exports.array(external_exports.object({ itemId: external_exports.string(), text: external_exports.string(), savedAt: external_exports.iso.datetime() })),
90420
+ /** Comments sent or deleted, and when, so a copy saved before that is dropped. */
90421
+ cleared: external_exports.array(external_exports.object({ itemId: external_exports.string(), savedAt: external_exports.iso.datetime() }))
90422
+ });
90423
+ var commentDraftListSchema = commentDraftListSchemaDefinition;
90108
90424
  var snoozeFeedItemInputSchemaDefinition = external_exports.object({
90109
90425
  ...itemRef.shape,
90110
90426
  until: external_exports.iso.datetime({ offset: true })
@@ -90316,7 +90632,7 @@ var feedPageMirror = {
90316
90632
  },
90317
90633
  storable: feedPageForDisk
90318
90634
  };
90319
- var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("page", { mirrored: feedPageMirror }).withInput(pageFeedInputSchema).withOutput(feedPageSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).query("decisions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(feedDecisionsSchema).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("share").withInput(shareFeedItemInputSchema).withOutput(feedShareAnswerSchema).mutation("unshare").withInput(unshareFeedItemInputSchema).withOutput(feedShareAnswerSchema).query("shareCandidates").withInput(itemRef).withOutput(external_exports.array(feedSharePersonSchema)).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentTransfer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("pin").withInput(pinFeedItemInputSchema).withOutput(feedItemSchema).mutation("markRead").withInput(itemRef).withOutput(feedItemSchema).mutation("markUnread").withInput(itemRef).withOutput(feedItemSchema).mutation("markAllRead").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ workspaceId: external_exports.string() })).query("delegates").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(feedDelegateSchema)).mutation("setDelegate").withInput(setFeedDelegateInputSchema).withOutput(external_exports.array(feedDelegateSchema)).build();
90635
+ var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("page", { mirrored: feedPageMirror }).withInput(pageFeedInputSchema).withOutput(feedPageSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).query("decisions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(feedDecisionsSchema).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).query("commentDrafts").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(commentDraftListSchema).mutation("saveCommentDraft").withInput(saveCommentDraftInputSchema).withOutput(commentDraftSavedSchema).mutation("deleteCommentDraft").withInput(itemRef).withOutput(commentDraftSavedSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("share").withInput(shareFeedItemInputSchema).withOutput(feedShareAnswerSchema).mutation("unshare").withInput(unshareFeedItemInputSchema).withOutput(feedShareAnswerSchema).query("shareCandidates").withInput(itemRef).withOutput(external_exports.array(feedSharePersonSchema)).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentTransfer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("pin").withInput(pinFeedItemInputSchema).withOutput(feedItemSchema).mutation("markRead").withInput(itemRef).withOutput(feedItemSchema).mutation("markUnread").withInput(itemRef).withOutput(feedItemSchema).mutation("markAllRead").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ workspaceId: external_exports.string() })).query("delegates").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(feedDelegateSchema)).mutation("setDelegate").withInput(setFeedDelegateInputSchema).withOutput(external_exports.array(feedDelegateSchema)).build();
90320
90636
  var feedUi = uiTokens("feed");
90321
90637
  var FeedNavSlot = feedUi.component("nav");
90322
90638
  var FeedDecisionsSlot = feedUi.component("decisions");
@@ -90649,7 +90965,7 @@ async function feedTurnOf({
90649
90965
  const read4 = async () => {
90650
90966
  const pinned = env.LAZE_TURN_TOKEN?.trim();
90651
90967
  if (pinned) return pinned;
90652
- if (env.LAZE_TURN_FILE) return (await readFile33(env.LAZE_TURN_FILE, "utf8")).trim();
90968
+ if (env.LAZE_TURN_FILE) return (await readFile34(env.LAZE_TURN_FILE, "utf8")).trim();
90653
90969
  return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
90654
90970
  };
90655
90971
  const turn = await read4().catch(() => "");
@@ -90723,7 +91039,7 @@ async function bodyOf2({
90723
91039
  flags: flags2
90724
91040
  }) {
90725
91041
  const body = { ...flags2.fields };
90726
- const read4 = (source) => "file" in source ? readFile33(resolve15(context.cwd, source.file), "utf8") : source.text;
91042
+ const read4 = (source) => "file" in source ? readFile34(resolve16(context.cwd, source.file), "utf8") : source.text;
90727
91043
  for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
90728
91044
  if (flags2.rich) {
90729
91045
  const text3 = await read4(flags2.rich.source);
@@ -90986,7 +91302,7 @@ async function textFlag({
90986
91302
  }) {
90987
91303
  const value = flagText({ args, name: name3 });
90988
91304
  if (!value.startsWith("@")) return value;
90989
- return readFile33(resolve15(context.cwd, value.slice(1)), "utf8");
91305
+ return readFile34(resolve16(context.cwd, value.slice(1)), "utf8");
90990
91306
  }
90991
91307
  async function feedList({ context, args }) {
90992
91308
  const { client } = await signedIn({ context, args });
@@ -91076,17 +91392,17 @@ async function ranksOf({
91076
91392
  }) {
91077
91393
  const file3 = flagText({ args, name: "file" });
91078
91394
  if (file3) {
91079
- const parsed = JSON.parse(await readFile33(resolve15(context.cwd, file3), "utf8"));
91395
+ const parsed = JSON.parse(await readFile34(resolve16(context.cwd, file3), "utf8"));
91080
91396
  if (Array.isArray(parsed)) return parsed;
91081
91397
  throw new CliUsageError("--file holds a list of {itemId, priority}");
91082
91398
  }
91083
91399
  const [itemId, priority] = args.words.slice(2);
91084
91400
  const named = itemId && priority ? [`${itemId}=${priority}`] : [];
91085
- return [...named, ...args.lists.set ?? []].map((pair2) => {
91086
- const at = pair2.indexOf("=");
91401
+ return [...named, ...args.lists.set ?? []].map((pair) => {
91402
+ const at = pair.indexOf("=");
91087
91403
  if (at < 1) throw new CliUsageError(USAGE10);
91088
91404
  try {
91089
- return { itemId: pair2.slice(0, at), priority: rankOf(pair2.slice(at + 1)) };
91405
+ return { itemId: pair.slice(0, at), priority: rankOf(pair.slice(at + 1)) };
91090
91406
  } catch (error63) {
91091
91407
  throw new CliUsageError(error63 instanceof Error ? error63.message : String(error63));
91092
91408
  }
@@ -91189,7 +91505,7 @@ async function feed({ context, args }) {
91189
91505
  }
91190
91506
 
91191
91507
  // src/services/github-commands.service.ts
91192
- import { readFile as readFile34 } from "node:fs/promises";
91508
+ import { readFile as readFile35 } from "node:fs/promises";
91193
91509
 
91194
91510
  // src/rules/github-signature.rules.ts
91195
91511
  var TURN_SEPARATOR = "~";
@@ -91259,7 +91575,7 @@ var REAL_GH = "/usr/bin/gh";
91259
91575
  var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Run `laze github request --repo <owner/name>` to post a card that gets it in one click, or its owner runs `laze agent set-github <agent> <connection>`.";
91260
91576
  async function turnFileToken({ env }) {
91261
91577
  if (!env.LAZE_TURN_FILE) return "";
91262
- return readFile34(env.LAZE_TURN_FILE, "utf8").then(
91578
+ return readFile35(env.LAZE_TURN_FILE, "utf8").then(
91263
91579
  (text3) => text3.trim(),
91264
91580
  () => ""
91265
91581
  );
@@ -91293,7 +91609,7 @@ async function githubGh({
91293
91609
  args: args.rest,
91294
91610
  agentName: profile.name ?? "An agent",
91295
91611
  threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
91296
- readBodyFile: (path) => path === "-" ? context.readStdin() : readFile34(path, "utf8")
91612
+ readBodyFile: (path) => path === "-" ? context.readStdin() : readFile35(path, "utf8")
91297
91613
  });
91298
91614
  return context.runCommand({
91299
91615
  command: [REAL_GH, ...ghArgs],
@@ -91306,7 +91622,7 @@ async function githubCredential({
91306
91622
  }) {
91307
91623
  if (args.words[2] !== "get") return;
91308
91624
  const asked = Object.fromEntries(
91309
- (await context.readStdin()).split("\n").map((line) => line.split(/=(.*)/s, 2)).filter((pair2) => pair2.length === 2)
91625
+ (await context.readStdin()).split("\n").map((line) => line.split(/=(.*)/s, 2)).filter((pair) => pair.length === 2)
91310
91626
  );
91311
91627
  if (asked.host !== "github.com") return;
91312
91628
  const credential = await credentialOf({ env: context.environment.inherited });
@@ -91456,7 +91772,7 @@ async function create2({ context, args }) {
91456
91772
  });
91457
91773
  printGroup({ context, args, group });
91458
91774
  }
91459
- async function rename6({ context, args }) {
91775
+ async function rename7({ context, args }) {
91460
91776
  const group = wordAt6({ args, at: 2 });
91461
91777
  const name3 = wordAt6({ args, at: 3 });
91462
91778
  const { client } = await signedIn({ context, args });
@@ -91495,7 +91811,7 @@ function changing3(key) {
91495
91811
  var COMMANDS = {
91496
91812
  list: list7,
91497
91813
  create: create2,
91498
- rename: rename6,
91814
+ rename: rename7,
91499
91815
  delete: remove5,
91500
91816
  add: changing3("add"),
91501
91817
  remove: changing3("remove")
@@ -91748,11 +92064,12 @@ async function invite3({ context, args }) {
91748
92064
  // src/services/ip-commands.service.ts
91749
92065
  var IP_USAGE = `Usage:
91750
92066
  laze ip [status] [--json] your dedicated IP: on or off, country, address, domains
91751
- laze ip on <country> turn it on in a country (code or name), 3 a month from credits
92067
+ laze ip on <country> turn it on in a country (code or name), 4 a month from credits
91752
92068
  laze ip off turn it off; your agents use the shared address again
91753
92069
  laze ip countries the countries on sale
91754
92070
  laze ip domains the domains it routes
91755
92071
  laze ip domains add|remove <domain>... change them; laze ip domains reset brings the defaults back
92072
+ laze ip scope all|sites all web traffic, or only your domains
91756
92073
  laze ip offer [--site <domain>] the plain offer to pass on when a site blocks the shared address
91757
92074
  laze ip list who has one, its country and price (Owners and Admins)`;
91758
92075
  var printJson7 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
@@ -91781,7 +92098,8 @@ function ipLines(status11) {
91781
92098
  const price = `${status11.monthlyPrice} ${status11.currency.toUpperCase()} a month from the workspace's credits`;
91782
92099
  const country = status11.country?.name ?? "?";
91783
92100
  const lines2 = linesFor({ status: status11, price, country });
91784
- lines2.push(`Domains: ${status11.domains.join(", ")}`, `Settings: ${status11.settingsUrl}`);
92101
+ const carries = status11.scope === "all" ? "all web traffic" : status11.domains.join(", ");
92102
+ lines2.push(`Carries: ${carries}`, `Settings: ${status11.settingsUrl}`);
91785
92103
  return lines2;
91786
92104
  }
91787
92105
  async function status5({ context, args }) {
@@ -91828,6 +92146,15 @@ function domainsEditOf({
91828
92146
  if (action === "remove") return { remove: names };
91829
92147
  return void 0;
91830
92148
  }
92149
+ async function scope2(run4) {
92150
+ const parsed = dedicatedIpScopeSchema.safeParse(run4.args.words[2]);
92151
+ if (!parsed.success) throw new CliUsageError(IP_USAGE);
92152
+ const client = await computeClient(run4);
92153
+ await printAnswer(
92154
+ run4,
92155
+ await client.post(DEDICATED_IP_REST_PATHS.domains, { scope: parsed.data })
92156
+ );
92157
+ }
91831
92158
  async function domains2(run4) {
91832
92159
  const [, , action, ...names] = run4.args.words;
91833
92160
  if (!action) {
@@ -91875,6 +92202,7 @@ var IP_COMMANDS = {
91875
92202
  off: turnOff,
91876
92203
  countries,
91877
92204
  domains: domains2,
92205
+ scope: scope2,
91878
92206
  offer,
91879
92207
  list: list8
91880
92208
  };
@@ -91886,19 +92214,19 @@ async function ip({ context, args }) {
91886
92214
  }
91887
92215
 
91888
92216
  // src/services/join-commands.service.ts
91889
- import { mkdir as mkdir21, readFile as readFile35, rename as rename7, rm as rm12, writeFile as writeFile21 } from "node:fs/promises";
91890
- import { dirname as dirname21, join as join25 } from "node:path";
92217
+ import { mkdir as mkdir23, readFile as readFile36, rename as rename8, rm as rm13, writeFile as writeFile22 } from "node:fs/promises";
92218
+ import { dirname as dirname23, join as join25 } from "node:path";
91891
92219
  var DEFAULT_WAIT_SECONDS2 = 100;
91892
92220
  var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
91893
92221
  function pendingPathOf({ context }) {
91894
- return join25(dirname21(context.environment.configPath), "join", "pending.json");
92222
+ return join25(dirname23(context.environment.configPath), "join", "pending.json");
91895
92223
  }
91896
92224
  async function readPending({
91897
92225
  context,
91898
92226
  url: url2,
91899
92227
  args
91900
92228
  }) {
91901
- const pending2 = await readFile35(pendingPathOf({ context }), "utf8").then(
92229
+ const pending2 = await readFile36(pendingPathOf({ context }), "utf8").then(
91902
92230
  (text3) => JSON.parse(text3),
91903
92231
  () => void 0
91904
92232
  );
@@ -91908,13 +92236,13 @@ async function readPending({
91908
92236
  }
91909
92237
  async function keepPending({ context, pending: pending2 }) {
91910
92238
  const path = pendingPathOf({ context });
91911
- await mkdir21(dirname21(path), { recursive: true, mode: 448 });
92239
+ await mkdir23(dirname23(path), { recursive: true, mode: 448 });
91912
92240
  const temporary = `${path}.${process.pid}.tmp`;
91913
- await writeFile21(temporary, JSON.stringify(pending2), { mode: 384 });
91914
- await rename7(temporary, path);
92241
+ await writeFile22(temporary, JSON.stringify(pending2), { mode: 384 });
92242
+ await rename8(temporary, path);
91915
92243
  }
91916
92244
  async function dropPending({ context }) {
91917
- await rm12(pendingPathOf({ context }), { force: true });
92245
+ await rm13(pendingPathOf({ context }), { force: true });
91918
92246
  }
91919
92247
  function waitSecondsOf3({ args }) {
91920
92248
  const raw = flagText({ args, name: "timeout" });
@@ -92482,7 +92810,7 @@ async function get({ context, args }) {
92482
92810
  machine: await client.post(COMPUTE_REST_PATHS.get, { machine: machine2 })
92483
92811
  });
92484
92812
  }
92485
- async function rename8({ context, args }) {
92813
+ async function rename9({ context, args }) {
92486
92814
  const machine2 = wordAt7({ args, at: 2 });
92487
92815
  const name3 = wordAt7({ args, at: 3 });
92488
92816
  const client = await computeClient({ context, args });
@@ -92528,7 +92856,7 @@ ${MACHINE_ACCESS_USAGE}`);
92528
92856
  });
92529
92857
  printMachine({ context, args, machine: changed });
92530
92858
  }
92531
- var COMMANDS2 = { status: status8, get, rename: rename8, grant: share2, revoke: share2, budget };
92859
+ var COMMANDS2 = { status: status8, get, rename: rename9, grant: share2, revoke: share2, budget };
92532
92860
  function machineAccessCommand(name3) {
92533
92861
  return name3 && Object.hasOwn(COMMANDS2, name3) ? COMMANDS2[name3] : void 0;
92534
92862
  }
@@ -93048,18 +93376,18 @@ async function serveMcp({
93048
93376
  }
93049
93377
 
93050
93378
  // src/services/memory-commands.service.ts
93051
- import { readdir as readdir7, readFile as readFile37 } from "node:fs/promises";
93052
- import { join as join26, resolve as resolve17 } from "node:path";
93379
+ import { readdir as readdir7, readFile as readFile38 } from "node:fs/promises";
93380
+ import { join as join26, resolve as resolve18 } from "node:path";
93053
93381
 
93054
93382
  // src/services/mount-files.service.ts
93055
- import { mkdir as mkdir22, readFile as readFile36, rm as rm13, writeFile as writeFile22 } from "node:fs/promises";
93056
- import { dirname as dirname22, relative as relative5, resolve as resolve16 } from "node:path";
93383
+ import { mkdir as mkdir24, readFile as readFile37, rm as rm14, writeFile as writeFile23 } from "node:fs/promises";
93384
+ import { dirname as dirname24, relative as relative5, resolve as resolve17 } from "node:path";
93057
93385
  async function textArgument({
93058
93386
  context,
93059
93387
  value
93060
93388
  }) {
93061
93389
  if (value === "-") return context.readStdin();
93062
- if (value.startsWith("@")) return readFile36(resolve16(context.cwd, value.slice(1)), "utf8");
93390
+ if (value.startsWith("@")) return readFile37(resolve17(context.cwd, value.slice(1)), "utf8");
93063
93391
  return value;
93064
93392
  }
93065
93393
  function turnChannel({ context, args }) {
@@ -93071,16 +93399,16 @@ async function writeMount({
93071
93399
  folder,
93072
93400
  files: files2
93073
93401
  }) {
93074
- const root = resolve16(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
93075
- await rm13(root, { recursive: true, force: true });
93076
- await mkdir22(root, { recursive: true });
93402
+ const root = resolve17(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
93403
+ await rm14(root, { recursive: true, force: true });
93404
+ await mkdir24(root, { recursive: true });
93077
93405
  for (const file3 of files2) {
93078
- const target = resolve16(root, file3.path);
93406
+ const target = resolve17(root, file3.path);
93079
93407
  const inside = relative5(root, target);
93080
93408
  if (!inside || inside.startsWith(".."))
93081
93409
  throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
93082
- await mkdir22(dirname22(target), { recursive: true });
93083
- await writeFile22(target, file3.content);
93410
+ await mkdir24(dirname24(target), { recursive: true });
93411
+ await writeFile23(target, file3.content);
93084
93412
  }
93085
93413
  return root;
93086
93414
  }
@@ -93206,7 +93534,7 @@ async function turnTokenOf5({ context }) {
93206
93534
  const pinned = env.LAZE_TURN_TOKEN?.trim();
93207
93535
  if (pinned) return pinned;
93208
93536
  if (!env.LAZE_TURN_FILE) return "";
93209
- return readFile37(env.LAZE_TURN_FILE, "utf8").then(
93537
+ return readFile38(env.LAZE_TURN_FILE, "utf8").then(
93210
93538
  (text3) => text3.trim(),
93211
93539
  () => ""
93212
93540
  );
@@ -93335,8 +93663,8 @@ async function siestaImport({
93335
93663
  args,
93336
93664
  dir
93337
93665
  }) {
93338
- const root = resolve17(context.cwd, dir);
93339
- const log = await readFile37(join26(root, "LOG.md"));
93666
+ const root = resolve18(context.cwd, dir);
93667
+ const log = await readFile38(join26(root, "LOG.md"));
93340
93668
  const names = (await readdir7(join26(root, "tree")).catch(() => [])).filter(
93341
93669
  (name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
93342
93670
  );
@@ -93344,7 +93672,7 @@ async function siestaImport({
93344
93672
  await Promise.all(
93345
93673
  names.map(async (name3) => [
93346
93674
  name3.slice(0, -3),
93347
- (await readFile37(join26(root, "tree", name3))).toString("base64")
93675
+ (await readFile38(join26(root, "tree", name3))).toString("base64")
93348
93676
  ])
93349
93677
  )
93350
93678
  );
@@ -93363,8 +93691,8 @@ async function memoryImport({ context, args }) {
93363
93691
  if (siesta) return siestaImport({ context, args, dir: siesta });
93364
93692
  const dir = flagText({ args, name: "optmem" });
93365
93693
  if (!dir) throw new CliUsageError(USAGE13);
93366
- const root = resolve17(context.cwd, dir);
93367
- const log = await readFile37(join26(root, "LOG.txt"));
93694
+ const root = resolve18(context.cwd, dir);
93695
+ const log = await readFile38(join26(root, "LOG.txt"));
93368
93696
  const sizes2 = (await readdir7(join26(root, "TREE")).catch(() => [])).filter(
93369
93697
  (name3) => /^\d{1,4}$/.test(name3)
93370
93698
  );
@@ -93372,7 +93700,7 @@ async function memoryImport({ context, args }) {
93372
93700
  await Promise.all(
93373
93701
  sizes2.map(async (size) => [
93374
93702
  size,
93375
- (await readFile37(join26(root, "TREE", size))).toString("base64")
93703
+ (await readFile38(join26(root, "TREE", size))).toString("base64")
93376
93704
  ])
93377
93705
  )
93378
93706
  );
@@ -93733,7 +94061,7 @@ async function notifications({ context, args }) {
93733
94061
  }
93734
94062
 
93735
94063
  // src/services/openclaw-commands.service.ts
93736
- import { resolve as resolve18 } from "node:path";
94064
+ import { resolve as resolve19 } from "node:path";
93737
94065
  var OPENCLAW_USAGE = `Usage (a person's key; a gateway belongs to the person who connects it):
93738
94066
  laze openclaw list the gateways connected here and their agents
93739
94067
  laze openclaw connect <wss url> [--label <label>] (< token | --from-file <file> | --from-vault <connection>)
@@ -93884,7 +94212,7 @@ var agentKey = async ({ context, args, client, url: url2 }) => {
93884
94212
  });
93885
94213
  const login2 = flagText({ args, name: "login" });
93886
94214
  if (login2) {
93887
- const folder = resolve18(context.cwd, login2);
94215
+ const folder = resolve19(context.cwd, login2);
93888
94216
  const profile = profileNameOf(key.agentName);
93889
94217
  await signInFolder({ context, url: url2, token: key.token, name: profile, folder });
93890
94218
  context.out(
@@ -93936,9 +94264,9 @@ async function openclaw({
93936
94264
  }
93937
94265
 
93938
94266
  // src/services/operator-key-commands.service.ts
93939
- import { createHash as createHash5, randomBytes as randomBytes3 } from "node:crypto";
93940
- import { mkdir as mkdir23, readFile as readFile38, rm as rm14, writeFile as writeFile23 } from "node:fs/promises";
93941
- import { dirname as dirname23, join as join27 } from "node:path";
94267
+ import { createHash as createHash6, randomBytes as randomBytes3 } from "node:crypto";
94268
+ import { mkdir as mkdir25, readFile as readFile39, rm as rm15, writeFile as writeFile24 } from "node:fs/promises";
94269
+ import { dirname as dirname25, join as join27 } from "node:path";
93942
94270
 
93943
94271
  // ../../modules/audit-log/contract/src/audit-log.api.ts
93944
94272
  var auditEntrySchemaDefinition = external_exports.object({
@@ -95107,7 +95435,7 @@ var BREAK_GLASS_COPY = {
95107
95435
 
95108
95436
  // ../../modules/ops/contract/src/operator-key.ts
95109
95437
  var OPERATOR_KEY = {
95110
- lifetimeMinutes: 15,
95438
+ lifetimeMinutes: 60,
95111
95439
  /** A key nobody answered expires this long after it was asked for. */
95112
95440
  pendingMinutes: 60,
95113
95441
  /** Requests one API key may have waiting at once. */
@@ -95172,7 +95500,7 @@ var keyDefinition = external_exports.object({
95172
95500
  /** The passkey that approved; null unless approved. */
95173
95501
  credentialId: external_exports.string().nullable(),
95174
95502
  denyReason: external_exports.string().nullable(),
95175
- /** The 15 minutes end then; null unless approved. */
95503
+ /** The window ends then; null unless approved. */
95176
95504
  endsAt: external_exports.iso.datetime().nullable(),
95177
95505
  /** When a write key was spent; a read key stays null. */
95178
95506
  spentAt: external_exports.iso.datetime().nullable()
@@ -95255,45 +95583,59 @@ var opsTrpc = defineTrpcContract("ops").query("me").withInput(external_exports.o
95255
95583
  // ../../modules/ops/contract/src/ops.config.ts
95256
95584
  var opsConfig = Config.define((c) => ({
95257
95585
  /** The progress board's alerts folder; unset, the parked jobs card is only logged. */
95258
- opsAlertDir: c.env("OPS_ALERT_DIR", external_exports.string().min(1).optional())
95586
+ opsAlertDir: c.env("OPS_ALERT_DIR", external_exports.string().min(1).optional()),
95587
+ /** The workspace whose operators get decision cards, on prod the one vault alerts reach. */
95588
+ operatorWorkspaceId: c.env("OPS_OPERATOR_WORKSPACE_ID", external_exports.string().min(1).optional())
95259
95589
  }));
95260
95590
 
95261
95591
  // src/services/operator-key-commands.service.ts
95262
- var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves with a passkey, 15 minutes):
95592
+ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves with a passkey, ${OPERATOR_KEY.lifetimeMinutes} minutes):
95263
95593
  laze ops request <action> <target> --reason "<why>" [--arg name=value] [--wait]
95264
95594
  actions: ${OPERATOR_KEY_ACTIONS.join(", ")}
95265
95595
  laze ops status <key> waiting, approved or ended
95266
95596
  laze ops use <key> run the approved action and print the answer`;
95267
95597
  var POLL_MS3 = 5e3;
95268
- var keyFile = ({ context, keyId }) => join27(dirname23(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
95598
+ var keyFile = ({ context, keyId }) => join27(dirname25(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
95269
95599
  async function saveSecret({
95270
95600
  context,
95271
95601
  keyId,
95272
95602
  secret
95273
95603
  }) {
95274
95604
  const path = keyFile({ context, keyId });
95275
- await mkdir23(dirname23(path), { recursive: true, mode: 448 });
95276
- await writeFile23(path, secret, { mode: 384 });
95605
+ await mkdir25(dirname25(path), { recursive: true, mode: 448 });
95606
+ await writeFile24(path, secret, { mode: 384 });
95277
95607
  }
95278
95608
  function typedArg(text3) {
95279
95609
  if (["true", "false", "null"].includes(text3)) return JSON.parse(text3);
95280
95610
  return text3 !== "" && Number.isFinite(Number(text3)) ? Number(text3) : text3;
95281
95611
  }
95282
95612
  function argsOf({ args }) {
95283
- const pairs = (args.lists.arg ?? []).map((pair2) => {
95284
- const at = pair2.indexOf("=");
95613
+ const pairs = (args.lists.arg ?? []).map((pair) => {
95614
+ const at = pair.indexOf("=");
95285
95615
  if (at < 1) throw new CliUsageError(`--arg takes name=value.
95286
95616
  ${OPERATOR_KEY_USAGE}`);
95287
- const text3 = pair2.slice(at + 1);
95288
- return [pair2.slice(0, at), typedArg(text3)];
95617
+ const text3 = pair.slice(at + 1);
95618
+ return [pair.slice(0, at), typedArg(text3)];
95289
95619
  });
95290
95620
  return Object.fromEntries(pairs);
95291
95621
  }
95292
- var statusLine2 = (key) => {
95293
- if (key.status === "approved") return `Approved until ${key.endsAt}. Run: laze ops use ${key.id}`;
95294
- if (key.status === "pending") return `Waiting for an operator's passkey at /ops/keys.`;
95295
- return `${key.status[0]?.toUpperCase()}${key.status.slice(1)}.`;
95296
- };
95622
+ var EXPIRED_LINE = `Expired: nobody answered within ${OPERATOR_KEY.pendingMinutes} minutes. Nothing ran. Ask again with laze ops request.`;
95623
+ function statusLine2({ key, nowMs }) {
95624
+ switch (key.status) {
95625
+ case "approved":
95626
+ return `Approved until ${key.endsAt}. Run: laze ops use ${key.id}`;
95627
+ case "pending":
95628
+ return Temporal3.Instant.from(key.pendingUntil).epochMilliseconds <= nowMs ? EXPIRED_LINE : `Waiting for an operator's passkey at /ops/keys. Nothing runs until they approve. It expires at ${key.pendingUntil} if nobody answers.`;
95629
+ case "expired":
95630
+ return EXPIRED_LINE;
95631
+ case "denied":
95632
+ return `Denied: ${key.denyReason ?? "no reason given"}. Nothing ran.`;
95633
+ case "revoked":
95634
+ return "Revoked by an operator. It no longer works.";
95635
+ case "ended":
95636
+ return "Ended: its time is over. Ask again with laze ops request.";
95637
+ }
95638
+ }
95297
95639
  async function waitForAnswer({
95298
95640
  context,
95299
95641
  client,
@@ -95318,13 +95660,13 @@ async function requestKey({ context, args }) {
95318
95660
  target,
95319
95661
  args: argsOf({ args }),
95320
95662
  reason: reason2,
95321
- secretHash: createHash5("sha256").update(secret).digest("hex")
95663
+ secretHash: createHash6("sha256").update(secret).digest("hex")
95322
95664
  });
95323
95665
  await saveSecret({ context, keyId: key.id, secret });
95324
95666
  const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
95325
95667
  if (args.flags.json) return context.out(`${JSON.stringify(answered, null, 2)}
95326
95668
  `);
95327
- context.out(`Operator key ${key.id}: ${statusLine2(answered)}
95669
+ context.out(`Operator key ${key.id}: ${statusLine2({ key: answered, nowMs: context.nowMs() })}
95328
95670
  `);
95329
95671
  }
95330
95672
  async function keyStatus({ context, args }) {
@@ -95334,7 +95676,7 @@ async function keyStatus({ context, args }) {
95334
95676
  const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
95335
95677
  if (args.flags.json) return context.out(`${JSON.stringify(key, null, 2)}
95336
95678
  `);
95337
- context.out(`Operator key ${key.id}: ${statusLine2(key)}
95679
+ context.out(`Operator key ${key.id}: ${statusLine2({ key, nowMs: context.nowMs() })}
95338
95680
  `);
95339
95681
  }
95340
95682
  async function forgetIfOver({
@@ -95345,15 +95687,16 @@ async function forgetIfOver({
95345
95687
  const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
95346
95688
  const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
95347
95689
  if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
95348
- await rm14(keyFile({ context, keyId }), { force: true });
95690
+ await rm15(keyFile({ context, keyId }), { force: true });
95349
95691
  }
95692
+ return key;
95350
95693
  }
95351
95694
  async function useKey({ context, args }) {
95352
95695
  const [, , keyId] = args.words;
95353
95696
  if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
95354
95697
  const { client } = await signedIn({ context, args });
95355
95698
  const path = keyFile({ context, keyId });
95356
- const secret = await readFile38(path, "utf8").catch(() => null);
95699
+ const secret = await readFile39(path, "utf8").catch(() => null);
95357
95700
  if (secret === null) {
95358
95701
  throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
95359
95702
  }
@@ -95367,7 +95710,12 @@ async function useKey({ context, args }) {
95367
95710
  await forgetIfOver({ context, client, keyId });
95368
95711
  } catch (error63) {
95369
95712
  if (error63 instanceof LazeApiError && error63.code === "operator_key_refused") {
95370
- await forgetIfOver({ context, client, keyId });
95713
+ const key = await forgetIfOver({ context, client, keyId });
95714
+ if (key.status !== "approved") {
95715
+ throw new CliUsageError(
95716
+ `Operator key ${keyId}: ${statusLine2({ key, nowMs: context.nowMs() })}`
95717
+ );
95718
+ }
95371
95719
  }
95372
95720
  throw error63;
95373
95721
  }
@@ -95413,8 +95761,8 @@ ${OPS_USAGE}`);
95413
95761
  }
95414
95762
 
95415
95763
  // src/services/release-watch.service.ts
95416
- import { mkdir as mkdir24, readFile as readFile39, realpath, writeFile as writeFile24 } from "node:fs/promises";
95417
- import { dirname as dirname24, join as join28 } from "node:path";
95764
+ import { mkdir as mkdir26, readFile as readFile40, realpath, writeFile as writeFile25 } from "node:fs/promises";
95765
+ import { dirname as dirname26, join as join28 } from "node:path";
95418
95766
 
95419
95767
  // src/rules/cli-update.rules.ts
95420
95768
  var CLI_PACKAGE = "@lazehq/cli";
@@ -95560,13 +95908,13 @@ async function startedUpdate({
95560
95908
  if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
95561
95909
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
95562
95910
  if (plan2.kind !== "install") return null;
95563
- const folder = dirname24(context.environment.configPath);
95911
+ const folder = dirname26(context.environment.configPath);
95564
95912
  const stamp = join28(folder, "auto-update.json");
95565
- const last = await readFile39(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
95913
+ const last = await readFile40(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
95566
95914
  const now = context.nowMs();
95567
95915
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
95568
- await mkdir24(folder, { recursive: true, mode: 448 });
95569
- await writeFile24(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
95916
+ await mkdir26(folder, { recursive: true, mode: 448 });
95917
+ await writeFile25(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
95570
95918
  context.processes.spawnDetached({
95571
95919
  argv: [...context.program, "update"],
95572
95920
  logPath: join28(folder, "auto-update.log")
@@ -95606,7 +95954,7 @@ function watchingRelease({
95606
95954
  }
95607
95955
 
95608
95956
  // src/services/rush-guard.service.ts
95609
- import { readFile as readFile40, rm as rm15 } from "node:fs/promises";
95957
+ import { readFile as readFile41, rm as rm16 } from "node:fs/promises";
95610
95958
  var WATCH_MS3 = 2e3;
95611
95959
  var RETRY_MS2 = 3e4;
95612
95960
  async function guardRound(guard) {
@@ -95649,7 +95997,7 @@ async function rushWakeHook({ context, args }) {
95649
95997
  while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
95650
95998
  const { client, name: name3 } = await signedIn({ context, args });
95651
95999
  const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
95652
- const note = await readFile40(noted, "utf8").then(
96000
+ const note = await readFile41(noted, "utf8").then(
95653
96001
  (text3) => JSON.parse(text3),
95654
96002
  () => void 0
95655
96003
  );
@@ -95678,10 +96026,10 @@ async function rushWakeHook({ context, args }) {
95678
96026
  return 0;
95679
96027
  } finally {
95680
96028
  if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
95681
- await rm15(lock, { force: true });
96029
+ await rm16(lock, { force: true });
95682
96030
  }
95683
96031
  } finally {
95684
- await rm15(path, { force: true });
96032
+ await rm16(path, { force: true });
95685
96033
  }
95686
96034
  }
95687
96035
 
@@ -95693,12 +96041,15 @@ var USAGE16 = `Usage:
95693
96041
  laze schedule update <scheduleId> [--name <name>] [--prompt <text>] [--cron|--rrule|--at <when>]
95694
96042
  [--tz <IANA zone>] [--channel <channelId>|none] [--agent <agentId>] [--check <script>|none]
95695
96043
  laze schedule pause|resume|rm|runs <scheduleId>
95696
- laze schedule run <scheduleId> (one extra run now; the next fire stays)
96044
+ laze schedule run <scheduleId> (one extra run now, its check first; the next fire stays)
95697
96045
  A repeating schedule runs at most every 30 minutes; a cron or RRULE that runs more often is refused.
95698
96046
  --check names an executable script in your work folder. It runs at each firing, without a model:
95699
96047
  if it prints something the agent wakes with that output added to the prompt; if it prints nothing
95700
96048
  nothing happens and nothing is spent; a non-zero exit or 30 s timeout is a failed check, shown
95701
- under Needs attention. Keep what it last saw in your own file. Run now skips the check.`;
96049
+ under Needs attention. Keep what it last saw in your own file. "laze schedule run" runs the check
96050
+ too and prints quiet, fired or skipped, so it tests a script without spending a turn on nothing.`;
96051
+ var CHECK_WAIT_MS = 2e3;
96052
+ var CHECK_WAIT_TRIES = 30;
95702
96053
  function timingOf(args) {
95703
96054
  const cron = flagText({ args, name: "cron" });
95704
96055
  const rrule = flagText({ args, name: "rrule" });
@@ -95813,10 +96164,17 @@ async function scheduleRun({ context, args }) {
95813
96164
  const scheduleId = args.words[2];
95814
96165
  if (!scheduleId) throw new CliUsageError(USAGE16);
95815
96166
  const { client } = await signedIn({ context, args });
95816
- const run4 = await client.post("/api/schedules/run", { scheduleId });
96167
+ let run4 = await client.post("/api/schedules/run", { scheduleId });
96168
+ for (let tries = 0; run4.status === "checking" && tries < CHECK_WAIT_TRIES; tries += 1) {
96169
+ await context.sleep(CHECK_WAIT_MS);
96170
+ const runs = await client.post("/api/schedules/runs", { scheduleId });
96171
+ run4 = runs.find((each) => each.id === run4.id) ?? run4;
96172
+ }
95817
96173
  if (args.flags.json) return context.out(`${JSON.stringify(run4, null, 2)}
95818
96174
  `);
95819
- context.out(`${run4.scheduledFor} ${run4.status}
96175
+ const reason2 = run4.reason ? ` ${run4.reason}` : "";
96176
+ const exit = typeof run4.checkExitCode === "number" ? ` (exit ${run4.checkExitCode})` : "";
96177
+ context.out(`${run4.scheduledFor} ${run4.status}${reason2}${exit}
95820
96178
  `);
95821
96179
  }
95822
96180
  var SCHEDULE_COMMANDS = {
@@ -95837,8 +96195,8 @@ async function schedule({ context, args }) {
95837
96195
  }
95838
96196
 
95839
96197
  // src/services/skill-commands.service.ts
95840
- import { readdir as readdir8, readFile as readFile41 } from "node:fs/promises";
95841
- import { join as join29, relative as relative6, resolve as resolve19 } from "node:path";
96198
+ import { readdir as readdir8, readFile as readFile42 } from "node:fs/promises";
96199
+ import { join as join29, relative as relative6, resolve as resolve20 } from "node:path";
95842
96200
  var USAGE17 = `Usage:
95843
96201
  laze skill list [--agent <agentId>]
95844
96202
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -95860,7 +96218,7 @@ async function folderFiles({ root }) {
95860
96218
  for (const entry of entries) {
95861
96219
  if (!entry.isFile()) continue;
95862
96220
  const full = join29(entry.parentPath, entry.name);
95863
- files2.push({ path: relative6(root, full), content: await readFile41(full, "utf8") });
96221
+ files2.push({ path: relative6(root, full), content: await readFile42(full, "utf8") });
95864
96222
  }
95865
96223
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
95866
96224
  }
@@ -95891,7 +96249,7 @@ async function skillInstall({ context, args }) {
95891
96249
  if (!catalogueId === !from) throw new CliUsageError(USAGE17);
95892
96250
  const name3 = flagText({ args, name: "as" });
95893
96251
  const agent3 = flagText({ args, name: "agent" });
95894
- const files2 = from ? await folderFiles({ root: resolve19(context.cwd, from) }) : void 0;
96252
+ const files2 = from ? await folderFiles({ root: resolve20(context.cwd, from) }) : void 0;
95895
96253
  const { client } = await signedIn({ context, args });
95896
96254
  const installed = await client.post("/api/skills/install", {
95897
96255
  ...catalogueId ? { catalogueId } : {},
@@ -95958,7 +96316,7 @@ async function skillUpdate({ context, args }) {
95958
96316
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
95959
96317
  throw new CliUsageError(USAGE17);
95960
96318
  }
95961
- const skillMd = skillMdFile ? await readFile41(resolve19(context.cwd, skillMdFile), "utf8") : void 0;
96319
+ const skillMd = skillMdFile ? await readFile42(resolve20(context.cwd, skillMdFile), "utf8") : void 0;
95962
96320
  const { client } = await signedIn({ context, args });
95963
96321
  const updated = await client.post("/api/skills/update", {
95964
96322
  name: name3,
@@ -96004,8 +96362,8 @@ async function skill({ context, args }) {
96004
96362
  }
96005
96363
 
96006
96364
  // src/services/slack-commands.service.ts
96007
- import { readFile as readFile42 } from "node:fs/promises";
96008
- import { resolve as resolve20 } from "node:path";
96365
+ import { readFile as readFile43 } from "node:fs/promises";
96366
+ import { resolve as resolve21 } from "node:path";
96009
96367
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
96010
96368
  laze slack overview connected Slack workspaces, mirrors, your link
96011
96369
  laze slack link-prompts Slack workspaces you have not linked yet
@@ -96052,7 +96410,7 @@ async function secretLines({ context, args }) {
96052
96410
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
96053
96411
  }
96054
96412
  const file3 = flagText({ args, name: "from-file" });
96055
- const text3 = file3 ? await readFile42(resolve20(context.cwd, file3), "utf8") : await context.readStdin();
96413
+ const text3 = file3 ? await readFile43(resolve21(context.cwd, file3), "utf8") : await context.readStdin();
96056
96414
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
96057
96415
  }
96058
96416
  async function secretsOf2({
@@ -96356,7 +96714,7 @@ async function slack({
96356
96714
  }
96357
96715
 
96358
96716
  // src/services/sso-commands.service.ts
96359
- import { readFile as readFile43 } from "node:fs/promises";
96717
+ import { readFile as readFile44 } from "node:fs/promises";
96360
96718
  var SSO_USAGE = `Usage:
96361
96719
  laze sso domains claimed domains and how each signs in (admins)
96362
96720
  laze sso claim <domain> the TXT record that proves the domain
@@ -96443,7 +96801,7 @@ function refuseSecretFlags({ args }) {
96443
96801
  }
96444
96802
  async function clientSecretOf({ context, args }) {
96445
96803
  const file3 = flagText({ args, name: "from-file" });
96446
- const text3 = file3 ? await readFile43(file3, "utf8") : await context.readStdin();
96804
+ const text3 = file3 ? await readFile44(file3, "utf8") : await context.readStdin();
96447
96805
  const secret = text3.trim();
96448
96806
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
96449
96807
  return secret;
@@ -96775,8 +97133,8 @@ async function update2({
96775
97133
  }
96776
97134
 
96777
97135
  // src/services/vault-env-commands.service.ts
96778
- import { readFile as readFile44, stat as stat10 } from "node:fs/promises";
96779
- import { dirname as dirname25, join as join30, resolve as resolve21 } from "node:path";
97136
+ import { readFile as readFile45, stat as stat11 } from "node:fs/promises";
97137
+ import { dirname as dirname27, join as join30, resolve as resolve22 } from "node:path";
96780
97138
 
96781
97139
  // src/rules/vault-manifest.rules.ts
96782
97140
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -96864,7 +97222,7 @@ function credentialProcessJson(fields) {
96864
97222
  }
96865
97223
 
96866
97224
  // src/services/vault-batch.service.ts
96867
- import { rm as rm16 } from "node:fs/promises";
97225
+ import { rm as rm17 } from "node:fs/promises";
96868
97226
  async function batchOf({ response }) {
96869
97227
  const text3 = await response.text();
96870
97228
  if (!response.ok) {
@@ -97046,7 +97404,7 @@ async function valuesOf({
97046
97404
  }) {
97047
97405
  const refused = refusalOf({ context, settled: settled2 });
97048
97406
  if (refused !== 0) {
97049
- await rm16(keyPath, { force: true });
97407
+ await rm17(keyPath, { force: true });
97050
97408
  return { exitCode: refused };
97051
97409
  }
97052
97410
  const opened = /* @__PURE__ */ new Map();
@@ -97058,7 +97416,7 @@ async function valuesOf({
97058
97416
  if (release2.message) context.err(`${release2.message}
97059
97417
  `);
97060
97418
  }
97061
- if (!keep2) await rm16(keyPath, { force: true });
97419
+ if (!keep2) await rm17(keyPath, { force: true });
97062
97420
  const released = /* @__PURE__ */ new Map();
97063
97421
  for (const entry of entries) {
97064
97422
  const fields = opened.get(keyOf(entry));
@@ -97111,7 +97469,7 @@ function refusedReason({
97111
97469
  return VAULT_EXIT_BAD_REASON;
97112
97470
  }
97113
97471
  async function isFile(path) {
97114
- return stat10(path).then(
97472
+ return stat11(path).then(
97115
97473
  (found) => found.isFile(),
97116
97474
  () => false
97117
97475
  );
@@ -97121,12 +97479,12 @@ async function manifestPathOf({
97121
97479
  args
97122
97480
  }) {
97123
97481
  const named = args.words[2];
97124
- if (named) return resolve21(context.cwd, named);
97482
+ if (named) return resolve22(context.cwd, named);
97125
97483
  const environment = flagText({ args, name: "env" });
97126
97484
  const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
97127
- for (let dir = resolve21(context.cwd); ; dir = dirname25(dir)) {
97485
+ for (let dir = resolve22(context.cwd); ; dir = dirname27(dir)) {
97128
97486
  if (await isFile(join30(dir, file3))) return join30(dir, file3);
97129
- if (dirname25(dir) === dir) break;
97487
+ if (dirname27(dir) === dir) break;
97130
97488
  }
97131
97489
  throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
97132
97490
  ${ENV_USAGE}`);
@@ -97136,7 +97494,7 @@ async function manifestOf({
97136
97494
  args
97137
97495
  }) {
97138
97496
  const file3 = await manifestPathOf({ context, args });
97139
- const text3 = await readFile44(file3, "utf8").catch(() => {
97497
+ const text3 = await readFile45(file3, "utf8").catch(() => {
97140
97498
  throw new CliUsageError(`laze vault: cannot read ${file3}`);
97141
97499
  });
97142
97500
  return { file: file3, lines: parseManifest({ text: text3, file: file3 }) };
@@ -97437,22 +97795,22 @@ function lineOf5(channel) {
97437
97795
  async function vaultScrub({ context, args }) {
97438
97796
  const { client } = await signedIn({ context, args });
97439
97797
  const dryRun = args.flags["dry-run"] === true;
97440
- const report4 = await client.post("/api/chat/scrub", { dryRun });
97441
- if (args.flags.json) return context.out(`${JSON.stringify(report4, null, 2)}
97798
+ const report3 = await client.post("/api/chat/scrub", { dryRun });
97799
+ if (args.flags.json) return context.out(`${JSON.stringify(report3, null, 2)}
97442
97800
  `);
97443
- const changed = report4.channels.filter((channel) => channel.messages > 0);
97801
+ const changed = report3.channels.filter((channel) => channel.messages > 0);
97444
97802
  for (const channel of changed) context.out(lineOf5(channel));
97445
97803
  const total = changed.reduce((sum, channel) => sum + channel.messages, 0);
97446
97804
  context.out(
97447
- report4.dryRun ? `Dry run: ${total} message(s) would change. Nothing was changed.
97805
+ report3.dryRun ? `Dry run: ${total} message(s) would change. Nothing was changed.
97448
97806
  ` : `${total} message(s) changed. The originals can be restored for 7 days.
97449
97807
  `
97450
97808
  );
97451
97809
  }
97452
97810
 
97453
97811
  // src/services/whatsapp-business-commands.service.ts
97454
- import { readFile as readFile45 } from "node:fs/promises";
97455
- import { resolve as resolve22 } from "node:path";
97812
+ import { readFile as readFile46 } from "node:fs/promises";
97813
+ import { resolve as resolve23 } from "node:path";
97456
97814
 
97457
97815
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
97458
97816
  var whatsappBusinessCategorySchema = external_exports.enum([
@@ -97871,7 +98229,7 @@ async function secretsOf3({ context, args }) {
97871
98229
  const fromConnection = flagText({ args, name: "from-vault" });
97872
98230
  if (fromConnection) return { fromConnection };
97873
98231
  const file3 = flagText({ args, name: "from-file" });
97874
- const text3 = file3 ? await readFile45(resolve22(context.cwd, file3), "utf8") : await context.readStdin();
98232
+ const text3 = file3 ? await readFile46(resolve23(context.cwd, file3), "utf8") : await context.readStdin();
97875
98233
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
97876
98234
  if (lines2.length !== 2) {
97877
98235
  throw new CliUsageError(
@@ -98072,70 +98430,11 @@ async function whatsappBusiness({
98072
98430
  }
98073
98431
 
98074
98432
  // src/services/whatsapp-pairing-commands.service.ts
98075
- import { writeFile as writeFile25 } from "node:fs/promises";
98076
- import { resolve as resolve23 } from "node:path";
98077
- var WHATSAPP_PAIRING_USAGE = [
98078
- " laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
98079
- " laze whatsapp pairing <pairing-id> [--qr <file.svg>] where the linking stands, with a fresh code",
98080
- " laze whatsapp cancel <pairing-id> stop the linking",
98081
- " laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)"
98082
- ].join("\n");
98083
- function wordAt11({ args, at }) {
98084
- const value = args.words[at];
98085
- if (!value) throw new CliUsageError(`Usage:
98086
- ${WHATSAPP_PAIRING_USAGE}`);
98087
- return value;
98088
- }
98089
- function svgOf(dataUrl) {
98090
- const [head = "", body = ""] = dataUrl.split(/,(.*)/s, 2);
98091
- if (head.endsWith(";base64")) return Buffer.from(body, "base64").toString("utf8");
98092
- return decodeURIComponent(body);
98093
- }
98094
- async function report2({ context, args, pairing: pairing2 }) {
98095
- const qrFile = pairing2.qrSvg ? resolve23(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
98096
- if (qrFile && pairing2.qrSvg) await writeFile25(qrFile, svgOf(pairing2.qrSvg), "utf8");
98097
- if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
98098
- `);
98099
- context.out(`${pairing2.pairingId} ${pairing2.state}
98100
- `);
98101
- if (qrFile) {
98102
- context.out(
98103
- `Scan ${qrFile} in WhatsApp under Linked devices. The code changes; run \`laze whatsapp pairing ${pairing2.pairingId}\` for a fresh one.
98104
- `
98105
- );
98106
- }
98107
- if (pairing2.linkedAs) context.out(`Linked as ${pairing2.linkedAs}.
98108
- `);
98109
- if (pairing2.error) context.out(`${pairing2.error}
98110
- `);
98111
- }
98112
- async function pair({ context, args }) {
98113
- const machine2 = wordAt11({ args, at: 2 });
98114
- const client = await computeClient({ context, args });
98115
- const pairing2 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.pair, { machine: machine2 });
98116
- await report2({ context, args, pairing: pairing2 });
98117
- }
98118
- async function pairing({ context, args }) {
98119
- const pairingId = wordAt11({ args, at: 2 });
98120
- const client = await computeClient({ context, args });
98121
- const answer6 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.pairing, {
98122
- pairingId
98123
- });
98124
- await report2({ context, args, pairing: answer6 });
98125
- }
98126
- async function cancel3({ context, args }) {
98127
- const pairingId = wordAt11({ args, at: 2 });
98128
- const client = await computeClient({ context, args });
98129
- const answer6 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.cancelPairing, {
98130
- pairingId
98131
- });
98132
- if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
98133
- `);
98134
- context.out(`Stopped linking ${answer6.pairingId}.
98135
- `);
98136
- }
98433
+ var WHATSAPP_PAIRING_USAGE = " laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)";
98137
98434
  async function unpair({ context, args }) {
98138
- const machine2 = wordAt11({ args, at: 2 });
98435
+ const machine2 = args.words[2];
98436
+ if (!machine2) throw new CliUsageError(`Usage:
98437
+ ${WHATSAPP_PAIRING_USAGE}`);
98139
98438
  const client = await computeClient({ context, args });
98140
98439
  const answer6 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.unpair, { machine: machine2 });
98141
98440
  if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
@@ -98143,7 +98442,7 @@ async function unpair({ context, args }) {
98143
98442
  context.out(`WhatsApp is unlinked from ${answer6.name}.
98144
98443
  `);
98145
98444
  }
98146
- var COMMANDS3 = { pair, pairing, cancel: cancel3, unpair };
98445
+ var COMMANDS3 = { unpair };
98147
98446
  function whatsappPairingCommand(name3) {
98148
98447
  return name3 && Object.hasOwn(COMMANDS3, name3) ? COMMANDS3[name3] : void 0;
98149
98448
  }
@@ -98222,7 +98521,7 @@ async function settle3({ client, send: send5 }) {
98222
98521
  }
98223
98522
  return current3;
98224
98523
  }
98225
- function report3({ context, args, send: send5 }) {
98524
+ function report2({ context, args, send: send5 }) {
98226
98525
  if (args.flags.json) context.out(`${JSON.stringify(send5, null, 2)}
98227
98526
  `);
98228
98527
  else if (SETTLED.has(send5.state)) context.out(`${send5.outcome}
@@ -98246,12 +98545,12 @@ async function send4({ context, args }) {
98246
98545
  });
98247
98546
  if (!SETTLED.has(asked.state) && !args.flags.json) context.err(`${asked.outcome}
98248
98547
  `);
98249
- return report3({ context, args, send: await settle3({ client, send: asked }) });
98548
+ return report2({ context, args, send: await settle3({ client, send: asked }) });
98250
98549
  }
98251
98550
  async function status10({ context, args }) {
98252
98551
  const client = await computeClient({ context, args });
98253
98552
  const answer6 = await client.post(PATHS3.sendStatus, { sendId: word2({ args, at: 2 }) });
98254
- return report3({ context, args, send: answer6 });
98553
+ return report2({ context, args, send: answer6 });
98255
98554
  }
98256
98555
  function oneLine(text3) {
98257
98556
  return text3.replace(/\s+/g, " ").trim();
@@ -98569,7 +98868,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
98569
98868
  laze threads [unread] the threads you follow (people)
98570
98869
  laze message edit|delete|remove|react|pin|restore <id> change a message; laze pins <channel>
98571
98870
  laze channel read|unread <channel> [--seq <n>] move your read marker
98572
- laze files <channel> | file link|rename|upload a conversation's files, and uploading one
98871
+ laze files <channel> | file link|download|rename|upload a conversation's files, and uploading one
98573
98872
  laze saved [marks|done|remind] | laze save <id> your saved messages (people)
98574
98873
  laze star add|remove|list [channel] starred conversations in your sidebar (people)
98575
98874
  laze feed post <title> [--channel <c>] ... put an item in people's feed as your agent
@@ -98684,7 +98983,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
98684
98983
  laze ip offer --site <domain> when a site blocks the shared address: the offer to pass on, price included
98685
98984
  laze ops suspend|release <workspace> --reason "<why>" Laze operators only, with LAZE_OPS_TOKEN
98686
98985
  laze ops request <action> <target> --reason "<why>" [--wait] | status <key> | use <key>
98687
- a 15 minute operator key for one action; an operator approves it with a passkey
98986
+ a 60 minute operator key for one action; an operator approves it with a passkey
98688
98987
  laze machine exec <machine> [--timeout <s>] -- <command> run a command on a person's own machine
98689
98988
  When someone wants work done on their own machine, run it there; if it is offline, say so and go on where you run
98690
98989
  laze machine exec <machine> --vault <connection> --reason "<why>" -- <command> the same, with a vault connection
@@ -98692,7 +98991,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
98692
98991
  laze machine unhost <agent> run the agent on your agent computer again
98693
98992
  laze whatsapp chats|read <machine> [<chat>] [--limit <n>] a person's WhatsApp, through their own machine
98694
98993
  laze whatsapp send <machine> <chat> "<text>" send as its owner; each message waits for their approval
98695
- laze whatsapp pair|unpair <machine>, pairing|cancel <id> link WhatsApp on your own machine (owner)
98994
+ laze whatsapp unpair <machine> unlink WhatsApp; linking is in Settings, Machines
98696
98995
  laze whatsapp-business status|conversations|read|send|send-template|send-status|templates|prices
98697
98996
  the workspace's WhatsApp Business number; admins: connect|check|verify-token|settings|disconnect
98698
98997
  laze github whoami | watch <owner/repo> | unwatch | watches the agent's GitHub identity and watches
@@ -99002,14 +99301,14 @@ function exitCodeOf({ context, error: error63 }) {
99002
99301
  // src/services/machine-key.service.ts
99003
99302
  import { execFile as execFile2 } from "node:child_process";
99004
99303
  import {
99005
- createHash as createHash6,
99304
+ createHash as createHash7,
99006
99305
  createPrivateKey,
99007
99306
  generateKeyPairSync,
99008
99307
  randomBytes as randomBytes4,
99009
99308
  sign
99010
99309
  } from "node:crypto";
99011
- import { chmod as chmod4, link, mkdir as mkdir25, readFile as readFile46, rm as rm17, writeFile as writeFile26 } from "node:fs/promises";
99012
- import { dirname as dirname26, join as join31 } from "node:path";
99310
+ import { chmod as chmod4, link, mkdir as mkdir27, readFile as readFile47, rm as rm18, writeFile as writeFile26 } from "node:fs/promises";
99311
+ import { dirname as dirname28, join as join31 } from "node:path";
99013
99312
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
99014
99313
  var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve24, reject) => {
99015
99314
  const child = execFile2(
@@ -99049,15 +99348,15 @@ var MachineKeyStore = class _MachineKeyStore {
99049
99348
  });
99050
99349
  }
99051
99350
  get metaPath() {
99052
- return join31(dirname26(this.options.configPath), "machine-key.json");
99351
+ return join31(dirname28(this.options.configPath), "machine-key.json");
99053
99352
  }
99054
99353
  /** Named by the key, so two CLIs making a key at once never overwrite each other's. */
99055
99354
  pemPathOf(jwk) {
99056
- return join31(dirname26(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99355
+ return join31(dirname28(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99057
99356
  }
99058
99357
  /** The Keychain item's account: one per config file and key. */
99059
99358
  accountOf(jwk) {
99060
- const config2 = createHash6("sha256").update(this.options.configPath).digest("hex");
99359
+ const config2 = createHash7("sha256").update(this.options.configPath).digest("hex");
99061
99360
  return `${config2.slice(0, 32)}-${shortOf(jwk)}`;
99062
99361
  }
99063
99362
  /** The key if this machine made one; null otherwise. Read once per process. */
@@ -99081,7 +99380,7 @@ var MachineKeyStore = class _MachineKeyStore {
99081
99380
  async read() {
99082
99381
  let meta3;
99083
99382
  try {
99084
- meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile46(this.metaPath, "utf8")));
99383
+ meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile47(this.metaPath, "utf8")));
99085
99384
  } catch {
99086
99385
  return null;
99087
99386
  }
@@ -99096,7 +99395,7 @@ var MachineKeyStore = class _MachineKeyStore {
99096
99395
  "-w"
99097
99396
  ],
99098
99397
  timeoutMs: 1e4
99099
- }) : await readFile46(this.pemPathOf(meta3.jwk), "utf8");
99398
+ }) : await readFile47(this.pemPathOf(meta3.jwk), "utf8");
99100
99399
  return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
99101
99400
  }
99102
99401
  async make() {
@@ -99120,7 +99419,7 @@ var MachineKeyStore = class _MachineKeyStore {
99120
99419
  return kept;
99121
99420
  }
99122
99421
  async drop({ tier, jwk }) {
99123
- if (tier === "file") return rm17(this.pemPathOf(jwk), { force: true });
99422
+ if (tier === "file") return rm18(this.pemPathOf(jwk), { force: true });
99124
99423
  await this.options.run({
99125
99424
  program: "security",
99126
99425
  args: ["delete-generic-password", "-s", KEYCHAIN_SERVICE, "-a", this.accountOf(jwk)],
@@ -99176,11 +99475,11 @@ async function writeOnce({ path, text: text3 }) {
99176
99475
  if (error63.code === "EEXIST") return false;
99177
99476
  throw error63;
99178
99477
  } finally {
99179
- await rm17(temporary, { force: true });
99478
+ await rm18(temporary, { force: true });
99180
99479
  }
99181
99480
  }
99182
99481
  async function writePrivate({ path, text: text3 }) {
99183
- await mkdir25(dirname26(path), { recursive: true, mode: 448 });
99482
+ await mkdir27(dirname28(path), { recursive: true, mode: 448 });
99184
99483
  await writeFile26(path, text3, { mode: 384 });
99185
99484
  await chmod4(path, 384);
99186
99485
  }
@@ -99238,8 +99537,8 @@ function machineProofFetch({
99238
99537
  // src/services/processes.service.ts
99239
99538
  import { execFile as execFile3, spawn as spawn4 } from "node:child_process";
99240
99539
  import { mkdirSync, openSync } from "node:fs";
99241
- import { readFile as readFile47, readlink } from "node:fs/promises";
99242
- import { dirname as dirname27 } from "node:path";
99540
+ import { readFile as readFile48, readlink } from "node:fs/promises";
99541
+ import { dirname as dirname29 } from "node:path";
99243
99542
  import { promisify as promisify2 } from "node:util";
99244
99543
  var run3 = promisify2(execFile3);
99245
99544
  function alive(pid) {
@@ -99252,15 +99551,15 @@ function alive(pid) {
99252
99551
  }
99253
99552
  }
99254
99553
  async function argsOf2(pid) {
99255
- const raw = await readFile47(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
99554
+ const raw = await readFile48(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
99256
99555
  if (raw) return raw.split("\0").filter(Boolean);
99257
99556
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
99258
99557
  const line = listed?.stdout.trim();
99259
99558
  return line ? line.split(/\s+/) : void 0;
99260
99559
  }
99261
99560
  async function parentOf(pid) {
99262
- const stat11 = await readFile47(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
99263
- const fromStat = stat11 ? Number(stat11.slice(stat11.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
99561
+ const stat12 = await readFile48(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
99562
+ const fromStat = stat12 ? Number(stat12.slice(stat12.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
99264
99563
  if (fromStat > 0) return fromStat;
99265
99564
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
99266
99565
  const parent = Number(listed?.stdout.trim());
@@ -99276,7 +99575,7 @@ async function cwdOf(pid) {
99276
99575
  return line ? line.slice(1) : void 0;
99277
99576
  }
99278
99577
  function spawnDetached({ argv, logPath }) {
99279
- mkdirSync(dirname27(logPath), { recursive: true, mode: 448 });
99578
+ mkdirSync(dirname29(logPath), { recursive: true, mode: 448 });
99280
99579
  const log = openSync(logPath, "a", 384);
99281
99580
  const [program = "", ...rest] = argv;
99282
99581
  const child = spawn4(program, rest, { detached: true, stdio: ["ignore", log, log] });