@lazehq/cli 0.1.78 → 0.1.79

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 +2018 -358
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -3224,7 +3224,7 @@ var require_websocket = __commonJS({
3224
3224
  var http = __require("http");
3225
3225
  var net = __require("net");
3226
3226
  var tls = __require("tls");
3227
- var { randomBytes: randomBytes4, createHash: createHash6 } = __require("crypto");
3227
+ var { randomBytes: randomBytes5, createHash: createHash7 } = __require("crypto");
3228
3228
  var { Duplex, Readable } = __require("stream");
3229
3229
  var { URL: URL3 } = __require("url");
3230
3230
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -3762,7 +3762,7 @@ var require_websocket = __commonJS({
3762
3762
  }
3763
3763
  }
3764
3764
  const defaultPort = isSecure ? 443 : 80;
3765
- const key = randomBytes4(16).toString("base64");
3765
+ const key = randomBytes5(16).toString("base64");
3766
3766
  const request2 = isSecure ? https.request : http.request;
3767
3767
  const protocolSet = /* @__PURE__ */ new Set();
3768
3768
  let perMessageDeflate;
@@ -3892,7 +3892,7 @@ var require_websocket = __commonJS({
3892
3892
  abortHandshake(websocket, socket, "Invalid Upgrade header");
3893
3893
  return;
3894
3894
  }
3895
- const digest = createHash6("sha1").update(key + GUID).digest("base64");
3895
+ const digest = createHash7("sha1").update(key + GUID).digest("base64");
3896
3896
  if (res.headers["sec-websocket-accept"] !== digest) {
3897
3897
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
3898
3898
  return;
@@ -4005,16 +4005,16 @@ var require_websocket = __commonJS({
4005
4005
  process.nextTick(cb, err);
4006
4006
  }
4007
4007
  }
4008
- function receiverOnConclude(code, reason) {
4008
+ function receiverOnConclude(code, reason2) {
4009
4009
  const websocket = this[kWebSocket];
4010
4010
  websocket._closeFrameReceived = true;
4011
- websocket._closeMessage = reason;
4011
+ websocket._closeMessage = reason2;
4012
4012
  websocket._closeCode = code;
4013
4013
  if (websocket._socket[kWebSocket] === void 0) return;
4014
4014
  websocket._socket.removeListener("data", socketOnData);
4015
4015
  process.nextTick(resume, websocket._socket);
4016
4016
  if (code === 1005) websocket.close();
4017
- else websocket.close(code, reason);
4017
+ else websocket.close(code, reason2);
4018
4018
  }
4019
4019
  function receiverOnDrain() {
4020
4020
  const websocket = this[kWebSocket];
@@ -4261,7 +4261,7 @@ var require_websocket_server = __commonJS({
4261
4261
  var EventEmitter = __require("events");
4262
4262
  var http = __require("http");
4263
4263
  var { Duplex } = __require("stream");
4264
- var { createHash: createHash6 } = __require("crypto");
4264
+ var { createHash: createHash7 } = __require("crypto");
4265
4265
  var extension2 = require_extension();
4266
4266
  var PerMessageDeflate2 = require_permessage_deflate();
4267
4267
  var subprotocol2 = require_subprotocol();
@@ -4568,7 +4568,7 @@ var require_websocket_server = __commonJS({
4568
4568
  );
4569
4569
  }
4570
4570
  if (this._state > RUNNING) return abortHandshake(socket, 503);
4571
- const digest = createHash6("sha1").update(key + GUID).digest("base64");
4571
+ const digest = createHash7("sha1").update(key + GUID).digest("base64");
4572
4572
  const headers = [
4573
4573
  "HTTP/1.1 101 Switching Protocols",
4574
4574
  "Upgrade: websocket",
@@ -6722,12 +6722,12 @@ var require_diagnostics = __commonJS({
6722
6722
  diagnosticsChannel.subscribe(
6723
6723
  "undici:websocket:close",
6724
6724
  (evt) => {
6725
- const { websocket, code, reason } = evt;
6725
+ const { websocket, code, reason: reason2 } = evt;
6726
6726
  debugLog(
6727
6727
  "closed connection to %s - %s %s",
6728
6728
  websocket.url,
6729
6729
  code,
6730
- reason
6730
+ reason2
6731
6731
  );
6732
6732
  }
6733
6733
  );
@@ -6828,11 +6828,11 @@ var require_request = __commonJS({
6828
6828
  this[kResume]?.();
6829
6829
  }
6830
6830
  }
6831
- abort(reason) {
6831
+ abort(reason2) {
6832
6832
  if (!this.#aborted) {
6833
6833
  this.#aborted = true;
6834
- this.#reason = reason;
6835
- this.#abort(reason);
6834
+ this.#reason = reason2;
6835
+ this.#abort(reason2);
6836
6836
  }
6837
6837
  }
6838
6838
  get aborted() {
@@ -12895,8 +12895,8 @@ var require_client_h2 = __commonJS({
12895
12895
  }
12896
12896
  this[kClient][kOnError](err);
12897
12897
  }
12898
- function onHttp2FrameError(type, code, id2) {
12899
- if (id2 === 0) {
12898
+ function onHttp2FrameError(type, code, id4) {
12899
+ if (id4 === 0) {
12900
12900
  if (this[kReceivedGoAway]) {
12901
12901
  return;
12902
12902
  }
@@ -15093,7 +15093,7 @@ var require_dispatcher1_wrapper = __commonJS({
15093
15093
  this.#handler = handler;
15094
15094
  }
15095
15095
  onRequestStart(controller, context) {
15096
- this.#handler.onConnect?.((reason) => controller.abort(reason), context);
15096
+ this.#handler.onConnect?.((reason2) => controller.abort(reason2), context);
15097
15097
  }
15098
15098
  onRequestUpgrade(controller, statusCode, headers, socket) {
15099
15099
  const rawHeaders = controller?.rawHeaders ?? toRawHeaders(headers ?? {});
@@ -16342,8 +16342,8 @@ var require_retry_handler = __commonJS({
16342
16342
  resume() {
16343
16343
  this.target?.resume();
16344
16344
  }
16345
- abort(reason) {
16346
- this.target?.abort(reason);
16345
+ abort(reason2) {
16346
+ this.target?.abort(reason2);
16347
16347
  }
16348
16348
  get paused() {
16349
16349
  return this.target?.paused ?? false;
@@ -17240,7 +17240,7 @@ var require_api_request = __commonJS({
17240
17240
  }
17241
17241
  assert2(this.callback);
17242
17242
  this.controller = controller;
17243
- this.abort = (reason) => controller.abort(reason);
17243
+ this.abort = (reason2) => controller.abort(reason2);
17244
17244
  this.context = context;
17245
17245
  }
17246
17246
  onResponseStart(controller, statusCode, headers, statusText) {
@@ -17258,7 +17258,7 @@ var require_api_request = __commonJS({
17258
17258
  const contentLength = parsedHeaders?.["content-length"];
17259
17259
  const res = new Readable({
17260
17260
  resume: () => controller.resume(),
17261
- abort: (reason) => controller.abort(reason),
17261
+ abort: (reason2) => controller.abort(reason2),
17262
17262
  contentType,
17263
17263
  contentLength: this.method !== "HEAD" && contentLength ? Number(contentLength) : null,
17264
17264
  highWaterMark
@@ -17520,7 +17520,7 @@ var require_api_stream = __commonJS({
17520
17520
  }
17521
17521
  assert2(this.callback);
17522
17522
  this.controller = controller;
17523
- this.abort = (reason) => controller.abort(reason);
17523
+ this.abort = (reason2) => controller.abort(reason2);
17524
17524
  this.context = context;
17525
17525
  }
17526
17526
  onResponseStart(controller, statusCode, headers, _statusMessage) {
@@ -17753,7 +17753,7 @@ var require_api_pipeline = __commonJS({
17753
17753
  return;
17754
17754
  }
17755
17755
  assert2(!res, "pipeline cannot be retried");
17756
- this.abort = (reason) => controller.abort(reason);
17756
+ this.abort = (reason2) => controller.abort(reason2);
17757
17757
  this.context = context;
17758
17758
  }
17759
17759
  onResponseStart(controller, statusCode, headers, _statusMessage) {
@@ -17870,7 +17870,7 @@ var require_api_upgrade = __commonJS({
17870
17870
  return;
17871
17871
  }
17872
17872
  assert2(this.callback);
17873
- this.abort = (reason) => controller.abort(reason);
17873
+ this.abort = (reason2) => controller.abort(reason2);
17874
17874
  this.context = context;
17875
17875
  }
17876
17876
  onResponseStart() {
@@ -17968,7 +17968,7 @@ var require_api_connect = __commonJS({
17968
17968
  return;
17969
17969
  }
17970
17970
  assert2(this.callback);
17971
- this.abort = (reason) => controller.abort(reason);
17971
+ this.abort = (reason2) => controller.abort(reason2);
17972
17972
  this.context = context;
17973
17973
  }
17974
17974
  onResponseStart() {
@@ -18392,7 +18392,7 @@ var require_mock_utils = __commonJS({
18392
18392
  resume() {
18393
18393
  this.paused = false;
18394
18394
  },
18395
- abort: (reason) => {
18395
+ abort: (reason2) => {
18396
18396
  if (aborted2) {
18397
18397
  return;
18398
18398
  }
@@ -18401,7 +18401,7 @@ var require_mock_utils = __commonJS({
18401
18401
  clearTimeout(timer);
18402
18402
  timer = null;
18403
18403
  }
18404
- handler.onResponseError?.(controller, reason);
18404
+ handler.onResponseError?.(controller, reason2);
18405
18405
  }
18406
18406
  };
18407
18407
  let replyOpts = opts;
@@ -19466,8 +19466,8 @@ var require_snapshot_utils = __commonJS({
19466
19466
  var require_snapshot_recorder = __commonJS({
19467
19467
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
19468
19468
  "use strict";
19469
- var { writeFile: writeFile26, readFile: readFile47, mkdir: mkdir25 } = __require("node:fs/promises");
19470
- var { dirname: dirname27, resolve: resolve24 } = __require("node:path");
19469
+ var { writeFile: writeFile27, readFile: readFile48, mkdir: mkdir26 } = __require("node:fs/promises");
19470
+ var { dirname: dirname28, resolve: resolve24 } = __require("node:path");
19471
19471
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
19472
19472
  var { InvalidArgumentError, UndiciError } = require_errors();
19473
19473
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -19683,7 +19683,7 @@ var require_snapshot_recorder = __commonJS({
19683
19683
  throw new InvalidArgumentError("Snapshot path is required");
19684
19684
  }
19685
19685
  try {
19686
- const data = await readFile47(resolve24(path), "utf8");
19686
+ const data = await readFile48(resolve24(path), "utf8");
19687
19687
  const parsed = JSON.parse(data);
19688
19688
  if (Array.isArray(parsed)) {
19689
19689
  this.#snapshots.clear();
@@ -19713,12 +19713,12 @@ var require_snapshot_recorder = __commonJS({
19713
19713
  throw new InvalidArgumentError("Snapshot path is required");
19714
19714
  }
19715
19715
  const resolvedPath = resolve24(path);
19716
- await mkdir25(dirname27(resolvedPath), { recursive: true });
19716
+ await mkdir26(dirname28(resolvedPath), { recursive: true });
19717
19717
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
19718
19718
  hash: hash2,
19719
19719
  snapshot
19720
19720
  }));
19721
- await writeFile26(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
19721
+ await writeFile27(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
19722
19722
  }
19723
19723
  /**
19724
19724
  * Clears all recorded snapshots
@@ -20013,9 +20013,9 @@ var require_snapshot_agent = __commonJS({
20013
20013
  },
20014
20014
  resume() {
20015
20015
  },
20016
- abort(reason) {
20016
+ abort(reason2) {
20017
20017
  this.aborted = true;
20018
- this.reason = reason;
20018
+ this.reason = reason2;
20019
20019
  },
20020
20020
  aborted: false,
20021
20021
  paused: false
@@ -20582,9 +20582,9 @@ var require_dump = __commonJS({
20582
20582
  super(handler);
20583
20583
  this.#maxSize = maxSize ?? this.#maxSize;
20584
20584
  }
20585
- #abort(reason) {
20585
+ #abort(reason2) {
20586
20586
  this.aborted = true;
20587
- this.reason = reason;
20587
+ this.reason = reason2;
20588
20588
  }
20589
20589
  onRequestStart(controller, context) {
20590
20590
  controller.abort = this.#abort.bind(this);
@@ -23099,9 +23099,9 @@ var require_cache2 = __commonJS({
23099
23099
  resume() {
23100
23100
  this.paused = false;
23101
23101
  },
23102
- abort: (reason) => {
23102
+ abort: (reason2) => {
23103
23103
  aborted2 = true;
23104
- handler.onResponseError?.(controller, reason ?? new AbortError());
23104
+ handler.onResponseError?.(controller, reason2 ?? new AbortError());
23105
23105
  }
23106
23106
  };
23107
23107
  try {
@@ -23145,8 +23145,8 @@ var require_cache2 = __commonJS({
23145
23145
  get reason() {
23146
23146
  return stream.errored;
23147
23147
  },
23148
- abort(reason) {
23149
- stream.destroy(reason ?? new AbortError());
23148
+ abort(reason2) {
23149
+ stream.destroy(reason2 ?? new AbortError());
23150
23150
  }
23151
23151
  };
23152
23152
  stream.on("error", function(err) {
@@ -23888,9 +23888,9 @@ var require_deduplication_handler = __commonJS({
23888
23888
  get reason() {
23889
23889
  return state.reason;
23890
23890
  },
23891
- abort: (reason) => {
23891
+ abort: (reason2) => {
23892
23892
  state.aborted = true;
23893
- state.reason = reason ?? null;
23893
+ state.reason = reason2 ?? null;
23894
23894
  waitingHandler.done = true;
23895
23895
  waitingHandler.pendingTrailers = null;
23896
23896
  waitingHandler.bufferedChunks = [];
@@ -25129,13 +25129,13 @@ var require_response = __commonJS({
25129
25129
  urlList: init?.urlList ? [...init.urlList] : []
25130
25130
  };
25131
25131
  }
25132
- function makeNetworkError(reason) {
25133
- const isError = isErrorLike(reason);
25132
+ function makeNetworkError(reason2) {
25133
+ const isError = isErrorLike(reason2);
25134
25134
  return makeResponse({
25135
25135
  type: "error",
25136
25136
  status: 0,
25137
- error: isError ? reason : new Error(reason ? String(reason) : reason),
25138
- aborted: reason && reason.name === "AbortError"
25137
+ error: isError ? reason2 : new Error(reason2 ? String(reason2) : reason2),
25138
+ aborted: reason2 && reason2.name === "AbortError"
25139
25139
  });
25140
25140
  }
25141
25141
  function isNetworkError(response) {
@@ -26317,13 +26317,13 @@ var require_fetch = __commonJS({
26317
26317
  this.dump = false;
26318
26318
  this.state = "ongoing";
26319
26319
  }
26320
- terminate(reason) {
26320
+ terminate(reason2) {
26321
26321
  if (this.state !== "ongoing") {
26322
26322
  return;
26323
26323
  }
26324
26324
  this.state = "terminated";
26325
- this.connection?.destroy(reason);
26326
- this.emit("terminated", reason);
26325
+ this.connection?.destroy(reason2);
26326
+ this.emit("terminated", reason2);
26327
26327
  }
26328
26328
  // https://fetch.spec.whatwg.org/#fetch-controller-abort
26329
26329
  abort(error63) {
@@ -26612,7 +26612,7 @@ var require_fetch = __commonJS({
26612
26612
  fetchParams.controller.dump = true;
26613
26613
  }
26614
26614
  if (request2.integrity) {
26615
- const processBodyError = (reason) => fetchFinale(fetchParams, makeNetworkError(reason));
26615
+ const processBodyError = (reason2) => fetchFinale(fetchParams, makeNetworkError(reason2));
26616
26616
  if (request2.responseTainting === "opaque" || response.body == null) {
26617
26617
  processBodyError(response.error);
26618
26618
  return;
@@ -27125,9 +27125,9 @@ var require_fetch = __commonJS({
27125
27125
  const pullAlgorithm = () => {
27126
27126
  return fetchParams.controller.resume();
27127
27127
  };
27128
- const cancelAlgorithm = (reason) => {
27128
+ const cancelAlgorithm = (reason2) => {
27129
27129
  if (!isCancelled(fetchParams)) {
27130
- fetchParams.controller.abort(reason);
27130
+ fetchParams.controller.abort(reason2);
27131
27131
  }
27132
27132
  };
27133
27133
  const stream = new ReadableStream(
@@ -27185,7 +27185,7 @@ var require_fetch = __commonJS({
27185
27185
  }
27186
27186
  }
27187
27187
  };
27188
- function onAborted(reason) {
27188
+ function onAborted(reason2) {
27189
27189
  if (isAborted(fetchParams)) {
27190
27190
  response.aborted = true;
27191
27191
  if (isReadable(stream)) {
@@ -27196,7 +27196,7 @@ var require_fetch = __commonJS({
27196
27196
  } else {
27197
27197
  if (isReadable(stream)) {
27198
27198
  fetchParams.controller.controller.error(new TypeError("terminated", {
27199
- cause: isErrorLike(reason) ? reason : void 0
27199
+ cause: isErrorLike(reason2) ? reason2 : void 0
27200
27200
  }));
27201
27201
  }
27202
27202
  }
@@ -27229,7 +27229,7 @@ var require_fetch = __commonJS({
27229
27229
  onRequestStart(controller) {
27230
27230
  const { connection } = fetchParams.controller;
27231
27231
  timingInfo.finalConnectionTimingInfo = clampAndCoarsenConnectionTimingInfo(void 0, timingInfo.postRedirectStartTime, fetchParams.crossOriginIsolatedCapability);
27232
- const abort = (reason) => controller.abort(reason);
27232
+ const abort = (reason2) => controller.abort(reason2);
27233
27233
  if (connection.destroyed) {
27234
27234
  abort(new DOMException("The operation was aborted.", "AbortError"));
27235
27235
  } else {
@@ -28997,14 +28997,14 @@ var require_util5 = __commonJS({
28997
28997
  }
28998
28998
  return urlRecord;
28999
28999
  }
29000
- function validateCloseCodeAndReason(code, reason) {
29000
+ function validateCloseCodeAndReason(code, reason2) {
29001
29001
  if (code !== null) {
29002
29002
  if (code !== 1e3 && (code < 3e3 || code > 4999)) {
29003
29003
  throw new DOMException("invalid code", "InvalidAccessError");
29004
29004
  }
29005
29005
  }
29006
- if (reason !== null) {
29007
- const reasonBytesLength = Buffer.byteLength(reason);
29006
+ if (reason2 !== null) {
29007
+ const reasonBytesLength = Buffer.byteLength(reason2);
29008
29008
  if (reasonBytesLength > 123) {
29009
29009
  throw new DOMException(`Reason must be less than 123 bytes; received ${reasonBytesLength}`, "SyntaxError");
29010
29010
  }
@@ -29249,29 +29249,29 @@ var require_connection = __commonJS({
29249
29249
  });
29250
29250
  return controller;
29251
29251
  }
29252
- function closeWebSocketConnection(object2, code, reason, validate2 = false) {
29252
+ function closeWebSocketConnection(object2, code, reason2, validate2 = false) {
29253
29253
  code ??= null;
29254
- reason ??= "";
29255
- if (validate2) validateCloseCodeAndReason(code, reason);
29254
+ reason2 ??= "";
29255
+ if (validate2) validateCloseCodeAndReason(code, reason2);
29256
29256
  if (isClosed(object2.readyState) || isClosing(object2.readyState)) {
29257
29257
  } else if (!isEstablished(object2.readyState)) {
29258
29258
  failWebsocketConnection(object2);
29259
29259
  object2.readyState = states.CLOSING;
29260
29260
  } else if (!object2.closeState.has(sentCloseFrameState.SENT) && !object2.closeState.has(sentCloseFrameState.RECEIVED)) {
29261
29261
  const frame = new WebsocketFrameSend();
29262
- if (reason.length !== 0 && code === null) {
29262
+ if (reason2.length !== 0 && code === null) {
29263
29263
  code = 1e3;
29264
29264
  }
29265
29265
  assert2(code === null || Number.isInteger(code));
29266
- if (code === null && reason.length === 0) {
29266
+ if (code === null && reason2.length === 0) {
29267
29267
  frame.frameData = emptyBuffer;
29268
- } else if (code !== null && reason === null) {
29268
+ } else if (code !== null && reason2 === null) {
29269
29269
  frame.frameData = Buffer.allocUnsafe(2);
29270
29270
  frame.frameData.writeUInt16BE(code, 0);
29271
- } else if (code !== null && reason !== null) {
29272
- frame.frameData = Buffer.allocUnsafe(2 + Buffer.byteLength(reason));
29271
+ } else if (code !== null && reason2 !== null) {
29272
+ frame.frameData = Buffer.allocUnsafe(2 + Buffer.byteLength(reason2));
29273
29273
  frame.frameData.writeUInt16BE(code, 0);
29274
- frame.frameData.write(reason, 2, "utf-8");
29274
+ frame.frameData.write(reason2, 2, "utf-8");
29275
29275
  } else {
29276
29276
  frame.frameData = emptyBuffer;
29277
29277
  }
@@ -29282,9 +29282,9 @@ var require_connection = __commonJS({
29282
29282
  object2.readyState = states.CLOSING;
29283
29283
  }
29284
29284
  }
29285
- function failWebsocketConnection(handler, code, reason, cause) {
29285
+ function failWebsocketConnection(handler, code, reason2, cause) {
29286
29286
  if (isEstablished(handler.readyState)) {
29287
- closeWebSocketConnection(handler, code, reason, false);
29287
+ closeWebSocketConnection(handler, code, reason2, false);
29288
29288
  }
29289
29289
  handler.controller.abort();
29290
29290
  if (isConnecting(handler.readyState)) {
@@ -29679,16 +29679,16 @@ var require_receiver2 = __commonJS({
29679
29679
  if (code !== void 0 && !isValidStatusCode(code)) {
29680
29680
  return { code: 1002, reason: "Invalid status code", error: true };
29681
29681
  }
29682
- let reason = data.subarray(2);
29683
- if (reason[0] === 239 && reason[1] === 187 && reason[2] === 191) {
29684
- reason = reason.subarray(3);
29682
+ let reason2 = data.subarray(2);
29683
+ if (reason2[0] === 239 && reason2[1] === 187 && reason2[2] === 191) {
29684
+ reason2 = reason2.subarray(3);
29685
29685
  }
29686
29686
  try {
29687
- reason = utf8Decode(reason);
29687
+ reason2 = utf8Decode(reason2);
29688
29688
  } catch {
29689
29689
  return { code: 1007, reason: "Invalid UTF-8", error: true };
29690
29690
  }
29691
- return { code, reason, error: false };
29691
+ return { code, reason: reason2, error: false };
29692
29692
  }
29693
29693
  /**
29694
29694
  * Parses control frames.
@@ -29703,8 +29703,8 @@ var require_receiver2 = __commonJS({
29703
29703
  }
29704
29704
  this.#info.closeInfo = this.parseCloseBody(body);
29705
29705
  if (this.#info.closeInfo.error) {
29706
- const { code, reason } = this.#info.closeInfo;
29707
- failWebsocketConnection(this.#handler, code, reason);
29706
+ const { code, reason: reason2 } = this.#info.closeInfo;
29707
+ failWebsocketConnection(this.#handler, code, reason2);
29708
29708
  return false;
29709
29709
  }
29710
29710
  if (!this.#handler.closeState.has(sentCloseFrameState.SENT) && !this.#handler.closeState.has(sentCloseFrameState.RECEIVED)) {
@@ -29975,18 +29975,18 @@ var require_websocket2 = __commonJS({
29975
29975
  * @param {number|undefined} code
29976
29976
  * @param {string|undefined} reason
29977
29977
  */
29978
- close(code = void 0, reason = void 0) {
29978
+ close(code = void 0, reason2 = void 0) {
29979
29979
  webidl.brandCheck(this, _WebSocket);
29980
29980
  const prefix = "WebSocket.close";
29981
29981
  if (code !== void 0) {
29982
29982
  code = webidl.converters["unsigned short"](code, prefix, "code", webidl.attributes.Clamp);
29983
29983
  }
29984
- if (reason !== void 0) {
29985
- reason = webidl.converters.USVString(reason);
29984
+ if (reason2 !== void 0) {
29985
+ reason2 = webidl.converters.USVString(reason2);
29986
29986
  }
29987
29987
  code ??= null;
29988
- reason ??= "";
29989
- closeWebSocketConnection(this.#handler, code, reason, true);
29988
+ reason2 ??= "";
29989
+ closeWebSocketConnection(this.#handler, code, reason2, true);
29990
29990
  }
29991
29991
  /**
29992
29992
  * @see https://websockets.spec.whatwg.org/#dom-websocket-send
@@ -30203,29 +30203,29 @@ var require_websocket2 = __commonJS({
30203
30203
  #onSocketClose() {
30204
30204
  const wasClean = this.#handler.closeState.has(sentCloseFrameState.SENT) && this.#handler.closeState.has(sentCloseFrameState.RECEIVED);
30205
30205
  let code = 1005;
30206
- let reason = "";
30206
+ let reason2 = "";
30207
30207
  const result2 = this.#parser?.closingInfo;
30208
30208
  if (result2 && !result2.error) {
30209
30209
  code = result2.code ?? 1005;
30210
- reason = result2.reason;
30210
+ reason2 = result2.reason;
30211
30211
  }
30212
30212
  this.#handler.readyState = states.CLOSED;
30213
30213
  if (!this.#handler.closeState.has(sentCloseFrameState.RECEIVED)) {
30214
30214
  code = 1006;
30215
30215
  fireEvent("error", this, (type, init) => new ErrorEvent(type, init), {
30216
- error: new TypeError(reason)
30216
+ error: new TypeError(reason2)
30217
30217
  });
30218
30218
  }
30219
30219
  fireEvent("close", this, (type, init) => new CloseEvent(type, init), {
30220
30220
  wasClean,
30221
30221
  code,
30222
- reason
30222
+ reason: reason2
30223
30223
  });
30224
30224
  if (channels3.close.hasSubscribers) {
30225
30225
  channels3.close.publish({
30226
30226
  websocket: this,
30227
30227
  code,
30228
- reason
30228
+ reason: reason2
30229
30229
  });
30230
30230
  }
30231
30231
  }
@@ -30370,13 +30370,13 @@ var require_websocketerror = __commonJS({
30370
30370
  init = webidl.converters.WebSocketCloseInfo(init);
30371
30371
  }
30372
30372
  let code = init.closeCode ?? null;
30373
- const reason = init.reason ?? "";
30374
- validateCloseCodeAndReason(code, reason);
30375
- if (reason.length !== 0 && code === null) {
30373
+ const reason2 = init.reason ?? "";
30374
+ validateCloseCodeAndReason(code, reason2);
30375
+ if (reason2.length !== 0 && code === null) {
30376
30376
  code = 1e3;
30377
30377
  }
30378
30378
  this.#closeCode = code;
30379
- this.#reason = reason;
30379
+ this.#reason = reason2;
30380
30380
  }
30381
30381
  get closeCode() {
30382
30382
  return this.#closeCode;
@@ -30389,10 +30389,10 @@ var require_websocketerror = __commonJS({
30389
30389
  * @param {number|null} code
30390
30390
  * @param {string} reason
30391
30391
  */
30392
- static createUnvalidatedWebSocketError(message2, code, reason) {
30392
+ static createUnvalidatedWebSocketError(message2, code, reason2) {
30393
30393
  const error63 = new _WebSocketError(message2, kConstruct);
30394
30394
  error63.#closeCode = code;
30395
- error63.#reason = reason;
30395
+ error63.#reason = reason2;
30396
30396
  return error63;
30397
30397
  }
30398
30398
  };
@@ -30550,8 +30550,8 @@ var require_websocketstream = __commonJS({
30550
30550
  closeInfo = webidl.converters.WebSocketCloseInfo(closeInfo);
30551
30551
  }
30552
30552
  const code = closeInfo.closeCode ?? null;
30553
- const reason = closeInfo.reason;
30554
- closeWebSocketConnection(this.#handler, code, reason, true);
30553
+ const reason2 = closeInfo.reason;
30554
+ closeWebSocketConnection(this.#handler, code, reason2, true);
30555
30555
  }
30556
30556
  #write(chunk) {
30557
30557
  chunk = webidl.converters.WebSocketStreamWrite(chunk);
@@ -30599,12 +30599,12 @@ var require_websocketstream = __commonJS({
30599
30599
  start: (controller) => {
30600
30600
  this.#readableStreamController = controller;
30601
30601
  },
30602
- cancel: (reason) => this.#cancel(reason)
30602
+ cancel: (reason2) => this.#cancel(reason2)
30603
30603
  });
30604
30604
  const writable = new WritableStream({
30605
30605
  write: (chunk) => this.#write(chunk),
30606
30606
  close: () => closeWebSocketConnection(this.#handler, null, null),
30607
- abort: (reason) => this.#closeUsingReason(reason)
30607
+ abort: (reason2) => this.#closeUsingReason(reason2)
30608
30608
  });
30609
30609
  this.#readableStream = readable;
30610
30610
  this.#writableStream = writable;
@@ -30648,7 +30648,7 @@ var require_websocketstream = __commonJS({
30648
30648
  if (!this.#handler.closeState.has(sentCloseFrameState.SENT) && !this.#handler.closeState.has(sentCloseFrameState.RECEIVED)) {
30649
30649
  code = 1006;
30650
30650
  }
30651
- const reason = result2?.reason == null ? "" : utf8DecodeBytes(Buffer.from(result2.reason));
30651
+ const reason2 = result2?.reason == null ? "" : utf8DecodeBytes(Buffer.from(result2.reason));
30652
30652
  if (wasClean) {
30653
30653
  readableStreamClose(this.#readableStreamController);
30654
30654
  if (!this.#writableStream.locked) {
@@ -30656,27 +30656,27 @@ var require_websocketstream = __commonJS({
30656
30656
  }
30657
30657
  this.#closedPromise.resolve({
30658
30658
  closeCode: code,
30659
- reason
30659
+ reason: reason2
30660
30660
  });
30661
30661
  } else {
30662
- const error63 = createUnvalidatedWebSocketError("unclean close", code, reason);
30662
+ const error63 = createUnvalidatedWebSocketError("unclean close", code, reason2);
30663
30663
  this.#readableStreamController?.error(error63);
30664
30664
  this.#writableStream?.abort(error63);
30665
30665
  this.#closedPromise.reject(error63);
30666
30666
  }
30667
30667
  }
30668
- #closeUsingReason(reason) {
30668
+ #closeUsingReason(reason2) {
30669
30669
  let code = null;
30670
30670
  let reasonString = "";
30671
- if (webidl.is.WebSocketError(reason)) {
30672
- code = reason.closeCode;
30673
- reasonString = reason.reason;
30671
+ if (webidl.is.WebSocketError(reason2)) {
30672
+ code = reason2.closeCode;
30673
+ reasonString = reason2.reason;
30674
30674
  }
30675
30675
  closeWebSocketConnection(this.#handler, code, reasonString);
30676
30676
  }
30677
30677
  // To cancel a WebSocketStream stream given reason , close using reason giving stream and reason .
30678
- #cancel(reason) {
30679
- this.#closeUsingReason(reason);
30678
+ #cancel(reason2) {
30679
+ this.#closeUsingReason(reason2);
30680
30680
  }
30681
30681
  };
30682
30682
  Object.defineProperties(WebSocketStream.prototype, {
@@ -34675,8 +34675,8 @@ function queryTimeZone(rawTimeZoneId) {
34675
34675
  }
34676
34676
  var queryTimeZoneRecord = /* @__PURE__ */ memoize((normTimeZoneId, record4) => "named" === record4.kind ? new IntlTimeZone(normTimeZoneId, record4.m, record4.format) : new FixedTimeZone(normTimeZoneId, record4.m, "fixed" === record4.kind ? record4.X : 0));
34677
34677
  var FixedTimeZone = class {
34678
- constructor(id2, compareKey, offsetNano) {
34679
- this.id = id2, this.m = compareKey, this.X = offsetNano;
34678
+ constructor(id4, compareKey, offsetNano) {
34679
+ this.id = id4, this.m = compareKey, this.X = offsetNano;
34680
34680
  }
34681
34681
  B() {
34682
34682
  return this.X;
@@ -34688,8 +34688,8 @@ var FixedTimeZone = class {
34688
34688
  }
34689
34689
  };
34690
34690
  var IntlTimeZone = class {
34691
- constructor(id2, compareKey, format2) {
34692
- this.id = id2, this.m = compareKey, this.ke = ((computeOffsetSec, periodDays) => {
34691
+ constructor(id4, compareKey, format2) {
34692
+ this.id = id4, this.m = compareKey, this.ke = ((computeOffsetSec, periodDays) => {
34693
34693
  const getSample = memoize(computeOffsetSec);
34694
34694
  const getSplit = memoize(createSplitTuple);
34695
34695
  const periodSec = 86400 * periodDays;
@@ -34771,7 +34771,7 @@ var IntlTimeZone = class {
34771
34771
  })(format2), ((timeZoneId) => {
34772
34772
  const timeZoneName = timeZoneId.split("/").pop();
34773
34773
  return timeZonePeriodDaysByName[timeZoneName] || 60;
34774
- })(id2));
34774
+ })(id4));
34775
34775
  }
34776
34776
  B(epochNano) {
34777
34777
  return this.ke.we(((epochNano2) => epochNanoToSecMod(epochNano2)[0])(epochNano)) * nanoInSec2;
@@ -36928,7 +36928,7 @@ function flagText({
36928
36928
  }
36929
36929
 
36930
36930
  // src/rules/cli-version.rules.ts
36931
- var STAMPED = "0.1.78";
36931
+ var STAMPED = "0.1.79";
36932
36932
  function cliVersionOf({ stamped = STAMPED } = {}) {
36933
36933
  return stamped.startsWith("__") ? "dev" : stamped;
36934
36934
  }
@@ -40531,15 +40531,15 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
40531
40531
  const syms = normalized.symbolKeys;
40532
40532
  const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms });
40533
40533
  const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
40534
- const prefixStr = (id2, k) => `
40535
- let ${id2}_ab = false;
40536
- for (let i = 0; i < ${id2}.issues.length; i++) {
40537
- const iss = ${id2}.issues[i];
40534
+ const prefixStr = (id4, k) => `
40535
+ let ${id4}_ab = false;
40536
+ for (let i = 0; i < ${id4}.issues.length; i++) {
40537
+ const iss = ${id4}.issues[i];
40538
40538
  iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
40539
40539
  payload.issues.push(iss);
40540
- if (iss.continue !== true) ${id2}_ab = true;
40540
+ if (iss.continue !== true) ${id4}_ab = true;
40541
40541
  }
40542
- if (${id2}_ab && ctx && ctx.abortEarly) {
40542
+ if (${id4}_ab && ctx && ctx.abortEarly) {
40543
40543
  payload.value = newResult;
40544
40544
  return payload;
40545
40545
  }`;
@@ -40553,34 +40553,34 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
40553
40553
  for (const key of normalized.allKeys) {
40554
40554
  if (key === "__proto__")
40555
40555
  continue;
40556
- const id2 = ids[key];
40556
+ const id4 = ids[key];
40557
40557
  const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
40558
40558
  const isPresent = `${k} in input`;
40559
40559
  const schema = shape[key];
40560
40560
  const optin = schema?._zod?.optin;
40561
40561
  const isOptionalIn = optin !== void 0;
40562
40562
  const isOptionalOut = schema?._zod?.optout === "optional";
40563
- doc.write(`const ${id2} = ${parseStr(k)};`);
40563
+ doc.write(`const ${id4} = ${parseStr(k)};`);
40564
40564
  if (isOptionalIn && isOptionalOut) {
40565
- const assign = optin === "optional" ? `${id2}_present` : `${id2}.value !== undefined || ${id2}_present`;
40565
+ const assign = optin === "optional" ? `${id4}_present` : `${id4}.value !== undefined || ${id4}_present`;
40566
40566
  doc.write(`
40567
- const ${id2}_present = ${isPresent};
40568
- if (!${id2}.issues.length || ${id2}_present) {
40569
- if (${id2}.issues.length) {${prefixStr(id2, k)}
40567
+ const ${id4}_present = ${isPresent};
40568
+ if (!${id4}.issues.length || ${id4}_present) {
40569
+ if (${id4}.issues.length) {${prefixStr(id4, k)}
40570
40570
  }
40571
40571
 
40572
40572
  if (${assign}) {
40573
- newResult[${k}] = ${id2}.value;
40573
+ newResult[${k}] = ${id4}.value;
40574
40574
  }
40575
40575
  }
40576
40576
 
40577
40577
  `);
40578
40578
  } else if (!isOptionalIn) {
40579
40579
  doc.write(`
40580
- const ${id2}_present = ${isPresent};
40581
- if (${id2}.issues.length) {${prefixStr(id2, k)}
40580
+ const ${id4}_present = ${isPresent};
40581
+ if (${id4}.issues.length) {${prefixStr(id4, k)}
40582
40582
  }
40583
- if (!${id2}_present && !${id2}.issues.length) {
40583
+ if (!${id4}_present && !${id4}.issues.length) {
40584
40584
  payload.issues.push({
40585
40585
  code: "invalid_type",
40586
40586
  expected: "nonoptional",
@@ -40593,22 +40593,22 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
40593
40593
  }
40594
40594
  }
40595
40595
 
40596
- if (${id2}_present) {
40597
- newResult[${k}] = ${id2}.value;
40596
+ if (${id4}_present) {
40597
+ newResult[${k}] = ${id4}.value;
40598
40598
  }
40599
40599
 
40600
40600
  `);
40601
40601
  } else {
40602
40602
  doc.write(`
40603
- if (${id2}.issues.length) {${prefixStr(id2, k)}
40603
+ if (${id4}.issues.length) {${prefixStr(id4, k)}
40604
40604
  }
40605
40605
  `);
40606
40606
  if (optin === "defaulted") {
40607
- doc.write(`newResult[${k}] = ${id2}.value;`);
40607
+ doc.write(`newResult[${k}] = ${id4}.value;`);
40608
40608
  } else {
40609
40609
  doc.write(`
40610
- if (${id2}.value !== undefined || ${isPresent}) {
40611
- newResult[${k}] = ${id2}.value;
40610
+ if (${id4}.value !== undefined || ${isPresent}) {
40611
+ newResult[${k}] = ${id4}.value;
40612
40612
  }
40613
40613
  `);
40614
40614
  }
@@ -52626,26 +52626,26 @@ function extractDefs(ctx, schema) {
52626
52626
  return;
52627
52627
  const idToSchema = /* @__PURE__ */ new Map();
52628
52628
  for (const entry of ctx.seen.entries()) {
52629
- const id2 = ctx.metadataRegistry.get(entry[0])?.id;
52630
- if (id2) {
52631
- const existing = idToSchema.get(id2);
52629
+ const id4 = ctx.metadataRegistry.get(entry[0])?.id;
52630
+ if (id4) {
52631
+ const existing = idToSchema.get(id4);
52632
52632
  if (existing && existing !== entry[0]) {
52633
- throw new Error(`Duplicate schema id "${id2}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
52633
+ throw new Error(`Duplicate schema id "${id4}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
52634
52634
  }
52635
- idToSchema.set(id2, entry[0]);
52635
+ idToSchema.set(id4, entry[0]);
52636
52636
  }
52637
52637
  }
52638
52638
  const makeURI = (entry) => {
52639
52639
  const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
52640
52640
  if (ctx.external) {
52641
52641
  const externalId = ctx.external.registry.get(entry[0])?.id;
52642
- const uriGenerator = ctx.external.uri ?? ((id3) => id3);
52642
+ const uriGenerator = ctx.external.uri ?? ((id5) => id5);
52643
52643
  if (externalId) {
52644
52644
  return { ref: uriGenerator(externalId) };
52645
52645
  }
52646
- const id2 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
52647
- entry[1].defId = id2;
52648
- return { defId: id2, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id2)}` };
52646
+ const id4 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
52647
+ entry[1].defId = id4;
52648
+ return { defId: id4, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id4)}` };
52649
52649
  }
52650
52650
  const uriPrefix = `#`;
52651
52651
  const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
@@ -52693,8 +52693,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
52693
52693
  continue;
52694
52694
  }
52695
52695
  }
52696
- const id2 = ctx.metadataRegistry.get(entry[0])?.id;
52697
- if (id2) {
52696
+ const id4 = ctx.metadataRegistry.get(entry[0])?.id;
52697
+ if (id4) {
52698
52698
  extractToDef(entry);
52699
52699
  continue;
52700
52700
  }
@@ -52927,10 +52927,10 @@ function finalize(ctx, schema) {
52927
52927
  } else {
52928
52928
  }
52929
52929
  if (ctx.external?.uri) {
52930
- const id2 = ctx.external.registry.get(schema)?.id;
52931
- if (!id2)
52930
+ const id4 = ctx.external.registry.get(schema)?.id;
52931
+ if (!id4)
52932
52932
  throw new Error("Schema is missing an `id` property");
52933
- result2.$id = ctx.external.uri(id2);
52933
+ result2.$id = ctx.external.uri(id4);
52934
52934
  }
52935
52935
  assignProps(result2, root.defId ? root.schema : root.def ?? root.schema);
52936
52936
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
@@ -53536,7 +53536,7 @@ function stringifyKeyNames(bySchema, json7, visited) {
53536
53536
  const values = json7.enum ?? (json7.const !== void 0 ? [json7.const] : void 0);
53537
53537
  if (!numericType && !values?.some((v) => typeof v === "number"))
53538
53538
  return json7;
53539
- const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format: format2, id: id2, ...rest } = json7;
53539
+ const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format: format2, id: id4, ...rest } = json7;
53540
53540
  if (rest.enum)
53541
53541
  rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
53542
53542
  else if (typeof rest.const === "number")
@@ -57413,12 +57413,12 @@ var isHex = new Uint8Array([
57413
57413
  1,
57414
57414
  1
57415
57415
  ]);
57416
- function isValidHex(id2, length) {
57417
- if (typeof id2 !== "string" || id2.length !== length)
57416
+ function isValidHex(id4, length) {
57417
+ if (typeof id4 !== "string" || id4.length !== length)
57418
57418
  return false;
57419
57419
  let r = 0;
57420
- for (let i = 0; i < id2.length; i += 4) {
57421
- r += (isHex[id2.charCodeAt(i)] | 0) + (isHex[id2.charCodeAt(i + 1)] | 0) + (isHex[id2.charCodeAt(i + 2)] | 0) + (isHex[id2.charCodeAt(i + 3)] | 0);
57420
+ for (let i = 0; i < id4.length; i += 4) {
57421
+ r += (isHex[id4.charCodeAt(i)] | 0) + (isHex[id4.charCodeAt(i + 1)] | 0) + (isHex[id4.charCodeAt(i + 2)] | 0) + (isHex[id4.charCodeAt(i + 3)] | 0);
57422
57422
  }
57423
57423
  return r === length;
57424
57424
  }
@@ -58865,7 +58865,7 @@ var ModuleApiToken = class _ModuleApiToken extends FeatureApiIdentity {
58865
58865
  };
58866
58866
  function moduleApi(name3) {
58867
58867
  if (name3 === void 0) {
58868
- return (id2) => ModuleApiToken.create(id2);
58868
+ return (id4) => ModuleApiToken.create(id4);
58869
58869
  }
58870
58870
  return ModuleApiToken.create(name3);
58871
58871
  }
@@ -59404,6 +59404,35 @@ function cleanResolutionNote(text3) {
59404
59404
  }
59405
59405
  var resolutionNoteSchema = external_exports.string().max(RESOLUTION_NOTE_INPUT_MAX_CHARS).default("").transform((text3) => cleanResolutionNote(text3));
59406
59406
 
59407
+ // ../../modules/vault/contract/src/vault-agent-rules.ts
59408
+ var VAULT_AGENT_RULES = ["off", "ask", "allow"];
59409
+ var vaultAgentRuleSchema = external_exports.enum(VAULT_AGENT_RULES);
59410
+ var vaultAgentRuleEntrySchemaDefinition = external_exports.object({
59411
+ agentId: external_exports.string().min(1),
59412
+ rule: vaultAgentRuleSchema,
59413
+ /** False for an Always allow the key has since outgrown: it waits to be confirmed again. */
59414
+ inForce: external_exports.boolean(),
59415
+ setByUserId: external_exports.string(),
59416
+ /** ISO 8601 */
59417
+ setAt: external_exports.iso.datetime()
59418
+ });
59419
+ var vaultAgentRuleEntrySchema = vaultAgentRuleEntrySchemaDefinition;
59420
+ var listVaultAgentRulesInputSchemaDefinition = external_exports.object({
59421
+ workspaceId: external_exports.string().min(1),
59422
+ connectionId: external_exports.string().min(1)
59423
+ });
59424
+ var listVaultAgentRulesInputSchema = listVaultAgentRulesInputSchemaDefinition;
59425
+ var setVaultAgentRuleInputSchemaDefinition = external_exports.object({
59426
+ workspaceId: external_exports.string().min(1),
59427
+ connectionId: external_exports.string().min(1),
59428
+ agentId: external_exports.string().min(1),
59429
+ rule: external_exports.enum([...VAULT_AGENT_RULES, "default"]),
59430
+ /** A fresh passkey proof, when the change needs one. */
59431
+ reauthToken: external_exports.string().min(1).optional()
59432
+ });
59433
+ var setVaultAgentRuleInputSchema = setVaultAgentRuleInputSchemaDefinition;
59434
+ var VaultAgentRulesDialogSlot = uiTokens("vault").component("agentRulesDialog");
59435
+
59407
59436
  // ../../modules/vault/contract/src/vault-devices.ts
59408
59437
  var base64Url = external_exports.string().regex(/^[A-Za-z0-9_-]+$/).max(16384);
59409
59438
  var name = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
@@ -59708,8 +59737,8 @@ var COMMAND_STARTS = new Set(
59708
59737
  " "
59709
59738
  )
59710
59739
  );
59711
- function checkVaultReason(reason) {
59712
- const text3 = (reason ?? "").trim();
59740
+ function checkVaultReason(reason2) {
59741
+ const text3 = (reason2 ?? "").trim();
59713
59742
  if (text3 === "") return "missing";
59714
59743
  if (text3.includes("\n") || Array.from(text3).length > 200) return "too_long";
59715
59744
  const words = text3.split(/\s+/);
@@ -59718,8 +59747,8 @@ function checkVaultReason(reason) {
59718
59747
  if (words.length < 4) return "too_short";
59719
59748
  return "ok";
59720
59749
  }
59721
- var vaultReasonSchema = external_exports.string().transform((reason) => reason.trim()).superRefine((reason, context) => {
59722
- const problem = checkVaultReason(reason);
59750
+ var vaultReasonSchema = external_exports.string().transform((reason2) => reason2.trim()).superRefine((reason2, context) => {
59751
+ const problem = checkVaultReason(reason2);
59723
59752
  if (problem !== "ok")
59724
59753
  context.addIssue({ code: "custom", message: problem, params: { problem } });
59725
59754
  });
@@ -60463,7 +60492,7 @@ var connectionInput = external_exports.object({
60463
60492
  workspaceId: external_exports.string().min(1),
60464
60493
  connectionId: external_exports.string().min(1)
60465
60494
  });
60466
- var vaultTrpc = defineTrpcContract("vault").mutation("createConnection").withInput(createVaultConnectionInputSchema).withOutput(vaultConnectionSchema).query("listConnections").withInput(workspaceInput).withOutput(external_exports.array(vaultConnectionSchema)).mutation("updateConnection").withInput(updateVaultConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("deleteConnection").withInput(connectionInput).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("revokeConnection").withInput(connectionInput).withOutput(external_exports.object({ atProvider: vaultRevokeAtProviderSchema })).query("listConnectionUses").withInput(
60495
+ var vaultCoreTrpc = defineTrpcContract("vault").mutation("createConnection").withInput(createVaultConnectionInputSchema).withOutput(vaultConnectionSchema).query("listConnections").withInput(workspaceInput).withOutput(external_exports.array(vaultConnectionSchema)).mutation("updateConnection").withInput(updateVaultConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("deleteConnection").withInput(connectionInput).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("revokeConnection").withInput(connectionInput).withOutput(external_exports.object({ atProvider: vaultRevokeAtProviderSchema })).query("listConnectionUses").withInput(
60467
60496
  external_exports.object({ ...connectionInput.shape, limit: external_exports.number().int().min(1).max(200).optional() })
60468
60497
  ).withOutput(external_exports.array(vaultConnectionUseSchema)).mutation("revealConnection").withInput(
60469
60498
  external_exports.object({
@@ -60484,6 +60513,8 @@ var vaultTrpc = defineTrpcContract("vault").mutation("createConnection").withInp
60484
60513
  reauthToken: external_exports.string().min(1).max(200).optional()
60485
60514
  })
60486
60515
  ).withOutput(vaultSealedMaterialSchema).query("getSealedApproval").withInput(external_exports.object({ ...workspaceInput.shape, requestId: external_exports.string().min(1) })).withOutput(vaultSealedApprovalSchema).mutation("answerSealedApproval").withInput(answerSealedApprovalInputSchema).withOutput(vaultApprovalRequestSchema).mutation("compareSecret").withInput(compareVaultSecretInputSchema).withOutput(vaultSecretComparisonSchema).mutation("replaceSecretValue").withInput(replaceVaultSecretValueInputSchema).withOutput(vaultConnectionSchema).mutation("savePastedSecret").withInput(external_exports.object({ ...workspaceInput.shape, ...saveVaultPastedSecretBodySchema.shape })).withOutput(vaultPastedSecretSavedSchema).build();
60516
+ var vaultAgentRuleTrpc = defineTrpcContract("vault").query("listAgentRules").withInput(listVaultAgentRulesInputSchema).withOutput(external_exports.array(vaultAgentRuleEntrySchema)).mutation("setAgentRule").withInput(setVaultAgentRuleInputSchema).withOutput(external_exports.array(vaultAgentRuleEntrySchema)).build();
60517
+ var vaultTrpc = joinTrpcContracts("vault", vaultCoreTrpc, vaultAgentRuleTrpc);
60487
60518
 
60488
60519
  // ../../modules/vault/contract/src/vault.config.ts
60489
60520
  var positiveInt = external_exports.coerce.number().int().positive();
@@ -61255,6 +61286,7 @@ var vaultPasskeyAssertionSchemaDefinition = external_exports.object({
61255
61286
  clientDataJSON: b64url2,
61256
61287
  signature: b64url2
61257
61288
  });
61289
+ var vaultPasskeyAssertionSchema = vaultPasskeyAssertionSchemaDefinition;
61258
61290
  var RFC3339 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;
61259
61291
  var vaultWatchOverrideSchemaDefinition = external_exports.object({
61260
61292
  ceilingPerHour: external_exports.number().int().positive().max(1e12),
@@ -61263,6 +61295,7 @@ var vaultWatchOverrideSchemaDefinition = external_exports.object({
61263
61295
  nonce: external_exports.string().regex(/^[A-Za-z0-9_-]{16,128}$/, "16 to 128 base64url characters"),
61264
61296
  assertion: vaultPasskeyAssertionSchemaDefinition
61265
61297
  });
61298
+ var vaultWatchOverrideSchema = vaultWatchOverrideSchemaDefinition;
61266
61299
  var vaultOperatorSignerSchema = external_exports.object({ rpId: external_exports.string().min(1), credentialId: b64url2 });
61267
61300
  var vaultBreakerChallengeSchemaDefinition = external_exports.object({
61268
61301
  challenge: b64url2,
@@ -61271,6 +61304,7 @@ var vaultBreakerChallengeSchemaDefinition = external_exports.object({
61271
61304
  /** Every trusted passkey; the page signs with the one for its own host. */
61272
61305
  passkeys: external_exports.array(vaultOperatorSignerSchema).default([])
61273
61306
  });
61307
+ var vaultBreakerChallengeSchema = vaultBreakerChallengeSchemaDefinition;
61274
61308
  var vaultOperatorPasskeySchemaDefinition = external_exports.object({
61275
61309
  credentialId: b64url2,
61276
61310
  rpId: external_exports.string().min(1),
@@ -61290,12 +61324,14 @@ var vaultOperatorProposalSchemaDefinition = external_exports.object({
61290
61324
  rpId: external_exports.string().min(1),
61291
61325
  fingerprint: external_exports.string()
61292
61326
  });
61327
+ var vaultOperatorProposalSchema = vaultOperatorProposalSchemaDefinition;
61293
61328
  var vaultOperatorProposeSchemaDefinition = external_exports.object({
61294
61329
  publicKey: external_exports.string().min(1).max(512),
61295
61330
  credentialId: b64url2,
61296
61331
  rpId: external_exports.string().min(1).max(253),
61297
61332
  origin: external_exports.url().max(300)
61298
61333
  });
61334
+ var vaultOperatorProposeSchema = vaultOperatorProposeSchemaDefinition;
61299
61335
  var VAULT_OPERATOR_ACTIONS = ["add", "prove", "remove", "label"];
61300
61336
  var VAULT_OPERATOR_LABEL_MAX = 40;
61301
61337
  var vaultOperatorChallengeInputSchemaDefinition = external_exports.object({
@@ -61305,11 +61341,13 @@ var vaultOperatorChallengeInputSchemaDefinition = external_exports.object({
61305
61341
  /** The name a label record signs. */
61306
61342
  label: external_exports.string().min(1).max(VAULT_OPERATOR_LABEL_MAX).optional()
61307
61343
  });
61344
+ var vaultOperatorChallengeInputSchema = vaultOperatorChallengeInputSchemaDefinition;
61308
61345
  var vaultOperatorChallengeSchemaDefinition = external_exports.object({
61309
61346
  challenge: b64url2,
61310
61347
  /** The passkeys vaultd would accept this record from. */
61311
61348
  passkeys: external_exports.array(vaultOperatorSignerSchema)
61312
61349
  });
61350
+ var vaultOperatorChallengeSchema = vaultOperatorChallengeSchemaDefinition;
61313
61351
  var vaultOperatorChainSchemaDefinition = external_exports.object({
61314
61352
  records: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown()))
61315
61353
  });
@@ -61342,6 +61380,7 @@ var vaultLockdownOverrideSchemaDefinition = external_exports.object({
61342
61380
  setByUserId: external_exports.string(),
61343
61381
  setAt: external_exports.iso.datetime()
61344
61382
  });
61383
+ var vaultLockdownOverrideSchema = vaultLockdownOverrideSchemaDefinition;
61345
61384
  var vaultLockdownSchemaDefinition = external_exports.object({
61346
61385
  vaultd: vaultdStateSchemaDefinition,
61347
61386
  /** False while VAULT_WATCH_REPORT_TOKEN is unset: the watchdog routes answer 404. */
@@ -61354,6 +61393,13 @@ var vaultLockdownSchemaDefinition = external_exports.object({
61354
61393
  }).nullable(),
61355
61394
  override: vaultLockdownOverrideSchemaDefinition.nullable()
61356
61395
  });
61396
+ var vaultLockdownSchema = vaultLockdownSchemaDefinition;
61397
+ var vaultOperatorKeyChallengeSchemaDefinition = external_exports.object({
61398
+ challenge: b64url2,
61399
+ passkeys: external_exports.array(vaultOperatorSignerSchema)
61400
+ });
61401
+ var vaultOperatorKeyChallengeSchema = vaultOperatorKeyChallengeSchemaDefinition;
61402
+ var vaultOperatorKeyProofSchemaDefinition = external_exports.object({ credentialId: b64url2 });
61357
61403
  var vaultAlertsSettleRequestedPayloadSchemaDefinition = external_exports.object({
61358
61404
  workspaceId: external_exports.string().min(1),
61359
61405
  kind: external_exports.string().regex(/^[a-z_]{1,64}$/),
@@ -62053,7 +62099,13 @@ var unfurlSchemaDefinition = external_exports.object({
62053
62099
  /** The site has an icon, read with `unfurlImage` and part `icon`. */
62054
62100
  icon: external_exports.boolean().default(false)
62055
62101
  });
62056
- var mirrorSourceSchema = external_exports.enum(["slack", "whatsapp_business", "discord", "laze"]);
62102
+ var mirrorSourceSchema = external_exports.enum([
62103
+ "slack",
62104
+ "whatsapp_business",
62105
+ "whatsapp",
62106
+ "discord",
62107
+ "laze"
62108
+ ]);
62057
62109
  var mirrorDeliverySchema = external_exports.enum(["waiting", "failed"]);
62058
62110
  var messageOriginSchemaDefinition = external_exports.object({
62059
62111
  source: mirrorSourceSchema,
@@ -65248,6 +65300,14 @@ var hostFrameSchemaDefinition = external_exports.discriminatedUnion("type", [
65248
65300
  /** Counts what would change and writes nothing. */
65249
65301
  dryRun: external_exports.boolean().default(false)
65250
65302
  }),
65303
+ /** Runs a schedule's check script without a turn; answered with `check_done`. */
65304
+ external_exports.object({
65305
+ type: external_exports.literal("run_check"),
65306
+ requestId: external_exports.string().min(1).max(80),
65307
+ script: external_exports.string().min(1).max(240),
65308
+ timeoutMs: external_exports.number().int().positive(),
65309
+ outputMax: external_exports.number().int().positive()
65310
+ }),
65251
65311
  /** Drops a message still queued for the agent; answered with `withdrawn`. */
65252
65312
  external_exports.object({
65253
65313
  type: external_exports.literal("withdraw"),
@@ -65292,6 +65352,15 @@ var supervisorFrameSchemaDefinition = external_exports.discriminatedUnion("type"
65292
65352
  lines: external_exports.number().int().nonnegative(),
65293
65353
  kept: external_exports.number().int().nonnegative().default(0)
65294
65354
  }),
65355
+ /** A `run_check` done: how it ended and what it printed on stdout. */
65356
+ external_exports.object({
65357
+ type: external_exports.literal("check_done"),
65358
+ requestId: external_exports.string().min(1).max(80),
65359
+ ending: external_exports.enum(["exited", "timed_out", "missing"]),
65360
+ exitCode: external_exports.number().int().nullable(),
65361
+ output: external_exports.string(),
65362
+ cut: external_exports.boolean()
65363
+ }),
65295
65364
  /** A `laze` CLI call made inside the sandbox; the host sends it to Laze with the agent's key. */
65296
65365
  external_exports.object({
65297
65366
  type: external_exports.literal("api_request"),
@@ -65558,6 +65627,7 @@ var capacityNumbersDefinition = external_exports.object({
65558
65627
  placedDiskGb: external_exports.number(),
65559
65628
  diskLimitGb: external_exports.number()
65560
65629
  });
65630
+ var capacityNumbersSchema = capacityNumbersDefinition;
65561
65631
  var computerPoolFactDefinition = external_exports.discriminatedUnion("kind", [
65562
65632
  external_exports.object({
65563
65633
  kind: external_exports.literal("host_registered"),
@@ -66278,7 +66348,7 @@ var NAMING_FREE_CLI_COMMANDS = [
66278
66348
  ];
66279
66349
  var NAMING_IS_SILENT = "Naming or renaming a conversation is silent: never post a message about it, and leave it out of your final text.";
66280
66350
  function namingFirstTextOf({ channelIds }) {
66281
- const lines2 = channelIds.map((id2) => ` laze conversation rename ${id2} "<a few words>"`);
66351
+ const lines2 = channelIds.map((id4) => ` laze conversation rename ${id4} "<a few words>"`);
66282
66352
  return [
66283
66353
  "Name your new conversation first, in a few words that say what it is about:",
66284
66354
  ...lines2,
@@ -71129,17 +71199,17 @@ function bodyAsText({
71129
71199
  body,
71130
71200
  mentions
71131
71201
  }) {
71132
- const actorName = (kind2, id2) => mentions.actors.find((actor) => actor.kind === kind2 && actor.id === id2)?.name ?? kind2;
71202
+ const actorName = (kind2, id4) => mentions.actors.find((actor) => actor.kind === kind2 && actor.id === id4)?.name ?? kind2;
71133
71203
  const written = withSlackMarkupAsText(body);
71134
71204
  let text3 = "";
71135
71205
  let from = 0;
71136
71206
  for (const token2 of written.matchAll(TOKEN)) {
71137
- const [whole, kind2, id2, broadcast, channelId] = token2;
71207
+ const [whole, kind2, id4, broadcast, channelId] = token2;
71138
71208
  text3 += plain2(written.slice(from, token2.index));
71139
71209
  from = token2.index + whole.length;
71140
71210
  if (channelId) {
71141
71211
  text3 += `#${mentions.channels.find((channel) => channel.id === channelId)?.name ?? "channel"}`;
71142
- } else if (kind2 && id2) text3 += `@${actorName(kind2, id2)}`;
71212
+ } else if (kind2 && id4) text3 += `@${actorName(kind2, id4)}`;
71143
71213
  else text3 += `@${broadcast ?? "channel"}`;
71144
71214
  }
71145
71215
  text3 += plain2(written.slice(from));
@@ -71317,13 +71387,13 @@ function rushSessionOf({
71317
71387
  parentArgs
71318
71388
  }) {
71319
71389
  if (!parentArgs) return void 0;
71320
- const [program = "", verb, action, id2] = parentArgs;
71390
+ const [program = "", verb, action, id4] = parentArgs;
71321
71391
  const isRush = program === "rush" || program.endsWith("/rush");
71322
- if (!isRush || verb !== "host" || action !== "run" || !id2) return void 0;
71323
- return { id: id2, program };
71392
+ if (!isRush || verb !== "host" || action !== "run" || !id4) return void 0;
71393
+ return { id: id4, program };
71324
71394
  }
71325
- function rushSendCommand({ program, id: id2 }) {
71326
- return ["sh", "-c", 'printf "%s\\n" "$LAZE_WAKE_TEXT" | "$0" session send "$1"', program, id2];
71395
+ function rushSendCommand({ program, id: id4 }) {
71396
+ return ["sh", "-c", 'printf "%s\\n" "$LAZE_WAKE_TEXT" | "$0" session send "$1"', program, id4];
71327
71397
  }
71328
71398
  function rushListedOf({ listed }) {
71329
71399
  try {
@@ -71836,15 +71906,15 @@ async function preToolHook({ context, args }) {
71836
71906
  const answer6 = await beat({ client, state, working: true });
71837
71907
  if (!answer6.stop) return;
71838
71908
  await turnEnded({ context, client, agent: name3 });
71839
- const reason = `Stopped by ${answer6.stoppedBy ?? "someone"} in Laze.`;
71909
+ const reason2 = `Stopped by ${answer6.stoppedBy ?? "someone"} in Laze.`;
71840
71910
  context.out(
71841
71911
  JSON.stringify({
71842
71912
  continue: false,
71843
- stopReason: reason,
71913
+ stopReason: reason2,
71844
71914
  hookSpecificOutput: {
71845
71915
  hookEventName: "PreToolUse",
71846
71916
  permissionDecision: "deny",
71847
- permissionDecisionReason: reason
71917
+ permissionDecisionReason: reason2
71848
71918
  }
71849
71919
  })
71850
71920
  );
@@ -72162,14 +72232,14 @@ async function scheduleMessage({
72162
72232
  var USAGE = "Usage: laze scheduled [--channel <channel>] [--json], laze scheduled send|cancel <id>, laze scheduled edit <id> [--text <text|->] [--at <time> [--tz <zone>]]";
72163
72233
  var EDIT_USAGE = "Usage: laze scheduled edit <id> [--text <text|->] [--at <time> [--tz <zone>]]; give the text, the time or both";
72164
72234
  async function scheduled({ context, args }) {
72165
- const [, action, id2] = args.words;
72235
+ const [, action, id4] = args.words;
72166
72236
  if (action === "send" || action === "cancel") {
72167
- if (!id2) throw new CliUsageError(USAGE);
72168
- return actOn({ context, args, action, id: id2 });
72237
+ if (!id4) throw new CliUsageError(USAGE);
72238
+ return actOn({ context, args, action, id: id4 });
72169
72239
  }
72170
72240
  if (action === "edit") {
72171
- if (!id2) throw new CliUsageError(EDIT_USAGE);
72172
- return editOne({ context, args, id: id2 });
72241
+ if (!id4) throw new CliUsageError(EDIT_USAGE);
72242
+ return editOne({ context, args, id: id4 });
72173
72243
  }
72174
72244
  if (action !== void 0) throw new CliUsageError(USAGE);
72175
72245
  const { client } = await signedIn({ context, args });
@@ -72195,14 +72265,14 @@ async function newTextOf({
72195
72265
  async function editOne({
72196
72266
  context,
72197
72267
  args,
72198
- id: id2
72268
+ id: id4
72199
72269
  }) {
72200
72270
  const at = scheduleAtOf({ args, usage: EDIT_USAGE });
72201
72271
  const body = await newTextOf({ context, args });
72202
72272
  if (!at && body === void 0) throw new CliUsageError(EDIT_USAGE);
72203
72273
  const { client } = await signedIn({ context, args });
72204
72274
  const edited = await client.post("/api/agents/me/scheduled/edit", {
72205
- scheduledId: id2,
72275
+ scheduledId: id4,
72206
72276
  ...body === void 0 ? {} : { body },
72207
72277
  ...at ? { sendAt: at.sendAt } : {}
72208
72278
  });
@@ -72215,11 +72285,11 @@ async function actOn({
72215
72285
  context,
72216
72286
  args,
72217
72287
  action,
72218
- id: id2
72288
+ id: id4
72219
72289
  }) {
72220
72290
  const { client } = await signedIn({ context, args });
72221
72291
  const done = await client.post(`/api/agents/me/scheduled/${action}`, {
72222
- scheduledId: id2
72292
+ scheduledId: id4
72223
72293
  });
72224
72294
  if (args.flags.json) return context.out(`${JSON.stringify(done, null, 2)}
72225
72295
  `);
@@ -72382,7 +72452,7 @@ function leavesLazeOf({
72382
72452
  }
72383
72453
  function turnAnswersOf({ context }) {
72384
72454
  const listed = context.environment.inherited.LAZE_TURN_MESSAGES ?? "";
72385
- const answers = listed.split(",").flatMap((id2) => id2.trim() ? [id2.trim()] : []);
72455
+ const answers = listed.split(",").flatMap((id4) => id4.trim() ? [id4.trim()] : []);
72386
72456
  return answers.length > 0 ? { answers } : {};
72387
72457
  }
72388
72458
  var FILES_USAGE = "[--image <path|url|fileId>]... [--file <path|url|fileId>]... (at most 6)";
@@ -72702,11 +72772,11 @@ function rolloutSessionOf({
72702
72772
  }) {
72703
72773
  try {
72704
72774
  const parsed = JSON.parse(firstLine);
72705
- const { id: id2, cwd } = parsed.payload ?? {};
72706
- if (parsed.type !== "session_meta" || typeof id2 !== "string" || typeof cwd !== "string") {
72775
+ const { id: id4, cwd } = parsed.payload ?? {};
72776
+ if (parsed.type !== "session_meta" || typeof id4 !== "string" || typeof cwd !== "string") {
72707
72777
  return void 0;
72708
72778
  }
72709
- return { id: id2, cwd };
72779
+ return { id: id4, cwd };
72710
72780
  } catch {
72711
72781
  return void 0;
72712
72782
  }
@@ -72735,7 +72805,7 @@ function rolloutEventOf({
72735
72805
  if (type === "task_complete" || type === "turn_aborted") return { kind: "ended" };
72736
72806
  const text3 = userTextOf({ parsed });
72737
72807
  if (text3 === void 0) return void 0;
72738
- const held = messageIds.filter((id2) => text3.includes(`[${id2}]`));
72808
+ const held = messageIds.filter((id4) => text3.includes(`[${id4}]`));
72739
72809
  return held.length > 0 ? { kind: "holds", messageIds: held } : void 0;
72740
72810
  }
72741
72811
 
@@ -72825,8 +72895,8 @@ var CodexTurnWatch = class _CodexTurnWatch {
72825
72895
  async #follow({ line }) {
72826
72896
  const event = rolloutEventOf({ line, messageIds: [...this.#queued.keys()] });
72827
72897
  if (event?.kind === "holds") {
72828
- const held = event.messageIds.flatMap((id2) => this.#queued.get(id2) ?? []);
72829
- for (const id2 of event.messageIds) this.#queued.delete(id2);
72898
+ const held = event.messageIds.flatMap((id4) => this.#queued.get(id4) ?? []);
72899
+ for (const id4 of event.messageIds) this.#queued.delete(id4);
72830
72900
  this.#answering = [...this.#answering, ...held];
72831
72901
  await this.#tell({ working: true });
72832
72902
  } else if (event?.kind === "ended" && this.#answering.length > 0) {
@@ -73117,8 +73187,8 @@ var answer = (status11, value) => ({
73117
73187
  headers: value === void 0 ? {} : JSON_HEADERS,
73118
73188
  body: value === void 0 ? "" : JSON.stringify(value)
73119
73189
  });
73120
- var result = (id2, value) => answer(200, { jsonrpc: "2.0", id: id2, result: value });
73121
- var error62 = (id2, code, message2) => answer(200, { jsonrpc: "2.0", id: id2 ?? null, error: { code, message: message2 } });
73190
+ var result = (id4, value) => answer(200, { jsonrpc: "2.0", id: id4, result: value });
73191
+ var error62 = (id4, code, message2) => answer(200, { jsonrpc: "2.0", id: id4 ?? null, error: { code, message: message2 } });
73122
73192
  function headerOf(headers, name3) {
73123
73193
  const found = Object.entries(headers).find(([key]) => key.toLowerCase() === name3);
73124
73194
  return found?.[1];
@@ -73547,8 +73617,8 @@ function decodeRelayEnvelope(bytes) {
73547
73617
  payload: bytes.subarray(2 + size)
73548
73618
  };
73549
73619
  }
73550
- function relayClosePayload({ code, reason }) {
73551
- const text3 = encoder.encode(reason.slice(0, 120));
73620
+ function relayClosePayload({ code, reason: reason2 }) {
73621
+ const text3 = encoder.encode(reason2.slice(0, 120));
73552
73622
  const out = new Uint8Array(2 + text3.length);
73553
73623
  out[0] = code >> 8 & 255;
73554
73624
  out[1] = code & 255;
@@ -73697,13 +73767,13 @@ var RelaySession = class {
73697
73767
  send({ socket: relay2, kind: binary ? "binary" : "text", line, payload: bytesOf(data) });
73698
73768
  });
73699
73769
  socket.on("error", () => void 0);
73700
- socket.on("close", (code, reason) => {
73770
+ socket.on("close", (code, reason2) => {
73701
73771
  const known = this.#lines.get(line) === entry;
73702
73772
  this.#lines.delete(line);
73703
73773
  if (!known) return;
73704
73774
  const closed = relayClosePayload({
73705
73775
  code: code || 1006,
73706
- reason: reason.toString() || "the gateway closed"
73776
+ reason: reason2.toString() || "the gateway closed"
73707
73777
  });
73708
73778
  send({ socket: relay2, kind: "closed", line, payload: closed });
73709
73779
  });
@@ -74061,9 +74131,9 @@ async function cliStampOf({ context }) {
74061
74131
  );
74062
74132
  }
74063
74133
  var CodexQueueError = class extends Error {
74064
- constructor(reason, detail) {
74134
+ constructor(reason2, detail) {
74065
74135
  super(detail);
74066
- this.reason = reason;
74136
+ this.reason = reason2;
74067
74137
  this.detail = detail;
74068
74138
  }
74069
74139
  reason;
@@ -74841,10 +74911,10 @@ var CodexAppServer = class _CodexAppServer {
74841
74911
  return new _CodexAppServer(spawn2("codex", ["app-server"], { env, stdio: "pipe" }));
74842
74912
  }
74843
74913
  async call(method, params) {
74844
- const id2 = ++this.#nextId;
74914
+ const id4 = ++this.#nextId;
74845
74915
  const reply2 = await new Promise((resolve24) => {
74846
- this.#pending.set(id2, resolve24);
74847
- this.write({ id: id2, method, params });
74916
+ this.#pending.set(id4, resolve24);
74917
+ this.write({ id: id4, method, params });
74848
74918
  });
74849
74919
  if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
74850
74920
  return record3(reply2.result);
@@ -74910,9 +74980,9 @@ async function newestThreadId({ codexHome }) {
74910
74980
  rollouts.map(async (file3) => ({ file: file3, at: (await stat5(join14(root, file3))).mtimeMs }))
74911
74981
  );
74912
74982
  const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
74913
- const id2 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
74914
- if (!id2?.[1]) throw new CliUsageError("No Codex session found: pass --thread <id>.");
74915
- return id2[1];
74983
+ const id4 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
74984
+ if (!id4?.[1]) throw new CliUsageError("No Codex session found: pass --thread <id>.");
74985
+ return id4[1];
74916
74986
  }
74917
74987
  function promptOf({ message: message2, self: self2 }) {
74918
74988
  return [
@@ -75319,6 +75389,10 @@ without a recap; the person's DM already shows your messages elsewhere.
75319
75389
 
75320
75390
  ## The feed
75321
75391
 
75392
+ A schedule that only polls for changes should not run a turn each time: give it a check with
75393
+ \`laze schedule add|update ... --check <script>\`. The script prints something to wake you with
75394
+ that output, prints nothing to let you sleep, and keeps its own state in a file.
75395
+
75322
75396
  When something needs a person to decide or act, post a card in their feed:
75323
75397
  \`laze feed post "<title>" --summary "<why>" --action "<label>=<what to do>"\`. Run
75324
75398
  \`laze feed post\` with no title for every flag and how to write a card.
@@ -76475,8 +76549,8 @@ async function pauseAgent({
76475
76549
  const agent3 = args.words[2];
76476
76550
  if (!agent3) throw new CliUsageError(PAUSE_USAGE);
76477
76551
  const { client } = await signedIn({ context, args });
76478
- const reason = paused && typeof args.flags.reason === "string" ? args.flags.reason : void 0;
76479
- const body = { agent: agent3, paused, ...reason && { pauseReason: reason } };
76552
+ const reason2 = paused && typeof args.flags.reason === "string" ? args.flags.reason : void 0;
76553
+ const body = { agent: agent3, paused, ...reason2 && { pauseReason: reason2 } };
76480
76554
  const updated = await client.post("/api/agents/update", body);
76481
76555
  if (args.flags.json) return context.out(`${JSON.stringify(updated, null, 2)}
76482
76556
  `);
@@ -77290,8 +77364,8 @@ async function uploadTranscript({ context, args, client }) {
77290
77364
  args,
77291
77365
  usage: "Usage: laze agent migrate upload <migrationId>"
77292
77366
  });
77293
- const id2 = encodeURIComponent(migrationId);
77294
- const ticket = await client.get(`/api/agents/me/migrations/${id2}`);
77367
+ const id4 = encodeURIComponent(migrationId);
77368
+ const ticket = await client.get(`/api/agents/me/migrations/${id4}`);
77295
77369
  if (ticket.status === "cancelled") {
77296
77370
  throw new CliUsageError("This migration was cancelled; nothing was uploaded.");
77297
77371
  }
@@ -77310,10 +77384,10 @@ async function uploadTranscript({ context, args, client }) {
77310
77384
  maxParts: Math.min(ticket.partsMax, MIGRATION_PARTS_MAX)
77311
77385
  });
77312
77386
  const upload = { parts, truncated, redactions: redacted.redactions };
77313
- await uploadParts({ client, migrationId: id2, upload });
77387
+ await uploadParts({ client, migrationId: id4, upload });
77314
77388
  const fileName = basename5(found.path);
77315
77389
  const completed = await client.post(
77316
- `/api/agents/me/migrations/${id2}/complete`,
77390
+ `/api/agents/me/migrations/${id4}/complete`,
77317
77391
  {
77318
77392
  parts: parts.length,
77319
77393
  sha256: sha256Of({ text: parts.join("") }),
@@ -77406,13 +77480,13 @@ async function mintedRequestProfile({
77406
77480
  token: agent3.token,
77407
77481
  fetcher: context.fetcher
77408
77482
  });
77409
- const { requestKey } = await client.post(
77483
+ const { requestKey: requestKey2 } = await client.post(
77410
77484
  "/api/agents/me/request-key",
77411
77485
  {}
77412
77486
  );
77413
77487
  const profile = {
77414
77488
  url: agent3.url,
77415
- token: requestKey,
77489
+ token: requestKey2,
77416
77490
  workspaceId: agent3.workspaceId,
77417
77491
  kind: "request",
77418
77492
  name: agent3.name
@@ -77862,7 +77936,7 @@ var createAppInputSchemaDefinition = external_exports.object({
77862
77936
  /** Defaults to the name in lower case words. */
77863
77937
  slug: appSlugSchema.optional(),
77864
77938
  channelId: external_exports.string().min(1).optional(),
77865
- /** Restricted unless chosen: owner, admins, shares and the conversations it is pinned to. */
77939
+ /** Restricted unless chosen: its owner, shares and the conversations it is pinned to. */
77866
77940
  visibility: appVisibilitySchema.default("restricted"),
77867
77941
  /** The agent a person hands the new app to, which becomes its creator and a Builder. */
77868
77942
  creatorAgentId: external_exports.string().min(1).optional(),
@@ -78440,6 +78514,35 @@ var visibilityOutcomeSchemaDefinition = external_exports.object({
78440
78514
  });
78441
78515
  var visibilityOutcomeSchema = visibilityOutcomeSchemaDefinition;
78442
78516
 
78517
+ // ../../modules/app/contract/src/app.admin.ts
78518
+ var workspaceAppSchemaDefinition = external_exports.object({
78519
+ id: external_exports.string().min(1),
78520
+ name: external_exports.string(),
78521
+ slug: external_exports.string(),
78522
+ owner: appActorSchema,
78523
+ /** The person the app belongs to, else the agent that built it; null when neither is known. */
78524
+ ownerName: external_exports.string().nullable(),
78525
+ /** The person the app belongs to left the workspace, or no person stands behind its agent. */
78526
+ ownerLeft: external_exports.boolean(),
78527
+ visibility: appVisibilitySchema,
78528
+ live: external_exports.boolean(),
78529
+ archived: external_exports.boolean(),
78530
+ /** Bytes the app stores on the host; null when the host did not answer. */
78531
+ bytes: external_exports.number().int().nonnegative().nullable()
78532
+ });
78533
+ var workspaceAppSchema = workspaceAppSchemaDefinition;
78534
+ var listWorkspaceAppsInputSchemaDefinition = external_exports.object({ workspaceId: external_exports.string().min(1) });
78535
+ var listWorkspaceAppsInputSchema = listWorkspaceAppsInputSchemaDefinition;
78536
+ var setAppOwnerInputSchemaDefinition = external_exports.object({
78537
+ workspaceId: external_exports.string().min(1),
78538
+ appId: external_exports.string().min(1),
78539
+ ownerUserId: external_exports.string().min(1)
78540
+ });
78541
+ var setAppOwnerInputSchema = setAppOwnerInputSchemaDefinition;
78542
+ var setAppOwnerByKeyInputSchemaDefinition = setAppOwnerInputSchemaDefinition.omit({
78543
+ workspaceId: true
78544
+ });
78545
+
78443
78546
  // ../../modules/app/contract/src/app.users.ts
78444
78547
  var appUserSchemaDefinition = external_exports.object({
78445
78548
  id: external_exports.string().min(1),
@@ -78640,7 +78743,7 @@ var appCostSchemaDefinition = external_exports.object({
78640
78743
  /** The last 30 days, oldest first, with every day present. */
78641
78744
  days: external_exports.array(appCostDaySchemaDefinition),
78642
78745
  budget: appBudgetSchemaDefinition,
78643
- /** Whether the caller may set the budget: the app's Builders and workspace admins. */
78746
+ /** Whether the caller may set the budget: the app's Builders. */
78644
78747
  canSetBudget: external_exports.boolean(),
78645
78748
  /** What the app uses against its limits; null when the apps host did not answer. */
78646
78749
  quota: appQuotaSchema.nullable().default(null)
@@ -79064,7 +79167,7 @@ var appsCopy = {
79064
79167
  var appMainTrpc = defineTrpcContract("app").query("list", { mirrored: appsCopy }).withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(appPushSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(appDataRefSchema).withOutput(external_exports.array(collectionSchema)).query("records").withInput(listRecordsInputSchema).withOutput(recordPageSchema).mutation("writeRecord").withInput(writeRecordInputSchema).withOutput(appRecordSchema).mutation("deleteRecord").withInput(deleteRecordInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("views").withInput(appDataRefSchema).withOutput(external_exports.array(appViewSchema)).mutation("saveView").withInput(saveViewInputSchema).withOutput(appViewSchema).mutation("deleteView").withInput(deleteViewInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("chooseCardRows").withInput(chooseCardRowsInputSchema).withOutput(appCardChoiceSchema).query("exportRecords").withInput(exportRecordsInputSchema).withOutput(recordExportSchema).mutation("importRecords").withInput(importRecordsInputSchema).withOutput(recordImportSchema).mutation("decidePublish").withInput(decidePublishInputSchema).withOutput(publishOutcomeSchema).mutation("nameVersion").withInput(nameVersionInputSchema).withOutput(appVersionSchema).mutation("makeInternal").withInput(appRefSchema).withOutput(appSchema).mutation("revokePublishLease").withInput(appRefSchema).withOutput(appSchema).mutation("signInHandoff").withInput(signInHandoffInputSchema).withOutput(signInHandoffSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("access").withInput(appRefSchema).withOutput(appAccessSchema).query("members").withInput(appRefSchema).withOutput(appMembersSchema).mutation("grantAccess").withInput(grantAppAccessInputSchema).withOutput(appAccessSchema).mutation("revokeAccess").withInput(revokeAppAccessInputSchema).withOutput(appAccessSchema).mutation("setVisibility").withInput(setAppVisibilityInputSchema).withOutput(visibilityOutcomeSchema).mutation("setMemberRole").withInput(setMemberRoleInputSchema).withOutput(appAccessSchema).mutation("unpublish").withInput(appRefSchema).withOutput(appSchema).query("door").withInput(appRefSchema).withOutput(appDoorSchema).mutation("requestAccess").withInput(appRefSchema).withOutput(appDoorSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).query("backups").withInput(appRefSchema).withOutput(appBackupStatusSchema).mutation("restoreData").withInput(restoreAppDataInputSchema).withOutput(appRestoreSchema).query("cost").withInput(appRefSchema).withOutput(appCostSchema).mutation("setBudget").withInput(setAppBudgetInputSchema).withOutput(appCostSchema).query("triggers").withInput(appRefSchema).withOutput(appTriggersSchema).mutation("setTriggerPaused").withInput(setAppTriggerPausedInputSchema).withOutput(appTriggerSchema).mutation("removeTrigger").withInput(appTriggerRefSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
79065
79168
  var appConnectionsTrpc = defineTrpcContract("app").query("connections").withInput(appRefSchema).withOutput(appConnectionsSchema).mutation("allowConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).mutation("revokeConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).build();
79066
79169
  var appPinsTrpc = defineTrpcContract("app").query("pins").withInput(channelPinsInputSchema).withOutput(channelAppPinsSchema).mutation("pin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("unpin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("setPinView").withInput(setPinViewInputSchema).withOutput(channelAppPinsSchema).mutation("reorderPins").withInput(reorderPinsInputSchema).withOutput(channelAppPinsSchema).mutation("setPinRole").withInput(setPinRoleInputSchema).withOutput(appAccessSchema).build();
79067
- var appSettingsTrpc = defineTrpcContract("app").query("workspaceSettings").withInput(appWorkspaceRefSchema).withOutput(appWorkspaceSettingsSchema).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).mutation("setPublicAppsAllowed").withInput(setPublicAppsAllowedInputSchema).withOutput(appFunctionSettingsSchema).query("templates").withInput(appWorkspaceRefSchema).withOutput(external_exports.array(appTemplateSchema)).build();
79170
+ var appSettingsTrpc = defineTrpcContract("app").query("workspaceSettings").withInput(appWorkspaceRefSchema).withOutput(appWorkspaceSettingsSchema).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).mutation("setPublicAppsAllowed").withInput(setPublicAppsAllowedInputSchema).withOutput(appFunctionSettingsSchema).query("workspaceApps").withInput(listWorkspaceAppsInputSchema).withOutput(external_exports.array(workspaceAppSchema)).mutation("setOwner").withInput(setAppOwnerInputSchema).withOutput(workspaceAppSchema).mutation("unpublishAsAdmin").withInput(appRefSchema).withOutput(external_exports.object({ unpublished: external_exports.literal(true) })).query("templates").withInput(appWorkspaceRefSchema).withOutput(external_exports.array(appTemplateSchema)).build();
79068
79171
  var appTrpc = joinTrpcContracts(
79069
79172
  "app",
79070
79173
  appMainTrpc,
@@ -79378,6 +79481,24 @@ var appCliCommands = [
79378
79481
  arguments: ["[app]", "--confirm <the app's name>"],
79379
79482
  summary: "Delete the app: it stops serving at once (owner or admin)"
79380
79483
  },
79484
+ {
79485
+ command: "laze app admin-list",
79486
+ operation: "listWorkspaceApps",
79487
+ arguments: [],
79488
+ summary: "Every app in the workspace with its owner, sharing and size, and no content (admins, a person's key)"
79489
+ },
79490
+ {
79491
+ command: "laze app set-owner",
79492
+ operation: "setAppOwner",
79493
+ arguments: ["<app id>", "<person>"],
79494
+ summary: "Give an app a new owner; the old owner keeps access (admins, a person's key)"
79495
+ },
79496
+ {
79497
+ command: "laze app admin-unpublish",
79498
+ operation: "unpublishAsAdmin",
79499
+ arguments: ["<app id>"],
79500
+ summary: "Take an app offline without opening it (admins, a person's key)"
79501
+ },
79381
79502
  {
79382
79503
  command: "laze app revoke-lease",
79383
79504
  operation: "revokePublishLease",
@@ -79734,6 +79855,39 @@ var revokeLease = async ({ context, args, open: open5 }) => {
79734
79855
  `;
79735
79856
  print2({ context, args, value: app2, text: text3 });
79736
79857
  };
79858
+ function workspaceAppLine(app2) {
79859
+ const size = app2.bytes === null ? "size unknown" : `${app2.bytes} bytes`;
79860
+ const left = app2.ownerLeft ? " (owner left)" : "";
79861
+ const state = [app2.live ? "live" : "offline", ...app2.archived ? ["archived"] : []].join(", ");
79862
+ return `${app2.id} ${app2.name} ${app2.ownerName ?? "no owner"}${left} ${app2.visibility} ${state} ${size}
79863
+ `;
79864
+ }
79865
+ var adminList = async ({ context, args, signed: signed2 }) => {
79866
+ const client = await signed2();
79867
+ const apps = await client.post("/api/apps/admin/list", {});
79868
+ const text3 = apps.length > 0 ? apps.map(workspaceAppLine).join("") : "No apps yet.\n";
79869
+ print2({ context, args, value: apps, text: text3 });
79870
+ };
79871
+ var setOwner = async ({ context, args, signed: signed2 }) => {
79872
+ const [appId, ownerUserId] = args.words.slice(2);
79873
+ if (!appId || !ownerUserId) {
79874
+ throw new CliUsageError("Usage: laze app set-owner <app id> <person id>");
79875
+ }
79876
+ const client = await signed2();
79877
+ const app2 = await client.post("/api/apps/admin/owner", { appId, ownerUserId });
79878
+ const text3 = `${app2.name} now belongs to ${app2.ownerName ?? ownerUserId}. The old owner keeps access and is told.
79879
+ `;
79880
+ print2({ context, args, value: app2, text: text3 });
79881
+ };
79882
+ var adminUnpublish = async ({ context, args, signed: signed2 }) => {
79883
+ const appId = args.words[2];
79884
+ if (!appId) throw new CliUsageError("Usage: laze app admin-unpublish <app id>");
79885
+ const client = await signed2();
79886
+ await client.post("/api/apps/admin/unpublish", { appId });
79887
+ const text3 = `${appId} is offline. Its data and versions stay.
79888
+ `;
79889
+ print2({ context, args, value: { unpublished: appId }, text: text3 });
79890
+ };
79737
79891
  var publicApps = async ({ context, args, signed: signed2 }) => {
79738
79892
  const word3 = args.words[2];
79739
79893
  if (word3 !== void 0 && word3 !== "on" && word3 !== "off") {
@@ -79825,6 +79979,9 @@ var appManageCommands = {
79825
79979
  unarchive,
79826
79980
  delete: remove,
79827
79981
  "revoke-lease": revokeLease,
79982
+ "admin-list": adminList,
79983
+ "set-owner": setOwner,
79984
+ "admin-unpublish": adminUnpublish,
79828
79985
  "public-apps": publicApps,
79829
79986
  backups,
79830
79987
  restore,
@@ -79916,7 +80073,7 @@ async function appPinsCommand({
79916
80073
  if (!channel) throw new CliUsageError(USAGE3);
79917
80074
  const client = await signed2();
79918
80075
  const order = flagText({ args, name: "order" });
79919
- const appIds = order.split(",").map((id2) => id2.trim()).filter(Boolean);
80076
+ const appIds = order.split(",").map((id4) => id4.trim()).filter(Boolean);
79920
80077
  const listed = appIds.length ? await client.post("/api/apps/pins/order", { channel, appIds }) : await client.post("/api/apps/pins", { channel });
79921
80078
  print3({ context, args, value: listed, text: pinsText({ channel, listed }) });
79922
80079
  }
@@ -81077,11 +81234,11 @@ function isSubjectType(type) {
81077
81234
  }
81078
81235
  function subjectOf(word3) {
81079
81236
  const [type, ...rest] = (word3 ?? "").split(":");
81080
- const id2 = rest.join(":");
81081
- if (!isSubjectType(type) || !id2) {
81237
+ const id4 = rest.join(":");
81238
+ if (!isSubjectType(type) || !id4) {
81082
81239
  throw new CliUsageError("Name who with user:<id>, agent:<id>, channel:<id> or group:<id>");
81083
81240
  }
81084
- return { type, id: id2 };
81241
+ return { type, id: id4 };
81085
81242
  }
81086
81243
  function agentPathText(path) {
81087
81244
  if (!path) return "you cannot open the app yourself, so you cannot let it in";
@@ -81388,6 +81545,9 @@ var APP_COMMANDS = {
81388
81545
  unarchive: managed(appManageCommands.unarchive),
81389
81546
  delete: managed(appManageCommands.delete),
81390
81547
  "revoke-lease": managed(appManageCommands["revoke-lease"]),
81548
+ "admin-list": managed(appManageCommands["admin-list"]),
81549
+ "set-owner": managed(appManageCommands["set-owner"]),
81550
+ "admin-unpublish": managed(appManageCommands["admin-unpublish"]),
81391
81551
  "public-apps": managed(appManageCommands["public-apps"]),
81392
81552
  backups: managed(appManageCommands.backups),
81393
81553
  restore: managed(appManageCommands.restore),
@@ -82103,13 +82263,13 @@ async function vaultRelease({
82103
82263
  context,
82104
82264
  args,
82105
82265
  connection,
82106
- reason,
82266
+ reason: reason2,
82107
82267
  command
82108
82268
  }) {
82109
82269
  const deadline = deadlineOf({ args, nowMs: context.nowMs() });
82110
82270
  const env = context.environment.inherited;
82111
82271
  const proxy = proxyOf({ env });
82112
- if (!proxy) return keyRelease({ context, args, connection, reason, command, deadline });
82272
+ if (!proxy) return keyRelease({ context, args, connection, reason: reason2, command, deadline });
82113
82273
  const turnFile = turnFileOf({ env });
82114
82274
  const headers = {
82115
82275
  "proxy-authorization": proxy.authorization,
@@ -82117,7 +82277,7 @@ async function vaultRelease({
82117
82277
  };
82118
82278
  const keyPath = runKeyPathOf({ turnFile, connection });
82119
82279
  const run4 = await runKeyAt({ path: keyPath });
82120
- const body = JSON.stringify({ connection, reason, command, recipient: run4.publicKey });
82280
+ const body = JSON.stringify({ connection, reason: reason2, command, recipient: run4.publicKey });
82121
82281
  let release2;
82122
82282
  try {
82123
82283
  const first = await releaseOf({
@@ -82190,7 +82350,7 @@ async function keyRelease({
82190
82350
  context,
82191
82351
  args,
82192
82352
  connection,
82193
- reason,
82353
+ reason: reason2,
82194
82354
  command,
82195
82355
  deadline
82196
82356
  }) {
@@ -82203,7 +82363,7 @@ async function keyRelease({
82203
82363
  const client = forSession({ client: signed2.client, session: harnessSession });
82204
82364
  const keyPath = runKeyPathOf({ turnFile: void 0, connection, profile: name3 });
82205
82365
  const run4 = await runKeyAt({ path: keyPath });
82206
- const body = { connection, reason, command, recipient: run4.publicKey };
82366
+ const body = { connection, reason: reason2, command, recipient: run4.publicKey };
82207
82367
  const door = signed2.profile.kind === "person" ? {
82208
82368
  ask: "/api/vault/session/release",
82209
82369
  status: "/api/vault/session/release-status",
@@ -82223,9 +82383,9 @@ async function vaultRun({
82223
82383
  args
82224
82384
  }) {
82225
82385
  const connection = args.words[2];
82226
- const reason = flagText({ args, name: "reason" });
82386
+ const reason2 = flagText({ args, name: "reason" });
82227
82387
  if (!connection || args.rest.length === 0) throw new CliUsageError(USAGE6);
82228
- if (!reason) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
82388
+ if (!reason2) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
82229
82389
  ${USAGE6}`);
82230
82390
  const foreign = commandReferenceNames({ command: args.rest }).find(
82231
82391
  (name3) => vaultReferenceConnectionName({ name: name3 }) !== connection
@@ -82238,7 +82398,7 @@ ${USAGE6}`);
82238
82398
  );
82239
82399
  return 1;
82240
82400
  }
82241
- const released = await vaultRelease({ context, args, connection, reason, command: args.rest });
82401
+ const released = await vaultRelease({ context, args, connection, reason: reason2, command: args.rest });
82242
82402
  if ("exitCode" in released) return released.exitCode;
82243
82403
  const prepared = preparedCommand({
82244
82404
  command: args.rest,
@@ -82428,12 +82588,12 @@ async function loginOnTab(run4) {
82428
82588
  `Name the saved sign-in with --vault <connection>
82429
82589
  ${BROWSER_TAB_USAGE}`
82430
82590
  );
82431
- const reason = flagText({ args, name: "reason" }) || `Sign in on the ${tab} browser tab of the conversation`;
82591
+ const reason2 = flagText({ args, name: "reason" }) || `Sign in on the ${tab} browser tab of the conversation`;
82432
82592
  const released = await vaultRelease({
82433
82593
  context,
82434
82594
  args,
82435
82595
  connection,
82436
- reason,
82596
+ reason: reason2,
82437
82597
  command: ["laze", "browser", "login", tab]
82438
82598
  });
82439
82599
  if ("exitCode" in released) return released.exitCode;
@@ -82688,8 +82848,8 @@ async function browserCall({
82688
82848
  });
82689
82849
  socket.once(
82690
82850
  "close",
82691
- (_code, reason) => reject(
82692
- new Error(`${method}: ${reason.toString("utf8") || "the machine closed the socket"}`)
82851
+ (_code, reason2) => reject(
82852
+ new Error(`${method}: ${reason2.toString("utf8") || "the machine closed the socket"}`)
82693
82853
  )
82694
82854
  );
82695
82855
  socket.send(JSON.stringify({ id: 1, method, params }));
@@ -84564,7 +84724,7 @@ var billingConfig = Config.define((c) => ({
84564
84724
  earlierTeamPriceIds: c.env(
84565
84725
  "STRIPE_PRICES_TEAM_EARLIER",
84566
84726
  external_exports.string().optional().transform(
84567
- (value) => (value ?? "").split(",").map((id2) => id2.trim()).filter(Boolean)
84727
+ (value) => (value ?? "").split(",").map((id4) => id4.trim()).filter(Boolean)
84568
84728
  )
84569
84729
  ),
84570
84730
  /** The product every top-up and auto-recharge line names; a bare line without it. */
@@ -85193,6 +85353,7 @@ var complimentaryComputerDefinition = external_exports.object({
85193
85353
  grantedByUserId: external_exports.string(),
85194
85354
  grantedAt: external_exports.iso.datetime()
85195
85355
  });
85356
+ var complimentaryComputerSchema = complimentaryComputerDefinition;
85196
85357
  var setComplimentaryComputerInputDefinition = external_exports.object({
85197
85358
  workspaceId: external_exports.string().min(1),
85198
85359
  userId: external_exports.string().min(1),
@@ -85587,10 +85748,46 @@ var whatsappPairingDefinition = external_exports.object({
85587
85748
  state: external_exports.enum(["starting", "scan", "paired", "failed"]),
85588
85749
  /** The code as an SVG data URL, while `state` is `scan`. */
85589
85750
  qrSvg: external_exports.string().nullable(),
85751
+ /** The code to type on the phone, when the pairing named a phone number. */
85752
+ phoneCode: external_exports.string().nullable().default(null),
85590
85753
  /** "Mia (+31 6 1234 5678)" once paired. */
85591
85754
  linkedAs: external_exports.string().nullable(),
85592
85755
  error: external_exports.string().nullable()
85593
85756
  });
85757
+ var pairInputDefinition = external_exports.object({
85758
+ workspaceId: workspaceIdSchema20,
85759
+ machine: machineRefText2,
85760
+ /** The person's number with country code; absent, only a QR code is made. */
85761
+ phone: external_exports.string().trim().min(7).max(24).regex(/^\+?[0-9 ()-]+$/).optional()
85762
+ });
85763
+ var whatsappPairInputSchema = pairInputDefinition;
85764
+ var whatsappOnlineModeSchema = external_exports.enum(["never", "active"]);
85765
+ var mirrorSettingsDefinition = external_exports.object({
85766
+ machineId: external_exports.string(),
85767
+ mirrorOn: external_exports.boolean(),
85768
+ onlineMode: whatsappOnlineModeSchema,
85769
+ agentsRead: external_exports.boolean()
85770
+ });
85771
+ var whatsappMirrorSettingsSchema = mirrorSettingsDefinition;
85772
+ var setMirrorSettingsDefinition = external_exports.object({
85773
+ workspaceId: workspaceIdSchema20,
85774
+ machine: machineRefText2,
85775
+ mirrorOn: external_exports.boolean().optional(),
85776
+ onlineMode: whatsappOnlineModeSchema.optional(),
85777
+ agentsRead: external_exports.boolean().optional()
85778
+ });
85779
+ var setWhatsappMirrorInputSchema = setMirrorSettingsDefinition;
85780
+ var whatsappChangeDefinition = external_exports.object({
85781
+ chat: external_exports.string().min(1).max(200),
85782
+ chatName: external_exports.string().max(500),
85783
+ group: external_exports.boolean(),
85784
+ id: external_exports.string().min(1).max(200),
85785
+ at: external_exports.string(),
85786
+ fromMe: external_exports.boolean(),
85787
+ sender: external_exports.string().max(500),
85788
+ text: external_exports.string(),
85789
+ deleted: external_exports.boolean()
85790
+ });
85594
85791
  var whatsappPairingSchema = whatsappPairingDefinition;
85595
85792
  var pairingRefDefinition = external_exports.object({
85596
85793
  workspaceId: workspaceIdSchema20,
@@ -85920,7 +86117,7 @@ var ownMachineSshConnectDefinition = external_exports.object({
85920
86117
  var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
85921
86118
  var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, machineId: idSchema23 });
85922
86119
  var ComputeApi = moduleApi()("compute");
85923
- var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(machineRefSchema).withOutput(whatsappPairingSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
86120
+ var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
85924
86121
  var computeFleetTrpc = defineTrpcContract("compute").query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
85925
86122
  var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
85926
86123
  var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
@@ -86571,8 +86768,8 @@ async function recheckTools({ relay: relay2, listed }) {
86571
86768
  listed.busy = true;
86572
86769
  try {
86573
86770
  listed.asked += 1;
86574
- const id2 = `laze-relist-${listed.asked}`;
86575
- const line = JSON.stringify({ jsonrpc: "2.0", id: id2, method: "tools/list" });
86771
+ const id4 = `laze-relist-${listed.asked}`;
86772
+ const line = JSON.stringify({ jsonrpc: "2.0", id: id4, method: "tools/list" });
86576
86773
  const names = toolNamesOf(await relay2.post({ line, turn }));
86577
86774
  listed.turn = turn;
86578
86775
  if (names !== null && names !== listed.names) {
@@ -86645,8 +86842,8 @@ async function connect({
86645
86842
  `);
86646
86843
  return;
86647
86844
  }
86648
- const reason = flagText({ args, name: "reason" }).trim();
86649
- if (!service || !reason) {
86845
+ const reason2 = flagText({ args, name: "reason" }).trim();
86846
+ if (!service || !reason2) {
86650
86847
  throw new CliUsageError(
86651
86848
  'Usage: laze connect suggest <service> --reason "<one plain sentence>"'
86652
86849
  );
@@ -86657,7 +86854,7 @@ async function connect({
86657
86854
  }
86658
86855
  const answer6 = await turned.post("/api/connectors/suggest", {
86659
86856
  service,
86660
- reason,
86857
+ reason: reason2,
86661
86858
  keychain: keychain2
86662
86859
  });
86663
86860
  if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
@@ -86749,15 +86946,15 @@ function printGrant({ context, grant }) {
86749
86946
  var grantTo = async ({ context, args }) => {
86750
86947
  const [kind2 = "", ...rest] = flagText({ args, name: "to" }).split(":");
86751
86948
  const subject = SUBJECTS.find((one) => one === kind2);
86752
- const id2 = rest.join(":");
86753
- if (!subject || !id2) {
86949
+ const id4 = rest.join(":");
86950
+ if (!subject || !id4) {
86754
86951
  throw new CliUsageError("--to is person:<id>, group:<id>, channel:<id> or agent:<id>.");
86755
86952
  }
86756
86953
  const { client } = await signedIn({ context, args });
86757
86954
  const target = await connectionOf({ client, args, word: args.words[2] });
86758
86955
  const grant = await client.post("/api/vault/grants", {
86759
86956
  connectionId: target.id,
86760
- subject: { kind: subject, id: id2 },
86957
+ subject: { kind: subject, id: id4 },
86761
86958
  ...durationOf(args)
86762
86959
  });
86763
86960
  if (args.flags.json) return printJson4({ context, data: grant });
@@ -88234,8 +88431,8 @@ var DOMAINS_USAGE = `Usage:
88234
88431
  var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
88235
88432
  `);
88236
88433
  function printDomain(context, row) {
88237
- const join31 = row.autoJoin ? "auto-join on" : "auto-join off";
88238
- context.out(`${row.domain} ${join31}${row.enforced ? " single sign-on enforced" : ""}
88434
+ const join32 = row.autoJoin ? "auto-join on" : "auto-join off";
88435
+ context.out(`${row.domain} ${join32}${row.enforced ? " single sign-on enforced" : ""}
88239
88436
  `);
88240
88437
  }
88241
88438
  async function list4({ context, args }) {
@@ -91914,7 +92111,7 @@ async function connect2({ context, args }) {
91914
92111
  sensitivity: sensitivity2
91915
92112
  });
91916
92113
  const { connection, relayKey } = answer6;
91917
- const rest = Object.fromEntries(Object.entries(relays).filter(([id2]) => id2 !== kept?.[0]));
92114
+ const rest = Object.fromEntries(Object.entries(relays).filter(([id4]) => id4 !== kept?.[0]));
91918
92115
  await saveMcpRelays({
91919
92116
  context,
91920
92117
  relays: {
@@ -92519,12 +92716,12 @@ async function vaultEnv({
92519
92716
  throw new CliUsageError(`--vault takes a connection name
92520
92717
  ${USAGE12}`);
92521
92718
  if (connections.length === 0) return {};
92522
- const reason = flagText({ args, name: "reason" });
92523
- if (!reason) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
92719
+ const reason2 = flagText({ args, name: "reason" });
92720
+ if (!reason2) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
92524
92721
  ${USAGE12}`);
92525
92722
  const env = {};
92526
92723
  for (const connection of new Set(connections)) {
92527
- const released = await vaultRelease({ context, args, connection, reason, command: args.rest });
92724
+ const released = await vaultRelease({ context, args, connection, reason: reason2, command: args.rest });
92528
92725
  if ("exitCode" in released) return released;
92529
92726
  Object.assign(env, released.env);
92530
92727
  }
@@ -92674,8 +92871,8 @@ function recordOf3(value) {
92674
92871
  function idsOf(message2) {
92675
92872
  const messages = Array.isArray(message2) ? message2 : [message2];
92676
92873
  return messages.flatMap((each) => {
92677
- const id2 = recordOf3(each).id;
92678
- return id2 === void 0 || id2 === null ? [] : [id2];
92874
+ const id4 = recordOf3(each).id;
92875
+ return id4 === void 0 || id4 === null ? [] : [id4];
92679
92876
  });
92680
92877
  }
92681
92878
  function toolResultOf({ text: text3, isError }) {
@@ -92738,11 +92935,11 @@ function refusedLines2({
92738
92935
  }) {
92739
92936
  const migrated = status11 === 401 ? migratedNoticeOf(apiErrorOf({ status: status11, text: text3 })) : void 0;
92740
92937
  const refused = status11 === 401 ? "Laze refused this key: run `laze login` or link the agent again" : `Laze answered ${status11}`;
92741
- const reason = migrated?.notice ?? refused;
92742
- const errors = idsOf(message2).map((id2) => ({
92938
+ const reason2 = migrated?.notice ?? refused;
92939
+ const errors = idsOf(message2).map((id4) => ({
92743
92940
  jsonrpc: "2.0",
92744
- id: id2,
92745
- error: { code: SERVER_REFUSED, message: reason }
92941
+ id: id4,
92942
+ error: { code: SERVER_REFUSED, message: reason2 }
92746
92943
  }));
92747
92944
  if (errors.length === 0) return [];
92748
92945
  return [JSON.stringify(Array.isArray(message2) ? errors : errors[0])];
@@ -93027,7 +93224,7 @@ function logTarget({
93027
93224
  const layer = flagText({ args, name: "layer", fallback: "person" });
93028
93225
  if (layer !== "person" && layer !== "agent") throw new CliUsageError(USAGE13);
93029
93226
  const channel = turn ? flagText({ args, name: "channel" }) : turnChannel({ context, args });
93030
- const messages = (context.environment.inherited.LAZE_TURN_MESSAGES ?? "").split(",").map((id2) => id2.trim()).filter(Boolean);
93227
+ const messages = (context.environment.inherited.LAZE_TURN_MESSAGES ?? "").split(",").map((id4) => id4.trim()).filter(Boolean);
93031
93228
  const message2 = flagText({ args, name: "message" }) || messages.at(-1) || "";
93032
93229
  const person = flagText({ args, name: "person" });
93033
93230
  return {
@@ -93083,9 +93280,9 @@ async function logCall({
93083
93280
  printAnswer2({ context, args, answer: answer6 });
93084
93281
  }
93085
93282
  function entryId(args) {
93086
- const id2 = Number((args.words[2] ?? "").replace(/^#/, ""));
93087
- if (!Number.isInteger(id2) || id2 < 0) throw new CliUsageError(USAGE13);
93088
- return id2;
93283
+ const id4 = Number((args.words[2] ?? "").replace(/^#/, ""));
93284
+ if (!Number.isInteger(id4) || id4 < 0) throw new CliUsageError(USAGE13);
93285
+ return id4;
93089
93286
  }
93090
93287
  function blockArg(args) {
93091
93288
  const block2 = (args.words[2] ?? "").replace(/^#/, "");
@@ -93097,9 +93294,9 @@ async function memoryNote({ context, args }) {
93097
93294
  await logCall({ context, args, path: "note", body: line });
93098
93295
  }
93099
93296
  async function memoryCorrect({ context, args }) {
93100
- const id2 = entryId(args);
93297
+ const id4 = entryId(args);
93101
93298
  const line = await taggedLine({ context, args, from: 3 });
93102
- await logCall({ context, args, path: "correct", body: { id: id2, ...line } });
93299
+ await logCall({ context, args, path: "correct", body: { id: id4, ...line } });
93103
93300
  }
93104
93301
  async function memoryRemove({ context, args }) {
93105
93302
  await logCall({ context, args, path: "remove", body: { id: entryId(args) } });
@@ -93639,7 +93836,7 @@ var connectLocal = async ({ context, args, client, url: url2 }) => {
93639
93836
  ...label3 && { label: label3 }
93640
93837
  });
93641
93838
  const { connection, relayKey } = answer6;
93642
- const rest = Object.fromEntries(Object.entries(relays).filter(([id2]) => id2 !== kept?.[0]));
93839
+ const rest = Object.fromEntries(Object.entries(relays).filter(([id4]) => id4 !== kept?.[0]));
93643
93840
  await saveRelays({
93644
93841
  context,
93645
93842
  relays: { ...rest, [connection.id]: { url: url2, relayKey, gatewayUrl: gatewayUrl2, label: connection.label } }
@@ -93738,17 +93935,1465 @@ async function openclaw({
93738
93935
  await run4({ context, args, client, url: profile.url });
93739
93936
  }
93740
93937
 
93938
+ // src/services/operator-key-commands.service.ts
93939
+ import { createHash as createHash5, randomBytes as randomBytes3 } from "node:crypto";
93940
+ import { mkdir as mkdir23, readFile as readFile38, rm as rm14, writeFile as writeFile23 } from "node:fs/promises";
93941
+ import { dirname as dirname23, join as join27 } from "node:path";
93942
+
93943
+ // ../../modules/audit-log/contract/src/audit-log.api.ts
93944
+ var auditEntrySchemaDefinition = external_exports.object({
93945
+ id: external_exports.string(),
93946
+ workspaceId: external_exports.string(),
93947
+ actorType: external_exports.enum(["user", "api_key", "system", "internal", "anonymous"]),
93948
+ actorId: external_exports.string().nullable(),
93949
+ /** Laze staff viewing Laze as the actor when this happened; null otherwise. */
93950
+ impersonatorId: external_exports.string().nullable().default(null),
93951
+ action: external_exports.string(),
93952
+ targetKind: external_exports.string().nullable(),
93953
+ targetId: external_exports.string().nullable(),
93954
+ errorCode: external_exports.string().nullable(),
93955
+ ipAddress: external_exports.string().nullable(),
93956
+ /** ISO 8601. */
93957
+ createdAt: external_exports.iso.datetime()
93958
+ });
93959
+ var auditEntrySchema = auditEntrySchemaDefinition;
93960
+ var listAuditEntriesInputSchemaDefinition = external_exports.object({
93961
+ workspaceId: external_exports.string().min(1),
93962
+ limit: external_exports.number().int().min(1).max(200).default(50)
93963
+ });
93964
+ var listAuditEntriesInputSchema = listAuditEntriesInputSchemaDefinition;
93965
+ var AuditLogApi = moduleApi()("audit-log");
93966
+
93967
+ // ../../modules/audit-log/contract/src/audit-log.trpc.ts
93968
+ var auditLogTrpc = defineTrpcContract("auditLog").query("list").withInput(listAuditEntriesInputSchema).withOutput(external_exports.array(auditEntrySchema)).build();
93969
+
93970
+ // ../../modules/auth/contract/src/auth-sign-up-guard.ts
93971
+ var captchaSettingsSchemaDefinition = external_exports.object({
93972
+ siteKey: external_exports.string().min(1),
93973
+ exemptDomains: external_exports.array(external_exports.string())
93974
+ });
93975
+ var captchaSettingsSchema = captchaSettingsSchemaDefinition;
93976
+ var verificationStatusSchemaDefinition = external_exports.discriminatedUnion("state", [
93977
+ external_exports.object({ state: external_exports.literal("none") }),
93978
+ external_exports.object({ state: external_exports.literal("verified") }),
93979
+ external_exports.object({ state: external_exports.literal("pending"), email: external_exports.string() })
93980
+ ]);
93981
+
93982
+ // ../../modules/auth/contract/src/auth.api.ts
93983
+ var authUserSchemaDefinition = external_exports.object({
93984
+ id: external_exports.string().min(1),
93985
+ email: external_exports.string(),
93986
+ name: external_exports.string(),
93987
+ image: external_exports.string().nullable(),
93988
+ emailVerified: external_exports.boolean(),
93989
+ /** BCP 47; absent or en-US until the person picks another (language.feature). */
93990
+ language: external_exports.string().optional()
93991
+ });
93992
+ var authUserSchema = authUserSchemaDefinition;
93993
+ var deviceKeysSchemaDefinition = external_exports.object({
93994
+ userId: external_exports.string().min(1),
93995
+ cacheKey: external_exports.string().min(1),
93996
+ previousCacheKey: external_exports.string().min(1),
93997
+ /** Seals what the person typed; the same on every session, so it survives one ending. */
93998
+ draftKey: external_exports.string().min(1)
93999
+ });
94000
+ var deviceKeysSchema = deviceKeysSchemaDefinition;
94001
+ var ssoConnectionSchemaDefinition = external_exports.object({
94002
+ /** The address segment of the sign-in callback, `/api/auth/sso/callback/<providerId>`. */
94003
+ providerId: external_exports.string().regex(/^[a-z0-9-]{3,64}$/),
94004
+ workspaceId: external_exports.string().min(1),
94005
+ /** Email domain whose people this connection signs in, verified by its owner. */
94006
+ domain: external_exports.string().min(3),
94007
+ issuer: external_exports.url(),
94008
+ clientId: external_exports.string().min(1),
94009
+ clientSecret: external_exports.string().min(1),
94010
+ authorizationEndpoint: external_exports.url(),
94011
+ tokenEndpoint: external_exports.url(),
94012
+ jwksEndpoint: external_exports.url(),
94013
+ userInfoEndpoint: external_exports.url().optional()
94014
+ });
94015
+ var domainRouteSchemaDefinition = external_exports.object({
94016
+ domain: external_exports.string().min(3),
94017
+ workspaceId: external_exports.string().min(1),
94018
+ /** `google`: Google Workspace, whose hosted domain must be `domain`. `oidc`: a connection. */
94019
+ provider: external_exports.enum(["google", "oidc"]),
94020
+ /** The connection an `oidc` route signs in through; null for Google Workspace. */
94021
+ providerId: external_exports.string().nullable(),
94022
+ /** Enforced: the domain's people sign in through this route and no other way. */
94023
+ enforced: external_exports.boolean()
94024
+ });
94025
+ var signInRouteSchemaDefinition = external_exports.discriminatedUnion("kind", [
94026
+ external_exports.object({ kind: external_exports.literal("open") }),
94027
+ external_exports.object({ kind: external_exports.literal("google"), domain: external_exports.string(), enforced: external_exports.boolean() }),
94028
+ external_exports.object({
94029
+ kind: external_exports.literal("sso"),
94030
+ domain: external_exports.string(),
94031
+ providerId: external_exports.string(),
94032
+ enforced: external_exports.boolean()
94033
+ })
94034
+ ]);
94035
+ var signInRouteSchema = signInRouteSchemaDefinition;
94036
+ var presenceMethodsSchemaDefinition = external_exports.object({ password: external_exports.boolean(), google: external_exports.boolean() });
94037
+ var signInOptionsSchemaDefinition = external_exports.object({
94038
+ google: external_exports.boolean(),
94039
+ apple: external_exports.boolean(),
94040
+ /** The sign-up captcha for plus addresses; absent from servers older than it. */
94041
+ captcha: captchaSettingsSchema.optional()
94042
+ });
94043
+ var signInOptionsSchema = signInOptionsSchemaDefinition;
94044
+ var appSiteAssociationSchemaDefinition = external_exports.discriminatedUnion("kind", [
94045
+ external_exports.object({ kind: external_exports.literal("off") }),
94046
+ external_exports.object({ kind: external_exports.literal("on"), json: external_exports.string() })
94047
+ ]);
94048
+ var pictureSourceSchema = external_exports.enum(["google", "slack", "discord", "upload"]);
94049
+ var AuthApi = moduleApi()("auth");
94050
+ var nativePairingSchemaDefinition = external_exports.object({
94051
+ /** Two groups of four, such as `BCDF-GHJK`; typed in any case, with or without the dash. */
94052
+ code: external_exports.string(),
94053
+ expiresAt: external_exports.iso.datetime(),
94054
+ /** `laze://pair?code=...&server=...`, what a QR code would carry. */
94055
+ link: external_exports.string(),
94056
+ /** The same code as an https link on this server. */
94057
+ url: external_exports.string()
94058
+ });
94059
+
94060
+ // ../../modules/auth/contract/src/auth-join.ts
94061
+ var joinWaySchema = external_exports.enum(["request", "join", "provider"]);
94062
+ var joinOfferSchemaDefinition = external_exports.object({
94063
+ workspaceId: external_exports.string().min(1),
94064
+ workspaceName: external_exports.string(),
94065
+ /** Coarse: exact below 10, then rounded down to 10s, 50s from 100 and 100s from 1000. */
94066
+ colleagues: external_exports.number().int().min(0),
94067
+ way: joinWaySchema
94068
+ });
94069
+ var joinOfferSchema = joinOfferSchemaDefinition;
94070
+ var pendingJoinSchemaDefinition = external_exports.object({
94071
+ requestId: external_exports.string().min(1),
94072
+ workspaceId: external_exports.string().min(1),
94073
+ workspaceName: external_exports.string(),
94074
+ /** ISO 8601. */
94075
+ createdAt: external_exports.iso.datetime()
94076
+ });
94077
+ var pendingJoinSchema = pendingJoinSchemaDefinition;
94078
+ var joinOfferReadingSchemaDefinition = external_exports.object({
94079
+ offers: external_exports.array(joinOfferSchema),
94080
+ /** The person's own requests still waiting for an admin. */
94081
+ pending: external_exports.array(pendingJoinSchema)
94082
+ });
94083
+ var joinOfferReadingSchema = joinOfferReadingSchemaDefinition;
94084
+ var joinAnswerSchemaDefinition = external_exports.object({
94085
+ workspaceId: external_exports.string().min(1),
94086
+ requestId: external_exports.string().min(1),
94087
+ /** True when the person is now a Member; false while the request waits for an admin. */
94088
+ joined: external_exports.boolean()
94089
+ });
94090
+ var joinAnswerSchema = joinAnswerSchemaDefinition;
94091
+ var joinDomainSchemaDefinition = external_exports.object({
94092
+ domain: external_exports.string(),
94093
+ /** People with a verified address on the domain join as Members without asking. */
94094
+ autoJoin: external_exports.boolean(),
94095
+ /** The domain signs in through its provider alone, which adds its people itself. */
94096
+ enforced: external_exports.boolean()
94097
+ });
94098
+ var joinDomainSchema = joinDomainSchemaDefinition;
94099
+ var setDomainAutoJoinInputSchemaDefinition = external_exports.object({
94100
+ workspaceId: external_exports.string().min(1),
94101
+ domain: external_exports.string().trim().toLowerCase().min(3).max(253),
94102
+ autoJoin: external_exports.boolean()
94103
+ });
94104
+ var setDomainAutoJoinInputSchema = setDomainAutoJoinInputSchemaDefinition;
94105
+
94106
+ // ../../modules/auth/contract/src/auth-analytics-consent.ts
94107
+ var analyticsConsentSourceSchema = external_exports.enum([
94108
+ "sign_up",
94109
+ "this_browser",
94110
+ "app_prompt",
94111
+ "app_prompt_closed",
94112
+ "settings"
94113
+ ]);
94114
+ var chosenDefinition = external_exports.object({
94115
+ kind: external_exports.literal("chosen"),
94116
+ analytics: external_exports.boolean(),
94117
+ decidedAt: external_exports.string(),
94118
+ source: analyticsConsentSourceSchema
94119
+ });
94120
+ var analyticsConsentReadingDefinition = external_exports.discriminatedUnion("kind", [
94121
+ chosenDefinition,
94122
+ external_exports.object({ kind: external_exports.literal("not_chosen") })
94123
+ ]);
94124
+ var analyticsConsentReadingSchema = analyticsConsentReadingDefinition;
94125
+ var setAnalyticsConsentInputDefinition = external_exports.object({
94126
+ analytics: external_exports.boolean(),
94127
+ /** `sign_up` is only ever taken from the sign-up answer, never sent. */
94128
+ source: analyticsConsentSourceSchema.exclude(["sign_up"])
94129
+ });
94130
+ var setAnalyticsConsentInputSchema = setAnalyticsConsentInputDefinition;
94131
+
94132
+ // ../../modules/auth/contract/src/auth-impersonation.ts
94133
+ var IMPERSONATION_MAX_MINUTES = 60;
94134
+ var personDefinition2 = external_exports.object({ id: external_exports.string(), name: external_exports.string(), email: external_exports.string() });
94135
+ var impersonationDefinition = external_exports.object({
94136
+ id: external_exports.string(),
94137
+ operator: personDefinition2,
94138
+ target: personDefinition2,
94139
+ workspaceId: external_exports.string().nullable(),
94140
+ reason: external_exports.string(),
94141
+ startedAt: external_exports.iso.datetime(),
94142
+ endsAt: external_exports.iso.datetime()
94143
+ });
94144
+ var impersonationSchema = impersonationDefinition;
94145
+ var startImpersonationDefinition = external_exports.object({
94146
+ targetUserId: external_exports.string().min(1),
94147
+ workspaceId: external_exports.string().min(1).nullable(),
94148
+ reason: external_exports.string().trim().min(3).max(500),
94149
+ minutes: external_exports.number().int().min(1).max(IMPERSONATION_MAX_MINUTES)
94150
+ });
94151
+ var userSummaryDefinition = external_exports.object({
94152
+ id: external_exports.string(),
94153
+ name: external_exports.string(),
94154
+ email: external_exports.string(),
94155
+ emailVerified: external_exports.boolean(),
94156
+ createdAt: external_exports.iso.datetime()
94157
+ });
94158
+ var authUserSummarySchema = userSummaryDefinition;
94159
+
94160
+ // ../../modules/workspace/contract/src/sign-up-source.ts
94161
+ var TAG = /^[\p{L}\p{N} ._\-+:/@|]{1,100}$/u;
94162
+ var PERSONA = /^[a-z0-9-]{1,40}$/;
94163
+ var REFERRAL_CODE = /^[0-9A-Za-z]{4,64}$/;
94164
+ var HOST = /^[a-z0-9.-]{1,253}$/;
94165
+ var tagSchema = external_exports.string().regex(TAG).nullable();
94166
+ var signUpSourceSchemaDefinition = external_exports.object({
94167
+ source: tagSchema,
94168
+ medium: tagSchema,
94169
+ campaign: tagSchema,
94170
+ content: tagSchema,
94171
+ term: tagSchema,
94172
+ /** The host of the outside page that sent the visitor; null for none or Laze's own pages. */
94173
+ referrer: external_exports.string().regex(HOST).nullable(),
94174
+ /** The path of the first page the visitor opened, without its query. */
94175
+ landingPath: external_exports.string().startsWith("/").max(200).nullable(),
94176
+ /** The persona page the visitor came through, such as `sales` for `/for/sales`. */
94177
+ persona: external_exports.string().regex(PERSONA).nullable(),
94178
+ /** The code of the referral link the visitor first opened. */
94179
+ referralCode: external_exports.string().regex(REFERRAL_CODE).nullable()
94180
+ });
94181
+ var signUpSourceSchema = signUpSourceSchemaDefinition;
94182
+ var HEARD_FROM_ANSWERS = [
94183
+ "reddit",
94184
+ "linkedin",
94185
+ "x",
94186
+ "search",
94187
+ "ai-assistant",
94188
+ "newsletter",
94189
+ "friend",
94190
+ "other"
94191
+ ];
94192
+ var heardFromSchema = external_exports.enum(HEARD_FROM_ANSWERS);
94193
+ var heardFromOtherSchema = external_exports.string().trim().min(1).max(120);
94194
+
94195
+ // ../../modules/workspace/contract/src/workspace-access.ts
94196
+ var MAX_INVITES_PER_BATCH = 50;
94197
+ var inviteLandingSchemaDefinition = external_exports.discriminatedUnion("kind", [
94198
+ external_exports.object({ kind: external_exports.literal("conversation"), channelId: external_exports.string().min(1).max(200) }),
94199
+ external_exports.object({
94200
+ kind: external_exports.literal("agent"),
94201
+ agentId: external_exports.string().min(1).max(200),
94202
+ /** The agent's chat, opened on joining. */
94203
+ channelId: external_exports.string().min(1).max(200)
94204
+ })
94205
+ ]);
94206
+ var inviteLandingSchema = inviteLandingSchemaDefinition;
94207
+ var accessRequestKindSchema = external_exports.enum(["invite", "join"]);
94208
+ var accessRequestStatusSchema = external_exports.enum([
94209
+ "pending",
94210
+ "approved",
94211
+ "denied",
94212
+ "withdrawn",
94213
+ "expired"
94214
+ ]);
94215
+ var accessRequestSchemaDefinition = external_exports.object({
94216
+ id: external_exports.string().min(1),
94217
+ workspaceId: external_exports.string().min(1),
94218
+ kind: accessRequestKindSchema,
94219
+ /** The person who would join. */
94220
+ email: external_exports.string(),
94221
+ name: external_exports.string(),
94222
+ role: workspaceRoleSchema,
94223
+ requestedByUserId: external_exports.string(),
94224
+ requestedByName: external_exports.string(),
94225
+ status: accessRequestStatusSchema,
94226
+ /** `admin`, `policy` (a domain that admits its people) or `invite` (an invitation answered). */
94227
+ decidedVia: external_exports.enum(["admin", "policy", "invite"]).nullable(),
94228
+ decidedByUserId: external_exports.string().nullable(),
94229
+ /** ISO 8601. */
94230
+ createdAt: external_exports.iso.datetime(),
94231
+ expiresAt: external_exports.iso.datetime(),
94232
+ /** Where an invite request's person lands on joining; null for the workspace's Home. */
94233
+ landing: inviteLandingSchemaDefinition.nullable().optional()
94234
+ });
94235
+ var accessRequestSchema = accessRequestSchemaDefinition;
94236
+ var requestInviteInputSchemaDefinition = external_exports.object({
94237
+ workspaceId: external_exports.string().min(1),
94238
+ email: external_exports.email().max(320),
94239
+ role: workspaceRoleSchema
94240
+ });
94241
+ var requestInviteInputSchema = requestInviteInputSchemaDefinition;
94242
+ var decideAccessRequestInputSchemaDefinition = external_exports.object({
94243
+ workspaceId: external_exports.string().min(1),
94244
+ requestId: external_exports.string().min(1),
94245
+ decision: external_exports.enum(["approved", "denied"])
94246
+ });
94247
+ var decideAccessRequestInputSchema = decideAccessRequestInputSchemaDefinition;
94248
+ var seatSourceSchema = external_exports.enum([
94249
+ "creator",
94250
+ "invite",
94251
+ "join_request",
94252
+ "domain",
94253
+ "single_sign_on",
94254
+ "directory"
94255
+ ]);
94256
+ var seatAddedSchemaDefinition = external_exports.object({
94257
+ workspaceId: external_exports.string().min(1),
94258
+ userId: external_exports.string().min(1),
94259
+ email: external_exports.string(),
94260
+ source: seatSourceSchema,
94261
+ /** ISO 8601. */
94262
+ at: external_exports.iso.datetime(),
94263
+ /** The invitation's landing: the module that owns it adds the person there. */
94264
+ landing: inviteLandingSchemaDefinition.nullable().optional(),
94265
+ /** Who sent the invitation, whose right to add the person to the landing is checked. */
94266
+ invitedByUserId: external_exports.string().nullable().optional()
94267
+ });
94268
+
94269
+ // ../../modules/workspace/contract/src/workspace-groups.ts
94270
+ var GROUP_MEMBERS_MAX_PER_CALL = 200;
94271
+ var idSchema25 = external_exports.string().min(1).max(80);
94272
+ var workspaceGroupSchemaDefinition = external_exports.object({
94273
+ id: idSchema25,
94274
+ name: external_exports.string(),
94275
+ /** Who is in it, by user id. */
94276
+ memberIds: external_exports.array(external_exports.string()),
94277
+ createdByUserId: external_exports.string(),
94278
+ createdAt: external_exports.iso.datetime()
94279
+ });
94280
+ var workspaceGroupSchema = workspaceGroupSchemaDefinition;
94281
+ var memberIdsSchema = external_exports.array(idSchema25).max(GROUP_MEMBERS_MAX_PER_CALL);
94282
+ var createGroupInputSchemaDefinition = external_exports.object({
94283
+ workspaceId: external_exports.string().min(1),
94284
+ name: external_exports.string().trim().min(1).max(80),
94285
+ memberIds: memberIdsSchema.default([])
94286
+ });
94287
+ var createGroupInputSchema = createGroupInputSchemaDefinition;
94288
+ var renameGroupInputSchemaDefinition = external_exports.object({
94289
+ workspaceId: external_exports.string().min(1),
94290
+ groupId: idSchema25,
94291
+ name: external_exports.string().trim().min(1).max(80)
94292
+ });
94293
+ var renameGroupInputSchema = renameGroupInputSchemaDefinition;
94294
+ var groupInputSchemaDefinition = external_exports.object({
94295
+ workspaceId: external_exports.string().min(1),
94296
+ groupId: idSchema25
94297
+ });
94298
+ var groupInputSchema = groupInputSchemaDefinition;
94299
+ var changeGroupMembersInputSchemaDefinition = external_exports.object({
94300
+ workspaceId: external_exports.string().min(1),
94301
+ groupId: idSchema25,
94302
+ add: memberIdsSchema.default([]),
94303
+ remove: memberIdsSchema.default([])
94304
+ });
94305
+ var changeGroupMembersInputSchema = changeGroupMembersInputSchemaDefinition;
94306
+
94307
+ // ../../modules/workspace/contract/src/workspace.ts
94308
+ var workspaceNameSchema = external_exports.string().trim().min(1).max(80);
94309
+ var WORKSPACE_LOGO_MAX_BYTES = 512 * 1024;
94310
+ var workspaceSchemaDefinition = external_exports.object({
94311
+ id: external_exports.string().min(1),
94312
+ name: external_exports.string(),
94313
+ createdByUserId: external_exports.string(),
94314
+ /** ISO 8601: tRPC carries plain JSON here. */
94315
+ createdAt: external_exports.iso.datetime(),
94316
+ /** When an Owner asked to delete it; null while it is not scheduled for deletion. */
94317
+ deletionScheduledAt: external_exports.iso.datetime().nullable().default(null),
94318
+ /** When it will be purged; null while it is not scheduled for deletion. */
94319
+ deletesAt: external_exports.iso.datetime().nullable().default(null),
94320
+ /** How many people its plan holds: one on Free; null or absent on Team, which takes everyone. */
94321
+ seatLimit: external_exports.number().int().positive().nullable().optional(),
94322
+ /** A short-lived link to the company logo; null while it has none and shows the Laze mark. */
94323
+ logoUrl: external_exports.string().nullable().optional()
94324
+ });
94325
+ var workspaceSchema = workspaceSchemaDefinition;
94326
+ var workspaceSummaryDefinition = external_exports.object({
94327
+ id: external_exports.string().min(1),
94328
+ name: external_exports.string(),
94329
+ createdByUserId: external_exports.string(),
94330
+ createdAt: external_exports.iso.datetime(),
94331
+ deletionScheduledAt: external_exports.iso.datetime().nullable(),
94332
+ seatLimit: external_exports.number().int().positive().nullable(),
94333
+ members: external_exports.number().int().nonnegative()
94334
+ });
94335
+ var workspaceSummarySchema = workspaceSummaryDefinition;
94336
+ var myWorkspaceSchemaDefinition = external_exports.object({
94337
+ id: external_exports.string().min(1),
94338
+ name: external_exports.string(),
94339
+ role: workspaceRoleSchema,
94340
+ /** A short-lived link to the company logo; null while it has none. */
94341
+ logoUrl: external_exports.string().nullable().optional()
94342
+ });
94343
+ var myWorkspaceSchema = myWorkspaceSchemaDefinition;
94344
+ var workspaceMemberSchemaDefinition = external_exports.object({
94345
+ userId: external_exports.string().min(1),
94346
+ email: external_exports.string(),
94347
+ name: external_exports.string(),
94348
+ role: workspaceRoleSchema,
94349
+ joinedAt: external_exports.iso.datetime(),
94350
+ /** Their picture, an uploaded or Google one; null or absent without one. */
94351
+ image: external_exports.string().nullable().optional(),
94352
+ /** Other names they go by in this workspace ("Also known as"); absent or empty without any. */
94353
+ aliases: external_exports.array(external_exports.string()).optional()
94354
+ });
94355
+ var workspaceMemberSchema = workspaceMemberSchemaDefinition;
94356
+ var ALIASES_MAX_COUNT = 5;
94357
+ var ALIAS_MAX_LENGTH = 40;
94358
+ var setAliasesInputSchemaDefinition = external_exports.object({
94359
+ workspaceId: external_exports.string().min(1),
94360
+ /** Trimmed; blank ones, repeats in any case and the person's own name are dropped. */
94361
+ aliases: external_exports.array(external_exports.string().trim().max(ALIAS_MAX_LENGTH)).max(ALIASES_MAX_COUNT)
94362
+ });
94363
+ var setAliasesInputSchema = setAliasesInputSchemaDefinition;
94364
+ var workspaceInviteSchemaDefinition = external_exports.object({
94365
+ id: external_exports.string().min(1),
94366
+ email: external_exports.string(),
94367
+ role: workspaceRoleSchema,
94368
+ invitedByUserId: external_exports.string(),
94369
+ expiresAt: external_exports.iso.datetime(),
94370
+ createdAt: external_exports.iso.datetime(),
94371
+ /** `held`: saved past the seat limit, not emailed, sent once on Team. Absent reads as pending. */
94372
+ status: external_exports.enum(["pending", "held"]).optional(),
94373
+ /** Where the invited person lands on joining; null for the workspace's Home. */
94374
+ landing: inviteLandingSchema.nullable().optional(),
94375
+ /** Held for Team, so its seat is paid for from the checkout on, before anyone accepts. */
94376
+ seatReserved: external_exports.boolean().optional()
94377
+ });
94378
+ var workspaceInviteSchema = workspaceInviteSchemaDefinition;
94379
+ var invitePreviewSchemaDefinition = external_exports.object({
94380
+ workspaceName: external_exports.string(),
94381
+ email: external_exports.string(),
94382
+ role: workspaceRoleSchema,
94383
+ status: external_exports.enum(["pending", "accepted", "revoked", "expired", "declined"])
94384
+ });
94385
+ var invitePreviewSchema = invitePreviewSchemaDefinition;
94386
+ var myInviteSchemaDefinition = external_exports.object({
94387
+ id: external_exports.string().min(1),
94388
+ workspaceId: external_exports.string().min(1),
94389
+ workspaceName: external_exports.string(),
94390
+ /** A short-lived link to the company logo; null while it has none. */
94391
+ logoUrl: external_exports.string().nullable(),
94392
+ role: workspaceRoleSchema,
94393
+ /** The member who sent it; `name` is null once they left the workspace. */
94394
+ invitedBy: external_exports.object({ userId: external_exports.string(), name: external_exports.string().nullable() }),
94395
+ expiresAt: external_exports.iso.datetime(),
94396
+ createdAt: external_exports.iso.datetime()
94397
+ });
94398
+ var myInviteSchema = myInviteSchemaDefinition;
94399
+ var createWorkspaceInputSchemaDefinition = external_exports.object({
94400
+ name: workspaceNameSchema,
94401
+ /** Where its creator came from, kept with the workspace; absent when the browser knew nothing. */
94402
+ source: signUpSourceSchema.nullable().optional()
94403
+ });
94404
+ var createWorkspaceInputSchema = createWorkspaceInputSchemaDefinition;
94405
+ var workspaceCreatedSchemaDefinition = external_exports.object({ id: external_exports.string().min(1) });
94406
+ var workspaceCreatedSchema = workspaceCreatedSchemaDefinition;
94407
+ var renameWorkspaceInputSchemaDefinition = external_exports.object({
94408
+ workspaceId: external_exports.string().min(1),
94409
+ name: workspaceNameSchema
94410
+ });
94411
+ var renameWorkspaceInputSchema = renameWorkspaceInputSchemaDefinition;
94412
+ var setWorkspaceLogoInputSchemaDefinition = external_exports.object({
94413
+ workspaceId: external_exports.string().min(1),
94414
+ /** Any type, so that a wrong one is refused as `workspace_logo_invalid`. */
94415
+ contentType: external_exports.string().min(1).max(100),
94416
+ /** The picture, base64; past the size limit it is refused as `workspace_logo_invalid`. */
94417
+ dataBase64: external_exports.string().min(1).max(Math.ceil(WORKSPACE_LOGO_MAX_BYTES * 8 / 3))
94418
+ });
94419
+ var setWorkspaceLogoInputSchema = setWorkspaceLogoInputSchemaDefinition;
94420
+ var memberErasureSchemaDefinition = external_exports.object({
94421
+ /** Workspaces shared with others that the person left. */
94422
+ left: external_exports.array(external_exports.string()),
94423
+ /** Workspaces only the person belonged to, deleted with the account. */
94424
+ deleted: external_exports.array(external_exports.string())
94425
+ });
94426
+ var deleteWorkspaceInputSchemaDefinition = external_exports.object({
94427
+ workspaceId: external_exports.string().min(1),
94428
+ /** The workspace's name, typed by the Owner to confirm. */
94429
+ confirmName: external_exports.string().max(200)
94430
+ });
94431
+ var deleteWorkspaceInputSchema = deleteWorkspaceInputSchemaDefinition;
94432
+ var myJoinRequestSchemaDefinition = external_exports.object({
94433
+ request: accessRequestSchema,
94434
+ workspaceName: external_exports.string()
94435
+ });
94436
+ var workspaceIdInputSchemaDefinition = external_exports.object({ workspaceId: external_exports.string().min(1) });
94437
+ var workspaceIdInputSchema = workspaceIdInputSchemaDefinition;
94438
+ var inviteMemberInputSchemaDefinition = external_exports.object({
94439
+ workspaceId: external_exports.string().min(1),
94440
+ email: external_exports.email().max(320),
94441
+ role: workspaceRoleSchema
94442
+ });
94443
+ var inviteMemberInputSchema = inviteMemberInputSchemaDefinition;
94444
+ var inviteManyInputSchemaDefinition = external_exports.object({
94445
+ workspaceId: external_exports.string().min(1),
94446
+ emails: external_exports.array(external_exports.string().max(320)).min(1).max(MAX_INVITES_PER_BATCH),
94447
+ role: workspaceRoleSchema,
94448
+ landing: inviteLandingSchema.nullable().default(null)
94449
+ });
94450
+ var inviteManyInputSchema = inviteManyInputSchemaDefinition;
94451
+ var inviteRefusalSchema = external_exports.enum(["invalid", "duplicate", "member"]);
94452
+ var inviteManyResultSchemaDefinition = external_exports.object({
94453
+ /** One open invitation per address that was not refused: new, or the one it already had. */
94454
+ invites: external_exports.array(workspaceInviteSchemaDefinition),
94455
+ refused: external_exports.array(external_exports.object({ email: external_exports.string(), reason: inviteRefusalSchema })),
94456
+ /** Some invitations wait for Team (the seat limit): none of those was emailed. */
94457
+ held: external_exports.boolean()
94458
+ });
94459
+ var inviteManyResultSchema = inviteManyResultSchemaDefinition;
94460
+ var requestInvitesResultSchemaDefinition = external_exports.object({
94461
+ requests: external_exports.array(accessRequestSchema),
94462
+ refused: external_exports.array(external_exports.object({ email: external_exports.string(), reason: inviteRefusalSchema })),
94463
+ /** Who approves them, the Owners and Admins by name: "Sent to Olga for approval". */
94464
+ approvers: external_exports.array(external_exports.string()).default([])
94465
+ });
94466
+ var requestInvitesResultSchema = requestInvitesResultSchemaDefinition;
94467
+ var acceptedInviteSchemaDefinition = external_exports.object({
94468
+ workspaceId: external_exports.string(),
94469
+ landing: inviteLandingSchema.nullable().default(null)
94470
+ });
94471
+ var acceptedInviteSchema = acceptedInviteSchemaDefinition;
94472
+ var revokeInviteInputSchemaDefinition = external_exports.object({
94473
+ workspaceId: external_exports.string().min(1),
94474
+ inviteId: external_exports.string().min(1)
94475
+ });
94476
+ var revokeInviteInputSchema = revokeInviteInputSchemaDefinition;
94477
+ var copiedInviteLinkSchemaDefinition = external_exports.object({
94478
+ inviteId: external_exports.string().min(1),
94479
+ email: external_exports.string(),
94480
+ url: external_exports.url(),
94481
+ expiresAt: external_exports.iso.datetime()
94482
+ });
94483
+ var copiedInviteLinkSchema = copiedInviteLinkSchemaDefinition;
94484
+ var inviteLinkInputSchemaDefinition = external_exports.object({
94485
+ inviteId: external_exports.string().min(1),
94486
+ secret: external_exports.string().min(1).max(200)
94487
+ });
94488
+ var inviteLinkInputSchema = inviteLinkInputSchemaDefinition;
94489
+ var changeRoleInputSchemaDefinition = external_exports.object({
94490
+ workspaceId: external_exports.string().min(1),
94491
+ userId: external_exports.string().min(1),
94492
+ role: workspaceRoleSchema
94493
+ });
94494
+ var changeRoleInputSchema = changeRoleInputSchemaDefinition;
94495
+ var removeMemberInputSchemaDefinition2 = external_exports.object({
94496
+ workspaceId: external_exports.string().min(1),
94497
+ userId: external_exports.string().min(1)
94498
+ });
94499
+ var removeMemberInputSchema2 = removeMemberInputSchemaDefinition2;
94500
+ var sessionPersonSchemaDefinition = external_exports.object({
94501
+ name: external_exports.string().nullable(),
94502
+ email: external_exports.string().nullable(),
94503
+ image: external_exports.string().nullable()
94504
+ }).nullable();
94505
+ var sessionPersonContext = defineMiddlewareContext(
94506
+ "workspaceSessionPerson",
94507
+ sessionPersonSchemaDefinition
94508
+ );
94509
+ var joinTargetSchemaDefinition = external_exports.object({ workspaceId: external_exports.string().min(1), name: external_exports.string() });
94510
+ var WorkspaceApi = moduleApi()("workspace");
94511
+ var WORKSPACE_GET_PATH = "workspace.get";
94512
+ var settingsCopy = {
94513
+ path: WORKSPACE_GET_PATH,
94514
+ paintOnly: true,
94515
+ storable: (copy2) => copy2
94516
+ };
94517
+ var workspaceTrpc = defineTrpcContract("workspace").mutation("create").withInput(createWorkspaceInputSchema).withOutput(workspaceCreatedSchema).query("get", { mirrored: settingsCopy }).withInput(workspaceIdInputSchema).withOutput(workspaceSchema).query("mine").withInput(external_exports.object({})).withOutput(external_exports.array(myWorkspaceSchema)).query("members").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceMemberSchema)).query("myMembership").withInput(workspaceIdInputSchema).withOutput(workspaceMemberSchema.nullable()).mutation("setMyAliases").withInput(setAliasesInputSchema).withOutput(workspaceMemberSchema).mutation("changeRole").withInput(changeRoleInputSchema).withOutput(workspaceMemberSchema).mutation("removeMember").withInput(removeMemberInputSchema2).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("leave").withInput(workspaceIdInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("invite").withInput(inviteMemberInputSchema).withOutput(workspaceInviteSchema).mutation("inviteMany").withInput(inviteManyInputSchema).withOutput(inviteManyResultSchema).mutation("requestInvites").withInput(inviteManyInputSchema).withOutput(requestInvitesResultSchema).query("invites").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceInviteSchema)).mutation("revokeInvite").withInput(revokeInviteInputSchema).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).mutation("copyInviteLink").withInput(revokeInviteInputSchema).withOutput(copiedInviteLinkSchema).query("previewInvite").withInput(inviteLinkInputSchema).withOutput(invitePreviewSchema).mutation("acceptInvite").withInput(inviteLinkInputSchema).withOutput(acceptedInviteSchema).mutation("rename").withInput(renameWorkspaceInputSchema).withOutput(workspaceSchema).mutation("setLogo").withInput(setWorkspaceLogoInputSchema).withOutput(workspaceSchema).mutation("removeLogo").withInput(workspaceIdInputSchema).withOutput(workspaceSchema).mutation("delete").withInput(deleteWorkspaceInputSchema).withOutput(workspaceSchema).mutation("cancelDeletion").withInput(workspaceIdInputSchema).withOutput(workspaceSchema).mutation("requestInvite").withInput(requestInviteInputSchema).withOutput(accessRequestSchema).query("accessRequests").withInput(workspaceIdInputSchema).withOutput(external_exports.array(accessRequestSchema)).mutation("decideAccessRequest").withInput(decideAccessRequestInputSchema).withOutput(accessRequestSchema).mutation("withdrawJoinRequest").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), requestId: external_exports.string().min(1) })).withOutput(accessRequestSchema).query("groups").withInput(workspaceIdInputSchema).withOutput(external_exports.array(workspaceGroupSchema)).mutation("createGroup").withInput(createGroupInputSchema).withOutput(workspaceGroupSchema).mutation("renameGroup").withInput(renameGroupInputSchema).withOutput(workspaceGroupSchema).mutation("deleteGroup").withInput(groupInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("changeGroupMembers").withInput(changeGroupMembersInputSchema).withOutput(workspaceGroupSchema).build();
94518
+
94519
+ // ../../modules/workspace/contract/src/workspace.config.ts
94520
+ var workspaceConfig = Config.define((c) => ({
94521
+ publicBaseUrl,
94522
+ /** Plan seat limits (Free holds one person); off on a server that takes no payment. */
94523
+ seatLimits: c.env("LAZE_SEAT_LIMITS", external_exports.enum(["on", "off"]).default("on"))
94524
+ }));
94525
+
94526
+ // ../../modules/workspace/contract/src/workspace.ui.ts
94527
+ var workspaceUi = uiTokens("workspace");
94528
+ var ProfileSettingsSlot = workspaceUi.extension("settings.profile");
94529
+ var AccountSettingsSlot = workspaceUi.extension("settings.account");
94530
+ var PrivacySettingsSlot = workspaceUi.extension("settings.privacy");
94531
+ var NotificationSettingsSlot = workspaceUi.extension("settings.notifications");
94532
+ var ChatDisplaySettingsSlot = workspaceUi.extension("settings.chatDisplay");
94533
+ var CliKeysSettingsSlot = workspaceUi.extension("settings.cliKeys");
94534
+ var SignInSettingsSlot = workspaceUi.extension("settings.signIn");
94535
+ var AppsSettingsSlot = workspaceUi.extension("settings.apps");
94536
+ var BillingSettingsSlot = workspaceUi.extension("settings.billing");
94537
+ var ModelSettingsSlot = workspaceUi.extension("settings.models");
94538
+ var AgentLoginsSettingsSlot = workspaceUi.extension("settings.agentLogins");
94539
+ var LoginPoolsSettingsSlot = workspaceUi.extension("settings.loginPools");
94540
+ var MachinesSettingsSlot = workspaceUi.extension("settings.machines");
94541
+ var MessagingSettingsSlot = workspaceUi.extension("settings.messaging");
94542
+ var ExternalConnectionsSettingsSlot = workspaceUi.extension("settings.externalConnections");
94543
+ var LangwatchSettingsSlot = workspaceUi.extension("settings.langwatch");
94544
+ var LoginPoolsNavGateSlot = workspaceUi.extension("settings.loginPools.navGate");
94545
+ var WorkspaceRailSlot = workspaceUi.component("rail");
94546
+ var WorkspaceAlertsSlot = workspaceUi.extension("frame.alerts");
94547
+ var WorkspaceSidebarSlot = workspaceUi.component("sidebar");
94548
+ var WorkspaceSidebarHeadSlot = workspaceUi.component("sidebar.head");
94549
+ var WorkspaceSidebarTopSlot = workspaceUi.component("sidebar.top");
94550
+ var WorkspaceSidebarFooterSlot = workspaceUi.extension("sidebar.footer");
94551
+ var WorkspaceInviteDialogSlot = workspaceUi.component("inviteDialog");
94552
+ var ProfileHooksToken = workspaceUi.hooks("profile");
94553
+
94554
+ // ../../modules/workspace/contract/src/workspace.events.ts
94555
+ var memberRemovedDefinition = external_exports.object({
94556
+ workspaceId: external_exports.string().min(1),
94557
+ userId: external_exports.string().min(1),
94558
+ /** ISO 8601. */
94559
+ at: external_exports.iso.datetime()
94560
+ });
94561
+ var memberErasedDefinition = external_exports.object({
94562
+ workspaceId: external_exports.string().min(1),
94563
+ userId: external_exports.string().min(1),
94564
+ /** ISO 8601. */
94565
+ at: external_exports.iso.datetime()
94566
+ });
94567
+ var groupChangedDefinition = external_exports.object({
94568
+ workspaceId: external_exports.string().min(1),
94569
+ groupId: external_exports.string().min(1),
94570
+ /** Who joined the group. */
94571
+ added: external_exports.array(external_exports.string().min(1)),
94572
+ /** Who left it; everyone in it when it was deleted. */
94573
+ removed: external_exports.array(external_exports.string().min(1)),
94574
+ /** The group is gone, so anything linked to it drops the link. */
94575
+ deleted: external_exports.boolean(),
94576
+ /** A workspace member named for the notices this causes. */
94577
+ byUserId: external_exports.string().min(1),
94578
+ /** Unique per change. */
94579
+ changeId: external_exports.string().min(1),
94580
+ /** ISO 8601. */
94581
+ at: external_exports.iso.datetime()
94582
+ });
94583
+ var requestApprovedDefinition = external_exports.object({
94584
+ workspaceId: external_exports.string().min(1),
94585
+ requestId: external_exports.string().min(1),
94586
+ email: external_exports.string(),
94587
+ approvedByUserId: external_exports.string().min(1),
94588
+ /** ISO 8601. */
94589
+ at: external_exports.iso.datetime()
94590
+ });
94591
+ var deletionScheduledDefinition = external_exports.object({
94592
+ workspaceId: external_exports.string().min(1),
94593
+ byUserId: external_exports.string().min(1),
94594
+ /** ISO 8601: when it was asked, which names this schedule. */
94595
+ at: external_exports.iso.datetime(),
94596
+ /** ISO 8601: when the workspace is purged. */
94597
+ deletesAt: external_exports.iso.datetime()
94598
+ });
94599
+ var deletionCancelledDefinition = external_exports.object({
94600
+ workspaceId: external_exports.string().min(1),
94601
+ byUserId: external_exports.string().min(1),
94602
+ /** ISO 8601. */
94603
+ at: external_exports.iso.datetime()
94604
+ });
94605
+ var workspaceCreatedDefinition = external_exports.object({
94606
+ workspaceId: external_exports.string().min(1),
94607
+ createdByUserId: external_exports.string().min(1),
94608
+ /** Where the creator came from (first touch); null when their tab kept no visit. */
94609
+ source: signUpSourceSchema.nullable(),
94610
+ /** ISO 8601. */
94611
+ at: external_exports.iso.datetime()
94612
+ });
94613
+ var inviteSentDefinition = external_exports.object({
94614
+ workspaceId: external_exports.string().min(1),
94615
+ inviteId: external_exports.string().min(1),
94616
+ invitedByUserId: external_exports.string().min(1),
94617
+ role: external_exports.string().min(1),
94618
+ /** ISO 8601. */
94619
+ at: external_exports.iso.datetime()
94620
+ });
94621
+ var workspaceDeletedDefinition = external_exports.object({
94622
+ workspaceId: external_exports.string().min(1),
94623
+ /** ISO 8601. */
94624
+ at: external_exports.iso.datetime()
94625
+ });
94626
+ var deletionStateDefinition = external_exports.object({
94627
+ workspaceId: external_exports.string(),
94628
+ /** ISO 8601 of the schedule waiting to purge; null when none waits. */
94629
+ scheduledAt: external_exports.iso.datetime().nullable(),
94630
+ /** Epoch milliseconds of the purge; null when none waits. */
94631
+ deletesAt: external_exports.number().nullable()
94632
+ });
94633
+ var purgeIntentDefinition = external_exports.object({
94634
+ workspaceId: external_exports.string().min(1),
94635
+ /** ISO 8601 of the schedule this purge belongs to. */
94636
+ scheduledAt: external_exports.iso.datetime()
94637
+ });
94638
+
94639
+ // ../../modules/workspace/contract/src/workspace-invites.ts
94640
+ var addressSchema = external_exports.email().max(320);
94641
+
94642
+ // ../../modules/workspace/contract/src/team-activation.ts
94643
+ var ACTIVATION_DAYS = 7;
94644
+ var ACTIVATION_WINDOW_MS = ACTIVATION_DAYS * 24 * 60 * 60 * 1e3;
94645
+
94646
+ // ../../modules/auth/contract/src/auth-ad-conversion.ts
94647
+ var metaCookieSchema = external_exports.string().regex(/^fb\.\d\.\d{10,16}\.[A-Za-z0-9_.-]{1,500}$/).nullable();
94648
+ var adClickSchemaDefinition = external_exports.object({
94649
+ /** Meta's click id cookie, or one built from the first visit's `fbclid`. */
94650
+ fbc: metaCookieSchema,
94651
+ /** Meta's browser id cookie. */
94652
+ fbp: metaCookieSchema
94653
+ });
94654
+ var adClickSchema = adClickSchemaDefinition;
94655
+
94656
+ // ../../modules/auth/contract/src/auth-sign-up-source.ts
94657
+ var setHeardFromInputSchemaDefinition = external_exports.object({
94658
+ answer: heardFromSchema,
94659
+ /** Only with `other`: what the person typed. */
94660
+ other: heardFromOtherSchema.nullable().optional()
94661
+ });
94662
+ var setHeardFromInputSchema = setHeardFromInputSchemaDefinition;
94663
+ var consentAtSignUpSchema = external_exports.enum(["accepted", "rejected", "unanswered"]);
94664
+ var recordSignUpSourceInputSchemaDefinition = external_exports.object({
94665
+ ...signUpSourceSchema.shape,
94666
+ /** Absent from browsers older than the consent state; kept as none then. */
94667
+ consentAtSignUp: consentAtSignUpSchema.optional(),
94668
+ /** Whether the banner answer allowed Advertising; absent reads as not allowed. */
94669
+ advertisingAtSignUp: external_exports.boolean().optional(),
94670
+ /** The ad network ids the browser held, sent only with Advertising allowed. */
94671
+ adClick: adClickSchema.optional()
94672
+ });
94673
+ var recordSignUpSourceInputSchema = recordSignUpSourceInputSchemaDefinition;
94674
+ var recordConsentAtSignUpInputSchemaDefinition = external_exports.object({ consent: consentAtSignUpSchema });
94675
+ var recordConsentAtSignUpInputSchema = recordConsentAtSignUpInputSchemaDefinition;
94676
+ var signUpKeptViaSchema = external_exports.enum(["visit", "invite", "join_offer", "unrecorded"]);
94677
+
94678
+ // ../../modules/auth/contract/src/auth.events.ts
94679
+ var impersonationStartedPayloadDefinition = external_exports.object({
94680
+ visitId: external_exports.string().min(1),
94681
+ operatorUserId: external_exports.string().min(1),
94682
+ targetUserId: external_exports.string().min(1),
94683
+ workspaceId: external_exports.string().nullable(),
94684
+ reason: external_exports.string(),
94685
+ startedAt: external_exports.iso.datetime(),
94686
+ endsAt: external_exports.iso.datetime()
94687
+ });
94688
+ var impersonationEndingSchema = external_exports.enum(["stopped", "timed_out"]);
94689
+ var impersonationEndedPayloadDefinition = external_exports.object({
94690
+ visitId: external_exports.string().min(1),
94691
+ operatorUserId: external_exports.string().min(1),
94692
+ targetUserId: external_exports.string().min(1),
94693
+ reason: external_exports.string(),
94694
+ endedAt: external_exports.iso.datetime(),
94695
+ how: impersonationEndingSchema
94696
+ });
94697
+ var signUpSourceRecordedPayloadDefinition = external_exports.object({
94698
+ userId: external_exports.string().min(1),
94699
+ source: signUpSourceSchema,
94700
+ /** When the account was created, ISO 8601. */
94701
+ signedUpAt: external_exports.iso.datetime(),
94702
+ at: external_exports.iso.datetime(),
94703
+ /** How the source was kept; facts from before it existed were all `visit`. */
94704
+ keptVia: signUpKeptViaSchema.optional(),
94705
+ /** The colleague's workspace the person joined, for `invite` and `join_offer`. */
94706
+ joinedWorkspaceId: external_exports.string().min(1).nullable().optional()
94707
+ });
94708
+ var emailVerifiedPayloadDefinition = external_exports.object({
94709
+ userId: external_exports.string().min(1),
94710
+ /** When the address was verified; the account's creation for one created verified. */
94711
+ at: external_exports.iso.datetime(),
94712
+ /** `link`: opened the verification email; `provider`: Google, Apple, SSO or a magic link. */
94713
+ via: external_exports.enum(["link", "provider"])
94714
+ });
94715
+
94716
+ // ../../modules/auth/contract/src/auth-language.ts
94717
+ var languageOptionDefinition = external_exports.object({ tag: external_exports.string(), label: external_exports.string() });
94718
+ var languageOptionSchema = languageOptionDefinition;
94719
+ var setLanguageInputDefinition = external_exports.object({ language: external_exports.string().trim().min(1).max(35) });
94720
+ var setLanguageInputSchema = setLanguageInputDefinition;
94721
+
94722
+ // ../../modules/auth/contract/src/auth.trpc.ts
94723
+ var authTrpc = defineTrpcContract("auth").query("me").withInput(external_exports.object({})).withOutput(authUserSchema.nullable()).query("languages").withInput(external_exports.object({})).withOutput(external_exports.array(languageOptionSchema)).mutation("setLanguage").withInput(setLanguageInputSchema).withOutput(authUserSchema).mutation("recordSignUpSource").withInput(recordSignUpSourceInputSchema).withOutput(external_exports.object({ kept: external_exports.boolean() })).mutation("recordConsentAtSignUp").withInput(recordConsentAtSignUpInputSchema).withOutput(external_exports.object({ kept: external_exports.boolean() })).query("analyticsConsent").withInput(external_exports.object({})).withOutput(analyticsConsentReadingSchema).mutation("setAnalyticsConsent").withInput(setAnalyticsConsentInputSchema).withOutput(analyticsConsentReadingSchema).mutation("setHeardFrom").withInput(setHeardFromInputSchema).withOutput(external_exports.object({ saved: external_exports.literal(true) })).query("deviceKeys").withInput(external_exports.object({})).withOutput(deviceKeysSchema).mutation("deleteAccount").withInput(external_exports.object({ confirmEmail: external_exports.string().trim().min(1).max(320) })).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("impersonation").withInput(external_exports.object({})).withOutput(impersonationSchema.nullable()).mutation("stopImpersonation").withInput(external_exports.object({})).withOutput(impersonationSchema.nullable()).query("signInOptions").withInput(external_exports.object({})).withOutput(signInOptionsSchema).query("signInRoute").withInput(external_exports.object({ email: external_exports.string().trim().min(3).max(320) })).withOutput(signInRouteSchema).query("joinOffer").withInput(external_exports.object({})).withOutput(joinOfferReadingSchema).query("myInvites").withInput(external_exports.object({})).withOutput(external_exports.array(myInviteSchema)).mutation("acceptMyInvite").withInput(external_exports.object({ inviteId: external_exports.string().min(1).max(200) })).withOutput(acceptedInviteSchema).mutation("declineMyInvite").withInput(external_exports.object({ inviteId: external_exports.string().min(1).max(200) })).withOutput(external_exports.object({ declined: external_exports.literal(true) })).mutation("requestToJoin").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(joinAnswerSchema).query("joinDomains").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(joinDomainSchema)).mutation("setDomainAutoJoin").withInput(setDomainAutoJoinInputSchema).withOutput(joinDomainSchema).build();
94724
+
94725
+ // ../../modules/auth/contract/src/auth.config.ts
94726
+ var originListSchema = external_exports.string().optional().transform(
94727
+ (value) => (value ?? "").split(",").map((origin) => origin.trim()).filter((origin) => origin !== "")
94728
+ );
94729
+ var blankIsUnset = external_exports.string().optional().transform((value) => value?.trim() ? value.trim() : void 0);
94730
+ var authConfig = Config.define((c) => ({
94731
+ publicBaseUrl,
94732
+ publicOriginAliases,
94733
+ trustedOrigins: c.env("AUTH_TRUSTED_ORIGINS", originListSchema),
94734
+ googleClientId: c.env("GOOGLE_CLIENT_ID", blankIsUnset),
94735
+ googleIssuer: c.env("GOOGLE_ISSUER", blankIsUnset),
94736
+ /** Sign in with Apple's Services ID, team and key id; APPLE_SIGNIN_KEY_P8 turns it on. */
94737
+ appleServicesId: c.env("APPLE_SERVICES_ID", blankIsUnset),
94738
+ appleTeamId: c.env("APPLE_TEAM_ID", blankIsUnset),
94739
+ appleKeyId: c.env("APPLE_SIGNIN_KEY_ID", blankIsUnset),
94740
+ /** The iPhone app's `<team id>.<bundle id>` names for universal links; none turns them off. */
94741
+ iosAppIds: c.env("IOS_APP_IDS", originListSchema),
94742
+ /** Cloudflare Turnstile's public site key; TURNSTILE_SECRET_KEY is its secret half. */
94743
+ turnstileSiteKey: c.env("TURNSTILE_SITE_KEY", blankIsUnset),
94744
+ /** Domains whose plus addresses sign up without the captcha (Laze's own QA addresses). */
94745
+ captchaExemptDomains: c.env(
94746
+ "AUTH_CAPTCHA_EXEMPT_DOMAINS",
94747
+ external_exports.string().optional().transform(
94748
+ (value) => (value ?? "langwatch.ai").split(",").map((domain2) => domain2.trim().toLowerCase()).filter((domain2) => domain2 !== "")
94749
+ )
94750
+ )
94751
+ }));
94752
+
94753
+ // ../../modules/auth/contract/src/auth.ui.ts
94754
+ var AccountOperationsToken = uiTokens("auth").operations("account");
94755
+ var ImpersonationBannerSlot = uiTokens("auth").component("impersonationBanner");
94756
+
94757
+ // ../../modules/authz/contract/src/authz.api.ts
94758
+ var platformPermissionSchema = external_exports.enum(["ops:view", "ops:manage"]);
94759
+ var platformGrantDefinition = external_exports.object({
94760
+ userId: external_exports.string().min(1),
94761
+ permission: platformPermissionSchema,
94762
+ /** The operator who granted it, or `system` for the box task. */
94763
+ grantedBy: external_exports.string().min(1),
94764
+ reason: external_exports.string().min(1),
94765
+ grantedAt: external_exports.iso.datetime()
94766
+ });
94767
+ var platformGrantSchema = platformGrantDefinition;
94768
+ var AuthzApi = moduleApi()("authz");
94769
+
94770
+ // ../../modules/authz/contract/src/authz.trpc.ts
94771
+ var authzTrpc = defineTrpcContract("authz").query("myPermissions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(authzPermissionSchema)).build();
94772
+
94773
+ // ../../modules/feature-flag/contract/src/feature-flag.api.ts
94774
+ var featureFlagKeySchema = external_exports.string().regex(/^[a-z][a-z0-9_]{1,63}$/, "a flag key is lower-case letters, digits and underscores");
94775
+ var featureFlagSchemaDefinition = external_exports.object({ key: featureFlagKeySchema, enabled: external_exports.boolean() });
94776
+ var featureFlagSchema = featureFlagSchemaDefinition;
94777
+ var setFeatureFlagInputSchemaDefinition = external_exports.object({
94778
+ workspaceId: external_exports.string().min(1),
94779
+ key: featureFlagKeySchema,
94780
+ enabled: external_exports.boolean()
94781
+ });
94782
+ var setFeatureFlagInputSchema = setFeatureFlagInputSchemaDefinition;
94783
+ var listFeatureFlagsInputSchemaDefinition = external_exports.object({ workspaceId: external_exports.string().min(1) });
94784
+ var listFeatureFlagsInputSchema = listFeatureFlagsInputSchemaDefinition;
94785
+ var setPersonFeatureFlagInputSchemaDefinition = external_exports.object({
94786
+ userId: external_exports.string().min(1),
94787
+ key: featureFlagKeySchema,
94788
+ enabled: external_exports.boolean()
94789
+ });
94790
+ var FeatureFlagApi = moduleApi()("feature-flag");
94791
+
94792
+ // ../../modules/feature-flag/contract/src/feature-flag.trpc.ts
94793
+ var featureFlagTrpc = defineTrpcContract("featureFlag").query("list").withInput(listFeatureFlagsInputSchema).withOutput(external_exports.array(featureFlagSchema)).mutation("set").withInput(setFeatureFlagInputSchema).withOutput(featureFlagSchema).build();
94794
+
94795
+ // ../../modules/ops/contract/src/ops.api.ts
94796
+ var reasonSchema = external_exports.string().trim().min(3).max(500);
94797
+ var searchDefinition = external_exports.object({
94798
+ query: external_exports.string().trim().max(200).default(""),
94799
+ limit: external_exports.number().int().min(1).max(100).default(50)
94800
+ });
94801
+ var opsSearchInputSchema = searchDefinition;
94802
+ var operatorDefinition = external_exports.object({
94803
+ userId: external_exports.string(),
94804
+ /** Holds `ops:manage`: plan changes, credits, flags, parked work and impersonation. */
94805
+ manage: external_exports.boolean()
94806
+ });
94807
+ var opsOperatorSchema = operatorDefinition;
94808
+ var workspaceRowDefinition = external_exports.object({
94809
+ ...workspaceSummarySchema.shape,
94810
+ plan: external_exports.enum(["free", "team"]),
94811
+ status: external_exports.string(),
94812
+ complimentarySeats: external_exports.number().int().positive().nullable(),
94813
+ /** Spent this billing period, in the workspace's currency. */
94814
+ spent: external_exports.number(),
94815
+ currency: external_exports.string()
94816
+ });
94817
+ var opsWorkspaceRowSchema = workspaceRowDefinition;
94818
+ var workspaceDetailDefinition = external_exports.object({
94819
+ workspace: workspaceSummarySchema,
94820
+ members: external_exports.array(workspaceMemberSchema),
94821
+ invites: external_exports.array(workspaceInviteSchema),
94822
+ agents: external_exports.array(agentListEntrySchema),
94823
+ billing: billingAccountViewSchema,
94824
+ flags: external_exports.array(featureFlagSchema),
94825
+ activity: external_exports.array(auditEntrySchema),
94826
+ /** The members' complimentary computer sizes that hold now. */
94827
+ computers: external_exports.array(complimentaryComputerSchema).default([])
94828
+ });
94829
+ var opsWorkspaceDetailSchema = workspaceDetailDefinition;
94830
+ var userRowDefinition = external_exports.object({
94831
+ ...authUserSummarySchema.shape,
94832
+ workspaces: external_exports.array(myWorkspaceSchema)
94833
+ });
94834
+ var opsUserRowSchema = userRowDefinition;
94835
+ var setPlanDefinition = external_exports.object({
94836
+ workspaceId: external_exports.string().min(1),
94837
+ /** People on the complimentary Team; null ends it and returns the workspace to Free. */
94838
+ seats: external_exports.number().int().positive().max(1e4).nullable(),
94839
+ reason: reasonSchema
94840
+ });
94841
+ var opsSetPlanInputSchema = setPlanDefinition;
94842
+ var setComputerDefinition = external_exports.object({
94843
+ workspaceId: external_exports.string().min(1),
94844
+ userId: external_exports.string().min(1),
94845
+ /** Medium, Large or XL for free; null ends the person's complimentary size. */
94846
+ size: complimentarySizeSchema.nullable(),
94847
+ /** When it ends; null keeps it until staff end it. */
94848
+ until: external_exports.iso.datetime().nullable().default(null),
94849
+ reason: reasonSchema
94850
+ });
94851
+ var opsSetComputerInputSchema = setComputerDefinition;
94852
+ var grantCreditsDefinition = external_exports.object({
94853
+ workspaceId: external_exports.string().min(1),
94854
+ amount: external_exports.number().positive().max(1e4),
94855
+ reason: reasonSchema
94856
+ });
94857
+ var opsGrantCreditsInputSchema = grantCreditsDefinition;
94858
+ var setFlagDefinition = external_exports.object({
94859
+ workspaceId: external_exports.string().min(1),
94860
+ key: featureFlagKeySchema,
94861
+ enabled: external_exports.boolean(),
94862
+ reason: reasonSchema
94863
+ });
94864
+ var opsSetFlagInputSchema = setFlagDefinition;
94865
+ var parkedDefinition = external_exports.object({
94866
+ /** False when this process runs without eventing, so nothing can be read. */
94867
+ available: external_exports.boolean(),
94868
+ dead: external_exports.object({
94869
+ total: external_exports.number().int().nonnegative(),
94870
+ messages: external_exports.array(
94871
+ external_exports.object({
94872
+ id: external_exports.string(),
94873
+ processName: external_exports.string(),
94874
+ intentType: external_exports.string(),
94875
+ attempts: external_exports.number().int(),
94876
+ updatedAt: external_exports.iso.datetime()
94877
+ })
94878
+ )
94879
+ }),
94880
+ blocked: external_exports.array(
94881
+ external_exports.object({
94882
+ queueName: external_exports.string(),
94883
+ groupId: external_exports.string(),
94884
+ error: external_exports.string(),
94885
+ staged: external_exports.number().int(),
94886
+ poisoned: external_exports.boolean()
94887
+ })
94888
+ ),
94889
+ deadLettered: external_exports.array(
94890
+ external_exports.object({
94891
+ queueName: external_exports.string(),
94892
+ groupId: external_exports.string(),
94893
+ jobs: external_exports.number().int(),
94894
+ error: external_exports.string()
94895
+ })
94896
+ )
94897
+ });
94898
+ var opsParkedSchema = parkedDefinition;
94899
+ var parkedActDefinition = external_exports.discriminatedUnion("action", [
94900
+ external_exports.object({ action: external_exports.enum(["redrive", "discard"]), id: external_exports.string().min(1), reason: reasonSchema }),
94901
+ external_exports.object({
94902
+ action: external_exports.enum(["unblock", "replay", "drop"]),
94903
+ queueName: external_exports.string().min(1),
94904
+ groupId: external_exports.string().min(1),
94905
+ reason: reasonSchema
94906
+ })
94907
+ ]);
94908
+ var opsParkedActInputSchema = parkedActDefinition;
94909
+ var impersonateDefinition = external_exports.object({
94910
+ targetUserId: external_exports.string().min(1),
94911
+ workspaceId: external_exports.string().min(1).nullable(),
94912
+ reason: reasonSchema,
94913
+ minutes: external_exports.number().int().min(1).max(60).default(30)
94914
+ });
94915
+ var opsImpersonateInputSchema = impersonateDefinition;
94916
+ var auditRowDefinition = external_exports.object({
94917
+ id: external_exports.string(),
94918
+ operatorUserId: external_exports.string(),
94919
+ action: external_exports.string(),
94920
+ targetKind: external_exports.string(),
94921
+ targetId: external_exports.string(),
94922
+ reason: external_exports.string(),
94923
+ args: external_exports.record(external_exports.string(), external_exports.unknown()),
94924
+ createdAt: external_exports.iso.datetime()
94925
+ });
94926
+ var opsAuditRowSchema = auditRowDefinition;
94927
+ var grantOperatorDefinition = external_exports.object({
94928
+ email: external_exports.string().trim().min(3).max(320),
94929
+ permission: external_exports.enum(["ops:view", "ops:manage"]),
94930
+ reason: reasonSchema
94931
+ });
94932
+ var resetVaultBreakerDefinition = external_exports.object({
94933
+ assertion: vaultPasskeyAssertionSchema,
94934
+ reason: reasonSchema
94935
+ });
94936
+ var opsResetVaultBreakerInputSchema = resetVaultBreakerDefinition;
94937
+ var proposeOperatorPasskeyDefinition = external_exports.object({
94938
+ ...vaultOperatorProposeSchema.shape,
94939
+ reason: reasonSchema
94940
+ });
94941
+ var opsProposeOperatorPasskeyInputSchema = proposeOperatorPasskeyDefinition;
94942
+ var commitOperatorRecordDefinition = external_exports.object({
94943
+ assertion: vaultPasskeyAssertionSchema,
94944
+ action: external_exports.enum(VAULT_OPERATOR_ACTIONS),
94945
+ credentialId: external_exports.string().max(512).optional(),
94946
+ label: external_exports.string().max(VAULT_OPERATOR_LABEL_MAX).optional(),
94947
+ reason: reasonSchema
94948
+ });
94949
+ var opsCommitOperatorRecordInputSchema = commitOperatorRecordDefinition;
94950
+ var setVaultOverrideDefinition = external_exports.object({
94951
+ ...vaultWatchOverrideSchema.shape,
94952
+ reason: reasonSchema
94953
+ });
94954
+ var opsSetVaultOverrideInputSchema = setVaultOverrideDefinition;
94955
+ var endVaultOverrideDefinition = external_exports.object({ reason: reasonSchema });
94956
+ var opsEndVaultOverrideInputSchema = endVaultOverrideDefinition;
94957
+ var acquisitionReportInputDefinition = external_exports.object({
94958
+ /** Inclusive. */
94959
+ from: external_exports.iso.datetime(),
94960
+ /** Exclusive. */
94961
+ to: external_exports.iso.datetime()
94962
+ });
94963
+ var countSchema = external_exports.number().int().nonnegative();
94964
+ var acquisitionCountsDefinition = external_exports.object({
94965
+ signUps: countSchema,
94966
+ workspaces: countSchema,
94967
+ /** Workspaces with 2+ people and an agent in a shared channel with 2+ posters within 7 days. */
94968
+ activatedTeams: countSchema,
94969
+ /** Workspaces on a paid Team now (active or past due, not complimentary). */
94970
+ payingTeams: countSchema
94971
+ });
94972
+ var acquisitionReportDefinition = external_exports.object({
94973
+ from: external_exports.iso.datetime(),
94974
+ to: external_exports.iso.datetime(),
94975
+ /** One row per source, campaign and persona; most sign-ups first. */
94976
+ rows: external_exports.array(
94977
+ external_exports.object({
94978
+ /** utm_source, else the referring host, else `direct`. */
94979
+ source: external_exports.string(),
94980
+ /** utm_campaign, or `none`. */
94981
+ campaign: external_exports.string(),
94982
+ /** The persona page, or `none`. */
94983
+ persona: external_exports.string(),
94984
+ ...acquisitionCountsDefinition.shape
94985
+ })
94986
+ ),
94987
+ totals: acquisitionCountsDefinition,
94988
+ /** Sign-ups by their "How did you hear about Laze?" answer; `not answered` for none. */
94989
+ heardFrom: external_exports.array(external_exports.object({ answer: external_exports.string(), signUps: countSchema })),
94990
+ /**
94991
+ * The funnel by the cookie banner answer at sign-up: `accepted`, `rejected`, `no answer`,
94992
+ * `not recorded`, and `signed up earlier` for workspaces whose creator signed up before the
94993
+ * range. Workspaces count under their creator's state; states with nothing are left out.
94994
+ */
94995
+ consent: external_exports.array(
94996
+ external_exports.object({
94997
+ state: external_exports.string(),
94998
+ signUps: countSchema,
94999
+ workspaces: countSchema,
95000
+ activatedTeams: countSchema
95001
+ })
95002
+ )
95003
+ });
95004
+ var operatorPersonDefinition = external_exports.object({ name: external_exports.string(), email: external_exports.string() });
95005
+ var operatorGrantDefinition = external_exports.object({
95006
+ ...platformGrantSchema.shape,
95007
+ /** Who holds the grant, from auth; null once the account is deleted. */
95008
+ person: operatorPersonDefinition.nullable(),
95009
+ /** Who gave it, from auth; null for `system` and for a deleted account. */
95010
+ grantedByPerson: operatorPersonDefinition.nullable()
95011
+ });
95012
+ var opsOperatorGrantSchema = operatorGrantDefinition;
95013
+ var OpsApi = moduleApi()("ops");
95014
+
95015
+ // ../../modules/ops/contract/src/break-glass.ts
95016
+ var BREAK_GLASS = {
95017
+ maxHours: 24,
95018
+ maxRangeDays: 7,
95019
+ maxMessageIds: 100,
95020
+ /** A request nobody answered expires this long after it was made. */
95021
+ pendingHours: 24,
95022
+ pageSize: 50
95023
+ };
95024
+ var id2 = external_exports.string().trim().min(1).max(200);
95025
+ var scopeDefinition = external_exports.discriminatedUnion("kind", [
95026
+ external_exports.object({
95027
+ kind: external_exports.literal("conversation"),
95028
+ conversationId: id2,
95029
+ from: external_exports.iso.datetime(),
95030
+ to: external_exports.iso.datetime()
95031
+ }),
95032
+ external_exports.object({
95033
+ kind: external_exports.literal("messages"),
95034
+ messageIds: external_exports.array(id2).min(1).max(BREAK_GLASS.maxMessageIds)
95035
+ })
95036
+ ]);
95037
+ var breakGlassScopeSchema = scopeDefinition;
95038
+ var requestInputDefinition = external_exports.object({
95039
+ workspaceId: id2,
95040
+ scope: breakGlassScopeSchema,
95041
+ reason: external_exports.string().trim().min(3).max(500),
95042
+ hours: external_exports.number().int().min(1).max(BREAK_GLASS.maxHours)
95043
+ });
95044
+ var breakGlassRequestInputSchema = requestInputDefinition;
95045
+ var breakGlassStatusSchema = external_exports.enum(["pending", "approved", "denied", "expired", "ended"]);
95046
+ var requestDefinition = external_exports.object({
95047
+ id: external_exports.string(),
95048
+ workspaceId: external_exports.string(),
95049
+ scope: breakGlassScopeSchema,
95050
+ reason: external_exports.string(),
95051
+ hours: external_exports.number().int(),
95052
+ status: breakGlassStatusSchema,
95053
+ requestedBy: external_exports.string(),
95054
+ requestedAt: external_exports.iso.datetime(),
95055
+ /** A pending request expires then. */
95056
+ pendingUntil: external_exports.iso.datetime(),
95057
+ decidedBy: external_exports.string().nullable(),
95058
+ decidedAt: external_exports.iso.datetime().nullable(),
95059
+ /** How the approver proved presence; null unless approved. */
95060
+ proofMethod: external_exports.enum(["passkey", "secure_enclave"]).nullable(),
95061
+ denyReason: external_exports.string().nullable(),
95062
+ /** Reads are allowed until then; null unless approved. */
95063
+ accessEndsAt: external_exports.iso.datetime().nullable()
95064
+ });
95065
+ var breakGlassRequestSchema = requestDefinition;
95066
+ var requestIdDefinition = external_exports.object({ requestId: id2 });
95067
+ var breakGlassRequestIdSchema = requestIdDefinition;
95068
+ var approveDefinition = external_exports.object({
95069
+ requestId: id2,
95070
+ challenge: external_exports.string().min(1),
95071
+ assertion: external_exports.union([vaultDeviceAssertionSchema, vaultNativeAssertionSchema])
95072
+ });
95073
+ var breakGlassApproveInputSchema = approveDefinition;
95074
+ var denyDefinition = external_exports.object({ requestId: id2, reason: external_exports.string().trim().min(3).max(500) });
95075
+ var breakGlassDenyInputSchema = denyDefinition;
95076
+ var readDefinition = external_exports.object({ requestId: id2, cursor: external_exports.string().max(300).nullable() });
95077
+ var breakGlassReadInputSchema = readDefinition;
95078
+ var messageDefinition2 = external_exports.object({
95079
+ id: external_exports.string(),
95080
+ conversationId: external_exports.string(),
95081
+ threadRootId: external_exports.string().nullable(),
95082
+ author: external_exports.object({ kind: external_exports.enum(["person", "agent", "external"]), id: external_exports.string() }),
95083
+ kind: external_exports.string(),
95084
+ body: external_exports.string(),
95085
+ undecryptable: external_exports.boolean(),
95086
+ deleted: external_exports.boolean(),
95087
+ createdAt: external_exports.iso.datetime()
95088
+ });
95089
+ var pageDefinition = external_exports.object({
95090
+ messages: external_exports.array(messageDefinition2),
95091
+ /** Pass back as `cursor` for the next page; null on the last one. */
95092
+ cursor: external_exports.string().nullable(),
95093
+ accessEndsAt: external_exports.iso.datetime()
95094
+ });
95095
+ var breakGlassPageSchema = pageDefinition;
95096
+ var BREAK_GLASS_COPY = {
95097
+ break_glass_self_approval: "A second staff member must approve; you cannot approve your own request",
95098
+ break_glass_proof_refused: "Your passkey or device could not confirm it is you",
95099
+ break_glass_not_pending: "This request was already answered or has expired",
95100
+ break_glass_not_open: "This request is not approved, or its time is over",
95101
+ break_glass_not_requester: "Only the staff member who asked can read under this request",
95102
+ break_glass_not_found: "There is no such break-glass request",
95103
+ break_glass_unknown_workspace: "There is no such workspace",
95104
+ break_glass_bad_cursor: "That page cursor did not come from this request",
95105
+ break_glass_bad_range: `The range must end after it starts and span at most ${BREAK_GLASS.maxRangeDays} days`
95106
+ };
95107
+
95108
+ // ../../modules/ops/contract/src/operator-key.ts
95109
+ var OPERATOR_KEY = {
95110
+ lifetimeMinutes: 15,
95111
+ /** A key nobody answered expires this long after it was asked for. */
95112
+ pendingMinutes: 60,
95113
+ /** Requests one API key may have waiting at once. */
95114
+ maxWaiting: 3
95115
+ };
95116
+ var OPERATOR_KEY_ACTIONS = [
95117
+ "workspace.owner-email",
95118
+ "workspace.detail",
95119
+ "user.lookup",
95120
+ "workspace.flag",
95121
+ "workspace.credits",
95122
+ "workspace.plan"
95123
+ ];
95124
+ var operatorKeyActionSchema = external_exports.enum(OPERATOR_KEY_ACTIONS);
95125
+ var OPERATOR_KEY_REST_PATHS = {
95126
+ request: "/api/ops/keys",
95127
+ status: "/api/ops/keys/status",
95128
+ use: "/api/ops/keys/use"
95129
+ };
95130
+ var id3 = external_exports.string().trim().min(1).max(200);
95131
+ var reason = external_exports.string().trim().min(3).max(500);
95132
+ var sha256Hex = external_exports.string().regex(/^[0-9a-f]{64}$/);
95133
+ var argsDefinition = external_exports.record(
95134
+ external_exports.string().max(64),
95135
+ external_exports.union([external_exports.string().max(200), external_exports.number(), external_exports.boolean(), external_exports.null()])
95136
+ );
95137
+ var operatorKeyStatusSchema = external_exports.enum([
95138
+ "pending",
95139
+ "approved",
95140
+ "denied",
95141
+ "expired",
95142
+ "revoked",
95143
+ "ended"
95144
+ ]);
95145
+ var requestInputDefinition2 = external_exports.object({
95146
+ /** Free text here: a name the catalogue lacks gets its own refusal, recorded. */
95147
+ action: external_exports.string().trim().min(1).max(80),
95148
+ target: id3,
95149
+ args: argsDefinition.default({}),
95150
+ reason,
95151
+ /** sha256 of the secret the CLI made and keeps; the secret itself never comes here. */
95152
+ secretHash: sha256Hex
95153
+ });
95154
+ var keyDefinition = external_exports.object({
95155
+ id: external_exports.string(),
95156
+ action: operatorKeyActionSchema,
95157
+ target: external_exports.string(),
95158
+ args: argsDefinition,
95159
+ reason: external_exports.string(),
95160
+ status: operatorKeyStatusSchema,
95161
+ /** The API key that asked; only that key can use this one. */
95162
+ askerKeyId: external_exports.string(),
95163
+ /** The person who made that API key. */
95164
+ askerUserId: external_exports.string(),
95165
+ asker: external_exports.enum(["person", "agent"]),
95166
+ /** The workspace of the API key that asked, where the card lands. */
95167
+ askerWorkspaceId: external_exports.string(),
95168
+ requestedAt: external_exports.iso.datetime(),
95169
+ pendingUntil: external_exports.iso.datetime(),
95170
+ decidedBy: external_exports.string().nullable(),
95171
+ decidedAt: external_exports.iso.datetime().nullable(),
95172
+ /** The passkey that approved; null unless approved. */
95173
+ credentialId: external_exports.string().nullable(),
95174
+ denyReason: external_exports.string().nullable(),
95175
+ /** The 15 minutes end then; null unless approved. */
95176
+ endsAt: external_exports.iso.datetime().nullable(),
95177
+ /** When a write key was spent; a read key stays null. */
95178
+ spentAt: external_exports.iso.datetime().nullable()
95179
+ });
95180
+ var operatorKeySchema = keyDefinition;
95181
+ var statusInputDefinition = external_exports.object({ keyId: id3 });
95182
+ var operatorKeyIdSchema = statusInputDefinition;
95183
+ var useInputDefinition = external_exports.object({ keyId: id3, secret: external_exports.string().min(32).max(128) });
95184
+ var useAnswerDefinition = external_exports.object({
95185
+ keyId: external_exports.string(),
95186
+ action: operatorKeyActionSchema,
95187
+ target: external_exports.string(),
95188
+ endsAt: external_exports.iso.datetime(),
95189
+ result: external_exports.unknown()
95190
+ });
95191
+ var approveDefinition2 = external_exports.object({ keyId: id3, assertion: vaultPasskeyAssertionSchema });
95192
+ var operatorKeyApproveInputSchema = approveDefinition2;
95193
+ var denyDefinition2 = external_exports.object({ keyId: id3, reason });
95194
+ var operatorKeyDenyInputSchema = denyDefinition2;
95195
+ var OPERATOR_KEY_COPY = {
95196
+ operator_key_unknown_action: `Choose one of: ${OPERATOR_KEY_ACTIONS.join(", ")}`,
95197
+ operator_key_action_forbidden: "This operation can never run under an operator key",
95198
+ operator_key_needs_manage: "This action needs an owner holding ops:manage",
95199
+ operator_key_bad_target: "This target is not the kind this action works on",
95200
+ operator_key_bad_args: "This action does not take those arguments",
95201
+ operator_key_too_many_waiting: `At most ${OPERATOR_KEY.maxWaiting} keys can wait at once`,
95202
+ operator_key_not_found: "There is no such operator key",
95203
+ operator_key_not_pending: "This key was already answered or has expired",
95204
+ operator_key_not_live: "This key is not approved, or its time is over",
95205
+ operator_key_proof_refused: "The operator passkey did not confirm this approval",
95206
+ operator_key_refused: "This key does not work here"
95207
+ };
95208
+
95209
+ // ../../modules/ops/contract/src/host-load.ts
95210
+ var sampleDefinition = external_exports.object({
95211
+ /** The machine's hostname. */
95212
+ host: external_exports.string(),
95213
+ sampledAt: external_exports.iso.datetime(),
95214
+ load1: external_exports.number(),
95215
+ load5: external_exports.number(),
95216
+ load15: external_exports.number(),
95217
+ cpus: external_exports.number().int(),
95218
+ /** Busy share of CPU time since the previous sample; null for the first after a start. */
95219
+ cpuPercent: external_exports.number().nullable(),
95220
+ memoryTotalMb: external_exports.number(),
95221
+ memoryAvailableMb: external_exports.number(),
95222
+ swapTotalMb: external_exports.number(),
95223
+ swapFreeMb: external_exports.number(),
95224
+ diskTotalGb: external_exports.number(),
95225
+ diskFreeGb: external_exports.number(),
95226
+ /** The agent computer pool then; null where this host runs no pool. */
95227
+ computers: capacityNumbersSchema.nullable()
95228
+ });
95229
+ var hostLoadSampleSchema = sampleDefinition;
95230
+ var pointDefinition = external_exports.object({
95231
+ at: external_exports.iso.datetime(),
95232
+ /** The highest 1 minute load average in the step. */
95233
+ load1: external_exports.number(),
95234
+ /** The highest CPU percent in the step, null when none was measured. */
95235
+ cpuPercent: external_exports.number().nullable(),
95236
+ /** The lowest available memory in the step. */
95237
+ memoryAvailableMb: external_exports.number(),
95238
+ /** The most computers awake in the step, null without a pool. */
95239
+ awakeComputers: external_exports.number().int().nullable(),
95240
+ /** The most vCPU reserved by awake computers in the step, null without a pool. */
95241
+ awakeCpus: external_exports.number().nullable()
95242
+ });
95243
+ var hostLoadPointSchema = pointDefinition;
95244
+ var viewDefinition = external_exports.object({
95245
+ /** The newest sample, null before the worker took one. */
95246
+ now: hostLoadSampleSchema.nullable(),
95247
+ /** The last day, oldest first, one point per step that has samples. */
95248
+ history: external_exports.array(hostLoadPointSchema)
95249
+ });
95250
+ var hostLoadViewSchema = viewDefinition;
95251
+
95252
+ // ../../modules/ops/contract/src/ops.trpc.ts
95253
+ var opsTrpc = defineTrpcContract("ops").query("me").withInput(external_exports.object({})).withOutput(opsOperatorSchema).query("workspaces").withInput(opsSearchInputSchema).withOutput(external_exports.array(opsWorkspaceRowSchema)).query("workspace").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(opsWorkspaceDetailSchema).query("users").withInput(opsSearchInputSchema).withOutput(external_exports.array(opsUserRowSchema)).mutation("setPlan").withInput(opsSetPlanInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("setComplimentaryComputer").withInput(opsSetComputerInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("grantCredits").withInput(opsGrantCreditsInputSchema).withOutput(opsWorkspaceDetailSchema).mutation("setFlag").withInput(opsSetFlagInputSchema).withOutput(opsWorkspaceDetailSchema).query("parked").withInput(external_exports.object({})).withOutput(opsParkedSchema).mutation("parkedAct").withInput(opsParkedActInputSchema).withOutput(external_exports.object({ changed: external_exports.number().int() })).mutation("impersonate").withInput(opsImpersonateInputSchema).withOutput(impersonationSchema).query("operators").withInput(external_exports.object({})).withOutput(external_exports.array(opsOperatorGrantSchema)).query("audit").withInput(external_exports.object({ limit: external_exports.number().int().min(1).max(200).default(100) })).withOutput(external_exports.array(opsAuditRowSchema)).query("vaultLockdown").withInput(external_exports.object({})).withOutput(vaultLockdownSchema).mutation("vaultBreakerChallenge").withInput(external_exports.object({})).withOutput(vaultBreakerChallengeSchema).mutation("proposeOperatorPasskey").withInput(opsProposeOperatorPasskeyInputSchema).withOutput(vaultOperatorProposalSchema).mutation("operatorPasskeyChallenge").withInput(vaultOperatorChallengeInputSchema).withOutput(vaultOperatorChallengeSchema).mutation("commitOperatorRecord").withInput(opsCommitOperatorRecordInputSchema).withOutput(external_exports.object({ seq: external_exports.number().int() })).mutation("resetVaultBreaker").withInput(opsResetVaultBreakerInputSchema).withOutput(external_exports.object({ breaker: external_exports.literal("closed") })).mutation("setVaultOverride").withInput(opsSetVaultOverrideInputSchema).withOutput(vaultLockdownOverrideSchema).mutation("endVaultOverride").withInput(opsEndVaultOverrideInputSchema).withOutput(external_exports.object({ ended: external_exports.boolean() })).query("breakGlassRequests").withInput(external_exports.object({})).withOutput(external_exports.array(breakGlassRequestSchema)).mutation("requestBreakGlass").withInput(breakGlassRequestInputSchema).withOutput(breakGlassRequestSchema).mutation("breakGlassChallenge").withInput(breakGlassRequestIdSchema).withOutput(vaultReauthChallengeSchema).mutation("approveBreakGlass").withInput(breakGlassApproveInputSchema).withOutput(breakGlassRequestSchema).mutation("denyBreakGlass").withInput(breakGlassDenyInputSchema).withOutput(breakGlassRequestSchema).mutation("readBreakGlass").withInput(breakGlassReadInputSchema).withOutput(breakGlassPageSchema).query("operatorKeys").withInput(external_exports.object({})).withOutput(external_exports.array(operatorKeySchema)).mutation("operatorKeyChallenge").withInput(operatorKeyIdSchema).withOutput(vaultOperatorKeyChallengeSchema).mutation("approveOperatorKey").withInput(operatorKeyApproveInputSchema).withOutput(operatorKeySchema).mutation("denyOperatorKey").withInput(operatorKeyDenyInputSchema).withOutput(operatorKeySchema).mutation("revokeOperatorKey").withInput(operatorKeyDenyInputSchema).withOutput(operatorKeySchema).query("hostLoad").withInput(external_exports.object({})).withOutput(hostLoadViewSchema).build();
95254
+
95255
+ // ../../modules/ops/contract/src/ops.config.ts
95256
+ var opsConfig = Config.define((c) => ({
95257
+ /** The progress board's alerts folder; unset, the parked jobs card is only logged. */
95258
+ opsAlertDir: c.env("OPS_ALERT_DIR", external_exports.string().min(1).optional())
95259
+ }));
95260
+
95261
+ // src/services/operator-key-commands.service.ts
95262
+ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves with a passkey, 15 minutes):
95263
+ laze ops request <action> <target> --reason "<why>" [--arg name=value] [--wait]
95264
+ actions: ${OPERATOR_KEY_ACTIONS.join(", ")}
95265
+ laze ops status <key> waiting, approved or ended
95266
+ laze ops use <key> run the approved action and print the answer`;
95267
+ var POLL_MS3 = 5e3;
95268
+ var keyFile = ({ context, keyId }) => join27(dirname23(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
95269
+ async function saveSecret({
95270
+ context,
95271
+ keyId,
95272
+ secret
95273
+ }) {
95274
+ const path = keyFile({ context, keyId });
95275
+ await mkdir23(dirname23(path), { recursive: true, mode: 448 });
95276
+ await writeFile23(path, secret, { mode: 384 });
95277
+ }
95278
+ function typedArg(text3) {
95279
+ if (["true", "false", "null"].includes(text3)) return JSON.parse(text3);
95280
+ return text3 !== "" && Number.isFinite(Number(text3)) ? Number(text3) : text3;
95281
+ }
95282
+ function argsOf({ args }) {
95283
+ const pairs = (args.lists.arg ?? []).map((pair2) => {
95284
+ const at = pair2.indexOf("=");
95285
+ if (at < 1) throw new CliUsageError(`--arg takes name=value.
95286
+ ${OPERATOR_KEY_USAGE}`);
95287
+ const text3 = pair2.slice(at + 1);
95288
+ return [pair2.slice(0, at), typedArg(text3)];
95289
+ });
95290
+ return Object.fromEntries(pairs);
95291
+ }
95292
+ var statusLine2 = (key) => {
95293
+ if (key.status === "approved") return `Approved until ${key.endsAt}. Run: laze ops use ${key.id}`;
95294
+ if (key.status === "pending") return `Waiting for an operator's passkey at /ops/keys.`;
95295
+ return `${key.status[0]?.toUpperCase()}${key.status.slice(1)}.`;
95296
+ };
95297
+ async function waitForAnswer({
95298
+ context,
95299
+ client,
95300
+ key
95301
+ }) {
95302
+ const giveUpAt = context.nowMs() + OPERATOR_KEY.pendingMinutes * 6e4;
95303
+ let current3 = key;
95304
+ while (current3.status === "pending" && context.nowMs() < giveUpAt) {
95305
+ await context.sleep(POLL_MS3);
95306
+ current3 = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId: key.id });
95307
+ }
95308
+ return current3;
95309
+ }
95310
+ async function requestKey({ context, args }) {
95311
+ const [, , action, target] = args.words;
95312
+ const reason2 = flagText({ args, name: "reason" });
95313
+ if (!action || !target || !reason2.trim()) throw new CliUsageError(OPERATOR_KEY_USAGE);
95314
+ const { client } = await signedIn({ context, args });
95315
+ const secret = randomBytes3(32).toString("hex");
95316
+ const key = await client.post(OPERATOR_KEY_REST_PATHS.request, {
95317
+ action,
95318
+ target,
95319
+ args: argsOf({ args }),
95320
+ reason: reason2,
95321
+ secretHash: createHash5("sha256").update(secret).digest("hex")
95322
+ });
95323
+ await saveSecret({ context, keyId: key.id, secret });
95324
+ const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
95325
+ if (args.flags.json) return context.out(`${JSON.stringify(answered, null, 2)}
95326
+ `);
95327
+ context.out(`Operator key ${key.id}: ${statusLine2(answered)}
95328
+ `);
95329
+ }
95330
+ async function keyStatus({ context, args }) {
95331
+ const [, , keyId] = args.words;
95332
+ if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
95333
+ const { client } = await signedIn({ context, args });
95334
+ const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
95335
+ if (args.flags.json) return context.out(`${JSON.stringify(key, null, 2)}
95336
+ `);
95337
+ context.out(`Operator key ${key.id}: ${statusLine2(key)}
95338
+ `);
95339
+ }
95340
+ async function forgetIfOver({
95341
+ context,
95342
+ client,
95343
+ keyId
95344
+ }) {
95345
+ const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
95346
+ const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
95347
+ if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
95348
+ await rm14(keyFile({ context, keyId }), { force: true });
95349
+ }
95350
+ }
95351
+ async function useKey({ context, args }) {
95352
+ const [, , keyId] = args.words;
95353
+ if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
95354
+ const { client } = await signedIn({ context, args });
95355
+ const path = keyFile({ context, keyId });
95356
+ const secret = await readFile38(path, "utf8").catch(() => null);
95357
+ if (secret === null) {
95358
+ throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
95359
+ }
95360
+ try {
95361
+ const answer6 = await client.post(OPERATOR_KEY_REST_PATHS.use, {
95362
+ keyId,
95363
+ secret
95364
+ });
95365
+ context.out(`${JSON.stringify(answer6.result, null, 2)}
95366
+ `);
95367
+ await forgetIfOver({ context, client, keyId });
95368
+ } catch (error63) {
95369
+ if (error63 instanceof LazeApiError && error63.code === "operator_key_refused") {
95370
+ await forgetIfOver({ context, client, keyId });
95371
+ }
95372
+ throw error63;
95373
+ }
95374
+ }
95375
+ function operatorKey({ context, args }) {
95376
+ const [, action] = args.words;
95377
+ if (action === "request") return requestKey({ context, args });
95378
+ if (action === "status") return keyStatus({ context, args });
95379
+ return useKey({ context, args });
95380
+ }
95381
+
93741
95382
  // src/services/ops-commands.service.ts
93742
95383
  var OPS_USAGE = `Usage (operators, with LAZE_OPS_TOKEN set):
93743
95384
  laze ops suspend <workspace> --reason "<why>" stop and hold the workspace's computer and agents
93744
- laze ops release <workspace> --reason "<why>" lift a suspension or a Free plan hold`;
95385
+ laze ops release <workspace> --reason "<why>" lift a suspension or a Free plan hold
95386
+ ${OPERATOR_KEY_USAGE}`;
93745
95387
  async function ops({ context, args }) {
93746
95388
  const [, action, workspaceId] = args.words;
93747
- const reason = flagText({ args, name: "reason" });
95389
+ if (action === "request" || action === "status" || action === "use") {
95390
+ return operatorKey({ context, args });
95391
+ }
95392
+ const reason2 = flagText({ args, name: "reason" });
93748
95393
  let path;
93749
95394
  if (action === "suspend") path = COMPUTE_OPS_REST_PATHS.suspend;
93750
95395
  if (action === "release") path = COMPUTE_OPS_REST_PATHS.release;
93751
- if (!path || !workspaceId || !reason.trim()) throw new CliUsageError(OPS_USAGE);
95396
+ if (!path || !workspaceId || !reason2.trim()) throw new CliUsageError(OPS_USAGE);
93752
95397
  const token2 = context.environment.opsToken;
93753
95398
  if (!token2) throw new CliUsageError(`LAZE_OPS_TOKEN is not set.
93754
95399
  ${OPS_USAGE}`);
@@ -93758,7 +95403,7 @@ ${OPS_USAGE}`);
93758
95403
  }).withHeaders({ [COMPUTE_OPS_TOKEN_HEADER]: token2 });
93759
95404
  const answer6 = await client.post(path, {
93760
95405
  targetWorkspaceId: workspaceId,
93761
- reason
95406
+ reason: reason2
93762
95407
  });
93763
95408
  if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
93764
95409
  `);
@@ -93768,8 +95413,8 @@ ${OPS_USAGE}`);
93768
95413
  }
93769
95414
 
93770
95415
  // src/services/release-watch.service.ts
93771
- import { mkdir as mkdir23, readFile as readFile38, realpath, writeFile as writeFile23 } from "node:fs/promises";
93772
- import { dirname as dirname23, join as join27 } from "node:path";
95416
+ import { mkdir as mkdir24, readFile as readFile39, realpath, writeFile as writeFile24 } from "node:fs/promises";
95417
+ import { dirname as dirname24, join as join28 } from "node:path";
93773
95418
 
93774
95419
  // src/rules/cli-update.rules.ts
93775
95420
  var CLI_PACKAGE = "@lazehq/cli";
@@ -93915,16 +95560,16 @@ async function startedUpdate({
93915
95560
  if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
93916
95561
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
93917
95562
  if (plan2.kind !== "install") return null;
93918
- const folder = dirname23(context.environment.configPath);
93919
- const stamp = join27(folder, "auto-update.json");
93920
- const last = await readFile38(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
95563
+ const folder = dirname24(context.environment.configPath);
95564
+ const stamp = join28(folder, "auto-update.json");
95565
+ const last = await readFile39(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
93921
95566
  const now = context.nowMs();
93922
95567
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
93923
- await mkdir23(folder, { recursive: true, mode: 448 });
93924
- await writeFile23(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
95568
+ await mkdir24(folder, { recursive: true, mode: 448 });
95569
+ await writeFile24(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
93925
95570
  context.processes.spawnDetached({
93926
95571
  argv: [...context.program, "update"],
93927
- logPath: join27(folder, "auto-update.log")
95572
+ logPath: join28(folder, "auto-update.log")
93928
95573
  });
93929
95574
  return { manager: plan2.manager };
93930
95575
  }
@@ -93961,7 +95606,7 @@ function watchingRelease({
93961
95606
  }
93962
95607
 
93963
95608
  // src/services/rush-guard.service.ts
93964
- import { readFile as readFile39, rm as rm14 } from "node:fs/promises";
95609
+ import { readFile as readFile40, rm as rm15 } from "node:fs/promises";
93965
95610
  var WATCH_MS3 = 2e3;
93966
95611
  var RETRY_MS2 = 3e4;
93967
95612
  async function guardRound(guard) {
@@ -93995,22 +95640,22 @@ function sessionIdOf({ session }) {
93995
95640
  }
93996
95641
  async function rushWakeHook({ context, args }) {
93997
95642
  const claudePid = Number(flagText({ args, name: "claude-pid" }));
93998
- const id2 = flagText({ args, name: "rush-id" });
95643
+ const id4 = flagText({ args, name: "rush-id" });
93999
95644
  const program = flagText({ args, name: "rush-program" }) || "rush";
94000
- if (!claudePid || !id2) return 1;
95645
+ if (!claudePid || !id4) return 1;
94001
95646
  if (!await claimRushGuard({ context, claudePid })) return 0;
94002
95647
  const path = guardPathOf({ context, claudePid });
94003
95648
  try {
94004
95649
  while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
94005
95650
  const { client, name: name3 } = await signedIn({ context, args });
94006
95651
  const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
94007
- const note = await readFile39(noted, "utf8").then(
95652
+ const note = await readFile40(noted, "utf8").then(
94008
95653
  (text3) => JSON.parse(text3),
94009
95654
  () => void 0
94010
95655
  );
94011
95656
  const { launch = {}, ...session } = note ?? {};
94012
95657
  const lock = statePathOf({ context, kind: "waiters", profile: name3 });
94013
- const rush = { id: id2, program };
95658
+ const rush = { id: id4, program };
94014
95659
  const known = note ? session : void 0;
94015
95660
  const guard = { context, client, name: name3, lock, claudePid, session: known, rush, launch };
94016
95661
  const deadline = context.nowMs() + WAIT_HOOK_TIMEOUT_SECONDS * 1e3;
@@ -94033,23 +95678,27 @@ async function rushWakeHook({ context, args }) {
94033
95678
  return 0;
94034
95679
  } finally {
94035
95680
  if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
94036
- await rm14(lock, { force: true });
95681
+ await rm15(lock, { force: true });
94037
95682
  }
94038
95683
  } finally {
94039
- await rm14(path, { force: true });
95684
+ await rm15(path, { force: true });
94040
95685
  }
94041
95686
  }
94042
95687
 
94043
95688
  // src/services/schedule-commands.service.ts
94044
95689
  var USAGE16 = `Usage:
94045
95690
  laze schedule add <name> --prompt <text> (--cron "<m h dom mon dow>" | --rrule "<RRULE>" | --at <local time>)
94046
- [--tz <IANA zone>] [--channel <channelId>] [--agent <agentId>]
95691
+ [--tz <IANA zone>] [--channel <channelId>] [--agent <agentId>] [--check <script>]
94047
95692
  laze schedule list
94048
95693
  laze schedule update <scheduleId> [--name <name>] [--prompt <text>] [--cron|--rrule|--at <when>]
94049
- [--tz <IANA zone>] [--channel <channelId>|none] [--agent <agentId>]
95694
+ [--tz <IANA zone>] [--channel <channelId>|none] [--agent <agentId>] [--check <script>|none]
94050
95695
  laze schedule pause|resume|rm|runs <scheduleId>
94051
95696
  laze schedule run <scheduleId> (one extra run now; the next fire stays)
94052
- A repeating schedule runs at most every 30 minutes; a cron or RRULE that runs more often is refused.`;
95697
+ A repeating schedule runs at most every 30 minutes; a cron or RRULE that runs more often is refused.
95698
+ --check names an executable script in your work folder. It runs at each firing, without a model:
95699
+ if it prints something the agent wakes with that output added to the prompt; if it prints nothing
95700
+ nothing happens and nothing is spent; a non-zero exit or 30 s timeout is a failed check, shown
95701
+ under Needs attention. Keep what it last saw in your own file. Run now skips the check.`;
94053
95702
  function timingOf(args) {
94054
95703
  const cron = flagText({ args, name: "cron" });
94055
95704
  const rrule = flagText({ args, name: "rrule" });
@@ -94064,8 +95713,11 @@ ${USAGE16}`);
94064
95713
  }
94065
95714
  function printSchedule({ context, schedule: schedule2 }) {
94066
95715
  const next = schedule2.nextFireAt ? `next ${schedule2.nextFireAt}` : "no next fire";
95716
+ const stats = schedule2.checkStats;
95717
+ const counts = stats ? ` (7 days: ${stats.checked} checks, ${stats.woke} woke, ${stats.failed} failed)` : "";
95718
+ const check3 = schedule2.checkScript ? ` check ${schedule2.checkScript}${counts}` : "";
94067
95719
  context.out(
94068
- `${schedule2.id} ${schedule2.status} ${schedule2.name} ${schedule2.source} (${schedule2.timezone}) ${next}
95720
+ `${schedule2.id} ${schedule2.status} ${schedule2.name} ${schedule2.source} (${schedule2.timezone}) ${next}${check3}
94069
95721
  `
94070
95722
  );
94071
95723
  }
@@ -94077,13 +95729,15 @@ async function scheduleAdd({ context, args }) {
94077
95729
  const { client } = await signedIn({ context, args });
94078
95730
  const channelId = flagText({ args, name: "channel" });
94079
95731
  const agentId = flagText({ args, name: "agent" });
95732
+ const checkScript = flagText({ args, name: "check" });
94080
95733
  const schedule2 = await client.post("/api/schedules", {
94081
95734
  name: name3,
94082
95735
  prompt,
94083
95736
  timing,
94084
95737
  timezone: flagText({ args, name: "tz", fallback: "UTC" }),
94085
95738
  channelId: channelId || null,
94086
- ...agentId ? { agentId } : {}
95739
+ ...agentId ? { agentId } : {},
95740
+ ...checkScript ? { checkScript } : {}
94087
95741
  });
94088
95742
  if (args.flags.json) return context.out(`${JSON.stringify(schedule2, null, 2)}
94089
95743
  `);
@@ -94104,6 +95758,8 @@ function changesOf2(args) {
94104
95758
  }
94105
95759
  const channel = flagText({ args, name: "channel" });
94106
95760
  if (channel) changes2.channelId = channel === "none" ? null : channel;
95761
+ const check3 = flagText({ args, name: "check" });
95762
+ if (check3) changes2.checkScript = check3 === "none" ? null : check3;
94107
95763
  return changes2;
94108
95764
  }
94109
95765
  async function scheduleUpdate({ context, args }) {
@@ -94147,8 +95803,9 @@ async function scheduleRuns({ context, args }) {
94147
95803
  `);
94148
95804
  for (const run4 of runs) {
94149
95805
  const missed = run4.missed > 0 ? ` (caught up ${run4.missed} missed)` : "";
94150
- const reason = run4.reason ? ` ${run4.reason}` : "";
94151
- context.out(`${run4.scheduledFor} ${run4.status}${reason}${missed}
95806
+ const reason2 = run4.reason ? ` ${run4.reason}` : "";
95807
+ const exit = typeof run4.checkExitCode === "number" ? ` (exit ${run4.checkExitCode})` : "";
95808
+ context.out(`${run4.scheduledFor} ${run4.status}${reason2}${exit}${missed}
94152
95809
  `);
94153
95810
  }
94154
95811
  }
@@ -94180,8 +95837,8 @@ async function schedule({ context, args }) {
94180
95837
  }
94181
95838
 
94182
95839
  // src/services/skill-commands.service.ts
94183
- import { readdir as readdir8, readFile as readFile40 } from "node:fs/promises";
94184
- import { join as join28, relative as relative6, resolve as resolve19 } from "node:path";
95840
+ import { readdir as readdir8, readFile as readFile41 } from "node:fs/promises";
95841
+ import { join as join29, relative as relative6, resolve as resolve19 } from "node:path";
94185
95842
  var USAGE17 = `Usage:
94186
95843
  laze skill list [--agent <agentId>]
94187
95844
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -94202,8 +95859,8 @@ async function folderFiles({ root }) {
94202
95859
  const files2 = [];
94203
95860
  for (const entry of entries) {
94204
95861
  if (!entry.isFile()) continue;
94205
- const full = join28(entry.parentPath, entry.name);
94206
- files2.push({ path: relative6(root, full), content: await readFile40(full, "utf8") });
95862
+ const full = join29(entry.parentPath, entry.name);
95863
+ files2.push({ path: relative6(root, full), content: await readFile41(full, "utf8") });
94207
95864
  }
94208
95865
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
94209
95866
  }
@@ -94301,7 +95958,7 @@ async function skillUpdate({ context, args }) {
94301
95958
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
94302
95959
  throw new CliUsageError(USAGE17);
94303
95960
  }
94304
- const skillMd = skillMdFile ? await readFile40(resolve19(context.cwd, skillMdFile), "utf8") : void 0;
95961
+ const skillMd = skillMdFile ? await readFile41(resolve19(context.cwd, skillMdFile), "utf8") : void 0;
94305
95962
  const { client } = await signedIn({ context, args });
94306
95963
  const updated = await client.post("/api/skills/update", {
94307
95964
  name: name3,
@@ -94347,7 +96004,7 @@ async function skill({ context, args }) {
94347
96004
  }
94348
96005
 
94349
96006
  // src/services/slack-commands.service.ts
94350
- import { readFile as readFile41 } from "node:fs/promises";
96007
+ import { readFile as readFile42 } from "node:fs/promises";
94351
96008
  import { resolve as resolve20 } from "node:path";
94352
96009
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
94353
96010
  laze slack overview connected Slack workspaces, mirrors, your link
@@ -94395,7 +96052,7 @@ async function secretLines({ context, args }) {
94395
96052
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
94396
96053
  }
94397
96054
  const file3 = flagText({ args, name: "from-file" });
94398
- const text3 = file3 ? await readFile41(resolve20(context.cwd, file3), "utf8") : await context.readStdin();
96055
+ const text3 = file3 ? await readFile42(resolve20(context.cwd, file3), "utf8") : await context.readStdin();
94399
96056
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
94400
96057
  }
94401
96058
  async function secretsOf2({
@@ -94699,7 +96356,7 @@ async function slack({
94699
96356
  }
94700
96357
 
94701
96358
  // src/services/sso-commands.service.ts
94702
- import { readFile as readFile42 } from "node:fs/promises";
96359
+ import { readFile as readFile43 } from "node:fs/promises";
94703
96360
  var SSO_USAGE = `Usage:
94704
96361
  laze sso domains claimed domains and how each signs in (admins)
94705
96362
  laze sso claim <domain> the TXT record that proves the domain
@@ -94786,7 +96443,7 @@ function refuseSecretFlags({ args }) {
94786
96443
  }
94787
96444
  async function clientSecretOf({ context, args }) {
94788
96445
  const file3 = flagText({ args, name: "from-file" });
94789
- const text3 = file3 ? await readFile42(file3, "utf8") : await context.readStdin();
96446
+ const text3 = file3 ? await readFile43(file3, "utf8") : await context.readStdin();
94790
96447
  const secret = text3.trim();
94791
96448
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
94792
96449
  return secret;
@@ -94942,7 +96599,7 @@ async function scim({ context, args }) {
94942
96599
  }
94943
96600
 
94944
96601
  // src/rules/status-format.rules.ts
94945
- function statusLine2({ presence: presence2 }) {
96602
+ function statusLine3({ presence: presence2 }) {
94946
96603
  const state = presence2.presence === "away" && presence2.awayByHand ? "away (set by hand)" : presence2.presence;
94947
96604
  const { status: status11 } = presence2;
94948
96605
  if (!status11) return `You are ${state}, with no status.
@@ -94967,7 +96624,7 @@ function answer5({
94967
96624
  }) {
94968
96625
  if (args.flags.json) return context.out(`${JSON.stringify(presence2, null, 2)}
94969
96626
  `);
94970
- context.out(statusLine2({ presence: presence2 }));
96627
+ context.out(statusLine3({ presence: presence2 }));
94971
96628
  }
94972
96629
  async function statusSet({ context, args }) {
94973
96630
  const [, , emoji4, ...words] = args.words;
@@ -95118,8 +96775,8 @@ async function update2({
95118
96775
  }
95119
96776
 
95120
96777
  // src/services/vault-env-commands.service.ts
95121
- import { readFile as readFile43, stat as stat10 } from "node:fs/promises";
95122
- import { dirname as dirname24, join as join29, resolve as resolve21 } from "node:path";
96778
+ import { readFile as readFile44, stat as stat10 } from "node:fs/promises";
96779
+ import { dirname as dirname25, join as join30, resolve as resolve21 } from "node:path";
95123
96780
 
95124
96781
  // src/rules/vault-manifest.rules.ts
95125
96782
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -95207,7 +96864,7 @@ function credentialProcessJson(fields) {
95207
96864
  }
95208
96865
 
95209
96866
  // src/services/vault-batch.service.ts
95210
- import { rm as rm15 } from "node:fs/promises";
96867
+ import { rm as rm16 } from "node:fs/promises";
95211
96868
  async function batchOf({ response }) {
95212
96869
  const text3 = await response.text();
95213
96870
  if (!response.ok) {
@@ -95329,7 +96986,7 @@ async function releaseBatch({
95329
96986
  context,
95330
96987
  args,
95331
96988
  refs,
95332
- reason,
96989
+ reason: reason2,
95333
96990
  command
95334
96991
  }) {
95335
96992
  const deadline = deadlineOf({ args, nowMs: context.nowMs() });
@@ -95338,7 +96995,7 @@ async function releaseBatch({
95338
96995
  let answer6;
95339
96996
  let settled2;
95340
96997
  try {
95341
- answer6 = await door.ask({ refs, reason, command, recipient: run4.publicKey });
96998
+ answer6 = await door.ask({ refs, reason: reason2, command, recipient: run4.publicKey });
95342
96999
  const missing = answer6.entries.filter((entry) => !entry.connection);
95343
97000
  if (missing.length > 0) {
95344
97001
  context.err(
@@ -95389,7 +97046,7 @@ async function valuesOf({
95389
97046
  }) {
95390
97047
  const refused = refusalOf({ context, settled: settled2 });
95391
97048
  if (refused !== 0) {
95392
- await rm15(keyPath, { force: true });
97049
+ await rm16(keyPath, { force: true });
95393
97050
  return { exitCode: refused };
95394
97051
  }
95395
97052
  const opened = /* @__PURE__ */ new Map();
@@ -95401,7 +97058,7 @@ async function valuesOf({
95401
97058
  if (release2.message) context.err(`${release2.message}
95402
97059
  `);
95403
97060
  }
95404
- if (!keep2) await rm15(keyPath, { force: true });
97061
+ if (!keep2) await rm16(keyPath, { force: true });
95405
97062
  const released = /* @__PURE__ */ new Map();
95406
97063
  for (const entry of entries) {
95407
97064
  const fields = opened.get(keyOf(entry));
@@ -95445,9 +97102,9 @@ function reasonOf({ context, args }) {
95445
97102
  }
95446
97103
  function refusedReason({
95447
97104
  context,
95448
- reason
97105
+ reason: reason2
95449
97106
  }) {
95450
- const problem = checkVaultReason(reason);
97107
+ const problem = checkVaultReason(reason2);
95451
97108
  if (problem === "ok") return null;
95452
97109
  context.err(`laze vault: the reason is refused (${problem}). ${VAULT_REASON_GUIDANCE}
95453
97110
  `);
@@ -95467,9 +97124,9 @@ async function manifestPathOf({
95467
97124
  if (named) return resolve21(context.cwd, named);
95468
97125
  const environment = flagText({ args, name: "env" });
95469
97126
  const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
95470
- for (let dir = resolve21(context.cwd); ; dir = dirname24(dir)) {
95471
- if (await isFile(join29(dir, file3))) return join29(dir, file3);
95472
- if (dirname24(dir) === dir) break;
97127
+ for (let dir = resolve21(context.cwd); ; dir = dirname25(dir)) {
97128
+ if (await isFile(join30(dir, file3))) return join30(dir, file3);
97129
+ if (dirname25(dir) === dir) break;
95473
97130
  }
95474
97131
  throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
95475
97132
  ${ENV_USAGE}`);
@@ -95479,7 +97136,7 @@ async function manifestOf({
95479
97136
  args
95480
97137
  }) {
95481
97138
  const file3 = await manifestPathOf({ context, args });
95482
- const text3 = await readFile43(file3, "utf8").catch(() => {
97139
+ const text3 = await readFile44(file3, "utf8").catch(() => {
95483
97140
  throw new CliUsageError(`laze vault: cannot read ${file3}`);
95484
97141
  });
95485
97142
  return { file: file3, lines: parseManifest({ text: text3, file: file3 }) };
@@ -95519,12 +97176,12 @@ async function releasedKeys({
95519
97176
  context,
95520
97177
  args,
95521
97178
  refs,
95522
- reason,
97179
+ reason: reason2,
95523
97180
  command
95524
97181
  }) {
95525
97182
  const byConnection = /* @__PURE__ */ new Map();
95526
97183
  if (refs.length === 0) return { released: /* @__PURE__ */ new Map(), byConnection };
95527
- const outcome = await releaseBatch({ context, args, refs, reason, command: [...command] });
97184
+ const outcome = await releaseBatch({ context, args, refs, reason: reason2, command: [...command] });
95528
97185
  if ("exitCode" in outcome) return outcome;
95529
97186
  for (const entry of outcome.entries) {
95530
97187
  const fields = outcome.released.get(entry.ref)?.fields;
@@ -95551,18 +97208,18 @@ async function vaultEnv2({
95551
97208
  );
95552
97209
  }
95553
97210
  if (!shell && args.rest.length === 0) throw new CliUsageError(ENV_USAGE);
95554
- const reason = reasonOf({ context, args });
95555
- if (!reason)
97211
+ const reason2 = reasonOf({ context, args });
97212
+ if (!reason2)
95556
97213
  throw new CliUsageError(`Say why with --reason "<one plain sentence>"
95557
97214
  ${ENV_USAGE}`);
95558
- const badReason = refusedReason({ context, reason });
97215
+ const badReason = refusedReason({ context, reason: reason2 });
95559
97216
  if (badReason !== null) return badReason;
95560
97217
  const refs = refsOf(lines2);
95561
97218
  const outcome = await releasedKeys({
95562
97219
  context,
95563
97220
  args,
95564
97221
  refs,
95565
- reason,
97222
+ reason: reason2,
95566
97223
  command: shell ? wrappedCommandOf(args) : args.rest
95567
97224
  });
95568
97225
  if ("exitCode" in outcome) return outcome.exitCode;
@@ -95589,17 +97246,17 @@ async function vaultAws({
95589
97246
  const args = withWaitSeconds(given);
95590
97247
  const connection = args.words[2];
95591
97248
  if (!connection || args.flags.help) throw new CliUsageError(AWS_USAGE);
95592
- const reason = reasonOf({ context, args });
95593
- if (!reason) {
97249
+ const reason2 = reasonOf({ context, args });
97250
+ if (!reason2) {
95594
97251
  throw new CliUsageError(
95595
97252
  `Say why with --reason "<one plain sentence>" or KV_REASON
95596
97253
  ${AWS_USAGE}`
95597
97254
  );
95598
97255
  }
95599
- const badReason = refusedReason({ context, reason });
97256
+ const badReason = refusedReason({ context, reason: reason2 });
95600
97257
  if (badReason !== null) return badReason;
95601
97258
  const command = args.rest.length > 0 ? args.rest : ["credential_process"];
95602
- const outcome = await releaseBatch({ context, args, refs: [connection], reason, command });
97259
+ const outcome = await releaseBatch({ context, args, refs: [connection], reason: reason2, command });
95603
97260
  if ("exitCode" in outcome) return outcome.exitCode;
95604
97261
  const fields = outcome.released.get(connection)?.fields ?? {};
95605
97262
  if (!fields.AWS_SESSION_TOKEN) {
@@ -95623,12 +97280,12 @@ In openclaw.json: secrets.providers.laze = { "source": "exec", "command": "laze"
95623
97280
  "args": ["--profile", "<agent profile>", "vault", "exec-provider"], "jsonOnly": true }`;
95624
97281
  function execProviderIds({ request: request2 }) {
95625
97282
  const ids = request2?.ids;
95626
- return Array.isArray(ids) ? ids.filter((id2) => typeof id2 === "string") : [];
97283
+ return Array.isArray(ids) ? ids.filter((id4) => typeof id4 === "string") : [];
95627
97284
  }
95628
- function splitExecId({ id: id2 }) {
95629
- const at = id2.indexOf("#");
95630
- if (at === -1) return { connection: id2 };
95631
- return { connection: id2.slice(0, at), field: id2.slice(at + 1) };
97285
+ function splitExecId({ id: id4 }) {
97286
+ const at = id4.indexOf("#");
97287
+ if (at === -1) return { connection: id4 };
97288
+ return { connection: id4.slice(0, at), field: id4.slice(at + 1) };
95632
97289
  }
95633
97290
  function valueOf({
95634
97291
  fields,
@@ -95663,29 +97320,29 @@ ${EXEC_PROVIDER_USAGE}`);
95663
97320
  ids.length === 0 ? [] : (await resolveBatch({
95664
97321
  context,
95665
97322
  args,
95666
- refs: [...new Set(ids.map((id2) => splitExecId({ id: id2 }).connection))]
97323
+ refs: [...new Set(ids.map((id4) => splitExecId({ id: id4 }).connection))]
95667
97324
  })).filter((entry) => entry.connection).map((entry) => entry.ref)
95668
97325
  );
95669
- for (const id2 of ids) {
95670
- const { connection, field } = splitExecId({ id: id2 });
97326
+ for (const id4 of ids) {
97327
+ const { connection, field } = splitExecId({ id: id4 });
95671
97328
  if (!known.has(connection)) {
95672
- errors[id2] = { code: "NOT_FOUND" };
97329
+ errors[id4] = { code: "NOT_FOUND" };
95673
97330
  continue;
95674
97331
  }
95675
97332
  const outcome = await releaseBatch({
95676
97333
  context,
95677
97334
  args: noWait,
95678
97335
  refs: [connection],
95679
- reason: `OpenClaw resolves its ${id2} secret reference`,
95680
- command: ["openclaw", "secrets", "resolve", id2]
97336
+ reason: `OpenClaw resolves its ${id4} secret reference`,
97337
+ command: ["openclaw", "secrets", "resolve", id4]
95681
97338
  }).catch(() => ({ exitCode: -1 }));
95682
97339
  if ("exitCode" in outcome) {
95683
- errors[id2] = { code: codeOfExit({ exitCode: outcome.exitCode }) };
97340
+ errors[id4] = { code: codeOfExit({ exitCode: outcome.exitCode }) };
95684
97341
  continue;
95685
97342
  }
95686
97343
  const value = valueOf({ fields: outcome.released.get(connection)?.fields ?? {}, field });
95687
- if (typeof value === "string") values[id2] = value;
95688
- else errors[id2] = value;
97344
+ if (typeof value === "string") values[id4] = value;
97345
+ else errors[id4] = value;
95689
97346
  }
95690
97347
  const answer6 = {
95691
97348
  protocolVersion: 1,
@@ -95794,7 +97451,7 @@ async function vaultScrub({ context, args }) {
95794
97451
  }
95795
97452
 
95796
97453
  // src/services/whatsapp-business-commands.service.ts
95797
- import { readFile as readFile44 } from "node:fs/promises";
97454
+ import { readFile as readFile45 } from "node:fs/promises";
95798
97455
  import { resolve as resolve22 } from "node:path";
95799
97456
 
95800
97457
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
@@ -95935,7 +97592,7 @@ var whatsappBusinessSendStateSchema = external_exports.enum([
95935
97592
  "denied",
95936
97593
  "expired"
95937
97594
  ]);
95938
- var messageDefinition2 = external_exports.object({
97595
+ var messageDefinition3 = external_exports.object({
95939
97596
  id: external_exports.string(),
95940
97597
  at: external_exports.iso.datetime(),
95941
97598
  direction: external_exports.enum(["in", "out"]),
@@ -95950,9 +97607,9 @@ var readInputDefinition2 = external_exports.object({
95950
97607
  contact: contactRefSchema,
95951
97608
  limit: limitSchema2.optional()
95952
97609
  });
95953
- var readDefinition = external_exports.object({
97610
+ var readDefinition2 = external_exports.object({
95954
97611
  conversation: conversationDefinition,
95955
- messages: external_exports.array(messageDefinition2)
97612
+ messages: external_exports.array(messageDefinition3)
95956
97613
  });
95957
97614
  var sendInputDefinition2 = external_exports.object({
95958
97615
  workspaceId: workspaceIdSchema26,
@@ -96214,7 +97871,7 @@ async function secretsOf3({ context, args }) {
96214
97871
  const fromConnection = flagText({ args, name: "from-vault" });
96215
97872
  if (fromConnection) return { fromConnection };
96216
97873
  const file3 = flagText({ args, name: "from-file" });
96217
- const text3 = file3 ? await readFile44(resolve22(context.cwd, file3), "utf8") : await context.readStdin();
97874
+ const text3 = file3 ? await readFile45(resolve22(context.cwd, file3), "utf8") : await context.readStdin();
96218
97875
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
96219
97876
  if (lines2.length !== 2) {
96220
97877
  throw new CliUsageError(
@@ -96415,7 +98072,7 @@ async function whatsappBusiness({
96415
98072
  }
96416
98073
 
96417
98074
  // src/services/whatsapp-pairing-commands.service.ts
96418
- import { writeFile as writeFile24 } from "node:fs/promises";
98075
+ import { writeFile as writeFile25 } from "node:fs/promises";
96419
98076
  import { resolve as resolve23 } from "node:path";
96420
98077
  var WHATSAPP_PAIRING_USAGE = [
96421
98078
  " laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
@@ -96436,7 +98093,7 @@ function svgOf(dataUrl) {
96436
98093
  }
96437
98094
  async function report2({ context, args, pairing: pairing2 }) {
96438
98095
  const qrFile = pairing2.qrSvg ? resolve23(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
96439
- if (qrFile && pairing2.qrSvg) await writeFile24(qrFile, svgOf(pairing2.qrSvg), "utf8");
98096
+ if (qrFile && pairing2.qrSvg) await writeFile25(qrFile, svgOf(pairing2.qrSvg), "utf8");
96440
98097
  if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
96441
98098
  `);
96442
98099
  context.out(`${pairing2.pairingId} ${pairing2.state}
@@ -96926,6 +98583,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
96926
98583
  laze feed rank [<id> <priority>|--set <id>=<priority>...] order your own feed for you alone
96927
98584
  an agent with Manage my feed lists its owner's cards by title and ranks many in one call
96928
98585
  laze schedule add <name> --prompt <p> --cron "0 8 * * 1-5" --tz <zone> work on a timer
98586
+ laze schedule add|update ... --check <script> a script decides each firing, without a model
96929
98587
  laze schedule list|update|pause|resume|rm|runs your agent's schedules and their runs
96930
98588
  laze memory get|set|append|history <file>, search, pull SOUL.md, AGENTS.md, a channel's MEMORY.md
96931
98589
  laze wiki list|get|put|search|history|mv|rm the workspace wiki
@@ -97025,6 +98683,8 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
97025
98683
  laze ip [status|on <country>|off|countries|domains [add|remove|reset]|list] your dedicated IP for sites that block Laze
97026
98684
  laze ip offer --site <domain> when a site blocks the shared address: the offer to pass on, price included
97027
98685
  laze ops suspend|release <workspace> --reason "<why>" Laze operators only, with LAZE_OPS_TOKEN
98686
+ laze ops request <action> <target> --reason "<why>" [--wait] | status <key> | use <key>
98687
+ a 15 minute operator key for one action; an operator approves it with a passkey
97028
98688
  laze machine exec <machine> [--timeout <s>] -- <command> run a command on a person's own machine
97029
98689
  When someone wants work done on their own machine, run it there; if it is offline, say so and go on where you run
97030
98690
  laze machine exec <machine> --vault <connection> --reason "<why>" -- <command> the same, with a vault connection
@@ -97342,14 +99002,14 @@ function exitCodeOf({ context, error: error63 }) {
97342
99002
  // src/services/machine-key.service.ts
97343
99003
  import { execFile as execFile2 } from "node:child_process";
97344
99004
  import {
97345
- createHash as createHash5,
99005
+ createHash as createHash6,
97346
99006
  createPrivateKey,
97347
99007
  generateKeyPairSync,
97348
- randomBytes as randomBytes3,
99008
+ randomBytes as randomBytes4,
97349
99009
  sign
97350
99010
  } from "node:crypto";
97351
- import { chmod as chmod4, link, mkdir as mkdir24, readFile as readFile45, rm as rm16, writeFile as writeFile25 } from "node:fs/promises";
97352
- import { dirname as dirname25, join as join30 } from "node:path";
99011
+ import { chmod as chmod4, link, mkdir as mkdir25, readFile as readFile46, rm as rm17, writeFile as writeFile26 } from "node:fs/promises";
99012
+ import { dirname as dirname26, join as join31 } from "node:path";
97353
99013
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
97354
99014
  var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve24, reject) => {
97355
99015
  const child = execFile2(
@@ -97389,15 +99049,15 @@ var MachineKeyStore = class _MachineKeyStore {
97389
99049
  });
97390
99050
  }
97391
99051
  get metaPath() {
97392
- return join30(dirname25(this.options.configPath), "machine-key.json");
99052
+ return join31(dirname26(this.options.configPath), "machine-key.json");
97393
99053
  }
97394
99054
  /** Named by the key, so two CLIs making a key at once never overwrite each other's. */
97395
99055
  pemPathOf(jwk) {
97396
- return join30(dirname25(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
99056
+ return join31(dirname26(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
97397
99057
  }
97398
99058
  /** The Keychain item's account: one per config file and key. */
97399
99059
  accountOf(jwk) {
97400
- const config2 = createHash5("sha256").update(this.options.configPath).digest("hex");
99060
+ const config2 = createHash6("sha256").update(this.options.configPath).digest("hex");
97401
99061
  return `${config2.slice(0, 32)}-${shortOf(jwk)}`;
97402
99062
  }
97403
99063
  /** The key if this machine made one; null otherwise. Read once per process. */
@@ -97421,7 +99081,7 @@ var MachineKeyStore = class _MachineKeyStore {
97421
99081
  async read() {
97422
99082
  let meta3;
97423
99083
  try {
97424
- meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile45(this.metaPath, "utf8")));
99084
+ meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile46(this.metaPath, "utf8")));
97425
99085
  } catch {
97426
99086
  return null;
97427
99087
  }
@@ -97436,7 +99096,7 @@ var MachineKeyStore = class _MachineKeyStore {
97436
99096
  "-w"
97437
99097
  ],
97438
99098
  timeoutMs: 1e4
97439
- }) : await readFile45(this.pemPathOf(meta3.jwk), "utf8");
99099
+ }) : await readFile46(this.pemPathOf(meta3.jwk), "utf8");
97440
99100
  return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
97441
99101
  }
97442
99102
  async make() {
@@ -97460,7 +99120,7 @@ var MachineKeyStore = class _MachineKeyStore {
97460
99120
  return kept;
97461
99121
  }
97462
99122
  async drop({ tier, jwk }) {
97463
- if (tier === "file") return rm16(this.pemPathOf(jwk), { force: true });
99123
+ if (tier === "file") return rm17(this.pemPathOf(jwk), { force: true });
97464
99124
  await this.options.run({
97465
99125
  program: "security",
97466
99126
  args: ["delete-generic-password", "-s", KEYCHAIN_SERVICE, "-a", this.accountOf(jwk)],
@@ -97507,7 +99167,7 @@ function keyOf2({ meta: meta3, privateKey }) {
97507
99167
  }
97508
99168
  var shortOf = (jwk) => thumbprintOf({ jwk }).slice(0, 12);
97509
99169
  async function writeOnce({ path, text: text3 }) {
97510
- const temporary = `${path}.${process.pid}.${randomBytes3(6).toString("hex")}.tmp`;
99170
+ const temporary = `${path}.${process.pid}.${randomBytes4(6).toString("hex")}.tmp`;
97511
99171
  await writePrivate({ path: temporary, text: text3 });
97512
99172
  try {
97513
99173
  await link(temporary, path);
@@ -97516,12 +99176,12 @@ async function writeOnce({ path, text: text3 }) {
97516
99176
  if (error63.code === "EEXIST") return false;
97517
99177
  throw error63;
97518
99178
  } finally {
97519
- await rm16(temporary, { force: true });
99179
+ await rm17(temporary, { force: true });
97520
99180
  }
97521
99181
  }
97522
99182
  async function writePrivate({ path, text: text3 }) {
97523
- await mkdir24(dirname25(path), { recursive: true, mode: 448 });
97524
- await writeFile25(path, text3, { mode: 384 });
99183
+ await mkdir25(dirname26(path), { recursive: true, mode: 448 });
99184
+ await writeFile26(path, text3, { mode: 384 });
97525
99185
  await chmod4(path, 384);
97526
99186
  }
97527
99187
 
@@ -97578,8 +99238,8 @@ function machineProofFetch({
97578
99238
  // src/services/processes.service.ts
97579
99239
  import { execFile as execFile3, spawn as spawn4 } from "node:child_process";
97580
99240
  import { mkdirSync, openSync } from "node:fs";
97581
- import { readFile as readFile46, readlink } from "node:fs/promises";
97582
- import { dirname as dirname26 } from "node:path";
99241
+ import { readFile as readFile47, readlink } from "node:fs/promises";
99242
+ import { dirname as dirname27 } from "node:path";
97583
99243
  import { promisify as promisify2 } from "node:util";
97584
99244
  var run3 = promisify2(execFile3);
97585
99245
  function alive(pid) {
@@ -97591,15 +99251,15 @@ function alive(pid) {
97591
99251
  return error63.code === "EPERM";
97592
99252
  }
97593
99253
  }
97594
- async function argsOf(pid) {
97595
- const raw = await readFile46(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
99254
+ async function argsOf2(pid) {
99255
+ const raw = await readFile47(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
97596
99256
  if (raw) return raw.split("\0").filter(Boolean);
97597
99257
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
97598
99258
  const line = listed?.stdout.trim();
97599
99259
  return line ? line.split(/\s+/) : void 0;
97600
99260
  }
97601
99261
  async function parentOf(pid) {
97602
- const stat11 = await readFile46(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
99262
+ const stat11 = await readFile47(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
97603
99263
  const fromStat = stat11 ? Number(stat11.slice(stat11.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
97604
99264
  if (fromStat > 0) return fromStat;
97605
99265
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
@@ -97616,7 +99276,7 @@ async function cwdOf(pid) {
97616
99276
  return line ? line.slice(1) : void 0;
97617
99277
  }
97618
99278
  function spawnDetached({ argv, logPath }) {
97619
- mkdirSync(dirname26(logPath), { recursive: true, mode: 448 });
99279
+ mkdirSync(dirname27(logPath), { recursive: true, mode: 448 });
97620
99280
  const log = openSync(logPath, "a", 384);
97621
99281
  const [program = "", ...rest] = argv;
97622
99282
  const child = spawn4(program, rest, { detached: true, stdio: ["ignore", log, log] });
@@ -97633,7 +99293,7 @@ function stop2(pid) {
97633
99293
  return true;
97634
99294
  }
97635
99295
  function nodeProcesses() {
97636
- return { pid: process.pid, alive, argsOf, parentOf, cwdOf, spawnDetached, stop: stop2 };
99296
+ return { pid: process.pid, alive, argsOf: argsOf2, parentOf, cwdOf, spawnDetached, stop: stop2 };
97637
99297
  }
97638
99298
 
97639
99299
  // src/services/proxied-fetch.service.ts