@lazehq/cli 0.1.132 → 0.1.134

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 +320 -238
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -19486,7 +19486,7 @@ 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: readFile39, mkdir: mkdir14 } = __require("node:fs/promises");
19489
+ var { writeFile: writeFile12, readFile: readFile40, mkdir: mkdir14 } = __require("node:fs/promises");
19490
19490
  var { dirname: dirname29, resolve: resolve27 } = __require("node:path");
19491
19491
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
19492
19492
  var { InvalidArgumentError, UndiciError } = require_errors();
@@ -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 readFile39(resolve27(path), "utf8");
19706
+ const data = await readFile40(resolve27(path), "utf8");
19707
19707
  const parsed = JSON.parse(data);
19708
19708
  if (Array.isArray(parsed)) {
19709
19709
  this.#snapshots.clear();
@@ -20951,17 +20951,17 @@ var require_dns = __commonJS({
20951
20951
  const timestamp = Date.now();
20952
20952
  const records = { records: { 4: null, 6: null } };
20953
20953
  let minTTL = this.#maxTTL;
20954
- for (const record4 of addresses) {
20955
- record4.timestamp = timestamp;
20956
- if (typeof record4.ttl === "number") {
20957
- record4.ttl = Math.min(record4.ttl, this.#maxTTL);
20958
- minTTL = Math.min(minTTL, record4.ttl);
20954
+ for (const record5 of addresses) {
20955
+ record5.timestamp = timestamp;
20956
+ if (typeof record5.ttl === "number") {
20957
+ record5.ttl = Math.min(record5.ttl, this.#maxTTL);
20958
+ minTTL = Math.min(minTTL, record5.ttl);
20959
20959
  } else {
20960
- record4.ttl = this.#maxTTL;
20960
+ record5.ttl = this.#maxTTL;
20961
20961
  }
20962
- const familyRecords = records.records[record4.family] ?? { ips: [] };
20963
- familyRecords.ips.push(record4);
20964
- records.records[record4.family] = familyRecords;
20962
+ const familyRecords = records.records[record5.family] ?? { ips: [] };
20963
+ familyRecords.ips.push(record5);
20964
+ records.records[record5.family] = familyRecords;
20965
20965
  }
20966
20966
  this.storage.set(origin.hostname, records, { ttl: minTTL });
20967
20967
  }
@@ -31632,7 +31632,7 @@ ${captureLines}` : capture.stack;
31632
31632
  });
31633
31633
 
31634
31634
  // src/main.ts
31635
- import { homedir as homedir5 } from "node:os";
31635
+ import { homedir as homedir6 } from "node:os";
31636
31636
  import { stderr, stdin, stdout } from "node:process";
31637
31637
  import { createInterface as createInterface4 } from "node:readline/promises";
31638
31638
 
@@ -32569,10 +32569,10 @@ var JSONL_STRUCTURAL_KEYS = /* @__PURE__ */ new Set([
32569
32569
  "originator",
32570
32570
  "cli_version"
32571
32571
  ]);
32572
- function recordSlotsOf(record4, into) {
32573
- for (const [key, item] of Object.entries(record4)) {
32572
+ function recordSlotsOf(record5, into) {
32573
+ for (const [key, item] of Object.entries(record5)) {
32574
32574
  if (typeof item !== "string") slotsOf(item, into);
32575
- else if (!JSONL_STRUCTURAL_KEYS.has(key)) into.push({ holder: record4, key });
32575
+ else if (!JSONL_STRUCTURAL_KEYS.has(key)) into.push({ holder: record5, key });
32576
32576
  }
32577
32577
  }
32578
32578
  function slotsOf(value, into) {
@@ -34718,10 +34718,10 @@ var queryTimeZoneIntlFormat = /* @__PURE__ */ memoize((upperNormId) => new RawDa
34718
34718
  second: "numeric"
34719
34719
  }));
34720
34720
  function queryTimeZone(rawTimeZoneId) {
34721
- const record4 = resolveTimeZoneRecord(rawTimeZoneId);
34722
- return queryTimeZoneRecord(record4.id, record4);
34721
+ const record5 = resolveTimeZoneRecord(rawTimeZoneId);
34722
+ return queryTimeZoneRecord(record5.id, record5);
34723
34723
  }
34724
- var queryTimeZoneRecord = /* @__PURE__ */ memoize((normTimeZoneId, record4) => "named" === record4.kind ? new IntlTimeZone(normTimeZoneId, record4.m, record4.format) : new FixedTimeZone(normTimeZoneId, record4.m, "fixed" === record4.kind ? record4.X : 0));
34724
+ var queryTimeZoneRecord = /* @__PURE__ */ memoize((normTimeZoneId, record5) => "named" === record5.kind ? new IntlTimeZone(normTimeZoneId, record5.m, record5.format) : new FixedTimeZone(normTimeZoneId, record5.m, "fixed" === record5.kind ? record5.X : 0));
34725
34725
  var FixedTimeZone = class {
34726
34726
  constructor(id8, compareKey, offsetNano) {
34727
34727
  this.id = id8, this.m = compareKey, this.X = offsetNano;
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
36960
36960
  }
36961
36961
 
36962
36962
  // src/rules/cli-version.rules.ts
36963
- var STAMPED = "0.1.132";
36963
+ var STAMPED = "0.1.134";
36964
36964
  function cliVersionOf({ stamped = STAMPED } = {}) {
36965
36965
  return stamped.startsWith("__") ? "dev" : stamped;
36966
36966
  }
@@ -37286,6 +37286,11 @@ var ConfigStore = class _ConfigStore {
37286
37286
  static create({ path }) {
37287
37287
  return new _ConfigStore(path);
37288
37288
  }
37289
+ /** How a login names its profile to Laze: `name`, or `<file>:name` for another config file. */
37290
+ loginProfileOf({ name: name3 }) {
37291
+ const file4 = basename2(this.path);
37292
+ return (file4 === "config.json" ? name3 : `${file4}:${name3}`).slice(0, 80);
37293
+ }
37289
37294
  async read() {
37290
37295
  const text3 = await readFile3(this.path, "utf8").catch((error63) => {
37291
37296
  if (error63.code === "ENOENT") return void 0;
@@ -54229,8 +54234,8 @@ function rewriteKeyNames(ctx) {
54229
54234
  bySchema.set(entry2.schema, entry2);
54230
54235
  }
54231
54236
  const rewrites = /* @__PURE__ */ new Map();
54232
- for (const record4 of pendingRecords.get(ctx) ?? []) {
54233
- const seen = ctx.seen.get(record4);
54237
+ for (const record5 of pendingRecords.get(ctx) ?? []) {
54238
+ const seen = ctx.seen.get(record5);
54234
54239
  const names = (seen?.def ?? seen?.schema)?.propertyNames;
54235
54240
  if (!names || names === true || rewrites.has(names))
54236
54241
  continue;
@@ -59793,7 +59798,9 @@ var startDeviceGrantInputSchemaDefinition = external_exports.object({
59793
59798
  /** What the CLI calls itself on the approval page, such as "laze on build-box". */
59794
59799
  clientName: external_exports.string().trim().min(1).max(80).default("laze CLI"),
59795
59800
  /** The machine key the CLI made; the key it receives is bound to it. */
59796
- machineKey: machineKeyRegistrationSchema.optional()
59801
+ machineKey: machineKeyRegistrationSchema.optional(),
59802
+ /** The CLI profile signing in; a later login of that profile on this machine replaces the key. */
59803
+ profile: external_exports.string().trim().min(1).max(80).optional()
59797
59804
  });
59798
59805
  var startedDeviceGrantSchemaDefinition = external_exports.object({
59799
59806
  /** Eight characters the person sees and the approval page asks for. */
@@ -70738,6 +70745,8 @@ var harnessLoginEntrySchemaDefinition = external_exports.object({
70738
70745
  checkedAt: external_exports.iso.datetime().nullable(),
70739
70746
  /** The agents running on this login now. */
70740
70747
  agentsOnIt: external_exports.number().int().nonnegative(),
70748
+ /** Their names, so two logins in use say which agents each one serves. */
70749
+ agentNames: external_exports.array(external_exports.string()).optional(),
70741
70750
  /** `computer`: signed in on the person's own Laze computer, which keeps the token. */
70742
70751
  source: external_exports.enum(["keychain", "computer"]).optional()
70743
70752
  });
@@ -73641,9 +73650,9 @@ function apiErrorOf({ status: status11, text: text3 }) {
73641
73650
  return errorOf({ status: status11, body });
73642
73651
  }
73643
73652
  function errorOf({ status: status11, body }) {
73644
- const record4 = typeof body === "object" && body !== null ? body : {};
73645
- const nested = typeof record4.error === "object" && record4.error !== null ? record4.error : record4;
73646
- const fallback = typeof record4.error === "string" ? record4.error : `http_${status11}`;
73653
+ const record5 = typeof body === "object" && body !== null ? body : {};
73654
+ const nested = typeof record5.error === "object" && record5.error !== null ? record5.error : record5;
73655
+ const fallback = typeof record5.error === "string" ? record5.error : `http_${status11}`;
73647
73656
  const code4 = typeof nested.code === "string" ? nested.code : fallback;
73648
73657
  const message2 = typeof nested.message === "string" ? nested.message : `Laze answered ${status11}`;
73649
73658
  const meta3 = typeof nested.meta === "object" && nested.meta !== null ? nested.meta : void 0;
@@ -74147,8 +74156,8 @@ async function copyAgent({
74147
74156
  }
74148
74157
 
74149
74158
  // src/services/agent-commands.service.ts
74150
- import { mkdir as mkdir6, readFile as readFile12, writeFile as writeFile3 } from "node:fs/promises";
74151
- import { join as join22, resolve as resolve4 } from "node:path";
74159
+ import { mkdir as mkdir6, readFile as readFile13, writeFile as writeFile3 } from "node:fs/promises";
74160
+ import { join as join23, resolve as resolve4 } from "node:path";
74152
74161
 
74153
74162
  // src/rules/link-format.rules.ts
74154
74163
  function linkOf({ url: url2, base }) {
@@ -74330,8 +74339,23 @@ function parse3(line) {
74330
74339
  return void 0;
74331
74340
  }
74332
74341
  }
74342
+ var STANDARD_WINDOW = 2e5;
74343
+ var LONG_WINDOW = 1e6;
74333
74344
  function contextWindowOf({ model }) {
74334
- return /\[1m\]|-1m\b/i.test(model) ? 1e6 : 2e5;
74345
+ return /\[1m\]|-1m\b/i.test(model) ? LONG_WINDOW : STANDARD_WINDOW;
74346
+ }
74347
+ function windowOf({
74348
+ run: run4,
74349
+ model,
74350
+ largest,
74351
+ tokens
74352
+ }) {
74353
+ const named = run4.model ?? model;
74354
+ if (named === void 0 && largest <= STANDARD_WINDOW) return void 0;
74355
+ let window2 = named === void 0 ? STANDARD_WINDOW : contextWindowOf({ model: named });
74356
+ if (largest > STANDARD_WINDOW) window2 = LONG_WINDOW;
74357
+ if (run4.compactWindow) window2 = Math.min(window2, run4.compactWindow);
74358
+ return tokens !== void 0 && tokens > window2 ? void 0 : window2;
74335
74359
  }
74336
74360
  function compactionOf({
74337
74361
  entry: entry2,
@@ -74357,9 +74381,13 @@ function usageOf({ entry: entry2 }) {
74357
74381
  ...typeof message2.model === "string" ? { model: message2.model } : {}
74358
74382
  };
74359
74383
  }
74360
- function readTranscript({ lines: lines2 }) {
74384
+ function readTranscript({
74385
+ lines: lines2,
74386
+ run: run4 = {}
74387
+ }) {
74361
74388
  let contextTokens;
74362
- let contextWindow;
74389
+ let model;
74390
+ let largest = 0;
74363
74391
  const compactions = [];
74364
74392
  for (const line of lines2) {
74365
74393
  const entry2 = parse3(line);
@@ -74367,14 +74395,17 @@ function readTranscript({ lines: lines2 }) {
74367
74395
  if (entry2.type === "system" && entry2.subtype === "compact_boundary") {
74368
74396
  const compaction = compactionOf({ entry: entry2, index: compactions.length });
74369
74397
  compactions.push(compaction);
74398
+ largest = Math.max(largest, compaction.tokensBefore ?? 0);
74370
74399
  contextTokens = compaction.tokensAfter ?? contextTokens;
74371
74400
  continue;
74372
74401
  }
74373
74402
  const usage2 = entry2.type === "assistant" ? usageOf({ entry: entry2 }) : void 0;
74374
74403
  if (!usage2) continue;
74375
74404
  contextTokens = usage2.tokens;
74376
- if (usage2.model) contextWindow = contextWindowOf({ model: usage2.model });
74405
+ largest = Math.max(largest, usage2.tokens);
74406
+ if (usage2.model) model = usage2.model;
74377
74407
  }
74408
+ const contextWindow = windowOf({ run: run4, model, largest, tokens: contextTokens });
74378
74409
  return { contextTokens, contextWindow, compactions };
74379
74410
  }
74380
74411
 
@@ -76942,8 +76973,54 @@ function channelLabelIn(channel) {
76942
76973
  return `#${channel.name}`;
76943
76974
  }
76944
76975
 
76976
+ // src/services/claude-run.service.ts
76977
+ import { readFile as readFile9 } from "node:fs/promises";
76978
+ import { homedir as homedir3 } from "node:os";
76979
+ import { join as join12 } from "node:path";
76980
+ function record3(value) {
76981
+ return typeof value === "object" && value !== null ? value : {};
76982
+ }
76983
+ async function settingsOf({ path }) {
76984
+ try {
76985
+ return record3(JSON.parse(await readFile9(path, "utf8")));
76986
+ } catch {
76987
+ return {};
76988
+ }
76989
+ }
76990
+ function windowOf2(value) {
76991
+ const tokens = Number(value);
76992
+ return Number.isInteger(tokens) && tokens > 0 ? tokens : void 0;
76993
+ }
76994
+ function modelFlagOf(args) {
76995
+ const at8 = args?.indexOf("--model") ?? -1;
76996
+ if (at8 >= 0) return args?.[at8 + 1];
76997
+ return args?.find((arg) => arg.startsWith("--model="))?.slice("--model=".length);
76998
+ }
76999
+ async function claudeRunOf({
77000
+ context,
77001
+ folder,
77002
+ claudePid
77003
+ }) {
77004
+ const env = context.environment.inherited;
77005
+ const user = env.CLAUDE_CONFIG_DIR || join12(env.HOME || homedir3(), ".claude");
77006
+ const files2 = await Promise.all(
77007
+ [
77008
+ join12(folder, ".claude", "settings.local.json"),
77009
+ join12(folder, ".claude", "settings.json"),
77010
+ join12(user, "settings.json")
77011
+ ].map((path) => settingsOf({ path }))
77012
+ );
77013
+ const args = claudePid > 0 ? await context.processes.argsOf(claudePid) : void 0;
77014
+ const model = env.ANTHROPIC_MODEL || modelFlagOf(args) || files2.map((file4) => file4.model).find((value) => typeof value === "string");
77015
+ const compactWindow = windowOf2(env.CLAUDE_CODE_AUTO_COMPACT_WINDOW) ?? files2.map((file4) => windowOf2(record3(file4.env).CLAUDE_CODE_AUTO_COMPACT_WINDOW)).find(Boolean);
77016
+ return {
77017
+ ...model ? { model } : {},
77018
+ ...compactWindow ? { compactWindow } : {}
77019
+ };
77020
+ }
77021
+
76945
77022
  // src/services/claude-wait.service.ts
76946
- import { readFile as readFile9, rm as rm6 } from "node:fs/promises";
77023
+ import { readFile as readFile10, rm as rm6 } from "node:fs/promises";
76947
77024
 
76948
77025
  // src/rules/listener-retry.rules.ts
76949
77026
  var FIRST_MS = 1e3;
@@ -76982,7 +77059,7 @@ var ListenerBackoff = class {
76982
77059
  // src/services/connect-service.service.ts
76983
77060
  import { createHash as createHash3 } from "node:crypto";
76984
77061
  import { mkdir as mkdir3, rm as rm5, writeFile } from "node:fs/promises";
76985
- import { dirname as dirname14, join as join17 } from "node:path";
77062
+ import { dirname as dirname14, join as join18 } from "node:path";
76986
77063
 
76987
77064
  // src/rules/connect-service.rules.ts
76988
77065
  function systemdWordOf(word3) {
@@ -77091,24 +77168,24 @@ function rolloutEventOf({
77091
77168
 
77092
77169
  // src/services/connect-delivery.service.ts
77093
77170
  import { rm as rm4, stat as stat5 } from "node:fs/promises";
77094
- import { homedir as homedir3, hostname as hostname6 } from "node:os";
77095
- import { dirname as dirname13, join as join16 } from "node:path";
77171
+ import { homedir as homedir4, hostname as hostname6 } from "node:os";
77172
+ import { dirname as dirname13, join as join17 } from "node:path";
77096
77173
 
77097
77174
  // src/services/codex-turn-watch.service.ts
77098
77175
  import { open as open4, readdir as readdir4 } from "node:fs/promises";
77099
- import { basename as basename5, join as join12 } from "node:path";
77176
+ import { basename as basename5, join as join13 } from "node:path";
77100
77177
  var READ_MS = 1500;
77101
77178
  var KEEP_WORKING_MS = 3e4;
77102
77179
  async function codexRolloutPathOf({
77103
77180
  codexHome,
77104
77181
  threadId
77105
77182
  }) {
77106
- const root = join12(codexHome, "sessions");
77183
+ const root = join13(codexHome, "sessions");
77107
77184
  const files2 = await readdir4(root, { recursive: true }).catch(() => []);
77108
77185
  const file4 = files2.find(
77109
77186
  (name3) => basename5(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
77110
77187
  );
77111
- return file4 ? join12(root, file4) : void 0;
77188
+ return file4 ? join13(root, file4) : void 0;
77112
77189
  }
77113
77190
  function rolloutPathOf({ delivery }) {
77114
77191
  return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
@@ -77197,7 +77274,7 @@ var CodexTurnWatch = class _CodexTurnWatch {
77197
77274
  };
77198
77275
 
77199
77276
  // src/services/mcp-relay.service.ts
77200
- import { dirname as dirname10, join as join13 } from "node:path";
77277
+ import { dirname as dirname10, join as join14 } from "node:path";
77201
77278
 
77202
77279
  // ../../node_modules/.pnpm/ws@8.21.3_bufferutil@4.1.0/node_modules/ws/wrapper.mjs
77203
77280
  var import_stream = __toESM(require_stream(), 1);
@@ -77533,7 +77610,7 @@ var STOPS = /* @__PURE__ */ new Map([
77533
77610
  [CONNECTOR_RELAY_CLOSE.replaced.code, "another relay for this server took over"]
77534
77611
  ]);
77535
77612
  function mcpRelaysPathOf({ context }) {
77536
- return join13(dirname10(context.environment.configPath), "connect", "mcp-relays.json");
77613
+ return join14(dirname10(context.environment.configPath), "connect", "mcp-relays.json");
77537
77614
  }
77538
77615
  async function readMcpRelays({ context }) {
77539
77616
  return await readStateJson({ path: mcpRelaysPathOf({ context }) }) ?? {};
@@ -77693,7 +77770,7 @@ var McpRelayLoops = class _McpRelayLoops {
77693
77770
  };
77694
77771
 
77695
77772
  // src/services/openclaw-relay.service.ts
77696
- import { dirname as dirname11, join as join14 } from "node:path";
77773
+ import { dirname as dirname11, join as join15 } from "node:path";
77697
77774
 
77698
77775
  // ../../modules/openclaw/contract/src/openclaw.ts
77699
77776
  var workspaceIdSchema18 = external_exports.string().min(1);
@@ -77914,7 +77991,7 @@ var STOPS2 = /* @__PURE__ */ new Map([
77914
77991
  [OPENCLAW_RELAY_CLOSE.replaced.code, "another relay for this gateway took over"]
77915
77992
  ]);
77916
77993
  function relaysPathOf({ context }) {
77917
- return join14(dirname11(context.environment.configPath), "connect", "openclaw-relays.json");
77994
+ return join15(dirname11(context.environment.configPath), "connect", "openclaw-relays.json");
77918
77995
  }
77919
77996
  async function readRelays({ context }) {
77920
77997
  return await readStateJson({ path: relaysPathOf({ context }) }) ?? {};
@@ -78107,7 +78184,7 @@ var RelayLoops = class _RelayLoops {
78107
78184
  };
78108
78185
 
78109
78186
  // src/services/rush-host.service.ts
78110
- import { dirname as dirname12, join as join15 } from "node:path";
78187
+ import { dirname as dirname12, join as join16 } from "node:path";
78111
78188
  async function rushAboveOf({
78112
78189
  context,
78113
78190
  from = context.processes.pid
@@ -78121,7 +78198,7 @@ async function rushAboveOf({
78121
78198
  return void 0;
78122
78199
  }
78123
78200
  function guardPathOf({ context, claudePid }) {
78124
- return join15(dirname12(context.environment.configPath), "rush-guards", `${claudePid}.json`);
78201
+ return join16(dirname12(context.environment.configPath), "rush-guards", `${claudePid}.json`);
78125
78202
  }
78126
78203
  async function startRushGuard({
78127
78204
  context,
@@ -78134,7 +78211,7 @@ async function startRushGuard({
78134
78211
  if (holder && context.processes.alive(holder.pid)) return;
78135
78212
  const flags2 = ["--profile", profile, "--claude-pid", String(claudePid), "--rush-id", rush.id];
78136
78213
  const argv = [...context.program, "hook", "rush-wake", ...flags2, "--rush-program", rush.program];
78137
- const logPath = join15(dirname12(context.environment.configPath), "rush-guards", "guard.log");
78214
+ const logPath = join16(dirname12(context.environment.configPath), "rush-guards", "guard.log");
78138
78215
  context.processes.spawnDetached({ argv: ["sh", "-c", '"$@" &', "sh", ...argv], logPath });
78139
78216
  }
78140
78217
  async function claimRushGuard({
@@ -78358,10 +78435,10 @@ async function watchRushDelivery({
78358
78435
 
78359
78436
  // src/services/connect-delivery.service.ts
78360
78437
  function connectFolderOf({ context }) {
78361
- return join16(dirname13(context.environment.configPath), "connect");
78438
+ return join17(dirname13(context.environment.configPath), "connect");
78362
78439
  }
78363
78440
  function runStatePathOf({ context }) {
78364
- return join16(connectFolderOf({ context }), "run.json");
78441
+ return join17(connectFolderOf({ context }), "run.json");
78365
78442
  }
78366
78443
  async function readJson({ path }) {
78367
78444
  return readStateJson({ path });
@@ -78418,7 +78495,7 @@ async function takeRound({
78418
78495
  const session = {
78419
78496
  harness: "codex",
78420
78497
  sessionId: delivery.threadId,
78421
- folder: displayFolderOf({ folder: delivery.cwd, home: homedir3() }),
78498
+ folder: displayFolderOf({ folder: delivery.cwd, home: homedir4() }),
78422
78499
  host: hostname6()
78423
78500
  };
78424
78501
  try {
@@ -78659,17 +78736,17 @@ var CONNECT_SERVICE_USAGE = `laze connect install|status|stop|uninstall|run: the
78659
78736
  \`laze openclaw connect --local\` and \`laze kanban connect\`, whose relays it also runs.
78660
78737
  `;
78661
78738
  function installedPathOf({ context }) {
78662
- return join17(connectFolderOf({ context }), "service.json");
78739
+ return join18(connectFolderOf({ context }), "service.json");
78663
78740
  }
78664
78741
  function logPathOf({ context }) {
78665
- return join17(connectFolderOf({ context }), "connect.log");
78742
+ return join18(connectFolderOf({ context }), "connect.log");
78666
78743
  }
78667
78744
  function homeOf({ context }) {
78668
78745
  return context.environment.inherited.HOME ?? dirname14(dirname14(context.environment.configPath));
78669
78746
  }
78670
78747
  function serviceNameOf({ context }) {
78671
78748
  const { configPath } = context.environment;
78672
- if (configPath === join17(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
78749
+ if (configPath === join18(homeOf({ context }), ".laze", "config.json")) return "laze-connect";
78673
78750
  return `laze-connect-${createHash3("sha256").update(configPath).digest("hex").slice(0, 8)}`;
78674
78751
  }
78675
78752
  function serviceEnvOf({ context }) {
@@ -78692,8 +78769,8 @@ async function run({ context, command }) {
78692
78769
  async function installSystemd({ context }) {
78693
78770
  const name3 = serviceNameOf({ context });
78694
78771
  const env = context.environment.inherited;
78695
- const base = env.XDG_CONFIG_HOME || join17(homeOf({ context }), ".config");
78696
- const file4 = join17(base, "systemd", "user", `${name3}.service`);
78772
+ const base = env.XDG_CONFIG_HOME || join18(homeOf({ context }), ".config");
78773
+ const file4 = join18(base, "systemd", "user", `${name3}.service`);
78697
78774
  await mkdir3(dirname14(file4), { recursive: true });
78698
78775
  await writeFile(
78699
78776
  file4,
@@ -78708,7 +78785,7 @@ async function installSystemd({ context }) {
78708
78785
  async function installLaunchd({ context }) {
78709
78786
  const name3 = serviceNameOf({ context });
78710
78787
  const label3 = `ai.laze.${name3}`;
78711
- const file4 = join17(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
78788
+ const file4 = join18(homeOf({ context }), "Library", "LaunchAgents", `${label3}.plist`);
78712
78789
  const log = logPathOf({ context });
78713
78790
  await mkdir3(dirname14(file4), { recursive: true });
78714
78791
  await writeFile(
@@ -79156,7 +79233,7 @@ async function waitForMessages({ context, args }) {
79156
79233
  if (rush) await healRushDelivery({ context });
79157
79234
  const lock = statePathOf({ context, kind: "waiters", profile: name3 });
79158
79235
  if (!await takeLock({ context, path: lock, sessionId: input2.session_id, claudePid })) return 0;
79159
- const seen = () => input2.transcript_path ? readFile9(input2.transcript_path, "utf8") : Promise.resolve("");
79236
+ const seen = () => input2.transcript_path ? readFile10(input2.transcript_path, "utf8") : Promise.resolve("");
79160
79237
  const deadline = context.nowMs() + (WAIT_HOOK_TIMEOUT_SECONDS - 60) * 1e3;
79161
79238
  try {
79162
79239
  const backoff = new ListenerBackoff();
@@ -79207,7 +79284,7 @@ async function refusedOnce({
79207
79284
  }) {
79208
79285
  const profile = error63 instanceof ProfileRefusedError ? error63.profile : String(args.flags.profile ?? "default");
79209
79286
  const path = statePathOf({ context, kind: "told", profile: `refused-${profile}` });
79210
- const told = await readFile9(path, "utf8").then(
79287
+ const told = await readFile10(path, "utf8").then(
79211
79288
  () => true,
79212
79289
  () => false
79213
79290
  );
@@ -79273,7 +79350,7 @@ import { rm as rm8 } from "node:fs/promises";
79273
79350
  // src/services/codex-adopt.service.ts
79274
79351
  import { spawn as spawn2 } from "node:child_process";
79275
79352
  import { readdir as readdir5, rm as rm7, stat as stat6 } from "node:fs/promises";
79276
- import { join as join18 } from "node:path";
79353
+ import { join as join19 } from "node:path";
79277
79354
  import { createInterface } from "node:readline";
79278
79355
 
79279
79356
  // src/rules/codex-requests.rules.ts
@@ -79296,19 +79373,19 @@ function codexRequestReplyOf({ method }) {
79296
79373
  }
79297
79374
 
79298
79375
  // src/services/codex-adopt.service.ts
79299
- function record3(value) {
79376
+ function record4(value) {
79300
79377
  return typeof value === "object" && value !== null ? value : {};
79301
79378
  }
79302
79379
  function absorbTurnEvent({ result: result2, message: message2 }) {
79303
- const params = record3(message2.params);
79380
+ const params = record4(message2.params);
79304
79381
  if (message2.method === "item/completed") {
79305
- const item = record3(params.item);
79382
+ const item = record4(params.item);
79306
79383
  if (item.type === "agentMessage" && typeof item.text === "string") result2.answer = item.text;
79307
79384
  return;
79308
79385
  }
79309
79386
  if (message2.method !== "thread/tokenUsage/updated") return;
79310
- const usage2 = record3(params.tokenUsage);
79311
- const total = record3(usage2.last).totalTokens;
79387
+ const usage2 = record4(params.tokenUsage);
79388
+ const total = record4(usage2.last).totalTokens;
79312
79389
  if (typeof total === "number") result2.contextTokens = total;
79313
79390
  const window2 = usage2.modelContextWindow;
79314
79391
  if (typeof window2 === "number" && window2 > 0) result2.contextWindow = window2;
@@ -79337,7 +79414,7 @@ var CodexAppServer = class _CodexAppServer {
79337
79414
  this.write({ id: id8, method, params });
79338
79415
  });
79339
79416
  if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
79340
- return record3(reply2.result);
79417
+ return record4(reply2.result);
79341
79418
  }
79342
79419
  notify(method) {
79343
79420
  this.write({ method });
@@ -79358,7 +79435,7 @@ var CodexAppServer = class _CodexAppServer {
79358
79435
  threadId,
79359
79436
  input: [{ type: "text", text: text3, text_elements: [] }]
79360
79437
  });
79361
- const turnId = record3(started.turn).id;
79438
+ const turnId = record4(started.turn).id;
79362
79439
  return { turnId: typeof turnId === "string" ? turnId : null, done };
79363
79440
  }
79364
79441
  stop() {
@@ -79371,7 +79448,7 @@ var CodexAppServer = class _CodexAppServer {
79371
79448
  receive(line) {
79372
79449
  let message2;
79373
79450
  try {
79374
- message2 = record3(JSON.parse(line));
79451
+ message2 = record4(JSON.parse(line));
79375
79452
  } catch {
79376
79453
  return;
79377
79454
  }
@@ -79393,11 +79470,11 @@ var CodexAppServer = class _CodexAppServer {
79393
79470
  }
79394
79471
  };
79395
79472
  async function newestThreadId({ codexHome }) {
79396
- const root = join18(codexHome, "sessions");
79473
+ const root = join19(codexHome, "sessions");
79397
79474
  const files2 = await readdir5(root, { recursive: true }).catch(() => []);
79398
79475
  const rollouts = files2.filter((file4) => /rollout-.*\.jsonl$/.test(file4));
79399
79476
  const dated = await Promise.all(
79400
- rollouts.map(async (file4) => ({ file: file4, at: (await stat6(join18(root, file4))).mtimeMs }))
79477
+ rollouts.map(async (file4) => ({ file: file4, at: (await stat6(join19(root, file4))).mtimeMs }))
79401
79478
  );
79402
79479
  const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
79403
79480
  const id8 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
@@ -79534,29 +79611,29 @@ async function supervise({
79534
79611
  return 0;
79535
79612
  }
79536
79613
  async function adoptStatus({ context, profile }) {
79537
- const record4 = await recordOf({ path: statePathOf({ context, kind: "adopt", profile }) });
79538
- if (!record4 || !context.processes.alive(record4.pid)) {
79614
+ const record5 = await recordOf({ path: statePathOf({ context, kind: "adopt", profile }) });
79615
+ if (!record5 || !context.processes.alive(record5.pid)) {
79539
79616
  context.out(`laze adopt codex does not run in the background for profile "${profile}".
79540
79617
  `);
79541
79618
  return;
79542
79619
  }
79543
- const thread2 = record4.thread ?? "the newest thread";
79620
+ const thread2 = record5.thread ?? "the newest thread";
79544
79621
  context.out(
79545
- `laze adopt codex runs in the background for profile "${profile}" (pid ${record4.pid}), thread ${thread2}.
79546
- Log: ${record4.log}
79622
+ `laze adopt codex runs in the background for profile "${profile}" (pid ${record5.pid}), thread ${thread2}.
79623
+ Log: ${record5.log}
79547
79624
  `
79548
79625
  );
79549
79626
  }
79550
79627
  async function adoptStop({ context, profile }) {
79551
79628
  const path = statePathOf({ context, kind: "adopt", profile });
79552
- const record4 = await recordOf({ path });
79629
+ const record5 = await recordOf({ path });
79553
79630
  await rm7(path, { force: true });
79554
- if (!record4 || !context.processes.stop(record4.pid)) {
79631
+ if (!record5 || !context.processes.stop(record5.pid)) {
79555
79632
  context.out(`laze adopt codex was not running in the background for profile "${profile}".
79556
79633
  `);
79557
79634
  return;
79558
79635
  }
79559
- context.out(`Stopped laze adopt codex (pid ${record4.pid}) for profile "${profile}".
79636
+ context.out(`Stopped laze adopt codex (pid ${record5.pid}) for profile "${profile}".
79560
79637
  `);
79561
79638
  }
79562
79639
  var HELD_THREAD = /active writer/;
@@ -79585,7 +79662,7 @@ async function adoptedThreadOf({
79585
79662
  `);
79586
79663
  return known;
79587
79664
  }
79588
- const forked = record3((await codex.call("thread/fork", { threadId })).thread).id;
79665
+ const forked = record4((await codex.call("thread/fork", { threadId })).thread).id;
79589
79666
  if (typeof forked !== "string") throw new Error("thread/fork answered no thread id");
79590
79667
  await writeStateJson({ path, value: { ...forks, [threadId]: forked } });
79591
79668
  context.out(
@@ -79715,16 +79792,16 @@ async function linkCodexSession({
79715
79792
  }
79716
79793
 
79717
79794
  // src/services/laze-plugin.service.ts
79718
- import { mkdir as mkdir4, readFile as readFile10, rm as rm9, writeFile as writeFile2 } from "node:fs/promises";
79719
- import { homedir as homedir4 } from "node:os";
79720
- import { dirname as dirname15, join as join20 } from "node:path";
79795
+ import { mkdir as mkdir4, readFile as readFile11, rm as rm9, writeFile as writeFile2 } from "node:fs/promises";
79796
+ import { homedir as homedir5 } from "node:os";
79797
+ import { dirname as dirname15, join as join21 } from "node:path";
79721
79798
 
79722
79799
  // src/rules/laze-plugin.rules.ts
79723
79800
  import { createHash as createHash4 } from "node:crypto";
79724
- import { join as join19 } from "node:path";
79801
+ import { join as join20 } from "node:path";
79725
79802
  var LAZE_PLUGIN = "laze";
79726
79803
  function pluginNameOf({ configPath, home }) {
79727
- if (configPath === join19(home, ".laze", "config.json")) return LAZE_PLUGIN;
79804
+ if (configPath === join20(home, ".laze", "config.json")) return LAZE_PLUGIN;
79728
79805
  return `${LAZE_PLUGIN}-${createHash4("sha256").update(configPath).digest("hex").slice(0, 8)}`;
79729
79806
  }
79730
79807
  var NPX_CLI = ["npx", "-y", "@lazehq/cli@latest"];
@@ -80005,7 +80082,7 @@ function lazePluginFiles({
80005
80082
  var REGISTER_LIMIT_MS = 6e4;
80006
80083
  var quote2 = (value) => `'${value.replaceAll("'", "'\\''")}'`;
80007
80084
  function homeOf2({ context }) {
80008
- return context.environment.inherited.HOME || homedir4();
80085
+ return context.environment.inherited.HOME || homedir5();
80009
80086
  }
80010
80087
  function pluginNameHere({ context }) {
80011
80088
  return pluginNameOf({ configPath: context.environment.configPath, home: homeOf2({ context }) });
@@ -80015,11 +80092,11 @@ function installedNameOf({ context }) {
80015
80092
  return `${name3}@${name3}`;
80016
80093
  }
80017
80094
  function pluginFolderOf({ context }) {
80018
- return join20(dirname15(context.environment.configPath), "plugins");
80095
+ return join21(dirname15(context.environment.configPath), "plugins");
80019
80096
  }
80020
80097
  async function pluginIsCurrent({ context }) {
80021
- const manifest = join20(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
80022
- const written = await readFile10(manifest, "utf8").then((text3) => JSON.parse(text3).version).catch(() => void 0);
80098
+ const manifest = join21(pluginFolderOf({ context }), LAZE_PLUGIN, ".claude-plugin", "plugin.json");
80099
+ const written = await readFile11(manifest, "utf8").then((text3) => JSON.parse(text3).version).catch(() => void 0);
80023
80100
  return written === cliVersionOf();
80024
80101
  }
80025
80102
  async function writeLazePlugin({ context }) {
@@ -80031,7 +80108,7 @@ async function writeLazePlugin({ context }) {
80031
80108
  configPath: context.environment.configPath
80032
80109
  });
80033
80110
  for (const [path, text3] of Object.entries(files2)) {
80034
- const target = join20(folder, path);
80111
+ const target = join21(folder, path);
80035
80112
  await mkdir4(dirname15(target), { recursive: true });
80036
80113
  await writeFile2(target, text3);
80037
80114
  }
@@ -80062,7 +80139,7 @@ async function registerWithClaude({ context, folder }) {
80062
80139
  return claudeScript({ context, script });
80063
80140
  }
80064
80141
  function claudeDirOf({ context }) {
80065
- return context.environment.inherited.CLAUDE_CONFIG_DIR || join20(homeOf2({ context }), ".claude");
80142
+ return context.environment.inherited.CLAUDE_CONFIG_DIR || join21(homeOf2({ context }), ".claude");
80066
80143
  }
80067
80144
  function unregisterAs({ context, name: name3 }) {
80068
80145
  const script = [
@@ -80073,8 +80150,8 @@ function unregisterAs({ context, name: name3 }) {
80073
80150
  }
80074
80151
  async function dropOwnLeftover({ context, folder }) {
80075
80152
  if (pluginNameHere({ context }) === LAZE_PLUGIN) return;
80076
- const known = await readFile10(
80077
- join20(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
80153
+ const known = await readFile11(
80154
+ join21(claudeDirOf({ context }), "plugins", "known_marketplaces.json"),
80078
80155
  "utf8"
80079
80156
  ).then((text3) => JSON.parse(text3)).catch(() => void 0);
80080
80157
  if (known?.[LAZE_PLUGIN]?.source?.path !== folder) return;
@@ -80082,17 +80159,17 @@ async function dropOwnLeftover({ context, folder }) {
80082
80159
  }
80083
80160
  var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
80084
80161
  async function cachedPluginOf({ context }) {
80085
- const path = join20(claudeDirOf({ context }), "plugins", "installed_plugins.json");
80086
- const listed = await readFile10(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
80162
+ const path = join21(claudeDirOf({ context }), "plugins", "installed_plugins.json");
80163
+ const listed = await readFile11(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
80087
80164
  return listed?.plugins?.[installedNameOf({ context })]?.[0]?.installPath;
80088
80165
  }
80089
80166
  async function refreshStaleCache({ context, folder }) {
80090
80167
  const cached2 = await cachedPluginOf({ context });
80091
80168
  if (!cached2) return true;
80092
- const read4 = (path) => readFile10(path, "utf8").catch(() => "");
80169
+ const read4 = (path) => readFile11(path, "utf8").catch(() => "");
80093
80170
  for (const file4 of RUN_FILES) {
80094
- const ours = await read4(join20(folder, LAZE_PLUGIN, file4));
80095
- if (ours === await read4(join20(cached2, file4))) continue;
80171
+ const ours = await read4(join21(folder, LAZE_PLUGIN, file4));
80172
+ if (ours === await read4(join21(cached2, file4))) continue;
80096
80173
  const plugin2 = installedNameOf({ context });
80097
80174
  const script = [
80098
80175
  `claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
@@ -80103,10 +80180,10 @@ async function refreshStaleCache({ context, folder }) {
80103
80180
  return true;
80104
80181
  }
80105
80182
  function registeredMarkOf({ context }) {
80106
- return join20(pluginFolderOf({ context }), "registered");
80183
+ return join21(pluginFolderOf({ context }), "registered");
80107
80184
  }
80108
80185
  async function pluginRegistered({ context }) {
80109
- return readFile10(registeredMarkOf({ context }), "utf8").then(
80186
+ return readFile11(registeredMarkOf({ context }), "utf8").then(
80110
80187
  () => true,
80111
80188
  () => false
80112
80189
  );
@@ -80121,7 +80198,7 @@ async function installLazePlugin({ context }) {
80121
80198
  async function plugin({ context, args }) {
80122
80199
  const action = args.words[1] ?? "install";
80123
80200
  if (action === "path") {
80124
- context.out(`${join20(pluginFolderOf({ context }), LAZE_PLUGIN)}
80201
+ context.out(`${join21(pluginFolderOf({ context }), LAZE_PLUGIN)}
80125
80202
  `);
80126
80203
  return 0;
80127
80204
  }
@@ -80332,7 +80409,7 @@ async function pushInbox({
80332
80409
  }
80333
80410
 
80334
80411
  // src/services/plugin-tip.service.ts
80335
- import { readFile as readFile11 } from "node:fs/promises";
80412
+ import { readFile as readFile12 } from "node:fs/promises";
80336
80413
  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.";
80337
80414
  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.";
80338
80415
  function monitorsRunHere({ context }) {
@@ -80374,7 +80451,7 @@ async function reloadTipOnce({
80374
80451
  }) {
80375
80452
  if (!session || !monitorsRunHere({ context })) return void 0;
80376
80453
  if (!await pluginRegistered({ context })) return void 0;
80377
- const told = await readFile11(toldPathOf({ context, session }), "utf8").then(
80454
+ const told = await readFile12(toldPathOf({ context, session }), "utf8").then(
80378
80455
  () => true,
80379
80456
  () => false
80380
80457
  );
@@ -80387,7 +80464,7 @@ async function reloadTipOnce({
80387
80464
  import { Buffer as Buffer3 } from "node:buffer";
80388
80465
  import { createHash as createHash5 } from "node:crypto";
80389
80466
  import { mkdir as mkdir5, open as open5 } from "node:fs/promises";
80390
- import { dirname as dirname16, join as join21 } from "node:path";
80467
+ import { dirname as dirname16, join as join22 } from "node:path";
80391
80468
 
80392
80469
  // src/rules/session-scrub.rules.ts
80393
80470
  import { Buffer as Buffer2 } from "node:buffer";
@@ -80447,7 +80524,7 @@ function paddedTo({ text: text3, bytes }) {
80447
80524
  // src/services/session-scrub.service.ts
80448
80525
  function offsetPathOf({ context, transcript }) {
80449
80526
  const key = createHash5("sha256").update(transcript).digest("hex").slice(0, 24);
80450
- return join21(dirname16(context.environment.configPath), "session-scrub", `${key}.json`);
80527
+ return join22(dirname16(context.environment.configPath), "session-scrub", `${key}.json`);
80451
80528
  }
80452
80529
  async function offsetOf({ path }) {
80453
80530
  const saved3 = await readStateJson({ path });
@@ -80626,7 +80703,7 @@ async function harnessOf2({ context, args }) {
80626
80703
  const nearest = await nearestHarnessOf({ context });
80627
80704
  return nearest ?? { harness: context.environment.harness, pid: void 0 };
80628
80705
  }
80629
- function settingsOf({ path, text: text3 }) {
80706
+ function settingsOf2({ path, text: text3 }) {
80630
80707
  try {
80631
80708
  return JSON.parse(text3);
80632
80709
  } catch {
@@ -80634,10 +80711,10 @@ function settingsOf({ path, text: text3 }) {
80634
80711
  }
80635
80712
  }
80636
80713
  async function installHooks({ context, directory }) {
80637
- const folder = join22(directory, ".claude");
80638
- const path = join22(folder, "settings.local.json");
80639
- const text3 = await readFile12(path, "utf8").catch(() => "{}");
80640
- const current3 = settingsOf({ path, text: text3 });
80714
+ const folder = join23(directory, ".claude");
80715
+ const path = join23(folder, "settings.local.json");
80716
+ const text3 = await readFile13(path, "utf8").catch(() => "{}");
80717
+ const current3 = settingsOf2({ path, text: text3 });
80641
80718
  const command = (hook) => hookCommand({ program: context.program, hook });
80642
80719
  const settings3 = withLazeHooks({
80643
80720
  settings: current3,
@@ -80867,12 +80944,16 @@ async function bindInLaze({
80867
80944
  }
80868
80945
  }
80869
80946
  async function reportTranscript({
80947
+ context: cli,
80870
80948
  client,
80871
- input: input2
80949
+ input: input2,
80950
+ claudePid
80872
80951
  }) {
80873
80952
  if (!input2.transcript_path || !input2.session_id) return;
80874
- const lines2 = (await readFile12(input2.transcript_path, "utf8")).split("\n");
80875
- const context = readTranscript({ lines: lines2 });
80953
+ const lines2 = (await readFile13(input2.transcript_path, "utf8")).split("\n");
80954
+ const { folder } = await claudeFoldersOf({ context: cli, claudePid });
80955
+ const run4 = await claudeRunOf({ context: cli, folder: input2.cwd ?? folder, claudePid });
80956
+ const context = readTranscript({ lines: lines2, run: run4 });
80876
80957
  await client.post("/api/agents/me/activity", {
80877
80958
  sessionId: input2.session_id,
80878
80959
  ...context.contextTokens !== void 0 ? { contextTokens: context.contextTokens } : {},
@@ -80897,7 +80978,7 @@ async function handOver({ context, args }) {
80897
80978
  const named = await pluginHookArgs({ context, args, session, claudePid });
80898
80979
  if (!named) return;
80899
80980
  const { client, name: agent3 } = await signedIn({ context, args: named });
80900
- await reportTranscript({ client, input: input2 }).catch(
80981
+ await reportTranscript({ context, client, input: input2, claudePid }).catch(
80901
80982
  (error63) => reportFailed({ context, error: error63 })
80902
80983
  );
80903
80984
  if (input2.transcript_path) {
@@ -80915,7 +80996,7 @@ async function handOver({ context, args }) {
80915
80996
  const kept = await dueFromSpool({
80916
80997
  context,
80917
80998
  profile: agent3,
80918
- seen: () => input2.transcript_path ? readFile12(input2.transcript_path, "utf8") : Promise.resolve(""),
80999
+ seen: () => input2.transcript_path ? readFile13(input2.transcript_path, "utf8") : Promise.resolve(""),
80919
81000
  pushedToo: false,
80920
81001
  settledOnly: true
80921
81002
  });
@@ -80947,14 +81028,14 @@ async function handOver({ context, args }) {
80947
81028
  async function addSessionStartWaiter({ context, args }) {
80948
81029
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR;
80949
81030
  if (!directory || args.flags.plugin) return;
80950
- const path = join22(directory, ".claude", "settings.local.json");
80951
- const settings3 = await readFile12(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
81031
+ const path = join23(directory, ".claude", "settings.local.json");
81032
+ const settings3 = await readFile13(path, "utf8").then((text3) => JSON.parse(text3)).catch(() => void 0);
80952
81033
  if (!settings3 || !lacksSessionStartWaiter({ settings: settings3 })) return;
80953
81034
  await installHooks({ context, directory });
80954
81035
  }
80955
81036
  async function refreshPlugin({ context }) {
80956
81037
  if (await pluginIsCurrent({ context })) return;
80957
- const logPath = join22(pluginFolderOf({ context }), "install.log");
81038
+ const logPath = join23(pluginFolderOf({ context }), "install.log");
80958
81039
  context.processes.spawnDetached({ argv: [...context.program, "plugin", "install"], logPath });
80959
81040
  }
80960
81041
  async function stopHook({ context, args }) {
@@ -80980,7 +81061,7 @@ async function stopHook({ context, args }) {
80980
81061
  }
80981
81062
 
80982
81063
  // src/services/agent-manage-commands.service.ts
80983
- import { readFile as readFile13 } from "node:fs/promises";
81064
+ import { readFile as readFile14 } from "node:fs/promises";
80984
81065
  import { extname, resolve as resolve5 } from "node:path";
80985
81066
 
80986
81067
  // src/rules/login-format.rules.ts
@@ -81113,7 +81194,7 @@ async function avatarOf({
81113
81194
  return emoji4;
81114
81195
  }
81115
81196
  if (!path) return void 0;
81116
- const bytes = await readFile13(resolve5(context.cwd, path)).catch(() => {
81197
+ const bytes = await readFile14(resolve5(context.cwd, path)).catch(() => {
81117
81198
  throw new CliUsageError(`laze: cannot read the avatar file ${path}.`);
81118
81199
  });
81119
81200
  const uploaded = await client.post("/api/agents/avatars", {
@@ -81829,8 +81910,8 @@ async function setAgentRunsOn({
81829
81910
  }
81830
81911
 
81831
81912
  // src/services/agent-migrate-commands.service.ts
81832
- import { readFile as readFile14, stat as stat7 } from "node:fs/promises";
81833
- import { basename as basename6, join as join23, resolve as resolve6 } from "node:path";
81913
+ import { readFile as readFile15, stat as stat7 } from "node:fs/promises";
81914
+ import { basename as basename6, join as join24, resolve as resolve6 } from "node:path";
81834
81915
 
81835
81916
  // src/rules/migration-upload.rules.ts
81836
81917
  import { createHash as createHash6 } from "node:crypto";
@@ -81893,8 +81974,8 @@ function packed({ lines: lines2, maxBytes }) {
81893
81974
  function isCompactBoundary(line) {
81894
81975
  if (!line.includes('"compact_boundary"')) return false;
81895
81976
  try {
81896
- const record4 = JSON.parse(line);
81897
- return record4.type === "system" && record4.subtype === "compact_boundary";
81977
+ const record5 = JSON.parse(line);
81978
+ return record5.type === "system" && record5.subtype === "compact_boundary";
81898
81979
  } catch {
81899
81980
  return false;
81900
81981
  }
@@ -82067,7 +82148,7 @@ async function transcriptOf({ context, args, ticket }) {
82067
82148
  if (ticket.source === "codex") {
82068
82149
  const codexHome = context.environment.codexHome;
82069
82150
  const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
82070
- return { sessionId, path: path2, where: join23(codexHome, "sessions") };
82151
+ return { sessionId, path: path2, where: join24(codexHome, "sessions") };
82071
82152
  }
82072
82153
  const { root, path } = await claudeTranscriptOf({ context, sessionId });
82073
82154
  return { sessionId, path, where: root };
@@ -82119,7 +82200,7 @@ async function uploadTranscript({ context, args, client }) {
82119
82200
  `The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
82120
82201
  );
82121
82202
  }
82122
- const raw = await readFile14(found.path, "utf8");
82203
+ const raw = await readFile15(found.path, "utf8");
82123
82204
  if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
82124
82205
  const redacted = await redactTranscript({ text: raw });
82125
82206
  const { parts, truncated } = transcriptPartsOf({
@@ -82442,8 +82523,8 @@ async function listAgentSessions({
82442
82523
  }
82443
82524
 
82444
82525
  // src/services/app-commands.service.ts
82445
- import { mkdir as mkdir8, readdir as readdir6, readFile as readFile17, writeFile as writeFile6 } from "node:fs/promises";
82446
- import { dirname as dirname18, join as join28, relative as relative3, resolve as resolve9, sep as sep3 } from "node:path";
82526
+ import { mkdir as mkdir8, readdir as readdir6, readFile as readFile18, writeFile as writeFile6 } from "node:fs/promises";
82527
+ import { dirname as dirname18, join as join29, relative as relative3, resolve as resolve9, sep as sep3 } from "node:path";
82447
82528
 
82448
82529
  // ../../modules/app/contract/src/app.connections.ts
82449
82530
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -85249,7 +85330,7 @@ async function appAsset(input2) {
85249
85330
  // src/services/browser-tab-commands.service.ts
85250
85331
  import { mkdir as mkdir7, writeFile as writeFile4 } from "node:fs/promises";
85251
85332
  import { tmpdir as tmpdir2 } from "node:os";
85252
- import { join as join25, resolve as resolve8 } from "node:path";
85333
+ import { join as join26, resolve as resolve8 } from "node:path";
85253
85334
 
85254
85335
  // src/rules/browser-login.rules.ts
85255
85336
  var PASSWORD_NAME = /pass|pwd/i;
@@ -85314,9 +85395,9 @@ async function patiently({
85314
85395
 
85315
85396
  // src/services/vault-commands.service.ts
85316
85397
  import { createHash as createHash8 } from "node:crypto";
85317
- import { readFile as readFile15, rm as rm11 } from "node:fs/promises";
85398
+ import { readFile as readFile16, rm as rm11 } from "node:fs/promises";
85318
85399
  import { hostname as hostname7, tmpdir } from "node:os";
85319
- import { dirname as dirname17, join as join24 } from "node:path";
85400
+ import { dirname as dirname17, join as join25 } from "node:path";
85320
85401
 
85321
85402
  // src/rules/vault-session.rules.ts
85322
85403
  function vaultSessionOf({
@@ -85376,7 +85457,7 @@ async function handedOut({
85376
85457
  () => void 0
85377
85458
  );
85378
85459
  context.err(
85379
- `laze vault: ${Object.keys(fields).join(", ")} of ${name3} hold a stand-in; Laze's proxy puts the key in only on sites approved for it. A command that needs the value itself (signing, a database) needs ${name3} marked "Used on the computer only".
85460
+ `laze vault: ${Object.keys(fields).join(", ")} of ${name3} ${Object.keys(fields).length === 1 ? "holds" : "hold"} a stand-in; Laze's proxy puts the key in only on sites approved for it. A command that needs the value itself (signing, a database) needs ${name3} marked "Used on the computer only".
85380
85461
  `
85381
85462
  );
85382
85463
  }
@@ -85419,7 +85500,7 @@ async function turnTokenOf2({
85419
85500
  if (pinned) return pinned;
85420
85501
  if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
85421
85502
  try {
85422
- return (await readFile15(turnFile, "utf8")).trim();
85503
+ return (await readFile16(turnFile, "utf8")).trim();
85423
85504
  } catch {
85424
85505
  throw new CliUsageError(`${command} works only during an agent's turn`);
85425
85506
  }
@@ -85430,8 +85511,8 @@ function runKeyPathOf({
85430
85511
  profile = ""
85431
85512
  }) {
85432
85513
  const name3 = createHash8("sha256").update(connection).digest("hex");
85433
- const base = turnFile ? dirname17(turnFile) : join24(tmpdir(), "laze-vault", profile);
85434
- return join24(base, "vault-run-keys", `${name3}.json`);
85514
+ const base = turnFile ? dirname17(turnFile) : join25(tmpdir(), "laze-vault", profile);
85515
+ return join25(base, "vault-run-keys", `${name3}.json`);
85435
85516
  }
85436
85517
  async function runKeyAt({ path }) {
85437
85518
  const saved3 = await readStateJson({
@@ -86014,9 +86095,9 @@ async function savedScreenshot({
86014
86095
  nowMs: nowMs2,
86015
86096
  what
86016
86097
  }) {
86017
- const folder = join25(tmpdir2(), "laze-browser");
86098
+ const folder = join26(tmpdir2(), "laze-browser");
86018
86099
  await mkdir7(folder, { recursive: true, mode: 448 });
86019
- const path = join25(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-${what}-${nowMs2}.jpg`);
86100
+ const path = join26(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-${what}-${nowMs2}.jpg`);
86020
86101
  await writeFile4(path, Buffer.from(data, "base64"), { mode: 384 });
86021
86102
  return path;
86022
86103
  }
@@ -86494,7 +86575,7 @@ async function appPinsCommand({
86494
86575
  import { execFile } from "node:child_process";
86495
86576
  import { mkdtemp, rm as rm12, writeFile as writeFile5 } from "node:fs/promises";
86496
86577
  import { tmpdir as tmpdir3 } from "node:os";
86497
- import { join as join26 } from "node:path";
86578
+ import { join as join27 } from "node:path";
86498
86579
  import { promisify } from "node:util";
86499
86580
  var run2 = promisify(execFile);
86500
86581
  var MODULE_SYNTAX = /^\s*(import|export)\s/m;
@@ -86523,11 +86604,11 @@ async function scriptErrorsOf({
86523
86604
  const unknown2 = unknownCollectionsOf({ files: files2, collections });
86524
86605
  const scripts = files2.flatMap(scriptsOf);
86525
86606
  if (scripts.length === 0) return unknown2;
86526
- const dir = await mkdtemp(join26(tmpdir3(), "laze-app-check-"));
86607
+ const dir = await mkdtemp(join27(tmpdir3(), "laze-app-check-"));
86527
86608
  try {
86528
86609
  const errors = await Promise.all(
86529
86610
  scripts.map(async (script, index) => {
86530
- const file4 = join26(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
86611
+ const file4 = join27(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
86531
86612
  await writeFile5(file4, script.code);
86532
86613
  try {
86533
86614
  await run2(process.execPath, ["--check", file4]);
@@ -86545,9 +86626,9 @@ async function scriptErrorsOf({
86545
86626
  }
86546
86627
 
86547
86628
  // src/services/app-serve.service.ts
86548
- import { readFile as readFile16, stat as stat9 } from "node:fs/promises";
86629
+ import { readFile as readFile17, stat as stat9 } from "node:fs/promises";
86549
86630
  import { createServer } from "node:http";
86550
- import { extname as extname2, join as join27, normalize, sep as sep2 } from "node:path";
86631
+ import { extname as extname2, join as join28, normalize, sep as sep2 } from "node:path";
86551
86632
  var TYPES2 = {
86552
86633
  ".html": "text/html; charset=utf-8",
86553
86634
  ".js": "text/javascript; charset=utf-8",
@@ -86598,13 +86679,13 @@ async function staticFile({
86598
86679
  if (clean.startsWith("..") || hidden) {
86599
86680
  return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
86600
86681
  }
86601
- const candidates = [join27(folder, clean), join27(folder, clean, "index.html")];
86602
- if (!extname2(clean)) candidates.push(join27(folder, "index.html"));
86682
+ const candidates = [join28(folder, clean), join28(folder, clean, "index.html")];
86683
+ if (!extname2(clean)) candidates.push(join28(folder, "index.html"));
86603
86684
  for (const target of candidates) {
86604
86685
  const info = await stat9(target).catch(() => void 0);
86605
86686
  if (!info?.isFile()) continue;
86606
86687
  const type = TYPES2[extname2(target).toLowerCase()] ?? "application/octet-stream";
86607
- const body = await readFile16(target);
86688
+ const body = await readFile17(target);
86608
86689
  if (extname2(target) === ".html") {
86609
86690
  return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
86610
86691
  }
@@ -86854,7 +86935,7 @@ async function turnTokenOf3({
86854
86935
  const pinned = env.LAZE_TURN_TOKEN?.trim();
86855
86936
  if (pinned) return pinned;
86856
86937
  if (env.LAZE_TURN_FILE) {
86857
- return readFile17(env.LAZE_TURN_FILE, "utf8").then(
86938
+ return readFile18(env.LAZE_TURN_FILE, "utf8").then(
86858
86939
  (text3) => text3.trim(),
86859
86940
  () => ""
86860
86941
  );
@@ -86888,7 +86969,7 @@ function folderOf({ context, word: word3 }) {
86888
86969
  return resolve9(context.cwd, word3 ?? ".");
86889
86970
  }
86890
86971
  async function readManifest(folder) {
86891
- const text3 = await readFile17(join28(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
86972
+ const text3 = await readFile18(join29(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
86892
86973
  if (text3 === void 0) return void 0;
86893
86974
  const parsed = appManifestSchema.safeParse(JSON.parse(text3));
86894
86975
  if (!parsed.success) {
@@ -86929,7 +87010,7 @@ async function jsonFlag({
86929
87010
  }) {
86930
87011
  const raw = flagText({ args, name: name3 });
86931
87012
  if (!raw) return void 0;
86932
- const text3 = raw.startsWith("@") ? await readFile17(resolve9(context.cwd, raw.slice(1)), "utf8") : raw;
87013
+ const text3 = raw.startsWith("@") ? await readFile18(resolve9(context.cwd, raw.slice(1)), "utf8") : raw;
86933
87014
  try {
86934
87015
  return JSON.parse(text3);
86935
87016
  } catch {
@@ -86942,7 +87023,7 @@ async function listFiles(folder) {
86942
87023
  while (pending2.length > 0 && found.length <= MAX_FILES) {
86943
87024
  const current3 = pending2.pop() ?? folder;
86944
87025
  for (const entry2 of await readdir6(current3, { withFileTypes: true })) {
86945
- const path = join28(current3, entry2.name);
87026
+ const path = join29(current3, entry2.name);
86946
87027
  const rel = relative3(folder, path).split(sep3).join("/");
86947
87028
  if (isSkippedPath({ path: rel })) continue;
86948
87029
  if (entry2.isDirectory()) pending2.push(path);
@@ -86981,7 +87062,7 @@ var appCreate = async ({ context, args }) => {
86981
87062
  await mkdir8(folder, { recursive: true });
86982
87063
  const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
86983
87064
  for (const file4 of start2?.files ?? []) {
86984
- const target = join28(folder, ...file4.path.split("/"));
87065
+ const target = join29(folder, ...file4.path.split("/"));
86985
87066
  await mkdir8(dirname18(target), { recursive: true });
86986
87067
  await writeFile6(
86987
87068
  target,
@@ -86994,7 +87075,7 @@ var appCreate = async ({ context, args }) => {
86994
87075
  views: [...start2?.template.views ?? []],
86995
87076
  seed: { ...start2?.template.seed }
86996
87077
  };
86997
- await writeFile6(join28(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
87078
+ await writeFile6(join29(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
86998
87079
  `);
86999
87080
  const where = relative3(context.cwd, folder) || ".";
87000
87081
  const created = start2 ? `Created ${app2.name} (${app2.id}) from the ${template} template in ${where}; its first version is live at ${app2.publishedUrl}.
@@ -87065,7 +87146,7 @@ var appPush = async ({ context, args }) => {
87065
87146
  paths.map(
87066
87147
  async (path) => buildFileOf({
87067
87148
  path: relative3(folder, path).split(sep3).join("/"),
87068
- bytes: await readFile17(path)
87149
+ bytes: await readFile18(path)
87069
87150
  })
87070
87151
  )
87071
87152
  );
@@ -87135,7 +87216,7 @@ var appWrite = async ({ context, args }) => {
87135
87216
  const path = resolve9(context.cwd, word3);
87136
87217
  const { bytes: _bytes, ...file4 } = buildFileOf({
87137
87218
  path: relative3(folder, path).split(sep3).join("/"),
87138
- bytes: await readFile17(path)
87219
+ bytes: await readFile18(path)
87139
87220
  });
87140
87221
  return file4;
87141
87222
  })
@@ -87263,7 +87344,7 @@ var appPull = async ({ context, args }) => {
87263
87344
  );
87264
87345
  }
87265
87346
  for (const file4 of pulled.files) {
87266
- const target = join28(folder, ...file4.path.split("/"));
87347
+ const target = join29(folder, ...file4.path.split("/"));
87267
87348
  await mkdir8(dirname18(target), { recursive: true });
87268
87349
  await writeFile6(
87269
87350
  target,
@@ -87282,7 +87363,7 @@ var appPull = async ({ context, args }) => {
87282
87363
  ])
87283
87364
  )
87284
87365
  };
87285
- await writeFile6(join28(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
87366
+ await writeFile6(join29(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
87286
87367
  `);
87287
87368
  const names = pulled.collections.map((collection) => collection.name);
87288
87369
  const where = relative3(context.cwd, folder) || ".";
@@ -87527,7 +87608,7 @@ var appRefresh = async ({ context, args }) => {
87527
87608
  };
87528
87609
  function recordPageText({ records }) {
87529
87610
  if (records.totalItems === 0) return "No records yet.\n";
87530
- const lines2 = records.items.map((record4) => JSON.stringify(record4)).join("\n");
87611
+ const lines2 = records.items.map((record5) => JSON.stringify(record5)).join("\n");
87531
87612
  return `${lines2}
87532
87613
  (page ${records.page} of ${records.totalPages}, ${records.totalItems} records)
87533
87614
  `;
@@ -87598,7 +87679,7 @@ var appImport = async ({ context, args }) => {
87598
87679
  const words = args.words.slice(2);
87599
87680
  const [named, collection, file4] = words.length >= 3 ? words : [void 0, ...words];
87600
87681
  if (!collection || !file4) throw new CliUsageError(USAGE7);
87601
- const csv = await readFile17(resolve9(context.cwd, file4), "utf8").catch(() => {
87682
+ const csv = await readFile18(resolve9(context.cwd, file4), "utf8").catch(() => {
87602
87683
  throw new CliUsageError(`Cannot read ${file4}`);
87603
87684
  });
87604
87685
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
@@ -88104,7 +88185,7 @@ async function login({ context, args }) {
88104
88185
  const url2 = serverUrlOf({ context, args });
88105
88186
  const name3 = flagText({ args, name: "profile", fallback: "default" });
88106
88187
  const given = flagText({ args, name: "token" });
88107
- const token2 = given || await deviceToken({ context, url: url2, args });
88188
+ const token2 = given || await deviceToken({ context, url: url2, args, profile: name3 });
88108
88189
  const profile = await profileOf({ context, url: url2, token: token2 });
88109
88190
  const here = Boolean(args.flags.here);
88110
88191
  await context.store.saveProfile({
@@ -88129,7 +88210,8 @@ async function machineLine({ context }) {
88129
88210
  async function deviceToken({
88130
88211
  context,
88131
88212
  url: url2,
88132
- args
88213
+ args,
88214
+ profile
88133
88215
  }) {
88134
88216
  const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
88135
88217
  const machineKey = await context.machineKeys?.registration().catch(() => void 0);
@@ -88139,7 +88221,7 @@ async function deviceToken({
88139
88221
  name: "client",
88140
88222
  fallback: `laze CLI on ${hostname8()}`.slice(0, 80)
88141
88223
  }),
88142
- ...machineKey ? { machineKey } : {}
88224
+ ...machineKey ? { machineKey, profile: context.store.loginProfileOf({ name: profile }) } : {}
88143
88225
  });
88144
88226
  context.out(
88145
88227
  [
@@ -88549,8 +88631,8 @@ async function billing({ context, args }) {
88549
88631
 
88550
88632
  // src/services/browser-commands.service.ts
88551
88633
  import { randomBytes as randomBytes3 } from "node:crypto";
88552
- import { readFile as readFile18 } from "node:fs/promises";
88553
- import { dirname as dirname19, join as join29 } from "node:path";
88634
+ import { readFile as readFile19 } from "node:fs/promises";
88635
+ import { dirname as dirname19, join as join30 } from "node:path";
88554
88636
 
88555
88637
  // src/services/cdp-bridge.service.ts
88556
88638
  import { spawn as spawn3 } from "node:child_process";
@@ -88970,7 +89052,7 @@ async function turnTokenOf4({
88970
89052
  const pinned = env.LAZE_TURN_TOKEN?.trim();
88971
89053
  if (pinned) return pinned;
88972
89054
  if (env.LAZE_TURN_FILE) {
88973
- return readFile18(env.LAZE_TURN_FILE, "utf8").then(
89055
+ return readFile19(env.LAZE_TURN_FILE, "utf8").then(
88974
89056
  (text3) => text3.trim(),
88975
89057
  () => ""
88976
89058
  );
@@ -89060,7 +89142,7 @@ async function answering({
89060
89142
  }
89061
89143
  function bridgeStatePath({ context, machine: machine2 }) {
89062
89144
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
89063
- return join29(dirname19(context.environment.configPath), "bridges", `${safe}.json`);
89145
+ return join30(dirname19(context.environment.configPath), "bridges", `${safe}.json`);
89064
89146
  }
89065
89147
  async function bridgePort({
89066
89148
  context,
@@ -89773,7 +89855,7 @@ async function channelSettings({ context, args }) {
89773
89855
  }
89774
89856
 
89775
89857
  // src/services/chat-actions-commands.service.ts
89776
- import { readFile as readFile19 } from "node:fs/promises";
89858
+ import { readFile as readFile20 } from "node:fs/promises";
89777
89859
  import { basename as basename9, resolve as resolve11 } from "node:path";
89778
89860
 
89779
89861
  // src/rules/app-link.rules.ts
@@ -90220,7 +90302,7 @@ var files = async ({ context, args, client }) => {
90220
90302
  };
90221
90303
  var fileUpload = async ({ context, args, client }) => {
90222
90304
  const path = resolve11(context.cwd, wordAt(args, 3));
90223
- const bytes = new Uint8Array(await readFile19(path));
90305
+ const bytes = new Uint8Array(await readFile20(path));
90224
90306
  const answer6 = await uploadFile({
90225
90307
  context,
90226
90308
  client,
@@ -93813,11 +93895,11 @@ async function computer({ context, args }) {
93813
93895
  }
93814
93896
 
93815
93897
  // src/services/connect-commands.service.ts
93816
- import { readFile as readFile21 } from "node:fs/promises";
93898
+ import { readFile as readFile22 } from "node:fs/promises";
93817
93899
 
93818
93900
  // src/services/mcp-gateway.service.ts
93819
- import { mkdir as mkdir10, readFile as readFile20, writeFile as writeFile7 } from "node:fs/promises";
93820
- import { basename as basename11, join as join30, resolve as resolve13 } from "node:path";
93901
+ import { mkdir as mkdir10, readFile as readFile21, writeFile as writeFile7 } from "node:fs/promises";
93902
+ import { basename as basename11, join as join31, resolve as resolve13 } from "node:path";
93821
93903
  import { createInterface as createInterface2 } from "node:readline";
93822
93904
 
93823
93905
  // src/services/mcp-support.service.ts
@@ -93953,7 +94035,7 @@ async function relayMcpLines({
93953
94035
  const github3 = env.LAZE_GITHUB_CONNECTION;
93954
94036
  const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
93955
94037
  const turnFile = env.LAZE_TURN_FILE;
93956
- const readTurn = () => readFile20(turnFile, "utf8").then(
94038
+ const readTurn = () => readFile21(turnFile, "utf8").then(
93957
94039
  (text3) => text3.trim(),
93958
94040
  () => ""
93959
94041
  );
@@ -93996,8 +94078,8 @@ function safeName(name3, fallback) {
93996
94078
  return last && last !== "." && last !== ".." ? last : fallback;
93997
94079
  }
93998
94080
  async function saveMailFile({ root, file: file4 }) {
93999
- const dir = join30(root, safeName(file4.messageId, "message"));
94000
- const path = join30(dir, safeName(file4.fileName, "attachment"));
94081
+ const dir = join31(root, safeName(file4.messageId, "message"));
94082
+ const path = join31(dir, safeName(file4.fileName, "attachment"));
94001
94083
  await mkdir10(dir, { recursive: true });
94002
94084
  await writeFile7(path, Buffer.from(file4.base64, "base64"));
94003
94085
  return path;
@@ -94123,7 +94205,7 @@ async function turnOf({ context }) {
94123
94205
  const pinned = env.LAZE_TURN_TOKEN?.trim();
94124
94206
  if (pinned) return pinned;
94125
94207
  const file4 = env.LAZE_TURN_FILE;
94126
- const turn = file4 ? await readFile21(file4, "utf8").then(
94208
+ const turn = file4 ? await readFile22(file4, "utf8").then(
94127
94209
  (text3) => text3.trim(),
94128
94210
  () => ""
94129
94211
  ) : "";
@@ -94247,11 +94329,11 @@ async function suggestServer({
94247
94329
  }
94248
94330
 
94249
94331
  // src/services/connector-commands.service.ts
94250
- import { readFile as readFile23 } from "node:fs/promises";
94332
+ import { readFile as readFile24 } from "node:fs/promises";
94251
94333
  import { resolve as resolve14 } from "node:path";
94252
94334
 
94253
94335
  // src/services/vault-keychain-commands.service.ts
94254
- import { readFile as readFile22 } from "node:fs/promises";
94336
+ import { readFile as readFile23 } from "node:fs/promises";
94255
94337
 
94256
94338
  // src/rules/vault-input.rules.ts
94257
94339
  function secondsOf(text3) {
@@ -94672,7 +94754,7 @@ async function secretText({ context, args }) {
94672
94754
  );
94673
94755
  }
94674
94756
  const file4 = flagText({ args, name: "from-file" });
94675
- const text3 = file4 ? await readFile22(file4, "utf8") : await context.readStdin();
94757
+ const text3 = file4 ? await readFile23(file4, "utf8") : await context.readStdin();
94676
94758
  const trimmed = text3.replace(/\r?\n$/, "");
94677
94759
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
94678
94760
  const held = await placeholdersOf({ env: context.environment.inherited });
@@ -94693,7 +94775,7 @@ async function keychainOf2({ client, args }) {
94693
94775
  const me = await client.get("/api/agents/me");
94694
94776
  return { kind: "personal", ownerUserId: me.id };
94695
94777
  }
94696
- function settingsOf2(args) {
94778
+ function settingsOf3(args) {
94697
94779
  const lease = flagText({ args, name: "lease" }) || flagText({ args, name: "max-lease" });
94698
94780
  const approvers = args.lists.approver;
94699
94781
  const everyUseAsks = yesNoOf({ args, name: "every-use-asks" });
@@ -94737,7 +94819,7 @@ var add4 = async ({ context, args }) => {
94737
94819
  name: name3,
94738
94820
  keychain: await keychainOf2({ client, args }),
94739
94821
  sensitivity: levelOf2(args) ?? "checked",
94740
- ...settingsOf2(args),
94822
+ ...settingsOf3(args),
94741
94823
  secret
94742
94824
  });
94743
94825
  if (args.flags.json) return printJson4({ context, data: created });
@@ -94747,7 +94829,7 @@ var add4 = async ({ context, args }) => {
94747
94829
  );
94748
94830
  };
94749
94831
  var update = async ({ context, args }) => {
94750
- const settings3 = { ...settingsOf2(args), ...deviceApprovalOf(args) };
94832
+ const settings3 = { ...settingsOf3(args), ...deviceApprovalOf(args) };
94751
94833
  const { client, profile } = await signedIn({ context, args });
94752
94834
  if (Object.keys(settings3).length === 0) throw new CliUsageError(VAULT_USAGE);
94753
94835
  const word3 = args.words[2];
@@ -94917,7 +94999,7 @@ async function keyText({ context, args }) {
94917
94999
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
94918
95000
  }
94919
95001
  const file4 = flagText({ args, name: "from-file" });
94920
- const text3 = file4 ? await readFile23(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
95002
+ const text3 = file4 ? await readFile24(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
94921
95003
  const trimmed = text3.trim();
94922
95004
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
94923
95005
  return trimmed;
@@ -95306,7 +95388,7 @@ async function conversationDelete({ context, args }) {
95306
95388
  }
95307
95389
 
95308
95390
  // src/services/discord-commands.service.ts
95309
- import { readFile as readFile24 } from "node:fs/promises";
95391
+ import { readFile as readFile25 } from "node:fs/promises";
95310
95392
  import { resolve as resolve15 } from "node:path";
95311
95393
 
95312
95394
  // ../../modules/discord/contract/src/discord.ts
@@ -95654,7 +95736,7 @@ async function secretsOf({ context, args }) {
95654
95736
  const fromConnection = flagText({ args, name: "from-vault" });
95655
95737
  if (fromConnection) return { fromConnection };
95656
95738
  const file4 = flagText({ args, name: "from-file" });
95657
- const text3 = file4 ? await readFile24(resolve15(context.cwd, file4), "utf8") : await context.readStdin();
95739
+ const text3 = file4 ? await readFile25(resolve15(context.cwd, file4), "utf8") : await context.readStdin();
95658
95740
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
95659
95741
  if (lines2.length !== 2) {
95660
95742
  throw new CliUsageError(
@@ -95924,8 +96006,8 @@ var DOMAINS_USAGE = `Usage:
95924
96006
  var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
95925
96007
  `);
95926
96008
  function printDomain(context, row) {
95927
- const join38 = row.autoJoin ? "auto-join on" : "auto-join off";
95928
- context.out(`${row.domain} ${join38}${row.enforced ? " single sign-on enforced" : ""}
96009
+ const join39 = row.autoJoin ? "auto-join on" : "auto-join off";
96010
+ context.out(`${row.domain} ${join39}${row.enforced ? " single sign-on enforced" : ""}
95929
96011
  `);
95930
96012
  }
95931
96013
  async function list5({ context, args }) {
@@ -95957,7 +96039,7 @@ async function domains({ context, args }) {
95957
96039
  }
95958
96040
 
95959
96041
  // src/services/emoji-commands.service.ts
95960
- import { readFile as readFile25 } from "node:fs/promises";
96042
+ import { readFile as readFile26 } from "node:fs/promises";
95961
96043
  import { resolve as resolve16 } from "node:path";
95962
96044
  var EMOJI_USAGE = `Usage:
95963
96045
  laze emoji list [--json] the workspace's custom emoji, aliases and who added each
@@ -95998,7 +96080,7 @@ async function addEmoji({ context, args, client }) {
95998
96080
  const file4 = wordAt4(args, 3);
95999
96081
  let bytes;
96000
96082
  try {
96001
- bytes = new Uint8Array(await readFile25(resolve16(context.cwd, file4)));
96083
+ bytes = new Uint8Array(await readFile26(resolve16(context.cwd, file4)));
96002
96084
  } catch {
96003
96085
  throw new CliUsageError(`Cannot read ${file4}.`);
96004
96086
  }
@@ -96337,7 +96419,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
96337
96419
  var ExternalSharingHooksToken = externalUi.hooks("sharing");
96338
96420
 
96339
96421
  // src/services/workspace-commands.service.ts
96340
- import { readFile as readFile26 } from "node:fs/promises";
96422
+ import { readFile as readFile27 } from "node:fs/promises";
96341
96423
  import { resolve as resolve17 } from "node:path";
96342
96424
  var ROLE_NAMES2 = {
96343
96425
  OWNER: "Owner",
@@ -96520,7 +96602,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
96520
96602
  async function readLogo({ context, file: file4 }) {
96521
96603
  let bytes;
96522
96604
  try {
96523
- bytes = new Uint8Array(await readFile26(resolve17(context.cwd, file4)));
96605
+ bytes = new Uint8Array(await readFile27(resolve17(context.cwd, file4)));
96524
96606
  } catch {
96525
96607
  throw new CliUsageError(`No file to read at ${file4}.`);
96526
96608
  }
@@ -97155,7 +97237,7 @@ async function agentFeedAccess({
97155
97237
  }
97156
97238
 
97157
97239
  // src/services/feed-commands.service.ts
97158
- import { readFile as readFile27 } from "node:fs/promises";
97240
+ import { readFile as readFile28 } from "node:fs/promises";
97159
97241
  import { resolve as resolve18 } from "node:path";
97160
97242
 
97161
97243
  // ../../modules/feed/contract/src/feed.delegate.ts
@@ -98309,7 +98391,7 @@ async function feedTurnOf({
98309
98391
  const read4 = async () => {
98310
98392
  const pinned = env.LAZE_TURN_TOKEN?.trim();
98311
98393
  if (pinned) return pinned;
98312
- if (env.LAZE_TURN_FILE) return (await readFile27(env.LAZE_TURN_FILE, "utf8")).trim();
98394
+ if (env.LAZE_TURN_FILE) return (await readFile28(env.LAZE_TURN_FILE, "utf8")).trim();
98313
98395
  return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
98314
98396
  };
98315
98397
  const turn = await read4().catch(() => "");
@@ -98383,7 +98465,7 @@ async function bodyOf2({
98383
98465
  flags: flags2
98384
98466
  }) {
98385
98467
  const body = { ...flags2.fields };
98386
- const read4 = (source) => "file" in source ? readFile27(resolve18(context.cwd, source.file), "utf8") : source.text;
98468
+ const read4 = (source) => "file" in source ? readFile28(resolve18(context.cwd, source.file), "utf8") : source.text;
98387
98469
  for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
98388
98470
  if (flags2.rich) {
98389
98471
  const text3 = await read4(flags2.rich.source);
@@ -98660,7 +98742,7 @@ async function textFlag({
98660
98742
  }) {
98661
98743
  const value = flagText({ args, name: name3 });
98662
98744
  if (!value.startsWith("@")) return value;
98663
- return readFile27(resolve18(context.cwd, value.slice(1)), "utf8");
98745
+ return readFile28(resolve18(context.cwd, value.slice(1)), "utf8");
98664
98746
  }
98665
98747
  async function feedList({ context, args }) {
98666
98748
  const { client, profile } = await signedIn({ context, args });
@@ -98750,7 +98832,7 @@ async function ranksOf({
98750
98832
  }) {
98751
98833
  const file4 = flagText({ args, name: "file" });
98752
98834
  if (file4) {
98753
- const parsed = JSON.parse(await readFile27(resolve18(context.cwd, file4), "utf8"));
98835
+ const parsed = JSON.parse(await readFile28(resolve18(context.cwd, file4), "utf8"));
98754
98836
  if (Array.isArray(parsed)) return parsed;
98755
98837
  throw new CliUsageError("--file holds a list of {itemId, priority}");
98756
98838
  }
@@ -98865,7 +98947,7 @@ async function feed({ context, args }) {
98865
98947
  }
98866
98948
 
98867
98949
  // src/services/github-commands.service.ts
98868
- import { readFile as readFile28 } from "node:fs/promises";
98950
+ import { readFile as readFile29 } from "node:fs/promises";
98869
98951
 
98870
98952
  // src/rules/github-signature.rules.ts
98871
98953
  var TURN_SEPARATOR = "~";
@@ -98935,7 +99017,7 @@ var REAL_GH = "/usr/bin/gh";
98935
99017
  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>`.";
98936
99018
  async function turnFileToken({ env }) {
98937
99019
  if (!env.LAZE_TURN_FILE) return "";
98938
- return readFile28(env.LAZE_TURN_FILE, "utf8").then(
99020
+ return readFile29(env.LAZE_TURN_FILE, "utf8").then(
98939
99021
  (text3) => text3.trim(),
98940
99022
  () => ""
98941
99023
  );
@@ -98969,7 +99051,7 @@ async function githubGh({
98969
99051
  args: args.rest,
98970
99052
  agentName: profile.name ?? "An agent",
98971
99053
  threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
98972
- readBodyFile: (path) => path === "-" ? context.readStdin() : readFile28(path, "utf8")
99054
+ readBodyFile: (path) => path === "-" ? context.readStdin() : readFile29(path, "utf8")
98973
99055
  });
98974
99056
  return context.runCommand({
98975
99057
  command: [REAL_GH, ...ghArgs],
@@ -99635,11 +99717,11 @@ async function ip({ context, args }) {
99635
99717
  // src/services/join-commands.service.ts
99636
99718
  import { rm as rm16 } from "node:fs/promises";
99637
99719
  import { hostname as hostname9 } from "node:os";
99638
- import { dirname as dirname22, join as join31 } from "node:path";
99720
+ import { dirname as dirname22, join as join32 } from "node:path";
99639
99721
  var DEFAULT_WAIT_SECONDS2 = 100;
99640
99722
  var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
99641
99723
  function pendingPathOf({ context }) {
99642
- return join31(dirname22(context.environment.configPath), "join", "pending.json");
99724
+ return join32(dirname22(context.environment.configPath), "join", "pending.json");
99643
99725
  }
99644
99726
  async function readPending({
99645
99727
  context,
@@ -100921,18 +101003,18 @@ async function serveMcp({
100921
101003
  }
100922
101004
 
100923
101005
  // src/services/memory-commands.service.ts
100924
- import { readdir as readdir7, readFile as readFile30 } from "node:fs/promises";
100925
- import { join as join32, resolve as resolve20 } from "node:path";
101006
+ import { readdir as readdir7, readFile as readFile31 } from "node:fs/promises";
101007
+ import { join as join33, resolve as resolve20 } from "node:path";
100926
101008
 
100927
101009
  // src/services/mount-files.service.ts
100928
- import { mkdir as mkdir11, readFile as readFile29, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
101010
+ import { mkdir as mkdir11, readFile as readFile30, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
100929
101011
  import { dirname as dirname23, relative as relative4, resolve as resolve19 } from "node:path";
100930
101012
  async function textArgument({
100931
101013
  context,
100932
101014
  value
100933
101015
  }) {
100934
101016
  if (value === "-") return context.readStdin();
100935
- if (value.startsWith("@")) return readFile29(resolve19(context.cwd, value.slice(1)), "utf8");
101017
+ if (value.startsWith("@")) return readFile30(resolve19(context.cwd, value.slice(1)), "utf8");
100936
101018
  return value;
100937
101019
  }
100938
101020
  function turnChannel({ context, args }) {
@@ -101079,7 +101161,7 @@ async function turnTokenOf5({ context }) {
101079
101161
  const pinned = env.LAZE_TURN_TOKEN?.trim();
101080
101162
  if (pinned) return pinned;
101081
101163
  if (!env.LAZE_TURN_FILE) return "";
101082
- return readFile30(env.LAZE_TURN_FILE, "utf8").then(
101164
+ return readFile31(env.LAZE_TURN_FILE, "utf8").then(
101083
101165
  (text3) => text3.trim(),
101084
101166
  () => ""
101085
101167
  );
@@ -101209,15 +101291,15 @@ async function siestaImport({
101209
101291
  dir
101210
101292
  }) {
101211
101293
  const root = resolve20(context.cwd, dir);
101212
- const log = await readFile30(join32(root, "LOG.md"));
101213
- const names = (await readdir7(join32(root, "tree")).catch(() => [])).filter(
101294
+ const log = await readFile31(join33(root, "LOG.md"));
101295
+ const names = (await readdir7(join33(root, "tree")).catch(() => [])).filter(
101214
101296
  (name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
101215
101297
  );
101216
101298
  const tree = Object.fromEntries(
101217
101299
  await Promise.all(
101218
101300
  names.map(async (name3) => [
101219
101301
  name3.slice(0, -3),
101220
- (await readFile30(join32(root, "tree", name3))).toString("base64")
101302
+ (await readFile31(join33(root, "tree", name3))).toString("base64")
101221
101303
  ])
101222
101304
  )
101223
101305
  );
@@ -101237,15 +101319,15 @@ async function memoryImport({ context, args }) {
101237
101319
  const dir = flagText({ args, name: "optmem" });
101238
101320
  if (!dir) throw new CliUsageError(USAGE14);
101239
101321
  const root = resolve20(context.cwd, dir);
101240
- const log = await readFile30(join32(root, "LOG.txt"));
101241
- const sizes2 = (await readdir7(join32(root, "TREE")).catch(() => [])).filter(
101322
+ const log = await readFile31(join33(root, "LOG.txt"));
101323
+ const sizes2 = (await readdir7(join33(root, "TREE")).catch(() => [])).filter(
101242
101324
  (name3) => /^\d{1,4}$/.test(name3)
101243
101325
  );
101244
101326
  const tree = Object.fromEntries(
101245
101327
  await Promise.all(
101246
101328
  sizes2.map(async (size) => [
101247
101329
  size,
101248
- (await readFile30(join32(root, "TREE", size))).toString("base64")
101330
+ (await readFile31(join33(root, "TREE", size))).toString("base64")
101249
101331
  ])
101250
101332
  )
101251
101333
  );
@@ -101842,8 +101924,8 @@ async function openclaw({
101842
101924
 
101843
101925
  // src/services/operator-key-commands.service.ts
101844
101926
  import { createHash as createHash10, randomBytes as randomBytes5 } from "node:crypto";
101845
- import { mkdir as mkdir12, readFile as readFile31, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
101846
- import { dirname as dirname24, join as join33 } from "node:path";
101927
+ import { mkdir as mkdir12, readFile as readFile32, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
101928
+ import { dirname as dirname24, join as join34 } from "node:path";
101847
101929
 
101848
101930
  // ../../modules/audit-log/contract/src/audit-log.api.ts
101849
101931
  var auditEntrySchemaDefinition = external_exports.object({
@@ -103683,7 +103765,7 @@ Ops function leases (ADR-214), instead of reading the database:
103683
103765
  call one function of an approved lease; a cut
103684
103766
  list says so and names the cursor of the next page`;
103685
103767
  var POLL_MS3 = 5e3;
103686
- var keyFile = ({ context, keyId }) => join33(dirname24(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
103768
+ var keyFile = ({ context, keyId }) => join34(dirname24(context.environment.configPath), "operator-keys", keyId.replaceAll("/", "_"));
103687
103769
  async function saveSecret({
103688
103770
  context,
103689
103771
  keyId,
@@ -103794,7 +103876,7 @@ async function useKey({
103794
103876
  if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
103795
103877
  const { client } = await signedIn({ context, args });
103796
103878
  const path = keyFile({ context, keyId });
103797
- const secret = await readFile31(path, "utf8").catch(() => null);
103879
+ const secret = await readFile32(path, "utf8").catch(() => null);
103798
103880
  if (secret === null) {
103799
103881
  throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
103800
103882
  }
@@ -103931,7 +104013,7 @@ ${OPS_USAGE}`);
103931
104013
 
103932
104014
  // src/services/release-watch.service.ts
103933
104015
  import { realpath as realpath2 } from "node:fs/promises";
103934
- import { dirname as dirname25, join as join34 } from "node:path";
104016
+ import { dirname as dirname25, join as join35 } from "node:path";
103935
104017
  var RETRY_AFTER_MS = 6 * 60 * 60 * 1e3;
103936
104018
  async function scriptOf(context) {
103937
104019
  const script = context.program.at(-1) ?? "";
@@ -103949,14 +104031,14 @@ async function startedUpdate({
103949
104031
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
103950
104032
  if (plan2.kind !== "install") return null;
103951
104033
  const folder = dirname25(context.environment.configPath);
103952
- const stamp = join34(folder, "auto-update.json");
104034
+ const stamp = join35(folder, "auto-update.json");
103953
104035
  const last = await readStateJson({ path: stamp }) ?? null;
103954
104036
  const now = context.nowMs();
103955
104037
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
103956
104038
  await writeStateJson({ path: stamp, value: { server, atMs: now } });
103957
104039
  context.processes.spawnDetached({
103958
104040
  argv: [...context.program, "update"],
103959
- logPath: join34(folder, "auto-update.log")
104041
+ logPath: join35(folder, "auto-update.log")
103960
104042
  });
103961
104043
  return { manager: plan2.manager };
103962
104044
  }
@@ -104252,8 +104334,8 @@ async function schedule({ context, args }) {
104252
104334
  }
104253
104335
 
104254
104336
  // src/services/skill-commands.service.ts
104255
- import { readdir as readdir8, readFile as readFile32 } from "node:fs/promises";
104256
- import { join as join35, relative as relative5, resolve as resolve22 } from "node:path";
104337
+ import { readdir as readdir8, readFile as readFile33 } from "node:fs/promises";
104338
+ import { join as join36, relative as relative5, resolve as resolve22 } from "node:path";
104257
104339
  var USAGE18 = `Usage:
104258
104340
  laze skill list [--agent <agentId>]
104259
104341
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -104274,8 +104356,8 @@ async function folderFiles({ root }) {
104274
104356
  const files2 = [];
104275
104357
  for (const entry2 of entries) {
104276
104358
  if (!entry2.isFile()) continue;
104277
- const full = join35(entry2.parentPath, entry2.name);
104278
- files2.push({ path: relative5(root, full), content: await readFile32(full, "utf8") });
104359
+ const full = join36(entry2.parentPath, entry2.name);
104360
+ files2.push({ path: relative5(root, full), content: await readFile33(full, "utf8") });
104279
104361
  }
104280
104362
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
104281
104363
  }
@@ -104373,7 +104455,7 @@ async function skillUpdate({ context, args }) {
104373
104455
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
104374
104456
  throw new CliUsageError(USAGE18);
104375
104457
  }
104376
- const skillMd = skillMdFile ? await readFile32(resolve22(context.cwd, skillMdFile), "utf8") : void 0;
104458
+ const skillMd = skillMdFile ? await readFile33(resolve22(context.cwd, skillMdFile), "utf8") : void 0;
104377
104459
  const { client } = await signedIn({ context, args });
104378
104460
  const updated = await client.post("/api/skills/update", {
104379
104461
  name: name3,
@@ -104419,7 +104501,7 @@ async function skill({ context, args }) {
104419
104501
  }
104420
104502
 
104421
104503
  // src/services/slack-commands.service.ts
104422
- import { readFile as readFile33 } from "node:fs/promises";
104504
+ import { readFile as readFile34 } from "node:fs/promises";
104423
104505
  import { resolve as resolve23 } from "node:path";
104424
104506
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
104425
104507
  laze slack overview connected Slack workspaces, mirrors, your link
@@ -104470,7 +104552,7 @@ async function secretLines({ context, args }) {
104470
104552
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
104471
104553
  }
104472
104554
  const file4 = flagText({ args, name: "from-file" });
104473
- const text3 = file4 ? await readFile33(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
104555
+ const text3 = file4 ? await readFile34(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
104474
104556
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
104475
104557
  }
104476
104558
  async function secretsOf2({
@@ -104788,7 +104870,7 @@ async function slack({
104788
104870
  }
104789
104871
 
104790
104872
  // src/services/sso-commands.service.ts
104791
- import { readFile as readFile34 } from "node:fs/promises";
104873
+ import { readFile as readFile35 } from "node:fs/promises";
104792
104874
  var SSO_USAGE = `Usage:
104793
104875
  laze sso domains claimed domains and how each signs in (admins)
104794
104876
  laze sso claim <domain> the TXT record that proves the domain
@@ -104875,7 +104957,7 @@ function refuseSecretFlags({ args }) {
104875
104957
  }
104876
104958
  async function clientSecretOf({ context, args }) {
104877
104959
  const file4 = flagText({ args, name: "from-file" });
104878
- const text3 = file4 ? await readFile34(file4, "utf8") : await context.readStdin();
104960
+ const text3 = file4 ? await readFile35(file4, "utf8") : await context.readStdin();
104879
104961
  const secret = text3.trim();
104880
104962
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
104881
104963
  return secret;
@@ -105219,8 +105301,8 @@ async function checkInstalled({
105219
105301
  }
105220
105302
 
105221
105303
  // src/services/vault-env-commands.service.ts
105222
- import { readFile as readFile35, stat as stat12 } from "node:fs/promises";
105223
- import { dirname as dirname26, join as join36, resolve as resolve24 } from "node:path";
105304
+ import { readFile as readFile36, stat as stat12 } from "node:fs/promises";
105305
+ import { dirname as dirname26, join as join37, resolve as resolve24 } from "node:path";
105224
105306
 
105225
105307
  // src/rules/vault-manifest.rules.ts
105226
105308
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -105602,7 +105684,7 @@ async function manifestPathOf({
105602
105684
  const environment = flagText({ args, name: "env" });
105603
105685
  const file4 = environment ? `.env.${environment}.vault` : ".env.vault";
105604
105686
  for (let dir = resolve24(context.cwd); ; dir = dirname26(dir)) {
105605
- if (await isFile(join36(dir, file4))) return join36(dir, file4);
105687
+ if (await isFile(join37(dir, file4))) return join37(dir, file4);
105606
105688
  if (dirname26(dir) === dir) break;
105607
105689
  }
105608
105690
  throw new CliUsageError(`laze vault: no ${file4} here or in a parent folder
@@ -105613,7 +105695,7 @@ async function manifestOf({
105613
105695
  args
105614
105696
  }) {
105615
105697
  const file4 = await manifestPathOf({ context, args });
105616
- const text3 = await readFile35(file4, "utf8").catch(() => {
105698
+ const text3 = await readFile36(file4, "utf8").catch(() => {
105617
105699
  throw new CliUsageError(`laze vault: cannot read ${file4}`);
105618
105700
  });
105619
105701
  return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
@@ -105975,7 +106057,7 @@ async function vaultScrub({ context, args }) {
105975
106057
  }
105976
106058
 
105977
106059
  // src/services/whatsapp-business-commands.service.ts
105978
- import { readFile as readFile36 } from "node:fs/promises";
106060
+ import { readFile as readFile37 } from "node:fs/promises";
105979
106061
  import { resolve as resolve25 } from "node:path";
105980
106062
 
105981
106063
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
@@ -106472,7 +106554,7 @@ async function secretsOf3({ context, args }) {
106472
106554
  const fromConnection = flagText({ args, name: "from-vault" });
106473
106555
  if (fromConnection) return { fromConnection };
106474
106556
  const file4 = flagText({ args, name: "from-file" });
106475
- const text3 = file4 ? await readFile36(resolve25(context.cwd, file4), "utf8") : await context.readStdin();
106557
+ const text3 = file4 ? await readFile37(resolve25(context.cwd, file4), "utf8") : await context.readStdin();
106476
106558
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
106477
106559
  if (lines2.length !== 2) {
106478
106560
  throw new CliUsageError(
@@ -107679,8 +107761,8 @@ import {
107679
107761
  randomBytes as randomBytes6,
107680
107762
  sign
107681
107763
  } from "node:crypto";
107682
- import { chmod, link, mkdir as mkdir13, readFile as readFile37, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
107683
- import { dirname as dirname27, join as join37 } from "node:path";
107764
+ import { chmod, link, mkdir as mkdir13, readFile as readFile38, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
107765
+ import { dirname as dirname27, join as join38 } from "node:path";
107684
107766
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
107685
107767
  var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve27, reject) => {
107686
107768
  const child = execFile2(
@@ -107720,11 +107802,11 @@ var MachineKeyStore = class _MachineKeyStore {
107720
107802
  });
107721
107803
  }
107722
107804
  get metaPath() {
107723
- return join37(dirname27(this.options.configPath), "machine-key.json");
107805
+ return join38(dirname27(this.options.configPath), "machine-key.json");
107724
107806
  }
107725
107807
  /** Named by the key, so two CLIs making a key at once never overwrite each other's. */
107726
107808
  pemPathOf(jwk) {
107727
- return join37(dirname27(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
107809
+ return join38(dirname27(this.options.configPath), `machine-key-${shortOf(jwk)}.pem`);
107728
107810
  }
107729
107811
  /** The Keychain item's account: one per config file and key. */
107730
107812
  accountOf(jwk) {
@@ -107752,7 +107834,7 @@ var MachineKeyStore = class _MachineKeyStore {
107752
107834
  async read() {
107753
107835
  let meta3;
107754
107836
  try {
107755
- meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile37(this.metaPath, "utf8")));
107837
+ meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile38(this.metaPath, "utf8")));
107756
107838
  } catch {
107757
107839
  return null;
107758
107840
  }
@@ -107767,7 +107849,7 @@ var MachineKeyStore = class _MachineKeyStore {
107767
107849
  "-w"
107768
107850
  ],
107769
107851
  timeoutMs: 1e4
107770
- }) : await readFile37(this.pemPathOf(meta3.jwk), "utf8");
107852
+ }) : await readFile38(this.pemPathOf(meta3.jwk), "utf8");
107771
107853
  return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
107772
107854
  }
107773
107855
  async make() {
@@ -107909,7 +107991,7 @@ function machineProofFetch({
107909
107991
  // src/services/processes.service.ts
107910
107992
  import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
107911
107993
  import { closeSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
107912
- import { readFile as readFile38, readlink } from "node:fs/promises";
107994
+ import { readFile as readFile39, readlink } from "node:fs/promises";
107913
107995
  import { dirname as dirname28 } from "node:path";
107914
107996
  import { promisify as promisify2 } from "node:util";
107915
107997
  var run3 = promisify2(execFile3);
@@ -107923,14 +108005,14 @@ function alive(pid) {
107923
108005
  }
107924
108006
  }
107925
108007
  async function argsOf2(pid) {
107926
- const raw = await readFile38(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
108008
+ const raw = await readFile39(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
107927
108009
  if (raw) return raw.split("\0").filter(Boolean);
107928
108010
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
107929
108011
  const line = listed?.stdout.trim();
107930
108012
  return line ? line.split(/\s+/) : void 0;
107931
108013
  }
107932
108014
  async function parentOf(pid) {
107933
- const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
108015
+ const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
107934
108016
  const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
107935
108017
  if (fromStat > 0) return fromStat;
107936
108018
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
@@ -107938,7 +108020,7 @@ async function parentOf(pid) {
107938
108020
  return parent > 0 ? parent : void 0;
107939
108021
  }
107940
108022
  async function startOf(pid) {
107941
- const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
108023
+ const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
107942
108024
  const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
107943
108025
  if (ticks) return ticks;
107944
108026
  const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);
@@ -108128,7 +108210,7 @@ if (true) {
108128
108210
  err: (text3) => void process.stderr.write(text3),
108129
108211
  readStdin,
108130
108212
  stdoutIsTerminal: process.stdout.isTTY === true,
108131
- lazeInstalls: () => scanLazeInstalls({ env: environment.inherited, home: homedir5() }),
108213
+ lazeInstalls: () => scanLazeInstalls({ env: environment.inherited, home: homedir6() }),
108132
108214
  ...ask ? { ask } : {},
108133
108215
  sleep,
108134
108216
  nowMs: nowMs2,