@lazehq/cli 0.1.96 → 0.1.98

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.
Files changed (2) hide show
  1. package/dist/laze.mjs +613 -424
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -3244,7 +3244,7 @@ var require_websocket = __commonJS({
3244
3244
  var http = __require("http");
3245
3245
  var net = __require("net");
3246
3246
  var tls = __require("tls");
3247
- var { randomBytes: randomBytes6, createHash: createHash9 } = __require("crypto");
3247
+ var { randomBytes: randomBytes7, createHash: createHash9 } = __require("crypto");
3248
3248
  var { Duplex, Readable: Readable2 } = __require("stream");
3249
3249
  var { URL: URL3 } = __require("url");
3250
3250
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -3782,7 +3782,7 @@ var require_websocket = __commonJS({
3782
3782
  }
3783
3783
  }
3784
3784
  const defaultPort = isSecure ? 443 : 80;
3785
- const key = randomBytes6(16).toString("base64");
3785
+ const key = randomBytes7(16).toString("base64");
3786
3786
  const request2 = isSecure ? https.request : http.request;
3787
3787
  const protocolSet = /* @__PURE__ */ new Set();
3788
3788
  let perMessageDeflate;
@@ -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: readFile38, mkdir: mkdir13 } = __require("node:fs/promises");
19490
- var { dirname: dirname26, resolve: resolve26 } = __require("node:path");
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 readFile38(resolve26(path), "utf8");
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(dirname26(resolvedPath), { recursive: true });
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 delimiter = lowercaseName === "cookie" ? "; " : ", ";
24576
+ const delimiter2 = lowercaseName === "cookie" ? "; " : ", ";
24577
24577
  this.headersMap.set(lowercaseName, {
24578
24578
  name: exists.name,
24579
- value: `${exists.value}${delimiter}${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.98";
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 readFile2 } from "node:fs/promises";
36784
- import { basename as basename2, dirname as dirname2, resolve } from "node:path";
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 join2 } from "node:path";
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 = dirname(path);
37115
+ const folder = dirname2(path);
36840
37116
  await mkdir(folder, { recursive: true, mode: 448 });
36841
- const temporary = join2(
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 readFile(path, "utf8").catch(() => void 0);
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(dirname(lock), { recursive: true, mode: 448 });
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 readFile2(this.path, "utf8").catch((error63) => {
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
  });
@@ -37080,9 +37356,9 @@ function chooseProfile({
37080
37356
  return name3 && profile ? { name: name3, profile } : { name: void 0, profile: void 0 };
37081
37357
  }
37082
37358
  function isWorktreeRoot({ directory }) {
37083
- const parent = dirname2(directory);
37359
+ const parent = dirname3(directory);
37084
37360
  if (basename2(parent) === ".worktrees") return true;
37085
- return basename2(parent) === "worktrees" && basename2(dirname2(parent)) === ".claude";
37361
+ return basename2(parent) === "worktrees" && basename2(dirname3(parent)) === ".claude";
37086
37362
  }
37087
37363
  function boundProfileOf({
37088
37364
  bindings,
@@ -37092,7 +37368,7 @@ function boundProfileOf({
37092
37368
  for (let depth = 0; depth < 64; depth += 1) {
37093
37369
  const bound = bindings[directory];
37094
37370
  if (bound) return bound;
37095
- const parent = dirname2(directory);
37371
+ const parent = dirname3(directory);
37096
37372
  if (parent === directory || isWorktreeRoot({ directory })) return void 0;
37097
37373
  directory = parent;
37098
37374
  }
@@ -37173,12 +37449,6 @@ function flagText({
37173
37449
  return typeof value === "string" ? value : fallback;
37174
37450
  }
37175
37451
 
37176
- // src/rules/cli-version.rules.ts
37177
- var STAMPED = "0.1.96";
37178
- function cliVersionOf({ stamped = STAMPED } = {}) {
37179
- return stamped.startsWith("__") ? "dev" : stamped;
37180
- }
37181
-
37182
37452
  // src/rules/refusal-format.rules.ts
37183
37453
  function refusalText({ code, message: message2 }) {
37184
37454
  const sentence = message2.trim().replace(/[.!]*$/, ".");
@@ -37213,7 +37483,7 @@ var ProfileRefusedError = class extends ProfileMigratedError {
37213
37483
  };
37214
37484
 
37215
37485
  // src/services/session.service.ts
37216
- import { readFile as readFile4 } from "node:fs/promises";
37486
+ import { readFile as readFile5 } from "node:fs/promises";
37217
37487
 
37218
37488
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
37219
37489
  var external_exports = {};
@@ -39212,8 +39482,8 @@ function emoji() {
39212
39482
  }
39213
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])$/;
39214
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}|:))$/;
39215
- var mac = (delimiter) => {
39216
- const escapedDelim = escapeRegex(delimiter ?? ":");
39485
+ var mac = (delimiter2) => {
39486
+ const escapedDelim = escapeRegex(delimiter2 ?? ":");
39217
39487
  return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
39218
39488
  };
39219
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])$/;
@@ -62942,6 +63212,8 @@ var messageSchemaDefinition = external_exports.object({
62942
63212
  mirrorDeliveryWaking: external_exports.boolean().optional(),
62943
63213
  /** A thread reply also sent to its conversation: it shows in the thread and the channel. */
62944
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(),
62945
63217
  /** For a reply also sent to the channel: its root's text, for the "replied to a thread" line. */
62946
63218
  threadRootBody: external_exports.string().nullable().optional(),
62947
63219
  /** For a root: the last three people or agents who replied, newest first. */
@@ -63144,7 +63416,9 @@ var createChannelInputSchemaDefinition = external_exports.object({
63144
63416
  /** An agent creator's name, kept on its membership so notices name it. */
63145
63417
  creatorName: external_exports.string().trim().min(1).max(80).optional(),
63146
63418
  /** Sent by older clients and ignored: new channels never end on their own. */
63147
- endsAt: external_exports.iso.datetime().optional()
63419
+ endsAt: external_exports.iso.datetime().optional(),
63420
+ /** The same key on every try of one create: a repeat answers the channel the first one made. */
63421
+ clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
63148
63422
  });
63149
63423
  var createChannelInputSchema = createChannelInputSchemaDefinition;
63150
63424
  var CHANNEL_TOPIC_MAX = 250;
@@ -63242,7 +63516,9 @@ var openChatInputSchemaDefinition = external_exports.object({
63242
63516
  id: idSchema4,
63243
63517
  name: external_exports.string().min(1).max(80),
63244
63518
  runsOutside: external_exports.boolean().optional()
63245
- })
63519
+ }),
63520
+ /** The first message's client key: the conversation already started with it is answered again. */
63521
+ startKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
63246
63522
  });
63247
63523
  var renameChatInputSchemaDefinition = external_exports.object({
63248
63524
  workspaceId: workspaceIdSchema,
@@ -63320,6 +63596,8 @@ var postMessageInputSchemaDefinition = external_exports.object({
63320
63596
  alsoInChannel: external_exports.boolean().optional(),
63321
63597
  /** In a direct message: notify the people in Do Not Disturb anyway, once. */
63322
63598
  notifyAnyway: external_exports.boolean().optional(),
63599
+ /** In a Laze DM: also post it to this paired Slack DM, as the sender; one Laze message. */
63600
+ alsoSendTo: idSchema4.optional(),
63323
63601
  attachmentIds: external_exports.array(idSchema4).max(10).default([]),
63324
63602
  /** The feed cards an agent's reply links; chat keeps them only when an agent posts. */
63325
63603
  feedRefs: external_exports.array(messageFeedRefSchemaDefinition).max(MESSAGE_FEED_REFS_MAX).optional(),
@@ -63495,12 +63773,15 @@ var forgetMirroredInputSchemaDefinition = external_exports.object({
63495
63773
  });
63496
63774
  var mirrorUnreadsInputSchemaDefinition = external_exports.object({
63497
63775
  workspaceId: workspaceIdSchema,
63498
- userId: idSchema4
63776
+ userId: idSchema4,
63777
+ readActiveSince: external_exports.iso.datetime().optional()
63499
63778
  });
63500
63779
  var mirrorUnreadSchemaDefinition = external_exports.object({
63501
63780
  channelId: idSchema4,
63502
63781
  /** The mirror's key for the conversation, such as `slack:<team>:<channel>`. */
63503
- mirrorKey: external_exports.string().min(1)
63782
+ mirrorKey: external_exports.string().min(1),
63783
+ /** Read to its last message in Laze: listed only when `readActiveSince` asked for it. */
63784
+ read: external_exports.boolean().optional()
63504
63785
  });
63505
63786
  var syncMirrorReadInputSchemaDefinition = external_exports.object({
63506
63787
  workspaceId: workspaceIdSchema,
@@ -63509,7 +63790,12 @@ var syncMirrorReadInputSchemaDefinition = external_exports.object({
63509
63790
  readTo: external_exports.iso.datetime(),
63510
63791
  unread: external_exports.number().int().positive().max(1e6).optional(),
63511
63792
  /** The source and Laze keep marks in step: a read there also ends a mark unread set in Laze. */
63512
- releasesHold: external_exports.boolean().optional()
63793
+ releasesHold: external_exports.boolean().optional(),
63794
+ /**
63795
+ * The person moved the source's marker back to `readTo`: Laze's marker moves back to the newest
63796
+ * message at or before it, while it still sits at this seq and others wrote after it.
63797
+ */
63798
+ backFromSeq: external_exports.number().int().nonnegative().optional()
63513
63799
  });
63514
63800
  var mirroredReadToInputSchemaDefinition = external_exports.object({
63515
63801
  workspaceId: workspaceIdSchema,
@@ -63758,7 +64044,7 @@ var setNotifyInputSchema = setNotifyInputSchemaDefinition;
63758
64044
  var setReplySideInputSchemaDefinition = external_exports.object({
63759
64045
  workspaceId: workspaceIdSchema,
63760
64046
  channelId: idSchema4,
63761
- /** Null forgets the pick, so replies follow the side the other person last wrote from. */
64047
+ /** Null forgets the pick, so replies go to both sides, the default, again. */
63762
64048
  side: replySideSchema.nullable()
63763
64049
  });
63764
64050
  var setReplySideInputSchema = setReplySideInputSchemaDefinition;
@@ -64961,6 +65247,8 @@ var messagePostedPayloadSchemaDefinition = external_exports.object({
64961
65247
  threadRootId: external_exports.string().nullable(),
64962
65248
  /** A thread reply also sent to its conversation, counted and notified like a channel post. */
64963
65249
  alsoInChannel: external_exports.boolean().optional(),
65250
+ /** A Laze DM message also posted to its paired Slack DM: that conversation's id. */
65251
+ alsoSentTo: external_exports.string().optional(),
64964
65252
  /** A person's direct message sent with "Notify anyway": it breaks through Do Not Disturb. */
64965
65253
  notifyAnyway: external_exports.boolean().optional(),
64966
65254
  /** The person whose own action posted it, such as a feed comment: they get no notice of it. */
@@ -69685,6 +69973,11 @@ var agentConfig = Config.define((c) => ({
69685
69973
  "AGENT_CLAUDE_GATEWAY_FAST",
69686
69974
  external_exports.string().min(1).default("claude-sonnet-5-5")
69687
69975
  ),
69976
+ /** What a staff haiku override runs (staff-model-override.feature); never a level people pick. */
69977
+ claudeGatewayHaikuModel: c.env(
69978
+ "AGENT_CLAUDE_GATEWAY_HAIKU",
69979
+ external_exports.string().min(1).default("claude-haiku-5-5")
69980
+ ),
69688
69981
  /** `off` turns Claude Code's thinking off on Laze models, for a gateway lane that refuses it. */
69689
69982
  claudeGatewayThinking: c.env(
69690
69983
  "AGENT_CLAUDE_GATEWAY_THINKING",
@@ -70036,7 +70329,9 @@ var createChannelAsCallerInputSchemaDefinition = external_exports.object({
70036
70329
  visibility: external_exports.enum(["public", "private"]).default("public"),
70037
70330
  topic: external_exports.string().trim().max(250).default(""),
70038
70331
  /** Sent by older CLIs and ignored: new channels never end on their own. */
70039
- temporary: external_exports.enum(CALLER_CHANNEL_DURATIONS).optional()
70332
+ temporary: external_exports.enum(CALLER_CHANNEL_DURATIONS).optional(),
70333
+ /** One key per `laze channel create`: a retry answers the channel the first try made. */
70334
+ clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
70040
70335
  });
70041
70336
  var extendChannelAsCallerInputSchemaDefinition = external_exports.object({
70042
70337
  channel: channelRefSchema,
@@ -70680,11 +70975,11 @@ function errorOf({ status: status11, body }) {
70680
70975
 
70681
70976
  // src/services/machine-report.service.ts
70682
70977
  import { createHash } from "node:crypto";
70683
- import { readFile as readFile3 } from "node:fs/promises";
70978
+ import { readFile as readFile4 } from "node:fs/promises";
70684
70979
  import { hostname as hostname3 } from "node:os";
70685
70980
 
70686
70981
  // src/services/inbox-spool.service.ts
70687
- import { dirname as dirname3, join as join3 } from "node:path";
70982
+ import { dirname as dirname4, join as join4 } from "node:path";
70688
70983
  var PUSH_GRACE_MS = 3 * 6e4;
70689
70984
  var IN_FLIGHT_MS = 35e3;
70690
70985
  function fileNameOf({ profile }) {
@@ -70696,8 +70991,8 @@ function statePathOf({
70696
70991
  profile,
70697
70992
  extension: extension2 = "json"
70698
70993
  }) {
70699
- const directory = join3(dirname3(context.environment.configPath), kind2);
70700
- return join3(directory, `${fileNameOf({ profile })}.${extension2}`);
70994
+ const directory = join4(dirname4(context.environment.configPath), kind2);
70995
+ return join4(directory, `${fileNameOf({ profile })}.${extension2}`);
70701
70996
  }
70702
70997
  async function readSpool({ path }) {
70703
70998
  return await readStateJson({ path }) ?? [];
@@ -70770,7 +71065,7 @@ async function reportMachine({
70770
71065
  if (!host2) return;
70771
71066
  const stamp = createHash("sha256").update(`${token2}:${host2}`).digest("hex");
70772
71067
  const path = statePathOf({ context, kind: "machine", profile });
70773
- const noted = await readFile3(path, "utf8").catch(() => "");
71068
+ const noted = await readFile4(path, "utf8").catch(() => "");
70774
71069
  if (noted === JSON.stringify(stamp) || noted === stamp) return;
70775
71070
  try {
70776
71071
  await client.post("/api/agents/me/machine", { host: host2 });
@@ -70812,7 +71107,7 @@ async function turnTokenOf({ context }) {
70812
71107
  const pinned = env.LAZE_TURN_TOKEN?.trim();
70813
71108
  if (pinned) return pinned;
70814
71109
  if (!env.LAZE_TURN_FILE) return "";
70815
- return readFile4(env.LAZE_TURN_FILE, "utf8").then(
71110
+ return readFile5(env.LAZE_TURN_FILE, "utf8").then(
70816
71111
  (text3) => text3.trim(),
70817
71112
  () => ""
70818
71113
  );
@@ -71112,8 +71407,8 @@ async function copyAgent({
71112
71407
  }
71113
71408
 
71114
71409
  // src/services/agent-commands.service.ts
71115
- import { mkdir as mkdir5, readFile as readFile11, writeFile as writeFile3 } from "node:fs/promises";
71116
- import { join as join19, resolve as resolve5 } from "node:path";
71410
+ import { mkdir as mkdir5, readFile as readFile12, writeFile as writeFile3 } from "node:fs/promises";
71411
+ import { join as join20, resolve as resolve5 } from "node:path";
71117
71412
 
71118
71413
  // src/rules/agent-profile.rules.ts
71119
71414
  var HARNESS_NAMES = {
@@ -71206,15 +71501,6 @@ ${lines2.join("\n")}
71206
71501
  `;
71207
71502
  }
71208
71503
 
71209
- // src/rules/cli-invocation.rules.ts
71210
- var NPX_CACHE = /[\\/]_npx[\\/]/;
71211
- var SANDBOX_CLI_PATH = "/opt/laze/cli/laze.mjs";
71212
- function lazeCommandOf({ program }) {
71213
- const script = program.at(-1) ?? "";
71214
- if (!NPX_CACHE.test(script)) return "laze";
71215
- return /^[\w./@+-]+$/.test(script) ? script : `'${script.replaceAll("'", "'\\''")}'`;
71216
- }
71217
-
71218
71504
  // src/rules/hook-settings.rules.ts
71219
71505
  var LAZE_HOOK_MARKER = "laze-cli-hook";
71220
71506
  var HOOK_TIMEOUTS = { Stop: 30, PreToolUse: 5, SessionStart: 30 };
@@ -72406,12 +72692,12 @@ function formatSearch({
72406
72692
 
72407
72693
  // src/services/claude-turn.service.ts
72408
72694
  import { rm as rm3 } from "node:fs/promises";
72409
- import { dirname as dirname6, join as join7 } from "node:path";
72695
+ import { dirname as dirname7, join as join8 } from "node:path";
72410
72696
 
72411
72697
  // src/services/harness-session.service.ts
72412
- import { open as open3, readdir as readdir2, readFile as readFile5, stat as stat3 } from "node:fs/promises";
72698
+ import { open as open3, readdir as readdir3, readFile as readFile6, stat as stat3 } from "node:fs/promises";
72413
72699
  import { homedir as homedir2, hostname as hostname4 } from "node:os";
72414
- import { dirname as dirname5, join as join5 } from "node:path";
72700
+ import { dirname as dirname6, join as join6 } from "node:path";
72415
72701
 
72416
72702
  // src/rules/claude-subagent.rules.ts
72417
72703
  function lastCallAtOf({ text: text3, command }) {
@@ -72529,7 +72815,7 @@ function holds({ folder, inner }) {
72529
72815
  const rel = relative2(resolve2(folder), resolve2(inner));
72530
72816
  return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
72531
72817
  }
72532
- async function claudeProjectOf({
72818
+ async function claudeFoldersOf({
72533
72819
  context,
72534
72820
  claudePid
72535
72821
  }) {
@@ -72540,12 +72826,14 @@ async function claudeProjectOf({
72540
72826
  env.CLAUDE_PROJECT_DIR ? resolve2(env.CLAUDE_PROJECT_DIR) : void 0,
72541
72827
  pid > 0 ? await context.processes.cwdOf(pid) : void 0
72542
72828
  ].filter((folder) => Boolean(folder));
72543
- return candidates.find((folder) => holds({ folder, inner: context.cwd })) ?? resolve2(context.cwd);
72829
+ const holding = candidates.find((folder) => holds({ folder, inner: context.cwd }));
72830
+ if (holding) return { folder: holding, elsewhere: void 0 };
72831
+ return { folder: resolve2(context.cwd), elsewhere: candidates[0] };
72544
72832
  }
72545
72833
 
72546
72834
  // src/services/session-notes.service.ts
72547
- import { readdir, rm as rm2, stat as stat2 } from "node:fs/promises";
72548
- import { dirname as dirname4, join as join4 } from "node:path";
72835
+ import { readdir as readdir2, rm as rm2, stat as stat2 } from "node:fs/promises";
72836
+ import { dirname as dirname5, join as join5 } from "node:path";
72549
72837
  function notePathOf({ context, pid }) {
72550
72838
  return statePathOf({ context, kind: "sessions", profile: String(pid) });
72551
72839
  }
@@ -72592,13 +72880,13 @@ async function sessionNotesOf({
72592
72880
  context,
72593
72881
  tell = true
72594
72882
  }) {
72595
- const folder = dirname4(notePathOf({ context, pid: 1 }));
72596
- const files2 = await readdir(folder).catch(() => []);
72883
+ const folder = dirname5(notePathOf({ context, pid: 1 }));
72884
+ const files2 = await readdir2(folder).catch(() => []);
72597
72885
  const notes = [];
72598
72886
  const dropped = [];
72599
72887
  for (const file4 of files2) {
72600
72888
  const pid = Number(file4.replace(/\.json$/, ""));
72601
- const path = join4(folder, file4);
72889
+ const path = join5(folder, file4);
72602
72890
  const note = pid ? await readStateJson({ path }) : void 0;
72603
72891
  if (!note) continue;
72604
72892
  const standing = await standingOf({ context, pid, note });
@@ -72728,14 +73016,14 @@ async function claudeTranscriptOf({
72728
73016
  sessionId
72729
73017
  }) {
72730
73018
  const inherited = context.environment.inherited;
72731
- const root = join5(
72732
- inherited.CLAUDE_CONFIG_DIR || join5(inherited.HOME || homedir2(), ".claude"),
73019
+ const root = join6(
73020
+ inherited.CLAUDE_CONFIG_DIR || join6(inherited.HOME || homedir2(), ".claude"),
72733
73021
  "projects"
72734
73022
  );
72735
- const folders = await readdir2(root).catch(() => []);
73023
+ const folders = await readdir3(root).catch(() => []);
72736
73024
  const found = await Promise.all(
72737
73025
  folders.map(async (folder) => {
72738
- const path = join5(root, folder, `${sessionId}.jsonl`);
73026
+ const path = join6(root, folder, `${sessionId}.jsonl`);
72739
73027
  return stat3(path).then(
72740
73028
  (info) => info.isFile() ? [{ path, at: info.mtimeMs }] : [],
72741
73029
  () => []
@@ -72763,11 +73051,11 @@ async function runsInSubagent({ context, command }) {
72763
73051
  if (!sessionId) return false;
72764
73052
  const { path } = await claudeTranscriptOf({ context, sessionId });
72765
73053
  if (!path) return false;
72766
- const folder = join5(dirname5(path), sessionId, "subagents");
72767
- const files2 = await readdir2(folder).catch(() => []);
73054
+ const folder = join6(dirname6(path), sessionId, "subagents");
73055
+ const files2 = await readdir3(folder).catch(() => []);
72768
73056
  const subagents = await Promise.all(
72769
73057
  files2.filter((file4) => file4.endsWith(".jsonl")).map(
72770
- async (file4) => lastCallAtOf({ text: await tailOf({ path: join5(folder, file4) }), command })
73058
+ async (file4) => lastCallAtOf({ text: await tailOf({ path: join6(folder, file4) }), command })
72771
73059
  )
72772
73060
  );
72773
73061
  const session = lastCallAtOf({ text: await tailOf({ path }), command });
@@ -72827,7 +73115,7 @@ async function notBoundNotice({
72827
73115
  }
72828
73116
  const key = session ? sessionKeyOf({ session }) : "unknown";
72829
73117
  const path = statePathOf({ context, kind: "told", profile: key });
72830
- const told = await readFile5(path, "utf8").then(
73118
+ const told = await readFile6(path, "utf8").then(
72831
73119
  () => true,
72832
73120
  () => false
72833
73121
  );
@@ -72840,8 +73128,8 @@ async function notBoundNotice({
72840
73128
  }
72841
73129
 
72842
73130
  // src/services/plugin-hook.service.ts
72843
- import { readFile as readFile6 } from "node:fs/promises";
72844
- import { join as join6 } from "node:path";
73131
+ import { readFile as readFile7 } from "node:fs/promises";
73132
+ import { join as join7 } from "node:path";
72845
73133
  async function agentProfileHere({
72846
73134
  context,
72847
73135
  args,
@@ -72862,8 +73150,8 @@ async function agentProfileHere({
72862
73150
  }
72863
73151
  async function projectHooksHere({ context }) {
72864
73152
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR || context.cwd;
72865
- const path = join6(directory, ".claude", "settings.local.json");
72866
- return readFile6(path, "utf8").then((text3) => hasLazeHooks({ settings: JSON.parse(text3) })).catch(() => false);
73153
+ const path = join7(directory, ".claude", "settings.local.json");
73154
+ return readFile7(path, "utf8").then((text3) => hasLazeHooks({ settings: JSON.parse(text3) })).catch(() => false);
72867
73155
  }
72868
73156
  async function pluginHookArgs({
72869
73157
  context,
@@ -72881,7 +73169,7 @@ async function pluginHookArgs({
72881
73169
  var PRE_TOOL_TIMEOUT_MS = 3e3;
72882
73170
  function statePath({ context, agent: agent3 }) {
72883
73171
  const safe = agent3.replace(/[^a-zA-Z0-9_-]/g, "_");
72884
- return join7(dirname6(context.environment.configPath), "turns", `${safe}.json`);
73172
+ return join8(dirname7(context.environment.configPath), "turns", `${safe}.json`);
72885
73173
  }
72886
73174
  async function readState({ context, agent: agent3 }) {
72887
73175
  return readStateJson({ path: statePath({ context, agent: agent3 }) });
@@ -72994,7 +73282,7 @@ async function preToolHook({ context, args }) {
72994
73282
  }
72995
73283
 
72996
73284
  // src/services/message-files.service.ts
72997
- import { readFile as readFile7, stat as stat4 } from "node:fs/promises";
73285
+ import { readFile as readFile8, stat as stat4 } from "node:fs/promises";
72998
73286
  import { basename as basename4, resolve as resolve3 } from "node:path";
72999
73287
 
73000
73288
  // src/rules/file-types.rules.ts
@@ -73123,7 +73411,7 @@ async function local({ full }) {
73123
73411
  return {
73124
73412
  fileName,
73125
73413
  contentType: contentTypeOf(fileName),
73126
- bytes: new Uint8Array(await readFile7(full))
73414
+ bytes: new Uint8Array(await readFile8(full))
73127
73415
  };
73128
73416
  }
73129
73417
  async function attachmentIdsOf({
@@ -73746,7 +74034,7 @@ function channelLabelIn(channel) {
73746
74034
  }
73747
74035
 
73748
74036
  // src/services/claude-wait.service.ts
73749
- import { readFile as readFile8, rm as rm6 } from "node:fs/promises";
74037
+ import { readFile as readFile9, rm as rm6 } from "node:fs/promises";
73750
74038
 
73751
74039
  // src/rules/listener-retry.rules.ts
73752
74040
  var FIRST_MS = 1e3;
@@ -73785,7 +74073,7 @@ var ListenerBackoff = class {
73785
74073
  // src/services/connect-service.service.ts
73786
74074
  import { createHash as createHash2 } from "node:crypto";
73787
74075
  import { mkdir as mkdir3, rm as rm5, writeFile } from "node:fs/promises";
73788
- import { dirname as dirname12, join as join14 } from "node:path";
74076
+ import { dirname as dirname13, join as join15 } from "node:path";
73789
74077
 
73790
74078
  // src/rules/connect-service.rules.ts
73791
74079
  function systemdWordOf(word3) {
@@ -73909,23 +74197,23 @@ function rolloutEventOf({
73909
74197
  // src/services/connect-delivery.service.ts
73910
74198
  import { rm as rm4, stat as stat5 } from "node:fs/promises";
73911
74199
  import { homedir as homedir3, hostname as hostname5 } from "node:os";
73912
- import { dirname as dirname11, join as join13 } from "node:path";
74200
+ import { dirname as dirname12, join as join14 } from "node:path";
73913
74201
 
73914
74202
  // src/services/codex-turn-watch.service.ts
73915
- import { open as open4, readdir as readdir3 } from "node:fs/promises";
73916
- import { basename as basename5, join as join8 } from "node:path";
74203
+ import { open as open4, readdir as readdir4 } from "node:fs/promises";
74204
+ import { basename as basename5, join as join9 } from "node:path";
73917
74205
  var READ_MS = 1500;
73918
74206
  var KEEP_WORKING_MS = 3e4;
73919
74207
  async function codexRolloutPathOf({
73920
74208
  codexHome,
73921
74209
  threadId
73922
74210
  }) {
73923
- const root = join8(codexHome, "sessions");
73924
- const files2 = await readdir3(root, { recursive: true }).catch(() => []);
74211
+ const root = join9(codexHome, "sessions");
74212
+ const files2 = await readdir4(root, { recursive: true }).catch(() => []);
73925
74213
  const file4 = files2.find(
73926
74214
  (name3) => basename5(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
73927
74215
  );
73928
- return file4 ? join8(root, file4) : void 0;
74216
+ return file4 ? join9(root, file4) : void 0;
73929
74217
  }
73930
74218
  function rolloutPathOf({ delivery }) {
73931
74219
  return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
@@ -74014,7 +74302,7 @@ var CodexTurnWatch = class _CodexTurnWatch {
74014
74302
  };
74015
74303
 
74016
74304
  // src/services/mcp-relay.service.ts
74017
- import { dirname as dirname7, join as join9 } from "node:path";
74305
+ import { dirname as dirname8, join as join10 } from "node:path";
74018
74306
 
74019
74307
  // ../../node_modules/.pnpm/ws@8.21.3_bufferutil@4.1.0/node_modules/ws/wrapper.mjs
74020
74308
  var import_stream = __toESM(require_stream(), 1);
@@ -74350,7 +74638,7 @@ var STOPS = /* @__PURE__ */ new Map([
74350
74638
  [CONNECTOR_RELAY_CLOSE.replaced.code, "another relay for this server took over"]
74351
74639
  ]);
74352
74640
  function mcpRelaysPathOf({ context }) {
74353
- return join9(dirname7(context.environment.configPath), "connect", "mcp-relays.json");
74641
+ return join10(dirname8(context.environment.configPath), "connect", "mcp-relays.json");
74354
74642
  }
74355
74643
  async function readMcpRelays({ context }) {
74356
74644
  return await readStateJson({ path: mcpRelaysPathOf({ context }) }) ?? {};
@@ -74510,7 +74798,7 @@ var McpRelayLoops = class _McpRelayLoops {
74510
74798
  };
74511
74799
 
74512
74800
  // src/services/openclaw-relay.service.ts
74513
- import { dirname as dirname8, join as join10 } from "node:path";
74801
+ import { dirname as dirname9, join as join11 } from "node:path";
74514
74802
 
74515
74803
  // ../../modules/openclaw/contract/src/openclaw.ts
74516
74804
  var workspaceIdSchema18 = external_exports.string().min(1);
@@ -74731,7 +75019,7 @@ var STOPS2 = /* @__PURE__ */ new Map([
74731
75019
  [OPENCLAW_RELAY_CLOSE.replaced.code, "another relay for this gateway took over"]
74732
75020
  ]);
74733
75021
  function relaysPathOf({ context }) {
74734
- return join10(dirname8(context.environment.configPath), "connect", "openclaw-relays.json");
75022
+ return join11(dirname9(context.environment.configPath), "connect", "openclaw-relays.json");
74735
75023
  }
74736
75024
  async function readRelays({ context }) {
74737
75025
  return await readStateJson({ path: relaysPathOf({ context }) }) ?? {};
@@ -74924,7 +75212,7 @@ var RelayLoops = class _RelayLoops {
74924
75212
  };
74925
75213
 
74926
75214
  // src/services/rush-host.service.ts
74927
- import { dirname as dirname9, join as join11 } from "node:path";
75215
+ import { dirname as dirname10, join as join12 } from "node:path";
74928
75216
  async function rushAboveOf({
74929
75217
  context,
74930
75218
  from = context.processes.pid
@@ -74938,7 +75226,7 @@ async function rushAboveOf({
74938
75226
  return void 0;
74939
75227
  }
74940
75228
  function guardPathOf({ context, claudePid }) {
74941
- return join11(dirname9(context.environment.configPath), "rush-guards", `${claudePid}.json`);
75229
+ return join12(dirname10(context.environment.configPath), "rush-guards", `${claudePid}.json`);
74942
75230
  }
74943
75231
  async function startRushGuard({
74944
75232
  context,
@@ -74951,7 +75239,7 @@ async function startRushGuard({
74951
75239
  if (holder && context.processes.alive(holder.pid)) return;
74952
75240
  const flags2 = ["--profile", profile, "--claude-pid", String(claudePid), "--rush-id", rush.id];
74953
75241
  const argv = [...context.program, "hook", "rush-wake", ...flags2, "--rush-program", rush.program];
74954
- const logPath = join11(dirname9(context.environment.configPath), "rush-guards", "guard.log");
75242
+ const logPath = join12(dirname10(context.environment.configPath), "rush-guards", "guard.log");
74955
75243
  context.processes.spawnDetached({ argv: ["sh", "-c", '"$@" &', "sh", ...argv], logPath });
74956
75244
  }
74957
75245
  async function claimRushGuard({
@@ -75069,7 +75357,7 @@ async function rearmRushGuards({ context }) {
75069
75357
 
75070
75358
  // src/services/rush-watchdog.service.ts
75071
75359
  import { appendFile, mkdir as mkdir2 } from "node:fs/promises";
75072
- import { dirname as dirname10, join as join12 } from "node:path";
75360
+ import { dirname as dirname11, join as join13 } from "node:path";
75073
75361
  var UNDELIVERED_AFTER_MS = 6e4;
75074
75362
  var CHECK_TIMEOUT_MS = 5e3;
75075
75363
  function clientOf({ context, profile }) {
@@ -75105,13 +75393,13 @@ function boundAwayOf({ waiting, key }) {
75105
75393
  return `${sessionLabelOf(bound)} (${bound.harness}:${bound.sessionId})`;
75106
75394
  }
75107
75395
  async function logDelivery({ context, line }) {
75108
- const folder = join12(dirname10(context.environment.configPath), "connect");
75396
+ const folder = join13(dirname11(context.environment.configPath), "connect");
75109
75397
  const at = Temporal3.Instant.fromEpochMilliseconds(context.nowMs());
75110
75398
  const stamped = `${at.toString({ smallestUnit: "second" })} ${line}
75111
75399
  `;
75112
75400
  context.out(stamped);
75113
75401
  await mkdir2(folder, { recursive: true, mode: 448 });
75114
- await appendFile(join12(folder, "delivery.log"), stamped, { mode: 384 });
75402
+ await appendFile(join13(folder, "delivery.log"), stamped, { mode: 384 });
75115
75403
  }
75116
75404
  async function claimFor({
75117
75405
  context,
@@ -75187,10 +75475,10 @@ async function watchRushDelivery({
75187
75475
 
75188
75476
  // src/services/connect-delivery.service.ts
75189
75477
  function connectFolderOf({ context }) {
75190
- return join13(dirname11(context.environment.configPath), "connect");
75478
+ return join14(dirname12(context.environment.configPath), "connect");
75191
75479
  }
75192
75480
  function runStatePathOf({ context }) {
75193
- return join13(connectFolderOf({ context }), "run.json");
75481
+ return join14(connectFolderOf({ context }), "run.json");
75194
75482
  }
75195
75483
  async function readJson({ path }) {
75196
75484
  return readStateJson({ path });
@@ -75488,17 +75776,17 @@ var CONNECT_SERVICE_USAGE = `laze connect install|status|stop|uninstall|run: the
75488
75776
  \`laze openclaw connect --local\` and \`laze kanban connect\`, whose relays it also runs.
75489
75777
  `;
75490
75778
  function installedPathOf({ context }) {
75491
- return join14(connectFolderOf({ context }), "service.json");
75779
+ return join15(connectFolderOf({ context }), "service.json");
75492
75780
  }
75493
75781
  function logPathOf({ context }) {
75494
- return join14(connectFolderOf({ context }), "connect.log");
75782
+ return join15(connectFolderOf({ context }), "connect.log");
75495
75783
  }
75496
75784
  function homeOf({ context }) {
75497
- return context.environment.inherited.HOME ?? dirname12(dirname12(context.environment.configPath));
75785
+ return context.environment.inherited.HOME ?? dirname13(dirname13(context.environment.configPath));
75498
75786
  }
75499
75787
  function serviceNameOf({ context }) {
75500
75788
  const { configPath } = context.environment;
75501
- if (configPath === join14(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
75789
+ if (configPath === join15(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
75502
75790
  return `laze-connect-${createHash2("sha256").update(configPath).digest("hex").slice(0, 8)}`;
75503
75791
  }
75504
75792
  function serviceEnvOf({ context }) {
@@ -75521,9 +75809,9 @@ async function run({ context, command }) {
75521
75809
  async function installSystemd({ context }) {
75522
75810
  const name3 = serviceNameOf({ context });
75523
75811
  const env = context.environment.inherited;
75524
- const base = env.XDG_CONFIG_HOME || join14(homeOf({ context }), ".config");
75525
- const file4 = join14(base, "systemd", "user", `${name3}.service`);
75526
- await mkdir3(dirname12(file4), { recursive: true });
75812
+ const base = env.XDG_CONFIG_HOME || join15(homeOf({ context }), ".config");
75813
+ const file4 = join15(base, "systemd", "user", `${name3}.service`);
75814
+ await mkdir3(dirname13(file4), { recursive: true });
75527
75815
  await writeFile(
75528
75816
  file4,
75529
75817
  systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
@@ -75537,9 +75825,9 @@ async function installSystemd({ context }) {
75537
75825
  async function installLaunchd({ context }) {
75538
75826
  const name3 = serviceNameOf({ context });
75539
75827
  const label3 = `ai.laze.${name3}`;
75540
- const file4 = join14(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
75828
+ const file4 = join15(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
75541
75829
  const log = logPathOf({ context });
75542
- await mkdir3(dirname12(file4), { recursive: true });
75830
+ await mkdir3(dirname13(file4), { recursive: true });
75543
75831
  await writeFile(
75544
75832
  file4,
75545
75833
  launchAgentOf({
@@ -75910,7 +76198,7 @@ async function waitForMessages({ context, args }) {
75910
76198
  if (rush) await healRushDelivery({ context });
75911
76199
  const lock = statePathOf({ context, kind: "waiters", profile: name3 });
75912
76200
  if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
75913
- const seen = () => input2.transcript_path ? readFile8(input2.transcript_path, "utf8") : Promise.resolve("");
76201
+ const seen = () => input2.transcript_path ? readFile9(input2.transcript_path, "utf8") : Promise.resolve("");
75914
76202
  const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
75915
76203
  try {
75916
76204
  const backoff = new ListenerBackoff();
@@ -75961,7 +76249,7 @@ async function refusedOnce({
75961
76249
  }) {
75962
76250
  const profile = String(args.flags.profile ?? "default");
75963
76251
  const path = statePathOf({ context, kind: "told", profile: `refused-${profile}` });
75964
- const told = await readFile8(path, "utf8").then(
76252
+ const told = await readFile9(path, "utf8").then(
75965
76253
  () => true,
75966
76254
  () => false
75967
76255
  );
@@ -76018,14 +76306,14 @@ async function monitorServes({
76018
76306
 
76019
76307
  // src/services/codex-link.service.ts
76020
76308
  import { createReadStream } from "node:fs";
76021
- import { readdir as readdir5, rm as rm8, stat as stat7 } from "node:fs/promises";
76022
- import { join as join16, resolve as resolve4 } from "node:path";
76309
+ import { readdir as readdir6, rm as rm8, stat as stat7 } from "node:fs/promises";
76310
+ import { join as join17, resolve as resolve4 } from "node:path";
76023
76311
  import { createInterface as createInterface2 } from "node:readline";
76024
76312
 
76025
76313
  // src/services/codex-adopt.service.ts
76026
76314
  import { spawn as spawn2 } from "node:child_process";
76027
- import { readdir as readdir4, rm as rm7, stat as stat6 } from "node:fs/promises";
76028
- import { join as join15 } from "node:path";
76315
+ import { readdir as readdir5, rm as rm7, stat as stat6 } from "node:fs/promises";
76316
+ import { join as join16 } from "node:path";
76029
76317
  import { createInterface } from "node:readline";
76030
76318
 
76031
76319
  // src/rules/codex-requests.rules.ts
@@ -76145,11 +76433,11 @@ var CodexAppServer = class _CodexAppServer {
76145
76433
  }
76146
76434
  };
76147
76435
  async function newestThreadId({ codexHome }) {
76148
- const root = join15(codexHome, "sessions");
76149
- const files2 = await readdir4(root, { recursive: true }).catch(() => []);
76436
+ const root = join16(codexHome, "sessions");
76437
+ const files2 = await readdir5(root, { recursive: true }).catch(() => []);
76150
76438
  const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
76151
76439
  const dated = await Promise.all(
76152
- rollouts.map(async (file4) => ({ file: file4, at: (await stat6(join15(root, file4))).mtimeMs }))
76440
+ rollouts.map(async (file4) => ({ file: file4, at: (await stat6(join16(root, file4))).mtimeMs }))
76153
76441
  );
76154
76442
  const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
76155
76443
  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);
@@ -76410,13 +76698,13 @@ async function newestThreadIn({
76410
76698
  codexHome,
76411
76699
  directory
76412
76700
  }) {
76413
- const root = join16(codexHome, "sessions");
76414
- const files2 = await readdir5(root, { recursive: true }).catch(() => []);
76701
+ const root = join17(codexHome, "sessions");
76702
+ const files2 = await readdir6(root, { recursive: true }).catch(() => []);
76415
76703
  const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
76416
76704
  const dated = await Promise.all(
76417
76705
  rollouts.map(async (file4) => ({
76418
- path: join16(root, file4),
76419
- at: await stat7(join16(root, file4)).then(
76706
+ path: join17(root, file4),
76707
+ at: await stat7(join17(root, file4)).then(
76420
76708
  (info) => info.mtimeMs,
76421
76709
  () => 0
76422
76710
  )
@@ -76486,16 +76774,16 @@ async function linkCodexSession({
76486
76774
  }
76487
76775
 
76488
76776
  // src/services/laze-plugin.service.ts
76489
- import { mkdir as mkdir4, readFile as readFile9, rm as rm9, writeFile as writeFile2 } from "node:fs/promises";
76777
+ import { mkdir as mkdir4, readFile as readFile10, rm as rm9, writeFile as writeFile2 } from "node:fs/promises";
76490
76778
  import { homedir as homedir4 } from "node:os";
76491
- import { dirname as dirname13, join as join18 } from "node:path";
76779
+ import { dirname as dirname14, join as join19 } from "node:path";
76492
76780
 
76493
76781
  // src/rules/laze-plugin.rules.ts
76494
76782
  import { createHash as createHash3 } from "node:crypto";
76495
- import { join as join17 } from "node:path";
76783
+ import { join as join18 } from "node:path";
76496
76784
  var LAZE_PLUGIN = "laze";
76497
76785
  function pluginNameOf({ configPath, home }) {
76498
- if (configPath === join17(home, ".laze", "config.json")) return LAZE_PLUGIN;
76786
+ if (configPath === join18(home, ".laze", "config.json")) return LAZE_PLUGIN;
76499
76787
  return `${LAZE_PLUGIN}-${createHash3("sha256").update(configPath).digest("hex").slice(0, 8)}`;
76500
76788
  }
76501
76789
  var NPX_CLI = ["npx", "-y", "@lazehq/cli@latest"];
@@ -76743,11 +77031,11 @@ function installedNameOf({ context }) {
76743
77031
  return `${name3}@${name3}`;
76744
77032
  }
76745
77033
  function pluginFolderOf({ context }) {
76746
- return join18(dirname13(context.environment.configPath), "plugins");
77034
+ return join19(dirname14(context.environment.configPath), "plugins");
76747
77035
  }
76748
77036
  async function pluginIsCurrent({ context }) {
76749
- const manifest = join18(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
76750
- const written = await readFile9(manifest, "utf8").then((text3) => JSON.parse(text3).version).catch(() => void 0);
77037
+ const manifest = join19(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
77038
+ const written = await readFile10(manifest, "utf8").then((text3) => JSON.parse(text3).version).catch(() => void 0);
76751
77039
  return written === cliVersionOf();
76752
77040
  }
76753
77041
  async function writeLazePlugin({ context }) {
@@ -76759,8 +77047,8 @@ async function writeLazePlugin({ context }) {
76759
77047
  configPath: context.environment.configPath
76760
77048
  });
76761
77049
  for (const [path, text3] of Object.entries(files2)) {
76762
- const target = join18(folder, path);
76763
- await mkdir4(dirname13(target), { recursive: true });
77050
+ const target = join19(folder, path);
77051
+ await mkdir4(dirname14(target), { recursive: true });
76764
77052
  await writeFile2(target, text3);
76765
77053
  }
76766
77054
  return folder;
@@ -76790,7 +77078,7 @@ async function registerWithClaude({ context, folder }) {
76790
77078
  return claudeScript({ context, script });
76791
77079
  }
76792
77080
  function claudeDirOf({ context }) {
76793
- return context.environment.inherited.CLAUDE_CONFIG_DIR || join18(homeOf2({ context }), ".claude");
77081
+ return context.environment.inherited.CLAUDE_CONFIG_DIR || join19(homeOf2({ context }), ".claude");
76794
77082
  }
76795
77083
  function unregisterAs({ context, name: name3 }) {
76796
77084
  const script = [
@@ -76801,8 +77089,8 @@ function unregisterAs({ context, name: name3 }) {
76801
77089
  }
76802
77090
  async function dropOwnLeftover({ context, folder }) {
76803
77091
  if (pluginNameHere({ context }) === LAZE_PLUGIN) return;
76804
- const known = await readFile9(
76805
- join18(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
77092
+ const known = await readFile10(
77093
+ join19(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
76806
77094
  "utf8"
76807
77095
  ).then((text3) => JSON.parse(text3)).catch(() => void 0);
76808
77096
  if (known?.[LAZE_PLUGIN]?.source?.path !== folder) return;
@@ -76810,17 +77098,17 @@ async function dropOwnLeftover({ context, folder }) {
76810
77098
  }
76811
77099
  var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
76812
77100
  async function cachedPluginOf({ context }) {
76813
- const path = join18(claudeDirOf({ context }), "plugins", "installed_plugins.json");
76814
- const listed = await readFile9(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
77101
+ const path = join19(claudeDirOf({ context }), "plugins", "installed_plugins.json");
77102
+ const listed = await readFile10(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
76815
77103
  return listed?.plugins?.[installedNameOf({ context })]?.[0]?.installPath;
76816
77104
  }
76817
77105
  async function refreshStaleCache({ context, folder }) {
76818
77106
  const cached2 = await cachedPluginOf({ context });
76819
77107
  if (!cached2) return true;
76820
- const read4 = (path) => readFile9(path, "utf8").catch(() => "");
77108
+ const read4 = (path) => readFile10(path, "utf8").catch(() => "");
76821
77109
  for (const file4 of RUN_FILES) {
76822
- const ours = await read4(join18(folder, LAZE_PLUGIN, file4));
76823
- if (ours === await read4(join18(cached2, file4))) continue;
77110
+ const ours = await read4(join19(folder, LAZE_PLUGIN, file4));
77111
+ if (ours === await read4(join19(cached2, file4))) continue;
76824
77112
  const plugin2 = installedNameOf({ context });
76825
77113
  const script = [
76826
77114
  `claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
@@ -76831,10 +77119,10 @@ async function refreshStaleCache({ context, folder }) {
76831
77119
  return true;
76832
77120
  }
76833
77121
  function registeredMarkOf({ context }) {
76834
- return join18(pluginFolderOf({ context }), "registered");
77122
+ return join19(pluginFolderOf({ context }), "registered");
76835
77123
  }
76836
77124
  async function pluginRegistered({ context }) {
76837
- return readFile9(registeredMarkOf({ context }), "utf8").then(
77125
+ return readFile10(registeredMarkOf({ context }), "utf8").then(
76838
77126
  () => true,
76839
77127
  () => false
76840
77128
  );
@@ -76849,7 +77137,7 @@ async function installLazePlugin({ context }) {
76849
77137
  async function plugin({ context, args }) {
76850
77138
  const action = args.words[1] ?? "install";
76851
77139
  if (action === "path") {
76852
- context.out(`${join18(pluginFolderOf({ context }), LAZE_PLUGIN)}
77140
+ context.out(`${join19(pluginFolderOf({ context }), LAZE_PLUGIN)}
76853
77141
  `);
76854
77142
  return 0;
76855
77143
  }
@@ -77048,7 +77336,7 @@ async function pushInbox({
77048
77336
  }
77049
77337
 
77050
77338
  // src/services/plugin-tip.service.ts
77051
- import { readFile as readFile10 } from "node:fs/promises";
77339
+ import { readFile as readFile11 } from "node:fs/promises";
77052
77340
  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.";
77053
77341
  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.";
77054
77342
  function monitorsRunHere({ context }) {
@@ -77090,7 +77378,7 @@ async function reloadTipOnce({
77090
77378
  }) {
77091
77379
  if (!session || !monitorsRunHere({ context })) return void 0;
77092
77380
  if (!await pluginRegistered({ context })) return void 0;
77093
- const told = await readFile10(toldPathOf({ context, session }), "utf8").then(
77381
+ const told = await readFile11(toldPathOf({ context, session }), "utf8").then(
77094
77382
  () => true,
77095
77383
  () => false
77096
77384
  );
@@ -77160,9 +77448,9 @@ async function installHooks({
77160
77448
  directory,
77161
77449
  profile
77162
77450
  }) {
77163
- const folder = join19(directory, ".claude");
77164
- const path = join19(folder, "settings.local.json");
77165
- const text3 = await readFile11(path, "utf8").catch(() => "{}");
77451
+ const folder = join20(directory, ".claude");
77452
+ const path = join20(folder, "settings.local.json");
77453
+ const text3 = await readFile12(path, "utf8").catch(() => "{}");
77166
77454
  const current3 = settingsOf({ path, text: text3 });
77167
77455
  const command = (hook) => hookCommand({ program: context.program, profile, hook });
77168
77456
  const settings3 = withLazeHooks({
@@ -77254,6 +77542,7 @@ async function linkAgent({ context, args }) {
77254
77542
  const token2 = flagText({ args, name: "token" });
77255
77543
  if (!token2) throw new CliUsageError("Usage: laze agent link --token <token>");
77256
77544
  await refuseInSubagent({ context, args, command: /\bagent\s+link\b/ });
77545
+ await noteNewerInstall({ context });
77257
77546
  const url2 = serverUrlOf({ context, args });
77258
77547
  const { harness, pid } = await harnessOf2({ context, args });
77259
77548
  const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
@@ -77271,8 +77560,16 @@ async function sessionFolderOf({
77271
77560
  pid
77272
77561
  }) {
77273
77562
  const asked = flagText({ args, name: "project" });
77274
- if (asked) return resolve5(context.cwd, asked);
77275
- return claude ? claudeProjectOf({ context, claudePid: pid }) : context.cwd;
77563
+ if (asked) return { folder: resolve5(context.cwd, asked), elsewhere: void 0 };
77564
+ if (!claude) return { folder: context.cwd, elsewhere: void 0 };
77565
+ return claudeFoldersOf({ context, claudePid: pid });
77566
+ }
77567
+ function elsewhereLinesOf({ folder, elsewhere }) {
77568
+ if (!elsewhere) return [];
77569
+ return [
77570
+ `Claude Code itself runs in ${elsewhere}, not in this folder, so this link is for ${folder}, where you ran it.`,
77571
+ `If ${elsewhere} is the session's folder, link again from there with a new token, or with --project ${elsewhere}.`
77572
+ ];
77276
77573
  }
77277
77574
  async function settleLinked({
77278
77575
  context,
@@ -77288,7 +77585,7 @@ async function settleLinked({
77288
77585
  profiles: (await context.store.read()).profiles
77289
77586
  });
77290
77587
  const claude = harness === "claude-code";
77291
- const directory = await sessionFolderOf({ context, args, claude, pid });
77588
+ const { folder: directory, elsewhere } = await sessionFolderOf({ context, args, claude, pid });
77292
77589
  await context.store.saveProfile({
77293
77590
  name: name3,
77294
77591
  bindDirectory: directory,
@@ -77316,7 +77613,7 @@ async function settleLinked({
77316
77613
  const hooked = claude && !args.flags["no-hook"];
77317
77614
  const hookPath = hooked ? await installHooks({ context, directory, profile: name3 }) : void 0;
77318
77615
  if (hooked) await listenAfterLink({ context, args, profile: name3, claudePid: pid });
77319
- const laze = lazeCommandOf({ program: context.program });
77616
+ const { command: laze, shadow } = await rerunCommandOf({ context });
77320
77617
  const steps = await nextStepsFor({
77321
77618
  context,
77322
77619
  args,
@@ -77330,6 +77627,8 @@ async function settleLinked({
77330
77627
  [
77331
77628
  `Linked as ${linked.agent.name} (${linked.agent.id}), profile "${name3}" for ${directory}.`,
77332
77629
  ...hookPath ? [`Added the Laze hooks to ${hookPath}.`] : [],
77630
+ ...elsewhereLinesOf({ folder: directory, elsewhere }),
77631
+ ...shadowedLinkLineOf({ shadow }),
77333
77632
  "",
77334
77633
  steps,
77335
77634
  ""
@@ -77385,7 +77684,7 @@ async function reportTranscript({
77385
77684
  input: input2
77386
77685
  }) {
77387
77686
  if (!input2.transcript_path || !input2.session_id) return;
77388
- const lines2 = (await readFile11(input2.transcript_path, "utf8")).split("\n");
77687
+ const lines2 = (await readFile12(input2.transcript_path, "utf8")).split("\n");
77389
77688
  const context = readTranscript({ lines: lines2 });
77390
77689
  await client.post("/api/agents/me/activity", {
77391
77690
  sessionId: input2.session_id,
@@ -77424,7 +77723,7 @@ async function handOver({ context, args }) {
77424
77723
  const kept = await dueFromSpool({
77425
77724
  context,
77426
77725
  profile: agent3,
77427
- seen: () => input2.transcript_path ? readFile11(input2.transcript_path, "utf8") : Promise.resolve(""),
77726
+ seen: () => input2.transcript_path ? readFile12(input2.transcript_path, "utf8") : Promise.resolve(""),
77428
77727
  pushedToo: false,
77429
77728
  settledOnly: true
77430
77729
  });
@@ -77465,14 +77764,14 @@ async function addSessionStartWaiter({ context, args }) {
77465
77764
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR;
77466
77765
  const profile = flagText({ args, name: "profile" });
77467
77766
  if (!directory || !profile) return;
77468
- const path = join19(directory, ".claude", "settings.local.json");
77469
- const settings3 = await readFile11(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
77767
+ const path = join20(directory, ".claude", "settings.local.json");
77768
+ const settings3 = await readFile12(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
77470
77769
  if (!settings3 || !lacksSessionStartWaiter({ settings: settings3 })) return;
77471
77770
  await installHooks({ context, directory, profile });
77472
77771
  }
77473
77772
  async function refreshPlugin({ context }) {
77474
77773
  if (await pluginIsCurrent({ context })) return;
77475
- const logPath = join19(pluginFolderOf({ context }), "install.log");
77774
+ const logPath = join20(pluginFolderOf({ context }), "install.log");
77476
77775
  context.processes.spawnDetached({ argv: [...context.program, "plugin", "install"], logPath });
77477
77776
  }
77478
77777
  async function stopHook({ context, args }) {
@@ -77493,7 +77792,7 @@ async function stopHook({ context, args }) {
77493
77792
  }
77494
77793
 
77495
77794
  // src/services/agent-manage-commands.service.ts
77496
- import { readFile as readFile12 } from "node:fs/promises";
77795
+ import { readFile as readFile13 } from "node:fs/promises";
77497
77796
  import { extname, resolve as resolve6 } from "node:path";
77498
77797
 
77499
77798
  // src/rules/login-format.rules.ts
@@ -77626,7 +77925,7 @@ async function avatarOf({
77626
77925
  return emoji4;
77627
77926
  }
77628
77927
  if (!path) return void 0;
77629
- const bytes = await readFile12(resolve6(context.cwd, path)).catch(() => {
77928
+ const bytes = await readFile13(resolve6(context.cwd, path)).catch(() => {
77630
77929
  throw new CliUsageError(`laze: cannot read the avatar file ${path}.`);
77631
77930
  });
77632
77931
  const uploaded = await client.post("/api/agents/avatars", {
@@ -78342,8 +78641,8 @@ async function setAgentRunsOn({
78342
78641
  }
78343
78642
 
78344
78643
  // src/services/agent-migrate-commands.service.ts
78345
- import { readFile as readFile13, stat as stat8 } from "node:fs/promises";
78346
- import { basename as basename6, join as join20, resolve as resolve7 } from "node:path";
78644
+ import { readFile as readFile14, stat as stat8 } from "node:fs/promises";
78645
+ import { basename as basename6, join as join21, resolve as resolve7 } from "node:path";
78347
78646
 
78348
78647
  // src/rules/migration-upload.rules.ts
78349
78648
  import { createHash as createHash4 } from "node:crypto";
@@ -78580,7 +78879,7 @@ async function transcriptOf({ context, args, ticket }) {
78580
78879
  if (ticket.source === "codex") {
78581
78880
  const codexHome = context.environment.codexHome;
78582
78881
  const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
78583
- return { sessionId, path: path2, where: join20(codexHome, "sessions") };
78882
+ return { sessionId, path: path2, where: join21(codexHome, "sessions") };
78584
78883
  }
78585
78884
  const { root, path } = await claudeTranscriptOf({ context, sessionId });
78586
78885
  return { sessionId, path, where: root };
@@ -78632,7 +78931,7 @@ async function uploadTranscript({ context, args, client }) {
78632
78931
  `The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
78633
78932
  );
78634
78933
  }
78635
- const raw = await readFile13(found.path, "utf8");
78934
+ const raw = await readFile14(found.path, "utf8");
78636
78935
  if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
78637
78936
  const redacted = await redactTranscript({ text: raw });
78638
78937
  const { parts, truncated } = transcriptPartsOf({
@@ -78890,8 +79189,8 @@ async function requestAgent({ context, args }) {
78890
79189
  }
78891
79190
 
78892
79191
  // src/services/app-commands.service.ts
78893
- import { mkdir as mkdir6, readdir as readdir6, readFile as readFile15, writeFile as writeFile5 } from "node:fs/promises";
78894
- import { dirname as dirname14, join as join23, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
79192
+ import { mkdir as mkdir6, readdir as readdir7, readFile as readFile16, writeFile as writeFile5 } from "node:fs/promises";
79193
+ import { dirname as dirname15, join as join24, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
78895
79194
 
78896
79195
  // ../../modules/app/contract/src/app.connections.ts
78897
79196
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -81439,7 +81738,7 @@ async function appPinsCommand({
81439
81738
  import { execFile } from "node:child_process";
81440
81739
  import { mkdtemp, rm as rm11, writeFile as writeFile4 } from "node:fs/promises";
81441
81740
  import { tmpdir } from "node:os";
81442
- import { join as join21 } from "node:path";
81741
+ import { join as join22 } from "node:path";
81443
81742
  import { promisify } from "node:util";
81444
81743
  var run2 = promisify(execFile);
81445
81744
  var MODULE_SYNTAX = /^\s*(import|export)\s/m;
@@ -81468,11 +81767,11 @@ async function scriptErrorsOf({
81468
81767
  const unknown2 = unknownCollectionsOf({ files: files2, collections });
81469
81768
  const scripts = files2.flatMap(scriptsOf);
81470
81769
  if (scripts.length === 0) return unknown2;
81471
- const dir = await mkdtemp(join21(tmpdir(), "laze-app-check-"));
81770
+ const dir = await mkdtemp(join22(tmpdir(), "laze-app-check-"));
81472
81771
  try {
81473
81772
  const errors = await Promise.all(
81474
81773
  scripts.map(async (script, index) => {
81475
- const file4 = join21(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
81774
+ const file4 = join22(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
81476
81775
  await writeFile4(file4, script.code);
81477
81776
  try {
81478
81777
  await run2(process.execPath, ["--check", file4]);
@@ -81490,9 +81789,9 @@ async function scriptErrorsOf({
81490
81789
  }
81491
81790
 
81492
81791
  // src/services/app-serve.service.ts
81493
- import { readFile as readFile14, stat as stat9 } from "node:fs/promises";
81792
+ import { readFile as readFile15, stat as stat9 } from "node:fs/promises";
81494
81793
  import { createServer } from "node:http";
81495
- import { extname as extname2, join as join22, normalize, sep as sep2 } from "node:path";
81794
+ import { extname as extname2, join as join23, normalize, sep as sep2 } from "node:path";
81496
81795
  var TYPES2 = {
81497
81796
  ".html": "text/html; charset=utf-8",
81498
81797
  ".js": "text/javascript; charset=utf-8",
@@ -81543,13 +81842,13 @@ async function staticFile({
81543
81842
  if (clean.startsWith("..") || hidden) {
81544
81843
  return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
81545
81844
  }
81546
- const candidates = [join22(folder, clean), join22(folder, clean, "index.html")];
81547
- if (!extname2(clean)) candidates.push(join22(folder, "index.html"));
81845
+ const candidates = [join23(folder, clean), join23(folder, clean, "index.html")];
81846
+ if (!extname2(clean)) candidates.push(join23(folder, "index.html"));
81548
81847
  for (const target of candidates) {
81549
81848
  const info = await stat9(target).catch(() => void 0);
81550
81849
  if (!info?.isFile()) continue;
81551
81850
  const type = TYPES2[extname2(target).toLowerCase()] ?? "application/octet-stream";
81552
- const body = await readFile14(target);
81851
+ const body = await readFile15(target);
81553
81852
  if (extname2(target) === ".html") {
81554
81853
  return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
81555
81854
  }
@@ -81784,7 +82083,7 @@ async function turnTokenOf2({
81784
82083
  const pinned = env.LAZE_TURN_TOKEN?.trim();
81785
82084
  if (pinned) return pinned;
81786
82085
  if (env.LAZE_TURN_FILE) {
81787
- return readFile15(env.LAZE_TURN_FILE, "utf8").then(
82086
+ return readFile16(env.LAZE_TURN_FILE, "utf8").then(
81788
82087
  (text3) => text3.trim(),
81789
82088
  () => ""
81790
82089
  );
@@ -81814,7 +82113,7 @@ function folderOf({ context, word: word3 }) {
81814
82113
  return resolve8(context.cwd, word3 ?? ".");
81815
82114
  }
81816
82115
  async function readManifest(folder) {
81817
- const text3 = await readFile15(join23(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
82116
+ const text3 = await readFile16(join24(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
81818
82117
  if (text3 === void 0) return void 0;
81819
82118
  const parsed = appManifestSchema.safeParse(JSON.parse(text3));
81820
82119
  if (!parsed.success) {
@@ -81855,7 +82154,7 @@ async function jsonFlag({
81855
82154
  }) {
81856
82155
  const raw = flagText({ args, name: name3 });
81857
82156
  if (!raw) return void 0;
81858
- const text3 = raw.startsWith("@") ? await readFile15(resolve8(context.cwd, raw.slice(1)), "utf8") : raw;
82157
+ const text3 = raw.startsWith("@") ? await readFile16(resolve8(context.cwd, raw.slice(1)), "utf8") : raw;
81859
82158
  try {
81860
82159
  return JSON.parse(text3);
81861
82160
  } catch {
@@ -81867,8 +82166,8 @@ async function listFiles(folder) {
81867
82166
  const pending2 = [folder];
81868
82167
  while (pending2.length > 0 && found.length <= MAX_FILES) {
81869
82168
  const current3 = pending2.pop() ?? folder;
81870
- for (const entry of await readdir6(current3, { withFileTypes: true })) {
81871
- const path = join23(current3, entry.name);
82169
+ for (const entry of await readdir7(current3, { withFileTypes: true })) {
82170
+ const path = join24(current3, entry.name);
81872
82171
  const rel = relative3(folder, path).split(sep3).join("/");
81873
82172
  if (isSkippedPath({ path: rel })) continue;
81874
82173
  if (entry.isDirectory()) pending2.push(path);
@@ -81907,8 +82206,8 @@ var appCreate = async ({ context, args }) => {
81907
82206
  await mkdir6(folder, { recursive: true });
81908
82207
  const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
81909
82208
  for (const file4 of start2?.files ?? []) {
81910
- const target = join23(folder, ...file4.path.split("/"));
81911
- await mkdir6(dirname14(target), { recursive: true });
82209
+ const target = join24(folder, ...file4.path.split("/"));
82210
+ await mkdir6(dirname15(target), { recursive: true });
81912
82211
  await writeFile5(
81913
82212
  target,
81914
82213
  file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
@@ -81920,7 +82219,7 @@ var appCreate = async ({ context, args }) => {
81920
82219
  views: [...start2?.template.views ?? []],
81921
82220
  seed: { ...start2?.template.seed }
81922
82221
  };
81923
- await writeFile5(join23(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
82222
+ await writeFile5(join24(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
81924
82223
  `);
81925
82224
  const where = relative3(context.cwd, folder) || ".";
81926
82225
  print5({
@@ -81992,7 +82291,7 @@ var appPush = async ({ context, args }) => {
81992
82291
  paths.map(
81993
82292
  async (path) => buildFileOf({
81994
82293
  path: relative3(folder, path).split(sep3).join("/"),
81995
- bytes: await readFile15(path)
82294
+ bytes: await readFile16(path)
81996
82295
  })
81997
82296
  )
81998
82297
  );
@@ -82062,7 +82361,7 @@ var appWrite = async ({ context, args }) => {
82062
82361
  const path = resolve8(context.cwd, word3);
82063
82362
  const { bytes: _bytes, ...file4 } = buildFileOf({
82064
82363
  path: relative3(folder, path).split(sep3).join("/"),
82065
- bytes: await readFile15(path)
82364
+ bytes: await readFile16(path)
82066
82365
  });
82067
82366
  return file4;
82068
82367
  })
@@ -82151,7 +82450,7 @@ async function folderClaim({
82151
82450
  folder,
82152
82451
  appId
82153
82452
  }) {
82154
- const entries = await readdir6(folder).catch(() => []);
82453
+ const entries = await readdir7(folder).catch(() => []);
82155
82454
  if (entries.length === 0) return "empty";
82156
82455
  const manifest = await readManifest(folder).catch(() => void 0);
82157
82456
  if (!manifest) return "other-files";
@@ -82189,8 +82488,8 @@ var appPull = async ({ context, args }) => {
82189
82488
  );
82190
82489
  }
82191
82490
  for (const file4 of pulled.files) {
82192
- const target = join23(folder, ...file4.path.split("/"));
82193
- await mkdir6(dirname14(target), { recursive: true });
82491
+ const target = join24(folder, ...file4.path.split("/"));
82492
+ await mkdir6(dirname15(target), { recursive: true });
82194
82493
  await writeFile5(
82195
82494
  target,
82196
82495
  file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
@@ -82208,7 +82507,7 @@ var appPull = async ({ context, args }) => {
82208
82507
  ])
82209
82508
  )
82210
82509
  };
82211
- await writeFile5(join23(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
82510
+ await writeFile5(join24(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
82212
82511
  `);
82213
82512
  const names = pulled.collections.map((collection) => collection.name);
82214
82513
  const where = relative3(context.cwd, folder) || ".";
@@ -82523,7 +82822,7 @@ var appImport = async ({ context, args }) => {
82523
82822
  const words = args.words.slice(2);
82524
82823
  const [named, collection, file4] = words.length >= 3 ? words : [void 0, ...words];
82525
82824
  if (!collection || !file4) throw new CliUsageError(USAGE5);
82526
- const csv = await readFile15(resolve8(context.cwd, file4), "utf8").catch(() => {
82825
+ const csv = await readFile16(resolve8(context.cwd, file4), "utf8").catch(() => {
82527
82826
  throw new CliUsageError(`Cannot read ${file4}`);
82528
82827
  });
82529
82828
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
@@ -83389,13 +83688,13 @@ async function billing({ context, args }) {
83389
83688
 
83390
83689
  // src/services/browser-commands.service.ts
83391
83690
  import { randomBytes as randomBytes3 } from "node:crypto";
83392
- import { readFile as readFile17 } from "node:fs/promises";
83393
- import { dirname as dirname16, join as join26 } from "node:path";
83691
+ import { readFile as readFile18 } from "node:fs/promises";
83692
+ import { dirname as dirname17, join as join27 } from "node:path";
83394
83693
 
83395
83694
  // src/services/browser-tab-commands.service.ts
83396
83695
  import { mkdir as mkdir7, writeFile as writeFile6 } from "node:fs/promises";
83397
83696
  import { tmpdir as tmpdir3 } from "node:os";
83398
- import { join as join25 } from "node:path";
83697
+ import { join as join26 } from "node:path";
83399
83698
 
83400
83699
  // src/rules/browser-login.rules.ts
83401
83700
  var PASSWORD_NAME = /pass|pwd/i;
@@ -83426,9 +83725,9 @@ function loginValuesOf({
83426
83725
 
83427
83726
  // src/services/vault-commands.service.ts
83428
83727
  import { createHash as createHash6 } from "node:crypto";
83429
- import { readFile as readFile16, rm as rm12 } from "node:fs/promises";
83728
+ import { readFile as readFile17, rm as rm12 } from "node:fs/promises";
83430
83729
  import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
83431
- import { dirname as dirname15, join as join24 } from "node:path";
83730
+ import { dirname as dirname16, join as join25 } from "node:path";
83432
83731
 
83433
83732
  // src/rules/vault-session.rules.ts
83434
83733
  function vaultSessionOf({
@@ -83493,7 +83792,7 @@ async function turnTokenOf3({
83493
83792
  if (pinned) return pinned;
83494
83793
  if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
83495
83794
  try {
83496
- return (await readFile16(turnFile, "utf8")).trim();
83795
+ return (await readFile17(turnFile, "utf8")).trim();
83497
83796
  } catch {
83498
83797
  throw new CliUsageError(`${command} works only during an agent's turn`);
83499
83798
  }
@@ -83504,8 +83803,8 @@ function runKeyPathOf({
83504
83803
  profile = ""
83505
83804
  }) {
83506
83805
  const name3 = createHash6("sha256").update(connection).digest("hex");
83507
- const base = turnFile ? dirname15(turnFile) : join24(tmpdir2(), "laze-vault", profile);
83508
- return join24(base, "vault-run-keys", `${name3}.json`);
83806
+ const base = turnFile ? dirname16(turnFile) : join25(tmpdir2(), "laze-vault", profile);
83807
+ return join25(base, "vault-run-keys", `${name3}.json`);
83509
83808
  }
83510
83809
  async function runKeyAt({ path }) {
83511
83810
  const saved3 = await readStateJson({
@@ -84030,9 +84329,9 @@ async function savedScreenshot({
84030
84329
  data,
84031
84330
  nowMs: nowMs2
84032
84331
  }) {
84033
- const folder = join25(tmpdir3(), "laze-browser");
84332
+ const folder = join26(tmpdir3(), "laze-browser");
84034
84333
  await mkdir7(folder, { recursive: true, mode: 448 });
84035
- const path = join25(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs2}.jpg`);
84334
+ const path = join26(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs2}.jpg`);
84036
84335
  await writeFile6(path, Buffer.from(data, "base64"), { mode: 384 });
84037
84336
  return path;
84038
84337
  }
@@ -84509,7 +84808,7 @@ async function turnTokenOf4({
84509
84808
  const pinned = env.LAZE_TURN_TOKEN?.trim();
84510
84809
  if (pinned) return pinned;
84511
84810
  if (env.LAZE_TURN_FILE) {
84512
- return readFile17(env.LAZE_TURN_FILE, "utf8").then(
84811
+ return readFile18(env.LAZE_TURN_FILE, "utf8").then(
84513
84812
  (text3) => text3.trim(),
84514
84813
  () => ""
84515
84814
  );
@@ -84599,7 +84898,7 @@ async function answering({
84599
84898
  }
84600
84899
  function bridgeStatePath({ context, machine: machine2 }) {
84601
84900
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
84602
- return join26(dirname16(context.environment.configPath), "bridges", `${safe}.json`);
84901
+ return join27(dirname17(context.environment.configPath), "bridges", `${safe}.json`);
84603
84902
  }
84604
84903
  async function bridgePort({
84605
84904
  context,
@@ -84709,6 +85008,9 @@ async function browser({
84709
85008
  throw new CliUsageError(BROWSER_USAGE);
84710
85009
  }
84711
85010
 
85011
+ // src/services/channel-admin-commands.service.ts
85012
+ import { randomBytes as randomBytes4 } from "node:crypto";
85013
+
84712
85014
  // src/rules/channel-format.rules.ts
84713
85015
  function channelLabelOf(detail) {
84714
85016
  return detail.kind === "public" || detail.kind === "private" ? `#${detail.name}` : "(direct)";
@@ -84931,6 +85233,7 @@ async function channelCreate({
84931
85233
  const name3 = args.words[2];
84932
85234
  if (!name3) throw new CliUsageError(CREATE_USAGE2);
84933
85235
  const { client, profile } = await signedIn({ context, args });
85236
+ const clientKey = `ck_${randomBytes4(12).toString("hex")}`;
84934
85237
  return changing({
84935
85238
  context,
84936
85239
  profile,
@@ -84938,7 +85241,8 @@ async function channelCreate({
84938
85241
  const detail = await client.post("/api/agents/me/channels/create", {
84939
85242
  name: name3.replace(/^#/, ""),
84940
85243
  visibility: args.flags.private ? "private" : "public",
84941
- topic: flagText({ args, name: "topic" })
85244
+ topic: flagText({ args, name: "topic" }),
85245
+ clientKey
84942
85246
  });
84943
85247
  if (args.flags.json) return context.out(`${JSON.stringify(detail, null, 2)}
84944
85248
  `);
@@ -85311,13 +85615,13 @@ async function channelSettings({ context, args }) {
85311
85615
  }
85312
85616
 
85313
85617
  // src/services/chat-actions-commands.service.ts
85314
- import { readFile as readFile18 } from "node:fs/promises";
85618
+ import { readFile as readFile19 } from "node:fs/promises";
85315
85619
  import { basename as basename8, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve10 } from "node:path";
85316
85620
 
85317
85621
  // src/services/file-download.service.ts
85318
85622
  import { createWriteStream } from "node:fs";
85319
85623
  import { mkdir as mkdir8, rename as rename3, rm as rm13, stat as stat10, truncate } from "node:fs/promises";
85320
- import { basename as basename7, dirname as dirname17, resolve as resolve9 } from "node:path";
85624
+ import { basename as basename7, dirname as dirname18, resolve as resolve9 } from "node:path";
85321
85625
  import { Readable, Transform } from "node:stream";
85322
85626
  import { pipeline } from "node:stream/promises";
85323
85627
  var NOT_READY_WAIT_MS = 5e3;
@@ -85437,8 +85741,8 @@ async function downloadFile({
85437
85741
  out
85438
85742
  }) {
85439
85743
  const asked = out ? resolve9(context.cwd, out) : void 0;
85440
- const part = resolve9(asked ? dirname17(asked) : context.cwd, `.${attachmentId}.part`);
85441
- await mkdir8(dirname17(part), { recursive: true });
85744
+ const part = resolve9(asked ? dirname18(asked) : context.cwd, `.${attachmentId}.part`);
85745
+ await mkdir8(dirname18(part), { recursive: true });
85442
85746
  const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
85443
85747
  async (error63) => {
85444
85748
  await rm13(part, { force: true });
@@ -85710,7 +86014,7 @@ function uploadNameOf({ cwd, path }) {
85710
86014
  }
85711
86015
  var fileUpload = async ({ context, args, client }) => {
85712
86016
  const path = resolve10(context.cwd, wordAt(args, 3));
85713
- const bytes = new Uint8Array(await readFile18(path));
86017
+ const bytes = new Uint8Array(await readFile19(path));
85714
86018
  const answer6 = await uploadFile({
85715
86019
  context,
85716
86020
  client,
@@ -88150,7 +88454,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
88150
88454
  // src/services/computer-copy-commands.service.ts
88151
88455
  import { mkdtemp as mkdtemp2, open as open5, rm as rm15, stat as stat11 } from "node:fs/promises";
88152
88456
  import { tmpdir as tmpdir4 } from "node:os";
88153
- import { basename as basename9, dirname as dirname18, resolve as resolve11 } from "node:path";
88457
+ import { basename as basename9, dirname as dirname19, resolve as resolve11 } from "node:path";
88154
88458
  var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
88155
88459
  copy a local file or folder into your hosted agent's work folder
88156
88460
  (its owner only, up to 2 GiB packed); <folder> is relative to the
@@ -88166,7 +88470,7 @@ function packingOf({ path, isDirectory }) {
88166
88470
  const contents = isDirectory && path.endsWith("/");
88167
88471
  const absolute = resolve11(path);
88168
88472
  const name3 = basename9(absolute);
88169
- return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname18(absolute), entry: name3 };
88473
+ return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname19(absolute), entry: name3 };
88170
88474
  }
88171
88475
  async function sendParts2({
88172
88476
  context,
@@ -88540,11 +88844,11 @@ async function computer({ context, args }) {
88540
88844
  }
88541
88845
 
88542
88846
  // src/services/connect-commands.service.ts
88543
- import { readFile as readFile20 } from "node:fs/promises";
88847
+ import { readFile as readFile21 } from "node:fs/promises";
88544
88848
 
88545
88849
  // src/services/mcp-gateway.service.ts
88546
- import { mkdir as mkdir9, readFile as readFile19, writeFile as writeFile7 } from "node:fs/promises";
88547
- import { basename as basename10, join as join27, resolve as resolve12 } from "node:path";
88850
+ import { mkdir as mkdir9, readFile as readFile20, writeFile as writeFile7 } from "node:fs/promises";
88851
+ import { basename as basename10, join as join28, resolve as resolve12 } from "node:path";
88548
88852
  import { createInterface as createInterface3 } from "node:readline";
88549
88853
  var TURN_HEADER = "x-laze-turn";
88550
88854
  function serveMcpGateway({
@@ -88587,7 +88891,7 @@ async function relayMcpLines({
88587
88891
  const github3 = env.LAZE_GITHUB_CONNECTION;
88588
88892
  const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
88589
88893
  const turnFile = env.LAZE_TURN_FILE;
88590
- const readTurn = () => readFile19(turnFile, "utf8").then(
88894
+ const readTurn = () => readFile20(turnFile, "utf8").then(
88591
88895
  (text3) => text3.trim(),
88592
88896
  () => ""
88593
88897
  );
@@ -88629,8 +88933,8 @@ function safeName(name3, fallback) {
88629
88933
  return last && last !== "." && last !== ".." ? last : fallback;
88630
88934
  }
88631
88935
  async function saveMailFile({ root, file: file4 }) {
88632
- const dir = join27(root, safeName(file4.messageId, "message"));
88633
- const path = join27(dir, safeName(file4.fileName, "attachment"));
88936
+ const dir = join28(root, safeName(file4.messageId, "message"));
88937
+ const path = join28(dir, safeName(file4.fileName, "attachment"));
88634
88938
  await mkdir9(dir, { recursive: true });
88635
88939
  await writeFile7(path, Buffer.from(file4.base64, "base64"));
88636
88940
  return path;
@@ -88749,7 +89053,7 @@ async function turnOf({ context }) {
88749
89053
  const pinned = env.LAZE_TURN_TOKEN?.trim();
88750
89054
  if (pinned) return pinned;
88751
89055
  const file4 = env.LAZE_TURN_FILE;
88752
- const turn = file4 ? await readFile20(file4, "utf8").then(
89056
+ const turn = file4 ? await readFile21(file4, "utf8").then(
88753
89057
  (text3) => text3.trim(),
88754
89058
  () => ""
88755
89059
  ) : "";
@@ -88807,11 +89111,11 @@ async function connect({
88807
89111
  }
88808
89112
 
88809
89113
  // src/services/connector-commands.service.ts
88810
- import { readFile as readFile22 } from "node:fs/promises";
89114
+ import { readFile as readFile23 } from "node:fs/promises";
88811
89115
  import { resolve as resolve13 } from "node:path";
88812
89116
 
88813
89117
  // src/services/vault-keychain-commands.service.ts
88814
- import { readFile as readFile21 } from "node:fs/promises";
89118
+ import { readFile as readFile22 } from "node:fs/promises";
88815
89119
 
88816
89120
  // src/rules/vault-input.rules.ts
88817
89121
  function secondsOf(text3) {
@@ -89229,7 +89533,7 @@ async function secretText({ context, args }) {
89229
89533
  );
89230
89534
  }
89231
89535
  const file4 = flagText({ args, name: "from-file" });
89232
- const text3 = file4 ? await readFile21(file4, "utf8") : await context.readStdin();
89536
+ const text3 = file4 ? await readFile22(file4, "utf8") : await context.readStdin();
89233
89537
  const trimmed = text3.replace(/\r?\n$/, "");
89234
89538
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
89235
89539
  return trimmed;
@@ -89462,7 +89766,7 @@ async function keyText({ context, args }) {
89462
89766
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
89463
89767
  }
89464
89768
  const file4 = flagText({ args, name: "from-file" });
89465
- const text3 = file4 ? await readFile22(resolve13(context.cwd, file4), "utf8") : await context.readStdin();
89769
+ const text3 = file4 ? await readFile23(resolve13(context.cwd, file4), "utf8") : await context.readStdin();
89466
89770
  const trimmed = text3.trim();
89467
89771
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
89468
89772
  return trimmed;
@@ -89783,7 +90087,7 @@ async function conversationDelete({ context, args }) {
89783
90087
  }
89784
90088
 
89785
90089
  // src/services/discord-commands.service.ts
89786
- import { readFile as readFile23 } from "node:fs/promises";
90090
+ import { readFile as readFile24 } from "node:fs/promises";
89787
90091
  import { resolve as resolve14 } from "node:path";
89788
90092
 
89789
90093
  // ../../modules/discord/contract/src/discord.ts
@@ -90131,7 +90435,7 @@ async function secretsOf({ context, args }) {
90131
90435
  const fromConnection = flagText({ args, name: "from-vault" });
90132
90436
  if (fromConnection) return { fromConnection };
90133
90437
  const file4 = flagText({ args, name: "from-file" });
90134
- const text3 = file4 ? await readFile23(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
90438
+ const text3 = file4 ? await readFile24(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
90135
90439
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
90136
90440
  if (lines2.length !== 2) {
90137
90441
  throw new CliUsageError(
@@ -90401,8 +90705,8 @@ var DOMAINS_USAGE = `Usage:
90401
90705
  var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
90402
90706
  `);
90403
90707
  function printDomain(context, row) {
90404
- const join35 = row.autoJoin ? "auto-join on" : "auto-join off";
90405
- context.out(`${row.domain} ${join35}${row.enforced ? " single sign-on enforced" : ""}
90708
+ const join36 = row.autoJoin ? "auto-join on" : "auto-join off";
90709
+ context.out(`${row.domain} ${join36}${row.enforced ? " single sign-on enforced" : ""}
90406
90710
  `);
90407
90711
  }
90408
90712
  async function list4({ context, args }) {
@@ -90434,7 +90738,7 @@ async function domains({ context, args }) {
90434
90738
  }
90435
90739
 
90436
90740
  // src/services/emoji-commands.service.ts
90437
- import { readFile as readFile24 } from "node:fs/promises";
90741
+ import { readFile as readFile25 } from "node:fs/promises";
90438
90742
  import { resolve as resolve15 } from "node:path";
90439
90743
  var EMOJI_USAGE = `Usage:
90440
90744
  laze emoji list [--json] the workspace's custom emoji, aliases and who added each
@@ -90475,7 +90779,7 @@ async function addEmoji({ context, args, client }) {
90475
90779
  const file4 = wordAt4(args, 3);
90476
90780
  let bytes;
90477
90781
  try {
90478
- bytes = new Uint8Array(await readFile24(resolve15(context.cwd, file4)));
90782
+ bytes = new Uint8Array(await readFile25(resolve15(context.cwd, file4)));
90479
90783
  } catch {
90480
90784
  throw new CliUsageError(`Cannot read ${file4}.`);
90481
90785
  }
@@ -90791,7 +91095,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
90791
91095
  var ExternalSharingHooksToken = externalUi.hooks("sharing");
90792
91096
 
90793
91097
  // src/services/workspace-commands.service.ts
90794
- import { readFile as readFile25 } from "node:fs/promises";
91098
+ import { readFile as readFile26 } from "node:fs/promises";
90795
91099
  import { resolve as resolve16 } from "node:path";
90796
91100
  var ROLE_NAMES2 = {
90797
91101
  OWNER: "Owner",
@@ -90974,7 +91278,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
90974
91278
  async function readLogo({ context, file: file4 }) {
90975
91279
  let bytes;
90976
91280
  try {
90977
- bytes = new Uint8Array(await readFile25(resolve16(context.cwd, file4)));
91281
+ bytes = new Uint8Array(await readFile26(resolve16(context.cwd, file4)));
90978
91282
  } catch {
90979
91283
  throw new CliUsageError(`No file to read at ${file4}.`);
90980
91284
  }
@@ -91574,7 +91878,7 @@ async function agentFeedAccess({
91574
91878
  }
91575
91879
 
91576
91880
  // src/services/feed-commands.service.ts
91577
- import { readFile as readFile26 } from "node:fs/promises";
91881
+ import { readFile as readFile27 } from "node:fs/promises";
91578
91882
  import { resolve as resolve17 } from "node:path";
91579
91883
 
91580
91884
  // ../../modules/feed/contract/src/feed.delegate.ts
@@ -92680,7 +92984,7 @@ async function feedTurnOf({
92680
92984
  const read4 = async () => {
92681
92985
  const pinned = env.LAZE_TURN_TOKEN?.trim();
92682
92986
  if (pinned) return pinned;
92683
- if (env.LAZE_TURN_FILE) return (await readFile26(env.LAZE_TURN_FILE, "utf8")).trim();
92987
+ if (env.LAZE_TURN_FILE) return (await readFile27(env.LAZE_TURN_FILE, "utf8")).trim();
92684
92988
  return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
92685
92989
  };
92686
92990
  const turn = await read4().catch(() => "");
@@ -92754,7 +93058,7 @@ async function bodyOf2({
92754
93058
  flags: flags2
92755
93059
  }) {
92756
93060
  const body = { ...flags2.fields };
92757
- const read4 = (source) => "file" in source ? readFile26(resolve17(context.cwd, source.file), "utf8") : source.text;
93061
+ const read4 = (source) => "file" in source ? readFile27(resolve17(context.cwd, source.file), "utf8") : source.text;
92758
93062
  for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
92759
93063
  if (flags2.rich) {
92760
93064
  const text3 = await read4(flags2.rich.source);
@@ -93017,7 +93321,7 @@ async function textFlag({
93017
93321
  }) {
93018
93322
  const value = flagText({ args, name: name3 });
93019
93323
  if (!value.startsWith("@")) return value;
93020
- return readFile26(resolve17(context.cwd, value.slice(1)), "utf8");
93324
+ return readFile27(resolve17(context.cwd, value.slice(1)), "utf8");
93021
93325
  }
93022
93326
  async function feedList({ context, args }) {
93023
93327
  const { client } = await signedIn({ context, args });
@@ -93107,7 +93411,7 @@ async function ranksOf({
93107
93411
  }) {
93108
93412
  const file4 = flagText({ args, name: "file" });
93109
93413
  if (file4) {
93110
- const parsed = JSON.parse(await readFile26(resolve17(context.cwd, file4), "utf8"));
93414
+ const parsed = JSON.parse(await readFile27(resolve17(context.cwd, file4), "utf8"));
93111
93415
  if (Array.isArray(parsed)) return parsed;
93112
93416
  throw new CliUsageError("--file holds a list of {itemId, priority}");
93113
93417
  }
@@ -93220,7 +93524,7 @@ async function feed({ context, args }) {
93220
93524
  }
93221
93525
 
93222
93526
  // src/services/github-commands.service.ts
93223
- import { readFile as readFile27 } from "node:fs/promises";
93527
+ import { readFile as readFile28 } from "node:fs/promises";
93224
93528
 
93225
93529
  // src/rules/github-signature.rules.ts
93226
93530
  var TURN_SEPARATOR = "~";
@@ -93290,7 +93594,7 @@ var REAL_GH = "/usr/bin/gh";
93290
93594
  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>`.";
93291
93595
  async function turnFileToken({ env }) {
93292
93596
  if (!env.LAZE_TURN_FILE) return "";
93293
- return readFile27(env.LAZE_TURN_FILE, "utf8").then(
93597
+ return readFile28(env.LAZE_TURN_FILE, "utf8").then(
93294
93598
  (text3) => text3.trim(),
93295
93599
  () => ""
93296
93600
  );
@@ -93324,7 +93628,7 @@ async function githubGh({
93324
93628
  args: args.rest,
93325
93629
  agentName: profile.name ?? "An agent",
93326
93630
  threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
93327
- readBodyFile: (path) => path === "-" ? context.readStdin() : readFile27(path, "utf8")
93631
+ readBodyFile: (path) => path === "-" ? context.readStdin() : readFile28(path, "utf8")
93328
93632
  });
93329
93633
  return context.runCommand({
93330
93634
  command: [REAL_GH, ...ghArgs],
@@ -93934,11 +94238,11 @@ async function ip({ context, args }) {
93934
94238
 
93935
94239
  // src/services/join-commands.service.ts
93936
94240
  import { rm as rm16 } from "node:fs/promises";
93937
- import { dirname as dirname19, join as join28 } from "node:path";
94241
+ import { dirname as dirname20, join as join29 } from "node:path";
93938
94242
  var DEFAULT_WAIT_SECONDS2 = 100;
93939
94243
  var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
93940
94244
  function pendingPathOf({ context }) {
93941
- return join28(dirname19(context.environment.configPath), "join", "pending.json");
94245
+ return join29(dirname20(context.environment.configPath), "join", "pending.json");
93942
94246
  }
93943
94247
  async function readPending({
93944
94248
  context,
@@ -95088,18 +95392,18 @@ async function serveMcp({
95088
95392
  }
95089
95393
 
95090
95394
  // src/services/memory-commands.service.ts
95091
- import { readdir as readdir7, readFile as readFile29 } from "node:fs/promises";
95092
- import { join as join29, resolve as resolve19 } from "node:path";
95395
+ import { readdir as readdir8, readFile as readFile30 } from "node:fs/promises";
95396
+ import { join as join30, resolve as resolve19 } from "node:path";
95093
95397
 
95094
95398
  // src/services/mount-files.service.ts
95095
- import { mkdir as mkdir10, readFile as readFile28, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
95096
- import { dirname as dirname20, relative as relative5, resolve as resolve18 } from "node:path";
95399
+ import { mkdir as mkdir10, readFile as readFile29, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
95400
+ import { dirname as dirname21, relative as relative5, resolve as resolve18 } from "node:path";
95097
95401
  async function textArgument({
95098
95402
  context,
95099
95403
  value
95100
95404
  }) {
95101
95405
  if (value === "-") return context.readStdin();
95102
- if (value.startsWith("@")) return readFile28(resolve18(context.cwd, value.slice(1)), "utf8");
95406
+ if (value.startsWith("@")) return readFile29(resolve18(context.cwd, value.slice(1)), "utf8");
95103
95407
  return value;
95104
95408
  }
95105
95409
  function turnChannel({ context, args }) {
@@ -95119,7 +95423,7 @@ async function writeMount({
95119
95423
  const inside = relative5(root, target);
95120
95424
  if (!inside || inside.startsWith(".."))
95121
95425
  throw new Error(`Refusing to write outside ${root}: ${file4.path}`);
95122
- await mkdir10(dirname20(target), { recursive: true });
95426
+ await mkdir10(dirname21(target), { recursive: true });
95123
95427
  await writeFile8(target, file4.content);
95124
95428
  }
95125
95429
  return root;
@@ -95246,7 +95550,7 @@ async function turnTokenOf5({ context }) {
95246
95550
  const pinned = env.LAZE_TURN_TOKEN?.trim();
95247
95551
  if (pinned) return pinned;
95248
95552
  if (!env.LAZE_TURN_FILE) return "";
95249
- return readFile29(env.LAZE_TURN_FILE, "utf8").then(
95553
+ return readFile30(env.LAZE_TURN_FILE, "utf8").then(
95250
95554
  (text3) => text3.trim(),
95251
95555
  () => ""
95252
95556
  );
@@ -95376,15 +95680,15 @@ async function siestaImport({
95376
95680
  dir
95377
95681
  }) {
95378
95682
  const root = resolve19(context.cwd, dir);
95379
- const log = await readFile29(join29(root, "LOG.md"));
95380
- const names = (await readdir7(join29(root, "tree")).catch(() => [])).filter(
95683
+ const log = await readFile30(join30(root, "LOG.md"));
95684
+ const names = (await readdir8(join30(root, "tree")).catch(() => [])).filter(
95381
95685
  (name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
95382
95686
  );
95383
95687
  const tree = Object.fromEntries(
95384
95688
  await Promise.all(
95385
95689
  names.map(async (name3) => [
95386
95690
  name3.slice(0, -3),
95387
- (await readFile29(join29(root, "tree", name3))).toString("base64")
95691
+ (await readFile30(join30(root, "tree", name3))).toString("base64")
95388
95692
  ])
95389
95693
  )
95390
95694
  );
@@ -95404,15 +95708,15 @@ async function memoryImport({ context, args }) {
95404
95708
  const dir = flagText({ args, name: "optmem" });
95405
95709
  if (!dir) throw new CliUsageError(USAGE13);
95406
95710
  const root = resolve19(context.cwd, dir);
95407
- const log = await readFile29(join29(root, "LOG.txt"));
95408
- const sizes2 = (await readdir7(join29(root, "TREE")).catch(() => [])).filter(
95711
+ const log = await readFile30(join30(root, "LOG.txt"));
95712
+ const sizes2 = (await readdir8(join30(root, "TREE")).catch(() => [])).filter(
95409
95713
  (name3) => /^\d{1,4}$/.test(name3)
95410
95714
  );
95411
95715
  const tree = Object.fromEntries(
95412
95716
  await Promise.all(
95413
95717
  sizes2.map(async (size) => [
95414
95718
  size,
95415
- (await readFile29(join29(root, "TREE", size))).toString("base64")
95719
+ (await readFile30(join30(root, "TREE", size))).toString("base64")
95416
95720
  ])
95417
95721
  )
95418
95722
  );
@@ -95976,9 +96280,9 @@ async function openclaw({
95976
96280
  }
95977
96281
 
95978
96282
  // src/services/operator-key-commands.service.ts
95979
- import { createHash as createHash7, randomBytes as randomBytes4 } from "node:crypto";
95980
- import { mkdir as mkdir11, readFile as readFile30, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
95981
- import { dirname as dirname21, join as join30 } from "node:path";
96283
+ import { createHash as createHash7, randomBytes as randomBytes5 } from "node:crypto";
96284
+ import { mkdir as mkdir11, readFile as readFile31, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
96285
+ import { dirname as dirname22, join as join31 } from "node:path";
95982
96286
 
95983
96287
  // ../../modules/audit-log/contract/src/audit-log.api.ts
95984
96288
  var auditEntrySchemaDefinition = external_exports.object({
@@ -97349,14 +97653,14 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
97349
97653
  laze ops status <key> waiting, approved or ended
97350
97654
  laze ops use <key> run the approved action and print the answer`;
97351
97655
  var POLL_MS3 = 5e3;
97352
- var keyFile = ({ context, keyId }) => join30(dirname21(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
97656
+ var keyFile = ({ context, keyId }) => join31(dirname22(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
97353
97657
  async function saveSecret({
97354
97658
  context,
97355
97659
  keyId,
97356
97660
  secret
97357
97661
  }) {
97358
97662
  const path = keyFile({ context, keyId });
97359
- await mkdir11(dirname21(path), { recursive: true, mode: 448 });
97663
+ await mkdir11(dirname22(path), { recursive: true, mode: 448 });
97360
97664
  await writeFile9(path, secret, { mode: 384 });
97361
97665
  }
97362
97666
  function typedArg(text3) {
@@ -97408,7 +97712,7 @@ async function requestKey({ context, args }) {
97408
97712
  const reason2 = flagText({ args, name: "reason" });
97409
97713
  if (!action || !target || !reason2.trim()) throw new CliUsageError(OPERATOR_KEY_USAGE);
97410
97714
  const { client } = await signedIn({ context, args });
97411
- const secret = randomBytes4(32).toString("hex");
97715
+ const secret = randomBytes5(32).toString("hex");
97412
97716
  const key = await client.post(OPERATOR_KEY_REST_PATHS.request, {
97413
97717
  action,
97414
97718
  target,
@@ -97450,7 +97754,7 @@ async function useKey({ context, args }) {
97450
97754
  if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
97451
97755
  const { client } = await signedIn({ context, args });
97452
97756
  const path = keyFile({ context, keyId });
97453
- const secret = await readFile30(path, "utf8").catch(() => null);
97757
+ const secret = await readFile31(path, "utf8").catch(() => null);
97454
97758
  if (secret === null) {
97455
97759
  throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
97456
97760
  }
@@ -97515,142 +97819,13 @@ ${OPS_USAGE}`);
97515
97819
  }
97516
97820
 
97517
97821
  // src/services/release-watch.service.ts
97518
- import { realpath } from "node:fs/promises";
97519
- import { dirname as dirname22, join as join31 } from "node:path";
97520
-
97521
- // src/rules/cli-update.rules.ts
97522
- var CLI_PACKAGE = "@lazehq/cli";
97523
- var CLI_PACKAGE_LATEST = `${CLI_PACKAGE}@latest`;
97524
- var MANAGERS = [
97525
- { manager: "bun", pattern: /[\\/]\.?bun[\\/]/, command: ["bun", "add", "-g"] },
97526
- { manager: "pnpm", pattern: /[\\/]\.?pnpm[\\/]/, command: ["pnpm", "add", "-g"] },
97527
- { manager: "yarn", pattern: /[\\/]yarn[\\/]global[\\/]/, command: ["yarn", "global", "add"] },
97528
- {
97529
- manager: "npm",
97530
- pattern: /[\\/]_npx[\\/]|[\\/]node_modules[\\/]@lazehq[\\/]cli[\\/]/,
97531
- command: ["npm", "install", "-g"]
97532
- }
97533
- ];
97534
- var NPM_PREFIX = /^(.+)[\\/]lib[\\/]node_modules[\\/]@lazehq[\\/]cli[\\/]/;
97535
- var NPX_CACHE2 = /[\\/]_npx[\\/]/;
97536
- function releaseAgeOverrideOf({ manager }) {
97537
- if (manager === "npm") return ["--prefer-online", "--min-release-age=0"];
97538
- if (manager === "pnpm") return [`--config.minimum-release-age-exclude=${CLI_PACKAGE}`];
97539
- if (manager === "bun") return ["--minimum-release-age=0"];
97540
- return [];
97541
- }
97542
- function updatePlanOf({ script }) {
97543
- if (script === SANDBOX_CLI_PATH) return { kind: "sandbox" };
97544
- const found = MANAGERS.find(({ pattern }) => pattern.test(script));
97545
- if (!found) return { kind: "unmanaged", script };
97546
- const prefix = found.manager === "npm" && !NPX_CACHE2.test(script) ? NPM_PREFIX.exec(script)?.[1] : void 0;
97547
- return {
97548
- kind: "install",
97549
- manager: found.manager,
97550
- command: [
97551
- ...found.command,
97552
- ...prefix ? ["--prefix", prefix] : [],
97553
- ...releaseAgeOverrideOf({ manager: found.manager }),
97554
- CLI_PACKAGE_LATEST
97555
- ]
97556
- };
97557
- }
97558
- function pinnedCommandOf({
97559
- plan: plan2,
97560
- version: version2
97561
- }) {
97562
- return plan2.command.map(
97563
- (part) => part === CLI_PACKAGE_LATEST ? `${CLI_PACKAGE}@${version2}` : part
97564
- );
97565
- }
97566
- var RELEASE_AGE_SETTINGS = {
97567
- npm: [
97568
- { setting: "min-release-age", read: ["npm", "config", "get", "min-release-age"] },
97569
- { setting: "before", read: ["npm", "config", "get", "before"] }
97570
- ],
97571
- pnpm: [
97572
- { setting: "minimum-release-age", read: ["pnpm", "config", "get", "minimum-release-age"] }
97573
- ]
97574
- };
97575
- function settingValueOf({ printed: printed2 }) {
97576
- const value = printed2.trim();
97577
- return value === "" || value === "null" || value === "undefined" || value === "0" ? null : value;
97578
- }
97579
- var VERSION_LINE = /^laze (\S+)\s*$/m;
97580
- function printedVersionOf({ printed: printed2 }) {
97581
- return VERSION_LINE.exec(printed2)?.[1] ?? null;
97582
- }
97583
- function heldBackLineOf({
97584
- manager,
97585
- installed,
97586
- latest,
97587
- settings: settings3,
97588
- command,
97589
- script
97590
- }) {
97591
- 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.`;
97592
- const line = command.join(" ");
97593
- if (settings3.length > 0) {
97594
- 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}
97595
- `;
97596
- }
97597
- if (manager === "bun") {
97598
- 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}
97599
- `;
97600
- }
97601
- 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}
97602
- `;
97603
- }
97604
-
97605
- // src/rules/cli-release.rules.ts
97606
- var CLI_RELEASE_HEADER = "x-laze-cli-release";
97607
- var STAMP = /^(\d+)\.(\d+)\.(\d+)(?:-g([0-9a-f]+))?$/;
97608
- function releaseSkewOf({
97609
- mine: mine4,
97610
- server
97611
- }) {
97612
- const have = STAMP.exec(mine4);
97613
- const ships = STAMP.exec(server);
97614
- if (!have || !ships) return null;
97615
- for (const part of [1, 2, 3]) {
97616
- const difference = Number(have[part]) - Number(ships[part]);
97617
- if (difference !== 0) return difference < 0 ? "older" : "newer";
97618
- }
97619
- return have[4] && ships[4] && have[4] !== ships[4] ? "other_build" : null;
97620
- }
97621
- function releaseWarningOf({
97622
- mine: mine4,
97623
- server,
97624
- sandbox
97625
- }) {
97626
- const skew = releaseSkewOf({ mine: mine4, server });
97627
- if (!skew || skew === "other_build") return null;
97628
- if (sandbox) {
97629
- 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.
97630
- `;
97631
- }
97632
- if (skew === "newer") {
97633
- return `laze: this CLI is ${mine4}, newer than the server's ${server}; a command the server does not have yet fails.
97634
- `;
97635
- }
97636
- return `laze: this CLI is ${mine4}, older than the server's ${server}. Update it with npm i -g ${CLI_PACKAGE_LATEST} (or laze update).
97637
- `;
97638
- }
97639
- function selfUpdateLineOf({
97640
- mine: mine4,
97641
- server,
97642
- manager
97643
- }) {
97644
- 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).
97645
- `;
97646
- }
97647
-
97648
- // src/services/release-watch.service.ts
97822
+ import { realpath as realpath2 } from "node:fs/promises";
97823
+ import { dirname as dirname23, join as join32 } from "node:path";
97649
97824
  var RETRY_AFTER_MS = 6 * 60 * 60 * 1e3;
97650
97825
  async function scriptOf(context) {
97651
97826
  const script = context.program.at(-1) ?? "";
97652
97827
  try {
97653
- return await realpath(script);
97828
+ return await realpath2(script);
97654
97829
  } catch {
97655
97830
  return script;
97656
97831
  }
@@ -97662,15 +97837,15 @@ async function startedUpdate({
97662
97837
  if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
97663
97838
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
97664
97839
  if (plan2.kind !== "install") return null;
97665
- const folder = dirname22(context.environment.configPath);
97666
- const stamp = join31(folder, "auto-update.json");
97840
+ const folder = dirname23(context.environment.configPath);
97841
+ const stamp = join32(folder, "auto-update.json");
97667
97842
  const last = await readStateJson({ path: stamp }) ?? null;
97668
97843
  const now = context.nowMs();
97669
97844
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
97670
97845
  await writeStateJson({ path: stamp, value: { server, atMs: now } });
97671
97846
  context.processes.spawnDetached({
97672
97847
  argv: [...context.program, "update"],
97673
- logPath: join31(folder, "auto-update.log")
97848
+ logPath: join32(folder, "auto-update.log")
97674
97849
  });
97675
97850
  return { manager: plan2.manager };
97676
97851
  }
@@ -97963,8 +98138,8 @@ async function schedule({ context, args }) {
97963
98138
  }
97964
98139
 
97965
98140
  // src/services/skill-commands.service.ts
97966
- import { readdir as readdir8, readFile as readFile31 } from "node:fs/promises";
97967
- import { join as join32, relative as relative6, resolve as resolve21 } from "node:path";
98141
+ import { readdir as readdir9, readFile as readFile32 } from "node:fs/promises";
98142
+ import { join as join33, relative as relative6, resolve as resolve21 } from "node:path";
97968
98143
  var USAGE17 = `Usage:
97969
98144
  laze skill list [--agent <agentId>]
97970
98145
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -97981,12 +98156,12 @@ var USAGE17 = `Usage:
97981
98156
  --agent names the agent with a person's key; an agent's key works on its own skills.
97982
98157
  With a person's key, list without --agent shows every agent's skills.`;
97983
98158
  async function folderFiles({ root }) {
97984
- const entries = await readdir8(root, { recursive: true, withFileTypes: true });
98159
+ const entries = await readdir9(root, { recursive: true, withFileTypes: true });
97985
98160
  const files2 = [];
97986
98161
  for (const entry of entries) {
97987
98162
  if (!entry.isFile()) continue;
97988
- const full = join32(entry.parentPath, entry.name);
97989
- files2.push({ path: relative6(root, full), content: await readFile31(full, "utf8") });
98163
+ const full = join33(entry.parentPath, entry.name);
98164
+ files2.push({ path: relative6(root, full), content: await readFile32(full, "utf8") });
97990
98165
  }
97991
98166
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
97992
98167
  }
@@ -98084,7 +98259,7 @@ async function skillUpdate({ context, args }) {
98084
98259
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
98085
98260
  throw new CliUsageError(USAGE17);
98086
98261
  }
98087
- const skillMd = skillMdFile ? await readFile31(resolve21(context.cwd, skillMdFile), "utf8") : void 0;
98262
+ const skillMd = skillMdFile ? await readFile32(resolve21(context.cwd, skillMdFile), "utf8") : void 0;
98088
98263
  const { client } = await signedIn({ context, args });
98089
98264
  const updated = await client.post("/api/skills/update", {
98090
98265
  name: name3,
@@ -98130,7 +98305,7 @@ async function skill({ context, args }) {
98130
98305
  }
98131
98306
 
98132
98307
  // src/services/slack-commands.service.ts
98133
- import { readFile as readFile32 } from "node:fs/promises";
98308
+ import { readFile as readFile33 } from "node:fs/promises";
98134
98309
  import { resolve as resolve22 } from "node:path";
98135
98310
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
98136
98311
  laze slack overview connected Slack workspaces, mirrors, your link
@@ -98178,7 +98353,7 @@ async function secretLines({ context, args }) {
98178
98353
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
98179
98354
  }
98180
98355
  const file4 = flagText({ args, name: "from-file" });
98181
- const text3 = file4 ? await readFile32(resolve22(context.cwd, file4), "utf8") : await context.readStdin();
98356
+ const text3 = file4 ? await readFile33(resolve22(context.cwd, file4), "utf8") : await context.readStdin();
98182
98357
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
98183
98358
  }
98184
98359
  async function secretsOf2({
@@ -98482,7 +98657,7 @@ async function slack({
98482
98657
  }
98483
98658
 
98484
98659
  // src/services/sso-commands.service.ts
98485
- import { readFile as readFile33 } from "node:fs/promises";
98660
+ import { readFile as readFile34 } from "node:fs/promises";
98486
98661
  var SSO_USAGE = `Usage:
98487
98662
  laze sso domains claimed domains and how each signs in (admins)
98488
98663
  laze sso claim <domain> the TXT record that proves the domain
@@ -98569,7 +98744,7 @@ function refuseSecretFlags({ args }) {
98569
98744
  }
98570
98745
  async function clientSecretOf({ context, args }) {
98571
98746
  const file4 = flagText({ args, name: "from-file" });
98572
- const text3 = file4 ? await readFile33(file4, "utf8") : await context.readStdin();
98747
+ const text3 = file4 ? await readFile34(file4, "utf8") : await context.readStdin();
98573
98748
  const secret = text3.trim();
98574
98749
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
98575
98750
  return secret;
@@ -98782,14 +98957,14 @@ async function statusUsage() {
98782
98957
  }
98783
98958
 
98784
98959
  // src/services/update-commands.service.ts
98785
- import { realpath as realpath2 } from "node:fs/promises";
98960
+ import { realpath as realpath3 } from "node:fs/promises";
98786
98961
  var BY_HAND = `npm install -g ${CLI_PACKAGE_LATEST}`;
98787
98962
  var REGISTRY_LATEST_URL = `https://registry.npmjs.org/${CLI_PACKAGE}/latest`;
98788
98963
  var REGISTRY_TIMEOUT_MS = 1e4;
98789
98964
  async function realScriptOf({ program }) {
98790
98965
  const script = program.at(-1) ?? "";
98791
98966
  try {
98792
- return await realpath2(script);
98967
+ return await realpath3(script);
98793
98968
  } catch {
98794
98969
  return script;
98795
98970
  }
@@ -98871,6 +99046,14 @@ async function update2({
98871
99046
  `);
98872
99047
  return code;
98873
99048
  }
99049
+ return checkInstalled({ context, plan: plan2, mine: mine4, latest });
99050
+ }
99051
+ async function checkInstalled({
99052
+ context,
99053
+ plan: plan2,
99054
+ mine: mine4,
99055
+ latest
99056
+ }) {
98874
99057
  const printed2 = await printedBy({ context, command: [...context.program, "--version"] });
98875
99058
  const installed = printed2 === null ? null : printedVersionOf({ printed: printed2 });
98876
99059
  if (!installed) {
@@ -98878,14 +99061,18 @@ async function update2({
98878
99061
  return 0;
98879
99062
  }
98880
99063
  const held = latest ? releaseSkewOf({ mine: installed, server: latest }) === "older" : installed === mine4;
99064
+ const { script, onPath } = await otherInstallsOf({ context });
99065
+ const shadowed = shadowedLineOf({ updated: installed, script, onPath });
98881
99066
  if (!held) {
98882
99067
  context.out(
98883
99068
  installed === mine4 ? `laze ${mine4} is the latest release.
98884
99069
  ` : `Updated laze ${mine4} to ${installed}.
98885
99070
  `
98886
99071
  );
99072
+ if (shadowed) context.err(shadowed);
98887
99073
  return 0;
98888
99074
  }
99075
+ if (shadowed) context.err(shadowed);
98889
99076
  const settings3 = await releaseAgeSettingsOf({ context, manager: plan2.manager });
98890
99077
  context.err(
98891
99078
  heldBackLineOf({
@@ -98901,8 +99088,8 @@ async function update2({
98901
99088
  }
98902
99089
 
98903
99090
  // src/services/vault-env-commands.service.ts
98904
- import { readFile as readFile34, stat as stat12 } from "node:fs/promises";
98905
- import { dirname as dirname23, join as join33, resolve as resolve23 } from "node:path";
99091
+ import { readFile as readFile35, stat as stat12 } from "node:fs/promises";
99092
+ import { dirname as dirname24, join as join34, resolve as resolve23 } from "node:path";
98906
99093
 
98907
99094
  // src/rules/vault-manifest.rules.ts
98908
99095
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -99248,9 +99435,9 @@ async function manifestPathOf({
99248
99435
  if (named) return resolve23(context.cwd, named);
99249
99436
  const environment = flagText({ args, name: "env" });
99250
99437
  const file4 = environment ? `.env.${environment}.vault` : ".env.vault";
99251
- for (let dir = resolve23(context.cwd); ; dir = dirname23(dir)) {
99252
- if (await isFile(join33(dir, file4))) return join33(dir, file4);
99253
- if (dirname23(dir) === dir) break;
99438
+ for (let dir = resolve23(context.cwd); ; dir = dirname24(dir)) {
99439
+ if (await isFile(join34(dir, file4))) return join34(dir, file4);
99440
+ if (dirname24(dir) === dir) break;
99254
99441
  }
99255
99442
  throw new CliUsageError(`laze vault: no ${file4} here or in a parent folder
99256
99443
  ${ENV_USAGE}`);
@@ -99260,7 +99447,7 @@ async function manifestOf({
99260
99447
  args
99261
99448
  }) {
99262
99449
  const file4 = await manifestPathOf({ context, args });
99263
- const text3 = await readFile34(file4, "utf8").catch(() => {
99450
+ const text3 = await readFile35(file4, "utf8").catch(() => {
99264
99451
  throw new CliUsageError(`laze vault: cannot read ${file4}`);
99265
99452
  });
99266
99453
  return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
@@ -99575,7 +99762,7 @@ async function vaultScrub({ context, args }) {
99575
99762
  }
99576
99763
 
99577
99764
  // src/services/whatsapp-business-commands.service.ts
99578
- import { readFile as readFile35 } from "node:fs/promises";
99765
+ import { readFile as readFile36 } from "node:fs/promises";
99579
99766
  import { resolve as resolve24 } from "node:path";
99580
99767
 
99581
99768
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
@@ -99995,7 +100182,7 @@ async function secretsOf3({ context, args }) {
99995
100182
  const fromConnection = flagText({ args, name: "from-vault" });
99996
100183
  if (fromConnection) return { fromConnection };
99997
100184
  const file4 = flagText({ args, name: "from-file" });
99998
- const text3 = file4 ? await readFile35(resolve24(context.cwd, file4), "utf8") : await context.readStdin();
100185
+ const text3 = file4 ? await readFile36(resolve24(context.cwd, file4), "utf8") : await context.readStdin();
99999
100186
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
100000
100187
  if (lines2.length !== 2) {
100001
100188
  throw new CliUsageError(
@@ -101080,6 +101267,7 @@ async function runCli({
101080
101267
  if (args.flags.version || args.words.length === 1 && args.words[0] === "version") {
101081
101268
  context.out(`laze ${cliVersionOf()}
101082
101269
  `);
101270
+ await noteNewerInstall({ context });
101083
101271
  return 0;
101084
101272
  }
101085
101273
  const command = commandOf(args);
@@ -101152,11 +101340,11 @@ import {
101152
101340
  createHash as createHash8,
101153
101341
  createPrivateKey,
101154
101342
  generateKeyPairSync,
101155
- randomBytes as randomBytes5,
101343
+ randomBytes as randomBytes6,
101156
101344
  sign
101157
101345
  } from "node:crypto";
101158
- import { chmod, link, mkdir as mkdir12, readFile as readFile36, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
101159
- import { dirname as dirname24, join as join34 } from "node:path";
101346
+ import { chmod, link, mkdir as mkdir12, readFile as readFile37, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
101347
+ import { dirname as dirname25, join as join35 } from "node:path";
101160
101348
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
101161
101349
  var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve26, reject) => {
101162
101350
  const child = execFile2(
@@ -101196,11 +101384,11 @@ var MachineKeyStore = class _MachineKeyStore {
101196
101384
  });
101197
101385
  }
101198
101386
  get metaPath() {
101199
- return join34(dirname24(this.options.configPath), "machine-key.json");
101387
+ return join35(dirname25(this.options.configPath), "machine-key.json");
101200
101388
  }
101201
101389
  /** Named by the key, so two CLIs making a key at once never overwrite each other's. */
101202
101390
  pemPathOf(jwk) {
101203
- return join34(dirname24(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
101391
+ return join35(dirname25(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
101204
101392
  }
101205
101393
  /** The Keychain item's account: one per config file and key. */
101206
101394
  accountOf(jwk) {
@@ -101228,7 +101416,7 @@ var MachineKeyStore = class _MachineKeyStore {
101228
101416
  async read() {
101229
101417
  let meta3;
101230
101418
  try {
101231
- meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile36(this.metaPath, "utf8")));
101419
+ meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile37(this.metaPath, "utf8")));
101232
101420
  } catch {
101233
101421
  return null;
101234
101422
  }
@@ -101243,7 +101431,7 @@ var MachineKeyStore = class _MachineKeyStore {
101243
101431
  "-w"
101244
101432
  ],
101245
101433
  timeoutMs: 1e4
101246
- }) : await readFile36(this.pemPathOf(meta3.jwk), "utf8");
101434
+ }) : await readFile37(this.pemPathOf(meta3.jwk), "utf8");
101247
101435
  return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
101248
101436
  }
101249
101437
  async make() {
@@ -101314,7 +101502,7 @@ function keyOf2({ meta: meta3, privateKey }) {
101314
101502
  }
101315
101503
  var shortOf = (jwk) => thumbprintOf({ jwk }).slice(0, 12);
101316
101504
  async function writeOnce({ path, text: text3 }) {
101317
- const temporary = `${path}.${process.pid}.${randomBytes5(6).toString("hex")}.tmp`;
101505
+ const temporary = `${path}.${process.pid}.${randomBytes6(6).toString("hex")}.tmp`;
101318
101506
  await writePrivate({ path: temporary, text: text3 });
101319
101507
  try {
101320
101508
  await link(temporary, path);
@@ -101327,7 +101515,7 @@ async function writeOnce({ path, text: text3 }) {
101327
101515
  }
101328
101516
  }
101329
101517
  async function writePrivate({ path, text: text3 }) {
101330
- await mkdir12(dirname24(path), { recursive: true, mode: 448 });
101518
+ await mkdir12(dirname25(path), { recursive: true, mode: 448 });
101331
101519
  await writeFile11(path, text3, { mode: 384 });
101332
101520
  await chmod(path, 384);
101333
101521
  }
@@ -101385,8 +101573,8 @@ function machineProofFetch({
101385
101573
  // src/services/processes.service.ts
101386
101574
  import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
101387
101575
  import { closeSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
101388
- import { readFile as readFile37, readlink } from "node:fs/promises";
101389
- import { dirname as dirname25 } from "node:path";
101576
+ import { readFile as readFile38, readlink } from "node:fs/promises";
101577
+ import { dirname as dirname26 } from "node:path";
101390
101578
  import { promisify as promisify2 } from "node:util";
101391
101579
  var run3 = promisify2(execFile3);
101392
101580
  function alive(pid) {
@@ -101399,14 +101587,14 @@ function alive(pid) {
101399
101587
  }
101400
101588
  }
101401
101589
  async function argsOf2(pid) {
101402
- const raw = await readFile37(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
101590
+ const raw = await readFile38(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
101403
101591
  if (raw) return raw.split("\0").filter(Boolean);
101404
101592
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
101405
101593
  const line = listed?.stdout.trim();
101406
101594
  return line ? line.split(/\s+/) : void 0;
101407
101595
  }
101408
101596
  async function parentOf(pid) {
101409
- const stat13 = await readFile37(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
101597
+ const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
101410
101598
  const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
101411
101599
  if (fromStat > 0) return fromStat;
101412
101600
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
@@ -101414,7 +101602,7 @@ async function parentOf(pid) {
101414
101602
  return parent > 0 ? parent : void 0;
101415
101603
  }
101416
101604
  async function startOf(pid) {
101417
- const stat13 = await readFile37(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
101605
+ const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
101418
101606
  const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
101419
101607
  if (ticks) return ticks;
101420
101608
  const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);
@@ -101454,7 +101642,7 @@ function spawnDetached({
101454
101642
  logPath,
101455
101643
  orphan = false
101456
101644
  }) {
101457
- mkdirSync(dirname25(logPath), { recursive: true, mode: 448 });
101645
+ mkdirSync(dirname26(logPath), { recursive: true, mode: 448 });
101458
101646
  keepLogSmall({ logPath });
101459
101647
  const log = openSync(logPath, "a", 384);
101460
101648
  if (orphan) {
@@ -101604,6 +101792,7 @@ if (true) {
101604
101792
  err: (text3) => void process.stderr.write(text3),
101605
101793
  readStdin,
101606
101794
  stdoutIsTerminal: process.stdout.isTTY === true,
101795
+ lazeInstalls: () => scanLazeInstalls({ env: environment.inherited, home: homedir5() }),
101607
101796
  ...ask ? { ask } : {},
101608
101797
  sleep,
101609
101798
  nowMs: nowMs2,