@lazehq/cli 0.1.43 → 0.1.45
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 +702 -113
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -96,9 +96,9 @@ var require_node_gyp_build = __commonJS({
|
|
|
96
96
|
var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
|
|
97
97
|
if (debug) return debug;
|
|
98
98
|
}
|
|
99
|
-
var prebuild =
|
|
99
|
+
var prebuild = resolve19(dir);
|
|
100
100
|
if (prebuild) return prebuild;
|
|
101
|
-
var nearby =
|
|
101
|
+
var nearby = resolve19(path.dirname(process.execPath));
|
|
102
102
|
if (nearby) return nearby;
|
|
103
103
|
var target = [
|
|
104
104
|
"platform=" + platform,
|
|
@@ -114,7 +114,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
114
114
|
// eslint-disable-line
|
|
115
115
|
].filter(Boolean).join(" ");
|
|
116
116
|
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
117
|
-
function
|
|
117
|
+
function resolve19(dir2) {
|
|
118
118
|
var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
|
|
119
119
|
var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
120
120
|
if (!tuple2) return;
|
|
@@ -6561,9 +6561,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
6561
6561
|
}
|
|
6562
6562
|
close(callback) {
|
|
6563
6563
|
if (callback === void 0) {
|
|
6564
|
-
return new Promise((
|
|
6564
|
+
return new Promise((resolve19, reject) => {
|
|
6565
6565
|
this.close((err, data) => {
|
|
6566
|
-
return err ? reject(err) :
|
|
6566
|
+
return err ? reject(err) : resolve19(data);
|
|
6567
6567
|
});
|
|
6568
6568
|
});
|
|
6569
6569
|
}
|
|
@@ -6601,9 +6601,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
6601
6601
|
err = null;
|
|
6602
6602
|
}
|
|
6603
6603
|
if (callback === void 0) {
|
|
6604
|
-
return new Promise((
|
|
6604
|
+
return new Promise((resolve19, reject) => {
|
|
6605
6605
|
this.destroy(err, (err2, data) => {
|
|
6606
|
-
return err2 ? reject(err2) :
|
|
6606
|
+
return err2 ? reject(err2) : resolve19(data);
|
|
6607
6607
|
});
|
|
6608
6608
|
});
|
|
6609
6609
|
}
|
|
@@ -11558,12 +11558,12 @@ upgrade: ${upgrade2}\r
|
|
|
11558
11558
|
cb();
|
|
11559
11559
|
}
|
|
11560
11560
|
}
|
|
11561
|
-
const waitForDrain = () => new Promise((
|
|
11561
|
+
const waitForDrain = () => new Promise((resolve19, reject) => {
|
|
11562
11562
|
assert2(callback === null);
|
|
11563
11563
|
if (socket[kError]) {
|
|
11564
11564
|
reject(socket[kError]);
|
|
11565
11565
|
} else {
|
|
11566
|
-
callback =
|
|
11566
|
+
callback = resolve19;
|
|
11567
11567
|
}
|
|
11568
11568
|
});
|
|
11569
11569
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -12921,12 +12921,12 @@ var require_client_h2 = __commonJS({
|
|
|
12921
12921
|
cb();
|
|
12922
12922
|
}
|
|
12923
12923
|
}
|
|
12924
|
-
const waitForDrain = () => new Promise((
|
|
12924
|
+
const waitForDrain = () => new Promise((resolve19, reject) => {
|
|
12925
12925
|
assert2(callback === null);
|
|
12926
12926
|
if (socket[kError]) {
|
|
12927
12927
|
reject(socket[kError]);
|
|
12928
12928
|
} else {
|
|
12929
|
-
callback =
|
|
12929
|
+
callback = resolve19;
|
|
12930
12930
|
}
|
|
12931
12931
|
});
|
|
12932
12932
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -13294,16 +13294,16 @@ var require_client = __commonJS({
|
|
|
13294
13294
|
return this[kNeedDrain] < 2;
|
|
13295
13295
|
}
|
|
13296
13296
|
[kClose]() {
|
|
13297
|
-
return new Promise((
|
|
13297
|
+
return new Promise((resolve19) => {
|
|
13298
13298
|
if (this[kSize]) {
|
|
13299
|
-
this[kClosedResolve] =
|
|
13299
|
+
this[kClosedResolve] = resolve19;
|
|
13300
13300
|
} else {
|
|
13301
|
-
|
|
13301
|
+
resolve19(null);
|
|
13302
13302
|
}
|
|
13303
13303
|
});
|
|
13304
13304
|
}
|
|
13305
13305
|
[kDestroy](err) {
|
|
13306
|
-
return new Promise((
|
|
13306
|
+
return new Promise((resolve19) => {
|
|
13307
13307
|
const requests2 = this[kQueue].splice(this[kPendingIdx]);
|
|
13308
13308
|
for (let i = 0; i < requests2.length; i++) {
|
|
13309
13309
|
const request2 = requests2[i];
|
|
@@ -13316,7 +13316,7 @@ var require_client = __commonJS({
|
|
|
13316
13316
|
this[kClosedResolve]();
|
|
13317
13317
|
this[kClosedResolve] = null;
|
|
13318
13318
|
}
|
|
13319
|
-
|
|
13319
|
+
resolve19(null);
|
|
13320
13320
|
};
|
|
13321
13321
|
if (this[kHTTPContext]) {
|
|
13322
13322
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -13729,8 +13729,8 @@ var require_pool_base = __commonJS({
|
|
|
13729
13729
|
}
|
|
13730
13730
|
return Promise.all(closeAll);
|
|
13731
13731
|
} else {
|
|
13732
|
-
return new Promise((
|
|
13733
|
-
this[kClosedResolve] =
|
|
13732
|
+
return new Promise((resolve19) => {
|
|
13733
|
+
this[kClosedResolve] = resolve19;
|
|
13734
13734
|
});
|
|
13735
13735
|
}
|
|
13736
13736
|
}
|
|
@@ -16241,7 +16241,7 @@ var require_readable = __commonJS({
|
|
|
16241
16241
|
if (this._readableState.closeEmitted) {
|
|
16242
16242
|
return Promise.resolve(null);
|
|
16243
16243
|
}
|
|
16244
|
-
return new Promise((
|
|
16244
|
+
return new Promise((resolve19, reject) => {
|
|
16245
16245
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
16246
16246
|
this.destroy(new AbortError());
|
|
16247
16247
|
}
|
|
@@ -16255,11 +16255,11 @@ var require_readable = __commonJS({
|
|
|
16255
16255
|
if (signal.aborted) {
|
|
16256
16256
|
reject(signal.reason ?? new AbortError());
|
|
16257
16257
|
} else {
|
|
16258
|
-
|
|
16258
|
+
resolve19(null);
|
|
16259
16259
|
}
|
|
16260
16260
|
});
|
|
16261
16261
|
} else {
|
|
16262
|
-
this.on("close",
|
|
16262
|
+
this.on("close", resolve19);
|
|
16263
16263
|
}
|
|
16264
16264
|
this.on("error", noop2).on("data", () => {
|
|
16265
16265
|
if (this[kBytesRead] > limit) {
|
|
@@ -16287,7 +16287,7 @@ var require_readable = __commonJS({
|
|
|
16287
16287
|
}
|
|
16288
16288
|
function consume(stream, type) {
|
|
16289
16289
|
assert2(!stream[kConsume]);
|
|
16290
|
-
return new Promise((
|
|
16290
|
+
return new Promise((resolve19, reject) => {
|
|
16291
16291
|
if (isUnusable(stream)) {
|
|
16292
16292
|
const rState = stream._readableState;
|
|
16293
16293
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -16302,7 +16302,7 @@ var require_readable = __commonJS({
|
|
|
16302
16302
|
stream[kConsume] = {
|
|
16303
16303
|
type,
|
|
16304
16304
|
stream,
|
|
16305
|
-
resolve:
|
|
16305
|
+
resolve: resolve19,
|
|
16306
16306
|
reject,
|
|
16307
16307
|
length: 0,
|
|
16308
16308
|
body: []
|
|
@@ -16380,18 +16380,18 @@ var require_readable = __commonJS({
|
|
|
16380
16380
|
return buffer;
|
|
16381
16381
|
}
|
|
16382
16382
|
function consumeEnd(consume2, encoding) {
|
|
16383
|
-
const { type, body, resolve:
|
|
16383
|
+
const { type, body, resolve: resolve19, stream, length } = consume2;
|
|
16384
16384
|
try {
|
|
16385
16385
|
if (type === "text") {
|
|
16386
|
-
|
|
16386
|
+
resolve19(chunksDecode(body, length, encoding));
|
|
16387
16387
|
} else if (type === "json") {
|
|
16388
|
-
|
|
16388
|
+
resolve19(JSON.parse(chunksDecode(body, length, encoding)));
|
|
16389
16389
|
} else if (type === "arrayBuffer") {
|
|
16390
|
-
|
|
16390
|
+
resolve19(chunksConcat(body, length).buffer);
|
|
16391
16391
|
} else if (type === "blob") {
|
|
16392
|
-
|
|
16392
|
+
resolve19(new Blob(body, { type: stream[kContentType] }));
|
|
16393
16393
|
} else if (type === "bytes") {
|
|
16394
|
-
|
|
16394
|
+
resolve19(chunksConcat(body, length));
|
|
16395
16395
|
}
|
|
16396
16396
|
consumeFinish(consume2);
|
|
16397
16397
|
} catch (err) {
|
|
@@ -16610,9 +16610,9 @@ var require_api_request = __commonJS({
|
|
|
16610
16610
|
};
|
|
16611
16611
|
function request2(opts, callback) {
|
|
16612
16612
|
if (callback === void 0) {
|
|
16613
|
-
return new Promise((
|
|
16613
|
+
return new Promise((resolve19, reject) => {
|
|
16614
16614
|
request2.call(this, opts, (err, data) => {
|
|
16615
|
-
return err ? reject(err) :
|
|
16615
|
+
return err ? reject(err) : resolve19(data);
|
|
16616
16616
|
});
|
|
16617
16617
|
});
|
|
16618
16618
|
}
|
|
@@ -16873,9 +16873,9 @@ var require_api_stream = __commonJS({
|
|
|
16873
16873
|
};
|
|
16874
16874
|
function stream(opts, factory, callback) {
|
|
16875
16875
|
if (callback === void 0) {
|
|
16876
|
-
return new Promise((
|
|
16876
|
+
return new Promise((resolve19, reject) => {
|
|
16877
16877
|
stream.call(this, opts, factory, (err, data) => {
|
|
16878
|
-
return err ? reject(err) :
|
|
16878
|
+
return err ? reject(err) : resolve19(data);
|
|
16879
16879
|
});
|
|
16880
16880
|
});
|
|
16881
16881
|
}
|
|
@@ -17175,9 +17175,9 @@ var require_api_upgrade = __commonJS({
|
|
|
17175
17175
|
};
|
|
17176
17176
|
function upgrade2(opts, callback) {
|
|
17177
17177
|
if (callback === void 0) {
|
|
17178
|
-
return new Promise((
|
|
17178
|
+
return new Promise((resolve19, reject) => {
|
|
17179
17179
|
upgrade2.call(this, opts, (err, data) => {
|
|
17180
|
-
return err ? reject(err) :
|
|
17180
|
+
return err ? reject(err) : resolve19(data);
|
|
17181
17181
|
});
|
|
17182
17182
|
});
|
|
17183
17183
|
}
|
|
@@ -17271,9 +17271,9 @@ var require_api_connect = __commonJS({
|
|
|
17271
17271
|
};
|
|
17272
17272
|
function connect6(opts, callback) {
|
|
17273
17273
|
if (callback === void 0) {
|
|
17274
|
-
return new Promise((
|
|
17274
|
+
return new Promise((resolve19, reject) => {
|
|
17275
17275
|
connect6.call(this, opts, (err, data) => {
|
|
17276
|
-
return err ? reject(err) :
|
|
17276
|
+
return err ? reject(err) : resolve19(data);
|
|
17277
17277
|
});
|
|
17278
17278
|
});
|
|
17279
17279
|
}
|
|
@@ -18733,8 +18733,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
18733
18733
|
var require_snapshot_recorder = __commonJS({
|
|
18734
18734
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
18735
18735
|
"use strict";
|
|
18736
|
-
var { writeFile: writeFile23, readFile:
|
|
18737
|
-
var { dirname:
|
|
18736
|
+
var { writeFile: writeFile23, readFile: readFile40, mkdir: mkdir22 } = __require("node:fs/promises");
|
|
18737
|
+
var { dirname: dirname24, resolve: resolve19 } = __require("node:path");
|
|
18738
18738
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
18739
18739
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
18740
18740
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -18950,7 +18950,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18950
18950
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
18951
18951
|
}
|
|
18952
18952
|
try {
|
|
18953
|
-
const data = await
|
|
18953
|
+
const data = await readFile40(resolve19(path), "utf8");
|
|
18954
18954
|
const parsed = JSON.parse(data);
|
|
18955
18955
|
if (Array.isArray(parsed)) {
|
|
18956
18956
|
this.#snapshots.clear();
|
|
@@ -18979,8 +18979,8 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18979
18979
|
if (!path) {
|
|
18980
18980
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
18981
18981
|
}
|
|
18982
|
-
const resolvedPath =
|
|
18983
|
-
await mkdir22(
|
|
18982
|
+
const resolvedPath = resolve19(path);
|
|
18983
|
+
await mkdir22(dirname24(resolvedPath), { recursive: true });
|
|
18984
18984
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
18985
18985
|
hash: hash2,
|
|
18986
18986
|
snapshot
|
|
@@ -26477,7 +26477,7 @@ var require_fetch = __commonJS({
|
|
|
26477
26477
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
26478
26478
|
return dispatchWithProtocolPreference(body);
|
|
26479
26479
|
function dispatchWithProtocolPreference(body2, allowH2) {
|
|
26480
|
-
return new Promise((
|
|
26480
|
+
return new Promise((resolve19, reject) => agent2.dispatch(
|
|
26481
26481
|
{
|
|
26482
26482
|
path: hasTrailingQuestionMark ? `${path}?` : path,
|
|
26483
26483
|
origin: url2.origin,
|
|
@@ -26560,7 +26560,7 @@ var require_fetch = __commonJS({
|
|
|
26560
26560
|
}
|
|
26561
26561
|
}
|
|
26562
26562
|
const onError = (err) => this.onResponseError(controller, err);
|
|
26563
|
-
|
|
26563
|
+
resolve19({
|
|
26564
26564
|
status: status9,
|
|
26565
26565
|
statusText,
|
|
26566
26566
|
headersList,
|
|
@@ -26593,7 +26593,7 @@ var require_fetch = __commonJS({
|
|
|
26593
26593
|
fetchParams.controller.off("terminated", this.abort);
|
|
26594
26594
|
}
|
|
26595
26595
|
if (request2.mode === "websocket" && allowH2 !== false && error62?.code === "UND_ERR_INFO" && error62?.message === "HTTP/2: Extended CONNECT protocol not supported by server") {
|
|
26596
|
-
|
|
26596
|
+
resolve19(dispatchWithProtocolPreference(body2, false));
|
|
26597
26597
|
return;
|
|
26598
26598
|
}
|
|
26599
26599
|
this.body?.destroy(error62);
|
|
@@ -26607,7 +26607,7 @@ var require_fetch = __commonJS({
|
|
|
26607
26607
|
const rawHeaders = controller?.rawHeaders ?? [];
|
|
26608
26608
|
const headersList = new HeadersList();
|
|
26609
26609
|
appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders);
|
|
26610
|
-
|
|
26610
|
+
resolve19({
|
|
26611
26611
|
status: status9,
|
|
26612
26612
|
statusText: STATUS_CODES[status9],
|
|
26613
26613
|
headersList,
|
|
@@ -31578,10 +31578,11 @@ function runRedacted({
|
|
|
31578
31578
|
stdout: stdout2,
|
|
31579
31579
|
stderr: stderr2,
|
|
31580
31580
|
cwd,
|
|
31581
|
-
signal
|
|
31581
|
+
signal,
|
|
31582
|
+
redact
|
|
31582
31583
|
}) {
|
|
31583
|
-
const values = Object.values(env);
|
|
31584
|
-
return new Promise((
|
|
31584
|
+
const values = redact ?? Object.values(env);
|
|
31585
|
+
return new Promise((resolve19, reject) => {
|
|
31585
31586
|
const [file3, ...args] = command;
|
|
31586
31587
|
const child = spawn(file3, args, {
|
|
31587
31588
|
env: { ...baseEnv, ...env },
|
|
@@ -31607,7 +31608,7 @@ function runRedacted({
|
|
|
31607
31608
|
child.on("error", reject);
|
|
31608
31609
|
child.on("close", (code, ended) => {
|
|
31609
31610
|
signal?.removeEventListener("abort", killGroup);
|
|
31610
|
-
void drained.then(() =>
|
|
31611
|
+
void drained.then(() => resolve19(code ?? (ended ? 128 + signalNumber(ended) : 1)));
|
|
31611
31612
|
});
|
|
31612
31613
|
});
|
|
31613
31614
|
}
|
|
@@ -35671,7 +35672,9 @@ var SWITCHES = /* @__PURE__ */ new Set([
|
|
|
35671
35672
|
"wait-reply",
|
|
35672
35673
|
"no-publish",
|
|
35673
35674
|
"local",
|
|
35674
|
-
"done"
|
|
35675
|
+
"done",
|
|
35676
|
+
"names",
|
|
35677
|
+
"shell"
|
|
35675
35678
|
]);
|
|
35676
35679
|
function parseArgs({ argv }) {
|
|
35677
35680
|
const words = [];
|
|
@@ -35709,7 +35712,7 @@ function flagText({
|
|
|
35709
35712
|
}
|
|
35710
35713
|
|
|
35711
35714
|
// src/rules/cli-version.rules.ts
|
|
35712
|
-
var STAMPED = "0.1.
|
|
35715
|
+
var STAMPED = "0.1.45";
|
|
35713
35716
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35714
35717
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35715
35718
|
}
|
|
@@ -40748,7 +40751,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
40748
40751
|
var NONE = 0;
|
|
40749
40752
|
var ASSUMED = 1;
|
|
40750
40753
|
var PROVEN = 2;
|
|
40751
|
-
function isRecursive(inst, stack,
|
|
40754
|
+
function isRecursive(inst, stack, resolve19) {
|
|
40752
40755
|
const cached2 = recursive.get(inst);
|
|
40753
40756
|
if (cached2 !== void 0)
|
|
40754
40757
|
return cached2 ? PROVEN : NONE;
|
|
@@ -40758,7 +40761,7 @@ function isRecursive(inst, stack, resolve18) {
|
|
|
40758
40761
|
let result = NONE;
|
|
40759
40762
|
const check3 = (child) => {
|
|
40760
40763
|
if (result !== PROVEN && child?._zod) {
|
|
40761
|
-
const answer4 = isRecursive(child, stack,
|
|
40764
|
+
const answer4 = isRecursive(child, stack, resolve19);
|
|
40762
40765
|
if (answer4 > result)
|
|
40763
40766
|
result = answer4;
|
|
40764
40767
|
}
|
|
@@ -40769,7 +40772,7 @@ function isRecursive(inst, stack, resolve18) {
|
|
|
40769
40772
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
40770
40773
|
if (spread && !desc.enumerable)
|
|
40771
40774
|
continue;
|
|
40772
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
40775
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve19) : NONE;
|
|
40773
40776
|
if (child > answer4)
|
|
40774
40777
|
answer4 = child;
|
|
40775
40778
|
}
|
|
@@ -40833,7 +40836,7 @@ function isRecursive(inst, stack, resolve18) {
|
|
|
40833
40836
|
break;
|
|
40834
40837
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
40835
40838
|
case "lazy": {
|
|
40836
|
-
const inner = def._cachedInner ?? (
|
|
40839
|
+
const inner = def._cachedInner ?? (resolve19 ? inst._zod.innerType : void 0);
|
|
40837
40840
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
40838
40841
|
break;
|
|
40839
40842
|
}
|
|
@@ -58379,7 +58382,9 @@ var feedCardSchemaDefinition = external_exports.object({
|
|
|
58379
58382
|
});
|
|
58380
58383
|
var failureCardSchemaDefinition = external_exports.object({
|
|
58381
58384
|
type: external_exports.literal("failure"),
|
|
58382
|
-
details: external_exports.string().min(1).max(NOTICE_DETAILS_MAX)
|
|
58385
|
+
details: external_exports.string().min(1).max(NOTICE_DETAILS_MAX),
|
|
58386
|
+
/** An agent's failed turn: Try again sends this person's message to the agent again. */
|
|
58387
|
+
retry: external_exports.object({ agentId: idSchema4, messageId: idSchema4 }).optional()
|
|
58383
58388
|
});
|
|
58384
58389
|
var messageCardSchemaDefinition = external_exports.discriminatedUnion("type", [
|
|
58385
58390
|
attentionCardSchemaDefinition,
|
|
@@ -59661,6 +59666,7 @@ var noticeKindSchema = external_exports.enum([
|
|
|
59661
59666
|
"channel",
|
|
59662
59667
|
"reaction"
|
|
59663
59668
|
]);
|
|
59669
|
+
var quietKindSchema = external_exports.enum([...noticeKindSchema.options, "broadcast"]);
|
|
59664
59670
|
var noticeSenderSchemaDefinition = external_exports.object({
|
|
59665
59671
|
kind: external_exports.enum(["person", "agent"]),
|
|
59666
59672
|
id: external_exports.string().min(1).max(64),
|
|
@@ -59687,7 +59693,9 @@ var messageNoticeSchema = external_exports.object({
|
|
|
59687
59693
|
/** The sender picked "Notify anyway": it breaks through Do Not Disturb, once. */
|
|
59688
59694
|
urgent: external_exports.boolean().optional(),
|
|
59689
59695
|
/** It came in through a mirror such as Slack, whose own app already rings: Laze stays silent. */
|
|
59690
|
-
mirrored: external_exports.boolean().optional()
|
|
59696
|
+
mirrored: external_exports.boolean().optional(),
|
|
59697
|
+
/** An @channel or @here raised it, not the conversation's every-message level. */
|
|
59698
|
+
broadcast: external_exports.boolean().optional()
|
|
59691
59699
|
});
|
|
59692
59700
|
var approvalNoticeSchema = external_exports.object({
|
|
59693
59701
|
workspaceId: workspaceIdSchema2,
|
|
@@ -60111,6 +60119,8 @@ var heldPhonePushShape = {
|
|
|
60111
60119
|
channelId: external_exports.string().min(1).optional(),
|
|
60112
60120
|
messageId: external_exports.string().min(1).optional(),
|
|
60113
60121
|
kind: noticeKindSchema.optional(),
|
|
60122
|
+
/** A `channel` notice an @channel or @here raised. */
|
|
60123
|
+
broadcast: external_exports.boolean().optional(),
|
|
60114
60124
|
silent: external_exports.boolean().optional(),
|
|
60115
60125
|
feed: heldFeedPushSchema.optional(),
|
|
60116
60126
|
burst: heldBurstPushSchema.optional()
|
|
@@ -60143,8 +60153,8 @@ var conversationQuietedPayloadSchemaDefinition = external_exports.object({
|
|
|
60143
60153
|
userId: external_exports.string().min(1),
|
|
60144
60154
|
channelId: external_exports.string().min(1),
|
|
60145
60155
|
changeId: external_exports.string().min(1),
|
|
60146
|
-
levelQuiets: external_exports.array(
|
|
60147
|
-
muteQuiets: external_exports.array(
|
|
60156
|
+
levelQuiets: external_exports.array(quietKindSchema),
|
|
60157
|
+
muteQuiets: external_exports.array(quietKindSchema),
|
|
60148
60158
|
mutedUntil: external_exports.iso.datetime().nullable(),
|
|
60149
60159
|
at: external_exports.iso.datetime()
|
|
60150
60160
|
});
|
|
@@ -60196,8 +60206,8 @@ var memberNotifySetPayloadSchemaDefinition = external_exports.object({
|
|
|
60196
60206
|
channelId: external_exports.string().min(1),
|
|
60197
60207
|
userId: external_exports.string().min(1),
|
|
60198
60208
|
changeId: external_exports.string().min(1),
|
|
60199
|
-
levelQuiets: external_exports.array(
|
|
60200
|
-
muteQuiets: external_exports.array(
|
|
60209
|
+
levelQuiets: external_exports.array(quietKindSchema),
|
|
60210
|
+
muteQuiets: external_exports.array(quietKindSchema),
|
|
60201
60211
|
mutedUntil: external_exports.iso.datetime().nullable(),
|
|
60202
60212
|
at: external_exports.iso.datetime()
|
|
60203
60213
|
});
|
|
@@ -60707,6 +60717,8 @@ function connectionNameForField(field) {
|
|
|
60707
60717
|
var VaultSecretOfferSlot = uiTokens("vault").component("secretOffer");
|
|
60708
60718
|
|
|
60709
60719
|
// ../../modules/vault/contract/src/vault-reason.ts
|
|
60720
|
+
var VAULT_EXIT_BAD_REASON = 2;
|
|
60721
|
+
var VAULT_REASON_GUIDANCE = 'Write --reason as one short plain sentence a person understands on a phone: what you want to do and why. Good: --reason "Read the query plan to find why the events dashboard is slow".';
|
|
60710
60722
|
var COMMAND_STARTS = new Set(
|
|
60711
60723
|
"sudo laze kv aws curl wget npm pnpm yarn npx git gh kubectl helm docker terraform python python3 node bash sh zsh export cd make cargo go ssh scp psql uv pip echo cat env clickhouse-client".split(
|
|
60712
60724
|
" "
|
|
@@ -60787,7 +60799,7 @@ var vaultOwnedKeychainSchemaDefinition = external_exports.discriminatedUnion("ki
|
|
|
60787
60799
|
agentKeychain
|
|
60788
60800
|
]);
|
|
60789
60801
|
var vaultOwnedKeychainSchema = vaultOwnedKeychainSchemaDefinition;
|
|
60790
|
-
var vaultConnectionKindSchema = external_exports.enum(["api_key_set", "oauth", "mcp"]);
|
|
60802
|
+
var vaultConnectionKindSchema = external_exports.enum(["api_key_set", "oauth", "mcp", "aws"]);
|
|
60791
60803
|
var vaultConnectionStatusSchema = external_exports.enum(["active", "needs_reconnect"]);
|
|
60792
60804
|
var vaultFieldNameSchema = external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(64);
|
|
60793
60805
|
var vaultConnectionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
|
|
@@ -60832,6 +60844,15 @@ var vaultSecretBundleSchemaDefinition = external_exports.discriminatedUnion("kin
|
|
|
60832
60844
|
serverUrl: external_exports.url(),
|
|
60833
60845
|
headers: external_exports.record(external_exports.string().regex(/^[A-Za-z0-9-]{1,64}$/), external_exports.string().min(1)).default({}),
|
|
60834
60846
|
tokens: vaultOAuthTokensSchema.nullable().default(null)
|
|
60847
|
+
}),
|
|
60848
|
+
/** An AWS access key: vaultd signs STS calls with it, releases carry only the session. */
|
|
60849
|
+
external_exports.object({
|
|
60850
|
+
kind: external_exports.literal("aws"),
|
|
60851
|
+
accessKeyId: external_exports.string().regex(/^[A-Z0-9]{16,128}$/),
|
|
60852
|
+
secretAccessKey: external_exports.string().min(16).max(256),
|
|
60853
|
+
roleArn: external_exports.string().regex(/^arn:aws[a-z-]*:iam::\d{12}:role\/[\w+=,.@/-]{1,512}$/).nullable().default(null),
|
|
60854
|
+
region: external_exports.string().regex(/^[a-z]{2}(-[a-z]+)+-\d$/),
|
|
60855
|
+
externalId: external_exports.string().min(2).max(1224).nullable().default(null)
|
|
60835
60856
|
})
|
|
60836
60857
|
]);
|
|
60837
60858
|
var vaultSecretBundleSchema = vaultSecretBundleSchemaDefinition;
|
|
@@ -61088,6 +61109,7 @@ var vaultRunReleaseSchemaDefinition = external_exports.discriminatedUnion("outco
|
|
|
61088
61109
|
}),
|
|
61089
61110
|
external_exports.object({ outcome: external_exports.literal("deny"), exitCode: external_exports.number().int(), message: external_exports.string() })
|
|
61090
61111
|
]);
|
|
61112
|
+
var vaultRunReleaseSchema = vaultRunReleaseSchemaDefinition;
|
|
61091
61113
|
var vaultEgressResolveInputSchemaDefinition = external_exports.object({
|
|
61092
61114
|
agentId: external_exports.string().min(1),
|
|
61093
61115
|
connectionId: external_exports.string().min(1),
|
|
@@ -61414,6 +61436,8 @@ var vaultConfig = Config.define((c) => ({
|
|
|
61414
61436
|
auditHeadFile: c.env("VAULT_AUDIT_HEAD_FILE", external_exports.string().min(1).optional()),
|
|
61415
61437
|
/** vaultd's socket; set, the master key and data keys stay in vaultd, unset keeps them here. */
|
|
61416
61438
|
vaultdSocket: c.env("LAZE_VAULTD_SOCKET", external_exports.string().min(1).optional()),
|
|
61439
|
+
/** Where the in-process key sends AWS STS calls instead of AWS; vaultd has its own flag. */
|
|
61440
|
+
awsStsEndpoint: c.env("LAZE_VAULT_AWS_STS_ENDPOINT", external_exports.url().optional()),
|
|
61417
61441
|
/** The workspace whose admins get vault alert cards; unset only logs the alerts. */
|
|
61418
61442
|
alertWorkspaceId: c.env("VAULT_ALERT_WORKSPACE_ID", external_exports.string().min(1).optional())
|
|
61419
61443
|
}));
|
|
@@ -62042,6 +62066,56 @@ var vaultAlertClearedPayloadSchemaDefinition = external_exports.object({
|
|
|
62042
62066
|
at: external_exports.iso.datetime()
|
|
62043
62067
|
});
|
|
62044
62068
|
|
|
62069
|
+
// ../../modules/vault/contract/src/vault-env.ts
|
|
62070
|
+
var VAULT_BATCH_MAX_REFS = 100;
|
|
62071
|
+
var vaultBatchRefSchema = external_exports.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/, "A connection name or a variable name");
|
|
62072
|
+
var batchFieldsDefinition = {
|
|
62073
|
+
refs: external_exports.array(vaultBatchRefSchema).min(1).max(VAULT_BATCH_MAX_REFS),
|
|
62074
|
+
reason: external_exports.string(),
|
|
62075
|
+
command: external_exports.array(external_exports.string()).default([]),
|
|
62076
|
+
/** The run's P-256 public key, base64url; a sealed connection is released only to it. */
|
|
62077
|
+
recipient: external_exports.string().max(200).optional(),
|
|
62078
|
+
/** Resolve the names only: no decision, no card, no audit line and no value. */
|
|
62079
|
+
resolveOnly: external_exports.boolean().default(false)
|
|
62080
|
+
};
|
|
62081
|
+
var vaultBatchReleaseInputSchemaDefinition = external_exports.object({
|
|
62082
|
+
agentId: external_exports.string().min(1),
|
|
62083
|
+
...batchFieldsDefinition
|
|
62084
|
+
});
|
|
62085
|
+
var vaultBatchReleaseInputSchema = vaultBatchReleaseInputSchemaDefinition;
|
|
62086
|
+
var vaultBatchConnectionSchemaDefinition = external_exports.object({
|
|
62087
|
+
name: vaultConnectionNameSchema,
|
|
62088
|
+
label: external_exports.string(),
|
|
62089
|
+
kind: vaultConnectionKindSchema,
|
|
62090
|
+
sensitivity: vaultSensitivitySchema,
|
|
62091
|
+
fieldNames: external_exports.array(external_exports.string())
|
|
62092
|
+
});
|
|
62093
|
+
var vaultBatchConnectionSchema = vaultBatchConnectionSchemaDefinition;
|
|
62094
|
+
var vaultBatchEntrySchemaDefinition = external_exports.object({
|
|
62095
|
+
ref: external_exports.string(),
|
|
62096
|
+
connection: vaultBatchConnectionSchema.nullable(),
|
|
62097
|
+
release: vaultRunReleaseSchema.nullable()
|
|
62098
|
+
});
|
|
62099
|
+
var vaultBatchEntrySchema = vaultBatchEntrySchemaDefinition;
|
|
62100
|
+
var vaultBatchReleaseSchemaDefinition = external_exports.object({
|
|
62101
|
+
entries: external_exports.array(vaultBatchEntrySchema)
|
|
62102
|
+
});
|
|
62103
|
+
var VAULT_AWS_SESSION_FIELDS = [
|
|
62104
|
+
"AWS_ACCESS_KEY_ID",
|
|
62105
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
62106
|
+
"AWS_SESSION_TOKEN",
|
|
62107
|
+
"AWS_REGION",
|
|
62108
|
+
"AWS_DEFAULT_REGION",
|
|
62109
|
+
"AWS_CREDENTIAL_EXPIRATION"
|
|
62110
|
+
];
|
|
62111
|
+
var vaultAwsSessionSchemaDefinition = external_exports.object({
|
|
62112
|
+
accessKeyId: external_exports.string().min(1),
|
|
62113
|
+
secretAccessKey: external_exports.string().min(1),
|
|
62114
|
+
sessionToken: external_exports.string().min(1),
|
|
62115
|
+
/** ISO 8601, as STS gives it. */
|
|
62116
|
+
expiration: external_exports.iso.datetime({ offset: true })
|
|
62117
|
+
});
|
|
62118
|
+
|
|
62045
62119
|
// ../../modules/agent/contract/src/agent-access.ts
|
|
62046
62120
|
var idSchema5 = external_exports.string().min(1).max(80);
|
|
62047
62121
|
var agentGranteeSchemaDefinition = external_exports.discriminatedUnion("kind", [
|
|
@@ -62780,7 +62854,9 @@ var supervisorFrameSchemaDefinition = external_exports.discriminatedUnion("type"
|
|
|
62780
62854
|
method: external_exports.enum(["GET", "POST"]),
|
|
62781
62855
|
releaseId: external_exports.string().regex(/^[A-Za-z0-9_-]+$/).max(200).optional(),
|
|
62782
62856
|
body: external_exports.string().max(64 * 1024).optional(),
|
|
62783
|
-
turnToken: external_exports.string().min(1).max(8192)
|
|
62857
|
+
turnToken: external_exports.string().min(1).max(8192),
|
|
62858
|
+
/** `laze vault env`: the body is a batch of names, posted to the batch release. */
|
|
62859
|
+
batch: external_exports.boolean().optional()
|
|
62784
62860
|
})
|
|
62785
62861
|
]);
|
|
62786
62862
|
var computerLaunchSchemaDefinition = external_exports.object({
|
|
@@ -63116,6 +63192,14 @@ var stopAgentTurnInputSchemaDefinition = external_exports.object({
|
|
|
63116
63192
|
channelId: idSchema6
|
|
63117
63193
|
});
|
|
63118
63194
|
var stopAgentTurnInputSchema = stopAgentTurnInputSchemaDefinition;
|
|
63195
|
+
var retryAgentTurnInputSchemaDefinition = external_exports.object({
|
|
63196
|
+
workspaceId: workspaceIdSchema3,
|
|
63197
|
+
agentId: idSchema6,
|
|
63198
|
+
channelId: idSchema6,
|
|
63199
|
+
/** The person's message the failed turn was on. */
|
|
63200
|
+
messageId: idSchema6
|
|
63201
|
+
});
|
|
63202
|
+
var retryAgentTurnInputSchema = retryAgentTurnInputSchemaDefinition;
|
|
63119
63203
|
var compactAgentSessionInputSchemaDefinition = external_exports.object({
|
|
63120
63204
|
workspaceId: workspaceIdSchema3,
|
|
63121
63205
|
agentId: idSchema6,
|
|
@@ -65047,7 +65131,9 @@ var inboxMessageSchemaDefinition = external_exports.object({
|
|
|
65047
65131
|
body: external_exports.string(),
|
|
65048
65132
|
postedAt: external_exports.iso.datetime(),
|
|
65049
65133
|
/** On the first message of each conversation in a catch up (agent-catch-up.feature). */
|
|
65050
|
-
catchUp: inboxCatchUpSchema.optional()
|
|
65134
|
+
catchUp: inboxCatchUpSchema.optional(),
|
|
65135
|
+
/** Set from 2 on when a person pressed Try again: the same turn, tried once more. */
|
|
65136
|
+
attempt: external_exports.number().int().min(2).optional()
|
|
65051
65137
|
});
|
|
65052
65138
|
var receiveInboxInputSchemaDefinition = external_exports.object({
|
|
65053
65139
|
waitSeconds: external_exports.coerce.number().int().min(0).max(INBOX_WAIT_MAX_SECONDS).default(0),
|
|
@@ -65226,6 +65312,11 @@ var agentVaultReleaseInputSchemaDefinition = external_exports.object({
|
|
|
65226
65312
|
...releaseShape,
|
|
65227
65313
|
channelId: external_exports.string().min(1).max(80).nullable().default(null)
|
|
65228
65314
|
});
|
|
65315
|
+
var { agentId: _batchAgentId, ...batchShape } = vaultBatchReleaseInputSchema.shape;
|
|
65316
|
+
var agentVaultBatchReleaseInputSchemaDefinition = external_exports.object({
|
|
65317
|
+
...batchShape,
|
|
65318
|
+
channelId: external_exports.string().min(1).max(80).nullable().default(null)
|
|
65319
|
+
});
|
|
65229
65320
|
var { id, name: name2, label, kind, keychain, sensitivity, fieldNames, status } = vaultConnectionSchema.shape;
|
|
65230
65321
|
var agentOwnerKeySchemaDefinition = external_exports.object({
|
|
65231
65322
|
id,
|
|
@@ -65247,7 +65338,7 @@ var codexLoginRefreshInputSchemaDefinition = external_exports.object({
|
|
|
65247
65338
|
});
|
|
65248
65339
|
var AgentApi = moduleApi()("agent");
|
|
65249
65340
|
var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("transfer").withInput(transferAgentInputSchema).withOutput(agentSchema).mutation("resetSession").withInput(resetAgentSessionInputSchema).withOutput(agentSchema).query("faces").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(external_exports.object({ limitUsd: external_exports.number() })).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(harnessLoginListSchema).mutation("addHarnessLogin").withInput(addHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("renameHarnessLogin").withInput(renameHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("deleteHarnessLogin").withInput(deleteHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("checkLoginUsage").withInput(checkLoginUsageInputSchema).withOutput(loginUsageCheckSchema).query("loginPools").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(loginPoolsSchema).mutation("createLoginPool").withInput(createLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("renameLoginPool").withInput(renameLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("deleteLoginPool").withInput(loginPoolRefInputSchema).withOutput(loginPoolsSchema).mutation("addPoolLogin").withInput(addPoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("removePoolLogin").withInput(removePoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("setPoolMember").withInput(setPoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("removePoolMember").withInput(removePoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("setAgentPool").withInput(setAgentPoolInputSchema).withOutput(agentSchema).mutation("openDirect").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.object({ channelId: idSchema14 })).mutation("startConversation").withInput(startConversationInputSchema).withOutput(startedConversationSchema).query("conversations").withInput(listConversationsInputSchema).withOutput(external_exports.array(conversationSummarySchema2)).mutation("joinConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("renameConversation").withInput(renameConversationInputSchema).withOutput(conversationSummarySchema2).mutation("leaveConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("deleteConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("mintLink").withInput(mintLinkInputSchema).withOutput(mintedLinkSchema).query("linkRedemption").withInput(linkRedemptionInputSchema).withOutput(linkRedemptionSchema).query("oauthRequest").withInput(oauthRequestInputSchema).withOutput(oauthRequestViewSchema).mutation("oauthApprove").withInput(approveOAuthInputSchema).withOutput(oauthRedirectSchema).mutation("oauthDeny").withInput(oauthRequestInputSchema).withOutput(oauthRedirectSchema).mutation("disconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.array(agentGithubWatchSchema)).mutation("watchGithub").withInput(watchGithubInputSchema).withOutput(agentGithubWatchSchema).mutation("unwatchGithub").withInput(unwatchGithubInputSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
|
|
65250
|
-
var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("workingNow").withInput(agentWorkingInputSchema).withOutput(agentWorkingSchema).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
|
|
65341
|
+
var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).mutation("retryTurn").withInput(retryAgentTurnInputSchema).withOutput(external_exports.object({ retried: external_exports.literal(true) })).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("workingNow").withInput(agentWorkingInputSchema).withOutput(agentWorkingSchema).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
|
|
65251
65342
|
var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14, channelId: idSchema14 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).build();
|
|
65252
65343
|
var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
|
|
65253
65344
|
var agentLoginTroubleTrpc = defineTrpcContract("agents").mutation("replaceHarnessLogin").withInput(replaceHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("startHarnessSignIn").withInput(startHarnessSignInInputSchema).withOutput(harnessSignInSchema).mutation("pollHarnessSignIn").withInput(pollHarnessSignInInputSchema).withOutput(harnessSignInPollSchema).mutation("waitForLogins").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ waiting: external_exports.boolean() })).mutation("useAnotherLogin").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ loginName: external_exports.string() })).build();
|
|
@@ -65282,6 +65373,7 @@ var AgentConnectDialogSlot = agentUi.component("connectDialog");
|
|
|
65282
65373
|
var AgentChannelLevelSlot = agentUi.component("channelLevel");
|
|
65283
65374
|
var AgentMuteNoticeSlot = agentUi.component("muteNotice");
|
|
65284
65375
|
var AgentHopLimitNoticeSlot = agentUi.component("hopLimitNotice");
|
|
65376
|
+
var AgentRetryTurnSlot = agentUi.component("retryTurn");
|
|
65285
65377
|
var AgentHeldNoticeSlot = agentUi.component("heldNotice");
|
|
65286
65378
|
|
|
65287
65379
|
// ../../modules/agent/contract/src/agent.config.ts
|
|
@@ -65391,6 +65483,19 @@ var stopTurnAsCallerInputSchemaDefinition = external_exports.object({
|
|
|
65391
65483
|
agent: agentRefSchema6,
|
|
65392
65484
|
channelId: idSchema15
|
|
65393
65485
|
});
|
|
65486
|
+
var retryTurnAsCallerInputSchemaDefinition = external_exports.object({
|
|
65487
|
+
agent: agentRefSchema6,
|
|
65488
|
+
channelId: idSchema15,
|
|
65489
|
+
messageId: idSchema15
|
|
65490
|
+
});
|
|
65491
|
+
var postTurnFailureAsCallerInputSchemaDefinition = external_exports.object({
|
|
65492
|
+
channelId: idSchema15,
|
|
65493
|
+
threadRootId: idSchema15.optional(),
|
|
65494
|
+
/** The person's message the turn was on, which Try again sends to the agent again. */
|
|
65495
|
+
messageId: idSchema15,
|
|
65496
|
+
line: external_exports.string().trim().min(1).max(1e3),
|
|
65497
|
+
details: external_exports.string().trim().min(1).max(2e3)
|
|
65498
|
+
});
|
|
65394
65499
|
var mintLinkAsCallerInputSchemaDefinition = external_exports.object({
|
|
65395
65500
|
/** Left out, the agent that joins with the link names itself. */
|
|
65396
65501
|
name: external_exports.string().trim().max(80).optional(),
|
|
@@ -66184,6 +66289,17 @@ async function stopAgentTurn({ context, args }) {
|
|
|
66184
66289
|
context.out(`Stopped ${agent2}'s turn.
|
|
66185
66290
|
`);
|
|
66186
66291
|
}
|
|
66292
|
+
async function retryAgentTurn({ context, args }) {
|
|
66293
|
+
const usage = "Usage: laze agent retry <agent> --channel <channelId> --message <messageId>";
|
|
66294
|
+
const agent2 = agentWord({ args, usage });
|
|
66295
|
+
const channelId = flagText({ args, name: "channel" });
|
|
66296
|
+
const messageId = flagText({ args, name: "message" });
|
|
66297
|
+
if (!channelId || !messageId) throw new CliUsageError(usage);
|
|
66298
|
+
const { client } = await signedIn({ context, args });
|
|
66299
|
+
await client.post("/api/agents/retry", { agent: agent2, channelId, messageId });
|
|
66300
|
+
context.out(`Sent the message to ${agent2} again.
|
|
66301
|
+
`);
|
|
66302
|
+
}
|
|
66187
66303
|
async function disconnectAgent({ context, args }) {
|
|
66188
66304
|
const agent2 = agentWord({ args, usage: "Usage: laze agent disconnect <agent>" });
|
|
66189
66305
|
const { client } = await signedIn({ context, args });
|
|
@@ -70182,8 +70298,8 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
70182
70298
|
}
|
|
70183
70299
|
async call(method, params) {
|
|
70184
70300
|
const id2 = ++this.#nextId;
|
|
70185
|
-
const reply2 = await new Promise((
|
|
70186
|
-
this.#pending.set(id2,
|
|
70301
|
+
const reply2 = await new Promise((resolve19) => {
|
|
70302
|
+
this.#pending.set(id2, resolve19);
|
|
70187
70303
|
this.write({ id: id2, method, params });
|
|
70188
70304
|
});
|
|
70189
70305
|
if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
|
|
@@ -70195,12 +70311,12 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
70195
70311
|
/** Starts one turn; `done` settles when it completes, keeping its last agent message. */
|
|
70196
70312
|
async startTurn({ threadId, text: text2 }) {
|
|
70197
70313
|
const result = { answer: "" };
|
|
70198
|
-
const done = new Promise((
|
|
70314
|
+
const done = new Promise((resolve19) => {
|
|
70199
70315
|
const listen = (message2) => {
|
|
70200
70316
|
absorbTurnEvent({ result, message: message2 });
|
|
70201
70317
|
if (message2.method !== "turn/completed") return;
|
|
70202
70318
|
this.#listeners.delete(listen);
|
|
70203
|
-
|
|
70319
|
+
resolve19(result);
|
|
70204
70320
|
};
|
|
70205
70321
|
this.#listeners.add(listen);
|
|
70206
70322
|
});
|
|
@@ -76326,7 +76442,7 @@ function tunnel({
|
|
|
76326
76442
|
host: host2,
|
|
76327
76443
|
port
|
|
76328
76444
|
}) {
|
|
76329
|
-
return new Promise((
|
|
76445
|
+
return new Promise((resolve19, reject) => {
|
|
76330
76446
|
const socket = connectTcp(proxy.port, proxy.host);
|
|
76331
76447
|
let answer4 = "";
|
|
76332
76448
|
const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
|
|
@@ -76343,7 +76459,7 @@ ${auth}\r
|
|
|
76343
76459
|
answer4 += chunk.toString("latin1");
|
|
76344
76460
|
if (!answer4.includes(HEADER_END)) return;
|
|
76345
76461
|
socket.off("data", onData);
|
|
76346
|
-
if (/^HTTP\/1\.[01] 200/.test(answer4)) return
|
|
76462
|
+
if (/^HTTP\/1\.[01] 200/.test(answer4)) return resolve19(socket);
|
|
76347
76463
|
socket.destroy();
|
|
76348
76464
|
reject(new Error(`proxy refused the tunnel: ${answer4.split("\r\n")[0] ?? ""}`));
|
|
76349
76465
|
};
|
|
@@ -76356,8 +76472,8 @@ async function upstreamOf({ target, proxy }) {
|
|
|
76356
76472
|
const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
|
|
76357
76473
|
if (!secure) return raw;
|
|
76358
76474
|
const tls = connectTls({ socket: raw, servername: target.hostname });
|
|
76359
|
-
await new Promise((
|
|
76360
|
-
tls.once("secureConnect", () =>
|
|
76475
|
+
await new Promise((resolve19, reject) => {
|
|
76476
|
+
tls.once("secureConnect", () => resolve19());
|
|
76361
76477
|
tls.once("error", reject);
|
|
76362
76478
|
});
|
|
76363
76479
|
return tls;
|
|
@@ -76399,8 +76515,8 @@ async function browserSocket({
|
|
|
76399
76515
|
createConnection: () => upstream,
|
|
76400
76516
|
perMessageDeflate: false
|
|
76401
76517
|
});
|
|
76402
|
-
await new Promise((
|
|
76403
|
-
socket.once("open", () =>
|
|
76518
|
+
await new Promise((resolve19, reject) => {
|
|
76519
|
+
socket.once("open", () => resolve19());
|
|
76404
76520
|
socket.once("error", reject);
|
|
76405
76521
|
});
|
|
76406
76522
|
return socket;
|
|
@@ -76413,12 +76529,12 @@ async function browserCall({
|
|
|
76413
76529
|
}) {
|
|
76414
76530
|
const socket = await browserSocket({ target, proxy });
|
|
76415
76531
|
try {
|
|
76416
|
-
return await new Promise((
|
|
76532
|
+
return await new Promise((resolve19, reject) => {
|
|
76417
76533
|
socket.on("message", (data) => {
|
|
76418
76534
|
const reply2 = JSON.parse(textOf2(data));
|
|
76419
76535
|
if (reply2.id !== 1) return;
|
|
76420
76536
|
if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
|
|
76421
|
-
else
|
|
76537
|
+
else resolve19(reply2.result ?? {});
|
|
76422
76538
|
});
|
|
76423
76539
|
socket.once(
|
|
76424
76540
|
"close",
|
|
@@ -76582,18 +76698,18 @@ function retargetCdpBridge({
|
|
|
76582
76698
|
target,
|
|
76583
76699
|
expiresAt
|
|
76584
76700
|
}) {
|
|
76585
|
-
return new Promise((
|
|
76701
|
+
return new Promise((resolve19) => {
|
|
76586
76702
|
const call = httpRequest(
|
|
76587
76703
|
{ host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
|
|
76588
76704
|
(response) => {
|
|
76589
76705
|
response.resume();
|
|
76590
|
-
|
|
76706
|
+
resolve19(response.statusCode === 204);
|
|
76591
76707
|
}
|
|
76592
76708
|
);
|
|
76593
76709
|
call.setHeader(KEY_HEADER, key);
|
|
76594
76710
|
call.setHeader("content-type", "application/json");
|
|
76595
76711
|
call.once("timeout", () => call.destroy());
|
|
76596
|
-
call.once("error", () =>
|
|
76712
|
+
call.once("error", () => resolve19(false));
|
|
76597
76713
|
call.end(JSON.stringify({ target, expiresAt }));
|
|
76598
76714
|
});
|
|
76599
76715
|
}
|
|
@@ -76642,15 +76758,15 @@ async function startCdpBridge({
|
|
|
76642
76758
|
(socket) => relayPage({ client: socket, targetId, target: url2, proxy })
|
|
76643
76759
|
);
|
|
76644
76760
|
});
|
|
76645
|
-
await new Promise((
|
|
76761
|
+
await new Promise((resolve19) => server.listen(0, "127.0.0.1", resolve19));
|
|
76646
76762
|
const port = server.address().port;
|
|
76647
76763
|
return {
|
|
76648
76764
|
port,
|
|
76649
|
-
close: () => new Promise((
|
|
76765
|
+
close: () => new Promise((resolve19) => {
|
|
76650
76766
|
for (const client of relayed) client.destroy();
|
|
76651
76767
|
pages.close();
|
|
76652
76768
|
server.closeAllConnections();
|
|
76653
|
-
server.close(() =>
|
|
76769
|
+
server.close(() => resolve19());
|
|
76654
76770
|
})
|
|
76655
76771
|
};
|
|
76656
76772
|
}
|
|
@@ -76667,7 +76783,7 @@ function launchCdpBridge({
|
|
|
76667
76783
|
stdio: ["ignore", "pipe", "ignore"],
|
|
76668
76784
|
env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
|
|
76669
76785
|
});
|
|
76670
|
-
return new Promise((
|
|
76786
|
+
return new Promise((resolve19, reject) => {
|
|
76671
76787
|
let printed = "";
|
|
76672
76788
|
child.once("error", reject);
|
|
76673
76789
|
child.once("exit", (code) => reject(new Error(`the CDP bridge stopped (${code})`)));
|
|
@@ -76678,7 +76794,7 @@ function launchCdpBridge({
|
|
|
76678
76794
|
child.stdout.destroy();
|
|
76679
76795
|
child.removeAllListeners("exit");
|
|
76680
76796
|
child.unref();
|
|
76681
|
-
if (Number.isInteger(port) && port > 0)
|
|
76797
|
+
if (Number.isInteger(port) && port > 0) resolve19(port);
|
|
76682
76798
|
else reject(new Error("the CDP bridge printed no port"));
|
|
76683
76799
|
});
|
|
76684
76800
|
});
|
|
@@ -81274,8 +81390,8 @@ var DOMAINS_USAGE = `Usage:
|
|
|
81274
81390
|
var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
81275
81391
|
`);
|
|
81276
81392
|
function printDomain(context, row) {
|
|
81277
|
-
const
|
|
81278
|
-
context.out(`${row.domain} ${
|
|
81393
|
+
const join25 = row.autoJoin ? "auto-join on" : "auto-join off";
|
|
81394
|
+
context.out(`${row.domain} ${join25}${row.enforced ? " single sign-on enforced" : ""}
|
|
81279
81395
|
`);
|
|
81280
81396
|
}
|
|
81281
81397
|
async function list4({ context, args }) {
|
|
@@ -82447,14 +82563,14 @@ async function signedGhArgs({
|
|
|
82447
82563
|
const arg = args[index] ?? "";
|
|
82448
82564
|
const [flag2 = "", inline] = arg.startsWith("--") ? arg.split(/=(.*)/s, 2) : [arg];
|
|
82449
82565
|
const isBody = BODY_FLAGS.has(flag2);
|
|
82450
|
-
const
|
|
82451
|
-
if (!isBody && !
|
|
82566
|
+
const isFile2 = BODY_FILE_FLAGS.has(flag2);
|
|
82567
|
+
if (!isBody && !isFile2) {
|
|
82452
82568
|
out.push(arg);
|
|
82453
82569
|
continue;
|
|
82454
82570
|
}
|
|
82455
82571
|
const value = inline ?? args[index + 1] ?? "";
|
|
82456
82572
|
if (inline === void 0) index += 1;
|
|
82457
|
-
const body =
|
|
82573
|
+
const body = isFile2 ? await readBodyFile(value) : value;
|
|
82458
82574
|
out.push("--body", signed({ body, signature }));
|
|
82459
82575
|
bodied = true;
|
|
82460
82576
|
}
|
|
@@ -85766,6 +85882,469 @@ async function update2({
|
|
|
85766
85882
|
return 1;
|
|
85767
85883
|
}
|
|
85768
85884
|
|
|
85885
|
+
// src/services/vault-env-commands.service.ts
|
|
85886
|
+
import { readFile as readFile36, stat as stat5 } from "node:fs/promises";
|
|
85887
|
+
import { dirname as dirname22, join as join24, resolve as resolve15 } from "node:path";
|
|
85888
|
+
|
|
85889
|
+
// src/rules/vault-manifest.rules.ts
|
|
85890
|
+
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
85891
|
+
var CONNECTION = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
85892
|
+
var REFERENCE = /^\{\{vault:([A-Za-z0-9][A-Za-z0-9_/-]{0,127})\}\}$/;
|
|
85893
|
+
function refOf(name3) {
|
|
85894
|
+
return name3.split("/").at(-1) ?? name3;
|
|
85895
|
+
}
|
|
85896
|
+
function unquoted(value) {
|
|
85897
|
+
const trimmed = value.trim();
|
|
85898
|
+
const quote4 = trimmed[0];
|
|
85899
|
+
if ((quote4 === '"' || quote4 === "'") && trimmed.length >= 2 && trimmed.endsWith(quote4)) {
|
|
85900
|
+
return trimmed.slice(1, -1);
|
|
85901
|
+
}
|
|
85902
|
+
return trimmed;
|
|
85903
|
+
}
|
|
85904
|
+
function bareLineOf({ line, where }) {
|
|
85905
|
+
if (CONNECTION.test(line)) return { kind: "connection", ref: line };
|
|
85906
|
+
if (VARIABLE.test(line)) return { kind: "field", variable: line, ref: line };
|
|
85907
|
+
throw new CliUsageError(`${where}: not a name: ${line}`);
|
|
85908
|
+
}
|
|
85909
|
+
function lineOf4({ line, where }) {
|
|
85910
|
+
const at = line.indexOf("=");
|
|
85911
|
+
if (at === -1) return bareLineOf({ line, where });
|
|
85912
|
+
const variable = line.slice(0, at).trim();
|
|
85913
|
+
const value = line.slice(at + 1).trim();
|
|
85914
|
+
if (!VARIABLE.test(variable)) {
|
|
85915
|
+
throw new CliUsageError(`${where}: not a variable name: ${variable}`);
|
|
85916
|
+
}
|
|
85917
|
+
const reference = REFERENCE.exec(value);
|
|
85918
|
+
if (reference?.[1]) return { kind: "reference", variable, ref: refOf(reference[1]) };
|
|
85919
|
+
return { kind: "plain", variable, value: unquoted(value) };
|
|
85920
|
+
}
|
|
85921
|
+
function parseManifest({ text: text2, file: file3 }) {
|
|
85922
|
+
const lines2 = [];
|
|
85923
|
+
for (const [index, raw] of text2.split(/\r?\n/).entries()) {
|
|
85924
|
+
const line = raw.trim().replace(/^export\s+/, "");
|
|
85925
|
+
if (!line || line.startsWith("#")) continue;
|
|
85926
|
+
lines2.push(lineOf4({ line, where: `${file3}:${index + 1}` }));
|
|
85927
|
+
}
|
|
85928
|
+
return lines2;
|
|
85929
|
+
}
|
|
85930
|
+
function refsOf(lines2) {
|
|
85931
|
+
return [...new Set(lines2.flatMap((line) => line.kind === "plain" ? [] : [line.ref]))];
|
|
85932
|
+
}
|
|
85933
|
+
var isAwsSession = (fields) => VAULT_AWS_SESSION_FIELDS.every((name3) => fields[name3] !== void 0);
|
|
85934
|
+
function environmentOf({
|
|
85935
|
+
lines: lines2,
|
|
85936
|
+
released
|
|
85937
|
+
}) {
|
|
85938
|
+
const env = {};
|
|
85939
|
+
for (const line of lines2) {
|
|
85940
|
+
if (line.kind === "plain") {
|
|
85941
|
+
env[line.variable] = line.value;
|
|
85942
|
+
continue;
|
|
85943
|
+
}
|
|
85944
|
+
const fields = released.get(line.ref)?.fields;
|
|
85945
|
+
if (!fields) throw new CliUsageError(`laze vault: nothing was released for ${line.ref}`);
|
|
85946
|
+
if (line.kind === "connection" || isAwsSession(fields)) {
|
|
85947
|
+
Object.assign(env, fields);
|
|
85948
|
+
continue;
|
|
85949
|
+
}
|
|
85950
|
+
const names = Object.keys(fields);
|
|
85951
|
+
const value = fields[line.variable] ?? (names.length === 1 ? fields[names[0] ?? ""] : void 0);
|
|
85952
|
+
if (value === void 0) {
|
|
85953
|
+
throw new CliUsageError(
|
|
85954
|
+
`laze vault: ${line.ref} has no field ${line.variable} (it has ${names.join(", ")}); write ${line.variable}={{vault:<connection>}} for a one-field key, or name the connection on its own line`
|
|
85955
|
+
);
|
|
85956
|
+
}
|
|
85957
|
+
env[line.variable] = value;
|
|
85958
|
+
}
|
|
85959
|
+
return env;
|
|
85960
|
+
}
|
|
85961
|
+
function shellExports(env) {
|
|
85962
|
+
return Object.entries(env).map(([name3, value]) => `export ${name3}='${value.replaceAll("'", `'\\''`)}'`).join("\n");
|
|
85963
|
+
}
|
|
85964
|
+
function credentialProcessJson(fields) {
|
|
85965
|
+
return JSON.stringify({
|
|
85966
|
+
Version: 1,
|
|
85967
|
+
AccessKeyId: fields.AWS_ACCESS_KEY_ID,
|
|
85968
|
+
SecretAccessKey: fields.AWS_SECRET_ACCESS_KEY,
|
|
85969
|
+
SessionToken: fields.AWS_SESSION_TOKEN,
|
|
85970
|
+
Expiration: fields.AWS_CREDENTIAL_EXPIRATION
|
|
85971
|
+
});
|
|
85972
|
+
}
|
|
85973
|
+
|
|
85974
|
+
// src/services/vault-batch.service.ts
|
|
85975
|
+
import { rm as rm14 } from "node:fs/promises";
|
|
85976
|
+
var WHERE = "laze vault env works only on a Laze agent's computer, on a machine it runs on, or signed in as a connected agent";
|
|
85977
|
+
async function batchOf({ response }) {
|
|
85978
|
+
const text2 = await response.text();
|
|
85979
|
+
if (!response.ok) {
|
|
85980
|
+
const code = /"code"\s*:\s*"([^"]+)"/.exec(text2)?.[1] ?? `status ${response.status}`;
|
|
85981
|
+
throw new CliUsageError(`laze vault: the batch was refused (${code})`);
|
|
85982
|
+
}
|
|
85983
|
+
return JSON.parse(text2);
|
|
85984
|
+
}
|
|
85985
|
+
async function doorOf({
|
|
85986
|
+
context,
|
|
85987
|
+
args,
|
|
85988
|
+
keyName
|
|
85989
|
+
}) {
|
|
85990
|
+
const env = context.environment.inherited;
|
|
85991
|
+
const proxy = proxyOf({ env });
|
|
85992
|
+
if (proxy) {
|
|
85993
|
+
const turnFile = turnFileOf({ env });
|
|
85994
|
+
const headers = {
|
|
85995
|
+
"proxy-authorization": proxy.authorization,
|
|
85996
|
+
"x-laze-turn": await turnTokenOf3({ env, turnFile, command: "laze vault env" })
|
|
85997
|
+
};
|
|
85998
|
+
return {
|
|
85999
|
+
keyPath: runKeyPathOf({ turnFile, connection: keyName }),
|
|
86000
|
+
ask: async (body) => batchOf({
|
|
86001
|
+
response: await reach({
|
|
86002
|
+
context,
|
|
86003
|
+
url: `${proxy.origin}/vault/release-batch`,
|
|
86004
|
+
init: {
|
|
86005
|
+
method: "POST",
|
|
86006
|
+
headers: { ...headers, "content-type": "application/json" },
|
|
86007
|
+
body: JSON.stringify(body)
|
|
86008
|
+
}
|
|
86009
|
+
})
|
|
86010
|
+
}),
|
|
86011
|
+
status: async (requestId) => releaseOf({
|
|
86012
|
+
response: await reach({
|
|
86013
|
+
context,
|
|
86014
|
+
url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
|
|
86015
|
+
init: { method: "GET", headers }
|
|
86016
|
+
})
|
|
86017
|
+
})
|
|
86018
|
+
};
|
|
86019
|
+
}
|
|
86020
|
+
const signed2 = await signedIn({ context, args }).catch(() => null);
|
|
86021
|
+
if (signed2?.profile.kind !== "agent") throw new CliUsageError(WHERE);
|
|
86022
|
+
const { client, name: name3 } = signed2;
|
|
86023
|
+
const channelId = flagText({ args, name: "channel" }) || null;
|
|
86024
|
+
return {
|
|
86025
|
+
keyPath: runKeyPathOf({ turnFile: void 0, connection: keyName, profile: name3 }),
|
|
86026
|
+
ask: async (body) => {
|
|
86027
|
+
try {
|
|
86028
|
+
return await client.post("/api/agents/me/vault/release-batch", {
|
|
86029
|
+
...body,
|
|
86030
|
+
channelId
|
|
86031
|
+
});
|
|
86032
|
+
} catch (error62) {
|
|
86033
|
+
if (!(error62 instanceof LazeApiError)) throw error62;
|
|
86034
|
+
throw new CliUsageError(
|
|
86035
|
+
`laze vault: the batch was refused: ${error62.message} (${error62.code})`
|
|
86036
|
+
);
|
|
86037
|
+
}
|
|
86038
|
+
},
|
|
86039
|
+
status: (requestId) => client.post("/api/agents/me/vault/release-status", { requestId, channelId }).catch(refusedRelease)
|
|
86040
|
+
};
|
|
86041
|
+
}
|
|
86042
|
+
async function resolveBatch({
|
|
86043
|
+
context,
|
|
86044
|
+
args,
|
|
86045
|
+
refs
|
|
86046
|
+
}) {
|
|
86047
|
+
const door = await doorOf({ context, args, keyName: "env-names" });
|
|
86048
|
+
const answer4 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
|
|
86049
|
+
return answer4.entries;
|
|
86050
|
+
}
|
|
86051
|
+
var keyOf = (entry) => entry.connection?.name ?? entry.ref;
|
|
86052
|
+
async function untilAllAnswered({
|
|
86053
|
+
context,
|
|
86054
|
+
door,
|
|
86055
|
+
waiting,
|
|
86056
|
+
deadline
|
|
86057
|
+
}) {
|
|
86058
|
+
const answered = /* @__PURE__ */ new Map();
|
|
86059
|
+
if (waiting.size === 0) return answered;
|
|
86060
|
+
const [first] = waiting.values();
|
|
86061
|
+
context.err(
|
|
86062
|
+
`laze vault: ${[...waiting.keys()].join(", ")} wait for an answer (${first?.message ?? "a card"}); cards expire after 12 hours...
|
|
86063
|
+
`
|
|
86064
|
+
);
|
|
86065
|
+
while (waiting.size > 0) {
|
|
86066
|
+
if (context.nowMs() + POLL_MS2 > deadline) {
|
|
86067
|
+
context.err(
|
|
86068
|
+
`laze vault: ${[...waiting.keys()].join(", ")} not approved yet; ask again later.
|
|
86069
|
+
`
|
|
86070
|
+
);
|
|
86071
|
+
return "capped";
|
|
86072
|
+
}
|
|
86073
|
+
await context.sleep(POLL_MS2);
|
|
86074
|
+
for (const [key, pending] of waiting) {
|
|
86075
|
+
const next = await door.status(pending.requestId);
|
|
86076
|
+
if (next.outcome === "ask") waiting.set(key, next);
|
|
86077
|
+
else {
|
|
86078
|
+
waiting.delete(key);
|
|
86079
|
+
answered.set(key, next);
|
|
86080
|
+
}
|
|
86081
|
+
}
|
|
86082
|
+
}
|
|
86083
|
+
return answered;
|
|
86084
|
+
}
|
|
86085
|
+
async function releaseBatch({
|
|
86086
|
+
context,
|
|
86087
|
+
args,
|
|
86088
|
+
refs,
|
|
86089
|
+
reason,
|
|
86090
|
+
command
|
|
86091
|
+
}) {
|
|
86092
|
+
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
86093
|
+
const door = await doorOf({ context, args, keyName: `env:${[...refs].toSorted().join(",")}` });
|
|
86094
|
+
const run4 = await runKeyAt({ path: door.keyPath });
|
|
86095
|
+
let answer4;
|
|
86096
|
+
let settled2;
|
|
86097
|
+
try {
|
|
86098
|
+
answer4 = await door.ask({ refs, reason, command, recipient: run4.publicKey });
|
|
86099
|
+
const missing = answer4.entries.filter((entry) => !entry.connection);
|
|
86100
|
+
if (missing.length > 0) {
|
|
86101
|
+
context.err(
|
|
86102
|
+
`laze vault: no key named ${missing.map((entry) => entry.ref).join(", ")} in your vault or reachable by this agent
|
|
86103
|
+
`
|
|
86104
|
+
);
|
|
86105
|
+
return { exitCode: 1 };
|
|
86106
|
+
}
|
|
86107
|
+
settled2 = /* @__PURE__ */ new Map();
|
|
86108
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
86109
|
+
for (const entry of answer4.entries) {
|
|
86110
|
+
const release2 = entry.release;
|
|
86111
|
+
if (!release2) continue;
|
|
86112
|
+
if (release2.outcome === "ask") waiting.set(keyOf(entry), release2);
|
|
86113
|
+
else settled2.set(keyOf(entry), release2);
|
|
86114
|
+
}
|
|
86115
|
+
const later = await untilAllAnswered({ context, door, waiting, deadline });
|
|
86116
|
+
if (later === "capped") return { exitCode: 75 };
|
|
86117
|
+
for (const [key, release2] of later) settled2.set(key, release2);
|
|
86118
|
+
} catch (error62) {
|
|
86119
|
+
if (!(error62 instanceof ServerGoneError)) throw error62;
|
|
86120
|
+
context.err(`${error62.message}. Run the command again to keep waiting.
|
|
86121
|
+
`);
|
|
86122
|
+
return { exitCode: 75 };
|
|
86123
|
+
}
|
|
86124
|
+
return valuesOf({ context, entries: answer4.entries, settled: settled2, run: run4, keyPath: door.keyPath });
|
|
86125
|
+
}
|
|
86126
|
+
function refusalOf({
|
|
86127
|
+
context,
|
|
86128
|
+
settled: settled2
|
|
86129
|
+
}) {
|
|
86130
|
+
const codes = [];
|
|
86131
|
+
for (const release2 of settled2.values()) {
|
|
86132
|
+
if (release2.outcome !== "deny") continue;
|
|
86133
|
+
context.err(`${release2.message}
|
|
86134
|
+
`);
|
|
86135
|
+
codes.push(release2.exitCode || 1);
|
|
86136
|
+
}
|
|
86137
|
+
if (codes.length === 0) return 0;
|
|
86138
|
+
return codes.includes(77) ? 77 : codes[0] ?? 1;
|
|
86139
|
+
}
|
|
86140
|
+
async function valuesOf({
|
|
86141
|
+
context,
|
|
86142
|
+
entries,
|
|
86143
|
+
settled: settled2,
|
|
86144
|
+
run: run4,
|
|
86145
|
+
keyPath
|
|
86146
|
+
}) {
|
|
86147
|
+
const refused = refusalOf({ context, settled: settled2 });
|
|
86148
|
+
if (refused !== 0) {
|
|
86149
|
+
await rm14(keyPath, { force: true });
|
|
86150
|
+
return { exitCode: refused };
|
|
86151
|
+
}
|
|
86152
|
+
const opened = /* @__PURE__ */ new Map();
|
|
86153
|
+
let keep = false;
|
|
86154
|
+
for (const [key, release2] of settled2) {
|
|
86155
|
+
if (release2.outcome !== "allow") continue;
|
|
86156
|
+
opened.set(key, await envOf({ release: release2, run: run4 }));
|
|
86157
|
+
if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep = true;
|
|
86158
|
+
if (release2.message) context.err(`${release2.message}
|
|
86159
|
+
`);
|
|
86160
|
+
}
|
|
86161
|
+
if (!keep) await rm14(keyPath, { force: true });
|
|
86162
|
+
const released = /* @__PURE__ */ new Map();
|
|
86163
|
+
for (const entry of entries) {
|
|
86164
|
+
const fields = opened.get(keyOf(entry));
|
|
86165
|
+
if (fields) released.set(entry.ref, { fields });
|
|
86166
|
+
}
|
|
86167
|
+
return { released, entries };
|
|
86168
|
+
}
|
|
86169
|
+
|
|
86170
|
+
// src/services/vault-env-commands.service.ts
|
|
86171
|
+
var ENV_USAGE = `Usage: laze vault env [<file>] [--env <name>] --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
86172
|
+
laze vault env [<file>] [--env <name>] --names
|
|
86173
|
+
laze vault env [<file>] --shell [--command-b64 <base64>] --reason "<one plain sentence>"
|
|
86174
|
+
Runs the command with every key the manifest names in its environment, asked in one go.
|
|
86175
|
+
The manifest is .env.vault (.env.<name>.vault with --env), here or in the nearest parent folder.
|
|
86176
|
+
Lines: KEY (the field KEY of the key that holds it), KEY={{vault:<name>}}, a key's name (all its
|
|
86177
|
+
fields) or KEY=value (plain text); # starts a comment.
|
|
86178
|
+
--names what each line resolves to, never a value
|
|
86179
|
+
--shell export lines to eval instead of running a command; refused on a terminal
|
|
86180
|
+
--reason or KV_REASON / LAZE_VAULT_REASON in the environment
|
|
86181
|
+
Exit codes: the command's own; 2 the reason was refused; 77 the vault denied a key, do not retry;
|
|
86182
|
+
75 the wait ran out, run it again to keep waiting; 1 a usage error or a name nothing resolves.`;
|
|
86183
|
+
var AWS_USAGE = `Usage: laze vault aws <connection> [--reason "<one plain sentence>"] [-- <command> [args...]]
|
|
86184
|
+
Prints AWS credential_process JSON with a short-lived STS session minted from the key, for
|
|
86185
|
+
~/.aws/config: credential_process = laze vault aws <connection>
|
|
86186
|
+
With -- <command>, runs it with AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN set.
|
|
86187
|
+
The reason comes from --reason, else KV_REASON or LAZE_VAULT_REASON: set it on each aws, kubectl,
|
|
86188
|
+
helm or terraform command, which reach this through credential_process.`;
|
|
86189
|
+
function withWaitSeconds(args) {
|
|
86190
|
+
if (args.flags.wait !== true) return args;
|
|
86191
|
+
const at = args.words.findLastIndex((word3, index) => index >= 2 && /^\d+$/.test(word3));
|
|
86192
|
+
if (at === -1) return args;
|
|
86193
|
+
return {
|
|
86194
|
+
...args,
|
|
86195
|
+
words: args.words.filter((_, index) => index !== at),
|
|
86196
|
+
flags: { ...args.flags, wait: args.words[at] ?? "" }
|
|
86197
|
+
};
|
|
86198
|
+
}
|
|
86199
|
+
function reasonOf({ context, args }) {
|
|
86200
|
+
const env = context.environment.inherited;
|
|
86201
|
+
return flagText({ args, name: "reason" }) || env.KV_REASON?.trim() || env.LAZE_VAULT_REASON?.trim() || "";
|
|
86202
|
+
}
|
|
86203
|
+
function refusedReason({
|
|
86204
|
+
context,
|
|
86205
|
+
reason
|
|
86206
|
+
}) {
|
|
86207
|
+
const problem = checkVaultReason(reason);
|
|
86208
|
+
if (problem === "ok") return null;
|
|
86209
|
+
context.err(`laze vault: the reason is refused (${problem}). ${VAULT_REASON_GUIDANCE}
|
|
86210
|
+
`);
|
|
86211
|
+
return VAULT_EXIT_BAD_REASON;
|
|
86212
|
+
}
|
|
86213
|
+
async function isFile(path) {
|
|
86214
|
+
return stat5(path).then(
|
|
86215
|
+
(found) => found.isFile(),
|
|
86216
|
+
() => false
|
|
86217
|
+
);
|
|
86218
|
+
}
|
|
86219
|
+
async function manifestPathOf({
|
|
86220
|
+
context,
|
|
86221
|
+
args
|
|
86222
|
+
}) {
|
|
86223
|
+
const named = args.words[2];
|
|
86224
|
+
if (named) return resolve15(context.cwd, named);
|
|
86225
|
+
const environment = flagText({ args, name: "env" });
|
|
86226
|
+
const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
86227
|
+
for (let dir = resolve15(context.cwd); ; dir = dirname22(dir)) {
|
|
86228
|
+
if (await isFile(join24(dir, file3))) return join24(dir, file3);
|
|
86229
|
+
if (dirname22(dir) === dir) break;
|
|
86230
|
+
}
|
|
86231
|
+
throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
|
|
86232
|
+
${ENV_USAGE}`);
|
|
86233
|
+
}
|
|
86234
|
+
async function manifestOf({
|
|
86235
|
+
context,
|
|
86236
|
+
args
|
|
86237
|
+
}) {
|
|
86238
|
+
const file3 = await manifestPathOf({ context, args });
|
|
86239
|
+
const text2 = await readFile36(file3, "utf8").catch(() => {
|
|
86240
|
+
throw new CliUsageError(`laze vault: cannot read ${file3}`);
|
|
86241
|
+
});
|
|
86242
|
+
return { file: file3, lines: parseManifest({ text: text2, file: file3 }) };
|
|
86243
|
+
}
|
|
86244
|
+
async function printNames({
|
|
86245
|
+
context,
|
|
86246
|
+
args,
|
|
86247
|
+
lines: lines2
|
|
86248
|
+
}) {
|
|
86249
|
+
const refs = refsOf(lines2);
|
|
86250
|
+
const entries = refs.length > 0 ? await resolveBatch({ context, args, refs }) : [];
|
|
86251
|
+
const byRef = new Map(entries.map((entry) => [entry.ref, entry.connection]));
|
|
86252
|
+
let missing = false;
|
|
86253
|
+
for (const line of lines2) {
|
|
86254
|
+
const label3 = line.kind === "connection" ? line.ref : line.variable;
|
|
86255
|
+
if (line.kind === "plain") {
|
|
86256
|
+
context.out(`${label3} plain
|
|
86257
|
+
`);
|
|
86258
|
+
continue;
|
|
86259
|
+
}
|
|
86260
|
+
const connection = byRef.get(line.ref);
|
|
86261
|
+
if (!connection) missing = true;
|
|
86262
|
+
context.out(
|
|
86263
|
+
connection ? `${label3} ${connection.name} ${vaultLevelLabel(connection.sensitivity)}
|
|
86264
|
+
` : `${label3} not found
|
|
86265
|
+
`
|
|
86266
|
+
);
|
|
86267
|
+
}
|
|
86268
|
+
return missing ? 1 : 0;
|
|
86269
|
+
}
|
|
86270
|
+
function wrappedCommandOf(args) {
|
|
86271
|
+
const encoded = flagText({ args, name: "command-b64" });
|
|
86272
|
+
if (!encoded) return ["(shell)"];
|
|
86273
|
+
return [Buffer.from(encoded, "base64").toString("utf8").slice(0, 2e3)];
|
|
86274
|
+
}
|
|
86275
|
+
async function vaultEnv2({
|
|
86276
|
+
context,
|
|
86277
|
+
args: given
|
|
86278
|
+
}) {
|
|
86279
|
+
const args = withWaitSeconds(given);
|
|
86280
|
+
if (args.flags.help) {
|
|
86281
|
+
context.out(`${ENV_USAGE}
|
|
86282
|
+
`);
|
|
86283
|
+
return 0;
|
|
86284
|
+
}
|
|
86285
|
+
const { lines: lines2 } = await manifestOf({ context, args });
|
|
86286
|
+
if (args.flags.names) return printNames({ context, args, lines: lines2 });
|
|
86287
|
+
const shell = args.flags.shell === true;
|
|
86288
|
+
if (shell && context.stdoutIsTerminal) {
|
|
86289
|
+
throw new CliUsageError(
|
|
86290
|
+
"laze vault env --shell prints values: it runs only with its output to a pipe, such as the Bash hook's eval"
|
|
86291
|
+
);
|
|
86292
|
+
}
|
|
86293
|
+
if (!shell && args.rest.length === 0) throw new CliUsageError(ENV_USAGE);
|
|
86294
|
+
const reason = reasonOf({ context, args });
|
|
86295
|
+
if (!reason)
|
|
86296
|
+
throw new CliUsageError(`Say why with --reason "<one plain sentence>"
|
|
86297
|
+
${ENV_USAGE}`);
|
|
86298
|
+
const badReason = refusedReason({ context, reason });
|
|
86299
|
+
if (badReason !== null) return badReason;
|
|
86300
|
+
const refs = refsOf(lines2);
|
|
86301
|
+
let released = /* @__PURE__ */ new Map();
|
|
86302
|
+
if (refs.length > 0) {
|
|
86303
|
+
const command = shell ? wrappedCommandOf(args) : args.rest;
|
|
86304
|
+
const outcome = await releaseBatch({ context, args, refs, reason, command });
|
|
86305
|
+
if ("exitCode" in outcome) return outcome.exitCode;
|
|
86306
|
+
released = outcome.released;
|
|
86307
|
+
}
|
|
86308
|
+
const env = environmentOf({ lines: lines2, released });
|
|
86309
|
+
if (shell) {
|
|
86310
|
+
context.out(`${shellExports(env)}
|
|
86311
|
+
`);
|
|
86312
|
+
return 0;
|
|
86313
|
+
}
|
|
86314
|
+
const redact = [...released.values()].flatMap(({ fields }) => Object.values(fields));
|
|
86315
|
+
return context.runCommand({ command: args.rest, env, redact });
|
|
86316
|
+
}
|
|
86317
|
+
async function vaultAws({
|
|
86318
|
+
context,
|
|
86319
|
+
args: given
|
|
86320
|
+
}) {
|
|
86321
|
+
const args = withWaitSeconds(given);
|
|
86322
|
+
const connection = args.words[2];
|
|
86323
|
+
if (!connection || args.flags.help) throw new CliUsageError(AWS_USAGE);
|
|
86324
|
+
const reason = reasonOf({ context, args });
|
|
86325
|
+
if (!reason) {
|
|
86326
|
+
throw new CliUsageError(
|
|
86327
|
+
`Say why with --reason "<one plain sentence>" or KV_REASON
|
|
86328
|
+
${AWS_USAGE}`
|
|
86329
|
+
);
|
|
86330
|
+
}
|
|
86331
|
+
const badReason = refusedReason({ context, reason });
|
|
86332
|
+
if (badReason !== null) return badReason;
|
|
86333
|
+
const command = args.rest.length > 0 ? args.rest : ["credential_process"];
|
|
86334
|
+
const outcome = await releaseBatch({ context, args, refs: [connection], reason, command });
|
|
86335
|
+
if ("exitCode" in outcome) return outcome.exitCode;
|
|
86336
|
+
const fields = outcome.released.get(connection)?.fields ?? {};
|
|
86337
|
+
if (!fields.AWS_SESSION_TOKEN) {
|
|
86338
|
+
context.err(`laze vault: ${connection} is not an AWS key; use laze vault run for it
|
|
86339
|
+
`);
|
|
86340
|
+
return 1;
|
|
86341
|
+
}
|
|
86342
|
+
if (args.rest.length > 0) return context.runCommand({ command: args.rest, env: fields });
|
|
86343
|
+
context.out(`${credentialProcessJson(fields)}
|
|
86344
|
+
`);
|
|
86345
|
+
return 0;
|
|
86346
|
+
}
|
|
86347
|
+
|
|
85769
86348
|
// src/services/vault-save-message-commands.service.ts
|
|
85770
86349
|
var SAVE_USAGE = `Usage: laze vault save <pending> --name <name> --description "<what it is for>"
|
|
85771
86350
|
Names a key Laze held from a message you received, in the sender's vault.
|
|
@@ -85839,7 +86418,7 @@ async function vaultSave({ context, args }) {
|
|
|
85839
86418
|
}
|
|
85840
86419
|
|
|
85841
86420
|
// src/services/vault-scrub-commands.service.ts
|
|
85842
|
-
function
|
|
86421
|
+
function lineOf5(channel) {
|
|
85843
86422
|
const where = channel.name ? `#${channel.name}` : channel.channelId;
|
|
85844
86423
|
const found = Object.entries(channel.found).map(([vendor, count5]) => `${vendor} ${count5}`).join(", ");
|
|
85845
86424
|
const kinds = [`held ${channel.held}`, ...found ? [`found: ${found}`] : []].join("; ");
|
|
@@ -85853,7 +86432,7 @@ async function vaultScrub({ context, args }) {
|
|
|
85853
86432
|
if (args.flags.json) return context.out(`${JSON.stringify(report3, null, 2)}
|
|
85854
86433
|
`);
|
|
85855
86434
|
const changed = report3.channels.filter((channel) => channel.messages > 0);
|
|
85856
|
-
for (const channel of changed) context.out(
|
|
86435
|
+
for (const channel of changed) context.out(lineOf5(channel));
|
|
85857
86436
|
const total = changed.reduce((sum, channel) => sum + channel.messages, 0);
|
|
85858
86437
|
context.out(
|
|
85859
86438
|
report3.dryRun ? `Dry run: ${total} message(s) would change. Nothing was changed.
|
|
@@ -85863,8 +86442,8 @@ async function vaultScrub({ context, args }) {
|
|
|
85863
86442
|
}
|
|
85864
86443
|
|
|
85865
86444
|
// src/services/whatsapp-business-commands.service.ts
|
|
85866
|
-
import { readFile as
|
|
85867
|
-
import { resolve as
|
|
86445
|
+
import { readFile as readFile37 } from "node:fs/promises";
|
|
86446
|
+
import { resolve as resolve16 } from "node:path";
|
|
85868
86447
|
|
|
85869
86448
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
85870
86449
|
var whatsappBusinessCategorySchema = external_exports.enum([
|
|
@@ -86283,7 +86862,7 @@ async function secretsOf2({ context, args }) {
|
|
|
86283
86862
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
86284
86863
|
if (fromConnection) return { fromConnection };
|
|
86285
86864
|
const file3 = flagText({ args, name: "from-file" });
|
|
86286
|
-
const text2 = file3 ? await
|
|
86865
|
+
const text2 = file3 ? await readFile37(resolve16(context.cwd, file3), "utf8") : await context.readStdin();
|
|
86287
86866
|
const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
86288
86867
|
if (lines2.length !== 2) {
|
|
86289
86868
|
throw new CliUsageError(
|
|
@@ -86485,7 +87064,7 @@ async function whatsappBusiness({
|
|
|
86485
87064
|
|
|
86486
87065
|
// src/services/whatsapp-pairing-commands.service.ts
|
|
86487
87066
|
import { writeFile as writeFile22 } from "node:fs/promises";
|
|
86488
|
-
import { resolve as
|
|
87067
|
+
import { resolve as resolve17 } from "node:path";
|
|
86489
87068
|
var WHATSAPP_PAIRING_USAGE = [
|
|
86490
87069
|
" laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
|
|
86491
87070
|
" laze whatsapp pairing <pairing-id> [--qr <file.svg>] where the linking stands, with a fresh code",
|
|
@@ -86504,7 +87083,7 @@ function svgOf(dataUrl) {
|
|
|
86504
87083
|
return decodeURIComponent(body);
|
|
86505
87084
|
}
|
|
86506
87085
|
async function report({ context, args, pairing: pairing2 }) {
|
|
86507
|
-
const qrFile = pairing2.qrSvg ?
|
|
87086
|
+
const qrFile = pairing2.qrSvg ? resolve17(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
|
|
86508
87087
|
if (qrFile && pairing2.qrSvg) await writeFile22(qrFile, svgOf(pairing2.qrSvg), "utf8");
|
|
86509
87088
|
if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
|
|
86510
87089
|
`);
|
|
@@ -86864,8 +87443,8 @@ async function flags({ context, args }) {
|
|
|
86864
87443
|
}
|
|
86865
87444
|
|
|
86866
87445
|
// src/services/workspace-commands.service.ts
|
|
86867
|
-
import { readFile as
|
|
86868
|
-
import { resolve as
|
|
87446
|
+
import { readFile as readFile38 } from "node:fs/promises";
|
|
87447
|
+
import { resolve as resolve18 } from "node:path";
|
|
86869
87448
|
var ROLE_NAMES2 = {
|
|
86870
87449
|
OWNER: "Owner",
|
|
86871
87450
|
ADMIN: "Admin",
|
|
@@ -87047,7 +87626,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
87047
87626
|
async function readLogo({ context, file: file3 }) {
|
|
87048
87627
|
let bytes;
|
|
87049
87628
|
try {
|
|
87050
|
-
bytes = new Uint8Array(await
|
|
87629
|
+
bytes = new Uint8Array(await readFile38(resolve18(context.cwd, file3)));
|
|
87051
87630
|
} catch {
|
|
87052
87631
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
87053
87632
|
}
|
|
@@ -87405,12 +87984,16 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
87405
87984
|
laze agent permission-prompts <agent> each permission prompt its harness raised and rush's answer
|
|
87406
87985
|
laze agent share|unshare <agent> --person <userId> | --channel <channelId> share it (its owner)
|
|
87407
87986
|
laze agent stop <agent> --channel <channelId> stop its running turn there
|
|
87987
|
+
laze agent retry <agent> --channel <id> --message <id> Try again on its failed turn on that message
|
|
87408
87988
|
laze agent invite [--name <name>] [--channel <id>] a one-time link that connects a new agent;
|
|
87409
87989
|
without --name the agent picks its own
|
|
87410
87990
|
laze agent faces every agent's sloth seed or picture
|
|
87411
87991
|
laze adopt codex [--thread <id>] answer Laze messages in a Codex thread
|
|
87412
87992
|
laze adopt codex --status | --stop the background adopt that laze agent link started
|
|
87413
87993
|
laze vault run <name> --reason "<why>" -- <cmd> run a command with a vault connection (agents)
|
|
87994
|
+
laze vault env [<file>] --reason "<why>" -- <cmd> run a command with every key .env.vault names (agents)
|
|
87995
|
+
laze vault env --names | --shell what .env.vault resolves to; export lines for a shell hook
|
|
87996
|
+
laze vault aws <connection> [--reason "<why>"] AWS credential_process JSON from a short-lived STS session
|
|
87414
87997
|
laze vault save <pending> --name <name> --description "<text>" name a key Laze held from a message (agents)
|
|
87415
87998
|
laze vault save --from-message <id> --name <name> --description "<text>" save a key a person sent,
|
|
87416
87999
|
read from stdin, to their own vault; the message keeps {{vault:<name>}} (agents, no vault access)
|
|
@@ -87571,6 +88154,8 @@ var COMMANDS3 = {
|
|
|
87571
88154
|
skill,
|
|
87572
88155
|
app,
|
|
87573
88156
|
"vault run": vaultRun,
|
|
88157
|
+
"vault env": vaultEnv2,
|
|
88158
|
+
"vault aws": vaultAws,
|
|
87574
88159
|
"vault save": vaultSave,
|
|
87575
88160
|
"vault save-from-message": vaultSaveFromMessage,
|
|
87576
88161
|
connect,
|
|
@@ -87653,6 +88238,7 @@ var COMMANDS3 = {
|
|
|
87653
88238
|
"agent unshare": shareAgent,
|
|
87654
88239
|
"agent dm": openAgentDirect,
|
|
87655
88240
|
"agent stop": stopAgentTurn,
|
|
88241
|
+
"agent retry": retryAgentTurn,
|
|
87656
88242
|
"agent disconnect": disconnectAgent,
|
|
87657
88243
|
"agent invite": inviteAgent,
|
|
87658
88244
|
"mcp gateway": serveMcpGateway,
|
|
@@ -87716,8 +88302,8 @@ async function runCli({
|
|
|
87716
88302
|
// src/services/processes.service.ts
|
|
87717
88303
|
import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
|
|
87718
88304
|
import { mkdirSync, openSync } from "node:fs";
|
|
87719
|
-
import { readFile as
|
|
87720
|
-
import { dirname as
|
|
88305
|
+
import { readFile as readFile39, readlink } from "node:fs/promises";
|
|
88306
|
+
import { dirname as dirname23 } from "node:path";
|
|
87721
88307
|
import { promisify as promisify2 } from "node:util";
|
|
87722
88308
|
var run3 = promisify2(execFile2);
|
|
87723
88309
|
function alive(pid) {
|
|
@@ -87730,15 +88316,15 @@ function alive(pid) {
|
|
|
87730
88316
|
}
|
|
87731
88317
|
}
|
|
87732
88318
|
async function argsOf(pid) {
|
|
87733
|
-
const raw = await
|
|
88319
|
+
const raw = await readFile39(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
87734
88320
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
87735
88321
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
87736
88322
|
const line = listed?.stdout.trim();
|
|
87737
88323
|
return line ? line.split(/\s+/) : void 0;
|
|
87738
88324
|
}
|
|
87739
88325
|
async function parentOf(pid) {
|
|
87740
|
-
const
|
|
87741
|
-
const fromStat =
|
|
88326
|
+
const stat6 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
88327
|
+
const fromStat = stat6 ? Number(stat6.slice(stat6.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
87742
88328
|
if (fromStat > 0) return fromStat;
|
|
87743
88329
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
87744
88330
|
const parent = Number(listed?.stdout.trim());
|
|
@@ -87754,7 +88340,7 @@ async function cwdOf(pid) {
|
|
|
87754
88340
|
return line ? line.slice(1) : void 0;
|
|
87755
88341
|
}
|
|
87756
88342
|
function spawnDetached({ argv, logPath }) {
|
|
87757
|
-
mkdirSync(
|
|
88343
|
+
mkdirSync(dirname23(logPath), { recursive: true, mode: 448 });
|
|
87758
88344
|
const log = openSync(logPath, "a", 384);
|
|
87759
88345
|
const [program = "", ...rest] = argv;
|
|
87760
88346
|
const child = spawn4(program, rest, { detached: true, stdio: ["ignore", log, log] });
|
|
@@ -87812,7 +88398,8 @@ async function runCommand({
|
|
|
87812
88398
|
env,
|
|
87813
88399
|
stdout: stdout2 = process.stdout,
|
|
87814
88400
|
stderr: stderr2 = process.stderr,
|
|
87815
|
-
signal
|
|
88401
|
+
signal,
|
|
88402
|
+
redact
|
|
87816
88403
|
}) {
|
|
87817
88404
|
const [program = "", ...rest] = command;
|
|
87818
88405
|
try {
|
|
@@ -87822,7 +88409,8 @@ async function runCommand({
|
|
|
87822
88409
|
baseEnv: inherited,
|
|
87823
88410
|
stdout: stdout2,
|
|
87824
88411
|
stderr: stderr2,
|
|
87825
|
-
...signal ? { signal } : {}
|
|
88412
|
+
...signal ? { signal } : {},
|
|
88413
|
+
...redact ? { redact } : {}
|
|
87826
88414
|
});
|
|
87827
88415
|
} catch (error62) {
|
|
87828
88416
|
stderr2.write(`laze vault: ${error62 instanceof Error ? error62.message : String(error62)}
|
|
@@ -87848,15 +88436,15 @@ function terminalAsk() {
|
|
|
87848
88436
|
};
|
|
87849
88437
|
}
|
|
87850
88438
|
function sleep(ms, signal) {
|
|
87851
|
-
return new Promise((
|
|
87852
|
-
if (signal?.aborted) return
|
|
88439
|
+
return new Promise((resolve19) => {
|
|
88440
|
+
if (signal?.aborted) return resolve19();
|
|
87853
88441
|
const stop3 = () => {
|
|
87854
88442
|
clearTimeout(timer);
|
|
87855
|
-
|
|
88443
|
+
resolve19();
|
|
87856
88444
|
};
|
|
87857
88445
|
const timer = setTimeout(() => {
|
|
87858
88446
|
signal?.removeEventListener("abort", stop3);
|
|
87859
|
-
|
|
88447
|
+
resolve19();
|
|
87860
88448
|
}, ms);
|
|
87861
88449
|
signal?.addEventListener("abort", stop3, { once: true });
|
|
87862
88450
|
});
|
|
@@ -87880,6 +88468,7 @@ if (true) {
|
|
|
87880
88468
|
out: (text2) => void process.stdout.write(text2),
|
|
87881
88469
|
err: (text2) => void process.stderr.write(text2),
|
|
87882
88470
|
readStdin,
|
|
88471
|
+
stdoutIsTerminal: process.stdout.isTTY === true,
|
|
87883
88472
|
...ask ? { ask } : {},
|
|
87884
88473
|
sleep,
|
|
87885
88474
|
nowMs: () => nowInstant().epochMilliseconds,
|