@lazehq/cli 0.1.83 → 0.1.85

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 +597 -356
  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 = resolve25(dir);
853
853
  if (prebuild) return prebuild;
854
- var nearby = resolve24(path.dirname(process.execPath));
854
+ var nearby = resolve25(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 resolve25(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((resolve25, reject) => {
7318
7318
  this.close((err, data) => {
7319
- return err ? reject(err) : resolve24(data);
7319
+ return err ? reject(err) : resolve25(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((resolve25, reject) => {
7358
7358
  this.destroy(err, (err2, data) => {
7359
- return err2 ? reject(err2) : resolve24(data);
7359
+ return err2 ? reject(err2) : resolve25(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((resolve25, reject) => {
12315
12315
  assert2(callback === null);
12316
12316
  if (socket[kError]) {
12317
12317
  reject(socket[kError]);
12318
12318
  } else {
12319
- callback = resolve24;
12319
+ callback = resolve25;
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((resolve25, reject) => {
13678
13678
  assert2(callback === null);
13679
13679
  if (socket[kError]) {
13680
13680
  reject(socket[kError]);
13681
13681
  } else {
13682
- callback = resolve24;
13682
+ callback = resolve25;
13683
13683
  }
13684
13684
  });
13685
13685
  h2stream.on("close", onDrain).on("drain", onDrain);
@@ -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((resolve25) => {
14051
14051
  if (this[kSize]) {
14052
- this[kClosedResolve] = resolve24;
14052
+ this[kClosedResolve] = resolve25;
14053
14053
  } else {
14054
- resolve24(null);
14054
+ resolve25(null);
14055
14055
  }
14056
14056
  });
14057
14057
  }
14058
14058
  [kDestroy](err) {
14059
- return new Promise((resolve24) => {
14059
+ return new Promise((resolve25) => {
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
+ resolve25(null);
14073
14073
  };
14074
14074
  if (this[kHTTPContext]) {
14075
14075
  this[kHTTPContext].destroy(err, callback);
@@ -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((resolve25) => {
14486
+ this[kClosedResolve] = resolve25;
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((resolve25, 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
+ resolve25(null);
17012
17012
  }
17013
17013
  });
17014
17014
  } else {
17015
- this.on("close", resolve24);
17015
+ this.on("close", resolve25);
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((resolve25, 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: resolve25,
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: resolve25, stream, length } = consume2;
17137
17137
  try {
17138
17138
  if (type === "text") {
17139
- resolve24(chunksDecode(body, length, encoding));
17139
+ resolve25(chunksDecode(body, length, encoding));
17140
17140
  } else if (type === "json") {
17141
- resolve24(JSON.parse(chunksDecode(body, length, encoding)));
17141
+ resolve25(JSON.parse(chunksDecode(body, length, encoding)));
17142
17142
  } else if (type === "arrayBuffer") {
17143
- resolve24(chunksConcat(body, length).buffer);
17143
+ resolve25(chunksConcat(body, length).buffer);
17144
17144
  } else if (type === "blob") {
17145
- resolve24(new Blob(body, { type: stream[kContentType] }));
17145
+ resolve25(new Blob(body, { type: stream[kContentType] }));
17146
17146
  } else if (type === "bytes") {
17147
- resolve24(chunksConcat(body, length));
17147
+ resolve25(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((resolve25, reject) => {
17367
17367
  request2.call(this, opts, (err, data) => {
17368
- return err ? reject(err) : resolve24(data);
17368
+ return err ? reject(err) : resolve25(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((resolve25, reject) => {
17630
17630
  stream.call(this, opts, factory, (err, data) => {
17631
- return err ? reject(err) : resolve24(data);
17631
+ return err ? reject(err) : resolve25(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((resolve25, reject) => {
17932
17932
  upgrade2.call(this, opts, (err, data) => {
17933
- return err ? reject(err) : resolve24(data);
17933
+ return err ? reject(err) : resolve25(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((resolve25, reject) => {
18028
18028
  connect8.call(this, opts, (err, data) => {
18029
- return err ? reject(err) : resolve24(data);
18029
+ return err ? reject(err) : resolve25(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: writeFile28, readFile: readFile49, mkdir: mkdir28 } = __require("node:fs/promises");
19490
+ var { dirname: dirname30, resolve: resolve25 } = __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(resolve25(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);
19735
+ const resolvedPath = resolve25(path);
19736
19736
  await mkdir28(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 writeFile28(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((resolve25, 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
+ resolve25({
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
+ resolve25(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
+ resolve25({
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((resolve25, 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(() => resolve25(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.83";
36993
+ var STAMPED = "0.1.85";
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, resolve25) {
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, resolve25);
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, resolve25) : 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 ?? (resolve25 ? 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({
@@ -62650,6 +62664,11 @@ var conversationSchemaDefinition = external_exports.object({
62650
62664
  departed: external_exports.array(departedPersonSchemaDefinition).optional()
62651
62665
  });
62652
62666
  var conversationSchema = conversationSchemaDefinition;
62667
+ var reachableConversationSchemaDefinition = external_exports.object({
62668
+ conversation: conversationSchema,
62669
+ /** Whether any of the asked readers may read it; members are listed either way. */
62670
+ readable: external_exports.boolean()
62671
+ });
62653
62672
  var conversationSummarySchemaDefinition = external_exports.object({
62654
62673
  ...conversationSchemaDefinition.shape,
62655
62674
  lastReadSeq: external_exports.number().int().nonnegative(),
@@ -62997,7 +63016,11 @@ var openMirrorInputSchemaDefinition = external_exports.object({
62997
63016
  /** A channel of this workspace the mirror attaches to; pass its name and visibility to keep. */
62998
63017
  channelId: idSchema4.optional(),
62999
63018
  /** False keeps every agent out from the start; absent keeps what the mirror had. */
63000
- agentsAllowed: external_exports.boolean().optional()
63019
+ agentsAllowed: external_exports.boolean().optional(),
63020
+ /** The name as the source writes it, shown in place of the channel's handle; absent keeps it. */
63021
+ title: external_exports.string().trim().min(1).max(120).optional(),
63022
+ /** True only brings a live mirror in line: a closed one stays closed and none is opened. */
63023
+ refreshOnly: external_exports.boolean().default(false)
63001
63024
  });
63002
63025
  var postMirroredInputSchemaDefinition = external_exports.object({
63003
63026
  workspaceId: workspaceIdSchema,
@@ -63043,7 +63066,9 @@ var updateMirroredInputSchemaDefinition = external_exports.object({
63043
63066
  /** Laze read the source's message again, which is not an edit: no edited mark. */
63044
63067
  rerendered: external_exports.boolean().default(false),
63045
63068
  /** The source says the message was never edited: an edited mark Laze gave it comes off. */
63046
- neverEdited: external_exports.boolean().default(false)
63069
+ neverEdited: external_exports.boolean().default(false),
63070
+ /** Files the mirror stored since, attached when the message has none yet. */
63071
+ fileIds: external_exports.array(idSchema4).max(10).default([])
63047
63072
  });
63048
63073
  var removeMirroredLinksInputSchemaDefinition = external_exports.object({
63049
63074
  workspaceId: workspaceIdSchema,
@@ -63111,7 +63136,8 @@ var syncMirrorReadInputSchemaDefinition = external_exports.object({
63111
63136
  workspaceId: workspaceIdSchema,
63112
63137
  channelId: idSchema4,
63113
63138
  userId: idSchema4,
63114
- readTo: external_exports.iso.datetime()
63139
+ readTo: external_exports.iso.datetime(),
63140
+ unread: external_exports.number().int().positive().max(1e6).optional()
63115
63141
  });
63116
63142
  var mirroredReadToInputSchemaDefinition = external_exports.object({
63117
63143
  workspaceId: workspaceIdSchema,
@@ -66230,7 +66256,9 @@ var askAgentApprovalInputSchemaDefinition = external_exports.object({
66230
66256
  line: external_exports.string().min(1).max(500),
66231
66257
  /** What exactly would happen, shown as code on the card. */
66232
66258
  call: external_exports.string().max(8e3),
66233
- deciderIds: external_exports.array(idSchema6).min(1).max(20)
66259
+ deciderIds: external_exports.array(idSchema6).min(1).max(20),
66260
+ /** Offers "Allow for" this long beside Allow once; the answer comes back as `leaseSeconds`. */
66261
+ leaseSeconds: external_exports.number().int().positive().max(30 * 86400).optional()
66234
66262
  });
66235
66263
  var stopAgentTurnInputSchemaDefinition = external_exports.object({
66236
66264
  workspaceId: workspaceIdSchema3,
@@ -66270,7 +66298,9 @@ var agentAttentionRequestedPayloadSchemaDefinition = external_exports.object({
66270
66298
  call: external_exports.string(),
66271
66299
  /** Who may decide; empty means anyone in the conversation. */
66272
66300
  deciderIds: external_exports.array(external_exports.string()),
66273
- expiresAt: external_exports.iso.datetime()
66301
+ expiresAt: external_exports.iso.datetime(),
66302
+ /** The lease "Allow for" gives on another module's ask; null offers only allow and deny. */
66303
+ alwaysLeaseSeconds: external_exports.number().int().positive().nullable().default(null).catch(null)
66274
66304
  });
66275
66305
  var agentAttentionResolvedPayloadSchemaDefinition = external_exports.object({
66276
66306
  workspaceId: external_exports.string().min(1),
@@ -66283,7 +66313,9 @@ var agentAttentionResolvedPayloadSchemaDefinition = external_exports.object({
66283
66313
  channelId: external_exports.string().default(""),
66284
66314
  requestId: external_exports.string().default(""),
66285
66315
  /** What the waiting harness hears; the worker, which holds the sandbox link, sends it. */
66286
- harness: attentionAnswerSchema.nullable().default(null).catch(null)
66316
+ harness: attentionAnswerSchema.nullable().default(null).catch(null),
66317
+ /** Another module's ask allowed for a while: the lease the decider picked; null otherwise. */
66318
+ leaseSeconds: external_exports.number().int().positive().nullable().default(null).catch(null)
66287
66319
  });
66288
66320
  var agentTurnStopRequestedPayloadSchemaDefinition = external_exports.object({
66289
66321
  workspaceId: external_exports.string().min(1),
@@ -68395,7 +68427,7 @@ var setWorkspaceDefaultAgentAsCallerInputSchemaDefinition = external_exports.obj
68395
68427
  // ../../modules/agent/contract/src/agent.ts
68396
68428
  var AGENT_LINK_TTL_SECONDS = 30 * 60;
68397
68429
  var AGENT_JOIN_REQUEST_TTL_SECONDS = 24 * 60 * 60;
68398
- var AGENT_ONLINE_WINDOW_SECONDS = 5 * 60;
68430
+ var AGENT_ONLINE_WINDOW_SECONDS = 2 * 60;
68399
68431
  var INBOX_WAIT_MAX_SECONDS = 55;
68400
68432
  var workspaceIdSchema14 = external_exports.string().min(1);
68401
68433
  var idSchema17 = external_exports.string().min(1).max(80);
@@ -70357,7 +70389,7 @@ async function copyAgent({
70357
70389
 
70358
70390
  // src/services/agent-commands.service.ts
70359
70391
  import { mkdir as mkdir17, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
70360
- import { join as join17, resolve as resolve5 } from "node:path";
70392
+ import { join as join18, resolve as resolve5 } from "node:path";
70361
70393
 
70362
70394
  // src/rules/agent-profile.rules.ts
70363
70395
  var HARNESS_NAMES = {
@@ -71889,10 +71921,10 @@ async function liveElsewhere({
71889
71921
  }) {
71890
71922
  if (await rushKeeps({ context, key, claudePid, asleepCounts })) return true;
71891
71923
  const folder = dirname4(statePathOf({ context, kind: "sessions", profile: "x" }));
71892
- for (const file3 of await readdir(folder).catch(() => [])) {
71893
- const pid = Number(file3.replace(/\.json$/, ""));
71924
+ for (const file4 of await readdir(folder).catch(() => [])) {
71925
+ const pid = Number(file4.replace(/\.json$/, ""));
71894
71926
  if (!pid || pid === claudePid || !context.processes.alive(pid)) continue;
71895
- const noted = await readFile5(join3(folder, file3), "utf8").then(
71927
+ const noted = await readFile5(join3(folder, file4), "utf8").then(
71896
71928
  (text3) => JSON.parse(text3),
71897
71929
  () => void 0
71898
71930
  );
@@ -71943,8 +71975,8 @@ async function runsInSubagent({ context, command }) {
71943
71975
  const folder = join3(dirname4(path), sessionId, "subagents");
71944
71976
  const files2 = await readdir(folder).catch(() => []);
71945
71977
  const subagents = await Promise.all(
71946
- files2.filter((file3) => file3.endsWith(".jsonl")).map(
71947
- async (file3) => lastCallAtOf({ text: await tailOf({ path: join3(folder, file3) }), command })
71978
+ files2.filter((file4) => file4.endsWith(".jsonl")).map(
71979
+ async (file4) => lastCallAtOf({ text: await tailOf({ path: join3(folder, file4) }), command })
71948
71980
  )
71949
71981
  );
71950
71982
  const session = lastCallAtOf({ text: await tailOf({ path }), command });
@@ -72241,17 +72273,17 @@ async function sendParts({
72241
72273
  async function uploadFile({
72242
72274
  context,
72243
72275
  client,
72244
- file: file3
72276
+ file: file4
72245
72277
  }) {
72246
72278
  const ticket = await client.post(CHAT_KEY_PATHS.startUpload, {
72247
- channel: file3.channel,
72248
- fileName: file3.fileName,
72249
- contentType: file3.contentType,
72250
- sizeBytes: file3.bytes.byteLength
72279
+ channel: file4.channel,
72280
+ fileName: file4.fileName,
72281
+ contentType: file4.contentType,
72282
+ sizeBytes: file4.bytes.byteLength
72251
72283
  });
72252
72284
  const attachmentId = ticket.attachment.id;
72253
72285
  try {
72254
- const parts = await sendParts({ context, ticket, bytes: file3.bytes });
72286
+ const parts = await sendParts({ context, ticket, bytes: file4.bytes });
72255
72287
  return await client.post(CHAT_KEY_PATHS.completeUpload, { attachmentId, parts });
72256
72288
  } catch (cause) {
72257
72289
  await client.post(CHAT_KEY_PATHS.abortUpload, { attachmentId }).catch(() => void 0);
@@ -72284,13 +72316,13 @@ async function readyOf({ context, source }) {
72284
72316
  if (marked) return { kind: "id", id: marked };
72285
72317
  throw new CliUsageError(`${value} is not a file here, a URL or an uploaded file id`);
72286
72318
  }
72287
- function asBytes({ source, file: file3 }) {
72288
- if (source.image && !file3.contentType.startsWith("image/")) {
72319
+ function asBytes({ source, file: file4 }) {
72320
+ if (source.image && !file4.contentType.startsWith("image/")) {
72289
72321
  throw new CliUsageError(
72290
- `--image ${source.value} is not an image (${file3.contentType}); send it with --file`
72322
+ `--image ${source.value} is not an image (${file4.contentType}); send it with --file`
72291
72323
  );
72292
72324
  }
72293
- return { kind: "bytes", file: file3 };
72325
+ return { kind: "bytes", file: file4 };
72294
72326
  }
72295
72327
  async function downloaded({ context, url: url2 }) {
72296
72328
  const response = await context.fetcher(url2);
@@ -73074,10 +73106,10 @@ async function codexRolloutPathOf({
73074
73106
  }) {
73075
73107
  const root = join6(codexHome, "sessions");
73076
73108
  const files2 = await readdir2(root, { recursive: true }).catch(() => []);
73077
- const file3 = files2.find(
73109
+ const file4 = files2.find(
73078
73110
  (name3) => basename4(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
73079
73111
  );
73080
- return file3 ? join6(root, file3) : void 0;
73112
+ return file4 ? join6(root, file4) : void 0;
73081
73113
  }
73082
73114
  function rolloutPathOf({ delivery }) {
73083
73115
  return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
@@ -74157,10 +74189,10 @@ async function notesOf({ context }) {
74157
74189
  const folder = dirname9(statePathOf({ context, kind: "sessions", profile: "x" }));
74158
74190
  const files2 = await readdir3(folder).catch(() => []);
74159
74191
  const notes = await Promise.all(
74160
- files2.map(async (file3) => {
74161
- const pid = Number(file3.replace(/\.json$/, ""));
74162
- const note = await jsonOf(join10(folder, file3));
74163
- const at = await stat3(join10(folder, file3)).then(
74192
+ files2.map(async (file4) => {
74193
+ const pid = Number(file4.replace(/\.json$/, ""));
74194
+ const note = await jsonOf(join10(folder, file4));
74195
+ const at = await stat3(join10(folder, file4)).then(
74164
74196
  (info) => info.mtimeMs,
74165
74197
  () => 0
74166
74198
  );
@@ -74372,9 +74404,9 @@ var REFRESH_MS = 3e4;
74372
74404
  var MAX_RETRY_SECONDS3 = 60;
74373
74405
  var CLI_CHANGED_EXIT = 75;
74374
74406
  async function cliStampOf({ context }) {
74375
- const file3 = context.program.at(-1);
74376
- if (!file3) return "";
74377
- return stat4(file3).then(
74407
+ const file4 = context.program.at(-1);
74408
+ if (!file4) return "";
74409
+ return stat4(file4).then(
74378
74410
  (info) => `${info.mtimeMs}:${info.size}`,
74379
74411
  () => ""
74380
74412
  );
@@ -74680,26 +74712,26 @@ async function installSystemd({ context }) {
74680
74712
  const name3 = serviceNameOf({ context });
74681
74713
  const env = context.environment.inherited;
74682
74714
  const base = env.XDG_CONFIG_HOME || join13(homeOf({ context }), ".config");
74683
- const file3 = join13(base, "systemd", "user", `${name3}.service`);
74684
- await mkdir11(dirname12(file3), { recursive: true });
74715
+ const file4 = join13(base, "systemd", "user", `${name3}.service`);
74716
+ await mkdir11(dirname12(file4), { recursive: true });
74685
74717
  await writeFile10(
74686
- file3,
74718
+ file4,
74687
74719
  systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
74688
74720
  );
74689
74721
  const systemctl = (...words) => run({ context, command: ["systemctl", "--user", ...words] });
74690
74722
  const started = await systemctl("daemon-reload") && await systemctl("enable", `${name3}.service`) && await systemctl("restart", `${name3}.service`);
74691
74723
  if (!started)
74692
74724
  throw new CliUsageError(`systemd did not start ${name3}.service; see the lines above.`);
74693
- return { manager: "systemd", name: name3, file: file3, log: `journalctl --user -u ${name3}` };
74725
+ return { manager: "systemd", name: name3, file: file4, log: `journalctl --user -u ${name3}` };
74694
74726
  }
74695
74727
  async function installLaunchd({ context }) {
74696
74728
  const name3 = serviceNameOf({ context });
74697
74729
  const label3 = `ai.laze.${name3}`;
74698
- const file3 = join13(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
74730
+ const file4 = join13(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
74699
74731
  const log = logPathOf({ context });
74700
- await mkdir11(dirname12(file3), { recursive: true });
74732
+ await mkdir11(dirname12(file4), { recursive: true });
74701
74733
  await writeFile10(
74702
- file3,
74734
+ file4,
74703
74735
  launchAgentOf({
74704
74736
  label: label3,
74705
74737
  argv: runArgvOf({ context }),
@@ -74710,10 +74742,10 @@ async function installLaunchd({ context }) {
74710
74742
  await quietly({ context, script: `launchctl bootout gui/$(id -u)/${label3}` });
74711
74743
  const started = await run({
74712
74744
  context,
74713
- command: ["sh", "-c", `launchctl bootstrap gui/$(id -u) '${file3.replaceAll("'", "'\\''")}'`]
74745
+ command: ["sh", "-c", `launchctl bootstrap gui/$(id -u) '${file4.replaceAll("'", "'\\''")}'`]
74714
74746
  });
74715
74747
  if (!started) throw new CliUsageError(`launchd did not start ${label3}; see the lines above.`);
74716
- return { manager: "launchd", name: label3, file: file3, log };
74748
+ return { manager: "launchd", name: label3, file: file4, log };
74717
74749
  }
74718
74750
  async function installDetached({ context }) {
74719
74751
  const log = logPathOf({ context });
@@ -75173,8 +75205,8 @@ var CodexAppServer = class _CodexAppServer {
75173
75205
  }
75174
75206
  async call(method, params) {
75175
75207
  const id4 = ++this.#nextId;
75176
- const reply2 = await new Promise((resolve24) => {
75177
- this.#pending.set(id4, resolve24);
75208
+ const reply2 = await new Promise((resolve25) => {
75209
+ this.#pending.set(id4, resolve25);
75178
75210
  this.write({ id: id4, method, params });
75179
75211
  });
75180
75212
  if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
@@ -75186,12 +75218,12 @@ var CodexAppServer = class _CodexAppServer {
75186
75218
  /** Starts one turn; `done` settles when it completes, keeping its last agent message. */
75187
75219
  async startTurn({ threadId, text: text3 }) {
75188
75220
  const result2 = { answer: "" };
75189
- const done = new Promise((resolve24) => {
75221
+ const done = new Promise((resolve25) => {
75190
75222
  const listen = (message2) => {
75191
75223
  absorbTurnEvent({ result: result2, message: message2 });
75192
75224
  if (message2.method !== "turn/completed") return;
75193
75225
  this.#listeners.delete(listen);
75194
- resolve24(result2);
75226
+ resolve25(result2);
75195
75227
  };
75196
75228
  this.#listeners.add(listen);
75197
75229
  });
@@ -75236,9 +75268,9 @@ var CodexAppServer = class _CodexAppServer {
75236
75268
  async function newestThreadId({ codexHome }) {
75237
75269
  const root = join14(codexHome, "sessions");
75238
75270
  const files2 = await readdir4(root, { recursive: true }).catch(() => []);
75239
- const rollouts = files2.filter((file3) => /rollout-.*\.jsonl$/.test(file3));
75271
+ const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
75240
75272
  const dated = await Promise.all(
75241
- rollouts.map(async (file3) => ({ file: file3, at: (await stat5(join14(root, file3))).mtimeMs }))
75273
+ rollouts.map(async (file4) => ({ file: file4, at: (await stat5(join14(root, file4))).mtimeMs }))
75242
75274
  );
75243
75275
  const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
75244
75276
  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);
@@ -75509,11 +75541,11 @@ async function newestThreadIn({
75509
75541
  }) {
75510
75542
  const root = join15(codexHome, "sessions");
75511
75543
  const files2 = await readdir5(root, { recursive: true }).catch(() => []);
75512
- const rollouts = files2.filter((file3) => /rollout-.*\.jsonl$/.test(file3));
75544
+ const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
75513
75545
  const dated = await Promise.all(
75514
- rollouts.map(async (file3) => ({
75515
- path: join15(root, file3),
75516
- at: await stat6(join15(root, file3)).then(
75546
+ rollouts.map(async (file4) => ({
75547
+ path: join15(root, file4),
75548
+ at: await stat6(join15(root, file4)).then(
75517
75549
  (info) => info.mtimeMs,
75518
75550
  () => 0
75519
75551
  )
@@ -75583,23 +75615,32 @@ async function linkCodexSession({
75583
75615
  }
75584
75616
 
75585
75617
  // src/services/laze-plugin.service.ts
75586
- import { mkdir as mkdir14, readFile as readFile16, writeFile as writeFile13 } from "node:fs/promises";
75618
+ import { mkdir as mkdir14, readFile as readFile16, rm as rm7, writeFile as writeFile13 } from "node:fs/promises";
75587
75619
  import { homedir as homedir4 } from "node:os";
75588
- import { dirname as dirname15, join as join16 } from "node:path";
75620
+ import { dirname as dirname15, join as join17 } from "node:path";
75589
75621
 
75590
75622
  // src/rules/laze-plugin.rules.ts
75623
+ import { createHash as createHash3 } from "node:crypto";
75624
+ import { join as join16 } from "node:path";
75591
75625
  var LAZE_PLUGIN = "laze";
75626
+ function pluginNameOf({ configPath, home }) {
75627
+ if (configPath === join16(home, ".laze", "config.json")) return LAZE_PLUGIN;
75628
+ return `${LAZE_PLUGIN}-${createHash3("sha256").update(configPath).digest("hex").slice(0, 8)}`;
75629
+ }
75592
75630
  var NPX_CLI = ["npx", "-y", "@lazehq/cli@latest"];
75593
75631
  var quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
75632
+ var GONE = { hook: "exit 0", monitor: "exec tail -f /dev/null" };
75594
75633
  function cliLineOf({
75595
75634
  program,
75596
75635
  args,
75597
- configPath
75636
+ configPath,
75637
+ kind: kind2 = "hook"
75598
75638
  }) {
75599
75639
  const here = [...program, ...args].map(quote).join(" ");
75600
75640
  const fallback = [...NPX_CLI, ...args].join(" ");
75601
75641
  const run4 = `if [ -e ${quote(program.at(-1) ?? "")} ]; then exec ${here}; else exec ${fallback}; fi`;
75602
- return `export LAZE_CLI_CONFIG=${quote(configPath)}; ${run4}`;
75642
+ const config2 = quote(configPath);
75643
+ return `if [ ! -e ${config2} ]; then ${GONE[kind2]}; fi; export LAZE_CLI_CONFIG=${config2}; ${run4}`;
75603
75644
  }
75604
75645
  var SKILL = `---
75605
75646
  name: laze
@@ -75750,6 +75791,7 @@ function pluginHooksOf({ line }) {
75750
75791
  };
75751
75792
  }
75752
75793
  function lazePluginFiles({
75794
+ name: name3 = LAZE_PLUGIN,
75753
75795
  program,
75754
75796
  version: version2,
75755
75797
  configPath
@@ -75761,13 +75803,13 @@ function lazePluginFiles({
75761
75803
  const author = { name: "Laze", url: "https://laze.so" };
75762
75804
  return {
75763
75805
  ".claude-plugin/marketplace.json": json7({
75764
- name: LAZE_PLUGIN,
75806
+ name: name3,
75765
75807
  owner: author,
75766
- plugins: [{ name: LAZE_PLUGIN, source: `./${LAZE_PLUGIN}`, description }]
75808
+ plugins: [{ name: name3, source: `./${LAZE_PLUGIN}`, description }]
75767
75809
  }),
75768
75810
  "laze/plugin.json": json7({
75769
75811
  $schema: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
75770
- name: LAZE_PLUGIN,
75812
+ name: name3,
75771
75813
  version: version2,
75772
75814
  description,
75773
75815
  author,
@@ -75781,7 +75823,7 @@ function lazePluginFiles({
75781
75823
  command: [...NPX_CLI, "hook", "monitor"]
75782
75824
  }),
75783
75825
  "laze/.claude-plugin/plugin.json": json7({
75784
- name: LAZE_PLUGIN,
75826
+ name: name3,
75785
75827
  version: version2,
75786
75828
  description,
75787
75829
  author
@@ -75789,7 +75831,7 @@ function lazePluginFiles({
75789
75831
  "laze/monitors/monitors.json": json7([
75790
75832
  {
75791
75833
  name: "laze-messages",
75792
- command: line(["hook", "monitor"]),
75834
+ command: cliLineOf({ program, args: ["hook", "monitor"], configPath, kind: "monitor" }),
75793
75835
  description: "Laze messages for this session"
75794
75836
  }
75795
75837
  ]),
@@ -75800,11 +75842,21 @@ function lazePluginFiles({
75800
75842
  // src/services/laze-plugin.service.ts
75801
75843
  var REGISTER_LIMIT_MS = 6e4;
75802
75844
  var quote2 = (value) => `'${value.replaceAll("'", "'\\''")}'`;
75845
+ function homeOf2({ context }) {
75846
+ return context.environment.inherited.HOME || homedir4();
75847
+ }
75848
+ function pluginNameHere({ context }) {
75849
+ return pluginNameOf({ configPath: context.environment.configPath, home: homeOf2({ context }) });
75850
+ }
75851
+ function installedNameOf({ context }) {
75852
+ const name3 = pluginNameHere({ context });
75853
+ return `${name3}@${name3}`;
75854
+ }
75803
75855
  function pluginFolderOf({ context }) {
75804
- return join16(dirname15(context.environment.configPath), "plugins");
75856
+ return join17(dirname15(context.environment.configPath), "plugins");
75805
75857
  }
75806
75858
  async function pluginIsCurrent({ context }) {
75807
- const manifest = join16(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
75859
+ const manifest = join17(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
75808
75860
  const written = await readFile16(manifest, "utf8").then(
75809
75861
  (text3) => JSON.parse(text3).version,
75810
75862
  () => void 0
@@ -75814,12 +75866,13 @@ async function pluginIsCurrent({ context }) {
75814
75866
  async function writeLazePlugin({ context }) {
75815
75867
  const folder = pluginFolderOf({ context });
75816
75868
  const files2 = lazePluginFiles({
75869
+ name: pluginNameHere({ context }),
75817
75870
  program: context.program,
75818
75871
  version: cliVersionOf(),
75819
75872
  configPath: context.environment.configPath
75820
75873
  });
75821
75874
  for (const [path, text3] of Object.entries(files2)) {
75822
- const target = join16(folder, path);
75875
+ const target = join17(folder, path);
75823
75876
  await mkdir14(dirname15(target), { recursive: true });
75824
75877
  await writeFile13(target, text3);
75825
75878
  }
@@ -75838,34 +75891,53 @@ async function claudeScript({ context, script }) {
75838
75891
  }
75839
75892
  var QUIET = ">/dev/null 2>&1 </dev/null";
75840
75893
  async function registerWithClaude({ context, folder }) {
75894
+ const name3 = pluginNameHere({ context });
75895
+ const plugin2 = installedNameOf({ context });
75841
75896
  const script = [
75842
75897
  `claude plugin marketplace add ${quote2(folder)} --scope user ${QUIET}`,
75843
- `claude plugin marketplace update ${LAZE_PLUGIN} ${QUIET}`,
75898
+ `claude plugin marketplace update ${name3} ${QUIET}`,
75844
75899
  // install is a no-op for a plugin Claude Code already has; update refreshes its cached copy.
75845
- `{ claude plugin install ${LAZE_PLUGIN}@${LAZE_PLUGIN} --scope user ${QUIET} || true; }`,
75846
- `claude plugin update ${LAZE_PLUGIN}@${LAZE_PLUGIN} ${QUIET}`
75900
+ `{ claude plugin install ${plugin2} --scope user ${QUIET} || true; }`,
75901
+ `claude plugin update ${plugin2} ${QUIET}`
75847
75902
  ].join("; ");
75848
75903
  return claudeScript({ context, script });
75849
75904
  }
75905
+ function claudeDirOf({ context }) {
75906
+ return context.environment.inherited.CLAUDE_CONFIG_DIR || join17(homeOf2({ context }), ".claude");
75907
+ }
75908
+ function unregisterAs({ context, name: name3 }) {
75909
+ const script = [
75910
+ `claude plugin uninstall ${name3}@${name3} --scope user ${QUIET}`,
75911
+ `claude plugin marketplace remove ${name3} ${QUIET}`
75912
+ ].join("; ");
75913
+ return claudeScript({ context, script });
75914
+ }
75915
+ async function dropOwnLeftover({ context, folder }) {
75916
+ if (pluginNameHere({ context }) === LAZE_PLUGIN) return;
75917
+ const known = await readFile16(
75918
+ join17(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
75919
+ "utf8"
75920
+ ).then((text3) => JSON.parse(text3)).catch(() => void 0);
75921
+ if (known?.[LAZE_PLUGIN]?.source?.path !== folder) return;
75922
+ await unregisterAs({ context, name: LAZE_PLUGIN });
75923
+ }
75850
75924
  var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
75851
75925
  async function cachedPluginOf({ context }) {
75852
- const inherited = context.environment.inherited;
75853
- const home = inherited.HOME || homedir4();
75854
- const claude = inherited.CLAUDE_CONFIG_DIR || join16(home, ".claude");
75855
- const listed = await readFile16(join16(claude, "plugins", "installed_plugins.json"), "utf8").then(
75926
+ const path = join17(claudeDirOf({ context }), "plugins", "installed_plugins.json");
75927
+ const listed = await readFile16(path, "utf8").then(
75856
75928
  (text3) => JSON.parse(text3),
75857
75929
  () => void 0
75858
75930
  );
75859
- return listed?.plugins?.[`${LAZE_PLUGIN}@${LAZE_PLUGIN}`]?.[0]?.installPath;
75931
+ return listed?.plugins?.[installedNameOf({ context })]?.[0]?.installPath;
75860
75932
  }
75861
75933
  async function refreshStaleCache({ context, folder }) {
75862
75934
  const cached2 = await cachedPluginOf({ context });
75863
75935
  if (!cached2) return true;
75864
75936
  const read4 = (path) => readFile16(path, "utf8").catch(() => "");
75865
- for (const file3 of RUN_FILES) {
75866
- const ours = await read4(join16(folder, LAZE_PLUGIN, file3));
75867
- if (ours === await read4(join16(cached2, file3))) continue;
75868
- const plugin2 = `${LAZE_PLUGIN}@${LAZE_PLUGIN}`;
75937
+ for (const file4 of RUN_FILES) {
75938
+ const ours = await read4(join17(folder, LAZE_PLUGIN, file4));
75939
+ if (ours === await read4(join17(cached2, file4))) continue;
75940
+ const plugin2 = installedNameOf({ context });
75869
75941
  const script = [
75870
75942
  `claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
75871
75943
  `claude plugin install ${plugin2} --scope user ${QUIET}`
@@ -75875,7 +75947,7 @@ async function refreshStaleCache({ context, folder }) {
75875
75947
  return true;
75876
75948
  }
75877
75949
  function registeredMarkOf({ context }) {
75878
- return join16(pluginFolderOf({ context }), "registered");
75950
+ return join17(pluginFolderOf({ context }), "registered");
75879
75951
  }
75880
75952
  async function pluginRegistered({ context }) {
75881
75953
  return readFile16(registeredMarkOf({ context }), "utf8").then(
@@ -75885,6 +75957,7 @@ async function pluginRegistered({ context }) {
75885
75957
  }
75886
75958
  async function installLazePlugin({ context }) {
75887
75959
  const folder = await writeLazePlugin({ context });
75960
+ await dropOwnLeftover({ context, folder });
75888
75961
  const registered = await registerWithClaude({ context, folder }) && await refreshStaleCache({ context, folder });
75889
75962
  if (registered) await writeFile13(registeredMarkOf({ context }), cliVersionOf());
75890
75963
  return { folder, registered };
@@ -75892,25 +75965,36 @@ async function installLazePlugin({ context }) {
75892
75965
  async function plugin({ context, args }) {
75893
75966
  const action = args.words[1] ?? "install";
75894
75967
  if (action === "path") {
75895
- context.out(`${join16(pluginFolderOf({ context }), LAZE_PLUGIN)}
75968
+ context.out(`${join17(pluginFolderOf({ context }), LAZE_PLUGIN)}
75896
75969
  `);
75897
75970
  return 0;
75898
75971
  }
75972
+ if (action === "uninstall") {
75973
+ const name3 = pluginNameHere({ context });
75974
+ const removed = await unregisterAs({ context, name: name3 });
75975
+ await rm7(registeredMarkOf({ context }), { force: true });
75976
+ context.out(
75977
+ removed ? `Removed the Laze plugin ${name3}@${name3} from Claude Code.
75978
+ ` : `Claude Code did not remove it; run: claude plugin uninstall ${name3}@${name3} && claude plugin marketplace remove ${name3}
75979
+ `
75980
+ );
75981
+ return removed ? 0 : 1;
75982
+ }
75899
75983
  if (action !== "install") {
75900
- context.err("Usage: laze plugin install | laze plugin path\n");
75984
+ context.err("Usage: laze plugin install | laze plugin uninstall | laze plugin path\n");
75901
75985
  return 1;
75902
75986
  }
75903
75987
  const { folder, registered } = await installLazePlugin({ context });
75904
75988
  context.out(
75905
75989
  registered ? `Installed the Laze plugin from ${folder} in Claude Code. It starts with your next session or resume.
75906
- ` : `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}
75990
+ ` : `Wrote the Laze plugin to ${folder}. Claude Code did not take it; run: claude plugin marketplace add ${folder} && claude plugin install ${installedNameOf({ context })}
75907
75991
  `
75908
75992
  );
75909
75993
  return 0;
75910
75994
  }
75911
75995
 
75912
75996
  // src/services/mcp-channel.service.ts
75913
- import { mkdir as mkdir15, rm as rm7, writeFile as writeFile14 } from "node:fs/promises";
75997
+ import { mkdir as mkdir15, rm as rm8, writeFile as writeFile14 } from "node:fs/promises";
75914
75998
  import { dirname as dirname16 } from "node:path";
75915
75999
  var LAZE_MCP_SERVER = "laze";
75916
76000
  var DEV_CHANNELS_FLAG = "--dangerously-load-development-channels";
@@ -76031,7 +76115,7 @@ async function pushInbox({
76031
76115
  `);
76032
76116
  }
76033
76117
  } finally {
76034
- await rm7(marker, { force: true });
76118
+ await rm8(marker, { force: true });
76035
76119
  }
76036
76120
  }
76037
76121
 
@@ -76146,8 +76230,8 @@ async function installHooks({
76146
76230
  directory,
76147
76231
  profile
76148
76232
  }) {
76149
- const folder = join17(directory, ".claude");
76150
- const path = join17(folder, "settings.local.json");
76233
+ const folder = join18(directory, ".claude");
76234
+ const path = join18(folder, "settings.local.json");
76151
76235
  const current3 = await readFile18(path, "utf8").then(
76152
76236
  (text3) => JSON.parse(text3),
76153
76237
  () => ({})
@@ -76467,7 +76551,7 @@ async function addSessionStartWaiter({ context, args }) {
76467
76551
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR;
76468
76552
  const profile = flagText({ args, name: "profile" });
76469
76553
  if (!directory || !profile) return;
76470
- const path = join17(directory, ".claude", "settings.local.json");
76554
+ const path = join18(directory, ".claude", "settings.local.json");
76471
76555
  const settings3 = await readFile18(path, "utf8").then(
76472
76556
  (text3) => JSON.parse(text3),
76473
76557
  () => void 0
@@ -76477,7 +76561,7 @@ async function addSessionStartWaiter({ context, args }) {
76477
76561
  }
76478
76562
  async function refreshPlugin({ context }) {
76479
76563
  if (await pluginIsCurrent({ context })) return;
76480
- const logPath = join17(pluginFolderOf({ context }), "install.log");
76564
+ const logPath = join18(pluginFolderOf({ context }), "install.log");
76481
76565
  context.processes.spawnDetached({ argv: [...context.program, "plugin", "install"], logPath });
76482
76566
  }
76483
76567
  async function stopHook({ context, args }) {
@@ -77353,10 +77437,10 @@ async function setAgentRunsOn({
77353
77437
 
77354
77438
  // src/services/agent-migrate-commands.service.ts
77355
77439
  import { readFile as readFile20, stat as stat7 } from "node:fs/promises";
77356
- import { basename as basename5, join as join18, resolve as resolve7 } from "node:path";
77440
+ import { basename as basename5, join as join19, resolve as resolve7 } from "node:path";
77357
77441
 
77358
77442
  // src/rules/migration-upload.rules.ts
77359
- import { createHash as createHash3 } from "node:crypto";
77443
+ import { createHash as createHash4 } from "node:crypto";
77360
77444
  function markersIn(text3) {
77361
77445
  return text3.split(REDACTION_MARKER).length - 1;
77362
77446
  }
@@ -77375,7 +77459,7 @@ async function redactTranscript({
77375
77459
  return { text: redacted.text, redactions };
77376
77460
  }
77377
77461
  function sha256Of({ text: text3 }) {
77378
- return createHash3("sha256").update(text3, "utf8").digest("hex");
77462
+ return createHash4("sha256").update(text3, "utf8").digest("hex");
77379
77463
  }
77380
77464
  var bytesOf2 = (text3) => Buffer.byteLength(text3, "utf8");
77381
77465
  function piecesOf({ line, maxBytes }) {
@@ -77561,9 +77645,9 @@ async function cancelMigration({ context, args }) {
77561
77645
  async function chosenTranscriptOf({
77562
77646
  context,
77563
77647
  ticket,
77564
- file: file3
77648
+ file: file4
77565
77649
  }) {
77566
- const path = resolve7(context.cwd, file3);
77650
+ const path = resolve7(context.cwd, file4);
77567
77651
  const sessionId = basename5(path).replace(/\.jsonl$/, "");
77568
77652
  if (ticket.source !== "claude-code" || !SESSION_ID.test(sessionId)) {
77569
77653
  throw new CliUsageError(
@@ -77577,8 +77661,8 @@ async function chosenTranscriptOf({
77577
77661
  return { sessionId, path: found ? path : void 0, where: path };
77578
77662
  }
77579
77663
  async function transcriptOf({ context, args, ticket }) {
77580
- const file3 = flagText({ args, name: "transcript" });
77581
- if (file3) return chosenTranscriptOf({ context, ticket, file: file3 });
77664
+ const file4 = flagText({ args, name: "transcript" });
77665
+ if (file4) return chosenTranscriptOf({ context, ticket, file: file4 });
77582
77666
  const inherited = context.environment.inherited;
77583
77667
  const own2 = ticket.source === "codex" ? inherited.CODEX_THREAD_ID : inherited.CLAUDE_CODE_SESSION_ID;
77584
77668
  const sessionId = own2 || ticket.sessionId || "";
@@ -77590,7 +77674,7 @@ async function transcriptOf({ context, args, ticket }) {
77590
77674
  if (ticket.source === "codex") {
77591
77675
  const codexHome = context.environment.codexHome;
77592
77676
  const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
77593
- return { sessionId, path: path2, where: join18(codexHome, "sessions") };
77677
+ return { sessionId, path: path2, where: join19(codexHome, "sessions") };
77594
77678
  }
77595
77679
  const { root, path } = await claudeTranscriptOf({ context, sessionId });
77596
77680
  return { sessionId, path, where: root };
@@ -77897,7 +77981,7 @@ async function requestAgent({ context, args }) {
77897
77981
 
77898
77982
  // src/services/app-commands.service.ts
77899
77983
  import { mkdir as mkdir18, readdir as readdir6, readFile as readFile22, writeFile as writeFile18 } from "node:fs/promises";
77900
- import { dirname as dirname18, join as join21, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
77984
+ import { dirname as dirname18, join as join22, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
77901
77985
 
77902
77986
  // ../../modules/app/contract/src/app.connections.ts
77903
77987
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -79986,11 +80070,11 @@ function unknownCollectionsOf({
79986
80070
  }) {
79987
80071
  if (!collections) return [];
79988
80072
  const known = Object.keys(collections);
79989
- return files2.filter((file3) => /\.(m?js|html)$/.test(file3.path)).flatMap(
79990
- (file3) => [...file3.text.matchAll(RECORDS_CALL)].filter(([, , name3]) => !known.includes(name3 ?? "")).map((match) => {
79991
- const line = file3.text.slice(0, match.index).split("\n").length;
80073
+ return files2.filter((file4) => /\.(m?js|html)$/.test(file4.path)).flatMap(
80074
+ (file4) => [...file4.text.matchAll(RECORDS_CALL)].filter(([, , name3]) => !known.includes(name3 ?? "")).map((match) => {
80075
+ const line = file4.text.slice(0, match.index).split("\n").length;
79992
80076
  const defines = known.length > 0 ? known.join(", ") : "none";
79993
- return `${file3.path}:${line.toString()}: Laze.records("${match[2] ?? ""}") names a collection laze.app.json does not define (it defines: ${defines})`;
80077
+ return `${file4.path}:${line.toString()}: Laze.records("${match[2] ?? ""}") names a collection laze.app.json does not define (it defines: ${defines})`;
79994
80078
  })
79995
80079
  );
79996
80080
  }
@@ -80347,9 +80431,9 @@ async function appPinsCommand({
80347
80431
 
80348
80432
  // src/services/app-script-check.service.ts
80349
80433
  import { execFile } from "node:child_process";
80350
- import { mkdtemp, rm as rm8, writeFile as writeFile17 } from "node:fs/promises";
80434
+ import { mkdtemp, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
80351
80435
  import { tmpdir } from "node:os";
80352
- import { join as join19 } from "node:path";
80436
+ import { join as join20 } from "node:path";
80353
80437
  import { promisify } from "node:util";
80354
80438
  var run2 = promisify(execFile);
80355
80439
  var MODULE_SYNTAX = /^\s*(import|export)\s/m;
@@ -80378,31 +80462,31 @@ async function scriptErrorsOf({
80378
80462
  const unknown2 = unknownCollectionsOf({ files: files2, collections });
80379
80463
  const scripts = files2.flatMap(scriptsOf);
80380
80464
  if (scripts.length === 0) return unknown2;
80381
- const dir = await mkdtemp(join19(tmpdir(), "laze-app-check-"));
80465
+ const dir = await mkdtemp(join20(tmpdir(), "laze-app-check-"));
80382
80466
  try {
80383
80467
  const errors = await Promise.all(
80384
80468
  scripts.map(async (script, index) => {
80385
- const file3 = join19(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
80386
- await writeFile17(file3, script.code);
80469
+ const file4 = join20(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
80470
+ await writeFile17(file4, script.code);
80387
80471
  try {
80388
- await run2(process.execPath, ["--check", file3]);
80472
+ await run2(process.execPath, ["--check", file4]);
80389
80473
  return null;
80390
80474
  } catch (cause) {
80391
80475
  const stderr2 = cause.stderr ?? "";
80392
- return errorOf2({ script, stderr: stderr2.replaceAll(file3, script.path) });
80476
+ return errorOf2({ script, stderr: stderr2.replaceAll(file4, script.path) });
80393
80477
  }
80394
80478
  })
80395
80479
  );
80396
80480
  return [...errors.filter((error63) => error63 !== null), ...unknown2];
80397
80481
  } finally {
80398
- await rm8(dir, { recursive: true, force: true });
80482
+ await rm9(dir, { recursive: true, force: true });
80399
80483
  }
80400
80484
  }
80401
80485
 
80402
80486
  // src/services/app-serve.service.ts
80403
80487
  import { readFile as readFile21, stat as stat8 } from "node:fs/promises";
80404
80488
  import { createServer } from "node:http";
80405
- import { extname as extname2, join as join20, normalize, sep as sep2 } from "node:path";
80489
+ import { extname as extname2, join as join21, normalize, sep as sep2 } from "node:path";
80406
80490
  var TYPES2 = {
80407
80491
  ".html": "text/html; charset=utf-8",
80408
80492
  ".js": "text/javascript; charset=utf-8",
@@ -80453,8 +80537,8 @@ async function staticFile({
80453
80537
  if (clean.startsWith("..") || hidden) {
80454
80538
  return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
80455
80539
  }
80456
- const candidates = [join20(folder, clean), join20(folder, clean, "index.html")];
80457
- if (!extname2(clean)) candidates.push(join20(folder, "index.html"));
80540
+ const candidates = [join21(folder, clean), join21(folder, clean, "index.html")];
80541
+ if (!extname2(clean)) candidates.push(join21(folder, "index.html"));
80458
80542
  for (const target of candidates) {
80459
80543
  const info = await stat8(target).catch(() => void 0);
80460
80544
  if (!info?.isFile()) continue;
@@ -80545,16 +80629,16 @@ async function serveAppFolder({
80545
80629
  (error63) => failed({ response, error: error63 })
80546
80630
  );
80547
80631
  });
80548
- await new Promise((resolve24, reject) => {
80632
+ await new Promise((resolve25, reject) => {
80549
80633
  server.once("error", reject);
80550
- server.listen(port, "127.0.0.1", () => resolve24());
80634
+ server.listen(port, "127.0.0.1", () => resolve25());
80551
80635
  });
80552
80636
  const { port: bound } = server.address();
80553
80637
  return {
80554
80638
  url: `http://127.0.0.1:${bound}/`,
80555
- close: () => new Promise((resolve24) => {
80639
+ close: () => new Promise((resolve25) => {
80556
80640
  server.closeAllConnections();
80557
- server.close(() => resolve24());
80641
+ server.close(() => resolve25());
80558
80642
  })
80559
80643
  };
80560
80644
  }
@@ -80722,7 +80806,7 @@ function folderOf({ context, word: word3 }) {
80722
80806
  return resolve8(context.cwd, word3 ?? ".");
80723
80807
  }
80724
80808
  async function readManifest(folder) {
80725
- const text3 = await readFile22(join21(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
80809
+ const text3 = await readFile22(join22(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
80726
80810
  if (text3 === void 0) return void 0;
80727
80811
  const parsed = appManifestSchema.safeParse(JSON.parse(text3));
80728
80812
  if (!parsed.success) {
@@ -80770,7 +80854,7 @@ async function listFiles(folder) {
80770
80854
  while (pending2.length > 0 && found.length <= MAX_FILES) {
80771
80855
  const current3 = pending2.pop() ?? folder;
80772
80856
  for (const entry of await readdir6(current3, { withFileTypes: true })) {
80773
- const path = join21(current3, entry.name);
80857
+ const path = join22(current3, entry.name);
80774
80858
  const rel = relative3(folder, path).split(sep3).join("/");
80775
80859
  if (isSkippedPath({ path: rel })) continue;
80776
80860
  if (entry.isDirectory()) pending2.push(path);
@@ -80808,12 +80892,12 @@ var appCreate = async ({ context, args }) => {
80808
80892
  const folder = resolve8(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
80809
80893
  await mkdir18(folder, { recursive: true });
80810
80894
  const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
80811
- for (const file3 of start2?.files ?? []) {
80812
- const target = join21(folder, ...file3.path.split("/"));
80895
+ for (const file4 of start2?.files ?? []) {
80896
+ const target = join22(folder, ...file4.path.split("/"));
80813
80897
  await mkdir18(dirname18(target), { recursive: true });
80814
80898
  await writeFile18(
80815
80899
  target,
80816
- file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
80900
+ file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
80817
80901
  );
80818
80902
  }
80819
80903
  const manifest = {
@@ -80822,7 +80906,7 @@ var appCreate = async ({ context, args }) => {
80822
80906
  views: [...start2?.template.views ?? []],
80823
80907
  seed: { ...start2?.template.seed }
80824
80908
  };
80825
- await writeFile18(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
80909
+ await writeFile18(join22(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
80826
80910
  `);
80827
80911
  const where = relative3(context.cwd, folder) || ".";
80828
80912
  print5({
@@ -80898,7 +80982,7 @@ var appPush = async ({ context, args }) => {
80898
80982
  })
80899
80983
  )
80900
80984
  );
80901
- const bytes = files2.reduce((sum, file3) => sum + file3.bytes, 0);
80985
+ const bytes = files2.reduce((sum, file4) => sum + file4.bytes, 0);
80902
80986
  if (bytes > MAX_APP_BUILD_BYTES) {
80903
80987
  context.err(
80904
80988
  `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)
@@ -80908,7 +80992,7 @@ var appPush = async ({ context, args }) => {
80908
80992
  }
80909
80993
  if (files2.length === 0) throw new CliUsageError(`No files to push in ${folder}`);
80910
80994
  const scriptErrors = await scriptErrorsOf({
80911
- files: files2.filter((file3) => file3.encoding === "utf8").map(({ path, content }) => ({ path, text: content })),
80995
+ files: files2.filter((file4) => file4.encoding === "utf8").map(({ path, content }) => ({ path, text: content })),
80912
80996
  collections: manifest?.collections
80913
80997
  });
80914
80998
  if (scriptErrors.length > 0) {
@@ -80935,7 +81019,7 @@ var appPush = async ({ context, args }) => {
80935
81019
  const pushed = await client.post("/api/apps/commit", {
80936
81020
  appId,
80937
81021
  message: message2,
80938
- files: files2.map(({ bytes: _bytes, ...file3 }) => file3),
81022
+ files: files2.map(({ bytes: _bytes, ...file4 }) => file4),
80939
81023
  ...manifest?.users ? { users: manifest.users } : {},
80940
81024
  ...manifest?.functions ? { functions: manifest.functions } : {}
80941
81025
  });
@@ -80962,11 +81046,11 @@ var appWrite = async ({ context, args }) => {
80962
81046
  const files2 = await Promise.all(
80963
81047
  words.slice(2).map(async (word3) => {
80964
81048
  const path = resolve8(context.cwd, word3);
80965
- const { bytes: _bytes, ...file3 } = buildFileOf({
81049
+ const { bytes: _bytes, ...file4 } = buildFileOf({
80966
81050
  path: relative3(folder, path).split(sep3).join("/"),
80967
81051
  bytes: await readFile22(path)
80968
81052
  });
80969
- return file3;
81053
+ return file4;
80970
81054
  })
80971
81055
  );
80972
81056
  if (files2.length + remove8.length === 0) {
@@ -81090,12 +81174,12 @@ var appPull = async ({ context, args }) => {
81090
81174
  `${folder} already holds files that are not this app's; pull into an empty folder, or pass --force. Nothing was written.`
81091
81175
  );
81092
81176
  }
81093
- for (const file3 of pulled.files) {
81094
- const target = join21(folder, ...file3.path.split("/"));
81177
+ for (const file4 of pulled.files) {
81178
+ const target = join22(folder, ...file4.path.split("/"));
81095
81179
  await mkdir18(dirname18(target), { recursive: true });
81096
81180
  await writeFile18(
81097
81181
  target,
81098
- file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
81182
+ file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
81099
81183
  );
81100
81184
  }
81101
81185
  const manifest = {
@@ -81110,7 +81194,7 @@ var appPull = async ({ context, args }) => {
81110
81194
  ])
81111
81195
  )
81112
81196
  };
81113
- await writeFile18(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
81197
+ await writeFile18(join22(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
81114
81198
  `);
81115
81199
  const names = pulled.collections.map((collection) => collection.name);
81116
81200
  const where = relative3(context.cwd, folder) || ".";
@@ -81423,10 +81507,10 @@ var appExport = async ({ context, args }) => {
81423
81507
  };
81424
81508
  var appImport = async ({ context, args }) => {
81425
81509
  const words = args.words.slice(2);
81426
- const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
81427
- if (!collection || !file3) throw new CliUsageError(USAGE5);
81428
- const csv = await readFile22(resolve8(context.cwd, file3), "utf8").catch(() => {
81429
- throw new CliUsageError(`Cannot read ${file3}`);
81510
+ const [named, collection, file4] = words.length >= 3 ? words : [void 0, ...words];
81511
+ if (!collection || !file4) throw new CliUsageError(USAGE5);
81512
+ const csv = await readFile22(resolve8(context.cwd, file4), "utf8").catch(() => {
81513
+ throw new CliUsageError(`Cannot read ${file4}`);
81430
81514
  });
81431
81515
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
81432
81516
  const client = await appClient({ context, args: scoped });
@@ -81839,11 +81923,11 @@ async function app({ context, args }) {
81839
81923
  import { hostname as hostname6 } from "node:os";
81840
81924
 
81841
81925
  // src/rules/machine-proof.rules.ts
81842
- import { createHash as createHash4, randomBytes } from "node:crypto";
81926
+ import { createHash as createHash5, randomBytes } from "node:crypto";
81843
81927
  var b64url3 = (bytes) => Buffer.from(bytes).toString("base64url");
81844
81928
  function thumbprintOf({ jwk }) {
81845
81929
  const canonical = JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y });
81846
- return b64url3(createHash4("sha256").update(canonical).digest());
81930
+ return b64url3(createHash5("sha256").update(canonical).digest());
81847
81931
  }
81848
81932
  function lazeTokenOf({ authorization }) {
81849
81933
  const match = /^Bearer (lz_\S+)$/.exec(authorization ?? "");
@@ -81867,7 +81951,7 @@ function machineProofOf({
81867
81951
  htu: url2,
81868
81952
  iat: Math.floor(nowMs / 1e3),
81869
81953
  jti,
81870
- ath: b64url3(createHash4("sha256").update(credential).digest()),
81954
+ ath: b64url3(createHash5("sha256").update(credential).digest()),
81871
81955
  lz_tier: tier,
81872
81956
  ...tailscaleNodeId ? { lz_ts: tailscaleNodeId } : {}
81873
81957
  })
@@ -82285,12 +82369,12 @@ async function billing({ context, args }) {
82285
82369
  // src/services/browser-commands.service.ts
82286
82370
  import { randomBytes as randomBytes2 } from "node:crypto";
82287
82371
  import { mkdir as mkdir21, readFile as readFile24, writeFile as writeFile21 } from "node:fs/promises";
82288
- import { dirname as dirname20, join as join24 } from "node:path";
82372
+ import { dirname as dirname20, join as join25 } from "node:path";
82289
82373
 
82290
82374
  // src/services/browser-tab-commands.service.ts
82291
82375
  import { mkdir as mkdir20, writeFile as writeFile20 } from "node:fs/promises";
82292
82376
  import { tmpdir as tmpdir3 } from "node:os";
82293
- import { join as join23 } from "node:path";
82377
+ import { join as join24 } from "node:path";
82294
82378
 
82295
82379
  // src/rules/browser-login.rules.ts
82296
82380
  var PASSWORD_NAME = /pass|pwd/i;
@@ -82320,10 +82404,10 @@ function loginValuesOf({
82320
82404
  }
82321
82405
 
82322
82406
  // src/services/vault-commands.service.ts
82323
- import { createHash as createHash5 } from "node:crypto";
82324
- import { mkdir as mkdir19, readFile as readFile23, rm as rm9, writeFile as writeFile19 } from "node:fs/promises";
82407
+ import { createHash as createHash6 } from "node:crypto";
82408
+ import { mkdir as mkdir19, readFile as readFile23, rm as rm10, writeFile as writeFile19 } from "node:fs/promises";
82325
82409
  import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
82326
- import { dirname as dirname19, join as join22 } from "node:path";
82410
+ import { dirname as dirname19, join as join23 } from "node:path";
82327
82411
 
82328
82412
  // src/rules/vault-session.rules.ts
82329
82413
  function vaultSessionOf({
@@ -82398,9 +82482,9 @@ function runKeyPathOf({
82398
82482
  connection,
82399
82483
  profile = ""
82400
82484
  }) {
82401
- const name3 = createHash5("sha256").update(connection).digest("hex");
82402
- const base = turnFile ? dirname19(turnFile) : join22(tmpdir2(), "laze-vault", profile);
82403
- return join22(base, "vault-run-keys", `${name3}.json`);
82485
+ const name3 = createHash6("sha256").update(connection).digest("hex");
82486
+ const base = turnFile ? dirname19(turnFile) : join23(tmpdir2(), "laze-vault", profile);
82487
+ return join23(base, "vault-run-keys", `${name3}.json`);
82404
82488
  }
82405
82489
  async function runKeyAt({ path }) {
82406
82490
  const saved3 = await readFile23(path, "utf8").then(
@@ -82578,13 +82662,13 @@ async function settled({
82578
82662
  }) {
82579
82663
  if (release2 === "capped") return { exitCode: 75 };
82580
82664
  if (release2.outcome === "deny") {
82581
- await rm9(keyPath, { force: true });
82665
+ await rm10(keyPath, { force: true });
82582
82666
  context.err(`${release2.message}
82583
82667
  `);
82584
82668
  return { exitCode: release2.exitCode || 1 };
82585
82669
  }
82586
82670
  const values = await envOf({ release: release2, run: run4 });
82587
- if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm9(keyPath, { force: true });
82671
+ if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm10(keyPath, { force: true });
82588
82672
  if (release2.message) context.err(`${release2.message}
82589
82673
  `);
82590
82674
  return { env: values };
@@ -82929,9 +83013,9 @@ async function savedScreenshot({
82929
83013
  data,
82930
83014
  nowMs
82931
83015
  }) {
82932
- const folder = join23(tmpdir3(), "laze-browser");
83016
+ const folder = join24(tmpdir3(), "laze-browser");
82933
83017
  await mkdir20(folder, { recursive: true, mode: 448 });
82934
- const path = join23(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
83018
+ const path = join24(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
82935
83019
  await writeFile20(path, Buffer.from(data, "base64"), { mode: 384 });
82936
83020
  return path;
82937
83021
  }
@@ -83019,7 +83103,7 @@ function tunnel({
83019
83103
  host: host2,
83020
83104
  port
83021
83105
  }) {
83022
- return new Promise((resolve24, reject) => {
83106
+ return new Promise((resolve25, reject) => {
83023
83107
  const socket = connectTcp(proxy.port, proxy.host);
83024
83108
  let answer6 = "";
83025
83109
  const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
@@ -83036,7 +83120,7 @@ ${auth}\r
83036
83120
  answer6 += chunk.toString("latin1");
83037
83121
  if (!answer6.includes(HEADER_END)) return;
83038
83122
  socket.off("data", onData);
83039
- if (/^HTTP\/1\.[01] 200/.test(answer6)) return resolve24(socket);
83123
+ if (/^HTTP\/1\.[01] 200/.test(answer6)) return resolve25(socket);
83040
83124
  socket.destroy();
83041
83125
  reject(new Error(`proxy refused the tunnel: ${answer6.split("\r\n")[0] ?? ""}`));
83042
83126
  };
@@ -83049,8 +83133,8 @@ async function upstreamOf({ target, proxy }) {
83049
83133
  const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
83050
83134
  if (!secure) return raw;
83051
83135
  const tls = connectTls({ socket: raw, servername: target.hostname });
83052
- await new Promise((resolve24, reject) => {
83053
- tls.once("secureConnect", () => resolve24());
83136
+ await new Promise((resolve25, reject) => {
83137
+ tls.once("secureConnect", () => resolve25());
83054
83138
  tls.once("error", reject);
83055
83139
  });
83056
83140
  return tls;
@@ -83092,8 +83176,8 @@ async function browserSocket({
83092
83176
  createConnection: () => upstream,
83093
83177
  perMessageDeflate: false
83094
83178
  });
83095
- await new Promise((resolve24, reject) => {
83096
- socket.once("open", () => resolve24());
83179
+ await new Promise((resolve25, reject) => {
83180
+ socket.once("open", () => resolve25());
83097
83181
  socket.once("error", reject);
83098
83182
  });
83099
83183
  return socket;
@@ -83106,12 +83190,12 @@ async function browserCall({
83106
83190
  }) {
83107
83191
  const socket = await browserSocket({ target, proxy });
83108
83192
  try {
83109
- return await new Promise((resolve24, reject) => {
83193
+ return await new Promise((resolve25, reject) => {
83110
83194
  socket.on("message", (data) => {
83111
83195
  const reply2 = JSON.parse(textOf3(data));
83112
83196
  if (reply2.id !== 1) return;
83113
83197
  if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
83114
- else resolve24(reply2.result ?? {});
83198
+ else resolve25(reply2.result ?? {});
83115
83199
  });
83116
83200
  socket.once(
83117
83201
  "close",
@@ -83275,18 +83359,18 @@ function retargetCdpBridge({
83275
83359
  target,
83276
83360
  expiresAt
83277
83361
  }) {
83278
- return new Promise((resolve24) => {
83362
+ return new Promise((resolve25) => {
83279
83363
  const call = httpRequest(
83280
83364
  { host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
83281
83365
  (response) => {
83282
83366
  response.resume();
83283
- resolve24(response.statusCode === 204);
83367
+ resolve25(response.statusCode === 204);
83284
83368
  }
83285
83369
  );
83286
83370
  call.setHeader(KEY_HEADER, key);
83287
83371
  call.setHeader("content-type", "application/json");
83288
83372
  call.once("timeout", () => call.destroy());
83289
- call.once("error", () => resolve24(false));
83373
+ call.once("error", () => resolve25(false));
83290
83374
  call.end(JSON.stringify({ target, expiresAt }));
83291
83375
  });
83292
83376
  }
@@ -83335,15 +83419,15 @@ async function startCdpBridge({
83335
83419
  (socket) => relayPage({ client: socket, targetId, target: url2, proxy })
83336
83420
  );
83337
83421
  });
83338
- await new Promise((resolve24) => server.listen(0, "127.0.0.1", resolve24));
83422
+ await new Promise((resolve25) => server.listen(0, "127.0.0.1", resolve25));
83339
83423
  const port = server.address().port;
83340
83424
  return {
83341
83425
  port,
83342
- close: () => new Promise((resolve24) => {
83426
+ close: () => new Promise((resolve25) => {
83343
83427
  for (const client of relayed) client.destroy();
83344
83428
  pages.close();
83345
83429
  server.closeAllConnections();
83346
- server.close(() => resolve24());
83430
+ server.close(() => resolve25());
83347
83431
  })
83348
83432
  };
83349
83433
  }
@@ -83360,7 +83444,7 @@ function launchCdpBridge({
83360
83444
  stdio: ["ignore", "pipe", "ignore"],
83361
83445
  env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
83362
83446
  });
83363
- return new Promise((resolve24, reject) => {
83447
+ return new Promise((resolve25, reject) => {
83364
83448
  let printed2 = "";
83365
83449
  child.once("error", reject);
83366
83450
  child.once("exit", (code) => reject(new Error(`the CDP bridge stopped (${code})`)));
@@ -83371,7 +83455,7 @@ function launchCdpBridge({
83371
83455
  child.stdout.destroy();
83372
83456
  child.removeAllListeners("exit");
83373
83457
  child.unref();
83374
- if (Number.isInteger(port) && port > 0) resolve24(port);
83458
+ if (Number.isInteger(port) && port > 0) resolve25(port);
83375
83459
  else reject(new Error("the CDP bridge printed no port"));
83376
83460
  });
83377
83461
  });
@@ -83498,7 +83582,7 @@ async function answering({
83498
83582
  }
83499
83583
  function bridgeStatePath({ context, machine: machine2 }) {
83500
83584
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
83501
- return join24(dirname20(context.environment.configPath), "bridges", `${safe}.json`);
83585
+ return join25(dirname20(context.environment.configPath), "bridges", `${safe}.json`);
83502
83586
  }
83503
83587
  async function bridgePort({
83504
83588
  context,
@@ -84221,7 +84305,7 @@ import { basename as basename7, isAbsolute as isAbsolute2, relative as relative4
84221
84305
 
84222
84306
  // src/services/file-download.service.ts
84223
84307
  import { createWriteStream } from "node:fs";
84224
- import { mkdir as mkdir22, rename as rename5, rm as rm10, stat as stat9, truncate } from "node:fs/promises";
84308
+ import { mkdir as mkdir22, rename as rename5, rm as rm11, stat as stat9, truncate } from "node:fs/promises";
84225
84309
  import { basename as basename6, dirname as dirname21, resolve as resolve9 } from "node:path";
84226
84310
  import { Readable, Transform } from "node:stream";
84227
84311
  import { pipeline } from "node:stream/promises";
@@ -84346,7 +84430,7 @@ async function downloadFile({
84346
84430
  await mkdir22(dirname21(part), { recursive: true });
84347
84431
  const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
84348
84432
  async (error63) => {
84349
- await rm10(part, { force: true });
84433
+ await rm11(part, { force: true });
84350
84434
  if (!isDiskError(error63)) throw error63;
84351
84435
  throw new CliUsageError(`Could not write ${attachmentId} to disk: ${String(error63)}`);
84352
84436
  }
@@ -84798,7 +84882,7 @@ async function chatActions({
84798
84882
  }
84799
84883
 
84800
84884
  // src/services/claude-monitor.service.ts
84801
- import { readFile as readFile26, rm as rm11 } from "node:fs/promises";
84885
+ import { readFile as readFile26, rm as rm12 } from "node:fs/promises";
84802
84886
  var MONITOR_IDLE_MS = 3e4;
84803
84887
  var MONITOR_OUTRANKED_MS = 3e3;
84804
84888
  async function deliverOnce({
@@ -84866,7 +84950,7 @@ async function monitorRound(turn) {
84866
84950
  async function release({ context, profile }) {
84867
84951
  const lock = statePathOf({ context, kind: "waiters", profile });
84868
84952
  if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
84869
- await rm11(lock, { force: true });
84953
+ await rm12(lock, { force: true });
84870
84954
  }
84871
84955
  async function monitorHook({ context, args }) {
84872
84956
  const claudePid = await claudePidOf({ context });
@@ -86095,17 +86179,41 @@ var WHATSAPP_AGENT_LEVELS = ["allow", "ask", "off"];
86095
86179
  var whatsappAgentLevelSchema = external_exports.enum(WHATSAPP_AGENT_LEVELS);
86096
86180
  var whatsappAgentControlSchema = external_exports.enum(["read", "send"]);
86097
86181
  var WHATSAPP_READ_WAIT_MAX_SECONDS = 50;
86182
+ var WHATSAPP_LEASE_CHOICES = [3600, 86400, 172800];
86183
+ var WHATSAPP_LEASE_DEFAULT_SECONDS = 172800;
86184
+ var whatsappLeaseSecondsSchema = external_exports.number().int().refine((seconds) => WHATSAPP_LEASE_CHOICES.includes(seconds), {
86185
+ message: "A lease is 1 hour, 1 day or 2 days"
86186
+ });
86187
+ var WHATSAPP_AGENT_ACCESS = ["ask", "read", "read_send", "read_only", "off"];
86188
+ var whatsappAgentAccessLevelSchema = external_exports.enum(WHATSAPP_AGENT_ACCESS);
86098
86189
  var agentAccessDefinition = external_exports.object({
86099
86190
  agentId: external_exports.string(),
86100
86191
  name: external_exports.string(),
86101
86192
  /** Whether anyone besides the owner can talk to the agent. */
86102
86193
  shared: external_exports.boolean(),
86103
86194
  read: whatsappAgentLevelSchema,
86104
- send: whatsappAgentLevelSchema
86195
+ send: whatsappAgentLevelSchema,
86196
+ /** What "Allow for" on this agent's cards lasts. */
86197
+ leaseSeconds: external_exports.number().int().positive().default(WHATSAPP_LEASE_DEFAULT_SECONDS),
86198
+ /** Until when a lease lets the agent read, or send, with no card; null when none runs. */
86199
+ readLeaseUntil: external_exports.iso.datetime().nullable().default(null),
86200
+ sendLeaseUntil: external_exports.iso.datetime().nullable().default(null),
86201
+ /** The owner set this agent's own level; false while it follows "Every agent". */
86202
+ overridden: external_exports.boolean().default(false)
86203
+ });
86204
+ var everyAgentDefinition = external_exports.object({
86205
+ /** The level every agent without its own follows; an agent shared with others asks to read. */
86206
+ access: whatsappAgentAccessLevelSchema,
86207
+ /** What "Allow for" lasts on every agent's cards. */
86208
+ leaseSeconds: external_exports.number().int().positive()
86105
86209
  });
86106
86210
  var agentsDefinition = external_exports.object({
86107
86211
  machineId: external_exports.string(),
86108
- agents: external_exports.array(agentAccessDefinition)
86212
+ agents: external_exports.array(agentAccessDefinition),
86213
+ everyAgent: everyAgentDefinition.default({
86214
+ access: "read",
86215
+ leaseSeconds: WHATSAPP_LEASE_DEFAULT_SECONDS
86216
+ })
86109
86217
  });
86110
86218
  var whatsappAgentsSchema = agentsDefinition;
86111
86219
  var setAgentDefinition = external_exports.object({
@@ -86118,6 +86226,32 @@ var setAgentDefinition = external_exports.object({
86118
86226
  reauthToken: external_exports.string().min(1).max(200).optional()
86119
86227
  });
86120
86228
  var setWhatsappAgentInputSchema = setAgentDefinition;
86229
+ var setLeaseDefinition = external_exports.object({
86230
+ workspaceId: external_exports.string().min(1).max(64),
86231
+ machine: external_exports.string().min(1).max(64),
86232
+ agentId: external_exports.string().min(1).max(64),
86233
+ leaseSeconds: whatsappLeaseSecondsSchema
86234
+ });
86235
+ var setWhatsappAgentLeaseInputSchema = setLeaseDefinition;
86236
+ var setEveryAgentDefinition = external_exports.object({
86237
+ workspaceId: external_exports.string().min(1).max(64),
86238
+ machine: external_exports.string().min(1).max(64),
86239
+ access: whatsappAgentAccessLevelSchema.optional(),
86240
+ leaseSeconds: whatsappLeaseSecondsSchema.optional(),
86241
+ /** The vault's one-use proof, needed when the level moves towards Allow. */
86242
+ reauthToken: external_exports.string().min(1).max(200).optional()
86243
+ });
86244
+ var setWhatsappEveryAgentInputSchema = setEveryAgentDefinition;
86245
+ var WHATSAPP_EVERY_AGENT = "every_agent";
86246
+ var setAgentAccessDefinition = external_exports.object({
86247
+ workspaceId: external_exports.string().min(1).max(64),
86248
+ machine: external_exports.string().min(1).max(64),
86249
+ agentId: external_exports.string().min(1).max(64),
86250
+ access: external_exports.union([whatsappAgentAccessLevelSchema, external_exports.literal(WHATSAPP_EVERY_AGENT)]),
86251
+ /** The vault's one-use proof, needed when Read or Send moves towards Allow. */
86252
+ reauthToken: external_exports.string().min(1).max(200).optional()
86253
+ });
86254
+ var setWhatsappAgentAccessInputSchema = setAgentAccessDefinition;
86121
86255
 
86122
86256
  // ../../modules/compute/contract/src/own-machine-whatsapp.ts
86123
86257
  var workspaceIdSchema20 = external_exports.string().min(1).max(64);
@@ -86138,12 +86272,29 @@ var whatsappChatDefinition = external_exports.object({
86138
86272
  lastMessageAt: external_exports.string().nullable().default(null),
86139
86273
  lastMessage: external_exports.string().max(500).default("")
86140
86274
  });
86275
+ var whatsappChangeMediaDefinition = external_exports.object({
86276
+ kind: external_exports.enum(["voice", "audio", "image", "video", "document", "sticker"]),
86277
+ mime: external_exports.string().max(200),
86278
+ size: external_exports.number().int().positive(),
86279
+ seconds: external_exports.number().int().nonnegative().optional(),
86280
+ name: external_exports.string().max(500).optional(),
86281
+ /** How the last fetch ended; absent while one is due, and from older connectors. */
86282
+ state: external_exports.enum(["done", "gone", "too_large"]).optional(),
86283
+ /** The Laze file the mirrored message carries, once confirmed; only between connector and api. */
86284
+ fileId: external_exports.string().max(200).optional()
86285
+ });
86141
86286
  var whatsappMessageDefinition = external_exports.object({
86142
86287
  id: external_exports.string().max(200),
86143
86288
  at: external_exports.string(),
86144
86289
  fromMe: external_exports.boolean(),
86145
86290
  sender: external_exports.string().max(500),
86146
- text: external_exports.string()
86291
+ text: external_exports.string(),
86292
+ /** The message's file; `laze whatsapp file` fetches it. Absent from older connectors. */
86293
+ media: external_exports.object({
86294
+ ...whatsappChangeMediaDefinition.shape,
86295
+ /** A voice or audio message's words, once Laze transcribed the mirrored copy. */
86296
+ transcript: external_exports.string().optional()
86297
+ }).optional()
86147
86298
  });
86148
86299
  var chatsResultDefinition = external_exports.object({
86149
86300
  machine: external_exports.string(),
@@ -86175,6 +86326,28 @@ var readInputDefinition = external_exports.object({
86175
86326
  limit: limitSchema.optional(),
86176
86327
  ...readAskFields
86177
86328
  });
86329
+ var fileInputDefinition = external_exports.object({
86330
+ workspaceId: workspaceIdSchema20,
86331
+ machine: whatsappMachineRef,
86332
+ /** The chat as a read names it: its id, a phone number or the exact contact or group name. */
86333
+ chat: chatRefSchema,
86334
+ /** The message id a read showed. */
86335
+ id: external_exports.string().trim().min(1).max(200),
86336
+ ...readAskFields
86337
+ });
86338
+ var whatsappFileDefinition = external_exports.object({
86339
+ machine: external_exports.string(),
86340
+ chat: external_exports.string().max(200),
86341
+ id: external_exports.string().max(200),
86342
+ kind: whatsappChangeMediaDefinition.shape.kind,
86343
+ fileName: external_exports.string().max(500),
86344
+ contentType: external_exports.string().max(200),
86345
+ sizeBytes: external_exports.number().int().nonnegative(),
86346
+ url: external_exports.string(),
86347
+ expiresAt: external_exports.string(),
86348
+ /** A voice or audio message's words, once Laze transcribed the mirrored copy. */
86349
+ transcript: external_exports.string().optional()
86350
+ });
86178
86351
  var sendInputDefinition = external_exports.object({
86179
86352
  workspaceId: workspaceIdSchema20,
86180
86353
  machine: whatsappMachineRef,
@@ -86276,13 +86449,6 @@ var whatsappComputerDefinition = external_exports.object({
86276
86449
  var whatsappComputerSchema = whatsappComputerDefinition;
86277
86450
  var whatsappComputerInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20 });
86278
86451
  var whatsappComputerInputSchema = whatsappComputerInputDefinition;
86279
- var whatsappChangeMediaDefinition = external_exports.object({
86280
- kind: external_exports.enum(["voice", "audio", "image", "video", "document", "sticker"]),
86281
- mime: external_exports.string().max(200),
86282
- size: external_exports.number().int().positive(),
86283
- seconds: external_exports.number().int().nonnegative().optional(),
86284
- name: external_exports.string().max(500).optional()
86285
- });
86286
86452
  var whatsappChangeDefinition = external_exports.object({
86287
86453
  chat: external_exports.string().min(1).max(200),
86288
86454
  chatName: external_exports.string().max(500),
@@ -86298,6 +86464,13 @@ var whatsappChangeDefinition = external_exports.object({
86298
86464
  /** The chat's other ids, such as the hidden id it was first seen under; new in Nov 2026. */
86299
86465
  aliases: external_exports.array(external_exports.string().min(1).max(200)).max(16).optional()
86300
86466
  });
86467
+ var whatsappReadDefinition = external_exports.object({
86468
+ chat: external_exports.string().min(1).max(200),
86469
+ at: external_exports.iso.datetime(),
86470
+ unread: external_exports.number().int().positive().max(1e6).optional(),
86471
+ /** The chat's other ids, such as the hidden id it was first seen under. */
86472
+ aliases: external_exports.array(external_exports.string().min(1).max(200)).max(16).optional()
86473
+ });
86301
86474
  var whatsappPairingSchema = whatsappPairingDefinition;
86302
86475
  var pairingRefDefinition = external_exports.object({
86303
86476
  workspaceId: workspaceIdSchema20,
@@ -86307,11 +86480,13 @@ var whatsappPairingRefSchema = pairingRefDefinition;
86307
86480
  var restPairingRefDefinition = external_exports.object({ pairingId: external_exports.string().min(1).max(64) });
86308
86481
  var restChatsDefinition = chatsInputDefinition.omit({ workspaceId: true });
86309
86482
  var restReadDefinition = readInputDefinition.omit({ workspaceId: true });
86483
+ var restFileDefinition = fileInputDefinition.omit({ workspaceId: true });
86310
86484
  var restSendDefinition = sendInputDefinition.omit({ workspaceId: true });
86311
86485
  var restSendStatusDefinition = sendStatusInputDefinition.omit({ workspaceId: true });
86312
86486
  var COMPUTE_WHATSAPP_REST_PATHS = {
86313
86487
  chats: "/api/compute/whatsapp/chats",
86314
86488
  read: "/api/compute/whatsapp/read",
86489
+ file: "/api/compute/whatsapp/file",
86315
86490
  send: "/api/compute/whatsapp/send",
86316
86491
  sendStatus: "/api/compute/whatsapp/send-status",
86317
86492
  unpair: "/api/compute/whatsapp/unpair"
@@ -86584,6 +86759,22 @@ var openScreenDefinition = external_exports.object({
86584
86759
  site: external_exports.string().min(1).max(500).optional()
86585
86760
  });
86586
86761
  var openScreenInputSchema = openScreenDefinition;
86762
+ var loginTerminalHarnessSchema = external_exports.enum(["claude-code", "codex"]);
86763
+ var openLoginTerminalDefinition = external_exports.object({
86764
+ workspaceId: workspaceIdSchema22,
86765
+ harness: loginTerminalHarnessSchema
86766
+ });
86767
+ var openLoginTerminalInputSchema = openLoginTerminalDefinition;
86768
+ var loginTerminalDefinition = external_exports.discriminatedUnion("status", [
86769
+ external_exports.object({ status: external_exports.literal("starting"), retryAfterSeconds: external_exports.number().int().positive() }),
86770
+ external_exports.object({
86771
+ status: external_exports.literal("ready"),
86772
+ /** The WebSocket path of the terminal, token included; add `cols` and `rows`. */
86773
+ streamPath: external_exports.string(),
86774
+ expiresAt: external_exports.iso.datetime()
86775
+ })
86776
+ ]);
86777
+ var loginTerminalSchema = loginTerminalDefinition;
86587
86778
  var screenRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, sessionId: idSchema23 });
86588
86779
  var screenRefSchema = screenRefDefinition;
86589
86780
  var screenSessionDefinition = external_exports.object({
@@ -86624,8 +86815,8 @@ var ownMachineSshConnectDefinition = external_exports.object({
86624
86815
  var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
86625
86816
  var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, machineId: idSchema23 });
86626
86817
  var ComputeApi = moduleApi()("compute");
86627
- 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();
86628
- 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).build();
86818
+ 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();
86819
+ 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).mutation("setWhatsappEveryAgent").withInput(setWhatsappEveryAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentAccess").withInput(setWhatsappAgentAccessInputSchema).withOutput(whatsappAgentsSchema).build();
86629
86820
  var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
86630
86821
  var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
86631
86822
  var restRenameInputDefinition = external_exports.object({
@@ -86696,7 +86887,7 @@ var computeUi = uiTokens("compute");
86696
86887
  var ComputeWhatsappMessagingSlot = computeUi.component("whatsapp-messaging");
86697
86888
  var ComputeBrowserTabSlot = computeUi.component("browser-tab");
86698
86889
  var ComputeOpenBrowserSlot = computeUi.component("open-browser");
86699
- var ComputeBrowserLinkOfferSlot = computeUi.component("browser-link-offer");
86890
+ var ComputeLoginTerminalSlot = computeUi.component("login-terminal");
86700
86891
 
86701
86892
  // ../../modules/compute/contract/src/computer-copy.ts
86702
86893
  var COMPUTER_COPY_MAX_BYTES = 2 * 1024 * 1024 * 1024;
@@ -86785,7 +86976,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
86785
86976
  });
86786
86977
 
86787
86978
  // src/services/computer-copy-commands.service.ts
86788
- import { mkdtemp as mkdtemp2, open as open4, rm as rm12, stat as stat10 } from "node:fs/promises";
86979
+ import { mkdtemp as mkdtemp2, open as open4, rm as rm13, stat as stat10 } from "node:fs/promises";
86789
86980
  import { tmpdir as tmpdir4 } from "node:os";
86790
86981
  import { basename as basename8, dirname as dirname22, resolve as resolve11 } from "node:path";
86791
86982
  var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
@@ -86812,12 +87003,12 @@ async function sendParts2({
86812
87003
  }) {
86813
87004
  const { upload } = started;
86814
87005
  const parts = [];
86815
- const file3 = await open4(archive2, "r");
87006
+ const file4 = await open4(archive2, "r");
86816
87007
  try {
86817
87008
  for (const part of upload.parts) {
86818
87009
  const length = part.end - part.start;
86819
87010
  const bytes = Buffer.alloc(length);
86820
- await file3.read(bytes, 0, length, part.start);
87011
+ await file4.read(bytes, 0, length, part.start);
86821
87012
  const single = upload.mode === "single";
86822
87013
  const response = await context.fetcher(part.url, {
86823
87014
  method: "PUT",
@@ -86837,7 +87028,7 @@ async function sendParts2({
86837
87028
  `);
86838
87029
  }
86839
87030
  } finally {
86840
- await file3.close();
87031
+ await file4.close();
86841
87032
  }
86842
87033
  return upload.mode === "multipart" ? parts : [];
86843
87034
  }
@@ -86886,7 +87077,7 @@ It lands before ${done.agentName}'s next turn.
86886
87077
  `
86887
87078
  );
86888
87079
  } finally {
86889
- await rm12(dir, { recursive: true, force: true });
87080
+ await rm13(dir, { recursive: true, force: true });
86890
87081
  }
86891
87082
  }
86892
87083
 
@@ -87312,8 +87503,8 @@ async function turnOf({ context }) {
87312
87503
  const env = context.environment.inherited;
87313
87504
  const pinned = env.LAZE_TURN_TOKEN?.trim();
87314
87505
  if (pinned) return pinned;
87315
- const file3 = env.LAZE_TURN_FILE;
87316
- const turn = file3 ? await readFile28(file3, "utf8").then(
87506
+ const file4 = env.LAZE_TURN_FILE;
87507
+ const turn = file4 ? await readFile28(file4, "utf8").then(
87317
87508
  (text3) => text3.trim(),
87318
87509
  () => ""
87319
87510
  ) : "";
@@ -87792,8 +87983,8 @@ async function secretText({ context, args }) {
87792
87983
  "A secret never goes in a flag (shell history keeps it): pipe it on stdin or use --from-file."
87793
87984
  );
87794
87985
  }
87795
- const file3 = flagText({ args, name: "from-file" });
87796
- const text3 = file3 ? await readFile29(file3, "utf8") : await context.readStdin();
87986
+ const file4 = flagText({ args, name: "from-file" });
87987
+ const text3 = file4 ? await readFile29(file4, "utf8") : await context.readStdin();
87797
87988
  const trimmed = text3.replace(/\r?\n$/, "");
87798
87989
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
87799
87990
  return trimmed;
@@ -88025,8 +88216,8 @@ async function keyText({ context, args }) {
88025
88216
  if (KEY_FLAGS.some((flag2) => args.flags[flag2] !== void 0)) {
88026
88217
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
88027
88218
  }
88028
- const file3 = flagText({ args, name: "from-file" });
88029
- const text3 = file3 ? await readFile30(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
88219
+ const file4 = flagText({ args, name: "from-file" });
88220
+ const text3 = file4 ? await readFile30(resolve12(context.cwd, file4), "utf8") : await context.readStdin();
88030
88221
  const trimmed = text3.trim();
88031
88222
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
88032
88223
  return trimmed;
@@ -88668,8 +88859,8 @@ async function secretsOf({ context, args }) {
88668
88859
  }
88669
88860
  const fromConnection = flagText({ args, name: "from-vault" });
88670
88861
  if (fromConnection) return { fromConnection };
88671
- const file3 = flagText({ args, name: "from-file" });
88672
- const text3 = file3 ? await readFile31(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
88862
+ const file4 = flagText({ args, name: "from-file" });
88863
+ const text3 = file4 ? await readFile31(resolve13(context.cwd, file4), "utf8") : await context.readStdin();
88673
88864
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
88674
88865
  if (lines2.length !== 2) {
88675
88866
  throw new CliUsageError(
@@ -88939,8 +89130,8 @@ var DOMAINS_USAGE = `Usage:
88939
89130
  var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
88940
89131
  `);
88941
89132
  function printDomain(context, row) {
88942
- const join32 = row.autoJoin ? "auto-join on" : "auto-join off";
88943
- context.out(`${row.domain} ${join32}${row.enforced ? " single sign-on enforced" : ""}
89133
+ const join33 = row.autoJoin ? "auto-join on" : "auto-join off";
89134
+ context.out(`${row.domain} ${join33}${row.enforced ? " single sign-on enforced" : ""}
88944
89135
  `);
88945
89136
  }
88946
89137
  async function list4({ context, args }) {
@@ -89010,17 +89201,17 @@ async function listEmoji({ context, args, client }) {
89010
89201
  for (const each of list12.emoji) context.out(shown(each));
89011
89202
  }
89012
89203
  async function addEmoji({ context, args, client }) {
89013
- const file3 = wordAt4(args, 3);
89204
+ const file4 = wordAt4(args, 3);
89014
89205
  let bytes;
89015
89206
  try {
89016
- bytes = new Uint8Array(await readFile32(resolve14(context.cwd, file3)));
89207
+ bytes = new Uint8Array(await readFile32(resolve14(context.cwd, file4)));
89017
89208
  } catch {
89018
- throw new CliUsageError(`Cannot read ${file3}.`);
89209
+ throw new CliUsageError(`Cannot read ${file4}.`);
89019
89210
  }
89020
89211
  const aliases = flagText({ args, name: "alias" }).split(",").map((alias) => alias.trim()).filter(Boolean);
89021
89212
  const added = await client.post(EMOJI_KEY_PATHS.add, {
89022
89213
  name: wordAt4(args, 2),
89023
- contentType: contentTypeOf(file3),
89214
+ contentType: contentTypeOf(file4),
89024
89215
  dataBase64: Buffer.from(bytes).toString("base64"),
89025
89216
  aliases
89026
89217
  });
@@ -89509,26 +89700,26 @@ function logoTypeOf(bytes) {
89509
89700
  }
89510
89701
  var LOGO_MAX_BYTES = 512 * 1024;
89511
89702
  var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze workspace logo remove";
89512
- async function readLogo({ context, file: file3 }) {
89703
+ async function readLogo({ context, file: file4 }) {
89513
89704
  let bytes;
89514
89705
  try {
89515
- bytes = new Uint8Array(await readFile33(resolve15(context.cwd, file3)));
89706
+ bytes = new Uint8Array(await readFile33(resolve15(context.cwd, file4)));
89516
89707
  } catch {
89517
- throw new CliUsageError(`No file to read at ${file3}.`);
89708
+ throw new CliUsageError(`No file to read at ${file4}.`);
89518
89709
  }
89519
89710
  const contentType = logoTypeOf(bytes);
89520
89711
  if (!contentType) throw new CliUsageError("A logo must be a PNG, JPEG or WebP picture.");
89521
89712
  if (bytes.byteLength > LOGO_MAX_BYTES) {
89522
89713
  throw new CliUsageError(
89523
- `A logo must be at most 512 KB; ${file3} is ${Math.ceil(bytes.byteLength / 1024)} KB.`
89714
+ `A logo must be at most 512 KB; ${file4} is ${Math.ceil(bytes.byteLength / 1024)} KB.`
89524
89715
  );
89525
89716
  }
89526
89717
  return { contentType, dataBase64: Buffer.from(bytes).toString("base64") };
89527
89718
  }
89528
89719
  async function logo({ context, args }) {
89529
- const [, , action, file3] = args.words;
89530
- if (action === "set" && file3) {
89531
- const body = await readLogo({ context, file: file3 });
89720
+ const [, , action, file4] = args.words;
89721
+ if (action === "set" && file4) {
89722
+ const body = await readLogo({ context, file: file4 });
89532
89723
  const { client } = await signedIn({ context, args });
89533
89724
  const answer6 = await client.post("/api/agents/me/workspace/logo", body);
89534
89725
  return print7({ context, args, answer: answer6, text: (it) => `Set the logo of ${it.name}.
@@ -90351,6 +90542,10 @@ var replyFeedItemInputSchemaDefinition = external_exports.object({
90351
90542
  /** Snoozes the item for these people in the same step, as `update` does. */
90352
90543
  snoozeFor: feedSnoozeForSchema.optional()
90353
90544
  });
90545
+ var feedSetCardSchemaDefinition = external_exports.object({
90546
+ links: external_exports.array(feedLinkSchema),
90547
+ actions: external_exports.array(feedItemActionSchema)
90548
+ });
90354
90549
  var feedEntrySchemaDefinition = external_exports.object({
90355
90550
  id: external_exports.string(),
90356
90551
  author: feedAuthorSchema,
@@ -90364,7 +90559,9 @@ var feedEntrySchemaDefinition = external_exports.object({
90364
90559
  urgent: external_exports.boolean(),
90365
90560
  createdAt: external_exports.iso.datetime(),
90366
90561
  /** Files a person's comment carried, as they were when sent; their bytes stay in chat. */
90367
- attachments: external_exports.array(feedAttachmentSchemaDefinition).max(FEED_ATTACHMENTS_MAX).optional()
90562
+ attachments: external_exports.array(feedAttachmentSchemaDefinition).max(FEED_ATTACHMENTS_MAX).optional(),
90563
+ /** On an agent's reply: the card's links and actions it set. Spec: feed-reply-card-set.feature */
90564
+ setCard: feedSetCardSchemaDefinition.optional()
90368
90565
  });
90369
90566
  var feedEntrySchema = feedEntrySchemaDefinition;
90370
90567
  var feedApprovalStateSchema = external_exports.enum([
@@ -90861,6 +91058,7 @@ var FeedNavSlot = feedUi.component("nav");
90861
91058
  var FeedDecisionsSlot = feedUi.component("decisions");
90862
91059
  var FeedCountHooksToken = feedUi.hooks("count");
90863
91060
  var FeedChannelCardSlot = feedUi.component("channel-card");
91061
+ var FeedCardPanelSlot = feedUi.component("card-panel");
90864
91062
  var FeedReplyLinksSlot = feedUi.component("reply-links");
90865
91063
  var FeedDelegateSlot = feedUi.component("delegate");
90866
91064
  var FeedSearchSlot = feedUi.component("search");
@@ -91214,7 +91412,7 @@ var USAGE10 = `Usage:
91214
91412
  [--image|--file <path|url|fileId>]... (adds) [--remove-file <fileId|name>]...
91215
91413
  [--auto-send-on <YYYY-MM-DD>|none] [--priority high|low|normal|<0 to 100>|none]
91216
91414
  [--show-at <ISO time>|none] [--snooze-for <userId>... --until <ISO time>|none] [--reopen]
91217
- laze feed reply <id> <text> [--done] [--quiet] [--urgent] [--force]
91415
+ laze feed reply <id> <text|-> [--done] [--quiet] [--urgent] [--force]
91218
91416
  [--snooze-for <userId>... --until <ISO time>]
91219
91417
  laze feed read <id>
91220
91418
  laze feed inbox
@@ -91227,7 +91425,7 @@ var USAGE10 = `Usage:
91227
91425
  laze feed count
91228
91426
  laze feed decisions [--json]
91229
91427
  laze feed act <id> <actionId> [--draft <text|@file>]
91230
- laze feed comment <id> <text> [--draft <text|@file>] [--force]
91428
+ laze feed comment <id> <text|-> [--draft <text|@file>] [--force]
91231
91429
  laze feed done|put-back|unsnooze|pin|unpin <id>
91232
91430
  laze feed snooze <id> --until <ISO time>
91233
91431
  laze feed channel <channelId>
@@ -91278,13 +91476,13 @@ function keptFilesOf({
91278
91476
  files: files2,
91279
91477
  removing
91280
91478
  }) {
91281
- const matches = (file3, name3) => file3.id === name3 || file3.fileName === name3;
91282
- const unknown2 = removing.filter((name3) => !files2.some((file3) => matches(file3, name3)));
91479
+ const matches = (file4, name3) => file4.id === name3 || file4.fileName === name3;
91480
+ const unknown2 = removing.filter((name3) => !files2.some((file4) => matches(file4, name3)));
91283
91481
  if (unknown2.length > 0) {
91284
- const on = files2.map((file3) => `${file3.fileName} (${file3.id})`).join(", ") || "none";
91482
+ const on = files2.map((file4) => `${file4.fileName} (${file4.id})`).join(", ") || "none";
91285
91483
  throw new CliUsageError(`The card has no file ${unknown2.join(", ")}; its files: ${on}`);
91286
91484
  }
91287
- return files2.filter((file3) => !removing.some((name3) => matches(file3, name3)));
91485
+ return files2.filter((file4) => !removing.some((name3) => matches(file4, name3)));
91288
91486
  }
91289
91487
  function refuseNamedFilesMissing({
91290
91488
  args,
@@ -91369,7 +91567,7 @@ async function feedUpdate({ context, args }) {
91369
91567
  channel: current3.item.channelId,
91370
91568
  people: current3.recipientUserIds
91371
91569
  }) : [];
91372
- const attachmentIds = adding || removing.length > 0 ? [...kept.map((file3) => file3.id), ...added] : void 0;
91570
+ const attachmentIds = adding || removing.length > 0 ? [...kept.map((file4) => file4.id), ...added] : void 0;
91373
91571
  const inTurn2 = await feedTurnOf({
91374
91572
  context,
91375
91573
  client,
@@ -91388,8 +91586,8 @@ async function feedUpdate({ context, args }) {
91388
91586
  }
91389
91587
  async function feedReply({ context, args }) {
91390
91588
  const itemId = args.words[2];
91391
- const text3 = args.words.slice(3).join(" ").trim();
91392
- if (!itemId || !text3) throw new CliUsageError(USAGE10);
91589
+ if (!itemId || args.words.length < 4) throw new CliUsageError(USAGE10);
91590
+ const text3 = await textOf({ context, args, from: 3 });
91393
91591
  const { client } = await signedIn({ context, args });
91394
91592
  const replied = await client.post("/api/feed/items/reply", {
91395
91593
  itemId,
@@ -91579,8 +91777,8 @@ async function feedAct({ context, args }) {
91579
91777
  }
91580
91778
  async function feedComment({ context, args }) {
91581
91779
  const itemId = args.words[2];
91582
- const text3 = args.words.slice(3).join(" ").trim();
91583
- if (!itemId || !text3) throw new CliUsageError(USAGE10);
91780
+ if (!itemId || args.words.length < 4) throw new CliUsageError(USAGE10);
91781
+ const text3 = await textOf({ context, args, from: 3 });
91584
91782
  const draft = await textFlag({ context, args, name: "draft" });
91585
91783
  const { client } = await signedIn({ context, args });
91586
91784
  const item = await client.post("/api/feed/mine/comment", {
@@ -91613,9 +91811,9 @@ async function ranksOf({
91613
91811
  context,
91614
91812
  args
91615
91813
  }) {
91616
- const file3 = flagText({ args, name: "file" });
91617
- if (file3) {
91618
- const parsed = JSON.parse(await readFile34(resolve16(context.cwd, file3), "utf8"));
91814
+ const file4 = flagText({ args, name: "file" });
91815
+ if (file4) {
91816
+ const parsed = JSON.parse(await readFile34(resolve16(context.cwd, file4), "utf8"));
91619
91817
  if (Array.isArray(parsed)) return parsed;
91620
91818
  throw new CliUsageError("--file holds a list of {itemId, priority}");
91621
91819
  }
@@ -92437,12 +92635,12 @@ async function ip({ context, args }) {
92437
92635
  }
92438
92636
 
92439
92637
  // src/services/join-commands.service.ts
92440
- import { mkdir as mkdir23, readFile as readFile36, rename as rename8, rm as rm13, writeFile as writeFile22 } from "node:fs/promises";
92441
- import { dirname as dirname23, join as join25 } from "node:path";
92638
+ import { mkdir as mkdir23, readFile as readFile36, rename as rename8, rm as rm14, writeFile as writeFile22 } from "node:fs/promises";
92639
+ import { dirname as dirname23, join as join26 } from "node:path";
92442
92640
  var DEFAULT_WAIT_SECONDS2 = 100;
92443
92641
  var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
92444
92642
  function pendingPathOf({ context }) {
92445
- return join25(dirname23(context.environment.configPath), "join", "pending.json");
92643
+ return join26(dirname23(context.environment.configPath), "join", "pending.json");
92446
92644
  }
92447
92645
  async function readPending({
92448
92646
  context,
@@ -92465,7 +92663,7 @@ async function keepPending({ context, pending: pending2 }) {
92465
92663
  await rename8(temporary, path);
92466
92664
  }
92467
92665
  async function dropPending({ context }) {
92468
- await rm13(pendingPathOf({ context }), { force: true });
92666
+ await rm14(pendingPathOf({ context }), { force: true });
92469
92667
  }
92470
92668
  function waitSecondsOf3({ args }) {
92471
92669
  const raw = flagText({ args, name: "timeout" });
@@ -93600,10 +93798,10 @@ async function serveMcp({
93600
93798
 
93601
93799
  // src/services/memory-commands.service.ts
93602
93800
  import { readdir as readdir7, readFile as readFile38 } from "node:fs/promises";
93603
- import { join as join26, resolve as resolve18 } from "node:path";
93801
+ import { join as join27, resolve as resolve18 } from "node:path";
93604
93802
 
93605
93803
  // src/services/mount-files.service.ts
93606
- import { mkdir as mkdir24, readFile as readFile37, rm as rm14, writeFile as writeFile23 } from "node:fs/promises";
93804
+ import { mkdir as mkdir24, readFile as readFile37, rm as rm15, writeFile as writeFile23 } from "node:fs/promises";
93607
93805
  import { dirname as dirname24, relative as relative5, resolve as resolve17 } from "node:path";
93608
93806
  async function textArgument({
93609
93807
  context,
@@ -93623,15 +93821,15 @@ async function writeMount({
93623
93821
  files: files2
93624
93822
  }) {
93625
93823
  const root = resolve17(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
93626
- await rm14(root, { recursive: true, force: true });
93824
+ await rm15(root, { recursive: true, force: true });
93627
93825
  await mkdir24(root, { recursive: true });
93628
- for (const file3 of files2) {
93629
- const target = resolve17(root, file3.path);
93826
+ for (const file4 of files2) {
93827
+ const target = resolve17(root, file4.path);
93630
93828
  const inside = relative5(root, target);
93631
93829
  if (!inside || inside.startsWith(".."))
93632
- throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
93830
+ throw new Error(`Refusing to write outside ${root}: ${file4.path}`);
93633
93831
  await mkdir24(dirname24(target), { recursive: true });
93634
- await writeFile23(target, file3.content);
93832
+ await writeFile23(target, file4.content);
93635
93833
  }
93636
93834
  return root;
93637
93835
  }
@@ -93663,10 +93861,10 @@ An agent reaches only its turn: another --channel or person is refused with memo
93663
93861
  var PROVENANCES = ["said", "decided", "verified", "inferred", "observed"];
93664
93862
  var FILES = /* @__PURE__ */ new Set(["SOUL.md", "AGENTS.md", "MEMORY.md"]);
93665
93863
  function fileRef({ context, args }) {
93666
- const file3 = args.words[2] ?? "";
93667
- if (!FILES.has(file3)) throw new CliUsageError(USAGE13);
93864
+ const file4 = args.words[2] ?? "";
93865
+ if (!FILES.has(file4)) throw new CliUsageError(USAGE13);
93668
93866
  const channel = turnChannel({ context, args });
93669
- return { file: file3, ...channel ? { channel } : {} };
93867
+ return { file: file4, ...channel ? { channel } : {} };
93670
93868
  }
93671
93869
  function printDocument({
93672
93870
  context,
@@ -93887,15 +94085,15 @@ async function siestaImport({
93887
94085
  dir
93888
94086
  }) {
93889
94087
  const root = resolve18(context.cwd, dir);
93890
- const log = await readFile38(join26(root, "LOG.md"));
93891
- const names = (await readdir7(join26(root, "tree")).catch(() => [])).filter(
94088
+ const log = await readFile38(join27(root, "LOG.md"));
94089
+ const names = (await readdir7(join27(root, "tree")).catch(() => [])).filter(
93892
94090
  (name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
93893
94091
  );
93894
94092
  const tree = Object.fromEntries(
93895
94093
  await Promise.all(
93896
94094
  names.map(async (name3) => [
93897
94095
  name3.slice(0, -3),
93898
- (await readFile38(join26(root, "tree", name3))).toString("base64")
94096
+ (await readFile38(join27(root, "tree", name3))).toString("base64")
93899
94097
  ])
93900
94098
  )
93901
94099
  );
@@ -93915,15 +94113,15 @@ async function memoryImport({ context, args }) {
93915
94113
  const dir = flagText({ args, name: "optmem" });
93916
94114
  if (!dir) throw new CliUsageError(USAGE13);
93917
94115
  const root = resolve18(context.cwd, dir);
93918
- const log = await readFile38(join26(root, "LOG.txt"));
93919
- const sizes2 = (await readdir7(join26(root, "TREE")).catch(() => [])).filter(
94116
+ const log = await readFile38(join27(root, "LOG.txt"));
94117
+ const sizes2 = (await readdir7(join27(root, "TREE")).catch(() => [])).filter(
93920
94118
  (name3) => /^\d{1,4}$/.test(name3)
93921
94119
  );
93922
94120
  const tree = Object.fromEntries(
93923
94121
  await Promise.all(
93924
94122
  sizes2.map(async (size) => [
93925
94123
  size,
93926
- (await readFile38(join26(root, "TREE", size))).toString("base64")
94124
+ (await readFile38(join27(root, "TREE", size))).toString("base64")
93927
94125
  ])
93928
94126
  )
93929
94127
  );
@@ -94487,9 +94685,9 @@ async function openclaw({
94487
94685
  }
94488
94686
 
94489
94687
  // src/services/operator-key-commands.service.ts
94490
- import { createHash as createHash6, randomBytes as randomBytes3 } from "node:crypto";
94491
- import { mkdir as mkdir25, readFile as readFile39, rm as rm15, writeFile as writeFile24 } from "node:fs/promises";
94492
- import { dirname as dirname25, join as join27 } from "node:path";
94688
+ import { createHash as createHash7, randomBytes as randomBytes3 } from "node:crypto";
94689
+ import { mkdir as mkdir25, readFile as readFile39, rm as rm16, writeFile as writeFile24 } from "node:fs/promises";
94690
+ import { dirname as dirname25, join as join28 } from "node:path";
94493
94691
 
94494
94692
  // ../../modules/audit-log/contract/src/audit-log.api.ts
94495
94693
  var auditEntrySchemaDefinition = external_exports.object({
@@ -95098,6 +95296,7 @@ var WorkspaceAlertsSlot = workspaceUi.extension("frame.alerts");
95098
95296
  var WorkspaceSidebarSlot = workspaceUi.component("sidebar");
95099
95297
  var WorkspaceSidebarHeadSlot = workspaceUi.component("sidebar.head");
95100
95298
  var WorkspaceSidebarTopSlot = workspaceUi.component("sidebar.top");
95299
+ var WorkspaceSidebarInvitesSlot = workspaceUi.extension("sidebar.invites");
95101
95300
  var WorkspaceSidebarFooterSlot = workspaceUi.extension("sidebar.footer");
95102
95301
  var WorkspaceInviteDialogSlot = workspaceUi.component("inviteDialog");
95103
95302
  var ProfileHooksToken = workspaceUi.hooks("profile");
@@ -95818,7 +96017,7 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
95818
96017
  laze ops status <key> waiting, approved or ended
95819
96018
  laze ops use <key> run the approved action and print the answer`;
95820
96019
  var POLL_MS3 = 5e3;
95821
- var keyFile = ({ context, keyId }) => join27(dirname25(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
96020
+ var keyFile = ({ context, keyId }) => join28(dirname25(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
95822
96021
  async function saveSecret({
95823
96022
  context,
95824
96023
  keyId,
@@ -95883,7 +96082,7 @@ async function requestKey({ context, args }) {
95883
96082
  target,
95884
96083
  args: argsOf({ args }),
95885
96084
  reason: reason2,
95886
- secretHash: createHash6("sha256").update(secret).digest("hex")
96085
+ secretHash: createHash7("sha256").update(secret).digest("hex")
95887
96086
  });
95888
96087
  await saveSecret({ context, keyId: key.id, secret });
95889
96088
  const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
@@ -95910,7 +96109,7 @@ async function forgetIfOver({
95910
96109
  const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
95911
96110
  const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
95912
96111
  if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
95913
- await rm15(keyFile({ context, keyId }), { force: true });
96112
+ await rm16(keyFile({ context, keyId }), { force: true });
95914
96113
  }
95915
96114
  return key;
95916
96115
  }
@@ -95985,7 +96184,7 @@ ${OPS_USAGE}`);
95985
96184
 
95986
96185
  // src/services/release-watch.service.ts
95987
96186
  import { mkdir as mkdir26, readFile as readFile40, realpath, writeFile as writeFile25 } from "node:fs/promises";
95988
- import { dirname as dirname26, join as join28 } from "node:path";
96187
+ import { dirname as dirname26, join as join29 } from "node:path";
95989
96188
 
95990
96189
  // src/rules/cli-update.rules.ts
95991
96190
  var CLI_PACKAGE = "@lazehq/cli";
@@ -96132,7 +96331,7 @@ async function startedUpdate({
96132
96331
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
96133
96332
  if (plan2.kind !== "install") return null;
96134
96333
  const folder = dirname26(context.environment.configPath);
96135
- const stamp = join28(folder, "auto-update.json");
96334
+ const stamp = join29(folder, "auto-update.json");
96136
96335
  const last = await readFile40(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
96137
96336
  const now = context.nowMs();
96138
96337
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
@@ -96140,7 +96339,7 @@ async function startedUpdate({
96140
96339
  await writeFile25(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
96141
96340
  context.processes.spawnDetached({
96142
96341
  argv: [...context.program, "update"],
96143
- logPath: join28(folder, "auto-update.log")
96342
+ logPath: join29(folder, "auto-update.log")
96144
96343
  });
96145
96344
  return { manager: plan2.manager };
96146
96345
  }
@@ -96177,7 +96376,7 @@ function watchingRelease({
96177
96376
  }
96178
96377
 
96179
96378
  // src/services/rush-guard.service.ts
96180
- import { readFile as readFile41, rm as rm16 } from "node:fs/promises";
96379
+ import { readFile as readFile41, rm as rm17 } from "node:fs/promises";
96181
96380
  var WATCH_MS3 = 2e3;
96182
96381
  var RETRY_MS2 = 3e4;
96183
96382
  async function guardRound(guard) {
@@ -96249,10 +96448,10 @@ async function rushWakeHook({ context, args }) {
96249
96448
  return 0;
96250
96449
  } finally {
96251
96450
  if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
96252
- await rm16(lock, { force: true });
96451
+ await rm17(lock, { force: true });
96253
96452
  }
96254
96453
  } finally {
96255
- await rm16(path, { force: true });
96454
+ await rm17(path, { force: true });
96256
96455
  }
96257
96456
  }
96258
96457
 
@@ -96419,7 +96618,7 @@ async function schedule({ context, args }) {
96419
96618
 
96420
96619
  // src/services/skill-commands.service.ts
96421
96620
  import { readdir as readdir8, readFile as readFile42 } from "node:fs/promises";
96422
- import { join as join29, relative as relative6, resolve as resolve20 } from "node:path";
96621
+ import { join as join30, relative as relative6, resolve as resolve20 } from "node:path";
96423
96622
  var USAGE17 = `Usage:
96424
96623
  laze skill list [--agent <agentId>]
96425
96624
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -96440,7 +96639,7 @@ async function folderFiles({ root }) {
96440
96639
  const files2 = [];
96441
96640
  for (const entry of entries) {
96442
96641
  if (!entry.isFile()) continue;
96443
- const full = join29(entry.parentPath, entry.name);
96642
+ const full = join30(entry.parentPath, entry.name);
96444
96643
  files2.push({ path: relative6(root, full), content: await readFile42(full, "utf8") });
96445
96644
  }
96446
96645
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
@@ -96498,9 +96697,9 @@ async function skillShow({ context, args }) {
96498
96697
  `);
96499
96698
  context.out(`${skill2.name}${skill2.installed ? "" : " (not installed)"}: ${skill2.description}
96500
96699
  `);
96501
- for (const file3 of skill2.files) context.out(` ${file3.path}
96700
+ for (const file4 of skill2.files) context.out(` ${file4.path}
96502
96701
  `);
96503
- const skillMd = skill2.files.find((file3) => file3.path === "SKILL.md");
96702
+ const skillMd = skill2.files.find((file4) => file4.path === "SKILL.md");
96504
96703
  if (skillMd) context.out(`
96505
96704
  ${skillMd.content}`);
96506
96705
  }
@@ -96632,8 +96831,8 @@ async function secretLines({ context, args }) {
96632
96831
  if (SECRET_FLAGS3.some((flag2) => args.flags[flag2] !== void 0)) {
96633
96832
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
96634
96833
  }
96635
- const file3 = flagText({ args, name: "from-file" });
96636
- const text3 = file3 ? await readFile43(resolve21(context.cwd, file3), "utf8") : await context.readStdin();
96834
+ const file4 = flagText({ args, name: "from-file" });
96835
+ const text3 = file4 ? await readFile43(resolve21(context.cwd, file4), "utf8") : await context.readStdin();
96637
96836
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
96638
96837
  }
96639
96838
  async function secretsOf2({
@@ -97023,8 +97222,8 @@ function refuseSecretFlags({ args }) {
97023
97222
  }
97024
97223
  }
97025
97224
  async function clientSecretOf({ context, args }) {
97026
- const file3 = flagText({ args, name: "from-file" });
97027
- const text3 = file3 ? await readFile44(file3, "utf8") : await context.readStdin();
97225
+ const file4 = flagText({ args, name: "from-file" });
97226
+ const text3 = file4 ? await readFile44(file4, "utf8") : await context.readStdin();
97028
97227
  const secret = text3.trim();
97029
97228
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
97030
97229
  return secret;
@@ -97357,7 +97556,7 @@ async function update2({
97357
97556
 
97358
97557
  // src/services/vault-env-commands.service.ts
97359
97558
  import { readFile as readFile45, stat as stat11 } from "node:fs/promises";
97360
- import { dirname as dirname27, join as join30, resolve as resolve22 } from "node:path";
97559
+ import { dirname as dirname27, join as join31, resolve as resolve22 } from "node:path";
97361
97560
 
97362
97561
  // src/rules/vault-manifest.rules.ts
97363
97562
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -97391,12 +97590,12 @@ function lineOf4({ line, where }) {
97391
97590
  if (reference?.[1]) return { kind: "reference", variable, ref: refOf(reference[1]) };
97392
97591
  return { kind: "plain", variable, value: unquoted(value) };
97393
97592
  }
97394
- function parseManifest({ text: text3, file: file3 }) {
97593
+ function parseManifest({ text: text3, file: file4 }) {
97395
97594
  const lines2 = [];
97396
97595
  for (const [index, raw] of text3.split(/\r?\n/).entries()) {
97397
97596
  const line = raw.trim().replace(/^export\s+/, "");
97398
97597
  if (!line || line.startsWith("#")) continue;
97399
- lines2.push(lineOf4({ line, where: `${file3}:${index + 1}` }));
97598
+ lines2.push(lineOf4({ line, where: `${file4}:${index + 1}` }));
97400
97599
  }
97401
97600
  return lines2;
97402
97601
  }
@@ -97445,7 +97644,7 @@ function credentialProcessJson(fields) {
97445
97644
  }
97446
97645
 
97447
97646
  // src/services/vault-batch.service.ts
97448
- import { rm as rm17 } from "node:fs/promises";
97647
+ import { rm as rm18 } from "node:fs/promises";
97449
97648
  async function batchOf({ response }) {
97450
97649
  const text3 = await response.text();
97451
97650
  if (!response.ok) {
@@ -97627,7 +97826,7 @@ async function valuesOf({
97627
97826
  }) {
97628
97827
  const refused = refusalOf({ context, settled: settled2 });
97629
97828
  if (refused !== 0) {
97630
- await rm17(keyPath, { force: true });
97829
+ await rm18(keyPath, { force: true });
97631
97830
  return { exitCode: refused };
97632
97831
  }
97633
97832
  const opened = /* @__PURE__ */ new Map();
@@ -97639,7 +97838,7 @@ async function valuesOf({
97639
97838
  if (release2.message) context.err(`${release2.message}
97640
97839
  `);
97641
97840
  }
97642
- if (!keep2) await rm17(keyPath, { force: true });
97841
+ if (!keep2) await rm18(keyPath, { force: true });
97643
97842
  const released = /* @__PURE__ */ new Map();
97644
97843
  for (const entry of entries) {
97645
97844
  const fields = opened.get(keyOf(entry));
@@ -97704,23 +97903,23 @@ async function manifestPathOf({
97704
97903
  const named = args.words[2];
97705
97904
  if (named) return resolve22(context.cwd, named);
97706
97905
  const environment = flagText({ args, name: "env" });
97707
- const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
97906
+ const file4 = environment ? `.env.${environment}.vault` : ".env.vault";
97708
97907
  for (let dir = resolve22(context.cwd); ; dir = dirname27(dir)) {
97709
- if (await isFile(join30(dir, file3))) return join30(dir, file3);
97908
+ if (await isFile(join31(dir, file4))) return join31(dir, file4);
97710
97909
  if (dirname27(dir) === dir) break;
97711
97910
  }
97712
- throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
97911
+ throw new CliUsageError(`laze vault: no ${file4} here or in a parent folder
97713
97912
  ${ENV_USAGE}`);
97714
97913
  }
97715
97914
  async function manifestOf({
97716
97915
  context,
97717
97916
  args
97718
97917
  }) {
97719
- const file3 = await manifestPathOf({ context, args });
97720
- const text3 = await readFile45(file3, "utf8").catch(() => {
97721
- throw new CliUsageError(`laze vault: cannot read ${file3}`);
97918
+ const file4 = await manifestPathOf({ context, args });
97919
+ const text3 = await readFile45(file4, "utf8").catch(() => {
97920
+ throw new CliUsageError(`laze vault: cannot read ${file4}`);
97722
97921
  });
97723
- return { file: file3, lines: parseManifest({ text: text3, file: file3 }) };
97922
+ return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
97724
97923
  }
97725
97924
  async function printNames({
97726
97925
  context,
@@ -98451,8 +98650,8 @@ async function secretsOf3({ context, args }) {
98451
98650
  }
98452
98651
  const fromConnection = flagText({ args, name: "from-vault" });
98453
98652
  if (fromConnection) return { fromConnection };
98454
- const file3 = flagText({ args, name: "from-file" });
98455
- const text3 = file3 ? await readFile46(resolve23(context.cwd, file3), "utf8") : await context.readStdin();
98653
+ const file4 = flagText({ args, name: "from-file" });
98654
+ const text3 = file4 ? await readFile46(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
98456
98655
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
98457
98656
  if (lines2.length !== 2) {
98458
98657
  throw new CliUsageError(
@@ -98652,6 +98851,10 @@ async function whatsappBusiness({
98652
98851
  return run4({ context, args, client });
98653
98852
  }
98654
98853
 
98854
+ // src/services/whatsapp-commands.service.ts
98855
+ import { writeFile as writeFile26 } from "node:fs/promises";
98856
+ import { basename as basename9, resolve as resolve24 } from "node:path";
98857
+
98655
98858
  // src/services/whatsapp-pairing-commands.service.ts
98656
98859
  var WHATSAPP_PAIRING_USAGE = " laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)";
98657
98860
  async function unpair({ context, args }) {
@@ -98674,6 +98877,7 @@ function whatsappPairingCommand(name3) {
98674
98877
  var PATHS3 = {
98675
98878
  chats: "/api/compute/whatsapp/chats",
98676
98879
  read: "/api/compute/whatsapp/read",
98880
+ file: "/api/compute/whatsapp/file",
98677
98881
  send: "/api/compute/whatsapp/send",
98678
98882
  sendStatus: "/api/compute/whatsapp/send-status"
98679
98883
  };
@@ -98685,6 +98889,7 @@ var USAGE19 = [
98685
98889
  "Usage: laze whatsapp chats [<machine>] [--limit <n>] the chats, newest first",
98686
98890
  " laze whatsapp read [<machine>] <chat> [--limit <n>] a chat's last messages, oldest first",
98687
98891
  " (a read your owner set to Always ask waits for their answer; --request <id> picks it up later)",
98892
+ " laze whatsapp file [<machine>] <chat> <message-id> [--out <path>] save a message's photo, voice message or file",
98688
98893
  ' laze whatsapp send <machine> <chat> "<text>" send as the owner; an agent waits for their approval',
98689
98894
  " laze whatsapp status <send-id> where a send stands",
98690
98895
  WHATSAPP_PAIRING_USAGE,
@@ -98760,7 +98965,41 @@ async function read3({ context, args }) {
98760
98965
  `);
98761
98966
  if (answer6.messages.length === 0) context.out("No messages kept yet.\n");
98762
98967
  for (const message2 of answer6.messages)
98763
- context.out(`[${message2.at}] ${message2.fromMe ? "me" : message2.sender}: ${message2.text}
98968
+ context.out(
98969
+ `[${message2.at}] ${message2.fromMe ? "me" : message2.sender}: ${message2.text}${fileNote(message2)}
98970
+ `
98971
+ );
98972
+ }
98973
+ function fileNote(message2) {
98974
+ const media = message2.media;
98975
+ if (!media) return "";
98976
+ const name3 = media.name ? ` ${media.name}` : "";
98977
+ const words = media.transcript ? `
98978
+ Transcript: ${media.transcript}` : "";
98979
+ return ` (${media.kind}${name3}, ${media.size} bytes, id ${message2.id})${words}`;
98980
+ }
98981
+ async function file3({ context, args }) {
98982
+ const client = await computeClient({ context, args });
98983
+ const named = args.words.length > 4;
98984
+ const answer6 = await askingRead({
98985
+ client,
98986
+ path: PATHS3.file,
98987
+ body: {
98988
+ ...named ? { machine: word2({ args, at: 2 }) } : {},
98989
+ chat: word2({ args, at: named ? 3 : 2 }),
98990
+ id: word2({ args, at: named ? 4 : 3 })
98991
+ },
98992
+ args
98993
+ });
98994
+ const out = resolve24(context.cwd, flagText({ args, name: "out" }) ?? basename9(answer6.fileName));
98995
+ const response = await context.fetcher(answer6.url);
98996
+ if (!response.ok) throw new Error(`The file link answered ${response.status}`);
98997
+ await writeFile26(out, new Uint8Array(await response.arrayBuffer()));
98998
+ if (args.flags.json) return context.out(`${JSON.stringify({ ...answer6, path: out }, null, 2)}
98999
+ `);
99000
+ context.out(`${out}
99001
+ `);
99002
+ if (answer6.transcript) context.out(`Transcript: ${answer6.transcript}
98764
99003
  `);
98765
99004
  }
98766
99005
  async function settle3({ client, send: send5 }) {
@@ -98814,6 +99053,7 @@ async function whatsapp({
98814
99053
  const command = args.words[1];
98815
99054
  if (command === "chats") return chats({ context, args });
98816
99055
  if (command === "read") return read3({ context, args });
99056
+ if (command === "file") return file3({ context, args });
98817
99057
  if (command === "send") return send4({ context, args });
98818
99058
  if (command === "status") return status10({ context, args });
98819
99059
  const linking = whatsappPairingCommand(command);
@@ -99242,6 +99482,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
99242
99482
  laze machine host <machine> <agent> [--when-offline wait|computer] run your personal agent on your machine
99243
99483
  laze machine unhost <agent> run the agent on your agent computer again
99244
99484
  laze whatsapp chats|read [<machine>] [<chat>] [--limit <n>] your person's WhatsApp, read through Laze
99485
+ laze whatsapp file [<machine>] <chat> <message-id> [--out <path>] save a message's photo, voice or file
99245
99486
  laze whatsapp send <machine> <chat> "<text>" send as its owner; each message waits for their approval
99246
99487
  laze whatsapp unpair <machine> unlink WhatsApp; linking is in Settings, Machines
99247
99488
  laze whatsapp-business status|conversations|read|send|send-template|send-status|templates|prices
@@ -99553,21 +99794,21 @@ function exitCodeOf({ context, error: error63 }) {
99553
99794
  // src/services/machine-key.service.ts
99554
99795
  import { execFile as execFile2 } from "node:child_process";
99555
99796
  import {
99556
- createHash as createHash7,
99797
+ createHash as createHash8,
99557
99798
  createPrivateKey,
99558
99799
  generateKeyPairSync,
99559
99800
  randomBytes as randomBytes4,
99560
99801
  sign
99561
99802
  } from "node:crypto";
99562
- import { chmod as chmod4, link, mkdir as mkdir27, readFile as readFile47, rm as rm18, writeFile as writeFile26 } from "node:fs/promises";
99563
- import { dirname as dirname28, join as join31 } from "node:path";
99803
+ import { chmod as chmod4, link, mkdir as mkdir27, readFile as readFile47, rm as rm19, writeFile as writeFile27 } from "node:fs/promises";
99804
+ import { dirname as dirname28, join as join32 } from "node:path";
99564
99805
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
99565
- var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve24, reject) => {
99806
+ var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve25, reject) => {
99566
99807
  const child = execFile2(
99567
99808
  program,
99568
99809
  [...args],
99569
99810
  { timeout: timeoutMs },
99570
- (error63, stdout2) => error63 ? reject(error63) : resolve24(String(stdout2))
99811
+ (error63, stdout2) => error63 ? reject(error63) : resolve25(String(stdout2))
99571
99812
  );
99572
99813
  if (stdin2 !== void 0) child.stdin?.end(stdin2);
99573
99814
  });
@@ -99600,15 +99841,15 @@ var MachineKeyStore = class _MachineKeyStore {
99600
99841
  });
99601
99842
  }
99602
99843
  get metaPath() {
99603
- return join31(dirname28(this.options.configPath), "machine-key.json");
99844
+ return join32(dirname28(this.options.configPath), "machine-key.json");
99604
99845
  }
99605
99846
  /** Named by the key, so two CLIs making a key at once never overwrite each other's. */
99606
99847
  pemPathOf(jwk) {
99607
- return join31(dirname28(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99848
+ return join32(dirname28(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99608
99849
  }
99609
99850
  /** The Keychain item's account: one per config file and key. */
99610
99851
  accountOf(jwk) {
99611
- const config2 = createHash7("sha256").update(this.options.configPath).digest("hex");
99852
+ const config2 = createHash8("sha256").update(this.options.configPath).digest("hex");
99612
99853
  return `${config2.slice(0, 32)}-${shortOf(jwk)}`;
99613
99854
  }
99614
99855
  /** The key if this machine made one; null otherwise. Read once per process. */
@@ -99671,7 +99912,7 @@ var MachineKeyStore = class _MachineKeyStore {
99671
99912
  return kept;
99672
99913
  }
99673
99914
  async drop({ tier, jwk }) {
99674
- if (tier === "file") return rm18(this.pemPathOf(jwk), { force: true });
99915
+ if (tier === "file") return rm19(this.pemPathOf(jwk), { force: true });
99675
99916
  await this.options.run({
99676
99917
  program: "security",
99677
99918
  args: ["delete-generic-password", "-s", KEYCHAIN_SERVICE, "-a", this.accountOf(jwk)],
@@ -99727,12 +99968,12 @@ async function writeOnce({ path, text: text3 }) {
99727
99968
  if (error63.code === "EEXIST") return false;
99728
99969
  throw error63;
99729
99970
  } finally {
99730
- await rm18(temporary, { force: true });
99971
+ await rm19(temporary, { force: true });
99731
99972
  }
99732
99973
  }
99733
99974
  async function writePrivate({ path, text: text3 }) {
99734
99975
  await mkdir27(dirname28(path), { recursive: true, mode: 448 });
99735
- await writeFile26(path, text3, { mode: 384 });
99976
+ await writeFile27(path, text3, { mode: 384 });
99736
99977
  await chmod4(path, 384);
99737
99978
  }
99738
99979
 
@@ -99923,15 +100164,15 @@ function terminalAsk() {
99923
100164
  };
99924
100165
  }
99925
100166
  function sleep(ms, signal) {
99926
- return new Promise((resolve24) => {
99927
- if (signal?.aborted) return resolve24();
100167
+ return new Promise((resolve25) => {
100168
+ if (signal?.aborted) return resolve25();
99928
100169
  const stop3 = () => {
99929
100170
  clearTimeout(timer);
99930
- resolve24();
100171
+ resolve25();
99931
100172
  };
99932
100173
  const timer = setTimeout(() => {
99933
100174
  signal?.removeEventListener("abort", stop3);
99934
- resolve24();
100175
+ resolve25();
99935
100176
  }, ms);
99936
100177
  signal?.addEventListener("abort", stop3, { once: true });
99937
100178
  });