@lazehq/cli 0.1.12 → 0.1.14
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 +250 -105
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -3440,7 +3440,7 @@ var require_stream = __commonJS({
|
|
|
3440
3440
|
};
|
|
3441
3441
|
duplex._final = function(callback) {
|
|
3442
3442
|
if (ws.readyState === ws.CONNECTING) {
|
|
3443
|
-
ws.once("open", function
|
|
3443
|
+
ws.once("open", function open3() {
|
|
3444
3444
|
duplex._final(callback);
|
|
3445
3445
|
});
|
|
3446
3446
|
return;
|
|
@@ -3461,7 +3461,7 @@ var require_stream = __commonJS({
|
|
|
3461
3461
|
};
|
|
3462
3462
|
duplex._write = function(chunk, encoding, callback) {
|
|
3463
3463
|
if (ws.readyState === ws.CONNECTING) {
|
|
3464
|
-
ws.once("open", function
|
|
3464
|
+
ws.once("open", function open3() {
|
|
3465
3465
|
duplex._write(chunk, encoding, callback);
|
|
3466
3466
|
});
|
|
3467
3467
|
return;
|
|
@@ -35402,6 +35402,7 @@ var DEFAULT_LAZE_URL = "https://laze.langwatch.ai";
|
|
|
35402
35402
|
function harnessOf({
|
|
35403
35403
|
env
|
|
35404
35404
|
}) {
|
|
35405
|
+
if (env.CODEX_THREAD_ID) return "codex";
|
|
35405
35406
|
if (env.CLAUDECODE === "1") return "claude-code";
|
|
35406
35407
|
const names = Object.keys(env);
|
|
35407
35408
|
return names.some((name2) => name2.startsWith("CODEX_")) ? "codex" : "other";
|
|
@@ -35605,7 +35606,7 @@ function flagText({
|
|
|
35605
35606
|
}
|
|
35606
35607
|
|
|
35607
35608
|
// src/rules/cli-version.rules.ts
|
|
35608
|
-
var STAMPED = "0.1.
|
|
35609
|
+
var STAMPED = "0.1.14";
|
|
35609
35610
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35610
35611
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35611
35612
|
}
|
|
@@ -65036,6 +65037,8 @@ var agentJoinRequestedPayloadSchemaDefinition = external_exports.object({
|
|
|
65036
65037
|
name: external_exports.string(),
|
|
65037
65038
|
harness: agentHarnessSchema.catch("other"),
|
|
65038
65039
|
note: external_exports.string(),
|
|
65040
|
+
/** A session's folder as it named it, such as `~/proj`; empty on an agent's own request. */
|
|
65041
|
+
folder: external_exports.string().default(""),
|
|
65039
65042
|
deciderIds: external_exports.array(external_exports.string().min(1)),
|
|
65040
65043
|
expiresAt: external_exports.iso.datetime(),
|
|
65041
65044
|
/** `session`: a session with an agent's request key asks its owner for an agent of its own. */
|
|
@@ -65388,7 +65391,7 @@ async function copyAgent({
|
|
|
65388
65391
|
|
|
65389
65392
|
// src/services/agent-commands.service.ts
|
|
65390
65393
|
import { mkdir as mkdir11, readFile as readFile9, writeFile as writeFile11 } from "node:fs/promises";
|
|
65391
|
-
import { join as
|
|
65394
|
+
import { join as join12, resolve as resolve4 } from "node:path";
|
|
65392
65395
|
|
|
65393
65396
|
// src/rules/agent-profile.rules.ts
|
|
65394
65397
|
var LEVELS = { fast: "Laze Fast", frontier: "Laze Frontier" };
|
|
@@ -67263,8 +67266,8 @@ async function claudeProjectOf({
|
|
|
67263
67266
|
|
|
67264
67267
|
// src/services/codex-link.service.ts
|
|
67265
67268
|
import { createReadStream } from "node:fs";
|
|
67266
|
-
import { readdir as
|
|
67267
|
-
import { join as
|
|
67269
|
+
import { readdir as readdir3, rm as rm5, stat as stat2 } from "node:fs/promises";
|
|
67270
|
+
import { join as join9, resolve as resolve3 } from "node:path";
|
|
67268
67271
|
import { createInterface as createInterface2 } from "node:readline";
|
|
67269
67272
|
|
|
67270
67273
|
// src/rules/connect-service.rules.ts
|
|
@@ -67354,6 +67357,33 @@ function rolloutSessionOf({
|
|
|
67354
67357
|
return void 0;
|
|
67355
67358
|
}
|
|
67356
67359
|
}
|
|
67360
|
+
function userTextOf({ parsed }) {
|
|
67361
|
+
const payload = parsed.payload ?? {};
|
|
67362
|
+
if (parsed.type === "event_msg" && payload.type === "user_message") {
|
|
67363
|
+
return typeof payload.message === "string" ? payload.message : void 0;
|
|
67364
|
+
}
|
|
67365
|
+
if (parsed.type !== "response_item" || payload.type !== "message" || payload.role !== "user") {
|
|
67366
|
+
return void 0;
|
|
67367
|
+
}
|
|
67368
|
+
return JSON.stringify(payload.content ?? "");
|
|
67369
|
+
}
|
|
67370
|
+
function rolloutEventOf({
|
|
67371
|
+
line,
|
|
67372
|
+
messageIds
|
|
67373
|
+
}) {
|
|
67374
|
+
let parsed;
|
|
67375
|
+
try {
|
|
67376
|
+
parsed = JSON.parse(line);
|
|
67377
|
+
} catch {
|
|
67378
|
+
return void 0;
|
|
67379
|
+
}
|
|
67380
|
+
const type = parsed.type === "event_msg" ? parsed.payload?.type : void 0;
|
|
67381
|
+
if (type === "task_complete" || type === "turn_aborted") return { kind: "ended" };
|
|
67382
|
+
const text2 = userTextOf({ parsed });
|
|
67383
|
+
if (text2 === void 0) return void 0;
|
|
67384
|
+
const held = messageIds.filter((id) => text2.includes(`[${id}]`));
|
|
67385
|
+
return held.length > 0 ? { kind: "holds", messageIds: held } : void 0;
|
|
67386
|
+
}
|
|
67357
67387
|
|
|
67358
67388
|
// src/services/codex-adopt.service.ts
|
|
67359
67389
|
import { spawn as spawn2 } from "node:child_process";
|
|
@@ -67733,7 +67763,7 @@ async function adoptCodex({ context, args }) {
|
|
|
67733
67763
|
// src/services/connect-delivery.service.ts
|
|
67734
67764
|
import { mkdir as mkdir6, readFile as readFile6, rename as rename3, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
|
|
67735
67765
|
import { homedir as homedir2, hostname as hostname3 } from "node:os";
|
|
67736
|
-
import { dirname as dirname6, join as
|
|
67766
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
67737
67767
|
|
|
67738
67768
|
// src/rules/session-headers.rules.ts
|
|
67739
67769
|
import { relative as relative2, sep } from "node:path";
|
|
@@ -67758,9 +67788,103 @@ function displayFolderOf({ folder, home }) {
|
|
|
67758
67788
|
return `~/${below.split(sep).join("/")}`;
|
|
67759
67789
|
}
|
|
67760
67790
|
|
|
67791
|
+
// src/services/codex-turn-watch.service.ts
|
|
67792
|
+
import { open as open2, readdir as readdir2 } from "node:fs/promises";
|
|
67793
|
+
import { join as join5 } from "node:path";
|
|
67794
|
+
var READ_MS = 1500;
|
|
67795
|
+
var KEEP_WORKING_MS = 3e4;
|
|
67796
|
+
async function rolloutPathOf({ delivery }) {
|
|
67797
|
+
const root = join5(delivery.codexHome, "sessions");
|
|
67798
|
+
const files2 = await readdir2(root, { recursive: true }).catch(() => []);
|
|
67799
|
+
const file3 = files2.find((name2) => name2.endsWith(`-${delivery.threadId}.jsonl`));
|
|
67800
|
+
return file3 ? join5(root, file3) : void 0;
|
|
67801
|
+
}
|
|
67802
|
+
async function readFrom({ path, offset }) {
|
|
67803
|
+
const handle = await open2(path, "r");
|
|
67804
|
+
try {
|
|
67805
|
+
const { size } = await handle.stat();
|
|
67806
|
+
if (size <= offset) return { text: "", size };
|
|
67807
|
+
const buffer = Buffer.alloc(size - offset);
|
|
67808
|
+
await handle.read(buffer, 0, buffer.length, offset);
|
|
67809
|
+
return { text: buffer.toString("utf8"), size };
|
|
67810
|
+
} finally {
|
|
67811
|
+
await handle.close();
|
|
67812
|
+
}
|
|
67813
|
+
}
|
|
67814
|
+
var CodexTurnWatch = class _CodexTurnWatch {
|
|
67815
|
+
constructor(deps) {
|
|
67816
|
+
this.deps = deps;
|
|
67817
|
+
}
|
|
67818
|
+
deps;
|
|
67819
|
+
/** Queued in Codex, not yet seen in a turn. */
|
|
67820
|
+
#queued = /* @__PURE__ */ new Map();
|
|
67821
|
+
/** The messages the running turn answers; empty when no turn of ours runs. */
|
|
67822
|
+
#answering = [];
|
|
67823
|
+
#path;
|
|
67824
|
+
#offset = 0;
|
|
67825
|
+
#partial = "";
|
|
67826
|
+
#toldAt = 0;
|
|
67827
|
+
static create(dependencies) {
|
|
67828
|
+
return new _CodexTurnWatch(dependencies);
|
|
67829
|
+
}
|
|
67830
|
+
queued({ messages }) {
|
|
67831
|
+
for (const message2 of messages) this.#queued.set(message2.messageId, message2);
|
|
67832
|
+
}
|
|
67833
|
+
/** Reads the rollout until the signal aborts, starting after what it holds now. */
|
|
67834
|
+
async run({ signal }) {
|
|
67835
|
+
await this.#find({ skipExisting: true });
|
|
67836
|
+
while (!signal.aborted) {
|
|
67837
|
+
await this.read().catch(() => void 0);
|
|
67838
|
+
await this.deps.context.sleep(READ_MS, signal);
|
|
67839
|
+
}
|
|
67840
|
+
}
|
|
67841
|
+
async #find({ skipExisting }) {
|
|
67842
|
+
if (this.#path) return this.#path;
|
|
67843
|
+
this.#path = await rolloutPathOf({ delivery: this.deps.delivery });
|
|
67844
|
+
if (this.#path && skipExisting) {
|
|
67845
|
+
this.#offset = (await readFrom({ path: this.#path, offset: Number.MAX_SAFE_INTEGER })).size;
|
|
67846
|
+
}
|
|
67847
|
+
return this.#path;
|
|
67848
|
+
}
|
|
67849
|
+
/** One read of the lines Codex added since the last one. */
|
|
67850
|
+
async read() {
|
|
67851
|
+
const path = await this.#find({ skipExisting: false });
|
|
67852
|
+
if (path) {
|
|
67853
|
+
const { text: text2, size } = await readFrom({ path, offset: this.#offset });
|
|
67854
|
+
this.#offset = Math.max(this.#offset, size);
|
|
67855
|
+
const lines = (this.#partial + text2).split("\n");
|
|
67856
|
+
this.#partial = lines.pop() ?? "";
|
|
67857
|
+
for (const line of lines) await this.#follow({ line });
|
|
67858
|
+
}
|
|
67859
|
+
await this.#keepWorking();
|
|
67860
|
+
}
|
|
67861
|
+
async #follow({ line }) {
|
|
67862
|
+
const event = rolloutEventOf({ line, messageIds: [...this.#queued.keys()] });
|
|
67863
|
+
if (event?.kind === "holds") {
|
|
67864
|
+
const held = event.messageIds.flatMap((id) => this.#queued.get(id) ?? []);
|
|
67865
|
+
for (const id of event.messageIds) this.#queued.delete(id);
|
|
67866
|
+
this.#answering = [...this.#answering, ...held];
|
|
67867
|
+
await this.#tell({ working: true });
|
|
67868
|
+
} else if (event?.kind === "ended" && this.#answering.length > 0) {
|
|
67869
|
+
this.#answering = [];
|
|
67870
|
+
await this.#tell({ working: false });
|
|
67871
|
+
}
|
|
67872
|
+
}
|
|
67873
|
+
async #keepWorking() {
|
|
67874
|
+
const due = this.deps.context.nowMs() - this.#toldAt >= KEEP_WORKING_MS;
|
|
67875
|
+
if (this.#answering.length > 0 && due) await this.#tell({ working: true });
|
|
67876
|
+
}
|
|
67877
|
+
async #tell({ working }) {
|
|
67878
|
+
const { context, client, profile } = this.deps;
|
|
67879
|
+
this.#toldAt = context.nowMs();
|
|
67880
|
+
const told = working ? turnStarted({ context, client, agent: profile, messages: this.#answering }) : turnEnded({ context, client, agent: profile });
|
|
67881
|
+
await told.catch(() => void 0);
|
|
67882
|
+
}
|
|
67883
|
+
};
|
|
67884
|
+
|
|
67761
67885
|
// src/services/openclaw-relay.service.ts
|
|
67762
67886
|
import { chmod as chmod2, mkdir as mkdir5, readFile as readFile5, writeFile as writeFile5 } from "node:fs/promises";
|
|
67763
|
-
import { dirname as dirname5, join as
|
|
67887
|
+
import { dirname as dirname5, join as join6 } from "node:path";
|
|
67764
67888
|
|
|
67765
67889
|
// ../../modules/openclaw/contract/src/openclaw.ts
|
|
67766
67890
|
var workspaceIdSchema14 = external_exports.string().min(1);
|
|
@@ -67988,7 +68112,7 @@ var STOPS = /* @__PURE__ */ new Map([
|
|
|
67988
68112
|
[OPENCLAW_RELAY_CLOSE.replaced.code, "another relay for this gateway took over"]
|
|
67989
68113
|
]);
|
|
67990
68114
|
function relaysPathOf({ context }) {
|
|
67991
|
-
return
|
|
68115
|
+
return join6(dirname5(context.environment.configPath), "connect", "openclaw-relays.json");
|
|
67992
68116
|
}
|
|
67993
68117
|
async function readRelays({ context }) {
|
|
67994
68118
|
try {
|
|
@@ -68083,18 +68207,18 @@ var RelaySession = class {
|
|
|
68083
68207
|
if (!envelope) return;
|
|
68084
68208
|
const { line, payload } = envelope;
|
|
68085
68209
|
if (envelope.kind === "open") return this.dial(relay2, line);
|
|
68086
|
-
const
|
|
68087
|
-
if (!
|
|
68210
|
+
const open3 = this.#lines.get(line);
|
|
68211
|
+
if (!open3) return;
|
|
68088
68212
|
if (envelope.kind === "close") {
|
|
68089
68213
|
this.#lines.delete(line);
|
|
68090
|
-
|
|
68214
|
+
open3.socket.close(1e3);
|
|
68091
68215
|
return;
|
|
68092
68216
|
}
|
|
68093
68217
|
if (envelope.kind !== "text" && envelope.kind !== "binary") return;
|
|
68094
68218
|
const frame = { data: Buffer.from(payload), binary: envelope.kind === "binary" };
|
|
68095
|
-
if (
|
|
68096
|
-
|
|
68097
|
-
} else
|
|
68219
|
+
if (open3.socket.readyState === wrapper_default.OPEN) {
|
|
68220
|
+
open3.socket.send(frame.data, { binary: frame.binary });
|
|
68221
|
+
} else open3.waiting.push(frame);
|
|
68098
68222
|
}
|
|
68099
68223
|
/** Dials the gateway for a line; its frames go back to Laze as they came. */
|
|
68100
68224
|
dial(relay2, line) {
|
|
@@ -68189,10 +68313,10 @@ var RelayLoops = class _RelayLoops {
|
|
|
68189
68313
|
|
|
68190
68314
|
// src/services/connect-delivery.service.ts
|
|
68191
68315
|
function connectFolderOf({ context }) {
|
|
68192
|
-
return
|
|
68316
|
+
return join7(dirname6(context.environment.configPath), "connect");
|
|
68193
68317
|
}
|
|
68194
68318
|
function runStatePathOf({ context }) {
|
|
68195
|
-
return
|
|
68319
|
+
return join7(connectFolderOf({ context }), "run.json");
|
|
68196
68320
|
}
|
|
68197
68321
|
async function readJson({ path }) {
|
|
68198
68322
|
try {
|
|
@@ -68259,7 +68383,8 @@ async function deliverRound({
|
|
|
68259
68383
|
client,
|
|
68260
68384
|
profile,
|
|
68261
68385
|
delivery,
|
|
68262
|
-
signal
|
|
68386
|
+
signal,
|
|
68387
|
+
watch
|
|
68263
68388
|
}) {
|
|
68264
68389
|
const kept = await dueFromSpool({ context, profile, seen: async () => "", pushedToo: true });
|
|
68265
68390
|
const messages = kept.length > 0 ? kept : await takeRound({ client, signal, delivery });
|
|
@@ -68267,7 +68392,7 @@ async function deliverRound({
|
|
|
68267
68392
|
if (kept.length === 0) await keepTaken({ context, profile, messages });
|
|
68268
68393
|
const self2 = await currentNameOf({ context, client, profile });
|
|
68269
68394
|
await queueInCodex({ context, delivery, text: hookContextOf({ messages, self: self2 }) });
|
|
68270
|
-
|
|
68395
|
+
watch.queued({ messages });
|
|
68271
68396
|
const messageIds = messages.map((message2) => message2.messageId);
|
|
68272
68397
|
await dropFromSpool({ context, profile, messageIds });
|
|
68273
68398
|
context.out(`${profile}: queued ${messageIds.join(", ")} in Codex thread ${delivery.threadId}
|
|
@@ -68293,6 +68418,25 @@ async function serveAgent({
|
|
|
68293
68418
|
token: entry.token,
|
|
68294
68419
|
fetcher: context.fetcher
|
|
68295
68420
|
});
|
|
68421
|
+
const watch = CodexTurnWatch.create({ context, client, profile, delivery: entry.delivery });
|
|
68422
|
+
const ended = new AbortController();
|
|
68423
|
+
const watching = watch.run({ signal: AbortSignal.any([signal, ended.signal]) });
|
|
68424
|
+
try {
|
|
68425
|
+
await serveRounds({ context, client, profile, entry, signal, report: report3, watch });
|
|
68426
|
+
} finally {
|
|
68427
|
+
ended.abort();
|
|
68428
|
+
await watching;
|
|
68429
|
+
}
|
|
68430
|
+
}
|
|
68431
|
+
async function serveRounds({
|
|
68432
|
+
context,
|
|
68433
|
+
client,
|
|
68434
|
+
profile,
|
|
68435
|
+
entry,
|
|
68436
|
+
signal,
|
|
68437
|
+
report: report3,
|
|
68438
|
+
watch
|
|
68439
|
+
}) {
|
|
68296
68440
|
let wait = 1;
|
|
68297
68441
|
await report3(profile, "listening");
|
|
68298
68442
|
while (!signal.aborted) {
|
|
@@ -68302,7 +68446,8 @@ async function serveAgent({
|
|
|
68302
68446
|
client,
|
|
68303
68447
|
profile,
|
|
68304
68448
|
delivery: entry.delivery,
|
|
68305
|
-
signal
|
|
68449
|
+
signal,
|
|
68450
|
+
watch
|
|
68306
68451
|
});
|
|
68307
68452
|
if (wait > 1) await report3(profile, "listening");
|
|
68308
68453
|
wait = 1;
|
|
@@ -68409,7 +68554,7 @@ async function runConnectLoop({ context }) {
|
|
|
68409
68554
|
// src/services/connect-service.service.ts
|
|
68410
68555
|
import { createHash } from "node:crypto";
|
|
68411
68556
|
import { mkdir as mkdir7, rm as rm4, writeFile as writeFile7 } from "node:fs/promises";
|
|
68412
|
-
import { dirname as dirname7, join as
|
|
68557
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
68413
68558
|
var CONNECT_SERVICE_USAGE = `laze connect install|status|stop|uninstall|run: the service that delivers to linked Codex sessions.
|
|
68414
68559
|
|
|
68415
68560
|
laze connect install install and start it (systemd --user, a LaunchAgent, or detached)
|
|
@@ -68422,17 +68567,17 @@ var CONNECT_SERVICE_USAGE = `laze connect install|status|stop|uninstall|run: the
|
|
|
68422
68567
|
\`laze openclaw connect --local\`, whose OpenClaw relay it also runs.
|
|
68423
68568
|
`;
|
|
68424
68569
|
function installedPathOf({ context }) {
|
|
68425
|
-
return
|
|
68570
|
+
return join8(connectFolderOf({ context }), "service.json");
|
|
68426
68571
|
}
|
|
68427
68572
|
function logPathOf({ context }) {
|
|
68428
|
-
return
|
|
68573
|
+
return join8(connectFolderOf({ context }), "connect.log");
|
|
68429
68574
|
}
|
|
68430
68575
|
function homeOf({ context }) {
|
|
68431
68576
|
return context.environment.inherited.HOME ?? dirname7(dirname7(context.environment.configPath));
|
|
68432
68577
|
}
|
|
68433
68578
|
function serviceNameOf({ context }) {
|
|
68434
68579
|
const { configPath } = context.environment;
|
|
68435
|
-
if (configPath ===
|
|
68580
|
+
if (configPath === join8(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
|
|
68436
68581
|
return `laze-connect-${createHash("sha256").update(configPath).digest("hex").slice(0, 8)}`;
|
|
68437
68582
|
}
|
|
68438
68583
|
function serviceEnvOf({ context }) {
|
|
@@ -68455,8 +68600,8 @@ async function run({ context, command }) {
|
|
|
68455
68600
|
async function installSystemd({ context }) {
|
|
68456
68601
|
const name2 = serviceNameOf({ context });
|
|
68457
68602
|
const env = context.environment.inherited;
|
|
68458
|
-
const base = env.XDG_CONFIG_HOME ||
|
|
68459
|
-
const file3 =
|
|
68603
|
+
const base = env.XDG_CONFIG_HOME || join8(homeOf({ context }), ".config");
|
|
68604
|
+
const file3 = join8(base, "systemd", "user", `${name2}.service`);
|
|
68460
68605
|
await mkdir7(dirname7(file3), { recursive: true });
|
|
68461
68606
|
await writeFile7(
|
|
68462
68607
|
file3,
|
|
@@ -68471,7 +68616,7 @@ async function installSystemd({ context }) {
|
|
|
68471
68616
|
async function installLaunchd({ context }) {
|
|
68472
68617
|
const name2 = serviceNameOf({ context });
|
|
68473
68618
|
const label2 = `ai.laze.${name2}`;
|
|
68474
|
-
const file3 =
|
|
68619
|
+
const file3 = join8(homeOf({ context }), "Library", "LaunchAgents", `${label2}.plist`);
|
|
68475
68620
|
const log = logPathOf({ context });
|
|
68476
68621
|
await mkdir7(dirname7(file3), { recursive: true });
|
|
68477
68622
|
await writeFile7(
|
|
@@ -68639,13 +68784,13 @@ async function newestThreadIn({
|
|
|
68639
68784
|
codexHome,
|
|
68640
68785
|
directory
|
|
68641
68786
|
}) {
|
|
68642
|
-
const root =
|
|
68643
|
-
const files2 = await
|
|
68787
|
+
const root = join9(codexHome, "sessions");
|
|
68788
|
+
const files2 = await readdir3(root, { recursive: true }).catch(() => []);
|
|
68644
68789
|
const rollouts = files2.filter((file3) => /rollout-.*\.jsonl$/.test(file3));
|
|
68645
68790
|
const dated = await Promise.all(
|
|
68646
68791
|
rollouts.map(async (file3) => ({
|
|
68647
|
-
path:
|
|
68648
|
-
at: await stat2(
|
|
68792
|
+
path: join9(root, file3),
|
|
68793
|
+
at: await stat2(join9(root, file3)).then(
|
|
68649
68794
|
(info) => info.mtimeMs,
|
|
68650
68795
|
() => 0
|
|
68651
68796
|
)
|
|
@@ -68713,9 +68858,9 @@ async function linkCodexSession({
|
|
|
68713
68858
|
}
|
|
68714
68859
|
|
|
68715
68860
|
// src/services/harness-session.service.ts
|
|
68716
|
-
import { mkdir as mkdir8, readdir as
|
|
68861
|
+
import { mkdir as mkdir8, readdir as readdir4, readFile as readFile7, writeFile as writeFile8 } from "node:fs/promises";
|
|
68717
68862
|
import { hostname as hostname4 } from "node:os";
|
|
68718
|
-
import { dirname as dirname8, join as
|
|
68863
|
+
import { dirname as dirname8, join as join10 } from "node:path";
|
|
68719
68864
|
function sessionOf({
|
|
68720
68865
|
context,
|
|
68721
68866
|
harness,
|
|
@@ -68793,10 +68938,10 @@ async function liveElsewhere({
|
|
|
68793
68938
|
claudePid
|
|
68794
68939
|
}) {
|
|
68795
68940
|
const folder = dirname8(statePathOf({ context, kind: "sessions", profile: "x" }));
|
|
68796
|
-
for (const file3 of await
|
|
68941
|
+
for (const file3 of await readdir4(folder).catch(() => [])) {
|
|
68797
68942
|
const pid = Number(file3.replace(/\.json$/, ""));
|
|
68798
68943
|
if (!pid || pid === claudePid || !context.processes.alive(pid)) continue;
|
|
68799
|
-
const noted = await readFile7(
|
|
68944
|
+
const noted = await readFile7(join10(folder, file3), "utf8").then(
|
|
68800
68945
|
(text2) => JSON.parse(text2),
|
|
68801
68946
|
() => void 0
|
|
68802
68947
|
);
|
|
@@ -68836,7 +68981,7 @@ async function notBoundNotice({
|
|
|
68836
68981
|
|
|
68837
68982
|
// src/services/laze-plugin.service.ts
|
|
68838
68983
|
import { mkdir as mkdir9, readFile as readFile8, writeFile as writeFile9 } from "node:fs/promises";
|
|
68839
|
-
import { dirname as dirname9, join as
|
|
68984
|
+
import { dirname as dirname9, join as join11 } from "node:path";
|
|
68840
68985
|
|
|
68841
68986
|
// src/rules/laze-plugin.rules.ts
|
|
68842
68987
|
var LAZE_PLUGIN = "laze";
|
|
@@ -68928,10 +69073,10 @@ function lazePluginFiles({
|
|
|
68928
69073
|
var REGISTER_LIMIT_MS = 6e4;
|
|
68929
69074
|
var quote2 = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
68930
69075
|
function pluginFolderOf({ context }) {
|
|
68931
|
-
return
|
|
69076
|
+
return join11(dirname9(context.environment.configPath), "plugins");
|
|
68932
69077
|
}
|
|
68933
69078
|
async function pluginIsCurrent({ context }) {
|
|
68934
|
-
const manifest =
|
|
69079
|
+
const manifest = join11(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
|
|
68935
69080
|
const written = await readFile8(manifest, "utf8").then(
|
|
68936
69081
|
(text2) => JSON.parse(text2).version,
|
|
68937
69082
|
() => void 0
|
|
@@ -68942,7 +69087,7 @@ async function writeLazePlugin({ context }) {
|
|
|
68942
69087
|
const folder = pluginFolderOf({ context });
|
|
68943
69088
|
const files2 = lazePluginFiles({ program: context.program, version: cliVersionOf() });
|
|
68944
69089
|
for (const [path, text2] of Object.entries(files2)) {
|
|
68945
|
-
const target =
|
|
69090
|
+
const target = join11(folder, path);
|
|
68946
69091
|
await mkdir9(dirname9(target), { recursive: true });
|
|
68947
69092
|
await writeFile9(target, text2);
|
|
68948
69093
|
}
|
|
@@ -68970,7 +69115,7 @@ async function installLazePlugin({ context }) {
|
|
|
68970
69115
|
async function plugin({ context, args }) {
|
|
68971
69116
|
const action = args.words[1] ?? "install";
|
|
68972
69117
|
if (action === "path") {
|
|
68973
|
-
context.out(`${
|
|
69118
|
+
context.out(`${join11(pluginFolderOf({ context }), LAZE_PLUGIN)}
|
|
68974
69119
|
`);
|
|
68975
69120
|
return 0;
|
|
68976
69121
|
}
|
|
@@ -69163,8 +69308,8 @@ async function installHooks({
|
|
|
69163
69308
|
directory,
|
|
69164
69309
|
profile
|
|
69165
69310
|
}) {
|
|
69166
|
-
const folder =
|
|
69167
|
-
const path =
|
|
69311
|
+
const folder = join12(directory, ".claude");
|
|
69312
|
+
const path = join12(folder, "settings.local.json");
|
|
69168
69313
|
const current2 = await readFile9(path, "utf8").then(
|
|
69169
69314
|
(text2) => JSON.parse(text2),
|
|
69170
69315
|
() => ({})
|
|
@@ -69423,7 +69568,7 @@ async function addSessionStartWaiter({ context, args }) {
|
|
|
69423
69568
|
const directory = context.environment.inherited.CLAUDE_PROJECT_DIR;
|
|
69424
69569
|
const profile = flagText({ args, name: "profile" });
|
|
69425
69570
|
if (!directory || !profile) return;
|
|
69426
|
-
const path =
|
|
69571
|
+
const path = join12(directory, ".claude", "settings.local.json");
|
|
69427
69572
|
const settings2 = await readFile9(path, "utf8").then(
|
|
69428
69573
|
(text2) => JSON.parse(text2),
|
|
69429
69574
|
() => void 0
|
|
@@ -69433,7 +69578,7 @@ async function addSessionStartWaiter({ context, args }) {
|
|
|
69433
69578
|
}
|
|
69434
69579
|
async function refreshPlugin({ context }) {
|
|
69435
69580
|
if (await pluginIsCurrent({ context })) return;
|
|
69436
|
-
const logPath =
|
|
69581
|
+
const logPath = join12(pluginFolderOf({ context }), "install.log");
|
|
69437
69582
|
context.processes.spawnDetached({ argv: [...context.program, "plugin", "install"], logPath });
|
|
69438
69583
|
}
|
|
69439
69584
|
async function stopHook({ context, args }) {
|
|
@@ -70270,8 +70415,8 @@ async function requestAgent({ context, args }) {
|
|
|
70270
70415
|
}
|
|
70271
70416
|
|
|
70272
70417
|
// src/services/app-commands.service.ts
|
|
70273
|
-
import { mkdir as mkdir12, readdir as
|
|
70274
|
-
import { dirname as dirname11, join as
|
|
70418
|
+
import { mkdir as mkdir12, readdir as readdir5, readFile as readFile11, writeFile as writeFile13 } from "node:fs/promises";
|
|
70419
|
+
import { dirname as dirname11, join as join14, relative as relative3, resolve as resolve6, sep as sep2 } from "node:path";
|
|
70275
70420
|
|
|
70276
70421
|
// ../../modules/app/contract/src/app.connections.ts
|
|
70277
70422
|
var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
|
|
@@ -72412,16 +72557,16 @@ function print({
|
|
|
72412
72557
|
async function appConnections({
|
|
72413
72558
|
context,
|
|
72414
72559
|
args,
|
|
72415
|
-
open:
|
|
72560
|
+
open: open3
|
|
72416
72561
|
}) {
|
|
72417
|
-
const { client, appId, name: name2 } = await
|
|
72562
|
+
const { client, appId, name: name2 } = await open3();
|
|
72418
72563
|
const listed = await client.post("/api/apps/connections", { appId });
|
|
72419
72564
|
print({ context, args, value: listed, text: connectionsText({ name: name2, listed }) });
|
|
72420
72565
|
}
|
|
72421
72566
|
async function appConnection({
|
|
72422
72567
|
context,
|
|
72423
72568
|
args,
|
|
72424
|
-
open:
|
|
72569
|
+
open: open3
|
|
72425
72570
|
}) {
|
|
72426
72571
|
const [, , verb, connection] = args.words;
|
|
72427
72572
|
if (verb !== "allow" && verb !== "revoke" || !connection) {
|
|
@@ -72430,7 +72575,7 @@ async function appConnection({
|
|
|
72430
72575
|
if (verb) throw new CliUsageError(USAGE2);
|
|
72431
72576
|
return;
|
|
72432
72577
|
}
|
|
72433
|
-
const { client, appId, name: name2 } = await
|
|
72578
|
+
const { client, appId, name: name2 } = await open3();
|
|
72434
72579
|
const listed = await client.post(`/api/apps/connections/${verb}`, { appId, connection }).catch((error62) => {
|
|
72435
72580
|
if (!(error62 instanceof LazeApiError) || error62.code !== "permission_denied") throw error62;
|
|
72436
72581
|
throw new CliUsageError(
|
|
@@ -72459,40 +72604,40 @@ function appAndWord({ args, usage }) {
|
|
|
72459
72604
|
if (!word3) throw new CliUsageError(usage);
|
|
72460
72605
|
return { app: app2, word: word3 };
|
|
72461
72606
|
}
|
|
72462
|
-
var rename4 = async ({ context, args, open:
|
|
72607
|
+
var rename4 = async ({ context, args, open: open3 }) => {
|
|
72463
72608
|
const { app: app2, word: word3 } = appAndWord({ args, usage: "Usage: laze app rename [app] <new name>" });
|
|
72464
|
-
const { client, appId, name: name2 } = await
|
|
72609
|
+
const { client, appId, name: name2 } = await open3(app2);
|
|
72465
72610
|
const renamed = await client.post("/api/apps/rename", { appId, name: word3 });
|
|
72466
72611
|
print2({ context, args, value: renamed, text: `${name2} is now called ${renamed.name}.
|
|
72467
72612
|
` });
|
|
72468
72613
|
};
|
|
72469
|
-
var archive = async ({ context, args, open:
|
|
72470
|
-
const { client, appId } = await
|
|
72614
|
+
var archive = async ({ context, args, open: open3 }) => {
|
|
72615
|
+
const { client, appId } = await open3(args.words[2]);
|
|
72471
72616
|
const archived = await client.post("/api/apps/archive", { appId });
|
|
72472
72617
|
const text2 = `Archived ${archived.name}: it serves nothing and keeps its versions and data. laze app unarchive brings it back.
|
|
72473
72618
|
`;
|
|
72474
72619
|
print2({ context, args, value: archived, text: text2 });
|
|
72475
72620
|
};
|
|
72476
|
-
var unarchive = async ({ context, args, open:
|
|
72477
|
-
const { client, appId } = await
|
|
72621
|
+
var unarchive = async ({ context, args, open: open3 }) => {
|
|
72622
|
+
const { client, appId } = await open3(args.words[2]);
|
|
72478
72623
|
const back = await client.post("/api/apps/unarchive", { appId });
|
|
72479
72624
|
const text2 = `${back.name} is back at the same addresses.
|
|
72480
72625
|
`;
|
|
72481
72626
|
print2({ context, args, value: back, text: text2 });
|
|
72482
72627
|
};
|
|
72483
|
-
var remove = async ({ context, args, open:
|
|
72628
|
+
var remove = async ({ context, args, open: open3 }) => {
|
|
72484
72629
|
const confirmName = flagText({ args, name: "confirm" });
|
|
72485
72630
|
if (!confirmName) {
|
|
72486
72631
|
throw new CliUsageError("Usage: laze app delete [app] --confirm <the app's name>");
|
|
72487
72632
|
}
|
|
72488
|
-
const { client, appId, name: name2 } = await
|
|
72633
|
+
const { client, appId, name: name2 } = await open3(args.words[2]);
|
|
72489
72634
|
await client.post("/api/apps/delete", { appId, confirmName });
|
|
72490
72635
|
const text2 = `Deleted ${name2}: it stopped serving and is gone from the workspace.
|
|
72491
72636
|
`;
|
|
72492
72637
|
print2({ context, args, value: { deleted: appId }, text: text2 });
|
|
72493
72638
|
};
|
|
72494
|
-
var revokeLease = async ({ context, args, open:
|
|
72495
|
-
const { client, appId, name: name2 } = await
|
|
72639
|
+
var revokeLease = async ({ context, args, open: open3 }) => {
|
|
72640
|
+
const { client, appId, name: name2 } = await open3(args.words[2]);
|
|
72496
72641
|
const app2 = await client.post("/api/apps/publish/revoke-lease", { appId });
|
|
72497
72642
|
const text2 = `${name2}'s builder asks for an approval again before its next public publish.
|
|
72498
72643
|
`;
|
|
@@ -72520,18 +72665,18 @@ function backupsText({ name: name2, status: status8 }) {
|
|
|
72520
72665
|
return `${name2}: ${replicating} ${window2}
|
|
72521
72666
|
${restores.join("")}`;
|
|
72522
72667
|
}
|
|
72523
|
-
var backups = async ({ context, args, open:
|
|
72524
|
-
const { client, appId, name: name2 } = await
|
|
72668
|
+
var backups = async ({ context, args, open: open3 }) => {
|
|
72669
|
+
const { client, appId, name: name2 } = await open3(args.words[2]);
|
|
72525
72670
|
const status8 = await client.post("/api/apps/backups", { appId });
|
|
72526
72671
|
print2({ context, args, value: status8, text: backupsText({ name: name2, status: status8 }) });
|
|
72527
72672
|
};
|
|
72528
|
-
var restore = async ({ context, args, open:
|
|
72673
|
+
var restore = async ({ context, args, open: open3 }) => {
|
|
72529
72674
|
const to = flagText({ args, name: "to" });
|
|
72530
72675
|
const undo = flagText({ args, name: "undo" });
|
|
72531
72676
|
if (Boolean(to) === Boolean(undo)) {
|
|
72532
72677
|
throw new CliUsageError("Usage: laze app restore [app] --to <ISO time> | --undo <restore-id>");
|
|
72533
72678
|
}
|
|
72534
|
-
const { client, appId, name: name2 } = await
|
|
72679
|
+
const { client, appId, name: name2 } = await open3(args.words[2]);
|
|
72535
72680
|
const done = await client.post("/api/apps/backups/restore", {
|
|
72536
72681
|
appId,
|
|
72537
72682
|
...to ? { to } : { undo }
|
|
@@ -72557,16 +72702,16 @@ function usersText({ name: name2, users: users2 }) {
|
|
|
72557
72702
|
return `${name2}'s app users:
|
|
72558
72703
|
${lines.join("")}`;
|
|
72559
72704
|
}
|
|
72560
|
-
var users = async ({ context, args, open:
|
|
72561
|
-
const { client, appId, name: name2 } = await
|
|
72705
|
+
var users = async ({ context, args, open: open3 }) => {
|
|
72706
|
+
const { client, appId, name: name2 } = await open3(args.words[2]);
|
|
72562
72707
|
const listed = await client.post("/api/apps/users", { appId });
|
|
72563
72708
|
print2({ context, args, value: listed, text: usersText({ name: name2, users: listed }) });
|
|
72564
72709
|
};
|
|
72565
72710
|
function blocking(blocked) {
|
|
72566
|
-
return async ({ context, args, open:
|
|
72711
|
+
return async ({ context, args, open: open3 }) => {
|
|
72567
72712
|
const verb = blocked ? "block-user" : "unblock-user";
|
|
72568
72713
|
const { app: app2, word: word3 } = appAndWord({ args, usage: `Usage: laze app ${verb} [app] <user-id>` });
|
|
72569
|
-
const { client, appId, name: name2 } = await
|
|
72714
|
+
const { client, appId, name: name2 } = await open3(app2);
|
|
72570
72715
|
const listed = await client.post("/api/apps/users/block", {
|
|
72571
72716
|
appId,
|
|
72572
72717
|
userId: word3,
|
|
@@ -72575,9 +72720,9 @@ function blocking(blocked) {
|
|
|
72575
72720
|
print2({ context, args, value: listed, text: usersText({ name: name2, users: listed }) });
|
|
72576
72721
|
};
|
|
72577
72722
|
}
|
|
72578
|
-
var deleteUser = async ({ context, args, open:
|
|
72723
|
+
var deleteUser = async ({ context, args, open: open3 }) => {
|
|
72579
72724
|
const { app: app2, word: word3 } = appAndWord({ args, usage: "Usage: laze app delete-user [app] <user-id>" });
|
|
72580
|
-
const { client, appId, name: name2 } = await
|
|
72725
|
+
const { client, appId, name: name2 } = await open3(app2);
|
|
72581
72726
|
const gone = await client.post("/api/apps/users/delete", { appId, userId: word3 });
|
|
72582
72727
|
const text2 = `Deleted ${gone.userId} from ${name2} with the ${gone.removedRecords.toString()} records they owned.
|
|
72583
72728
|
`;
|
|
@@ -72628,10 +72773,10 @@ async function appPinCommand({
|
|
|
72628
72773
|
context,
|
|
72629
72774
|
args,
|
|
72630
72775
|
verb,
|
|
72631
|
-
open:
|
|
72776
|
+
open: open3
|
|
72632
72777
|
}) {
|
|
72633
72778
|
const channel = flagText({ args, name: "channel" });
|
|
72634
|
-
const { client, appId, name: name2 } = await
|
|
72779
|
+
const { client, appId, name: name2 } = await open3();
|
|
72635
72780
|
const listed = await client.post(`/api/apps/${verb}`, {
|
|
72636
72781
|
appId,
|
|
72637
72782
|
...channel ? { channel } : {}
|
|
@@ -72664,7 +72809,7 @@ async function appPinsCommand({
|
|
|
72664
72809
|
import { execFile } from "node:child_process";
|
|
72665
72810
|
import { mkdtemp, rm as rm7, writeFile as writeFile12 } from "node:fs/promises";
|
|
72666
72811
|
import { tmpdir } from "node:os";
|
|
72667
|
-
import { join as
|
|
72812
|
+
import { join as join13 } from "node:path";
|
|
72668
72813
|
import { promisify } from "node:util";
|
|
72669
72814
|
var run2 = promisify(execFile);
|
|
72670
72815
|
var MODULE_SYNTAX = /^\s*(import|export)\s/m;
|
|
@@ -72693,11 +72838,11 @@ async function scriptErrorsOf({
|
|
|
72693
72838
|
const unknown2 = unknownCollectionsOf({ files: files2, collections });
|
|
72694
72839
|
const scripts = files2.flatMap(scriptsOf);
|
|
72695
72840
|
if (scripts.length === 0) return unknown2;
|
|
72696
|
-
const dir = await mkdtemp(
|
|
72841
|
+
const dir = await mkdtemp(join13(tmpdir(), "laze-app-check-"));
|
|
72697
72842
|
try {
|
|
72698
72843
|
const errors = await Promise.all(
|
|
72699
72844
|
scripts.map(async (script, index) => {
|
|
72700
|
-
const file3 =
|
|
72845
|
+
const file3 = join13(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
|
|
72701
72846
|
await writeFile12(file3, script.code);
|
|
72702
72847
|
try {
|
|
72703
72848
|
await run2(process.execPath, ["--check", file3]);
|
|
@@ -72760,26 +72905,26 @@ function print4({
|
|
|
72760
72905
|
context.out(args.flags.json ? `${JSON.stringify(value, null, 2)}
|
|
72761
72906
|
` : text2);
|
|
72762
72907
|
}
|
|
72763
|
-
async function add({ context, args, open:
|
|
72908
|
+
async function add({ context, args, open: open3, word: word3 }) {
|
|
72764
72909
|
const prompt = flagText({ args, name: "prompt" }).trim();
|
|
72765
72910
|
if (!prompt) throw new CliUsageError("--prompt says what the agent does with the records");
|
|
72766
72911
|
const body = { collection: word3, on: onOf(args), where: whereOf3(args), prompt };
|
|
72767
|
-
const { client, appId, name: name2 } = await
|
|
72912
|
+
const { client, appId, name: name2 } = await open3();
|
|
72768
72913
|
const trigger = await client.post("/api/apps/triggers/add", { appId, ...body });
|
|
72769
72914
|
const text2 = `Added a trigger on ${name2}:
|
|
72770
72915
|
${triggerLine(trigger)}Matching changes to published ${word3} records wake ${trigger.agentName} in ${trigger.channelName}.
|
|
72771
72916
|
`;
|
|
72772
72917
|
print4({ context, args, value: trigger, text: text2 });
|
|
72773
72918
|
}
|
|
72774
|
-
async function list({ context, args, open:
|
|
72775
|
-
const { client, appId, name: name2 } = await
|
|
72919
|
+
async function list({ context, args, open: open3 }) {
|
|
72920
|
+
const { client, appId, name: name2 } = await open3();
|
|
72776
72921
|
const listed = await client.post("/api/apps/triggers", { appId });
|
|
72777
72922
|
const text2 = listed.triggers.length === 0 ? `${name2} has no triggers. laze app trigger add <collection> adds one.
|
|
72778
72923
|
` : listed.triggers.map(triggerLine).join("");
|
|
72779
72924
|
print4({ context, args, value: listed, text: text2 });
|
|
72780
72925
|
}
|
|
72781
|
-
async function setPaused({ context, args, open:
|
|
72782
|
-
const { client, appId } = await
|
|
72926
|
+
async function setPaused({ context, args, open: open3, word: word3, paused }) {
|
|
72927
|
+
const { client, appId } = await open3();
|
|
72783
72928
|
const trigger = await client.post("/api/apps/triggers/pause", {
|
|
72784
72929
|
appId,
|
|
72785
72930
|
triggerId: word3,
|
|
@@ -72787,8 +72932,8 @@ async function setPaused({ context, args, open: open2, word: word3, paused }) {
|
|
|
72787
72932
|
});
|
|
72788
72933
|
print4({ context, args, value: trigger, text: triggerLine(trigger) });
|
|
72789
72934
|
}
|
|
72790
|
-
async function remove2({ context, args, open:
|
|
72791
|
-
const { client, appId } = await
|
|
72935
|
+
async function remove2({ context, args, open: open3, word: word3 }) {
|
|
72936
|
+
const { client, appId } = await open3();
|
|
72792
72937
|
await client.post("/api/apps/triggers/remove", { appId, triggerId: word3 });
|
|
72793
72938
|
print4({ context, args, value: { removed: word3 }, text: `Removed trigger ${word3}.
|
|
72794
72939
|
` });
|
|
@@ -72796,14 +72941,14 @@ async function remove2({ context, args, open: open2, word: word3 }) {
|
|
|
72796
72941
|
async function appTrigger({
|
|
72797
72942
|
context,
|
|
72798
72943
|
args,
|
|
72799
|
-
open:
|
|
72944
|
+
open: open3
|
|
72800
72945
|
}) {
|
|
72801
72946
|
const [, , verb, word3] = args.words;
|
|
72802
|
-
if (verb === "list") return list({ context, args, open:
|
|
72947
|
+
if (verb === "list") return list({ context, args, open: open3 });
|
|
72803
72948
|
const known = verb === "add" || verb === "pause" || verb === "resume" || verb === "remove";
|
|
72804
72949
|
if (known && !word3) throw new CliUsageError(USAGE4);
|
|
72805
72950
|
if (known && word3) {
|
|
72806
|
-
const run4 = { context, args, open:
|
|
72951
|
+
const run4 = { context, args, open: open3, word: word3 };
|
|
72807
72952
|
if (verb === "add") return add(run4);
|
|
72808
72953
|
if (verb === "remove") return remove2(run4);
|
|
72809
72954
|
return setPaused({ ...run4, paused: verb === "pause" });
|
|
@@ -72873,7 +73018,7 @@ function folderOf({ context, word: word3 }) {
|
|
|
72873
73018
|
return resolve6(context.cwd, word3 ?? ".");
|
|
72874
73019
|
}
|
|
72875
73020
|
async function readManifest(folder) {
|
|
72876
|
-
const text2 = await readFile11(
|
|
73021
|
+
const text2 = await readFile11(join14(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
72877
73022
|
if (text2 === void 0) return void 0;
|
|
72878
73023
|
const parsed = appManifestSchema.safeParse(JSON.parse(text2));
|
|
72879
73024
|
if (!parsed.success) {
|
|
@@ -72920,8 +73065,8 @@ async function listFiles(folder) {
|
|
|
72920
73065
|
const pending = [folder];
|
|
72921
73066
|
while (pending.length > 0 && found.length <= MAX_FILES) {
|
|
72922
73067
|
const current2 = pending.pop() ?? folder;
|
|
72923
|
-
for (const entry of await
|
|
72924
|
-
const path =
|
|
73068
|
+
for (const entry of await readdir5(current2, { withFileTypes: true })) {
|
|
73069
|
+
const path = join14(current2, entry.name);
|
|
72925
73070
|
const rel = relative3(folder, path).split(sep2).join("/");
|
|
72926
73071
|
if (isSkippedPath({ path: rel })) continue;
|
|
72927
73072
|
if (entry.isDirectory()) pending.push(path);
|
|
@@ -72965,8 +73110,8 @@ var appCreate = async ({ context, args }) => {
|
|
|
72965
73110
|
await mkdir12(folder, { recursive: true });
|
|
72966
73111
|
const files2 = template ? templateFiles({ template, name: name2 }) : {};
|
|
72967
73112
|
for (const [path, content] of Object.entries(files2)) {
|
|
72968
|
-
await mkdir12(dirname11(
|
|
72969
|
-
await writeFile13(
|
|
73113
|
+
await mkdir12(dirname11(join14(folder, path)), { recursive: true });
|
|
73114
|
+
await writeFile13(join14(folder, path), content);
|
|
72970
73115
|
}
|
|
72971
73116
|
const manifest = {
|
|
72972
73117
|
app: { id: app2.id, name: app2.name, slug: app2.slug },
|
|
@@ -72974,7 +73119,7 @@ var appCreate = async ({ context, args }) => {
|
|
|
72974
73119
|
views: template?.views ? [...template.views] : [],
|
|
72975
73120
|
seed: template ? { ...template.seed } : {}
|
|
72976
73121
|
};
|
|
72977
|
-
await writeFile13(
|
|
73122
|
+
await writeFile13(join14(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
72978
73123
|
`);
|
|
72979
73124
|
print5({
|
|
72980
73125
|
context,
|
|
@@ -73961,7 +74106,7 @@ async function billing({ context, args }) {
|
|
|
73961
74106
|
// src/services/browser-commands.service.ts
|
|
73962
74107
|
import { randomBytes } from "node:crypto";
|
|
73963
74108
|
import { mkdir as mkdir13, readFile as readFile12, writeFile as writeFile14 } from "node:fs/promises";
|
|
73964
|
-
import { dirname as dirname12, join as
|
|
74109
|
+
import { dirname as dirname12, join as join15 } from "node:path";
|
|
73965
74110
|
|
|
73966
74111
|
// src/services/browser-tab-commands.service.ts
|
|
73967
74112
|
var BROWSER_TAB_PATHS = {
|
|
@@ -74581,7 +74726,7 @@ async function cdp({ context, args }) {
|
|
|
74581
74726
|
}
|
|
74582
74727
|
function bridgeStatePath({ context, machine: machine2 }) {
|
|
74583
74728
|
const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
74584
|
-
return
|
|
74729
|
+
return join15(dirname12(context.environment.configPath), "bridges", `${safe}.json`);
|
|
74585
74730
|
}
|
|
74586
74731
|
async function bridgePort({
|
|
74587
74732
|
context,
|
|
@@ -78536,8 +78681,8 @@ var DOMAINS_USAGE = `Usage:
|
|
|
78536
78681
|
var printJson4 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
78537
78682
|
`);
|
|
78538
78683
|
function printDomain(context, row) {
|
|
78539
|
-
const
|
|
78540
|
-
context.out(`${row.domain} ${
|
|
78684
|
+
const join19 = row.autoJoin ? "auto-join on" : "auto-join off";
|
|
78685
|
+
context.out(`${row.domain} ${join19}${row.enforced ? " single sign-on enforced" : ""}
|
|
78541
78686
|
`);
|
|
78542
78687
|
}
|
|
78543
78688
|
async function list4({ context, args }) {
|
|
@@ -80129,11 +80274,11 @@ async function ip({ context, args }) {
|
|
|
80129
80274
|
|
|
80130
80275
|
// src/services/join-commands.service.ts
|
|
80131
80276
|
import { mkdir as mkdir15, readFile as readFile23, rename as rename5, rm as rm10, writeFile as writeFile16 } from "node:fs/promises";
|
|
80132
|
-
import { dirname as dirname14, join as
|
|
80277
|
+
import { dirname as dirname14, join as join16 } from "node:path";
|
|
80133
80278
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
80134
80279
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
80135
80280
|
function pendingPathOf({ context }) {
|
|
80136
|
-
return
|
|
80281
|
+
return join16(dirname14(context.environment.configPath), "join", "pending.json");
|
|
80137
80282
|
}
|
|
80138
80283
|
async function readPending({
|
|
80139
80284
|
context,
|
|
@@ -80472,7 +80617,7 @@ function machineAccessCommand(name2) {
|
|
|
80472
80617
|
import { createHash as createHash2 } from "node:crypto";
|
|
80473
80618
|
import { mkdir as mkdir16, readFile as readFile24, rm as rm11, writeFile as writeFile17 } from "node:fs/promises";
|
|
80474
80619
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
80475
|
-
import { dirname as dirname15, join as
|
|
80620
|
+
import { dirname as dirname15, join as join17 } from "node:path";
|
|
80476
80621
|
var USAGE10 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
80477
80622
|
Runs the command with the connection's values in its environment, on a Laze agent's computer
|
|
80478
80623
|
or on a machine it runs on.`;
|
|
@@ -80521,8 +80666,8 @@ function runKeyPathOf({
|
|
|
80521
80666
|
connection
|
|
80522
80667
|
}) {
|
|
80523
80668
|
const name2 = createHash2("sha256").update(connection).digest("hex");
|
|
80524
|
-
const base = turnFile ? dirname15(turnFile) :
|
|
80525
|
-
return
|
|
80669
|
+
const base = turnFile ? dirname15(turnFile) : join17(tmpdir2(), "laze-vault");
|
|
80670
|
+
return join17(base, "vault-run-keys", `${name2}.json`);
|
|
80526
80671
|
}
|
|
80527
80672
|
async function runKeyAt({ path }) {
|
|
80528
80673
|
const saved3 = await readFile24(path, "utf8").then(
|
|
@@ -82112,8 +82257,8 @@ async function schedule({ context, args }) {
|
|
|
82112
82257
|
}
|
|
82113
82258
|
|
|
82114
82259
|
// src/services/skill-commands.service.ts
|
|
82115
|
-
import { readdir as
|
|
82116
|
-
import { join as
|
|
82260
|
+
import { readdir as readdir6, readFile as readFile26 } from "node:fs/promises";
|
|
82261
|
+
import { join as join18, relative as relative6, resolve as resolve12 } from "node:path";
|
|
82117
82262
|
var USAGE16 = `Usage:
|
|
82118
82263
|
laze skill list [--agent <agentId>]
|
|
82119
82264
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -82130,11 +82275,11 @@ var USAGE16 = `Usage:
|
|
|
82130
82275
|
--agent names the agent with a person's key; an agent's key works on its own skills.
|
|
82131
82276
|
With a person's key, list without --agent shows every agent's skills.`;
|
|
82132
82277
|
async function folderFiles({ root }) {
|
|
82133
|
-
const entries = await
|
|
82278
|
+
const entries = await readdir6(root, { recursive: true, withFileTypes: true });
|
|
82134
82279
|
const files2 = [];
|
|
82135
82280
|
for (const entry of entries) {
|
|
82136
82281
|
if (!entry.isFile()) continue;
|
|
82137
|
-
const full =
|
|
82282
|
+
const full = join18(entry.parentPath, entry.name);
|
|
82138
82283
|
files2.push({ path: relative6(root, full), content: await readFile26(full, "utf8") });
|
|
82139
82284
|
}
|
|
82140
82285
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
package/package.json
CHANGED