@lazehq/cli 0.1.80 → 0.1.82
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 +717 -445
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -84,6 +84,7 @@ var init_ar = __esm({
|
|
|
84
84
|
"compact.months": "\u0645\u0646\u0630 {count} \u0634",
|
|
85
85
|
"day.today": "\u0627\u0644\u064A\u0648\u0645 \u0641\u064A {time}",
|
|
86
86
|
"day.tomorrow": "\u063A\u062F\u064B\u0627 \u0641\u064A {time}",
|
|
87
|
+
"day.yesterday": "\u0623\u0645\u0633 \u0627\u0644\u0633\u0627\u0639\u0629 {time}",
|
|
87
88
|
"day.other": "{date} \u0641\u064A {time}"
|
|
88
89
|
};
|
|
89
90
|
}
|
|
@@ -120,6 +121,7 @@ var init_de = __esm({
|
|
|
120
121
|
"compact.months": "vor {count} Mon.",
|
|
121
122
|
"day.today": "heute um {time}",
|
|
122
123
|
"day.tomorrow": "morgen um {time}",
|
|
124
|
+
"day.yesterday": "Gestern um {time}",
|
|
123
125
|
"day.other": "{date} um {time}"
|
|
124
126
|
};
|
|
125
127
|
}
|
|
@@ -156,6 +158,7 @@ var init_es = __esm({
|
|
|
156
158
|
"compact.months": "hace {count} m",
|
|
157
159
|
"day.today": "hoy a las {time}",
|
|
158
160
|
"day.tomorrow": "ma\xF1ana a las {time}",
|
|
161
|
+
"day.yesterday": "Ayer a las {time}",
|
|
159
162
|
"day.other": "{date} a las {time}"
|
|
160
163
|
};
|
|
161
164
|
}
|
|
@@ -192,6 +195,7 @@ var init_fr = __esm({
|
|
|
192
195
|
"compact.months": "il y a {count} mois",
|
|
193
196
|
"day.today": "aujourd\u2019hui \xE0 {time}",
|
|
194
197
|
"day.tomorrow": "demain \xE0 {time}",
|
|
198
|
+
"day.yesterday": "Hier \xE0 {time}",
|
|
195
199
|
"day.other": "{date} \xE0 {time}"
|
|
196
200
|
};
|
|
197
201
|
}
|
|
@@ -228,6 +232,7 @@ var init_he = __esm({
|
|
|
228
232
|
"compact.months": "\u05DC\u05E4\u05E0\u05D9 {count} \u05D7\u05D5\u05D3\u05E9\u05D9\u05DD",
|
|
229
233
|
"day.today": "\u05D4\u05D9\u05D5\u05DD \u05D1-{time}",
|
|
230
234
|
"day.tomorrow": "\u05DE\u05D7\u05E8 \u05D1-{time}",
|
|
235
|
+
"day.yesterday": "\u05D0\u05EA\u05DE\u05D5\u05DC \u05D1-{time}",
|
|
231
236
|
"day.other": "{date} \u05D1-{time}"
|
|
232
237
|
};
|
|
233
238
|
}
|
|
@@ -264,6 +269,7 @@ var init_hi = __esm({
|
|
|
264
269
|
"compact.months": "{count} \u092E\u093E\u0939 \u092A\u0939\u0932\u0947",
|
|
265
270
|
"day.today": "\u0906\u091C {time}",
|
|
266
271
|
"day.tomorrow": "\u0915\u0932 {time}",
|
|
272
|
+
"day.yesterday": "\u0915\u0932 {time} \u092C\u091C\u0947",
|
|
267
273
|
"day.other": "{date} \u0915\u094B {time}"
|
|
268
274
|
};
|
|
269
275
|
}
|
|
@@ -300,6 +306,7 @@ var init_id = __esm({
|
|
|
300
306
|
"compact.months": "{count}bln lalu",
|
|
301
307
|
"day.today": "hari ini pukul {time}",
|
|
302
308
|
"day.tomorrow": "besok pukul {time}",
|
|
309
|
+
"day.yesterday": "Kemarin pukul {time}",
|
|
303
310
|
"day.other": "{date} pukul {time}"
|
|
304
311
|
};
|
|
305
312
|
}
|
|
@@ -336,6 +343,7 @@ var init_it = __esm({
|
|
|
336
343
|
"compact.months": "{count} mesi fa",
|
|
337
344
|
"day.today": "oggi alle {time}",
|
|
338
345
|
"day.tomorrow": "domani alle {time}",
|
|
346
|
+
"day.yesterday": "Ieri alle {time}",
|
|
339
347
|
"day.other": "{date} alle {time}"
|
|
340
348
|
};
|
|
341
349
|
}
|
|
@@ -372,6 +380,7 @@ var init_ja = __esm({
|
|
|
372
380
|
"compact.months": "{count}\u304B\u6708\u524D",
|
|
373
381
|
"day.today": "\u4ECA\u65E5 {time}",
|
|
374
382
|
"day.tomorrow": "\u660E\u65E5 {time}",
|
|
383
|
+
"day.yesterday": "\u6628\u65E5 {time}",
|
|
375
384
|
"day.other": "{date} {time}"
|
|
376
385
|
};
|
|
377
386
|
}
|
|
@@ -408,6 +417,7 @@ var init_ko = __esm({
|
|
|
408
417
|
"compact.months": "{count}\uAC1C\uC6D4 \uC804",
|
|
409
418
|
"day.today": "\uC624\uB298 {time}",
|
|
410
419
|
"day.tomorrow": "\uB0B4\uC77C {time}",
|
|
420
|
+
"day.yesterday": "\uC5B4\uC81C {time}",
|
|
411
421
|
"day.other": "{date} {time}"
|
|
412
422
|
};
|
|
413
423
|
}
|
|
@@ -444,6 +454,7 @@ var init_nl = __esm({
|
|
|
444
454
|
"compact.months": "{count}mnd geleden",
|
|
445
455
|
"day.today": "vandaag om {time}",
|
|
446
456
|
"day.tomorrow": "morgen om {time}",
|
|
457
|
+
"day.yesterday": "Gisteren om {time}",
|
|
447
458
|
"day.other": "{date} om {time}"
|
|
448
459
|
};
|
|
449
460
|
}
|
|
@@ -480,6 +491,7 @@ var init_pl = __esm({
|
|
|
480
491
|
"compact.months": "{count} mies. temu",
|
|
481
492
|
"day.today": "dzisiaj o {time}",
|
|
482
493
|
"day.tomorrow": "jutro o {time}",
|
|
494
|
+
"day.yesterday": "Wczoraj o {time}",
|
|
483
495
|
"day.other": "{date} o {time}"
|
|
484
496
|
};
|
|
485
497
|
}
|
|
@@ -516,6 +528,7 @@ var init_pt_BR = __esm({
|
|
|
516
528
|
"compact.months": "{count, plural, one {h\xE1 # m\xEAs} other {h\xE1 # meses}}",
|
|
517
529
|
"day.today": "hoje \xE0s {time}",
|
|
518
530
|
"day.tomorrow": "amanh\xE3 \xE0s {time}",
|
|
531
|
+
"day.yesterday": "Ontem \xE0s {time}",
|
|
519
532
|
"day.other": "{date} \xE0s {time}"
|
|
520
533
|
};
|
|
521
534
|
}
|
|
@@ -552,6 +565,7 @@ var init_ru = __esm({
|
|
|
552
565
|
"compact.months": "{count} \u043C\u0435\u0441 \u043D\u0430\u0437\u0430\u0434",
|
|
553
566
|
"day.today": "\u0441\u0435\u0433\u043E\u0434\u043D\u044F \u0432 {time}",
|
|
554
567
|
"day.tomorrow": "\u0437\u0430\u0432\u0442\u0440\u0430 \u0432 {time}",
|
|
568
|
+
"day.yesterday": "\u0412\u0447\u0435\u0440\u0430 \u0432 {time}",
|
|
555
569
|
"day.other": "{date} \u0432 {time}"
|
|
556
570
|
};
|
|
557
571
|
}
|
|
@@ -588,6 +602,7 @@ var init_sv = __esm({
|
|
|
588
602
|
"compact.months": "{count}m\xE5n sen",
|
|
589
603
|
"day.today": "idag kl. {time}",
|
|
590
604
|
"day.tomorrow": "imorgon kl. {time}",
|
|
605
|
+
"day.yesterday": "I g\xE5r kl. {time}",
|
|
591
606
|
"day.other": "{date} kl. {time}"
|
|
592
607
|
};
|
|
593
608
|
}
|
|
@@ -624,6 +639,7 @@ var init_th = __esm({
|
|
|
624
639
|
"compact.months": "{count} \u0E40\u0E14\u0E37\u0E2D\u0E19\u0E17\u0E35\u0E48\u0E41\u0E25\u0E49\u0E27",
|
|
625
640
|
"day.today": "\u0E27\u0E31\u0E19\u0E19\u0E35\u0E49\u0E40\u0E27\u0E25\u0E32 {time}",
|
|
626
641
|
"day.tomorrow": "\u0E1E\u0E23\u0E38\u0E48\u0E07\u0E19\u0E35\u0E49\u0E40\u0E27\u0E25\u0E32 {time}",
|
|
642
|
+
"day.yesterday": "\u0E40\u0E21\u0E37\u0E48\u0E2D\u0E27\u0E32\u0E19\u0E40\u0E27\u0E25\u0E32 {time}",
|
|
627
643
|
"day.other": "{date} \u0E40\u0E27\u0E25\u0E32 {time}"
|
|
628
644
|
};
|
|
629
645
|
}
|
|
@@ -660,6 +676,7 @@ var init_tr = __esm({
|
|
|
660
676
|
"compact.months": "{count} ay \xF6nce",
|
|
661
677
|
"day.today": "bug\xFCn {time}",
|
|
662
678
|
"day.tomorrow": "yar\u0131n {time}",
|
|
679
|
+
"day.yesterday": "D\xFCn {time}",
|
|
663
680
|
"day.other": "{date} {time}"
|
|
664
681
|
};
|
|
665
682
|
}
|
|
@@ -696,6 +713,7 @@ var init_vi = __esm({
|
|
|
696
713
|
"compact.months": "{count} th\xE1ng tr\u01B0\u1EDBc",
|
|
697
714
|
"day.today": "h\xF4m nay l\xFAc {time}",
|
|
698
715
|
"day.tomorrow": "ng\xE0y mai l\xFAc {time}",
|
|
716
|
+
"day.yesterday": "H\xF4m qua l\xFAc {time}",
|
|
699
717
|
"day.other": "{date} l\xFAc {time}"
|
|
700
718
|
};
|
|
701
719
|
}
|
|
@@ -732,6 +750,7 @@ var init_zh_Hans = __esm({
|
|
|
732
750
|
"compact.months": "{count}\u4E2A\u6708\u524D",
|
|
733
751
|
"day.today": "\u4ECA\u5929 {time}",
|
|
734
752
|
"day.tomorrow": "\u660E\u5929 {time}",
|
|
753
|
+
"day.yesterday": "\u6628\u5929 {time}",
|
|
735
754
|
"day.other": "{date} {time}"
|
|
736
755
|
};
|
|
737
756
|
}
|
|
@@ -768,6 +787,7 @@ var init_zh_Hant = __esm({
|
|
|
768
787
|
"compact.months": "{count} \u500B\u6708\u524D",
|
|
769
788
|
"day.today": "\u4ECA\u5929 {time}",
|
|
770
789
|
"day.tomorrow": "\u660E\u5929 {time}",
|
|
790
|
+
"day.yesterday": "\u6628\u5929 {time}",
|
|
771
791
|
"day.other": "{date} {time}"
|
|
772
792
|
};
|
|
773
793
|
}
|
|
@@ -3224,7 +3244,7 @@ var require_websocket = __commonJS({
|
|
|
3224
3244
|
var http = __require("http");
|
|
3225
3245
|
var net = __require("net");
|
|
3226
3246
|
var tls = __require("tls");
|
|
3227
|
-
var { randomBytes: randomBytes5, createHash:
|
|
3247
|
+
var { randomBytes: randomBytes5, createHash: createHash8 } = __require("crypto");
|
|
3228
3248
|
var { Duplex, Readable: Readable2 } = __require("stream");
|
|
3229
3249
|
var { URL: URL3 } = __require("url");
|
|
3230
3250
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -3892,7 +3912,7 @@ var require_websocket = __commonJS({
|
|
|
3892
3912
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
3893
3913
|
return;
|
|
3894
3914
|
}
|
|
3895
|
-
const digest =
|
|
3915
|
+
const digest = createHash8("sha1").update(key + GUID).digest("base64");
|
|
3896
3916
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
3897
3917
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
3898
3918
|
return;
|
|
@@ -4261,7 +4281,7 @@ var require_websocket_server = __commonJS({
|
|
|
4261
4281
|
var EventEmitter = __require("events");
|
|
4262
4282
|
var http = __require("http");
|
|
4263
4283
|
var { Duplex } = __require("stream");
|
|
4264
|
-
var { createHash:
|
|
4284
|
+
var { createHash: createHash8 } = __require("crypto");
|
|
4265
4285
|
var extension2 = require_extension();
|
|
4266
4286
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
4267
4287
|
var subprotocol2 = require_subprotocol();
|
|
@@ -4568,7 +4588,7 @@ var require_websocket_server = __commonJS({
|
|
|
4568
4588
|
);
|
|
4569
4589
|
}
|
|
4570
4590
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
4571
|
-
const digest =
|
|
4591
|
+
const digest = createHash8("sha1").update(key + GUID).digest("base64");
|
|
4572
4592
|
const headers = [
|
|
4573
4593
|
"HTTP/1.1 101 Switching Protocols",
|
|
4574
4594
|
"Upgrade: websocket",
|
|
@@ -7454,14 +7474,14 @@ var require_connect = __commonJS({
|
|
|
7454
7474
|
const sessionCache = new SessionCache(maxCachedSessions == null ? 100 : maxCachedSessions);
|
|
7455
7475
|
timeout = timeout == null ? 1e4 : timeout;
|
|
7456
7476
|
allowH2 = allowH2 != null ? allowH2 : true;
|
|
7457
|
-
return function connect8({ hostname:
|
|
7477
|
+
return function connect8({ hostname: hostname8, host: host2, protocol, port, servername, localAddress, httpSocket }, callback) {
|
|
7458
7478
|
let socket;
|
|
7459
7479
|
if (protocol === "https:") {
|
|
7460
7480
|
if (!tls) {
|
|
7461
7481
|
tls = __require("node:tls");
|
|
7462
7482
|
}
|
|
7463
7483
|
servername = servername || options.servername || util.getServerName(host2) || null;
|
|
7464
|
-
const sessionKey = servername ||
|
|
7484
|
+
const sessionKey = servername || hostname8;
|
|
7465
7485
|
assert2(sessionKey);
|
|
7466
7486
|
const session = customSession || sessionCache.get(sessionKey) || null;
|
|
7467
7487
|
port = port || 443;
|
|
@@ -7476,7 +7496,7 @@ var require_connect = __commonJS({
|
|
|
7476
7496
|
socket: httpSocket,
|
|
7477
7497
|
// upgrade socket connection
|
|
7478
7498
|
port,
|
|
7479
|
-
host:
|
|
7499
|
+
host: hostname8
|
|
7480
7500
|
});
|
|
7481
7501
|
socket.on("session", function(session2) {
|
|
7482
7502
|
sessionCache.set(sessionKey, session2);
|
|
@@ -7490,16 +7510,16 @@ var require_connect = __commonJS({
|
|
|
7490
7510
|
...options,
|
|
7491
7511
|
localAddress,
|
|
7492
7512
|
port,
|
|
7493
|
-
host:
|
|
7513
|
+
host: hostname8
|
|
7494
7514
|
};
|
|
7495
|
-
const family = net.isIP(
|
|
7496
|
-
if (family !== 0 && servername && servername !==
|
|
7515
|
+
const family = net.isIP(hostname8);
|
|
7516
|
+
if (family !== 0 && servername && servername !== hostname8) {
|
|
7497
7517
|
connectOptions.host = servername;
|
|
7498
7518
|
connectOptions.lookup = (_hostname, lookupOptions, cb) => {
|
|
7499
7519
|
if (lookupOptions.all) {
|
|
7500
|
-
cb(null, [{ address:
|
|
7520
|
+
cb(null, [{ address: hostname8, family }]);
|
|
7501
7521
|
} else {
|
|
7502
|
-
cb(null,
|
|
7522
|
+
cb(null, hostname8, family);
|
|
7503
7523
|
}
|
|
7504
7524
|
};
|
|
7505
7525
|
}
|
|
@@ -7512,7 +7532,7 @@ var require_connect = __commonJS({
|
|
|
7512
7532
|
const keepAliveInitialDelay = options.keepAliveInitialDelay === void 0 ? 6e4 : options.keepAliveInitialDelay;
|
|
7513
7533
|
socket.setKeepAlive(true, keepAliveInitialDelay);
|
|
7514
7534
|
}
|
|
7515
|
-
const clearConnectTimeout = util.setupConnectTimeout(new WeakRef(socket), { timeout, hostname:
|
|
7535
|
+
const clearConnectTimeout = util.setupConnectTimeout(new WeakRef(socket), { timeout, hostname: hostname8, port });
|
|
7516
7536
|
socket.setNoDelay(true).once(protocol === "https:" ? "secureConnect" : "connect", function() {
|
|
7517
7537
|
queueMicrotask(clearConnectTimeout);
|
|
7518
7538
|
if (callback) {
|
|
@@ -7525,7 +7545,7 @@ var require_connect = __commonJS({
|
|
|
7525
7545
|
if (callback) {
|
|
7526
7546
|
const cb = callback;
|
|
7527
7547
|
callback = null;
|
|
7528
|
-
cb(maybeNormalizeConnectError(err, this, { timeout, hostname:
|
|
7548
|
+
cb(maybeNormalizeConnectError(err, this, { timeout, hostname: hostname8, port }));
|
|
7529
7549
|
}
|
|
7530
7550
|
});
|
|
7531
7551
|
return socket;
|
|
@@ -14077,20 +14097,20 @@ var require_client = __commonJS({
|
|
|
14077
14097
|
function connect8(client) {
|
|
14078
14098
|
assert2(!client[kConnecting]);
|
|
14079
14099
|
assert2(!client[kHTTPContext]);
|
|
14080
|
-
let { host: host2, hostname:
|
|
14081
|
-
if (
|
|
14082
|
-
const idx =
|
|
14100
|
+
let { host: host2, hostname: hostname8, protocol, port } = client[kUrl];
|
|
14101
|
+
if (hostname8[0] === "[") {
|
|
14102
|
+
const idx = hostname8.indexOf("]");
|
|
14083
14103
|
assert2(idx !== -1);
|
|
14084
|
-
const ip2 =
|
|
14104
|
+
const ip2 = hostname8.substring(1, idx);
|
|
14085
14105
|
assert2(net.isIPv6(ip2));
|
|
14086
|
-
|
|
14106
|
+
hostname8 = ip2;
|
|
14087
14107
|
}
|
|
14088
14108
|
client[kConnecting] = true;
|
|
14089
14109
|
if (channels3.beforeConnect.hasSubscribers) {
|
|
14090
14110
|
channels3.beforeConnect.publish({
|
|
14091
14111
|
connectParams: {
|
|
14092
14112
|
host: host2,
|
|
14093
|
-
hostname:
|
|
14113
|
+
hostname: hostname8,
|
|
14094
14114
|
protocol,
|
|
14095
14115
|
port,
|
|
14096
14116
|
version: client[kHTTPContext]?.version,
|
|
@@ -14103,14 +14123,14 @@ var require_client = __commonJS({
|
|
|
14103
14123
|
try {
|
|
14104
14124
|
client[kConnector]({
|
|
14105
14125
|
host: host2,
|
|
14106
|
-
hostname:
|
|
14126
|
+
hostname: hostname8,
|
|
14107
14127
|
protocol,
|
|
14108
14128
|
port,
|
|
14109
14129
|
servername: client[kServerName],
|
|
14110
14130
|
localAddress: client[kLocalAddress]
|
|
14111
14131
|
}, (err, socket) => {
|
|
14112
14132
|
if (err) {
|
|
14113
|
-
handleConnectError(client, err, { host: host2, hostname:
|
|
14133
|
+
handleConnectError(client, err, { host: host2, hostname: hostname8, protocol, port });
|
|
14114
14134
|
client[kResume]();
|
|
14115
14135
|
return;
|
|
14116
14136
|
}
|
|
@@ -14124,7 +14144,7 @@ var require_client = __commonJS({
|
|
|
14124
14144
|
client[kHTTPContext] = socket.alpnProtocol === "h2" ? connectH2(client, socket) : connectH1(client, socket);
|
|
14125
14145
|
} catch (err2) {
|
|
14126
14146
|
socket.destroy().on("error", noop2);
|
|
14127
|
-
handleConnectError(client, err2, { host: host2, hostname:
|
|
14147
|
+
handleConnectError(client, err2, { host: host2, hostname: hostname8, protocol, port });
|
|
14128
14148
|
client[kResume]();
|
|
14129
14149
|
return;
|
|
14130
14150
|
}
|
|
@@ -14137,7 +14157,7 @@ var require_client = __commonJS({
|
|
|
14137
14157
|
channels3.connected.publish({
|
|
14138
14158
|
connectParams: {
|
|
14139
14159
|
host: host2,
|
|
14140
|
-
hostname:
|
|
14160
|
+
hostname: hostname8,
|
|
14141
14161
|
protocol,
|
|
14142
14162
|
port,
|
|
14143
14163
|
version: client[kHTTPContext]?.version,
|
|
@@ -14152,11 +14172,11 @@ var require_client = __commonJS({
|
|
|
14152
14172
|
client[kResume]();
|
|
14153
14173
|
});
|
|
14154
14174
|
} catch (err) {
|
|
14155
|
-
handleConnectError(client, err, { host: host2, hostname:
|
|
14175
|
+
handleConnectError(client, err, { host: host2, hostname: hostname8, protocol, port });
|
|
14156
14176
|
client[kResume]();
|
|
14157
14177
|
}
|
|
14158
14178
|
}
|
|
14159
|
-
function handleConnectError(client, err, { host: host2, hostname:
|
|
14179
|
+
function handleConnectError(client, err, { host: host2, hostname: hostname8, protocol, port }) {
|
|
14160
14180
|
if (client.destroyed) {
|
|
14161
14181
|
return;
|
|
14162
14182
|
}
|
|
@@ -14165,7 +14185,7 @@ var require_client = __commonJS({
|
|
|
14165
14185
|
channels3.connectError.publish({
|
|
14166
14186
|
connectParams: {
|
|
14167
14187
|
host: host2,
|
|
14168
|
-
hostname:
|
|
14188
|
+
hostname: hostname8,
|
|
14169
14189
|
protocol,
|
|
14170
14190
|
port,
|
|
14171
14191
|
version: client[kHTTPContext]?.version,
|
|
@@ -16220,10 +16240,10 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
16220
16240
|
]);
|
|
16221
16241
|
}
|
|
16222
16242
|
#getProxyAgentForUrl(url2) {
|
|
16223
|
-
let { protocol, host:
|
|
16224
|
-
|
|
16243
|
+
let { protocol, host: hostname8, port } = url2;
|
|
16244
|
+
hostname8 = hostname8.replace(/:\d*$/, "").replace(/^\[(.+)\]$/, "$1").toLowerCase();
|
|
16225
16245
|
port = Number.parseInt(port, 10) || DEFAULT_PORTS[protocol] || 0;
|
|
16226
|
-
if (!this.#shouldProxy(
|
|
16246
|
+
if (!this.#shouldProxy(hostname8, port)) {
|
|
16227
16247
|
return this[kNoProxyAgent];
|
|
16228
16248
|
}
|
|
16229
16249
|
if (protocol === "https:") {
|
|
@@ -16231,7 +16251,7 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
16231
16251
|
}
|
|
16232
16252
|
return this[kHttpProxyAgent];
|
|
16233
16253
|
}
|
|
16234
|
-
#shouldProxy(
|
|
16254
|
+
#shouldProxy(hostname8, port) {
|
|
16235
16255
|
if (this.#noProxyChanged) {
|
|
16236
16256
|
this.#parseNoProxy();
|
|
16237
16257
|
}
|
|
@@ -16246,10 +16266,10 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
16246
16266
|
if (entry.port && entry.port !== port) {
|
|
16247
16267
|
continue;
|
|
16248
16268
|
}
|
|
16249
|
-
if (
|
|
16269
|
+
if (hostname8 === entry.hostname) {
|
|
16250
16270
|
return false;
|
|
16251
16271
|
}
|
|
16252
|
-
if (
|
|
16272
|
+
if (hostname8.slice(-(entry.hostname.length + 1)) === `.${entry.hostname}`) {
|
|
16253
16273
|
return false;
|
|
16254
16274
|
}
|
|
16255
16275
|
}
|
|
@@ -16264,21 +16284,21 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
16264
16284
|
if (!entry) {
|
|
16265
16285
|
continue;
|
|
16266
16286
|
}
|
|
16267
|
-
let
|
|
16287
|
+
let hostname8, port;
|
|
16268
16288
|
const ipv6WithPort = entry.match(/^\[(.+)\]:(\d+)$/);
|
|
16269
16289
|
if (ipv6WithPort) {
|
|
16270
|
-
|
|
16290
|
+
hostname8 = ipv6WithPort[1];
|
|
16271
16291
|
port = Number.parseInt(ipv6WithPort[2], 10);
|
|
16272
16292
|
} else {
|
|
16273
16293
|
const unbracketed = entry.replace(/^\[(.+)\]$/, "$1");
|
|
16274
16294
|
const colonCount = (unbracketed.match(/:/g) || []).length;
|
|
16275
16295
|
const parsed = colonCount === 1 && unbracketed.match(/^(.+):(\d+)$/);
|
|
16276
|
-
|
|
16296
|
+
hostname8 = parsed ? parsed[1] : unbracketed;
|
|
16277
16297
|
port = parsed ? Number.parseInt(parsed[2], 10) : 0;
|
|
16278
16298
|
}
|
|
16279
16299
|
noProxyEntries.push({
|
|
16280
16300
|
// strip leading dot or asterisk with dot
|
|
16281
|
-
hostname:
|
|
16301
|
+
hostname: hostname8.replace(/^\*?\./, "").toLowerCase(),
|
|
16282
16302
|
port
|
|
16283
16303
|
});
|
|
16284
16304
|
}
|
|
@@ -19466,8 +19486,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
19466
19486
|
var require_snapshot_recorder = __commonJS({
|
|
19467
19487
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
19468
19488
|
"use strict";
|
|
19469
|
-
var { writeFile:
|
|
19470
|
-
var { dirname:
|
|
19489
|
+
var { writeFile: writeFile27, readFile: readFile49, mkdir: mkdir28 } = __require("node:fs/promises");
|
|
19490
|
+
var { dirname: dirname30, resolve: resolve24 } = __require("node:path");
|
|
19471
19491
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
19472
19492
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
19473
19493
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -19683,7 +19703,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19683
19703
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19684
19704
|
}
|
|
19685
19705
|
try {
|
|
19686
|
-
const data = await
|
|
19706
|
+
const data = await readFile49(resolve24(path), "utf8");
|
|
19687
19707
|
const parsed = JSON.parse(data);
|
|
19688
19708
|
if (Array.isArray(parsed)) {
|
|
19689
19709
|
this.#snapshots.clear();
|
|
@@ -19713,12 +19733,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19713
19733
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19714
19734
|
}
|
|
19715
19735
|
const resolvedPath = resolve24(path);
|
|
19716
|
-
await
|
|
19736
|
+
await mkdir28(dirname30(resolvedPath), { recursive: true });
|
|
19717
19737
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
19718
19738
|
hash: hash2,
|
|
19719
19739
|
snapshot
|
|
19720
19740
|
}));
|
|
19721
|
-
await
|
|
19741
|
+
await writeFile27(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
|
|
19722
19742
|
}
|
|
19723
19743
|
/**
|
|
19724
19744
|
* Clears all recorded snapshots
|
|
@@ -20745,14 +20765,14 @@ var require_dns = __commonJS({
|
|
|
20745
20765
|
get size() {
|
|
20746
20766
|
return this.#records.size;
|
|
20747
20767
|
}
|
|
20748
|
-
get(
|
|
20749
|
-
return this.#records.get(
|
|
20768
|
+
get(hostname8) {
|
|
20769
|
+
return this.#records.get(hostname8) ?? null;
|
|
20750
20770
|
}
|
|
20751
|
-
set(
|
|
20752
|
-
this.#records.set(
|
|
20771
|
+
set(hostname8, records) {
|
|
20772
|
+
this.#records.set(hostname8, records);
|
|
20753
20773
|
}
|
|
20754
|
-
delete(
|
|
20755
|
-
this.#records.delete(
|
|
20774
|
+
delete(hostname8) {
|
|
20775
|
+
this.#records.delete(hostname8);
|
|
20756
20776
|
}
|
|
20757
20777
|
// Delegate to storage decide can we do more lookups or not
|
|
20758
20778
|
full() {
|
|
@@ -36555,6 +36575,7 @@ var en = {
|
|
|
36555
36575
|
"compact.months": "{count}mo ago",
|
|
36556
36576
|
"day.today": "today at {time}",
|
|
36557
36577
|
"day.tomorrow": "tomorrow at {time}",
|
|
36578
|
+
"day.yesterday": "Yesterday at {time}",
|
|
36558
36579
|
"day.other": "{date} at {time}"
|
|
36559
36580
|
};
|
|
36560
36581
|
|
|
@@ -36630,8 +36651,22 @@ function nameOf({
|
|
|
36630
36651
|
const noon = Date.UTC(fields.year, fields.month - 1, fields.day, 12);
|
|
36631
36652
|
return new Intl.DateTimeFormat(locale, { ...options, timeZone: "UTC" }).format(noon);
|
|
36632
36653
|
}
|
|
36654
|
+
var WEEKDAYS_LONG = [
|
|
36655
|
+
"Monday",
|
|
36656
|
+
"Tuesday",
|
|
36657
|
+
"Wednesday",
|
|
36658
|
+
"Thursday",
|
|
36659
|
+
"Friday",
|
|
36660
|
+
"Saturday",
|
|
36661
|
+
"Sunday"
|
|
36662
|
+
];
|
|
36633
36663
|
var TOKENS = {
|
|
36634
36664
|
yyyy: (f) => pad(f.year, 4),
|
|
36665
|
+
EEEE: (f) => nameOf({
|
|
36666
|
+
fields: f,
|
|
36667
|
+
options: { weekday: "long" },
|
|
36668
|
+
fallback: WEEKDAYS_LONG[f.weekday - 1] ?? ""
|
|
36669
|
+
}),
|
|
36635
36670
|
EEE: (f) => nameOf({
|
|
36636
36671
|
fields: f,
|
|
36637
36672
|
options: { weekday: "short" },
|
|
@@ -36955,7 +36990,7 @@ function flagText({
|
|
|
36955
36990
|
}
|
|
36956
36991
|
|
|
36957
36992
|
// src/rules/cli-version.rules.ts
|
|
36958
|
-
var STAMPED = "0.1.
|
|
36993
|
+
var STAMPED = "0.1.82";
|
|
36959
36994
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36960
36995
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36961
36996
|
}
|
|
@@ -36977,7 +37012,7 @@ var ProfileMigratedError = class extends Error {
|
|
|
36977
37012
|
};
|
|
36978
37013
|
|
|
36979
37014
|
// src/services/session.service.ts
|
|
36980
|
-
import { readFile as
|
|
37015
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
36981
37016
|
|
|
36982
37017
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
|
|
36983
37018
|
var external_exports = {};
|
|
@@ -39792,9 +39827,9 @@ var asciiTabOrNewline = /[\t\n\r]/g;
|
|
|
39792
39827
|
function stripTabAndNewline(value) {
|
|
39793
39828
|
return value.replace(asciiTabOrNewline, "");
|
|
39794
39829
|
}
|
|
39795
|
-
function urlHostnameOk(url2,
|
|
39796
|
-
|
|
39797
|
-
return
|
|
39830
|
+
function urlHostnameOk(url2, hostname8) {
|
|
39831
|
+
hostname8.lastIndex = 0;
|
|
39832
|
+
return hostname8.test(url2.hostname);
|
|
39798
39833
|
}
|
|
39799
39834
|
function urlProtocolOk(url2, protocol) {
|
|
39800
39835
|
protocol.lastIndex = 0;
|
|
@@ -57736,10 +57771,10 @@ var HandledErrorRuntime = class _HandledErrorRuntime extends Error {
|
|
|
57736
57771
|
}
|
|
57737
57772
|
};
|
|
57738
57773
|
function handledErrorConstructor() {
|
|
57739
|
-
const
|
|
57740
|
-
const existing =
|
|
57774
|
+
const scope3 = globalThis;
|
|
57775
|
+
const existing = scope3[HANDLED_ERROR_RUNTIME];
|
|
57741
57776
|
if (existing) return existing;
|
|
57742
|
-
Object.defineProperty(
|
|
57777
|
+
Object.defineProperty(scope3, HANDLED_ERROR_RUNTIME, {
|
|
57743
57778
|
configurable: false,
|
|
57744
57779
|
enumerable: false,
|
|
57745
57780
|
value: HandledErrorRuntime,
|
|
@@ -58902,10 +58937,10 @@ var MIRRORED_KEY_SEGMENT = "mirrored";
|
|
|
58902
58937
|
function mirroredQueryKey({
|
|
58903
58938
|
path,
|
|
58904
58939
|
workspaceId,
|
|
58905
|
-
scope:
|
|
58940
|
+
scope: scope3
|
|
58906
58941
|
}) {
|
|
58907
58942
|
const key = [path.split("."), workspaceId, MIRRORED_KEY_SEGMENT];
|
|
58908
|
-
return
|
|
58943
|
+
return scope3 === void 0 ? key : [...key, scope3];
|
|
58909
58944
|
}
|
|
58910
58945
|
function contractBuilder(namespace, members3) {
|
|
58911
58946
|
const member = (name3, kind2, read4 = {}) => ({
|
|
@@ -59656,6 +59691,7 @@ var VaultShareApprovalSlot = vaultUi.component("shareApproval");
|
|
|
59656
59691
|
var VaultDeviceApprovalSlot = vaultUi.component("deviceApproval");
|
|
59657
59692
|
var VaultMachineKeyApprovalSlot = vaultUi.component("machineKeyApproval");
|
|
59658
59693
|
var VaultPasskeyStepSlot = vaultUi.component("passkeyStep");
|
|
59694
|
+
var VaultPasskeyConfirmSlot = vaultUi.component("passkeyConfirm");
|
|
59659
59695
|
var VaultNavSlot = vaultUi.component("nav");
|
|
59660
59696
|
var answerSealedApprovalInputSchemaDefinition = external_exports.object({
|
|
59661
59697
|
workspaceId: external_exports.string().min(1),
|
|
@@ -61706,6 +61742,22 @@ var gifResultsSchemaDefinition = external_exports.object({
|
|
|
61706
61742
|
});
|
|
61707
61743
|
var gifResultsSchema = gifResultsSchemaDefinition;
|
|
61708
61744
|
|
|
61745
|
+
// ../../modules/chat/contract/src/chat.images.ts
|
|
61746
|
+
var MIRROR_AVATAR_PATTERN = /^\/api\/chat\/mirror-avatars\/[A-Za-z0-9_-]{1,64}\/[A-Za-z0-9_-]{1,64}\/[A-Za-z0-9_-]{1,64}$/;
|
|
61747
|
+
function isMirrorAvatarPath(value) {
|
|
61748
|
+
return MIRROR_AVATAR_PATTERN.test(value);
|
|
61749
|
+
}
|
|
61750
|
+
var mirrorAvatarParamsSchemaDefinition = external_exports.object({
|
|
61751
|
+
workspaceId: external_exports.string().min(1).max(64),
|
|
61752
|
+
channelId: external_exports.string().min(1).max(64),
|
|
61753
|
+
fileId: external_exports.string().min(1).max(64)
|
|
61754
|
+
});
|
|
61755
|
+
var externalImageParamsSchemaDefinition = external_exports.object({ workspaceId: external_exports.string().min(1).max(64) });
|
|
61756
|
+
var externalImageQuerySchemaDefinition = external_exports.object({
|
|
61757
|
+
u: external_exports.string().min(1).max(2e3),
|
|
61758
|
+
sig: external_exports.string().max(100).default("")
|
|
61759
|
+
});
|
|
61760
|
+
|
|
61709
61761
|
// ../../modules/chat/contract/src/chat.layout.ts
|
|
61710
61762
|
var LAYOUT_BLOCKS_MAX = 50;
|
|
61711
61763
|
var LAYOUT_TEXT_MAX = 3e3;
|
|
@@ -62091,6 +62143,12 @@ var boxSchema = external_exports.object({
|
|
|
62091
62143
|
width: external_exports.number().int().positive(),
|
|
62092
62144
|
height: external_exports.number().int().positive()
|
|
62093
62145
|
});
|
|
62146
|
+
var ATTACHMENT_TRANSCRIPT_MAX = 2e4;
|
|
62147
|
+
var attachmentTranscriptSchemaDefinition = external_exports.object({
|
|
62148
|
+
text: external_exports.string().max(ATTACHMENT_TRANSCRIPT_MAX),
|
|
62149
|
+
state: external_exports.enum(["pending", "ready", "failed", "unavailable"]),
|
|
62150
|
+
source: external_exports.enum(["live", "final"])
|
|
62151
|
+
});
|
|
62094
62152
|
var attachmentSchemaDefinition = external_exports.object({
|
|
62095
62153
|
id: idSchema4,
|
|
62096
62154
|
fileName: external_exports.string(),
|
|
@@ -62108,7 +62166,9 @@ var attachmentSchemaDefinition = external_exports.object({
|
|
|
62108
62166
|
preview: boxSchema.nullable(),
|
|
62109
62167
|
/** The first lines of a text, markdown or code file. */
|
|
62110
62168
|
previewText: external_exports.string().nullable(),
|
|
62111
|
-
previewTruncated: external_exports.boolean()
|
|
62169
|
+
previewTruncated: external_exports.boolean(),
|
|
62170
|
+
/** An audio file's transcript; null for other files and audio from before transcripts. */
|
|
62171
|
+
transcript: attachmentTranscriptSchemaDefinition.nullable().default(null)
|
|
62112
62172
|
});
|
|
62113
62173
|
var attachmentSchema = attachmentSchemaDefinition;
|
|
62114
62174
|
var reactionSchemaDefinition = external_exports.object({
|
|
@@ -62146,7 +62206,8 @@ var messageOriginSchemaDefinition = external_exports.object({
|
|
|
62146
62206
|
var MIRROR_PEERS_MAX = 9;
|
|
62147
62207
|
var mirrorPeerSchemaDefinition = external_exports.object({
|
|
62148
62208
|
name: external_exports.string().min(1).max(120),
|
|
62149
|
-
|
|
62209
|
+
/** An address on another host, or a stored photo's address from `mirrorAvatarPathOf`. */
|
|
62210
|
+
avatarUrl: external_exports.union([external_exports.url().max(500), external_exports.string().max(500).refine(isMirrorAvatarPath)]).nullable().default(null),
|
|
62150
62211
|
personId: external_exports.string().min(1).max(64).nullable().optional()
|
|
62151
62212
|
});
|
|
62152
62213
|
var conversationMirrorSchemaDefinition = external_exports.object({
|
|
@@ -62405,6 +62466,14 @@ var failureCardSchemaDefinition = external_exports.object({
|
|
|
62405
62466
|
/** An agent's unanswered turn: Try again sends this person's message to the agent again. */
|
|
62406
62467
|
retry: failureRetrySchemaDefinition.optional()
|
|
62407
62468
|
});
|
|
62469
|
+
var SCHEDULE_RUN_PROMPT_MAX = 2e3;
|
|
62470
|
+
var scheduleRunCardSchemaDefinition = external_exports.object({
|
|
62471
|
+
type: external_exports.literal("schedule_run"),
|
|
62472
|
+
scheduleId: idSchema4,
|
|
62473
|
+
runId: idSchema4,
|
|
62474
|
+
name: external_exports.string().max(200),
|
|
62475
|
+
prompt: external_exports.string().max(SCHEDULE_RUN_PROMPT_MAX)
|
|
62476
|
+
});
|
|
62408
62477
|
var welcomeCardActionSchema = external_exports.enum(["slides", "connect_agent", "new_channel", "invite"]);
|
|
62409
62478
|
var welcomeCardSchemaDefinition = external_exports.object({
|
|
62410
62479
|
type: external_exports.literal("welcome"),
|
|
@@ -62428,7 +62497,8 @@ var messageCardSchemaDefinition = external_exports.discriminatedUnion("type", [
|
|
|
62428
62497
|
budgetCardSchemaDefinition,
|
|
62429
62498
|
feedCardSchemaDefinition,
|
|
62430
62499
|
failureCardSchemaDefinition,
|
|
62431
|
-
welcomeCardSchemaDefinition
|
|
62500
|
+
welcomeCardSchemaDefinition,
|
|
62501
|
+
scheduleRunCardSchemaDefinition
|
|
62432
62502
|
]);
|
|
62433
62503
|
var messageRefSchemaDefinition = external_exports.object({
|
|
62434
62504
|
/** `conversation` points at a conversation with the agent, by its channel. */
|
|
@@ -62947,6 +63017,20 @@ var postMirroredInputSchemaDefinition = external_exports.object({
|
|
|
62947
63017
|
/** Files the mirror stored in this workspace's files, attached to the message. */
|
|
62948
63018
|
fileIds: external_exports.array(idSchema4).max(10).default([])
|
|
62949
63019
|
});
|
|
63020
|
+
var MIRROR_BATCH_MAX = 500;
|
|
63021
|
+
var postMirroredBatchInputSchemaDefinition = external_exports.object({
|
|
63022
|
+
workspaceId: workspaceIdSchema,
|
|
63023
|
+
channelId: idSchema4,
|
|
63024
|
+
keyOwnerUserId: idSchema4,
|
|
63025
|
+
messages: external_exports.array(
|
|
63026
|
+
postMirroredInputSchemaDefinition.omit({
|
|
63027
|
+
workspaceId: true,
|
|
63028
|
+
channelId: true,
|
|
63029
|
+
keyOwnerUserId: true,
|
|
63030
|
+
threadRootId: true
|
|
63031
|
+
})
|
|
63032
|
+
).min(1).max(MIRROR_BATCH_MAX)
|
|
63033
|
+
});
|
|
62950
63034
|
var updateMirroredInputSchemaDefinition = external_exports.object({
|
|
62951
63035
|
workspaceId: workspaceIdSchema,
|
|
62952
63036
|
messageId: idSchema4,
|
|
@@ -63170,9 +63254,34 @@ var uploadTicketSchema = uploadTicketSchemaDefinition;
|
|
|
63170
63254
|
var completeUploadInputSchemaDefinition = external_exports.object({
|
|
63171
63255
|
workspaceId: workspaceIdSchema,
|
|
63172
63256
|
attachmentId: idSchema4,
|
|
63173
|
-
parts: external_exports.array(external_exports.object({ partNumber: external_exports.number().int().positive(), etag: external_exports.string().min(1).max(200) })).max(1e4).default([])
|
|
63257
|
+
parts: external_exports.array(external_exports.object({ partNumber: external_exports.number().int().positive(), etag: external_exports.string().min(1).max(200) })).max(1e4).default([]),
|
|
63258
|
+
/** What a voice message said as it was recorded; the files worker's transcript replaces it. */
|
|
63259
|
+
liveTranscript: external_exports.string().max(2e4).optional()
|
|
63174
63260
|
});
|
|
63175
63261
|
var completeUploadInputSchema = completeUploadInputSchemaDefinition;
|
|
63262
|
+
var voiceSegmentRefusalSchema = external_exports.enum([
|
|
63263
|
+
"not_configured",
|
|
63264
|
+
"out_of_credit",
|
|
63265
|
+
"too_large",
|
|
63266
|
+
"failed"
|
|
63267
|
+
]);
|
|
63268
|
+
var transcribeVoiceSegmentInputSchemaDefinition = external_exports.object({
|
|
63269
|
+
workspaceId: workspaceIdSchema,
|
|
63270
|
+
channelId: idSchema4,
|
|
63271
|
+
/** The recording's id and the segment's number; the spend entry is keyed on it. */
|
|
63272
|
+
segmentId: external_exports.string().min(1).max(100),
|
|
63273
|
+
contentType: external_exports.string().regex(/^audio\/[a-z0-9.+-]+(;.*)?$/i).max(100),
|
|
63274
|
+
/** At most about 2 MB of audio. */
|
|
63275
|
+
audio: external_exports.string().min(1).max(28e5),
|
|
63276
|
+
/** The end of the text before this segment, so words carry across the cut. */
|
|
63277
|
+
prompt: external_exports.string().max(2e3).optional()
|
|
63278
|
+
});
|
|
63279
|
+
var transcribeVoiceSegmentInputSchema = transcribeVoiceSegmentInputSchemaDefinition;
|
|
63280
|
+
var voiceSegmentTextSchemaDefinition = external_exports.discriminatedUnion("kind", [
|
|
63281
|
+
external_exports.object({ kind: external_exports.literal("text"), text: external_exports.string() }),
|
|
63282
|
+
external_exports.object({ kind: external_exports.literal("refused"), reason: voiceSegmentRefusalSchema })
|
|
63283
|
+
]);
|
|
63284
|
+
var voiceSegmentTextSchema = voiceSegmentTextSchemaDefinition;
|
|
63176
63285
|
var fileInputSchemaDefinition = external_exports.object({
|
|
63177
63286
|
workspaceId: workspaceIdSchema,
|
|
63178
63287
|
attachmentId: idSchema4
|
|
@@ -63639,7 +63748,7 @@ var ChatApi = moduleApi()("chat");
|
|
|
63639
63748
|
var chatConversationsTrpc = defineTrpcContract("chat").query("overview", { mirrored: overviewMirror }).withInput(workspaceInputSchema).withOutput(chatOverviewSchema).query("unreadSummary").withInput(external_exports.object({})).withOutput(external_exports.array(workspaceUnreadSchema)).query("browse").withInput(workspaceInputSchema).withOutput(external_exports.array(browsableChannelSchema)).mutation("createChannel").withInput(createChannelInputSchema).withOutput(conversationSchema).mutation("join").withInput(channelInputSchema).withOutput(conversationSchema).mutation("leave").withInput(channelInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("updateChannel").withInput(updateChannelInputSchema).withOutput(conversationSchema).mutation("setDefaultAgent").withInput(setDefaultAgentInputSchema).withOutput(conversationSchema).query("logChannelHint").withInput(channelInputSchema).withOutput(logChannelHintSchema).mutation("dismissLogChannelHint").withInput(channelInputSchema).withOutput(external_exports.object({ dismissed: external_exports.literal(true) })).query("externalNotice").withInput(channelInputSchema).withOutput(externalNoticeSchema).mutation("dismissExternalNotice").withInput(dismissExternalNoticeInputSchema).withOutput(externalNoticeSchema).mutation("archiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("unarchiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("addMembers").withInput(addMembersInputSchema).withOutput(conversationSchema).query("channelGroups").withInput(channelInputSchema).withOutput(channelGroupsSchema).mutation("addChannelGroup").withInput(channelGroupInputSchema).withOutput(channelGroupsSchema).mutation("removeChannelGroup").withInput(channelGroupInputSchema).withOutput(channelGroupsSchema).mutation("removeMember").withInput(removeMemberInputSchema).withOutput(conversationSchema).mutation("openDirect").withInput(openDirectInputSchema).withOutput(conversationSchema).query("conversation").withInput(channelInputSchema).withOutput(conversationSchema).build();
|
|
63640
63749
|
var chatChannelRolesTrpc = defineTrpcContract("chat").mutation("setChannelRole").withInput(setChannelRoleInputSchema).withOutput(conversationSchema).mutation("extendChannel").withInput(extendChannelInputSchema).withOutput(conversationSchema).build();
|
|
63641
63750
|
var chatMessagesTrpc = defineTrpcContract("chat").query("history", { mirrored: historyMirror }).withInput(historyInputSchema).withOutput(historyPageSchema).query("thread").withInput(messageInputSchema).withOutput(threadSchema).query("message").withInput(messageInputSchema).withOutput(messageSchema).mutation("post").withInput(postMessageInputSchema).withOutput(messageSchema).mutation("forward").withInput(forwardMessageInputSchema).withOutput(messageSchema).mutation("addMentioned").withInput(addMentionedInputSchema).withOutput(messageSchema).mutation("edit").withInput(editMessageInputSchema).withOutput(messageSchema).mutation("delete").withInput(messageInputSchema).withOutput(messageSchema).mutation("remove").withInput(messageInputSchema).withOutput(messageSchema).mutation("react").withInput(reactInputSchema).withOutput(messageSchema).mutation("signalTyping").withInput(signalTypingInputSchema).withOutput(external_exports.object({ sent: external_exports.literal(true) })).mutation("markRead").withInput(markReadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).mutation("markUnread").withInput(markUnreadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).query("search").withInput(searchInputSchema).withOutput(searchResultSchema).build();
|
|
63642
|
-
var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).mutation("abortUpload").withInput(fileInputSchema).withOutput(external_exports.object({ aborted: external_exports.literal(true) })).query("fileLink").withInput(fileLinkInputSchema).withOutput(fileLinkSchema).query("channelFiles").withInput(channelFilesInputSchema).withOutput(channelFilesSchema).mutation("renameAttachment").withInput(renameAttachmentInputSchema).withOutput(attachmentSchema).mutation("hideUnfurl").withInput(hideUnfurlInputSchema).withOutput(messageSchema).query("unfurlImage").withInput(unfurlImageInputSchema).withOutput(fileLinkSchema).query("searchGifs").withInput(searchGifsInputSchema).withOutput(gifResultsSchema).build();
|
|
63751
|
+
var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).mutation("transcribeVoiceSegment").withInput(transcribeVoiceSegmentInputSchema).withOutput(voiceSegmentTextSchema).mutation("abortUpload").withInput(fileInputSchema).withOutput(external_exports.object({ aborted: external_exports.literal(true) })).query("fileLink").withInput(fileLinkInputSchema).withOutput(fileLinkSchema).query("channelFiles").withInput(channelFilesInputSchema).withOutput(channelFilesSchema).mutation("renameAttachment").withInput(renameAttachmentInputSchema).withOutput(attachmentSchema).mutation("hideUnfurl").withInput(hideUnfurlInputSchema).withOutput(messageSchema).query("unfurlImage").withInput(unfurlImageInputSchema).withOutput(fileLinkSchema).query("searchGifs").withInput(searchGifsInputSchema).withOutput(gifResultsSchema).build();
|
|
63643
63752
|
var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads", { mirrored: threadsMirror }).withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
|
|
63644
63753
|
var chatSessionTrpc = defineTrpcContract("chat").mutation("realtimeToken").withInput(workspaceInputSchema).withOutput(realtimeTokenSchema).query("drafts").withInput(workspaceInputSchema).withOutput(draftListSchema).mutation("saveDraft").withInput(saveDraftInputSchema).withOutput(draftSavedSchema).mutation("deleteDraft").withInput(deleteDraftInputSchema).withOutput(draftSavedSchema).query("sent").withInput(listSentInputSchema).withOutput(sentPageSchema).query("sidebarLayout").withInput(workspaceInputSchema).withOutput(sidebarLayoutSchema).mutation("editSidebar").withInput(editSidebarInputSchema).withOutput(sidebarLayoutSchema).query("readerPreferences").withInput(workspaceInputSchema).withOutput(readerPreferencesSchema).mutation("setReaderPreferences").withInput(setReaderPreferencesInputSchema).withOutput(readerPreferencesSchema).mutation("star").withInput(starInputSchema).withOutput(starStatusSchema).query("starred").withInput(workspaceInputSchema).withOutput(starredListSchema).mutation("scrubSecrets").withInput(scrubChatInputSchema).withOutput(chatScrubReportSchema).mutation("restoreScrubbed").withInput(messageInputSchema).withOutput(messageSchema).build();
|
|
63645
63754
|
var chatScheduledTrpc = defineTrpcContract("chat").mutation("scheduleMessage").withInput(scheduleMessageInputSchema).withOutput(scheduledMessageSchema).query("scheduled").withInput(listScheduledInputSchema).withOutput(scheduledListSchema).mutation("editScheduled").withInput(editScheduledInputSchema).withOutput(scheduledMessageSchema).mutation("sendScheduledNow").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).mutation("cancelScheduled").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).build();
|
|
@@ -64417,7 +64526,9 @@ var messagePostedPayloadSchemaDefinition = external_exports.object({
|
|
|
64417
64526
|
/** A forward's quote; null once the forward is deleted. */
|
|
64418
64527
|
forward: postedForwardSchemaDefinition.nullable().optional(),
|
|
64419
64528
|
/** The card this message carries, such as an approval: a system card, not something said. */
|
|
64420
|
-
cardType: external_exports.string().optional()
|
|
64529
|
+
cardType: external_exports.string().optional(),
|
|
64530
|
+
/** Mirrored history in a batch: no live publication of its own, its conversation reads again. */
|
|
64531
|
+
quiet: external_exports.boolean().optional()
|
|
64421
64532
|
});
|
|
64422
64533
|
var messageChangedPayloadSchemaDefinition = external_exports.object({
|
|
64423
64534
|
workspaceId: external_exports.string().min(1),
|
|
@@ -64620,6 +64731,7 @@ var ChatExternalPersonCardSlot = chatUi.extension("external-person-card");
|
|
|
64620
64731
|
var ChatNewChannelDialogSlot = chatUi.component("new-channel-dialog");
|
|
64621
64732
|
var ChatPeoplePickerSlot = chatUi.component("people-picker");
|
|
64622
64733
|
var ChatAddPeopleDialogSlot = chatUi.component("add-people-dialog");
|
|
64734
|
+
var ChatHandoffComposerSlot = chatUi.component("handoff-composer");
|
|
64623
64735
|
|
|
64624
64736
|
// ../../modules/chat/contract/src/chat.markers.ts
|
|
64625
64737
|
var FILE_MARKER = /<file:([A-Za-z0-9_-]{1,64})>/g;
|
|
@@ -64641,13 +64753,6 @@ function withSlackMarkupAsText(text3) {
|
|
|
64641
64753
|
return withSlackPeopleAsNames(text3).replace(SLACK_DATE_TOKEN, "$1").replace(ANGLE_LINK, (_link, address, label3) => label3 ?? address);
|
|
64642
64754
|
}
|
|
64643
64755
|
|
|
64644
|
-
// ../../modules/chat/contract/src/chat.images.ts
|
|
64645
|
-
var externalImageParamsSchemaDefinition = external_exports.object({ workspaceId: external_exports.string().min(1).max(64) });
|
|
64646
|
-
var externalImageQuerySchemaDefinition = external_exports.object({
|
|
64647
|
-
u: external_exports.string().min(1).max(2e3),
|
|
64648
|
-
sig: external_exports.string().max(100).default("")
|
|
64649
|
-
});
|
|
64650
|
-
|
|
64651
64756
|
// ../../modules/agent/contract/src/agent-access.ts
|
|
64652
64757
|
var idSchema5 = external_exports.string().min(1).max(80);
|
|
64653
64758
|
var agentGranteeSchemaDefinition = external_exports.discriminatedUnion("kind", [
|
|
@@ -65211,7 +65316,9 @@ var setEgressRouteInputDefinition = external_exports.object({
|
|
|
65211
65316
|
route: external_exports.object({
|
|
65212
65317
|
/** The `human_only` connection in the owner's keychain holding host, port and credentials. */
|
|
65213
65318
|
vaultConnectionId: external_exports.string().min(1),
|
|
65214
|
-
domains: external_exports.array(external_exports.string().min(1)).min(1).max(50)
|
|
65319
|
+
domains: external_exports.array(external_exports.string().min(1)).min(1).max(50),
|
|
65320
|
+
/** All web traffic, not only the domains. */
|
|
65321
|
+
all: external_exports.boolean().default(false)
|
|
65215
65322
|
}).nullable()
|
|
65216
65323
|
});
|
|
65217
65324
|
var AgentRuntimeApi = moduleApi()("agent-runtime");
|
|
@@ -68763,6 +68870,7 @@ var callerSearchResultSchemaDefinition = external_exports.object({
|
|
|
68763
68870
|
channels: external_exports.array(external_exports.object({ id: idSchema17, name: external_exports.string() }))
|
|
68764
68871
|
})
|
|
68765
68872
|
});
|
|
68873
|
+
var agentMachineInputSchemaDefinition = external_exports.object({ host: external_exports.string().trim().min(1).max(200) });
|
|
68766
68874
|
var agentActivityInputSchemaDefinition = external_exports.object({
|
|
68767
68875
|
/** The session the report is about, so a resent report is recorded once. */
|
|
68768
68876
|
sessionId: external_exports.string().min(1).max(120),
|
|
@@ -69120,12 +69228,16 @@ var fileAgentTurnInputSchemaDefinition = external_exports.object({
|
|
|
69120
69228
|
notice: external_exports.string().min(1).optional(),
|
|
69121
69229
|
anchor: agentTurnAnchorSchema.optional(),
|
|
69122
69230
|
prompt: external_exports.string().min(1),
|
|
69231
|
+
/** The anchor message's files, staged for the turn as a chat message's are. */
|
|
69232
|
+
attachmentIds: external_exports.array(external_exports.string().min(1)).max(10).optional(),
|
|
69123
69233
|
/** The caller's id for this turn: the same key again files nothing new. */
|
|
69124
69234
|
key: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/)
|
|
69125
69235
|
}).refine((input2) => input2.notice !== void 0 || input2.anchor !== void 0, {
|
|
69126
69236
|
message: "A turn carries a notice to post or the anchor it hangs off"
|
|
69127
69237
|
}).refine((input2) => input2.anchor === void 0 || input2.channelId !== null, {
|
|
69128
69238
|
message: "An anchored turn names the conversation its anchor is in"
|
|
69239
|
+
}).refine((input2) => input2.anchor !== void 0 || (input2.attachmentIds ?? []).length === 0, {
|
|
69240
|
+
message: "Only an anchored turn carries files: they are its anchor message's"
|
|
69129
69241
|
});
|
|
69130
69242
|
|
|
69131
69243
|
// ../../modules/agent/contract/src/agent-removed.ts
|
|
@@ -69847,6 +69959,116 @@ function errorOf({ status: status11, body }) {
|
|
|
69847
69959
|
return error63;
|
|
69848
69960
|
}
|
|
69849
69961
|
|
|
69962
|
+
// src/services/machine-report.service.ts
|
|
69963
|
+
import { createHash } from "node:crypto";
|
|
69964
|
+
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
69965
|
+
import { hostname as hostname3 } from "node:os";
|
|
69966
|
+
import { dirname as dirname3 } from "node:path";
|
|
69967
|
+
|
|
69968
|
+
// src/services/inbox-spool.service.ts
|
|
69969
|
+
import { mkdir as mkdir2, readFile as readFile2, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
|
|
69970
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
69971
|
+
var PUSH_GRACE_MS = 3 * 6e4;
|
|
69972
|
+
var IN_FLIGHT_MS = 35e3;
|
|
69973
|
+
function fileNameOf({ profile }) {
|
|
69974
|
+
return profile.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
69975
|
+
}
|
|
69976
|
+
function statePathOf({
|
|
69977
|
+
context,
|
|
69978
|
+
kind: kind2,
|
|
69979
|
+
profile,
|
|
69980
|
+
extension: extension2 = "json"
|
|
69981
|
+
}) {
|
|
69982
|
+
const directory = join2(dirname2(context.environment.configPath), kind2);
|
|
69983
|
+
return join2(directory, `${fileNameOf({ profile })}.${extension2}`);
|
|
69984
|
+
}
|
|
69985
|
+
async function readSpool({ path }) {
|
|
69986
|
+
return readFile2(path, "utf8").then(
|
|
69987
|
+
(text3) => JSON.parse(text3),
|
|
69988
|
+
() => []
|
|
69989
|
+
);
|
|
69990
|
+
}
|
|
69991
|
+
async function writeSpool({ path, entries }) {
|
|
69992
|
+
await mkdir2(dirname2(path), { recursive: true, mode: 448 });
|
|
69993
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
69994
|
+
await writeFile2(temporary, JSON.stringify(entries), { mode: 384 });
|
|
69995
|
+
await rename2(temporary, path);
|
|
69996
|
+
}
|
|
69997
|
+
async function keepTaken({
|
|
69998
|
+
context,
|
|
69999
|
+
profile,
|
|
70000
|
+
messages,
|
|
70001
|
+
pushed = false
|
|
70002
|
+
}) {
|
|
70003
|
+
if (messages.length === 0) return;
|
|
70004
|
+
const path = statePathOf({ context, kind: "spool", profile });
|
|
70005
|
+
const ids = new Set(messages.map((message2) => message2.messageId));
|
|
70006
|
+
const kept = (await readSpool({ path })).filter((entry) => !ids.has(entry.message.messageId));
|
|
70007
|
+
const now = context.nowMs();
|
|
70008
|
+
const taken = messages.map((message2) => ({
|
|
70009
|
+
message: message2,
|
|
70010
|
+
takenAt: now,
|
|
70011
|
+
...pushed ? { pushedAt: now } : {}
|
|
70012
|
+
}));
|
|
70013
|
+
await writeSpool({ path, entries: [...kept, ...taken] });
|
|
70014
|
+
}
|
|
70015
|
+
async function dropFromSpool({
|
|
70016
|
+
context,
|
|
70017
|
+
profile,
|
|
70018
|
+
messageIds
|
|
70019
|
+
}) {
|
|
70020
|
+
if (messageIds.length === 0) return;
|
|
70021
|
+
const path = statePathOf({ context, kind: "spool", profile });
|
|
70022
|
+
const entries = await readSpool({ path });
|
|
70023
|
+
const ids = new Set(messageIds);
|
|
70024
|
+
const kept = entries.filter((entry) => !ids.has(entry.message.messageId));
|
|
70025
|
+
if (kept.length !== entries.length) await writeSpool({ path, entries: kept });
|
|
70026
|
+
}
|
|
70027
|
+
async function dueFromSpool({
|
|
70028
|
+
context,
|
|
70029
|
+
profile,
|
|
70030
|
+
seen,
|
|
70031
|
+
pushedToo,
|
|
70032
|
+
settledOnly = false
|
|
70033
|
+
}) {
|
|
70034
|
+
const path = statePathOf({ context, kind: "spool", profile });
|
|
70035
|
+
const entries = await readSpool({ path });
|
|
70036
|
+
const pushed = entries.some((entry) => entry.pushedAt !== void 0);
|
|
70037
|
+
const text3 = pushed ? await seen().catch(() => "") : "";
|
|
70038
|
+
const shown2 = entries.filter(
|
|
70039
|
+
(entry) => entry.pushedAt !== void 0 && text3.includes(entry.message.messageId)
|
|
70040
|
+
);
|
|
70041
|
+
await dropFromSpool({
|
|
70042
|
+
context,
|
|
70043
|
+
profile,
|
|
70044
|
+
messageIds: shown2.map((entry) => entry.message.messageId)
|
|
70045
|
+
});
|
|
70046
|
+
const late = context.nowMs() - PUSH_GRACE_MS;
|
|
70047
|
+
const settled2 = context.nowMs() - IN_FLIGHT_MS;
|
|
70048
|
+
return entries.filter((entry) => !shown2.includes(entry)).filter((entry) => !settledOnly || entry.takenAt <= settled2).filter((entry) => entry.pushedAt === void 0 || pushedToo && entry.pushedAt <= late).map((entry) => entry.message);
|
|
70049
|
+
}
|
|
70050
|
+
|
|
70051
|
+
// src/services/machine-report.service.ts
|
|
70052
|
+
async function reportMachine({
|
|
70053
|
+
context,
|
|
70054
|
+
profile,
|
|
70055
|
+
token: token2,
|
|
70056
|
+
client
|
|
70057
|
+
}) {
|
|
70058
|
+
const host2 = hostname3().trim().slice(0, 200);
|
|
70059
|
+
if (!host2) return;
|
|
70060
|
+
const stamp = createHash("sha256").update(`${token2}:${host2}`).digest("hex");
|
|
70061
|
+
const path = statePathOf({ context, kind: "machine", profile });
|
|
70062
|
+
if (await readFile3(path, "utf8").catch(() => "") === stamp) return;
|
|
70063
|
+
try {
|
|
70064
|
+
await client.post("/api/agents/me/machine", { host: host2 });
|
|
70065
|
+
await mkdir3(dirname3(path), { recursive: true, mode: 448 });
|
|
70066
|
+
await writeFile3(path, stamp, { mode: 384 });
|
|
70067
|
+
} catch {
|
|
70068
|
+
return;
|
|
70069
|
+
}
|
|
70070
|
+
}
|
|
70071
|
+
|
|
69850
70072
|
// src/services/session.service.ts
|
|
69851
70073
|
function markMigratedOn({ context, profile }) {
|
|
69852
70074
|
return async ({ notice, link: link2 }) => context.store.markMigrated({ name: profile, migrated: { at: context.nowMs(), link: link2, notice } });
|
|
@@ -69863,7 +70085,7 @@ async function turnTokenOf({ context }) {
|
|
|
69863
70085
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
69864
70086
|
if (pinned) return pinned;
|
|
69865
70087
|
if (!env.LAZE_TURN_FILE) return "";
|
|
69866
|
-
return
|
|
70088
|
+
return readFile4(env.LAZE_TURN_FILE, "utf8").then(
|
|
69867
70089
|
(text3) => text3.trim(),
|
|
69868
70090
|
() => ""
|
|
69869
70091
|
);
|
|
@@ -69896,6 +70118,10 @@ async function signedIn({
|
|
|
69896
70118
|
return { name: chosen.name, profile: chosen.profile, client };
|
|
69897
70119
|
await namingFirst({ client, args });
|
|
69898
70120
|
const turn = await turnTokenOf({ context });
|
|
70121
|
+
if (!turn) {
|
|
70122
|
+
const { name: name3, profile } = chosen;
|
|
70123
|
+
await reportMachine({ context, profile: name3, token: profile.token, client });
|
|
70124
|
+
}
|
|
69899
70125
|
return {
|
|
69900
70126
|
name: chosen.name,
|
|
69901
70127
|
profile: chosen.profile,
|
|
@@ -70130,7 +70356,7 @@ async function copyAgent({
|
|
|
70130
70356
|
}
|
|
70131
70357
|
|
|
70132
70358
|
// src/services/agent-commands.service.ts
|
|
70133
|
-
import { mkdir as
|
|
70359
|
+
import { mkdir as mkdir17, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
|
|
70134
70360
|
import { join as join17, resolve as resolve5 } from "node:path";
|
|
70135
70361
|
|
|
70136
70362
|
// src/rules/agent-profile.rules.ts
|
|
@@ -70919,6 +71145,12 @@ var slackBotCleanupRequestedPayloadSchemaDefinition = external_exports.object({
|
|
|
70919
71145
|
runId: external_exports.string().min(1),
|
|
70920
71146
|
dryRun: external_exports.boolean()
|
|
70921
71147
|
});
|
|
71148
|
+
var slackCacheTrimRequestedPayloadSchemaDefinition = external_exports.object({
|
|
71149
|
+
workspaceId: external_exports.string().min(1),
|
|
71150
|
+
teamId: external_exports.string().min(1),
|
|
71151
|
+
runId: external_exports.string().min(1),
|
|
71152
|
+
scheduledFor: external_exports.number()
|
|
71153
|
+
});
|
|
70922
71154
|
var slackBotCleanupOutcomePayloadSchemaDefinition = external_exports.object({
|
|
70923
71155
|
workspaceId: external_exports.string().min(1),
|
|
70924
71156
|
runId: external_exports.string().min(1),
|
|
@@ -71415,13 +71647,13 @@ function formatSearch({
|
|
|
71415
71647
|
}
|
|
71416
71648
|
|
|
71417
71649
|
// src/services/claude-turn.service.ts
|
|
71418
|
-
import { mkdir as
|
|
71419
|
-
import { dirname as
|
|
71650
|
+
import { mkdir as mkdir5, readFile as readFile7, rm, writeFile as writeFile5 } from "node:fs/promises";
|
|
71651
|
+
import { dirname as dirname5, join as join5 } from "node:path";
|
|
71420
71652
|
|
|
71421
71653
|
// src/services/harness-session.service.ts
|
|
71422
|
-
import { mkdir as
|
|
71423
|
-
import { homedir as homedir2, hostname as
|
|
71424
|
-
import { dirname as
|
|
71654
|
+
import { mkdir as mkdir4, open as open2, readdir, readFile as readFile5, stat, writeFile as writeFile4 } from "node:fs/promises";
|
|
71655
|
+
import { homedir as homedir2, hostname as hostname4 } from "node:os";
|
|
71656
|
+
import { dirname as dirname4, join as join3 } from "node:path";
|
|
71425
71657
|
|
|
71426
71658
|
// src/rules/claude-subagent.rules.ts
|
|
71427
71659
|
function lastCallAtOf({ text: text3, command }) {
|
|
@@ -71553,89 +71785,6 @@ async function claudeProjectOf({
|
|
|
71553
71785
|
return candidates.find((folder) => holds({ folder, inner: context.cwd })) ?? resolve2(context.cwd);
|
|
71554
71786
|
}
|
|
71555
71787
|
|
|
71556
|
-
// src/services/inbox-spool.service.ts
|
|
71557
|
-
import { mkdir as mkdir2, readFile as readFile3, rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
|
|
71558
|
-
import { dirname as dirname2, join as join2 } from "node:path";
|
|
71559
|
-
var PUSH_GRACE_MS = 3 * 6e4;
|
|
71560
|
-
var IN_FLIGHT_MS = 35e3;
|
|
71561
|
-
function fileNameOf({ profile }) {
|
|
71562
|
-
return profile.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
71563
|
-
}
|
|
71564
|
-
function statePathOf({
|
|
71565
|
-
context,
|
|
71566
|
-
kind: kind2,
|
|
71567
|
-
profile,
|
|
71568
|
-
extension: extension2 = "json"
|
|
71569
|
-
}) {
|
|
71570
|
-
const directory = join2(dirname2(context.environment.configPath), kind2);
|
|
71571
|
-
return join2(directory, `${fileNameOf({ profile })}.${extension2}`);
|
|
71572
|
-
}
|
|
71573
|
-
async function readSpool({ path }) {
|
|
71574
|
-
return readFile3(path, "utf8").then(
|
|
71575
|
-
(text3) => JSON.parse(text3),
|
|
71576
|
-
() => []
|
|
71577
|
-
);
|
|
71578
|
-
}
|
|
71579
|
-
async function writeSpool({ path, entries }) {
|
|
71580
|
-
await mkdir2(dirname2(path), { recursive: true, mode: 448 });
|
|
71581
|
-
const temporary = `${path}.${process.pid}.tmp`;
|
|
71582
|
-
await writeFile2(temporary, JSON.stringify(entries), { mode: 384 });
|
|
71583
|
-
await rename2(temporary, path);
|
|
71584
|
-
}
|
|
71585
|
-
async function keepTaken({
|
|
71586
|
-
context,
|
|
71587
|
-
profile,
|
|
71588
|
-
messages,
|
|
71589
|
-
pushed = false
|
|
71590
|
-
}) {
|
|
71591
|
-
if (messages.length === 0) return;
|
|
71592
|
-
const path = statePathOf({ context, kind: "spool", profile });
|
|
71593
|
-
const ids = new Set(messages.map((message2) => message2.messageId));
|
|
71594
|
-
const kept = (await readSpool({ path })).filter((entry) => !ids.has(entry.message.messageId));
|
|
71595
|
-
const now = context.nowMs();
|
|
71596
|
-
const taken = messages.map((message2) => ({
|
|
71597
|
-
message: message2,
|
|
71598
|
-
takenAt: now,
|
|
71599
|
-
...pushed ? { pushedAt: now } : {}
|
|
71600
|
-
}));
|
|
71601
|
-
await writeSpool({ path, entries: [...kept, ...taken] });
|
|
71602
|
-
}
|
|
71603
|
-
async function dropFromSpool({
|
|
71604
|
-
context,
|
|
71605
|
-
profile,
|
|
71606
|
-
messageIds
|
|
71607
|
-
}) {
|
|
71608
|
-
if (messageIds.length === 0) return;
|
|
71609
|
-
const path = statePathOf({ context, kind: "spool", profile });
|
|
71610
|
-
const entries = await readSpool({ path });
|
|
71611
|
-
const ids = new Set(messageIds);
|
|
71612
|
-
const kept = entries.filter((entry) => !ids.has(entry.message.messageId));
|
|
71613
|
-
if (kept.length !== entries.length) await writeSpool({ path, entries: kept });
|
|
71614
|
-
}
|
|
71615
|
-
async function dueFromSpool({
|
|
71616
|
-
context,
|
|
71617
|
-
profile,
|
|
71618
|
-
seen,
|
|
71619
|
-
pushedToo,
|
|
71620
|
-
settledOnly = false
|
|
71621
|
-
}) {
|
|
71622
|
-
const path = statePathOf({ context, kind: "spool", profile });
|
|
71623
|
-
const entries = await readSpool({ path });
|
|
71624
|
-
const pushed = entries.some((entry) => entry.pushedAt !== void 0);
|
|
71625
|
-
const text3 = pushed ? await seen().catch(() => "") : "";
|
|
71626
|
-
const shown2 = entries.filter(
|
|
71627
|
-
(entry) => entry.pushedAt !== void 0 && text3.includes(entry.message.messageId)
|
|
71628
|
-
);
|
|
71629
|
-
await dropFromSpool({
|
|
71630
|
-
context,
|
|
71631
|
-
profile,
|
|
71632
|
-
messageIds: shown2.map((entry) => entry.message.messageId)
|
|
71633
|
-
});
|
|
71634
|
-
const late = context.nowMs() - PUSH_GRACE_MS;
|
|
71635
|
-
const settled2 = context.nowMs() - IN_FLIGHT_MS;
|
|
71636
|
-
return entries.filter((entry) => !shown2.includes(entry)).filter((entry) => !settledOnly || entry.takenAt <= settled2).filter((entry) => entry.pushedAt === void 0 || pushedToo && entry.pushedAt <= late).map((entry) => entry.message);
|
|
71637
|
-
}
|
|
71638
|
-
|
|
71639
71788
|
// src/services/harness-session.service.ts
|
|
71640
71789
|
function sessionOf({
|
|
71641
71790
|
context,
|
|
@@ -71649,7 +71798,7 @@ function sessionOf({
|
|
|
71649
71798
|
harness,
|
|
71650
71799
|
sessionId,
|
|
71651
71800
|
folder: displayFolderOf({ folder, home: inherited.HOME }),
|
|
71652
|
-
host:
|
|
71801
|
+
host: hostname4()
|
|
71653
71802
|
};
|
|
71654
71803
|
}
|
|
71655
71804
|
function forSession({
|
|
@@ -71665,9 +71814,9 @@ async function rememberSession({
|
|
|
71665
71814
|
}) {
|
|
71666
71815
|
if (!session || !claudePid) return;
|
|
71667
71816
|
const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
71668
|
-
await
|
|
71817
|
+
await mkdir4(dirname4(path), { recursive: true, mode: 448 });
|
|
71669
71818
|
const launch = launchEnvOf({ inherited: context.environment.inherited });
|
|
71670
|
-
await
|
|
71819
|
+
await writeFile4(path, JSON.stringify({ ...session, launch }), { mode: 384 });
|
|
71671
71820
|
}
|
|
71672
71821
|
async function currentSessionOf({
|
|
71673
71822
|
context,
|
|
@@ -71686,7 +71835,7 @@ async function currentSessionOf({
|
|
|
71686
71835
|
const nearest = await nearestHarnessOf({ context });
|
|
71687
71836
|
if (!nearest) return void 0;
|
|
71688
71837
|
const path = statePathOf({ context, kind: "sessions", profile: String(nearest.pid) });
|
|
71689
|
-
return
|
|
71838
|
+
return readFile5(path, "utf8").then(
|
|
71690
71839
|
(text3) => JSON.parse(text3),
|
|
71691
71840
|
() => void 0
|
|
71692
71841
|
);
|
|
@@ -71739,11 +71888,11 @@ async function liveElsewhere({
|
|
|
71739
71888
|
asleepCounts = true
|
|
71740
71889
|
}) {
|
|
71741
71890
|
if (await rushKeeps({ context, key, claudePid, asleepCounts })) return true;
|
|
71742
|
-
const folder =
|
|
71891
|
+
const folder = dirname4(statePathOf({ context, kind: "sessions", profile: "x" }));
|
|
71743
71892
|
for (const file3 of await readdir(folder).catch(() => [])) {
|
|
71744
71893
|
const pid = Number(file3.replace(/\.json$/, ""));
|
|
71745
71894
|
if (!pid || pid === claudePid || !context.processes.alive(pid)) continue;
|
|
71746
|
-
const noted = await
|
|
71895
|
+
const noted = await readFile5(join3(folder, file3), "utf8").then(
|
|
71747
71896
|
(text3) => JSON.parse(text3),
|
|
71748
71897
|
() => void 0
|
|
71749
71898
|
);
|
|
@@ -71791,7 +71940,7 @@ async function runsInSubagent({ context, command }) {
|
|
|
71791
71940
|
if (!sessionId) return false;
|
|
71792
71941
|
const { path } = await claudeTranscriptOf({ context, sessionId });
|
|
71793
71942
|
if (!path) return false;
|
|
71794
|
-
const folder = join3(
|
|
71943
|
+
const folder = join3(dirname4(path), sessionId, "subagents");
|
|
71795
71944
|
const files2 = await readdir(folder).catch(() => []);
|
|
71796
71945
|
const subagents = await Promise.all(
|
|
71797
71946
|
files2.filter((file3) => file3.endsWith(".jsonl")).map(
|
|
@@ -71855,13 +72004,13 @@ async function notBoundNotice({
|
|
|
71855
72004
|
}
|
|
71856
72005
|
const key = session ? sessionKeyOf({ session }) : "unknown";
|
|
71857
72006
|
const path = statePathOf({ context, kind: "told", profile: key });
|
|
71858
|
-
const told = await
|
|
72007
|
+
const told = await readFile5(path, "utf8").then(
|
|
71859
72008
|
() => true,
|
|
71860
72009
|
() => false
|
|
71861
72010
|
);
|
|
71862
72011
|
if (told) return { notice: void 0 };
|
|
71863
|
-
await
|
|
71864
|
-
await
|
|
72012
|
+
await mkdir4(dirname4(path), { recursive: true, mode: 448 });
|
|
72013
|
+
await writeFile4(path, String(context.nowMs()), { mode: 384 });
|
|
71865
72014
|
const agent3 = (await context.store.read()).profiles[profile]?.name;
|
|
71866
72015
|
return {
|
|
71867
72016
|
notice: notBoundText({ meta: meta3, agent: agent3, configPath: context.environment.configPath })
|
|
@@ -71869,7 +72018,7 @@ async function notBoundNotice({
|
|
|
71869
72018
|
}
|
|
71870
72019
|
|
|
71871
72020
|
// src/services/plugin-hook.service.ts
|
|
71872
|
-
import { readFile as
|
|
72021
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
71873
72022
|
import { join as join4 } from "node:path";
|
|
71874
72023
|
async function agentProfileHere({
|
|
71875
72024
|
context,
|
|
@@ -71892,7 +72041,7 @@ async function agentProfileHere({
|
|
|
71892
72041
|
async function projectHooksHere({ context }) {
|
|
71893
72042
|
const directory = context.environment.inherited.CLAUDE_PROJECT_DIR || context.cwd;
|
|
71894
72043
|
const path = join4(directory, ".claude", "settings.local.json");
|
|
71895
|
-
return
|
|
72044
|
+
return readFile6(path, "utf8").then(
|
|
71896
72045
|
(text3) => hasLazeHooks({ settings: JSON.parse(text3) }),
|
|
71897
72046
|
() => false
|
|
71898
72047
|
);
|
|
@@ -71913,10 +72062,10 @@ async function pluginHookArgs({
|
|
|
71913
72062
|
var PRE_TOOL_TIMEOUT_MS = 3e3;
|
|
71914
72063
|
function statePath({ context, agent: agent3 }) {
|
|
71915
72064
|
const safe = agent3.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
71916
|
-
return join5(
|
|
72065
|
+
return join5(dirname5(context.environment.configPath), "turns", `${safe}.json`);
|
|
71917
72066
|
}
|
|
71918
72067
|
async function readState({ context, agent: agent3 }) {
|
|
71919
|
-
return
|
|
72068
|
+
return readFile7(statePath({ context, agent: agent3 }), "utf8").then(
|
|
71920
72069
|
(text3) => JSON.parse(text3),
|
|
71921
72070
|
() => void 0
|
|
71922
72071
|
);
|
|
@@ -71952,8 +72101,8 @@ async function turnStarted({
|
|
|
71952
72101
|
await beat({ client, state: before, working: false }).catch(() => void 0);
|
|
71953
72102
|
}
|
|
71954
72103
|
const path = statePath({ context, agent: agent3 });
|
|
71955
|
-
await
|
|
71956
|
-
await
|
|
72104
|
+
await mkdir5(dirname5(path), { recursive: true, mode: 448 });
|
|
72105
|
+
await writeFile5(path, JSON.stringify(state));
|
|
71957
72106
|
await beat({ client, state, working: true }).catch(() => void 0);
|
|
71958
72107
|
}
|
|
71959
72108
|
async function turnEnded({
|
|
@@ -72011,7 +72160,7 @@ async function preToolHook({ context, args }) {
|
|
|
72011
72160
|
}
|
|
72012
72161
|
|
|
72013
72162
|
// src/services/message-files.service.ts
|
|
72014
|
-
import { readFile as
|
|
72163
|
+
import { readFile as readFile8, stat as stat2 } from "node:fs/promises";
|
|
72015
72164
|
import { basename as basename3, resolve as resolve3 } from "node:path";
|
|
72016
72165
|
|
|
72017
72166
|
// src/rules/file-types.rules.ts
|
|
@@ -72140,7 +72289,7 @@ async function local({ full }) {
|
|
|
72140
72289
|
return {
|
|
72141
72290
|
fileName,
|
|
72142
72291
|
contentType: contentTypeOf(fileName),
|
|
72143
|
-
bytes: new Uint8Array(await
|
|
72292
|
+
bytes: new Uint8Array(await readFile8(full))
|
|
72144
72293
|
};
|
|
72145
72294
|
}
|
|
72146
72295
|
async function attachmentIdsOf({
|
|
@@ -72763,13 +72912,13 @@ function channelLabelIn(channel) {
|
|
|
72763
72912
|
}
|
|
72764
72913
|
|
|
72765
72914
|
// src/services/claude-wait.service.ts
|
|
72766
|
-
import { readFile as
|
|
72767
|
-
import { dirname as
|
|
72915
|
+
import { readFile as readFile14, rm as rm4, writeFile as writeFile11, mkdir as mkdir12 } from "node:fs/promises";
|
|
72916
|
+
import { dirname as dirname13 } from "node:path";
|
|
72768
72917
|
|
|
72769
72918
|
// src/services/connect-service.service.ts
|
|
72770
|
-
import { createHash } from "node:crypto";
|
|
72771
|
-
import { mkdir as
|
|
72772
|
-
import { dirname as
|
|
72919
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
72920
|
+
import { mkdir as mkdir11, rm as rm3, writeFile as writeFile10 } from "node:fs/promises";
|
|
72921
|
+
import { dirname as dirname12, join as join13 } from "node:path";
|
|
72773
72922
|
|
|
72774
72923
|
// src/rules/connect-service.rules.ts
|
|
72775
72924
|
function systemdWordOf(word3) {
|
|
@@ -72891,9 +73040,9 @@ function rolloutEventOf({
|
|
|
72891
73040
|
}
|
|
72892
73041
|
|
|
72893
73042
|
// src/services/connect-delivery.service.ts
|
|
72894
|
-
import { mkdir as
|
|
72895
|
-
import { homedir as homedir3, hostname as
|
|
72896
|
-
import { dirname as
|
|
73043
|
+
import { mkdir as mkdir10, readFile as readFile13, rename as rename3, rm as rm2, stat as stat4, writeFile as writeFile9 } from "node:fs/promises";
|
|
73044
|
+
import { homedir as homedir3, hostname as hostname5 } from "node:os";
|
|
73045
|
+
import { dirname as dirname11, join as join12 } from "node:path";
|
|
72897
73046
|
|
|
72898
73047
|
// src/services/codex-turn-watch.service.ts
|
|
72899
73048
|
import { open as open3, readdir as readdir2 } from "node:fs/promises";
|
|
@@ -72998,8 +73147,8 @@ var CodexTurnWatch = class _CodexTurnWatch {
|
|
|
72998
73147
|
};
|
|
72999
73148
|
|
|
73000
73149
|
// src/services/mcp-relay.service.ts
|
|
73001
|
-
import { chmod as chmod2, mkdir as
|
|
73002
|
-
import { dirname as
|
|
73150
|
+
import { chmod as chmod2, mkdir as mkdir6, readFile as readFile9, writeFile as writeFile6 } from "node:fs/promises";
|
|
73151
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
73003
73152
|
|
|
73004
73153
|
// ../../node_modules/.pnpm/ws@8.21.3_bufferutil@4.1.0/node_modules/ws/wrapper.mjs
|
|
73005
73154
|
var import_stream = __toESM(require_stream(), 1);
|
|
@@ -73335,11 +73484,11 @@ var STOPS = /* @__PURE__ */ new Map([
|
|
|
73335
73484
|
[CONNECTOR_RELAY_CLOSE.replaced.code, "another relay for this server took over"]
|
|
73336
73485
|
]);
|
|
73337
73486
|
function mcpRelaysPathOf({ context }) {
|
|
73338
|
-
return join7(
|
|
73487
|
+
return join7(dirname6(context.environment.configPath), "connect", "mcp-relays.json");
|
|
73339
73488
|
}
|
|
73340
73489
|
async function readMcpRelays({ context }) {
|
|
73341
73490
|
try {
|
|
73342
|
-
return JSON.parse(await
|
|
73491
|
+
return JSON.parse(await readFile9(mcpRelaysPathOf({ context }), "utf8"));
|
|
73343
73492
|
} catch {
|
|
73344
73493
|
return {};
|
|
73345
73494
|
}
|
|
@@ -73349,8 +73498,8 @@ async function saveMcpRelays({
|
|
|
73349
73498
|
relays
|
|
73350
73499
|
}) {
|
|
73351
73500
|
const path = mcpRelaysPathOf({ context });
|
|
73352
|
-
await
|
|
73353
|
-
await
|
|
73501
|
+
await mkdir6(dirname6(path), { recursive: true, mode: 448 });
|
|
73502
|
+
await writeFile6(path, `${JSON.stringify(relays, null, 2)}
|
|
73354
73503
|
`, { mode: 384 });
|
|
73355
73504
|
await chmod2(path, 384);
|
|
73356
73505
|
}
|
|
@@ -73502,8 +73651,8 @@ var McpRelayLoops = class _McpRelayLoops {
|
|
|
73502
73651
|
};
|
|
73503
73652
|
|
|
73504
73653
|
// src/services/openclaw-relay.service.ts
|
|
73505
|
-
import { chmod as chmod3, mkdir as
|
|
73506
|
-
import { dirname as
|
|
73654
|
+
import { chmod as chmod3, mkdir as mkdir7, readFile as readFile10, writeFile as writeFile7 } from "node:fs/promises";
|
|
73655
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
73507
73656
|
|
|
73508
73657
|
// ../../modules/openclaw/contract/src/openclaw.ts
|
|
73509
73658
|
var workspaceIdSchema18 = external_exports.string().min(1);
|
|
@@ -73724,11 +73873,11 @@ var STOPS2 = /* @__PURE__ */ new Map([
|
|
|
73724
73873
|
[OPENCLAW_RELAY_CLOSE.replaced.code, "another relay for this gateway took over"]
|
|
73725
73874
|
]);
|
|
73726
73875
|
function relaysPathOf({ context }) {
|
|
73727
|
-
return join8(
|
|
73876
|
+
return join8(dirname7(context.environment.configPath), "connect", "openclaw-relays.json");
|
|
73728
73877
|
}
|
|
73729
73878
|
async function readRelays({ context }) {
|
|
73730
73879
|
try {
|
|
73731
|
-
return JSON.parse(await
|
|
73880
|
+
return JSON.parse(await readFile10(relaysPathOf({ context }), "utf8"));
|
|
73732
73881
|
} catch {
|
|
73733
73882
|
return {};
|
|
73734
73883
|
}
|
|
@@ -73738,8 +73887,8 @@ async function saveRelays({
|
|
|
73738
73887
|
relays
|
|
73739
73888
|
}) {
|
|
73740
73889
|
const path = relaysPathOf({ context });
|
|
73741
|
-
await
|
|
73742
|
-
await
|
|
73890
|
+
await mkdir7(dirname7(path), { recursive: true, mode: 448 });
|
|
73891
|
+
await writeFile7(path, `${JSON.stringify(relays, null, 2)}
|
|
73743
73892
|
`, { mode: 384 });
|
|
73744
73893
|
await chmod3(path, 384);
|
|
73745
73894
|
}
|
|
@@ -73924,12 +74073,12 @@ var RelayLoops = class _RelayLoops {
|
|
|
73924
74073
|
};
|
|
73925
74074
|
|
|
73926
74075
|
// src/services/rush-listeners.service.ts
|
|
73927
|
-
import { readFile as
|
|
73928
|
-
import { dirname as
|
|
74076
|
+
import { readFile as readFile12, readdir as readdir3, stat as stat3 } from "node:fs/promises";
|
|
74077
|
+
import { dirname as dirname9, join as join10 } from "node:path";
|
|
73929
74078
|
|
|
73930
74079
|
// src/services/rush-host.service.ts
|
|
73931
|
-
import { mkdir as
|
|
73932
|
-
import { dirname as
|
|
74080
|
+
import { mkdir as mkdir8, readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
|
|
74081
|
+
import { dirname as dirname8, join as join9 } from "node:path";
|
|
73933
74082
|
async function rushAboveOf({
|
|
73934
74083
|
context,
|
|
73935
74084
|
from = context.processes.pid
|
|
@@ -73943,7 +74092,7 @@ async function rushAboveOf({
|
|
|
73943
74092
|
return void 0;
|
|
73944
74093
|
}
|
|
73945
74094
|
function guardPathOf({ context, claudePid }) {
|
|
73946
|
-
return join9(
|
|
74095
|
+
return join9(dirname8(context.environment.configPath), "rush-guards", `${claudePid}.json`);
|
|
73947
74096
|
}
|
|
73948
74097
|
async function startRushGuard({
|
|
73949
74098
|
context,
|
|
@@ -73956,7 +74105,7 @@ async function startRushGuard({
|
|
|
73956
74105
|
if (holder && context.processes.alive(holder.pid)) return;
|
|
73957
74106
|
const flags2 = ["--profile", profile, "--claude-pid", String(claudePid), "--rush-id", rush.id];
|
|
73958
74107
|
const argv = [...context.program, "hook", "rush-wake", ...flags2, "--rush-program", rush.program];
|
|
73959
|
-
const logPath = join9(
|
|
74108
|
+
const logPath = join9(dirname8(context.environment.configPath), "rush-guards", "guard.log");
|
|
73960
74109
|
context.processes.spawnDetached({ argv: ["sh", "-c", '"$@" &', "sh", ...argv], logPath });
|
|
73961
74110
|
}
|
|
73962
74111
|
async function claimRushGuard({
|
|
@@ -73967,12 +74116,12 @@ async function claimRushGuard({
|
|
|
73967
74116
|
const holder = await guardHolderOf({ path });
|
|
73968
74117
|
const self2 = context.processes.pid;
|
|
73969
74118
|
if (holder && holder.pid !== self2 && context.processes.alive(holder.pid)) return false;
|
|
73970
|
-
await
|
|
73971
|
-
await
|
|
74119
|
+
await mkdir8(dirname8(path), { recursive: true, mode: 448 });
|
|
74120
|
+
await writeFile8(path, JSON.stringify({ pid: self2, claudePid }), { mode: 384 });
|
|
73972
74121
|
return true;
|
|
73973
74122
|
}
|
|
73974
74123
|
function guardHolderOf({ path }) {
|
|
73975
|
-
return
|
|
74124
|
+
return readFile11(path, "utf8").then(
|
|
73976
74125
|
(text3) => JSON.parse(text3),
|
|
73977
74126
|
() => void 0
|
|
73978
74127
|
);
|
|
@@ -73980,13 +74129,13 @@ function guardHolderOf({ path }) {
|
|
|
73980
74129
|
|
|
73981
74130
|
// src/services/rush-listeners.service.ts
|
|
73982
74131
|
async function jsonOf(path) {
|
|
73983
|
-
return
|
|
74132
|
+
return readFile12(path, "utf8").then(
|
|
73984
74133
|
(text3) => JSON.parse(text3),
|
|
73985
74134
|
() => void 0
|
|
73986
74135
|
);
|
|
73987
74136
|
}
|
|
73988
74137
|
async function notesOf({ context }) {
|
|
73989
|
-
const folder =
|
|
74138
|
+
const folder = dirname9(statePathOf({ context, kind: "sessions", profile: "x" }));
|
|
73990
74139
|
const files2 = await readdir3(folder).catch(() => []);
|
|
73991
74140
|
const notes = await Promise.all(
|
|
73992
74141
|
files2.map(async (file3) => {
|
|
@@ -74072,8 +74221,8 @@ async function rearmRushGuards({ context }) {
|
|
|
74072
74221
|
}
|
|
74073
74222
|
|
|
74074
74223
|
// src/services/rush-watchdog.service.ts
|
|
74075
|
-
import { appendFile, mkdir as
|
|
74076
|
-
import { dirname as
|
|
74224
|
+
import { appendFile, mkdir as mkdir9 } from "node:fs/promises";
|
|
74225
|
+
import { dirname as dirname10, join as join11 } from "node:path";
|
|
74077
74226
|
var UNDELIVERED_AFTER_MS = 6e4;
|
|
74078
74227
|
var CHECK_TIMEOUT_MS = 5e3;
|
|
74079
74228
|
function clientOf({ context, profile }) {
|
|
@@ -74102,12 +74251,12 @@ function boundAwayOf({ waiting, key }) {
|
|
|
74102
74251
|
return `${sessionLabelOf(bound)} (${bound.harness}:${bound.sessionId})`;
|
|
74103
74252
|
}
|
|
74104
74253
|
async function logDelivery({ context, line }) {
|
|
74105
|
-
const folder = join11(
|
|
74254
|
+
const folder = join11(dirname10(context.environment.configPath), "connect");
|
|
74106
74255
|
const at = Temporal3.Instant.fromEpochMilliseconds(context.nowMs());
|
|
74107
74256
|
const stamped = `${at.toString({ smallestUnit: "second" })} ${line}
|
|
74108
74257
|
`;
|
|
74109
74258
|
context.out(stamped);
|
|
74110
|
-
await
|
|
74259
|
+
await mkdir9(folder, { recursive: true, mode: 448 });
|
|
74111
74260
|
await appendFile(join11(folder, "delivery.log"), stamped, { mode: 384 });
|
|
74112
74261
|
}
|
|
74113
74262
|
async function claimFor({
|
|
@@ -74184,14 +74333,14 @@ async function watchRushDelivery({
|
|
|
74184
74333
|
|
|
74185
74334
|
// src/services/connect-delivery.service.ts
|
|
74186
74335
|
function connectFolderOf({ context }) {
|
|
74187
|
-
return join12(
|
|
74336
|
+
return join12(dirname11(context.environment.configPath), "connect");
|
|
74188
74337
|
}
|
|
74189
74338
|
function runStatePathOf({ context }) {
|
|
74190
74339
|
return join12(connectFolderOf({ context }), "run.json");
|
|
74191
74340
|
}
|
|
74192
74341
|
async function readJson({ path }) {
|
|
74193
74342
|
try {
|
|
74194
|
-
return JSON.parse(await
|
|
74343
|
+
return JSON.parse(await readFile13(path, "utf8"));
|
|
74195
74344
|
} catch {
|
|
74196
74345
|
return void 0;
|
|
74197
74346
|
}
|
|
@@ -74250,7 +74399,7 @@ async function takeRound({
|
|
|
74250
74399
|
harness: "codex",
|
|
74251
74400
|
sessionId: delivery.threadId,
|
|
74252
74401
|
folder: displayFolderOf({ folder: delivery.cwd, home: homedir3() }),
|
|
74253
|
-
host:
|
|
74402
|
+
host: hostname5()
|
|
74254
74403
|
};
|
|
74255
74404
|
try {
|
|
74256
74405
|
return await client.withHeaders(sessionHeadersOf({ session })).post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS }, { signal });
|
|
@@ -74359,9 +74508,9 @@ async function serveRounds({
|
|
|
74359
74508
|
}
|
|
74360
74509
|
var saves = 0;
|
|
74361
74510
|
async function save(run4) {
|
|
74362
|
-
await
|
|
74511
|
+
await mkdir10(dirname11(run4.path), { recursive: true, mode: 448 });
|
|
74363
74512
|
const temporary = `${run4.path}.${run4.self}.${saves += 1}.tmp`;
|
|
74364
|
-
await
|
|
74513
|
+
await writeFile9(temporary, JSON.stringify(run4.state));
|
|
74365
74514
|
await rename3(temporary, run4.path);
|
|
74366
74515
|
}
|
|
74367
74516
|
async function holdsLock(run4) {
|
|
@@ -74484,12 +74633,12 @@ function logPathOf({ context }) {
|
|
|
74484
74633
|
return join13(connectFolderOf({ context }), "connect.log");
|
|
74485
74634
|
}
|
|
74486
74635
|
function homeOf({ context }) {
|
|
74487
|
-
return context.environment.inherited.HOME ??
|
|
74636
|
+
return context.environment.inherited.HOME ?? dirname12(dirname12(context.environment.configPath));
|
|
74488
74637
|
}
|
|
74489
74638
|
function serviceNameOf({ context }) {
|
|
74490
74639
|
const { configPath } = context.environment;
|
|
74491
74640
|
if (configPath === join13(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
|
|
74492
|
-
return `laze-connect-${
|
|
74641
|
+
return `laze-connect-${createHash2("sha256").update(configPath).digest("hex").slice(0, 8)}`;
|
|
74493
74642
|
}
|
|
74494
74643
|
function serviceEnvOf({ context }) {
|
|
74495
74644
|
const path = context.environment.inherited.PATH;
|
|
@@ -74513,8 +74662,8 @@ async function installSystemd({ context }) {
|
|
|
74513
74662
|
const env = context.environment.inherited;
|
|
74514
74663
|
const base = env.XDG_CONFIG_HOME || join13(homeOf({ context }), ".config");
|
|
74515
74664
|
const file3 = join13(base, "systemd", "user", `${name3}.service`);
|
|
74516
|
-
await
|
|
74517
|
-
await
|
|
74665
|
+
await mkdir11(dirname12(file3), { recursive: true });
|
|
74666
|
+
await writeFile10(
|
|
74518
74667
|
file3,
|
|
74519
74668
|
systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
|
|
74520
74669
|
);
|
|
@@ -74529,8 +74678,8 @@ async function installLaunchd({ context }) {
|
|
|
74529
74678
|
const label3 = `ai.laze.${name3}`;
|
|
74530
74679
|
const file3 = join13(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
|
|
74531
74680
|
const log = logPathOf({ context });
|
|
74532
|
-
await
|
|
74533
|
-
await
|
|
74681
|
+
await mkdir11(dirname12(file3), { recursive: true });
|
|
74682
|
+
await writeFile10(
|
|
74534
74683
|
file3,
|
|
74535
74684
|
launchAgentOf({
|
|
74536
74685
|
label: label3,
|
|
@@ -74582,8 +74731,8 @@ async function installConnectService({ context }) {
|
|
|
74582
74731
|
const manager = await managerOf({ context });
|
|
74583
74732
|
const install = { systemd: installSystemd, launchd: installLaunchd, detached: installDetached };
|
|
74584
74733
|
const installed = await install[manager]({ context });
|
|
74585
|
-
await
|
|
74586
|
-
await
|
|
74734
|
+
await mkdir11(dirname12(path), { recursive: true, mode: 448 });
|
|
74735
|
+
await writeFile10(path, JSON.stringify(installed));
|
|
74587
74736
|
return describeInstalled({ installed });
|
|
74588
74737
|
}
|
|
74589
74738
|
async function ensureConnectService({ context }) {
|
|
@@ -74733,7 +74882,7 @@ var ROUND_SECONDS2 = 50;
|
|
|
74733
74882
|
var WATCH_MS = 2e3;
|
|
74734
74883
|
var CHANNEL_CHECK_MS = 5e3;
|
|
74735
74884
|
async function holderOf({ path }) {
|
|
74736
|
-
return
|
|
74885
|
+
return readFile14(path, "utf8").then(
|
|
74737
74886
|
(text3) => JSON.parse(text3),
|
|
74738
74887
|
() => void 0
|
|
74739
74888
|
);
|
|
@@ -74757,8 +74906,8 @@ async function takeLock({
|
|
|
74757
74906
|
if (served && context.processes.alive(served) && !mine4) return false;
|
|
74758
74907
|
context.processes.stop(holder.pid);
|
|
74759
74908
|
}
|
|
74760
|
-
await
|
|
74761
|
-
await
|
|
74909
|
+
await mkdir12(dirname13(path), { recursive: true, mode: 448 });
|
|
74910
|
+
await writeFile11(
|
|
74762
74911
|
path,
|
|
74763
74912
|
JSON.stringify({
|
|
74764
74913
|
pid: self2,
|
|
@@ -74876,7 +75025,7 @@ async function waitForMessages({ context, args }) {
|
|
|
74876
75025
|
if (rush) await healRushDelivery({ context });
|
|
74877
75026
|
const lock = statePathOf({ context, kind: "waiters", profile: name3 });
|
|
74878
75027
|
if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
|
|
74879
|
-
const seen = () => input2.transcript_path ?
|
|
75028
|
+
const seen = () => input2.transcript_path ? readFile14(input2.transcript_path, "utf8") : Promise.resolve("");
|
|
74880
75029
|
const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
|
|
74881
75030
|
try {
|
|
74882
75031
|
while (context.nowMs() < deadline) {
|
|
@@ -74933,8 +75082,8 @@ import { createInterface as createInterface2 } from "node:readline";
|
|
|
74933
75082
|
|
|
74934
75083
|
// src/services/codex-adopt.service.ts
|
|
74935
75084
|
import { spawn as spawn2 } from "node:child_process";
|
|
74936
|
-
import { mkdir as
|
|
74937
|
-
import { dirname as
|
|
75085
|
+
import { mkdir as mkdir13, readdir as readdir4, readFile as readFile15, rm as rm5, stat as stat5, writeFile as writeFile12 } from "node:fs/promises";
|
|
75086
|
+
import { dirname as dirname14, join as join14 } from "node:path";
|
|
74938
75087
|
import { createInterface } from "node:readline";
|
|
74939
75088
|
|
|
74940
75089
|
// src/rules/codex-requests.rules.ts
|
|
@@ -75133,7 +75282,7 @@ async function answer2({
|
|
|
75133
75282
|
var MAX_RESTART_WAIT_SECONDS = 60;
|
|
75134
75283
|
var HEALTHY_RUN_MS = 6e4;
|
|
75135
75284
|
async function recordOf({ path }) {
|
|
75136
|
-
return
|
|
75285
|
+
return readFile15(path, "utf8").then(
|
|
75137
75286
|
(text3) => JSON.parse(text3),
|
|
75138
75287
|
() => void 0
|
|
75139
75288
|
);
|
|
@@ -75155,8 +75304,8 @@ async function startAdoptInBackground({
|
|
|
75155
75304
|
const adopt = ["adopt", "codex", "--profile", profile, ...threadFlag({ thread: thread2 })];
|
|
75156
75305
|
const argv = [...context.program, ...adopt, "--supervise"];
|
|
75157
75306
|
const pid = context.processes.spawnDetached({ argv, logPath: log });
|
|
75158
|
-
await
|
|
75159
|
-
await
|
|
75307
|
+
await mkdir13(dirname14(path), { recursive: true, mode: 448 });
|
|
75308
|
+
await writeFile12(path, JSON.stringify({ pid, thread: thread2, log, startedAt: context.nowMs() }));
|
|
75160
75309
|
return [
|
|
75161
75310
|
`Started \`${laze} adopt codex\` in the background (pid ${pid}). It answers each Laze message`,
|
|
75162
75311
|
`as a turn in ${thread2 ? `this Codex thread (${thread2})` : "the newest Codex thread"}, and starts again if it stops.`,
|
|
@@ -75240,7 +75389,7 @@ async function adoptedThreadOf({
|
|
|
75240
75389
|
);
|
|
75241
75390
|
if (!held) return threadId;
|
|
75242
75391
|
const path = statePathOf({ context, kind: "adopt", profile, extension: "forks.json" });
|
|
75243
|
-
const forks = await
|
|
75392
|
+
const forks = await readFile15(path, "utf8").then(
|
|
75244
75393
|
(text3) => JSON.parse(text3),
|
|
75245
75394
|
() => ({})
|
|
75246
75395
|
);
|
|
@@ -75255,8 +75404,8 @@ async function adoptedThreadOf({
|
|
|
75255
75404
|
}
|
|
75256
75405
|
const forked = record3((await codex.call("thread/fork", { threadId })).thread).id;
|
|
75257
75406
|
if (typeof forked !== "string") throw new Error("thread/fork answered no thread id");
|
|
75258
|
-
await
|
|
75259
|
-
await
|
|
75407
|
+
await mkdir13(dirname14(path), { recursive: true, mode: 448 });
|
|
75408
|
+
await writeFile12(path, JSON.stringify({ ...forks, [threadId]: forked }));
|
|
75260
75409
|
context.out(
|
|
75261
75410
|
`Codex holds thread ${threadId} open elsewhere; answering in its new fork ${forked}.
|
|
75262
75411
|
`
|
|
@@ -75403,9 +75552,9 @@ async function linkCodexSession({
|
|
|
75403
75552
|
}
|
|
75404
75553
|
|
|
75405
75554
|
// src/services/laze-plugin.service.ts
|
|
75406
|
-
import { mkdir as
|
|
75555
|
+
import { mkdir as mkdir14, readFile as readFile16, writeFile as writeFile13 } from "node:fs/promises";
|
|
75407
75556
|
import { homedir as homedir4 } from "node:os";
|
|
75408
|
-
import { dirname as
|
|
75557
|
+
import { dirname as dirname15, join as join16 } from "node:path";
|
|
75409
75558
|
|
|
75410
75559
|
// src/rules/laze-plugin.rules.ts
|
|
75411
75560
|
var LAZE_PLUGIN = "laze";
|
|
@@ -75621,11 +75770,11 @@ function lazePluginFiles({
|
|
|
75621
75770
|
var REGISTER_LIMIT_MS = 6e4;
|
|
75622
75771
|
var quote2 = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
75623
75772
|
function pluginFolderOf({ context }) {
|
|
75624
|
-
return join16(
|
|
75773
|
+
return join16(dirname15(context.environment.configPath), "plugins");
|
|
75625
75774
|
}
|
|
75626
75775
|
async function pluginIsCurrent({ context }) {
|
|
75627
75776
|
const manifest = join16(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
|
|
75628
|
-
const written = await
|
|
75777
|
+
const written = await readFile16(manifest, "utf8").then(
|
|
75629
75778
|
(text3) => JSON.parse(text3).version,
|
|
75630
75779
|
() => void 0
|
|
75631
75780
|
);
|
|
@@ -75640,8 +75789,8 @@ async function writeLazePlugin({ context }) {
|
|
|
75640
75789
|
});
|
|
75641
75790
|
for (const [path, text3] of Object.entries(files2)) {
|
|
75642
75791
|
const target = join16(folder, path);
|
|
75643
|
-
await
|
|
75644
|
-
await
|
|
75792
|
+
await mkdir14(dirname15(target), { recursive: true });
|
|
75793
|
+
await writeFile13(target, text3);
|
|
75645
75794
|
}
|
|
75646
75795
|
return folder;
|
|
75647
75796
|
}
|
|
@@ -75672,7 +75821,7 @@ async function cachedPluginOf({ context }) {
|
|
|
75672
75821
|
const inherited = context.environment.inherited;
|
|
75673
75822
|
const home = inherited.HOME || homedir4();
|
|
75674
75823
|
const claude = inherited.CLAUDE_CONFIG_DIR || join16(home, ".claude");
|
|
75675
|
-
const listed = await
|
|
75824
|
+
const listed = await readFile16(join16(claude, "plugins", "installed_plugins.json"), "utf8").then(
|
|
75676
75825
|
(text3) => JSON.parse(text3),
|
|
75677
75826
|
() => void 0
|
|
75678
75827
|
);
|
|
@@ -75681,7 +75830,7 @@ async function cachedPluginOf({ context }) {
|
|
|
75681
75830
|
async function refreshStaleCache({ context, folder }) {
|
|
75682
75831
|
const cached2 = await cachedPluginOf({ context });
|
|
75683
75832
|
if (!cached2) return true;
|
|
75684
|
-
const read4 = (path) =>
|
|
75833
|
+
const read4 = (path) => readFile16(path, "utf8").catch(() => "");
|
|
75685
75834
|
for (const file3 of RUN_FILES) {
|
|
75686
75835
|
const ours = await read4(join16(folder, LAZE_PLUGIN, file3));
|
|
75687
75836
|
if (ours === await read4(join16(cached2, file3))) continue;
|
|
@@ -75698,7 +75847,7 @@ function registeredMarkOf({ context }) {
|
|
|
75698
75847
|
return join16(pluginFolderOf({ context }), "registered");
|
|
75699
75848
|
}
|
|
75700
75849
|
async function pluginRegistered({ context }) {
|
|
75701
|
-
return
|
|
75850
|
+
return readFile16(registeredMarkOf({ context }), "utf8").then(
|
|
75702
75851
|
() => true,
|
|
75703
75852
|
() => false
|
|
75704
75853
|
);
|
|
@@ -75706,7 +75855,7 @@ async function pluginRegistered({ context }) {
|
|
|
75706
75855
|
async function installLazePlugin({ context }) {
|
|
75707
75856
|
const folder = await writeLazePlugin({ context });
|
|
75708
75857
|
const registered = await registerWithClaude({ context, folder }) && await refreshStaleCache({ context, folder });
|
|
75709
|
-
if (registered) await
|
|
75858
|
+
if (registered) await writeFile13(registeredMarkOf({ context }), cliVersionOf());
|
|
75710
75859
|
return { folder, registered };
|
|
75711
75860
|
}
|
|
75712
75861
|
async function plugin({ context, args }) {
|
|
@@ -75730,8 +75879,8 @@ async function plugin({ context, args }) {
|
|
|
75730
75879
|
}
|
|
75731
75880
|
|
|
75732
75881
|
// src/services/mcp-channel.service.ts
|
|
75733
|
-
import { mkdir as
|
|
75734
|
-
import { dirname as
|
|
75882
|
+
import { mkdir as mkdir15, rm as rm7, writeFile as writeFile14 } from "node:fs/promises";
|
|
75883
|
+
import { dirname as dirname16 } from "node:path";
|
|
75735
75884
|
var LAZE_MCP_SERVER = "laze";
|
|
75736
75885
|
var DEV_CHANNELS_FLAG = "--dangerously-load-development-channels";
|
|
75737
75886
|
var ROUND_SECONDS3 = 50;
|
|
@@ -75821,8 +75970,8 @@ async function pushInbox({
|
|
|
75821
75970
|
signal
|
|
75822
75971
|
}) {
|
|
75823
75972
|
const marker = statePathOf({ context, kind: "channels", profile });
|
|
75824
|
-
await
|
|
75825
|
-
await
|
|
75973
|
+
await mkdir15(dirname16(marker), { recursive: true, mode: 448 });
|
|
75974
|
+
await writeFile14(marker, JSON.stringify({ pid: context.processes.pid }));
|
|
75826
75975
|
try {
|
|
75827
75976
|
while (!signal.aborted) {
|
|
75828
75977
|
const messages = await client.post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS3 }, { signal }).catch(async (error63) => {
|
|
@@ -75856,8 +76005,8 @@ async function pushInbox({
|
|
|
75856
76005
|
}
|
|
75857
76006
|
|
|
75858
76007
|
// src/services/plugin-tip.service.ts
|
|
75859
|
-
import { mkdir as
|
|
75860
|
-
import { dirname as
|
|
76008
|
+
import { mkdir as mkdir16, readFile as readFile17, writeFile as writeFile15 } from "node:fs/promises";
|
|
76009
|
+
import { dirname as dirname17 } from "node:path";
|
|
75861
76010
|
var RELOAD_TIP = "Laze: the Laze plugin is installed in Claude Code, and this session has not loaded it yet. Tell the user once, in one plain line, that it is optional: typing /reload-plugins makes Laze messages arrive right away; until then they still arrive through the hooks.";
|
|
75862
76011
|
var LINK_RELOAD_TIP = "Tell the user once, in one plain line, that it is optional: typing /reload-plugins makes Laze messages arrive right away; until then they still arrive through the hooks.";
|
|
75863
76012
|
function monitorsRunHere({ context }) {
|
|
@@ -75891,8 +76040,8 @@ async function markReloadTipTold({
|
|
|
75891
76040
|
}) {
|
|
75892
76041
|
if (!session) return;
|
|
75893
76042
|
const path = toldPathOf({ context, session });
|
|
75894
|
-
await
|
|
75895
|
-
await
|
|
76043
|
+
await mkdir16(dirname17(path), { recursive: true, mode: 448 });
|
|
76044
|
+
await writeFile15(path, String(context.nowMs()), { mode: 384 });
|
|
75896
76045
|
}
|
|
75897
76046
|
async function reloadTipOnce({
|
|
75898
76047
|
context,
|
|
@@ -75900,7 +76049,7 @@ async function reloadTipOnce({
|
|
|
75900
76049
|
}) {
|
|
75901
76050
|
if (!session || !monitorsRunHere({ context })) return void 0;
|
|
75902
76051
|
if (!await pluginRegistered({ context })) return void 0;
|
|
75903
|
-
const told = await
|
|
76052
|
+
const told = await readFile17(toldPathOf({ context, session }), "utf8").then(
|
|
75904
76053
|
() => true,
|
|
75905
76054
|
() => false
|
|
75906
76055
|
);
|
|
@@ -75968,7 +76117,7 @@ async function installHooks({
|
|
|
75968
76117
|
}) {
|
|
75969
76118
|
const folder = join17(directory, ".claude");
|
|
75970
76119
|
const path = join17(folder, "settings.local.json");
|
|
75971
|
-
const current3 = await
|
|
76120
|
+
const current3 = await readFile18(path, "utf8").then(
|
|
75972
76121
|
(text3) => JSON.parse(text3),
|
|
75973
76122
|
() => ({})
|
|
75974
76123
|
);
|
|
@@ -75979,8 +76128,8 @@ async function installHooks({
|
|
|
75979
76128
|
waitCommand: command("wait"),
|
|
75980
76129
|
preToolCommand: command("pre-tool")
|
|
75981
76130
|
});
|
|
75982
|
-
await
|
|
75983
|
-
await
|
|
76131
|
+
await mkdir17(folder, { recursive: true });
|
|
76132
|
+
await writeFile16(path, `${JSON.stringify(settings3, null, 2)}
|
|
75984
76133
|
`);
|
|
75985
76134
|
return path;
|
|
75986
76135
|
}
|
|
@@ -76207,7 +76356,7 @@ async function reportTranscript({
|
|
|
76207
76356
|
input: input2
|
|
76208
76357
|
}) {
|
|
76209
76358
|
if (!input2.transcript_path || !input2.session_id) return;
|
|
76210
|
-
const lines2 = (await
|
|
76359
|
+
const lines2 = (await readFile18(input2.transcript_path, "utf8")).split("\n");
|
|
76211
76360
|
const context = readTranscript({ lines: lines2 });
|
|
76212
76361
|
await client.post("/api/agents/me/activity", {
|
|
76213
76362
|
sessionId: input2.session_id,
|
|
@@ -76246,7 +76395,7 @@ async function handOver({ context, args }) {
|
|
|
76246
76395
|
const kept = await dueFromSpool({
|
|
76247
76396
|
context,
|
|
76248
76397
|
profile: agent3,
|
|
76249
|
-
seen: () => input2.transcript_path ?
|
|
76398
|
+
seen: () => input2.transcript_path ? readFile18(input2.transcript_path, "utf8") : Promise.resolve(""),
|
|
76250
76399
|
pushedToo: false,
|
|
76251
76400
|
settledOnly: true
|
|
76252
76401
|
});
|
|
@@ -76288,7 +76437,7 @@ async function addSessionStartWaiter({ context, args }) {
|
|
|
76288
76437
|
const profile = flagText({ args, name: "profile" });
|
|
76289
76438
|
if (!directory || !profile) return;
|
|
76290
76439
|
const path = join17(directory, ".claude", "settings.local.json");
|
|
76291
|
-
const settings3 = await
|
|
76440
|
+
const settings3 = await readFile18(path, "utf8").then(
|
|
76292
76441
|
(text3) => JSON.parse(text3),
|
|
76293
76442
|
() => void 0
|
|
76294
76443
|
);
|
|
@@ -76318,7 +76467,7 @@ async function stopHook({ context, args }) {
|
|
|
76318
76467
|
}
|
|
76319
76468
|
|
|
76320
76469
|
// src/services/agent-manage-commands.service.ts
|
|
76321
|
-
import { readFile as
|
|
76470
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
76322
76471
|
import { extname, resolve as resolve6 } from "node:path";
|
|
76323
76472
|
|
|
76324
76473
|
// src/rules/login-format.rules.ts
|
|
@@ -76456,7 +76605,7 @@ async function avatarOf({
|
|
|
76456
76605
|
return emoji4;
|
|
76457
76606
|
}
|
|
76458
76607
|
if (!path) return void 0;
|
|
76459
|
-
const bytes = await
|
|
76608
|
+
const bytes = await readFile19(resolve6(context.cwd, path)).catch(() => {
|
|
76460
76609
|
throw new CliUsageError(`laze: cannot read the avatar file ${path}.`);
|
|
76461
76610
|
});
|
|
76462
76611
|
const uploaded = await client.post("/api/agents/avatars", {
|
|
@@ -77172,11 +77321,11 @@ async function setAgentRunsOn({
|
|
|
77172
77321
|
}
|
|
77173
77322
|
|
|
77174
77323
|
// src/services/agent-migrate-commands.service.ts
|
|
77175
|
-
import { readFile as
|
|
77324
|
+
import { readFile as readFile20, stat as stat7 } from "node:fs/promises";
|
|
77176
77325
|
import { basename as basename5, join as join18, resolve as resolve7 } from "node:path";
|
|
77177
77326
|
|
|
77178
77327
|
// src/rules/migration-upload.rules.ts
|
|
77179
|
-
import { createHash as
|
|
77328
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
77180
77329
|
function markersIn(text3) {
|
|
77181
77330
|
return text3.split(REDACTION_MARKER).length - 1;
|
|
77182
77331
|
}
|
|
@@ -77195,7 +77344,7 @@ async function redactTranscript({
|
|
|
77195
77344
|
return { text: redacted.text, redactions };
|
|
77196
77345
|
}
|
|
77197
77346
|
function sha256Of({ text: text3 }) {
|
|
77198
|
-
return
|
|
77347
|
+
return createHash3("sha256").update(text3, "utf8").digest("hex");
|
|
77199
77348
|
}
|
|
77200
77349
|
var bytesOf2 = (text3) => Buffer.byteLength(text3, "utf8");
|
|
77201
77350
|
function piecesOf({ line, maxBytes }) {
|
|
@@ -77462,7 +77611,7 @@ async function uploadTranscript({ context, args, client }) {
|
|
|
77462
77611
|
`The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
|
|
77463
77612
|
);
|
|
77464
77613
|
}
|
|
77465
|
-
const raw = await
|
|
77614
|
+
const raw = await readFile20(found.path, "utf8");
|
|
77466
77615
|
if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
|
|
77467
77616
|
const redacted = await redactTranscript({ text: raw });
|
|
77468
77617
|
const { parts, truncated } = transcriptPartsOf({
|
|
@@ -77716,8 +77865,8 @@ async function requestAgent({ context, args }) {
|
|
|
77716
77865
|
}
|
|
77717
77866
|
|
|
77718
77867
|
// src/services/app-commands.service.ts
|
|
77719
|
-
import { mkdir as
|
|
77720
|
-
import { dirname as
|
|
77868
|
+
import { mkdir as mkdir18, readdir as readdir6, readFile as readFile22, writeFile as writeFile18 } from "node:fs/promises";
|
|
77869
|
+
import { dirname as dirname18, join as join21, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
|
|
77721
77870
|
|
|
77722
77871
|
// ../../modules/app/contract/src/app.connections.ts
|
|
77723
77872
|
var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
|
|
@@ -80167,7 +80316,7 @@ async function appPinsCommand({
|
|
|
80167
80316
|
|
|
80168
80317
|
// src/services/app-script-check.service.ts
|
|
80169
80318
|
import { execFile } from "node:child_process";
|
|
80170
|
-
import { mkdtemp, rm as rm8, writeFile as
|
|
80319
|
+
import { mkdtemp, rm as rm8, writeFile as writeFile17 } from "node:fs/promises";
|
|
80171
80320
|
import { tmpdir } from "node:os";
|
|
80172
80321
|
import { join as join19 } from "node:path";
|
|
80173
80322
|
import { promisify } from "node:util";
|
|
@@ -80203,7 +80352,7 @@ async function scriptErrorsOf({
|
|
|
80203
80352
|
const errors = await Promise.all(
|
|
80204
80353
|
scripts.map(async (script, index) => {
|
|
80205
80354
|
const file3 = join19(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
|
|
80206
|
-
await
|
|
80355
|
+
await writeFile17(file3, script.code);
|
|
80207
80356
|
try {
|
|
80208
80357
|
await run2(process.execPath, ["--check", file3]);
|
|
80209
80358
|
return null;
|
|
@@ -80220,7 +80369,7 @@ async function scriptErrorsOf({
|
|
|
80220
80369
|
}
|
|
80221
80370
|
|
|
80222
80371
|
// src/services/app-serve.service.ts
|
|
80223
|
-
import { readFile as
|
|
80372
|
+
import { readFile as readFile21, stat as stat8 } from "node:fs/promises";
|
|
80224
80373
|
import { createServer } from "node:http";
|
|
80225
80374
|
import { extname as extname2, join as join20, normalize, sep as sep2 } from "node:path";
|
|
80226
80375
|
var TYPES2 = {
|
|
@@ -80279,7 +80428,7 @@ async function staticFile({
|
|
|
80279
80428
|
const info = await stat8(target).catch(() => void 0);
|
|
80280
80429
|
if (!info?.isFile()) continue;
|
|
80281
80430
|
const type = TYPES2[extname2(target).toLowerCase()] ?? "application/octet-stream";
|
|
80282
|
-
const body = await
|
|
80431
|
+
const body = await readFile21(target);
|
|
80283
80432
|
if (extname2(target) === ".html") {
|
|
80284
80433
|
return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
|
|
80285
80434
|
}
|
|
@@ -80512,7 +80661,7 @@ async function turnTokenOf2({
|
|
|
80512
80661
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
80513
80662
|
if (pinned) return pinned;
|
|
80514
80663
|
if (env.LAZE_TURN_FILE) {
|
|
80515
|
-
return
|
|
80664
|
+
return readFile22(env.LAZE_TURN_FILE, "utf8").then(
|
|
80516
80665
|
(text3) => text3.trim(),
|
|
80517
80666
|
() => ""
|
|
80518
80667
|
);
|
|
@@ -80542,7 +80691,7 @@ function folderOf({ context, word: word3 }) {
|
|
|
80542
80691
|
return resolve8(context.cwd, word3 ?? ".");
|
|
80543
80692
|
}
|
|
80544
80693
|
async function readManifest(folder) {
|
|
80545
|
-
const text3 = await
|
|
80694
|
+
const text3 = await readFile22(join21(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
80546
80695
|
if (text3 === void 0) return void 0;
|
|
80547
80696
|
const parsed = appManifestSchema.safeParse(JSON.parse(text3));
|
|
80548
80697
|
if (!parsed.success) {
|
|
@@ -80577,7 +80726,7 @@ async function jsonFlag({
|
|
|
80577
80726
|
}) {
|
|
80578
80727
|
const raw = flagText({ args, name: name3 });
|
|
80579
80728
|
if (!raw) return void 0;
|
|
80580
|
-
const text3 = raw.startsWith("@") ? await
|
|
80729
|
+
const text3 = raw.startsWith("@") ? await readFile22(resolve8(context.cwd, raw.slice(1)), "utf8") : raw;
|
|
80581
80730
|
try {
|
|
80582
80731
|
return JSON.parse(text3);
|
|
80583
80732
|
} catch {
|
|
@@ -80626,12 +80775,12 @@ var appCreate = async ({ context, args }) => {
|
|
|
80626
80775
|
...template ? { template } : {}
|
|
80627
80776
|
});
|
|
80628
80777
|
const folder = resolve8(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
|
|
80629
|
-
await
|
|
80778
|
+
await mkdir18(folder, { recursive: true });
|
|
80630
80779
|
const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
|
|
80631
80780
|
for (const file3 of start2?.files ?? []) {
|
|
80632
80781
|
const target = join21(folder, ...file3.path.split("/"));
|
|
80633
|
-
await
|
|
80634
|
-
await
|
|
80782
|
+
await mkdir18(dirname18(target), { recursive: true });
|
|
80783
|
+
await writeFile18(
|
|
80635
80784
|
target,
|
|
80636
80785
|
file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
|
|
80637
80786
|
);
|
|
@@ -80642,7 +80791,7 @@ var appCreate = async ({ context, args }) => {
|
|
|
80642
80791
|
views: [...start2?.template.views ?? []],
|
|
80643
80792
|
seed: { ...start2?.template.seed }
|
|
80644
80793
|
};
|
|
80645
|
-
await
|
|
80794
|
+
await writeFile18(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
80646
80795
|
`);
|
|
80647
80796
|
const where = relative3(context.cwd, folder) || ".";
|
|
80648
80797
|
print5({
|
|
@@ -80714,7 +80863,7 @@ var appPush = async ({ context, args }) => {
|
|
|
80714
80863
|
paths.map(
|
|
80715
80864
|
async (path) => buildFileOf({
|
|
80716
80865
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
80717
|
-
bytes: await
|
|
80866
|
+
bytes: await readFile22(path)
|
|
80718
80867
|
})
|
|
80719
80868
|
)
|
|
80720
80869
|
);
|
|
@@ -80784,7 +80933,7 @@ var appWrite = async ({ context, args }) => {
|
|
|
80784
80933
|
const path = resolve8(context.cwd, word3);
|
|
80785
80934
|
const { bytes: _bytes, ...file3 } = buildFileOf({
|
|
80786
80935
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
80787
|
-
bytes: await
|
|
80936
|
+
bytes: await readFile22(path)
|
|
80788
80937
|
});
|
|
80789
80938
|
return file3;
|
|
80790
80939
|
})
|
|
@@ -80912,8 +81061,8 @@ var appPull = async ({ context, args }) => {
|
|
|
80912
81061
|
}
|
|
80913
81062
|
for (const file3 of pulled.files) {
|
|
80914
81063
|
const target = join21(folder, ...file3.path.split("/"));
|
|
80915
|
-
await
|
|
80916
|
-
await
|
|
81064
|
+
await mkdir18(dirname18(target), { recursive: true });
|
|
81065
|
+
await writeFile18(
|
|
80917
81066
|
target,
|
|
80918
81067
|
file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
|
|
80919
81068
|
);
|
|
@@ -80930,7 +81079,7 @@ var appPull = async ({ context, args }) => {
|
|
|
80930
81079
|
])
|
|
80931
81080
|
)
|
|
80932
81081
|
};
|
|
80933
|
-
await
|
|
81082
|
+
await writeFile18(join21(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
80934
81083
|
`);
|
|
80935
81084
|
const names = pulled.collections.map((collection) => collection.name);
|
|
80936
81085
|
const where = relative3(context.cwd, folder) || ".";
|
|
@@ -81237,7 +81386,7 @@ var appExport = async ({ context, args }) => {
|
|
|
81237
81386
|
const out = flagText({ args, name: "out" });
|
|
81238
81387
|
if (!out) return context.out(exported.body);
|
|
81239
81388
|
const target = resolve8(context.cwd, out);
|
|
81240
|
-
await
|
|
81389
|
+
await writeFile18(target, exported.body);
|
|
81241
81390
|
context.out(`Wrote ${exported.rows} records to ${relative3(context.cwd, target)}
|
|
81242
81391
|
`);
|
|
81243
81392
|
};
|
|
@@ -81245,7 +81394,7 @@ var appImport = async ({ context, args }) => {
|
|
|
81245
81394
|
const words = args.words.slice(2);
|
|
81246
81395
|
const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
|
|
81247
81396
|
if (!collection || !file3) throw new CliUsageError(USAGE5);
|
|
81248
|
-
const csv = await
|
|
81397
|
+
const csv = await readFile22(resolve8(context.cwd, file3), "utf8").catch(() => {
|
|
81249
81398
|
throw new CliUsageError(`Cannot read ${file3}`);
|
|
81250
81399
|
});
|
|
81251
81400
|
const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
|
|
@@ -81263,7 +81412,7 @@ var appImport = async ({ context, args }) => {
|
|
|
81263
81412
|
});
|
|
81264
81413
|
const refusedOut = flagText({ args, name: "refused" });
|
|
81265
81414
|
if (refusedOut && result2.refusedCsv) {
|
|
81266
|
-
await
|
|
81415
|
+
await writeFile18(resolve8(context.cwd, refusedOut), result2.refusedCsv);
|
|
81267
81416
|
}
|
|
81268
81417
|
const fitting = result2.rows - result2.refused.length;
|
|
81269
81418
|
const skipped = result2.refused.slice(0, 20).map((row) => ` line ${row.line}: ${row.reason}
|
|
@@ -81656,14 +81805,14 @@ async function app({ context, args }) {
|
|
|
81656
81805
|
}
|
|
81657
81806
|
|
|
81658
81807
|
// src/services/auth-commands.service.ts
|
|
81659
|
-
import { hostname as
|
|
81808
|
+
import { hostname as hostname6 } from "node:os";
|
|
81660
81809
|
|
|
81661
81810
|
// src/rules/machine-proof.rules.ts
|
|
81662
|
-
import { createHash as
|
|
81811
|
+
import { createHash as createHash4, randomBytes } from "node:crypto";
|
|
81663
81812
|
var b64url3 = (bytes) => Buffer.from(bytes).toString("base64url");
|
|
81664
81813
|
function thumbprintOf({ jwk }) {
|
|
81665
81814
|
const canonical = JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y });
|
|
81666
|
-
return b64url3(
|
|
81815
|
+
return b64url3(createHash4("sha256").update(canonical).digest());
|
|
81667
81816
|
}
|
|
81668
81817
|
function lazeTokenOf({ authorization }) {
|
|
81669
81818
|
const match = /^Bearer (lz_\S+)$/.exec(authorization ?? "");
|
|
@@ -81687,7 +81836,7 @@ function machineProofOf({
|
|
|
81687
81836
|
htu: url2,
|
|
81688
81837
|
iat: Math.floor(nowMs / 1e3),
|
|
81689
81838
|
jti,
|
|
81690
|
-
ath: b64url3(
|
|
81839
|
+
ath: b64url3(createHash4("sha256").update(credential).digest()),
|
|
81691
81840
|
lz_tier: tier,
|
|
81692
81841
|
...tailscaleNodeId ? { lz_ts: tailscaleNodeId } : {}
|
|
81693
81842
|
})
|
|
@@ -81760,7 +81909,7 @@ async function deviceToken({
|
|
|
81760
81909
|
clientName: flagText({
|
|
81761
81910
|
args,
|
|
81762
81911
|
name: "client",
|
|
81763
|
-
fallback: `laze CLI on ${
|
|
81912
|
+
fallback: `laze CLI on ${hostname6()}`.slice(0, 80)
|
|
81764
81913
|
}),
|
|
81765
81914
|
...machineKey ? { machineKey } : {}
|
|
81766
81915
|
});
|
|
@@ -82104,11 +82253,11 @@ async function billing({ context, args }) {
|
|
|
82104
82253
|
|
|
82105
82254
|
// src/services/browser-commands.service.ts
|
|
82106
82255
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
82107
|
-
import { mkdir as
|
|
82108
|
-
import { dirname as
|
|
82256
|
+
import { mkdir as mkdir21, readFile as readFile24, writeFile as writeFile21 } from "node:fs/promises";
|
|
82257
|
+
import { dirname as dirname20, join as join24 } from "node:path";
|
|
82109
82258
|
|
|
82110
82259
|
// src/services/browser-tab-commands.service.ts
|
|
82111
|
-
import { mkdir as
|
|
82260
|
+
import { mkdir as mkdir20, writeFile as writeFile20 } from "node:fs/promises";
|
|
82112
82261
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
82113
82262
|
import { join as join23 } from "node:path";
|
|
82114
82263
|
|
|
@@ -82140,10 +82289,10 @@ function loginValuesOf({
|
|
|
82140
82289
|
}
|
|
82141
82290
|
|
|
82142
82291
|
// src/services/vault-commands.service.ts
|
|
82143
|
-
import { createHash as
|
|
82144
|
-
import { mkdir as
|
|
82145
|
-
import { hostname as
|
|
82146
|
-
import { dirname as
|
|
82292
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
82293
|
+
import { mkdir as mkdir19, readFile as readFile23, rm as rm9, writeFile as writeFile19 } from "node:fs/promises";
|
|
82294
|
+
import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
|
|
82295
|
+
import { dirname as dirname19, join as join22 } from "node:path";
|
|
82147
82296
|
|
|
82148
82297
|
// src/rules/vault-session.rules.ts
|
|
82149
82298
|
function vaultSessionOf({
|
|
@@ -82208,7 +82357,7 @@ async function turnTokenOf3({
|
|
|
82208
82357
|
if (pinned) return pinned;
|
|
82209
82358
|
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
82210
82359
|
try {
|
|
82211
|
-
return (await
|
|
82360
|
+
return (await readFile23(turnFile, "utf8")).trim();
|
|
82212
82361
|
} catch {
|
|
82213
82362
|
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
82214
82363
|
}
|
|
@@ -82218,12 +82367,12 @@ function runKeyPathOf({
|
|
|
82218
82367
|
connection,
|
|
82219
82368
|
profile = ""
|
|
82220
82369
|
}) {
|
|
82221
|
-
const name3 =
|
|
82222
|
-
const base = turnFile ?
|
|
82370
|
+
const name3 = createHash5("sha256").update(connection).digest("hex");
|
|
82371
|
+
const base = turnFile ? dirname19(turnFile) : join22(tmpdir2(), "laze-vault", profile);
|
|
82223
82372
|
return join22(base, "vault-run-keys", `${name3}.json`);
|
|
82224
82373
|
}
|
|
82225
82374
|
async function runKeyAt({ path }) {
|
|
82226
|
-
const saved3 = await
|
|
82375
|
+
const saved3 = await readFile23(path, "utf8").then(
|
|
82227
82376
|
(text3) => JSON.parse(text3),
|
|
82228
82377
|
() => void 0
|
|
82229
82378
|
);
|
|
@@ -82233,8 +82382,8 @@ async function runKeyAt({ path }) {
|
|
|
82233
82382
|
}
|
|
82234
82383
|
const fresh = await generateEcdhKeys();
|
|
82235
82384
|
const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
|
|
82236
|
-
await
|
|
82237
|
-
await
|
|
82385
|
+
await mkdir19(dirname19(path), { recursive: true, mode: 448 });
|
|
82386
|
+
await writeFile19(path, JSON.stringify({ publicKey: fresh.publicKey, privateKey: jwk }), {
|
|
82238
82387
|
mode: 384
|
|
82239
82388
|
});
|
|
82240
82389
|
return fresh;
|
|
@@ -82427,7 +82576,7 @@ async function vaultSessionFor({
|
|
|
82427
82576
|
harnessSession,
|
|
82428
82577
|
inherited: context.environment.inherited,
|
|
82429
82578
|
cwd: context.cwd,
|
|
82430
|
-
host:
|
|
82579
|
+
host: hostname7(),
|
|
82431
82580
|
named: flagText({ args, name: "as" }),
|
|
82432
82581
|
shellPid: await context.processes.parentOf(context.processes.pid),
|
|
82433
82582
|
terminal: context.stdoutIsTerminal === true
|
|
@@ -82750,9 +82899,9 @@ async function savedScreenshot({
|
|
|
82750
82899
|
nowMs
|
|
82751
82900
|
}) {
|
|
82752
82901
|
const folder = join23(tmpdir3(), "laze-browser");
|
|
82753
|
-
await
|
|
82902
|
+
await mkdir20(folder, { recursive: true, mode: 448 });
|
|
82754
82903
|
const path = join23(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
|
|
82755
|
-
await
|
|
82904
|
+
await writeFile20(path, Buffer.from(data, "base64"), { mode: 384 });
|
|
82756
82905
|
return path;
|
|
82757
82906
|
}
|
|
82758
82907
|
async function shareTab({ args, client, channel, print: print9 }) {
|
|
@@ -83228,7 +83377,7 @@ async function turnTokenOf4({
|
|
|
83228
83377
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
83229
83378
|
if (pinned) return pinned;
|
|
83230
83379
|
if (env.LAZE_TURN_FILE) {
|
|
83231
|
-
return
|
|
83380
|
+
return readFile24(env.LAZE_TURN_FILE, "utf8").then(
|
|
83232
83381
|
(text3) => text3.trim(),
|
|
83233
83382
|
() => ""
|
|
83234
83383
|
);
|
|
@@ -83318,7 +83467,7 @@ async function answering({
|
|
|
83318
83467
|
}
|
|
83319
83468
|
function bridgeStatePath({ context, machine: machine2 }) {
|
|
83320
83469
|
const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
83321
|
-
return join24(
|
|
83470
|
+
return join24(dirname20(context.environment.configPath), "bridges", `${safe}.json`);
|
|
83322
83471
|
}
|
|
83323
83472
|
async function bridgePort({
|
|
83324
83473
|
context,
|
|
@@ -83326,7 +83475,7 @@ async function bridgePort({
|
|
|
83326
83475
|
access
|
|
83327
83476
|
}) {
|
|
83328
83477
|
const path = bridgeStatePath({ context, machine: machine2 });
|
|
83329
|
-
const live = await
|
|
83478
|
+
const live = await readFile24(path, "utf8").then(
|
|
83330
83479
|
(text3) => JSON.parse(text3),
|
|
83331
83480
|
() => void 0
|
|
83332
83481
|
);
|
|
@@ -83339,8 +83488,8 @@ async function bridgePort({
|
|
|
83339
83488
|
key,
|
|
83340
83489
|
...target
|
|
83341
83490
|
});
|
|
83342
|
-
await
|
|
83343
|
-
await
|
|
83491
|
+
await mkdir21(dirname20(path), { recursive: true, mode: 448 });
|
|
83492
|
+
await writeFile21(path, JSON.stringify({ port, key }), { mode: 384 });
|
|
83344
83493
|
return port;
|
|
83345
83494
|
}
|
|
83346
83495
|
async function bridge({ context }) {
|
|
@@ -84036,13 +84185,13 @@ async function channelSettings({ context, args }) {
|
|
|
84036
84185
|
}
|
|
84037
84186
|
|
|
84038
84187
|
// src/services/chat-actions-commands.service.ts
|
|
84039
|
-
import { readFile as
|
|
84188
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
84040
84189
|
import { basename as basename7, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve10 } from "node:path";
|
|
84041
84190
|
|
|
84042
84191
|
// src/services/file-download.service.ts
|
|
84043
84192
|
import { createWriteStream } from "node:fs";
|
|
84044
|
-
import { mkdir as
|
|
84045
|
-
import { basename as basename6, dirname as
|
|
84193
|
+
import { mkdir as mkdir22, rename as rename5, rm as rm10, stat as stat9, truncate } from "node:fs/promises";
|
|
84194
|
+
import { basename as basename6, dirname as dirname21, resolve as resolve9 } from "node:path";
|
|
84046
84195
|
import { Readable, Transform } from "node:stream";
|
|
84047
84196
|
import { pipeline } from "node:stream/promises";
|
|
84048
84197
|
var NOT_READY_WAIT_MS = 5e3;
|
|
@@ -84162,8 +84311,8 @@ async function downloadFile({
|
|
|
84162
84311
|
out
|
|
84163
84312
|
}) {
|
|
84164
84313
|
const asked = out ? resolve9(context.cwd, out) : void 0;
|
|
84165
|
-
const part = resolve9(asked ?
|
|
84166
|
-
await
|
|
84314
|
+
const part = resolve9(asked ? dirname21(asked) : context.cwd, `.${attachmentId}.part`);
|
|
84315
|
+
await mkdir22(dirname21(part), { recursive: true });
|
|
84167
84316
|
const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
|
|
84168
84317
|
async (error63) => {
|
|
84169
84318
|
await rm10(part, { force: true });
|
|
@@ -84434,7 +84583,7 @@ function uploadNameOf({ cwd, path }) {
|
|
|
84434
84583
|
}
|
|
84435
84584
|
var fileUpload = async ({ context, args, client }) => {
|
|
84436
84585
|
const path = resolve10(context.cwd, wordAt(args, 3));
|
|
84437
|
-
const bytes = new Uint8Array(await
|
|
84586
|
+
const bytes = new Uint8Array(await readFile25(path));
|
|
84438
84587
|
const answer6 = await uploadFile({
|
|
84439
84588
|
context,
|
|
84440
84589
|
client,
|
|
@@ -84618,7 +84767,7 @@ async function chatActions({
|
|
|
84618
84767
|
}
|
|
84619
84768
|
|
|
84620
84769
|
// src/services/claude-monitor.service.ts
|
|
84621
|
-
import { readFile as
|
|
84770
|
+
import { readFile as readFile26, rm as rm11 } from "node:fs/promises";
|
|
84622
84771
|
var MONITOR_IDLE_MS = 3e4;
|
|
84623
84772
|
var MONITOR_OUTRANKED_MS = 3e3;
|
|
84624
84773
|
async function deliverOnce({
|
|
@@ -84725,7 +84874,7 @@ async function monitorSessionOf({
|
|
|
84725
84874
|
const fromEnv = sessionOf({ context, harness: "claude-code", sessionId });
|
|
84726
84875
|
if (fromEnv || !claudePid) return fromEnv;
|
|
84727
84876
|
const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
84728
|
-
return
|
|
84877
|
+
return readFile26(path, "utf8").then(
|
|
84729
84878
|
(text3) => JSON.parse(text3),
|
|
84730
84879
|
() => void 0
|
|
84731
84880
|
);
|
|
@@ -85763,6 +85912,7 @@ var computerChangedDefinition = external_exports.object({
|
|
|
85763
85912
|
|
|
85764
85913
|
// ../../modules/compute/contract/src/dedicated-ip.ts
|
|
85765
85914
|
var DEDICATED_IP_MAX_DOMAINS = 50;
|
|
85915
|
+
var dedicatedIpScopeSchema = external_exports.enum(["all", "sites"]);
|
|
85766
85916
|
var DEDICATED_IP_MONTHLY_PRICE = DEDICATED_IP_TERMS.monthlyPrice;
|
|
85767
85917
|
var adoptDedicatedAddressInputDefinition = external_exports.object({
|
|
85768
85918
|
workspaceId: external_exports.string().min(1),
|
|
@@ -85790,6 +85940,9 @@ var dedicatedIpStatusDefinition = external_exports.object({
|
|
|
85790
85940
|
address: external_exports.string().nullable(),
|
|
85791
85941
|
domains: external_exports.array(external_exports.string()),
|
|
85792
85942
|
defaultDomains: external_exports.array(external_exports.string()),
|
|
85943
|
+
scope: dedicatedIpScopeSchema,
|
|
85944
|
+
/** When the health check found it stopped working; null while it works. */
|
|
85945
|
+
troubleSince: external_exports.iso.datetime().nullable(),
|
|
85793
85946
|
currency: currencySchema,
|
|
85794
85947
|
monthlyPrice: external_exports.number().nonnegative(),
|
|
85795
85948
|
/** Why Laze turned it off: credits ran out, or its owner left the workspace. */
|
|
@@ -85835,7 +85988,8 @@ var setDedicatedIpDomainsInputDefinition = external_exports.object({
|
|
|
85835
85988
|
add: external_exports.array(external_exports.string().max(300)).max(DEDICATED_IP_MAX_DOMAINS).default([]),
|
|
85836
85989
|
remove: external_exports.array(external_exports.string().max(300)).max(DEDICATED_IP_MAX_DOMAINS).default([]),
|
|
85837
85990
|
/** Back to the defaults, before any add or remove. */
|
|
85838
|
-
reset: external_exports.boolean().default(false)
|
|
85991
|
+
reset: external_exports.boolean().default(false),
|
|
85992
|
+
scope: dedicatedIpScopeSchema.optional()
|
|
85839
85993
|
});
|
|
85840
85994
|
var setDedicatedIpDomainsInputSchema = setDedicatedIpDomainsInputDefinition;
|
|
85841
85995
|
var dedicatedIpOfferInputDefinition = external_exports.object({
|
|
@@ -85905,6 +86059,35 @@ var trustHostKeyDefinition = external_exports.object({
|
|
|
85905
86059
|
var trustHostKeyInputSchema = trustHostKeyDefinition;
|
|
85906
86060
|
var restTrustHostKeyDefinition = trustHostKeyDefinition.omit({ workspaceId: true });
|
|
85907
86061
|
|
|
86062
|
+
// ../../modules/compute/contract/src/whatsapp-agent-access.ts
|
|
86063
|
+
var WHATSAPP_AGENT_LEVELS = ["allow", "ask", "off"];
|
|
86064
|
+
var whatsappAgentLevelSchema = external_exports.enum(WHATSAPP_AGENT_LEVELS);
|
|
86065
|
+
var whatsappAgentControlSchema = external_exports.enum(["read", "send"]);
|
|
86066
|
+
var WHATSAPP_READ_WAIT_MAX_SECONDS = 50;
|
|
86067
|
+
var agentAccessDefinition = external_exports.object({
|
|
86068
|
+
agentId: external_exports.string(),
|
|
86069
|
+
name: external_exports.string(),
|
|
86070
|
+
/** Whether anyone besides the owner can talk to the agent. */
|
|
86071
|
+
shared: external_exports.boolean(),
|
|
86072
|
+
read: whatsappAgentLevelSchema,
|
|
86073
|
+
send: whatsappAgentLevelSchema
|
|
86074
|
+
});
|
|
86075
|
+
var agentsDefinition = external_exports.object({
|
|
86076
|
+
machineId: external_exports.string(),
|
|
86077
|
+
agents: external_exports.array(agentAccessDefinition)
|
|
86078
|
+
});
|
|
86079
|
+
var whatsappAgentsSchema = agentsDefinition;
|
|
86080
|
+
var setAgentDefinition = external_exports.object({
|
|
86081
|
+
workspaceId: external_exports.string().min(1).max(64),
|
|
86082
|
+
machine: external_exports.string().min(1).max(64),
|
|
86083
|
+
agentId: external_exports.string().min(1).max(64),
|
|
86084
|
+
control: whatsappAgentControlSchema,
|
|
86085
|
+
level: whatsappAgentLevelSchema,
|
|
86086
|
+
/** The vault's one-use proof, needed when the level moves towards Allow. */
|
|
86087
|
+
reauthToken: external_exports.string().min(1).max(200).optional()
|
|
86088
|
+
});
|
|
86089
|
+
var setWhatsappAgentInputSchema = setAgentDefinition;
|
|
86090
|
+
|
|
85908
86091
|
// ../../modules/compute/contract/src/own-machine-whatsapp.ts
|
|
85909
86092
|
var workspaceIdSchema20 = external_exports.string().min(1).max(64);
|
|
85910
86093
|
var machineRefText2 = external_exports.string().min(1).max(64);
|
|
@@ -85942,21 +86125,28 @@ var messagesResultDefinition = external_exports.object({
|
|
|
85942
86125
|
});
|
|
85943
86126
|
var limitSchema = external_exports.number().int().min(1).max(WHATSAPP_LIMIT_MAX);
|
|
85944
86127
|
var chatRefSchema = external_exports.string().trim().min(1).max(200);
|
|
86128
|
+
var whatsappMachineRef = machineRefText2.optional();
|
|
86129
|
+
var readAskFields = {
|
|
86130
|
+
request: external_exports.string().min(1).max(64).optional(),
|
|
86131
|
+
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_READ_WAIT_MAX_SECONDS).optional()
|
|
86132
|
+
};
|
|
85945
86133
|
var chatsInputDefinition = external_exports.object({
|
|
85946
86134
|
workspaceId: workspaceIdSchema20,
|
|
85947
|
-
machine:
|
|
85948
|
-
limit: limitSchema.optional()
|
|
86135
|
+
machine: whatsappMachineRef,
|
|
86136
|
+
limit: limitSchema.optional(),
|
|
86137
|
+
...readAskFields
|
|
85949
86138
|
});
|
|
85950
86139
|
var readInputDefinition = external_exports.object({
|
|
85951
86140
|
workspaceId: workspaceIdSchema20,
|
|
85952
|
-
machine:
|
|
86141
|
+
machine: whatsappMachineRef,
|
|
85953
86142
|
/** A chat id, a phone number or a contact or group name. */
|
|
85954
86143
|
chat: chatRefSchema,
|
|
85955
|
-
limit: limitSchema.optional()
|
|
86144
|
+
limit: limitSchema.optional(),
|
|
86145
|
+
...readAskFields
|
|
85956
86146
|
});
|
|
85957
86147
|
var sendInputDefinition = external_exports.object({
|
|
85958
86148
|
workspaceId: workspaceIdSchema20,
|
|
85959
|
-
machine:
|
|
86149
|
+
machine: whatsappMachineRef,
|
|
85960
86150
|
chat: chatRefSchema,
|
|
85961
86151
|
text: external_exports.string().trim().min(1).max(WHATSAPP_TEXT_MAX)
|
|
85962
86152
|
});
|
|
@@ -86011,15 +86201,26 @@ var whatsappVisitEveryDefinition = external_exports.union([
|
|
|
86011
86201
|
external_exports.literal(5),
|
|
86012
86202
|
external_exports.literal(15),
|
|
86013
86203
|
external_exports.literal(30),
|
|
86014
|
-
external_exports.literal(60)
|
|
86204
|
+
external_exports.literal(60),
|
|
86205
|
+
external_exports.literal(360),
|
|
86206
|
+
external_exports.literal(1440)
|
|
86015
86207
|
]);
|
|
86016
86208
|
var whatsappVisitEverySchema = whatsappVisitEveryDefinition;
|
|
86209
|
+
var whatsappSendLevelDefinition = external_exports.enum(["auto", "checked", "ask"]);
|
|
86210
|
+
var whatsappSendLevelSchema = whatsappSendLevelDefinition;
|
|
86017
86211
|
var mirrorSettingsDefinition = external_exports.object({
|
|
86018
86212
|
machineId: external_exports.string(),
|
|
86019
86213
|
mirrorOn: external_exports.boolean(),
|
|
86020
86214
|
onlineMode: whatsappOnlineModeSchema,
|
|
86021
|
-
|
|
86022
|
-
|
|
86215
|
+
/** Always true: the owner's agents read. Kept one release for pages already loaded. */
|
|
86216
|
+
agentsRead: external_exports.boolean().meta({ deprecated: true }),
|
|
86217
|
+
agentsSend: external_exports.boolean(),
|
|
86218
|
+
sendLevel: whatsappSendLevelSchema,
|
|
86219
|
+
visitEveryMinutes: whatsappVisitEverySchema,
|
|
86220
|
+
/** Whether the computer's size allows checks more often than hourly. */
|
|
86221
|
+
frequentChecks: external_exports.boolean(),
|
|
86222
|
+
/** Messages chat could not show yet; Laze tries them again after its next update. */
|
|
86223
|
+
skipped: external_exports.number().int().min(0).default(0)
|
|
86023
86224
|
});
|
|
86024
86225
|
var whatsappMirrorSettingsSchema = mirrorSettingsDefinition;
|
|
86025
86226
|
var setMirrorSettingsDefinition = external_exports.object({
|
|
@@ -86027,8 +86228,11 @@ var setMirrorSettingsDefinition = external_exports.object({
|
|
|
86027
86228
|
machine: machineRefText2,
|
|
86028
86229
|
mirrorOn: external_exports.boolean().optional(),
|
|
86029
86230
|
onlineMode: whatsappOnlineModeSchema.optional(),
|
|
86030
|
-
|
|
86031
|
-
|
|
86231
|
+
agentsSend: external_exports.boolean().optional(),
|
|
86232
|
+
sendLevel: whatsappSendLevelSchema.optional(),
|
|
86233
|
+
visitEveryMinutes: whatsappVisitEverySchema.optional(),
|
|
86234
|
+
/** The vault's one-use proof, needed when `sendLevel` lowers the level. */
|
|
86235
|
+
reauthToken: external_exports.string().min(1).max(200).optional()
|
|
86032
86236
|
});
|
|
86033
86237
|
var setWhatsappMirrorInputSchema = setMirrorSettingsDefinition;
|
|
86034
86238
|
var whatsappComputerDefinition = external_exports.object({
|
|
@@ -86041,6 +86245,13 @@ var whatsappComputerDefinition = external_exports.object({
|
|
|
86041
86245
|
var whatsappComputerSchema = whatsappComputerDefinition;
|
|
86042
86246
|
var whatsappComputerInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20 });
|
|
86043
86247
|
var whatsappComputerInputSchema = whatsappComputerInputDefinition;
|
|
86248
|
+
var whatsappChangeMediaDefinition = external_exports.object({
|
|
86249
|
+
kind: external_exports.enum(["voice", "audio", "image", "video", "document", "sticker"]),
|
|
86250
|
+
mime: external_exports.string().max(200),
|
|
86251
|
+
size: external_exports.number().int().positive(),
|
|
86252
|
+
seconds: external_exports.number().int().nonnegative().optional(),
|
|
86253
|
+
name: external_exports.string().max(500).optional()
|
|
86254
|
+
});
|
|
86044
86255
|
var whatsappChangeDefinition = external_exports.object({
|
|
86045
86256
|
chat: external_exports.string().min(1).max(200),
|
|
86046
86257
|
chatName: external_exports.string().max(500),
|
|
@@ -86050,7 +86261,11 @@ var whatsappChangeDefinition = external_exports.object({
|
|
|
86050
86261
|
fromMe: external_exports.boolean(),
|
|
86051
86262
|
sender: external_exports.string().max(500),
|
|
86052
86263
|
text: external_exports.string(),
|
|
86053
|
-
deleted: external_exports.boolean()
|
|
86264
|
+
deleted: external_exports.boolean(),
|
|
86265
|
+
/** Fetched with a "media" request while the store is open; absent from older connectors. */
|
|
86266
|
+
media: whatsappChangeMediaDefinition.optional(),
|
|
86267
|
+
/** The chat's other ids, such as the hidden id it was first seen under; new in Nov 2026. */
|
|
86268
|
+
aliases: external_exports.array(external_exports.string().min(1).max(200)).max(16).optional()
|
|
86054
86269
|
});
|
|
86055
86270
|
var whatsappPairingSchema = whatsappPairingDefinition;
|
|
86056
86271
|
var pairingRefDefinition = external_exports.object({
|
|
@@ -86379,7 +86594,7 @@ var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
|
86379
86594
|
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, machineId: idSchema23 });
|
|
86380
86595
|
var ComputeApi = moduleApi()("compute");
|
|
86381
86596
|
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();
|
|
86382
|
-
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
|
|
86597
|
+
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).build();
|
|
86383
86598
|
var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
|
|
86384
86599
|
var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
|
|
86385
86600
|
var restRenameInputDefinition = external_exports.object({
|
|
@@ -86541,7 +86756,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
|
|
|
86541
86756
|
// src/services/computer-copy-commands.service.ts
|
|
86542
86757
|
import { mkdtemp as mkdtemp2, open as open4, rm as rm12, stat as stat10 } from "node:fs/promises";
|
|
86543
86758
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
86544
|
-
import { basename as basename8, dirname as
|
|
86759
|
+
import { basename as basename8, dirname as dirname22, resolve as resolve11 } from "node:path";
|
|
86545
86760
|
var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
|
|
86546
86761
|
copy a local file or folder into your hosted agent's work folder
|
|
86547
86762
|
(its owner only, up to 2 GiB packed); <folder> is relative to the
|
|
@@ -86557,7 +86772,7 @@ function packingOf({ path, isDirectory }) {
|
|
|
86557
86772
|
const contents = isDirectory && path.endsWith("/");
|
|
86558
86773
|
const absolute = resolve11(path);
|
|
86559
86774
|
const name3 = basename8(absolute);
|
|
86560
|
-
return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent:
|
|
86775
|
+
return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname22(absolute), entry: name3 };
|
|
86561
86776
|
}
|
|
86562
86777
|
async function sendParts2({
|
|
86563
86778
|
context,
|
|
@@ -86931,10 +87146,10 @@ async function computer({ context, args }) {
|
|
|
86931
87146
|
}
|
|
86932
87147
|
|
|
86933
87148
|
// src/services/connect-commands.service.ts
|
|
86934
|
-
import { readFile as
|
|
87149
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
86935
87150
|
|
|
86936
87151
|
// src/services/mcp-gateway.service.ts
|
|
86937
|
-
import { readFile as
|
|
87152
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
86938
87153
|
import { createInterface as createInterface3 } from "node:readline";
|
|
86939
87154
|
var TURN_HEADER = "x-laze-turn";
|
|
86940
87155
|
function serveMcpGateway({
|
|
@@ -86977,7 +87192,7 @@ async function relayMcpLines({
|
|
|
86977
87192
|
const github3 = env.LAZE_GITHUB_CONNECTION;
|
|
86978
87193
|
const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
|
|
86979
87194
|
const turnFile = env.LAZE_TURN_FILE;
|
|
86980
|
-
const readTurn = () =>
|
|
87195
|
+
const readTurn = () => readFile27(turnFile, "utf8").then(
|
|
86981
87196
|
(text3) => text3.trim(),
|
|
86982
87197
|
() => ""
|
|
86983
87198
|
);
|
|
@@ -87067,7 +87282,7 @@ async function turnOf({ context }) {
|
|
|
87067
87282
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
87068
87283
|
if (pinned) return pinned;
|
|
87069
87284
|
const file3 = env.LAZE_TURN_FILE;
|
|
87070
|
-
const turn = file3 ? await
|
|
87285
|
+
const turn = file3 ? await readFile28(file3, "utf8").then(
|
|
87071
87286
|
(text3) => text3.trim(),
|
|
87072
87287
|
() => ""
|
|
87073
87288
|
) : "";
|
|
@@ -87125,11 +87340,11 @@ async function connect({
|
|
|
87125
87340
|
}
|
|
87126
87341
|
|
|
87127
87342
|
// src/services/connector-commands.service.ts
|
|
87128
|
-
import { readFile as
|
|
87343
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
87129
87344
|
import { resolve as resolve12 } from "node:path";
|
|
87130
87345
|
|
|
87131
87346
|
// src/services/vault-keychain-commands.service.ts
|
|
87132
|
-
import { readFile as
|
|
87347
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
87133
87348
|
|
|
87134
87349
|
// src/rules/vault-input.rules.ts
|
|
87135
87350
|
function secondsOf(text3) {
|
|
@@ -87547,7 +87762,7 @@ async function secretText({ context, args }) {
|
|
|
87547
87762
|
);
|
|
87548
87763
|
}
|
|
87549
87764
|
const file3 = flagText({ args, name: "from-file" });
|
|
87550
|
-
const text3 = file3 ? await
|
|
87765
|
+
const text3 = file3 ? await readFile29(file3, "utf8") : await context.readStdin();
|
|
87551
87766
|
const trimmed = text3.replace(/\r?\n$/, "");
|
|
87552
87767
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
87553
87768
|
return trimmed;
|
|
@@ -87780,7 +87995,7 @@ async function keyText({ context, args }) {
|
|
|
87780
87995
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
87781
87996
|
}
|
|
87782
87997
|
const file3 = flagText({ args, name: "from-file" });
|
|
87783
|
-
const text3 = file3 ? await
|
|
87998
|
+
const text3 = file3 ? await readFile30(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
|
|
87784
87999
|
const trimmed = text3.trim();
|
|
87785
88000
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
87786
88001
|
return trimmed;
|
|
@@ -88101,7 +88316,7 @@ async function conversationDelete({ context, args }) {
|
|
|
88101
88316
|
}
|
|
88102
88317
|
|
|
88103
88318
|
// src/services/discord-commands.service.ts
|
|
88104
|
-
import { readFile as
|
|
88319
|
+
import { readFile as readFile31 } from "node:fs/promises";
|
|
88105
88320
|
import { resolve as resolve13 } from "node:path";
|
|
88106
88321
|
|
|
88107
88322
|
// ../../modules/discord/contract/src/discord.ts
|
|
@@ -88423,7 +88638,7 @@ async function secretsOf({ context, args }) {
|
|
|
88423
88638
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
88424
88639
|
if (fromConnection) return { fromConnection };
|
|
88425
88640
|
const file3 = flagText({ args, name: "from-file" });
|
|
88426
|
-
const text3 = file3 ? await
|
|
88641
|
+
const text3 = file3 ? await readFile31(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
|
|
88427
88642
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
88428
88643
|
if (lines2.length !== 2) {
|
|
88429
88644
|
throw new CliUsageError(
|
|
@@ -88726,7 +88941,7 @@ async function domains({ context, args }) {
|
|
|
88726
88941
|
}
|
|
88727
88942
|
|
|
88728
88943
|
// src/services/emoji-commands.service.ts
|
|
88729
|
-
import { readFile as
|
|
88944
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
88730
88945
|
import { resolve as resolve14 } from "node:path";
|
|
88731
88946
|
var EMOJI_USAGE = `Usage:
|
|
88732
88947
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
@@ -88767,7 +88982,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
88767
88982
|
const file3 = wordAt4(args, 3);
|
|
88768
88983
|
let bytes;
|
|
88769
88984
|
try {
|
|
88770
|
-
bytes = new Uint8Array(await
|
|
88985
|
+
bytes = new Uint8Array(await readFile32(resolve14(context.cwd, file3)));
|
|
88771
88986
|
} catch {
|
|
88772
88987
|
throw new CliUsageError(`Cannot read ${file3}.`);
|
|
88773
88988
|
}
|
|
@@ -89083,7 +89298,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
89083
89298
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
89084
89299
|
|
|
89085
89300
|
// src/services/workspace-commands.service.ts
|
|
89086
|
-
import { readFile as
|
|
89301
|
+
import { readFile as readFile33 } from "node:fs/promises";
|
|
89087
89302
|
import { resolve as resolve15 } from "node:path";
|
|
89088
89303
|
var ROLE_NAMES2 = {
|
|
89089
89304
|
OWNER: "Owner",
|
|
@@ -89266,7 +89481,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
89266
89481
|
async function readLogo({ context, file: file3 }) {
|
|
89267
89482
|
let bytes;
|
|
89268
89483
|
try {
|
|
89269
|
-
bytes = new Uint8Array(await
|
|
89484
|
+
bytes = new Uint8Array(await readFile33(resolve15(context.cwd, file3)));
|
|
89270
89485
|
} catch {
|
|
89271
89486
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
89272
89487
|
}
|
|
@@ -89866,7 +90081,7 @@ async function agentFeedAccess({
|
|
|
89866
90081
|
}
|
|
89867
90082
|
|
|
89868
90083
|
// src/services/feed-commands.service.ts
|
|
89869
|
-
import { readFile as
|
|
90084
|
+
import { readFile as readFile34 } from "node:fs/promises";
|
|
89870
90085
|
import { resolve as resolve16 } from "node:path";
|
|
89871
90086
|
|
|
89872
90087
|
// ../../modules/feed/contract/src/feed.delegate.ts
|
|
@@ -90116,7 +90331,9 @@ var feedEntrySchemaDefinition = external_exports.object({
|
|
|
90116
90331
|
/** The draft as the person edited it, sent with the action or the comment. */
|
|
90117
90332
|
draft: external_exports.string().nullable(),
|
|
90118
90333
|
urgent: external_exports.boolean(),
|
|
90119
|
-
createdAt: external_exports.iso.datetime()
|
|
90334
|
+
createdAt: external_exports.iso.datetime(),
|
|
90335
|
+
/** Files a person's comment carried, as they were when sent; their bytes stay in chat. */
|
|
90336
|
+
attachments: external_exports.array(feedAttachmentSchemaDefinition).max(FEED_ATTACHMENTS_MAX).optional()
|
|
90120
90337
|
});
|
|
90121
90338
|
var feedEntrySchema = feedEntrySchemaDefinition;
|
|
90122
90339
|
var feedApprovalStateSchema = external_exports.enum([
|
|
@@ -90364,9 +90581,13 @@ var commentFeedItemInputSchemaDefinition = external_exports.object({
|
|
|
90364
90581
|
body: external_exports.string(),
|
|
90365
90582
|
draft: external_exports.string().optional(),
|
|
90366
90583
|
/** With an after-step the comment is a note on the card and the agent files no turn. */
|
|
90367
|
-
after: feedCommentAfterSchemaDefinition.nullable().default(null)
|
|
90584
|
+
after: feedCommentAfterSchemaDefinition.nullable().default(null),
|
|
90585
|
+
/** Chat attachment ids, uploaded where `commentPlace` says; refused with an after-step. */
|
|
90586
|
+
attachmentIds: external_exports.array(external_exports.string().min(1)).max(FEED_ATTACHMENTS_MAX).optional()
|
|
90368
90587
|
});
|
|
90369
90588
|
var commentFeedItemInputSchema = commentFeedItemInputSchemaDefinition;
|
|
90589
|
+
var feedCommentPlaceSchemaDefinition = external_exports.object({ channelId: external_exports.string().nullable() });
|
|
90590
|
+
var feedCommentPlaceSchema = feedCommentPlaceSchemaDefinition;
|
|
90370
90591
|
var saveCommentDraftInputSchemaDefinition = external_exports.object({
|
|
90371
90592
|
...itemRef.shape,
|
|
90372
90593
|
text: external_exports.string().max(MESSAGE_BODY_MAX),
|
|
@@ -90541,8 +90762,18 @@ var unshareFeedItemInputSchemaDefinition = external_exports.object({
|
|
|
90541
90762
|
userId: external_exports.string().min(1)
|
|
90542
90763
|
});
|
|
90543
90764
|
var unshareFeedItemInputSchema = unshareFeedItemInputSchemaDefinition;
|
|
90544
|
-
var feedSharePersonSchemaDefinition = external_exports.object({
|
|
90765
|
+
var feedSharePersonSchemaDefinition = external_exports.object({
|
|
90766
|
+
userId: external_exports.string(),
|
|
90767
|
+
name: external_exports.string(),
|
|
90768
|
+
agentHears: external_exports.boolean().optional()
|
|
90769
|
+
});
|
|
90545
90770
|
var feedSharePersonSchema = feedSharePersonSchemaDefinition;
|
|
90771
|
+
var feedCommentReachSchemaDefinition = external_exports.object({
|
|
90772
|
+
hears: external_exports.boolean(),
|
|
90773
|
+
agentName: external_exports.string(),
|
|
90774
|
+
ownerName: external_exports.string().nullable()
|
|
90775
|
+
});
|
|
90776
|
+
var feedCommentReachSchema = feedCommentReachSchemaDefinition;
|
|
90546
90777
|
var feedShareAnswerSchemaDefinition = external_exports.object({
|
|
90547
90778
|
itemIds: external_exports.array(external_exports.string()),
|
|
90548
90779
|
people: external_exports.array(feedSharePersonSchemaDefinition),
|
|
@@ -90593,7 +90824,7 @@ var feedPageMirror = {
|
|
|
90593
90824
|
},
|
|
90594
90825
|
storable: feedPageForDisk
|
|
90595
90826
|
};
|
|
90596
|
-
var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("page", { mirrored: feedPageMirror }).withInput(pageFeedInputSchema).withOutput(feedPageSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).query("decisions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(feedDecisionsSchema).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).query("commentDrafts").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(commentDraftListSchema).mutation("saveCommentDraft").withInput(saveCommentDraftInputSchema).withOutput(commentDraftSavedSchema).mutation("deleteCommentDraft").withInput(itemRef).withOutput(commentDraftSavedSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("share").withInput(shareFeedItemInputSchema).withOutput(feedShareAnswerSchema).mutation("unshare").withInput(unshareFeedItemInputSchema).withOutput(feedShareAnswerSchema).query("shareCandidates").withInput(itemRef).withOutput(external_exports.array(feedSharePersonSchema)).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentTransfer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("pin").withInput(pinFeedItemInputSchema).withOutput(feedItemSchema).mutation("markRead").withInput(itemRef).withOutput(feedItemSchema).mutation("markUnread").withInput(itemRef).withOutput(feedItemSchema).mutation("markAllRead").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ workspaceId: external_exports.string() })).query("delegates").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(feedDelegateSchema)).mutation("setDelegate").withInput(setFeedDelegateInputSchema).withOutput(external_exports.array(feedDelegateSchema)).build();
|
|
90827
|
+
var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("page", { mirrored: feedPageMirror }).withInput(pageFeedInputSchema).withOutput(feedPageSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).query("decisions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(feedDecisionsSchema).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).mutation("commentPlace").withInput(itemRef).withOutput(feedCommentPlaceSchema).query("commentDrafts").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(commentDraftListSchema).mutation("saveCommentDraft").withInput(saveCommentDraftInputSchema).withOutput(commentDraftSavedSchema).mutation("deleteCommentDraft").withInput(itemRef).withOutput(commentDraftSavedSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("share").withInput(shareFeedItemInputSchema).withOutput(feedShareAnswerSchema).mutation("unshare").withInput(unshareFeedItemInputSchema).withOutput(feedShareAnswerSchema).query("shareCandidates").withInput(itemRef).withOutput(external_exports.array(feedSharePersonSchema)).query("commentReach").withInput(itemRef).withOutput(feedCommentReachSchema).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentTransfer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("pin").withInput(pinFeedItemInputSchema).withOutput(feedItemSchema).mutation("markRead").withInput(itemRef).withOutput(feedItemSchema).mutation("markUnread").withInput(itemRef).withOutput(feedItemSchema).mutation("markAllRead").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ workspaceId: external_exports.string() })).query("delegates").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(feedDelegateSchema)).mutation("setDelegate").withInput(setFeedDelegateInputSchema).withOutput(external_exports.array(feedDelegateSchema)).build();
|
|
90597
90828
|
var feedUi = uiTokens("feed");
|
|
90598
90829
|
var FeedNavSlot = feedUi.component("nav");
|
|
90599
90830
|
var FeedDecisionsSlot = feedUi.component("decisions");
|
|
@@ -90926,7 +91157,7 @@ async function feedTurnOf({
|
|
|
90926
91157
|
const read4 = async () => {
|
|
90927
91158
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
90928
91159
|
if (pinned) return pinned;
|
|
90929
|
-
if (env.LAZE_TURN_FILE) return (await
|
|
91160
|
+
if (env.LAZE_TURN_FILE) return (await readFile34(env.LAZE_TURN_FILE, "utf8")).trim();
|
|
90930
91161
|
return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
|
|
90931
91162
|
};
|
|
90932
91163
|
const turn = await read4().catch(() => "");
|
|
@@ -91000,7 +91231,7 @@ async function bodyOf2({
|
|
|
91000
91231
|
flags: flags2
|
|
91001
91232
|
}) {
|
|
91002
91233
|
const body = { ...flags2.fields };
|
|
91003
|
-
const read4 = (source) => "file" in source ?
|
|
91234
|
+
const read4 = (source) => "file" in source ? readFile34(resolve16(context.cwd, source.file), "utf8") : source.text;
|
|
91004
91235
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
|
|
91005
91236
|
if (flags2.rich) {
|
|
91006
91237
|
const text3 = await read4(flags2.rich.source);
|
|
@@ -91263,7 +91494,7 @@ async function textFlag({
|
|
|
91263
91494
|
}) {
|
|
91264
91495
|
const value = flagText({ args, name: name3 });
|
|
91265
91496
|
if (!value.startsWith("@")) return value;
|
|
91266
|
-
return
|
|
91497
|
+
return readFile34(resolve16(context.cwd, value.slice(1)), "utf8");
|
|
91267
91498
|
}
|
|
91268
91499
|
async function feedList({ context, args }) {
|
|
91269
91500
|
const { client } = await signedIn({ context, args });
|
|
@@ -91353,7 +91584,7 @@ async function ranksOf({
|
|
|
91353
91584
|
}) {
|
|
91354
91585
|
const file3 = flagText({ args, name: "file" });
|
|
91355
91586
|
if (file3) {
|
|
91356
|
-
const parsed = JSON.parse(await
|
|
91587
|
+
const parsed = JSON.parse(await readFile34(resolve16(context.cwd, file3), "utf8"));
|
|
91357
91588
|
if (Array.isArray(parsed)) return parsed;
|
|
91358
91589
|
throw new CliUsageError("--file holds a list of {itemId, priority}");
|
|
91359
91590
|
}
|
|
@@ -91466,7 +91697,7 @@ async function feed({ context, args }) {
|
|
|
91466
91697
|
}
|
|
91467
91698
|
|
|
91468
91699
|
// src/services/github-commands.service.ts
|
|
91469
|
-
import { readFile as
|
|
91700
|
+
import { readFile as readFile35 } from "node:fs/promises";
|
|
91470
91701
|
|
|
91471
91702
|
// src/rules/github-signature.rules.ts
|
|
91472
91703
|
var TURN_SEPARATOR = "~";
|
|
@@ -91536,7 +91767,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
91536
91767
|
var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Run `laze github request --repo <owner/name>` to post a card that gets it in one click, or its owner runs `laze agent set-github <agent> <connection>`.";
|
|
91537
91768
|
async function turnFileToken({ env }) {
|
|
91538
91769
|
if (!env.LAZE_TURN_FILE) return "";
|
|
91539
|
-
return
|
|
91770
|
+
return readFile35(env.LAZE_TURN_FILE, "utf8").then(
|
|
91540
91771
|
(text3) => text3.trim(),
|
|
91541
91772
|
() => ""
|
|
91542
91773
|
);
|
|
@@ -91570,7 +91801,7 @@ async function githubGh({
|
|
|
91570
91801
|
args: args.rest,
|
|
91571
91802
|
agentName: profile.name ?? "An agent",
|
|
91572
91803
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
91573
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
91804
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile35(path, "utf8")
|
|
91574
91805
|
});
|
|
91575
91806
|
return context.runCommand({
|
|
91576
91807
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -92030,6 +92261,7 @@ var IP_USAGE = `Usage:
|
|
|
92030
92261
|
laze ip countries the countries on sale
|
|
92031
92262
|
laze ip domains the domains it routes
|
|
92032
92263
|
laze ip domains add|remove <domain>... change them; laze ip domains reset brings the defaults back
|
|
92264
|
+
laze ip scope all|sites all web traffic, or only your domains
|
|
92033
92265
|
laze ip offer [--site <domain>] the plain offer to pass on when a site blocks the shared address
|
|
92034
92266
|
laze ip list who has one, its country and price (Owners and Admins)`;
|
|
92035
92267
|
var printJson7 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
@@ -92058,7 +92290,8 @@ function ipLines(status11) {
|
|
|
92058
92290
|
const price = `${status11.monthlyPrice} ${status11.currency.toUpperCase()} a month from the workspace's credits`;
|
|
92059
92291
|
const country = status11.country?.name ?? "?";
|
|
92060
92292
|
const lines2 = linesFor({ status: status11, price, country });
|
|
92061
|
-
|
|
92293
|
+
const carries = status11.scope === "all" ? "all web traffic" : status11.domains.join(", ");
|
|
92294
|
+
lines2.push(`Carries: ${carries}`, `Settings: ${status11.settingsUrl}`);
|
|
92062
92295
|
return lines2;
|
|
92063
92296
|
}
|
|
92064
92297
|
async function status5({ context, args }) {
|
|
@@ -92105,6 +92338,15 @@ function domainsEditOf({
|
|
|
92105
92338
|
if (action === "remove") return { remove: names };
|
|
92106
92339
|
return void 0;
|
|
92107
92340
|
}
|
|
92341
|
+
async function scope2(run4) {
|
|
92342
|
+
const parsed = dedicatedIpScopeSchema.safeParse(run4.args.words[2]);
|
|
92343
|
+
if (!parsed.success) throw new CliUsageError(IP_USAGE);
|
|
92344
|
+
const client = await computeClient(run4);
|
|
92345
|
+
await printAnswer(
|
|
92346
|
+
run4,
|
|
92347
|
+
await client.post(DEDICATED_IP_REST_PATHS.domains, { scope: parsed.data })
|
|
92348
|
+
);
|
|
92349
|
+
}
|
|
92108
92350
|
async function domains2(run4) {
|
|
92109
92351
|
const [, , action, ...names] = run4.args.words;
|
|
92110
92352
|
if (!action) {
|
|
@@ -92152,6 +92394,7 @@ var IP_COMMANDS = {
|
|
|
92152
92394
|
off: turnOff,
|
|
92153
92395
|
countries,
|
|
92154
92396
|
domains: domains2,
|
|
92397
|
+
scope: scope2,
|
|
92155
92398
|
offer,
|
|
92156
92399
|
list: list8
|
|
92157
92400
|
};
|
|
@@ -92163,19 +92406,19 @@ async function ip({ context, args }) {
|
|
|
92163
92406
|
}
|
|
92164
92407
|
|
|
92165
92408
|
// src/services/join-commands.service.ts
|
|
92166
|
-
import { mkdir as
|
|
92167
|
-
import { dirname as
|
|
92409
|
+
import { mkdir as mkdir23, readFile as readFile36, rename as rename8, rm as rm13, writeFile as writeFile22 } from "node:fs/promises";
|
|
92410
|
+
import { dirname as dirname23, join as join25 } from "node:path";
|
|
92168
92411
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
92169
92412
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
92170
92413
|
function pendingPathOf({ context }) {
|
|
92171
|
-
return join25(
|
|
92414
|
+
return join25(dirname23(context.environment.configPath), "join", "pending.json");
|
|
92172
92415
|
}
|
|
92173
92416
|
async function readPending({
|
|
92174
92417
|
context,
|
|
92175
92418
|
url: url2,
|
|
92176
92419
|
args
|
|
92177
92420
|
}) {
|
|
92178
|
-
const pending2 = await
|
|
92421
|
+
const pending2 = await readFile36(pendingPathOf({ context }), "utf8").then(
|
|
92179
92422
|
(text3) => JSON.parse(text3),
|
|
92180
92423
|
() => void 0
|
|
92181
92424
|
);
|
|
@@ -92185,9 +92428,9 @@ async function readPending({
|
|
|
92185
92428
|
}
|
|
92186
92429
|
async function keepPending({ context, pending: pending2 }) {
|
|
92187
92430
|
const path = pendingPathOf({ context });
|
|
92188
|
-
await
|
|
92431
|
+
await mkdir23(dirname23(path), { recursive: true, mode: 448 });
|
|
92189
92432
|
const temporary = `${path}.${process.pid}.tmp`;
|
|
92190
|
-
await
|
|
92433
|
+
await writeFile22(temporary, JSON.stringify(pending2), { mode: 384 });
|
|
92191
92434
|
await rename8(temporary, path);
|
|
92192
92435
|
}
|
|
92193
92436
|
async function dropPending({ context }) {
|
|
@@ -93325,18 +93568,18 @@ async function serveMcp({
|
|
|
93325
93568
|
}
|
|
93326
93569
|
|
|
93327
93570
|
// src/services/memory-commands.service.ts
|
|
93328
|
-
import { readdir as readdir7, readFile as
|
|
93571
|
+
import { readdir as readdir7, readFile as readFile38 } from "node:fs/promises";
|
|
93329
93572
|
import { join as join26, resolve as resolve18 } from "node:path";
|
|
93330
93573
|
|
|
93331
93574
|
// src/services/mount-files.service.ts
|
|
93332
|
-
import { mkdir as
|
|
93333
|
-
import { dirname as
|
|
93575
|
+
import { mkdir as mkdir24, readFile as readFile37, rm as rm14, writeFile as writeFile23 } from "node:fs/promises";
|
|
93576
|
+
import { dirname as dirname24, relative as relative5, resolve as resolve17 } from "node:path";
|
|
93334
93577
|
async function textArgument({
|
|
93335
93578
|
context,
|
|
93336
93579
|
value
|
|
93337
93580
|
}) {
|
|
93338
93581
|
if (value === "-") return context.readStdin();
|
|
93339
|
-
if (value.startsWith("@")) return
|
|
93582
|
+
if (value.startsWith("@")) return readFile37(resolve17(context.cwd, value.slice(1)), "utf8");
|
|
93340
93583
|
return value;
|
|
93341
93584
|
}
|
|
93342
93585
|
function turnChannel({ context, args }) {
|
|
@@ -93350,14 +93593,14 @@ async function writeMount({
|
|
|
93350
93593
|
}) {
|
|
93351
93594
|
const root = resolve17(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
93352
93595
|
await rm14(root, { recursive: true, force: true });
|
|
93353
|
-
await
|
|
93596
|
+
await mkdir24(root, { recursive: true });
|
|
93354
93597
|
for (const file3 of files2) {
|
|
93355
93598
|
const target = resolve17(root, file3.path);
|
|
93356
93599
|
const inside = relative5(root, target);
|
|
93357
93600
|
if (!inside || inside.startsWith(".."))
|
|
93358
93601
|
throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
|
|
93359
|
-
await
|
|
93360
|
-
await
|
|
93602
|
+
await mkdir24(dirname24(target), { recursive: true });
|
|
93603
|
+
await writeFile23(target, file3.content);
|
|
93361
93604
|
}
|
|
93362
93605
|
return root;
|
|
93363
93606
|
}
|
|
@@ -93483,7 +93726,7 @@ async function turnTokenOf5({ context }) {
|
|
|
93483
93726
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
93484
93727
|
if (pinned) return pinned;
|
|
93485
93728
|
if (!env.LAZE_TURN_FILE) return "";
|
|
93486
|
-
return
|
|
93729
|
+
return readFile38(env.LAZE_TURN_FILE, "utf8").then(
|
|
93487
93730
|
(text3) => text3.trim(),
|
|
93488
93731
|
() => ""
|
|
93489
93732
|
);
|
|
@@ -93613,7 +93856,7 @@ async function siestaImport({
|
|
|
93613
93856
|
dir
|
|
93614
93857
|
}) {
|
|
93615
93858
|
const root = resolve18(context.cwd, dir);
|
|
93616
|
-
const log = await
|
|
93859
|
+
const log = await readFile38(join26(root, "LOG.md"));
|
|
93617
93860
|
const names = (await readdir7(join26(root, "tree")).catch(() => [])).filter(
|
|
93618
93861
|
(name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
|
|
93619
93862
|
);
|
|
@@ -93621,7 +93864,7 @@ async function siestaImport({
|
|
|
93621
93864
|
await Promise.all(
|
|
93622
93865
|
names.map(async (name3) => [
|
|
93623
93866
|
name3.slice(0, -3),
|
|
93624
|
-
(await
|
|
93867
|
+
(await readFile38(join26(root, "tree", name3))).toString("base64")
|
|
93625
93868
|
])
|
|
93626
93869
|
)
|
|
93627
93870
|
);
|
|
@@ -93641,7 +93884,7 @@ async function memoryImport({ context, args }) {
|
|
|
93641
93884
|
const dir = flagText({ args, name: "optmem" });
|
|
93642
93885
|
if (!dir) throw new CliUsageError(USAGE13);
|
|
93643
93886
|
const root = resolve18(context.cwd, dir);
|
|
93644
|
-
const log = await
|
|
93887
|
+
const log = await readFile38(join26(root, "LOG.txt"));
|
|
93645
93888
|
const sizes2 = (await readdir7(join26(root, "TREE")).catch(() => [])).filter(
|
|
93646
93889
|
(name3) => /^\d{1,4}$/.test(name3)
|
|
93647
93890
|
);
|
|
@@ -93649,7 +93892,7 @@ async function memoryImport({ context, args }) {
|
|
|
93649
93892
|
await Promise.all(
|
|
93650
93893
|
sizes2.map(async (size) => [
|
|
93651
93894
|
size,
|
|
93652
|
-
(await
|
|
93895
|
+
(await readFile38(join26(root, "TREE", size))).toString("base64")
|
|
93653
93896
|
])
|
|
93654
93897
|
)
|
|
93655
93898
|
);
|
|
@@ -94213,9 +94456,9 @@ async function openclaw({
|
|
|
94213
94456
|
}
|
|
94214
94457
|
|
|
94215
94458
|
// src/services/operator-key-commands.service.ts
|
|
94216
|
-
import { createHash as
|
|
94217
|
-
import { mkdir as
|
|
94218
|
-
import { dirname as
|
|
94459
|
+
import { createHash as createHash6, randomBytes as randomBytes3 } from "node:crypto";
|
|
94460
|
+
import { mkdir as mkdir25, readFile as readFile39, rm as rm15, writeFile as writeFile24 } from "node:fs/promises";
|
|
94461
|
+
import { dirname as dirname25, join as join27 } from "node:path";
|
|
94219
94462
|
|
|
94220
94463
|
// ../../modules/audit-log/contract/src/audit-log.api.ts
|
|
94221
94464
|
var auditEntrySchemaDefinition = external_exports.object({
|
|
@@ -95544,15 +95787,15 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
|
|
|
95544
95787
|
laze ops status <key> waiting, approved or ended
|
|
95545
95788
|
laze ops use <key> run the approved action and print the answer`;
|
|
95546
95789
|
var POLL_MS3 = 5e3;
|
|
95547
|
-
var keyFile = ({ context, keyId }) => join27(
|
|
95790
|
+
var keyFile = ({ context, keyId }) => join27(dirname25(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
|
|
95548
95791
|
async function saveSecret({
|
|
95549
95792
|
context,
|
|
95550
95793
|
keyId,
|
|
95551
95794
|
secret
|
|
95552
95795
|
}) {
|
|
95553
95796
|
const path = keyFile({ context, keyId });
|
|
95554
|
-
await
|
|
95555
|
-
await
|
|
95797
|
+
await mkdir25(dirname25(path), { recursive: true, mode: 448 });
|
|
95798
|
+
await writeFile24(path, secret, { mode: 384 });
|
|
95556
95799
|
}
|
|
95557
95800
|
function typedArg(text3) {
|
|
95558
95801
|
if (["true", "false", "null"].includes(text3)) return JSON.parse(text3);
|
|
@@ -95609,7 +95852,7 @@ async function requestKey({ context, args }) {
|
|
|
95609
95852
|
target,
|
|
95610
95853
|
args: argsOf({ args }),
|
|
95611
95854
|
reason: reason2,
|
|
95612
|
-
secretHash:
|
|
95855
|
+
secretHash: createHash6("sha256").update(secret).digest("hex")
|
|
95613
95856
|
});
|
|
95614
95857
|
await saveSecret({ context, keyId: key.id, secret });
|
|
95615
95858
|
const answered = args.flags.wait ? await waitForAnswer({ context, client, key }) : key;
|
|
@@ -95645,7 +95888,7 @@ async function useKey({ context, args }) {
|
|
|
95645
95888
|
if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
95646
95889
|
const { client } = await signedIn({ context, args });
|
|
95647
95890
|
const path = keyFile({ context, keyId });
|
|
95648
|
-
const secret = await
|
|
95891
|
+
const secret = await readFile39(path, "utf8").catch(() => null);
|
|
95649
95892
|
if (secret === null) {
|
|
95650
95893
|
throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
|
|
95651
95894
|
}
|
|
@@ -95710,8 +95953,8 @@ ${OPS_USAGE}`);
|
|
|
95710
95953
|
}
|
|
95711
95954
|
|
|
95712
95955
|
// src/services/release-watch.service.ts
|
|
95713
|
-
import { mkdir as
|
|
95714
|
-
import { dirname as
|
|
95956
|
+
import { mkdir as mkdir26, readFile as readFile40, realpath, writeFile as writeFile25 } from "node:fs/promises";
|
|
95957
|
+
import { dirname as dirname26, join as join28 } from "node:path";
|
|
95715
95958
|
|
|
95716
95959
|
// src/rules/cli-update.rules.ts
|
|
95717
95960
|
var CLI_PACKAGE = "@lazehq/cli";
|
|
@@ -95857,13 +96100,13 @@ async function startedUpdate({
|
|
|
95857
96100
|
if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
|
|
95858
96101
|
const plan2 = updatePlanOf({ script: await scriptOf(context) });
|
|
95859
96102
|
if (plan2.kind !== "install") return null;
|
|
95860
|
-
const folder =
|
|
96103
|
+
const folder = dirname26(context.environment.configPath);
|
|
95861
96104
|
const stamp = join28(folder, "auto-update.json");
|
|
95862
|
-
const last = await
|
|
96105
|
+
const last = await readFile40(stamp, "utf8").then((text3) => JSON.parse(text3)).catch(() => null);
|
|
95863
96106
|
const now = context.nowMs();
|
|
95864
96107
|
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
95865
|
-
await
|
|
95866
|
-
await
|
|
96108
|
+
await mkdir26(folder, { recursive: true, mode: 448 });
|
|
96109
|
+
await writeFile25(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
|
|
95867
96110
|
context.processes.spawnDetached({
|
|
95868
96111
|
argv: [...context.program, "update"],
|
|
95869
96112
|
logPath: join28(folder, "auto-update.log")
|
|
@@ -95903,7 +96146,7 @@ function watchingRelease({
|
|
|
95903
96146
|
}
|
|
95904
96147
|
|
|
95905
96148
|
// src/services/rush-guard.service.ts
|
|
95906
|
-
import { readFile as
|
|
96149
|
+
import { readFile as readFile41, rm as rm16 } from "node:fs/promises";
|
|
95907
96150
|
var WATCH_MS3 = 2e3;
|
|
95908
96151
|
var RETRY_MS2 = 3e4;
|
|
95909
96152
|
async function guardRound(guard) {
|
|
@@ -95946,7 +96189,7 @@ async function rushWakeHook({ context, args }) {
|
|
|
95946
96189
|
while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
|
|
95947
96190
|
const { client, name: name3 } = await signedIn({ context, args });
|
|
95948
96191
|
const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
95949
|
-
const note = await
|
|
96192
|
+
const note = await readFile41(noted, "utf8").then(
|
|
95950
96193
|
(text3) => JSON.parse(text3),
|
|
95951
96194
|
() => void 0
|
|
95952
96195
|
);
|
|
@@ -96144,7 +96387,7 @@ async function schedule({ context, args }) {
|
|
|
96144
96387
|
}
|
|
96145
96388
|
|
|
96146
96389
|
// src/services/skill-commands.service.ts
|
|
96147
|
-
import { readdir as readdir8, readFile as
|
|
96390
|
+
import { readdir as readdir8, readFile as readFile42 } from "node:fs/promises";
|
|
96148
96391
|
import { join as join29, relative as relative6, resolve as resolve20 } from "node:path";
|
|
96149
96392
|
var USAGE17 = `Usage:
|
|
96150
96393
|
laze skill list [--agent <agentId>]
|
|
@@ -96167,7 +96410,7 @@ async function folderFiles({ root }) {
|
|
|
96167
96410
|
for (const entry of entries) {
|
|
96168
96411
|
if (!entry.isFile()) continue;
|
|
96169
96412
|
const full = join29(entry.parentPath, entry.name);
|
|
96170
|
-
files2.push({ path: relative6(root, full), content: await
|
|
96413
|
+
files2.push({ path: relative6(root, full), content: await readFile42(full, "utf8") });
|
|
96171
96414
|
}
|
|
96172
96415
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
96173
96416
|
}
|
|
@@ -96265,7 +96508,7 @@ async function skillUpdate({ context, args }) {
|
|
|
96265
96508
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
96266
96509
|
throw new CliUsageError(USAGE17);
|
|
96267
96510
|
}
|
|
96268
|
-
const skillMd = skillMdFile ? await
|
|
96511
|
+
const skillMd = skillMdFile ? await readFile42(resolve20(context.cwd, skillMdFile), "utf8") : void 0;
|
|
96269
96512
|
const { client } = await signedIn({ context, args });
|
|
96270
96513
|
const updated = await client.post("/api/skills/update", {
|
|
96271
96514
|
name: name3,
|
|
@@ -96311,7 +96554,7 @@ async function skill({ context, args }) {
|
|
|
96311
96554
|
}
|
|
96312
96555
|
|
|
96313
96556
|
// src/services/slack-commands.service.ts
|
|
96314
|
-
import { readFile as
|
|
96557
|
+
import { readFile as readFile43 } from "node:fs/promises";
|
|
96315
96558
|
import { resolve as resolve21 } from "node:path";
|
|
96316
96559
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
96317
96560
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -96359,7 +96602,7 @@ async function secretLines({ context, args }) {
|
|
|
96359
96602
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
96360
96603
|
}
|
|
96361
96604
|
const file3 = flagText({ args, name: "from-file" });
|
|
96362
|
-
const text3 = file3 ? await
|
|
96605
|
+
const text3 = file3 ? await readFile43(resolve21(context.cwd, file3), "utf8") : await context.readStdin();
|
|
96363
96606
|
return text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
96364
96607
|
}
|
|
96365
96608
|
async function secretsOf2({
|
|
@@ -96663,7 +96906,7 @@ async function slack({
|
|
|
96663
96906
|
}
|
|
96664
96907
|
|
|
96665
96908
|
// src/services/sso-commands.service.ts
|
|
96666
|
-
import { readFile as
|
|
96909
|
+
import { readFile as readFile44 } from "node:fs/promises";
|
|
96667
96910
|
var SSO_USAGE = `Usage:
|
|
96668
96911
|
laze sso domains claimed domains and how each signs in (admins)
|
|
96669
96912
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -96750,7 +96993,7 @@ function refuseSecretFlags({ args }) {
|
|
|
96750
96993
|
}
|
|
96751
96994
|
async function clientSecretOf({ context, args }) {
|
|
96752
96995
|
const file3 = flagText({ args, name: "from-file" });
|
|
96753
|
-
const text3 = file3 ? await
|
|
96996
|
+
const text3 = file3 ? await readFile44(file3, "utf8") : await context.readStdin();
|
|
96754
96997
|
const secret = text3.trim();
|
|
96755
96998
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
96756
96999
|
return secret;
|
|
@@ -97082,8 +97325,8 @@ async function update2({
|
|
|
97082
97325
|
}
|
|
97083
97326
|
|
|
97084
97327
|
// src/services/vault-env-commands.service.ts
|
|
97085
|
-
import { readFile as
|
|
97086
|
-
import { dirname as
|
|
97328
|
+
import { readFile as readFile45, stat as stat11 } from "node:fs/promises";
|
|
97329
|
+
import { dirname as dirname27, join as join30, resolve as resolve22 } from "node:path";
|
|
97087
97330
|
|
|
97088
97331
|
// src/rules/vault-manifest.rules.ts
|
|
97089
97332
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -97431,9 +97674,9 @@ async function manifestPathOf({
|
|
|
97431
97674
|
if (named) return resolve22(context.cwd, named);
|
|
97432
97675
|
const environment = flagText({ args, name: "env" });
|
|
97433
97676
|
const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
97434
|
-
for (let dir = resolve22(context.cwd); ; dir =
|
|
97677
|
+
for (let dir = resolve22(context.cwd); ; dir = dirname27(dir)) {
|
|
97435
97678
|
if (await isFile(join30(dir, file3))) return join30(dir, file3);
|
|
97436
|
-
if (
|
|
97679
|
+
if (dirname27(dir) === dir) break;
|
|
97437
97680
|
}
|
|
97438
97681
|
throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
|
|
97439
97682
|
${ENV_USAGE}`);
|
|
@@ -97443,7 +97686,7 @@ async function manifestOf({
|
|
|
97443
97686
|
args
|
|
97444
97687
|
}) {
|
|
97445
97688
|
const file3 = await manifestPathOf({ context, args });
|
|
97446
|
-
const text3 = await
|
|
97689
|
+
const text3 = await readFile45(file3, "utf8").catch(() => {
|
|
97447
97690
|
throw new CliUsageError(`laze vault: cannot read ${file3}`);
|
|
97448
97691
|
});
|
|
97449
97692
|
return { file: file3, lines: parseManifest({ text: text3, file: file3 }) };
|
|
@@ -97758,7 +98001,7 @@ async function vaultScrub({ context, args }) {
|
|
|
97758
98001
|
}
|
|
97759
98002
|
|
|
97760
98003
|
// src/services/whatsapp-business-commands.service.ts
|
|
97761
|
-
import { readFile as
|
|
98004
|
+
import { readFile as readFile46 } from "node:fs/promises";
|
|
97762
98005
|
import { resolve as resolve23 } from "node:path";
|
|
97763
98006
|
|
|
97764
98007
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -98178,7 +98421,7 @@ async function secretsOf3({ context, args }) {
|
|
|
98178
98421
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
98179
98422
|
if (fromConnection) return { fromConnection };
|
|
98180
98423
|
const file3 = flagText({ args, name: "from-file" });
|
|
98181
|
-
const text3 = file3 ? await
|
|
98424
|
+
const text3 = file3 ? await readFile46(resolve23(context.cwd, file3), "utf8") : await context.readStdin();
|
|
98182
98425
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
98183
98426
|
if (lines2.length !== 2) {
|
|
98184
98427
|
throw new CliUsageError(
|
|
@@ -98406,12 +98649,15 @@ var PATHS3 = {
|
|
|
98406
98649
|
var STATUS_WAIT_SECONDS2 = 50;
|
|
98407
98650
|
var STATUS_CALLS2 = 2;
|
|
98408
98651
|
var SETTLED = /* @__PURE__ */ new Set(["sent", "denied", "expired", "failed"]);
|
|
98652
|
+
var READ_WAIT_SECONDS = 50;
|
|
98409
98653
|
var USAGE19 = [
|
|
98410
|
-
"Usage: laze whatsapp chats <machine> [--limit <n>]
|
|
98411
|
-
" laze whatsapp read <machine> <chat> [--limit <n>]
|
|
98654
|
+
"Usage: laze whatsapp chats [<machine>] [--limit <n>] the chats, newest first",
|
|
98655
|
+
" laze whatsapp read [<machine>] <chat> [--limit <n>] a chat's last messages, oldest first",
|
|
98656
|
+
" (a read your owner set to Always ask waits for their answer; --request <id> picks it up later)",
|
|
98412
98657
|
' laze whatsapp send <machine> <chat> "<text>" send as the owner; an agent waits for their approval',
|
|
98413
98658
|
" laze whatsapp status <send-id> where a send stands",
|
|
98414
98659
|
WHATSAPP_PAIRING_USAGE,
|
|
98660
|
+
"With no machine it is the WhatsApp linked on your (or your agent's owner's) Laze computer.",
|
|
98415
98661
|
"A chat is its id, a phone number or a contact or group name."
|
|
98416
98662
|
].join("\n");
|
|
98417
98663
|
function word2({ args, at }) {
|
|
@@ -98426,17 +98672,35 @@ function limitOf5({ args }) {
|
|
|
98426
98672
|
if (!Number.isInteger(limit) || limit < 1) throw new CliUsageError(USAGE19);
|
|
98427
98673
|
return { limit };
|
|
98428
98674
|
}
|
|
98675
|
+
async function askingRead({
|
|
98676
|
+
client,
|
|
98677
|
+
path,
|
|
98678
|
+
body,
|
|
98679
|
+
args
|
|
98680
|
+
}) {
|
|
98681
|
+
const request2 = flagText({ args, name: "request" });
|
|
98682
|
+
const first = { ...body, waitSeconds: READ_WAIT_SECONDS, ...request2 ? { request: request2 } : {} };
|
|
98683
|
+
try {
|
|
98684
|
+
return await client.post(path, first);
|
|
98685
|
+
} catch (error63) {
|
|
98686
|
+
const waiting = error63 instanceof LazeApiError && error63.code === "whatsapp_read_waiting";
|
|
98687
|
+
const asked = waiting ? error63.meta?.request : void 0;
|
|
98688
|
+
if (typeof asked !== "string") throw error63;
|
|
98689
|
+
return client.post(path, { ...first, request: asked });
|
|
98690
|
+
}
|
|
98691
|
+
}
|
|
98429
98692
|
async function chats({ context, args }) {
|
|
98430
98693
|
const client = await computeClient({ context, args });
|
|
98431
|
-
const
|
|
98432
|
-
|
|
98433
|
-
|
|
98694
|
+
const machine2 = args.words[2];
|
|
98695
|
+
const answer6 = await askingRead({
|
|
98696
|
+
client,
|
|
98697
|
+
path: PATHS3.chats,
|
|
98698
|
+
body: { ...machine2 ? { machine: machine2 } : {}, ...limitOf5({ args }) },
|
|
98699
|
+
args
|
|
98434
98700
|
});
|
|
98435
98701
|
if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
|
|
98436
98702
|
`);
|
|
98437
|
-
if (answer6.chats.length === 0)
|
|
98438
|
-
return context.out(`No WhatsApp chats on ${answer6.machine} yet.
|
|
98439
|
-
`);
|
|
98703
|
+
if (answer6.chats.length === 0) return context.out("No WhatsApp chats kept yet.\n");
|
|
98440
98704
|
for (const chat of answer6.chats) {
|
|
98441
98705
|
const kind2 = chat.group ? "group" : "chat";
|
|
98442
98706
|
context.out(
|
|
@@ -98447,13 +98711,21 @@ async function chats({ context, args }) {
|
|
|
98447
98711
|
}
|
|
98448
98712
|
async function read3({ context, args }) {
|
|
98449
98713
|
const client = await computeClient({ context, args });
|
|
98450
|
-
const
|
|
98451
|
-
|
|
98452
|
-
|
|
98453
|
-
|
|
98714
|
+
const named = args.words.length > 3;
|
|
98715
|
+
const answer6 = await askingRead({
|
|
98716
|
+
client,
|
|
98717
|
+
path: PATHS3.read,
|
|
98718
|
+
body: {
|
|
98719
|
+
...named ? { machine: word2({ args, at: 2 }) } : {},
|
|
98720
|
+
chat: word2({ args, at: named ? 3 : 2 }),
|
|
98721
|
+
...limitOf5({ args })
|
|
98722
|
+
},
|
|
98723
|
+
args
|
|
98724
|
+
});
|
|
98454
98725
|
if (args.flags.json) return context.out(`${JSON.stringify(answer6, null, 2)}
|
|
98455
98726
|
`);
|
|
98456
|
-
|
|
98727
|
+
const where = named ? ` on ${answer6.machine}` : "";
|
|
98728
|
+
context.out(`${answer6.chat.name} (${answer6.chat.id})${where}
|
|
98457
98729
|
`);
|
|
98458
98730
|
if (answer6.messages.length === 0) context.out("No messages kept yet.\n");
|
|
98459
98731
|
for (const message2 of answer6.messages)
|
|
@@ -98938,7 +99210,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
98938
99210
|
laze machine exec <machine> --vault <connection> --reason "<why>" -- <command> the same, with a vault connection
|
|
98939
99211
|
laze machine host <machine> <agent> [--when-offline wait|computer] run your personal agent on your machine
|
|
98940
99212
|
laze machine unhost <agent> run the agent on your agent computer again
|
|
98941
|
-
laze whatsapp chats|read <machine> [<chat>] [--limit <n>]
|
|
99213
|
+
laze whatsapp chats|read [<machine>] [<chat>] [--limit <n>] your person's WhatsApp, read through Laze
|
|
98942
99214
|
laze whatsapp send <machine> <chat> "<text>" send as its owner; each message waits for their approval
|
|
98943
99215
|
laze whatsapp unpair <machine> unlink WhatsApp; linking is in Settings, Machines
|
|
98944
99216
|
laze whatsapp-business status|conversations|read|send|send-template|send-status|templates|prices
|
|
@@ -99250,14 +99522,14 @@ function exitCodeOf({ context, error: error63 }) {
|
|
|
99250
99522
|
// src/services/machine-key.service.ts
|
|
99251
99523
|
import { execFile as execFile2 } from "node:child_process";
|
|
99252
99524
|
import {
|
|
99253
|
-
createHash as
|
|
99525
|
+
createHash as createHash7,
|
|
99254
99526
|
createPrivateKey,
|
|
99255
99527
|
generateKeyPairSync,
|
|
99256
99528
|
randomBytes as randomBytes4,
|
|
99257
99529
|
sign
|
|
99258
99530
|
} from "node:crypto";
|
|
99259
|
-
import { chmod as chmod4, link, mkdir as
|
|
99260
|
-
import { dirname as
|
|
99531
|
+
import { chmod as chmod4, link, mkdir as mkdir27, readFile as readFile47, rm as rm18, writeFile as writeFile26 } from "node:fs/promises";
|
|
99532
|
+
import { dirname as dirname28, join as join31 } from "node:path";
|
|
99261
99533
|
var KEYCHAIN_SERVICE = "laze-cli-machine-key";
|
|
99262
99534
|
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve24, reject) => {
|
|
99263
99535
|
const child = execFile2(
|
|
@@ -99297,15 +99569,15 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
99297
99569
|
});
|
|
99298
99570
|
}
|
|
99299
99571
|
get metaPath() {
|
|
99300
|
-
return join31(
|
|
99572
|
+
return join31(dirname28(this.options.configPath), "machine-key.json");
|
|
99301
99573
|
}
|
|
99302
99574
|
/** Named by the key, so two CLIs making a key at once never overwrite each other's. */
|
|
99303
99575
|
pemPathOf(jwk) {
|
|
99304
|
-
return join31(
|
|
99576
|
+
return join31(dirname28(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
|
|
99305
99577
|
}
|
|
99306
99578
|
/** The Keychain item's account: one per config file and key. */
|
|
99307
99579
|
accountOf(jwk) {
|
|
99308
|
-
const config2 =
|
|
99580
|
+
const config2 = createHash7("sha256").update(this.options.configPath).digest("hex");
|
|
99309
99581
|
return `${config2.slice(0, 32)}-${shortOf(jwk)}`;
|
|
99310
99582
|
}
|
|
99311
99583
|
/** The key if this machine made one; null otherwise. Read once per process. */
|
|
@@ -99329,7 +99601,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
99329
99601
|
async read() {
|
|
99330
99602
|
let meta3;
|
|
99331
99603
|
try {
|
|
99332
|
-
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await
|
|
99604
|
+
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile47(this.metaPath, "utf8")));
|
|
99333
99605
|
} catch {
|
|
99334
99606
|
return null;
|
|
99335
99607
|
}
|
|
@@ -99344,7 +99616,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
99344
99616
|
"-w"
|
|
99345
99617
|
],
|
|
99346
99618
|
timeoutMs: 1e4
|
|
99347
|
-
}) : await
|
|
99619
|
+
}) : await readFile47(this.pemPathOf(meta3.jwk), "utf8");
|
|
99348
99620
|
return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
|
|
99349
99621
|
}
|
|
99350
99622
|
async make() {
|
|
@@ -99428,8 +99700,8 @@ async function writeOnce({ path, text: text3 }) {
|
|
|
99428
99700
|
}
|
|
99429
99701
|
}
|
|
99430
99702
|
async function writePrivate({ path, text: text3 }) {
|
|
99431
|
-
await
|
|
99432
|
-
await
|
|
99703
|
+
await mkdir27(dirname28(path), { recursive: true, mode: 448 });
|
|
99704
|
+
await writeFile26(path, text3, { mode: 384 });
|
|
99433
99705
|
await chmod4(path, 384);
|
|
99434
99706
|
}
|
|
99435
99707
|
|
|
@@ -99486,8 +99758,8 @@ function machineProofFetch({
|
|
|
99486
99758
|
// src/services/processes.service.ts
|
|
99487
99759
|
import { execFile as execFile3, spawn as spawn4 } from "node:child_process";
|
|
99488
99760
|
import { mkdirSync, openSync } from "node:fs";
|
|
99489
|
-
import { readFile as
|
|
99490
|
-
import { dirname as
|
|
99761
|
+
import { readFile as readFile48, readlink } from "node:fs/promises";
|
|
99762
|
+
import { dirname as dirname29 } from "node:path";
|
|
99491
99763
|
import { promisify as promisify2 } from "node:util";
|
|
99492
99764
|
var run3 = promisify2(execFile3);
|
|
99493
99765
|
function alive(pid) {
|
|
@@ -99500,14 +99772,14 @@ function alive(pid) {
|
|
|
99500
99772
|
}
|
|
99501
99773
|
}
|
|
99502
99774
|
async function argsOf2(pid) {
|
|
99503
|
-
const raw = await
|
|
99775
|
+
const raw = await readFile48(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
99504
99776
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
99505
99777
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
99506
99778
|
const line = listed?.stdout.trim();
|
|
99507
99779
|
return line ? line.split(/\s+/) : void 0;
|
|
99508
99780
|
}
|
|
99509
99781
|
async function parentOf(pid) {
|
|
99510
|
-
const stat12 = await
|
|
99782
|
+
const stat12 = await readFile48(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
99511
99783
|
const fromStat = stat12 ? Number(stat12.slice(stat12.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
99512
99784
|
if (fromStat > 0) return fromStat;
|
|
99513
99785
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -99524,7 +99796,7 @@ async function cwdOf(pid) {
|
|
|
99524
99796
|
return line ? line.slice(1) : void 0;
|
|
99525
99797
|
}
|
|
99526
99798
|
function spawnDetached({ argv, logPath }) {
|
|
99527
|
-
mkdirSync(
|
|
99799
|
+
mkdirSync(dirname29(logPath), { recursive: true, mode: 448 });
|
|
99528
99800
|
const log = openSync(logPath, "a", 384);
|
|
99529
99801
|
const [program = "", ...rest] = argv;
|
|
99530
99802
|
const child = spawn4(program, rest, { detached: true, stdio: ["ignore", log, log] });
|