@lazehq/cli 0.1.84 → 0.1.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/laze.mjs +552 -345
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -849,9 +849,9 @@ var require_node_gyp_build = __commonJS({
|
|
|
849
849
|
var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
|
|
850
850
|
if (debug) return debug;
|
|
851
851
|
}
|
|
852
|
-
var prebuild =
|
|
852
|
+
var prebuild = resolve25(dir);
|
|
853
853
|
if (prebuild) return prebuild;
|
|
854
|
-
var nearby =
|
|
854
|
+
var nearby = resolve25(path.dirname(process.execPath));
|
|
855
855
|
if (nearby) return nearby;
|
|
856
856
|
var target = [
|
|
857
857
|
"platform=" + platform,
|
|
@@ -867,7 +867,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
867
867
|
// eslint-disable-line
|
|
868
868
|
].filter(Boolean).join(" ");
|
|
869
869
|
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
870
|
-
function
|
|
870
|
+
function resolve25(dir2) {
|
|
871
871
|
var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
|
|
872
872
|
var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
873
873
|
if (!tuple2) return;
|
|
@@ -912,10 +912,10 @@ var require_node_gyp_build = __commonJS({
|
|
|
912
912
|
function compareTuples(a, b) {
|
|
913
913
|
return a.architectures.length - b.architectures.length;
|
|
914
914
|
}
|
|
915
|
-
function parseTags(
|
|
916
|
-
var arr =
|
|
915
|
+
function parseTags(file4) {
|
|
916
|
+
var arr = file4.split(".");
|
|
917
917
|
var extension2 = arr.pop();
|
|
918
|
-
var tags = { file:
|
|
918
|
+
var tags = { file: file4, specificity: 0 };
|
|
919
919
|
if (extension2 !== "node") return;
|
|
920
920
|
for (var i = 0; i < arr.length; i++) {
|
|
921
921
|
var tag = arr[i];
|
|
@@ -3244,7 +3244,7 @@ var require_websocket = __commonJS({
|
|
|
3244
3244
|
var http = __require("http");
|
|
3245
3245
|
var net = __require("net");
|
|
3246
3246
|
var tls = __require("tls");
|
|
3247
|
-
var { randomBytes: randomBytes5, createHash:
|
|
3247
|
+
var { randomBytes: randomBytes5, createHash: createHash9 } = __require("crypto");
|
|
3248
3248
|
var { Duplex, Readable: Readable2 } = __require("stream");
|
|
3249
3249
|
var { URL: URL3 } = __require("url");
|
|
3250
3250
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -3912,7 +3912,7 @@ var require_websocket = __commonJS({
|
|
|
3912
3912
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
3913
3913
|
return;
|
|
3914
3914
|
}
|
|
3915
|
-
const digest =
|
|
3915
|
+
const digest = createHash9("sha1").update(key + GUID).digest("base64");
|
|
3916
3916
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
3917
3917
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
3918
3918
|
return;
|
|
@@ -4281,7 +4281,7 @@ var require_websocket_server = __commonJS({
|
|
|
4281
4281
|
var EventEmitter = __require("events");
|
|
4282
4282
|
var http = __require("http");
|
|
4283
4283
|
var { Duplex } = __require("stream");
|
|
4284
|
-
var { createHash:
|
|
4284
|
+
var { createHash: createHash9 } = __require("crypto");
|
|
4285
4285
|
var extension2 = require_extension();
|
|
4286
4286
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
4287
4287
|
var subprotocol2 = require_subprotocol();
|
|
@@ -4588,7 +4588,7 @@ var require_websocket_server = __commonJS({
|
|
|
4588
4588
|
);
|
|
4589
4589
|
}
|
|
4590
4590
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
4591
|
-
const digest =
|
|
4591
|
+
const digest = createHash9("sha1").update(key + GUID).digest("base64");
|
|
4592
4592
|
const headers = [
|
|
4593
4593
|
"HTTP/1.1 101 Switching Protocols",
|
|
4594
4594
|
"Upgrade: websocket",
|
|
@@ -7314,9 +7314,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
7314
7314
|
}
|
|
7315
7315
|
close(callback) {
|
|
7316
7316
|
if (callback === void 0) {
|
|
7317
|
-
return new Promise((
|
|
7317
|
+
return new Promise((resolve25, reject) => {
|
|
7318
7318
|
this.close((err, data) => {
|
|
7319
|
-
return err ? reject(err) :
|
|
7319
|
+
return err ? reject(err) : resolve25(data);
|
|
7320
7320
|
});
|
|
7321
7321
|
});
|
|
7322
7322
|
}
|
|
@@ -7354,9 +7354,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
7354
7354
|
err = null;
|
|
7355
7355
|
}
|
|
7356
7356
|
if (callback === void 0) {
|
|
7357
|
-
return new Promise((
|
|
7357
|
+
return new Promise((resolve25, reject) => {
|
|
7358
7358
|
this.destroy(err, (err2, data) => {
|
|
7359
|
-
return err2 ? reject(err2) :
|
|
7359
|
+
return err2 ? reject(err2) : resolve25(data);
|
|
7360
7360
|
});
|
|
7361
7361
|
});
|
|
7362
7362
|
}
|
|
@@ -12311,12 +12311,12 @@ upgrade: ${upgrade2}\r
|
|
|
12311
12311
|
cb();
|
|
12312
12312
|
}
|
|
12313
12313
|
}
|
|
12314
|
-
const waitForDrain = () => new Promise((
|
|
12314
|
+
const waitForDrain = () => new Promise((resolve25, reject) => {
|
|
12315
12315
|
assert2(callback === null);
|
|
12316
12316
|
if (socket[kError]) {
|
|
12317
12317
|
reject(socket[kError]);
|
|
12318
12318
|
} else {
|
|
12319
|
-
callback =
|
|
12319
|
+
callback = resolve25;
|
|
12320
12320
|
}
|
|
12321
12321
|
});
|
|
12322
12322
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -13674,12 +13674,12 @@ var require_client_h2 = __commonJS({
|
|
|
13674
13674
|
cb();
|
|
13675
13675
|
}
|
|
13676
13676
|
}
|
|
13677
|
-
const waitForDrain = () => new Promise((
|
|
13677
|
+
const waitForDrain = () => new Promise((resolve25, reject) => {
|
|
13678
13678
|
assert2(callback === null);
|
|
13679
13679
|
if (socket[kError]) {
|
|
13680
13680
|
reject(socket[kError]);
|
|
13681
13681
|
} else {
|
|
13682
|
-
callback =
|
|
13682
|
+
callback = resolve25;
|
|
13683
13683
|
}
|
|
13684
13684
|
});
|
|
13685
13685
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -14047,16 +14047,16 @@ var require_client = __commonJS({
|
|
|
14047
14047
|
return this[kNeedDrain] < 2;
|
|
14048
14048
|
}
|
|
14049
14049
|
[kClose]() {
|
|
14050
|
-
return new Promise((
|
|
14050
|
+
return new Promise((resolve25) => {
|
|
14051
14051
|
if (this[kSize]) {
|
|
14052
|
-
this[kClosedResolve] =
|
|
14052
|
+
this[kClosedResolve] = resolve25;
|
|
14053
14053
|
} else {
|
|
14054
|
-
|
|
14054
|
+
resolve25(null);
|
|
14055
14055
|
}
|
|
14056
14056
|
});
|
|
14057
14057
|
}
|
|
14058
14058
|
[kDestroy](err) {
|
|
14059
|
-
return new Promise((
|
|
14059
|
+
return new Promise((resolve25) => {
|
|
14060
14060
|
const requests2 = this[kQueue].splice(this[kPendingIdx]);
|
|
14061
14061
|
for (let i = 0; i < requests2.length; i++) {
|
|
14062
14062
|
const request2 = requests2[i];
|
|
@@ -14069,7 +14069,7 @@ var require_client = __commonJS({
|
|
|
14069
14069
|
this[kClosedResolve]();
|
|
14070
14070
|
this[kClosedResolve] = null;
|
|
14071
14071
|
}
|
|
14072
|
-
|
|
14072
|
+
resolve25(null);
|
|
14073
14073
|
};
|
|
14074
14074
|
if (this[kHTTPContext]) {
|
|
14075
14075
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -14482,8 +14482,8 @@ var require_pool_base = __commonJS({
|
|
|
14482
14482
|
}
|
|
14483
14483
|
return Promise.all(closeAll);
|
|
14484
14484
|
} else {
|
|
14485
|
-
return new Promise((
|
|
14486
|
-
this[kClosedResolve] =
|
|
14485
|
+
return new Promise((resolve25) => {
|
|
14486
|
+
this[kClosedResolve] = resolve25;
|
|
14487
14487
|
});
|
|
14488
14488
|
}
|
|
14489
14489
|
}
|
|
@@ -16994,7 +16994,7 @@ var require_readable = __commonJS({
|
|
|
16994
16994
|
if (this._readableState.closeEmitted) {
|
|
16995
16995
|
return Promise.resolve(null);
|
|
16996
16996
|
}
|
|
16997
|
-
return new Promise((
|
|
16997
|
+
return new Promise((resolve25, reject) => {
|
|
16998
16998
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
16999
16999
|
this.destroy(new AbortError());
|
|
17000
17000
|
}
|
|
@@ -17008,11 +17008,11 @@ var require_readable = __commonJS({
|
|
|
17008
17008
|
if (signal.aborted) {
|
|
17009
17009
|
reject(signal.reason ?? new AbortError());
|
|
17010
17010
|
} else {
|
|
17011
|
-
|
|
17011
|
+
resolve25(null);
|
|
17012
17012
|
}
|
|
17013
17013
|
});
|
|
17014
17014
|
} else {
|
|
17015
|
-
this.on("close",
|
|
17015
|
+
this.on("close", resolve25);
|
|
17016
17016
|
}
|
|
17017
17017
|
this.on("error", noop2).on("data", () => {
|
|
17018
17018
|
if (this[kBytesRead] > limit) {
|
|
@@ -17040,7 +17040,7 @@ var require_readable = __commonJS({
|
|
|
17040
17040
|
}
|
|
17041
17041
|
function consume(stream, type) {
|
|
17042
17042
|
assert2(!stream[kConsume]);
|
|
17043
|
-
return new Promise((
|
|
17043
|
+
return new Promise((resolve25, reject) => {
|
|
17044
17044
|
if (isUnusable(stream)) {
|
|
17045
17045
|
const rState = stream._readableState;
|
|
17046
17046
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -17055,7 +17055,7 @@ var require_readable = __commonJS({
|
|
|
17055
17055
|
stream[kConsume] = {
|
|
17056
17056
|
type,
|
|
17057
17057
|
stream,
|
|
17058
|
-
resolve:
|
|
17058
|
+
resolve: resolve25,
|
|
17059
17059
|
reject,
|
|
17060
17060
|
length: 0,
|
|
17061
17061
|
body: []
|
|
@@ -17133,18 +17133,18 @@ var require_readable = __commonJS({
|
|
|
17133
17133
|
return buffer;
|
|
17134
17134
|
}
|
|
17135
17135
|
function consumeEnd(consume2, encoding) {
|
|
17136
|
-
const { type, body, resolve:
|
|
17136
|
+
const { type, body, resolve: resolve25, stream, length } = consume2;
|
|
17137
17137
|
try {
|
|
17138
17138
|
if (type === "text") {
|
|
17139
|
-
|
|
17139
|
+
resolve25(chunksDecode(body, length, encoding));
|
|
17140
17140
|
} else if (type === "json") {
|
|
17141
|
-
|
|
17141
|
+
resolve25(JSON.parse(chunksDecode(body, length, encoding)));
|
|
17142
17142
|
} else if (type === "arrayBuffer") {
|
|
17143
|
-
|
|
17143
|
+
resolve25(chunksConcat(body, length).buffer);
|
|
17144
17144
|
} else if (type === "blob") {
|
|
17145
|
-
|
|
17145
|
+
resolve25(new Blob(body, { type: stream[kContentType] }));
|
|
17146
17146
|
} else if (type === "bytes") {
|
|
17147
|
-
|
|
17147
|
+
resolve25(chunksConcat(body, length));
|
|
17148
17148
|
}
|
|
17149
17149
|
consumeFinish(consume2);
|
|
17150
17150
|
} catch (err) {
|
|
@@ -17363,9 +17363,9 @@ var require_api_request = __commonJS({
|
|
|
17363
17363
|
};
|
|
17364
17364
|
function request2(opts, callback) {
|
|
17365
17365
|
if (callback === void 0) {
|
|
17366
|
-
return new Promise((
|
|
17366
|
+
return new Promise((resolve25, reject) => {
|
|
17367
17367
|
request2.call(this, opts, (err, data) => {
|
|
17368
|
-
return err ? reject(err) :
|
|
17368
|
+
return err ? reject(err) : resolve25(data);
|
|
17369
17369
|
});
|
|
17370
17370
|
});
|
|
17371
17371
|
}
|
|
@@ -17626,9 +17626,9 @@ var require_api_stream = __commonJS({
|
|
|
17626
17626
|
};
|
|
17627
17627
|
function stream(opts, factory, callback) {
|
|
17628
17628
|
if (callback === void 0) {
|
|
17629
|
-
return new Promise((
|
|
17629
|
+
return new Promise((resolve25, reject) => {
|
|
17630
17630
|
stream.call(this, opts, factory, (err, data) => {
|
|
17631
|
-
return err ? reject(err) :
|
|
17631
|
+
return err ? reject(err) : resolve25(data);
|
|
17632
17632
|
});
|
|
17633
17633
|
});
|
|
17634
17634
|
}
|
|
@@ -17928,9 +17928,9 @@ var require_api_upgrade = __commonJS({
|
|
|
17928
17928
|
};
|
|
17929
17929
|
function upgrade2(opts, callback) {
|
|
17930
17930
|
if (callback === void 0) {
|
|
17931
|
-
return new Promise((
|
|
17931
|
+
return new Promise((resolve25, reject) => {
|
|
17932
17932
|
upgrade2.call(this, opts, (err, data) => {
|
|
17933
|
-
return err ? reject(err) :
|
|
17933
|
+
return err ? reject(err) : resolve25(data);
|
|
17934
17934
|
});
|
|
17935
17935
|
});
|
|
17936
17936
|
}
|
|
@@ -18024,9 +18024,9 @@ var require_api_connect = __commonJS({
|
|
|
18024
18024
|
};
|
|
18025
18025
|
function connect8(opts, callback) {
|
|
18026
18026
|
if (callback === void 0) {
|
|
18027
|
-
return new Promise((
|
|
18027
|
+
return new Promise((resolve25, reject) => {
|
|
18028
18028
|
connect8.call(this, opts, (err, data) => {
|
|
18029
|
-
return err ? reject(err) :
|
|
18029
|
+
return err ? reject(err) : resolve25(data);
|
|
18030
18030
|
});
|
|
18031
18031
|
});
|
|
18032
18032
|
}
|
|
@@ -19486,8 +19486,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
19486
19486
|
var require_snapshot_recorder = __commonJS({
|
|
19487
19487
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
19488
19488
|
"use strict";
|
|
19489
|
-
var { writeFile:
|
|
19490
|
-
var { dirname: dirname30, resolve:
|
|
19489
|
+
var { writeFile: writeFile28, readFile: readFile49, mkdir: mkdir28 } = __require("node:fs/promises");
|
|
19490
|
+
var { dirname: dirname30, resolve: resolve25 } = __require("node:path");
|
|
19491
19491
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
19492
19492
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
19493
19493
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -19703,7 +19703,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19703
19703
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19704
19704
|
}
|
|
19705
19705
|
try {
|
|
19706
|
-
const data = await readFile49(
|
|
19706
|
+
const data = await readFile49(resolve25(path), "utf8");
|
|
19707
19707
|
const parsed = JSON.parse(data);
|
|
19708
19708
|
if (Array.isArray(parsed)) {
|
|
19709
19709
|
this.#snapshots.clear();
|
|
@@ -19732,13 +19732,13 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19732
19732
|
if (!path) {
|
|
19733
19733
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19734
19734
|
}
|
|
19735
|
-
const resolvedPath =
|
|
19735
|
+
const resolvedPath = resolve25(path);
|
|
19736
19736
|
await mkdir28(dirname30(resolvedPath), { recursive: true });
|
|
19737
19737
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
19738
19738
|
hash: hash2,
|
|
19739
19739
|
snapshot
|
|
19740
19740
|
}));
|
|
19741
|
-
await
|
|
19741
|
+
await writeFile28(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
19742
19742
|
}
|
|
19743
19743
|
/**
|
|
19744
19744
|
* Clears all recorded snapshots
|
|
@@ -27230,7 +27230,7 @@ var require_fetch = __commonJS({
|
|
|
27230
27230
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
27231
27231
|
return dispatchWithProtocolPreference(body);
|
|
27232
27232
|
function dispatchWithProtocolPreference(body2, allowH2) {
|
|
27233
|
-
return new Promise((
|
|
27233
|
+
return new Promise((resolve25, reject) => agent3.dispatch(
|
|
27234
27234
|
{
|
|
27235
27235
|
path: hasTrailingQuestionMark ? `${path}?` : path,
|
|
27236
27236
|
origin: url2.origin,
|
|
@@ -27313,7 +27313,7 @@ var require_fetch = __commonJS({
|
|
|
27313
27313
|
}
|
|
27314
27314
|
}
|
|
27315
27315
|
const onError = (err) => this.onResponseError(controller, err);
|
|
27316
|
-
|
|
27316
|
+
resolve25({
|
|
27317
27317
|
status: status11,
|
|
27318
27318
|
statusText,
|
|
27319
27319
|
headersList,
|
|
@@ -27346,7 +27346,7 @@ var require_fetch = __commonJS({
|
|
|
27346
27346
|
fetchParams.controller.off("terminated", this.abort);
|
|
27347
27347
|
}
|
|
27348
27348
|
if (request2.mode === "websocket" && allowH2 !== false && error63?.code === "UND_ERR_INFO" && error63?.message === "HTTP/2: Extended CONNECT protocol not supported by server") {
|
|
27349
|
-
|
|
27349
|
+
resolve25(dispatchWithProtocolPreference(body2, false));
|
|
27350
27350
|
return;
|
|
27351
27351
|
}
|
|
27352
27352
|
this.body?.destroy(error63);
|
|
@@ -27360,7 +27360,7 @@ var require_fetch = __commonJS({
|
|
|
27360
27360
|
const rawHeaders = controller?.rawHeaders ?? [];
|
|
27361
27361
|
const headersList = new HeadersList();
|
|
27362
27362
|
appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders);
|
|
27363
|
-
|
|
27363
|
+
resolve25({
|
|
27364
27364
|
status: status11,
|
|
27365
27365
|
statusText: STATUS_CODES[status11],
|
|
27366
27366
|
headersList,
|
|
@@ -32692,9 +32692,9 @@ function runRedacted({
|
|
|
32692
32692
|
redact
|
|
32693
32693
|
}) {
|
|
32694
32694
|
const values = redact ?? Object.values(env);
|
|
32695
|
-
return new Promise((
|
|
32696
|
-
const [
|
|
32697
|
-
const child = spawn(
|
|
32695
|
+
return new Promise((resolve25, reject) => {
|
|
32696
|
+
const [file4, ...args] = command;
|
|
32697
|
+
const child = spawn(file4, args, {
|
|
32698
32698
|
env: { ...baseEnv, ...env },
|
|
32699
32699
|
stdio: ["inherit", "pipe", "pipe"],
|
|
32700
32700
|
...cwd ? { cwd } : {},
|
|
@@ -32718,7 +32718,7 @@ function runRedacted({
|
|
|
32718
32718
|
child.on("error", reject);
|
|
32719
32719
|
child.on("close", (code, ended) => {
|
|
32720
32720
|
signal?.removeEventListener("abort", killGroup);
|
|
32721
|
-
void drained.then(() =>
|
|
32721
|
+
void drained.then(() => resolve25(code ?? (ended ? 128 + signalNumber(ended) : 1)));
|
|
32722
32722
|
});
|
|
32723
32723
|
});
|
|
32724
32724
|
}
|
|
@@ -36990,7 +36990,7 @@ function flagText({
|
|
|
36990
36990
|
}
|
|
36991
36991
|
|
|
36992
36992
|
// src/rules/cli-version.rules.ts
|
|
36993
|
-
var STAMPED = "0.1.
|
|
36993
|
+
var STAMPED = "0.1.85";
|
|
36994
36994
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36995
36995
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36996
36996
|
}
|
|
@@ -42040,7 +42040,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
42040
42040
|
var NONE = 0;
|
|
42041
42041
|
var ASSUMED = 1;
|
|
42042
42042
|
var PROVEN = 2;
|
|
42043
|
-
function isRecursive(inst, stack,
|
|
42043
|
+
function isRecursive(inst, stack, resolve25) {
|
|
42044
42044
|
const cached2 = recursive.get(inst);
|
|
42045
42045
|
if (cached2 !== void 0)
|
|
42046
42046
|
return cached2 ? PROVEN : NONE;
|
|
@@ -42050,7 +42050,7 @@ function isRecursive(inst, stack, resolve24) {
|
|
|
42050
42050
|
let result2 = NONE;
|
|
42051
42051
|
const check3 = (child) => {
|
|
42052
42052
|
if (result2 !== PROVEN && child?._zod) {
|
|
42053
|
-
const answer6 = isRecursive(child, stack,
|
|
42053
|
+
const answer6 = isRecursive(child, stack, resolve25);
|
|
42054
42054
|
if (answer6 > result2)
|
|
42055
42055
|
result2 = answer6;
|
|
42056
42056
|
}
|
|
@@ -42061,7 +42061,7 @@ function isRecursive(inst, stack, resolve24) {
|
|
|
42061
42061
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
42062
42062
|
if (spread && !desc.enumerable)
|
|
42063
42063
|
continue;
|
|
42064
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
42064
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve25) : NONE;
|
|
42065
42065
|
if (child > answer6)
|
|
42066
42066
|
answer6 = child;
|
|
42067
42067
|
}
|
|
@@ -42125,7 +42125,7 @@ function isRecursive(inst, stack, resolve24) {
|
|
|
42125
42125
|
break;
|
|
42126
42126
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
42127
42127
|
case "lazy": {
|
|
42128
|
-
const inner = def._cachedInner ?? (
|
|
42128
|
+
const inner = def._cachedInner ?? (resolve25 ? inst._zod.innerType : void 0);
|
|
42129
42129
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
42130
42130
|
break;
|
|
42131
42131
|
}
|
|
@@ -59493,6 +59493,18 @@ var setVaultAgentRuleInputSchemaDefinition = external_exports.object({
|
|
|
59493
59493
|
reauthToken: external_exports.string().min(1).optional()
|
|
59494
59494
|
});
|
|
59495
59495
|
var setVaultAgentRuleInputSchema = setVaultAgentRuleInputSchemaDefinition;
|
|
59496
|
+
var setVaultAgentRulesInputSchemaDefinition = external_exports.object({
|
|
59497
|
+
workspaceId: external_exports.string().min(1),
|
|
59498
|
+
agentId: external_exports.string().min(1),
|
|
59499
|
+
rules: external_exports.array(
|
|
59500
|
+
external_exports.object({
|
|
59501
|
+
connectionId: external_exports.string().min(1),
|
|
59502
|
+
rule: external_exports.enum([...VAULT_AGENT_RULES, "default"])
|
|
59503
|
+
})
|
|
59504
|
+
).min(1).max(4),
|
|
59505
|
+
/** One fresh passkey proof for the whole change, when any part needs one. */
|
|
59506
|
+
reauthToken: external_exports.string().min(1).optional()
|
|
59507
|
+
});
|
|
59496
59508
|
var VaultAgentRulesDialogSlot = uiTokens("vault").component("agentRulesDialog");
|
|
59497
59509
|
|
|
59498
59510
|
// ../../modules/vault/contract/src/vault-devices.ts
|
|
@@ -62231,7 +62243,9 @@ var conversationMirrorSchemaDefinition = external_exports.object({
|
|
|
62231
62243
|
/** False keeps every agent out, as a channel shared with another workspace does by default. */
|
|
62232
62244
|
agentsAllowed: external_exports.boolean().optional(),
|
|
62233
62245
|
/** When the mirror ended: it stays readable and takes no new messages. */
|
|
62234
|
-
endedAt: external_exports.iso.datetime().nullable().optional()
|
|
62246
|
+
endedAt: external_exports.iso.datetime().nullable().optional(),
|
|
62247
|
+
/** The name as the source writes it, such as a WhatsApp group's subject; absent shows `name`. */
|
|
62248
|
+
title: external_exports.string().max(120).optional()
|
|
62235
62249
|
});
|
|
62236
62250
|
var messageKindSchema = external_exports.enum(["message", "notice"]);
|
|
62237
62251
|
var cardQuestionSchemaDefinition = external_exports.object({
|
|
@@ -63002,7 +63016,11 @@ var openMirrorInputSchemaDefinition = external_exports.object({
|
|
|
63002
63016
|
/** A channel of this workspace the mirror attaches to; pass its name and visibility to keep. */
|
|
63003
63017
|
channelId: idSchema4.optional(),
|
|
63004
63018
|
/** False keeps every agent out from the start; absent keeps what the mirror had. */
|
|
63005
|
-
agentsAllowed: external_exports.boolean().optional()
|
|
63019
|
+
agentsAllowed: external_exports.boolean().optional(),
|
|
63020
|
+
/** The name as the source writes it, shown in place of the channel's handle; absent keeps it. */
|
|
63021
|
+
title: external_exports.string().trim().min(1).max(120).optional(),
|
|
63022
|
+
/** True only brings a live mirror in line: a closed one stays closed and none is opened. */
|
|
63023
|
+
refreshOnly: external_exports.boolean().default(false)
|
|
63006
63024
|
});
|
|
63007
63025
|
var postMirroredInputSchemaDefinition = external_exports.object({
|
|
63008
63026
|
workspaceId: workspaceIdSchema,
|
|
@@ -63048,7 +63066,9 @@ var updateMirroredInputSchemaDefinition = external_exports.object({
|
|
|
63048
63066
|
/** Laze read the source's message again, which is not an edit: no edited mark. */
|
|
63049
63067
|
rerendered: external_exports.boolean().default(false),
|
|
63050
63068
|
/** The source says the message was never edited: an edited mark Laze gave it comes off. */
|
|
63051
|
-
neverEdited: external_exports.boolean().default(false)
|
|
63069
|
+
neverEdited: external_exports.boolean().default(false),
|
|
63070
|
+
/** Files the mirror stored since, attached when the message has none yet. */
|
|
63071
|
+
fileIds: external_exports.array(idSchema4).max(10).default([])
|
|
63052
63072
|
});
|
|
63053
63073
|
var removeMirroredLinksInputSchemaDefinition = external_exports.object({
|
|
63054
63074
|
workspaceId: workspaceIdSchema,
|
|
@@ -63116,7 +63136,8 @@ var syncMirrorReadInputSchemaDefinition = external_exports.object({
|
|
|
63116
63136
|
workspaceId: workspaceIdSchema,
|
|
63117
63137
|
channelId: idSchema4,
|
|
63118
63138
|
userId: idSchema4,
|
|
63119
|
-
readTo: external_exports.iso.datetime()
|
|
63139
|
+
readTo: external_exports.iso.datetime(),
|
|
63140
|
+
unread: external_exports.number().int().positive().max(1e6).optional()
|
|
63120
63141
|
});
|
|
63121
63142
|
var mirroredReadToInputSchemaDefinition = external_exports.object({
|
|
63122
63143
|
workspaceId: workspaceIdSchema,
|
|
@@ -68406,7 +68427,7 @@ var setWorkspaceDefaultAgentAsCallerInputSchemaDefinition = external_exports.obj
|
|
|
68406
68427
|
// ../../modules/agent/contract/src/agent.ts
|
|
68407
68428
|
var AGENT_LINK_TTL_SECONDS = 30 * 60;
|
|
68408
68429
|
var AGENT_JOIN_REQUEST_TTL_SECONDS = 24 * 60 * 60;
|
|
68409
|
-
var AGENT_ONLINE_WINDOW_SECONDS =
|
|
68430
|
+
var AGENT_ONLINE_WINDOW_SECONDS = 2 * 60;
|
|
68410
68431
|
var INBOX_WAIT_MAX_SECONDS = 55;
|
|
68411
68432
|
var workspaceIdSchema14 = external_exports.string().min(1);
|
|
68412
68433
|
var idSchema17 = external_exports.string().min(1).max(80);
|
|
@@ -70368,7 +70389,7 @@ async function copyAgent({
|
|
|
70368
70389
|
|
|
70369
70390
|
// src/services/agent-commands.service.ts
|
|
70370
70391
|
import { mkdir as mkdir17, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
|
|
70371
|
-
import { join as
|
|
70392
|
+
import { join as join18, resolve as resolve5 } from "node:path";
|
|
70372
70393
|
|
|
70373
70394
|
// src/rules/agent-profile.rules.ts
|
|
70374
70395
|
var HARNESS_NAMES = {
|
|
@@ -71900,10 +71921,10 @@ async function liveElsewhere({
|
|
|
71900
71921
|
}) {
|
|
71901
71922
|
if (await rushKeeps({ context, key, claudePid, asleepCounts })) return true;
|
|
71902
71923
|
const folder = dirname4(statePathOf({ context, kind: "sessions", profile: "x" }));
|
|
71903
|
-
for (const
|
|
71904
|
-
const pid = Number(
|
|
71924
|
+
for (const file4 of await readdir(folder).catch(() => [])) {
|
|
71925
|
+
const pid = Number(file4.replace(/\.json$/, ""));
|
|
71905
71926
|
if (!pid || pid === claudePid || !context.processes.alive(pid)) continue;
|
|
71906
|
-
const noted = await readFile5(join3(folder,
|
|
71927
|
+
const noted = await readFile5(join3(folder, file4), "utf8").then(
|
|
71907
71928
|
(text3) => JSON.parse(text3),
|
|
71908
71929
|
() => void 0
|
|
71909
71930
|
);
|
|
@@ -71954,8 +71975,8 @@ async function runsInSubagent({ context, command }) {
|
|
|
71954
71975
|
const folder = join3(dirname4(path), sessionId, "subagents");
|
|
71955
71976
|
const files2 = await readdir(folder).catch(() => []);
|
|
71956
71977
|
const subagents = await Promise.all(
|
|
71957
|
-
files2.filter((
|
|
71958
|
-
async (
|
|
71978
|
+
files2.filter((file4) => file4.endsWith(".jsonl")).map(
|
|
71979
|
+
async (file4) => lastCallAtOf({ text: await tailOf({ path: join3(folder, file4) }), command })
|
|
71959
71980
|
)
|
|
71960
71981
|
);
|
|
71961
71982
|
const session = lastCallAtOf({ text: await tailOf({ path }), command });
|
|
@@ -72252,17 +72273,17 @@ async function sendParts({
|
|
|
72252
72273
|
async function uploadFile({
|
|
72253
72274
|
context,
|
|
72254
72275
|
client,
|
|
72255
|
-
file:
|
|
72276
|
+
file: file4
|
|
72256
72277
|
}) {
|
|
72257
72278
|
const ticket = await client.post(CHAT_KEY_PATHS.startUpload, {
|
|
72258
|
-
channel:
|
|
72259
|
-
fileName:
|
|
72260
|
-
contentType:
|
|
72261
|
-
sizeBytes:
|
|
72279
|
+
channel: file4.channel,
|
|
72280
|
+
fileName: file4.fileName,
|
|
72281
|
+
contentType: file4.contentType,
|
|
72282
|
+
sizeBytes: file4.bytes.byteLength
|
|
72262
72283
|
});
|
|
72263
72284
|
const attachmentId = ticket.attachment.id;
|
|
72264
72285
|
try {
|
|
72265
|
-
const parts = await sendParts({ context, ticket, bytes:
|
|
72286
|
+
const parts = await sendParts({ context, ticket, bytes: file4.bytes });
|
|
72266
72287
|
return await client.post(CHAT_KEY_PATHS.completeUpload, { attachmentId, parts });
|
|
72267
72288
|
} catch (cause) {
|
|
72268
72289
|
await client.post(CHAT_KEY_PATHS.abortUpload, { attachmentId }).catch(() => void 0);
|
|
@@ -72295,13 +72316,13 @@ async function readyOf({ context, source }) {
|
|
|
72295
72316
|
if (marked) return { kind: "id", id: marked };
|
|
72296
72317
|
throw new CliUsageError(`${value} is not a file here, a URL or an uploaded file id`);
|
|
72297
72318
|
}
|
|
72298
|
-
function asBytes({ source, file:
|
|
72299
|
-
if (source.image && !
|
|
72319
|
+
function asBytes({ source, file: file4 }) {
|
|
72320
|
+
if (source.image && !file4.contentType.startsWith("image/")) {
|
|
72300
72321
|
throw new CliUsageError(
|
|
72301
|
-
`--image ${source.value} is not an image (${
|
|
72322
|
+
`--image ${source.value} is not an image (${file4.contentType}); send it with --file`
|
|
72302
72323
|
);
|
|
72303
72324
|
}
|
|
72304
|
-
return { kind: "bytes", file:
|
|
72325
|
+
return { kind: "bytes", file: file4 };
|
|
72305
72326
|
}
|
|
72306
72327
|
async function downloaded({ context, url: url2 }) {
|
|
72307
72328
|
const response = await context.fetcher(url2);
|
|
@@ -73085,10 +73106,10 @@ async function codexRolloutPathOf({
|
|
|
73085
73106
|
}) {
|
|
73086
73107
|
const root = join6(codexHome, "sessions");
|
|
73087
73108
|
const files2 = await readdir2(root, { recursive: true }).catch(() => []);
|
|
73088
|
-
const
|
|
73109
|
+
const file4 = files2.find(
|
|
73089
73110
|
(name3) => basename4(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
|
|
73090
73111
|
);
|
|
73091
|
-
return
|
|
73112
|
+
return file4 ? join6(root, file4) : void 0;
|
|
73092
73113
|
}
|
|
73093
73114
|
function rolloutPathOf({ delivery }) {
|
|
73094
73115
|
return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
|
|
@@ -74168,10 +74189,10 @@ async function notesOf({ context }) {
|
|
|
74168
74189
|
const folder = dirname9(statePathOf({ context, kind: "sessions", profile: "x" }));
|
|
74169
74190
|
const files2 = await readdir3(folder).catch(() => []);
|
|
74170
74191
|
const notes = await Promise.all(
|
|
74171
|
-
files2.map(async (
|
|
74172
|
-
const pid = Number(
|
|
74173
|
-
const note = await jsonOf(join10(folder,
|
|
74174
|
-
const at = await stat3(join10(folder,
|
|
74192
|
+
files2.map(async (file4) => {
|
|
74193
|
+
const pid = Number(file4.replace(/\.json$/, ""));
|
|
74194
|
+
const note = await jsonOf(join10(folder, file4));
|
|
74195
|
+
const at = await stat3(join10(folder, file4)).then(
|
|
74175
74196
|
(info) => info.mtimeMs,
|
|
74176
74197
|
() => 0
|
|
74177
74198
|
);
|
|
@@ -74383,9 +74404,9 @@ var REFRESH_MS = 3e4;
|
|
|
74383
74404
|
var MAX_RETRY_SECONDS3 = 60;
|
|
74384
74405
|
var CLI_CHANGED_EXIT = 75;
|
|
74385
74406
|
async function cliStampOf({ context }) {
|
|
74386
|
-
const
|
|
74387
|
-
if (!
|
|
74388
|
-
return stat4(
|
|
74407
|
+
const file4 = context.program.at(-1);
|
|
74408
|
+
if (!file4) return "";
|
|
74409
|
+
return stat4(file4).then(
|
|
74389
74410
|
(info) => `${info.mtimeMs}:${info.size}`,
|
|
74390
74411
|
() => ""
|
|
74391
74412
|
);
|
|
@@ -74691,26 +74712,26 @@ async function installSystemd({ context }) {
|
|
|
74691
74712
|
const name3 = serviceNameOf({ context });
|
|
74692
74713
|
const env = context.environment.inherited;
|
|
74693
74714
|
const base = env.XDG_CONFIG_HOME || join13(homeOf({ context }), ".config");
|
|
74694
|
-
const
|
|
74695
|
-
await mkdir11(dirname12(
|
|
74715
|
+
const file4 = join13(base, "systemd", "user", `${name3}.service`);
|
|
74716
|
+
await mkdir11(dirname12(file4), { recursive: true });
|
|
74696
74717
|
await writeFile10(
|
|
74697
|
-
|
|
74718
|
+
file4,
|
|
74698
74719
|
systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
|
|
74699
74720
|
);
|
|
74700
74721
|
const systemctl = (...words) => run({ context, command: ["systemctl", "--user", ...words] });
|
|
74701
74722
|
const started = await systemctl("daemon-reload") && await systemctl("enable", `${name3}.service`) && await systemctl("restart", `${name3}.service`);
|
|
74702
74723
|
if (!started)
|
|
74703
74724
|
throw new CliUsageError(`systemd did not start ${name3}.service; see the lines above.`);
|
|
74704
|
-
return { manager: "systemd", name: name3, file:
|
|
74725
|
+
return { manager: "systemd", name: name3, file: file4, log: `journalctl --user -u ${name3}` };
|
|
74705
74726
|
}
|
|
74706
74727
|
async function installLaunchd({ context }) {
|
|
74707
74728
|
const name3 = serviceNameOf({ context });
|
|
74708
74729
|
const label3 = `ai.laze.${name3}`;
|
|
74709
|
-
const
|
|
74730
|
+
const file4 = join13(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
|
|
74710
74731
|
const log = logPathOf({ context });
|
|
74711
|
-
await mkdir11(dirname12(
|
|
74732
|
+
await mkdir11(dirname12(file4), { recursive: true });
|
|
74712
74733
|
await writeFile10(
|
|
74713
|
-
|
|
74734
|
+
file4,
|
|
74714
74735
|
launchAgentOf({
|
|
74715
74736
|
label: label3,
|
|
74716
74737
|
argv: runArgvOf({ context }),
|
|
@@ -74721,10 +74742,10 @@ async function installLaunchd({ context }) {
|
|
|
74721
74742
|
await quietly({ context, script: `launchctl bootout gui/$(id -u)/${label3}` });
|
|
74722
74743
|
const started = await run({
|
|
74723
74744
|
context,
|
|
74724
|
-
command: ["sh", "-c", `launchctl bootstrap gui/$(id -u) '${
|
|
74745
|
+
command: ["sh", "-c", `launchctl bootstrap gui/$(id -u) '${file4.replaceAll("'", "'\\''")}'`]
|
|
74725
74746
|
});
|
|
74726
74747
|
if (!started) throw new CliUsageError(`launchd did not start ${label3}; see the lines above.`);
|
|
74727
|
-
return { manager: "launchd", name: label3, file:
|
|
74748
|
+
return { manager: "launchd", name: label3, file: file4, log };
|
|
74728
74749
|
}
|
|
74729
74750
|
async function installDetached({ context }) {
|
|
74730
74751
|
const log = logPathOf({ context });
|
|
@@ -75184,8 +75205,8 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
75184
75205
|
}
|
|
75185
75206
|
async call(method, params) {
|
|
75186
75207
|
const id4 = ++this.#nextId;
|
|
75187
|
-
const reply2 = await new Promise((
|
|
75188
|
-
this.#pending.set(id4,
|
|
75208
|
+
const reply2 = await new Promise((resolve25) => {
|
|
75209
|
+
this.#pending.set(id4, resolve25);
|
|
75189
75210
|
this.write({ id: id4, method, params });
|
|
75190
75211
|
});
|
|
75191
75212
|
if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
|
|
@@ -75197,12 +75218,12 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
75197
75218
|
/** Starts one turn; `done` settles when it completes, keeping its last agent message. */
|
|
75198
75219
|
async startTurn({ threadId, text: text3 }) {
|
|
75199
75220
|
const result2 = { answer: "" };
|
|
75200
|
-
const done = new Promise((
|
|
75221
|
+
const done = new Promise((resolve25) => {
|
|
75201
75222
|
const listen = (message2) => {
|
|
75202
75223
|
absorbTurnEvent({ result: result2, message: message2 });
|
|
75203
75224
|
if (message2.method !== "turn/completed") return;
|
|
75204
75225
|
this.#listeners.delete(listen);
|
|
75205
|
-
|
|
75226
|
+
resolve25(result2);
|
|
75206
75227
|
};
|
|
75207
75228
|
this.#listeners.add(listen);
|
|
75208
75229
|
});
|
|
@@ -75247,9 +75268,9 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
75247
75268
|
async function newestThreadId({ codexHome }) {
|
|
75248
75269
|
const root = join14(codexHome, "sessions");
|
|
75249
75270
|
const files2 = await readdir4(root, { recursive: true }).catch(() => []);
|
|
75250
|
-
const rollouts = files2.filter((
|
|
75271
|
+
const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
|
|
75251
75272
|
const dated = await Promise.all(
|
|
75252
|
-
rollouts.map(async (
|
|
75273
|
+
rollouts.map(async (file4) => ({ file: file4, at: (await stat5(join14(root, file4))).mtimeMs }))
|
|
75253
75274
|
);
|
|
75254
75275
|
const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
|
|
75255
75276
|
const id4 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
|
|
@@ -75520,11 +75541,11 @@ async function newestThreadIn({
|
|
|
75520
75541
|
}) {
|
|
75521
75542
|
const root = join15(codexHome, "sessions");
|
|
75522
75543
|
const files2 = await readdir5(root, { recursive: true }).catch(() => []);
|
|
75523
|
-
const rollouts = files2.filter((
|
|
75544
|
+
const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
|
|
75524
75545
|
const dated = await Promise.all(
|
|
75525
|
-
rollouts.map(async (
|
|
75526
|
-
path: join15(root,
|
|
75527
|
-
at: await stat6(join15(root,
|
|
75546
|
+
rollouts.map(async (file4) => ({
|
|
75547
|
+
path: join15(root, file4),
|
|
75548
|
+
at: await stat6(join15(root, file4)).then(
|
|
75528
75549
|
(info) => info.mtimeMs,
|
|
75529
75550
|
() => 0
|
|
75530
75551
|
)
|
|
@@ -75594,23 +75615,32 @@ async function linkCodexSession({
|
|
|
75594
75615
|
}
|
|
75595
75616
|
|
|
75596
75617
|
// src/services/laze-plugin.service.ts
|
|
75597
|
-
import { mkdir as mkdir14, readFile as readFile16, writeFile as writeFile13 } from "node:fs/promises";
|
|
75618
|
+
import { mkdir as mkdir14, readFile as readFile16, rm as rm7, writeFile as writeFile13 } from "node:fs/promises";
|
|
75598
75619
|
import { homedir as homedir4 } from "node:os";
|
|
75599
|
-
import { dirname as dirname15, join as
|
|
75620
|
+
import { dirname as dirname15, join as join17 } from "node:path";
|
|
75600
75621
|
|
|
75601
75622
|
// src/rules/laze-plugin.rules.ts
|
|
75623
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
75624
|
+
import { join as join16 } from "node:path";
|
|
75602
75625
|
var LAZE_PLUGIN = "laze";
|
|
75626
|
+
function pluginNameOf({ configPath, home }) {
|
|
75627
|
+
if (configPath === join16(home, ".laze", "config.json")) return LAZE_PLUGIN;
|
|
75628
|
+
return `${LAZE_PLUGIN}-${createHash3("sha256").update(configPath).digest("hex").slice(0, 8)}`;
|
|
75629
|
+
}
|
|
75603
75630
|
var NPX_CLI = ["npx", "-y", "@lazehq/cli@latest"];
|
|
75604
75631
|
var quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
75632
|
+
var GONE = { hook: "exit 0", monitor: "exec tail -f /dev/null" };
|
|
75605
75633
|
function cliLineOf({
|
|
75606
75634
|
program,
|
|
75607
75635
|
args,
|
|
75608
|
-
configPath
|
|
75636
|
+
configPath,
|
|
75637
|
+
kind: kind2 = "hook"
|
|
75609
75638
|
}) {
|
|
75610
75639
|
const here = [...program, ...args].map(quote).join(" ");
|
|
75611
75640
|
const fallback = [...NPX_CLI, ...args].join(" ");
|
|
75612
75641
|
const run4 = `if [ -e ${quote(program.at(-1) ?? "")} ]; then exec ${here}; else exec ${fallback}; fi`;
|
|
75613
|
-
|
|
75642
|
+
const config2 = quote(configPath);
|
|
75643
|
+
return `if [ ! -e ${config2} ]; then ${GONE[kind2]}; fi; export LAZE_CLI_CONFIG=${config2}; ${run4}`;
|
|
75614
75644
|
}
|
|
75615
75645
|
var SKILL = `---
|
|
75616
75646
|
name: laze
|
|
@@ -75761,6 +75791,7 @@ function pluginHooksOf({ line }) {
|
|
|
75761
75791
|
};
|
|
75762
75792
|
}
|
|
75763
75793
|
function lazePluginFiles({
|
|
75794
|
+
name: name3 = LAZE_PLUGIN,
|
|
75764
75795
|
program,
|
|
75765
75796
|
version: version2,
|
|
75766
75797
|
configPath
|
|
@@ -75772,13 +75803,13 @@ function lazePluginFiles({
|
|
|
75772
75803
|
const author = { name: "Laze", url: "https://laze.so" };
|
|
75773
75804
|
return {
|
|
75774
75805
|
".claude-plugin/marketplace.json": json7({
|
|
75775
|
-
name:
|
|
75806
|
+
name: name3,
|
|
75776
75807
|
owner: author,
|
|
75777
|
-
plugins: [{ name:
|
|
75808
|
+
plugins: [{ name: name3, source: `./${LAZE_PLUGIN}`, description }]
|
|
75778
75809
|
}),
|
|
75779
75810
|
"laze/plugin.json": json7({
|
|
75780
75811
|
$schema: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
75781
|
-
name:
|
|
75812
|
+
name: name3,
|
|
75782
75813
|
version: version2,
|
|
75783
75814
|
description,
|
|
75784
75815
|
author,
|
|
@@ -75792,7 +75823,7 @@ function lazePluginFiles({
|
|
|
75792
75823
|
command: [...NPX_CLI, "hook", "monitor"]
|
|
75793
75824
|
}),
|
|
75794
75825
|
"laze/.claude-plugin/plugin.json": json7({
|
|
75795
|
-
name:
|
|
75826
|
+
name: name3,
|
|
75796
75827
|
version: version2,
|
|
75797
75828
|
description,
|
|
75798
75829
|
author
|
|
@@ -75800,7 +75831,7 @@ function lazePluginFiles({
|
|
|
75800
75831
|
"laze/monitors/monitors.json": json7([
|
|
75801
75832
|
{
|
|
75802
75833
|
name: "laze-messages",
|
|
75803
|
-
command:
|
|
75834
|
+
command: cliLineOf({ program, args: ["hook", "monitor"], configPath, kind: "monitor" }),
|
|
75804
75835
|
description: "Laze messages for this session"
|
|
75805
75836
|
}
|
|
75806
75837
|
]),
|
|
@@ -75811,11 +75842,21 @@ function lazePluginFiles({
|
|
|
75811
75842
|
// src/services/laze-plugin.service.ts
|
|
75812
75843
|
var REGISTER_LIMIT_MS = 6e4;
|
|
75813
75844
|
var quote2 = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
75845
|
+
function homeOf2({ context }) {
|
|
75846
|
+
return context.environment.inherited.HOME || homedir4();
|
|
75847
|
+
}
|
|
75848
|
+
function pluginNameHere({ context }) {
|
|
75849
|
+
return pluginNameOf({ configPath: context.environment.configPath, home: homeOf2({ context }) });
|
|
75850
|
+
}
|
|
75851
|
+
function installedNameOf({ context }) {
|
|
75852
|
+
const name3 = pluginNameHere({ context });
|
|
75853
|
+
return `${name3}@${name3}`;
|
|
75854
|
+
}
|
|
75814
75855
|
function pluginFolderOf({ context }) {
|
|
75815
|
-
return
|
|
75856
|
+
return join17(dirname15(context.environment.configPath), "plugins");
|
|
75816
75857
|
}
|
|
75817
75858
|
async function pluginIsCurrent({ context }) {
|
|
75818
|
-
const manifest =
|
|
75859
|
+
const manifest = join17(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
|
|
75819
75860
|
const written = await readFile16(manifest, "utf8").then(
|
|
75820
75861
|
(text3) => JSON.parse(text3).version,
|
|
75821
75862
|
() => void 0
|
|
@@ -75825,12 +75866,13 @@ async function pluginIsCurrent({ context }) {
|
|
|
75825
75866
|
async function writeLazePlugin({ context }) {
|
|
75826
75867
|
const folder = pluginFolderOf({ context });
|
|
75827
75868
|
const files2 = lazePluginFiles({
|
|
75869
|
+
name: pluginNameHere({ context }),
|
|
75828
75870
|
program: context.program,
|
|
75829
75871
|
version: cliVersionOf(),
|
|
75830
75872
|
configPath: context.environment.configPath
|
|
75831
75873
|
});
|
|
75832
75874
|
for (const [path, text3] of Object.entries(files2)) {
|
|
75833
|
-
const target =
|
|
75875
|
+
const target = join17(folder, path);
|
|
75834
75876
|
await mkdir14(dirname15(target), { recursive: true });
|
|
75835
75877
|
await writeFile13(target, text3);
|
|
75836
75878
|
}
|
|
@@ -75849,34 +75891,53 @@ async function claudeScript({ context, script }) {
|
|
|
75849
75891
|
}
|
|
75850
75892
|
var QUIET = ">/dev/null 2>&1 </dev/null";
|
|
75851
75893
|
async function registerWithClaude({ context, folder }) {
|
|
75894
|
+
const name3 = pluginNameHere({ context });
|
|
75895
|
+
const plugin2 = installedNameOf({ context });
|
|
75852
75896
|
const script = [
|
|
75853
75897
|
`claude plugin marketplace add ${quote2(folder)} --scope user ${QUIET}`,
|
|
75854
|
-
`claude plugin marketplace update ${
|
|
75898
|
+
`claude plugin marketplace update ${name3} ${QUIET}`,
|
|
75855
75899
|
// install is a no-op for a plugin Claude Code already has; update refreshes its cached copy.
|
|
75856
|
-
`{ claude plugin install ${
|
|
75857
|
-
`claude plugin update ${
|
|
75900
|
+
`{ claude plugin install ${plugin2} --scope user ${QUIET} || true; }`,
|
|
75901
|
+
`claude plugin update ${plugin2} ${QUIET}`
|
|
75902
|
+
].join("; ");
|
|
75903
|
+
return claudeScript({ context, script });
|
|
75904
|
+
}
|
|
75905
|
+
function claudeDirOf({ context }) {
|
|
75906
|
+
return context.environment.inherited.CLAUDE_CONFIG_DIR || join17(homeOf2({ context }), ".claude");
|
|
75907
|
+
}
|
|
75908
|
+
function unregisterAs({ context, name: name3 }) {
|
|
75909
|
+
const script = [
|
|
75910
|
+
`claude plugin uninstall ${name3}@${name3} --scope user ${QUIET}`,
|
|
75911
|
+
`claude plugin marketplace remove ${name3} ${QUIET}`
|
|
75858
75912
|
].join("; ");
|
|
75859
75913
|
return claudeScript({ context, script });
|
|
75860
75914
|
}
|
|
75915
|
+
async function dropOwnLeftover({ context, folder }) {
|
|
75916
|
+
if (pluginNameHere({ context }) === LAZE_PLUGIN) return;
|
|
75917
|
+
const known = await readFile16(
|
|
75918
|
+
join17(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
|
|
75919
|
+
"utf8"
|
|
75920
|
+
).then((text3) => JSON.parse(text3)).catch(() => void 0);
|
|
75921
|
+
if (known?.[LAZE_PLUGIN]?.source?.path !== folder) return;
|
|
75922
|
+
await unregisterAs({ context, name: LAZE_PLUGIN });
|
|
75923
|
+
}
|
|
75861
75924
|
var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
|
|
75862
75925
|
async function cachedPluginOf({ context }) {
|
|
75863
|
-
const
|
|
75864
|
-
const
|
|
75865
|
-
const claude = inherited.CLAUDE_CONFIG_DIR || join16(home, ".claude");
|
|
75866
|
-
const listed = await readFile16(join16(claude, "plugins", "installed_plugins.json"), "utf8").then(
|
|
75926
|
+
const path = join17(claudeDirOf({ context }), "plugins", "installed_plugins.json");
|
|
75927
|
+
const listed = await readFile16(path, "utf8").then(
|
|
75867
75928
|
(text3) => JSON.parse(text3),
|
|
75868
75929
|
() => void 0
|
|
75869
75930
|
);
|
|
75870
|
-
return listed?.plugins?.[
|
|
75931
|
+
return listed?.plugins?.[installedNameOf({ context })]?.[0]?.installPath;
|
|
75871
75932
|
}
|
|
75872
75933
|
async function refreshStaleCache({ context, folder }) {
|
|
75873
75934
|
const cached2 = await cachedPluginOf({ context });
|
|
75874
75935
|
if (!cached2) return true;
|
|
75875
75936
|
const read4 = (path) => readFile16(path, "utf8").catch(() => "");
|
|
75876
|
-
for (const
|
|
75877
|
-
const ours = await read4(
|
|
75878
|
-
if (ours === await read4(
|
|
75879
|
-
const plugin2 =
|
|
75937
|
+
for (const file4 of RUN_FILES) {
|
|
75938
|
+
const ours = await read4(join17(folder, LAZE_PLUGIN, file4));
|
|
75939
|
+
if (ours === await read4(join17(cached2, file4))) continue;
|
|
75940
|
+
const plugin2 = installedNameOf({ context });
|
|
75880
75941
|
const script = [
|
|
75881
75942
|
`claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
|
|
75882
75943
|
`claude plugin install ${plugin2} --scope user ${QUIET}`
|
|
@@ -75886,7 +75947,7 @@ async function refreshStaleCache({ context, folder }) {
|
|
|
75886
75947
|
return true;
|
|
75887
75948
|
}
|
|
75888
75949
|
function registeredMarkOf({ context }) {
|
|
75889
|
-
return
|
|
75950
|
+
return join17(pluginFolderOf({ context }), "registered");
|
|
75890
75951
|
}
|
|
75891
75952
|
async function pluginRegistered({ context }) {
|
|
75892
75953
|
return readFile16(registeredMarkOf({ context }), "utf8").then(
|
|
@@ -75896,6 +75957,7 @@ async function pluginRegistered({ context }) {
|
|
|
75896
75957
|
}
|
|
75897
75958
|
async function installLazePlugin({ context }) {
|
|
75898
75959
|
const folder = await writeLazePlugin({ context });
|
|
75960
|
+
await dropOwnLeftover({ context, folder });
|
|
75899
75961
|
const registered = await registerWithClaude({ context, folder }) && await refreshStaleCache({ context, folder });
|
|
75900
75962
|
if (registered) await writeFile13(registeredMarkOf({ context }), cliVersionOf());
|
|
75901
75963
|
return { folder, registered };
|
|
@@ -75903,25 +75965,36 @@ async function installLazePlugin({ context }) {
|
|
|
75903
75965
|
async function plugin({ context, args }) {
|
|
75904
75966
|
const action = args.words[1] ?? "install";
|
|
75905
75967
|
if (action === "path") {
|
|
75906
|
-
context.out(`${
|
|
75968
|
+
context.out(`${join17(pluginFolderOf({ context }), LAZE_PLUGIN)}
|
|
75907
75969
|
`);
|
|
75908
75970
|
return 0;
|
|
75909
75971
|
}
|
|
75972
|
+
if (action === "uninstall") {
|
|
75973
|
+
const name3 = pluginNameHere({ context });
|
|
75974
|
+
const removed = await unregisterAs({ context, name: name3 });
|
|
75975
|
+
await rm7(registeredMarkOf({ context }), { force: true });
|
|
75976
|
+
context.out(
|
|
75977
|
+
removed ? `Removed the Laze plugin ${name3}@${name3} from Claude Code.
|
|
75978
|
+
` : `Claude Code did not remove it; run: claude plugin uninstall ${name3}@${name3} && claude plugin marketplace remove ${name3}
|
|
75979
|
+
`
|
|
75980
|
+
);
|
|
75981
|
+
return removed ? 0 : 1;
|
|
75982
|
+
}
|
|
75910
75983
|
if (action !== "install") {
|
|
75911
|
-
context.err("Usage: laze plugin install | laze plugin path\n");
|
|
75984
|
+
context.err("Usage: laze plugin install | laze plugin uninstall | laze plugin path\n");
|
|
75912
75985
|
return 1;
|
|
75913
75986
|
}
|
|
75914
75987
|
const { folder, registered } = await installLazePlugin({ context });
|
|
75915
75988
|
context.out(
|
|
75916
75989
|
registered ? `Installed the Laze plugin from ${folder} in Claude Code. It starts with your next session or resume.
|
|
75917
|
-
` : `Wrote the Laze plugin to ${folder}. Claude Code did not take it; run: claude plugin marketplace add ${folder} && claude plugin install ${
|
|
75990
|
+
` : `Wrote the Laze plugin to ${folder}. Claude Code did not take it; run: claude plugin marketplace add ${folder} && claude plugin install ${installedNameOf({ context })}
|
|
75918
75991
|
`
|
|
75919
75992
|
);
|
|
75920
75993
|
return 0;
|
|
75921
75994
|
}
|
|
75922
75995
|
|
|
75923
75996
|
// src/services/mcp-channel.service.ts
|
|
75924
|
-
import { mkdir as mkdir15, rm as
|
|
75997
|
+
import { mkdir as mkdir15, rm as rm8, writeFile as writeFile14 } from "node:fs/promises";
|
|
75925
75998
|
import { dirname as dirname16 } from "node:path";
|
|
75926
75999
|
var LAZE_MCP_SERVER = "laze";
|
|
75927
76000
|
var DEV_CHANNELS_FLAG = "--dangerously-load-development-channels";
|
|
@@ -76042,7 +76115,7 @@ async function pushInbox({
|
|
|
76042
76115
|
`);
|
|
76043
76116
|
}
|
|
76044
76117
|
} finally {
|
|
76045
|
-
await
|
|
76118
|
+
await rm8(marker, { force: true });
|
|
76046
76119
|
}
|
|
76047
76120
|
}
|
|
76048
76121
|
|
|
@@ -76157,8 +76230,8 @@ async function installHooks({
|
|
|
76157
76230
|
directory,
|
|
76158
76231
|
profile
|
|
76159
76232
|
}) {
|
|
76160
|
-
const folder =
|
|
76161
|
-
const path =
|
|
76233
|
+
const folder = join18(directory, ".claude");
|
|
76234
|
+
const path = join18(folder, "settings.local.json");
|
|
76162
76235
|
const current3 = await readFile18(path, "utf8").then(
|
|
76163
76236
|
(text3) => JSON.parse(text3),
|
|
76164
76237
|
() => ({})
|
|
@@ -76478,7 +76551,7 @@ async function addSessionStartWaiter({ context, args }) {
|
|
|
76478
76551
|
const directory = context.environment.inherited.CLAUDE_PROJECT_DIR;
|
|
76479
76552
|
const profile = flagText({ args, name: "profile" });
|
|
76480
76553
|
if (!directory || !profile) return;
|
|
76481
|
-
const path =
|
|
76554
|
+
const path = join18(directory, ".claude", "settings.local.json");
|
|
76482
76555
|
const settings3 = await readFile18(path, "utf8").then(
|
|
76483
76556
|
(text3) => JSON.parse(text3),
|
|
76484
76557
|
() => void 0
|
|
@@ -76488,7 +76561,7 @@ async function addSessionStartWaiter({ context, args }) {
|
|
|
76488
76561
|
}
|
|
76489
76562
|
async function refreshPlugin({ context }) {
|
|
76490
76563
|
if (await pluginIsCurrent({ context })) return;
|
|
76491
|
-
const logPath =
|
|
76564
|
+
const logPath = join18(pluginFolderOf({ context }), "install.log");
|
|
76492
76565
|
context.processes.spawnDetached({ argv: [...context.program, "plugin", "install"], logPath });
|
|
76493
76566
|
}
|
|
76494
76567
|
async function stopHook({ context, args }) {
|
|
@@ -77364,10 +77437,10 @@ async function setAgentRunsOn({
|
|
|
77364
77437
|
|
|
77365
77438
|
// src/services/agent-migrate-commands.service.ts
|
|
77366
77439
|
import { readFile as readFile20, stat as stat7 } from "node:fs/promises";
|
|
77367
|
-
import { basename as basename5, join as
|
|
77440
|
+
import { basename as basename5, join as join19, resolve as resolve7 } from "node:path";
|
|
77368
77441
|
|
|
77369
77442
|
// src/rules/migration-upload.rules.ts
|
|
77370
|
-
import { createHash as
|
|
77443
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
77371
77444
|
function markersIn(text3) {
|
|
77372
77445
|
return text3.split(REDACTION_MARKER).length - 1;
|
|
77373
77446
|
}
|
|
@@ -77386,7 +77459,7 @@ async function redactTranscript({
|
|
|
77386
77459
|
return { text: redacted.text, redactions };
|
|
77387
77460
|
}
|
|
77388
77461
|
function sha256Of({ text: text3 }) {
|
|
77389
|
-
return
|
|
77462
|
+
return createHash4("sha256").update(text3, "utf8").digest("hex");
|
|
77390
77463
|
}
|
|
77391
77464
|
var bytesOf2 = (text3) => Buffer.byteLength(text3, "utf8");
|
|
77392
77465
|
function piecesOf({ line, maxBytes }) {
|
|
@@ -77572,9 +77645,9 @@ async function cancelMigration({ context, args }) {
|
|
|
77572
77645
|
async function chosenTranscriptOf({
|
|
77573
77646
|
context,
|
|
77574
77647
|
ticket,
|
|
77575
|
-
file:
|
|
77648
|
+
file: file4
|
|
77576
77649
|
}) {
|
|
77577
|
-
const path = resolve7(context.cwd,
|
|
77650
|
+
const path = resolve7(context.cwd, file4);
|
|
77578
77651
|
const sessionId = basename5(path).replace(/\.jsonl$/, "");
|
|
77579
77652
|
if (ticket.source !== "claude-code" || !SESSION_ID.test(sessionId)) {
|
|
77580
77653
|
throw new CliUsageError(
|
|
@@ -77588,8 +77661,8 @@ async function chosenTranscriptOf({
|
|
|
77588
77661
|
return { sessionId, path: found ? path : void 0, where: path };
|
|
77589
77662
|
}
|
|
77590
77663
|
async function transcriptOf({ context, args, ticket }) {
|
|
77591
|
-
const
|
|
77592
|
-
if (
|
|
77664
|
+
const file4 = flagText({ args, name: "transcript" });
|
|
77665
|
+
if (file4) return chosenTranscriptOf({ context, ticket, file: file4 });
|
|
77593
77666
|
const inherited = context.environment.inherited;
|
|
77594
77667
|
const own2 = ticket.source === "codex" ? inherited.CODEX_THREAD_ID : inherited.CLAUDE_CODE_SESSION_ID;
|
|
77595
77668
|
const sessionId = own2 || ticket.sessionId || "";
|
|
@@ -77601,7 +77674,7 @@ async function transcriptOf({ context, args, ticket }) {
|
|
|
77601
77674
|
if (ticket.source === "codex") {
|
|
77602
77675
|
const codexHome = context.environment.codexHome;
|
|
77603
77676
|
const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
|
|
77604
|
-
return { sessionId, path: path2, where:
|
|
77677
|
+
return { sessionId, path: path2, where: join19(codexHome, "sessions") };
|
|
77605
77678
|
}
|
|
77606
77679
|
const { root, path } = await claudeTranscriptOf({ context, sessionId });
|
|
77607
77680
|
return { sessionId, path, where: root };
|
|
@@ -77908,7 +77981,7 @@ async function requestAgent({ context, args }) {
|
|
|
77908
77981
|
|
|
77909
77982
|
// src/services/app-commands.service.ts
|
|
77910
77983
|
import { mkdir as mkdir18, readdir as readdir6, readFile as readFile22, writeFile as writeFile18 } from "node:fs/promises";
|
|
77911
|
-
import { dirname as dirname18, join as
|
|
77984
|
+
import { dirname as dirname18, join as join22, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
|
|
77912
77985
|
|
|
77913
77986
|
// ../../modules/app/contract/src/app.connections.ts
|
|
77914
77987
|
var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
|
|
@@ -79997,11 +80070,11 @@ function unknownCollectionsOf({
|
|
|
79997
80070
|
}) {
|
|
79998
80071
|
if (!collections) return [];
|
|
79999
80072
|
const known = Object.keys(collections);
|
|
80000
|
-
return files2.filter((
|
|
80001
|
-
(
|
|
80002
|
-
const line =
|
|
80073
|
+
return files2.filter((file4) => /\.(m?js|html)$/.test(file4.path)).flatMap(
|
|
80074
|
+
(file4) => [...file4.text.matchAll(RECORDS_CALL)].filter(([, , name3]) => !known.includes(name3 ?? "")).map((match) => {
|
|
80075
|
+
const line = file4.text.slice(0, match.index).split("\n").length;
|
|
80003
80076
|
const defines = known.length > 0 ? known.join(", ") : "none";
|
|
80004
|
-
return `${
|
|
80077
|
+
return `${file4.path}:${line.toString()}: Laze.records("${match[2] ?? ""}") names a collection laze.app.json does not define (it defines: ${defines})`;
|
|
80005
80078
|
})
|
|
80006
80079
|
);
|
|
80007
80080
|
}
|
|
@@ -80358,9 +80431,9 @@ async function appPinsCommand({
|
|
|
80358
80431
|
|
|
80359
80432
|
// src/services/app-script-check.service.ts
|
|
80360
80433
|
import { execFile } from "node:child_process";
|
|
80361
|
-
import { mkdtemp, rm as
|
|
80434
|
+
import { mkdtemp, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
|
|
80362
80435
|
import { tmpdir } from "node:os";
|
|
80363
|
-
import { join as
|
|
80436
|
+
import { join as join20 } from "node:path";
|
|
80364
80437
|
import { promisify } from "node:util";
|
|
80365
80438
|
var run2 = promisify(execFile);
|
|
80366
80439
|
var MODULE_SYNTAX = /^\s*(import|export)\s/m;
|
|
@@ -80389,31 +80462,31 @@ async function scriptErrorsOf({
|
|
|
80389
80462
|
const unknown2 = unknownCollectionsOf({ files: files2, collections });
|
|
80390
80463
|
const scripts = files2.flatMap(scriptsOf);
|
|
80391
80464
|
if (scripts.length === 0) return unknown2;
|
|
80392
|
-
const dir = await mkdtemp(
|
|
80465
|
+
const dir = await mkdtemp(join20(tmpdir(), "laze-app-check-"));
|
|
80393
80466
|
try {
|
|
80394
80467
|
const errors = await Promise.all(
|
|
80395
80468
|
scripts.map(async (script, index) => {
|
|
80396
|
-
const
|
|
80397
|
-
await writeFile17(
|
|
80469
|
+
const file4 = join20(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
|
|
80470
|
+
await writeFile17(file4, script.code);
|
|
80398
80471
|
try {
|
|
80399
|
-
await run2(process.execPath, ["--check",
|
|
80472
|
+
await run2(process.execPath, ["--check", file4]);
|
|
80400
80473
|
return null;
|
|
80401
80474
|
} catch (cause) {
|
|
80402
80475
|
const stderr2 = cause.stderr ?? "";
|
|
80403
|
-
return errorOf2({ script, stderr: stderr2.replaceAll(
|
|
80476
|
+
return errorOf2({ script, stderr: stderr2.replaceAll(file4, script.path) });
|
|
80404
80477
|
}
|
|
80405
80478
|
})
|
|
80406
80479
|
);
|
|
80407
80480
|
return [...errors.filter((error63) => error63 !== null), ...unknown2];
|
|
80408
80481
|
} finally {
|
|
80409
|
-
await
|
|
80482
|
+
await rm9(dir, { recursive: true, force: true });
|
|
80410
80483
|
}
|
|
80411
80484
|
}
|
|
80412
80485
|
|
|
80413
80486
|
// src/services/app-serve.service.ts
|
|
80414
80487
|
import { readFile as readFile21, stat as stat8 } from "node:fs/promises";
|
|
80415
80488
|
import { createServer } from "node:http";
|
|
80416
|
-
import { extname as extname2, join as
|
|
80489
|
+
import { extname as extname2, join as join21, normalize, sep as sep2 } from "node:path";
|
|
80417
80490
|
var TYPES2 = {
|
|
80418
80491
|
".html": "text/html; charset=utf-8",
|
|
80419
80492
|
".js": "text/javascript; charset=utf-8",
|
|
@@ -80464,8 +80537,8 @@ async function staticFile({
|
|
|
80464
80537
|
if (clean.startsWith("..") || hidden) {
|
|
80465
80538
|
return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
|
|
80466
80539
|
}
|
|
80467
|
-
const candidates = [
|
|
80468
|
-
if (!extname2(clean)) candidates.push(
|
|
80540
|
+
const candidates = [join21(folder, clean), join21(folder, clean, "index.html")];
|
|
80541
|
+
if (!extname2(clean)) candidates.push(join21(folder, "index.html"));
|
|
80469
80542
|
for (const target of candidates) {
|
|
80470
80543
|
const info = await stat8(target).catch(() => void 0);
|
|
80471
80544
|
if (!info?.isFile()) continue;
|
|
@@ -80556,16 +80629,16 @@ async function serveAppFolder({
|
|
|
80556
80629
|
(error63) => failed({ response, error: error63 })
|
|
80557
80630
|
);
|
|
80558
80631
|
});
|
|
80559
|
-
await new Promise((
|
|
80632
|
+
await new Promise((resolve25, reject) => {
|
|
80560
80633
|
server.once("error", reject);
|
|
80561
|
-
server.listen(port, "127.0.0.1", () =>
|
|
80634
|
+
server.listen(port, "127.0.0.1", () => resolve25());
|
|
80562
80635
|
});
|
|
80563
80636
|
const { port: bound } = server.address();
|
|
80564
80637
|
return {
|
|
80565
80638
|
url: `http://127.0.0.1:${bound}/`,
|
|
80566
|
-
close: () => new Promise((
|
|
80639
|
+
close: () => new Promise((resolve25) => {
|
|
80567
80640
|
server.closeAllConnections();
|
|
80568
|
-
server.close(() =>
|
|
80641
|
+
server.close(() => resolve25());
|
|
80569
80642
|
})
|
|
80570
80643
|
};
|
|
80571
80644
|
}
|
|
@@ -80733,7 +80806,7 @@ function folderOf({ context, word: word3 }) {
|
|
|
80733
80806
|
return resolve8(context.cwd, word3 ?? ".");
|
|
80734
80807
|
}
|
|
80735
80808
|
async function readManifest(folder) {
|
|
80736
|
-
const text3 = await readFile22(
|
|
80809
|
+
const text3 = await readFile22(join22(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
80737
80810
|
if (text3 === void 0) return void 0;
|
|
80738
80811
|
const parsed = appManifestSchema.safeParse(JSON.parse(text3));
|
|
80739
80812
|
if (!parsed.success) {
|
|
@@ -80781,7 +80854,7 @@ async function listFiles(folder) {
|
|
|
80781
80854
|
while (pending2.length > 0 && found.length <= MAX_FILES) {
|
|
80782
80855
|
const current3 = pending2.pop() ?? folder;
|
|
80783
80856
|
for (const entry of await readdir6(current3, { withFileTypes: true })) {
|
|
80784
|
-
const path =
|
|
80857
|
+
const path = join22(current3, entry.name);
|
|
80785
80858
|
const rel = relative3(folder, path).split(sep3).join("/");
|
|
80786
80859
|
if (isSkippedPath({ path: rel })) continue;
|
|
80787
80860
|
if (entry.isDirectory()) pending2.push(path);
|
|
@@ -80819,12 +80892,12 @@ var appCreate = async ({ context, args }) => {
|
|
|
80819
80892
|
const folder = resolve8(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
|
|
80820
80893
|
await mkdir18(folder, { recursive: true });
|
|
80821
80894
|
const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
|
|
80822
|
-
for (const
|
|
80823
|
-
const target =
|
|
80895
|
+
for (const file4 of start2?.files ?? []) {
|
|
80896
|
+
const target = join22(folder, ...file4.path.split("/"));
|
|
80824
80897
|
await mkdir18(dirname18(target), { recursive: true });
|
|
80825
80898
|
await writeFile18(
|
|
80826
80899
|
target,
|
|
80827
|
-
|
|
80900
|
+
file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
|
|
80828
80901
|
);
|
|
80829
80902
|
}
|
|
80830
80903
|
const manifest = {
|
|
@@ -80833,7 +80906,7 @@ var appCreate = async ({ context, args }) => {
|
|
|
80833
80906
|
views: [...start2?.template.views ?? []],
|
|
80834
80907
|
seed: { ...start2?.template.seed }
|
|
80835
80908
|
};
|
|
80836
|
-
await writeFile18(
|
|
80909
|
+
await writeFile18(join22(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
80837
80910
|
`);
|
|
80838
80911
|
const where = relative3(context.cwd, folder) || ".";
|
|
80839
80912
|
print5({
|
|
@@ -80909,7 +80982,7 @@ var appPush = async ({ context, args }) => {
|
|
|
80909
80982
|
})
|
|
80910
80983
|
)
|
|
80911
80984
|
);
|
|
80912
|
-
const bytes = files2.reduce((sum,
|
|
80985
|
+
const bytes = files2.reduce((sum, file4) => sum + file4.bytes, 0);
|
|
80913
80986
|
if (bytes > MAX_APP_BUILD_BYTES) {
|
|
80914
80987
|
context.err(
|
|
80915
80988
|
`laze: The folder is ${Math.ceil(bytes / 1024)} KB; one version holds at most ${MAX_APP_BUILD_BYTES / 1024 / 1024} MB (app_build_too_large)
|
|
@@ -80919,7 +80992,7 @@ var appPush = async ({ context, args }) => {
|
|
|
80919
80992
|
}
|
|
80920
80993
|
if (files2.length === 0) throw new CliUsageError(`No files to push in ${folder}`);
|
|
80921
80994
|
const scriptErrors = await scriptErrorsOf({
|
|
80922
|
-
files: files2.filter((
|
|
80995
|
+
files: files2.filter((file4) => file4.encoding === "utf8").map(({ path, content }) => ({ path, text: content })),
|
|
80923
80996
|
collections: manifest?.collections
|
|
80924
80997
|
});
|
|
80925
80998
|
if (scriptErrors.length > 0) {
|
|
@@ -80946,7 +81019,7 @@ var appPush = async ({ context, args }) => {
|
|
|
80946
81019
|
const pushed = await client.post("/api/apps/commit", {
|
|
80947
81020
|
appId,
|
|
80948
81021
|
message: message2,
|
|
80949
|
-
files: files2.map(({ bytes: _bytes, ...
|
|
81022
|
+
files: files2.map(({ bytes: _bytes, ...file4 }) => file4),
|
|
80950
81023
|
...manifest?.users ? { users: manifest.users } : {},
|
|
80951
81024
|
...manifest?.functions ? { functions: manifest.functions } : {}
|
|
80952
81025
|
});
|
|
@@ -80973,11 +81046,11 @@ var appWrite = async ({ context, args }) => {
|
|
|
80973
81046
|
const files2 = await Promise.all(
|
|
80974
81047
|
words.slice(2).map(async (word3) => {
|
|
80975
81048
|
const path = resolve8(context.cwd, word3);
|
|
80976
|
-
const { bytes: _bytes, ...
|
|
81049
|
+
const { bytes: _bytes, ...file4 } = buildFileOf({
|
|
80977
81050
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
80978
81051
|
bytes: await readFile22(path)
|
|
80979
81052
|
});
|
|
80980
|
-
return
|
|
81053
|
+
return file4;
|
|
80981
81054
|
})
|
|
80982
81055
|
);
|
|
80983
81056
|
if (files2.length + remove8.length === 0) {
|
|
@@ -81101,12 +81174,12 @@ var appPull = async ({ context, args }) => {
|
|
|
81101
81174
|
`${folder} already holds files that are not this app's; pull into an empty folder, or pass --force. Nothing was written.`
|
|
81102
81175
|
);
|
|
81103
81176
|
}
|
|
81104
|
-
for (const
|
|
81105
|
-
const target =
|
|
81177
|
+
for (const file4 of pulled.files) {
|
|
81178
|
+
const target = join22(folder, ...file4.path.split("/"));
|
|
81106
81179
|
await mkdir18(dirname18(target), { recursive: true });
|
|
81107
81180
|
await writeFile18(
|
|
81108
81181
|
target,
|
|
81109
|
-
|
|
81182
|
+
file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
|
|
81110
81183
|
);
|
|
81111
81184
|
}
|
|
81112
81185
|
const manifest = {
|
|
@@ -81121,7 +81194,7 @@ var appPull = async ({ context, args }) => {
|
|
|
81121
81194
|
])
|
|
81122
81195
|
)
|
|
81123
81196
|
};
|
|
81124
|
-
await writeFile18(
|
|
81197
|
+
await writeFile18(join22(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
81125
81198
|
`);
|
|
81126
81199
|
const names = pulled.collections.map((collection) => collection.name);
|
|
81127
81200
|
const where = relative3(context.cwd, folder) || ".";
|
|
@@ -81434,10 +81507,10 @@ var appExport = async ({ context, args }) => {
|
|
|
81434
81507
|
};
|
|
81435
81508
|
var appImport = async ({ context, args }) => {
|
|
81436
81509
|
const words = args.words.slice(2);
|
|
81437
|
-
const [named, collection,
|
|
81438
|
-
if (!collection || !
|
|
81439
|
-
const csv = await readFile22(resolve8(context.cwd,
|
|
81440
|
-
throw new CliUsageError(`Cannot read ${
|
|
81510
|
+
const [named, collection, file4] = words.length >= 3 ? words : [void 0, ...words];
|
|
81511
|
+
if (!collection || !file4) throw new CliUsageError(USAGE5);
|
|
81512
|
+
const csv = await readFile22(resolve8(context.cwd, file4), "utf8").catch(() => {
|
|
81513
|
+
throw new CliUsageError(`Cannot read ${file4}`);
|
|
81441
81514
|
});
|
|
81442
81515
|
const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
|
|
81443
81516
|
const client = await appClient({ context, args: scoped });
|
|
@@ -81850,11 +81923,11 @@ async function app({ context, args }) {
|
|
|
81850
81923
|
import { hostname as hostname6 } from "node:os";
|
|
81851
81924
|
|
|
81852
81925
|
// src/rules/machine-proof.rules.ts
|
|
81853
|
-
import { createHash as
|
|
81926
|
+
import { createHash as createHash5, randomBytes } from "node:crypto";
|
|
81854
81927
|
var b64url3 = (bytes) => Buffer.from(bytes).toString("base64url");
|
|
81855
81928
|
function thumbprintOf({ jwk }) {
|
|
81856
81929
|
const canonical = JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y });
|
|
81857
|
-
return b64url3(
|
|
81930
|
+
return b64url3(createHash5("sha256").update(canonical).digest());
|
|
81858
81931
|
}
|
|
81859
81932
|
function lazeTokenOf({ authorization }) {
|
|
81860
81933
|
const match = /^Bearer (lz_\S+)$/.exec(authorization ?? "");
|
|
@@ -81878,7 +81951,7 @@ function machineProofOf({
|
|
|
81878
81951
|
htu: url2,
|
|
81879
81952
|
iat: Math.floor(nowMs / 1e3),
|
|
81880
81953
|
jti,
|
|
81881
|
-
ath: b64url3(
|
|
81954
|
+
ath: b64url3(createHash5("sha256").update(credential).digest()),
|
|
81882
81955
|
lz_tier: tier,
|
|
81883
81956
|
...tailscaleNodeId ? { lz_ts: tailscaleNodeId } : {}
|
|
81884
81957
|
})
|
|
@@ -82296,12 +82369,12 @@ async function billing({ context, args }) {
|
|
|
82296
82369
|
// src/services/browser-commands.service.ts
|
|
82297
82370
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
82298
82371
|
import { mkdir as mkdir21, readFile as readFile24, writeFile as writeFile21 } from "node:fs/promises";
|
|
82299
|
-
import { dirname as dirname20, join as
|
|
82372
|
+
import { dirname as dirname20, join as join25 } from "node:path";
|
|
82300
82373
|
|
|
82301
82374
|
// src/services/browser-tab-commands.service.ts
|
|
82302
82375
|
import { mkdir as mkdir20, writeFile as writeFile20 } from "node:fs/promises";
|
|
82303
82376
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
82304
|
-
import { join as
|
|
82377
|
+
import { join as join24 } from "node:path";
|
|
82305
82378
|
|
|
82306
82379
|
// src/rules/browser-login.rules.ts
|
|
82307
82380
|
var PASSWORD_NAME = /pass|pwd/i;
|
|
@@ -82331,10 +82404,10 @@ function loginValuesOf({
|
|
|
82331
82404
|
}
|
|
82332
82405
|
|
|
82333
82406
|
// src/services/vault-commands.service.ts
|
|
82334
|
-
import { createHash as
|
|
82335
|
-
import { mkdir as mkdir19, readFile as readFile23, rm as
|
|
82407
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
82408
|
+
import { mkdir as mkdir19, readFile as readFile23, rm as rm10, writeFile as writeFile19 } from "node:fs/promises";
|
|
82336
82409
|
import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
|
|
82337
|
-
import { dirname as dirname19, join as
|
|
82410
|
+
import { dirname as dirname19, join as join23 } from "node:path";
|
|
82338
82411
|
|
|
82339
82412
|
// src/rules/vault-session.rules.ts
|
|
82340
82413
|
function vaultSessionOf({
|
|
@@ -82409,9 +82482,9 @@ function runKeyPathOf({
|
|
|
82409
82482
|
connection,
|
|
82410
82483
|
profile = ""
|
|
82411
82484
|
}) {
|
|
82412
|
-
const name3 =
|
|
82413
|
-
const base = turnFile ? dirname19(turnFile) :
|
|
82414
|
-
return
|
|
82485
|
+
const name3 = createHash6("sha256").update(connection).digest("hex");
|
|
82486
|
+
const base = turnFile ? dirname19(turnFile) : join23(tmpdir2(), "laze-vault", profile);
|
|
82487
|
+
return join23(base, "vault-run-keys", `${name3}.json`);
|
|
82415
82488
|
}
|
|
82416
82489
|
async function runKeyAt({ path }) {
|
|
82417
82490
|
const saved3 = await readFile23(path, "utf8").then(
|
|
@@ -82589,13 +82662,13 @@ async function settled({
|
|
|
82589
82662
|
}) {
|
|
82590
82663
|
if (release2 === "capped") return { exitCode: 75 };
|
|
82591
82664
|
if (release2.outcome === "deny") {
|
|
82592
|
-
await
|
|
82665
|
+
await rm10(keyPath, { force: true });
|
|
82593
82666
|
context.err(`${release2.message}
|
|
82594
82667
|
`);
|
|
82595
82668
|
return { exitCode: release2.exitCode || 1 };
|
|
82596
82669
|
}
|
|
82597
82670
|
const values = await envOf({ release: release2, run: run4 });
|
|
82598
|
-
if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await
|
|
82671
|
+
if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm10(keyPath, { force: true });
|
|
82599
82672
|
if (release2.message) context.err(`${release2.message}
|
|
82600
82673
|
`);
|
|
82601
82674
|
return { env: values };
|
|
@@ -82940,9 +83013,9 @@ async function savedScreenshot({
|
|
|
82940
83013
|
data,
|
|
82941
83014
|
nowMs
|
|
82942
83015
|
}) {
|
|
82943
|
-
const folder =
|
|
83016
|
+
const folder = join24(tmpdir3(), "laze-browser");
|
|
82944
83017
|
await mkdir20(folder, { recursive: true, mode: 448 });
|
|
82945
|
-
const path =
|
|
83018
|
+
const path = join24(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
|
|
82946
83019
|
await writeFile20(path, Buffer.from(data, "base64"), { mode: 384 });
|
|
82947
83020
|
return path;
|
|
82948
83021
|
}
|
|
@@ -83030,7 +83103,7 @@ function tunnel({
|
|
|
83030
83103
|
host: host2,
|
|
83031
83104
|
port
|
|
83032
83105
|
}) {
|
|
83033
|
-
return new Promise((
|
|
83106
|
+
return new Promise((resolve25, reject) => {
|
|
83034
83107
|
const socket = connectTcp(proxy.port, proxy.host);
|
|
83035
83108
|
let answer6 = "";
|
|
83036
83109
|
const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
|
|
@@ -83047,7 +83120,7 @@ ${auth}\r
|
|
|
83047
83120
|
answer6 += chunk.toString("latin1");
|
|
83048
83121
|
if (!answer6.includes(HEADER_END)) return;
|
|
83049
83122
|
socket.off("data", onData);
|
|
83050
|
-
if (/^HTTP\/1\.[01] 200/.test(answer6)) return
|
|
83123
|
+
if (/^HTTP\/1\.[01] 200/.test(answer6)) return resolve25(socket);
|
|
83051
83124
|
socket.destroy();
|
|
83052
83125
|
reject(new Error(`proxy refused the tunnel: ${answer6.split("\r\n")[0] ?? ""}`));
|
|
83053
83126
|
};
|
|
@@ -83060,8 +83133,8 @@ async function upstreamOf({ target, proxy }) {
|
|
|
83060
83133
|
const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
|
|
83061
83134
|
if (!secure) return raw;
|
|
83062
83135
|
const tls = connectTls({ socket: raw, servername: target.hostname });
|
|
83063
|
-
await new Promise((
|
|
83064
|
-
tls.once("secureConnect", () =>
|
|
83136
|
+
await new Promise((resolve25, reject) => {
|
|
83137
|
+
tls.once("secureConnect", () => resolve25());
|
|
83065
83138
|
tls.once("error", reject);
|
|
83066
83139
|
});
|
|
83067
83140
|
return tls;
|
|
@@ -83103,8 +83176,8 @@ async function browserSocket({
|
|
|
83103
83176
|
createConnection: () => upstream,
|
|
83104
83177
|
perMessageDeflate: false
|
|
83105
83178
|
});
|
|
83106
|
-
await new Promise((
|
|
83107
|
-
socket.once("open", () =>
|
|
83179
|
+
await new Promise((resolve25, reject) => {
|
|
83180
|
+
socket.once("open", () => resolve25());
|
|
83108
83181
|
socket.once("error", reject);
|
|
83109
83182
|
});
|
|
83110
83183
|
return socket;
|
|
@@ -83117,12 +83190,12 @@ async function browserCall({
|
|
|
83117
83190
|
}) {
|
|
83118
83191
|
const socket = await browserSocket({ target, proxy });
|
|
83119
83192
|
try {
|
|
83120
|
-
return await new Promise((
|
|
83193
|
+
return await new Promise((resolve25, reject) => {
|
|
83121
83194
|
socket.on("message", (data) => {
|
|
83122
83195
|
const reply2 = JSON.parse(textOf3(data));
|
|
83123
83196
|
if (reply2.id !== 1) return;
|
|
83124
83197
|
if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
|
|
83125
|
-
else
|
|
83198
|
+
else resolve25(reply2.result ?? {});
|
|
83126
83199
|
});
|
|
83127
83200
|
socket.once(
|
|
83128
83201
|
"close",
|
|
@@ -83286,18 +83359,18 @@ function retargetCdpBridge({
|
|
|
83286
83359
|
target,
|
|
83287
83360
|
expiresAt
|
|
83288
83361
|
}) {
|
|
83289
|
-
return new Promise((
|
|
83362
|
+
return new Promise((resolve25) => {
|
|
83290
83363
|
const call = httpRequest(
|
|
83291
83364
|
{ host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
|
|
83292
83365
|
(response) => {
|
|
83293
83366
|
response.resume();
|
|
83294
|
-
|
|
83367
|
+
resolve25(response.statusCode === 204);
|
|
83295
83368
|
}
|
|
83296
83369
|
);
|
|
83297
83370
|
call.setHeader(KEY_HEADER, key);
|
|
83298
83371
|
call.setHeader("content-type", "application/json");
|
|
83299
83372
|
call.once("timeout", () => call.destroy());
|
|
83300
|
-
call.once("error", () =>
|
|
83373
|
+
call.once("error", () => resolve25(false));
|
|
83301
83374
|
call.end(JSON.stringify({ target, expiresAt }));
|
|
83302
83375
|
});
|
|
83303
83376
|
}
|
|
@@ -83346,15 +83419,15 @@ async function startCdpBridge({
|
|
|
83346
83419
|
(socket) => relayPage({ client: socket, targetId, target: url2, proxy })
|
|
83347
83420
|
);
|
|
83348
83421
|
});
|
|
83349
|
-
await new Promise((
|
|
83422
|
+
await new Promise((resolve25) => server.listen(0, "127.0.0.1", resolve25));
|
|
83350
83423
|
const port = server.address().port;
|
|
83351
83424
|
return {
|
|
83352
83425
|
port,
|
|
83353
|
-
close: () => new Promise((
|
|
83426
|
+
close: () => new Promise((resolve25) => {
|
|
83354
83427
|
for (const client of relayed) client.destroy();
|
|
83355
83428
|
pages.close();
|
|
83356
83429
|
server.closeAllConnections();
|
|
83357
|
-
server.close(() =>
|
|
83430
|
+
server.close(() => resolve25());
|
|
83358
83431
|
})
|
|
83359
83432
|
};
|
|
83360
83433
|
}
|
|
@@ -83371,7 +83444,7 @@ function launchCdpBridge({
|
|
|
83371
83444
|
stdio: ["ignore", "pipe", "ignore"],
|
|
83372
83445
|
env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
|
|
83373
83446
|
});
|
|
83374
|
-
return new Promise((
|
|
83447
|
+
return new Promise((resolve25, reject) => {
|
|
83375
83448
|
let printed2 = "";
|
|
83376
83449
|
child.once("error", reject);
|
|
83377
83450
|
child.once("exit", (code) => reject(new Error(`the CDP bridge stopped (${code})`)));
|
|
@@ -83382,7 +83455,7 @@ function launchCdpBridge({
|
|
|
83382
83455
|
child.stdout.destroy();
|
|
83383
83456
|
child.removeAllListeners("exit");
|
|
83384
83457
|
child.unref();
|
|
83385
|
-
if (Number.isInteger(port) && port > 0)
|
|
83458
|
+
if (Number.isInteger(port) && port > 0) resolve25(port);
|
|
83386
83459
|
else reject(new Error("the CDP bridge printed no port"));
|
|
83387
83460
|
});
|
|
83388
83461
|
});
|
|
@@ -83509,7 +83582,7 @@ async function answering({
|
|
|
83509
83582
|
}
|
|
83510
83583
|
function bridgeStatePath({ context, machine: machine2 }) {
|
|
83511
83584
|
const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
83512
|
-
return
|
|
83585
|
+
return join25(dirname20(context.environment.configPath), "bridges", `${safe}.json`);
|
|
83513
83586
|
}
|
|
83514
83587
|
async function bridgePort({
|
|
83515
83588
|
context,
|
|
@@ -84232,7 +84305,7 @@ import { basename as basename7, isAbsolute as isAbsolute2, relative as relative4
|
|
|
84232
84305
|
|
|
84233
84306
|
// src/services/file-download.service.ts
|
|
84234
84307
|
import { createWriteStream } from "node:fs";
|
|
84235
|
-
import { mkdir as mkdir22, rename as rename5, rm as
|
|
84308
|
+
import { mkdir as mkdir22, rename as rename5, rm as rm11, stat as stat9, truncate } from "node:fs/promises";
|
|
84236
84309
|
import { basename as basename6, dirname as dirname21, resolve as resolve9 } from "node:path";
|
|
84237
84310
|
import { Readable, Transform } from "node:stream";
|
|
84238
84311
|
import { pipeline } from "node:stream/promises";
|
|
@@ -84357,7 +84430,7 @@ async function downloadFile({
|
|
|
84357
84430
|
await mkdir22(dirname21(part), { recursive: true });
|
|
84358
84431
|
const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
|
|
84359
84432
|
async (error63) => {
|
|
84360
|
-
await
|
|
84433
|
+
await rm11(part, { force: true });
|
|
84361
84434
|
if (!isDiskError(error63)) throw error63;
|
|
84362
84435
|
throw new CliUsageError(`Could not write ${attachmentId} to disk: ${String(error63)}`);
|
|
84363
84436
|
}
|
|
@@ -84809,7 +84882,7 @@ async function chatActions({
|
|
|
84809
84882
|
}
|
|
84810
84883
|
|
|
84811
84884
|
// src/services/claude-monitor.service.ts
|
|
84812
|
-
import { readFile as readFile26, rm as
|
|
84885
|
+
import { readFile as readFile26, rm as rm12 } from "node:fs/promises";
|
|
84813
84886
|
var MONITOR_IDLE_MS = 3e4;
|
|
84814
84887
|
var MONITOR_OUTRANKED_MS = 3e3;
|
|
84815
84888
|
async function deliverOnce({
|
|
@@ -84877,7 +84950,7 @@ async function monitorRound(turn) {
|
|
|
84877
84950
|
async function release({ context, profile }) {
|
|
84878
84951
|
const lock = statePathOf({ context, kind: "waiters", profile });
|
|
84879
84952
|
if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
|
|
84880
|
-
await
|
|
84953
|
+
await rm12(lock, { force: true });
|
|
84881
84954
|
}
|
|
84882
84955
|
async function monitorHook({ context, args }) {
|
|
84883
84956
|
const claudePid = await claudePidOf({ context });
|
|
@@ -86111,6 +86184,8 @@ var WHATSAPP_LEASE_DEFAULT_SECONDS = 172800;
|
|
|
86111
86184
|
var whatsappLeaseSecondsSchema = external_exports.number().int().refine((seconds) => WHATSAPP_LEASE_CHOICES.includes(seconds), {
|
|
86112
86185
|
message: "A lease is 1 hour, 1 day or 2 days"
|
|
86113
86186
|
});
|
|
86187
|
+
var WHATSAPP_AGENT_ACCESS = ["ask", "read", "read_send", "read_only", "off"];
|
|
86188
|
+
var whatsappAgentAccessLevelSchema = external_exports.enum(WHATSAPP_AGENT_ACCESS);
|
|
86114
86189
|
var agentAccessDefinition = external_exports.object({
|
|
86115
86190
|
agentId: external_exports.string(),
|
|
86116
86191
|
name: external_exports.string(),
|
|
@@ -86122,11 +86197,23 @@ var agentAccessDefinition = external_exports.object({
|
|
|
86122
86197
|
leaseSeconds: external_exports.number().int().positive().default(WHATSAPP_LEASE_DEFAULT_SECONDS),
|
|
86123
86198
|
/** Until when a lease lets the agent read, or send, with no card; null when none runs. */
|
|
86124
86199
|
readLeaseUntil: external_exports.iso.datetime().nullable().default(null),
|
|
86125
|
-
sendLeaseUntil: external_exports.iso.datetime().nullable().default(null)
|
|
86200
|
+
sendLeaseUntil: external_exports.iso.datetime().nullable().default(null),
|
|
86201
|
+
/** The owner set this agent's own level; false while it follows "Every agent". */
|
|
86202
|
+
overridden: external_exports.boolean().default(false)
|
|
86203
|
+
});
|
|
86204
|
+
var everyAgentDefinition = external_exports.object({
|
|
86205
|
+
/** The level every agent without its own follows; an agent shared with others asks to read. */
|
|
86206
|
+
access: whatsappAgentAccessLevelSchema,
|
|
86207
|
+
/** What "Allow for" lasts on every agent's cards. */
|
|
86208
|
+
leaseSeconds: external_exports.number().int().positive()
|
|
86126
86209
|
});
|
|
86127
86210
|
var agentsDefinition = external_exports.object({
|
|
86128
86211
|
machineId: external_exports.string(),
|
|
86129
|
-
agents: external_exports.array(agentAccessDefinition)
|
|
86212
|
+
agents: external_exports.array(agentAccessDefinition),
|
|
86213
|
+
everyAgent: everyAgentDefinition.default({
|
|
86214
|
+
access: "read",
|
|
86215
|
+
leaseSeconds: WHATSAPP_LEASE_DEFAULT_SECONDS
|
|
86216
|
+
})
|
|
86130
86217
|
});
|
|
86131
86218
|
var whatsappAgentsSchema = agentsDefinition;
|
|
86132
86219
|
var setAgentDefinition = external_exports.object({
|
|
@@ -86146,6 +86233,25 @@ var setLeaseDefinition = external_exports.object({
|
|
|
86146
86233
|
leaseSeconds: whatsappLeaseSecondsSchema
|
|
86147
86234
|
});
|
|
86148
86235
|
var setWhatsappAgentLeaseInputSchema = setLeaseDefinition;
|
|
86236
|
+
var setEveryAgentDefinition = external_exports.object({
|
|
86237
|
+
workspaceId: external_exports.string().min(1).max(64),
|
|
86238
|
+
machine: external_exports.string().min(1).max(64),
|
|
86239
|
+
access: whatsappAgentAccessLevelSchema.optional(),
|
|
86240
|
+
leaseSeconds: whatsappLeaseSecondsSchema.optional(),
|
|
86241
|
+
/** The vault's one-use proof, needed when the level moves towards Allow. */
|
|
86242
|
+
reauthToken: external_exports.string().min(1).max(200).optional()
|
|
86243
|
+
});
|
|
86244
|
+
var setWhatsappEveryAgentInputSchema = setEveryAgentDefinition;
|
|
86245
|
+
var WHATSAPP_EVERY_AGENT = "every_agent";
|
|
86246
|
+
var setAgentAccessDefinition = external_exports.object({
|
|
86247
|
+
workspaceId: external_exports.string().min(1).max(64),
|
|
86248
|
+
machine: external_exports.string().min(1).max(64),
|
|
86249
|
+
agentId: external_exports.string().min(1).max(64),
|
|
86250
|
+
access: external_exports.union([whatsappAgentAccessLevelSchema, external_exports.literal(WHATSAPP_EVERY_AGENT)]),
|
|
86251
|
+
/** The vault's one-use proof, needed when Read or Send moves towards Allow. */
|
|
86252
|
+
reauthToken: external_exports.string().min(1).max(200).optional()
|
|
86253
|
+
});
|
|
86254
|
+
var setWhatsappAgentAccessInputSchema = setAgentAccessDefinition;
|
|
86149
86255
|
|
|
86150
86256
|
// ../../modules/compute/contract/src/own-machine-whatsapp.ts
|
|
86151
86257
|
var workspaceIdSchema20 = external_exports.string().min(1).max(64);
|
|
@@ -86166,12 +86272,29 @@ var whatsappChatDefinition = external_exports.object({
|
|
|
86166
86272
|
lastMessageAt: external_exports.string().nullable().default(null),
|
|
86167
86273
|
lastMessage: external_exports.string().max(500).default("")
|
|
86168
86274
|
});
|
|
86275
|
+
var whatsappChangeMediaDefinition = external_exports.object({
|
|
86276
|
+
kind: external_exports.enum(["voice", "audio", "image", "video", "document", "sticker"]),
|
|
86277
|
+
mime: external_exports.string().max(200),
|
|
86278
|
+
size: external_exports.number().int().positive(),
|
|
86279
|
+
seconds: external_exports.number().int().nonnegative().optional(),
|
|
86280
|
+
name: external_exports.string().max(500).optional(),
|
|
86281
|
+
/** How the last fetch ended; absent while one is due, and from older connectors. */
|
|
86282
|
+
state: external_exports.enum(["done", "gone", "too_large"]).optional(),
|
|
86283
|
+
/** The Laze file the mirrored message carries, once confirmed; only between connector and api. */
|
|
86284
|
+
fileId: external_exports.string().max(200).optional()
|
|
86285
|
+
});
|
|
86169
86286
|
var whatsappMessageDefinition = external_exports.object({
|
|
86170
86287
|
id: external_exports.string().max(200),
|
|
86171
86288
|
at: external_exports.string(),
|
|
86172
86289
|
fromMe: external_exports.boolean(),
|
|
86173
86290
|
sender: external_exports.string().max(500),
|
|
86174
|
-
text: external_exports.string()
|
|
86291
|
+
text: external_exports.string(),
|
|
86292
|
+
/** The message's file; `laze whatsapp file` fetches it. Absent from older connectors. */
|
|
86293
|
+
media: external_exports.object({
|
|
86294
|
+
...whatsappChangeMediaDefinition.shape,
|
|
86295
|
+
/** A voice or audio message's words, once Laze transcribed the mirrored copy. */
|
|
86296
|
+
transcript: external_exports.string().optional()
|
|
86297
|
+
}).optional()
|
|
86175
86298
|
});
|
|
86176
86299
|
var chatsResultDefinition = external_exports.object({
|
|
86177
86300
|
machine: external_exports.string(),
|
|
@@ -86203,6 +86326,28 @@ var readInputDefinition = external_exports.object({
|
|
|
86203
86326
|
limit: limitSchema.optional(),
|
|
86204
86327
|
...readAskFields
|
|
86205
86328
|
});
|
|
86329
|
+
var fileInputDefinition = external_exports.object({
|
|
86330
|
+
workspaceId: workspaceIdSchema20,
|
|
86331
|
+
machine: whatsappMachineRef,
|
|
86332
|
+
/** The chat as a read names it: its id, a phone number or the exact contact or group name. */
|
|
86333
|
+
chat: chatRefSchema,
|
|
86334
|
+
/** The message id a read showed. */
|
|
86335
|
+
id: external_exports.string().trim().min(1).max(200),
|
|
86336
|
+
...readAskFields
|
|
86337
|
+
});
|
|
86338
|
+
var whatsappFileDefinition = external_exports.object({
|
|
86339
|
+
machine: external_exports.string(),
|
|
86340
|
+
chat: external_exports.string().max(200),
|
|
86341
|
+
id: external_exports.string().max(200),
|
|
86342
|
+
kind: whatsappChangeMediaDefinition.shape.kind,
|
|
86343
|
+
fileName: external_exports.string().max(500),
|
|
86344
|
+
contentType: external_exports.string().max(200),
|
|
86345
|
+
sizeBytes: external_exports.number().int().nonnegative(),
|
|
86346
|
+
url: external_exports.string(),
|
|
86347
|
+
expiresAt: external_exports.string(),
|
|
86348
|
+
/** A voice or audio message's words, once Laze transcribed the mirrored copy. */
|
|
86349
|
+
transcript: external_exports.string().optional()
|
|
86350
|
+
});
|
|
86206
86351
|
var sendInputDefinition = external_exports.object({
|
|
86207
86352
|
workspaceId: workspaceIdSchema20,
|
|
86208
86353
|
machine: whatsappMachineRef,
|
|
@@ -86304,13 +86449,6 @@ var whatsappComputerDefinition = external_exports.object({
|
|
|
86304
86449
|
var whatsappComputerSchema = whatsappComputerDefinition;
|
|
86305
86450
|
var whatsappComputerInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20 });
|
|
86306
86451
|
var whatsappComputerInputSchema = whatsappComputerInputDefinition;
|
|
86307
|
-
var whatsappChangeMediaDefinition = external_exports.object({
|
|
86308
|
-
kind: external_exports.enum(["voice", "audio", "image", "video", "document", "sticker"]),
|
|
86309
|
-
mime: external_exports.string().max(200),
|
|
86310
|
-
size: external_exports.number().int().positive(),
|
|
86311
|
-
seconds: external_exports.number().int().nonnegative().optional(),
|
|
86312
|
-
name: external_exports.string().max(500).optional()
|
|
86313
|
-
});
|
|
86314
86452
|
var whatsappChangeDefinition = external_exports.object({
|
|
86315
86453
|
chat: external_exports.string().min(1).max(200),
|
|
86316
86454
|
chatName: external_exports.string().max(500),
|
|
@@ -86326,6 +86464,13 @@ var whatsappChangeDefinition = external_exports.object({
|
|
|
86326
86464
|
/** The chat's other ids, such as the hidden id it was first seen under; new in Nov 2026. */
|
|
86327
86465
|
aliases: external_exports.array(external_exports.string().min(1).max(200)).max(16).optional()
|
|
86328
86466
|
});
|
|
86467
|
+
var whatsappReadDefinition = external_exports.object({
|
|
86468
|
+
chat: external_exports.string().min(1).max(200),
|
|
86469
|
+
at: external_exports.iso.datetime(),
|
|
86470
|
+
unread: external_exports.number().int().positive().max(1e6).optional(),
|
|
86471
|
+
/** The chat's other ids, such as the hidden id it was first seen under. */
|
|
86472
|
+
aliases: external_exports.array(external_exports.string().min(1).max(200)).max(16).optional()
|
|
86473
|
+
});
|
|
86329
86474
|
var whatsappPairingSchema = whatsappPairingDefinition;
|
|
86330
86475
|
var pairingRefDefinition = external_exports.object({
|
|
86331
86476
|
workspaceId: workspaceIdSchema20,
|
|
@@ -86335,11 +86480,13 @@ var whatsappPairingRefSchema = pairingRefDefinition;
|
|
|
86335
86480
|
var restPairingRefDefinition = external_exports.object({ pairingId: external_exports.string().min(1).max(64) });
|
|
86336
86481
|
var restChatsDefinition = chatsInputDefinition.omit({ workspaceId: true });
|
|
86337
86482
|
var restReadDefinition = readInputDefinition.omit({ workspaceId: true });
|
|
86483
|
+
var restFileDefinition = fileInputDefinition.omit({ workspaceId: true });
|
|
86338
86484
|
var restSendDefinition = sendInputDefinition.omit({ workspaceId: true });
|
|
86339
86485
|
var restSendStatusDefinition = sendStatusInputDefinition.omit({ workspaceId: true });
|
|
86340
86486
|
var COMPUTE_WHATSAPP_REST_PATHS = {
|
|
86341
86487
|
chats: "/api/compute/whatsapp/chats",
|
|
86342
86488
|
read: "/api/compute/whatsapp/read",
|
|
86489
|
+
file: "/api/compute/whatsapp/file",
|
|
86343
86490
|
send: "/api/compute/whatsapp/send",
|
|
86344
86491
|
sendStatus: "/api/compute/whatsapp/send-status",
|
|
86345
86492
|
unpair: "/api/compute/whatsapp/unpair"
|
|
@@ -86612,6 +86759,22 @@ var openScreenDefinition = external_exports.object({
|
|
|
86612
86759
|
site: external_exports.string().min(1).max(500).optional()
|
|
86613
86760
|
});
|
|
86614
86761
|
var openScreenInputSchema = openScreenDefinition;
|
|
86762
|
+
var loginTerminalHarnessSchema = external_exports.enum(["claude-code", "codex"]);
|
|
86763
|
+
var openLoginTerminalDefinition = external_exports.object({
|
|
86764
|
+
workspaceId: workspaceIdSchema22,
|
|
86765
|
+
harness: loginTerminalHarnessSchema
|
|
86766
|
+
});
|
|
86767
|
+
var openLoginTerminalInputSchema = openLoginTerminalDefinition;
|
|
86768
|
+
var loginTerminalDefinition = external_exports.discriminatedUnion("status", [
|
|
86769
|
+
external_exports.object({ status: external_exports.literal("starting"), retryAfterSeconds: external_exports.number().int().positive() }),
|
|
86770
|
+
external_exports.object({
|
|
86771
|
+
status: external_exports.literal("ready"),
|
|
86772
|
+
/** The WebSocket path of the terminal, token included; add `cols` and `rows`. */
|
|
86773
|
+
streamPath: external_exports.string(),
|
|
86774
|
+
expiresAt: external_exports.iso.datetime()
|
|
86775
|
+
})
|
|
86776
|
+
]);
|
|
86777
|
+
var loginTerminalSchema = loginTerminalDefinition;
|
|
86615
86778
|
var screenRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, sessionId: idSchema23 });
|
|
86616
86779
|
var screenRefSchema = screenRefDefinition;
|
|
86617
86780
|
var screenSessionDefinition = external_exports.object({
|
|
@@ -86652,8 +86815,8 @@ var ownMachineSshConnectDefinition = external_exports.object({
|
|
|
86652
86815
|
var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
86653
86816
|
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, machineId: idSchema23 });
|
|
86654
86817
|
var ComputeApi = moduleApi()("compute");
|
|
86655
|
-
var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
|
|
86656
|
-
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentLease").withInput(setWhatsappAgentLeaseInputSchema).withOutput(whatsappAgentsSchema).build();
|
|
86818
|
+
var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("openLoginTerminal").withInput(openLoginTerminalInputSchema).withOutput(loginTerminalSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
|
|
86819
|
+
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentLease").withInput(setWhatsappAgentLeaseInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappEveryAgent").withInput(setWhatsappEveryAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentAccess").withInput(setWhatsappAgentAccessInputSchema).withOutput(whatsappAgentsSchema).build();
|
|
86657
86820
|
var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
|
|
86658
86821
|
var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
|
|
86659
86822
|
var restRenameInputDefinition = external_exports.object({
|
|
@@ -86724,6 +86887,7 @@ var computeUi = uiTokens("compute");
|
|
|
86724
86887
|
var ComputeWhatsappMessagingSlot = computeUi.component("whatsapp-messaging");
|
|
86725
86888
|
var ComputeBrowserTabSlot = computeUi.component("browser-tab");
|
|
86726
86889
|
var ComputeOpenBrowserSlot = computeUi.component("open-browser");
|
|
86890
|
+
var ComputeLoginTerminalSlot = computeUi.component("login-terminal");
|
|
86727
86891
|
|
|
86728
86892
|
// ../../modules/compute/contract/src/computer-copy.ts
|
|
86729
86893
|
var COMPUTER_COPY_MAX_BYTES = 2 * 1024 * 1024 * 1024;
|
|
@@ -86812,7 +86976,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
|
|
|
86812
86976
|
});
|
|
86813
86977
|
|
|
86814
86978
|
// src/services/computer-copy-commands.service.ts
|
|
86815
|
-
import { mkdtemp as mkdtemp2, open as open4, rm as
|
|
86979
|
+
import { mkdtemp as mkdtemp2, open as open4, rm as rm13, stat as stat10 } from "node:fs/promises";
|
|
86816
86980
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
86817
86981
|
import { basename as basename8, dirname as dirname22, resolve as resolve11 } from "node:path";
|
|
86818
86982
|
var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
|
|
@@ -86839,12 +87003,12 @@ async function sendParts2({
|
|
|
86839
87003
|
}) {
|
|
86840
87004
|
const { upload } = started;
|
|
86841
87005
|
const parts = [];
|
|
86842
|
-
const
|
|
87006
|
+
const file4 = await open4(archive2, "r");
|
|
86843
87007
|
try {
|
|
86844
87008
|
for (const part of upload.parts) {
|
|
86845
87009
|
const length = part.end - part.start;
|
|
86846
87010
|
const bytes = Buffer.alloc(length);
|
|
86847
|
-
await
|
|
87011
|
+
await file4.read(bytes, 0, length, part.start);
|
|
86848
87012
|
const single = upload.mode === "single";
|
|
86849
87013
|
const response = await context.fetcher(part.url, {
|
|
86850
87014
|
method: "PUT",
|
|
@@ -86864,7 +87028,7 @@ async function sendParts2({
|
|
|
86864
87028
|
`);
|
|
86865
87029
|
}
|
|
86866
87030
|
} finally {
|
|
86867
|
-
await
|
|
87031
|
+
await file4.close();
|
|
86868
87032
|
}
|
|
86869
87033
|
return upload.mode === "multipart" ? parts : [];
|
|
86870
87034
|
}
|
|
@@ -86913,7 +87077,7 @@ It lands before ${done.agentName}'s next turn.
|
|
|
86913
87077
|
`
|
|
86914
87078
|
);
|
|
86915
87079
|
} finally {
|
|
86916
|
-
await
|
|
87080
|
+
await rm13(dir, { recursive: true, force: true });
|
|
86917
87081
|
}
|
|
86918
87082
|
}
|
|
86919
87083
|
|
|
@@ -87339,8 +87503,8 @@ async function turnOf({ context }) {
|
|
|
87339
87503
|
const env = context.environment.inherited;
|
|
87340
87504
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
87341
87505
|
if (pinned) return pinned;
|
|
87342
|
-
const
|
|
87343
|
-
const turn =
|
|
87506
|
+
const file4 = env.LAZE_TURN_FILE;
|
|
87507
|
+
const turn = file4 ? await readFile28(file4, "utf8").then(
|
|
87344
87508
|
(text3) => text3.trim(),
|
|
87345
87509
|
() => ""
|
|
87346
87510
|
) : "";
|
|
@@ -87819,8 +87983,8 @@ async function secretText({ context, args }) {
|
|
|
87819
87983
|
"A secret never goes in a flag (shell history keeps it): pipe it on stdin or use --from-file."
|
|
87820
87984
|
);
|
|
87821
87985
|
}
|
|
87822
|
-
const
|
|
87823
|
-
const text3 =
|
|
87986
|
+
const file4 = flagText({ args, name: "from-file" });
|
|
87987
|
+
const text3 = file4 ? await readFile29(file4, "utf8") : await context.readStdin();
|
|
87824
87988
|
const trimmed = text3.replace(/\r?\n$/, "");
|
|
87825
87989
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
87826
87990
|
return trimmed;
|
|
@@ -88052,8 +88216,8 @@ async function keyText({ context, args }) {
|
|
|
88052
88216
|
if (KEY_FLAGS.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
88053
88217
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
88054
88218
|
}
|
|
88055
|
-
const
|
|
88056
|
-
const text3 =
|
|
88219
|
+
const file4 = flagText({ args, name: "from-file" });
|
|
88220
|
+
const text3 = file4 ? await readFile30(resolve12(context.cwd, file4), "utf8") : await context.readStdin();
|
|
88057
88221
|
const trimmed = text3.trim();
|
|
88058
88222
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
88059
88223
|
return trimmed;
|
|
@@ -88695,8 +88859,8 @@ async function secretsOf({ context, args }) {
|
|
|
88695
88859
|
}
|
|
88696
88860
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
88697
88861
|
if (fromConnection) return { fromConnection };
|
|
88698
|
-
const
|
|
88699
|
-
const text3 =
|
|
88862
|
+
const file4 = flagText({ args, name: "from-file" });
|
|
88863
|
+
const text3 = file4 ? await readFile31(resolve13(context.cwd, file4), "utf8") : await context.readStdin();
|
|
88700
88864
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
88701
88865
|
if (lines2.length !== 2) {
|
|
88702
88866
|
throw new CliUsageError(
|
|
@@ -88966,8 +89130,8 @@ var DOMAINS_USAGE = `Usage:
|
|
|
88966
89130
|
var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
88967
89131
|
`);
|
|
88968
89132
|
function printDomain(context, row) {
|
|
88969
|
-
const
|
|
88970
|
-
context.out(`${row.domain} ${
|
|
89133
|
+
const join33 = row.autoJoin ? "auto-join on" : "auto-join off";
|
|
89134
|
+
context.out(`${row.domain} ${join33}${row.enforced ? " single sign-on enforced" : ""}
|
|
88971
89135
|
`);
|
|
88972
89136
|
}
|
|
88973
89137
|
async function list4({ context, args }) {
|
|
@@ -89037,17 +89201,17 @@ async function listEmoji({ context, args, client }) {
|
|
|
89037
89201
|
for (const each of list12.emoji) context.out(shown(each));
|
|
89038
89202
|
}
|
|
89039
89203
|
async function addEmoji({ context, args, client }) {
|
|
89040
|
-
const
|
|
89204
|
+
const file4 = wordAt4(args, 3);
|
|
89041
89205
|
let bytes;
|
|
89042
89206
|
try {
|
|
89043
|
-
bytes = new Uint8Array(await readFile32(resolve14(context.cwd,
|
|
89207
|
+
bytes = new Uint8Array(await readFile32(resolve14(context.cwd, file4)));
|
|
89044
89208
|
} catch {
|
|
89045
|
-
throw new CliUsageError(`Cannot read ${
|
|
89209
|
+
throw new CliUsageError(`Cannot read ${file4}.`);
|
|
89046
89210
|
}
|
|
89047
89211
|
const aliases = flagText({ args, name: "alias" }).split(",").map((alias) => alias.trim()).filter(Boolean);
|
|
89048
89212
|
const added = await client.post(EMOJI_KEY_PATHS.add, {
|
|
89049
89213
|
name: wordAt4(args, 2),
|
|
89050
|
-
contentType: contentTypeOf(
|
|
89214
|
+
contentType: contentTypeOf(file4),
|
|
89051
89215
|
dataBase64: Buffer.from(bytes).toString("base64"),
|
|
89052
89216
|
aliases
|
|
89053
89217
|
});
|
|
@@ -89536,26 +89700,26 @@ function logoTypeOf(bytes) {
|
|
|
89536
89700
|
}
|
|
89537
89701
|
var LOGO_MAX_BYTES = 512 * 1024;
|
|
89538
89702
|
var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze workspace logo remove";
|
|
89539
|
-
async function readLogo({ context, file:
|
|
89703
|
+
async function readLogo({ context, file: file4 }) {
|
|
89540
89704
|
let bytes;
|
|
89541
89705
|
try {
|
|
89542
|
-
bytes = new Uint8Array(await readFile33(resolve15(context.cwd,
|
|
89706
|
+
bytes = new Uint8Array(await readFile33(resolve15(context.cwd, file4)));
|
|
89543
89707
|
} catch {
|
|
89544
|
-
throw new CliUsageError(`No file to read at ${
|
|
89708
|
+
throw new CliUsageError(`No file to read at ${file4}.`);
|
|
89545
89709
|
}
|
|
89546
89710
|
const contentType = logoTypeOf(bytes);
|
|
89547
89711
|
if (!contentType) throw new CliUsageError("A logo must be a PNG, JPEG or WebP picture.");
|
|
89548
89712
|
if (bytes.byteLength > LOGO_MAX_BYTES) {
|
|
89549
89713
|
throw new CliUsageError(
|
|
89550
|
-
`A logo must be at most 512 KB; ${
|
|
89714
|
+
`A logo must be at most 512 KB; ${file4} is ${Math.ceil(bytes.byteLength / 1024)} KB.`
|
|
89551
89715
|
);
|
|
89552
89716
|
}
|
|
89553
89717
|
return { contentType, dataBase64: Buffer.from(bytes).toString("base64") };
|
|
89554
89718
|
}
|
|
89555
89719
|
async function logo({ context, args }) {
|
|
89556
|
-
const [, , action,
|
|
89557
|
-
if (action === "set" &&
|
|
89558
|
-
const body = await readLogo({ context, file:
|
|
89720
|
+
const [, , action, file4] = args.words;
|
|
89721
|
+
if (action === "set" && file4) {
|
|
89722
|
+
const body = await readLogo({ context, file: file4 });
|
|
89559
89723
|
const { client } = await signedIn({ context, args });
|
|
89560
89724
|
const answer6 = await client.post("/api/agents/me/workspace/logo", body);
|
|
89561
89725
|
return print7({ context, args, answer: answer6, text: (it) => `Set the logo of ${it.name}.
|
|
@@ -91312,13 +91476,13 @@ function keptFilesOf({
|
|
|
91312
91476
|
files: files2,
|
|
91313
91477
|
removing
|
|
91314
91478
|
}) {
|
|
91315
|
-
const matches = (
|
|
91316
|
-
const unknown2 = removing.filter((name3) => !files2.some((
|
|
91479
|
+
const matches = (file4, name3) => file4.id === name3 || file4.fileName === name3;
|
|
91480
|
+
const unknown2 = removing.filter((name3) => !files2.some((file4) => matches(file4, name3)));
|
|
91317
91481
|
if (unknown2.length > 0) {
|
|
91318
|
-
const on = files2.map((
|
|
91482
|
+
const on = files2.map((file4) => `${file4.fileName} (${file4.id})`).join(", ") || "none";
|
|
91319
91483
|
throw new CliUsageError(`The card has no file ${unknown2.join(", ")}; its files: ${on}`);
|
|
91320
91484
|
}
|
|
91321
|
-
return files2.filter((
|
|
91485
|
+
return files2.filter((file4) => !removing.some((name3) => matches(file4, name3)));
|
|
91322
91486
|
}
|
|
91323
91487
|
function refuseNamedFilesMissing({
|
|
91324
91488
|
args,
|
|
@@ -91403,7 +91567,7 @@ async function feedUpdate({ context, args }) {
|
|
|
91403
91567
|
channel: current3.item.channelId,
|
|
91404
91568
|
people: current3.recipientUserIds
|
|
91405
91569
|
}) : [];
|
|
91406
|
-
const attachmentIds = adding || removing.length > 0 ? [...kept.map((
|
|
91570
|
+
const attachmentIds = adding || removing.length > 0 ? [...kept.map((file4) => file4.id), ...added] : void 0;
|
|
91407
91571
|
const inTurn2 = await feedTurnOf({
|
|
91408
91572
|
context,
|
|
91409
91573
|
client,
|
|
@@ -91647,9 +91811,9 @@ async function ranksOf({
|
|
|
91647
91811
|
context,
|
|
91648
91812
|
args
|
|
91649
91813
|
}) {
|
|
91650
|
-
const
|
|
91651
|
-
if (
|
|
91652
|
-
const parsed = JSON.parse(await readFile34(resolve16(context.cwd,
|
|
91814
|
+
const file4 = flagText({ args, name: "file" });
|
|
91815
|
+
if (file4) {
|
|
91816
|
+
const parsed = JSON.parse(await readFile34(resolve16(context.cwd, file4), "utf8"));
|
|
91653
91817
|
if (Array.isArray(parsed)) return parsed;
|
|
91654
91818
|
throw new CliUsageError("--file holds a list of {itemId, priority}");
|
|
91655
91819
|
}
|
|
@@ -92471,12 +92635,12 @@ async function ip({ context, args }) {
|
|
|
92471
92635
|
}
|
|
92472
92636
|
|
|
92473
92637
|
// src/services/join-commands.service.ts
|
|
92474
|
-
import { mkdir as mkdir23, readFile as readFile36, rename as rename8, rm as
|
|
92475
|
-
import { dirname as dirname23, join as
|
|
92638
|
+
import { mkdir as mkdir23, readFile as readFile36, rename as rename8, rm as rm14, writeFile as writeFile22 } from "node:fs/promises";
|
|
92639
|
+
import { dirname as dirname23, join as join26 } from "node:path";
|
|
92476
92640
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
92477
92641
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
92478
92642
|
function pendingPathOf({ context }) {
|
|
92479
|
-
return
|
|
92643
|
+
return join26(dirname23(context.environment.configPath), "join", "pending.json");
|
|
92480
92644
|
}
|
|
92481
92645
|
async function readPending({
|
|
92482
92646
|
context,
|
|
@@ -92499,7 +92663,7 @@ async function keepPending({ context, pending: pending2 }) {
|
|
|
92499
92663
|
await rename8(temporary, path);
|
|
92500
92664
|
}
|
|
92501
92665
|
async function dropPending({ context }) {
|
|
92502
|
-
await
|
|
92666
|
+
await rm14(pendingPathOf({ context }), { force: true });
|
|
92503
92667
|
}
|
|
92504
92668
|
function waitSecondsOf3({ args }) {
|
|
92505
92669
|
const raw = flagText({ args, name: "timeout" });
|
|
@@ -93634,10 +93798,10 @@ async function serveMcp({
|
|
|
93634
93798
|
|
|
93635
93799
|
// src/services/memory-commands.service.ts
|
|
93636
93800
|
import { readdir as readdir7, readFile as readFile38 } from "node:fs/promises";
|
|
93637
|
-
import { join as
|
|
93801
|
+
import { join as join27, resolve as resolve18 } from "node:path";
|
|
93638
93802
|
|
|
93639
93803
|
// src/services/mount-files.service.ts
|
|
93640
|
-
import { mkdir as mkdir24, readFile as readFile37, rm as
|
|
93804
|
+
import { mkdir as mkdir24, readFile as readFile37, rm as rm15, writeFile as writeFile23 } from "node:fs/promises";
|
|
93641
93805
|
import { dirname as dirname24, relative as relative5, resolve as resolve17 } from "node:path";
|
|
93642
93806
|
async function textArgument({
|
|
93643
93807
|
context,
|
|
@@ -93657,15 +93821,15 @@ async function writeMount({
|
|
|
93657
93821
|
files: files2
|
|
93658
93822
|
}) {
|
|
93659
93823
|
const root = resolve17(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
93660
|
-
await
|
|
93824
|
+
await rm15(root, { recursive: true, force: true });
|
|
93661
93825
|
await mkdir24(root, { recursive: true });
|
|
93662
|
-
for (const
|
|
93663
|
-
const target = resolve17(root,
|
|
93826
|
+
for (const file4 of files2) {
|
|
93827
|
+
const target = resolve17(root, file4.path);
|
|
93664
93828
|
const inside = relative5(root, target);
|
|
93665
93829
|
if (!inside || inside.startsWith(".."))
|
|
93666
|
-
throw new Error(`Refusing to write outside ${root}: ${
|
|
93830
|
+
throw new Error(`Refusing to write outside ${root}: ${file4.path}`);
|
|
93667
93831
|
await mkdir24(dirname24(target), { recursive: true });
|
|
93668
|
-
await writeFile23(target,
|
|
93832
|
+
await writeFile23(target, file4.content);
|
|
93669
93833
|
}
|
|
93670
93834
|
return root;
|
|
93671
93835
|
}
|
|
@@ -93697,10 +93861,10 @@ An agent reaches only its turn: another --channel or person is refused with memo
|
|
|
93697
93861
|
var PROVENANCES = ["said", "decided", "verified", "inferred", "observed"];
|
|
93698
93862
|
var FILES = /* @__PURE__ */ new Set(["SOUL.md", "AGENTS.md", "MEMORY.md"]);
|
|
93699
93863
|
function fileRef({ context, args }) {
|
|
93700
|
-
const
|
|
93701
|
-
if (!FILES.has(
|
|
93864
|
+
const file4 = args.words[2] ?? "";
|
|
93865
|
+
if (!FILES.has(file4)) throw new CliUsageError(USAGE13);
|
|
93702
93866
|
const channel = turnChannel({ context, args });
|
|
93703
|
-
return { file:
|
|
93867
|
+
return { file: file4, ...channel ? { channel } : {} };
|
|
93704
93868
|
}
|
|
93705
93869
|
function printDocument({
|
|
93706
93870
|
context,
|
|
@@ -93921,15 +94085,15 @@ async function siestaImport({
|
|
|
93921
94085
|
dir
|
|
93922
94086
|
}) {
|
|
93923
94087
|
const root = resolve18(context.cwd, dir);
|
|
93924
|
-
const log = await readFile38(
|
|
93925
|
-
const names = (await readdir7(
|
|
94088
|
+
const log = await readFile38(join27(root, "LOG.md"));
|
|
94089
|
+
const names = (await readdir7(join27(root, "tree")).catch(() => [])).filter(
|
|
93926
94090
|
(name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
|
|
93927
94091
|
);
|
|
93928
94092
|
const tree = Object.fromEntries(
|
|
93929
94093
|
await Promise.all(
|
|
93930
94094
|
names.map(async (name3) => [
|
|
93931
94095
|
name3.slice(0, -3),
|
|
93932
|
-
(await readFile38(
|
|
94096
|
+
(await readFile38(join27(root, "tree", name3))).toString("base64")
|
|
93933
94097
|
])
|
|
93934
94098
|
)
|
|
93935
94099
|
);
|
|
@@ -93949,15 +94113,15 @@ async function memoryImport({ context, args }) {
|
|
|
93949
94113
|
const dir = flagText({ args, name: "optmem" });
|
|
93950
94114
|
if (!dir) throw new CliUsageError(USAGE13);
|
|
93951
94115
|
const root = resolve18(context.cwd, dir);
|
|
93952
|
-
const log = await readFile38(
|
|
93953
|
-
const sizes2 = (await readdir7(
|
|
94116
|
+
const log = await readFile38(join27(root, "LOG.txt"));
|
|
94117
|
+
const sizes2 = (await readdir7(join27(root, "TREE")).catch(() => [])).filter(
|
|
93954
94118
|
(name3) => /^\d{1,4}$/.test(name3)
|
|
93955
94119
|
);
|
|
93956
94120
|
const tree = Object.fromEntries(
|
|
93957
94121
|
await Promise.all(
|
|
93958
94122
|
sizes2.map(async (size) => [
|
|
93959
94123
|
size,
|
|
93960
|
-
(await readFile38(
|
|
94124
|
+
(await readFile38(join27(root, "TREE", size))).toString("base64")
|
|
93961
94125
|
])
|
|
93962
94126
|
)
|
|
93963
94127
|
);
|
|
@@ -94521,9 +94685,9 @@ async function openclaw({
|
|
|
94521
94685
|
}
|
|
94522
94686
|
|
|
94523
94687
|
// src/services/operator-key-commands.service.ts
|
|
94524
|
-
import { createHash as
|
|
94525
|
-
import { mkdir as mkdir25, readFile as readFile39, rm as
|
|
94526
|
-
import { dirname as dirname25, join as
|
|
94688
|
+
import { createHash as createHash7, randomBytes as randomBytes3 } from "node:crypto";
|
|
94689
|
+
import { mkdir as mkdir25, readFile as readFile39, rm as rm16, writeFile as writeFile24 } from "node:fs/promises";
|
|
94690
|
+
import { dirname as dirname25, join as join28 } from "node:path";
|
|
94527
94691
|
|
|
94528
94692
|
// ../../modules/audit-log/contract/src/audit-log.api.ts
|
|
94529
94693
|
var auditEntrySchemaDefinition = external_exports.object({
|
|
@@ -95132,6 +95296,7 @@ var WorkspaceAlertsSlot = workspaceUi.extension("frame.alerts");
|
|
|
95132
95296
|
var WorkspaceSidebarSlot = workspaceUi.component("sidebar");
|
|
95133
95297
|
var WorkspaceSidebarHeadSlot = workspaceUi.component("sidebar.head");
|
|
95134
95298
|
var WorkspaceSidebarTopSlot = workspaceUi.component("sidebar.top");
|
|
95299
|
+
var WorkspaceSidebarInvitesSlot = workspaceUi.extension("sidebar.invites");
|
|
95135
95300
|
var WorkspaceSidebarFooterSlot = workspaceUi.extension("sidebar.footer");
|
|
95136
95301
|
var WorkspaceInviteDialogSlot = workspaceUi.component("inviteDialog");
|
|
95137
95302
|
var ProfileHooksToken = workspaceUi.hooks("profile");
|
|
@@ -95852,7 +96017,7 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
|
|
|
95852
96017
|
laze ops status <key> waiting, approved or ended
|
|
95853
96018
|
laze ops use <key> run the approved action and print the answer`;
|
|
95854
96019
|
var POLL_MS3 = 5e3;
|
|
95855
|
-
var keyFile = ({ context, keyId }) =>
|
|
96020
|
+
var keyFile = ({ context, keyId }) => join28(dirname25(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
|
|
95856
96021
|
async function saveSecret({
|
|
95857
96022
|
context,
|
|
95858
96023
|
keyId,
|
|
@@ -95917,7 +96082,7 @@ async function requestKey({ context, args }) {
|
|
|
95917
96082
|
target,
|
|
95918
96083
|
args: argsOf({ args }),
|
|
95919
96084
|
reason: reason2,
|
|
95920
|
-
secretHash:
|
|
96085
|
+
secretHash: createHash7("sha256").update(secret).digest("hex")
|
|
95921
96086
|
});
|
|
95922
96087
|
await saveSecret({ context, keyId: key.id, secret });
|
|
95923
96088
|
const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
|
|
@@ -95944,7 +96109,7 @@ async function forgetIfOver({
|
|
|
95944
96109
|
const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
|
|
95945
96110
|
const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
|
|
95946
96111
|
if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
|
|
95947
|
-
await
|
|
96112
|
+
await rm16(keyFile({ context, keyId }), { force: true });
|
|
95948
96113
|
}
|
|
95949
96114
|
return key;
|
|
95950
96115
|
}
|
|
@@ -96019,7 +96184,7 @@ ${OPS_USAGE}`);
|
|
|
96019
96184
|
|
|
96020
96185
|
// src/services/release-watch.service.ts
|
|
96021
96186
|
import { mkdir as mkdir26, readFile as readFile40, realpath, writeFile as writeFile25 } from "node:fs/promises";
|
|
96022
|
-
import { dirname as dirname26, join as
|
|
96187
|
+
import { dirname as dirname26, join as join29 } from "node:path";
|
|
96023
96188
|
|
|
96024
96189
|
// src/rules/cli-update.rules.ts
|
|
96025
96190
|
var CLI_PACKAGE = "@lazehq/cli";
|
|
@@ -96166,7 +96331,7 @@ async function startedUpdate({
|
|
|
96166
96331
|
const plan2 = updatePlanOf({ script: await scriptOf(context) });
|
|
96167
96332
|
if (plan2.kind !== "install") return null;
|
|
96168
96333
|
const folder = dirname26(context.environment.configPath);
|
|
96169
|
-
const stamp =
|
|
96334
|
+
const stamp = join29(folder, "auto-update.json");
|
|
96170
96335
|
const last = await readFile40(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
|
|
96171
96336
|
const now = context.nowMs();
|
|
96172
96337
|
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
@@ -96174,7 +96339,7 @@ async function startedUpdate({
|
|
|
96174
96339
|
await writeFile25(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
|
|
96175
96340
|
context.processes.spawnDetached({
|
|
96176
96341
|
argv: [...context.program, "update"],
|
|
96177
|
-
logPath:
|
|
96342
|
+
logPath: join29(folder, "auto-update.log")
|
|
96178
96343
|
});
|
|
96179
96344
|
return { manager: plan2.manager };
|
|
96180
96345
|
}
|
|
@@ -96211,7 +96376,7 @@ function watchingRelease({
|
|
|
96211
96376
|
}
|
|
96212
96377
|
|
|
96213
96378
|
// src/services/rush-guard.service.ts
|
|
96214
|
-
import { readFile as readFile41, rm as
|
|
96379
|
+
import { readFile as readFile41, rm as rm17 } from "node:fs/promises";
|
|
96215
96380
|
var WATCH_MS3 = 2e3;
|
|
96216
96381
|
var RETRY_MS2 = 3e4;
|
|
96217
96382
|
async function guardRound(guard) {
|
|
@@ -96283,10 +96448,10 @@ async function rushWakeHook({ context, args }) {
|
|
|
96283
96448
|
return 0;
|
|
96284
96449
|
} finally {
|
|
96285
96450
|
if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
|
|
96286
|
-
await
|
|
96451
|
+
await rm17(lock, { force: true });
|
|
96287
96452
|
}
|
|
96288
96453
|
} finally {
|
|
96289
|
-
await
|
|
96454
|
+
await rm17(path, { force: true });
|
|
96290
96455
|
}
|
|
96291
96456
|
}
|
|
96292
96457
|
|
|
@@ -96453,7 +96618,7 @@ async function schedule({ context, args }) {
|
|
|
96453
96618
|
|
|
96454
96619
|
// src/services/skill-commands.service.ts
|
|
96455
96620
|
import { readdir as readdir8, readFile as readFile42 } from "node:fs/promises";
|
|
96456
|
-
import { join as
|
|
96621
|
+
import { join as join30, relative as relative6, resolve as resolve20 } from "node:path";
|
|
96457
96622
|
var USAGE17 = `Usage:
|
|
96458
96623
|
laze skill list [--agent <agentId>]
|
|
96459
96624
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -96474,7 +96639,7 @@ async function folderFiles({ root }) {
|
|
|
96474
96639
|
const files2 = [];
|
|
96475
96640
|
for (const entry of entries) {
|
|
96476
96641
|
if (!entry.isFile()) continue;
|
|
96477
|
-
const full =
|
|
96642
|
+
const full = join30(entry.parentPath, entry.name);
|
|
96478
96643
|
files2.push({ path: relative6(root, full), content: await readFile42(full, "utf8") });
|
|
96479
96644
|
}
|
|
96480
96645
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
@@ -96532,9 +96697,9 @@ async function skillShow({ context, args }) {
|
|
|
96532
96697
|
`);
|
|
96533
96698
|
context.out(`${skill2.name}${skill2.installed ? "" : " (not installed)"}: ${skill2.description}
|
|
96534
96699
|
`);
|
|
96535
|
-
for (const
|
|
96700
|
+
for (const file4 of skill2.files) context.out(` ${file4.path}
|
|
96536
96701
|
`);
|
|
96537
|
-
const skillMd = skill2.files.find((
|
|
96702
|
+
const skillMd = skill2.files.find((file4) => file4.path === "SKILL.md");
|
|
96538
96703
|
if (skillMd) context.out(`
|
|
96539
96704
|
${skillMd.content}`);
|
|
96540
96705
|
}
|
|
@@ -96666,8 +96831,8 @@ async function secretLines({ context, args }) {
|
|
|
96666
96831
|
if (SECRET_FLAGS3.some((flag2) => args.flags[flag2] !== void 0)) {
|
|
96667
96832
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
96668
96833
|
}
|
|
96669
|
-
const
|
|
96670
|
-
const text3 =
|
|
96834
|
+
const file4 = flagText({ args, name: "from-file" });
|
|
96835
|
+
const text3 = file4 ? await readFile43(resolve21(context.cwd, file4), "utf8") : await context.readStdin();
|
|
96671
96836
|
return text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
96672
96837
|
}
|
|
96673
96838
|
async function secretsOf2({
|
|
@@ -97057,8 +97222,8 @@ function refuseSecretFlags({ args }) {
|
|
|
97057
97222
|
}
|
|
97058
97223
|
}
|
|
97059
97224
|
async function clientSecretOf({ context, args }) {
|
|
97060
|
-
const
|
|
97061
|
-
const text3 =
|
|
97225
|
+
const file4 = flagText({ args, name: "from-file" });
|
|
97226
|
+
const text3 = file4 ? await readFile44(file4, "utf8") : await context.readStdin();
|
|
97062
97227
|
const secret = text3.trim();
|
|
97063
97228
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
97064
97229
|
return secret;
|
|
@@ -97391,7 +97556,7 @@ async function update2({
|
|
|
97391
97556
|
|
|
97392
97557
|
// src/services/vault-env-commands.service.ts
|
|
97393
97558
|
import { readFile as readFile45, stat as stat11 } from "node:fs/promises";
|
|
97394
|
-
import { dirname as dirname27, join as
|
|
97559
|
+
import { dirname as dirname27, join as join31, resolve as resolve22 } from "node:path";
|
|
97395
97560
|
|
|
97396
97561
|
// src/rules/vault-manifest.rules.ts
|
|
97397
97562
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -97425,12 +97590,12 @@ function lineOf4({ line, where }) {
|
|
|
97425
97590
|
if (reference?.[1]) return { kind: "reference", variable, ref: refOf(reference[1]) };
|
|
97426
97591
|
return { kind: "plain", variable, value: unquoted(value) };
|
|
97427
97592
|
}
|
|
97428
|
-
function parseManifest({ text: text3, file:
|
|
97593
|
+
function parseManifest({ text: text3, file: file4 }) {
|
|
97429
97594
|
const lines2 = [];
|
|
97430
97595
|
for (const [index, raw] of text3.split(/\r?\n/).entries()) {
|
|
97431
97596
|
const line = raw.trim().replace(/^export\s+/, "");
|
|
97432
97597
|
if (!line || line.startsWith("#")) continue;
|
|
97433
|
-
lines2.push(lineOf4({ line, where: `${
|
|
97598
|
+
lines2.push(lineOf4({ line, where: `${file4}:${index + 1}` }));
|
|
97434
97599
|
}
|
|
97435
97600
|
return lines2;
|
|
97436
97601
|
}
|
|
@@ -97479,7 +97644,7 @@ function credentialProcessJson(fields) {
|
|
|
97479
97644
|
}
|
|
97480
97645
|
|
|
97481
97646
|
// src/services/vault-batch.service.ts
|
|
97482
|
-
import { rm as
|
|
97647
|
+
import { rm as rm18 } from "node:fs/promises";
|
|
97483
97648
|
async function batchOf({ response }) {
|
|
97484
97649
|
const text3 = await response.text();
|
|
97485
97650
|
if (!response.ok) {
|
|
@@ -97661,7 +97826,7 @@ async function valuesOf({
|
|
|
97661
97826
|
}) {
|
|
97662
97827
|
const refused = refusalOf({ context, settled: settled2 });
|
|
97663
97828
|
if (refused !== 0) {
|
|
97664
|
-
await
|
|
97829
|
+
await rm18(keyPath, { force: true });
|
|
97665
97830
|
return { exitCode: refused };
|
|
97666
97831
|
}
|
|
97667
97832
|
const opened = /* @__PURE__ */ new Map();
|
|
@@ -97673,7 +97838,7 @@ async function valuesOf({
|
|
|
97673
97838
|
if (release2.message) context.err(`${release2.message}
|
|
97674
97839
|
`);
|
|
97675
97840
|
}
|
|
97676
|
-
if (!keep2) await
|
|
97841
|
+
if (!keep2) await rm18(keyPath, { force: true });
|
|
97677
97842
|
const released = /* @__PURE__ */ new Map();
|
|
97678
97843
|
for (const entry of entries) {
|
|
97679
97844
|
const fields = opened.get(keyOf(entry));
|
|
@@ -97738,23 +97903,23 @@ async function manifestPathOf({
|
|
|
97738
97903
|
const named = args.words[2];
|
|
97739
97904
|
if (named) return resolve22(context.cwd, named);
|
|
97740
97905
|
const environment = flagText({ args, name: "env" });
|
|
97741
|
-
const
|
|
97906
|
+
const file4 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
97742
97907
|
for (let dir = resolve22(context.cwd); ; dir = dirname27(dir)) {
|
|
97743
|
-
if (await isFile(
|
|
97908
|
+
if (await isFile(join31(dir, file4))) return join31(dir, file4);
|
|
97744
97909
|
if (dirname27(dir) === dir) break;
|
|
97745
97910
|
}
|
|
97746
|
-
throw new CliUsageError(`laze vault: no ${
|
|
97911
|
+
throw new CliUsageError(`laze vault: no ${file4} here or in a parent folder
|
|
97747
97912
|
${ENV_USAGE}`);
|
|
97748
97913
|
}
|
|
97749
97914
|
async function manifestOf({
|
|
97750
97915
|
context,
|
|
97751
97916
|
args
|
|
97752
97917
|
}) {
|
|
97753
|
-
const
|
|
97754
|
-
const text3 = await readFile45(
|
|
97755
|
-
throw new CliUsageError(`laze vault: cannot read ${
|
|
97918
|
+
const file4 = await manifestPathOf({ context, args });
|
|
97919
|
+
const text3 = await readFile45(file4, "utf8").catch(() => {
|
|
97920
|
+
throw new CliUsageError(`laze vault: cannot read ${file4}`);
|
|
97756
97921
|
});
|
|
97757
|
-
return { file:
|
|
97922
|
+
return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
|
|
97758
97923
|
}
|
|
97759
97924
|
async function printNames({
|
|
97760
97925
|
context,
|
|
@@ -98485,8 +98650,8 @@ async function secretsOf3({ context, args }) {
|
|
|
98485
98650
|
}
|
|
98486
98651
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
98487
98652
|
if (fromConnection) return { fromConnection };
|
|
98488
|
-
const
|
|
98489
|
-
const text3 =
|
|
98653
|
+
const file4 = flagText({ args, name: "from-file" });
|
|
98654
|
+
const text3 = file4 ? await readFile46(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
|
|
98490
98655
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
98491
98656
|
if (lines2.length !== 2) {
|
|
98492
98657
|
throw new CliUsageError(
|
|
@@ -98686,6 +98851,10 @@ async function whatsappBusiness({
|
|
|
98686
98851
|
return run4({ context, args, client });
|
|
98687
98852
|
}
|
|
98688
98853
|
|
|
98854
|
+
// src/services/whatsapp-commands.service.ts
|
|
98855
|
+
import { writeFile as writeFile26 } from "node:fs/promises";
|
|
98856
|
+
import { basename as basename9, resolve as resolve24 } from "node:path";
|
|
98857
|
+
|
|
98689
98858
|
// src/services/whatsapp-pairing-commands.service.ts
|
|
98690
98859
|
var WHATSAPP_PAIRING_USAGE = " laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)";
|
|
98691
98860
|
async function unpair({ context, args }) {
|
|
@@ -98708,6 +98877,7 @@ function whatsappPairingCommand(name3) {
|
|
|
98708
98877
|
var PATHS3 = {
|
|
98709
98878
|
chats: "/api/compute/whatsapp/chats",
|
|
98710
98879
|
read: "/api/compute/whatsapp/read",
|
|
98880
|
+
file: "/api/compute/whatsapp/file",
|
|
98711
98881
|
send: "/api/compute/whatsapp/send",
|
|
98712
98882
|
sendStatus: "/api/compute/whatsapp/send-status"
|
|
98713
98883
|
};
|
|
@@ -98719,6 +98889,7 @@ var USAGE19 = [
|
|
|
98719
98889
|
"Usage: laze whatsapp chats [<machine>] [--limit <n>] the chats, newest first",
|
|
98720
98890
|
" laze whatsapp read [<machine>] <chat> [--limit <n>] a chat's last messages, oldest first",
|
|
98721
98891
|
" (a read your owner set to Always ask waits for their answer; --request <id> picks it up later)",
|
|
98892
|
+
" laze whatsapp file [<machine>] <chat> <message-id> [--out <path>] save a message's photo, voice message or file",
|
|
98722
98893
|
' laze whatsapp send <machine> <chat> "<text>" send as the owner; an agent waits for their approval',
|
|
98723
98894
|
" laze whatsapp status <send-id> where a send stands",
|
|
98724
98895
|
WHATSAPP_PAIRING_USAGE,
|
|
@@ -98794,7 +98965,41 @@ async function read3({ context, args }) {
|
|
|
98794
98965
|
`);
|
|
98795
98966
|
if (answer6.messages.length === 0) context.out("No messages kept yet.\n");
|
|
98796
98967
|
for (const message2 of answer6.messages)
|
|
98797
|
-
context.out(
|
|
98968
|
+
context.out(
|
|
98969
|
+
`[${message2.at}] ${message2.fromMe ? "me" : message2.sender}: ${message2.text}${fileNote(message2)}
|
|
98970
|
+
`
|
|
98971
|
+
);
|
|
98972
|
+
}
|
|
98973
|
+
function fileNote(message2) {
|
|
98974
|
+
const media = message2.media;
|
|
98975
|
+
if (!media) return "";
|
|
98976
|
+
const name3 = media.name ? ` ${media.name}` : "";
|
|
98977
|
+
const words = media.transcript ? `
|
|
98978
|
+
Transcript: ${media.transcript}` : "";
|
|
98979
|
+
return ` (${media.kind}${name3}, ${media.size} bytes, id ${message2.id})${words}`;
|
|
98980
|
+
}
|
|
98981
|
+
async function file3({ context, args }) {
|
|
98982
|
+
const client = await computeClient({ context, args });
|
|
98983
|
+
const named = args.words.length > 4;
|
|
98984
|
+
const answer6 = await askingRead({
|
|
98985
|
+
client,
|
|
98986
|
+
path: PATHS3.file,
|
|
98987
|
+
body: {
|
|
98988
|
+
...named ? { machine: word2({ args, at: 2 }) } : {},
|
|
98989
|
+
chat: word2({ args, at: named ? 3 : 2 }),
|
|
98990
|
+
id: word2({ args, at: named ? 4 : 3 })
|
|
98991
|
+
},
|
|
98992
|
+
args
|
|
98993
|
+
});
|
|
98994
|
+
const out = resolve24(context.cwd, flagText({ args, name: "out" }) ?? basename9(answer6.fileName));
|
|
98995
|
+
const response = await context.fetcher(answer6.url);
|
|
98996
|
+
if (!response.ok) throw new Error(`The file link answered ${response.status}`);
|
|
98997
|
+
await writeFile26(out, new Uint8Array(await response.arrayBuffer()));
|
|
98998
|
+
if (args.flags.json) return context.out(`${JSON.stringify({ ...answer6, path: out }, null, 2)}
|
|
98999
|
+
`);
|
|
99000
|
+
context.out(`${out}
|
|
99001
|
+
`);
|
|
99002
|
+
if (answer6.transcript) context.out(`Transcript: ${answer6.transcript}
|
|
98798
99003
|
`);
|
|
98799
99004
|
}
|
|
98800
99005
|
async function settle3({ client, send: send5 }) {
|
|
@@ -98848,6 +99053,7 @@ async function whatsapp({
|
|
|
98848
99053
|
const command = args.words[1];
|
|
98849
99054
|
if (command === "chats") return chats({ context, args });
|
|
98850
99055
|
if (command === "read") return read3({ context, args });
|
|
99056
|
+
if (command === "file") return file3({ context, args });
|
|
98851
99057
|
if (command === "send") return send4({ context, args });
|
|
98852
99058
|
if (command === "status") return status10({ context, args });
|
|
98853
99059
|
const linking = whatsappPairingCommand(command);
|
|
@@ -99276,6 +99482,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
99276
99482
|
laze machine host <machine> <agent> [--when-offline wait|computer] run your personal agent on your machine
|
|
99277
99483
|
laze machine unhost <agent> run the agent on your agent computer again
|
|
99278
99484
|
laze whatsapp chats|read [<machine>] [<chat>] [--limit <n>] your person's WhatsApp, read through Laze
|
|
99485
|
+
laze whatsapp file [<machine>] <chat> <message-id> [--out <path>] save a message's photo, voice or file
|
|
99279
99486
|
laze whatsapp send <machine> <chat> "<text>" send as its owner; each message waits for their approval
|
|
99280
99487
|
laze whatsapp unpair <machine> unlink WhatsApp; linking is in Settings, Machines
|
|
99281
99488
|
laze whatsapp-business status|conversations|read|send|send-template|send-status|templates|prices
|
|
@@ -99587,21 +99794,21 @@ function exitCodeOf({ context, error: error63 }) {
|
|
|
99587
99794
|
// src/services/machine-key.service.ts
|
|
99588
99795
|
import { execFile as execFile2 } from "node:child_process";
|
|
99589
99796
|
import {
|
|
99590
|
-
createHash as
|
|
99797
|
+
createHash as createHash8,
|
|
99591
99798
|
createPrivateKey,
|
|
99592
99799
|
generateKeyPairSync,
|
|
99593
99800
|
randomBytes as randomBytes4,
|
|
99594
99801
|
sign
|
|
99595
99802
|
} from "node:crypto";
|
|
99596
|
-
import { chmod as chmod4, link, mkdir as mkdir27, readFile as readFile47, rm as
|
|
99597
|
-
import { dirname as dirname28, join as
|
|
99803
|
+
import { chmod as chmod4, link, mkdir as mkdir27, readFile as readFile47, rm as rm19, writeFile as writeFile27 } from "node:fs/promises";
|
|
99804
|
+
import { dirname as dirname28, join as join32 } from "node:path";
|
|
99598
99805
|
var KEYCHAIN_SERVICE = "laze-cli-machine-key";
|
|
99599
|
-
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((
|
|
99806
|
+
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve25, reject) => {
|
|
99600
99807
|
const child = execFile2(
|
|
99601
99808
|
program,
|
|
99602
99809
|
[...args],
|
|
99603
99810
|
{ timeout: timeoutMs },
|
|
99604
|
-
(error63, stdout2) => error63 ? reject(error63) :
|
|
99811
|
+
(error63, stdout2) => error63 ? reject(error63) : resolve25(String(stdout2))
|
|
99605
99812
|
);
|
|
99606
99813
|
if (stdin2 !== void 0) child.stdin?.end(stdin2);
|
|
99607
99814
|
});
|
|
@@ -99634,15 +99841,15 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
99634
99841
|
});
|
|
99635
99842
|
}
|
|
99636
99843
|
get metaPath() {
|
|
99637
|
-
return
|
|
99844
|
+
return join32(dirname28(this.options.configPath), "machine-key.json");
|
|
99638
99845
|
}
|
|
99639
99846
|
/** Named by the key, so two CLIs making a key at once never overwrite each other's. */
|
|
99640
99847
|
pemPathOf(jwk) {
|
|
99641
|
-
return
|
|
99848
|
+
return join32(dirname28(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
|
|
99642
99849
|
}
|
|
99643
99850
|
/** The Keychain item's account: one per config file and key. */
|
|
99644
99851
|
accountOf(jwk) {
|
|
99645
|
-
const config2 =
|
|
99852
|
+
const config2 = createHash8("sha256").update(this.options.configPath).digest("hex");
|
|
99646
99853
|
return `${config2.slice(0, 32)}-${shortOf(jwk)}`;
|
|
99647
99854
|
}
|
|
99648
99855
|
/** The key if this machine made one; null otherwise. Read once per process. */
|
|
@@ -99705,7 +99912,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
99705
99912
|
return kept;
|
|
99706
99913
|
}
|
|
99707
99914
|
async drop({ tier, jwk }) {
|
|
99708
|
-
if (tier === "file") return
|
|
99915
|
+
if (tier === "file") return rm19(this.pemPathOf(jwk), { force: true });
|
|
99709
99916
|
await this.options.run({
|
|
99710
99917
|
program: "security",
|
|
99711
99918
|
args: ["delete-generic-password", "-s", KEYCHAIN_SERVICE, "-a", this.accountOf(jwk)],
|
|
@@ -99761,12 +99968,12 @@ async function writeOnce({ path, text: text3 }) {
|
|
|
99761
99968
|
if (error63.code === "EEXIST") return false;
|
|
99762
99969
|
throw error63;
|
|
99763
99970
|
} finally {
|
|
99764
|
-
await
|
|
99971
|
+
await rm19(temporary, { force: true });
|
|
99765
99972
|
}
|
|
99766
99973
|
}
|
|
99767
99974
|
async function writePrivate({ path, text: text3 }) {
|
|
99768
99975
|
await mkdir27(dirname28(path), { recursive: true, mode: 448 });
|
|
99769
|
-
await
|
|
99976
|
+
await writeFile27(path, text3, { mode: 384 });
|
|
99770
99977
|
await chmod4(path, 384);
|
|
99771
99978
|
}
|
|
99772
99979
|
|
|
@@ -99957,15 +100164,15 @@ function terminalAsk() {
|
|
|
99957
100164
|
};
|
|
99958
100165
|
}
|
|
99959
100166
|
function sleep(ms, signal) {
|
|
99960
|
-
return new Promise((
|
|
99961
|
-
if (signal?.aborted) return
|
|
100167
|
+
return new Promise((resolve25) => {
|
|
100168
|
+
if (signal?.aborted) return resolve25();
|
|
99962
100169
|
const stop3 = () => {
|
|
99963
100170
|
clearTimeout(timer);
|
|
99964
|
-
|
|
100171
|
+
resolve25();
|
|
99965
100172
|
};
|
|
99966
100173
|
const timer = setTimeout(() => {
|
|
99967
100174
|
signal?.removeEventListener("abort", stop3);
|
|
99968
|
-
|
|
100175
|
+
resolve25();
|
|
99969
100176
|
}, ms);
|
|
99970
100177
|
signal?.addEventListener("abort", stop3, { once: true });
|
|
99971
100178
|
});
|