@lazehq/cli 0.1.56 → 0.1.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/laze.mjs +1747 -494
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -2491,7 +2491,7 @@ var require_websocket = __commonJS({
2491
2491
  var http = __require("http");
2492
2492
  var net = __require("net");
2493
2493
  var tls = __require("tls");
2494
- var { randomBytes: randomBytes2, createHash: createHash3 } = __require("crypto");
2494
+ var { randomBytes: randomBytes2, createHash: createHash4 } = __require("crypto");
2495
2495
  var { Duplex, Readable } = __require("stream");
2496
2496
  var { URL: URL2 } = __require("url");
2497
2497
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -3159,7 +3159,7 @@ var require_websocket = __commonJS({
3159
3159
  abortHandshake(websocket, socket, "Invalid Upgrade header");
3160
3160
  return;
3161
3161
  }
3162
- const digest = createHash3("sha1").update(key + GUID).digest("base64");
3162
+ const digest = createHash4("sha1").update(key + GUID).digest("base64");
3163
3163
  if (res.headers["sec-websocket-accept"] !== digest) {
3164
3164
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
3165
3165
  return;
@@ -3440,7 +3440,7 @@ var require_stream = __commonJS({
3440
3440
  };
3441
3441
  duplex._final = function(callback) {
3442
3442
  if (ws.readyState === ws.CONNECTING) {
3443
- ws.once("open", function open3() {
3443
+ ws.once("open", function open4() {
3444
3444
  duplex._final(callback);
3445
3445
  });
3446
3446
  return;
@@ -3461,7 +3461,7 @@ var require_stream = __commonJS({
3461
3461
  };
3462
3462
  duplex._write = function(chunk, encoding, callback) {
3463
3463
  if (ws.readyState === ws.CONNECTING) {
3464
- ws.once("open", function open3() {
3464
+ ws.once("open", function open4() {
3465
3465
  duplex._write(chunk, encoding, callback);
3466
3466
  });
3467
3467
  return;
@@ -3528,7 +3528,7 @@ var require_websocket_server = __commonJS({
3528
3528
  var EventEmitter = __require("events");
3529
3529
  var http = __require("http");
3530
3530
  var { Duplex } = __require("stream");
3531
- var { createHash: createHash3 } = __require("crypto");
3531
+ var { createHash: createHash4 } = __require("crypto");
3532
3532
  var extension2 = require_extension();
3533
3533
  var PerMessageDeflate2 = require_permessage_deflate();
3534
3534
  var subprotocol2 = require_subprotocol();
@@ -3835,7 +3835,7 @@ var require_websocket_server = __commonJS({
3835
3835
  );
3836
3836
  }
3837
3837
  if (this._state > RUNNING) return abortHandshake(socket, 503);
3838
- const digest = createHash3("sha1").update(key + GUID).digest("base64");
3838
+ const digest = createHash4("sha1").update(key + GUID).digest("base64");
3839
3839
  const headers = [
3840
3840
  "HTTP/1.1 101 Switching Protocols",
3841
3841
  "Upgrade: websocket",
@@ -18733,7 +18733,7 @@ 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: writeFile24, readFile: readFile43, mkdir: mkdir23 } = __require("node:fs/promises");
18736
+ var { writeFile: writeFile24, readFile: readFile44, mkdir: mkdir23 } = __require("node:fs/promises");
18737
18737
  var { dirname: dirname24, resolve: resolve21 } = __require("node:path");
18738
18738
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
18739
18739
  var { InvalidArgumentError, UndiciError } = require_errors();
@@ -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 readFile43(resolve21(path), "utf8");
18953
+ const data = await readFile44(resolve21(path), "utf8");
18954
18954
  const parsed = JSON.parse(data);
18955
18955
  if (Array.isArray(parsed)) {
18956
18956
  this.#snapshots.clear();
@@ -31489,6 +31489,13 @@ function findSecrets({
31489
31489
  (secret) => !isPlaceholderValue({ value: secret.value, kind: secret.kind })
31490
31490
  );
31491
31491
  }
31492
+ function redactDetectedSecrets({ text: text2 }) {
31493
+ let out = text2;
31494
+ for (const secret of matchSecrets({ text: text2 }).reverse()) {
31495
+ out = out.slice(0, secret.start) + REDACTION_MARKER + out.slice(secret.end);
31496
+ }
31497
+ return out;
31498
+ }
31492
31499
 
31493
31500
  // ../../packages/secret-guard/src/detector/one-time-links.ts
31494
31501
  var URL_PATTERN = /https?:\/\/[^\s<>"'`)\]]+/g;
@@ -31580,6 +31587,91 @@ function secretValuesOf({
31580
31587
  return Object.entries(fields).filter(([name3]) => !isIdentifierField({ name: name3 })).map(([, value]) => value);
31581
31588
  }
31582
31589
 
31590
+ // ../../packages/secret-guard/src/redaction/jsonl-strings.ts
31591
+ var JSONL_STRUCTURAL_KEYS = /* @__PURE__ */ new Set([
31592
+ "uuid",
31593
+ "parentUuid",
31594
+ "leafUuid",
31595
+ "logicalParentUuid",
31596
+ "sessionId",
31597
+ "requestId",
31598
+ "messageId",
31599
+ "id",
31600
+ "tool_use_id",
31601
+ "call_id",
31602
+ "type",
31603
+ "role",
31604
+ "timestamp",
31605
+ "version",
31606
+ "model",
31607
+ "signature",
31608
+ "cwd",
31609
+ "gitBranch",
31610
+ "userType",
31611
+ "stop_reason",
31612
+ "originator",
31613
+ "cli_version"
31614
+ ]);
31615
+ function recordSlotsOf(record4, into) {
31616
+ for (const [key, item] of Object.entries(record4)) {
31617
+ if (typeof item !== "string") slotsOf(item, into);
31618
+ else if (!JSONL_STRUCTURAL_KEYS.has(key)) into.push({ holder: record4, key });
31619
+ }
31620
+ }
31621
+ function slotsOf(value, into) {
31622
+ if (Array.isArray(value)) {
31623
+ value.forEach((item, index) => {
31624
+ if (typeof item === "string") into.push({ holder: value, key: index });
31625
+ else slotsOf(item, into);
31626
+ });
31627
+ return;
31628
+ }
31629
+ if (typeof value === "object" && value !== null) {
31630
+ recordSlotsOf(value, into);
31631
+ }
31632
+ }
31633
+ function read(slot) {
31634
+ return slot.holder[slot.key] ?? "";
31635
+ }
31636
+ function write(slot, text2) {
31637
+ slot.holder[slot.key] = text2;
31638
+ }
31639
+ function parsedLine(line) {
31640
+ if (line.trim() === "") return { raw: true };
31641
+ try {
31642
+ return { raw: false, value: JSON.parse(line) };
31643
+ } catch {
31644
+ return { raw: true };
31645
+ }
31646
+ }
31647
+ async function mapJsonlStrings({
31648
+ text: text2,
31649
+ mapAll
31650
+ }) {
31651
+ const sources = text2.split("\n");
31652
+ const cells = [];
31653
+ const raw = [];
31654
+ const slots = [];
31655
+ sources.forEach((source, index) => {
31656
+ const line = parsedLine(source);
31657
+ raw.push(line.raw);
31658
+ cells.push(line.raw ? source : line.value);
31659
+ if (typeof cells[index] !== "string") slotsOf(cells[index], slots);
31660
+ else if (source.trim() !== "") slots.push({ holder: cells, key: index });
31661
+ });
31662
+ const before = slots.map(read);
31663
+ const after = await mapAll(before);
31664
+ if (after.length !== before.length) throw new Error("mapAll answered a different count");
31665
+ let changed = 0;
31666
+ slots.forEach((slot, index) => {
31667
+ const next = after[index] ?? "";
31668
+ if (next !== before[index]) changed += 1;
31669
+ write(slot, next);
31670
+ });
31671
+ const out = cells.map((cell, index) => raw[index] ? String(cell) : JSON.stringify(cell));
31672
+ return { text: out.join("\n"), changed };
31673
+ }
31674
+
31583
31675
  // ../../packages/secret-guard/src/redaction/redactor.ts
31584
31676
  var REDACTED = "****";
31585
31677
  var MIN_REDACTED_LENGTH = 4;
@@ -35569,7 +35661,8 @@ function cliEnvironment({
35569
35661
  } = {}) {
35570
35662
  return {
35571
35663
  configPath: env.LAZE_CLI_CONFIG || join(homedir(), ".laze", "config.json"),
35572
- // Claude Code names a subagent's commands `claude-code_<version>_agent`.
35664
+ // `claude-code_<version>_agent` may be a subagent; from 2.1.310 the session itself too, so
35665
+ // refuseInSubagent reads the transcripts before it refuses.
35573
35666
  subagent: /^claude-code_.+_agent$/.test(env.AI_AGENT ?? ""),
35574
35667
  profile: env.LAZE_PROFILE || void 0,
35575
35668
  url: env.LAZE_URL || void 0,
@@ -35656,6 +35749,17 @@ var ConfigStore = class _ConfigStore {
35656
35749
  await this.write({ ...config2, profiles: { ...config2.profiles, [name3]: updated } });
35657
35750
  return true;
35658
35751
  }
35752
+ /** Marks a profile migrated; false when there is none. */
35753
+ async markMigrated({ name: name3, migrated }) {
35754
+ const config2 = await this.read();
35755
+ const profile = config2.profiles[name3];
35756
+ if (!profile) return false;
35757
+ await this.write({
35758
+ ...config2,
35759
+ profiles: { ...config2.profiles, [name3]: { ...profile, migrated } }
35760
+ });
35761
+ return true;
35762
+ }
35659
35763
  async removeProfile({ name: name3 }) {
35660
35764
  const config2 = await this.read();
35661
35765
  if (!config2.profiles[name3]) return false;
@@ -35739,7 +35843,8 @@ var SWITCHES = /* @__PURE__ */ new Set([
35739
35843
  "names",
35740
35844
  "shell",
35741
35845
  "self",
35742
- "all"
35846
+ "all",
35847
+ "resend"
35743
35848
  ]);
35744
35849
  function parseArgs({ argv }) {
35745
35850
  const words = [];
@@ -35777,7 +35882,7 @@ function flagText({
35777
35882
  }
35778
35883
 
35779
35884
  // src/rules/cli-version.rules.ts
35780
- var STAMPED = "0.1.56";
35885
+ var STAMPED = "0.1.58";
35781
35886
  function cliVersionOf({ stamped = STAMPED } = {}) {
35782
35887
  return stamped.startsWith("__") ? "dev" : stamped;
35783
35888
  }
@@ -35789,6 +35894,14 @@ var CliUsageError = class extends Error {
35789
35894
  this.name = "CliUsageError";
35790
35895
  }
35791
35896
  };
35897
+ var ProfileMigratedError = class extends Error {
35898
+ constructor(profile) {
35899
+ super(`The agent of profile "${profile}" moved into Laze.`);
35900
+ this.profile = profile;
35901
+ this.name = "ProfileMigratedError";
35902
+ }
35903
+ profile;
35904
+ };
35792
35905
 
35793
35906
  // ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
35794
35907
  var external_exports = {};
@@ -57706,13 +57819,13 @@ function moduleApi(name3) {
57706
57819
 
57707
57820
  // ../../packages/module/src/contract/trpc-contract.ts
57708
57821
  function contractBuilder(namespace, members3) {
57709
- const member = (name3, kind2, read3 = {}) => ({
57822
+ const member = (name3, kind2, read4 = {}) => ({
57710
57823
  withInput: (input2) => {
57711
57824
  assertUndeclared(namespace, name3, members3);
57712
57825
  const cached2 = {
57713
- ...read3.invalidatedBy ? { invalidatedBy: read3.invalidatedBy } : {},
57714
- ...read3.fromProjection ? { fromProjection: read3.fromProjection } : {},
57715
- ...read3.revision === void 0 ? {} : { revision: read3.revision }
57826
+ ...read4.invalidatedBy ? { invalidatedBy: read4.invalidatedBy } : {},
57827
+ ...read4.fromProjection ? { fromProjection: read4.fromProjection } : {},
57828
+ ...read4.revision === void 0 ? {} : { revision: read4.revision }
57716
57829
  };
57717
57830
  const declared = { ...members3, [name3]: { kind: kind2, input: input2, output: void 0, ...cached2 } };
57718
57831
  return {
@@ -57835,6 +57948,12 @@ var revokeApiKeyInputSchemaDefinition = external_exports.object({
57835
57948
  apiKeyId: external_exports.string().min(1)
57836
57949
  });
57837
57950
  var revokeApiKeyInputSchema = revokeApiKeyInputSchemaDefinition;
57951
+ var retiredKeyNoticeSchemaDefinition = external_exports.object({
57952
+ code: external_exports.enum(["agent_migrated"]),
57953
+ message: external_exports.string().min(1).max(1e3),
57954
+ /** Where the holder goes instead, such as the migrated agent's chat. */
57955
+ link: external_exports.string().max(2e3).optional()
57956
+ });
57838
57957
  var revokeCurrentKeyInputSchemaDefinition = external_exports.object({});
57839
57958
  var createApiKeyByKeyInputSchemaDefinition = external_exports.object({
57840
57959
  name: external_exports.string().trim().min(1).max(80),
@@ -58030,13 +58149,28 @@ var layoutBlockSchemaDefinition = external_exports.discriminatedUnion("type", [
58030
58149
  cardSchemaDefinition,
58031
58150
  external_exports.object({ type: external_exports.literal("carousel"), cards: external_exports.array(cardSchemaDefinition).max(10) })
58032
58151
  ]);
58152
+ var layoutChipSchemaDefinition = external_exports.object({
58153
+ label: plain,
58154
+ color: external_exports.string().regex(/^[a-z]{1,20}$/)
58155
+ });
58033
58156
  var attachmentFieldSchemaDefinition = external_exports.object({
58034
58157
  title: plain,
58035
58158
  value: markdown,
58036
- short: external_exports.boolean()
58159
+ short: external_exports.boolean(),
58160
+ chips: external_exports.array(layoutChipSchemaDefinition).max(LAYOUT_ITEMS_MAX).optional()
58161
+ });
58162
+ var layoutFileSchemaDefinition = external_exports.object({
58163
+ name: plain,
58164
+ path: external_exports.string().max(600).regex(/^\/api\/[^\s]*$/),
58165
+ image: external_exports.boolean()
58037
58166
  });
58038
58167
  var layoutAttachmentSchemaDefinition = external_exports.object({
58039
58168
  type: external_exports.literal("attachment"),
58169
+ /** A list item draws its fields as a table; a shared message is a quoted message. */
58170
+ kind: external_exports.enum(["list_item", "message"]).optional(),
58171
+ /** The line under the author or title, such as "Posted in #channel". */
58172
+ subtitle: markdown.optional(),
58173
+ files: external_exports.array(layoutFileSchemaDefinition).max(10).optional(),
58040
58174
  /** `#RRGGBB`, or null for the default grey bar. */
58041
58175
  color: external_exports.string().regex(/^#[0-9A-F]{6}$/).nullable(),
58042
58176
  pretext: markdown,
@@ -61752,6 +61886,8 @@ var vaultConfig = Config.define((c) => ({
61752
61886
  publicOriginAliases,
61753
61887
  /** A file each audit chain head is appended to as a JSON line; unset only logs the heads. */
61754
61888
  auditHeadFile: c.env("VAULT_AUDIT_HEAD_FILE", external_exports.string().min(1).optional()),
61889
+ /** The progress board's alert folder for ops cards (a-content-open-fail); unset only logs. */
61890
+ opsAlertDir: c.env("VAULT_OPS_ALERT_DIR", external_exports.string().min(1).optional()),
61755
61891
  /** vaultd's socket; set, the master key and data keys stay in vaultd, unset keeps them here. */
61756
61892
  vaultdSocket: c.env("LAZE_VAULTD_SOCKET", external_exports.string().min(1).optional()),
61757
61893
  /** Where the in-process key sends AWS STS calls instead of AWS; vaultd has its own flag. */
@@ -62856,6 +62992,18 @@ var claudeGatewayModelsSchemaDefinition = external_exports.object({
62856
62992
  haiku: external_exports.string().min(1)
62857
62993
  });
62858
62994
  var claudeGatewayModelsSchema = claudeGatewayModelsSchemaDefinition;
62995
+ var sessionImportSchemaDefinition = external_exports.object({
62996
+ migrationId: external_exports.string().regex(/^[A-Za-z0-9_-]{1,200}$/),
62997
+ /** `resume` writes the transcript where the harness resumes it; `seed` writes MIGRATED.md. */
62998
+ mode: external_exports.enum(["resume", "seed"]),
62999
+ /** The harness the transcript came from. */
63000
+ harness: harnessKindSchema,
63001
+ /** The harness's own session id the resume names; absent for a seed. */
63002
+ sessionId: external_exports.string().regex(/^[A-Za-z0-9_-]{1,100}$/).optional(),
63003
+ /** The Codex rollout's file name. */
63004
+ fileName: external_exports.string().regex(/^[A-Za-z0-9._-]{1,200}\.jsonl$/).optional()
63005
+ });
63006
+ var sessionImportSchema = sessionImportSchemaDefinition;
62859
63007
  var agentSandboxSpecSchemaDefinition = external_exports.object({
62860
63008
  workspaceId: external_exports.string().min(1),
62861
63009
  agentId: external_exports.string().regex(/^[a-zA-Z0-9_-]+$/),
@@ -62884,7 +63032,9 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
62884
63032
  /** A personal agent's owner: their dedicated IP's route applies to this agent. */
62885
63033
  routeOwnerUserId: external_exports.string().min(1).optional(),
62886
63034
  /** Set by the runtime from the workspace's plan: egress applies the Free plan's rules. */
62887
- freePlan: external_exports.boolean().optional()
63035
+ freePlan: external_exports.boolean().optional(),
63036
+ /** A migrated agent's imported session, used when its main session first starts. */
63037
+ sessionImport: sessionImportSchemaDefinition.optional()
62888
63038
  });
62889
63039
  var deliveredFileSchemaDefinition = external_exports.object({
62890
63040
  /** Relative to the agent's work folder, e.g. `attachments/<messageId>/report.pdf`. */
@@ -63072,6 +63222,8 @@ var supervisorLaunchSchemaDefinition = external_exports.object({
63072
63222
  cli: external_exports.object({ workspaceId: external_exports.string().min(1), agentName: external_exports.string().min(1) }).optional(),
63073
63223
  /** The agent's DM with its owner: its one session is tagged with it and its events carry it. */
63074
63224
  mainChannelId: external_exports.string().regex(/^[a-zA-Z0-9_-]+$/).optional(),
63225
+ /** A migrated agent's imported session, fetched once when the main session first starts. */
63226
+ sessionImport: sessionImportSchema.optional(),
63075
63227
  /** Set by the connector on a person's own machine: ports, paths and the local token. */
63076
63228
  machine: supervisorMachineSchemaDefinition.optional(),
63077
63229
  /** On a machine, by relay connection id: the placeholder a local caller must present. */
@@ -65208,6 +65360,124 @@ var uploadAvatarAsCallerInputSchemaDefinition = external_exports.object({
65208
65360
  dataBase64: external_exports.string().min(1).max(Math.ceil(AGENT_AVATAR_PICK_MAX_BYTES * 4 / 3) + 8)
65209
65361
  });
65210
65362
 
65363
+ // ../../modules/agent/contract/src/agent-migration.ts
65364
+ var workspaceIdSchema8 = external_exports.string().min(1);
65365
+ var idSchema12 = external_exports.string().min(1).max(200);
65366
+ var agentRefSchema5 = external_exports.string().trim().min(1).max(80);
65367
+ var MIGRATION_PART_MAX_BYTES = 1024 * 1024;
65368
+ var MIGRATION_PARTS_MAX = 64;
65369
+ var migrationSourceSchema = external_exports.enum(["claude-code", "codex"]);
65370
+ var migrationModeSchema = external_exports.enum(["resume", "seed"]);
65371
+ var migrationStatusSchema = external_exports.enum(["waiting", "uploading", "done", "cancelled"]);
65372
+ var migrationRemovedSchemaDefinition = external_exports.object({
65373
+ /** Redacted on the owner's machine before the upload. */
65374
+ local: external_exports.number().int().nonnegative(),
65375
+ /** Values held in the workspace's vault. */
65376
+ vault: external_exports.number().int().nonnegative(),
65377
+ /** Key-shaped text the server's detector found. */
65378
+ patterns: external_exports.number().int().nonnegative()
65379
+ });
65380
+ var agentMigrationSchemaDefinition = external_exports.object({
65381
+ id: external_exports.string().min(1),
65382
+ agentId: external_exports.string().min(1),
65383
+ agentName: external_exports.string(),
65384
+ source: migrationSourceSchema,
65385
+ target: hostedHarnessSchema,
65386
+ modelLevel: external_exports.enum(["frontier", "fast"]).nullable(),
65387
+ mode: migrationModeSchema,
65388
+ status: migrationStatusSchema,
65389
+ requestedAt: external_exports.iso.datetime(),
65390
+ updatedAt: external_exports.iso.datetime(),
65391
+ completedAt: external_exports.iso.datetime().nullable(),
65392
+ /** When the agent's machine last called Laze; null when it never did. */
65393
+ machineLastSeenAt: external_exports.iso.datetime().nullable(),
65394
+ /** The agent's DM, where the request and the notice are. */
65395
+ channelId: external_exports.string().nullable(),
65396
+ /** The notice's place in the DM, once done. */
65397
+ noticeSeq: external_exports.number().int().nullable(),
65398
+ /** Counts of what was removed, never the values; null before it is done. */
65399
+ removed: migrationRemovedSchemaDefinition.nullable()
65400
+ });
65401
+ var agentMigrationSchema = agentMigrationSchemaDefinition;
65402
+ var migrateAgentInputSchemaDefinition = external_exports.object({
65403
+ workspaceId: workspaceIdSchema8,
65404
+ agentId: idSchema12,
65405
+ harness: hostedHarnessSchema,
65406
+ /** For Laze models; fast when not given. */
65407
+ modelLevel: external_exports.enum(["frontier", "fast"]).optional(),
65408
+ /** Post the request to the agent's session again while one waits. */
65409
+ resend: external_exports.boolean().default(false)
65410
+ });
65411
+ var migrateAgentInputSchema = migrateAgentInputSchemaDefinition;
65412
+ var agentMigrationInputSchemaDefinition = external_exports.object({
65413
+ workspaceId: workspaceIdSchema8,
65414
+ agentId: idSchema12
65415
+ });
65416
+ var agentMigrationInputSchema = agentMigrationInputSchemaDefinition;
65417
+ var migrateAgentAsCallerInputSchemaDefinition = external_exports.object({
65418
+ agent: agentRefSchema5,
65419
+ /** Where it runs in Laze; its own harness when not given. */
65420
+ harness: hostedHarnessSchema.optional(),
65421
+ modelLevel: external_exports.enum(["frontier", "fast"]).optional(),
65422
+ resend: external_exports.boolean().default(false)
65423
+ });
65424
+ var agentMigrationAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema5 });
65425
+ var nullableMigrationSchemaDefinition = external_exports.object({
65426
+ migration: agentMigrationSchemaDefinition.nullable()
65427
+ });
65428
+ var nullableMigrationSchema = nullableMigrationSchemaDefinition;
65429
+ var migrationIdParamsSchemaDefinition = external_exports.object({ migrationId: idSchema12 });
65430
+ var migrationPartParamsSchemaDefinition = external_exports.object({
65431
+ migrationId: idSchema12,
65432
+ index: external_exports.coerce.number().int().min(0).max(MIGRATION_PARTS_MAX - 1)
65433
+ });
65434
+ var migrationTicketSchemaDefinition = external_exports.object({
65435
+ id: external_exports.string().min(1),
65436
+ status: migrationStatusSchema,
65437
+ source: migrationSourceSchema,
65438
+ mode: migrationModeSchema,
65439
+ /** The session the agent was bound to, when it was. */
65440
+ sessionId: external_exports.string().nullable(),
65441
+ partMaxBytes: external_exports.number().int().positive(),
65442
+ partsMax: external_exports.number().int().positive()
65443
+ });
65444
+ var uploadMigrationPartInputSchemaDefinition = external_exports.object({
65445
+ text: external_exports.string().max(MIGRATION_PART_MAX_BYTES)
65446
+ });
65447
+ var completeMigrationInputSchemaDefinition = external_exports.object({
65448
+ parts: external_exports.number().int().min(1).max(MIGRATION_PARTS_MAX),
65449
+ /** Of the joined parts' UTF-8, so the server knows it holds what was sent. */
65450
+ sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
65451
+ /** The transcript was longer than the cap: only its newest lines were sent. */
65452
+ truncated: external_exports.boolean().default(false),
65453
+ /** The harness's own session id: Claude's session or Codex's thread. */
65454
+ sessionId: external_exports.string().regex(/^[A-Za-z0-9_-]{1,100}$/).optional(),
65455
+ /** The transcript's file name, which Codex finds its rollout by. */
65456
+ fileName: external_exports.string().regex(/^[A-Za-z0-9._-]{1,200}\.jsonl$/).optional(),
65457
+ localRedactions: external_exports.number().int().nonnegative().default(0)
65458
+ });
65459
+ var completedMigrationSchemaDefinition = external_exports.object({
65460
+ migration: agentMigrationSchemaDefinition,
65461
+ /** The agent's chat at the notice, to open in the browser. */
65462
+ link: external_exports.string()
65463
+ });
65464
+ var transcriptPartQuerySchemaDefinition = external_exports.object({
65465
+ part: external_exports.coerce.number().int().min(0).max(MIGRATION_PARTS_MAX - 1).default(0)
65466
+ });
65467
+ var transcriptPartSchemaDefinition = external_exports.object({
65468
+ index: external_exports.number().int().nonnegative(),
65469
+ count: external_exports.number().int().positive(),
65470
+ text: external_exports.string(),
65471
+ mode: migrationModeSchema,
65472
+ harness: migrationSourceSchema,
65473
+ sessionId: external_exports.string().nullable(),
65474
+ fileName: external_exports.string().nullable()
65475
+ });
65476
+ function migrationUploadCommandOf({ migrationId }) {
65477
+ return `laze agent migrate upload ${migrationId}`;
65478
+ }
65479
+ var agentMigrationTrpc = defineTrpcContract("agents").mutation("migrate").withInput(migrateAgentInputSchema).withOutput(agentMigrationSchema).query("migration").withInput(agentMigrationInputSchema).withOutput(nullableMigrationSchema).mutation("cancelMigration").withInput(agentMigrationInputSchema).withOutput(agentMigrationSchema).build();
65480
+
65211
65481
  // ../../modules/agent/contract/src/agent-monitors.ts
65212
65482
  var MONITOR_PROMPT_MAX = 4e3;
65213
65483
  var MONITOR_RUNS_PER_DAY_DEFAULT = 100;
@@ -65269,8 +65539,8 @@ var addedMonitorSchemaDefinition = external_exports.object({
65269
65539
  // ../../modules/agent/contract/src/agent-oauth.ts
65270
65540
  var OAUTH_CODE_TTL_SECONDS = 5 * 60;
65271
65541
  var REMOTE_MCP_PATH = "/mcp";
65272
- var workspaceIdSchema8 = external_exports.string().min(1);
65273
- var idSchema12 = external_exports.string().min(1).max(80);
65542
+ var workspaceIdSchema9 = external_exports.string().min(1);
65543
+ var idSchema13 = external_exports.string().min(1).max(80);
65274
65544
  var oauthAuthorizeRequestSchemaDefinition = external_exports.object({
65275
65545
  response_type: external_exports.string().max(40).optional(),
65276
65546
  client_id: external_exports.string().min(1).max(4096),
@@ -65282,7 +65552,7 @@ var oauthAuthorizeRequestSchemaDefinition = external_exports.object({
65282
65552
  scope: external_exports.string().max(400).optional()
65283
65553
  });
65284
65554
  var oauthRequestInputSchemaDefinition = external_exports.object({
65285
- workspaceId: workspaceIdSchema8,
65555
+ workspaceId: workspaceIdSchema9,
65286
65556
  request: oauthAuthorizeRequestSchemaDefinition
65287
65557
  });
65288
65558
  var oauthRequestInputSchema = oauthRequestInputSchemaDefinition;
@@ -65291,16 +65561,16 @@ var oauthRequestViewSchemaDefinition = external_exports.object({
65291
65561
  /** The host the browser returns to, such as `chatgpt.com`. */
65292
65562
  redirectHost: external_exports.string(),
65293
65563
  /** The person's connected agents of this client in the workspace, newest first. */
65294
- reconnectable: external_exports.array(external_exports.object({ id: idSchema12, name: external_exports.string() })),
65564
+ reconnectable: external_exports.array(external_exports.object({ id: idSchema13, name: external_exports.string() })),
65295
65565
  defaultName: external_exports.string()
65296
65566
  });
65297
65567
  var oauthRequestViewSchema = oauthRequestViewSchemaDefinition;
65298
65568
  var approveOAuthInputSchemaDefinition = external_exports.object({
65299
- workspaceId: workspaceIdSchema8,
65569
+ workspaceId: workspaceIdSchema9,
65300
65570
  request: oauthAuthorizeRequestSchemaDefinition,
65301
65571
  name: external_exports.string().trim().min(1).max(80),
65302
65572
  /** One of the person's agents of this client to hand a new key, instead of a new agent. */
65303
- reconnectAgentId: idSchema12.optional()
65573
+ reconnectAgentId: idSchema13.optional()
65304
65574
  });
65305
65575
  var approveOAuthInputSchema = approveOAuthInputSchemaDefinition;
65306
65576
  var oauthRedirectSchemaDefinition = external_exports.object({ redirectUrl: external_exports.string() });
@@ -65332,9 +65602,9 @@ var agentPermissionPromptSchemaDefinition = external_exports.object({
65332
65602
  var agentPermissionPromptSchema = agentPermissionPromptSchemaDefinition;
65333
65603
 
65334
65604
  // ../../modules/agent/contract/src/agent-transfer.ts
65335
- var workspaceIdSchema9 = external_exports.string().min(1);
65336
- var idSchema13 = external_exports.string().min(1).max(200);
65337
- var agentRefSchema5 = external_exports.string().trim().min(1).max(80);
65605
+ var workspaceIdSchema10 = external_exports.string().min(1);
65606
+ var idSchema14 = external_exports.string().min(1).max(200);
65607
+ var agentRefSchema6 = external_exports.string().trim().min(1).max(80);
65338
65608
  var agentTransferOfferSchemaDefinition = external_exports.object({
65339
65609
  id: external_exports.string().min(1),
65340
65610
  agentId: external_exports.string().min(1),
@@ -65349,11 +65619,11 @@ var agentTransferOfferSchemaDefinition = external_exports.object({
65349
65619
  });
65350
65620
  var agentTransferOfferSchema = agentTransferOfferSchemaDefinition;
65351
65621
  var agentTransferInputSchemaDefinition = external_exports.object({
65352
- workspaceId: workspaceIdSchema9,
65353
- agentId: idSchema13
65622
+ workspaceId: workspaceIdSchema10,
65623
+ agentId: idSchema14
65354
65624
  });
65355
65625
  var agentTransferInputSchema = agentTransferInputSchemaDefinition;
65356
- var agentTransferAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema5 });
65626
+ var agentTransferAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema6 });
65357
65627
  var agentTransferOfferedPayloadSchemaDefinition = external_exports.object({
65358
65628
  workspaceId: external_exports.string().min(1),
65359
65629
  offerId: external_exports.string().min(1),
@@ -65383,24 +65653,24 @@ var agentWorkingSchemaDefinition = external_exports.object({ working: external_e
65383
65653
  var agentWorkingSchema = agentWorkingSchemaDefinition;
65384
65654
 
65385
65655
  // ../../modules/agent/contract/src/agent-workspace-default.ts
65386
- var workspaceIdSchema10 = external_exports.string().min(1);
65387
- var idSchema14 = external_exports.string().min(1).max(200);
65388
- var agentRefSchema6 = external_exports.string().trim().min(1).max(80);
65656
+ var workspaceIdSchema11 = external_exports.string().min(1);
65657
+ var idSchema15 = external_exports.string().min(1).max(200);
65658
+ var agentRefSchema7 = external_exports.string().trim().min(1).max(80);
65389
65659
  var workspaceDefaultAgentSchemaDefinition = external_exports.object({
65390
65660
  /** Null when the workspace has none, or its pick was removed. */
65391
- agentId: idSchema14.nullable(),
65661
+ agentId: idSchema15.nullable(),
65392
65662
  name: external_exports.string().nullable()
65393
65663
  });
65394
65664
  var workspaceDefaultAgentSchema = workspaceDefaultAgentSchemaDefinition;
65395
65665
  var setWorkspaceDefaultAgentInputSchemaDefinition = external_exports.object({
65396
- workspaceId: workspaceIdSchema10,
65666
+ workspaceId: workspaceIdSchema11,
65397
65667
  /** A team agent of the workspace; null clears the pick. */
65398
- agentId: idSchema14.nullable()
65668
+ agentId: idSchema15.nullable()
65399
65669
  });
65400
65670
  var setWorkspaceDefaultAgentInputSchema = setWorkspaceDefaultAgentInputSchemaDefinition;
65401
65671
  var setWorkspaceDefaultAgentAsCallerInputSchemaDefinition = external_exports.object({
65402
65672
  /** The agent by id or name; null clears the pick. */
65403
- agent: agentRefSchema6.nullable()
65673
+ agent: agentRefSchema7.nullable()
65404
65674
  });
65405
65675
 
65406
65676
  // ../../modules/agent/contract/src/agent.ts
@@ -65408,8 +65678,8 @@ var AGENT_LINK_TTL_SECONDS = 30 * 60;
65408
65678
  var AGENT_JOIN_REQUEST_TTL_SECONDS = 24 * 60 * 60;
65409
65679
  var AGENT_ONLINE_WINDOW_SECONDS = 5 * 60;
65410
65680
  var INBOX_WAIT_MAX_SECONDS = 55;
65411
- var workspaceIdSchema11 = external_exports.string().min(1);
65412
- var idSchema15 = external_exports.string().min(1).max(80);
65681
+ var workspaceIdSchema12 = external_exports.string().min(1);
65682
+ var idSchema16 = external_exports.string().min(1).max(80);
65413
65683
  var agentHarnessSchema = external_exports.enum([
65414
65684
  "claude-code",
65415
65685
  "codex",
@@ -65456,27 +65726,27 @@ var agentContextSchemaDefinition = external_exports.object({
65456
65726
  updatedAt: external_exports.iso.datetime().nullable()
65457
65727
  });
65458
65728
  var agentHostSchemaDefinition = external_exports.object({
65459
- machineId: idSchema15,
65729
+ machineId: idSchema16,
65460
65730
  whenOffline: external_exports.enum(["wait", "sandbox"])
65461
65731
  });
65462
65732
  var setAgentHostInputSchemaDefinition = external_exports.object({
65463
- workspaceId: workspaceIdSchema11,
65464
- agentId: idSchema15,
65733
+ workspaceId: workspaceIdSchema12,
65734
+ agentId: idSchema16,
65465
65735
  host: agentHostSchemaDefinition.nullable()
65466
65736
  });
65467
65737
  var setAgentComputerKeyInputSchemaDefinition = external_exports.object({
65468
- workspaceId: workspaceIdSchema11,
65469
- agentId: idSchema15,
65738
+ workspaceId: workspaceIdSchema12,
65739
+ agentId: idSchema16,
65470
65740
  computerKey: external_exports.string().min(1).max(200).nullable()
65471
65741
  });
65472
65742
  var agentSchemaDefinition = external_exports.object({
65473
- id: idSchema15,
65474
- workspaceId: workspaceIdSchema11,
65743
+ id: idSchema16,
65744
+ workspaceId: workspaceIdSchema12,
65475
65745
  name: external_exports.string(),
65476
65746
  kind: external_exports.enum(["personal", "team"]),
65477
65747
  hosting: agentHostingSchema,
65478
65748
  harness: agentHarnessSchema,
65479
- ownerUserId: idSchema15,
65749
+ ownerUserId: idSchema16,
65480
65750
  status: external_exports.enum(["connected", "disconnected"]),
65481
65751
  online: external_exports.boolean(),
65482
65752
  lastSeenAt: external_exports.iso.datetime().nullable(),
@@ -65518,7 +65788,7 @@ var agentSchemaDefinition = external_exports.object({
65518
65788
  });
65519
65789
  var agentSchema = agentSchemaDefinition;
65520
65790
  var agentChannelSchemaDefinition = external_exports.object({
65521
- id: idSchema15,
65791
+ id: idSchema16,
65522
65792
  name: external_exports.string(),
65523
65793
  kind: external_exports.enum(["public", "private", "dm", "group", "chat"])
65524
65794
  });
@@ -65533,22 +65803,22 @@ var agentNameSchema = external_exports.string().trim().min(1).max(80);
65533
65803
  var instructionsSchema = external_exports.string().max(2e4);
65534
65804
  var linkedAvatarSchema = external_exports.string().trim().max(16);
65535
65805
  var createAgentInputSchemaDefinition = external_exports.object({
65536
- workspaceId: workspaceIdSchema11,
65806
+ workspaceId: workspaceIdSchema12,
65537
65807
  name: agentNameSchema,
65538
65808
  avatar: agentAvatarInputSchema.default(""),
65539
65809
  harness: hostedHarnessSchema,
65540
65810
  modelLevel: agentModelLevelSchema.optional(),
65541
65811
  kind: external_exports.enum(["personal", "team"]).default("personal"),
65542
65812
  instructions: instructionsSchema.default(""),
65543
- channelIds: external_exports.array(idSchema15).max(50).default([]),
65813
+ channelIds: external_exports.array(idSchema16).max(50).default([]),
65544
65814
  /** A Claude Code or Codex agent drawing from this login pool; a team one needs a pool. */
65545
65815
  /** The pool's id or name. */
65546
65816
  loginPoolId: external_exports.string().min(1).max(200).optional()
65547
65817
  });
65548
65818
  var createAgentInputSchema = createAgentInputSchemaDefinition;
65549
65819
  var updateAgentInputSchemaDefinition = external_exports.object({
65550
- workspaceId: workspaceIdSchema11,
65551
- agentId: idSchema15,
65820
+ workspaceId: workspaceIdSchema12,
65821
+ agentId: idSchema16,
65552
65822
  name: agentNameSchema.optional(),
65553
65823
  avatar: agentAvatarInputSchema.optional(),
65554
65824
  modelLevel: agentModelLevelSchema.optional(),
@@ -65560,7 +65830,7 @@ var updateAgentInputSchemaDefinition = external_exports.object({
65560
65830
  effort: runEffortInputSchema.optional(),
65561
65831
  instructions: instructionsSchema.optional(),
65562
65832
  /** The whole set: channels left out are left. */
65563
- channelIds: external_exports.array(idSchema15).max(50).optional(),
65833
+ channelIds: external_exports.array(idSchema16).max(50).optional(),
65564
65834
  /** Agents Laze runs only: paused, it does not wake until resumed and its messages wait. */
65565
65835
  paused: external_exports.boolean().optional(),
65566
65836
  /** Why it is paused, shown on the agents page and in the notice under held messages. */
@@ -65568,14 +65838,14 @@ var updateAgentInputSchemaDefinition = external_exports.object({
65568
65838
  });
65569
65839
  var updateAgentInputSchema = updateAgentInputSchemaDefinition;
65570
65840
  var saveHarnessLoginInputSchemaDefinition = external_exports.object({
65571
- workspaceId: workspaceIdSchema11,
65841
+ workspaceId: workspaceIdSchema12,
65572
65842
  harness: harnessLoginSchema,
65573
65843
  secret: external_exports.string().trim().min(10).max(2e4).optional(),
65574
65844
  signIn: harnessSignInValueSchema.optional()
65575
65845
  });
65576
65846
  var saveHarnessLoginInputSchema = saveHarnessLoginInputSchemaDefinition;
65577
65847
  var removeHarnessLoginInputSchemaDefinition = external_exports.object({
65578
- workspaceId: workspaceIdSchema11,
65848
+ workspaceId: workspaceIdSchema12,
65579
65849
  harness: harnessLoginSchema
65580
65850
  });
65581
65851
  var removeHarnessLoginInputSchema = removeHarnessLoginInputSchemaDefinition;
@@ -65587,13 +65857,13 @@ var harnessLoginsSchema = harnessLoginsSchemaDefinition;
65587
65857
  var lastRuntimeSchemaDefinition = external_exports.object({ harness: hostedHarnessSchema.nullable() });
65588
65858
  var lastRuntimeSchema = lastRuntimeSchemaDefinition;
65589
65859
  var mintLinkInputSchemaDefinition = external_exports.object({
65590
- workspaceId: workspaceIdSchema11,
65860
+ workspaceId: workspaceIdSchema12,
65591
65861
  /** Left out, the agent names itself when it joins, else it takes its harness's name. */
65592
65862
  name: external_exports.string().trim().max(80).optional(),
65593
65863
  /** The channel the agent joins once linked. */
65594
- channelId: idSchema15.optional(),
65864
+ channelId: idSchema16.optional(),
65595
65865
  /** One of the minting person's connected agents: redeeming gives it a new key instead. */
65596
- reconnectAgentId: idSchema15.optional()
65866
+ reconnectAgentId: idSchema16.optional()
65597
65867
  });
65598
65868
  var mintLinkInputSchema = mintLinkInputSchemaDefinition;
65599
65869
  var mintedLinkSchemaDefinition = external_exports.object({
@@ -65625,7 +65895,7 @@ var redeemedLinkSchemaDefinition = external_exports.object({
65625
65895
  agent: agentSchemaDefinition,
65626
65896
  /** The agent's own `lz_` key, shown once. */
65627
65897
  apiKey: external_exports.string(),
65628
- channelId: idSchema15.nullable(),
65898
+ channelId: idSchema16.nullable(),
65629
65899
  /** The owner's key that may only ask for a new agent (`laze agent request`), shown once. */
65630
65900
  requestKey: external_exports.string().nullable().optional()
65631
65901
  });
@@ -65664,12 +65934,12 @@ var joinRequestAnswerSchemaDefinition = external_exports.discriminatedUnion("sta
65664
65934
  })
65665
65935
  ]);
65666
65936
  var joinRequestInputSchemaDefinition = external_exports.object({
65667
- workspaceId: workspaceIdSchema11,
65937
+ workspaceId: workspaceIdSchema12,
65668
65938
  code: external_exports.string().trim().min(1).max(20)
65669
65939
  });
65670
65940
  var joinRequestInputSchema = joinRequestInputSchemaDefinition;
65671
65941
  var approveJoinRequestInputSchemaDefinition = external_exports.object({
65672
- workspaceId: workspaceIdSchema11,
65942
+ workspaceId: workspaceIdSchema12,
65673
65943
  code: external_exports.string().trim().min(1).max(20),
65674
65944
  /** The person may rename the agent as they approve it. */
65675
65945
  name: external_exports.string().trim().max(80).optional()
@@ -65690,12 +65960,12 @@ var inboxCatchUpSchemaDefinition = external_exports.object({
65690
65960
  });
65691
65961
  var inboxCatchUpSchema = inboxCatchUpSchemaDefinition;
65692
65962
  var inboxMessageSchemaDefinition = external_exports.object({
65693
- messageId: idSchema15,
65694
- channelId: idSchema15,
65963
+ messageId: idSchema16,
65964
+ channelId: idSchema16,
65695
65965
  channelName: external_exports.string(),
65696
65966
  channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
65697
- threadRootId: idSchema15.nullable(),
65698
- author: external_exports.object({ kind: external_exports.enum(["person", "agent"]), id: idSchema15, name: external_exports.string() }),
65967
+ threadRootId: idSchema16.nullable(),
65968
+ author: external_exports.object({ kind: external_exports.enum(["person", "agent"]), id: idSchema16, name: external_exports.string() }),
65699
65969
  body: external_exports.string(),
65700
65970
  postedAt: external_exports.iso.datetime(),
65701
65971
  /** On the first message of each conversation in a catch up (agent-catch-up.feature). */
@@ -65715,9 +65985,9 @@ var inboxWaitingSchemaDefinition = external_exports.object({
65715
65985
  });
65716
65986
  var callerSchemaDefinition = external_exports.object({
65717
65987
  kind: external_exports.enum(["person", "agent"]),
65718
- id: idSchema15,
65988
+ id: idSchema16,
65719
65989
  name: external_exports.string(),
65720
- workspaceId: workspaceIdSchema11,
65990
+ workspaceId: workspaceIdSchema12,
65721
65991
  agent: agentSchemaDefinition.nullable(),
65722
65992
  /** Messages waiting in the agent's inbox, not taken yet; 0 for a person. */
65723
65993
  pendingCount: external_exports.number().int().min(0).optional(),
@@ -65733,7 +66003,7 @@ var agentGuideFilesSchemaDefinition = external_exports.object({
65733
66003
  });
65734
66004
  var agentChannelLevelSchema = external_exports.enum(["everything", "mentions"]);
65735
66005
  var callerChannelSchemaDefinition = external_exports.object({
65736
- id: idSchema15,
66006
+ id: idSchema16,
65737
66007
  name: external_exports.string(),
65738
66008
  kind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
65739
66009
  unread: external_exports.number().int().nonnegative(),
@@ -65747,9 +66017,9 @@ var callerChannelSchemaDefinition = external_exports.object({
65747
66017
  isDefault: external_exports.boolean().default(false)
65748
66018
  });
65749
66019
  var setChannelLevelInputSchemaDefinition = external_exports.object({
65750
- workspaceId: workspaceIdSchema11,
65751
- agentId: idSchema15,
65752
- channelId: idSchema15,
66020
+ workspaceId: workspaceIdSchema12,
66021
+ agentId: idSchema16,
66022
+ channelId: idSchema16,
65753
66023
  level: agentChannelLevelSchema
65754
66024
  });
65755
66025
  var setChannelLevelInputSchema = setChannelLevelInputSchemaDefinition;
@@ -65772,12 +66042,12 @@ var postAsCallerInputSchemaDefinition = external_exports.object({
65772
66042
  /** A channel's name (with or without `#`) or id. */
65773
66043
  channel: external_exports.string().trim().min(1).max(81),
65774
66044
  body: external_exports.string().trim().min(1).max(4e4),
65775
- threadRootId: idSchema15.optional(),
66045
+ threadRootId: idSchema16.optional(),
65776
66046
  /** The messages of the agent's turn this post answers. */
65777
- answers: external_exports.array(idSchema15).max(200).optional()
66047
+ answers: external_exports.array(idSchema16).max(200).optional()
65778
66048
  });
65779
66049
  var replyAsCallerInputSchemaDefinition = external_exports.object({
65780
- messageId: idSchema15,
66050
+ messageId: idSchema16,
65781
66051
  body: external_exports.string().trim().min(1).max(4e4),
65782
66052
  /** Needed for a message that is not in the caller's inbox. */
65783
66053
  channel: external_exports.string().trim().min(1).max(81).optional(),
@@ -65786,18 +66056,18 @@ var replyAsCallerInputSchemaDefinition = external_exports.object({
65786
66056
  /** A thread reply also shows in the channel, as "Also send to #channel" does. */
65787
66057
  alsoInChannel: external_exports.boolean().optional(),
65788
66058
  /** The other messages of the agent's turn this reply answers. */
65789
- answers: external_exports.array(idSchema15).max(200).optional()
66059
+ answers: external_exports.array(idSchema16).max(200).optional()
65790
66060
  });
65791
66061
  var postedMessageSchemaDefinition = external_exports.object({
65792
- messageId: idSchema15,
65793
- channelId: idSchema15,
65794
- threadRootId: idSchema15.nullable(),
66062
+ messageId: idSchema16,
66063
+ channelId: idSchema16,
66064
+ threadRootId: idSchema16.nullable(),
65795
66065
  /** Workspace members the message mentioned who are not in the channel: it did not reach them. */
65796
66066
  notInChannel: external_exports.array(external_exports.object({ ...notInChannelSchema.shape, name: external_exports.string() })).default([]),
65797
66067
  /** Mentioned agents that are paused or out of usage: the message waits for each of them. */
65798
66068
  waitsFor: external_exports.array(
65799
66069
  external_exports.object({
65800
- agentId: idSchema15,
66070
+ agentId: idSchema16,
65801
66071
  name: external_exports.string(),
65802
66072
  cause: external_exports.enum(["paused", "out_of_usage"]),
65803
66073
  /** When an agent out of usage gets its usage back; null while paused. */
@@ -65814,15 +66084,15 @@ var searchAsCallerInputSchemaDefinition = external_exports.object({
65814
66084
  });
65815
66085
  var callerActorNameSchema = external_exports.object({
65816
66086
  kind: external_exports.enum(["person", "agent"]),
65817
- id: idSchema15,
66087
+ id: idSchema16,
65818
66088
  name: external_exports.string()
65819
66089
  });
65820
66090
  var callerSearchHitSchemaDefinition = external_exports.object({
65821
- messageId: idSchema15,
65822
- channelId: idSchema15,
66091
+ messageId: idSchema16,
66092
+ channelId: idSchema16,
65823
66093
  channelName: external_exports.string(),
65824
66094
  channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
65825
- threadRootId: idSchema15.nullable(),
66095
+ threadRootId: idSchema16.nullable(),
65826
66096
  seq: external_exports.number().int().positive(),
65827
66097
  /** `external` for a mirrored message from someone outside Laze. */
65828
66098
  author: external_exports.object({
@@ -65844,7 +66114,7 @@ var callerSearchResultSchemaDefinition = external_exports.object({
65844
66114
  /** Names for the mention tokens in the bodies. */
65845
66115
  mentions: external_exports.object({
65846
66116
  actors: external_exports.array(callerActorNameSchema),
65847
- channels: external_exports.array(external_exports.object({ id: idSchema15, name: external_exports.string() }))
66117
+ channels: external_exports.array(external_exports.object({ id: idSchema16, name: external_exports.string() }))
65848
66118
  })
65849
66119
  });
65850
66120
  var agentActivityInputSchemaDefinition = external_exports.object({
@@ -65916,14 +66186,14 @@ var codexLoginRefreshInputSchemaDefinition = external_exports.object({
65916
66186
  authJson: external_exports.string().min(2).max(CODEX_LOGIN_MAX_LENGTH)
65917
66187
  });
65918
66188
  var AgentApi = moduleApi()("agent");
65919
- var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15 })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("transfer").withInput(transferAgentInputSchema).withOutput(agentSchema).mutation("resetSession").withInput(resetAgentSessionInputSchema).withOutput(agentSchema).query("faces").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(external_exports.object({ limitUsd: external_exports.number() })).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(harnessLoginListSchema).mutation("addHarnessLogin").withInput(addHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("renameHarnessLogin").withInput(renameHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("deleteHarnessLogin").withInput(deleteHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("checkLoginUsage").withInput(checkLoginUsageInputSchema).withOutput(loginUsageCheckSchema).query("loginPools").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(loginPoolsSchema).mutation("createLoginPool").withInput(createLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("renameLoginPool").withInput(renameLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("deleteLoginPool").withInput(loginPoolRefInputSchema).withOutput(loginPoolsSchema).mutation("addPoolLogin").withInput(addPoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("removePoolLogin").withInput(removePoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("setPoolMember").withInput(setPoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("removePoolMember").withInput(removePoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("setAgentPool").withInput(setAgentPoolInputSchema).withOutput(agentSchema).mutation("openDirect").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15 })).withOutput(external_exports.object({ channelId: idSchema15 })).mutation("startConversation").withInput(startConversationInputSchema).withOutput(startedConversationSchema).query("conversations").withInput(listConversationsInputSchema).withOutput(external_exports.array(conversationSummarySchema2)).mutation("joinConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("renameConversation").withInput(renameConversationInputSchema).withOutput(conversationSummarySchema2).mutation("leaveConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("deleteConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("mintLink").withInput(mintLinkInputSchema).withOutput(mintedLinkSchema).query("linkRedemption").withInput(linkRedemptionInputSchema).withOutput(linkRedemptionSchema).query("oauthRequest").withInput(oauthRequestInputSchema).withOutput(oauthRequestViewSchema).mutation("oauthApprove").withInput(approveOAuthInputSchema).withOutput(oauthRedirectSchema).mutation("oauthDeny").withInput(oauthRequestInputSchema).withOutput(oauthRedirectSchema).mutation("disconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15 })).withOutput(external_exports.array(agentGithubWatchSchema)).mutation("watchGithub").withInput(watchGithubInputSchema).withOutput(agentGithubWatchSchema).mutation("unwatchGithub").withInput(unwatchGithubInputSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
66189
+ var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("transfer").withInput(transferAgentInputSchema).withOutput(agentSchema).mutation("resetSession").withInput(resetAgentSessionInputSchema).withOutput(agentSchema).query("faces").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(external_exports.object({ limitUsd: external_exports.number() })).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(harnessLoginListSchema).mutation("addHarnessLogin").withInput(addHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("renameHarnessLogin").withInput(renameHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("deleteHarnessLogin").withInput(deleteHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("checkLoginUsage").withInput(checkLoginUsageInputSchema).withOutput(loginUsageCheckSchema).query("loginPools").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(loginPoolsSchema).mutation("createLoginPool").withInput(createLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("renameLoginPool").withInput(renameLoginPoolInputSchema).withOutput(loginPoolsSchema).mutation("deleteLoginPool").withInput(loginPoolRefInputSchema).withOutput(loginPoolsSchema).mutation("addPoolLogin").withInput(addPoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("removePoolLogin").withInput(removePoolLoginInputSchema).withOutput(loginPoolsSchema).mutation("setPoolMember").withInput(setPoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("removePoolMember").withInput(removePoolMemberInputSchema).withOutput(loginPoolsSchema).mutation("setAgentPool").withInput(setAgentPoolInputSchema).withOutput(agentSchema).mutation("openDirect").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.object({ channelId: idSchema16 })).mutation("startConversation").withInput(startConversationInputSchema).withOutput(startedConversationSchema).query("conversations").withInput(listConversationsInputSchema).withOutput(external_exports.array(conversationSummarySchema2)).mutation("joinConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("renameConversation").withInput(renameConversationInputSchema).withOutput(conversationSummarySchema2).mutation("leaveConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("deleteConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("mintLink").withInput(mintLinkInputSchema).withOutput(mintedLinkSchema).query("linkRedemption").withInput(linkRedemptionInputSchema).withOutput(linkRedemptionSchema).query("oauthRequest").withInput(oauthRequestInputSchema).withOutput(oauthRequestViewSchema).mutation("oauthApprove").withInput(approveOAuthInputSchema).withOutput(oauthRedirectSchema).mutation("oauthDeny").withInput(oauthRequestInputSchema).withOutput(oauthRedirectSchema).mutation("disconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.array(agentGithubWatchSchema)).mutation("watchGithub").withInput(watchGithubInputSchema).withOutput(agentGithubWatchSchema).mutation("unwatchGithub").withInput(unwatchGithubInputSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
65920
66190
  var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).mutation("retryTurn").withInput(retryAgentTurnInputSchema).withOutput(external_exports.object({ retried: external_exports.literal(true) })).query("retryState").withInput(retryAgentTurnInputSchema).withOutput(agentRetryStateSchema).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("workingNow").withInput(agentWorkingInputSchema).withOutput(agentWorkingSchema).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("catchUp").withInput(startCatchUpInputSchema).withOutput(catchUpRunSchema).mutation("catchUpAsk").withInput(askCatchUpInputSchema).withOutput(catchUpRunSchema).query("catchUpRun").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("catchUpStop").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
65921
- var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema11, agentId: idSchema15, channelId: idSchema15 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).build();
66191
+ var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema12, agentId: idSchema16, channelId: idSchema16 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).build();
65922
66192
  var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
65923
66193
  var agentLoginTroubleTrpc = defineTrpcContract("agents").mutation("replaceHarnessLogin").withInput(replaceHarnessLoginInputSchema).withOutput(harnessLoginListSchema).mutation("startHarnessSignIn").withInput(startHarnessSignInInputSchema).withOutput(harnessSignInSchema).mutation("pollHarnessSignIn").withInput(pollHarnessSignInInputSchema).withOutput(harnessSignInPollSchema).mutation("waitForLogins").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ waiting: external_exports.boolean() })).mutation("useAnotherLogin").withInput(loginCardActionInputSchema).withOutput(external_exports.object({ loginName: external_exports.string() })).build();
65924
- var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("workspaceDefault").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(workspaceDefaultAgentSchema).mutation("setWorkspaceDefault").withInput(setWorkspaceDefaultAgentInputSchema).withOutput(workspaceDefaultAgentSchema).build();
65925
- var agentRuntimeChoiceTrpc = defineTrpcContract("agents").query("lastRuntime").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(lastRuntimeSchema).build();
65926
- var agentArchiveTrpc = defineTrpcContract("agents").query("archived").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(external_exports.array(archivedAgentSchema)).mutation("restore").withInput(restoreAgentInputSchema).withOutput(agentSchema).mutation("copy").withInput(copyAgentInputSchema).withOutput(agentSchema).mutation("deleteArchived").withInput(restoreAgentInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("transferOffers").withInput(external_exports.object({ workspaceId: workspaceIdSchema11 })).withOutput(external_exports.array(agentTransferOfferSchema)).mutation("acceptTransfer").withInput(agentTransferInputSchema).withOutput(agentSchema).mutation("declineTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ declined: external_exports.literal(true) })).mutation("cancelTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ cancelled: external_exports.literal(true) })).build();
66194
+ var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("workspaceDefault").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(workspaceDefaultAgentSchema).mutation("setWorkspaceDefault").withInput(setWorkspaceDefaultAgentInputSchema).withOutput(workspaceDefaultAgentSchema).build();
66195
+ var agentRuntimeChoiceTrpc = defineTrpcContract("agents").query("lastRuntime").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(lastRuntimeSchema).build();
66196
+ var agentArchiveTrpc = defineTrpcContract("agents").query("archived").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(archivedAgentSchema)).mutation("restore").withInput(restoreAgentInputSchema).withOutput(agentSchema).mutation("copy").withInput(copyAgentInputSchema).withOutput(agentSchema).mutation("deleteArchived").withInput(restoreAgentInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("transferOffers").withInput(external_exports.object({ workspaceId: workspaceIdSchema12 })).withOutput(external_exports.array(agentTransferOfferSchema)).mutation("acceptTransfer").withInput(agentTransferInputSchema).withOutput(agentSchema).mutation("declineTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ declined: external_exports.literal(true) })).mutation("cancelTransfer").withInput(agentTransferInputSchema).withOutput(external_exports.object({ cancelled: external_exports.literal(true) })).build();
65927
66197
  var agentTrpc = joinTrpcContracts(
65928
66198
  "agents",
65929
66199
  agentCoreTrpc,
@@ -65933,7 +66203,8 @@ var agentTrpc = joinTrpcContracts(
65933
66203
  agentLoginTroubleTrpc,
65934
66204
  agentWorkspaceDefaultTrpc,
65935
66205
  agentRuntimeChoiceTrpc,
65936
- agentArchiveTrpc
66206
+ agentArchiveTrpc,
66207
+ agentMigrationTrpc
65937
66208
  );
65938
66209
  var agentUi = uiTokens("agent");
65939
66210
  var AgentNavSlot = agentUi.component("nav");
@@ -65951,6 +66222,7 @@ var AgentEditDialogSlot = agentUi.component("editDialog");
65951
66222
  var AgentFaceSlot = agentUi.component("face");
65952
66223
  var AgentAccessSlot = agentUi.component("access");
65953
66224
  var AgentConnectDialogSlot = agentUi.component("connectDialog");
66225
+ var AgentMigrateDialogSlot = agentUi.component("migrateDialog");
65954
66226
  var AgentChannelLevelSlot = agentUi.component("channelLevel");
65955
66227
  var AgentMuteNoticeSlot = agentUi.component("muteNotice");
65956
66228
  var AgentHopLimitNoticeSlot = agentUi.component("hopLimitNotice");
@@ -66062,27 +66334,27 @@ var agentKeepsFailingPayloadSchemaDefinition = external_exports.object({
66062
66334
  });
66063
66335
 
66064
66336
  // ../../modules/agent/contract/src/agent-caller-access.ts
66065
- var agentRefSchema7 = external_exports.string().trim().min(1).max(80);
66066
- var idSchema16 = external_exports.string().min(1).max(64);
66067
- var agentAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema7 });
66337
+ var agentRefSchema8 = external_exports.string().trim().min(1).max(80);
66338
+ var idSchema17 = external_exports.string().min(1).max(64);
66339
+ var agentAsCallerInputSchemaDefinition = external_exports.object({ agent: agentRefSchema8 });
66068
66340
  var shareAgentAsCallerInputSchemaDefinition = external_exports.object({
66069
- agent: agentRefSchema7,
66341
+ agent: agentRefSchema8,
66070
66342
  grantee: agentGranteeSchema
66071
66343
  });
66072
66344
  var stopTurnAsCallerInputSchemaDefinition = external_exports.object({
66073
- agent: agentRefSchema7,
66074
- channelId: idSchema16
66345
+ agent: agentRefSchema8,
66346
+ channelId: idSchema17
66075
66347
  });
66076
66348
  var retryTurnAsCallerInputSchemaDefinition = external_exports.object({
66077
- agent: agentRefSchema7,
66078
- channelId: idSchema16,
66079
- messageId: idSchema16
66349
+ agent: agentRefSchema8,
66350
+ channelId: idSchema17,
66351
+ messageId: idSchema17
66080
66352
  });
66081
66353
  var postTurnFailureAsCallerInputSchemaDefinition = external_exports.object({
66082
- channelId: idSchema16,
66083
- threadRootId: idSchema16.optional(),
66354
+ channelId: idSchema17,
66355
+ threadRootId: idSchema17.optional(),
66084
66356
  /** The person's message the turn was on, which Try again sends to the agent again. */
66085
- messageId: idSchema16,
66357
+ messageId: idSchema17,
66086
66358
  /** The attempt that failed, so Try again knows once a later one is stored. */
66087
66359
  attempt: external_exports.number().int().min(1).optional(),
66088
66360
  line: external_exports.string().trim().min(1).max(1e3),
@@ -66091,7 +66363,9 @@ var postTurnFailureAsCallerInputSchemaDefinition = external_exports.object({
66091
66363
  var mintLinkAsCallerInputSchemaDefinition = external_exports.object({
66092
66364
  /** Left out, the agent that joins with the link names itself. */
66093
66365
  name: external_exports.string().trim().max(80).optional(),
66094
- channelId: idSchema16.optional()
66366
+ channelId: idSchema17.optional(),
66367
+ /** One of the key's person's agents by id or name: redeeming gives it a new key instead. */
66368
+ reconnect: external_exports.string().trim().min(1).max(80).optional()
66095
66369
  });
66096
66370
 
66097
66371
  // ../../modules/agent/contract/src/agent-secret-sweep.ts
@@ -66201,25 +66475,25 @@ var agentScheduledRunMissedPayloadSchemaDefinition = external_exports.object({
66201
66475
  });
66202
66476
 
66203
66477
  // ../../modules/agent/contract/src/agent-history.ts
66204
- var idSchema17 = external_exports.string().min(1).max(80);
66478
+ var idSchema18 = external_exports.string().min(1).max(80);
66205
66479
  var CALLER_HISTORY_LIMIT_MAX = 100;
66206
66480
  var historyAsCallerInputSchemaDefinition = external_exports.object({
66207
66481
  /** A channel the key's speaker is in, by id or name. */
66208
66482
  channel: external_exports.string().trim().min(1).max(200),
66209
66483
  /** Messages before this Laze message; none reads the newest page. */
66210
- before: idSchema17.optional(),
66484
+ before: idSchema18.optional(),
66211
66485
  /** Already past the cache: no cached messages, only where the live read goes on. */
66212
66486
  olderThan: external_exports.iso.datetime().optional(),
66213
66487
  limit: external_exports.number().int().min(1).max(CALLER_HISTORY_LIMIT_MAX).default(50)
66214
66488
  });
66215
66489
  var callerHistoryMessageSchemaDefinition = external_exports.object({
66216
- messageId: idSchema17,
66217
- threadRootId: idSchema17.nullable(),
66490
+ messageId: idSchema18,
66491
+ threadRootId: idSchema18.nullable(),
66218
66492
  seq: external_exports.number().int().positive(),
66219
66493
  /** `external` for a mirrored message from someone outside Laze. */
66220
66494
  author: external_exports.object({
66221
66495
  kind: external_exports.enum(["person", "agent", "external"]),
66222
- id: idSchema17,
66496
+ id: idSchema18,
66223
66497
  name: external_exports.string()
66224
66498
  }),
66225
66499
  body: external_exports.string(),
@@ -66229,7 +66503,7 @@ var callerHistoryMessageSchemaDefinition = external_exports.object({
66229
66503
  originKey: external_exports.string().nullable()
66230
66504
  });
66231
66505
  var callerHistorySchemaDefinition = external_exports.object({
66232
- channelId: idSchema17,
66506
+ channelId: idSchema18,
66233
66507
  channelName: external_exports.string(),
66234
66508
  channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
66235
66509
  /** The outside workspace a mirrored conversation shows, such as "Slack ACME HQ". */
@@ -66243,12 +66517,12 @@ var callerHistorySchemaDefinition = external_exports.object({
66243
66517
  });
66244
66518
 
66245
66519
  // ../../modules/agent/contract/src/agent-channel-admin.ts
66246
- var idSchema18 = external_exports.string().min(1).max(80);
66520
+ var idSchema19 = external_exports.string().min(1).max(80);
66247
66521
  var channelRefSchema = external_exports.string().trim().min(1).max(200);
66248
66522
  var channelAsCallerInputSchemaDefinition = external_exports.object({ channel: channelRefSchema });
66249
66523
  var callerChannelMemberSchemaDefinition = external_exports.object({
66250
66524
  kind: external_exports.enum(["person", "agent"]),
66251
- id: idSchema18,
66525
+ id: idSchema19,
66252
66526
  name: external_exports.string(),
66253
66527
  role: external_exports.enum(["admin", "member"]),
66254
66528
  /** Active, away or unknown for a person the speaker may see; absent for agents. */
@@ -66258,7 +66532,7 @@ var callerChannelMemberSchemaDefinition = external_exports.object({
66258
66532
  doNotDisturb: doNotDisturbSchema.nullable().optional()
66259
66533
  });
66260
66534
  var callerChannelDetailSchemaDefinition = external_exports.object({
66261
- id: idSchema18,
66535
+ id: idSchema19,
66262
66536
  name: external_exports.string(),
66263
66537
  kind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
66264
66538
  topic: external_exports.string(),
@@ -66289,17 +66563,17 @@ var activityAsCallerInputSchemaDefinition = external_exports.object({
66289
66563
  limit: external_exports.number().int().min(1).max(100).default(50)
66290
66564
  });
66291
66565
  var callerActivityItemSchemaDefinition = external_exports.object({
66292
- id: idSchema18,
66566
+ id: idSchema19,
66293
66567
  kind: external_exports.enum(["mention", "thread_reply", "keyword", "reaction"]),
66294
- channelId: idSchema18,
66568
+ channelId: idSchema19,
66295
66569
  channelName: external_exports.string(),
66296
66570
  channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
66297
- messageId: idSchema18,
66298
- threadRootId: idSchema18.nullable(),
66571
+ messageId: idSchema19,
66572
+ threadRootId: idSchema19.nullable(),
66299
66573
  /** `external` is someone outside Laze whose message a mirror brought in, named at the source. */
66300
66574
  actor: external_exports.object({
66301
66575
  kind: external_exports.enum(["person", "agent", "external"]),
66302
- id: idSchema18,
66576
+ id: idSchema19,
66303
66577
  name: external_exports.string()
66304
66578
  }),
66305
66579
  emoji: external_exports.string().nullable(),
@@ -66316,12 +66590,12 @@ var setStatusAsCallerInputSchemaDefinition = setStatusInputSchema.omit({ workspa
66316
66590
  var setAwayAsCallerInputSchemaDefinition = external_exports.object({ away: external_exports.boolean() });
66317
66591
 
66318
66592
  // ../../modules/agent/contract/src/agent-scheduled.ts
66319
- var idSchema19 = external_exports.string().min(1).max(80);
66593
+ var idSchema20 = external_exports.string().min(1).max(80);
66320
66594
  var channelRefSchema2 = external_exports.string().trim().min(1).max(200);
66321
66595
  var scheduleAsCallerInputSchemaDefinition = external_exports.object({
66322
66596
  channel: channelRefSchema2.optional(),
66323
- threadRootId: idSchema19.optional(),
66324
- replyTo: idSchema19.optional(),
66597
+ threadRootId: idSchema20.optional(),
66598
+ replyTo: idSchema20.optional(),
66325
66599
  body: external_exports.string().trim().min(1).max(4e4),
66326
66600
  sendAt: external_exports.iso.datetime({ offset: true }),
66327
66601
  /** A reply that also goes to the channel at its time (`--also-channel`). */
@@ -66332,9 +66606,9 @@ var scheduleAsCallerInputSchemaDefinition = external_exports.object({
66332
66606
  var listScheduledAsCallerInputSchemaDefinition = external_exports.object({
66333
66607
  channel: channelRefSchema2.optional()
66334
66608
  });
66335
- var scheduledAsCallerInputSchemaDefinition = external_exports.object({ scheduledId: idSchema19 });
66609
+ var scheduledAsCallerInputSchemaDefinition = external_exports.object({ scheduledId: idSchema20 });
66336
66610
  var editScheduledAsCallerInputSchemaDefinition = external_exports.object({
66337
- scheduledId: idSchema19,
66611
+ scheduledId: idSchema20,
66338
66612
  body: external_exports.string().trim().min(1).max(4e4).optional(),
66339
66613
  sendAt: external_exports.iso.datetime({ offset: true }).optional()
66340
66614
  }).refine((input2) => input2.body !== void 0 || input2.sendAt !== void 0, {
@@ -66447,6 +66721,32 @@ var inviteAsCallerInputSchemaDefinition = external_exports.object({
66447
66721
  email: external_exports.email().max(320),
66448
66722
  role: roleSchema.default("MEMBER")
66449
66723
  });
66724
+ var inviteManyAsCallerInputSchemaDefinition = external_exports.object({
66725
+ emails: external_exports.array(external_exports.string().trim().min(1).max(320)).min(1).max(50),
66726
+ /** A conversation by id or `#name`; invitees join it and land in it. */
66727
+ to: external_exports.string().trim().min(1).max(200).optional(),
66728
+ role: roleSchema.default("MEMBER"),
66729
+ confirmed: external_exports.literal(true)
66730
+ });
66731
+ var callerRefusedAddressSchema = external_exports.object({
66732
+ email: external_exports.string(),
66733
+ reason: external_exports.enum(["invalid", "duplicate", "member"])
66734
+ });
66735
+ var callerInviteManySchemaDefinition = external_exports.object({
66736
+ invites: external_exports.array(callerWorkspaceInviteSchemaDefinition),
66737
+ refused: external_exports.array(callerRefusedAddressSchema),
66738
+ /** Some invitations wait for Team (or for seats) before any email goes out. */
66739
+ held: external_exports.boolean(),
66740
+ /** The conversation they land in; null without `to`. */
66741
+ channelId: external_exports.string().nullable()
66742
+ });
66743
+ var callerRequestInvitesSchemaDefinition = external_exports.object({
66744
+ requests: external_exports.array(callerAccessRequestSchemaDefinition),
66745
+ refused: external_exports.array(callerRefusedAddressSchema),
66746
+ channelId: external_exports.string().nullable(),
66747
+ /** The Owners and Admins who approve them, by name. */
66748
+ approvers: external_exports.array(external_exports.string()).default([])
66749
+ });
66450
66750
  var revokeInviteAsCallerInputSchemaDefinition = external_exports.object({
66451
66751
  invite: external_exports.string().trim().min(1).max(320)
66452
66752
  });
@@ -66693,6 +66993,13 @@ var LazeApiError = class extends Error {
66693
66993
  /** What Laze adds to the code, such as the bound session of a `session_not_bound`. */
66694
66994
  meta;
66695
66995
  };
66996
+ var AGENT_MIGRATED = "agent_migrated";
66997
+ function migratedNoticeOf(error62) {
66998
+ if (!(error62 instanceof LazeApiError) || error62.code !== AGENT_MIGRATED) return void 0;
66999
+ const notice = typeof error62.meta?.notice === "string" ? error62.meta.notice : error62.message;
67000
+ const link = typeof error62.meta?.link === "string" ? error62.meta.link : null;
67001
+ return { notice, link };
67002
+ }
66696
67003
  var LazeClient = class _LazeClient {
66697
67004
  constructor(options) {
66698
67005
  this.options = options;
@@ -66701,9 +67008,16 @@ var LazeClient = class _LazeClient {
66701
67008
  static create({
66702
67009
  baseUrl,
66703
67010
  token: token2,
66704
- fetcher
67011
+ fetcher,
67012
+ onMigrated
66705
67013
  }) {
66706
- return new _LazeClient({ baseUrl: baseUrl.replace(/\/+$/, ""), token: token2, fetcher, headers: {} });
67014
+ return new _LazeClient({
67015
+ baseUrl: baseUrl.replace(/\/+$/, ""),
67016
+ token: token2,
67017
+ fetcher,
67018
+ headers: {},
67019
+ onMigrated
67020
+ });
66707
67021
  }
66708
67022
  /** The same client, sending these headers too on every call. */
66709
67023
  withHeaders(headers) {
@@ -66716,6 +67030,9 @@ var LazeClient = class _LazeClient {
66716
67030
  post(path, body, { signal } = {}) {
66717
67031
  return this.send({ method: "POST", path, body, signal });
66718
67032
  }
67033
+ put(path, body) {
67034
+ return this.send({ method: "PUT", path, body });
67035
+ }
66719
67036
  /** A JSON body sent as it is, answered as it came: the status and text, never thrown. */
66720
67037
  async forward({
66721
67038
  path,
@@ -66733,7 +67050,14 @@ var LazeClient = class _LazeClient {
66733
67050
  headers,
66734
67051
  body
66735
67052
  });
66736
- return { status: response.status, text: await response.text() };
67053
+ const text2 = await response.text();
67054
+ if (response.status === 401) await this.toldMigrated(apiErrorOf({ status: 401, text: text2 }));
67055
+ return { status: response.status, text: text2 };
67056
+ }
67057
+ async toldMigrated(error62) {
67058
+ const found = migratedNoticeOf(error62);
67059
+ if (found && this.options.onMigrated)
67060
+ await this.options.onMigrated(found).catch(() => void 0);
66737
67061
  }
66738
67062
  async send({
66739
67063
  method,
@@ -66756,10 +67080,23 @@ var LazeClient = class _LazeClient {
66756
67080
  });
66757
67081
  const text2 = await response.text();
66758
67082
  const parsed = text2 ? JSON.parse(text2) : void 0;
66759
- if (!response.ok) throw errorOf({ status: response.status, body: parsed });
67083
+ if (!response.ok) {
67084
+ const error62 = errorOf({ status: response.status, body: parsed });
67085
+ await this.toldMigrated(error62);
67086
+ throw error62;
67087
+ }
66760
67088
  return parsed;
66761
67089
  }
66762
67090
  };
67091
+ function apiErrorOf({ status: status9, text: text2 }) {
67092
+ let body;
67093
+ try {
67094
+ body = text2 ? JSON.parse(text2) : void 0;
67095
+ } catch {
67096
+ body = void 0;
67097
+ }
67098
+ return errorOf({ status: status9, body });
67099
+ }
66763
67100
  function errorOf({ status: status9, body }) {
66764
67101
  const record4 = typeof body === "object" && body !== null ? body : {};
66765
67102
  const nested = typeof record4.error === "object" && record4.error !== null ? record4.error : record4;
@@ -66773,6 +67110,16 @@ function errorOf({ status: status9, body }) {
66773
67110
  }
66774
67111
 
66775
67112
  // src/services/session.service.ts
67113
+ function markMigratedOn({ context, profile }) {
67114
+ return async ({ notice, link }) => context.store.markMigrated({ name: profile, migrated: { at: context.nowMs(), link, notice } });
67115
+ }
67116
+ function quietWhenMigrated({ args }) {
67117
+ const [first = "", second = ""] = args.words;
67118
+ if (first === "hook") return true;
67119
+ if (first === "inbox") return Boolean(args.flags.wait);
67120
+ if (first === "adopt") return !args.flags.status && !args.flags.stop;
67121
+ return first === "connect" && second === "run";
67122
+ }
66776
67123
  async function signedIn({
66777
67124
  context,
66778
67125
  args
@@ -66788,10 +67135,14 @@ async function signedIn({
66788
67135
  throw new CliUsageError(
66789
67136
  "Not signed in: run `laze login`, or `laze agent link --token <token>` from an agent."
66790
67137
  );
67138
+ if (chosen.profile.migrated && quietWhenMigrated({ args })) {
67139
+ throw new ProfileMigratedError(chosen.name);
67140
+ }
66791
67141
  const client = LazeClient.create({
66792
67142
  baseUrl: chosen.profile.url,
66793
67143
  token: chosen.profile.token,
66794
- fetcher: context.fetcher
67144
+ fetcher: context.fetcher,
67145
+ onMigrated: markMigratedOn({ context, profile: chosen.name })
66795
67146
  });
66796
67147
  if (chosen.profile.kind === "agent") await namingFirst({ client, args });
66797
67148
  return { name: chosen.name, profile: chosen.profile, client };
@@ -66805,7 +67156,8 @@ var ALWAYS_FREE = [
66805
67156
  "logout",
66806
67157
  "update",
66807
67158
  "agent link",
66808
- "agent bind"
67159
+ "agent bind",
67160
+ "agent migrate"
66809
67161
  ];
66810
67162
  async function namingFirst({ client, args }) {
66811
67163
  const [first = "", second = ""] = args.words;
@@ -66923,15 +67275,21 @@ async function disconnectAgent({ context, args }) {
66923
67275
  async function inviteAgent({ context, args }) {
66924
67276
  const name3 = flagText({ args, name: "name" });
66925
67277
  const channelId = flagText({ args, name: "channel" });
67278
+ const reconnect = flagText({ args, name: "reconnect" });
67279
+ if (args.flags.reconnect === true) {
67280
+ throw new CliUsageError("Usage: laze agent invite --reconnect <agent>");
67281
+ }
66926
67282
  const { client } = await signedIn({ context, args });
66927
67283
  const link = await client.post("/api/agents/links", {
66928
67284
  ...name3 ? { name: name3 } : {},
66929
- ...channelId ? { channelId } : {}
67285
+ ...channelId ? { channelId } : {},
67286
+ ...reconnect ? { reconnect } : {}
66930
67287
  });
66931
67288
  if (args.flags.json) return context.out(`${JSON.stringify(link, null, 2)}
66932
67289
  `);
67290
+ const where = reconnect ? `the session that should run ${reconnect} again` : "the agent's session";
66933
67291
  context.out(
66934
- `Paste this into the agent's session (the link works once, until ${link.expiresAt}):
67292
+ `Paste this into ${where} (the link works once, until ${link.expiresAt}):
66935
67293
 
66936
67294
  ${link.prompt}
66937
67295
  `
@@ -67420,7 +67778,7 @@ var dismissSlackLinkPromptInputSchemaDefinition = external_exports.object({
67420
67778
  var dismissSlackLinkPromptInputSchema = dismissSlackLinkPromptInputSchemaDefinition;
67421
67779
 
67422
67780
  // ../../modules/slack/contract/src/slack-move.ts
67423
- var workspaceIdSchema12 = external_exports.string().min(1);
67781
+ var workspaceIdSchema13 = external_exports.string().min(1);
67424
67782
  var teamIdSchema = external_exports.string().regex(/^[TE][A-Z0-9]{2,20}$/);
67425
67783
  var slackChannelIdSchema = external_exports.string().regex(/^[CG][A-Z0-9]{2,20}$/);
67426
67784
  var slackUserIdSchema = external_exports.string().regex(/^[UW][A-Z0-9]{2,20}$/);
@@ -67493,7 +67851,7 @@ var slackMovePreviewSchemaDefinition = external_exports.object({
67493
67851
  });
67494
67852
  var slackMovePreviewSchema = slackMovePreviewSchemaDefinition;
67495
67853
  var slackMoveChannelInputSchemaDefinition = external_exports.object({
67496
- workspaceId: workspaceIdSchema12,
67854
+ workspaceId: workspaceIdSchema13,
67497
67855
  teamId: teamIdSchema,
67498
67856
  slackChannelId: slackChannelIdSchema
67499
67857
  });
@@ -67508,7 +67866,7 @@ var slackMoveRequestSchemaDefinition = external_exports.object({
67508
67866
  farewell: external_exports.string().trim().min(1).max(SLACK_FAREWELL_MAX).optional()
67509
67867
  });
67510
67868
  var startSlackMovesInputSchemaDefinition = external_exports.object({
67511
- workspaceId: workspaceIdSchema12,
67869
+ workspaceId: workspaceIdSchema13,
67512
67870
  teamId: teamIdSchema,
67513
67871
  channels: external_exports.array(slackMoveRequestSchemaDefinition).min(1).max(SLACK_MOVE_BATCH_MAX)
67514
67872
  });
@@ -67523,7 +67881,7 @@ var startedSlackMovesSchemaDefinition = external_exports.object({
67523
67881
  });
67524
67882
  var startedSlackMovesSchema = startedSlackMovesSchemaDefinition;
67525
67883
  var slackMoveInputSchemaDefinition = external_exports.object({
67526
- workspaceId: workspaceIdSchema12,
67884
+ workspaceId: workspaceIdSchema13,
67527
67885
  moveId: external_exports.string().min(1).max(100)
67528
67886
  });
67529
67887
  var slackMoveInputSchema = slackMoveInputSchemaDefinition;
@@ -67597,7 +67955,7 @@ var slackExternalPeopleSchemaDefinition = external_exports.object({
67597
67955
  var slackExternalPeopleSchema = slackExternalPeopleSchemaDefinition;
67598
67956
 
67599
67957
  // ../../modules/slack/contract/src/slack-setup.ts
67600
- var workspaceIdSchema13 = external_exports.string().min(1);
67958
+ var workspaceIdSchema14 = external_exports.string().min(1);
67601
67959
  var appKeySchema = external_exports.string().regex(/^[a-z0-9]{8,64}$/);
67602
67960
  var returnToSchema3 = external_exports.string().startsWith("/").max(500).optional();
67603
67961
  var slackAppCredentialFieldSchema = external_exports.enum([
@@ -67606,7 +67964,7 @@ var slackAppCredentialFieldSchema = external_exports.enum([
67606
67964
  "clientSecret",
67607
67965
  "signingSecret"
67608
67966
  ]);
67609
- var beginSlackSetupInputSchemaDefinition = external_exports.object({ workspaceId: workspaceIdSchema13 });
67967
+ var beginSlackSetupInputSchemaDefinition = external_exports.object({ workspaceId: workspaceIdSchema14 });
67610
67968
  var beginSlackSetupInputSchema = beginSlackSetupInputSchemaDefinition;
67611
67969
  var slackSetupSchemaDefinition = external_exports.object({
67612
67970
  appKey: appKeySchema,
@@ -67620,7 +67978,7 @@ var slackSetupSchemaDefinition = external_exports.object({
67620
67978
  });
67621
67979
  var slackSetupSchema = slackSetupSchemaDefinition;
67622
67980
  var saveSlackAppCredentialsInputSchemaDefinition = external_exports.object({
67623
- workspaceId: workspaceIdSchema13,
67981
+ workspaceId: workspaceIdSchema14,
67624
67982
  appKey: appKeySchema,
67625
67983
  appId: external_exports.string().max(200),
67626
67984
  clientId: external_exports.string().max(200),
@@ -67630,7 +67988,7 @@ var saveSlackAppCredentialsInputSchemaDefinition = external_exports.object({
67630
67988
  });
67631
67989
  var saveSlackAppCredentialsInputSchema = saveSlackAppCredentialsInputSchemaDefinition;
67632
67990
  var installSlackAppInputSchemaDefinition = external_exports.object({
67633
- workspaceId: workspaceIdSchema13,
67991
+ workspaceId: workspaceIdSchema14,
67634
67992
  appKey: appKeySchema,
67635
67993
  returnTo: returnToSchema3
67636
67994
  });
@@ -67765,7 +68123,7 @@ var slackEventsPausedPayloadSchemaDefinition = external_exports.object({
67765
68123
  var SLACK_CACHE_DAYS_MAX = 30;
67766
68124
  var SLACK_HISTORY_PATH = "/api/slack/history";
67767
68125
  var SLACK_READ_BUDGET_MAX = 5e3;
67768
- var workspaceIdSchema14 = external_exports.string().min(1);
68126
+ var workspaceIdSchema15 = external_exports.string().min(1);
67769
68127
  var teamIdSchema2 = external_exports.string().regex(/^[TE][A-Z0-9]{2,20}$/);
67770
68128
  var slackChannelIdSchema2 = external_exports.string().regex(/^[CG][A-Z0-9]{2,20}$/);
67771
68129
  var slackConnectionStatusSchema = external_exports.enum(["connected", "needs_reinstall"]);
@@ -67829,13 +68187,13 @@ var slackChannelViewSchemaDefinition = external_exports.object({
67829
68187
  });
67830
68188
  var slackChannelViewSchema = slackChannelViewSchemaDefinition;
67831
68189
  var startSlackInstallInputSchemaDefinition = external_exports.object({
67832
- workspaceId: workspaceIdSchema14,
68190
+ workspaceId: workspaceIdSchema15,
67833
68191
  /** A path in Laze to land on afterwards; defaults to the Connectors page. */
67834
68192
  returnTo: external_exports.string().startsWith("/").max(500).optional()
67835
68193
  });
67836
68194
  var startSlackInstallInputSchema = startSlackInstallInputSchemaDefinition;
67837
68195
  var startSlackLinkInputSchemaDefinition = external_exports.object({
67838
- workspaceId: workspaceIdSchema14,
68196
+ workspaceId: workspaceIdSchema15,
67839
68197
  teamId: teamIdSchema2,
67840
68198
  returnTo: external_exports.string().startsWith("/").max(500).optional()
67841
68199
  });
@@ -67843,7 +68201,7 @@ var startSlackLinkInputSchema = startSlackLinkInputSchemaDefinition;
67843
68201
  var startedSlackAuthorizeSchemaDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
67844
68202
  var startedSlackAuthorizeSchema = startedSlackAuthorizeSchemaDefinition;
67845
68203
  var startSlackSetupInputSchemaDefinition = external_exports.object({
67846
- workspaceId: workspaceIdSchema14,
68204
+ workspaceId: workspaceIdSchema15,
67847
68205
  configToken: external_exports.string().trim().min(10).max(1e3),
67848
68206
  returnTo: external_exports.string().startsWith("/").max(500).optional()
67849
68207
  });
@@ -67862,19 +68220,19 @@ var slackEventsHeadersSchemaDefinition = external_exports.object({
67862
68220
  });
67863
68221
  var slackEventsAnswerSchemaDefinition = external_exports.object({ challenge: external_exports.string().nullable() });
67864
68222
  var teamInputSchemaDefinition = external_exports.object({
67865
- workspaceId: workspaceIdSchema14,
68223
+ workspaceId: workspaceIdSchema15,
67866
68224
  teamId: teamIdSchema2
67867
68225
  });
67868
68226
  var slackTeamInputSchema = teamInputSchemaDefinition;
67869
68227
  var setSlackMirrorInputSchemaDefinition = external_exports.object({
67870
- workspaceId: workspaceIdSchema14,
68228
+ workspaceId: workspaceIdSchema15,
67871
68229
  teamId: teamIdSchema2,
67872
68230
  slackChannelId: slackChannelIdSchema2,
67873
68231
  mirrored: external_exports.boolean()
67874
68232
  });
67875
68233
  var setSlackMirrorInputSchema = setSlackMirrorInputSchemaDefinition;
67876
68234
  var updateSlackConnectionInputSchemaDefinition = external_exports.object({
67877
- workspaceId: workspaceIdSchema14,
68235
+ workspaceId: workspaceIdSchema15,
67878
68236
  teamId: teamIdSchema2,
67879
68237
  label: external_exports.string().trim().max(80).nullable().optional(),
67880
68238
  cacheDays: external_exports.number().int().min(1).max(SLACK_CACHE_DAYS_MAX).optional(),
@@ -67882,17 +68240,17 @@ var updateSlackConnectionInputSchemaDefinition = external_exports.object({
67882
68240
  });
67883
68241
  var updateSlackConnectionInputSchema = updateSlackConnectionInputSchemaDefinition;
67884
68242
  var updateSlackAppInputSchemaDefinition = external_exports.object({
67885
- workspaceId: workspaceIdSchema14,
68243
+ workspaceId: workspaceIdSchema15,
67886
68244
  teamId: teamIdSchema2,
67887
68245
  configToken: external_exports.string().trim().min(10).max(1e3)
67888
68246
  });
67889
68247
  var updateSlackAppInputSchema = updateSlackAppInputSchemaDefinition;
67890
68248
  var slackLinkParamsSchemaDefinition = external_exports.object({
67891
- workspaceId: workspaceIdSchema14,
68249
+ workspaceId: workspaceIdSchema15,
67892
68250
  teamId: teamIdSchema2
67893
68251
  });
67894
68252
  var slackHistoryInputSchemaDefinition = external_exports.object({
67895
- workspaceId: workspaceIdSchema14,
68253
+ workspaceId: workspaceIdSchema15,
67896
68254
  /** The Laze conversation that mirrors the Slack channel. */
67897
68255
  channelId: external_exports.string().min(1),
67898
68256
  /** Messages before this time; the oldest message the cache shows. */
@@ -67922,7 +68280,7 @@ var slackHistoryPageSchemaDefinition = external_exports.object({
67922
68280
  });
67923
68281
  var slackHistoryPageSchema = slackHistoryPageSchemaDefinition;
67924
68282
  var slackFileParamsSchemaDefinition = external_exports.object({
67925
- workspaceId: workspaceIdSchema14,
68283
+ workspaceId: workspaceIdSchema15,
67926
68284
  /** The Laze conversation that mirrors the Slack channel. */
67927
68285
  channelId: external_exports.string().min(1).max(200),
67928
68286
  fileId: external_exports.string().regex(/^F[A-Z0-9]{2,30}$/)
@@ -67930,7 +68288,7 @@ var slackFileParamsSchemaDefinition = external_exports.object({
67930
68288
  var SLACK_SEARCH_QUERY_MIN = 2;
67931
68289
  var SLACK_SEARCH_QUERY_MAX = 200;
67932
68290
  var slackSearchInputSchemaDefinition = external_exports.object({
67933
- workspaceId: workspaceIdSchema14,
68291
+ workspaceId: workspaceIdSchema15,
67934
68292
  query: external_exports.string().trim().min(SLACK_SEARCH_QUERY_MIN).max(SLACK_SEARCH_QUERY_MAX)
67935
68293
  });
67936
68294
  var slackSearchInputSchema = slackSearchInputSchemaDefinition;
@@ -67978,7 +68336,7 @@ var slackSearchAnswerSchemaDefinition = external_exports.object({
67978
68336
  });
67979
68337
  var slackSearchAnswerSchema = slackSearchAnswerSchemaDefinition;
67980
68338
  var SlackApi = moduleApi()("slack");
67981
- var workspaceInput3 = external_exports.object({ workspaceId: workspaceIdSchema14 });
68339
+ var workspaceInput3 = external_exports.object({ workspaceId: workspaceIdSchema15 });
67982
68340
  var slackTrpc = defineTrpcContract("slack").query("overview").withInput(workspaceInput3).withOutput(slackOverviewSchema).mutation("startSetup").withInput(startSlackSetupInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("beginSetup").withInput(beginSlackSetupInputSchema).withOutput(slackSetupSchema).mutation("saveAppCredentials").withInput(saveSlackAppCredentialsInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("installApp").withInput(installSlackAppInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("startInstall").withInput(startSlackInstallInputSchema).withOutput(startedSlackAuthorizeSchema).mutation("startLink").withInput(startSlackLinkInputSchema).withOutput(startedSlackAuthorizeSchema).query("channels").withInput(slackTeamInputSchema).withOutput(external_exports.array(slackChannelViewSchema)).mutation("setMirror").withInput(setSlackMirrorInputSchema).withOutput(slackConnectionViewSchema).mutation("updateConnection").withInput(updateSlackConnectionInputSchema).withOutput(slackConnectionViewSchema).mutation("disconnect").withInput(slackTeamInputSchema).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("unlink").withInput(slackTeamInputSchema).withOutput(slackConnectionViewSchema).query("linkPrompts").withInput(workspaceInput3).withOutput(slackLinkPromptsSchema).mutation("dismissLinkPrompt").withInput(dismissSlackLinkPromptInputSchema).withOutput(slackLinkPromptsSchema).query("people").withInput(slackPeopleInputSchema).withOutput(slackPeopleSchema).query("bookmarks").withInput(slackBookmarksInputSchema).withOutput(slackBookmarksSchema).query("profiles").withInput(slackProfilesInputSchema).withOutput(slackProfilesSchema).query("linkedNames").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(slackLinkedNamesSchema).query("externalPeople").withInput(slackExternalPeopleInputSchema).withOutput(slackExternalPeopleSchema).mutation("openDirect").withInput(openSlackDirectInputSchema).withOutput(openedSlackDirectSchema).mutation("updateApp").withInput(updateSlackAppInputSchema).withOutput(external_exports.object({ updated: external_exports.literal(true) })).query("history").withInput(slackHistoryInputSchema).withOutput(slackHistoryPageSchema).query("search").withInput(slackSearchInputSchema).withOutput(slackSearchAnswerSchema).query("movePreview").withInput(slackMoveChannelInputSchema).withOutput(slackMovePreviewSchema).mutation("startMoves").withInput(startSlackMovesInputSchema).withOutput(startedSlackMovesSchema).mutation("cancelMove").withInput(slackMoveInputSchema).withOutput(slackMoveViewSchema).query("moves").withInput(workspaceInput3).withOutput(slackMovesSchema).query("emojiSource").withInput(workspaceInput3).withOutput(slackEmojiSourceSchema).mutation("importEmoji").withInput(workspaceInput3).withOutput(slackEmojiImportSchema).build();
67983
68341
 
67984
68342
  // ../../modules/slack/contract/src/slack-keys.ts
@@ -68050,11 +68408,6 @@ var slackMoveByKeyInputSchemaDefinition = slackMoveInputSchema.omit(noWorkspace)
68050
68408
  var positiveInt4 = external_exports.coerce.number().int().positive();
68051
68409
  var slackConfig = Config.define((c) => ({
68052
68410
  publicBaseUrl,
68053
- /**
68054
- * The origin Slack sends people back to after consent, when it is not `publicBaseUrl`: the
68055
- * origin the Slack app lists as its redirect URL during a domain move (docs/ops/domains.md).
68056
- */
68057
- oauthBaseUrl: c.env("SLACK_OAUTH_BASE_URL", external_exports.url().optional()),
68058
68411
  /** The Web API base; methods are `${apiUrl}/<method>`. */
68059
68412
  apiUrl: c.env("SLACK_API_URL", external_exports.url().default("https://slack.com/api")),
68060
68413
  /** Slack's install and sign-in consent page. */
@@ -68253,10 +68606,50 @@ import { mkdir as mkdir4, readFile as readFile5, rm, writeFile as writeFile4 } f
68253
68606
  import { dirname as dirname4, join as join5 } from "node:path";
68254
68607
 
68255
68608
  // src/services/harness-session.service.ts
68256
- import { mkdir as mkdir3, readdir, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
68257
- import { hostname as hostname3 } from "node:os";
68609
+ import { mkdir as mkdir3, open as open2, readdir, readFile as readFile3, stat, writeFile as writeFile3 } from "node:fs/promises";
68610
+ import { homedir as homedir2, hostname as hostname3 } from "node:os";
68258
68611
  import { dirname as dirname3, join as join3 } from "node:path";
68259
68612
 
68613
+ // src/rules/claude-subagent.rules.ts
68614
+ function lastCallAtOf({ text: text2, command }) {
68615
+ const lines2 = text2.split("\n");
68616
+ for (let index = lines2.length - 1; index >= 0; index -= 1) {
68617
+ const line = lines2[index]?.trim();
68618
+ if (!line?.startsWith("{")) continue;
68619
+ let entry;
68620
+ try {
68621
+ entry = JSON.parse(line);
68622
+ } catch {
68623
+ continue;
68624
+ }
68625
+ const at = callAtOf({ entry, command });
68626
+ if (at !== null) return at;
68627
+ }
68628
+ return null;
68629
+ }
68630
+ function callAtOf({ entry, command }) {
68631
+ const { type, timestamp, message: message2 } = entry ?? {};
68632
+ if (type !== "assistant" || typeof timestamp !== "string") return null;
68633
+ const content = Array.isArray(message2?.content) ? message2.content : [];
68634
+ const runs = content.some((part) => {
68635
+ const { type: kind2, input: input2 } = part ?? {};
68636
+ return kind2 === "tool_use" && typeof input2?.command === "string" && command.test(input2.command);
68637
+ });
68638
+ if (!runs) return null;
68639
+ try {
68640
+ return Temporal3.Instant.from(timestamp).epochMilliseconds;
68641
+ } catch {
68642
+ return null;
68643
+ }
68644
+ }
68645
+ function newestIsSubagent({
68646
+ session,
68647
+ subagents
68648
+ }) {
68649
+ const newest = Math.max(...subagents.map((at) => at ?? Number.NEGATIVE_INFINITY));
68650
+ return Number.isFinite(newest) && newest >= (session ?? Number.NEGATIVE_INFINITY);
68651
+ }
68652
+
68260
68653
  // src/rules/rush-host.rules.ts
68261
68654
  function rushSessionOf({
68262
68655
  parentArgs
@@ -68545,8 +68938,63 @@ async function liveElsewhere({
68545
68938
  }
68546
68939
  return false;
68547
68940
  }
68548
- function refuseInSubagent({ context, args }) {
68941
+ async function claudeTranscriptOf({
68942
+ context,
68943
+ sessionId
68944
+ }) {
68945
+ const inherited = context.environment.inherited;
68946
+ const root = join3(
68947
+ inherited.CLAUDE_CONFIG_DIR || join3(inherited.HOME || homedir2(), ".claude"),
68948
+ "projects"
68949
+ );
68950
+ const folders = await readdir(root).catch(() => []);
68951
+ const found = await Promise.all(
68952
+ folders.map(async (folder) => {
68953
+ const path = join3(root, folder, `${sessionId}.jsonl`);
68954
+ return stat(path).then(
68955
+ (info) => info.isFile() ? [{ path, at: info.mtimeMs }] : [],
68956
+ () => []
68957
+ );
68958
+ })
68959
+ );
68960
+ return { root, path: found.flat().toSorted((a, b) => b.at - a.at)[0]?.path };
68961
+ }
68962
+ var TAIL_BYTES = 512 * 1024;
68963
+ async function tailOf({ path }) {
68964
+ const handle = await open2(path, "r").catch(() => void 0);
68965
+ if (!handle) return "";
68966
+ try {
68967
+ const { size } = await handle.stat();
68968
+ const length = Math.min(size, TAIL_BYTES);
68969
+ const buffer = Buffer.alloc(length);
68970
+ await handle.read({ buffer, position: size - length, length });
68971
+ return buffer.toString("utf8");
68972
+ } finally {
68973
+ await handle.close();
68974
+ }
68975
+ }
68976
+ async function runsInSubagent({ context, command }) {
68977
+ const sessionId = context.environment.inherited.CLAUDE_CODE_SESSION_ID ?? "";
68978
+ if (!sessionId) return false;
68979
+ const { path } = await claudeTranscriptOf({ context, sessionId });
68980
+ if (!path) return false;
68981
+ const folder = join3(dirname3(path), sessionId, "subagents");
68982
+ const files2 = await readdir(folder).catch(() => []);
68983
+ const subagents = await Promise.all(
68984
+ files2.filter((file3) => file3.endsWith(".jsonl")).map(
68985
+ async (file3) => lastCallAtOf({ text: await tailOf({ path: join3(folder, file3) }), command })
68986
+ )
68987
+ );
68988
+ const session = lastCallAtOf({ text: await tailOf({ path }), command });
68989
+ return newestIsSubagent({ session, subagents });
68990
+ }
68991
+ async function refuseInSubagent({
68992
+ context,
68993
+ args,
68994
+ command
68995
+ }) {
68549
68996
  if (!context.environment.subagent || flagText({ args, name: "session" })) return;
68997
+ if (!await runsInSubagent({ context, command })) return;
68550
68998
  throw new CliUsageError(
68551
68999
  "This runs inside a Claude Code subagent, which shares its parent's session: it would take that session. Run it in the session itself, or pass --session <id>."
68552
69000
  );
@@ -68625,7 +69073,8 @@ async function agentProfileHere({
68625
69073
  args: await sessionProfileArgs({ context, args: asked, session, binds: false }),
68626
69074
  name: "profile"
68627
69075
  });
68628
- return name3 && config2.profiles[name3]?.kind === "agent" ? name3 : void 0;
69076
+ const profile = name3 ? config2.profiles[name3] : void 0;
69077
+ return name3 && profile?.kind === "agent" && !profile.migrated ? name3 : void 0;
68629
69078
  }
68630
69079
  async function projectHooksHere({ context }) {
68631
69080
  const directory = context.environment.inherited.CLAUDE_PROJECT_DIR || context.cwd;
@@ -68715,7 +69164,8 @@ async function preToolHook({ context, args }) {
68715
69164
  const client = LazeClient.create({
68716
69165
  baseUrl: profile.url,
68717
69166
  token: profile.token,
68718
- fetcher: (input3, init) => context.fetcher(input3, { ...init, signal: AbortSignal.timeout(PRE_TOOL_TIMEOUT_MS) })
69167
+ fetcher: (input3, init) => context.fetcher(input3, { ...init, signal: AbortSignal.timeout(PRE_TOOL_TIMEOUT_MS) }),
69168
+ onMigrated: markMigratedOn({ context, profile: name3 })
68719
69169
  });
68720
69170
  const state = await readState({ context, agent: name3 });
68721
69171
  const answer5 = await beat({ client, state, working: true });
@@ -68734,8 +69184,13 @@ async function preToolHook({ context, args }) {
68734
69184
  })
68735
69185
  );
68736
69186
  } catch (error62) {
68737
- context.err(`laze: the PreToolUse hook skipped: ${String(error62)}
68738
- `);
69187
+ if (error62 instanceof ProfileMigratedError) return;
69188
+ const migrated = migratedNoticeOf(error62);
69189
+ context.err(
69190
+ migrated ? `${migrated.notice}
69191
+ ` : `laze: the PreToolUse hook skipped: ${String(error62)}
69192
+ `
69193
+ );
68739
69194
  }
68740
69195
  }
68741
69196
 
@@ -69423,23 +69878,31 @@ function rolloutEventOf({
69423
69878
  }
69424
69879
 
69425
69880
  // src/services/connect-delivery.service.ts
69426
- import { mkdir as mkdir8, readFile as readFile9, rename as rename3, rm as rm2, stat as stat2, writeFile as writeFile7 } from "node:fs/promises";
69427
- import { homedir as homedir2, hostname as hostname4 } from "node:os";
69881
+ import { mkdir as mkdir8, readFile as readFile9, rename as rename3, rm as rm2, stat as stat3, writeFile as writeFile7 } from "node:fs/promises";
69882
+ import { homedir as homedir3, hostname as hostname4 } from "node:os";
69428
69883
  import { dirname as dirname9, join as join11 } from "node:path";
69429
69884
 
69430
69885
  // src/services/codex-turn-watch.service.ts
69431
- import { open as open2, readdir as readdir2 } from "node:fs/promises";
69432
- import { join as join6 } from "node:path";
69886
+ import { open as open3, readdir as readdir2 } from "node:fs/promises";
69887
+ import { basename as basename3, join as join6 } from "node:path";
69433
69888
  var READ_MS = 1500;
69434
69889
  var KEEP_WORKING_MS = 3e4;
69435
- async function rolloutPathOf({ delivery }) {
69436
- const root = join6(delivery.codexHome, "sessions");
69890
+ async function codexRolloutPathOf({
69891
+ codexHome,
69892
+ threadId
69893
+ }) {
69894
+ const root = join6(codexHome, "sessions");
69437
69895
  const files2 = await readdir2(root, { recursive: true }).catch(() => []);
69438
- const file3 = files2.find((name3) => name3.endsWith(`-${delivery.threadId}.jsonl`));
69896
+ const file3 = files2.find(
69897
+ (name3) => basename3(name3).startsWith("rollout-") && name3.endsWith(`-${threadId}.jsonl`)
69898
+ );
69439
69899
  return file3 ? join6(root, file3) : void 0;
69440
69900
  }
69901
+ function rolloutPathOf({ delivery }) {
69902
+ return codexRolloutPathOf({ codexHome: delivery.codexHome, threadId: delivery.threadId });
69903
+ }
69441
69904
  async function readFrom({ path, offset }) {
69442
- const handle = await open2(path, "r");
69905
+ const handle = await open3(path, "r");
69443
69906
  try {
69444
69907
  const { size } = await handle.stat();
69445
69908
  if (size <= offset) return { text: "", size };
@@ -69526,7 +69989,7 @@ import { chmod as chmod2, mkdir as mkdir5, readFile as readFile6, writeFile as w
69526
69989
  import { dirname as dirname5, join as join7 } from "node:path";
69527
69990
 
69528
69991
  // ../../modules/openclaw/contract/src/openclaw.ts
69529
- var workspaceIdSchema15 = external_exports.string().min(1);
69992
+ var workspaceIdSchema16 = external_exports.string().min(1);
69530
69993
  var connectionIdSchema = external_exports.string().min(1).max(80);
69531
69994
  var openclawAgentIdSchema = external_exports.string().min(1).max(120);
69532
69995
  var openclawConnectionStatusSchema = external_exports.enum([
@@ -69581,14 +70044,14 @@ var openclawOverviewSchemaDefinition = external_exports.object({
69581
70044
  });
69582
70045
  var openclawOverviewSchema = openclawOverviewSchemaDefinition;
69583
70046
  var connectOpenclawInputSchemaDefinition = external_exports.object({
69584
- workspaceId: workspaceIdSchema15,
70047
+ workspaceId: workspaceIdSchema16,
69585
70048
  gatewayUrl: external_exports.string().trim().min(1).max(500),
69586
70049
  token: external_exports.string().trim().min(1).max(500),
69587
70050
  label: external_exports.string().trim().min(1).max(80).optional()
69588
70051
  });
69589
70052
  var connectOpenclawInputSchema = connectOpenclawInputSchemaDefinition;
69590
70053
  var openclawConnectionRefSchemaDefinition = external_exports.object({
69591
- workspaceId: workspaceIdSchema15,
70054
+ workspaceId: workspaceIdSchema16,
69592
70055
  connectionId: connectionIdSchema
69593
70056
  });
69594
70057
  var openclawConnectionRefSchema = openclawConnectionRefSchemaDefinition;
@@ -69615,7 +70078,7 @@ var openclawAgentKeySchemaDefinition = external_exports.object({
69615
70078
  });
69616
70079
  var openclawAgentKeySchema = openclawAgentKeySchemaDefinition;
69617
70080
  var OpenclawApi = moduleApi()("openclaw");
69618
- var openclawTrpc = defineTrpcContract("openclaw").query("overview").withInput(external_exports.object({ workspaceId: workspaceIdSchema15 })).withOutput(openclawOverviewSchema).mutation("connect").withInput(connectOpenclawInputSchema).withOutput(openclawConnectionViewSchema).mutation("setAgent").withInput(setOpenclawAgentInputSchema).withOutput(openclawConnectionViewSchema).mutation("setFeed").withInput(setOpenclawFeedInputSchema).withOutput(openclawConnectionViewSchema).mutation("agentKey").withInput(openclawAgentRefSchema).withOutput(openclawAgentKeySchema).mutation("disconnect").withInput(openclawConnectionRefSchema).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).build();
70081
+ var openclawTrpc = defineTrpcContract("openclaw").query("overview").withInput(external_exports.object({ workspaceId: workspaceIdSchema16 })).withOutput(openclawOverviewSchema).mutation("connect").withInput(connectOpenclawInputSchema).withOutput(openclawConnectionViewSchema).mutation("setAgent").withInput(setOpenclawAgentInputSchema).withOutput(openclawConnectionViewSchema).mutation("setFeed").withInput(setOpenclawFeedInputSchema).withOutput(openclawConnectionViewSchema).mutation("agentKey").withInput(openclawAgentRefSchema).withOutput(openclawAgentKeySchema).mutation("disconnect").withInput(openclawConnectionRefSchema).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).build();
69619
70082
 
69620
70083
  // ../../modules/openclaw/contract/src/openclaw.config.ts
69621
70084
  var positiveInt5 = external_exports.coerce.number().int().positive();
@@ -69634,7 +70097,9 @@ var openclawConfig = Config.define((c) => ({
69634
70097
  /** A run that shows no progress for this long is given up and said so in the conversation. */
69635
70098
  runTimeoutMinutes: c.env("OPENCLAW_RUN_TIMEOUT_MINUTES", positiveInt5.default(30)),
69636
70099
  /** The hard limit of one run, progress or not; OpenClaw gets it as the run's `timeoutMs`. */
69637
- runMaxHours: c.env("OPENCLAW_RUN_MAX_HOURS", positiveInt5.default(6))
70100
+ runMaxHours: c.env("OPENCLAW_RUN_MAX_HOURS", positiveInt5.default(6)),
70101
+ /** Where the progress board ops card for a gateway that stopped answering is written. */
70102
+ opsAlertDir: c.env("OPENCLAW_OPS_ALERT_DIR", external_exports.string().min(1).optional())
69638
70103
  }));
69639
70104
 
69640
70105
  // ../../modules/openclaw/contract/src/openclaw.events.ts
@@ -69848,18 +70313,18 @@ var RelaySession = class {
69848
70313
  if (!envelope) return;
69849
70314
  const { line, payload } = envelope;
69850
70315
  if (envelope.kind === "open") return this.dial(relay2, line);
69851
- const open3 = this.#lines.get(line);
69852
- if (!open3) return;
70316
+ const open4 = this.#lines.get(line);
70317
+ if (!open4) return;
69853
70318
  if (envelope.kind === "close") {
69854
70319
  this.#lines.delete(line);
69855
- open3.socket.close(1e3);
70320
+ open4.socket.close(1e3);
69856
70321
  return;
69857
70322
  }
69858
70323
  if (envelope.kind !== "text" && envelope.kind !== "binary") return;
69859
70324
  const frame = { data: Buffer.from(payload), binary: envelope.kind === "binary" };
69860
- if (open3.socket.readyState === wrapper_default.OPEN) {
69861
- open3.socket.send(frame.data, { binary: frame.binary });
69862
- } else open3.waiting.push(frame);
70325
+ if (open4.socket.readyState === wrapper_default.OPEN) {
70326
+ open4.socket.send(frame.data, { binary: frame.binary });
70327
+ } else open4.waiting.push(frame);
69863
70328
  }
69864
70329
  /** Dials the gateway for a line; its frames go back to Laze as they came. */
69865
70330
  dial(relay2, line) {
@@ -69953,7 +70418,7 @@ var RelayLoops = class _RelayLoops {
69953
70418
  };
69954
70419
 
69955
70420
  // src/services/rush-listeners.service.ts
69956
- import { readFile as readFile8, readdir as readdir3, stat } from "node:fs/promises";
70421
+ import { readFile as readFile8, readdir as readdir3, stat as stat2 } from "node:fs/promises";
69957
70422
  import { dirname as dirname7, join as join9 } from "node:path";
69958
70423
 
69959
70424
  // src/services/rush-host.service.ts
@@ -70021,7 +70486,7 @@ async function notesOf({ context }) {
70021
70486
  files2.map(async (file3) => {
70022
70487
  const pid = Number(file3.replace(/\.json$/, ""));
70023
70488
  const note = await jsonOf(join9(folder, file3));
70024
- const at = await stat(join9(folder, file3)).then(
70489
+ const at = await stat2(join9(folder, file3)).then(
70025
70490
  (info) => info.mtimeMs,
70026
70491
  () => 0
70027
70492
  );
@@ -70035,8 +70500,9 @@ async function notesOf({ context }) {
70035
70500
  async function rushListenersOf({
70036
70501
  context
70037
70502
  }) {
70038
- const bound = Object.entries((await context.store.read()).sessions ?? {}).filter(
70039
- ([key]) => key.startsWith("claude-code:")
70503
+ const config2 = await context.store.read();
70504
+ const bound = Object.entries(config2.sessions ?? {}).filter(
70505
+ ([key, profile]) => key.startsWith("claude-code:") && !config2.profiles[profile]?.migrated
70040
70506
  );
70041
70507
  if (bound.length === 0) return [];
70042
70508
  const listed = await rushListingOf({ context });
@@ -70107,11 +70573,12 @@ var CHECK_TIMEOUT_MS = 5e3;
70107
70573
  function clientOf({ context, profile }) {
70108
70574
  return context.store.read().then((config2) => {
70109
70575
  const entry = config2.profiles[profile];
70110
- if (!entry) return void 0;
70576
+ if (!entry || entry.migrated) return void 0;
70111
70577
  return LazeClient.create({
70112
70578
  baseUrl: entry.url,
70113
70579
  token: entry.token,
70114
- fetcher: (input2, init) => context.fetcher(input2, { ...init, signal: AbortSignal.timeout(CHECK_TIMEOUT_MS) })
70580
+ fetcher: (input2, init) => context.fetcher(input2, { ...init, signal: AbortSignal.timeout(CHECK_TIMEOUT_MS) }),
70581
+ onMigrated: markMigratedOn({ context, profile })
70115
70582
  });
70116
70583
  });
70117
70584
  }
@@ -70233,7 +70700,7 @@ var CLI_CHANGED_EXIT = 75;
70233
70700
  async function cliStampOf({ context }) {
70234
70701
  const file3 = context.program.at(-1);
70235
70702
  if (!file3) return "";
70236
- return stat2(file3).then(
70703
+ return stat3(file3).then(
70237
70704
  (info) => `${info.mtimeMs}:${info.size}`,
70238
70705
  () => ""
70239
70706
  );
@@ -70276,7 +70743,7 @@ async function takeRound({
70276
70743
  const session = {
70277
70744
  harness: "codex",
70278
70745
  sessionId: delivery.threadId,
70279
- folder: displayFolderOf({ folder: delivery.cwd, home: homedir2() }),
70746
+ folder: displayFolderOf({ folder: delivery.cwd, home: homedir3() }),
70280
70747
  host: hostname4()
70281
70748
  };
70282
70749
  try {
@@ -70324,7 +70791,8 @@ async function serveAgent({
70324
70791
  const client = LazeClient.create({
70325
70792
  baseUrl: entry.url,
70326
70793
  token: entry.token,
70327
- fetcher: context.fetcher
70794
+ fetcher: context.fetcher,
70795
+ onMigrated: markMigratedOn({ context, profile })
70328
70796
  });
70329
70797
  const watch = CodexTurnWatch.create({ context, client, profile, delivery: entry.delivery });
70330
70798
  const ended = new AbortController();
@@ -70361,6 +70829,13 @@ async function serveRounds({
70361
70829
  wait = 1;
70362
70830
  if (delivered === 0) await context.sleep(1e3, signal);
70363
70831
  } catch (error62) {
70832
+ const migrated = migratedNoticeOf(error62);
70833
+ if (migrated) {
70834
+ await report4(profile, "stopped: the agent moved into Laze");
70835
+ context.err(`${profile}: ${migrated.notice}
70836
+ `);
70837
+ return;
70838
+ }
70364
70839
  if (error62 instanceof LazeApiError && error62.status === 401) {
70365
70840
  await report4(profile, "stopped: Laze refused the agent's key; link the session again");
70366
70841
  context.err(`${profile}: Laze refused the key; this agent is no longer served
@@ -70394,14 +70869,15 @@ async function syncLoops(run4) {
70394
70869
  const config2 = await run4.context.store.read();
70395
70870
  for (const [profile, current2] of run4.served) {
70396
70871
  const entry = config2.profiles[profile];
70397
- if (entry?.token === current2.token && entry.delivery?.threadId === current2.threadId) continue;
70872
+ const same2 = entry?.token === current2.token && entry.delivery?.threadId === current2.threadId;
70873
+ if (same2 && !entry.migrated) continue;
70398
70874
  current2.stop.abort();
70399
70875
  await current2.done;
70400
70876
  run4.served.delete(profile);
70401
70877
  setAgent(run4, profile, void 0);
70402
70878
  }
70403
70879
  const linked = Object.entries(config2.profiles).filter(
70404
- (pair2) => pair2[1].delivery?.harness === "codex" && pair2[1].kind === "agent"
70880
+ (pair2) => pair2[1].delivery?.harness === "codex" && pair2[1].kind === "agent" && !pair2[1].migrated
70405
70881
  );
70406
70882
  for (const [profile, entry] of linked.filter(([name3]) => !run4.served.has(name3))) {
70407
70883
  const { threadId } = entry.delivery;
@@ -70901,6 +71377,13 @@ async function waitHook({ context, args }) {
70901
71377
  try {
70902
71378
  return await waitForMessages({ context, args });
70903
71379
  } catch (error62) {
71380
+ if (error62 instanceof ProfileMigratedError) return 0;
71381
+ const migrated = migratedNoticeOf(error62);
71382
+ if (migrated) {
71383
+ context.err(`${migrated.notice}
71384
+ `);
71385
+ return 2;
71386
+ }
70904
71387
  context.err(`laze: the background waiter stopped: ${String(error62)}
70905
71388
  `);
70906
71389
  return 0;
@@ -70918,13 +71401,13 @@ async function monitorServes({
70918
71401
 
70919
71402
  // src/services/codex-link.service.ts
70920
71403
  import { createReadStream } from "node:fs";
70921
- import { readdir as readdir5, rm as rm6, stat as stat4 } from "node:fs/promises";
71404
+ import { readdir as readdir5, rm as rm6, stat as stat5 } from "node:fs/promises";
70922
71405
  import { join as join14, resolve as resolve3 } from "node:path";
70923
71406
  import { createInterface as createInterface2 } from "node:readline";
70924
71407
 
70925
71408
  // src/services/codex-adopt.service.ts
70926
71409
  import { spawn as spawn2 } from "node:child_process";
70927
- import { mkdir as mkdir11, readdir as readdir4, readFile as readFile11, rm as rm5, stat as stat3, writeFile as writeFile10 } from "node:fs/promises";
71410
+ import { mkdir as mkdir11, readdir as readdir4, readFile as readFile11, rm as rm5, stat as stat4, writeFile as writeFile10 } from "node:fs/promises";
70928
71411
  import { dirname as dirname12, join as join13 } from "node:path";
70929
71412
  import { createInterface } from "node:readline";
70930
71413
 
@@ -71049,7 +71532,7 @@ async function newestThreadId({ codexHome }) {
71049
71532
  const files2 = await readdir4(root, { recursive: true }).catch(() => []);
71050
71533
  const rollouts = files2.filter((file3) => /rollout-.*\.jsonl$/.test(file3));
71051
71534
  const dated = await Promise.all(
71052
- rollouts.map(async (file3) => ({ file: file3, at: (await stat3(join13(root, file3))).mtimeMs }))
71535
+ rollouts.map(async (file3) => ({ file: file3, at: (await stat4(join13(root, file3))).mtimeMs }))
71053
71536
  );
71054
71537
  const newest = dated.toSorted((a, b) => b.at - a.at)[0]?.file ?? "";
71055
71538
  const id2 = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.jsonl$/.exec(newest);
@@ -71178,6 +71661,10 @@ async function supervise({
71178
71661
  const code = await context.runCommand({ command, env: {} }).catch(() => 1);
71179
71662
  if (context.nowMs() - started > HEALTHY_RUN_MS) wait = 1;
71180
71663
  if ((await recordOf({ path }))?.pid !== context.processes.pid) break;
71664
+ if ((await context.store.read()).profiles[profile]?.migrated) {
71665
+ context.out("The agent moved into Laze; laze adopt codex stops here.\n");
71666
+ break;
71667
+ }
71181
71668
  context.out(`laze adopt codex exited ${code}; starting it again in ${wait}s
71182
71669
  `);
71183
71670
  await context.sleep(wait * 1e3);
@@ -71320,7 +71807,7 @@ async function newestThreadIn({
71320
71807
  const dated = await Promise.all(
71321
71808
  rollouts.map(async (file3) => ({
71322
71809
  path: join14(root, file3),
71323
- at: await stat4(join14(root, file3)).then(
71810
+ at: await stat5(join14(root, file3)).then(
71324
71811
  (info) => info.mtimeMs,
71325
71812
  () => 0
71326
71813
  )
@@ -71391,7 +71878,7 @@ async function linkCodexSession({
71391
71878
 
71392
71879
  // src/services/laze-plugin.service.ts
71393
71880
  import { mkdir as mkdir12, readFile as readFile12, writeFile as writeFile11 } from "node:fs/promises";
71394
- import { homedir as homedir3 } from "node:os";
71881
+ import { homedir as homedir4 } from "node:os";
71395
71882
  import { dirname as dirname13, join as join15 } from "node:path";
71396
71883
 
71397
71884
  // src/rules/laze-plugin.rules.ts
@@ -71599,7 +72086,7 @@ async function registerWithClaude({ context, folder }) {
71599
72086
  var RUN_FILES = ["hooks/hooks.json", "monitors/monitors.json"];
71600
72087
  async function cachedPluginOf({ context }) {
71601
72088
  const inherited = context.environment.inherited;
71602
- const home = inherited.HOME || homedir3();
72089
+ const home = inherited.HOME || homedir4();
71603
72090
  const claude = inherited.CLAUDE_CONFIG_DIR || join15(home, ".claude");
71604
72091
  const listed = await readFile12(join15(claude, "plugins", "installed_plugins.json"), "utf8").then(
71605
72092
  (text2) => JSON.parse(text2),
@@ -71610,10 +72097,10 @@ async function cachedPluginOf({ context }) {
71610
72097
  async function refreshStaleCache({ context, folder }) {
71611
72098
  const cached2 = await cachedPluginOf({ context });
71612
72099
  if (!cached2) return true;
71613
- const read3 = (path) => readFile12(path, "utf8").catch(() => "");
72100
+ const read4 = (path) => readFile12(path, "utf8").catch(() => "");
71614
72101
  for (const file3 of RUN_FILES) {
71615
- const ours = await read3(join15(folder, LAZE_PLUGIN, file3));
71616
- if (ours === await read3(join15(cached2, file3))) continue;
72102
+ const ours = await read4(join15(folder, LAZE_PLUGIN, file3));
72103
+ if (ours === await read4(join15(cached2, file3))) continue;
71617
72104
  const plugin2 = `${LAZE_PLUGIN}@${LAZE_PLUGIN}`;
71618
72105
  const script = [
71619
72106
  `claude plugin uninstall ${plugin2} --scope user ${QUIET}`,
@@ -71756,11 +72243,18 @@ async function pushInbox({
71756
72243
  while (!signal.aborted) {
71757
72244
  const messages = await client.post("/api/agents/me/inbox", { waitSeconds: ROUND_SECONDS3 }, { signal }).catch(async (error62) => {
71758
72245
  if (signal.aborted) return [];
72246
+ const migrated = migratedNoticeOf(error62);
72247
+ if (migrated) {
72248
+ context.err(`${migrated.notice}
72249
+ `);
72250
+ return void 0;
72251
+ }
71759
72252
  context.err(`laze mcp: could not read the inbox: ${String(error62)}
71760
72253
  `);
71761
72254
  await context.sleep(RETRY_MS, signal);
71762
72255
  return [];
71763
72256
  });
72257
+ if (messages === void 0) break;
71764
72258
  if (messages.length === 0) {
71765
72259
  await context.sleep(1e3, signal);
71766
72260
  continue;
@@ -71983,7 +72477,7 @@ function sandboxed({ context, error: error62 }) {
71983
72477
  async function linkAgent({ context, args }) {
71984
72478
  const token2 = flagText({ args, name: "token" });
71985
72479
  if (!token2) throw new CliUsageError("Usage: laze agent link --token <token>");
71986
- refuseInSubagent({ context, args });
72480
+ await refuseInSubagent({ context, args, command: /\bagent\s+link\b/ });
71987
72481
  const url2 = serverUrlOf({ context, args });
71988
72482
  const { harness, pid } = await harnessOf2({ context, args });
71989
72483
  const client = LazeClient.create({ baseUrl: url2, fetcher: context.fetcher });
@@ -72105,6 +72599,11 @@ function stopContext({ context, text: text2 }) {
72105
72599
  const hookSpecificOutput = { hookEventName: "Stop", additionalContext: text2 };
72106
72600
  context.out(JSON.stringify({ hookSpecificOutput }));
72107
72601
  }
72602
+ function reportFailed({ context, error: error62 }) {
72603
+ if (migratedNoticeOf(error62)) throw error62;
72604
+ context.err(`laze: could not report context: ${String(error62)}
72605
+ `);
72606
+ }
72108
72607
  async function handOver({ context, args }) {
72109
72608
  const raw = await context.readStdin();
72110
72609
  const input2 = raw.trim() ? JSON.parse(raw) : {};
@@ -72115,8 +72614,7 @@ async function handOver({ context, args }) {
72115
72614
  const named = await sessionProfileArgs({ context, args: asked, session });
72116
72615
  const { client, name: agent2 } = await signedIn({ context, args: named });
72117
72616
  await reportTranscript({ client, input: input2 }).catch(
72118
- (error62) => context.err(`laze: could not report context: ${String(error62)}
72119
- `)
72617
+ (error62) => reportFailed({ context, error: error62 })
72120
72618
  );
72121
72619
  if (input2.stop_hook_active) return;
72122
72620
  if (await monitorServes({ context, profile: agent2, claudePid })) {
@@ -72188,6 +72686,9 @@ async function stopHook({ context, args }) {
72188
72686
  try {
72189
72687
  await handOver({ context, args });
72190
72688
  } catch (error62) {
72689
+ if (error62 instanceof ProfileMigratedError) return;
72690
+ const migrated = migratedNoticeOf(error62);
72691
+ if (migrated) return stopContext({ context, text: migrated.notice });
72191
72692
  context.err(`laze: the Stop hook skipped: ${String(error62)}
72192
72693
  `);
72193
72694
  }
@@ -72934,6 +73435,314 @@ async function setAgentPool({
72934
73435
  });
72935
73436
  }
72936
73437
 
73438
+ // src/services/agent-migrate-commands.service.ts
73439
+ import { readFile as readFile16 } from "node:fs/promises";
73440
+ import { basename as basename4, join as join17 } from "node:path";
73441
+
73442
+ // src/rules/migration-upload.rules.ts
73443
+ import { createHash as createHash2 } from "node:crypto";
73444
+ function markersIn(text2) {
73445
+ return text2.split(REDACTION_MARKER).length - 1;
73446
+ }
73447
+ async function redactTranscript({
73448
+ text: text2
73449
+ }) {
73450
+ let redactions = 0;
73451
+ const redacted = await mapJsonlStrings({
73452
+ text: text2,
73453
+ mapAll: async (strings) => strings.map((value) => {
73454
+ const next = redactDetectedSecrets({ text: value });
73455
+ redactions += Math.max(0, markersIn(next) - markersIn(value));
73456
+ return next;
73457
+ })
73458
+ });
73459
+ return { text: redacted.text, redactions };
73460
+ }
73461
+ function sha256Of({ text: text2 }) {
73462
+ return createHash2("sha256").update(text2, "utf8").digest("hex");
73463
+ }
73464
+ var bytesOf2 = (text2) => Buffer.byteLength(text2, "utf8");
73465
+ function piecesOf({ line, maxBytes }) {
73466
+ if (bytesOf2(line) <= maxBytes) return [line];
73467
+ const pieces = [];
73468
+ let current2 = "";
73469
+ let size = 0;
73470
+ for (const char of line) {
73471
+ const width = bytesOf2(char);
73472
+ if (size + width > maxBytes) {
73473
+ pieces.push(current2);
73474
+ current2 = "";
73475
+ size = 0;
73476
+ }
73477
+ current2 += char;
73478
+ size += width;
73479
+ }
73480
+ if (current2) pieces.push(current2);
73481
+ return pieces;
73482
+ }
73483
+ function packed({ lines: lines2, maxBytes }) {
73484
+ const parts = [];
73485
+ let current2 = "";
73486
+ let size = 0;
73487
+ for (const piece of lines2.flatMap((line) => piecesOf({ line, maxBytes }))) {
73488
+ const width = bytesOf2(piece);
73489
+ if (size + width > maxBytes && current2) {
73490
+ parts.push(current2);
73491
+ current2 = "";
73492
+ size = 0;
73493
+ }
73494
+ current2 += piece;
73495
+ size += width;
73496
+ }
73497
+ if (current2) parts.push(current2);
73498
+ return parts;
73499
+ }
73500
+ function transcriptPartsOf({
73501
+ text: text2,
73502
+ maxBytes,
73503
+ maxParts
73504
+ }) {
73505
+ const lines2 = text2.split(/(?<=\n)/);
73506
+ const whole = packed({ lines: lines2, maxBytes });
73507
+ if (whole.length <= maxParts) return { parts: whole, truncated: false };
73508
+ let low = 1;
73509
+ let high = lines2.length - 1;
73510
+ while (low < high) {
73511
+ const middle = Math.floor((low + high) / 2);
73512
+ if (packed({ lines: lines2.slice(middle), maxBytes }).length <= maxParts) high = middle;
73513
+ else low = middle + 1;
73514
+ }
73515
+ const kept = packed({ lines: lines2.slice(low), maxBytes });
73516
+ return { parts: kept.slice(-maxParts), truncated: true };
73517
+ }
73518
+
73519
+ // src/services/agent-migrate-commands.service.ts
73520
+ var MIGRATE_USAGE = `laze agent migrate <agent> [--to claude-code|codex|laze-models] [--level fast|frontier] [--resend]
73521
+ move your connected Claude Code or Codex agent into Laze, as the same agent: its own session
73522
+ uploads its conversation with secrets removed, then Laze runs it; --to picks where it runs
73523
+ (its own harness when left out), --level the Laze models level, --resend asks its session again
73524
+ laze agent migrate status <agent> [--json] the agent's latest migration
73525
+ laze agent migrate cancel <agent> cancel a migration still waiting for the agent's session
73526
+ laze agent migrate upload <migrationId> run inside the agent's own session: uploads its transcript
73527
+ `;
73528
+ var TARGETS = /* @__PURE__ */ new Set(["claude-code", "codex", "laze-models"]);
73529
+ var LEVELS3 = /* @__PURE__ */ new Set(["fast", "frontier"]);
73530
+ var HARNESS_NAMES3 = {
73531
+ "claude-code": "Claude Code",
73532
+ codex: "Codex",
73533
+ "laze-models": "Laze models"
73534
+ };
73535
+ var SESSION_ID = /^[A-Za-z0-9_-]{1,100}$/;
73536
+ var FILE_NAME2 = /^[A-Za-z0-9._-]{1,200}\.jsonl$/;
73537
+ var quoted = (value) => /^[\w.@:+-]+$/.test(value) ? value : `"${value.replaceAll('"', '\\"')}"`;
73538
+ function targetOf(migration) {
73539
+ const name3 = HARNESS_NAMES3[migration.target] ?? migration.target;
73540
+ return migration.modelLevel ? `${name3}, ${migration.modelLevel}` : name3;
73541
+ }
73542
+ function modeLine(migration) {
73543
+ return migration.mode === "resume" ? "Laze resumes that same session" : "Laze starts a fresh session from a summary of it";
73544
+ }
73545
+ function agentOf({ args, usage }) {
73546
+ const agent2 = args.words[3] ?? "";
73547
+ if (!agent2) throw new CliUsageError(usage);
73548
+ return agent2;
73549
+ }
73550
+ async function migrate({ context, args }) {
73551
+ const agent2 = args.words[2] ?? "";
73552
+ const harness = flagText({ args, name: "to" });
73553
+ const level = flagText({ args, name: "level" });
73554
+ const known = (!harness || TARGETS.has(harness)) && (!level || LEVELS3.has(level));
73555
+ if (!agent2 || !known) {
73556
+ throw new CliUsageError(`Usage: ${MIGRATE_USAGE}`);
73557
+ }
73558
+ const { client } = await signedIn({ context, args });
73559
+ const migration = await client.post("/api/agents/migrate", {
73560
+ agent: agent2,
73561
+ ...harness ? { harness } : {},
73562
+ ...level ? { modelLevel: level } : {},
73563
+ resend: Boolean(args.flags.resend)
73564
+ });
73565
+ if (args.flags.json) return context.out(`${JSON.stringify(migration, null, 2)}
73566
+ `);
73567
+ const name3 = migration.agentName;
73568
+ context.out(
73569
+ [
73570
+ `Asked ${name3} to move into Laze, to run on ${targetOf(migration)}.`,
73571
+ `${name3}'s session uploads its conversation, secrets removed, when it reads the request in its direct messages; ${modeLine(migration)}.`,
73572
+ ...migration.machineLastSeenAt ? [] : [`${name3}'s machine has not called Laze yet: the request waits until it is on.`],
73573
+ `Cancel it: laze agent migrate cancel ${quoted(name3)}`,
73574
+ `Check on it: laze agent migrate status ${quoted(name3)}`,
73575
+ ""
73576
+ ].join("\n")
73577
+ );
73578
+ }
73579
+ function statusLines(migration) {
73580
+ const removed = migration.removed;
73581
+ return [
73582
+ `${migration.agentName}: ${migration.status}`,
73583
+ `From ${HARNESS_NAMES3[migration.source] ?? migration.source} to ${targetOf(migration)}`,
73584
+ `Session: ${migration.mode === "resume" ? "resumed" : "started fresh from a summary"}`,
73585
+ `Asked: ${migration.requestedAt}`,
73586
+ ...migration.completedAt ? [`Done: ${migration.completedAt}`] : [],
73587
+ ...removed ? [
73588
+ `Secrets removed: ${removed.local} on the machine, ${removed.vault} vault values, ${removed.patterns} key-shaped texts`
73589
+ ] : [],
73590
+ `Machine last seen: ${migration.machineLastSeenAt ?? "never"}`
73591
+ ];
73592
+ }
73593
+ async function migrationStatus({ context, args }) {
73594
+ const agent2 = agentOf({ context, args, usage: "Usage: laze agent migrate status <agent>" });
73595
+ const { client } = await signedIn({ context, args });
73596
+ const { migration } = await client.get(
73597
+ `/api/agents/migration?agent=${encodeURIComponent(agent2)}`
73598
+ );
73599
+ if (args.flags.json) return context.out(`${JSON.stringify(migration, null, 2)}
73600
+ `);
73601
+ if (!migration) return context.out(`${agent2} has no migration.
73602
+ `);
73603
+ context.out(`${statusLines(migration).join("\n")}
73604
+ `);
73605
+ }
73606
+ async function cancelMigration({ context, args }) {
73607
+ const agent2 = agentOf({ context, args, usage: "Usage: laze agent migrate cancel <agent>" });
73608
+ const { client } = await signedIn({ context, args });
73609
+ const migration = await client.post("/api/agents/migrate/cancel", { agent: agent2 });
73610
+ if (args.flags.json) return context.out(`${JSON.stringify(migration, null, 2)}
73611
+ `);
73612
+ context.out(`Cancelled ${migration.agentName}'s migration; it stays connected on its machine.
73613
+ `);
73614
+ }
73615
+ async function transcriptOf({ context, ticket }) {
73616
+ const inherited = context.environment.inherited;
73617
+ const own2 = ticket.source === "codex" ? inherited.CODEX_THREAD_ID : inherited.CLAUDE_CODE_SESSION_ID;
73618
+ const sessionId = own2 || ticket.sessionId || "";
73619
+ if (!SESSION_ID.test(sessionId)) {
73620
+ throw new CliUsageError(
73621
+ `No ${HARNESS_NAMES3[ticket.source]} session id here: run this inside the agent's own session. Nothing was uploaded.`
73622
+ );
73623
+ }
73624
+ if (ticket.source === "codex") {
73625
+ const codexHome = context.environment.codexHome;
73626
+ const path2 = await codexRolloutPathOf({ codexHome, threadId: sessionId });
73627
+ return { sessionId, path: path2, where: join17(codexHome, "sessions") };
73628
+ }
73629
+ const { root, path } = await claudeTranscriptOf({ context, sessionId });
73630
+ return { sessionId, path, where: root };
73631
+ }
73632
+ async function agentHere({ context, args }) {
73633
+ const session = await currentSessionOf({ context, args });
73634
+ const named = await sessionProfileArgs({ context, args, session, binds: false });
73635
+ const signed2 = await signedIn({ context, args: named });
73636
+ if (signed2.profile.kind !== "agent") {
73637
+ throw new CliUsageError(
73638
+ "laze agent migrate upload runs inside the agent's own session, with the agent's key."
73639
+ );
73640
+ }
73641
+ return signed2;
73642
+ }
73643
+ async function uploadParts({
73644
+ client,
73645
+ migrationId,
73646
+ upload
73647
+ }) {
73648
+ const again = migrationUploadCommandOf({ migrationId: decodeURIComponent(migrationId) });
73649
+ for (const [index, text2] of upload.parts.entries()) {
73650
+ try {
73651
+ await client.put(`/api/agents/me/migrations/${migrationId}/parts/${index}`, { text: text2 });
73652
+ } catch (error62) {
73653
+ if (migratedNoticeOf(error62)) throw error62;
73654
+ const why = error62 instanceof Error ? error62.message : String(error62);
73655
+ throw new CliUsageError(
73656
+ `Part ${index + 1} of ${upload.parts.length} did not upload (${why}). Nothing moved yet: run \`${again}\` again.`
73657
+ );
73658
+ }
73659
+ }
73660
+ }
73661
+ async function uploadTranscript({ context, args, client }) {
73662
+ const migrationId = agentOf({
73663
+ context,
73664
+ args,
73665
+ usage: "Usage: laze agent migrate upload <migrationId>"
73666
+ });
73667
+ const id2 = encodeURIComponent(migrationId);
73668
+ const ticket = await client.get(`/api/agents/me/migrations/${id2}`);
73669
+ if (ticket.status === "cancelled") {
73670
+ throw new CliUsageError("This migration was cancelled; nothing was uploaded.");
73671
+ }
73672
+ const found = await transcriptOf({ context, ticket });
73673
+ if (!found.path) {
73674
+ throw new CliUsageError(
73675
+ `The transcript of session ${found.sessionId} was not found under ${found.where}; nothing was uploaded.`
73676
+ );
73677
+ }
73678
+ const raw = await readFile16(found.path, "utf8");
73679
+ if (!raw.trim()) throw new CliUsageError(`${found.path} is empty; nothing was uploaded.`);
73680
+ const redacted = await redactTranscript({ text: raw });
73681
+ const { parts, truncated } = transcriptPartsOf({
73682
+ text: redacted.text,
73683
+ maxBytes: Math.min(ticket.partMaxBytes, MIGRATION_PART_MAX_BYTES),
73684
+ maxParts: Math.min(ticket.partsMax, MIGRATION_PARTS_MAX)
73685
+ });
73686
+ const upload = { parts, truncated, redactions: redacted.redactions };
73687
+ await uploadParts({ client, migrationId: id2, upload });
73688
+ const fileName = basename4(found.path);
73689
+ const completed = await client.post(
73690
+ `/api/agents/me/migrations/${id2}/complete`,
73691
+ {
73692
+ parts: parts.length,
73693
+ sha256: sha256Of({ text: parts.join("") }),
73694
+ truncated,
73695
+ sessionId: found.sessionId,
73696
+ ...FILE_NAME2.test(fileName) ? { fileName } : {},
73697
+ localRedactions: redacted.redactions
73698
+ }
73699
+ );
73700
+ if (args.flags.json) context.out(`${JSON.stringify(completed, null, 2)}
73701
+ `);
73702
+ return {
73703
+ link: completed.link,
73704
+ agentName: completed.migration.agentName,
73705
+ sent: `Uploaded ${fileName} in ${parts.length} part${parts.length === 1 ? "" : "s"}${truncated ? ", only its newest lines (it was over the cap)" : ""}; ${redacted.redactions} secret${redacted.redactions === 1 ? "" : "s"} removed on this machine.`
73706
+ };
73707
+ }
73708
+ function linkIn(text2) {
73709
+ return /https?:\/\/[^\s)]+[^\s).,]/.exec(text2)?.[0] ?? null;
73710
+ }
73711
+ async function uploadMigration({ context, args }) {
73712
+ const { client, name: name3, profile } = await agentHere({ context, args });
73713
+ const moved = await uploadTranscript({ context, args, client }).catch((error62) => {
73714
+ const migrated = migratedNoticeOf(error62);
73715
+ if (!migrated) throw error62;
73716
+ const link = migrated.link ?? linkIn(migrated.notice);
73717
+ return { link: link ?? "", agentName: profile.name, sent: void 0 };
73718
+ });
73719
+ const notice = moved.link ? `Moved to Laze: ${moved.link}` : "Moved to Laze.";
73720
+ await context.store.markMigrated({
73721
+ name: name3,
73722
+ migrated: { at: context.nowMs(), link: moved.link || null, notice }
73723
+ });
73724
+ if (args.flags.json) return;
73725
+ context.out(
73726
+ [
73727
+ notice,
73728
+ ...moved.sent ? [moved.sent] : [],
73729
+ `Laze runs ${moved.agentName} from now on. Stop working in this session now: tell your person the agent continues in Laze at the link above, and answer nothing more here.`,
73730
+ ""
73731
+ ].join("\n")
73732
+ );
73733
+ }
73734
+ var SUBCOMMANDS = {
73735
+ status: migrationStatus,
73736
+ cancel: cancelMigration,
73737
+ upload: uploadMigration
73738
+ };
73739
+ async function agentMigrate({ context, args }) {
73740
+ const sub = SUBCOMMANDS[args.words[2] ?? ""];
73741
+ if (sub && args.words[3]) return sub({ context, args });
73742
+ if (sub || !args.words[2]) throw new CliUsageError(`Usage: ${MIGRATE_USAGE}`);
73743
+ return migrate({ context, args });
73744
+ }
73745
+
72937
73746
  // src/services/agent-session-commands.service.ts
72938
73747
  var NO_SESSION = "Run this inside the Claude Code or Codex session the agent should listen in, or pass --session <id>.";
72939
73748
  var NO_AGENT = "This session and its folder have no agent: name one with `laze agent bind --profile <name>`.";
@@ -72942,7 +73751,7 @@ async function bindAgentSession({
72942
73751
  context,
72943
73752
  args
72944
73753
  }) {
72945
- refuseInSubagent({ context, args });
73754
+ await refuseInSubagent({ context, args, command: /\bagent\s+bind\b/ });
72946
73755
  const session = await currentSessionOf({ context, args });
72947
73756
  if (!session) throw new CliUsageError(NO_SESSION);
72948
73757
  const key = sessionKeyOf({ session });
@@ -73088,8 +73897,8 @@ async function requestAgent({ context, args }) {
73088
73897
  }
73089
73898
 
73090
73899
  // src/services/app-commands.service.ts
73091
- import { mkdir as mkdir16, readdir as readdir6, readFile as readFile17, writeFile as writeFile16 } from "node:fs/promises";
73092
- import { dirname as dirname16, join as join19, relative as relative3, resolve as resolve6, sep as sep3 } from "node:path";
73900
+ import { mkdir as mkdir16, readdir as readdir6, readFile as readFile18, writeFile as writeFile16 } from "node:fs/promises";
73901
+ import { dirname as dirname16, join as join20, relative as relative3, resolve as resolve6, sep as sep3 } from "node:path";
73093
73902
 
73094
73903
  // ../../modules/app/contract/src/app.connections.ts
73095
73904
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -73250,6 +74059,8 @@ var appSchemaDefinition = external_exports.object({
73250
74059
  archivedAt: external_exports.iso.datetime().nullable().optional(),
73251
74060
  /** The reader's role in the app; absent where the app is read without a reader. */
73252
74061
  role: appRoleSchema.nullable().optional(),
74062
+ /** The agent that built it, a Builder by standing; null or absent when a person did. */
74063
+ creatorAgentId: external_exports.string().nullable().optional(),
73253
74064
  createdAt: external_exports.iso.datetime(),
73254
74065
  updatedAt: external_exports.iso.datetime()
73255
74066
  });
@@ -73347,7 +74158,9 @@ var createAppInputSchemaDefinition = external_exports.object({
73347
74158
  slug: appSlugSchema.optional(),
73348
74159
  channelId: external_exports.string().min(1).optional(),
73349
74160
  /** Restricted unless chosen: owner, admins, shares and the conversations it is pinned to. */
73350
- visibility: appVisibilitySchema.default("restricted")
74161
+ visibility: appVisibilitySchema.default("restricted"),
74162
+ /** The agent a person hands the new app to, which becomes its creator and a Builder. */
74163
+ creatorAgentId: external_exports.string().min(1).optional()
73351
74164
  });
73352
74165
  var createAppInputSchema = createAppInputSchemaDefinition;
73353
74166
  var listAppsInputSchemaDefinition = external_exports.object({
@@ -73762,15 +74575,18 @@ var appAccessRequestSchemaDefinition = external_exports.object({
73762
74575
  role: appRoleSchema.nullable(),
73763
74576
  decidedBy: appActorSchema.nullable(),
73764
74577
  createdAt: external_exports.iso.datetime(),
73765
- decidedAt: external_exports.iso.datetime().nullable()
74578
+ decidedAt: external_exports.iso.datetime().nullable(),
74579
+ /** `agent` for an agent's request, whose `userId` and `userName` are then the agent's. */
74580
+ subjectType: external_exports.enum(["user", "agent"]).optional()
73766
74581
  });
73767
74582
  var appAccessRequestSchema = appAccessRequestSchemaDefinition;
73768
74583
  var appMemberSourceSchemaDefinition = external_exports.object({
73769
- kind: external_exports.enum(["owner", "admin", "direct", "channel", "workspace", "agent-owner"]),
74584
+ /** `agent-owner` is no longer sent; older clients still read it. */
74585
+ kind: external_exports.enum(["owner", "creator", "admin", "direct", "channel", "workspace", "agent-owner"]),
73770
74586
  /** The channel, for `channel`: a pin there, a share with it, or the app's own channel. */
73771
74587
  channelId: external_exports.string().nullable(),
73772
74588
  channelName: external_exports.string().nullable(),
73773
- /** The person an agent holds the app through, for `agent-owner`. */
74589
+ /** Unused since agents stopped holding apps through their owner; always null. */
73774
74590
  ownerName: external_exports.string().nullable()
73775
74591
  });
73776
74592
  var appMemberSchemaDefinition = external_exports.object({
@@ -73794,6 +74610,31 @@ var appAccessPinSchemaDefinition = external_exports.object({
73794
74610
  name: external_exports.string().nullable(),
73795
74611
  role: appRoleSchema
73796
74612
  });
74613
+ var appAgentAccessPathSchemaDefinition = external_exports.object({
74614
+ kind: external_exports.enum(["channel", "direct"]),
74615
+ /** The channel, for `channel`. */
74616
+ channelId: external_exports.string().nullable(),
74617
+ channelName: external_exports.string().nullable(),
74618
+ /** The highest role approving gives: the owner's own, or the channel's. */
74619
+ maxRole: appRoleSchema
74620
+ });
74621
+ var appAgentAccessRequestSchemaDefinition = external_exports.object({
74622
+ id: external_exports.string().min(1),
74623
+ appId: external_exports.string().min(1),
74624
+ appName: external_exports.string(),
74625
+ agentId: external_exports.string().min(1),
74626
+ agentName: external_exports.string().nullable(),
74627
+ /** The agent's owner, who answers it. */
74628
+ approverUserId: external_exports.string().min(1),
74629
+ approverName: external_exports.string().nullable(),
74630
+ status: external_exports.enum(["pending", "granted", "declined"]),
74631
+ /** The role approving gave; null while pending or when declined. */
74632
+ role: appRoleSchema.nullable(),
74633
+ /** While pending, how approving would add the agent; once granted, how it did. */
74634
+ path: appAgentAccessPathSchemaDefinition.nullable(),
74635
+ createdAt: external_exports.iso.datetime(),
74636
+ decidedAt: external_exports.iso.datetime().nullable()
74637
+ });
73797
74638
  var appAccessSchemaDefinition = external_exports.object({
73798
74639
  appId: external_exports.string().min(1),
73799
74640
  visibility: appVisibilitySchema,
@@ -73806,6 +74647,8 @@ var appAccessSchemaDefinition = external_exports.object({
73806
74647
  pins: external_exports.array(appAccessPinSchemaDefinition).default([]),
73807
74648
  /** Pending requests, to the app's Builders; empty for anyone else. */
73808
74649
  requests: external_exports.array(appAccessRequestSchemaDefinition),
74650
+ /** Pending requests of the reader's own agents; empty for anyone else. */
74651
+ agentRequests: external_exports.array(appAgentAccessRequestSchemaDefinition).default([]),
73809
74652
  /** The reader's own role. */
73810
74653
  role: appRoleSchema,
73811
74654
  /** The workspace's name, for "Everyone in <workspace>". */
@@ -73865,8 +74708,14 @@ var pendingAppAccessSchemaDefinition = external_exports.object({
73865
74708
  appName: external_exports.string(),
73866
74709
  /** The role a grant from the feed card gives. */
73867
74710
  memberRole: appRoleSchema,
73868
- /** The Builders who answer it. */
73869
- builderUserIds: external_exports.array(external_exports.string())
74711
+ /** The Builders who answer it; for an agent's request, the agent's owner only. */
74712
+ builderUserIds: external_exports.array(external_exports.string()),
74713
+ /** Set for an agent's request: whose it is and how approving adds it. */
74714
+ agent: external_exports.object({
74715
+ id: external_exports.string().min(1),
74716
+ name: external_exports.string().nullable(),
74717
+ path: appAgentAccessPathSchemaDefinition.nullable()
74718
+ }).nullable().optional()
73870
74719
  });
73871
74720
  var visibilityOutcomeSchemaDefinition = external_exports.object({
73872
74721
  app: appSchema,
@@ -74557,7 +75406,7 @@ var appCliCommands = [
74557
75406
  command: "laze app members",
74558
75407
  operation: "listMembers",
74559
75408
  arguments: ["[app]"],
74560
- summary: "Everyone who can open the app, people and agents, each with how: Owner, Shared directly, via #channel or the workspace"
75409
+ summary: "Everyone who can open the app, people and agents, each with how: Owner, Creator, Shared directly, via #channel or the workspace"
74561
75410
  },
74562
75411
  {
74563
75412
  command: "laze app access",
@@ -74593,13 +75442,19 @@ var appCliCommands = [
74593
75442
  command: "laze app access pin-role",
74594
75443
  operation: "setPinRole",
74595
75444
  arguments: ["<channel-id>", "viewer|editor|builder"],
74596
- summary: "The role a conversation the app is pinned in gives its members and their agents (default builder)"
75445
+ summary: "The role a conversation the app is pinned in gives its members, people and agents (default builder)"
74597
75446
  },
74598
75447
  {
74599
75448
  command: "laze app access approve",
74600
75449
  operation: "decideAccessRequest",
74601
75450
  arguments: ["<request-id>", "[viewer|editor|builder]"],
74602
- summary: "Let in someone who asked for access (laze app access decline <request-id> refuses)"
75451
+ summary: "Let in someone who asked for access, or your own agent (laze app access decline <request-id> refuses)"
75452
+ },
75453
+ {
75454
+ command: "laze app request",
75455
+ operation: "requestAgentAccess",
75456
+ arguments: ["[app]"],
75457
+ summary: "As an agent that cannot open the app, ask your owner for access; they approve it in Laze"
74603
75458
  },
74604
75459
  {
74605
75460
  command: "laze app cost",
@@ -75479,16 +76334,16 @@ function print({
75479
76334
  async function appConnections({
75480
76335
  context,
75481
76336
  args,
75482
- open: open3
76337
+ open: open4
75483
76338
  }) {
75484
- const { client, appId, name: name3 } = await open3();
76339
+ const { client, appId, name: name3 } = await open4();
75485
76340
  const listed = await client.post("/api/apps/connections", { appId });
75486
76341
  print({ context, args, value: listed, text: connectionsText({ name: name3, listed }) });
75487
76342
  }
75488
76343
  async function appConnection({
75489
76344
  context,
75490
76345
  args,
75491
- open: open3
76346
+ open: open4
75492
76347
  }) {
75493
76348
  const [, , verb, connection] = args.words;
75494
76349
  if (verb !== "allow" && verb !== "revoke" || !connection) {
@@ -75497,7 +76352,7 @@ async function appConnection({
75497
76352
  if (verb) throw new CliUsageError(USAGE2);
75498
76353
  return;
75499
76354
  }
75500
- const { client, appId, name: name3 } = await open3();
76355
+ const { client, appId, name: name3 } = await open4();
75501
76356
  const listed = await client.post(`/api/apps/connections/${verb}`, { appId, connection }).catch((error62) => {
75502
76357
  if (!(error62 instanceof LazeApiError) || error62.code !== "permission_denied") throw error62;
75503
76358
  throw new CliUsageError(
@@ -75526,40 +76381,40 @@ function appAndWord({ args, usage }) {
75526
76381
  if (!word3) throw new CliUsageError(usage);
75527
76382
  return { app: app2, word: word3 };
75528
76383
  }
75529
- var rename4 = async ({ context, args, open: open3 }) => {
76384
+ var rename4 = async ({ context, args, open: open4 }) => {
75530
76385
  const { app: app2, word: word3 } = appAndWord({ args, usage: "Usage: laze app rename [app] <new name>" });
75531
- const { client, appId, name: name3 } = await open3(app2);
76386
+ const { client, appId, name: name3 } = await open4(app2);
75532
76387
  const renamed = await client.post("/api/apps/rename", { appId, name: word3 });
75533
76388
  print2({ context, args, value: renamed, text: `${name3} is now called ${renamed.name}.
75534
76389
  ` });
75535
76390
  };
75536
- var archive = async ({ context, args, open: open3 }) => {
75537
- const { client, appId } = await open3(args.words[2]);
76391
+ var archive = async ({ context, args, open: open4 }) => {
76392
+ const { client, appId } = await open4(args.words[2]);
75538
76393
  const archived = await client.post("/api/apps/archive", { appId });
75539
76394
  const text2 = `Archived ${archived.name}: it serves nothing and keeps its versions and data. laze app unarchive brings it back.
75540
76395
  `;
75541
76396
  print2({ context, args, value: archived, text: text2 });
75542
76397
  };
75543
- var unarchive = async ({ context, args, open: open3 }) => {
75544
- const { client, appId } = await open3(args.words[2]);
76398
+ var unarchive = async ({ context, args, open: open4 }) => {
76399
+ const { client, appId } = await open4(args.words[2]);
75545
76400
  const back = await client.post("/api/apps/unarchive", { appId });
75546
76401
  const text2 = `${back.name} is back at the same addresses.
75547
76402
  `;
75548
76403
  print2({ context, args, value: back, text: text2 });
75549
76404
  };
75550
- var remove = async ({ context, args, open: open3 }) => {
76405
+ var remove = async ({ context, args, open: open4 }) => {
75551
76406
  const confirmName = flagText({ args, name: "confirm" });
75552
76407
  if (!confirmName) {
75553
76408
  throw new CliUsageError("Usage: laze app delete [app] --confirm <the app's name>");
75554
76409
  }
75555
- const { client, appId, name: name3 } = await open3(args.words[2]);
76410
+ const { client, appId, name: name3 } = await open4(args.words[2]);
75556
76411
  await client.post("/api/apps/delete", { appId, confirmName });
75557
76412
  const text2 = `Deleted ${name3}: it stopped serving and is gone from the workspace.
75558
76413
  `;
75559
76414
  print2({ context, args, value: { deleted: appId }, text: text2 });
75560
76415
  };
75561
- var revokeLease = async ({ context, args, open: open3 }) => {
75562
- const { client, appId, name: name3 } = await open3(args.words[2]);
76416
+ var revokeLease = async ({ context, args, open: open4 }) => {
76417
+ const { client, appId, name: name3 } = await open4(args.words[2]);
75563
76418
  const app2 = await client.post("/api/apps/publish/revoke-lease", { appId });
75564
76419
  const text2 = `${name3}'s builder asks for an approval again before its next public publish.
75565
76420
  `;
@@ -75587,18 +76442,18 @@ function backupsText({ name: name3, status: status9 }) {
75587
76442
  return `${name3}: ${replicating} ${window2}
75588
76443
  ${restores.join("")}`;
75589
76444
  }
75590
- var backups = async ({ context, args, open: open3 }) => {
75591
- const { client, appId, name: name3 } = await open3(args.words[2]);
76445
+ var backups = async ({ context, args, open: open4 }) => {
76446
+ const { client, appId, name: name3 } = await open4(args.words[2]);
75592
76447
  const status9 = await client.post("/api/apps/backups", { appId });
75593
76448
  print2({ context, args, value: status9, text: backupsText({ name: name3, status: status9 }) });
75594
76449
  };
75595
- var restore = async ({ context, args, open: open3 }) => {
76450
+ var restore = async ({ context, args, open: open4 }) => {
75596
76451
  const to = flagText({ args, name: "to" });
75597
76452
  const undo = flagText({ args, name: "undo" });
75598
76453
  if (Boolean(to) === Boolean(undo)) {
75599
76454
  throw new CliUsageError("Usage: laze app restore [app] --to <ISO time> | --undo <restore-id>");
75600
76455
  }
75601
- const { client, appId, name: name3 } = await open3(args.words[2]);
76456
+ const { client, appId, name: name3 } = await open4(args.words[2]);
75602
76457
  const done = await client.post("/api/apps/backups/restore", {
75603
76458
  appId,
75604
76459
  ...to ? { to } : { undo }
@@ -75624,16 +76479,16 @@ function usersText({ name: name3, users: users2 }) {
75624
76479
  return `${name3}'s app users:
75625
76480
  ${lines2.join("")}`;
75626
76481
  }
75627
- var users = async ({ context, args, open: open3 }) => {
75628
- const { client, appId, name: name3 } = await open3(args.words[2]);
76482
+ var users = async ({ context, args, open: open4 }) => {
76483
+ const { client, appId, name: name3 } = await open4(args.words[2]);
75629
76484
  const listed = await client.post("/api/apps/users", { appId });
75630
76485
  print2({ context, args, value: listed, text: usersText({ name: name3, users: listed }) });
75631
76486
  };
75632
76487
  function blocking(blocked) {
75633
- return async ({ context, args, open: open3 }) => {
76488
+ return async ({ context, args, open: open4 }) => {
75634
76489
  const verb = blocked ? "block-user" : "unblock-user";
75635
76490
  const { app: app2, word: word3 } = appAndWord({ args, usage: `Usage: laze app ${verb} [app] <user-id>` });
75636
- const { client, appId, name: name3 } = await open3(app2);
76491
+ const { client, appId, name: name3 } = await open4(app2);
75637
76492
  const listed = await client.post("/api/apps/users/block", {
75638
76493
  appId,
75639
76494
  userId: word3,
@@ -75642,9 +76497,9 @@ function blocking(blocked) {
75642
76497
  print2({ context, args, value: listed, text: usersText({ name: name3, users: listed }) });
75643
76498
  };
75644
76499
  }
75645
- var deleteUser = async ({ context, args, open: open3 }) => {
76500
+ var deleteUser = async ({ context, args, open: open4 }) => {
75646
76501
  const { app: app2, word: word3 } = appAndWord({ args, usage: "Usage: laze app delete-user [app] <user-id>" });
75647
- const { client, appId, name: name3 } = await open3(app2);
76502
+ const { client, appId, name: name3 } = await open4(app2);
75648
76503
  const gone = await client.post("/api/apps/users/delete", { appId, userId: word3 });
75649
76504
  const text2 = `Deleted ${gone.userId} from ${name3} with the ${gone.removedRecords.toString()} records they owned.
75650
76505
  `;
@@ -75717,10 +76572,10 @@ async function appPinCommand({
75717
76572
  context,
75718
76573
  args,
75719
76574
  verb,
75720
- open: open3
76575
+ open: open4
75721
76576
  }) {
75722
76577
  const channel = flagText({ args, name: "channel" });
75723
- const { client, appId, name: name3 } = await open3();
76578
+ const { client, appId, name: name3 } = await open4();
75724
76579
  const role2 = verb === "pin" ? pinRoleOf(args) : void 0;
75725
76580
  const listed = await client.post(`/api/apps/${verb}`, {
75726
76581
  appId,
@@ -75756,7 +76611,7 @@ async function appPinsCommand({
75756
76611
  import { execFile } from "node:child_process";
75757
76612
  import { mkdtemp, rm as rm8, writeFile as writeFile15 } from "node:fs/promises";
75758
76613
  import { tmpdir } from "node:os";
75759
- import { join as join17 } from "node:path";
76614
+ import { join as join18 } from "node:path";
75760
76615
  import { promisify } from "node:util";
75761
76616
  var run2 = promisify(execFile);
75762
76617
  var MODULE_SYNTAX = /^\s*(import|export)\s/m;
@@ -75785,11 +76640,11 @@ async function scriptErrorsOf({
75785
76640
  const unknown2 = unknownCollectionsOf({ files: files2, collections });
75786
76641
  const scripts = files2.flatMap(scriptsOf);
75787
76642
  if (scripts.length === 0) return unknown2;
75788
- const dir = await mkdtemp(join17(tmpdir(), "laze-app-check-"));
76643
+ const dir = await mkdtemp(join18(tmpdir(), "laze-app-check-"));
75789
76644
  try {
75790
76645
  const errors = await Promise.all(
75791
76646
  scripts.map(async (script, index) => {
75792
- const file3 = join17(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
76647
+ const file3 = join18(dir, `${index}.${script.module ? "mjs" : "cjs"}`);
75793
76648
  await writeFile15(file3, script.code);
75794
76649
  try {
75795
76650
  await run2(process.execPath, ["--check", file3]);
@@ -75807,9 +76662,9 @@ async function scriptErrorsOf({
75807
76662
  }
75808
76663
 
75809
76664
  // src/services/app-serve.service.ts
75810
- import { readFile as readFile16, stat as stat5 } from "node:fs/promises";
76665
+ import { readFile as readFile17, stat as stat6 } from "node:fs/promises";
75811
76666
  import { createServer } from "node:http";
75812
- import { extname as extname2, join as join18, normalize, sep as sep2 } from "node:path";
76667
+ import { extname as extname2, join as join19, normalize, sep as sep2 } from "node:path";
75813
76668
  var TYPES = {
75814
76669
  ".html": "text/html; charset=utf-8",
75815
76670
  ".js": "text/javascript; charset=utf-8",
@@ -75860,13 +76715,13 @@ async function staticFile({
75860
76715
  if (clean.startsWith("..") || hidden) {
75861
76716
  return json2({ response, status: 404, value: { code: "not_found", message: "Not found" } });
75862
76717
  }
75863
- const candidates = [join18(folder, clean), join18(folder, clean, "index.html")];
75864
- if (!extname2(clean)) candidates.push(join18(folder, "index.html"));
76718
+ const candidates = [join19(folder, clean), join19(folder, clean, "index.html")];
76719
+ if (!extname2(clean)) candidates.push(join19(folder, "index.html"));
75865
76720
  for (const target of candidates) {
75866
- const info = await stat5(target).catch(() => void 0);
76721
+ const info = await stat6(target).catch(() => void 0);
75867
76722
  if (!info?.isFile()) continue;
75868
76723
  const type = TYPES[extname2(target).toLowerCase()] ?? "application/octet-stream";
75869
- const body = await readFile16(target);
76724
+ const body = await readFile17(target);
75870
76725
  if (extname2(target) === ".html") {
75871
76726
  return send2({ response, status: 200, type, body: withServeThemeScript(body.toString()) });
75872
76727
  }
@@ -76012,26 +76867,26 @@ function print4({
76012
76867
  context.out(args.flags.json ? `${JSON.stringify(value, null, 2)}
76013
76868
  ` : text2);
76014
76869
  }
76015
- async function add({ context, args, open: open3, word: word3 }) {
76870
+ async function add({ context, args, open: open4, word: word3 }) {
76016
76871
  const prompt = flagText({ args, name: "prompt" }).trim();
76017
76872
  if (!prompt) throw new CliUsageError("--prompt says what the agent does with the records");
76018
76873
  const body = { collection: word3, on: onOf(args), where: whereOf3(args), prompt };
76019
- const { client, appId, name: name3 } = await open3();
76874
+ const { client, appId, name: name3 } = await open4();
76020
76875
  const trigger = await client.post("/api/apps/triggers/add", { appId, ...body });
76021
76876
  const text2 = `Added a trigger on ${name3}:
76022
76877
  ${triggerLine(trigger)}Matching changes to ${word3} records wake ${trigger.agentName} in ${trigger.channelName}.
76023
76878
  `;
76024
76879
  print4({ context, args, value: trigger, text: text2 });
76025
76880
  }
76026
- async function list({ context, args, open: open3 }) {
76027
- const { client, appId, name: name3 } = await open3();
76881
+ async function list({ context, args, open: open4 }) {
76882
+ const { client, appId, name: name3 } = await open4();
76028
76883
  const listed = await client.post("/api/apps/triggers", { appId });
76029
76884
  const text2 = listed.triggers.length === 0 ? `${name3} has no triggers. laze app trigger add <collection> adds one.
76030
76885
  ` : listed.triggers.map(triggerLine).join("");
76031
76886
  print4({ context, args, value: listed, text: text2 });
76032
76887
  }
76033
- async function setPaused({ context, args, open: open3, word: word3, paused }) {
76034
- const { client, appId } = await open3();
76888
+ async function setPaused({ context, args, open: open4, word: word3, paused }) {
76889
+ const { client, appId } = await open4();
76035
76890
  const trigger = await client.post("/api/apps/triggers/pause", {
76036
76891
  appId,
76037
76892
  triggerId: word3,
@@ -76039,8 +76894,8 @@ async function setPaused({ context, args, open: open3, word: word3, paused }) {
76039
76894
  });
76040
76895
  print4({ context, args, value: trigger, text: triggerLine(trigger) });
76041
76896
  }
76042
- async function remove2({ context, args, open: open3, word: word3 }) {
76043
- const { client, appId } = await open3();
76897
+ async function remove2({ context, args, open: open4, word: word3 }) {
76898
+ const { client, appId } = await open4();
76044
76899
  await client.post("/api/apps/triggers/remove", { appId, triggerId: word3 });
76045
76900
  print4({ context, args, value: { removed: word3 }, text: `Removed trigger ${word3}.
76046
76901
  ` });
@@ -76048,14 +76903,14 @@ async function remove2({ context, args, open: open3, word: word3 }) {
76048
76903
  async function appTrigger({
76049
76904
  context,
76050
76905
  args,
76051
- open: open3
76906
+ open: open4
76052
76907
  }) {
76053
76908
  const [, , verb, word3] = args.words;
76054
- if (verb === "list") return list({ context, args, open: open3 });
76909
+ if (verb === "list") return list({ context, args, open: open4 });
76055
76910
  const known = verb === "add" || verb === "pause" || verb === "resume" || verb === "remove";
76056
76911
  if (known && !word3) throw new CliUsageError(USAGE4);
76057
76912
  if (known && word3) {
76058
- const run4 = { context, args, open: open3, word: word3 };
76913
+ const run4 = { context, args, open: open4, word: word3 };
76059
76914
  if (verb === "add") return add(run4);
76060
76915
  if (verb === "remove") return remove2(run4);
76061
76916
  return setPaused({ ...run4, paused: verb === "pause" });
@@ -76099,7 +76954,7 @@ async function turnTokenOf({
76099
76954
  const pinned = env.LAZE_TURN_TOKEN?.trim();
76100
76955
  if (pinned) return pinned;
76101
76956
  if (env.LAZE_TURN_FILE) {
76102
- return readFile17(env.LAZE_TURN_FILE, "utf8").then(
76957
+ return readFile18(env.LAZE_TURN_FILE, "utf8").then(
76103
76958
  (text2) => text2.trim(),
76104
76959
  () => ""
76105
76960
  );
@@ -76129,7 +76984,7 @@ function folderOf({ context, word: word3 }) {
76129
76984
  return resolve6(context.cwd, word3 ?? ".");
76130
76985
  }
76131
76986
  async function readManifest(folder) {
76132
- const text2 = await readFile17(join19(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
76987
+ const text2 = await readFile18(join20(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
76133
76988
  if (text2 === void 0) return void 0;
76134
76989
  const parsed = appManifestSchema.safeParse(JSON.parse(text2));
76135
76990
  if (!parsed.success) {
@@ -76164,7 +77019,7 @@ async function jsonFlag({
76164
77019
  }) {
76165
77020
  const raw = flagText({ args, name: name3 });
76166
77021
  if (!raw) return void 0;
76167
- const text2 = raw.startsWith("@") ? await readFile17(resolve6(context.cwd, raw.slice(1)), "utf8") : raw;
77022
+ const text2 = raw.startsWith("@") ? await readFile18(resolve6(context.cwd, raw.slice(1)), "utf8") : raw;
76168
77023
  try {
76169
77024
  return JSON.parse(text2);
76170
77025
  } catch {
@@ -76177,7 +77032,7 @@ async function listFiles(folder) {
76177
77032
  while (pending2.length > 0 && found.length <= MAX_FILES) {
76178
77033
  const current2 = pending2.pop() ?? folder;
76179
77034
  for (const entry of await readdir6(current2, { withFileTypes: true })) {
76180
- const path = join19(current2, entry.name);
77035
+ const path = join20(current2, entry.name);
76181
77036
  const rel = relative3(folder, path).split(sep3).join("/");
76182
77037
  if (isSkippedPath({ path: rel })) continue;
76183
77038
  if (entry.isDirectory()) pending2.push(path);
@@ -76221,8 +77076,8 @@ var appCreate = async ({ context, args }) => {
76221
77076
  await mkdir16(folder, { recursive: true });
76222
77077
  const files2 = template ? templateFiles({ template, name: name3 }) : {};
76223
77078
  for (const [path, content] of Object.entries(files2)) {
76224
- await mkdir16(dirname16(join19(folder, path)), { recursive: true });
76225
- await writeFile16(join19(folder, path), content);
77079
+ await mkdir16(dirname16(join20(folder, path)), { recursive: true });
77080
+ await writeFile16(join20(folder, path), content);
76226
77081
  }
76227
77082
  const manifest = {
76228
77083
  app: { id: app2.id, name: app2.name, slug: app2.slug },
@@ -76230,7 +77085,7 @@ var appCreate = async ({ context, args }) => {
76230
77085
  views: template?.views ? [...template.views] : [],
76231
77086
  seed: template ? { ...template.seed } : {}
76232
77087
  };
76233
- await writeFile16(join19(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
77088
+ await writeFile16(join20(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
76234
77089
  `);
76235
77090
  print5({
76236
77091
  context,
@@ -76245,6 +77100,11 @@ var appList = async ({ context, args }) => {
76245
77100
  const client = await appClient({ context, args });
76246
77101
  const apps = await client.get("/api/apps");
76247
77102
  const lines2 = apps.map((app2) => {
77103
+ if (app2.role === null) {
77104
+ const owner = app2.ownerName ? `, ${app2.ownerName}'s` : "";
77105
+ return `${app2.slug} ${app2.id} no access${owner}: laze app request ${app2.slug} asks your owner
77106
+ `;
77107
+ }
76248
77108
  const state = app2.publishedVersion ? `live (${app2.visibility})` : "not live";
76249
77109
  return `${app2.slug} ${app2.id} ${state} ${app2.publishedUrl}
76250
77110
  `;
@@ -76267,7 +77127,7 @@ var appPush = async ({ context, args }) => {
76267
77127
  paths.map(
76268
77128
  async (path) => buildFileOf({
76269
77129
  path: relative3(folder, path).split(sep3).join("/"),
76270
- bytes: await readFile17(path)
77130
+ bytes: await readFile18(path)
76271
77131
  })
76272
77132
  )
76273
77133
  );
@@ -76425,7 +77285,7 @@ var appPull = async ({ context, args }) => {
76425
77285
  );
76426
77286
  }
76427
77287
  for (const file3 of pulled.files) {
76428
- const target = join19(folder, ...file3.path.split("/"));
77288
+ const target = join20(folder, ...file3.path.split("/"));
76429
77289
  await mkdir16(dirname16(target), { recursive: true });
76430
77290
  await writeFile16(
76431
77291
  target,
@@ -76444,7 +77304,7 @@ var appPull = async ({ context, args }) => {
76444
77304
  ])
76445
77305
  )
76446
77306
  };
76447
- await writeFile16(join19(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
77307
+ await writeFile16(join20(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
76448
77308
  `);
76449
77309
  const names = pulled.collections.map((collection) => collection.name);
76450
77310
  const where = relative3(context.cwd, folder) || ".";
@@ -76748,7 +77608,7 @@ var appImport = async ({ context, args }) => {
76748
77608
  const words = args.words.slice(2);
76749
77609
  const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
76750
77610
  if (!collection || !file3) throw new CliUsageError(USAGE5);
76751
- const csv = await readFile17(resolve6(context.cwd, file3), "utf8").catch(() => {
77611
+ const csv = await readFile18(resolve6(context.cwd, file3), "utf8").catch(() => {
76752
77612
  throw new CliUsageError(`Cannot read ${file3}`);
76753
77613
  });
76754
77614
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
@@ -76827,6 +77687,13 @@ function subjectOf(word3) {
76827
77687
  }
76828
77688
  return { type, id: id2 };
76829
77689
  }
77690
+ function agentPathText(path) {
77691
+ if (!path) return "you cannot open the app yourself, so you cannot let it in";
77692
+ if (path.kind === "channel") {
77693
+ return `approving adds it to ${path.channelName ?? path.channelId ?? "your channel"} as ${ROLE_NAMES[path.maxRole]}`;
77694
+ }
77695
+ return `approving shares the app with it as ${ROLE_NAMES[path.maxRole]} at most`;
77696
+ }
76830
77697
  function accessText(access) {
76831
77698
  const lines2 = [
76832
77699
  `Visibility: ${access.visibility}. Everyone it admits is ${ROLE_NAMES[access.memberRole]}.`,
@@ -76839,6 +77706,9 @@ function accessText(access) {
76839
77706
  ),
76840
77707
  ...access.requests.map(
76841
77708
  (request2) => ` asks for access: ${request2.userName ?? request2.userId} (${request2.id})`
77709
+ ),
77710
+ ...(access.agentRequests ?? []).map(
77711
+ (request2) => ` your agent ${request2.agentName ?? request2.agentId} asks for access (${request2.id}): ${agentPathText(request2.path)}`
76842
77712
  )
76843
77713
  ];
76844
77714
  return `${lines2.join("\n")}
@@ -76928,6 +77798,8 @@ function sourceText(source) {
76928
77798
  switch (source.kind) {
76929
77799
  case "owner":
76930
77800
  return "Owner";
77801
+ case "creator":
77802
+ return "Creator";
76931
77803
  case "admin":
76932
77804
  return "Workspace admin";
76933
77805
  case "direct":
@@ -76974,6 +77846,26 @@ var appAccess = async ({ context, args }) => {
76974
77846
  if (!run4) throw new CliUsageError(USAGE5);
76975
77847
  print5({ context, args, ...await run4({ client, appId, first, second }) });
76976
77848
  };
77849
+ var appRequest = async ({ context, args }) => {
77850
+ const scoped = args.words[2] ? { ...args, flags: { ...args.flags, app: args.words[2] } } : args;
77851
+ const client = await appClient({ context, args: scoped });
77852
+ const appId = await appIdOf({
77853
+ client,
77854
+ args: scoped,
77855
+ folder: folderOf({ context, word: void 0 })
77856
+ });
77857
+ const request2 = await client.post("/api/apps/access/request", {
77858
+ appId
77859
+ });
77860
+ const owner = request2.approverName ?? "your owner";
77861
+ print5({
77862
+ context,
77863
+ args,
77864
+ value: request2,
77865
+ text: `Asked ${owner} for access to ${request2.appName} (${request2.id}); ${agentPathText(request2.path)}. Run laze app list to see when it opens.
77866
+ `
77867
+ });
77868
+ };
76977
77869
  var appUnpublish = async ({ context, args }) => {
76978
77870
  const client = await appClient({ context, args });
76979
77871
  const appId = await appIdOf({ client, args, folder: folderOf({ context, word: void 0 }) });
@@ -76987,21 +77879,21 @@ var appUnpublish = async ({ context, args }) => {
76987
77879
  });
76988
77880
  };
76989
77881
  function costText({ name: name3, cost }) {
76990
- const money2 = (amount) => formatAppMoney({ amount, currency: cost.currency });
77882
+ const money3 = (amount) => formatAppMoney({ amount, currency: cost.currency });
76991
77883
  const month = Temporal3.PlainDate.from(`${cost.month}-01`).toLocaleString("en-GB", {
76992
77884
  month: "long",
76993
77885
  year: "numeric"
76994
77886
  });
76995
77887
  const rows = cost.lines.map((line) => {
76996
77888
  const used = appCostQuantityText(line);
76997
- return ` ${APP_COST_PART_LABELS[line.part].padEnd(16)} ${money2(line.amount).padStart(12)}${used ? ` ${used}` : ""}
77889
+ return ` ${APP_COST_PART_LABELS[line.part].padEnd(16)} ${money3(line.amount).padStart(12)}${used ? ` ${used}` : ""}
76998
77890
  `;
76999
77891
  });
77000
77892
  const { budget: budget2 } = cost;
77001
- const budgetLine = budget2.monthly === null ? "No budget. laze app budget <amount> sets one.\n" : `Budget ${money2(budget2.monthly)} a month, ${Math.round(cost.total / budget2.monthly * 100).toString()}% used.
77893
+ const budgetLine = budget2.monthly === null ? "No budget. laze app budget <amount> sets one.\n" : `Budget ${money3(budget2.monthly)} a month, ${Math.round(cost.total / budget2.monthly * 100).toString()}% used.
77002
77894
  `;
77003
77895
  const paused = budget2.paused ? "Paused: server functions and agent work on this app stop until the budget is raised or the month ends. Pages and records keep working.\n" : "";
77004
- return `${name3} cost ${money2(cost.total)} so far in ${month}, at Laze list prices:
77896
+ return `${name3} cost ${money3(cost.total)} so far in ${month}, at Laze list prices:
77005
77897
  ${rows.join("")}${budgetLine}${paused}`;
77006
77898
  }
77007
77899
  async function appOfWord({
@@ -77058,6 +77950,7 @@ var APP_COMMANDS = {
77058
77950
  unpublish: appUnpublish,
77059
77951
  access: appAccess,
77060
77952
  members: appMembers,
77953
+ request: appRequest,
77061
77954
  name: appName,
77062
77955
  versions: appVersions,
77063
77956
  log: appVersions,
@@ -77256,7 +78149,13 @@ var BILLING_USAGE = `Usage:
77256
78149
  laze billing currency usd|eur bill in USD or EUR, until the first payment (admins)
77257
78150
  laze billing top-up <amount> a Stripe link that adds prepaid credits, 10 or more (admins)
77258
78151
  laze billing auto-recharge on|off [--amount <n>] [--limit <n>] (admins)
77259
- laze billing referral <code> apply another workspace's referral code (admins)`;
78152
+ laze billing referral <code> apply another workspace's referral code (admins)
78153
+ laze billing details the company, address, billing email and tax id on invoices (admins)
78154
+ laze billing details set --company <name> --email <billing email> --line1 <street> --city <city>
78155
+ --country <NL> [--postal <code>] [--line2 <text>] [--state <text>]
78156
+ [--tax-id <NL123456789B01>|none] [--tax-type eu_vat|gb_vat|ch_vat|no_vat|us_ein|au_abn|ca_bn] (admins)
78157
+ laze billing cancel end Team at the end of the paid period (admins)
78158
+ laze billing keep keep Team after a cancellation (admins)`;
77260
78159
  var printJson = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
77261
78160
  `);
77262
78161
  async function plan({ context, args }) {
@@ -77293,8 +78192,14 @@ function printAccount({ context, args }, account) {
77293
78192
  const of = (amount) => money(amount, account.currency);
77294
78193
  const plan2 = account.plan === "team" ? `Team, ${of(account.seats.monthlyPrice)} a month for ${account.seats.people} people` : "Free, for one person";
77295
78194
  const pending2 = account.status === "pending_payment" ? " (payment pending: run laze billing checkout)" : "";
77296
- context.out(`Plan: ${plan2}${pending2}
78195
+ const ending = account.cancelAtPeriodEnd && account.period ? ` (ends ${account.period.end.slice(0, 10)}: run laze billing keep to renew)` : "";
78196
+ context.out(`Plan: ${plan2}${pending2}${ending}
78197
+ `);
78198
+ if (account.paymentIssue) {
78199
+ const link = account.paymentIssue.invoiceUrl ? ` ${account.paymentIssue.invoiceUrl}` : "";
78200
+ context.out(`Payment: ${account.paymentIssue.message ?? account.paymentIssue.kind}${link}
77297
78201
  `);
78202
+ }
77298
78203
  context.out(
77299
78204
  `Credits: ${of(account.credits.includedLeft)} of ${of(account.credits.included)} included left, ${of(account.credits.prepaid)} prepaid${prepaidNoteOf(account, of)}${account.credits.paused ? " (paused: top up to resume)" : ""}
77300
78205
  `
@@ -77323,8 +78228,9 @@ async function invoices({ context, args }) {
77323
78228
  if (list11.length === 0) return context.out("No invoices yet.\n");
77324
78229
  for (const invoice of list11) {
77325
78230
  const link = invoice.hostedUrl ? ` ${invoice.hostedUrl}` : "";
78231
+ const tax = invoice.tax ? ` (tax ${money(invoice.tax, invoice.currency)})` : "";
77326
78232
  context.out(
77327
- `${invoice.createdAt.slice(0, 10)} ${invoice.number ?? "draft"} ${invoice.status} ${money(invoice.total, invoice.currency)}${link}
78233
+ `${invoice.createdAt.slice(0, 10)} ${invoice.number ?? "draft"} ${invoice.status} ${money(invoice.total, invoice.currency)}${tax}${link}
77328
78234
  `
77329
78235
  );
77330
78236
  }
@@ -77387,6 +78293,73 @@ async function referral({ context, args }) {
77387
78293
  await client.post("/api/billing-account/referral", { code })
77388
78294
  );
77389
78295
  }
78296
+ function addressLine(address) {
78297
+ if (!address) return "not set";
78298
+ const town = [address.postalCode, address.city].filter(Boolean).join(" ");
78299
+ return [address.line1, address.line2, town, address.state, address.country].filter(Boolean).join(", ");
78300
+ }
78301
+ function printDetails({ context, args }, details2) {
78302
+ if (args.flags.json) return printJson(context, details2);
78303
+ const taxId = details2.taxId ? `${details2.taxId.value} (${details2.taxId.type}, ${details2.taxId.status})` : "none";
78304
+ context.out(`Company: ${details2.companyName ?? "not set"}
78305
+ `);
78306
+ context.out(`Billing email: ${details2.email ?? "not set"}
78307
+ `);
78308
+ context.out(`Address: ${addressLine(details2.address)}
78309
+ `);
78310
+ context.out(`Tax id: ${taxId}
78311
+ `);
78312
+ if (details2.taxIdRemoved) {
78313
+ context.out(
78314
+ `Removed: ${details2.taxIdRemoved.value}, which the EU VAT service rejected; invoices carry VAT until a valid number is set
78315
+ `
78316
+ );
78317
+ }
78318
+ }
78319
+ var TAX_TYPES = ["eu_vat", "gb_vat", "ch_vat", "no_vat", "us_ein", "au_abn", "ca_bn"];
78320
+ function needed({ args, name: name3 }) {
78321
+ const value = flagText({ args, name: name3 });
78322
+ if (!value) throw new CliUsageError(`--${name3} is needed.
78323
+ ${BILLING_USAGE}`);
78324
+ return value;
78325
+ }
78326
+ function detailsBody({ args }) {
78327
+ const taxText = flagText({ args, name: "tax-id" });
78328
+ const taxType = flagText({ args, name: "tax-type" }) || "eu_vat";
78329
+ if (!TAX_TYPES.includes(taxType)) {
78330
+ throw new CliUsageError(`--tax-type takes ${TAX_TYPES.join(", ")}.
78331
+ ${BILLING_USAGE}`);
78332
+ }
78333
+ return {
78334
+ companyName: needed({ args, name: "company" }),
78335
+ email: needed({ args, name: "email" }),
78336
+ address: {
78337
+ line1: needed({ args, name: "line1" }),
78338
+ line2: flagText({ args, name: "line2" }) || null,
78339
+ city: needed({ args, name: "city" }),
78340
+ postalCode: flagText({ args, name: "postal" }) || null,
78341
+ state: flagText({ args, name: "state" }) || null,
78342
+ country: needed({ args, name: "country" })
78343
+ },
78344
+ taxId: !taxText || taxText === "none" ? null : { type: taxType, value: taxText }
78345
+ };
78346
+ }
78347
+ async function details({ context, args }) {
78348
+ const action = args.words[2];
78349
+ if (action !== void 0 && action !== "set") throw new CliUsageError(BILLING_USAGE);
78350
+ const body = action === "set" ? detailsBody({ args }) : null;
78351
+ const { client } = await signedIn({ context, args });
78352
+ const answer5 = body ? await client.post("/api/billing-account/details", body) : await client.get("/api/billing-account/details");
78353
+ printDetails({ context, args }, answer5);
78354
+ }
78355
+ async function cancel({ context, args }) {
78356
+ const { client } = await signedIn({ context, args });
78357
+ printAccount({ context, args }, await client.post("/api/billing-account/cancel", {}));
78358
+ }
78359
+ async function keep({ context, args }) {
78360
+ const { client } = await signedIn({ context, args });
78361
+ printAccount({ context, args }, await client.post("/api/billing-account/keep", {}));
78362
+ }
77390
78363
  var BILLING_COMMANDS = {
77391
78364
  account: show,
77392
78365
  invoices,
@@ -77395,7 +78368,10 @@ var BILLING_COMMANDS = {
77395
78368
  currency,
77396
78369
  "top-up": topUp,
77397
78370
  "auto-recharge": autoRecharge,
77398
- referral
78371
+ referral,
78372
+ details,
78373
+ cancel,
78374
+ keep
77399
78375
  };
77400
78376
  async function billing({ context, args }) {
77401
78377
  const name3 = args.words[1];
@@ -77407,13 +78383,13 @@ async function billing({ context, args }) {
77407
78383
 
77408
78384
  // src/services/browser-commands.service.ts
77409
78385
  import { randomBytes } from "node:crypto";
77410
- import { mkdir as mkdir19, readFile as readFile19, writeFile as writeFile19 } from "node:fs/promises";
77411
- import { dirname as dirname18, join as join22 } from "node:path";
78386
+ import { mkdir as mkdir19, readFile as readFile20, writeFile as writeFile19 } from "node:fs/promises";
78387
+ import { dirname as dirname18, join as join23 } from "node:path";
77412
78388
 
77413
78389
  // src/services/browser-tab-commands.service.ts
77414
78390
  import { mkdir as mkdir18, writeFile as writeFile18 } from "node:fs/promises";
77415
78391
  import { tmpdir as tmpdir3 } from "node:os";
77416
- import { join as join21 } from "node:path";
78392
+ import { join as join22 } from "node:path";
77417
78393
 
77418
78394
  // src/rules/browser-login.rules.ts
77419
78395
  var PASSWORD_NAME = /pass|pwd/i;
@@ -77443,10 +78419,10 @@ function loginValuesOf({
77443
78419
  }
77444
78420
 
77445
78421
  // src/services/vault-commands.service.ts
77446
- import { createHash as createHash2 } from "node:crypto";
77447
- import { mkdir as mkdir17, readFile as readFile18, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
78422
+ import { createHash as createHash3 } from "node:crypto";
78423
+ import { mkdir as mkdir17, readFile as readFile19, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
77448
78424
  import { tmpdir as tmpdir2 } from "node:os";
77449
- import { dirname as dirname17, join as join20 } from "node:path";
78425
+ import { dirname as dirname17, join as join21 } from "node:path";
77450
78426
  var USAGE6 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
77451
78427
  Runs the command with the connection's values in its environment, on a Laze agent's computer,
77452
78428
  on a machine it runs on, or where a connected agent runs, with its own key.
@@ -77482,7 +78458,7 @@ async function turnTokenOf2({
77482
78458
  if (pinned) return pinned;
77483
78459
  if (!turnFile) throw new CliUsageError(`${command} works only during an agent's turn`);
77484
78460
  try {
77485
- return (await readFile18(turnFile, "utf8")).trim();
78461
+ return (await readFile19(turnFile, "utf8")).trim();
77486
78462
  } catch {
77487
78463
  throw new CliUsageError(`${command} works only during an agent's turn`);
77488
78464
  }
@@ -77492,12 +78468,12 @@ function runKeyPathOf({
77492
78468
  connection,
77493
78469
  profile = ""
77494
78470
  }) {
77495
- const name3 = createHash2("sha256").update(connection).digest("hex");
77496
- const base = turnFile ? dirname17(turnFile) : join20(tmpdir2(), "laze-vault", profile);
77497
- return join20(base, "vault-run-keys", `${name3}.json`);
78471
+ const name3 = createHash3("sha256").update(connection).digest("hex");
78472
+ const base = turnFile ? dirname17(turnFile) : join21(tmpdir2(), "laze-vault", profile);
78473
+ return join21(base, "vault-run-keys", `${name3}.json`);
77498
78474
  }
77499
78475
  async function runKeyAt({ path }) {
77500
- const saved3 = await readFile18(path, "utf8").then(
78476
+ const saved3 = await readFile19(path, "utf8").then(
77501
78477
  (text2) => JSON.parse(text2),
77502
78478
  () => void 0
77503
78479
  );
@@ -78007,9 +78983,9 @@ async function savedScreenshot({
78007
78983
  data,
78008
78984
  nowMs
78009
78985
  }) {
78010
- const folder = join21(tmpdir3(), "laze-browser");
78986
+ const folder = join22(tmpdir3(), "laze-browser");
78011
78987
  await mkdir18(folder, { recursive: true, mode: 448 });
78012
- const path = join21(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
78988
+ const path = join22(folder, `${tabId.replace(/[^a-zA-Z0-9_-]/g, "_")}-login-${nowMs}.jpg`);
78013
78989
  await writeFile18(path, Buffer.from(data, "base64"), { mode: 384 });
78014
78990
  return path;
78015
78991
  }
@@ -78486,7 +79462,7 @@ async function turnTokenOf3({
78486
79462
  const pinned = env.LAZE_TURN_TOKEN?.trim();
78487
79463
  if (pinned) return pinned;
78488
79464
  if (env.LAZE_TURN_FILE) {
78489
- return readFile19(env.LAZE_TURN_FILE, "utf8").then(
79465
+ return readFile20(env.LAZE_TURN_FILE, "utf8").then(
78490
79466
  (text2) => text2.trim(),
78491
79467
  () => ""
78492
79468
  );
@@ -78576,7 +79552,7 @@ async function answering({
78576
79552
  }
78577
79553
  function bridgeStatePath({ context, machine: machine2 }) {
78578
79554
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
78579
- return join22(dirname18(context.environment.configPath), "bridges", `${safe}.json`);
79555
+ return join23(dirname18(context.environment.configPath), "bridges", `${safe}.json`);
78580
79556
  }
78581
79557
  async function bridgePort({
78582
79558
  context,
@@ -78584,7 +79560,7 @@ async function bridgePort({
78584
79560
  access
78585
79561
  }) {
78586
79562
  const path = bridgeStatePath({ context, machine: machine2 });
78587
- const live = await readFile19(path, "utf8").then(
79563
+ const live = await readFile20(path, "utf8").then(
78588
79564
  (text2) => JSON.parse(text2),
78589
79565
  () => void 0
78590
79566
  );
@@ -78997,7 +79973,7 @@ async function activityRead({ context, args }) {
78997
79973
 
78998
79974
  // src/services/channel-config-commands.service.ts
78999
79975
  var AGENT_HINT2 = "Roles, archiving and removing others are a channel admin's change: ask one.\n";
79000
- var LEVELS3 = ["default", "all", "mentions", "nothing", "mute", "unmute"];
79976
+ var LEVELS4 = ["default", "all", "mentions", "nothing", "mute", "unmute"];
79001
79977
  async function changing2({
79002
79978
  context,
79003
79979
  profile,
@@ -79183,7 +80159,7 @@ function instantOf({ until }) {
79183
80159
  }
79184
80160
  function notifyBodyOf({ args }) {
79185
80161
  const [, , channel, word3] = args.words;
79186
- const level = LEVELS3.find((candidate) => candidate === word3);
80162
+ const level = LEVELS4.find((candidate) => candidate === word3);
79187
80163
  if (!channel || !level) throw new CliUsageError(NOTIFY_USAGE);
79188
80164
  if (level === "unmute") return { channel, muted: false };
79189
80165
  if (level !== "mute") return { channel, level };
@@ -79259,8 +80235,8 @@ async function channelSettings({ context, args }) {
79259
80235
  }
79260
80236
 
79261
80237
  // src/services/chat-actions-commands.service.ts
79262
- import { readFile as readFile20 } from "node:fs/promises";
79263
- import { basename as basename3, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve7 } from "node:path";
80238
+ import { readFile as readFile21 } from "node:fs/promises";
80239
+ import { basename as basename5, isAbsolute as isAbsolute2, relative as relative4, resolve as resolve7 } from "node:path";
79264
80240
 
79265
80241
  // src/rules/file-types.rules.ts
79266
80242
  var TYPES2 = {
@@ -79355,12 +80331,12 @@ async function threadWaitReply({
79355
80331
  if (!messageId) throw new CliUsageError(USAGE7);
79356
80332
  const seconds = timeoutOf({ args });
79357
80333
  const { client } = await signedIn({ context, args });
79358
- const read3 = () => client.post(CHAT_KEY_PATHS.thread, { messageId });
79359
- const seen = new Set((await read3()).replies.map((reply2) => reply2.id));
80334
+ const read4 = () => client.post(CHAT_KEY_PATHS.thread, { messageId });
80335
+ const seen = new Set((await read4()).replies.map((reply2) => reply2.id));
79360
80336
  const isNew = (reply2) => reply2.author.kind === "person" && !seen.has(reply2.id);
79361
80337
  for (let waited = 0; waited < seconds * 1e3; waited += POLL_MS2) {
79362
80338
  await context.sleep(POLL_MS2);
79363
- const reply2 = (await read3()).replies.find(isNew);
80339
+ const reply2 = (await read4()).replies.find(isNew);
79364
80340
  if (!reply2) continue;
79365
80341
  const line = `${reply2.seq} ${reply2.id} person ${reply2.author.id} ${reply2.body}
79366
80342
  `;
@@ -79592,11 +80568,11 @@ var files = async ({ context, args, client }) => {
79592
80568
  };
79593
80569
  function uploadNameOf({ cwd, path }) {
79594
80570
  const inside = relative4(cwd, path);
79595
- return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename3(path);
80571
+ return inside && !inside.startsWith("..") && !isAbsolute2(inside) ? inside : basename5(path);
79596
80572
  }
79597
80573
  var fileUpload = async ({ context, args, client }) => {
79598
80574
  const path = resolve7(context.cwd, wordAt(args, 3));
79599
- const bytes = new Uint8Array(await readFile20(path));
80575
+ const bytes = new Uint8Array(await readFile21(path));
79600
80576
  const answer5 = await uploadFile({
79601
80577
  context,
79602
80578
  client,
@@ -79769,7 +80745,7 @@ async function chatActions({
79769
80745
  }
79770
80746
 
79771
80747
  // src/services/claude-monitor.service.ts
79772
- import { readFile as readFile21, rm as rm10 } from "node:fs/promises";
80748
+ import { readFile as readFile22, rm as rm10 } from "node:fs/promises";
79773
80749
  var MONITOR_IDLE_MS = 3e4;
79774
80750
  var MONITOR_OUTRANKED_MS = 3e3;
79775
80751
  async function deliverOnce({
@@ -79810,6 +80786,12 @@ async function deliverOnce({
79810
80786
  async function monitorRound(turn) {
79811
80787
  const { context, session } = turn;
79812
80788
  return deliverOnce(turn).catch(async (error62) => {
80789
+ const migrated = migratedNoticeOf(error62);
80790
+ if (migrated) {
80791
+ context.out(`${migrated.notice}
80792
+ `);
80793
+ return false;
80794
+ }
79813
80795
  const named = { ...turn.args, flags: { ...turn.args.flags, profile: turn.profile } };
79814
80796
  const { client } = await signedIn({ context, args: named });
79815
80797
  const claim3 = forSession({ client, session });
@@ -79870,7 +80852,7 @@ async function monitorSessionOf({
79870
80852
  const fromEnv = sessionOf({ context, harness: "claude-code", sessionId });
79871
80853
  if (fromEnv || !claudePid) return fromEnv;
79872
80854
  const path = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
79873
- return readFile21(path, "utf8").then(
80855
+ return readFile22(path, "utf8").then(
79874
80856
  (text2) => JSON.parse(text2),
79875
80857
  () => void 0
79876
80858
  );
@@ -80097,6 +81079,14 @@ var billingConfig = Config.define((c) => ({
80097
81079
  stripeApiBase: c.env("STRIPE_API_BASE", external_exports.url().default("https://api.stripe.com")),
80098
81080
  /** Team's graduated per-person price (`TEAM_PRICING`), one quantity per person. */
80099
81081
  teamPriceId: c.env("STRIPE_PRICE_TEAM", priceId),
81082
+ /** Team's price before 2026-10-25 (first step of 2), kept by subscriptions started on it. */
81083
+ legacyTeamPriceId: c.env("STRIPE_PRICE_TEAM_LEGACY", priceId),
81084
+ /** The product every top-up and auto-recharge line names; a bare line without it. */
81085
+ creditsProductId: c.env("STRIPE_PRODUCT_CREDITS", external_exports.string().min(1).optional()),
81086
+ /** The customer portal configuration; Stripe's default one without it. */
81087
+ portalConfigurationId: c.env("STRIPE_PORTAL_CONFIGURATION", external_exports.string().min(1).optional()),
81088
+ /** Stripe Tax on checkouts, recharge invoices and subscriptions; needs Stripe Tax active. */
81089
+ automaticTax: c.env("STRIPE_AUTOMATIC_TAX", environmentBooleanSchema.default(true)),
80100
81090
  /** The coupon for a referral: `REFERRAL_TERMS` off, repeating for its months. */
80101
81091
  referralCouponId: c.env("STRIPE_COUPON_REFERRAL", external_exports.string().min(1).optional()),
80102
81092
  /** List price over cost per usage category; never shown on the site. */
@@ -80120,7 +81110,9 @@ var referralRefusalSchema = external_exports.enum([
80120
81110
  "unknown",
80121
81111
  "own_code",
80122
81112
  "already_applied",
80123
- "subscribed"
81113
+ "subscribed",
81114
+ "same_person",
81115
+ "same_company"
80124
81116
  ]);
80125
81117
 
80126
81118
  // ../../modules/billing/contract/src/billing.plans.ts
@@ -80128,6 +81120,19 @@ var currencySchema = external_exports.enum(["usd", "eur"]);
80128
81120
  var planSchema = external_exports.enum(["free", "team"]);
80129
81121
  var LEGACY_PLANS = { free: "free", team: "team", none: "free", individual: "team" };
80130
81122
  var storedPlanSchema = external_exports.enum(["free", "team", "none", "individual"]).transform((plan2) => LEGACY_PLANS[plan2]);
81123
+ var TEAM_PRICING = {
81124
+ firstPeople: 3,
81125
+ teamSizeStep: 10,
81126
+ prices: {
81127
+ usd: { firstPeoplePrice: 20, perPersonToStep: 10, perPersonAfterStep: 8 },
81128
+ eur: { firstPeoplePrice: 18, perPersonToStep: 9, perPersonAfterStep: 7 }
81129
+ }
81130
+ };
81131
+ var teamPricingRuleSchema = external_exports.enum(["first_three", "first_two"]);
81132
+ var FIRST_PEOPLE = {
81133
+ first_three: TEAM_PRICING.firstPeople,
81134
+ first_two: 2
81135
+ };
80131
81136
  var computerSizeSchema = external_exports.enum(["small", "medium", "large", "xl"]);
80132
81137
  var COMPUTER_MARKUP = 2;
80133
81138
  function computerSize(input2) {
@@ -80242,6 +81247,13 @@ var subscriptionStatusSchema = external_exports.enum([
80242
81247
  ]);
80243
81248
  var pauseReasonSchema = external_exports.enum(["credits"]);
80244
81249
  var spendLineDefinition = external_exports.object({ id: external_exports.string(), amount: external_exports.number() });
81250
+ var referralStateSchema = external_exports.enum(["waiting", "rewarded", "over_limit"]);
81251
+ var referralEntryDefinition = external_exports.object({
81252
+ state: referralStateSchema,
81253
+ referredAt: external_exports.iso.datetime(),
81254
+ settledAt: external_exports.iso.datetime().nullable(),
81255
+ reward: external_exports.enum(["discount", "banked", "credits"]).nullable()
81256
+ });
80245
81257
  var billingAccountViewDefinition = external_exports.object({
80246
81258
  workspaceId: external_exports.string(),
80247
81259
  plan: planSchema,
@@ -80258,6 +81270,8 @@ var billingAccountViewDefinition = external_exports.object({
80258
81270
  /** What the plan costs a month for these people; 0 on Free. */
80259
81271
  monthlyPrice: external_exports.number().nonnegative()
80260
81272
  }),
81273
+ /** The first step Team is priced by: `first_two` for subscriptions from before 2026-10-25. */
81274
+ pricingRule: teamPricingRuleSchema.default("first_three"),
80261
81275
  /** Team given free of charge by Laze staff, for this many people; null when paid or Free. */
80262
81276
  complimentary: external_exports.object({ seats: external_exports.number().int().positive() }).nullable().default(null),
80263
81277
  credits: external_exports.object({
@@ -80297,9 +81311,21 @@ var billingAccountViewDefinition = external_exports.object({
80297
81311
  /** The code this workspace applied, if any. */
80298
81312
  appliedCode: external_exports.string().nullable(),
80299
81313
  /** Discounts earned and not yet on a subscription. */
80300
- discountsPending: external_exports.number().int().nonnegative()
81314
+ discountsPending: external_exports.number().int().nonnegative(),
81315
+ /** Each workspace this code brought, oldest first; never who or which workspace it is. */
81316
+ referrals: external_exports.array(referralEntryDefinition).default([]),
81317
+ /** Rewards earned in the last 365 days, against `REFERRAL_CARD_TERMS.yearlyRewardLimit`. */
81318
+ rewardsThisYear: external_exports.number().int().nonnegative().default(0)
80301
81319
  }),
80302
- portalAvailable: external_exports.boolean()
81320
+ portalAvailable: external_exports.boolean(),
81321
+ /** A Team payment that failed or waits for the buyer's bank, until an invoice is paid. */
81322
+ paymentIssue: external_exports.object({
81323
+ kind: external_exports.enum(["failed", "action_required"]),
81324
+ message: external_exports.string().nullable(),
81325
+ /** Stripe's page that pays or confirms the invoice. */
81326
+ invoiceUrl: external_exports.string().nullable(),
81327
+ at: external_exports.iso.datetime()
81328
+ }).nullable().default(null)
80303
81329
  });
80304
81330
  var billingAccountViewSchema = billingAccountViewDefinition;
80305
81331
  var invoiceDefinition = external_exports.object({
@@ -80307,12 +81333,61 @@ var invoiceDefinition = external_exports.object({
80307
81333
  number: external_exports.string().nullable(),
80308
81334
  status: external_exports.string(),
80309
81335
  total: external_exports.number(),
81336
+ /** The tax on the invoice, in the same units as `total`. */
81337
+ tax: external_exports.number().default(0),
80310
81338
  currency: currencySchema,
80311
81339
  createdAt: external_exports.iso.datetime(),
80312
81340
  hostedUrl: external_exports.string().nullable(),
80313
81341
  pdfUrl: external_exports.string().nullable()
80314
81342
  });
80315
81343
  var billingInvoiceSchema = invoiceDefinition;
81344
+ var taxIdTypeSchema = external_exports.enum([
81345
+ "eu_vat",
81346
+ "gb_vat",
81347
+ "ch_vat",
81348
+ "no_vat",
81349
+ "us_ein",
81350
+ "au_abn",
81351
+ "ca_bn"
81352
+ ]);
81353
+ var billingAddressDefinition = external_exports.object({
81354
+ line1: external_exports.string().trim().min(1).max(200),
81355
+ line2: external_exports.string().trim().max(200).nullable().default(null),
81356
+ city: external_exports.string().trim().min(1).max(100),
81357
+ postalCode: external_exports.string().trim().max(20).nullable().default(null),
81358
+ state: external_exports.string().trim().max(100).nullable().default(null),
81359
+ /** ISO 3166-1 alpha-2, upper case. */
81360
+ country: external_exports.string().trim().regex(/^[A-Za-z]{2}$/, "a two-letter country code").transform((code) => code.toUpperCase())
81361
+ });
81362
+ var billingDetailsDefinition = external_exports.object({
81363
+ workspaceId: external_exports.string(),
81364
+ companyName: external_exports.string().nullable(),
81365
+ /** Where Stripe sends invoices and receipts. */
81366
+ email: external_exports.string().nullable(),
81367
+ address: billingAddressDefinition.nullable(),
81368
+ taxId: external_exports.object({
81369
+ type: taxIdTypeSchema,
81370
+ value: external_exports.string(),
81371
+ /** The EU VAT service's answer; `pending` until it gives one. */
81372
+ status: external_exports.enum(["pending", "verified", "unverified", "unavailable"])
81373
+ }).nullable(),
81374
+ /** A tax id the EU VAT service rejected after it was saved, removed from the customer. */
81375
+ taxIdRemoved: external_exports.object({ value: external_exports.string(), at: external_exports.iso.datetime() }).nullable()
81376
+ });
81377
+ var billingDetailsSchema = billingDetailsDefinition;
81378
+ var setBillingDetailsInputDefinition = external_exports.object({
81379
+ workspaceId: external_exports.string().min(1),
81380
+ companyName: external_exports.string().trim().min(1).max(200),
81381
+ email: external_exports.email().max(254),
81382
+ address: billingAddressDefinition,
81383
+ /** Null removes the tax id. */
81384
+ taxId: external_exports.object({ type: taxIdTypeSchema, value: external_exports.string().trim().min(2).max(40) }).nullable()
81385
+ });
81386
+ var setBillingDetailsInputSchema = setBillingDetailsInputDefinition;
81387
+ var setBillingDetailsByKeyInputDefinition = setBillingDetailsInputDefinition.omit({
81388
+ workspaceId: true
81389
+ });
81390
+ var emptyDefinition = external_exports.object({});
80316
81391
  var returnPathSchema = external_exports.string().max(500).regex(/^\/(?!\/)/, "a path on this site").optional();
80317
81392
  var startCheckoutInputDefinition = external_exports.object({
80318
81393
  workspaceId: external_exports.string().min(1),
@@ -80327,6 +81402,37 @@ var openPortalInputDefinition = external_exports.object({
80327
81402
  var openPortalInputSchema = openPortalInputDefinition;
80328
81403
  var redirectDefinition = external_exports.object({ url: external_exports.string() });
80329
81404
  var billingRedirectSchema = redirectDefinition;
81405
+ var inviteQuoteInputDefinition = external_exports.object({
81406
+ workspaceId: external_exports.string().min(1),
81407
+ /** People about to be invited, beyond the members and the seats already held for invitations. */
81408
+ adding: external_exports.number().int().min(0).max(100)
81409
+ });
81410
+ var inviteQuoteInputSchema = inviteQuoteInputDefinition;
81411
+ var inviteQuoteByKeyInputDefinition = inviteQuoteInputDefinition.omit({ workspaceId: true });
81412
+ var inviteQuoteDefinition = external_exports.object({
81413
+ workspaceId: external_exports.string(),
81414
+ plan: planSchema,
81415
+ currency: currencySchema,
81416
+ rule: teamPricingRuleSchema,
81417
+ /** Members plus the seats held for invitations, now. */
81418
+ people: external_exports.number().int().nonnegative(),
81419
+ peopleAfter: external_exports.number().int().nonnegative(),
81420
+ /** What the workspace pays a month now: 0 on Free or a complimentary Team. */
81421
+ monthlyNow: external_exports.number().nonnegative(),
81422
+ monthlyAfter: external_exports.number().nonnegative(),
81423
+ perPersonAfter: external_exports.number().nonnegative(),
81424
+ /** Seats Team's first step still includes after the invite ("1 free seat left"); 0 when none. */
81425
+ freeSeatsLeft: external_exports.number().int().nonnegative().default(0),
81426
+ /** Free, or a Team not paid for: inviting starts Team through Stripe Checkout. */
81427
+ upgradeNeeded: external_exports.boolean(),
81428
+ /** A live paid Team: the new people are added to the subscription, prorated, as they join. */
81429
+ prorated: external_exports.boolean(),
81430
+ /** The most people the plan holds; null when it holds everyone. */
81431
+ seatCap: external_exports.number().int().positive().nullable(),
81432
+ /** How many of the added people the cap leaves waiting. */
81433
+ overCap: external_exports.number().int().nonnegative()
81434
+ });
81435
+ var inviteQuoteSchema = inviteQuoteDefinition;
80330
81436
  var setCurrencyInputDefinition = external_exports.object({
80331
81437
  workspaceId: external_exports.string().min(1),
80332
81438
  currency: currencySchema
@@ -80353,6 +81459,23 @@ var applyReferralInputDefinition = external_exports.object({
80353
81459
  code: external_exports.string().trim().min(1).max(64)
80354
81460
  });
80355
81461
  var applyReferralInputSchema = applyReferralInputDefinition;
81462
+ var referralCardDefinition = external_exports.object({
81463
+ show: external_exports.enum(["offer", "reward", "hidden"]),
81464
+ code: external_exports.string(),
81465
+ url: external_exports.string(),
81466
+ /** "50% off Team for a month". */
81467
+ offer: external_exports.string(),
81468
+ /** The last reward the workspace earned, for the `reward` card. */
81469
+ rewardedAt: external_exports.iso.datetime().nullable()
81470
+ });
81471
+ var referralCardSchema = referralCardDefinition;
81472
+ var claimReferralInputDefinition = external_exports.object({ code: external_exports.string().trim().min(1).max(64) });
81473
+ var claimReferralInputSchema = claimReferralInputDefinition;
81474
+ var claimReferralOutputDefinition = external_exports.object({
81475
+ outcome: external_exports.enum(["kept", "applied", "refused"]),
81476
+ reason: referralRefusalSchema.nullable()
81477
+ });
81478
+ var claimReferralOutputSchema = claimReferralOutputDefinition;
80356
81479
  var usageCategorySchema = external_exports.enum([
80357
81480
  "model",
80358
81481
  "machine",
@@ -80390,7 +81513,7 @@ var grantCreditsInputDefinition = external_exports.object({
80390
81513
  reason: external_exports.string().trim().min(3).max(500)
80391
81514
  });
80392
81515
  var BillingApi = moduleApi()("billing");
80393
- var billingTrpc = defineTrpcContract("billing").query("account").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).query("invoices").withInput(billingWorkspaceInputSchema).withOutput(external_exports.array(billingInvoiceSchema)).mutation("startCheckout").withInput(startCheckoutInputSchema).withOutput(billingRedirectSchema).mutation("openPortal").withInput(openPortalInputSchema).withOutput(billingRedirectSchema).mutation("setCurrency").withInput(setCurrencyInputSchema).withOutput(billingAccountViewSchema).mutation("topUp").withInput(topUpInputSchema).withOutput(billingRedirectSchema).mutation("setAutoRecharge").withInput(setAutoRechargeInputSchema).withOutput(billingAccountViewSchema).mutation("applyReferral").withInput(applyReferralInputSchema).withOutput(billingAccountViewSchema).build();
81516
+ var billingTrpc = defineTrpcContract("billing").query("account").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).query("invoices").withInput(billingWorkspaceInputSchema).withOutput(external_exports.array(billingInvoiceSchema)).mutation("startCheckout").withInput(startCheckoutInputSchema).withOutput(billingRedirectSchema).query("inviteQuote").withInput(inviteQuoteInputSchema).withOutput(inviteQuoteSchema).mutation("openPortal").withInput(openPortalInputSchema).withOutput(billingRedirectSchema).mutation("setCurrency").withInput(setCurrencyInputSchema).withOutput(billingAccountViewSchema).mutation("topUp").withInput(topUpInputSchema).withOutput(billingRedirectSchema).mutation("setAutoRecharge").withInput(setAutoRechargeInputSchema).withOutput(billingAccountViewSchema).mutation("applyReferral").withInput(applyReferralInputSchema).withOutput(billingAccountViewSchema).query("referralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("dismissReferralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("claimReferral").withInput(claimReferralInputSchema).withOutput(claimReferralOutputSchema).query("billingDetails").withInput(billingWorkspaceInputSchema).withOutput(billingDetailsSchema).mutation("setBillingDetails").withInput(setBillingDetailsInputSchema).withOutput(billingDetailsSchema).mutation("cancelPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).mutation("keepPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).build();
80394
81517
  var stripeWebhookHeadersDefinition = external_exports.object({
80395
81518
  "stripe-signature": external_exports.string().max(1e3).default("")
80396
81519
  });
@@ -80805,7 +81928,7 @@ var dedicatedIpKeyReleasedDefinition = external_exports.object({
80805
81928
  });
80806
81929
 
80807
81930
  // ../../modules/compute/contract/src/own-machine-ssh.ts
80808
- var workspaceIdSchema16 = external_exports.string().min(1).max(64);
81931
+ var workspaceIdSchema17 = external_exports.string().min(1).max(64);
80809
81932
  var machineRefText = external_exports.string().min(1).max(64);
80810
81933
  var sshHostKeySchema = external_exports.string().regex(/^SHA256:[A-Za-z0-9+/]{43}$/);
80811
81934
  function sshTargetText({ target }) {
@@ -80827,7 +81950,7 @@ var machineSshDefinition = external_exports.object({
80827
81950
  });
80828
81951
  var machineSshSchema = machineSshDefinition;
80829
81952
  var connectSshDefinition = external_exports.object({
80830
- workspaceId: workspaceIdSchema16,
81953
+ workspaceId: workspaceIdSchema17,
80831
81954
  /** Checked by `checkMachineName`, so a refusal reads as a sentence. */
80832
81955
  name: external_exports.string().max(200),
80833
81956
  /** `user@host[:port]`, checked by `parseSshTarget`. */
@@ -80836,7 +81959,7 @@ var connectSshDefinition = external_exports.object({
80836
81959
  var connectSshMachineInputSchema = connectSshDefinition;
80837
81960
  var restConnectSshDefinition = connectSshDefinition.omit({ workspaceId: true });
80838
81961
  var trustHostKeyDefinition = external_exports.object({
80839
- workspaceId: workspaceIdSchema16,
81962
+ workspaceId: workspaceIdSchema17,
80840
81963
  machine: machineRefText,
80841
81964
  hostKey: sshHostKeySchema
80842
81965
  });
@@ -80844,7 +81967,7 @@ var trustHostKeyInputSchema = trustHostKeyDefinition;
80844
81967
  var restTrustHostKeyDefinition = trustHostKeyDefinition.omit({ workspaceId: true });
80845
81968
 
80846
81969
  // ../../modules/compute/contract/src/own-machine-whatsapp.ts
80847
- var workspaceIdSchema17 = external_exports.string().min(1).max(64);
81970
+ var workspaceIdSchema18 = external_exports.string().min(1).max(64);
80848
81971
  var machineRefText2 = external_exports.string().min(1).max(64);
80849
81972
  var WHATSAPP_TEXT_MAX = 4096;
80850
81973
  var WHATSAPP_LIMIT_MAX = 200;
@@ -80881,25 +82004,25 @@ var messagesResultDefinition = external_exports.object({
80881
82004
  var limitSchema = external_exports.number().int().min(1).max(WHATSAPP_LIMIT_MAX);
80882
82005
  var chatRefSchema = external_exports.string().trim().min(1).max(200);
80883
82006
  var chatsInputDefinition = external_exports.object({
80884
- workspaceId: workspaceIdSchema17,
82007
+ workspaceId: workspaceIdSchema18,
80885
82008
  machine: machineRefText2,
80886
82009
  limit: limitSchema.optional()
80887
82010
  });
80888
82011
  var readInputDefinition = external_exports.object({
80889
- workspaceId: workspaceIdSchema17,
82012
+ workspaceId: workspaceIdSchema18,
80890
82013
  machine: machineRefText2,
80891
82014
  /** A chat id, a phone number or a contact or group name. */
80892
82015
  chat: chatRefSchema,
80893
82016
  limit: limitSchema.optional()
80894
82017
  });
80895
82018
  var sendInputDefinition = external_exports.object({
80896
- workspaceId: workspaceIdSchema17,
82019
+ workspaceId: workspaceIdSchema18,
80897
82020
  machine: machineRefText2,
80898
82021
  chat: chatRefSchema,
80899
82022
  text: external_exports.string().trim().min(1).max(WHATSAPP_TEXT_MAX)
80900
82023
  });
80901
82024
  var sendStatusInputDefinition = external_exports.object({
80902
- workspaceId: workspaceIdSchema17,
82025
+ workspaceId: workspaceIdSchema18,
80903
82026
  sendId: external_exports.string().min(1).max(64),
80904
82027
  /** Wait up to this long for the owner's answer; 0 answers at once. */
80905
82028
  waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_STATUS_WAIT_MAX_SECONDS).default(0)
@@ -80937,7 +82060,7 @@ var whatsappPairingDefinition = external_exports.object({
80937
82060
  });
80938
82061
  var whatsappPairingSchema = whatsappPairingDefinition;
80939
82062
  var pairingRefDefinition = external_exports.object({
80940
- workspaceId: workspaceIdSchema17,
82063
+ workspaceId: workspaceIdSchema18,
80941
82064
  pairingId: external_exports.string().min(1).max(64)
80942
82065
  });
80943
82066
  var whatsappPairingRefSchema = pairingRefDefinition;
@@ -80958,7 +82081,7 @@ var COMPUTE_WHATSAPP_REST_PATHS = {
80958
82081
  };
80959
82082
 
80960
82083
  // ../../modules/compute/contract/src/own-machine.ts
80961
- var workspaceIdSchema18 = external_exports.string().min(1).max(64);
82084
+ var workspaceIdSchema19 = external_exports.string().min(1).max(64);
80962
82085
  var machineRefText3 = external_exports.string().min(1).max(64);
80963
82086
  var machineBrowserDefinition = external_exports.object({
80964
82087
  ready: external_exports.boolean(),
@@ -80991,7 +82114,7 @@ var machineHealthDefinition = external_exports.object({
80991
82114
  });
80992
82115
  var machineHealthSchema = machineHealthDefinition;
80993
82116
  var connectOwnDefinition = external_exports.object({
80994
- workspaceId: workspaceIdSchema18,
82117
+ workspaceId: workspaceIdSchema19,
80995
82118
  /** Checked by `checkMachineName`, so a refusal reads as a sentence. */
80996
82119
  name: external_exports.string().max(200)
80997
82120
  });
@@ -80999,7 +82122,7 @@ var connectOwnMachineInputSchema = connectOwnDefinition;
80999
82122
  var MACHINE_EXEC_MAX_SECONDS = 240;
81000
82123
  var MACHINE_EXEC_OUTPUT_BYTES = 1024 * 1024;
81001
82124
  var execDefinition = external_exports.object({
81002
- workspaceId: workspaceIdSchema18,
82125
+ workspaceId: workspaceIdSchema19,
81003
82126
  machine: machineRefText3,
81004
82127
  command: external_exports.string().min(1).max(64 * 1024),
81005
82128
  timeoutSeconds: external_exports.number().int().min(1).max(MACHINE_EXEC_MAX_SECONDS).optional(),
@@ -81071,14 +82194,14 @@ function gigabytes(bytes) {
81071
82194
  }
81072
82195
  var hostWhenOfflineSchema = external_exports.enum(["wait", "sandbox"]);
81073
82196
  var hostAgentDefinition = external_exports.object({
81074
- workspaceId: workspaceIdSchema18,
82197
+ workspaceId: workspaceIdSchema19,
81075
82198
  machine: machineRefText3,
81076
82199
  agentId: external_exports.string().min(1).max(64),
81077
82200
  whenOffline: hostWhenOfflineSchema.default("wait")
81078
82201
  });
81079
82202
  var hostAgentInputSchema = hostAgentDefinition;
81080
82203
  var unhostAgentDefinition = external_exports.object({
81081
- workspaceId: workspaceIdSchema18,
82204
+ workspaceId: workspaceIdSchema19,
81082
82205
  agentId: external_exports.string().min(1).max(64)
81083
82206
  });
81084
82207
  var unhostAgentInputSchema = unhostAgentDefinition;
@@ -81097,8 +82220,8 @@ var agentHostGrantDefinition = external_exports.object({
81097
82220
  });
81098
82221
 
81099
82222
  // ../../modules/compute/contract/src/compute.ts
81100
- var idSchema20 = external_exports.string().min(1).max(64);
81101
- var workspaceIdSchema19 = external_exports.string().min(1).max(64);
82223
+ var idSchema21 = external_exports.string().min(1).max(64);
82224
+ var workspaceIdSchema20 = external_exports.string().min(1).max(64);
81102
82225
  var machineStateSchema = external_exports.enum([
81103
82226
  "starting",
81104
82227
  "ready",
@@ -81119,24 +82242,24 @@ var machinePriceDefinition = external_exports.object({
81119
82242
  asleepMonthUsd: external_exports.number()
81120
82243
  });
81121
82244
  var machineGranteeKindSchema = external_exports.enum(["member", "agent"]);
81122
- var machineGranteeDefinition = external_exports.object({ kind: machineGranteeKindSchema, id: idSchema20 });
82245
+ var machineGranteeDefinition = external_exports.object({ kind: machineGranteeKindSchema, id: idSchema21 });
81123
82246
  var machineGrantDefinition = external_exports.object({
81124
82247
  kind: machineGranteeKindSchema,
81125
- id: idSchema20,
81126
- grantedByUserId: idSchema20,
82248
+ id: idSchema21,
82249
+ grantedByUserId: idSchema21,
81127
82250
  grantedAt: external_exports.iso.datetime()
81128
82251
  });
81129
82252
  var machineDefinition = external_exports.object({
81130
- id: idSchema20,
81131
- workspaceId: workspaceIdSchema19,
82253
+ id: idSchema21,
82254
+ workspaceId: workspaceIdSchema20,
81132
82255
  name: external_exports.string(),
81133
82256
  type: machineTypeSchema,
81134
82257
  zone: external_exports.string(),
81135
82258
  state: machineStateSchema,
81136
- ownerUserId: idSchema20,
81137
- requesterUserId: idSchema20,
81138
- renterAgentId: idSchema20.nullable(),
81139
- channelId: idSchema20.nullable(),
82259
+ ownerUserId: idSchema21,
82260
+ requesterUserId: idSchema21,
82261
+ renterAgentId: idSchema21.nullable(),
82262
+ channelId: idSchema21.nullable(),
81140
82263
  ipAddress: external_exports.string().nullable(),
81141
82264
  sites: external_exports.array(machineSiteDefinition),
81142
82265
  /** Members and agents the owner shared the machine with, beyond the owner's own agents. */
@@ -81168,7 +82291,7 @@ var machineDefinition = external_exports.object({
81168
82291
  /** The owner's agents set to run on this own machine. */
81169
82292
  hostedAgents: external_exports.array(
81170
82293
  external_exports.object({
81171
- id: idSchema20,
82294
+ id: idSchema21,
81172
82295
  name: external_exports.string(),
81173
82296
  whenOffline: external_exports.enum(["wait", "sandbox"])
81174
82297
  })
@@ -81179,23 +82302,23 @@ var machineDefinition = external_exports.object({
81179
82302
  var machineSchema = machineDefinition;
81180
82303
  var computeStatusDefinition = external_exports.object({ available: external_exports.boolean() });
81181
82304
  var computeStatusSchema = computeStatusDefinition;
81182
- var workspaceInputDefinition2 = external_exports.object({ workspaceId: workspaceIdSchema19 });
82305
+ var workspaceInputDefinition2 = external_exports.object({ workspaceId: workspaceIdSchema20 });
81183
82306
  var computeWorkspaceInputSchema = workspaceInputDefinition2;
81184
82307
  var machineRefDefinition = external_exports.object({
81185
- workspaceId: workspaceIdSchema19,
82308
+ workspaceId: workspaceIdSchema20,
81186
82309
  machine: external_exports.string().min(1).max(64)
81187
82310
  });
81188
82311
  var machineRefSchema = machineRefDefinition;
81189
82312
  var MACHINE_NAME_MAX = 40;
81190
82313
  var machineNameSchema = external_exports.string().min(2).max(MACHINE_NAME_MAX).regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters, digits and dashes");
81191
82314
  var renameDefinition = external_exports.object({
81192
- workspaceId: workspaceIdSchema19,
82315
+ workspaceId: workspaceIdSchema20,
81193
82316
  machine: external_exports.string().min(1).max(64),
81194
82317
  name: external_exports.string().max(200)
81195
82318
  });
81196
82319
  var renameMachineInputSchema = renameDefinition;
81197
82320
  var setupBrowserDefinition = external_exports.object({
81198
- workspaceId: workspaceIdSchema19,
82321
+ workspaceId: workspaceIdSchema20,
81199
82322
  /** The site the person signs in to, as a host or a URL. */
81200
82323
  site: external_exports.string().min(1).max(500),
81201
82324
  name: machineNameSchema.optional(),
@@ -81204,29 +82327,29 @@ var setupBrowserDefinition = external_exports.object({
81204
82327
  });
81205
82328
  var setupBrowserInputSchema = setupBrowserDefinition;
81206
82329
  var grantDefinition = external_exports.object({
81207
- workspaceId: workspaceIdSchema19,
82330
+ workspaceId: workspaceIdSchema20,
81208
82331
  machine: external_exports.string().min(1).max(64),
81209
82332
  grantee: machineGranteeDefinition
81210
82333
  });
81211
82334
  var machineGrantInputSchema = grantDefinition;
81212
82335
  var setBudgetDefinition = external_exports.object({
81213
- workspaceId: workspaceIdSchema19,
82336
+ workspaceId: workspaceIdSchema20,
81214
82337
  machine: external_exports.string().min(1).max(64),
81215
82338
  budgetUsd: external_exports.number().min(0).max(1e4),
81216
82339
  period: machineBudgetPeriodSchema
81217
82340
  });
81218
82341
  var setMachineBudgetInputSchema = setBudgetDefinition;
81219
82342
  var openScreenDefinition = external_exports.object({
81220
- workspaceId: workspaceIdSchema19,
82343
+ workspaceId: workspaceIdSchema20,
81221
82344
  machine: external_exports.string().min(1).max(64),
81222
82345
  site: external_exports.string().min(1).max(500).optional()
81223
82346
  });
81224
82347
  var openScreenInputSchema = openScreenDefinition;
81225
- var screenRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema19, sessionId: idSchema20 });
82348
+ var screenRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, sessionId: idSchema21 });
81226
82349
  var screenRefSchema = screenRefDefinition;
81227
82350
  var screenSessionDefinition = external_exports.object({
81228
- sessionId: idSchema20,
81229
- machineId: idSchema20,
82351
+ sessionId: idSchema21,
82352
+ machineId: idSchema21,
81230
82353
  machineName: external_exports.string(),
81231
82354
  site: external_exports.string().nullable(),
81232
82355
  expiresAt: external_exports.iso.datetime(),
@@ -81260,7 +82383,7 @@ var ownMachineSshConnectDefinition = external_exports.object({
81260
82383
  publicKey: external_exports.string()
81261
82384
  });
81262
82385
  var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
81263
- var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema19, machineId: idSchema20 });
82386
+ var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, machineId: idSchema21 });
81264
82387
  var ComputeApi = moduleApi()("compute");
81265
82388
  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("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).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();
81266
82389
  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();
@@ -81358,9 +82481,9 @@ function creatorsOf(args) {
81358
82481
  return { everyone: args.flags.everyone === true, userIds };
81359
82482
  }
81360
82483
  function lineOf3(computer2) {
81361
- const money2 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
82484
+ const money3 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
81362
82485
  const agents = `${computer2.agents.length} agent(s)`;
81363
- return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money2} ${agents} ${computer2.state}`;
82486
+ return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money3} ${agents} ${computer2.state}`;
81364
82487
  }
81365
82488
  async function mine({ context, args }) {
81366
82489
  const client = await computeClient({ context, args });
@@ -81549,7 +82672,7 @@ Message to forward: ${answer5.message}
81549
82672
  `
81550
82673
  );
81551
82674
  }
81552
- async function cancel({ context, args }) {
82675
+ async function cancel2({ context, args }) {
81553
82676
  const requestId = args.words[2];
81554
82677
  if (!requestId) throw new CliUsageError(COMPUTER_USAGE);
81555
82678
  const client = await computeClient({ context, args });
@@ -81578,9 +82701,9 @@ async function list2({ context, args }) {
81578
82701
  const client = await computeClient({ context, args });
81579
82702
  const answer5 = await client.get(COMPUTER_REST_PATHS.all);
81580
82703
  if (args.flags.json) return printJson3(context, answer5);
81581
- const money2 = (amount) => `${amount} ${answer5.currency.toUpperCase()}`;
82704
+ const money3 = (amount) => `${amount} ${answer5.currency.toUpperCase()}`;
81582
82705
  const lines2 = answer5.computers.map(
81583
- (one) => ` ${one.name ?? one.ownerName} ${one.size} ${money2(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
82706
+ (one) => ` ${one.name ?? one.ownerName} ${one.size} ${money3(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
81584
82707
  );
81585
82708
  context.out(
81586
82709
  `Everyone's computers (${answer5.includedSize} included per person):
@@ -81593,7 +82716,7 @@ var COMPUTER_COMMANDS = {
81593
82716
  sizes,
81594
82717
  upgrade,
81595
82718
  request,
81596
- cancel,
82719
+ cancel: cancel2,
81597
82720
  restart,
81598
82721
  list: list2,
81599
82722
  ...COMPUTER_FLEET_COMMANDS
@@ -81607,10 +82730,10 @@ async function computer({ context, args }) {
81607
82730
  }
81608
82731
 
81609
82732
  // src/services/connect-commands.service.ts
81610
- import { readFile as readFile23 } from "node:fs/promises";
82733
+ import { readFile as readFile24 } from "node:fs/promises";
81611
82734
 
81612
82735
  // src/services/mcp-gateway.service.ts
81613
- import { readFile as readFile22 } from "node:fs/promises";
82736
+ import { readFile as readFile23 } from "node:fs/promises";
81614
82737
  import { createInterface as createInterface3 } from "node:readline";
81615
82738
  var TURN_HEADER = "x-laze-turn";
81616
82739
  function serveMcpGateway({
@@ -81653,7 +82776,7 @@ async function relayMcpLines({
81653
82776
  const github3 = env.LAZE_GITHUB_CONNECTION;
81654
82777
  const url2 = `${profile.url.replace(/\/+$/, "")}/api/connectors/mcp/${encodeURIComponent(profile.agentId)}${github3 ? `?github=${encodeURIComponent(github3)}` : ""}`;
81655
82778
  const turnFile = env.LAZE_TURN_FILE;
81656
- const readTurn = () => readFile22(turnFile, "utf8").then(
82779
+ const readTurn = () => readFile23(turnFile, "utf8").then(
81657
82780
  (text2) => text2.trim(),
81658
82781
  () => ""
81659
82782
  );
@@ -81743,7 +82866,7 @@ async function turnOf({ context }) {
81743
82866
  const pinned = env.LAZE_TURN_TOKEN?.trim();
81744
82867
  if (pinned) return pinned;
81745
82868
  const file3 = env.LAZE_TURN_FILE;
81746
- const turn = file3 ? await readFile23(file3, "utf8").then(
82869
+ const turn = file3 ? await readFile24(file3, "utf8").then(
81747
82870
  (text2) => text2.trim(),
81748
82871
  () => ""
81749
82872
  ) : "";
@@ -81801,11 +82924,11 @@ async function connect({
81801
82924
  }
81802
82925
 
81803
82926
  // src/services/connector-commands.service.ts
81804
- import { readFile as readFile25 } from "node:fs/promises";
82927
+ import { readFile as readFile26 } from "node:fs/promises";
81805
82928
  import { resolve as resolve8 } from "node:path";
81806
82929
 
81807
82930
  // src/services/vault-keychain-commands.service.ts
81808
- import { readFile as readFile24 } from "node:fs/promises";
82931
+ import { readFile as readFile25 } from "node:fs/promises";
81809
82932
 
81810
82933
  // src/rules/vault-input.rules.ts
81811
82934
  function secondsOf(text2) {
@@ -82185,7 +83308,7 @@ async function secretText({ context, args }) {
82185
83308
  );
82186
83309
  }
82187
83310
  const file3 = flagText({ args, name: "from-file" });
82188
- const text2 = file3 ? await readFile24(file3, "utf8") : await context.readStdin();
83311
+ const text2 = file3 ? await readFile25(file3, "utf8") : await context.readStdin();
82189
83312
  const trimmed = text2.replace(/\r?\n$/, "");
82190
83313
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
82191
83314
  return trimmed;
@@ -82414,7 +83537,7 @@ async function keyText({ context, args }) {
82414
83537
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
82415
83538
  }
82416
83539
  const file3 = flagText({ args, name: "from-file" });
82417
- const text2 = file3 ? await readFile25(resolve8(context.cwd, file3), "utf8") : await context.readStdin();
83540
+ const text2 = file3 ? await readFile26(resolve8(context.cwd, file3), "utf8") : await context.readStdin();
82418
83541
  const trimmed = text2.trim();
82419
83542
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
82420
83543
  return trimmed;
@@ -82732,12 +83855,12 @@ async function conversationDelete({ context, args }) {
82732
83855
  }
82733
83856
 
82734
83857
  // src/services/discord-commands.service.ts
82735
- import { readFile as readFile26 } from "node:fs/promises";
83858
+ import { readFile as readFile27 } from "node:fs/promises";
82736
83859
  import { resolve as resolve9 } from "node:path";
82737
83860
 
82738
83861
  // ../../modules/discord/contract/src/discord.ts
82739
- var workspaceIdSchema20 = external_exports.string().min(1).max(64);
82740
- var workspaceInput4 = external_exports.object({ workspaceId: workspaceIdSchema20 });
83862
+ var workspaceIdSchema21 = external_exports.string().min(1).max(64);
83863
+ var workspaceInput4 = external_exports.object({ workspaceId: workspaceIdSchema21 });
82741
83864
  var discordIdSchema = external_exports.string().regex(/^\d{5,25}$/);
82742
83865
  var DISCORD_PERMISSIONS = {
82743
83866
  ADMINISTRATOR: 1n << 3n,
@@ -82819,10 +83942,10 @@ var discordChannelViewDefinition = external_exports.object({
82819
83942
  url: external_exports.url()
82820
83943
  });
82821
83944
  var discordChannelViewSchema = discordChannelViewDefinition;
82822
- var guildInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, guildId: discordIdSchema });
83945
+ var guildInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, guildId: discordIdSchema });
82823
83946
  var discordGuildInputSchema = guildInputDefinition;
82824
83947
  var saveDiscordAppDefinition = external_exports.object({
82825
- workspaceId: workspaceIdSchema20,
83948
+ workspaceId: workspaceIdSchema21,
82826
83949
  setupKey: external_exports.string().min(1).max(64),
82827
83950
  applicationId: external_exports.string().trim().max(40),
82828
83951
  clientSecret: external_exports.string().trim().max(200),
@@ -82832,7 +83955,7 @@ var saveDiscordAppInputSchema = saveDiscordAppDefinition;
82832
83955
  var startedAuthorizeDefinition = external_exports.object({ authorizeUrl: external_exports.url() });
82833
83956
  var startedDiscordAuthorizeSchema = startedAuthorizeDefinition;
82834
83957
  var pickDefinition = external_exports.object({
82835
- workspaceId: workspaceIdSchema20,
83958
+ workspaceId: workspaceIdSchema21,
82836
83959
  guildId: discordIdSchema,
82837
83960
  channelId: discordIdSchema,
82838
83961
  picked: external_exports.boolean(),
@@ -82840,7 +83963,7 @@ var pickDefinition = external_exports.object({
82840
83963
  });
82841
83964
  var discordPickInputSchema = pickDefinition;
82842
83965
  var updateConnectionDefinition = external_exports.object({
82843
- workspaceId: workspaceIdSchema20,
83966
+ workspaceId: workspaceIdSchema21,
82844
83967
  guildId: discordIdSchema,
82845
83968
  label: external_exports.string().trim().max(80).nullable().optional(),
82846
83969
  cacheDays: external_exports.number().int().min(1).max(30).optional()
@@ -82853,9 +83976,9 @@ var oauthCallbackDefinition = external_exports.object({
82853
83976
  permissions: external_exports.string().max(40).optional(),
82854
83977
  error: external_exports.string().max(200).optional()
82855
83978
  });
82856
- var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema20, guildId: discordIdSchema });
83979
+ var linkParamsDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, guildId: discordIdSchema });
82857
83980
  var historyInputDefinition = external_exports.object({
82858
- workspaceId: workspaceIdSchema20,
83981
+ workspaceId: workspaceIdSchema21,
82859
83982
  /** The Laze conversation that mirrors the Discord channel. */
82860
83983
  channelId: external_exports.string().min(1).max(200),
82861
83984
  before: external_exports.iso.datetime()
@@ -82884,7 +84007,7 @@ var historyPageDefinition = external_exports.object({
82884
84007
  });
82885
84008
  var discordHistoryPageSchema = historyPageDefinition;
82886
84009
  var fileParamsDefinition = external_exports.object({
82887
- workspaceId: workspaceIdSchema20,
84010
+ workspaceId: workspaceIdSchema21,
82888
84011
  channelId: external_exports.string().min(1).max(200),
82889
84012
  messageId: discordIdSchema,
82890
84013
  attachmentId: discordIdSchema
@@ -82899,7 +84022,7 @@ var saveAppByKeyDefinition = external_exports.object({
82899
84022
  var pickByKeyDefinition = pickDefinition.omit({ workspaceId: true });
82900
84023
  var updateByKeyDefinition = updateConnectionDefinition.omit({ workspaceId: true });
82901
84024
  var historyByKeyDefinition = historyInputDefinition.omit({ workspaceId: true });
82902
- var emptyDefinition = external_exports.object({});
84025
+ var emptyDefinition2 = external_exports.object({});
82903
84026
  var DISCORD_KEY_PATHS = {
82904
84027
  overview: "/api/discord/overview",
82905
84028
  beginSetup: "/api/discord/setup",
@@ -83054,7 +84177,7 @@ async function secretsOf({ context, args }) {
83054
84177
  const fromConnection = flagText({ args, name: "from-vault" });
83055
84178
  if (fromConnection) return { fromConnection };
83056
84179
  const file3 = flagText({ args, name: "from-file" });
83057
- const text2 = file3 ? await readFile26(resolve9(context.cwd, file3), "utf8") : await context.readStdin();
84180
+ const text2 = file3 ? await readFile27(resolve9(context.cwd, file3), "utf8") : await context.readStdin();
83058
84181
  const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
83059
84182
  if (lines2.length !== 2) {
83060
84183
  throw new CliUsageError(
@@ -83324,8 +84447,8 @@ var DOMAINS_USAGE = `Usage:
83324
84447
  var printJson5 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
83325
84448
  `);
83326
84449
  function printDomain(context, row) {
83327
- const join27 = row.autoJoin ? "auto-join on" : "auto-join off";
83328
- context.out(`${row.domain} ${join27}${row.enforced ? " single sign-on enforced" : ""}
84450
+ const join28 = row.autoJoin ? "auto-join on" : "auto-join off";
84451
+ context.out(`${row.domain} ${join28}${row.enforced ? " single sign-on enforced" : ""}
83329
84452
  `);
83330
84453
  }
83331
84454
  async function list4({ context, args }) {
@@ -83357,7 +84480,7 @@ async function domains({ context, args }) {
83357
84480
  }
83358
84481
 
83359
84482
  // src/services/emoji-commands.service.ts
83360
- import { readFile as readFile27 } from "node:fs/promises";
84483
+ import { readFile as readFile28 } from "node:fs/promises";
83361
84484
  import { resolve as resolve10 } from "node:path";
83362
84485
  var EMOJI_USAGE = `Usage:
83363
84486
  laze emoji list [--json] the workspace's custom emoji, aliases and who added each
@@ -83398,7 +84521,7 @@ async function addEmoji({ context, args, client }) {
83398
84521
  const file3 = wordAt4(args, 3);
83399
84522
  let bytes;
83400
84523
  try {
83401
- bytes = new Uint8Array(await readFile27(resolve10(context.cwd, file3)));
84524
+ bytes = new Uint8Array(await readFile28(resolve10(context.cwd, file3)));
83402
84525
  } catch {
83403
84526
  throw new CliUsageError(`Cannot read ${file3}.`);
83404
84527
  }
@@ -83464,10 +84587,10 @@ var EXTERNAL_CONNECTION_REST_PATHS = {
83464
84587
  block: "/api/external-connections/block",
83465
84588
  report: "/api/external-connections/report"
83466
84589
  };
83467
- var workspaceIdSchema21 = external_exports.string().min(1).max(64);
83468
- var idSchema21 = external_exports.string().min(1).max(64);
84590
+ var workspaceIdSchema22 = external_exports.string().min(1).max(64);
84591
+ var idSchema22 = external_exports.string().min(1).max(64);
83469
84592
  var iso = external_exports.iso.datetime();
83470
- var workspaceInput5 = external_exports.object({ workspaceId: workspaceIdSchema21 });
84593
+ var workspaceInput5 = external_exports.object({ workspaceId: workspaceIdSchema22 });
83471
84594
  var connectionReference = external_exports.string().trim().min(1).max(120);
83472
84595
  var externalConnectionStateSchema = external_exports.enum(["active", "ended"]);
83473
84596
  var externalInviteStateSchema = external_exports.enum([
@@ -83571,10 +84694,10 @@ var rosterDefinition = external_exports.object({
83571
84694
  members: external_exports.array(rosterMemberDefinition)
83572
84695
  });
83573
84696
  var externalRosterSchema = rosterDefinition;
83574
- var rosterInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, channelId: idSchema21 });
84697
+ var rosterInputDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, channelId: idSchema22 });
83575
84698
  var externalRosterInputSchema = rosterInputDefinition;
83576
84699
  var inviteInputDefinition = external_exports.object({
83577
- workspaceId: workspaceIdSchema21,
84700
+ workspaceId: workspaceIdSchema22,
83578
84701
  email: external_exports.email().max(320),
83579
84702
  /** The first channel to share, by id or name; it is shared once the invitation is accepted. */
83580
84703
  share: external_exports.string().trim().min(1).max(81).optional(),
@@ -83582,7 +84705,7 @@ var inviteInputDefinition = external_exports.object({
83582
84705
  company: external_exports.string().trim().min(1).max(80).optional()
83583
84706
  });
83584
84707
  var externalInviteInputSchema = inviteInputDefinition;
83585
- var inviteRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema21, inviteId: idSchema21 });
84708
+ var inviteRefDefinition = external_exports.object({ workspaceId: workspaceIdSchema22, inviteId: idSchema22 });
83586
84709
  var externalInviteRefSchema = inviteRefDefinition;
83587
84710
  var pendingShareDefinition = external_exports.object({
83588
84711
  channelId: external_exports.string(),
@@ -83606,8 +84729,8 @@ var pendingSharesDefinition = external_exports.object({
83606
84729
  var externalPendingSharesSchema = pendingSharesDefinition;
83607
84730
  var acceptInviteDefinition = external_exports.object({
83608
84731
  /** The workspace to connect: one where the person is Admin or Owner. */
83609
- workspaceId: workspaceIdSchema21,
83610
- inviteId: idSchema21,
84732
+ workspaceId: workspaceIdSchema22,
84733
+ inviteId: idSchema22,
83611
84734
  /** The emailed link's secret; without it the invitation must be addressed to the person. */
83612
84735
  secret: external_exports.string().trim().max(200).optional()
83613
84736
  });
@@ -83615,40 +84738,40 @@ var externalAcceptInviteInputSchema = acceptInviteDefinition;
83615
84738
  var answeredDefinition = external_exports.object({ id: external_exports.string(), state: externalInviteStateSchema });
83616
84739
  var externalInviteAnsweredSchema = answeredDefinition;
83617
84740
  var connectionInputDefinition = external_exports.object({
83618
- workspaceId: workspaceIdSchema21,
84741
+ workspaceId: workspaceIdSchema22,
83619
84742
  connection: connectionReference
83620
84743
  });
83621
84744
  var externalConnectionInputSchema = connectionInputDefinition;
83622
84745
  var settingsInputDefinition = external_exports.object({
83623
- workspaceId: workspaceIdSchema21,
84746
+ workspaceId: workspaceIdSchema22,
83624
84747
  connection: connectionReference,
83625
84748
  agentsAllowed: external_exports.boolean().optional(),
83626
84749
  directAllowed: external_exports.boolean().optional()
83627
84750
  });
83628
84751
  var externalSettingsInputSchema = settingsInputDefinition;
83629
84752
  var shareInputDefinition = external_exports.object({
83630
- workspaceId: workspaceIdSchema21,
84753
+ workspaceId: workspaceIdSchema22,
83631
84754
  connection: connectionReference,
83632
84755
  /** The channel as its id or name, `#` optional. */
83633
84756
  channel: external_exports.string().trim().min(1).max(81)
83634
84757
  });
83635
84758
  var externalShareInputSchema = shareInputDefinition;
83636
84759
  var acceptShareDefinition = external_exports.object({
83637
- workspaceId: workspaceIdSchema21,
83638
- shareId: idSchema21,
84760
+ workspaceId: workspaceIdSchema22,
84761
+ shareId: idSchema22,
83639
84762
  /** Its name here; the host's name when left out. */
83640
84763
  name: external_exports.string().trim().min(1).max(80).optional(),
83641
84764
  visibility: external_exports.enum(["public", "private"]).default("public")
83642
84765
  });
83643
84766
  var externalAcceptShareInputSchema = acceptShareDefinition;
83644
84767
  var shareRefDefinition = external_exports.object({
83645
- workspaceId: workspaceIdSchema21,
84768
+ workspaceId: workspaceIdSchema22,
83646
84769
  /** The share's id, or this workspace's channel as its id or name. */
83647
84770
  share: external_exports.string().trim().min(1).max(81)
83648
84771
  });
83649
84772
  var externalShareRefSchema = shareRefDefinition;
83650
84773
  var reportInputDefinition = external_exports.object({
83651
- workspaceId: workspaceIdSchema21,
84774
+ workspaceId: workspaceIdSchema22,
83652
84775
  connection: connectionReference,
83653
84776
  note: external_exports.string().trim().min(1).max(2e3)
83654
84777
  });
@@ -83659,7 +84782,7 @@ var blockedDefinition = external_exports.object({
83659
84782
  });
83660
84783
  var externalBlockedSchema = blockedDefinition;
83661
84784
  var openDirectDefinition = external_exports.object({
83662
- workspaceId: workspaceIdSchema21,
84785
+ workspaceId: workspaceIdSchema22,
83663
84786
  /** The external person: their roster id (`laze:<id>`) or their name in a shared channel. */
83664
84787
  person: external_exports.string().trim().min(1).max(120),
83665
84788
  /** Their workspace, as a connection reference; needed only when a name is in two. */
@@ -83685,7 +84808,7 @@ var externalConnectionConfig = Config.define(() => ({ publicBaseUrl }));
83685
84808
 
83686
84809
  // ../../modules/external-connection/contract/src/external-connection.rest.ts
83687
84810
  var keyed = { workspaceId: true };
83688
- var emptyDefinition2 = external_exports.object({});
84811
+ var emptyDefinition3 = external_exports.object({});
83689
84812
  var rosterDefinition2 = externalRosterInputSchema.omit(keyed);
83690
84813
  var inviteDefinition = externalInviteInputSchema.omit(keyed);
83691
84814
  var inviteRefDefinition2 = externalInviteRefSchema.omit(keyed);
@@ -83705,7 +84828,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
83705
84828
  var ExternalSharingHooksToken = externalUi.hooks("sharing");
83706
84829
 
83707
84830
  // src/services/workspace-commands.service.ts
83708
- import { readFile as readFile28 } from "node:fs/promises";
84831
+ import { readFile as readFile29 } from "node:fs/promises";
83709
84832
  import { resolve as resolve11 } from "node:path";
83710
84833
  var ROLE_NAMES2 = {
83711
84834
  OWNER: "Owner",
@@ -83888,7 +85011,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
83888
85011
  async function readLogo({ context, file: file3 }) {
83889
85012
  let bytes;
83890
85013
  try {
83891
- bytes = new Uint8Array(await readFile28(resolve11(context.cwd, file3)));
85014
+ bytes = new Uint8Array(await readFile29(resolve11(context.cwd, file3)));
83892
85015
  } catch {
83893
85016
  throw new CliUsageError(`No file to read at ${file3}.`);
83894
85017
  }
@@ -84204,7 +85327,7 @@ async function list6({ context, args }) {
84204
85327
  ...overview3.connections.flatMap(connectionLines),
84205
85328
  ...overview3.invites.length > 0 ? ["Invitations sent:"] : [],
84206
85329
  ...overview3.invites.map(
84207
- (invite3) => ` ${invite3.email} ${invite3.state} expires ${utcTimeOf(invite3.expiresAt)} ${invite3.id}`
85330
+ (invite4) => ` ${invite4.email} ${invite4.state} expires ${utcTimeOf(invite4.expiresAt)} ${invite4.id}`
84208
85331
  ),
84209
85332
  ...overview3.blocked.map((each) => `Blocked: ${each.name}`)
84210
85333
  ];
@@ -84461,7 +85584,7 @@ async function external({ context, args }) {
84461
85584
  }
84462
85585
 
84463
85586
  // src/services/feed-commands.service.ts
84464
- import { readFile as readFile30 } from "node:fs/promises";
85587
+ import { readFile as readFile31 } from "node:fs/promises";
84465
85588
  import { resolve as resolve13 } from "node:path";
84466
85589
 
84467
85590
  // ../../modules/feed/contract/src/feed.ts
@@ -84649,6 +85772,13 @@ var feedApprovalSchemaDefinition = external_exports.object({
84649
85772
  "vault_share"
84650
85773
  ]),
84651
85774
  requestId: external_exports.string(),
85775
+ /** Every request an invite card answers at once, `requestId` first; absent means just it. */
85776
+ requestIds: external_exports.array(external_exports.string()).optional(),
85777
+ /**
85778
+ * An invite card whose approval raises what the workspace pays (Team, more seats or a higher
85779
+ * price): the web shows the price and runs the upgrade; iOS sends the admin to the web.
85780
+ */
85781
+ needsUpgrade: external_exports.boolean().optional(),
84652
85782
  /** The app, for an `app_publish` or `app_access` card. */
84653
85783
  appId: external_exports.string().nullable(),
84654
85784
  subject: external_exports.string(),
@@ -85086,15 +86216,15 @@ function decisionsLineOf(count5) {
85086
86216
  function csvCellsOf(line) {
85087
86217
  const cells = [];
85088
86218
  let cell = "";
85089
- let quoted = false;
86219
+ let quoted2 = false;
85090
86220
  for (let at = 0; at < line.length; at += 1) {
85091
86221
  const char = line[at];
85092
- if (quoted && char === '"' && line[at + 1] === '"') {
86222
+ if (quoted2 && char === '"' && line[at + 1] === '"') {
85093
86223
  cell += '"';
85094
86224
  at += 1;
85095
86225
  } else if (char === '"') {
85096
- quoted = !quoted;
85097
- } else if (char === "," && !quoted) {
86226
+ quoted2 = !quoted2;
86227
+ } else if (char === "," && !quoted2) {
85098
86228
  cells.push(cell);
85099
86229
  cell = "";
85100
86230
  } else {
@@ -85211,9 +86341,9 @@ function feedFlagsOf({ args }) {
85211
86341
  }
85212
86342
 
85213
86343
  // src/services/feed-files.service.ts
85214
- import { readFile as readFile29 } from "node:fs/promises";
85215
- import { basename as basename4, resolve as resolve12 } from "node:path";
85216
- async function bytesOf2({
86344
+ import { readFile as readFile30 } from "node:fs/promises";
86345
+ import { basename as basename6, resolve as resolve12 } from "node:path";
86346
+ async function bytesOf3({
85217
86347
  context,
85218
86348
  source
85219
86349
  }) {
@@ -85228,7 +86358,7 @@ async function bytesOf2({
85228
86358
  async function downloaded({ context, url: url2 }) {
85229
86359
  const response = await context.fetcher(url2);
85230
86360
  if (!response.ok) throw new CliUsageError(`${url2} answered ${response.status}`);
85231
- const fileName = basename4(new URL(url2).pathname) || "file";
86361
+ const fileName = basename6(new URL(url2).pathname) || "file";
85232
86362
  const header = (response.headers.get("content-type") ?? "").split(";")[0]?.trim();
85233
86363
  return {
85234
86364
  fileName,
@@ -85238,11 +86368,11 @@ async function downloaded({ context, url: url2 }) {
85238
86368
  }
85239
86369
  async function local({ context, path }) {
85240
86370
  const full = resolve12(context.cwd, path);
85241
- const fileName = basename4(full);
86371
+ const fileName = basename6(full);
85242
86372
  return {
85243
86373
  fileName,
85244
86374
  contentType: contentTypeOf(fileName),
85245
- bytes: new Uint8Array(await readFile29(full))
86375
+ bytes: new Uint8Array(await readFile30(full))
85246
86376
  };
85247
86377
  }
85248
86378
  async function directWith({ client, to }) {
@@ -85270,7 +86400,7 @@ async function feedAttachmentIdsOf({
85270
86400
  throw new CliUsageError(`An item carries at most ${FEED_ATTACHMENTS_MAX} files`);
85271
86401
  }
85272
86402
  const files2 = [];
85273
- for (const source of sources) files2.push(await bytesOf2({ context, source }));
86403
+ for (const source of sources) files2.push(await bytesOf3({ context, source }));
85274
86404
  const target = channel || await directWith({ client, to: args.lists.to ?? [] });
85275
86405
  const ids = [];
85276
86406
  for (const file3 of files2) {
@@ -85324,10 +86454,10 @@ async function bodyOf2({
85324
86454
  flags: flags2
85325
86455
  }) {
85326
86456
  const body = { ...flags2.fields };
85327
- const read3 = (source) => "file" in source ? readFile30(resolve13(context.cwd, source.file), "utf8") : source.text;
85328
- for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read3(source);
86457
+ const read4 = (source) => "file" in source ? readFile31(resolve13(context.cwd, source.file), "utf8") : source.text;
86458
+ for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
85329
86459
  if (flags2.rich) {
85330
- const text2 = await read3(flags2.rich.source);
86460
+ const text2 = await read4(flags2.rich.source);
85331
86461
  try {
85332
86462
  body.rich = richBodyOf({ kind: flags2.rich.kind, text: text2 });
85333
86463
  } catch (error62) {
@@ -85406,10 +86536,10 @@ async function feedRead({ context, args }) {
85406
86536
  const itemId = args.words[2];
85407
86537
  if (!itemId) throw new CliUsageError(USAGE9);
85408
86538
  const { client } = await signedIn({ context, args });
85409
- const read3 = await client.post("/api/feed/items/read", { itemId });
85410
- printItem({ context, args, item: read3 });
85411
- if (!args.flags.json && read3.item.draft) context.out(`Draft:
85412
- ${read3.item.draft}
86539
+ const read4 = await client.post("/api/feed/items/read", { itemId });
86540
+ printItem({ context, args, item: read4 });
86541
+ if (!args.flags.json && read4.item.draft) context.out(`Draft:
86542
+ ${read4.item.draft}
85413
86543
  `);
85414
86544
  }
85415
86545
  async function feedInbox({ context, args }) {
@@ -85519,7 +86649,7 @@ async function textFlag({
85519
86649
  }) {
85520
86650
  const value = flagText({ args, name: name3 });
85521
86651
  if (!value.startsWith("@")) return value;
85522
- return readFile30(resolve13(context.cwd, value.slice(1)), "utf8");
86652
+ return readFile31(resolve13(context.cwd, value.slice(1)), "utf8");
85523
86653
  }
85524
86654
  async function feedList({ context, args }) {
85525
86655
  const { client } = await signedIn({ context, args });
@@ -85642,7 +86772,7 @@ async function feed({ context, args }) {
85642
86772
  }
85643
86773
 
85644
86774
  // src/services/github-commands.service.ts
85645
- import { readFile as readFile31 } from "node:fs/promises";
86775
+ import { readFile as readFile32 } from "node:fs/promises";
85646
86776
 
85647
86777
  // src/rules/github-signature.rules.ts
85648
86778
  var TURN_SEPARATOR = "~";
@@ -85712,7 +86842,7 @@ var REAL_GH = "/usr/bin/gh";
85712
86842
  var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Its owner sets one on the agent's settings page or with `laze agent set-github <agent> <connection>`.";
85713
86843
  async function turnFileToken({ env }) {
85714
86844
  if (!env.LAZE_TURN_FILE) return "";
85715
- return readFile31(env.LAZE_TURN_FILE, "utf8").then(
86845
+ return readFile32(env.LAZE_TURN_FILE, "utf8").then(
85716
86846
  (text2) => text2.trim(),
85717
86847
  () => ""
85718
86848
  );
@@ -85746,7 +86876,7 @@ async function githubGh({
85746
86876
  args: args.rest,
85747
86877
  agentName: profile.name ?? "An agent",
85748
86878
  threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
85749
- readBodyFile: (path) => path === "-" ? context.readStdin() : readFile31(path, "utf8")
86879
+ readBodyFile: (path) => path === "-" ? context.readStdin() : readFile32(path, "utf8")
85750
86880
  });
85751
86881
  return context.runCommand({
85752
86882
  command: [REAL_GH, ...ghArgs],
@@ -85845,7 +86975,7 @@ async function setAgentGithub({
85845
86975
  }
85846
86976
 
85847
86977
  // src/services/history-commands.service.ts
85848
- import { readFile as readFile32 } from "node:fs/promises";
86978
+ import { readFile as readFile33 } from "node:fs/promises";
85849
86979
 
85850
86980
  // src/rules/history-format.rules.ts
85851
86981
  function timeOf2(iso2) {
@@ -85941,7 +87071,7 @@ async function turnTokenOf4({ context }) {
85941
87071
  const pinned = env.LAZE_TURN_TOKEN?.trim();
85942
87072
  if (pinned) return pinned;
85943
87073
  if (!env.LAZE_TURN_FILE) return "";
85944
- return readFile32(env.LAZE_TURN_FILE, "utf8").then(
87074
+ return readFile33(env.LAZE_TURN_FILE, "utf8").then(
85945
87075
  (text2) => text2.trim(),
85946
87076
  () => ""
85947
87077
  );
@@ -85992,6 +87122,100 @@ async function history2({
85992
87122
  return 1;
85993
87123
  }
85994
87124
 
87125
+ // src/rules/invite-format.rules.ts
87126
+ function money2({ amount, currency: currency2 }) {
87127
+ return `${currency2.toUpperCase()} ${Number(amount.toFixed(2))}`;
87128
+ }
87129
+ function inviteQuoteText(quote4) {
87130
+ const at = (amount) => money2({ amount, currency: quote4.currency });
87131
+ const people2 = `${quote4.peopleAfter} ${quote4.peopleAfter === 1 ? "person" : "people"}`;
87132
+ const seats = quote4.freeSeatsLeft ? ` ${quote4.freeSeatsLeft} free ${quote4.freeSeatsLeft === 1 ? "seat" : "seats"} left.` : "";
87133
+ if (quote4.seatCap !== null && !quote4.upgradeNeeded) {
87134
+ return `Your plan holds ${quote4.seatCap} people, at no charge.
87135
+ `;
87136
+ }
87137
+ const price = `${at(quote4.monthlyAfter)} a month for ${people2} (${at(quote4.perPersonAfter)} per person).${seats}`;
87138
+ if (quote4.upgradeNeeded)
87139
+ return `Team: ${price} This starts Team, paid through Stripe Checkout.
87140
+ `;
87141
+ const change2 = quote4.monthlyAfter === quote4.monthlyNow ? "No change to your price." : `Was ${at(quote4.monthlyNow)}; the change is prorated as each person joins.`;
87142
+ return `New price: ${price} ${change2}
87143
+ `;
87144
+ }
87145
+
87146
+ // src/services/invite-commands.service.ts
87147
+ var INVITE_USAGE = "Usage: laze invite [--to <conversation>] [--role member|guest|admin|owner] [--yes] <email>...";
87148
+ var ROLES3 = {
87149
+ owner: "OWNER",
87150
+ admin: "ADMIN",
87151
+ member: "MEMBER",
87152
+ guest: "GUEST"
87153
+ };
87154
+ function inviteInput(args) {
87155
+ const emails = args.words.slice(1);
87156
+ const roleFlag = typeof args.flags.role === "string" ? args.flags.role.toLowerCase() : "member";
87157
+ const role2 = ROLES3[roleFlag];
87158
+ if (emails.length === 0 || !role2) throw new CliUsageError(INVITE_USAGE);
87159
+ const to = typeof args.flags.to === "string" ? args.flags.to : void 0;
87160
+ return { emails, role: role2, ...to ? { to } : {}, confirmed: true };
87161
+ }
87162
+ function refusedLines(refused) {
87163
+ const why = { invalid: "not an email address", duplicate: "listed twice", member: "already in" };
87164
+ return refused.map((one) => `Left out ${one.email}: ${why[one.reason]}.
87165
+ `).join("");
87166
+ }
87167
+ async function invite3({ context, args }) {
87168
+ const input2 = inviteInput(args);
87169
+ const { client } = await signedIn({ context, args });
87170
+ const quote4 = await client.post("/api/billing-account/invite-quote", {
87171
+ adding: input2.emails.length
87172
+ });
87173
+ if (!args.flags.yes) {
87174
+ context.out(`${inviteQuoteText(quote4)}Nothing was sent. Run it again with --yes to send.
87175
+ `);
87176
+ return;
87177
+ }
87178
+ let sent;
87179
+ try {
87180
+ sent = await client.post("/api/agents/me/workspace/invite-many", input2);
87181
+ } catch (error62) {
87182
+ if (!(error62 instanceof LazeApiError) || error62.status !== 403) throw error62;
87183
+ const asked = await client.post(
87184
+ "/api/agents/me/workspace/request-invites",
87185
+ input2
87186
+ );
87187
+ const approvers = asked.approvers.length > 0 ? asked.approvers.join(" or ") : "an admin";
87188
+ context.out(
87189
+ `${refusedLines(asked.refused)}Sent ${asked.requests.length} to ${approvers} for approval. The invitations go out once approved.
87190
+ `
87191
+ );
87192
+ return;
87193
+ }
87194
+ context.out(refusedLines(sent.refused));
87195
+ if (!quote4.upgradeNeeded) {
87196
+ context.out(`Invited ${sent.invites.length}.${sent.held ? " Some wait for seats." : ""}
87197
+ `);
87198
+ return;
87199
+ }
87200
+ const returnPath = sent.channelId ? `/workspaces/${quote4.workspaceId}?c=${encodeURIComponent(sent.channelId)}&invite=checkout` : `/workspaces/${quote4.workspaceId}?invite=checkout`;
87201
+ try {
87202
+ const { url: url2 } = await client.post("/api/billing-account/checkout", {
87203
+ currency: quote4.currency,
87204
+ returnPath
87205
+ });
87206
+ context.out(
87207
+ `Saved ${sent.invites.length} invitations for Team. Open this link to upgrade; they go out once it is paid: ${url2}
87208
+ `
87209
+ );
87210
+ } catch (error62) {
87211
+ if (!(error62 instanceof LazeApiError) || error62.status !== 403) throw error62;
87212
+ context.out(
87213
+ `Saved ${sent.invites.length} invitations for Team. An admin has to upgrade the workspace (laze billing checkout) before they go out.
87214
+ `
87215
+ );
87216
+ }
87217
+ }
87218
+
85995
87219
  // src/services/ip-commands.service.ts
85996
87220
  var IP_USAGE = `Usage:
85997
87221
  laze ip [status] [--json] your dedicated IP: on or off, country, address, domains
@@ -86108,9 +87332,9 @@ async function list7({ context, args }) {
86108
87332
  const answer5 = await client.get(DEDICATED_IP_REST_PATHS.all);
86109
87333
  if (args.flags.json) return printJson7(context, answer5);
86110
87334
  if (answer5.ips.length === 0) return context.out("No one has a dedicated IP.\n");
86111
- const money2 = (amount) => `${amount} ${answer5.currency.toUpperCase()}`;
87335
+ const money3 = (amount) => `${amount} ${answer5.currency.toUpperCase()}`;
86112
87336
  const lines2 = answer5.ips.map(
86113
- (one) => ` ${one.ownerName} ${one.country.name} ${one.state === "on" ? "on" : "being bought"} ${money2(one.monthlyPrice)} a month`
87337
+ (one) => ` ${one.ownerName} ${one.country.name} ${one.state === "on" ? "on" : "being bought"} ${money3(one.monthlyPrice)} a month`
86114
87338
  );
86115
87339
  context.out(`Dedicated IPs:
86116
87340
  ${lines2.join("\n")}
@@ -86133,19 +87357,19 @@ async function ip({ context, args }) {
86133
87357
  }
86134
87358
 
86135
87359
  // src/services/join-commands.service.ts
86136
- import { mkdir as mkdir20, readFile as readFile33, rename as rename6, rm as rm11, writeFile as writeFile20 } from "node:fs/promises";
86137
- import { dirname as dirname19, join as join23 } from "node:path";
87360
+ import { mkdir as mkdir20, readFile as readFile34, rename as rename6, rm as rm11, writeFile as writeFile20 } from "node:fs/promises";
87361
+ import { dirname as dirname19, join as join24 } from "node:path";
86138
87362
  var DEFAULT_WAIT_SECONDS2 = 100;
86139
87363
  var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
86140
87364
  function pendingPathOf({ context }) {
86141
- return join23(dirname19(context.environment.configPath), "join", "pending.json");
87365
+ return join24(dirname19(context.environment.configPath), "join", "pending.json");
86142
87366
  }
86143
87367
  async function readPending({
86144
87368
  context,
86145
87369
  url: url2,
86146
87370
  args
86147
87371
  }) {
86148
- const pending2 = await readFile33(pendingPathOf({ context }), "utf8").then(
87372
+ const pending2 = await readFile34(pendingPathOf({ context }), "utf8").then(
86149
87373
  (text2) => JSON.parse(text2),
86150
87374
  () => void 0
86151
87375
  );
@@ -86865,8 +88089,14 @@ function withLocalTools(answer5) {
86865
88089
  if (!Array.isArray(result.tools)) return answer5;
86866
88090
  return { ...recordOf3(answer5), result: { ...result, tools: [...TOOLS, ...result.tools] } };
86867
88091
  }
86868
- function refusedLines({ message: message2, status: status9 }) {
86869
- const reason = status9 === 401 ? "Laze refused this key: run `laze login` or link the agent again" : `Laze answered ${status9}`;
88092
+ function refusedLines2({
88093
+ message: message2,
88094
+ status: status9,
88095
+ text: text2
88096
+ }) {
88097
+ const migrated = status9 === 401 ? migratedNoticeOf(apiErrorOf({ status: status9, text: text2 })) : void 0;
88098
+ const refused = status9 === 401 ? "Laze refused this key: run `laze login` or link the agent again" : `Laze answered ${status9}`;
88099
+ const reason = migrated?.notice ?? refused;
86870
88100
  const errors = idsOf(message2).map((id2) => ({
86871
88101
  jsonrpc: "2.0",
86872
88102
  id: id2,
@@ -86916,7 +88146,7 @@ async function answerLine({
86916
88146
  }
86917
88147
  const answer5 = await client.forward({ path: REMOTE_MCP_PATH, body: line });
86918
88148
  if (answer5.status < 200 || answer5.status >= 300) {
86919
- return refusedLines({ message: message2, status: answer5.status });
88149
+ return refusedLines2({ message: message2, status: answer5.status, text: answer5.text });
86920
88150
  }
86921
88151
  const replied = repliedTo({ request: request2 });
86922
88152
  if (replied)
@@ -86979,14 +88209,14 @@ async function serveMcp({
86979
88209
  }
86980
88210
 
86981
88211
  // src/services/mount-files.service.ts
86982
- import { mkdir as mkdir21, readFile as readFile34, rm as rm12, writeFile as writeFile21 } from "node:fs/promises";
88212
+ import { mkdir as mkdir21, readFile as readFile35, rm as rm12, writeFile as writeFile21 } from "node:fs/promises";
86983
88213
  import { dirname as dirname20, relative as relative5, resolve as resolve14 } from "node:path";
86984
88214
  async function textArgument({
86985
88215
  context,
86986
88216
  value
86987
88217
  }) {
86988
88218
  if (value === "-") return context.readStdin();
86989
- if (value.startsWith("@")) return readFile34(resolve14(context.cwd, value.slice(1)), "utf8");
88219
+ if (value.startsWith("@")) return readFile35(resolve14(context.cwd, value.slice(1)), "utf8");
86990
88220
  return value;
86991
88221
  }
86992
88222
  function turnChannel({ context, args }) {
@@ -87269,7 +88499,7 @@ async function models({ context, args }) {
87269
88499
 
87270
88500
  // src/services/monitor-commands.service.ts
87271
88501
  var ADD_USAGE = "Usage: laze monitor add <name> --channel '#support-*' --prompt '<what to do>' [--from anyone|people|slack] [--not-from bots] [--thread roots-only] [--matches '<pattern>'] [--max-runs-per-day <n>] [--agent <name>]";
87272
- function agentOf(args) {
88502
+ function agentOf2(args) {
87273
88503
  const agent2 = flagText({ args, name: "agent" });
87274
88504
  return agent2 ? { agent: agent2 } : {};
87275
88505
  }
@@ -87290,7 +88520,7 @@ async function monitorAdd({ context, args }) {
87290
88520
  if (maxRuns && !/^\d+$/.test(maxRuns)) throw new CliUsageError(ADD_USAGE);
87291
88521
  const { client } = await signedIn({ context, args });
87292
88522
  const added = await client.post("/api/agents/monitors", {
87293
- ...agentOf(args),
88523
+ ...agentOf2(args),
87294
88524
  name: name3,
87295
88525
  channels: channels3,
87296
88526
  prompt,
@@ -87326,7 +88556,7 @@ function stateRun(path, verb) {
87326
88556
  if (!name3) throw new CliUsageError(`Usage: laze monitor ${verb} <name> [--agent <name>]`);
87327
88557
  const { client } = await signedIn({ context, args });
87328
88558
  const answer5 = await client.post(path, {
87329
- ...agentOf(args),
88559
+ ...agentOf2(args),
87330
88560
  name: name3
87331
88561
  });
87332
88562
  if (args.flags.json) return context.out(`${JSON.stringify(answer5, null, 2)}
@@ -87665,8 +88895,8 @@ ${OPS_USAGE}`);
87665
88895
  }
87666
88896
 
87667
88897
  // src/services/release-watch.service.ts
87668
- import { mkdir as mkdir22, readFile as readFile35, realpath, writeFile as writeFile22 } from "node:fs/promises";
87669
- import { dirname as dirname21, join as join24 } from "node:path";
88898
+ import { mkdir as mkdir22, readFile as readFile36, realpath, writeFile as writeFile22 } from "node:fs/promises";
88899
+ import { dirname as dirname21, join as join25 } from "node:path";
87670
88900
 
87671
88901
  // src/rules/cli-update.rules.ts
87672
88902
  var CLI_PACKAGE = "@lazehq/cli";
@@ -87813,15 +89043,15 @@ async function startedUpdate({
87813
89043
  const plan2 = updatePlanOf({ script: await scriptOf(context) });
87814
89044
  if (plan2.kind !== "install") return null;
87815
89045
  const folder = dirname21(context.environment.configPath);
87816
- const stamp = join24(folder, "auto-update.json");
87817
- const last = await readFile35(stamp, "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
89046
+ const stamp = join25(folder, "auto-update.json");
89047
+ const last = await readFile36(stamp, "utf8").then((text2) => JSON.parse(text2)).catch(() => null);
87818
89048
  const now = context.nowMs();
87819
89049
  if (last?.server === server && now - last.atMs < RETRY_AFTER_MS) return null;
87820
89050
  await mkdir22(folder, { recursive: true, mode: 448 });
87821
89051
  await writeFile22(stamp, JSON.stringify({ server, atMs: now }), { mode: 384 });
87822
89052
  context.processes.spawnDetached({
87823
89053
  argv: [...context.program, "update"],
87824
- logPath: join24(folder, "auto-update.log")
89054
+ logPath: join25(folder, "auto-update.log")
87825
89055
  });
87826
89056
  return { manager: plan2.manager };
87827
89057
  }
@@ -87858,7 +89088,7 @@ function watchingRelease({
87858
89088
  }
87859
89089
 
87860
89090
  // src/services/rush-guard.service.ts
87861
- import { readFile as readFile36, rm as rm13 } from "node:fs/promises";
89091
+ import { readFile as readFile37, rm as rm13 } from "node:fs/promises";
87862
89092
  var WATCH_MS3 = 2e3;
87863
89093
  var RETRY_MS2 = 3e4;
87864
89094
  async function guardRound(guard) {
@@ -87901,7 +89131,7 @@ async function rushWakeHook({ context, args }) {
87901
89131
  while (context.processes.alive(claudePid)) await context.sleep(WATCH_MS3);
87902
89132
  const { client, name: name3 } = await signedIn({ context, args });
87903
89133
  const noted = statePathOf({ context, kind: "sessions", profile: String(claudePid) });
87904
- const note = await readFile36(noted, "utf8").then(
89134
+ const note = await readFile37(noted, "utf8").then(
87905
89135
  (text2) => JSON.parse(text2),
87906
89136
  () => void 0
87907
89137
  );
@@ -87914,6 +89144,12 @@ async function rushWakeHook({ context, args }) {
87914
89144
  try {
87915
89145
  while (context.nowMs() < deadline) {
87916
89146
  const done = await guardRound(guard).catch((error62) => {
89147
+ const migrated = migratedNoticeOf(error62);
89148
+ if (migrated) {
89149
+ context.err(`${migrated.notice}
89150
+ `);
89151
+ return true;
89152
+ }
87917
89153
  context.err(`laze: the rush guard will try again: ${String(error62)}
87918
89154
  `);
87919
89155
  return "failed";
@@ -88070,8 +89306,8 @@ async function schedule({ context, args }) {
88070
89306
  }
88071
89307
 
88072
89308
  // src/services/skill-commands.service.ts
88073
- import { readdir as readdir7, readFile as readFile37 } from "node:fs/promises";
88074
- import { join as join25, relative as relative6, resolve as resolve16 } from "node:path";
89309
+ import { readdir as readdir7, readFile as readFile38 } from "node:fs/promises";
89310
+ import { join as join26, relative as relative6, resolve as resolve16 } from "node:path";
88075
89311
  var USAGE15 = `Usage:
88076
89312
  laze skill list [--agent <agentId>]
88077
89313
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -88092,8 +89328,8 @@ async function folderFiles({ root }) {
88092
89328
  const files2 = [];
88093
89329
  for (const entry of entries) {
88094
89330
  if (!entry.isFile()) continue;
88095
- const full = join25(entry.parentPath, entry.name);
88096
- files2.push({ path: relative6(root, full), content: await readFile37(full, "utf8") });
89331
+ const full = join26(entry.parentPath, entry.name);
89332
+ files2.push({ path: relative6(root, full), content: await readFile38(full, "utf8") });
88097
89333
  }
88098
89334
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
88099
89335
  }
@@ -88191,7 +89427,7 @@ async function skillUpdate({ context, args }) {
88191
89427
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
88192
89428
  throw new CliUsageError(USAGE15);
88193
89429
  }
88194
- const skillMd = skillMdFile ? await readFile37(resolve16(context.cwd, skillMdFile), "utf8") : void 0;
89430
+ const skillMd = skillMdFile ? await readFile38(resolve16(context.cwd, skillMdFile), "utf8") : void 0;
88195
89431
  const { client } = await signedIn({ context, args });
88196
89432
  const updated = await client.post("/api/skills/update", {
88197
89433
  name: name3,
@@ -88237,7 +89473,7 @@ async function skill({ context, args }) {
88237
89473
  }
88238
89474
 
88239
89475
  // src/services/slack-commands.service.ts
88240
- import { readFile as readFile38 } from "node:fs/promises";
89476
+ import { readFile as readFile39 } from "node:fs/promises";
88241
89477
  import { resolve as resolve17 } from "node:path";
88242
89478
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
88243
89479
  laze slack overview connected Slack workspaces, mirrors, your link
@@ -88285,7 +89521,7 @@ async function secretLines({ context, args }) {
88285
89521
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
88286
89522
  }
88287
89523
  const file3 = flagText({ args, name: "from-file" });
88288
- const text2 = file3 ? await readFile38(resolve17(context.cwd, file3), "utf8") : await context.readStdin();
89524
+ const text2 = file3 ? await readFile39(resolve17(context.cwd, file3), "utf8") : await context.readStdin();
88289
89525
  return text2.split("\n").map((line) => line.trim()).filter(Boolean);
88290
89526
  }
88291
89527
  async function secretsOf2({
@@ -88516,14 +89752,14 @@ function moveBody(args) {
88516
89752
  const name3 = flagText({ args, name: "name" });
88517
89753
  if (ids.length === 0 || name3 && ids.length > 1) throw new CliUsageError(SLACK_USAGE);
88518
89754
  const farewell = flagText({ args, name: "farewell" });
88519
- const invite3 = args.lists.invite ?? [];
89755
+ const invite4 = args.lists.invite ?? [];
88520
89756
  return {
88521
89757
  teamId: wordAt8(args, 2),
88522
89758
  channels: ids.map((slackChannelId) => ({
88523
89759
  slackChannelId,
88524
89760
  ...name3 && { name: name3 },
88525
89761
  ...farewell && { farewell },
88526
- invite: invite3
89762
+ invite: invite4
88527
89763
  }))
88528
89764
  };
88529
89765
  }
@@ -88589,7 +89825,7 @@ async function slack({
88589
89825
  }
88590
89826
 
88591
89827
  // src/services/sso-commands.service.ts
88592
- import { readFile as readFile39 } from "node:fs/promises";
89828
+ import { readFile as readFile40 } from "node:fs/promises";
88593
89829
  var SSO_USAGE = `Usage:
88594
89830
  laze sso domains claimed domains and how each signs in (admins)
88595
89831
  laze sso claim <domain> the TXT record that proves the domain
@@ -88676,7 +89912,7 @@ function refuseSecretFlags({ args }) {
88676
89912
  }
88677
89913
  async function clientSecretOf({ context, args }) {
88678
89914
  const file3 = flagText({ args, name: "from-file" });
88679
- const text2 = file3 ? await readFile39(file3, "utf8") : await context.readStdin();
89915
+ const text2 = file3 ? await readFile40(file3, "utf8") : await context.readStdin();
88680
89916
  const secret = text2.trim();
88681
89917
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
88682
89918
  return secret;
@@ -88935,8 +90171,8 @@ async function releaseAgeSettingsOf({
88935
90171
  manager
88936
90172
  }) {
88937
90173
  const settings3 = [];
88938
- for (const { setting, read: read3 } of RELEASE_AGE_SETTINGS[manager] ?? []) {
88939
- const value = settingValueOf({ printed: await printedBy({ context, command: read3 }) ?? "" });
90174
+ for (const { setting, read: read4 } of RELEASE_AGE_SETTINGS[manager] ?? []) {
90175
+ const value = settingValueOf({ printed: await printedBy({ context, command: read4 }) ?? "" });
88940
90176
  if (value) settings3.push(`${setting}=${value}`);
88941
90177
  }
88942
90178
  return settings3;
@@ -89008,8 +90244,8 @@ async function update2({
89008
90244
  }
89009
90245
 
89010
90246
  // src/services/vault-env-commands.service.ts
89011
- import { readFile as readFile40, stat as stat6 } from "node:fs/promises";
89012
- import { dirname as dirname22, join as join26, resolve as resolve18 } from "node:path";
90247
+ import { readFile as readFile41, stat as stat7 } from "node:fs/promises";
90248
+ import { dirname as dirname22, join as join27, resolve as resolve18 } from "node:path";
89013
90249
 
89014
90250
  // src/rules/vault-manifest.rules.ts
89015
90251
  var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -89279,15 +90515,15 @@ async function valuesOf({
89279
90515
  return { exitCode: refused };
89280
90516
  }
89281
90517
  const opened = /* @__PURE__ */ new Map();
89282
- let keep = false;
90518
+ let keep2 = false;
89283
90519
  for (const [key, release2] of settled2) {
89284
90520
  if (release2.outcome !== "allow") continue;
89285
90521
  opened.set(key, await envOf({ release: release2, run: run4 }));
89286
- if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep = true;
90522
+ if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
89287
90523
  if (release2.message) context.err(`${release2.message}
89288
90524
  `);
89289
90525
  }
89290
- if (!keep) await rm14(keyPath, { force: true });
90526
+ if (!keep2) await rm14(keyPath, { force: true });
89291
90527
  const released = /* @__PURE__ */ new Map();
89292
90528
  for (const entry of entries) {
89293
90529
  const fields = opened.get(keyOf(entry));
@@ -89340,7 +90576,7 @@ function refusedReason({
89340
90576
  return VAULT_EXIT_BAD_REASON;
89341
90577
  }
89342
90578
  async function isFile(path) {
89343
- return stat6(path).then(
90579
+ return stat7(path).then(
89344
90580
  (found) => found.isFile(),
89345
90581
  () => false
89346
90582
  );
@@ -89354,7 +90590,7 @@ async function manifestPathOf({
89354
90590
  const environment = flagText({ args, name: "env" });
89355
90591
  const file3 = environment ? `.env.${environment}.vault` : ".env.vault";
89356
90592
  for (let dir = resolve18(context.cwd); ; dir = dirname22(dir)) {
89357
- if (await isFile(join26(dir, file3))) return join26(dir, file3);
90593
+ if (await isFile(join27(dir, file3))) return join27(dir, file3);
89358
90594
  if (dirname22(dir) === dir) break;
89359
90595
  }
89360
90596
  throw new CliUsageError(`laze vault: no ${file3} here or in a parent folder
@@ -89365,7 +90601,7 @@ async function manifestOf({
89365
90601
  args
89366
90602
  }) {
89367
90603
  const file3 = await manifestPathOf({ context, args });
89368
- const text2 = await readFile40(file3, "utf8").catch(() => {
90604
+ const text2 = await readFile41(file3, "utf8").catch(() => {
89369
90605
  throw new CliUsageError(`laze vault: cannot read ${file3}`);
89370
90606
  });
89371
90607
  return { file: file3, lines: parseManifest({ text: text2, file: file3 }) };
@@ -89596,7 +90832,7 @@ async function vaultScrub({ context, args }) {
89596
90832
  }
89597
90833
 
89598
90834
  // src/services/whatsapp-business-commands.service.ts
89599
- import { readFile as readFile41 } from "node:fs/promises";
90835
+ import { readFile as readFile42 } from "node:fs/promises";
89600
90836
  import { resolve as resolve19 } from "node:path";
89601
90837
 
89602
90838
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
@@ -89644,8 +90880,8 @@ var WHATSAPP_BUSINESS_REST_PATHS = {
89644
90880
  var WHATSAPP_BUSINESS_TEXT_MAX = 4096;
89645
90881
  var WHATSAPP_BUSINESS_LIMIT_MAX = 200;
89646
90882
  var WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS = 50;
89647
- var workspaceIdSchema22 = external_exports.string().min(1).max(64);
89648
- var workspaceInput6 = external_exports.object({ workspaceId: workspaceIdSchema22 });
90883
+ var workspaceIdSchema23 = external_exports.string().min(1).max(64);
90884
+ var workspaceInput6 = external_exports.object({ workspaceId: workspaceIdSchema23 });
89649
90885
  var digits = (what) => external_exports.string().trim().regex(/^\d{5,30}$/, `${what} is the number Meta shows, digits only`);
89650
90886
  var appSecretSchema = external_exports.string().trim().regex(/^[a-f0-9]{32}$/i, "The app secret is 32 letters and digits from App settings > Basic");
89651
90887
  var accessTokenSchema = external_exports.string().trim().min(20, "The access token is the long permanent system user token").max(2e3).regex(/^\S+$/, "The access token is one line with no spaces");
@@ -89679,7 +90915,7 @@ var statusDefinition = external_exports.object({
89679
90915
  });
89680
90916
  var whatsappBusinessStatusSchema = statusDefinition;
89681
90917
  var connectDefinition = external_exports.object({
89682
- workspaceId: workspaceIdSchema22,
90918
+ workspaceId: workspaceIdSchema23,
89683
90919
  appId: digits("The app id"),
89684
90920
  wabaId: digits("The WhatsApp Business Account id"),
89685
90921
  phoneNumberId: digits("The phone number id"),
@@ -89702,7 +90938,7 @@ var webhookDefinition = external_exports.object({
89702
90938
  });
89703
90939
  var whatsappBusinessWebhookSchema = webhookDefinition;
89704
90940
  var settingsDefinition3 = external_exports.object({
89705
- workspaceId: workspaceIdSchema22,
90941
+ workspaceId: workspaceIdSchema23,
89706
90942
  /** The agent that answers; null for none. Left out keeps the current one. */
89707
90943
  agentId: external_exports.string().min(1).max(64).nullable().optional(),
89708
90944
  replyMode: whatsappBusinessReplyModeSchema.optional()
@@ -89722,7 +90958,7 @@ var whatsappBusinessConversationSchema = conversationDefinition;
89722
90958
  var limitSchema2 = external_exports.number().int().min(1).max(WHATSAPP_BUSINESS_LIMIT_MAX);
89723
90959
  var contactRefSchema = external_exports.string().trim().min(1).max(64);
89724
90960
  var conversationsInputDefinition = external_exports.object({
89725
- workspaceId: workspaceIdSchema22,
90961
+ workspaceId: workspaceIdSchema23,
89726
90962
  limit: limitSchema2.optional()
89727
90963
  });
89728
90964
  var whatsappBusinessConversationsInputSchema = conversationsInputDefinition;
@@ -89748,7 +90984,7 @@ var messageDefinition2 = external_exports.object({
89748
90984
  template: external_exports.string().nullable()
89749
90985
  });
89750
90986
  var readInputDefinition2 = external_exports.object({
89751
- workspaceId: workspaceIdSchema22,
90987
+ workspaceId: workspaceIdSchema23,
89752
90988
  contact: contactRefSchema,
89753
90989
  limit: limitSchema2.optional()
89754
90990
  });
@@ -89757,12 +90993,12 @@ var readDefinition = external_exports.object({
89757
90993
  messages: external_exports.array(messageDefinition2)
89758
90994
  });
89759
90995
  var sendInputDefinition2 = external_exports.object({
89760
- workspaceId: workspaceIdSchema22,
90996
+ workspaceId: workspaceIdSchema23,
89761
90997
  to: contactRefSchema,
89762
90998
  text: external_exports.string().trim().min(1).max(WHATSAPP_BUSINESS_TEXT_MAX)
89763
90999
  });
89764
91000
  var sendTemplateInputDefinition = external_exports.object({
89765
- workspaceId: workspaceIdSchema22,
91001
+ workspaceId: workspaceIdSchema23,
89766
91002
  to: contactRefSchema,
89767
91003
  template: external_exports.string().trim().min(1).max(512),
89768
91004
  /** The template's language code; the only approved one when left out. */
@@ -89789,7 +91025,7 @@ function whatsappBusinessSendSettled({
89789
91025
  return state !== "waiting" && state !== "sending";
89790
91026
  }
89791
91027
  var sendStatusInputDefinition2 = external_exports.object({
89792
- workspaceId: workspaceIdSchema22,
91028
+ workspaceId: workspaceIdSchema23,
89793
91029
  sendId: external_exports.string().min(1).max(64),
89794
91030
  waitSeconds: external_exports.number().int().min(0).max(WHATSAPP_BUSINESS_STATUS_WAIT_MAX_SECONDS).default(0)
89795
91031
  });
@@ -89839,7 +91075,7 @@ var restSendStatusDefinition2 = sendStatusInputDefinition2.omit({ workspaceId: t
89839
91075
  var restSettingsDefinition = settingsDefinition3.omit({ workspaceId: true });
89840
91076
  var restEmptyDefinition = external_exports.object({});
89841
91077
  var WhatsappBusinessApi = moduleApi()("whatsapp-business");
89842
- var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("connect").withInput(connectWhatsappBusinessInputSchema).withOutput(whatsappBusinessWebhookSchema).mutation("check").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("verifyToken").withInput(workspaceInput6).withOutput(whatsappBusinessWebhookSchema).mutation("settings").withInput(updateWhatsappBusinessSettingsInputSchema).withOutput(whatsappBusinessStatusSchema).mutation("disconnect").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).query("conversations").withInput(whatsappBusinessConversationsInputSchema).withOutput(external_exports.array(whatsappBusinessConversationSchema)).query("templates").withInput(workspaceInput6).withOutput(external_exports.array(whatsappBusinessTemplateSchema)).query("prices").withInput(external_exports.object({ ...pricesInputDefinition.shape, workspaceId: workspaceIdSchema22 })).withOutput(whatsappBusinessPricesSchema).build();
91078
+ var whatsappBusinessTrpc = defineTrpcContract("whatsappBusiness").query("status").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("connect").withInput(connectWhatsappBusinessInputSchema).withOutput(whatsappBusinessWebhookSchema).mutation("check").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).mutation("verifyToken").withInput(workspaceInput6).withOutput(whatsappBusinessWebhookSchema).mutation("settings").withInput(updateWhatsappBusinessSettingsInputSchema).withOutput(whatsappBusinessStatusSchema).mutation("disconnect").withInput(workspaceInput6).withOutput(whatsappBusinessStatusSchema).query("conversations").withInput(whatsappBusinessConversationsInputSchema).withOutput(external_exports.array(whatsappBusinessConversationSchema)).query("templates").withInput(workspaceInput6).withOutput(external_exports.array(whatsappBusinessTemplateSchema)).query("prices").withInput(external_exports.object({ ...pricesInputDefinition.shape, workspaceId: workspaceIdSchema23 })).withOutput(whatsappBusinessPricesSchema).build();
89843
91079
 
89844
91080
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.config.ts
89845
91081
  var whatsappBusinessConfig = Config.define((c) => ({
@@ -90016,7 +91252,7 @@ async function secretsOf3({ context, args }) {
90016
91252
  const fromConnection = flagText({ args, name: "from-vault" });
90017
91253
  if (fromConnection) return { fromConnection };
90018
91254
  const file3 = flagText({ args, name: "from-file" });
90019
- const text2 = file3 ? await readFile41(resolve19(context.cwd, file3), "utf8") : await context.readStdin();
91255
+ const text2 = file3 ? await readFile42(resolve19(context.cwd, file3), "utf8") : await context.readStdin();
90020
91256
  const lines2 = text2.split("\n").map((line) => line.trim()).filter(Boolean);
90021
91257
  if (lines2.length !== 2) {
90022
91258
  throw new CliUsageError(
@@ -90049,7 +91285,7 @@ var conversations = async ({ context, args, client }) => {
90049
91285
  `);
90050
91286
  }
90051
91287
  };
90052
- var read = async ({ context, args, client }) => {
91288
+ var read2 = async ({ context, args, client }) => {
90053
91289
  const answer5 = await client.post(WHATSAPP_BUSINESS_REST_PATHS.read, {
90054
91290
  contact: wordAt9(args, 2),
90055
91291
  ...limitOf4(args)
@@ -90193,7 +91429,7 @@ var disconnect5 = async ({ context, args, client }) => {
90193
91429
  var RUNS6 = {
90194
91430
  status: status7,
90195
91431
  conversations,
90196
- read,
91432
+ read: read2,
90197
91433
  send: send3,
90198
91434
  "send-template": sendTemplate,
90199
91435
  "send-status": sendStatus,
@@ -90268,7 +91504,7 @@ async function pairing({ context, args }) {
90268
91504
  });
90269
91505
  await report2({ context, args, pairing: answer5 });
90270
91506
  }
90271
- async function cancel2({ context, args }) {
91507
+ async function cancel3({ context, args }) {
90272
91508
  const pairingId = wordAt10({ args, at: 2 });
90273
91509
  const client = await computeClient({ context, args });
90274
91510
  const answer5 = await client.post(COMPUTE_WHATSAPP_REST_PATHS.cancelPairing, {
@@ -90288,7 +91524,7 @@ async function unpair({ context, args }) {
90288
91524
  context.out(`WhatsApp is unlinked from ${answer5.name}.
90289
91525
  `);
90290
91526
  }
90291
- var COMMANDS2 = { pair, pairing, cancel: cancel2, unpair };
91527
+ var COMMANDS2 = { pair, pairing, cancel: cancel3, unpair };
90292
91528
  function whatsappPairingCommand(name3) {
90293
91529
  return name3 && Object.hasOwn(COMMANDS2, name3) ? COMMANDS2[name3] : void 0;
90294
91530
  }
@@ -90342,7 +91578,7 @@ async function chats({ context, args }) {
90342
91578
  );
90343
91579
  }
90344
91580
  }
90345
- async function read2({ context, args }) {
91581
+ async function read3({ context, args }) {
90346
91582
  const client = await computeClient({ context, args });
90347
91583
  const answer5 = await client.post(
90348
91584
  PATHS3.read,
@@ -90407,7 +91643,7 @@ async function whatsapp({
90407
91643
  }) {
90408
91644
  const command = args.words[1];
90409
91645
  if (command === "chats") return chats({ context, args });
90410
- if (command === "read") return read2({ context, args });
91646
+ if (command === "read") return read3({ context, args });
90411
91647
  if (command === "send") return send4({ context, args });
90412
91648
  if (command === "status") return status8({ context, args });
90413
91649
  const linking = whatsappPairingCommand(command);
@@ -90639,6 +91875,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
90639
91875
  laze workspace leave leave this workspace
90640
91876
  laze workspace delete --confirm <name> | cancel-deletion schedule its deletion, or take it back (Owners)
90641
91877
  laze members the workspace's people, each with their role
91878
+ laze invite [--to <conversation>] [--yes] <email>... invite people to a chat; shows the price first
90642
91879
  laze members invite <email> [--role owner|admin|member|guest] invite someone (admins)
90643
91880
  laze members invites | revoke-invite <email|id> invitations waiting, or take one back (admins)
90644
91881
  laze members invite-link <email|id> a fresh link for an invitation, shown once (admins)
@@ -90750,6 +91987,12 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
90750
91987
  laze agent retry <agent> --channel <id> --message <id> Try again on its failed turn on that message
90751
91988
  laze agent invite [--name <name>] [--channel <id>] a one-time link that connects a new agent;
90752
91989
  without --name the agent picks its own
91990
+ laze agent invite --reconnect <agent> a link that connects one of your agents again with a new key,
91991
+ a migrated one back on its own machine
91992
+ laze agent migrate <agent> [--to claude-code|codex|laze-models] [--level fast|frontier] [--resend]
91993
+ move your connected agent into Laze as the same agent; its session uploads its conversation, secrets removed
91994
+ laze agent migrate status|cancel <agent> the latest migration, or cancel one still waiting
91995
+ laze agent migrate upload <migrationId> run inside the agent's own session: hands its transcript to Laze
90753
91996
  laze agent faces every agent's sloth seed or picture
90754
91997
  laze adopt codex [--thread <id>] answer Laze messages in a Codex thread
90755
91998
  laze adopt codex --status | --stop the background adopt that laze agent link started
@@ -90852,6 +92095,7 @@ var COMMANDS3 = {
90852
92095
  workspaces,
90853
92096
  workspace,
90854
92097
  members: members2,
92098
+ invite: invite3,
90855
92099
  update: update2,
90856
92100
  "channels list": listChannels,
90857
92101
  "channel set": setChannelLevel,
@@ -91015,6 +92259,7 @@ var COMMANDS3 = {
91015
92259
  "agent retry": retryAgentTurn,
91016
92260
  "agent disconnect": disconnectAgent,
91017
92261
  "agent invite": inviteAgent,
92262
+ "agent migrate": agentMigrate,
91018
92263
  "mcp gateway": serveMcpGateway,
91019
92264
  mcp: (input2) => serveMcp({ ...input2, runCommandLine: runCli })
91020
92265
  };
@@ -91058,7 +92303,8 @@ async function runCli({
91058
92303
  [browser, `${BROWSER_USAGE}
91059
92304
  `],
91060
92305
  [external, `${EXTERNAL_USAGE}
91061
- `]
92306
+ `],
92307
+ [agentMigrate, MIGRATE_USAGE]
91062
92308
  ]);
91063
92309
  if (command && args.flags.help && ownHelp.has(command)) {
91064
92310
  context.out(ownHelp.get(command) ?? HELP);
@@ -91072,19 +92318,26 @@ async function runCli({
91072
92318
  const quiet = args.words[0] === "hook";
91073
92319
  return await command({ context: watchingRelease({ context, quiet }), args }) ?? 0;
91074
92320
  } catch (error62) {
91075
- if (error62 instanceof CliUsageError) context.err(`${error62.message}
92321
+ return exitCodeOf({ context, error: error62 });
92322
+ }
92323
+ }
92324
+ function exitCodeOf({ context, error: error62 }) {
92325
+ if (error62 instanceof ProfileMigratedError) return 0;
92326
+ const migrated = migratedNoticeOf(error62);
92327
+ if (migrated) context.err(`${migrated.notice}
91076
92328
  `);
91077
- else if (error62 instanceof LazeApiError) context.err(`laze: ${error62.message} (${error62.code})
92329
+ else if (error62 instanceof CliUsageError) context.err(`${error62.message}
91078
92330
  `);
91079
- else throw error62;
91080
- return 1;
91081
- }
92331
+ else if (error62 instanceof LazeApiError) context.err(`laze: ${error62.message} (${error62.code})
92332
+ `);
92333
+ else throw error62;
92334
+ return 1;
91082
92335
  }
91083
92336
 
91084
92337
  // src/services/processes.service.ts
91085
92338
  import { execFile as execFile2, spawn as spawn4 } from "node:child_process";
91086
92339
  import { mkdirSync, openSync } from "node:fs";
91087
- import { readFile as readFile42, readlink } from "node:fs/promises";
92340
+ import { readFile as readFile43, readlink } from "node:fs/promises";
91088
92341
  import { dirname as dirname23 } from "node:path";
91089
92342
  import { promisify as promisify2 } from "node:util";
91090
92343
  var run3 = promisify2(execFile2);
@@ -91098,15 +92351,15 @@ function alive(pid) {
91098
92351
  }
91099
92352
  }
91100
92353
  async function argsOf(pid) {
91101
- const raw = await readFile42(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
92354
+ const raw = await readFile43(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
91102
92355
  if (raw) return raw.split("\0").filter(Boolean);
91103
92356
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
91104
92357
  const line = listed?.stdout.trim();
91105
92358
  return line ? line.split(/\s+/) : void 0;
91106
92359
  }
91107
92360
  async function parentOf(pid) {
91108
- const stat7 = await readFile42(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
91109
- const fromStat = stat7 ? Number(stat7.slice(stat7.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
92361
+ const stat8 = await readFile43(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
92362
+ const fromStat = stat8 ? Number(stat8.slice(stat8.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
91110
92363
  if (fromStat > 0) return fromStat;
91111
92364
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
91112
92365
  const parent = Number(listed?.stdout.trim());