@lazehq/cli 0.1.84 → 0.1.86

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 +767 -415
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -849,9 +849,9 @@ var require_node_gyp_build = __commonJS({
849
849
  var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
850
850
  if (debug) return debug;
851
851
  }
852
- var prebuild = resolve24(dir);
852
+ var prebuild = resolve26(dir);
853
853
  if (prebuild) return prebuild;
854
- var nearby = resolve24(path.dirname(process.execPath));
854
+ var nearby = resolve26(path.dirname(process.execPath));
855
855
  if (nearby) return nearby;
856
856
  var target = [
857
857
  "platform=" + platform,
@@ -867,7 +867,7 @@ var require_node_gyp_build = __commonJS({
867
867
  // eslint-disable-line
868
868
  ].filter(Boolean).join(" ");
869
869
  throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
870
- function resolve24(dir2) {
870
+ function resolve26(dir2) {
871
871
  var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
872
872
  var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
873
873
  if (!tuple2) return;
@@ -912,10 +912,10 @@ var require_node_gyp_build = __commonJS({
912
912
  function compareTuples(a, b) {
913
913
  return a.architectures.length - b.architectures.length;
914
914
  }
915
- function parseTags(file3) {
916
- var arr = file3.split(".");
915
+ function parseTags(file4) {
916
+ var arr = file4.split(".");
917
917
  var extension2 = arr.pop();
918
- var tags = { file: file3, specificity: 0 };
918
+ var tags = { file: file4, specificity: 0 };
919
919
  if (extension2 !== "node") return;
920
920
  for (var i = 0; i < arr.length; i++) {
921
921
  var tag = arr[i];
@@ -3244,7 +3244,7 @@ var require_websocket = __commonJS({
3244
3244
  var http = __require("http");
3245
3245
  var net = __require("net");
3246
3246
  var tls = __require("tls");
3247
- var { randomBytes: randomBytes5, createHash: createHash8 } = __require("crypto");
3247
+ var { randomBytes: randomBytes5, createHash: createHash9 } = __require("crypto");
3248
3248
  var { Duplex, Readable: Readable2 } = __require("stream");
3249
3249
  var { URL: URL3 } = __require("url");
3250
3250
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -3912,7 +3912,7 @@ var require_websocket = __commonJS({
3912
3912
  abortHandshake(websocket, socket, "Invalid Upgrade header");
3913
3913
  return;
3914
3914
  }
3915
- const digest = createHash8("sha1").update(key + GUID).digest("base64");
3915
+ const digest = createHash9("sha1").update(key + GUID).digest("base64");
3916
3916
  if (res.headers["sec-websocket-accept"] !== digest) {
3917
3917
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
3918
3918
  return;
@@ -4281,7 +4281,7 @@ var require_websocket_server = __commonJS({
4281
4281
  var EventEmitter = __require("events");
4282
4282
  var http = __require("http");
4283
4283
  var { Duplex } = __require("stream");
4284
- var { createHash: createHash8 } = __require("crypto");
4284
+ var { createHash: createHash9 } = __require("crypto");
4285
4285
  var extension2 = require_extension();
4286
4286
  var PerMessageDeflate2 = require_permessage_deflate();
4287
4287
  var subprotocol2 = require_subprotocol();
@@ -4588,7 +4588,7 @@ var require_websocket_server = __commonJS({
4588
4588
  );
4589
4589
  }
4590
4590
  if (this._state > RUNNING) return abortHandshake(socket, 503);
4591
- const digest = createHash8("sha1").update(key + GUID).digest("base64");
4591
+ const digest = createHash9("sha1").update(key + GUID).digest("base64");
4592
4592
  const headers = [
4593
4593
  "HTTP/1.1 101 Switching Protocols",
4594
4594
  "Upgrade: websocket",
@@ -7314,9 +7314,9 @@ var require_dispatcher_base = __commonJS({
7314
7314
  }
7315
7315
  close(callback) {
7316
7316
  if (callback === void 0) {
7317
- return new Promise((resolve24, reject) => {
7317
+ return new Promise((resolve26, reject) => {
7318
7318
  this.close((err, data) => {
7319
- return err ? reject(err) : resolve24(data);
7319
+ return err ? reject(err) : resolve26(data);
7320
7320
  });
7321
7321
  });
7322
7322
  }
@@ -7354,9 +7354,9 @@ var require_dispatcher_base = __commonJS({
7354
7354
  err = null;
7355
7355
  }
7356
7356
  if (callback === void 0) {
7357
- return new Promise((resolve24, reject) => {
7357
+ return new Promise((resolve26, reject) => {
7358
7358
  this.destroy(err, (err2, data) => {
7359
- return err2 ? reject(err2) : resolve24(data);
7359
+ return err2 ? reject(err2) : resolve26(data);
7360
7360
  });
7361
7361
  });
7362
7362
  }
@@ -12311,12 +12311,12 @@ upgrade: ${upgrade2}\r
12311
12311
  cb();
12312
12312
  }
12313
12313
  }
12314
- const waitForDrain = () => new Promise((resolve24, reject) => {
12314
+ const waitForDrain = () => new Promise((resolve26, reject) => {
12315
12315
  assert2(callback === null);
12316
12316
  if (socket[kError]) {
12317
12317
  reject(socket[kError]);
12318
12318
  } else {
12319
- callback = resolve24;
12319
+ callback = resolve26;
12320
12320
  }
12321
12321
  });
12322
12322
  socket.on("close", onDrain).on("drain", onDrain);
@@ -13674,12 +13674,12 @@ var require_client_h2 = __commonJS({
13674
13674
  cb();
13675
13675
  }
13676
13676
  }
13677
- const waitForDrain = () => new Promise((resolve24, reject) => {
13677
+ const waitForDrain = () => new Promise((resolve26, reject) => {
13678
13678
  assert2(callback === null);
13679
13679
  if (socket[kError]) {
13680
13680
  reject(socket[kError]);
13681
13681
  } else {
13682
- callback = resolve24;
13682
+ callback = resolve26;
13683
13683
  }
13684
13684
  });
13685
13685
  h2stream.on("close", onDrain).on("drain", onDrain);
@@ -13996,7 +13996,7 @@ var require_client = __commonJS({
13996
13996
  this[kQueue] = [];
13997
13997
  this[kRunningIdx] = 0;
13998
13998
  this[kPendingIdx] = 0;
13999
- this[kResume] = (sync) => resume(this, sync);
13999
+ this[kResume] = (sync2) => resume(this, sync2);
14000
14000
  this[kOnError] = (err) => onError(this, err);
14001
14001
  }
14002
14002
  get pipelining() {
@@ -14047,16 +14047,16 @@ var require_client = __commonJS({
14047
14047
  return this[kNeedDrain] < 2;
14048
14048
  }
14049
14049
  [kClose]() {
14050
- return new Promise((resolve24) => {
14050
+ return new Promise((resolve26) => {
14051
14051
  if (this[kSize]) {
14052
- this[kClosedResolve] = resolve24;
14052
+ this[kClosedResolve] = resolve26;
14053
14053
  } else {
14054
- resolve24(null);
14054
+ resolve26(null);
14055
14055
  }
14056
14056
  });
14057
14057
  }
14058
14058
  [kDestroy](err) {
14059
- return new Promise((resolve24) => {
14059
+ return new Promise((resolve26) => {
14060
14060
  const requests2 = this[kQueue].splice(this[kPendingIdx]);
14061
14061
  for (let i = 0; i < requests2.length; i++) {
14062
14062
  const request2 = requests2[i];
@@ -14069,7 +14069,7 @@ var require_client = __commonJS({
14069
14069
  this[kClosedResolve]();
14070
14070
  this[kClosedResolve] = null;
14071
14071
  }
14072
- resolve24(null);
14072
+ resolve26(null);
14073
14073
  };
14074
14074
  if (this[kHTTPContext]) {
14075
14075
  this[kHTTPContext].destroy(err, callback);
@@ -14215,12 +14215,12 @@ var require_client = __commonJS({
14215
14215
  client[kNeedDrain] = 0;
14216
14216
  client.emit("drain", client[kUrl], [client]);
14217
14217
  }
14218
- function resume(client, sync) {
14218
+ function resume(client, sync2) {
14219
14219
  if (client[kResuming] === 2) {
14220
14220
  return;
14221
14221
  }
14222
14222
  client[kResuming] = 2;
14223
- _resume(client, sync);
14223
+ _resume(client, sync2);
14224
14224
  client[kResuming] = 0;
14225
14225
  if (client[kRunningIdx] > 256) {
14226
14226
  client[kQueue].splice(0, client[kRunningIdx]);
@@ -14228,7 +14228,7 @@ var require_client = __commonJS({
14228
14228
  client[kRunningIdx] = 0;
14229
14229
  }
14230
14230
  }
14231
- function _resume(client, sync) {
14231
+ function _resume(client, sync2) {
14232
14232
  while (true) {
14233
14233
  if (client.destroyed) {
14234
14234
  assert2(client[kPending] === 0);
@@ -14245,7 +14245,7 @@ var require_client = __commonJS({
14245
14245
  if (client[kBusy]) {
14246
14246
  client[kNeedDrain] = 2;
14247
14247
  } else if (client[kNeedDrain] === 2) {
14248
- if (sync) {
14248
+ if (sync2) {
14249
14249
  client[kNeedDrain] = 1;
14250
14250
  queueMicrotask(() => emitDrain(client));
14251
14251
  } else {
@@ -14482,8 +14482,8 @@ var require_pool_base = __commonJS({
14482
14482
  }
14483
14483
  return Promise.all(closeAll);
14484
14484
  } else {
14485
- return new Promise((resolve24) => {
14486
- this[kClosedResolve] = resolve24;
14485
+ return new Promise((resolve26) => {
14486
+ this[kClosedResolve] = resolve26;
14487
14487
  });
14488
14488
  }
14489
14489
  }
@@ -16994,7 +16994,7 @@ var require_readable = __commonJS({
16994
16994
  if (this._readableState.closeEmitted) {
16995
16995
  return Promise.resolve(null);
16996
16996
  }
16997
- return new Promise((resolve24, reject) => {
16997
+ return new Promise((resolve26, reject) => {
16998
16998
  if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
16999
16999
  this.destroy(new AbortError());
17000
17000
  }
@@ -17008,11 +17008,11 @@ var require_readable = __commonJS({
17008
17008
  if (signal.aborted) {
17009
17009
  reject(signal.reason ?? new AbortError());
17010
17010
  } else {
17011
- resolve24(null);
17011
+ resolve26(null);
17012
17012
  }
17013
17013
  });
17014
17014
  } else {
17015
- this.on("close", resolve24);
17015
+ this.on("close", resolve26);
17016
17016
  }
17017
17017
  this.on("error", noop2).on("data", () => {
17018
17018
  if (this[kBytesRead] > limit) {
@@ -17040,7 +17040,7 @@ var require_readable = __commonJS({
17040
17040
  }
17041
17041
  function consume(stream, type) {
17042
17042
  assert2(!stream[kConsume]);
17043
- return new Promise((resolve24, reject) => {
17043
+ return new Promise((resolve26, reject) => {
17044
17044
  if (isUnusable(stream)) {
17045
17045
  const rState = stream._readableState;
17046
17046
  if (rState.destroyed && rState.closeEmitted === false) {
@@ -17055,7 +17055,7 @@ var require_readable = __commonJS({
17055
17055
  stream[kConsume] = {
17056
17056
  type,
17057
17057
  stream,
17058
- resolve: resolve24,
17058
+ resolve: resolve26,
17059
17059
  reject,
17060
17060
  length: 0,
17061
17061
  body: []
@@ -17133,18 +17133,18 @@ var require_readable = __commonJS({
17133
17133
  return buffer;
17134
17134
  }
17135
17135
  function consumeEnd(consume2, encoding) {
17136
- const { type, body, resolve: resolve24, stream, length } = consume2;
17136
+ const { type, body, resolve: resolve26, stream, length } = consume2;
17137
17137
  try {
17138
17138
  if (type === "text") {
17139
- resolve24(chunksDecode(body, length, encoding));
17139
+ resolve26(chunksDecode(body, length, encoding));
17140
17140
  } else if (type === "json") {
17141
- resolve24(JSON.parse(chunksDecode(body, length, encoding)));
17141
+ resolve26(JSON.parse(chunksDecode(body, length, encoding)));
17142
17142
  } else if (type === "arrayBuffer") {
17143
- resolve24(chunksConcat(body, length).buffer);
17143
+ resolve26(chunksConcat(body, length).buffer);
17144
17144
  } else if (type === "blob") {
17145
- resolve24(new Blob(body, { type: stream[kContentType] }));
17145
+ resolve26(new Blob(body, { type: stream[kContentType] }));
17146
17146
  } else if (type === "bytes") {
17147
- resolve24(chunksConcat(body, length));
17147
+ resolve26(chunksConcat(body, length));
17148
17148
  }
17149
17149
  consumeFinish(consume2);
17150
17150
  } catch (err) {
@@ -17363,9 +17363,9 @@ var require_api_request = __commonJS({
17363
17363
  };
17364
17364
  function request2(opts, callback) {
17365
17365
  if (callback === void 0) {
17366
- return new Promise((resolve24, reject) => {
17366
+ return new Promise((resolve26, reject) => {
17367
17367
  request2.call(this, opts, (err, data) => {
17368
- return err ? reject(err) : resolve24(data);
17368
+ return err ? reject(err) : resolve26(data);
17369
17369
  });
17370
17370
  });
17371
17371
  }
@@ -17626,9 +17626,9 @@ var require_api_stream = __commonJS({
17626
17626
  };
17627
17627
  function stream(opts, factory, callback) {
17628
17628
  if (callback === void 0) {
17629
- return new Promise((resolve24, reject) => {
17629
+ return new Promise((resolve26, reject) => {
17630
17630
  stream.call(this, opts, factory, (err, data) => {
17631
- return err ? reject(err) : resolve24(data);
17631
+ return err ? reject(err) : resolve26(data);
17632
17632
  });
17633
17633
  });
17634
17634
  }
@@ -17928,9 +17928,9 @@ var require_api_upgrade = __commonJS({
17928
17928
  };
17929
17929
  function upgrade2(opts, callback) {
17930
17930
  if (callback === void 0) {
17931
- return new Promise((resolve24, reject) => {
17931
+ return new Promise((resolve26, reject) => {
17932
17932
  upgrade2.call(this, opts, (err, data) => {
17933
- return err ? reject(err) : resolve24(data);
17933
+ return err ? reject(err) : resolve26(data);
17934
17934
  });
17935
17935
  });
17936
17936
  }
@@ -18024,9 +18024,9 @@ var require_api_connect = __commonJS({
18024
18024
  };
18025
18025
  function connect8(opts, callback) {
18026
18026
  if (callback === void 0) {
18027
- return new Promise((resolve24, reject) => {
18027
+ return new Promise((resolve26, reject) => {
18028
18028
  connect8.call(this, opts, (err, data) => {
18029
- return err ? reject(err) : resolve24(data);
18029
+ return err ? reject(err) : resolve26(data);
18030
18030
  });
18031
18031
  });
18032
18032
  }
@@ -19486,8 +19486,8 @@ var require_snapshot_utils = __commonJS({
19486
19486
  var require_snapshot_recorder = __commonJS({
19487
19487
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
19488
19488
  "use strict";
19489
- var { writeFile: writeFile27, readFile: readFile49, mkdir: mkdir28 } = __require("node:fs/promises");
19490
- var { dirname: dirname30, resolve: resolve24 } = __require("node:path");
19489
+ var { writeFile: writeFile29, readFile: readFile49, mkdir: mkdir29 } = __require("node:fs/promises");
19490
+ var { dirname: dirname30, resolve: resolve26 } = __require("node:path");
19491
19491
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
19492
19492
  var { InvalidArgumentError, UndiciError } = require_errors();
19493
19493
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -19703,7 +19703,7 @@ var require_snapshot_recorder = __commonJS({
19703
19703
  throw new InvalidArgumentError("Snapshot path is required");
19704
19704
  }
19705
19705
  try {
19706
- const data = await readFile49(resolve24(path), "utf8");
19706
+ const data = await readFile49(resolve26(path), "utf8");
19707
19707
  const parsed = JSON.parse(data);
19708
19708
  if (Array.isArray(parsed)) {
19709
19709
  this.#snapshots.clear();
@@ -19732,13 +19732,13 @@ var require_snapshot_recorder = __commonJS({
19732
19732
  if (!path) {
19733
19733
  throw new InvalidArgumentError("Snapshot path is required");
19734
19734
  }
19735
- const resolvedPath = resolve24(path);
19736
- await mkdir28(dirname30(resolvedPath), { recursive: true });
19735
+ const resolvedPath = resolve26(path);
19736
+ await mkdir29(dirname30(resolvedPath), { recursive: true });
19737
19737
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
19738
19738
  hash: hash2,
19739
19739
  snapshot
19740
19740
  }));
19741
- await writeFile27(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
19741
+ await writeFile29(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
19742
19742
  }
19743
19743
  /**
19744
19744
  * Clears all recorded snapshots
@@ -27230,7 +27230,7 @@ var require_fetch = __commonJS({
27230
27230
  const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
27231
27231
  return dispatchWithProtocolPreference(body);
27232
27232
  function dispatchWithProtocolPreference(body2, allowH2) {
27233
- return new Promise((resolve24, reject) => agent3.dispatch(
27233
+ return new Promise((resolve26, reject) => agent3.dispatch(
27234
27234
  {
27235
27235
  path: hasTrailingQuestionMark ? `${path}?` : path,
27236
27236
  origin: url2.origin,
@@ -27313,7 +27313,7 @@ var require_fetch = __commonJS({
27313
27313
  }
27314
27314
  }
27315
27315
  const onError = (err) => this.onResponseError(controller, err);
27316
- resolve24({
27316
+ resolve26({
27317
27317
  status: status11,
27318
27318
  statusText,
27319
27319
  headersList,
@@ -27346,7 +27346,7 @@ var require_fetch = __commonJS({
27346
27346
  fetchParams.controller.off("terminated", this.abort);
27347
27347
  }
27348
27348
  if (request2.mode === "websocket" && allowH2 !== false && error63?.code === "UND_ERR_INFO" && error63?.message === "HTTP/2: Extended CONNECT protocol not supported by server") {
27349
- resolve24(dispatchWithProtocolPreference(body2, false));
27349
+ resolve26(dispatchWithProtocolPreference(body2, false));
27350
27350
  return;
27351
27351
  }
27352
27352
  this.body?.destroy(error63);
@@ -27360,7 +27360,7 @@ var require_fetch = __commonJS({
27360
27360
  const rawHeaders = controller?.rawHeaders ?? [];
27361
27361
  const headersList = new HeadersList();
27362
27362
  appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders);
27363
- resolve24({
27363
+ resolve26({
27364
27364
  status: status11,
27365
27365
  statusText: STATUS_CODES[status11],
27366
27366
  headersList,
@@ -32692,9 +32692,9 @@ function runRedacted({
32692
32692
  redact
32693
32693
  }) {
32694
32694
  const values = redact ?? Object.values(env);
32695
- return new Promise((resolve24, reject) => {
32696
- const [file3, ...args] = command;
32697
- const child = spawn(file3, args, {
32695
+ return new Promise((resolve26, reject) => {
32696
+ const [file4, ...args] = command;
32697
+ const child = spawn(file4, args, {
32698
32698
  env: { ...baseEnv, ...env },
32699
32699
  stdio: ["inherit", "pipe", "pipe"],
32700
32700
  ...cwd ? { cwd } : {},
@@ -32718,7 +32718,7 @@ function runRedacted({
32718
32718
  child.on("error", reject);
32719
32719
  child.on("close", (code, ended) => {
32720
32720
  signal?.removeEventListener("abort", killGroup);
32721
- void drained.then(() => resolve24(code ?? (ended ? 128 + signalNumber(ended) : 1)));
32721
+ void drained.then(() => resolve26(code ?? (ended ? 128 + signalNumber(ended) : 1)));
32722
32722
  });
32723
32723
  });
32724
32724
  }
@@ -36990,7 +36990,7 @@ function flagText({
36990
36990
  }
36991
36991
 
36992
36992
  // src/rules/cli-version.rules.ts
36993
- var STAMPED = "0.1.84";
36993
+ var STAMPED = "0.1.86";
36994
36994
  function cliVersionOf({ stamped = STAMPED } = {}) {
36995
36995
  return stamped.startsWith("__") ? "dev" : stamped;
36996
36996
  }
@@ -42040,7 +42040,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
42040
42040
  var NONE = 0;
42041
42041
  var ASSUMED = 1;
42042
42042
  var PROVEN = 2;
42043
- function isRecursive(inst, stack, resolve24) {
42043
+ function isRecursive(inst, stack, resolve26) {
42044
42044
  const cached2 = recursive.get(inst);
42045
42045
  if (cached2 !== void 0)
42046
42046
  return cached2 ? PROVEN : NONE;
@@ -42050,7 +42050,7 @@ function isRecursive(inst, stack, resolve24) {
42050
42050
  let result2 = NONE;
42051
42051
  const check3 = (child) => {
42052
42052
  if (result2 !== PROVEN && child?._zod) {
42053
- const answer6 = isRecursive(child, stack, resolve24);
42053
+ const answer6 = isRecursive(child, stack, resolve26);
42054
42054
  if (answer6 > result2)
42055
42055
  result2 = answer6;
42056
42056
  }
@@ -42061,7 +42061,7 @@ function isRecursive(inst, stack, resolve24) {
42061
42061
  const desc = Object.getOwnPropertyDescriptor(sh, key);
42062
42062
  if (spread && !desc.enumerable)
42063
42063
  continue;
42064
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve24) : NONE;
42064
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve26) : NONE;
42065
42065
  if (child > answer6)
42066
42066
  answer6 = child;
42067
42067
  }
@@ -42125,7 +42125,7 @@ function isRecursive(inst, stack, resolve24) {
42125
42125
  break;
42126
42126
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
42127
42127
  case "lazy": {
42128
- const inner = def._cachedInner ?? (resolve24 ? inst._zod.innerType : void 0);
42128
+ const inner = def._cachedInner ?? (resolve26 ? inst._zod.innerType : void 0);
42129
42129
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
42130
42130
  break;
42131
42131
  }
@@ -59493,6 +59493,18 @@ var setVaultAgentRuleInputSchemaDefinition = external_exports.object({
59493
59493
  reauthToken: external_exports.string().min(1).optional()
59494
59494
  });
59495
59495
  var setVaultAgentRuleInputSchema = setVaultAgentRuleInputSchemaDefinition;
59496
+ var setVaultAgentRulesInputSchemaDefinition = external_exports.object({
59497
+ workspaceId: external_exports.string().min(1),
59498
+ agentId: external_exports.string().min(1),
59499
+ rules: external_exports.array(
59500
+ external_exports.object({
59501
+ connectionId: external_exports.string().min(1),
59502
+ rule: external_exports.enum([...VAULT_AGENT_RULES, "default"])
59503
+ })
59504
+ ).min(1).max(4),
59505
+ /** One fresh passkey proof for the whole change, when any part needs one. */
59506
+ reauthToken: external_exports.string().min(1).optional()
59507
+ });
59496
59508
  var VaultAgentRulesDialogSlot = uiTokens("vault").component("agentRulesDialog");
59497
59509
 
59498
59510
  // ../../modules/vault/contract/src/vault-devices.ts
@@ -62231,7 +62243,9 @@ var conversationMirrorSchemaDefinition = external_exports.object({
62231
62243
  /** False keeps every agent out, as a channel shared with another workspace does by default. */
62232
62244
  agentsAllowed: external_exports.boolean().optional(),
62233
62245
  /** When the mirror ended: it stays readable and takes no new messages. */
62234
- endedAt: external_exports.iso.datetime().nullable().optional()
62246
+ endedAt: external_exports.iso.datetime().nullable().optional(),
62247
+ /** The name as the source writes it, such as a WhatsApp group's subject; absent shows `name`. */
62248
+ title: external_exports.string().max(120).optional()
62235
62249
  });
62236
62250
  var messageKindSchema = external_exports.enum(["message", "notice"]);
62237
62251
  var cardQuestionSchemaDefinition = external_exports.object({
@@ -62684,7 +62698,9 @@ var directoryEntrySchemaDefinition = external_exports.object({
62684
62698
  /** An agent that runs outside Laze: what it reads leaves Laze. False for people. */
62685
62699
  runsOutside: external_exports.boolean().default(false),
62686
62700
  /** Other names a person goes by, such as "Drew" or their Slack name; mentions match them. */
62687
- aliases: external_exports.array(external_exports.string()).optional()
62701
+ aliases: external_exports.array(external_exports.string()).optional(),
62702
+ /** A person invited and not joined yet, by their invitation's state; absent for members. */
62703
+ invited: external_exports.enum(["pending", "held", "expired"]).optional()
62688
62704
  });
62689
62705
  var chatOverviewSchemaDefinition = external_exports.object({
62690
62706
  viewer: chatActorSchemaDefinition,
@@ -63002,7 +63018,11 @@ var openMirrorInputSchemaDefinition = external_exports.object({
63002
63018
  /** A channel of this workspace the mirror attaches to; pass its name and visibility to keep. */
63003
63019
  channelId: idSchema4.optional(),
63004
63020
  /** False keeps every agent out from the start; absent keeps what the mirror had. */
63005
- agentsAllowed: external_exports.boolean().optional()
63021
+ agentsAllowed: external_exports.boolean().optional(),
63022
+ /** The name as the source writes it, shown in place of the channel's handle; absent keeps it. */
63023
+ title: external_exports.string().trim().min(1).max(120).optional(),
63024
+ /** True only brings a live mirror in line: a closed one stays closed and none is opened. */
63025
+ refreshOnly: external_exports.boolean().default(false)
63006
63026
  });
63007
63027
  var postMirroredInputSchemaDefinition = external_exports.object({
63008
63028
  workspaceId: workspaceIdSchema,
@@ -63048,7 +63068,9 @@ var updateMirroredInputSchemaDefinition = external_exports.object({
63048
63068
  /** Laze read the source's message again, which is not an edit: no edited mark. */
63049
63069
  rerendered: external_exports.boolean().default(false),
63050
63070
  /** The source says the message was never edited: an edited mark Laze gave it comes off. */
63051
- neverEdited: external_exports.boolean().default(false)
63071
+ neverEdited: external_exports.boolean().default(false),
63072
+ /** Files the mirror stored since, attached when the message has none yet. */
63073
+ fileIds: external_exports.array(idSchema4).max(10).default([])
63052
63074
  });
63053
63075
  var removeMirroredLinksInputSchemaDefinition = external_exports.object({
63054
63076
  workspaceId: workspaceIdSchema,
@@ -63116,7 +63138,10 @@ var syncMirrorReadInputSchemaDefinition = external_exports.object({
63116
63138
  workspaceId: workspaceIdSchema,
63117
63139
  channelId: idSchema4,
63118
63140
  userId: idSchema4,
63119
- readTo: external_exports.iso.datetime()
63141
+ readTo: external_exports.iso.datetime(),
63142
+ unread: external_exports.number().int().positive().max(1e6).optional(),
63143
+ /** The source and Laze keep marks in step: a read there also ends a mark unread set in Laze. */
63144
+ releasesHold: external_exports.boolean().optional()
63120
63145
  });
63121
63146
  var mirroredReadToInputSchemaDefinition = external_exports.object({
63122
63147
  workspaceId: workspaceIdSchema,
@@ -63999,7 +64024,7 @@ var mirrorNotifyLevelSchema = external_exports.enum(["everywhere", "desktop", "o
63999
64024
  var mirrorNotifySchemaDefinition = external_exports.object({
64000
64025
  slack: mirrorNotifyLevelSchema.default("everywhere"),
64001
64026
  discord: mirrorNotifyLevelSchema.default("everywhere"),
64002
- whatsapp: mirrorNotifyLevelSchema.default("desktop")
64027
+ whatsapp: mirrorNotifyLevelSchema.default("everywhere")
64003
64028
  });
64004
64029
  var notificationSettingsSchemaDefinition = external_exports.object({
64005
64030
  channelDefault: channelDefaultSchema,
@@ -64278,7 +64303,9 @@ var desktopTextReviewRequestedPayloadSchemaDefinition = external_exports.object(
64278
64303
  workspaceId: external_exports.string().min(1),
64279
64304
  userId: external_exports.string().min(1),
64280
64305
  requestId: external_exports.string().min(1),
64281
- at: external_exports.iso.datetime()
64306
+ at: external_exports.iso.datetime(),
64307
+ /** The notice tags (`<channel id>:<message id>`) that changed; absent, every fact is checked. */
64308
+ tags: external_exports.array(external_exports.string().min(1)).optional()
64282
64309
  });
64283
64310
  var notificationsPausedPayloadSchemaDefinition = external_exports.object({
64284
64311
  workspaceId: external_exports.string().min(1),
@@ -64777,7 +64804,13 @@ var agentAccessSchemaDefinition = external_exports.object({
64777
64804
  kind: external_exports.enum(["personal", "team"]),
64778
64805
  ownerUserId: idSchema5,
64779
64806
  people: external_exports.array(
64780
- external_exports.object({ userId: idSchema5, grantedByUserId: idSchema5, grantedAt: external_exports.iso.datetime() })
64807
+ external_exports.object({
64808
+ userId: idSchema5,
64809
+ grantedByUserId: idSchema5,
64810
+ grantedAt: external_exports.iso.datetime(),
64811
+ /** The address of a person invited and not joined yet, who is named by it. */
64812
+ invitedEmail: external_exports.string().optional()
64813
+ })
64781
64814
  ),
64782
64815
  channels: external_exports.array(
64783
64816
  external_exports.object({ id: idSchema5, name: external_exports.string(), kind: external_exports.enum(["public", "private"]) })
@@ -66759,6 +66792,11 @@ var connectorCategorySchema = external_exports.enum([
66759
66792
  "Projects and code"
66760
66793
  ]);
66761
66794
  var TWO_DAYS = 2 * 86400;
66795
+ var GMAIL_MODIFY_SCOPE = "https://www.googleapis.com/auth/gmail.modify";
66796
+ var GMAIL_TRASH_PATHS = [
66797
+ "/gmail/v1/users/*/threads/*/trash",
66798
+ "/gmail/v1/users/*/messages/*/trash"
66799
+ ];
66762
66800
  var GOOGLE = {
66763
66801
  family: "google",
66764
66802
  authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth",
@@ -66780,22 +66818,18 @@ var CONNECTOR_PROVIDERS = [
66780
66818
  id: "gmail",
66781
66819
  label: "Gmail",
66782
66820
  category: "Email and calendar",
66783
- description: "Search and read mail and write drafts. Sending asks you, with the draft to send.",
66784
- scopes: [
66785
- "openid",
66786
- "email",
66787
- "https://www.googleapis.com/auth/gmail.readonly",
66788
- "https://www.googleapis.com/auth/gmail.compose"
66789
- ],
66821
+ description: "Search, read, archive and label mail and write drafts. Sending, trash and unsubscribing ask you first.",
66822
+ // gmail.modify covers reading, drafts and sending as well as labels, archive and trash.
66823
+ scopes: ["openid", "email", GMAIL_MODIFY_SCOPE],
66790
66824
  sensitivity: "auto",
66791
66825
  maxLeaseSeconds: TWO_DAYS,
66792
66826
  egress: {
66793
66827
  upstream: "https://gmail.googleapis.com",
66794
66828
  header: "Authorization",
66795
66829
  prefix: "Bearer ",
66796
- askPaths: VAULT_GMAIL_SEND_PATHS
66830
+ askPaths: [...VAULT_GMAIL_SEND_PATHS, ...GMAIL_TRASH_PATHS]
66797
66831
  },
66798
- rules: "Read mail and write drafts freely; send only what the requester asked to send."
66832
+ rules: "Read, label and archive mail and write drafts freely; send, trash or unsubscribe only when the requester asked for it."
66799
66833
  },
66800
66834
  {
66801
66835
  ...GOOGLE,
@@ -68406,7 +68440,7 @@ var setWorkspaceDefaultAgentAsCallerInputSchemaDefinition = external_exports.obj
68406
68440
  // ../../modules/agent/contract/src/agent.ts
68407
68441
  var AGENT_LINK_TTL_SECONDS = 30 * 60;
68408
68442
  var AGENT_JOIN_REQUEST_TTL_SECONDS = 24 * 60 * 60;
68409
- var AGENT_ONLINE_WINDOW_SECONDS = 5 * 60;
68443
+ var AGENT_ONLINE_WINDOW_SECONDS = 2 * 60;
68410
68444
  var INBOX_WAIT_MAX_SECONDS = 55;
68411
68445
  var workspaceIdSchema14 = external_exports.string().min(1);
68412
68446
  var idSchema17 = external_exports.string().min(1).max(80);
@@ -69533,7 +69567,9 @@ var callerWorkspaceInviteSchemaDefinition = external_exports.object({
69533
69567
  role: roleSchema,
69534
69568
  status: external_exports.enum(["pending", "held"]).optional(),
69535
69569
  expiresAt: external_exports.iso.datetime(),
69536
- createdAt: external_exports.iso.datetime()
69570
+ createdAt: external_exports.iso.datetime(),
69571
+ /** The invited person, who can be given agents, apps and channels before they join. */
69572
+ personId: external_exports.string().optional()
69537
69573
  });
69538
69574
  var callerInviteLinkSchemaDefinition = external_exports.object({
69539
69575
  inviteId: external_exports.string().min(1),
@@ -70368,7 +70404,7 @@ async function copyAgent({
70368
70404
 
70369
70405
  // src/services/agent-commands.service.ts
70370
70406
  import { mkdir as mkdir17, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
70371
- import { join as join17, resolve as resolve5 } from "node:path";
70407
+ import { join as join18, resolve as resolve5 } from "node:path";
70372
70408
 
70373
70409
  // src/rules/agent-profile.rules.ts
70374
70410
  var HARNESS_NAMES = {
@@ -71900,10 +71936,10 @@ async function liveElsewhere({
71900
71936
  }) {
71901
71937
  if (await rushKeeps({ context, key, claudePid, asleepCounts })) return true;
71902
71938
  const folder = dirname4(statePathOf({ context, kind: "sessions", profile: "x" }));
71903
- for (const file3 of await readdir(folder).catch(() => [])) {
71904
- const pid = Number(file3.replace(/\.json$/, ""));
71939
+ for (const file4 of await readdir(folder).catch(() => [])) {
71940
+ const pid = Number(file4.replace(/\.json$/, ""));
71905
71941
  if (!pid || pid === claudePid || !context.processes.alive(pid)) continue;
71906
- const noted = await readFile5(join3(folder, file3), "utf8").then(
71942
+ const noted = await readFile5(join3(folder, file4), "utf8").then(
71907
71943
  (text3) => JSON.parse(text3),
71908
71944
  () => void 0
71909
71945
  );
@@ -71954,8 +71990,8 @@ async function runsInSubagent({ context, command }) {
71954
71990
  const folder = join3(dirname4(path), sessionId, "subagents");
71955
71991
  const files2 = await readdir(folder).catch(() => []);
71956
71992
  const subagents = await Promise.all(
71957
- files2.filter((file3) => file3.endsWith(".jsonl")).map(
71958
- async (file3) => lastCallAtOf({ text: await tailOf({ path: join3(folder, file3) }), command })
71993
+ files2.filter((file4) => file4.endsWith(".jsonl")).map(
71994
+ async (file4) => lastCallAtOf({ text: await tailOf({ path: join3(folder, file4) }), command })
71959
71995
  )
71960
71996
  );
71961
71997
  const session = lastCallAtOf({ text: await tailOf({ path }), command });
@@ -72252,17 +72288,17 @@ async function sendParts({
72252
72288
  async function uploadFile({
72253
72289
  context,
72254
72290
  client,
72255
- file: file3
72291
+ file: file4
72256
72292
  }) {
72257
72293
  const ticket = await client.post(CHAT_KEY_PATHS.startUpload, {
72258
- channel: file3.channel,
72259
- fileName: file3.fileName,
72260
- contentType: file3.contentType,
72261
- sizeBytes: file3.bytes.byteLength
72294
+ channel: file4.channel,
72295
+ fileName: file4.fileName,
72296
+ contentType: file4.contentType,
72297
+ sizeBytes: file4.bytes.byteLength
72262
72298
  });
72263
72299
  const attachmentId = ticket.attachment.id;
72264
72300
  try {
72265
- const parts = await sendParts({ context, ticket, bytes: file3.bytes });
72301
+ const parts = await sendParts({ context, ticket, bytes: file4.bytes });
72266
72302
  return await client.post(CHAT_KEY_PATHS.completeUpload, { attachmentId, parts });
72267
72303
  } catch (cause) {
72268
72304
  await client.post(CHAT_KEY_PATHS.abortUpload, { attachmentId }).catch(() => void 0);
@@ -72295,13 +72331,13 @@ async function readyOf({ context, source }) {
72295
72331
  if (marked) return { kind: "id", id: marked };
72296
72332
  throw new CliUsageError(`${value} is not a file here, a URL or an uploaded file id`);
72297
72333
  }
72298
- function asBytes({ source, file: file3 }) {
72299
- if (source.image && !file3.contentType.startsWith("image/")) {
72334
+ function asBytes({ source, file: file4 }) {
72335
+ if (source.image && !file4.contentType.startsWith("image/")) {
72300
72336
  throw new CliUsageError(
72301
- `--image ${source.value} is not an image (${file3.contentType}); send it with --file`
72337
+ `--image ${source.value} is not an image (${file4.contentType}); send it with --file`
72302
72338
  );
72303
72339
  }
72304
- return { kind: "bytes", file: file3 };
72340
+ return { kind: "bytes", file: file4 };
72305
72341
  }
72306
72342
  async function downloaded({ context, url: url2 }) {
72307
72343
  const response = await context.fetcher(url2);
@@ -73085,10 +73121,10 @@ async function codexRolloutPathOf({
73085
73121
  }) {
73086
73122
  const root = join6(codexHome, "sessions");
73087
73123
  const files2 = await readdir2(root, { recursive: true }).catch(() => []);
73088
- const file3 = files2.find(
73124
+ const file4 = files2.find(
73089
73125
  (name3) => basename4(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
73090
73126
  );
73091
- return file3 ? join6(root, file3) : void 0;
73127
+ return file4 ? join6(root, file4) : void 0;
73092
73128
  }
73093
73129
  function rolloutPathOf({ delivery }) {
73094
73130
  return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
@@ -74168,10 +74204,10 @@ async function notesOf({ context }) {
74168
74204
  const folder = dirname9(statePathOf({ context, kind: "sessions", profile: "x" }));
74169
74205
  const files2 = await readdir3(folder).catch(() => []);
74170
74206
  const notes = await Promise.all(
74171
- files2.map(async (file3) => {
74172
- const pid = Number(file3.replace(/\.json$/, ""));
74173
- const note = await jsonOf(join10(folder, file3));
74174
- const at = await stat3(join10(folder, file3)).then(
74207
+ files2.map(async (file4) => {
74208
+ const pid = Number(file4.replace(/\.json$/, ""));
74209
+ const note = await jsonOf(join10(folder, file4));
74210
+ const at = await stat3(join10(folder, file4)).then(
74175
74211
  (info) => info.mtimeMs,
74176
74212
  () => 0
74177
74213
  );
@@ -74383,9 +74419,9 @@ var REFRESH_MS = 3e4;
74383
74419
  var MAX_RETRY_SECONDS3 = 60;
74384
74420
  var CLI_CHANGED_EXIT = 75;
74385
74421
  async function cliStampOf({ context }) {
74386
- const file3 = context.program.at(-1);
74387
- if (!file3) return "";
74388
- return stat4(file3).then(
74422
+ const file4 = context.program.at(-1);
74423
+ if (!file4) return "";
74424
+ return stat4(file4).then(
74389
74425
  (info) => `${info.mtimeMs}:${info.size}`,
74390
74426
  () => ""
74391
74427
  );
@@ -74691,26 +74727,26 @@ async function installSystemd({ context }) {
74691
74727
  const name3 = serviceNameOf({ context });
74692
74728
  const env = context.environment.inherited;
74693
74729
  const base = env.XDG_CONFIG_HOME || join13(homeOf({ context }), ".config");
74694
- const file3 = join13(base, "systemd", "user", `${name3}.service`);
74695
- await mkdir11(dirname12(file3), { recursive: true });
74730
+ const file4 = join13(base, "systemd", "user", `${name3}.service`);
74731
+ await mkdir11(dirname12(file4), { recursive: true });
74696
74732
  await writeFile10(
74697
- file3,
74733
+ file4,
74698
74734
  systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
74699
74735
  );
74700
74736
  const systemctl = (...words) => run({ context, command: ["systemctl", "--user", ...words] });
74701
74737
  const started = await systemctl("daemon-reload") && await systemctl("enable", `${name3}.service`) && await systemctl("restart", `${name3}.service`);
74702
74738
  if (!started)
74703
74739
  throw new CliUsageError(`systemd did not start ${name3}.service; see the lines above.`);
74704
- return { manager: "systemd", name: name3, file: file3, log: `journalctl --user -u ${name3}` };
74740
+ return { manager: "systemd", name: name3, file: file4, log: `journalctl --user -u ${name3}` };
74705
74741
  }
74706
74742
  async function installLaunchd({ context }) {
74707
74743
  const name3 = serviceNameOf({ context });
74708
74744
  const label3 = `ai.laze.${name3}`;
74709
- const file3 = join13(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
74745
+ const file4 = join13(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
74710
74746
  const log = logPathOf({ context });
74711
- await mkdir11(dirname12(file3), { recursive: true });
74747
+ await mkdir11(dirname12(file4), { recursive: true });
74712
74748
  await writeFile10(
74713
- file3,
74749
+ file4,
74714
74750
  launchAgentOf({
74715
74751
  label: label3,
74716
74752
  argv: runArgvOf({ context }),
@@ -74721,10 +74757,10 @@ async function installLaunchd({ context }) {
74721
74757
  await quietly({ context, script: `launchctl bootout gui/$(id -u)/${label3}` });
74722
74758
  const started = await run({
74723
74759
  context,
74724
- command: ["sh", "-c", `launchctl bootstrap gui/$(id -u) '${file3.replaceAll("'", "'\\''")}'`]
74760
+ command: ["sh", "-c", `launchctl bootstrap gui/$(id -u) '${file4.replaceAll("'", "'\\''")}'`]
74725
74761
  });
74726
74762
  if (!started) throw new CliUsageError(`launchd did not start ${label3}; see the lines above.`);
74727
- return { manager: "launchd", name: label3, file: file3, log };
74763
+ return { manager: "launchd", name: label3, file: file4, log };
74728
74764
  }
74729
74765
  async function installDetached({ context }) {
74730
74766
  const log = logPathOf({ context });
@@ -75184,8 +75220,8 @@ var CodexAppServer = class _CodexAppServer {
75184
75220
  }
75185
75221
  async call(method, params) {
75186
75222
  const id4 = ++this.#nextId;
75187
- const reply2 = await new Promise((resolve24) => {
75188
- this.#pending.set(id4, resolve24);
75223
+ const reply2 = await new Promise((resolve26) => {
75224
+ this.#pending.set(id4, resolve26);
75189
75225
  this.write({ id: id4, method, params });
75190
75226
  });
75191
75227
  if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
@@ -75197,12 +75233,12 @@ var CodexAppServer = class _CodexAppServer {
75197
75233
  /** Starts one turn; `done` settles when it completes, keeping its last agent message. */
75198
75234
  async startTurn({ threadId, text: text3 }) {
75199
75235
  const result2 = { answer: "" };
75200
- const done = new Promise((resolve24) => {
75236
+ const done = new Promise((resolve26) => {
75201
75237
  const listen = (message2) => {
75202
75238
  absorbTurnEvent({ result: result2, message: message2 });
75203
75239
  if (message2.method !== "turn/completed") return;
75204
75240
  this.#listeners.delete(listen);
75205
- resolve24(result2);
75241
+ resolve26(result2);
75206
75242
  };
75207
75243
  this.#listeners.add(listen);
75208
75244
  });
@@ -75247,9 +75283,9 @@ var CodexAppServer = class _CodexAppServer {
75247
75283
  async function newestThreadId({ codexHome }) {
75248
75284
  const root = join14(codexHome, "sessions");
75249
75285
  const files2 = await readdir4(root, { recursive: true }).catch(() => []);
75250
- const rollouts = files2.filter((file3) => /rollout-.*\.jsonl$/.test(file3));
75286
+ const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
75251
75287
  const dated = await Promise.all(
75252
- rollouts.map(async (file3) => ({ file: file3, at: (await stat5(join14(root, file3))).mtimeMs }))
75288
+ rollouts.map(async (file4) => ({ file: file4, at: (await stat5(join14(root, file4))).mtimeMs }))
75253
75289
  );
75254
75290
  const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
75255
75291
  const id4 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
@@ -75520,11 +75556,11 @@ async function newestThreadIn({
75520
75556
  }) {
75521
75557
  const root = join15(codexHome, "sessions");
75522
75558
  const files2 = await readdir5(root, { recursive: true }).catch(() => []);
75523
- const rollouts = files2.filter((file3) => /rollout-.*\.jsonl$/.test(file3));
75559
+ const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
75524
75560
  const dated = await Promise.all(
75525
- rollouts.map(async (file3) => ({
75526
- path: join15(root, file3),
75527
- at: await stat6(join15(root, file3)).then(
75561
+ rollouts.map(async (file4) => ({
75562
+ path: join15(root, file4),
75563
+ at: await stat6(join15(root, file4)).then(
75528
75564
  (info) => info.mtimeMs,
75529
75565
  () => 0
75530
75566
  )
@@ -75594,23 +75630,32 @@ async function linkCodexSession({
75594
75630
  }
75595
75631
 
75596
75632
  // src/services/laze-plugin.service.ts
75597
- import { mkdir as mkdir14, readFile as readFile16, writeFile as writeFile13 } from "node:fs/promises";
75633
+ import { mkdir as mkdir14, readFile as readFile16, rm as rm7, writeFile as writeFile13 } from "node:fs/promises";
75598
75634
  import { homedir as homedir4 } from "node:os";
75599
- import { dirname as dirname15, join as join16 } from "node:path";
75635
+ import { dirname as dirname15, join as join17 } from "node:path";
75600
75636
 
75601
75637
  // src/rules/laze-plugin.rules.ts
75638
+ import { createHash as createHash3 } from "node:crypto";
75639
+ import { join as join16 } from "node:path";
75602
75640
  var LAZE_PLUGIN = "laze";
75641
+ function pluginNameOf({ configPath, home }) {
75642
+ if (configPath === join16(home, ".laze", "config.json")) return LAZE_PLUGIN;
75643
+ return `${LAZE_PLUGIN}-${createHash3("sha256").update(configPath).digest("hex").slice(0, 8)}`;
75644
+ }
75603
75645
  var NPX_CLI = ["npx", "-y", "@lazehq/cli@latest"];
75604
75646
  var quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
75647
+ var GONE = { hook: "exit 0", monitor: "exec tail -f /dev/null" };
75605
75648
  function cliLineOf({
75606
75649
  program,
75607
75650
  args,
75608
- configPath
75651
+ configPath,
75652
+ kind: kind2 = "hook"
75609
75653
  }) {
75610
75654
  const here = [...program, ...args].map(quote).join(" ");
75611
75655
  const fallback = [...NPX_CLI, ...args].join(" ");
75612
75656
  const run4 = `if [ -e ${quote(program.at(-1) ?? "")} ]; then exec ${here}; else exec ${fallback}; fi`;
75613
- return `export LAZE_CLI_CONFIG=${quote(configPath)}; ${run4}`;
75657
+ const config2 = quote(configPath);
75658
+ return `if [ ! -e ${config2} ]; then ${GONE[kind2]}; fi; export LAZE_CLI_CONFIG=${config2}; ${run4}`;
75614
75659
  }
75615
75660
  var SKILL = `---
75616
75661
  name: laze
@@ -75672,13 +75717,26 @@ When something needs a person to decide or act, post a card in their feed:
75672
75717
  \`laze feed post "<title>" --summary "<why>" --action "<label>=<what to do>"\`. Run
75673
75718
  \`laze feed post\` with no title for every flag and how to write a card.
75674
75719
 
75675
- When you prepare a message for a person to send (email, Slack, LinkedIn), post a feed card with
75676
- the full text in \`--draft\`, the recipients and subject in
75677
- \`--draft-header "To: ...\\nCc: ...\\nSubject: ..."\`, an action to send it
75678
- (\`--action "Send it=<what to do>"\`) and a \`--link\` to the exact draft
75679
- (\`"Open draft in Gmail=https://mail.google.com/mail/u/0/#drafts?compose=<draft message id>"\`,
75680
- not the drafts folder). Never leave it only in Gmail drafts. If they edit the text on the card,
75681
- the press brings you the edited text: update the native draft with it first, then send.
75720
+ Anything that goes to people outside this conversation (an email, a Slack, WhatsApp or LinkedIn
75721
+ message to someone else, a post) is a draft for your person first, on a feed card: a one-line ask
75722
+ as the title, the full text in \`--draft\`, the recipients and subject in
75723
+ \`--draft-header "To: ...\\nCc: ...\\nSubject: ..."\`, \`--action "Send it=<what to do>"\` and a
75724
+ \`--link\` that opens the original in its own app: for Gmail
75725
+ \`"Open thread with the draft=https://mail.google.com/mail/u/0/#all/<thread id>"\`, else the Slack,
75726
+ WhatsApp or LinkedIn thread or the GitHub PR. For example:
75727
+
75728
+ \`\`\`bash
75729
+ laze feed post "Reply to Dana about the renewal" --summary "She asked for the price by Friday" \\
75730
+ --draft @reply.md --draft-header "To: dana@acme.test\\nSubject: Re: Renewal" \\
75731
+ --link "Open thread with the draft=https://mail.google.com/mail/u/0/#all/<thread id>" \\
75732
+ --action "Send it=Send this reply"
75733
+ \`\`\`
75734
+
75735
+ They edit and send it from the card. Send such a message only when they pressed Send on its card
75736
+ or told you in chat to send that exact message ("send it", "manda"): a send approval card is not
75737
+ their review, so post the feed card first. After a send, say in one line what went to whom.
75738
+ Never leave a draft only in Gmail drafts. If they edit the text on the card, the press brings you
75739
+ the edited text: update the native draft with it first, then send.
75682
75740
 
75683
75741
  A card you post or update while answering is linked under your reply: don't describe where the
75684
75742
  card is, say what changed.
@@ -75761,6 +75819,7 @@ function pluginHooksOf({ line }) {
75761
75819
  };
75762
75820
  }
75763
75821
  function lazePluginFiles({
75822
+ name: name3 = LAZE_PLUGIN,
75764
75823
  program,
75765
75824
  version: version2,
75766
75825
  configPath
@@ -75772,13 +75831,13 @@ function lazePluginFiles({
75772
75831
  const author = { name: "Laze", url: "https://laze.so" };
75773
75832
  return {
75774
75833
  ".claude-plugin/marketplace.json": json7({
75775
- name: LAZE_PLUGIN,
75834
+ name: name3,
75776
75835
  owner: author,
75777
- plugins: [{ name: LAZE_PLUGIN, source: `./${LAZE_PLUGIN}`, description }]
75836
+ plugins: [{ name: name3, source: `./${LAZE_PLUGIN}`, description }]
75778
75837
  }),
75779
75838
  "laze/plugin.json": json7({
75780
75839
  $schema: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
75781
- name: LAZE_PLUGIN,
75840
+ name: name3,
75782
75841
  version: version2,
75783
75842
  description,
75784
75843
  author,
@@ -75792,7 +75851,7 @@ function lazePluginFiles({
75792
75851
  command: [...NPX_CLI, "hook", "monitor"]
75793
75852
  }),
75794
75853
  "laze/.claude-plugin/plugin.json": json7({
75795
- name: LAZE_PLUGIN,
75854
+ name: name3,
75796
75855
  version: version2,
75797
75856
  description,
75798
75857
  author
@@ -75800,7 +75859,7 @@ function lazePluginFiles({
75800
75859
  "laze/monitors/monitors.json": json7([
75801
75860
  {
75802
75861
  name: "laze-messages",
75803
- command: line(["hook", "monitor"]),
75862
+ command: cliLineOf({ program, args: ["hook", "monitor"], configPath, kind: "monitor" }),
75804
75863
  description: "Laze messages for this session"
75805
75864
  }
75806
75865
  ]),
@@ -75811,11 +75870,21 @@ function lazePluginFiles({
75811
75870
  // src/services/laze-plugin.service.ts
75812
75871
  var REGISTER_LIMIT_MS = 6e4;
75813
75872
  var quote2 = (value) => `'${value.replaceAll("'", "'\\''")}'`;
75873
+ function homeOf2({ context }) {
75874
+ return context.environment.inherited.HOME || homedir4();
75875
+ }
75876
+ function pluginNameHere({ context }) {
75877
+ return pluginNameOf({ configPath: context.environment.configPath, home: homeOf2({ context }) });
75878
+ }
75879
+ function installedNameOf({ context }) {
75880
+ const name3 = pluginNameHere({ context });
75881
+ return `${name3}@${name3}`;
75882
+ }
75814
75883
  function pluginFolderOf({ context }) {
75815
- return join16(dirname15(context.environment.configPath), "plugins");
75884
+ return join17(dirname15(context.environment.configPath), "plugins");
75816
75885
  }
75817
75886
  async function pluginIsCurrent({ context }) {
75818
- const manifest = join16(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
75887
+ const manifest = join17(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
75819
75888
  const written = await readFile16(manifest, "utf8").then(
75820
75889
  (text3) => JSON.parse(text3).version,
75821
75890
  () => void 0
@@ -75825,12 +75894,13 @@ async function pluginIsCurrent({ context }) {
75825
75894
  async function writeLazePlugin({ context }) {
75826
75895
  const folder = pluginFolderOf({ context });
75827
75896
  const files2 = lazePluginFiles({
75897
+ name: pluginNameHere({ context }),
75828
75898
  program: context.program,
75829
75899
  version: cliVersionOf(),
75830
75900
  configPath: context.environment.configPath
75831
75901
  });
75832
75902
  for (const [path, text3] of Object.entries(files2)) {
75833
- const target = join16(folder, path);
75903
+ const target = join17(folder, path);
75834
75904
  await mkdir14(dirname15(target), { recursive: true });
75835
75905
  await writeFile13(target, text3);
75836
75906
  }
@@ -75849,34 +75919,53 @@ async function claudeScript({ context, script }) {
75849
75919
  }
75850
75920
  var QUIET = ">/dev/null 2>&1 </dev/null";
75851
75921
  async function registerWithClaude({ context, folder }) {
75922
+ const name3 = pluginNameHere({ context });
75923
+ const plugin2 = installedNameOf({ context });
75852
75924
  const script = [
75853
75925
  `claude plugin marketplace add ${quote2(folder)} --scope user ${QUIET}`,
75854
- `claude plugin marketplace update ${LAZE_PLUGIN} ${QUIET}`,
75926
+ `claude plugin marketplace update ${name3} ${QUIET}`,
75855
75927
  // install is a no-op for a plugin Claude Code already has; update refreshes its cached copy.
75856
- `{ claude plugin install ${LAZE_PLUGIN}@${LAZE_PLUGIN} --scope user ${QUIET} || true; }`,
75857
- `claude plugin update ${LAZE_PLUGIN}@${LAZE_PLUGIN} ${QUIET}`
75928
+ `{ claude plugin install ${plugin2} --scope user ${QUIET} || true; }`,
75929
+ `claude plugin update ${plugin2} ${QUIET}`
75930
+ ].join("; ");
75931
+ return claudeScript({ context, script });
75932
+ }
75933
+ function claudeDirOf({ context }) {
75934
+ return context.environment.inherited.CLAUDE_CONFIG_DIR || join17(homeOf2({ context }), ".claude");
75935
+ }
75936
+ function unregisterAs({ context, name: name3 }) {
75937
+ const script = [
75938
+ `claude plugin uninstall ${name3}@${name3} --scope user ${QUIET}`,
75939
+ `claude plugin marketplace remove ${name3} ${QUIET}`
75858
75940
  ].join("; ");
75859
75941
  return claudeScript({ context, script });
75860
75942
  }
75943
+ async function dropOwnLeftover({ context, folder }) {
75944
+ if (pluginNameHere({ context }) === LAZE_PLUGIN) return;
75945
+ const known = await readFile16(
75946
+ join17(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
75947
+ "utf8"
75948
+ ).then((text3) => JSON.parse(text3)).catch(() => void 0);
75949
+ if (known?.[LAZE_PLUGIN]?.source?.path !== folder) return;
75950
+ await unregisterAs({ context, name: LAZE_PLUGIN });
75951
+ }
75861
75952
  var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
75862
75953
  async function cachedPluginOf({ context }) {
75863
- const inherited = context.environment.inherited;
75864
- const home = inherited.HOME || homedir4();
75865
- const claude = inherited.CLAUDE_CONFIG_DIR || join16(home, ".claude");
75866
- const listed = await readFile16(join16(claude, "plugins", "installed_plugins.json"), "utf8").then(
75954
+ const path = join17(claudeDirOf({ context }), "plugins", "installed_plugins.json");
75955
+ const listed = await readFile16(path, "utf8").then(
75867
75956
  (text3) => JSON.parse(text3),
75868
75957
  () => void 0
75869
75958
  );
75870
- return listed?.plugins?.[`${LAZE_PLUGIN}@${LAZE_PLUGIN}`]?.[0]?.installPath;
75959
+ return listed?.plugins?.[installedNameOf({ context })]?.[0]?.installPath;
75871
75960
  }
75872
75961
  async function refreshStaleCache({ context, folder }) {
75873
75962
  const cached2 = await cachedPluginOf({ context });
75874
75963
  if (!cached2) return true;
75875
75964
  const read4 = (path) => readFile16(path, "utf8").catch(() => "");
75876
- for (const file3 of RUN_FILES) {
75877
- const ours = await read4(join16(folder, LAZE_PLUGIN, file3));
75878
- if (ours === await read4(join16(cached2, file3))) continue;
75879
- const plugin2 = `${LAZE_PLUGIN}@${LAZE_PLUGIN}`;
75965
+ for (const file4 of RUN_FILES) {
75966
+ const ours = await read4(join17(folder, LAZE_PLUGIN, file4));
75967
+ if (ours === await read4(join17(cached2, file4))) continue;
75968
+ const plugin2 = installedNameOf({ context });
75880
75969
  const script = [
75881
75970
  `claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
75882
75971
  `claude plugin install ${plugin2} --scope user ${QUIET}`
@@ -75886,7 +75975,7 @@ async function refreshStaleCache({ context, folder }) {
75886
75975
  return true;
75887
75976
  }
75888
75977
  function registeredMarkOf({ context }) {
75889
- return join16(pluginFolderOf({ context }), "registered");
75978
+ return join17(pluginFolderOf({ context }), "registered");
75890
75979
  }
75891
75980
  async function pluginRegistered({ context }) {
75892
75981
  return readFile16(registeredMarkOf({ context }), "utf8").then(
@@ -75896,6 +75985,7 @@ async function pluginRegistered({ context }) {
75896
75985
  }
75897
75986
  async function installLazePlugin({ context }) {
75898
75987
  const folder = await writeLazePlugin({ context });
75988
+ await dropOwnLeftover({ context, folder });
75899
75989
  const registered = await registerWithClaude({ context, folder }) && await refreshStaleCache({ context, folder });
75900
75990
  if (registered) await writeFile13(registeredMarkOf({ context }), cliVersionOf());
75901
75991
  return { folder, registered };
@@ -75903,25 +75993,36 @@ async function installLazePlugin({ context }) {
75903
75993
  async function plugin({ context, args }) {
75904
75994
  const action = args.words[1] ?? "install";
75905
75995
  if (action === "path") {
75906
- context.out(`${join16(pluginFolderOf({ context }), LAZE_PLUGIN)}
75996
+ context.out(`${join17(pluginFolderOf({ context }), LAZE_PLUGIN)}
75907
75997
  `);
75908
75998
  return 0;
75909
75999
  }
76000
+ if (action === "uninstall") {
76001
+ const name3 = pluginNameHere({ context });
76002
+ const removed = await unregisterAs({ context, name: name3 });
76003
+ await rm7(registeredMarkOf({ context }), { force: true });
76004
+ context.out(
76005
+ removed ? `Removed the Laze plugin ${name3}@${name3} from Claude Code.
76006
+ ` : `Claude Code did not remove it; run: claude plugin uninstall ${name3}@${name3} && claude plugin marketplace remove ${name3}
76007
+ `
76008
+ );
76009
+ return removed ? 0 : 1;
76010
+ }
75910
76011
  if (action !== "install") {
75911
- context.err("Usage: laze plugin install | laze plugin path\n");
76012
+ context.err("Usage: laze plugin install | laze plugin uninstall | laze plugin path\n");
75912
76013
  return 1;
75913
76014
  }
75914
76015
  const { folder, registered } = await installLazePlugin({ context });
75915
76016
  context.out(
75916
76017
  registered ? `Installed the Laze plugin from ${folder} in Claude Code. It starts with your next session or resume.
75917
- ` : `Wrote the Laze plugin to ${folder}. Claude Code did not take it; run: claude plugin marketplace add ${folder} && claude plugin install ${LAZE_PLUGIN}@${LAZE_PLUGIN}
76018
+ ` : `Wrote the Laze plugin to ${folder}. Claude Code did not take it; run: claude plugin marketplace add ${folder} && claude plugin install ${installedNameOf({ context })}
75918
76019
  `
75919
76020
  );
75920
76021
  return 0;
75921
76022
  }
75922
76023
 
75923
76024
  // src/services/mcp-channel.service.ts
75924
- import { mkdir as mkdir15, rm as rm7, writeFile as writeFile14 } from "node:fs/promises";
76025
+ import { mkdir as mkdir15, rm as rm8, writeFile as writeFile14 } from "node:fs/promises";
75925
76026
  import { dirname as dirname16 } from "node:path";
75926
76027
  var LAZE_MCP_SERVER = "laze";
75927
76028
  var DEV_CHANNELS_FLAG = "--dangerously-load-development-channels";
@@ -76042,7 +76143,7 @@ async function pushInbox({
76042
76143
  `);
76043
76144
  }
76044
76145
  } finally {
76045
- await rm7(marker, { force: true });
76146
+ await rm8(marker, { force: true });
76046
76147
  }
76047
76148
  }
76048
76149
 
@@ -76157,8 +76258,8 @@ async function installHooks({
76157
76258
  directory,
76158
76259
  profile
76159
76260
  }) {
76160
- const folder = join17(directory, ".claude");
76161
- const path = join17(folder, "settings.local.json");
76261
+ const folder = join18(directory, ".claude");
76262
+ const path = join18(folder, "settings.local.json");
76162
76263
  const current3 = await readFile18(path, "utf8").then(
76163
76264
  (text3) => JSON.parse(text3),
76164
76265
  () => ({})
@@ -76478,7 +76579,7 @@ async function addSessionStartWaiter({ context, args }) {
76478
76579
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR;
76479
76580
  const profile = flagText({ args, name: "profile" });
76480
76581
  if (!directory || !profile) return;
76481
- const path = join17(directory, ".claude", "settings.local.json");
76582
+ const path = join18(directory, ".claude", "settings.local.json");
76482
76583
  const settings3 = await readFile18(path, "utf8").then(
76483
76584
  (text3) => JSON.parse(text3),
76484
76585
  () => void 0
@@ -76488,7 +76589,7 @@ async function addSessionStartWaiter({ context, args }) {
76488
76589
  }
76489
76590
  async function refreshPlugin({ context }) {
76490
76591
  if (await pluginIsCurrent({ context })) return;
76491
- const logPath = join17(pluginFolderOf({ context }), "install.log");
76592
+ const logPath = join18(pluginFolderOf({ context }), "install.log");
76492
76593
  context.processes.spawnDetached({ argv: [...context.program, "plugin", "install"], logPath });
76493
76594
  }
76494
76595
  async function stopHook({ context, args }) {
@@ -77364,10 +77465,10 @@ async function setAgentRunsOn({
77364
77465
 
77365
77466
  // src/services/agent-migrate-commands.service.ts
77366
77467
  import { readFile as readFile20, stat as stat7 } from "node:fs/promises";
77367
- import { basename as basename5, join as join18, resolve as resolve7 } from "node:path";
77468
+ import { basename as basename5, join as join19, resolve as resolve7 } from "node:path";
77368
77469
 
77369
77470
  // src/rules/migration-upload.rules.ts
77370
- import { createHash as createHash3 } from "node:crypto";
77471
+ import { createHash as createHash4 } from "node:crypto";
77371
77472
  function markersIn(text3) {
77372
77473
  return text3.split(REDACTION_MARKER).length - 1;
77373
77474
  }
@@ -77386,7 +77487,7 @@ async function redactTranscript({
77386
77487
  return { text: redacted.text, redactions };
77387
77488
  }
77388
77489
  function sha256Of({ text: text3 }) {
77389
- return createHash3("sha256").update(text3, "utf8").digest("hex");
77490
+ return createHash4("sha256").update(text3, "utf8").digest("hex");
77390
77491
  }
77391
77492
  var bytesOf2 = (text3) => Buffer.byteLength(text3, "utf8");
77392
77493
  function piecesOf({ line, maxBytes }) {
@@ -77572,9 +77673,9 @@ async function cancelMigration({ context, args }) {
77572
77673
  async function chosenTranscriptOf({
77573
77674
  context,
77574
77675
  ticket,
77575
- file: file3
77676
+ file: file4
77576
77677
  }) {
77577
- const path = resolve7(context.cwd, file3);
77678
+ const path = resolve7(context.cwd, file4);
77578
77679
  const sessionId = basename5(path).replace(/\.jsonl$/, "");
77579
77680
  if (ticket.source !== "claude-code" || !SESSION_ID.test(sessionId)) {
77580
77681
  throw new CliUsageError(
@@ -77588,8 +77689,8 @@ async function chosenTranscriptOf({
77588
77689
  return { sessionId, path: found ? path : void 0, where: path };
77589
77690
  }
77590
77691
  async function transcriptOf({ context, args, ticket }) {
77591
- const file3 = flagText({ args, name: "transcript" });
77592
- if (file3) return chosenTranscriptOf({ context, ticket, file: file3 });
77692
+ const file4 = flagText({ args, name: "transcript" });
77693
+ if (file4) return chosenTranscriptOf({ context, ticket, file: file4 });
77593
77694
  const inherited = context.environment.inherited;
77594
77695
  const own2 = ticket.source === "codex" ? inherited.CODEX_THREAD_ID : inherited.CLAUDE_CODE_SESSION_ID;
77595
77696
  const sessionId = own2 || ticket.sessionId || "";
@@ -77601,7 +77702,7 @@ async function transcriptOf({ context, args, ticket }) {
77601
77702
  if (ticket.source === "codex") {
77602
77703
  const codexHome = context.environment.codexHome;
77603
77704
  const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
77604
- return { sessionId, path: path2, where: join18(codexHome, "sessions") };
77705
+ return { sessionId, path: path2, where: join19(codexHome, "sessions") };
77605
77706
  }
77606
77707
  const { root, path } = await claudeTranscriptOf({ context, sessionId });
77607
77708
  return { sessionId, path, where: root };
@@ -77908,7 +78009,7 @@ async function requestAgent({ context, args }) {
77908
78009
 
77909
78010
  // src/services/app-commands.service.ts
77910
78011
  import { mkdir as mkdir18, readdir as readdir6, readFile as readFile22, writeFile as writeFile18 } from "node:fs/promises";
77911
- import { dirname as dirname18, join as join21, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
78012
+ import { dirname as dirname18, join as join22, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
77912
78013
 
77913
78014
  // ../../modules/app/contract/src/app.connections.ts
77914
78015
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -79997,11 +80098,11 @@ function unknownCollectionsOf({
79997
80098
  }) {
79998
80099
  if (!collections) return [];
79999
80100
  const known = Object.keys(collections);
80000
- return files2.filter((file3) => /\.(m?js|html)$/.test(file3.path)).flatMap(
80001
- (file3) => [...file3.text.matchAll(RECORDS_CALL)].filter(([, , name3]) => !known.includes(name3 ?? "")).map((match) => {
80002
- const line = file3.text.slice(0, match.index).split("\n").length;
80101
+ return files2.filter((file4) => /\.(m?js|html)$/.test(file4.path)).flatMap(
80102
+ (file4) => [...file4.text.matchAll(RECORDS_CALL)].filter(([, , name3]) => !known.includes(name3 ?? "")).map((match) => {
80103
+ const line = file4.text.slice(0, match.index).split("\n").length;
80003
80104
  const defines = known.length > 0 ? known.join(", ") : "none";
80004
- return `${file3.path}:${line.toString()}: Laze.records("${match[2] ?? ""}") names a collection laze.app.json does not define (it defines: ${defines})`;
80105
+ return `${file4.path}:${line.toString()}: Laze.records("${match[2] ?? ""}") names a collection laze.app.json does not define (it defines: ${defines})`;
80005
80106
  })
80006
80107
  );
80007
80108
  }
@@ -80358,9 +80459,9 @@ async function appPinsCommand({
80358
80459
 
80359
80460
  // src/services/app-script-check.service.ts
80360
80461
  import { execFile } from "node:child_process";
80361
- import { mkdtemp, rm as rm8, writeFile as writeFile17 } from "node:fs/promises";
80462
+ import { mkdtemp, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
80362
80463
  import { tmpdir } from "node:os";
80363
- import { join as join19 } from "node:path";
80464
+ import { join as join20 } from "node:path";
80364
80465
  import { promisify } from "node:util";
80365
80466
  var run2 = promisify(execFile);
80366
80467
  var MODULE_SYNTAX = /^\s*(import|export)\s/m;
@@ -80389,31 +80490,31 @@ async function scriptErrorsOf({
80389
80490
  const unknown2 = unknownCollectionsOf({ files: files2, collections });
80390
80491
  const scripts = files2.flatMap(scriptsOf);
80391
80492
  if (scripts.length === 0) return unknown2;
80392
- const dir = await mkdtemp(join19(tmpdir(), "laze-app-check-"));
80493
+ const dir = await mkdtemp(join20(tmpdir(), "laze-app-check-"));
80393
80494
  try {
80394
80495
  const errors = await Promise.all(
80395
80496
  scripts.map(async (script, index) => {
80396
- const file3 = join19(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
80397
- await writeFile17(file3, script.code);
80497
+ const file4 = join20(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
80498
+ await writeFile17(file4, script.code);
80398
80499
  try {
80399
- await run2(process.execPath, ["--check", file3]);
80500
+ await run2(process.execPath, ["--check", file4]);
80400
80501
  return null;
80401
80502
  } catch (cause) {
80402
80503
  const stderr2 = cause.stderr ?? "";
80403
- return errorOf2({ script, stderr: stderr2.replaceAll(file3, script.path) });
80504
+ return errorOf2({ script, stderr: stderr2.replaceAll(file4, script.path) });
80404
80505
  }
80405
80506
  })
80406
80507
  );
80407
80508
  return [...errors.filter((error63) => error63 !== null), ...unknown2];
80408
80509
  } finally {
80409
- await rm8(dir, { recursive: true, force: true });
80510
+ await rm9(dir, { recursive: true, force: true });
80410
80511
  }
80411
80512
  }
80412
80513
 
80413
80514
  // src/services/app-serve.service.ts
80414
80515
  import { readFile as readFile21, stat as stat8 } from "node:fs/promises";
80415
80516
  import { createServer } from "node:http";
80416
- import { extname as extname2, join as join20, normalize, sep as sep2 } from "node:path";
80517
+ import { extname as extname2, join as join21, normalize, sep as sep2 } from "node:path";
80417
80518
  var TYPES2 = {
80418
80519
  ".html": "text/html; charset=utf-8",
80419
80520
  ".js": "text/javascript; charset=utf-8",
@@ -80464,8 +80565,8 @@ async function staticFile({
80464
80565
  if (clean.startsWith("..") || hidden) {
80465
80566
  return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
80466
80567
  }
80467
- const candidates = [join20(folder, clean), join20(folder, clean, "index.html")];
80468
- if (!extname2(clean)) candidates.push(join20(folder, "index.html"));
80568
+ const candidates = [join21(folder, clean), join21(folder, clean, "index.html")];
80569
+ if (!extname2(clean)) candidates.push(join21(folder, "index.html"));
80469
80570
  for (const target of candidates) {
80470
80571
  const info = await stat8(target).catch(() => void 0);
80471
80572
  if (!info?.isFile()) continue;
@@ -80556,16 +80657,16 @@ async function serveAppFolder({
80556
80657
  (error63) => failed({ response, error: error63 })
80557
80658
  );
80558
80659
  });
80559
- await new Promise((resolve24, reject) => {
80660
+ await new Promise((resolve26, reject) => {
80560
80661
  server.once("error", reject);
80561
- server.listen(port, "127.0.0.1", () => resolve24());
80662
+ server.listen(port, "127.0.0.1", () => resolve26());
80562
80663
  });
80563
80664
  const { port: bound } = server.address();
80564
80665
  return {
80565
80666
  url: `http://127.0.0.1:${bound}/`,
80566
- close: () => new Promise((resolve24) => {
80667
+ close: () => new Promise((resolve26) => {
80567
80668
  server.closeAllConnections();
80568
- server.close(() => resolve24());
80669
+ server.close(() => resolve26());
80569
80670
  })
80570
80671
  };
80571
80672
  }
@@ -80733,7 +80834,7 @@ function folderOf({ context, word: word3 }) {
80733
80834
  return resolve8(context.cwd, word3 ?? ".");
80734
80835
  }
80735
80836
  async function readManifest(folder) {
80736
- const text3 = await readFile22(join21(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
80837
+ const text3 = await readFile22(join22(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
80737
80838
  if (text3 === void 0) return void 0;
80738
80839
  const parsed = appManifestSchema.safeParse(JSON.parse(text3));
80739
80840
  if (!parsed.success) {
@@ -80781,7 +80882,7 @@ async function listFiles(folder) {
80781
80882
  while (pending2.length > 0 && found.length <= MAX_FILES) {
80782
80883
  const current3 = pending2.pop() ?? folder;
80783
80884
  for (const entry of await readdir6(current3, { withFileTypes: true })) {
80784
- const path = join21(current3, entry.name);
80885
+ const path = join22(current3, entry.name);
80785
80886
  const rel = relative3(folder, path).split(sep3).join("/");
80786
80887
  if (isSkippedPath({ path: rel })) continue;
80787
80888
  if (entry.isDirectory()) pending2.push(path);
@@ -80819,12 +80920,12 @@ var appCreate = async ({ context, args }) => {
80819
80920
  const folder = resolve8(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
80820
80921
  await mkdir18(folder, { recursive: true });
80821
80922
  const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
80822
- for (const file3 of start2?.files ?? []) {
80823
- const target = join21(folder, ...file3.path.split("/"));
80923
+ for (const file4 of start2?.files ?? []) {
80924
+ const target = join22(folder, ...file4.path.split("/"));
80824
80925
  await mkdir18(dirname18(target), { recursive: true });
80825
80926
  await writeFile18(
80826
80927
  target,
80827
- file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
80928
+ file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
80828
80929
  );
80829
80930
  }
80830
80931
  const manifest = {
@@ -80833,7 +80934,7 @@ var appCreate = async ({ context, args }) => {
80833
80934
  views: [...start2?.template.views ?? []],
80834
80935
  seed: { ...start2?.template.seed }
80835
80936
  };
80836
- await writeFile18(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
80937
+ await writeFile18(join22(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
80837
80938
  `);
80838
80939
  const where = relative3(context.cwd, folder) || ".";
80839
80940
  print5({
@@ -80909,7 +81010,7 @@ var appPush = async ({ context, args }) => {
80909
81010
  })
80910
81011
  )
80911
81012
  );
80912
- const bytes = files2.reduce((sum, file3) => sum + file3.bytes, 0);
81013
+ const bytes = files2.reduce((sum, file4) => sum + file4.bytes, 0);
80913
81014
  if (bytes > MAX_APP_BUILD_BYTES) {
80914
81015
  context.err(
80915
81016
  `laze: The folder is ${Math.ceil(bytes / 1024)} KB; one version holds at most ${MAX_APP_BUILD_BYTES / 1024 / 1024} MB (app_build_too_large)
@@ -80919,7 +81020,7 @@ var appPush = async ({ context, args }) => {
80919
81020
  }
80920
81021
  if (files2.length === 0) throw new CliUsageError(`No files to push in ${folder}`);
80921
81022
  const scriptErrors = await scriptErrorsOf({
80922
- files: files2.filter((file3) => file3.encoding === "utf8").map(({ path, content }) => ({ path, text: content })),
81023
+ files: files2.filter((file4) => file4.encoding === "utf8").map(({ path, content }) => ({ path, text: content })),
80923
81024
  collections: manifest?.collections
80924
81025
  });
80925
81026
  if (scriptErrors.length > 0) {
@@ -80946,7 +81047,7 @@ var appPush = async ({ context, args }) => {
80946
81047
  const pushed = await client.post("/api/apps/commit", {
80947
81048
  appId,
80948
81049
  message: message2,
80949
- files: files2.map(({ bytes: _bytes, ...file3 }) => file3),
81050
+ files: files2.map(({ bytes: _bytes, ...file4 }) => file4),
80950
81051
  ...manifest?.users ? { users: manifest.users } : {},
80951
81052
  ...manifest?.functions ? { functions: manifest.functions } : {}
80952
81053
  });
@@ -80973,11 +81074,11 @@ var appWrite = async ({ context, args }) => {
80973
81074
  const files2 = await Promise.all(
80974
81075
  words.slice(2).map(async (word3) => {
80975
81076
  const path = resolve8(context.cwd, word3);
80976
- const { bytes: _bytes, ...file3 } = buildFileOf({
81077
+ const { bytes: _bytes, ...file4 } = buildFileOf({
80977
81078
  path: relative3(folder, path).split(sep3).join("/"),
80978
81079
  bytes: await readFile22(path)
80979
81080
  });
80980
- return file3;
81081
+ return file4;
80981
81082
  })
80982
81083
  );
80983
81084
  if (files2.length + remove8.length === 0) {
@@ -81101,12 +81202,12 @@ var appPull = async ({ context, args }) => {
81101
81202
  `${folder} already holds files that are not this app's; pull into an empty folder, or pass --force. Nothing was written.`
81102
81203
  );
81103
81204
  }
81104
- for (const file3 of pulled.files) {
81105
- const target = join21(folder, ...file3.path.split("/"));
81205
+ for (const file4 of pulled.files) {
81206
+ const target = join22(folder, ...file4.path.split("/"));
81106
81207
  await mkdir18(dirname18(target), { recursive: true });
81107
81208
  await writeFile18(
81108
81209
  target,
81109
- file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
81210
+ file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
81110
81211
  );
81111
81212
  }
81112
81213
  const manifest = {
@@ -81121,7 +81222,7 @@ var appPull = async ({ context, args }) => {
81121
81222
  ])
81122
81223
  )
81123
81224
  };
81124
- await writeFile18(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
81225
+ await writeFile18(join22(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
81125
81226
  `);
81126
81227
  const names = pulled.collections.map((collection) => collection.name);
81127
81228
  const where = relative3(context.cwd, folder) || ".";
@@ -81434,10 +81535,10 @@ var appExport = async ({ context, args }) => {
81434
81535
  };
81435
81536
  var appImport = async ({ context, args }) => {
81436
81537
  const words = args.words.slice(2);
81437
- const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
81438
- if (!collection || !file3) throw new CliUsageError(USAGE5);
81439
- const csv = await readFile22(resolve8(context.cwd, file3), "utf8").catch(() => {
81440
- throw new CliUsageError(`Cannot read ${file3}`);
81538
+ const [named, collection, file4] = words.length >= 3 ? words : [void 0, ...words];
81539
+ if (!collection || !file4) throw new CliUsageError(USAGE5);
81540
+ const csv = await readFile22(resolve8(context.cwd, file4), "utf8").catch(() => {
81541
+ throw new CliUsageError(`Cannot read ${file4}`);
81441
81542
  });
81442
81543
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
81443
81544
  const client = await appClient({ context, args: scoped });
@@ -81850,11 +81951,11 @@ async function app({ context, args }) {
81850
81951
  import { hostname as hostname6 } from "node:os";
81851
81952
 
81852
81953
  // src/rules/machine-proof.rules.ts
81853
- import { createHash as createHash4, randomBytes } from "node:crypto";
81954
+ import { createHash as createHash5, randomBytes } from "node:crypto";
81854
81955
  var b64url3 = (bytes) => Buffer.from(bytes).toString("base64url");
81855
81956
  function thumbprintOf({ jwk }) {
81856
81957
  const canonical = JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y });
81857
- return b64url3(createHash4("sha256").update(canonical).digest());
81958
+ return b64url3(createHash5("sha256").update(canonical).digest());
81858
81959
  }
81859
81960
  function lazeTokenOf({ authorization }) {
81860
81961
  const match = /^Bearer (lz_\S+)$/.exec(authorization ?? "");
@@ -81878,7 +81979,7 @@ function machineProofOf({
81878
81979
  htu: url2,
81879
81980
  iat: Math.floor(nowMs / 1e3),
81880
81981
  jti,
81881
- ath: b64url3(createHash4("sha256").update(credential).digest()),
81982
+ ath: b64url3(createHash5("sha256").update(credential).digest()),
81882
81983
  lz_tier: tier,
81883
81984
  ...tailscaleNodeId ? { lz_ts: tailscaleNodeId } : {}
81884
81985
  })
@@ -82296,12 +82397,12 @@ async function billing({ context, args }) {
82296
82397
  // src/services/browser-commands.service.ts
82297
82398
  import { randomBytes as randomBytes2 } from "node:crypto";
82298
82399
  import { mkdir as mkdir21, readFile as readFile24, writeFile as writeFile21 } from "node:fs/promises";
82299
- import { dirname as dirname20, join as join24 } from "node:path";
82400
+ import { dirname as dirname20, join as join25 } from "node:path";
82300
82401
 
82301
82402
  // src/services/browser-tab-commands.service.ts
82302
82403
  import { mkdir as mkdir20, writeFile as writeFile20 } from "node:fs/promises";
82303
82404
  import { tmpdir as tmpdir3 } from "node:os";
82304
- import { join as join23 } from "node:path";
82405
+ import { join as join24 } from "node:path";
82305
82406
 
82306
82407
  // src/rules/browser-login.rules.ts
82307
82408
  var PASSWORD_NAME = /pass|pwd/i;
@@ -82331,10 +82432,10 @@ function loginValuesOf({
82331
82432
  }
82332
82433
 
82333
82434
  // src/services/vault-commands.service.ts
82334
- import { createHash as createHash5 } from "node:crypto";
82335
- import { mkdir as mkdir19, readFile as readFile23, rm as rm9, writeFile as writeFile19 } from "node:fs/promises";
82435
+ import { createHash as createHash6 } from "node:crypto";
82436
+ import { mkdir as mkdir19, readFile as readFile23, rm as rm10, writeFile as writeFile19 } from "node:fs/promises";
82336
82437
  import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
82337
- import { dirname as dirname19, join as join22 } from "node:path";
82438
+ import { dirname as dirname19, join as join23 } from "node:path";
82338
82439
 
82339
82440
  // src/rules/vault-session.rules.ts
82340
82441
  function vaultSessionOf({
@@ -82409,9 +82510,9 @@ function runKeyPathOf({
82409
82510
  connection,
82410
82511
  profile = ""
82411
82512
  }) {
82412
- const name3 = createHash5("sha256").update(connection).digest("hex");
82413
- const base = turnFile ? dirname19(turnFile) : join22(tmpdir2(), "laze-vault", profile);
82414
- return join22(base, "vault-run-keys", `${name3}.json`);
82513
+ const name3 = createHash6("sha256").update(connection).digest("hex");
82514
+ const base = turnFile ? dirname19(turnFile) : join23(tmpdir2(), "laze-vault", profile);
82515
+ return join23(base, "vault-run-keys", `${name3}.json`);
82415
82516
  }
82416
82517
  async function runKeyAt({ path }) {
82417
82518
  const saved3 = await readFile23(path, "utf8").then(
@@ -82589,13 +82690,13 @@ async function settled({
82589
82690
  }) {
82590
82691
  if (release2 === "capped") return { exitCode: 75 };
82591
82692
  if (release2.outcome === "deny") {
82592
- await rm9(keyPath, { force: true });
82693
+ await rm10(keyPath, { force: true });
82593
82694
  context.err(`${release2.message}
82594
82695
  `);
82595
82696
  return { exitCode: release2.exitCode || 1 };
82596
82697
  }
82597
82698
  const values = await envOf({ release: release2, run: run4 });
82598
- if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm9(keyPath, { force: true });
82699
+ if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm10(keyPath, { force: true });
82599
82700
  if (release2.message) context.err(`${release2.message}
82600
82701
  `);
82601
82702
  return { env: values };
@@ -82940,9 +83041,9 @@ async function savedScreenshot({
82940
83041
  data,
82941
83042
  nowMs
82942
83043
  }) {
82943
- const folder = join23(tmpdir3(), "laze-browser");
83044
+ const folder = join24(tmpdir3(), "laze-browser");
82944
83045
  await mkdir20(folder, { recursive: true, mode: 448 });
82945
- const path = join23(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
83046
+ const path = join24(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
82946
83047
  await writeFile20(path, Buffer.from(data, "base64"), { mode: 384 });
82947
83048
  return path;
82948
83049
  }
@@ -83030,7 +83131,7 @@ function tunnel({
83030
83131
  host: host2,
83031
83132
  port
83032
83133
  }) {
83033
- return new Promise((resolve24, reject) => {
83134
+ return new Promise((resolve26, reject) => {
83034
83135
  const socket = connectTcp(proxy.port, proxy.host);
83035
83136
  let answer6 = "";
83036
83137
  const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
@@ -83047,7 +83148,7 @@ ${auth}\r
83047
83148
  answer6 += chunk.toString("latin1");
83048
83149
  if (!answer6.includes(HEADER_END)) return;
83049
83150
  socket.off("data", onData);
83050
- if (/^HTTP\/1\.[01] 200/.test(answer6)) return resolve24(socket);
83151
+ if (/^HTTP\/1\.[01] 200/.test(answer6)) return resolve26(socket);
83051
83152
  socket.destroy();
83052
83153
  reject(new Error(`proxy refused the tunnel: ${answer6.split("\r\n")[0] ?? ""}`));
83053
83154
  };
@@ -83060,8 +83161,8 @@ async function upstreamOf({ target, proxy }) {
83060
83161
  const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
83061
83162
  if (!secure) return raw;
83062
83163
  const tls = connectTls({ socket: raw, servername: target.hostname });
83063
- await new Promise((resolve24, reject) => {
83064
- tls.once("secureConnect", () => resolve24());
83164
+ await new Promise((resolve26, reject) => {
83165
+ tls.once("secureConnect", () => resolve26());
83065
83166
  tls.once("error", reject);
83066
83167
  });
83067
83168
  return tls;
@@ -83103,8 +83204,8 @@ async function browserSocket({
83103
83204
  createConnection: () => upstream,
83104
83205
  perMessageDeflate: false
83105
83206
  });
83106
- await new Promise((resolve24, reject) => {
83107
- socket.once("open", () => resolve24());
83207
+ await new Promise((resolve26, reject) => {
83208
+ socket.once("open", () => resolve26());
83108
83209
  socket.once("error", reject);
83109
83210
  });
83110
83211
  return socket;
@@ -83117,12 +83218,12 @@ async function browserCall({
83117
83218
  }) {
83118
83219
  const socket = await browserSocket({ target, proxy });
83119
83220
  try {
83120
- return await new Promise((resolve24, reject) => {
83221
+ return await new Promise((resolve26, reject) => {
83121
83222
  socket.on("message", (data) => {
83122
83223
  const reply2 = JSON.parse(textOf3(data));
83123
83224
  if (reply2.id !== 1) return;
83124
83225
  if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
83125
- else resolve24(reply2.result ?? {});
83226
+ else resolve26(reply2.result ?? {});
83126
83227
  });
83127
83228
  socket.once(
83128
83229
  "close",
@@ -83286,18 +83387,18 @@ function retargetCdpBridge({
83286
83387
  target,
83287
83388
  expiresAt
83288
83389
  }) {
83289
- return new Promise((resolve24) => {
83390
+ return new Promise((resolve26) => {
83290
83391
  const call = httpRequest(
83291
83392
  { host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
83292
83393
  (response) => {
83293
83394
  response.resume();
83294
- resolve24(response.statusCode === 204);
83395
+ resolve26(response.statusCode === 204);
83295
83396
  }
83296
83397
  );
83297
83398
  call.setHeader(KEY_HEADER, key);
83298
83399
  call.setHeader("content-type", "application/json");
83299
83400
  call.once("timeout", () => call.destroy());
83300
- call.once("error", () => resolve24(false));
83401
+ call.once("error", () => resolve26(false));
83301
83402
  call.end(JSON.stringify({ target, expiresAt }));
83302
83403
  });
83303
83404
  }
@@ -83346,15 +83447,15 @@ async function startCdpBridge({
83346
83447
  (socket) => relayPage({ client: socket, targetId, target: url2, proxy })
83347
83448
  );
83348
83449
  });
83349
- await new Promise((resolve24) => server.listen(0, "127.0.0.1", resolve24));
83450
+ await new Promise((resolve26) => server.listen(0, "127.0.0.1", resolve26));
83350
83451
  const port = server.address().port;
83351
83452
  return {
83352
83453
  port,
83353
- close: () => new Promise((resolve24) => {
83454
+ close: () => new Promise((resolve26) => {
83354
83455
  for (const client of relayed) client.destroy();
83355
83456
  pages.close();
83356
83457
  server.closeAllConnections();
83357
- server.close(() => resolve24());
83458
+ server.close(() => resolve26());
83358
83459
  })
83359
83460
  };
83360
83461
  }
@@ -83371,7 +83472,7 @@ function launchCdpBridge({
83371
83472
  stdio: ["ignore", "pipe", "ignore"],
83372
83473
  env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
83373
83474
  });
83374
- return new Promise((resolve24, reject) => {
83475
+ return new Promise((resolve26, reject) => {
83375
83476
  let printed2 = "";
83376
83477
  child.once("error", reject);
83377
83478
  child.once("exit", (code) => reject(new Error(`the CDP bridge stopped (${code})`)));
@@ -83382,7 +83483,7 @@ function launchCdpBridge({
83382
83483
  child.stdout.destroy();
83383
83484
  child.removeAllListeners("exit");
83384
83485
  child.unref();
83385
- if (Number.isInteger(port) && port > 0) resolve24(port);
83486
+ if (Number.isInteger(port) && port > 0) resolve26(port);
83386
83487
  else reject(new Error("the CDP bridge printed no port"));
83387
83488
  });
83388
83489
  });
@@ -83509,7 +83610,7 @@ async function answering({
83509
83610
  }
83510
83611
  function bridgeStatePath({ context, machine: machine2 }) {
83511
83612
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
83512
- return join24(dirname20(context.environment.configPath), "bridges", `${safe}.json`);
83613
+ return join25(dirname20(context.environment.configPath), "bridges", `${safe}.json`);
83513
83614
  }
83514
83615
  async function bridgePort({
83515
83616
  context,
@@ -84232,7 +84333,7 @@ import { basename as basename7, isAbsolute as isAbsolute2, relative as relative4
84232
84333
 
84233
84334
  // src/services/file-download.service.ts
84234
84335
  import { createWriteStream } from "node:fs";
84235
- import { mkdir as mkdir22, rename as rename5, rm as rm10, stat as stat9, truncate } from "node:fs/promises";
84336
+ import { mkdir as mkdir22, rename as rename5, rm as rm11, stat as stat9, truncate } from "node:fs/promises";
84236
84337
  import { basename as basename6, dirname as dirname21, resolve as resolve9 } from "node:path";
84237
84338
  import { Readable, Transform } from "node:stream";
84238
84339
  import { pipeline } from "node:stream/promises";
@@ -84357,7 +84458,7 @@ async function downloadFile({
84357
84458
  await mkdir22(dirname21(part), { recursive: true });
84358
84459
  const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
84359
84460
  async (error63) => {
84360
- await rm10(part, { force: true });
84461
+ await rm11(part, { force: true });
84361
84462
  if (!isDiskError(error63)) throw error63;
84362
84463
  throw new CliUsageError(`Could not write ${attachmentId} to disk: ${String(error63)}`);
84363
84464
  }
@@ -84809,7 +84910,7 @@ async function chatActions({
84809
84910
  }
84810
84911
 
84811
84912
  // src/services/claude-monitor.service.ts
84812
- import { readFile as readFile26, rm as rm11 } from "node:fs/promises";
84913
+ import { readFile as readFile26, rm as rm12 } from "node:fs/promises";
84813
84914
  var MONITOR_IDLE_MS = 3e4;
84814
84915
  var MONITOR_OUTRANKED_MS = 3e3;
84815
84916
  async function deliverOnce({
@@ -84877,7 +84978,7 @@ async function monitorRound(turn) {
84877
84978
  async function release({ context, profile }) {
84878
84979
  const lock = statePathOf({ context, kind: "waiters", profile });
84879
84980
  if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
84880
- await rm11(lock, { force: true });
84981
+ await rm12(lock, { force: true });
84881
84982
  }
84882
84983
  async function monitorHook({ context, args }) {
84883
84984
  const claudePid = await claudePidOf({ context });
@@ -86111,6 +86212,8 @@ var WHATSAPP_LEASE_DEFAULT_SECONDS = 172800;
86111
86212
  var whatsappLeaseSecondsSchema = external_exports.number().int().refine((seconds) => WHATSAPP_LEASE_CHOICES.includes(seconds), {
86112
86213
  message: "A lease is 1 hour, 1 day or 2 days"
86113
86214
  });
86215
+ var WHATSAPP_AGENT_ACCESS = ["ask", "read", "read_send", "read_only", "off"];
86216
+ var whatsappAgentAccessLevelSchema = external_exports.enum(WHATSAPP_AGENT_ACCESS);
86114
86217
  var agentAccessDefinition = external_exports.object({
86115
86218
  agentId: external_exports.string(),
86116
86219
  name: external_exports.string(),
@@ -86122,11 +86225,23 @@ var agentAccessDefinition = external_exports.object({
86122
86225
  leaseSeconds: external_exports.number().int().positive().default(WHATSAPP_LEASE_DEFAULT_SECONDS),
86123
86226
  /** Until when a lease lets the agent read, or send, with no card; null when none runs. */
86124
86227
  readLeaseUntil: external_exports.iso.datetime().nullable().default(null),
86125
- sendLeaseUntil: external_exports.iso.datetime().nullable().default(null)
86228
+ sendLeaseUntil: external_exports.iso.datetime().nullable().default(null),
86229
+ /** The owner set this agent's own level; false while it follows "Every agent". */
86230
+ overridden: external_exports.boolean().default(false)
86231
+ });
86232
+ var everyAgentDefinition = external_exports.object({
86233
+ /** The level every agent without its own follows; an agent shared with others asks to read. */
86234
+ access: whatsappAgentAccessLevelSchema,
86235
+ /** What "Allow for" lasts on every agent's cards. */
86236
+ leaseSeconds: external_exports.number().int().positive()
86126
86237
  });
86127
86238
  var agentsDefinition = external_exports.object({
86128
86239
  machineId: external_exports.string(),
86129
- agents: external_exports.array(agentAccessDefinition)
86240
+ agents: external_exports.array(agentAccessDefinition),
86241
+ everyAgent: everyAgentDefinition.default({
86242
+ access: "read",
86243
+ leaseSeconds: WHATSAPP_LEASE_DEFAULT_SECONDS
86244
+ })
86130
86245
  });
86131
86246
  var whatsappAgentsSchema = agentsDefinition;
86132
86247
  var setAgentDefinition = external_exports.object({
@@ -86146,6 +86261,25 @@ var setLeaseDefinition = external_exports.object({
86146
86261
  leaseSeconds: whatsappLeaseSecondsSchema
86147
86262
  });
86148
86263
  var setWhatsappAgentLeaseInputSchema = setLeaseDefinition;
86264
+ var setEveryAgentDefinition = external_exports.object({
86265
+ workspaceId: external_exports.string().min(1).max(64),
86266
+ machine: external_exports.string().min(1).max(64),
86267
+ access: whatsappAgentAccessLevelSchema.optional(),
86268
+ leaseSeconds: whatsappLeaseSecondsSchema.optional(),
86269
+ /** The vault's one-use proof, needed when the level moves towards Allow. */
86270
+ reauthToken: external_exports.string().min(1).max(200).optional()
86271
+ });
86272
+ var setWhatsappEveryAgentInputSchema = setEveryAgentDefinition;
86273
+ var WHATSAPP_EVERY_AGENT = "every_agent";
86274
+ var setAgentAccessDefinition = external_exports.object({
86275
+ workspaceId: external_exports.string().min(1).max(64),
86276
+ machine: external_exports.string().min(1).max(64),
86277
+ agentId: external_exports.string().min(1).max(64),
86278
+ access: external_exports.union([whatsappAgentAccessLevelSchema, external_exports.literal(WHATSAPP_EVERY_AGENT)]),
86279
+ /** The vault's one-use proof, needed when Read or Send moves towards Allow. */
86280
+ reauthToken: external_exports.string().min(1).max(200).optional()
86281
+ });
86282
+ var setWhatsappAgentAccessInputSchema = setAgentAccessDefinition;
86149
86283
 
86150
86284
  // ../../modules/compute/contract/src/own-machine-whatsapp.ts
86151
86285
  var workspaceIdSchema20 = external_exports.string().min(1).max(64);
@@ -86166,12 +86300,29 @@ var whatsappChatDefinition = external_exports.object({
86166
86300
  lastMessageAt: external_exports.string().nullable().default(null),
86167
86301
  lastMessage: external_exports.string().max(500).default("")
86168
86302
  });
86303
+ var whatsappChangeMediaDefinition = external_exports.object({
86304
+ kind: external_exports.enum(["voice", "audio", "image", "video", "document", "sticker"]),
86305
+ mime: external_exports.string().max(200),
86306
+ size: external_exports.number().int().positive(),
86307
+ seconds: external_exports.number().int().nonnegative().optional(),
86308
+ name: external_exports.string().max(500).optional(),
86309
+ /** How the last fetch ended; absent while one is due, and from older connectors. */
86310
+ state: external_exports.enum(["done", "gone", "too_large"]).optional(),
86311
+ /** The Laze file the mirrored message carries, once confirmed; only between connector and api. */
86312
+ fileId: external_exports.string().max(200).optional()
86313
+ });
86169
86314
  var whatsappMessageDefinition = external_exports.object({
86170
86315
  id: external_exports.string().max(200),
86171
86316
  at: external_exports.string(),
86172
86317
  fromMe: external_exports.boolean(),
86173
86318
  sender: external_exports.string().max(500),
86174
- text: external_exports.string()
86319
+ text: external_exports.string(),
86320
+ /** The message's file; `laze whatsapp file` fetches it. Absent from older connectors. */
86321
+ media: external_exports.object({
86322
+ ...whatsappChangeMediaDefinition.shape,
86323
+ /** A voice or audio message's words, once Laze transcribed the mirrored copy. */
86324
+ transcript: external_exports.string().optional()
86325
+ }).optional()
86175
86326
  });
86176
86327
  var chatsResultDefinition = external_exports.object({
86177
86328
  machine: external_exports.string(),
@@ -86203,6 +86354,28 @@ var readInputDefinition = external_exports.object({
86203
86354
  limit: limitSchema.optional(),
86204
86355
  ...readAskFields
86205
86356
  });
86357
+ var fileInputDefinition = external_exports.object({
86358
+ workspaceId: workspaceIdSchema20,
86359
+ machine: whatsappMachineRef,
86360
+ /** The chat as a read names it: its id, a phone number or the exact contact or group name. */
86361
+ chat: chatRefSchema,
86362
+ /** The message id a read showed. */
86363
+ id: external_exports.string().trim().min(1).max(200),
86364
+ ...readAskFields
86365
+ });
86366
+ var whatsappFileDefinition = external_exports.object({
86367
+ machine: external_exports.string(),
86368
+ chat: external_exports.string().max(200),
86369
+ id: external_exports.string().max(200),
86370
+ kind: whatsappChangeMediaDefinition.shape.kind,
86371
+ fileName: external_exports.string().max(500),
86372
+ contentType: external_exports.string().max(200),
86373
+ sizeBytes: external_exports.number().int().nonnegative(),
86374
+ url: external_exports.string(),
86375
+ expiresAt: external_exports.string(),
86376
+ /** A voice or audio message's words, once Laze transcribed the mirrored copy. */
86377
+ transcript: external_exports.string().optional()
86378
+ });
86206
86379
  var sendInputDefinition = external_exports.object({
86207
86380
  workspaceId: workspaceIdSchema20,
86208
86381
  machine: whatsappMachineRef,
@@ -86304,13 +86477,6 @@ var whatsappComputerDefinition = external_exports.object({
86304
86477
  var whatsappComputerSchema = whatsappComputerDefinition;
86305
86478
  var whatsappComputerInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20 });
86306
86479
  var whatsappComputerInputSchema = whatsappComputerInputDefinition;
86307
- var whatsappChangeMediaDefinition = external_exports.object({
86308
- kind: external_exports.enum(["voice", "audio", "image", "video", "document", "sticker"]),
86309
- mime: external_exports.string().max(200),
86310
- size: external_exports.number().int().positive(),
86311
- seconds: external_exports.number().int().nonnegative().optional(),
86312
- name: external_exports.string().max(500).optional()
86313
- });
86314
86480
  var whatsappChangeDefinition = external_exports.object({
86315
86481
  chat: external_exports.string().min(1).max(200),
86316
86482
  chatName: external_exports.string().max(500),
@@ -86326,6 +86492,13 @@ var whatsappChangeDefinition = external_exports.object({
86326
86492
  /** The chat's other ids, such as the hidden id it was first seen under; new in Nov 2026. */
86327
86493
  aliases: external_exports.array(external_exports.string().min(1).max(200)).max(16).optional()
86328
86494
  });
86495
+ var whatsappReadDefinition = external_exports.object({
86496
+ chat: external_exports.string().min(1).max(200),
86497
+ at: external_exports.iso.datetime(),
86498
+ unread: external_exports.number().int().positive().max(1e6).optional(),
86499
+ /** The chat's other ids, such as the hidden id it was first seen under. */
86500
+ aliases: external_exports.array(external_exports.string().min(1).max(200)).max(16).optional()
86501
+ });
86329
86502
  var whatsappPairingSchema = whatsappPairingDefinition;
86330
86503
  var pairingRefDefinition = external_exports.object({
86331
86504
  workspaceId: workspaceIdSchema20,
@@ -86334,15 +86507,19 @@ var pairingRefDefinition = external_exports.object({
86334
86507
  var whatsappPairingRefSchema = pairingRefDefinition;
86335
86508
  var restPairingRefDefinition = external_exports.object({ pairingId: external_exports.string().min(1).max(64) });
86336
86509
  var restChatsDefinition = chatsInputDefinition.omit({ workspaceId: true });
86510
+ var restSyncDefinition = external_exports.object({ machine: whatsappMachineRef });
86337
86511
  var restReadDefinition = readInputDefinition.omit({ workspaceId: true });
86512
+ var restFileDefinition = fileInputDefinition.omit({ workspaceId: true });
86338
86513
  var restSendDefinition = sendInputDefinition.omit({ workspaceId: true });
86339
86514
  var restSendStatusDefinition = sendStatusInputDefinition.omit({ workspaceId: true });
86340
86515
  var COMPUTE_WHATSAPP_REST_PATHS = {
86341
86516
  chats: "/api/compute/whatsapp/chats",
86342
86517
  read: "/api/compute/whatsapp/read",
86518
+ file: "/api/compute/whatsapp/file",
86343
86519
  send: "/api/compute/whatsapp/send",
86344
86520
  sendStatus: "/api/compute/whatsapp/send-status",
86345
- unpair: "/api/compute/whatsapp/unpair"
86521
+ unpair: "/api/compute/whatsapp/unpair",
86522
+ sync: "/api/compute/whatsapp/sync"
86346
86523
  };
86347
86524
 
86348
86525
  // ../../modules/compute/contract/src/own-machine.ts
@@ -86612,6 +86789,24 @@ var openScreenDefinition = external_exports.object({
86612
86789
  site: external_exports.string().min(1).max(500).optional()
86613
86790
  });
86614
86791
  var openScreenInputSchema = openScreenDefinition;
86792
+ var loginTerminalHarnessSchema = external_exports.enum(["claude-code", "codex"]);
86793
+ var openLoginTerminalDefinition = external_exports.object({
86794
+ workspaceId: workspaceIdSchema22,
86795
+ harness: loginTerminalHarnessSchema
86796
+ });
86797
+ var openLoginTerminalInputSchema = openLoginTerminalDefinition;
86798
+ var loginTerminalDefinition = external_exports.discriminatedUnion("status", [
86799
+ external_exports.object({ status: external_exports.literal("starting"), retryAfterSeconds: external_exports.number().int().positive() }),
86800
+ external_exports.object({
86801
+ status: external_exports.literal("ready"),
86802
+ /** The WebSocket path of the terminal, token included; add `cols` and `rows`. */
86803
+ streamPath: external_exports.string(),
86804
+ expiresAt: external_exports.iso.datetime()
86805
+ })
86806
+ ]);
86807
+ var loginTerminalSchema = loginTerminalDefinition;
86808
+ var warmComputerDefinition = external_exports.object({ status: external_exports.enum(["starting", "ready"]) });
86809
+ var warmComputerSchema = warmComputerDefinition;
86615
86810
  var screenRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, sessionId: idSchema23 });
86616
86811
  var screenRefSchema = screenRefDefinition;
86617
86812
  var screenSessionDefinition = external_exports.object({
@@ -86652,8 +86847,8 @@ var ownMachineSshConnectDefinition = external_exports.object({
86652
86847
  var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
86653
86848
  var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, machineId: idSchema23 });
86654
86849
  var ComputeApi = moduleApi()("compute");
86655
- var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
86656
- var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentLease").withInput(setWhatsappAgentLeaseInputSchema).withOutput(whatsappAgentsSchema).build();
86850
+ var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("openLoginTerminal").withInput(openLoginTerminalInputSchema).withOutput(loginTerminalSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
86851
+ var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("warmComputer").withInput(computeWorkspaceInputSchema).withOutput(warmComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentLease").withInput(setWhatsappAgentLeaseInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappEveryAgent").withInput(setWhatsappEveryAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentAccess").withInput(setWhatsappAgentAccessInputSchema).withOutput(whatsappAgentsSchema).mutation("checkWhatsappNow").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).build();
86657
86852
  var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
86658
86853
  var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
86659
86854
  var restRenameInputDefinition = external_exports.object({
@@ -86724,6 +86919,7 @@ var computeUi = uiTokens("compute");
86724
86919
  var ComputeWhatsappMessagingSlot = computeUi.component("whatsapp-messaging");
86725
86920
  var ComputeBrowserTabSlot = computeUi.component("browser-tab");
86726
86921
  var ComputeOpenBrowserSlot = computeUi.component("open-browser");
86922
+ var ComputeLoginTerminalSlot = computeUi.component("login-terminal");
86727
86923
 
86728
86924
  // ../../modules/compute/contract/src/computer-copy.ts
86729
86925
  var COMPUTER_COPY_MAX_BYTES = 2 * 1024 * 1024 * 1024;
@@ -86812,7 +87008,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
86812
87008
  });
86813
87009
 
86814
87010
  // src/services/computer-copy-commands.service.ts
86815
- import { mkdtemp as mkdtemp2, open as open4, rm as rm12, stat as stat10 } from "node:fs/promises";
87011
+ import { mkdtemp as mkdtemp2, open as open4, rm as rm13, stat as stat10 } from "node:fs/promises";
86816
87012
  import { tmpdir as tmpdir4 } from "node:os";
86817
87013
  import { basename as basename8, dirname as dirname22, resolve as resolve11 } from "node:path";
86818
87014
  var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
@@ -86839,12 +87035,12 @@ async function sendParts2({
86839
87035
  }) {
86840
87036
  const { upload } = started;
86841
87037
  const parts = [];
86842
- const file3 = await open4(archive2, "r");
87038
+ const file4 = await open4(archive2, "r");
86843
87039
  try {
86844
87040
  for (const part of upload.parts) {
86845
87041
  const length = part.end - part.start;
86846
87042
  const bytes = Buffer.alloc(length);
86847
- await file3.read(bytes, 0, length, part.start);
87043
+ await file4.read(bytes, 0, length, part.start);
86848
87044
  const single = upload.mode === "single";
86849
87045
  const response = await context.fetcher(part.url, {
86850
87046
  method: "PUT",
@@ -86864,7 +87060,7 @@ async function sendParts2({
86864
87060
  `);
86865
87061
  }
86866
87062
  } finally {
86867
- await file3.close();
87063
+ await file4.close();
86868
87064
  }
86869
87065
  return upload.mode === "multipart" ? parts : [];
86870
87066
  }
@@ -86913,7 +87109,7 @@ It lands before ${done.agentName}'s next turn.
86913
87109
  `
86914
87110
  );
86915
87111
  } finally {
86916
- await rm12(dir, { recursive: true, force: true });
87112
+ await rm13(dir, { recursive: true, force: true });
86917
87113
  }
86918
87114
  }
86919
87115
 
@@ -87207,7 +87403,8 @@ async function computer({ context, args }) {
87207
87403
  import { readFile as readFile28 } from "node:fs/promises";
87208
87404
 
87209
87405
  // src/services/mcp-gateway.service.ts
87210
- import { readFile as readFile27 } from "node:fs/promises";
87406
+ import { mkdir as mkdir23, readFile as readFile27, writeFile as writeFile22 } from "node:fs/promises";
87407
+ import { basename as basename9, join as join26, resolve as resolve12 } from "node:path";
87211
87408
  import { createInterface as createInterface3 } from "node:readline";
87212
87409
  var TURN_HEADER = "x-laze-turn";
87213
87410
  function serveMcpGateway({
@@ -87257,6 +87454,7 @@ async function relayMcpLines({
87257
87454
  const relay2 = {
87258
87455
  readTurn,
87259
87456
  out: (text3) => context.out(text3),
87457
+ saveFile: (file4) => saveMailFile({ root: resolve12(context.cwd, MAIL_FILES_DIR), file: file4 }),
87260
87458
  post: async ({ line, turn }) => {
87261
87459
  const response = await context.fetcher(url2, {
87262
87460
  method: "POST",
@@ -87282,13 +87480,84 @@ async function relayMcpLines({
87282
87480
  clearInterval(timer);
87283
87481
  }
87284
87482
  }
87483
+ var MAIL_FILES_DIR = "mail-attachments";
87484
+ var SAVES_FILES_META = "laze/files";
87485
+ var FILE_META = "laze/file";
87486
+ function safeName(name3, fallback) {
87487
+ const printable = name3.replace(new RegExp("\\p{Cc}", "gu"), "");
87488
+ const last = basename9(printable.replaceAll("\\", "/"));
87489
+ return last && last !== "." && last !== ".." ? last : fallback;
87490
+ }
87491
+ async function saveMailFile({ root, file: file4 }) {
87492
+ const dir = join26(root, safeName(file4.messageId, "message"));
87493
+ const path = join26(dir, safeName(file4.fileName, "attachment"));
87494
+ await mkdir23(dir, { recursive: true });
87495
+ await writeFile22(path, Buffer.from(file4.base64, "base64"));
87496
+ return path;
87497
+ }
87498
+ function markSavesFiles(line) {
87499
+ try {
87500
+ const request2 = JSON.parse(line);
87501
+ if (request2.method !== "tools/call" || typeof request2.params !== "object" || !request2.params)
87502
+ return line;
87503
+ const meta3 = request2.params._meta;
87504
+ const own2 = typeof meta3 === "object" && meta3 !== null ? meta3 : {};
87505
+ request2.params._meta = { ...own2, [SAVES_FILES_META]: "save" };
87506
+ return JSON.stringify(request2);
87507
+ } catch {
87508
+ return line;
87509
+ }
87510
+ }
87511
+ function carriedFileOf(value) {
87512
+ if (typeof value !== "object" || value === null) return null;
87513
+ const file4 = value;
87514
+ const text3 = (key) => typeof file4[key] === "string" ? file4[key] : "";
87515
+ if (text3("base64") === "" && file4.sizeBytes !== 0) return null;
87516
+ return {
87517
+ messageId: text3("messageId"),
87518
+ fileName: text3("fileName"),
87519
+ contentType: text3("contentType") || "application/octet-stream",
87520
+ sizeBytes: typeof file4.sizeBytes === "number" ? file4.sizeBytes : 0,
87521
+ base64: text3("base64")
87522
+ };
87523
+ }
87524
+ async function withFileSaved({ relay: relay2, text: text3 }) {
87525
+ let answer6;
87526
+ try {
87527
+ answer6 = JSON.parse(text3);
87528
+ } catch {
87529
+ return text3;
87530
+ }
87531
+ const result2 = answer6.result;
87532
+ const meta3 = result2?._meta;
87533
+ if (!result2 || !meta3 || !(FILE_META in meta3)) return text3;
87534
+ const file4 = carriedFileOf(meta3[FILE_META]);
87535
+ const { [FILE_META]: _carried, ...rest } = meta3;
87536
+ const kept = Object.keys(rest).length > 0 ? { _meta: rest } : {};
87537
+ const { _meta: _old, ...plain3 } = result2;
87538
+ if (!file4) {
87539
+ const content = [{ type: "text", text: "The gateway sent a file this CLI could not read." }];
87540
+ return JSON.stringify({ ...answer6, result: { ...plain3, ...kept, content, isError: true } });
87541
+ }
87542
+ const what = `${file4.fileName} (${file4.contentType}, ${file4.sizeBytes} bytes)`;
87543
+ try {
87544
+ const path = await relay2.saveFile(file4);
87545
+ const content = [{ type: "text", text: `Saved ${what} to ${path}` }];
87546
+ return JSON.stringify({ ...answer6, result: { ...plain3, ...kept, content } });
87547
+ } catch (error63) {
87548
+ const why = error63 instanceof Error ? error63.message : "it could not be written";
87549
+ const content = [{ type: "text", text: `Could not save ${what}: ${why}` }];
87550
+ return JSON.stringify({ ...answer6, result: { ...plain3, ...kept, content, isError: true } });
87551
+ }
87552
+ }
87285
87553
  async function relayLine({
87286
87554
  relay: relay2,
87287
87555
  listed,
87288
87556
  line
87289
87557
  }) {
87290
87558
  const turn = await relay2.readTurn();
87291
- const text3 = await relay2.post({ line, turn });
87559
+ const posted = await relay2.post({ line: markSavesFiles(line), turn });
87560
+ const text3 = methodOf(line) === "tools/call" ? await withFileSaved({ relay: relay2, text: posted }) : posted;
87292
87561
  if (methodOf(line) === "tools/list") {
87293
87562
  const names = toolNamesOf(text3);
87294
87563
  if (names !== null) Object.assign(listed, { names, turn });
@@ -87339,8 +87608,8 @@ async function turnOf({ context }) {
87339
87608
  const env = context.environment.inherited;
87340
87609
  const pinned = env.LAZE_TURN_TOKEN?.trim();
87341
87610
  if (pinned) return pinned;
87342
- const file3 = env.LAZE_TURN_FILE;
87343
- const turn = file3 ? await readFile28(file3, "utf8").then(
87611
+ const file4 = env.LAZE_TURN_FILE;
87612
+ const turn = file4 ? await readFile28(file4, "utf8").then(
87344
87613
  (text3) => text3.trim(),
87345
87614
  () => ""
87346
87615
  ) : "";
@@ -87399,7 +87668,7 @@ async function connect({
87399
87668
 
87400
87669
  // src/services/connector-commands.service.ts
87401
87670
  import { readFile as readFile30 } from "node:fs/promises";
87402
- import { resolve as resolve12 } from "node:path";
87671
+ import { resolve as resolve13 } from "node:path";
87403
87672
 
87404
87673
  // src/services/vault-keychain-commands.service.ts
87405
87674
  import { readFile as readFile29 } from "node:fs/promises";
@@ -87819,8 +88088,8 @@ async function secretText({ context, args }) {
87819
88088
  "A secret never goes in a flag (shell history keeps it): pipe it on stdin or use --from-file."
87820
88089
  );
87821
88090
  }
87822
- const file3 = flagText({ args, name: "from-file" });
87823
- const text3 = file3 ? await readFile29(file3, "utf8") : await context.readStdin();
88091
+ const file4 = flagText({ args, name: "from-file" });
88092
+ const text3 = file4 ? await readFile29(file4, "utf8") : await context.readStdin();
87824
88093
  const trimmed = text3.replace(/\r?\n$/, "");
87825
88094
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
87826
88095
  return trimmed;
@@ -88052,8 +88321,8 @@ async function keyText({ context, args }) {
88052
88321
  if (KEY_FLAGS.some((flag2) => args.flags[flag2] !== void 0)) {
88053
88322
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
88054
88323
  }
88055
- const file3 = flagText({ args, name: "from-file" });
88056
- const text3 = file3 ? await readFile30(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
88324
+ const file4 = flagText({ args, name: "from-file" });
88325
+ const text3 = file4 ? await readFile30(resolve13(context.cwd, file4), "utf8") : await context.readStdin();
88057
88326
  const trimmed = text3.trim();
88058
88327
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
88059
88328
  return trimmed;
@@ -88375,7 +88644,7 @@ async function conversationDelete({ context, args }) {
88375
88644
 
88376
88645
  // src/services/discord-commands.service.ts
88377
88646
  import { readFile as readFile31 } from "node:fs/promises";
88378
- import { resolve as resolve13 } from "node:path";
88647
+ import { resolve as resolve14 } from "node:path";
88379
88648
 
88380
88649
  // ../../modules/discord/contract/src/discord.ts
88381
88650
  var workspaceIdSchema24 = external_exports.string().min(1).max(64);
@@ -88695,8 +88964,8 @@ async function secretsOf({ context, args }) {
88695
88964
  }
88696
88965
  const fromConnection = flagText({ args, name: "from-vault" });
88697
88966
  if (fromConnection) return { fromConnection };
88698
- const file3 = flagText({ args, name: "from-file" });
88699
- const text3 = file3 ? await readFile31(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
88967
+ const file4 = flagText({ args, name: "from-file" });
88968
+ const text3 = file4 ? await readFile31(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
88700
88969
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
88701
88970
  if (lines2.length !== 2) {
88702
88971
  throw new CliUsageError(
@@ -88966,8 +89235,8 @@ var DOMAINS_USAGE = `Usage:
88966
89235
  var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
88967
89236
  `);
88968
89237
  function printDomain(context, row) {
88969
- const join32 = row.autoJoin ? "auto-join on" : "auto-join off";
88970
- context.out(`${row.domain} ${join32}${row.enforced ? " single sign-on enforced" : ""}
89238
+ const join34 = row.autoJoin ? "auto-join on" : "auto-join off";
89239
+ context.out(`${row.domain} ${join34}${row.enforced ? " single sign-on enforced" : ""}
88971
89240
  `);
88972
89241
  }
88973
89242
  async function list4({ context, args }) {
@@ -89000,7 +89269,7 @@ async function domains({ context, args }) {
89000
89269
 
89001
89270
  // src/services/emoji-commands.service.ts
89002
89271
  import { readFile as readFile32 } from "node:fs/promises";
89003
- import { resolve as resolve14 } from "node:path";
89272
+ import { resolve as resolve15 } from "node:path";
89004
89273
  var EMOJI_USAGE = `Usage:
89005
89274
  laze emoji list [--json] the workspace's custom emoji, aliases and who added each
89006
89275
  laze emoji add <name> <file> [--alias <a,b>] add a PNG, JPEG or GIF as :name: (made 128px square)
@@ -89037,17 +89306,17 @@ async function listEmoji({ context, args, client }) {
89037
89306
  for (const each of list12.emoji) context.out(shown(each));
89038
89307
  }
89039
89308
  async function addEmoji({ context, args, client }) {
89040
- const file3 = wordAt4(args, 3);
89309
+ const file4 = wordAt4(args, 3);
89041
89310
  let bytes;
89042
89311
  try {
89043
- bytes = new Uint8Array(await readFile32(resolve14(context.cwd, file3)));
89312
+ bytes = new Uint8Array(await readFile32(resolve15(context.cwd, file4)));
89044
89313
  } catch {
89045
- throw new CliUsageError(`Cannot read ${file3}.`);
89314
+ throw new CliUsageError(`Cannot read ${file4}.`);
89046
89315
  }
89047
89316
  const aliases = flagText({ args, name: "alias" }).split(",").map((alias) => alias.trim()).filter(Boolean);
89048
89317
  const added = await client.post(EMOJI_KEY_PATHS.add, {
89049
89318
  name: wordAt4(args, 2),
89050
- contentType: contentTypeOf(file3),
89319
+ contentType: contentTypeOf(file4),
89051
89320
  dataBase64: Buffer.from(bytes).toString("base64"),
89052
89321
  aliases
89053
89322
  });
@@ -89357,7 +89626,7 @@ var ExternalSharingHooksToken = externalUi.hooks("sharing");
89357
89626
 
89358
89627
  // src/services/workspace-commands.service.ts
89359
89628
  import { readFile as readFile33 } from "node:fs/promises";
89360
- import { resolve as resolve15 } from "node:path";
89629
+ import { resolve as resolve16 } from "node:path";
89361
89630
  var ROLE_NAMES2 = {
89362
89631
  OWNER: "Owner",
89363
89632
  ADMIN: "Admin",
@@ -89536,26 +89805,26 @@ function logoTypeOf(bytes) {
89536
89805
  }
89537
89806
  var LOGO_MAX_BYTES = 512 * 1024;
89538
89807
  var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze workspace logo remove";
89539
- async function readLogo({ context, file: file3 }) {
89808
+ async function readLogo({ context, file: file4 }) {
89540
89809
  let bytes;
89541
89810
  try {
89542
- bytes = new Uint8Array(await readFile33(resolve15(context.cwd, file3)));
89811
+ bytes = new Uint8Array(await readFile33(resolve16(context.cwd, file4)));
89543
89812
  } catch {
89544
- throw new CliUsageError(`No file to read at ${file3}.`);
89813
+ throw new CliUsageError(`No file to read at ${file4}.`);
89545
89814
  }
89546
89815
  const contentType = logoTypeOf(bytes);
89547
89816
  if (!contentType) throw new CliUsageError("A logo must be a PNG, JPEG or WebP picture.");
89548
89817
  if (bytes.byteLength > LOGO_MAX_BYTES) {
89549
89818
  throw new CliUsageError(
89550
- `A logo must be at most 512 KB; ${file3} is ${Math.ceil(bytes.byteLength / 1024)} KB.`
89819
+ `A logo must be at most 512 KB; ${file4} is ${Math.ceil(bytes.byteLength / 1024)} KB.`
89551
89820
  );
89552
89821
  }
89553
89822
  return { contentType, dataBase64: Buffer.from(bytes).toString("base64") };
89554
89823
  }
89555
89824
  async function logo({ context, args }) {
89556
- const [, , action, file3] = args.words;
89557
- if (action === "set" && file3) {
89558
- const body = await readLogo({ context, file: file3 });
89825
+ const [, , action, file4] = args.words;
89826
+ if (action === "set" && file4) {
89827
+ const body = await readLogo({ context, file: file4 });
89559
89828
  const { client } = await signedIn({ context, args });
89560
89829
  const answer6 = await client.post("/api/agents/me/workspace/logo", body);
89561
89830
  return print7({ context, args, answer: answer6, text: (it) => `Set the logo of ${it.name}.
@@ -90140,7 +90409,7 @@ async function agentFeedAccess({
90140
90409
 
90141
90410
  // src/services/feed-commands.service.ts
90142
90411
  import { readFile as readFile34 } from "node:fs/promises";
90143
- import { resolve as resolve16 } from "node:path";
90412
+ import { resolve as resolve17 } from "node:path";
90144
90413
 
90145
90414
  // ../../modules/feed/contract/src/feed.delegate.ts
90146
90415
  var feedDelegateSchemaDefinition = external_exports.object({
@@ -91054,15 +91323,24 @@ var FEED_WRITING = `Write for a person deciding on a phone in a few seconds:
91054
91323
  no "Day 9." counters. Numbers only when they change the decision.
91055
91324
  - Not too terse either: whole sentences a person understands without context.
91056
91325
  - Replies and comments: same rules, short when you can.
91057
- - When you prepare a message for a person to send (email, Slack, LinkedIn), post a card
91058
- with the full text in --draft, the recipients and subject in
91326
+ - Anything for people outside the conversation (an email, a Slack, WhatsApp or LinkedIn
91327
+ message to someone else, a post) is a draft for your person first, on a card: a one-line
91328
+ ask as the title, the full text in --draft, the recipients and subject in
91059
91329
  --draft-header "To: ...
91060
91330
  Cc: ...
91061
- Subject: ...", an action to send it
91062
- (--action "Send it=<what to do>") and a --link to the exact draft
91063
- ("Open draft in Gmail=https://mail.google.com/mail/u/0/#drafts?compose=<draft message id>",
91064
- not the drafts folder). Never leave it only in Gmail drafts. If they edit the text on the
91065
- card, the press brings you the edited text: update the native draft with it, then send.
91331
+ Subject: ...", --action "Send it=<what to do>" and a
91332
+ --link that opens the original in its own app: for Gmail
91333
+ "Open thread with the draft=https://mail.google.com/mail/u/0/#all/<thread id>", else the
91334
+ Slack, WhatsApp or LinkedIn thread or the GitHub PR. For example:
91335
+ laze feed post "Reply to Dana about the renewal" --summary "She asked for the price by
91336
+ Friday" --draft @reply.md --draft-header "To: dana@acme.test
91337
+ Subject: Re: Renewal"
91338
+ --link "Open thread with the draft=https://mail.google.com/mail/u/0/#all/<thread id>"
91339
+ --action "Send it=Send this reply"
91340
+ - Send it only when they pressed Send on the card or told you in chat to send that exact
91341
+ message; a send approval card is not their review. After a send, say what went to whom.
91342
+ Never leave a draft only in Gmail drafts. If they edit the text on the card, the press
91343
+ brings you the edited text: update the native draft with it, then send.
91066
91344
  - A draft that sends a file carries the file: pass it with --file. Never name a file you
91067
91345
  did not attach; "Attach: deck.pdf" without a file is stopped unless you pass --force.
91068
91346
  The server pushes back with feed_hard_to_read when the text reads like a log, and with
@@ -91296,7 +91574,7 @@ async function bodyOf2({
91296
91574
  flags: flags2
91297
91575
  }) {
91298
91576
  const body = { ...flags2.fields };
91299
- const read4 = (source) => "file" in source ? readFile34(resolve16(context.cwd, source.file), "utf8") : source.text;
91577
+ const read4 = (source) => "file" in source ? readFile34(resolve17(context.cwd, source.file), "utf8") : source.text;
91300
91578
  for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
91301
91579
  if (flags2.rich) {
91302
91580
  const text3 = await read4(flags2.rich.source);
@@ -91312,13 +91590,13 @@ function keptFilesOf({
91312
91590
  files: files2,
91313
91591
  removing
91314
91592
  }) {
91315
- const matches = (file3, name3) => file3.id === name3 || file3.fileName === name3;
91316
- const unknown2 = removing.filter((name3) => !files2.some((file3) => matches(file3, name3)));
91593
+ const matches = (file4, name3) => file4.id === name3 || file4.fileName === name3;
91594
+ const unknown2 = removing.filter((name3) => !files2.some((file4) => matches(file4, name3)));
91317
91595
  if (unknown2.length > 0) {
91318
- const on = files2.map((file3) => `${file3.fileName} (${file3.id})`).join(", ") || "none";
91596
+ const on = files2.map((file4) => `${file4.fileName} (${file4.id})`).join(", ") || "none";
91319
91597
  throw new CliUsageError(`The card has no file ${unknown2.join(", ")}; its files: ${on}`);
91320
91598
  }
91321
- return files2.filter((file3) => !removing.some((name3) => matches(file3, name3)));
91599
+ return files2.filter((file4) => !removing.some((name3) => matches(file4, name3)));
91322
91600
  }
91323
91601
  function refuseNamedFilesMissing({
91324
91602
  args,
@@ -91403,7 +91681,7 @@ async function feedUpdate({ context, args }) {
91403
91681
  channel: current3.item.channelId,
91404
91682
  people: current3.recipientUserIds
91405
91683
  }) : [];
91406
- const attachmentIds = adding || removing.length > 0 ? [...kept.map((file3) => file3.id), ...added] : void 0;
91684
+ const attachmentIds = adding || removing.length > 0 ? [...kept.map((file4) => file4.id), ...added] : void 0;
91407
91685
  const inTurn2 = await feedTurnOf({
91408
91686
  context,
91409
91687
  client,
@@ -91559,7 +91837,7 @@ async function textFlag({
91559
91837
  }) {
91560
91838
  const value = flagText({ args, name: name3 });
91561
91839
  if (!value.startsWith("@")) return value;
91562
- return readFile34(resolve16(context.cwd, value.slice(1)), "utf8");
91840
+ return readFile34(resolve17(context.cwd, value.slice(1)), "utf8");
91563
91841
  }
91564
91842
  async function feedList({ context, args }) {
91565
91843
  const { client } = await signedIn({ context, args });
@@ -91647,9 +91925,9 @@ async function ranksOf({
91647
91925
  context,
91648
91926
  args
91649
91927
  }) {
91650
- const file3 = flagText({ args, name: "file" });
91651
- if (file3) {
91652
- const parsed = JSON.parse(await readFile34(resolve16(context.cwd, file3), "utf8"));
91928
+ const file4 = flagText({ args, name: "file" });
91929
+ if (file4) {
91930
+ const parsed = JSON.parse(await readFile34(resolve17(context.cwd, file4), "utf8"));
91653
91931
  if (Array.isArray(parsed)) return parsed;
91654
91932
  throw new CliUsageError("--file holds a list of {itemId, priority}");
91655
91933
  }
@@ -92261,6 +92539,10 @@ function heldLine(sent) {
92261
92539
  const saved3 = `Saved ${held} ${held === 1 ? "invitation" : "invitations"} for Team: Free holds 2 people.`;
92262
92540
  return emailed > 0 ? `Invited ${emailed}. ${saved3}` : saved3;
92263
92541
  }
92542
+ function personLines(sent) {
92543
+ return sent.invites.flatMap((one) => one.personId ? [`${one.email} is person ${one.personId}.
92544
+ `] : []).join("");
92545
+ }
92264
92546
  function refusedLines(refused) {
92265
92547
  const why = { invalid: "not an email address", duplicate: "listed twice", member: "already in" };
92266
92548
  return refused.map((one) => `Left out ${one.email}: ${why[one.reason]}.
@@ -92294,6 +92576,7 @@ async function invite3({ context, args }) {
92294
92576
  return;
92295
92577
  }
92296
92578
  context.out(refusedLines(sent.refused));
92579
+ context.out(personLines(sent));
92297
92580
  if (!quote4.upgradeNeeded) {
92298
92581
  context.out(`Invited ${sent.invites.length}.${sent.held ? " Some wait for seats." : ""}
92299
92582
  `);
@@ -92471,12 +92754,12 @@ async function ip({ context, args }) {
92471
92754
  }
92472
92755
 
92473
92756
  // src/services/join-commands.service.ts
92474
- import { mkdir as mkdir23, readFile as readFile36, rename as rename8, rm as rm13, writeFile as writeFile22 } from "node:fs/promises";
92475
- import { dirname as dirname23, join as join25 } from "node:path";
92757
+ import { mkdir as mkdir24, readFile as readFile36, rename as rename8, rm as rm14, writeFile as writeFile23 } from "node:fs/promises";
92758
+ import { dirname as dirname23, join as join27 } from "node:path";
92476
92759
  var DEFAULT_WAIT_SECONDS2 = 100;
92477
92760
  var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
92478
92761
  function pendingPathOf({ context }) {
92479
- return join25(dirname23(context.environment.configPath), "join", "pending.json");
92762
+ return join27(dirname23(context.environment.configPath), "join", "pending.json");
92480
92763
  }
92481
92764
  async function readPending({
92482
92765
  context,
@@ -92493,13 +92776,13 @@ async function readPending({
92493
92776
  }
92494
92777
  async function keepPending({ context, pending: pending2 }) {
92495
92778
  const path = pendingPathOf({ context });
92496
- await mkdir23(dirname23(path), { recursive: true, mode: 448 });
92779
+ await mkdir24(dirname23(path), { recursive: true, mode: 448 });
92497
92780
  const temporary = `${path}.${process.pid}.tmp`;
92498
- await writeFile22(temporary, JSON.stringify(pending2), { mode: 384 });
92781
+ await writeFile23(temporary, JSON.stringify(pending2), { mode: 384 });
92499
92782
  await rename8(temporary, path);
92500
92783
  }
92501
92784
  async function dropPending({ context }) {
92502
- await rm13(pendingPathOf({ context }), { force: true });
92785
+ await rm14(pendingPathOf({ context }), { force: true });
92503
92786
  }
92504
92787
  function waitSecondsOf3({ args }) {
92505
92788
  const raw = flagText({ args, name: "timeout" });
@@ -93634,17 +93917,17 @@ async function serveMcp({
93634
93917
 
93635
93918
  // src/services/memory-commands.service.ts
93636
93919
  import { readdir as readdir7, readFile as readFile38 } from "node:fs/promises";
93637
- import { join as join26, resolve as resolve18 } from "node:path";
93920
+ import { join as join28, resolve as resolve19 } from "node:path";
93638
93921
 
93639
93922
  // src/services/mount-files.service.ts
93640
- import { mkdir as mkdir24, readFile as readFile37, rm as rm14, writeFile as writeFile23 } from "node:fs/promises";
93641
- import { dirname as dirname24, relative as relative5, resolve as resolve17 } from "node:path";
93923
+ import { mkdir as mkdir25, readFile as readFile37, rm as rm15, writeFile as writeFile24 } from "node:fs/promises";
93924
+ import { dirname as dirname24, relative as relative5, resolve as resolve18 } from "node:path";
93642
93925
  async function textArgument({
93643
93926
  context,
93644
93927
  value
93645
93928
  }) {
93646
93929
  if (value === "-") return context.readStdin();
93647
- if (value.startsWith("@")) return readFile37(resolve17(context.cwd, value.slice(1)), "utf8");
93930
+ if (value.startsWith("@")) return readFile37(resolve18(context.cwd, value.slice(1)), "utf8");
93648
93931
  return value;
93649
93932
  }
93650
93933
  function turnChannel({ context, args }) {
@@ -93656,16 +93939,16 @@ async function writeMount({
93656
93939
  folder,
93657
93940
  files: files2
93658
93941
  }) {
93659
- const root = resolve17(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
93660
- await rm14(root, { recursive: true, force: true });
93661
- await mkdir24(root, { recursive: true });
93662
- for (const file3 of files2) {
93663
- const target = resolve17(root, file3.path);
93942
+ const root = resolve18(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
93943
+ await rm15(root, { recursive: true, force: true });
93944
+ await mkdir25(root, { recursive: true });
93945
+ for (const file4 of files2) {
93946
+ const target = resolve18(root, file4.path);
93664
93947
  const inside = relative5(root, target);
93665
93948
  if (!inside || inside.startsWith(".."))
93666
- throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
93667
- await mkdir24(dirname24(target), { recursive: true });
93668
- await writeFile23(target, file3.content);
93949
+ throw new Error(`Refusing to write outside ${root}: ${file4.path}`);
93950
+ await mkdir25(dirname24(target), { recursive: true });
93951
+ await writeFile24(target, file4.content);
93669
93952
  }
93670
93953
  return root;
93671
93954
  }
@@ -93697,10 +93980,10 @@ An agent reaches only its turn: another --channel or person is refused with memo
93697
93980
  var PROVENANCES = ["said", "decided", "verified", "inferred", "observed"];
93698
93981
  var FILES = /* @__PURE__ */ new Set(["SOUL.md", "AGENTS.md", "MEMORY.md"]);
93699
93982
  function fileRef({ context, args }) {
93700
- const file3 = args.words[2] ?? "";
93701
- if (!FILES.has(file3)) throw new CliUsageError(USAGE13);
93983
+ const file4 = args.words[2] ?? "";
93984
+ if (!FILES.has(file4)) throw new CliUsageError(USAGE13);
93702
93985
  const channel = turnChannel({ context, args });
93703
- return { file: file3, ...channel ? { channel } : {} };
93986
+ return { file: file4, ...channel ? { channel } : {} };
93704
93987
  }
93705
93988
  function printDocument({
93706
93989
  context,
@@ -93920,16 +94203,16 @@ async function siestaImport({
93920
94203
  args,
93921
94204
  dir
93922
94205
  }) {
93923
- const root = resolve18(context.cwd, dir);
93924
- const log = await readFile38(join26(root, "LOG.md"));
93925
- const names = (await readdir7(join26(root, "tree")).catch(() => [])).filter(
94206
+ const root = resolve19(context.cwd, dir);
94207
+ const log = await readFile38(join28(root, "LOG.md"));
94208
+ const names = (await readdir7(join28(root, "tree")).catch(() => [])).filter(
93926
94209
  (name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
93927
94210
  );
93928
94211
  const tree = Object.fromEntries(
93929
94212
  await Promise.all(
93930
94213
  names.map(async (name3) => [
93931
94214
  name3.slice(0, -3),
93932
- (await readFile38(join26(root, "tree", name3))).toString("base64")
94215
+ (await readFile38(join28(root, "tree", name3))).toString("base64")
93933
94216
  ])
93934
94217
  )
93935
94218
  );
@@ -93948,16 +94231,16 @@ async function memoryImport({ context, args }) {
93948
94231
  if (siesta) return siestaImport({ context, args, dir: siesta });
93949
94232
  const dir = flagText({ args, name: "optmem" });
93950
94233
  if (!dir) throw new CliUsageError(USAGE13);
93951
- const root = resolve18(context.cwd, dir);
93952
- const log = await readFile38(join26(root, "LOG.txt"));
93953
- const sizes2 = (await readdir7(join26(root, "TREE")).catch(() => [])).filter(
94234
+ const root = resolve19(context.cwd, dir);
94235
+ const log = await readFile38(join28(root, "LOG.txt"));
94236
+ const sizes2 = (await readdir7(join28(root, "TREE")).catch(() => [])).filter(
93954
94237
  (name3) => /^\d{1,4}$/.test(name3)
93955
94238
  );
93956
94239
  const tree = Object.fromEntries(
93957
94240
  await Promise.all(
93958
94241
  sizes2.map(async (size) => [
93959
94242
  size,
93960
- (await readFile38(join26(root, "TREE", size))).toString("base64")
94243
+ (await readFile38(join28(root, "TREE", size))).toString("base64")
93961
94244
  ])
93962
94245
  )
93963
94246
  );
@@ -94318,7 +94601,7 @@ async function notifications({ context, args }) {
94318
94601
  }
94319
94602
 
94320
94603
  // src/services/openclaw-commands.service.ts
94321
- import { resolve as resolve19 } from "node:path";
94604
+ import { resolve as resolve20 } from "node:path";
94322
94605
  var OPENCLAW_USAGE = `Usage (a person's key; a gateway belongs to the person who connects it):
94323
94606
  laze openclaw list the gateways connected here and their agents
94324
94607
  laze openclaw connect <wss url> [--label <label>] (< token | --from-file <file> | --from-vault <connection>)
@@ -94469,7 +94752,7 @@ var agentKey = async ({ context, args, client, url: url2 }) => {
94469
94752
  });
94470
94753
  const login2 = flagText({ args, name: "login" });
94471
94754
  if (login2) {
94472
- const folder = resolve19(context.cwd, login2);
94755
+ const folder = resolve20(context.cwd, login2);
94473
94756
  const profile = profileNameOf(key.agentName);
94474
94757
  await signInFolder({ context, url: url2, token: key.token, name: profile, folder });
94475
94758
  context.out(
@@ -94521,9 +94804,9 @@ async function openclaw({
94521
94804
  }
94522
94805
 
94523
94806
  // src/services/operator-key-commands.service.ts
94524
- import { createHash as createHash6, randomBytes as randomBytes3 } from "node:crypto";
94525
- import { mkdir as mkdir25, readFile as readFile39, rm as rm15, writeFile as writeFile24 } from "node:fs/promises";
94526
- import { dirname as dirname25, join as join27 } from "node:path";
94807
+ import { createHash as createHash7, randomBytes as randomBytes3 } from "node:crypto";
94808
+ import { mkdir as mkdir26, readFile as readFile39, rm as rm16, writeFile as writeFile25 } from "node:fs/promises";
94809
+ import { dirname as dirname25, join as join29 } from "node:path";
94527
94810
 
94528
94811
  // ../../modules/audit-log/contract/src/audit-log.api.ts
94529
94812
  var auditEntrySchemaDefinition = external_exports.object({
@@ -94958,9 +95241,20 @@ var workspaceInviteSchemaDefinition = external_exports.object({
94958
95241
  /** Where the invited person lands on joining; null for the workspace's Home. */
94959
95242
  landing: inviteLandingSchema.nullable().optional(),
94960
95243
  /** Held for Team, so its seat is paid for from the checkout on, before anyone accepts. */
94961
- seatReserved: external_exports.boolean().optional()
95244
+ seatReserved: external_exports.boolean().optional(),
95245
+ /** The invited person's id: members message them and give them things before they join. */
95246
+ personId: external_exports.string().optional()
94962
95247
  });
94963
95248
  var workspaceInviteSchema = workspaceInviteSchemaDefinition;
95249
+ var workspaceInviteeSchemaDefinition = external_exports.object({
95250
+ userId: external_exports.string().min(1),
95251
+ inviteId: external_exports.string().min(1),
95252
+ email: external_exports.string(),
95253
+ status: external_exports.enum(["pending", "held", "expired"]),
95254
+ invitedByUserId: external_exports.string(),
95255
+ invitedAt: external_exports.iso.datetime()
95256
+ });
95257
+ var workspaceInviteeSchema = workspaceInviteeSchemaDefinition;
94964
95258
  var invitePreviewSchemaDefinition = external_exports.object({
94965
95259
  workspaceName: external_exports.string(),
94966
95260
  email: external_exports.string(),
@@ -95099,7 +95393,7 @@ var settingsCopy = {
95099
95393
  paintOnly: true,
95100
95394
  storable: (copy2) => copy2
95101
95395
  };
95102
- var workspaceTrpc = defineTrpcContract("workspace").mutation("create").withInput(createWorkspaceInputSchema).withOutput(workspaceCreatedSchema).query("get", { mirrored: settingsCopy }).withInput(workspaceIdInputSchema).withOutput(workspaceSchema).query("mine").withInput(external_exports.object({})).withOutput(external_exports.array(myWorkspaceSchema)).query("members").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceMemberSchema)).query("myMembership").withInput(workspaceIdInputSchema).withOutput(workspaceMemberSchema.nullable()).mutation("setMyAliases").withInput(setAliasesInputSchema).withOutput(workspaceMemberSchema).mutation("changeRole").withInput(changeRoleInputSchema).withOutput(workspaceMemberSchema).mutation("removeMember").withInput(removeMemberInputSchema2).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("leave").withInput(workspaceIdInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("invite").withInput(inviteMemberInputSchema).withOutput(workspaceInviteSchema).mutation("inviteMany").withInput(inviteManyInputSchema).withOutput(inviteManyResultSchema).mutation("requestInvites").withInput(inviteManyInputSchema).withOutput(requestInvitesResultSchema).query("invites").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceInviteSchema)).mutation("revokeInvite").withInput(revokeInviteInputSchema).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).mutation("copyInviteLink").withInput(revokeInviteInputSchema).withOutput(copiedInviteLinkSchema).query("previewInvite").withInput(inviteLinkInputSchema).withOutput(invitePreviewSchema).mutation("acceptInvite").withInput(inviteLinkInputSchema).withOutput(acceptedInviteSchema).mutation("rename").withInput(renameWorkspaceInputSchema).withOutput(workspaceSchema).mutation("setLogo").withInput(setWorkspaceLogoInputSchema).withOutput(workspaceSchema).mutation("removeLogo").withInput(workspaceIdInputSchema).withOutput(workspaceSchema).mutation("delete").withInput(deleteWorkspaceInputSchema).withOutput(workspaceSchema).mutation("cancelDeletion").withInput(workspaceIdInputSchema).withOutput(workspaceSchema).mutation("requestInvite").withInput(requestInviteInputSchema).withOutput(accessRequestSchema).query("accessRequests").withInput(workspaceIdInputSchema).withOutput(external_exports.array(accessRequestSchema)).mutation("decideAccessRequest").withInput(decideAccessRequestInputSchema).withOutput(accessRequestSchema).mutation("withdrawJoinRequest").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), requestId: external_exports.string().min(1) })).withOutput(accessRequestSchema).query("groups").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceGroupSchema)).mutation("createGroup").withInput(createGroupInputSchema).withOutput(workspaceGroupSchema).mutation("renameGroup").withInput(renameGroupInputSchema).withOutput(workspaceGroupSchema).mutation("deleteGroup").withInput(groupInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("changeGroupMembers").withInput(changeGroupMembersInputSchema).withOutput(workspaceGroupSchema).build();
95396
+ var workspaceTrpc = defineTrpcContract("workspace").mutation("create").withInput(createWorkspaceInputSchema).withOutput(workspaceCreatedSchema).query("get", { mirrored: settingsCopy }).withInput(workspaceIdInputSchema).withOutput(workspaceSchema).query("mine").withInput(external_exports.object({})).withOutput(external_exports.array(myWorkspaceSchema)).query("members").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceMemberSchema)).query("myMembership").withInput(workspaceIdInputSchema).withOutput(workspaceMemberSchema.nullable()).mutation("setMyAliases").withInput(setAliasesInputSchema).withOutput(workspaceMemberSchema).mutation("changeRole").withInput(changeRoleInputSchema).withOutput(workspaceMemberSchema).mutation("removeMember").withInput(removeMemberInputSchema2).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("leave").withInput(workspaceIdInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("invite").withInput(inviteMemberInputSchema).withOutput(workspaceInviteSchema).mutation("inviteMany").withInput(inviteManyInputSchema).withOutput(inviteManyResultSchema).mutation("requestInvites").withInput(inviteManyInputSchema).withOutput(requestInvitesResultSchema).query("invites").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceInviteSchema)).query("invitees").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceInviteeSchema)).mutation("revokeInvite").withInput(revokeInviteInputSchema).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).mutation("copyInviteLink").withInput(revokeInviteInputSchema).withOutput(copiedInviteLinkSchema).query("previewInvite").withInput(inviteLinkInputSchema).withOutput(invitePreviewSchema).mutation("acceptInvite").withInput(inviteLinkInputSchema).withOutput(acceptedInviteSchema).mutation("rename").withInput(renameWorkspaceInputSchema).withOutput(workspaceSchema).mutation("setLogo").withInput(setWorkspaceLogoInputSchema).withOutput(workspaceSchema).mutation("removeLogo").withInput(workspaceIdInputSchema).withOutput(workspaceSchema).mutation("delete").withInput(deleteWorkspaceInputSchema).withOutput(workspaceSchema).mutation("cancelDeletion").withInput(workspaceIdInputSchema).withOutput(workspaceSchema).mutation("requestInvite").withInput(requestInviteInputSchema).withOutput(accessRequestSchema).query("accessRequests").withInput(workspaceIdInputSchema).withOutput(external_exports.array(accessRequestSchema)).mutation("decideAccessRequest").withInput(decideAccessRequestInputSchema).withOutput(accessRequestSchema).mutation("withdrawJoinRequest").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), requestId: external_exports.string().min(1) })).withOutput(accessRequestSchema).query("groups").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceGroupSchema)).mutation("createGroup").withInput(createGroupInputSchema).withOutput(workspaceGroupSchema).mutation("renameGroup").withInput(renameGroupInputSchema).withOutput(workspaceGroupSchema).mutation("deleteGroup").withInput(groupInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("changeGroupMembers").withInput(changeGroupMembersInputSchema).withOutput(workspaceGroupSchema).build();
95103
95397
 
95104
95398
  // ../../modules/workspace/contract/src/workspace.config.ts
95105
95399
  var workspaceConfig = Config.define((c) => ({
@@ -95132,6 +95426,7 @@ var WorkspaceAlertsSlot = workspaceUi.extension("frame.alerts");
95132
95426
  var WorkspaceSidebarSlot = workspaceUi.component("sidebar");
95133
95427
  var WorkspaceSidebarHeadSlot = workspaceUi.component("sidebar.head");
95134
95428
  var WorkspaceSidebarTopSlot = workspaceUi.component("sidebar.top");
95429
+ var WorkspaceSidebarInvitesSlot = workspaceUi.extension("sidebar.invites");
95135
95430
  var WorkspaceSidebarFooterSlot = workspaceUi.extension("sidebar.footer");
95136
95431
  var WorkspaceInviteDialogSlot = workspaceUi.component("inviteDialog");
95137
95432
  var ProfileHooksToken = workspaceUi.hooks("profile");
@@ -95143,6 +95438,10 @@ var memberRemovedDefinition = external_exports.object({
95143
95438
  /** ISO 8601. */
95144
95439
  at: external_exports.iso.datetime()
95145
95440
  });
95441
+ var inviteeReleasedDefinition = external_exports.object({
95442
+ ...memberRemovedDefinition.shape,
95443
+ email: external_exports.string().optional()
95444
+ });
95146
95445
  var memberErasedDefinition = external_exports.object({
95147
95446
  workspaceId: external_exports.string().min(1),
95148
95447
  userId: external_exports.string().min(1),
@@ -95852,15 +96151,15 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
95852
96151
  laze ops status <key> waiting, approved or ended
95853
96152
  laze ops use <key> run the approved action and print the answer`;
95854
96153
  var POLL_MS3 = 5e3;
95855
- var keyFile = ({ context, keyId }) => join27(dirname25(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
96154
+ var keyFile = ({ context, keyId }) => join29(dirname25(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
95856
96155
  async function saveSecret({
95857
96156
  context,
95858
96157
  keyId,
95859
96158
  secret
95860
96159
  }) {
95861
96160
  const path = keyFile({ context, keyId });
95862
- await mkdir25(dirname25(path), { recursive: true, mode: 448 });
95863
- await writeFile24(path, secret, { mode: 384 });
96161
+ await mkdir26(dirname25(path), { recursive: true, mode: 448 });
96162
+ await writeFile25(path, secret, { mode: 384 });
95864
96163
  }
95865
96164
  function typedArg(text3) {
95866
96165
  if (["true", "false", "null"].includes(text3)) return JSON.parse(text3);
@@ -95917,7 +96216,7 @@ async function requestKey({ context, args }) {
95917
96216
  target,
95918
96217
  args: argsOf({ args }),
95919
96218
  reason: reason2,
95920
- secretHash: createHash6("sha256").update(secret).digest("hex")
96219
+ secretHash: createHash7("sha256").update(secret).digest("hex")
95921
96220
  });
95922
96221
  await saveSecret({ context, keyId: key.id, secret });
95923
96222
  const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
@@ -95944,7 +96243,7 @@ async function forgetIfOver({
95944
96243
  const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
95945
96244
  const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
95946
96245
  if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
95947
- await rm15(keyFile({ context, keyId }), { force: true });
96246
+ await rm16(keyFile({ context, keyId }), { force: true });
95948
96247
  }
95949
96248
  return key;
95950
96249
  }
@@ -96018,8 +96317,8 @@ ${OPS_USAGE}`);
96018
96317
  }
96019
96318
 
96020
96319
  // src/services/release-watch.service.ts
96021
- import { mkdir as mkdir26, readFile as readFile40, realpath, writeFile as writeFile25 } from "node:fs/promises";
96022
- import { dirname as dirname26, join as join28 } from "node:path";
96320
+ import { mkdir as mkdir27, readFile as readFile40, realpath, writeFile as writeFile26 } from "node:fs/promises";
96321
+ import { dirname as dirname26, join as join30 } from "node:path";
96023
96322
 
96024
96323
  // src/rules/cli-update.rules.ts
96025
96324
  var CLI_PACKAGE = "@lazehq/cli";
@@ -96166,15 +96465,15 @@ async function startedUpdate({
96166
96465
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
96167
96466
  if (plan2.kind !== "install") return null;
96168
96467
  const folder = dirname26(context.environment.configPath);
96169
- const stamp = join28(folder, "auto-update.json");
96468
+ const stamp = join30(folder, "auto-update.json");
96170
96469
  const last = await readFile40(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
96171
96470
  const now = context.nowMs();
96172
96471
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
96173
- await mkdir26(folder, { recursive: true, mode: 448 });
96174
- await writeFile25(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
96472
+ await mkdir27(folder, { recursive: true, mode: 448 });
96473
+ await writeFile26(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
96175
96474
  context.processes.spawnDetached({
96176
96475
  argv: [...context.program, "update"],
96177
- logPath: join28(folder, "auto-update.log")
96476
+ logPath: join30(folder, "auto-update.log")
96178
96477
  });
96179
96478
  return { manager: plan2.manager };
96180
96479
  }
@@ -96211,7 +96510,7 @@ function watchingRelease({
96211
96510
  }
96212
96511
 
96213
96512
  // src/services/rush-guard.service.ts
96214
- import { readFile as readFile41, rm as rm16 } from "node:fs/promises";
96513
+ import { readFile as readFile41, rm as rm17 } from "node:fs/promises";
96215
96514
  var WATCH_MS3 = 2e3;
96216
96515
  var RETRY_MS2 = 3e4;
96217
96516
  async function guardRound(guard) {
@@ -96283,10 +96582,10 @@ async function rushWakeHook({ context, args }) {
96283
96582
  return 0;
96284
96583
  } finally {
96285
96584
  if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
96286
- await rm16(lock, { force: true });
96585
+ await rm17(lock, { force: true });
96287
96586
  }
96288
96587
  } finally {
96289
- await rm16(path, { force: true });
96588
+ await rm17(path, { force: true });
96290
96589
  }
96291
96590
  }
96292
96591
 
@@ -96453,7 +96752,7 @@ async function schedule({ context, args }) {
96453
96752
 
96454
96753
  // src/services/skill-commands.service.ts
96455
96754
  import { readdir as readdir8, readFile as readFile42 } from "node:fs/promises";
96456
- import { join as join29, relative as relative6, resolve as resolve20 } from "node:path";
96755
+ import { join as join31, relative as relative6, resolve as resolve21 } from "node:path";
96457
96756
  var USAGE17 = `Usage:
96458
96757
  laze skill list [--agent <agentId>]
96459
96758
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -96474,7 +96773,7 @@ async function folderFiles({ root }) {
96474
96773
  const files2 = [];
96475
96774
  for (const entry of entries) {
96476
96775
  if (!entry.isFile()) continue;
96477
- const full = join29(entry.parentPath, entry.name);
96776
+ const full = join31(entry.parentPath, entry.name);
96478
96777
  files2.push({ path: relative6(root, full), content: await readFile42(full, "utf8") });
96479
96778
  }
96480
96779
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
@@ -96506,7 +96805,7 @@ async function skillInstall({ context, args }) {
96506
96805
  if (!catalogueId === !from) throw new CliUsageError(USAGE17);
96507
96806
  const name3 = flagText({ args, name: "as" });
96508
96807
  const agent3 = flagText({ args, name: "agent" });
96509
- const files2 = from ? await folderFiles({ root: resolve20(context.cwd, from) }) : void 0;
96808
+ const files2 = from ? await folderFiles({ root: resolve21(context.cwd, from) }) : void 0;
96510
96809
  const { client } = await signedIn({ context, args });
96511
96810
  const installed = await client.post("/api/skills/install", {
96512
96811
  ...catalogueId ? { catalogueId } : {},
@@ -96532,9 +96831,9 @@ async function skillShow({ context, args }) {
96532
96831
  `);
96533
96832
  context.out(`${skill2.name}${skill2.installed ? "" : " (not installed)"}: ${skill2.description}
96534
96833
  `);
96535
- for (const file3 of skill2.files) context.out(` ${file3.path}
96834
+ for (const file4 of skill2.files) context.out(` ${file4.path}
96536
96835
  `);
96537
- const skillMd = skill2.files.find((file3) => file3.path === "SKILL.md");
96836
+ const skillMd = skill2.files.find((file4) => file4.path === "SKILL.md");
96538
96837
  if (skillMd) context.out(`
96539
96838
  ${skillMd.content}`);
96540
96839
  }
@@ -96573,7 +96872,7 @@ async function skillUpdate({ context, args }) {
96573
96872
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
96574
96873
  throw new CliUsageError(USAGE17);
96575
96874
  }
96576
- const skillMd = skillMdFile ? await readFile42(resolve20(context.cwd, skillMdFile), "utf8") : void 0;
96875
+ const skillMd = skillMdFile ? await readFile42(resolve21(context.cwd, skillMdFile), "utf8") : void 0;
96577
96876
  const { client } = await signedIn({ context, args });
96578
96877
  const updated = await client.post("/api/skills/update", {
96579
96878
  name: name3,
@@ -96620,7 +96919,7 @@ async function skill({ context, args }) {
96620
96919
 
96621
96920
  // src/services/slack-commands.service.ts
96622
96921
  import { readFile as readFile43 } from "node:fs/promises";
96623
- import { resolve as resolve21 } from "node:path";
96922
+ import { resolve as resolve22 } from "node:path";
96624
96923
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
96625
96924
  laze slack overview connected Slack workspaces, mirrors, your link
96626
96925
  laze slack link-prompts Slack workspaces you have not linked yet
@@ -96666,8 +96965,8 @@ async function secretLines({ context, args }) {
96666
96965
  if (SECRET_FLAGS3.some((flag2) => args.flags[flag2] !== void 0)) {
96667
96966
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
96668
96967
  }
96669
- const file3 = flagText({ args, name: "from-file" });
96670
- const text3 = file3 ? await readFile43(resolve21(context.cwd, file3), "utf8") : await context.readStdin();
96968
+ const file4 = flagText({ args, name: "from-file" });
96969
+ const text3 = file4 ? await readFile43(resolve22(context.cwd, file4), "utf8") : await context.readStdin();
96671
96970
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
96672
96971
  }
96673
96972
  async function secretsOf2({
@@ -97057,8 +97356,8 @@ function refuseSecretFlags({ args }) {
97057
97356
  }
97058
97357
  }
97059
97358
  async function clientSecretOf({ context, args }) {
97060
- const file3 = flagText({ args, name: "from-file" });
97061
- const text3 = file3 ? await readFile44(file3, "utf8") : await context.readStdin();
97359
+ const file4 = flagText({ args, name: "from-file" });
97360
+ const text3 = file4 ? await readFile44(file4, "utf8") : await context.readStdin();
97062
97361
  const secret = text3.trim();
97063
97362
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
97064
97363
  return secret;
@@ -97391,7 +97690,7 @@ async function update2({
97391
97690
 
97392
97691
  // src/services/vault-env-commands.service.ts
97393
97692
  import { readFile as readFile45, stat as stat11 } from "node:fs/promises";
97394
- import { dirname as dirname27, join as join30, resolve as resolve22 } from "node:path";
97693
+ import { dirname as dirname27, join as join32, resolve as resolve23 } from "node:path";
97395
97694
 
97396
97695
  // src/rules/vault-manifest.rules.ts
97397
97696
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -97425,12 +97724,12 @@ function lineOf4({ line, where }) {
97425
97724
  if (reference?.[1]) return { kind: "reference", variable, ref: refOf(reference[1]) };
97426
97725
  return { kind: "plain", variable, value: unquoted(value) };
97427
97726
  }
97428
- function parseManifest({ text: text3, file: file3 }) {
97727
+ function parseManifest({ text: text3, file: file4 }) {
97429
97728
  const lines2 = [];
97430
97729
  for (const [index, raw] of text3.split(/\r?\n/).entries()) {
97431
97730
  const line = raw.trim().replace(/^export\s+/, "");
97432
97731
  if (!line || line.startsWith("#")) continue;
97433
- lines2.push(lineOf4({ line, where: `${file3}:${index + 1}` }));
97732
+ lines2.push(lineOf4({ line, where: `${file4}:${index + 1}` }));
97434
97733
  }
97435
97734
  return lines2;
97436
97735
  }
@@ -97479,7 +97778,7 @@ function credentialProcessJson(fields) {
97479
97778
  }
97480
97779
 
97481
97780
  // src/services/vault-batch.service.ts
97482
- import { rm as rm17 } from "node:fs/promises";
97781
+ import { rm as rm18 } from "node:fs/promises";
97483
97782
  async function batchOf({ response }) {
97484
97783
  const text3 = await response.text();
97485
97784
  if (!response.ok) {
@@ -97661,7 +97960,7 @@ async function valuesOf({
97661
97960
  }) {
97662
97961
  const refused = refusalOf({ context, settled: settled2 });
97663
97962
  if (refused !== 0) {
97664
- await rm17(keyPath, { force: true });
97963
+ await rm18(keyPath, { force: true });
97665
97964
  return { exitCode: refused };
97666
97965
  }
97667
97966
  const opened = /* @__PURE__ */ new Map();
@@ -97673,7 +97972,7 @@ async function valuesOf({
97673
97972
  if (release2.message) context.err(`${release2.message}
97674
97973
  `);
97675
97974
  }
97676
- if (!keep2) await rm17(keyPath, { force: true });
97975
+ if (!keep2) await rm18(keyPath, { force: true });
97677
97976
  const released = /* @__PURE__ */ new Map();
97678
97977
  for (const entry of entries) {
97679
97978
  const fields = opened.get(keyOf(entry));
@@ -97736,25 +98035,25 @@ async function manifestPathOf({
97736
98035
  args
97737
98036
  }) {
97738
98037
  const named = args.words[2];
97739
- if (named) return resolve22(context.cwd, named);
98038
+ if (named) return resolve23(context.cwd, named);
97740
98039
  const environment = flagText({ args, name: "env" });
97741
- const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
97742
- for (let dir = resolve22(context.cwd); ; dir = dirname27(dir)) {
97743
- if (await isFile(join30(dir, file3))) return join30(dir, file3);
98040
+ const file4 = environment ? `.env.${environment}.vault` : ".env.vault";
98041
+ for (let dir = resolve23(context.cwd); ; dir = dirname27(dir)) {
98042
+ if (await isFile(join32(dir, file4))) return join32(dir, file4);
97744
98043
  if (dirname27(dir) === dir) break;
97745
98044
  }
97746
- throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
98045
+ throw new CliUsageError(`laze vault: no ${file4} here or in a parent folder
97747
98046
  ${ENV_USAGE}`);
97748
98047
  }
97749
98048
  async function manifestOf({
97750
98049
  context,
97751
98050
  args
97752
98051
  }) {
97753
- const file3 = await manifestPathOf({ context, args });
97754
- const text3 = await readFile45(file3, "utf8").catch(() => {
97755
- throw new CliUsageError(`laze vault: cannot read ${file3}`);
98052
+ const file4 = await manifestPathOf({ context, args });
98053
+ const text3 = await readFile45(file4, "utf8").catch(() => {
98054
+ throw new CliUsageError(`laze vault: cannot read ${file4}`);
97756
98055
  });
97757
- return { file: file3, lines: parseManifest({ text: text3, file: file3 }) };
98056
+ return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
97758
98057
  }
97759
98058
  async function printNames({
97760
98059
  context,
@@ -98067,7 +98366,7 @@ async function vaultScrub({ context, args }) {
98067
98366
 
98068
98367
  // src/services/whatsapp-business-commands.service.ts
98069
98368
  import { readFile as readFile46 } from "node:fs/promises";
98070
- import { resolve as resolve23 } from "node:path";
98369
+ import { resolve as resolve24 } from "node:path";
98071
98370
 
98072
98371
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
98073
98372
  var whatsappBusinessCategorySchema = external_exports.enum([
@@ -98485,8 +98784,8 @@ async function secretsOf3({ context, args }) {
98485
98784
  }
98486
98785
  const fromConnection = flagText({ args, name: "from-vault" });
98487
98786
  if (fromConnection) return { fromConnection };
98488
- const file3 = flagText({ args, name: "from-file" });
98489
- const text3 = file3 ? await readFile46(resolve23(context.cwd, file3), "utf8") : await context.readStdin();
98787
+ const file4 = flagText({ args, name: "from-file" });
98788
+ const text3 = file4 ? await readFile46(resolve24(context.cwd, file4), "utf8") : await context.readStdin();
98490
98789
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
98491
98790
  if (lines2.length !== 2) {
98492
98791
  throw new CliUsageError(
@@ -98686,6 +98985,10 @@ async function whatsappBusiness({
98686
98985
  return run4({ context, args, client });
98687
98986
  }
98688
98987
 
98988
+ // src/services/whatsapp-commands.service.ts
98989
+ import { writeFile as writeFile27 } from "node:fs/promises";
98990
+ import { basename as basename10, resolve as resolve25 } from "node:path";
98991
+
98689
98992
  // src/services/whatsapp-pairing-commands.service.ts
98690
98993
  var WHATSAPP_PAIRING_USAGE = " laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)";
98691
98994
  async function unpair({ context, args }) {
@@ -98708,8 +99011,10 @@ function whatsappPairingCommand(name3) {
98708
99011
  var PATHS3 = {
98709
99012
  chats: "/api/compute/whatsapp/chats",
98710
99013
  read: "/api/compute/whatsapp/read",
99014
+ file: "/api/compute/whatsapp/file",
98711
99015
  send: "/api/compute/whatsapp/send",
98712
- sendStatus: "/api/compute/whatsapp/send-status"
99016
+ sendStatus: "/api/compute/whatsapp/send-status",
99017
+ sync: "/api/compute/whatsapp/sync"
98713
99018
  };
98714
99019
  var STATUS_WAIT_SECONDS2 = 50;
98715
99020
  var STATUS_CALLS2 = 2;
@@ -98719,8 +99024,10 @@ var USAGE19 = [
98719
99024
  "Usage: laze whatsapp chats [<machine>] [--limit <n>] the chats, newest first",
98720
99025
  " laze whatsapp read [<machine>] <chat> [--limit <n>] a chat's last messages, oldest first",
98721
99026
  " (a read your owner set to Always ask waits for their answer; --request <id> picks it up later)",
99027
+ " laze whatsapp file [<machine>] <chat> <message-id> [--out <path>] save a message's photo, voice message or file",
98722
99028
  ' laze whatsapp send <machine> <chat> "<text>" send as the owner; an agent waits for their approval',
98723
99029
  " laze whatsapp status <send-id> where a send stands",
99030
+ " laze whatsapp sync [<machine>] check WhatsApp now (the owner only)",
98724
99031
  WHATSAPP_PAIRING_USAGE,
98725
99032
  "With no machine it is the WhatsApp linked on your (or your agent's owner's) Laze computer.",
98726
99033
  "A chat is its id, a phone number or a contact or group name."
@@ -98794,7 +99101,41 @@ async function read3({ context, args }) {
98794
99101
  `);
98795
99102
  if (answer6.messages.length === 0) context.out("No messages kept yet.\n");
98796
99103
  for (const message2 of answer6.messages)
98797
- context.out(`[${message2.at}] ${message2.fromMe ? "me" : message2.sender}: ${message2.text}
99104
+ context.out(
99105
+ `[${message2.at}] ${message2.fromMe ? "me" : message2.sender}: ${message2.text}${fileNote(message2)}
99106
+ `
99107
+ );
99108
+ }
99109
+ function fileNote(message2) {
99110
+ const media = message2.media;
99111
+ if (!media) return "";
99112
+ const name3 = media.name ? ` ${media.name}` : "";
99113
+ const words = media.transcript ? `
99114
+ Transcript: ${media.transcript}` : "";
99115
+ return ` (${media.kind}${name3}, ${media.size} bytes, id ${message2.id})${words}`;
99116
+ }
99117
+ async function file3({ context, args }) {
99118
+ const client = await computeClient({ context, args });
99119
+ const named = args.words.length > 4;
99120
+ const answer6 = await askingRead({
99121
+ client,
99122
+ path: PATHS3.file,
99123
+ body: {
99124
+ ...named ? { machine: word2({ args, at: 2 }) } : {},
99125
+ chat: word2({ args, at: named ? 3 : 2 }),
99126
+ id: word2({ args, at: named ? 4 : 3 })
99127
+ },
99128
+ args
99129
+ });
99130
+ const out = resolve25(context.cwd, flagText({ args, name: "out" }) ?? basename10(answer6.fileName));
99131
+ const response = await context.fetcher(answer6.url);
99132
+ if (!response.ok) throw new Error(`The file link answered ${response.status}`);
99133
+ await writeFile27(out, new Uint8Array(await response.arrayBuffer()));
99134
+ if (args.flags.json) return context.out(`${JSON.stringify({ ...answer6, path: out }, null, 2)}
99135
+ `);
99136
+ context.out(`${out}
99137
+ `);
99138
+ if (answer6.transcript) context.out(`Transcript: ${answer6.transcript}
98798
99139
  `);
98799
99140
  }
98800
99141
  async function settle3({ client, send: send5 }) {
@@ -98833,6 +99174,14 @@ async function send4({ context, args }) {
98833
99174
  `);
98834
99175
  return report2({ context, args, send: await settle3({ client, send: asked }) });
98835
99176
  }
99177
+ async function sync({ context, args }) {
99178
+ const client = await computeClient({ context, args });
99179
+ const machine2 = args.words[2];
99180
+ const answer6 = await client.post(PATHS3.sync, machine2 ? { machine: machine2 } : {});
99181
+ if (args.flags.json) context.out(`${JSON.stringify(answer6)}
99182
+ `);
99183
+ else context.out("WhatsApp check booked: new messages land in Laze within a minute or two.\n");
99184
+ }
98836
99185
  async function status10({ context, args }) {
98837
99186
  const client = await computeClient({ context, args });
98838
99187
  const answer6 = await client.post(PATHS3.sendStatus, { sendId: word2({ args, at: 2 }) });
@@ -98848,8 +99197,10 @@ async function whatsapp({
98848
99197
  const command = args.words[1];
98849
99198
  if (command === "chats") return chats({ context, args });
98850
99199
  if (command === "read") return read3({ context, args });
99200
+ if (command === "file") return file3({ context, args });
98851
99201
  if (command === "send") return send4({ context, args });
98852
99202
  if (command === "status") return status10({ context, args });
99203
+ if (command === "sync") return sync({ context, args });
98853
99204
  const linking = whatsappPairingCommand(command);
98854
99205
  if (linking) return linking({ context, args });
98855
99206
  throw new CliUsageError(USAGE19);
@@ -99276,6 +99627,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
99276
99627
  laze machine host <machine> <agent> [--when-offline wait|computer] run your personal agent on your machine
99277
99628
  laze machine unhost <agent> run the agent on your agent computer again
99278
99629
  laze whatsapp chats|read [<machine>] [<chat>] [--limit <n>] your person's WhatsApp, read through Laze
99630
+ laze whatsapp file [<machine>] <chat> <message-id> [--out <path>] save a message's photo, voice or file
99279
99631
  laze whatsapp send <machine> <chat> "<text>" send as its owner; each message waits for their approval
99280
99632
  laze whatsapp unpair <machine> unlink WhatsApp; linking is in Settings, Machines
99281
99633
  laze whatsapp-business status|conversations|read|send|send-template|send-status|templates|prices
@@ -99587,21 +99939,21 @@ function exitCodeOf({ context, error: error63 }) {
99587
99939
  // src/services/machine-key.service.ts
99588
99940
  import { execFile as execFile2 } from "node:child_process";
99589
99941
  import {
99590
- createHash as createHash7,
99942
+ createHash as createHash8,
99591
99943
  createPrivateKey,
99592
99944
  generateKeyPairSync,
99593
99945
  randomBytes as randomBytes4,
99594
99946
  sign
99595
99947
  } from "node:crypto";
99596
- import { chmod as chmod4, link, mkdir as mkdir27, readFile as readFile47, rm as rm18, writeFile as writeFile26 } from "node:fs/promises";
99597
- import { dirname as dirname28, join as join31 } from "node:path";
99948
+ import { chmod as chmod4, link, mkdir as mkdir28, readFile as readFile47, rm as rm19, writeFile as writeFile28 } from "node:fs/promises";
99949
+ import { dirname as dirname28, join as join33 } from "node:path";
99598
99950
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
99599
- var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve24, reject) => {
99951
+ var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve26, reject) => {
99600
99952
  const child = execFile2(
99601
99953
  program,
99602
99954
  [...args],
99603
99955
  { timeout: timeoutMs },
99604
- (error63, stdout2) => error63 ? reject(error63) : resolve24(String(stdout2))
99956
+ (error63, stdout2) => error63 ? reject(error63) : resolve26(String(stdout2))
99605
99957
  );
99606
99958
  if (stdin2 !== void 0) child.stdin?.end(stdin2);
99607
99959
  });
@@ -99634,15 +99986,15 @@ var MachineKeyStore = class _MachineKeyStore {
99634
99986
  });
99635
99987
  }
99636
99988
  get metaPath() {
99637
- return join31(dirname28(this.options.configPath), "machine-key.json");
99989
+ return join33(dirname28(this.options.configPath), "machine-key.json");
99638
99990
  }
99639
99991
  /** Named by the key, so two CLIs making a key at once never overwrite each other's. */
99640
99992
  pemPathOf(jwk) {
99641
- return join31(dirname28(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99993
+ return join33(dirname28(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99642
99994
  }
99643
99995
  /** The Keychain item's account: one per config file and key. */
99644
99996
  accountOf(jwk) {
99645
- const config2 = createHash7("sha256").update(this.options.configPath).digest("hex");
99997
+ const config2 = createHash8("sha256").update(this.options.configPath).digest("hex");
99646
99998
  return `${config2.slice(0, 32)}-${shortOf(jwk)}`;
99647
99999
  }
99648
100000
  /** The key if this machine made one; null otherwise. Read once per process. */
@@ -99705,7 +100057,7 @@ var MachineKeyStore = class _MachineKeyStore {
99705
100057
  return kept;
99706
100058
  }
99707
100059
  async drop({ tier, jwk }) {
99708
- if (tier === "file") return rm18(this.pemPathOf(jwk), { force: true });
100060
+ if (tier === "file") return rm19(this.pemPathOf(jwk), { force: true });
99709
100061
  await this.options.run({
99710
100062
  program: "security",
99711
100063
  args: ["delete-generic-password", "-s", KEYCHAIN_SERVICE, "-a", this.accountOf(jwk)],
@@ -99761,12 +100113,12 @@ async function writeOnce({ path, text: text3 }) {
99761
100113
  if (error63.code === "EEXIST") return false;
99762
100114
  throw error63;
99763
100115
  } finally {
99764
- await rm18(temporary, { force: true });
100116
+ await rm19(temporary, { force: true });
99765
100117
  }
99766
100118
  }
99767
100119
  async function writePrivate({ path, text: text3 }) {
99768
- await mkdir27(dirname28(path), { recursive: true, mode: 448 });
99769
- await writeFile26(path, text3, { mode: 384 });
100120
+ await mkdir28(dirname28(path), { recursive: true, mode: 448 });
100121
+ await writeFile28(path, text3, { mode: 384 });
99770
100122
  await chmod4(path, 384);
99771
100123
  }
99772
100124
 
@@ -99957,15 +100309,15 @@ function terminalAsk() {
99957
100309
  };
99958
100310
  }
99959
100311
  function sleep(ms, signal) {
99960
- return new Promise((resolve24) => {
99961
- if (signal?.aborted) return resolve24();
100312
+ return new Promise((resolve26) => {
100313
+ if (signal?.aborted) return resolve26();
99962
100314
  const stop3 = () => {
99963
100315
  clearTimeout(timer);
99964
- resolve24();
100316
+ resolve26();
99965
100317
  };
99966
100318
  const timer = setTimeout(() => {
99967
100319
  signal?.removeEventListener("abort", stop3);
99968
- resolve24();
100320
+ resolve26();
99969
100321
  }, ms);
99970
100322
  signal?.addEventListener("abort", stop3, { once: true });
99971
100323
  });