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