@lazehq/cli 0.1.15 → 0.1.16
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 +82 -54
- 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.16";
|
|
35610
35610
|
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
35611
35611
|
return stamped.startsWith("__") ? "dev" : stamped;
|
|
35612
35612
|
}
|
|
@@ -76090,15 +76090,18 @@ async function chatActions({
|
|
|
76090
76090
|
}
|
|
76091
76091
|
|
|
76092
76092
|
// src/services/claude-monitor.service.ts
|
|
76093
|
-
import { rm as rm9 } from "node:fs/promises";
|
|
76093
|
+
import { readFile as readFile16, rm as rm9 } from "node:fs/promises";
|
|
76094
76094
|
var MONITOR_IDLE_MS = 3e4;
|
|
76095
|
+
var MONITOR_OUTRANKED_MS = 3e3;
|
|
76095
76096
|
async function agentProfileHere({
|
|
76096
76097
|
context,
|
|
76097
76098
|
args,
|
|
76098
|
-
session
|
|
76099
|
+
session,
|
|
76100
|
+
claudePid
|
|
76099
76101
|
}) {
|
|
76100
76102
|
const config2 = await context.store.read();
|
|
76101
|
-
const
|
|
76103
|
+
const cwd = (claudePid ? await context.processes.cwdOf(claudePid) : void 0) ?? context.cwd;
|
|
76104
|
+
const folder = boundProfileOf({ bindings: config2.bindings, cwd });
|
|
76102
76105
|
if (!folder && !session) return void 0;
|
|
76103
76106
|
const asked = { ...args, flags: { ...args.flags, ...folder ? { profile: folder } : {} } };
|
|
76104
76107
|
const name2 = flagText({
|
|
@@ -76116,7 +76119,9 @@ async function deliverOnce({
|
|
|
76116
76119
|
}) {
|
|
76117
76120
|
const lock = statePathOf({ context, kind: "waiters", profile });
|
|
76118
76121
|
const mine3 = (await holderOf({ path: lock }))?.pid === context.processes.pid;
|
|
76119
|
-
if (!mine3 && !await takeLock({ context, path: lock, claudePid, preempt: true }))
|
|
76122
|
+
if (!mine3 && !await takeLock({ context, path: lock, claudePid, preempt: true })) {
|
|
76123
|
+
return "outranked";
|
|
76124
|
+
}
|
|
76120
76125
|
const named = { ...args, flags: { ...args.flags, profile } };
|
|
76121
76126
|
const { client } = await signedIn({ context, args: named });
|
|
76122
76127
|
const due = await dueFromSpool({ context, profile, seen: async () => "", pushedToo: true });
|
|
@@ -76156,23 +76161,46 @@ async function release({ context, profile }) {
|
|
|
76156
76161
|
}
|
|
76157
76162
|
async function monitorHook({ context, args }) {
|
|
76158
76163
|
const claudePid = await claudePidOf({ context });
|
|
76159
|
-
const
|
|
76160
|
-
|
|
76161
|
-
await rememberSession({ context, claudePid, session });
|
|
76164
|
+
const session = await monitorSessionOf({ context, claudePid });
|
|
76165
|
+
await rememberSession({ context, claudePid, session }).catch(() => void 0);
|
|
76162
76166
|
const held = /* @__PURE__ */ new Set();
|
|
76163
76167
|
const turn = { context, args, claudePid, session };
|
|
76164
76168
|
try {
|
|
76165
76169
|
while (claudePid && context.processes.alive(claudePid)) {
|
|
76166
|
-
const
|
|
76167
|
-
|
|
76168
|
-
if (
|
|
76169
|
-
if (!busy) await context.sleep(MONITOR_IDLE_MS);
|
|
76170
|
+
const round = await oneRound({ turn, held });
|
|
76171
|
+
if (round === "outranked") await context.sleep(MONITOR_OUTRANKED_MS);
|
|
76172
|
+
else if (!round) await context.sleep(MONITOR_IDLE_MS);
|
|
76170
76173
|
}
|
|
76171
76174
|
return 0;
|
|
76172
76175
|
} finally {
|
|
76173
|
-
for (const profile of held) await release({ context, profile });
|
|
76176
|
+
for (const profile of held) await release({ context, profile }).catch(() => void 0);
|
|
76177
|
+
}
|
|
76178
|
+
}
|
|
76179
|
+
async function oneRound({ turn, held }) {
|
|
76180
|
+
try {
|
|
76181
|
+
const profile = await agentProfileHere(turn);
|
|
76182
|
+
const round = profile ? await monitorRound({ ...turn, profile }) : false;
|
|
76183
|
+
if (profile && round === true) held.add(profile);
|
|
76184
|
+
return round;
|
|
76185
|
+
} catch (error62) {
|
|
76186
|
+
turn.context.err(`laze: the monitor will try again: ${String(error62)}
|
|
76187
|
+
`);
|
|
76188
|
+
return false;
|
|
76174
76189
|
}
|
|
76175
76190
|
}
|
|
76191
|
+
async function monitorSessionOf({
|
|
76192
|
+
context,
|
|
76193
|
+
claudePid
|
|
76194
|
+
}) {
|
|
76195
|
+
const sessionId = context.environment.inherited.CLAUDE_CODE_SESSION_ID;
|
|
76196
|
+
const fromEnv = sessionOf({ context, harness: "claude-code", sessionId });
|
|
76197
|
+
if (fromEnv || !claudePid) return fromEnv;
|
|
76198
|
+
const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
|
|
76199
|
+
return readFile16(path, "utf8").then(
|
|
76200
|
+
(text2) => JSON.parse(text2),
|
|
76201
|
+
() => void 0
|
|
76202
|
+
);
|
|
76203
|
+
}
|
|
76176
76204
|
|
|
76177
76205
|
// ../../modules/compute/contract/src/browser-tab.ts
|
|
76178
76206
|
var browserTabSharingSchema = external_exports.enum(["private", "watch", "use"]);
|
|
@@ -77655,10 +77683,10 @@ async function computer({ context, args }) {
|
|
|
77655
77683
|
}
|
|
77656
77684
|
|
|
77657
77685
|
// src/services/connect-commands.service.ts
|
|
77658
|
-
import { readFile as
|
|
77686
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
77659
77687
|
|
|
77660
77688
|
// src/services/mcp-gateway.service.ts
|
|
77661
|
-
import { readFile as
|
|
77689
|
+
import { readFile as readFile17 } from "node:fs/promises";
|
|
77662
77690
|
import { createInterface as createInterface3 } from "node:readline";
|
|
77663
77691
|
var TURN_HEADER = "x-laze-turn";
|
|
77664
77692
|
function serveMcpGateway({
|
|
@@ -77701,7 +77729,7 @@ async function relayMcpLines({
|
|
|
77701
77729
|
const github3 = env.LAZE_GITHUB_CONNECTION;
|
|
77702
77730
|
const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
|
|
77703
77731
|
const turnFile = env.LAZE_TURN_FILE;
|
|
77704
|
-
const readTurn = () =>
|
|
77732
|
+
const readTurn = () => readFile17(turnFile, "utf8").then(
|
|
77705
77733
|
(text2) => text2.trim(),
|
|
77706
77734
|
() => ""
|
|
77707
77735
|
);
|
|
@@ -77791,7 +77819,7 @@ async function turnOf({ context }) {
|
|
|
77791
77819
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
77792
77820
|
if (pinned) return pinned;
|
|
77793
77821
|
const file3 = env.LAZE_TURN_FILE;
|
|
77794
|
-
const turn = file3 ? await
|
|
77822
|
+
const turn = file3 ? await readFile18(file3, "utf8").then(
|
|
77795
77823
|
(text2) => text2.trim(),
|
|
77796
77824
|
() => ""
|
|
77797
77825
|
) : "";
|
|
@@ -77849,11 +77877,11 @@ async function connect({
|
|
|
77849
77877
|
}
|
|
77850
77878
|
|
|
77851
77879
|
// src/services/connector-commands.service.ts
|
|
77852
|
-
import { readFile as
|
|
77880
|
+
import { readFile as readFile20 } from "node:fs/promises";
|
|
77853
77881
|
import { resolve as resolve8 } from "node:path";
|
|
77854
77882
|
|
|
77855
77883
|
// src/services/vault-keychain-commands.service.ts
|
|
77856
|
-
import { readFile as
|
|
77884
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
77857
77885
|
|
|
77858
77886
|
// src/rules/vault-input.rules.ts
|
|
77859
77887
|
function secondsOf(text2) {
|
|
@@ -78164,7 +78192,7 @@ async function secretText({ context, args }) {
|
|
|
78164
78192
|
);
|
|
78165
78193
|
}
|
|
78166
78194
|
const file3 = flagText({ args, name: "from-file" });
|
|
78167
|
-
const text2 = file3 ? await
|
|
78195
|
+
const text2 = file3 ? await readFile19(file3, "utf8") : await context.readStdin();
|
|
78168
78196
|
const trimmed = text2.replace(/\r?\n$/, "");
|
|
78169
78197
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
78170
78198
|
return trimmed;
|
|
@@ -78362,7 +78390,7 @@ async function keyText({ context, args }) {
|
|
|
78362
78390
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
78363
78391
|
}
|
|
78364
78392
|
const file3 = flagText({ args, name: "from-file" });
|
|
78365
|
-
const text2 = file3 ? await
|
|
78393
|
+
const text2 = file3 ? await readFile20(resolve8(context.cwd, file3), "utf8") : await context.readStdin();
|
|
78366
78394
|
const trimmed = text2.trim();
|
|
78367
78395
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
78368
78396
|
return trimmed;
|
|
@@ -78781,7 +78809,7 @@ async function domains({ context, args }) {
|
|
|
78781
78809
|
}
|
|
78782
78810
|
|
|
78783
78811
|
// src/services/feed-commands.service.ts
|
|
78784
|
-
import { readFile as
|
|
78812
|
+
import { readFile as readFile22 } from "node:fs/promises";
|
|
78785
78813
|
import { resolve as resolve10 } from "node:path";
|
|
78786
78814
|
|
|
78787
78815
|
// src/rules/feed-input.rules.ts
|
|
@@ -78906,7 +78934,7 @@ function feedFlagsOf({ args }) {
|
|
|
78906
78934
|
}
|
|
78907
78935
|
|
|
78908
78936
|
// src/services/feed-files.service.ts
|
|
78909
|
-
import { readFile as
|
|
78937
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
78910
78938
|
import { basename as basename3, resolve as resolve9 } from "node:path";
|
|
78911
78939
|
|
|
78912
78940
|
// ../../modules/feed/contract/src/feed.ts
|
|
@@ -79499,7 +79527,7 @@ async function local({ context, path }) {
|
|
|
79499
79527
|
return {
|
|
79500
79528
|
fileName,
|
|
79501
79529
|
contentType: contentTypeOf(fileName),
|
|
79502
|
-
bytes: new Uint8Array(await
|
|
79530
|
+
bytes: new Uint8Array(await readFile21(full))
|
|
79503
79531
|
};
|
|
79504
79532
|
}
|
|
79505
79533
|
async function directWith({ client, to }) {
|
|
@@ -79577,7 +79605,7 @@ async function bodyOf2({
|
|
|
79577
79605
|
flags: flags2
|
|
79578
79606
|
}) {
|
|
79579
79607
|
const body = { ...flags2.fields };
|
|
79580
|
-
const read3 = (source) => "file" in source ?
|
|
79608
|
+
const read3 = (source) => "file" in source ? readFile22(resolve10(context.cwd, source.file), "utf8") : source.text;
|
|
79581
79609
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read3(source);
|
|
79582
79610
|
if (flags2.rich) {
|
|
79583
79611
|
const text2 = await read3(flags2.rich.source);
|
|
@@ -79739,7 +79767,7 @@ async function textFlag({
|
|
|
79739
79767
|
}) {
|
|
79740
79768
|
const value = flagText({ args, name: name2 });
|
|
79741
79769
|
if (!value.startsWith("@")) return value;
|
|
79742
|
-
return
|
|
79770
|
+
return readFile22(resolve10(context.cwd, value.slice(1)), "utf8");
|
|
79743
79771
|
}
|
|
79744
79772
|
async function feedList({ context, args }) {
|
|
79745
79773
|
const { client } = await signedIn({ context, args });
|
|
@@ -79849,7 +79877,7 @@ async function feed({ context, args }) {
|
|
|
79849
79877
|
}
|
|
79850
79878
|
|
|
79851
79879
|
// src/services/github-commands.service.ts
|
|
79852
|
-
import { readFile as
|
|
79880
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
79853
79881
|
|
|
79854
79882
|
// src/rules/github-signature.rules.ts
|
|
79855
79883
|
var TURN_SEPARATOR = "~";
|
|
@@ -79919,7 +79947,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
79919
79947
|
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
79948
|
async function turnFileToken({ env }) {
|
|
79921
79949
|
if (!env.LAZE_TURN_FILE) return "";
|
|
79922
|
-
return
|
|
79950
|
+
return readFile23(env.LAZE_TURN_FILE, "utf8").then(
|
|
79923
79951
|
(text2) => text2.trim(),
|
|
79924
79952
|
() => ""
|
|
79925
79953
|
);
|
|
@@ -79953,7 +79981,7 @@ async function githubGh({
|
|
|
79953
79981
|
args: args.rest,
|
|
79954
79982
|
agentName: profile.name ?? "An agent",
|
|
79955
79983
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
79956
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
79984
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile23(path, "utf8")
|
|
79957
79985
|
});
|
|
79958
79986
|
return context.runCommand({
|
|
79959
79987
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -80052,7 +80080,7 @@ async function setAgentGithub({
|
|
|
80052
80080
|
}
|
|
80053
80081
|
|
|
80054
80082
|
// src/services/history-commands.service.ts
|
|
80055
|
-
import { readFile as
|
|
80083
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
80056
80084
|
|
|
80057
80085
|
// src/rules/history-format.rules.ts
|
|
80058
80086
|
function timeOf2(iso) {
|
|
@@ -80148,7 +80176,7 @@ async function turnTokenOf3({ context }) {
|
|
|
80148
80176
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
80149
80177
|
if (pinned) return pinned;
|
|
80150
80178
|
if (!env.LAZE_TURN_FILE) return "";
|
|
80151
|
-
return
|
|
80179
|
+
return readFile24(env.LAZE_TURN_FILE, "utf8").then(
|
|
80152
80180
|
(text2) => text2.trim(),
|
|
80153
80181
|
() => ""
|
|
80154
80182
|
);
|
|
@@ -80340,7 +80368,7 @@ async function ip({ context, args }) {
|
|
|
80340
80368
|
}
|
|
80341
80369
|
|
|
80342
80370
|
// src/services/join-commands.service.ts
|
|
80343
|
-
import { mkdir as mkdir16, readFile as
|
|
80371
|
+
import { mkdir as mkdir16, readFile as readFile25, rename as rename5, rm as rm10, writeFile as writeFile17 } from "node:fs/promises";
|
|
80344
80372
|
import { dirname as dirname15, join as join16 } from "node:path";
|
|
80345
80373
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
80346
80374
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
@@ -80352,7 +80380,7 @@ async function readPending({
|
|
|
80352
80380
|
url: url2,
|
|
80353
80381
|
args
|
|
80354
80382
|
}) {
|
|
80355
|
-
const pending = await
|
|
80383
|
+
const pending = await readFile25(pendingPathOf({ context }), "utf8").then(
|
|
80356
80384
|
(text2) => JSON.parse(text2),
|
|
80357
80385
|
() => void 0
|
|
80358
80386
|
);
|
|
@@ -80682,7 +80710,7 @@ function machineAccessCommand(name2) {
|
|
|
80682
80710
|
|
|
80683
80711
|
// src/services/vault-commands.service.ts
|
|
80684
80712
|
import { createHash as createHash2 } from "node:crypto";
|
|
80685
|
-
import { mkdir as mkdir17, readFile as
|
|
80713
|
+
import { mkdir as mkdir17, readFile as readFile26, rm as rm11, writeFile as writeFile18 } from "node:fs/promises";
|
|
80686
80714
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
80687
80715
|
import { dirname as dirname16, join as join17 } from "node:path";
|
|
80688
80716
|
var USAGE10 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
|
|
@@ -80723,7 +80751,7 @@ async function turnTokenOf4({
|
|
|
80723
80751
|
if (pinned) return pinned;
|
|
80724
80752
|
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
80725
80753
|
try {
|
|
80726
|
-
return (await
|
|
80754
|
+
return (await readFile26(turnFile, "utf8")).trim();
|
|
80727
80755
|
} catch {
|
|
80728
80756
|
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
80729
80757
|
}
|
|
@@ -80737,7 +80765,7 @@ function runKeyPathOf({
|
|
|
80737
80765
|
return join17(base, "vault-run-keys", `${name2}.json`);
|
|
80738
80766
|
}
|
|
80739
80767
|
async function runKeyAt({ path }) {
|
|
80740
|
-
const saved3 = await
|
|
80768
|
+
const saved3 = await readFile26(path, "utf8").then(
|
|
80741
80769
|
(text2) => JSON.parse(text2),
|
|
80742
80770
|
() => void 0
|
|
80743
80771
|
);
|
|
@@ -81419,14 +81447,14 @@ async function serveMcp({
|
|
|
81419
81447
|
}
|
|
81420
81448
|
|
|
81421
81449
|
// src/services/mount-files.service.ts
|
|
81422
|
-
import { mkdir as mkdir18, readFile as
|
|
81450
|
+
import { mkdir as mkdir18, readFile as readFile27, rm as rm12, writeFile as writeFile19 } from "node:fs/promises";
|
|
81423
81451
|
import { dirname as dirname17, relative as relative5, resolve as resolve11 } from "node:path";
|
|
81424
81452
|
async function textArgument({
|
|
81425
81453
|
context,
|
|
81426
81454
|
value
|
|
81427
81455
|
}) {
|
|
81428
81456
|
if (value === "-") return context.readStdin();
|
|
81429
|
-
if (value.startsWith("@")) return
|
|
81457
|
+
if (value.startsWith("@")) return readFile27(resolve11(context.cwd, value.slice(1)), "utf8");
|
|
81430
81458
|
return value;
|
|
81431
81459
|
}
|
|
81432
81460
|
function turnChannel({ context, args }) {
|
|
@@ -82324,7 +82352,7 @@ async function schedule({ context, args }) {
|
|
|
82324
82352
|
}
|
|
82325
82353
|
|
|
82326
82354
|
// src/services/skill-commands.service.ts
|
|
82327
|
-
import { readdir as readdir6, readFile as
|
|
82355
|
+
import { readdir as readdir6, readFile as readFile28 } from "node:fs/promises";
|
|
82328
82356
|
import { join as join18, relative as relative6, resolve as resolve12 } from "node:path";
|
|
82329
82357
|
var USAGE16 = `Usage:
|
|
82330
82358
|
laze skill list [--agent <agentId>]
|
|
@@ -82347,7 +82375,7 @@ async function folderFiles({ root }) {
|
|
|
82347
82375
|
for (const entry of entries) {
|
|
82348
82376
|
if (!entry.isFile()) continue;
|
|
82349
82377
|
const full = join18(entry.parentPath, entry.name);
|
|
82350
|
-
files2.push({ path: relative6(root, full), content: await
|
|
82378
|
+
files2.push({ path: relative6(root, full), content: await readFile28(full, "utf8") });
|
|
82351
82379
|
}
|
|
82352
82380
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
82353
82381
|
}
|
|
@@ -82445,7 +82473,7 @@ async function skillUpdate({ context, args }) {
|
|
|
82445
82473
|
if (!name2 || !newName && description === void 0 && !skillMdFile) {
|
|
82446
82474
|
throw new CliUsageError(USAGE16);
|
|
82447
82475
|
}
|
|
82448
|
-
const skillMd = skillMdFile ? await
|
|
82476
|
+
const skillMd = skillMdFile ? await readFile28(resolve12(context.cwd, skillMdFile), "utf8") : void 0;
|
|
82449
82477
|
const { client } = await signedIn({ context, args });
|
|
82450
82478
|
const updated = await client.post("/api/skills/update", {
|
|
82451
82479
|
name: name2,
|
|
@@ -82491,7 +82519,7 @@ async function skill({ context, args }) {
|
|
|
82491
82519
|
}
|
|
82492
82520
|
|
|
82493
82521
|
// src/services/slack-commands.service.ts
|
|
82494
|
-
import { readFile as
|
|
82522
|
+
import { readFile as readFile29 } from "node:fs/promises";
|
|
82495
82523
|
import { resolve as resolve13 } from "node:path";
|
|
82496
82524
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
82497
82525
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -82539,7 +82567,7 @@ async function secretLines({ context, args }) {
|
|
|
82539
82567
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
82540
82568
|
}
|
|
82541
82569
|
const file3 = flagText({ args, name: "from-file" });
|
|
82542
|
-
const text2 = file3 ? await
|
|
82570
|
+
const text2 = file3 ? await readFile29(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
|
|
82543
82571
|
return text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
82544
82572
|
}
|
|
82545
82573
|
async function secretsOf({
|
|
@@ -82843,7 +82871,7 @@ async function slack({
|
|
|
82843
82871
|
}
|
|
82844
82872
|
|
|
82845
82873
|
// src/services/sso-commands.service.ts
|
|
82846
|
-
import { readFile as
|
|
82874
|
+
import { readFile as readFile30 } from "node:fs/promises";
|
|
82847
82875
|
var SSO_USAGE = `Usage:
|
|
82848
82876
|
laze sso domains claimed domains and how each signs in (admins)
|
|
82849
82877
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -82930,7 +82958,7 @@ function refuseSecretFlags({ args }) {
|
|
|
82930
82958
|
}
|
|
82931
82959
|
async function clientSecretOf({ context, args }) {
|
|
82932
82960
|
const file3 = flagText({ args, name: "from-file" });
|
|
82933
|
-
const text2 = file3 ? await
|
|
82961
|
+
const text2 = file3 ? await readFile30(file3, "utf8") : await context.readStdin();
|
|
82934
82962
|
const secret = text2.trim();
|
|
82935
82963
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
82936
82964
|
return secret;
|
|
@@ -83263,7 +83291,7 @@ async function vaultScrub({ context, args }) {
|
|
|
83263
83291
|
}
|
|
83264
83292
|
|
|
83265
83293
|
// src/services/whatsapp-business-commands.service.ts
|
|
83266
|
-
import { readFile as
|
|
83294
|
+
import { readFile as readFile31 } from "node:fs/promises";
|
|
83267
83295
|
import { resolve as resolve14 } from "node:path";
|
|
83268
83296
|
|
|
83269
83297
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -83683,7 +83711,7 @@ async function secretsOf2({ context, args }) {
|
|
|
83683
83711
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
83684
83712
|
if (fromConnection) return { fromConnection };
|
|
83685
83713
|
const file3 = flagText({ args, name: "from-file" });
|
|
83686
|
-
const text2 = file3 ? await
|
|
83714
|
+
const text2 = file3 ? await readFile31(resolve14(context.cwd, file3), "utf8") : await context.readStdin();
|
|
83687
83715
|
const lines = text2.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
83688
83716
|
if (lines.length !== 2) {
|
|
83689
83717
|
throw new CliUsageError(
|
|
@@ -84264,7 +84292,7 @@ async function flags({ context, args }) {
|
|
|
84264
84292
|
}
|
|
84265
84293
|
|
|
84266
84294
|
// src/services/workspace-commands.service.ts
|
|
84267
|
-
import { readFile as
|
|
84295
|
+
import { readFile as readFile32 } from "node:fs/promises";
|
|
84268
84296
|
import { resolve as resolve16 } from "node:path";
|
|
84269
84297
|
var ROLE_NAMES2 = {
|
|
84270
84298
|
OWNER: "Owner",
|
|
@@ -84447,7 +84475,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
84447
84475
|
async function readLogo({ context, file: file3 }) {
|
|
84448
84476
|
let bytes;
|
|
84449
84477
|
try {
|
|
84450
|
-
bytes = new Uint8Array(await
|
|
84478
|
+
bytes = new Uint8Array(await readFile32(resolve16(context.cwd, file3)));
|
|
84451
84479
|
} catch {
|
|
84452
84480
|
throw new CliUsageError(`No file to read at ${file3}.`);
|
|
84453
84481
|
}
|
|
@@ -85108,7 +85136,7 @@ async function runCli({
|
|
|
85108
85136
|
// src/services/processes.service.ts
|
|
85109
85137
|
import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
|
|
85110
85138
|
import { mkdirSync, openSync } from "node:fs";
|
|
85111
|
-
import { readFile as
|
|
85139
|
+
import { readFile as readFile33, readlink } from "node:fs/promises";
|
|
85112
85140
|
import { dirname as dirname18 } from "node:path";
|
|
85113
85141
|
import { promisify as promisify2 } from "node:util";
|
|
85114
85142
|
var run3 = promisify2(execFile2);
|
|
@@ -85122,14 +85150,14 @@ function alive(pid) {
|
|
|
85122
85150
|
}
|
|
85123
85151
|
}
|
|
85124
85152
|
async function argsOf(pid) {
|
|
85125
|
-
const raw = await
|
|
85153
|
+
const raw = await readFile33(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
85126
85154
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
85127
85155
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
85128
85156
|
const line = listed?.stdout.trim();
|
|
85129
85157
|
return line ? line.split(/\s+/) : void 0;
|
|
85130
85158
|
}
|
|
85131
85159
|
async function parentOf(pid) {
|
|
85132
|
-
const stat3 = await
|
|
85160
|
+
const stat3 = await readFile33(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
85133
85161
|
const fromStat = stat3 ? Number(stat3.slice(stat3.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
85134
85162
|
if (fromStat > 0) return fromStat;
|
|
85135
85163
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
package/package.json
CHANGED