@lazehq/cli 0.1.57 → 0.1.58

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 +168 -94
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -3440,7 +3440,7 @@ var require_stream = __commonJS({
3440
3440
  };
3441
3441
  duplex._final = function(callback) {
3442
3442
  if (ws.readyState === ws.CONNECTING) {
3443
- ws.once("open", function open3() {
3443
+ ws.once("open", function open4() {
3444
3444
  duplex._final(callback);
3445
3445
  });
3446
3446
  return;
@@ -3461,7 +3461,7 @@ var require_stream = __commonJS({
3461
3461
  };
3462
3462
  duplex._write = function(chunk, encoding, callback) {
3463
3463
  if (ws.readyState === ws.CONNECTING) {
3464
- ws.once("open", function open3() {
3464
+ ws.once("open", function open4() {
3465
3465
  duplex._write(chunk, encoding, callback);
3466
3466
  });
3467
3467
  return;
@@ -35661,7 +35661,8 @@ function cliEnvironment({
35661
35661
  } = {}) {
35662
35662
  return {
35663
35663
  configPath: env.LAZE_CLI_CONFIG || join(homedir(), ".laze", "config.json"),
35664
- // Claude Code names a subagent's commands `claude-code_<version>_agent`.
35664
+ // `claude-code_<version>_agent` may be a subagent; from 2.1.310 the session itself too, so
35665
+ // refuseInSubagent reads the transcripts before it refuses.
35665
35666
  subagent: /^claude-code_.+_agent$/.test(env.AI_AGENT ?? ""),
35666
35667
  profile: env.LAZE_PROFILE || void 0,
35667
35668
  url: env.LAZE_URL || void 0,
@@ -35881,7 +35882,7 @@ function flagText({
35881
35882
  }
35882
35883
 
35883
35884
  // src/rules/cli-version.rules.ts
35884
- var STAMPED = "0.1.57";
35885
+ var STAMPED = "0.1.58";
35885
35886
  function cliVersionOf({ stamped = STAMPED } = {}) {
35886
35887
  return stamped.startsWith("__") ? "dev" : stamped;
35887
35888
  }
@@ -68605,10 +68606,50 @@ import { mkdir as mkdir4, readFile as readFile5, rm, writeFile as writeFile4 } f
68605
68606
  import { dirname as dirname4, join as join5 } from "node:path";
68606
68607
 
68607
68608
  // src/services/harness-session.service.ts
68608
- import { mkdir as mkdir3, readdir, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
68609
- import { hostname as hostname3 } from "node:os";
68609
+ import { mkdir as mkdir3, open as open2, readdir, readFile as readFile3, stat, writeFile as writeFile3 } from "node:fs/promises";
68610
+ import { homedir as homedir2, hostname as hostname3 } from "node:os";
68610
68611
  import { dirname as dirname3, join as join3 } from "node:path";
68611
68612
 
68613
+ // src/rules/claude-subagent.rules.ts
68614
+ function lastCallAtOf({ text: text2, command }) {
68615
+ const lines2 = text2.split("\n");
68616
+ for (let index = lines2.length - 1; index >= 0; index -= 1) {
68617
+ const line = lines2[index]?.trim();
68618
+ if (!line?.startsWith("{")) continue;
68619
+ let entry;
68620
+ try {
68621
+ entry = JSON.parse(line);
68622
+ } catch {
68623
+ continue;
68624
+ }
68625
+ const at = callAtOf({ entry, command });
68626
+ if (at !== null) return at;
68627
+ }
68628
+ return null;
68629
+ }
68630
+ function callAtOf({ entry, command }) {
68631
+ const { type, timestamp, message: message2 } = entry ?? {};
68632
+ if (type !== "assistant" || typeof timestamp !== "string") return null;
68633
+ const content = Array.isArray(message2?.content) ? message2.content : [];
68634
+ const runs = content.some((part) => {
68635
+ const { type: kind2, input: input2 } = part ?? {};
68636
+ return kind2 === "tool_use" && typeof input2?.command === "string" && command.test(input2.command);
68637
+ });
68638
+ if (!runs) return null;
68639
+ try {
68640
+ return Temporal3.Instant.from(timestamp).epochMilliseconds;
68641
+ } catch {
68642
+ return null;
68643
+ }
68644
+ }
68645
+ function newestIsSubagent({
68646
+ session,
68647
+ subagents
68648
+ }) {
68649
+ const newest = Math.max(...subagents.map((at) => at ?? Number.NEGATIVE_INFINITY));
68650
+ return Number.isFinite(newest) && newest >= (session ?? Number.NEGATIVE_INFINITY);
68651
+ }
68652
+
68612
68653
  // src/rules/rush-host.rules.ts
68613
68654
  function rushSessionOf({
68614
68655
  parentArgs
@@ -68897,8 +68938,63 @@ async function liveElsewhere({
68897
68938
  }
68898
68939
  return false;
68899
68940
  }
68900
- function refuseInSubagent({ context, args }) {
68941
+ async function claudeTranscriptOf({
68942
+ context,
68943
+ sessionId
68944
+ }) {
68945
+ const inherited = context.environment.inherited;
68946
+ const root = join3(
68947
+ inherited.CLAUDE_CONFIG_DIR || join3(inherited.HOME || homedir2(), ".claude"),
68948
+ "projects"
68949
+ );
68950
+ const folders = await readdir(root).catch(() => []);
68951
+ const found = await Promise.all(
68952
+ folders.map(async (folder) => {
68953
+ const path = join3(root, folder, `${sessionId}.jsonl`);
68954
+ return stat(path).then(
68955
+ (info) => info.isFile() ? [{ path, at: info.mtimeMs }] : [],
68956
+ () => []
68957
+ );
68958
+ })
68959
+ );
68960
+ return { root, path: found.flat().toSorted((a, b) => b.at - a.at)[0]?.path };
68961
+ }
68962
+ var TAIL_BYTES = 512 * 1024;
68963
+ async function tailOf({ path }) {
68964
+ const handle = await open2(path, "r").catch(() => void 0);
68965
+ if (!handle) return "";
68966
+ try {
68967
+ const { size } = await handle.stat();
68968
+ const length = Math.min(size, TAIL_BYTES);
68969
+ const buffer = Buffer.alloc(length);
68970
+ await handle.read({ buffer, position: size - length, length });
68971
+ return buffer.toString("utf8");
68972
+ } finally {
68973
+ await handle.close();
68974
+ }
68975
+ }
68976
+ async function runsInSubagent({ context, command }) {
68977
+ const sessionId = context.environment.inherited.CLAUDE_CODE_SESSION_ID ?? "";
68978
+ if (!sessionId) return false;
68979
+ const { path } = await claudeTranscriptOf({ context, sessionId });
68980
+ if (!path) return false;
68981
+ const folder = join3(dirname3(path), sessionId, "subagents");
68982
+ const files2 = await readdir(folder).catch(() => []);
68983
+ const subagents = await Promise.all(
68984
+ files2.filter((file3) => file3.endsWith(".jsonl")).map(
68985
+ async (file3) => lastCallAtOf({ text: await tailOf({ path: join3(folder, file3) }), command })
68986
+ )
68987
+ );
68988
+ const session = lastCallAtOf({ text: await tailOf({ path }), command });
68989
+ return newestIsSubagent({ session, subagents });
68990
+ }
68991
+ async function refuseInSubagent({
68992
+ context,
68993
+ args,
68994
+ command
68995
+ }) {
68901
68996
  if (!context.environment.subagent || flagText({ args, name: "session" })) return;
68997
+ if (!await runsInSubagent({ context, command })) return;
68902
68998
  throw new CliUsageError(
68903
68999
  "This runs inside a Claude Code subagent, which shares its parent's session: it would take that session. Run it in the session itself, or pass --session <id>."
68904
69000
  );
@@ -69782,12 +69878,12 @@ function rolloutEventOf({
69782
69878
  }
69783
69879
 
69784
69880
  // src/services/connect-delivery.service.ts
69785
- import { mkdir as mkdir8, readFile as readFile9, rename as rename3, rm as rm2, stat as stat2, writeFile as writeFile7 } from "node:fs/promises";
69786
- import { homedir as homedir2, hostname as hostname4 } from "node:os";
69881
+ import { mkdir as mkdir8, readFile as readFile9, rename as rename3, rm as rm2, stat as stat3, writeFile as writeFile7 } from "node:fs/promises";
69882
+ import { homedir as homedir3, hostname as hostname4 } from "node:os";
69787
69883
  import { dirname as dirname9, join as join11 } from "node:path";
69788
69884
 
69789
69885
  // src/services/codex-turn-watch.service.ts
69790
- import { open as open2, readdir as readdir2 } from "node:fs/promises";
69886
+ import { open as open3, readdir as readdir2 } from "node:fs/promises";
69791
69887
  import { basename as basename3, join as join6 } from "node:path";
69792
69888
  var READ_MS = 1500;
69793
69889
  var KEEP_WORKING_MS = 3e4;
@@ -69806,7 +69902,7 @@ function rolloutPathOf({ delivery }) {
69806
69902
  return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
69807
69903
  }
69808
69904
  async function readFrom({ path, offset }) {
69809
- const handle = await open2(path, "r");
69905
+ const handle = await open3(path, "r");
69810
69906
  try {
69811
69907
  const { size } = await handle.stat();
69812
69908
  if (size <= offset) return { text: "", size };
@@ -70217,18 +70313,18 @@ var RelaySession = class {
70217
70313
  if (!envelope) return;
70218
70314
  const { line, payload } = envelope;
70219
70315
  if (envelope.kind === "open") return this.dial(relay2, line);
70220
- const open3 = this.#lines.get(line);
70221
- if (!open3) return;
70316
+ const open4 = this.#lines.get(line);
70317
+ if (!open4) return;
70222
70318
  if (envelope.kind === "close") {
70223
70319
  this.#lines.delete(line);
70224
- open3.socket.close(1e3);
70320
+ open4.socket.close(1e3);
70225
70321
  return;
70226
70322
  }
70227
70323
  if (envelope.kind !== "text" && envelope.kind !== "binary") return;
70228
70324
  const frame = { data: Buffer.from(payload), binary: envelope.kind === "binary" };
70229
- if (open3.socket.readyState === wrapper_default.OPEN) {
70230
- open3.socket.send(frame.data, { binary: frame.binary });
70231
- } else open3.waiting.push(frame);
70325
+ if (open4.socket.readyState === wrapper_default.OPEN) {
70326
+ open4.socket.send(frame.data, { binary: frame.binary });
70327
+ } else open4.waiting.push(frame);
70232
70328
  }
70233
70329
  /** Dials the gateway for a line; its frames go back to Laze as they came. */
70234
70330
  dial(relay2, line) {
@@ -70322,7 +70418,7 @@ var RelayLoops = class _RelayLoops {
70322
70418
  };
70323
70419
 
70324
70420
  // src/services/rush-listeners.service.ts
70325
- import { readFile as readFile8, readdir as readdir3, stat } from "node:fs/promises";
70421
+ import { readFile as readFile8, readdir as readdir3, stat as stat2 } from "node:fs/promises";
70326
70422
  import { dirname as dirname7, join as join9 } from "node:path";
70327
70423
 
70328
70424
  // src/services/rush-host.service.ts
@@ -70390,7 +70486,7 @@ async function notesOf({ context }) {
70390
70486
  files2.map(async (file3) => {
70391
70487
  const pid = Number(file3.replace(/\.json$/, ""));
70392
70488
  const note = await jsonOf(join9(folder, file3));
70393
- const at = await stat(join9(folder, file3)).then(
70489
+ const at = await stat2(join9(folder, file3)).then(
70394
70490
  (info) => info.mtimeMs,
70395
70491
  () => 0
70396
70492
  );
@@ -70604,7 +70700,7 @@ var CLI_CHANGED_EXIT = 75;
70604
70700
  async function cliStampOf({ context }) {
70605
70701
  const file3 = context.program.at(-1);
70606
70702
  if (!file3) return "";
70607
- return stat2(file3).then(
70703
+ return stat3(file3).then(
70608
70704
  (info) => `${info.mtimeMs}:${info.size}`,
70609
70705
  () => ""
70610
70706
  );
@@ -70647,7 +70743,7 @@ async function takeRound({
70647
70743
  const session = {
70648
70744
  harness: "codex",
70649
70745
  sessionId: delivery.threadId,
70650
- folder: displayFolderOf({ folder: delivery.cwd, home: homedir2() }),
70746
+ folder: displayFolderOf({ folder: delivery.cwd, home: homedir3() }),
70651
70747
  host: hostname4()
70652
70748
  };
70653
70749
  try {
@@ -71305,13 +71401,13 @@ async function monitorServes({
71305
71401
 
71306
71402
  // src/services/codex-link.service.ts
71307
71403
  import { createReadStream } from "node:fs";
71308
- import { readdir as readdir5, rm as rm6, stat as stat4 } from "node:fs/promises";
71404
+ import { readdir as readdir5, rm as rm6, stat as stat5 } from "node:fs/promises";
71309
71405
  import { join as join14, resolve as resolve3 } from "node:path";
71310
71406
  import { createInterface as createInterface2 } from "node:readline";
71311
71407
 
71312
71408
  // src/services/codex-adopt.service.ts
71313
71409
  import { spawn as spawn2 } from "node:child_process";
71314
- import { mkdir as mkdir11, readdir as readdir4, readFile as readFile11, rm as rm5, stat as stat3, writeFile as writeFile10 } from "node:fs/promises";
71410
+ import { mkdir as mkdir11, readdir as readdir4, readFile as readFile11, rm as rm5, stat as stat4, writeFile as writeFile10 } from "node:fs/promises";
71315
71411
  import { dirname as dirname12, join as join13 } from "node:path";
71316
71412
  import { createInterface } from "node:readline";
71317
71413
 
@@ -71436,7 +71532,7 @@ async function newestThreadId({ codexHome }) {
71436
71532
  const files2 = await readdir4(root, { recursive: true }).catch(() => []);
71437
71533
  const rollouts = files2.filter((file3) => /rollout-.*\.jsonl$/.test(file3));
71438
71534
  const dated = await Promise.all(
71439
- rollouts.map(async (file3) => ({ file: file3, at: (await stat3(join13(root, file3))).mtimeMs }))
71535
+ rollouts.map(async (file3) => ({ file: file3, at: (await stat4(join13(root, file3))).mtimeMs }))
71440
71536
  );
71441
71537
  const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
71442
71538
  const id2 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
@@ -71711,7 +71807,7 @@ async function newestThreadIn({
71711
71807
  const dated = await Promise.all(
71712
71808
  rollouts.map(async (file3) => ({
71713
71809
  path: join14(root, file3),
71714
- at: await stat4(join14(root, file3)).then(
71810
+ at: await stat5(join14(root, file3)).then(
71715
71811
  (info) => info.mtimeMs,
71716
71812
  () => 0
71717
71813
  )
@@ -71782,7 +71878,7 @@ async function linkCodexSession({
71782
71878
 
71783
71879
  // src/services/laze-plugin.service.ts
71784
71880
  import { mkdir as mkdir12, readFile as readFile12, writeFile as writeFile11 } from "node:fs/promises";
71785
- import { homedir as homedir3 } from "node:os";
71881
+ import { homedir as homedir4 } from "node:os";
71786
71882
  import { dirname as dirname13, join as join15 } from "node:path";
71787
71883
 
71788
71884
  // src/rules/laze-plugin.rules.ts
@@ -71990,7 +72086,7 @@ async function registerWithClaude({ context, folder }) {
71990
72086
  var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
71991
72087
  async function cachedPluginOf({ context }) {
71992
72088
  const inherited = context.environment.inherited;
71993
- const home = inherited.HOME || homedir3();
72089
+ const home = inherited.HOME || homedir4();
71994
72090
  const claude = inherited.CLAUDE_CONFIG_DIR || join15(home, ".claude");
71995
72091
  const listed = await readFile12(join15(claude, "plugins", "installed_plugins.json"), "utf8").then(
71996
72092
  (text2) => JSON.parse(text2),
@@ -72381,7 +72477,7 @@ function sandboxed({ context, error: error62 }) {
72381
72477
  async function linkAgent({ context, args }) {
72382
72478
  const token2 = flagText({ args, name: "token" });
72383
72479
  if (!token2) throw new CliUsageError("Usage: laze agent link --token <token>");
72384
- refuseInSubagent({ context, args });
72480
+ await refuseInSubagent({ context, args, command: /\bagent\s+link\b/ });
72385
72481
  const url2 = serverUrlOf({ context, args });
72386
72482
  const { harness, pid } = await harnessOf2({ context, args });
72387
72483
  const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
@@ -73340,8 +73436,7 @@ async function setAgentPool({
73340
73436
  }
73341
73437
 
73342
73438
  // src/services/agent-migrate-commands.service.ts
73343
- import { readdir as readdir6, readFile as readFile16, stat as stat5 } from "node:fs/promises";
73344
- import { homedir as homedir4 } from "node:os";
73439
+ import { readFile as readFile16 } from "node:fs/promises";
73345
73440
  import { basename as basename4, join as join17 } from "node:path";
73346
73441
 
73347
73442
  // src/rules/migration-upload.rules.ts
@@ -73517,27 +73612,6 @@ async function cancelMigration({ context, args }) {
73517
73612
  context.out(`Cancelled ${migration.agentName}'s migration; it stays connected on its machine.
73518
73613
  `);
73519
73614
  }
73520
- async function claudeTranscriptOf({
73521
- context,
73522
- sessionId
73523
- }) {
73524
- const inherited = context.environment.inherited;
73525
- const root = join17(
73526
- inherited.CLAUDE_CONFIG_DIR || join17(inherited.HOME || homedir4(), ".claude"),
73527
- "projects"
73528
- );
73529
- const folders = await readdir6(root).catch(() => []);
73530
- const found = await Promise.all(
73531
- folders.map(async (folder) => {
73532
- const path = join17(root, folder, `${sessionId}.jsonl`);
73533
- return stat5(path).then(
73534
- (info) => info.isFile() ? [{ path, at: info.mtimeMs }] : [],
73535
- () => []
73536
- );
73537
- })
73538
- );
73539
- return { root, path: found.flat().toSorted((a, b) => b.at - a.at)[0]?.path };
73540
- }
73541
73615
  async function transcriptOf({ context, ticket }) {
73542
73616
  const inherited = context.environment.inherited;
73543
73617
  const own2 = ticket.source === "codex" ? inherited.CODEX_THREAD_ID : inherited.CLAUDE_CODE_SESSION_ID;
@@ -73677,7 +73751,7 @@ async function bindAgentSession({
73677
73751
  context,
73678
73752
  args
73679
73753
  }) {
73680
- refuseInSubagent({ context, args });
73754
+ await refuseInSubagent({ context, args, command: /\bagent\s+bind\b/ });
73681
73755
  const session = await currentSessionOf({ context, args });
73682
73756
  if (!session) throw new CliUsageError(NO_SESSION);
73683
73757
  const key = sessionKeyOf({ session });
@@ -73823,7 +73897,7 @@ async function requestAgent({ context, args }) {
73823
73897
  }
73824
73898
 
73825
73899
  // src/services/app-commands.service.ts
73826
- import { mkdir as mkdir16, readdir as readdir7, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
73900
+ import { mkdir as mkdir16, readdir as readdir6, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
73827
73901
  import { dirname as dirname16, join as join20, relative as relative3, resolve as resolve6, sep as sep3 } from "node:path";
73828
73902
 
73829
73903
  // ../../modules/app/contract/src/app.connections.ts
@@ -76260,16 +76334,16 @@ function print({
76260
76334
  async function appConnections({
76261
76335
  context,
76262
76336
  args,
76263
- open: open3
76337
+ open: open4
76264
76338
  }) {
76265
- const { client, appId, name: name3 } = await open3();
76339
+ const { client, appId, name: name3 } = await open4();
76266
76340
  const listed = await client.post("/api/apps/connections", { appId });
76267
76341
  print({ context, args, value: listed, text: connectionsText({ name: name3, listed }) });
76268
76342
  }
76269
76343
  async function appConnection({
76270
76344
  context,
76271
76345
  args,
76272
- open: open3
76346
+ open: open4
76273
76347
  }) {
76274
76348
  const [, , verb, connection] = args.words;
76275
76349
  if (verb !== "allow" && verb !== "revoke" || !connection) {
@@ -76278,7 +76352,7 @@ async function appConnection({
76278
76352
  if (verb) throw new CliUsageError(USAGE2);
76279
76353
  return;
76280
76354
  }
76281
- const { client, appId, name: name3 } = await open3();
76355
+ const { client, appId, name: name3 } = await open4();
76282
76356
  const listed = await client.post(`/api/apps/connections/${verb}`, { appId, connection }).catch((error62) => {
76283
76357
  if (!(error62 instanceof LazeApiError) || error62.code !== "permission_denied") throw error62;
76284
76358
  throw new CliUsageError(
@@ -76307,40 +76381,40 @@ function appAndWord({ args, usage }) {
76307
76381
  if (!word3) throw new CliUsageError(usage);
76308
76382
  return { app: app2, word: word3 };
76309
76383
  }
76310
- var rename4 = async ({ context, args, open: open3 }) => {
76384
+ var rename4 = async ({ context, args, open: open4 }) => {
76311
76385
  const { app: app2, word: word3 } = appAndWord({ args, usage: "Usage: laze app rename [app] <new name>" });
76312
- const { client, appId, name: name3 } = await open3(app2);
76386
+ const { client, appId, name: name3 } = await open4(app2);
76313
76387
  const renamed = await client.post("/api/apps/rename", { appId, name: word3 });
76314
76388
  print2({ context, args, value: renamed, text: `${name3} is now called ${renamed.name}.
76315
76389
  ` });
76316
76390
  };
76317
- var archive = async ({ context, args, open: open3 }) => {
76318
- const { client, appId } = await open3(args.words[2]);
76391
+ var archive = async ({ context, args, open: open4 }) => {
76392
+ const { client, appId } = await open4(args.words[2]);
76319
76393
  const archived = await client.post("/api/apps/archive", { appId });
76320
76394
  const text2 = `Archived ${archived.name}: it serves nothing and keeps its versions and data. laze app unarchive brings it back.
76321
76395
  `;
76322
76396
  print2({ context, args, value: archived, text: text2 });
76323
76397
  };
76324
- var unarchive = async ({ context, args, open: open3 }) => {
76325
- const { client, appId } = await open3(args.words[2]);
76398
+ var unarchive = async ({ context, args, open: open4 }) => {
76399
+ const { client, appId } = await open4(args.words[2]);
76326
76400
  const back = await client.post("/api/apps/unarchive", { appId });
76327
76401
  const text2 = `${back.name} is back at the same addresses.
76328
76402
  `;
76329
76403
  print2({ context, args, value: back, text: text2 });
76330
76404
  };
76331
- var remove = async ({ context, args, open: open3 }) => {
76405
+ var remove = async ({ context, args, open: open4 }) => {
76332
76406
  const confirmName = flagText({ args, name: "confirm" });
76333
76407
  if (!confirmName) {
76334
76408
  throw new CliUsageError("Usage: laze app delete [app] --confirm <the app's name>");
76335
76409
  }
76336
- const { client, appId, name: name3 } = await open3(args.words[2]);
76410
+ const { client, appId, name: name3 } = await open4(args.words[2]);
76337
76411
  await client.post("/api/apps/delete", { appId, confirmName });
76338
76412
  const text2 = `Deleted ${name3}: it stopped serving and is gone from the workspace.
76339
76413
  `;
76340
76414
  print2({ context, args, value: { deleted: appId }, text: text2 });
76341
76415
  };
76342
- var revokeLease = async ({ context, args, open: open3 }) => {
76343
- const { client, appId, name: name3 } = await open3(args.words[2]);
76416
+ var revokeLease = async ({ context, args, open: open4 }) => {
76417
+ const { client, appId, name: name3 } = await open4(args.words[2]);
76344
76418
  const app2 = await client.post("/api/apps/publish/revoke-lease", { appId });
76345
76419
  const text2 = `${name3}'s builder asks for an approval again before its next public publish.
76346
76420
  `;
@@ -76368,18 +76442,18 @@ function backupsText({ name: name3, status: status9 }) {
76368
76442
  return `${name3}: ${replicating} ${window2}
76369
76443
  ${restores.join("")}`;
76370
76444
  }
76371
- var backups = async ({ context, args, open: open3 }) => {
76372
- const { client, appId, name: name3 } = await open3(args.words[2]);
76445
+ var backups = async ({ context, args, open: open4 }) => {
76446
+ const { client, appId, name: name3 } = await open4(args.words[2]);
76373
76447
  const status9 = await client.post("/api/apps/backups", { appId });
76374
76448
  print2({ context, args, value: status9, text: backupsText({ name: name3, status: status9 }) });
76375
76449
  };
76376
- var restore = async ({ context, args, open: open3 }) => {
76450
+ var restore = async ({ context, args, open: open4 }) => {
76377
76451
  const to = flagText({ args, name: "to" });
76378
76452
  const undo = flagText({ args, name: "undo" });
76379
76453
  if (Boolean(to) === Boolean(undo)) {
76380
76454
  throw new CliUsageError("Usage: laze app restore [app] --to <ISO time> | --undo <restore-id>");
76381
76455
  }
76382
- const { client, appId, name: name3 } = await open3(args.words[2]);
76456
+ const { client, appId, name: name3 } = await open4(args.words[2]);
76383
76457
  const done = await client.post("/api/apps/backups/restore", {
76384
76458
  appId,
76385
76459
  ...to ? { to } : { undo }
@@ -76405,16 +76479,16 @@ function usersText({ name: name3, users: users2 }) {
76405
76479
  return `${name3}'s app users:
76406
76480
  ${lines2.join("")}`;
76407
76481
  }
76408
- var users = async ({ context, args, open: open3 }) => {
76409
- const { client, appId, name: name3 } = await open3(args.words[2]);
76482
+ var users = async ({ context, args, open: open4 }) => {
76483
+ const { client, appId, name: name3 } = await open4(args.words[2]);
76410
76484
  const listed = await client.post("/api/apps/users", { appId });
76411
76485
  print2({ context, args, value: listed, text: usersText({ name: name3, users: listed }) });
76412
76486
  };
76413
76487
  function blocking(blocked) {
76414
- return async ({ context, args, open: open3 }) => {
76488
+ return async ({ context, args, open: open4 }) => {
76415
76489
  const verb = blocked ? "block-user" : "unblock-user";
76416
76490
  const { app: app2, word: word3 } = appAndWord({ args, usage: `Usage: laze app ${verb} [app] <user-id>` });
76417
- const { client, appId, name: name3 } = await open3(app2);
76491
+ const { client, appId, name: name3 } = await open4(app2);
76418
76492
  const listed = await client.post("/api/apps/users/block", {
76419
76493
  appId,
76420
76494
  userId: word3,
@@ -76423,9 +76497,9 @@ function blocking(blocked) {
76423
76497
  print2({ context, args, value: listed, text: usersText({ name: name3, users: listed }) });
76424
76498
  };
76425
76499
  }
76426
- var deleteUser = async ({ context, args, open: open3 }) => {
76500
+ var deleteUser = async ({ context, args, open: open4 }) => {
76427
76501
  const { app: app2, word: word3 } = appAndWord({ args, usage: "Usage: laze app delete-user [app] <user-id>" });
76428
- const { client, appId, name: name3 } = await open3(app2);
76502
+ const { client, appId, name: name3 } = await open4(app2);
76429
76503
  const gone = await client.post("/api/apps/users/delete", { appId, userId: word3 });
76430
76504
  const text2 = `Deleted ${gone.userId} from ${name3} with the ${gone.removedRecords.toString()} records they owned.
76431
76505
  `;
@@ -76498,10 +76572,10 @@ async function appPinCommand({
76498
76572
  context,
76499
76573
  args,
76500
76574
  verb,
76501
- open: open3
76575
+ open: open4
76502
76576
  }) {
76503
76577
  const channel = flagText({ args, name: "channel" });
76504
- const { client, appId, name: name3 } = await open3();
76578
+ const { client, appId, name: name3 } = await open4();
76505
76579
  const role2 = verb === "pin" ? pinRoleOf(args) : void 0;
76506
76580
  const listed = await client.post(`/api/apps/${verb}`, {
76507
76581
  appId,
@@ -76793,26 +76867,26 @@ function print4({
76793
76867
  context.out(args.flags.json ? `${JSON.stringify(value, null, 2)}
76794
76868
  ` : text2);
76795
76869
  }
76796
- async function add({ context, args, open: open3, word: word3 }) {
76870
+ async function add({ context, args, open: open4, word: word3 }) {
76797
76871
  const prompt = flagText({ args, name: "prompt" }).trim();
76798
76872
  if (!prompt) throw new CliUsageError("--prompt says what the agent does with the records");
76799
76873
  const body = { collection: word3, on: onOf(args), where: whereOf3(args), prompt };
76800
- const { client, appId, name: name3 } = await open3();
76874
+ const { client, appId, name: name3 } = await open4();
76801
76875
  const trigger = await client.post("/api/apps/triggers/add", { appId, ...body });
76802
76876
  const text2 = `Added a trigger on ${name3}:
76803
76877
  ${triggerLine(trigger)}Matching changes to ${word3} records wake ${trigger.agentName} in ${trigger.channelName}.
76804
76878
  `;
76805
76879
  print4({ context, args, value: trigger, text: text2 });
76806
76880
  }
76807
- async function list({ context, args, open: open3 }) {
76808
- const { client, appId, name: name3 } = await open3();
76881
+ async function list({ context, args, open: open4 }) {
76882
+ const { client, appId, name: name3 } = await open4();
76809
76883
  const listed = await client.post("/api/apps/triggers", { appId });
76810
76884
  const text2 = listed.triggers.length === 0 ? `${name3} has no triggers. laze app trigger add <collection> adds one.
76811
76885
  ` : listed.triggers.map(triggerLine).join("");
76812
76886
  print4({ context, args, value: listed, text: text2 });
76813
76887
  }
76814
- async function setPaused({ context, args, open: open3, word: word3, paused }) {
76815
- const { client, appId } = await open3();
76888
+ async function setPaused({ context, args, open: open4, word: word3, paused }) {
76889
+ const { client, appId } = await open4();
76816
76890
  const trigger = await client.post("/api/apps/triggers/pause", {
76817
76891
  appId,
76818
76892
  triggerId: word3,
@@ -76820,8 +76894,8 @@ async function setPaused({ context, args, open: open3, word: word3, paused }) {
76820
76894
  });
76821
76895
  print4({ context, args, value: trigger, text: triggerLine(trigger) });
76822
76896
  }
76823
- async function remove2({ context, args, open: open3, word: word3 }) {
76824
- const { client, appId } = await open3();
76897
+ async function remove2({ context, args, open: open4, word: word3 }) {
76898
+ const { client, appId } = await open4();
76825
76899
  await client.post("/api/apps/triggers/remove", { appId, triggerId: word3 });
76826
76900
  print4({ context, args, value: { removed: word3 }, text: `Removed trigger ${word3}.
76827
76901
  ` });
@@ -76829,14 +76903,14 @@ async function remove2({ context, args, open: open3, word: word3 }) {
76829
76903
  async function appTrigger({
76830
76904
  context,
76831
76905
  args,
76832
- open: open3
76906
+ open: open4
76833
76907
  }) {
76834
76908
  const [, , verb, word3] = args.words;
76835
- if (verb === "list") return list({ context, args, open: open3 });
76909
+ if (verb === "list") return list({ context, args, open: open4 });
76836
76910
  const known = verb === "add" || verb === "pause" || verb === "resume" || verb === "remove";
76837
76911
  if (known && !word3) throw new CliUsageError(USAGE4);
76838
76912
  if (known && word3) {
76839
- const run4 = { context, args, open: open3, word: word3 };
76913
+ const run4 = { context, args, open: open4, word: word3 };
76840
76914
  if (verb === "add") return add(run4);
76841
76915
  if (verb === "remove") return remove2(run4);
76842
76916
  return setPaused({ ...run4, paused: verb === "pause" });
@@ -76957,7 +77031,7 @@ async function listFiles(folder) {
76957
77031
  const pending2 = [folder];
76958
77032
  while (pending2.length > 0 && found.length <= MAX_FILES) {
76959
77033
  const current2 = pending2.pop() ?? folder;
76960
- for (const entry of await readdir7(current2, { withFileTypes: true })) {
77034
+ for (const entry of await readdir6(current2, { withFileTypes: true })) {
76961
77035
  const path = join20(current2, entry.name);
76962
77036
  const rel = relative3(folder, path).split(sep3).join("/");
76963
77037
  if (isSkippedPath({ path: rel })) continue;
@@ -77173,7 +77247,7 @@ async function folderClaim({
77173
77247
  folder,
77174
77248
  appId
77175
77249
  }) {
77176
- const entries = await readdir7(folder).catch(() => []);
77250
+ const entries = await readdir6(folder).catch(() => []);
77177
77251
  if (entries.length === 0) return "empty";
77178
77252
  const manifest = await readManifest(folder).catch(() => void 0);
77179
77253
  if (!manifest) return "other-files";
@@ -89232,7 +89306,7 @@ async function schedule({ context, args }) {
89232
89306
  }
89233
89307
 
89234
89308
  // src/services/skill-commands.service.ts
89235
- import { readdir as readdir8, readFile as readFile38 } from "node:fs/promises";
89309
+ import { readdir as readdir7, readFile as readFile38 } from "node:fs/promises";
89236
89310
  import { join as join26, relative as relative6, resolve as resolve16 } from "node:path";
89237
89311
  var USAGE15 = `Usage:
89238
89312
  laze skill list [--agent <agentId>]
@@ -89250,7 +89324,7 @@ var USAGE15 = `Usage:
89250
89324
  --agent names the agent with a person's key; an agent's key works on its own skills.
89251
89325
  With a person's key, list without --agent shows every agent's skills.`;
89252
89326
  async function folderFiles({ root }) {
89253
- const entries = await readdir8(root, { recursive: true, withFileTypes: true });
89327
+ const entries = await readdir7(root, { recursive: true, withFileTypes: true });
89254
89328
  const files2 = [];
89255
89329
  for (const entry of entries) {
89256
89330
  if (!entry.isFile()) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazehq/cli",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "description": "The Laze command line: sign in, read and post in chat, and connect your own Claude Code or Codex session as an agent.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",