@lazehq/cli 0.1.96 → 0.1.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/laze.mjs +592 -414
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -19486,8 +19486,8 @@ var require_snapshot_utils = __commonJS({
19486
19486
  var require_snapshot_recorder = __commonJS({
19487
19487
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
19488
19488
  "use strict";
19489
- var { writeFile: writeFile12, readFile: 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.97";
36964
+ function cliVersionOf({ stamped = STAMPED } = {}) {
36965
+ return stamped.startsWith("__") ? "dev" : stamped;
36966
+ }
36967
+
36968
+ // src/services/cli-installs.service.ts
36969
+ var SYSTEM_FOLDERS = ["/opt/homebrew/bin", "/usr/local/bin", "/usr/bin"];
36970
+ async function wellKnownFoldersOf({
36971
+ env,
36972
+ home,
36973
+ systemFolders
36974
+ }) {
36975
+ const nvm = join2(env.NVM_DIR || join2(home, ".nvm"), "versions", "node");
36976
+ const nodes = await readdir(nvm).catch(() => []);
36977
+ return [
36978
+ ...env.NPM_CONFIG_PREFIX ? [join2(env.NPM_CONFIG_PREFIX, "bin")] : [],
36979
+ join2(home, ".npm-global", "bin"),
36980
+ join2(home, ".local", "share", "npm-global", "bin"),
36981
+ join2(home, ".local", "bin"),
36982
+ join2(home, ".bun", "bin"),
36983
+ ...env.PNPM_HOME ? [env.PNPM_HOME] : [],
36984
+ join2(home, "Library", "pnpm"),
36985
+ join2(home, ".local", "share", "pnpm"),
36986
+ join2(home, ".volta", "bin"),
36987
+ ...nodes.map((node2) => join2(nvm, node2, "bin")),
36988
+ ...systemFolders
36989
+ ];
36990
+ }
36991
+ async function versionBeside({ script }) {
36992
+ try {
36993
+ const text3 = await readFile(join2(dirname(script), "..", "package.json"), "utf8");
36994
+ const found = JSON.parse(text3);
36995
+ return found.name === CLI_PACKAGE && typeof found.version === "string" ? found.version : null;
36996
+ } catch {
36997
+ return null;
36998
+ }
36999
+ }
37000
+ async function installAt({ folder }) {
37001
+ const path = join2(folder, "laze");
37002
+ const script = await realpath(path).catch(() => void 0);
37003
+ if (!script) return void 0;
37004
+ return { path, script, version: await versionBeside({ script }) };
37005
+ }
37006
+ async function scanLazeInstalls({
37007
+ env,
37008
+ home,
37009
+ systemFolders = SYSTEM_FOLDERS
37010
+ }) {
37011
+ const onPathFolders = (env.PATH ?? "").split(delimiter).filter(Boolean);
37012
+ const folders = [...onPathFolders, ...await wellKnownFoldersOf({ env, home, systemFolders })];
37013
+ const seen = /* @__PURE__ */ new Set();
37014
+ const installs = [];
37015
+ let onPath;
37016
+ for (const [index, folder] of folders.entries()) {
37017
+ const install = await installAt({ folder });
37018
+ if (!install) continue;
37019
+ if (!onPath && index < onPathFolders.length) onPath = install;
37020
+ if (seen.has(install.script)) continue;
37021
+ seen.add(install.script);
37022
+ installs.push(install);
37023
+ }
37024
+ return { installs, onPath };
37025
+ }
37026
+ async function runningScriptOf({ context }) {
37027
+ const script = context.program.at(-1) ?? "";
37028
+ return realpath(script).catch(() => script);
37029
+ }
37030
+ async function otherInstallsOf({ context }) {
37031
+ const script = await runningScriptOf({ context });
37032
+ if (!context.lazeInstalls || script === SANDBOX_CLI_PATH) {
37033
+ return { script, others: [], onPath: void 0 };
37034
+ }
37035
+ const { installs, onPath } = await context.lazeInstalls();
37036
+ return { script, others: installs.filter((install) => install.script !== script), onPath };
37037
+ }
37038
+ async function noteNewerInstall({
37039
+ context,
37040
+ mine: mine4 = cliVersionOf()
37041
+ }) {
37042
+ const { script, others } = await otherInstallsOf({ context });
37043
+ const line = newerInstallLineOf({ mine: mine4, script, installs: others });
37044
+ if (line) context.err(line);
37045
+ }
37046
+ async function rerunCommandOf({
37047
+ context
37048
+ }) {
37049
+ const command = lazeCommandOf({ program: context.program });
37050
+ if (command !== "laze") return { command, shadow: void 0 };
37051
+ const { script, onPath } = await otherInstallsOf({ context });
37052
+ if (!onPath || onPath.script === script) return { command, shadow: void 0 };
37053
+ const own2 = context.program.at(-1) ?? script;
37054
+ const quoted2 = /^[\w./@+-]+$/.test(own2) ? own2 : `'${own2.replaceAll("'", "'\\''")}'`;
37055
+ return { command: quoted2, shadow: onPath };
37056
+ }
37057
+
36782
37058
  // src/services/config-store.service.ts
36783
- import { readFile as 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. */
@@ -63320,6 +63592,8 @@ var postMessageInputSchemaDefinition = external_exports.object({
63320
63592
  alsoInChannel: external_exports.boolean().optional(),
63321
63593
  /** In a direct message: notify the people in Do Not Disturb anyway, once. */
63322
63594
  notifyAnyway: external_exports.boolean().optional(),
63595
+ /** In a Laze DM: also post it to this paired Slack DM, as the sender; one Laze message. */
63596
+ alsoSendTo: idSchema4.optional(),
63323
63597
  attachmentIds: external_exports.array(idSchema4).max(10).default([]),
63324
63598
  /** The feed cards an agent's reply links; chat keeps them only when an agent posts. */
63325
63599
  feedRefs: external_exports.array(messageFeedRefSchemaDefinition).max(MESSAGE_FEED_REFS_MAX).optional(),
@@ -63495,12 +63769,15 @@ var forgetMirroredInputSchemaDefinition = external_exports.object({
63495
63769
  });
63496
63770
  var mirrorUnreadsInputSchemaDefinition = external_exports.object({
63497
63771
  workspaceId: workspaceIdSchema,
63498
- userId: idSchema4
63772
+ userId: idSchema4,
63773
+ readActiveSince: external_exports.iso.datetime().optional()
63499
63774
  });
63500
63775
  var mirrorUnreadSchemaDefinition = external_exports.object({
63501
63776
  channelId: idSchema4,
63502
63777
  /** The mirror's key for the conversation, such as `slack:<team>:<channel>`. */
63503
- mirrorKey: external_exports.string().min(1)
63778
+ mirrorKey: external_exports.string().min(1),
63779
+ /** Read to its last message in Laze: listed only when `readActiveSince` asked for it. */
63780
+ read: external_exports.boolean().optional()
63504
63781
  });
63505
63782
  var syncMirrorReadInputSchemaDefinition = external_exports.object({
63506
63783
  workspaceId: workspaceIdSchema,
@@ -63509,7 +63786,12 @@ var syncMirrorReadInputSchemaDefinition = external_exports.object({
63509
63786
  readTo: external_exports.iso.datetime(),
63510
63787
  unread: external_exports.number().int().positive().max(1e6).optional(),
63511
63788
  /** 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()
63789
+ releasesHold: external_exports.boolean().optional(),
63790
+ /**
63791
+ * The person moved the source's marker back to `readTo`: Laze's marker moves back to the newest
63792
+ * message at or before it, while it still sits at this seq and others wrote after it.
63793
+ */
63794
+ backFromSeq: external_exports.number().int().nonnegative().optional()
63513
63795
  });
63514
63796
  var mirroredReadToInputSchemaDefinition = external_exports.object({
63515
63797
  workspaceId: workspaceIdSchema,
@@ -63758,7 +64040,7 @@ var setNotifyInputSchema = setNotifyInputSchemaDefinition;
63758
64040
  var setReplySideInputSchemaDefinition = external_exports.object({
63759
64041
  workspaceId: workspaceIdSchema,
63760
64042
  channelId: idSchema4,
63761
- /** Null forgets the pick, so replies follow the side the other person last wrote from. */
64043
+ /** Null forgets the pick, so replies go to both sides, the default, again. */
63762
64044
  side: replySideSchema.nullable()
63763
64045
  });
63764
64046
  var setReplySideInputSchema = setReplySideInputSchemaDefinition;
@@ -64961,6 +65243,8 @@ var messagePostedPayloadSchemaDefinition = external_exports.object({
64961
65243
  threadRootId: external_exports.string().nullable(),
64962
65244
  /** A thread reply also sent to its conversation, counted and notified like a channel post. */
64963
65245
  alsoInChannel: external_exports.boolean().optional(),
65246
+ /** A Laze DM message also posted to its paired Slack DM: that conversation's id. */
65247
+ alsoSentTo: external_exports.string().optional(),
64964
65248
  /** A person's direct message sent with "Notify anyway": it breaks through Do Not Disturb. */
64965
65249
  notifyAnyway: external_exports.boolean().optional(),
64966
65250
  /** The person whose own action posted it, such as a feed comment: they get no notice of it. */
@@ -69685,6 +69969,11 @@ var agentConfig = Config.define((c) => ({
69685
69969
  "AGENT_CLAUDE_GATEWAY_FAST",
69686
69970
  external_exports.string().min(1).default("claude-sonnet-5-5")
69687
69971
  ),
69972
+ /** What a staff haiku override runs (staff-model-override.feature); never a level people pick. */
69973
+ claudeGatewayHaikuModel: c.env(
69974
+ "AGENT_CLAUDE_GATEWAY_HAIKU",
69975
+ external_exports.string().min(1).default("claude-haiku-5-5")
69976
+ ),
69688
69977
  /** `off` turns Claude Code's thinking off on Laze models, for a gateway lane that refuses it. */
69689
69978
  claudeGatewayThinking: c.env(
69690
69979
  "AGENT_CLAUDE_GATEWAY_THINKING",
@@ -70680,11 +70969,11 @@ function errorOf({ status: status11, body }) {
70680
70969
 
70681
70970
  // src/services/machine-report.service.ts
70682
70971
  import { createHash } from "node:crypto";
70683
- import { readFile as readFile3 } from "node:fs/promises";
70972
+ import { readFile as readFile4 } from "node:fs/promises";
70684
70973
  import { hostname as hostname3 } from "node:os";
70685
70974
 
70686
70975
  // src/services/inbox-spool.service.ts
70687
- import { dirname as dirname3, join as join3 } from "node:path";
70976
+ import { dirname as dirname4, join as join4 } from "node:path";
70688
70977
  var PUSH_GRACE_MS = 3 * 6e4;
70689
70978
  var IN_FLIGHT_MS = 35e3;
70690
70979
  function fileNameOf({ profile }) {
@@ -70696,8 +70985,8 @@ function statePathOf({
70696
70985
  profile,
70697
70986
  extension: extension2 = "json"
70698
70987
  }) {
70699
- const directory = join3(dirname3(context.environment.configPath), kind2);
70700
- return join3(directory, `${fileNameOf({ profile })}.${extension2}`);
70988
+ const directory = join4(dirname4(context.environment.configPath), kind2);
70989
+ return join4(directory, `${fileNameOf({ profile })}.${extension2}`);
70701
70990
  }
70702
70991
  async function readSpool({ path }) {
70703
70992
  return await readStateJson({ path }) ?? [];
@@ -70770,7 +71059,7 @@ async function reportMachine({
70770
71059
  if (!host2) return;
70771
71060
  const stamp = createHash("sha256").update(`${token2}:${host2}`).digest("hex");
70772
71061
  const path = statePathOf({ context, kind: "machine", profile });
70773
- const noted = await readFile3(path, "utf8").catch(() => "");
71062
+ const noted = await readFile4(path, "utf8").catch(() => "");
70774
71063
  if (noted === JSON.stringify(stamp) || noted === stamp) return;
70775
71064
  try {
70776
71065
  await client.post("/api/agents/me/machine", { host: host2 });
@@ -70812,7 +71101,7 @@ async function turnTokenOf({ context }) {
70812
71101
  const pinned = env.LAZE_TURN_TOKEN?.trim();
70813
71102
  if (pinned) return pinned;
70814
71103
  if (!env.LAZE_TURN_FILE) return "";
70815
- return readFile4(env.LAZE_TURN_FILE, "utf8").then(
71104
+ return readFile5(env.LAZE_TURN_FILE, "utf8").then(
70816
71105
  (text3) => text3.trim(),
70817
71106
  () => ""
70818
71107
  );
@@ -71112,8 +71401,8 @@ async function copyAgent({
71112
71401
  }
71113
71402
 
71114
71403
  // 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";
71404
+ import { mkdir as mkdir5, readFile as readFile12, writeFile as writeFile3 } from "node:fs/promises";
71405
+ import { join as join20, resolve as resolve5 } from "node:path";
71117
71406
 
71118
71407
  // src/rules/agent-profile.rules.ts
71119
71408
  var HARNESS_NAMES = {
@@ -71206,15 +71495,6 @@ ${lines2.join("\n")}
71206
71495
  `;
71207
71496
  }
71208
71497
 
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
71498
  // src/rules/hook-settings.rules.ts
71219
71499
  var LAZE_HOOK_MARKER = "laze-cli-hook";
71220
71500
  var HOOK_TIMEOUTS = { Stop: 30, PreToolUse: 5, SessionStart: 30 };
@@ -72406,12 +72686,12 @@ function formatSearch({
72406
72686
 
72407
72687
  // src/services/claude-turn.service.ts
72408
72688
  import { rm as rm3 } from "node:fs/promises";
72409
- import { dirname as dirname6, join as join7 } from "node:path";
72689
+ import { dirname as dirname7, join as join8 } from "node:path";
72410
72690
 
72411
72691
  // src/services/harness-session.service.ts
72412
- import { open as open3, readdir as readdir2, readFile as readFile5, stat as stat3 } from "node:fs/promises";
72692
+ import { open as open3, readdir as readdir3, readFile as readFile6, stat as stat3 } from "node:fs/promises";
72413
72693
  import { homedir as homedir2, hostname as hostname4 } from "node:os";
72414
- import { dirname as dirname5, join as join5 } from "node:path";
72694
+ import { dirname as dirname6, join as join6 } from "node:path";
72415
72695
 
72416
72696
  // src/rules/claude-subagent.rules.ts
72417
72697
  function lastCallAtOf({ text: text3, command }) {
@@ -72529,7 +72809,7 @@ function holds({ folder, inner }) {
72529
72809
  const rel = relative2(resolve2(folder), resolve2(inner));
72530
72810
  return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
72531
72811
  }
72532
- async function claudeProjectOf({
72812
+ async function claudeFoldersOf({
72533
72813
  context,
72534
72814
  claudePid
72535
72815
  }) {
@@ -72540,12 +72820,14 @@ async function claudeProjectOf({
72540
72820
  env.CLAUDE_PROJECT_DIR ? resolve2(env.CLAUDE_PROJECT_DIR) : void 0,
72541
72821
  pid > 0 ? await context.processes.cwdOf(pid) : void 0
72542
72822
  ].filter((folder) => Boolean(folder));
72543
- return candidates.find((folder) => holds({ folder, inner: context.cwd })) ?? resolve2(context.cwd);
72823
+ const holding = candidates.find((folder) => holds({ folder, inner: context.cwd }));
72824
+ if (holding) return { folder: holding, elsewhere: void 0 };
72825
+ return { folder: resolve2(context.cwd), elsewhere: candidates[0] };
72544
72826
  }
72545
72827
 
72546
72828
  // 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";
72829
+ import { readdir as readdir2, rm as rm2, stat as stat2 } from "node:fs/promises";
72830
+ import { dirname as dirname5, join as join5 } from "node:path";
72549
72831
  function notePathOf({ context, pid }) {
72550
72832
  return statePathOf({ context, kind: "sessions", profile: String(pid) });
72551
72833
  }
@@ -72592,13 +72874,13 @@ async function sessionNotesOf({
72592
72874
  context,
72593
72875
  tell = true
72594
72876
  }) {
72595
- const folder = dirname4(notePathOf({ context, pid: 1 }));
72596
- const files2 = await readdir(folder).catch(() => []);
72877
+ const folder = dirname5(notePathOf({ context, pid: 1 }));
72878
+ const files2 = await readdir2(folder).catch(() => []);
72597
72879
  const notes = [];
72598
72880
  const dropped = [];
72599
72881
  for (const file4 of files2) {
72600
72882
  const pid = Number(file4.replace(/\.json$/, ""));
72601
- const path = join4(folder, file4);
72883
+ const path = join5(folder, file4);
72602
72884
  const note = pid ? await readStateJson({ path }) : void 0;
72603
72885
  if (!note) continue;
72604
72886
  const standing = await standingOf({ context, pid, note });
@@ -72728,14 +73010,14 @@ async function claudeTranscriptOf({
72728
73010
  sessionId
72729
73011
  }) {
72730
73012
  const inherited = context.environment.inherited;
72731
- const root = join5(
72732
- inherited.CLAUDE_CONFIG_DIR || join5(inherited.HOME || homedir2(), ".claude"),
73013
+ const root = join6(
73014
+ inherited.CLAUDE_CONFIG_DIR || join6(inherited.HOME || homedir2(), ".claude"),
72733
73015
  "projects"
72734
73016
  );
72735
- const folders = await readdir2(root).catch(() => []);
73017
+ const folders = await readdir3(root).catch(() => []);
72736
73018
  const found = await Promise.all(
72737
73019
  folders.map(async (folder) => {
72738
- const path = join5(root, folder, `${sessionId}.jsonl`);
73020
+ const path = join6(root, folder, `${sessionId}.jsonl`);
72739
73021
  return stat3(path).then(
72740
73022
  (info) => info.isFile() ? [{ path, at: info.mtimeMs }] : [],
72741
73023
  () => []
@@ -72763,11 +73045,11 @@ async function runsInSubagent({ context, command }) {
72763
73045
  if (!sessionId) return false;
72764
73046
  const { path } = await claudeTranscriptOf({ context, sessionId });
72765
73047
  if (!path) return false;
72766
- const folder = join5(dirname5(path), sessionId, "subagents");
72767
- const files2 = await readdir2(folder).catch(() => []);
73048
+ const folder = join6(dirname6(path), sessionId, "subagents");
73049
+ const files2 = await readdir3(folder).catch(() => []);
72768
73050
  const subagents = await Promise.all(
72769
73051
  files2.filter((file4) => file4.endsWith(".jsonl")).map(
72770
- async (file4) => lastCallAtOf({ text: await tailOf({ path: join5(folder, file4) }), command })
73052
+ async (file4) => lastCallAtOf({ text: await tailOf({ path: join6(folder, file4) }), command })
72771
73053
  )
72772
73054
  );
72773
73055
  const session = lastCallAtOf({ text: await tailOf({ path }), command });
@@ -72827,7 +73109,7 @@ async function notBoundNotice({
72827
73109
  }
72828
73110
  const key = session ? sessionKeyOf({ session }) : "unknown";
72829
73111
  const path = statePathOf({ context, kind: "told", profile: key });
72830
- const told = await readFile5(path, "utf8").then(
73112
+ const told = await readFile6(path, "utf8").then(
72831
73113
  () => true,
72832
73114
  () => false
72833
73115
  );
@@ -72840,8 +73122,8 @@ async function notBoundNotice({
72840
73122
  }
72841
73123
 
72842
73124
  // src/services/plugin-hook.service.ts
72843
- import { readFile as readFile6 } from "node:fs/promises";
72844
- import { join as join6 } from "node:path";
73125
+ import { readFile as readFile7 } from "node:fs/promises";
73126
+ import { join as join7 } from "node:path";
72845
73127
  async function agentProfileHere({
72846
73128
  context,
72847
73129
  args,
@@ -72862,8 +73144,8 @@ async function agentProfileHere({
72862
73144
  }
72863
73145
  async function projectHooksHere({ context }) {
72864
73146
  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);
73147
+ const path = join7(directory, ".claude", "settings.local.json");
73148
+ return readFile7(path, "utf8").then((text3) => hasLazeHooks({ settings: JSON.parse(text3) })).catch(() => false);
72867
73149
  }
72868
73150
  async function pluginHookArgs({
72869
73151
  context,
@@ -72881,7 +73163,7 @@ async function pluginHookArgs({
72881
73163
  var PRE_TOOL_TIMEOUT_MS = 3e3;
72882
73164
  function statePath({ context, agent: agent3 }) {
72883
73165
  const safe = agent3.replace(/[^a-zA-Z0-9_-]/g, "_");
72884
- return join7(dirname6(context.environment.configPath), "turns", `${safe}.json`);
73166
+ return join8(dirname7(context.environment.configPath), "turns", `${safe}.json`);
72885
73167
  }
72886
73168
  async function readState({ context, agent: agent3 }) {
72887
73169
  return readStateJson({ path: statePath({ context, agent: agent3 }) });
@@ -72994,7 +73276,7 @@ async function preToolHook({ context, args }) {
72994
73276
  }
72995
73277
 
72996
73278
  // src/services/message-files.service.ts
72997
- import { readFile as readFile7, stat as stat4 } from "node:fs/promises";
73279
+ import { readFile as readFile8, stat as stat4 } from "node:fs/promises";
72998
73280
  import { basename as basename4, resolve as resolve3 } from "node:path";
72999
73281
 
73000
73282
  // src/rules/file-types.rules.ts
@@ -73123,7 +73405,7 @@ async function local({ full }) {
73123
73405
  return {
73124
73406
  fileName,
73125
73407
  contentType: contentTypeOf(fileName),
73126
- bytes: new Uint8Array(await readFile7(full))
73408
+ bytes: new Uint8Array(await readFile8(full))
73127
73409
  };
73128
73410
  }
73129
73411
  async function attachmentIdsOf({
@@ -73746,7 +74028,7 @@ function channelLabelIn(channel) {
73746
74028
  }
73747
74029
 
73748
74030
  // src/services/claude-wait.service.ts
73749
- import { readFile as readFile8, rm as rm6 } from "node:fs/promises";
74031
+ import { readFile as readFile9, rm as rm6 } from "node:fs/promises";
73750
74032
 
73751
74033
  // src/rules/listener-retry.rules.ts
73752
74034
  var FIRST_MS = 1e3;
@@ -73785,7 +74067,7 @@ var ListenerBackoff = class {
73785
74067
  // src/services/connect-service.service.ts
73786
74068
  import { createHash as createHash2 } from "node:crypto";
73787
74069
  import { mkdir as mkdir3, rm as rm5, writeFile } from "node:fs/promises";
73788
- import { dirname as dirname12, join as join14 } from "node:path";
74070
+ import { dirname as dirname13, join as join15 } from "node:path";
73789
74071
 
73790
74072
  // src/rules/connect-service.rules.ts
73791
74073
  function systemdWordOf(word3) {
@@ -73909,23 +74191,23 @@ function rolloutEventOf({
73909
74191
  // src/services/connect-delivery.service.ts
73910
74192
  import { rm as rm4, stat as stat5 } from "node:fs/promises";
73911
74193
  import { homedir as homedir3, hostname as hostname5 } from "node:os";
73912
- import { dirname as dirname11, join as join13 } from "node:path";
74194
+ import { dirname as dirname12, join as join14 } from "node:path";
73913
74195
 
73914
74196
  // 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";
74197
+ import { open as open4, readdir as readdir4 } from "node:fs/promises";
74198
+ import { basename as basename5, join as join9 } from "node:path";
73917
74199
  var READ_MS = 1500;
73918
74200
  var KEEP_WORKING_MS = 3e4;
73919
74201
  async function codexRolloutPathOf({
73920
74202
  codexHome,
73921
74203
  threadId
73922
74204
  }) {
73923
- const root = join8(codexHome, "sessions");
73924
- const files2 = await readdir3(root, { recursive: true }).catch(() => []);
74205
+ const root = join9(codexHome, "sessions");
74206
+ const files2 = await readdir4(root, { recursive: true }).catch(() => []);
73925
74207
  const file4 = files2.find(
73926
74208
  (name3) => basename5(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
73927
74209
  );
73928
- return file4 ? join8(root, file4) : void 0;
74210
+ return file4 ? join9(root, file4) : void 0;
73929
74211
  }
73930
74212
  function rolloutPathOf({ delivery }) {
73931
74213
  return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
@@ -74014,7 +74296,7 @@ var CodexTurnWatch = class _CodexTurnWatch {
74014
74296
  };
74015
74297
 
74016
74298
  // src/services/mcp-relay.service.ts
74017
- import { dirname as dirname7, join as join9 } from "node:path";
74299
+ import { dirname as dirname8, join as join10 } from "node:path";
74018
74300
 
74019
74301
  // ../../node_modules/.pnpm/ws@8.21.3_bufferutil@4.1.0/node_modules/ws/wrapper.mjs
74020
74302
  var import_stream = __toESM(require_stream(), 1);
@@ -74350,7 +74632,7 @@ var STOPS = /* @__PURE__ */ new Map([
74350
74632
  [CONNECTOR_RELAY_CLOSE.replaced.code, "another relay for this server took over"]
74351
74633
  ]);
74352
74634
  function mcpRelaysPathOf({ context }) {
74353
- return join9(dirname7(context.environment.configPath), "connect", "mcp-relays.json");
74635
+ return join10(dirname8(context.environment.configPath), "connect", "mcp-relays.json");
74354
74636
  }
74355
74637
  async function readMcpRelays({ context }) {
74356
74638
  return await readStateJson({ path: mcpRelaysPathOf({ context }) }) ?? {};
@@ -74510,7 +74792,7 @@ var McpRelayLoops = class _McpRelayLoops {
74510
74792
  };
74511
74793
 
74512
74794
  // src/services/openclaw-relay.service.ts
74513
- import { dirname as dirname8, join as join10 } from "node:path";
74795
+ import { dirname as dirname9, join as join11 } from "node:path";
74514
74796
 
74515
74797
  // ../../modules/openclaw/contract/src/openclaw.ts
74516
74798
  var workspaceIdSchema18 = external_exports.string().min(1);
@@ -74731,7 +75013,7 @@ var STOPS2 = /* @__PURE__ */ new Map([
74731
75013
  [OPENCLAW_RELAY_CLOSE.replaced.code, "another relay for this gateway took over"]
74732
75014
  ]);
74733
75015
  function relaysPathOf({ context }) {
74734
- return join10(dirname8(context.environment.configPath), "connect", "openclaw-relays.json");
75016
+ return join11(dirname9(context.environment.configPath), "connect", "openclaw-relays.json");
74735
75017
  }
74736
75018
  async function readRelays({ context }) {
74737
75019
  return await readStateJson({ path: relaysPathOf({ context }) }) ?? {};
@@ -74924,7 +75206,7 @@ var RelayLoops = class _RelayLoops {
74924
75206
  };
74925
75207
 
74926
75208
  // src/services/rush-host.service.ts
74927
- import { dirname as dirname9, join as join11 } from "node:path";
75209
+ import { dirname as dirname10, join as join12 } from "node:path";
74928
75210
  async function rushAboveOf({
74929
75211
  context,
74930
75212
  from = context.processes.pid
@@ -74938,7 +75220,7 @@ async function rushAboveOf({
74938
75220
  return void 0;
74939
75221
  }
74940
75222
  function guardPathOf({ context, claudePid }) {
74941
- return join11(dirname9(context.environment.configPath), "rush-guards", `${claudePid}.json`);
75223
+ return join12(dirname10(context.environment.configPath), "rush-guards", `${claudePid}.json`);
74942
75224
  }
74943
75225
  async function startRushGuard({
74944
75226
  context,
@@ -74951,7 +75233,7 @@ async function startRushGuard({
74951
75233
  if (holder && context.processes.alive(holder.pid)) return;
74952
75234
  const flags2 = ["--profile", profile, "--claude-pid", String(claudePid), "--rush-id", rush.id];
74953
75235
  const argv = [...context.program, "hook", "rush-wake", ...flags2, "--rush-program", rush.program];
74954
- const logPath = join11(dirname9(context.environment.configPath), "rush-guards", "guard.log");
75236
+ const logPath = join12(dirname10(context.environment.configPath), "rush-guards", "guard.log");
74955
75237
  context.processes.spawnDetached({ argv: ["sh", "-c", '"$@" &', "sh", ...argv], logPath });
74956
75238
  }
74957
75239
  async function claimRushGuard({
@@ -75069,7 +75351,7 @@ async function rearmRushGuards({ context }) {
75069
75351
 
75070
75352
  // src/services/rush-watchdog.service.ts
75071
75353
  import { appendFile, mkdir as mkdir2 } from "node:fs/promises";
75072
- import { dirname as dirname10, join as join12 } from "node:path";
75354
+ import { dirname as dirname11, join as join13 } from "node:path";
75073
75355
  var UNDELIVERED_AFTER_MS = 6e4;
75074
75356
  var CHECK_TIMEOUT_MS = 5e3;
75075
75357
  function clientOf({ context, profile }) {
@@ -75105,13 +75387,13 @@ function boundAwayOf({ waiting, key }) {
75105
75387
  return `${sessionLabelOf(bound)} (${bound.harness}:${bound.sessionId})`;
75106
75388
  }
75107
75389
  async function logDelivery({ context, line }) {
75108
- const folder = join12(dirname10(context.environment.configPath), "connect");
75390
+ const folder = join13(dirname11(context.environment.configPath), "connect");
75109
75391
  const at = Temporal3.Instant.fromEpochMilliseconds(context.nowMs());
75110
75392
  const stamped = `${at.toString({ smallestUnit: "second" })} ${line}
75111
75393
  `;
75112
75394
  context.out(stamped);
75113
75395
  await mkdir2(folder, { recursive: true, mode: 448 });
75114
- await appendFile(join12(folder, "delivery.log"), stamped, { mode: 384 });
75396
+ await appendFile(join13(folder, "delivery.log"), stamped, { mode: 384 });
75115
75397
  }
75116
75398
  async function claimFor({
75117
75399
  context,
@@ -75187,10 +75469,10 @@ async function watchRushDelivery({
75187
75469
 
75188
75470
  // src/services/connect-delivery.service.ts
75189
75471
  function connectFolderOf({ context }) {
75190
- return join13(dirname11(context.environment.configPath), "connect");
75472
+ return join14(dirname12(context.environment.configPath), "connect");
75191
75473
  }
75192
75474
  function runStatePathOf({ context }) {
75193
- return join13(connectFolderOf({ context }), "run.json");
75475
+ return join14(connectFolderOf({ context }), "run.json");
75194
75476
  }
75195
75477
  async function readJson({ path }) {
75196
75478
  return readStateJson({ path });
@@ -75488,17 +75770,17 @@ var CONNECT_SERVICE_USAGE = `laze connect install|status|stop|uninstall|run: the
75488
75770
  \`laze openclaw connect --local\` and \`laze kanban connect\`, whose relays it also runs.
75489
75771
  `;
75490
75772
  function installedPathOf({ context }) {
75491
- return join14(connectFolderOf({ context }), "service.json");
75773
+ return join15(connectFolderOf({ context }), "service.json");
75492
75774
  }
75493
75775
  function logPathOf({ context }) {
75494
- return join14(connectFolderOf({ context }), "connect.log");
75776
+ return join15(connectFolderOf({ context }), "connect.log");
75495
75777
  }
75496
75778
  function homeOf({ context }) {
75497
- return context.environment.inherited.HOME ?? dirname12(dirname12(context.environment.configPath));
75779
+ return context.environment.inherited.HOME ?? dirname13(dirname13(context.environment.configPath));
75498
75780
  }
75499
75781
  function serviceNameOf({ context }) {
75500
75782
  const { configPath } = context.environment;
75501
- if (configPath === join14(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
75783
+ if (configPath === join15(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
75502
75784
  return `laze-connect-${createHash2("sha256").update(configPath).digest("hex").slice(0, 8)}`;
75503
75785
  }
75504
75786
  function serviceEnvOf({ context }) {
@@ -75521,9 +75803,9 @@ async function run({ context, command }) {
75521
75803
  async function installSystemd({ context }) {
75522
75804
  const name3 = serviceNameOf({ context });
75523
75805
  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 });
75806
+ const base = env.XDG_CONFIG_HOME || join15(homeOf({ context }), ".config");
75807
+ const file4 = join15(base, "systemd", "user", `${name3}.service`);
75808
+ await mkdir3(dirname13(file4), { recursive: true });
75527
75809
  await writeFile(
75528
75810
  file4,
75529
75811
  systemdUnitOf({ argv: runArgvOf({ context }), env: serviceEnvOf({ context }) })
@@ -75537,9 +75819,9 @@ async function installSystemd({ context }) {
75537
75819
  async function installLaunchd({ context }) {
75538
75820
  const name3 = serviceNameOf({ context });
75539
75821
  const label3 = `ai.laze.${name3}`;
75540
- const file4 = join14(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
75822
+ const file4 = join15(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
75541
75823
  const log = logPathOf({ context });
75542
- await mkdir3(dirname12(file4), { recursive: true });
75824
+ await mkdir3(dirname13(file4), { recursive: true });
75543
75825
  await writeFile(
75544
75826
  file4,
75545
75827
  launchAgentOf({
@@ -75910,7 +76192,7 @@ async function waitForMessages({ context, args }) {
75910
76192
  if (rush) await healRushDelivery({ context });
75911
76193
  const lock = statePathOf({ context, kind: "waiters", profile: name3 });
75912
76194
  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("");
76195
+ const seen = () => input2.transcript_path ? readFile9(input2.transcript_path, "utf8") : Promise.resolve("");
75914
76196
  const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
75915
76197
  try {
75916
76198
  const backoff = new ListenerBackoff();
@@ -75961,7 +76243,7 @@ async function refusedOnce({
75961
76243
  }) {
75962
76244
  const profile = String(args.flags.profile ?? "default");
75963
76245
  const path = statePathOf({ context, kind: "told", profile: `refused-${profile}` });
75964
- const told = await readFile8(path, "utf8").then(
76246
+ const told = await readFile9(path, "utf8").then(
75965
76247
  () => true,
75966
76248
  () => false
75967
76249
  );
@@ -76018,14 +76300,14 @@ async function monitorServes({
76018
76300
 
76019
76301
  // src/services/codex-link.service.ts
76020
76302
  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";
76303
+ import { readdir as readdir6, rm as rm8, stat as stat7 } from "node:fs/promises";
76304
+ import { join as join17, resolve as resolve4 } from "node:path";
76023
76305
  import { createInterface as createInterface2 } from "node:readline";
76024
76306
 
76025
76307
  // src/services/codex-adopt.service.ts
76026
76308
  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";
76309
+ import { readdir as readdir5, rm as rm7, stat as stat6 } from "node:fs/promises";
76310
+ import { join as join16 } from "node:path";
76029
76311
  import { createInterface } from "node:readline";
76030
76312
 
76031
76313
  // src/rules/codex-requests.rules.ts
@@ -76145,11 +76427,11 @@ var CodexAppServer = class _CodexAppServer {
76145
76427
  }
76146
76428
  };
76147
76429
  async function newestThreadId({ codexHome }) {
76148
- const root = join15(codexHome, "sessions");
76149
- const files2 = await readdir4(root, { recursive: true }).catch(() => []);
76430
+ const root = join16(codexHome, "sessions");
76431
+ const files2 = await readdir5(root, { recursive: true }).catch(() => []);
76150
76432
  const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
76151
76433
  const dated = await Promise.all(
76152
- rollouts.map(async (file4) => ({ file: file4, at: (await stat6(join15(root, file4))).mtimeMs }))
76434
+ rollouts.map(async (file4) => ({ file: file4, at: (await stat6(join16(root, file4))).mtimeMs }))
76153
76435
  );
76154
76436
  const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
76155
76437
  const id4 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
@@ -76410,13 +76692,13 @@ async function newestThreadIn({
76410
76692
  codexHome,
76411
76693
  directory
76412
76694
  }) {
76413
- const root = join16(codexHome, "sessions");
76414
- const files2 = await readdir5(root, { recursive: true }).catch(() => []);
76695
+ const root = join17(codexHome, "sessions");
76696
+ const files2 = await readdir6(root, { recursive: true }).catch(() => []);
76415
76697
  const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
76416
76698
  const dated = await Promise.all(
76417
76699
  rollouts.map(async (file4) => ({
76418
- path: join16(root, file4),
76419
- at: await stat7(join16(root, file4)).then(
76700
+ path: join17(root, file4),
76701
+ at: await stat7(join17(root, file4)).then(
76420
76702
  (info) => info.mtimeMs,
76421
76703
  () => 0
76422
76704
  )
@@ -76486,16 +76768,16 @@ async function linkCodexSession({
76486
76768
  }
76487
76769
 
76488
76770
  // src/services/laze-plugin.service.ts
76489
- import { mkdir as mkdir4, readFile as readFile9, rm as rm9, writeFile as writeFile2 } from "node:fs/promises";
76771
+ import { mkdir as mkdir4, readFile as readFile10, rm as rm9, writeFile as writeFile2 } from "node:fs/promises";
76490
76772
  import { homedir as homedir4 } from "node:os";
76491
- import { dirname as dirname13, join as join18 } from "node:path";
76773
+ import { dirname as dirname14, join as join19 } from "node:path";
76492
76774
 
76493
76775
  // src/rules/laze-plugin.rules.ts
76494
76776
  import { createHash as createHash3 } from "node:crypto";
76495
- import { join as join17 } from "node:path";
76777
+ import { join as join18 } from "node:path";
76496
76778
  var LAZE_PLUGIN = "laze";
76497
76779
  function pluginNameOf({ configPath, home }) {
76498
- if (configPath === join17(home, ".laze", "config.json")) return LAZE_PLUGIN;
76780
+ if (configPath === join18(home, ".laze", "config.json")) return LAZE_PLUGIN;
76499
76781
  return `${LAZE_PLUGIN}-${createHash3("sha256").update(configPath).digest("hex").slice(0, 8)}`;
76500
76782
  }
76501
76783
  var NPX_CLI = ["npx", "-y", "@lazehq/cli@latest"];
@@ -76743,11 +77025,11 @@ function installedNameOf({ context }) {
76743
77025
  return `${name3}@${name3}`;
76744
77026
  }
76745
77027
  function pluginFolderOf({ context }) {
76746
- return join18(dirname13(context.environment.configPath), "plugins");
77028
+ return join19(dirname14(context.environment.configPath), "plugins");
76747
77029
  }
76748
77030
  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);
77031
+ const manifest = join19(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
77032
+ const written = await readFile10(manifest, "utf8").then((text3) => JSON.parse(text3).version).catch(() => void 0);
76751
77033
  return written === cliVersionOf();
76752
77034
  }
76753
77035
  async function writeLazePlugin({ context }) {
@@ -76759,8 +77041,8 @@ async function writeLazePlugin({ context }) {
76759
77041
  configPath: context.environment.configPath
76760
77042
  });
76761
77043
  for (const [path, text3] of Object.entries(files2)) {
76762
- const target = join18(folder, path);
76763
- await mkdir4(dirname13(target), { recursive: true });
77044
+ const target = join19(folder, path);
77045
+ await mkdir4(dirname14(target), { recursive: true });
76764
77046
  await writeFile2(target, text3);
76765
77047
  }
76766
77048
  return folder;
@@ -76790,7 +77072,7 @@ async function registerWithClaude({ context, folder }) {
76790
77072
  return claudeScript({ context, script });
76791
77073
  }
76792
77074
  function claudeDirOf({ context }) {
76793
- return context.environment.inherited.CLAUDE_CONFIG_DIR || join18(homeOf2({ context }), ".claude");
77075
+ return context.environment.inherited.CLAUDE_CONFIG_DIR || join19(homeOf2({ context }), ".claude");
76794
77076
  }
76795
77077
  function unregisterAs({ context, name: name3 }) {
76796
77078
  const script = [
@@ -76801,8 +77083,8 @@ function unregisterAs({ context, name: name3 }) {
76801
77083
  }
76802
77084
  async function dropOwnLeftover({ context, folder }) {
76803
77085
  if (pluginNameHere({ context }) === LAZE_PLUGIN) return;
76804
- const known = await readFile9(
76805
- join18(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
77086
+ const known = await readFile10(
77087
+ join19(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
76806
77088
  "utf8"
76807
77089
  ).then((text3) => JSON.parse(text3)).catch(() => void 0);
76808
77090
  if (known?.[LAZE_PLUGIN]?.source?.path !== folder) return;
@@ -76810,17 +77092,17 @@ async function dropOwnLeftover({ context, folder }) {
76810
77092
  }
76811
77093
  var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
76812
77094
  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);
77095
+ const path = join19(claudeDirOf({ context }), "plugins", "installed_plugins.json");
77096
+ const listed = await readFile10(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
76815
77097
  return listed?.plugins?.[installedNameOf({ context })]?.[0]?.installPath;
76816
77098
  }
76817
77099
  async function refreshStaleCache({ context, folder }) {
76818
77100
  const cached2 = await cachedPluginOf({ context });
76819
77101
  if (!cached2) return true;
76820
- const read4 = (path) => readFile9(path, "utf8").catch(() => "");
77102
+ const read4 = (path) => readFile10(path, "utf8").catch(() => "");
76821
77103
  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;
77104
+ const ours = await read4(join19(folder, LAZE_PLUGIN, file4));
77105
+ if (ours === await read4(join19(cached2, file4))) continue;
76824
77106
  const plugin2 = installedNameOf({ context });
76825
77107
  const script = [
76826
77108
  `claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
@@ -76831,10 +77113,10 @@ async function refreshStaleCache({ context, folder }) {
76831
77113
  return true;
76832
77114
  }
76833
77115
  function registeredMarkOf({ context }) {
76834
- return join18(pluginFolderOf({ context }), "registered");
77116
+ return join19(pluginFolderOf({ context }), "registered");
76835
77117
  }
76836
77118
  async function pluginRegistered({ context }) {
76837
- return readFile9(registeredMarkOf({ context }), "utf8").then(
77119
+ return readFile10(registeredMarkOf({ context }), "utf8").then(
76838
77120
  () => true,
76839
77121
  () => false
76840
77122
  );
@@ -76849,7 +77131,7 @@ async function installLazePlugin({ context }) {
76849
77131
  async function plugin({ context, args }) {
76850
77132
  const action = args.words[1] ?? "install";
76851
77133
  if (action === "path") {
76852
- context.out(`${join18(pluginFolderOf({ context }), LAZE_PLUGIN)}
77134
+ context.out(`${join19(pluginFolderOf({ context }), LAZE_PLUGIN)}
76853
77135
  `);
76854
77136
  return 0;
76855
77137
  }
@@ -77048,7 +77330,7 @@ async function pushInbox({
77048
77330
  }
77049
77331
 
77050
77332
  // src/services/plugin-tip.service.ts
77051
- import { readFile as readFile10 } from "node:fs/promises";
77333
+ import { readFile as readFile11 } from "node:fs/promises";
77052
77334
  var RELOAD_TIP = "Laze: the Laze plugin is installed in Claude Code, and this session has not loaded it yet. Tell the user once, in one plain line, that it is optional: typing /reload-plugins makes Laze messages arrive right away; until then they still arrive through the hooks.";
77053
77335
  var LINK_RELOAD_TIP = "Tell the user once, in one plain line, that it is optional: typing /reload-plugins makes Laze messages arrive right away; until then they still arrive through the hooks.";
77054
77336
  function monitorsRunHere({ context }) {
@@ -77090,7 +77372,7 @@ async function reloadTipOnce({
77090
77372
  }) {
77091
77373
  if (!session || !monitorsRunHere({ context })) return void 0;
77092
77374
  if (!await pluginRegistered({ context })) return void 0;
77093
- const told = await readFile10(toldPathOf({ context, session }), "utf8").then(
77375
+ const told = await readFile11(toldPathOf({ context, session }), "utf8").then(
77094
77376
  () => true,
77095
77377
  () => false
77096
77378
  );
@@ -77160,9 +77442,9 @@ async function installHooks({
77160
77442
  directory,
77161
77443
  profile
77162
77444
  }) {
77163
- const folder = join19(directory, ".claude");
77164
- const path = join19(folder, "settings.local.json");
77165
- const text3 = await readFile11(path, "utf8").catch(() => "{}");
77445
+ const folder = join20(directory, ".claude");
77446
+ const path = join20(folder, "settings.local.json");
77447
+ const text3 = await readFile12(path, "utf8").catch(() => "{}");
77166
77448
  const current3 = settingsOf({ path, text: text3 });
77167
77449
  const command = (hook) => hookCommand({ program: context.program, profile, hook });
77168
77450
  const settings3 = withLazeHooks({
@@ -77254,6 +77536,7 @@ async function linkAgent({ context, args }) {
77254
77536
  const token2 = flagText({ args, name: "token" });
77255
77537
  if (!token2) throw new CliUsageError("Usage: laze agent link --token <token>");
77256
77538
  await refuseInSubagent({ context, args, command: /\bagent\s+link\b/ });
77539
+ await noteNewerInstall({ context });
77257
77540
  const url2 = serverUrlOf({ context, args });
77258
77541
  const { harness, pid } = await harnessOf2({ context, args });
77259
77542
  const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
@@ -77271,8 +77554,16 @@ async function sessionFolderOf({
77271
77554
  pid
77272
77555
  }) {
77273
77556
  const asked = flagText({ args, name: "project" });
77274
- if (asked) return resolve5(context.cwd, asked);
77275
- return claude ? claudeProjectOf({ context, claudePid: pid }) : context.cwd;
77557
+ if (asked) return { folder: resolve5(context.cwd, asked), elsewhere: void 0 };
77558
+ if (!claude) return { folder: context.cwd, elsewhere: void 0 };
77559
+ return claudeFoldersOf({ context, claudePid: pid });
77560
+ }
77561
+ function elsewhereLinesOf({ folder, elsewhere }) {
77562
+ if (!elsewhere) return [];
77563
+ return [
77564
+ `Claude Code itself runs in ${elsewhere}, not in this folder, so this link is for ${folder}, where you ran it.`,
77565
+ `If ${elsewhere} is the session's folder, link again from there with a new token, or with --project ${elsewhere}.`
77566
+ ];
77276
77567
  }
77277
77568
  async function settleLinked({
77278
77569
  context,
@@ -77288,7 +77579,7 @@ async function settleLinked({
77288
77579
  profiles: (await context.store.read()).profiles
77289
77580
  });
77290
77581
  const claude = harness === "claude-code";
77291
- const directory = await sessionFolderOf({ context, args, claude, pid });
77582
+ const { folder: directory, elsewhere } = await sessionFolderOf({ context, args, claude, pid });
77292
77583
  await context.store.saveProfile({
77293
77584
  name: name3,
77294
77585
  bindDirectory: directory,
@@ -77316,7 +77607,7 @@ async function settleLinked({
77316
77607
  const hooked = claude && !args.flags["no-hook"];
77317
77608
  const hookPath = hooked ? await installHooks({ context, directory, profile: name3 }) : void 0;
77318
77609
  if (hooked) await listenAfterLink({ context, args, profile: name3, claudePid: pid });
77319
- const laze = lazeCommandOf({ program: context.program });
77610
+ const { command: laze, shadow } = await rerunCommandOf({ context });
77320
77611
  const steps = await nextStepsFor({
77321
77612
  context,
77322
77613
  args,
@@ -77330,6 +77621,8 @@ async function settleLinked({
77330
77621
  [
77331
77622
  `Linked as ${linked.agent.name} (${linked.agent.id}), profile "${name3}" for ${directory}.`,
77332
77623
  ...hookPath ? [`Added the Laze hooks to ${hookPath}.`] : [],
77624
+ ...elsewhereLinesOf({ folder: directory, elsewhere }),
77625
+ ...shadowedLinkLineOf({ shadow }),
77333
77626
  "",
77334
77627
  steps,
77335
77628
  ""
@@ -77385,7 +77678,7 @@ async function reportTranscript({
77385
77678
  input: input2
77386
77679
  }) {
77387
77680
  if (!input2.transcript_path || !input2.session_id) return;
77388
- const lines2 = (await readFile11(input2.transcript_path, "utf8")).split("\n");
77681
+ const lines2 = (await readFile12(input2.transcript_path, "utf8")).split("\n");
77389
77682
  const context = readTranscript({ lines: lines2 });
77390
77683
  await client.post("/api/agents/me/activity", {
77391
77684
  sessionId: input2.session_id,
@@ -77424,7 +77717,7 @@ async function handOver({ context, args }) {
77424
77717
  const kept = await dueFromSpool({
77425
77718
  context,
77426
77719
  profile: agent3,
77427
- seen: () => input2.transcript_path ? readFile11(input2.transcript_path, "utf8") : Promise.resolve(""),
77720
+ seen: () => input2.transcript_path ? readFile12(input2.transcript_path, "utf8") : Promise.resolve(""),
77428
77721
  pushedToo: false,
77429
77722
  settledOnly: true
77430
77723
  });
@@ -77465,14 +77758,14 @@ async function addSessionStartWaiter({ context, args }) {
77465
77758
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR;
77466
77759
  const profile = flagText({ args, name: "profile" });
77467
77760
  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);
77761
+ const path = join20(directory, ".claude", "settings.local.json");
77762
+ const settings3 = await readFile12(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
77470
77763
  if (!settings3 || !lacksSessionStartWaiter({ settings: settings3 })) return;
77471
77764
  await installHooks({ context, directory, profile });
77472
77765
  }
77473
77766
  async function refreshPlugin({ context }) {
77474
77767
  if (await pluginIsCurrent({ context })) return;
77475
- const logPath = join19(pluginFolderOf({ context }), "install.log");
77768
+ const logPath = join20(pluginFolderOf({ context }), "install.log");
77476
77769
  context.processes.spawnDetached({ argv: [...context.program, "plugin", "install"], logPath });
77477
77770
  }
77478
77771
  async function stopHook({ context, args }) {
@@ -77493,7 +77786,7 @@ async function stopHook({ context, args }) {
77493
77786
  }
77494
77787
 
77495
77788
  // src/services/agent-manage-commands.service.ts
77496
- import { readFile as readFile12 } from "node:fs/promises";
77789
+ import { readFile as readFile13 } from "node:fs/promises";
77497
77790
  import { extname, resolve as resolve6 } from "node:path";
77498
77791
 
77499
77792
  // src/rules/login-format.rules.ts
@@ -77626,7 +77919,7 @@ async function avatarOf({
77626
77919
  return emoji4;
77627
77920
  }
77628
77921
  if (!path) return void 0;
77629
- const bytes = await readFile12(resolve6(context.cwd, path)).catch(() => {
77922
+ const bytes = await readFile13(resolve6(context.cwd, path)).catch(() => {
77630
77923
  throw new CliUsageError(`laze: cannot read the avatar file ${path}.`);
77631
77924
  });
77632
77925
  const uploaded = await client.post("/api/agents/avatars", {
@@ -78342,8 +78635,8 @@ async function setAgentRunsOn({
78342
78635
  }
78343
78636
 
78344
78637
  // 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";
78638
+ import { readFile as readFile14, stat as stat8 } from "node:fs/promises";
78639
+ import { basename as basename6, join as join21, resolve as resolve7 } from "node:path";
78347
78640
 
78348
78641
  // src/rules/migration-upload.rules.ts
78349
78642
  import { createHash as createHash4 } from "node:crypto";
@@ -78580,7 +78873,7 @@ async function transcriptOf({ context, args, ticket }) {
78580
78873
  if (ticket.source === "codex") {
78581
78874
  const codexHome = context.environment.codexHome;
78582
78875
  const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
78583
- return { sessionId, path: path2, where: join20(codexHome, "sessions") };
78876
+ return { sessionId, path: path2, where: join21(codexHome, "sessions") };
78584
78877
  }
78585
78878
  const { root, path } = await claudeTranscriptOf({ context, sessionId });
78586
78879
  return { sessionId, path, where: root };
@@ -78632,7 +78925,7 @@ async function uploadTranscript({ context, args, client }) {
78632
78925
  `The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
78633
78926
  );
78634
78927
  }
78635
- const raw = await readFile13(found.path, "utf8");
78928
+ const raw = await readFile14(found.path, "utf8");
78636
78929
  if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
78637
78930
  const redacted = await redactTranscript({ text: raw });
78638
78931
  const { parts, truncated } = transcriptPartsOf({
@@ -78890,8 +79183,8 @@ async function requestAgent({ context, args }) {
78890
79183
  }
78891
79184
 
78892
79185
  // 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";
79186
+ import { mkdir as mkdir6, readdir as readdir7, readFile as readFile16, writeFile as writeFile5 } from "node:fs/promises";
79187
+ import { dirname as dirname15, join as join24, relative as relative3, resolve as resolve8, sep as sep3 } from "node:path";
78895
79188
 
78896
79189
  // ../../modules/app/contract/src/app.connections.ts
78897
79190
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -81439,7 +81732,7 @@ async function appPinsCommand({
81439
81732
  import { execFile } from "node:child_process";
81440
81733
  import { mkdtemp, rm as rm11, writeFile as writeFile4 } from "node:fs/promises";
81441
81734
  import { tmpdir } from "node:os";
81442
- import { join as join21 } from "node:path";
81735
+ import { join as join22 } from "node:path";
81443
81736
  import { promisify } from "node:util";
81444
81737
  var run2 = promisify(execFile);
81445
81738
  var MODULE_SYNTAX = /^\s*(import|export)\s/m;
@@ -81468,11 +81761,11 @@ async function scriptErrorsOf({
81468
81761
  const unknown2 = unknownCollectionsOf({ files: files2, collections });
81469
81762
  const scripts = files2.flatMap(scriptsOf);
81470
81763
  if (scripts.length === 0) return unknown2;
81471
- const dir = await mkdtemp(join21(tmpdir(), "laze-app-check-"));
81764
+ const dir = await mkdtemp(join22(tmpdir(), "laze-app-check-"));
81472
81765
  try {
81473
81766
  const errors = await Promise.all(
81474
81767
  scripts.map(async (script, index) => {
81475
- const file4 = join21(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
81768
+ const file4 = join22(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
81476
81769
  await writeFile4(file4, script.code);
81477
81770
  try {
81478
81771
  await run2(process.execPath, ["--check", file4]);
@@ -81490,9 +81783,9 @@ async function scriptErrorsOf({
81490
81783
  }
81491
81784
 
81492
81785
  // src/services/app-serve.service.ts
81493
- import { readFile as readFile14, stat as stat9 } from "node:fs/promises";
81786
+ import { readFile as readFile15, stat as stat9 } from "node:fs/promises";
81494
81787
  import { createServer } from "node:http";
81495
- import { extname as extname2, join as join22, normalize, sep as sep2 } from "node:path";
81788
+ import { extname as extname2, join as join23, normalize, sep as sep2 } from "node:path";
81496
81789
  var TYPES2 = {
81497
81790
  ".html": "text/html; charset=utf-8",
81498
81791
  ".js": "text/javascript; charset=utf-8",
@@ -81543,13 +81836,13 @@ async function staticFile({
81543
81836
  if (clean.startsWith("..") || hidden) {
81544
81837
  return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
81545
81838
  }
81546
- const candidates = [join22(folder, clean), join22(folder, clean, "index.html")];
81547
- if (!extname2(clean)) candidates.push(join22(folder, "index.html"));
81839
+ const candidates = [join23(folder, clean), join23(folder, clean, "index.html")];
81840
+ if (!extname2(clean)) candidates.push(join23(folder, "index.html"));
81548
81841
  for (const target of candidates) {
81549
81842
  const info = await stat9(target).catch(() => void 0);
81550
81843
  if (!info?.isFile()) continue;
81551
81844
  const type = TYPES2[extname2(target).toLowerCase()] ?? "application/octet-stream";
81552
- const body = await readFile14(target);
81845
+ const body = await readFile15(target);
81553
81846
  if (extname2(target) === ".html") {
81554
81847
  return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
81555
81848
  }
@@ -81784,7 +82077,7 @@ async function turnTokenOf2({
81784
82077
  const pinned = env.LAZE_TURN_TOKEN?.trim();
81785
82078
  if (pinned) return pinned;
81786
82079
  if (env.LAZE_TURN_FILE) {
81787
- return readFile15(env.LAZE_TURN_FILE, "utf8").then(
82080
+ return readFile16(env.LAZE_TURN_FILE, "utf8").then(
81788
82081
  (text3) => text3.trim(),
81789
82082
  () => ""
81790
82083
  );
@@ -81814,7 +82107,7 @@ function folderOf({ context, word: word3 }) {
81814
82107
  return resolve8(context.cwd, word3 ?? ".");
81815
82108
  }
81816
82109
  async function readManifest(folder) {
81817
- const text3 = await readFile15(join23(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
82110
+ const text3 = await readFile16(join24(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
81818
82111
  if (text3 === void 0) return void 0;
81819
82112
  const parsed = appManifestSchema.safeParse(JSON.parse(text3));
81820
82113
  if (!parsed.success) {
@@ -81855,7 +82148,7 @@ async function jsonFlag({
81855
82148
  }) {
81856
82149
  const raw = flagText({ args, name: name3 });
81857
82150
  if (!raw) return void 0;
81858
- const text3 = raw.startsWith("@") ? await readFile15(resolve8(context.cwd, raw.slice(1)), "utf8") : raw;
82151
+ const text3 = raw.startsWith("@") ? await readFile16(resolve8(context.cwd, raw.slice(1)), "utf8") : raw;
81859
82152
  try {
81860
82153
  return JSON.parse(text3);
81861
82154
  } catch {
@@ -81867,8 +82160,8 @@ async function listFiles(folder) {
81867
82160
  const pending2 = [folder];
81868
82161
  while (pending2.length > 0 && found.length <= MAX_FILES) {
81869
82162
  const current3 = pending2.pop() ?? folder;
81870
- for (const entry of await readdir6(current3, { withFileTypes: true })) {
81871
- const path = join23(current3, entry.name);
82163
+ for (const entry of await readdir7(current3, { withFileTypes: true })) {
82164
+ const path = join24(current3, entry.name);
81872
82165
  const rel = relative3(folder, path).split(sep3).join("/");
81873
82166
  if (isSkippedPath({ path: rel })) continue;
81874
82167
  if (entry.isDirectory()) pending2.push(path);
@@ -81907,8 +82200,8 @@ var appCreate = async ({ context, args }) => {
81907
82200
  await mkdir6(folder, { recursive: true });
81908
82201
  const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
81909
82202
  for (const file4 of start2?.files ?? []) {
81910
- const target = join23(folder, ...file4.path.split("/"));
81911
- await mkdir6(dirname14(target), { recursive: true });
82203
+ const target = join24(folder, ...file4.path.split("/"));
82204
+ await mkdir6(dirname15(target), { recursive: true });
81912
82205
  await writeFile5(
81913
82206
  target,
81914
82207
  file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
@@ -81920,7 +82213,7 @@ var appCreate = async ({ context, args }) => {
81920
82213
  views: [...start2?.template.views ?? []],
81921
82214
  seed: { ...start2?.template.seed }
81922
82215
  };
81923
- await writeFile5(join23(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
82216
+ await writeFile5(join24(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
81924
82217
  `);
81925
82218
  const where = relative3(context.cwd, folder) || ".";
81926
82219
  print5({
@@ -81992,7 +82285,7 @@ var appPush = async ({ context, args }) => {
81992
82285
  paths.map(
81993
82286
  async (path) => buildFileOf({
81994
82287
  path: relative3(folder, path).split(sep3).join("/"),
81995
- bytes: await readFile15(path)
82288
+ bytes: await readFile16(path)
81996
82289
  })
81997
82290
  )
81998
82291
  );
@@ -82062,7 +82355,7 @@ var appWrite = async ({ context, args }) => {
82062
82355
  const path = resolve8(context.cwd, word3);
82063
82356
  const { bytes: _bytes, ...file4 } = buildFileOf({
82064
82357
  path: relative3(folder, path).split(sep3).join("/"),
82065
- bytes: await readFile15(path)
82358
+ bytes: await readFile16(path)
82066
82359
  });
82067
82360
  return file4;
82068
82361
  })
@@ -82151,7 +82444,7 @@ async function folderClaim({
82151
82444
  folder,
82152
82445
  appId
82153
82446
  }) {
82154
- const entries = await readdir6(folder).catch(() => []);
82447
+ const entries = await readdir7(folder).catch(() => []);
82155
82448
  if (entries.length === 0) return "empty";
82156
82449
  const manifest = await readManifest(folder).catch(() => void 0);
82157
82450
  if (!manifest) return "other-files";
@@ -82189,8 +82482,8 @@ var appPull = async ({ context, args }) => {
82189
82482
  );
82190
82483
  }
82191
82484
  for (const file4 of pulled.files) {
82192
- const target = join23(folder, ...file4.path.split("/"));
82193
- await mkdir6(dirname14(target), { recursive: true });
82485
+ const target = join24(folder, ...file4.path.split("/"));
82486
+ await mkdir6(dirname15(target), { recursive: true });
82194
82487
  await writeFile5(
82195
82488
  target,
82196
82489
  file4.encoding === "base64" ? Buffer.from(file4.content, "base64") : file4.content
@@ -82208,7 +82501,7 @@ var appPull = async ({ context, args }) => {
82208
82501
  ])
82209
82502
  )
82210
82503
  };
82211
- await writeFile5(join23(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
82504
+ await writeFile5(join24(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
82212
82505
  `);
82213
82506
  const names = pulled.collections.map((collection) => collection.name);
82214
82507
  const where = relative3(context.cwd, folder) || ".";
@@ -82523,7 +82816,7 @@ var appImport = async ({ context, args }) => {
82523
82816
  const words = args.words.slice(2);
82524
82817
  const [named, collection, file4] = words.length >= 3 ? words : [void 0, ...words];
82525
82818
  if (!collection || !file4) throw new CliUsageError(USAGE5);
82526
- const csv = await readFile15(resolve8(context.cwd, file4), "utf8").catch(() => {
82819
+ const csv = await readFile16(resolve8(context.cwd, file4), "utf8").catch(() => {
82527
82820
  throw new CliUsageError(`Cannot read ${file4}`);
82528
82821
  });
82529
82822
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
@@ -83389,13 +83682,13 @@ async function billing({ context, args }) {
83389
83682
 
83390
83683
  // src/services/browser-commands.service.ts
83391
83684
  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";
83685
+ import { readFile as readFile18 } from "node:fs/promises";
83686
+ import { dirname as dirname17, join as join27 } from "node:path";
83394
83687
 
83395
83688
  // src/services/browser-tab-commands.service.ts
83396
83689
  import { mkdir as mkdir7, writeFile as writeFile6 } from "node:fs/promises";
83397
83690
  import { tmpdir as tmpdir3 } from "node:os";
83398
- import { join as join25 } from "node:path";
83691
+ import { join as join26 } from "node:path";
83399
83692
 
83400
83693
  // src/rules/browser-login.rules.ts
83401
83694
  var PASSWORD_NAME = /pass|pwd/i;
@@ -83426,9 +83719,9 @@ function loginValuesOf({
83426
83719
 
83427
83720
  // src/services/vault-commands.service.ts
83428
83721
  import { createHash as createHash6 } from "node:crypto";
83429
- import { readFile as readFile16, rm as rm12 } from "node:fs/promises";
83722
+ import { readFile as readFile17, rm as rm12 } from "node:fs/promises";
83430
83723
  import { hostname as hostname7, tmpdir as tmpdir2 } from "node:os";
83431
- import { dirname as dirname15, join as join24 } from "node:path";
83724
+ import { dirname as dirname16, join as join25 } from "node:path";
83432
83725
 
83433
83726
  // src/rules/vault-session.rules.ts
83434
83727
  function vaultSessionOf({
@@ -83493,7 +83786,7 @@ async function turnTokenOf3({
83493
83786
  if (pinned) return pinned;
83494
83787
  if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
83495
83788
  try {
83496
- return (await readFile16(turnFile, "utf8")).trim();
83789
+ return (await readFile17(turnFile, "utf8")).trim();
83497
83790
  } catch {
83498
83791
  throw new CliUsageError(`${command} works only during an agent's turn`);
83499
83792
  }
@@ -83504,8 +83797,8 @@ function runKeyPathOf({
83504
83797
  profile = ""
83505
83798
  }) {
83506
83799
  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`);
83800
+ const base = turnFile ? dirname16(turnFile) : join25(tmpdir2(), "laze-vault", profile);
83801
+ return join25(base, "vault-run-keys", `${name3}.json`);
83509
83802
  }
83510
83803
  async function runKeyAt({ path }) {
83511
83804
  const saved3 = await readStateJson({
@@ -84030,9 +84323,9 @@ async function savedScreenshot({
84030
84323
  data,
84031
84324
  nowMs: nowMs2
84032
84325
  }) {
84033
- const folder = join25(tmpdir3(), "laze-browser");
84326
+ const folder = join26(tmpdir3(), "laze-browser");
84034
84327
  await mkdir7(folder, { recursive: true, mode: 448 });
84035
- const path = join25(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs2}.jpg`);
84328
+ const path = join26(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs2}.jpg`);
84036
84329
  await writeFile6(path, Buffer.from(data, "base64"), { mode: 384 });
84037
84330
  return path;
84038
84331
  }
@@ -84509,7 +84802,7 @@ async function turnTokenOf4({
84509
84802
  const pinned = env.LAZE_TURN_TOKEN?.trim();
84510
84803
  if (pinned) return pinned;
84511
84804
  if (env.LAZE_TURN_FILE) {
84512
- return readFile17(env.LAZE_TURN_FILE, "utf8").then(
84805
+ return readFile18(env.LAZE_TURN_FILE, "utf8").then(
84513
84806
  (text3) => text3.trim(),
84514
84807
  () => ""
84515
84808
  );
@@ -84599,7 +84892,7 @@ async function answering({
84599
84892
  }
84600
84893
  function bridgeStatePath({ context, machine: machine2 }) {
84601
84894
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
84602
- return join26(dirname16(context.environment.configPath), "bridges", `${safe}.json`);
84895
+ return join27(dirname17(context.environment.configPath), "bridges", `${safe}.json`);
84603
84896
  }
84604
84897
  async function bridgePort({
84605
84898
  context,
@@ -85311,13 +85604,13 @@ async function channelSettings({ context, args }) {
85311
85604
  }
85312
85605
 
85313
85606
  // src/services/chat-actions-commands.service.ts
85314
- import { readFile as readFile18 } from "node:fs/promises";
85607
+ import { readFile as readFile19 } from "node:fs/promises";
85315
85608
  import { basename as basename8, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve10 } from "node:path";
85316
85609
 
85317
85610
  // src/services/file-download.service.ts
85318
85611
  import { createWriteStream } from "node:fs";
85319
85612
  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";
85613
+ import { basename as basename7, dirname as dirname18, resolve as resolve9 } from "node:path";
85321
85614
  import { Readable, Transform } from "node:stream";
85322
85615
  import { pipeline } from "node:stream/promises";
85323
85616
  var NOT_READY_WAIT_MS = 5e3;
@@ -85437,8 +85730,8 @@ async function downloadFile({
85437
85730
  out
85438
85731
  }) {
85439
85732
  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 });
85733
+ const part = resolve9(asked ? dirname18(asked) : context.cwd, `.${attachmentId}.part`);
85734
+ await mkdir8(dirname18(part), { recursive: true });
85442
85735
  const named = await fetchWhole({ context, client, attachmentId, part, out }).catch(
85443
85736
  async (error63) => {
85444
85737
  await rm13(part, { force: true });
@@ -85710,7 +86003,7 @@ function uploadNameOf({ cwd, path }) {
85710
86003
  }
85711
86004
  var fileUpload = async ({ context, args, client }) => {
85712
86005
  const path = resolve10(context.cwd, wordAt(args, 3));
85713
- const bytes = new Uint8Array(await readFile18(path));
86006
+ const bytes = new Uint8Array(await readFile19(path));
85714
86007
  const answer6 = await uploadFile({
85715
86008
  context,
85716
86009
  client,
@@ -88150,7 +88443,7 @@ var restSettleComputerCopyInputDefinition = settleComputerCopyInputDefinition.om
88150
88443
  // src/services/computer-copy-commands.service.ts
88151
88444
  import { mkdtemp as mkdtemp2, open as open5, rm as rm15, stat as stat11 } from "node:fs/promises";
88152
88445
  import { tmpdir as tmpdir4 } from "node:os";
88153
- import { basename as basename9, dirname as dirname18, resolve as resolve11 } from "node:path";
88446
+ import { basename as basename9, dirname as dirname19, resolve as resolve11 } from "node:path";
88154
88447
  var COMPUTER_COPY_USAGE = ` laze computer copy <path> --agent <agent> [--to <folder>] [--json]
88155
88448
  copy a local file or folder into your hosted agent's work folder
88156
88449
  (its owner only, up to 2 GiB packed); <folder> is relative to the
@@ -88166,7 +88459,7 @@ function packingOf({ path, isDirectory }) {
88166
88459
  const contents = isDirectory && path.endsWith("/");
88167
88460
  const absolute = resolve11(path);
88168
88461
  const name3 = basename9(absolute);
88169
- return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname18(absolute), entry: name3 };
88462
+ return contents ? { name: name3, parent: absolute, entry: "." } : { name: name3, parent: dirname19(absolute), entry: name3 };
88170
88463
  }
88171
88464
  async function sendParts2({
88172
88465
  context,
@@ -88540,11 +88833,11 @@ async function computer({ context, args }) {
88540
88833
  }
88541
88834
 
88542
88835
  // src/services/connect-commands.service.ts
88543
- import { readFile as readFile20 } from "node:fs/promises";
88836
+ import { readFile as readFile21 } from "node:fs/promises";
88544
88837
 
88545
88838
  // 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";
88839
+ import { mkdir as mkdir9, readFile as readFile20, writeFile as writeFile7 } from "node:fs/promises";
88840
+ import { basename as basename10, join as join28, resolve as resolve12 } from "node:path";
88548
88841
  import { createInterface as createInterface3 } from "node:readline";
88549
88842
  var TURN_HEADER = "x-laze-turn";
88550
88843
  function serveMcpGateway({
@@ -88587,7 +88880,7 @@ async function relayMcpLines({
88587
88880
  const github3 = env.LAZE_GITHUB_CONNECTION;
88588
88881
  const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
88589
88882
  const turnFile = env.LAZE_TURN_FILE;
88590
- const readTurn = () => readFile19(turnFile, "utf8").then(
88883
+ const readTurn = () => readFile20(turnFile, "utf8").then(
88591
88884
  (text3) => text3.trim(),
88592
88885
  () => ""
88593
88886
  );
@@ -88629,8 +88922,8 @@ function safeName(name3, fallback) {
88629
88922
  return last && last !== "." && last !== ".." ? last : fallback;
88630
88923
  }
88631
88924
  async function saveMailFile({ root, file: file4 }) {
88632
- const dir = join27(root, safeName(file4.messageId, "message"));
88633
- const path = join27(dir, safeName(file4.fileName, "attachment"));
88925
+ const dir = join28(root, safeName(file4.messageId, "message"));
88926
+ const path = join28(dir, safeName(file4.fileName, "attachment"));
88634
88927
  await mkdir9(dir, { recursive: true });
88635
88928
  await writeFile7(path, Buffer.from(file4.base64, "base64"));
88636
88929
  return path;
@@ -88749,7 +89042,7 @@ async function turnOf({ context }) {
88749
89042
  const pinned = env.LAZE_TURN_TOKEN?.trim();
88750
89043
  if (pinned) return pinned;
88751
89044
  const file4 = env.LAZE_TURN_FILE;
88752
- const turn = file4 ? await readFile20(file4, "utf8").then(
89045
+ const turn = file4 ? await readFile21(file4, "utf8").then(
88753
89046
  (text3) => text3.trim(),
88754
89047
  () => ""
88755
89048
  ) : "";
@@ -88807,11 +89100,11 @@ async function connect({
88807
89100
  }
88808
89101
 
88809
89102
  // src/services/connector-commands.service.ts
88810
- import { readFile as readFile22 } from "node:fs/promises";
89103
+ import { readFile as readFile23 } from "node:fs/promises";
88811
89104
  import { resolve as resolve13 } from "node:path";
88812
89105
 
88813
89106
  // src/services/vault-keychain-commands.service.ts
88814
- import { readFile as readFile21 } from "node:fs/promises";
89107
+ import { readFile as readFile22 } from "node:fs/promises";
88815
89108
 
88816
89109
  // src/rules/vault-input.rules.ts
88817
89110
  function secondsOf(text3) {
@@ -89229,7 +89522,7 @@ async function secretText({ context, args }) {
89229
89522
  );
89230
89523
  }
89231
89524
  const file4 = flagText({ args, name: "from-file" });
89232
- const text3 = file4 ? await readFile21(file4, "utf8") : await context.readStdin();
89525
+ const text3 = file4 ? await readFile22(file4, "utf8") : await context.readStdin();
89233
89526
  const trimmed = text3.replace(/\r?\n$/, "");
89234
89527
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
89235
89528
  return trimmed;
@@ -89462,7 +89755,7 @@ async function keyText({ context, args }) {
89462
89755
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
89463
89756
  }
89464
89757
  const file4 = flagText({ args, name: "from-file" });
89465
- const text3 = file4 ? await readFile22(resolve13(context.cwd, file4), "utf8") : await context.readStdin();
89758
+ const text3 = file4 ? await readFile23(resolve13(context.cwd, file4), "utf8") : await context.readStdin();
89466
89759
  const trimmed = text3.trim();
89467
89760
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
89468
89761
  return trimmed;
@@ -89783,7 +90076,7 @@ async function conversationDelete({ context, args }) {
89783
90076
  }
89784
90077
 
89785
90078
  // src/services/discord-commands.service.ts
89786
- import { readFile as readFile23 } from "node:fs/promises";
90079
+ import { readFile as readFile24 } from "node:fs/promises";
89787
90080
  import { resolve as resolve14 } from "node:path";
89788
90081
 
89789
90082
  // ../../modules/discord/contract/src/discord.ts
@@ -90131,7 +90424,7 @@ async function secretsOf({ context, args }) {
90131
90424
  const fromConnection = flagText({ args, name: "from-vault" });
90132
90425
  if (fromConnection) return { fromConnection };
90133
90426
  const file4 = flagText({ args, name: "from-file" });
90134
- const text3 = file4 ? await readFile23(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
90427
+ const text3 = file4 ? await readFile24(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
90135
90428
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
90136
90429
  if (lines2.length !== 2) {
90137
90430
  throw new CliUsageError(
@@ -90401,8 +90694,8 @@ var DOMAINS_USAGE = `Usage:
90401
90694
  var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
90402
90695
  `);
90403
90696
  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" : ""}
90697
+ const join36 = row.autoJoin ? "auto-join on" : "auto-join off";
90698
+ context.out(`${row.domain} ${join36}${row.enforced ? " single sign-on enforced" : ""}
90406
90699
  `);
90407
90700
  }
90408
90701
  async function list4({ context, args }) {
@@ -90434,7 +90727,7 @@ async function domains({ context, args }) {
90434
90727
  }
90435
90728
 
90436
90729
  // src/services/emoji-commands.service.ts
90437
- import { readFile as readFile24 } from "node:fs/promises";
90730
+ import { readFile as readFile25 } from "node:fs/promises";
90438
90731
  import { resolve as resolve15 } from "node:path";
90439
90732
  var EMOJI_USAGE = `Usage:
90440
90733
  laze emoji list [--json] the workspace's custom emoji, aliases and who added each
@@ -90475,7 +90768,7 @@ async function addEmoji({ context, args, client }) {
90475
90768
  const file4 = wordAt4(args, 3);
90476
90769
  let bytes;
90477
90770
  try {
90478
- bytes = new Uint8Array(await readFile24(resolve15(context.cwd, file4)));
90771
+ bytes = new Uint8Array(await readFile25(resolve15(context.cwd, file4)));
90479
90772
  } catch {
90480
90773
  throw new CliUsageError(`Cannot read ${file4}.`);
90481
90774
  }
@@ -90791,7 +91084,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
90791
91084
  var ExternalSharingHooksToken = externalUi.hooks("sharing");
90792
91085
 
90793
91086
  // src/services/workspace-commands.service.ts
90794
- import { readFile as readFile25 } from "node:fs/promises";
91087
+ import { readFile as readFile26 } from "node:fs/promises";
90795
91088
  import { resolve as resolve16 } from "node:path";
90796
91089
  var ROLE_NAMES2 = {
90797
91090
  OWNER: "Owner",
@@ -90974,7 +91267,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
90974
91267
  async function readLogo({ context, file: file4 }) {
90975
91268
  let bytes;
90976
91269
  try {
90977
- bytes = new Uint8Array(await readFile25(resolve16(context.cwd, file4)));
91270
+ bytes = new Uint8Array(await readFile26(resolve16(context.cwd, file4)));
90978
91271
  } catch {
90979
91272
  throw new CliUsageError(`No file to read at ${file4}.`);
90980
91273
  }
@@ -91574,7 +91867,7 @@ async function agentFeedAccess({
91574
91867
  }
91575
91868
 
91576
91869
  // src/services/feed-commands.service.ts
91577
- import { readFile as readFile26 } from "node:fs/promises";
91870
+ import { readFile as readFile27 } from "node:fs/promises";
91578
91871
  import { resolve as resolve17 } from "node:path";
91579
91872
 
91580
91873
  // ../../modules/feed/contract/src/feed.delegate.ts
@@ -92680,7 +92973,7 @@ async function feedTurnOf({
92680
92973
  const read4 = async () => {
92681
92974
  const pinned = env.LAZE_TURN_TOKEN?.trim();
92682
92975
  if (pinned) return pinned;
92683
- if (env.LAZE_TURN_FILE) return (await readFile26(env.LAZE_TURN_FILE, "utf8")).trim();
92976
+ if (env.LAZE_TURN_FILE) return (await readFile27(env.LAZE_TURN_FILE, "utf8")).trim();
92684
92977
  return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
92685
92978
  };
92686
92979
  const turn = await read4().catch(() => "");
@@ -92754,7 +93047,7 @@ async function bodyOf2({
92754
93047
  flags: flags2
92755
93048
  }) {
92756
93049
  const body = { ...flags2.fields };
92757
- const read4 = (source) => "file" in source ? readFile26(resolve17(context.cwd, source.file), "utf8") : source.text;
93050
+ const read4 = (source) => "file" in source ? readFile27(resolve17(context.cwd, source.file), "utf8") : source.text;
92758
93051
  for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
92759
93052
  if (flags2.rich) {
92760
93053
  const text3 = await read4(flags2.rich.source);
@@ -93017,7 +93310,7 @@ async function textFlag({
93017
93310
  }) {
93018
93311
  const value = flagText({ args, name: name3 });
93019
93312
  if (!value.startsWith("@")) return value;
93020
- return readFile26(resolve17(context.cwd, value.slice(1)), "utf8");
93313
+ return readFile27(resolve17(context.cwd, value.slice(1)), "utf8");
93021
93314
  }
93022
93315
  async function feedList({ context, args }) {
93023
93316
  const { client } = await signedIn({ context, args });
@@ -93107,7 +93400,7 @@ async function ranksOf({
93107
93400
  }) {
93108
93401
  const file4 = flagText({ args, name: "file" });
93109
93402
  if (file4) {
93110
- const parsed = JSON.parse(await readFile26(resolve17(context.cwd, file4), "utf8"));
93403
+ const parsed = JSON.parse(await readFile27(resolve17(context.cwd, file4), "utf8"));
93111
93404
  if (Array.isArray(parsed)) return parsed;
93112
93405
  throw new CliUsageError("--file holds a list of {itemId, priority}");
93113
93406
  }
@@ -93220,7 +93513,7 @@ async function feed({ context, args }) {
93220
93513
  }
93221
93514
 
93222
93515
  // src/services/github-commands.service.ts
93223
- import { readFile as readFile27 } from "node:fs/promises";
93516
+ import { readFile as readFile28 } from "node:fs/promises";
93224
93517
 
93225
93518
  // src/rules/github-signature.rules.ts
93226
93519
  var TURN_SEPARATOR = "~";
@@ -93290,7 +93583,7 @@ var REAL_GH = "/usr/bin/gh";
93290
93583
  var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Run `laze github request --repo <owner/name>` to post a card that gets it in one click, or its owner runs `laze agent set-github <agent> <connection>`.";
93291
93584
  async function turnFileToken({ env }) {
93292
93585
  if (!env.LAZE_TURN_FILE) return "";
93293
- return readFile27(env.LAZE_TURN_FILE, "utf8").then(
93586
+ return readFile28(env.LAZE_TURN_FILE, "utf8").then(
93294
93587
  (text3) => text3.trim(),
93295
93588
  () => ""
93296
93589
  );
@@ -93324,7 +93617,7 @@ async function githubGh({
93324
93617
  args: args.rest,
93325
93618
  agentName: profile.name ?? "An agent",
93326
93619
  threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
93327
- readBodyFile: (path) => path === "-" ? context.readStdin() : readFile27(path, "utf8")
93620
+ readBodyFile: (path) => path === "-" ? context.readStdin() : readFile28(path, "utf8")
93328
93621
  });
93329
93622
  return context.runCommand({
93330
93623
  command: [REAL_GH, ...ghArgs],
@@ -93934,11 +94227,11 @@ async function ip({ context, args }) {
93934
94227
 
93935
94228
  // src/services/join-commands.service.ts
93936
94229
  import { rm as rm16 } from "node:fs/promises";
93937
- import { dirname as dirname19, join as join28 } from "node:path";
94230
+ import { dirname as dirname20, join as join29 } from "node:path";
93938
94231
  var DEFAULT_WAIT_SECONDS2 = 100;
93939
94232
  var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
93940
94233
  function pendingPathOf({ context }) {
93941
- return join28(dirname19(context.environment.configPath), "join", "pending.json");
94234
+ return join29(dirname20(context.environment.configPath), "join", "pending.json");
93942
94235
  }
93943
94236
  async function readPending({
93944
94237
  context,
@@ -95088,18 +95381,18 @@ async function serveMcp({
95088
95381
  }
95089
95382
 
95090
95383
  // 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";
95384
+ import { readdir as readdir8, readFile as readFile30 } from "node:fs/promises";
95385
+ import { join as join30, resolve as resolve19 } from "node:path";
95093
95386
 
95094
95387
  // 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";
95388
+ import { mkdir as mkdir10, readFile as readFile29, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
95389
+ import { dirname as dirname21, relative as relative5, resolve as resolve18 } from "node:path";
95097
95390
  async function textArgument({
95098
95391
  context,
95099
95392
  value
95100
95393
  }) {
95101
95394
  if (value === "-") return context.readStdin();
95102
- if (value.startsWith("@")) return readFile28(resolve18(context.cwd, value.slice(1)), "utf8");
95395
+ if (value.startsWith("@")) return readFile29(resolve18(context.cwd, value.slice(1)), "utf8");
95103
95396
  return value;
95104
95397
  }
95105
95398
  function turnChannel({ context, args }) {
@@ -95119,7 +95412,7 @@ async function writeMount({
95119
95412
  const inside = relative5(root, target);
95120
95413
  if (!inside || inside.startsWith(".."))
95121
95414
  throw new Error(`Refusing to write outside ${root}: ${file4.path}`);
95122
- await mkdir10(dirname20(target), { recursive: true });
95415
+ await mkdir10(dirname21(target), { recursive: true });
95123
95416
  await writeFile8(target, file4.content);
95124
95417
  }
95125
95418
  return root;
@@ -95246,7 +95539,7 @@ async function turnTokenOf5({ context }) {
95246
95539
  const pinned = env.LAZE_TURN_TOKEN?.trim();
95247
95540
  if (pinned) return pinned;
95248
95541
  if (!env.LAZE_TURN_FILE) return "";
95249
- return readFile29(env.LAZE_TURN_FILE, "utf8").then(
95542
+ return readFile30(env.LAZE_TURN_FILE, "utf8").then(
95250
95543
  (text3) => text3.trim(),
95251
95544
  () => ""
95252
95545
  );
@@ -95376,15 +95669,15 @@ async function siestaImport({
95376
95669
  dir
95377
95670
  }) {
95378
95671
  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(
95672
+ const log = await readFile30(join30(root, "LOG.md"));
95673
+ const names = (await readdir8(join30(root, "tree")).catch(() => [])).filter(
95381
95674
  (name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
95382
95675
  );
95383
95676
  const tree = Object.fromEntries(
95384
95677
  await Promise.all(
95385
95678
  names.map(async (name3) => [
95386
95679
  name3.slice(0, -3),
95387
- (await readFile29(join29(root, "tree", name3))).toString("base64")
95680
+ (await readFile30(join30(root, "tree", name3))).toString("base64")
95388
95681
  ])
95389
95682
  )
95390
95683
  );
@@ -95404,15 +95697,15 @@ async function memoryImport({ context, args }) {
95404
95697
  const dir = flagText({ args, name: "optmem" });
95405
95698
  if (!dir) throw new CliUsageError(USAGE13);
95406
95699
  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(
95700
+ const log = await readFile30(join30(root, "LOG.txt"));
95701
+ const sizes2 = (await readdir8(join30(root, "TREE")).catch(() => [])).filter(
95409
95702
  (name3) => /^\d{1,4}$/.test(name3)
95410
95703
  );
95411
95704
  const tree = Object.fromEntries(
95412
95705
  await Promise.all(
95413
95706
  sizes2.map(async (size) => [
95414
95707
  size,
95415
- (await readFile29(join29(root, "TREE", size))).toString("base64")
95708
+ (await readFile30(join30(root, "TREE", size))).toString("base64")
95416
95709
  ])
95417
95710
  )
95418
95711
  );
@@ -95977,8 +96270,8 @@ async function openclaw({
95977
96270
 
95978
96271
  // src/services/operator-key-commands.service.ts
95979
96272
  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";
96273
+ import { mkdir as mkdir11, readFile as readFile31, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
96274
+ import { dirname as dirname22, join as join31 } from "node:path";
95982
96275
 
95983
96276
  // ../../modules/audit-log/contract/src/audit-log.api.ts
95984
96277
  var auditEntrySchemaDefinition = external_exports.object({
@@ -97349,14 +97642,14 @@ var OPERATOR_KEY_USAGE = `Temporary operator keys (ask, an operator approves wit
97349
97642
  laze ops status <key> waiting, approved or ended
97350
97643
  laze ops use <key> run the approved action and print the answer`;
97351
97644
  var POLL_MS3 = 5e3;
97352
- var keyFile = ({ context, keyId }) => join30(dirname21(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
97645
+ var keyFile = ({ context, keyId }) => join31(dirname22(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
97353
97646
  async function saveSecret({
97354
97647
  context,
97355
97648
  keyId,
97356
97649
  secret
97357
97650
  }) {
97358
97651
  const path = keyFile({ context, keyId });
97359
- await mkdir11(dirname21(path), { recursive: true, mode: 448 });
97652
+ await mkdir11(dirname22(path), { recursive: true, mode: 448 });
97360
97653
  await writeFile9(path, secret, { mode: 384 });
97361
97654
  }
97362
97655
  function typedArg(text3) {
@@ -97450,7 +97743,7 @@ async function useKey({ context, args }) {
97450
97743
  if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
97451
97744
  const { client } = await signedIn({ context, args });
97452
97745
  const path = keyFile({ context, keyId });
97453
- const secret = await readFile30(path, "utf8").catch(() => null);
97746
+ const secret = await readFile31(path, "utf8").catch(() => null);
97454
97747
  if (secret === null) {
97455
97748
  throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
97456
97749
  }
@@ -97515,142 +97808,13 @@ ${OPS_USAGE}`);
97515
97808
  }
97516
97809
 
97517
97810
  // 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
97811
+ import { realpath as realpath2 } from "node:fs/promises";
97812
+ import { dirname as dirname23, join as join32 } from "node:path";
97649
97813
  var RETRY_AFTER_MS = 6 * 60 * 60 * 1e3;
97650
97814
  async function scriptOf(context) {
97651
97815
  const script = context.program.at(-1) ?? "";
97652
97816
  try {
97653
- return await realpath(script);
97817
+ return await realpath2(script);
97654
97818
  } catch {
97655
97819
  return script;
97656
97820
  }
@@ -97662,15 +97826,15 @@ async function startedUpdate({
97662
97826
  if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
97663
97827
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
97664
97828
  if (plan2.kind !== "install") return null;
97665
- const folder = dirname22(context.environment.configPath);
97666
- const stamp = join31(folder, "auto-update.json");
97829
+ const folder = dirname23(context.environment.configPath);
97830
+ const stamp = join32(folder, "auto-update.json");
97667
97831
  const last = await readStateJson({ path: stamp }) ?? null;
97668
97832
  const now = context.nowMs();
97669
97833
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
97670
97834
  await writeStateJson({ path: stamp, value: { server, atMs: now } });
97671
97835
  context.processes.spawnDetached({
97672
97836
  argv: [...context.program, "update"],
97673
- logPath: join31(folder, "auto-update.log")
97837
+ logPath: join32(folder, "auto-update.log")
97674
97838
  });
97675
97839
  return { manager: plan2.manager };
97676
97840
  }
@@ -97963,8 +98127,8 @@ async function schedule({ context, args }) {
97963
98127
  }
97964
98128
 
97965
98129
  // 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";
98130
+ import { readdir as readdir9, readFile as readFile32 } from "node:fs/promises";
98131
+ import { join as join33, relative as relative6, resolve as resolve21 } from "node:path";
97968
98132
  var USAGE17 = `Usage:
97969
98133
  laze skill list [--agent <agentId>]
97970
98134
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -97981,12 +98145,12 @@ var USAGE17 = `Usage:
97981
98145
  --agent names the agent with a person's key; an agent's key works on its own skills.
97982
98146
  With a person's key, list without --agent shows every agent's skills.`;
97983
98147
  async function folderFiles({ root }) {
97984
- const entries = await readdir8(root, { recursive: true, withFileTypes: true });
98148
+ const entries = await readdir9(root, { recursive: true, withFileTypes: true });
97985
98149
  const files2 = [];
97986
98150
  for (const entry of entries) {
97987
98151
  if (!entry.isFile()) continue;
97988
- const full = join32(entry.parentPath, entry.name);
97989
- files2.push({ path: relative6(root, full), content: await readFile31(full, "utf8") });
98152
+ const full = join33(entry.parentPath, entry.name);
98153
+ files2.push({ path: relative6(root, full), content: await readFile32(full, "utf8") });
97990
98154
  }
97991
98155
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
97992
98156
  }
@@ -98084,7 +98248,7 @@ async function skillUpdate({ context, args }) {
98084
98248
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
98085
98249
  throw new CliUsageError(USAGE17);
98086
98250
  }
98087
- const skillMd = skillMdFile ? await readFile31(resolve21(context.cwd, skillMdFile), "utf8") : void 0;
98251
+ const skillMd = skillMdFile ? await readFile32(resolve21(context.cwd, skillMdFile), "utf8") : void 0;
98088
98252
  const { client } = await signedIn({ context, args });
98089
98253
  const updated = await client.post("/api/skills/update", {
98090
98254
  name: name3,
@@ -98130,7 +98294,7 @@ async function skill({ context, args }) {
98130
98294
  }
98131
98295
 
98132
98296
  // src/services/slack-commands.service.ts
98133
- import { readFile as readFile32 } from "node:fs/promises";
98297
+ import { readFile as readFile33 } from "node:fs/promises";
98134
98298
  import { resolve as resolve22 } from "node:path";
98135
98299
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
98136
98300
  laze slack overview connected Slack workspaces, mirrors, your link
@@ -98178,7 +98342,7 @@ async function secretLines({ context, args }) {
98178
98342
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
98179
98343
  }
98180
98344
  const file4 = flagText({ args, name: "from-file" });
98181
- const text3 = file4 ? await readFile32(resolve22(context.cwd, file4), "utf8") : await context.readStdin();
98345
+ const text3 = file4 ? await readFile33(resolve22(context.cwd, file4), "utf8") : await context.readStdin();
98182
98346
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
98183
98347
  }
98184
98348
  async function secretsOf2({
@@ -98482,7 +98646,7 @@ async function slack({
98482
98646
  }
98483
98647
 
98484
98648
  // src/services/sso-commands.service.ts
98485
- import { readFile as readFile33 } from "node:fs/promises";
98649
+ import { readFile as readFile34 } from "node:fs/promises";
98486
98650
  var SSO_USAGE = `Usage:
98487
98651
  laze sso domains claimed domains and how each signs in (admins)
98488
98652
  laze sso claim <domain> the TXT record that proves the domain
@@ -98569,7 +98733,7 @@ function refuseSecretFlags({ args }) {
98569
98733
  }
98570
98734
  async function clientSecretOf({ context, args }) {
98571
98735
  const file4 = flagText({ args, name: "from-file" });
98572
- const text3 = file4 ? await readFile33(file4, "utf8") : await context.readStdin();
98736
+ const text3 = file4 ? await readFile34(file4, "utf8") : await context.readStdin();
98573
98737
  const secret = text3.trim();
98574
98738
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
98575
98739
  return secret;
@@ -98782,14 +98946,14 @@ async function statusUsage() {
98782
98946
  }
98783
98947
 
98784
98948
  // src/services/update-commands.service.ts
98785
- import { realpath as realpath2 } from "node:fs/promises";
98949
+ import { realpath as realpath3 } from "node:fs/promises";
98786
98950
  var BY_HAND = `npm install -g ${CLI_PACKAGE_LATEST}`;
98787
98951
  var REGISTRY_LATEST_URL = `https://registry.npmjs.org/${CLI_PACKAGE}/latest`;
98788
98952
  var REGISTRY_TIMEOUT_MS = 1e4;
98789
98953
  async function realScriptOf({ program }) {
98790
98954
  const script = program.at(-1) ?? "";
98791
98955
  try {
98792
- return await realpath2(script);
98956
+ return await realpath3(script);
98793
98957
  } catch {
98794
98958
  return script;
98795
98959
  }
@@ -98871,6 +99035,14 @@ async function update2({
98871
99035
  `);
98872
99036
  return code;
98873
99037
  }
99038
+ return checkInstalled({ context, plan: plan2, mine: mine4, latest });
99039
+ }
99040
+ async function checkInstalled({
99041
+ context,
99042
+ plan: plan2,
99043
+ mine: mine4,
99044
+ latest
99045
+ }) {
98874
99046
  const printed2 = await printedBy({ context, command: [...context.program, "--version"] });
98875
99047
  const installed = printed2 === null ? null : printedVersionOf({ printed: printed2 });
98876
99048
  if (!installed) {
@@ -98878,14 +99050,18 @@ async function update2({
98878
99050
  return 0;
98879
99051
  }
98880
99052
  const held = latest ? releaseSkewOf({ mine: installed, server: latest }) === "older" : installed === mine4;
99053
+ const { script, onPath } = await otherInstallsOf({ context });
99054
+ const shadowed = shadowedLineOf({ updated: installed, script, onPath });
98881
99055
  if (!held) {
98882
99056
  context.out(
98883
99057
  installed === mine4 ? `laze ${mine4} is the latest release.
98884
99058
  ` : `Updated laze ${mine4} to ${installed}.
98885
99059
  `
98886
99060
  );
99061
+ if (shadowed) context.err(shadowed);
98887
99062
  return 0;
98888
99063
  }
99064
+ if (shadowed) context.err(shadowed);
98889
99065
  const settings3 = await releaseAgeSettingsOf({ context, manager: plan2.manager });
98890
99066
  context.err(
98891
99067
  heldBackLineOf({
@@ -98901,8 +99077,8 @@ async function update2({
98901
99077
  }
98902
99078
 
98903
99079
  // 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";
99080
+ import { readFile as readFile35, stat as stat12 } from "node:fs/promises";
99081
+ import { dirname as dirname24, join as join34, resolve as resolve23 } from "node:path";
98906
99082
 
98907
99083
  // src/rules/vault-manifest.rules.ts
98908
99084
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -99248,9 +99424,9 @@ async function manifestPathOf({
99248
99424
  if (named) return resolve23(context.cwd, named);
99249
99425
  const environment = flagText({ args, name: "env" });
99250
99426
  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;
99427
+ for (let dir = resolve23(context.cwd); ; dir = dirname24(dir)) {
99428
+ if (await isFile(join34(dir, file4))) return join34(dir, file4);
99429
+ if (dirname24(dir) === dir) break;
99254
99430
  }
99255
99431
  throw new CliUsageError(`laze vault: no ${file4} here or in a parent folder
99256
99432
  ${ENV_USAGE}`);
@@ -99260,7 +99436,7 @@ async function manifestOf({
99260
99436
  args
99261
99437
  }) {
99262
99438
  const file4 = await manifestPathOf({ context, args });
99263
- const text3 = await readFile34(file4, "utf8").catch(() => {
99439
+ const text3 = await readFile35(file4, "utf8").catch(() => {
99264
99440
  throw new CliUsageError(`laze vault: cannot read ${file4}`);
99265
99441
  });
99266
99442
  return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
@@ -99575,7 +99751,7 @@ async function vaultScrub({ context, args }) {
99575
99751
  }
99576
99752
 
99577
99753
  // src/services/whatsapp-business-commands.service.ts
99578
- import { readFile as readFile35 } from "node:fs/promises";
99754
+ import { readFile as readFile36 } from "node:fs/promises";
99579
99755
  import { resolve as resolve24 } from "node:path";
99580
99756
 
99581
99757
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
@@ -99995,7 +100171,7 @@ async function secretsOf3({ context, args }) {
99995
100171
  const fromConnection = flagText({ args, name: "from-vault" });
99996
100172
  if (fromConnection) return { fromConnection };
99997
100173
  const file4 = flagText({ args, name: "from-file" });
99998
- const text3 = file4 ? await readFile35(resolve24(context.cwd, file4), "utf8") : await context.readStdin();
100174
+ const text3 = file4 ? await readFile36(resolve24(context.cwd, file4), "utf8") : await context.readStdin();
99999
100175
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
100000
100176
  if (lines2.length !== 2) {
100001
100177
  throw new CliUsageError(
@@ -101080,6 +101256,7 @@ async function runCli({
101080
101256
  if (args.flags.version || args.words.length === 1 && args.words[0] === "version") {
101081
101257
  context.out(`laze ${cliVersionOf()}
101082
101258
  `);
101259
+ await noteNewerInstall({ context });
101083
101260
  return 0;
101084
101261
  }
101085
101262
  const command = commandOf(args);
@@ -101155,8 +101332,8 @@ import {
101155
101332
  randomBytes as randomBytes5,
101156
101333
  sign
101157
101334
  } 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";
101335
+ import { chmod, link, mkdir as mkdir12, readFile as readFile37, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
101336
+ import { dirname as dirname25, join as join35 } from "node:path";
101160
101337
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
101161
101338
  var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve26, reject) => {
101162
101339
  const child = execFile2(
@@ -101196,11 +101373,11 @@ var MachineKeyStore = class _MachineKeyStore {
101196
101373
  });
101197
101374
  }
101198
101375
  get metaPath() {
101199
- return join34(dirname24(this.options.configPath), "machine-key.json");
101376
+ return join35(dirname25(this.options.configPath), "machine-key.json");
101200
101377
  }
101201
101378
  /** Named by the key, so two CLIs making a key at once never overwrite each other's. */
101202
101379
  pemPathOf(jwk) {
101203
- return join34(dirname24(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
101380
+ return join35(dirname25(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
101204
101381
  }
101205
101382
  /** The Keychain item's account: one per config file and key. */
101206
101383
  accountOf(jwk) {
@@ -101228,7 +101405,7 @@ var MachineKeyStore = class _MachineKeyStore {
101228
101405
  async read() {
101229
101406
  let meta3;
101230
101407
  try {
101231
- meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile36(this.metaPath, "utf8")));
101408
+ meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile37(this.metaPath, "utf8")));
101232
101409
  } catch {
101233
101410
  return null;
101234
101411
  }
@@ -101243,7 +101420,7 @@ var MachineKeyStore = class _MachineKeyStore {
101243
101420
  "-w"
101244
101421
  ],
101245
101422
  timeoutMs: 1e4
101246
- }) : await readFile36(this.pemPathOf(meta3.jwk), "utf8");
101423
+ }) : await readFile37(this.pemPathOf(meta3.jwk), "utf8");
101247
101424
  return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
101248
101425
  }
101249
101426
  async make() {
@@ -101327,7 +101504,7 @@ async function writeOnce({ path, text: text3 }) {
101327
101504
  }
101328
101505
  }
101329
101506
  async function writePrivate({ path, text: text3 }) {
101330
- await mkdir12(dirname24(path), { recursive: true, mode: 448 });
101507
+ await mkdir12(dirname25(path), { recursive: true, mode: 448 });
101331
101508
  await writeFile11(path, text3, { mode: 384 });
101332
101509
  await chmod(path, 384);
101333
101510
  }
@@ -101385,8 +101562,8 @@ function machineProofFetch({
101385
101562
  // src/services/processes.service.ts
101386
101563
  import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
101387
101564
  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";
101565
+ import { readFile as readFile38, readlink } from "node:fs/promises";
101566
+ import { dirname as dirname26 } from "node:path";
101390
101567
  import { promisify as promisify2 } from "node:util";
101391
101568
  var run3 = promisify2(execFile3);
101392
101569
  function alive(pid) {
@@ -101399,14 +101576,14 @@ function alive(pid) {
101399
101576
  }
101400
101577
  }
101401
101578
  async function argsOf2(pid) {
101402
- const raw = await readFile37(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
101579
+ const raw = await readFile38(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
101403
101580
  if (raw) return raw.split("\0").filter(Boolean);
101404
101581
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
101405
101582
  const line = listed?.stdout.trim();
101406
101583
  return line ? line.split(/\s+/) : void 0;
101407
101584
  }
101408
101585
  async function parentOf(pid) {
101409
- const stat13 = await readFile37(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
101586
+ const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
101410
101587
  const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
101411
101588
  if (fromStat > 0) return fromStat;
101412
101589
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
@@ -101414,7 +101591,7 @@ async function parentOf(pid) {
101414
101591
  return parent > 0 ? parent : void 0;
101415
101592
  }
101416
101593
  async function startOf(pid) {
101417
- const stat13 = await readFile37(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
101594
+ const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
101418
101595
  const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
101419
101596
  if (ticks) return ticks;
101420
101597
  const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);
@@ -101454,7 +101631,7 @@ function spawnDetached({
101454
101631
  logPath,
101455
101632
  orphan = false
101456
101633
  }) {
101457
- mkdirSync(dirname25(logPath), { recursive: true, mode: 448 });
101634
+ mkdirSync(dirname26(logPath), { recursive: true, mode: 448 });
101458
101635
  keepLogSmall({ logPath });
101459
101636
  const log = openSync(logPath, "a", 384);
101460
101637
  if (orphan) {
@@ -101604,6 +101781,7 @@ if (true) {
101604
101781
  err: (text3) => void process.stderr.write(text3),
101605
101782
  readStdin,
101606
101783
  stdoutIsTerminal: process.stdout.isTTY === true,
101784
+ lazeInstalls: () => scanLazeInstalls({ env: environment.inherited, home: homedir5() }),
101607
101785
  ...ask ? { ask } : {},
101608
101786
  sleep,
101609
101787
  nowMs: nowMs2,