@lazehq/cli 0.1.99 → 0.1.100
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 +1938 -1294
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -849,9 +849,9 @@ var require_node_gyp_build = __commonJS({
|
|
|
849
849
|
var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
|
|
850
850
|
if (debug) return debug;
|
|
851
851
|
}
|
|
852
|
-
var prebuild =
|
|
852
|
+
var prebuild = resolve27(dir);
|
|
853
853
|
if (prebuild) return prebuild;
|
|
854
|
-
var nearby =
|
|
854
|
+
var nearby = resolve27(path.dirname(process.execPath));
|
|
855
855
|
if (nearby) return nearby;
|
|
856
856
|
var target = [
|
|
857
857
|
"platform=" + platform,
|
|
@@ -867,7 +867,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
867
867
|
// eslint-disable-line
|
|
868
868
|
].filter(Boolean).join(" ");
|
|
869
869
|
throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
|
|
870
|
-
function
|
|
870
|
+
function resolve27(dir2) {
|
|
871
871
|
var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
|
|
872
872
|
var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
873
873
|
if (!tuple2) return;
|
|
@@ -7314,9 +7314,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
7314
7314
|
}
|
|
7315
7315
|
close(callback) {
|
|
7316
7316
|
if (callback === void 0) {
|
|
7317
|
-
return new Promise((
|
|
7317
|
+
return new Promise((resolve27, reject) => {
|
|
7318
7318
|
this.close((err, data) => {
|
|
7319
|
-
return err ? reject(err) :
|
|
7319
|
+
return err ? reject(err) : resolve27(data);
|
|
7320
7320
|
});
|
|
7321
7321
|
});
|
|
7322
7322
|
}
|
|
@@ -7354,9 +7354,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
7354
7354
|
err = null;
|
|
7355
7355
|
}
|
|
7356
7356
|
if (callback === void 0) {
|
|
7357
|
-
return new Promise((
|
|
7357
|
+
return new Promise((resolve27, reject) => {
|
|
7358
7358
|
this.destroy(err, (err2, data) => {
|
|
7359
|
-
return err2 ? reject(err2) :
|
|
7359
|
+
return err2 ? reject(err2) : resolve27(data);
|
|
7360
7360
|
});
|
|
7361
7361
|
});
|
|
7362
7362
|
}
|
|
@@ -12311,12 +12311,12 @@ upgrade: ${upgrade2}\r
|
|
|
12311
12311
|
cb();
|
|
12312
12312
|
}
|
|
12313
12313
|
}
|
|
12314
|
-
const waitForDrain = () => new Promise((
|
|
12314
|
+
const waitForDrain = () => new Promise((resolve27, reject) => {
|
|
12315
12315
|
assert2(callback === null);
|
|
12316
12316
|
if (socket[kError]) {
|
|
12317
12317
|
reject(socket[kError]);
|
|
12318
12318
|
} else {
|
|
12319
|
-
callback =
|
|
12319
|
+
callback = resolve27;
|
|
12320
12320
|
}
|
|
12321
12321
|
});
|
|
12322
12322
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -13674,12 +13674,12 @@ var require_client_h2 = __commonJS({
|
|
|
13674
13674
|
cb();
|
|
13675
13675
|
}
|
|
13676
13676
|
}
|
|
13677
|
-
const waitForDrain = () => new Promise((
|
|
13677
|
+
const waitForDrain = () => new Promise((resolve27, reject) => {
|
|
13678
13678
|
assert2(callback === null);
|
|
13679
13679
|
if (socket[kError]) {
|
|
13680
13680
|
reject(socket[kError]);
|
|
13681
13681
|
} else {
|
|
13682
|
-
callback =
|
|
13682
|
+
callback = resolve27;
|
|
13683
13683
|
}
|
|
13684
13684
|
});
|
|
13685
13685
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -14047,16 +14047,16 @@ var require_client = __commonJS({
|
|
|
14047
14047
|
return this[kNeedDrain] < 2;
|
|
14048
14048
|
}
|
|
14049
14049
|
[kClose]() {
|
|
14050
|
-
return new Promise((
|
|
14050
|
+
return new Promise((resolve27) => {
|
|
14051
14051
|
if (this[kSize]) {
|
|
14052
|
-
this[kClosedResolve] =
|
|
14052
|
+
this[kClosedResolve] = resolve27;
|
|
14053
14053
|
} else {
|
|
14054
|
-
|
|
14054
|
+
resolve27(null);
|
|
14055
14055
|
}
|
|
14056
14056
|
});
|
|
14057
14057
|
}
|
|
14058
14058
|
[kDestroy](err) {
|
|
14059
|
-
return new Promise((
|
|
14059
|
+
return new Promise((resolve27) => {
|
|
14060
14060
|
const requests2 = this[kQueue].splice(this[kPendingIdx]);
|
|
14061
14061
|
for (let i = 0; i < requests2.length; i++) {
|
|
14062
14062
|
const request2 = requests2[i];
|
|
@@ -14069,7 +14069,7 @@ var require_client = __commonJS({
|
|
|
14069
14069
|
this[kClosedResolve]();
|
|
14070
14070
|
this[kClosedResolve] = null;
|
|
14071
14071
|
}
|
|
14072
|
-
|
|
14072
|
+
resolve27(null);
|
|
14073
14073
|
};
|
|
14074
14074
|
if (this[kHTTPContext]) {
|
|
14075
14075
|
this[kHTTPContext].destroy(err, callback);
|
|
@@ -14482,8 +14482,8 @@ var require_pool_base = __commonJS({
|
|
|
14482
14482
|
}
|
|
14483
14483
|
return Promise.all(closeAll);
|
|
14484
14484
|
} else {
|
|
14485
|
-
return new Promise((
|
|
14486
|
-
this[kClosedResolve] =
|
|
14485
|
+
return new Promise((resolve27) => {
|
|
14486
|
+
this[kClosedResolve] = resolve27;
|
|
14487
14487
|
});
|
|
14488
14488
|
}
|
|
14489
14489
|
}
|
|
@@ -16994,7 +16994,7 @@ var require_readable = __commonJS({
|
|
|
16994
16994
|
if (this._readableState.closeEmitted) {
|
|
16995
16995
|
return Promise.resolve(null);
|
|
16996
16996
|
}
|
|
16997
|
-
return new Promise((
|
|
16997
|
+
return new Promise((resolve27, reject) => {
|
|
16998
16998
|
if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
|
|
16999
16999
|
this.destroy(new AbortError());
|
|
17000
17000
|
}
|
|
@@ -17008,11 +17008,11 @@ var require_readable = __commonJS({
|
|
|
17008
17008
|
if (signal.aborted) {
|
|
17009
17009
|
reject(signal.reason ?? new AbortError());
|
|
17010
17010
|
} else {
|
|
17011
|
-
|
|
17011
|
+
resolve27(null);
|
|
17012
17012
|
}
|
|
17013
17013
|
});
|
|
17014
17014
|
} else {
|
|
17015
|
-
this.on("close",
|
|
17015
|
+
this.on("close", resolve27);
|
|
17016
17016
|
}
|
|
17017
17017
|
this.on("error", noop2).on("data", () => {
|
|
17018
17018
|
if (this[kBytesRead] > limit) {
|
|
@@ -17040,7 +17040,7 @@ var require_readable = __commonJS({
|
|
|
17040
17040
|
}
|
|
17041
17041
|
function consume(stream, type) {
|
|
17042
17042
|
assert2(!stream[kConsume]);
|
|
17043
|
-
return new Promise((
|
|
17043
|
+
return new Promise((resolve27, reject) => {
|
|
17044
17044
|
if (isUnusable(stream)) {
|
|
17045
17045
|
const rState = stream._readableState;
|
|
17046
17046
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -17055,7 +17055,7 @@ var require_readable = __commonJS({
|
|
|
17055
17055
|
stream[kConsume] = {
|
|
17056
17056
|
type,
|
|
17057
17057
|
stream,
|
|
17058
|
-
resolve:
|
|
17058
|
+
resolve: resolve27,
|
|
17059
17059
|
reject,
|
|
17060
17060
|
length: 0,
|
|
17061
17061
|
body: []
|
|
@@ -17133,18 +17133,18 @@ var require_readable = __commonJS({
|
|
|
17133
17133
|
return buffer;
|
|
17134
17134
|
}
|
|
17135
17135
|
function consumeEnd(consume2, encoding) {
|
|
17136
|
-
const { type, body, resolve:
|
|
17136
|
+
const { type, body, resolve: resolve27, stream, length } = consume2;
|
|
17137
17137
|
try {
|
|
17138
17138
|
if (type === "text") {
|
|
17139
|
-
|
|
17139
|
+
resolve27(chunksDecode(body, length, encoding));
|
|
17140
17140
|
} else if (type === "json") {
|
|
17141
|
-
|
|
17141
|
+
resolve27(JSON.parse(chunksDecode(body, length, encoding)));
|
|
17142
17142
|
} else if (type === "arrayBuffer") {
|
|
17143
|
-
|
|
17143
|
+
resolve27(chunksConcat(body, length).buffer);
|
|
17144
17144
|
} else if (type === "blob") {
|
|
17145
|
-
|
|
17145
|
+
resolve27(new Blob(body, { type: stream[kContentType] }));
|
|
17146
17146
|
} else if (type === "bytes") {
|
|
17147
|
-
|
|
17147
|
+
resolve27(chunksConcat(body, length));
|
|
17148
17148
|
}
|
|
17149
17149
|
consumeFinish(consume2);
|
|
17150
17150
|
} catch (err) {
|
|
@@ -17363,9 +17363,9 @@ var require_api_request = __commonJS({
|
|
|
17363
17363
|
};
|
|
17364
17364
|
function request2(opts, callback) {
|
|
17365
17365
|
if (callback === void 0) {
|
|
17366
|
-
return new Promise((
|
|
17366
|
+
return new Promise((resolve27, reject) => {
|
|
17367
17367
|
request2.call(this, opts, (err, data) => {
|
|
17368
|
-
return err ? reject(err) :
|
|
17368
|
+
return err ? reject(err) : resolve27(data);
|
|
17369
17369
|
});
|
|
17370
17370
|
});
|
|
17371
17371
|
}
|
|
@@ -17626,9 +17626,9 @@ var require_api_stream = __commonJS({
|
|
|
17626
17626
|
};
|
|
17627
17627
|
function stream(opts, factory, callback) {
|
|
17628
17628
|
if (callback === void 0) {
|
|
17629
|
-
return new Promise((
|
|
17629
|
+
return new Promise((resolve27, reject) => {
|
|
17630
17630
|
stream.call(this, opts, factory, (err, data) => {
|
|
17631
|
-
return err ? reject(err) :
|
|
17631
|
+
return err ? reject(err) : resolve27(data);
|
|
17632
17632
|
});
|
|
17633
17633
|
});
|
|
17634
17634
|
}
|
|
@@ -17928,9 +17928,9 @@ var require_api_upgrade = __commonJS({
|
|
|
17928
17928
|
};
|
|
17929
17929
|
function upgrade2(opts, callback) {
|
|
17930
17930
|
if (callback === void 0) {
|
|
17931
|
-
return new Promise((
|
|
17931
|
+
return new Promise((resolve27, reject) => {
|
|
17932
17932
|
upgrade2.call(this, opts, (err, data) => {
|
|
17933
|
-
return err ? reject(err) :
|
|
17933
|
+
return err ? reject(err) : resolve27(data);
|
|
17934
17934
|
});
|
|
17935
17935
|
});
|
|
17936
17936
|
}
|
|
@@ -18024,9 +18024,9 @@ var require_api_connect = __commonJS({
|
|
|
18024
18024
|
};
|
|
18025
18025
|
function connect8(opts, callback) {
|
|
18026
18026
|
if (callback === void 0) {
|
|
18027
|
-
return new Promise((
|
|
18027
|
+
return new Promise((resolve27, reject) => {
|
|
18028
18028
|
connect8.call(this, opts, (err, data) => {
|
|
18029
|
-
return err ? reject(err) :
|
|
18029
|
+
return err ? reject(err) : resolve27(data);
|
|
18030
18030
|
});
|
|
18031
18031
|
});
|
|
18032
18032
|
}
|
|
@@ -19487,7 +19487,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19487
19487
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
19488
19488
|
"use strict";
|
|
19489
19489
|
var { writeFile: writeFile12, readFile: readFile39, mkdir: mkdir13 } = __require("node:fs/promises");
|
|
19490
|
-
var { dirname: dirname27, resolve:
|
|
19490
|
+
var { dirname: dirname27, resolve: resolve27 } = __require("node:path");
|
|
19491
19491
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
19492
19492
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
19493
19493
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -19703,7 +19703,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19703
19703
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19704
19704
|
}
|
|
19705
19705
|
try {
|
|
19706
|
-
const data = await readFile39(
|
|
19706
|
+
const data = await readFile39(resolve27(path), "utf8");
|
|
19707
19707
|
const parsed = JSON.parse(data);
|
|
19708
19708
|
if (Array.isArray(parsed)) {
|
|
19709
19709
|
this.#snapshots.clear();
|
|
@@ -19732,7 +19732,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19732
19732
|
if (!path) {
|
|
19733
19733
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19734
19734
|
}
|
|
19735
|
-
const resolvedPath =
|
|
19735
|
+
const resolvedPath = resolve27(path);
|
|
19736
19736
|
await mkdir13(dirname27(resolvedPath), { recursive: true });
|
|
19737
19737
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
19738
19738
|
hash: hash2,
|
|
@@ -27230,7 +27230,7 @@ var require_fetch = __commonJS({
|
|
|
27230
27230
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
27231
27231
|
return dispatchWithProtocolPreference(body);
|
|
27232
27232
|
function dispatchWithProtocolPreference(body2, allowH2) {
|
|
27233
|
-
return new Promise((
|
|
27233
|
+
return new Promise((resolve27, reject) => agent3.dispatch(
|
|
27234
27234
|
{
|
|
27235
27235
|
path: hasTrailingQuestionMark ? `${path}?` : path,
|
|
27236
27236
|
origin: url2.origin,
|
|
@@ -27313,7 +27313,7 @@ var require_fetch = __commonJS({
|
|
|
27313
27313
|
}
|
|
27314
27314
|
}
|
|
27315
27315
|
const onError = (err) => this.onResponseError(controller, err);
|
|
27316
|
-
|
|
27316
|
+
resolve27({
|
|
27317
27317
|
status: status11,
|
|
27318
27318
|
statusText,
|
|
27319
27319
|
headersList,
|
|
@@ -27346,7 +27346,7 @@ var require_fetch = __commonJS({
|
|
|
27346
27346
|
fetchParams.controller.off("terminated", this.abort);
|
|
27347
27347
|
}
|
|
27348
27348
|
if (request2.mode === "websocket" && allowH2 !== false && error63?.code === "UND_ERR_INFO" && error63?.message === "HTTP/2: Extended CONNECT protocol not supported by server") {
|
|
27349
|
-
|
|
27349
|
+
resolve27(dispatchWithProtocolPreference(body2, false));
|
|
27350
27350
|
return;
|
|
27351
27351
|
}
|
|
27352
27352
|
this.body?.destroy(error63);
|
|
@@ -27360,7 +27360,7 @@ var require_fetch = __commonJS({
|
|
|
27360
27360
|
const rawHeaders = controller?.rawHeaders ?? [];
|
|
27361
27361
|
const headersList = new HeadersList();
|
|
27362
27362
|
appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders);
|
|
27363
|
-
|
|
27363
|
+
resolve27({
|
|
27364
27364
|
status: status11,
|
|
27365
27365
|
statusText: STATUS_CODES[status11],
|
|
27366
27366
|
headersList,
|
|
@@ -32693,7 +32693,7 @@ function runRedacted({
|
|
|
32693
32693
|
redact
|
|
32694
32694
|
}) {
|
|
32695
32695
|
const values = redact ?? Object.values(env);
|
|
32696
|
-
return new Promise((
|
|
32696
|
+
return new Promise((resolve27, reject) => {
|
|
32697
32697
|
const [file4, ...args] = command;
|
|
32698
32698
|
const child = spawn(file4, args, {
|
|
32699
32699
|
env: { ...baseEnv, ...env },
|
|
@@ -32719,7 +32719,7 @@ function runRedacted({
|
|
|
32719
32719
|
child.on("error", reject);
|
|
32720
32720
|
child.on("close", (code, ended) => {
|
|
32721
32721
|
signal?.removeEventListener("abort", killGroup);
|
|
32722
|
-
void drained.then(() =>
|
|
32722
|
+
void drained.then(() => resolve27(code ?? (ended ? 128 + signalNumber(ended) : 1)));
|
|
32723
32723
|
});
|
|
32724
32724
|
});
|
|
32725
32725
|
}
|
|
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
|
|
|
36960
36960
|
}
|
|
36961
36961
|
|
|
36962
36962
|
// src/rules/cli-version.rules.ts
|
|
36963
|
-
var STAMPED = "0.1.
|
|
36963
|
+
var STAMPED = "0.1.100";
|
|
36964
36964
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36965
36965
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36966
36966
|
}
|
|
@@ -37188,7 +37188,7 @@ async function withStateLock({
|
|
|
37188
37188
|
() => 0
|
|
37189
37189
|
);
|
|
37190
37190
|
if (since > LOCK_STALE_MS) await rm(lock, { force: true });
|
|
37191
|
-
else await new Promise((
|
|
37191
|
+
else await new Promise((resolve27) => setTimeout(resolve27, 15 + Math.random() * 20));
|
|
37192
37192
|
}
|
|
37193
37193
|
try {
|
|
37194
37194
|
return await work();
|
|
@@ -37392,6 +37392,7 @@ var SWITCHES = /* @__PURE__ */ new Set([
|
|
|
37392
37392
|
"save",
|
|
37393
37393
|
"private",
|
|
37394
37394
|
"public",
|
|
37395
|
+
"closed",
|
|
37395
37396
|
"mentions",
|
|
37396
37397
|
"threads",
|
|
37397
37398
|
"reactions",
|
|
@@ -42535,7 +42536,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
42535
42536
|
var NONE = 0;
|
|
42536
42537
|
var ASSUMED = 1;
|
|
42537
42538
|
var PROVEN = 2;
|
|
42538
|
-
function isRecursive(inst, stack,
|
|
42539
|
+
function isRecursive(inst, stack, resolve27) {
|
|
42539
42540
|
const cached2 = recursive.get(inst);
|
|
42540
42541
|
if (cached2 !== void 0)
|
|
42541
42542
|
return cached2 ? PROVEN : NONE;
|
|
@@ -42545,7 +42546,7 @@ function isRecursive(inst, stack, resolve26) {
|
|
|
42545
42546
|
let result2 = NONE;
|
|
42546
42547
|
const check3 = (child) => {
|
|
42547
42548
|
if (result2 !== PROVEN && child?._zod) {
|
|
42548
|
-
const answer6 = isRecursive(child, stack,
|
|
42549
|
+
const answer6 = isRecursive(child, stack, resolve27);
|
|
42549
42550
|
if (answer6 > result2)
|
|
42550
42551
|
result2 = answer6;
|
|
42551
42552
|
}
|
|
@@ -42556,7 +42557,7 @@ function isRecursive(inst, stack, resolve26) {
|
|
|
42556
42557
|
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
42557
42558
|
if (spread && !desc.enumerable)
|
|
42558
42559
|
continue;
|
|
42559
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
42560
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve27) : NONE;
|
|
42560
42561
|
if (child > answer6)
|
|
42561
42562
|
answer6 = child;
|
|
42562
42563
|
}
|
|
@@ -42620,7 +42621,7 @@ function isRecursive(inst, stack, resolve26) {
|
|
|
42620
42621
|
break;
|
|
42621
42622
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
42622
42623
|
case "lazy": {
|
|
42623
|
-
const inner = def._cachedInner ?? (
|
|
42624
|
+
const inner = def._cachedInner ?? (resolve27 ? inst._zod.innerType : void 0);
|
|
42624
42625
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
42625
42626
|
break;
|
|
42626
42627
|
}
|
|
@@ -59327,6 +59328,8 @@ var principalRefSchema = external_exports.discriminatedUnion("type", [
|
|
|
59327
59328
|
external_exports.object({ type: external_exports.literal("user"), id: external_exports.string() }).strict(),
|
|
59328
59329
|
external_exports.object({ type: external_exports.literal("apiKey"), id: external_exports.string() }).strict()
|
|
59329
59330
|
]);
|
|
59331
|
+
var KEY_SCOPES = ["support"];
|
|
59332
|
+
var keyScopeSchema = external_exports.enum(KEY_SCOPES);
|
|
59330
59333
|
|
|
59331
59334
|
// ../../packages/module/src/feature-names.generated.ts
|
|
59332
59335
|
var FEATURE_NAMES = [
|
|
@@ -59362,6 +59365,7 @@ var FEATURE_NAMES = [
|
|
|
59362
59365
|
"schedule",
|
|
59363
59366
|
"skill",
|
|
59364
59367
|
"slack",
|
|
59368
|
+
"support",
|
|
59365
59369
|
"vault",
|
|
59366
59370
|
"whatsapp-business",
|
|
59367
59371
|
"wiki",
|
|
@@ -60692,7 +60696,9 @@ var openVaultTurnInputSchemaDefinition = external_exports.object({
|
|
|
60692
60696
|
/** The login pool the agent draws its harness login from; only that pool's logins reach. */
|
|
60693
60697
|
loginPoolId: external_exports.string().min(1).nullable().default(null),
|
|
60694
60698
|
/** A session outside Laze, which has no agent record: how its cards name it. */
|
|
60695
|
-
label: external_exports.string().max(300).nullish()
|
|
60699
|
+
label: external_exports.string().max(300).nullish(),
|
|
60700
|
+
/** The support agent's turns: the agent_turn door refuses them, signed with the turn. */
|
|
60701
|
+
profile: external_exports.literal("support").optional()
|
|
60696
60702
|
}),
|
|
60697
60703
|
requesterUserId: external_exports.string().min(1),
|
|
60698
60704
|
requesterGroupIds: external_exports.array(external_exports.string().min(1)).default([]),
|
|
@@ -61284,7 +61290,9 @@ var vaultApprovalRequestedPayloadSchemaDefinition = external_exports.object({
|
|
|
61284
61290
|
/** Who asks when it is a session outside Laze, not an agent: "Claude Code session on pat-mac". */
|
|
61285
61291
|
agentLabel: external_exports.string().nullable().optional(),
|
|
61286
61292
|
/** Its key wants a device: Allow goes through a passkey, Touch ID or Face ID; Deny does not. */
|
|
61287
|
-
deviceApproval: external_exports.boolean().optional()
|
|
61293
|
+
deviceApproval: external_exports.boolean().optional(),
|
|
61294
|
+
/** The connector's service ("Gmail") when the key is one; what everyone may see of the ask. */
|
|
61295
|
+
service: external_exports.string().nullish()
|
|
61288
61296
|
});
|
|
61289
61297
|
var vaultApprovalResolvedPayloadSchemaDefinition = external_exports.object({
|
|
61290
61298
|
workspaceId: external_exports.string().min(1),
|
|
@@ -61966,7 +61974,9 @@ var vaultWatchReportSchemaDefinition = external_exports.object({
|
|
|
61966
61974
|
operatorChainLength: external_exports.number().int().min(0).optional(),
|
|
61967
61975
|
operatorChainHead: external_exports.string().max(128).optional(),
|
|
61968
61976
|
operatorChainProblem: external_exports.string().max(2e3).optional(),
|
|
61969
|
-
contentReconcile: vaultWatchContentReconcileSchemaDefinition.nullish().transform((value) => value ?? null)
|
|
61977
|
+
contentReconcile: vaultWatchContentReconcileSchemaDefinition.nullish().transform((value) => value ?? null),
|
|
61978
|
+
/** The same reconcile over vault-gate: the data keys of Allow and Auto secrets. */
|
|
61979
|
+
secretReconcile: vaultWatchContentReconcileSchemaDefinition.nullish().transform((value) => value ?? null)
|
|
61970
61980
|
});
|
|
61971
61981
|
var vaultWatchReportReceiptSchemaDefinition = external_exports.object({
|
|
61972
61982
|
stored: external_exports.boolean(),
|
|
@@ -62955,6 +62965,11 @@ var attentionCardSchemaDefinition = external_exports.object({
|
|
|
62955
62965
|
deviceApproval: external_exports.boolean().optional(),
|
|
62956
62966
|
/** The vault's automatic check, in one plain line, shown under the card's line. */
|
|
62957
62967
|
judgeLine: external_exports.string().max(400).nullable().default(null),
|
|
62968
|
+
/**
|
|
62969
|
+
* A vault approval as everyone sees it: who decides and, for a connector, its service. The key,
|
|
62970
|
+
* call and reason are only in the vault, which its deciders read through `attentionDetail`.
|
|
62971
|
+
*/
|
|
62972
|
+
waiting: external_exports.object({ service: external_exports.string().max(120).nullable() }).optional(),
|
|
62958
62973
|
/** People who may decide; empty means anyone in the conversation. */
|
|
62959
62974
|
deciderIds: external_exports.array(external_exports.string()),
|
|
62960
62975
|
state: attentionCardStateSchema,
|
|
@@ -63017,7 +63032,14 @@ var appCardSchemaDefinition = external_exports.object({
|
|
|
63017
63032
|
/** Records filter and sort text the app module reads the rows with. */
|
|
63018
63033
|
filter: external_exports.string().max(2e3).default(""),
|
|
63019
63034
|
sort: external_exports.string().max(200).default(""),
|
|
63020
|
-
rows: external_exports.number().int().min(1).max(10).default(5)
|
|
63035
|
+
rows: external_exports.number().int().min(1).max(10).default(5),
|
|
63036
|
+
/** On the other workspace's copy of a shared channel: the workspace that serves the app. */
|
|
63037
|
+
host: external_exports.object({ workspaceId: workspaceIdSchema, name: external_exports.string().max(200) }).nullish()
|
|
63038
|
+
});
|
|
63039
|
+
var setMirroredCardInputSchemaDefinition = external_exports.object({
|
|
63040
|
+
workspaceId: workspaceIdSchema,
|
|
63041
|
+
messageId: idSchema4,
|
|
63042
|
+
card: appCardSchemaDefinition
|
|
63021
63043
|
});
|
|
63022
63044
|
var computerCardStateSchema = external_exports.enum([
|
|
63023
63045
|
"failed",
|
|
@@ -63224,6 +63246,29 @@ var messagePinSchemaDefinition = external_exports.object({
|
|
|
63224
63246
|
at: external_exports.iso.datetime()
|
|
63225
63247
|
});
|
|
63226
63248
|
var forwardSourceKindSchema = external_exports.enum(["channel", "direct"]);
|
|
63249
|
+
var messageSystemSchemaDefinition = external_exports.discriminatedUnion("key", [
|
|
63250
|
+
external_exports.object({
|
|
63251
|
+
key: external_exports.literal("approval_waiting"),
|
|
63252
|
+
approver: external_exports.string().max(200).nullable(),
|
|
63253
|
+
service: external_exports.string().max(120).nullable()
|
|
63254
|
+
}),
|
|
63255
|
+
external_exports.object({
|
|
63256
|
+
key: external_exports.literal("approval_settled"),
|
|
63257
|
+
outcome: external_exports.enum(["allowed", "denied", "expired", "closed"]),
|
|
63258
|
+
by: external_exports.string().max(200).nullable()
|
|
63259
|
+
}),
|
|
63260
|
+
external_exports.object({
|
|
63261
|
+
key: external_exports.literal("app_updated"),
|
|
63262
|
+
app: external_exports.string().max(200),
|
|
63263
|
+
message: external_exports.string().max(4e3)
|
|
63264
|
+
}),
|
|
63265
|
+
external_exports.object({
|
|
63266
|
+
key: external_exports.literal("app_change"),
|
|
63267
|
+
change: external_exports.enum(["updated", "updated_public", "deleted"]),
|
|
63268
|
+
message: external_exports.string().max(4e3)
|
|
63269
|
+
})
|
|
63270
|
+
]);
|
|
63271
|
+
var messageSystemSchema = messageSystemSchemaDefinition;
|
|
63227
63272
|
var messageForwardSchemaDefinition = external_exports.object({
|
|
63228
63273
|
messageId: idSchema4,
|
|
63229
63274
|
channelId: idSchema4,
|
|
@@ -63277,6 +63322,8 @@ var messageSchemaDefinition = external_exports.object({
|
|
|
63277
63322
|
pin: messagePinSchemaDefinition.nullable().default(null),
|
|
63278
63323
|
/** A forward's quote of the original message, taken when it was forwarded. */
|
|
63279
63324
|
forward: messageForwardSchemaDefinition.nullable().optional(),
|
|
63325
|
+
/** A line Laze wrote, drawn in the reader's language; an unknown key reads as the body. */
|
|
63326
|
+
system: messageSystemSchemaDefinition.nullable().optional().catch(null),
|
|
63280
63327
|
/** The blocks and attachments a mirrored message's source drew; clients draw it for the body. */
|
|
63281
63328
|
layout: messageLayoutSchema.nullable().optional(),
|
|
63282
63329
|
/** Each https body image and outside author picture the page cannot load, to its Laze address. */
|
|
@@ -63348,7 +63395,11 @@ var conversationSchemaDefinition = external_exports.object({
|
|
|
63348
63395
|
*/
|
|
63349
63396
|
departed: external_exports.array(departedPersonSchemaDefinition).optional(),
|
|
63350
63397
|
/** A conversation with an agent that closed: readable, no new messages. Absent while open. */
|
|
63351
|
-
closed: conversationClosedSchema.nullable().optional()
|
|
63398
|
+
closed: conversationClosedSchema.nullable().optional(),
|
|
63399
|
+
/** The workspace's Laze Support channel: pinned last, no threads, never left. Else absent. */
|
|
63400
|
+
support: external_exports.boolean().optional(),
|
|
63401
|
+
/** The staff workspace's Laze Support triage: one thread per workspace. Else absent. */
|
|
63402
|
+
supportTriage: external_exports.boolean().optional()
|
|
63352
63403
|
});
|
|
63353
63404
|
var conversationSchema = conversationSchemaDefinition;
|
|
63354
63405
|
var reachableConversationSchemaDefinition = external_exports.object({
|
|
@@ -63689,6 +63740,8 @@ var postMessageInputSchemaDefinition = external_exports.object({
|
|
|
63689
63740
|
attachmentIds: external_exports.array(idSchema4).max(10).default([]),
|
|
63690
63741
|
/** The feed cards an agent's reply links; chat keeps them only when an agent posts. */
|
|
63691
63742
|
feedRefs: external_exports.array(messageFeedRefSchemaDefinition).max(MESSAGE_FEED_REFS_MAX).optional(),
|
|
63743
|
+
/** A line Laze writes for an agent, drawn in each reader's language; kept only from agents. */
|
|
63744
|
+
system: messageSystemSchemaDefinition.optional(),
|
|
63692
63745
|
/** The sender's own key for this post: sending it again answers the message stored first. */
|
|
63693
63746
|
clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
|
|
63694
63747
|
}).refine((input2) => input2.body.trim().length > 0 || input2.attachmentIds.length > 0, {
|
|
@@ -63773,7 +63826,9 @@ var postMirroredInputSchemaDefinition = external_exports.object({
|
|
|
63773
63826
|
/** A notice is a one-line change at the source, such as a new topic; it mentions no one. */
|
|
63774
63827
|
kind: external_exports.enum(["message", "notice"]).default("message"),
|
|
63775
63828
|
/** Files the mirror stored in this workspace's files, attached to the message. */
|
|
63776
|
-
fileIds: external_exports.array(idSchema4).max(10).default([])
|
|
63829
|
+
fileIds: external_exports.array(idSchema4).max(10).default([]),
|
|
63830
|
+
/** The source's line Laze wrote, drawn in each reader's language here too. */
|
|
63831
|
+
system: messageSystemSchemaDefinition.nullable().default(null)
|
|
63777
63832
|
});
|
|
63778
63833
|
var postMirroredInputSchema = postMirroredInputSchemaDefinition;
|
|
63779
63834
|
var MIRROR_BATCH_MAX = 500;
|
|
@@ -63796,6 +63851,8 @@ var updateMirroredInputSchemaDefinition = external_exports.object({
|
|
|
63796
63851
|
/** The Laze person the mirror acts for: the linked author, else whoever mirrored it. */
|
|
63797
63852
|
keyOwnerUserId: idSchema4,
|
|
63798
63853
|
body: external_exports.string().max(MESSAGE_BODY_MAX).optional(),
|
|
63854
|
+
/** The source's system line now, drawn in the reader's language; left out keeps it. */
|
|
63855
|
+
system: messageSystemSchemaDefinition.nullable().optional(),
|
|
63799
63856
|
/** The source's blocks and attachments now; null drops them; left out keeps them. */
|
|
63800
63857
|
layout: messageLayoutSchema.nullable().optional(),
|
|
63801
63858
|
deleted: external_exports.boolean().default(false),
|
|
@@ -63841,6 +63898,12 @@ var setMirrorAgentPolicyInputSchemaDefinition = external_exports.object({
|
|
|
63841
63898
|
mirrorKey: external_exports.string().min(1).max(200),
|
|
63842
63899
|
allowed: external_exports.boolean()
|
|
63843
63900
|
});
|
|
63901
|
+
var admitMirrorAgentInputSchemaDefinition = external_exports.object({
|
|
63902
|
+
workspaceId: workspaceIdSchema,
|
|
63903
|
+
mirrorKey: external_exports.string().min(1).max(200),
|
|
63904
|
+
agentId: idSchema4,
|
|
63905
|
+
agentName: external_exports.string().trim().min(1).max(80)
|
|
63906
|
+
});
|
|
63844
63907
|
var syncMirrorPeopleInputSchemaDefinition = external_exports.object({
|
|
63845
63908
|
workspaceId: workspaceIdSchema,
|
|
63846
63909
|
mirrorKey: external_exports.string().min(1).max(200),
|
|
@@ -63899,6 +63962,8 @@ var postCardInputSchemaDefinition = external_exports.object({
|
|
|
63899
63962
|
card: messageCardSchemaDefinition,
|
|
63900
63963
|
/** The person whose own action posts the card: it never notifies them or reads unread to them. */
|
|
63901
63964
|
promptedBy: idSchema4.optional(),
|
|
63965
|
+
/** The body as a line Laze wrote, drawn in each reader's language. */
|
|
63966
|
+
system: messageSystemSchemaDefinition.optional(),
|
|
63902
63967
|
/** One card per key: a second post with it answers the first. */
|
|
63903
63968
|
clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
|
|
63904
63969
|
});
|
|
@@ -63907,7 +63972,9 @@ var updateCardInputSchemaDefinition = external_exports.object({
|
|
|
63907
63972
|
messageId: idSchema4,
|
|
63908
63973
|
card: messageCardSchemaDefinition,
|
|
63909
63974
|
/** New plain text for previews, search and notifications; left out, the text stays. */
|
|
63910
|
-
body: external_exports.string().min(1).max(4e3).optional()
|
|
63975
|
+
body: external_exports.string().min(1).max(4e3).optional(),
|
|
63976
|
+
/** The line clients draw for the new text in the reader's language; null drops it. */
|
|
63977
|
+
system: messageSystemSchemaDefinition.nullable().optional()
|
|
63911
63978
|
});
|
|
63912
63979
|
var agentActivityStateSchema = external_exports.enum([
|
|
63913
63980
|
"thinking",
|
|
@@ -64625,7 +64692,9 @@ var apnsPayloadSchemaDefinition = external_exports.object({
|
|
|
64625
64692
|
/** A read or retraction push: the person's Notifications total, as alert pushes carry it. */
|
|
64626
64693
|
badge: external_exports.number().int().nonnegative().optional(),
|
|
64627
64694
|
/** Who a message alert is from, for a communication notification with their picture. */
|
|
64628
|
-
sender: apnsSenderSchemaDefinition.optional()
|
|
64695
|
+
sender: apnsSenderSchemaDefinition.optional(),
|
|
64696
|
+
/** The channel a message alert is in ("#ops"): the app shows it as a group conversation. */
|
|
64697
|
+
conversationName: external_exports.string().min(2).max(120).optional()
|
|
64629
64698
|
}).strict();
|
|
64630
64699
|
|
|
64631
64700
|
// ../../modules/notification/contract/src/web-push.ts
|
|
@@ -65346,6 +65415,8 @@ var messagePostedPayloadSchemaDefinition = external_exports.object({
|
|
|
65346
65415
|
/** Facts recorded before notices existed carry no kind: they are messages. */
|
|
65347
65416
|
kind: messageKindSchema.default("message"),
|
|
65348
65417
|
body: external_exports.string(),
|
|
65418
|
+
/** A line Laze wrote, for copies that draw it in their readers' language. */
|
|
65419
|
+
system: messageSystemSchema.nullable().optional(),
|
|
65349
65420
|
mentions: external_exports.array(mentionSchema),
|
|
65350
65421
|
attachmentIds: external_exports.array(external_exports.string()),
|
|
65351
65422
|
createdAt: external_exports.iso.datetime(),
|
|
@@ -65574,6 +65645,7 @@ var ChatStatusDialogSlot = chatUi.component("status-dialog");
|
|
|
65574
65645
|
var ChatExternalPersonCardSlot = chatUi.extension("external-person-card");
|
|
65575
65646
|
var ChatNewChannelDialogSlot = chatUi.component("new-channel-dialog");
|
|
65576
65647
|
var ChatPeoplePickerSlot = chatUi.component("people-picker");
|
|
65648
|
+
var ChatActorFaceSlot = chatUi.component("actor-face");
|
|
65577
65649
|
var ChatAddPeopleDialogSlot = chatUi.component("add-people-dialog");
|
|
65578
65650
|
var ChatHandoffComposerSlot = chatUi.component("handoff-composer");
|
|
65579
65651
|
var ChatConversationsWithSlot = chatUi.component("conversations-with");
|
|
@@ -66050,6 +66122,8 @@ var sessionImportSchemaDefinition = external_exports.object({
|
|
|
66050
66122
|
fileName: external_exports.string().regex(/^[A-Za-z0-9._-]{1,200}\.jsonl$/).optional()
|
|
66051
66123
|
});
|
|
66052
66124
|
var sessionImportSchema = sessionImportSchemaDefinition;
|
|
66125
|
+
var launchProfileSchema = external_exports.enum(["standard", "locked"]);
|
|
66126
|
+
var sandboxProfileSchema = external_exports.enum(["standard", "support"]);
|
|
66053
66127
|
var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
66054
66128
|
workspaceId: external_exports.string().min(1),
|
|
66055
66129
|
agentId: external_exports.string().regex(/^[a-zA-Z0-9_-]+$/),
|
|
@@ -66070,7 +66144,12 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
|
66070
66144
|
/** Files the supervisor writes under the home folder at every start, by relative path. */
|
|
66071
66145
|
homeFiles: external_exports.record(external_exports.string(), external_exports.string()).default({}),
|
|
66072
66146
|
/** The agent's own Laze key: the host adds it to the CLI's calls, it never enters the sandbox. */
|
|
66073
|
-
lazeApi: external_exports.object({
|
|
66147
|
+
lazeApi: external_exports.object({
|
|
66148
|
+
key: external_exports.string().min(1),
|
|
66149
|
+
agentName: external_exports.string().min(1),
|
|
66150
|
+
/** The key's scope: `support` forwards only paths under `SUPPORT_SCOPE_PATH_PREFIX`. */
|
|
66151
|
+
scope: external_exports.enum(["support"]).optional()
|
|
66152
|
+
}).optional(),
|
|
66074
66153
|
/** The agent's DM with its owner: the main stream its one session runs in. */
|
|
66075
66154
|
mainChannelId: external_exports.string().regex(/^[a-zA-Z0-9_-]+$/).optional(),
|
|
66076
66155
|
/** Where the harness runs: a Laze computer when absent, else the owner's own machine. */
|
|
@@ -66082,7 +66161,9 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
|
|
|
66082
66161
|
/** A migrated agent's imported session, used when its main session first starts. */
|
|
66083
66162
|
sessionImport: sessionImportSchemaDefinition.optional(),
|
|
66084
66163
|
/** The agent's turns go to LangWatch: the harness exports OpenTelemetry at this level. */
|
|
66085
|
-
telemetry: external_exports.object({ content: external_exports.enum(["full", "metadata"]) }).optional()
|
|
66164
|
+
telemetry: external_exports.object({ content: external_exports.enum(["full", "metadata"]) }).optional(),
|
|
66165
|
+
/** The agent's profile; absent reads as `standard`. */
|
|
66166
|
+
profile: sandboxProfileSchema.optional()
|
|
66086
66167
|
});
|
|
66087
66168
|
var deliveredFileSchemaDefinition = external_exports.object({
|
|
66088
66169
|
/** Relative to the agent's work folder, e.g. `attachments/<messageId>/report.pdf`. */
|
|
@@ -66182,7 +66263,9 @@ var computerAgentUseSchemaDefinition = external_exports.object({
|
|
|
66182
66263
|
state: external_exports.enum(["working", "idle", "asleep"]),
|
|
66183
66264
|
/** CPUs busy over the last sample, 1 = one vCPU fully busy. */
|
|
66184
66265
|
cpuBusy: external_exports.number().nonnegative(),
|
|
66185
|
-
memoryMb: external_exports.number().nonnegative()
|
|
66266
|
+
memoryMb: external_exports.number().nonnegative(),
|
|
66267
|
+
/** Since when the agent has had no turn; absent while it works or from an older daemon. */
|
|
66268
|
+
idleSince: external_exports.iso.datetime().optional()
|
|
66186
66269
|
});
|
|
66187
66270
|
var computerMemoryStopSchemaDefinition = external_exports.object({
|
|
66188
66271
|
agentId: external_exports.string().min(1),
|
|
@@ -66227,7 +66310,10 @@ var computerUseSchemaDefinition = external_exports.object({
|
|
|
66227
66310
|
memoryStops: external_exports.array(computerMemoryStopSchemaDefinition).max(20),
|
|
66228
66311
|
/** Newest last; a daemon from an older release sends none. */
|
|
66229
66312
|
diskEvents: external_exports.array(computerDiskEventSchemaDefinition).max(20).default([]),
|
|
66230
|
-
resize: computerResizeSchemaDefinition.nullable().default(null)
|
|
66313
|
+
resize: computerResizeSchemaDefinition.nullable().default(null),
|
|
66314
|
+
/** Until when a browser tab or the WhatsApp job keeps it awake; null for neither, absent from
|
|
66315
|
+
* an older daemon. */
|
|
66316
|
+
heldUntil: external_exports.iso.datetime().nullable().optional()
|
|
66231
66317
|
});
|
|
66232
66318
|
var computerUseSchema = computerUseSchemaDefinition;
|
|
66233
66319
|
var computerRefSchemaDefinition = external_exports.object({
|
|
@@ -66297,6 +66383,8 @@ var supervisorLaunchSchemaDefinition = external_exports.object({
|
|
|
66297
66383
|
sessionImport: sessionImportSchema.optional(),
|
|
66298
66384
|
/** Claude Code exports OpenTelemetry to the supervisor's loopback API at this content level. */
|
|
66299
66385
|
telemetry: external_exports.object({ content: external_exports.enum(["full", "metadata"]) }).optional(),
|
|
66386
|
+
/** `locked`: managed settings and flags strip the harness's tools; turns are capped. */
|
|
66387
|
+
profile: launchProfileSchema.optional(),
|
|
66300
66388
|
/** Set by the connector on a person's own machine: ports, paths and the local token. */
|
|
66301
66389
|
machine: supervisorMachineSchemaDefinition.optional(),
|
|
66302
66390
|
/** On a machine, by relay connection id: the placeholder a local caller must present. */
|
|
@@ -66740,7 +66828,12 @@ var capacityNumbersDefinition = external_exports.object({
|
|
|
66740
66828
|
awakeMemoryMb: external_exports.number(),
|
|
66741
66829
|
awakeMemoryLimitMb: external_exports.number(),
|
|
66742
66830
|
placedDiskGb: external_exports.number(),
|
|
66743
|
-
diskLimitGb: external_exports.number()
|
|
66831
|
+
diskLimitGb: external_exports.number(),
|
|
66832
|
+
/** Physical disk and memory, and what is really used, over hosts with a report; absent before. */
|
|
66833
|
+
realDiskGb: external_exports.number().optional(),
|
|
66834
|
+
realDiskUsedGb: external_exports.number().optional(),
|
|
66835
|
+
realMemoryMb: external_exports.number().optional(),
|
|
66836
|
+
realMemoryUsedMb: external_exports.number().optional()
|
|
66744
66837
|
});
|
|
66745
66838
|
var capacityNumbersSchema = capacityNumbersDefinition;
|
|
66746
66839
|
var computerPoolFactDefinition = external_exports.discriminatedUnion("kind", [
|
|
@@ -67176,6 +67269,18 @@ function cleanResolutionNote2(text3) {
|
|
|
67176
67269
|
return text3.replace(/[\r\n\u2028\u2029]+/g, " ").replace(/[\p{Cc}\p{Cf}]/gu, "").trim();
|
|
67177
67270
|
}
|
|
67178
67271
|
var resolutionNoteSchema2 = external_exports.string().max(4e3).default("").transform(cleanResolutionNote2);
|
|
67272
|
+
var attentionDetailInputSchemaDefinition = external_exports.object({
|
|
67273
|
+
workspaceId: workspaceIdSchema3,
|
|
67274
|
+
attentionId: idSchema6
|
|
67275
|
+
});
|
|
67276
|
+
var attentionDetailInputSchema = attentionDetailInputSchemaDefinition;
|
|
67277
|
+
var attentionDetailSchemaDefinition = external_exports.object({
|
|
67278
|
+
line: external_exports.string(),
|
|
67279
|
+
call: external_exports.string(),
|
|
67280
|
+
detail: external_exports.string(),
|
|
67281
|
+
judgeLine: external_exports.string().nullable()
|
|
67282
|
+
});
|
|
67283
|
+
var attentionDetailSchema = attentionDetailSchemaDefinition;
|
|
67179
67284
|
var answerAttentionInputSchemaDefinition = external_exports.object({
|
|
67180
67285
|
workspaceId: workspaceIdSchema3,
|
|
67181
67286
|
attentionId: idSchema6,
|
|
@@ -69457,6 +69562,7 @@ var agentSessionSchemaDefinition = external_exports.object({
|
|
|
69457
69562
|
boundAt: external_exports.iso.datetime()
|
|
69458
69563
|
});
|
|
69459
69564
|
var agentModelLevelSchema = external_exports.enum(["frontier", "fast"]);
|
|
69565
|
+
var agentProfileSchema = external_exports.enum(["standard", "support"]);
|
|
69460
69566
|
var harnessLoginSchema = external_exports.enum(["claude-code", "codex"]);
|
|
69461
69567
|
var agentHostingSchema = external_exports.enum(["connected", "laze"]);
|
|
69462
69568
|
var agentCompactionSchemaDefinition = external_exports.object({
|
|
@@ -69548,7 +69654,9 @@ var agentSchemaDefinition = external_exports.object({
|
|
|
69548
69654
|
/** The session a connected agent listens in; null until its CLI first names one. */
|
|
69549
69655
|
session: agentSessionSchemaDefinition.nullable().optional(),
|
|
69550
69656
|
/** How the background setup after creating it went. */
|
|
69551
|
-
setup: agentSetupStateSchema.optional()
|
|
69657
|
+
setup: agentSetupStateSchema.optional(),
|
|
69658
|
+
/** `support` for the locked Laze Support agent; absent reads as `standard`. */
|
|
69659
|
+
profile: agentProfileSchema.optional()
|
|
69552
69660
|
});
|
|
69553
69661
|
var agentSchema = agentSchemaDefinition;
|
|
69554
69662
|
var agentChannelSchemaDefinition = external_exports.object({
|
|
@@ -69580,6 +69688,11 @@ var createAgentInputSchemaDefinition = external_exports.object({
|
|
|
69580
69688
|
loginPoolId: external_exports.string().min(1).max(200).optional()
|
|
69581
69689
|
});
|
|
69582
69690
|
var createAgentInputSchema = createAgentInputSchemaDefinition;
|
|
69691
|
+
var createSupportAgentInputSchemaDefinition = external_exports.object({
|
|
69692
|
+
workspaceId: workspaceIdSchema14,
|
|
69693
|
+
name: agentNameSchema,
|
|
69694
|
+
instructions: instructionsSchema
|
|
69695
|
+
});
|
|
69583
69696
|
var updateAgentInputSchemaDefinition = external_exports.object({
|
|
69584
69697
|
workspaceId: workspaceIdSchema14,
|
|
69585
69698
|
agentId: idSchema17,
|
|
@@ -69981,7 +70094,7 @@ var agentsCopy = {
|
|
|
69981
70094
|
storable: agentsForDisk
|
|
69982
70095
|
};
|
|
69983
70096
|
var agentCoreTrpc = defineTrpcContract("agents").query("list", { mirrored: agentsCopy }).withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema17 })).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: workspaceIdSchema14 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema17 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema17 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(external_exports.object({ limitUsd: external_exports.number() })).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema17 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).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: workspaceIdSchema14 })).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: workspaceIdSchema14, agentId: idSchema17 })).withOutput(external_exports.object({ channelId: idSchema17 })).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: workspaceIdSchema14, agentId: idSchema17 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema17 })).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();
|
|
69984
|
-
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("retryState").withInput(retryAgentTurnInputSchema).withOutput(agentRetryStateSchema).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("catchUp").withInput(startCatchUpInputSchema).withOutput(catchUpRunSchema).mutation("catchUpAsk").withInput(askCatchUpInputSchema).withOutput(catchUpRunSchema).query("catchUpRun").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("catchUpStop").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
|
|
70097
|
+
var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).query("attentionDetail").withInput(attentionDetailInputSchema).withOutput(attentionDetailSchema).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("retryState").withInput(retryAgentTurnInputSchema).withOutput(agentRetryStateSchema).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("catchUp").withInput(startCatchUpInputSchema).withOutput(catchUpRunSchema).mutation("catchUpAsk").withInput(askCatchUpInputSchema).withOutput(catchUpRunSchema).query("catchUpRun").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("catchUpStop").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
|
|
69985
70098
|
var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema17 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema17, channelId: idSchema17 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).mutation("useLazeModelsUntilReset").withInput(useLazeModelsUntilResetInputSchema).withOutput(lazeModelsUntilResetSchema).build();
|
|
69986
70099
|
var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
|
|
69987
70100
|
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();
|
|
@@ -70705,6 +70818,187 @@ var callerWorkspaceDeletionSchemaDefinition = external_exports.object({
|
|
|
70705
70818
|
deletesAt: external_exports.iso.datetime().nullable()
|
|
70706
70819
|
});
|
|
70707
70820
|
|
|
70821
|
+
// ../../modules/agent/contract/src/agent-mcp-tools.ts
|
|
70822
|
+
var AGENT_MCP_TOOLS = [
|
|
70823
|
+
{ name: "whoami", operationId: "agentWhoAmI", readOnly: true },
|
|
70824
|
+
{ name: "list_channels", operationId: "agentChannels", readOnly: true },
|
|
70825
|
+
{
|
|
70826
|
+
name: "read_inbox",
|
|
70827
|
+
operationId: "agentReceiveInbox",
|
|
70828
|
+
description: "Take the messages addressed to you (mentions, direct messages, your threads), each once.",
|
|
70829
|
+
pinned: { waitSeconds: 0 }
|
|
70830
|
+
},
|
|
70831
|
+
{
|
|
70832
|
+
name: "wait_for_messages",
|
|
70833
|
+
operationId: "agentReceiveInbox",
|
|
70834
|
+
description: "Wait for the next messages addressed to you and take them, like read_inbox. Answers as soon as one arrives, or an empty list after waitSeconds (50 unless set, at most 55). Call it again instead of ending your turn while you expect someone to answer.",
|
|
70835
|
+
defaults: { waitSeconds: 50 }
|
|
70836
|
+
},
|
|
70837
|
+
{
|
|
70838
|
+
name: "post_message",
|
|
70839
|
+
operationId: "agentPostMessage",
|
|
70840
|
+
description: "Post to a channel or direct message by id or name, in the main conversation. Set threadRootId only to answer inside an existing thread."
|
|
70841
|
+
},
|
|
70842
|
+
{ name: "start_conversation", operationId: "agentStartConversation" },
|
|
70843
|
+
{ name: "list_conversations", operationId: "agentListConversations", readOnly: true },
|
|
70844
|
+
{ name: "rename_conversation", operationId: "agentRenameConversation" },
|
|
70845
|
+
{ name: "join_conversation", operationId: "agentJoinConversation" },
|
|
70846
|
+
{ name: "leave_conversation", operationId: "agentLeaveConversation" },
|
|
70847
|
+
{ name: "delete_conversation", operationId: "agentDeleteConversation" },
|
|
70848
|
+
{ name: "close_conversation", operationId: "agentCloseConversation" },
|
|
70849
|
+
{ name: "reopen_conversation", operationId: "agentReopenConversation" },
|
|
70850
|
+
{ name: "convert_conversation", operationId: "agentConvertConversation" },
|
|
70851
|
+
{
|
|
70852
|
+
name: "reply",
|
|
70853
|
+
operationId: "agentReply",
|
|
70854
|
+
description: "Answer a message where it was said, like a person typing in the same place: in the main channel or direct message, or in its thread when the message is already in a thread. Set thread: true only when you want to start a new thread under it."
|
|
70855
|
+
},
|
|
70856
|
+
{ name: "set_channel_level", operationId: "agentSetChannelLevel" },
|
|
70857
|
+
{ name: "mute_channel", operationId: "agentMuteChannel" },
|
|
70858
|
+
{ name: "unmute_channel", operationId: "agentUnmuteChannel" },
|
|
70859
|
+
{ name: "update_agent", operationId: "agentUpdateAsCaller" },
|
|
70860
|
+
{ name: "migrate_agent", operationId: "agentMigrateAsCaller" },
|
|
70861
|
+
{
|
|
70862
|
+
name: "list_permission_prompts",
|
|
70863
|
+
operationId: "agentPermissionPromptsAsCaller",
|
|
70864
|
+
readOnly: true
|
|
70865
|
+
},
|
|
70866
|
+
{ name: "search_messages", operationId: "agentSearch", readOnly: true },
|
|
70867
|
+
{ name: "read_history", operationId: "agentHistory", readOnly: true },
|
|
70868
|
+
{ name: "list_channel_members", operationId: "agentChannelMembers", readOnly: true },
|
|
70869
|
+
{ name: "set_channel_role", operationId: "agentSetChannelRole" },
|
|
70870
|
+
{ name: "create_channel", operationId: "agentCreateChannel" },
|
|
70871
|
+
{ name: "browse_channels", operationId: "agentBrowseChannels", readOnly: true },
|
|
70872
|
+
{ name: "join_channel", operationId: "agentJoinChannel" },
|
|
70873
|
+
{ name: "leave_channel", operationId: "agentLeaveChannel" },
|
|
70874
|
+
{ name: "update_channel", operationId: "agentUpdateChannel" },
|
|
70875
|
+
{
|
|
70876
|
+
name: "add_channel_members",
|
|
70877
|
+
operationId: "agentAddChannelMembers",
|
|
70878
|
+
description: "Add people and agents to a channel you are in, by name or id."
|
|
70879
|
+
},
|
|
70880
|
+
{
|
|
70881
|
+
name: "open_direct_message",
|
|
70882
|
+
operationId: "agentOpenDirect",
|
|
70883
|
+
description: "Open a direct message with one person (or a group with several), by name or id."
|
|
70884
|
+
},
|
|
70885
|
+
{
|
|
70886
|
+
name: "invite_person",
|
|
70887
|
+
operationId: "agentWorkspaceInvite",
|
|
70888
|
+
description: "Invite someone to the workspace by email, sent in your owner's name."
|
|
70889
|
+
},
|
|
70890
|
+
{
|
|
70891
|
+
name: "invite_quote",
|
|
70892
|
+
operationId: "billingInviteQuote",
|
|
70893
|
+
readOnly: true,
|
|
70894
|
+
description: "The workspace's new monthly price if `adding` more people join. Free holds 2 people at no charge (freeInvitesLeft); past that upgradeNeeded is true and Team is needed. Show it to your person before invite_people."
|
|
70895
|
+
},
|
|
70896
|
+
{
|
|
70897
|
+
name: "invite_people",
|
|
70898
|
+
operationId: "agentWorkspaceInviteMany",
|
|
70899
|
+
description: "Invite several people by email, landing them in a conversation (`to`). Call invite_quote first, show the price, and pass confirmed: true only after your person says yes. Free holds 2 people; invitations past that are saved and wait until an Owner or Admin upgrades to Team, and planRequired says so: pass it on to your person."
|
|
70900
|
+
},
|
|
70901
|
+
{
|
|
70902
|
+
name: "request_invites",
|
|
70903
|
+
operationId: "agentWorkspaceRequestInvites",
|
|
70904
|
+
description: "Ask the workspace admins to invite several people, when you or your person may not invite. Admins get a card in their feed."
|
|
70905
|
+
},
|
|
70906
|
+
{
|
|
70907
|
+
name: "invite_agent",
|
|
70908
|
+
operationId: "agentMintLinkAsCaller",
|
|
70909
|
+
description: "Make a one-time link another agent uses to join this workspace. The name is optional: the joining agent can pick its own."
|
|
70910
|
+
},
|
|
70911
|
+
{ name: "extend_channel", operationId: "agentExtendChannel" },
|
|
70912
|
+
{ name: "star_conversation", operationId: "agentChatStar" },
|
|
70913
|
+
{ name: "list_starred", operationId: "agentChatStarred", readOnly: true },
|
|
70914
|
+
{ name: "list_activity", operationId: "agentListActivity", readOnly: true },
|
|
70915
|
+
{ name: "mark_activity_read", operationId: "agentMarkActivityRead" },
|
|
70916
|
+
{ name: "schedule_message", operationId: "agentScheduleMessage" },
|
|
70917
|
+
{ name: "list_scheduled", operationId: "agentListScheduled", readOnly: true },
|
|
70918
|
+
{ name: "edit_scheduled", operationId: "agentEditScheduled" },
|
|
70919
|
+
{ name: "send_scheduled_now", operationId: "agentSendScheduledNow" },
|
|
70920
|
+
{ name: "cancel_scheduled", operationId: "agentCancelScheduled" },
|
|
70921
|
+
{
|
|
70922
|
+
name: "post_feed_item",
|
|
70923
|
+
operationId: "feedPost",
|
|
70924
|
+
description: 'Put a card in front of people. Write for a person on a phone: a short title with the ask first, one plain summary sentence of why, no body (text to send goes in draft, sources in links: a mail as label "Open in Gmail" with url https://mail.google.com/mail/u/0/#all/<thread id>). Anything for people outside the conversation (an email, a Slack, WhatsApp or LinkedIn message to someone else, a post) is a draft for your person first, on a card: the full text in draft, recipients and subject in draftHeader ("To: ...\\nCc: ...\\nSubject: ..."), a "Send it" action and a link that opens the original in its own app (a Gmail reply as label "Open thread with the draft" with url https://mail.google.com/mail/u/0/#all/<thread id>; else the Slack, WhatsApp or LinkedIn thread or the GitHub PR); send it only when they pressed Send or told you in chat to send that exact message, and never leave it only in Gmail drafts. No ids, UTC times, PR lists or day counters. Text that reads like a log is refused with feed_hard_to_read, a card that points at a draft without its text with feed_draft_missing; set force to post it as written.'
|
|
70925
|
+
},
|
|
70926
|
+
{
|
|
70927
|
+
name: "reply_feed_item",
|
|
70928
|
+
operationId: "feedReply",
|
|
70929
|
+
description: "Answer on a feed card in short plain sentences, no ids or UTC times. Text that reads like a log is refused with feed_hard_to_read; set force to post it as written."
|
|
70930
|
+
},
|
|
70931
|
+
{ name: "read_feed_inbox", operationId: "feedInbox", readOnly: true },
|
|
70932
|
+
{ name: "list_apps", operationId: "appList", readOnly: true },
|
|
70933
|
+
{ name: "get_app", operationId: "appGet", readOnly: true },
|
|
70934
|
+
{
|
|
70935
|
+
name: "create_app",
|
|
70936
|
+
operationId: "appCreate",
|
|
70937
|
+
description: "Create a Laze app (a static site with a live record store), restricted to the workspace unless you choose a visibility. A new app is empty: design it from scratch and call push_app_files with its files. Only for slides or a deck, set template: slides, whose files become the first live version, yours to change."
|
|
70938
|
+
},
|
|
70939
|
+
{
|
|
70940
|
+
name: "list_app_templates",
|
|
70941
|
+
operationId: "appTemplates",
|
|
70942
|
+
readOnly: true,
|
|
70943
|
+
description: "The templates an app can start from, each with its version and description. Slides, for a deck, is the only one."
|
|
70944
|
+
},
|
|
70945
|
+
{
|
|
70946
|
+
name: "push_app_files",
|
|
70947
|
+
operationId: "appCommit",
|
|
70948
|
+
description: "Upload the app's whole build as its new live version: every file as { path, content }, text as utf8 or binary with encoding base64, index.html at the root. Files left out are gone from this version, so send them all (pull_app_files gives the current ones). Up to 10 MB."
|
|
70949
|
+
},
|
|
70950
|
+
{ name: "pull_app_files", operationId: "appPull", readOnly: true },
|
|
70951
|
+
{
|
|
70952
|
+
name: "write_app_files",
|
|
70953
|
+
operationId: "appWriteFiles",
|
|
70954
|
+
description: "Write or remove some files of an app as a new live version; every other file stays. The message says what changed in plain words."
|
|
70955
|
+
},
|
|
70956
|
+
{ name: "app_url", operationId: "appPreview", readOnly: true },
|
|
70957
|
+
{ name: "app_versions", operationId: "appVersions", readOnly: true },
|
|
70958
|
+
{ name: "revert_app", operationId: "appRevert" },
|
|
70959
|
+
{ name: "publish_app", operationId: "appPublish" },
|
|
70960
|
+
{ name: "unpublish_app", operationId: "appUnpublish" },
|
|
70961
|
+
{ name: "share_app", operationId: "appGrantAccess" },
|
|
70962
|
+
{ name: "set_app_visibility", operationId: "appSetVisibility" },
|
|
70963
|
+
{ name: "list_app_pins", operationId: "appPins", readOnly: true },
|
|
70964
|
+
{
|
|
70965
|
+
name: "pin_app",
|
|
70966
|
+
operationId: "appPin",
|
|
70967
|
+
description: "Pin an app in a channel or direct message, where its members open it."
|
|
70968
|
+
},
|
|
70969
|
+
{ name: "unpin_app", operationId: "appUnpin" },
|
|
70970
|
+
{ name: "list_app_collections", operationId: "appCollections", readOnly: true },
|
|
70971
|
+
{ name: "define_app_collection", operationId: "appDefineCollection" },
|
|
70972
|
+
{ name: "list_app_records", operationId: "appRecords", readOnly: true },
|
|
70973
|
+
{ name: "write_app_record", operationId: "appWriteRecord" },
|
|
70974
|
+
{ name: "delete_app_record", operationId: "appDeleteRecord" },
|
|
70975
|
+
{ name: "app_logs", operationId: "appFunctionLogs", readOnly: true },
|
|
70976
|
+
{ name: "list_wiki_pages", operationId: "wikiList", readOnly: true },
|
|
70977
|
+
{ name: "get_wiki_page", operationId: "wikiGet", readOnly: true },
|
|
70978
|
+
{ name: "put_wiki_page", operationId: "wikiPut" },
|
|
70979
|
+
{ name: "search_wiki", operationId: "wikiSearch", readOnly: true },
|
|
70980
|
+
{ name: "get_memory", operationId: "memoryGet", readOnly: true },
|
|
70981
|
+
{ name: "set_memory", operationId: "memorySet" },
|
|
70982
|
+
{ name: "append_memory", operationId: "memoryAppend" },
|
|
70983
|
+
{ name: "search_memory", operationId: "memorySearch", readOnly: true },
|
|
70984
|
+
{
|
|
70985
|
+
name: "support_read_thread",
|
|
70986
|
+
operationId: "supportAgentThread",
|
|
70987
|
+
readOnly: true,
|
|
70988
|
+
description: "Laze Support only: read the support thread your turn names, as plain text."
|
|
70989
|
+
},
|
|
70990
|
+
{
|
|
70991
|
+
name: "support_answer",
|
|
70992
|
+
operationId: "supportAgentAnswer",
|
|
70993
|
+
description: "Laze Support only: answer in your turn's support thread; it reaches the customer."
|
|
70994
|
+
},
|
|
70995
|
+
{
|
|
70996
|
+
name: "support_needs_human",
|
|
70997
|
+
operationId: "supportAgentNeedsHuman",
|
|
70998
|
+
description: "Laze Support only: hand your turn's support thread to the Laze team."
|
|
70999
|
+
}
|
|
71000
|
+
];
|
|
71001
|
+
|
|
70708
71002
|
// ../../modules/agent/contract/src/agent-mcp-events.ts
|
|
70709
71003
|
var agentMcpEventFiledPayloadSchemaDefinition = external_exports.object({
|
|
70710
71004
|
workspaceId: external_exports.string().min(1),
|
|
@@ -74705,20 +74999,20 @@ function headerOf(headers, name3) {
|
|
|
74705
74999
|
return found?.[1];
|
|
74706
75000
|
}
|
|
74707
75001
|
async function callTool({
|
|
74708
|
-
rpc,
|
|
75002
|
+
rpc: rpc2,
|
|
74709
75003
|
target,
|
|
74710
75004
|
authorization
|
|
74711
75005
|
}) {
|
|
74712
|
-
const params =
|
|
75006
|
+
const params = rpc2.params ?? {};
|
|
74713
75007
|
const name3 = typeof params.name === "string" ? params.name : "";
|
|
74714
75008
|
const run4 = Object.hasOwn(RUNS, name3) ? RUNS[name3] : void 0;
|
|
74715
|
-
if (!run4) return error62(
|
|
75009
|
+
if (!run4) return error62(rpc2.id, -32602, `Unknown tool: ${name3 || "(none)"}`);
|
|
74716
75010
|
const raw = params.arguments ?? {};
|
|
74717
75011
|
const args = typeof raw === "object" && raw !== null && !Array.isArray(raw) ? raw : {};
|
|
74718
75012
|
try {
|
|
74719
|
-
return result(
|
|
75013
|
+
return result(rpc2.id, await run4({ args, target, authorization }));
|
|
74720
75014
|
} catch (failure2) {
|
|
74721
|
-
if (failure2 instanceof BadArguments) return result(
|
|
75015
|
+
if (failure2 instanceof BadArguments) return result(rpc2.id, text2(failure2.message, true));
|
|
74722
75016
|
throw failure2;
|
|
74723
75017
|
}
|
|
74724
75018
|
}
|
|
@@ -74726,32 +75020,32 @@ async function answerKanbanMcp({
|
|
|
74726
75020
|
target,
|
|
74727
75021
|
exchange
|
|
74728
75022
|
}) {
|
|
74729
|
-
const
|
|
74730
|
-
if (!
|
|
75023
|
+
const rpc2 = rpcOf(exchange.body);
|
|
75024
|
+
if (!rpc2) {
|
|
74731
75025
|
return answer(400, {
|
|
74732
75026
|
jsonrpc: "2.0",
|
|
74733
75027
|
id: null,
|
|
74734
75028
|
error: { code: -32600, message: "Not a JSON-RPC 2.0 message" }
|
|
74735
75029
|
});
|
|
74736
75030
|
}
|
|
74737
|
-
if (
|
|
74738
|
-
switch (
|
|
75031
|
+
if (rpc2.method === void 0 || rpc2.id === void 0 || rpc2.id === null) return answer(202);
|
|
75032
|
+
switch (rpc2.method) {
|
|
74739
75033
|
case "initialize": {
|
|
74740
|
-
const asked =
|
|
74741
|
-
return result(
|
|
75034
|
+
const asked = rpc2.params?.protocolVersion;
|
|
75035
|
+
return result(rpc2.id, {
|
|
74742
75036
|
protocolVersion: typeof asked === "string" ? asked : PROTOCOL_VERSION,
|
|
74743
75037
|
capabilities: { tools: {} },
|
|
74744
75038
|
serverInfo: { name: "kanban-code", title: "Kanban Code", version: "1.0.0" }
|
|
74745
75039
|
});
|
|
74746
75040
|
}
|
|
74747
75041
|
case "ping":
|
|
74748
|
-
return result(
|
|
75042
|
+
return result(rpc2.id, {});
|
|
74749
75043
|
case "tools/list":
|
|
74750
|
-
return result(
|
|
75044
|
+
return result(rpc2.id, { tools: KANBAN_TOOLS });
|
|
74751
75045
|
case "tools/call":
|
|
74752
|
-
return callTool({ rpc, target, authorization: headerOf(exchange.headers, "authorization") });
|
|
75046
|
+
return callTool({ rpc: rpc2, target, authorization: headerOf(exchange.headers, "authorization") });
|
|
74753
75047
|
default:
|
|
74754
|
-
return error62(
|
|
75048
|
+
return error62(rpc2.id, -32601, `Method not found: ${rpc2.method}`);
|
|
74755
75049
|
}
|
|
74756
75050
|
}
|
|
74757
75051
|
|
|
@@ -76502,8 +76796,8 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
76502
76796
|
}
|
|
76503
76797
|
async call(method, params) {
|
|
76504
76798
|
const id4 = ++this.#nextId;
|
|
76505
|
-
const reply2 = await new Promise((
|
|
76506
|
-
this.#pending.set(id4,
|
|
76799
|
+
const reply2 = await new Promise((resolve27) => {
|
|
76800
|
+
this.#pending.set(id4, resolve27);
|
|
76507
76801
|
this.write({ id: id4, method, params });
|
|
76508
76802
|
});
|
|
76509
76803
|
if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
|
|
@@ -76515,12 +76809,12 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
76515
76809
|
/** Starts one turn; `done` settles when it completes, keeping its last agent message. */
|
|
76516
76810
|
async startTurn({ threadId, text: text3 }) {
|
|
76517
76811
|
const result2 = { answer: "" };
|
|
76518
|
-
const done = new Promise((
|
|
76812
|
+
const done = new Promise((resolve27) => {
|
|
76519
76813
|
const listen = (message2) => {
|
|
76520
76814
|
absorbTurnEvent({ result: result2, message: message2 });
|
|
76521
76815
|
if (message2.method !== "turn/completed") return;
|
|
76522
76816
|
this.#listeners.delete(listen);
|
|
76523
|
-
|
|
76817
|
+
resolve27(result2);
|
|
76524
76818
|
};
|
|
76525
76819
|
this.#listeners.add(listen);
|
|
76526
76820
|
});
|
|
@@ -79374,8 +79668,8 @@ async function requestAgent({ context, args }) {
|
|
|
79374
79668
|
}
|
|
79375
79669
|
|
|
79376
79670
|
// src/services/app-commands.service.ts
|
|
79377
|
-
import { mkdir as
|
|
79378
|
-
import { dirname as
|
|
79671
|
+
import { mkdir as mkdir7, readdir as readdir7, readFile as readFile17, writeFile as writeFile6 } from "node:fs/promises";
|
|
79672
|
+
import { dirname as dirname16, join as join26, relative as relative3, resolve as resolve9, sep as sep3 } from "node:path";
|
|
79379
79673
|
|
|
79380
79674
|
// ../../modules/app/contract/src/app.connections.ts
|
|
79381
79675
|
var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
|
|
@@ -80084,6 +80378,22 @@ var restoreAppDataInputSchema = restoreAppDataInputSchemaDefinition;
|
|
|
80084
80378
|
var AppApi = moduleApi()("app");
|
|
80085
80379
|
|
|
80086
80380
|
// ../../modules/app/contract/src/app.access.ts
|
|
80381
|
+
var appExternalRoleSchemaDefinition = external_exports.enum(["viewer", "builder"]);
|
|
80382
|
+
var setExternalRoleInputSchemaDefinition = external_exports.object({
|
|
80383
|
+
...appRefSchema.shape,
|
|
80384
|
+
role: appExternalRoleSchemaDefinition
|
|
80385
|
+
});
|
|
80386
|
+
var setExternalRoleInputSchema = setExternalRoleInputSchemaDefinition;
|
|
80387
|
+
var externalSignInHandoffInputSchemaDefinition = external_exports.object({
|
|
80388
|
+
/** The reader's own workspace, the one the door asks. */
|
|
80389
|
+
workspaceId: external_exports.string().min(1),
|
|
80390
|
+
/** The reader's copy of the shared channel the app is pinned in. */
|
|
80391
|
+
channelId: external_exports.string().min(1),
|
|
80392
|
+
hostWorkspaceId: external_exports.string().min(1),
|
|
80393
|
+
appId: external_exports.string().min(1),
|
|
80394
|
+
returnPath: external_exports.string().max(2e3).default("/")
|
|
80395
|
+
});
|
|
80396
|
+
var externalSignInHandoffInputSchema = externalSignInHandoffInputSchemaDefinition;
|
|
80087
80397
|
var appGrantSubjectSchemaDefinition = external_exports.object({
|
|
80088
80398
|
type: external_exports.enum(["user", "agent", "channel", "group"]),
|
|
80089
80399
|
id: external_exports.string().min(1)
|
|
@@ -80195,7 +80505,18 @@ var appAccessSchemaDefinition = external_exports.object({
|
|
|
80195
80505
|
/** The workspace's name, for "Everyone in <workspace>". */
|
|
80196
80506
|
workspaceName: external_exports.string(),
|
|
80197
80507
|
/** Whether a Builder makes it public without asking an admin. */
|
|
80198
|
-
publicAppsAllowed: external_exports.boolean()
|
|
80508
|
+
publicAppsAllowed: external_exports.boolean(),
|
|
80509
|
+
/** People of other workspaces in shared channels it is pinned in, and the most they get. */
|
|
80510
|
+
external: external_exports.object({
|
|
80511
|
+
role: appExternalRoleSchemaDefinition,
|
|
80512
|
+
channels: external_exports.array(
|
|
80513
|
+
external_exports.object({
|
|
80514
|
+
channelId: external_exports.string().min(1),
|
|
80515
|
+
name: external_exports.string().nullable(),
|
|
80516
|
+
workspaceName: external_exports.string()
|
|
80517
|
+
})
|
|
80518
|
+
)
|
|
80519
|
+
}).default({ role: "viewer", channels: [] })
|
|
80199
80520
|
});
|
|
80200
80521
|
var appAccessSchema = appAccessSchemaDefinition;
|
|
80201
80522
|
var grantAppAccessInputSchemaDefinition = external_exports.object({
|
|
@@ -80246,7 +80567,12 @@ var appDoorSchema = appDoorSchemaDefinition;
|
|
|
80246
80567
|
var appOpenChoiceSchemaDefinition = external_exports.object({
|
|
80247
80568
|
workspaceId: external_exports.string().min(1),
|
|
80248
80569
|
workspaceName: external_exports.string(),
|
|
80249
|
-
name: external_exports.string()
|
|
80570
|
+
name: external_exports.string(),
|
|
80571
|
+
/**
|
|
80572
|
+
* Set when the person reaches the app from their workspace's copy of a channel the app's
|
|
80573
|
+
* workspace shares: `workspaceId` is then theirs, and the handoff is `externalSignInHandoff`.
|
|
80574
|
+
*/
|
|
80575
|
+
via: external_exports.object({ channelId: external_exports.string().min(1), hostWorkspaceId: external_exports.string().min(1) }).nullable().default(null)
|
|
80250
80576
|
});
|
|
80251
80577
|
var appOpenChoicesSchemaDefinition = external_exports.object({
|
|
80252
80578
|
viewer: external_exports.object({ name: external_exports.string(), email: external_exports.string() }),
|
|
@@ -80759,7 +81085,12 @@ var appPinSchemaDefinition = external_exports.object({
|
|
|
80759
81085
|
/** Whether the reader may unpin it; a browser tab only its owner, their agents or an Admin. */
|
|
80760
81086
|
canUnpin: external_exports.boolean().default(true),
|
|
80761
81087
|
/** The app's own origin, so links to it open in the panel; null for a browser tab. */
|
|
80762
|
-
url: external_exports.string().nullable().default(null)
|
|
81088
|
+
url: external_exports.string().nullable().default(null),
|
|
81089
|
+
/**
|
|
81090
|
+
* The workspace that owns the app, when it is not the reader's: an app pinned in the other
|
|
81091
|
+
* side's copy of a shared channel. Null for the reader's own workspace's apps.
|
|
81092
|
+
*/
|
|
81093
|
+
host: external_exports.object({ workspaceId: external_exports.string().min(1), name: external_exports.string() }).nullable().default(null)
|
|
80763
81094
|
});
|
|
80764
81095
|
var appPinViewSchemaDefinition = external_exports.object({
|
|
80765
81096
|
activeAppId: external_exports.string().nullable(),
|
|
@@ -80836,6 +81167,23 @@ var browserTabPinSchemaDefinition = external_exports.discriminatedUnion("status"
|
|
|
80836
81167
|
}),
|
|
80837
81168
|
external_exports.object({ status: external_exports.literal("unpinned") })
|
|
80838
81169
|
]);
|
|
81170
|
+
var browserTabAddressInputSchemaDefinition = external_exports.object({
|
|
81171
|
+
workspaceId: external_exports.string().min(1),
|
|
81172
|
+
url: external_exports.string().min(1).max(4096)
|
|
81173
|
+
});
|
|
81174
|
+
var browserTabAddressSchemaDefinition = external_exports.object({
|
|
81175
|
+
open: external_exports.string().min(1),
|
|
81176
|
+
shown: external_exports.string().min(1)
|
|
81177
|
+
});
|
|
81178
|
+
var browserTabAppSchemaDefinition = external_exports.discriminatedUnion("kind", [
|
|
81179
|
+
external_exports.object({ kind: external_exports.literal("page") }),
|
|
81180
|
+
external_exports.object({ kind: external_exports.literal("app"), name: external_exports.string(), opens: external_exports.boolean() }),
|
|
81181
|
+
external_exports.object({ kind: external_exports.literal("sign-in"), name: external_exports.string() })
|
|
81182
|
+
]);
|
|
81183
|
+
var browserAppSessionsSchemaDefinition = external_exports.object({
|
|
81184
|
+
cookie: external_exports.string().min(1),
|
|
81185
|
+
domain: external_exports.string().min(1)
|
|
81186
|
+
});
|
|
80839
81187
|
|
|
80840
81188
|
// ../../modules/app/contract/src/app.backup.ts
|
|
80841
81189
|
var appBackupCheckFailureSchemaDefinition = external_exports.object({
|
|
@@ -80942,6 +81290,21 @@ var appQuotaAlertChangedPayloadSchemaDefinition = external_exports.object({
|
|
|
80942
81290
|
changeId: external_exports.string().min(1),
|
|
80943
81291
|
at: external_exports.iso.datetime()
|
|
80944
81292
|
});
|
|
81293
|
+
var appAdminActedPayloadSchemaDefinition = external_exports.object({
|
|
81294
|
+
workspaceId: external_exports.string().min(1),
|
|
81295
|
+
appId: external_exports.string().min(1),
|
|
81296
|
+
appName: external_exports.string().min(1),
|
|
81297
|
+
change: external_exports.enum(["owner", "offline", "deleted"]),
|
|
81298
|
+
adminName: external_exports.string().min(1),
|
|
81299
|
+
/** The new owner's name on an owner change, else null. */
|
|
81300
|
+
ownerName: external_exports.string().nullable(),
|
|
81301
|
+
/** The people told: the old and the new owner, or the owner, never the admin. */
|
|
81302
|
+
recipientUserIds: external_exports.array(external_exports.string().min(1)),
|
|
81303
|
+
/** Where the card links: the app, or the Apps page once it is deleted. */
|
|
81304
|
+
path: external_exports.string().min(1),
|
|
81305
|
+
changeId: external_exports.string().min(1),
|
|
81306
|
+
at: external_exports.iso.datetime()
|
|
81307
|
+
});
|
|
80945
81308
|
|
|
80946
81309
|
// ../../modules/app/contract/src/app.templates.ts
|
|
80947
81310
|
var APP_TEMPLATE_SOURCES = ["laze"];
|
|
@@ -81014,6 +81377,7 @@ var appsCopy = {
|
|
|
81014
81377
|
storable: appsForDisk
|
|
81015
81378
|
};
|
|
81016
81379
|
var appMainTrpc = defineTrpcContract("app").query("list", { mirrored: appsCopy }).withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(appPushSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(appDataRefSchema).withOutput(external_exports.array(collectionSchema)).query("records").withInput(listRecordsInputSchema).withOutput(recordPageSchema).mutation("writeRecord").withInput(writeRecordInputSchema).withOutput(appRecordSchema).mutation("deleteRecord").withInput(deleteRecordInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("views").withInput(appDataRefSchema).withOutput(external_exports.array(appViewSchema)).mutation("saveView").withInput(saveViewInputSchema).withOutput(appViewSchema).mutation("deleteView").withInput(deleteViewInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("chooseCardRows").withInput(chooseCardRowsInputSchema).withOutput(appCardChoiceSchema).query("exportRecords").withInput(exportRecordsInputSchema).withOutput(recordExportSchema).mutation("importRecords").withInput(importRecordsInputSchema).withOutput(recordImportSchema).mutation("decidePublish").withInput(decidePublishInputSchema).withOutput(publishOutcomeSchema).mutation("nameVersion").withInput(nameVersionInputSchema).withOutput(appVersionSchema).mutation("makeInternal").withInput(appRefSchema).withOutput(appSchema).mutation("revokePublishLease").withInput(appRefSchema).withOutput(appSchema).mutation("signInHandoff").withInput(signInHandoffInputSchema).withOutput(signInHandoffSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("access").withInput(appRefSchema).withOutput(appAccessSchema).query("members").withInput(appRefSchema).withOutput(appMembersSchema).mutation("grantAccess").withInput(grantAppAccessInputSchema).withOutput(appAccessSchema).mutation("revokeAccess").withInput(revokeAppAccessInputSchema).withOutput(appAccessSchema).mutation("setVisibility").withInput(setAppVisibilityInputSchema).withOutput(visibilityOutcomeSchema).mutation("setMemberRole").withInput(setMemberRoleInputSchema).withOutput(appAccessSchema).mutation("unpublish").withInput(appRefSchema).withOutput(appSchema).query("door").withInput(appRefSchema).withOutput(appDoorSchema).mutation("requestAccess").withInput(appRefSchema).withOutput(appDoorSchema).query("openChoices").withInput(appRefSchema).withOutput(appOpenChoicesSchema).mutation("askToOpen").withInput(appRefSchema).withOutput(appAskedSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).query("backups").withInput(appRefSchema).withOutput(appBackupStatusSchema).mutation("restoreData").withInput(restoreAppDataInputSchema).withOutput(appRestoreSchema).query("cost").withInput(appRefSchema).withOutput(appCostSchema).mutation("setBudget").withInput(setAppBudgetInputSchema).withOutput(appCostSchema).query("triggers").withInput(appRefSchema).withOutput(appTriggersSchema).mutation("setTriggerPaused").withInput(setAppTriggerPausedInputSchema).withOutput(appTriggerSchema).mutation("removeTrigger").withInput(appTriggerRefSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
|
|
81380
|
+
var appExternalTrpc = defineTrpcContract("app").mutation("externalSignInHandoff").withInput(externalSignInHandoffInputSchema).withOutput(signInHandoffSchema).mutation("setExternalRole").withInput(setExternalRoleInputSchema).withOutput(appAccessSchema).build();
|
|
81017
81381
|
var appConnectionsTrpc = defineTrpcContract("app").query("connections").withInput(appRefSchema).withOutput(appConnectionsSchema).mutation("allowConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).mutation("revokeConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).build();
|
|
81018
81382
|
var appPinsTrpc = defineTrpcContract("app").query("pins").withInput(channelPinsInputSchema).withOutput(channelAppPinsSchema).mutation("pin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("unpin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("setPinView").withInput(setPinViewInputSchema).withOutput(channelAppPinsSchema).mutation("reorderPins").withInput(reorderPinsInputSchema).withOutput(channelAppPinsSchema).mutation("setPinRole").withInput(setPinRoleInputSchema).withOutput(appAccessSchema).build();
|
|
81019
81383
|
var appSettingsTrpc = defineTrpcContract("app").query("workspaceSettings").withInput(appWorkspaceRefSchema).withOutput(appWorkspaceSettingsSchema).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).mutation("setPublicAppsAllowed").withInput(setPublicAppsAllowedInputSchema).withOutput(appFunctionSettingsSchema).query("workspaceApps").withInput(listWorkspaceAppsInputSchema).withOutput(external_exports.array(workspaceAppSchema)).mutation("setOwner").withInput(setAppOwnerInputSchema).withOutput(workspaceAppSchema).mutation("unpublishAsAdmin").withInput(appRefSchema).withOutput(external_exports.object({ unpublished: external_exports.literal(true) })).query("templates").withInput(appWorkspaceRefSchema).withOutput(external_exports.array(appTemplateSchema)).mutation("upgradeTemplate").withInput(appRefSchema).withOutput(appTemplateUpgradeSchema).build();
|
|
@@ -81022,7 +81386,8 @@ var appTrpc = joinTrpcContracts(
|
|
|
81022
81386
|
appMainTrpc,
|
|
81023
81387
|
appConnectionsTrpc,
|
|
81024
81388
|
appPinsTrpc,
|
|
81025
|
-
appSettingsTrpc
|
|
81389
|
+
appSettingsTrpc,
|
|
81390
|
+
appExternalTrpc
|
|
81026
81391
|
);
|
|
81027
81392
|
|
|
81028
81393
|
// ../../modules/app/contract/src/app.rest.ts
|
|
@@ -81062,6 +81427,7 @@ var grantAccessByKeyInputSchemaDefinition = grantAppAccessInputSchema.omit(byKey
|
|
|
81062
81427
|
var revokeAccessByKeyInputSchemaDefinition = revokeAppAccessInputSchema.omit(byKey);
|
|
81063
81428
|
var visibilityByKeyInputSchemaDefinition = setAppVisibilityInputSchema.omit(byKey);
|
|
81064
81429
|
var memberRoleByKeyInputSchemaDefinition = setMemberRoleInputSchema.omit(byKey);
|
|
81430
|
+
var externalRoleByKeyInputSchemaDefinition = setExternalRoleInputSchema.omit(byKey);
|
|
81065
81431
|
var pinRoleByKeyInputSchemaDefinition = setPinRoleInputSchema.omit(byKey);
|
|
81066
81432
|
var decideAccessByKeyInputSchemaDefinition = decideAppAccessInputSchema.omit(byKey);
|
|
81067
81433
|
var renameAppByKeyInputSchemaDefinition = renameAppInputSchema.omit(byKey);
|
|
@@ -81158,6 +81524,18 @@ var appCliCommands = [
|
|
|
81158
81524
|
arguments: [],
|
|
81159
81525
|
summary: "Print the live app's address"
|
|
81160
81526
|
},
|
|
81527
|
+
{
|
|
81528
|
+
command: "laze app open",
|
|
81529
|
+
operation: "getAddress",
|
|
81530
|
+
arguments: ["[app]", "--channel <c>"],
|
|
81531
|
+
summary: "Open the live app in a browser tab of the conversation, titled with its name, signed in as you with view only for 10 minutes, so you and the conversation see the page. Look before you say it is on the page"
|
|
81532
|
+
},
|
|
81533
|
+
{
|
|
81534
|
+
command: "laze app screenshot",
|
|
81535
|
+
operation: "getAddress",
|
|
81536
|
+
arguments: ["[file]", "--channel <c>"],
|
|
81537
|
+
summary: "Open the live app in its browser tab and save a JPEG of the page to the file (default: a temp file), to check how it renders"
|
|
81538
|
+
},
|
|
81161
81539
|
{
|
|
81162
81540
|
command: "laze app pull",
|
|
81163
81541
|
operation: "pullFiles",
|
|
@@ -81585,127 +81963,905 @@ function unknownCollectionsOf({
|
|
|
81585
81963
|
);
|
|
81586
81964
|
}
|
|
81587
81965
|
|
|
81588
|
-
// src/services/
|
|
81589
|
-
|
|
81590
|
-
|
|
81591
|
-
|
|
81592
|
-
|
|
81593
|
-
|
|
81594
|
-
|
|
81595
|
-
|
|
81596
|
-
|
|
81597
|
-
|
|
81966
|
+
// src/services/browser-tab-commands.service.ts
|
|
81967
|
+
import { mkdir as mkdir6, writeFile as writeFile4 } from "node:fs/promises";
|
|
81968
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
81969
|
+
import { join as join23, resolve as resolve8 } from "node:path";
|
|
81970
|
+
|
|
81971
|
+
// src/rules/browser-login.rules.ts
|
|
81972
|
+
var PASSWORD_NAME = /pass|pwd/i;
|
|
81973
|
+
var USER_NAME = /user|email|e-mail|login|account|name|^id$|_id$/i;
|
|
81974
|
+
function loginValuesOf({
|
|
81975
|
+
connection,
|
|
81976
|
+
values,
|
|
81977
|
+
userField,
|
|
81978
|
+
passField
|
|
81979
|
+
}) {
|
|
81980
|
+
const names = Object.keys(values).toSorted();
|
|
81981
|
+
const listed = names.join(", ") || "no fields";
|
|
81982
|
+
const refusal = (why) => ({
|
|
81983
|
+
refusal: `laze browser login: ${why}; ${connection} holds ${listed}. Pass --user-field <field> and --pass-field <field>.`
|
|
81984
|
+
});
|
|
81985
|
+
if (userField && values[userField] === void 0)
|
|
81986
|
+
return refusal(`${connection} has no field ${userField}`);
|
|
81987
|
+
if (passField && values[passField] === void 0)
|
|
81988
|
+
return refusal(`${connection} has no field ${passField}`);
|
|
81989
|
+
const passName = passField ?? names.find((name3) => PASSWORD_NAME.test(name3)) ?? (names.length === 1 ? names[0] : void 0);
|
|
81990
|
+
if (passName === void 0) return refusal("no field reads as the password");
|
|
81991
|
+
const userName = userField ?? names.find((name3) => name3 !== passName && USER_NAME.test(name3)) ?? void 0;
|
|
81992
|
+
const password = values[passName] ?? "";
|
|
81993
|
+
if (!password) return refusal(`${passName} is empty`);
|
|
81994
|
+
const username = userName === void 0 ? void 0 : values[userName];
|
|
81995
|
+
return username ? { username, password } : { password };
|
|
81598
81996
|
}
|
|
81599
|
-
|
|
81600
|
-
|
|
81601
|
-
|
|
81602
|
-
|
|
81603
|
-
|
|
81997
|
+
|
|
81998
|
+
// src/services/vault-commands.service.ts
|
|
81999
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
82000
|
+
import { readFile as readFile15, rm as rm11 } from "node:fs/promises";
|
|
82001
|
+
import { hostname as hostname6, tmpdir } from "node:os";
|
|
82002
|
+
import { dirname as dirname15, join as join22 } from "node:path";
|
|
82003
|
+
|
|
82004
|
+
// src/rules/vault-session.rules.ts
|
|
82005
|
+
function vaultSessionOf({
|
|
82006
|
+
harnessSession,
|
|
82007
|
+
inherited,
|
|
82008
|
+
cwd,
|
|
82009
|
+
host: host2,
|
|
82010
|
+
named,
|
|
82011
|
+
shellPid,
|
|
82012
|
+
terminal
|
|
82013
|
+
}) {
|
|
82014
|
+
const card2 = inherited.KANBAN_CARD_ID?.trim() ?? "";
|
|
82015
|
+
const name3 = (named || inherited.LAZE_SESSION_NAME || (card2 ? `card ${card2}` : "")).trim();
|
|
82016
|
+
const folder = displayFolderOf({
|
|
82017
|
+
folder: inherited.CLAUDE_PROJECT_DIR || cwd,
|
|
82018
|
+
home: inherited.HOME
|
|
82019
|
+
});
|
|
82020
|
+
const base = { name: name3.slice(0, 120), host: host2.slice(0, 200), folder: folder.slice(0, 500) };
|
|
82021
|
+
if (harnessSession && harnessSession.harness !== "other") {
|
|
82022
|
+
return { ...base, harness: harnessSession.harness, id: harnessSession.sessionId.slice(0, 200) };
|
|
82023
|
+
}
|
|
82024
|
+
if (card2) return { ...base, harness: "kanban", id: card2.slice(0, 200) };
|
|
82025
|
+
if (terminal && shellPid) return { ...base, harness: "terminal", id: `shell ${shellPid}` };
|
|
82026
|
+
return { ...base, harness: "script", id: folder.slice(0, 200) || "script" };
|
|
81604
82027
|
}
|
|
81605
|
-
|
|
81606
|
-
|
|
81607
|
-
|
|
81608
|
-
|
|
82028
|
+
|
|
82029
|
+
// src/services/vault-commands.service.ts
|
|
82030
|
+
var USAGE2 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
82031
|
+
Runs the command with the connection's values in its environment, on a Laze agent's computer,
|
|
82032
|
+
on a machine it runs on, where a connected agent runs, or signed in as yourself, where it asks
|
|
82033
|
+
as the calling Claude Code, Codex, Kanban or terminal session.
|
|
82034
|
+
--channel <id> the conversation whose turn it runs in, when the agent answers in several
|
|
82035
|
+
--as <name> the session's name on the card when signed in as yourself (or LAZE_SESSION_NAME)`;
|
|
82036
|
+
var POLL_MS = 3e3;
|
|
82037
|
+
var RESTART_WAIT_MS = 12e4;
|
|
82038
|
+
var RESTART_BACKOFF_MS = [1e3, 2e3, 4e3, 8e3, 1e4];
|
|
82039
|
+
var P2562 = { name: "ECDH", namedCurve: "P-256" };
|
|
82040
|
+
var ServerGoneError = class extends Error {
|
|
82041
|
+
};
|
|
82042
|
+
function proxyOf({ env }) {
|
|
82043
|
+
const raw = env.LAZE_VAULT_PROXY || env.HTTP_PROXY || env.http_proxy;
|
|
82044
|
+
if (!raw) return null;
|
|
82045
|
+
const url2 = new URL(raw);
|
|
82046
|
+
const user = decodeURIComponent(url2.username);
|
|
82047
|
+
const password = decodeURIComponent(url2.password);
|
|
82048
|
+
return {
|
|
82049
|
+
origin: url2.origin,
|
|
82050
|
+
authorization: `Basic ${Buffer.from(`${user}:${password}`).toString("base64")}`
|
|
82051
|
+
};
|
|
82052
|
+
}
|
|
82053
|
+
function turnFileOf({
|
|
82054
|
+
env
|
|
82055
|
+
}) {
|
|
82056
|
+
return env.LAZE_TURN_FILE || void 0;
|
|
82057
|
+
}
|
|
82058
|
+
async function turnTokenOf2({
|
|
82059
|
+
env,
|
|
82060
|
+
turnFile,
|
|
82061
|
+
command = "laze vault run"
|
|
82062
|
+
}) {
|
|
82063
|
+
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
82064
|
+
if (pinned) return pinned;
|
|
82065
|
+
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
82066
|
+
try {
|
|
82067
|
+
return (await readFile15(turnFile, "utf8")).trim();
|
|
82068
|
+
} catch {
|
|
82069
|
+
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
81609
82070
|
}
|
|
81610
|
-
const hosts = listed.hosts.map((host2) => `${host2.host} used by ${host2.functions.join(", ")}
|
|
81611
|
-
`);
|
|
81612
|
-
return [
|
|
81613
|
-
...listed.connections.length > 0 ? ["Connections:\n", ...listed.connections.map(connectionLine)] : [],
|
|
81614
|
-
...hosts.length > 0 ? ["Outside hosts:\n", ...hosts] : []
|
|
81615
|
-
].join("");
|
|
81616
82071
|
}
|
|
81617
|
-
function
|
|
82072
|
+
function runKeyPathOf({
|
|
82073
|
+
turnFile,
|
|
82074
|
+
connection,
|
|
82075
|
+
profile = ""
|
|
82076
|
+
}) {
|
|
82077
|
+
const name3 = createHash5("sha256").update(connection).digest("hex");
|
|
82078
|
+
const base = turnFile ? dirname15(turnFile) : join22(tmpdir(), "laze-vault", profile);
|
|
82079
|
+
return join22(base, "vault-run-keys", `${name3}.json`);
|
|
82080
|
+
}
|
|
82081
|
+
async function runKeyAt({ path }) {
|
|
82082
|
+
const saved3 = await readStateJson({
|
|
82083
|
+
path
|
|
82084
|
+
});
|
|
82085
|
+
if (saved3 && typeof saved3.publicKey === "string" && saved3.privateKey) {
|
|
82086
|
+
const privateKey = await globalThis.crypto.subtle.importKey("jwk", saved3.privateKey, P2562, false, ["deriveBits"]).catch(() => void 0);
|
|
82087
|
+
if (privateKey) return { privateKey, publicKey: saved3.publicKey };
|
|
82088
|
+
}
|
|
82089
|
+
const fresh = await generateEcdhKeys();
|
|
82090
|
+
const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
|
|
82091
|
+
await writeStateJson({ path, value: { publicKey: fresh.publicKey, privateKey: jwk } });
|
|
82092
|
+
return fresh;
|
|
82093
|
+
}
|
|
82094
|
+
function connectionRefused(error63) {
|
|
82095
|
+
const cause = error63.cause;
|
|
82096
|
+
if (cause?.code === "ECONNREFUSED") return true;
|
|
82097
|
+
return cause?.errors?.some((inner) => inner.code === "ECONNREFUSED") ?? false;
|
|
82098
|
+
}
|
|
82099
|
+
async function sendOnce({
|
|
81618
82100
|
context,
|
|
81619
|
-
|
|
81620
|
-
|
|
81621
|
-
text: text3
|
|
82101
|
+
url: url2,
|
|
82102
|
+
init
|
|
81622
82103
|
}) {
|
|
81623
|
-
|
|
81624
|
-
|
|
82104
|
+
let response;
|
|
82105
|
+
try {
|
|
82106
|
+
response = await context.fetcher(url2, init);
|
|
82107
|
+
} catch (error63) {
|
|
82108
|
+
const wasRefused = connectionRefused(error63);
|
|
82109
|
+
if (init.method === "POST" && !wasRefused) throw error63;
|
|
82110
|
+
return { restarting: wasRefused ? "connection refused" : String(error63) };
|
|
82111
|
+
}
|
|
82112
|
+
if (response.status !== 502 && response.status !== 503) return { response };
|
|
82113
|
+
const code = codeOf(await response.clone().text());
|
|
82114
|
+
const neverReached = response.status === 503 && code === "vault_not_answering";
|
|
82115
|
+
if (init.method === "POST" && !neverReached) return { response };
|
|
82116
|
+
return { restarting: `status ${response.status}${code ? ` ${code}` : ""}` };
|
|
81625
82117
|
}
|
|
81626
|
-
async function
|
|
82118
|
+
async function reach(input2) {
|
|
82119
|
+
const { context } = input2;
|
|
82120
|
+
const started = context.nowMs();
|
|
82121
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
82122
|
+
const sent = await sendOnce(input2);
|
|
82123
|
+
if ("response" in sent) return sent.response;
|
|
82124
|
+
if (context.nowMs() - started >= RESTART_WAIT_MS) {
|
|
82125
|
+
throw new ServerGoneError(
|
|
82126
|
+
`laze vault: the Laze server did not come back (${sent.restarting})`
|
|
82127
|
+
);
|
|
82128
|
+
}
|
|
82129
|
+
if (attempt === 0) {
|
|
82130
|
+
context.err(
|
|
82131
|
+
`laze vault: the Laze server is not answering (${sent.restarting}), probably restarting; waiting up to 2 min...
|
|
82132
|
+
`
|
|
82133
|
+
);
|
|
82134
|
+
}
|
|
82135
|
+
await context.sleep(RESTART_BACKOFF_MS[Math.min(attempt, RESTART_BACKOFF_MS.length - 1)] ?? 0);
|
|
82136
|
+
}
|
|
82137
|
+
}
|
|
82138
|
+
function codeOf(text3) {
|
|
82139
|
+
return /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1];
|
|
82140
|
+
}
|
|
82141
|
+
async function releaseOf({ response }) {
|
|
82142
|
+
const text3 = await response.text();
|
|
82143
|
+
if (!response.ok) {
|
|
82144
|
+
return {
|
|
82145
|
+
outcome: "deny",
|
|
82146
|
+
exitCode: 1,
|
|
82147
|
+
message: `laze vault: the release was refused (${codeOf(text3) ?? `status ${response.status}`})`
|
|
82148
|
+
};
|
|
82149
|
+
}
|
|
82150
|
+
return JSON.parse(text3);
|
|
82151
|
+
}
|
|
82152
|
+
async function envOf({
|
|
82153
|
+
release: release2,
|
|
82154
|
+
run: run4
|
|
82155
|
+
}) {
|
|
82156
|
+
if (!release2.sealed) return release2.env;
|
|
82157
|
+
const sealed = await openRunRelease({
|
|
82158
|
+
release: release2.sealed,
|
|
82159
|
+
runPrivateKey: run4.privateKey,
|
|
82160
|
+
runPublicKey: run4.publicKey,
|
|
82161
|
+
requestId: release2.sealed.requestId
|
|
82162
|
+
});
|
|
82163
|
+
return { ...release2.env, ...sealed };
|
|
82164
|
+
}
|
|
82165
|
+
function deadlineOf({ args, nowMs: nowMs2 }) {
|
|
82166
|
+
const wait = flagText({ args, name: "wait" }) || (args.flags.wait === true ? args.words[3] : "");
|
|
82167
|
+
if (!wait) return Infinity;
|
|
82168
|
+
if (!(Number(wait) >= 0)) throw new CliUsageError(`--wait takes a number of seconds
|
|
82169
|
+
${USAGE2}`);
|
|
82170
|
+
return nowMs2 + Number(wait) * 1e3;
|
|
82171
|
+
}
|
|
82172
|
+
async function untilAnswered({
|
|
81627
82173
|
context,
|
|
81628
|
-
|
|
81629
|
-
|
|
82174
|
+
first,
|
|
82175
|
+
next,
|
|
82176
|
+
deadline
|
|
81630
82177
|
}) {
|
|
81631
|
-
|
|
81632
|
-
|
|
81633
|
-
|
|
82178
|
+
let release2 = first;
|
|
82179
|
+
while (release2.outcome === "ask") {
|
|
82180
|
+
if (context.nowMs() + POLL_MS > deadline) {
|
|
82181
|
+
context.err(`${release2.message}. Not approved yet; ask again later.
|
|
82182
|
+
`);
|
|
82183
|
+
return "capped";
|
|
82184
|
+
}
|
|
82185
|
+
if (release2 === first) {
|
|
82186
|
+
context.err(`${release2.message}. Waiting for an answer (cards expire after 24 hours)...
|
|
82187
|
+
`);
|
|
82188
|
+
}
|
|
82189
|
+
await context.sleep(POLL_MS);
|
|
82190
|
+
release2 = await next(release2.requestId);
|
|
82191
|
+
}
|
|
82192
|
+
return release2;
|
|
81634
82193
|
}
|
|
81635
|
-
|
|
82194
|
+
function leaseHolds({
|
|
82195
|
+
release: release2,
|
|
82196
|
+
nowMs: nowMs2
|
|
82197
|
+
}) {
|
|
82198
|
+
const ends = release2.sealed?.leaseEndsAt;
|
|
82199
|
+
return ends !== void 0 && Temporal3.Instant.from(ends).epochMilliseconds > nowMs2;
|
|
82200
|
+
}
|
|
82201
|
+
async function vaultRelease({
|
|
81636
82202
|
context,
|
|
81637
82203
|
args,
|
|
81638
|
-
|
|
82204
|
+
connection,
|
|
82205
|
+
reason: reason2,
|
|
82206
|
+
command
|
|
81639
82207
|
}) {
|
|
81640
|
-
const
|
|
81641
|
-
|
|
81642
|
-
|
|
82208
|
+
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
82209
|
+
const env = context.environment.inherited;
|
|
82210
|
+
const proxy = proxyOf({ env });
|
|
82211
|
+
if (!proxy) return keyRelease({ context, args, connection, reason: reason2, command, deadline });
|
|
82212
|
+
const turnFile = turnFileOf({ env });
|
|
82213
|
+
const headers = {
|
|
82214
|
+
"proxy-authorization": proxy.authorization,
|
|
82215
|
+
"x-laze-turn": await turnTokenOf2({ env, turnFile })
|
|
82216
|
+
};
|
|
82217
|
+
const keyPath = runKeyPathOf({ turnFile, connection });
|
|
82218
|
+
const run4 = await runKeyAt({ path: keyPath });
|
|
82219
|
+
const body = JSON.stringify({ connection, reason: reason2, command, recipient: run4.publicKey });
|
|
82220
|
+
let release2;
|
|
82221
|
+
try {
|
|
82222
|
+
const first = await releaseOf({
|
|
82223
|
+
response: await reach({
|
|
82224
|
+
context,
|
|
82225
|
+
url: `${proxy.origin}/vault/release`,
|
|
82226
|
+
init: { method: "POST", headers: { ...headers, "content-type": "application/json" }, body }
|
|
82227
|
+
})
|
|
82228
|
+
});
|
|
82229
|
+
const next = async (requestId) => releaseOf({
|
|
82230
|
+
response: await reach({
|
|
82231
|
+
context,
|
|
82232
|
+
url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
|
|
82233
|
+
init: { method: "GET", headers }
|
|
82234
|
+
})
|
|
82235
|
+
});
|
|
82236
|
+
release2 = await untilAnswered({ context, first, next, deadline });
|
|
82237
|
+
} catch (error63) {
|
|
82238
|
+
if (!(error63 instanceof ServerGoneError)) throw error63;
|
|
82239
|
+
context.err(`${error63.message}. Run the command again to keep waiting.
|
|
81643
82240
|
`);
|
|
81644
|
-
|
|
81645
|
-
return;
|
|
82241
|
+
return { exitCode: 75 };
|
|
81646
82242
|
}
|
|
81647
|
-
|
|
81648
|
-
const listed = await client.post(`/api/apps/connections/${verb}`, { appId, connection }).catch((error63) => {
|
|
81649
|
-
if (!(error63 instanceof LazeApiError) || error63.code !== "permission_denied") throw error63;
|
|
81650
|
-
throw new CliUsageError(
|
|
81651
|
-
`Only the connection's owner can ${verb} it, signed in as themselves: an agent's key cannot. Ask them to run "laze app connection ${verb} ${connection}" with their own login, or to use the app's Connections tab.`
|
|
81652
|
-
);
|
|
81653
|
-
});
|
|
81654
|
-
const done = verb === "allow" ? `${name3} may now use ${connection} from its server functions.
|
|
81655
|
-
` : `${name3} no longer uses ${connection}; its next call is refused.
|
|
81656
|
-
`;
|
|
81657
|
-
print({ context, args, value: listed, text: done + connectionsText({ name: name3, listed }) });
|
|
82243
|
+
return settled({ context, release: release2, run: run4, keyPath });
|
|
81658
82244
|
}
|
|
81659
|
-
|
|
81660
|
-
// src/services/app-manage-commands.service.ts
|
|
81661
|
-
function print2({
|
|
82245
|
+
async function settled({
|
|
81662
82246
|
context,
|
|
81663
|
-
|
|
81664
|
-
|
|
81665
|
-
|
|
82247
|
+
release: release2,
|
|
82248
|
+
run: run4,
|
|
82249
|
+
keyPath
|
|
81666
82250
|
}) {
|
|
81667
|
-
|
|
81668
|
-
|
|
82251
|
+
if (release2 === "capped") return { exitCode: 75 };
|
|
82252
|
+
if (release2.outcome === "deny") {
|
|
82253
|
+
await rm11(keyPath, { force: true });
|
|
82254
|
+
context.err(`${release2.message}
|
|
82255
|
+
`);
|
|
82256
|
+
return { exitCode: release2.exitCode || 1 };
|
|
82257
|
+
}
|
|
82258
|
+
const values = await envOf({ release: release2, run: run4 });
|
|
82259
|
+
if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm11(keyPath, { force: true });
|
|
82260
|
+
if (release2.message) context.err(`${release2.message}
|
|
82261
|
+
`);
|
|
82262
|
+
return { env: values };
|
|
81669
82263
|
}
|
|
81670
|
-
function
|
|
81671
|
-
|
|
81672
|
-
|
|
81673
|
-
|
|
81674
|
-
|
|
82264
|
+
function refusedRelease(error63) {
|
|
82265
|
+
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
82266
|
+
return {
|
|
82267
|
+
outcome: "deny",
|
|
82268
|
+
exitCode: 1,
|
|
82269
|
+
message: `laze vault: the release was refused: ${refusalText(error63)}`
|
|
82270
|
+
};
|
|
81675
82271
|
}
|
|
81676
|
-
var
|
|
81677
|
-
|
|
81678
|
-
|
|
81679
|
-
|
|
81680
|
-
|
|
81681
|
-
|
|
81682
|
-
|
|
81683
|
-
|
|
81684
|
-
|
|
81685
|
-
|
|
81686
|
-
|
|
81687
|
-
|
|
81688
|
-
|
|
81689
|
-
|
|
81690
|
-
|
|
81691
|
-
|
|
81692
|
-
|
|
81693
|
-
|
|
81694
|
-
|
|
81695
|
-
|
|
81696
|
-
|
|
81697
|
-
|
|
81698
|
-
|
|
81699
|
-
|
|
81700
|
-
|
|
82272
|
+
var WHERE = "works only on a Laze agent's computer, on a machine it runs on, or signed in with `laze login` (as yourself or as a connected agent)";
|
|
82273
|
+
async function vaultSessionFor({
|
|
82274
|
+
context,
|
|
82275
|
+
args,
|
|
82276
|
+
harnessSession
|
|
82277
|
+
}) {
|
|
82278
|
+
return vaultSessionOf({
|
|
82279
|
+
harnessSession,
|
|
82280
|
+
inherited: context.environment.inherited,
|
|
82281
|
+
cwd: context.cwd,
|
|
82282
|
+
host: hostname6(),
|
|
82283
|
+
named: flagText({ args, name: "as" }),
|
|
82284
|
+
shellPid: await context.processes.parentOf(context.processes.pid),
|
|
82285
|
+
terminal: context.stdoutIsTerminal === true
|
|
82286
|
+
});
|
|
82287
|
+
}
|
|
82288
|
+
async function keyRelease({
|
|
82289
|
+
context,
|
|
82290
|
+
args,
|
|
82291
|
+
connection,
|
|
82292
|
+
reason: reason2,
|
|
82293
|
+
command,
|
|
82294
|
+
deadline
|
|
82295
|
+
}) {
|
|
82296
|
+
const signed2 = await signedIn({ context, args }).catch(() => null);
|
|
82297
|
+
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
82298
|
+
throw new CliUsageError(`laze vault run ${WHERE}`);
|
|
81701
82299
|
}
|
|
81702
|
-
const {
|
|
81703
|
-
await
|
|
81704
|
-
const
|
|
81705
|
-
|
|
81706
|
-
|
|
81707
|
-
};
|
|
81708
|
-
|
|
82300
|
+
const { name: name3 } = signed2;
|
|
82301
|
+
const harnessSession = await currentSessionOf({ context, args });
|
|
82302
|
+
const client = forSession({ client: signed2.client, session: harnessSession });
|
|
82303
|
+
const keyPath = runKeyPathOf({ turnFile: void 0, connection, profile: name3 });
|
|
82304
|
+
const run4 = await runKeyAt({ path: keyPath });
|
|
82305
|
+
const body = { connection, reason: reason2, command, recipient: run4.publicKey };
|
|
82306
|
+
const door = signed2.profile.kind === "person" ? {
|
|
82307
|
+
ask: "/api/vault/session/release",
|
|
82308
|
+
status: "/api/vault/session/release-status",
|
|
82309
|
+
extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
|
|
82310
|
+
} : {
|
|
82311
|
+
ask: "/api/agents/me/vault/release",
|
|
82312
|
+
status: "/api/agents/me/vault/release-status",
|
|
82313
|
+
extra: { channelId: flagText({ args, name: "channel" }) || null }
|
|
82314
|
+
};
|
|
82315
|
+
const first = await client.post(door.ask, { ...body, ...door.extra }).catch(refusedRelease);
|
|
82316
|
+
const next = (requestId) => client.post(door.status, { requestId, ...door.extra }).catch(refusedRelease);
|
|
82317
|
+
const release2 = await untilAnswered({ context, first, next, deadline });
|
|
82318
|
+
return settled({ context, release: release2, run: run4, keyPath });
|
|
82319
|
+
}
|
|
82320
|
+
async function vaultRun({
|
|
82321
|
+
context,
|
|
82322
|
+
args
|
|
82323
|
+
}) {
|
|
82324
|
+
const connection = args.words[2];
|
|
82325
|
+
const reason2 = flagText({ args, name: "reason" });
|
|
82326
|
+
if (!connection || args.rest.length === 0) throw new CliUsageError(USAGE2);
|
|
82327
|
+
if (!reason2) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
|
|
82328
|
+
${USAGE2}`);
|
|
82329
|
+
const foreign = commandReferenceNames({ command: args.rest }).find(
|
|
82330
|
+
(name3) => vaultReferenceConnectionName({ name: name3 }) !== connection
|
|
82331
|
+
);
|
|
82332
|
+
if (foreign !== void 0) {
|
|
82333
|
+
const named = vaultReferenceConnectionName({ name: foreign });
|
|
82334
|
+
context.err(
|
|
82335
|
+
`laze vault: the command names {{vault:${foreign}}}, but this run releases only ${connection}, not ${named}. Nothing was asked and the command did not run.
|
|
82336
|
+
`
|
|
82337
|
+
);
|
|
82338
|
+
return 1;
|
|
82339
|
+
}
|
|
82340
|
+
const released = await vaultRelease({ context, args, connection, reason: reason2, command: args.rest });
|
|
82341
|
+
if ("exitCode" in released) return released.exitCode;
|
|
82342
|
+
const prepared = preparedCommand({
|
|
82343
|
+
command: args.rest,
|
|
82344
|
+
released: /* @__PURE__ */ new Map([[connection, released.env]])
|
|
82345
|
+
});
|
|
82346
|
+
if ("refusal" in prepared) {
|
|
82347
|
+
context.err(`${prepared.refusal}
|
|
82348
|
+
`);
|
|
82349
|
+
return 1;
|
|
82350
|
+
}
|
|
82351
|
+
const redact = secretValuesOf({ fields: released.env });
|
|
82352
|
+
return context.runCommand({ command: prepared.command, env: released.env, redact });
|
|
82353
|
+
}
|
|
82354
|
+
function preparedCommand({
|
|
82355
|
+
command,
|
|
82356
|
+
released
|
|
82357
|
+
}) {
|
|
82358
|
+
for (const [name3, fields] of released) {
|
|
82359
|
+
const [problem] = unusableFieldProblems({ fields });
|
|
82360
|
+
if (problem !== void 0) {
|
|
82361
|
+
return {
|
|
82362
|
+
refusal: `laze vault: ${name3}: ${problem}, so the command did not run. Ask its owner to save the real value on the vault page.`
|
|
82363
|
+
};
|
|
82364
|
+
}
|
|
82365
|
+
}
|
|
82366
|
+
const filled = fillCommandReferences({ command, released });
|
|
82367
|
+
if ("refusal" in filled) {
|
|
82368
|
+
return { refusal: `laze vault: ${filled.refusal}. The command did not run.` };
|
|
82369
|
+
}
|
|
82370
|
+
return filled;
|
|
82371
|
+
}
|
|
82372
|
+
|
|
82373
|
+
// src/services/browser-tab-commands.service.ts
|
|
82374
|
+
var BROWSER_TAB_PATHS = {
|
|
82375
|
+
open: "/api/compute/browser-tabs/open",
|
|
82376
|
+
list: "/api/compute/browser-tabs/list",
|
|
82377
|
+
get: "/api/compute/browser-tabs/get",
|
|
82378
|
+
goto: "/api/compute/browser-tabs/goto",
|
|
82379
|
+
read: "/api/compute/browser-tabs/read",
|
|
82380
|
+
ask: "/api/compute/browser-tabs/ask",
|
|
82381
|
+
share: "/api/compute/browser-tabs/share",
|
|
82382
|
+
close: "/api/compute/browser-tabs/close",
|
|
82383
|
+
cdp: "/api/compute/browser-tabs/cdp",
|
|
82384
|
+
login: "/api/compute/browser-tabs/login",
|
|
82385
|
+
screenshot: "/api/compute/browser-tabs/screenshot"
|
|
82386
|
+
};
|
|
82387
|
+
var ASK_WAIT_SECONDS = 15 * 60;
|
|
82388
|
+
var ASK_POLL_MS = 3e3;
|
|
82389
|
+
var BROWSER_TAB_USAGE = [
|
|
82390
|
+
"Usage: laze browser open <url> [--title <title>] [--channel <channel>] a live browser tab in the conversation",
|
|
82391
|
+
" laze browser tabs [--channel <channel>] the conversation's browser tabs",
|
|
82392
|
+
" laze browser tab <tab> one tab: its owner, sharing and page",
|
|
82393
|
+
" laze browser goto <tab> <url> send the tab to another page",
|
|
82394
|
+
" laze browser read <tab> the page's address, title and text",
|
|
82395
|
+
" laze browser screenshot <tab> [file] save a JPEG of the page (default: a temp file)",
|
|
82396
|
+
" laze browser ask <tab> <what> [--wait[=<seconds>]] ask the person you work for to sign in or click something there",
|
|
82397
|
+
" laze browser login <tab> --vault <connection> [--reason <why>] [--user-field <field> --pass-field <field>]",
|
|
82398
|
+
" [--user-input <css> --pass-input <css>] type a saved sign-in into the page and submit it",
|
|
82399
|
+
" laze browser cdp <tab> a CDP address on the tab's browser",
|
|
82400
|
+
" laze browser share <tab> private|watch|use who sees the screen and who types into it",
|
|
82401
|
+
" laze browser close <tab> unpin the tab and close its browser",
|
|
82402
|
+
"A tab is named by its id or its title. Opening a title that is already open reuses that tab.",
|
|
82403
|
+
"Any agent working for the tab's owner drives it, connected agents (Claude Code, Codex) from",
|
|
82404
|
+
"their own session included; no Laze computer is needed. Another person's agent cannot.",
|
|
82405
|
+
"Sign-ins: ask the person in the tab first (`laze browser ask`); they sign in on the screen and",
|
|
82406
|
+
"press Done, which reaches you at once. Use `laze browser login --vault` only when the person",
|
|
82407
|
+
"says to use a saved key; a code or emailed link it meets becomes a request to them in the tab.",
|
|
82408
|
+
"Never write scripts that type passwords.",
|
|
82409
|
+
"Your workspace's apps open signed in as you, view only, for 10 minutes: `laze app open` shows yours."
|
|
82410
|
+
].join("\n");
|
|
82411
|
+
var SHARING = /* @__PURE__ */ new Set(["private", "watch", "use"]);
|
|
82412
|
+
function channelOf({ context, args }) {
|
|
82413
|
+
const channel = flagText({ args, name: "channel" }) || context.environment.inherited.LAZE_CHANNEL;
|
|
82414
|
+
return channel ? { channel } : {};
|
|
82415
|
+
}
|
|
82416
|
+
function word({ args, at }) {
|
|
82417
|
+
const value = args.words[at];
|
|
82418
|
+
if (!value) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
82419
|
+
return value;
|
|
82420
|
+
}
|
|
82421
|
+
function tabLine(tab) {
|
|
82422
|
+
return `${tab.id} ${tab.title} ${tab.ownerName}'s browser ${tab.sharing} ${tab.url}
|
|
82423
|
+
`;
|
|
82424
|
+
}
|
|
82425
|
+
function pageText({ page }) {
|
|
82426
|
+
const head = `${page.title || "(no title)"}
|
|
82427
|
+
${page.url}
|
|
82428
|
+
`;
|
|
82429
|
+
if (page.text === null) return head;
|
|
82430
|
+
const cut = page.truncated ? "\n[cut at 100 000 characters]\n" : "\n";
|
|
82431
|
+
return `${head}
|
|
82432
|
+
${page.text}${cut}`;
|
|
82433
|
+
}
|
|
82434
|
+
async function openTab({ args, client, channel, print: print9 }) {
|
|
82435
|
+
const title = flagText({ args, name: "title" });
|
|
82436
|
+
const tab = await client.post(BROWSER_TAB_PATHS.open, {
|
|
82437
|
+
url: word({ args, at: 2 }),
|
|
82438
|
+
...title ? { title } : {},
|
|
82439
|
+
...channel
|
|
82440
|
+
});
|
|
82441
|
+
if (tab.reused)
|
|
82442
|
+
return print9(
|
|
82443
|
+
tab,
|
|
82444
|
+
`Reused ${tab.title} (${tab.id}), ${tab.ownerName}'s browser tab already open, and sent it to ${tab.url}
|
|
82445
|
+
`
|
|
82446
|
+
);
|
|
82447
|
+
print9(
|
|
82448
|
+
tab,
|
|
82449
|
+
`Opened ${tab.title} (${tab.id}) in ${tab.ownerName}'s browser, pinned as a tab of the conversation.
|
|
82450
|
+
Everyone in it watches the screen live. Page: ${tab.url}
|
|
82451
|
+
If the site needs a sign-in, run \`laze browser ask ${tab.id} "Sign in to <site>"\` and wait for their Done.
|
|
82452
|
+
`
|
|
82453
|
+
);
|
|
82454
|
+
}
|
|
82455
|
+
async function listTabs({ context, client, channel, json: json7, print: print9 }) {
|
|
82456
|
+
const { tabs } = await client.post(BROWSER_TAB_PATHS.list, channel);
|
|
82457
|
+
if (json7) return print9(tabs, "");
|
|
82458
|
+
if (tabs.length === 0)
|
|
82459
|
+
return context.out("No browser tabs here. `laze browser open <url>` opens one.\n");
|
|
82460
|
+
for (const tab of tabs) context.out(tabLine(tab));
|
|
82461
|
+
}
|
|
82462
|
+
async function showTab({ args, client, channel, print: print9 }) {
|
|
82463
|
+
const tab = await client.post(BROWSER_TAB_PATHS.get, {
|
|
82464
|
+
tab: word({ args, at: 2 }),
|
|
82465
|
+
...channel
|
|
82466
|
+
});
|
|
82467
|
+
print9(tab, tabLine(tab));
|
|
82468
|
+
}
|
|
82469
|
+
async function gotoTab({ args, client, channel, print: print9 }) {
|
|
82470
|
+
const page = await client.post(BROWSER_TAB_PATHS.goto, {
|
|
82471
|
+
tab: word({ args, at: 2 }),
|
|
82472
|
+
url: word({ args, at: 3 }),
|
|
82473
|
+
...channel
|
|
82474
|
+
});
|
|
82475
|
+
print9(page, pageText({ page }));
|
|
82476
|
+
}
|
|
82477
|
+
async function readTab({ args, client, channel, print: print9 }) {
|
|
82478
|
+
const page = await client.post(BROWSER_TAB_PATHS.read, {
|
|
82479
|
+
tab: word({ args, at: 2 }),
|
|
82480
|
+
...channel
|
|
82481
|
+
});
|
|
82482
|
+
print9(page, pageText({ page }));
|
|
82483
|
+
}
|
|
82484
|
+
async function saveScreenshot({
|
|
82485
|
+
context,
|
|
82486
|
+
shot,
|
|
82487
|
+
path
|
|
82488
|
+
}) {
|
|
82489
|
+
if (path) {
|
|
82490
|
+
const target = resolve8(context.cwd, path);
|
|
82491
|
+
await writeFile4(target, Buffer.from(shot.image, "base64"), { mode: 384 });
|
|
82492
|
+
return target;
|
|
82493
|
+
}
|
|
82494
|
+
return savedScreenshot({
|
|
82495
|
+
tabId: shot.tabId,
|
|
82496
|
+
data: shot.image,
|
|
82497
|
+
nowMs: context.nowMs(),
|
|
82498
|
+
what: "page"
|
|
82499
|
+
});
|
|
82500
|
+
}
|
|
82501
|
+
async function screenshotTab({ context, args, client, channel, json: json7 }) {
|
|
82502
|
+
const shot = await client.post(BROWSER_TAB_PATHS.screenshot, {
|
|
82503
|
+
tab: word({ args, at: 2 }),
|
|
82504
|
+
...channel
|
|
82505
|
+
});
|
|
82506
|
+
const path = await saveScreenshot({ context, shot, path: args.words[3] });
|
|
82507
|
+
const { image: _image, ...rest } = shot;
|
|
82508
|
+
context.out(
|
|
82509
|
+
json7 ? `${JSON.stringify({ ...rest, path }, null, 2)}
|
|
82510
|
+
` : `Saved a screenshot of ${shot.title || "(no title)"} to ${path}
|
|
82511
|
+
${shot.url}
|
|
82512
|
+
`
|
|
82513
|
+
);
|
|
82514
|
+
}
|
|
82515
|
+
async function askOnTab(run4) {
|
|
82516
|
+
const { args, client, channel, print: print9 } = run4;
|
|
82517
|
+
const tab = word({ args, at: 2 });
|
|
82518
|
+
const text3 = args.words.slice(3).join(" ").trim();
|
|
82519
|
+
if (!text3) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
82520
|
+
const asked = await client.post(BROWSER_TAB_PATHS.ask, { tab, text: text3, ...channel });
|
|
82521
|
+
const who = asked.ask?.userName ?? asked.ownerName;
|
|
82522
|
+
if (args.flags.wait === void 0)
|
|
82523
|
+
return print9(
|
|
82524
|
+
asked,
|
|
82525
|
+
`Asked ${who} in the conversation; the tab shows them your request full screen with "Done, hand back".
|
|
82526
|
+
Wait for their "Done" message before you go on in ${asked.title}.
|
|
82527
|
+
`
|
|
82528
|
+
);
|
|
82529
|
+
run4.context.err(`Asked ${who} in the conversation; waiting for their Done...
|
|
82530
|
+
`);
|
|
82531
|
+
return waitForDone({ run: run4, tab: asked, who });
|
|
82532
|
+
}
|
|
82533
|
+
async function waitForDone({
|
|
82534
|
+
run: run4,
|
|
82535
|
+
tab,
|
|
82536
|
+
who
|
|
82537
|
+
}) {
|
|
82538
|
+
const { context, args, client, channel, print: print9 } = run4;
|
|
82539
|
+
const seconds = Number(flagText({ args, name: "wait" }) || ASK_WAIT_SECONDS);
|
|
82540
|
+
if (!(seconds > 0)) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
82541
|
+
const deadline = context.nowMs() + seconds * 1e3;
|
|
82542
|
+
while (context.nowMs() < deadline) {
|
|
82543
|
+
await context.sleep(Math.min(ASK_POLL_MS, Math.max(0, deadline - context.nowMs())));
|
|
82544
|
+
const now = await client.post(BROWSER_TAB_PATHS.get, { tab: tab.id, ...channel });
|
|
82545
|
+
if (!now.ask) return print9(now, `${who} pressed Done. ${now.title} shows ${now.url}
|
|
82546
|
+
`);
|
|
82547
|
+
}
|
|
82548
|
+
print9(
|
|
82549
|
+
tab,
|
|
82550
|
+
`${who} has not pressed Done yet; the request stays open. Wait for their "Done" message.
|
|
82551
|
+
`
|
|
82552
|
+
);
|
|
82553
|
+
return 75;
|
|
82554
|
+
}
|
|
82555
|
+
async function loginOnTab(run4) {
|
|
82556
|
+
const { context, args, client, channel, json: json7 } = run4;
|
|
82557
|
+
const tab = word({ args, at: 2 });
|
|
82558
|
+
const connection = flagText({ args, name: "vault" });
|
|
82559
|
+
if (!connection)
|
|
82560
|
+
throw new CliUsageError(
|
|
82561
|
+
`Name the saved sign-in with --vault <connection>
|
|
82562
|
+
${BROWSER_TAB_USAGE}`
|
|
82563
|
+
);
|
|
82564
|
+
const reason2 = flagText({ args, name: "reason" }) || `Sign in on the ${tab} browser tab of the conversation`;
|
|
82565
|
+
const released = await vaultRelease({
|
|
82566
|
+
context,
|
|
82567
|
+
args,
|
|
82568
|
+
connection,
|
|
82569
|
+
reason: reason2,
|
|
82570
|
+
command: ["laze", "browser", "login", tab]
|
|
82571
|
+
});
|
|
82572
|
+
if ("exitCode" in released) return released.exitCode;
|
|
82573
|
+
const [problem] = unusableFieldProblems({ fields: released.env });
|
|
82574
|
+
if (problem !== void 0) {
|
|
82575
|
+
context.err(`laze browser login: ${connection}: ${problem}. Nothing was typed.
|
|
82576
|
+
`);
|
|
82577
|
+
return 1;
|
|
82578
|
+
}
|
|
82579
|
+
const values = loginValuesOf({
|
|
82580
|
+
connection,
|
|
82581
|
+
values: released.env,
|
|
82582
|
+
userField: flagText({ args, name: "user-field" }) || void 0,
|
|
82583
|
+
passField: flagText({ args, name: "pass-field" }) || void 0
|
|
82584
|
+
});
|
|
82585
|
+
if ("refusal" in values) {
|
|
82586
|
+
context.err(`${values.refusal}
|
|
82587
|
+
`);
|
|
82588
|
+
return 1;
|
|
82589
|
+
}
|
|
82590
|
+
const userInput = flagText({ args, name: "user-input" });
|
|
82591
|
+
const passInput = flagText({ args, name: "pass-input" });
|
|
82592
|
+
const answer6 = await client.post(BROWSER_TAB_PATHS.login, {
|
|
82593
|
+
tab,
|
|
82594
|
+
...values,
|
|
82595
|
+
...userInput ? { userInput } : {},
|
|
82596
|
+
...passInput ? { passInput } : {},
|
|
82597
|
+
...channel
|
|
82598
|
+
});
|
|
82599
|
+
const screenshotPath = answer6.screenshot ? await savedScreenshot({
|
|
82600
|
+
tabId: answer6.tabId,
|
|
82601
|
+
data: answer6.screenshot,
|
|
82602
|
+
nowMs: context.nowMs(),
|
|
82603
|
+
what: "login"
|
|
82604
|
+
}) : null;
|
|
82605
|
+
const { screenshot: _shown, ...rest } = answer6;
|
|
82606
|
+
if (json7) context.out(`${JSON.stringify({ ...rest, screenshotPath }, null, 2)}
|
|
82607
|
+
`);
|
|
82608
|
+
else context.out(loginText({ answer: answer6, tab, screenshotPath }));
|
|
82609
|
+
return answer6.state === "refused" || answer6.state === "still_on_form" ? 1 : 0;
|
|
82610
|
+
}
|
|
82611
|
+
function loginText({
|
|
82612
|
+
answer: answer6,
|
|
82613
|
+
tab,
|
|
82614
|
+
screenshotPath
|
|
82615
|
+
}) {
|
|
82616
|
+
const page = `${answer6.title || "(no title)"}
|
|
82617
|
+
${answer6.url}
|
|
82618
|
+
`;
|
|
82619
|
+
const shot = screenshotPath ? `Screenshot: ${screenshotPath}
|
|
82620
|
+
` : "";
|
|
82621
|
+
if (answer6.state === "signed_in") return `Signed in.
|
|
82622
|
+
${page}${shot}`;
|
|
82623
|
+
if (answer6.state === "second_step")
|
|
82624
|
+
return `The site asks for a second step (a code or an emailed link). Asked ${answer6.askedUserName ?? "the person"} in the conversation to finish it in the tab;
|
|
82625
|
+
wait for their "Done" message before you go on.
|
|
82626
|
+
${page}${shot}`;
|
|
82627
|
+
if (answer6.state === "refused")
|
|
82628
|
+
return `The site refused the sign-in: ${answer6.error ?? "no reason shown"}
|
|
82629
|
+
${page}${shot}`;
|
|
82630
|
+
return `Still on the sign-in page after submitting. Look at the screenshot, then ask the person in the tab:
|
|
82631
|
+
laze browser ask ${tab} "Finish signing in"
|
|
82632
|
+
${page}${shot}`;
|
|
82633
|
+
}
|
|
82634
|
+
async function savedScreenshot({
|
|
82635
|
+
tabId,
|
|
82636
|
+
data,
|
|
82637
|
+
nowMs: nowMs2,
|
|
82638
|
+
what
|
|
82639
|
+
}) {
|
|
82640
|
+
const folder = join23(tmpdir2(), "laze-browser");
|
|
82641
|
+
await mkdir6(folder, { recursive: true, mode: 448 });
|
|
82642
|
+
const path = join23(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-${what}-${nowMs2}.jpg`);
|
|
82643
|
+
await writeFile4(path, Buffer.from(data, "base64"), { mode: 384 });
|
|
82644
|
+
return path;
|
|
82645
|
+
}
|
|
82646
|
+
async function shareTab({ args, client, channel, print: print9 }) {
|
|
82647
|
+
const tab = word({ args, at: 2 });
|
|
82648
|
+
const sharing = word({ args, at: 3 });
|
|
82649
|
+
if (!SHARING.has(sharing)) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
82650
|
+
const shared = await client.post(BROWSER_TAB_PATHS.share, {
|
|
82651
|
+
tab,
|
|
82652
|
+
sharing,
|
|
82653
|
+
...channel
|
|
82654
|
+
});
|
|
82655
|
+
print9(shared, tabLine(shared));
|
|
82656
|
+
}
|
|
82657
|
+
async function closeTab({ args, client, channel, print: print9 }) {
|
|
82658
|
+
const tab = word({ args, at: 2 });
|
|
82659
|
+
const closed = await client.post(BROWSER_TAB_PATHS.close, { tab, ...channel });
|
|
82660
|
+
print9(closed, `Closed ${tab}.
|
|
82661
|
+
`);
|
|
82662
|
+
}
|
|
82663
|
+
var TAB_RUNS = {
|
|
82664
|
+
open: openTab,
|
|
82665
|
+
tabs: listTabs,
|
|
82666
|
+
tab: showTab,
|
|
82667
|
+
goto: gotoTab,
|
|
82668
|
+
read: readTab,
|
|
82669
|
+
screenshot: screenshotTab,
|
|
82670
|
+
ask: askOnTab,
|
|
82671
|
+
login: loginOnTab,
|
|
82672
|
+
share: shareTab,
|
|
82673
|
+
close: closeTab
|
|
82674
|
+
};
|
|
82675
|
+
async function browserTab({
|
|
82676
|
+
context,
|
|
82677
|
+
args,
|
|
82678
|
+
client
|
|
82679
|
+
}) {
|
|
82680
|
+
const handler = TAB_RUNS[args.words[1] ?? ""];
|
|
82681
|
+
if (!handler) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
82682
|
+
const json7 = Boolean(args.flags.json);
|
|
82683
|
+
const print9 = (value, text3) => context.out(json7 ? `${JSON.stringify(value, null, 2)}
|
|
82684
|
+
` : text3);
|
|
82685
|
+
return handler({ context, args, client, channel: channelOf({ context, args }), json: json7, print: print9 });
|
|
82686
|
+
}
|
|
82687
|
+
async function browserTabCdp({
|
|
82688
|
+
context,
|
|
82689
|
+
args,
|
|
82690
|
+
client
|
|
82691
|
+
}) {
|
|
82692
|
+
try {
|
|
82693
|
+
const channel = channelOf({ context, args });
|
|
82694
|
+
return await client.post(BROWSER_TAB_PATHS.cdp, { tab: word({ args, at: 2 }), ...channel });
|
|
82695
|
+
} catch (error63) {
|
|
82696
|
+
const missing = ["browser_tab_not_found", "not_found"];
|
|
82697
|
+
if (error63 instanceof LazeApiError && missing.includes(error63.code)) return null;
|
|
82698
|
+
throw error63;
|
|
82699
|
+
}
|
|
82700
|
+
}
|
|
82701
|
+
|
|
82702
|
+
// src/services/app-browser-commands.service.ts
|
|
82703
|
+
async function appTab({ context, args, open: open6 }) {
|
|
82704
|
+
const { client, appId, name: name3 } = await open6();
|
|
82705
|
+
const { url: url2 } = await client.post("/api/apps/preview", { appId });
|
|
82706
|
+
const channel = channelOf({ context, args });
|
|
82707
|
+
const tab = await client.post(BROWSER_TAB_PATHS.open, {
|
|
82708
|
+
url: url2,
|
|
82709
|
+
title: name3,
|
|
82710
|
+
...channel
|
|
82711
|
+
});
|
|
82712
|
+
return { client, tab, channel, name: name3 };
|
|
82713
|
+
}
|
|
82714
|
+
async function appOpen(run4) {
|
|
82715
|
+
const { tab, name: name3 } = await appTab(run4);
|
|
82716
|
+
const { context, args } = run4;
|
|
82717
|
+
if (args.flags.json) return context.out(`${JSON.stringify(tab, null, 2)}
|
|
82718
|
+
`);
|
|
82719
|
+
context.out(
|
|
82720
|
+
`${tab.reused ? "Reused" : "Opened"} ${name3} (${tab.id}) in ${tab.ownerName}'s browser, signed in as you, view only, for 10 minutes.
|
|
82721
|
+
Everyone in the conversation who may open ${name3} watches it. Page: ${tab.url}
|
|
82722
|
+
Look at it: laze browser screenshot ${tab.id} [file]. Change data with laze app records, not on the page.
|
|
82723
|
+
`
|
|
82724
|
+
);
|
|
82725
|
+
}
|
|
82726
|
+
async function appScreenshot(run4) {
|
|
82727
|
+
const { client, tab, channel } = await appTab(run4);
|
|
82728
|
+
const shot = await client.post(BROWSER_TAB_PATHS.screenshot, {
|
|
82729
|
+
tab: tab.id,
|
|
82730
|
+
...channel
|
|
82731
|
+
});
|
|
82732
|
+
const { context, args } = run4;
|
|
82733
|
+
const path = await saveScreenshot({ context, shot, path: args.words[2] });
|
|
82734
|
+
if (args.flags.json) {
|
|
82735
|
+
const { image: _image, ...rest } = shot;
|
|
82736
|
+
return context.out(`${JSON.stringify({ ...rest, path }, null, 2)}
|
|
82737
|
+
`);
|
|
82738
|
+
}
|
|
82739
|
+
context.out(`Saved a screenshot of ${shot.title || tab.title} to ${path}
|
|
82740
|
+
${shot.url}
|
|
82741
|
+
`);
|
|
82742
|
+
}
|
|
82743
|
+
|
|
82744
|
+
// src/services/app-connection-commands.service.ts
|
|
82745
|
+
var USAGE3 = `Usage:
|
|
82746
|
+
laze app connections
|
|
82747
|
+
laze app connection allow <connection>
|
|
82748
|
+
laze app connection revoke <connection>`;
|
|
82749
|
+
function connectionLine(connection) {
|
|
82750
|
+
const whose = connection.ownerUserId ? `${connection.ownerName}'s keychain` : "workspace keychain";
|
|
82751
|
+
return `${connection.name} ${connection.label}, ${whose}, ${vaultLevelLabel(connection.sensitivity)}
|
|
82752
|
+
used by ${connection.functions.join(", ")}; ${stateOf(connection)}
|
|
82753
|
+
`;
|
|
82754
|
+
}
|
|
82755
|
+
function stateOf(connection) {
|
|
82756
|
+
if (connection.missing) return "gone from the vault";
|
|
82757
|
+
if (connection.grant) return `allowed by ${connection.grant.grantedByName}`;
|
|
82758
|
+
if (connection.canGrant) return `not allowed yet: laze app connection allow ${connection.name}`;
|
|
82759
|
+
return `not allowed yet: ask ${connection.ownerName} to allow it`;
|
|
82760
|
+
}
|
|
82761
|
+
function connectionsText({ name: name3, listed }) {
|
|
82762
|
+
if (listed.connections.length === 0 && listed.hosts.length === 0) {
|
|
82763
|
+
return `${name3}'s server functions use no connections or outside hosts. Declare them per function under "functions" in laze.app.json.
|
|
82764
|
+
`;
|
|
82765
|
+
}
|
|
82766
|
+
const hosts = listed.hosts.map((host2) => `${host2.host} used by ${host2.functions.join(", ")}
|
|
82767
|
+
`);
|
|
82768
|
+
return [
|
|
82769
|
+
...listed.connections.length > 0 ? ["Connections:\n", ...listed.connections.map(connectionLine)] : [],
|
|
82770
|
+
...hosts.length > 0 ? ["Outside hosts:\n", ...hosts] : []
|
|
82771
|
+
].join("");
|
|
82772
|
+
}
|
|
82773
|
+
function print({
|
|
82774
|
+
context,
|
|
82775
|
+
args,
|
|
82776
|
+
value,
|
|
82777
|
+
text: text3
|
|
82778
|
+
}) {
|
|
82779
|
+
context.out(args.flags.json ? `${JSON.stringify(value, null, 2)}
|
|
82780
|
+
` : text3);
|
|
82781
|
+
}
|
|
82782
|
+
async function appConnections({
|
|
82783
|
+
context,
|
|
82784
|
+
args,
|
|
82785
|
+
open: open6
|
|
82786
|
+
}) {
|
|
82787
|
+
const { client, appId, name: name3 } = await open6();
|
|
82788
|
+
const listed = await client.post("/api/apps/connections", { appId });
|
|
82789
|
+
print({ context, args, value: listed, text: connectionsText({ name: name3, listed }) });
|
|
82790
|
+
}
|
|
82791
|
+
async function appConnection({
|
|
82792
|
+
context,
|
|
82793
|
+
args,
|
|
82794
|
+
open: open6
|
|
82795
|
+
}) {
|
|
82796
|
+
const [, , verb, connection] = args.words;
|
|
82797
|
+
if (verb !== "allow" && verb !== "revoke" || !connection) {
|
|
82798
|
+
context.out(`${USAGE3}
|
|
82799
|
+
`);
|
|
82800
|
+
if (verb) throw new CliUsageError(USAGE3);
|
|
82801
|
+
return;
|
|
82802
|
+
}
|
|
82803
|
+
const { client, appId, name: name3 } = await open6();
|
|
82804
|
+
const listed = await client.post(`/api/apps/connections/${verb}`, { appId, connection }).catch((error63) => {
|
|
82805
|
+
if (!(error63 instanceof LazeApiError) || error63.code !== "permission_denied") throw error63;
|
|
82806
|
+
throw new CliUsageError(
|
|
82807
|
+
`Only the connection's owner can ${verb} it, signed in as themselves: an agent's key cannot. Ask them to run "laze app connection ${verb} ${connection}" with their own login, or to use the app's Connections tab.`
|
|
82808
|
+
);
|
|
82809
|
+
});
|
|
82810
|
+
const done = verb === "allow" ? `${name3} may now use ${connection} from its server functions.
|
|
82811
|
+
` : `${name3} no longer uses ${connection}; its next call is refused.
|
|
82812
|
+
`;
|
|
82813
|
+
print({ context, args, value: listed, text: done + connectionsText({ name: name3, listed }) });
|
|
82814
|
+
}
|
|
82815
|
+
|
|
82816
|
+
// src/services/app-manage-commands.service.ts
|
|
82817
|
+
function print2({
|
|
82818
|
+
context,
|
|
82819
|
+
args,
|
|
82820
|
+
value,
|
|
82821
|
+
text: text3
|
|
82822
|
+
}) {
|
|
82823
|
+
context.out(args.flags.json ? `${JSON.stringify(value, null, 2)}
|
|
82824
|
+
` : text3);
|
|
82825
|
+
}
|
|
82826
|
+
function appAndWord({ args, usage }) {
|
|
82827
|
+
const words = args.words.slice(2);
|
|
82828
|
+
const [app2, word3] = words.length >= 2 ? words : [void 0, ...words];
|
|
82829
|
+
if (!word3) throw new CliUsageError(usage);
|
|
82830
|
+
return { app: app2, word: word3 };
|
|
82831
|
+
}
|
|
82832
|
+
var rename2 = async ({ context, args, open: open6 }) => {
|
|
82833
|
+
const { app: app2, word: word3 } = appAndWord({ args, usage: "Usage: laze app rename [app] <new name>" });
|
|
82834
|
+
const { client, appId, name: name3 } = await open6(app2);
|
|
82835
|
+
const renamed = await client.post("/api/apps/rename", { appId, name: word3 });
|
|
82836
|
+
print2({ context, args, value: renamed, text: `${name3} is now called ${renamed.name}.
|
|
82837
|
+
` });
|
|
82838
|
+
};
|
|
82839
|
+
var archive = async ({ context, args, open: open6 }) => {
|
|
82840
|
+
const { client, appId } = await open6(args.words[2]);
|
|
82841
|
+
const archived = await client.post("/api/apps/archive", { appId });
|
|
82842
|
+
const text3 = `Archived ${archived.name}: it serves nothing and keeps its versions and data. laze app unarchive brings it back.
|
|
82843
|
+
`;
|
|
82844
|
+
print2({ context, args, value: archived, text: text3 });
|
|
82845
|
+
};
|
|
82846
|
+
var unarchive = async ({ context, args, open: open6 }) => {
|
|
82847
|
+
const { client, appId } = await open6(args.words[2]);
|
|
82848
|
+
const back = await client.post("/api/apps/unarchive", { appId });
|
|
82849
|
+
const text3 = `${back.name} is back at the same addresses.
|
|
82850
|
+
`;
|
|
82851
|
+
print2({ context, args, value: back, text: text3 });
|
|
82852
|
+
};
|
|
82853
|
+
var remove = async ({ context, args, open: open6 }) => {
|
|
82854
|
+
const confirmName = flagText({ args, name: "confirm" });
|
|
82855
|
+
if (!confirmName) {
|
|
82856
|
+
throw new CliUsageError("Usage: laze app delete [app] --confirm <the app's name>");
|
|
82857
|
+
}
|
|
82858
|
+
const { client, appId, name: name3 } = await open6(args.words[2]);
|
|
82859
|
+
await client.post("/api/apps/delete", { appId, confirmName });
|
|
82860
|
+
const text3 = `Deleted ${name3}: it stopped serving and is gone from the workspace.
|
|
82861
|
+
`;
|
|
82862
|
+
print2({ context, args, value: { deleted: appId }, text: text3 });
|
|
82863
|
+
};
|
|
82864
|
+
var revokeLease = async ({ context, args, open: open6 }) => {
|
|
81709
82865
|
const { client, appId, name: name3 } = await open6(args.words[2]);
|
|
81710
82866
|
const app2 = await client.post("/api/apps/publish/revoke-lease", { appId });
|
|
81711
82867
|
const text3 = `${name3}'s builder asks for an approval again before its next public publish.
|
|
@@ -81849,7 +83005,7 @@ var appManageCommands = {
|
|
|
81849
83005
|
};
|
|
81850
83006
|
|
|
81851
83007
|
// src/services/app-pin-commands.service.ts
|
|
81852
|
-
var
|
|
83008
|
+
var USAGE4 = `Usage:
|
|
81853
83009
|
laze app pin [app] --channel <c> [--role builder|editor|viewer | --view-only]
|
|
81854
83010
|
laze app unpin [app] --channel <c>
|
|
81855
83011
|
laze app pins <channel> [--order <app,app,...>]`;
|
|
@@ -81927,7 +83083,7 @@ async function appPinsCommand({
|
|
|
81927
83083
|
signed: signed2
|
|
81928
83084
|
}) {
|
|
81929
83085
|
const channel = args.words[2] ?? flagText({ args, name: "channel" });
|
|
81930
|
-
if (!channel) throw new CliUsageError(
|
|
83086
|
+
if (!channel) throw new CliUsageError(USAGE4);
|
|
81931
83087
|
const client = await signed2();
|
|
81932
83088
|
const order = flagText({ args, name: "order" });
|
|
81933
83089
|
const appIds = order.split(",").map((id4) => id4.trim()).filter(Boolean);
|
|
@@ -81937,9 +83093,9 @@ async function appPinsCommand({
|
|
|
81937
83093
|
|
|
81938
83094
|
// src/services/app-script-check.service.ts
|
|
81939
83095
|
import { execFile } from "node:child_process";
|
|
81940
|
-
import { mkdtemp, rm as
|
|
81941
|
-
import { tmpdir } from "node:os";
|
|
81942
|
-
import { join as
|
|
83096
|
+
import { mkdtemp, rm as rm12, writeFile as writeFile5 } from "node:fs/promises";
|
|
83097
|
+
import { tmpdir as tmpdir3 } from "node:os";
|
|
83098
|
+
import { join as join24 } from "node:path";
|
|
81943
83099
|
import { promisify } from "node:util";
|
|
81944
83100
|
var run2 = promisify(execFile);
|
|
81945
83101
|
var MODULE_SYNTAX = /^\s*(import|export)\s/m;
|
|
@@ -81968,12 +83124,12 @@ async function scriptErrorsOf({
|
|
|
81968
83124
|
const unknown2 = unknownCollectionsOf({ files: files2, collections });
|
|
81969
83125
|
const scripts = files2.flatMap(scriptsOf);
|
|
81970
83126
|
if (scripts.length === 0) return unknown2;
|
|
81971
|
-
const dir = await mkdtemp(
|
|
83127
|
+
const dir = await mkdtemp(join24(tmpdir3(), "laze-app-check-"));
|
|
81972
83128
|
try {
|
|
81973
83129
|
const errors = await Promise.all(
|
|
81974
83130
|
scripts.map(async (script, index) => {
|
|
81975
|
-
const file4 =
|
|
81976
|
-
await
|
|
83131
|
+
const file4 = join24(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
|
|
83132
|
+
await writeFile5(file4, script.code);
|
|
81977
83133
|
try {
|
|
81978
83134
|
await run2(process.execPath, ["--check", file4]);
|
|
81979
83135
|
return null;
|
|
@@ -81985,14 +83141,14 @@ async function scriptErrorsOf({
|
|
|
81985
83141
|
);
|
|
81986
83142
|
return [...errors.filter((error63) => error63 !== null), ...unknown2];
|
|
81987
83143
|
} finally {
|
|
81988
|
-
await
|
|
83144
|
+
await rm12(dir, { recursive: true, force: true });
|
|
81989
83145
|
}
|
|
81990
83146
|
}
|
|
81991
83147
|
|
|
81992
83148
|
// src/services/app-serve.service.ts
|
|
81993
|
-
import { readFile as
|
|
83149
|
+
import { readFile as readFile16, stat as stat9 } from "node:fs/promises";
|
|
81994
83150
|
import { createServer } from "node:http";
|
|
81995
|
-
import { extname as extname2, join as
|
|
83151
|
+
import { extname as extname2, join as join25, normalize, sep as sep2 } from "node:path";
|
|
81996
83152
|
var TYPES2 = {
|
|
81997
83153
|
".html": "text/html; charset=utf-8",
|
|
81998
83154
|
".js": "text/javascript; charset=utf-8",
|
|
@@ -82043,13 +83199,13 @@ async function staticFile({
|
|
|
82043
83199
|
if (clean.startsWith("..") || hidden) {
|
|
82044
83200
|
return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
|
|
82045
83201
|
}
|
|
82046
|
-
const candidates = [
|
|
82047
|
-
if (!extname2(clean)) candidates.push(
|
|
83202
|
+
const candidates = [join25(folder, clean), join25(folder, clean, "index.html")];
|
|
83203
|
+
if (!extname2(clean)) candidates.push(join25(folder, "index.html"));
|
|
82048
83204
|
for (const target of candidates) {
|
|
82049
83205
|
const info = await stat9(target).catch(() => void 0);
|
|
82050
83206
|
if (!info?.isFile()) continue;
|
|
82051
83207
|
const type = TYPES2[extname2(target).toLowerCase()] ?? "application/octet-stream";
|
|
82052
|
-
const body = await
|
|
83208
|
+
const body = await readFile16(target);
|
|
82053
83209
|
if (extname2(target) === ".html") {
|
|
82054
83210
|
return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
|
|
82055
83211
|
}
|
|
@@ -82135,22 +83291,22 @@ async function serveAppFolder({
|
|
|
82135
83291
|
(error63) => failed({ response, error: error63 })
|
|
82136
83292
|
);
|
|
82137
83293
|
});
|
|
82138
|
-
await new Promise((
|
|
83294
|
+
await new Promise((resolve27, reject) => {
|
|
82139
83295
|
server.once("error", reject);
|
|
82140
|
-
server.listen(port, "127.0.0.1", () =>
|
|
83296
|
+
server.listen(port, "127.0.0.1", () => resolve27());
|
|
82141
83297
|
});
|
|
82142
83298
|
const { port: bound } = server.address();
|
|
82143
83299
|
return {
|
|
82144
83300
|
url: `http://127.0.0.1:${bound}/`,
|
|
82145
|
-
close: () => new Promise((
|
|
83301
|
+
close: () => new Promise((resolve27) => {
|
|
82146
83302
|
server.closeAllConnections();
|
|
82147
|
-
server.close(() =>
|
|
83303
|
+
server.close(() => resolve27());
|
|
82148
83304
|
})
|
|
82149
83305
|
};
|
|
82150
83306
|
}
|
|
82151
83307
|
|
|
82152
83308
|
// src/services/app-trigger-commands.service.ts
|
|
82153
|
-
var
|
|
83309
|
+
var USAGE5 = `Usage:
|
|
82154
83310
|
laze app trigger add <collection> --on create,update,delete [--where <json>] --prompt <text>
|
|
82155
83311
|
laze app trigger list
|
|
82156
83312
|
laze app trigger pause|resume <trigger-id>
|
|
@@ -82236,14 +83392,14 @@ async function appTrigger({
|
|
|
82236
83392
|
const [, , verb, word3] = args.words;
|
|
82237
83393
|
if (verb === "list") return list({ context, args, open: open6 });
|
|
82238
83394
|
const known = verb === "add" || verb === "pause" || verb === "resume" || verb === "remove";
|
|
82239
|
-
if (known && !word3) throw new CliUsageError(
|
|
83395
|
+
if (known && !word3) throw new CliUsageError(USAGE5);
|
|
82240
83396
|
if (known && word3) {
|
|
82241
83397
|
const run4 = { context, args, open: open6, word: word3 };
|
|
82242
83398
|
if (verb === "add") return add(run4);
|
|
82243
83399
|
if (verb === "remove") return remove2(run4);
|
|
82244
83400
|
return setPaused({ ...run4, paused: verb === "pause" });
|
|
82245
83401
|
}
|
|
82246
|
-
context.out(`${
|
|
83402
|
+
context.out(`${USAGE5}
|
|
82247
83403
|
`);
|
|
82248
83404
|
if (verb) throw new CliUsageError(`laze app trigger has no command ${verb}`);
|
|
82249
83405
|
}
|
|
@@ -82267,14 +83423,14 @@ async function connectedTurnTokenOf({
|
|
|
82267
83423
|
}
|
|
82268
83424
|
|
|
82269
83425
|
// src/services/app-commands.service.ts
|
|
82270
|
-
var
|
|
83426
|
+
var USAGE6 = `Usage: laze app <command>. The app comes from ${APP_MANIFEST_FILE} in the folder, or --app <id|slug>.
|
|
82271
83427
|
${APP_ARTIFACT_RULE}
|
|
82272
83428
|
${APP_ARTIFACT_RULE}
|
|
82273
83429
|
|
|
82274
83430
|
${appCliCommands.map((entry) => ` ${entry.command} ${entry.arguments.join(" ")}
|
|
82275
83431
|
${entry.summary}`).join("\n")}`;
|
|
82276
83432
|
var MAX_FILES = 2e3;
|
|
82277
|
-
async function
|
|
83433
|
+
async function turnTokenOf3({
|
|
82278
83434
|
context,
|
|
82279
83435
|
args,
|
|
82280
83436
|
client,
|
|
@@ -82284,7 +83440,7 @@ async function turnTokenOf2({
|
|
|
82284
83440
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
82285
83441
|
if (pinned) return pinned;
|
|
82286
83442
|
if (env.LAZE_TURN_FILE) {
|
|
82287
|
-
return
|
|
83443
|
+
return readFile17(env.LAZE_TURN_FILE, "utf8").then(
|
|
82288
83444
|
(text3) => text3.trim(),
|
|
82289
83445
|
() => ""
|
|
82290
83446
|
);
|
|
@@ -82297,7 +83453,7 @@ async function appClient({
|
|
|
82297
83453
|
args
|
|
82298
83454
|
}) {
|
|
82299
83455
|
const { client, profile } = await signedIn({ context, args });
|
|
82300
|
-
const turn = await
|
|
83456
|
+
const turn = await turnTokenOf3({ context, args, client, agent: profile.kind === "agent" });
|
|
82301
83457
|
return turn ? client.withHeaders({ "x-laze-turn": turn }) : client;
|
|
82302
83458
|
}
|
|
82303
83459
|
function noteRetiredFlags({ context, args }) {
|
|
@@ -82311,10 +83467,10 @@ function noteRetiredFlags({ context, args }) {
|
|
|
82311
83467
|
}
|
|
82312
83468
|
}
|
|
82313
83469
|
function folderOf({ context, word: word3 }) {
|
|
82314
|
-
return
|
|
83470
|
+
return resolve9(context.cwd, word3 ?? ".");
|
|
82315
83471
|
}
|
|
82316
83472
|
async function readManifest(folder) {
|
|
82317
|
-
const text3 = await
|
|
83473
|
+
const text3 = await readFile17(join26(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
82318
83474
|
if (text3 === void 0) return void 0;
|
|
82319
83475
|
const parsed = appManifestSchema.safeParse(JSON.parse(text3));
|
|
82320
83476
|
if (!parsed.success) {
|
|
@@ -82355,7 +83511,7 @@ async function jsonFlag({
|
|
|
82355
83511
|
}) {
|
|
82356
83512
|
const raw = flagText({ args, name: name3 });
|
|
82357
83513
|
if (!raw) return void 0;
|
|
82358
|
-
const text3 = raw.startsWith("@") ? await
|
|
83514
|
+
const text3 = raw.startsWith("@") ? await readFile17(resolve9(context.cwd, raw.slice(1)), "utf8") : raw;
|
|
82359
83515
|
try {
|
|
82360
83516
|
return JSON.parse(text3);
|
|
82361
83517
|
} catch {
|
|
@@ -82368,7 +83524,7 @@ async function listFiles(folder) {
|
|
|
82368
83524
|
while (pending2.length > 0 && found.length <= MAX_FILES) {
|
|
82369
83525
|
const current3 = pending2.pop() ?? folder;
|
|
82370
83526
|
for (const entry of await readdir7(current3, { withFileTypes: true })) {
|
|
82371
|
-
const path =
|
|
83527
|
+
const path = join26(current3, entry.name);
|
|
82372
83528
|
const rel = relative3(folder, path).split(sep3).join("/");
|
|
82373
83529
|
if (isSkippedPath({ path: rel })) continue;
|
|
82374
83530
|
if (entry.isDirectory()) pending2.push(path);
|
|
@@ -82390,7 +83546,7 @@ function print5({
|
|
|
82390
83546
|
}
|
|
82391
83547
|
var appCreate = async ({ context, args }) => {
|
|
82392
83548
|
const name3 = args.words.slice(2).join(" ").trim();
|
|
82393
|
-
if (!name3) throw new CliUsageError(
|
|
83549
|
+
if (!name3) throw new CliUsageError(USAGE6);
|
|
82394
83550
|
const template = flagText({ args, name: "template" });
|
|
82395
83551
|
const client = await appClient({ context, args });
|
|
82396
83552
|
const channel = flagText({ args, name: "channel" });
|
|
@@ -82403,13 +83559,13 @@ var appCreate = async ({ context, args }) => {
|
|
|
82403
83559
|
...visibility ? { visibility } : {},
|
|
82404
83560
|
...template ? { template } : {}
|
|
82405
83561
|
});
|
|
82406
|
-
const folder =
|
|
82407
|
-
await
|
|
83562
|
+
const folder = resolve9(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
|
|
83563
|
+
await mkdir7(folder, { recursive: true });
|
|
82408
83564
|
const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
|
|
82409
83565
|
for (const file4 of start2?.files ?? []) {
|
|
82410
|
-
const target =
|
|
82411
|
-
await
|
|
82412
|
-
await
|
|
83566
|
+
const target = join26(folder, ...file4.path.split("/"));
|
|
83567
|
+
await mkdir7(dirname16(target), { recursive: true });
|
|
83568
|
+
await writeFile6(
|
|
82413
83569
|
target,
|
|
82414
83570
|
file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
|
|
82415
83571
|
);
|
|
@@ -82420,7 +83576,7 @@ var appCreate = async ({ context, args }) => {
|
|
|
82420
83576
|
views: [...start2?.template.views ?? []],
|
|
82421
83577
|
seed: { ...start2?.template.seed }
|
|
82422
83578
|
};
|
|
82423
|
-
await
|
|
83579
|
+
await writeFile6(join26(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
82424
83580
|
`);
|
|
82425
83581
|
const where = relative3(context.cwd, folder) || ".";
|
|
82426
83582
|
print5({
|
|
@@ -82492,7 +83648,7 @@ var appPush = async ({ context, args }) => {
|
|
|
82492
83648
|
paths.map(
|
|
82493
83649
|
async (path) => buildFileOf({
|
|
82494
83650
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
82495
|
-
bytes: await
|
|
83651
|
+
bytes: await readFile17(path)
|
|
82496
83652
|
})
|
|
82497
83653
|
)
|
|
82498
83654
|
);
|
|
@@ -82559,10 +83715,10 @@ var appWrite = async ({ context, args }) => {
|
|
|
82559
83715
|
const remove8 = (flagText({ args, name: "remove" }) ?? "").split(",").map((path) => path.trim()).filter(Boolean);
|
|
82560
83716
|
const files2 = await Promise.all(
|
|
82561
83717
|
words.slice(2).map(async (word3) => {
|
|
82562
|
-
const path =
|
|
83718
|
+
const path = resolve9(context.cwd, word3);
|
|
82563
83719
|
const { bytes: _bytes, ...file4 } = buildFileOf({
|
|
82564
83720
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
82565
|
-
bytes: await
|
|
83721
|
+
bytes: await readFile17(path)
|
|
82566
83722
|
});
|
|
82567
83723
|
return file4;
|
|
82568
83724
|
})
|
|
@@ -82689,9 +83845,9 @@ var appPull = async ({ context, args }) => {
|
|
|
82689
83845
|
);
|
|
82690
83846
|
}
|
|
82691
83847
|
for (const file4 of pulled.files) {
|
|
82692
|
-
const target =
|
|
82693
|
-
await
|
|
82694
|
-
await
|
|
83848
|
+
const target = join26(folder, ...file4.path.split("/"));
|
|
83849
|
+
await mkdir7(dirname16(target), { recursive: true });
|
|
83850
|
+
await writeFile6(
|
|
82695
83851
|
target,
|
|
82696
83852
|
file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
|
|
82697
83853
|
);
|
|
@@ -82708,7 +83864,7 @@ var appPull = async ({ context, args }) => {
|
|
|
82708
83864
|
])
|
|
82709
83865
|
)
|
|
82710
83866
|
};
|
|
82711
|
-
await
|
|
83867
|
+
await writeFile6(join26(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
82712
83868
|
`);
|
|
82713
83869
|
const names = pulled.collections.map((collection) => collection.name);
|
|
82714
83870
|
const where = relative3(context.cwd, folder) || ".";
|
|
@@ -82755,6 +83911,7 @@ The app keeps serving the version that was live until then; the request expires
|
|
|
82755
83911
|
if (request2.status === "denied") return "The publish was denied.\n";
|
|
82756
83912
|
const audience = PUBLISH_AUDIENCE[request2.visibility];
|
|
82757
83913
|
return `Live for ${audience}: ${outcome.app.publishedUrl}
|
|
83914
|
+
See how it renders before you say it is ready: laze app screenshot [file], or laze app open to show it in a browser tab.
|
|
82758
83915
|
`;
|
|
82759
83916
|
}
|
|
82760
83917
|
async function versionOf({
|
|
@@ -82792,7 +83949,7 @@ var appVersions = async ({ context, args }) => {
|
|
|
82792
83949
|
};
|
|
82793
83950
|
var appRevert = async ({ context, args }) => {
|
|
82794
83951
|
const prefix = messageOf({ args }).words[2];
|
|
82795
|
-
if (!prefix) throw new CliUsageError(
|
|
83952
|
+
if (!prefix) throw new CliUsageError(USAGE6);
|
|
82796
83953
|
const client = await appClient({ context, args });
|
|
82797
83954
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
82798
83955
|
const { message: message2 } = messageOf({ args });
|
|
@@ -82825,7 +83982,7 @@ var appMakeInternal = async ({ context, args }) => {
|
|
|
82825
83982
|
var appName = async ({ context, args }) => {
|
|
82826
83983
|
const [, , prefix, ...rest] = args.words;
|
|
82827
83984
|
const name3 = rest.join(" ").trim();
|
|
82828
|
-
if (!prefix || !name3) throw new CliUsageError(
|
|
83985
|
+
if (!prefix || !name3) throw new CliUsageError(USAGE6);
|
|
82829
83986
|
const client = await appClient({ context, args });
|
|
82830
83987
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
82831
83988
|
const version2 = await client.post("/api/apps/versions/name", {
|
|
@@ -82852,7 +84009,7 @@ var appCollections = async ({ context, args }) => {
|
|
|
82852
84009
|
if (args.words[2] === "define") {
|
|
82853
84010
|
const name3 = args.words[3];
|
|
82854
84011
|
const fields = await jsonFlag({ context, args, name: "fields" });
|
|
82855
|
-
if (!name3 || !Array.isArray(fields)) throw new CliUsageError(
|
|
84012
|
+
if (!name3 || !Array.isArray(fields)) throw new CliUsageError(USAGE6);
|
|
82856
84013
|
const collection = await client.post("/api/apps/collections/define", {
|
|
82857
84014
|
appId,
|
|
82858
84015
|
name: name3,
|
|
@@ -82959,7 +84116,7 @@ function recordPageText({ records }) {
|
|
|
82959
84116
|
}
|
|
82960
84117
|
var appRecords = async ({ context, args }) => {
|
|
82961
84118
|
const [, , action = "list", collection] = args.words;
|
|
82962
|
-
if (!collection) throw new CliUsageError(
|
|
84119
|
+
if (!collection) throw new CliUsageError(USAGE6);
|
|
82963
84120
|
const client = await appClient({ context, args });
|
|
82964
84121
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
82965
84122
|
noteRetiredFlags({ context, args });
|
|
@@ -82980,7 +84137,7 @@ var appRecords = async ({ context, args }) => {
|
|
|
82980
84137
|
}
|
|
82981
84138
|
if (action === "delete") {
|
|
82982
84139
|
const recordId = args.words[4];
|
|
82983
|
-
if (!recordId) throw new CliUsageError(
|
|
84140
|
+
if (!recordId) throw new CliUsageError(USAGE6);
|
|
82984
84141
|
await client.post("/api/apps/records/delete", { appId, collection, recordId });
|
|
82985
84142
|
return context.out(`Deleted ${recordId}
|
|
82986
84143
|
`);
|
|
@@ -83004,7 +84161,7 @@ var appRecords = async ({ context, args }) => {
|
|
|
83004
84161
|
};
|
|
83005
84162
|
var appExport = async ({ context, args }) => {
|
|
83006
84163
|
const collection = args.words[2];
|
|
83007
|
-
if (!collection) throw new CliUsageError(
|
|
84164
|
+
if (!collection) throw new CliUsageError(USAGE6);
|
|
83008
84165
|
const client = await appClient({ context, args });
|
|
83009
84166
|
const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
|
|
83010
84167
|
const exported = await client.post("/api/apps/export", {
|
|
@@ -83014,16 +84171,16 @@ var appExport = async ({ context, args }) => {
|
|
|
83014
84171
|
});
|
|
83015
84172
|
const out = flagText({ args, name: "out" });
|
|
83016
84173
|
if (!out) return context.out(exported.body);
|
|
83017
|
-
const target =
|
|
83018
|
-
await
|
|
84174
|
+
const target = resolve9(context.cwd, out);
|
|
84175
|
+
await writeFile6(target, exported.body);
|
|
83019
84176
|
context.out(`Wrote ${exported.rows} records to ${relative3(context.cwd, target)}
|
|
83020
84177
|
`);
|
|
83021
84178
|
};
|
|
83022
84179
|
var appImport = async ({ context, args }) => {
|
|
83023
84180
|
const words = args.words.slice(2);
|
|
83024
84181
|
const [named, collection, file4] = words.length >= 3 ? words : [void 0, ...words];
|
|
83025
|
-
if (!collection || !file4) throw new CliUsageError(
|
|
83026
|
-
const csv = await
|
|
84182
|
+
if (!collection || !file4) throw new CliUsageError(USAGE6);
|
|
84183
|
+
const csv = await readFile17(resolve9(context.cwd, file4), "utf8").catch(() => {
|
|
83027
84184
|
throw new CliUsageError(`Cannot read ${file4}`);
|
|
83028
84185
|
});
|
|
83029
84186
|
const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
|
|
@@ -83041,7 +84198,7 @@ var appImport = async ({ context, args }) => {
|
|
|
83041
84198
|
});
|
|
83042
84199
|
const refusedOut = flagText({ args, name: "refused" });
|
|
83043
84200
|
if (refusedOut && result2.refusedCsv) {
|
|
83044
|
-
await
|
|
84201
|
+
await writeFile6(resolve9(context.cwd, refusedOut), result2.refusedCsv);
|
|
83045
84202
|
}
|
|
83046
84203
|
const fitting = result2.rows - result2.refused.length;
|
|
83047
84204
|
const skipped = result2.refused.slice(0, 20).map((row) => ` line ${row.line}: ${row.reason}
|
|
@@ -83094,6 +84251,13 @@ function roleOf(word3) {
|
|
|
83094
84251
|
if (!role2) throw new CliUsageError("The role is viewer, editor or builder");
|
|
83095
84252
|
return role2;
|
|
83096
84253
|
}
|
|
84254
|
+
function externalRoleOf(word3) {
|
|
84255
|
+
const role2 = word3?.toLowerCase();
|
|
84256
|
+
if (role2 !== "viewer" && role2 !== "builder") {
|
|
84257
|
+
throw new CliUsageError("The role for other workspaces is viewer or builder");
|
|
84258
|
+
}
|
|
84259
|
+
return role2;
|
|
84260
|
+
}
|
|
83097
84261
|
function isSubjectType(type) {
|
|
83098
84262
|
return type === "user" || type === "agent" || type === "channel" || type === "group";
|
|
83099
84263
|
}
|
|
@@ -83122,6 +84286,9 @@ function accessText(access) {
|
|
|
83122
84286
|
...(access.pins ?? []).map(
|
|
83123
84287
|
(pin) => ` pinned in ${pin.name ?? pin.channelId} (${pin.channelId}) ${ROLE_NAMES[pin.role]}`
|
|
83124
84288
|
),
|
|
84289
|
+
...(access.external?.channels ?? []).map(
|
|
84290
|
+
(channel) => ` shared with ${channel.workspaceName} in ${channel.name ?? channel.channelId}: their people at most ${ROLE_NAMES[access.external.role]}`
|
|
84291
|
+
),
|
|
83125
84292
|
...access.requests.map(
|
|
83126
84293
|
(request2) => ` asks for access: ${request2.userName ?? request2.userId} (${request2.id})`
|
|
83127
84294
|
),
|
|
@@ -83147,7 +84314,7 @@ async function decideAsk({
|
|
|
83147
84314
|
decision,
|
|
83148
84315
|
role: role2
|
|
83149
84316
|
}) {
|
|
83150
|
-
if (!requestId) throw new CliUsageError(
|
|
84317
|
+
if (!requestId) throw new CliUsageError(USAGE6);
|
|
83151
84318
|
const answer6 = await client.post("/api/apps/access/decide", {
|
|
83152
84319
|
appId,
|
|
83153
84320
|
requestId,
|
|
@@ -83180,6 +84347,11 @@ var ACCESS_ACTIONS = {
|
|
|
83180
84347
|
path: "/api/apps/access/member-role",
|
|
83181
84348
|
body: { appId, role: roleOf(first) }
|
|
83182
84349
|
}),
|
|
84350
|
+
"external-role": ({ client, appId, first }) => shownAccess({
|
|
84351
|
+
client,
|
|
84352
|
+
path: "/api/apps/access/external-role",
|
|
84353
|
+
body: { appId, role: externalRoleOf(first) }
|
|
84354
|
+
}),
|
|
83183
84355
|
"pin-role": async ({ client, appId, first, second }) => {
|
|
83184
84356
|
const access = await client.post("/api/apps/access", { appId });
|
|
83185
84357
|
const word3 = (first ?? "").replace(/^#/, "");
|
|
@@ -83263,7 +84435,7 @@ var appAccess = async ({ context, args }) => {
|
|
|
83263
84435
|
return;
|
|
83264
84436
|
}
|
|
83265
84437
|
const run4 = Object.hasOwn(ACCESS_ACTIONS, action) ? ACCESS_ACTIONS[action] : void 0;
|
|
83266
|
-
if (!run4) throw new CliUsageError(
|
|
84438
|
+
if (!run4) throw new CliUsageError(USAGE6);
|
|
83267
84439
|
print5({ context, args, ...await run4({ client, appId, first, second }) });
|
|
83268
84440
|
};
|
|
83269
84441
|
var appRequest = async ({ context, args }) => {
|
|
@@ -83346,7 +84518,7 @@ var appUpgrade = async ({ context, args }) => {
|
|
|
83346
84518
|
var appBudget = async ({ context, args }) => {
|
|
83347
84519
|
const words = args.words.slice(2);
|
|
83348
84520
|
const [word3, amount] = words.length >= 2 ? words : [void 0, ...words];
|
|
83349
|
-
if (!amount) throw new CliUsageError(
|
|
84521
|
+
if (!amount) throw new CliUsageError(USAGE6);
|
|
83350
84522
|
const monthly = amount === "none" ? null : Number(amount);
|
|
83351
84523
|
if (monthly !== null && (!Number.isFinite(monthly) || monthly < 0.01)) {
|
|
83352
84524
|
throw new CliUsageError("The budget is an amount such as 5 or 12.50, or none");
|
|
@@ -83372,6 +84544,8 @@ var APP_COMMANDS = {
|
|
|
83372
84544
|
write: appWrite,
|
|
83373
84545
|
url: appUrl,
|
|
83374
84546
|
preview: appUrl,
|
|
84547
|
+
open: ({ context, args }) => appOpen({ context, args, open: () => appOfWord({ context, args, word: args.words[2] }) }),
|
|
84548
|
+
screenshot: ({ context, args }) => appScreenshot({ context, args, open: () => appOfWord({ context, args, word: void 0 }) }),
|
|
83375
84549
|
serve: appServe,
|
|
83376
84550
|
pull: appPull,
|
|
83377
84551
|
publish: appPublish,
|
|
@@ -83432,7 +84606,7 @@ async function app({ context, args }) {
|
|
|
83432
84606
|
const name3 = args.words[1] ?? "";
|
|
83433
84607
|
const command = Object.hasOwn(APP_COMMANDS, name3) ? APP_COMMANDS[name3] : void 0;
|
|
83434
84608
|
if (!command) {
|
|
83435
|
-
context.out(`${
|
|
84609
|
+
context.out(`${USAGE6}
|
|
83436
84610
|
`);
|
|
83437
84611
|
if (name3) throw new CliUsageError(`laze app has no command ${name3}`);
|
|
83438
84612
|
return;
|
|
@@ -83441,14 +84615,14 @@ async function app({ context, args }) {
|
|
|
83441
84615
|
}
|
|
83442
84616
|
|
|
83443
84617
|
// src/services/auth-commands.service.ts
|
|
83444
|
-
import { hostname as
|
|
84618
|
+
import { hostname as hostname7 } from "node:os";
|
|
83445
84619
|
|
|
83446
84620
|
// src/rules/machine-proof.rules.ts
|
|
83447
|
-
import { createHash as
|
|
84621
|
+
import { createHash as createHash6, randomBytes as randomBytes2 } from "node:crypto";
|
|
83448
84622
|
var b64url3 = (bytes) => Buffer.from(bytes).toString("base64url");
|
|
83449
84623
|
function thumbprintOf({ jwk }) {
|
|
83450
84624
|
const canonical = JSON.stringify({ crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y });
|
|
83451
|
-
return b64url3(
|
|
84625
|
+
return b64url3(createHash6("sha256").update(canonical).digest());
|
|
83452
84626
|
}
|
|
83453
84627
|
function lazeTokenOf({ authorization }) {
|
|
83454
84628
|
const match = /^Bearer (lz_\S+)$/.exec(authorization ?? "");
|
|
@@ -83472,7 +84646,7 @@ function machineProofOf({
|
|
|
83472
84646
|
htu: url2,
|
|
83473
84647
|
iat: Math.floor(nowMs2 / 1e3),
|
|
83474
84648
|
jti,
|
|
83475
|
-
ath: b64url3(
|
|
84649
|
+
ath: b64url3(createHash6("sha256").update(credential).digest()),
|
|
83476
84650
|
lz_tier: tier,
|
|
83477
84651
|
...tailscaleNodeId ? { lz_ts: tailscaleNodeId } : {}
|
|
83478
84652
|
})
|
|
@@ -83545,7 +84719,7 @@ async function deviceToken({
|
|
|
83545
84719
|
clientName: flagText({
|
|
83546
84720
|
args,
|
|
83547
84721
|
name: "client",
|
|
83548
|
-
fallback: `laze CLI on ${
|
|
84722
|
+
fallback: `laze CLI on ${hostname7()}`.slice(0, 80)
|
|
83549
84723
|
}),
|
|
83550
84724
|
...machineKey ? { machineKey } : {}
|
|
83551
84725
|
});
|
|
@@ -83614,983 +84788,284 @@ async function whoami({ context, args }) {
|
|
|
83614
84788
|
context.out(`${who} in workspace ${me.workspaceId} at ${profile.url}, profile "${name3}"
|
|
83615
84789
|
`);
|
|
83616
84790
|
if (profile.kind === "person") await machineLine({ context });
|
|
83617
|
-
if (me.language || me.timeZone) {
|
|
83618
|
-
const whose = me.kind === "agent" ? "Owner's language" : "Language";
|
|
83619
|
-
context.out(`${whose} ${me.language ?? "en-US"}, time zone ${me.timeZone ?? "UTC"}
|
|
83620
|
-
`);
|
|
83621
|
-
}
|
|
83622
|
-
}
|
|
83623
|
-
async function workspaces({ context, args }) {
|
|
83624
|
-
const config2 = await context.store.read();
|
|
83625
|
-
const entries = Object.entries(config2.profiles);
|
|
83626
|
-
if (entries.length === 0) return context.out("Not signed in: run `laze login` first.\n");
|
|
83627
|
-
const active = await signedIn({ context, args }).catch(() => void 0);
|
|
83628
|
-
for (const [name3, profile] of entries) {
|
|
83629
|
-
const star2 = active?.name === name3 ? "*" : " ";
|
|
83630
|
-
context.out(
|
|
83631
|
-
`${star2} ${name3} ${profile.workspaceId} ${profile.kind} ${profile.name} ${profile.url}
|
|
83632
|
-
`
|
|
83633
|
-
);
|
|
83634
|
-
}
|
|
83635
|
-
}
|
|
83636
|
-
async function changes({ context, args }) {
|
|
83637
|
-
const { client } = await signedIn({ context, args });
|
|
83638
|
-
const list12 = await client.get("/api/agents/me/changes");
|
|
83639
|
-
if (args.flags.json) return context.out(`${JSON.stringify(list12, null, 2)}
|
|
83640
|
-
`);
|
|
83641
|
-
if (list12.length === 0) return context.out("No recent changes.\n");
|
|
83642
|
-
for (const change2 of list12) {
|
|
83643
|
-
const lifted = change2.codes.length > 0 ? ` (lifts ${change2.codes.join(", ")})` : "";
|
|
83644
|
-
context.out(`${change2.date}${lifted}: ${change2.text}
|
|
83645
|
-
`);
|
|
83646
|
-
}
|
|
83647
|
-
}
|
|
83648
|
-
|
|
83649
|
-
// src/services/billing-commands.service.ts
|
|
83650
|
-
var BILLING_USAGE = `Usage:
|
|
83651
|
-
laze billing [account] the plan, people, credits, auto-recharge and referral
|
|
83652
|
-
laze billing invoices the workspace's invoices
|
|
83653
|
-
laze billing checkout [--currency usd|eur] a Stripe Checkout link that starts Team (admins)
|
|
83654
|
-
laze billing portal a Stripe link to manage cards and invoices (admins)
|
|
83655
|
-
laze billing currency usd|eur bill in USD or EUR, until the first payment (admins)
|
|
83656
|
-
laze billing top-up <amount> a Stripe link that adds prepaid credits, 10 or more (admins)
|
|
83657
|
-
laze billing auto-recharge on|off [--amount <n>] [--limit <n>] (admins)
|
|
83658
|
-
laze billing referral <code> apply another workspace's referral code (admins)
|
|
83659
|
-
laze billing details the company, address, billing email and tax id on invoices (admins)
|
|
83660
|
-
laze billing details set --company <name> --email <billing email> --line1 <street> --city <city>
|
|
83661
|
-
--country <NL> [--postal <code>] [--line2 <text>] [--state <text>]
|
|
83662
|
-
[--tax-id <NL123456789B01>|none] [--tax-type eu_vat|gb_vat|ch_vat|no_vat|us_ein|au_abn|ca_bn] (admins)
|
|
83663
|
-
laze billing cancel end Team at the end of the paid period (admins)
|
|
83664
|
-
laze billing keep keep Team after a cancellation (admins)`;
|
|
83665
|
-
var printJson = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
83666
|
-
`);
|
|
83667
|
-
async function plan({ context, args }) {
|
|
83668
|
-
const { client } = await signedIn({ context, args });
|
|
83669
|
-
const active = await client.get("/api/entitlements/plan");
|
|
83670
|
-
if (args.flags.json) return printJson(context, active);
|
|
83671
|
-
context.out(`Plan: ${active.plan}
|
|
83672
|
-
`);
|
|
83673
|
-
context.out(`Features: ${active.features.length > 0 ? active.features.join(", ") : "none"}
|
|
83674
|
-
`);
|
|
83675
|
-
}
|
|
83676
|
-
function money(amount, currency2) {
|
|
83677
|
-
return `${Number(amount.toFixed(2))} ${currency2.toUpperCase()}`;
|
|
83678
|
-
}
|
|
83679
|
-
function amountOf({ text: text3, what }) {
|
|
83680
|
-
const value = Number(text3);
|
|
83681
|
-
if (!text3 || !Number.isFinite(value) || value <= 0) {
|
|
83682
|
-
throw new CliUsageError(`${what} takes an amount.
|
|
83683
|
-
${BILLING_USAGE}`);
|
|
83684
|
-
}
|
|
83685
|
-
return value;
|
|
83686
|
-
}
|
|
83687
|
-
function prepaidNoteOf(account, of) {
|
|
83688
|
-
const { prepaid, overdraft = 0, welcome = 0 } = account.credits;
|
|
83689
|
-
const notes = [
|
|
83690
|
-
prepaid < 0 ? `${of(-prepaid)} owed, paid first by the next top-up` : null,
|
|
83691
|
-
overdraft > 0 ? `may go down to -${of(overdraft)}` : null,
|
|
83692
|
-
welcome > 0 ? `welcome credit, ${of(welcome)}` : null
|
|
83693
|
-
].filter((note) => note !== null);
|
|
83694
|
-
return notes.length > 0 ? ` (${notes.join(", ")})` : "";
|
|
83695
|
-
}
|
|
83696
|
-
function printAccount({ context, args }, account) {
|
|
83697
|
-
if (args.flags.json) return printJson(context, account);
|
|
83698
|
-
const of = (amount) => money(amount, account.currency);
|
|
83699
|
-
const plan2 = account.plan === "team" ? `Team, ${of(account.seats.monthlyPrice)} a month for ${account.seats.people} people` : "Free, for one person";
|
|
83700
|
-
const pending2 = account.status === "pending_payment" ? " (payment pending: run laze billing checkout)" : "";
|
|
83701
|
-
const ending = account.cancelAtPeriodEnd && account.period ? ` (ends ${account.period.end.slice(0, 10)}: run laze billing keep to renew)` : "";
|
|
83702
|
-
context.out(`Plan: ${plan2}${pending2}${ending}
|
|
83703
|
-
`);
|
|
83704
|
-
if (account.paymentIssue) {
|
|
83705
|
-
const link2 = account.paymentIssue.invoiceUrl ? ` ${account.paymentIssue.invoiceUrl}` : "";
|
|
83706
|
-
context.out(`Payment: ${account.paymentIssue.message ?? account.paymentIssue.kind}${link2}
|
|
83707
|
-
`);
|
|
83708
|
-
}
|
|
83709
|
-
context.out(
|
|
83710
|
-
`Credits: ${of(account.credits.includedLeft)} of ${of(account.credits.included)} included left, ${of(account.credits.prepaid)} prepaid${prepaidNoteOf(account, of)}${account.credits.paused ? " (paused: top up to resume)" : ""}
|
|
83711
|
-
`
|
|
83712
|
-
);
|
|
83713
|
-
const recharge = account.autoRecharge;
|
|
83714
|
-
const rechargeLine = recharge.enabled ? `on, ${recharge.amount === null ? "after the first top-up" : of(recharge.amount)} when under ${of(recharge.rechargeBelow)}, limit ${recharge.monthlyLimit === null ? "set by the first top-up" : of(recharge.monthlyLimit)} a month (${of(recharge.rechargedThisMonth)} so far)` : "off";
|
|
83715
|
-
context.out(`Auto-recharge: ${rechargeLine}
|
|
83716
|
-
`);
|
|
83717
|
-
if (recharge.lastFailure) context.out(`Last recharge failed: ${recharge.lastFailure.message}
|
|
83718
|
-
`);
|
|
83719
|
-
context.out(`Used this period: ${of(account.usage.used)}
|
|
83720
|
-
`);
|
|
83721
|
-
context.out(
|
|
83722
|
-
`Referral: ${account.referral.url} (code ${account.referral.code}, used by ${account.referral.referred})
|
|
83723
|
-
`
|
|
83724
|
-
);
|
|
83725
|
-
}
|
|
83726
|
-
async function show({ context, args }) {
|
|
83727
|
-
const { client } = await signedIn({ context, args });
|
|
83728
|
-
printAccount({ context, args }, await client.get("/api/billing-account"));
|
|
83729
|
-
}
|
|
83730
|
-
async function invoices({ context, args }) {
|
|
83731
|
-
const { client } = await signedIn({ context, args });
|
|
83732
|
-
const list12 = await client.get("/api/billing-account/invoices");
|
|
83733
|
-
if (args.flags.json) return printJson(context, list12);
|
|
83734
|
-
if (list12.length === 0) return context.out("No invoices yet.\n");
|
|
83735
|
-
for (const invoice of list12) {
|
|
83736
|
-
const link2 = invoice.hostedUrl ? ` ${invoice.hostedUrl}` : "";
|
|
83737
|
-
const tax = invoice.tax ? ` (tax ${money(invoice.tax, invoice.currency)})` : "";
|
|
83738
|
-
context.out(
|
|
83739
|
-
`${invoice.createdAt.slice(0, 10)} ${invoice.number ?? "draft"} ${invoice.status} ${money(invoice.total, invoice.currency)}${tax}${link2}
|
|
83740
|
-
`
|
|
83741
|
-
);
|
|
83742
|
-
}
|
|
83743
|
-
}
|
|
83744
|
-
async function checkout({ context, args }) {
|
|
83745
|
-
const { client } = await signedIn({ context, args });
|
|
83746
|
-
const currency2 = flagText({ args, name: "currency" });
|
|
83747
|
-
if (currency2 && currency2 !== "usd" && currency2 !== "eur") {
|
|
83748
|
-
throw new CliUsageError(`--currency takes usd or eur.
|
|
83749
|
-
${BILLING_USAGE}`);
|
|
83750
|
-
}
|
|
83751
|
-
const { url: url2 } = await client.post(
|
|
83752
|
-
"/api/billing-account/checkout",
|
|
83753
|
-
currency2 ? { currency: currency2 } : {}
|
|
83754
|
-
);
|
|
83755
|
-
context.out(`Open this link to start Team: ${url2}
|
|
83756
|
-
`);
|
|
83757
|
-
}
|
|
83758
|
-
async function portal({ context, args }) {
|
|
83759
|
-
const { client } = await signedIn({ context, args });
|
|
83760
|
-
const { url: url2 } = await client.post("/api/billing-account/portal", {});
|
|
83761
|
-
context.out(`${url2}
|
|
83762
|
-
`);
|
|
83763
|
-
}
|
|
83764
|
-
async function currency({ context, args }) {
|
|
83765
|
-
const value = args.words[2];
|
|
83766
|
-
if (value !== "usd" && value !== "eur") throw new CliUsageError(BILLING_USAGE);
|
|
83767
|
-
const { client } = await signedIn({ context, args });
|
|
83768
|
-
printAccount(
|
|
83769
|
-
{ context, args },
|
|
83770
|
-
await client.post("/api/billing-account/currency", { currency: value })
|
|
83771
|
-
);
|
|
83772
|
-
}
|
|
83773
|
-
async function topUp({ context, args }) {
|
|
83774
|
-
const amount = amountOf({ text: args.words[2], what: "top-up" });
|
|
83775
|
-
const { client } = await signedIn({ context, args });
|
|
83776
|
-
const { url: url2 } = await client.post("/api/billing-account/top-up", { amount });
|
|
83777
|
-
context.out(`Open this link to pay: ${url2}
|
|
83778
|
-
`);
|
|
83779
|
-
}
|
|
83780
|
-
async function autoRecharge({ context, args }) {
|
|
83781
|
-
const state = args.words[2];
|
|
83782
|
-
if (state !== "on" && state !== "off") throw new CliUsageError(BILLING_USAGE);
|
|
83783
|
-
const amountText = flagText({ args, name: "amount" });
|
|
83784
|
-
const limitText = flagText({ args, name: "limit" });
|
|
83785
|
-
const { client } = await signedIn({ context, args });
|
|
83786
|
-
const account = await client.post("/api/billing-account/auto-recharge", {
|
|
83787
|
-
enabled: state === "on",
|
|
83788
|
-
...amountText ? { amount: amountOf({ text: amountText, what: "--amount" }) } : {},
|
|
83789
|
-
...limitText ? { monthlyLimit: amountOf({ text: limitText, what: "--limit" }) } : {}
|
|
83790
|
-
});
|
|
83791
|
-
printAccount({ context, args }, account);
|
|
83792
|
-
}
|
|
83793
|
-
async function referral({ context, args }) {
|
|
83794
|
-
const code = args.words[2];
|
|
83795
|
-
if (!code) throw new CliUsageError(BILLING_USAGE);
|
|
83796
|
-
const { client } = await signedIn({ context, args });
|
|
83797
|
-
printAccount(
|
|
83798
|
-
{ context, args },
|
|
83799
|
-
await client.post("/api/billing-account/referral", { code })
|
|
83800
|
-
);
|
|
83801
|
-
}
|
|
83802
|
-
function addressLine(address) {
|
|
83803
|
-
if (!address) return "not set";
|
|
83804
|
-
const town = [address.postalCode, address.city].filter(Boolean).join(" ");
|
|
83805
|
-
return [address.line1, address.line2, town, address.state, address.country].filter(Boolean).join(", ");
|
|
83806
|
-
}
|
|
83807
|
-
function printDetails({ context, args }, details2) {
|
|
83808
|
-
if (args.flags.json) return printJson(context, details2);
|
|
83809
|
-
const taxId = details2.taxId ? `${details2.taxId.value} (${details2.taxId.type}, ${details2.taxId.status})` : "none";
|
|
83810
|
-
context.out(`Company: ${details2.companyName ?? "not set"}
|
|
83811
|
-
`);
|
|
83812
|
-
context.out(`Billing email: ${details2.email ?? "not set"}
|
|
83813
|
-
`);
|
|
83814
|
-
context.out(`Address: ${addressLine(details2.address)}
|
|
83815
|
-
`);
|
|
83816
|
-
context.out(`Tax id: ${taxId}
|
|
83817
|
-
`);
|
|
83818
|
-
if (details2.taxIdRemoved) {
|
|
83819
|
-
context.out(
|
|
83820
|
-
`Removed: ${details2.taxIdRemoved.value}, which the EU VAT service rejected; invoices carry VAT until a valid number is set
|
|
83821
|
-
`
|
|
83822
|
-
);
|
|
83823
|
-
}
|
|
83824
|
-
}
|
|
83825
|
-
var TAX_TYPES = ["eu_vat", "gb_vat", "ch_vat", "no_vat", "us_ein", "au_abn", "ca_bn"];
|
|
83826
|
-
function needed({ args, name: name3 }) {
|
|
83827
|
-
const value = flagText({ args, name: name3 });
|
|
83828
|
-
if (!value) throw new CliUsageError(`--${name3} is needed.
|
|
83829
|
-
${BILLING_USAGE}`);
|
|
83830
|
-
return value;
|
|
83831
|
-
}
|
|
83832
|
-
function detailsBody({ args }) {
|
|
83833
|
-
const taxText = flagText({ args, name: "tax-id" });
|
|
83834
|
-
const taxType = flagText({ args, name: "tax-type" }) || "eu_vat";
|
|
83835
|
-
if (!TAX_TYPES.includes(taxType)) {
|
|
83836
|
-
throw new CliUsageError(`--tax-type takes ${TAX_TYPES.join(", ")}.
|
|
83837
|
-
${BILLING_USAGE}`);
|
|
83838
|
-
}
|
|
83839
|
-
return {
|
|
83840
|
-
companyName: needed({ args, name: "company" }),
|
|
83841
|
-
email: needed({ args, name: "email" }),
|
|
83842
|
-
address: {
|
|
83843
|
-
line1: needed({ args, name: "line1" }),
|
|
83844
|
-
line2: flagText({ args, name: "line2" }) || null,
|
|
83845
|
-
city: needed({ args, name: "city" }),
|
|
83846
|
-
postalCode: flagText({ args, name: "postal" }) || null,
|
|
83847
|
-
state: flagText({ args, name: "state" }) || null,
|
|
83848
|
-
country: needed({ args, name: "country" })
|
|
83849
|
-
},
|
|
83850
|
-
taxId: !taxText || taxText === "none" ? null : { type: taxType, value: taxText }
|
|
83851
|
-
};
|
|
83852
|
-
}
|
|
83853
|
-
async function details({ context, args }) {
|
|
83854
|
-
const action = args.words[2];
|
|
83855
|
-
if (action !== void 0 && action !== "set") throw new CliUsageError(BILLING_USAGE);
|
|
83856
|
-
const body = action === "set" ? detailsBody({ args }) : null;
|
|
83857
|
-
const { client } = await signedIn({ context, args });
|
|
83858
|
-
const answer6 = body ? await client.post("/api/billing-account/details", body) : await client.get("/api/billing-account/details");
|
|
83859
|
-
printDetails({ context, args }, answer6);
|
|
83860
|
-
}
|
|
83861
|
-
async function cancel({ context, args }) {
|
|
83862
|
-
const { client } = await signedIn({ context, args });
|
|
83863
|
-
printAccount({ context, args }, await client.post("/api/billing-account/cancel", {}));
|
|
83864
|
-
}
|
|
83865
|
-
async function keep({ context, args }) {
|
|
83866
|
-
const { client } = await signedIn({ context, args });
|
|
83867
|
-
printAccount({ context, args }, await client.post("/api/billing-account/keep", {}));
|
|
83868
|
-
}
|
|
83869
|
-
var BILLING_COMMANDS = {
|
|
83870
|
-
account: show,
|
|
83871
|
-
invoices,
|
|
83872
|
-
checkout,
|
|
83873
|
-
portal,
|
|
83874
|
-
currency,
|
|
83875
|
-
"top-up": topUp,
|
|
83876
|
-
"auto-recharge": autoRecharge,
|
|
83877
|
-
referral,
|
|
83878
|
-
details,
|
|
83879
|
-
cancel,
|
|
83880
|
-
keep
|
|
83881
|
-
};
|
|
83882
|
-
async function billing({ context, args }) {
|
|
83883
|
-
const name3 = args.words[1];
|
|
83884
|
-
if (name3 === void 0) return show({ context, args });
|
|
83885
|
-
const command = Object.hasOwn(BILLING_COMMANDS, name3) ? BILLING_COMMANDS[name3] : void 0;
|
|
83886
|
-
if (!command) throw new CliUsageError(BILLING_USAGE);
|
|
83887
|
-
await command({ context, args });
|
|
83888
|
-
}
|
|
83889
|
-
|
|
83890
|
-
// src/services/browser-commands.service.ts
|
|
83891
|
-
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
83892
|
-
import { readFile as readFile18 } from "node:fs/promises";
|
|
83893
|
-
import { dirname as dirname17, join as join27 } from "node:path";
|
|
83894
|
-
|
|
83895
|
-
// src/services/browser-tab-commands.service.ts
|
|
83896
|
-
import { mkdir as mkdir7, writeFile as writeFile6 } from "node:fs/promises";
|
|
83897
|
-
import { tmpdir as tmpdir3 } from "node:os";
|
|
83898
|
-
import { join as join26 } from "node:path";
|
|
83899
|
-
|
|
83900
|
-
// src/rules/browser-login.rules.ts
|
|
83901
|
-
var PASSWORD_NAME = /pass|pwd/i;
|
|
83902
|
-
var USER_NAME = /user|email|e-mail|login|account|name|^id$|_id$/i;
|
|
83903
|
-
function loginValuesOf({
|
|
83904
|
-
connection,
|
|
83905
|
-
values,
|
|
83906
|
-
userField,
|
|
83907
|
-
passField
|
|
83908
|
-
}) {
|
|
83909
|
-
const names = Object.keys(values).toSorted();
|
|
83910
|
-
const listed = names.join(", ") || "no fields";
|
|
83911
|
-
const refusal = (why) => ({
|
|
83912
|
-
refusal: `laze browser login: ${why}; ${connection} holds ${listed}. Pass --user-field <field> and --pass-field <field>.`
|
|
83913
|
-
});
|
|
83914
|
-
if (userField && values[userField] === void 0)
|
|
83915
|
-
return refusal(`${connection} has no field ${userField}`);
|
|
83916
|
-
if (passField && values[passField] === void 0)
|
|
83917
|
-
return refusal(`${connection} has no field ${passField}`);
|
|
83918
|
-
const passName = passField ?? names.find((name3) => PASSWORD_NAME.test(name3)) ?? (names.length === 1 ? names[0] : void 0);
|
|
83919
|
-
if (passName === void 0) return refusal("no field reads as the password");
|
|
83920
|
-
const userName = userField ?? names.find((name3) => name3 !== passName && USER_NAME.test(name3)) ?? void 0;
|
|
83921
|
-
const password = values[passName] ?? "";
|
|
83922
|
-
if (!password) return refusal(`${passName} is empty`);
|
|
83923
|
-
const username = userName === void 0 ? void 0 : values[userName];
|
|
83924
|
-
return username ? { username, password } : { password };
|
|
83925
|
-
}
|
|
83926
|
-
|
|
83927
|
-
// src/services/vault-commands.service.ts
|
|
83928
|
-
import { createHash as createHash6 } from "node:crypto";
|
|
83929
|
-
import { readFile as readFile17, rm as rm12 } from "node:fs/promises";
|
|
83930
|
-
import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
|
|
83931
|
-
import { dirname as dirname16, join as join25 } from "node:path";
|
|
83932
|
-
|
|
83933
|
-
// src/rules/vault-session.rules.ts
|
|
83934
|
-
function vaultSessionOf({
|
|
83935
|
-
harnessSession,
|
|
83936
|
-
inherited,
|
|
83937
|
-
cwd,
|
|
83938
|
-
host: host2,
|
|
83939
|
-
named,
|
|
83940
|
-
shellPid,
|
|
83941
|
-
terminal
|
|
83942
|
-
}) {
|
|
83943
|
-
const card2 = inherited.KANBAN_CARD_ID?.trim() ?? "";
|
|
83944
|
-
const name3 = (named || inherited.LAZE_SESSION_NAME || (card2 ? `card ${card2}` : "")).trim();
|
|
83945
|
-
const folder = displayFolderOf({
|
|
83946
|
-
folder: inherited.CLAUDE_PROJECT_DIR || cwd,
|
|
83947
|
-
home: inherited.HOME
|
|
83948
|
-
});
|
|
83949
|
-
const base = { name: name3.slice(0, 120), host: host2.slice(0, 200), folder: folder.slice(0, 500) };
|
|
83950
|
-
if (harnessSession && harnessSession.harness !== "other") {
|
|
83951
|
-
return { ...base, harness: harnessSession.harness, id: harnessSession.sessionId.slice(0, 200) };
|
|
83952
|
-
}
|
|
83953
|
-
if (card2) return { ...base, harness: "kanban", id: card2.slice(0, 200) };
|
|
83954
|
-
if (terminal && shellPid) return { ...base, harness: "terminal", id: `shell ${shellPid}` };
|
|
83955
|
-
return { ...base, harness: "script", id: folder.slice(0, 200) || "script" };
|
|
83956
|
-
}
|
|
83957
|
-
|
|
83958
|
-
// src/services/vault-commands.service.ts
|
|
83959
|
-
var USAGE6 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
83960
|
-
Runs the command with the connection's values in its environment, on a Laze agent's computer,
|
|
83961
|
-
on a machine it runs on, where a connected agent runs, or signed in as yourself, where it asks
|
|
83962
|
-
as the calling Claude Code, Codex, Kanban or terminal session.
|
|
83963
|
-
--channel <id> the conversation whose turn it runs in, when the agent answers in several
|
|
83964
|
-
--as <name> the session's name on the card when signed in as yourself (or LAZE_SESSION_NAME)`;
|
|
83965
|
-
var POLL_MS = 3e3;
|
|
83966
|
-
var RESTART_WAIT_MS = 12e4;
|
|
83967
|
-
var RESTART_BACKOFF_MS = [1e3, 2e3, 4e3, 8e3, 1e4];
|
|
83968
|
-
var P2562 = { name: "ECDH", namedCurve: "P-256" };
|
|
83969
|
-
var ServerGoneError = class extends Error {
|
|
83970
|
-
};
|
|
83971
|
-
function proxyOf({ env }) {
|
|
83972
|
-
const raw = env.LAZE_VAULT_PROXY || env.HTTP_PROXY || env.http_proxy;
|
|
83973
|
-
if (!raw) return null;
|
|
83974
|
-
const url2 = new URL(raw);
|
|
83975
|
-
const user = decodeURIComponent(url2.username);
|
|
83976
|
-
const password = decodeURIComponent(url2.password);
|
|
83977
|
-
return {
|
|
83978
|
-
origin: url2.origin,
|
|
83979
|
-
authorization: `Basic ${Buffer.from(`${user}:${password}`).toString("base64")}`
|
|
83980
|
-
};
|
|
83981
|
-
}
|
|
83982
|
-
function turnFileOf({
|
|
83983
|
-
env
|
|
83984
|
-
}) {
|
|
83985
|
-
return env.LAZE_TURN_FILE || void 0;
|
|
83986
|
-
}
|
|
83987
|
-
async function turnTokenOf3({
|
|
83988
|
-
env,
|
|
83989
|
-
turnFile,
|
|
83990
|
-
command = "laze vault run"
|
|
83991
|
-
}) {
|
|
83992
|
-
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
83993
|
-
if (pinned) return pinned;
|
|
83994
|
-
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
83995
|
-
try {
|
|
83996
|
-
return (await readFile17(turnFile, "utf8")).trim();
|
|
83997
|
-
} catch {
|
|
83998
|
-
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
83999
|
-
}
|
|
84000
|
-
}
|
|
84001
|
-
function runKeyPathOf({
|
|
84002
|
-
turnFile,
|
|
84003
|
-
connection,
|
|
84004
|
-
profile = ""
|
|
84005
|
-
}) {
|
|
84006
|
-
const name3 = createHash6("sha256").update(connection).digest("hex");
|
|
84007
|
-
const base = turnFile ? dirname16(turnFile) : join25(tmpdir2(), "laze-vault", profile);
|
|
84008
|
-
return join25(base, "vault-run-keys", `${name3}.json`);
|
|
84009
|
-
}
|
|
84010
|
-
async function runKeyAt({ path }) {
|
|
84011
|
-
const saved3 = await readStateJson({
|
|
84012
|
-
path
|
|
84013
|
-
});
|
|
84014
|
-
if (saved3 && typeof saved3.publicKey === "string" && saved3.privateKey) {
|
|
84015
|
-
const privateKey = await globalThis.crypto.subtle.importKey("jwk", saved3.privateKey, P2562, false, ["deriveBits"]).catch(() => void 0);
|
|
84016
|
-
if (privateKey) return { privateKey, publicKey: saved3.publicKey };
|
|
84017
|
-
}
|
|
84018
|
-
const fresh = await generateEcdhKeys();
|
|
84019
|
-
const jwk = await globalThis.crypto.subtle.exportKey("jwk", fresh.privateKey);
|
|
84020
|
-
await writeStateJson({ path, value: { publicKey: fresh.publicKey, privateKey: jwk } });
|
|
84021
|
-
return fresh;
|
|
84022
|
-
}
|
|
84023
|
-
function connectionRefused(error63) {
|
|
84024
|
-
const cause = error63.cause;
|
|
84025
|
-
if (cause?.code === "ECONNREFUSED") return true;
|
|
84026
|
-
return cause?.errors?.some((inner) => inner.code === "ECONNREFUSED") ?? false;
|
|
84027
|
-
}
|
|
84028
|
-
async function sendOnce({
|
|
84029
|
-
context,
|
|
84030
|
-
url: url2,
|
|
84031
|
-
init
|
|
84032
|
-
}) {
|
|
84033
|
-
let response;
|
|
84034
|
-
try {
|
|
84035
|
-
response = await context.fetcher(url2, init);
|
|
84036
|
-
} catch (error63) {
|
|
84037
|
-
const wasRefused = connectionRefused(error63);
|
|
84038
|
-
if (init.method === "POST" && !wasRefused) throw error63;
|
|
84039
|
-
return { restarting: wasRefused ? "connection refused" : String(error63) };
|
|
84040
|
-
}
|
|
84041
|
-
if (response.status !== 502 && response.status !== 503) return { response };
|
|
84042
|
-
const code = codeOf(await response.clone().text());
|
|
84043
|
-
const neverReached = response.status === 503 && code === "vault_not_answering";
|
|
84044
|
-
if (init.method === "POST" && !neverReached) return { response };
|
|
84045
|
-
return { restarting: `status ${response.status}${code ? ` ${code}` : ""}` };
|
|
84046
|
-
}
|
|
84047
|
-
async function reach(input2) {
|
|
84048
|
-
const { context } = input2;
|
|
84049
|
-
const started = context.nowMs();
|
|
84050
|
-
for (let attempt = 0; ; attempt += 1) {
|
|
84051
|
-
const sent = await sendOnce(input2);
|
|
84052
|
-
if ("response" in sent) return sent.response;
|
|
84053
|
-
if (context.nowMs() - started >= RESTART_WAIT_MS) {
|
|
84054
|
-
throw new ServerGoneError(
|
|
84055
|
-
`laze vault: the Laze server did not come back (${sent.restarting})`
|
|
84056
|
-
);
|
|
84057
|
-
}
|
|
84058
|
-
if (attempt === 0) {
|
|
84059
|
-
context.err(
|
|
84060
|
-
`laze vault: the Laze server is not answering (${sent.restarting}), probably restarting; waiting up to 2 min...
|
|
84061
|
-
`
|
|
84062
|
-
);
|
|
84063
|
-
}
|
|
84064
|
-
await context.sleep(RESTART_BACKOFF_MS[Math.min(attempt, RESTART_BACKOFF_MS.length - 1)] ?? 0);
|
|
84065
|
-
}
|
|
84066
|
-
}
|
|
84067
|
-
function codeOf(text3) {
|
|
84068
|
-
return /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1];
|
|
84069
|
-
}
|
|
84070
|
-
async function releaseOf({ response }) {
|
|
84071
|
-
const text3 = await response.text();
|
|
84072
|
-
if (!response.ok) {
|
|
84073
|
-
return {
|
|
84074
|
-
outcome: "deny",
|
|
84075
|
-
exitCode: 1,
|
|
84076
|
-
message: `laze vault: the release was refused (${codeOf(text3) ?? `status ${response.status}`})`
|
|
84077
|
-
};
|
|
84078
|
-
}
|
|
84079
|
-
return JSON.parse(text3);
|
|
84080
|
-
}
|
|
84081
|
-
async function envOf({
|
|
84082
|
-
release: release2,
|
|
84083
|
-
run: run4
|
|
84084
|
-
}) {
|
|
84085
|
-
if (!release2.sealed) return release2.env;
|
|
84086
|
-
const sealed = await openRunRelease({
|
|
84087
|
-
release: release2.sealed,
|
|
84088
|
-
runPrivateKey: run4.privateKey,
|
|
84089
|
-
runPublicKey: run4.publicKey,
|
|
84090
|
-
requestId: release2.sealed.requestId
|
|
84091
|
-
});
|
|
84092
|
-
return { ...release2.env, ...sealed };
|
|
84093
|
-
}
|
|
84094
|
-
function deadlineOf({ args, nowMs: nowMs2 }) {
|
|
84095
|
-
const wait = flagText({ args, name: "wait" }) || (args.flags.wait === true ? args.words[3] : "");
|
|
84096
|
-
if (!wait) return Infinity;
|
|
84097
|
-
if (!(Number(wait) >= 0)) throw new CliUsageError(`--wait takes a number of seconds
|
|
84098
|
-
${USAGE6}`);
|
|
84099
|
-
return nowMs2 + Number(wait) * 1e3;
|
|
84100
|
-
}
|
|
84101
|
-
async function untilAnswered({
|
|
84102
|
-
context,
|
|
84103
|
-
first,
|
|
84104
|
-
next,
|
|
84105
|
-
deadline
|
|
84106
|
-
}) {
|
|
84107
|
-
let release2 = first;
|
|
84108
|
-
while (release2.outcome === "ask") {
|
|
84109
|
-
if (context.nowMs() + POLL_MS > deadline) {
|
|
84110
|
-
context.err(`${release2.message}. Not approved yet; ask again later.
|
|
84111
|
-
`);
|
|
84112
|
-
return "capped";
|
|
84113
|
-
}
|
|
84114
|
-
if (release2 === first) {
|
|
84115
|
-
context.err(`${release2.message}. Waiting for an answer (cards expire after 24 hours)...
|
|
84116
|
-
`);
|
|
84117
|
-
}
|
|
84118
|
-
await context.sleep(POLL_MS);
|
|
84119
|
-
release2 = await next(release2.requestId);
|
|
84120
|
-
}
|
|
84121
|
-
return release2;
|
|
84122
|
-
}
|
|
84123
|
-
function leaseHolds({
|
|
84124
|
-
release: release2,
|
|
84125
|
-
nowMs: nowMs2
|
|
84126
|
-
}) {
|
|
84127
|
-
const ends = release2.sealed?.leaseEndsAt;
|
|
84128
|
-
return ends !== void 0 && Temporal3.Instant.from(ends).epochMilliseconds > nowMs2;
|
|
84129
|
-
}
|
|
84130
|
-
async function vaultRelease({
|
|
84131
|
-
context,
|
|
84132
|
-
args,
|
|
84133
|
-
connection,
|
|
84134
|
-
reason: reason2,
|
|
84135
|
-
command
|
|
84136
|
-
}) {
|
|
84137
|
-
const deadline = deadlineOf({ args, nowMs: context.nowMs() });
|
|
84138
|
-
const env = context.environment.inherited;
|
|
84139
|
-
const proxy = proxyOf({ env });
|
|
84140
|
-
if (!proxy) return keyRelease({ context, args, connection, reason: reason2, command, deadline });
|
|
84141
|
-
const turnFile = turnFileOf({ env });
|
|
84142
|
-
const headers = {
|
|
84143
|
-
"proxy-authorization": proxy.authorization,
|
|
84144
|
-
"x-laze-turn": await turnTokenOf3({ env, turnFile })
|
|
84145
|
-
};
|
|
84146
|
-
const keyPath = runKeyPathOf({ turnFile, connection });
|
|
84147
|
-
const run4 = await runKeyAt({ path: keyPath });
|
|
84148
|
-
const body = JSON.stringify({ connection, reason: reason2, command, recipient: run4.publicKey });
|
|
84149
|
-
let release2;
|
|
84150
|
-
try {
|
|
84151
|
-
const first = await releaseOf({
|
|
84152
|
-
response: await reach({
|
|
84153
|
-
context,
|
|
84154
|
-
url: `${proxy.origin}/vault/release`,
|
|
84155
|
-
init: { method: "POST", headers: { ...headers, "content-type": "application/json" }, body }
|
|
84156
|
-
})
|
|
84157
|
-
});
|
|
84158
|
-
const next = async (requestId) => releaseOf({
|
|
84159
|
-
response: await reach({
|
|
84160
|
-
context,
|
|
84161
|
-
url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
|
|
84162
|
-
init: { method: "GET", headers }
|
|
84163
|
-
})
|
|
84164
|
-
});
|
|
84165
|
-
release2 = await untilAnswered({ context, first, next, deadline });
|
|
84166
|
-
} catch (error63) {
|
|
84167
|
-
if (!(error63 instanceof ServerGoneError)) throw error63;
|
|
84168
|
-
context.err(`${error63.message}. Run the command again to keep waiting.
|
|
84169
|
-
`);
|
|
84170
|
-
return { exitCode: 75 };
|
|
84171
|
-
}
|
|
84172
|
-
return settled({ context, release: release2, run: run4, keyPath });
|
|
84173
|
-
}
|
|
84174
|
-
async function settled({
|
|
84175
|
-
context,
|
|
84176
|
-
release: release2,
|
|
84177
|
-
run: run4,
|
|
84178
|
-
keyPath
|
|
84179
|
-
}) {
|
|
84180
|
-
if (release2 === "capped") return { exitCode: 75 };
|
|
84181
|
-
if (release2.outcome === "deny") {
|
|
84182
|
-
await rm12(keyPath, { force: true });
|
|
84183
|
-
context.err(`${release2.message}
|
|
84184
|
-
`);
|
|
84185
|
-
return { exitCode: release2.exitCode || 1 };
|
|
84186
|
-
}
|
|
84187
|
-
const values = await envOf({ release: release2, run: run4 });
|
|
84188
|
-
if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm12(keyPath, { force: true });
|
|
84189
|
-
if (release2.message) context.err(`${release2.message}
|
|
84190
|
-
`);
|
|
84191
|
-
return { env: values };
|
|
84192
|
-
}
|
|
84193
|
-
function refusedRelease(error63) {
|
|
84194
|
-
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
84195
|
-
return {
|
|
84196
|
-
outcome: "deny",
|
|
84197
|
-
exitCode: 1,
|
|
84198
|
-
message: `laze vault: the release was refused: ${refusalText(error63)}`
|
|
84199
|
-
};
|
|
84200
|
-
}
|
|
84201
|
-
var WHERE = "works only on a Laze agent's computer, on a machine it runs on, or signed in with `laze login` (as yourself or as a connected agent)";
|
|
84202
|
-
async function vaultSessionFor({
|
|
84203
|
-
context,
|
|
84204
|
-
args,
|
|
84205
|
-
harnessSession
|
|
84206
|
-
}) {
|
|
84207
|
-
return vaultSessionOf({
|
|
84208
|
-
harnessSession,
|
|
84209
|
-
inherited: context.environment.inherited,
|
|
84210
|
-
cwd: context.cwd,
|
|
84211
|
-
host: hostname7(),
|
|
84212
|
-
named: flagText({ args, name: "as" }),
|
|
84213
|
-
shellPid: await context.processes.parentOf(context.processes.pid),
|
|
84214
|
-
terminal: context.stdoutIsTerminal === true
|
|
84215
|
-
});
|
|
84216
|
-
}
|
|
84217
|
-
async function keyRelease({
|
|
84218
|
-
context,
|
|
84219
|
-
args,
|
|
84220
|
-
connection,
|
|
84221
|
-
reason: reason2,
|
|
84222
|
-
command,
|
|
84223
|
-
deadline
|
|
84224
|
-
}) {
|
|
84225
|
-
const signed2 = await signedIn({ context, args }).catch(() => null);
|
|
84226
|
-
if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
|
|
84227
|
-
throw new CliUsageError(`laze vault run ${WHERE}`);
|
|
84228
|
-
}
|
|
84229
|
-
const { name: name3 } = signed2;
|
|
84230
|
-
const harnessSession = await currentSessionOf({ context, args });
|
|
84231
|
-
const client = forSession({ client: signed2.client, session: harnessSession });
|
|
84232
|
-
const keyPath = runKeyPathOf({ turnFile: void 0, connection, profile: name3 });
|
|
84233
|
-
const run4 = await runKeyAt({ path: keyPath });
|
|
84234
|
-
const body = { connection, reason: reason2, command, recipient: run4.publicKey };
|
|
84235
|
-
const door = signed2.profile.kind === "person" ? {
|
|
84236
|
-
ask: "/api/vault/session/release",
|
|
84237
|
-
status: "/api/vault/session/release-status",
|
|
84238
|
-
extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
|
|
84239
|
-
} : {
|
|
84240
|
-
ask: "/api/agents/me/vault/release",
|
|
84241
|
-
status: "/api/agents/me/vault/release-status",
|
|
84242
|
-
extra: { channelId: flagText({ args, name: "channel" }) || null }
|
|
84243
|
-
};
|
|
84244
|
-
const first = await client.post(door.ask, { ...body, ...door.extra }).catch(refusedRelease);
|
|
84245
|
-
const next = (requestId) => client.post(door.status, { requestId, ...door.extra }).catch(refusedRelease);
|
|
84246
|
-
const release2 = await untilAnswered({ context, first, next, deadline });
|
|
84247
|
-
return settled({ context, release: release2, run: run4, keyPath });
|
|
84248
|
-
}
|
|
84249
|
-
async function vaultRun({
|
|
84250
|
-
context,
|
|
84251
|
-
args
|
|
84252
|
-
}) {
|
|
84253
|
-
const connection = args.words[2];
|
|
84254
|
-
const reason2 = flagText({ args, name: "reason" });
|
|
84255
|
-
if (!connection || args.rest.length === 0) throw new CliUsageError(USAGE6);
|
|
84256
|
-
if (!reason2) throw new CliUsageError(`Say why with --reason "<one plain sentence>"
|
|
84257
|
-
${USAGE6}`);
|
|
84258
|
-
const foreign = commandReferenceNames({ command: args.rest }).find(
|
|
84259
|
-
(name3) => vaultReferenceConnectionName({ name: name3 }) !== connection
|
|
84260
|
-
);
|
|
84261
|
-
if (foreign !== void 0) {
|
|
84262
|
-
const named = vaultReferenceConnectionName({ name: foreign });
|
|
84263
|
-
context.err(
|
|
84264
|
-
`laze vault: the command names {{vault:${foreign}}}, but this run releases only ${connection}, not ${named}. Nothing was asked and the command did not run.
|
|
84265
|
-
`
|
|
84266
|
-
);
|
|
84267
|
-
return 1;
|
|
84268
|
-
}
|
|
84269
|
-
const released = await vaultRelease({ context, args, connection, reason: reason2, command: args.rest });
|
|
84270
|
-
if ("exitCode" in released) return released.exitCode;
|
|
84271
|
-
const prepared = preparedCommand({
|
|
84272
|
-
command: args.rest,
|
|
84273
|
-
released: /* @__PURE__ */ new Map([[connection, released.env]])
|
|
84274
|
-
});
|
|
84275
|
-
if ("refusal" in prepared) {
|
|
84276
|
-
context.err(`${prepared.refusal}
|
|
84277
|
-
`);
|
|
84278
|
-
return 1;
|
|
84279
|
-
}
|
|
84280
|
-
const redact = secretValuesOf({ fields: released.env });
|
|
84281
|
-
return context.runCommand({ command: prepared.command, env: released.env, redact });
|
|
84282
|
-
}
|
|
84283
|
-
function preparedCommand({
|
|
84284
|
-
command,
|
|
84285
|
-
released
|
|
84286
|
-
}) {
|
|
84287
|
-
for (const [name3, fields] of released) {
|
|
84288
|
-
const [problem] = unusableFieldProblems({ fields });
|
|
84289
|
-
if (problem !== void 0) {
|
|
84290
|
-
return {
|
|
84291
|
-
refusal: `laze vault: ${name3}: ${problem}, so the command did not run. Ask its owner to save the real value on the vault page.`
|
|
84292
|
-
};
|
|
84293
|
-
}
|
|
84294
|
-
}
|
|
84295
|
-
const filled = fillCommandReferences({ command, released });
|
|
84296
|
-
if ("refusal" in filled) {
|
|
84297
|
-
return { refusal: `laze vault: ${filled.refusal}. The command did not run.` };
|
|
84298
|
-
}
|
|
84299
|
-
return filled;
|
|
84300
|
-
}
|
|
84301
|
-
|
|
84302
|
-
// src/services/browser-tab-commands.service.ts
|
|
84303
|
-
var BROWSER_TAB_PATHS = {
|
|
84304
|
-
open: "/api/compute/browser-tabs/open",
|
|
84305
|
-
list: "/api/compute/browser-tabs/list",
|
|
84306
|
-
get: "/api/compute/browser-tabs/get",
|
|
84307
|
-
goto: "/api/compute/browser-tabs/goto",
|
|
84308
|
-
read: "/api/compute/browser-tabs/read",
|
|
84309
|
-
ask: "/api/compute/browser-tabs/ask",
|
|
84310
|
-
share: "/api/compute/browser-tabs/share",
|
|
84311
|
-
close: "/api/compute/browser-tabs/close",
|
|
84312
|
-
cdp: "/api/compute/browser-tabs/cdp",
|
|
84313
|
-
login: "/api/compute/browser-tabs/login"
|
|
84314
|
-
};
|
|
84315
|
-
var ASK_WAIT_SECONDS = 15 * 60;
|
|
84316
|
-
var ASK_POLL_MS = 3e3;
|
|
84317
|
-
var BROWSER_TAB_USAGE = [
|
|
84318
|
-
"Usage: laze browser open <url> [--title <title>] [--channel <channel>] a live browser tab in the conversation",
|
|
84319
|
-
" laze browser tabs [--channel <channel>] the conversation's browser tabs",
|
|
84320
|
-
" laze browser tab <tab> one tab: its owner, sharing and page",
|
|
84321
|
-
" laze browser goto <tab> <url> send the tab to another page",
|
|
84322
|
-
" laze browser read <tab> the page's address, title and text",
|
|
84323
|
-
" laze browser ask <tab> <what> [--wait[=<seconds>]] ask the person you work for to sign in or click something there",
|
|
84324
|
-
" laze browser login <tab> --vault <connection> [--reason <why>] [--user-field <field> --pass-field <field>]",
|
|
84325
|
-
" [--user-input <css> --pass-input <css>] type a saved sign-in into the page and submit it",
|
|
84326
|
-
" laze browser cdp <tab> a CDP address on the tab's browser",
|
|
84327
|
-
" laze browser share <tab> private|watch|use who sees the screen and who types into it",
|
|
84328
|
-
" laze browser close <tab> unpin the tab and close its browser",
|
|
84329
|
-
"A tab is named by its id or its title. Opening a title that is already open reuses that tab.",
|
|
84330
|
-
"Any agent working for the tab's owner drives it, connected agents (Claude Code, Codex) from",
|
|
84331
|
-
"their own session included; no Laze computer is needed. Another person's agent cannot.",
|
|
84332
|
-
"Sign-ins: ask the person in the tab first (`laze browser ask`); they sign in on the screen and",
|
|
84333
|
-
"press Done, which reaches you at once. Use `laze browser login --vault` only when the person",
|
|
84334
|
-
"says to use a saved key; a code or emailed link it meets becomes a request to them in the tab.",
|
|
84335
|
-
"Never write scripts that type passwords."
|
|
84336
|
-
].join("\n");
|
|
84337
|
-
var SHARING = /* @__PURE__ */ new Set(["private", "watch", "use"]);
|
|
84338
|
-
function channelOf({ context, args }) {
|
|
84339
|
-
const channel = flagText({ args, name: "channel" }) || context.environment.inherited.LAZE_CHANNEL;
|
|
84340
|
-
return channel ? { channel } : {};
|
|
84341
|
-
}
|
|
84342
|
-
function word({ args, at }) {
|
|
84343
|
-
const value = args.words[at];
|
|
84344
|
-
if (!value) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
84345
|
-
return value;
|
|
84346
|
-
}
|
|
84347
|
-
function tabLine(tab) {
|
|
84348
|
-
return `${tab.id} ${tab.title} ${tab.ownerName}'s browser ${tab.sharing} ${tab.url}
|
|
84349
|
-
`;
|
|
84350
|
-
}
|
|
84351
|
-
function pageText({ page }) {
|
|
84352
|
-
const head = `${page.title || "(no title)"}
|
|
84353
|
-
${page.url}
|
|
84354
|
-
`;
|
|
84355
|
-
if (page.text === null) return head;
|
|
84356
|
-
const cut = page.truncated ? "\n[cut at 100 000 characters]\n" : "\n";
|
|
84357
|
-
return `${head}
|
|
84358
|
-
${page.text}${cut}`;
|
|
84359
|
-
}
|
|
84360
|
-
async function openTab({ args, client, channel, print: print9 }) {
|
|
84361
|
-
const title = flagText({ args, name: "title" });
|
|
84362
|
-
const tab = await client.post(BROWSER_TAB_PATHS.open, {
|
|
84363
|
-
url: word({ args, at: 2 }),
|
|
84364
|
-
...title ? { title } : {},
|
|
84365
|
-
...channel
|
|
84366
|
-
});
|
|
84367
|
-
if (tab.reused)
|
|
84368
|
-
return print9(
|
|
84369
|
-
tab,
|
|
84370
|
-
`Reused ${tab.title} (${tab.id}), ${tab.ownerName}'s browser tab already open, and sent it to ${tab.url}
|
|
84791
|
+
if (me.language || me.timeZone) {
|
|
84792
|
+
const whose = me.kind === "agent" ? "Owner's language" : "Language";
|
|
84793
|
+
context.out(`${whose} ${me.language ?? "en-US"}, time zone ${me.timeZone ?? "UTC"}
|
|
84794
|
+
`);
|
|
84795
|
+
}
|
|
84796
|
+
}
|
|
84797
|
+
async function workspaces({ context, args }) {
|
|
84798
|
+
const config2 = await context.store.read();
|
|
84799
|
+
const entries = Object.entries(config2.profiles);
|
|
84800
|
+
if (entries.length === 0) return context.out("Not signed in: run `laze login` first.\n");
|
|
84801
|
+
const active = await signedIn({ context, args }).catch(() => void 0);
|
|
84802
|
+
for (const [name3, profile] of entries) {
|
|
84803
|
+
const star2 = active?.name === name3 ? "*" : " ";
|
|
84804
|
+
context.out(
|
|
84805
|
+
`${star2} ${name3} ${profile.workspaceId} ${profile.kind} ${profile.name} ${profile.url}
|
|
84371
84806
|
`
|
|
84372
84807
|
);
|
|
84373
|
-
|
|
84374
|
-
tab,
|
|
84375
|
-
`Opened ${tab.title} (${tab.id}) in ${tab.ownerName}'s browser, pinned as a tab of the conversation.
|
|
84376
|
-
Everyone in it watches the screen live. Page: ${tab.url}
|
|
84377
|
-
If the site needs a sign-in, run \`laze browser ask ${tab.id} "Sign in to <site>"\` and wait for their Done.
|
|
84378
|
-
`
|
|
84379
|
-
);
|
|
84808
|
+
}
|
|
84380
84809
|
}
|
|
84381
|
-
async function
|
|
84382
|
-
const {
|
|
84383
|
-
|
|
84384
|
-
if (
|
|
84385
|
-
|
|
84386
|
-
|
|
84810
|
+
async function changes({ context, args }) {
|
|
84811
|
+
const { client } = await signedIn({ context, args });
|
|
84812
|
+
const list12 = await client.get("/api/agents/me/changes");
|
|
84813
|
+
if (args.flags.json) return context.out(`${JSON.stringify(list12, null, 2)}
|
|
84814
|
+
`);
|
|
84815
|
+
if (list12.length === 0) return context.out("No recent changes.\n");
|
|
84816
|
+
for (const change2 of list12) {
|
|
84817
|
+
const lifted = change2.codes.length > 0 ? ` (lifts ${change2.codes.join(", ")})` : "";
|
|
84818
|
+
context.out(`${change2.date}${lifted}: ${change2.text}
|
|
84819
|
+
`);
|
|
84820
|
+
}
|
|
84387
84821
|
}
|
|
84388
|
-
|
|
84389
|
-
|
|
84390
|
-
|
|
84391
|
-
|
|
84392
|
-
|
|
84393
|
-
|
|
84822
|
+
|
|
84823
|
+
// src/services/billing-commands.service.ts
|
|
84824
|
+
var BILLING_USAGE = `Usage:
|
|
84825
|
+
laze billing [account] the plan, people, credits, auto-recharge and referral
|
|
84826
|
+
laze billing invoices the workspace's invoices
|
|
84827
|
+
laze billing checkout [--currency usd|eur] a Stripe Checkout link that starts Team (admins)
|
|
84828
|
+
laze billing portal a Stripe link to manage cards and invoices (admins)
|
|
84829
|
+
laze billing currency usd|eur bill in USD or EUR, until the first payment (admins)
|
|
84830
|
+
laze billing top-up <amount> a Stripe link that adds prepaid credits, 10 or more (admins)
|
|
84831
|
+
laze billing auto-recharge on|off [--amount <n>] [--limit <n>] (admins)
|
|
84832
|
+
laze billing referral <code> apply another workspace's referral code (admins)
|
|
84833
|
+
laze billing details the company, address, billing email and tax id on invoices (admins)
|
|
84834
|
+
laze billing details set --company <name> --email <billing email> --line1 <street> --city <city>
|
|
84835
|
+
--country <NL> [--postal <code>] [--line2 <text>] [--state <text>]
|
|
84836
|
+
[--tax-id <NL123456789B01>|none] [--tax-type eu_vat|gb_vat|ch_vat|no_vat|us_ein|au_abn|ca_bn] (admins)
|
|
84837
|
+
laze billing cancel end Team at the end of the paid period (admins)
|
|
84838
|
+
laze billing keep keep Team after a cancellation (admins)`;
|
|
84839
|
+
var printJson = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
84840
|
+
`);
|
|
84841
|
+
async function plan({ context, args }) {
|
|
84842
|
+
const { client } = await signedIn({ context, args });
|
|
84843
|
+
const active = await client.get("/api/entitlements/plan");
|
|
84844
|
+
if (args.flags.json) return printJson(context, active);
|
|
84845
|
+
context.out(`Plan: ${active.plan}
|
|
84846
|
+
`);
|
|
84847
|
+
context.out(`Features: ${active.features.length > 0 ? active.features.join(", ") : "none"}
|
|
84848
|
+
`);
|
|
84394
84849
|
}
|
|
84395
|
-
|
|
84396
|
-
|
|
84397
|
-
tab: word({ args, at: 2 }),
|
|
84398
|
-
url: word({ args, at: 3 }),
|
|
84399
|
-
...channel
|
|
84400
|
-
});
|
|
84401
|
-
print9(page, pageText({ page }));
|
|
84850
|
+
function money(amount, currency2) {
|
|
84851
|
+
return `${Number(amount.toFixed(2))} ${currency2.toUpperCase()}`;
|
|
84402
84852
|
}
|
|
84403
|
-
|
|
84404
|
-
const
|
|
84405
|
-
|
|
84406
|
-
|
|
84407
|
-
|
|
84408
|
-
|
|
84853
|
+
function amountOf({ text: text3, what }) {
|
|
84854
|
+
const value = Number(text3);
|
|
84855
|
+
if (!text3 || !Number.isFinite(value) || value <= 0) {
|
|
84856
|
+
throw new CliUsageError(`${what} takes an amount.
|
|
84857
|
+
${BILLING_USAGE}`);
|
|
84858
|
+
}
|
|
84859
|
+
return value;
|
|
84409
84860
|
}
|
|
84410
|
-
|
|
84411
|
-
const {
|
|
84412
|
-
const
|
|
84413
|
-
|
|
84414
|
-
|
|
84415
|
-
|
|
84416
|
-
|
|
84417
|
-
|
|
84418
|
-
return print9(
|
|
84419
|
-
asked,
|
|
84420
|
-
`Asked ${who} in the conversation; the tab shows them your request full screen with "Done, hand back".
|
|
84421
|
-
Wait for their "Done" message before you go on in ${asked.title}.
|
|
84422
|
-
`
|
|
84423
|
-
);
|
|
84424
|
-
run4.context.err(`Asked ${who} in the conversation; waiting for their Done...
|
|
84425
|
-
`);
|
|
84426
|
-
return waitForDone({ run: run4, tab: asked, who });
|
|
84861
|
+
function prepaidNoteOf(account, of) {
|
|
84862
|
+
const { prepaid, overdraft = 0, welcome = 0 } = account.credits;
|
|
84863
|
+
const notes = [
|
|
84864
|
+
prepaid < 0 ? `${of(-prepaid)} owed, paid first by the next top-up` : null,
|
|
84865
|
+
overdraft > 0 ? `may go down to -${of(overdraft)}` : null,
|
|
84866
|
+
welcome > 0 ? `welcome credit, ${of(welcome)}` : null
|
|
84867
|
+
].filter((note) => note !== null);
|
|
84868
|
+
return notes.length > 0 ? ` (${notes.join(", ")})` : "";
|
|
84427
84869
|
}
|
|
84428
|
-
|
|
84429
|
-
|
|
84430
|
-
|
|
84431
|
-
|
|
84432
|
-
|
|
84433
|
-
const
|
|
84434
|
-
|
|
84435
|
-
|
|
84436
|
-
|
|
84437
|
-
|
|
84438
|
-
|
|
84439
|
-
const now = await client.post(BROWSER_TAB_PATHS.get, { tab: tab.id, ...channel });
|
|
84440
|
-
if (!now.ask) return print9(now, `${who} pressed Done. ${now.title} shows ${now.url}
|
|
84870
|
+
function printAccount({ context, args }, account) {
|
|
84871
|
+
if (args.flags.json) return printJson(context, account);
|
|
84872
|
+
const of = (amount) => money(amount, account.currency);
|
|
84873
|
+
const plan2 = account.plan === "team" ? `Team, ${of(account.seats.monthlyPrice)} a month for ${account.seats.people} people` : "Free, for one person";
|
|
84874
|
+
const pending2 = account.status === "pending_payment" ? " (payment pending: run laze billing checkout)" : "";
|
|
84875
|
+
const ending = account.cancelAtPeriodEnd && account.period ? ` (ends ${account.period.end.slice(0, 10)}: run laze billing keep to renew)` : "";
|
|
84876
|
+
context.out(`Plan: ${plan2}${pending2}${ending}
|
|
84877
|
+
`);
|
|
84878
|
+
if (account.paymentIssue) {
|
|
84879
|
+
const link2 = account.paymentIssue.invoiceUrl ? ` ${account.paymentIssue.invoiceUrl}` : "";
|
|
84880
|
+
context.out(`Payment: ${account.paymentIssue.message ?? account.paymentIssue.kind}${link2}
|
|
84441
84881
|
`);
|
|
84442
84882
|
}
|
|
84443
|
-
|
|
84444
|
-
|
|
84445
|
-
|
|
84883
|
+
context.out(
|
|
84884
|
+
`Credits: ${of(account.credits.includedLeft)} of ${of(account.credits.included)} included left, ${of(account.credits.prepaid)} prepaid${prepaidNoteOf(account, of)}${account.credits.paused ? " (paused: top up to resume)" : ""}
|
|
84885
|
+
`
|
|
84886
|
+
);
|
|
84887
|
+
const recharge = account.autoRecharge;
|
|
84888
|
+
const rechargeLine = recharge.enabled ? `on, ${recharge.amount === null ? "after the first top-up" : of(recharge.amount)} when under ${of(recharge.rechargeBelow)}, limit ${recharge.monthlyLimit === null ? "set by the first top-up" : of(recharge.monthlyLimit)} a month (${of(recharge.rechargedThisMonth)} so far)` : "off";
|
|
84889
|
+
context.out(`Auto-recharge: ${rechargeLine}
|
|
84890
|
+
`);
|
|
84891
|
+
if (recharge.lastFailure) context.out(`Last recharge failed: ${recharge.lastFailure.message}
|
|
84892
|
+
`);
|
|
84893
|
+
context.out(`Used this period: ${of(account.usage.used)}
|
|
84894
|
+
`);
|
|
84895
|
+
context.out(
|
|
84896
|
+
`Referral: ${account.referral.url} (code ${account.referral.code}, used by ${account.referral.referred})
|
|
84446
84897
|
`
|
|
84447
84898
|
);
|
|
84448
|
-
return 75;
|
|
84449
84899
|
}
|
|
84450
|
-
async function
|
|
84451
|
-
const {
|
|
84452
|
-
|
|
84453
|
-
|
|
84454
|
-
|
|
84455
|
-
|
|
84456
|
-
|
|
84457
|
-
|
|
84900
|
+
async function show({ context, args }) {
|
|
84901
|
+
const { client } = await signedIn({ context, args });
|
|
84902
|
+
printAccount({ context, args }, await client.get("/api/billing-account"));
|
|
84903
|
+
}
|
|
84904
|
+
async function invoices({ context, args }) {
|
|
84905
|
+
const { client } = await signedIn({ context, args });
|
|
84906
|
+
const list12 = await client.get("/api/billing-account/invoices");
|
|
84907
|
+
if (args.flags.json) return printJson(context, list12);
|
|
84908
|
+
if (list12.length === 0) return context.out("No invoices yet.\n");
|
|
84909
|
+
for (const invoice of list12) {
|
|
84910
|
+
const link2 = invoice.hostedUrl ? ` ${invoice.hostedUrl}` : "";
|
|
84911
|
+
const tax = invoice.tax ? ` (tax ${money(invoice.tax, invoice.currency)})` : "";
|
|
84912
|
+
context.out(
|
|
84913
|
+
`${invoice.createdAt.slice(0, 10)} ${invoice.number ?? "draft"} ${invoice.status} ${money(invoice.total, invoice.currency)}${tax}${link2}
|
|
84914
|
+
`
|
|
84458
84915
|
);
|
|
84459
|
-
const reason2 = flagText({ args, name: "reason" }) || `Sign in on the ${tab} browser tab of the conversation`;
|
|
84460
|
-
const released = await vaultRelease({
|
|
84461
|
-
context,
|
|
84462
|
-
args,
|
|
84463
|
-
connection,
|
|
84464
|
-
reason: reason2,
|
|
84465
|
-
command: ["laze", "browser", "login", tab]
|
|
84466
|
-
});
|
|
84467
|
-
if ("exitCode" in released) return released.exitCode;
|
|
84468
|
-
const [problem] = unusableFieldProblems({ fields: released.env });
|
|
84469
|
-
if (problem !== void 0) {
|
|
84470
|
-
context.err(`laze browser login: ${connection}: ${problem}. Nothing was typed.
|
|
84471
|
-
`);
|
|
84472
|
-
return 1;
|
|
84473
84916
|
}
|
|
84474
|
-
|
|
84475
|
-
|
|
84476
|
-
|
|
84477
|
-
|
|
84478
|
-
|
|
84479
|
-
|
|
84480
|
-
|
|
84481
|
-
context.err(`${values.refusal}
|
|
84482
|
-
`);
|
|
84483
|
-
return 1;
|
|
84917
|
+
}
|
|
84918
|
+
async function checkout({ context, args }) {
|
|
84919
|
+
const { client } = await signedIn({ context, args });
|
|
84920
|
+
const currency2 = flagText({ args, name: "currency" });
|
|
84921
|
+
if (currency2 && currency2 !== "usd" && currency2 !== "eur") {
|
|
84922
|
+
throw new CliUsageError(`--currency takes usd or eur.
|
|
84923
|
+
${BILLING_USAGE}`);
|
|
84484
84924
|
}
|
|
84485
|
-
const
|
|
84486
|
-
|
|
84487
|
-
|
|
84488
|
-
|
|
84489
|
-
|
|
84490
|
-
...userInput ? { userInput } : {},
|
|
84491
|
-
...passInput ? { passInput } : {},
|
|
84492
|
-
...channel
|
|
84493
|
-
});
|
|
84494
|
-
const screenshotPath = answer6.screenshot ? await savedScreenshot({
|
|
84495
|
-
tabId: answer6.tabId,
|
|
84496
|
-
data: answer6.screenshot,
|
|
84497
|
-
nowMs: context.nowMs()
|
|
84498
|
-
}) : null;
|
|
84499
|
-
const { screenshot: _shown, ...rest } = answer6;
|
|
84500
|
-
if (json7) context.out(`${JSON.stringify({ ...rest, screenshotPath }, null, 2)}
|
|
84925
|
+
const { url: url2 } = await client.post(
|
|
84926
|
+
"/api/billing-account/checkout",
|
|
84927
|
+
currency2 ? { currency: currency2 } : {}
|
|
84928
|
+
);
|
|
84929
|
+
context.out(`Open this link to start Team: ${url2}
|
|
84501
84930
|
`);
|
|
84502
|
-
else context.out(loginText({ answer: answer6, tab, screenshotPath }));
|
|
84503
|
-
return answer6.state === "refused" || answer6.state === "still_on_form" ? 1 : 0;
|
|
84504
84931
|
}
|
|
84505
|
-
function
|
|
84506
|
-
|
|
84507
|
-
|
|
84508
|
-
|
|
84509
|
-
|
|
84510
|
-
const page = `${answer6.title || "(no title)"}
|
|
84511
|
-
${answer6.url}
|
|
84512
|
-
`;
|
|
84513
|
-
const shot = screenshotPath ? `Screenshot: ${screenshotPath}
|
|
84514
|
-
` : "";
|
|
84515
|
-
if (answer6.state === "signed_in") return `Signed in.
|
|
84516
|
-
${page}${shot}`;
|
|
84517
|
-
if (answer6.state === "second_step")
|
|
84518
|
-
return `The site asks for a second step (a code or an emailed link). Asked ${answer6.askedUserName ?? "the person"} in the conversation to finish it in the tab;
|
|
84519
|
-
wait for their "Done" message before you go on.
|
|
84520
|
-
${page}${shot}`;
|
|
84521
|
-
if (answer6.state === "refused")
|
|
84522
|
-
return `The site refused the sign-in: ${answer6.error ?? "no reason shown"}
|
|
84523
|
-
${page}${shot}`;
|
|
84524
|
-
return `Still on the sign-in page after submitting. Look at the screenshot, then ask the person in the tab:
|
|
84525
|
-
laze browser ask ${tab} "Finish signing in"
|
|
84526
|
-
${page}${shot}`;
|
|
84932
|
+
async function portal({ context, args }) {
|
|
84933
|
+
const { client } = await signedIn({ context, args });
|
|
84934
|
+
const { url: url2 } = await client.post("/api/billing-account/portal", {});
|
|
84935
|
+
context.out(`${url2}
|
|
84936
|
+
`);
|
|
84527
84937
|
}
|
|
84528
|
-
async function
|
|
84529
|
-
|
|
84530
|
-
|
|
84531
|
-
|
|
84532
|
-
|
|
84533
|
-
|
|
84534
|
-
|
|
84535
|
-
|
|
84536
|
-
await writeFile6(path, Buffer.from(data, "base64"), { mode: 384 });
|
|
84537
|
-
return path;
|
|
84938
|
+
async function currency({ context, args }) {
|
|
84939
|
+
const value = args.words[2];
|
|
84940
|
+
if (value !== "usd" && value !== "eur") throw new CliUsageError(BILLING_USAGE);
|
|
84941
|
+
const { client } = await signedIn({ context, args });
|
|
84942
|
+
printAccount(
|
|
84943
|
+
{ context, args },
|
|
84944
|
+
await client.post("/api/billing-account/currency", { currency: value })
|
|
84945
|
+
);
|
|
84538
84946
|
}
|
|
84539
|
-
async function
|
|
84540
|
-
const
|
|
84541
|
-
const
|
|
84542
|
-
|
|
84543
|
-
|
|
84544
|
-
|
|
84545
|
-
|
|
84546
|
-
|
|
84947
|
+
async function topUp({ context, args }) {
|
|
84948
|
+
const amount = amountOf({ text: args.words[2], what: "top-up" });
|
|
84949
|
+
const { client } = await signedIn({ context, args });
|
|
84950
|
+
const { url: url2 } = await client.post("/api/billing-account/top-up", { amount });
|
|
84951
|
+
context.out(`Open this link to pay: ${url2}
|
|
84952
|
+
`);
|
|
84953
|
+
}
|
|
84954
|
+
async function autoRecharge({ context, args }) {
|
|
84955
|
+
const state = args.words[2];
|
|
84956
|
+
if (state !== "on" && state !== "off") throw new CliUsageError(BILLING_USAGE);
|
|
84957
|
+
const amountText = flagText({ args, name: "amount" });
|
|
84958
|
+
const limitText = flagText({ args, name: "limit" });
|
|
84959
|
+
const { client } = await signedIn({ context, args });
|
|
84960
|
+
const account = await client.post("/api/billing-account/auto-recharge", {
|
|
84961
|
+
enabled: state === "on",
|
|
84962
|
+
...amountText ? { amount: amountOf({ text: amountText, what: "--amount" }) } : {},
|
|
84963
|
+
...limitText ? { monthlyLimit: amountOf({ text: limitText, what: "--limit" }) } : {}
|
|
84547
84964
|
});
|
|
84548
|
-
|
|
84965
|
+
printAccount({ context, args }, account);
|
|
84549
84966
|
}
|
|
84550
|
-
async function
|
|
84551
|
-
const
|
|
84552
|
-
|
|
84553
|
-
|
|
84967
|
+
async function referral({ context, args }) {
|
|
84968
|
+
const code = args.words[2];
|
|
84969
|
+
if (!code) throw new CliUsageError(BILLING_USAGE);
|
|
84970
|
+
const { client } = await signedIn({ context, args });
|
|
84971
|
+
printAccount(
|
|
84972
|
+
{ context, args },
|
|
84973
|
+
await client.post("/api/billing-account/referral", { code })
|
|
84974
|
+
);
|
|
84975
|
+
}
|
|
84976
|
+
function addressLine(address) {
|
|
84977
|
+
if (!address) return "not set";
|
|
84978
|
+
const town = [address.postalCode, address.city].filter(Boolean).join(" ");
|
|
84979
|
+
return [address.line1, address.line2, town, address.state, address.country].filter(Boolean).join(", ");
|
|
84980
|
+
}
|
|
84981
|
+
function printDetails({ context, args }, details2) {
|
|
84982
|
+
if (args.flags.json) return printJson(context, details2);
|
|
84983
|
+
const taxId = details2.taxId ? `${details2.taxId.value} (${details2.taxId.type}, ${details2.taxId.status})` : "none";
|
|
84984
|
+
context.out(`Company: ${details2.companyName ?? "not set"}
|
|
84554
84985
|
`);
|
|
84986
|
+
context.out(`Billing email: ${details2.email ?? "not set"}
|
|
84987
|
+
`);
|
|
84988
|
+
context.out(`Address: ${addressLine(details2.address)}
|
|
84989
|
+
`);
|
|
84990
|
+
context.out(`Tax id: ${taxId}
|
|
84991
|
+
`);
|
|
84992
|
+
if (details2.taxIdRemoved) {
|
|
84993
|
+
context.out(
|
|
84994
|
+
`Removed: ${details2.taxIdRemoved.value}, which the EU VAT service rejected; invoices carry VAT until a valid number is set
|
|
84995
|
+
`
|
|
84996
|
+
);
|
|
84997
|
+
}
|
|
84555
84998
|
}
|
|
84556
|
-
var
|
|
84557
|
-
|
|
84558
|
-
|
|
84559
|
-
|
|
84560
|
-
|
|
84561
|
-
|
|
84562
|
-
ask: askOnTab,
|
|
84563
|
-
login: loginOnTab,
|
|
84564
|
-
share: shareTab,
|
|
84565
|
-
close: closeTab
|
|
84566
|
-
};
|
|
84567
|
-
async function browserTab({
|
|
84568
|
-
context,
|
|
84569
|
-
args,
|
|
84570
|
-
client
|
|
84571
|
-
}) {
|
|
84572
|
-
const handler = TAB_RUNS[args.words[1] ?? ""];
|
|
84573
|
-
if (!handler) throw new CliUsageError(BROWSER_TAB_USAGE);
|
|
84574
|
-
const json7 = Boolean(args.flags.json);
|
|
84575
|
-
const print9 = (value, text3) => context.out(json7 ? `${JSON.stringify(value, null, 2)}
|
|
84576
|
-
` : text3);
|
|
84577
|
-
return handler({ context, args, client, channel: channelOf({ context, args }), json: json7, print: print9 });
|
|
84999
|
+
var TAX_TYPES = ["eu_vat", "gb_vat", "ch_vat", "no_vat", "us_ein", "au_abn", "ca_bn"];
|
|
85000
|
+
function needed({ args, name: name3 }) {
|
|
85001
|
+
const value = flagText({ args, name: name3 });
|
|
85002
|
+
if (!value) throw new CliUsageError(`--${name3} is needed.
|
|
85003
|
+
${BILLING_USAGE}`);
|
|
85004
|
+
return value;
|
|
84578
85005
|
}
|
|
84579
|
-
|
|
84580
|
-
|
|
84581
|
-
args,
|
|
84582
|
-
|
|
84583
|
-
|
|
84584
|
-
|
|
84585
|
-
const channel = channelOf({ context, args });
|
|
84586
|
-
return await client.post(BROWSER_TAB_PATHS.cdp, { tab: word({ args, at: 2 }), ...channel });
|
|
84587
|
-
} catch (error63) {
|
|
84588
|
-
const missing = ["browser_tab_not_found", "not_found"];
|
|
84589
|
-
if (error63 instanceof LazeApiError && missing.includes(error63.code)) return null;
|
|
84590
|
-
throw error63;
|
|
85006
|
+
function detailsBody({ args }) {
|
|
85007
|
+
const taxText = flagText({ args, name: "tax-id" });
|
|
85008
|
+
const taxType = flagText({ args, name: "tax-type" }) || "eu_vat";
|
|
85009
|
+
if (!TAX_TYPES.includes(taxType)) {
|
|
85010
|
+
throw new CliUsageError(`--tax-type takes ${TAX_TYPES.join(", ")}.
|
|
85011
|
+
${BILLING_USAGE}`);
|
|
84591
85012
|
}
|
|
85013
|
+
return {
|
|
85014
|
+
companyName: needed({ args, name: "company" }),
|
|
85015
|
+
email: needed({ args, name: "email" }),
|
|
85016
|
+
address: {
|
|
85017
|
+
line1: needed({ args, name: "line1" }),
|
|
85018
|
+
line2: flagText({ args, name: "line2" }) || null,
|
|
85019
|
+
city: needed({ args, name: "city" }),
|
|
85020
|
+
postalCode: flagText({ args, name: "postal" }) || null,
|
|
85021
|
+
state: flagText({ args, name: "state" }) || null,
|
|
85022
|
+
country: needed({ args, name: "country" })
|
|
85023
|
+
},
|
|
85024
|
+
taxId: !taxText || taxText === "none" ? null : { type: taxType, value: taxText }
|
|
85025
|
+
};
|
|
85026
|
+
}
|
|
85027
|
+
async function details({ context, args }) {
|
|
85028
|
+
const action = args.words[2];
|
|
85029
|
+
if (action !== void 0 && action !== "set") throw new CliUsageError(BILLING_USAGE);
|
|
85030
|
+
const body = action === "set" ? detailsBody({ args }) : null;
|
|
85031
|
+
const { client } = await signedIn({ context, args });
|
|
85032
|
+
const answer6 = body ? await client.post("/api/billing-account/details", body) : await client.get("/api/billing-account/details");
|
|
85033
|
+
printDetails({ context, args }, answer6);
|
|
85034
|
+
}
|
|
85035
|
+
async function cancel({ context, args }) {
|
|
85036
|
+
const { client } = await signedIn({ context, args });
|
|
85037
|
+
printAccount({ context, args }, await client.post("/api/billing-account/cancel", {}));
|
|
85038
|
+
}
|
|
85039
|
+
async function keep({ context, args }) {
|
|
85040
|
+
const { client } = await signedIn({ context, args });
|
|
85041
|
+
printAccount({ context, args }, await client.post("/api/billing-account/keep", {}));
|
|
85042
|
+
}
|
|
85043
|
+
var BILLING_COMMANDS = {
|
|
85044
|
+
account: show,
|
|
85045
|
+
invoices,
|
|
85046
|
+
checkout,
|
|
85047
|
+
portal,
|
|
85048
|
+
currency,
|
|
85049
|
+
"top-up": topUp,
|
|
85050
|
+
"auto-recharge": autoRecharge,
|
|
85051
|
+
referral,
|
|
85052
|
+
details,
|
|
85053
|
+
cancel,
|
|
85054
|
+
keep
|
|
85055
|
+
};
|
|
85056
|
+
async function billing({ context, args }) {
|
|
85057
|
+
const name3 = args.words[1];
|
|
85058
|
+
if (name3 === void 0) return show({ context, args });
|
|
85059
|
+
const command = Object.hasOwn(BILLING_COMMANDS, name3) ? BILLING_COMMANDS[name3] : void 0;
|
|
85060
|
+
if (!command) throw new CliUsageError(BILLING_USAGE);
|
|
85061
|
+
await command({ context, args });
|
|
84592
85062
|
}
|
|
84593
85063
|
|
|
85064
|
+
// src/services/browser-commands.service.ts
|
|
85065
|
+
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
85066
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
85067
|
+
import { dirname as dirname17, join as join27 } from "node:path";
|
|
85068
|
+
|
|
84594
85069
|
// src/services/cdp-bridge.service.ts
|
|
84595
85070
|
import { spawn as spawn3 } from "node:child_process";
|
|
84596
85071
|
import { createServer as createServer2, request as httpRequest } from "node:http";
|
|
@@ -84620,7 +85095,7 @@ function tunnel({
|
|
|
84620
85095
|
host: host2,
|
|
84621
85096
|
port
|
|
84622
85097
|
}) {
|
|
84623
|
-
return new Promise((
|
|
85098
|
+
return new Promise((resolve27, reject) => {
|
|
84624
85099
|
const socket = connectTcp(proxy.port, proxy.host);
|
|
84625
85100
|
let answer6 = "";
|
|
84626
85101
|
const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
|
|
@@ -84637,7 +85112,7 @@ ${auth}\r
|
|
|
84637
85112
|
answer6 += chunk.toString("latin1");
|
|
84638
85113
|
if (!answer6.includes(HEADER_END)) return;
|
|
84639
85114
|
socket.off("data", onData);
|
|
84640
|
-
if (/^HTTP\/1\.[01] 200/.test(answer6)) return
|
|
85115
|
+
if (/^HTTP\/1\.[01] 200/.test(answer6)) return resolve27(socket);
|
|
84641
85116
|
socket.destroy();
|
|
84642
85117
|
reject(new Error(`proxy refused the tunnel: ${answer6.split("\r\n")[0] ?? ""}`));
|
|
84643
85118
|
};
|
|
@@ -84650,8 +85125,8 @@ async function upstreamOf({ target, proxy }) {
|
|
|
84650
85125
|
const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
|
|
84651
85126
|
if (!secure) return raw;
|
|
84652
85127
|
const tls = connectTls({ socket: raw, servername: target.hostname });
|
|
84653
|
-
await new Promise((
|
|
84654
|
-
tls.once("secureConnect", () =>
|
|
85128
|
+
await new Promise((resolve27, reject) => {
|
|
85129
|
+
tls.once("secureConnect", () => resolve27());
|
|
84655
85130
|
tls.once("error", reject);
|
|
84656
85131
|
});
|
|
84657
85132
|
return tls;
|
|
@@ -84693,8 +85168,8 @@ async function browserSocket({
|
|
|
84693
85168
|
createConnection: () => upstream,
|
|
84694
85169
|
perMessageDeflate: false
|
|
84695
85170
|
});
|
|
84696
|
-
await new Promise((
|
|
84697
|
-
socket.once("open", () =>
|
|
85171
|
+
await new Promise((resolve27, reject) => {
|
|
85172
|
+
socket.once("open", () => resolve27());
|
|
84698
85173
|
socket.once("error", reject);
|
|
84699
85174
|
});
|
|
84700
85175
|
return socket;
|
|
@@ -84707,12 +85182,12 @@ async function browserCall({
|
|
|
84707
85182
|
}) {
|
|
84708
85183
|
const socket = await browserSocket({ target, proxy });
|
|
84709
85184
|
try {
|
|
84710
|
-
return await new Promise((
|
|
85185
|
+
return await new Promise((resolve27, reject) => {
|
|
84711
85186
|
socket.on("message", (data) => {
|
|
84712
85187
|
const reply2 = JSON.parse(textOf3(data));
|
|
84713
85188
|
if (reply2.id !== 1) return;
|
|
84714
85189
|
if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
|
|
84715
|
-
else
|
|
85190
|
+
else resolve27(reply2.result ?? {});
|
|
84716
85191
|
});
|
|
84717
85192
|
socket.once(
|
|
84718
85193
|
"close",
|
|
@@ -84876,18 +85351,18 @@ function retargetCdpBridge({
|
|
|
84876
85351
|
target,
|
|
84877
85352
|
expiresAt
|
|
84878
85353
|
}) {
|
|
84879
|
-
return new Promise((
|
|
85354
|
+
return new Promise((resolve27) => {
|
|
84880
85355
|
const call = httpRequest(
|
|
84881
85356
|
{ host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
|
|
84882
85357
|
(response) => {
|
|
84883
85358
|
response.resume();
|
|
84884
|
-
|
|
85359
|
+
resolve27(response.statusCode === 204);
|
|
84885
85360
|
}
|
|
84886
85361
|
);
|
|
84887
85362
|
call.setHeader(KEY_HEADER, key);
|
|
84888
85363
|
call.setHeader("content-type", "application/json");
|
|
84889
85364
|
call.once("timeout", () => call.destroy());
|
|
84890
|
-
call.once("error", () =>
|
|
85365
|
+
call.once("error", () => resolve27(false));
|
|
84891
85366
|
call.end(JSON.stringify({ target, expiresAt }));
|
|
84892
85367
|
});
|
|
84893
85368
|
}
|
|
@@ -84936,15 +85411,15 @@ async function startCdpBridge({
|
|
|
84936
85411
|
(socket) => relayPage({ client: socket, targetId, target: url2, proxy })
|
|
84937
85412
|
);
|
|
84938
85413
|
});
|
|
84939
|
-
await new Promise((
|
|
85414
|
+
await new Promise((resolve27) => server.listen(0, "127.0.0.1", resolve27));
|
|
84940
85415
|
const port = server.address().port;
|
|
84941
85416
|
return {
|
|
84942
85417
|
port,
|
|
84943
|
-
close: () => new Promise((
|
|
85418
|
+
close: () => new Promise((resolve27) => {
|
|
84944
85419
|
for (const client of relayed) client.destroy();
|
|
84945
85420
|
pages.close();
|
|
84946
85421
|
server.closeAllConnections();
|
|
84947
|
-
server.close(() =>
|
|
85422
|
+
server.close(() => resolve27());
|
|
84948
85423
|
})
|
|
84949
85424
|
};
|
|
84950
85425
|
}
|
|
@@ -84961,7 +85436,7 @@ function launchCdpBridge({
|
|
|
84961
85436
|
stdio: ["ignore", "pipe", "ignore"],
|
|
84962
85437
|
env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
|
|
84963
85438
|
});
|
|
84964
|
-
return new Promise((
|
|
85439
|
+
return new Promise((resolve27, reject) => {
|
|
84965
85440
|
let printed2 = "";
|
|
84966
85441
|
child.once("error", reject);
|
|
84967
85442
|
child.once("exit", (code) => reject(new Error(`the CDP bridge stopped (${code})`)));
|
|
@@ -84972,7 +85447,7 @@ function launchCdpBridge({
|
|
|
84972
85447
|
child.stdout.destroy();
|
|
84973
85448
|
child.removeAllListeners("exit");
|
|
84974
85449
|
child.unref();
|
|
84975
|
-
if (Number.isInteger(port) && port > 0)
|
|
85450
|
+
if (Number.isInteger(port) && port > 0) resolve27(port);
|
|
84976
85451
|
else reject(new Error("the CDP bridge printed no port"));
|
|
84977
85452
|
});
|
|
84978
85453
|
});
|
|
@@ -85183,6 +85658,7 @@ async function change({
|
|
|
85183
85658
|
}
|
|
85184
85659
|
var TAB_COMMANDS = /* @__PURE__ */ new Set([
|
|
85185
85660
|
"open",
|
|
85661
|
+
"screenshot",
|
|
85186
85662
|
"tabs",
|
|
85187
85663
|
"tab",
|
|
85188
85664
|
"goto",
|
|
@@ -85817,12 +86293,12 @@ async function channelSettings({ context, args }) {
|
|
|
85817
86293
|
|
|
85818
86294
|
// src/services/chat-actions-commands.service.ts
|
|
85819
86295
|
import { readFile as readFile19 } from "node:fs/promises";
|
|
85820
|
-
import { basename as basename8, isAbsolute as isAbsolute2, relative as relative4, resolve as
|
|
86296
|
+
import { basename as basename8, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve11 } from "node:path";
|
|
85821
86297
|
|
|
85822
86298
|
// src/services/file-download.service.ts
|
|
85823
86299
|
import { createWriteStream } from "node:fs";
|
|
85824
86300
|
import { mkdir as mkdir8, rename as rename3, rm as rm13, stat as stat10, truncate } from "node:fs/promises";
|
|
85825
|
-
import { basename as basename7, dirname as dirname18, resolve as
|
|
86301
|
+
import { basename as basename7, dirname as dirname18, resolve as resolve10 } from "node:path";
|
|
85826
86302
|
import { Readable, Transform } from "node:stream";
|
|
85827
86303
|
import { pipeline } from "node:stream/promises";
|
|
85828
86304
|
var NOT_READY_WAIT_MS = 5e3;
|
|
@@ -85941,8 +86417,8 @@ async function downloadFile({
|
|
|
85941
86417
|
attachmentId,
|
|
85942
86418
|
out
|
|
85943
86419
|
}) {
|
|
85944
|
-
const asked = out ?
|
|
85945
|
-
const part =
|
|
86420
|
+
const asked = out ? resolve10(context.cwd, out) : void 0;
|
|
86421
|
+
const part = resolve10(asked ? dirname18(asked) : context.cwd, `.${attachmentId}.part`);
|
|
85946
86422
|
await mkdir8(dirname18(part), { recursive: true });
|
|
85947
86423
|
const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
|
|
85948
86424
|
async (error63) => {
|
|
@@ -85951,7 +86427,7 @@ async function downloadFile({
|
|
|
85951
86427
|
throw new CliUsageError(`Could not write ${attachmentId} to disk: ${String(error63)}`);
|
|
85952
86428
|
}
|
|
85953
86429
|
);
|
|
85954
|
-
const path = asked ??
|
|
86430
|
+
const path = asked ?? resolve10(context.cwd, named ?? attachmentId);
|
|
85955
86431
|
await rename3(part, path);
|
|
85956
86432
|
return { path, sizeBytes: await sizeOnDisk(path) };
|
|
85957
86433
|
}
|
|
@@ -86214,7 +86690,7 @@ function uploadNameOf({ cwd, path }) {
|
|
|
86214
86690
|
return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename8(path);
|
|
86215
86691
|
}
|
|
86216
86692
|
var fileUpload = async ({ context, args, client }) => {
|
|
86217
|
-
const path =
|
|
86693
|
+
const path = resolve11(context.cwd, wordAt(args, 3));
|
|
86218
86694
|
const bytes = new Uint8Array(await readFile19(path));
|
|
86219
86695
|
const answer6 = await uploadFile({
|
|
86220
86696
|
context,
|
|
@@ -86623,6 +87099,13 @@ var browserTabPageDefinition = external_exports.object({
|
|
|
86623
87099
|
truncated: external_exports.boolean()
|
|
86624
87100
|
});
|
|
86625
87101
|
var browserTabPageSchema = browserTabPageDefinition;
|
|
87102
|
+
var browserTabScreenshotDefinition = external_exports.object({
|
|
87103
|
+
tabId: external_exports.string().min(1),
|
|
87104
|
+
url: external_exports.string(),
|
|
87105
|
+
title: external_exports.string(),
|
|
87106
|
+
contentType: external_exports.literal("image/jpeg"),
|
|
87107
|
+
image: external_exports.string().min(1)
|
|
87108
|
+
});
|
|
86626
87109
|
var browserTabScreenDefinition = external_exports.discriminatedUnion("status", [
|
|
86627
87110
|
external_exports.object({
|
|
86628
87111
|
status: external_exports.literal("ready"),
|
|
@@ -87664,6 +88147,14 @@ var computerAttentionChangedDefinition = external_exports.object({
|
|
|
87664
88147
|
changeId: external_exports.string().min(1),
|
|
87665
88148
|
at: external_exports.iso.datetime()
|
|
87666
88149
|
});
|
|
88150
|
+
var whatsappWatchChangedDefinition = external_exports.object({
|
|
88151
|
+
workspaceId: external_exports.string().min(1),
|
|
88152
|
+
userId: external_exports.string().min(1),
|
|
88153
|
+
machineId: external_exports.string().min(1),
|
|
88154
|
+
change: external_exports.enum(["started", "woke", "full", "ended"]),
|
|
88155
|
+
changeId: external_exports.string().min(1),
|
|
88156
|
+
at: external_exports.iso.datetime()
|
|
88157
|
+
});
|
|
87667
88158
|
|
|
87668
88159
|
// ../../modules/compute/contract/src/dedicated-ip.ts
|
|
87669
88160
|
var DEDICATED_IP_MAX_DOMAINS = 50;
|
|
@@ -87955,6 +88446,23 @@ var chatPeopleDefinition = external_exports.object({
|
|
|
87955
88446
|
state: external_exports.enum(["listed", "none", "asleep", "unreachable"])
|
|
87956
88447
|
});
|
|
87957
88448
|
var whatsappChatPeopleSchema = chatPeopleDefinition;
|
|
88449
|
+
var watchChatInputDefinition = external_exports.object({
|
|
88450
|
+
workspaceId: workspaceIdSchema21,
|
|
88451
|
+
channelId: external_exports.string().min(1).max(64),
|
|
88452
|
+
/** The chat just came on screen: opened, focused again or shown again. Syncs it at once. */
|
|
88453
|
+
opened: external_exports.boolean().default(false)
|
|
88454
|
+
});
|
|
88455
|
+
var whatsappWatchInputSchema = watchChatInputDefinition;
|
|
88456
|
+
var whatsappWatchStateSchema = external_exports.enum(["awake", "waking", "full", "off"]);
|
|
88457
|
+
var watchDefinition = external_exports.object({ computer: whatsappWatchStateSchema });
|
|
88458
|
+
var whatsappWatchSchema = watchDefinition;
|
|
88459
|
+
var replyCheckDefinition = external_exports.object({ state: external_exports.enum(["clear", "newer", "unchecked"]) });
|
|
88460
|
+
var replyCheckInputDefinition = external_exports.object({
|
|
88461
|
+
...chatPeopleInputDefinition.shape,
|
|
88462
|
+
seenAt: external_exports.iso.datetime().optional()
|
|
88463
|
+
});
|
|
88464
|
+
var whatsappReplyCheckInputSchema = replyCheckInputDefinition;
|
|
88465
|
+
var whatsappReplyCheckSchema = replyCheckDefinition;
|
|
87958
88466
|
var limitSchema = external_exports.number().int().min(1).max(WHATSAPP_LIMIT_MAX);
|
|
87959
88467
|
var chatRefSchema = external_exports.string().trim().min(1).max(200);
|
|
87960
88468
|
var whatsappMachineRef = machineRefText2.optional();
|
|
@@ -88487,7 +88995,7 @@ var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
|
88487
88995
|
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema23, machineId: idSchema23 });
|
|
88488
88996
|
var ComputeApi = moduleApi()("compute");
|
|
88489
88997
|
var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("openLoginTerminal").withInput(openLoginTerminalInputSchema).withOutput(loginTerminalSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
|
|
88490
|
-
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("warmComputer").withInput(computeWorkspaceInputSchema).withOutput(warmComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).query("personComputer").withInput(personComputerInputSchema).withOutput(computerUseSchema2).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentLease").withInput(setWhatsappAgentLeaseInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappEveryAgent").withInput(setWhatsappEveryAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentAccess").withInput(setWhatsappAgentAccessInputSchema).withOutput(whatsappAgentsSchema).mutation("checkWhatsappNow").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappChatPeople").withInput(whatsappChatPeopleInputSchema).withOutput(whatsappChatPeopleSchema).build();
|
|
88998
|
+
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("warmComputer").withInput(computeWorkspaceInputSchema).withOutput(warmComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).query("personComputer").withInput(personComputerInputSchema).withOutput(computerUseSchema2).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentLease").withInput(setWhatsappAgentLeaseInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappEveryAgent").withInput(setWhatsappEveryAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentAccess").withInput(setWhatsappAgentAccessInputSchema).withOutput(whatsappAgentsSchema).mutation("checkWhatsappNow").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappChatPeople").withInput(whatsappChatPeopleInputSchema).withOutput(whatsappChatPeopleSchema).mutation("watchWhatsappChat").withInput(whatsappWatchInputSchema).withOutput(whatsappWatchSchema).mutation("checkWhatsappReply").withInput(whatsappReplyCheckInputSchema).withOutput(whatsappReplyCheckSchema).build();
|
|
88491
88999
|
var computeTrpc = joinTrpcContracts(
|
|
88492
89000
|
"compute",
|
|
88493
89001
|
computeCoreTrpc,
|
|
@@ -88655,7 +89163,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
|
|
|
88655
89163
|
// src/services/computer-copy-commands.service.ts
|
|
88656
89164
|
import { mkdtemp as mkdtemp2, open as open5, rm as rm15, stat as stat11 } from "node:fs/promises";
|
|
88657
89165
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
88658
|
-
import { basename as basename9, dirname as dirname19, resolve as
|
|
89166
|
+
import { basename as basename9, dirname as dirname19, resolve as resolve12 } from "node:path";
|
|
88659
89167
|
var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
|
|
88660
89168
|
copy a local file or folder into your hosted agent's work folder
|
|
88661
89169
|
(its owner only, up to 2 GiB packed); <folder> is relative to the
|
|
@@ -88669,7 +89177,7 @@ function stringFlag(args, name3) {
|
|
|
88669
89177
|
}
|
|
88670
89178
|
function packingOf({ path, isDirectory }) {
|
|
88671
89179
|
const contents = isDirectory && path.endsWith("/");
|
|
88672
|
-
const absolute =
|
|
89180
|
+
const absolute = resolve12(path);
|
|
88673
89181
|
const name3 = basename9(absolute);
|
|
88674
89182
|
return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname19(absolute), entry: name3 };
|
|
88675
89183
|
}
|
|
@@ -88715,15 +89223,15 @@ async function copy({ context, args }) {
|
|
|
88715
89223
|
if (!path || !agent3) throw new CliUsageError(`Usage:
|
|
88716
89224
|
${COMPUTER_COPY_USAGE}`);
|
|
88717
89225
|
const to = stringFlag(args, "to") ?? ".";
|
|
88718
|
-
const full =
|
|
89226
|
+
const full = resolve12(context.cwd, path);
|
|
88719
89227
|
const found = await stat11(full).catch(() => void 0);
|
|
88720
89228
|
if (!found) throw new CliUsageError(`${path} does not exist`);
|
|
88721
89229
|
const { name: name3, parent, entry } = packingOf({
|
|
88722
89230
|
path: path.endsWith("/") ? `${full}/` : full,
|
|
88723
89231
|
isDirectory: found.isDirectory()
|
|
88724
89232
|
});
|
|
88725
|
-
const dir = await mkdtemp2(
|
|
88726
|
-
const archive2 =
|
|
89233
|
+
const dir = await mkdtemp2(resolve12(tmpdir4(), "laze-copy-"));
|
|
89234
|
+
const archive2 = resolve12(dir, `${name3}.tar.gz`);
|
|
88727
89235
|
try {
|
|
88728
89236
|
const code = await context.runCommand({
|
|
88729
89237
|
command: ["tar", "-czf", archive2, "-C", parent, entry],
|
|
@@ -89049,8 +89557,101 @@ import { readFile as readFile21 } from "node:fs/promises";
|
|
|
89049
89557
|
|
|
89050
89558
|
// src/services/mcp-gateway.service.ts
|
|
89051
89559
|
import { mkdir as mkdir9, readFile as readFile20, writeFile as writeFile7 } from "node:fs/promises";
|
|
89052
|
-
import { basename as basename10, join as join28, resolve as
|
|
89560
|
+
import { basename as basename10, join as join28, resolve as resolve13 } from "node:path";
|
|
89053
89561
|
import { createInterface as createInterface3 } from "node:readline";
|
|
89562
|
+
|
|
89563
|
+
// src/services/mcp-support.service.ts
|
|
89564
|
+
var SUPPORT_TOOL_NAMES = ["support_read_thread", "support_answer", "support_needs_human"];
|
|
89565
|
+
var THREAD_ID = { type: "string", description: "The support thread id your turn names" };
|
|
89566
|
+
var INPUTS = {
|
|
89567
|
+
support_read_thread: { properties: { threadId: THREAD_ID }, required: ["threadId"] },
|
|
89568
|
+
support_answer: {
|
|
89569
|
+
properties: {
|
|
89570
|
+
threadId: THREAD_ID,
|
|
89571
|
+
text: { type: "string", description: "Your answer, as the customer reads it" }
|
|
89572
|
+
},
|
|
89573
|
+
required: ["threadId", "text"]
|
|
89574
|
+
},
|
|
89575
|
+
support_needs_human: {
|
|
89576
|
+
properties: {
|
|
89577
|
+
threadId: THREAD_ID,
|
|
89578
|
+
reason: { type: "string", description: "One line for staff: what you cannot answer" }
|
|
89579
|
+
},
|
|
89580
|
+
required: ["threadId", "reason"]
|
|
89581
|
+
}
|
|
89582
|
+
};
|
|
89583
|
+
var SUPPORT_MCP_TOOLS = AGENT_MCP_TOOLS.filter(
|
|
89584
|
+
(tool) => SUPPORT_TOOL_NAMES.includes(tool.name)
|
|
89585
|
+
).map((tool) => ({
|
|
89586
|
+
name: tool.name,
|
|
89587
|
+
description: tool.description ?? tool.name,
|
|
89588
|
+
inputSchema: { type: "object", additionalProperties: false, ...INPUTS[tool.name] }
|
|
89589
|
+
}));
|
|
89590
|
+
var SAFE_THREAD_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
89591
|
+
var METHOD_NOT_FOUND = -32601;
|
|
89592
|
+
var INVALID_PARAMS = -32602;
|
|
89593
|
+
var recordOf3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
89594
|
+
async function answerSupportLine({
|
|
89595
|
+
line,
|
|
89596
|
+
turn,
|
|
89597
|
+
client
|
|
89598
|
+
}) {
|
|
89599
|
+
let request2;
|
|
89600
|
+
try {
|
|
89601
|
+
request2 = recordOf3(JSON.parse(line));
|
|
89602
|
+
} catch {
|
|
89603
|
+
return rpc(null, { error: { code: -32700, message: "Parse error" } });
|
|
89604
|
+
}
|
|
89605
|
+
const { id: id4, method } = request2;
|
|
89606
|
+
if (id4 === void 0 || id4 === null) return "";
|
|
89607
|
+
const params = recordOf3(request2.params);
|
|
89608
|
+
if (method === "initialize") {
|
|
89609
|
+
return rpc(id4, {
|
|
89610
|
+
result: {
|
|
89611
|
+
protocolVersion: typeof params.protocolVersion === "string" ? params.protocolVersion : "2025-06-18",
|
|
89612
|
+
capabilities: { tools: {} },
|
|
89613
|
+
serverInfo: { name: "laze", version: "support" }
|
|
89614
|
+
}
|
|
89615
|
+
});
|
|
89616
|
+
}
|
|
89617
|
+
if (method === "ping") return rpc(id4, { result: {} });
|
|
89618
|
+
if (method === "tools/list") return rpc(id4, { result: { tools: SUPPORT_MCP_TOOLS } });
|
|
89619
|
+
if (method !== "tools/call") {
|
|
89620
|
+
return rpc(id4, { error: { code: METHOD_NOT_FOUND, message: `No method ${String(method)}` } });
|
|
89621
|
+
}
|
|
89622
|
+
const call = routeOf({ name: params.name, input: recordOf3(params.arguments) });
|
|
89623
|
+
if (!call) return rpc(id4, { error: { code: INVALID_PARAMS, message: "Unknown tool or input" } });
|
|
89624
|
+
const scoped = client.withHeaders({ "x-laze-turn": turn });
|
|
89625
|
+
try {
|
|
89626
|
+
const answer6 = call.body === void 0 ? await scoped.get(call.path) : await scoped.post(call.path, call.body);
|
|
89627
|
+
return rpc(id4, { result: { content: [{ type: "text", text: JSON.stringify(answer6) }] } });
|
|
89628
|
+
} catch (error63) {
|
|
89629
|
+
if (!(error63 instanceof LazeApiError)) throw error63;
|
|
89630
|
+
const text3 = `${error63.code}: ${error63.message}`;
|
|
89631
|
+
return rpc(id4, { result: { content: [{ type: "text", text: text3 }], isError: true } });
|
|
89632
|
+
}
|
|
89633
|
+
}
|
|
89634
|
+
function routeOf({
|
|
89635
|
+
name: name3,
|
|
89636
|
+
input: input2
|
|
89637
|
+
}) {
|
|
89638
|
+
const { threadId, text: text3, reason: reason2 } = input2;
|
|
89639
|
+
if (typeof threadId !== "string" || !SAFE_THREAD_ID.test(threadId)) return null;
|
|
89640
|
+
const thread2 = `/api/support/agent/threads/${threadId}`;
|
|
89641
|
+
if (name3 === "support_read_thread") return { path: thread2 };
|
|
89642
|
+
if (name3 === "support_answer" && typeof text3 === "string") {
|
|
89643
|
+
return { path: `${thread2}/answer`, body: { text: text3 } };
|
|
89644
|
+
}
|
|
89645
|
+
if (name3 === "support_needs_human" && typeof reason2 === "string") {
|
|
89646
|
+
return { path: `${thread2}/needs-human`, body: { reason: reason2 } };
|
|
89647
|
+
}
|
|
89648
|
+
return null;
|
|
89649
|
+
}
|
|
89650
|
+
function rpc(id4, body) {
|
|
89651
|
+
return JSON.stringify({ jsonrpc: "2.0", id: id4, ...body });
|
|
89652
|
+
}
|
|
89653
|
+
|
|
89654
|
+
// src/services/mcp-gateway.service.ts
|
|
89054
89655
|
var TURN_HEADER = "x-laze-turn";
|
|
89055
89656
|
function serveMcpGateway({
|
|
89056
89657
|
context,
|
|
@@ -89085,7 +89686,7 @@ async function relayMcpLines({
|
|
|
89085
89686
|
watchMs = WATCH_MS2
|
|
89086
89687
|
}) {
|
|
89087
89688
|
const pending2 = lines2[Symbol.asyncIterator]();
|
|
89088
|
-
const { profile } = await signedIn({ context, args });
|
|
89689
|
+
const { profile, client } = await signedIn({ context, args });
|
|
89089
89690
|
const env = context.environment.inherited;
|
|
89090
89691
|
if (!profile.agentId || !env.LAZE_TURN_FILE)
|
|
89091
89692
|
throw new CliUsageError("laze mcp gateway runs only on a Laze agent's computer");
|
|
@@ -89099,8 +89700,9 @@ async function relayMcpLines({
|
|
|
89099
89700
|
const relay2 = {
|
|
89100
89701
|
readTurn,
|
|
89101
89702
|
out: (text3) => context.out(text3),
|
|
89102
|
-
saveFile: (file4) => saveMailFile({ root:
|
|
89703
|
+
saveFile: (file4) => saveMailFile({ root: resolve13(context.cwd, MAIL_FILES_DIR), file: file4 }),
|
|
89103
89704
|
post: async ({ line, turn }) => {
|
|
89705
|
+
if (args.flags.support === true) return answerSupportLine({ line, turn, client });
|
|
89104
89706
|
const response = await context.fetcher(url2, {
|
|
89105
89707
|
method: "POST",
|
|
89106
89708
|
headers: {
|
|
@@ -89313,7 +89915,7 @@ async function connect({
|
|
|
89313
89915
|
|
|
89314
89916
|
// src/services/connector-commands.service.ts
|
|
89315
89917
|
import { readFile as readFile23 } from "node:fs/promises";
|
|
89316
|
-
import { resolve as
|
|
89918
|
+
import { resolve as resolve14 } from "node:path";
|
|
89317
89919
|
|
|
89318
89920
|
// src/services/vault-keychain-commands.service.ts
|
|
89319
89921
|
import { readFile as readFile22 } from "node:fs/promises";
|
|
@@ -89627,7 +90229,7 @@ async function inTurn({
|
|
|
89627
90229
|
command
|
|
89628
90230
|
}) {
|
|
89629
90231
|
const env = context.environment.inherited;
|
|
89630
|
-
const turn = await
|
|
90232
|
+
const turn = await turnTokenOf2({ env, turnFile: turnFileOf({ env }), command });
|
|
89631
90233
|
return client.withHeaders({ "x-laze-turn": turn });
|
|
89632
90234
|
}
|
|
89633
90235
|
function printShare({ context, grant }) {
|
|
@@ -89967,7 +90569,7 @@ async function keyText({ context, args }) {
|
|
|
89967
90569
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
89968
90570
|
}
|
|
89969
90571
|
const file4 = flagText({ args, name: "from-file" });
|
|
89970
|
-
const text3 = file4 ? await readFile23(
|
|
90572
|
+
const text3 = file4 ? await readFile23(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
|
|
89971
90573
|
const trimmed = text3.trim();
|
|
89972
90574
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
89973
90575
|
return trimmed;
|
|
@@ -90196,6 +90798,7 @@ var CONVERSATION_USAGE = `Usage:
|
|
|
90196
90798
|
laze conversation new <agent> <text|-> start a conversation with an agent (people)
|
|
90197
90799
|
[--about <message id>] continue from a message: the first one quotes it
|
|
90198
90800
|
laze conversation list [--agent <agent>] yours (an agent: its own; --unnamed for untitled)
|
|
90801
|
+
[--closed] only the closed ones, which the list leaves out
|
|
90199
90802
|
laze conversation rename <id> <title> name it (its agent, or a person in it)
|
|
90200
90803
|
laze conversation join <id> open one of an agent shared with you
|
|
90201
90804
|
laze conversation close <id> close it for everyone (who started it, or an admin)
|
|
@@ -90236,10 +90839,13 @@ async function conversationList({ context, args }) {
|
|
|
90236
90839
|
...agent3 ? { agent: agent3 } : {},
|
|
90237
90840
|
...args.flags.unnamed ? { unnamed: true } : {}
|
|
90238
90841
|
});
|
|
90239
|
-
|
|
90842
|
+
const closed = Boolean(args.flags.closed);
|
|
90843
|
+
const shown2 = listed.filter((chat) => Boolean(chat.closedAt) === closed);
|
|
90844
|
+
if (args.flags.json) return context.out(`${JSON.stringify(shown2, null, 2)}
|
|
90240
90845
|
`);
|
|
90241
|
-
if (
|
|
90242
|
-
|
|
90846
|
+
if (shown2.length === 0)
|
|
90847
|
+
return context.out(closed ? "No closed conversations.\n" : "No conversations.\n");
|
|
90848
|
+
for (const chat of shown2) context.out(`${conversationLineOf(chat)}
|
|
90243
90849
|
`);
|
|
90244
90850
|
}
|
|
90245
90851
|
async function conversationRename({ context, args }) {
|
|
@@ -90328,7 +90934,7 @@ async function conversationDelete({ context, args }) {
|
|
|
90328
90934
|
|
|
90329
90935
|
// src/services/discord-commands.service.ts
|
|
90330
90936
|
import { readFile as readFile24 } from "node:fs/promises";
|
|
90331
|
-
import { resolve as
|
|
90937
|
+
import { resolve as resolve15 } from "node:path";
|
|
90332
90938
|
|
|
90333
90939
|
// ../../modules/discord/contract/src/discord.ts
|
|
90334
90940
|
var workspaceIdSchema25 = external_exports.string().min(1).max(64);
|
|
@@ -90675,7 +91281,7 @@ async function secretsOf({ context, args }) {
|
|
|
90675
91281
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
90676
91282
|
if (fromConnection) return { fromConnection };
|
|
90677
91283
|
const file4 = flagText({ args, name: "from-file" });
|
|
90678
|
-
const text3 = file4 ? await readFile24(
|
|
91284
|
+
const text3 = file4 ? await readFile24(resolve15(context.cwd, file4), "utf8") : await context.readStdin();
|
|
90679
91285
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
90680
91286
|
if (lines2.length !== 2) {
|
|
90681
91287
|
throw new CliUsageError(
|
|
@@ -90979,7 +91585,7 @@ async function domains({ context, args }) {
|
|
|
90979
91585
|
|
|
90980
91586
|
// src/services/emoji-commands.service.ts
|
|
90981
91587
|
import { readFile as readFile25 } from "node:fs/promises";
|
|
90982
|
-
import { resolve as
|
|
91588
|
+
import { resolve as resolve16 } from "node:path";
|
|
90983
91589
|
var EMOJI_USAGE = `Usage:
|
|
90984
91590
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
90985
91591
|
laze emoji add <name> <file> [--alias <a,b>] add a PNG, JPEG or GIF as :name: (made 128px square)
|
|
@@ -91019,7 +91625,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
91019
91625
|
const file4 = wordAt4(args, 3);
|
|
91020
91626
|
let bytes;
|
|
91021
91627
|
try {
|
|
91022
|
-
bytes = new Uint8Array(await readFile25(
|
|
91628
|
+
bytes = new Uint8Array(await readFile25(resolve16(context.cwd, file4)));
|
|
91023
91629
|
} catch {
|
|
91024
91630
|
throw new CliUsageError(`Cannot read ${file4}.`);
|
|
91025
91631
|
}
|
|
@@ -91082,6 +91688,7 @@ var EXTERNAL_CONNECTION_REST_PATHS = {
|
|
|
91082
91688
|
declineShare: "/api/external-connections/decline-share",
|
|
91083
91689
|
unshare: "/api/external-connections/unshare",
|
|
91084
91690
|
dm: "/api/external-connections/dm",
|
|
91691
|
+
letAgentIn: "/api/external-connections/let-agent-in",
|
|
91085
91692
|
block: "/api/external-connections/block",
|
|
91086
91693
|
report: "/api/external-connections/report"
|
|
91087
91694
|
};
|
|
@@ -91108,7 +91715,7 @@ var workspaceDefinition = external_exports.object({
|
|
|
91108
91715
|
});
|
|
91109
91716
|
var personDefinition = external_exports.object({ userId: external_exports.string(), name: external_exports.string() });
|
|
91110
91717
|
var settingsDefinition = external_exports.object({
|
|
91111
|
-
/**
|
|
91718
|
+
/** This side lets the other side's agents into the channels shared with it; on by default. */
|
|
91112
91719
|
agentsAllowed: external_exports.boolean(),
|
|
91113
91720
|
/** The other side's people may start a direct message with this side's people. */
|
|
91114
91721
|
directAllowed: external_exports.boolean()
|
|
@@ -91256,6 +91863,19 @@ var settingsInputDefinition = external_exports.object({
|
|
|
91256
91863
|
directAllowed: external_exports.boolean().optional()
|
|
91257
91864
|
});
|
|
91258
91865
|
var externalSettingsInputSchema = settingsInputDefinition;
|
|
91866
|
+
var letAgentInInputDefinition = external_exports.object({
|
|
91867
|
+
workspaceId: workspaceIdSchema26,
|
|
91868
|
+
channelId: idSchema24,
|
|
91869
|
+
agentId: idSchema24
|
|
91870
|
+
});
|
|
91871
|
+
var externalLetAgentInInputSchema = letAgentInInputDefinition;
|
|
91872
|
+
var agentLetInDefinition = external_exports.object({
|
|
91873
|
+
channelId: external_exports.string(),
|
|
91874
|
+
agentId: external_exports.string(),
|
|
91875
|
+
/** The workspace whose people may now talk to the agent. */
|
|
91876
|
+
peer: workspaceDefinition
|
|
91877
|
+
});
|
|
91878
|
+
var externalAgentLetInSchema = agentLetInDefinition;
|
|
91259
91879
|
var shareInputDefinition = external_exports.object({
|
|
91260
91880
|
workspaceId: workspaceIdSchema26,
|
|
91261
91881
|
connection: connectionReference,
|
|
@@ -91307,8 +91927,16 @@ var directDefinition = external_exports.object({
|
|
|
91307
91927
|
messageId: external_exports.string().nullable()
|
|
91308
91928
|
});
|
|
91309
91929
|
var externalDirectSchema = directDefinition;
|
|
91930
|
+
var peerChannelDefinition = external_exports.object({
|
|
91931
|
+
/** This side's conversation. */
|
|
91932
|
+
channelId: external_exports.string(),
|
|
91933
|
+
peerWorkspaceId: external_exports.string(),
|
|
91934
|
+
peerWorkspaceName: external_exports.string(),
|
|
91935
|
+
/** The other side's conversation. */
|
|
91936
|
+
peerChannelId: external_exports.string()
|
|
91937
|
+
});
|
|
91310
91938
|
var ExternalConnectionApi = moduleApi()("external-connection");
|
|
91311
|
-
var externalConnectionTrpc = defineTrpcContract("externalConnection").query("overview").withInput(workspaceInput5).withOutput(externalOverviewSchema).query("roster").withInput(externalRosterInputSchema).withOutput(externalRosterSchema).query("rosterCounts").withInput(externalRosterCountsInputSchema).withOutput(externalRosterCountsSchema).query("myInvitations").withInput(workspaceInput5).withOutput(external_exports.array(externalInvitationSchema)).mutation("invite").withInput(externalInviteInputSchema).withOutput(externalSentInviteSchema).mutation("revokeInvite").withInput(externalInviteRefSchema).withOutput(externalSentInviteSchema).mutation("resendInvite").withInput(externalInviteRefSchema).withOutput(externalSentInviteSchema).query("pendingShares").withInput(workspaceInput5).withOutput(externalPendingSharesSchema).mutation("acceptInvite").withInput(externalAcceptInviteInputSchema).withOutput(externalConnectionSchema).mutation("declineInvite").withInput(externalInviteRefSchema).withOutput(externalInviteAnsweredSchema).mutation("forwardInvite").withInput(externalInviteRefSchema).withOutput(externalInviteAnsweredSchema).mutation("disconnect").withInput(externalConnectionInputSchema).withOutput(externalConnectionSchema).mutation("updateSettings").withInput(externalSettingsInputSchema).withOutput(externalConnectionSchema).mutation("shareChannel").withInput(externalShareInputSchema).withOutput(externalSharedChannelSchema).mutation("acceptShare").withInput(externalAcceptShareInputSchema).withOutput(externalSharedChannelSchema).mutation("declineShare").withInput(externalShareRefSchema).withOutput(externalSharedChannelSchema).mutation("stopSharing").withInput(externalShareRefSchema).withOutput(externalSharedChannelSchema).mutation("block").withInput(externalConnectionInputSchema).withOutput(externalBlockedSchema).mutation("report").withInput(externalReportInputSchema).withOutput(externalBlockedSchema).mutation("openDirect").withInput(externalOpenDirectInputSchema).withOutput(externalDirectSchema).build();
|
|
91939
|
+
var externalConnectionTrpc = defineTrpcContract("externalConnection").query("overview").withInput(workspaceInput5).withOutput(externalOverviewSchema).query("roster").withInput(externalRosterInputSchema).withOutput(externalRosterSchema).query("rosterCounts").withInput(externalRosterCountsInputSchema).withOutput(externalRosterCountsSchema).query("myInvitations").withInput(workspaceInput5).withOutput(external_exports.array(externalInvitationSchema)).mutation("invite").withInput(externalInviteInputSchema).withOutput(externalSentInviteSchema).mutation("revokeInvite").withInput(externalInviteRefSchema).withOutput(externalSentInviteSchema).mutation("resendInvite").withInput(externalInviteRefSchema).withOutput(externalSentInviteSchema).query("pendingShares").withInput(workspaceInput5).withOutput(externalPendingSharesSchema).mutation("acceptInvite").withInput(externalAcceptInviteInputSchema).withOutput(externalConnectionSchema).mutation("declineInvite").withInput(externalInviteRefSchema).withOutput(externalInviteAnsweredSchema).mutation("forwardInvite").withInput(externalInviteRefSchema).withOutput(externalInviteAnsweredSchema).mutation("disconnect").withInput(externalConnectionInputSchema).withOutput(externalConnectionSchema).mutation("updateSettings").withInput(externalSettingsInputSchema).withOutput(externalConnectionSchema).mutation("shareChannel").withInput(externalShareInputSchema).withOutput(externalSharedChannelSchema).mutation("acceptShare").withInput(externalAcceptShareInputSchema).withOutput(externalSharedChannelSchema).mutation("declineShare").withInput(externalShareRefSchema).withOutput(externalSharedChannelSchema).mutation("stopSharing").withInput(externalShareRefSchema).withOutput(externalSharedChannelSchema).mutation("block").withInput(externalConnectionInputSchema).withOutput(externalBlockedSchema).mutation("report").withInput(externalReportInputSchema).withOutput(externalBlockedSchema).mutation("openDirect").withInput(externalOpenDirectInputSchema).withOutput(externalDirectSchema).mutation("letAgentIn").withInput(externalLetAgentInInputSchema).withOutput(externalAgentLetInSchema).build();
|
|
91312
91940
|
|
|
91313
91941
|
// ../../modules/external-connection/contract/src/external-connection.config.ts
|
|
91314
91942
|
var externalConnectionConfig = Config.define(() => ({ publicBaseUrl }));
|
|
@@ -91327,6 +91955,7 @@ var acceptShareDefinition2 = externalAcceptShareInputSchema.omit(keyed2);
|
|
|
91327
91955
|
var shareRefDefinition2 = externalShareRefSchema.omit(keyed2);
|
|
91328
91956
|
var reportDefinition = externalReportInputSchema.omit(keyed2);
|
|
91329
91957
|
var directDefinition2 = externalOpenDirectInputSchema.omit(keyed2);
|
|
91958
|
+
var letAgentInDefinition = externalLetAgentInInputSchema.omit(keyed2);
|
|
91330
91959
|
|
|
91331
91960
|
// ../../modules/external-connection/contract/src/external-connection.ui.ts
|
|
91332
91961
|
var externalUi = uiTokens("external-connection");
|
|
@@ -91336,7 +91965,7 @@ var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
|
91336
91965
|
|
|
91337
91966
|
// src/services/workspace-commands.service.ts
|
|
91338
91967
|
import { readFile as readFile26 } from "node:fs/promises";
|
|
91339
|
-
import { resolve as
|
|
91968
|
+
import { resolve as resolve17 } from "node:path";
|
|
91340
91969
|
var ROLE_NAMES2 = {
|
|
91341
91970
|
OWNER: "Owner",
|
|
91342
91971
|
ADMIN: "Admin",
|
|
@@ -91518,7 +92147,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
91518
92147
|
async function readLogo({ context, file: file4 }) {
|
|
91519
92148
|
let bytes;
|
|
91520
92149
|
try {
|
|
91521
|
-
bytes = new Uint8Array(await readFile26(
|
|
92150
|
+
bytes = new Uint8Array(await readFile26(resolve17(context.cwd, file4)));
|
|
91522
92151
|
} catch {
|
|
91523
92152
|
throw new CliUsageError(`No file to read at ${file4}.`);
|
|
91524
92153
|
}
|
|
@@ -91764,12 +92393,13 @@ var EXTERNAL_USAGE = `Usage:
|
|
|
91764
92393
|
laze external decline <invitation id> decline an invitation (admins)
|
|
91765
92394
|
laze external forward <invitation id> hand an invitation addressed to you to your admins
|
|
91766
92395
|
laze external disconnect <workspace> end a connection; shared channels stay readable (admins)
|
|
91767
|
-
laze external settings <workspace> [--agents on|off] [--dms on|off]
|
|
92396
|
+
laze external settings <workspace> [--agents on|off] [--dms on|off] other organisations' agents and DMs here (admins)
|
|
91768
92397
|
laze external share <#channel> --with <workspace> share a channel; their admins accept it (admins)
|
|
91769
92398
|
laze external accept-share <share id> [--name <name>] [--private] take a shared channel (admins)
|
|
91770
92399
|
laze external decline-share <share id> turn a shared channel down (admins)
|
|
91771
92400
|
laze external unshare <share id|#channel> stop sharing a channel, or leave one shared with you (admins)
|
|
91772
92401
|
laze external dm <person> [--connection <workspace>] [<message>|-] a DM with someone you share a channel with
|
|
92402
|
+
laze external agent-in <channel id> <agent id> let your agent into a shared channel; the other side's people can talk to it
|
|
91773
92403
|
laze external block <workspace> disconnect and refuse their invitations (admins)
|
|
91774
92404
|
laze external report <workspace> --note "<why>" report a workspace to Laze staff, and block it (admins)`;
|
|
91775
92405
|
var printJson6 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
@@ -92038,6 +92668,18 @@ async function direct({ context, args }) {
|
|
|
92038
92668
|
`
|
|
92039
92669
|
);
|
|
92040
92670
|
}
|
|
92671
|
+
async function agentIn({ context, args }) {
|
|
92672
|
+
const channelId = wordAt5({ args, at: 2, what: "the shared channel's id" });
|
|
92673
|
+
const agentId = wordAt5({ args, at: 3, what: "your agent's id" });
|
|
92674
|
+
const { client } = await clientOf2({ context, args });
|
|
92675
|
+
const answer6 = await client.post(EXTERNAL_CONNECTION_REST_PATHS.letAgentIn, {
|
|
92676
|
+
channelId,
|
|
92677
|
+
agentId
|
|
92678
|
+
});
|
|
92679
|
+
if (args.flags.json) return printJson6(context, answer6);
|
|
92680
|
+
context.out(`Let your agent in. People from ${answer6.peer.name} can talk to it.
|
|
92681
|
+
`);
|
|
92682
|
+
}
|
|
92041
92683
|
async function block({ context, args }) {
|
|
92042
92684
|
const connection = wordAt5({ args, at: 2, what: "the workspace to block" });
|
|
92043
92685
|
const { client } = await clientOf2({ context, args });
|
|
@@ -92080,6 +92722,7 @@ var EXTERNAL_COMMANDS = {
|
|
|
92080
92722
|
"decline-share": declineShare,
|
|
92081
92723
|
unshare,
|
|
92082
92724
|
dm: direct,
|
|
92725
|
+
"agent-in": agentIn,
|
|
92083
92726
|
block,
|
|
92084
92727
|
report
|
|
92085
92728
|
};
|
|
@@ -92119,7 +92762,7 @@ async function agentFeedAccess({
|
|
|
92119
92762
|
|
|
92120
92763
|
// src/services/feed-commands.service.ts
|
|
92121
92764
|
import { readFile as readFile27 } from "node:fs/promises";
|
|
92122
|
-
import { resolve as
|
|
92765
|
+
import { resolve as resolve18 } from "node:path";
|
|
92123
92766
|
|
|
92124
92767
|
// ../../modules/feed/contract/src/feed.delegate.ts
|
|
92125
92768
|
var feedDelegateSchemaDefinition = external_exports.object({
|
|
@@ -93308,7 +93951,7 @@ async function bodyOf2({
|
|
|
93308
93951
|
flags: flags2
|
|
93309
93952
|
}) {
|
|
93310
93953
|
const body = { ...flags2.fields };
|
|
93311
|
-
const read4 = (source) => "file" in source ? readFile27(
|
|
93954
|
+
const read4 = (source) => "file" in source ? readFile27(resolve18(context.cwd, source.file), "utf8") : source.text;
|
|
93312
93955
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
|
|
93313
93956
|
if (flags2.rich) {
|
|
93314
93957
|
const text3 = await read4(flags2.rich.source);
|
|
@@ -93571,7 +94214,7 @@ async function textFlag({
|
|
|
93571
94214
|
}) {
|
|
93572
94215
|
const value = flagText({ args, name: name3 });
|
|
93573
94216
|
if (!value.startsWith("@")) return value;
|
|
93574
|
-
return readFile27(
|
|
94217
|
+
return readFile27(resolve18(context.cwd, value.slice(1)), "utf8");
|
|
93575
94218
|
}
|
|
93576
94219
|
async function feedList({ context, args }) {
|
|
93577
94220
|
const { client } = await signedIn({ context, args });
|
|
@@ -93661,7 +94304,7 @@ async function ranksOf({
|
|
|
93661
94304
|
}) {
|
|
93662
94305
|
const file4 = flagText({ args, name: "file" });
|
|
93663
94306
|
if (file4) {
|
|
93664
|
-
const parsed = JSON.parse(await readFile27(
|
|
94307
|
+
const parsed = JSON.parse(await readFile27(resolve18(context.cwd, file4), "utf8"));
|
|
93665
94308
|
if (Array.isArray(parsed)) return parsed;
|
|
93666
94309
|
throw new CliUsageError("--file holds a list of {itemId, priority}");
|
|
93667
94310
|
}
|
|
@@ -95459,13 +96102,13 @@ var TOOLS = [
|
|
|
95459
96102
|
}
|
|
95460
96103
|
];
|
|
95461
96104
|
var LOCAL_TOOL = TOOLS[0];
|
|
95462
|
-
function
|
|
96105
|
+
function recordOf4(value) {
|
|
95463
96106
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
95464
96107
|
}
|
|
95465
96108
|
function idsOf(message2) {
|
|
95466
96109
|
const messages = Array.isArray(message2) ? message2 : [message2];
|
|
95467
96110
|
return messages.flatMap((each) => {
|
|
95468
|
-
const id4 =
|
|
96111
|
+
const id4 = recordOf4(each).id;
|
|
95469
96112
|
return id4 === void 0 || id4 === null ? [] : [id4];
|
|
95470
96113
|
});
|
|
95471
96114
|
}
|
|
@@ -95518,9 +96161,9 @@ async function runCommandLineTool({
|
|
|
95518
96161
|
return { text: out.trimEnd() || "Done.", isError: false };
|
|
95519
96162
|
}
|
|
95520
96163
|
function withLocalTools(answer6) {
|
|
95521
|
-
const result2 =
|
|
96164
|
+
const result2 = recordOf4(recordOf4(answer6).result);
|
|
95522
96165
|
if (!Array.isArray(result2.tools)) return answer6;
|
|
95523
|
-
return { ...
|
|
96166
|
+
return { ...recordOf4(answer6), result: { ...result2, tools: [...TOOLS, ...result2.tools] } };
|
|
95524
96167
|
}
|
|
95525
96168
|
function refusedLines2({
|
|
95526
96169
|
message: message2,
|
|
@@ -95539,9 +96182,9 @@ function refusedLines2({
|
|
|
95539
96182
|
return [JSON.stringify(Array.isArray(message2) ? errors : errors[0])];
|
|
95540
96183
|
}
|
|
95541
96184
|
function repliedTo({ request: request2 }) {
|
|
95542
|
-
const params =
|
|
96185
|
+
const params = recordOf4(request2.params);
|
|
95543
96186
|
if (request2.method !== "tools/call" || params.name !== "reply") return void 0;
|
|
95544
|
-
const messageId =
|
|
96187
|
+
const messageId = recordOf4(params.arguments).messageId;
|
|
95545
96188
|
return typeof messageId === "string" ? messageId : void 0;
|
|
95546
96189
|
}
|
|
95547
96190
|
function answerFor({
|
|
@@ -95570,10 +96213,10 @@ async function answerLine({
|
|
|
95570
96213
|
JSON.stringify({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } })
|
|
95571
96214
|
];
|
|
95572
96215
|
}
|
|
95573
|
-
const request2 =
|
|
95574
|
-
const params =
|
|
96216
|
+
const request2 = recordOf4(message2);
|
|
96217
|
+
const params = recordOf4(request2.params);
|
|
95575
96218
|
if (request2.method === "tools/call" && params.name === LOCAL_TOOL.name) {
|
|
95576
|
-
const input2 =
|
|
96219
|
+
const input2 = recordOf4(params.arguments);
|
|
95577
96220
|
const answered = await runCommandLineTool({ context, serveArgs, runCommandLine, input: input2 });
|
|
95578
96221
|
return [JSON.stringify({ jsonrpc: "2.0", id: request2.id, result: toolResultOf(answered) })];
|
|
95579
96222
|
}
|
|
@@ -95591,7 +96234,7 @@ async function answerLine({
|
|
|
95591
96234
|
var READY_METHODS = /* @__PURE__ */ new Set(["notifications/initialized", "tools/list"]);
|
|
95592
96235
|
function methodOf2({ line }) {
|
|
95593
96236
|
try {
|
|
95594
|
-
const method =
|
|
96237
|
+
const method = recordOf4(JSON.parse(line)).method;
|
|
95595
96238
|
return typeof method === "string" ? method : "";
|
|
95596
96239
|
} catch {
|
|
95597
96240
|
return "";
|
|
@@ -95643,17 +96286,17 @@ async function serveMcp({
|
|
|
95643
96286
|
|
|
95644
96287
|
// src/services/memory-commands.service.ts
|
|
95645
96288
|
import { readdir as readdir8, readFile as readFile30 } from "node:fs/promises";
|
|
95646
|
-
import { join as join30, resolve as
|
|
96289
|
+
import { join as join30, resolve as resolve20 } from "node:path";
|
|
95647
96290
|
|
|
95648
96291
|
// src/services/mount-files.service.ts
|
|
95649
96292
|
import { mkdir as mkdir10, readFile as readFile29, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
|
|
95650
|
-
import { dirname as dirname21, relative as relative5, resolve as
|
|
96293
|
+
import { dirname as dirname21, relative as relative5, resolve as resolve19 } from "node:path";
|
|
95651
96294
|
async function textArgument({
|
|
95652
96295
|
context,
|
|
95653
96296
|
value
|
|
95654
96297
|
}) {
|
|
95655
96298
|
if (value === "-") return context.readStdin();
|
|
95656
|
-
if (value.startsWith("@")) return readFile29(
|
|
96299
|
+
if (value.startsWith("@")) return readFile29(resolve19(context.cwd, value.slice(1)), "utf8");
|
|
95657
96300
|
return value;
|
|
95658
96301
|
}
|
|
95659
96302
|
function turnChannel({ context, args }) {
|
|
@@ -95665,11 +96308,11 @@ async function writeMount({
|
|
|
95665
96308
|
folder,
|
|
95666
96309
|
files: files2
|
|
95667
96310
|
}) {
|
|
95668
|
-
const root =
|
|
96311
|
+
const root = resolve19(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
|
|
95669
96312
|
await rm17(root, { recursive: true, force: true });
|
|
95670
96313
|
await mkdir10(root, { recursive: true });
|
|
95671
96314
|
for (const file4 of files2) {
|
|
95672
|
-
const target =
|
|
96315
|
+
const target = resolve19(root, file4.path);
|
|
95673
96316
|
const inside = relative5(root, target);
|
|
95674
96317
|
if (!inside || inside.startsWith(".."))
|
|
95675
96318
|
throw new Error(`Refusing to write outside ${root}: ${file4.path}`);
|
|
@@ -95929,7 +96572,7 @@ async function siestaImport({
|
|
|
95929
96572
|
args,
|
|
95930
96573
|
dir
|
|
95931
96574
|
}) {
|
|
95932
|
-
const root =
|
|
96575
|
+
const root = resolve20(context.cwd, dir);
|
|
95933
96576
|
const log = await readFile30(join30(root, "LOG.md"));
|
|
95934
96577
|
const names = (await readdir8(join30(root, "tree")).catch(() => [])).filter(
|
|
95935
96578
|
(name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
|
|
@@ -95957,7 +96600,7 @@ async function memoryImport({ context, args }) {
|
|
|
95957
96600
|
if (siesta) return siestaImport({ context, args, dir: siesta });
|
|
95958
96601
|
const dir = flagText({ args, name: "optmem" });
|
|
95959
96602
|
if (!dir) throw new CliUsageError(USAGE13);
|
|
95960
|
-
const root =
|
|
96603
|
+
const root = resolve20(context.cwd, dir);
|
|
95961
96604
|
const log = await readFile30(join30(root, "LOG.txt"));
|
|
95962
96605
|
const sizes2 = (await readdir8(join30(root, "TREE")).catch(() => [])).filter(
|
|
95963
96606
|
(name3) => /^\d{1,4}$/.test(name3)
|
|
@@ -96327,7 +96970,7 @@ async function notifications({ context, args }) {
|
|
|
96327
96970
|
}
|
|
96328
96971
|
|
|
96329
96972
|
// src/services/openclaw-commands.service.ts
|
|
96330
|
-
import { resolve as
|
|
96973
|
+
import { resolve as resolve21 } from "node:path";
|
|
96331
96974
|
var OPENCLAW_USAGE = `Usage (a person's key; a gateway belongs to the person who connects it):
|
|
96332
96975
|
laze openclaw list the gateways connected here and their agents
|
|
96333
96976
|
laze openclaw connect <wss url> [--label <label>] (< token | --from-file <file> | --from-vault <connection>)
|
|
@@ -96478,7 +97121,7 @@ var agentKey = async ({ context, args, client, url: url2 }) => {
|
|
|
96478
97121
|
});
|
|
96479
97122
|
const login2 = flagText({ args, name: "login" });
|
|
96480
97123
|
if (login2) {
|
|
96481
|
-
const folder =
|
|
97124
|
+
const folder = resolve21(context.cwd, login2);
|
|
96482
97125
|
const profile = profileNameOf(key.agentName);
|
|
96483
97126
|
await signInFolder({ context, url: url2, token: key.token, name: profile, folder });
|
|
96484
97127
|
context.out(
|
|
@@ -98390,7 +99033,7 @@ async function schedule({ context, args }) {
|
|
|
98390
99033
|
|
|
98391
99034
|
// src/services/skill-commands.service.ts
|
|
98392
99035
|
import { readdir as readdir9, readFile as readFile32 } from "node:fs/promises";
|
|
98393
|
-
import { join as join33, relative as relative6, resolve as
|
|
99036
|
+
import { join as join33, relative as relative6, resolve as resolve22 } from "node:path";
|
|
98394
99037
|
var USAGE17 = `Usage:
|
|
98395
99038
|
laze skill list [--agent <agentId>]
|
|
98396
99039
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -98443,7 +99086,7 @@ async function skillInstall({ context, args }) {
|
|
|
98443
99086
|
if (!catalogueId === !from) throw new CliUsageError(USAGE17);
|
|
98444
99087
|
const name3 = flagText({ args, name: "as" });
|
|
98445
99088
|
const agent3 = flagText({ args, name: "agent" });
|
|
98446
|
-
const files2 = from ? await folderFiles({ root:
|
|
99089
|
+
const files2 = from ? await folderFiles({ root: resolve22(context.cwd, from) }) : void 0;
|
|
98447
99090
|
const { client } = await signedIn({ context, args });
|
|
98448
99091
|
const installed = await client.post("/api/skills/install", {
|
|
98449
99092
|
...catalogueId ? { catalogueId } : {},
|
|
@@ -98510,7 +99153,7 @@ async function skillUpdate({ context, args }) {
|
|
|
98510
99153
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
98511
99154
|
throw new CliUsageError(USAGE17);
|
|
98512
99155
|
}
|
|
98513
|
-
const skillMd = skillMdFile ? await readFile32(
|
|
99156
|
+
const skillMd = skillMdFile ? await readFile32(resolve22(context.cwd, skillMdFile), "utf8") : void 0;
|
|
98514
99157
|
const { client } = await signedIn({ context, args });
|
|
98515
99158
|
const updated = await client.post("/api/skills/update", {
|
|
98516
99159
|
name: name3,
|
|
@@ -98557,7 +99200,7 @@ async function skill({ context, args }) {
|
|
|
98557
99200
|
|
|
98558
99201
|
// src/services/slack-commands.service.ts
|
|
98559
99202
|
import { readFile as readFile33 } from "node:fs/promises";
|
|
98560
|
-
import { resolve as
|
|
99203
|
+
import { resolve as resolve23 } from "node:path";
|
|
98561
99204
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
98562
99205
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
98563
99206
|
laze slack link-prompts Slack workspaces you have not linked yet
|
|
@@ -98604,7 +99247,7 @@ async function secretLines({ context, args }) {
|
|
|
98604
99247
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
98605
99248
|
}
|
|
98606
99249
|
const file4 = flagText({ args, name: "from-file" });
|
|
98607
|
-
const text3 = file4 ? await readFile33(
|
|
99250
|
+
const text3 = file4 ? await readFile33(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
|
|
98608
99251
|
return text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
98609
99252
|
}
|
|
98610
99253
|
async function secretsOf2({
|
|
@@ -99340,7 +99983,7 @@ async function checkInstalled({
|
|
|
99340
99983
|
|
|
99341
99984
|
// src/services/vault-env-commands.service.ts
|
|
99342
99985
|
import { readFile as readFile35, stat as stat12 } from "node:fs/promises";
|
|
99343
|
-
import { dirname as dirname24, join as join34, resolve as
|
|
99986
|
+
import { dirname as dirname24, join as join34, resolve as resolve24 } from "node:path";
|
|
99344
99987
|
|
|
99345
99988
|
// src/rules/vault-manifest.rules.ts
|
|
99346
99989
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -99448,7 +100091,7 @@ async function doorOf({
|
|
|
99448
100091
|
const turnFile = turnFileOf({ env });
|
|
99449
100092
|
const headers = {
|
|
99450
100093
|
"proxy-authorization": proxy.authorization,
|
|
99451
|
-
"x-laze-turn": await
|
|
100094
|
+
"x-laze-turn": await turnTokenOf2({ env, turnFile, command: "laze vault env" })
|
|
99452
100095
|
};
|
|
99453
100096
|
return {
|
|
99454
100097
|
keyPath: runKeyPathOf({ turnFile, connection: keyName }),
|
|
@@ -99683,10 +100326,10 @@ async function manifestPathOf({
|
|
|
99683
100326
|
args
|
|
99684
100327
|
}) {
|
|
99685
100328
|
const named = args.words[2];
|
|
99686
|
-
if (named) return
|
|
100329
|
+
if (named) return resolve24(context.cwd, named);
|
|
99687
100330
|
const environment = flagText({ args, name: "env" });
|
|
99688
100331
|
const file4 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
99689
|
-
for (let dir =
|
|
100332
|
+
for (let dir = resolve24(context.cwd); ; dir = dirname24(dir)) {
|
|
99690
100333
|
if (await isFile(join34(dir, file4))) return join34(dir, file4);
|
|
99691
100334
|
if (dirname24(dir) === dir) break;
|
|
99692
100335
|
}
|
|
@@ -99931,7 +100574,7 @@ async function postInTurn({
|
|
|
99931
100574
|
body
|
|
99932
100575
|
}) {
|
|
99933
100576
|
const env = context.environment.inherited;
|
|
99934
|
-
const turn = await
|
|
100577
|
+
const turn = await turnTokenOf2({
|
|
99935
100578
|
env,
|
|
99936
100579
|
turnFile: turnFileOf({ env }),
|
|
99937
100580
|
command: "laze vault save"
|
|
@@ -100014,7 +100657,7 @@ async function vaultScrub({ context, args }) {
|
|
|
100014
100657
|
|
|
100015
100658
|
// src/services/whatsapp-business-commands.service.ts
|
|
100016
100659
|
import { readFile as readFile36 } from "node:fs/promises";
|
|
100017
|
-
import { resolve as
|
|
100660
|
+
import { resolve as resolve25 } from "node:path";
|
|
100018
100661
|
|
|
100019
100662
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
100020
100663
|
var whatsappBusinessCategorySchema = external_exports.enum([
|
|
@@ -100433,7 +101076,7 @@ async function secretsOf3({ context, args }) {
|
|
|
100433
101076
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
100434
101077
|
if (fromConnection) return { fromConnection };
|
|
100435
101078
|
const file4 = flagText({ args, name: "from-file" });
|
|
100436
|
-
const text3 = file4 ? await readFile36(
|
|
101079
|
+
const text3 = file4 ? await readFile36(resolve25(context.cwd, file4), "utf8") : await context.readStdin();
|
|
100437
101080
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
100438
101081
|
if (lines2.length !== 2) {
|
|
100439
101082
|
throw new CliUsageError(
|
|
@@ -100635,7 +101278,7 @@ async function whatsappBusiness({
|
|
|
100635
101278
|
|
|
100636
101279
|
// src/services/whatsapp-commands.service.ts
|
|
100637
101280
|
import { writeFile as writeFile10 } from "node:fs/promises";
|
|
100638
|
-
import { basename as basename11, resolve as
|
|
101281
|
+
import { basename as basename11, resolve as resolve26 } from "node:path";
|
|
100639
101282
|
|
|
100640
101283
|
// src/services/whatsapp-pairing-commands.service.ts
|
|
100641
101284
|
var WHATSAPP_PAIRING_USAGE = " laze whatsapp unpair <machine> unlink WhatsApp from the machine (owner)";
|
|
@@ -100775,7 +101418,7 @@ async function file3({ context, args }) {
|
|
|
100775
101418
|
},
|
|
100776
101419
|
args
|
|
100777
101420
|
});
|
|
100778
|
-
const out =
|
|
101421
|
+
const out = resolve26(context.cwd, flagText({ args, name: "out" }) ?? basename11(answer6.fileName));
|
|
100779
101422
|
const response = await context.fetcher(answer6.url);
|
|
100780
101423
|
if (!response.ok) throw new Error(`The file link answered ${response.status}`);
|
|
100781
101424
|
await writeFile10(out, new Uint8Array(await response.arrayBuffer()));
|
|
@@ -101174,6 +101817,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
101174
101817
|
laze skill list|install|show|pull|rm|update|pin|unpin your agent's skills and the catalogue
|
|
101175
101818
|
laze app create <name> ... build an app from scratch (--template slides for a deck), push, revert
|
|
101176
101819
|
apps are also called artifacts: asked for an artifact, page, dashboard, deck or mock, build a Laze app
|
|
101820
|
+
laze app open|screenshot [file] look at your app in a browser tab, signed in as you, view only
|
|
101177
101821
|
laze app every laze app command, with its flags
|
|
101178
101822
|
laze agents list | laze agents status <name> the workspace's agents and their context
|
|
101179
101823
|
laze agents show <name> [--json] an agent's profile: kind, how it runs, intelligence
|
|
@@ -101244,7 +101888,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
|
|
|
101244
101888
|
laze connect install|status|stop|uninstall the service that hands linked Codex sessions their messages
|
|
101245
101889
|
laze openclaw list|connect|agent|agent-key|feed|disconnect your OpenClaw gateways and their agents
|
|
101246
101890
|
laze kanban connect|status Kanban Code on this machine as tools for your agents
|
|
101247
|
-
laze browser open|tabs|goto|read|ask|login|cdp|share|close a live browser tab pinned to the conversation
|
|
101891
|
+
laze browser open|tabs|goto|read|screenshot|ask|login|cdp|share|close a live browser tab pinned to the conversation
|
|
101248
101892
|
Show your work: open pages in a browser tab of the conversation; ask the person you work for to sign in there, never ask for a password
|
|
101249
101893
|
Any agent working for the tab's owner drives it, connected agents (Claude Code, Codex) from their own session included
|
|
101250
101894
|
laze browser login <tab> --vault <connection> types a saved sign-in only when the person says to use it; laze browser --help for all
|
|
@@ -101608,12 +102252,12 @@ import {
|
|
|
101608
102252
|
import { chmod, link, mkdir as mkdir12, readFile as readFile37, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
|
|
101609
102253
|
import { dirname as dirname25, join as join35 } from "node:path";
|
|
101610
102254
|
var KEYCHAIN_SERVICE = "laze-cli-machine-key";
|
|
101611
|
-
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((
|
|
102255
|
+
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve27, reject) => {
|
|
101612
102256
|
const child = execFile2(
|
|
101613
102257
|
program,
|
|
101614
102258
|
[...args],
|
|
101615
102259
|
{ timeout: timeoutMs },
|
|
101616
|
-
(error63, stdout2) => error63 ? reject(error63) :
|
|
102260
|
+
(error63, stdout2) => error63 ? reject(error63) : resolve27(String(stdout2))
|
|
101617
102261
|
);
|
|
101618
102262
|
if (stdin2 !== void 0) child.stdin?.end(stdin2);
|
|
101619
102263
|
});
|
|
@@ -102008,15 +102652,15 @@ function terminalAsk() {
|
|
|
102008
102652
|
};
|
|
102009
102653
|
}
|
|
102010
102654
|
function sleep(ms, signal) {
|
|
102011
|
-
return new Promise((
|
|
102012
|
-
if (signal?.aborted) return
|
|
102655
|
+
return new Promise((resolve27) => {
|
|
102656
|
+
if (signal?.aborted) return resolve27();
|
|
102013
102657
|
const stop3 = () => {
|
|
102014
102658
|
clearTimeout(timer);
|
|
102015
|
-
|
|
102659
|
+
resolve27();
|
|
102016
102660
|
};
|
|
102017
102661
|
const timer = setTimeout(() => {
|
|
102018
102662
|
signal?.removeEventListener("abort", stop3);
|
|
102019
|
-
|
|
102663
|
+
resolve27();
|
|
102020
102664
|
}, ms);
|
|
102021
102665
|
signal?.addEventListener("abort", stop3, { once: true });
|
|
102022
102666
|
});
|