@lazehq/cli 0.1.15 → 0.1.17
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 +109 -65
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -18733,7 +18733,7 @@ var require_snapshot_utils = __commonJS({
|
|
|
18733
18733
|
var require_snapshot_recorder = __commonJS({
|
|
18734
18734
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
18735
18735
|
"use strict";
|
|
18736
|
-
var { writeFile: writeFile21, readFile:
|
|
18736
|
+
var { writeFile: writeFile21, readFile: readFile34, mkdir: mkdir19 } = __require("node:fs/promises");
|
|
18737
18737
|
var { dirname: dirname19, resolve: resolve17 } = __require("node:path");
|
|
18738
18738
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
18739
18739
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
@@ -18950,7 +18950,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18950
18950
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
18951
18951
|
}
|
|
18952
18952
|
try {
|
|
18953
|
-
const data = await
|
|
18953
|
+
const data = await readFile34(resolve17(path), "utf8");
|
|
18954
18954
|
const parsed = JSON.parse(data);
|
|
18955
18955
|
if (Array.isArray(parsed)) {
|
|
18956
18956
|
this.#snapshots.clear();
|
|
@@ -35606,7 +35606,7 @@ function flagText({
|
|
|
35606
35606
|
}
|
|
35607
35607
|
|
|
35608
35608
|
// src/rules/cli-version.rules.ts
|
|
35609
|
-
var STAMPED = "0.1.
|
|
35609
|
+
var STAMPED = "0.1.17";
|
|
35610
35610
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35611
35611
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35612
35612
|
}
|
|
@@ -69438,6 +69438,28 @@ import { mkdir as mkdir12, readFile as readFile10, writeFile as writeFile12 } fr
|
|
|
69438
69438
|
import { dirname as dirname12 } from "node:path";
|
|
69439
69439
|
var RELOAD_TIP = "Laze: the Laze plugin is installed in Claude Code, and this session has not loaded it yet. Tell the user once, in one plain line, that it is optional: typing /reload-plugins makes Laze messages arrive right away; until then they still arrive through the hooks.";
|
|
69440
69440
|
var LINK_RELOAD_TIP = "Tell the user once, in one plain line, that it is optional: typing /reload-plugins makes Laze messages arrive right away; until then they still arrive through the hooks.";
|
|
69441
|
+
function monitorsRunHere({ context }) {
|
|
69442
|
+
const entrypoint = context.environment.inherited.CLAUDE_CODE_ENTRYPOINT;
|
|
69443
|
+
return entrypoint === void 0 || entrypoint === "cli";
|
|
69444
|
+
}
|
|
69445
|
+
function pluginLinesOf({
|
|
69446
|
+
context,
|
|
69447
|
+
registered
|
|
69448
|
+
}) {
|
|
69449
|
+
if (registered === void 0) return [];
|
|
69450
|
+
if (!registered)
|
|
69451
|
+
return ["Claude Code did not take the Laze plugin; the hooks deliver on their own."];
|
|
69452
|
+
if (!monitorsRunHere({ context })) {
|
|
69453
|
+
return [
|
|
69454
|
+
"The Laze plugin is installed in Claude Code. This session runs headless (claude -p), where",
|
|
69455
|
+
"Claude Code starts no plugin monitors, so the hooks deliver here; nothing to type or restart."
|
|
69456
|
+
];
|
|
69457
|
+
}
|
|
69458
|
+
return [
|
|
69459
|
+
"The Laze plugin is installed in Claude Code: from the next start or resume it delivers too.",
|
|
69460
|
+
LINK_RELOAD_TIP
|
|
69461
|
+
];
|
|
69462
|
+
}
|
|
69441
69463
|
function toldPathOf({ context, session }) {
|
|
69442
69464
|
return statePathOf({ context, kind: "told", profile: `plugin-${sessionKeyOf({ session })}` });
|
|
69443
69465
|
}
|
|
@@ -69454,7 +69476,8 @@ async function reloadTipOnce({
|
|
|
69454
69476
|
context,
|
|
69455
69477
|
session
|
|
69456
69478
|
}) {
|
|
69457
|
-
if (!session || !
|
|
69479
|
+
if (!session || !monitorsRunHere({ context })) return void 0;
|
|
69480
|
+
if (!await pluginRegistered({ context })) return void 0;
|
|
69458
69481
|
const told = await readFile10(toldPathOf({ context, session }), "utf8").then(
|
|
69459
69482
|
() => true,
|
|
69460
69483
|
() => false
|
|
@@ -69559,14 +69582,6 @@ async function registerMcp({
|
|
|
69559
69582
|
done.abort();
|
|
69560
69583
|
return code === 0;
|
|
69561
69584
|
}
|
|
69562
|
-
function pluginLinesOf({ plugin: plugin2 }) {
|
|
69563
|
-
if (plugin2 === void 0) return [];
|
|
69564
|
-
if (!plugin2) return ["Claude Code did not take the Laze plugin; the hooks deliver on their own."];
|
|
69565
|
-
return [
|
|
69566
|
-
"The Laze plugin is installed in Claude Code: from the next start or resume it delivers too.",
|
|
69567
|
-
LINK_RELOAD_TIP
|
|
69568
|
-
];
|
|
69569
|
-
}
|
|
69570
69585
|
function mcpLinesOf({
|
|
69571
69586
|
mcp: mcp2,
|
|
69572
69587
|
mcpAdd: mcpAdd2,
|
|
@@ -69595,7 +69610,7 @@ function claudeStepsOf({
|
|
|
69595
69610
|
"Answer each with",
|
|
69596
69611
|
` ${laze} reply <message-id> "<answer>" --profile ${profile}`,
|
|
69597
69612
|
"Nothing else needs to keep running.",
|
|
69598
|
-
...
|
|
69613
|
+
...plugin2,
|
|
69599
69614
|
...mcpLinesOf({ mcp: mcp2, mcpAdd: mcpAdd2, directory })
|
|
69600
69615
|
].join("\n");
|
|
69601
69616
|
}
|
|
@@ -69724,7 +69739,8 @@ async function nextStepsFor({
|
|
|
69724
69739
|
}
|
|
69725
69740
|
const mcp2 = args.flags.mcp ? await registerMcp({ context, directory, profile }) : void 0;
|
|
69726
69741
|
const mcpAdd2 = mcpAddCommandOf({ context, profile });
|
|
69727
|
-
|
|
69742
|
+
const lines = pluginLinesOf({ context, registered: plugin2?.registered });
|
|
69743
|
+
return claudeStepsOf({ profile, laze, directory, mcp: mcp2, mcpAdd: mcpAdd2, plugin: lines });
|
|
69728
69744
|
}
|
|
69729
69745
|
async function reportTranscript({
|
|
69730
69746
|
client,
|
|
@@ -76090,15 +76106,18 @@ async function chatActions({
|
|
|
76090
76106
|
}
|
|
76091
76107
|
|
|
76092
76108
|
// src/services/claude-monitor.service.ts
|
|
76093
|
-
import { rm as rm9 } from "node:fs/promises";
|
|
76109
|
+
import { readFile as readFile16, rm as rm9 } from "node:fs/promises";
|
|
76094
76110
|
var MONITOR_IDLE_MS = 3e4;
|
|
76111
|
+
var MONITOR_OUTRANKED_MS = 3e3;
|
|
76095
76112
|
async function agentProfileHere({
|
|
76096
76113
|
context,
|
|
76097
76114
|
args,
|
|
76098
|
-
session
|
|
76115
|
+
session,
|
|
76116
|
+
claudePid
|
|
76099
76117
|
}) {
|
|
76100
76118
|
const config2 = await context.store.read();
|
|
76101
|
-
const
|
|
76119
|
+
const cwd = (claudePid ? await context.processes.cwdOf(claudePid) : void 0) ?? context.cwd;
|
|
76120
|
+
const folder = boundProfileOf({ bindings: config2.bindings, cwd });
|
|
76102
76121
|
if (!folder && !session) return void 0;
|
|
76103
76122
|
const asked = { ...args, flags: { ...args.flags, ...folder ? { profile: folder } : {} } };
|
|
76104
76123
|
const name2 = flagText({
|
|
@@ -76116,7 +76135,9 @@ async function deliverOnce({
|
|
|
76116
76135
|
}) {
|
|
76117
76136
|
const lock = statePathOf({ context, kind: "waiters", profile });
|
|
76118
76137
|
const mine3 = (await holderOf({ path: lock }))?.pid === context.processes.pid;
|
|
76119
|
-
if (!mine3 && !await takeLock({ context, path: lock, claudePid, preempt: true }))
|
|
76138
|
+
if (!mine3 && !await takeLock({ context, path: lock, claudePid, preempt: true })) {
|
|
76139
|
+
return "outranked";
|
|
76140
|
+
}
|
|
76120
76141
|
const named = { ...args, flags: { ...args.flags, profile } };
|
|
76121
76142
|
const { client } = await signedIn({ context, args: named });
|
|
76122
76143
|
const due = await dueFromSpool({ context, profile, seen: async () => "", pushedToo: true });
|
|
@@ -76156,23 +76177,46 @@ async function release({ context, profile }) {
|
|
|
76156
76177
|
}
|
|
76157
76178
|
async function monitorHook({ context, args }) {
|
|
76158
76179
|
const claudePid = await claudePidOf({ context });
|
|
76159
|
-
const
|
|
76160
|
-
|
|
76161
|
-
await rememberSession({ context, claudePid, session });
|
|
76180
|
+
const session = await monitorSessionOf({ context, claudePid });
|
|
76181
|
+
await rememberSession({ context, claudePid, session }).catch(() => void 0);
|
|
76162
76182
|
const held = /* @__PURE__ */ new Set();
|
|
76163
76183
|
const turn = { context, args, claudePid, session };
|
|
76164
76184
|
try {
|
|
76165
76185
|
while (claudePid && context.processes.alive(claudePid)) {
|
|
76166
|
-
const
|
|
76167
|
-
|
|
76168
|
-
if (
|
|
76169
|
-
if (!busy) await context.sleep(MONITOR_IDLE_MS);
|
|
76186
|
+
const round = await oneRound({ turn, held });
|
|
76187
|
+
if (round === "outranked") await context.sleep(MONITOR_OUTRANKED_MS);
|
|
76188
|
+
else if (!round) await context.sleep(MONITOR_IDLE_MS);
|
|
76170
76189
|
}
|
|
76171
76190
|
return 0;
|
|
76172
76191
|
} finally {
|
|
76173
|
-
for (const profile of held) await release({ context, profile });
|
|
76192
|
+
for (const profile of held) await release({ context, profile }).catch(() => void 0);
|
|
76174
76193
|
}
|
|
76175
76194
|
}
|
|
76195
|
+
async function oneRound({ turn, held }) {
|
|
76196
|
+
try {
|
|
76197
|
+
const profile = await agentProfileHere(turn);
|
|
76198
|
+
const round = profile ? await monitorRound({ ...turn, profile }) : false;
|
|
76199
|
+
if (profile && round === true) held.add(profile);
|
|
76200
|
+
return round;
|
|
76201
|
+
} catch (error62) {
|
|
76202
|
+
turn.context.err(`laze: the monitor will try again: ${String(error62)}
|
|
76203
|
+
`);
|
|
76204
|
+
return false;
|
|
76205
|
+
}
|
|
76206
|
+
}
|
|
76207
|
+
async function monitorSessionOf({
|
|
76208
|
+
context,
|
|
76209
|
+
claudePid
|
|
76210
|
+
}) {
|
|
76211
|
+
const sessionId = context.environment.inherited.CLAUDE_CODE_SESSION_ID;
|
|
76212
|
+
const fromEnv = sessionOf({ context, harness: "claude-code", sessionId });
|
|
76213
|
+
if (fromEnv || !claudePid) return fromEnv;
|
|
76214
|
+
const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
76215
|
+
return readFile16(path, "utf8").then(
|
|
76216
|
+
(text2) => JSON.parse(text2),
|
|
76217
|
+
() => void 0
|
|
76218
|
+
);
|
|
76219
|
+
}
|
|
76176
76220
|
|
|
76177
76221
|
// ../../modules/compute/contract/src/browser-tab.ts
|
|
76178
76222
|
var browserTabSharingSchema = external_exports.enum(["private", "watch", "use"]);
|
|
@@ -77655,10 +77699,10 @@ async function computer({ context, args }) {
|
|
|
77655
77699
|
}
|
|
77656
77700
|
|
|
77657
77701
|
// src/services/connect-commands.service.ts
|
|
77658
|
-
import { readFile as
|
|
77702
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
77659
77703
|
|
|
77660
77704
|
// src/services/mcp-gateway.service.ts
|
|
77661
|
-
import { readFile as
|
|
77705
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
77662
77706
|
import { createInterface as createInterface3 } from "node:readline";
|
|
77663
77707
|
var TURN_HEADER = "x-laze-turn";
|
|
77664
77708
|
function serveMcpGateway({
|
|
@@ -77701,7 +77745,7 @@ async function relayMcpLines({
|
|
|
77701
77745
|
const github3 = env.LAZE_GITHUB_CONNECTION;
|
|
77702
77746
|
const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
|
|
77703
77747
|
const turnFile = env.LAZE_TURN_FILE;
|
|
77704
|
-
const readTurn = () =>
|
|
77748
|
+
const readTurn = () => readFile17(turnFile, "utf8").then(
|
|
77705
77749
|
(text2) => text2.trim(),
|
|
77706
77750
|
() => ""
|
|
77707
77751
|
);
|
|
@@ -77791,7 +77835,7 @@ async function turnOf({ context }) {
|
|
|
77791
77835
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
77792
77836
|
if (pinned) return pinned;
|
|
77793
77837
|
const file3 = env.LAZE_TURN_FILE;
|
|
77794
|
-
const turn = file3 ? await
|
|
77838
|
+
const turn = file3 ? await readFile18(file3, "utf8").then(
|
|
77795
77839
|
(text2) => text2.trim(),
|
|
77796
77840
|
() => ""
|
|
77797
77841
|
) : "";
|
|
@@ -77849,11 +77893,11 @@ async function connect({
|
|
|
77849
77893
|
}
|
|
77850
77894
|
|
|
77851
77895
|
// src/services/connector-commands.service.ts
|
|
77852
|
-
import { readFile as
|
|
77896
|
+
import { readFile as readFile20 } from "node:fs/promises";
|
|
77853
77897
|
import { resolve as resolve8 } from "node:path";
|
|
77854
77898
|
|
|
77855
77899
|
// src/services/vault-keychain-commands.service.ts
|
|
77856
|
-
import { readFile as
|
|
77900
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
77857
77901
|
|
|
77858
77902
|
// src/rules/vault-input.rules.ts
|
|
77859
77903
|
function secondsOf(text2) {
|
|
@@ -78164,7 +78208,7 @@ async function secretText({ context, args }) {
|
|
|
78164
78208
|
);
|
|
78165
78209
|
}
|
|
78166
78210
|
const file3 = flagText({ args, name: "from-file" });
|
|
78167
|
-
const text2 = file3 ? await
|
|
78211
|
+
const text2 = file3 ? await readFile19(file3, "utf8") : await context.readStdin();
|
|
78168
78212
|
const trimmed = text2.replace(/\r?\n$/, "");
|
|
78169
78213
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
78170
78214
|
return trimmed;
|
|
@@ -78362,7 +78406,7 @@ async function keyText({ context, args }) {
|
|
|
78362
78406
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
78363
78407
|
}
|
|
78364
78408
|
const file3 = flagText({ args, name: "from-file" });
|
|
78365
|
-
const text2 = file3 ? await
|
|
78409
|
+
const text2 = file3 ? await readFile20(resolve8(context.cwd, file3), "utf8") : await context.readStdin();
|
|
78366
78410
|
const trimmed = text2.trim();
|
|
78367
78411
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
78368
78412
|
return trimmed;
|
|
@@ -78781,7 +78825,7 @@ async function domains({ context, args }) {
|
|
|
78781
78825
|
}
|
|
78782
78826
|
|
|
78783
78827
|
// src/services/feed-commands.service.ts
|
|
78784
|
-
import { readFile as
|
|
78828
|
+
import { readFile as readFile22 } from "node:fs/promises";
|
|
78785
78829
|
import { resolve as resolve10 } from "node:path";
|
|
78786
78830
|
|
|
78787
78831
|
// src/rules/feed-input.rules.ts
|
|
@@ -78906,7 +78950,7 @@ function feedFlagsOf({ args }) {
|
|
|
78906
78950
|
}
|
|
78907
78951
|
|
|
78908
78952
|
// src/services/feed-files.service.ts
|
|
78909
|
-
import { readFile as
|
|
78953
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
78910
78954
|
import { basename as basename3, resolve as resolve9 } from "node:path";
|
|
78911
78955
|
|
|
78912
78956
|
// ../../modules/feed/contract/src/feed.ts
|
|
@@ -79499,7 +79543,7 @@ async function local({ context, path }) {
|
|
|
79499
79543
|
return {
|
|
79500
79544
|
fileName,
|
|
79501
79545
|
contentType: contentTypeOf(fileName),
|
|
79502
|
-
bytes: new Uint8Array(await
|
|
79546
|
+
bytes: new Uint8Array(await readFile21(full))
|
|
79503
79547
|
};
|
|
79504
79548
|
}
|
|
79505
79549
|
async function directWith({ client, to }) {
|
|
@@ -79577,7 +79621,7 @@ async function bodyOf2({
|
|
|
79577
79621
|
flags: flags2
|
|
79578
79622
|
}) {
|
|
79579
79623
|
const body = { ...flags2.fields };
|
|
79580
|
-
const read3 = (source) => "file" in source ?
|
|
79624
|
+
const read3 = (source) => "file" in source ? readFile22(resolve10(context.cwd, source.file), "utf8") : source.text;
|
|
79581
79625
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read3(source);
|
|
79582
79626
|
if (flags2.rich) {
|
|
79583
79627
|
const text2 = await read3(flags2.rich.source);
|
|
@@ -79739,7 +79783,7 @@ async function textFlag({
|
|
|
79739
79783
|
}) {
|
|
79740
79784
|
const value = flagText({ args, name: name2 });
|
|
79741
79785
|
if (!value.startsWith("@")) return value;
|
|
79742
|
-
return
|
|
79786
|
+
return readFile22(resolve10(context.cwd, value.slice(1)), "utf8");
|
|
79743
79787
|
}
|
|
79744
79788
|
async function feedList({ context, args }) {
|
|
79745
79789
|
const { client } = await signedIn({ context, args });
|
|
@@ -79849,7 +79893,7 @@ async function feed({ context, args }) {
|
|
|
79849
79893
|
}
|
|
79850
79894
|
|
|
79851
79895
|
// src/services/github-commands.service.ts
|
|
79852
|
-
import { readFile as
|
|
79896
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
79853
79897
|
|
|
79854
79898
|
// src/rules/github-signature.rules.ts
|
|
79855
79899
|
var TURN_SEPARATOR = "~";
|
|
@@ -79919,7 +79963,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
79919
79963
|
var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Its owner sets one on the agent's settings page or with `laze agent set-github <agent> <connection>`.";
|
|
79920
79964
|
async function turnFileToken({ env }) {
|
|
79921
79965
|
if (!env.LAZE_TURN_FILE) return "";
|
|
79922
|
-
return
|
|
79966
|
+
return readFile23(env.LAZE_TURN_FILE, "utf8").then(
|
|
79923
79967
|
(text2) => text2.trim(),
|
|
79924
79968
|
() => ""
|
|
79925
79969
|
);
|
|
@@ -79953,7 +79997,7 @@ async function githubGh({
|
|
|
79953
79997
|
args: args.rest,
|
|
79954
79998
|
agentName: profile.name ?? "An agent",
|
|
79955
79999
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
79956
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
80000
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile23(path, "utf8")
|
|
79957
80001
|
});
|
|
79958
80002
|
return context.runCommand({
|
|
79959
80003
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -80052,7 +80096,7 @@ async function setAgentGithub({
|
|
|
80052
80096
|
}
|
|
80053
80097
|
|
|
80054
80098
|
// src/services/history-commands.service.ts
|
|
80055
|
-
import { readFile as
|
|
80099
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
80056
80100
|
|
|
80057
80101
|
// src/rules/history-format.rules.ts
|
|
80058
80102
|
function timeOf2(iso) {
|
|
@@ -80148,7 +80192,7 @@ async function turnTokenOf3({ context }) {
|
|
|
80148
80192
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
80149
80193
|
if (pinned) return pinned;
|
|
80150
80194
|
if (!env.LAZE_TURN_FILE) return "";
|
|
80151
|
-
return
|
|
80195
|
+
return readFile24(env.LAZE_TURN_FILE, "utf8").then(
|
|
80152
80196
|
(text2) => text2.trim(),
|
|
80153
80197
|
() => ""
|
|
80154
80198
|
);
|
|
@@ -80340,7 +80384,7 @@ async function ip({ context, args }) {
|
|
|
80340
80384
|
}
|
|
80341
80385
|
|
|
80342
80386
|
// src/services/join-commands.service.ts
|
|
80343
|
-
import { mkdir as mkdir16, readFile as
|
|
80387
|
+
import { mkdir as mkdir16, readFile as readFile25, rename as rename5, rm as rm10, writeFile as writeFile17 } from "node:fs/promises";
|
|
80344
80388
|
import { dirname as dirname15, join as join16 } from "node:path";
|
|
80345
80389
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
80346
80390
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
@@ -80352,7 +80396,7 @@ async function readPending({
|
|
|
80352
80396
|
url: url2,
|
|
80353
80397
|
args
|
|
80354
80398
|
}) {
|
|
80355
|
-
const pending = await
|
|
80399
|
+
const pending = await readFile25(pendingPathOf({ context }), "utf8").then(
|
|
80356
80400
|
(text2) => JSON.parse(text2),
|
|
80357
80401
|
() => void 0
|
|
80358
80402
|
);
|
|
@@ -80682,7 +80726,7 @@ function machineAccessCommand(name2) {
|
|
|
80682
80726
|
|
|
80683
80727
|
// src/services/vault-commands.service.ts
|
|
80684
80728
|
import { createHash as createHash2 } from "node:crypto";
|
|
80685
|
-
import { mkdir as mkdir17, readFile as
|
|
80729
|
+
import { mkdir as mkdir17, readFile as readFile26, rm as rm11, writeFile as writeFile18 } from "node:fs/promises";
|
|
80686
80730
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
80687
80731
|
import { dirname as dirname16, join as join17 } from "node:path";
|
|
80688
80732
|
var USAGE10 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
@@ -80723,7 +80767,7 @@ async function turnTokenOf4({
|
|
|
80723
80767
|
if (pinned) return pinned;
|
|
80724
80768
|
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
80725
80769
|
try {
|
|
80726
|
-
return (await
|
|
80770
|
+
return (await readFile26(turnFile, "utf8")).trim();
|
|
80727
80771
|
} catch {
|
|
80728
80772
|
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
80729
80773
|
}
|
|
@@ -80737,7 +80781,7 @@ function runKeyPathOf({
|
|
|
80737
80781
|
return join17(base, "vault-run-keys", `${name2}.json`);
|
|
80738
80782
|
}
|
|
80739
80783
|
async function runKeyAt({ path }) {
|
|
80740
|
-
const saved3 = await
|
|
80784
|
+
const saved3 = await readFile26(path, "utf8").then(
|
|
80741
80785
|
(text2) => JSON.parse(text2),
|
|
80742
80786
|
() => void 0
|
|
80743
80787
|
);
|
|
@@ -81419,14 +81463,14 @@ async function serveMcp({
|
|
|
81419
81463
|
}
|
|
81420
81464
|
|
|
81421
81465
|
// src/services/mount-files.service.ts
|
|
81422
|
-
import { mkdir as mkdir18, readFile as
|
|
81466
|
+
import { mkdir as mkdir18, readFile as readFile27, rm as rm12, writeFile as writeFile19 } from "node:fs/promises";
|
|
81423
81467
|
import { dirname as dirname17, relative as relative5, resolve as resolve11 } from "node:path";
|
|
81424
81468
|
async function textArgument({
|
|
81425
81469
|
context,
|
|
81426
81470
|
value
|
|
81427
81471
|
}) {
|
|
81428
81472
|
if (value === "-") return context.readStdin();
|
|
81429
|
-
if (value.startsWith("@")) return
|
|
81473
|
+
if (value.startsWith("@")) return readFile27(resolve11(context.cwd, value.slice(1)), "utf8");
|
|
81430
81474
|
return value;
|
|
81431
81475
|
}
|
|
81432
81476
|
function turnChannel({ context, args }) {
|
|
@@ -82324,7 +82368,7 @@ async function schedule({ context, args }) {
|
|
|
82324
82368
|
}
|
|
82325
82369
|
|
|
82326
82370
|
// src/services/skill-commands.service.ts
|
|
82327
|
-
import { readdir as readdir6, readFile as
|
|
82371
|
+
import { readdir as readdir6, readFile as readFile28 } from "node:fs/promises";
|
|
82328
82372
|
import { join as join18, relative as relative6, resolve as resolve12 } from "node:path";
|
|
82329
82373
|
var USAGE16 = `Usage:
|
|
82330
82374
|
laze skill list [--agent <agentId>]
|
|
@@ -82347,7 +82391,7 @@ async function folderFiles({ root }) {
|
|
|
82347
82391
|
for (const entry of entries) {
|
|
82348
82392
|
if (!entry.isFile()) continue;
|
|
82349
82393
|
const full = join18(entry.parentPath, entry.name);
|
|
82350
|
-
files2.push({ path: relative6(root, full), content: await
|
|
82394
|
+
files2.push({ path: relative6(root, full), content: await readFile28(full, "utf8") });
|
|
82351
82395
|
}
|
|
82352
82396
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
82353
82397
|
}
|
|
@@ -82445,7 +82489,7 @@ async function skillUpdate({ context, args }) {
|
|
|
82445
82489
|
if (!name2 || !newName && description === void 0 && !skillMdFile) {
|
|
82446
82490
|
throw new CliUsageError(USAGE16);
|
|
82447
82491
|
}
|
|
82448
|
-
const skillMd = skillMdFile ? await
|
|
82492
|
+
const skillMd = skillMdFile ? await readFile28(resolve12(context.cwd, skillMdFile), "utf8") : void 0;
|
|
82449
82493
|
const { client } = await signedIn({ context, args });
|
|
82450
82494
|
const updated = await client.post("/api/skills/update", {
|
|
82451
82495
|
name: name2,
|
|
@@ -82491,7 +82535,7 @@ async function skill({ context, args }) {
|
|
|
82491
82535
|
}
|
|
82492
82536
|
|
|
82493
82537
|
// src/services/slack-commands.service.ts
|
|
82494
|
-
import { readFile as
|
|
82538
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
82495
82539
|
import { resolve as resolve13 } from "node:path";
|
|
82496
82540
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
82497
82541
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -82539,7 +82583,7 @@ async function secretLines({ context, args }) {
|
|
|
82539
82583
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
82540
82584
|
}
|
|
82541
82585
|
const file3 = flagText({ args, name: "from-file" });
|
|
82542
|
-
const text2 = file3 ? await
|
|
82586
|
+
const text2 = file3 ? await readFile29(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
|
|
82543
82587
|
return text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
82544
82588
|
}
|
|
82545
82589
|
async function secretsOf({
|
|
@@ -82843,7 +82887,7 @@ async function slack({
|
|
|
82843
82887
|
}
|
|
82844
82888
|
|
|
82845
82889
|
// src/services/sso-commands.service.ts
|
|
82846
|
-
import { readFile as
|
|
82890
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
82847
82891
|
var SSO_USAGE = `Usage:
|
|
82848
82892
|
laze sso domains claimed domains and how each signs in (admins)
|
|
82849
82893
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -82930,7 +82974,7 @@ function refuseSecretFlags({ args }) {
|
|
|
82930
82974
|
}
|
|
82931
82975
|
async function clientSecretOf({ context, args }) {
|
|
82932
82976
|
const file3 = flagText({ args, name: "from-file" });
|
|
82933
|
-
const text2 = file3 ? await
|
|
82977
|
+
const text2 = file3 ? await readFile30(file3, "utf8") : await context.readStdin();
|
|
82934
82978
|
const secret = text2.trim();
|
|
82935
82979
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
82936
82980
|
return secret;
|
|
@@ -83263,7 +83307,7 @@ async function vaultScrub({ context, args }) {
|
|
|
83263
83307
|
}
|
|
83264
83308
|
|
|
83265
83309
|
// src/services/whatsapp-business-commands.service.ts
|
|
83266
|
-
import { readFile as
|
|
83310
|
+
import { readFile as readFile31 } from "node:fs/promises";
|
|
83267
83311
|
import { resolve as resolve14 } from "node:path";
|
|
83268
83312
|
|
|
83269
83313
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -83683,7 +83727,7 @@ async function secretsOf2({ context, args }) {
|
|
|
83683
83727
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
83684
83728
|
if (fromConnection) return { fromConnection };
|
|
83685
83729
|
const file3 = flagText({ args, name: "from-file" });
|
|
83686
|
-
const text2 = file3 ? await
|
|
83730
|
+
const text2 = file3 ? await readFile31(resolve14(context.cwd, file3), "utf8") : await context.readStdin();
|
|
83687
83731
|
const lines = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
83688
83732
|
if (lines.length !== 2) {
|
|
83689
83733
|
throw new CliUsageError(
|
|
@@ -84264,7 +84308,7 @@ async function flags({ context, args }) {
|
|
|
84264
84308
|
}
|
|
84265
84309
|
|
|
84266
84310
|
// src/services/workspace-commands.service.ts
|
|
84267
|
-
import { readFile as
|
|
84311
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
84268
84312
|
import { resolve as resolve16 } from "node:path";
|
|
84269
84313
|
var ROLE_NAMES2 = {
|
|
84270
84314
|
OWNER: "Owner",
|
|
@@ -84447,7 +84491,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
84447
84491
|
async function readLogo({ context, file: file3 }) {
|
|
84448
84492
|
let bytes;
|
|
84449
84493
|
try {
|
|
84450
|
-
bytes = new Uint8Array(await
|
|
84494
|
+
bytes = new Uint8Array(await readFile32(resolve16(context.cwd, file3)));
|
|
84451
84495
|
} catch {
|
|
84452
84496
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
84453
84497
|
}
|
|
@@ -85108,7 +85152,7 @@ async function runCli({
|
|
|
85108
85152
|
// src/services/processes.service.ts
|
|
85109
85153
|
import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
|
|
85110
85154
|
import { mkdirSync, openSync } from "node:fs";
|
|
85111
|
-
import { readFile as
|
|
85155
|
+
import { readFile as readFile33, readlink } from "node:fs/promises";
|
|
85112
85156
|
import { dirname as dirname18 } from "node:path";
|
|
85113
85157
|
import { promisify as promisify2 } from "node:util";
|
|
85114
85158
|
var run3 = promisify2(execFile2);
|
|
@@ -85122,14 +85166,14 @@ function alive(pid) {
|
|
|
85122
85166
|
}
|
|
85123
85167
|
}
|
|
85124
85168
|
async function argsOf(pid) {
|
|
85125
|
-
const raw = await
|
|
85169
|
+
const raw = await readFile33(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
85126
85170
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
85127
85171
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
85128
85172
|
const line = listed?.stdout.trim();
|
|
85129
85173
|
return line ? line.split(/\s+/) : void 0;
|
|
85130
85174
|
}
|
|
85131
85175
|
async function parentOf(pid) {
|
|
85132
|
-
const stat3 = await
|
|
85176
|
+
const stat3 = await readFile33(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
85133
85177
|
const fromStat = stat3 ? Number(stat3.slice(stat3.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
85134
85178
|
if (fromStat > 0) return fromStat;
|
|
85135
85179
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
package/package.json
CHANGED