@lazehq/cli 0.1.79 → 0.1.80
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.
- package/dist/laze.mjs +538 -290
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -3225,7 +3225,7 @@ var require_websocket = __commonJS({
|
|
|
3225
3225
|
var net = __require("net");
|
|
3226
3226
|
var tls = __require("tls");
|
|
3227
3227
|
var { randomBytes: randomBytes5, createHash: createHash7 } = __require("crypto");
|
|
3228
|
-
var { Duplex, Readable } = __require("stream");
|
|
3228
|
+
var { Duplex, Readable: Readable2 } = __require("stream");
|
|
3229
3229
|
var { URL: URL3 } = __require("url");
|
|
3230
3230
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
3231
3231
|
var Receiver2 = require_receiver();
|
|
@@ -9497,7 +9497,7 @@ var require_webidl = __commonJS({
|
|
|
9497
9497
|
var require_util2 = __commonJS({
|
|
9498
9498
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/web/fetch/util.js"(exports, module) {
|
|
9499
9499
|
"use strict";
|
|
9500
|
-
var { Transform } = __require("node:stream");
|
|
9500
|
+
var { Transform: Transform2 } = __require("node:stream");
|
|
9501
9501
|
var zlib = __require("node:zlib");
|
|
9502
9502
|
var { redirectStatusSet, referrerPolicyTokens, badPortsSet } = require_constants4();
|
|
9503
9503
|
var { getGlobalOrigin } = require_global();
|
|
@@ -10088,7 +10088,7 @@ var require_util2 = __commonJS({
|
|
|
10088
10088
|
contentRange += isomorphicEncode(`${fullLength}`);
|
|
10089
10089
|
return contentRange;
|
|
10090
10090
|
}
|
|
10091
|
-
var InflateStream = class extends
|
|
10091
|
+
var InflateStream = class extends Transform2 {
|
|
10092
10092
|
#zlibOptions;
|
|
10093
10093
|
/** @param {zlib.ZlibOptions} [zlibOptions] */
|
|
10094
10094
|
constructor(zlibOptions) {
|
|
@@ -12455,7 +12455,7 @@ var require_client_h2 = __commonJS({
|
|
|
12455
12455
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/dispatcher/client-h2.js"(exports, module) {
|
|
12456
12456
|
"use strict";
|
|
12457
12457
|
var assert2 = __require("node:assert");
|
|
12458
|
-
var { pipeline } = __require("node:stream");
|
|
12458
|
+
var { pipeline: pipeline2 } = __require("node:stream");
|
|
12459
12459
|
var util = require_util();
|
|
12460
12460
|
var {
|
|
12461
12461
|
RequestContentLengthMismatchError,
|
|
@@ -13602,7 +13602,7 @@ var require_client_h2 = __commonJS({
|
|
|
13602
13602
|
}
|
|
13603
13603
|
function writeStream(abort, socket, expectsPayload, h2stream, body, client, request2, contentLength) {
|
|
13604
13604
|
assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
|
13605
|
-
const pipe2 =
|
|
13605
|
+
const pipe2 = pipeline2(
|
|
13606
13606
|
body,
|
|
13607
13607
|
h2stream,
|
|
13608
13608
|
(err) => {
|
|
@@ -16757,7 +16757,7 @@ var require_readable = __commonJS({
|
|
|
16757
16757
|
"use strict";
|
|
16758
16758
|
var assert2 = __require("node:assert");
|
|
16759
16759
|
var { addAbortListener } = __require("node:events");
|
|
16760
|
-
var { Readable } = __require("node:stream");
|
|
16760
|
+
var { Readable: Readable2 } = __require("node:stream");
|
|
16761
16761
|
var { RequestAbortedError, NotSupportedError, InvalidArgumentError, AbortError } = require_errors();
|
|
16762
16762
|
var util = require_util();
|
|
16763
16763
|
var { ReadableStreamFrom } = require_util();
|
|
@@ -16771,7 +16771,7 @@ var require_readable = __commonJS({
|
|
|
16771
16771
|
var kBytesRead = /* @__PURE__ */ Symbol("kBytesRead");
|
|
16772
16772
|
var noop2 = () => {
|
|
16773
16773
|
};
|
|
16774
|
-
var BodyReadable = class extends
|
|
16774
|
+
var BodyReadable = class extends Readable2 {
|
|
16775
16775
|
/**
|
|
16776
16776
|
* @param {object} opts
|
|
16777
16777
|
* @param {(this: Readable, size: number) => void} opts.resume
|
|
@@ -17170,7 +17170,7 @@ var require_api_request = __commonJS({
|
|
|
17170
17170
|
"use strict";
|
|
17171
17171
|
var assert2 = __require("node:assert");
|
|
17172
17172
|
var { AsyncResource } = __require("node:async_hooks");
|
|
17173
|
-
var { Readable } = require_readable();
|
|
17173
|
+
var { Readable: Readable2 } = require_readable();
|
|
17174
17174
|
var { InvalidArgumentError, RequestAbortedError } = require_errors();
|
|
17175
17175
|
var util = require_util();
|
|
17176
17176
|
function noop2() {
|
|
@@ -17256,7 +17256,7 @@ var require_api_request = __commonJS({
|
|
|
17256
17256
|
const parsedHeaders = headers;
|
|
17257
17257
|
const contentType = parsedHeaders?.["content-type"];
|
|
17258
17258
|
const contentLength = parsedHeaders?.["content-length"];
|
|
17259
|
-
const res = new
|
|
17259
|
+
const res = new Readable2({
|
|
17260
17260
|
resume: () => controller.resume(),
|
|
17261
17261
|
abort: (reason2) => controller.abort(reason2),
|
|
17262
17262
|
contentType,
|
|
@@ -17632,7 +17632,7 @@ var require_api_pipeline = __commonJS({
|
|
|
17632
17632
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/api/api-pipeline.js"(exports, module) {
|
|
17633
17633
|
"use strict";
|
|
17634
17634
|
var {
|
|
17635
|
-
Readable,
|
|
17635
|
+
Readable: Readable2,
|
|
17636
17636
|
Duplex,
|
|
17637
17637
|
PassThrough
|
|
17638
17638
|
} = __require("node:stream");
|
|
@@ -17649,7 +17649,7 @@ var require_api_pipeline = __commonJS({
|
|
|
17649
17649
|
function noop2() {
|
|
17650
17650
|
}
|
|
17651
17651
|
var kResume = /* @__PURE__ */ Symbol("resume");
|
|
17652
|
-
var PipelineRequest = class extends
|
|
17652
|
+
var PipelineRequest = class extends Readable2 {
|
|
17653
17653
|
constructor() {
|
|
17654
17654
|
super({ autoDestroy: true });
|
|
17655
17655
|
this[kResume] = null;
|
|
@@ -17667,7 +17667,7 @@ var require_api_pipeline = __commonJS({
|
|
|
17667
17667
|
callback(err);
|
|
17668
17668
|
}
|
|
17669
17669
|
};
|
|
17670
|
-
var PipelineResponse = class extends
|
|
17670
|
+
var PipelineResponse = class extends Readable2 {
|
|
17671
17671
|
constructor(resume) {
|
|
17672
17672
|
super({ autoDestroy: true });
|
|
17673
17673
|
this[kResume] = resume;
|
|
@@ -17821,7 +17821,7 @@ var require_api_pipeline = __commonJS({
|
|
|
17821
17821
|
util.destroy(ret, err);
|
|
17822
17822
|
}
|
|
17823
17823
|
};
|
|
17824
|
-
function
|
|
17824
|
+
function pipeline2(opts, handler) {
|
|
17825
17825
|
try {
|
|
17826
17826
|
const pipelineHandler = new PipelineHandler(opts, handler);
|
|
17827
17827
|
this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler);
|
|
@@ -17830,7 +17830,7 @@ var require_api_pipeline = __commonJS({
|
|
|
17830
17830
|
return new PassThrough().destroy(err);
|
|
17831
17831
|
}
|
|
17832
17832
|
}
|
|
17833
|
-
module.exports =
|
|
17833
|
+
module.exports = pipeline2;
|
|
17834
17834
|
}
|
|
17835
17835
|
});
|
|
17836
17836
|
|
|
@@ -19155,13 +19155,13 @@ var require_mock_pool = __commonJS({
|
|
|
19155
19155
|
var require_pending_interceptors_formatter = __commonJS({
|
|
19156
19156
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/pending-interceptors-formatter.js"(exports, module) {
|
|
19157
19157
|
"use strict";
|
|
19158
|
-
var { Transform } = __require("node:stream");
|
|
19158
|
+
var { Transform: Transform2 } = __require("node:stream");
|
|
19159
19159
|
var { Console } = __require("node:console");
|
|
19160
19160
|
var PERSISTENT = process.versions.icu ? "\u2705" : "Y ";
|
|
19161
19161
|
var NOT_PERSISTENT = process.versions.icu ? "\u274C" : "N ";
|
|
19162
19162
|
module.exports = class PendingInterceptorsFormatter {
|
|
19163
19163
|
constructor({ disableColors } = {}) {
|
|
19164
|
-
this.transform = new
|
|
19164
|
+
this.transform = new Transform2({
|
|
19165
19165
|
transform(chunk, _enc, cb) {
|
|
19166
19166
|
cb(null, chunk);
|
|
19167
19167
|
}
|
|
@@ -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:
|
|
19470
|
-
var { dirname:
|
|
19469
|
+
var { writeFile: writeFile26, readFile: readFile48, mkdir: mkdir27 } = __require("node:fs/promises");
|
|
19470
|
+
var { dirname: dirname29, 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();
|
|
@@ -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
|
|
19716
|
+
await mkdir27(dirname29(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
|
|
19721
|
+
await writeFile26(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
19722
19722
|
}
|
|
19723
19723
|
/**
|
|
19724
19724
|
* Clears all recorded snapshots
|
|
@@ -22948,7 +22948,7 @@ var require_cache2 = __commonJS({
|
|
|
22948
22948
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/interceptor/cache.js"(exports, module) {
|
|
22949
22949
|
"use strict";
|
|
22950
22950
|
var assert2 = __require("node:assert");
|
|
22951
|
-
var { Readable } = __require("node:stream");
|
|
22951
|
+
var { Readable: Readable2 } = __require("node:stream");
|
|
22952
22952
|
var util = require_util();
|
|
22953
22953
|
var CacheHandler = require_cache_handler();
|
|
22954
22954
|
var MemoryCacheStore = require_memory_cache_store();
|
|
@@ -23124,7 +23124,7 @@ var require_cache2 = __commonJS({
|
|
|
23124
23124
|
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
23125
23125
|
}
|
|
23126
23126
|
function sendCachedValue(handler, opts, result2, age, context, isStale2) {
|
|
23127
|
-
const stream = util.isStream(result2.body) ? result2.body :
|
|
23127
|
+
const stream = util.isStream(result2.body) ? result2.body : Readable2.from(result2.body ?? []);
|
|
23128
23128
|
assert2(!stream.destroyed, "stream should not be destroyed");
|
|
23129
23129
|
assert2(!stream.readableDidRead, "stream should not be readableDidRead");
|
|
23130
23130
|
const controller = {
|
|
@@ -23369,7 +23369,7 @@ var require_decompress = __commonJS({
|
|
|
23369
23369
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/interceptor/decompress.js"(exports, module) {
|
|
23370
23370
|
"use strict";
|
|
23371
23371
|
var { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress } = __require("node:zlib");
|
|
23372
|
-
var { pipeline } = __require("node:stream");
|
|
23372
|
+
var { pipeline: pipeline2 } = __require("node:stream");
|
|
23373
23373
|
var DecoratorHandler = require_decorator_handler();
|
|
23374
23374
|
var supportedEncodings = {
|
|
23375
23375
|
gzip: createGunzip,
|
|
@@ -23479,7 +23479,7 @@ var require_decompress = __commonJS({
|
|
|
23479
23479
|
#setupMultipleDecompressors(controller) {
|
|
23480
23480
|
const lastDecompressor = this.#decompressors[this.#decompressors.length - 1];
|
|
23481
23481
|
this.#setupDecompressorEvents(lastDecompressor, controller);
|
|
23482
|
-
|
|
23482
|
+
pipeline2(this.#decompressors, (err) => {
|
|
23483
23483
|
if (err) {
|
|
23484
23484
|
super.onResponseError(controller, err);
|
|
23485
23485
|
return;
|
|
@@ -26273,7 +26273,7 @@ var require_fetch = __commonJS({
|
|
|
26273
26273
|
subresourceSet
|
|
26274
26274
|
} = require_constants4();
|
|
26275
26275
|
var EE = __require("node:events");
|
|
26276
|
-
var { Readable, pipeline, finished, isErrored, isReadable } = __require("node:stream");
|
|
26276
|
+
var { Readable: Readable2, pipeline: pipeline2, finished, isErrored, isReadable } = __require("node:stream");
|
|
26277
26277
|
var { addAbortListener, bufferToLowerCasedHeaderName } = require_util();
|
|
26278
26278
|
var { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = require_data_url();
|
|
26279
26279
|
var { getGlobalDispatcher } = require_global2();
|
|
@@ -27249,7 +27249,7 @@ var require_fetch = __commonJS({
|
|
|
27249
27249
|
const headersList = new HeadersList();
|
|
27250
27250
|
appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders);
|
|
27251
27251
|
const location = headersList.get("location", true);
|
|
27252
|
-
this.body = new
|
|
27252
|
+
this.body = new Readable2({ read: () => controller.resume() });
|
|
27253
27253
|
const willFollow = location && request2.redirect === "follow" && redirectStatusSet.has(status11);
|
|
27254
27254
|
const decoders = [];
|
|
27255
27255
|
if (request2.method !== "HEAD" && request2.method !== "CONNECT" && !nullBodyStatus.includes(status11) && !willFollow) {
|
|
@@ -27297,7 +27297,7 @@ var require_fetch = __commonJS({
|
|
|
27297
27297
|
status: status11,
|
|
27298
27298
|
statusText,
|
|
27299
27299
|
headersList,
|
|
27300
|
-
body: decoders.length ?
|
|
27300
|
+
body: decoders.length ? pipeline2(this.body, ...decoders, (err) => {
|
|
27301
27301
|
if (err) {
|
|
27302
27302
|
this.onResponseError(controller, err);
|
|
27303
27303
|
}
|
|
@@ -28452,7 +28452,7 @@ var require_cookies = __commonJS({
|
|
|
28452
28452
|
if (!cookies) {
|
|
28453
28453
|
return [];
|
|
28454
28454
|
}
|
|
28455
|
-
return cookies.map((
|
|
28455
|
+
return cookies.map((pair) => parseSetCookie(pair));
|
|
28456
28456
|
}
|
|
28457
28457
|
function parseCookie(cookie) {
|
|
28458
28458
|
cookie = webidl.converters.DOMString(cookie);
|
|
@@ -28954,8 +28954,8 @@ var require_util5 = __commonJS({
|
|
|
28954
28954
|
const position = { position: 0 };
|
|
28955
28955
|
const extensionList = /* @__PURE__ */ new Map();
|
|
28956
28956
|
while (position.position < extensions.length) {
|
|
28957
|
-
const
|
|
28958
|
-
const [name3, value = ""] =
|
|
28957
|
+
const pair = collectASequenceOfCodePointsFast(";", extensions, position);
|
|
28958
|
+
const [name3, value = ""] = pair.split("=", 2);
|
|
28959
28959
|
extensionList.set(
|
|
28960
28960
|
removeHTTPWhitespace(name3, true, false),
|
|
28961
28961
|
removeHTTPWhitespace(value, false, true)
|
|
@@ -30768,7 +30768,7 @@ var require_util6 = __commonJS({
|
|
|
30768
30768
|
var require_eventsource_stream = __commonJS({
|
|
30769
30769
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/web/eventsource/eventsource-stream.js"(exports, module) {
|
|
30770
30770
|
"use strict";
|
|
30771
|
-
var { Transform } = __require("node:stream");
|
|
30771
|
+
var { Transform: Transform2 } = __require("node:stream");
|
|
30772
30772
|
var { isASCIINumber, isValidLastEventId } = require_util6();
|
|
30773
30773
|
var BOM = [239, 187, 191];
|
|
30774
30774
|
var LF = 10;
|
|
@@ -30809,7 +30809,7 @@ var require_eventsource_stream = __commonJS({
|
|
|
30809
30809
|
}
|
|
30810
30810
|
return true;
|
|
30811
30811
|
}
|
|
30812
|
-
var EventSourceStream = class extends
|
|
30812
|
+
var EventSourceStream = class extends Transform2 {
|
|
30813
30813
|
/**
|
|
30814
30814
|
* @type {eventSourceSettings}
|
|
30815
30815
|
*/
|
|
@@ -31109,7 +31109,7 @@ ${value}`;
|
|
|
31109
31109
|
var require_eventsource = __commonJS({
|
|
31110
31110
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/web/eventsource/eventsource.js"(exports, module) {
|
|
31111
31111
|
"use strict";
|
|
31112
|
-
var { pipeline } = __require("node:stream");
|
|
31112
|
+
var { pipeline: pipeline2 } = __require("node:stream");
|
|
31113
31113
|
var { fetching } = require_fetch();
|
|
31114
31114
|
var { webidl } = require_webidl();
|
|
31115
31115
|
var { EventSourceStream } = require_eventsource_stream();
|
|
@@ -31259,7 +31259,7 @@ var require_eventsource = __commonJS({
|
|
|
31259
31259
|
));
|
|
31260
31260
|
}
|
|
31261
31261
|
});
|
|
31262
|
-
|
|
31262
|
+
pipeline2(
|
|
31263
31263
|
response.body.stream,
|
|
31264
31264
|
eventSourceStream,
|
|
31265
31265
|
(error63) => {
|
|
@@ -31617,6 +31617,7 @@ import { createInterface as createInterface5 } from "node:readline/promises";
|
|
|
31617
31617
|
|
|
31618
31618
|
// ../../packages/secret-guard/src/detector/laze-id.ts
|
|
31619
31619
|
var LAZE_ID = /^(?:[a-z\d]+_)?[a-z\d]+_([0-9A-Za-z]{29})$/;
|
|
31620
|
+
var LAZE_ID_INSIDE = /(?<![A-Za-z0-9])(?:[a-z\d]+_)?[a-z\d]+_[0-9A-Za-z]{29}(?![A-Za-z0-9])/g;
|
|
31620
31621
|
var BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
31621
31622
|
var FIRST_SECOND = 1577836800n;
|
|
31622
31623
|
var LAST_SECOND = 4102444800n;
|
|
@@ -31624,6 +31625,8 @@ var SEPARATOR = /[/?&=#]/;
|
|
|
31624
31625
|
var WORD = /^[A-Za-z-]{0,40}$/;
|
|
31625
31626
|
var FILE_NAME = /^[A-Za-z0-9 ._-]{1,120}\.[A-Za-z0-9]{1,8}$/;
|
|
31626
31627
|
var SLACK_ID = /^[A-Z][A-Z0-9]{7,12}$/;
|
|
31628
|
+
var KEY_RUN_MIN = 16;
|
|
31629
|
+
var KEY_RUN_MIN_DISTINCT = 10;
|
|
31627
31630
|
function isLazeId(token2) {
|
|
31628
31631
|
const body = LAZE_ID.exec(token2)?.[1];
|
|
31629
31632
|
if (!body) return false;
|
|
@@ -31642,6 +31645,26 @@ function isLazeIdText(text3) {
|
|
|
31642
31645
|
(segment, index) => isLazeId(segment) || WORD.test(segment) || SLACK_ID.test(segment) || index > 0 && isLazeId(segments[index - 1] ?? "") && FILE_NAME.test(segment)
|
|
31643
31646
|
);
|
|
31644
31647
|
}
|
|
31648
|
+
function holdsKeyRun(word3) {
|
|
31649
|
+
return word3.split(/[-_.+]/).some((run4) => {
|
|
31650
|
+
if (run4.length < KEY_RUN_MIN || new Set(run4).size < KEY_RUN_MIN_DISTINCT) return false;
|
|
31651
|
+
const mixedCase = /[a-z].*[a-z]/.test(run4) && /[A-Z].*[A-Z]/.test(run4);
|
|
31652
|
+
return mixedCase || /\d.*\d/.test(run4) && /[A-Za-z].*[A-Za-z]/.test(run4);
|
|
31653
|
+
});
|
|
31654
|
+
}
|
|
31655
|
+
function withoutLazeIds(text3) {
|
|
31656
|
+
let held = false;
|
|
31657
|
+
const rest = text3.replace(LAZE_ID_INSIDE, (id4) => {
|
|
31658
|
+
if (!isLazeId(id4)) return id4;
|
|
31659
|
+
held = true;
|
|
31660
|
+
return "/";
|
|
31661
|
+
});
|
|
31662
|
+
return { rest, held };
|
|
31663
|
+
}
|
|
31664
|
+
function isPathAroundLazeId(text3) {
|
|
31665
|
+
const { rest, held } = withoutLazeIds(text3);
|
|
31666
|
+
return held && !rest.split(SEPARATOR).some(holdsKeyRun);
|
|
31667
|
+
}
|
|
31645
31668
|
|
|
31646
31669
|
// ../../packages/secret-guard/src/detector/url-values.ts
|
|
31647
31670
|
var URL2 = /\b[a-z][a-z0-9+.-]{0,30}:\/\/[^\s<>"'`()[\]{}]+/gi;
|
|
@@ -31683,10 +31706,10 @@ function pairsIn({
|
|
|
31683
31706
|
while (at < end) {
|
|
31684
31707
|
const next = text3.indexOf("&", at);
|
|
31685
31708
|
const stop3 = next === -1 || next > end ? end : next;
|
|
31686
|
-
const
|
|
31687
|
-
const equals =
|
|
31709
|
+
const pair = text3.slice(at, stop3);
|
|
31710
|
+
const equals = pair.indexOf("=");
|
|
31688
31711
|
if (equals === -1) out.push({ start: at, end: stop3, name: "" });
|
|
31689
|
-
else out.push({ start: at + equals + 1, end: stop3, name:
|
|
31712
|
+
else out.push({ start: at + equals + 1, end: stop3, name: pair.slice(0, equals) });
|
|
31690
31713
|
at = stop3 + 1;
|
|
31691
31714
|
}
|
|
31692
31715
|
}
|
|
@@ -32318,7 +32341,7 @@ function matchSlice({
|
|
|
32318
32341
|
if (ruleIds && !ruleIds.has(rule.id)) continue;
|
|
32319
32342
|
if (rule.precondition && !rule.precondition(text3)) continue;
|
|
32320
32343
|
const matches = rawMatches(rule, text3);
|
|
32321
|
-
found.push(...matches.filter((match) => !
|
|
32344
|
+
found.push(...matches.filter((match) => !isIdOrIdPath({ text: text3, match })));
|
|
32322
32345
|
}
|
|
32323
32346
|
const urlValues = urlValuesIn(text3);
|
|
32324
32347
|
const placed = urlValues.length === 0 ? found : inLinkValues({ text: text3, found, urlValues, ruleIds });
|
|
@@ -32333,6 +32356,10 @@ function matchSlice({
|
|
|
32333
32356
|
};
|
|
32334
32357
|
});
|
|
32335
32358
|
}
|
|
32359
|
+
function isIdOrIdPath({ text: text3, match }) {
|
|
32360
|
+
const value = withExtension({ text: text3, match });
|
|
32361
|
+
return isLazeIdText(value) || match.ruleId === "shaped_api_key" && isPathAroundLazeId(value);
|
|
32362
|
+
}
|
|
32336
32363
|
var SHAPE_RULE_IDS = /* @__PURE__ */ new Set(["shaped_api_key", "named_key", "sensitive_assignment"]);
|
|
32337
32364
|
function inLinkValues({
|
|
32338
32365
|
text: text3,
|
|
@@ -36310,8 +36337,8 @@ var Duration = /* @__PURE__ */ defineTemporalClass(DurationBranding, class {
|
|
|
36310
36337
|
round(roundTo) {
|
|
36311
36338
|
return createDuration(roundDuration(refinePublicRelativeTo, getDurationSlots(this), roundTo));
|
|
36312
36339
|
}
|
|
36313
|
-
total(
|
|
36314
|
-
return totalDuration(refinePublicRelativeTo, getDurationSlots(this),
|
|
36340
|
+
total(totalOf2) {
|
|
36341
|
+
return totalDuration(refinePublicRelativeTo, getDurationSlots(this), totalOf2);
|
|
36315
36342
|
}
|
|
36316
36343
|
toLocaleString(locales = void 0, options) {
|
|
36317
36344
|
const slots = getDurationSlots(this);
|
|
@@ -36928,7 +36955,7 @@ function flagText({
|
|
|
36928
36955
|
}
|
|
36929
36956
|
|
|
36930
36957
|
// src/rules/cli-version.rules.ts
|
|
36931
|
-
var STAMPED = "0.1.
|
|
36958
|
+
var STAMPED = "0.1.80";
|
|
36932
36959
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36933
36960
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36934
36961
|
}
|
|
@@ -59941,6 +59968,8 @@ var vaultConnectionSchemaDefinition = external_exports.object({
|
|
|
59941
59968
|
connector: vaultConnectorDetailsSchema.nullable(),
|
|
59942
59969
|
/** Sealed to its owner's devices: the server cannot open it. */
|
|
59943
59970
|
sealed: external_exports.boolean().default(false),
|
|
59971
|
+
/** Laze opens it itself for its owner's background work, so it never seals to devices. */
|
|
59972
|
+
serverOpens: external_exports.boolean().optional(),
|
|
59944
59973
|
/** False for a sealed connection no enrolled device can open any more. */
|
|
59945
59974
|
openable: external_exports.boolean().default(true),
|
|
59946
59975
|
createdByUserId: external_exports.string(),
|
|
@@ -60767,9 +60796,9 @@ async function decryptFrom(input2) {
|
|
|
60767
60796
|
return gcmOpen({ key, sealed: fromBase64Url(input2.sealed), aad: input2.aad });
|
|
60768
60797
|
}
|
|
60769
60798
|
async function generateEcdhKeys() {
|
|
60770
|
-
const
|
|
60771
|
-
const raw = new Uint8Array(await subtle().exportKey("raw",
|
|
60772
|
-
return { publicKey: toBase64Url(raw), privateKey:
|
|
60799
|
+
const pair = await subtle().generateKey(P256, true, ["deriveBits"]);
|
|
60800
|
+
const raw = new Uint8Array(await subtle().exportKey("raw", pair.publicKey));
|
|
60801
|
+
return { publicKey: toBase64Url(raw), privateKey: pair.privateKey };
|
|
60773
60802
|
}
|
|
60774
60803
|
function fieldsOf(value) {
|
|
60775
60804
|
if (typeof value !== "object" || value === null) throw new VaultSealMismatchError();
|
|
@@ -62363,16 +62392,18 @@ var feedCardSchemaDefinition = external_exports.object({
|
|
|
62363
62392
|
itemId: idSchema4,
|
|
62364
62393
|
changeId: idSchema4
|
|
62365
62394
|
});
|
|
62395
|
+
var failureRetrySchemaDefinition = external_exports.object({
|
|
62396
|
+
agentId: idSchema4,
|
|
62397
|
+
messageId: idSchema4,
|
|
62398
|
+
/** The attempt that failed; a later one stored means it was already tried again. */
|
|
62399
|
+
attempt: external_exports.number().int().min(1).optional()
|
|
62400
|
+
});
|
|
62366
62401
|
var failureCardSchemaDefinition = external_exports.object({
|
|
62367
62402
|
type: external_exports.literal("failure"),
|
|
62368
|
-
|
|
62369
|
-
|
|
62370
|
-
|
|
62371
|
-
|
|
62372
|
-
messageId: idSchema4,
|
|
62373
|
-
/** The attempt that failed; a later one stored means it was already tried again. */
|
|
62374
|
-
attempt: external_exports.number().int().min(1).optional()
|
|
62375
|
-
}).optional()
|
|
62403
|
+
/** Empty when there is no reason to show: a turn that ended without answering. */
|
|
62404
|
+
details: external_exports.string().max(NOTICE_DETAILS_MAX),
|
|
62405
|
+
/** An agent's unanswered turn: Try again sends this person's message to the agent again. */
|
|
62406
|
+
retry: failureRetrySchemaDefinition.optional()
|
|
62376
62407
|
});
|
|
62377
62408
|
var welcomeCardActionSchema = external_exports.enum(["slides", "connect_agent", "new_channel", "invite"]);
|
|
62378
62409
|
var welcomeCardSchemaDefinition = external_exports.object({
|
|
@@ -62861,6 +62892,8 @@ var postNoticeInputSchemaDefinition = external_exports.object({
|
|
|
62861
62892
|
compaction: messageCompactionSchemaDefinition.optional(),
|
|
62862
62893
|
/** The raw reason behind the line, such as a provider's error, shown only under Details. */
|
|
62863
62894
|
details: external_exports.string().trim().min(1).max(NOTICE_DETAILS_MAX).optional(),
|
|
62895
|
+
/** Try again under the notice, for the message the agent did not answer. */
|
|
62896
|
+
retry: failureRetrySchemaDefinition.optional(),
|
|
62864
62897
|
/** One notice per key: a second post with it answers the first. */
|
|
62865
62898
|
clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
|
|
62866
62899
|
});
|
|
@@ -63187,6 +63220,7 @@ var attachmentTextSchemaDefinition = external_exports.object({
|
|
|
63187
63220
|
text: external_exports.string(),
|
|
63188
63221
|
truncated: external_exports.boolean()
|
|
63189
63222
|
});
|
|
63223
|
+
var ATTACHMENT_MAX_BYTES = 1024 * 1024 * 1024;
|
|
63190
63224
|
var attachmentBytesSchemaDefinition = external_exports.object({
|
|
63191
63225
|
attachment: attachmentSchemaDefinition,
|
|
63192
63226
|
bytes: external_exports.custom((value) => value instanceof Uint8Array),
|
|
@@ -63473,6 +63507,25 @@ var saveDraftInputSchemaDefinition = external_exports.object({
|
|
|
63473
63507
|
var saveDraftInputSchema = saveDraftInputSchemaDefinition;
|
|
63474
63508
|
var draftSavedSchemaDefinition = external_exports.object({ saved: external_exports.boolean() });
|
|
63475
63509
|
var draftSavedSchema = draftSavedSchemaDefinition;
|
|
63510
|
+
var cardDraftSchemaDefinition = external_exports.object({
|
|
63511
|
+
cardId: idSchema4,
|
|
63512
|
+
text: external_exports.string().max(MESSAGE_BODY_MAX),
|
|
63513
|
+
/** The writer's clock when they typed it; the newest save wins. */
|
|
63514
|
+
savedAt: external_exports.iso.datetime()
|
|
63515
|
+
});
|
|
63516
|
+
var clearedCardDraftSchemaDefinition = cardDraftSchemaDefinition.pick({
|
|
63517
|
+
cardId: true,
|
|
63518
|
+
savedAt: true
|
|
63519
|
+
});
|
|
63520
|
+
var cardDraftListSchemaDefinition = external_exports.object({
|
|
63521
|
+
drafts: external_exports.array(cardDraftSchemaDefinition),
|
|
63522
|
+
/** Comments sent or deleted, and when, so a copy saved before that is dropped. */
|
|
63523
|
+
cleared: external_exports.array(clearedCardDraftSchemaDefinition)
|
|
63524
|
+
});
|
|
63525
|
+
var saveCardDraftInputSchemaDefinition = external_exports.object({
|
|
63526
|
+
...cardDraftSchemaDefinition.shape,
|
|
63527
|
+
workspaceId: workspaceIdSchema
|
|
63528
|
+
});
|
|
63476
63529
|
var draftsParamsSchemaDefinition = external_exports.object({ workspaceId: workspaceIdSchema });
|
|
63477
63530
|
var draftPlaceParamsSchemaDefinition = external_exports.object({
|
|
63478
63531
|
workspaceId: workspaceIdSchema,
|
|
@@ -63828,6 +63881,12 @@ var FEED_PUSH_KINDS = ["approvals", "urgent", "replies", "wakeups", "groups"];
|
|
|
63828
63881
|
var feedPushKindSchema = external_exports.enum(FEED_PUSH_KINDS);
|
|
63829
63882
|
var PHONE_PUSH_DELAYS = [0, 1, 2, 5, 10, 15, 30];
|
|
63830
63883
|
var phonePushDelaySchema = external_exports.literal(PHONE_PUSH_DELAYS);
|
|
63884
|
+
var mirrorNotifyLevelSchema = external_exports.enum(["everywhere", "desktop", "off"]);
|
|
63885
|
+
var mirrorNotifySchemaDefinition = external_exports.object({
|
|
63886
|
+
slack: mirrorNotifyLevelSchema.default("everywhere"),
|
|
63887
|
+
discord: mirrorNotifyLevelSchema.default("everywhere"),
|
|
63888
|
+
whatsapp: mirrorNotifyLevelSchema.default("desktop")
|
|
63889
|
+
});
|
|
63831
63890
|
var notificationSettingsSchemaDefinition = external_exports.object({
|
|
63832
63891
|
channelDefault: channelDefaultSchema,
|
|
63833
63892
|
/** Words that notify like a mention, matched whole and case-blind. */
|
|
@@ -63855,11 +63914,19 @@ var notificationSettingsSchemaDefinition = external_exports.object({
|
|
|
63855
63914
|
/** Skips Saturday and Sunday. */
|
|
63856
63915
|
digestWeekdaysOnly: external_exports.boolean(),
|
|
63857
63916
|
/** Minutes without input on the web or the desktop app before notices reach the phone. */
|
|
63858
|
-
phonePushAfterMinutes: phonePushDelaySchema
|
|
63917
|
+
phonePushAfterMinutes: phonePushDelaySchema,
|
|
63918
|
+
/** Where each mirrored app's messages reach the person. */
|
|
63919
|
+
mirrorNotify: mirrorNotifySchemaDefinition
|
|
63859
63920
|
});
|
|
63860
63921
|
var notificationSettingsSchema = notificationSettingsSchemaDefinition;
|
|
63861
63922
|
var updateSettingsInputSchemaDefinition = external_exports.object({
|
|
63862
63923
|
...notificationSettingsSchemaDefinition.omit({ snoozeUntil: true }).partial().shape,
|
|
63924
|
+
/** Only the apps named here change. */
|
|
63925
|
+
mirrorNotify: external_exports.object({
|
|
63926
|
+
slack: mirrorNotifyLevelSchema.optional(),
|
|
63927
|
+
discord: mirrorNotifyLevelSchema.optional(),
|
|
63928
|
+
whatsapp: mirrorNotifyLevelSchema.optional()
|
|
63929
|
+
}).optional(),
|
|
63863
63930
|
workspaceId: workspaceIdSchema2,
|
|
63864
63931
|
timeZone: external_exports.string().min(1).max(64).refine((zone) => {
|
|
63865
63932
|
try {
|
|
@@ -63920,6 +63987,8 @@ var messageNoticeSchema = external_exports.object({
|
|
|
63920
63987
|
urgent: external_exports.boolean().optional(),
|
|
63921
63988
|
/** It came in through a mirror such as Slack, whose own app already rings: Laze stays silent. */
|
|
63922
63989
|
mirrored: external_exports.boolean().optional(),
|
|
63990
|
+
/** The mirrored app it came from, whose level in the person's settings decides where it goes. */
|
|
63991
|
+
mirrorApp: external_exports.enum(["slack", "discord", "whatsapp"]).optional(),
|
|
63923
63992
|
/** An @channel or @here raised it, not the conversation's every-message level. */
|
|
63924
63993
|
broadcast: external_exports.boolean().optional(),
|
|
63925
63994
|
/** The person's Notifications count, from chat: the iPhone's icon badge shows it. */
|
|
@@ -64265,6 +64334,7 @@ var feedDigestIntentSchemaDefinition = external_exports.object({
|
|
|
64265
64334
|
var notificationUi = uiTokens("notification");
|
|
64266
64335
|
var NotificationPauseHooksToken = notificationUi.hooks("pause");
|
|
64267
64336
|
var NotificationDefaultHooksToken = notificationUi.hooks("channel-default");
|
|
64337
|
+
var MirrorNotifySettingSlot = notificationUi.component("mirror-notify-setting");
|
|
64268
64338
|
var NotificationPauseDialogSlot = notificationUi.component("pause-dialog");
|
|
64269
64339
|
|
|
64270
64340
|
// ../../modules/chat/contract/src/chat.events.ts
|
|
@@ -64529,7 +64599,7 @@ var chatConfig = Config.define((c) => ({
|
|
|
64529
64599
|
/** The largest upload on any plan; a plan may allow less. */
|
|
64530
64600
|
maxUploadBytes: c.env(
|
|
64531
64601
|
"CHAT_MAX_UPLOAD_BYTES",
|
|
64532
|
-
external_exports.coerce.number().int().positive().default(
|
|
64602
|
+
external_exports.coerce.number().int().positive().default(ATTACHMENT_MAX_BYTES)
|
|
64533
64603
|
),
|
|
64534
64604
|
/** Where links in notifications and emails point. */
|
|
64535
64605
|
publicBaseUrl
|
|
@@ -65002,6 +65072,8 @@ var deliverMessageInputSchemaDefinition = external_exports.object({
|
|
|
65002
65072
|
text: external_exports.string().min(1),
|
|
65003
65073
|
/** Busy agents: `queue` waits for the turn, `steer` joins it, `interrupt` stops it. */
|
|
65004
65074
|
mode: deliveryModeSchema.default("queue"),
|
|
65075
|
+
/** Try again's count, from the second attempt on. */
|
|
65076
|
+
attempt: external_exports.number().int().min(2).optional(),
|
|
65005
65077
|
/** The vault turn of the person who asked; the CLI presents it on vault calls. */
|
|
65006
65078
|
turnToken: external_exports.string().min(1).optional(),
|
|
65007
65079
|
/** The thread the message is in; a turn joins only messages of one channel and thread. */
|
|
@@ -65228,6 +65300,8 @@ var hostFrameSchemaDefinition = external_exports.discriminatedUnion("type", [
|
|
|
65228
65300
|
messageId: external_exports.string().min(1),
|
|
65229
65301
|
text: external_exports.string().min(1),
|
|
65230
65302
|
mode: deliveryModeSchema,
|
|
65303
|
+
/** Try again's count: a later attempt is new work, not a resend of a message already seen. */
|
|
65304
|
+
attempt: external_exports.number().int().min(2).optional(),
|
|
65231
65305
|
turnToken: external_exports.string().min(1).optional(),
|
|
65232
65306
|
threadRootId: external_exports.string().min(1).optional(),
|
|
65233
65307
|
files: external_exports.array(deliveredFileSchema).max(10).default([]),
|
|
@@ -65531,8 +65605,11 @@ var agentRuntimeConfig = Config.define((c) => ({
|
|
|
65531
65605
|
"AGENT_RUNTIME_COMPUTER_IDLE_EXIT_SECONDS",
|
|
65532
65606
|
positive.int().default(60)
|
|
65533
65607
|
),
|
|
65534
|
-
/**
|
|
65535
|
-
|
|
65608
|
+
/**
|
|
65609
|
+
* A computer from an older release that stays busy is rolled after this long anyway. A roll
|
|
65610
|
+
* ends what runs in it, so the cap sits above any job an agent leaves running in a working day.
|
|
65611
|
+
*/
|
|
65612
|
+
computerRollCapMinutes: c.env("AGENT_RUNTIME_COMPUTER_ROLL_CAP_MINUTES", positive.default(720)),
|
|
65536
65613
|
/** A cold start waits while computers reserve more than host memory times this. */
|
|
65537
65614
|
computerHostOvercommit: c.env("AGENT_RUNTIME_COMPUTER_HOST_OVERCOMMIT", positive.default(2)),
|
|
65538
65615
|
/** The host's memory for that check; unset, the total memory of this box. */
|
|
@@ -65813,7 +65890,11 @@ var agentReconnectSchemaDefinition = external_exports.discriminatedUnion("connec
|
|
|
65813
65890
|
/** The owner's name for anyone else; null once they left the workspace. */
|
|
65814
65891
|
ownerName: external_exports.string().nullable(),
|
|
65815
65892
|
/** The session's folder and machine, for its owner alone; null when unknown. */
|
|
65816
|
-
where: external_exports.string().nullable()
|
|
65893
|
+
where: external_exports.string().nullable(),
|
|
65894
|
+
/** The session's folder, for its owner alone; null when unknown. */
|
|
65895
|
+
folder: external_exports.string().nullable(),
|
|
65896
|
+
/** The session's machine, for its owner alone; null when unknown. */
|
|
65897
|
+
machine: external_exports.string().nullable()
|
|
65817
65898
|
})
|
|
65818
65899
|
]);
|
|
65819
65900
|
var agentReconnectSchema = agentReconnectSchemaDefinition;
|
|
@@ -73298,10 +73379,10 @@ function outcomeOf(input2) {
|
|
|
73298
73379
|
return { kind: "dropped", openMs: input2.openMs };
|
|
73299
73380
|
}
|
|
73300
73381
|
var McpRelaySession = class {
|
|
73301
|
-
constructor(relay2, context,
|
|
73382
|
+
constructor(relay2, context, report3) {
|
|
73302
73383
|
this.relay = relay2;
|
|
73303
73384
|
this.context = context;
|
|
73304
|
-
this.report =
|
|
73385
|
+
this.report = report3;
|
|
73305
73386
|
}
|
|
73306
73387
|
relay;
|
|
73307
73388
|
context;
|
|
@@ -73360,29 +73441,29 @@ async function serveMcpRelay({
|
|
|
73360
73441
|
context,
|
|
73361
73442
|
relay: relay2,
|
|
73362
73443
|
signal,
|
|
73363
|
-
report:
|
|
73444
|
+
report: report3
|
|
73364
73445
|
}) {
|
|
73365
73446
|
let wait = 1;
|
|
73366
|
-
await
|
|
73447
|
+
await report3("connecting");
|
|
73367
73448
|
while (!signal.aborted) {
|
|
73368
|
-
const outcome = await new McpRelaySession(relay2, context,
|
|
73449
|
+
const outcome = await new McpRelaySession(relay2, context, report3).run(signal);
|
|
73369
73450
|
if (outcome.kind === "stopped") {
|
|
73370
|
-
await
|
|
73451
|
+
await report3(`stopped: ${outcome.why}`);
|
|
73371
73452
|
if (!signal.aborted)
|
|
73372
73453
|
context.err(`${relay2.target.kind} relay ${relay2.label}: ${outcome.why}
|
|
73373
73454
|
`);
|
|
73374
73455
|
return;
|
|
73375
73456
|
}
|
|
73376
73457
|
if (outcome.openMs >= STEADY_MS) wait = 1;
|
|
73377
|
-
await
|
|
73458
|
+
await report3(`reconnecting in ${wait}s`);
|
|
73378
73459
|
await context.sleep(wait * 1e3, signal);
|
|
73379
73460
|
wait = Math.min(MAX_RETRY_SECONDS, wait * 2);
|
|
73380
73461
|
}
|
|
73381
73462
|
}
|
|
73382
73463
|
var McpRelayLoops = class _McpRelayLoops {
|
|
73383
|
-
constructor(context,
|
|
73464
|
+
constructor(context, report3) {
|
|
73384
73465
|
this.context = context;
|
|
73385
|
-
this.report =
|
|
73466
|
+
this.report = report3;
|
|
73386
73467
|
}
|
|
73387
73468
|
context;
|
|
73388
73469
|
report;
|
|
@@ -73684,10 +73765,10 @@ function send(input2) {
|
|
|
73684
73765
|
}
|
|
73685
73766
|
}
|
|
73686
73767
|
var RelaySession = class {
|
|
73687
|
-
constructor(relay2, context,
|
|
73768
|
+
constructor(relay2, context, report3) {
|
|
73688
73769
|
this.relay = relay2;
|
|
73689
73770
|
this.context = context;
|
|
73690
|
-
this.report =
|
|
73771
|
+
this.report = report3;
|
|
73691
73772
|
}
|
|
73692
73773
|
relay;
|
|
73693
73774
|
context;
|
|
@@ -73783,28 +73864,28 @@ async function serveRelay({
|
|
|
73783
73864
|
context,
|
|
73784
73865
|
relay: relay2,
|
|
73785
73866
|
signal,
|
|
73786
|
-
report:
|
|
73867
|
+
report: report3
|
|
73787
73868
|
}) {
|
|
73788
73869
|
let wait = 1;
|
|
73789
|
-
await
|
|
73870
|
+
await report3("connecting");
|
|
73790
73871
|
while (!signal.aborted) {
|
|
73791
|
-
const outcome = await new RelaySession(relay2, context,
|
|
73872
|
+
const outcome = await new RelaySession(relay2, context, report3).run(signal);
|
|
73792
73873
|
if (outcome.kind === "stopped") {
|
|
73793
|
-
await
|
|
73874
|
+
await report3(`stopped: ${outcome.why}`);
|
|
73794
73875
|
if (!signal.aborted) context.err(`openclaw relay ${relay2.label}: ${outcome.why}
|
|
73795
73876
|
`);
|
|
73796
73877
|
return;
|
|
73797
73878
|
}
|
|
73798
73879
|
if (outcome.openMs >= STEADY_MS2) wait = 1;
|
|
73799
|
-
await
|
|
73880
|
+
await report3(`reconnecting in ${wait}s`);
|
|
73800
73881
|
await context.sleep(wait * 1e3, signal);
|
|
73801
73882
|
wait = Math.min(MAX_RETRY_SECONDS2, wait * 2);
|
|
73802
73883
|
}
|
|
73803
73884
|
}
|
|
73804
73885
|
var RelayLoops = class _RelayLoops {
|
|
73805
|
-
constructor(context,
|
|
73886
|
+
constructor(context, report3) {
|
|
73806
73887
|
this.context = context;
|
|
73807
|
-
this.report =
|
|
73888
|
+
this.report = report3;
|
|
73808
73889
|
}
|
|
73809
73890
|
context;
|
|
73810
73891
|
report;
|
|
@@ -74211,7 +74292,7 @@ async function serveAgent({
|
|
|
74211
74292
|
profile,
|
|
74212
74293
|
entry,
|
|
74213
74294
|
signal,
|
|
74214
|
-
report:
|
|
74295
|
+
report: report3
|
|
74215
74296
|
}) {
|
|
74216
74297
|
const client = LazeClient.create({
|
|
74217
74298
|
baseUrl: entry.url,
|
|
@@ -74223,7 +74304,7 @@ async function serveAgent({
|
|
|
74223
74304
|
const ended = new AbortController();
|
|
74224
74305
|
const watching = watch.run({ signal: AbortSignal.any([signal, ended.signal]) });
|
|
74225
74306
|
try {
|
|
74226
|
-
await serveRounds({ context, client, profile, entry, signal, report:
|
|
74307
|
+
await serveRounds({ context, client, profile, entry, signal, report: report3, watch });
|
|
74227
74308
|
} finally {
|
|
74228
74309
|
ended.abort();
|
|
74229
74310
|
await watching;
|
|
@@ -74235,11 +74316,11 @@ async function serveRounds({
|
|
|
74235
74316
|
profile,
|
|
74236
74317
|
entry,
|
|
74237
74318
|
signal,
|
|
74238
|
-
report:
|
|
74319
|
+
report: report3,
|
|
74239
74320
|
watch
|
|
74240
74321
|
}) {
|
|
74241
74322
|
let wait = 1;
|
|
74242
|
-
await
|
|
74323
|
+
await report3(profile, "listening");
|
|
74243
74324
|
while (!signal.aborted) {
|
|
74244
74325
|
try {
|
|
74245
74326
|
const delivered = await deliverRound({
|
|
@@ -74250,25 +74331,25 @@ async function serveRounds({
|
|
|
74250
74331
|
signal,
|
|
74251
74332
|
watch
|
|
74252
74333
|
});
|
|
74253
|
-
if (wait > 1) await
|
|
74334
|
+
if (wait > 1) await report3(profile, "listening");
|
|
74254
74335
|
wait = 1;
|
|
74255
74336
|
if (delivered === 0) await context.sleep(1e3, signal);
|
|
74256
74337
|
} catch (error63) {
|
|
74257
74338
|
const migrated = migratedNoticeOf(error63);
|
|
74258
74339
|
if (migrated) {
|
|
74259
|
-
await
|
|
74340
|
+
await report3(profile, "stopped: the agent moved into Laze");
|
|
74260
74341
|
context.err(`${profile}: ${migrated.notice}
|
|
74261
74342
|
`);
|
|
74262
74343
|
return;
|
|
74263
74344
|
}
|
|
74264
74345
|
if (error63 instanceof LazeApiError && error63.status === 401) {
|
|
74265
|
-
await
|
|
74346
|
+
await report3(profile, "stopped: Laze refused the agent's key; link the session again");
|
|
74266
74347
|
context.err(`${profile}: Laze refused the key; this agent is no longer served
|
|
74267
74348
|
`);
|
|
74268
74349
|
return;
|
|
74269
74350
|
}
|
|
74270
74351
|
const state = stateOfError({ error: error63, delivery: entry.delivery });
|
|
74271
|
-
await
|
|
74352
|
+
await report3(profile, state);
|
|
74272
74353
|
context.err(`${profile}: ${state}; trying again in ${wait}s
|
|
74273
74354
|
`);
|
|
74274
74355
|
await context.sleep(wait * 1e3, signal);
|
|
@@ -74302,19 +74383,19 @@ async function syncLoops(run4) {
|
|
|
74302
74383
|
setAgent(run4, profile, void 0);
|
|
74303
74384
|
}
|
|
74304
74385
|
const linked = Object.entries(config2.profiles).filter(
|
|
74305
|
-
(
|
|
74386
|
+
(pair) => pair[1].delivery?.harness === "codex" && pair[1].kind === "agent" && !pair[1].migrated
|
|
74306
74387
|
);
|
|
74307
74388
|
for (const [profile, entry] of linked.filter(([name3]) => !run4.served.has(name3))) {
|
|
74308
74389
|
const { threadId } = entry.delivery;
|
|
74309
74390
|
setAgent(run4, profile, { agent: entry.name, threadId, state: "starting" });
|
|
74310
74391
|
const stop3 = new AbortController();
|
|
74311
|
-
const
|
|
74392
|
+
const report3 = async (name3, line) => {
|
|
74312
74393
|
const agent3 = run4.state.agents[name3];
|
|
74313
74394
|
if (!agent3) return;
|
|
74314
74395
|
setAgent(run4, name3, { ...agent3, state: line });
|
|
74315
74396
|
if (await holdsLock(run4)) await save(run4);
|
|
74316
74397
|
};
|
|
74317
|
-
const done = serveAgent({ context: run4.context, profile, entry, signal: stop3.signal, report:
|
|
74398
|
+
const done = serveAgent({ context: run4.context, profile, entry, signal: stop3.signal, report: report3 });
|
|
74318
74399
|
run4.served.set(profile, { token: entry.token, threadId, stop: stop3, done });
|
|
74319
74400
|
}
|
|
74320
74401
|
}
|
|
@@ -75389,6 +75470,9 @@ without a recap; the person's DM already shows your messages elsewhere.
|
|
|
75389
75470
|
|
|
75390
75471
|
## The feed
|
|
75391
75472
|
|
|
75473
|
+
Claude Code background commands stop after 30 minutes by default. For longer work pass a longer
|
|
75474
|
+
timeout (2 hours at most) or use a schedule.
|
|
75475
|
+
|
|
75392
75476
|
A schedule that only polls for changes should not run a turn each time: give it a check with
|
|
75393
75477
|
\`laze schedule add|update ... --check <script>\`. The script prints something to wake you with
|
|
75394
75478
|
that output, prints nothing to let you sleep, and keeps its own state in a file.
|
|
@@ -75421,7 +75505,10 @@ guide first: https://laze.so/docs/agents/apps.md. The short version:
|
|
|
75421
75505
|
|
|
75422
75506
|
- Create it where it was asked for: \`laze app create "<Name>" --channel <channel>\`. It starts
|
|
75423
75507
|
empty: build it from scratch and design it for its subject. Be visual and creative (a diagram,
|
|
75424
|
-
a map, a timeline, something to explore), not stat tiles and bullet lists.
|
|
75508
|
+
a map, a timeline, something to explore), not stat tiles and bullet lists. Be very visual:
|
|
75509
|
+
motion graphics and flows where you can, guiding people one step at a time until they fully
|
|
75510
|
+
understand. Never walls of text: where you need words, use simple, short sentences. An app is
|
|
75511
|
+
for people to understand, not for your own brain dump.
|
|
75425
75512
|
- The slides template is only for a new deck. Sent files that already are a page or a deck (an
|
|
75426
75513
|
HTML export, a zip with index.html, a static site): unpack them as they are into a new app
|
|
75427
75514
|
with no template (\`laze app create "<Name>" --channel <channel>\`), index.html at the top of
|
|
@@ -76248,8 +76335,8 @@ function usageOf2({
|
|
|
76248
76335
|
limitedUntil,
|
|
76249
76336
|
nowMs
|
|
76250
76337
|
}) {
|
|
76251
|
-
const
|
|
76252
|
-
if (
|
|
76338
|
+
const limited2 = ahead({ iso: limitedUntil, nowMs });
|
|
76339
|
+
if (limited2) return `out of usage until ${utcTimeOf(limited2)}`;
|
|
76253
76340
|
if (usedPercent === null) return "no usage reading yet";
|
|
76254
76341
|
const resets = ahead({ iso: resetsAt, nowMs });
|
|
76255
76342
|
const used = `${Math.round(usedPercent)}% used`;
|
|
@@ -83950,7 +84037,144 @@ async function channelSettings({ context, args }) {
|
|
|
83950
84037
|
|
|
83951
84038
|
// src/services/chat-actions-commands.service.ts
|
|
83952
84039
|
import { readFile as readFile24 } from "node:fs/promises";
|
|
83953
|
-
import { basename as
|
|
84040
|
+
import { basename as basename7, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve10 } from "node:path";
|
|
84041
|
+
|
|
84042
|
+
// src/services/file-download.service.ts
|
|
84043
|
+
import { createWriteStream } from "node:fs";
|
|
84044
|
+
import { mkdir as mkdir21, rename as rename5, rm as rm10, stat as stat9, truncate } from "node:fs/promises";
|
|
84045
|
+
import { basename as basename6, dirname as dirname20, resolve as resolve9 } from "node:path";
|
|
84046
|
+
import { Readable, Transform } from "node:stream";
|
|
84047
|
+
import { pipeline } from "node:stream/promises";
|
|
84048
|
+
var NOT_READY_WAIT_MS = 5e3;
|
|
84049
|
+
var NOT_READY_TRIES = 24;
|
|
84050
|
+
var STALLED_TRIES = 4;
|
|
84051
|
+
var RETRY_WAIT_MS = 1e3;
|
|
84052
|
+
var LIMIT_LINE = `This file is over the ${ATTACHMENT_MAX_BYTES / 1024 ** 3} GB limit`;
|
|
84053
|
+
async function linkOf({
|
|
84054
|
+
context,
|
|
84055
|
+
client,
|
|
84056
|
+
attachmentId
|
|
84057
|
+
}) {
|
|
84058
|
+
for (let tries = 1; ; tries += 1) {
|
|
84059
|
+
try {
|
|
84060
|
+
return await client.post(CHAT_KEY_PATHS.fileLink, { attachmentId, download: true });
|
|
84061
|
+
} catch (error63) {
|
|
84062
|
+
const processing = error63 instanceof LazeApiError && error63.code === "file_not_ready";
|
|
84063
|
+
if (!processing || tries >= NOT_READY_TRIES) throw error63;
|
|
84064
|
+
await context.sleep(NOT_READY_WAIT_MS);
|
|
84065
|
+
}
|
|
84066
|
+
}
|
|
84067
|
+
}
|
|
84068
|
+
function nameFrom({ response, attachmentId }) {
|
|
84069
|
+
const header = response.headers.get("content-disposition") ?? "";
|
|
84070
|
+
const encoded = /filename\*=UTF-8''([^;]+)/i.exec(header)?.[1];
|
|
84071
|
+
const plain3 = /filename="?([^";]+)"?/i.exec(header)?.[1];
|
|
84072
|
+
const name3 = encoded ? decodeURIComponent(encoded) : plain3;
|
|
84073
|
+
const safe = name3 ? basename6(name3.replaceAll("\\", "/")) : "";
|
|
84074
|
+
return safe && safe !== "." && safe !== ".." ? safe : attachmentId;
|
|
84075
|
+
}
|
|
84076
|
+
function limited({ start: start2 }) {
|
|
84077
|
+
let total = start2;
|
|
84078
|
+
return new Transform({
|
|
84079
|
+
transform(chunk, _encoding, done) {
|
|
84080
|
+
total += chunk.byteLength;
|
|
84081
|
+
if (total > ATTACHMENT_MAX_BYTES) done(new CliUsageError(LIMIT_LINE));
|
|
84082
|
+
else done(null, chunk);
|
|
84083
|
+
}
|
|
84084
|
+
});
|
|
84085
|
+
}
|
|
84086
|
+
function totalOf({ response, start: start2 }) {
|
|
84087
|
+
const ranged = /\/(\d+)$/.exec(response.headers.get("content-range") ?? "")?.[1];
|
|
84088
|
+
if (ranged) return Number(ranged);
|
|
84089
|
+
const length = response.headers.get("content-length");
|
|
84090
|
+
if (length === null) return void 0;
|
|
84091
|
+
return Number(length) + (response.status === 206 ? start2 : 0);
|
|
84092
|
+
}
|
|
84093
|
+
var sizeOnDisk = (path) => stat9(path).then(
|
|
84094
|
+
(found) => found.size,
|
|
84095
|
+
() => 0
|
|
84096
|
+
);
|
|
84097
|
+
async function fetchInto({
|
|
84098
|
+
context,
|
|
84099
|
+
url: url2,
|
|
84100
|
+
part,
|
|
84101
|
+
attachmentId,
|
|
84102
|
+
out
|
|
84103
|
+
}) {
|
|
84104
|
+
const had = await sizeOnDisk(part);
|
|
84105
|
+
const response = await context.fetcher(url2, {
|
|
84106
|
+
headers: had > 0 ? { range: `bytes=${had}-` } : {}
|
|
84107
|
+
});
|
|
84108
|
+
if (response.status === 416) return { done: true, path: void 0 };
|
|
84109
|
+
if (response.status >= 500) return { done: false, path: void 0 };
|
|
84110
|
+
if (!response.ok || !response.body) {
|
|
84111
|
+
throw new CliUsageError(`The file store refused the download (${response.status})`);
|
|
84112
|
+
}
|
|
84113
|
+
const start2 = response.status === 206 ? had : 0;
|
|
84114
|
+
if (start2 === 0) await truncate(part, 0).catch(() => void 0);
|
|
84115
|
+
const total = totalOf({ response, start: start2 });
|
|
84116
|
+
if (total !== void 0 && total > ATTACHMENT_MAX_BYTES) {
|
|
84117
|
+
await response.body.cancel();
|
|
84118
|
+
throw new CliUsageError(LIMIT_LINE);
|
|
84119
|
+
}
|
|
84120
|
+
const path = out ? void 0 : nameFrom({ response, attachmentId });
|
|
84121
|
+
await pipeline(
|
|
84122
|
+
Readable.fromWeb(response.body),
|
|
84123
|
+
limited({ start: start2 }),
|
|
84124
|
+
createWriteStream(part, { flags: "a" })
|
|
84125
|
+
);
|
|
84126
|
+
const size = await sizeOnDisk(part);
|
|
84127
|
+
if (total !== void 0 && size > total) {
|
|
84128
|
+
throw new CliUsageError("The file changed during the download; try again");
|
|
84129
|
+
}
|
|
84130
|
+
return { done: total === void 0 || size === total, path };
|
|
84131
|
+
}
|
|
84132
|
+
var retryable = (error63) => !(error63 instanceof CliUsageError || error63 instanceof LazeApiError) && !isDiskError(error63);
|
|
84133
|
+
function isDiskError(error63) {
|
|
84134
|
+
const code = error63?.code;
|
|
84135
|
+
return ["ENOSPC", "EACCES", "EROFS", "EISDIR", "ENOTDIR", "EDQUOT"].includes(String(code));
|
|
84136
|
+
}
|
|
84137
|
+
async function fetchWhole(input2) {
|
|
84138
|
+
const { context, client, attachmentId, part, out } = input2;
|
|
84139
|
+
let named;
|
|
84140
|
+
let stalled = 0;
|
|
84141
|
+
for (; ; ) {
|
|
84142
|
+
const before = await sizeOnDisk(part);
|
|
84143
|
+
try {
|
|
84144
|
+
const { url: url2 } = await linkOf({ context, client, attachmentId });
|
|
84145
|
+
const { done, path } = await fetchInto({ context, url: url2, part, attachmentId, out });
|
|
84146
|
+
named = path ?? named;
|
|
84147
|
+
if (done) return named;
|
|
84148
|
+
} catch (error63) {
|
|
84149
|
+
if (!retryable(error63)) throw error63;
|
|
84150
|
+
}
|
|
84151
|
+
stalled = await sizeOnDisk(part) > before ? 0 : stalled + 1;
|
|
84152
|
+
if (stalled >= STALLED_TRIES) {
|
|
84153
|
+
throw new CliUsageError(`The download of ${attachmentId} kept failing; try again`);
|
|
84154
|
+
}
|
|
84155
|
+
await context.sleep(RETRY_WAIT_MS);
|
|
84156
|
+
}
|
|
84157
|
+
}
|
|
84158
|
+
async function downloadFile({
|
|
84159
|
+
context,
|
|
84160
|
+
client,
|
|
84161
|
+
attachmentId,
|
|
84162
|
+
out
|
|
84163
|
+
}) {
|
|
84164
|
+
const asked = out ? resolve9(context.cwd, out) : void 0;
|
|
84165
|
+
const part = resolve9(asked ? dirname20(asked) : context.cwd, `.${attachmentId}.part`);
|
|
84166
|
+
await mkdir21(dirname20(part), { recursive: true });
|
|
84167
|
+
const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
|
|
84168
|
+
async (error63) => {
|
|
84169
|
+
await rm10(part, { force: true });
|
|
84170
|
+
if (!isDiskError(error63)) throw error63;
|
|
84171
|
+
throw new CliUsageError(`Could not write ${attachmentId} to disk: ${String(error63)}`);
|
|
84172
|
+
}
|
|
84173
|
+
);
|
|
84174
|
+
const path = asked ?? resolve9(context.cwd, named ?? attachmentId);
|
|
84175
|
+
await rename5(part, path);
|
|
84176
|
+
return { path, sizeBytes: await sizeOnDisk(path) };
|
|
84177
|
+
}
|
|
83954
84178
|
|
|
83955
84179
|
// src/services/thread-wait-commands.service.ts
|
|
83956
84180
|
var USAGE7 = "Usage: laze thread <message-id> --wait-reply [--timeout <1-3600 seconds>]";
|
|
@@ -84005,6 +84229,7 @@ var CHAT_ACTIONS_USAGE = `Usage:
|
|
|
84005
84229
|
laze channel unread <channel> [--seq <n>] mark it unread from a message, or its last one
|
|
84006
84230
|
laze files <channel> [--before <fileId>] [--limit <n>] its files, newest first
|
|
84007
84231
|
laze file link <fileId> [--variant original|thumbnail|poster|preview] [--download]
|
|
84232
|
+
laze file download <fileId> [--out <path>] save a file to disk, up to 1 GB
|
|
84008
84233
|
laze file rename <fileId> <name> rename a file you posted
|
|
84009
84234
|
laze file upload <channel> <path> [--name <name>] [--type <content-type>] upload a file; post it with its id
|
|
84010
84235
|
laze saved [--done] [--limit <n>] | laze saved marks your saved messages (people)
|
|
@@ -84205,10 +84430,10 @@ var files = async ({ context, args, client }) => {
|
|
|
84205
84430
|
};
|
|
84206
84431
|
function uploadNameOf({ cwd, path }) {
|
|
84207
84432
|
const inside = relative4(cwd, path);
|
|
84208
|
-
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside :
|
|
84433
|
+
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename7(path);
|
|
84209
84434
|
}
|
|
84210
84435
|
var fileUpload = async ({ context, args, client }) => {
|
|
84211
|
-
const path =
|
|
84436
|
+
const path = resolve10(context.cwd, wordAt(args, 3));
|
|
84212
84437
|
const bytes = new Uint8Array(await readFile24(path));
|
|
84213
84438
|
const answer6 = await uploadFile({
|
|
84214
84439
|
context,
|
|
@@ -84240,6 +84465,17 @@ var FILE_VERBS = {
|
|
|
84240
84465
|
download: Boolean(args.flags.download)
|
|
84241
84466
|
});
|
|
84242
84467
|
print6({ context, args, answer: answer6, text: (it) => `${it.url}
|
|
84468
|
+
` });
|
|
84469
|
+
},
|
|
84470
|
+
download: async ({ context, args, client }) => {
|
|
84471
|
+
const out = flagText({ args, name: "out" });
|
|
84472
|
+
const answer6 = await downloadFile({
|
|
84473
|
+
context,
|
|
84474
|
+
client,
|
|
84475
|
+
attachmentId: wordAt(args, 2),
|
|
84476
|
+
...out && { out }
|
|
84477
|
+
});
|
|
84478
|
+
print6({ context, args, answer: answer6, text: (it) => `Saved ${it.path} (${it.sizeBytes} bytes).
|
|
84243
84479
|
` });
|
|
84244
84480
|
},
|
|
84245
84481
|
rename: async ({ context, args, client }) => {
|
|
@@ -84382,7 +84618,7 @@ async function chatActions({
|
|
|
84382
84618
|
}
|
|
84383
84619
|
|
|
84384
84620
|
// src/services/claude-monitor.service.ts
|
|
84385
|
-
import { readFile as readFile25, rm as
|
|
84621
|
+
import { readFile as readFile25, rm as rm11 } from "node:fs/promises";
|
|
84386
84622
|
var MONITOR_IDLE_MS = 3e4;
|
|
84387
84623
|
var MONITOR_OUTRANKED_MS = 3e3;
|
|
84388
84624
|
async function deliverOnce({
|
|
@@ -84450,7 +84686,7 @@ async function monitorRound(turn) {
|
|
|
84450
84686
|
async function release({ context, profile }) {
|
|
84451
84687
|
const lock = statePathOf({ context, kind: "waiters", profile });
|
|
84452
84688
|
if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
|
|
84453
|
-
await
|
|
84689
|
+
await rm11(lock, { force: true });
|
|
84454
84690
|
}
|
|
84455
84691
|
async function monitorHook({ context, args }) {
|
|
84456
84692
|
const claudePid = await claudePidOf({ context });
|
|
@@ -84822,7 +85058,7 @@ var COMPUTER_SIZES = [
|
|
|
84822
85058
|
units: 8
|
|
84823
85059
|
})
|
|
84824
85060
|
];
|
|
84825
|
-
var DEDICATED_IP_TERMS = { monthlyCost:
|
|
85061
|
+
var DEDICATED_IP_TERMS = { monthlyCost: 3.59, monthlyPrice: 4 };
|
|
84826
85062
|
var DEDICATED_IP_MARKUP = DEDICATED_IP_TERMS.monthlyPrice / DEDICATED_IP_TERMS.monthlyCost;
|
|
84827
85063
|
var CREDIT_TERMS = {
|
|
84828
85064
|
minTopUp: 10,
|
|
@@ -85528,6 +85764,15 @@ var computerChangedDefinition = external_exports.object({
|
|
|
85528
85764
|
// ../../modules/compute/contract/src/dedicated-ip.ts
|
|
85529
85765
|
var DEDICATED_IP_MAX_DOMAINS = 50;
|
|
85530
85766
|
var DEDICATED_IP_MONTHLY_PRICE = DEDICATED_IP_TERMS.monthlyPrice;
|
|
85767
|
+
var adoptDedicatedAddressInputDefinition = external_exports.object({
|
|
85768
|
+
workspaceId: external_exports.string().min(1),
|
|
85769
|
+
userId: external_exports.string().min(1),
|
|
85770
|
+
orderId: external_exports.string().min(1),
|
|
85771
|
+
ip: external_exports.string().min(1),
|
|
85772
|
+
countryCode: external_exports.string().length(2),
|
|
85773
|
+
coveredThrough: external_exports.iso.date(),
|
|
85774
|
+
reason: external_exports.string().trim().min(3).max(500)
|
|
85775
|
+
});
|
|
85531
85776
|
var countryDefinition = external_exports.object({
|
|
85532
85777
|
/** ISO 3166-1 alpha-2, upper case. */
|
|
85533
85778
|
code: external_exports.string().length(2),
|
|
@@ -85745,7 +85990,7 @@ var whatsappSendDefinition = external_exports.object({
|
|
|
85745
85990
|
var whatsappPairingDefinition = external_exports.object({
|
|
85746
85991
|
pairingId: external_exports.string(),
|
|
85747
85992
|
machineId: external_exports.string(),
|
|
85748
|
-
state: external_exports.enum(["starting", "scan", "paired", "failed"]),
|
|
85993
|
+
state: external_exports.enum(["starting", "scan", "linking", "paired", "failed"]),
|
|
85749
85994
|
/** The code as an SVG data URL, while `state` is `scan`. */
|
|
85750
85995
|
qrSvg: external_exports.string().nullable(),
|
|
85751
85996
|
/** The code to type on the phone, when the pairing named a phone number. */
|
|
@@ -85762,11 +86007,19 @@ var pairInputDefinition = external_exports.object({
|
|
|
85762
86007
|
});
|
|
85763
86008
|
var whatsappPairInputSchema = pairInputDefinition;
|
|
85764
86009
|
var whatsappOnlineModeSchema = external_exports.enum(["never", "active"]);
|
|
86010
|
+
var whatsappVisitEveryDefinition = external_exports.union([
|
|
86011
|
+
external_exports.literal(5),
|
|
86012
|
+
external_exports.literal(15),
|
|
86013
|
+
external_exports.literal(30),
|
|
86014
|
+
external_exports.literal(60)
|
|
86015
|
+
]);
|
|
86016
|
+
var whatsappVisitEverySchema = whatsappVisitEveryDefinition;
|
|
85765
86017
|
var mirrorSettingsDefinition = external_exports.object({
|
|
85766
86018
|
machineId: external_exports.string(),
|
|
85767
86019
|
mirrorOn: external_exports.boolean(),
|
|
85768
86020
|
onlineMode: whatsappOnlineModeSchema,
|
|
85769
|
-
agentsRead: external_exports.boolean()
|
|
86021
|
+
agentsRead: external_exports.boolean(),
|
|
86022
|
+
visitEveryMinutes: whatsappVisitEverySchema
|
|
85770
86023
|
});
|
|
85771
86024
|
var whatsappMirrorSettingsSchema = mirrorSettingsDefinition;
|
|
85772
86025
|
var setMirrorSettingsDefinition = external_exports.object({
|
|
@@ -85774,9 +86027,20 @@ var setMirrorSettingsDefinition = external_exports.object({
|
|
|
85774
86027
|
machine: machineRefText2,
|
|
85775
86028
|
mirrorOn: external_exports.boolean().optional(),
|
|
85776
86029
|
onlineMode: whatsappOnlineModeSchema.optional(),
|
|
85777
|
-
agentsRead: external_exports.boolean().optional()
|
|
86030
|
+
agentsRead: external_exports.boolean().optional(),
|
|
86031
|
+
visitEveryMinutes: whatsappVisitEverySchema.optional()
|
|
85778
86032
|
});
|
|
85779
86033
|
var setWhatsappMirrorInputSchema = setMirrorSettingsDefinition;
|
|
86034
|
+
var whatsappComputerDefinition = external_exports.object({
|
|
86035
|
+
offered: external_exports.boolean(),
|
|
86036
|
+
machineId: external_exports.string().nullable(),
|
|
86037
|
+
machine: external_exports.string().nullable(),
|
|
86038
|
+
linked: external_exports.boolean(),
|
|
86039
|
+
nextVisitAt: external_exports.string().nullable()
|
|
86040
|
+
});
|
|
86041
|
+
var whatsappComputerSchema = whatsappComputerDefinition;
|
|
86042
|
+
var whatsappComputerInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20 });
|
|
86043
|
+
var whatsappComputerInputSchema = whatsappComputerInputDefinition;
|
|
85780
86044
|
var whatsappChangeDefinition = external_exports.object({
|
|
85781
86045
|
chat: external_exports.string().min(1).max(200),
|
|
85782
86046
|
chatName: external_exports.string().max(500),
|
|
@@ -85804,9 +86068,6 @@ var COMPUTE_WHATSAPP_REST_PATHS = {
|
|
|
85804
86068
|
read: "/api/compute/whatsapp/read",
|
|
85805
86069
|
send: "/api/compute/whatsapp/send",
|
|
85806
86070
|
sendStatus: "/api/compute/whatsapp/send-status",
|
|
85807
|
-
pair: "/api/compute/whatsapp/pair",
|
|
85808
|
-
pairing: "/api/compute/whatsapp/pairing",
|
|
85809
|
-
cancelPairing: "/api/compute/whatsapp/cancel-pairing",
|
|
85810
86071
|
unpair: "/api/compute/whatsapp/unpair"
|
|
85811
86072
|
};
|
|
85812
86073
|
|
|
@@ -86118,7 +86379,7 @@ var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
|
86118
86379
|
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, machineId: idSchema23 });
|
|
86119
86380
|
var ComputeApi = moduleApi()("compute");
|
|
86120
86381
|
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();
|
|
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();
|
|
86382
|
+
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
|
|
86122
86383
|
var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
|
|
86123
86384
|
var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
|
|
86124
86385
|
var restRenameInputDefinition = external_exports.object({
|
|
@@ -86186,6 +86447,7 @@ var machineWatchStateDefinition = external_exports.object({
|
|
|
86186
86447
|
|
|
86187
86448
|
// ../../modules/compute/contract/src/compute.ui.ts
|
|
86188
86449
|
var computeUi = uiTokens("compute");
|
|
86450
|
+
var ComputeWhatsappMessagingSlot = computeUi.component("whatsapp-messaging");
|
|
86189
86451
|
var ComputeBrowserTabSlot = computeUi.component("browser-tab");
|
|
86190
86452
|
var ComputeOpenBrowserSlot = computeUi.component("open-browser");
|
|
86191
86453
|
var ComputeBrowserLinkOfferSlot = computeUi.component("browser-link-offer");
|
|
@@ -86277,9 +86539,9 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
|
|
|
86277
86539
|
});
|
|
86278
86540
|
|
|
86279
86541
|
// src/services/computer-copy-commands.service.ts
|
|
86280
|
-
import { mkdtemp as mkdtemp2, open as open4, rm as
|
|
86542
|
+
import { mkdtemp as mkdtemp2, open as open4, rm as rm12, stat as stat10 } from "node:fs/promises";
|
|
86281
86543
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
86282
|
-
import { basename as
|
|
86544
|
+
import { basename as basename8, dirname as dirname21, resolve as resolve11 } from "node:path";
|
|
86283
86545
|
var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
|
|
86284
86546
|
copy a local file or folder into your hosted agent's work folder
|
|
86285
86547
|
(its owner only, up to 2 GiB packed); <folder> is relative to the
|
|
@@ -86293,9 +86555,9 @@ function stringFlag(args, name3) {
|
|
|
86293
86555
|
}
|
|
86294
86556
|
function packingOf({ path, isDirectory }) {
|
|
86295
86557
|
const contents = isDirectory && path.endsWith("/");
|
|
86296
|
-
const absolute =
|
|
86297
|
-
const name3 =
|
|
86298
|
-
return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent:
|
|
86558
|
+
const absolute = resolve11(path);
|
|
86559
|
+
const name3 = basename8(absolute);
|
|
86560
|
+
return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname21(absolute), entry: name3 };
|
|
86299
86561
|
}
|
|
86300
86562
|
async function sendParts2({
|
|
86301
86563
|
context,
|
|
@@ -86339,22 +86601,22 @@ async function copy({ context, args }) {
|
|
|
86339
86601
|
if (!path || !agent3) throw new CliUsageError(`Usage:
|
|
86340
86602
|
${COMPUTER_COPY_USAGE}`);
|
|
86341
86603
|
const to = stringFlag(args, "to") ?? ".";
|
|
86342
|
-
const full =
|
|
86343
|
-
const found = await
|
|
86604
|
+
const full = resolve11(context.cwd, path);
|
|
86605
|
+
const found = await stat10(full).catch(() => void 0);
|
|
86344
86606
|
if (!found) throw new CliUsageError(`${path} does not exist`);
|
|
86345
86607
|
const { name: name3, parent, entry } = packingOf({
|
|
86346
86608
|
path: path.endsWith("/") ? `${full}/` : full,
|
|
86347
86609
|
isDirectory: found.isDirectory()
|
|
86348
86610
|
});
|
|
86349
|
-
const dir = await mkdtemp2(
|
|
86350
|
-
const archive2 =
|
|
86611
|
+
const dir = await mkdtemp2(resolve11(tmpdir4(), "laze-copy-"));
|
|
86612
|
+
const archive2 = resolve11(dir, `${name3}.tar.gz`);
|
|
86351
86613
|
try {
|
|
86352
86614
|
const code = await context.runCommand({
|
|
86353
86615
|
command: ["tar", "-czf", archive2, "-C", parent, entry],
|
|
86354
86616
|
env: { COPYFILE_DISABLE: "1" }
|
|
86355
86617
|
});
|
|
86356
86618
|
if (code !== 0) throw new CliUsageError(`tar could not pack ${path} (exit ${code})`);
|
|
86357
|
-
const sizeBytes = (await
|
|
86619
|
+
const sizeBytes = (await stat10(archive2)).size;
|
|
86358
86620
|
if (sizeBytes > COMPUTER_COPY_MAX_BYTES)
|
|
86359
86621
|
throw new CliUsageError(`${path} packs to ${mb(sizeBytes)}; a copy holds at most 2 GiB`);
|
|
86360
86622
|
const client = await computeClient({ context, args });
|
|
@@ -86378,7 +86640,7 @@ It lands before ${done.agentName}'s next turn.
|
|
|
86378
86640
|
`
|
|
86379
86641
|
);
|
|
86380
86642
|
} finally {
|
|
86381
|
-
await
|
|
86643
|
+
await rm12(dir, { recursive: true, force: true });
|
|
86382
86644
|
}
|
|
86383
86645
|
}
|
|
86384
86646
|
|
|
@@ -86864,7 +87126,7 @@ async function connect({
|
|
|
86864
87126
|
|
|
86865
87127
|
// src/services/connector-commands.service.ts
|
|
86866
87128
|
import { readFile as readFile29 } from "node:fs/promises";
|
|
86867
|
-
import { resolve as
|
|
87129
|
+
import { resolve as resolve12 } from "node:path";
|
|
86868
87130
|
|
|
86869
87131
|
// src/services/vault-keychain-commands.service.ts
|
|
86870
87132
|
import { readFile as readFile28 } from "node:fs/promises";
|
|
@@ -87518,7 +87780,7 @@ async function keyText({ context, args }) {
|
|
|
87518
87780
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
87519
87781
|
}
|
|
87520
87782
|
const file3 = flagText({ args, name: "from-file" });
|
|
87521
|
-
const text3 = file3 ? await readFile29(
|
|
87783
|
+
const text3 = file3 ? await readFile29(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
|
|
87522
87784
|
const trimmed = text3.trim();
|
|
87523
87785
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
87524
87786
|
return trimmed;
|
|
@@ -87840,7 +88102,7 @@ async function conversationDelete({ context, args }) {
|
|
|
87840
88102
|
|
|
87841
88103
|
// src/services/discord-commands.service.ts
|
|
87842
88104
|
import { readFile as readFile30 } from "node:fs/promises";
|
|
87843
|
-
import { resolve as
|
|
88105
|
+
import { resolve as resolve13 } from "node:path";
|
|
87844
88106
|
|
|
87845
88107
|
// ../../modules/discord/contract/src/discord.ts
|
|
87846
88108
|
var workspaceIdSchema24 = external_exports.string().min(1).max(64);
|
|
@@ -88161,7 +88423,7 @@ async function secretsOf({ context, args }) {
|
|
|
88161
88423
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
88162
88424
|
if (fromConnection) return { fromConnection };
|
|
88163
88425
|
const file3 = flagText({ args, name: "from-file" });
|
|
88164
|
-
const text3 = file3 ? await readFile30(
|
|
88426
|
+
const text3 = file3 ? await readFile30(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
|
|
88165
88427
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
88166
88428
|
if (lines2.length !== 2) {
|
|
88167
88429
|
throw new CliUsageError(
|
|
@@ -88465,7 +88727,7 @@ async function domains({ context, args }) {
|
|
|
88465
88727
|
|
|
88466
88728
|
// src/services/emoji-commands.service.ts
|
|
88467
88729
|
import { readFile as readFile31 } from "node:fs/promises";
|
|
88468
|
-
import { resolve as
|
|
88730
|
+
import { resolve as resolve14 } from "node:path";
|
|
88469
88731
|
var EMOJI_USAGE = `Usage:
|
|
88470
88732
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
88471
88733
|
laze emoji add <name> <file> [--alias <a,b>] add a PNG, JPEG or GIF as :name: (made 128px square)
|
|
@@ -88505,7 +88767,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
88505
88767
|
const file3 = wordAt4(args, 3);
|
|
88506
88768
|
let bytes;
|
|
88507
88769
|
try {
|
|
88508
|
-
bytes = new Uint8Array(await readFile31(
|
|
88770
|
+
bytes = new Uint8Array(await readFile31(resolve14(context.cwd, file3)));
|
|
88509
88771
|
} catch {
|
|
88510
88772
|
throw new CliUsageError(`Cannot read ${file3}.`);
|
|
88511
88773
|
}
|
|
@@ -88822,7 +89084,7 @@ var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
|
88822
89084
|
|
|
88823
89085
|
// src/services/workspace-commands.service.ts
|
|
88824
89086
|
import { readFile as readFile32 } from "node:fs/promises";
|
|
88825
|
-
import { resolve as
|
|
89087
|
+
import { resolve as resolve15 } from "node:path";
|
|
88826
89088
|
var ROLE_NAMES2 = {
|
|
88827
89089
|
OWNER: "Owner",
|
|
88828
89090
|
ADMIN: "Admin",
|
|
@@ -88865,7 +89127,7 @@ async function mine2({ context, args }) {
|
|
|
88865
89127
|
`).join("") || "No workspaces.\n"
|
|
88866
89128
|
});
|
|
88867
89129
|
}
|
|
88868
|
-
async function
|
|
89130
|
+
async function rename6({ context, args }) {
|
|
88869
89131
|
const name3 = args.words.slice(2).join(" ").trim();
|
|
88870
89132
|
if (!name3) throw new CliUsageError("Usage: laze workspace rename <name>");
|
|
88871
89133
|
const { client } = await signedIn({ context, args });
|
|
@@ -89004,7 +89266,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
89004
89266
|
async function readLogo({ context, file: file3 }) {
|
|
89005
89267
|
let bytes;
|
|
89006
89268
|
try {
|
|
89007
|
-
bytes = new Uint8Array(await readFile32(
|
|
89269
|
+
bytes = new Uint8Array(await readFile32(resolve15(context.cwd, file3)));
|
|
89008
89270
|
} catch {
|
|
89009
89271
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
89010
89272
|
}
|
|
@@ -89044,7 +89306,7 @@ var WORKSPACE_COMMANDS = {
|
|
|
89044
89306
|
switch: switchTo,
|
|
89045
89307
|
logo,
|
|
89046
89308
|
mine: mine2,
|
|
89047
|
-
rename:
|
|
89309
|
+
rename: rename6,
|
|
89048
89310
|
create,
|
|
89049
89311
|
leave,
|
|
89050
89312
|
delete: scheduleDeletion,
|
|
@@ -89605,7 +89867,7 @@ async function agentFeedAccess({
|
|
|
89605
89867
|
|
|
89606
89868
|
// src/services/feed-commands.service.ts
|
|
89607
89869
|
import { readFile as readFile33 } from "node:fs/promises";
|
|
89608
|
-
import { resolve as
|
|
89870
|
+
import { resolve as resolve16 } from "node:path";
|
|
89609
89871
|
|
|
89610
89872
|
// ../../modules/feed/contract/src/feed.delegate.ts
|
|
89611
89873
|
var feedDelegateSchemaDefinition = external_exports.object({
|
|
@@ -90105,6 +90367,21 @@ var commentFeedItemInputSchemaDefinition = external_exports.object({
|
|
|
90105
90367
|
after: feedCommentAfterSchemaDefinition.nullable().default(null)
|
|
90106
90368
|
});
|
|
90107
90369
|
var commentFeedItemInputSchema = commentFeedItemInputSchemaDefinition;
|
|
90370
|
+
var saveCommentDraftInputSchemaDefinition = external_exports.object({
|
|
90371
|
+
...itemRef.shape,
|
|
90372
|
+
text: external_exports.string().max(MESSAGE_BODY_MAX),
|
|
90373
|
+
/** The writer's clock when they typed it; the newest save wins. */
|
|
90374
|
+
savedAt: external_exports.iso.datetime()
|
|
90375
|
+
});
|
|
90376
|
+
var saveCommentDraftInputSchema = saveCommentDraftInputSchemaDefinition;
|
|
90377
|
+
var commentDraftSavedSchemaDefinition = external_exports.object({ saved: external_exports.boolean() });
|
|
90378
|
+
var commentDraftSavedSchema = commentDraftSavedSchemaDefinition;
|
|
90379
|
+
var commentDraftListSchemaDefinition = external_exports.object({
|
|
90380
|
+
drafts: external_exports.array(external_exports.object({ itemId: external_exports.string(), text: external_exports.string(), savedAt: external_exports.iso.datetime() })),
|
|
90381
|
+
/** Comments sent or deleted, and when, so a copy saved before that is dropped. */
|
|
90382
|
+
cleared: external_exports.array(external_exports.object({ itemId: external_exports.string(), savedAt: external_exports.iso.datetime() }))
|
|
90383
|
+
});
|
|
90384
|
+
var commentDraftListSchema = commentDraftListSchemaDefinition;
|
|
90108
90385
|
var snoozeFeedItemInputSchemaDefinition = external_exports.object({
|
|
90109
90386
|
...itemRef.shape,
|
|
90110
90387
|
until: external_exports.iso.datetime({ offset: true })
|
|
@@ -90316,7 +90593,7 @@ var feedPageMirror = {
|
|
|
90316
90593
|
},
|
|
90317
90594
|
storable: feedPageForDisk
|
|
90318
90595
|
};
|
|
90319
|
-
var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("page", { mirrored: feedPageMirror }).withInput(pageFeedInputSchema).withOutput(feedPageSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).query("decisions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(feedDecisionsSchema).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("share").withInput(shareFeedItemInputSchema).withOutput(feedShareAnswerSchema).mutation("unshare").withInput(unshareFeedItemInputSchema).withOutput(feedShareAnswerSchema).query("shareCandidates").withInput(itemRef).withOutput(external_exports.array(feedSharePersonSchema)).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentTransfer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("pin").withInput(pinFeedItemInputSchema).withOutput(feedItemSchema).mutation("markRead").withInput(itemRef).withOutput(feedItemSchema).mutation("markUnread").withInput(itemRef).withOutput(feedItemSchema).mutation("markAllRead").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ workspaceId: external_exports.string() })).query("delegates").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(feedDelegateSchema)).mutation("setDelegate").withInput(setFeedDelegateInputSchema).withOutput(external_exports.array(feedDelegateSchema)).build();
|
|
90596
|
+
var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("page", { mirrored: feedPageMirror }).withInput(pageFeedInputSchema).withOutput(feedPageSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).query("decisions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(feedDecisionsSchema).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).query("commentDrafts").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(commentDraftListSchema).mutation("saveCommentDraft").withInput(saveCommentDraftInputSchema).withOutput(commentDraftSavedSchema).mutation("deleteCommentDraft").withInput(itemRef).withOutput(commentDraftSavedSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("share").withInput(shareFeedItemInputSchema).withOutput(feedShareAnswerSchema).mutation("unshare").withInput(unshareFeedItemInputSchema).withOutput(feedShareAnswerSchema).query("shareCandidates").withInput(itemRef).withOutput(external_exports.array(feedSharePersonSchema)).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentTransfer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("pin").withInput(pinFeedItemInputSchema).withOutput(feedItemSchema).mutation("markRead").withInput(itemRef).withOutput(feedItemSchema).mutation("markUnread").withInput(itemRef).withOutput(feedItemSchema).mutation("markAllRead").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ workspaceId: external_exports.string() })).query("delegates").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(feedDelegateSchema)).mutation("setDelegate").withInput(setFeedDelegateInputSchema).withOutput(external_exports.array(feedDelegateSchema)).build();
|
|
90320
90597
|
var feedUi = uiTokens("feed");
|
|
90321
90598
|
var FeedNavSlot = feedUi.component("nav");
|
|
90322
90599
|
var FeedDecisionsSlot = feedUi.component("decisions");
|
|
@@ -90723,7 +91000,7 @@ async function bodyOf2({
|
|
|
90723
91000
|
flags: flags2
|
|
90724
91001
|
}) {
|
|
90725
91002
|
const body = { ...flags2.fields };
|
|
90726
|
-
const read4 = (source) => "file" in source ? readFile33(
|
|
91003
|
+
const read4 = (source) => "file" in source ? readFile33(resolve16(context.cwd, source.file), "utf8") : source.text;
|
|
90727
91004
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
|
|
90728
91005
|
if (flags2.rich) {
|
|
90729
91006
|
const text3 = await read4(flags2.rich.source);
|
|
@@ -90986,7 +91263,7 @@ async function textFlag({
|
|
|
90986
91263
|
}) {
|
|
90987
91264
|
const value = flagText({ args, name: name3 });
|
|
90988
91265
|
if (!value.startsWith("@")) return value;
|
|
90989
|
-
return readFile33(
|
|
91266
|
+
return readFile33(resolve16(context.cwd, value.slice(1)), "utf8");
|
|
90990
91267
|
}
|
|
90991
91268
|
async function feedList({ context, args }) {
|
|
90992
91269
|
const { client } = await signedIn({ context, args });
|
|
@@ -91076,17 +91353,17 @@ async function ranksOf({
|
|
|
91076
91353
|
}) {
|
|
91077
91354
|
const file3 = flagText({ args, name: "file" });
|
|
91078
91355
|
if (file3) {
|
|
91079
|
-
const parsed = JSON.parse(await readFile33(
|
|
91356
|
+
const parsed = JSON.parse(await readFile33(resolve16(context.cwd, file3), "utf8"));
|
|
91080
91357
|
if (Array.isArray(parsed)) return parsed;
|
|
91081
91358
|
throw new CliUsageError("--file holds a list of {itemId, priority}");
|
|
91082
91359
|
}
|
|
91083
91360
|
const [itemId, priority] = args.words.slice(2);
|
|
91084
91361
|
const named = itemId && priority ? [`${itemId}=${priority}`] : [];
|
|
91085
|
-
return [...named, ...args.lists.set ?? []].map((
|
|
91086
|
-
const at =
|
|
91362
|
+
return [...named, ...args.lists.set ?? []].map((pair) => {
|
|
91363
|
+
const at = pair.indexOf("=");
|
|
91087
91364
|
if (at < 1) throw new CliUsageError(USAGE10);
|
|
91088
91365
|
try {
|
|
91089
|
-
return { itemId:
|
|
91366
|
+
return { itemId: pair.slice(0, at), priority: rankOf(pair.slice(at + 1)) };
|
|
91090
91367
|
} catch (error63) {
|
|
91091
91368
|
throw new CliUsageError(error63 instanceof Error ? error63.message : String(error63));
|
|
91092
91369
|
}
|
|
@@ -91306,7 +91583,7 @@ async function githubCredential({
|
|
|
91306
91583
|
}) {
|
|
91307
91584
|
if (args.words[2] !== "get") return;
|
|
91308
91585
|
const asked = Object.fromEntries(
|
|
91309
|
-
(await context.readStdin()).split("\n").map((line) => line.split(/=(.*)/s, 2)).filter((
|
|
91586
|
+
(await context.readStdin()).split("\n").map((line) => line.split(/=(.*)/s, 2)).filter((pair) => pair.length === 2)
|
|
91310
91587
|
);
|
|
91311
91588
|
if (asked.host !== "github.com") return;
|
|
91312
91589
|
const credential = await credentialOf({ env: context.environment.inherited });
|
|
@@ -91456,7 +91733,7 @@ async function create2({ context, args }) {
|
|
|
91456
91733
|
});
|
|
91457
91734
|
printGroup({ context, args, group });
|
|
91458
91735
|
}
|
|
91459
|
-
async function
|
|
91736
|
+
async function rename7({ context, args }) {
|
|
91460
91737
|
const group = wordAt6({ args, at: 2 });
|
|
91461
91738
|
const name3 = wordAt6({ args, at: 3 });
|
|
91462
91739
|
const { client } = await signedIn({ context, args });
|
|
@@ -91495,7 +91772,7 @@ function changing3(key) {
|
|
|
91495
91772
|
var COMMANDS = {
|
|
91496
91773
|
list: list7,
|
|
91497
91774
|
create: create2,
|
|
91498
|
-
rename:
|
|
91775
|
+
rename: rename7,
|
|
91499
91776
|
delete: remove5,
|
|
91500
91777
|
add: changing3("add"),
|
|
91501
91778
|
remove: changing3("remove")
|
|
@@ -91748,7 +92025,7 @@ async function invite3({ context, args }) {
|
|
|
91748
92025
|
// src/services/ip-commands.service.ts
|
|
91749
92026
|
var IP_USAGE = `Usage:
|
|
91750
92027
|
laze ip [status] [--json] your dedicated IP: on or off, country, address, domains
|
|
91751
|
-
laze ip on <country> turn it on in a country (code or name),
|
|
92028
|
+
laze ip on <country> turn it on in a country (code or name), 4 a month from credits
|
|
91752
92029
|
laze ip off turn it off; your agents use the shared address again
|
|
91753
92030
|
laze ip countries the countries on sale
|
|
91754
92031
|
laze ip domains the domains it routes
|
|
@@ -91886,12 +92163,12 @@ async function ip({ context, args }) {
|
|
|
91886
92163
|
}
|
|
91887
92164
|
|
|
91888
92165
|
// src/services/join-commands.service.ts
|
|
91889
|
-
import { mkdir as
|
|
91890
|
-
import { dirname as
|
|
92166
|
+
import { mkdir as mkdir22, readFile as readFile35, rename as rename8, rm as rm13, writeFile as writeFile21 } from "node:fs/promises";
|
|
92167
|
+
import { dirname as dirname22, join as join25 } from "node:path";
|
|
91891
92168
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
91892
92169
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
91893
92170
|
function pendingPathOf({ context }) {
|
|
91894
|
-
return join25(
|
|
92171
|
+
return join25(dirname22(context.environment.configPath), "join", "pending.json");
|
|
91895
92172
|
}
|
|
91896
92173
|
async function readPending({
|
|
91897
92174
|
context,
|
|
@@ -91908,13 +92185,13 @@ async function readPending({
|
|
|
91908
92185
|
}
|
|
91909
92186
|
async function keepPending({ context, pending: pending2 }) {
|
|
91910
92187
|
const path = pendingPathOf({ context });
|
|
91911
|
-
await
|
|
92188
|
+
await mkdir22(dirname22(path), { recursive: true, mode: 448 });
|
|
91912
92189
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
91913
92190
|
await writeFile21(temporary, JSON.stringify(pending2), { mode: 384 });
|
|
91914
|
-
await
|
|
92191
|
+
await rename8(temporary, path);
|
|
91915
92192
|
}
|
|
91916
92193
|
async function dropPending({ context }) {
|
|
91917
|
-
await
|
|
92194
|
+
await rm13(pendingPathOf({ context }), { force: true });
|
|
91918
92195
|
}
|
|
91919
92196
|
function waitSecondsOf3({ args }) {
|
|
91920
92197
|
const raw = flagText({ args, name: "timeout" });
|
|
@@ -92482,7 +92759,7 @@ async function get({ context, args }) {
|
|
|
92482
92759
|
machine: await client.post(COMPUTE_REST_PATHS.get, { machine: machine2 })
|
|
92483
92760
|
});
|
|
92484
92761
|
}
|
|
92485
|
-
async function
|
|
92762
|
+
async function rename9({ context, args }) {
|
|
92486
92763
|
const machine2 = wordAt7({ args, at: 2 });
|
|
92487
92764
|
const name3 = wordAt7({ args, at: 3 });
|
|
92488
92765
|
const client = await computeClient({ context, args });
|
|
@@ -92528,7 +92805,7 @@ ${MACHINE_ACCESS_USAGE}`);
|
|
|
92528
92805
|
});
|
|
92529
92806
|
printMachine({ context, args, machine: changed });
|
|
92530
92807
|
}
|
|
92531
|
-
var COMMANDS2 = { status: status8, get, rename:
|
|
92808
|
+
var COMMANDS2 = { status: status8, get, rename: rename9, grant: share2, revoke: share2, budget };
|
|
92532
92809
|
function machineAccessCommand(name3) {
|
|
92533
92810
|
return name3 && Object.hasOwn(COMMANDS2, name3) ? COMMANDS2[name3] : void 0;
|
|
92534
92811
|
}
|
|
@@ -93049,17 +93326,17 @@ async function serveMcp({
|
|
|
93049
93326
|
|
|
93050
93327
|
// src/services/memory-commands.service.ts
|
|
93051
93328
|
import { readdir as readdir7, readFile as readFile37 } from "node:fs/promises";
|
|
93052
|
-
import { join as join26, resolve as
|
|
93329
|
+
import { join as join26, resolve as resolve18 } from "node:path";
|
|
93053
93330
|
|
|
93054
93331
|
// src/services/mount-files.service.ts
|
|
93055
|
-
import { mkdir as
|
|
93056
|
-
import { dirname as
|
|
93332
|
+
import { mkdir as mkdir23, readFile as readFile36, rm as rm14, writeFile as writeFile22 } from "node:fs/promises";
|
|
93333
|
+
import { dirname as dirname23, relative as relative5, resolve as resolve17 } from "node:path";
|
|
93057
93334
|
async function textArgument({
|
|
93058
93335
|
context,
|
|
93059
93336
|
value
|
|
93060
93337
|
}) {
|
|
93061
93338
|
if (value === "-") return context.readStdin();
|
|
93062
|
-
if (value.startsWith("@")) return readFile36(
|
|
93339
|
+
if (value.startsWith("@")) return readFile36(resolve17(context.cwd, value.slice(1)), "utf8");
|
|
93063
93340
|
return value;
|
|
93064
93341
|
}
|
|
93065
93342
|
function turnChannel({ context, args }) {
|
|
@@ -93071,15 +93348,15 @@ async function writeMount({
|
|
|
93071
93348
|
folder,
|
|
93072
93349
|
files: files2
|
|
93073
93350
|
}) {
|
|
93074
|
-
const root =
|
|
93075
|
-
await
|
|
93076
|
-
await
|
|
93351
|
+
const root = resolve17(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
93352
|
+
await rm14(root, { recursive: true, force: true });
|
|
93353
|
+
await mkdir23(root, { recursive: true });
|
|
93077
93354
|
for (const file3 of files2) {
|
|
93078
|
-
const target =
|
|
93355
|
+
const target = resolve17(root, file3.path);
|
|
93079
93356
|
const inside = relative5(root, target);
|
|
93080
93357
|
if (!inside || inside.startsWith(".."))
|
|
93081
93358
|
throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
|
|
93082
|
-
await
|
|
93359
|
+
await mkdir23(dirname23(target), { recursive: true });
|
|
93083
93360
|
await writeFile22(target, file3.content);
|
|
93084
93361
|
}
|
|
93085
93362
|
return root;
|
|
@@ -93335,7 +93612,7 @@ async function siestaImport({
|
|
|
93335
93612
|
args,
|
|
93336
93613
|
dir
|
|
93337
93614
|
}) {
|
|
93338
|
-
const root =
|
|
93615
|
+
const root = resolve18(context.cwd, dir);
|
|
93339
93616
|
const log = await readFile37(join26(root, "LOG.md"));
|
|
93340
93617
|
const names = (await readdir7(join26(root, "tree")).catch(() => [])).filter(
|
|
93341
93618
|
(name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
|
|
@@ -93363,7 +93640,7 @@ async function memoryImport({ context, args }) {
|
|
|
93363
93640
|
if (siesta) return siestaImport({ context, args, dir: siesta });
|
|
93364
93641
|
const dir = flagText({ args, name: "optmem" });
|
|
93365
93642
|
if (!dir) throw new CliUsageError(USAGE13);
|
|
93366
|
-
const root =
|
|
93643
|
+
const root = resolve18(context.cwd, dir);
|
|
93367
93644
|
const log = await readFile37(join26(root, "LOG.txt"));
|
|
93368
93645
|
const sizes2 = (await readdir7(join26(root, "TREE")).catch(() => [])).filter(
|
|
93369
93646
|
(name3) => /^\d{1,4}$/.test(name3)
|
|
@@ -93733,7 +94010,7 @@ async function notifications({ context, args }) {
|
|
|
93733
94010
|
}
|
|
93734
94011
|
|
|
93735
94012
|
// src/services/openclaw-commands.service.ts
|
|
93736
|
-
import { resolve as
|
|
94013
|
+
import { resolve as resolve19 } from "node:path";
|
|
93737
94014
|
var OPENCLAW_USAGE = `Usage (a person's key; a gateway belongs to the person who connects it):
|
|
93738
94015
|
laze openclaw list the gateways connected here and their agents
|
|
93739
94016
|
laze openclaw connect <wss url> [--label <label>] (< token | --from-file <file> | --from-vault <connection>)
|
|
@@ -93884,7 +94161,7 @@ var agentKey = async ({ context, args, client, url: url2 }) => {
|
|
|
93884
94161
|
});
|
|
93885
94162
|
const login2 = flagText({ args, name: "login" });
|
|
93886
94163
|
if (login2) {
|
|
93887
|
-
const folder =
|
|
94164
|
+
const folder = resolve19(context.cwd, login2);
|
|
93888
94165
|
const profile = profileNameOf(key.agentName);
|
|
93889
94166
|
await signInFolder({ context, url: url2, token: key.token, name: profile, folder });
|
|
93890
94167
|
context.out(
|
|
@@ -93937,8 +94214,8 @@ async function openclaw({
|
|
|
93937
94214
|
|
|
93938
94215
|
// src/services/operator-key-commands.service.ts
|
|
93939
94216
|
import { createHash as createHash5, randomBytes as randomBytes3 } from "node:crypto";
|
|
93940
|
-
import { mkdir as
|
|
93941
|
-
import { dirname as
|
|
94217
|
+
import { mkdir as mkdir24, readFile as readFile38, rm as rm15, writeFile as writeFile23 } from "node:fs/promises";
|
|
94218
|
+
import { dirname as dirname24, join as join27 } from "node:path";
|
|
93942
94219
|
|
|
93943
94220
|
// ../../modules/audit-log/contract/src/audit-log.api.ts
|
|
93944
94221
|
var auditEntrySchemaDefinition = external_exports.object({
|
|
@@ -95107,7 +95384,7 @@ var BREAK_GLASS_COPY = {
|
|
|
95107
95384
|
|
|
95108
95385
|
// ../../modules/ops/contract/src/operator-key.ts
|
|
95109
95386
|
var OPERATOR_KEY = {
|
|
95110
|
-
lifetimeMinutes:
|
|
95387
|
+
lifetimeMinutes: 60,
|
|
95111
95388
|
/** A key nobody answered expires this long after it was asked for. */
|
|
95112
95389
|
pendingMinutes: 60,
|
|
95113
95390
|
/** Requests one API key may have waiting at once. */
|
|
@@ -95172,7 +95449,7 @@ var keyDefinition = external_exports.object({
|
|
|
95172
95449
|
/** The passkey that approved; null unless approved. */
|
|
95173
95450
|
credentialId: external_exports.string().nullable(),
|
|
95174
95451
|
denyReason: external_exports.string().nullable(),
|
|
95175
|
-
/** The
|
|
95452
|
+
/** The window ends then; null unless approved. */
|
|
95176
95453
|
endsAt: external_exports.iso.datetime().nullable(),
|
|
95177
95454
|
/** When a write key was spent; a read key stays null. */
|
|
95178
95455
|
spentAt: external_exports.iso.datetime().nullable()
|
|
@@ -95255,24 +95532,26 @@ var opsTrpc = defineTrpcContract("ops").query("me").withInput(external_exports.o
|
|
|
95255
95532
|
// ../../modules/ops/contract/src/ops.config.ts
|
|
95256
95533
|
var opsConfig = Config.define((c) => ({
|
|
95257
95534
|
/** 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())
|
|
95535
|
+
opsAlertDir: c.env("OPS_ALERT_DIR", external_exports.string().min(1).optional()),
|
|
95536
|
+
/** The workspace whose operators get decision cards, on prod the one vault alerts reach. */
|
|
95537
|
+
operatorWorkspaceId: c.env("OPS_OPERATOR_WORKSPACE_ID", external_exports.string().min(1).optional())
|
|
95259
95538
|
}));
|
|
95260
95539
|
|
|
95261
95540
|
// src/services/operator-key-commands.service.ts
|
|
95262
|
-
var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves with a passkey,
|
|
95541
|
+
var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves with a passkey, ${OPERATOR_KEY.lifetimeMinutes} minutes):
|
|
95263
95542
|
laze ops request <action> <target> --reason "<why>" [--arg name=value] [--wait]
|
|
95264
95543
|
actions: ${OPERATOR_KEY_ACTIONS.join(", ")}
|
|
95265
95544
|
laze ops status <key> waiting, approved or ended
|
|
95266
95545
|
laze ops use <key> run the approved action and print the answer`;
|
|
95267
95546
|
var POLL_MS3 = 5e3;
|
|
95268
|
-
var keyFile = ({ context, keyId }) => join27(
|
|
95547
|
+
var keyFile = ({ context, keyId }) => join27(dirname24(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
|
|
95269
95548
|
async function saveSecret({
|
|
95270
95549
|
context,
|
|
95271
95550
|
keyId,
|
|
95272
95551
|
secret
|
|
95273
95552
|
}) {
|
|
95274
95553
|
const path = keyFile({ context, keyId });
|
|
95275
|
-
await
|
|
95554
|
+
await mkdir24(dirname24(path), { recursive: true, mode: 448 });
|
|
95276
95555
|
await writeFile23(path, secret, { mode: 384 });
|
|
95277
95556
|
}
|
|
95278
95557
|
function typedArg(text3) {
|
|
@@ -95280,20 +95559,32 @@ function typedArg(text3) {
|
|
|
95280
95559
|
return text3 !== "" && Number.isFinite(Number(text3)) ? Number(text3) : text3;
|
|
95281
95560
|
}
|
|
95282
95561
|
function argsOf({ args }) {
|
|
95283
|
-
const pairs = (args.lists.arg ?? []).map((
|
|
95284
|
-
const at =
|
|
95562
|
+
const pairs = (args.lists.arg ?? []).map((pair) => {
|
|
95563
|
+
const at = pair.indexOf("=");
|
|
95285
95564
|
if (at < 1) throw new CliUsageError(`--arg takes name=value.
|
|
95286
95565
|
${OPERATOR_KEY_USAGE}`);
|
|
95287
|
-
const text3 =
|
|
95288
|
-
return [
|
|
95566
|
+
const text3 = pair.slice(at + 1);
|
|
95567
|
+
return [pair.slice(0, at), typedArg(text3)];
|
|
95289
95568
|
});
|
|
95290
95569
|
return Object.fromEntries(pairs);
|
|
95291
95570
|
}
|
|
95292
|
-
var
|
|
95293
|
-
|
|
95294
|
-
|
|
95295
|
-
|
|
95296
|
-
}
|
|
95571
|
+
var EXPIRED_LINE = `Expired: nobody answered within ${OPERATOR_KEY.pendingMinutes} minutes. Nothing ran. Ask again with laze ops request.`;
|
|
95572
|
+
function statusLine2({ key, nowMs }) {
|
|
95573
|
+
switch (key.status) {
|
|
95574
|
+
case "approved":
|
|
95575
|
+
return `Approved until ${key.endsAt}. Run: laze ops use ${key.id}`;
|
|
95576
|
+
case "pending":
|
|
95577
|
+
return Temporal3.Instant.from(key.pendingUntil).epochMilliseconds <= nowMs ? EXPIRED_LINE : `Waiting for an operator's passkey at /ops/keys. Nothing runs until they approve. It expires at ${key.pendingUntil} if nobody answers.`;
|
|
95578
|
+
case "expired":
|
|
95579
|
+
return EXPIRED_LINE;
|
|
95580
|
+
case "denied":
|
|
95581
|
+
return `Denied: ${key.denyReason ?? "no reason given"}. Nothing ran.`;
|
|
95582
|
+
case "revoked":
|
|
95583
|
+
return "Revoked by an operator. It no longer works.";
|
|
95584
|
+
case "ended":
|
|
95585
|
+
return "Ended: its time is over. Ask again with laze ops request.";
|
|
95586
|
+
}
|
|
95587
|
+
}
|
|
95297
95588
|
async function waitForAnswer({
|
|
95298
95589
|
context,
|
|
95299
95590
|
client,
|
|
@@ -95324,7 +95615,7 @@ async function requestKey({ context, args }) {
|
|
|
95324
95615
|
const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
|
|
95325
95616
|
if (args.flags.json) return context.out(`${JSON.stringify(answered, null, 2)}
|
|
95326
95617
|
`);
|
|
95327
|
-
context.out(`Operator key ${key.id}: ${statusLine2(answered)}
|
|
95618
|
+
context.out(`Operator key ${key.id}: ${statusLine2({ key: answered, nowMs: context.nowMs() })}
|
|
95328
95619
|
`);
|
|
95329
95620
|
}
|
|
95330
95621
|
async function keyStatus({ context, args }) {
|
|
@@ -95334,7 +95625,7 @@ async function keyStatus({ context, args }) {
|
|
|
95334
95625
|
const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
|
|
95335
95626
|
if (args.flags.json) return context.out(`${JSON.stringify(key, null, 2)}
|
|
95336
95627
|
`);
|
|
95337
|
-
context.out(`Operator key ${key.id}: ${statusLine2(key)}
|
|
95628
|
+
context.out(`Operator key ${key.id}: ${statusLine2({ key, nowMs: context.nowMs() })}
|
|
95338
95629
|
`);
|
|
95339
95630
|
}
|
|
95340
95631
|
async function forgetIfOver({
|
|
@@ -95345,8 +95636,9 @@ async function forgetIfOver({
|
|
|
95345
95636
|
const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
|
|
95346
95637
|
const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
|
|
95347
95638
|
if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
|
|
95348
|
-
await
|
|
95639
|
+
await rm15(keyFile({ context, keyId }), { force: true });
|
|
95349
95640
|
}
|
|
95641
|
+
return key;
|
|
95350
95642
|
}
|
|
95351
95643
|
async function useKey({ context, args }) {
|
|
95352
95644
|
const [, , keyId] = args.words;
|
|
@@ -95367,7 +95659,12 @@ async function useKey({ context, args }) {
|
|
|
95367
95659
|
await forgetIfOver({ context, client, keyId });
|
|
95368
95660
|
} catch (error63) {
|
|
95369
95661
|
if (error63 instanceof LazeApiError && error63.code === "operator_key_refused") {
|
|
95370
|
-
await forgetIfOver({ context, client, keyId });
|
|
95662
|
+
const key = await forgetIfOver({ context, client, keyId });
|
|
95663
|
+
if (key.status !== "approved") {
|
|
95664
|
+
throw new CliUsageError(
|
|
95665
|
+
`Operator key ${keyId}: ${statusLine2({ key, nowMs: context.nowMs() })}`
|
|
95666
|
+
);
|
|
95667
|
+
}
|
|
95371
95668
|
}
|
|
95372
95669
|
throw error63;
|
|
95373
95670
|
}
|
|
@@ -95413,8 +95710,8 @@ ${OPS_USAGE}`);
|
|
|
95413
95710
|
}
|
|
95414
95711
|
|
|
95415
95712
|
// src/services/release-watch.service.ts
|
|
95416
|
-
import { mkdir as
|
|
95417
|
-
import { dirname as
|
|
95713
|
+
import { mkdir as mkdir25, readFile as readFile39, realpath, writeFile as writeFile24 } from "node:fs/promises";
|
|
95714
|
+
import { dirname as dirname25, join as join28 } from "node:path";
|
|
95418
95715
|
|
|
95419
95716
|
// src/rules/cli-update.rules.ts
|
|
95420
95717
|
var CLI_PACKAGE = "@lazehq/cli";
|
|
@@ -95560,12 +95857,12 @@ async function startedUpdate({
|
|
|
95560
95857
|
if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
|
|
95561
95858
|
const plan2 = updatePlanOf({ script: await scriptOf(context) });
|
|
95562
95859
|
if (plan2.kind !== "install") return null;
|
|
95563
|
-
const folder =
|
|
95860
|
+
const folder = dirname25(context.environment.configPath);
|
|
95564
95861
|
const stamp = join28(folder, "auto-update.json");
|
|
95565
95862
|
const last = await readFile39(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
|
|
95566
95863
|
const now = context.nowMs();
|
|
95567
95864
|
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
95568
|
-
await
|
|
95865
|
+
await mkdir25(folder, { recursive: true, mode: 448 });
|
|
95569
95866
|
await writeFile24(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
|
|
95570
95867
|
context.processes.spawnDetached({
|
|
95571
95868
|
argv: [...context.program, "update"],
|
|
@@ -95606,7 +95903,7 @@ function watchingRelease({
|
|
|
95606
95903
|
}
|
|
95607
95904
|
|
|
95608
95905
|
// src/services/rush-guard.service.ts
|
|
95609
|
-
import { readFile as readFile40, rm as
|
|
95906
|
+
import { readFile as readFile40, rm as rm16 } from "node:fs/promises";
|
|
95610
95907
|
var WATCH_MS3 = 2e3;
|
|
95611
95908
|
var RETRY_MS2 = 3e4;
|
|
95612
95909
|
async function guardRound(guard) {
|
|
@@ -95678,10 +95975,10 @@ async function rushWakeHook({ context, args }) {
|
|
|
95678
95975
|
return 0;
|
|
95679
95976
|
} finally {
|
|
95680
95977
|
if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
|
|
95681
|
-
await
|
|
95978
|
+
await rm16(lock, { force: true });
|
|
95682
95979
|
}
|
|
95683
95980
|
} finally {
|
|
95684
|
-
await
|
|
95981
|
+
await rm16(path, { force: true });
|
|
95685
95982
|
}
|
|
95686
95983
|
}
|
|
95687
95984
|
|
|
@@ -95693,12 +95990,15 @@ var USAGE16 = `Usage:
|
|
|
95693
95990
|
laze schedule update <scheduleId> [--name <name>] [--prompt <text>] [--cron|--rrule|--at <when>]
|
|
95694
95991
|
[--tz <IANA zone>] [--channel <channelId>|none] [--agent <agentId>] [--check <script>|none]
|
|
95695
95992
|
laze schedule pause|resume|rm|runs <scheduleId>
|
|
95696
|
-
laze schedule run <scheduleId> (one extra run now; the next fire stays)
|
|
95993
|
+
laze schedule run <scheduleId> (one extra run now, its check first; the next fire stays)
|
|
95697
95994
|
A repeating schedule runs at most every 30 minutes; a cron or RRULE that runs more often is refused.
|
|
95698
95995
|
--check names an executable script in your work folder. It runs at each firing, without a model:
|
|
95699
95996
|
if it prints something the agent wakes with that output added to the prompt; if it prints nothing
|
|
95700
95997
|
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.
|
|
95998
|
+
under Needs attention. Keep what it last saw in your own file. "laze schedule run" runs the check
|
|
95999
|
+
too and prints quiet, fired or skipped, so it tests a script without spending a turn on nothing.`;
|
|
96000
|
+
var CHECK_WAIT_MS = 2e3;
|
|
96001
|
+
var CHECK_WAIT_TRIES = 30;
|
|
95702
96002
|
function timingOf(args) {
|
|
95703
96003
|
const cron = flagText({ args, name: "cron" });
|
|
95704
96004
|
const rrule = flagText({ args, name: "rrule" });
|
|
@@ -95813,10 +96113,17 @@ async function scheduleRun({ context, args }) {
|
|
|
95813
96113
|
const scheduleId = args.words[2];
|
|
95814
96114
|
if (!scheduleId) throw new CliUsageError(USAGE16);
|
|
95815
96115
|
const { client } = await signedIn({ context, args });
|
|
95816
|
-
|
|
96116
|
+
let run4 = await client.post("/api/schedules/run", { scheduleId });
|
|
96117
|
+
for (let tries = 0; run4.status === "checking" && tries < CHECK_WAIT_TRIES; tries += 1) {
|
|
96118
|
+
await context.sleep(CHECK_WAIT_MS);
|
|
96119
|
+
const runs = await client.post("/api/schedules/runs", { scheduleId });
|
|
96120
|
+
run4 = runs.find((each) => each.id === run4.id) ?? run4;
|
|
96121
|
+
}
|
|
95817
96122
|
if (args.flags.json) return context.out(`${JSON.stringify(run4, null, 2)}
|
|
95818
96123
|
`);
|
|
95819
|
-
|
|
96124
|
+
const reason2 = run4.reason ? ` ${run4.reason}` : "";
|
|
96125
|
+
const exit = typeof run4.checkExitCode === "number" ? ` (exit ${run4.checkExitCode})` : "";
|
|
96126
|
+
context.out(`${run4.scheduledFor} ${run4.status}${reason2}${exit}
|
|
95820
96127
|
`);
|
|
95821
96128
|
}
|
|
95822
96129
|
var SCHEDULE_COMMANDS = {
|
|
@@ -95838,7 +96145,7 @@ async function schedule({ context, args }) {
|
|
|
95838
96145
|
|
|
95839
96146
|
// src/services/skill-commands.service.ts
|
|
95840
96147
|
import { readdir as readdir8, readFile as readFile41 } from "node:fs/promises";
|
|
95841
|
-
import { join as join29, relative as relative6, resolve as
|
|
96148
|
+
import { join as join29, relative as relative6, resolve as resolve20 } from "node:path";
|
|
95842
96149
|
var USAGE17 = `Usage:
|
|
95843
96150
|
laze skill list [--agent <agentId>]
|
|
95844
96151
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -95891,7 +96198,7 @@ async function skillInstall({ context, args }) {
|
|
|
95891
96198
|
if (!catalogueId === !from) throw new CliUsageError(USAGE17);
|
|
95892
96199
|
const name3 = flagText({ args, name: "as" });
|
|
95893
96200
|
const agent3 = flagText({ args, name: "agent" });
|
|
95894
|
-
const files2 = from ? await folderFiles({ root:
|
|
96201
|
+
const files2 = from ? await folderFiles({ root: resolve20(context.cwd, from) }) : void 0;
|
|
95895
96202
|
const { client } = await signedIn({ context, args });
|
|
95896
96203
|
const installed = await client.post("/api/skills/install", {
|
|
95897
96204
|
...catalogueId ? { catalogueId } : {},
|
|
@@ -95958,7 +96265,7 @@ async function skillUpdate({ context, args }) {
|
|
|
95958
96265
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
95959
96266
|
throw new CliUsageError(USAGE17);
|
|
95960
96267
|
}
|
|
95961
|
-
const skillMd = skillMdFile ? await readFile41(
|
|
96268
|
+
const skillMd = skillMdFile ? await readFile41(resolve20(context.cwd, skillMdFile), "utf8") : void 0;
|
|
95962
96269
|
const { client } = await signedIn({ context, args });
|
|
95963
96270
|
const updated = await client.post("/api/skills/update", {
|
|
95964
96271
|
name: name3,
|
|
@@ -96005,7 +96312,7 @@ async function skill({ context, args }) {
|
|
|
96005
96312
|
|
|
96006
96313
|
// src/services/slack-commands.service.ts
|
|
96007
96314
|
import { readFile as readFile42 } from "node:fs/promises";
|
|
96008
|
-
import { resolve as
|
|
96315
|
+
import { resolve as resolve21 } from "node:path";
|
|
96009
96316
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
96010
96317
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
96011
96318
|
laze slack link-prompts Slack workspaces you have not linked yet
|
|
@@ -96052,7 +96359,7 @@ async function secretLines({ context, args }) {
|
|
|
96052
96359
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
96053
96360
|
}
|
|
96054
96361
|
const file3 = flagText({ args, name: "from-file" });
|
|
96055
|
-
const text3 = file3 ? await readFile42(
|
|
96362
|
+
const text3 = file3 ? await readFile42(resolve21(context.cwd, file3), "utf8") : await context.readStdin();
|
|
96056
96363
|
return text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
96057
96364
|
}
|
|
96058
96365
|
async function secretsOf2({
|
|
@@ -96775,8 +97082,8 @@ async function update2({
|
|
|
96775
97082
|
}
|
|
96776
97083
|
|
|
96777
97084
|
// src/services/vault-env-commands.service.ts
|
|
96778
|
-
import { readFile as readFile44, stat as
|
|
96779
|
-
import { dirname as
|
|
97085
|
+
import { readFile as readFile44, stat as stat11 } from "node:fs/promises";
|
|
97086
|
+
import { dirname as dirname26, join as join30, resolve as resolve22 } from "node:path";
|
|
96780
97087
|
|
|
96781
97088
|
// src/rules/vault-manifest.rules.ts
|
|
96782
97089
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -96864,7 +97171,7 @@ function credentialProcessJson(fields) {
|
|
|
96864
97171
|
}
|
|
96865
97172
|
|
|
96866
97173
|
// src/services/vault-batch.service.ts
|
|
96867
|
-
import { rm as
|
|
97174
|
+
import { rm as rm17 } from "node:fs/promises";
|
|
96868
97175
|
async function batchOf({ response }) {
|
|
96869
97176
|
const text3 = await response.text();
|
|
96870
97177
|
if (!response.ok) {
|
|
@@ -97046,7 +97353,7 @@ async function valuesOf({
|
|
|
97046
97353
|
}) {
|
|
97047
97354
|
const refused = refusalOf({ context, settled: settled2 });
|
|
97048
97355
|
if (refused !== 0) {
|
|
97049
|
-
await
|
|
97356
|
+
await rm17(keyPath, { force: true });
|
|
97050
97357
|
return { exitCode: refused };
|
|
97051
97358
|
}
|
|
97052
97359
|
const opened = /* @__PURE__ */ new Map();
|
|
@@ -97058,7 +97365,7 @@ async function valuesOf({
|
|
|
97058
97365
|
if (release2.message) context.err(`${release2.message}
|
|
97059
97366
|
`);
|
|
97060
97367
|
}
|
|
97061
|
-
if (!keep2) await
|
|
97368
|
+
if (!keep2) await rm17(keyPath, { force: true });
|
|
97062
97369
|
const released = /* @__PURE__ */ new Map();
|
|
97063
97370
|
for (const entry of entries) {
|
|
97064
97371
|
const fields = opened.get(keyOf(entry));
|
|
@@ -97111,7 +97418,7 @@ function refusedReason({
|
|
|
97111
97418
|
return VAULT_EXIT_BAD_REASON;
|
|
97112
97419
|
}
|
|
97113
97420
|
async function isFile(path) {
|
|
97114
|
-
return
|
|
97421
|
+
return stat11(path).then(
|
|
97115
97422
|
(found) => found.isFile(),
|
|
97116
97423
|
() => false
|
|
97117
97424
|
);
|
|
@@ -97121,12 +97428,12 @@ async function manifestPathOf({
|
|
|
97121
97428
|
args
|
|
97122
97429
|
}) {
|
|
97123
97430
|
const named = args.words[2];
|
|
97124
|
-
if (named) return
|
|
97431
|
+
if (named) return resolve22(context.cwd, named);
|
|
97125
97432
|
const environment = flagText({ args, name: "env" });
|
|
97126
97433
|
const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
97127
|
-
for (let dir =
|
|
97434
|
+
for (let dir = resolve22(context.cwd); ; dir = dirname26(dir)) {
|
|
97128
97435
|
if (await isFile(join30(dir, file3))) return join30(dir, file3);
|
|
97129
|
-
if (
|
|
97436
|
+
if (dirname26(dir) === dir) break;
|
|
97130
97437
|
}
|
|
97131
97438
|
throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
|
|
97132
97439
|
${ENV_USAGE}`);
|
|
@@ -97437,14 +97744,14 @@ function lineOf5(channel) {
|
|
|
97437
97744
|
async function vaultScrub({ context, args }) {
|
|
97438
97745
|
const { client } = await signedIn({ context, args });
|
|
97439
97746
|
const dryRun = args.flags["dry-run"] === true;
|
|
97440
|
-
const
|
|
97441
|
-
if (args.flags.json) return context.out(`${JSON.stringify(
|
|
97747
|
+
const report3 = await client.post("/api/chat/scrub", { dryRun });
|
|
97748
|
+
if (args.flags.json) return context.out(`${JSON.stringify(report3, null, 2)}
|
|
97442
97749
|
`);
|
|
97443
|
-
const changed =
|
|
97750
|
+
const changed = report3.channels.filter((channel) => channel.messages > 0);
|
|
97444
97751
|
for (const channel of changed) context.out(lineOf5(channel));
|
|
97445
97752
|
const total = changed.reduce((sum, channel) => sum + channel.messages, 0);
|
|
97446
97753
|
context.out(
|
|
97447
|
-
|
|
97754
|
+
report3.dryRun ? `Dry run: ${total} message(s) would change. Nothing was changed.
|
|
97448
97755
|
` : `${total} message(s) changed. The originals can be restored for 7 days.
|
|
97449
97756
|
`
|
|
97450
97757
|
);
|
|
@@ -97452,7 +97759,7 @@ async function vaultScrub({ context, args }) {
|
|
|
97452
97759
|
|
|
97453
97760
|
// src/services/whatsapp-business-commands.service.ts
|
|
97454
97761
|
import { readFile as readFile45 } from "node:fs/promises";
|
|
97455
|
-
import { resolve as
|
|
97762
|
+
import { resolve as resolve23 } from "node:path";
|
|
97456
97763
|
|
|
97457
97764
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
97458
97765
|
var whatsappBusinessCategorySchema = external_exports.enum([
|
|
@@ -97871,7 +98178,7 @@ async function secretsOf3({ context, args }) {
|
|
|
97871
98178
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
97872
98179
|
if (fromConnection) return { fromConnection };
|
|
97873
98180
|
const file3 = flagText({ args, name: "from-file" });
|
|
97874
|
-
const text3 = file3 ? await readFile45(
|
|
98181
|
+
const text3 = file3 ? await readFile45(resolve23(context.cwd, file3), "utf8") : await context.readStdin();
|
|
97875
98182
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
97876
98183
|
if (lines2.length !== 2) {
|
|
97877
98184
|
throw new CliUsageError(
|
|
@@ -98072,70 +98379,11 @@ async function whatsappBusiness({
|
|
|
98072
98379
|
}
|
|
98073
98380
|
|
|
98074
98381
|
// src/services/whatsapp-pairing-commands.service.ts
|
|
98075
|
-
|
|
98076
|
-
import { resolve as resolve23 } from "node:path";
|
|
98077
|
-
var WHATSAPP_PAIRING_USAGE = [
|
|
98078
|
-
" laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
|
|
98079
|
-
" laze whatsapp pairing <pairing-id> [--qr <file.svg>] where the linking stands, with a fresh code",
|
|
98080
|
-
" laze whatsapp cancel <pairing-id> stop the linking",
|
|
98081
|
-
" laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)"
|
|
98082
|
-
].join("\n");
|
|
98083
|
-
function wordAt11({ args, at }) {
|
|
98084
|
-
const value = args.words[at];
|
|
98085
|
-
if (!value) throw new CliUsageError(`Usage:
|
|
98086
|
-
${WHATSAPP_PAIRING_USAGE}`);
|
|
98087
|
-
return value;
|
|
98088
|
-
}
|
|
98089
|
-
function svgOf(dataUrl) {
|
|
98090
|
-
const [head = "", body = ""] = dataUrl.split(/,(.*)/s, 2);
|
|
98091
|
-
if (head.endsWith(";base64")) return Buffer.from(body, "base64").toString("utf8");
|
|
98092
|
-
return decodeURIComponent(body);
|
|
98093
|
-
}
|
|
98094
|
-
async function report2({ context, args, pairing: pairing2 }) {
|
|
98095
|
-
const qrFile = pairing2.qrSvg ? resolve23(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
|
|
98096
|
-
if (qrFile && pairing2.qrSvg) await writeFile25(qrFile, svgOf(pairing2.qrSvg), "utf8");
|
|
98097
|
-
if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
|
|
98098
|
-
`);
|
|
98099
|
-
context.out(`${pairing2.pairingId} ${pairing2.state}
|
|
98100
|
-
`);
|
|
98101
|
-
if (qrFile) {
|
|
98102
|
-
context.out(
|
|
98103
|
-
`Scan ${qrFile} in WhatsApp under Linked devices. The code changes; run \`laze whatsapp pairing ${pairing2.pairingId}\` for a fresh one.
|
|
98104
|
-
`
|
|
98105
|
-
);
|
|
98106
|
-
}
|
|
98107
|
-
if (pairing2.linkedAs) context.out(`Linked as ${pairing2.linkedAs}.
|
|
98108
|
-
`);
|
|
98109
|
-
if (pairing2.error) context.out(`${pairing2.error}
|
|
98110
|
-
`);
|
|
98111
|
-
}
|
|
98112
|
-
async function pair({ context, args }) {
|
|
98113
|
-
const machine2 = wordAt11({ args, at: 2 });
|
|
98114
|
-
const client = await computeClient({ context, args });
|
|
98115
|
-
const pairing2 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.pair, { machine: machine2 });
|
|
98116
|
-
await report2({ context, args, pairing: pairing2 });
|
|
98117
|
-
}
|
|
98118
|
-
async function pairing({ context, args }) {
|
|
98119
|
-
const pairingId = wordAt11({ args, at: 2 });
|
|
98120
|
-
const client = await computeClient({ context, args });
|
|
98121
|
-
const answer6 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.pairing, {
|
|
98122
|
-
pairingId
|
|
98123
|
-
});
|
|
98124
|
-
await report2({ context, args, pairing: answer6 });
|
|
98125
|
-
}
|
|
98126
|
-
async function cancel3({ context, args }) {
|
|
98127
|
-
const pairingId = wordAt11({ args, at: 2 });
|
|
98128
|
-
const client = await computeClient({ context, args });
|
|
98129
|
-
const answer6 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.cancelPairing, {
|
|
98130
|
-
pairingId
|
|
98131
|
-
});
|
|
98132
|
-
if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
|
|
98133
|
-
`);
|
|
98134
|
-
context.out(`Stopped linking ${answer6.pairingId}.
|
|
98135
|
-
`);
|
|
98136
|
-
}
|
|
98382
|
+
var WHATSAPP_PAIRING_USAGE = " laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)";
|
|
98137
98383
|
async function unpair({ context, args }) {
|
|
98138
|
-
const machine2 =
|
|
98384
|
+
const machine2 = args.words[2];
|
|
98385
|
+
if (!machine2) throw new CliUsageError(`Usage:
|
|
98386
|
+
${WHATSAPP_PAIRING_USAGE}`);
|
|
98139
98387
|
const client = await computeClient({ context, args });
|
|
98140
98388
|
const answer6 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.unpair, { machine: machine2 });
|
|
98141
98389
|
if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
|
|
@@ -98143,7 +98391,7 @@ async function unpair({ context, args }) {
|
|
|
98143
98391
|
context.out(`WhatsApp is unlinked from ${answer6.name}.
|
|
98144
98392
|
`);
|
|
98145
98393
|
}
|
|
98146
|
-
var COMMANDS3 = {
|
|
98394
|
+
var COMMANDS3 = { unpair };
|
|
98147
98395
|
function whatsappPairingCommand(name3) {
|
|
98148
98396
|
return name3 && Object.hasOwn(COMMANDS3, name3) ? COMMANDS3[name3] : void 0;
|
|
98149
98397
|
}
|
|
@@ -98222,7 +98470,7 @@ async function settle3({ client, send: send5 }) {
|
|
|
98222
98470
|
}
|
|
98223
98471
|
return current3;
|
|
98224
98472
|
}
|
|
98225
|
-
function
|
|
98473
|
+
function report2({ context, args, send: send5 }) {
|
|
98226
98474
|
if (args.flags.json) context.out(`${JSON.stringify(send5, null, 2)}
|
|
98227
98475
|
`);
|
|
98228
98476
|
else if (SETTLED.has(send5.state)) context.out(`${send5.outcome}
|
|
@@ -98246,12 +98494,12 @@ async function send4({ context, args }) {
|
|
|
98246
98494
|
});
|
|
98247
98495
|
if (!SETTLED.has(asked.state) && !args.flags.json) context.err(`${asked.outcome}
|
|
98248
98496
|
`);
|
|
98249
|
-
return
|
|
98497
|
+
return report2({ context, args, send: await settle3({ client, send: asked }) });
|
|
98250
98498
|
}
|
|
98251
98499
|
async function status10({ context, args }) {
|
|
98252
98500
|
const client = await computeClient({ context, args });
|
|
98253
98501
|
const answer6 = await client.post(PATHS3.sendStatus, { sendId: word2({ args, at: 2 }) });
|
|
98254
|
-
return
|
|
98502
|
+
return report2({ context, args, send: answer6 });
|
|
98255
98503
|
}
|
|
98256
98504
|
function oneLine(text3) {
|
|
98257
98505
|
return text3.replace(/\s+/g, " ").trim();
|
|
@@ -98569,7 +98817,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
98569
98817
|
laze threads [unread] the threads you follow (people)
|
|
98570
98818
|
laze message edit|delete|remove|react|pin|restore <id> change a message; laze pins <channel>
|
|
98571
98819
|
laze channel read|unread <channel> [--seq <n>] move your read marker
|
|
98572
|
-
laze files <channel> | file link|rename|upload a conversation's files, and uploading one
|
|
98820
|
+
laze files <channel> | file link|download|rename|upload a conversation's files, and uploading one
|
|
98573
98821
|
laze saved [marks|done|remind] | laze save <id> your saved messages (people)
|
|
98574
98822
|
laze star add|remove|list [channel] starred conversations in your sidebar (people)
|
|
98575
98823
|
laze feed post <title> [--channel <c>] ... put an item in people's feed as your agent
|
|
@@ -98684,7 +98932,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
98684
98932
|
laze ip offer --site <domain> when a site blocks the shared address: the offer to pass on, price included
|
|
98685
98933
|
laze ops suspend|release <workspace> --reason "<why>" Laze operators only, with LAZE_OPS_TOKEN
|
|
98686
98934
|
laze ops request <action> <target> --reason "<why>" [--wait] | status <key> | use <key>
|
|
98687
|
-
a
|
|
98935
|
+
a 60 minute operator key for one action; an operator approves it with a passkey
|
|
98688
98936
|
laze machine exec <machine> [--timeout <s>] -- <command> run a command on a person's own machine
|
|
98689
98937
|
When someone wants work done on their own machine, run it there; if it is offline, say so and go on where you run
|
|
98690
98938
|
laze machine exec <machine> --vault <connection> --reason "<why>" -- <command> the same, with a vault connection
|
|
@@ -98692,7 +98940,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
98692
98940
|
laze machine unhost <agent> run the agent on your agent computer again
|
|
98693
98941
|
laze whatsapp chats|read <machine> [<chat>] [--limit <n>] a person's WhatsApp, through their own machine
|
|
98694
98942
|
laze whatsapp send <machine> <chat> "<text>" send as its owner; each message waits for their approval
|
|
98695
|
-
laze whatsapp
|
|
98943
|
+
laze whatsapp unpair <machine> unlink WhatsApp; linking is in Settings, Machines
|
|
98696
98944
|
laze whatsapp-business status|conversations|read|send|send-template|send-status|templates|prices
|
|
98697
98945
|
the workspace's WhatsApp Business number; admins: connect|check|verify-token|settings|disconnect
|
|
98698
98946
|
laze github whoami | watch <owner/repo> | unwatch | watches the agent's GitHub identity and watches
|
|
@@ -99008,8 +99256,8 @@ import {
|
|
|
99008
99256
|
randomBytes as randomBytes4,
|
|
99009
99257
|
sign
|
|
99010
99258
|
} from "node:crypto";
|
|
99011
|
-
import { chmod as chmod4, link, mkdir as
|
|
99012
|
-
import { dirname as
|
|
99259
|
+
import { chmod as chmod4, link, mkdir as mkdir26, readFile as readFile46, rm as rm18, writeFile as writeFile25 } from "node:fs/promises";
|
|
99260
|
+
import { dirname as dirname27, join as join31 } from "node:path";
|
|
99013
99261
|
var KEYCHAIN_SERVICE = "laze-cli-machine-key";
|
|
99014
99262
|
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve24, reject) => {
|
|
99015
99263
|
const child = execFile2(
|
|
@@ -99049,11 +99297,11 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
99049
99297
|
});
|
|
99050
99298
|
}
|
|
99051
99299
|
get metaPath() {
|
|
99052
|
-
return join31(
|
|
99300
|
+
return join31(dirname27(this.options.configPath), "machine-key.json");
|
|
99053
99301
|
}
|
|
99054
99302
|
/** Named by the key, so two CLIs making a key at once never overwrite each other's. */
|
|
99055
99303
|
pemPathOf(jwk) {
|
|
99056
|
-
return join31(
|
|
99304
|
+
return join31(dirname27(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
|
|
99057
99305
|
}
|
|
99058
99306
|
/** The Keychain item's account: one per config file and key. */
|
|
99059
99307
|
accountOf(jwk) {
|
|
@@ -99120,7 +99368,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
99120
99368
|
return kept;
|
|
99121
99369
|
}
|
|
99122
99370
|
async drop({ tier, jwk }) {
|
|
99123
|
-
if (tier === "file") return
|
|
99371
|
+
if (tier === "file") return rm18(this.pemPathOf(jwk), { force: true });
|
|
99124
99372
|
await this.options.run({
|
|
99125
99373
|
program: "security",
|
|
99126
99374
|
args: ["delete-generic-password", "-s", KEYCHAIN_SERVICE, "-a", this.accountOf(jwk)],
|
|
@@ -99176,12 +99424,12 @@ async function writeOnce({ path, text: text3 }) {
|
|
|
99176
99424
|
if (error63.code === "EEXIST") return false;
|
|
99177
99425
|
throw error63;
|
|
99178
99426
|
} finally {
|
|
99179
|
-
await
|
|
99427
|
+
await rm18(temporary, { force: true });
|
|
99180
99428
|
}
|
|
99181
99429
|
}
|
|
99182
99430
|
async function writePrivate({ path, text: text3 }) {
|
|
99183
|
-
await
|
|
99184
|
-
await
|
|
99431
|
+
await mkdir26(dirname27(path), { recursive: true, mode: 448 });
|
|
99432
|
+
await writeFile25(path, text3, { mode: 384 });
|
|
99185
99433
|
await chmod4(path, 384);
|
|
99186
99434
|
}
|
|
99187
99435
|
|
|
@@ -99239,7 +99487,7 @@ function machineProofFetch({
|
|
|
99239
99487
|
import { execFile as execFile3, spawn as spawn4 } from "node:child_process";
|
|
99240
99488
|
import { mkdirSync, openSync } from "node:fs";
|
|
99241
99489
|
import { readFile as readFile47, readlink } from "node:fs/promises";
|
|
99242
|
-
import { dirname as
|
|
99490
|
+
import { dirname as dirname28 } from "node:path";
|
|
99243
99491
|
import { promisify as promisify2 } from "node:util";
|
|
99244
99492
|
var run3 = promisify2(execFile3);
|
|
99245
99493
|
function alive(pid) {
|
|
@@ -99259,8 +99507,8 @@ async function argsOf2(pid) {
|
|
|
99259
99507
|
return line ? line.split(/\s+/) : void 0;
|
|
99260
99508
|
}
|
|
99261
99509
|
async function parentOf(pid) {
|
|
99262
|
-
const
|
|
99263
|
-
const fromStat =
|
|
99510
|
+
const stat12 = await readFile47(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
99511
|
+
const fromStat = stat12 ? Number(stat12.slice(stat12.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
99264
99512
|
if (fromStat > 0) return fromStat;
|
|
99265
99513
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
99266
99514
|
const parent = Number(listed?.stdout.trim());
|
|
@@ -99276,7 +99524,7 @@ async function cwdOf(pid) {
|
|
|
99276
99524
|
return line ? line.slice(1) : void 0;
|
|
99277
99525
|
}
|
|
99278
99526
|
function spawnDetached({ argv, logPath }) {
|
|
99279
|
-
mkdirSync(
|
|
99527
|
+
mkdirSync(dirname28(logPath), { recursive: true, mode: 448 });
|
|
99280
99528
|
const log = openSync(logPath, "a", 384);
|
|
99281
99529
|
const [program = "", ...rest] = argv;
|
|
99282
99530
|
const child = spawn4(program, rest, { detached: true, stdio: ["ignore", log, log] });
|