@lazehq/cli 0.1.80 → 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 +453 -402
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -3224,7 +3224,7 @@ 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");
3227
+ var { randomBytes: randomBytes5, createHash: createHash8 } = __require("crypto");
3228
3228
  var { Duplex, Readable: Readable2 } = __require("stream");
3229
3229
  var { URL: URL3 } = __require("url");
3230
3230
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -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;
@@ -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
  }
@@ -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: writeFile26, readFile: readFile48, mkdir: mkdir27 } = __require("node:fs/promises");
19470
- var { dirname: dirname29, 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,12 +19713,12 @@ var require_snapshot_recorder = __commonJS({
19713
19713
  throw new InvalidArgumentError("Snapshot path is required");
19714
19714
  }
19715
19715
  const resolvedPath = resolve24(path);
19716
- await mkdir27(dirname29(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
19720
19720
  }));
19721
- await writeFile26(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
19721
+ await writeFile27(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
19722
19722
  }
19723
19723
  /**
19724
19724
  * Clears all recorded snapshots
@@ -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() {
@@ -36955,7 +36955,7 @@ function flagText({
36955
36955
  }
36956
36956
 
36957
36957
  // src/rules/cli-version.rules.ts
36958
- var STAMPED = "0.1.80";
36958
+ var STAMPED = "0.1.81";
36959
36959
  function cliVersionOf({ stamped = STAMPED } = {}) {
36960
36960
  return stamped.startsWith("__") ? "dev" : stamped;
36961
36961
  }
@@ -36977,7 +36977,7 @@ var ProfileMigratedError = class extends Error {
36977
36977
  };
36978
36978
 
36979
36979
  // src/services/session.service.ts
36980
- import { readFile as readFile2 } from "node:fs/promises";
36980
+ import { readFile as readFile4 } from "node:fs/promises";
36981
36981
 
36982
36982
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
36983
36983
  var external_exports = {};
@@ -39792,9 +39792,9 @@ var asciiTabOrNewline = /[\t\n\r]/g;
39792
39792
  function stripTabAndNewline(value) {
39793
39793
  return value.replace(asciiTabOrNewline, "");
39794
39794
  }
39795
- function urlHostnameOk(url2, hostname7) {
39796
- hostname7.lastIndex = 0;
39797
- return hostname7.test(url2.hostname);
39795
+ function urlHostnameOk(url2, hostname8) {
39796
+ hostname8.lastIndex = 0;
39797
+ return hostname8.test(url2.hostname);
39798
39798
  }
39799
39799
  function urlProtocolOk(url2, protocol) {
39800
39800
  protocol.lastIndex = 0;
@@ -57736,10 +57736,10 @@ var HandledErrorRuntime = class _HandledErrorRuntime extends Error {
57736
57736
  }
57737
57737
  };
57738
57738
  function handledErrorConstructor() {
57739
- const scope2 = globalThis;
57740
- const existing = scope2[HANDLED_ERROR_RUNTIME];
57739
+ const scope3 = globalThis;
57740
+ const existing = scope3[HANDLED_ERROR_RUNTIME];
57741
57741
  if (existing) return existing;
57742
- Object.defineProperty(scope2, HANDLED_ERROR_RUNTIME, {
57742
+ Object.defineProperty(scope3, HANDLED_ERROR_RUNTIME, {
57743
57743
  configurable: false,
57744
57744
  enumerable: false,
57745
57745
  value: HandledErrorRuntime,
@@ -58902,10 +58902,10 @@ var MIRRORED_KEY_SEGMENT = "mirrored";
58902
58902
  function mirroredQueryKey({
58903
58903
  path,
58904
58904
  workspaceId,
58905
- scope: scope2
58905
+ scope: scope3
58906
58906
  }) {
58907
58907
  const key = [path.split("."), workspaceId, MIRRORED_KEY_SEGMENT];
58908
- return scope2 === void 0 ? key : [...key, scope2];
58908
+ return scope3 === void 0 ? key : [...key, scope3];
58909
58909
  }
58910
58910
  function contractBuilder(namespace, members3) {
58911
58911
  const member = (name3, kind2, read4 = {}) => ({
@@ -65211,7 +65211,9 @@ var setEgressRouteInputDefinition = external_exports.object({
65211
65211
  route: external_exports.object({
65212
65212
  /** The `human_only` connection in the owner's keychain holding host, port and credentials. */
65213
65213
  vaultConnectionId: external_exports.string().min(1),
65214
- 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)
65215
65217
  }).nullable()
65216
65218
  });
65217
65219
  var AgentRuntimeApi = moduleApi()("agent-runtime");
@@ -68763,6 +68765,7 @@ var callerSearchResultSchemaDefinition = external_exports.object({
68763
68765
  channels: external_exports.array(external_exports.object({ id: idSchema17, name: external_exports.string() }))
68764
68766
  })
68765
68767
  });
