@lazehq/cli 0.1.135 → 0.1.137

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 +793 -414
  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 = resolve27(dir);
852
+ var prebuild = resolve29(dir);
853
853
  if (prebuild) return prebuild;
854
- var nearby = resolve27(path.dirname(process.execPath));
854
+ var nearby = resolve29(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 resolve27(dir2) {
870
+ function resolve29(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;
@@ -886,8 +886,8 @@ var require_node_gyp_build = __commonJS({
886
886
  }
887
887
  }
888
888
  function getFirst(dir, filter) {
889
- var files2 = readdirSync(dir).filter(filter);
890
- return files2[0] && path.join(dir, files2[0]);
889
+ var files3 = readdirSync(dir).filter(filter);
890
+ return files3[0] && path.join(dir, files3[0]);
891
891
  }
892
892
  function matchBuild(name3) {
893
893
  return /\.node$/.test(name3);
@@ -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((resolve27, reject) => {
7317
+ return new Promise((resolve29, reject) => {
7318
7318
  this.close((err, data) => {
7319
- return err ? reject(err) : resolve27(data);
7319
+ return err ? reject(err) : resolve29(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((resolve27, reject) => {
7357
+ return new Promise((resolve29, reject) => {
7358
7358
  this.destroy(err, (err2, data) => {
7359
- return err2 ? reject(err2) : resolve27(data);
7359
+ return err2 ? reject(err2) : resolve29(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((resolve27, reject) => {
12314
+ const waitForDrain = () => new Promise((resolve29, reject) => {
12315
12315
  assert2(callback === null);
12316
12316
  if (socket[kError]) {
12317
12317
  reject(socket[kError]);
12318
12318
  } else {
12319
- callback = resolve27;
12319
+ callback = resolve29;
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((resolve27, reject) => {
13677
+ const waitForDrain = () => new Promise((resolve29, reject) => {
13678
13678
  assert2(callback === null);
13679
13679
  if (socket[kError]) {
13680
13680
  reject(socket[kError]);
13681
13681
  } else {
13682
- callback = resolve27;
13682
+ callback = resolve29;
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((resolve27) => {
14050
+ return new Promise((resolve29) => {
14051
14051
  if (this[kSize]) {
14052
- this[kClosedResolve] = resolve27;
14052
+ this[kClosedResolve] = resolve29;
14053
14053
  } else {
14054
- resolve27(null);
14054
+ resolve29(null);
14055
14055
  }
14056
14056
  });
14057
14057
  }
14058
14058
  [kDestroy](err) {
14059
- return new Promise((resolve27) => {
14059
+ return new Promise((resolve29) => {
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
- resolve27(null);
14072
+ resolve29(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((resolve27) => {
14486
- this[kClosedResolve] = resolve27;
14485
+ return new Promise((resolve29) => {
14486
+ this[kClosedResolve] = resolve29;
14487
14487
  });
14488
14488
  }
14489
14489
  }
@@ -15591,7 +15591,7 @@ var require_socks5_client = __commonJS({
15591
15591
  return;
15592
15592
  }
15593
15593
  const version2 = this.buffer[0];
15594
- const reply2 = this.buffer[1];
15594
+ const reply3 = this.buffer[1];
15595
15595
  const addressType = this.buffer[3];
15596
15596
  if (version2 !== SOCKS_VERSION) {
15597
15597
  throw new Socks5ProxyError(`Invalid SOCKS version in reply: ${version2}`, "UND_ERR_SOCKS5_REPLY_VERSION");
@@ -15612,9 +15612,9 @@ var require_socks5_client = __commonJS({
15612
15612
  if (this.buffer.length < responseLength) {
15613
15613
  return;
15614
15614
  }
15615
- if (reply2 !== REPLY_CODES.SUCCEEDED) {
15616
- const errorMessage = this.getReplyErrorMessage(reply2);
15617
- throw new Socks5ProxyError(`SOCKS5 connection failed: ${errorMessage}`, `UND_ERR_SOCKS5_REPLY_${reply2}`);
15615
+ if (reply3 !== REPLY_CODES.SUCCEEDED) {
15616
+ const errorMessage = this.getReplyErrorMessage(reply3);
15617
+ throw new Socks5ProxyError(`SOCKS5 connection failed: ${errorMessage}`, `UND_ERR_SOCKS5_REPLY_${reply3}`);
15618
15618
  }
15619
15619
  let boundAddress;
15620
15620
  let offset = 4;
@@ -15645,8 +15645,8 @@ var require_socks5_client = __commonJS({
15645
15645
  /**
15646
15646
  * Get human-readable error message for reply code
15647
15647
  */
15648
- getReplyErrorMessage(reply2) {
15649
- switch (reply2) {
15648
+ getReplyErrorMessage(reply3) {
15649
+ switch (reply3) {
15650
15650
  case REPLY_CODES.GENERAL_FAILURE:
15651
15651
  return "General SOCKS server failure";
15652
15652
  case REPLY_CODES.CONNECTION_NOT_ALLOWED:
@@ -15664,7 +15664,7 @@ var require_socks5_client = __commonJS({
15664
15664
  case REPLY_CODES.ADDRESS_TYPE_NOT_SUPPORTED:
15665
15665
  return "Address type not supported";
15666
15666
  default:
15667
- return `Unknown error code: ${reply2}`;
15667
+ return `Unknown error code: ${reply3}`;
15668
15668
  }
15669
15669
  }
15670
15670
  };
@@ -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((resolve27, reject) => {
16997
+ return new Promise((resolve29, 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
- resolve27(null);
17011
+ resolve29(null);
17012
17012
  }
17013
17013
  });
17014
17014
  } else {
17015
- this.on("close", resolve27);
17015
+ this.on("close", resolve29);
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((resolve27, reject) => {
17043
+ return new Promise((resolve29, 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: resolve27,
17058
+ resolve: resolve29,
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: resolve27, stream, length } = consume2;
17136
+ const { type, body, resolve: resolve29, stream, length } = consume2;
17137
17137
  try {
17138
17138
  if (type === "text") {
17139
- resolve27(chunksDecode(body, length, encoding));
17139
+ resolve29(chunksDecode(body, length, encoding));
17140
17140
  } else if (type === "json") {
17141
- resolve27(JSON.parse(chunksDecode(body, length, encoding)));
17141
+ resolve29(JSON.parse(chunksDecode(body, length, encoding)));
17142
17142
  } else if (type === "arrayBuffer") {
17143
- resolve27(chunksConcat(body, length).buffer);
17143
+ resolve29(chunksConcat(body, length).buffer);
17144
17144
  } else if (type === "blob") {
17145
- resolve27(new Blob(body, { type: stream[kContentType] }));
17145
+ resolve29(new Blob(body, { type: stream[kContentType] }));
17146
17146
  } else if (type === "bytes") {
17147
- resolve27(chunksConcat(body, length));
17147
+ resolve29(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((resolve27, reject) => {
17366
+ return new Promise((resolve29, reject) => {
17367
17367
  request2.call(this, opts, (err, data) => {
17368
- return err ? reject(err) : resolve27(data);
17368
+ return err ? reject(err) : resolve29(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((resolve27, reject) => {
17629
+ return new Promise((resolve29, reject) => {
17630
17630
  stream.call(this, opts, factory, (err, data) => {
17631
- return err ? reject(err) : resolve27(data);
17631
+ return err ? reject(err) : resolve29(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((resolve27, reject) => {
17931
+ return new Promise((resolve29, reject) => {
17932
17932
  upgrade2.call(this, opts, (err, data) => {
17933
- return err ? reject(err) : resolve27(data);
17933
+ return err ? reject(err) : resolve29(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((resolve27, reject) => {
18027
+ return new Promise((resolve29, reject) => {
18028
18028
  connect8.call(this, opts, (err, data) => {
18029
- return err ? reject(err) : resolve27(data);
18029
+ return err ? reject(err) : resolve29(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: writeFile12, readFile: readFile40, mkdir: mkdir14 } = __require("node:fs/promises");
19490
- var { dirname: dirname29, resolve: resolve27 } = __require("node:path");
19489
+ var { writeFile: writeFile12, readFile: readFile41, mkdir: mkdir14 } = __require("node:fs/promises");
19490
+ var { dirname: dirname29, resolve: resolve29 } = __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 readFile40(resolve27(path), "utf8");
19706
+ const data = await readFile41(resolve29(path), "utf8");
19707
19707
  const parsed = JSON.parse(data);
19708
19708
  if (Array.isArray(parsed)) {
19709
19709
  this.#snapshots.clear();
@@ -19732,7 +19732,7 @@ var require_snapshot_recorder = __commonJS({
19732
19732
  if (!path) {
19733
19733
  throw new InvalidArgumentError("Snapshot path is required");
19734
19734
  }
19735
- const resolvedPath = resolve27(path);
19735
+ const resolvedPath = resolve29(path);
19736
19736
  await mkdir14(dirname29(resolvedPath), { recursive: true });
19737
19737
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
19738
19738
  hash: hash2,
@@ -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((resolve27, reject) => agent3.dispatch(
27233
+ return new Promise((resolve29, 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
- resolve27({
27316
+ resolve29({
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
- resolve27(dispatchWithProtocolPreference(body2, false));
27349
+ resolve29(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
- resolve27({
27363
+ resolve29({
27364
27364
  status: status11,
27365
27365
  statusText: STATUS_CODES[status11],
27366
27366
  headersList,
@@ -31077,15 +31077,15 @@ ${value}`;
31077
31077
  pos = 0;
31078
31078
  }
31079
31079
  }
31080
- discardLeadingBytes(count13) {
31081
- while (count13 > 0 && this.lineChunkIndex < this.chunks.length) {
31080
+ discardLeadingBytes(count14) {
31081
+ while (count14 > 0 && this.lineChunkIndex < this.chunks.length) {
31082
31082
  const chunk = this.chunks[this.lineChunkIndex];
31083
31083
  const remaining = chunk.length - this.linePos;
31084
- if (count13 < remaining) {
31085
- this.linePos += count13;
31086
- count13 = 0;
31084
+ if (count14 < remaining) {
31085
+ this.linePos += count14;
31086
+ count14 = 0;
31087
31087
  } else {
31088
- count13 -= remaining;
31088
+ count14 -= remaining;
31089
31089
  this.lineChunkIndex++;
31090
31090
  this.linePos = 0;
31091
31091
  }
@@ -31834,8 +31834,8 @@ function shannonEntropyBits(value) {
31834
31834
  const counts = /* @__PURE__ */ new Map();
31835
31835
  for (const char of sample) counts.set(char, (counts.get(char) ?? 0) + 1);
31836
31836
  let entropy = 0;
31837
- for (const count13 of counts.values()) {
31838
- const p = count13 / sample.length;
31837
+ for (const count14 of counts.values()) {
31838
+ const p = count14 / sample.length;
31839
31839
  entropy -= p * Math.log2(p);
31840
31840
  }
31841
31841
  return entropy;
@@ -31893,6 +31893,15 @@ function isKeyMaterial(value) {
31893
31893
  const c = charClasses(value);
31894
31894
  return c.digit >= 2 && (c.lower >= 2 || c.upper >= 2);
31895
31895
  }
31896
+ var VARIABLE_NAME = "[A-Za-z_][A-Za-z0-9_]*";
31897
+ var VARIABLE_REFERENCE = new RegExp(
31898
+ `^(?:\\$(${VARIABLE_NAME})|\\$\\{(${VARIABLE_NAME})\\}|%(${VARIABLE_NAME})%|\\$env:(${VARIABLE_NAME}))$`,
31899
+ "i"
31900
+ );
31901
+ function isVariableReference(value) {
31902
+ const name3 = VARIABLE_REFERENCE.exec(value)?.slice(1).find(Boolean);
31903
+ return name3 !== void 0 && !isKeyMaterial(name3);
31904
+ }
31896
31905
  function isBasicAuthPayload(value) {
31897
31906
  if (value.endsWith("=")) return true;
31898
31907
  const c = charClasses(value);
@@ -32366,7 +32375,8 @@ function matchSlice({
32366
32375
  }
32367
32376
  const urlValues = urlValuesIn(text3);
32368
32377
  const placed = urlValues.length === 0 ? found : inLinkValues({ text: text3, found, urlValues, ruleIds });
32369
- return withoutOverlaps(placed).map((match) => {
32378
+ const values = placed.filter((match) => !isVariableReference(text3.slice(match.start, match.end)));
32379
+ return withoutOverlaps(values).map((match) => {
32370
32380
  const value = text3.slice(match.start, match.end);
32371
32381
  return {
32372
32382
  value,
@@ -32485,7 +32495,7 @@ function withoutOneTimeLinkTokens({
32485
32495
  const links = oneTimeLinksIn({ text: text3 });
32486
32496
  if (links.length === 0) return [...secrets];
32487
32497
  return secrets.filter(
32488
- (secret) => KEPT_IN_LINKS.has(secret.kind) || NEVER_ONE_TIME.test(secret.suggestedName) || !links.some((link2) => secret.start >= link2.start && secret.end <= link2.end)
32498
+ (secret) => KEPT_IN_LINKS.has(secret.kind) || NEVER_ONE_TIME.test(secret.suggestedName) || !links.some((link3) => secret.start >= link3.start && secret.end <= link3.end)
32489
32499
  );
32490
32500
  }
32491
32501
 
@@ -32693,7 +32703,7 @@ function runRedacted({
32693
32703
  redact
32694
32704
  }) {
32695
32705
  const values = redact ?? Object.values(env);
32696
- return new Promise((resolve27, reject) => {
32706
+ return new Promise((resolve29, reject) => {
32697
32707
  const [file4, ...args] = command;
32698
32708
  const child = spawn(file4, args, {
32699
32709
  env: { ...baseEnv, ...env },
@@ -32719,7 +32729,7 @@ function runRedacted({
32719
32729
  child.on("error", reject);
32720
32730
  child.on("close", (code4, ended) => {
32721
32731
  signal?.removeEventListener("abort", killGroup);
32722
- void drained.then(() => resolve27(code4 ?? (ended ? 128 + signalNumber(ended) : 1)));
32732
+ void drained.then(() => resolve29(code4 ?? (ended ? 128 + signalNumber(ended) : 1)));
32723
32733
  });
32724
32734
  });
32725
32735
  }
@@ -36960,7 +36970,7 @@ function shadowedLinkLineOf({ shadow }) {
36960
36970
  }
36961
36971
 
36962
36972
  // src/rules/cli-version.rules.ts
36963
- var STAMPED = "0.1.135";
36973
+ var STAMPED = "0.1.137";
36964
36974
  function cliVersionOf({ stamped = STAMPED } = {}) {
36965
36975
  return stamped.startsWith("__") ? "dev" : stamped;
36966
36976
  }
@@ -37267,7 +37277,7 @@ async function withStateLock({
37267
37277
  () => 0
37268
37278
  );
37269
37279
  if (since > LOCK_STALE_MS) await rm(lock, { force: true });
37270
- else await new Promise((resolve27) => setTimeout(resolve27, 15 + Math.random() * 20));
37280
+ else await new Promise((resolve29) => setTimeout(resolve29, 15 + Math.random() * 20));
37271
37281
  }
37272
37282
  try {
37273
37283
  return await work();
@@ -37534,6 +37544,7 @@ var SWITCHES = /* @__PURE__ */ new Set([
37534
37544
  "all",
37535
37545
  "resend",
37536
37546
  "replace",
37547
+ "reset",
37537
37548
  "ask",
37538
37549
  "real-value"
37539
37550
  ]);
@@ -38845,14 +38856,14 @@ function codePointLength(str) {
38845
38856
  const units = str.length;
38846
38857
  if (!highSurrogate.test(str))
38847
38858
  return units;
38848
- let count13 = units;
38859
+ let count14 = units;
38849
38860
  for (let i = 0; i < units - 1; i++) {
38850
38861
  if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
38851
- count13--;
38862
+ count14--;
38852
38863
  i++;
38853
38864
  }
38854
38865
  }
38855
- return count13;
38866
+ return count14;
38856
38867
  }
38857
38868
  function getLengthableOrigin(input2) {
38858
38869
  if (Array.isArray(input2))
@@ -42657,7 +42668,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
42657
42668
  var NONE = 0;
42658
42669
  var ASSUMED = 1;
42659
42670
  var PROVEN = 2;
42660
- function isRecursive(inst, stack, resolve27) {
42671
+ function isRecursive(inst, stack, resolve29) {
42661
42672
  const cached2 = recursive.get(inst);
42662
42673
  if (cached2 !== void 0)
42663
42674
  return cached2 ? PROVEN : NONE;
@@ -42667,7 +42678,7 @@ function isRecursive(inst, stack, resolve27) {
42667
42678
  let result2 = NONE;
42668
42679
  const check4 = (child) => {
42669
42680
  if (result2 !== PROVEN && child?._zod) {
42670
- const answer6 = isRecursive(child, stack, resolve27);
42681
+ const answer6 = isRecursive(child, stack, resolve29);
42671
42682
  if (answer6 > result2)
42672
42683
  result2 = answer6;
42673
42684
  }
@@ -42678,7 +42689,7 @@ function isRecursive(inst, stack, resolve27) {
42678
42689
  const desc = Object.getOwnPropertyDescriptor(sh, key);
42679
42690
  if (spread && !desc.enumerable)
42680
42691
  continue;
42681
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve27) : NONE;
42692
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve29) : NONE;
42682
42693
  if (child > answer6)
42683
42694
  answer6 = child;
42684
42695
  }
@@ -42742,7 +42753,7 @@ function isRecursive(inst, stack, resolve27) {
42742
42753
  break;
42743
42754
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
42744
42755
  case "lazy": {
42745
- const inner = def._cachedInner ?? (resolve27 ? inst._zod.innerType : void 0);
42756
+ const inner = def._cachedInner ?? (resolve29 ? inst._zod.innerType : void 0);
42746
42757
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
42747
42758
  break;
42748
42759
  }
@@ -43207,8 +43218,8 @@ function az_default() {
43207
43218
  }
43208
43219
 
43209
43220
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/be.js
43210
- function getBelarusianPlural(count13, one, few, many) {
43211
- const absCount = Math.abs(count13);
43221
+ function getBelarusianPlural(count14, one, few, many) {
43222
+ const absCount = Math.abs(count14);
43212
43223
  const lastDigit = absCount % 10;
43213
43224
  const lastTwoDigits = absCount % 100;
43214
43225
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -45855,8 +45866,8 @@ function hu_default() {
45855
45866
  }
45856
45867
 
45857
45868
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/hy.js
45858
- function getArmenianPlural(count13, one, many) {
45859
- return Math.abs(count13) === 1 ? one : many;
45869
+ function getArmenianPlural(count14, one, many) {
45870
+ return Math.abs(count14) === 1 ? one : many;
45860
45871
  }
45861
45872
  function withDefiniteArticle(word3) {
45862
45873
  if (!word3)
@@ -48594,8 +48605,8 @@ function ro_default() {
48594
48605
  }
48595
48606
 
48596
48607
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/ru.js
48597
- function getRussianPlural(count13, one, few, many) {
48598
- const absCount = Math.abs(count13);
48608
+ function getRussianPlural(count14, one, few, many) {
48609
+ const absCount = Math.abs(count14);
48599
48610
  const lastDigit = absCount % 10;
48600
48611
  const lastTwoDigits = absCount % 100;
48601
48612
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -59689,6 +59700,12 @@ function uiTokens(owner) {
59689
59700
  };
59690
59701
  }
59691
59702
 
59703
+ // ../../packages/module/src/contract/read-audience.ts
59704
+ var AUDIENCE_KEYWORD = "x-laze-audience";
59705
+ function ownerOnly(schema) {
59706
+ return schema.meta({ [AUDIENCE_KEYWORD]: "owner" });
59707
+ }
59708
+
59692
59709
  // ../../modules/api-key/contract/src/machine-key.ts
59693
59710
  var MACHINE_PROOF_HEADER = "dpop";
59694
59711
  var MACHINE_KEY_WARNING_HEADER = "x-laze-key-warning";
@@ -62048,15 +62065,15 @@ function clustersIn({
62048
62065
  const out = [];
62049
62066
  let current3 = null;
62050
62067
  for (let index = segment.start; index <= segment.end; index += 1) {
62051
- const count13 = flagged[index] ?? 0;
62052
- if (count13 === 0) continue;
62068
+ const count14 = flagged[index] ?? 0;
62069
+ if (count14 === 0) continue;
62053
62070
  if (current3 && index - current3.end - 1 <= REDACTED_BLOCK_MAX_GAP) {
62054
62071
  current3.end = index;
62055
- current3.values += count13;
62072
+ current3.values += count14;
62056
62073
  continue;
62057
62074
  }
62058
62075
  if (current3) out.push(current3);
62059
- current3 = { start: index, end: index, values: count13 };
62076
+ current3 = { start: index, end: index, values: count14 };
62060
62077
  }
62061
62078
  if (current3) out.push(current3);
62062
62079
  return out;
@@ -62096,7 +62113,7 @@ function redactedBlocksAt({
62096
62113
  }
62097
62114
  const blocks = redactedBlocks({ lines: lines2, flagged });
62098
62115
  const inside = (line) => blocks.some((block2) => line >= block2.start && line <= block2.end);
62099
- const values = flagged.reduce((sum, count13, line) => inside(line) ? sum + count13 : sum, 0);
62116
+ const values = flagged.reduce((sum, count14, line) => inside(line) ? sum + count14 : sum, 0);
62100
62117
  return { values, insideAt: (offset) => inside(lineAt(offset)) };
62101
62118
  }
62102
62119
 
@@ -62658,18 +62675,43 @@ var vaultOpsAskSchemaDefinition = external_exports.object({
62658
62675
  var vaultOpsAskSchema = vaultOpsAskSchemaDefinition;
62659
62676
  var vaultOpsAsksSchemaDefinition = external_exports.object({ rows: external_exports.array(vaultOpsAskSchema), total: count3 });
62660
62677
 
62661
- // ../../modules/vault/contract/src/vault-ops-connections.ts
62678
+ // ../../modules/vault/contract/src/vault-ops-reference-keys.ts
62662
62679
  var count4 = external_exports.number().int().nonnegative();
62663
62680
  var idText3 = external_exports.string().max(128);
62681
+ var vaultOpsReferenceKeySchemaDefinition = external_exports.object({
62682
+ workspaceId: idText3,
62683
+ connectionId: idText3,
62684
+ /** The keychain's owner; null for a workspace key. */
62685
+ ownerUserId: idText3.nullable(),
62686
+ createdAt: external_exports.iso.datetime(),
62687
+ status: external_exports.string().regex(/^[a-z][a-z_]{0,31}$/),
62688
+ /** The key's name, to count the messages naming it; never in an ops answer. */
62689
+ name: external_exports.string().max(200)
62690
+ });
62691
+ var vaultOpsReferenceKeySchema = vaultOpsReferenceKeySchemaDefinition;
62692
+ var vaultOpsReferenceKeysSchemaDefinition = external_exports.object({
62693
+ keys: external_exports.array(vaultOpsReferenceKeySchemaDefinition),
62694
+ /** Pasted keys looked at, opened, held for a device only, and failing to open. */
62695
+ scanned: count4,
62696
+ opened: count4,
62697
+ sealed: count4,
62698
+ failed: count4,
62699
+ /** The scan reached the open cap before the last pasted key. */
62700
+ stopped: external_exports.boolean()
62701
+ });
62702
+
62703
+ // ../../modules/vault/contract/src/vault-ops-connections.ts
62704
+ var count5 = external_exports.number().int().nonnegative();
62705
+ var idText4 = external_exports.string().max(128);
62664
62706
  var codeText2 = external_exports.string().regex(/^[a-z][a-z0-9_.]{0,39}$/);
62665
62707
  var vaultOpsConnectionSchemaDefinition = external_exports.object({
62666
- connectionId: idText3,
62708
+ connectionId: idText4,
62667
62709
  kind: vaultConnectionKindSchema,
62668
62710
  /** An OAuth or MCP connection's provider (`gmail`); null for none, `other` for free text. */
62669
62711
  provider: codeText2.nullable(),
62670
62712
  holderKind: external_exports.enum(["personal", "workspace", "agent", "pool"]),
62671
62713
  /** The person, agent or pool that owns the keychain; null for the workspace's. */
62672
- holderId: idText3.nullable(),
62714
+ holderId: idText4.nullable(),
62673
62715
  sensitivity: vaultSensitivitySchema,
62674
62716
  everyUseAsks: external_exports.boolean(),
62675
62717
  deviceApproval: external_exports.boolean(),
@@ -62677,7 +62719,7 @@ var vaultOpsConnectionSchemaDefinition = external_exports.object({
62677
62719
  serverOpens: external_exports.boolean(),
62678
62720
  sealing: external_exports.enum(["envelope_v1", "sealed_v2"]),
62679
62721
  /** The devices a `sealed_v2` bundle is sealed to; 0 on `envelope_v1`. */
62680
- recipients: count4,
62722
+ recipients: count5,
62681
62723
  status: codeText2,
62682
62724
  /** When the stored access token runs out; null for none. */
62683
62725
  grantExpiresAt: external_exports.iso.datetime().nullable(),
@@ -62686,14 +62728,14 @@ var vaultOpsConnectionSchemaDefinition = external_exports.object({
62686
62728
  });
62687
62729
  var vaultOpsConnectionSchema = vaultOpsConnectionSchemaDefinition;
62688
62730
  var vaultOpsConnectionEventSchemaDefinition = external_exports.object({
62689
- seq: count4,
62690
- connectionId: idText3,
62731
+ seq: count5,
62732
+ connectionId: idText4,
62691
62733
  action: codeText2,
62692
62734
  outcome: codeText2,
62693
62735
  actorKind: external_exports.enum(["user", "agent", "system"]),
62694
62736
  decider: codeText2.nullable(),
62695
- agentId: idText3.nullable(),
62696
- requestId: idText3.nullable(),
62737
+ agentId: idText4.nullable(),
62738
+ requestId: idText4.nullable(),
62697
62739
  /** The entry's stored code (`vault_oauth_refresh_failed`); null when it holds none. */
62698
62740
  code: codeText2.nullable(),
62699
62741
  /** The provider's error code on a refused refresh (`invalid_grant`); null when not kept. */
@@ -63610,6 +63652,8 @@ var computerCardStateSchema = external_exports.enum([
63610
63652
  var computerCardSchemaDefinition = external_exports.object({
63611
63653
  type: external_exports.literal("computer"),
63612
63654
  agentId: idSchema4,
63655
+ /** The agent's owner: only they or an Admin see its actions; null on cards drawn before. */
63656
+ ownerUserId: external_exports.string().max(200).nullable().default(null),
63613
63657
  /** The computer the agent runs on, for support. */
63614
63658
  computerId: external_exports.string().min(1).max(200),
63615
63659
  /** The workspace audit entry's reference for this failure, for support. */
@@ -63650,6 +63694,8 @@ var loginCardLoginSchemaDefinition = external_exports.object({
63650
63694
  var loginCardSchemaDefinition = external_exports.object({
63651
63695
  type: external_exports.literal("login"),
63652
63696
  agentId: idSchema4,
63697
+ /** The agent's owner: only they or an Admin see its actions; null on cards drawn before. */
63698
+ ownerUserId: external_exports.string().max(200).nullable().default(null),
63653
63699
  harness: external_exports.enum(["claude-code", "codex"]),
63654
63700
  state: loginCardStateSchema,
63655
63701
  /** The plain first line: "All of my Claude logins are out of usage." */
@@ -66514,10 +66560,10 @@ var observeSenderInputSchemaDefinition = external_exports.object({
66514
66560
  });
66515
66561
 
66516
66562
  // ../../modules/chat/contract/src/chat.read-ops.ts
66517
- var count5 = external_exports.number().int().nonnegative();
66563
+ var count6 = external_exports.number().int().nonnegative();
66518
66564
  var at = external_exports.iso.datetime();
66519
66565
  var unreadMessageDefinition = external_exports.object({
66520
- seq: count5,
66566
+ seq: count6,
66521
66567
  createdAt: at,
66522
66568
  /** self is the reader; the others are the author's kind. */
66523
66569
  author: external_exports.enum(["self", "person", "agent", "external"]),
@@ -66536,12 +66582,12 @@ var readConversationDefinition = external_exports.object({
66536
66582
  direct: external_exports.boolean(),
66537
66583
  /** The other side of a Laze DM paired with a Slack DM, or null. */
66538
66584
  pairedWith: external_exports.string().nullable(),
66539
- lastSeq: count5,
66540
- lastReadSeq: count5,
66541
- unreadHeldToSeq: count5.nullable(),
66542
- hiddenAtSeq: count5.nullable(),
66543
- unread: count5,
66544
- mentions: count5,
66585
+ lastSeq: count6,
66586
+ lastReadSeq: count6,
66587
+ unreadHeldToSeq: count6.nullable(),
66588
+ hiddenAtSeq: count6.nullable(),
66589
+ unread: count6,
66590
+ mentions: count6,
66545
66591
  lastMessageAt: at.nullable(),
66546
66592
  /** When the newest message at or before the marker was written. */
66547
66593
  markerAt: at.nullable(),
@@ -66551,41 +66597,41 @@ var readConversationDefinition = external_exports.object({
66551
66597
  var chatReadFactsDefinition = external_exports.object({
66552
66598
  conversations: external_exports.array(readConversationDefinition).max(40),
66553
66599
  /** Conversations that qualified before the cap. */
66554
- total: count5
66600
+ total: count6
66555
66601
  });
66556
66602
  var chatReadFactsSchema = chatReadFactsDefinition;
66557
66603
 
66558
66604
  // ../../modules/chat/contract/src/chat.link-domain-ops.ts
66559
- var count6 = external_exports.number().int().nonnegative();
66605
+ var count7 = external_exports.number().int().nonnegative();
66560
66606
  var linkDomainDefinition = external_exports.object({
66561
66607
  /** The link's host, lowercased, without `www.`. */
66562
66608
  domain: external_exports.string(),
66563
66609
  /** Previews on messages, one per message and preview. */
66564
- links: count6,
66610
+ links: count7,
66565
66611
  /** Messages with at least one preview of this host. */
66566
- messageCount: count6,
66612
+ messageCount: count7,
66567
66613
  /** Previews of this host a message author took off. */
66568
- removed: count6,
66614
+ removed: count7,
66569
66615
  /** Distinct previews (addresses) of this host. */
66570
- pages: count6,
66616
+ pages: count7,
66571
66617
  /** Pages whose preview carries a picture, and a page name. */
66572
- pictured: count6,
66573
- named: count6,
66618
+ pictured: count7,
66619
+ named: count7,
66574
66620
  /** Pages whose fetch failed or was blocked. */
66575
- failed: count6,
66621
+ failed: count7,
66576
66622
  /** The commonest path shapes, at most 5, each with its page count. */
66577
- shapes: external_exports.array(external_exports.object({ shape: external_exports.string(), pages: count6 })).max(5)
66623
+ shapes: external_exports.array(external_exports.object({ shape: external_exports.string(), pages: count7 })).max(5)
66578
66624
  });
66579
66625
  var linkDomainFactsDefinition = external_exports.object({
66580
66626
  domains: external_exports.array(linkDomainDefinition),
66581
66627
  /** Messages with previews read on this page, and how many previews they carry. */
66582
- scannedMessageCount: count6,
66583
- scannedLinks: count6,
66628
+ scannedMessageCount: count7,
66629
+ scannedLinks: count7,
66584
66630
  /** Messages carrying exactly 1, 2, and 3 or more previews on this page. */
66585
- messageCountByLinks: external_exports.array(count6).length(3),
66631
+ messageCountByLinks: external_exports.array(count7).length(3),
66586
66632
  /** Over the whole workspace: live messages with a link, and those with a preview. */
66587
- linkedMessageCount: count6,
66588
- previewedMessageCount: count6,
66633
+ linkedMessageCount: count7,
66634
+ previewedMessageCount: count7,
66589
66635
  /** The last message id read; pass it back as `cursor` to read on, null at the end. */
66590
66636
  nextCursor: external_exports.string().nullable()
66591
66637
  });
@@ -71641,7 +71687,7 @@ var agentSchemaDefinition = external_exports.object({
71641
71687
  /** `<roster>:<seed>`, `file:<file id>`, or empty for the sloth drawn from its id. */
71642
71688
  avatar: external_exports.string().max(AGENT_AVATAR_MAX).default(""),
71643
71689
  /** A Laze agent's SOUL.md. */
71644
- instructions: external_exports.string().default(""),
71690
+ instructions: ownerOnly(external_exports.string().default("")),
71645
71691
  /** A Laze models agent's level: the one picked, or what Default resolves to. */
71646
71692
  modelLevel: agentModelLevelSchema.nullable().default(null),
71647
71693
  /** True when `modelLevel` is what Default resolves to, not a level someone picked. */
@@ -71657,9 +71703,9 @@ var agentSchemaDefinition = external_exports.object({
71657
71703
  /** The thinking effort it runs at; null for its model's default. */
71658
71704
  effort: external_exports.string().nullable().default(null),
71659
71705
  /** The models its harness listed for its login when it last started; null before then. */
71660
- harnessModels: harnessModelsSchema.nullable().default(null),
71706
+ harnessModels: ownerOnly(harnessModelsSchema.nullable().default(null)),
71661
71707
  /** The GitHub identity a Laze agent works as; null when it has none. */
71662
- github: agentGithubSchema.nullable().default(null),
71708
+ github: ownerOnly(agentGithubSchema.nullable().default(null)),
71663
71709
  /** Out of usage (its login or its Laze models budget) until this time; null when it can work. */
71664
71710
  limitedUntil: external_exports.iso.datetime().nullable().default(null),
71665
71711
  /** Why it is limited: "usage" (its login; also when absent) or "budget" (Laze models). */
@@ -71668,17 +71714,17 @@ var agentSchemaDefinition = external_exports.object({
71668
71714
  pausedAt: external_exports.iso.datetime().nullable().default(null),
71669
71715
  /** Who paused it and the reason they gave; null when it runs or no reason was given. */
71670
71716
  pausedByUserId: external_exports.string().nullable().default(null),
71671
- pauseReason: external_exports.string().nullable().default(null),
71717
+ pauseReason: ownerOnly(external_exports.string().nullable().default(null)),
71672
71718
  /** The owner's own machine the agent's turns run on; null for a Laze sandbox. */
71673
- host: agentHostSchemaDefinition.nullable().default(null),
71719
+ host: ownerOnly(agentHostSchemaDefinition.nullable().default(null)),
71674
71720
  /** The Laze computer it runs on, as compute names it; null for its owner's default computer. */
71675
- computerKey: external_exports.string().nullable().default(null),
71721
+ computerKey: ownerOnly(external_exports.string().nullable().default(null)),
71676
71722
  /** The login pool a Claude Code or Codex agent draws from; null for its owner's own logins. */
71677
- loginPoolId: external_exports.string().nullable().default(null),
71723
+ loginPoolId: ownerOnly(external_exports.string().nullable().default(null)),
71678
71724
  /** The login it runs on now, "On Work Max"; null before its first turn and on other harnesses. */
71679
- login: agentLoginSchema.nullable().default(null),
71725
+ login: ownerOnly(agentLoginSchema.nullable().default(null)),
71680
71726
  /** The session a connected agent listens in; null until its CLI first names one. */
71681
- session: agentSessionSchemaDefinition.nullable().optional(),
71727
+ session: ownerOnly(agentSessionSchemaDefinition.nullable().optional()),
71682
71728
  /** How the background setup after creating it went. */
71683
71729
  setup: agentSetupStateSchema.optional(),
71684
71730
  /** `support` for the locked Laze Support agent; absent reads as `standard`. */
@@ -73549,8 +73595,8 @@ function unreachableReasonOf(error63) {
73549
73595
  function migratedNoticeOf(error63) {
73550
73596
  if (!(error63 instanceof LazeApiError) || error63.code !== AGENT_MIGRATED) return void 0;
73551
73597
  const notice = typeof error63.meta?.notice === "string" ? error63.meta.notice : error63.message;
73552
- const link2 = typeof error63.meta?.link === "string" ? error63.meta.link : null;
73553
- return { notice, link: link2 };
73598
+ const link3 = typeof error63.meta?.link === "string" ? error63.meta.link : null;
73599
+ return { notice, link: link3 };
73554
73600
  }
73555
73601
  var LazeClient = class _LazeClient {
73556
73602
  constructor(options) {
@@ -73697,7 +73743,7 @@ async function reportMachine({
73697
73743
 
73698
73744
  // src/services/session.service.ts
73699
73745
  function markMigratedOn({ context, profile }) {
73700
- return async ({ notice, link: link2 }) => context.store.markMigrated({ name: profile, migrated: { at: context.nowMs(), link: link2, notice } });
73746
+ return async ({ notice, link: link3 }) => context.store.markMigrated({ name: profile, migrated: { at: context.nowMs(), link: link3, notice } });
73701
73747
  }
73702
73748
  var REFUSED_RECHECK_MS = 10 * 60 * 1e3;
73703
73749
  function markRefusedOn({
@@ -74024,18 +74070,18 @@ async function inviteAgent({ context, args }) {
74024
74070
  throw new CliUsageError("Usage: laze agent invite --reconnect <agent>");
74025
74071
  }
74026
74072
  const { client } = await signedIn({ context, args });
74027
- const link2 = await client.post("/api/agents/links", {
74073
+ const link3 = await client.post("/api/agents/links", {
74028
74074
  ...name3 ? { name: name3 } : {},
74029
74075
  ...channelId ? { channelId } : {},
74030
74076
  ...reconnect ? { reconnect } : {}
74031
74077
  });
74032
- if (args.flags.json) return context.out(`${JSON.stringify(link2, null, 2)}
74078
+ if (args.flags.json) return context.out(`${JSON.stringify(link3, null, 2)}
74033
74079
  `);
74034
74080
  const where = reconnect ? `the session that should run ${reconnect} again` : "the agent's session";
74035
74081
  context.out(
74036
- `Paste this into ${where} (the link works once, until ${link2.expiresAt}):
74082
+ `Paste this into ${where} (the link works once, until ${link3.expiresAt}):
74037
74083
 
74038
- ${link2.prompt}
74084
+ ${link3.prompt}
74039
74085
  `
74040
74086
  );
74041
74087
  }
@@ -74176,12 +74222,12 @@ function linkOf({ url: url2, base }) {
74176
74222
  return `${base.replace(/\/+$/, "")}${url2.startsWith("/") ? "" : "/"}${url2}`;
74177
74223
  }
74178
74224
  function withLink({ text: text3, url: url2, base }) {
74179
- const link2 = linkOf({ url: url2, base });
74180
- return link2 ? `${text3} ${link2}` : text3;
74225
+ const link3 = linkOf({ url: url2, base });
74226
+ return link3 ? `${text3} ${link3}` : text3;
74181
74227
  }
74182
74228
  function linkLineOf({ url: url2, base }) {
74183
- const link2 = linkOf({ url: url2, base });
74184
- return link2 ? `Link: ${link2}
74229
+ const link3 = linkOf({ url: url2, base });
74230
+ return link3 ? `Link: ${link3}
74185
74231
  ` : "";
74186
74232
  }
74187
74233
 
@@ -74291,10 +74337,10 @@ function whereOf(message2) {
74291
74337
  }
74292
74338
  function catchUpLinesOf(message2) {
74293
74339
  if (!message2.catchUp) return [];
74294
- const { count: count13, older } = message2.catchUp;
74340
+ const { count: count14, older } = message2.catchUp;
74295
74341
  const where = whereOf(message2);
74296
74342
  const lines2 = [
74297
- `${count13} ${count13 === 1 ? "message" : "messages"} in ${where} while you were away.`
74343
+ `${count14} ${count14 === 1 ? "message" : "messages"} in ${where} while you were away.`
74298
74344
  ];
74299
74345
  if (older === 0) return lines2;
74300
74346
  const channel = message2.channelKind === "public" || message2.channelKind === "private";
@@ -74309,12 +74355,12 @@ function formatInboxMessage({
74309
74355
  base
74310
74356
  }) {
74311
74357
  const thread2 = message2.threadRootId ? ` (in the thread of ${message2.threadRootId})` : "";
74312
- const link2 = base === void 0 ? void 0 : linkOf({ url: message2.url, base });
74358
+ const link3 = base === void 0 ? void 0 : linkOf({ url: message2.url, base });
74313
74359
  return [
74314
74360
  ...catchUpLinesOf(message2),
74315
74361
  `[${message2.messageId}] ${message2.author.name} in ${whereOf(message2)}${thread2}:`,
74316
74362
  message2.body,
74317
- ...link2 ? [`Link: ${link2}`] : [],
74363
+ ...link3 ? [`Link: ${link3}`] : [],
74318
74364
  `Answer with: laze reply ${message2.messageId} "<your answer>"`
74319
74365
  ].join("\n");
74320
74366
  }
@@ -74322,9 +74368,9 @@ function hookContextOf({
74322
74368
  messages,
74323
74369
  self: self2
74324
74370
  }) {
74325
- const count13 = messages.length === 1 ? "A message" : `${messages.length} messages`;
74371
+ const count14 = messages.length === 1 ? "A message" : `${messages.length} messages`;
74326
74372
  return [
74327
- `${count13} reached you in Laze${selfClauseOf({ self: self2 })}:`,
74373
+ `${count14} reached you in Laze${selfClauseOf({ self: self2 })}:`,
74328
74374
  "",
74329
74375
  ...messages.map((message2) => formatInboxMessage({ message: message2 })),
74330
74376
  "",
@@ -74339,7 +74385,7 @@ function selfClauseOf({ self: self2 }) {
74339
74385
  function record2(value) {
74340
74386
  return typeof value === "object" && value !== null ? value : {};
74341
74387
  }
74342
- function count7(value) {
74388
+ function count8(value) {
74343
74389
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
74344
74390
  }
74345
74391
  function parse3(line) {
@@ -74375,17 +74421,17 @@ function compactionOf({
74375
74421
  return {
74376
74422
  key: typeof entry2.uuid === "string" ? entry2.uuid : String(index),
74377
74423
  trigger: meta3.trigger === "manual" ? "manual" : "auto",
74378
- tokensBefore: count7(meta3.preTokens),
74379
- tokensAfter: count7(meta3.postTokens),
74424
+ tokensBefore: count8(meta3.preTokens),
74425
+ tokensAfter: count8(meta3.postTokens),
74380
74426
  at: typeof entry2.timestamp === "string" ? entry2.timestamp : "1970-01-01T00:00:00.000Z"
74381
74427
  };
74382
74428
  }
74383
74429
  function usageOf({ entry: entry2 }) {
74384
74430
  const message2 = record2(entry2.message);
74385
74431
  const usage2 = record2(message2.usage);
74386
- const input2 = count7(usage2.input_tokens);
74432
+ const input2 = count8(usage2.input_tokens);
74387
74433
  if (input2 === void 0) return void 0;
74388
- const cached2 = (count7(usage2.cache_read_input_tokens) ?? 0) + (count7(usage2.cache_creation_input_tokens) ?? 0);
74434
+ const cached2 = (count8(usage2.cache_read_input_tokens) ?? 0) + (count8(usage2.cache_creation_input_tokens) ?? 0);
74389
74435
  return {
74390
74436
  tokens: input2 + cached2,
74391
74437
  ...typeof message2.model === "string" ? { model: message2.model } : {}
@@ -75290,7 +75336,7 @@ var slackConfig = Config.define((c) => ({
75290
75336
  }));
75291
75337
 
75292
75338
  // ../../modules/slack/contract/src/slack-ops.ts
75293
- var count8 = external_exports.number().int().nonnegative();
75339
+ var count9 = external_exports.number().int().nonnegative();
75294
75340
  var at2 = external_exports.iso.datetime();
75295
75341
  var slackMirrorHealthDefinition = external_exports.object({
75296
75342
  mirrors: external_exports.array(
@@ -75303,19 +75349,19 @@ var slackMirrorHealthDefinition = external_exports.object({
75303
75349
  /** Shared with another organisation, such as a Slack Connect channel. */
75304
75350
  external: external_exports.boolean(),
75305
75351
  botMember: external_exports.boolean(),
75306
- linkedMembers: count8,
75307
- cacheDays: count8,
75352
+ linkedMembers: count9,
75353
+ cacheDays: count9,
75308
75354
  backfilledAt: at2.nullable(),
75309
75355
  reconciledAt: at2.nullable(),
75310
75356
  /** Message links Laze holds for the conversation, both ways. */
75311
- links: count8,
75357
+ links: count9,
75312
75358
  /** Thread roots Laze holds a reply of. */
75313
- threads: count8,
75359
+ threads: count9,
75314
75360
  /** Roots whose Slack reply count, when last read, is above the replies Laze holds. */
75315
- threadsShort: count8,
75316
- repliesShort: count8,
75361
+ threadsShort: count9,
75362
+ repliesShort: count9,
75317
75363
  /** Threads Laze holds whose root is older than the cache window. */
75318
- oldThreads: count8
75364
+ oldThreads: count9
75319
75365
  })
75320
75366
  )
75321
75367
  });
@@ -75326,10 +75372,10 @@ var DURATION = /^(\d+)\s*(m|min|mins|minutes?|h|hours?|d|days?)$/i;
75326
75372
  function minutesOf({ text: text3 }) {
75327
75373
  const match = DURATION.exec(text3.trim());
75328
75374
  if (!match?.[1] || !match[2]) return null;
75329
- const count13 = Number(match[1]);
75375
+ const count14 = Number(match[1]);
75330
75376
  const unit = match[2].toLowerCase()[0];
75331
75377
  const perUnit = { d: 1440, h: 60, m: 1 };
75332
- const minutes = count13 * (perUnit[unit ?? "m"] ?? 1);
75378
+ const minutes = count14 * (perUnit[unit ?? "m"] ?? 1);
75333
75379
  return minutes > 0 ? minutes : null;
75334
75380
  }
75335
75381
  function muteTextOf({ mute }) {
@@ -75487,13 +75533,13 @@ function lazeHitLines({
75487
75533
  url: url2,
75488
75534
  workspaceId
75489
75535
  }) {
75490
- const reply2 = hit.threadRootId ? " (thread reply)" : "";
75536
+ const reply3 = hit.threadRootId ? " (thread reply)" : "";
75491
75537
  const text3 = bodyAsText({ body: hit.body, mentions: laze.mentions });
75492
- const files2 = hit.matchedFiles.length > 0 ? [` files: ${hit.matchedFiles.join(", ")}`] : [];
75538
+ const files3 = hit.matchedFiles.length > 0 ? [` files: ${hit.matchedFiles.join(", ")}`] : [];
75493
75539
  return [
75494
- `${whereOf2({ kind: hit.channelKind, name: hit.channelName })} ${hit.author.name} ${timeOf(hit.postedAt)}${reply2}`,
75540
+ `${whereOf2({ kind: hit.channelKind, name: hit.channelName })} ${hit.author.name} ${timeOf(hit.postedAt)}${reply3}`,
75495
75541
  ` ${snippetOf({ text: text3, terms: laze.terms }) || "(no text)"}`,
75496
- ...files2,
75542
+ ...files3,
75497
75543
  ` ${linkOf({ url: hit.url, base: url2 }) ?? lazeLinkOf({ url: url2, workspaceId, channelId: hit.channelId, hit })}`
75498
75544
  ];
75499
75545
  }
@@ -75504,14 +75550,14 @@ function slackHitLines({
75504
75550
  workspaceId
75505
75551
  }) {
75506
75552
  const text3 = bodyAsText({ body: hit.body, mentions: laze.mentions });
75507
- const link2 = hit.lazeChannelId ? lazeLinkOf({ url: url2, workspaceId, channelId: hit.lazeChannelId }) : hit.permalink ?? "";
75553
+ const link3 = hit.lazeChannelId ? lazeLinkOf({ url: url2, workspaceId, channelId: hit.lazeChannelId }) : hit.permalink ?? "";
75508
75554
  return [
75509
75555
  `${whereOf2({ kind: "public", name: hit.channelName })} ${hit.authorName} ${timeOf(hit.createdAt)}`,
75510
75556
  ` ${snippetOf({ text: text3, terms: laze.terms }) || "(no text)"}`,
75511
- ...link2 ? [` ${link2}`] : []
75557
+ ...link3 ? [` ${link3}`] : []
75512
75558
  ];
75513
75559
  }
75514
- var count9 = (n) => `${n} message${n === 1 ? "" : "s"}`;
75560
+ var count10 = (n) => `${n} message${n === 1 ? "" : "s"}`;
75515
75561
  function slackSectionLines({
75516
75562
  slack: slack2,
75517
75563
  laze,
@@ -75524,7 +75570,7 @@ function slackSectionLines({
75524
75570
  });
75525
75571
  if (slack2.teams.some((team) => team.state === "searched")) {
75526
75572
  const found = slack2.hits.length;
75527
- lines2.push(found === 0 ? "From Slack: nothing more." : `From Slack: ${count9(found)}`);
75573
+ lines2.push(found === 0 ? "From Slack: nothing more." : `From Slack: ${count10(found)}`);
75528
75574
  }
75529
75575
  for (const hit of slack2.hits) lines2.push(...slackHitLines({ hit, laze, url: url2, workspaceId }), "");
75530
75576
  return lines2;
@@ -75535,7 +75581,7 @@ function formatSearch({
75535
75581
  workspaceId
75536
75582
  }) {
75537
75583
  const { laze, slack: slack2, query } = output2;
75538
- const lines2 = laze.hits.length === 0 ? [`No Laze messages match "${query}".`] : [`Laze: ${count9(laze.hits.length)} for "${query}"`];
75584
+ const lines2 = laze.hits.length === 0 ? [`No Laze messages match "${query}".`] : [`Laze: ${count10(laze.hits.length)} for "${query}"`];
75539
75585
  for (const hit of laze.hits) {
75540
75586
  lines2.push(...lazeHitLines({ hit, laze, url: url2, workspaceId }), "");
75541
75587
  }
@@ -75709,10 +75755,10 @@ async function sessionNotesOf({
75709
75755
  tell = true
75710
75756
  }) {
75711
75757
  const folder = dirname6(notePathOf({ context, pid: 1 }));
75712
- const files2 = await readdir2(folder).catch(() => []);
75758
+ const files3 = await readdir2(folder).catch(() => []);
75713
75759
  const notes = [];
75714
75760
  const dropped = [];
75715
- for (const file4 of files2) {
75761
+ for (const file4 of files3) {
75716
75762
  const pid = Number(file4.replace(/\.json$/, ""));
75717
75763
  const path = join7(folder, file4);
75718
75764
  const note = pid ? await readStateJson({ path }) : void 0;
@@ -75907,9 +75953,9 @@ async function runsInSubagent({ context, command }) {
75907
75953
  const { path } = await claudeTranscriptOf({ context, sessionId });
75908
75954
  if (!path) return false;
75909
75955
  const folder = join8(dirname7(path), sessionId, "subagents");
75910
- const files2 = await readdir3(folder).catch(() => []);
75956
+ const files3 = await readdir3(folder).catch(() => []);
75911
75957
  const subagents = await Promise.all(
75912
- files2.filter((file4) => file4.endsWith(".jsonl")).map(
75958
+ files3.filter((file4) => file4.endsWith(".jsonl")).map(
75913
75959
  async (file4) => lastCallAtOf({ text: await tailOf({ path: join8(folder, file4) }), command })
75914
75960
  )
75915
75961
  );
@@ -76778,7 +76824,7 @@ async function post({
76778
76824
  const body = await textToSend({ context, args, profile, client, text: typed, leaves });
76779
76825
  const thread2 = flagText({ args, name: "thread" });
76780
76826
  const via = viaOf({ args, usage: POST_USAGE });
76781
- const files2 = await filesOf({ context, args, client, at: at8, channel: async () => channel });
76827
+ const files3 = await filesOf({ context, args, client, at: at8, channel: async () => channel });
76782
76828
  if (at8) {
76783
76829
  const target = { channel, ...thread2 ? { threadRootId: thread2 } : {} };
76784
76830
  return scheduleMessage({ context, args, client, at: at8, target, body });
@@ -76791,7 +76837,7 @@ async function post({
76791
76837
  body,
76792
76838
  ...thread2 ? { threadRootId: thread2 } : {},
76793
76839
  ...via,
76794
- ...files2,
76840
+ ...files3,
76795
76841
  ...turnAnswersOf({ context })
76796
76842
  }
76797
76843
  });
@@ -76820,7 +76866,7 @@ async function reply({
76820
76866
  const typed = await textOf({ context, args, from: 2 });
76821
76867
  const leaves = leavesLazeOf({ client, channel });
76822
76868
  const body = await textToSend({ context, args, profile, client, text: typed, leaves });
76823
- const files2 = await filesOf({
76869
+ const files3 = await filesOf({
76824
76870
  context,
76825
76871
  args,
76826
76872
  client,
@@ -76840,7 +76886,7 @@ async function reply({
76840
76886
  ...args.flags["new-thread"] === true ? { thread: true } : {},
76841
76887
  ...args.flags["also-channel"] === true ? { alsoInChannel: true } : {},
76842
76888
  ...via,
76843
- ...files2,
76889
+ ...files3,
76844
76890
  ...turnAnswersOf({ context })
76845
76891
  }
76846
76892
  });
@@ -77013,7 +77059,7 @@ async function claudeRunOf({
77013
77059
  }) {
77014
77060
  const env = context.environment.inherited;
77015
77061
  const user = env.CLAUDE_CONFIG_DIR || join12(env.HOME || homedir3(), ".claude");
77016
- const files2 = await Promise.all(
77062
+ const files3 = await Promise.all(
77017
77063
  [
77018
77064
  join12(folder, ".claude", "settings.local.json"),
77019
77065
  join12(folder, ".claude", "settings.json"),
@@ -77021,8 +77067,8 @@ async function claudeRunOf({
77021
77067
  ].map((path) => settingsOf({ path }))
77022
77068
  );
77023
77069
  const args = claudePid > 0 ? await context.processes.argsOf(claudePid) : void 0;
77024
- const model = env.ANTHROPIC_MODEL || modelFlagOf(args) || files2.map((file4) => file4.model).find((value) => typeof value === "string");
77025
- const compactWindow = windowOf2(env.CLAUDE_CODE_AUTO_COMPACT_WINDOW) ?? files2.map((file4) => windowOf2(record3(file4.env).CLAUDE_CODE_AUTO_COMPACT_WINDOW)).find(Boolean);
77070
+ const model = env.ANTHROPIC_MODEL || modelFlagOf(args) || files3.map((file4) => file4.model).find((value) => typeof value === "string");
77071
+ const compactWindow = windowOf2(env.CLAUDE_CODE_AUTO_COMPACT_WINDOW) ?? files3.map((file4) => windowOf2(record3(file4.env).CLAUDE_CODE_AUTO_COMPACT_WINDOW)).find(Boolean);
77026
77072
  return {
77027
77073
  ...model ? { model } : {},
77028
77074
  ...compactWindow ? { compactWindow } : {}
@@ -77191,8 +77237,8 @@ async function codexRolloutPathOf({
77191
77237
  threadId
77192
77238
  }) {
77193
77239
  const root = join13(codexHome, "sessions");
77194
- const files2 = await readdir4(root, { recursive: true }).catch(() => []);
77195
- const file4 = files2.find(
77240
+ const files3 = await readdir4(root, { recursive: true }).catch(() => []);
77241
+ const file4 = files3.find(
77196
77242
  (name3) => basename5(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
77197
77243
  );
77198
77244
  return file4 ? join13(root, file4) : void 0;
@@ -77449,15 +77495,15 @@ var taskCreate = async ({ args, target, authorization }) => {
77449
77495
  ...typeof worktree === "string" && worktree.trim() && { worktree },
77450
77496
  ...machine2 && { machine: machine2 }
77451
77497
  };
77452
- const reply2 = await callKanban({
77498
+ const reply3 = await callKanban({
77453
77499
  target,
77454
77500
  authorization,
77455
77501
  method: "POST",
77456
77502
  path: "/v1/tasks",
77457
77503
  body
77458
77504
  });
77459
- if (!reply2.ok) return reply2.result;
77460
- const card2 = reply2.data ?? {};
77505
+ if (!reply3.ok) return reply3.result;
77506
+ const card2 = reply3.data ?? {};
77461
77507
  return jsonText(
77462
77508
  pick2(card2, ["id", "title", "column", "projectName", "branch", "isBusy", "isLive"])
77463
77509
  );
@@ -77474,14 +77520,14 @@ var STATUS_KEYS = [
77474
77520
  "queuedPromptCount"
77475
77521
  ];
77476
77522
  var cardStatus = async ({ args, target, authorization }) => {
77477
- const reply2 = await callKanban({
77523
+ const reply3 = await callKanban({
77478
77524
  target,
77479
77525
  authorization,
77480
77526
  method: "GET",
77481
77527
  path: cardPath(required2(args, "card"))
77482
77528
  });
77483
- if (!reply2.ok) return reply2.result;
77484
- const card2 = reply2.data ?? {};
77529
+ if (!reply3.ok) return reply3.result;
77530
+ const card2 = reply3.data ?? {};
77485
77531
  const prs = Array.isArray(card2.prs) ? card2.prs : [];
77486
77532
  return jsonText({
77487
77533
  ...pick2(card2, STATUS_KEYS),
@@ -77517,14 +77563,14 @@ var cardReply = async ({ args, target, authorization }) => {
77517
77563
  var cardPrompt = async ({ args, target, authorization }) => {
77518
77564
  const card2 = required2(args, "card");
77519
77565
  const now = args.now === true;
77520
- const reply2 = await callKanban({
77566
+ const reply3 = await callKanban({
77521
77567
  target,
77522
77568
  authorization,
77523
77569
  method: "POST",
77524
77570
  path: `${cardPath(card2)}/prompt`,
77525
77571
  body: { text: required2(args, "text"), mode: now ? "now" : "queue" }
77526
77572
  });
77527
- if (!reply2.ok) return reply2.result;
77573
+ if (!reply3.ok) return reply3.result;
77528
77574
  return text2(
77529
77575
  now ? `Sent to ${card2} now.` : `Sent to ${card2}; it is delivered when the card's current turn ends.`
77530
77576
  );
@@ -79419,12 +79465,12 @@ var CodexAppServer = class _CodexAppServer {
79419
79465
  }
79420
79466
  async call(method, params) {
79421
79467
  const id8 = ++this.#nextId;
79422
- const reply2 = await new Promise((resolve27) => {
79423
- this.#pending.set(id8, resolve27);
79468
+ const reply3 = await new Promise((resolve29) => {
79469
+ this.#pending.set(id8, resolve29);
79424
79470
  this.write({ id: id8, method, params });
79425
79471
  });
79426
- if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
79427
- return record4(reply2.result);
79472
+ if (reply3.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply3.error)}`);
79473
+ return record4(reply3.result);
79428
79474
  }
79429
79475
  notify(method) {
79430
79476
  this.write({ method });
@@ -79432,12 +79478,12 @@ var CodexAppServer = class _CodexAppServer {
79432
79478
  /** Starts one turn; `done` settles when it completes, keeping its last agent message. */
79433
79479
  async startTurn({ threadId, text: text3 }) {
79434
79480
  const result2 = { answer: "" };
79435
- const done = new Promise((resolve27) => {
79481
+ const done = new Promise((resolve29) => {
79436
79482
  const listen = (message2) => {
79437
79483
  absorbTurnEvent({ result: result2, message: message2 });
79438
79484
  if (message2.method !== "turn/completed") return;
79439
79485
  this.#listeners.delete(listen);
79440
- resolve27(result2);
79486
+ resolve29(result2);
79441
79487
  };
79442
79488
  this.#listeners.add(listen);
79443
79489
  });
@@ -79481,8 +79527,8 @@ var CodexAppServer = class _CodexAppServer {
79481
79527
  };
79482
79528
  async function newestThreadId({ codexHome }) {
79483
79529
  const root = join19(codexHome, "sessions");
79484
- const files2 = await readdir5(root, { recursive: true }).catch(() => []);
79485
- const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
79530
+ const files3 = await readdir5(root, { recursive: true }).catch(() => []);
79531
+ const rollouts = files3.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
79486
79532
  const dated = await Promise.all(
79487
79533
  rollouts.map(async (file4) => ({ file: file4, at: (await stat6(join19(root, file4))).mtimeMs }))
79488
79534
  );
@@ -80111,13 +80157,13 @@ async function pluginIsCurrent({ context }) {
80111
80157
  }
80112
80158
  async function writeLazePlugin({ context }) {
80113
80159
  const folder = pluginFolderOf({ context });
80114
- const files2 = lazePluginFiles({
80160
+ const files3 = lazePluginFiles({
80115
80161
  name: pluginNameHere({ context }),
80116
80162
  program: context.program,
80117
80163
  version: cliVersionOf(),
80118
80164
  configPath: context.environment.configPath
80119
80165
  });
80120
- for (const [path, text3] of Object.entries(files2)) {
80166
+ for (const [path, text3] of Object.entries(files3)) {
80121
80167
  const target = join21(folder, path);
80122
80168
  await mkdir4(dirname15(target), { recursive: true });
80123
80169
  await writeFile2(target, text3);
@@ -82248,8 +82294,8 @@ async function uploadMigration({ context, args }) {
82248
82294
  const moved = await uploadTranscript({ context, args, client }).catch((error63) => {
82249
82295
  const migrated = migratedNoticeOf(error63);
82250
82296
  if (!migrated) throw error63;
82251
- const link2 = migrated.link ?? linkIn(migrated.notice);
82252
- return { link: link2 ?? "", agentName: profile.name, sent: void 0 };
82297
+ const link3 = migrated.link ?? linkIn(migrated.notice);
82298
+ return { link: link3 ?? "", agentName: profile.name, sent: void 0 };
82253
82299
  });
82254
82300
  const notice = moved.link ? `Moved to Laze: ${moved.link}` : "Moved to Laze.";
82255
82301
  await context.store.markMigrated({
@@ -83612,7 +83658,7 @@ var appEditClaimsSchemaDefinition = external_exports.object({
83612
83658
  app: external_exports.string().min(1),
83613
83659
  vid: external_exports.string().min(1),
83614
83660
  base: external_exports.string().min(1).max(64),
83615
- files: external_exports.array(external_exports.object({ path: external_exports.string().min(1).max(300), content: external_exports.string().max(6e5) })).max(20).nullable().transform((files2) => files2 ?? []),
83661
+ files: external_exports.array(external_exports.object({ path: external_exports.string().min(1).max(300), content: external_exports.string().max(6e5) })).max(20).nullable().transform((files3) => files3 ?? []),
83616
83662
  remove: external_exports.array(external_exports.string().min(1).max(300)).max(20).nullable().optional().transform((paths) => paths ?? []),
83617
83663
  msg: external_exports.string().min(1).max(500)
83618
83664
  });
@@ -83797,9 +83843,9 @@ function formatAppMoney({
83797
83843
  maximumFractionDigits: tiny ? 4 : 2
83798
83844
  }).format(amount);
83799
83845
  }
83800
- var count10 = new Intl.NumberFormat("en-US");
83846
+ var count11 = new Intl.NumberFormat("en-US");
83801
83847
  function plural2({ value, one, many }) {
83802
- return `${count10.format(value)} ${value === 1 ? one : many}`;
83848
+ return `${count11.format(value)} ${value === 1 ? one : many}`;
83803
83849
  }
83804
83850
  function appCostQuantityText(line) {
83805
83851
  const { quantity } = line;
@@ -84122,7 +84168,8 @@ var fileScopeSchemaDefinition = external_exports.object({
84122
84168
  "workspace-logo",
84123
84169
  "custom-emoji",
84124
84170
  "computer-copy",
84125
- "app-asset"
84171
+ "app-asset",
84172
+ "wiki-page"
84126
84173
  ]),
84127
84174
  id: idSchema25
84128
84175
  });
@@ -85115,12 +85162,12 @@ function messageOf({ args }) {
85115
85162
  }
85116
85163
  var RECORDS_CALL = /\b(?:Laze|LAZE)\.records\(\s*(["'`])([^"'`$]+)\1\s*\)/g;
85117
85164
  function unknownCollectionsOf({
85118
- files: files2,
85165
+ files: files3,
85119
85166
  collections
85120
85167
  }) {
85121
85168
  if (!collections) return [];
85122
85169
  const known = Object.keys(collections);
85123
- return files2.filter((file4) => /\.(m?js|html)$/.test(file4.path)).flatMap(
85170
+ return files3.filter((file4) => /\.(m?js|html)$/.test(file4.path)).flatMap(
85124
85171
  (file4) => [...file4.text.matchAll(RECORDS_CALL)].filter(([, , name3]) => !known.includes(name3 ?? "")).map((match) => {
85125
85172
  const line = file4.text.slice(0, match.index).split("\n").length;
85126
85173
  const defines = known.length > 0 ? known.join(", ") : "none";
@@ -86629,11 +86676,11 @@ function errorOf2({ script, stderr: stderr2 }) {
86629
86676
  return `${script.path}${line ? `:${line}` : ""}: ${message2}`;
86630
86677
  }
86631
86678
  async function scriptErrorsOf({
86632
- files: files2,
86679
+ files: files3,
86633
86680
  collections
86634
86681
  }) {
86635
- const unknown2 = unknownCollectionsOf({ files: files2, collections });
86636
- const scripts = files2.flatMap(scriptsOf);
86682
+ const unknown2 = unknownCollectionsOf({ files: files3, collections });
86683
+ const scripts = files3.flatMap(scriptsOf);
86637
86684
  if (scripts.length === 0) return unknown2;
86638
86685
  const dir = await mkdtemp(join27(tmpdir3(), "laze-app-check-"));
86639
86686
  try {
@@ -86802,16 +86849,16 @@ async function serveAppFolder({
86802
86849
  (error63) => failed({ response, error: error63 })
86803
86850
  );
86804
86851
  });
86805
- await new Promise((resolve27, reject) => {
86852
+ await new Promise((resolve29, reject) => {
86806
86853
  server.once("error", reject);
86807
- server.listen(port, "127.0.0.1", () => resolve27());
86854
+ server.listen(port, "127.0.0.1", () => resolve29());
86808
86855
  });
86809
86856
  const { port: bound } = server.address();
86810
86857
  return {
86811
86858
  url: `http://127.0.0.1:${bound}/`,
86812
- close: () => new Promise((resolve27) => {
86859
+ close: () => new Promise((resolve29) => {
86813
86860
  server.closeAllConnections();
86814
- server.close(() => resolve27());
86861
+ server.close(() => resolve29());
86815
86862
  })
86816
86863
  };
86817
86864
  }
@@ -87173,7 +87220,7 @@ var appPush = async ({ context, args }) => {
87173
87220
  }
87174
87221
  const manifest = await readManifest(folder);
87175
87222
  const paths = await listFiles(folder);
87176
- const files2 = await Promise.all(
87223
+ const files3 = await Promise.all(
87177
87224
  paths.map(
87178
87225
  async (path) => buildFileOf({
87179
87226
  path: relative3(folder, path).split(sep3).join("/"),
@@ -87181,7 +87228,7 @@ var appPush = async ({ context, args }) => {
87181
87228
  })
87182
87229
  )
87183
87230
  );
87184
- const bytes = files2.reduce((sum, file4) => sum + file4.bytes, 0);
87231
+ const bytes = files3.reduce((sum, file4) => sum + file4.bytes, 0);
87185
87232
  if (bytes > MAX_APP_BUILD_BYTES) {
87186
87233
  context.err(
87187
87234
  `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). Put video, audio, big images and PDFs in assets: laze app asset add <file>
@@ -87189,9 +87236,9 @@ var appPush = async ({ context, args }) => {
87189
87236
  );
87190
87237
  throw new CliUsageError("Nothing was uploaded.");
87191
87238
  }
87192
- if (files2.length === 0) throw new CliUsageError(`No files to push in ${folder}`);
87239
+ if (files3.length === 0) throw new CliUsageError(`No files to push in ${folder}`);
87193
87240
  const scriptErrors = await scriptErrorsOf({
87194
- files: files2.filter((file4) => file4.encoding === "utf8").map(({ path, content }) => ({ path, text: content })),
87241
+ files: files3.filter((file4) => file4.encoding === "utf8").map(({ path, content }) => ({ path, text: content })),
87195
87242
  collections: manifest?.collections
87196
87243
  });
87197
87244
  if (scriptErrors.length > 0) {
@@ -87218,7 +87265,7 @@ var appPush = async ({ context, args }) => {
87218
87265
  const pushed = await client.post("/api/apps/commit", {
87219
87266
  appId,
87220
87267
  message: message2,
87221
- files: files2.map(({ bytes: _bytes, ...file4 }) => file4),
87268
+ files: files3.map(({ bytes: _bytes, ...file4 }) => file4),
87222
87269
  ...manifest?.users ? { users: manifest.users } : {},
87223
87270
  ...manifest?.functions ? { functions: manifest.functions } : {}
87224
87271
  });
@@ -87228,7 +87275,7 @@ var appPush = async ({ context, args }) => {
87228
87275
  context,
87229
87276
  args,
87230
87277
  value: { version: version2, app: publish.app, publish },
87231
- text: `Pushed ${version2.version.slice(0, 7)} "${version2.message}" (${files2.length} files)
87278
+ text: `Pushed ${version2.version.slice(0, 7)} "${version2.message}" (${files3.length} files)
87232
87279
  ` + (seeded ? seedLine(seeded) : "") + publishLine(publish)
87233
87280
  });
87234
87281
  };
@@ -87241,8 +87288,8 @@ var appWrite = async ({ context, args }) => {
87241
87288
  );
87242
87289
  }
87243
87290
  const folder = folderOf({ context, word: void 0 });
87244
- const remove9 = (flagText({ args, name: "remove" }) ?? "").split(",").map((path) => path.trim()).filter(Boolean);
87245
- const files2 = await Promise.all(
87291
+ const remove10 = (flagText({ args, name: "remove" }) ?? "").split(",").map((path) => path.trim()).filter(Boolean);
87292
+ const files3 = await Promise.all(
87246
87293
  words.slice(2).map(async (word3) => {
87247
87294
  const path = resolve9(context.cwd, word3);
87248
87295
  const { bytes: _bytes, ...file4 } = buildFileOf({
@@ -87252,27 +87299,27 @@ var appWrite = async ({ context, args }) => {
87252
87299
  return file4;
87253
87300
  })
87254
87301
  );
87255
- if (files2.length + remove9.length === 0) {
87302
+ if (files3.length + remove10.length === 0) {
87256
87303
  throw new CliUsageError("laze app write needs a file to write or --remove <path,...>");
87257
87304
  }
87258
87305
  const client = await appClient({ context, args });
87259
87306
  const appId = await appIdOf({ client, args, folder });
87260
87307
  const { publish, ...version2 } = await client.post("/api/apps/files/write", {
87261
87308
  appId,
87262
- files: files2,
87263
- remove: remove9,
87309
+ files: files3,
87310
+ remove: remove10,
87264
87311
  message: message2
87265
87312
  });
87266
87313
  print5({
87267
87314
  context,
87268
87315
  args,
87269
87316
  value: { version: version2, app: publish.app, publish },
87270
- text: `Wrote ${version2.version.slice(0, 7)} "${version2.message}" (${files2.length} written, ${remove9.length} removed)
87317
+ text: `Wrote ${version2.version.slice(0, 7)} "${version2.message}" (${files3.length} written, ${remove10.length} removed)
87271
87318
  ` + publishLine(publish)
87272
87319
  });
87273
87320
  };
87274
87321
  function seedLine(seeded) {
87275
- const created = Object.entries(seeded.created).map(([name3, count13]) => `${count13} in ${name3}`);
87322
+ const created = Object.entries(seeded.created).map(([name3, count14]) => `${count14} in ${name3}`);
87276
87323
  const parts = [
87277
87324
  created.length ? `Loaded starter records: ${created.join(", ")}.` : "",
87278
87325
  seeded.skipped.length ? `Left ${seeded.skipped.join(", ")} as it was: it already holds records.` : ""
@@ -87598,8 +87645,8 @@ function cardLine({ choice }) {
87598
87645
  var appCard = async ({ context, args }) => {
87599
87646
  const client = await appClient({ context, args });
87600
87647
  const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
87601
- const count13 = Number(flagText({ args, name: "rows", fallback: "5" }));
87602
- if (!Number.isInteger(count13) || count13 < 1 || count13 > 10) {
87648
+ const count14 = Number(flagText({ args, name: "rows", fallback: "5" }));
87649
+ if (!Number.isInteger(count14) || count14 < 1 || count14 > 10) {
87603
87650
  throw new CliUsageError("--rows is a whole number from 1 to 10");
87604
87651
  }
87605
87652
  const text3 = (name3) => flagText({ args, name: name3 }) || null;
@@ -87612,7 +87659,7 @@ var appCard = async ({ context, args }) => {
87612
87659
  collection: text3("collection"),
87613
87660
  filter: flagText({ args, name: "where" }) || flagText({ args, name: "filter" }),
87614
87661
  sort: flagText({ args, name: "sort" }),
87615
- rows: count13,
87662
+ rows: count14,
87616
87663
  caption: text3("caption")
87617
87664
  }
87618
87665
  });
@@ -88439,8 +88486,8 @@ function printAccount({ context, args }, account) {
88439
88486
  context.out(`Plan: ${plan2}${pending2}${ending}
88440
88487
  `);
88441
88488
  if (account.paymentIssue) {
88442
- const link2 = account.paymentIssue.invoiceUrl ? ` ${account.paymentIssue.invoiceUrl}` : "";
88443
- context.out(`Payment: ${account.paymentIssue.message ?? account.paymentIssue.kind}${link2}
88489
+ const link3 = account.paymentIssue.invoiceUrl ? ` ${account.paymentIssue.invoiceUrl}` : "";
88490
+ context.out(`Payment: ${account.paymentIssue.message ?? account.paymentIssue.kind}${link3}
88444
88491
  `);
88445
88492
  }
88446
88493
  context.out(
@@ -88469,10 +88516,10 @@ async function invoices({ context, args }) {
88469
88516
  if (args.flags.json) return printJson(context, list13);
88470
88517
  if (list13.length === 0) return context.out("No invoices yet.\n");
88471
88518
  for (const invoice of list13) {
88472
- const link2 = invoice.hostedUrl ? ` ${invoice.hostedUrl}` : "";
88519
+ const link3 = invoice.hostedUrl ? ` ${invoice.hostedUrl}` : "";
88473
88520
  const tax = invoice.tax ? ` (tax ${money(invoice.tax, invoice.currency)})` : "";
88474
88521
  context.out(
88475
- `${invoice.createdAt.slice(0, 10)} ${invoice.number ?? "draft"} ${invoice.status} ${money(invoice.total, invoice.currency)}${tax}${link2}
88522
+ `${invoice.createdAt.slice(0, 10)} ${invoice.number ?? "draft"} ${invoice.status} ${money(invoice.total, invoice.currency)}${tax}${link3}
88476
88523
  `
88477
88524
  );
88478
88525
  }
@@ -88694,7 +88741,7 @@ function tunnel({
88694
88741
  host: host2,
88695
88742
  port
88696
88743
  }) {
88697
- return new Promise((resolve27, reject) => {
88744
+ return new Promise((resolve29, reject) => {
88698
88745
  const socket = connectTcp(proxy.port, proxy.host);
88699
88746
  let answer6 = "";
88700
88747
  const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
@@ -88711,7 +88758,7 @@ ${auth}\r
88711
88758
  answer6 += chunk.toString("latin1");
88712
88759
  if (!answer6.includes(HEADER_END)) return;
88713
88760
  socket.off("data", onData);
88714
- if (/^HTTP\/1\.[01] 200/.test(answer6)) return resolve27(socket);
88761
+ if (/^HTTP\/1\.[01] 200/.test(answer6)) return resolve29(socket);
88715
88762
  socket.destroy();
88716
88763
  reject(new Error(`proxy refused the tunnel: ${answer6.split("\r\n")[0] ?? ""}`));
88717
88764
  };
@@ -88724,8 +88771,8 @@ async function upstreamOf({ target, proxy }) {
88724
88771
  const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
88725
88772
  if (!secure) return raw;
88726
88773
  const tls = connectTls({ socket: raw, servername: target.hostname });
88727
- await new Promise((resolve27, reject) => {
88728
- tls.once("secureConnect", () => resolve27());
88774
+ await new Promise((resolve29, reject) => {
88775
+ tls.once("secureConnect", () => resolve29());
88729
88776
  tls.once("error", reject);
88730
88777
  });
88731
88778
  return tls;
@@ -88767,8 +88814,8 @@ async function browserSocket({
88767
88814
  createConnection: () => upstream,
88768
88815
  perMessageDeflate: false
88769
88816
  });
88770
- await new Promise((resolve27, reject) => {
88771
- socket.once("open", () => resolve27());
88817
+ await new Promise((resolve29, reject) => {
88818
+ socket.once("open", () => resolve29());
88772
88819
  socket.once("error", reject);
88773
88820
  });
88774
88821
  return socket;
@@ -88781,12 +88828,12 @@ async function browserCall({
88781
88828
  }) {
88782
88829
  const socket = await browserSocket({ target, proxy });
88783
88830
  try {
88784
- return await new Promise((resolve27, reject) => {
88831
+ return await new Promise((resolve29, reject) => {
88785
88832
  socket.on("message", (data) => {
88786
- const reply2 = JSON.parse(textOf3(data));
88787
- if (reply2.id !== 1) return;
88788
- if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
88789
- else resolve27(reply2.result ?? {});
88833
+ const reply3 = JSON.parse(textOf3(data));
88834
+ if (reply3.id !== 1) return;
88835
+ if (reply3.error) reject(new Error(`${method}: ${JSON.stringify(reply3.error)}`));
88836
+ else resolve29(reply3.result ?? {});
88790
88837
  });
88791
88838
  socket.once(
88792
88839
  "close",
@@ -88950,18 +88997,18 @@ function retargetCdpBridge({
88950
88997
  target,
88951
88998
  expiresAt
88952
88999
  }) {
88953
- return new Promise((resolve27) => {
89000
+ return new Promise((resolve29) => {
88954
89001
  const call = httpRequest(
88955
89002
  { host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
88956
89003
  (response) => {
88957
89004
  response.resume();
88958
- resolve27(response.statusCode === 204);
89005
+ resolve29(response.statusCode === 204);
88959
89006
  }
88960
89007
  );
88961
89008
  call.setHeader(KEY_HEADER, key);
88962
89009
  call.setHeader("content-type", "application/json");
88963
89010
  call.once("timeout", () => call.destroy());
88964
- call.once("error", () => resolve27(false));
89011
+ call.once("error", () => resolve29(false));
88965
89012
  call.end(JSON.stringify({ target, expiresAt }));
88966
89013
  });
88967
89014
  }
@@ -89010,15 +89057,15 @@ async function startCdpBridge({
89010
89057
  (socket) => relayPage({ client: socket, targetId, target: url2, proxy })
89011
89058
  );
89012
89059
  });
89013
- await new Promise((resolve27) => server.listen(0, "127.0.0.1", resolve27));
89060
+ await new Promise((resolve29) => server.listen(0, "127.0.0.1", resolve29));
89014
89061
  const port = server.address().port;
89015
89062
  return {
89016
89063
  port,
89017
- close: () => new Promise((resolve27) => {
89064
+ close: () => new Promise((resolve29) => {
89018
89065
  for (const client of relayed) client.destroy();
89019
89066
  pages.close();
89020
89067
  server.closeAllConnections();
89021
- server.close(() => resolve27());
89068
+ server.close(() => resolve29());
89022
89069
  })
89023
89070
  };
89024
89071
  }
@@ -89035,7 +89082,7 @@ function launchCdpBridge({
89035
89082
  stdio: ["ignore", "pipe", "ignore"],
89036
89083
  env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
89037
89084
  });
89038
- return new Promise((resolve27, reject) => {
89085
+ return new Promise((resolve29, reject) => {
89039
89086
  let printed2 = "";
89040
89087
  child.once("error", reject);
89041
89088
  child.once("exit", (code4) => reject(new Error(`the CDP bridge stopped (${code4})`)));
@@ -89046,7 +89093,7 @@ function launchCdpBridge({
89046
89093
  child.stdout.destroy();
89047
89094
  child.removeAllListeners("exit");
89048
89095
  child.unref();
89049
- if (Number.isInteger(port) && port > 0) resolve27(port);
89096
+ if (Number.isInteger(port) && port > 0) resolve29(port);
89050
89097
  else reject(new Error("the CDP bridge printed no port"));
89051
89098
  });
89052
89099
  });
@@ -89217,15 +89264,15 @@ async function bridge({ context }) {
89217
89264
  async function screen({ context, args }) {
89218
89265
  const client = await computeClient({ context, args });
89219
89266
  const site = flagText({ args, name: "site" }) || void 0;
89220
- const link2 = await client.post(PATHS2.screen, {
89267
+ const link3 = await client.post(PATHS2.screen, {
89221
89268
  machine: machineArg({ args }),
89222
89269
  ...site ? { site } : {}
89223
89270
  });
89224
- if (args.flags.json) return context.out(`${JSON.stringify(link2, null, 2)}
89271
+ if (args.flags.json) return context.out(`${JSON.stringify(link3, null, 2)}
89225
89272
  `);
89226
89273
  context.out(
89227
- link2.url ? `${link2.url}
89228
- ` : `Sent a fresh screen link for ${link2.machine.name} where you were asked.
89274
+ link3.url ? `${link3.url}
89275
+ ` : `Sent a fresh screen link for ${link3.machine.name} where you were asked.
89229
89276
  `
89230
89277
  );
89231
89278
  }
@@ -89307,9 +89354,9 @@ function presenceColumns(member) {
89307
89354
  return [member.presence, `${status11.emoji} ${status11.text}`.trim() + until, ...dndColumn(member)];
89308
89355
  }
89309
89356
  function formatMembers({ detail }) {
89310
- const count13 = `${detail.members.length} ${detail.members.length === 1 ? "member" : "members"}`;
89357
+ const count14 = `${detail.members.length} ${detail.members.length === 1 ? "member" : "members"}`;
89311
89358
  const ends = detail.endsAt ? `, ends ${utcTimeOf(detail.endsAt)}` : "";
89312
- const head = `${channelLabelOf(detail)} (${detail.id}), ${count13}${ends}`;
89359
+ const head = `${channelLabelOf(detail)} (${detail.id}), ${count14}${ends}`;
89313
89360
  const rows = detail.members.map(
89314
89361
  (member) => [ROLE[member.role], member.name, member.kind, member.id, ...presenceColumns(member)].join(" ")
89315
89362
  );
@@ -89349,13 +89396,13 @@ function formatBrowsable({
89349
89396
  }) {
89350
89397
  if (channels3.length === 0) return "No channels to browse.\n";
89351
89398
  const rows = channels3.map((channel) => {
89352
- const count13 = `${channel.memberCount} ${channel.memberCount === 1 ? "member" : "members"}`;
89399
+ const count14 = `${channel.memberCount} ${channel.memberCount === 1 ? "member" : "members"}`;
89353
89400
  const marks = [
89354
89401
  channel.joined ? "joined" : "not joined",
89355
89402
  ...channel.private ? ["private"] : [],
89356
89403
  ...channel.archived ? ["archived"] : []
89357
89404
  ].join(", ");
89358
- const text3 = `#${channel.name} ${channel.id} ${count13} ${marks} ${channel.topic}`;
89405
+ const text3 = `#${channel.name} ${channel.id} ${count14} ${marks} ${channel.topic}`;
89359
89406
  return withLink({ text: text3, url: channel.url, base });
89360
89407
  });
89361
89408
  return `${rows.join("\n")}
@@ -89725,13 +89772,13 @@ async function channelGroups({ context, args }) {
89725
89772
  const [, , channel] = args.words;
89726
89773
  if (!channel) throw new CliUsageError("Usage: laze channel groups <channel>");
89727
89774
  const { client } = await signedIn({ context, args });
89728
- const reply2 = await client.post("/api/agents/me/channels/groups", {
89775
+ const reply3 = await client.post("/api/agents/me/channels/groups", {
89729
89776
  channel
89730
89777
  });
89731
- if (args.flags.json) return context.out(`${JSON.stringify(reply2, null, 2)}
89778
+ if (args.flags.json) return context.out(`${JSON.stringify(reply3, null, 2)}
89732
89779
  `);
89733
- if (reply2.groups.length === 0) return context.out("No groups in this channel.\n");
89734
- for (const group of reply2.groups) context.out(`@${group.name} ${group.memberCount}
89780
+ if (reply3.groups.length === 0) return context.out("No groups in this channel.\n");
89781
+ for (const group of reply3.groups) context.out(`@${group.name} ${group.memberCount}
89735
89782
  `);
89736
89783
  }
89737
89784
  function groupChange({
@@ -89744,11 +89791,11 @@ function groupChange({
89744
89791
  throw new CliUsageError(`Usage: laze channel ${verb} <channel> <group>`);
89745
89792
  }
89746
89793
  const { client } = await signedIn({ context, args });
89747
- const reply2 = await client.post(`/api/agents/me/channels/${verb}`, {
89794
+ const reply3 = await client.post(`/api/agents/me/channels/${verb}`, {
89748
89795
  channel,
89749
89796
  group
89750
89797
  });
89751
- if (args.flags.json) return context.out(`${JSON.stringify(reply2, null, 2)}
89798
+ if (args.flags.json) return context.out(`${JSON.stringify(reply3, null, 2)}
89752
89799
  `);
89753
89800
  context.out(`${line(group.replace(/^@/, ""))}
89754
89801
  `);
@@ -90067,15 +90114,15 @@ async function threadWaitReply({
90067
90114
  const seconds = timeoutOf({ args });
90068
90115
  const { client } = await signedIn({ context, args });
90069
90116
  const read4 = () => client.post(CHAT_KEY_PATHS.thread, { messageId });
90070
- const seen = new Set((await read4()).replies.map((reply2) => reply2.id));
90071
- const isNew = (reply2) => reply2.author.kind === "person" && !seen.has(reply2.id);
90117
+ const seen = new Set((await read4()).replies.map((reply3) => reply3.id));
90118
+ const isNew = (reply3) => reply3.author.kind === "person" && !seen.has(reply3.id);
90072
90119
  for (let waited = 0; waited < seconds * 1e3; waited += POLL_MS2) {
90073
90120
  await context.sleep(POLL_MS2);
90074
- const reply2 = (await read4()).replies.find(isNew);
90075
- if (!reply2) continue;
90076
- const line = `${reply2.seq} ${reply2.id} person ${reply2.author.id} ${reply2.body}
90121
+ const reply3 = (await read4()).replies.find(isNew);
90122
+ if (!reply3) continue;
90123
+ const line = `${reply3.seq} ${reply3.id} person ${reply3.author.id} ${reply3.body}
90077
90124
  `;
90078
- context.out(args.flags.json ? `${JSON.stringify(reply2, null, 2)}
90125
+ context.out(args.flags.json ? `${JSON.stringify(reply3, null, 2)}
90079
90126
  ` : line);
90080
90127
  return void 0;
90081
90128
  }
@@ -92665,42 +92712,44 @@ var machineDefinition = external_exports.object({
92665
92712
  requesterUserId: idSchema26,
92666
92713
  renterAgentId: idSchema26.nullable(),
92667
92714
  channelId: idSchema26.nullable(),
92668
- ipAddress: external_exports.string().nullable(),
92669
- sites: external_exports.array(machineSiteDefinition),
92715
+ ipAddress: ownerOnly(external_exports.string().nullable()),
92716
+ sites: ownerOnly(external_exports.array(machineSiteDefinition)),
92670
92717
  /** Members and agents the owner shared the machine with, beyond the owner's own agents. */
92671
- grants: external_exports.array(machineGrantDefinition),
92718
+ grants: ownerOnly(external_exports.array(machineGrantDefinition)),
92672
92719
  /** Set while the owner has the screen open; the agent waits until then. */
92673
92720
  inHumanUse: external_exports.boolean(),
92674
92721
  /** The spend cap for one `budgetPeriod`, at list price. */
92675
- budgetUsd: external_exports.number().nonnegative(),
92722
+ budgetUsd: ownerOnly(external_exports.number().nonnegative()),
92676
92723
  budgetPeriod: machineBudgetPeriodSchema,
92677
92724
  /** What the machine cost so far in the current budget period. */
92678
- periodCostUsd: external_exports.number().nonnegative(),
92725
+ periodCostUsd: ownerOnly(external_exports.number().nonnegative()),
92679
92726
  /** Set when the period's cost reached the cap: the machine sleeps until the period ends. */
92680
92727
  budgetReached: external_exports.boolean(),
92681
92728
  /** When the current budget period ends and the cost starts again from zero. */
92682
92729
  budgetResetsAt: external_exports.iso.datetime(),
92683
- monthCostUsd: external_exports.number().nonnegative(),
92730
+ monthCostUsd: ownerOnly(external_exports.number().nonnegative()),
92684
92731
  price: machinePriceDefinition,
92685
92732
  /** Whether the machine's daemon holds its link to Laze right now. */
92686
92733
  online: external_exports.boolean(),
92687
92734
  /** When the daemon was last linked; null before it ever was. */
92688
92735
  lastSeenAt: external_exports.iso.datetime().nullable(),
92689
92736
  /** What an own machine's connector reported last, and when. */
92690
- health: machineHealthSchema.nullable(),
92737
+ health: ownerOnly(machineHealthSchema.nullable()),
92691
92738
  healthCheckedAt: external_exports.iso.datetime().nullable(),
92692
92739
  /** While an own machine waits for its connector: when the connect code stops working. */
92693
92740
  connectExpiresAt: external_exports.iso.datetime().nullable(),
92694
92741
  /** Set on an own machine Laze reaches over SSH instead of through the connector. */
92695
- ssh: machineSshSchema.optional(),
92742
+ ssh: ownerOnly(machineSshSchema.optional()),
92696
92743
  /** The owner's agents set to run on this own machine. */
92697
- hostedAgents: external_exports.array(
92698
- external_exports.object({
92699
- id: idSchema26,
92700
- name: external_exports.string(),
92701
- whenOffline: external_exports.enum(["wait", "sandbox"])
92702
- })
92703
- ).default([]),
92744
+ hostedAgents: ownerOnly(
92745
+ external_exports.array(
92746
+ external_exports.object({
92747
+ id: idSchema26,
92748
+ name: external_exports.string(),
92749
+ whenOffline: external_exports.enum(["wait", "sandbox"])
92750
+ })
92751
+ ).default([])
92752
+ ),
92704
92753
  lastUsedAt: external_exports.iso.datetime(),
92705
92754
  createdAt: external_exports.iso.datetime(),
92706
92755
  /** The machine's screen in Laze; absent where the deployment names no origin. */
@@ -93303,7 +93352,7 @@ var sendWakeIntentDefinition = external_exports.object({
93303
93352
  });
93304
93353
 
93305
93354
  // ../../modules/compute/contract/src/whatsapp-ops.ts
93306
- var count11 = external_exports.number().int().nonnegative();
93355
+ var count12 = external_exports.number().int().nonnegative();
93307
93356
  var at4 = external_exports.iso.datetime();
93308
93357
  var whatsappMirrorHealthDefinition = external_exports.object({
93309
93358
  mirrors: external_exports.array(
@@ -93321,33 +93370,33 @@ var whatsappMirrorHealthDefinition = external_exports.object({
93321
93370
  nextVisitAt: at4.nullable(),
93322
93371
  touchedAt: at4.nullable(),
93323
93372
  createdAt: at4,
93324
- skipped: external_exports.object({ count: count11, from: external_exports.number().int().nullable(), at: at4.nullable() }),
93373
+ skipped: external_exports.object({ count: count12, from: external_exports.number().int().nullable(), at: at4.nullable() }),
93325
93374
  /** The last pull that met files; null when none did. */
93326
93375
  files: external_exports.object({
93327
93376
  at: at4,
93328
- attached: count11,
93329
- unavailable: count11,
93330
- retrying: count11,
93331
- dropped: count11,
93377
+ attached: count12,
93378
+ unavailable: count12,
93379
+ retrying: count12,
93380
+ dropped: count12,
93332
93381
  failureCode: external_exports.string().nullable()
93333
93382
  }).nullable(),
93334
93383
  /** Intake holds (ADR-216 §11) by kind and code, with when the oldest was made. */
93335
- holds: external_exports.array(external_exports.object({ kind: external_exports.string(), code: external_exports.string(), count: count11, oldestAt: at4 })),
93384
+ holds: external_exports.array(external_exports.object({ kind: external_exports.string(), code: external_exports.string(), count: count12, oldestAt: at4 })),
93336
93385
  /**
93337
93386
  * The computer store's fill (ADR-223): chats done, how many mirrored items from the last 6
93338
93387
  * months Laze held, those the store held and those sent; the mirrored items Laze holds now
93339
93388
  * and how many a trim to 7 days after last read would delete. Null before a fill started.
93340
93389
  */
93341
93390
  storeFill: external_exports.object({
93342
- chats: count11,
93343
- lazeHeld: count11,
93344
- alreadyHeld: count11,
93345
- sent: count11,
93391
+ chats: count12,
93392
+ lazeHeld: count12,
93393
+ alreadyHeld: count12,
93394
+ sent: count12,
93346
93395
  problem: external_exports.string().nullable(),
93347
93396
  filledAt: at4.nullable(),
93348
93397
  updatedAt: at4,
93349
- mirrored: count11,
93350
- trimmable: count11
93398
+ mirrored: count12,
93399
+ trimmable: count12
93351
93400
  }).nullable().optional()
93352
93401
  })
93353
93402
  )
@@ -93377,7 +93426,7 @@ var whatsappSendsDefinition = external_exports.object({
93377
93426
  quoted: external_exports.boolean(),
93378
93427
  /** Sends to the same chat share a number, counted from 1 in this answer; never the chat. */
93379
93428
  chatIndex: external_exports.number().int().min(1),
93380
- files: count11,
93429
+ files: count12,
93381
93430
  /**
93382
93431
  * Why a failed send did not go: its stored code, or for older sends the code its outcome
93383
93432
  * line reads as; "other" when none fits, null for a send that did not fail.
@@ -93405,7 +93454,7 @@ var whatsappSendStreamsDefinition = external_exports.object({
93405
93454
  failureCode: external_exports.string().nullable(),
93406
93455
  createdAt: at4,
93407
93456
  /** The stream's events, its last event's kind and time; zero and null for none. */
93408
- events: count11,
93457
+ events: count12,
93409
93458
  lastEvent: external_exports.enum(["requested", "taken", "evidenced", "refused", "unresolved", "recheck_requested"]).nullable(),
93410
93459
  lastEventAt: at4.nullable(),
93411
93460
  /** The process's step and deadline; null when no process holds the send. */
@@ -93416,9 +93465,9 @@ var whatsappSendStreamsDefinition = external_exports.object({
93416
93465
  })
93417
93466
  ),
93418
93467
  /** Counts over the answered sends. */
93419
- total: count11,
93420
- agree: count11,
93421
- disagree: count11
93468
+ total: count12,
93469
+ agree: count12,
93470
+ disagree: count12
93422
93471
  });
93423
93472
  var whatsappSendStreamsSchema = whatsappSendStreamsDefinition;
93424
93473
  var WHATSAPP_WAKE_STEPS = [
@@ -93458,11 +93507,11 @@ var whatsappWakeTimelineDefinition = external_exports.object({
93458
93507
  external_exports.object({
93459
93508
  step: external_exports.enum(WHATSAPP_WAKE_STEPS),
93460
93509
  at: at4,
93461
- sincePreviousMs: count11,
93462
- sinceRequestMs: count11
93510
+ sincePreviousMs: count12,
93511
+ sinceRequestMs: count12
93463
93512
  })
93464
93513
  ),
93465
- totalMs: count11.nullable()
93514
+ totalMs: count12.nullable()
93466
93515
  })
93467
93516
  )
93468
93517
  })
@@ -95453,7 +95502,8 @@ var DISCORD_PERMISSIONS = {
95453
95502
  SEND_MESSAGES_IN_THREADS: 1n << 38n
95454
95503
  };
95455
95504
  var discordSetupDefinition = external_exports.object({
95456
- setupKey: external_exports.string().min(1),
95505
+ /** The handle that saves the bot; empty to anyone who cannot set it up. */
95506
+ setupKey: external_exports.string(),
95457
95507
  /** The OAuth2 redirect to add in the portal. */
95458
95508
  redirectUrl: external_exports.url(),
95459
95509
  /** The Developer Portal's applications page. */
@@ -95836,8 +95886,12 @@ var overview = async ({ context, args, client }) => {
95836
95886
  const view = await client.get(DISCORD_KEY_PATHS.overview);
95837
95887
  if (json4({ context, args, data: view })) return;
95838
95888
  if (!view.setup) context.out("No Discord bot is set up. An admin runs `laze discord setup`.\n");
95839
- else if (!view.setup.saved) context.out(`Setup started: ${view.setup.setupKey}
95840
- `);
95889
+ else if (!view.setup.saved) {
95890
+ context.out(
95891
+ view.setup.setupKey ? `Setup started: ${view.setup.setupKey}
95892
+ ` : "An admin started setup.\n"
95893
+ );
95894
+ }
95841
95895
  if (view.connections.length === 0) return context.out("No Discord server is connected.\n");
95842
95896
  for (const row of view.connections) printConnection2({ context, row });
95843
95897
  };
@@ -95933,8 +95987,8 @@ var history = async ({ context, args, client }) => {
95933
95987
  if (json4({ context, args, data: page })) return;
95934
95988
  if (page.messages.length === 0) return context.out("No older messages.\n");
95935
95989
  for (const message2 of page.messages) {
95936
- const files2 = message2.files.length > 0 ? ` [${message2.files.length} files]` : "";
95937
- context.out(`[${message2.createdAt}] ${message2.authorName}: ${message2.body}${files2}
95990
+ const files3 = message2.files.length > 0 ? ` [${message2.files.length} files]` : "";
95991
+ context.out(`[${message2.createdAt}] ${message2.authorName}: ${message2.body}${files3}
95938
95992
  `);
95939
95993
  }
95940
95994
  if (page.hasOlder) {
@@ -98183,8 +98237,8 @@ function draftFilesMissingText(names) {
98183
98237
  }
98184
98238
 
98185
98239
  // ../../modules/feed/contract/src/feed.decisions.ts
98186
- function decisionsLineOf(count13) {
98187
- return `${count13} ${count13 === 1 ? "decision" : "decisions"} waiting on you`;
98240
+ function decisionsLineOf(count14) {
98241
+ return `${count14} ${count14 === 1 ? "decision" : "decisions"} waiting on you`;
98188
98242
  }
98189
98243
 
98190
98244
  // src/rules/feed-input.rules.ts
@@ -98525,16 +98579,16 @@ async function bodyOf2({
98525
98579
  return body;
98526
98580
  }
98527
98581
  function keptFilesOf({
98528
- files: files2,
98582
+ files: files3,
98529
98583
  removing
98530
98584
  }) {
98531
98585
  const matches = (file4, name3) => file4.id === name3 || file4.fileName === name3;
98532
- const unknown2 = removing.filter((name3) => !files2.some((file4) => matches(file4, name3)));
98586
+ const unknown2 = removing.filter((name3) => !files3.some((file4) => matches(file4, name3)));
98533
98587
  if (unknown2.length > 0) {
98534
- const on = files2.map((file4) => `${file4.fileName} (${file4.id})`).join(", ") || "none";
98588
+ const on = files3.map((file4) => `${file4.fileName} (${file4.id})`).join(", ") || "none";
98535
98589
  throw new CliUsageError(`The card has no file ${unknown2.join(", ")}; its files: ${on}`);
98536
98590
  }
98537
- return files2.filter((file4) => !removing.some((name3) => matches(file4, name3)));
98591
+ return files3.filter((file4) => !removing.some((name3) => matches(file4, name3)));
98538
98592
  }
98539
98593
  function refuseNamedFilesMissing({
98540
98594
  args,
@@ -98722,8 +98776,8 @@ function optionalWords(words) {
98722
98776
  }
98723
98777
  function shareLinesOf({ move: move3, answer: answer6 }) {
98724
98778
  const names = answer6.people.map((person) => person.name).join(", ") || "no one new";
98725
- const count13 = answer6.itemIds.length;
98726
- const items = `${count13} item${count13 === 1 ? "" : "s"}`;
98779
+ const count14 = answer6.itemIds.length;
98780
+ const items = `${count14} item${count14 === 1 ? "" : "s"}`;
98727
98781
  const head = move3 === "share" ? `Shared ${items} with ${names}` : `Took ${names} off ${items}`;
98728
98782
  return [head, ...answer6.itemIds].map((line) => `${line}
98729
98783
  `).join("");
@@ -98750,9 +98804,9 @@ async function feedGroupSummary({ context, args }) {
98750
98804
  const pointer = await client.post("/api/feed/group-summary", { group });
98751
98805
  if (args.flags.json) return context.out(`${JSON.stringify(pointer, null, 2)}
98752
98806
  `);
98753
- const link2 = pointer.link.startsWith("/") ? pointer.path : pointer.link;
98807
+ const link3 = pointer.link.startsWith("/") ? pointer.path : pointer.link;
98754
98808
  const top = pointer.top.map((title, index) => `${index + 1}. ${title}`);
98755
- context.out(`${[pointer.headline, link2, ...top].join("\n")}
98809
+ context.out(`${[pointer.headline, link3, ...top].join("\n")}
98756
98810
  `);
98757
98811
  }
98758
98812
  var PLACES = { open: "open", coming_up: "coming up", handled: "handled" };
@@ -99351,8 +99405,8 @@ function linesOf3(output2) {
99351
99405
  function blockOf2(line) {
99352
99406
  const badge = line.source ? ` [${line.source}]` : "";
99353
99407
  const thread2 = line.threadRootId ? ` in thread ${line.threadRootId}` : "";
99354
- const link2 = line.link ? ` ${line.link}` : "";
99355
- const head = `${timeOf2(line.at)} ${line.author}${badge} ${line.cursor}${thread2}${link2}`;
99408
+ const link3 = line.link ? ` ${line.link}` : "";
99409
+ const head = `${timeOf2(line.at)} ${line.author}${badge} ${line.cursor}${thread2}${link3}`;
99356
99410
  const body = line.body.split("\n").map((each) => ` ${each}`);
99357
99411
  const replies = line.replyCount > 0 ? [` ${line.replyCount} ${line.replyCount === 1 ? "reply" : "replies"} in its thread`] : [];
99358
99412
  return [head, ...body, ...replies].join("\n");
@@ -99370,13 +99424,13 @@ function formatHistory(output2) {
99370
99424
  const lines2 = linesOf3(output2);
99371
99425
  if (lines2.length === 0) return `${where}${from}: no messages.
99372
99426
  `;
99373
- const count13 = lines2.length === 1 ? "1 message" : `${lines2.length} messages`;
99427
+ const count14 = lines2.length === 1 ? "1 message" : `${lines2.length} messages`;
99374
99428
  const blocks = lines2.map(blockOf2).join("\n\n");
99375
99429
  const cursor = olderCursorOf(output2);
99376
99430
  const older = cursor ? `
99377
99431
 
99378
99432
  Older: laze history ${output2.channel} --before ${cursor}` : "";
99379
- return `${where}${from}: ${count13}, oldest first
99433
+ return `${where}${from}: ${count14}, oldest first
99380
99434
 
99381
99435
  ${blocks}${older}
99382
99436
  `;
@@ -100725,10 +100779,10 @@ ${USAGE13}`);
100725
100779
  if ("exitCode" in released) return released;
100726
100780
  Object.assign(env, released.env);
100727
100781
  }
100728
- const count13 = Object.keys(env).length;
100729
- if (count13 > EXEC_ENV_MAX) {
100782
+ const count14 = Object.keys(env).length;
100783
+ if (count14 > EXEC_ENV_MAX) {
100730
100784
  context.err(
100731
- `laze: these connections hold ${count13} variables; at most ${EXEC_ENV_MAX} go with a command. Send fewer connections, or run the command with \`laze vault run\` where you run.
100785
+ `laze: these connections hold ${count14} variables; at most ${EXEC_ENV_MAX} go with a command. Send fewer connections, or run the command with \`laze vault run\` where you run.
100732
100786
  `
100733
100787
  );
100734
100788
  return { exitCode: 1 };
@@ -100885,7 +100939,7 @@ function secretRefusal({
100885
100939
  rules = MCP_SECRET_COMMANDS
100886
100940
  }) {
100887
100941
  const { words, flags: flags2 } = parseArgs({ argv });
100888
- const command = [3, 2, 1].map((count13) => words.slice(0, count13).join(" ")).find((name3) => Object.hasOwn(rules, name3));
100942
+ const command = [3, 2, 1].map((count14) => words.slice(0, count14).join(" ")).find((name3) => Object.hasOwn(rules, name3));
100889
100943
  const rule = command === void 0 ? void 0 : rules[command];
100890
100944
  if (!command || !rule) return void 0;
100891
100945
  const vaultFlag = rule.vaultFlag ?? "from-vault";
@@ -101071,12 +101125,12 @@ async function writeMount({
101071
101125
  context,
101072
101126
  args,
101073
101127
  folder,
101074
- files: files2
101128
+ files: files3
101075
101129
  }) {
101076
101130
  const root = resolve19(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
101077
101131
  await rm17(root, { recursive: true, force: true });
101078
101132
  await mkdir11(root, { recursive: true });
101079
- for (const file4 of files2) {
101133
+ for (const file4 of files3) {
101080
101134
  const target = resolve19(root, file4.path);
101081
101135
  const inside = relative4(root, target);
101082
101136
  if (!inside || inside.startsWith(".."))
@@ -101195,12 +101249,12 @@ async function memorySearch({ context, args }) {
101195
101249
  async function memoryPull({ context, args }) {
101196
101250
  const channel = turnChannel({ context, args });
101197
101251
  const { client } = await turnClient({ context, args });
101198
- const files2 = await client.post("/api/memory/files", channel ? { channel } : {});
101199
- const root = await writeMount({ context, args, folder: "memory", files: files2 });
101252
+ const files3 = await client.post("/api/memory/files", channel ? { channel } : {});
101253
+ const root = await writeMount({ context, args, folder: "memory", files: files3 });
101200
101254
  if (args.flags.json)
101201
- return context.out(`${JSON.stringify({ root, files: files2.map((f) => f.path) })}
101255
+ return context.out(`${JSON.stringify({ root, files: files3.map((f) => f.path) })}
101202
101256
  `);
101203
- context.out(`${files2.length} files in ${root}
101257
+ context.out(`${files3.length} files in ${root}
101204
101258
  `);
101205
101259
  }
101206
101260
  async function turnTokenOf5({ context }) {
@@ -101636,11 +101690,11 @@ async function monitorAdd({ context, args }) {
101636
101690
  });
101637
101691
  if (args.flags.json) return context.out(`${JSON.stringify(added, null, 2)}
101638
101692
  `);
101639
- const count13 = added.watching.length;
101693
+ const count14 = added.watching.length;
101640
101694
  context.out(
101641
101695
  `${added.monitor.id} ${added.monitor.name}
101642
101696
  ${added.watching.join(" ")}
101643
- Watching ${count13} ${count13 === 1 ? "channel" : "channels"}
101697
+ Watching ${count14} ${count14 === 1 ? "channel" : "channels"}
101644
101698
  `
101645
101699
  );
101646
101700
  }
@@ -103027,12 +103081,12 @@ var funnelInputDefinition = external_exports.object({
103027
103081
  to: external_exports.iso.datetime(),
103028
103082
  bucketMinutes: external_exports.union([external_exports.literal(10), external_exports.literal(60), external_exports.literal(1440)]).default(60)
103029
103083
  }).strict();
103030
- var count12 = external_exports.number().int().nonnegative();
103084
+ var count13 = external_exports.number().int().nonnegative();
103031
103085
  var funnelCountsDefinition = external_exports.object({
103032
- signUps: count12,
103033
- workspaces: count12,
103034
- activatedTeams: count12,
103035
- payingTeams: count12
103086
+ signUps: count13,
103087
+ workspaces: count13,
103088
+ activatedTeams: count13,
103089
+ payingTeams: count13
103036
103090
  });
103037
103091
  var funnelOutputDefinition = external_exports.object({
103038
103092
  bucketMinutes: external_exports.number().int(),
@@ -103061,34 +103115,34 @@ var cohortOutputDefinition = external_exports.object({
103061
103115
  promotionId: external_exports.string().nullable(),
103062
103116
  plan: external_exports.string(),
103063
103117
  paying: external_exports.boolean(),
103064
- members: count12,
103118
+ members: count13,
103065
103119
  agents: external_exports.object({
103066
- laze: count12,
103067
- connected: count12,
103120
+ laze: count13,
103121
+ connected: count13,
103068
103122
  firstLazeAgentAt: external_exports.iso.datetime().nullable()
103069
103123
  }),
103070
- turns: count12,
103071
- appsCreated: count12,
103072
- connectionsLinked: count12,
103124
+ turns: count13,
103125
+ appsCreated: count13,
103126
+ connectionsLinked: count13,
103073
103127
  /** Slack channels mirrored, Slack and Discord link and intake events, WhatsApp mirrors on. */
103074
103128
  messaging: external_exports.object({
103075
- slackChannels: count12,
103076
- slackEvents: count12,
103077
- discordEvents: count12,
103078
- whatsappMirrors: count12
103129
+ slackChannels: count13,
103130
+ slackEvents: count13,
103131
+ discordEvents: count13,
103132
+ whatsappMirrors: count13
103079
103133
  }),
103080
103134
  creatorLastMessageAt: external_exports.iso.datetime().nullable(),
103081
103135
  /** The creator's last heartbeat from a Laze web or desktop window here; null when never. */
103082
103136
  creatorLastSeenAt: external_exports.iso.datetime().nullable(),
103083
103137
  /** Members whose last heartbeat here falls in the 7 days before `until`. */
103084
- peopleSeenLast7Days: count12,
103138
+ peopleSeenLast7Days: count13,
103085
103139
  /** Live messages per UTC day; days with none are left out. */
103086
103140
  days: external_exports.array(
103087
103141
  external_exports.object({
103088
103142
  day: external_exports.string(),
103089
- byPeople: count12,
103090
- byAgents: count12,
103091
- people: count12
103143
+ byPeople: count13,
103144
+ byAgents: count13,
103145
+ people: count13
103092
103146
  })
103093
103147
  ),
103094
103148
  /** The once-only sends nurturing kept (first_agent_made, first_agent_nudge, ...). */
@@ -103112,29 +103166,29 @@ var capacityOutputDefinition = external_exports.object({
103112
103166
  /** The last day of host load, oldest first. */
103113
103167
  history: external_exports.array(hostLoadPointSchema)
103114
103168
  });
103115
- var tally = external_exports.array(external_exports.object({ key: external_exports.string(), count: count12 }));
103169
+ var tally = external_exports.array(external_exports.object({ key: external_exports.string(), count: count13 }));
103116
103170
  var snapshotOutputDefinition = external_exports.object({
103117
103171
  workspaceId: external_exports.string(),
103118
103172
  createdAt: external_exports.iso.datetime(),
103119
103173
  plan: external_exports.string(),
103120
103174
  status: external_exports.string(),
103121
- seats: external_exports.object({ people: count12, limit: external_exports.number().int().nullable() }),
103175
+ seats: external_exports.object({ people: count13, limit: external_exports.number().int().nullable() }),
103122
103176
  membersByRole: tally,
103123
103177
  invitesByStatus: tally,
103124
103178
  agentsByKind: tally,
103125
103179
  agentsByHosting: tally,
103126
- agentsConnected: count12,
103180
+ agentsConnected: count13,
103127
103181
  flagsOn: external_exports.array(external_exports.string()),
103128
- complimentaryComputers: count12
103182
+ complimentaryComputers: count13
103129
103183
  });
103130
103184
  var eventsInputDefinition = external_exports.object({ from: external_exports.iso.datetime(), to: external_exports.iso.datetime() }).strict();
103131
103185
  var eventCountsDefinition = external_exports.object({
103132
- total: count12,
103186
+ total: count13,
103133
103187
  /** Per type: how many, and the stored bytes of their payloads and sealed copies. */
103134
103188
  byType: external_exports.array(
103135
103189
  external_exports.object({
103136
103190
  eventType: external_exports.string(),
103137
- count: count12,
103191
+ count: count13,
103138
103192
  payloadBytes: external_exports.number().nonnegative(),
103139
103193
  encryptedCopyBytes: external_exports.number().nonnegative()
103140
103194
  })
@@ -103188,9 +103242,9 @@ var databaseHealthDefinition = external_exports.object({
103188
103242
  deadlocks: external_exports.number().nonnegative(),
103189
103243
  tempBytes: external_exports.number().nonnegative(),
103190
103244
  connections: external_exports.object({
103191
- total: count12,
103192
- byState: external_exports.array(external_exports.object({ state: external_exports.string(), count: count12 })),
103193
- waitingOnLocks: count12,
103245
+ total: count13,
103246
+ byState: external_exports.array(external_exports.object({ state: external_exports.string(), count: count13 })),
103247
+ waitingOnLocks: count13,
103194
103248
  longestActiveSeconds: external_exports.number().nonnegative(),
103195
103249
  longestIdleInTransactionSeconds: external_exports.number().nonnegative()
103196
103250
  }),
@@ -103245,7 +103299,7 @@ var tenantAgentsDefinition = external_exports.object({
103245
103299
  createdAt: external_exports.iso.datetime(),
103246
103300
  modelLevel: external_exports.string().nullable(),
103247
103301
  model: external_exports.string().nullable(),
103248
- channels: count12,
103302
+ channels: count13,
103249
103303
  limitedUntil: external_exports.iso.datetime().nullable(),
103250
103304
  limitedBy: external_exports.string().nullable(),
103251
103305
  pausedAt: external_exports.iso.datetime().nullable(),
@@ -103299,8 +103353,8 @@ var tenantBillingDefinition = external_exports.object({
103299
103353
  currencyChosen: external_exports.boolean(),
103300
103354
  cancelAtPeriodEnd: external_exports.boolean(),
103301
103355
  period: external_exports.object({ start: external_exports.iso.datetime(), end: external_exports.iso.datetime() }).nullable(),
103302
- seats: external_exports.object({ people: count12, limit: count12.nullable(), monthlyPrice: external_exports.number() }),
103303
- complimentarySeats: count12.nullable(),
103356
+ seats: external_exports.object({ people: count13, limit: count13.nullable(), monthlyPrice: external_exports.number() }),
103357
+ complimentarySeats: count13.nullable(),
103304
103358
  credits: external_exports.object({
103305
103359
  included: external_exports.number(),
103306
103360
  includedLeft: external_exports.number(),
@@ -103339,14 +103393,14 @@ var tenantVaultDefinition = external_exports.object({
103339
103393
  external_exports.object({
103340
103394
  subject: external_exports.string(),
103341
103395
  most: external_exports.string(),
103342
- maxLeaseSeconds: count12.nullable(),
103396
+ maxLeaseSeconds: count13.nullable(),
103343
103397
  blocked: external_exports.boolean(),
103344
103398
  approveNew: external_exports.boolean(),
103345
103399
  updatedAt: external_exports.iso.datetime()
103346
103400
  })
103347
103401
  ),
103348
103402
  /** Connections waiting for an admin, counted by kind; never a name, label or field. */
103349
- waitingByKind: external_exports.array(external_exports.object({ key: external_exports.string(), count: count12 }))
103403
+ waitingByKind: external_exports.array(external_exports.object({ key: external_exports.string(), count: count13 }))
103350
103404
  });
103351
103405
  var WHATSAPP_INTAKE_KEY_KINDS = ["msg", "edit", "del", "react", "read"];
103352
103406
  var tenantWhatsappInputDefinition = external_exports.object({
@@ -103359,17 +103413,17 @@ var tenantWhatsappOutputDefinition = external_exports.object({
103359
103413
  intake: external_exports.object({
103360
103414
  since: external_exports.iso.datetime(),
103361
103415
  until: external_exports.iso.datetime(),
103362
- total: count12,
103416
+ total: count13,
103363
103417
  byKind: external_exports.array(
103364
103418
  external_exports.object({
103365
103419
  kind: external_exports.enum([...WHATSAPP_INTAKE_KEY_KINDS, "other"]),
103366
- count: count12,
103420
+ count: count13,
103367
103421
  /** Events dated over a second after Laze got them, and the most ahead: a fast clock. */
103368
- aheadOfLaze: external_exports.object({ count: count12, maxAheadMs: external_exports.number().int() }).optional()
103422
+ aheadOfLaze: external_exports.object({ count: count13, maxAheadMs: external_exports.number().int() }).optional()
103369
103423
  })
103370
103424
  ),
103371
103425
  /** The workspace's chat messages and changes dated over a second after Laze stored them. */
103372
- chatAheadOfLaze: external_exports.object({ count: count12, maxAheadMs: external_exports.number().int() }).optional()
103426
+ chatAheadOfLaze: external_exports.object({ count: count13, maxAheadMs: external_exports.number().int() }).optional()
103373
103427
  })
103374
103428
  });
103375
103429
  var computerBrowserInputDefinition = external_exports.object({
@@ -103489,6 +103543,26 @@ var vaultAsksInputDefinition = external_exports.object({
103489
103543
  cursor: cursorDefinition.optional()
103490
103544
  }).strict();
103491
103545
  var vaultAsksOutputDefinition = external_exports.object({ asks: pageOf(vaultOpsAskSchema) });
103546
+ var variableReferenceKeysInputDefinition = external_exports.object({
103547
+ limit: external_exports.number().int().min(1).max(500).default(100),
103548
+ cursor: cursorDefinition.optional()
103549
+ }).strict();
103550
+ var variableReferenceKeysOutputDefinition = external_exports.object({
103551
+ keys: pageOf(
103552
+ external_exports.object({
103553
+ ...vaultOpsReferenceKeySchema.omit({ name: true }).shape,
103554
+ /** Messages since the key was made naming it in its owner's conversations; null: no owner. */
103555
+ messageCount: external_exports.number().int().nonnegative().nullable(),
103556
+ /** The count reached the cap, so there are at least that many. */
103557
+ messageCountCapped: external_exports.boolean()
103558
+ })
103559
+ ),
103560
+ scanned: external_exports.number().int().nonnegative(),
103561
+ opened: external_exports.number().int().nonnegative(),
103562
+ deviceOnlyCount: external_exports.number().int().nonnegative(),
103563
+ failed: external_exports.number().int().nonnegative(),
103564
+ stopped: external_exports.boolean()
103565
+ });
103492
103566
  var vaultConnectionsInputDefinition = external_exports.object({
103493
103567
  from: external_exports.iso.datetime(),
103494
103568
  to: external_exports.iso.datetime(),
@@ -103739,6 +103813,13 @@ var OPS_FUNCTIONS = {
103739
103813
  input: judgeMeasureInputDefinition,
103740
103814
  output: judgeMeasureOutputDefinition
103741
103815
  }),
103816
+ "vault.variable_reference_keys": entry({
103817
+ title: "Pasted keys whose value is a shell variable reference, with how many messages name them",
103818
+ scope: "platform",
103819
+ view: "table",
103820
+ input: variableReferenceKeysInputDefinition,
103821
+ output: variableReferenceKeysOutputDefinition
103822
+ }),
103742
103823
  "traces.browser_errors": entry({
103743
103824
  title: "Browser errors over a range: message, frames, route, release and session",
103744
103825
  scope: "platform",
@@ -104400,13 +104481,13 @@ var USAGE18 = `Usage:
104400
104481
  With a person's key, list without --agent shows every agent's skills.`;
104401
104482
  async function folderFiles({ root }) {
104402
104483
  const entries = await readdir8(root, { recursive: true, withFileTypes: true });
104403
- const files2 = [];
104484
+ const files3 = [];
104404
104485
  for (const entry2 of entries) {
104405
104486
  if (!entry2.isFile()) continue;
104406
104487
  const full = join36(entry2.parentPath, entry2.name);
104407
- files2.push({ path: relative5(root, full), content: await readFile33(full, "utf8") });
104488
+ files3.push({ path: relative5(root, full), content: await readFile33(full, "utf8") });
104408
104489
  }
104409
- return files2.toSorted((a, b) => a.path.localeCompare(b.path));
104490
+ return files3.toSorted((a, b) => a.path.localeCompare(b.path));
104410
104491
  }
104411
104492
  function pinNote(skill2) {
104412
104493
  if (skill2.updateAvailable) return " (pinned, a newer version is available)";
@@ -104435,12 +104516,12 @@ async function skillInstall({ context, args }) {
104435
104516
  if (!catalogueId === !from) throw new CliUsageError(USAGE18);
104436
104517
  const name3 = flagText({ args, name: "as" });
104437
104518
  const agent3 = flagText({ args, name: "agent" });
104438
- const files2 = from ? await folderFiles({ root: resolve22(context.cwd, from) }) : void 0;
104519
+ const files3 = from ? await folderFiles({ root: resolve22(context.cwd, from) }) : void 0;
104439
104520
  const { client } = await signedIn({ context, args });
104440
104521
  const installed = await client.post("/api/skills/install", {
104441
104522
  ...catalogueId ? { catalogueId } : {},
104442
104523
  ...name3 ? { name: name3 } : {},
104443
- ...files2 ? { files: files2 } : {},
104524
+ ...files3 ? { files: files3 } : {},
104444
104525
  ...agent3 ? { agentId: agent3 } : {}
104445
104526
  });
104446
104527
  if (args.flags.json) return context.out(`${JSON.stringify(installed, null, 2)}
@@ -104469,12 +104550,12 @@ ${skillMd.content}`);
104469
104550
  }
104470
104551
  async function skillPull({ context, args }) {
104471
104552
  const { client } = await signedIn({ context, args });
104472
- const files2 = await client.get("/api/skills/files");
104473
- const root = await writeMount({ context, args, folder: "skills", files: files2 });
104553
+ const files3 = await client.get("/api/skills/files");
104554
+ const root = await writeMount({ context, args, folder: "skills", files: files3 });
104474
104555
  if (args.flags.json)
104475
- return context.out(`${JSON.stringify({ root, files: files2.map((f) => f.path) })}
104556
+ return context.out(`${JSON.stringify({ root, files: files3.map((f) => f.path) })}
104476
104557
  `);
104477
- context.out(`${files2.length} files in ${root}
104558
+ context.out(`${files3.length} files in ${root}
104478
104559
  `);
104479
104560
  }
104480
104561
  function agentFlag(args) {
@@ -104628,9 +104709,9 @@ function authorizeRun2(path, label3, body) {
104628
104709
  };
104629
104710
  }
104630
104711
  function printConnection4({ context, row }) {
104631
- const link2 = row.viewerLinkState ?? "not linked";
104712
+ const link3 = row.viewerLinkState ?? "not linked";
104632
104713
  context.out(
104633
- `${row.teamId} ${row.label ?? row.teamName} ${row.status} ${row.mirrors.length} mirrored ${row.linkedPeople} linked you: ${link2}
104714
+ `${row.teamId} ${row.label ?? row.teamName} ${row.status} ${row.mirrors.length} mirrored ${row.linkedPeople} linked you: ${link3}
104634
104715
  `
104635
104716
  );
104636
104717
  }
@@ -106083,7 +106164,7 @@ async function vaultSave({ context, args }) {
106083
106164
  // src/services/vault-scrub-commands.service.ts
106084
106165
  function lineOf6(channel) {
106085
106166
  const where = channel.name ? `#${channel.name}` : channel.channelId;
106086
- const found = Object.entries(channel.found).map(([vendor, count13]) => `${vendor} ${count13}`).join(", ");
106167
+ const found = Object.entries(channel.found).map(([vendor, count14]) => `${vendor} ${count14}`).join(", ");
106087
106168
  const kinds = [`held ${channel.held}`, ...found ? [`found: ${found}`] : []].join("; ");
106088
106169
  return `${where} scanned ${channel.scanned} changed ${channel.messages} ${kinds}
106089
106170
  `;
@@ -106842,7 +106923,7 @@ var USAGE20 = [
106842
106923
  " laze whatsapp read [<machine>] <chat> [--limit <n>] a chat's last messages, oldest first",
106843
106924
  " (a read your owner set to Always ask waits for their answer; --request <id> picks it up later)",
106844
106925
  " laze whatsapp file [<machine>] <chat> <message-id> [--out <path>] save a message's photo, voice message or file",
106845
- ' laze whatsapp send <machine> <chat> "<text>"|- send as the owner (- reads stdin); an agent waits for their approval',
106926
+ ' laze whatsapp send [<machine>] <chat> "<text>"|- send as the owner (- reads stdin); an agent waits for their approval',
106846
106927
  " laze whatsapp status <send-id> where a send stands",
106847
106928
  " laze whatsapp sync [<machine>] check WhatsApp now (the owner only)",
106848
106929
  WHATSAPP_PAIRING_USAGE,
@@ -106979,12 +107060,17 @@ Still waiting. Run \`laze whatsapp status ${send5.id}\` later to see the answer.
106979
107060
  return send5.state === "sent" || !SETTLED.has(send5.state) ? 0 : 1;
106980
107061
  }
106981
107062
  async function send4({ context, args }) {
106982
- const text3 = args.words.length > 4 ? await textOf({ context, args, from: 4 }) : args.rest.join(" ").trim();
107063
+ const after = args.words.length - 2;
107064
+ const fewest = args.rest.length > 0 ? 1 : 2;
107065
+ if (after < fewest) throw new CliUsageError(USAGE20);
107066
+ const named = after > fewest;
107067
+ const textAt = named ? 4 : 3;
107068
+ const text3 = args.rest.length > 0 && args.words.length <= textAt ? args.rest.join(" ").trim() : await textOf({ context, args, from: textAt });
106983
107069
  if (!text3) throw new CliUsageError(USAGE20);
106984
107070
  const client = await computeClient({ context, args });
106985
107071
  const asked = await client.post(PATHS3.send, {
106986
- machine: word2({ args, at: 2 }),
106987
- chat: word2({ args, at: 3 }),
107072
+ ...named ? { machine: word2({ args, at: 2 }) } : {},
107073
+ chat: word2({ args, at: named ? 3 : 2 }),
106988
107074
  text: text3
106989
107075
  });
106990
107076
  if (!SETTLED.has(asked.state) && !args.flags.json) context.err(`${asked.outcome}
@@ -107023,24 +107109,209 @@ async function whatsapp({
107023
107109
  throw new CliUsageError(USAGE20);
107024
107110
  }
107025
107111
 
107112
+ // src/services/wiki-comment-commands.service.ts
107113
+ var WIKI_COMMENT_USAGE = ` laze wiki comments <path> [--open] the page's comment threads, with their ids
107114
+ laze wiki comment <path> --quote <text> <comment|->
107115
+ starts a thread on text the page holds; @Name tells a person or agent who can read it
107116
+ laze wiki comment reply <thread-id> <text|->
107117
+ laze wiki comment resolve <thread-id> [--reopen]
107118
+ laze wiki comment delete <comment-id> your own comment; the first one takes its thread`;
107119
+ function commentText({ context, value }) {
107120
+ return value === "-" ? textArgument({ context, value }) : Promise.resolve(value);
107121
+ }
107122
+ function threadText(thread2) {
107123
+ const open8 = thread2.detached ? "open, its text is no longer on the page" : "open";
107124
+ const state = thread2.resolved ? `resolved by ${thread2.resolved.by.name}` : open8;
107125
+ const lines2 = [`Thread ${thread2.id} (${state})`, ` > ${thread2.quote}`];
107126
+ for (const comment of thread2.comments)
107127
+ lines2.push(
107128
+ ` ${comment.author.name}: ${comment.body.replace(/\n/g, "\n ")} [${comment.id}]`
107129
+ );
107130
+ return `${lines2.join("\n")}
107131
+ `;
107132
+ }
107133
+ function postedText(posted) {
107134
+ const told = posted.notTold.length === 0 ? "" : `Not told, as they cannot see the page: ${posted.notTold.join(", ")}
107135
+ `;
107136
+ return `${threadText(posted.thread)}${told}`;
107137
+ }
107138
+ var comments = async ({ context, args, usage: usage2 }) => {
107139
+ const path = args.words[2];
107140
+ if (!path) throw new CliUsageError(usage2);
107141
+ const { client } = await signedIn({ context, args });
107142
+ const query = args.flags.open ? "&open=true" : "";
107143
+ const threads2 = await client.get(
107144
+ `/api/wiki/comments?path=${encodeURIComponent(path)}${query}`
107145
+ );
107146
+ if (args.flags.json) return context.out(`${JSON.stringify(threads2, null, 2)}
107147
+ `);
107148
+ if (threads2.threads.length === 0) return context.out(`No comments on ${path}
107149
+ `);
107150
+ context.out(`${threads2.open} open on ${path}
107151
+
107152
+ ${threads2.threads.map(threadText).join("\n")}`);
107153
+ };
107154
+ var startThread = async ({ context, args, usage: usage2 }) => {
107155
+ const path = args.words[2];
107156
+ const quote4 = flagText({ args, name: "quote" });
107157
+ const value = args.words.slice(3).join(" ");
107158
+ if (!path || !quote4 || !value) throw new CliUsageError(usage2);
107159
+ const body = await commentText({ context, value });
107160
+ const { client } = await signedIn({ context, args });
107161
+ const posted = await client.post("/api/wiki/comment", { path, quote: quote4, body });
107162
+ if (args.flags.json) return context.out(`${JSON.stringify(posted, null, 2)}
107163
+ `);
107164
+ context.out(postedText(posted));
107165
+ };
107166
+ var reply2 = async ({ context, args, usage: usage2 }) => {
107167
+ const threadId = args.words[3];
107168
+ const value = args.words.slice(4).join(" ");
107169
+ if (!threadId || !value) throw new CliUsageError(usage2);
107170
+ const body = await commentText({ context, value });
107171
+ const { client } = await signedIn({ context, args });
107172
+ const posted = await client.post("/api/wiki/comment/reply", {
107173
+ threadId,
107174
+ body
107175
+ });
107176
+ if (args.flags.json) return context.out(`${JSON.stringify(posted, null, 2)}
107177
+ `);
107178
+ context.out(postedText(posted));
107179
+ };
107180
+ var resolve27 = async ({ context, args, usage: usage2 }) => {
107181
+ const threadId = args.words[3];
107182
+ if (!threadId) throw new CliUsageError(usage2);
107183
+ const { client } = await signedIn({ context, args });
107184
+ const thread2 = await client.post("/api/wiki/comment/resolve", {
107185
+ threadId,
107186
+ resolved: !args.flags.reopen
107187
+ });
107188
+ if (args.flags.json) return context.out(`${JSON.stringify(thread2, null, 2)}
107189
+ `);
107190
+ context.out(threadText(thread2));
107191
+ };
107192
+ var remove9 = async ({ context, args, usage: usage2 }) => {
107193
+ const commentId = args.words[3];
107194
+ if (!commentId) throw new CliUsageError(usage2);
107195
+ const { client } = await signedIn({ context, args });
107196
+ const left = await client.post("/api/wiki/comment/delete", { commentId });
107197
+ if (args.flags.json) return context.out(`${JSON.stringify(left, null, 2)}
107198
+ `);
107199
+ context.out(`Deleted ${commentId}; ${left.open} open on ${left.path}
107200
+ `);
107201
+ };
107202
+ var ACTIONS2 = { reply: reply2, resolve: resolve27, delete: remove9 };
107203
+ async function wikiComment({
107204
+ context,
107205
+ args,
107206
+ usage: usage2
107207
+ }) {
107208
+ if (args.words[1] === "comments") return comments({ context, args, usage: usage2 });
107209
+ const action = Object.hasOwn(ACTIONS2, args.words[2] ?? "") ? ACTIONS2[args.words[2] ?? ""] : null;
107210
+ if (action && !flagText({ args, name: "quote" })) return action({ context, args, usage: usage2 });
107211
+ return startThread({ context, args, usage: usage2 });
107212
+ }
107213
+
107214
+ // src/services/wiki-file-commands.service.ts
107215
+ import { readFile as readFile38 } from "node:fs/promises";
107216
+ import { basename as basename13, resolve as resolve28 } from "node:path";
107217
+ var WIKI_FILE_USAGE = ` laze wiki attach <path> <file> [--name <name>] [--type <mime>]
107218
+ uploads a file to the page (up to 25 MB) and prints the markdown that embeds it
107219
+ laze wiki files <path> the page's files, with their addresses
107220
+ laze wiki file <file-id> a short-lived link to a file's bytes`;
107221
+ function wikiFileMarkdown(file4) {
107222
+ const label3 = file4.name.replace(/[[\]]/g, "");
107223
+ return `${file4.contentType.startsWith("image/") ? "!" : ""}[${label3}](${file4.url})`;
107224
+ }
107225
+ var attach = async ({ context, args, usage: usage2 }) => {
107226
+ const path = args.words[2];
107227
+ const local2 = args.words[3];
107228
+ if (!path || !local2) throw new CliUsageError(usage2);
107229
+ const file4 = resolve28(context.cwd, local2);
107230
+ const bytes = new Uint8Array(await readFile38(file4));
107231
+ const asked = flagText({ args, name: "name" });
107232
+ const fileName = readableUploadName({ name: basename13(file4), ...asked && { asked } });
107233
+ const contentType = flagText({ args, name: "type", fallback: contentTypeOf(file4) });
107234
+ const { client } = await signedIn({ context, args });
107235
+ const ticket = await client.post("/api/wiki/attach", {
107236
+ path,
107237
+ fileName,
107238
+ contentType,
107239
+ sizeBytes: bytes.byteLength
107240
+ });
107241
+ const parts = await sendParts({ context, ticket: ticket.upload, bytes });
107242
+ const done = await client.post("/api/wiki/attach/done", {
107243
+ path,
107244
+ fileId: ticket.file.id,
107245
+ parts
107246
+ });
107247
+ if (args.flags.json) return context.out(`${JSON.stringify(done, null, 2)}
107248
+ `);
107249
+ context.out(`${wikiFileMarkdown(done)}
107250
+ `);
107251
+ };
107252
+ var files2 = async ({ context, args, usage: usage2 }) => {
107253
+ const path = args.words[2];
107254
+ if (!path) throw new CliUsageError(usage2);
107255
+ const { client } = await signedIn({ context, args });
107256
+ const listed = await client.get(`/api/wiki/files?path=${encodeURIComponent(path)}`);
107257
+ if (args.flags.json) return context.out(`${JSON.stringify(listed, null, 2)}
107258
+ `);
107259
+ if (listed.files.length === 0) return context.out(`No files on ${path}
107260
+ `);
107261
+ for (const one of listed.files)
107262
+ context.out(`${one.id} ${one.name} ${one.contentType} ${one.sizeBytes} ${one.url}
107263
+ `);
107264
+ };
107265
+ var link = async ({ context, args, usage: usage2 }) => {
107266
+ const fileId = args.words[2];
107267
+ if (!fileId) throw new CliUsageError(usage2);
107268
+ const { client } = await signedIn({ context, args });
107269
+ const answer6 = await client.get(
107270
+ `/api/wiki/file-link?fileId=${encodeURIComponent(fileId)}`
107271
+ );
107272
+ if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
107273
+ `);
107274
+ context.out(`${answer6.url}
107275
+ `);
107276
+ };
107277
+ var WIKI_FILE_COMMANDS = {
107278
+ attach,
107279
+ files: files2,
107280
+ file: link
107281
+ };
107282
+
107026
107283
  // src/services/wiki-commands.service.ts
107027
107284
  var USAGE21 = `Usage:
107028
- laze wiki list
107285
+ laze wiki list [--type <type>] every page, or only those whose header says type: <type>
107029
107286
  laze wiki get <path>
107030
107287
  laze wiki put <path> <markdown|@file|-> [--title <title>] [--channel <channel>] [--base <version>]
107031
107288
  laze wiki search <words>
107032
107289
  laze wiki history <path>
107033
107290
  laze wiki mv <path> <new-path> pages under <path> move with it
107034
107291
  laze wiki rm <path> the page and its history; pages under it stay
107292
+ laze wiki share <path> who sees a page or folder, and what they can do
107293
+ [--visibility restricted|channel|internal|public] [--role view|edit] [--channel <channel>]
107294
+ [--grant <who>[:view|edit]]... [--revoke <who>]... [--reset]
107295
+ <who> is #channel, @group, an email, or a person's or agent's name. --reset takes the
107296
+ folder's sharing again. Agents can only narrow sharing.
107297
+ laze wiki pin <path> --channel <channel> [--role view|edit | --view-only]
107298
+ shows the page or folder as a tab of the conversation; its members get edit, or view
107299
+ laze wiki unpin <path> --channel <channel> the access the pin gave goes with it
107300
+ laze wiki pins --channel <channel> the pages and folders pinned there
107301
+ ${WIKI_COMMENT_USAGE}
107302
+ ${WIKI_FILE_USAGE}
107035
107303
 
107036
107304
  Paths are lower-case segments such as handbook/onboarding; link pages with [[path]].`;
107037
107305
  async function wikiList({ context, args }) {
107038
107306
  const { client, profile } = await signedIn({ context, args });
107039
- const listing = await client.get("/api/wiki/pages");
107307
+ const type = flagText({ args, name: "type" });
107308
+ const listing = await client.get(
107309
+ type ? `/api/wiki/pages?type=${encodeURIComponent(type)}` : "/api/wiki/pages"
107310
+ );
107040
107311
  if (args.flags.json) return context.out(`${JSON.stringify(listing, null, 2)}
107041
107312
  `);
107042
107313
  for (const page of listing.pages) {
107043
- const text3 = `${page.path} ${page.title}`;
107314
+ const text3 = [page.path, page.title, ...page.type ? [page.type] : []].join(" ");
107044
107315
  context.out(`${withLink({ text: text3, url: page.url, base: profile.url })}
107045
107316
  `);
107046
107317
  }
@@ -107060,7 +107331,7 @@ ${page.body}
107060
107331
  );
107061
107332
  if (page.backlinks.length > 0)
107062
107333
  context.out(`
107063
- Linked from: ${page.backlinks.map((link2) => link2.path).join(", ")}
107334
+ Linked from: ${page.backlinks.map((link3) => link3.path).join(", ")}
107064
107335
  `);
107065
107336
  }
107066
107337
  async function wikiPut({ context, args }) {
@@ -107133,6 +107404,102 @@ async function wikiRemove({ context, args }) {
107133
107404
  context.out(`Removed ${path}
107134
107405
  `);
107135
107406
  }
107407
+ var VISIBILITY_WORDS = {
107408
+ restricted: "Restricted: only the people it is shared with",
107409
+ channel: "Members of the channel",
107410
+ internal: "Everyone in the workspace",
107411
+ public: "Anyone with the link"
107412
+ };
107413
+ function sharingLines(sharing) {
107414
+ const general = sharing.visibility === "channel" && sharing.channel ? `Members of #${sharing.channel.name ?? sharing.channel.id}` : VISIBILITY_WORDS[sharing.visibility];
107415
+ const role2 = sharing.visibility === "restricted" ? "" : `, can ${sharing.memberRole}`;
107416
+ const from = sharing.source === "inherited" ? ` (from ${sharing.from})` : "";
107417
+ const lines2 = [sharing.path, `General access: ${general}${role2}${from}`];
107418
+ if (sharing.publicUrl ?? sharing.publicToken)
107419
+ lines2.push(`Public link: ${sharing.publicUrl ?? `/wiki/p/${sharing.publicToken}`}`);
107420
+ for (const grant of sharing.grants)
107421
+ lines2.push(` ${grant.name ?? `${grant.subject.type} ${grant.subject.id}`} can ${grant.role}`);
107422
+ if (sharing.ownBelow > 0) lines2.push(`${sharing.ownBelow} pages under it keep their own sharing`);
107423
+ lines2.push(`You can ${sharing.role}`);
107424
+ return `${lines2.join("\n")}
107425
+ `;
107426
+ }
107427
+ function grantOf(value) {
107428
+ const match = /^(.*):(view|edit)$/.exec(value);
107429
+ return match ? { who: match[1] ?? value, role: match[2] } : { who: value, role: "view" };
107430
+ }
107431
+ async function wikiShare({ context, args }) {
107432
+ const path = args.words[2];
107433
+ if (!path) throw new CliUsageError(USAGE21);
107434
+ const { client } = await signedIn({ context, args });
107435
+ const visibility = flagText({ args, name: "visibility" });
107436
+ const memberRole = flagText({ args, name: "role" });
107437
+ const channel = flagText({ args, name: "channel" });
107438
+ let sharing = null;
107439
+ if (args.flags.reset)
107440
+ sharing = await client.post("/api/wiki/sharing/reset", { path });
107441
+ if (visibility || memberRole || channel) {
107442
+ sharing = await client.post("/api/wiki/sharing", {
107443
+ path,
107444
+ ...visibility ? { visibility } : {},
107445
+ ...memberRole ? { memberRole } : {},
107446
+ ...channel ? { channel } : {}
107447
+ });
107448
+ }
107449
+ for (const value of args.lists.grant ?? [])
107450
+ sharing = await client.post("/api/wiki/sharing/grant", {
107451
+ path,
107452
+ ...grantOf(value)
107453
+ });
107454
+ for (const who of args.lists.revoke ?? [])
107455
+ sharing = await client.post("/api/wiki/sharing/revoke", { path, who });
107456
+ sharing ??= await client.get(`/api/wiki/sharing?path=${encodeURIComponent(path)}`);
107457
+ if (args.flags.json) return context.out(`${JSON.stringify(sharing, null, 2)}
107458
+ `);
107459
+ context.out(sharingLines(sharing));
107460
+ }
107461
+ function channelOf3(args) {
107462
+ const channel = flagText({ args, name: "channel" });
107463
+ if (!channel) throw new CliUsageError(USAGE21);
107464
+ return channel;
107465
+ }
107466
+ async function wikiPin({ context, args }) {
107467
+ const path = args.words[2];
107468
+ if (!path) throw new CliUsageError(USAGE21);
107469
+ const channel = channelOf3(args);
107470
+ const role2 = args.flags["view-only"] ? "view" : flagText({ args, name: "role" }) || "edit";
107471
+ const { client } = await signedIn({ context, args });
107472
+ const sharing = await client.post("/api/wiki/pin", { path, channel, role: role2 });
107473
+ if (args.flags.json) return context.out(`${JSON.stringify(sharing, null, 2)}
107474
+ `);
107475
+ context.out(`Pinned ${path} to ${channel}, members can ${role2}
107476
+ `);
107477
+ }
107478
+ async function wikiUnpin({ context, args }) {
107479
+ const path = args.words[2];
107480
+ if (!path) throw new CliUsageError(USAGE21);
107481
+ const channel = channelOf3(args);
107482
+ const { client } = await signedIn({ context, args });
107483
+ const sharing = await client.post("/api/wiki/unpin", { path, channel });
107484
+ if (args.flags.json) return context.out(`${JSON.stringify(sharing, null, 2)}
107485
+ `);
107486
+ context.out(`Unpinned ${path} from ${channel}
107487
+ `);
107488
+ }
107489
+ async function wikiPins({ context, args }) {
107490
+ const channel = channelOf3(args);
107491
+ const { client } = await signedIn({ context, args });
107492
+ const pins2 = await client.get(
107493
+ `/api/wiki/pins?channel=${encodeURIComponent(channel)}`
107494
+ );
107495
+ if (args.flags.json) return context.out(`${JSON.stringify(pins2, null, 2)}
107496
+ `);
107497
+ if (pins2.pins.length === 0) return context.out(`No wiki pages pinned to ${channel}
107498
+ `);
107499
+ for (const pin of pins2.pins)
107500
+ context.out(`${pin.path} ${pin.title}${pin.folder ? " (folder)" : ""} can ${pin.role}
107501
+ `);
107502
+ }
107136
107503
  var WIKI_COMMANDS = {
107137
107504
  list: wikiList,
107138
107505
  get: wikiGet,
@@ -107140,7 +107507,19 @@ var WIKI_COMMANDS = {
107140
107507
  search: wikiSearch,
107141
107508
  history: wikiHistory,
107142
107509
  mv: wikiMove,
107143
- rm: wikiRemove
107510
+ rm: wikiRemove,
107511
+ share: wikiShare,
107512
+ pin: wikiPin,
107513
+ unpin: wikiUnpin,
107514
+ pins: wikiPins,
107515
+ comments: (input2) => wikiComment({ ...input2, usage: USAGE21 }),
107516
+ comment: (input2) => wikiComment({ ...input2, usage: USAGE21 }),
107517
+ ...Object.fromEntries(
107518
+ Object.entries(WIKI_FILE_COMMANDS).map(([name3, run4]) => [
107519
+ name3,
107520
+ (input2) => run4({ ...input2, usage: USAGE21 })
107521
+ ])
107522
+ )
107144
107523
  };
107145
107524
  async function wiki({ context, args }) {
107146
107525
  const name3 = args.words[1] ?? "";
@@ -107160,8 +107539,8 @@ async function roles({ context, args }) {
107160
107539
  const catalogue = await client.get("/api/roles");
107161
107540
  if (args.flags.json) return printJson11(context, catalogue);
107162
107541
  for (const role2 of catalogue) {
107163
- const count13 = `${role2.permissions.length} permissions`;
107164
- context.out(`${role2.label} ${count13} ${role2.description}
107542
+ const count14 = `${role2.permissions.length} permissions`;
107543
+ context.out(`${role2.label} ${count14} ${role2.description}
107165
107544
  `);
107166
107545
  context.out(` ${role2.permissions.join(", ")}
107167
107546
  `);
@@ -107359,7 +107738,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
107359
107738
  laze schedule add|update ... --check <script> a script decides each firing, without a model
107360
107739
  laze schedule list|update|pause|resume|rm|runs your agent's schedules and their runs
107361
107740
  laze memory get|set|append|history <file>, search, pull SOUL.md, AGENTS.md, a channel's MEMORY.md
107362
- laze wiki list|get|put|search|history|mv|rm the workspace wiki
107741
+ laze wiki list|get|put|search|history|mv|rm|share the workspace wiki
107363
107742
  laze skill list|install|show|pull|rm|update|pin|unpin your agent's skills and the catalogue
107364
107743
  laze app create <name> ... build an app from scratch (--template slides for a deck), push, revert
107365
107744
  apps are also called artifacts: asked for an artifact, page, dashboard, deck or mock, build a Laze app
@@ -107809,15 +108188,15 @@ import {
107809
108188
  randomBytes as randomBytes6,
107810
108189
  sign
107811
108190
  } from "node:crypto";
107812
- import { chmod, link, mkdir as mkdir13, readFile as readFile38, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
108191
+ import { chmod, link as link2, mkdir as mkdir13, readFile as readFile39, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
107813
108192
  import { dirname as dirname27, join as join38 } from "node:path";
107814
108193
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
107815
- var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve27, reject) => {
108194
+ var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve29, reject) => {
107816
108195
  const child = execFile2(
107817
108196
  program,
107818
108197
  [...args],
107819
108198
  { timeout: timeoutMs },
107820
- (error63, stdout2) => error63 ? reject(error63) : resolve27(String(stdout2))
108199
+ (error63, stdout2) => error63 ? reject(error63) : resolve29(String(stdout2))
107821
108200
  );
107822
108201
  if (stdin2 !== void 0) child.stdin?.end(stdin2);
107823
108202
  });
@@ -107882,7 +108261,7 @@ var MachineKeyStore = class _MachineKeyStore {
107882
108261
  async read() {
107883
108262
  let meta3;
107884
108263
  try {
107885
- meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile38(this.metaPath, "utf8")));
108264
+ meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile39(this.metaPath, "utf8")));
107886
108265
  } catch {
107887
108266
  return null;
107888
108267
  }
@@ -107897,7 +108276,7 @@ var MachineKeyStore = class _MachineKeyStore {
107897
108276
  "-w"
107898
108277
  ],
107899
108278
  timeoutMs: 1e4
107900
- }) : await readFile38(this.pemPathOf(meta3.jwk), "utf8");
108279
+ }) : await readFile39(this.pemPathOf(meta3.jwk), "utf8");
107901
108280
  return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
107902
108281
  }
107903
108282
  async make() {
@@ -107971,7 +108350,7 @@ async function writeOnce({ path, text: text3 }) {
107971
108350
  const temporary = `${path}.${process.pid}.${randomBytes6(6).toString("hex")}.tmp`;
107972
108351
  await writePrivate({ path: temporary, text: text3 });
107973
108352
  try {
107974
- await link(temporary, path);
108353
+ await link2(temporary, path);
107975
108354
  return true;
107976
108355
  } catch (error63) {
107977
108356
  if (error63.code === "EEXIST") return false;
@@ -108039,7 +108418,7 @@ function machineProofFetch({
108039
108418
  // src/services/processes.service.ts
108040
108419
  import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
108041
108420
  import { closeSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
108042
- import { readFile as readFile39, readlink } from "node:fs/promises";
108421
+ import { readFile as readFile40, readlink } from "node:fs/promises";
108043
108422
  import { dirname as dirname28 } from "node:path";
108044
108423
  import { promisify as promisify2 } from "node:util";
108045
108424
  var run3 = promisify2(execFile3);
@@ -108053,14 +108432,14 @@ function alive(pid) {
108053
108432
  }
108054
108433
  }
108055
108434
  async function argsOf2(pid) {
108056
- const raw = await readFile39(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
108435
+ const raw = await readFile40(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
108057
108436
  if (raw) return raw.split("\0").filter(Boolean);
108058
108437
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
108059
108438
  const line = listed?.stdout.trim();
108060
108439
  return line ? line.split(/\s+/) : void 0;
108061
108440
  }
108062
108441
  async function parentOf(pid) {
108063
- const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
108442
+ const stat13 = await readFile40(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
108064
108443
  const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
108065
108444
  if (fromStat > 0) return fromStat;
108066
108445
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
@@ -108068,7 +108447,7 @@ async function parentOf(pid) {
108068
108447
  return parent > 0 ? parent : void 0;
108069
108448
  }
108070
108449
  async function startOf(pid) {
108071
- const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
108450
+ const stat13 = await readFile40(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
108072
108451
  const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
108073
108452
  if (ticks) return ticks;
108074
108453
  const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);
@@ -108212,15 +108591,15 @@ function terminalAsk() {
108212
108591
  };
108213
108592
  }
108214
108593
  function sleep(ms2, signal) {
108215
- return new Promise((resolve27) => {
108216
- if (signal?.aborted) return resolve27();
108594
+ return new Promise((resolve29) => {
108595
+ if (signal?.aborted) return resolve29();
108217
108596
  const stop3 = () => {
108218
108597
  clearTimeout(timer);
108219
- resolve27();
108598
+ resolve29();
108220
108599
  };
108221
108600
  const timer = setTimeout(() => {
108222
108601
  signal?.removeEventListener("abort", stop3);
108223
- resolve27();
108602
+ resolve29();
108224
108603
  }, ms2);
108225
108604
  signal?.addEventListener("abort", stop3, { once: true });
108226
108605
  });