@lazehq/cli 0.1.27 → 0.1.29

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 +565 -199
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -18733,8 +18733,8 @@ var require_snapshot_utils = __commonJS({
18733
18733
  var require_snapshot_recorder = __commonJS({
18734
18734
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
18735
18735
  "use strict";
18736
- var { writeFile: writeFile22, readFile: readFile37, mkdir: mkdir20 } = __require("node:fs/promises");
18737
- var { dirname: dirname20, resolve: resolve17 } = __require("node:path");
18736
+ var { writeFile: writeFile23, readFile: readFile38, mkdir: mkdir21 } = __require("node:fs/promises");
18737
+ var { dirname: dirname21, resolve: resolve17 } = __require("node:path");
18738
18738
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
18739
18739
  var { InvalidArgumentError, UndiciError } = require_errors();
18740
18740
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -18950,7 +18950,7 @@ var require_snapshot_recorder = __commonJS({
18950
18950
  throw new InvalidArgumentError("Snapshot path is required");
18951
18951
  }
18952
18952
  try {
18953
- const data = await readFile37(resolve17(path), "utf8");
18953
+ const data = await readFile38(resolve17(path), "utf8");
18954
18954
  const parsed = JSON.parse(data);
18955
18955
  if (Array.isArray(parsed)) {
18956
18956
  this.#snapshots.clear();
@@ -18980,12 +18980,12 @@ var require_snapshot_recorder = __commonJS({
18980
18980
  throw new InvalidArgumentError("Snapshot path is required");
18981
18981
  }
18982
18982
  const resolvedPath = resolve17(path);
18983
- await mkdir20(dirname20(resolvedPath), { recursive: true });
18983
+ await mkdir21(dirname21(resolvedPath), { recursive: true });
18984
18984
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
18985
18985
  hash: hash2,
18986
18986
  snapshot
18987
18987
  }));
18988
- await writeFile22(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
18988
+ await writeFile23(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
18989
18989
  }
18990
18990
  /**
18991
18991
  * Clears all recorded snapshots
@@ -35506,6 +35506,8 @@ function cliEnvironment({
35506
35506
  } = {}) {
35507
35507
  return {
35508
35508
  configPath: env.LAZE_CLI_CONFIG || join(homedir(), ".laze", "config.json"),
35509
+ // Claude Code names a subagent's commands `claude-code_<version>_agent`.
35510
+ subagent: /^claude-code_.+_agent$/.test(env.AI_AGENT ?? ""),
35509
35511
  profile: env.LAZE_PROFILE || void 0,
35510
35512
  url: env.LAZE_URL || void 0,
35511
35513
  opsToken: env.LAZE_OPS_TOKEN || void 0,
@@ -35611,12 +35613,12 @@ var ConfigStore = class _ConfigStore {
35611
35613
  };
35612
35614
  function chooseProfile({
35613
35615
  config: config2,
35614
- flag,
35616
+ flag: flag2,
35615
35617
  environment,
35616
35618
  cwd
35617
35619
  }) {
35618
35620
  const bound = boundProfileOf({ bindings: config2.bindings, cwd });
35619
- const name2 = flag || environment || bound || config2.current;
35621
+ const name2 = flag2 || environment || bound || config2.current;
35620
35622
  const profile = name2 ? config2.profiles[name2] : void 0;
35621
35623
  return name2 && profile ? { name: name2, profile } : { name: void 0, profile: void 0 };
35622
35624
  }
@@ -35705,7 +35707,7 @@ function flagText({
35705
35707
  }
35706
35708
 
35707
35709
  // src/rules/cli-version.rules.ts
35708
- var STAMPED = "0.1.27";
35710
+ var STAMPED = "0.1.29";
35709
35711
  function cliVersionOf({ stamped = STAMPED } = {}) {
35710
35712
  return stamped.startsWith("__") ? "dev" : stamped;
35711
35713
  }
@@ -61862,6 +61864,13 @@ var VAULT_GMAIL_SEND_PATHS = [
61862
61864
  "/upload/gmail/v1/users/*/drafts/send"
61863
61865
  ];
61864
61866
  var VAULT_MAX_LEASE_SECONDS = 2 * 86400;
61867
+ var VAULT_LEASE_CHOICES = [
61868
+ 15 * 60,
61869
+ 3600,
61870
+ 8 * 3600,
61871
+ 86400,
61872
+ VAULT_MAX_LEASE_SECONDS
61873
+ ];
61865
61874
  var vaultConnectionSchemaDefinition = external_exports.object({
61866
61875
  id: external_exports.string().min(1),
61867
61876
  workspaceId: external_exports.string().min(1),
@@ -61874,7 +61883,7 @@ var vaultConnectionSchemaDefinition = external_exports.object({
61874
61883
  rules: external_exports.string(),
61875
61884
  /** Who answers an ask on a workspace or agent keychain; a personal one asks its owner. */
61876
61885
  approverUserIds: external_exports.array(external_exports.string().min(1)),
61877
- /** The longest lease an approver may give, set by an admin. */
61886
+ /** How long an approval lasts for the agent; null takes the deployment's default, 2 days. */
61878
61887
  maxLeaseSeconds: external_exports.number().int().positive().nullable(),
61879
61888
  /** Every use asks a person: no lease is offered and none covers it. */
61880
61889
  everyUseAsks: external_exports.boolean().default(false),
@@ -62190,16 +62199,28 @@ var vaultMostAskedSchemaDefinition = external_exports.object({
62190
62199
  )
62191
62200
  });
62192
62201
  var vaultMostAskedSchema = vaultMostAskedSchemaDefinition;
62202
+ var vaultUseOriginSchema = external_exports.enum(["computer", "connected"]);
62193
62203
  var vaultConnectionUseSchemaDefinition = external_exports.object({
62194
62204
  at: external_exports.iso.datetime(),
62195
62205
  action: external_exports.string(),
62196
62206
  outcome: external_exports.string(),
62207
+ /** Who used it: a person (`user`), an agent, or Laze itself (`system`). */
62208
+ actorKind: external_exports.enum(["user", "agent", "system"]).default("system"),
62209
+ actorId: external_exports.string().nullable().default(null),
62197
62210
  agentId: external_exports.string().nullable(),
62198
62211
  requesterUserId: external_exports.string().nullable(),
62199
62212
  channelId: external_exports.string().nullable(),
62200
62213
  reason: external_exports.string().nullable(),
62201
62214
  /** The command or tool, as the use named it. */
62202
- command: external_exports.array(external_exports.string())
62215
+ command: external_exports.array(external_exports.string()),
62216
+ /** What let it through, such as `approval`, `lease`, `judge` or `sensitivity`. */
62217
+ decider: external_exports.string().nullable().default(null),
62218
+ /** The approval card the use came under; uses under one lease share it. */
62219
+ requestId: external_exports.string().nullable().default(null),
62220
+ leaseId: external_exports.string().nullable().default(null),
62221
+ origin: vaultUseOriginSchema.nullable().default(null),
62222
+ /** How a person's read happened: `page` (Reveal) or `own_secret` (the CLI or Laze for them). */
62223
+ via: external_exports.string().nullable().default(null)
62203
62224
  });
62204
62225
  var vaultConnectionUseSchema = vaultConnectionUseSchemaDefinition;
62205
62226
  var vaultRevokeAtProviderSchema = external_exports.enum(["revoked", "failed", "not_supported"]);
@@ -62334,6 +62355,39 @@ var vaultConfig = Config.define((c) => ({
62334
62355
  auditHeadFile: c.env("VAULT_AUDIT_HEAD_FILE", external_exports.string().min(1).optional())
62335
62356
  }));
62336
62357
 
62358
+ // ../../modules/vault/contract/src/vault-levels.ts
62359
+ var LEVEL_LABELS = {
62360
+ auto: "Allow",
62361
+ checked: "Auto",
62362
+ ask: "Always ask",
62363
+ human_only: "Human only"
62364
+ };
62365
+ function vaultLevelLabel(level) {
62366
+ return LEVEL_LABELS[level];
62367
+ }
62368
+ var CLI_LEVELS = {
62369
+ auto: "allow",
62370
+ checked: "auto",
62371
+ ask: "always-ask",
62372
+ human_only: "human-only"
62373
+ };
62374
+ var VAULT_CLI_LEVEL_NAMES = [
62375
+ "allow",
62376
+ "auto",
62377
+ "always-ask",
62378
+ "human-only"
62379
+ ];
62380
+ function vaultCliLevelOf(level) {
62381
+ return CLI_LEVELS[level];
62382
+ }
62383
+ function vaultLevelOfCliName(name2) {
62384
+ const wanted = name2.toLowerCase();
62385
+ const found = Object.keys(CLI_LEVELS).find(
62386
+ (level) => CLI_LEVELS[level] === wanted
62387
+ );
62388
+ return found ?? "unknown";
62389
+ }
62390
+
62337
62391
  // ../../modules/vault/contract/src/vault.errors.ts
62338
62392
  var VaultSealMismatchError = class extends HandledError {
62339
62393
  constructor() {
@@ -64106,6 +64160,11 @@ var setAgentHostInputSchemaDefinition = external_exports.object({
64106
64160
  agentId: idSchema14,
64107
64161
  host: agentHostSchemaDefinition.nullable()
64108
64162
  });
64163
+ var setAgentComputerKeyInputSchemaDefinition = external_exports.object({
64164
+ workspaceId: workspaceIdSchema10,
64165
+ agentId: idSchema14,
64166
+ computerKey: external_exports.string().min(1).max(200).nullable()
64167
+ });
64109
64168
  var agentSchemaDefinition = external_exports.object({
64110
64169
  id: idSchema14,
64111
64170
  workspaceId: workspaceIdSchema10,
@@ -64136,6 +64195,8 @@ var agentSchemaDefinition = external_exports.object({
64136
64195
  pauseReason: external_exports.string().nullable().default(null),
64137
64196
  /** The owner's own machine the agent's turns run on; null for a Laze sandbox. */
64138
64197
  host: agentHostSchemaDefinition.nullable().default(null),
64198
+ /** The Laze computer it runs on, as compute names it; null for its owner's default computer. */
64199
+ computerKey: external_exports.string().nullable().default(null),
64139
64200
  /** The login pool a Claude Code or Codex agent draws from; null for its owner's own logins. */
64140
64201
  loginPoolId: external_exports.string().nullable().default(null),
64141
64202
  /** The login it runs on now, "On Work Max"; null before its first turn and on other harnesses. */
@@ -66918,6 +66979,12 @@ async function liveElsewhere({
66918
66979
  }
66919
66980
  return false;
66920
66981
  }
66982
+ function refuseInSubagent({ context, args }) {
66983
+ if (!context.environment.subagent || flagText({ args, name: "session" })) return;
66984
+ throw new CliUsageError(
66985
+ "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>."
66986
+ );
66987
+ }
66921
66988
  function notBoundText({
66922
66989
  meta: meta3,
66923
66990
  agent: agent2,
@@ -67709,8 +67776,8 @@ async function takeLock({
67709
67776
  const self2 = context.processes.pid;
67710
67777
  if (holder && holder.pid !== self2 && context.processes.alive(holder.pid)) {
67711
67778
  const served = await holderClaudeOf({ context, holder });
67712
- const mine3 = preempt && served === claudePid && !holder.monitor;
67713
- if (served && context.processes.alive(served) && !mine3) return false;
67779
+ const mine4 = preempt && served === claudePid && !holder.monitor;
67780
+ if (served && context.processes.alive(served) && !mine4) return false;
67714
67781
  context.processes.stop(holder.pid);
67715
67782
  }
67716
67783
  await mkdir6(dirname6(path), { recursive: true, mode: 448 });
@@ -69432,6 +69499,7 @@ async function linkCodexSession({
69432
69499
 
69433
69500
  // src/services/laze-plugin.service.ts
69434
69501
  import { mkdir as mkdir11, readFile as readFile11, writeFile as writeFile11 } from "node:fs/promises";
69502
+ import { homedir as homedir3 } from "node:os";
69435
69503
  import { dirname as dirname11, join as join13 } from "node:path";
69436
69504
 
69437
69505
  // src/rules/laze-plugin.rules.ts
@@ -69572,15 +69640,7 @@ async function writeLazePlugin({ context }) {
69572
69640
  }
69573
69641
  return folder;
69574
69642
  }
69575
- async function registerWithClaude({ context, folder }) {
69576
- const quiet = ">/dev/null 2>&1 </dev/null";
69577
- const script = [
69578
- `claude plugin marketplace add ${quote2(folder)} --scope user ${quiet}`,
69579
- `claude plugin marketplace update ${LAZE_PLUGIN} ${quiet}`,
69580
- // install is a no-op for a plugin Claude Code already has; update refreshes its cached copy.
69581
- `{ claude plugin install ${LAZE_PLUGIN}@${LAZE_PLUGIN} --scope user ${quiet} || true; }`,
69582
- `claude plugin update ${LAZE_PLUGIN}@${LAZE_PLUGIN} ${quiet}`
69583
- ].join("; ");
69643
+ async function claudeScript({ context, script }) {
69584
69644
  const stop3 = new AbortController();
69585
69645
  const command = ["sh", "-c", script];
69586
69646
  const run4 = context.runCommand({ command, env: {}, signal: stop3.signal }).catch(() => 1);
@@ -69591,6 +69651,44 @@ async function registerWithClaude({ context, folder }) {
69591
69651
  stop3.abort();
69592
69652
  return code === 0;
69593
69653
  }
69654
+ var QUIET = ">/dev/null 2>&1 </dev/null";
69655
+ async function registerWithClaude({ context, folder }) {
69656
+ const script = [
69657
+ `claude plugin marketplace add ${quote2(folder)} --scope user ${QUIET}`,
69658
+ `claude plugin marketplace update ${LAZE_PLUGIN} ${QUIET}`,
69659
+ // install is a no-op for a plugin Claude Code already has; update refreshes its cached copy.
69660
+ `{ claude plugin install ${LAZE_PLUGIN}@${LAZE_PLUGIN} --scope user ${QUIET} || true; }`,
69661
+ `claude plugin update ${LAZE_PLUGIN}@${LAZE_PLUGIN} ${QUIET}`
69662
+ ].join("; ");
69663
+ return claudeScript({ context, script });
69664
+ }
69665
+ var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
69666
+ async function cachedPluginOf({ context }) {
69667
+ const inherited = context.environment.inherited;
69668
+ const home = inherited.HOME || homedir3();
69669
+ const claude = inherited.CLAUDE_CONFIG_DIR || join13(home, ".claude");
69670
+ const listed = await readFile11(join13(claude, "plugins", "installed_plugins.json"), "utf8").then(
69671
+ (text2) => JSON.parse(text2),
69672
+ () => void 0
69673
+ );
69674
+ return listed?.plugins?.[`${LAZE_PLUGIN}@${LAZE_PLUGIN}`]?.[0]?.installPath;
69675
+ }
69676
+ async function refreshStaleCache({ context, folder }) {
69677
+ const cached2 = await cachedPluginOf({ context });
69678
+ if (!cached2) return true;
69679
+ const read3 = (path) => readFile11(path, "utf8").catch(() => "");
69680
+ for (const file3 of RUN_FILES) {
69681
+ const ours = await read3(join13(folder, LAZE_PLUGIN, file3));
69682
+ if (ours === await read3(join13(cached2, file3))) continue;
69683
+ const plugin2 = `${LAZE_PLUGIN}@${LAZE_PLUGIN}`;
69684
+ const script = [
69685
+ `claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
69686
+ `claude plugin install ${plugin2} --scope user ${QUIET}`
69687
+ ].join("; ");
69688
+ return claudeScript({ context, script });
69689
+ }
69690
+ return true;
69691
+ }
69594
69692
  function registeredMarkOf({ context }) {
69595
69693
  return join13(pluginFolderOf({ context }), "registered");
69596
69694
  }
@@ -69602,7 +69700,7 @@ async function pluginRegistered({ context }) {
69602
69700
  }
69603
69701
  async function installLazePlugin({ context }) {
69604
69702
  const folder = await writeLazePlugin({ context });
69605
- const registered = await registerWithClaude({ context, folder });
69703
+ const registered = await registerWithClaude({ context, folder }) && await refreshStaleCache({ context, folder });
69606
69704
  if (registered) await writeFile11(registeredMarkOf({ context }), cliVersionOf());
69607
69705
  return { folder, registered };
69608
69706
  }
@@ -69885,8 +69983,8 @@ async function registerMcp({
69885
69983
  directory,
69886
69984
  profile
69887
69985
  }) {
69888
- const add3 = mcpAddCommandOf({ context, profile });
69889
- const script = `cd ${quote3(directory)} && { claude mcp remove --scope local ${LAZE_MCP_SERVER} >/dev/null 2>&1 </dev/null; ${add3} >/dev/null 2>&1 </dev/null; }`;
69986
+ const add4 = mcpAddCommandOf({ context, profile });
69987
+ const script = `cd ${quote3(directory)} && { claude mcp remove --scope local ${LAZE_MCP_SERVER} >/dev/null 2>&1 </dev/null; ${add4} >/dev/null 2>&1 </dev/null; }`;
69890
69988
  const run4 = context.runCommand({ command: ["sh", "-c", script], env: {} }).catch(() => 1);
69891
69989
  const done = new AbortController();
69892
69990
  const gaveUp = context.sleep(MCP_REGISTER_LIMIT_MS, done.signal).then(() => -1);
@@ -69951,6 +70049,7 @@ function sandboxed({ context, error: error62 }) {
69951
70049
  async function linkAgent({ context, args }) {
69952
70050
  const token2 = flagText({ args, name: "token" });
69953
70051
  if (!token2) throw new CliUsageError("Usage: laze agent link --token <token>");
70052
+ refuseInSubagent({ context, args });
69954
70053
  const url2 = serverUrlOf({ context, args });
69955
70054
  const { harness, pid } = await harnessOf2({ context, args });
69956
70055
  const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
@@ -70542,7 +70641,7 @@ async function loginValueOf({
70542
70641
  args,
70543
70642
  usage
70544
70643
  }) {
70545
- if (SECRET_FLAGS.some((flag) => args.flags[flag] !== void 0)) {
70644
+ if (SECRET_FLAGS.some((flag2) => args.flags[flag2] !== void 0)) {
70546
70645
  throw new CliUsageError(
70547
70646
  "laze: a login token is read from stdin or --from-vault only, never from an argument, so it stays out of your shell history."
70548
70647
  );
@@ -70661,7 +70760,7 @@ var LOGIN_ACTIONS = {
70661
70760
  words: 1,
70662
70761
  run: async (step) => {
70663
70762
  const login2 = loginNamed({ logins: await loginsOf(step.client), wanted: step.first });
70664
- if (SECRET_FLAGS.some((flag) => step.args.flags[flag] !== void 0)) {
70763
+ if (SECRET_FLAGS.some((flag2) => step.args.flags[flag2] !== void 0)) {
70665
70764
  throw new CliUsageError(LOGIN_SIGN_IN_USAGE);
70666
70765
  }
70667
70766
  const secret = await secretOnStdin({ context: step.context });
@@ -70846,6 +70945,7 @@ async function bindAgentSession({
70846
70945
  context,
70847
70946
  args
70848
70947
  }) {
70948
+ refuseInSubagent({ context, args });
70849
70949
  const session = await currentSessionOf({ context, args });
70850
70950
  if (!session) throw new CliUsageError(NO_SESSION);
70851
70951
  const key = sessionKeyOf({ session });
@@ -72027,7 +72127,9 @@ var appPinSchemaDefinition = external_exports.object({
72027
72127
  pinnedByName: external_exports.string().nullable(),
72028
72128
  pinnedAt: external_exports.iso.datetime(),
72029
72129
  /** Set for a browser tab, null for an app. */
72030
- browser: browserPinSchemaDefinition.nullable()
72130
+ browser: browserPinSchemaDefinition.nullable(),
72131
+ /** Whether the reader may unpin it; a browser tab only its owner, their agents or an Admin. */
72132
+ canUnpin: external_exports.boolean().default(true)
72031
72133
  });
72032
72134
  var appPinViewSchemaDefinition = external_exports.object({
72033
72135
  activeAppId: external_exports.string().nullable(),
@@ -72533,6 +72635,7 @@ var AppNavSlot = appUi.component("nav");
72533
72635
  var AppPanelSlot = appUi.component("panel");
72534
72636
  var AppCardSlot = appUi.component("card");
72535
72637
  var AppPinStripSlot = appUi.component("pin-strip");
72638
+ var AppPinListSlot = appUi.component("pin-list");
72536
72639
 
72537
72640
  // ../../modules/app/contract/src/app.config.ts
72538
72641
  var appConfig = Config.define((c) => ({
@@ -73096,10 +73199,9 @@ var USAGE2 = `Usage:
73096
73199
  laze app connections
73097
73200
  laze app connection allow <connection>
73098
73201
  laze app connection revoke <connection>`;
73099
- var LEVELS3 = { auto: "Auto", checked: "Checked", ask: "Ask", human_only: "Human only" };
73100
73202
  function connectionLine(connection) {
73101
73203
  const whose = connection.ownerUserId ? `${connection.ownerName}'s keychain` : "workspace keychain";
73102
- return `${connection.name} ${connection.label}, ${whose}, ${LEVELS3[connection.sensitivity]}
73204
+ return `${connection.name} ${connection.label}, ${whose}, ${vaultLevelLabel(connection.sensitivity)}
73103
73205
  used by ${connection.functions.join(", ")}; ${stateOf(connection)}
73104
73206
  `;
73105
73207
  }
@@ -75673,7 +75775,7 @@ function filterOf({ args }) {
75673
75775
  ["mentions", "mention"],
75674
75776
  ["threads", "thread_reply"],
75675
75777
  ["reactions", "reaction"]
75676
- ].filter(([flag]) => args.flags[flag] !== void 0);
75778
+ ].filter(([flag2]) => args.flags[flag2] !== void 0);
75677
75779
  if (picked.length > 1) throw new CliUsageError(ACTIVITY_USAGE);
75678
75780
  return picked[0]?.[1] ?? "all";
75679
75781
  }
@@ -75706,7 +75808,7 @@ async function activityRead({ context, args }) {
75706
75808
 
75707
75809
  // src/services/channel-config-commands.service.ts
75708
75810
  var AGENT_HINT2 = "Roles, archiving and removing others are a channel admin's change: ask one.\n";
75709
- var LEVELS4 = ["default", "all", "mentions", "nothing", "mute", "unmute"];
75811
+ var LEVELS3 = ["default", "all", "mentions", "nothing", "mute", "unmute"];
75710
75812
  async function changing2({
75711
75813
  context,
75712
75814
  profile,
@@ -75892,7 +75994,7 @@ function instantOf({ until }) {
75892
75994
  }
75893
75995
  function notifyBodyOf({ args }) {
75894
75996
  const [, , channel, word3] = args.words;
75895
- const level = LEVELS4.find((candidate) => candidate === word3);
75997
+ const level = LEVELS3.find((candidate) => candidate === word3);
75896
75998
  if (!channel || !level) throw new CliUsageError(NOTIFY_USAGE);
75897
75999
  if (level === "unmute") return { channel, muted: false };
75898
76000
  if (level !== "mute") return { channel, level };
@@ -76449,8 +76551,8 @@ async function deliverOnce({
76449
76551
  profile
76450
76552
  }) {
76451
76553
  const lock = statePathOf({ context, kind: "waiters", profile });
76452
- const mine3 = (await holderOf({ path: lock }))?.pid === context.processes.pid;
76453
- if (!mine3 && !await takeLock({ context, path: lock, claudePid, preempt: true })) {
76554
+ const mine4 = (await holderOf({ path: lock }))?.pid === context.processes.pid;
76555
+ if (!mine4 && !await takeLock({ context, path: lock, claudePid, preempt: true })) {
76454
76556
  return "outranked";
76455
76557
  }
76456
76558
  const named = { ...args, flags: { ...args.flags, profile } };
@@ -77039,6 +77141,12 @@ var computeGuardSweepStateDefinition = external_exports.object({ lastSweepAt: ex
77039
77141
  var computeGuardSweepIntentDefinition = external_exports.object({ scheduledFor: external_exports.number() });
77040
77142
 
77041
77143
  // ../../modules/compute/contract/src/computer.ts
77144
+ var computerKindSchema = external_exports.enum(["default", "personal", "shared"]);
77145
+ var computerCreatorsDefinition = external_exports.object({
77146
+ /** Every Member, present and future; Owners and Admins always may. */
77147
+ everyone: external_exports.boolean(),
77148
+ userIds: external_exports.array(external_exports.string())
77149
+ });
77042
77150
  var sizeTermsDefinition = external_exports.object({
77043
77151
  id: computerSizeSchema,
77044
77152
  label: external_exports.string(),
@@ -77056,7 +77164,9 @@ var computerAgentDefinition = external_exports.object({
77056
77164
  state: external_exports.enum(["working", "idle", "asleep"]),
77057
77165
  /** CPUs busy, 1 = one vCPU fully busy. */
77058
77166
  cpuBusy: external_exports.number().nonnegative(),
77059
- memoryGb: external_exports.number().nonnegative()
77167
+ memoryGb: external_exports.number().nonnegative(),
77168
+ /** Whose agent it is, on a shared computer; null on a person's own. */
77169
+ ownerName: external_exports.string().nullable().default(null)
77060
77170
  });
77061
77171
  var memoryStopDefinition = external_exports.object({
77062
77172
  agentId: external_exports.string(),
@@ -77101,6 +77211,12 @@ var computerRequestDefinition = external_exports.object({
77101
77211
  var computerRequestSchema = computerRequestDefinition;
77102
77212
  var computerStatusDefinition = external_exports.object({
77103
77213
  workspaceId: external_exports.string(),
77214
+ /** `default` is the person's included computer; more computers have their own ids. */
77215
+ computerId: external_exports.string().default("default"),
77216
+ kind: computerKindSchema.default("default"),
77217
+ /** Who may put agents on a shared computer; null on a person's own. */
77218
+ creators: computerCreatorsDefinition.nullable().default(null),
77219
+ canDelete: external_exports.boolean().default(false),
77104
77220
  /** The person whose computer this is; an agent reads its owner's. */
77105
77221
  ownerUserId: external_exports.string(),
77106
77222
  ownerName: external_exports.string(),
@@ -77143,7 +77259,9 @@ var computerStatusDefinition = external_exports.object({
77143
77259
  var computerStatusSchema = computerStatusDefinition;
77144
77260
  var setComputerSizeInputDefinition = external_exports.object({
77145
77261
  workspaceId: external_exports.string().min(1),
77146
- size: external_exports.string().trim().toLowerCase().min(1).max(32)
77262
+ size: external_exports.string().trim().toLowerCase().min(1).max(32),
77263
+ /** Another computer of the caller's, or a shared one; absent for the default computer. */
77264
+ computerId: external_exports.string().min(1).max(64).optional()
77147
77265
  });
77148
77266
  var setComputerSizeInputSchema = setComputerSizeInputDefinition;
77149
77267
  var computerSizeAnswerDefinition = external_exports.object({
@@ -77193,7 +77311,69 @@ var restRestartComputerInputDefinition = restartComputerInputDefinition.omit({
77193
77311
  });
77194
77312
  var restComputerSizeInputDefinition = setComputerSizeInputDefinition.omit({ workspaceId: true });
77195
77313
  var restComputerRequestRefDefinition = computerRequestRefDefinition.omit({ workspaceId: true });
77314
+ var myComputersDefinition = external_exports.object({
77315
+ currency: currencySchema,
77316
+ computers: external_exports.array(computerStatusDefinition),
77317
+ /** Whether the caller may add a computer at once; otherwise adding files a request. */
77318
+ canAdd: external_exports.boolean(),
77319
+ canAddShared: external_exports.boolean()
77320
+ });
77321
+ var myComputersSchema = myComputersDefinition;
77322
+ var createComputerInputDefinition = external_exports.object({
77323
+ workspaceId: external_exports.string().min(1),
77324
+ name: external_exports.string().trim().min(1).max(40),
77325
+ size: computerSizeSchema,
77326
+ kind: external_exports.enum(["personal", "shared"]),
77327
+ creators: computerCreatorsDefinition.nullable().default(null)
77328
+ });
77329
+ var createComputerInputSchema = createComputerInputDefinition;
77330
+ var computerRefDefinition = external_exports.object({
77331
+ workspaceId: external_exports.string().min(1),
77332
+ computerId: external_exports.string().min(1).max(64)
77333
+ });
77334
+ var deleteComputerInputDefinition = external_exports.object({
77335
+ ...computerRefDefinition.shape,
77336
+ moveTo: external_exports.string().min(1).max(64).nullable().default(null)
77337
+ });
77338
+ var deleteComputerInputSchema = deleteComputerInputDefinition;
77339
+ var deleteComputerAnswerDefinition = external_exports.object({
77340
+ computerId: external_exports.string(),
77341
+ /** The agents moved to `moveTo` before the delete. */
77342
+ moved: external_exports.array(external_exports.string()),
77343
+ message: external_exports.string()
77344
+ });
77345
+ var deleteComputerAnswerSchema = deleteComputerAnswerDefinition;
77346
+ var setComputerCreatorsInputDefinition = external_exports.object({
77347
+ ...computerRefDefinition.shape,
77348
+ creators: computerCreatorsDefinition
77349
+ });
77350
+ var setComputerCreatorsInputSchema = setComputerCreatorsInputDefinition;
77351
+ var setAgentComputerInputDefinition = external_exports.object({
77352
+ ...computerRefDefinition.shape,
77353
+ agentId: external_exports.string().min(1)
77354
+ });
77355
+ var setAgentComputerInputSchema = setAgentComputerInputDefinition;
77356
+ var agentComputerAnswerDefinition = external_exports.object({
77357
+ agentId: external_exports.string(),
77358
+ computerId: external_exports.string(),
77359
+ message: external_exports.string()
77360
+ });
77361
+ var agentComputerAnswerSchema = agentComputerAnswerDefinition;
77362
+ var restCreateComputerInputDefinition = createComputerInputDefinition.omit({
77363
+ workspaceId: true
77364
+ });
77365
+ var restDeleteComputerInputDefinition = deleteComputerInputDefinition.omit({ workspaceId: true });
77366
+ var restSetComputerCreatorsInputDefinition = setComputerCreatorsInputDefinition.omit({
77367
+ workspaceId: true
77368
+ });
77369
+ var restSetAgentComputerInputDefinition = setAgentComputerInputDefinition.omit({
77370
+ workspaceId: true
77371
+ });
77196
77372
  var computerListEntryDefinition = external_exports.object({
77373
+ computerId: external_exports.string().default("default"),
77374
+ kind: computerKindSchema.default("default"),
77375
+ /** Set on a person's extra computers and on shared ones; null on a default computer. */
77376
+ name: external_exports.string().nullable().default(null),
77197
77377
  ownerUserId: external_exports.string(),
77198
77378
  ownerName: external_exports.string(),
77199
77379
  size: computerSizeSchema,
@@ -77215,7 +77395,12 @@ var COMPUTER_REST_PATHS = {
77215
77395
  size: "/api/compute/computer/size",
77216
77396
  requests: "/api/compute/computer/requests",
77217
77397
  cancelRequest: "/api/compute/computer/requests/cancel",
77218
- restart: "/api/compute/computer/restart"
77398
+ restart: "/api/compute/computer/restart",
77399
+ mine: "/api/compute/computers/mine",
77400
+ create: "/api/compute/computers",
77401
+ remove: "/api/compute/computers/remove",
77402
+ creators: "/api/compute/computers/creators",
77403
+ agent: "/api/compute/computers/agent"
77219
77404
  };
77220
77405
  var computerWatchStateDefinition = external_exports.object({
77221
77406
  nextWakeAt: external_exports.number().nullable(),
@@ -77788,7 +77973,9 @@ var ownMachineSshConnectDefinition = external_exports.object({
77788
77973
  var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
77789
77974
  var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema18, machineId: idSchema19 });
77790
77975
  var ComputeApi = moduleApi()("compute");
77791
- var computeTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(machineRefSchema).withOutput(whatsappPairingSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
77976
+ var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(machineRefSchema).withOutput(whatsappPairingSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
77977
+ var computeFleetTrpc = defineTrpcContract("compute").query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
77978
+ var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
77792
77979
  var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
77793
77980
  var restRenameInputDefinition = external_exports.object({
77794
77981
  machine: external_exports.string().min(1).max(64),
@@ -77858,6 +78045,96 @@ var computeUi = uiTokens("compute");
77858
78045
  var ComputeBrowserTabSlot = computeUi.component("browser-tab");
77859
78046
  var ComputeOpenBrowserSlot = computeUi.component("open-browser");
77860
78047
 
78048
+ // src/services/computer-fleet-commands.service.ts
78049
+ var COMPUTER_FLEET_USAGE = ` laze computer mine [--json] every Laze computer your agents may run on, your default one first
78050
+ laze computer add <name> --size <size> [--shared [--everyone | --people <id,id>]]
78051
+ add a computer of your own or a shared one, at its full price (Owners and Admins)
78052
+ laze computer remove <computer> [--to <computer>]
78053
+ delete a computer; its agents move to --to first (default: their owner's default)
78054
+ laze computer creators <computer> --everyone | --people <id,id>
78055
+ who may put agents on a shared computer (Owners and Admins)
78056
+ laze computer move <agent> <computer|default>
78057
+ move an agent with its home to a Laze computer its owner may use`;
78058
+ var printJson2 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
78059
+ `);
78060
+ function flag(args, name2) {
78061
+ const value = args.flags[name2];
78062
+ if (value === true) throw new CliUsageError(COMPUTER_FLEET_USAGE);
78063
+ return value ?? null;
78064
+ }
78065
+ function creatorsOf(args) {
78066
+ const people2 = flag(args, "people");
78067
+ const userIds = (people2 ?? "").split(",").map((one) => one.trim()).filter(Boolean);
78068
+ return { everyone: args.flags.everyone === true, userIds };
78069
+ }
78070
+ function lineOf3(computer2) {
78071
+ const money2 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
78072
+ const agents = `${computer2.agents.length} agent(s)`;
78073
+ return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money2} ${agents} ${computer2.state}`;
78074
+ }
78075
+ async function mine({ context, args }) {
78076
+ const client = await computeClient({ context, args });
78077
+ const answer4 = await client.get(COMPUTER_REST_PATHS.mine);
78078
+ if (args.flags.json) return printJson2(context, answer4);
78079
+ context.out(`Your Laze computers:
78080
+ ${answer4.computers.map(lineOf3).join("\n")}
78081
+ `);
78082
+ }
78083
+ async function add2({ context, args }) {
78084
+ const name2 = args.words[2];
78085
+ const size = flag(args, "size");
78086
+ if (!name2 || !size) throw new CliUsageError(COMPUTER_FLEET_USAGE);
78087
+ const shared = args.flags.shared === true;
78088
+ const client = await computeClient({ context, args });
78089
+ const answer4 = await client.post(COMPUTER_REST_PATHS.create, {
78090
+ name: name2,
78091
+ size,
78092
+ kind: shared ? "shared" : "personal",
78093
+ creators: shared ? creatorsOf(args) : null
78094
+ });
78095
+ if (args.flags.json) return printJson2(context, answer4);
78096
+ context.out(`${answer4.name} (${answer4.computerId}) is ready, ${answer4.monthlyCharge} a month.
78097
+ `);
78098
+ }
78099
+ async function remove3({ context, args }) {
78100
+ const computerId = args.words[2];
78101
+ if (!computerId) throw new CliUsageError(COMPUTER_FLEET_USAGE);
78102
+ const client = await computeClient({ context, args });
78103
+ const answer4 = await client.post(COMPUTER_REST_PATHS.remove, {
78104
+ computerId,
78105
+ moveTo: flag(args, "to")
78106
+ });
78107
+ if (args.flags.json) return printJson2(context, answer4);
78108
+ context.out(`${answer4.message}
78109
+ `);
78110
+ }
78111
+ async function creators({ context, args }) {
78112
+ const computerId = args.words[2];
78113
+ if (!computerId) throw new CliUsageError(COMPUTER_FLEET_USAGE);
78114
+ const client = await computeClient({ context, args });
78115
+ const answer4 = await client.post(COMPUTER_REST_PATHS.creators, {
78116
+ computerId,
78117
+ creators: creatorsOf(args)
78118
+ });
78119
+ if (args.flags.json) return printJson2(context, answer4);
78120
+ const who = answer4.creators?.everyone ? "everyone" : `${answer4.creators?.userIds.length ?? 0} people`;
78121
+ context.out(`${answer4.name}: ${who} may add agents, and Owners and Admins.
78122
+ `);
78123
+ }
78124
+ async function move({ context, args }) {
78125
+ const [, , agentId, computerId] = args.words;
78126
+ if (!agentId || !computerId) throw new CliUsageError(COMPUTER_FLEET_USAGE);
78127
+ const client = await computeClient({ context, args });
78128
+ const answer4 = await client.post(COMPUTER_REST_PATHS.agent, {
78129
+ agentId,
78130
+ computerId
78131
+ });
78132
+ if (args.flags.json) return printJson2(context, answer4);
78133
+ context.out(`${answer4.message}
78134
+ `);
78135
+ }
78136
+ var COMPUTER_FLEET_COMMANDS = { mine, add: add2, remove: remove3, creators, move };
78137
+
77861
78138
  // src/services/computer-commands.service.ts
77862
78139
  var COMPUTER_USAGE = `Usage:
77863
78140
  laze computer status [--json] your computer: size, CPU, memory and disk in use, your agents, the sizes
@@ -77866,11 +78143,12 @@ var COMPUTER_USAGE = `Usage:
77866
78143
  Admins); anyone else gets a message to forward and the admins a card
77867
78144
  laze computer request <size> ask the admins for a size for your computer
77868
78145
  laze computer cancel <request> withdraw your request
77869
- laze computer restart [--person <user id>]
78146
+ laze computer restart [--person <user id>] [--computer <computer>]
77870
78147
  stop and start your computer, or a person's (Owners and Admins);
77871
78148
  its agents start again on their next message
77872
- laze computer list [--json] everyone's computers with size and monthly cost (Owners and Admins)`;
77873
- var printJson2 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
78149
+ laze computer list [--json] everyone's computers with size and monthly cost (Owners and Admins)
78150
+ ${COMPUTER_FLEET_USAGE}`;
78151
+ var printJson3 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
77874
78152
  `);
77875
78153
  var gb = (value) => `${Number(value.toFixed(1))} GB`;
77876
78154
  var DISK_STATE_TEXT = {
@@ -77939,13 +78217,13 @@ function printStatus({ context }, status8) {
77939
78217
  async function status3({ context, args }) {
77940
78218
  const client = await computeClient({ context, args });
77941
78219
  const answer4 = await client.get(COMPUTER_REST_PATHS.computer);
77942
- if (args.flags.json) return printJson2(context, answer4);
78220
+ if (args.flags.json) return printJson3(context, answer4);
77943
78221
  printStatus({ context, args }, answer4);
77944
78222
  }
77945
78223
  async function sizes({ context, args }) {
77946
78224
  const client = await computeClient({ context, args });
77947
78225
  const answer4 = await client.get(COMPUTER_REST_PATHS.computer);
77948
- if (args.flags.json) return printJson2(context, answer4.sizes);
78226
+ if (args.flags.json) return printJson3(context, answer4.sizes);
77949
78227
  context.out(`${sizeLines(answer4).join("\n")}
77950
78228
  Settings: ${answer4.settingsUrl}
77951
78229
  `);
@@ -77959,7 +78237,7 @@ async function upgrade({ context, args }) {
77959
78237
  const size = sizeArg({ args });
77960
78238
  const client = await computeClient({ context, args });
77961
78239
  const answer4 = await client.post(COMPUTER_REST_PATHS.size, { size });
77962
- if (args.flags.json) return printJson2(context, answer4);
78240
+ if (args.flags.json) return printJson3(context, answer4);
77963
78241
  context.out(`${answer4.message}
77964
78242
  `);
77965
78243
  }
@@ -77967,7 +78245,7 @@ async function request({ context, args }) {
77967
78245
  const size = sizeArg({ args });
77968
78246
  const client = await computeClient({ context, args });
77969
78247
  const answer4 = await client.post(COMPUTER_REST_PATHS.requests, { size });
77970
- if (args.flags.json) return printJson2(context, answer4);
78248
+ if (args.flags.json) return printJson3(context, answer4);
77971
78249
  context.out(
77972
78250
  `Asked the admins (request ${answer4.id}); they get a card in the feed.
77973
78251
  Message to forward: ${answer4.message}
@@ -77981,7 +78259,7 @@ async function cancel({ context, args }) {
77981
78259
  const answer4 = await client.post(COMPUTER_REST_PATHS.cancelRequest, {
77982
78260
  requestId
77983
78261
  });
77984
- if (args.flags.json) return printJson2(context, answer4);
78262
+ if (args.flags.json) return printJson3(context, answer4);
77985
78263
  context.out(`Request ${answer4.id} is ${answer4.state}.
77986
78264
  `);
77987
78265
  }
@@ -77989,20 +78267,23 @@ async function restart({ context, args }) {
77989
78267
  const person = args.flags.person;
77990
78268
  if (person === true) throw new CliUsageError(COMPUTER_USAGE);
77991
78269
  const client = await computeClient({ context, args });
78270
+ const computerId = args.flags.computer;
78271
+ if (computerId === true) throw new CliUsageError(COMPUTER_USAGE);
77992
78272
  const answer4 = await client.post(COMPUTER_REST_PATHS.restart, {
77993
- ownerUserId: person ?? null
78273
+ ownerUserId: person ?? null,
78274
+ ...computerId ? { computerId } : {}
77994
78275
  });
77995
- if (args.flags.json) return printJson2(context, answer4);
78276
+ if (args.flags.json) return printJson3(context, answer4);
77996
78277
  context.out(`${answer4.message}
77997
78278
  `);
77998
78279
  }
77999
78280
  async function list2({ context, args }) {
78000
78281
  const client = await computeClient({ context, args });
78001
78282
  const answer4 = await client.get(COMPUTER_REST_PATHS.all);
78002
- if (args.flags.json) return printJson2(context, answer4);
78283
+ if (args.flags.json) return printJson3(context, answer4);
78003
78284
  const money2 = (amount) => `${amount} ${answer4.currency.toUpperCase()}`;
78004
78285
  const lines = answer4.computers.map(
78005
- (one) => ` ${one.ownerName} ${one.size} ${money2(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
78286
+ (one) => ` ${one.name ?? one.ownerName} ${one.size} ${money2(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
78006
78287
  );
78007
78288
  context.out(
78008
78289
  `Everyone's computers (${answer4.includedSize} included per person):
@@ -78010,7 +78291,16 @@ ${lines.join("\n")}
78010
78291
  `
78011
78292
  );
78012
78293
  }
78013
- var COMPUTER_COMMANDS = { status: status3, sizes, upgrade, request, cancel, restart, list: list2 };
78294
+ var COMPUTER_COMMANDS = {
78295
+ status: status3,
78296
+ sizes,
78297
+ upgrade,
78298
+ request,
78299
+ cancel,
78300
+ restart,
78301
+ list: list2,
78302
+ ...COMPUTER_FLEET_COMMANDS
78303
+ };
78014
78304
  async function computer({ context, args }) {
78015
78305
  const name2 = args.words[1];
78016
78306
  if (name2 === void 0) return status3({ context, args });
@@ -78262,7 +78552,7 @@ function keychainLabel(keychain) {
78262
78552
 
78263
78553
  // src/services/vault-admin-commands.service.ts
78264
78554
  var SUBJECTS = ["person", "group", "channel", "agent"];
78265
- function printJson3({ context, data }) {
78555
+ function printJson4({ context, data }) {
78266
78556
  context.out(`${JSON.stringify(data, null, 2)}
78267
78557
  `);
78268
78558
  }
@@ -78308,7 +78598,7 @@ var grantTo = async ({ context, args }) => {
78308
78598
  subject: { kind: subject, id },
78309
78599
  ...durationOf(args)
78310
78600
  });
78311
- if (args.flags.json) return printJson3({ context, data: grant });
78601
+ if (args.flags.json) return printJson4({ context, data: grant });
78312
78602
  printGrant({ context, grant });
78313
78603
  };
78314
78604
  var lendTo = async ({ context, args }) => {
@@ -78321,7 +78611,7 @@ var lendTo = async ({ context, args }) => {
78321
78611
  channelId,
78322
78612
  ...durationOf(args)
78323
78613
  });
78324
- if (args.flags.json) return printJson3({ context, data: grant });
78614
+ if (args.flags.json) return printJson4({ context, data: grant });
78325
78615
  printGrant({ context, grant });
78326
78616
  };
78327
78617
  var grantsOf = async ({ context, args }) => {
@@ -78330,7 +78620,7 @@ var grantsOf = async ({ context, args }) => {
78330
78620
  const grants = await client.post("/api/vault/grants/list", {
78331
78621
  connectionId: target.id
78332
78622
  });
78333
- if (args.flags.json) return printJson3({ context, data: grants });
78623
+ if (args.flags.json) return printJson4({ context, data: grants });
78334
78624
  if (grants.length === 0) return context.out(`${target.name} is shared with no one.
78335
78625
  `);
78336
78626
  for (const grant of grants) printGrant({ context, grant });
@@ -78340,14 +78630,14 @@ var revokeGrant = async ({ context, args }) => {
78340
78630
  if (!grantId) throw new CliUsageError("Usage: laze vault ungrant <grantId>");
78341
78631
  const { client } = await signedIn({ context, args });
78342
78632
  const answer4 = await client.post("/api/vault/grants/revoke", { grantId });
78343
- if (args.flags.json) return printJson3({ context, data: answer4 });
78633
+ if (args.flags.json) return printJson4({ context, data: answer4 });
78344
78634
  context.out(`Ended grant ${grantId}.
78345
78635
  `);
78346
78636
  };
78347
78637
  var listLeases = async ({ context, args }) => {
78348
78638
  const { client } = await signedIn({ context, args });
78349
78639
  const leases = await client.get("/api/vault/leases");
78350
- if (args.flags.json) return printJson3({ context, data: leases });
78640
+ if (args.flags.json) return printJson4({ context, data: leases });
78351
78641
  if (leases.length === 0) return context.out("No live leases.\n");
78352
78642
  for (const lease of leases) {
78353
78643
  context.out(
@@ -78361,7 +78651,7 @@ var endLease = async ({ context, args }) => {
78361
78651
  if (!leaseId) throw new CliUsageError("Usage: laze vault end-lease <leaseId>");
78362
78652
  const { client } = await signedIn({ context, args });
78363
78653
  const answer4 = await client.post("/api/vault/leases/end", { leaseId });
78364
- if (args.flags.json) return printJson3({ context, data: answer4 });
78654
+ if (args.flags.json) return printJson4({ context, data: answer4 });
78365
78655
  context.out(`Ended lease ${leaseId}.
78366
78656
  `);
78367
78657
  };
@@ -78371,14 +78661,16 @@ function printLimits({ context, limits }) {
78371
78661
  const lease = limit.maxLeaseSeconds ? ` lease<=${limit.maxLeaseSeconds}s` : "";
78372
78662
  const blocked = limit.blocked ? " blocked" : "";
78373
78663
  const approve = limit.approveNew ? " approve-new" : "";
78374
- context.out(`${limit.subject} most ${limit.most}${lease}${blocked}${approve}
78375
- `);
78664
+ context.out(
78665
+ `${limit.subject} most ${vaultCliLevelOf(limit.most)}${lease}${blocked}${approve}
78666
+ `
78667
+ );
78376
78668
  }
78377
78669
  }
78378
78670
  var listLimits = async ({ context, args }) => {
78379
78671
  const { client } = await signedIn({ context, args });
78380
78672
  const limits = await client.get("/api/vault/limits");
78381
- if (args.flags.json) return printJson3({ context, data: limits });
78673
+ if (args.flags.json) return printJson4({ context, data: limits });
78382
78674
  printLimits({ context, limits });
78383
78675
  };
78384
78676
  var setLimit = async ({ context, args }) => {
@@ -78386,21 +78678,25 @@ var setLimit = async ({ context, args }) => {
78386
78678
  const most = flagText({ args, name: "most" });
78387
78679
  if (!subject || !most) {
78388
78680
  throw new CliUsageError(
78389
- "Usage: laze vault set-limit <subject> --most checked|ask|human_only|none [--max-lease 1h|none]"
78681
+ "Usage: laze vault set-limit <subject> --most auto|always-ask|human-only|none [--max-lease 1h|none]"
78390
78682
  );
78391
78683
  }
78684
+ const level = most === "none" ? null : vaultLevelOfCliName(most);
78685
+ if (level === "unknown" || level === "auto") {
78686
+ throw new CliUsageError("--most is one of auto, always-ask, human-only or none.");
78687
+ }
78392
78688
  const lease = flagText({ args, name: "max-lease" });
78393
78689
  const blocked = yesNoOf({ args, name: "blocked" });
78394
78690
  const approveNew = yesNoOf({ args, name: "approve-new" });
78395
78691
  const { client } = await signedIn({ context, args });
78396
78692
  const limits = await client.post("/api/vault/limits", {
78397
78693
  subject,
78398
- most: most === "none" ? null : most,
78694
+ most: level,
78399
78695
  ...lease && { maxLeaseSeconds: lease === "none" ? null : secondsOf(lease) },
78400
78696
  ...blocked !== void 0 && { blocked },
78401
78697
  ...approveNew !== void 0 && { approveNew }
78402
78698
  });
78403
- if (args.flags.json) return printJson3({ context, data: limits });
78699
+ if (args.flags.json) return printJson4({ context, data: limits });
78404
78700
  printLimits({ context, limits });
78405
78701
  };
78406
78702
  function readOf(args) {
@@ -78422,12 +78718,12 @@ var listAudit = async ({ context, args }) => {
78422
78718
  const { client } = await signedIn({ context, args });
78423
78719
  if (args.words[1] === "activity") {
78424
78720
  const entries = await client.post("/api/vault/activity", readOf(args));
78425
- if (args.flags.json) return printJson3({ context, data: entries });
78721
+ if (args.flags.json) return printJson4({ context, data: entries });
78426
78722
  for (const entry of entries) printEntry({ context, entry });
78427
78723
  return;
78428
78724
  }
78429
78725
  const page = await client.post("/api/vault/audit", readOf(args));
78430
- if (args.flags.json) return printJson3({ context, data: page });
78726
+ if (args.flags.json) return printJson4({ context, data: page });
78431
78727
  for (const entry of page.entries) printEntry({ context, entry });
78432
78728
  const chain = page.chain.intact ? "intact" : `broken at ${page.chain.brokenAtSeq}`;
78433
78729
  context.out(`Chain ${chain}.${page.nextCursor ? ` Older: --before ${page.nextCursor}` : ""}
@@ -78439,7 +78735,7 @@ var mostAsked = async ({ context, args }) => {
78439
78735
  const answer4 = await client.post("/api/vault/most-asked", {
78440
78736
  ...days && { days: Number(days) }
78441
78737
  });
78442
- if (args.flags.json) return printJson3({ context, data: answer4 });
78738
+ if (args.flags.json) return printJson4({ context, data: answer4 });
78443
78739
  for (const row of answer4.connections) {
78444
78740
  context.out(
78445
78741
  `${row.connectionId} ${row.cards} cards ${row.asks} asks ${row.denied} denied
@@ -78453,7 +78749,7 @@ var listApprovals = async ({ context, args }) => {
78453
78749
  const cards = await client.post("/api/vault/approvals", {
78454
78750
  ...state && { state }
78455
78751
  });
78456
- if (args.flags.json) return printJson3({ context, data: cards });
78752
+ if (args.flags.json) return printJson4({ context, data: cards });
78457
78753
  if (cards.length === 0) return context.out("No approval cards.\n");
78458
78754
  for (const card2 of cards) {
78459
78755
  context.out(`${card2.id} ${card2.state} ${card2.action} ${card2.agentId} ${card2.reason}
@@ -78464,7 +78760,7 @@ var listApprovals = async ({ context, args }) => {
78464
78760
  var judgeStatus = async ({ context, args }) => {
78465
78761
  const { client } = await signedIn({ context, args });
78466
78762
  const status8 = await client.get("/api/vault/judge");
78467
- if (args.flags.json) return printJson3({ context, data: status8 });
78763
+ if (args.flags.json) return printJson4({ context, data: status8 });
78468
78764
  context.out(
78469
78765
  status8.configured ? "The judge is set up: Checked uses are decided by it.\n" : "No judge is set up: every Checked use asks a person.\n"
78470
78766
  );
@@ -78472,8 +78768,9 @@ var judgeStatus = async ({ context, args }) => {
78472
78768
  var listDevices = async ({ context, args }) => {
78473
78769
  const { client } = await signedIn({ context, args });
78474
78770
  const devices = await client.get("/api/vault/devices");
78475
- if (args.flags.json) return printJson3({ context, data: devices });
78476
- if (devices.length === 0) return context.out("No devices. Enrol one in Laze, under Keychains.\n");
78771
+ if (args.flags.json) return printJson4({ context, data: devices });
78772
+ if (devices.length === 0)
78773
+ return context.out("No devices. Enrol one in Laze, under Settings, Vault, Passkeys.\n");
78477
78774
  for (const device of devices) {
78478
78775
  context.out(
78479
78776
  `${device.id} ${device.label} ${device.kind} ${device.state} ${device.fingerprint}
@@ -78486,39 +78783,43 @@ var listDevices = async ({ context, args }) => {
78486
78783
  var VAULT_USAGE = `Usage (your own key; an agent's key is refused, values are never printed):
78487
78784
  laze vault list [--json] connections you manage or see: names, fields, levels
78488
78785
  laze vault add <name> --label <text> [--keychain personal|workspace|agent:<id>]
78489
- [--level auto|checked|ask|human_only] [--rules <text>] [--approver <userId>]...
78490
- [--max-lease 1h|2d] [--every-use-asks] [--field <FIELD>] [--from-file <path>]
78786
+ [--level allow|auto|always-ask|human-only] [--rules <text>] [--approver <userId>]...
78787
+ [--lease 15m|1h|8h|1d|2d] [--every-use-asks] [--field <FIELD>] [--from-file <path>]
78788
+ levels as the page names them: allow (agents use it), auto (the automatic check reads
78789
+ each use against --rules), always-ask (a person approves), human-only (agents never do)
78790
+ --lease (or --max-lease) is how long an approval lasts for the agent, 2 days by default
78491
78791
  the value comes from stdin or --from-file, never a flag: KEY=value lines, one value
78492
78792
  with --field, or a JSON secret bundle ({"kind":"api_key_set","fields":{...}})
78493
- laze vault update <connection> [--label] [--level] [--rules] [--approver]... [--max-lease 1h|none]
78793
+ laze vault update <connection> [--label] [--level] [--rules] [--approver]... [--lease 1h|none]
78494
78794
  [--every-use-asks yes|no]
78495
78795
  laze vault replace <connection> [--field <FIELD>] [--from-file <path>] a new value, from stdin
78496
78796
  laze vault compare <name> [--field <FIELD>] [--from-file <path>] is this value already held
78497
78797
  laze vault rm|revoke <connection> delete it; revoke also takes it back at the provider
78498
- laze vault uses <connection> [--limit <n>] who used it lately
78798
+ laze vault uses <connection> [--limit <n>] who used it, how, where, under which approval
78499
78799
  laze vault grant <connection> --to person|group|channel|agent:<id> [--for 1h]
78500
78800
  laze vault lend <connection> --channel <channelId> [--for 1h]
78501
78801
  laze vault grants <connection> | laze vault ungrant <grantId>
78502
78802
  laze vault leases | laze vault end-lease <leaseId>
78503
- laze vault limits | laze vault set-limit <subject> [--most checked|ask|human_only|none]
78803
+ laze vault limits | laze vault set-limit <subject> [--most auto|always-ask|human-only|none]
78504
78804
  [--max-lease 1h|none] [--blocked yes|no] [--approve-new yes|no] (admins)
78505
78805
  laze vault audit|activity [--connection <c>] [--limit <n>] [--before <seq>] (audit: admins)
78506
78806
  laze vault most-asked [--days <n>] (admins)
78507
78807
  laze vault approvals [--state pending] cards you answer; answer them in Laze
78508
78808
  laze vault judge | laze vault devices`;
78509
- var LEVELS5 = ["auto", "checked", "ask", "human_only"];
78510
78809
  function levelOf(args) {
78511
78810
  const level = flagText({ args, name: "level" });
78512
78811
  if (!level) return void 0;
78513
- const known = LEVELS5.find((one) => one === level);
78514
- if (!known) throw new CliUsageError(`--level is one of ${LEVELS5.join(", ")}.`);
78812
+ const known = vaultLevelOfCliName(level);
78813
+ if (known === "unknown") {
78814
+ throw new CliUsageError(`--level is one of ${VAULT_CLI_LEVEL_NAMES.join(", ")}.`);
78815
+ }
78515
78816
  return known;
78516
78817
  }
78517
78818
  function printConnection({ context, row }) {
78518
78819
  const waiting = row.waitingApproval ? " (waiting for an admin)" : "";
78519
78820
  const status8 = row.status === "active" ? "" : ` ${row.status}`;
78520
78821
  context.out(
78521
- `${row.id} ${row.name} ${row.label} ${keychainLabel(row.keychain)} ${row.sensitivity} ${row.fieldNames.join(",")}${status8}${waiting}
78822
+ `${row.id} ${row.name} ${row.label} ${keychainLabel(row.keychain)} ${vaultCliLevelOf(row.sensitivity)} ${row.fieldNames.join(",")}${status8}${waiting}
78522
78823
  `
78523
78824
  );
78524
78825
  }
@@ -78544,7 +78845,7 @@ async function keychainOf2({ client, args }) {
78544
78845
  return { kind: "personal", ownerUserId: me.id };
78545
78846
  }
78546
78847
  function settingsOf(args) {
78547
- const lease = flagText({ args, name: "max-lease" });
78848
+ const lease = flagText({ args, name: "lease" }) || flagText({ args, name: "max-lease" });
78548
78849
  const approvers = args.lists.approver;
78549
78850
  const everyUseAsks = yesNoOf({ args, name: "every-use-asks" });
78550
78851
  const label2 = flagText({ args, name: "label" });
@@ -78561,11 +78862,11 @@ function settingsOf(args) {
78561
78862
  var list3 = async ({ context, args }) => {
78562
78863
  const { client } = await signedIn({ context, args });
78563
78864
  const rows = await client.get("/api/vault/connections");
78564
- if (args.flags.json) return printJson3({ context, data: rows });
78865
+ if (args.flags.json) return printJson4({ context, data: rows });
78565
78866
  if (rows.length === 0) return context.out("No connections yet. Add one with laze vault add.\n");
78566
78867
  for (const row of rows) printConnection({ context, row });
78567
78868
  };
78568
- var add2 = async ({ context, args }) => {
78869
+ var add3 = async ({ context, args }) => {
78569
78870
  const name2 = args.words[2];
78570
78871
  const label2 = flagText({ args, name: "label" });
78571
78872
  if (!name2 || !label2) throw new CliUsageError(VAULT_USAGE);
@@ -78581,9 +78882,11 @@ var add2 = async ({ context, args }) => {
78581
78882
  ...settingsOf(args),
78582
78883
  secret
78583
78884
  });
78584
- if (args.flags.json) return printJson3({ context, data: created });
78585
- context.out(`Added ${created.name} (${created.id}) at ${created.sensitivity}.
78586
- `);
78885
+ if (args.flags.json) return printJson4({ context, data: created });
78886
+ context.out(
78887
+ `Added ${created.name} (${created.id}) at ${vaultLevelLabel(created.sensitivity)}.
78888
+ `
78889
+ );
78587
78890
  };
78588
78891
  var update = async ({ context, args }) => {
78589
78892
  const { client } = await signedIn({ context, args });
@@ -78594,7 +78897,7 @@ var update = async ({ context, args }) => {
78594
78897
  connectionId: target.id,
78595
78898
  ...settings2
78596
78899
  });
78597
- if (args.flags.json) return printJson3({ context, data: updated });
78900
+ if (args.flags.json) return printJson4({ context, data: updated });
78598
78901
  printConnection({ context, row: updated });
78599
78902
  };
78600
78903
  var replace = async ({ context, args }) => {
@@ -78607,7 +78910,7 @@ var replace = async ({ context, args }) => {
78607
78910
  ...field && { field },
78608
78911
  value
78609
78912
  });
78610
- if (args.flags.json) return printJson3({ context, data: updated });
78913
+ if (args.flags.json) return printJson4({ context, data: updated });
78611
78914
  context.out(`Replaced the value of ${updated.name}.
78612
78915
  `);
78613
78916
  };
@@ -78622,7 +78925,7 @@ var compare = async ({ context, args }) => {
78622
78925
  ...field && { field },
78623
78926
  value
78624
78927
  });
78625
- if (args.flags.json) return printJson3({ context, data: answer4 });
78928
+ if (args.flags.json) return printJson4({ context, data: answer4 });
78626
78929
  const said = {
78627
78930
  absent: `You hold no connection named ${name2}.`,
78628
78931
  same: `${name2} already holds this value.`,
@@ -78639,12 +78942,17 @@ function removal(path) {
78639
78942
  `/api/vault/connections/${path}`,
78640
78943
  { connectionId: target.id }
78641
78944
  );
78642
- if (args.flags.json) return printJson3({ context, data: answer4 });
78945
+ if (args.flags.json) return printJson4({ context, data: answer4 });
78643
78946
  const provider = "atProvider" in answer4 ? ` (at the provider: ${answer4.atProvider})` : "";
78644
78947
  context.out(`Deleted ${target.name}${provider}.
78645
78948
  `);
78646
78949
  };
78647
78950
  }
78951
+ function usedBy(row) {
78952
+ if (row.agentId) return `agent ${row.agentId}`;
78953
+ if (row.actorKind === "user") return `person ${row.actorId ?? ""}`;
78954
+ return "laze";
78955
+ }
78648
78956
  var uses = async ({ context, args }) => {
78649
78957
  const { client } = await signedIn({ context, args });
78650
78958
  const target = await connectionOf({ client, args, word: args.words[2] });
@@ -78653,18 +78961,22 @@ var uses = async ({ context, args }) => {
78653
78961
  connectionId: target.id,
78654
78962
  ...limit && { limit: Number(limit) }
78655
78963
  });
78656
- if (args.flags.json) return printJson3({ context, data: rows });
78964
+ if (args.flags.json) return printJson4({ context, data: rows });
78657
78965
  if (rows.length === 0) return context.out(`No one used ${target.name} yet.
78658
78966
  `);
78659
78967
  for (const row of rows) {
78660
- const who = row.agentId ?? row.requesterUserId ?? "";
78661
- context.out(`${row.at} ${row.action} ${row.outcome} ${who} ${row.reason ?? ""}
78662
- `);
78968
+ const who = usedBy(row);
78969
+ const where = row.origin ?? row.via ?? "-";
78970
+ const approval = row.requestId ?? "-";
78971
+ context.out(
78972
+ `${row.at} ${row.action} ${row.outcome} ${who} ${where} ${approval} ${row.reason ?? ""}
78973
+ `
78974
+ );
78663
78975
  }
78664
78976
  };
78665
78977
  var VAULT_COMMANDS = {
78666
78978
  list: list3,
78667
- add: add2,
78979
+ add: add3,
78668
78980
  update,
78669
78981
  replace,
78670
78982
  compare,
@@ -78704,6 +79016,7 @@ var CONNECTOR_USAGE = `Usage (a person's key; an agent runs laze connect suggest
78704
79016
  [--level <level>] [--again <connectionId>] a server with no key, or with its own sign-in
78705
79017
  laze connect mcp refresh <connectionId> read its tools again
78706
79018
  laze connect mcp tool-level <connectionId> <tool> <level|default>
79019
+ levels: allow, auto (the automatic check), always-ask, human-only
78707
79020
  laze connect mcp-key <https url> --name <name> --label <label> [--header Authorization]
78708
79021
  [--prefix "Bearer "] [--keychain ...] [--level <level>] the key from stdin or --from-file
78709
79022
  laze connect github the GitHub App and its installations
@@ -78723,7 +79036,7 @@ function wordAt2(args, index) {
78723
79036
  }
78724
79037
  var KEY_FLAGS = ["key", "value", "token"];
78725
79038
  async function keyText({ context, args }) {
78726
- if (KEY_FLAGS.some((flag) => args.flags[flag] !== void 0)) {
79039
+ if (KEY_FLAGS.some((flag2) => args.flags[flag2] !== void 0)) {
78727
79040
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
78728
79041
  }
78729
79042
  const file3 = flagText({ args, name: "from-file" });
@@ -78749,8 +79062,10 @@ var providers = async ({ context, args, client }) => {
78749
79062
  if (json2({ context, args, data: rows })) return;
78750
79063
  for (const row of rows) {
78751
79064
  const ready = row.configured ? "" : " not set up here";
78752
- context.out(`${row.id} ${row.label} ${row.category} ${row.sensitivity}${ready}
78753
- `);
79065
+ context.out(
79066
+ `${row.id} ${row.label} ${row.category} ${vaultCliLevelOf(row.sensitivity)}${ready}
79067
+ `
79068
+ );
78754
79069
  }
78755
79070
  };
78756
79071
  var start = async ({ context, args, client }) => {
@@ -78839,10 +79154,14 @@ var mcpRefresh = async ({ context, args, client }) => {
78839
79154
  };
78840
79155
  var mcpToolLevel = async ({ context, args, client }) => {
78841
79156
  const level = wordAt2(args, 5);
79157
+ const sensitivity = level === "default" ? null : vaultLevelOfCliName(level);
79158
+ if (sensitivity === "unknown") {
79159
+ throw new CliUsageError(`The level is one of ${VAULT_CLI_LEVEL_NAMES.join(", ")} or default.`);
79160
+ }
78842
79161
  const server = await client.post(CONNECTOR_KEY_PATHS.mcpToolLevel, {
78843
79162
  connectionId: wordAt2(args, 3),
78844
79163
  tool: wordAt2(args, 4),
78845
- sensitivity: level === "default" ? null : level
79164
+ sensitivity
78846
79165
  });
78847
79166
  if (json2({ context, args, data: server })) return;
78848
79167
  context.out(`${args.words[4]} is now ${level}.
@@ -79110,17 +79429,17 @@ async function dnd({ context, args }) {
79110
79429
  var DOMAINS_USAGE = `Usage:
79111
79430
  laze domains list proven domains, with auto-join (admins)
79112
79431
  laze domains auto-join <domain> on|off people on the domain join without asking`;
79113
- var printJson4 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
79432
+ var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
79114
79433
  `);
79115
79434
  function printDomain(context, row) {
79116
- const join21 = row.autoJoin ? "auto-join on" : "auto-join off";
79117
- context.out(`${row.domain} ${join21}${row.enforced ? " single sign-on enforced" : ""}
79435
+ const join22 = row.autoJoin ? "auto-join on" : "auto-join off";
79436
+ context.out(`${row.domain} ${join22}${row.enforced ? " single sign-on enforced" : ""}
79118
79437
  `);
79119
79438
  }
79120
79439
  async function list4({ context, args }) {
79121
79440
  const { client } = await signedIn({ context, args });
79122
79441
  const rows = await client.get("/api/join-domains");
79123
- if (args.flags.json) return printJson4(context, rows);
79442
+ if (args.flags.json) return printJson5(context, rows);
79124
79443
  if (rows.length === 0) {
79125
79444
  return context.out("No proven domains yet. laze sso claim <domain> starts proving one.\n");
79126
79445
  }
@@ -79134,7 +79453,7 @@ async function autoJoin({ context, args }) {
79134
79453
  domain: domain2,
79135
79454
  autoJoin: state === "on"
79136
79455
  });
79137
- if (args.flags.json) return printJson4(context, row);
79456
+ if (args.flags.json) return printJson5(context, row);
79138
79457
  printDomain(context, row);
79139
79458
  }
79140
79459
  var DOMAIN_COMMANDS = { list: list4, "auto-join": autoJoin };
@@ -79201,10 +79520,10 @@ var FEED_WRITING = `Write for a person deciding on a phone in a few seconds:
79201
79520
  The server pushes back with feed_hard_to_read when the text reads like a log;
79202
79521
  rewrite it, or pass --force to post it as written.`;
79203
79522
  var FEED_NO_BODY = "feed cards have no body: put the point in the title and one --summary line, text to send in --draft, sources in --link";
79204
- function pairOf({ value, flag }) {
79523
+ function pairOf({ value, flag: flag2 }) {
79205
79524
  const at = value.indexOf("=");
79206
79525
  if (at <= 0 || at === value.length - 1) {
79207
- throw new Error(`--${flag} takes <label>=<value>, got "${value}"`);
79526
+ throw new Error(`--${flag2} takes <label>=<value>, got "${value}"`);
79208
79527
  }
79209
79528
  return [value.slice(0, at), value.slice(at + 1)];
79210
79529
  }
@@ -79223,8 +79542,8 @@ function snoozeOf(args) {
79223
79542
  }
79224
79543
  function textsOf(args) {
79225
79544
  const texts = {};
79226
- for (const [flag, field] of Object.entries(TEXT_FLAGS)) {
79227
- const value = flagText({ args, name: flag });
79545
+ for (const [flag2, field] of Object.entries(TEXT_FLAGS)) {
79546
+ const value = flagText({ args, name: flag2 });
79228
79547
  if (value) texts[field] = sourceOf(value);
79229
79548
  }
79230
79549
  return texts;
@@ -79256,7 +79575,7 @@ function feedFlagsOf({ args }) {
79256
79575
  if (header) fields.draftHeader = header.replaceAll("\\n", "\n");
79257
79576
  const doneLabel = flagText({ args, name: "done-label" });
79258
79577
  if (doneLabel) fields.doneLabel = doneLabel;
79259
- for (const flag of ["urgent", "force"]) if (args.flags[flag]) fields[flag] = true;
79578
+ for (const flag2 of ["urgent", "force"]) if (args.flags[flag2]) fields[flag2] = true;
79260
79579
  const showAt = flagText({ args, name: "show-at" });
79261
79580
  if (showAt) fields.showAt = dateOf(showAt);
79262
79581
  const group = flagText({ args, name: "group" });
@@ -79738,6 +80057,7 @@ var feedFileLinkSchema = feedFileLinkSchemaDefinition;
79738
80057
  var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).build();
79739
80058
  var feedUi = uiTokens("feed");
79740
80059
  var FeedNavSlot = feedUi.component("nav");
80060
+ var FeedCountHooksToken = feedUi.hooks("count");
79741
80061
  var FeedChannelCardSlot = feedUi.component("channel-card");
79742
80062
  var FeedSearchSlot = feedUi.component("search");
79743
80063
 
@@ -80255,9 +80575,9 @@ async function signedGhArgs({
80255
80575
  let bodied = false;
80256
80576
  for (let index = 0; index < args.length; index += 1) {
80257
80577
  const arg = args[index] ?? "";
80258
- const [flag = "", inline] = arg.startsWith("--") ? arg.split(/=(.*)/s, 2) : [arg];
80259
- const isBody = BODY_FLAGS.has(flag);
80260
- const isFile = BODY_FILE_FLAGS.has(flag);
80578
+ const [flag2 = "", inline] = arg.startsWith("--") ? arg.split(/=(.*)/s, 2) : [arg];
80579
+ const isBody = BODY_FLAGS.has(flag2);
80580
+ const isFile = BODY_FILE_FLAGS.has(flag2);
80261
80581
  if (!isBody && !isFile) {
80262
80582
  out.push(arg);
80263
80583
  continue;
@@ -80575,7 +80895,7 @@ var IP_USAGE = `Usage:
80575
80895
  laze ip domains add|remove <domain>... change them; laze ip domains reset brings the defaults back
80576
80896
  laze ip offer [--site <domain>] the plain offer to pass on when a site blocks the shared address
80577
80897
  laze ip list who has one, its country and price (Owners and Admins)`;
80578
- var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
80898
+ var printJson6 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
80579
80899
  `);
80580
80900
  var OFF_REASONS = {
80581
80901
  credits: ", turned off because the credits ran out",
@@ -80607,12 +80927,12 @@ function ipLines(status8) {
80607
80927
  async function status4({ context, args }) {
80608
80928
  const client = await computeClient({ context, args });
80609
80929
  const answer4 = await client.get(DEDICATED_IP_REST_PATHS.mine);
80610
- if (args.flags.json) return printJson5(context, answer4);
80930
+ if (args.flags.json) return printJson6(context, answer4);
80611
80931
  context.out(`${ipLines(answer4).join("\n")}
80612
80932
  `);
80613
80933
  }
80614
80934
  async function printAnswer({ context, args }, answer4) {
80615
- if (args.flags.json) return printJson5(context, answer4);
80935
+ if (args.flags.json) return printJson6(context, answer4);
80616
80936
  context.out(`${answer4.message}
80617
80937
  `);
80618
80938
  }
@@ -80632,7 +80952,7 @@ async function turnOff(run4) {
80632
80952
  async function countries({ context, args }) {
80633
80953
  const client = await computeClient({ context, args });
80634
80954
  const answer4 = await client.get(DEDICATED_IP_REST_PATHS.countries);
80635
- if (args.flags.json) return printJson5(context, answer4);
80955
+ if (args.flags.json) return printJson6(context, answer4);
80636
80956
  const lines = answer4.countries.map((one) => ` ${one.code} ${one.name}`);
80637
80957
  context.out(`Countries on sale:
80638
80958
  ${lines.join("\n")}
@@ -80653,7 +80973,7 @@ async function domains2(run4) {
80653
80973
  if (!action) {
80654
80974
  const client2 = await computeClient(run4);
80655
80975
  const answer4 = await client2.get(DEDICATED_IP_REST_PATHS.mine);
80656
- if (run4.args.flags.json) return printJson5(run4.context, answer4.domains);
80976
+ if (run4.args.flags.json) return printJson6(run4.context, answer4.domains);
80657
80977
  return run4.context.out(`${answer4.domains.join("\n")}
80658
80978
  `);
80659
80979
  }
@@ -80672,14 +80992,14 @@ async function offer({ context, args }) {
80672
80992
  DEDICATED_IP_REST_PATHS.offer,
80673
80993
  site ? { site } : {}
80674
80994
  );
80675
- if (args.flags.json) return printJson5(context, answer4);
80995
+ if (args.flags.json) return printJson6(context, answer4);
80676
80996
  context.out(`${answer4.message}
80677
80997
  `);
80678
80998
  }
80679
80999
  async function list5({ context, args }) {
80680
81000
  const client = await computeClient({ context, args });
80681
81001
  const answer4 = await client.get(DEDICATED_IP_REST_PATHS.all);
80682
- if (args.flags.json) return printJson5(context, answer4);
81002
+ if (args.flags.json) return printJson6(context, answer4);
80683
81003
  if (answer4.ips.length === 0) return context.out("No one has a dedicated IP.\n");
80684
81004
  const money2 = (amount) => `${amount} ${answer4.currency.toUpperCase()}`;
80685
81005
  const lines = answer4.ips.map(
@@ -80859,13 +81179,13 @@ var KEYS_USAGE = `Usage:
80859
81179
  printed once, or with --to-vault saved to your personal keychain and never printed
80860
81180
  laze keys revoke <id> revoke one of your own keys
80861
81181
  laze keys revoke <id> --any revoke any key of the workspace (admins)`;
80862
- var printJson6 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
81182
+ var printJson7 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
80863
81183
  `);
80864
81184
  var lastUsed = (at) => at ? `last used ${at}` : "never used";
80865
- async function mine({ context, args }) {
81185
+ async function mine2({ context, args }) {
80866
81186
  const { client } = await signedIn({ context, args });
80867
81187
  const keys2 = await client.get("/api/api-keys/mine");
80868
- if (args.flags.json) return printJson6(context, keys2);
81188
+ if (args.flags.json) return printJson7(context, keys2);
80869
81189
  if (keys2.length === 0)
80870
81190
  return context.out("No keys yet. laze login or laze keys create make one.\n");
80871
81191
  for (const key of keys2) {
@@ -80879,7 +81199,7 @@ async function mine({ context, args }) {
80879
81199
  async function list6({ context, args }) {
80880
81200
  const { client } = await signedIn({ context, args });
80881
81201
  const keys2 = await client.get("/api/api-keys");
80882
- if (args.flags.json) return printJson6(context, keys2);
81202
+ if (args.flags.json) return printJson7(context, keys2);
80883
81203
  if (keys2.length === 0) return context.out("The workspace has no live keys.\n");
80884
81204
  for (const key of keys2) {
80885
81205
  const held = `${key.permissions.length} permissions`;
@@ -80921,13 +81241,13 @@ async function create({ context, args }) {
80921
81241
  const created = await client.post("/api/api-keys", { name: name2, permissions });
80922
81242
  if (connection) {
80923
81243
  await keepInVault({ client, created, connection });
80924
- if (args.flags.json) return printJson6(context, { key: created.key, vault: connection });
81244
+ if (args.flags.json) return printJson7(context, { key: created.key, vault: connection });
80925
81245
  return context.out(
80926
81246
  `Created ${created.key.name} (${created.key.id}), kept in your vault as ${connection}.
80927
81247
  `
80928
81248
  );
80929
81249
  }
80930
- if (args.flags.json) return printJson6(context, created);
81250
+ if (args.flags.json) return printJson7(context, created);
80931
81251
  context.out(`Created ${created.key.name} (${created.key.id}). Its token, shown once:
80932
81252
  `);
80933
81253
  context.out(`${created.token}
@@ -80939,11 +81259,11 @@ async function revoke({ context, args }) {
80939
81259
  const { client } = await signedIn({ context, args });
80940
81260
  const path = args.flags.any ? "/api/api-keys/revoke" : "/api/api-keys/mine/revoke";
80941
81261
  await client.post(path, { apiKeyId });
80942
- if (args.flags.json) return printJson6(context, { revoked: true, apiKeyId });
81262
+ if (args.flags.json) return printJson7(context, { revoked: true, apiKeyId });
80943
81263
  context.out(`Revoked ${apiKeyId}.
80944
81264
  `);
80945
81265
  }
80946
- var KEY_COMMANDS = { mine, list: list6, create, revoke };
81266
+ var KEY_COMMANDS = { mine: mine2, list: list6, create, revoke };
80947
81267
  async function keys({ context, args }) {
80948
81268
  const name2 = args.words[1] ?? "mine";
80949
81269
  const command = Object.hasOwn(KEY_COMMANDS, name2) ? KEY_COMMANDS[name2] : void 0;
@@ -81518,7 +81838,7 @@ async function unhost({ context, args }) {
81518
81838
  context.out(`${agent2} runs on your computer again.
81519
81839
  `);
81520
81840
  }
81521
- async function remove3({ context, args }) {
81841
+ async function remove4({ context, args }) {
81522
81842
  const client = await computeClient({ context, args });
81523
81843
  const machine2 = await client.post(COMPUTE_REST_PATHS.remove, {
81524
81844
  machine: machineArg2({ args })
@@ -81541,7 +81861,7 @@ async function machine({ context, args }) {
81541
81861
  if (command === "list" || command === "ls") return list7({ context, args });
81542
81862
  if (command === "health") return health({ context, args });
81543
81863
  if (command === "exec") return exec({ context, args });
81544
- if (command === "remove") return remove3({ context, args });
81864
+ if (command === "remove") return remove4({ context, args });
81545
81865
  if (command === "trust-host-key") return trustHostKey({ context, args });
81546
81866
  if (command === "host") return host({ context, args });
81547
81867
  if (command === "unhost") return unhost({ context, args });
@@ -81631,7 +81951,7 @@ function secretRefusal({
81631
81951
  const rule = command === void 0 ? void 0 : rules[command];
81632
81952
  if (!command || !rule) return void 0;
81633
81953
  const vaultFlag = rule.vaultFlag ?? "from-vault";
81634
- const raw = (rule.secretFlags ?? []).find((flag) => flag in flags2);
81954
+ const raw = (rule.secretFlags ?? []).find((flag2) => flag2 in flags2);
81635
81955
  if (raw)
81636
81956
  return `laze ${command} takes no --${raw} over MCP; name a vault connection with --${vaultFlag}.`;
81637
81957
  if (rule.vaultFlag && typeof flags2[rule.vaultFlag] === "string") return void 0;
@@ -82454,6 +82774,10 @@ ${OPS_USAGE}`);
82454
82774
  `);
82455
82775
  }
82456
82776
 
82777
+ // src/services/release-watch.service.ts
82778
+ import { mkdir as mkdir20, readFile as readFile30, realpath, writeFile as writeFile21 } from "node:fs/promises";
82779
+ import { dirname as dirname19, join as join20 } from "node:path";
82780
+
82457
82781
  // src/rules/cli-update.rules.ts
82458
82782
  var CLI_PACKAGE_LATEST = "@lazehq/cli@latest";
82459
82783
  var MANAGERS = [
@@ -82493,10 +82817,10 @@ function releaseAgeRetryOf({
82493
82817
  var CLI_RELEASE_HEADER = "x-laze-cli-release";
82494
82818
  var STAMP = /^(\d+)\.(\d+)\.(\d+)(?:-g([0-9a-f]+))?$/;
82495
82819
  function releaseSkewOf({
82496
- mine: mine3,
82820
+ mine: mine4,
82497
82821
  server
82498
82822
  }) {
82499
- const have = STAMP.exec(mine3);
82823
+ const have = STAMP.exec(mine4);
82500
82824
  const ships = STAMP.exec(server);
82501
82825
  if (!have || !ships) return null;
82502
82826
  for (const part of [1, 2, 3]) {
@@ -82506,32 +82830,69 @@ function releaseSkewOf({
82506
82830
  return have[4] && ships[4] && have[4] !== ships[4] ? "other_build" : null;
82507
82831
  }
82508
82832
  function releaseWarningOf({
82509
- mine: mine3,
82833
+ mine: mine4,
82510
82834
  server,
82511
82835
  sandbox
82512
82836
  }) {
82513
- const skew = releaseSkewOf({ mine: mine3, server });
82837
+ const skew = releaseSkewOf({ mine: mine4, server });
82514
82838
  if (!skew) return null;
82515
82839
  if (sandbox) {
82516
- return `laze: this CLI is ${mine3}, but the server ships ${server}. Laze updates the computer's CLI each time the agent connects, so restart the agent if this stays.
82840
+ return `laze: this CLI is ${mine4}, but the server ships ${server}. Laze updates the computer's CLI each time the agent connects, so restart the agent if this stays.
82517
82841
  `;
82518
82842
  }
82519
82843
  if (skew === "newer") {
82520
- return `laze: this CLI is ${mine3}, newer than the server's ${server}; a command the server does not have yet fails.
82844
+ return `laze: this CLI is ${mine4}, newer than the server's ${server}; a command the server does not have yet fails.
82521
82845
  `;
82522
82846
  }
82523
82847
  const how = `Update it with npm i -g ${CLI_PACKAGE_LATEST} (or laze update).`;
82524
82848
  if (skew === "older")
82525
- return `laze: this CLI is ${mine3}, older than the server's ${server}. ${how}
82849
+ return `laze: this CLI is ${mine4}, older than the server's ${server}. ${how}
82850
+ `;
82851
+ return `laze: this CLI is ${mine4}, a different build from the server's ${server}. ${how}
82526
82852
  `;
82527
- return `laze: this CLI is ${mine3}, a different build from the server's ${server}. ${how}
82853
+ }
82854
+ function selfUpdateLineOf({
82855
+ mine: mine4,
82856
+ server,
82857
+ manager
82858
+ }) {
82859
+ return `laze: this CLI is ${mine4}, older than the server's ${server}. Updating it in the background with ${manager}; the next command runs the new one (LAZE_AUTO_UPDATE=0 turns this off).
82528
82860
  `;
82529
82861
  }
82530
82862
 
82531
82863
  // src/services/release-watch.service.ts
82864
+ var RETRY_AFTER_MS = 6 * 60 * 60 * 1e3;
82865
+ async function scriptOf(context) {
82866
+ const script = context.program.at(-1) ?? "";
82867
+ try {
82868
+ return await realpath(script);
82869
+ } catch {
82870
+ return script;
82871
+ }
82872
+ }
82873
+ async function startedUpdate({
82874
+ context,
82875
+ server
82876
+ }) {
82877
+ if (context.environment.inherited.LAZE_AUTO_UPDATE === "0") return null;
82878
+ const plan2 = updatePlanOf({ script: await scriptOf(context) });
82879
+ if (plan2.kind !== "install") return null;
82880
+ const folder = dirname19(context.environment.configPath);
82881
+ const stamp = join20(folder, "auto-update.json");
82882
+ const last = await readFile30(stamp, "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
82883
+ const now = context.nowMs();
82884
+ if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
82885
+ await mkdir20(folder, { recursive: true, mode: 448 });
82886
+ await writeFile21(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
82887
+ context.processes.spawnDetached({
82888
+ argv: [...context.program, "update"],
82889
+ logPath: join20(folder, "auto-update.log")
82890
+ });
82891
+ return { manager: plan2.manager };
82892
+ }
82532
82893
  function watchingRelease({
82533
82894
  context,
82534
- mine: mine3 = cliVersionOf()
82895
+ mine: mine4 = cliVersionOf()
82535
82896
  }) {
82536
82897
  const sandbox = context.program.at(-1) === SANDBOX_CLI_PATH;
82537
82898
  let warned = false;
@@ -82541,10 +82902,12 @@ function watchingRelease({
82541
82902
  const response = await context.fetcher(input2, init);
82542
82903
  const server = response.headers.get(CLI_RELEASE_HEADER);
82543
82904
  if (!warned && server) {
82544
- const warning = releaseWarningOf({ mine: mine3, server, sandbox });
82905
+ const warning = releaseWarningOf({ mine: mine4, server, sandbox });
82545
82906
  if (warning) {
82546
82907
  warned = true;
82547
- context.err(warning);
82908
+ const older = !sandbox && releaseSkewOf({ mine: mine4, server }) === "older";
82909
+ const started = older ? await startedUpdate({ context, server }) : null;
82910
+ context.err(started ? selfUpdateLineOf({ mine: mine4, server, ...started }) : warning);
82548
82911
  }
82549
82912
  }
82550
82913
  return response;
@@ -82553,7 +82916,7 @@ function watchingRelease({
82553
82916
  }
82554
82917
 
82555
82918
  // src/services/rush-guard.service.ts
82556
- import { readFile as readFile30, rm as rm13 } from "node:fs/promises";
82919
+ import { readFile as readFile31, rm as rm13 } from "node:fs/promises";
82557
82920
  var WATCH_MS3 = 2e3;
82558
82921
  var RETRY_MS2 = 3e4;
82559
82922
  async function guardRound({ context, client, name: name2, lock, claudePid, session, rush }) {
@@ -82589,7 +82952,7 @@ async function rushWakeHook({ context, args }) {
82589
82952
  while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
82590
82953
  const { client, name: name2 } = await signedIn({ context, args });
82591
82954
  const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
82592
- const session = await readFile30(noted, "utf8").then(
82955
+ const session = await readFile31(noted, "utf8").then(
82593
82956
  (text2) => JSON.parse(text2),
82594
82957
  () => void 0
82595
82958
  );
@@ -82668,13 +83031,13 @@ function changesOf2(args) {
82668
83031
  const changes = {};
82669
83032
  const timed = ["cron", "rrule", "at"].some((name2) => flagText({ args, name: name2 }));
82670
83033
  if (timed) changes.timing = timingOf(args);
82671
- for (const [flag, field] of [
83034
+ for (const [flag2, field] of [
82672
83035
  ["name", "name"],
82673
83036
  ["prompt", "prompt"],
82674
83037
  ["tz", "timezone"],
82675
83038
  ["agent", "agentId"]
82676
83039
  ]) {
82677
- const value = flagText({ args, name: flag });
83040
+ const value = flagText({ args, name: flag2 });
82678
83041
  if (value) changes[field] = value;
82679
83042
  }
82680
83043
  const channel = flagText({ args, name: "channel" });
@@ -82755,8 +83118,8 @@ async function schedule({ context, args }) {
82755
83118
  }
82756
83119
 
82757
83120
  // src/services/skill-commands.service.ts
82758
- import { readdir as readdir6, readFile as readFile31 } from "node:fs/promises";
82759
- import { join as join20, relative as relative6, resolve as resolve12 } from "node:path";
83121
+ import { readdir as readdir6, readFile as readFile32 } from "node:fs/promises";
83122
+ import { join as join21, relative as relative6, resolve as resolve12 } from "node:path";
82760
83123
  var USAGE16 = `Usage:
82761
83124
  laze skill list [--agent <agentId>]
82762
83125
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -82777,8 +83140,8 @@ async function folderFiles({ root }) {
82777
83140
  const files2 = [];
82778
83141
  for (const entry of entries) {
82779
83142
  if (!entry.isFile()) continue;
82780
- const full = join20(entry.parentPath, entry.name);
82781
- files2.push({ path: relative6(root, full), content: await readFile31(full, "utf8") });
83143
+ const full = join21(entry.parentPath, entry.name);
83144
+ files2.push({ path: relative6(root, full), content: await readFile32(full, "utf8") });
82782
83145
  }
82783
83146
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
82784
83147
  }
@@ -82876,7 +83239,7 @@ async function skillUpdate({ context, args }) {
82876
83239
  if (!name2 || !newName && description === void 0 && !skillMdFile) {
82877
83240
  throw new CliUsageError(USAGE16);
82878
83241
  }
82879
- const skillMd = skillMdFile ? await readFile31(resolve12(context.cwd, skillMdFile), "utf8") : void 0;
83242
+ const skillMd = skillMdFile ? await readFile32(resolve12(context.cwd, skillMdFile), "utf8") : void 0;
82880
83243
  const { client } = await signedIn({ context, args });
82881
83244
  const updated = await client.post("/api/skills/update", {
82882
83245
  name: name2,
@@ -82922,7 +83285,7 @@ async function skill({ context, args }) {
82922
83285
  }
82923
83286
 
82924
83287
  // src/services/slack-commands.service.ts
82925
- import { readFile as readFile32 } from "node:fs/promises";
83288
+ import { readFile as readFile33 } from "node:fs/promises";
82926
83289
  import { resolve as resolve13 } from "node:path";
82927
83290
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
82928
83291
  laze slack overview connected Slack workspaces, mirrors, your link
@@ -82966,11 +83329,11 @@ function wordAt5(args, index) {
82966
83329
  return word3;
82967
83330
  }
82968
83331
  async function secretLines({ context, args }) {
82969
- if (SECRET_FLAGS2.some((flag) => args.flags[flag] !== void 0)) {
83332
+ if (SECRET_FLAGS2.some((flag2) => args.flags[flag2] !== void 0)) {
82970
83333
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
82971
83334
  }
82972
83335
  const file3 = flagText({ args, name: "from-file" });
82973
- const text2 = file3 ? await readFile32(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
83336
+ const text2 = file3 ? await readFile33(resolve13(context.cwd, file3), "utf8") : await context.readStdin();
82974
83337
  return text2.split("\n").map((line) => line.trim()).filter(Boolean);
82975
83338
  }
82976
83339
  async function secretsOf({
@@ -83168,16 +83531,16 @@ var disconnect2 = async ({ context, args, client }) => {
83168
83531
  context.out(`Disconnected ${teamId}.
83169
83532
  `);
83170
83533
  };
83171
- function printMove({ context, move: move2 }) {
83172
- const problem = move2.problem ? ` ${move2.problem.message}` : "";
83173
- context.out(`${move2.moveId} #${move2.slackName} -> #${move2.name} ${move2.state}${problem}
83534
+ function printMove({ context, move: move3 }) {
83535
+ const problem = move3.problem ? ` ${move3.problem.message}` : "";
83536
+ context.out(`${move3.moveId} #${move3.slackName} -> #${move3.name} ${move3.state}${problem}
83174
83537
  `);
83175
83538
  }
83176
83539
  var moves = async ({ context, args, client }) => {
83177
83540
  const answer4 = await client.get(SLACK_KEY_PATHS.moves);
83178
83541
  if (json3({ context, args, data: answer4 })) return;
83179
83542
  if (answer4.moves.length === 0) context.out("No moves yet.\n");
83180
- for (const move2 of answer4.moves) printMove({ context, move: move2 });
83543
+ for (const move3 of answer4.moves) printMove({ context, move: move3 });
83181
83544
  };
83182
83545
  var movePreview = async ({ context, args, client }) => {
83183
83546
  const preview = await client.post(SLACK_KEY_PATHS.movePreview, {
@@ -83212,7 +83575,7 @@ function moveBody(args) {
83212
83575
  }))
83213
83576
  };
83214
83577
  }
83215
- var move = async ({ context, args, client }) => {
83578
+ var move2 = async ({ context, args, client }) => {
83216
83579
  const answer4 = await client.post(SLACK_KEY_PATHS.startMoves, moveBody(args));
83217
83580
  if (json3({ context, args, data: answer4 })) return;
83218
83581
  for (const one of answer4.started) {
@@ -83259,7 +83622,7 @@ var RUNS4 = {
83259
83622
  disconnect: disconnect2,
83260
83623
  moves,
83261
83624
  "move-preview": movePreview,
83262
- move,
83625
+ move: move2,
83263
83626
  "cancel-move": cancelMove
83264
83627
  };
83265
83628
  async function slack({
@@ -83274,7 +83637,7 @@ async function slack({
83274
83637
  }
83275
83638
 
83276
83639
  // src/services/sso-commands.service.ts
83277
- import { readFile as readFile33 } from "node:fs/promises";
83640
+ import { readFile as readFile34 } from "node:fs/promises";
83278
83641
  var SSO_USAGE = `Usage:
83279
83642
  laze sso domains claimed domains and how each signs in (admins)
83280
83643
  laze sso claim <domain> the TXT record that proves the domain
@@ -83292,7 +83655,7 @@ var SCIM_USAGE = `Usage:
83292
83655
  laze scim create-token <name> [--to-vault <name>] a token for the identity provider; printed
83293
83656
  once, or with --to-vault kept in your personal keychain and never printed
83294
83657
  laze scim revoke-token <id> the directory is refused at once`;
83295
- var printJson7 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
83658
+ var printJson8 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
83296
83659
  `);
83297
83660
  function stateOf2(claim3) {
83298
83661
  if (!claim3.verified) return "not verified";
@@ -83324,13 +83687,13 @@ async function claimCall({
83324
83687
  }) {
83325
83688
  const { client } = await signedIn({ context, args });
83326
83689
  const claim3 = await client.post(path, body);
83327
- if (args.flags.json) return printJson7(context, claim3);
83690
+ if (args.flags.json) return printJson8(context, claim3);
83328
83691
  printClaim(context, claim3);
83329
83692
  }
83330
83693
  async function domains3({ context, args }) {
83331
83694
  const { client } = await signedIn({ context, args });
83332
83695
  const claims = await client.get("/api/sso/domains");
83333
- if (args.flags.json) return printJson7(context, claims);
83696
+ if (args.flags.json) return printJson8(context, claims);
83334
83697
  if (claims.length === 0) return context.out("No claimed domains yet. laze sso claim <domain>.\n");
83335
83698
  for (const claim3 of claims) printClaim(context, claim3);
83336
83699
  }
@@ -83353,7 +83716,7 @@ var connectGoogle = ({ context, args }) => claimCall({
83353
83716
  body: { domain: domainOf({ args, usage: SSO_USAGE }) }
83354
83717
  });
83355
83718
  function refuseSecretFlags({ args }) {
83356
- if (["client-secret", "secret"].some((flag) => args.flags[flag] !== void 0)) {
83719
+ if (["client-secret", "secret"].some((flag2) => args.flags[flag2] !== void 0)) {
83357
83720
  throw new CliUsageError(
83358
83721
  "A client secret never goes in a flag (shell history keeps it): pipe it on stdin or use --from-file."
83359
83722
  );
@@ -83361,7 +83724,7 @@ function refuseSecretFlags({ args }) {
83361
83724
  }
83362
83725
  async function clientSecretOf({ context, args }) {
83363
83726
  const file3 = flagText({ args, name: "from-file" });
83364
- const text2 = file3 ? await readFile33(file3, "utf8") : await context.readStdin();
83727
+ const text2 = file3 ? await readFile34(file3, "utf8") : await context.readStdin();
83365
83728
  const secret = text2.trim();
83366
83729
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
83367
83730
  return secret;
@@ -83391,7 +83754,7 @@ async function enforce({ context, args }) {
83391
83754
  "/api/sso/enforce",
83392
83755
  { domain: domain2, enforced: state === "on" }
83393
83756
  );
83394
- if (args.flags.json) return printJson7(context, outcome);
83757
+ if (args.flags.json) return printJson8(context, outcome);
83395
83758
  printClaim(context, outcome.claim);
83396
83759
  if (outcome.endedSessions > 0) {
83397
83760
  context.out(`Ended ${outcome.endedSessions} sessions that signed in another way.
@@ -83412,7 +83775,7 @@ async function domainAction({ context, args, path }) {
83412
83775
  const domain2 = domainOf({ args, usage: SSO_USAGE });
83413
83776
  const { client } = await signedIn({ context, args });
83414
83777
  const answer4 = await client.post(path, { domain: domain2 });
83415
- if (args.flags.json) return printJson7(context, answer4);
83778
+ if (args.flags.json) return printJson8(context, answer4);
83416
83779
  context.out(`${path.endsWith("remove") ? "Removed" : "Disconnected"} ${domain2}.
83417
83780
  `);
83418
83781
  }
@@ -83435,7 +83798,7 @@ async function sso({ context, args }) {
83435
83798
  async function scimTokens({ context, args }) {
83436
83799
  const { client } = await signedIn({ context, args });
83437
83800
  const tokens = await client.get("/api/scim-tokens");
83438
- if (args.flags.json) return printJson7(context, tokens);
83801
+ if (args.flags.json) return printJson8(context, tokens);
83439
83802
  if (tokens.length === 0) return context.out("No SCIM tokens. laze scim create-token <name>.\n");
83440
83803
  for (const token2 of tokens) {
83441
83804
  context.out(`${token2.id} ${token2.name} by ${token2.createdByUserId} ${token2.createdAt}
@@ -83474,7 +83837,7 @@ async function scimCreateToken({ context, args }) {
83474
83837
  if (connection) {
83475
83838
  await keepScimToken({ client, minted, connection });
83476
83839
  if (args.flags.json) {
83477
- return printJson7(context, {
83840
+ return printJson8(context, {
83478
83841
  token: minted.token,
83479
83842
  baseUrl: minted.baseUrl,
83480
83843
  vault: connection
@@ -83487,7 +83850,7 @@ async function scimCreateToken({ context, args }) {
83487
83850
  return context.out(`SCIM base URL for your identity provider: ${minted.baseUrl}
83488
83851
  `);
83489
83852
  }
83490
- if (args.flags.json) return printJson7(context, minted);
83853
+ if (args.flags.json) return printJson8(context, minted);
83491
83854
  context.out(`Created ${minted.token.name} (${minted.token.id}). Its token, shown once:
83492
83855
  `);
83493
83856
  context.out(`${minted.secret}
@@ -83500,7 +83863,7 @@ async function scimRevokeToken({ context, args }) {
83500
83863
  if (!tokenId) throw new CliUsageError(SCIM_USAGE);
83501
83864
  const { client } = await signedIn({ context, args });
83502
83865
  await client.post("/api/scim-tokens/revoke", { tokenId });
83503
- if (args.flags.json) return printJson7(context, { revoked: true, tokenId });
83866
+ if (args.flags.json) return printJson8(context, { revoked: true, tokenId });
83504
83867
  context.out(`Revoked ${tokenId}.
83505
83868
  `);
83506
83869
  }
@@ -83574,12 +83937,12 @@ async function statusUsage() {
83574
83937
  }
83575
83938
 
83576
83939
  // src/services/update-commands.service.ts
83577
- import { realpath } from "node:fs/promises";
83940
+ import { realpath as realpath2 } from "node:fs/promises";
83578
83941
  var BY_HAND = `npm install -g ${CLI_PACKAGE_LATEST}`;
83579
83942
  async function realScriptOf({ program }) {
83580
83943
  const script = program.at(-1) ?? "";
83581
83944
  try {
83582
- return await realpath(script);
83945
+ return await realpath2(script);
83583
83946
  } catch {
83584
83947
  return script;
83585
83948
  }
@@ -83711,7 +84074,7 @@ async function vaultSave({ context, args }) {
83711
84074
  }
83712
84075
 
83713
84076
  // src/services/vault-scrub-commands.service.ts
83714
- function lineOf3(channel) {
84077
+ function lineOf4(channel) {
83715
84078
  const where = channel.name ? `#${channel.name}` : channel.channelId;
83716
84079
  const found = Object.entries(channel.found).map(([vendor, count4]) => `${vendor} ${count4}`).join(", ");
83717
84080
  const kinds = [`held ${channel.held}`, ...found ? [`found: ${found}`] : []].join("; ");
@@ -83725,7 +84088,7 @@ async function vaultScrub({ context, args }) {
83725
84088
  if (args.flags.json) return context.out(`${JSON.stringify(report3, null, 2)}
83726
84089
  `);
83727
84090
  const changed = report3.channels.filter((channel) => channel.messages > 0);
83728
- for (const channel of changed) context.out(lineOf3(channel));
84091
+ for (const channel of changed) context.out(lineOf4(channel));
83729
84092
  const total = changed.reduce((sum, channel) => sum + channel.messages, 0);
83730
84093
  context.out(
83731
84094
  report3.dryRun ? `Dry run: ${total} message(s) would change. Nothing was changed.
@@ -83735,7 +84098,7 @@ async function vaultScrub({ context, args }) {
83735
84098
  }
83736
84099
 
83737
84100
  // src/services/whatsapp-business-commands.service.ts
83738
- import { readFile as readFile34 } from "node:fs/promises";
84101
+ import { readFile as readFile35 } from "node:fs/promises";
83739
84102
  import { resolve as resolve14 } from "node:path";
83740
84103
 
83741
84104
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
@@ -84147,7 +84510,7 @@ async function settle2({ client, send: send4 }) {
84147
84510
  return current2;
84148
84511
  }
84149
84512
  async function secretsOf2({ context, args }) {
84150
- if (SECRET_FLAGS3.some((flag) => args.flags[flag] !== void 0)) {
84513
+ if (SECRET_FLAGS3.some((flag2) => args.flags[flag2] !== void 0)) {
84151
84514
  throw new CliUsageError(
84152
84515
  "A secret never goes in a flag: pipe it on stdin, use --from-file or --from-vault."
84153
84516
  );
@@ -84155,7 +84518,7 @@ async function secretsOf2({ context, args }) {
84155
84518
  const fromConnection = flagText({ args, name: "from-vault" });
84156
84519
  if (fromConnection) return { fromConnection };
84157
84520
  const file3 = flagText({ args, name: "from-file" });
84158
- const text2 = file3 ? await readFile34(resolve14(context.cwd, file3), "utf8") : await context.readStdin();
84521
+ const text2 = file3 ? await readFile35(resolve14(context.cwd, file3), "utf8") : await context.readStdin();
84159
84522
  const lines = text2.split("\n").map((line) => line.trim()).filter(Boolean);
84160
84523
  if (lines.length !== 2) {
84161
84524
  throw new CliUsageError(
@@ -84356,7 +84719,7 @@ async function whatsappBusiness({
84356
84719
  }
84357
84720
 
84358
84721
  // src/services/whatsapp-pairing-commands.service.ts
84359
- import { writeFile as writeFile21 } from "node:fs/promises";
84722
+ import { writeFile as writeFile22 } from "node:fs/promises";
84360
84723
  import { resolve as resolve15 } from "node:path";
84361
84724
  var WHATSAPP_PAIRING_USAGE = [
84362
84725
  " laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
@@ -84377,7 +84740,7 @@ function svgOf(dataUrl) {
84377
84740
  }
84378
84741
  async function report({ context, args, pairing: pairing2 }) {
84379
84742
  const qrFile = pairing2.qrSvg ? resolve15(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
84380
- if (qrFile && pairing2.qrSvg) await writeFile21(qrFile, svgOf(pairing2.qrSvg), "utf8");
84743
+ if (qrFile && pairing2.qrSvg) await writeFile22(qrFile, svgOf(pairing2.qrSvg), "utf8");
84381
84744
  if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
84382
84745
  `);
84383
84746
  context.out(`${pairing2.pairingId} ${pairing2.state}
@@ -84674,12 +85037,12 @@ async function wiki({ context, args }) {
84674
85037
  var FLAGS_USAGE = `Usage:
84675
85038
  laze flags list
84676
85039
  laze flags set <key> on|off`;
84677
- var printJson8 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
85040
+ var printJson9 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
84678
85041
  `);
84679
85042
  async function roles({ context, args }) {
84680
85043
  const { client } = await signedIn({ context, args });
84681
85044
  const catalogue = await client.get("/api/roles");
84682
- if (args.flags.json) return printJson8(context, catalogue);
85045
+ if (args.flags.json) return printJson9(context, catalogue);
84683
85046
  for (const role2 of catalogue) {
84684
85047
  const count4 = `${role2.permissions.length} permissions`;
84685
85048
  context.out(`${role2.label} ${count4} ${role2.description}
@@ -84695,7 +85058,7 @@ async function audit({ context, args }) {
84695
85058
  throw new CliUsageError("Usage: laze audit [--limit <1-200>]");
84696
85059
  const { client } = await signedIn({ context, args });
84697
85060
  const entries = await client.post("/api/audit-log/list", limit ? { limit } : {});
84698
- if (args.flags.json) return printJson8(context, entries);
85061
+ if (args.flags.json) return printJson9(context, entries);
84699
85062
  if (entries.length === 0) return context.out("No audited actions yet.\n");
84700
85063
  for (const entry of entries) {
84701
85064
  const actor = `${entry.actorType}${entry.actorId ? ` ${entry.actorId}` : ""}`;
@@ -84710,21 +85073,21 @@ async function audit({ context, args }) {
84710
85073
  async function flagsList({ context, args }) {
84711
85074
  const { client } = await signedIn({ context, args });
84712
85075
  const flags2 = await client.get("/api/feature-flags");
84713
- if (args.flags.json) return printJson8(context, flags2);
85076
+ if (args.flags.json) return printJson9(context, flags2);
84714
85077
  if (flags2.length === 0) return context.out("No flag was ever set: every flag is off.\n");
84715
- for (const flag of flags2) context.out(`${flag.key} ${flag.enabled ? "on" : "off"}
85078
+ for (const flag2 of flags2) context.out(`${flag2.key} ${flag2.enabled ? "on" : "off"}
84716
85079
  `);
84717
85080
  }
84718
85081
  async function flagsSet({ context, args }) {
84719
85082
  const [, , key, state] = args.words;
84720
85083
  if (!key || state !== "on" && state !== "off") throw new CliUsageError(FLAGS_USAGE);
84721
85084
  const { client } = await signedIn({ context, args });
84722
- const flag = await client.post("/api/feature-flags/set", {
85085
+ const flag2 = await client.post("/api/feature-flags/set", {
84723
85086
  key,
84724
85087
  enabled: state === "on"
84725
85088
  });
84726
- if (args.flags.json) return printJson8(context, flag);
84727
- context.out(`${flag.key} ${flag.enabled ? "on" : "off"}
85089
+ if (args.flags.json) return printJson9(context, flag2);
85090
+ context.out(`${flag2.key} ${flag2.enabled ? "on" : "off"}
84728
85091
  `);
84729
85092
  }
84730
85093
  var FLAG_COMMANDS = { list: flagsList, set: flagsSet };
@@ -84736,7 +85099,7 @@ async function flags({ context, args }) {
84736
85099
  }
84737
85100
 
84738
85101
  // src/services/workspace-commands.service.ts
84739
- import { readFile as readFile35 } from "node:fs/promises";
85102
+ import { readFile as readFile36 } from "node:fs/promises";
84740
85103
  import { resolve as resolve16 } from "node:path";
84741
85104
  var ROLE_NAMES2 = {
84742
85105
  OWNER: "Owner",
@@ -84769,7 +85132,7 @@ ${deleting}`;
84769
85132
  }
84770
85133
  });
84771
85134
  }
84772
- async function mine2({ context, args }) {
85135
+ async function mine3({ context, args }) {
84773
85136
  const { client } = await signedIn({ context, args });
84774
85137
  const answer4 = await client.post("/api/agents/me/workspace/mine", {});
84775
85138
  print8({
@@ -84919,7 +85282,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
84919
85282
  async function readLogo({ context, file: file3 }) {
84920
85283
  let bytes;
84921
85284
  try {
84922
- bytes = new Uint8Array(await readFile35(resolve16(context.cwd, file3)));
85285
+ bytes = new Uint8Array(await readFile36(resolve16(context.cwd, file3)));
84923
85286
  } catch {
84924
85287
  throw new CliUsageError(`No file to read at ${file3}.`);
84925
85288
  }
@@ -84958,7 +85321,7 @@ var WORKSPACE_COMMANDS = {
84958
85321
  list: listWorkspaces,
84959
85322
  switch: switchTo,
84960
85323
  logo,
84961
- mine: mine2,
85324
+ mine: mine3,
84962
85325
  rename: rename7,
84963
85326
  create: create2,
84964
85327
  leave,
@@ -85066,7 +85429,7 @@ async function role({ context, args }) {
85066
85429
  `
85067
85430
  });
85068
85431
  }
85069
- async function remove4({ context, args }) {
85432
+ async function remove5({ context, args }) {
85070
85433
  const member = args.words[2];
85071
85434
  if (!member) throw new CliUsageError("Usage: laze members remove <member>");
85072
85435
  const { client } = await signedIn({ context, args });
@@ -85115,7 +85478,7 @@ var MEMBERS_COMMANDS = {
85115
85478
  "revoke-invite": revokeInvite,
85116
85479
  "invite-link": inviteLink,
85117
85480
  role,
85118
- remove: remove4,
85481
+ remove: remove5,
85119
85482
  requests,
85120
85483
  approve: deciding("approved"),
85121
85484
  deny: deciding("denied")
@@ -85316,6 +85679,9 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
85316
85679
  laze computer request <size> | cancel <request> ask the admins for a size, or withdraw the ask
85317
85680
  laze computer list everyone's computers, size and monthly cost (Owners and Admins)
85318
85681
  laze computer restart [--person <user id>] stop and start a computer that runs fine (people, not agents)
85682
+ laze computer mine | add <name> --size <size> [--shared] your Laze computers; add one (Owners and Admins)
85683
+ laze computer remove <computer> [--to <computer>] | move <agent> <computer|default> delete one, or move an agent
85684
+ laze computer creators <computer> --everyone | --people <id,id> who may add agents on a shared computer
85319
85685
  laze ip [status|on <country>|off|countries|domains [add|remove|reset]|list] your dedicated IP for sites that block Laze
85320
85686
  laze ip offer --site <domain> when a site blocks the shared address: the offer to pass on, price included
85321
85687
  laze ops suspend|release <workspace> --reason "<why>" Laze operators only, with LAZE_OPS_TOKEN
@@ -85584,8 +85950,8 @@ async function runCli({
85584
85950
  // src/services/processes.service.ts
85585
85951
  import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
85586
85952
  import { mkdirSync, openSync } from "node:fs";
85587
- import { readFile as readFile36, readlink } from "node:fs/promises";
85588
- import { dirname as dirname19 } from "node:path";
85953
+ import { readFile as readFile37, readlink } from "node:fs/promises";
85954
+ import { dirname as dirname20 } from "node:path";
85589
85955
  import { promisify as promisify2 } from "node:util";
85590
85956
  var run3 = promisify2(execFile2);
85591
85957
  function alive(pid) {
@@ -85598,14 +85964,14 @@ function alive(pid) {
85598
85964
  }
85599
85965
  }
85600
85966
  async function argsOf(pid) {
85601
- const raw = await readFile36(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
85967
+ const raw = await readFile37(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
85602
85968
  if (raw) return raw.split("\0").filter(Boolean);
85603
85969
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
85604
85970
  const line = listed?.stdout.trim();
85605
85971
  return line ? line.split(/\s+/) : void 0;
85606
85972
  }
85607
85973
  async function parentOf(pid) {
85608
- const stat3 = await readFile36(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
85974
+ const stat3 = await readFile37(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
85609
85975
  const fromStat = stat3 ? Number(stat3.slice(stat3.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
85610
85976
  if (fromStat > 0) return fromStat;
85611
85977
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
@@ -85622,7 +85988,7 @@ async function cwdOf(pid) {
85622
85988
  return line ? line.slice(1) : void 0;
85623
85989
  }
85624
85990
  function spawnDetached({ argv, logPath }) {
85625
- mkdirSync(dirname19(logPath), { recursive: true, mode: 448 });
85991
+ mkdirSync(dirname20(logPath), { recursive: true, mode: 448 });
85626
85992
  const log = openSync(logPath, "a", 384);
85627
85993
  const [program = "", ...rest] = argv;
85628
85994
  const child = spawn4(program, rest, { detached: true, stdio: ["ignore", log, log] });