68768
+ var agentMachineInputSchemaDefinition = external_exports.object({ host: external_exports.string().trim().min(1).max(200) });
68766
68769
  var agentActivityInputSchemaDefinition = external_exports.object({
68767
68770
  /** The session the report is about, so a resent report is recorded once. */
68768
68771
  sessionId: external_exports.string().min(1).max(120),
@@ -69847,6 +69850,116 @@ function errorOf({ status: status11, body }) {
69847
69850
  return error63;
69848
69851
  }
69849
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
+
69850
69963
  // src/services/session.service.ts
69851
69964
  function markMigratedOn({ context, profile }) {
69852
69965
  return async ({ notice, link: link2 }) => context.store.markMigrated({ name: profile, migrated: { at: context.nowMs(), link: link2, notice } });
@@ -69863,7 +69976,7 @@ async function turnTokenOf({ context }) {
69863
69976
  const pinned = env.LAZE_TURN_TOKEN?.trim();
69864
69977
  if (pinned) return pinned;
69865
69978
  if (!env.LAZE_TURN_FILE) return "";
69866
- return readFile2(env.LAZE_TURN_FILE, "utf8").then(
69979
+ return readFile4(env.LAZE_TURN_FILE, "utf8").then(
69867
69980
  (text3) => text3.trim(),
69868
69981
  () => ""
69869
69982
  );
@@ -69896,6 +70009,10 @@ async function signedIn({
69896
70009
  return { name: chosen.name, profile: chosen.profile, client };
69897
70010
  await namingFirst({ client, args });
69898
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
+ }
69899
70016
  return {
69900
70017
  name: chosen.name,
69901
70018
  profile: chosen.profile,
@@ -70130,7 +70247,7 @@ async function copyAgent({
70130
70247
  }
70131
70248
 
70132
70249
  // src/services/agent-commands.service.ts
70133
- 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";
70134
70251
  import { join as join17, resolve as resolve5 } from "node:path";
70135
70252
 
70136
70253
  // src/rules/agent-profile.rules.ts
@@ -71415,13 +71532,13 @@ function formatSearch({
71415
71532
  }
71416
71533
 
71417
71534
  // src/services/claude-turn.service.ts
71418
- import { mkdir as mkdir4, readFile as readFile6, rm, writeFile as writeFile4 } from "node:fs/promises";
71419
- 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";
71420
71537
 
71421
71538
  // src/services/harness-session.service.ts
71422
- import { mkdir as mkdir3, open as open2, readdir, readFile as readFile4, stat, writeFile as writeFile3 } from "node:fs/promises";
71423
- import { homedir as homedir2, hostname as hostname3 } from "node:os";
71424
- 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";
71425
71542
 
71426
71543
  // src/rules/claude-subagent.rules.ts
71427
71544
  function lastCallAtOf({ text: text3, command }) {
@@ -71553,89 +71670,6 @@ async function claudeProjectOf({
71553
71670
  return candidates.find((folder) => holds({ folder, inner: context.cwd })) ?? resolve2(context.cwd);
71554
71671
  }
71555
71672
 
71556
- // src/services/inbox-spool.service.ts
71557
- import { mkdir as mkdir2, readFile as readFile3, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
71558
- import { dirname as dirname2, join as join2 } from "node:path";
71559
- var PUSH_GRACE_MS = 3 * 6e4;
71560
- var IN_FLIGHT_MS = 35e3;
71561
- function fileNameOf({ profile }) {
71562
- return profile.replace(/[^a-zA-Z0-9_-]/g, "_");
71563
- }
71564
- function statePathOf({
71565
- context,
71566
- kind: kind2,
71567
- profile,
71568
- extension: extension2 = "json"
71569
- }) {
71570
- const directory = join2(dirname2(context.environment.configPath), kind2);
71571
- return join2(directory, `${fileNameOf({ profile })}.${extension2}`);
71572
- }
71573
- async function readSpool({ path }) {
71574
- return readFile3(path, "utf8").then(
71575
- (text3) => JSON.parse(text3),
71576
- () => []
71577
- );
71578
- }
71579
- async function writeSpool({ path, entries }) {
71580
- await mkdir2(dirname2(path), { recursive: true, mode: 448 });
71581
- const temporary = `${path}.${process.pid}.tmp`;
71582
- await writeFile2(temporary, JSON.stringify(entries), { mode: 384 });
71583
- await rename2(temporary, path);
71584
- }
71585
- async function keepTaken({
71586
- context,
71587
- profile,
71588
- messages,
71589
- pushed = false
71590
- }) {
71591
- if (messages.length === 0) return;
71592
- const path = statePathOf({ context, kind: "spool", profile });
71593
- const ids = new Set(messages.map((message2) => message2.messageId));
71594
- const kept = (await readSpool({ path })).filter((entry) => !ids.has(entry.message.messageId));
71595
- const now = context.nowMs();
71596
- const taken = messages.map((message2) => ({
71597
- message: message2,
71598
- takenAt: now,
71599
- ...pushed ? { pushedAt: now } : {}
71600
- }));
71601
- await writeSpool({ path, entries: [...kept, ...taken] });
71602
- }
71603
- async function dropFromSpool({
71604
- context,
71605
- profile,
71606
- messageIds
71607
- }) {
71608
- if (messageIds.length === 0) return;
71609
- const path = statePathOf({ context, kind: "spool", profile });
71610
- const entries = await readSpool({ path });
71611
- const ids = new Set(messageIds);
71612
- const kept = entries.filter((entry) => !ids.has(entry.message.messageId));
71613
- if (kept.length !== entries.length) await writeSpool({ path, entries: kept });
71614
- }
71615
- async function dueFromSpool({
71616
- context,
71617
- profile,
71618
- seen,
71619
- pushedToo,
71620
- settledOnly = false
71621
- }) {
71622
- const path = statePathOf({ context, kind: "spool", profile });
71623
- const entries = await readSpool({ path });
71624
- const pushed = entries.some((entry) => entry.pushedAt !== void 0);
71625
- const text3 = pushed ? await seen().catch(() => "") : "";
71626
- const shown2 = entries.filter(
71627
- (entry) => entry.pushedAt !== void 0 && text3.includes(entry.message.messageId)
71628
- );
71629
- await dropFromSpool({
71630
- context,
71631
- profile,
71632
- messageIds: shown2.map((entry) => entry.message.messageId)
71633
- });
71634
- const late = context.nowMs() - PUSH_GRACE_MS;
71635
- const settled2 = context.nowMs() - IN_FLIGHT_MS;
71636
- 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);
71637
- }
71638
-
71639
71673
  // src/services/harness-session.service.ts
71640
71674
  function sessionOf({
71641
71675
  context,
@@ -71649,7 +71683,7 @@ function sessionOf({
71649
71683
  harness,
71650
71684
  sessionId,
71651
71685
  folder: displayFolderOf({ folder, home: inherited.HOME }),
71652
- host: hostname3()
71686
+ host: hostname4()
71653
71687
  };
71654
71688
  }
71655
71689
  function forSession({
@@ -71665,9 +71699,9 @@ async function rememberSession({
71665
71699
  }) {
71666
71700
  if (!session || !claudePid) return;
71667
71701
  const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
71668
- await mkdir3(dirname3(path), { recursive: true, mode: 448 });
71702
+ await mkdir4(dirname4(path), { recursive: true, mode: 448 });
71669
71703
  const launch = launchEnvOf({ inherited: context.environment.inherited });
71670
- await writeFile3(path, JSON.stringify({ ...session, launch }), { mode: 384 });
71704
+ await writeFile4(path, JSON.stringify({ ...session, launch }), { mode: 384 });
71671
71705
  }
71672
71706
  async function currentSessionOf({
71673
71707
  context,
@@ -71686,7 +71720,7 @@ async function currentSessionOf({
71686
71720
  const nearest = await nearestHarnessOf({ context });
71687
71721
  if (!nearest) return void 0;
71688
71722
  const path = statePathOf({ context, kind: "sessions", profile: String(nearest.pid) });
71689
- return readFile4(path, "utf8").then(
71723
+ return readFile5(path, "utf8").then(
71690
71724
  (text3) => JSON.parse(text3),
71691
71725
  () => void 0
71692
71726
  );
@@ -71739,11 +71773,11 @@ async function liveElsewhere({
71739
71773
  asleepCounts = true
71740
71774
  }) {
71741
71775
  if (await rushKeeps({ context, key, claudePid, asleepCounts })) return true;
71742
- const folder = dirname3(statePathOf({ context, kind: "sessions", profile: "x" }));
71776
+ const folder = dirname4(statePathOf({ context, kind: "sessions", profile: "x" }));
71743
71777
  for (const file3 of await readdir(folder).catch(() => [])) {
71744
71778
  const pid = Number(file3.replace(/\.json$/, ""));
71745
71779
  if (!pid || pid === claudePid || !context.processes.alive(pid)) continue;
71746
- const noted = await readFile4(join3(folder, file3), "utf8").then(
71780
+ const noted = await readFile5(join3(folder, file3), "utf8").then(
71747
71781
  (text3) => JSON.parse(text3),
71748
71782
  () => void 0
71749
71783
  );
@@ -71791,7 +71825,7 @@ async function runsInSubagent({ context, command }) {
71791
71825
  if (!sessionId) return false;
71792
71826
  const { path } = await claudeTranscriptOf({ context, sessionId });
71793
71827
  if (!path) return false;
71794
- const folder = join3(dirname3(path), sessionId, "subagents");
71828
+ const folder = join3(dirname4(path), sessionId, "subagents");
71795
71829
  const files2 = await readdir(folder).catch(() => []);
71796
71830
  const subagents = await Promise.all(
71797
71831
  files2.filter((file3) => file3.endsWith(".jsonl")).map(
@@ -71855,13 +71889,13 @@ async function notBoundNotice({
71855
71889
  }
71856
71890
  const key = session ? sessionKeyOf({ session }) : "unknown";
71857
71891
  const path = statePathOf({ context, kind: "told", profile: key });
71858
- const told = await readFile4(path, "utf8").then(
71892
+ const told = await readFile5(path, "utf8").then(
71859
71893
  () => true,
71860
71894
  () => false
71861
71895
  );
71862
71896
  if (told) return { notice: void 0 };
71863
- await mkdir3(dirname3(path), { recursive: true, mode: 448 });
71864
- 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 });
71865
71899
  const agent3 = (await context.store.read()).profiles[profile]?.name;
71866
71900
  return {
71867
71901
  notice: notBoundText({ meta: meta3, agent: agent3, configPath: context.environment.configPath })
@@ -71869,7 +71903,7 @@ async function notBoundNotice({
71869
71903
  }
71870
71904
 
71871
71905
  // src/services/plugin-hook.service.ts
71872
- import { readFile as readFile5 } from "node:fs/promises";
71906
+ import { readFile as readFile6 } from "node:fs/promises";
71873
71907
  import { join as join4 } from "node:path";
71874
71908
  async function agentProfileHere({
71875
71909
  context,
@@ -71892,7 +71926,7 @@ async function agentProfileHere({
71892
71926
  async function projectHooksHere({ context }) {
71893
71927
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR || context.cwd;
71894
71928
  const path = join4(directory, ".claude", "settings.local.json");
71895
- return readFile5(path, "utf8").then(
71929
+ return readFile6(path, "utf8").then(
71896
71930
  (text3) => hasLazeHooks({ settings: JSON.parse(text3) }),
71897
71931
  () => false
71898
71932
  );
@@ -71913,10 +71947,10 @@ async function pluginHookArgs({
71913
71947
  var PRE_TOOL_TIMEOUT_MS = 3e3;
71914
71948
  function statePath({ context, agent: agent3 }) {
71915
71949
  const safe = agent3.replace(/[^a-zA-Z0-9_-]/g, "_");
71916
- return join5(dirname4(context.environment.configPath), "turns", `${safe}.json`);
71950
+ return join5(dirname5(context.environment.configPath), "turns", `${safe}.json`);
71917
71951
  }
71918
71952
  async function readState({ context, agent: agent3 }) {
71919
- return readFile6(statePath({ context, agent: agent3 }), "utf8").then(
71953
+ return readFile7(statePath({ context, agent: agent3 }), "utf8").then(
71920
71954
  (text3) => JSON.parse(text3),
71921
71955
  () => void 0
71922
71956
  );
@@ -71952,8 +71986,8 @@ async function turnStarted({
71952
71986
  await beat({ client, state: before, working: false }).catch(() => void 0);
71953
71987
  }
71954
71988
  const path = statePath({ context, agent: agent3 });
71955
- await mkdir4(dirname4(path), { recursive: true, mode: 448 });
71956
- await writeFile4(path, JSON.stringify(state));
71989
+ await mkdir5(dirname5(path), { recursive: true, mode: 448 });
71990
+ await writeFile5(path, JSON.stringify(state));
71957
71991
  await beat({ client, state, working: true }).catch(() => void 0);
71958
71992
  }
71959
71993
  async function turnEnded({
@@ -72011,7 +72045,7 @@ async function preToolHook({ context, args }) {
72011
72045
  }
72012
72046
 
72013
72047
  // src/services/message-files.service.ts
72014
- import { readFile as readFile7, stat as stat2 } from "node:fs/promises";
72048
+ import { readFile as readFile8, stat as stat2 } from "node:fs/promises";
72015
72049
  import { basename as basename3, resolve as resolve3 } from "node:path";
72016
72050
 
72017
72051
  // src/rules/file-types.rules.ts
@@ -72140,7 +72174,7 @@ async function local({ full }) {
72140
72174
  return {
72141
72175
  fileName,
72142
72176
  contentType: contentTypeOf(fileName),
72143
- bytes: new Uint8Array(await readFile7(full))
72177
+ bytes: new Uint8Array(await readFile8(full))
72144
72178
  };
72145
72179
  }
72146
72180
  async function attachmentIdsOf({
@@ -72763,13 +72797,13 @@ function channelLabelIn(channel) {
72763
72797
  }
72764
72798
 
72765
72799
  // src/services/claude-wait.service.ts
72766
- import { readFile as readFile13, rm as rm4, writeFile as writeFile10, mkdir as mkdir11 } from "node:fs/promises";
72767
- 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";
72768
72802
 
72769
72803
  // src/services/connect-service.service.ts
72770
- import { createHash } from "node:crypto";
72771
- import { mkdir as mkdir10, rm as rm3, writeFile as writeFile9 } from "node:fs/promises";
72772
- 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";
72773
72807
 
72774
72808
  // src/rules/connect-service.rules.ts
72775
72809
  function systemdWordOf(word3) {
@@ -72891,9 +72925,9 @@ function rolloutEventOf({
72891
72925
  }
72892
72926
 
72893
72927
  // src/services/connect-delivery.service.ts
72894
- import { mkdir as mkdir9, readFile as readFile12, rename as rename3, rm as rm2, stat as stat4, writeFile as writeFile8 } from "node:fs/promises";
72895
- import { homedir as homedir3, hostname as hostname4 } from "node:os";
72896
- 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";
72897
72931
 
72898
72932
  // src/services/codex-turn-watch.service.ts
72899
72933
  import { open as open3, readdir as readdir2 } from "node:fs/promises";
@@ -72998,8 +73032,8 @@ var CodexTurnWatch = class _CodexTurnWatch {
72998
73032
  };
72999
73033
 
73000
73034
  // src/services/mcp-relay.service.ts
73001
- import { chmod as chmod2, mkdir as mkdir5, readFile as readFile8, writeFile as writeFile5 } from "node:fs/promises";
73002
- 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";
73003
73037
 
73004
73038
  // ../../node_modules/.pnpm/ws@8.21.3_bufferutil@4.1.0/node_modules/ws/wrapper.mjs
73005
73039
  var import_stream = __toESM(require_stream(), 1);
@@ -73335,11 +73369,11 @@ var STOPS = /* @__PURE__ */ new Map([
73335
73369
  [CONNECTOR_RELAY_CLOSE.replaced.code, "another relay for this server took over"]
73336
73370
  ]);
73337
73371
  function mcpRelaysPathOf({ context }) {
73338
- return join7(dirname5(context.environment.configPath), "connect", "mcp-relays.json");
73372
+ return join7(dirname6(context.environment.configPath), "connect", "mcp-relays.json");
73339
73373
  }
73340
73374
  async function readMcpRelays({ context }) {
73341
73375
  try {
73342
- return JSON.parse(await readFile8(mcpRelaysPathOf({ context }), "utf8"));
73376
+ return JSON.parse(await readFile9(mcpRelaysPathOf({ context }), "utf8"));
73343
73377
  } catch {
73344
73378
  return {};
73345
73379
  }
@@ -73349,8 +73383,8 @@ async function saveMcpRelays({
73349
73383
  relays
73350
73384
  }) {
73351
73385
  const path = mcpRelaysPathOf({ context });
73352
- await mkdir5(dirname5(path), { recursive: true, mode: 448 });
73353
- 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)}
73354
73388
  `, { mode: 384 });
73355
73389
  await chmod2(path, 384);
73356
73390
  }
@@ -73502,8 +73536,8 @@ var McpRelayLoops = class _McpRelayLoops {
73502
73536
  };
73503
73537
 
73504
73538
  // src/services/openclaw-relay.service.ts
73505
- import { chmod as chmod3, mkdir as mkdir6, readFile as readFile9, writeFile as writeFile6 } from "node:fs/promises";
73506
- 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";
73507
73541
 
73508
73542
  // ../../modules/openclaw/contract/src/openclaw.ts
73509
73543
  var workspaceIdSchema18 = external_exports.string().min(1);
@@ -73724,11 +73758,11 @@ var STOPS2 = /* @__PURE__ */ new Map([
73724
73758
  [OPENCLAW_RELAY_CLOSE.replaced.code, "another relay for this gateway took over"]
73725
73759
  ]);
73726
73760
  function relaysPathOf({ context }) {
73727
- return join8(dirname6(context.environment.configPath), "connect", "openclaw-relays.json");
73761
+ return join8(dirname7(context.environment.configPath), "connect", "openclaw-relays.json");
73728
73762
  }
73729
73763
  async function readRelays({ context }) {
73730
73764
  try {
73731
- return JSON.parse(await readFile9(relaysPathOf({ context }), "utf8"));
73765
+ return JSON.parse(await readFile10(relaysPathOf({ context }), "utf8"));
73732
73766
  } catch {
73733
73767
  return {};
73734
73768
  }
@@ -73738,8 +73772,8 @@ async function saveRelays({
73738
73772
  relays
73739
73773
  }) {
73740
73774
  const path = relaysPathOf({ context });
73741
- await mkdir6(dirname6(path), { recursive: true, mode: 448 });
73742
- 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)}
73743
73777
  `, { mode: 384 });
73744
73778
  await chmod3(path, 384);
73745
73779
  }
@@ -73924,12 +73958,12 @@ var RelayLoops = class _RelayLoops {
73924
73958
  };
73925
73959
 
73926
73960
  // src/services/rush-listeners.service.ts
73927
- import { readFile as readFile11, readdir as readdir3, stat as stat3 } from "node:fs/promises";
73928
- 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";
73929
73963
 
73930
73964
  // src/services/rush-host.service.ts
73931
- import { mkdir as mkdir7, readFile as readFile10, writeFile as writeFile7 } from "node:fs/promises";
73932
- 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";
73933
73967
  async function rushAboveOf({
73934
73968
  context,
73935
73969
  from = context.processes.pid
@@ -73943,7 +73977,7 @@ async function rushAboveOf({
73943
73977
  return void 0;
73944
73978
  }
73945
73979
  function guardPathOf({ context, claudePid }) {
73946
- return join9(dirname7(context.environment.configPath), "rush-guards", `${claudePid}.json`);
73980
+ return join9(dirname8(context.environment.configPath), "rush-guards", `${claudePid}.json`);
73947
73981
  }
73948
73982
  async function startRushGuard({
73949
73983
  context,
@@ -73956,7 +73990,7 @@ async function startRushGuard({
73956
73990
  if (holder && context.processes.alive(holder.pid)) return;
73957
73991
  const flags2 = ["--profile", profile, "--claude-pid", String(claudePid), "--rush-id", rush.id];
73958
73992
  const argv = [...context.program, "hook", "rush-wake", ...flags2, "--rush-program", rush.program];
73959
- const logPath = join9(dirname7(context.environment.configPath), "rush-guards", "guard.log");
73993
+ const logPath = join9(dirname8(context.environment.configPath), "rush-guards", "guard.log");
73960
73994
  context.processes.spawnDetached({ argv: ["sh", "-c", '"$@" &', "sh", ...argv], logPath });
73961
73995
  }
73962
73996
  async function claimRushGuard({
@@ -73967,12 +74001,12 @@ async function claimRushGuard({
73967
74001
  const holder = await guardHolderOf({ path });
73968
74002
  const self2 = context.processes.pid;
73969
74003
  if (holder && holder.pid !== self2 && context.processes.alive(holder.pid)) return false;
73970
- await mkdir7(dirname7(path), { recursive: true, mode: 448 });
73971
- 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 });
73972
74006
  return true;
73973
74007
  }
73974
74008
  function guardHolderOf({ path }) {
73975
- return readFile10(path, "utf8").then(
74009
+ return readFile11(path, "utf8").then(
73976
74010
  (text3) => JSON.parse(text3),
73977
74011
  () => void 0
73978
74012
  );
@@ -73980,13 +74014,13 @@ function guardHolderOf({ path }) {
73980
74014
 
73981
74015
  // src/services/rush-listeners.service.ts
73982
74016
  async function jsonOf(path) {
73983
- return readFile11(path, "utf8").then(
74017
+ return readFile12(path, "utf8").then(
73984
74018
  (text3) => JSON.parse(text3),
73985
74019
  () => void 0
73986
74020
  );
73987
74021
  }
73988
74022
  async function notesOf({ context }) {
73989
- const folder = dirname8(statePathOf({ context, kind: "sessions", profile: "x" }));
74023
+ const folder = dirname9(statePathOf({ context, kind: "sessions", profile: "x" }));
73990
74024
  const files2 = await readdir3(folder).catch(() => []);
73991
74025
  const notes = await Promise.all(
73992
74026
  files2.map(async (file3) => {
@@ -74072,8 +74106,8 @@ async function rearmRushGuards({ context }) {
74072
74106
  }
74073
74107
 
74074
74108
  // src/services/rush-watchdog.service.ts
74075
- import { appendFile, mkdir as mkdir8 } from "node:fs/promises";
74076
- 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";
74077
74111
  var UNDELIVERED_AFTER_MS = 6e4;
74078
74112
  var CHECK_TIMEOUT_MS = 5e3;
74079
74113
  function clientOf({ context, profile }) {
@@ -74102,12 +74136,12 @@ function boundAwayOf({ waiting, key }) {
74102
74136
  return `${sessionLabelOf(bound)} (${bound.harness}:${bound.sessionId})`;
74103
74137
  }
74104
74138
  async function logDelivery({ context, line }) {
74105
- const folder = join11(dirname9(context.environment.configPath), "connect");
74139
+ const folder = join11(dirname10(context.environment.configPath), "connect");
74106
74140
  const at = Temporal3.Instant.fromEpochMilliseconds(context.nowMs());
74107
74141
  const stamped = `${at.toString({ smallestUnit: "second" })} ${line}
74108
74142
  `;
74109
74143
  context.out(stamped);
74110
- await mkdir8(folder, { recursive: true, mode: 448 });
74144
+ await mkdir9(folder, { recursive: true, mode: 448 });
74111
74145
  await appendFile(join11(folder, "delivery.log"), stamped, { mode: 384 });
74112
74146
  }
74113
74147
  async function claimFor({
@@ -74184,14 +74218,14 @@ async function watchRushDelivery({
74184
74218
 
74185
74219
  // src/services/connect-delivery.service.ts
74186
74220
  function connectFolderOf({ context }) {
74187
- return join12(dirname10(context.environment.configPath), "connect");
74221
+ return join12(dirname11(context.environment.configPath), "connect");
74188
74222
  }
74189
74223
  function runStatePathOf({ context }) {
74190
74224
  return join12(connectFolderOf({ context }), "run.json");
74191
74225
  }
74192
74226
  async function readJson({ path }) {
74193
74227
  try {
74194
- return JSON.parse(await readFile12(path, "utf8"));
74228
+ return JSON.parse(await readFile13(path, "utf8"));
74195
74229
  } catch {
74196
74230
  return void 0;
74197
74231
  }
@@ -74250,7 +74284,7 @@ async function takeRound({
74250
74284
  harness: "codex",
74251
74285
  sessionId: delivery.threadId,
74252
74286
  folder: displayFolderOf({ folder: delivery.cwd, home: homedir3() }),
74253
- host: hostname4()
74287
+ host: hostname5()
74254
74288
  };
74255
74289
  try {
74256
74290
  return await client.withHeaders(sessionHeadersOf({ session })).post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS }, { signal });
@@ -74359,9 +74393,9 @@ async function serveRounds({
74359
74393
  }
74360
74394
  var saves = 0;
74361
74395
  async function save(run4) {
74362
- await mkdir9(dirname10(run4.path), { recursive: true, mode: 448 });
74396
+ await mkdir10(dirname11(run4.path), { recursive: true, mode: 448 });
74363
74397
  const temporary = `${run4.path}.${run4.self}.${saves += 1}.tmp`;
74364
- await writeFile8(temporary, JSON.stringify(run4.state));
74398
+ await writeFile9(temporary, JSON.stringify(run4.state));
74365
74399
  await rename3(temporary, run4.path);
74366
74400
  }
74367
74401
  async function holdsLock(run4) {
@@ -74484,12 +74518,12 @@ function logPathOf({ context }) {
74484
74518
  return join13(connectFolderOf({ context }), "connect.log");
74485
74519
  }
74486
74520
  function homeOf({ context }) {
74487
- return context.environment.inherited.HOME ?? dirname11(dirname11(context.environment.configPath));
74521
+ return context.environment.inherited.HOME ?? dirname12(dirname12(context.environment.configPath));
74488
74522
  }
74489
74523
  function serviceNameOf({ context }) {
74490
74524
  const { configPath } = context.environment;
74491
74525
  if (configPath === join13(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
74492
- 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)}`;
74493
74527
  }
74494
74528
  function serviceEnvOf({ context }) {
74495
74529
  const path = context.environment.inherited.PATH;
@@ -74513,8 +74547,8 @@ async function installSystemd({ context }) {
74513
74547
  const env = context.environment.inherited;
74514
74548
  const base = env.XDG_CONFIG_HOME || join13(homeOf({ context }), ".config");
74515
74549
  const file3 = join13(base, "systemd", "user", `${name3}.service`);
74516
- await mkdir10(dirname11(file3), { recursive: true });
74517
- await writeFile9(
74550
+ await mkdir11(dirname12(file3), { recursive: true });
74551
+ await writeFile10(
74518
74552
  file3,
74519
74553
  systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
74520
74554
  );
@@ -74529,8 +74563,8 @@ async function installLaunchd({ context }) {
74529
74563
  const label3 = `ai.laze.${name3}`;
74530
74564
  const file3 = join13(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
74531
74565
  const log = logPathOf({ context });
74532
- await mkdir10(dirname11(file3), { recursive: true });
74533
- await writeFile9(
74566
+ await mkdir11(dirname12(file3), { recursive: true });
74567
+ await writeFile10(
74534
74568
  file3,
74535
74569
  launchAgentOf({
74536
74570
  label: label3,
@@ -74582,8 +74616,8 @@ async function installConnectService({ context }) {
74582
74616
  const manager = await managerOf({ context });
74583
74617
  const install = { systemd: installSystemd, launchd: installLaunchd, detached: installDetached };
74584
74618
  const installed = await install[manager]({ context });
74585
- await mkdir10(dirname11(path), { recursive: true, mode: 448 });
74586
- await writeFile9(path, JSON.stringify(installed));
74619
+ await mkdir11(dirname12(path), { recursive: true, mode: 448 });
74620
+ await writeFile10(path, JSON.stringify(installed));
74587
74621
  return describeInstalled({ installed });
74588
74622
  }
74589
74623
  async function ensureConnectService({ context }) {
@@ -74733,7 +74767,7 @@ var ROUND_SECONDS2 = 50;
74733
74767
  var WATCH_MS = 2e3;
74734
74768
  var CHANNEL_CHECK_MS = 5e3;
74735
74769
  async function holderOf({ path }) {
74736
- return readFile13(path, "utf8").then(
74770
+ return readFile14(path, "utf8").then(
74737
74771
  (text3) => JSON.parse(text3),
74738
74772
  () => void 0
74739
74773
  );
@@ -74757,8 +74791,8 @@ async function takeLock({
74757
74791
  if (served && context.processes.alive(served) && !mine4) return false;
74758
74792
  context.processes.stop(holder.pid);
74759
74793
  }
74760
- await mkdir11(dirname12(path), { recursive: true, mode: 448 });
74761
- await writeFile10(
74794
+ await mkdir12(dirname13(path), { recursive: true, mode: 448 });
74795
+ await writeFile11(
74762
74796
  path,
74763
74797
  JSON.stringify({
74764
74798
  pid: self2,
@@ -74876,7 +74910,7 @@ async function waitForMessages({ context, args }) {
74876
74910
  if (rush) await healRushDelivery({ context });
74877
74911
  const lock = statePathOf({ context, kind: "waiters", profile: name3 });
74878
74912
  if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
74879
- 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("");
74880
74914
  const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
74881
74915
  try {
74882
74916
  while (context.nowMs() < deadline) {
@@ -74933,8 +74967,8 @@ import { createInterface as createInterface2 } from "node:readline";
74933
74967
 
74934
74968
  // src/services/codex-adopt.service.ts
74935
74969
  import { spawn as spawn2 } from "node:child_process";
74936
- import { mkdir as mkdir12, readdir as readdir4, readFile as readFile14, rm as rm5, stat as stat5, writeFile as writeFile11 } from "node:fs/promises";
74937
- 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";
74938
74972
  import { createInterface } from "node:readline";
74939
74973
 
74940
74974
  // src/rules/codex-requests.rules.ts
@@ -75133,7 +75167,7 @@ async function answer2({
75133
75167
  var MAX_RESTART_WAIT_SECONDS = 60;
75134
75168
  var HEALTHY_RUN_MS = 6e4;
75135
75169
  async function recordOf({ path }) {
75136
- return readFile14(path, "utf8").then(
75170
+ return readFile15(path, "utf8").then(
75137
75171
  (text3) => JSON.parse(text3),
75138
75172
  () => void 0
75139
75173
  );
@@ -75155,8 +75189,8 @@ async function startAdoptInBackground({
75155
75189
  const adopt = ["adopt", "codex", "--profile", profile, ...threadFlag({ thread: thread2 })];
75156
75190
  const argv = [...context.program, ...adopt, "--supervise"];
75157
75191
  const pid = context.processes.spawnDetached({ argv, logPath: log });
75158
- await mkdir12(dirname13(path), { recursive: true, mode: 448 });
75159
- 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() }));
75160
75194
  return [
75161
75195
  `Started \`${laze} adopt codex\` in the background (pid ${pid}). It answers each Laze message`,
75162
75196
  `as a turn in ${thread2 ? `this Codex thread (${thread2})` : "the newest Codex thread"}, and starts again if it stops.`,
@@ -75240,7 +75274,7 @@ async function adoptedThreadOf({
75240
75274
  );
75241
75275
  if (!held) return threadId;
75242
75276
  const path = statePathOf({ context, kind: "adopt", profile, extension: "forks.json" });
75243
- const forks = await readFile14(path, "utf8").then(
75277
+ const forks = await readFile15(path, "utf8").then(
75244
75278
  (text3) => JSON.parse(text3),
75245
75279
  () => ({})
75246
75280
  );
@@ -75255,8 +75289,8 @@ async function adoptedThreadOf({
75255
75289
  }
75256
75290
  const forked = record3((await codex.call("thread/fork", { threadId })).thread).id;
75257
75291
  if (typeof forked !== "string") throw new Error("thread/fork answered no thread id");
75258
- await mkdir12(dirname13(path), { recursive: true, mode: 448 });
75259
- 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 }));
75260
75294
  context.out(
75261
75295
  `Codex holds thread ${threadId} open elsewhere; answering in its new fork ${forked}.
75262
75296
  `
@@ -75403,9 +75437,9 @@ async function linkCodexSession({
75403
75437
  }
75404
75438
 
75405
75439
  // src/services/laze-plugin.service.ts
75406
- 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";
75407
75441
  import { homedir as homedir4 } from "node:os";
75408
- import { dirname as dirname14, join as join16 } from "node:path";
75442
+ import { dirname as dirname15, join as join16 } from "node:path";
75409
75443
 
75410
75444
  // src/rules/laze-plugin.rules.ts
75411
75445
  var LAZE_PLUGIN = "laze";
@@ -75621,11 +75655,11 @@ function lazePluginFiles({
75621
75655
  var REGISTER_LIMIT_MS = 6e4;
75622
75656
  var quote2 = (value) => `'${value.replaceAll("'", "'\\''")}'`;
75623
75657
  function pluginFolderOf({ context }) {
75624
- return join16(dirname14(context.environment.configPath), "plugins");
75658
+ return join16(dirname15(context.environment.configPath), "plugins");
75625
75659
  }
75626
75660
  async function pluginIsCurrent({ context }) {
75627
75661
  const manifest = join16(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
75628
- const written = await readFile15(manifest, "utf8").then(
75662
+ const written = await readFile16(manifest, "utf8").then(
75629
75663
  (text3) => JSON.parse(text3).version,
75630
75664
  () => void 0
75631
75665
  );
@@ -75640,8 +75674,8 @@ async function writeLazePlugin({ context }) {
75640
75674
  });
75641
75675
  for (const [path, text3] of Object.entries(files2)) {
75642
75676
  const target = join16(folder, path);
75643
- await mkdir13(dirname14(target), { recursive: true });
75644
- await writeFile12(target, text3);
75677
+ await mkdir14(dirname15(target), { recursive: true });
75678
+ await writeFile13(target, text3);
75645
75679
  }
75646
75680
  return folder;
75647
75681
  }
@@ -75672,7 +75706,7 @@ async function cachedPluginOf({ context }) {
75672
75706
  const inherited = context.environment.inherited;
75673
75707
  const home = inherited.HOME || homedir4();
75674
75708
  const claude = inherited.CLAUDE_CONFIG_DIR || join16(home, ".claude");
75675
- 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(
75676
75710
  (text3) => JSON.parse(text3),
75677
75711
  () => void 0
75678
75712
  );
@@ -75681,7 +75715,7 @@ async function cachedPluginOf({ context }) {
75681
75715
  async function refreshStaleCache({ context, folder }) {
75682
75716
  const cached2 = await cachedPluginOf({ context });
75683
75717
  if (!cached2) return true;
75684
- const read4 = (path) => readFile15(path, "utf8").catch(() => "");
75718
+ const read4 = (path) => readFile16(path, "utf8").catch(() => "");
75685
75719
  for (const file3 of RUN_FILES) {
75686
75720
  const ours = await read4(join16(folder, LAZE_PLUGIN, file3));
75687
75721
  if (ours === await read4(join16(cached2, file3))) continue;
@@ -75698,7 +75732,7 @@ function registeredMarkOf({ context }) {
75698
75732
  return join16(pluginFolderOf({ context }), "registered");
75699
75733
  }
75700
75734
  async function pluginRegistered({ context }) {
75701
- return readFile15(registeredMarkOf({ context }), "utf8").then(
75735
+ return readFile16(registeredMarkOf({ context }), "utf8").then(
75702
75736
  () => true,
75703
75737
  () => false
75704
75738
  );
@@ -75706,7 +75740,7 @@ async function pluginRegistered({ context }) {
75706
75740
  async function installLazePlugin({ context }) {
75707
75741
  const folder = await writeLazePlugin({ context });
75708
75742
  const registered = await registerWithClaude({ context, folder }) && await refreshStaleCache({ context, folder });
75709
- if (registered) await writeFile12(registeredMarkOf({ context }), cliVersionOf());
75743
+ if (registered) await writeFile13(registeredMarkOf({ context }), cliVersionOf());
75710
75744
  return { folder, registered };
75711
75745
  }
75712
75746
  async function plugin({ context, args }) {
@@ -75730,8 +75764,8 @@ async function plugin({ context, args }) {
75730
75764
  }
75731
75765
 
75732
75766
  // src/services/mcp-channel.service.ts
75733
- import { mkdir as mkdir14, rm as rm7, writeFile as writeFile13 } from "node:fs/promises";
75734
- 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";
75735
75769
  var LAZE_MCP_SERVER = "laze";
75736
75770
  var DEV_CHANNELS_FLAG = "--dangerously-load-development-channels";
75737
75771
  var ROUND_SECONDS3 = 50;
@@ -75821,8 +75855,8 @@ async function pushInbox({
75821
75855
  signal
75822
75856
  }) {
75823
75857
  const marker = statePathOf({ context, kind: "channels", profile });
75824
- await mkdir14(dirname15(marker), { recursive: true, mode: 448 });
75825
- 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 }));
75826
75860
  try {
75827
75861
  while (!signal.aborted) {
75828
75862
  const messages = await client.post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS3 }, { signal }).catch(async (error63) => {
@@ -75856,8 +75890,8 @@ async function pushInbox({
75856
75890
  }
75857
75891
 
75858
75892
  // src/services/plugin-tip.service.ts
75859
- import { mkdir as mkdir15, readFile as readFile16, writeFile as writeFile14 } from "node:fs/promises";
75860
- 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";
75861
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.";
75862
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.";
75863
75897
  function monitorsRunHere({ context }) {
@@ -75891,8 +75925,8 @@ async function markReloadTipTold({
75891
75925
  }) {
75892
75926
  if (!session) return;
75893
75927
  const path = toldPathOf({ context, session });
75894
- await mkdir15(dirname16(path), { recursive: true, mode: 448 });
75895
- 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 });
75896
75930
  }
75897
75931
  async function reloadTipOnce({
75898
75932
  context,
@@ -75900,7 +75934,7 @@ async function reloadTipOnce({
75900
75934
  }) {
75901
75935
  if (!session || !monitorsRunHere({ context })) return void 0;
75902
75936
  if (!await pluginRegistered({ context })) return void 0;
75903
- const told = await readFile16(toldPathOf({ context, session }), "utf8").then(
75937
+ const told = await readFile17(toldPathOf({ context, session }), "utf8").then(
75904
75938
  () => true,
75905
75939
  () => false
75906
75940
  );
@@ -75968,7 +76002,7 @@ async function installHooks({
75968
76002
  }) {
75969
76003
  const folder = join17(directory, ".claude");
75970
76004
  const path = join17(folder, "settings.local.json");
75971
- const current3 = await readFile17(path, "utf8").then(
76005
+ const current3 = await readFile18(path, "utf8").then(
75972
76006
  (text3) => JSON.parse(text3),
75973
76007
  () => ({})
75974
76008
  );
@@ -75979,8 +76013,8 @@ async function installHooks({
75979
76013
  waitCommand: command("wait"),
75980
76014
  preToolCommand: command("pre-tool")
75981
76015
  });
75982
- await mkdir16(folder, { recursive: true });
75983
- await writeFile15(path, `${JSON.stringify(settings3, null, 2)}
76016
+ await mkdir17(folder, { recursive: true });
76017
+ await writeFile16(path, `${JSON.stringify(settings3, null, 2)}
75984
76018
  `);
75985
76019
  return path;
75986
76020
  }
@@ -76207,7 +76241,7 @@ async function reportTranscript({
76207
76241
  input: input2
76208
76242
  }) {
76209
76243
  if (!input2.transcript_path || !input2.session_id) return;
76210
- const lines2 = (await readFile17(input2.transcript_path, "utf8")).split("\n");
76244
+ const lines2 = (await readFile18(input2.transcript_path, "utf8")).split("\n");
76211
76245
  const context = readTranscript({ lines: lines2 });
76212
76246
  await client.post("/api/agents/me/activity", {
76213
76247
  sessionId: input2.session_id,
@@ -76246,7 +76280,7 @@ async function handOver({ context, args }) {
76246
76280
  const kept = await dueFromSpool({
76247
76281
  context,
76248
76282
  profile: agent3,
76249
- seen: () => input2.transcript_path ? readFile17(input2.transcript_path, "utf8") : Promise.resolve(""),
76283
+ seen: () => input2.transcript_path ? readFile18(input2.transcript_path, "utf8") : Promise.resolve(""),
76250
76284
  pushedToo: false,
76251
76285
  settledOnly: true
76252
76286
  });
@@ -76288,7 +76322,7 @@ async function addSessionStartWaiter({ context, args }) {
76288
76322
  const profile = flagText({ args, name: "profile" });
76289
76323
  if (!directory || !profile) return;
76290
76324
  const path = join17(directory, ".claude", "settings.local.json");
76291
- const settings3 = await readFile17(path, "utf8").then(
76325
+ const settings3 = await readFile18(path, "utf8").then(
76292
76326
  (text3) => JSON.parse(text3),
76293
76327
  () => void 0
76294
76328
  );
@@ -76318,7 +76352,7 @@ async function stopHook({ context, args }) {
76318
76352
  }
76319
76353
 
76320
76354
  // src/services/agent-manage-commands.service.ts
76321
- import { readFile as readFile18 } from "node:fs/promises";
76355
+ import { readFile as readFile19 } from "node:fs/promises";
76322
76356
  import { extname, resolve as resolve6 } from "node:path";
76323
76357
 
76324
76358
  // src/rules/login-format.rules.ts
@@ -76456,7 +76490,7 @@ async function avatarOf({
76456
76490
  return emoji4;
76457
76491
  }
76458
76492
  if (!path) return void 0;
76459
- const bytes = await readFile18(resolve6(context.cwd, path)).catch(() => {
76493
+ const bytes = await readFile19(resolve6(context.cwd, path)).catch(() => {
76460
76494
  throw new CliUsageError(`laze: cannot read the avatar file ${path}.`);
76461
76495
  });
76462
76496
  const uploaded = await client.post("/api/agents/avatars", {
@@ -77172,11 +77206,11 @@ async function setAgentRunsOn({
77172
77206
  }
77173
77207
 
77174
77208
  // src/services/agent-migrate-commands.service.ts
77175
- import { readFile as readFile19, stat as stat7 } from "node:fs/promises";
77209
+ import { readFile as readFile20, stat as stat7 } from "node:fs/promises";
77176
77210
  import { basename as basename5, join as join18, resolve as resolve7 } from "node:path";
77177
77211
 
77178
77212
  // src/rules/migration-upload.rules.ts
77179
- import { createHash as createHash2 } from "node:crypto";
77213
+ import { createHash as createHash3 } from "node:crypto";
77180
77214
  function markersIn(text3) {
77181
77215
  return text3.split(REDACTION_MARKER).length - 1;
77182
77216
  }
@@ -77195,7 +77229,7 @@ async function redactTranscript({
77195
77229
  return { text: redacted.text, redactions };
77196
77230
  }
77197
77231
  function sha256Of({ text: text3 }) {
77198
- return createHash2("sha256").update(text3, "utf8").digest("hex");
77232
+ return createHash3("sha256").update(text3, "utf8").digest("hex");
77199
77233
  }
77200
77234
  var bytesOf2 = (text3) => Buffer.byteLength(text3, "utf8");
77201
77235
  function piecesOf({ line, maxBytes }) {
@@ -77462,7 +77496,7 @@ async function uploadTranscript({ context, args, client }) {
77462
77496
  `The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
77463
77497
  );
77464
77498
  }
77465
- const raw = await readFile19(found.path, "utf8");
77499
+ const raw = await readFile20(found.path, "utf8");
77466
77500
  if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
77467
77501
  const redacted = await redactTranscript({ text: raw });
77468
77502
  const { parts, truncated } = transcriptPartsOf({
@@ -77716,8 +77750,8 @@ async function requestAgent({ context, args }) {
77716
77750
  }
77717
77751
 
77718
77752
  // src/services/app-commands.service.ts
77719
- import { mkdir as mkdir17, readdir as readdir6, readFile as readFile21, writeFile as writeFile17 } from "node:fs/promises";
77720
- 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";
77721
77755
 
77722
77756
  // ../../modules/app/contract/src/app.connections.ts
77723
77757
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -80167,7 +80201,7 @@ async function appPinsCommand({
80167
80201
 
80168
80202
  // src/services/app-script-check.service.ts
80169
80203
  import { execFile } from "node:child_process";
80170
- 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";
80171
80205
  import { tmpdir } from "node:os";
80172
80206
  import { join as join19 } from "node:path";
80173
80207
  import { promisify } from "node:util";
@@ -80203,7 +80237,7 @@ async function scriptErrorsOf({
80203
80237
  const errors = await Promise.all(
80204
80238
  scripts.map(async (script, index) => {
80205
80239
  const file3 = join19(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
80206
- await writeFile16(file3, script.code);
80240
+ await writeFile17(file3, script.code);
80207
80241
  try {
80208
80242
  await run2(process.execPath, ["--check", file3]);
80209
80243
  return null;
@@ -80220,7 +80254,7 @@ async function scriptErrorsOf({
80220
80254
  }
80221
80255
 
80222
80256
  // src/services/app-serve.service.ts
80223
- import { readFile as readFile20, stat as stat8 } from "node:fs/promises";
80257
+ import { readFile as readFile21, stat as stat8 } from "node:fs/promises";
80224
80258
  import { createServer } from "node:http";
80225
80259
  import { extname as extname2, join as join20, normalize, sep as sep2 } from "node:path";
80226
80260
  var TYPES2 = {
@@ -80279,7 +80313,7 @@ async function staticFile({
80279
80313
  const info = await stat8(target).catch(() => void 0);
80280
80314
  if (!info?.isFile()) continue;
80281
80315
  const type = TYPES2[extname2(target).toLowerCase()] ?? "application/octet-stream";
80282
- const body = await readFile20(target);
80316
+ const body = await readFile21(target);
80283
80317
  if (extname2(target) === ".html") {
80284
80318
  return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
80285
80319
  }
@@ -80512,7 +80546,7 @@ async function turnTokenOf2({
80512
80546
  const pinned = env.LAZE_TURN_TOKEN?.trim();
80513
80547
  if (pinned) return pinned;
80514
80548
  if (env.LAZE_TURN_FILE) {
80515
- return readFile21(env.LAZE_TURN_FILE, "utf8").then(
80549
+ return readFile22(env.LAZE_TURN_FILE, "utf8").then(
80516
80550
  (text3) => text3.trim(),
80517
80551
  () => ""
80518
80552
  );
@@ -80542,7 +80576,7 @@ function folderOf({ context, word: word3 }) {
80542
80576
  return resolve8(context.cwd, word3 ?? ".");
80543
80577
  }
80544
80578
  async function readManifest(folder) {
80545
- 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);
80546
80580
  if (text3 === void 0) return void 0;
80547
80581
  const parsed = appManifestSchema.safeParse(JSON.parse(text3));
80548
80582
  if (!parsed.success) {
@@ -80577,7 +80611,7 @@ async function jsonFlag({
80577
80611
  }) {
80578
80612
  const raw = flagText({ args, name: name3 });
80579
80613
  if (!raw) return void 0;
80580
- 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;
80581
80615
  try {
80582
80616
  return JSON.parse(text3);
80583
80617
  } catch {
@@ -80626,12 +80660,12 @@ var appCreate = async ({ context, args }) => {
80626
80660
  ...template ? { template } : {}
80627
80661
  });
80628
80662
  const folder = resolve8(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
80629
- await mkdir17(folder, { recursive: true });
80663
+ await mkdir18(folder, { recursive: true });
80630
80664
  const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
80631
80665
  for (const file3 of start2?.files ?? []) {
80632
80666
  const target = join21(folder, ...file3.path.split("/"));
80633
- await mkdir17(dirname17(target), { recursive: true });
80634
- await writeFile17(
80667
+ await mkdir18(dirname18(target), { recursive: true });
80668
+ await writeFile18(
80635
80669
  target,
80636
80670
  file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
80637
80671
  );
@@ -80642,7 +80676,7 @@ var appCreate = async ({ context, args }) => {
80642
80676
  views: [...start2?.template.views ?? []],
80643
80677
  seed: { ...start2?.template.seed }
80644
80678
  };
80645
- 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)}
80646
80680
  `);
80647
80681
  const where = relative3(context.cwd, folder) || ".";
80648
80682
  print5({
@@ -80714,7 +80748,7 @@ var appPush = async ({ context, args }) => {
80714
80748
  paths.map(
80715
80749
  async (path) => buildFileOf({
80716
80750
  path: relative3(folder, path).split(sep3).join("/"),
80717
- bytes: await readFile21(path)
80751
+ bytes: await readFile22(path)
80718
80752
  })
80719
80753
  )
80720
80754
  );
@@ -80784,7 +80818,7 @@ var appWrite = async ({ context, args }) => {
80784
80818
  const path = resolve8(context.cwd, word3);
80785
80819
  const { bytes: _bytes, ...file3 } = buildFileOf({
80786
80820
  path: relative3(folder, path).split(sep3).join("/"),
80787
- bytes: await readFile21(path)
80821
+ bytes: await readFile22(path)
80788
80822
  });
80789
80823
  return file3;
80790
80824
  })
@@ -80912,8 +80946,8 @@ var appPull = async ({ context, args }) => {
80912
80946
  }
80913
80947
  for (const file3 of pulled.files) {
80914
80948
  const target = join21(folder, ...file3.path.split("/"));
80915
- await mkdir17(dirname17(target), { recursive: true });
80916
- await writeFile17(
80949
+ await mkdir18(dirname18(target), { recursive: true });
80950
+ await writeFile18(
80917
80951
  target,
80918
80952
  file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
80919
80953
  );
@@ -80930,7 +80964,7 @@ var appPull = async ({ context, args }) => {
80930
80964
  ])
80931
80965
  )
80932
80966
  };
80933
- 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)}
80934
80968
  `);
80935
80969
  const names = pulled.collections.map((collection) => collection.name);
80936
80970
  const where = relative3(context.cwd, folder) || ".";
@@ -81237,7 +81271,7 @@ var appExport = async ({ context, args }) => {
81237
81271
  const out = flagText({ args, name: "out" });
81238
81272
  if (!out) return context.out(exported.body);
81239
81273
  const target = resolve8(context.cwd, out);
81240
- await writeFile17(target, exported.body);
81274
+ await writeFile18(target, exported.body);
81241
81275
  context.out(`Wrote ${exported.rows} records to ${relative3(context.cwd, target)}
81242
81276
  `);
81243
81277
  };
@@ -81245,7 +81279,7 @@ var appImport = async ({ context, args }) => {
81245
81279
  const words = args.words.slice(2);
81246
81280
  const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
81247
81281
  if (!collection || !file3) throw new CliUsageError(USAGE5);
81248
- const csv = await readFile21(resolve8(context.cwd, file3), "utf8").catch(() => {
81282
+ const csv = await readFile22(resolve8(context.cwd, file3), "utf8").catch(() => {
81249
81283
  throw new CliUsageError(`Cannot read ${file3}`);
81250
81284
  });
81251
81285
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
@@ -81263,7 +81297,7 @@ var appImport = async ({ context, args }) => {
81263
81297
  });
81264
81298
  const refusedOut = flagText({ args, name: "refused" });
81265
81299
  if (refusedOut && result2.refusedCsv) {
81266
- await writeFile17(resolve8(context.cwd, refusedOut), result2.refusedCsv);
81300
+ await writeFile18(resolve8(context.cwd, refusedOut), result2.refusedCsv);
81267
81301
  }
81268
81302
  const fitting = result2.rows - result2.refused.length;
81269
81303
  const skipped = result2.refused.slice(0, 20).map((row) => ` line ${row.line}: ${row.reason}
@@ -81656,14 +81690,14 @@ async function app({ context, args }) {
81656
81690
  }
81657
81691
 
81658
81692
  // src/services/auth-commands.service.ts
81659
- import { hostname as hostname5 } from "node:os";
81693
+ import { hostname as hostname6 } from "node:os";
81660
81694
 
81661
81695
  // src/rules/machine-proof.rules.ts
81662
- import { createHash as createHash3, randomBytes } from "node:crypto";
81696
+ import { createHash as createHash4, randomBytes } from "node:crypto";
81663
81697
  var b64url3 = (bytes) => Buffer.from(bytes).toString("base64url");
81664
81698
  function thumbprintOf({ jwk }) {
81665
81699
  const canonical = JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y });
81666
- return b64url3(createHash3("sha256").update(canonical).digest());
81700
+ return b64url3(createHash4("sha256").update(canonical).digest());
81667
81701
  }
81668
81702
  function lazeTokenOf({ authorization }) {
81669
81703
  const match = /^Bearer (lz_\S+)$/.exec(authorization ?? "");
@@ -81687,7 +81721,7 @@ function machineProofOf({
81687
81721
  htu: url2,
81688
81722
  iat: Math.floor(nowMs / 1e3),
81689
81723
  jti,
81690
- ath: b64url3(createHash3("sha256").update(credential).digest()),
81724
+ ath: b64url3(createHash4("sha256").update(credential).digest()),
81691
81725
  lz_tier: tier,
81692
81726
  ...tailscaleNodeId ? { lz_ts: tailscaleNodeId } : {}
81693
81727
  })
@@ -81760,7 +81794,7 @@ async function deviceToken({
81760
81794
  clientName: flagText({
81761
81795
  args,
81762
81796
  name: "client",
81763
- fallback: `laze CLI on ${hostname5()}`.slice(0, 80)
81797
+ fallback: `laze CLI on ${hostname6()}`.slice(0, 80)
81764
81798
  }),
81765
81799
  ...machineKey ? { machineKey } : {}
81766
81800
  });
@@ -82104,11 +82138,11 @@ async function billing({ context, args }) {
82104
82138
 
82105
82139
  // src/services/browser-commands.service.ts
82106
82140
  import { randomBytes as randomBytes2 } from "node:crypto";
82107
- import { mkdir as mkdir20, readFile as readFile23, writeFile as writeFile20 } from "node:fs/promises";
82108
- 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";
82109
82143
 
82110
82144
  // src/services/browser-tab-commands.service.ts
82111
- import { mkdir as mkdir19, writeFile as writeFile19 } from "node:fs/promises";
82145
+ import { mkdir as mkdir20, writeFile as writeFile20 } from "node:fs/promises";
82112
82146
  import { tmpdir as tmpdir3 } from "node:os";
82113
82147
  import { join as join23 } from "node:path";
82114
82148
 
@@ -82140,10 +82174,10 @@ function loginValuesOf({
82140
82174
  }
82141
82175
 
82142
82176
  // src/services/vault-commands.service.ts
82143
- import { createHash as createHash4 } from "node:crypto";
82144
- import { mkdir as mkdir18, readFile as readFile22, rm as rm9, writeFile as writeFile18 } from "node:fs/promises";
82145
- import { hostname as hostname6, tmpdir as tmpdir2 } from "node:os";
82146
- 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";
82147
82181
 
82148
82182
  // src/rules/vault-session.rules.ts
82149
82183
  function vaultSessionOf({
@@ -82208,7 +82242,7 @@ async function turnTokenOf3({
82208
82242
  if (pinned) return pinned;
82209
82243
  if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
82210
82244
  try {
82211
- return (await readFile22(turnFile, "utf8")).trim();
82245
+ return (await readFile23(turnFile, "utf8")).trim();
82212
82246
  } catch {
82213
82247
  throw new CliUsageError(`${command} works only during an agent's turn`);
82214
82248
  }
@@ -82218,12 +82252,12 @@ function runKeyPathOf({
82218
82252
  connection,
82219
82253
  profile = ""
82220
82254
  }) {
82221
- const name3 = createHash4("sha256").update(connection).digest("hex");
82222
- 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);
82223
82257
  return join22(base, "vault-run-keys", `${name3}.json`);
82224
82258
  }
82225
82259
  async function runKeyAt({ path }) {
82226
- const saved3 = await readFile22(path, "utf8").then(
82260
+ const saved3 = await readFile23(path, "utf8").then(
82227
82261
  (text3) => JSON.parse(text3),
82228
82262
  () => void 0
82229
82263
  );
@@ -82233,8 +82267,8 @@ async function runKeyAt({ path }) {
82233
82267
  }
82234
82268
  const fresh = await generateEcdhKeys();
82235
82269
  const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
82236
- await mkdir18(dirname18(path), { recursive: true, mode: 448 });
82237
- 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 }), {
82238
82272
  mode: 384
82239
82273
  });
82240
82274
  return fresh;
@@ -82427,7 +82461,7 @@ async function vaultSessionFor({
82427
82461
  harnessSession,
82428
82462
  inherited: context.environment.inherited,
82429
82463
  cwd: context.cwd,
82430
- host: hostname6(),
82464
+ host: hostname7(),
82431
82465
  named: flagText({ args, name: "as" }),
82432
82466
  shellPid: await context.processes.parentOf(context.processes.pid),
82433
82467
  terminal: context.stdoutIsTerminal === true
@@ -82750,9 +82784,9 @@ async function savedScreenshot({
82750
82784
  nowMs
82751
82785
  }) {
82752
82786
  const folder = join23(tmpdir3(), "laze-browser");
82753
- await mkdir19(folder, { recursive: true, mode: 448 });
82787
+ await mkdir20(folder, { recursive: true, mode: 448 });
82754
82788
  const path = join23(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
82755
- await writeFile19(path, Buffer.from(data, "base64"), { mode: 384 });
82789
+ await writeFile20(path, Buffer.from(data, "base64"), { mode: 384 });
82756
82790
  return path;
82757
82791
  }
82758
82792
  async function shareTab({ args, client, channel, print: print9 }) {
@@ -83228,7 +83262,7 @@ async function turnTokenOf4({
83228
83262
  const pinned = env.LAZE_TURN_TOKEN?.trim();
83229
83263
  if (pinned) return pinned;
83230
83264
  if (env.LAZE_TURN_FILE) {
83231
- return readFile23(env.LAZE_TURN_FILE, "utf8").then(
83265
+ return readFile24(env.LAZE_TURN_FILE, "utf8").then(
83232
83266
  (text3) => text3.trim(),
83233
83267
  () => ""
83234
83268
  );
@@ -83318,7 +83352,7 @@ async function answering({
83318
83352
  }
83319
83353
  function bridgeStatePath({ context, machine: machine2 }) {
83320
83354
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
83321
- return join24(dirname19(context.environment.configPath), "bridges", `${safe}.json`);
83355
+ return join24(dirname20(context.environment.configPath), "bridges", `${safe}.json`);
83322
83356
  }
83323
83357
  async function bridgePort({
83324
83358
  context,
@@ -83326,7 +83360,7 @@ async function bridgePort({
83326
83360
  access
83327
83361
  }) {
83328
83362
  const path = bridgeStatePath({ context, machine: machine2 });
83329
- const live = await readFile23(path, "utf8").then(
83363
+ const live = await readFile24(path, "utf8").then(
83330
83364
  (text3) => JSON.parse(text3),
83331
83365
  () => void 0
83332
83366
  );
@@ -83339,8 +83373,8 @@ async function bridgePort({
83339
83373
  key,
83340
83374
  ...target
83341
83375
  });
83342
- await mkdir20(dirname19(path), { recursive: true, mode: 448 });
83343
- 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 });
83344
83378
  return port;
83345
83379
  }
83346
83380
  async function bridge({ context }) {
@@ -84036,13 +84070,13 @@ async function channelSettings({ context, args }) {
84036
84070
  }
84037
84071
 
84038
84072
  // src/services/chat-actions-commands.service.ts
84039
- import { readFile as readFile24 } from "node:fs/promises";
84073
+ import { readFile as readFile25 } from "node:fs/promises";
84040
84074
  import { basename as basename7, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve10 } from "node:path";
84041
84075
 
84042
84076
  // src/services/file-download.service.ts
84043
84077
  import { createWriteStream } from "node:fs";
84044
- import { mkdir as mkdir21, rename as rename5, rm as rm10, stat as stat9, truncate } from "node:fs/promises";
84045
- import { basename as basename6, dirname as dirname20, resolve as resolve9 } from "node:path";
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";
84046
84080
  import { Readable, Transform } from "node:stream";
84047
84081
  import { pipeline } from "node:stream/promises";
84048
84082
  var NOT_READY_WAIT_MS = 5e3;
@@ -84162,8 +84196,8 @@ async function downloadFile({
84162
84196
  out
84163
84197
  }) {
84164
84198
  const asked = out ? resolve9(context.cwd, out) : void 0;
84165
- const part = resolve9(asked ? dirname20(asked) : context.cwd, `.${attachmentId}.part`);
84166
- await mkdir21(dirname20(part), { recursive: true });
84199
+ const part = resolve9(asked ? dirname21(asked) : context.cwd, `.${attachmentId}.part`);
84200
+ await mkdir22(dirname21(part), { recursive: true });
84167
84201
  const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
84168
84202
  async (error63) => {
84169
84203
  await rm10(part, { force: true });
@@ -84434,7 +84468,7 @@ function uploadNameOf({ cwd, path }) {
84434
84468
  }
84435
84469
  var fileUpload = async ({ context, args, client }) => {
84436
84470
  const path = resolve10(context.cwd, wordAt(args, 3));
84437
- const bytes = new Uint8Array(await readFile24(path));
84471
+ const bytes = new Uint8Array(await readFile25(path));
84438
84472
  const answer6 = await uploadFile({
84439
84473
  context,
84440
84474
  client,
@@ -84618,7 +84652,7 @@ async function chatActions({
84618
84652
  }
84619
84653
 
84620
84654
  // src/services/claude-monitor.service.ts
84621
- import { readFile as readFile25, rm as rm11 } from "node:fs/promises";
84655
+ import { readFile as readFile26, rm as rm11 } from "node:fs/promises";
84622
84656
  var MONITOR_IDLE_MS = 3e4;
84623
84657
  var MONITOR_OUTRANKED_MS = 3e3;
84624
84658
  async function deliverOnce({
@@ -84725,7 +84759,7 @@ async function monitorSessionOf({
84725
84759
  const fromEnv = sessionOf({ context, harness: "claude-code", sessionId });
84726
84760
  if (fromEnv || !claudePid) return fromEnv;
84727
84761
  const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
84728
- return readFile25(path, "utf8").then(
84762
+ return readFile26(path, "utf8").then(
84729
84763
  (text3) => JSON.parse(text3),
84730
84764
  () => void 0
84731
84765
  );
@@ -85763,6 +85797,7 @@ var computerChangedDefinition = external_exports.object({
85763
85797
 
85764
85798
  // ../../modules/compute/contract/src/dedicated-ip.ts
85765
85799
  var DEDICATED_IP_MAX_DOMAINS = 50;
85800
+ var dedicatedIpScopeSchema = external_exports.enum(["all", "sites"]);
85766
85801
  var DEDICATED_IP_MONTHLY_PRICE = DEDICATED_IP_TERMS.monthlyPrice;
85767
85802
  var adoptDedicatedAddressInputDefinition = external_exports.object({
85768
85803
  workspaceId: external_exports.string().min(1),
@@ -85790,6 +85825,9 @@ var dedicatedIpStatusDefinition = external_exports.object({
85790
85825
  address: external_exports.string().nullable(),
85791
85826
  domains: external_exports.array(external_exports.string()),
85792
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(),
85793
85831
  currency: currencySchema,
85794
85832
  monthlyPrice: external_exports.number().nonnegative(),
85795
85833
  /** Why Laze turned it off: credits ran out, or its owner left the workspace. */
@@ -85835,7 +85873,8 @@ var setDedicatedIpDomainsInputDefinition = external_exports.object({
85835
85873
  add: external_exports.array(external_exports.string().max(300)).max(DEDICATED_IP_MAX_DOMAINS).default([]),
85836
85874
  remove: external_exports.array(external_exports.string().max(300)).max(DEDICATED_IP_MAX_DOMAINS).default([]),
85837
85875
  /** Back to the defaults, before any add or remove. */
85838
- reset: external_exports.boolean().default(false)
85876
+ reset: external_exports.boolean().default(false),
85877
+ scope: dedicatedIpScopeSchema.optional()
85839
85878
  });
85840
85879
  var setDedicatedIpDomainsInputSchema = setDedicatedIpDomainsInputDefinition;
85841
85880
  var dedicatedIpOfferInputDefinition = external_exports.object({
@@ -86541,7 +86580,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
86541
86580
  // src/services/computer-copy-commands.service.ts
86542
86581
  import { mkdtemp as mkdtemp2, open as open4, rm as rm12, stat as stat10 } from "node:fs/promises";
86543
86582
  import { tmpdir as tmpdir4 } from "node:os";
86544
- import { basename as basename8, dirname as dirname21, resolve as resolve11 } from "node:path";
86583
+ import { basename as basename8, dirname as dirname22, resolve as resolve11 } from "node:path";
86545
86584
  var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
86546
86585
  copy a local file or folder into your hosted agent's work folder
86547
86586
  (its owner only, up to 2 GiB packed); <folder> is relative to the
@@ -86557,7 +86596,7 @@ function packingOf({ path, isDirectory }) {
86557
86596
  const contents = isDirectory && path.endsWith("/");
86558
86597
  const absolute = resolve11(path);
86559
86598
  const name3 = basename8(absolute);
86560
- return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname21(absolute), entry: name3 };
86599
+ return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname22(absolute), entry: name3 };
86561
86600
  }
86562
86601
  async function sendParts2({
86563
86602
  context,
@@ -86931,10 +86970,10 @@ async function computer({ context, args }) {
86931
86970
  }
86932
86971
 
86933
86972
  // src/services/connect-commands.service.ts
86934
- import { readFile as readFile27 } from "node:fs/promises";
86973
+ import { readFile as readFile28 } from "node:fs/promises";
86935
86974
 
86936
86975
  // src/services/mcp-gateway.service.ts
86937
- import { readFile as readFile26 } from "node:fs/promises";
86976
+ import { readFile as readFile27 } from "node:fs/promises";
86938
86977
  import { createInterface as createInterface3 } from "node:readline";
86939
86978
  var TURN_HEADER = "x-laze-turn";
86940
86979
  function serveMcpGateway({
@@ -86977,7 +87016,7 @@ async function relayMcpLines({
86977
87016
  const github3 = env.LAZE_GITHUB_CONNECTION;
86978
87017
  const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
86979
87018
  const turnFile = env.LAZE_TURN_FILE;
86980
- const readTurn = () => readFile26(turnFile, "utf8").then(
87019
+ const readTurn = () => readFile27(turnFile, "utf8").then(
86981
87020
  (text3) => text3.trim(),
86982
87021
  () => ""
86983
87022
  );
@@ -87067,7 +87106,7 @@ async function turnOf({ context }) {
87067
87106
  const pinned = env.LAZE_TURN_TOKEN?.trim();
87068
87107
  if (pinned) return pinned;
87069
87108
  const file3 = env.LAZE_TURN_FILE;
87070
- const turn = file3 ? await readFile27(file3, "utf8").then(
87109
+ const turn = file3 ? await readFile28(file3, "utf8").then(
87071
87110
  (text3) => text3.trim(),
87072
87111
  () => ""
87073
87112
  ) : "";
@@ -87125,11 +87164,11 @@ async function connect({
87125
87164
  }
87126
87165
 
87127
87166
  // src/services/connector-commands.service.ts
87128
- import { readFile as readFile29 } from "node:fs/promises";
87167
+ import { readFile as readFile30 } from "node:fs/promises";
87129
87168
  import { resolve as resolve12 } from "node:path";
87130
87169
 
87131
87170
  // src/services/vault-keychain-commands.service.ts
87132
- import { readFile as readFile28 } from "node:fs/promises";
87171
+ import { readFile as readFile29 } from "node:fs/promises";
87133
87172
 
87134
87173
  // src/rules/vault-input.rules.ts
87135
87174
  function secondsOf(text3) {
@@ -87547,7 +87586,7 @@ async function secretText({ context, args }) {
87547
87586
  );
87548
87587
  }
87549
87588
  const file3 = flagText({ args, name: "from-file" });
87550
- const text3 = file3 ? await readFile28(file3, "utf8") : await context.readStdin();
87589
+ const text3 = file3 ? await readFile29(file3, "utf8") : await context.readStdin();
87551
87590
  const trimmed = text3.replace(/\r?\n$/, "");
87552
87591
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
87553
87592
  return trimmed;
@@ -87780,7 +87819,7 @@ async function keyText({ context, args }) {
87780
87819
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
87781
87820
  }
87782
87821
  const file3 = flagText({ args, name: "from-file" });
87783
- const text3 = file3 ? await readFile29(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
87822
+ const text3 = file3 ? await readFile30(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
87784
87823
  const trimmed = text3.trim();
87785
87824
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
87786
87825
  return trimmed;
@@ -88101,7 +88140,7 @@ async function conversationDelete({ context, args }) {
88101
88140
  }
88102
88141
 
88103
88142
  // src/services/discord-commands.service.ts
88104
- import { readFile as readFile30 } from "node:fs/promises";
88143
+ import { readFile as readFile31 } from "node:fs/promises";
88105
88144
  import { resolve as resolve13 } from "node:path";
88106
88145
 
88107
88146
  // ../../modules/discord/contract/src/discord.ts
@@ -88423,7 +88462,7 @@ async function secretsOf({ context, args }) {
88423
88462
  const fromConnection = flagText({ args, name: "from-vault" });
88424
88463
  if (fromConnection) return { fromConnection };
88425
88464
  const file3 = flagText({ args, name: "from-file" });
88426
- const text3 = file3 ? await readFile30(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
88465
+ const text3 = file3 ? await readFile31(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
88427
88466
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
88428
88467
  if (lines2.length !== 2) {
88429
88468
  throw new CliUsageError(
@@ -88726,7 +88765,7 @@ async function domains({ context, args }) {
88726
88765
  }
88727
88766
 
88728
88767
  // src/services/emoji-commands.service.ts
88729
- import { readFile as readFile31 } from "node:fs/promises";
88768
+ import { readFile as readFile32 } from "node:fs/promises";
88730
88769
  import { resolve as resolve14 } from "node:path";
88731
88770
  var EMOJI_USAGE = `Usage:
88732
88771
  laze emoji list [--json] the workspace's custom emoji, aliases and who added each
@@ -88767,7 +88806,7 @@ async function addEmoji({ context, args, client }) {
88767
88806
  const file3 = wordAt4(args, 3);
88768
88807
  let bytes;
88769
88808
  try {
88770
- bytes = new Uint8Array(await readFile31(resolve14(context.cwd, file3)));
88809
+ bytes = new Uint8Array(await readFile32(resolve14(context.cwd, file3)));
88771
88810
  } catch {
88772
88811
  throw new CliUsageError(`Cannot read ${file3}.`);
88773
88812
  }
@@ -89083,7 +89122,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
89083
89122
  var ExternalSharingHooksToken = externalUi.hooks("sharing");
89084
89123
 
89085
89124
  // src/services/workspace-commands.service.ts
89086
- import { readFile as readFile32 } from "node:fs/promises";
89125
+ import { readFile as readFile33 } from "node:fs/promises";
89087
89126
  import { resolve as resolve15 } from "node:path";
89088
89127
  var ROLE_NAMES2 = {
89089
89128
  OWNER: "Owner",
@@ -89266,7 +89305,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
89266
89305
  async function readLogo({ context, file: file3 }) {
89267
89306
  let bytes;
89268
89307
  try {
89269
- bytes = new Uint8Array(await readFile32(resolve15(context.cwd, file3)));
89308
+ bytes = new Uint8Array(await readFile33(resolve15(context.cwd, file3)));
89270
89309
  } catch {
89271
89310
  throw new CliUsageError(`No file to read at ${file3}.`);
89272
89311
  }
@@ -89866,7 +89905,7 @@ async function agentFeedAccess({
89866
89905
  }
89867
89906
 
89868
89907
  // src/services/feed-commands.service.ts
89869
- import { readFile as readFile33 } from "node:fs/promises";
89908
+ import { readFile as readFile34 } from "node:fs/promises";
89870
89909
  import { resolve as resolve16 } from "node:path";
89871
89910
 
89872
89911
  // ../../modules/feed/contract/src/feed.delegate.ts
@@ -90926,7 +90965,7 @@ async function feedTurnOf({
90926
90965
  const read4 = async () => {
90927
90966
  const pinned = env.LAZE_TURN_TOKEN?.trim();
90928
90967
  if (pinned) return pinned;
90929
- 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();
90930
90969
  return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
90931
90970
  };
90932
90971
  const turn = await read4().catch(() => "");
@@ -91000,7 +91039,7 @@ async function bodyOf2({
91000
91039
  flags: flags2
91001
91040
  }) {
91002
91041
  const body = { ...flags2.fields };
91003
- const read4 = (source) => "file" in source ? readFile33(resolve16(context.cwd, source.file), "utf8") : source.text;
91042
+ const read4 = (source) => "file" in source ? readFile34(resolve16(context.cwd, source.file), "utf8") : source.text;
91004
91043
  for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
91005
91044
  if (flags2.rich) {
91006
91045
  const text3 = await read4(flags2.rich.source);
@@ -91263,7 +91302,7 @@ async function textFlag({
91263
91302
  }) {
91264
91303
  const value = flagText({ args, name: name3 });
91265
91304
  if (!value.startsWith("@")) return value;
91266
- return readFile33(resolve16(context.cwd, value.slice(1)), "utf8");
91305
+ return readFile34(resolve16(context.cwd, value.slice(1)), "utf8");
91267
91306
  }
91268
91307
  async function feedList({ context, args }) {
91269
91308
  const { client } = await signedIn({ context, args });
@@ -91353,7 +91392,7 @@ async function ranksOf({
91353
91392
  }) {
91354
91393
  const file3 = flagText({ args, name: "file" });
91355
91394
  if (file3) {
91356
- const parsed = JSON.parse(await readFile33(resolve16(context.cwd, file3), "utf8"));
91395
+ const parsed = JSON.parse(await readFile34(resolve16(context.cwd, file3), "utf8"));
91357
91396
  if (Array.isArray(parsed)) return parsed;
91358
91397
  throw new CliUsageError("--file holds a list of {itemId, priority}");
91359
91398
  }
@@ -91466,7 +91505,7 @@ async function feed({ context, args }) {
91466
91505
  }
91467
91506
 
91468
91507
  // src/services/github-commands.service.ts
91469
- import { readFile as readFile34 } from "node:fs/promises";
91508
+ import { readFile as readFile35 } from "node:fs/promises";
91470
91509
 
91471
91510
  // src/rules/github-signature.rules.ts
91472
91511
  var TURN_SEPARATOR = "~";
@@ -91536,7 +91575,7 @@ var REAL_GH = "/usr/bin/gh";
91536
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>`.";
91537
91576
  async function turnFileToken({ env }) {
91538
91577
  if (!env.LAZE_TURN_FILE) return "";
91539
- return readFile34(env.LAZE_TURN_FILE, "utf8").then(
91578
+ return readFile35(env.LAZE_TURN_FILE, "utf8").then(
91540
91579
  (text3) => text3.trim(),
91541
91580
  () => ""
91542
91581
  );
@@ -91570,7 +91609,7 @@ async function githubGh({
91570
91609
  args: args.rest,
91571
91610
  agentName: profile.name ?? "An agent",
91572
91611
  threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
91573
- readBodyFile: (path) => path === "-" ? context.readStdin() : readFile34(path, "utf8")
91612
+ readBodyFile: (path) => path === "-" ? context.readStdin() : readFile35(path, "utf8")
91574
91613
  });
91575
91614
  return context.runCommand({
91576
91615
  command: [REAL_GH, ...ghArgs],
@@ -92030,6 +92069,7 @@ var IP_USAGE = `Usage:
92030
92069
  laze ip countries the countries on sale
92031
92070
  laze ip domains the domains it routes
92032
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
92033
92073
  laze ip offer [--site <domain>] the plain offer to pass on when a site blocks the shared address
92034
92074
  laze ip list who has one, its country and price (Owners and Admins)`;
92035
92075
  var printJson7 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
@@ -92058,7 +92098,8 @@ function ipLines(status11) {
92058
92098
  const price = `${status11.monthlyPrice} ${status11.currency.toUpperCase()} a month from the workspace's credits`;
92059
92099
  const country = status11.country?.name ?? "?";
92060
92100
  const lines2 = linesFor({ status: status11, price, country });
92061
- 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}`);
92062
92103
  return lines2;
92063
92104
  }
92064
92105
  async function status5({ context, args }) {
@@ -92105,6 +92146,15 @@ function domainsEditOf({
92105
92146
  if (action === "remove") return { remove: names };
92106
92147
  return void 0;
92107
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
+ }
92108
92158
  async function domains2(run4) {
92109
92159
  const [, , action, ...names] = run4.args.words;
92110
92160
  if (!action) {
@@ -92152,6 +92202,7 @@ var IP_COMMANDS = {
92152
92202
  off: turnOff,
92153
92203
  countries,
92154
92204
  domains: domains2,
92205
+ scope: scope2,
92155
92206
  offer,
92156
92207
  list: list8
92157
92208
  };
@@ -92163,19 +92214,19 @@ async function ip({ context, args }) {
92163
92214
  }
92164
92215
 
92165
92216
  // src/services/join-commands.service.ts
92166
- import { mkdir as mkdir22, readFile as readFile35, rename as rename8, rm as rm13, writeFile as writeFile21 } from "node:fs/promises";
92167
- import { dirname as dirname22, 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";
92168
92219
  var DEFAULT_WAIT_SECONDS2 = 100;
92169
92220
  var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
92170
92221
  function pendingPathOf({ context }) {
92171
- return join25(dirname22(context.environment.configPath), "join", "pending.json");
92222
+ return join25(dirname23(context.environment.configPath), "join", "pending.json");
92172
92223
  }
92173
92224
  async function readPending({
92174
92225
  context,
92175
92226
  url: url2,
92176
92227
  args
92177
92228
  }) {
92178
- const pending2 = await readFile35(pendingPathOf({ context }), "utf8").then(
92229
+ const pending2 = await readFile36(pendingPathOf({ context }), "utf8").then(
92179
92230
  (text3) => JSON.parse(text3),
92180
92231
  () => void 0
92181
92232
  );
@@ -92185,9 +92236,9 @@ async function readPending({
92185
92236
  }
92186
92237
  async function keepPending({ context, pending: pending2 }) {
92187
92238
  const path = pendingPathOf({ context });
92188
- await mkdir22(dirname22(path), { recursive: true, mode: 448 });
92239
+ await mkdir23(dirname23(path), { recursive: true, mode: 448 });
92189
92240
  const temporary = `${path}.${process.pid}.tmp`;
92190
- await writeFile21(temporary, JSON.stringify(pending2), { mode: 384 });
92241
+ await writeFile22(temporary, JSON.stringify(pending2), { mode: 384 });
92191
92242
  await rename8(temporary, path);
92192
92243
  }
92193
92244
  async function dropPending({ context }) {
@@ -93325,18 +93376,18 @@ async function serveMcp({
93325
93376
  }
93326
93377
 
93327
93378
  // src/services/memory-commands.service.ts
93328
- import { readdir as readdir7, readFile as readFile37 } from "node:fs/promises";
93379
+ import { readdir as readdir7, readFile as readFile38 } from "node:fs/promises";
93329
93380
  import { join as join26, resolve as resolve18 } from "node:path";
93330
93381
 
93331
93382
  // src/services/mount-files.service.ts
93332
- import { mkdir as mkdir23, readFile as readFile36, rm as rm14, writeFile as writeFile22 } from "node:fs/promises";
93333
- import { dirname as dirname23, relative as relative5, resolve as resolve17 } 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";
93334
93385
  async function textArgument({
93335
93386
  context,
93336
93387
  value
93337
93388
  }) {
93338
93389
  if (value === "-") return context.readStdin();
93339
- if (value.startsWith("@")) return readFile36(resolve17(context.cwd, value.slice(1)), "utf8");
93390
+ if (value.startsWith("@")) return readFile37(resolve17(context.cwd, value.slice(1)), "utf8");
93340
93391
  return value;
93341
93392
  }
93342
93393
  function turnChannel({ context, args }) {
@@ -93350,14 +93401,14 @@ async function writeMount({
93350
93401
  }) {
93351
93402
  const root = resolve17(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
93352
93403
  await rm14(root, { recursive: true, force: true });
93353
- await mkdir23(root, { recursive: true });
93404
+ await mkdir24(root, { recursive: true });
93354
93405
  for (const file3 of files2) {
93355
93406
  const target = resolve17(root, file3.path);
93356
93407
  const inside = relative5(root, target);
93357
93408
  if (!inside || inside.startsWith(".."))
93358
93409
  throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
93359
- await mkdir23(dirname23(target), { recursive: true });
93360
- await writeFile22(target, file3.content);
93410
+ await mkdir24(dirname24(target), { recursive: true });
93411
+ await writeFile23(target, file3.content);
93361
93412
  }
93362
93413
  return root;
93363
93414
  }
@@ -93483,7 +93534,7 @@ async function turnTokenOf5({ context }) {
93483
93534
  const pinned = env.LAZE_TURN_TOKEN?.trim();
93484
93535
  if (pinned) return pinned;
93485
93536
  if (!env.LAZE_TURN_FILE) return "";
93486
- return readFile37(env.LAZE_TURN_FILE, "utf8").then(
93537
+ return readFile38(env.LAZE_TURN_FILE, "utf8").then(
93487
93538
  (text3) => text3.trim(),
93488
93539
  () => ""
93489
93540
  );
@@ -93613,7 +93664,7 @@ async function siestaImport({
93613
93664
  dir
93614
93665
  }) {
93615
93666
  const root = resolve18(context.cwd, dir);
93616
- const log = await readFile37(join26(root, "LOG.md"));
93667
+ const log = await readFile38(join26(root, "LOG.md"));
93617
93668
  const names = (await readdir7(join26(root, "tree")).catch(() => [])).filter(
93618
93669
  (name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
93619
93670
  );
@@ -93621,7 +93672,7 @@ async function siestaImport({
93621
93672
  await Promise.all(
93622
93673
  names.map(async (name3) => [
93623
93674
  name3.slice(0, -3),
93624
- (await readFile37(join26(root, "tree", name3))).toString("base64")
93675
+ (await readFile38(join26(root, "tree", name3))).toString("base64")
93625
93676
  ])
93626
93677
  )
93627
93678
  );
@@ -93641,7 +93692,7 @@ async function memoryImport({ context, args }) {
93641
93692
  const dir = flagText({ args, name: "optmem" });
93642
93693
  if (!dir) throw new CliUsageError(USAGE13);
93643
93694
  const root = resolve18(context.cwd, dir);
93644
- const log = await readFile37(join26(root, "LOG.txt"));
93695
+ const log = await readFile38(join26(root, "LOG.txt"));
93645
93696
  const sizes2 = (await readdir7(join26(root, "TREE")).catch(() => [])).filter(
93646
93697
  (name3) => /^\d{1,4}$/.test(name3)
93647
93698
  );
@@ -93649,7 +93700,7 @@ async function memoryImport({ context, args }) {
93649
93700
  await Promise.all(
93650
93701
  sizes2.map(async (size) => [
93651
93702
  size,
93652
- (await readFile37(join26(root, "TREE", size))).toString("base64")
93703
+ (await readFile38(join26(root, "TREE", size))).toString("base64")
93653
93704
  ])
93654
93705
  )
93655
93706
  );
@@ -94213,9 +94264,9 @@ async function openclaw({
94213
94264
  }
94214
94265
 
94215
94266
  // src/services/operator-key-commands.service.ts
94216
- import { createHash as createHash5, randomBytes as randomBytes3 } from "node:crypto";
94217
- import { mkdir as mkdir24, readFile as readFile38, rm as rm15, writeFile as writeFile23 } from "node:fs/promises";
94218
- import { dirname as dirname24, 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";
94219
94270
 
94220
94271
  // ../../modules/audit-log/contract/src/audit-log.api.ts
94221
94272
  var auditEntrySchemaDefinition = external_exports.object({
@@ -95544,15 +95595,15 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
95544
95595
  laze ops status <key> waiting, approved or ended
95545
95596
  laze ops use <key> run the approved action and print the answer`;
95546
95597
  var POLL_MS3 = 5e3;
95547
- var keyFile = ({ context, keyId }) => join27(dirname24(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
95598
+ var keyFile = ({ context, keyId }) => join27(dirname25(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
95548
95599
  async function saveSecret({
95549
95600
  context,
95550
95601
  keyId,
95551
95602
  secret
95552
95603
  }) {
95553
95604
  const path = keyFile({ context, keyId });
95554
- await mkdir24(dirname24(path), { recursive: true, mode: 448 });
95555
- await writeFile23(path, secret, { mode: 384 });
95605
+ await mkdir25(dirname25(path), { recursive: true, mode: 448 });
95606
+ await writeFile24(path, secret, { mode: 384 });
95556
95607
  }
95557
95608
  function typedArg(text3) {
95558
95609
  if (["true", "false", "null"].includes(text3)) return JSON.parse(text3);
@@ -95609,7 +95660,7 @@ async function requestKey({ context, args }) {
95609
95660
  target,
95610
95661
  args: argsOf({ args }),
95611
95662
  reason: reason2,
95612
- secretHash: createHash5("sha256").update(secret).digest("hex")
95663
+ secretHash: createHash6("sha256").update(secret).digest("hex")
95613
95664
  });
95614
95665
  await saveSecret({ context, keyId: key.id, secret });
95615
95666
  const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
@@ -95645,7 +95696,7 @@ async function useKey({ context, args }) {
95645
95696
  if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
95646
95697
  const { client } = await signedIn({ context, args });
95647
95698
  const path = keyFile({ context, keyId });
95648
- const secret = await readFile38(path, "utf8").catch(() => null);
95699
+ const secret = await readFile39(path, "utf8").catch(() => null);
95649
95700
  if (secret === null) {
95650
95701
  throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
95651
95702
  }
@@ -95710,8 +95761,8 @@ ${OPS_USAGE}`);
95710
95761
  }
95711
95762
 
95712
95763
  // src/services/release-watch.service.ts
95713
- import { mkdir as mkdir25, readFile as readFile39, realpath, writeFile as writeFile24 } from "node:fs/promises";
95714
- import { dirname as dirname25, 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";
95715
95766
 
95716
95767
  // src/rules/cli-update.rules.ts
95717
95768
  var CLI_PACKAGE = "@lazehq/cli";
@@ -95857,13 +95908,13 @@ async function startedUpdate({
95857
95908
  if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
95858
95909
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
95859
95910
  if (plan2.kind !== "install") return null;
95860
- const folder = dirname25(context.environment.configPath);
95911
+ const folder = dirname26(context.environment.configPath);
95861
95912
  const stamp = join28(folder, "auto-update.json");
95862
- 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);
95863
95914
  const now = context.nowMs();
95864
95915
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
95865
- await mkdir25(folder, { recursive: true, mode: 448 });
95866
- 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 });
95867
95918
  context.processes.spawnDetached({
95868
95919
  argv: [...context.program, "update"],
95869
95920
  logPath: join28(folder, "auto-update.log")
@@ -95903,7 +95954,7 @@ function watchingRelease({
95903
95954
  }
95904
95955
 
95905
95956
  // src/services/rush-guard.service.ts
95906
- import { readFile as readFile40, rm as rm16 } from "node:fs/promises";
95957
+ import { readFile as readFile41, rm as rm16 } from "node:fs/promises";
95907
95958
  var WATCH_MS3 = 2e3;
95908
95959
  var RETRY_MS2 = 3e4;
95909
95960
  async function guardRound(guard) {
@@ -95946,7 +95997,7 @@ async function rushWakeHook({ context, args }) {
95946
95997
  while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
95947
95998
  const { client, name: name3 } = await signedIn({ context, args });
95948
95999
  const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
95949
- const note = await readFile40(noted, "utf8").then(
96000
+ const note = await readFile41(noted, "utf8").then(
95950
96001
  (text3) => JSON.parse(text3),
95951
96002
  () => void 0
95952
96003
  );
@@ -96144,7 +96195,7 @@ async function schedule({ context, args }) {
96144
96195
  }
96145
96196
 
96146
96197
  // src/services/skill-commands.service.ts
96147
- import { readdir as readdir8, readFile as readFile41 } from "node:fs/promises";
96198
+ import { readdir as readdir8, readFile as readFile42 } from "node:fs/promises";
96148
96199
  import { join as join29, relative as relative6, resolve as resolve20 } from "node:path";
96149
96200
  var USAGE17 = `Usage:
96150
96201
  laze skill list [--agent <agentId>]
@@ -96167,7 +96218,7 @@ async function folderFiles({ root }) {
96167
96218
  for (const entry of entries) {
96168
96219
  if (!entry.isFile()) continue;
96169
96220
  const full = join29(entry.parentPath, entry.name);
96170
- files2.push({ path: relative6(root, full), content: await readFile41(full, "utf8") });
96221
+ files2.push({ path: relative6(root, full), content: await readFile42(full, "utf8") });
96171
96222
  }
96172
96223
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
96173
96224
  }
@@ -96265,7 +96316,7 @@ async function skillUpdate({ context, args }) {
96265
96316
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
96266
96317
  throw new CliUsageError(USAGE17);
96267
96318
  }
96268
- const skillMd = skillMdFile ? await readFile41(resolve20(context.cwd, skillMdFile), "utf8") : void 0;
96319
+ const skillMd = skillMdFile ? await readFile42(resolve20(context.cwd, skillMdFile), "utf8") : void 0;
96269
96320
  const { client } = await signedIn({ context, args });
96270
96321
  const updated = await client.post("/api/skills/update", {
96271
96322
  name: name3,
@@ -96311,7 +96362,7 @@ async function skill({ context, args }) {
96311
96362
  }
96312
96363
 
96313
96364
  // src/services/slack-commands.service.ts
96314
- import { readFile as readFile42 } from "node:fs/promises";
96365
+ import { readFile as readFile43 } from "node:fs/promises";
96315
96366
  import { resolve as resolve21 } from "node:path";
96316
96367
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
96317
96368
  laze slack overview connected Slack workspaces, mirrors, your link
@@ -96359,7 +96410,7 @@ async function secretLines({ context, args }) {
96359
96410
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
96360
96411
  }
96361
96412
  const file3 = flagText({ args, name: "from-file" });
96362
- const text3 = file3 ? await readFile42(resolve21(context.cwd, file3), "utf8") : await context.readStdin();
96413
+ const text3 = file3 ? await readFile43(resolve21(context.cwd, file3), "utf8") : await context.readStdin();
96363
96414
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
96364
96415
  }
96365
96416
  async function secretsOf2({
@@ -96663,7 +96714,7 @@ async function slack({
96663
96714
  }
96664
96715
 
96665
96716
  // src/services/sso-commands.service.ts
96666
- import { readFile as readFile43 } from "node:fs/promises";
96717
+ import { readFile as readFile44 } from "node:fs/promises";
96667
96718
  var SSO_USAGE = `Usage:
96668
96719
  laze sso domains claimed domains and how each signs in (admins)
96669
96720
  laze sso claim <domain> the TXT record that proves the domain
@@ -96750,7 +96801,7 @@ function refuseSecretFlags({ args }) {
96750
96801
  }
96751
96802
  async function clientSecretOf({ context, args }) {
96752
96803
  const file3 = flagText({ args, name: "from-file" });
96753
- const text3 = file3 ? await readFile43(file3, "utf8") : await context.readStdin();
96804
+ const text3 = file3 ? await readFile44(file3, "utf8") : await context.readStdin();
96754
96805
  const secret = text3.trim();
96755
96806
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
96756
96807
  return secret;
@@ -97082,8 +97133,8 @@ async function update2({
97082
97133
  }
97083
97134
 
97084
97135
  // src/services/vault-env-commands.service.ts
97085
- import { readFile as readFile44, stat as stat11 } from "node:fs/promises";
97086
- import { dirname as dirname26, join as join30, resolve as resolve22 } 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";
97087
97138
 
97088
97139
  // src/rules/vault-manifest.rules.ts
97089
97140
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -97431,9 +97482,9 @@ async function manifestPathOf({
97431
97482
  if (named) return resolve22(context.cwd, named);
97432
97483
  const environment = flagText({ args, name: "env" });
97433
97484
  const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
97434
- for (let dir = resolve22(context.cwd); ; dir = dirname26(dir)) {
97485
+ for (let dir = resolve22(context.cwd); ; dir = dirname27(dir)) {
97435
97486
  if (await isFile(join30(dir, file3))) return join30(dir, file3);
97436
- if (dirname26(dir) === dir) break;
97487
+ if (dirname27(dir) === dir) break;
97437
97488
  }
97438
97489
  throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
97439
97490
  ${ENV_USAGE}`);
@@ -97443,7 +97494,7 @@ async function manifestOf({
97443
97494
  args
97444
97495
  }) {
97445
97496
  const file3 = await manifestPathOf({ context, args });
97446
- const text3 = await readFile44(file3, "utf8").catch(() => {
97497
+ const text3 = await readFile45(file3, "utf8").catch(() => {
97447
97498
  throw new CliUsageError(`laze vault: cannot read ${file3}`);
97448
97499
  });
97449
97500
  return { file: file3, lines: parseManifest({ text: text3, file: file3 }) };
@@ -97758,7 +97809,7 @@ async function vaultScrub({ context, args }) {
97758
97809
  }
97759
97810
 
97760
97811
  // src/services/whatsapp-business-commands.service.ts
97761
- import { readFile as readFile45 } from "node:fs/promises";
97812
+ import { readFile as readFile46 } from "node:fs/promises";
97762
97813
  import { resolve as resolve23 } from "node:path";
97763
97814
 
97764
97815
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
@@ -98178,7 +98229,7 @@ async function secretsOf3({ context, args }) {
98178
98229
  const fromConnection = flagText({ args, name: "from-vault" });
98179
98230
  if (fromConnection) return { fromConnection };
98180
98231
  const file3 = flagText({ args, name: "from-file" });
98181
- const text3 = file3 ? await readFile45(resolve23(context.cwd, file3), "utf8") : await context.readStdin();
98232
+ const text3 = file3 ? await readFile46(resolve23(context.cwd, file3), "utf8") : await context.readStdin();
98182
98233
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
98183
98234
  if (lines2.length !== 2) {
98184
98235
  throw new CliUsageError(
@@ -99250,14 +99301,14 @@ function exitCodeOf({ context, error: error63 }) {
99250
99301
  // src/services/machine-key.service.ts
99251
99302
  import { execFile as execFile2 } from "node:child_process";
99252
99303
  import {
99253
- createHash as createHash6,
99304
+ createHash as createHash7,
99254
99305
  createPrivateKey,
99255
99306
  generateKeyPairSync,
99256
99307
  randomBytes as randomBytes4,
99257
99308
  sign
99258
99309
  } from "node:crypto";
99259
- import { chmod as chmod4, link, mkdir as mkdir26, readFile as readFile46, rm as rm18, writeFile as writeFile25 } from "node:fs/promises";
99260
- import { dirname as dirname27, 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";
99261
99312
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
99262
99313
  var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve24, reject) => {
99263
99314
  const child = execFile2(
@@ -99297,15 +99348,15 @@ var MachineKeyStore = class _MachineKeyStore {
99297
99348
  });
99298
99349
  }
99299
99350
  get metaPath() {
99300
- return join31(dirname27(this.options.configPath), "machine-key.json");
99351
+ return join31(dirname28(this.options.configPath), "machine-key.json");
99301
99352
  }
99302
99353
  /** Named by the key, so two CLIs making a key at once never overwrite each other's. */
99303
99354
  pemPathOf(jwk) {
99304
- return join31(dirname27(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99355
+ return join31(dirname28(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99305
99356
  }
99306
99357
  /** The Keychain item's account: one per config file and key. */
99307
99358
  accountOf(jwk) {
99308
- const config2 = createHash6("sha256").update(this.options.configPath).digest("hex");
99359
+ const config2 = createHash7("sha256").update(this.options.configPath).digest("hex");
99309
99360
  return `${config2.slice(0, 32)}-${shortOf(jwk)}`;
99310
99361
  }
99311
99362
  /** The key if this machine made one; null otherwise. Read once per process. */
@@ -99329,7 +99380,7 @@ var MachineKeyStore = class _MachineKeyStore {
99329
99380
  async read() {
99330
99381
  let meta3;
99331
99382
  try {
99332
- meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile46(this.metaPath, "utf8")));
99383
+ meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile47(this.metaPath, "utf8")));
99333
99384
  } catch {
99334
99385
  return null;
99335
99386
  }
@@ -99344,7 +99395,7 @@ var MachineKeyStore = class _MachineKeyStore {
99344
99395
  "-w"
99345
99396
  ],
99346
99397
  timeoutMs: 1e4
99347
- }) : await readFile46(this.pemPathOf(meta3.jwk), "utf8");
99398
+ }) : await readFile47(this.pemPathOf(meta3.jwk), "utf8");
99348
99399
  return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
99349
99400
  }
99350
99401
  async make() {
@@ -99428,8 +99479,8 @@ async function writeOnce({ path, text: text3 }) {
99428
99479
  }
99429
99480
  }
99430
99481
  async function writePrivate({ path, text: text3 }) {
99431
- await mkdir26(dirname27(path), { recursive: true, mode: 448 });
99432
- await writeFile25(path, text3, { mode: 384 });
99482
+ await mkdir27(dirname28(path), { recursive: true, mode: 448 });
99483
+ await writeFile26(path, text3, { mode: 384 });
99433
99484
  await chmod4(path, 384);
99434
99485
  }
99435
99486
 
@@ -99486,8 +99537,8 @@ function machineProofFetch({
99486
99537
  // src/services/processes.service.ts
99487
99538
  import { execFile as execFile3, spawn as spawn4 } from "node:child_process";
99488
99539
  import { mkdirSync, openSync } from "node:fs";
99489
- import { readFile as readFile47, readlink } from "node:fs/promises";
99490
- import { dirname as dirname28 } from "node:path";
99540
+ import { readFile as readFile48, readlink } from "node:fs/promises";
99541
+ import { dirname as dirname29 } from "node:path";
99491
99542
  import { promisify as promisify2 } from "node:util";
99492
99543
  var run3 = promisify2(execFile3);
99493
99544
  function alive(pid) {
@@ -99500,14 +99551,14 @@ function alive(pid) {
99500
99551
  }
99501
99552
  }
99502
99553
  async function argsOf2(pid) {
99503
- const raw = await readFile47(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
99554
+ const raw = await readFile48(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
99504
99555
  if (raw) return raw.split("\0").filter(Boolean);
99505
99556
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
99506
99557
  const line = listed?.stdout.trim();
99507
99558
  return line ? line.split(/\s+/) : void 0;
99508
99559
  }
99509
99560
  async function parentOf(pid) {
99510
- const stat12 = await readFile47(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
99561
+ const stat12 = await readFile48(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
99511
99562
  const fromStat = stat12 ? Number(stat12.slice(stat12.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
99512
99563
  if (fromStat > 0) return fromStat;
99513
99564
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
@@ -99524,7 +99575,7 @@ async function cwdOf(pid) {
99524
99575
  return line ? line.slice(1) : void 0;
99525
99576
  }
99526
99577
  function spawnDetached({ argv, logPath }) {
99527
- mkdirSync(dirname28(logPath), { recursive: true, mode: 448 });
99578
+ mkdirSync(dirname29(logPath), { recursive: true, mode: 448 });
99528
99579
  const log = openSync(logPath, "a", 384);
99529
99580
  const [program = "", ...rest] = argv;
99530
99581
  const child = spawn4(program, rest, { detached: true, stdio: ["ignore", log, log] });