@lazehq/cli 0.1.95 → 0.1.97
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 +975 -525
- package/package.json +1 -1
package/dist/laze.mjs
CHANGED
|
@@ -19486,8 +19486,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
19486
19486
|
var require_snapshot_recorder = __commonJS({
|
|
19487
19487
|
"../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
19488
19488
|
"use strict";
|
|
19489
|
-
var { writeFile: writeFile12, readFile:
|
|
19490
|
-
var { dirname:
|
|
19489
|
+
var { writeFile: writeFile12, readFile: readFile39, mkdir: mkdir13 } = __require("node:fs/promises");
|
|
19490
|
+
var { dirname: dirname27, resolve: resolve26 } = __require("node:path");
|
|
19491
19491
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
19492
19492
|
var { InvalidArgumentError, UndiciError } = require_errors();
|
|
19493
19493
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -19703,7 +19703,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19703
19703
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19704
19704
|
}
|
|
19705
19705
|
try {
|
|
19706
|
-
const data = await
|
|
19706
|
+
const data = await readFile39(resolve26(path), "utf8");
|
|
19707
19707
|
const parsed = JSON.parse(data);
|
|
19708
19708
|
if (Array.isArray(parsed)) {
|
|
19709
19709
|
this.#snapshots.clear();
|
|
@@ -19733,7 +19733,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
19733
19733
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
19734
19734
|
}
|
|
19735
19735
|
const resolvedPath = resolve26(path);
|
|
19736
|
-
await mkdir13(
|
|
19736
|
+
await mkdir13(dirname27(resolvedPath), { recursive: true });
|
|
19737
19737
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
19738
19738
|
hash: hash2,
|
|
19739
19739
|
snapshot
|
|
@@ -24573,10 +24573,10 @@ var require_headers = __commonJS({
|
|
|
24573
24573
|
const lowercaseName = isLowerCase ? name3 : name3.toLowerCase();
|
|
24574
24574
|
const exists = this.headersMap.get(lowercaseName);
|
|
24575
24575
|
if (exists) {
|
|
24576
|
-
const
|
|
24576
|
+
const delimiter2 = lowercaseName === "cookie" ? "; " : ", ";
|
|
24577
24577
|
this.headersMap.set(lowercaseName, {
|
|
24578
24578
|
name: exists.name,
|
|
24579
|
-
value: `${exists.value}${
|
|
24579
|
+
value: `${exists.value}${delimiter2}${value}`
|
|
24580
24580
|
});
|
|
24581
24581
|
} else {
|
|
24582
24582
|
this.headersMap.set(lowercaseName, { name: name3, value });
|
|
@@ -31632,6 +31632,7 @@ ${captureLines}` : capture.stack;
|
|
|
31632
31632
|
});
|
|
31633
31633
|
|
|
31634
31634
|
// src/main.ts
|
|
31635
|
+
import { homedir as homedir5 } from "node:os";
|
|
31635
31636
|
import { stderr, stdin, stdout } from "node:process";
|
|
31636
31637
|
import { createInterface as createInterface5 } from "node:readline/promises";
|
|
31637
31638
|
|
|
@@ -36779,9 +36780,284 @@ function cliEnvironment({
|
|
|
36779
36780
|
};
|
|
36780
36781
|
}
|
|
36781
36782
|
|
|
36783
|
+
// src/services/cli-installs.service.ts
|
|
36784
|
+
import { readdir, readFile, realpath } from "node:fs/promises";
|
|
36785
|
+
import { delimiter, dirname, join as join2 } from "node:path";
|
|
36786
|
+
|
|
36787
|
+
// src/rules/cli-invocation.rules.ts
|
|
36788
|
+
var NPX_CACHE = /[\\/]_npx[\\/]/;
|
|
36789
|
+
var SANDBOX_CLI_PATH = "/opt/laze/cli/laze.mjs";
|
|
36790
|
+
function lazeCommandOf({ program }) {
|
|
36791
|
+
const script = program.at(-1) ?? "";
|
|
36792
|
+
if (!NPX_CACHE.test(script)) return "laze";
|
|
36793
|
+
return /^[\w./@+-]+$/.test(script) ? script : `'${script.replaceAll("'", "'\\''")}'`;
|
|
36794
|
+
}
|
|
36795
|
+
|
|
36796
|
+
// src/rules/cli-update.rules.ts
|
|
36797
|
+
var CLI_PACKAGE = "@lazehq/cli";
|
|
36798
|
+
var CLI_PACKAGE_LATEST = `${CLI_PACKAGE}@latest`;
|
|
36799
|
+
var MANAGERS = [
|
|
36800
|
+
{ manager: "bun", pattern: /[\\/]\.?bun[\\/]/, command: ["bun", "add", "-g"] },
|
|
36801
|
+
{ manager: "pnpm", pattern: /[\\/]\.?pnpm[\\/]/, command: ["pnpm", "add", "-g"] },
|
|
36802
|
+
{ manager: "yarn", pattern: /[\\/]yarn[\\/]global[\\/]/, command: ["yarn", "global", "add"] },
|
|
36803
|
+
{
|
|
36804
|
+
manager: "npm",
|
|
36805
|
+
pattern: /[\\/]_npx[\\/]|[\\/]node_modules[\\/]@lazehq[\\/]cli[\\/]/,
|
|
36806
|
+
command: ["npm", "install", "-g"]
|
|
36807
|
+
}
|
|
36808
|
+
];
|
|
36809
|
+
var NPM_PREFIX = /^(.+)[\\/]lib[\\/]node_modules[\\/]@lazehq[\\/]cli[\\/]/;
|
|
36810
|
+
var NPX_CACHE2 = /[\\/]_npx[\\/]/;
|
|
36811
|
+
function releaseAgeOverrideOf({ manager }) {
|
|
36812
|
+
if (manager === "npm") return ["--prefer-online", "--min-release-age=0"];
|
|
36813
|
+
if (manager === "pnpm") return [`--config.minimum-release-age-exclude=${CLI_PACKAGE}`];
|
|
36814
|
+
if (manager === "bun") return ["--minimum-release-age=0"];
|
|
36815
|
+
return [];
|
|
36816
|
+
}
|
|
36817
|
+
function updatePlanOf({ script }) {
|
|
36818
|
+
if (script === SANDBOX_CLI_PATH) return { kind: "sandbox" };
|
|
36819
|
+
const found = MANAGERS.find(({ pattern }) => pattern.test(script));
|
|
36820
|
+
if (!found) return { kind: "unmanaged", script };
|
|
36821
|
+
const prefix = found.manager === "npm" && !NPX_CACHE2.test(script) ? NPM_PREFIX.exec(script)?.[1] : void 0;
|
|
36822
|
+
return {
|
|
36823
|
+
kind: "install",
|
|
36824
|
+
manager: found.manager,
|
|
36825
|
+
command: [
|
|
36826
|
+
...found.command,
|
|
36827
|
+
...prefix ? ["--prefix", prefix] : [],
|
|
36828
|
+
...releaseAgeOverrideOf({ manager: found.manager }),
|
|
36829
|
+
CLI_PACKAGE_LATEST
|
|
36830
|
+
]
|
|
36831
|
+
};
|
|
36832
|
+
}
|
|
36833
|
+
function pinnedCommandOf({
|
|
36834
|
+
plan: plan2,
|
|
36835
|
+
version: version2
|
|
36836
|
+
}) {
|
|
36837
|
+
return plan2.command.map(
|
|
36838
|
+
(part) => part === CLI_PACKAGE_LATEST ? `${CLI_PACKAGE}@${version2}` : part
|
|
36839
|
+
);
|
|
36840
|
+
}
|
|
36841
|
+
var RELEASE_AGE_SETTINGS = {
|
|
36842
|
+
npm: [
|
|
36843
|
+
{ setting: "min-release-age", read: ["npm", "config", "get", "min-release-age"] },
|
|
36844
|
+
{ setting: "before", read: ["npm", "config", "get", "before"] }
|
|
36845
|
+
],
|
|
36846
|
+
pnpm: [
|
|
36847
|
+
{ setting: "minimum-release-age", read: ["pnpm", "config", "get", "minimum-release-age"] }
|
|
36848
|
+
]
|
|
36849
|
+
};
|
|
36850
|
+
function settingValueOf({ printed: printed2 }) {
|
|
36851
|
+
const value = printed2.trim();
|
|
36852
|
+
return value === "" || value === "null" || value === "undefined" || value === "0" ? null : value;
|
|
36853
|
+
}
|
|
36854
|
+
var VERSION_LINE = /^laze (\S+)\s*$/m;
|
|
36855
|
+
function printedVersionOf({ printed: printed2 }) {
|
|
36856
|
+
return VERSION_LINE.exec(printed2)?.[1] ?? null;
|
|
36857
|
+
}
|
|
36858
|
+
function heldBackLineOf({
|
|
36859
|
+
manager,
|
|
36860
|
+
installed,
|
|
36861
|
+
latest,
|
|
36862
|
+
settings: settings3,
|
|
36863
|
+
command,
|
|
36864
|
+
script
|
|
36865
|
+
}) {
|
|
36866
|
+
const head = latest ? `laze is ${installed} after the install, but the latest release is ${latest}.` : `laze is still ${installed} after the install, and the npm registry did not say which release is the latest.`;
|
|
36867
|
+
const line = command.join(" ");
|
|
36868
|
+
if (settings3.length > 0) {
|
|
36869
|
+
return `${head} ${manager}'s ${settings3.join(" and ")} setting holds back releases younger than it allows, so ${manager} kept or picked an older one. Install the latest with: ${line}
|
|
36870
|
+
`;
|
|
36871
|
+
}
|
|
36872
|
+
if (manager === "bun") {
|
|
36873
|
+
return `${head} A minimumReleaseAge in bunfig.toml may hold it back, or another laze comes first on PATH (this one is ${script}). Install the latest with: ${line}
|
|
36874
|
+
`;
|
|
36875
|
+
}
|
|
36876
|
+
return `${head} No release-age setting is set, so another laze may come first on PATH (this one is ${script}). Install the latest with: ${line}
|
|
36877
|
+
`;
|
|
36878
|
+
}
|
|
36879
|
+
|
|
36880
|
+
// src/rules/cli-release.rules.ts
|
|
36881
|
+
var CLI_RELEASE_HEADER = "x-laze-cli-release";
|
|
36882
|
+
var STAMP = /^(\d+)\.(\d+)\.(\d+)(?:-g([0-9a-f]+))?$/;
|
|
36883
|
+
function releaseSkewOf({
|
|
36884
|
+
mine: mine4,
|
|
36885
|
+
server
|
|
36886
|
+
}) {
|
|
36887
|
+
const have = STAMP.exec(mine4);
|
|
36888
|
+
const ships = STAMP.exec(server);
|
|
36889
|
+
if (!have || !ships) return null;
|
|
36890
|
+
for (const part of [1, 2, 3]) {
|
|
36891
|
+
const difference = Number(have[part]) - Number(ships[part]);
|
|
36892
|
+
if (difference !== 0) return difference < 0 ? "older" : "newer";
|
|
36893
|
+
}
|
|
36894
|
+
return have[4] && ships[4] && have[4] !== ships[4] ? "other_build" : null;
|
|
36895
|
+
}
|
|
36896
|
+
function releaseWarningOf({
|
|
36897
|
+
mine: mine4,
|
|
36898
|
+
server,
|
|
36899
|
+
sandbox
|
|
36900
|
+
}) {
|
|
36901
|
+
const skew = releaseSkewOf({ mine: mine4, server });
|
|
36902
|
+
if (!skew || skew === "other_build") return null;
|
|
36903
|
+
if (sandbox) {
|
|
36904
|
+
return `laze: this CLI is ${mine4}, but the server ships ${server}. Laze updates the computer's CLI each time the agent connects, so restart the agent if this stays.
|
|
36905
|
+
`;
|
|
36906
|
+
}
|
|
36907
|
+
if (skew === "newer") {
|
|
36908
|
+
return `laze: this CLI is ${mine4}, newer than the server's ${server}; a command the server does not have yet fails.
|
|
36909
|
+
`;
|
|
36910
|
+
}
|
|
36911
|
+
return `laze: this CLI is ${mine4}, older than the server's ${server}. Update it with npm i -g ${CLI_PACKAGE_LATEST} (or laze update).
|
|
36912
|
+
`;
|
|
36913
|
+
}
|
|
36914
|
+
function selfUpdateLineOf({
|
|
36915
|
+
mine: mine4,
|
|
36916
|
+
server,
|
|
36917
|
+
manager
|
|
36918
|
+
}) {
|
|
36919
|
+
return `laze: this CLI is ${mine4}, older than the server's ${server}. Updating it in the background with ${manager}; the next command runs the new one (LAZE_AUTO_UPDATE=0 turns this off).
|
|
36920
|
+
`;
|
|
36921
|
+
}
|
|
36922
|
+
|
|
36923
|
+
// src/rules/cli-installs.rules.ts
|
|
36924
|
+
function newerInstallsOf({
|
|
36925
|
+
mine: mine4,
|
|
36926
|
+
installs
|
|
36927
|
+
}) {
|
|
36928
|
+
return installs.filter(
|
|
36929
|
+
(install) => install.version !== null && releaseSkewOf({ mine: mine4, server: install.version }) === "older"
|
|
36930
|
+
);
|
|
36931
|
+
}
|
|
36932
|
+
function newerInstallLineOf({
|
|
36933
|
+
mine: mine4,
|
|
36934
|
+
script,
|
|
36935
|
+
installs
|
|
36936
|
+
}) {
|
|
36937
|
+
const newer = newerInstallsOf({ mine: mine4, installs });
|
|
36938
|
+
const [first] = newer;
|
|
36939
|
+
if (!first) return null;
|
|
36940
|
+
const others = newer.map((install) => `laze ${install.version} at ${install.path}`).join(", ");
|
|
36941
|
+
return `laze: this is laze ${mine4} at ${script}, but a newer ${others} is installed. A shell runs the first laze on PATH: run ${first.path} by its path, or remove the older one.
|
|
36942
|
+
`;
|
|
36943
|
+
}
|
|
36944
|
+
function shadowedLineOf({
|
|
36945
|
+
updated,
|
|
36946
|
+
script,
|
|
36947
|
+
onPath
|
|
36948
|
+
}) {
|
|
36949
|
+
if (!onPath || onPath.script === script) return null;
|
|
36950
|
+
const version2 = onPath.version ? ` (${onPath.version})` : "";
|
|
36951
|
+
return `laze on PATH is ${onPath.path}${version2}, not the laze ${updated} just updated at ${script}. Remove ${onPath.path}, or put the updated one's folder first on PATH.
|
|
36952
|
+
`;
|
|
36953
|
+
}
|
|
36954
|
+
function shadowedLinkLineOf({ shadow }) {
|
|
36955
|
+
if (!shadow) return [];
|
|
36956
|
+
const version2 = shadow.version ? ` (${shadow.version})` : "";
|
|
36957
|
+
return [
|
|
36958
|
+
`laze on PATH is ${shadow.path}${version2}, another install, so the commands below run this one by its path.`
|
|
36959
|
+
];
|
|
36960
|
+
}
|
|
36961
|
+
|
|
36962
|
+
// src/rules/cli-version.rules.ts
|
|
36963
|
+
var STAMPED = "0.1.97";
|
|
36964
|
+
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
36965
|
+
return stamped.startsWith("__") ? "dev" : stamped;
|
|
36966
|
+
}
|
|
36967
|
+
|
|
36968
|
+
// src/services/cli-installs.service.ts
|
|
36969
|
+
var SYSTEM_FOLDERS = ["/opt/homebrew/bin", "/usr/local/bin", "/usr/bin"];
|
|
36970
|
+
async function wellKnownFoldersOf({
|
|
36971
|
+
env,
|
|
36972
|
+
home,
|
|
36973
|
+
systemFolders
|
|
36974
|
+
}) {
|
|
36975
|
+
const nvm = join2(env.NVM_DIR || join2(home, ".nvm"), "versions", "node");
|
|
36976
|
+
const nodes = await readdir(nvm).catch(() => []);
|
|
36977
|
+
return [
|
|
36978
|
+
...env.NPM_CONFIG_PREFIX ? [join2(env.NPM_CONFIG_PREFIX, "bin")] : [],
|
|
36979
|
+
join2(home, ".npm-global", "bin"),
|
|
36980
|
+
join2(home, ".local", "share", "npm-global", "bin"),
|
|
36981
|
+
join2(home, ".local", "bin"),
|
|
36982
|
+
join2(home, ".bun", "bin"),
|
|
36983
|
+
...env.PNPM_HOME ? [env.PNPM_HOME] : [],
|
|
36984
|
+
join2(home, "Library", "pnpm"),
|
|
36985
|
+
join2(home, ".local", "share", "pnpm"),
|
|
36986
|
+
join2(home, ".volta", "bin"),
|
|
36987
|
+
...nodes.map((node2) => join2(nvm, node2, "bin")),
|
|
36988
|
+
...systemFolders
|
|
36989
|
+
];
|
|
36990
|
+
}
|
|
36991
|
+
async function versionBeside({ script }) {
|
|
36992
|
+
try {
|
|
36993
|
+
const text3 = await readFile(join2(dirname(script), "..", "package.json"), "utf8");
|
|
36994
|
+
const found = JSON.parse(text3);
|
|
36995
|
+
return found.name === CLI_PACKAGE && typeof found.version === "string" ? found.version : null;
|
|
36996
|
+
} catch {
|
|
36997
|
+
return null;
|
|
36998
|
+
}
|
|
36999
|
+
}
|
|
37000
|
+
async function installAt({ folder }) {
|
|
37001
|
+
const path = join2(folder, "laze");
|
|
37002
|
+
const script = await realpath(path).catch(() => void 0);
|
|
37003
|
+
if (!script) return void 0;
|
|
37004
|
+
return { path, script, version: await versionBeside({ script }) };
|
|
37005
|
+
}
|
|
37006
|
+
async function scanLazeInstalls({
|
|
37007
|
+
env,
|
|
37008
|
+
home,
|
|
37009
|
+
systemFolders = SYSTEM_FOLDERS
|
|
37010
|
+
}) {
|
|
37011
|
+
const onPathFolders = (env.PATH ?? "").split(delimiter).filter(Boolean);
|
|
37012
|
+
const folders = [...onPathFolders, ...await wellKnownFoldersOf({ env, home, systemFolders })];
|
|
37013
|
+
const seen = /* @__PURE__ */ new Set();
|
|
37014
|
+
const installs = [];
|
|
37015
|
+
let onPath;
|
|
37016
|
+
for (const [index, folder] of folders.entries()) {
|
|
37017
|
+
const install = await installAt({ folder });
|
|
37018
|
+
if (!install) continue;
|
|
37019
|
+
if (!onPath && index < onPathFolders.length) onPath = install;
|
|
37020
|
+
if (seen.has(install.script)) continue;
|
|
37021
|
+
seen.add(install.script);
|
|
37022
|
+
installs.push(install);
|
|
37023
|
+
}
|
|
37024
|
+
return { installs, onPath };
|
|
37025
|
+
}
|
|
37026
|
+
async function runningScriptOf({ context }) {
|
|
37027
|
+
const script = context.program.at(-1) ?? "";
|
|
37028
|
+
return realpath(script).catch(() => script);
|
|
37029
|
+
}
|
|
37030
|
+
async function otherInstallsOf({ context }) {
|
|
37031
|
+
const script = await runningScriptOf({ context });
|
|
37032
|
+
if (!context.lazeInstalls || script === SANDBOX_CLI_PATH) {
|
|
37033
|
+
return { script, others: [], onPath: void 0 };
|
|
37034
|
+
}
|
|
37035
|
+
const { installs, onPath } = await context.lazeInstalls();
|
|
37036
|
+
return { script, others: installs.filter((install) => install.script !== script), onPath };
|
|
37037
|
+
}
|
|
37038
|
+
async function noteNewerInstall({
|
|
37039
|
+
context,
|
|
37040
|
+
mine: mine4 = cliVersionOf()
|
|
37041
|
+
}) {
|
|
37042
|
+
const { script, others } = await otherInstallsOf({ context });
|
|
37043
|
+
const line = newerInstallLineOf({ mine: mine4, script, installs: others });
|
|
37044
|
+
if (line) context.err(line);
|
|
37045
|
+
}
|
|
37046
|
+
async function rerunCommandOf({
|
|
37047
|
+
context
|
|
37048
|
+
}) {
|
|
37049
|
+
const command = lazeCommandOf({ program: context.program });
|
|
37050
|
+
if (command !== "laze") return { command, shadow: void 0 };
|
|
37051
|
+
const { script, onPath } = await otherInstallsOf({ context });
|
|
37052
|
+
if (!onPath || onPath.script === script) return { command, shadow: void 0 };
|
|
37053
|
+
const own2 = context.program.at(-1) ?? script;
|
|
37054
|
+
const quoted2 = /^[\w./@+-]+$/.test(own2) ? own2 : `'${own2.replaceAll("'", "'\\''")}'`;
|
|
37055
|
+
return { command: quoted2, shadow: onPath };
|
|
37056
|
+
}
|
|
37057
|
+
|
|
36782
37058
|
// src/services/config-store.service.ts
|
|
36783
|
-
import { readFile as
|
|
36784
|
-
import { basename as basename2, dirname as
|
|
37059
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
37060
|
+
import { basename as basename2, dirname as dirname3, resolve } from "node:path";
|
|
36785
37061
|
|
|
36786
37062
|
// src/rules/state-file.rules.ts
|
|
36787
37063
|
function stepOf({ scan, char }) {
|
|
@@ -36825,8 +37101,8 @@ function stateTextOf({ text: text3 }) {
|
|
|
36825
37101
|
|
|
36826
37102
|
// src/services/state-file.service.ts
|
|
36827
37103
|
import { randomBytes } from "node:crypto";
|
|
36828
|
-
import { mkdir, open, readFile, rename, rm, stat } from "node:fs/promises";
|
|
36829
|
-
import { basename, dirname, join as
|
|
37104
|
+
import { mkdir, open, readFile as readFile2, rename, rm, stat } from "node:fs/promises";
|
|
37105
|
+
import { basename, dirname as dirname2, join as join3 } from "node:path";
|
|
36830
37106
|
var damaged = /* @__PURE__ */ new Map();
|
|
36831
37107
|
function damagedStateFiles() {
|
|
36832
37108
|
return [...damaged.values()];
|
|
@@ -36836,9 +37112,9 @@ async function writeStateText({
|
|
|
36836
37112
|
text: text3,
|
|
36837
37113
|
mode = 384
|
|
36838
37114
|
}) {
|
|
36839
|
-
const folder =
|
|
37115
|
+
const folder = dirname2(path);
|
|
36840
37116
|
await mkdir(folder, { recursive: true, mode: 448 });
|
|
36841
|
-
const temporary =
|
|
37117
|
+
const temporary = join3(
|
|
36842
37118
|
folder,
|
|
36843
37119
|
`.${basename(path)}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`
|
|
36844
37120
|
);
|
|
@@ -36869,7 +37145,7 @@ async function writeStateJson({
|
|
|
36869
37145
|
await writeStateText({ path, text: text3, ...mode === void 0 ? {} : { mode } });
|
|
36870
37146
|
}
|
|
36871
37147
|
async function readStateJson({ path }) {
|
|
36872
|
-
const text3 = await
|
|
37148
|
+
const text3 = await readFile2(path, "utf8").catch(() => void 0);
|
|
36873
37149
|
if (text3 === void 0) return void 0;
|
|
36874
37150
|
const read4 = stateTextOf({ text: text3 });
|
|
36875
37151
|
if (read4.kind === "valid") return read4.value;
|
|
@@ -36897,7 +37173,7 @@ async function withStateLock({
|
|
|
36897
37173
|
work
|
|
36898
37174
|
}) {
|
|
36899
37175
|
const lock = `${path}.lock`;
|
|
36900
|
-
await mkdir(
|
|
37176
|
+
await mkdir(dirname2(lock), { recursive: true, mode: 448 });
|
|
36901
37177
|
for (; ; ) {
|
|
36902
37178
|
const handle = await open(lock, "wx", 384).catch((error63) => {
|
|
36903
37179
|
if (error63.code === "EEXIST") return void 0;
|
|
@@ -36932,7 +37208,7 @@ var ConfigStore = class _ConfigStore {
|
|
|
36932
37208
|
return new _ConfigStore(path);
|
|
36933
37209
|
}
|
|
36934
37210
|
async read() {
|
|
36935
|
-
const text3 = await
|
|
37211
|
+
const text3 = await readFile3(this.path, "utf8").catch((error63) => {
|
|
36936
37212
|
if (error63.code === "ENOENT") return void 0;
|
|
36937
37213
|
throw error63;
|
|
36938
37214
|
});
|
|
@@ -37069,17 +37345,20 @@ function chooseProfile({
|
|
|
37069
37345
|
config: config2,
|
|
37070
37346
|
flag: flag2,
|
|
37071
37347
|
environment,
|
|
37348
|
+
session,
|
|
37072
37349
|
cwd
|
|
37073
37350
|
}) {
|
|
37351
|
+
const heard = session ? config2.sessions?.[session] : void 0;
|
|
37352
|
+
const sessionBound = heard && config2.profiles[heard] ? heard : void 0;
|
|
37074
37353
|
const bound = boundProfileOf({ bindings: config2.bindings, cwd });
|
|
37075
|
-
const name3 = flag2 || environment || bound || config2.current;
|
|
37354
|
+
const name3 = flag2 || environment || sessionBound || bound || config2.current;
|
|
37076
37355
|
const profile = name3 ? config2.profiles[name3] : void 0;
|
|
37077
37356
|
return name3 && profile ? { name: name3, profile } : { name: void 0, profile: void 0 };
|
|
37078
37357
|
}
|
|
37079
37358
|
function isWorktreeRoot({ directory }) {
|
|
37080
|
-
const parent =
|
|
37359
|
+
const parent = dirname3(directory);
|
|
37081
37360
|
if (basename2(parent) === ".worktrees") return true;
|
|
37082
|
-
return basename2(parent) === "worktrees" && basename2(
|
|
37361
|
+
return basename2(parent) === "worktrees" && basename2(dirname3(parent)) === ".claude";
|
|
37083
37362
|
}
|
|
37084
37363
|
function boundProfileOf({
|
|
37085
37364
|
bindings,
|
|
@@ -37089,7 +37368,7 @@ function boundProfileOf({
|
|
|
37089
37368
|
for (let depth = 0; depth < 64; depth += 1) {
|
|
37090
37369
|
const bound = bindings[directory];
|
|
37091
37370
|
if (bound) return bound;
|
|
37092
|
-
const parent =
|
|
37371
|
+
const parent = dirname3(directory);
|
|
37093
37372
|
if (parent === directory || isWorktreeRoot({ directory })) return void 0;
|
|
37094
37373
|
directory = parent;
|
|
37095
37374
|
}
|
|
@@ -37170,12 +37449,6 @@ function flagText({
|
|
|
37170
37449
|
return typeof value === "string" ? value : fallback;
|
|
37171
37450
|
}
|
|
37172
37451
|
|
|
37173
|
-
// src/rules/cli-version.rules.ts
|
|
37174
|
-
var STAMPED = "0.1.95";
|
|
37175
|
-
function cliVersionOf({ stamped = STAMPED } = {}) {
|
|
37176
|
-
return stamped.startsWith("__") ? "dev" : stamped;
|
|
37177
|
-
}
|
|
37178
|
-
|
|
37179
37452
|
// src/rules/refusal-format.rules.ts
|
|
37180
37453
|
function refusalText({ code, message: message2 }) {
|
|
37181
37454
|
const sentence = message2.trim().replace(/[.!]*$/, ".");
|
|
@@ -37210,7 +37483,7 @@ var ProfileRefusedError = class extends ProfileMigratedError {
|
|
|
37210
37483
|
};
|
|
37211
37484
|
|
|
37212
37485
|
// src/services/session.service.ts
|
|
37213
|
-
import { readFile as
|
|
37486
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
37214
37487
|
|
|
37215
37488
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
|
|
37216
37489
|
var external_exports = {};
|
|
@@ -39209,8 +39482,8 @@ function emoji() {
|
|
|
39209
39482
|
}
|
|
39210
39483
|
var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
39211
39484
|
var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
39212
|
-
var mac = (
|
|
39213
|
-
const escapedDelim = escapeRegex(
|
|
39485
|
+
var mac = (delimiter2) => {
|
|
39486
|
+
const escapedDelim = escapeRegex(delimiter2 ?? ":");
|
|
39214
39487
|
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
|
|
39215
39488
|
};
|
|
39216
39489
|
var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
@@ -59504,6 +59777,9 @@ var { isSaas } = Config.define((c) => ({
|
|
|
59504
59777
|
var { nodeEnvironment } = Config.define((c) => ({
|
|
59505
59778
|
nodeEnvironment: c.env("NODE_ENV", external_exports.string().optional())
|
|
59506
59779
|
}));
|
|
59780
|
+
var { apiSlot } = Config.define((c) => ({
|
|
59781
|
+
apiSlot: c.env("LAZE_API_SLOT", external_exports.enum(["a", "b"]).default("a"))
|
|
59782
|
+
}));
|
|
59507
59783
|
var { rawSocketPort } = Config.define((c) => ({
|
|
59508
59784
|
rawSocketPort: c.env("VOICE_WS_PORT", external_exports.coerce.number().int().min(0).max(65535).default(3300))
|
|
59509
59785
|
}));
|
|
@@ -60180,12 +60456,14 @@ var VAULT_GMAIL_SEND_PATHS = [
|
|
|
60180
60456
|
"/upload/gmail/v1/users/*/drafts/send"
|
|
60181
60457
|
];
|
|
60182
60458
|
var VAULT_MAX_LEASE_SECONDS = 2 * 86400;
|
|
60459
|
+
var VAULT_LONGEST_LEASE_SECONDS = 7 * 86400;
|
|
60183
60460
|
var VAULT_LEASE_CHOICES = [
|
|
60184
60461
|
15 * 60,
|
|
60185
60462
|
3600,
|
|
60186
60463
|
8 * 3600,
|
|
60187
60464
|
86400,
|
|
60188
|
-
VAULT_MAX_LEASE_SECONDS
|
|
60465
|
+
VAULT_MAX_LEASE_SECONDS,
|
|
60466
|
+
VAULT_LONGEST_LEASE_SECONDS
|
|
60189
60467
|
];
|
|
60190
60468
|
var vaultConnectionSchemaDefinition = external_exports.object({
|
|
60191
60469
|
id: external_exports.string().min(1),
|
|
@@ -60233,7 +60511,7 @@ var createVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
|
60233
60511
|
sensitivity: vaultSensitivitySchema.optional(),
|
|
60234
60512
|
rules: external_exports.string().max(2e3).default(""),
|
|
60235
60513
|
approverUserIds: external_exports.array(external_exports.string().min(1)).default([]),
|
|
60236
|
-
maxLeaseSeconds: external_exports.number().int().positive().max(
|
|
60514
|
+
maxLeaseSeconds: external_exports.number().int().positive().max(VAULT_LONGEST_LEASE_SECONDS).nullable().default(null),
|
|
60237
60515
|
everyUseAsks: external_exports.boolean().default(false),
|
|
60238
60516
|
secret: vaultSecretBundleSchema,
|
|
60239
60517
|
egress: vaultEgressTargetSchema.nullable().default(null)
|
|
@@ -60246,7 +60524,7 @@ var updateVaultConnectionInputSchemaDefinition = external_exports.object({
|
|
|
60246
60524
|
sensitivity: vaultSensitivitySchema.optional(),
|
|
60247
60525
|
rules: external_exports.string().max(2e3).optional(),
|
|
60248
60526
|
approverUserIds: external_exports.array(external_exports.string().min(1)).optional(),
|
|
60249
|
-
maxLeaseSeconds: external_exports.number().int().positive().max(
|
|
60527
|
+
maxLeaseSeconds: external_exports.number().int().positive().max(VAULT_LONGEST_LEASE_SECONDS).nullable().optional(),
|
|
60250
60528
|
everyUseAsks: external_exports.boolean().optional(),
|
|
60251
60529
|
/** On from anywhere; off only from the page, with a fresh device proof. */
|
|
60252
60530
|
deviceApproval: external_exports.boolean().optional(),
|
|
@@ -60640,6 +60918,17 @@ var vaultMostAskedSchemaDefinition = external_exports.object({
|
|
|
60640
60918
|
});
|
|
60641
60919
|
var vaultMostAskedSchema = vaultMostAskedSchemaDefinition;
|
|
60642
60920
|
var vaultUseOriginSchema = external_exports.enum(["computer", "connected"]);
|
|
60921
|
+
var vaultUseJudgeSchemaDefinition = external_exports.object({
|
|
60922
|
+
/** Let it through, asked a person, held it back, or could not check (off or no answer). */
|
|
60923
|
+
verdict: external_exports.enum(["allowed", "asked", "refused", "unchecked"]),
|
|
60924
|
+
/** The chance, 0 to 1, it gave the use fitting the key's rules; null when it gave none. */
|
|
60925
|
+
confidence: external_exports.number().min(0).max(1).nullable(),
|
|
60926
|
+
/** One plain line of why, from a fixed set: never model text, a message or a value. */
|
|
60927
|
+
line: external_exports.string(),
|
|
60928
|
+
/** The line as a code, for clients that translate it. */
|
|
60929
|
+
reason: external_exports.enum(["fits", "unsure", "unbacked", "not_asked", "against_rules", "off", "no_answer"]).optional()
|
|
60930
|
+
});
|
|
60931
|
+
var vaultUseJudgeSchema = vaultUseJudgeSchemaDefinition;
|
|
60643
60932
|
var vaultConnectionUseSchemaDefinition = external_exports.object({
|
|
60644
60933
|
at: external_exports.iso.datetime(),
|
|
60645
60934
|
action: external_exports.string(),
|
|
@@ -60667,7 +60956,9 @@ var vaultConnectionUseSchemaDefinition = external_exports.object({
|
|
|
60667
60956
|
to: vaultSensitivitySchema.nullable(),
|
|
60668
60957
|
direction: external_exports.enum(["raised", "lowered"]).nullable(),
|
|
60669
60958
|
method: external_exports.string().nullable()
|
|
60670
|
-
}).nullable().optional()
|
|
60959
|
+
}).nullable().optional(),
|
|
60960
|
+
/** When the automatic check decided the use: its verdict, confidence and why. */
|
|
60961
|
+
judge: vaultUseJudgeSchema.nullable().optional()
|
|
60671
60962
|
});
|
|
60672
60963
|
var vaultConnectionUseSchema = vaultConnectionUseSchemaDefinition;
|
|
60673
60964
|
var vaultKeyActivitySchemaDefinition = external_exports.object({
|
|
@@ -60743,7 +61034,7 @@ var vaultLevelLimitSchemaDefinition = external_exports.object({
|
|
|
60743
61034
|
subject: vaultLimitSubjectSchema,
|
|
60744
61035
|
most: vaultSensitivitySchema,
|
|
60745
61036
|
/** The longest lease an approval may grant on this subject's connections; null is no cap. */
|
|
60746
|
-
maxLeaseSeconds: external_exports.number().int().positive().max(
|
|
61037
|
+
maxLeaseSeconds: external_exports.number().int().positive().max(VAULT_LONGEST_LEASE_SECONDS).nullable(),
|
|
60747
61038
|
/** Turned off by an admin: no one adds one and agents cannot use the ones there are. */
|
|
60748
61039
|
blocked: external_exports.boolean().default(false),
|
|
60749
61040
|
/** New connections a member adds wait for an admin's approval before agents use them. */
|
|
@@ -60756,7 +61047,7 @@ var setVaultLevelLimitInputSchemaDefinition = external_exports.object({
|
|
|
60756
61047
|
workspaceId: external_exports.string().min(1),
|
|
60757
61048
|
subject: vaultLimitSubjectSchema,
|
|
60758
61049
|
most: vaultSensitivitySchema.exclude(["auto"]).nullable(),
|
|
60759
|
-
maxLeaseSeconds: external_exports.number().int().min(60).max(
|
|
61050
|
+
maxLeaseSeconds: external_exports.number().int().min(60).max(VAULT_LONGEST_LEASE_SECONDS).nullable().optional(),
|
|
60760
61051
|
/** Turns the connector off or on again; left out it stays as it is. */
|
|
60761
61052
|
blocked: external_exports.boolean().optional(),
|
|
60762
61053
|
/** Asks an admin to approve new connections, or stops asking; left out it stays. */
|
|
@@ -62921,6 +63212,8 @@ var messageSchemaDefinition = external_exports.object({
|
|
|
62921
63212
|
mirrorDeliveryWaking: external_exports.boolean().optional(),
|
|
62922
63213
|
/** A thread reply also sent to its conversation: it shows in the thread and the channel. */
|
|
62923
63214
|
alsoInChannel: external_exports.boolean().optional(),
|
|
63215
|
+
/** A Laze DM message also posted to its paired Slack DM, the id of that conversation. */
|
|
63216
|
+
alsoSentTo: external_exports.string().optional(),
|
|
62924
63217
|
/** For a reply also sent to the channel: its root's text, for the "replied to a thread" line. */
|
|
62925
63218
|
threadRootBody: external_exports.string().nullable().optional(),
|
|
62926
63219
|
/** For a root: the last three people or agents who replied, newest first. */
|
|
@@ -62982,6 +63275,7 @@ var reachableConversationSchemaDefinition = external_exports.object({
|
|
|
62982
63275
|
/** Whether any of the asked readers may read it; members are listed either way. */
|
|
62983
63276
|
readable: external_exports.boolean()
|
|
62984
63277
|
});
|
|
63278
|
+
var replySideSchema = external_exports.enum(["laze", "slack"]);
|
|
62985
63279
|
var conversationSummarySchemaDefinition = external_exports.object({
|
|
62986
63280
|
...conversationSchemaDefinition.shape,
|
|
62987
63281
|
lastReadSeq: external_exports.number().int().nonnegative(),
|
|
@@ -62993,7 +63287,14 @@ var conversationSummarySchemaDefinition = external_exports.object({
|
|
|
62993
63287
|
/** A timed mute ends on its own then; null or absent while muted means until unmuted. */
|
|
62994
63288
|
mutedUntil: external_exports.iso.datetime().nullable().optional(),
|
|
62995
63289
|
/** No message for SIDEBAR_ACTIVE_DAYS days, by the server's clock; absent means active. */
|
|
62996
|
-
inactive: external_exports.boolean().optional()
|
|
63290
|
+
inactive: external_exports.boolean().optional(),
|
|
63291
|
+
/**
|
|
63292
|
+
* When the reader last read or wrote here, from any device or a mirror; orders Recent on every
|
|
63293
|
+
* client. Absent when they never did.
|
|
63294
|
+
*/
|
|
63295
|
+
activeAt: external_exports.iso.datetime().optional(),
|
|
63296
|
+
/** In a Laze DM paired with a Slack DM: the side the reader picked; absent follows the other. */
|
|
63297
|
+
replySide: replySideSchema.optional()
|
|
62997
63298
|
});
|
|
62998
63299
|
var conversationSummarySchema = conversationSummarySchemaDefinition;
|
|
62999
63300
|
var directoryEntrySchemaDefinition = external_exports.object({
|
|
@@ -63291,6 +63592,8 @@ var postMessageInputSchemaDefinition = external_exports.object({
|
|
|
63291
63592
|
alsoInChannel: external_exports.boolean().optional(),
|
|
63292
63593
|
/** In a direct message: notify the people in Do Not Disturb anyway, once. */
|
|
63293
63594
|
notifyAnyway: external_exports.boolean().optional(),
|
|
63595
|
+
/** In a Laze DM: also post it to this paired Slack DM, as the sender; one Laze message. */
|
|
63596
|
+
alsoSendTo: idSchema4.optional(),
|
|
63294
63597
|
attachmentIds: external_exports.array(idSchema4).max(10).default([]),
|
|
63295
63598
|
/** The feed cards an agent's reply links; chat keeps them only when an agent posts. */
|
|
63296
63599
|
feedRefs: external_exports.array(messageFeedRefSchemaDefinition).max(MESSAGE_FEED_REFS_MAX).optional(),
|
|
@@ -63466,12 +63769,15 @@ var forgetMirroredInputSchemaDefinition = external_exports.object({
|
|
|
63466
63769
|
});
|
|
63467
63770
|
var mirrorUnreadsInputSchemaDefinition = external_exports.object({
|
|
63468
63771
|
workspaceId: workspaceIdSchema,
|
|
63469
|
-
userId: idSchema4
|
|
63772
|
+
userId: idSchema4,
|
|
63773
|
+
readActiveSince: external_exports.iso.datetime().optional()
|
|
63470
63774
|
});
|
|
63471
63775
|
var mirrorUnreadSchemaDefinition = external_exports.object({
|
|
63472
63776
|
channelId: idSchema4,
|
|
63473
63777
|
/** The mirror's key for the conversation, such as `slack:<team>:<channel>`. */
|
|
63474
|
-
mirrorKey: external_exports.string().min(1)
|
|
63778
|
+
mirrorKey: external_exports.string().min(1),
|
|
63779
|
+
/** Read to its last message in Laze: listed only when `readActiveSince` asked for it. */
|
|
63780
|
+
read: external_exports.boolean().optional()
|
|
63475
63781
|
});
|
|
63476
63782
|
var syncMirrorReadInputSchemaDefinition = external_exports.object({
|
|
63477
63783
|
workspaceId: workspaceIdSchema,
|
|
@@ -63480,7 +63786,12 @@ var syncMirrorReadInputSchemaDefinition = external_exports.object({
|
|
|
63480
63786
|
readTo: external_exports.iso.datetime(),
|
|
63481
63787
|
unread: external_exports.number().int().positive().max(1e6).optional(),
|
|
63482
63788
|
/** The source and Laze keep marks in step: a read there also ends a mark unread set in Laze. */
|
|
63483
|
-
releasesHold: external_exports.boolean().optional()
|
|
63789
|
+
releasesHold: external_exports.boolean().optional(),
|
|
63790
|
+
/**
|
|
63791
|
+
* The person moved the source's marker back to `readTo`: Laze's marker moves back to the newest
|
|
63792
|
+
* message at or before it, while it still sits at this seq and others wrote after it.
|
|
63793
|
+
*/
|
|
63794
|
+
backFromSeq: external_exports.number().int().nonnegative().optional()
|
|
63484
63795
|
});
|
|
63485
63796
|
var mirroredReadToInputSchemaDefinition = external_exports.object({
|
|
63486
63797
|
workspaceId: workspaceIdSchema,
|
|
@@ -63726,6 +64037,13 @@ var setNotifyInputSchemaDefinition = external_exports.object({
|
|
|
63726
64037
|
mutedUntil: external_exports.iso.datetime().nullable().optional()
|
|
63727
64038
|
});
|
|
63728
64039
|
var setNotifyInputSchema = setNotifyInputSchemaDefinition;
|
|
64040
|
+
var setReplySideInputSchemaDefinition = external_exports.object({
|
|
64041
|
+
workspaceId: workspaceIdSchema,
|
|
64042
|
+
channelId: idSchema4,
|
|
64043
|
+
/** Null forgets the pick, so replies go to both sides, the default, again. */
|
|
64044
|
+
side: replySideSchema.nullable()
|
|
64045
|
+
});
|
|
64046
|
+
var setReplySideInputSchema = setReplySideInputSchemaDefinition;
|
|
63729
64047
|
var followThreadInputSchemaDefinition = external_exports.object({
|
|
63730
64048
|
workspaceId: workspaceIdSchema,
|
|
63731
64049
|
messageId: idSchema4,
|
|
@@ -64121,7 +64439,7 @@ var chatConversationsTrpc = defineTrpcContract("chat").query("overview", { mirro
|
|
|
64121
64439
|
var chatChannelRolesTrpc = defineTrpcContract("chat").mutation("setChannelRole").withInput(setChannelRoleInputSchema).withOutput(conversationSchema).mutation("extendChannel").withInput(extendChannelInputSchema).withOutput(conversationSchema).build();
|
|
64122
64440
|
var chatMessagesTrpc = defineTrpcContract("chat").query("history", { mirrored: historyMirror }).withInput(historyInputSchema).withOutput(historyPageSchema).query("thread").withInput(messageInputSchema).withOutput(threadSchema).query("message").withInput(messageInputSchema).withOutput(messageSchema).mutation("post").withInput(postMessageInputSchema).withOutput(messageSchema).mutation("forward").withInput(forwardMessageInputSchema).withOutput(messageSchema).mutation("addMentioned").withInput(addMentionedInputSchema).withOutput(messageSchema).mutation("edit").withInput(editMessageInputSchema).withOutput(messageSchema).mutation("delete").withInput(messageInputSchema).withOutput(messageSchema).mutation("remove").withInput(messageInputSchema).withOutput(messageSchema).mutation("react").withInput(reactInputSchema).withOutput(messageSchema).mutation("signalTyping").withInput(signalTypingInputSchema).withOutput(external_exports.object({ sent: external_exports.literal(true) })).mutation("markRead").withInput(markReadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).mutation("markUnread").withInput(markUnreadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).query("search").withInput(searchInputSchema).withOutput(searchResultSchema).build();
|
|
64123
64441
|
var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).mutation("transcribeVoiceSegment").withInput(transcribeVoiceSegmentInputSchema).withOutput(voiceSegmentTextSchema).mutation("abortUpload").withInput(fileInputSchema).withOutput(external_exports.object({ aborted: external_exports.literal(true) })).query("fileLink").withInput(fileLinkInputSchema).withOutput(fileLinkSchema).query("channelFiles").withInput(channelFilesInputSchema).withOutput(channelFilesSchema).mutation("renameAttachment").withInput(renameAttachmentInputSchema).withOutput(attachmentSchema).mutation("hideUnfurl").withInput(hideUnfurlInputSchema).withOutput(messageSchema).query("unfurlImage").withInput(unfurlImageInputSchema).withOutput(fileLinkSchema).query("searchGifs").withInput(searchGifsInputSchema).withOutput(gifResultsSchema).build();
|
|
64124
|
-
var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads", { mirrored: threadsMirror }).withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).mutation("retryMirrorDelivery").withInput(messageInputSchema).withOutput(external_exports.object({ retried: external_exports.boolean() })).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
|
|
64442
|
+
var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("setReplySide").withInput(setReplySideInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads", { mirrored: threadsMirror }).withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).mutation("retryMirrorDelivery").withInput(messageInputSchema).withOutput(external_exports.object({ retried: external_exports.boolean() })).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
|
|
64125
64443
|
var chatSessionTrpc = defineTrpcContract("chat").mutation("realtimeToken").withInput(workspaceInputSchema).withOutput(realtimeTokenSchema).query("drafts").withInput(workspaceInputSchema).withOutput(draftListSchema).mutation("saveDraft").withInput(saveDraftInputSchema).withOutput(draftSavedSchema).mutation("deleteDraft").withInput(deleteDraftInputSchema).withOutput(draftSavedSchema).query("sent").withInput(listSentInputSchema).withOutput(sentPageSchema).query("sidebarLayout").withInput(workspaceInputSchema).withOutput(sidebarLayoutSchema).mutation("editSidebar").withInput(editSidebarInputSchema).withOutput(sidebarLayoutSchema).query("readerPreferences").withInput(workspaceInputSchema).withOutput(readerPreferencesSchema).mutation("setReaderPreferences").withInput(setReaderPreferencesInputSchema).withOutput(readerPreferencesSchema).mutation("star").withInput(starInputSchema).withOutput(starStatusSchema).query("starred").withInput(workspaceInputSchema).withOutput(starredListSchema).mutation("scrubSecrets").withInput(scrubChatInputSchema).withOutput(chatScrubReportSchema).mutation("restoreScrubbed").withInput(messageInputSchema).withOutput(messageSchema).build();
|
|
64126
64444
|
var chatScheduledTrpc = defineTrpcContract("chat").mutation("scheduleMessage").withInput(scheduleMessageInputSchema).withOutput(scheduledMessageSchema).query("scheduled").withInput(listScheduledInputSchema).withOutput(scheduledListSchema).mutation("editScheduled").withInput(editScheduledInputSchema).withOutput(scheduledMessageSchema).mutation("sendScheduledNow").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).mutation("cancelScheduled").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).build();
|
|
64127
64445
|
var chatPresenceTrpc = defineTrpcContract("chat").mutation("heartbeat").withInput(workspaceInputSchema).withOutput(heartbeatSchema).query("presence").withInput(workspaceInputSchema).withOutput(presenceListSchema).mutation("setStatus").withInput(setStatusInputSchema).withOutput(personPresenceSchema).mutation("clearStatus").withInput(workspaceInputSchema).withOutput(personPresenceSchema).mutation("setAway").withInput(setAwayInputSchema).withOutput(personPresenceSchema).build();
|
|
@@ -64317,6 +64635,27 @@ var emailMessageSchemaDefinition = external_exports.discriminatedUnion("template
|
|
|
64317
64635
|
lines: external_exports.array(external_exports.string()).min(1),
|
|
64318
64636
|
action: external_exports.string().min(1)
|
|
64319
64637
|
}),
|
|
64638
|
+
/**
|
|
64639
|
+
* Optional product mail with one picture over the words and one button, such as an apology
|
|
64640
|
+
* after an incident; sent only where `optionalEmailReach` allows, with its off link.
|
|
64641
|
+
*/
|
|
64642
|
+
external_exports.object({
|
|
64643
|
+
template: external_exports.literal("announcement"),
|
|
64644
|
+
to: external_exports.email(),
|
|
64645
|
+
locale: localeSchema,
|
|
64646
|
+
url: external_exports.url(),
|
|
64647
|
+
subject: external_exports.string().min(1).max(200),
|
|
64648
|
+
heading: external_exports.string().min(1).max(200),
|
|
64649
|
+
lines: external_exports.array(external_exports.string().min(1).max(600)).min(1).max(4),
|
|
64650
|
+
action: external_exports.string().min(1).max(80),
|
|
64651
|
+
image: external_exports.object({
|
|
64652
|
+
url: external_exports.url(),
|
|
64653
|
+
alt: external_exports.string().max(200),
|
|
64654
|
+
width: external_exports.number().int().positive().max(600),
|
|
64655
|
+
height: external_exports.number().int().positive().max(600)
|
|
64656
|
+
}),
|
|
64657
|
+
unsubscribeUrl: external_exports.url()
|
|
64658
|
+
}),
|
|
64320
64659
|
/** A Laze app a person waited for is out; `url` is its store page. */
|
|
64321
64660
|
external_exports.object({
|
|
64322
64661
|
template: external_exports.literal("appAvailable"),
|
|
@@ -64688,12 +65027,18 @@ var pauseSummaryIntentSchemaDefinition = external_exports.object({
|
|
|
64688
65027
|
userId: external_exports.string().min(1),
|
|
64689
65028
|
since: external_exports.iso.datetime()
|
|
64690
65029
|
});
|
|
65030
|
+
var heldPushTextSchema = external_exports.union([
|
|
65031
|
+
external_exports.object({ sealed: external_exports.string().min(1), version: external_exports.number().int().positive() }).strict(),
|
|
65032
|
+
external_exports.object({ unavailable: external_exports.literal(true) }).strict()
|
|
65033
|
+
]);
|
|
65034
|
+
var sealedNameSchema = heldPushTextSchema;
|
|
64691
65035
|
var noticeHeldPayloadSchemaDefinition = external_exports.object({
|
|
64692
65036
|
workspaceId: external_exports.string().min(1),
|
|
64693
65037
|
userId: external_exports.string().min(1),
|
|
64694
65038
|
noticeId: external_exports.string().min(1),
|
|
64695
65039
|
fromKey: external_exports.string().min(1),
|
|
64696
65040
|
fromName: external_exports.string(),
|
|
65041
|
+
fromNameSealed: sealedNameSchema.optional(),
|
|
64697
65042
|
at: external_exports.iso.datetime()
|
|
64698
65043
|
});
|
|
64699
65044
|
var burstSummaryStateSchemaDefinition = external_exports.object({
|
|
@@ -64701,6 +65046,7 @@ var burstSummaryStateSchemaDefinition = external_exports.object({
|
|
|
64701
65046
|
userId: external_exports.string(),
|
|
64702
65047
|
fromKey: external_exports.string(),
|
|
64703
65048
|
fromName: external_exports.string(),
|
|
65049
|
+
fromNameSealed: sealedNameSchema.optional(),
|
|
64704
65050
|
/** When the first held notice of this burst came, in epoch milliseconds. */
|
|
64705
65051
|
since: external_exports.number().nullable(),
|
|
64706
65052
|
/** When the latest held notice came. */
|
|
@@ -64711,12 +65057,9 @@ var burstSummaryIntentSchemaDefinition = external_exports.object({
|
|
|
64711
65057
|
userId: external_exports.string().min(1),
|
|
64712
65058
|
fromKey: external_exports.string().min(1),
|
|
64713
65059
|
fromName: external_exports.string(),
|
|
65060
|
+
fromNameSealed: sealedNameSchema.optional(),
|
|
64714
65061
|
since: external_exports.iso.datetime()
|
|
64715
65062
|
});
|
|
64716
|
-
var heldPushTextSchema = external_exports.union([
|
|
64717
|
-
external_exports.object({ sealed: external_exports.string().min(1), version: external_exports.number().int().positive() }).strict(),
|
|
64718
|
-
external_exports.object({ unavailable: external_exports.literal(true) }).strict()
|
|
64719
|
-
]);
|
|
64720
65063
|
var heldFeedPushSchema = external_exports.object({
|
|
64721
65064
|
itemId: external_exports.string().min(1),
|
|
64722
65065
|
idempotencyKey: external_exports.string().min(1),
|
|
@@ -64729,6 +65072,7 @@ var heldFeedPushSchema = external_exports.object({
|
|
|
64729
65072
|
var heldBurstPushSchema = external_exports.object({
|
|
64730
65073
|
fromKey: external_exports.string().min(1),
|
|
64731
65074
|
fromName: external_exports.string(),
|
|
65075
|
+
fromNameSealed: sealedNameSchema.optional(),
|
|
64732
65076
|
since: external_exports.iso.datetime()
|
|
64733
65077
|
});
|
|
64734
65078
|
var heldPhonePushShape = {
|
|
@@ -64742,7 +65086,9 @@ var heldPhonePushShape = {
|
|
|
64742
65086
|
feed: heldFeedPushSchema.optional(),
|
|
64743
65087
|
burst: heldBurstPushSchema.optional(),
|
|
64744
65088
|
/** A message alert's sender, so a held alert still shows their picture. */
|
|
64745
|
-
sender: apnsSenderSchema.optional()
|
|
65089
|
+
sender: apnsSenderSchema.optional(),
|
|
65090
|
+
/** The sender's name sealed; sealed mode leaves `sender.name` empty. */
|
|
65091
|
+
senderNameSealed: sealedNameSchema.optional()
|
|
64746
65092
|
};
|
|
64747
65093
|
var phonePushHeldPayloadSchemaDefinition = external_exports.object({
|
|
64748
65094
|
workspaceId: external_exports.string().min(1),
|
|
@@ -64897,6 +65243,8 @@ var messagePostedPayloadSchemaDefinition = external_exports.object({
|
|
|
64897
65243
|
threadRootId: external_exports.string().nullable(),
|
|
64898
65244
|
/** A thread reply also sent to its conversation, counted and notified like a channel post. */
|
|
64899
65245
|
alsoInChannel: external_exports.boolean().optional(),
|
|
65246
|
+
/** A Laze DM message also posted to its paired Slack DM: that conversation's id. */
|
|
65247
|
+
alsoSentTo: external_exports.string().optional(),
|
|
64900
65248
|
/** A person's direct message sent with "Notify anyway": it breaks through Do Not Disturb. */
|
|
64901
65249
|
notifyAnyway: external_exports.boolean().optional(),
|
|
64902
65250
|
/** The person whose own action posted it, such as a feed comment: they get no notice of it. */
|
|
@@ -66284,6 +66632,7 @@ var computerHostViewDefinition = external_exports.object({
|
|
|
66284
66632
|
diskFreeGb: external_exports.number().nullable()
|
|
66285
66633
|
});
|
|
66286
66634
|
var computerResizeOutcomeSchema = external_exports.enum(["in_place", "moving", "stored"]);
|
|
66635
|
+
var computerRoomDefinition = external_exports.object({ placed: external_exports.boolean(), fits: external_exports.boolean() });
|
|
66287
66636
|
var sizeShape = {
|
|
66288
66637
|
memoryMb: external_exports.number().int().positive(),
|
|
66289
66638
|
cpus: external_exports.number().positive(),
|
|
@@ -66314,6 +66663,12 @@ var computerPoolFactDefinition = external_exports.discriminatedUnion("kind", [
|
|
|
66314
66663
|
state: computerHostStateSchema
|
|
66315
66664
|
}),
|
|
66316
66665
|
external_exports.object({ kind: external_exports.literal("host_health_changed"), hostId: external_exports.string(), healthy: external_exports.boolean() }),
|
|
66666
|
+
external_exports.object({
|
|
66667
|
+
kind: external_exports.literal("host_overcommit_changed"),
|
|
66668
|
+
hostId: external_exports.string(),
|
|
66669
|
+
overcommit: external_exports.number(),
|
|
66670
|
+
diskOvercommit: external_exports.number()
|
|
66671
|
+
}),
|
|
66317
66672
|
external_exports.object({ kind: external_exports.literal("host_removed"), hostId: external_exports.string() }),
|
|
66318
66673
|
external_exports.object({
|
|
66319
66674
|
kind: external_exports.literal("placed"),
|
|
@@ -66382,13 +66737,38 @@ var computerPoolFactDefinition = external_exports.discriminatedUnion("kind", [
|
|
|
66382
66737
|
memoryMb: external_exports.number().int().nonnegative(),
|
|
66383
66738
|
cpus: external_exports.number().nonnegative(),
|
|
66384
66739
|
diskGb: external_exports.number().int().nonnegative(),
|
|
66385
|
-
numbers: capacityNumbersDefinition
|
|
66740
|
+
numbers: capacityNumbersDefinition,
|
|
66741
|
+
/** Distinct computers refused a create in the incident; absent on older facts. */
|
|
66742
|
+
waiting: external_exports.number().int().nonnegative().optional()
|
|
66386
66743
|
}),
|
|
66387
66744
|
external_exports.object({
|
|
66388
66745
|
kind: external_exports.literal("capacity_card_settled"),
|
|
66389
66746
|
incidentId: external_exports.string(),
|
|
66390
66747
|
workspaceId: external_exports.string(),
|
|
66391
|
-
refusals: external_exports.number()
|
|
66748
|
+
refusals: external_exports.number(),
|
|
66749
|
+
waiting: external_exports.number().int().nonnegative().optional()
|
|
66750
|
+
}),
|
|
66751
|
+
/** Room is running low before the limit: one urgent card per episode. */
|
|
66752
|
+
external_exports.object({
|
|
66753
|
+
kind: external_exports.literal("capacity_low_raised"),
|
|
66754
|
+
episodeId: external_exports.string(),
|
|
66755
|
+
workspaceId: external_exports.string(),
|
|
66756
|
+
recipientUserIds: external_exports.array(external_exports.string()),
|
|
66757
|
+
/** New Small computers that fit on the best host. */
|
|
66758
|
+
smallFits: external_exports.number().int().nonnegative(),
|
|
66759
|
+
/** Hosts whose report shows little real disk free or much memory held, in percent. */
|
|
66760
|
+
tightHosts: external_exports.array(
|
|
66761
|
+
external_exports.object({
|
|
66762
|
+
hostId: external_exports.string(),
|
|
66763
|
+
diskFreePercent: external_exports.number().nullable(),
|
|
66764
|
+
memoryUsedPercent: external_exports.number().nullable()
|
|
66765
|
+
})
|
|
66766
|
+
)
|
|
66767
|
+
}),
|
|
66768
|
+
external_exports.object({
|
|
66769
|
+
kind: external_exports.literal("capacity_low_settled"),
|
|
66770
|
+
episodeId: external_exports.string(),
|
|
66771
|
+
workspaceId: external_exports.string()
|
|
66392
66772
|
})
|
|
66393
66773
|
]);
|
|
66394
66774
|
var computerPoolFactRecordDefinition = external_exports.object({
|
|
@@ -67497,6 +67877,19 @@ var mcpServerApprovalChangedPayloadSchemaDefinition = external_exports.object({
|
|
|
67497
67877
|
changeId: external_exports.string().min(1),
|
|
67498
67878
|
at: external_exports.iso.datetime()
|
|
67499
67879
|
});
|
|
67880
|
+
var connectionLinkedPayloadSchemaDefinition = external_exports.object({
|
|
67881
|
+
workspaceId: external_exports.string().min(1),
|
|
67882
|
+
connectionId: external_exports.string().min(1),
|
|
67883
|
+
userId: external_exports.string().min(1),
|
|
67884
|
+
/** The provider's id (`gmail`, `github`), `mcp` for a remote MCP server, or `github_app`. */
|
|
67885
|
+
service: external_exports.string().min(1).max(80),
|
|
67886
|
+
/** The connection's sensitivity tier; null when the path sets none. */
|
|
67887
|
+
sensitivity: external_exports.string().max(40).nullable(),
|
|
67888
|
+
/** `renewed`: a sign-in that refreshed a connection the person already had. */
|
|
67889
|
+
renewed: external_exports.boolean(),
|
|
67890
|
+
changeId: external_exports.string().min(1),
|
|
67891
|
+
at: external_exports.iso.datetime()
|
|
67892
|
+
});
|
|
67500
67893
|
var ConnectorApi = moduleApi()("connector");
|
|
67501
67894
|
var workspaceInput2 = external_exports.object({ workspaceId: external_exports.string().min(1) });
|
|
67502
67895
|
var connectionInput2 = external_exports.object({
|
|
@@ -69576,6 +69969,11 @@ var agentConfig = Config.define((c) => ({
|
|
|
69576
69969
|
"AGENT_CLAUDE_GATEWAY_FAST",
|
|
69577
69970
|
external_exports.string().min(1).default("claude-sonnet-5-5")
|
|
69578
69971
|
),
|
|
69972
|
+
/** What a staff haiku override runs (staff-model-override.feature); never a level people pick. */
|
|
69973
|
+
claudeGatewayHaikuModel: c.env(
|
|
69974
|
+
"AGENT_CLAUDE_GATEWAY_HAIKU",
|
|
69975
|
+
external_exports.string().min(1).default("claude-haiku-5-5")
|
|
69976
|
+
),
|
|
69579
69977
|
/** `off` turns Claude Code's thinking off on Laze models, for a gateway lane that refuses it. */
|
|
69580
69978
|
claudeGatewayThinking: c.env(
|
|
69581
69979
|
"AGENT_CLAUDE_GATEWAY_THINKING",
|
|
@@ -69813,6 +70211,32 @@ var agentScheduledRunMissedPayloadSchemaDefinition = external_exports.object({
|
|
|
69813
70211
|
scheduledFor: external_exports.iso.datetime()
|
|
69814
70212
|
});
|
|
69815
70213
|
|
|
70214
|
+
// ../../modules/agent/contract/src/agent-adoption.ts
|
|
70215
|
+
var agentAdoptionHarnessSchema = external_exports.enum(["laze-models", "claude-code", "codex", "other"]);
|
|
70216
|
+
var agentCreatedPayloadSchemaDefinition = external_exports.object({
|
|
70217
|
+
workspaceId: external_exports.string().min(1),
|
|
70218
|
+
agentId: external_exports.string().min(1),
|
|
70219
|
+
byUserId: external_exports.string().min(1).nullable(),
|
|
70220
|
+
harness: agentAdoptionHarnessSchema,
|
|
70221
|
+
hosting: external_exports.enum(["laze", "connected"]),
|
|
70222
|
+
kind: external_exports.enum(["personal", "team"]),
|
|
70223
|
+
at: external_exports.iso.datetime()
|
|
70224
|
+
});
|
|
70225
|
+
var agentConnectedPayloadSchemaDefinition = external_exports.object({
|
|
70226
|
+
workspaceId: external_exports.string().min(1),
|
|
70227
|
+
agentId: external_exports.string().min(1),
|
|
70228
|
+
byUserId: external_exports.string().min(1).nullable(),
|
|
70229
|
+
harness: agentAdoptionHarnessSchema,
|
|
70230
|
+
at: external_exports.iso.datetime()
|
|
70231
|
+
});
|
|
70232
|
+
var agentPersonMessageReceivedPayloadSchemaDefinition = external_exports.object({
|
|
70233
|
+
workspaceId: external_exports.string().min(1),
|
|
70234
|
+
agentId: external_exports.string().min(1),
|
|
70235
|
+
/** The person whose message it was. */
|
|
70236
|
+
userId: external_exports.string().min(1),
|
|
70237
|
+
at: external_exports.iso.datetime()
|
|
70238
|
+
});
|
|
70239
|
+
|
|
69816
70240
|
// ../../modules/agent/contract/src/agent-history.ts
|
|
69817
70241
|
var idSchema19 = external_exports.string().min(1).max(80);
|
|
69818
70242
|
var CALLER_HISTORY_LIMIT_MAX = 100;
|
|
@@ -70382,6 +70806,29 @@ function revokedKeyLineOf({ profile }) {
|
|
|
70382
70806
|
return `${profile}: this agent's key was revoked: run \`laze agent link\` again or remove it with \`laze logout --profile ${profile}\``;
|
|
70383
70807
|
}
|
|
70384
70808
|
|
|
70809
|
+
// src/rules/session-headers.rules.ts
|
|
70810
|
+
import { relative, sep } from "node:path";
|
|
70811
|
+
function sessionKeyOf({ session }) {
|
|
70812
|
+
return `${session.harness}:${session.sessionId}`;
|
|
70813
|
+
}
|
|
70814
|
+
function sessionHeadersOf({
|
|
70815
|
+
session
|
|
70816
|
+
}) {
|
|
70817
|
+
if (!session) return {};
|
|
70818
|
+
return {
|
|
70819
|
+
[AGENT_SESSION_HEADER]: sessionKeyOf({ session }),
|
|
70820
|
+
[AGENT_SESSION_FOLDER_HEADER]: encodeURIComponent(session.folder),
|
|
70821
|
+
[AGENT_SESSION_HOST_HEADER]: encodeURIComponent(session.host)
|
|
70822
|
+
};
|
|
70823
|
+
}
|
|
70824
|
+
function displayFolderOf({ folder, home }) {
|
|
70825
|
+
if (!home) return folder;
|
|
70826
|
+
const below = relative(home, folder);
|
|
70827
|
+
if (below === "") return "~";
|
|
70828
|
+
if (below.startsWith("..") || below.startsWith(sep)) return folder;
|
|
70829
|
+
return `~/${below.split(sep).join("/")}`;
|
|
70830
|
+
}
|
|
70831
|
+
|
|
70385
70832
|
// src/services/laze-client.service.ts
|
|
70386
70833
|
var CLI_VERSION_HEADER = "x-laze-cli-version";
|
|
70387
70834
|
var LazeApiError = class extends Error {
|
|
@@ -70522,11 +70969,11 @@ function errorOf({ status: status11, body }) {
|
|
|
70522
70969
|
|
|
70523
70970
|
// src/services/machine-report.service.ts
|
|
70524
70971
|
import { createHash } from "node:crypto";
|
|
70525
|
-
import { readFile as
|
|
70972
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
70526
70973
|
import { hostname as hostname3 } from "node:os";
|
|
70527
70974
|
|
|
70528
70975
|
// src/services/inbox-spool.service.ts
|
|
70529
|
-
import { dirname as
|
|
70976
|
+
import { dirname as dirname4, join as join4 } from "node:path";
|
|
70530
70977
|
var PUSH_GRACE_MS = 3 * 6e4;
|
|
70531
70978
|
var IN_FLIGHT_MS = 35e3;
|
|
70532
70979
|
function fileNameOf({ profile }) {
|
|
@@ -70538,8 +70985,8 @@ function statePathOf({
|
|
|
70538
70985
|
profile,
|
|
70539
70986
|
extension: extension2 = "json"
|
|
70540
70987
|
}) {
|
|
70541
|
-
const directory =
|
|
70542
|
-
return
|
|
70988
|
+
const directory = join4(dirname4(context.environment.configPath), kind2);
|
|
70989
|
+
return join4(directory, `${fileNameOf({ profile })}.${extension2}`);
|
|
70543
70990
|
}
|
|
70544
70991
|
async function readSpool({ path }) {
|
|
70545
70992
|
return await readStateJson({ path }) ?? [];
|
|
@@ -70612,7 +71059,7 @@ async function reportMachine({
|
|
|
70612
71059
|
if (!host2) return;
|
|
70613
71060
|
const stamp = createHash("sha256").update(`${token2}:${host2}`).digest("hex");
|
|
70614
71061
|
const path = statePathOf({ context, kind: "machine", profile });
|
|
70615
|
-
const noted = await
|
|
71062
|
+
const noted = await readFile4(path, "utf8").catch(() => "");
|
|
70616
71063
|
if (noted === JSON.stringify(stamp) || noted === stamp) return;
|
|
70617
71064
|
try {
|
|
70618
71065
|
await client.post("/api/agents/me/machine", { host: host2 });
|
|
@@ -70654,11 +71101,20 @@ async function turnTokenOf({ context }) {
|
|
|
70654
71101
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
70655
71102
|
if (pinned) return pinned;
|
|
70656
71103
|
if (!env.LAZE_TURN_FILE) return "";
|
|
70657
|
-
return
|
|
71104
|
+
return readFile5(env.LAZE_TURN_FILE, "utf8").then(
|
|
70658
71105
|
(text3) => text3.trim(),
|
|
70659
71106
|
() => ""
|
|
70660
71107
|
);
|
|
70661
71108
|
}
|
|
71109
|
+
function harnessSessionKeyOf({ context }) {
|
|
71110
|
+
const { harness, inherited } = context.environment;
|
|
71111
|
+
const ids = {
|
|
71112
|
+
"claude-code": inherited.CLAUDE_CODE_SESSION_ID,
|
|
71113
|
+
codex: inherited.CODEX_THREAD_ID
|
|
71114
|
+
};
|
|
71115
|
+
const sessionId = ids[harness];
|
|
71116
|
+
return sessionId ? sessionKeyOf({ session: { harness, sessionId } }) : void 0;
|
|
71117
|
+
}
|
|
70662
71118
|
async function signedIn({
|
|
70663
71119
|
context,
|
|
70664
71120
|
args
|
|
@@ -70668,6 +71124,7 @@ async function signedIn({
|
|
|
70668
71124
|
config: config2,
|
|
70669
71125
|
flag: flagText({ args, name: "profile" }) || void 0,
|
|
70670
71126
|
environment: context.environment.profile,
|
|
71127
|
+
session: harnessSessionKeyOf({ context }),
|
|
70671
71128
|
cwd: context.cwd
|
|
70672
71129
|
});
|
|
70673
71130
|
if (!chosen.profile)
|
|
@@ -70944,8 +71401,8 @@ async function copyAgent({
|
|
|
70944
71401
|
}
|
|
70945
71402
|
|
|
70946
71403
|
// src/services/agent-commands.service.ts
|
|
70947
|
-
import { mkdir as mkdir5, readFile as
|
|
70948
|
-
import { join as
|
|
71404
|
+
import { mkdir as mkdir5, readFile as readFile12, writeFile as writeFile3 } from "node:fs/promises";
|
|
71405
|
+
import { join as join20, resolve as resolve5 } from "node:path";
|
|
70949
71406
|
|
|
70950
71407
|
// src/rules/agent-profile.rules.ts
|
|
70951
71408
|
var HARNESS_NAMES = {
|
|
@@ -71038,15 +71495,6 @@ ${lines2.join("\n")}
|
|
|
71038
71495
|
`;
|
|
71039
71496
|
}
|
|
71040
71497
|
|
|
71041
|
-
// src/rules/cli-invocation.rules.ts
|
|
71042
|
-
var NPX_CACHE = /[\\/]_npx[\\/]/;
|
|
71043
|
-
var SANDBOX_CLI_PATH = "/opt/laze/cli/laze.mjs";
|
|
71044
|
-
function lazeCommandOf({ program }) {
|
|
71045
|
-
const script = program.at(-1) ?? "";
|
|
71046
|
-
if (!NPX_CACHE.test(script)) return "laze";
|
|
71047
|
-
return /^[\w./@+-]+$/.test(script) ? script : `'${script.replaceAll("'", "'\\''")}'`;
|
|
71048
|
-
}
|
|
71049
|
-
|
|
71050
71498
|
// src/rules/hook-settings.rules.ts
|
|
71051
71499
|
var LAZE_HOOK_MARKER = "laze-cli-hook";
|
|
71052
71500
|
var HOOK_TIMEOUTS = { Stop: 30, PreToolUse: 5, SessionStart: 30 };
|
|
@@ -71175,29 +71623,6 @@ function selfClauseOf({ self: self2 }) {
|
|
|
71175
71623
|
return self2 ? `, where you are ${self2}` : "";
|
|
71176
71624
|
}
|
|
71177
71625
|
|
|
71178
|
-
// src/rules/session-headers.rules.ts
|
|
71179
|
-
import { relative, sep } from "node:path";
|
|
71180
|
-
function sessionKeyOf({ session }) {
|
|
71181
|
-
return `${session.harness}:${session.sessionId}`;
|
|
71182
|
-
}
|
|
71183
|
-
function sessionHeadersOf({
|
|
71184
|
-
session
|
|
71185
|
-
}) {
|
|
71186
|
-
if (!session) return {};
|
|
71187
|
-
return {
|
|
71188
|
-
[AGENT_SESSION_HEADER]: sessionKeyOf({ session }),
|
|
71189
|
-
[AGENT_SESSION_FOLDER_HEADER]: encodeURIComponent(session.folder),
|
|
71190
|
-
[AGENT_SESSION_HOST_HEADER]: encodeURIComponent(session.host)
|
|
71191
|
-
};
|
|
71192
|
-
}
|
|
71193
|
-
function displayFolderOf({ folder, home }) {
|
|
71194
|
-
if (!home) return folder;
|
|
71195
|
-
const below = relative(home, folder);
|
|
71196
|
-
if (below === "") return "~";
|
|
71197
|
-
if (below.startsWith("..") || below.startsWith(sep)) return folder;
|
|
71198
|
-
return `~/${below.split(sep).join("/")}`;
|
|
71199
|
-
}
|
|
71200
|
-
|
|
71201
71626
|
// src/rules/transcript.rules.ts
|
|
71202
71627
|
function record2(value) {
|
|
71203
71628
|
return typeof value === "object" && value !== null ? value : {};
|
|
@@ -71756,6 +72181,17 @@ var slackBotCleanupOutcomePayloadSchemaDefinition = external_exports.object({
|
|
|
71756
72181
|
slackChannelId: external_exports.string().min(1),
|
|
71757
72182
|
outcome: external_exports.enum(["left", "kept", "failed"])
|
|
71758
72183
|
});
|
|
72184
|
+
var slackLinkedPayloadSchemaDefinition = external_exports.object({
|
|
72185
|
+
workspaceId: external_exports.string().min(1),
|
|
72186
|
+
/** The Laze person who finished the flow. */
|
|
72187
|
+
userId: external_exports.string().min(1),
|
|
72188
|
+
/** Opaque and unique to this link, derived from the finished authorization. */
|
|
72189
|
+
linkId: external_exports.string().min(1),
|
|
72190
|
+
/** `installed`: the bot; `linked`: a person's own account; `moved`: onto another app. */
|
|
72191
|
+
outcome: external_exports.enum(["installed", "linked", "moved"]),
|
|
72192
|
+
changeId: external_exports.string().min(1),
|
|
72193
|
+
at: external_exports.iso.datetime()
|
|
72194
|
+
});
|
|
71759
72195
|
|
|
71760
72196
|
// ../../modules/slack/contract/src/slack.ts
|
|
71761
72197
|
var SLACK_CACHE_DAYS_MAX = 30;
|
|
@@ -72250,12 +72686,12 @@ function formatSearch({
|
|
|
72250
72686
|
|
|
72251
72687
|
// src/services/claude-turn.service.ts
|
|
72252
72688
|
import { rm as rm3 } from "node:fs/promises";
|
|
72253
|
-
import { dirname as
|
|
72689
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
72254
72690
|
|
|
72255
72691
|
// src/services/harness-session.service.ts
|
|
72256
|
-
import { open as open3, readdir as
|
|
72692
|
+
import { open as open3, readdir as readdir3, readFile as readFile6, stat as stat3 } from "node:fs/promises";
|
|
72257
72693
|
import { homedir as homedir2, hostname as hostname4 } from "node:os";
|
|
72258
|
-
import { dirname as
|
|
72694
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
72259
72695
|
|
|
72260
72696
|
// src/rules/claude-subagent.rules.ts
|
|
72261
72697
|
function lastCallAtOf({ text: text3, command }) {
|
|
@@ -72373,7 +72809,7 @@ function holds({ folder, inner }) {
|
|
|
72373
72809
|
const rel = relative2(resolve2(folder), resolve2(inner));
|
|
72374
72810
|
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
72375
72811
|
}
|
|
72376
|
-
async function
|
|
72812
|
+
async function claudeFoldersOf({
|
|
72377
72813
|
context,
|
|
72378
72814
|
claudePid
|
|
72379
72815
|
}) {
|
|
@@ -72384,12 +72820,14 @@ async function claudeProjectOf({
|
|
|
72384
72820
|
env.CLAUDE_PROJECT_DIR ? resolve2(env.CLAUDE_PROJECT_DIR) : void 0,
|
|
72385
72821
|
pid > 0 ? await context.processes.cwdOf(pid) : void 0
|
|
72386
72822
|
].filter((folder) => Boolean(folder));
|
|
72387
|
-
|
|
72823
|
+
const holding = candidates.find((folder) => holds({ folder, inner: context.cwd }));
|
|
72824
|
+
if (holding) return { folder: holding, elsewhere: void 0 };
|
|
72825
|
+
return { folder: resolve2(context.cwd), elsewhere: candidates[0] };
|
|
72388
72826
|
}
|
|
72389
72827
|
|
|
72390
72828
|
// src/services/session-notes.service.ts
|
|
72391
|
-
import { readdir, rm as rm2, stat as stat2 } from "node:fs/promises";
|
|
72392
|
-
import { dirname as
|
|
72829
|
+
import { readdir as readdir2, rm as rm2, stat as stat2 } from "node:fs/promises";
|
|
72830
|
+
import { dirname as dirname5, join as join5 } from "node:path";
|
|
72393
72831
|
function notePathOf({ context, pid }) {
|
|
72394
72832
|
return statePathOf({ context, kind: "sessions", profile: String(pid) });
|
|
72395
72833
|
}
|
|
@@ -72436,13 +72874,13 @@ async function sessionNotesOf({
|
|
|
72436
72874
|
context,
|
|
72437
72875
|
tell = true
|
|
72438
72876
|
}) {
|
|
72439
|
-
const folder =
|
|
72440
|
-
const files2 = await
|
|
72877
|
+
const folder = dirname5(notePathOf({ context, pid: 1 }));
|
|
72878
|
+
const files2 = await readdir2(folder).catch(() => []);
|
|
72441
72879
|
const notes = [];
|
|
72442
72880
|
const dropped = [];
|
|
72443
72881
|
for (const file4 of files2) {
|
|
72444
72882
|
const pid = Number(file4.replace(/\.json$/, ""));
|
|
72445
|
-
const path =
|
|
72883
|
+
const path = join5(folder, file4);
|
|
72446
72884
|
const note = pid ? await readStateJson({ path }) : void 0;
|
|
72447
72885
|
if (!note) continue;
|
|
72448
72886
|
const standing = await standingOf({ context, pid, note });
|
|
@@ -72572,14 +73010,14 @@ async function claudeTranscriptOf({
|
|
|
72572
73010
|
sessionId
|
|
72573
73011
|
}) {
|
|
72574
73012
|
const inherited = context.environment.inherited;
|
|
72575
|
-
const root =
|
|
72576
|
-
inherited.CLAUDE_CONFIG_DIR ||
|
|
73013
|
+
const root = join6(
|
|
73014
|
+
inherited.CLAUDE_CONFIG_DIR || join6(inherited.HOME || homedir2(), ".claude"),
|
|
72577
73015
|
"projects"
|
|
72578
73016
|
);
|
|
72579
|
-
const folders = await
|
|
73017
|
+
const folders = await readdir3(root).catch(() => []);
|
|
72580
73018
|
const found = await Promise.all(
|
|
72581
73019
|
folders.map(async (folder) => {
|
|
72582
|
-
const path =
|
|
73020
|
+
const path = join6(root, folder, `${sessionId}.jsonl`);
|
|
72583
73021
|
return stat3(path).then(
|
|
72584
73022
|
(info) => info.isFile() ? [{ path, at: info.mtimeMs }] : [],
|
|
72585
73023
|
() => []
|
|
@@ -72607,11 +73045,11 @@ async function runsInSubagent({ context, command }) {
|
|
|
72607
73045
|
if (!sessionId) return false;
|
|
72608
73046
|
const { path } = await claudeTranscriptOf({ context, sessionId });
|
|
72609
73047
|
if (!path) return false;
|
|
72610
|
-
const folder =
|
|
72611
|
-
const files2 = await
|
|
73048
|
+
const folder = join6(dirname6(path), sessionId, "subagents");
|
|
73049
|
+
const files2 = await readdir3(folder).catch(() => []);
|
|
72612
73050
|
const subagents = await Promise.all(
|
|
72613
73051
|
files2.filter((file4) => file4.endsWith(".jsonl")).map(
|
|
72614
|
-
async (file4) => lastCallAtOf({ text: await tailOf({ path:
|
|
73052
|
+
async (file4) => lastCallAtOf({ text: await tailOf({ path: join6(folder, file4) }), command })
|
|
72615
73053
|
)
|
|
72616
73054
|
);
|
|
72617
73055
|
const session = lastCallAtOf({ text: await tailOf({ path }), command });
|
|
@@ -72671,7 +73109,7 @@ async function notBoundNotice({
|
|
|
72671
73109
|
}
|
|
72672
73110
|
const key = session ? sessionKeyOf({ session }) : "unknown";
|
|
72673
73111
|
const path = statePathOf({ context, kind: "told", profile: key });
|
|
72674
|
-
const told = await
|
|
73112
|
+
const told = await readFile6(path, "utf8").then(
|
|
72675
73113
|
() => true,
|
|
72676
73114
|
() => false
|
|
72677
73115
|
);
|
|
@@ -72684,8 +73122,8 @@ async function notBoundNotice({
|
|
|
72684
73122
|
}
|
|
72685
73123
|
|
|
72686
73124
|
// src/services/plugin-hook.service.ts
|
|
72687
|
-
import { readFile as
|
|
72688
|
-
import { join as
|
|
73125
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
73126
|
+
import { join as join7 } from "node:path";
|
|
72689
73127
|
async function agentProfileHere({
|
|
72690
73128
|
context,
|
|
72691
73129
|
args,
|
|
@@ -72706,8 +73144,8 @@ async function agentProfileHere({
|
|
|
72706
73144
|
}
|
|
72707
73145
|
async function projectHooksHere({ context }) {
|
|
72708
73146
|
const directory = context.environment.inherited.CLAUDE_PROJECT_DIR || context.cwd;
|
|
72709
|
-
const path =
|
|
72710
|
-
return
|
|
73147
|
+
const path = join7(directory, ".claude", "settings.local.json");
|
|
73148
|
+
return readFile7(path, "utf8").then((text3) => hasLazeHooks({ settings: JSON.parse(text3) })).catch(() => false);
|
|
72711
73149
|
}
|
|
72712
73150
|
async function pluginHookArgs({
|
|
72713
73151
|
context,
|
|
@@ -72725,7 +73163,7 @@ async function pluginHookArgs({
|
|
|
72725
73163
|
var PRE_TOOL_TIMEOUT_MS = 3e3;
|
|
72726
73164
|
function statePath({ context, agent: agent3 }) {
|
|
72727
73165
|
const safe = agent3.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
72728
|
-
return
|
|
73166
|
+
return join8(dirname7(context.environment.configPath), "turns", `${safe}.json`);
|
|
72729
73167
|
}
|
|
72730
73168
|
async function readState({ context, agent: agent3 }) {
|
|
72731
73169
|
return readStateJson({ path: statePath({ context, agent: agent3 }) });
|
|
@@ -72838,7 +73276,7 @@ async function preToolHook({ context, args }) {
|
|
|
72838
73276
|
}
|
|
72839
73277
|
|
|
72840
73278
|
// src/services/message-files.service.ts
|
|
72841
|
-
import { readFile as
|
|
73279
|
+
import { readFile as readFile8, stat as stat4 } from "node:fs/promises";
|
|
72842
73280
|
import { basename as basename4, resolve as resolve3 } from "node:path";
|
|
72843
73281
|
|
|
72844
73282
|
// src/rules/file-types.rules.ts
|
|
@@ -72967,7 +73405,7 @@ async function local({ full }) {
|
|
|
72967
73405
|
return {
|
|
72968
73406
|
fileName,
|
|
72969
73407
|
contentType: contentTypeOf(fileName),
|
|
72970
|
-
bytes: new Uint8Array(await
|
|
73408
|
+
bytes: new Uint8Array(await readFile8(full))
|
|
72971
73409
|
};
|
|
72972
73410
|
}
|
|
72973
73411
|
async function attachmentIdsOf({
|
|
@@ -73590,7 +74028,7 @@ function channelLabelIn(channel) {
|
|
|
73590
74028
|
}
|
|
73591
74029
|
|
|
73592
74030
|
// src/services/claude-wait.service.ts
|
|
73593
|
-
import { readFile as
|
|
74031
|
+
import { readFile as readFile9, rm as rm6 } from "node:fs/promises";
|
|
73594
74032
|
|
|
73595
74033
|
// src/rules/listener-retry.rules.ts
|
|
73596
74034
|
var FIRST_MS = 1e3;
|
|
@@ -73629,7 +74067,7 @@ var ListenerBackoff = class {
|
|
|
73629
74067
|
// src/services/connect-service.service.ts
|
|
73630
74068
|
import { createHash as createHash2 } from "node:crypto";
|
|
73631
74069
|
import { mkdir as mkdir3, rm as rm5, writeFile } from "node:fs/promises";
|
|
73632
|
-
import { dirname as
|
|
74070
|
+
import { dirname as dirname13, join as join15 } from "node:path";
|
|
73633
74071
|
|
|
73634
74072
|
// src/rules/connect-service.rules.ts
|
|
73635
74073
|
function systemdWordOf(word3) {
|
|
@@ -73753,23 +74191,23 @@ function rolloutEventOf({
|
|
|
73753
74191
|
// src/services/connect-delivery.service.ts
|
|
73754
74192
|
import { rm as rm4, stat as stat5 } from "node:fs/promises";
|
|
73755
74193
|
import { homedir as homedir3, hostname as hostname5 } from "node:os";
|
|
73756
|
-
import { dirname as
|
|
74194
|
+
import { dirname as dirname12, join as join14 } from "node:path";
|
|
73757
74195
|
|
|
73758
74196
|
// src/services/codex-turn-watch.service.ts
|
|
73759
|
-
import { open as open4, readdir as
|
|
73760
|
-
import { basename as basename5, join as
|
|
74197
|
+
import { open as open4, readdir as readdir4 } from "node:fs/promises";
|
|
74198
|
+
import { basename as basename5, join as join9 } from "node:path";
|
|
73761
74199
|
var READ_MS = 1500;
|
|
73762
74200
|
var KEEP_WORKING_MS = 3e4;
|
|
73763
74201
|
async function codexRolloutPathOf({
|
|
73764
74202
|
codexHome,
|
|
73765
74203
|
threadId
|
|
73766
74204
|
}) {
|
|
73767
|
-
const root =
|
|
73768
|
-
const files2 = await
|
|
74205
|
+
const root = join9(codexHome, "sessions");
|
|
74206
|
+
const files2 = await readdir4(root, { recursive: true }).catch(() => []);
|
|
73769
74207
|
const file4 = files2.find(
|
|
73770
74208
|
(name3) => basename5(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
|
|
73771
74209
|
);
|
|
73772
|
-
return file4 ?
|
|
74210
|
+
return file4 ? join9(root, file4) : void 0;
|
|
73773
74211
|
}
|
|
73774
74212
|
function rolloutPathOf({ delivery }) {
|
|
73775
74213
|
return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
|
|
@@ -73858,7 +74296,7 @@ var CodexTurnWatch = class _CodexTurnWatch {
|
|
|
73858
74296
|
};
|
|
73859
74297
|
|
|
73860
74298
|
// src/services/mcp-relay.service.ts
|
|
73861
|
-
import { dirname as
|
|
74299
|
+
import { dirname as dirname8, join as join10 } from "node:path";
|
|
73862
74300
|
|
|
73863
74301
|
// ../../node_modules/.pnpm/ws@8.21.3_bufferutil@4.1.0/node_modules/ws/wrapper.mjs
|
|
73864
74302
|
var import_stream = __toESM(require_stream(), 1);
|
|
@@ -74194,7 +74632,7 @@ var STOPS = /* @__PURE__ */ new Map([
|
|
|
74194
74632
|
[CONNECTOR_RELAY_CLOSE.replaced.code, "another relay for this server took over"]
|
|
74195
74633
|
]);
|
|
74196
74634
|
function mcpRelaysPathOf({ context }) {
|
|
74197
|
-
return
|
|
74635
|
+
return join10(dirname8(context.environment.configPath), "connect", "mcp-relays.json");
|
|
74198
74636
|
}
|
|
74199
74637
|
async function readMcpRelays({ context }) {
|
|
74200
74638
|
return await readStateJson({ path: mcpRelaysPathOf({ context }) }) ?? {};
|
|
@@ -74354,7 +74792,7 @@ var McpRelayLoops = class _McpRelayLoops {
|
|
|
74354
74792
|
};
|
|
74355
74793
|
|
|
74356
74794
|
// src/services/openclaw-relay.service.ts
|
|
74357
|
-
import { dirname as
|
|
74795
|
+
import { dirname as dirname9, join as join11 } from "node:path";
|
|
74358
74796
|
|
|
74359
74797
|
// ../../modules/openclaw/contract/src/openclaw.ts
|
|
74360
74798
|
var workspaceIdSchema18 = external_exports.string().min(1);
|
|
@@ -74575,7 +75013,7 @@ var STOPS2 = /* @__PURE__ */ new Map([
|
|
|
74575
75013
|
[OPENCLAW_RELAY_CLOSE.replaced.code, "another relay for this gateway took over"]
|
|
74576
75014
|
]);
|
|
74577
75015
|
function relaysPathOf({ context }) {
|
|
74578
|
-
return
|
|
75016
|
+
return join11(dirname9(context.environment.configPath), "connect", "openclaw-relays.json");
|
|
74579
75017
|
}
|
|
74580
75018
|
async function readRelays({ context }) {
|
|
74581
75019
|
return await readStateJson({ path: relaysPathOf({ context }) }) ?? {};
|
|
@@ -74768,7 +75206,7 @@ var RelayLoops = class _RelayLoops {
|
|
|
74768
75206
|
};
|
|
74769
75207
|
|
|
74770
75208
|
// src/services/rush-host.service.ts
|
|
74771
|
-
import { dirname as
|
|
75209
|
+
import { dirname as dirname10, join as join12 } from "node:path";
|
|
74772
75210
|
async function rushAboveOf({
|
|
74773
75211
|
context,
|
|
74774
75212
|
from = context.processes.pid
|
|
@@ -74782,7 +75220,7 @@ async function rushAboveOf({
|
|
|
74782
75220
|
return void 0;
|
|
74783
75221
|
}
|
|
74784
75222
|
function guardPathOf({ context, claudePid }) {
|
|
74785
|
-
return
|
|
75223
|
+
return join12(dirname10(context.environment.configPath), "rush-guards", `${claudePid}.json`);
|
|
74786
75224
|
}
|
|
74787
75225
|
async function startRushGuard({
|
|
74788
75226
|
context,
|
|
@@ -74795,7 +75233,7 @@ async function startRushGuard({
|
|
|
74795
75233
|
if (holder && context.processes.alive(holder.pid)) return;
|
|
74796
75234
|
const flags2 = ["--profile", profile, "--claude-pid", String(claudePid), "--rush-id", rush.id];
|
|
74797
75235
|
const argv = [...context.program, "hook", "rush-wake", ...flags2, "--rush-program", rush.program];
|
|
74798
|
-
const logPath =
|
|
75236
|
+
const logPath = join12(dirname10(context.environment.configPath), "rush-guards", "guard.log");
|
|
74799
75237
|
context.processes.spawnDetached({ argv: ["sh", "-c", '"$@" &', "sh", ...argv], logPath });
|
|
74800
75238
|
}
|
|
74801
75239
|
async function claimRushGuard({
|
|
@@ -74913,7 +75351,7 @@ async function rearmRushGuards({ context }) {
|
|
|
74913
75351
|
|
|
74914
75352
|
// src/services/rush-watchdog.service.ts
|
|
74915
75353
|
import { appendFile, mkdir as mkdir2 } from "node:fs/promises";
|
|
74916
|
-
import { dirname as
|
|
75354
|
+
import { dirname as dirname11, join as join13 } from "node:path";
|
|
74917
75355
|
var UNDELIVERED_AFTER_MS = 6e4;
|
|
74918
75356
|
var CHECK_TIMEOUT_MS = 5e3;
|
|
74919
75357
|
function clientOf({ context, profile }) {
|
|
@@ -74949,13 +75387,13 @@ function boundAwayOf({ waiting, key }) {
|
|
|
74949
75387
|
return `${sessionLabelOf(bound)} (${bound.harness}:${bound.sessionId})`;
|
|
74950
75388
|
}
|
|
74951
75389
|
async function logDelivery({ context, line }) {
|
|
74952
|
-
const folder =
|
|
75390
|
+
const folder = join13(dirname11(context.environment.configPath), "connect");
|
|
74953
75391
|
const at = Temporal3.Instant.fromEpochMilliseconds(context.nowMs());
|
|
74954
75392
|
const stamped = `${at.toString({ smallestUnit: "second" })} ${line}
|
|
74955
75393
|
`;
|
|
74956
75394
|
context.out(stamped);
|
|
74957
75395
|
await mkdir2(folder, { recursive: true, mode: 448 });
|
|
74958
|
-
await appendFile(
|
|
75396
|
+
await appendFile(join13(folder, "delivery.log"), stamped, { mode: 384 });
|
|
74959
75397
|
}
|
|
74960
75398
|
async function claimFor({
|
|
74961
75399
|
context,
|
|
@@ -75031,10 +75469,10 @@ async function watchRushDelivery({
|
|
|
75031
75469
|
|
|
75032
75470
|
// src/services/connect-delivery.service.ts
|
|
75033
75471
|
function connectFolderOf({ context }) {
|
|
75034
|
-
return
|
|
75472
|
+
return join14(dirname12(context.environment.configPath), "connect");
|
|
75035
75473
|
}
|
|
75036
75474
|
function runStatePathOf({ context }) {
|
|
75037
|
-
return
|
|
75475
|
+
return join14(connectFolderOf({ context }), "run.json");
|
|
75038
75476
|
}
|
|
75039
75477
|
async function readJson({ path }) {
|
|
75040
75478
|
return readStateJson({ path });
|
|
@@ -75332,17 +75770,17 @@ var CONNECT_SERVICE_USAGE = `laze connect install|status|stop|uninstall|run: the
|
|
|
75332
75770
|
\`laze openclaw connect --local\` and \`laze kanban connect\`, whose relays it also runs.
|
|
75333
75771
|
`;
|
|
75334
75772
|
function installedPathOf({ context }) {
|
|
75335
|
-
return
|
|
75773
|
+
return join15(connectFolderOf({ context }), "service.json");
|
|
75336
75774
|
}
|
|
75337
75775
|
function logPathOf({ context }) {
|
|
75338
|
-
return
|
|
75776
|
+
return join15(connectFolderOf({ context }), "connect.log");
|
|
75339
75777
|
}
|
|
75340
75778
|
function homeOf({ context }) {
|
|
75341
|
-
return context.environment.inherited.HOME ??
|
|
75779
|
+
return context.environment.inherited.HOME ?? dirname13(dirname13(context.environment.configPath));
|
|
75342
75780
|
}
|
|
75343
75781
|
function serviceNameOf({ context }) {
|
|
75344
75782
|
const { configPath } = context.environment;
|
|
75345
|
-
if (configPath ===
|
|
75783
|
+
if (configPath === join15(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
|
|
75346
75784
|
return `laze-connect-${createHash2("sha256").update(configPath).digest("hex").slice(0, 8)}`;
|
|
75347
75785
|
}
|
|
75348
75786
|
function serviceEnvOf({ context }) {
|
|
@@ -75365,9 +75803,9 @@ async function run({ context, command }) {
|
|
|
75365
75803
|
async function installSystemd({ context }) {
|
|
75366
75804
|
const name3 = serviceNameOf({ context });
|
|
75367
75805
|
const env = context.environment.inherited;
|
|
75368
|
-
const base = env.XDG_CONFIG_HOME ||
|
|
75369
|
-
const file4 =
|
|
75370
|
-
await mkdir3(
|
|
75806
|
+
const base = env.XDG_CONFIG_HOME || join15(homeOf({ context }), ".config");
|
|
75807
|
+
const file4 = join15(base, "systemd", "user", `${name3}.service`);
|
|
75808
|
+
await mkdir3(dirname13(file4), { recursive: true });
|
|
75371
75809
|
await writeFile(
|
|
75372
75810
|
file4,
|
|
75373
75811
|
systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
|
|
@@ -75381,9 +75819,9 @@ async function installSystemd({ context }) {
|
|
|
75381
75819
|
async function installLaunchd({ context }) {
|
|
75382
75820
|
const name3 = serviceNameOf({ context });
|
|
75383
75821
|
const label3 = `ai.laze.${name3}`;
|
|
75384
|
-
const file4 =
|
|
75822
|
+
const file4 = join15(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
|
|
75385
75823
|
const log = logPathOf({ context });
|
|
75386
|
-
await mkdir3(
|
|
75824
|
+
await mkdir3(dirname13(file4), { recursive: true });
|
|
75387
75825
|
await writeFile(
|
|
75388
75826
|
file4,
|
|
75389
75827
|
launchAgentOf({
|
|
@@ -75754,7 +76192,7 @@ async function waitForMessages({ context, args }) {
|
|
|
75754
76192
|
if (rush) await healRushDelivery({ context });
|
|
75755
76193
|
const lock = statePathOf({ context, kind: "waiters", profile: name3 });
|
|
75756
76194
|
if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
|
|
75757
|
-
const seen = () => input2.transcript_path ?
|
|
76195
|
+
const seen = () => input2.transcript_path ? readFile9(input2.transcript_path, "utf8") : Promise.resolve("");
|
|
75758
76196
|
const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
|
|
75759
76197
|
try {
|
|
75760
76198
|
const backoff = new ListenerBackoff();
|
|
@@ -75805,7 +76243,7 @@ async function refusedOnce({
|
|
|
75805
76243
|
}) {
|
|
75806
76244
|
const profile = String(args.flags.profile ?? "default");
|
|
75807
76245
|
const path = statePathOf({ context, kind: "told", profile: `refused-${profile}` });
|
|
75808
|
-
const told = await
|
|
76246
|
+
const told = await readFile9(path, "utf8").then(
|
|
75809
76247
|
() => true,
|
|
75810
76248
|
() => false
|
|
75811
76249
|
);
|
|
@@ -75862,14 +76300,14 @@ async function monitorServes({
|
|
|
75862
76300
|
|
|
75863
76301
|
// src/services/codex-link.service.ts
|
|
75864
76302
|
import { createReadStream } from "node:fs";
|
|
75865
|
-
import { readdir as
|
|
75866
|
-
import { join as
|
|
76303
|
+
import { readdir as readdir6, rm as rm8, stat as stat7 } from "node:fs/promises";
|
|
76304
|
+
import { join as join17, resolve as resolve4 } from "node:path";
|
|
75867
76305
|
import { createInterface as createInterface2 } from "node:readline";
|
|
75868
76306
|
|
|
75869
76307
|
// src/services/codex-adopt.service.ts
|
|
75870
76308
|
import { spawn as spawn2 } from "node:child_process";
|
|
75871
|
-
import { readdir as
|
|
75872
|
-
import { join as
|
|
76309
|
+
import { readdir as readdir5, rm as rm7, stat as stat6 } from "node:fs/promises";
|
|
76310
|
+
import { join as join16 } from "node:path";
|
|
75873
76311
|
import { createInterface } from "node:readline";
|
|
75874
76312
|
|
|
75875
76313
|
// src/rules/codex-requests.rules.ts
|
|
@@ -75989,11 +76427,11 @@ var CodexAppServer = class _CodexAppServer {
|
|
|
75989
76427
|
}
|
|
75990
76428
|
};
|
|
75991
76429
|
async function newestThreadId({ codexHome }) {
|
|
75992
|
-
const root =
|
|
75993
|
-
const files2 = await
|
|
76430
|
+
const root = join16(codexHome, "sessions");
|
|
76431
|
+
const files2 = await readdir5(root, { recursive: true }).catch(() => []);
|
|
75994
76432
|
const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
|
|
75995
76433
|
const dated = await Promise.all(
|
|
75996
|
-
rollouts.map(async (file4) => ({ file: file4, at: (await stat6(
|
|
76434
|
+
rollouts.map(async (file4) => ({ file: file4, at: (await stat6(join16(root, file4))).mtimeMs }))
|
|
75997
76435
|
);
|
|
75998
76436
|
const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
|
|
75999
76437
|
const id4 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
|
|
@@ -76254,13 +76692,13 @@ async function newestThreadIn({
|
|
|
76254
76692
|
codexHome,
|
|
76255
76693
|
directory
|
|
76256
76694
|
}) {
|
|
76257
|
-
const root =
|
|
76258
|
-
const files2 = await
|
|
76695
|
+
const root = join17(codexHome, "sessions");
|
|
76696
|
+
const files2 = await readdir6(root, { recursive: true }).catch(() => []);
|
|
76259
76697
|
const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
|
|
76260
76698
|
const dated = await Promise.all(
|
|
76261
76699
|
rollouts.map(async (file4) => ({
|
|
76262
|
-
path:
|
|
76263
|
-
at: await stat7(
|
|
76700
|
+
path: join17(root, file4),
|
|
76701
|
+
at: await stat7(join17(root, file4)).then(
|
|
76264
76702
|
(info) => info.mtimeMs,
|
|
76265
76703
|
() => 0
|
|
76266
76704
|
)
|
|
@@ -76330,16 +76768,16 @@ async function linkCodexSession({
|
|
|
76330
76768
|
}
|
|
76331
76769
|
|
|
76332
76770
|
// src/services/laze-plugin.service.ts
|
|
76333
|
-
import { mkdir as mkdir4, readFile as
|
|
76771
|
+
import { mkdir as mkdir4, readFile as readFile10, rm as rm9, writeFile as writeFile2 } from "node:fs/promises";
|
|
76334
76772
|
import { homedir as homedir4 } from "node:os";
|
|
76335
|
-
import { dirname as
|
|
76773
|
+
import { dirname as dirname14, join as join19 } from "node:path";
|
|
76336
76774
|
|
|
76337
76775
|
// src/rules/laze-plugin.rules.ts
|
|
76338
76776
|
import { createHash as createHash3 } from "node:crypto";
|
|
76339
|
-
import { join as
|
|
76777
|
+
import { join as join18 } from "node:path";
|
|
76340
76778
|
var LAZE_PLUGIN = "laze";
|
|
76341
76779
|
function pluginNameOf({ configPath, home }) {
|
|
76342
|
-
if (configPath ===
|
|
76780
|
+
if (configPath === join18(home, ".laze", "config.json")) return LAZE_PLUGIN;
|
|
76343
76781
|
return `${LAZE_PLUGIN}-${createHash3("sha256").update(configPath).digest("hex").slice(0, 8)}`;
|
|
76344
76782
|
}
|
|
76345
76783
|
var NPX_CLI = ["npx", "-y", "@lazehq/cli@latest"];
|
|
@@ -76469,7 +76907,9 @@ guide first: https://laze.so/docs/agents/apps.md. The short version:
|
|
|
76469
76907
|
an attachment means exactly that: do it, do not ask.
|
|
76470
76908
|
- Slides, a deck or a talk: start from \`laze app create <name> --template slides\`. Each slide
|
|
76471
76909
|
is a file in slides/, listed in order in slides/deck.json; the deck presents full screen and
|
|
76472
|
-
exports PDF and HTML on its own.
|
|
76910
|
+
exports PDF and HTML on its own. People who can change the app also edit the deck on its page
|
|
76911
|
+
(reorder, move, resize, retype), each change a live version: \`laze app pull\` before you change
|
|
76912
|
+
a deck and keep its data-el attributes. A deck made earlier gets this with \`laze app upgrade\`.
|
|
76473
76913
|
An app that already exists goes in with \`laze app pin <app> --channel <channel>\`, never as a
|
|
76474
76914
|
pinned message with a link. A pin opens it to everyone there, and their agents may build on it.
|
|
76475
76915
|
- A new app is Restricted. Do not share it with only the person who asked when they asked in a
|
|
@@ -76585,11 +77025,11 @@ function installedNameOf({ context }) {
|
|
|
76585
77025
|
return `${name3}@${name3}`;
|
|
76586
77026
|
}
|
|
76587
77027
|
function pluginFolderOf({ context }) {
|
|
76588
|
-
return
|
|
77028
|
+
return join19(dirname14(context.environment.configPath), "plugins");
|
|
76589
77029
|
}
|
|
76590
77030
|
async function pluginIsCurrent({ context }) {
|
|
76591
|
-
const manifest =
|
|
76592
|
-
const written = await
|
|
77031
|
+
const manifest = join19(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
|
|
77032
|
+
const written = await readFile10(manifest, "utf8").then((text3) => JSON.parse(text3).version).catch(() => void 0);
|
|
76593
77033
|
return written === cliVersionOf();
|
|
76594
77034
|
}
|
|
76595
77035
|
async function writeLazePlugin({ context }) {
|
|
@@ -76601,8 +77041,8 @@ async function writeLazePlugin({ context }) {
|
|
|
76601
77041
|
configPath: context.environment.configPath
|
|
76602
77042
|
});
|
|
76603
77043
|
for (const [path, text3] of Object.entries(files2)) {
|
|
76604
|
-
const target =
|
|
76605
|
-
await mkdir4(
|
|
77044
|
+
const target = join19(folder, path);
|
|
77045
|
+
await mkdir4(dirname14(target), { recursive: true });
|
|
76606
77046
|
await writeFile2(target, text3);
|
|
76607
77047
|
}
|
|
76608
77048
|
return folder;
|
|
@@ -76632,7 +77072,7 @@ async function registerWithClaude({ context, folder }) {
|
|
|
76632
77072
|
return claudeScript({ context, script });
|
|
76633
77073
|
}
|
|
76634
77074
|
function claudeDirOf({ context }) {
|
|
76635
|
-
return context.environment.inherited.CLAUDE_CONFIG_DIR ||
|
|
77075
|
+
return context.environment.inherited.CLAUDE_CONFIG_DIR || join19(homeOf2({ context }), ".claude");
|
|
76636
77076
|
}
|
|
76637
77077
|
function unregisterAs({ context, name: name3 }) {
|
|
76638
77078
|
const script = [
|
|
@@ -76643,8 +77083,8 @@ function unregisterAs({ context, name: name3 }) {
|
|
|
76643
77083
|
}
|
|
76644
77084
|
async function dropOwnLeftover({ context, folder }) {
|
|
76645
77085
|
if (pluginNameHere({ context }) === LAZE_PLUGIN) return;
|
|
76646
|
-
const known = await
|
|
76647
|
-
|
|
77086
|
+
const known = await readFile10(
|
|
77087
|
+
join19(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
|
|
76648
77088
|
"utf8"
|
|
76649
77089
|
).then((text3) => JSON.parse(text3)).catch(() => void 0);
|
|
76650
77090
|
if (known?.[LAZE_PLUGIN]?.source?.path !== folder) return;
|
|
@@ -76652,17 +77092,17 @@ async function dropOwnLeftover({ context, folder }) {
|
|
|
76652
77092
|
}
|
|
76653
77093
|
var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
|
|
76654
77094
|
async function cachedPluginOf({ context }) {
|
|
76655
|
-
const path =
|
|
76656
|
-
const listed = await
|
|
77095
|
+
const path = join19(claudeDirOf({ context }), "plugins", "installed_plugins.json");
|
|
77096
|
+
const listed = await readFile10(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
|
|
76657
77097
|
return listed?.plugins?.[installedNameOf({ context })]?.[0]?.installPath;
|
|
76658
77098
|
}
|
|
76659
77099
|
async function refreshStaleCache({ context, folder }) {
|
|
76660
77100
|
const cached2 = await cachedPluginOf({ context });
|
|
76661
77101
|
if (!cached2) return true;
|
|
76662
|
-
const read4 = (path) =>
|
|
77102
|
+
const read4 = (path) => readFile10(path, "utf8").catch(() => "");
|
|
76663
77103
|
for (const file4 of RUN_FILES) {
|
|
76664
|
-
const ours = await read4(
|
|
76665
|
-
if (ours === await read4(
|
|
77104
|
+
const ours = await read4(join19(folder, LAZE_PLUGIN, file4));
|
|
77105
|
+
if (ours === await read4(join19(cached2, file4))) continue;
|
|
76666
77106
|
const plugin2 = installedNameOf({ context });
|
|
76667
77107
|
const script = [
|
|
76668
77108
|
`claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
|
|
@@ -76673,10 +77113,10 @@ async function refreshStaleCache({ context, folder }) {
|
|
|
76673
77113
|
return true;
|
|
76674
77114
|
}
|
|
76675
77115
|
function registeredMarkOf({ context }) {
|
|
76676
|
-
return
|
|
77116
|
+
return join19(pluginFolderOf({ context }), "registered");
|
|
76677
77117
|
}
|
|
76678
77118
|
async function pluginRegistered({ context }) {
|
|
76679
|
-
return
|
|
77119
|
+
return readFile10(registeredMarkOf({ context }), "utf8").then(
|
|
76680
77120
|
() => true,
|
|
76681
77121
|
() => false
|
|
76682
77122
|
);
|
|
@@ -76691,7 +77131,7 @@ async function installLazePlugin({ context }) {
|
|
|
76691
77131
|
async function plugin({ context, args }) {
|
|
76692
77132
|
const action = args.words[1] ?? "install";
|
|
76693
77133
|
if (action === "path") {
|
|
76694
|
-
context.out(`${
|
|
77134
|
+
context.out(`${join19(pluginFolderOf({ context }), LAZE_PLUGIN)}
|
|
76695
77135
|
`);
|
|
76696
77136
|
return 0;
|
|
76697
77137
|
}
|
|
@@ -76890,7 +77330,7 @@ async function pushInbox({
|
|
|
76890
77330
|
}
|
|
76891
77331
|
|
|
76892
77332
|
// src/services/plugin-tip.service.ts
|
|
76893
|
-
import { readFile as
|
|
77333
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
76894
77334
|
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.";
|
|
76895
77335
|
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.";
|
|
76896
77336
|
function monitorsRunHere({ context }) {
|
|
@@ -76932,7 +77372,7 @@ async function reloadTipOnce({
|
|
|
76932
77372
|
}) {
|
|
76933
77373
|
if (!session || !monitorsRunHere({ context })) return void 0;
|
|
76934
77374
|
if (!await pluginRegistered({ context })) return void 0;
|
|
76935
|
-
const told = await
|
|
77375
|
+
const told = await readFile11(toldPathOf({ context, session }), "utf8").then(
|
|
76936
77376
|
() => true,
|
|
76937
77377
|
() => false
|
|
76938
77378
|
);
|
|
@@ -77002,9 +77442,9 @@ async function installHooks({
|
|
|
77002
77442
|
directory,
|
|
77003
77443
|
profile
|
|
77004
77444
|
}) {
|
|
77005
|
-
const folder =
|
|
77006
|
-
const path =
|
|
77007
|
-
const text3 = await
|
|
77445
|
+
const folder = join20(directory, ".claude");
|
|
77446
|
+
const path = join20(folder, "settings.local.json");
|
|
77447
|
+
const text3 = await readFile12(path, "utf8").catch(() => "{}");
|
|
77008
77448
|
const current3 = settingsOf({ path, text: text3 });
|
|
77009
77449
|
const command = (hook) => hookCommand({ program: context.program, profile, hook });
|
|
77010
77450
|
const settings3 = withLazeHooks({
|
|
@@ -77096,6 +77536,7 @@ async function linkAgent({ context, args }) {
|
|
|
77096
77536
|
const token2 = flagText({ args, name: "token" });
|
|
77097
77537
|
if (!token2) throw new CliUsageError("Usage: laze agent link --token <token>");
|
|
77098
77538
|
await refuseInSubagent({ context, args, command: /\bagent\s+link\b/ });
|
|
77539
|
+
await noteNewerInstall({ context });
|
|
77099
77540
|
const url2 = serverUrlOf({ context, args });
|
|
77100
77541
|
const { harness, pid } = await harnessOf2({ context, args });
|
|
77101
77542
|
const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
|
|
@@ -77113,8 +77554,16 @@ async function sessionFolderOf({
|
|
|
77113
77554
|
pid
|
|
77114
77555
|
}) {
|
|
77115
77556
|
const asked = flagText({ args, name: "project" });
|
|
77116
|
-
if (asked) return resolve5(context.cwd, asked);
|
|
77117
|
-
|
|
77557
|
+
if (asked) return { folder: resolve5(context.cwd, asked), elsewhere: void 0 };
|
|
77558
|
+
if (!claude) return { folder: context.cwd, elsewhere: void 0 };
|
|
77559
|
+
return claudeFoldersOf({ context, claudePid: pid });
|
|
77560
|
+
}
|
|
77561
|
+
function elsewhereLinesOf({ folder, elsewhere }) {
|
|
77562
|
+
if (!elsewhere) return [];
|
|
77563
|
+
return [
|
|
77564
|
+
`Claude Code itself runs in ${elsewhere}, not in this folder, so this link is for ${folder}, where you ran it.`,
|
|
77565
|
+
`If ${elsewhere} is the session's folder, link again from there with a new token, or with --project ${elsewhere}.`
|
|
77566
|
+
];
|
|
77118
77567
|
}
|
|
77119
77568
|
async function settleLinked({
|
|
77120
77569
|
context,
|
|
@@ -77130,7 +77579,7 @@ async function settleLinked({
|
|
|
77130
77579
|
profiles: (await context.store.read()).profiles
|
|
77131
77580
|
});
|
|
77132
77581
|
const claude = harness === "claude-code";
|
|
77133
|
-
const directory = await sessionFolderOf({ context, args, claude, pid });
|
|
77582
|
+
const { folder: directory, elsewhere } = await sessionFolderOf({ context, args, claude, pid });
|
|
77134
77583
|
await context.store.saveProfile({
|
|
77135
77584
|
name: name3,
|
|
77136
77585
|
bindDirectory: directory,
|
|
@@ -77158,7 +77607,7 @@ async function settleLinked({
|
|
|
77158
77607
|
const hooked = claude && !args.flags["no-hook"];
|
|
77159
77608
|
const hookPath = hooked ? await installHooks({ context, directory, profile: name3 }) : void 0;
|
|
77160
77609
|
if (hooked) await listenAfterLink({ context, args, profile: name3, claudePid: pid });
|
|
77161
|
-
const laze =
|
|
77610
|
+
const { command: laze, shadow } = await rerunCommandOf({ context });
|
|
77162
77611
|
const steps = await nextStepsFor({
|
|
77163
77612
|
context,
|
|
77164
77613
|
args,
|
|
@@ -77172,6 +77621,8 @@ async function settleLinked({
|
|
|
77172
77621
|
[
|
|
77173
77622
|
`Linked as ${linked.agent.name} (${linked.agent.id}), profile "${name3}" for ${directory}.`,
|
|
77174
77623
|
...hookPath ? [`Added the Laze hooks to ${hookPath}.`] : [],
|
|
77624
|
+
...elsewhereLinesOf({ folder: directory, elsewhere }),
|
|
77625
|
+
...shadowedLinkLineOf({ shadow }),
|
|
77175
77626
|
"",
|
|
77176
77627
|
steps,
|
|
77177
77628
|
""
|
|
@@ -77227,7 +77678,7 @@ async function reportTranscript({
|
|
|
77227
77678
|
input: input2
|
|
77228
77679
|
}) {
|
|
77229
77680
|
if (!input2.transcript_path || !input2.session_id) return;
|
|
77230
|
-
const lines2 = (await
|
|
77681
|
+
const lines2 = (await readFile12(input2.transcript_path, "utf8")).split("\n");
|
|
77231
77682
|
const context = readTranscript({ lines: lines2 });
|
|
77232
77683
|
await client.post("/api/agents/me/activity", {
|
|
77233
77684
|
sessionId: input2.session_id,
|
|
@@ -77266,7 +77717,7 @@ async function handOver({ context, args }) {
|
|
|
77266
77717
|
const kept = await dueFromSpool({
|
|
77267
77718
|
context,
|
|
77268
77719
|
profile: agent3,
|
|
77269
|
-
seen: () => input2.transcript_path ?
|
|
77720
|
+
seen: () => input2.transcript_path ? readFile12(input2.transcript_path, "utf8") : Promise.resolve(""),
|
|
77270
77721
|
pushedToo: false,
|
|
77271
77722
|
settledOnly: true
|
|
77272
77723
|
});
|
|
@@ -77307,14 +77758,14 @@ async function addSessionStartWaiter({ context, args }) {
|
|
|
77307
77758
|
const directory = context.environment.inherited.CLAUDE_PROJECT_DIR;
|
|
77308
77759
|
const profile = flagText({ args, name: "profile" });
|
|
77309
77760
|
if (!directory || !profile) return;
|
|
77310
|
-
const path =
|
|
77311
|
-
const settings3 = await
|
|
77761
|
+
const path = join20(directory, ".claude", "settings.local.json");
|
|
77762
|
+
const settings3 = await readFile12(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
|
|
77312
77763
|
if (!settings3 || !lacksSessionStartWaiter({ settings: settings3 })) return;
|
|
77313
77764
|
await installHooks({ context, directory, profile });
|
|
77314
77765
|
}
|
|
77315
77766
|
async function refreshPlugin({ context }) {
|
|
77316
77767
|
if (await pluginIsCurrent({ context })) return;
|
|
77317
|
-
const logPath =
|
|
77768
|
+
const logPath = join20(pluginFolderOf({ context }), "install.log");
|
|
77318
77769
|
context.processes.spawnDetached({ argv: [...context.program, "plugin", "install"], logPath });
|
|
77319
77770
|
}
|
|
77320
77771
|
async function stopHook({ context, args }) {
|
|
@@ -77335,7 +77786,7 @@ async function stopHook({ context, args }) {
|
|
|
77335
77786
|
}
|
|
77336
77787
|
|
|
77337
77788
|
// src/services/agent-manage-commands.service.ts
|
|
77338
|
-
import { readFile as
|
|
77789
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
77339
77790
|
import { extname, resolve as resolve6 } from "node:path";
|
|
77340
77791
|
|
|
77341
77792
|
// src/rules/login-format.rules.ts
|
|
@@ -77468,7 +77919,7 @@ async function avatarOf({
|
|
|
77468
77919
|
return emoji4;
|
|
77469
77920
|
}
|
|
77470
77921
|
if (!path) return void 0;
|
|
77471
|
-
const bytes = await
|
|
77922
|
+
const bytes = await readFile13(resolve6(context.cwd, path)).catch(() => {
|
|
77472
77923
|
throw new CliUsageError(`laze: cannot read the avatar file ${path}.`);
|
|
77473
77924
|
});
|
|
77474
77925
|
const uploaded = await client.post("/api/agents/avatars", {
|
|
@@ -78184,8 +78635,8 @@ async function setAgentRunsOn({
|
|
|
78184
78635
|
}
|
|
78185
78636
|
|
|
78186
78637
|
// src/services/agent-migrate-commands.service.ts
|
|
78187
|
-
import { readFile as
|
|
78188
|
-
import { basename as basename6, join as
|
|
78638
|
+
import { readFile as readFile14, stat as stat8 } from "node:fs/promises";
|
|
78639
|
+
import { basename as basename6, join as join21, resolve as resolve7 } from "node:path";
|
|
78189
78640
|
|
|
78190
78641
|
// src/rules/migration-upload.rules.ts
|
|
78191
78642
|
import { createHash as createHash4 } from "node:crypto";
|
|
@@ -78422,7 +78873,7 @@ async function transcriptOf({ context, args, ticket }) {
|
|
|
78422
78873
|
if (ticket.source === "codex") {
|
|
78423
78874
|
const codexHome = context.environment.codexHome;
|
|
78424
78875
|
const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
|
|
78425
|
-
return { sessionId, path: path2, where:
|
|
78876
|
+
return { sessionId, path: path2, where: join21(codexHome, "sessions") };
|
|
78426
78877
|
}
|
|
78427
78878
|
const { root, path } = await claudeTranscriptOf({ context, sessionId });
|
|
78428
78879
|
return { sessionId, path, where: root };
|
|
@@ -78474,7 +78925,7 @@ async function uploadTranscript({ context, args, client }) {
|
|
|
78474
78925
|
`The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
|
|
78475
78926
|
);
|
|
78476
78927
|
}
|
|
78477
|
-
const raw = await
|
|
78928
|
+
const raw = await readFile14(found.path, "utf8");
|
|
78478
78929
|
if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
|
|
78479
78930
|
const redacted = await redactTranscript({ text: raw });
|
|
78480
78931
|
const { parts, truncated } = transcriptPartsOf({
|
|
@@ -78732,8 +79183,8 @@ async function requestAgent({ context, args }) {
|
|
|
78732
79183
|
}
|
|
78733
79184
|
|
|
78734
79185
|
// src/services/app-commands.service.ts
|
|
78735
|
-
import { mkdir as mkdir6, readdir as
|
|
78736
|
-
import { dirname as
|
|
79186
|
+
import { mkdir as mkdir6, readdir as readdir7, readFile as readFile16, writeFile as writeFile5 } from "node:fs/promises";
|
|
79187
|
+
import { dirname as dirname15, join as join24, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
|
|
78737
79188
|
|
|
78738
79189
|
// ../../modules/app/contract/src/app.connections.ts
|
|
78739
79190
|
var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
|
|
@@ -79734,6 +80185,22 @@ var appFaultClaimsSchemaDefinition = external_exports.object({
|
|
|
79734
80185
|
page: external_exports.string().max(600)
|
|
79735
80186
|
});
|
|
79736
80187
|
|
|
80188
|
+
// ../../modules/app/contract/src/app.self-edit.ts
|
|
80189
|
+
var selfEditAppInputSchemaDefinition = external_exports.object({ token: external_exports.string().min(1).max(15e5) });
|
|
80190
|
+
var selfEditedAppSchemaDefinition = external_exports.object({ version: external_exports.string().min(1), live: external_exports.boolean() });
|
|
80191
|
+
var appEditClaimsSchemaDefinition = external_exports.object({
|
|
80192
|
+
iss: external_exports.literal("laze-apps"),
|
|
80193
|
+
aud: external_exports.array(external_exports.string()).refine((aud) => aud.includes("laze-app-edit")),
|
|
80194
|
+
exp: external_exports.number().int(),
|
|
80195
|
+
wid: external_exports.string().min(1),
|
|
80196
|
+
app: external_exports.string().min(1),
|
|
80197
|
+
vid: external_exports.string().min(1),
|
|
80198
|
+
base: external_exports.string().min(1).max(64),
|
|
80199
|
+
files: external_exports.array(external_exports.object({ path: external_exports.string().min(1).max(300), content: external_exports.string().max(6e5) })).max(20).nullable().transform((files2) => files2 ?? []),
|
|
80200
|
+
remove: external_exports.array(external_exports.string().min(1).max(300)).max(20).nullable().optional().transform((paths) => paths ?? []),
|
|
80201
|
+
msg: external_exports.string().min(1).max(500)
|
|
80202
|
+
});
|
|
80203
|
+
|
|
79737
80204
|
// ../../modules/app/contract/src/app.quota.ts
|
|
79738
80205
|
var APP_QUOTA_LIMITS = [
|
|
79739
80206
|
"app_database_bytes",
|
|
@@ -80288,6 +80755,11 @@ var appTemplateManifestSchemaDefinition = external_exports.object({
|
|
|
80288
80755
|
entry: external_exports.string().min(1).max(200),
|
|
80289
80756
|
/** One or two sentences an agent reads first: how to change an app made from it. */
|
|
80290
80757
|
guide: external_exports.string().trim().max(500).optional(),
|
|
80758
|
+
/**
|
|
80759
|
+
* Files the template owns and the app's author leaves as they are (a deck's engine): updating
|
|
80760
|
+
* an app to a newer template version writes only these.
|
|
80761
|
+
*/
|
|
80762
|
+
engine: external_exports.array(external_exports.string().min(1).max(200)).max(20).optional(),
|
|
80291
80763
|
collections: templateCollectionsSchema,
|
|
80292
80764
|
views: external_exports.array(appViewSpecSchema).default([]),
|
|
80293
80765
|
seed: external_exports.record(collectionNameSchema, external_exports.array(appRecordSchema)).default({})
|
|
@@ -80312,6 +80784,17 @@ var somethingToWrite = {
|
|
|
80312
80784
|
var writeAppFilesInputSchemaDefinition = external_exports.object({ workspaceId: external_exports.string().min(1), ...writeAppFilesShape }).refine(somethingToWrite.check, { message: somethingToWrite.message });
|
|
80313
80785
|
var writeAppFilesByKeyInputSchemaDefinition = external_exports.object(writeAppFilesShape).refine(somethingToWrite.check, { message: somethingToWrite.message });
|
|
80314
80786
|
var appTemplatesByKeyQuerySchemaDefinition = external_exports.object({});
|
|
80787
|
+
var upgradeAppTemplateByKeyInputSchemaDefinition = external_exports.object({ appId: external_exports.string().min(1) });
|
|
80788
|
+
var appTemplateUpgradeSchemaDefinition = external_exports.object({
|
|
80789
|
+
upgraded: external_exports.boolean(),
|
|
80790
|
+
/** The new live version; null when nothing changed. */
|
|
80791
|
+
version: external_exports.string().nullable(),
|
|
80792
|
+
templateName: appTemplateNameSchema,
|
|
80793
|
+
templateVersion: external_exports.number().int().positive(),
|
|
80794
|
+
/** The files written over the live version. */
|
|
80795
|
+
files: external_exports.array(external_exports.string())
|
|
80796
|
+
});
|
|
80797
|
+
var appTemplateUpgradeSchema = appTemplateUpgradeSchemaDefinition;
|
|
80315
80798
|
|
|
80316
80799
|
// ../../modules/app/contract/src/app.trpc.ts
|
|
80317
80800
|
var APP_LIST_PATH = "app.list";
|
|
@@ -80326,7 +80809,7 @@ var appsCopy = {
|
|
|
80326
80809
|
var appMainTrpc = defineTrpcContract("app").query("list", { mirrored: appsCopy }).withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(appPushSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(appDataRefSchema).withOutput(external_exports.array(collectionSchema)).query("records").withInput(listRecordsInputSchema).withOutput(recordPageSchema).mutation("writeRecord").withInput(writeRecordInputSchema).withOutput(appRecordSchema).mutation("deleteRecord").withInput(deleteRecordInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("views").withInput(appDataRefSchema).withOutput(external_exports.array(appViewSchema)).mutation("saveView").withInput(saveViewInputSchema).withOutput(appViewSchema).mutation("deleteView").withInput(deleteViewInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("chooseCardRows").withInput(chooseCardRowsInputSchema).withOutput(appCardChoiceSchema).query("exportRecords").withInput(exportRecordsInputSchema).withOutput(recordExportSchema).mutation("importRecords").withInput(importRecordsInputSchema).withOutput(recordImportSchema).mutation("decidePublish").withInput(decidePublishInputSchema).withOutput(publishOutcomeSchema).mutation("nameVersion").withInput(nameVersionInputSchema).withOutput(appVersionSchema).mutation("makeInternal").withInput(appRefSchema).withOutput(appSchema).mutation("revokePublishLease").withInput(appRefSchema).withOutput(appSchema).mutation("signInHandoff").withInput(signInHandoffInputSchema).withOutput(signInHandoffSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("access").withInput(appRefSchema).withOutput(appAccessSchema).query("members").withInput(appRefSchema).withOutput(appMembersSchema).mutation("grantAccess").withInput(grantAppAccessInputSchema).withOutput(appAccessSchema).mutation("revokeAccess").withInput(revokeAppAccessInputSchema).withOutput(appAccessSchema).mutation("setVisibility").withInput(setAppVisibilityInputSchema).withOutput(visibilityOutcomeSchema).mutation("setMemberRole").withInput(setMemberRoleInputSchema).withOutput(appAccessSchema).mutation("unpublish").withInput(appRefSchema).withOutput(appSchema).query("door").withInput(appRefSchema).withOutput(appDoorSchema).mutation("requestAccess").withInput(appRefSchema).withOutput(appDoorSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).query("backups").withInput(appRefSchema).withOutput(appBackupStatusSchema).mutation("restoreData").withInput(restoreAppDataInputSchema).withOutput(appRestoreSchema).query("cost").withInput(appRefSchema).withOutput(appCostSchema).mutation("setBudget").withInput(setAppBudgetInputSchema).withOutput(appCostSchema).query("triggers").withInput(appRefSchema).withOutput(appTriggersSchema).mutation("setTriggerPaused").withInput(setAppTriggerPausedInputSchema).withOutput(appTriggerSchema).mutation("removeTrigger").withInput(appTriggerRefSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
|
|
80327
80810
|
var appConnectionsTrpc = defineTrpcContract("app").query("connections").withInput(appRefSchema).withOutput(appConnectionsSchema).mutation("allowConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).mutation("revokeConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).build();
|
|
80328
80811
|
var appPinsTrpc = defineTrpcContract("app").query("pins").withInput(channelPinsInputSchema).withOutput(channelAppPinsSchema).mutation("pin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("unpin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("setPinView").withInput(setPinViewInputSchema).withOutput(channelAppPinsSchema).mutation("reorderPins").withInput(reorderPinsInputSchema).withOutput(channelAppPinsSchema).mutation("setPinRole").withInput(setPinRoleInputSchema).withOutput(appAccessSchema).build();
|
|
80329
|
-
var appSettingsTrpc = defineTrpcContract("app").query("workspaceSettings").withInput(appWorkspaceRefSchema).withOutput(appWorkspaceSettingsSchema).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).mutation("setPublicAppsAllowed").withInput(setPublicAppsAllowedInputSchema).withOutput(appFunctionSettingsSchema).query("workspaceApps").withInput(listWorkspaceAppsInputSchema).withOutput(external_exports.array(workspaceAppSchema)).mutation("setOwner").withInput(setAppOwnerInputSchema).withOutput(workspaceAppSchema).mutation("unpublishAsAdmin").withInput(appRefSchema).withOutput(external_exports.object({ unpublished: external_exports.literal(true) })).query("templates").withInput(appWorkspaceRefSchema).withOutput(external_exports.array(appTemplateSchema)).build();
|
|
80812
|
+
var appSettingsTrpc = defineTrpcContract("app").query("workspaceSettings").withInput(appWorkspaceRefSchema).withOutput(appWorkspaceSettingsSchema).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).mutation("setPublicAppsAllowed").withInput(setPublicAppsAllowedInputSchema).withOutput(appFunctionSettingsSchema).query("workspaceApps").withInput(listWorkspaceAppsInputSchema).withOutput(external_exports.array(workspaceAppSchema)).mutation("setOwner").withInput(setAppOwnerInputSchema).withOutput(workspaceAppSchema).mutation("unpublishAsAdmin").withInput(appRefSchema).withOutput(external_exports.object({ unpublished: external_exports.literal(true) })).query("templates").withInput(appWorkspaceRefSchema).withOutput(external_exports.array(appTemplateSchema)).mutation("upgradeTemplate").withInput(appRefSchema).withOutput(appTemplateUpgradeSchema).build();
|
|
80330
80813
|
var appTrpc = joinTrpcContracts(
|
|
80331
80814
|
"app",
|
|
80332
80815
|
appMainTrpc,
|
|
@@ -80432,6 +80915,12 @@ var appCliCommands = [
|
|
|
80432
80915
|
arguments: [],
|
|
80433
80916
|
summary: "List the templates an app can start from, with their versions"
|
|
80434
80917
|
},
|
|
80918
|
+
{
|
|
80919
|
+
command: "laze app upgrade",
|
|
80920
|
+
operation: "upgradeTemplate",
|
|
80921
|
+
arguments: ["[app]"],
|
|
80922
|
+
summary: "Bring an app made from a template (a deck) to the template's current version: the template's engine files (deck.js) are written over the live app as a new version, every slide and style stays. Run laze app pull afterwards"
|
|
80923
|
+
},
|
|
80435
80924
|
{
|
|
80436
80925
|
command: "laze app list",
|
|
80437
80926
|
operation: "listApps",
|
|
@@ -81243,7 +81732,7 @@ async function appPinsCommand({
|
|
|
81243
81732
|
import { execFile } from "node:child_process";
|
|
81244
81733
|
import { mkdtemp, rm as rm11, writeFile as writeFile4 } from "node:fs/promises";
|
|
81245
81734
|
import { tmpdir } from "node:os";
|
|
81246
|
-
import { join as
|
|
81735
|
+
import { join as join22 } from "node:path";
|
|
81247
81736
|
import { promisify } from "node:util";
|
|
81248
81737
|
var run2 = promisify(execFile);
|
|
81249
81738
|
var MODULE_SYNTAX = /^\s*(import|export)\s/m;
|
|
@@ -81272,11 +81761,11 @@ async function scriptErrorsOf({
|
|
|
81272
81761
|
const unknown2 = unknownCollectionsOf({ files: files2, collections });
|
|
81273
81762
|
const scripts = files2.flatMap(scriptsOf);
|
|
81274
81763
|
if (scripts.length === 0) return unknown2;
|
|
81275
|
-
const dir = await mkdtemp(
|
|
81764
|
+
const dir = await mkdtemp(join22(tmpdir(), "laze-app-check-"));
|
|
81276
81765
|
try {
|
|
81277
81766
|
const errors = await Promise.all(
|
|
81278
81767
|
scripts.map(async (script, index) => {
|
|
81279
|
-
const file4 =
|
|
81768
|
+
const file4 = join22(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
|
|
81280
81769
|
await writeFile4(file4, script.code);
|
|
81281
81770
|
try {
|
|
81282
81771
|
await run2(process.execPath, ["--check", file4]);
|
|
@@ -81294,9 +81783,9 @@ async function scriptErrorsOf({
|
|
|
81294
81783
|
}
|
|
81295
81784
|
|
|
81296
81785
|
// src/services/app-serve.service.ts
|
|
81297
|
-
import { readFile as
|
|
81786
|
+
import { readFile as readFile15, stat as stat9 } from "node:fs/promises";
|
|
81298
81787
|
import { createServer } from "node:http";
|
|
81299
|
-
import { extname as extname2, join as
|
|
81788
|
+
import { extname as extname2, join as join23, normalize, sep as sep2 } from "node:path";
|
|
81300
81789
|
var TYPES2 = {
|
|
81301
81790
|
".html": "text/html; charset=utf-8",
|
|
81302
81791
|
".js": "text/javascript; charset=utf-8",
|
|
@@ -81347,13 +81836,13 @@ async function staticFile({
|
|
|
81347
81836
|
if (clean.startsWith("..") || hidden) {
|
|
81348
81837
|
return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
|
|
81349
81838
|
}
|
|
81350
|
-
const candidates = [
|
|
81351
|
-
if (!extname2(clean)) candidates.push(
|
|
81839
|
+
const candidates = [join23(folder, clean), join23(folder, clean, "index.html")];
|
|
81840
|
+
if (!extname2(clean)) candidates.push(join23(folder, "index.html"));
|
|
81352
81841
|
for (const target of candidates) {
|
|
81353
81842
|
const info = await stat9(target).catch(() => void 0);
|
|
81354
81843
|
if (!info?.isFile()) continue;
|
|
81355
81844
|
const type = TYPES2[extname2(target).toLowerCase()] ?? "application/octet-stream";
|
|
81356
|
-
const body = await
|
|
81845
|
+
const body = await readFile15(target);
|
|
81357
81846
|
if (extname2(target) === ".html") {
|
|
81358
81847
|
return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
|
|
81359
81848
|
}
|
|
@@ -81588,7 +82077,7 @@ async function turnTokenOf2({
|
|
|
81588
82077
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
81589
82078
|
if (pinned) return pinned;
|
|
81590
82079
|
if (env.LAZE_TURN_FILE) {
|
|
81591
|
-
return
|
|
82080
|
+
return readFile16(env.LAZE_TURN_FILE, "utf8").then(
|
|
81592
82081
|
(text3) => text3.trim(),
|
|
81593
82082
|
() => ""
|
|
81594
82083
|
);
|
|
@@ -81618,7 +82107,7 @@ function folderOf({ context, word: word3 }) {
|
|
|
81618
82107
|
return resolve8(context.cwd, word3 ?? ".");
|
|
81619
82108
|
}
|
|
81620
82109
|
async function readManifest(folder) {
|
|
81621
|
-
const text3 = await
|
|
82110
|
+
const text3 = await readFile16(join24(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
|
|
81622
82111
|
if (text3 === void 0) return void 0;
|
|
81623
82112
|
const parsed = appManifestSchema.safeParse(JSON.parse(text3));
|
|
81624
82113
|
if (!parsed.success) {
|
|
@@ -81659,7 +82148,7 @@ async function jsonFlag({
|
|
|
81659
82148
|
}) {
|
|
81660
82149
|
const raw = flagText({ args, name: name3 });
|
|
81661
82150
|
if (!raw) return void 0;
|
|
81662
|
-
const text3 = raw.startsWith("@") ? await
|
|
82151
|
+
const text3 = raw.startsWith("@") ? await readFile16(resolve8(context.cwd, raw.slice(1)), "utf8") : raw;
|
|
81663
82152
|
try {
|
|
81664
82153
|
return JSON.parse(text3);
|
|
81665
82154
|
} catch {
|
|
@@ -81671,8 +82160,8 @@ async function listFiles(folder) {
|
|
|
81671
82160
|
const pending2 = [folder];
|
|
81672
82161
|
while (pending2.length > 0 && found.length <= MAX_FILES) {
|
|
81673
82162
|
const current3 = pending2.pop() ?? folder;
|
|
81674
|
-
for (const entry of await
|
|
81675
|
-
const path =
|
|
82163
|
+
for (const entry of await readdir7(current3, { withFileTypes: true })) {
|
|
82164
|
+
const path = join24(current3, entry.name);
|
|
81676
82165
|
const rel = relative3(folder, path).split(sep3).join("/");
|
|
81677
82166
|
if (isSkippedPath({ path: rel })) continue;
|
|
81678
82167
|
if (entry.isDirectory()) pending2.push(path);
|
|
@@ -81711,8 +82200,8 @@ var appCreate = async ({ context, args }) => {
|
|
|
81711
82200
|
await mkdir6(folder, { recursive: true });
|
|
81712
82201
|
const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
|
|
81713
82202
|
for (const file4 of start2?.files ?? []) {
|
|
81714
|
-
const target =
|
|
81715
|
-
await mkdir6(
|
|
82203
|
+
const target = join24(folder, ...file4.path.split("/"));
|
|
82204
|
+
await mkdir6(dirname15(target), { recursive: true });
|
|
81716
82205
|
await writeFile5(
|
|
81717
82206
|
target,
|
|
81718
82207
|
file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
|
|
@@ -81724,7 +82213,7 @@ var appCreate = async ({ context, args }) => {
|
|
|
81724
82213
|
views: [...start2?.template.views ?? []],
|
|
81725
82214
|
seed: { ...start2?.template.seed }
|
|
81726
82215
|
};
|
|
81727
|
-
await writeFile5(
|
|
82216
|
+
await writeFile5(join24(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
81728
82217
|
`);
|
|
81729
82218
|
const where = relative3(context.cwd, folder) || ".";
|
|
81730
82219
|
print5({
|
|
@@ -81796,7 +82285,7 @@ var appPush = async ({ context, args }) => {
|
|
|
81796
82285
|
paths.map(
|
|
81797
82286
|
async (path) => buildFileOf({
|
|
81798
82287
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
81799
|
-
bytes: await
|
|
82288
|
+
bytes: await readFile16(path)
|
|
81800
82289
|
})
|
|
81801
82290
|
)
|
|
81802
82291
|
);
|
|
@@ -81866,7 +82355,7 @@ var appWrite = async ({ context, args }) => {
|
|
|
81866
82355
|
const path = resolve8(context.cwd, word3);
|
|
81867
82356
|
const { bytes: _bytes, ...file4 } = buildFileOf({
|
|
81868
82357
|
path: relative3(folder, path).split(sep3).join("/"),
|
|
81869
|
-
bytes: await
|
|
82358
|
+
bytes: await readFile16(path)
|
|
81870
82359
|
});
|
|
81871
82360
|
return file4;
|
|
81872
82361
|
})
|
|
@@ -81955,7 +82444,7 @@ async function folderClaim({
|
|
|
81955
82444
|
folder,
|
|
81956
82445
|
appId
|
|
81957
82446
|
}) {
|
|
81958
|
-
const entries = await
|
|
82447
|
+
const entries = await readdir7(folder).catch(() => []);
|
|
81959
82448
|
if (entries.length === 0) return "empty";
|
|
81960
82449
|
const manifest = await readManifest(folder).catch(() => void 0);
|
|
81961
82450
|
if (!manifest) return "other-files";
|
|
@@ -81993,8 +82482,8 @@ var appPull = async ({ context, args }) => {
|
|
|
81993
82482
|
);
|
|
81994
82483
|
}
|
|
81995
82484
|
for (const file4 of pulled.files) {
|
|
81996
|
-
const target =
|
|
81997
|
-
await mkdir6(
|
|
82485
|
+
const target = join24(folder, ...file4.path.split("/"));
|
|
82486
|
+
await mkdir6(dirname15(target), { recursive: true });
|
|
81998
82487
|
await writeFile5(
|
|
81999
82488
|
target,
|
|
82000
82489
|
file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
|
|
@@ -82012,7 +82501,7 @@ var appPull = async ({ context, args }) => {
|
|
|
82012
82501
|
])
|
|
82013
82502
|
)
|
|
82014
82503
|
};
|
|
82015
|
-
await writeFile5(
|
|
82504
|
+
await writeFile5(join24(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
|
|
82016
82505
|
`);
|
|
82017
82506
|
const names = pulled.collections.map((collection) => collection.name);
|
|
82018
82507
|
const where = relative3(context.cwd, folder) || ".";
|
|
@@ -82327,7 +82816,7 @@ var appImport = async ({ context, args }) => {
|
|
|
82327
82816
|
const words = args.words.slice(2);
|
|
82328
82817
|
const [named, collection, file4] = words.length >= 3 ? words : [void 0, ...words];
|
|
82329
82818
|
if (!collection || !file4) throw new CliUsageError(USAGE5);
|
|
82330
|
-
const csv = await
|
|
82819
|
+
const csv = await readFile16(resolve8(context.cwd, file4), "utf8").catch(() => {
|
|
82331
82820
|
throw new CliUsageError(`Cannot read ${file4}`);
|
|
82332
82821
|
});
|
|
82333
82822
|
const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
|
|
@@ -82639,6 +83128,14 @@ var appCost = async ({ context, args }) => {
|
|
|
82639
83128
|
const cost = await client.post("/api/apps/cost", { appId });
|
|
82640
83129
|
print5({ context, args, value: cost, text: costText({ name: name3, cost }) });
|
|
82641
83130
|
};
|
|
83131
|
+
var appUpgrade = async ({ context, args }) => {
|
|
83132
|
+
const { client, appId, name: name3 } = await appOfWord({ context, args, word: args.words[2] });
|
|
83133
|
+
const done = await client.post("/api/apps/template/upgrade", { appId });
|
|
83134
|
+
const text3 = done.upgraded ? `${name3} now runs the ${done.templateName} template version ${done.templateVersion}: wrote ${done.files.join(", ")} as live version ${done.version?.slice(0, 7) ?? ""}. Run laze app pull before your next push so your folder has it.
|
|
83135
|
+
` : `${name3} is already on the ${done.templateName} template version ${done.templateVersion}; nothing changed.
|
|
83136
|
+
`;
|
|
83137
|
+
print5({ context, args, value: done, text: text3 });
|
|
83138
|
+
};
|
|
82642
83139
|
var appBudget = async ({ context, args }) => {
|
|
82643
83140
|
const words = args.words.slice(2);
|
|
82644
83141
|
const [word3, amount] = words.length >= 2 ? words : [void 0, ...words];
|
|
@@ -82662,6 +83159,7 @@ function managed(command) {
|
|
|
82662
83159
|
var APP_COMMANDS = {
|
|
82663
83160
|
create: appCreate,
|
|
82664
83161
|
templates: appTemplates,
|
|
83162
|
+
upgrade: appUpgrade,
|
|
82665
83163
|
list: appList,
|
|
82666
83164
|
push: appPush,
|
|
82667
83165
|
write: appWrite,
|
|
@@ -83184,13 +83682,13 @@ async function billing({ context, args }) {
|
|
|
83184
83682
|
|
|
83185
83683
|
// src/services/browser-commands.service.ts
|
|
83186
83684
|
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
83187
|
-
import { readFile as
|
|
83188
|
-
import { dirname as
|
|
83685
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
83686
|
+
import { dirname as dirname17, join as join27 } from "node:path";
|
|
83189
83687
|
|
|
83190
83688
|
// src/services/browser-tab-commands.service.ts
|
|
83191
83689
|
import { mkdir as mkdir7, writeFile as writeFile6 } from "node:fs/promises";
|
|
83192
83690
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
83193
|
-
import { join as
|
|
83691
|
+
import { join as join26 } from "node:path";
|
|
83194
83692
|
|
|
83195
83693
|
// src/rules/browser-login.rules.ts
|
|
83196
83694
|
var PASSWORD_NAME = /pass|pwd/i;
|
|
@@ -83221,9 +83719,9 @@ function loginValuesOf({
|
|
|
83221
83719
|
|
|
83222
83720
|
// src/services/vault-commands.service.ts
|
|
83223
83721
|
import { createHash as createHash6 } from "node:crypto";
|
|
83224
|
-
import { readFile as
|
|
83722
|
+
import { readFile as readFile17, rm as rm12 } from "node:fs/promises";
|
|
83225
83723
|
import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
|
|
83226
|
-
import { dirname as
|
|
83724
|
+
import { dirname as dirname16, join as join25 } from "node:path";
|
|
83227
83725
|
|
|
83228
83726
|
// src/rules/vault-session.rules.ts
|
|
83229
83727
|
function vaultSessionOf({
|
|
@@ -83288,7 +83786,7 @@ async function turnTokenOf3({
|
|
|
83288
83786
|
if (pinned) return pinned;
|
|
83289
83787
|
if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
83290
83788
|
try {
|
|
83291
|
-
return (await
|
|
83789
|
+
return (await readFile17(turnFile, "utf8")).trim();
|
|
83292
83790
|
} catch {
|
|
83293
83791
|
throw new CliUsageError(`${command} works only during an agent's turn`);
|
|
83294
83792
|
}
|
|
@@ -83299,8 +83797,8 @@ function runKeyPathOf({
|
|
|
83299
83797
|
profile = ""
|
|
83300
83798
|
}) {
|
|
83301
83799
|
const name3 = createHash6("sha256").update(connection).digest("hex");
|
|
83302
|
-
const base = turnFile ?
|
|
83303
|
-
return
|
|
83800
|
+
const base = turnFile ? dirname16(turnFile) : join25(tmpdir2(), "laze-vault", profile);
|
|
83801
|
+
return join25(base, "vault-run-keys", `${name3}.json`);
|
|
83304
83802
|
}
|
|
83305
83803
|
async function runKeyAt({ path }) {
|
|
83306
83804
|
const saved3 = await readStateJson({
|
|
@@ -83825,9 +84323,9 @@ async function savedScreenshot({
|
|
|
83825
84323
|
data,
|
|
83826
84324
|
nowMs: nowMs2
|
|
83827
84325
|
}) {
|
|
83828
|
-
const folder =
|
|
84326
|
+
const folder = join26(tmpdir3(), "laze-browser");
|
|
83829
84327
|
await mkdir7(folder, { recursive: true, mode: 448 });
|
|
83830
|
-
const path =
|
|
84328
|
+
const path = join26(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs2}.jpg`);
|
|
83831
84329
|
await writeFile6(path, Buffer.from(data, "base64"), { mode: 384 });
|
|
83832
84330
|
return path;
|
|
83833
84331
|
}
|
|
@@ -84304,7 +84802,7 @@ async function turnTokenOf4({
|
|
|
84304
84802
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
84305
84803
|
if (pinned) return pinned;
|
|
84306
84804
|
if (env.LAZE_TURN_FILE) {
|
|
84307
|
-
return
|
|
84805
|
+
return readFile18(env.LAZE_TURN_FILE, "utf8").then(
|
|
84308
84806
|
(text3) => text3.trim(),
|
|
84309
84807
|
() => ""
|
|
84310
84808
|
);
|
|
@@ -84394,7 +84892,7 @@ async function answering({
|
|
|
84394
84892
|
}
|
|
84395
84893
|
function bridgeStatePath({ context, machine: machine2 }) {
|
|
84396
84894
|
const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
84397
|
-
return
|
|
84895
|
+
return join27(dirname17(context.environment.configPath), "bridges", `${safe}.json`);
|
|
84398
84896
|
}
|
|
84399
84897
|
async function bridgePort({
|
|
84400
84898
|
context,
|
|
@@ -85106,13 +85604,13 @@ async function channelSettings({ context, args }) {
|
|
|
85106
85604
|
}
|
|
85107
85605
|
|
|
85108
85606
|
// src/services/chat-actions-commands.service.ts
|
|
85109
|
-
import { readFile as
|
|
85607
|
+
import { readFile as readFile19 } from "node:fs/promises";
|
|
85110
85608
|
import { basename as basename8, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve10 } from "node:path";
|
|
85111
85609
|
|
|
85112
85610
|
// src/services/file-download.service.ts
|
|
85113
85611
|
import { createWriteStream } from "node:fs";
|
|
85114
85612
|
import { mkdir as mkdir8, rename as rename3, rm as rm13, stat as stat10, truncate } from "node:fs/promises";
|
|
85115
|
-
import { basename as basename7, dirname as
|
|
85613
|
+
import { basename as basename7, dirname as dirname18, resolve as resolve9 } from "node:path";
|
|
85116
85614
|
import { Readable, Transform } from "node:stream";
|
|
85117
85615
|
import { pipeline } from "node:stream/promises";
|
|
85118
85616
|
var NOT_READY_WAIT_MS = 5e3;
|
|
@@ -85232,8 +85730,8 @@ async function downloadFile({
|
|
|
85232
85730
|
out
|
|
85233
85731
|
}) {
|
|
85234
85732
|
const asked = out ? resolve9(context.cwd, out) : void 0;
|
|
85235
|
-
const part = resolve9(asked ?
|
|
85236
|
-
await mkdir8(
|
|
85733
|
+
const part = resolve9(asked ? dirname18(asked) : context.cwd, `.${attachmentId}.part`);
|
|
85734
|
+
await mkdir8(dirname18(part), { recursive: true });
|
|
85237
85735
|
const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
|
|
85238
85736
|
async (error63) => {
|
|
85239
85737
|
await rm13(part, { force: true });
|
|
@@ -85505,7 +86003,7 @@ function uploadNameOf({ cwd, path }) {
|
|
|
85505
86003
|
}
|
|
85506
86004
|
var fileUpload = async ({ context, args, client }) => {
|
|
85507
86005
|
const path = resolve10(context.cwd, wordAt(args, 3));
|
|
85508
|
-
const bytes = new Uint8Array(await
|
|
86006
|
+
const bytes = new Uint8Array(await readFile19(path));
|
|
85509
86007
|
const answer6 = await uploadFile({
|
|
85510
86008
|
context,
|
|
85511
86009
|
client,
|
|
@@ -85998,7 +86496,7 @@ var computeConfig = Config.define((c) => ({
|
|
|
85998
86496
|
external_exports.string().min(1).default("rg.fr-par.scw.cloud/laze-prod/laze-browser-machine:latest")
|
|
85999
86497
|
),
|
|
86000
86498
|
/** `b` on the spare api (ADR-206): its link sweeps run only while it holds machine links. */
|
|
86001
|
-
apiSlot
|
|
86499
|
+
apiSlot,
|
|
86002
86500
|
/** Who sells dedicated IPs, on once its keys are set; `memory` locally, `none` for off. */
|
|
86003
86501
|
ipVendor: c.env(
|
|
86004
86502
|
"LAZE_IP_VENDOR",
|
|
@@ -86016,6 +86514,44 @@ var computeConfig = Config.define((c) => ({
|
|
|
86016
86514
|
whatsappMirrorObserve: c.env("WHATSAPP_MIRROR_OBSERVE", external_exports.enum(["on", "off"]).default("off"))
|
|
86017
86515
|
}));
|
|
86018
86516
|
|
|
86517
|
+
// ../../modules/compute/contract/src/computer-waitlist.ts
|
|
86518
|
+
var workspaceIdSchema19 = external_exports.string().min(1).max(64);
|
|
86519
|
+
var computerRoomInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema19 });
|
|
86520
|
+
var computerRoomInputSchema = computerRoomInputDefinition;
|
|
86521
|
+
var computerRoomDefinition2 = external_exports.object({
|
|
86522
|
+
room: external_exports.enum(["ok", "full"]),
|
|
86523
|
+
/** The caller waits on the list in this workspace. */
|
|
86524
|
+
waitlisted: external_exports.boolean()
|
|
86525
|
+
});
|
|
86526
|
+
var computerRoomAnswerSchema = computerRoomDefinition2;
|
|
86527
|
+
var computerWaitlistReasonSchema = external_exports.enum(["first_run", "invitee"]);
|
|
86528
|
+
var joinComputerWaitlistDefinition = external_exports.object({
|
|
86529
|
+
workspaceId: workspaceIdSchema19,
|
|
86530
|
+
/** The app page the claim email and notice link back to; a relative path such as /w/... */
|
|
86531
|
+
returnPath: external_exports.string().min(1).max(2048),
|
|
86532
|
+
reason: computerWaitlistReasonSchema
|
|
86533
|
+
});
|
|
86534
|
+
var joinComputerWaitlistInputSchema = joinComputerWaitlistDefinition;
|
|
86535
|
+
var computerWaitlistJoinedDefinition = external_exports.object({
|
|
86536
|
+
waitlisted: external_exports.literal(true),
|
|
86537
|
+
position: external_exports.number().int().positive()
|
|
86538
|
+
});
|
|
86539
|
+
var computerWaitlistJoinedSchema = computerWaitlistJoinedDefinition;
|
|
86540
|
+
var computeWaitlistTrpc = defineTrpcContract("compute").query("computerRoom").withInput(computerRoomInputSchema).withOutput(computerRoomAnswerSchema).mutation("joinComputerWaitlist").withInput(joinComputerWaitlistInputSchema).withOutput(computerWaitlistJoinedSchema).build();
|
|
86541
|
+
var computeWaitlistSweepStateDefinition = external_exports.object({ lastSweepAt: external_exports.number().nullable() });
|
|
86542
|
+
var computeWaitlistSweepIntentDefinition = external_exports.object({ scheduledFor: external_exports.number() });
|
|
86543
|
+
var computerWaitlistChangedDefinition = external_exports.object({
|
|
86544
|
+
workspaceId: external_exports.string().min(1),
|
|
86545
|
+
userId: external_exports.string().min(1),
|
|
86546
|
+
entryId: external_exports.string().min(1),
|
|
86547
|
+
change: external_exports.enum(["joined", "claimed"]),
|
|
86548
|
+
reason: computerWaitlistReasonSchema,
|
|
86549
|
+
/** How long the person waited, in milliseconds; null on joining. */
|
|
86550
|
+
waitedMs: external_exports.number().int().nonnegative().nullable(),
|
|
86551
|
+
changeId: external_exports.string().min(1),
|
|
86552
|
+
at: external_exports.iso.datetime()
|
|
86553
|
+
});
|
|
86554
|
+
|
|
86019
86555
|
// ../../modules/billing/contract/src/billing.config.ts
|
|
86020
86556
|
var priceId = external_exports.string().min(1).optional();
|
|
86021
86557
|
var billingConfig = Config.define((c) => ({
|
|
@@ -86196,6 +86732,19 @@ var referralRewardedDefinition = external_exports.object({
|
|
|
86196
86732
|
outcome: external_exports.enum(["discount", "banked", "credits"]),
|
|
86197
86733
|
at: external_exports.iso.datetime()
|
|
86198
86734
|
});
|
|
86735
|
+
var checkoutChangedDefinition = external_exports.object({
|
|
86736
|
+
workspaceId: external_exports.string().min(1),
|
|
86737
|
+
/** The Stripe Checkout session id. */
|
|
86738
|
+
checkoutId: external_exports.string().min(1),
|
|
86739
|
+
kind: external_exports.enum(["team", "credits"]),
|
|
86740
|
+
/** `abandoned` is Stripe expiring the session unpaid, 24 hours after it opened. */
|
|
86741
|
+
stage: external_exports.enum(["started", "completed", "abandoned"]),
|
|
86742
|
+
/** The promotion whose coupon the Checkout carries (`tlc-2026-11`); null when none. */
|
|
86743
|
+
promotionId: external_exports.string().nullable(),
|
|
86744
|
+
/** The person who opened the Checkout, when known. */
|
|
86745
|
+
byUserId: external_exports.string().nullable(),
|
|
86746
|
+
at: external_exports.iso.datetime()
|
|
86747
|
+
});
|
|
86199
86748
|
var creditCheckStateDefinition = external_exports.object({ nextWakeAt: external_exports.number().nullable() });
|
|
86200
86749
|
var creditCheckIntentDefinition = external_exports.object({ workspaceId: external_exports.string().min(1) });
|
|
86201
86750
|
|
|
@@ -87015,7 +87564,7 @@ var dedicatedIpKeyReleasedDefinition = external_exports.object({
|
|
|
87015
87564
|
});
|
|
87016
87565
|
|
|
87017
87566
|
// ../../modules/compute/contract/src/own-machine-ssh.ts
|
|
87018
|
-
var
|
|
87567
|
+
var workspaceIdSchema20 = external_exports.string().min(1).max(64);
|
|
87019
87568
|
var machineRefText = external_exports.string().min(1).max(64);
|
|
87020
87569
|
var sshHostKeySchema = external_exports.string().regex(/^SHA256:[A-Za-z0-9+/]{43}$/);
|
|
87021
87570
|
function sshTargetText({ target }) {
|
|
@@ -87037,7 +87586,7 @@ var machineSshDefinition = external_exports.object({
|
|
|
87037
87586
|
});
|
|
87038
87587
|
var machineSshSchema = machineSshDefinition;
|
|
87039
87588
|
var connectSshDefinition = external_exports.object({
|
|
87040
|
-
workspaceId:
|
|
87589
|
+
workspaceId: workspaceIdSchema20,
|
|
87041
87590
|
/** Checked by `checkMachineName`, so a refusal reads as a sentence. */
|
|
87042
87591
|
name: external_exports.string().max(200),
|
|
87043
87592
|
/** `user@host[:port]`, checked by `parseSshTarget`. */
|
|
@@ -87046,7 +87595,7 @@ var connectSshDefinition = external_exports.object({
|
|
|
87046
87595
|
var connectSshMachineInputSchema = connectSshDefinition;
|
|
87047
87596
|
var restConnectSshDefinition = connectSshDefinition.omit({ workspaceId: true });
|
|
87048
87597
|
var trustHostKeyDefinition = external_exports.object({
|
|
87049
|
-
workspaceId:
|
|
87598
|
+
workspaceId: workspaceIdSchema20,
|
|
87050
87599
|
machine: machineRefText,
|
|
87051
87600
|
hostKey: sshHostKeySchema
|
|
87052
87601
|
});
|
|
@@ -87133,7 +87682,7 @@ var setAgentAccessDefinition = external_exports.object({
|
|
|
87133
87682
|
var setWhatsappAgentAccessInputSchema = setAgentAccessDefinition;
|
|
87134
87683
|
|
|
87135
87684
|
// ../../modules/compute/contract/src/own-machine-whatsapp.ts
|
|
87136
|
-
var
|
|
87685
|
+
var workspaceIdSchema21 = external_exports.string().min(1).max(64);
|
|
87137
87686
|
var machineRefText2 = external_exports.string().min(1).max(64);
|
|
87138
87687
|
var WHATSAPP_TEXT_MAX = 4096;
|
|
87139
87688
|
var WHATSAPP_LIMIT_MAX = 200;
|
|
@@ -87185,7 +87734,7 @@ var messagesResultDefinition = external_exports.object({
|
|
|
87185
87734
|
messages: external_exports.array(whatsappMessageDefinition)
|
|
87186
87735
|
});
|
|
87187
87736
|
var chatPeopleInputDefinition = external_exports.object({
|
|
87188
|
-
workspaceId:
|
|
87737
|
+
workspaceId: workspaceIdSchema21,
|
|
87189
87738
|
channelId: external_exports.string().min(1).max(64)
|
|
87190
87739
|
});
|
|
87191
87740
|
var whatsappChatPeopleInputSchema = chatPeopleInputDefinition;
|
|
@@ -87202,13 +87751,13 @@ var readAskFields = {
|
|
|
87202
87751
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_READ_WAIT_MAX_SECONDS).optional()
|
|
87203
87752
|
};
|
|
87204
87753
|
var chatsInputDefinition = external_exports.object({
|
|
87205
|
-
workspaceId:
|
|
87754
|
+
workspaceId: workspaceIdSchema21,
|
|
87206
87755
|
machine: whatsappMachineRef,
|
|
87207
87756
|
limit: limitSchema.optional(),
|
|
87208
87757
|
...readAskFields
|
|
87209
87758
|
});
|
|
87210
87759
|
var readInputDefinition = external_exports.object({
|
|
87211
|
-
workspaceId:
|
|
87760
|
+
workspaceId: workspaceIdSchema21,
|
|
87212
87761
|
machine: whatsappMachineRef,
|
|
87213
87762
|
/** A chat id, a phone number or a contact or group name. */
|
|
87214
87763
|
chat: chatRefSchema,
|
|
@@ -87216,7 +87765,7 @@ var readInputDefinition = external_exports.object({
|
|
|
87216
87765
|
...readAskFields
|
|
87217
87766
|
});
|
|
87218
87767
|
var fileInputDefinition = external_exports.object({
|
|
87219
|
-
workspaceId:
|
|
87768
|
+
workspaceId: workspaceIdSchema21,
|
|
87220
87769
|
machine: whatsappMachineRef,
|
|
87221
87770
|
/** The chat as a read names it: its id, a phone number or the exact contact or group name. */
|
|
87222
87771
|
chat: chatRefSchema,
|
|
@@ -87238,13 +87787,13 @@ var whatsappFileDefinition = external_exports.object({
|
|
|
87238
87787
|
transcript: external_exports.string().optional()
|
|
87239
87788
|
});
|
|
87240
87789
|
var sendInputDefinition = external_exports.object({
|
|
87241
|
-
workspaceId:
|
|
87790
|
+
workspaceId: workspaceIdSchema21,
|
|
87242
87791
|
machine: whatsappMachineRef,
|
|
87243
87792
|
chat: chatRefSchema,
|
|
87244
87793
|
text: external_exports.string().trim().min(1).max(WHATSAPP_TEXT_MAX)
|
|
87245
87794
|
});
|
|
87246
87795
|
var sendStatusInputDefinition = external_exports.object({
|
|
87247
|
-
workspaceId:
|
|
87796
|
+
workspaceId: workspaceIdSchema21,
|
|
87248
87797
|
sendId: external_exports.string().min(1).max(64),
|
|
87249
87798
|
/** Wait up to this long for the owner's answer; 0 answers at once. */
|
|
87250
87799
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_STATUS_WAIT_MAX_SECONDS).default(0)
|
|
@@ -87283,7 +87832,7 @@ var whatsappPairingDefinition = external_exports.object({
|
|
|
87283
87832
|
error: external_exports.string().nullable()
|
|
87284
87833
|
});
|
|
87285
87834
|
var pairInputDefinition = external_exports.object({
|
|
87286
|
-
workspaceId:
|
|
87835
|
+
workspaceId: workspaceIdSchema21,
|
|
87287
87836
|
machine: machineRefText2,
|
|
87288
87837
|
/** The person's number with country code; absent, only a QR code is made. */
|
|
87289
87838
|
phone: external_exports.string().trim().min(7).max(24).regex(/^\+?[0-9 ()-]+$/).optional()
|
|
@@ -87317,7 +87866,7 @@ var mirrorSettingsDefinition = external_exports.object({
|
|
|
87317
87866
|
});
|
|
87318
87867
|
var whatsappMirrorSettingsSchema = mirrorSettingsDefinition;
|
|
87319
87868
|
var setMirrorSettingsDefinition = external_exports.object({
|
|
87320
|
-
workspaceId:
|
|
87869
|
+
workspaceId: workspaceIdSchema21,
|
|
87321
87870
|
machine: machineRefText2,
|
|
87322
87871
|
mirrorOn: external_exports.boolean().optional(),
|
|
87323
87872
|
onlineMode: whatsappOnlineModeSchema.optional(),
|
|
@@ -87336,7 +87885,7 @@ var whatsappComputerDefinition = external_exports.object({
|
|
|
87336
87885
|
nextVisitAt: external_exports.string().nullable()
|
|
87337
87886
|
});
|
|
87338
87887
|
var whatsappComputerSchema = whatsappComputerDefinition;
|
|
87339
|
-
var whatsappComputerInputDefinition = external_exports.object({ workspaceId:
|
|
87888
|
+
var whatsappComputerInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema21 });
|
|
87340
87889
|
var whatsappComputerInputSchema = whatsappComputerInputDefinition;
|
|
87341
87890
|
var whatsappChangeDefinition = external_exports.object({
|
|
87342
87891
|
chat: external_exports.string().min(1).max(200),
|
|
@@ -87372,7 +87921,7 @@ var whatsappReadDefinition = external_exports.object({
|
|
|
87372
87921
|
});
|
|
87373
87922
|
var whatsappPairingSchema = whatsappPairingDefinition;
|
|
87374
87923
|
var pairingRefDefinition = external_exports.object({
|
|
87375
|
-
workspaceId:
|
|
87924
|
+
workspaceId: workspaceIdSchema21,
|
|
87376
87925
|
pairingId: external_exports.string().min(1).max(64)
|
|
87377
87926
|
});
|
|
87378
87927
|
var whatsappPairingRefSchema = pairingRefDefinition;
|
|
@@ -87394,7 +87943,7 @@ var COMPUTE_WHATSAPP_REST_PATHS = {
|
|
|
87394
87943
|
};
|
|
87395
87944
|
|
|
87396
87945
|
// ../../modules/compute/contract/src/own-machine.ts
|
|
87397
|
-
var
|
|
87946
|
+
var workspaceIdSchema22 = external_exports.string().min(1).max(64);
|
|
87398
87947
|
var machineRefText3 = external_exports.string().min(1).max(64);
|
|
87399
87948
|
var machineBrowserDefinition = external_exports.object({
|
|
87400
87949
|
ready: external_exports.boolean(),
|
|
@@ -87429,7 +87978,7 @@ var machineHealthDefinition = external_exports.object({
|
|
|
87429
87978
|
});
|
|
87430
87979
|
var machineHealthSchema = machineHealthDefinition;
|
|
87431
87980
|
var connectOwnDefinition = external_exports.object({
|
|
87432
|
-
workspaceId:
|
|
87981
|
+
workspaceId: workspaceIdSchema22,
|
|
87433
87982
|
/** Checked by `checkMachineName`, so a refusal reads as a sentence. */
|
|
87434
87983
|
name: external_exports.string().max(200)
|
|
87435
87984
|
});
|
|
@@ -87437,7 +87986,7 @@ var connectOwnMachineInputSchema = connectOwnDefinition;
|
|
|
87437
87986
|
var MACHINE_EXEC_MAX_SECONDS = 240;
|
|
87438
87987
|
var MACHINE_EXEC_OUTPUT_BYTES = 1024 * 1024;
|
|
87439
87988
|
var execDefinition = external_exports.object({
|
|
87440
|
-
workspaceId:
|
|
87989
|
+
workspaceId: workspaceIdSchema22,
|
|
87441
87990
|
machine: machineRefText3,
|
|
87442
87991
|
command: external_exports.string().min(1).max(64 * 1024),
|
|
87443
87992
|
timeoutSeconds: external_exports.number().int().min(1).max(MACHINE_EXEC_MAX_SECONDS).optional(),
|
|
@@ -87509,14 +88058,14 @@ function gigabytes(bytes) {
|
|
|
87509
88058
|
}
|
|
87510
88059
|
var hostWhenOfflineSchema = external_exports.enum(["wait", "sandbox"]);
|
|
87511
88060
|
var hostAgentDefinition = external_exports.object({
|
|
87512
|
-
workspaceId:
|
|
88061
|
+
workspaceId: workspaceIdSchema22,
|
|
87513
88062
|
machine: machineRefText3,
|
|
87514
88063
|
agentId: external_exports.string().min(1).max(64),
|
|
87515
88064
|
whenOffline: hostWhenOfflineSchema.default("wait")
|
|
87516
88065
|
});
|
|
87517
88066
|
var hostAgentInputSchema = hostAgentDefinition;
|
|
87518
88067
|
var unhostAgentDefinition = external_exports.object({
|
|
87519
|
-
workspaceId:
|
|
88068
|
+
workspaceId: workspaceIdSchema22,
|
|
87520
88069
|
agentId: external_exports.string().min(1).max(64)
|
|
87521
88070
|
});
|
|
87522
88071
|
var unhostAgentInputSchema = unhostAgentDefinition;
|
|
@@ -87536,7 +88085,7 @@ var agentHostGrantDefinition = external_exports.object({
|
|
|
87536
88085
|
|
|
87537
88086
|
// ../../modules/compute/contract/src/compute.ts
|
|
87538
88087
|
var idSchema23 = external_exports.string().min(1).max(64);
|
|
87539
|
-
var
|
|
88088
|
+
var workspaceIdSchema23 = external_exports.string().min(1).max(64);
|
|
87540
88089
|
var machineStateSchema = external_exports.enum([
|
|
87541
88090
|
"starting",
|
|
87542
88091
|
"ready",
|
|
@@ -87566,7 +88115,7 @@ var machineGrantDefinition = external_exports.object({
|
|
|
87566
88115
|
});
|
|
87567
88116
|
var machineDefinition = external_exports.object({
|
|
87568
88117
|
id: idSchema23,
|
|
87569
|
-
workspaceId:
|
|
88118
|
+
workspaceId: workspaceIdSchema23,
|
|
87570
88119
|
name: external_exports.string(),
|
|
87571
88120
|
type: machineTypeSchema,
|
|
87572
88121
|
zone: external_exports.string(),
|
|
@@ -87617,23 +88166,23 @@ var machineDefinition = external_exports.object({
|
|
|
87617
88166
|
var machineSchema = machineDefinition;
|
|
87618
88167
|
var computeStatusDefinition = external_exports.object({ available: external_exports.boolean() });
|
|
87619
88168
|
var computeStatusSchema = computeStatusDefinition;
|
|
87620
|
-
var workspaceInputDefinition3 = external_exports.object({ workspaceId:
|
|
88169
|
+
var workspaceInputDefinition3 = external_exports.object({ workspaceId: workspaceIdSchema23 });
|
|
87621
88170
|
var computeWorkspaceInputSchema = workspaceInputDefinition3;
|
|
87622
88171
|
var machineRefDefinition = external_exports.object({
|
|
87623
|
-
workspaceId:
|
|
88172
|
+
workspaceId: workspaceIdSchema23,
|
|
87624
88173
|
machine: external_exports.string().min(1).max(64)
|
|
87625
88174
|
});
|
|
87626
88175
|
var machineRefSchema = machineRefDefinition;
|
|
87627
88176
|
var MACHINE_NAME_MAX = 40;
|
|
87628
88177
|
var machineNameSchema = external_exports.string().min(2).max(MACHINE_NAME_MAX).regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes");
|
|
87629
88178
|
var renameDefinition = external_exports.object({
|
|
87630
|
-
workspaceId:
|
|
88179
|
+
workspaceId: workspaceIdSchema23,
|
|
87631
88180
|
machine: external_exports.string().min(1).max(64),
|
|
87632
88181
|
name: external_exports.string().max(200)
|
|
87633
88182
|
});
|
|
87634
88183
|
var renameMachineInputSchema = renameDefinition;
|
|
87635
88184
|
var setupBrowserDefinition = external_exports.object({
|
|
87636
|
-
workspaceId:
|
|
88185
|
+
workspaceId: workspaceIdSchema23,
|
|
87637
88186
|
/** The site the person signs in to, as a host or a URL. */
|
|
87638
88187
|
site: external_exports.string().min(1).max(500),
|
|
87639
88188
|
name: machineNameSchema.optional(),
|
|
@@ -87642,27 +88191,27 @@ var setupBrowserDefinition = external_exports.object({
|
|
|
87642
88191
|
});
|
|
87643
88192
|
var setupBrowserInputSchema = setupBrowserDefinition;
|
|
87644
88193
|
var grantDefinition = external_exports.object({
|
|
87645
|
-
workspaceId:
|
|
88194
|
+
workspaceId: workspaceIdSchema23,
|
|
87646
88195
|
machine: external_exports.string().min(1).max(64),
|
|
87647
88196
|
grantee: machineGranteeDefinition
|
|
87648
88197
|
});
|
|
87649
88198
|
var machineGrantInputSchema = grantDefinition;
|
|
87650
88199
|
var setBudgetDefinition = external_exports.object({
|
|
87651
|
-
workspaceId:
|
|
88200
|
+
workspaceId: workspaceIdSchema23,
|
|
87652
88201
|
machine: external_exports.string().min(1).max(64),
|
|
87653
88202
|
budgetUsd: external_exports.number().min(0).max(1e4),
|
|
87654
88203
|
period: machineBudgetPeriodSchema
|
|
87655
88204
|
});
|
|
87656
88205
|
var setMachineBudgetInputSchema = setBudgetDefinition;
|
|
87657
88206
|
var openScreenDefinition = external_exports.object({
|
|
87658
|
-
workspaceId:
|
|
88207
|
+
workspaceId: workspaceIdSchema23,
|
|
87659
88208
|
machine: external_exports.string().min(1).max(64),
|
|
87660
88209
|
site: external_exports.string().min(1).max(500).optional()
|
|
87661
88210
|
});
|
|
87662
88211
|
var openScreenInputSchema = openScreenDefinition;
|
|
87663
88212
|
var loginTerminalHarnessSchema = external_exports.enum(["claude-code", "codex"]);
|
|
87664
88213
|
var openLoginTerminalDefinition = external_exports.object({
|
|
87665
|
-
workspaceId:
|
|
88214
|
+
workspaceId: workspaceIdSchema23,
|
|
87666
88215
|
harness: loginTerminalHarnessSchema
|
|
87667
88216
|
});
|
|
87668
88217
|
var openLoginTerminalInputSchema = openLoginTerminalDefinition;
|
|
@@ -87685,7 +88234,7 @@ var loginTerminalDefinition = external_exports.discriminatedUnion("status", [
|
|
|
87685
88234
|
var loginTerminalSchema = loginTerminalDefinition;
|
|
87686
88235
|
var warmComputerDefinition = external_exports.object({ status: external_exports.enum(["starting", "ready"]) });
|
|
87687
88236
|
var warmComputerSchema = warmComputerDefinition;
|
|
87688
|
-
var screenRefDefinition = external_exports.object({ workspaceId:
|
|
88237
|
+
var screenRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema23, sessionId: idSchema23 });
|
|
87689
88238
|
var screenRefSchema = screenRefDefinition;
|
|
87690
88239
|
var screenSessionDefinition = external_exports.object({
|
|
87691
88240
|
sessionId: idSchema23,
|
|
@@ -87723,11 +88272,16 @@ var ownMachineSshConnectDefinition = external_exports.object({
|
|
|
87723
88272
|
publicKey: external_exports.string()
|
|
87724
88273
|
});
|
|
87725
88274
|
var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
|
|
87726
|
-
var reconcileDefinition = external_exports.object({ workspaceId:
|
|
88275
|
+
var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema23, machineId: idSchema23 });
|
|
87727
88276
|
var ComputeApi = moduleApi()("compute");
|
|
87728
88277
|
var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("openLoginTerminal").withInput(openLoginTerminalInputSchema).withOutput(loginTerminalSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(whatsappPairInputSchema).withOutput(whatsappPairingSchema).query("whatsappMirror").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).mutation("setWhatsappMirror").withInput(setWhatsappMirrorInputSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
|
|
87729
88278
|
var computeFleetTrpc = defineTrpcContract("compute").query("whatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("prepareWhatsappComputer").withInput(whatsappComputerInputSchema).withOutput(whatsappComputerSchema).mutation("warmComputer").withInput(computeWorkspaceInputSchema).withOutput(warmComputerSchema).query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).query("personComputer").withInput(personComputerInputSchema).withOutput(computerUseSchema2).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).query("whatsappAgents").withInput(machineRefSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgent").withInput(setWhatsappAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentLease").withInput(setWhatsappAgentLeaseInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappEveryAgent").withInput(setWhatsappEveryAgentInputSchema).withOutput(whatsappAgentsSchema).mutation("setWhatsappAgentAccess").withInput(setWhatsappAgentAccessInputSchema).withOutput(whatsappAgentsSchema).mutation("checkWhatsappNow").withInput(machineRefSchema).withOutput(whatsappMirrorSettingsSchema).query("whatsappChatPeople").withInput(whatsappChatPeopleInputSchema).withOutput(whatsappChatPeopleSchema).build();
|
|
87730
|
-
var computeTrpc = joinTrpcContracts(
|
|
88279
|
+
var computeTrpc = joinTrpcContracts(
|
|
88280
|
+
"compute",
|
|
88281
|
+
computeCoreTrpc,
|
|
88282
|
+
computeFleetTrpc,
|
|
88283
|
+
computeWaitlistTrpc
|
|
88284
|
+
);
|
|
87731
88285
|
var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
|
|
87732
88286
|
var restRenameInputDefinition = external_exports.object({
|
|
87733
88287
|
machine: external_exports.string().min(1).max(64),
|
|
@@ -87809,7 +88363,7 @@ var COMPUTER_COPY_REST_PATHS = {
|
|
|
87809
88363
|
pending: "/api/compute/copies/pending",
|
|
87810
88364
|
settle: "/api/compute/copies/settle"
|
|
87811
88365
|
};
|
|
87812
|
-
var
|
|
88366
|
+
var workspaceIdSchema24 = external_exports.string().min(1).max(64);
|
|
87813
88367
|
var copyIdSchema = external_exports.string().min(1).max(64);
|
|
87814
88368
|
var copyTargetSchema = external_exports.string().trim().min(1).max(500).default(".");
|
|
87815
88369
|
var computerCopyStateSchema = external_exports.enum(["uploading", "pending", "done", "failed"]);
|
|
@@ -87828,7 +88382,7 @@ var computerCopyDefinition = external_exports.object({
|
|
|
87828
88382
|
createdAt: external_exports.iso.datetime()
|
|
87829
88383
|
});
|
|
87830
88384
|
var startComputerCopyInputDefinition = external_exports.object({
|
|
87831
|
-
workspaceId:
|
|
88385
|
+
workspaceId: workspaceIdSchema24,
|
|
87832
88386
|
/** The agent's id or name. */
|
|
87833
88387
|
agent: external_exports.string().trim().min(1).max(200),
|
|
87834
88388
|
name: external_exports.string().trim().min(1).max(200),
|
|
@@ -87856,7 +88410,7 @@ var startedComputerCopyDefinition = external_exports.object({
|
|
|
87856
88410
|
upload: copyUploadDefinition
|
|
87857
88411
|
});
|
|
87858
88412
|
var completeComputerCopyInputDefinition = external_exports.object({
|
|
87859
|
-
workspaceId:
|
|
88413
|
+
workspaceId: workspaceIdSchema24,
|
|
87860
88414
|
copyId: copyIdSchema,
|
|
87861
88415
|
parts: external_exports.array(external_exports.object({ partNumber: external_exports.number().int().positive(), etag: external_exports.string().min(1).max(200) })).max(1e4).default([])
|
|
87862
88416
|
});
|
|
@@ -87875,7 +88429,7 @@ var pendingComputerCopiesDefinition = external_exports.object({
|
|
|
87875
88429
|
copies: external_exports.array(pendingComputerCopyDefinition)
|
|
87876
88430
|
});
|
|
87877
88431
|
var settleComputerCopyInputDefinition = external_exports.object({
|
|
87878
|
-
workspaceId:
|
|
88432
|
+
workspaceId: workspaceIdSchema24,
|
|
87879
88433
|
copyId: copyIdSchema,
|
|
87880
88434
|
outcome: external_exports.enum(["done", "failed"]),
|
|
87881
88435
|
files: external_exports.number().int().nonnegative().optional(),
|
|
@@ -87889,7 +88443,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
|
|
|
87889
88443
|
// src/services/computer-copy-commands.service.ts
|
|
87890
88444
|
import { mkdtemp as mkdtemp2, open as open5, rm as rm15, stat as stat11 } from "node:fs/promises";
|
|
87891
88445
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
87892
|
-
import { basename as basename9, dirname as
|
|
88446
|
+
import { basename as basename9, dirname as dirname19, resolve as resolve11 } from "node:path";
|
|
87893
88447
|
var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
|
|
87894
88448
|
copy a local file or folder into your hosted agent's work folder
|
|
87895
88449
|
(its owner only, up to 2 GiB packed); <folder> is relative to the
|
|
@@ -87905,7 +88459,7 @@ function packingOf({ path, isDirectory }) {
|
|
|
87905
88459
|
const contents = isDirectory && path.endsWith("/");
|
|
87906
88460
|
const absolute = resolve11(path);
|
|
87907
88461
|
const name3 = basename9(absolute);
|
|
87908
|
-
return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent:
|
|
88462
|
+
return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname19(absolute), entry: name3 };
|
|
87909
88463
|
}
|
|
87910
88464
|
async function sendParts2({
|
|
87911
88465
|
context,
|
|
@@ -88279,11 +88833,11 @@ async function computer({ context, args }) {
|
|
|
88279
88833
|
}
|
|
88280
88834
|
|
|
88281
88835
|
// src/services/connect-commands.service.ts
|
|
88282
|
-
import { readFile as
|
|
88836
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
88283
88837
|
|
|
88284
88838
|
// src/services/mcp-gateway.service.ts
|
|
88285
|
-
import { mkdir as mkdir9, readFile as
|
|
88286
|
-
import { basename as basename10, join as
|
|
88839
|
+
import { mkdir as mkdir9, readFile as readFile20, writeFile as writeFile7 } from "node:fs/promises";
|
|
88840
|
+
import { basename as basename10, join as join28, resolve as resolve12 } from "node:path";
|
|
88287
88841
|
import { createInterface as createInterface3 } from "node:readline";
|
|
88288
88842
|
var TURN_HEADER = "x-laze-turn";
|
|
88289
88843
|
function serveMcpGateway({
|
|
@@ -88326,7 +88880,7 @@ async function relayMcpLines({
|
|
|
88326
88880
|
const github3 = env.LAZE_GITHUB_CONNECTION;
|
|
88327
88881
|
const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
|
|
88328
88882
|
const turnFile = env.LAZE_TURN_FILE;
|
|
88329
|
-
const readTurn = () =>
|
|
88883
|
+
const readTurn = () => readFile20(turnFile, "utf8").then(
|
|
88330
88884
|
(text3) => text3.trim(),
|
|
88331
88885
|
() => ""
|
|
88332
88886
|
);
|
|
@@ -88368,8 +88922,8 @@ function safeName(name3, fallback) {
|
|
|
88368
88922
|
return last && last !== "." && last !== ".." ? last : fallback;
|
|
88369
88923
|
}
|
|
88370
88924
|
async function saveMailFile({ root, file: file4 }) {
|
|
88371
|
-
const dir =
|
|
88372
|
-
const path =
|
|
88925
|
+
const dir = join28(root, safeName(file4.messageId, "message"));
|
|
88926
|
+
const path = join28(dir, safeName(file4.fileName, "attachment"));
|
|
88373
88927
|
await mkdir9(dir, { recursive: true });
|
|
88374
88928
|
await writeFile7(path, Buffer.from(file4.base64, "base64"));
|
|
88375
88929
|
return path;
|
|
@@ -88488,7 +89042,7 @@ async function turnOf({ context }) {
|
|
|
88488
89042
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
88489
89043
|
if (pinned) return pinned;
|
|
88490
89044
|
const file4 = env.LAZE_TURN_FILE;
|
|
88491
|
-
const turn = file4 ? await
|
|
89045
|
+
const turn = file4 ? await readFile21(file4, "utf8").then(
|
|
88492
89046
|
(text3) => text3.trim(),
|
|
88493
89047
|
() => ""
|
|
88494
89048
|
) : "";
|
|
@@ -88546,11 +89100,11 @@ async function connect({
|
|
|
88546
89100
|
}
|
|
88547
89101
|
|
|
88548
89102
|
// src/services/connector-commands.service.ts
|
|
88549
|
-
import { readFile as
|
|
89103
|
+
import { readFile as readFile23 } from "node:fs/promises";
|
|
88550
89104
|
import { resolve as resolve13 } from "node:path";
|
|
88551
89105
|
|
|
88552
89106
|
// src/services/vault-keychain-commands.service.ts
|
|
88553
|
-
import { readFile as
|
|
89107
|
+
import { readFile as readFile22 } from "node:fs/promises";
|
|
88554
89108
|
|
|
88555
89109
|
// src/rules/vault-input.rules.ts
|
|
88556
89110
|
function secondsOf(text3) {
|
|
@@ -88968,7 +89522,7 @@ async function secretText({ context, args }) {
|
|
|
88968
89522
|
);
|
|
88969
89523
|
}
|
|
88970
89524
|
const file4 = flagText({ args, name: "from-file" });
|
|
88971
|
-
const text3 = file4 ? await
|
|
89525
|
+
const text3 = file4 ? await readFile22(file4, "utf8") : await context.readStdin();
|
|
88972
89526
|
const trimmed = text3.replace(/\r?\n$/, "");
|
|
88973
89527
|
if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
|
|
88974
89528
|
return trimmed;
|
|
@@ -89201,7 +89755,7 @@ async function keyText({ context, args }) {
|
|
|
89201
89755
|
throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
|
|
89202
89756
|
}
|
|
89203
89757
|
const file4 = flagText({ args, name: "from-file" });
|
|
89204
|
-
const text3 = file4 ? await
|
|
89758
|
+
const text3 = file4 ? await readFile23(resolve13(context.cwd, file4), "utf8") : await context.readStdin();
|
|
89205
89759
|
const trimmed = text3.trim();
|
|
89206
89760
|
if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
|
|
89207
89761
|
return trimmed;
|
|
@@ -89522,12 +90076,12 @@ async function conversationDelete({ context, args }) {
|
|
|
89522
90076
|
}
|
|
89523
90077
|
|
|
89524
90078
|
// src/services/discord-commands.service.ts
|
|
89525
|
-
import { readFile as
|
|
90079
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
89526
90080
|
import { resolve as resolve14 } from "node:path";
|
|
89527
90081
|
|
|
89528
90082
|
// ../../modules/discord/contract/src/discord.ts
|
|
89529
|
-
var
|
|
89530
|
-
var workspaceInput4 = external_exports.object({ workspaceId:
|
|
90083
|
+
var workspaceIdSchema25 = external_exports.string().min(1).max(64);
|
|
90084
|
+
var workspaceInput4 = external_exports.object({ workspaceId: workspaceIdSchema25 });
|
|
89531
90085
|
var discordIdSchema = external_exports.string().regex(/^\d{5,25}$/);
|
|
89532
90086
|
var DISCORD_PERMISSIONS = {
|
|
89533
90087
|
ADMINISTRATOR: 1n << 3n,
|
|
@@ -89609,10 +90163,10 @@ var discordChannelViewDefinition = external_exports.object({
|
|
|
89609
90163
|
url: external_exports.url()
|
|
89610
90164
|
});
|
|
89611
90165
|
var discordChannelViewSchema = discordChannelViewDefinition;
|
|
89612
|
-
var guildInputDefinition = external_exports.object({ workspaceId:
|
|
90166
|
+
var guildInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema25, guildId: discordIdSchema });
|
|
89613
90167
|
var discordGuildInputSchema = guildInputDefinition;
|
|
89614
90168
|
var saveDiscordAppDefinition = external_exports.object({
|
|
89615
|
-
workspaceId:
|
|
90169
|
+
workspaceId: workspaceIdSchema25,
|
|
89616
90170
|
setupKey: external_exports.string().min(1).max(64),
|
|
89617
90171
|
applicationId: external_exports.string().trim().max(40),
|
|
89618
90172
|
clientSecret: external_exports.string().trim().max(200),
|
|
@@ -89622,7 +90176,7 @@ var saveDiscordAppInputSchema = saveDiscordAppDefinition;
|
|
|
89622
90176
|
var startedAuthorizeDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
|
|
89623
90177
|
var startedDiscordAuthorizeSchema = startedAuthorizeDefinition;
|
|
89624
90178
|
var pickDefinition = external_exports.object({
|
|
89625
|
-
workspaceId:
|
|
90179
|
+
workspaceId: workspaceIdSchema25,
|
|
89626
90180
|
guildId: discordIdSchema,
|
|
89627
90181
|
channelId: discordIdSchema,
|
|
89628
90182
|
picked: external_exports.boolean(),
|
|
@@ -89630,7 +90184,7 @@ var pickDefinition = external_exports.object({
|
|
|
89630
90184
|
});
|
|
89631
90185
|
var discordPickInputSchema = pickDefinition;
|
|
89632
90186
|
var updateConnectionDefinition = external_exports.object({
|
|
89633
|
-
workspaceId:
|
|
90187
|
+
workspaceId: workspaceIdSchema25,
|
|
89634
90188
|
guildId: discordIdSchema,
|
|
89635
90189
|
label: external_exports.string().trim().max(80).nullable().optional(),
|
|
89636
90190
|
cacheDays: external_exports.number().int().min(1).max(30).optional()
|
|
@@ -89643,16 +90197,16 @@ var oauthCallbackDefinition = external_exports.object({
|
|
|
89643
90197
|
permissions: external_exports.string().max(40).optional(),
|
|
89644
90198
|
error: external_exports.string().max(200).optional()
|
|
89645
90199
|
});
|
|
89646
|
-
var linkParamsDefinition = external_exports.object({ workspaceId:
|
|
90200
|
+
var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema25, guildId: discordIdSchema });
|
|
89647
90201
|
var historyInputDefinition = external_exports.object({
|
|
89648
|
-
workspaceId:
|
|
90202
|
+
workspaceId: workspaceIdSchema25,
|
|
89649
90203
|
/** The Laze conversation that mirrors the Discord channel. */
|
|
89650
90204
|
channelId: external_exports.string().min(1).max(200),
|
|
89651
90205
|
before: external_exports.iso.datetime()
|
|
89652
90206
|
});
|
|
89653
90207
|
var discordHistoryInputSchema = historyInputDefinition;
|
|
89654
90208
|
var channelPeopleInputDefinition = external_exports.object({
|
|
89655
|
-
workspaceId:
|
|
90209
|
+
workspaceId: workspaceIdSchema25,
|
|
89656
90210
|
channelId: external_exports.string().min(1).max(200)
|
|
89657
90211
|
});
|
|
89658
90212
|
var discordChannelPeopleInputSchema = channelPeopleInputDefinition;
|
|
@@ -89683,7 +90237,7 @@ var historyPageDefinition = external_exports.object({
|
|
|
89683
90237
|
});
|
|
89684
90238
|
var discordHistoryPageSchema = historyPageDefinition;
|
|
89685
90239
|
var fileParamsDefinition = external_exports.object({
|
|
89686
|
-
workspaceId:
|
|
90240
|
+
workspaceId: workspaceIdSchema25,
|
|
89687
90241
|
channelId: external_exports.string().min(1).max(200),
|
|
89688
90242
|
messageId: discordIdSchema,
|
|
89689
90243
|
attachmentId: discordIdSchema
|
|
@@ -89820,6 +90374,17 @@ var webhookProbeRequestedDefinition = external_exports.object({
|
|
|
89820
90374
|
workspaceId: external_exports.string().min(1),
|
|
89821
90375
|
runId: external_exports.string().min(1)
|
|
89822
90376
|
});
|
|
90377
|
+
var discordLinkedDefinition = external_exports.object({
|
|
90378
|
+
workspaceId: external_exports.string().min(1),
|
|
90379
|
+
/** The Laze person who finished the flow. */
|
|
90380
|
+
userId: external_exports.string().min(1),
|
|
90381
|
+
/** Opaque and unique to this link, derived from the finished authorization. */
|
|
90382
|
+
linkId: external_exports.string().min(1),
|
|
90383
|
+
/** `installed`: the bot added to a server; `linked`: a person's own Discord account. */
|
|
90384
|
+
outcome: external_exports.enum(["installed", "linked"]),
|
|
90385
|
+
changeId: external_exports.string().min(1),
|
|
90386
|
+
at: external_exports.iso.datetime()
|
|
90387
|
+
});
|
|
89823
90388
|
|
|
89824
90389
|
// src/services/discord-commands.service.ts
|
|
89825
90390
|
var DISCORD_USAGE = `Usage (a person's key; Discord stays the source, each person picks their own channels):
|
|
@@ -89859,7 +90424,7 @@ async function secretsOf({ context, args }) {
|
|
|
89859
90424
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
89860
90425
|
if (fromConnection) return { fromConnection };
|
|
89861
90426
|
const file4 = flagText({ args, name: "from-file" });
|
|
89862
|
-
const text3 = file4 ? await
|
|
90427
|
+
const text3 = file4 ? await readFile24(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
|
|
89863
90428
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
89864
90429
|
if (lines2.length !== 2) {
|
|
89865
90430
|
throw new CliUsageError(
|
|
@@ -90129,8 +90694,8 @@ var DOMAINS_USAGE = `Usage:
|
|
|
90129
90694
|
var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
|
|
90130
90695
|
`);
|
|
90131
90696
|
function printDomain(context, row) {
|
|
90132
|
-
const
|
|
90133
|
-
context.out(`${row.domain} ${
|
|
90697
|
+
const join36 = row.autoJoin ? "auto-join on" : "auto-join off";
|
|
90698
|
+
context.out(`${row.domain} ${join36}${row.enforced ? " single sign-on enforced" : ""}
|
|
90134
90699
|
`);
|
|
90135
90700
|
}
|
|
90136
90701
|
async function list4({ context, args }) {
|
|
@@ -90162,7 +90727,7 @@ async function domains({ context, args }) {
|
|
|
90162
90727
|
}
|
|
90163
90728
|
|
|
90164
90729
|
// src/services/emoji-commands.service.ts
|
|
90165
|
-
import { readFile as
|
|
90730
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
90166
90731
|
import { resolve as resolve15 } from "node:path";
|
|
90167
90732
|
var EMOJI_USAGE = `Usage:
|
|
90168
90733
|
laze emoji list [--json] the workspace's custom emoji, aliases and who added each
|
|
@@ -90203,7 +90768,7 @@ async function addEmoji({ context, args, client }) {
|
|
|
90203
90768
|
const file4 = wordAt4(args, 3);
|
|
90204
90769
|
let bytes;
|
|
90205
90770
|
try {
|
|
90206
|
-
bytes = new Uint8Array(await
|
|
90771
|
+
bytes = new Uint8Array(await readFile25(resolve15(context.cwd, file4)));
|
|
90207
90772
|
} catch {
|
|
90208
90773
|
throw new CliUsageError(`Cannot read ${file4}.`);
|
|
90209
90774
|
}
|
|
@@ -90269,10 +90834,10 @@ var EXTERNAL_CONNECTION_REST_PATHS = {
|
|
|
90269
90834
|
block: "/api/external-connections/block",
|
|
90270
90835
|
report: "/api/external-connections/report"
|
|
90271
90836
|
};
|
|
90272
|
-
var
|
|
90837
|
+
var workspaceIdSchema26 = external_exports.string().min(1).max(64);
|
|
90273
90838
|
var idSchema24 = external_exports.string().min(1).max(64);
|
|
90274
90839
|
var iso2 = external_exports.iso.datetime();
|
|
90275
|
-
var workspaceInput5 = external_exports.object({ workspaceId:
|
|
90840
|
+
var workspaceInput5 = external_exports.object({ workspaceId: workspaceIdSchema26 });
|
|
90276
90841
|
var connectionReference = external_exports.string().trim().min(1).max(120);
|
|
90277
90842
|
var externalConnectionStateSchema = external_exports.enum(["active", "ended"]);
|
|
90278
90843
|
var externalInviteStateSchema = external_exports.enum([
|
|
@@ -90376,10 +90941,10 @@ var rosterDefinition = external_exports.object({
|
|
|
90376
90941
|
members: external_exports.array(rosterMemberDefinition)
|
|
90377
90942
|
});
|
|
90378
90943
|
var externalRosterSchema = rosterDefinition;
|
|
90379
|
-
var rosterInputDefinition = external_exports.object({ workspaceId:
|
|
90944
|
+
var rosterInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema26, channelId: idSchema24 });
|
|
90380
90945
|
var externalRosterInputSchema = rosterInputDefinition;
|
|
90381
90946
|
var rosterCountsInputDefinition = external_exports.object({
|
|
90382
|
-
workspaceId:
|
|
90947
|
+
workspaceId: workspaceIdSchema26,
|
|
90383
90948
|
channelIds: external_exports.array(idSchema24).max(200)
|
|
90384
90949
|
});
|
|
90385
90950
|
var externalRosterCountsInputSchema = rosterCountsInputDefinition;
|
|
@@ -90388,7 +90953,7 @@ var rosterCountsDefinition = external_exports.object({
|
|
|
90388
90953
|
});
|
|
90389
90954
|
var externalRosterCountsSchema = rosterCountsDefinition;
|
|
90390
90955
|
var inviteInputDefinition = external_exports.object({
|
|
90391
|
-
workspaceId:
|
|
90956
|
+
workspaceId: workspaceIdSchema26,
|
|
90392
90957
|
email: external_exports.email().max(320),
|
|
90393
90958
|
/** The first channel to share, by id or name; it is shared once the invitation is accepted. */
|
|
90394
90959
|
share: external_exports.string().trim().min(1).max(81).optional(),
|
|
@@ -90396,7 +90961,7 @@ var inviteInputDefinition = external_exports.object({
|
|
|
90396
90961
|
company: external_exports.string().trim().min(1).max(80).optional()
|
|
90397
90962
|
});
|
|
90398
90963
|
var externalInviteInputSchema = inviteInputDefinition;
|
|
90399
|
-
var inviteRefDefinition = external_exports.object({ workspaceId:
|
|
90964
|
+
var inviteRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema26, inviteId: idSchema24 });
|
|
90400
90965
|
var externalInviteRefSchema = inviteRefDefinition;
|
|
90401
90966
|
var pendingShareDefinition = external_exports.object({
|
|
90402
90967
|
channelId: external_exports.string(),
|
|
@@ -90420,7 +90985,7 @@ var pendingSharesDefinition = external_exports.object({
|
|
|
90420
90985
|
var externalPendingSharesSchema = pendingSharesDefinition;
|
|
90421
90986
|
var acceptInviteDefinition = external_exports.object({
|
|
90422
90987
|
/** The workspace to connect: one where the person is Admin or Owner. */
|
|
90423
|
-
workspaceId:
|
|
90988
|
+
workspaceId: workspaceIdSchema26,
|
|
90424
90989
|
inviteId: idSchema24,
|
|
90425
90990
|
/** The emailed link's secret; without it the invitation must be addressed to the person. */
|
|
90426
90991
|
secret: external_exports.string().trim().max(200).optional()
|
|
@@ -90429,26 +90994,26 @@ var externalAcceptInviteInputSchema = acceptInviteDefinition;
|
|
|
90429
90994
|
var answeredDefinition = external_exports.object({ id: external_exports.string(), state: externalInviteStateSchema });
|
|
90430
90995
|
var externalInviteAnsweredSchema = answeredDefinition;
|
|
90431
90996
|
var connectionInputDefinition = external_exports.object({
|
|
90432
|
-
workspaceId:
|
|
90997
|
+
workspaceId: workspaceIdSchema26,
|
|
90433
90998
|
connection: connectionReference
|
|
90434
90999
|
});
|
|
90435
91000
|
var externalConnectionInputSchema = connectionInputDefinition;
|
|
90436
91001
|
var settingsInputDefinition = external_exports.object({
|
|
90437
|
-
workspaceId:
|
|
91002
|
+
workspaceId: workspaceIdSchema26,
|
|
90438
91003
|
connection: connectionReference,
|
|
90439
91004
|
agentsAllowed: external_exports.boolean().optional(),
|
|
90440
91005
|
directAllowed: external_exports.boolean().optional()
|
|
90441
91006
|
});
|
|
90442
91007
|
var externalSettingsInputSchema = settingsInputDefinition;
|
|
90443
91008
|
var shareInputDefinition = external_exports.object({
|
|
90444
|
-
workspaceId:
|
|
91009
|
+
workspaceId: workspaceIdSchema26,
|
|
90445
91010
|
connection: connectionReference,
|
|
90446
91011
|
/** The channel as its id or name, `#` optional. */
|
|
90447
91012
|
channel: external_exports.string().trim().min(1).max(81)
|
|
90448
91013
|
});
|
|
90449
91014
|
var externalShareInputSchema = shareInputDefinition;
|
|
90450
91015
|
var acceptShareDefinition = external_exports.object({
|
|
90451
|
-
workspaceId:
|
|
91016
|
+
workspaceId: workspaceIdSchema26,
|
|
90452
91017
|
shareId: idSchema24,
|
|
90453
91018
|
/** Its name here; the host's name when left out. */
|
|
90454
91019
|
name: external_exports.string().trim().min(1).max(80).optional(),
|
|
@@ -90456,13 +91021,13 @@ var acceptShareDefinition = external_exports.object({
|
|
|
90456
91021
|
});
|
|
90457
91022
|
var externalAcceptShareInputSchema = acceptShareDefinition;
|
|
90458
91023
|
var shareRefDefinition = external_exports.object({
|
|
90459
|
-
workspaceId:
|
|
91024
|
+
workspaceId: workspaceIdSchema26,
|
|
90460
91025
|
/** The share's id, or this workspace's channel as its id or name. */
|
|
90461
91026
|
share: external_exports.string().trim().min(1).max(81)
|
|
90462
91027
|
});
|
|
90463
91028
|
var externalShareRefSchema = shareRefDefinition;
|
|
90464
91029
|
var reportInputDefinition = external_exports.object({
|
|
90465
|
-
workspaceId:
|
|
91030
|
+
workspaceId: workspaceIdSchema26,
|
|
90466
91031
|
connection: connectionReference,
|
|
90467
91032
|
note: external_exports.string().trim().min(1).max(2e3)
|
|
90468
91033
|
});
|
|
@@ -90473,7 +91038,7 @@ var blockedDefinition = external_exports.object({
|
|
|
90473
91038
|
});
|
|
90474
91039
|
var externalBlockedSchema = blockedDefinition;
|
|
90475
91040
|
var openDirectDefinition = external_exports.object({
|
|
90476
|
-
workspaceId:
|
|
91041
|
+
workspaceId: workspaceIdSchema26,
|
|
90477
91042
|
/** The external person: their roster id (`laze:<id>`) or their name in a shared channel. */
|
|
90478
91043
|
person: external_exports.string().trim().min(1).max(120),
|
|
90479
91044
|
/** Their workspace, as a connection reference; needed only when a name is in two. */
|
|
@@ -90519,7 +91084,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
|
|
|
90519
91084
|
var ExternalSharingHooksToken = externalUi.hooks("sharing");
|
|
90520
91085
|
|
|
90521
91086
|
// src/services/workspace-commands.service.ts
|
|
90522
|
-
import { readFile as
|
|
91087
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
90523
91088
|
import { resolve as resolve16 } from "node:path";
|
|
90524
91089
|
var ROLE_NAMES2 = {
|
|
90525
91090
|
OWNER: "Owner",
|
|
@@ -90702,7 +91267,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
|
|
|
90702
91267
|
async function readLogo({ context, file: file4 }) {
|
|
90703
91268
|
let bytes;
|
|
90704
91269
|
try {
|
|
90705
|
-
bytes = new Uint8Array(await
|
|
91270
|
+
bytes = new Uint8Array(await readFile26(resolve16(context.cwd, file4)));
|
|
90706
91271
|
} catch {
|
|
90707
91272
|
throw new CliUsageError(`No file to read at ${file4}.`);
|
|
90708
91273
|
}
|
|
@@ -91302,7 +91867,7 @@ async function agentFeedAccess({
|
|
|
91302
91867
|
}
|
|
91303
91868
|
|
|
91304
91869
|
// src/services/feed-commands.service.ts
|
|
91305
|
-
import { readFile as
|
|
91870
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
91306
91871
|
import { resolve as resolve17 } from "node:path";
|
|
91307
91872
|
|
|
91308
91873
|
// ../../modules/feed/contract/src/feed.delegate.ts
|
|
@@ -92408,7 +92973,7 @@ async function feedTurnOf({
|
|
|
92408
92973
|
const read4 = async () => {
|
|
92409
92974
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
92410
92975
|
if (pinned) return pinned;
|
|
92411
|
-
if (env.LAZE_TURN_FILE) return (await
|
|
92976
|
+
if (env.LAZE_TURN_FILE) return (await readFile27(env.LAZE_TURN_FILE, "utf8")).trim();
|
|
92412
92977
|
return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
|
|
92413
92978
|
};
|
|
92414
92979
|
const turn = await read4().catch(() => "");
|
|
@@ -92482,7 +93047,7 @@ async function bodyOf2({
|
|
|
92482
93047
|
flags: flags2
|
|
92483
93048
|
}) {
|
|
92484
93049
|
const body = { ...flags2.fields };
|
|
92485
|
-
const read4 = (source) => "file" in source ?
|
|
93050
|
+
const read4 = (source) => "file" in source ? readFile27(resolve17(context.cwd, source.file), "utf8") : source.text;
|
|
92486
93051
|
for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
|
|
92487
93052
|
if (flags2.rich) {
|
|
92488
93053
|
const text3 = await read4(flags2.rich.source);
|
|
@@ -92745,7 +93310,7 @@ async function textFlag({
|
|
|
92745
93310
|
}) {
|
|
92746
93311
|
const value = flagText({ args, name: name3 });
|
|
92747
93312
|
if (!value.startsWith("@")) return value;
|
|
92748
|
-
return
|
|
93313
|
+
return readFile27(resolve17(context.cwd, value.slice(1)), "utf8");
|
|
92749
93314
|
}
|
|
92750
93315
|
async function feedList({ context, args }) {
|
|
92751
93316
|
const { client } = await signedIn({ context, args });
|
|
@@ -92835,7 +93400,7 @@ async function ranksOf({
|
|
|
92835
93400
|
}) {
|
|
92836
93401
|
const file4 = flagText({ args, name: "file" });
|
|
92837
93402
|
if (file4) {
|
|
92838
|
-
const parsed = JSON.parse(await
|
|
93403
|
+
const parsed = JSON.parse(await readFile27(resolve17(context.cwd, file4), "utf8"));
|
|
92839
93404
|
if (Array.isArray(parsed)) return parsed;
|
|
92840
93405
|
throw new CliUsageError("--file holds a list of {itemId, priority}");
|
|
92841
93406
|
}
|
|
@@ -92948,7 +93513,7 @@ async function feed({ context, args }) {
|
|
|
92948
93513
|
}
|
|
92949
93514
|
|
|
92950
93515
|
// src/services/github-commands.service.ts
|
|
92951
|
-
import { readFile as
|
|
93516
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
92952
93517
|
|
|
92953
93518
|
// src/rules/github-signature.rules.ts
|
|
92954
93519
|
var TURN_SEPARATOR = "~";
|
|
@@ -93018,7 +93583,7 @@ var REAL_GH = "/usr/bin/gh";
|
|
|
93018
93583
|
var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Run `laze github request --repo <owner/name>` to post a card that gets it in one click, or its owner runs `laze agent set-github <agent> <connection>`.";
|
|
93019
93584
|
async function turnFileToken({ env }) {
|
|
93020
93585
|
if (!env.LAZE_TURN_FILE) return "";
|
|
93021
|
-
return
|
|
93586
|
+
return readFile28(env.LAZE_TURN_FILE, "utf8").then(
|
|
93022
93587
|
(text3) => text3.trim(),
|
|
93023
93588
|
() => ""
|
|
93024
93589
|
);
|
|
@@ -93052,7 +93617,7 @@ async function githubGh({
|
|
|
93052
93617
|
args: args.rest,
|
|
93053
93618
|
agentName: profile.name ?? "An agent",
|
|
93054
93619
|
threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
|
|
93055
|
-
readBodyFile: (path) => path === "-" ? context.readStdin() :
|
|
93620
|
+
readBodyFile: (path) => path === "-" ? context.readStdin() : readFile28(path, "utf8")
|
|
93056
93621
|
});
|
|
93057
93622
|
return context.runCommand({
|
|
93058
93623
|
command: [REAL_GH, ...ghArgs],
|
|
@@ -93662,11 +94227,11 @@ async function ip({ context, args }) {
|
|
|
93662
94227
|
|
|
93663
94228
|
// src/services/join-commands.service.ts
|
|
93664
94229
|
import { rm as rm16 } from "node:fs/promises";
|
|
93665
|
-
import { dirname as
|
|
94230
|
+
import { dirname as dirname20, join as join29 } from "node:path";
|
|
93666
94231
|
var DEFAULT_WAIT_SECONDS2 = 100;
|
|
93667
94232
|
var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
|
|
93668
94233
|
function pendingPathOf({ context }) {
|
|
93669
|
-
return
|
|
94234
|
+
return join29(dirname20(context.environment.configPath), "join", "pending.json");
|
|
93670
94235
|
}
|
|
93671
94236
|
async function readPending({
|
|
93672
94237
|
context,
|
|
@@ -94816,18 +95381,18 @@ async function serveMcp({
|
|
|
94816
95381
|
}
|
|
94817
95382
|
|
|
94818
95383
|
// src/services/memory-commands.service.ts
|
|
94819
|
-
import { readdir as
|
|
94820
|
-
import { join as
|
|
95384
|
+
import { readdir as readdir8, readFile as readFile30 } from "node:fs/promises";
|
|
95385
|
+
import { join as join30, resolve as resolve19 } from "node:path";
|
|
94821
95386
|
|
|
94822
95387
|
// src/services/mount-files.service.ts
|
|
94823
|
-
import { mkdir as mkdir10, readFile as
|
|
94824
|
-
import { dirname as
|
|
95388
|
+
import { mkdir as mkdir10, readFile as readFile29, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
|
|
95389
|
+
import { dirname as dirname21, relative as relative5, resolve as resolve18 } from "node:path";
|
|
94825
95390
|
async function textArgument({
|
|
94826
95391
|
context,
|
|
94827
95392
|
value
|
|
94828
95393
|
}) {
|
|
94829
95394
|
if (value === "-") return context.readStdin();
|
|
94830
|
-
if (value.startsWith("@")) return
|
|
95395
|
+
if (value.startsWith("@")) return readFile29(resolve18(context.cwd, value.slice(1)), "utf8");
|
|
94831
95396
|
return value;
|
|
94832
95397
|
}
|
|
94833
95398
|
function turnChannel({ context, args }) {
|
|
@@ -94847,7 +95412,7 @@ async function writeMount({
|
|
|
94847
95412
|
const inside = relative5(root, target);
|
|
94848
95413
|
if (!inside || inside.startsWith(".."))
|
|
94849
95414
|
throw new Error(`Refusing to write outside ${root}: ${file4.path}`);
|
|
94850
|
-
await mkdir10(
|
|
95415
|
+
await mkdir10(dirname21(target), { recursive: true });
|
|
94851
95416
|
await writeFile8(target, file4.content);
|
|
94852
95417
|
}
|
|
94853
95418
|
return root;
|
|
@@ -94974,7 +95539,7 @@ async function turnTokenOf5({ context }) {
|
|
|
94974
95539
|
const pinned = env.LAZE_TURN_TOKEN?.trim();
|
|
94975
95540
|
if (pinned) return pinned;
|
|
94976
95541
|
if (!env.LAZE_TURN_FILE) return "";
|
|
94977
|
-
return
|
|
95542
|
+
return readFile30(env.LAZE_TURN_FILE, "utf8").then(
|
|
94978
95543
|
(text3) => text3.trim(),
|
|
94979
95544
|
() => ""
|
|
94980
95545
|
);
|
|
@@ -95104,15 +95669,15 @@ async function siestaImport({
|
|
|
95104
95669
|
dir
|
|
95105
95670
|
}) {
|
|
95106
95671
|
const root = resolve19(context.cwd, dir);
|
|
95107
|
-
const log = await
|
|
95108
|
-
const names = (await
|
|
95672
|
+
const log = await readFile30(join30(root, "LOG.md"));
|
|
95673
|
+
const names = (await readdir8(join30(root, "tree")).catch(() => [])).filter(
|
|
95109
95674
|
(name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
|
|
95110
95675
|
);
|
|
95111
95676
|
const tree = Object.fromEntries(
|
|
95112
95677
|
await Promise.all(
|
|
95113
95678
|
names.map(async (name3) => [
|
|
95114
95679
|
name3.slice(0, -3),
|
|
95115
|
-
(await
|
|
95680
|
+
(await readFile30(join30(root, "tree", name3))).toString("base64")
|
|
95116
95681
|
])
|
|
95117
95682
|
)
|
|
95118
95683
|
);
|
|
@@ -95132,15 +95697,15 @@ async function memoryImport({ context, args }) {
|
|
|
95132
95697
|
const dir = flagText({ args, name: "optmem" });
|
|
95133
95698
|
if (!dir) throw new CliUsageError(USAGE13);
|
|
95134
95699
|
const root = resolve19(context.cwd, dir);
|
|
95135
|
-
const log = await
|
|
95136
|
-
const sizes2 = (await
|
|
95700
|
+
const log = await readFile30(join30(root, "LOG.txt"));
|
|
95701
|
+
const sizes2 = (await readdir8(join30(root, "TREE")).catch(() => [])).filter(
|
|
95137
95702
|
(name3) => /^\d{1,4}$/.test(name3)
|
|
95138
95703
|
);
|
|
95139
95704
|
const tree = Object.fromEntries(
|
|
95140
95705
|
await Promise.all(
|
|
95141
95706
|
sizes2.map(async (size) => [
|
|
95142
95707
|
size,
|
|
95143
|
-
(await
|
|
95708
|
+
(await readFile30(join30(root, "TREE", size))).toString("base64")
|
|
95144
95709
|
])
|
|
95145
95710
|
)
|
|
95146
95711
|
);
|
|
@@ -95705,8 +96270,8 @@ async function openclaw({
|
|
|
95705
96270
|
|
|
95706
96271
|
// src/services/operator-key-commands.service.ts
|
|
95707
96272
|
import { createHash as createHash7, randomBytes as randomBytes4 } from "node:crypto";
|
|
95708
|
-
import { mkdir as mkdir11, readFile as
|
|
95709
|
-
import { dirname as
|
|
96273
|
+
import { mkdir as mkdir11, readFile as readFile31, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
|
|
96274
|
+
import { dirname as dirname22, join as join31 } from "node:path";
|
|
95710
96275
|
|
|
95711
96276
|
// ../../modules/audit-log/contract/src/audit-log.api.ts
|
|
95712
96277
|
var auditEntrySchemaDefinition = external_exports.object({
|
|
@@ -97077,14 +97642,14 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
|
|
|
97077
97642
|
laze ops status <key> waiting, approved or ended
|
|
97078
97643
|
laze ops use <key> run the approved action and print the answer`;
|
|
97079
97644
|
var POLL_MS3 = 5e3;
|
|
97080
|
-
var keyFile = ({ context, keyId }) =>
|
|
97645
|
+
var keyFile = ({ context, keyId }) => join31(dirname22(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
|
|
97081
97646
|
async function saveSecret({
|
|
97082
97647
|
context,
|
|
97083
97648
|
keyId,
|
|
97084
97649
|
secret
|
|
97085
97650
|
}) {
|
|
97086
97651
|
const path = keyFile({ context, keyId });
|
|
97087
|
-
await mkdir11(
|
|
97652
|
+
await mkdir11(dirname22(path), { recursive: true, mode: 448 });
|
|
97088
97653
|
await writeFile9(path, secret, { mode: 384 });
|
|
97089
97654
|
}
|
|
97090
97655
|
function typedArg(text3) {
|
|
@@ -97178,7 +97743,7 @@ async function useKey({ context, args }) {
|
|
|
97178
97743
|
if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
|
|
97179
97744
|
const { client } = await signedIn({ context, args });
|
|
97180
97745
|
const path = keyFile({ context, keyId });
|
|
97181
|
-
const secret = await
|
|
97746
|
+
const secret = await readFile31(path, "utf8").catch(() => null);
|
|
97182
97747
|
if (secret === null) {
|
|
97183
97748
|
throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
|
|
97184
97749
|
}
|
|
@@ -97243,142 +97808,13 @@ ${OPS_USAGE}`);
|
|
|
97243
97808
|
}
|
|
97244
97809
|
|
|
97245
97810
|
// src/services/release-watch.service.ts
|
|
97246
|
-
import { realpath } from "node:fs/promises";
|
|
97247
|
-
import { dirname as
|
|
97248
|
-
|
|
97249
|
-
// src/rules/cli-update.rules.ts
|
|
97250
|
-
var CLI_PACKAGE = "@lazehq/cli";
|
|
97251
|
-
var CLI_PACKAGE_LATEST = `${CLI_PACKAGE}@latest`;
|
|
97252
|
-
var MANAGERS = [
|
|
97253
|
-
{ manager: "bun", pattern: /[\\/]\.?bun[\\/]/, command: ["bun", "add", "-g"] },
|
|
97254
|
-
{ manager: "pnpm", pattern: /[\\/]\.?pnpm[\\/]/, command: ["pnpm", "add", "-g"] },
|
|
97255
|
-
{ manager: "yarn", pattern: /[\\/]yarn[\\/]global[\\/]/, command: ["yarn", "global", "add"] },
|
|
97256
|
-
{
|
|
97257
|
-
manager: "npm",
|
|
97258
|
-
pattern: /[\\/]_npx[\\/]|[\\/]node_modules[\\/]@lazehq[\\/]cli[\\/]/,
|
|
97259
|
-
command: ["npm", "install", "-g"]
|
|
97260
|
-
}
|
|
97261
|
-
];
|
|
97262
|
-
var NPM_PREFIX = /^(.+)[\\/]lib[\\/]node_modules[\\/]@lazehq[\\/]cli[\\/]/;
|
|
97263
|
-
var NPX_CACHE2 = /[\\/]_npx[\\/]/;
|
|
97264
|
-
function releaseAgeOverrideOf({ manager }) {
|
|
97265
|
-
if (manager === "npm") return ["--prefer-online", "--min-release-age=0"];
|
|
97266
|
-
if (manager === "pnpm") return [`--config.minimum-release-age-exclude=${CLI_PACKAGE}`];
|
|
97267
|
-
if (manager === "bun") return ["--minimum-release-age=0"];
|
|
97268
|
-
return [];
|
|
97269
|
-
}
|
|
97270
|
-
function updatePlanOf({ script }) {
|
|
97271
|
-
if (script === SANDBOX_CLI_PATH) return { kind: "sandbox" };
|
|
97272
|
-
const found = MANAGERS.find(({ pattern }) => pattern.test(script));
|
|
97273
|
-
if (!found) return { kind: "unmanaged", script };
|
|
97274
|
-
const prefix = found.manager === "npm" && !NPX_CACHE2.test(script) ? NPM_PREFIX.exec(script)?.[1] : void 0;
|
|
97275
|
-
return {
|
|
97276
|
-
kind: "install",
|
|
97277
|
-
manager: found.manager,
|
|
97278
|
-
command: [
|
|
97279
|
-
...found.command,
|
|
97280
|
-
...prefix ? ["--prefix", prefix] : [],
|
|
97281
|
-
...releaseAgeOverrideOf({ manager: found.manager }),
|
|
97282
|
-
CLI_PACKAGE_LATEST
|
|
97283
|
-
]
|
|
97284
|
-
};
|
|
97285
|
-
}
|
|
97286
|
-
function pinnedCommandOf({
|
|
97287
|
-
plan: plan2,
|
|
97288
|
-
version: version2
|
|
97289
|
-
}) {
|
|
97290
|
-
return plan2.command.map(
|
|
97291
|
-
(part) => part === CLI_PACKAGE_LATEST ? `${CLI_PACKAGE}@${version2}` : part
|
|
97292
|
-
);
|
|
97293
|
-
}
|
|
97294
|
-
var RELEASE_AGE_SETTINGS = {
|
|
97295
|
-
npm: [
|
|
97296
|
-
{ setting: "min-release-age", read: ["npm", "config", "get", "min-release-age"] },
|
|
97297
|
-
{ setting: "before", read: ["npm", "config", "get", "before"] }
|
|
97298
|
-
],
|
|
97299
|
-
pnpm: [
|
|
97300
|
-
{ setting: "minimum-release-age", read: ["pnpm", "config", "get", "minimum-release-age"] }
|
|
97301
|
-
]
|
|
97302
|
-
};
|
|
97303
|
-
function settingValueOf({ printed: printed2 }) {
|
|
97304
|
-
const value = printed2.trim();
|
|
97305
|
-
return value === "" || value === "null" || value === "undefined" || value === "0" ? null : value;
|
|
97306
|
-
}
|
|
97307
|
-
var VERSION_LINE = /^laze (\S+)\s*$/m;
|
|
97308
|
-
function printedVersionOf({ printed: printed2 }) {
|
|
97309
|
-
return VERSION_LINE.exec(printed2)?.[1] ?? null;
|
|
97310
|
-
}
|
|
97311
|
-
function heldBackLineOf({
|
|
97312
|
-
manager,
|
|
97313
|
-
installed,
|
|
97314
|
-
latest,
|
|
97315
|
-
settings: settings3,
|
|
97316
|
-
command,
|
|
97317
|
-
script
|
|
97318
|
-
}) {
|
|
97319
|
-
const head = latest ? `laze is ${installed} after the install, but the latest release is ${latest}.` : `laze is still ${installed} after the install, and the npm registry did not say which release is the latest.`;
|
|
97320
|
-
const line = command.join(" ");
|
|
97321
|
-
if (settings3.length > 0) {
|
|
97322
|
-
return `${head} ${manager}'s ${settings3.join(" and ")} setting holds back releases younger than it allows, so ${manager} kept or picked an older one. Install the latest with: ${line}
|
|
97323
|
-
`;
|
|
97324
|
-
}
|
|
97325
|
-
if (manager === "bun") {
|
|
97326
|
-
return `${head} A minimumReleaseAge in bunfig.toml may hold it back, or another laze comes first on PATH (this one is ${script}). Install the latest with: ${line}
|
|
97327
|
-
`;
|
|
97328
|
-
}
|
|
97329
|
-
return `${head} No release-age setting is set, so another laze may come first on PATH (this one is ${script}). Install the latest with: ${line}
|
|
97330
|
-
`;
|
|
97331
|
-
}
|
|
97332
|
-
|
|
97333
|
-
// src/rules/cli-release.rules.ts
|
|
97334
|
-
var CLI_RELEASE_HEADER = "x-laze-cli-release";
|
|
97335
|
-
var STAMP = /^(\d+)\.(\d+)\.(\d+)(?:-g([0-9a-f]+))?$/;
|
|
97336
|
-
function releaseSkewOf({
|
|
97337
|
-
mine: mine4,
|
|
97338
|
-
server
|
|
97339
|
-
}) {
|
|
97340
|
-
const have = STAMP.exec(mine4);
|
|
97341
|
-
const ships = STAMP.exec(server);
|
|
97342
|
-
if (!have || !ships) return null;
|
|
97343
|
-
for (const part of [1, 2, 3]) {
|
|
97344
|
-
const difference = Number(have[part]) - Number(ships[part]);
|
|
97345
|
-
if (difference !== 0) return difference < 0 ? "older" : "newer";
|
|
97346
|
-
}
|
|
97347
|
-
return have[4] && ships[4] && have[4] !== ships[4] ? "other_build" : null;
|
|
97348
|
-
}
|
|
97349
|
-
function releaseWarningOf({
|
|
97350
|
-
mine: mine4,
|
|
97351
|
-
server,
|
|
97352
|
-
sandbox
|
|
97353
|
-
}) {
|
|
97354
|
-
const skew = releaseSkewOf({ mine: mine4, server });
|
|
97355
|
-
if (!skew || skew === "other_build") return null;
|
|
97356
|
-
if (sandbox) {
|
|
97357
|
-
return `laze: this CLI is ${mine4}, but the server ships ${server}. Laze updates the computer's CLI each time the agent connects, so restart the agent if this stays.
|
|
97358
|
-
`;
|
|
97359
|
-
}
|
|
97360
|
-
if (skew === "newer") {
|
|
97361
|
-
return `laze: this CLI is ${mine4}, newer than the server's ${server}; a command the server does not have yet fails.
|
|
97362
|
-
`;
|
|
97363
|
-
}
|
|
97364
|
-
return `laze: this CLI is ${mine4}, older than the server's ${server}. Update it with npm i -g ${CLI_PACKAGE_LATEST} (or laze update).
|
|
97365
|
-
`;
|
|
97366
|
-
}
|
|
97367
|
-
function selfUpdateLineOf({
|
|
97368
|
-
mine: mine4,
|
|
97369
|
-
server,
|
|
97370
|
-
manager
|
|
97371
|
-
}) {
|
|
97372
|
-
return `laze: this CLI is ${mine4}, older than the server's ${server}. Updating it in the background with ${manager}; the next command runs the new one (LAZE_AUTO_UPDATE=0 turns this off).
|
|
97373
|
-
`;
|
|
97374
|
-
}
|
|
97375
|
-
|
|
97376
|
-
// src/services/release-watch.service.ts
|
|
97811
|
+
import { realpath as realpath2 } from "node:fs/promises";
|
|
97812
|
+
import { dirname as dirname23, join as join32 } from "node:path";
|
|
97377
97813
|
var RETRY_AFTER_MS = 6 * 60 * 60 * 1e3;
|
|
97378
97814
|
async function scriptOf(context) {
|
|
97379
97815
|
const script = context.program.at(-1) ?? "";
|
|
97380
97816
|
try {
|
|
97381
|
-
return await
|
|
97817
|
+
return await realpath2(script);
|
|
97382
97818
|
} catch {
|
|
97383
97819
|
return script;
|
|
97384
97820
|
}
|
|
@@ -97390,15 +97826,15 @@ async function startedUpdate({
|
|
|
97390
97826
|
if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
|
|
97391
97827
|
const plan2 = updatePlanOf({ script: await scriptOf(context) });
|
|
97392
97828
|
if (plan2.kind !== "install") return null;
|
|
97393
|
-
const folder =
|
|
97394
|
-
const stamp =
|
|
97829
|
+
const folder = dirname23(context.environment.configPath);
|
|
97830
|
+
const stamp = join32(folder, "auto-update.json");
|
|
97395
97831
|
const last = await readStateJson({ path: stamp }) ?? null;
|
|
97396
97832
|
const now = context.nowMs();
|
|
97397
97833
|
if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
|
|
97398
97834
|
await writeStateJson({ path: stamp, value: { server, atMs: now } });
|
|
97399
97835
|
context.processes.spawnDetached({
|
|
97400
97836
|
argv: [...context.program, "update"],
|
|
97401
|
-
logPath:
|
|
97837
|
+
logPath: join32(folder, "auto-update.log")
|
|
97402
97838
|
});
|
|
97403
97839
|
return { manager: plan2.manager };
|
|
97404
97840
|
}
|
|
@@ -97691,8 +98127,8 @@ async function schedule({ context, args }) {
|
|
|
97691
98127
|
}
|
|
97692
98128
|
|
|
97693
98129
|
// src/services/skill-commands.service.ts
|
|
97694
|
-
import { readdir as
|
|
97695
|
-
import { join as
|
|
98130
|
+
import { readdir as readdir9, readFile as readFile32 } from "node:fs/promises";
|
|
98131
|
+
import { join as join33, relative as relative6, resolve as resolve21 } from "node:path";
|
|
97696
98132
|
var USAGE17 = `Usage:
|
|
97697
98133
|
laze skill list [--agent <agentId>]
|
|
97698
98134
|
laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
|
|
@@ -97709,12 +98145,12 @@ var USAGE17 = `Usage:
|
|
|
97709
98145
|
--agent names the agent with a person's key; an agent's key works on its own skills.
|
|
97710
98146
|
With a person's key, list without --agent shows every agent's skills.`;
|
|
97711
98147
|
async function folderFiles({ root }) {
|
|
97712
|
-
const entries = await
|
|
98148
|
+
const entries = await readdir9(root, { recursive: true, withFileTypes: true });
|
|
97713
98149
|
const files2 = [];
|
|
97714
98150
|
for (const entry of entries) {
|
|
97715
98151
|
if (!entry.isFile()) continue;
|
|
97716
|
-
const full =
|
|
97717
|
-
files2.push({ path: relative6(root, full), content: await
|
|
98152
|
+
const full = join33(entry.parentPath, entry.name);
|
|
98153
|
+
files2.push({ path: relative6(root, full), content: await readFile32(full, "utf8") });
|
|
97718
98154
|
}
|
|
97719
98155
|
return files2.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
97720
98156
|
}
|
|
@@ -97812,7 +98248,7 @@ async function skillUpdate({ context, args }) {
|
|
|
97812
98248
|
if (!name3 || !newName && description === void 0 && !skillMdFile) {
|
|
97813
98249
|
throw new CliUsageError(USAGE17);
|
|
97814
98250
|
}
|
|
97815
|
-
const skillMd = skillMdFile ? await
|
|
98251
|
+
const skillMd = skillMdFile ? await readFile32(resolve21(context.cwd, skillMdFile), "utf8") : void 0;
|
|
97816
98252
|
const { client } = await signedIn({ context, args });
|
|
97817
98253
|
const updated = await client.post("/api/skills/update", {
|
|
97818
98254
|
name: name3,
|
|
@@ -97858,7 +98294,7 @@ async function skill({ context, args }) {
|
|
|
97858
98294
|
}
|
|
97859
98295
|
|
|
97860
98296
|
// src/services/slack-commands.service.ts
|
|
97861
|
-
import { readFile as
|
|
98297
|
+
import { readFile as readFile33 } from "node:fs/promises";
|
|
97862
98298
|
import { resolve as resolve22 } from "node:path";
|
|
97863
98299
|
var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
|
|
97864
98300
|
laze slack overview connected Slack workspaces, mirrors, your link
|
|
@@ -97906,7 +98342,7 @@ async function secretLines({ context, args }) {
|
|
|
97906
98342
|
throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
|
|
97907
98343
|
}
|
|
97908
98344
|
const file4 = flagText({ args, name: "from-file" });
|
|
97909
|
-
const text3 = file4 ? await
|
|
98345
|
+
const text3 = file4 ? await readFile33(resolve22(context.cwd, file4), "utf8") : await context.readStdin();
|
|
97910
98346
|
return text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
97911
98347
|
}
|
|
97912
98348
|
async function secretsOf2({
|
|
@@ -98210,7 +98646,7 @@ async function slack({
|
|
|
98210
98646
|
}
|
|
98211
98647
|
|
|
98212
98648
|
// src/services/sso-commands.service.ts
|
|
98213
|
-
import { readFile as
|
|
98649
|
+
import { readFile as readFile34 } from "node:fs/promises";
|
|
98214
98650
|
var SSO_USAGE = `Usage:
|
|
98215
98651
|
laze sso domains claimed domains and how each signs in (admins)
|
|
98216
98652
|
laze sso claim <domain> the TXT record that proves the domain
|
|
@@ -98297,7 +98733,7 @@ function refuseSecretFlags({ args }) {
|
|
|
98297
98733
|
}
|
|
98298
98734
|
async function clientSecretOf({ context, args }) {
|
|
98299
98735
|
const file4 = flagText({ args, name: "from-file" });
|
|
98300
|
-
const text3 = file4 ? await
|
|
98736
|
+
const text3 = file4 ? await readFile34(file4, "utf8") : await context.readStdin();
|
|
98301
98737
|
const secret = text3.trim();
|
|
98302
98738
|
if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
|
|
98303
98739
|
return secret;
|
|
@@ -98510,14 +98946,14 @@ async function statusUsage() {
|
|
|
98510
98946
|
}
|
|
98511
98947
|
|
|
98512
98948
|
// src/services/update-commands.service.ts
|
|
98513
|
-
import { realpath as
|
|
98949
|
+
import { realpath as realpath3 } from "node:fs/promises";
|
|
98514
98950
|
var BY_HAND = `npm install -g ${CLI_PACKAGE_LATEST}`;
|
|
98515
98951
|
var REGISTRY_LATEST_URL = `https://registry.npmjs.org/${CLI_PACKAGE}/latest`;
|
|
98516
98952
|
var REGISTRY_TIMEOUT_MS = 1e4;
|
|
98517
98953
|
async function realScriptOf({ program }) {
|
|
98518
98954
|
const script = program.at(-1) ?? "";
|
|
98519
98955
|
try {
|
|
98520
|
-
return await
|
|
98956
|
+
return await realpath3(script);
|
|
98521
98957
|
} catch {
|
|
98522
98958
|
return script;
|
|
98523
98959
|
}
|
|
@@ -98599,6 +99035,14 @@ async function update2({
|
|
|
98599
99035
|
`);
|
|
98600
99036
|
return code;
|
|
98601
99037
|
}
|
|
99038
|
+
return checkInstalled({ context, plan: plan2, mine: mine4, latest });
|
|
99039
|
+
}
|
|
99040
|
+
async function checkInstalled({
|
|
99041
|
+
context,
|
|
99042
|
+
plan: plan2,
|
|
99043
|
+
mine: mine4,
|
|
99044
|
+
latest
|
|
99045
|
+
}) {
|
|
98602
99046
|
const printed2 = await printedBy({ context, command: [...context.program, "--version"] });
|
|
98603
99047
|
const installed = printed2 === null ? null : printedVersionOf({ printed: printed2 });
|
|
98604
99048
|
if (!installed) {
|
|
@@ -98606,14 +99050,18 @@ async function update2({
|
|
|
98606
99050
|
return 0;
|
|
98607
99051
|
}
|
|
98608
99052
|
const held = latest ? releaseSkewOf({ mine: installed, server: latest }) === "older" : installed === mine4;
|
|
99053
|
+
const { script, onPath } = await otherInstallsOf({ context });
|
|
99054
|
+
const shadowed = shadowedLineOf({ updated: installed, script, onPath });
|
|
98609
99055
|
if (!held) {
|
|
98610
99056
|
context.out(
|
|
98611
99057
|
installed === mine4 ? `laze ${mine4} is the latest release.
|
|
98612
99058
|
` : `Updated laze ${mine4} to ${installed}.
|
|
98613
99059
|
`
|
|
98614
99060
|
);
|
|
99061
|
+
if (shadowed) context.err(shadowed);
|
|
98615
99062
|
return 0;
|
|
98616
99063
|
}
|
|
99064
|
+
if (shadowed) context.err(shadowed);
|
|
98617
99065
|
const settings3 = await releaseAgeSettingsOf({ context, manager: plan2.manager });
|
|
98618
99066
|
context.err(
|
|
98619
99067
|
heldBackLineOf({
|
|
@@ -98629,8 +99077,8 @@ async function update2({
|
|
|
98629
99077
|
}
|
|
98630
99078
|
|
|
98631
99079
|
// src/services/vault-env-commands.service.ts
|
|
98632
|
-
import { readFile as
|
|
98633
|
-
import { dirname as
|
|
99080
|
+
import { readFile as readFile35, stat as stat12 } from "node:fs/promises";
|
|
99081
|
+
import { dirname as dirname24, join as join34, resolve as resolve23 } from "node:path";
|
|
98634
99082
|
|
|
98635
99083
|
// src/rules/vault-manifest.rules.ts
|
|
98636
99084
|
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
@@ -98976,9 +99424,9 @@ async function manifestPathOf({
|
|
|
98976
99424
|
if (named) return resolve23(context.cwd, named);
|
|
98977
99425
|
const environment = flagText({ args, name: "env" });
|
|
98978
99426
|
const file4 = environment ? `.env.${environment}.vault` : ".env.vault";
|
|
98979
|
-
for (let dir = resolve23(context.cwd); ; dir =
|
|
98980
|
-
if (await isFile(
|
|
98981
|
-
if (
|
|
99427
|
+
for (let dir = resolve23(context.cwd); ; dir = dirname24(dir)) {
|
|
99428
|
+
if (await isFile(join34(dir, file4))) return join34(dir, file4);
|
|
99429
|
+
if (dirname24(dir) === dir) break;
|
|
98982
99430
|
}
|
|
98983
99431
|
throw new CliUsageError(`laze vault: no ${file4} here or in a parent folder
|
|
98984
99432
|
${ENV_USAGE}`);
|
|
@@ -98988,7 +99436,7 @@ async function manifestOf({
|
|
|
98988
99436
|
args
|
|
98989
99437
|
}) {
|
|
98990
99438
|
const file4 = await manifestPathOf({ context, args });
|
|
98991
|
-
const text3 = await
|
|
99439
|
+
const text3 = await readFile35(file4, "utf8").catch(() => {
|
|
98992
99440
|
throw new CliUsageError(`laze vault: cannot read ${file4}`);
|
|
98993
99441
|
});
|
|
98994
99442
|
return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
|
|
@@ -99303,7 +99751,7 @@ async function vaultScrub({ context, args }) {
|
|
|
99303
99751
|
}
|
|
99304
99752
|
|
|
99305
99753
|
// src/services/whatsapp-business-commands.service.ts
|
|
99306
|
-
import { readFile as
|
|
99754
|
+
import { readFile as readFile36 } from "node:fs/promises";
|
|
99307
99755
|
import { resolve as resolve24 } from "node:path";
|
|
99308
99756
|
|
|
99309
99757
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
|
|
@@ -99351,8 +99799,8 @@ var WHATSAPP_BUSINESS_REST_PATHS = {
|
|
|
99351
99799
|
var WHATSAPP_BUSINESS_TEXT_MAX = 4096;
|
|
99352
99800
|
var WHATSAPP_BUSINESS_LIMIT_MAX = 200;
|
|
99353
99801
|
var WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS = 50;
|
|
99354
|
-
var
|
|
99355
|
-
var workspaceInput6 = external_exports.object({ workspaceId:
|
|
99802
|
+
var workspaceIdSchema27 = external_exports.string().min(1).max(64);
|
|
99803
|
+
var workspaceInput6 = external_exports.object({ workspaceId: workspaceIdSchema27 });
|
|
99356
99804
|
var digits = (what) => external_exports.string().trim().regex(/^\d{5,30}$/, `${what} is the number Meta shows, digits only`);
|
|
99357
99805
|
var appSecretSchema = external_exports.string().trim().regex(/^[a-f0-9]{32}$/i, "The app secret is 32 letters and digits from App settings > Basic");
|
|
99358
99806
|
var accessTokenSchema = external_exports.string().trim().min(20, "The access token is the long permanent system user token").max(2e3).regex(/^\S+$/, "The access token is one line with no spaces");
|
|
@@ -99386,7 +99834,7 @@ var statusDefinition = external_exports.object({
|
|
|
99386
99834
|
});
|
|
99387
99835
|
var whatsappBusinessStatusSchema = statusDefinition;
|
|
99388
99836
|
var connectDefinition2 = external_exports.object({
|
|
99389
|
-
workspaceId:
|
|
99837
|
+
workspaceId: workspaceIdSchema27,
|
|
99390
99838
|
appId: digits("The app id"),
|
|
99391
99839
|
wabaId: digits("The WhatsApp Business Account id"),
|
|
99392
99840
|
phoneNumberId: digits("The phone number id"),
|
|
@@ -99409,7 +99857,7 @@ var webhookDefinition = external_exports.object({
|
|
|
99409
99857
|
});
|
|
99410
99858
|
var whatsappBusinessWebhookSchema = webhookDefinition;
|
|
99411
99859
|
var settingsDefinition3 = external_exports.object({
|
|
99412
|
-
workspaceId:
|
|
99860
|
+
workspaceId: workspaceIdSchema27,
|
|
99413
99861
|
/** The agent that answers; null for none. Left out keeps the current one. */
|
|
99414
99862
|
agentId: external_exports.string().min(1).max(64).nullable().optional(),
|
|
99415
99863
|
replyMode: whatsappBusinessReplyModeSchema.optional()
|
|
@@ -99429,7 +99877,7 @@ var whatsappBusinessConversationSchema = conversationDefinition;
|
|
|
99429
99877
|
var limitSchema2 = external_exports.number().int().min(1).max(WHATSAPP_BUSINESS_LIMIT_MAX);
|
|
99430
99878
|
var contactRefSchema = external_exports.string().trim().min(1).max(64);
|
|
99431
99879
|
var conversationsInputDefinition = external_exports.object({
|
|
99432
|
-
workspaceId:
|
|
99880
|
+
workspaceId: workspaceIdSchema27,
|
|
99433
99881
|
limit: limitSchema2.optional()
|
|
99434
99882
|
});
|
|
99435
99883
|
var whatsappBusinessConversationsInputSchema = conversationsInputDefinition;
|
|
@@ -99455,7 +99903,7 @@ var messageDefinition3 = external_exports.object({
|
|
|
99455
99903
|
template: external_exports.string().nullable()
|
|
99456
99904
|
});
|
|
99457
99905
|
var readInputDefinition2 = external_exports.object({
|
|
99458
|
-
workspaceId:
|
|
99906
|
+
workspaceId: workspaceIdSchema27,
|
|
99459
99907
|
contact: contactRefSchema,
|
|
99460
99908
|
limit: limitSchema2.optional()
|
|
99461
99909
|
});
|
|
@@ -99464,12 +99912,12 @@ var readDefinition2 = external_exports.object({
|
|
|
99464
99912
|
messages: external_exports.array(messageDefinition3)
|
|
99465
99913
|
});
|
|
99466
99914
|
var sendInputDefinition2 = external_exports.object({
|
|
99467
|
-
workspaceId:
|
|
99915
|
+
workspaceId: workspaceIdSchema27,
|
|
99468
99916
|
to: contactRefSchema,
|
|
99469
99917
|
text: external_exports.string().trim().min(1).max(WHATSAPP_BUSINESS_TEXT_MAX)
|
|
99470
99918
|
});
|
|
99471
99919
|
var sendTemplateInputDefinition = external_exports.object({
|
|
99472
|
-
workspaceId:
|
|
99920
|
+
workspaceId: workspaceIdSchema27,
|
|
99473
99921
|
to: contactRefSchema,
|
|
99474
99922
|
template: external_exports.string().trim().min(1).max(512),
|
|
99475
99923
|
/** The template's language code; the only approved one when left out. */
|
|
@@ -99496,7 +99944,7 @@ function whatsappBusinessSendSettled({
|
|
|
99496
99944
|
return state !== "waiting" && state !== "sending";
|
|
99497
99945
|
}
|
|
99498
99946
|
var sendStatusInputDefinition2 = external_exports.object({
|
|
99499
|
-
workspaceId:
|
|
99947
|
+
workspaceId: workspaceIdSchema27,
|
|
99500
99948
|
sendId: external_exports.string().min(1).max(64),
|
|
99501
99949
|
waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS).default(0)
|
|
99502
99950
|
});
|
|
@@ -99546,7 +99994,7 @@ var restSendStatusDefinition2 = sendStatusInputDefinition2.omit({ workspaceId: t
|
|
|
99546
99994
|
var restSettingsDefinition = settingsDefinition3.omit({ workspaceId: true });
|
|
99547
99995
|
var restEmptyDefinition = external_exports.object({});
|
|
99548
99996
|
var WhatsappBusinessApi = moduleApi()("whatsapp-business");
|
|
99549
|
-
var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("connect").withInput(connectWhatsappBusinessInputSchema).withOutput(whatsappBusinessWebhookSchema).mutation("check").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("verifyToken").withInput(workspaceInput6).withOutput(whatsappBusinessWebhookSchema).mutation("settings").withInput(updateWhatsappBusinessSettingsInputSchema).withOutput(whatsappBusinessStatusSchema).mutation("disconnect").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).query("conversations").withInput(whatsappBusinessConversationsInputSchema).withOutput(external_exports.array(whatsappBusinessConversationSchema)).query("templates").withInput(workspaceInput6).withOutput(external_exports.array(whatsappBusinessTemplateSchema)).query("prices").withInput(external_exports.object({ ...pricesInputDefinition.shape, workspaceId:
|
|
99997
|
+
var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("connect").withInput(connectWhatsappBusinessInputSchema).withOutput(whatsappBusinessWebhookSchema).mutation("check").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("verifyToken").withInput(workspaceInput6).withOutput(whatsappBusinessWebhookSchema).mutation("settings").withInput(updateWhatsappBusinessSettingsInputSchema).withOutput(whatsappBusinessStatusSchema).mutation("disconnect").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).query("conversations").withInput(whatsappBusinessConversationsInputSchema).withOutput(external_exports.array(whatsappBusinessConversationSchema)).query("templates").withInput(workspaceInput6).withOutput(external_exports.array(whatsappBusinessTemplateSchema)).query("prices").withInput(external_exports.object({ ...pricesInputDefinition.shape, workspaceId: workspaceIdSchema27 })).withOutput(whatsappBusinessPricesSchema).build();
|
|
99550
99998
|
|
|
99551
99999
|
// ../../modules/whatsapp-business/contract/src/whatsapp-business.config.ts
|
|
99552
100000
|
var whatsappBusinessConfig = Config.define((c) => ({
|
|
@@ -99723,7 +100171,7 @@ async function secretsOf3({ context, args }) {
|
|
|
99723
100171
|
const fromConnection = flagText({ args, name: "from-vault" });
|
|
99724
100172
|
if (fromConnection) return { fromConnection };
|
|
99725
100173
|
const file4 = flagText({ args, name: "from-file" });
|
|
99726
|
-
const text3 = file4 ? await
|
|
100174
|
+
const text3 = file4 ? await readFile36(resolve24(context.cwd, file4), "utf8") : await context.readStdin();
|
|
99727
100175
|
const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
99728
100176
|
if (lines2.length !== 2) {
|
|
99729
100177
|
throw new CliUsageError(
|
|
@@ -100808,6 +101256,7 @@ async function runCli({
|
|
|
100808
101256
|
if (args.flags.version || args.words.length === 1 && args.words[0] === "version") {
|
|
100809
101257
|
context.out(`laze ${cliVersionOf()}
|
|
100810
101258
|
`);
|
|
101259
|
+
await noteNewerInstall({ context });
|
|
100811
101260
|
return 0;
|
|
100812
101261
|
}
|
|
100813
101262
|
const command = commandOf(args);
|
|
@@ -100883,8 +101332,8 @@ import {
|
|
|
100883
101332
|
randomBytes as randomBytes5,
|
|
100884
101333
|
sign
|
|
100885
101334
|
} from "node:crypto";
|
|
100886
|
-
import { chmod, link, mkdir as mkdir12, readFile as
|
|
100887
|
-
import { dirname as
|
|
101335
|
+
import { chmod, link, mkdir as mkdir12, readFile as readFile37, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
|
|
101336
|
+
import { dirname as dirname25, join as join35 } from "node:path";
|
|
100888
101337
|
var KEYCHAIN_SERVICE = "laze-cli-machine-key";
|
|
100889
101338
|
var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve26, reject) => {
|
|
100890
101339
|
const child = execFile2(
|
|
@@ -100924,11 +101373,11 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
100924
101373
|
});
|
|
100925
101374
|
}
|
|
100926
101375
|
get metaPath() {
|
|
100927
|
-
return
|
|
101376
|
+
return join35(dirname25(this.options.configPath), "machine-key.json");
|
|
100928
101377
|
}
|
|
100929
101378
|
/** Named by the key, so two CLIs making a key at once never overwrite each other's. */
|
|
100930
101379
|
pemPathOf(jwk) {
|
|
100931
|
-
return
|
|
101380
|
+
return join35(dirname25(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
|
|
100932
101381
|
}
|
|
100933
101382
|
/** The Keychain item's account: one per config file and key. */
|
|
100934
101383
|
accountOf(jwk) {
|
|
@@ -100956,7 +101405,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
100956
101405
|
async read() {
|
|
100957
101406
|
let meta3;
|
|
100958
101407
|
try {
|
|
100959
|
-
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await
|
|
101408
|
+
meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile37(this.metaPath, "utf8")));
|
|
100960
101409
|
} catch {
|
|
100961
101410
|
return null;
|
|
100962
101411
|
}
|
|
@@ -100971,7 +101420,7 @@ var MachineKeyStore = class _MachineKeyStore {
|
|
|
100971
101420
|
"-w"
|
|
100972
101421
|
],
|
|
100973
101422
|
timeoutMs: 1e4
|
|
100974
|
-
}) : await
|
|
101423
|
+
}) : await readFile37(this.pemPathOf(meta3.jwk), "utf8");
|
|
100975
101424
|
return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
|
|
100976
101425
|
}
|
|
100977
101426
|
async make() {
|
|
@@ -101055,7 +101504,7 @@ async function writeOnce({ path, text: text3 }) {
|
|
|
101055
101504
|
}
|
|
101056
101505
|
}
|
|
101057
101506
|
async function writePrivate({ path, text: text3 }) {
|
|
101058
|
-
await mkdir12(
|
|
101507
|
+
await mkdir12(dirname25(path), { recursive: true, mode: 448 });
|
|
101059
101508
|
await writeFile11(path, text3, { mode: 384 });
|
|
101060
101509
|
await chmod(path, 384);
|
|
101061
101510
|
}
|
|
@@ -101113,8 +101562,8 @@ function machineProofFetch({
|
|
|
101113
101562
|
// src/services/processes.service.ts
|
|
101114
101563
|
import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
|
|
101115
101564
|
import { closeSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
|
|
101116
|
-
import { readFile as
|
|
101117
|
-
import { dirname as
|
|
101565
|
+
import { readFile as readFile38, readlink } from "node:fs/promises";
|
|
101566
|
+
import { dirname as dirname26 } from "node:path";
|
|
101118
101567
|
import { promisify as promisify2 } from "node:util";
|
|
101119
101568
|
var run3 = promisify2(execFile3);
|
|
101120
101569
|
function alive(pid) {
|
|
@@ -101127,14 +101576,14 @@ function alive(pid) {
|
|
|
101127
101576
|
}
|
|
101128
101577
|
}
|
|
101129
101578
|
async function argsOf2(pid) {
|
|
101130
|
-
const raw = await
|
|
101579
|
+
const raw = await readFile38(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
|
|
101131
101580
|
if (raw) return raw.split("\0").filter(Boolean);
|
|
101132
101581
|
const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
|
|
101133
101582
|
const line = listed?.stdout.trim();
|
|
101134
101583
|
return line ? line.split(/\s+/) : void 0;
|
|
101135
101584
|
}
|
|
101136
101585
|
async function parentOf(pid) {
|
|
101137
|
-
const stat13 = await
|
|
101586
|
+
const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
101138
101587
|
const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
|
|
101139
101588
|
if (fromStat > 0) return fromStat;
|
|
101140
101589
|
const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -101142,7 +101591,7 @@ async function parentOf(pid) {
|
|
|
101142
101591
|
return parent > 0 ? parent : void 0;
|
|
101143
101592
|
}
|
|
101144
101593
|
async function startOf(pid) {
|
|
101145
|
-
const stat13 = await
|
|
101594
|
+
const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
|
|
101146
101595
|
const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
|
|
101147
101596
|
if (ticks) return ticks;
|
|
101148
101597
|
const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);
|
|
@@ -101182,7 +101631,7 @@ function spawnDetached({
|
|
|
101182
101631
|
logPath,
|
|
101183
101632
|
orphan = false
|
|
101184
101633
|
}) {
|
|
101185
|
-
mkdirSync(
|
|
101634
|
+
mkdirSync(dirname26(logPath), { recursive: true, mode: 448 });
|
|
101186
101635
|
keepLogSmall({ logPath });
|
|
101187
101636
|
const log = openSync(logPath, "a", 384);
|
|
101188
101637
|
if (orphan) {
|
|
@@ -101332,6 +101781,7 @@ if (true) {
|
|
|
101332
101781
|
err: (text3) => void process.stderr.write(text3),
|
|
101333
101782
|
readStdin,
|
|
101334
101783
|
stdoutIsTerminal: process.stdout.isTTY === true,
|
|
101784
|
+
lazeInstalls: () => scanLazeInstalls({ env: environment.inherited, home: homedir5() }),
|
|
101335
101785
|
...ask ? { ask } : {},
|
|
101336
101786
|
sleep,
|
|
101337
101787
|
nowMs: nowMs2,
|