@lazehq/cli 0.1.130 → 0.1.132

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 +462 -365
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -19486,7 +19486,7 @@ var require_snapshot_utils = __commonJS({
19486
19486
  var require_snapshot_recorder = __commonJS({
19487
19487
  "../../node_modules/.pnpm/undici@8.10.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
19488
19488
  "use strict";
19489
- var { writeFile: writeFile12, readFile: readFile40, mkdir: mkdir14 } = __require("node:fs/promises");
19489
+ var { writeFile: writeFile12, readFile: readFile39, mkdir: mkdir14 } = __require("node:fs/promises");
19490
19490
  var { dirname: dirname29, resolve: resolve27 } = __require("node:path");
19491
19491
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
19492
19492
  var { InvalidArgumentError, UndiciError } = require_errors();
@@ -19703,7 +19703,7 @@ var require_snapshot_recorder = __commonJS({
19703
19703
  throw new InvalidArgumentError("Snapshot path is required");
19704
19704
  }
19705
19705
  try {
19706
- const data = await readFile40(resolve27(path), "utf8");
19706
+ const data = await readFile39(resolve27(path), "utf8");
19707
19707
  const parsed = JSON.parse(data);
19708
19708
  if (Array.isArray(parsed)) {
19709
19709
  this.#snapshots.clear();
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
36960
36960
  }
36961
36961
 
36962
36962
  // src/rules/cli-version.rules.ts
36963
- var STAMPED = "0.1.130";
36963
+ var STAMPED = "0.1.132";
36964
36964
  function cliVersionOf({ stamped = STAMPED } = {}) {
36965
36965
  return stamped.startsWith("__") ? "dev" : stamped;
36966
36966
  }
@@ -37535,7 +37535,7 @@ function parseArgs({ argv }) {
37535
37535
  const words = [];
37536
37536
  const flags2 = {};
37537
37537
  const lists = {};
37538
- const remember = (name3, value) => {
37538
+ const remember2 = (name3, value) => {
37539
37539
  flags2[name3] = value;
37540
37540
  lists[name3] = [...lists[name3] ?? [], value];
37541
37541
  };
@@ -37548,10 +37548,10 @@ function parseArgs({ argv }) {
37548
37548
  }
37549
37549
  const [name3 = "", inline] = arg.slice(2).split(/=(.*)/s, 2);
37550
37550
  const next = argv[index + 1];
37551
- if (inline !== void 0) remember(name3, inline);
37551
+ if (inline !== void 0) remember2(name3, inline);
37552
37552
  else if (SWITCHES.has(name3) || next === void 0 || next.startsWith("--")) flags2[name3] = true;
37553
37553
  else {
37554
- remember(name3, next);
37554
+ remember2(name3, next);
37555
37555
  index += 1;
37556
37556
  }
37557
37557
  }
@@ -60209,12 +60209,11 @@ var vaultValueShapeSchemaDefinition = external_exports.object({
60209
60209
  symbols: external_exports.string()
60210
60210
  });
60211
60211
  var vaultValueShapeSchema = vaultValueShapeSchemaDefinition;
60212
- var vaultBoundaryKeySchemaDefinition = external_exports.object({
60213
- connectionId: external_exports.string().min(1),
60214
- name: external_exports.string().min(1),
60215
- field: external_exports.string().min(1),
60216
- shape: vaultValueShapeSchema
60212
+ var vaultBoundaryHandoutSchemaDefinition = external_exports.object({
60213
+ connectionId: external_exports.string(),
60214
+ shapes: external_exports.record(external_exports.string(), vaultValueShapeSchema).optional()
60217
60215
  });
60216
+ var vaultBoundaryHandoutSchema = vaultBoundaryHandoutSchemaDefinition;
60218
60217
  var vaultEgressHostSchemaDefinition = external_exports.object({
60219
60218
  host: external_exports.string(),
60220
60219
  addedBy: external_exports.enum(["judge", "person"]),
@@ -60998,7 +60997,9 @@ var vaultRunReleaseSchemaDefinition = external_exports.discriminatedUnion("outco
60998
60997
  /** A sealed connection's values, encrypted to the run's own key. */
60999
60998
  sealed: vaultRunSealedReleaseSchema.optional(),
61000
60999
  /** What the approver told the agent, for the run to print. */
61001
- message: external_exports.string().optional()
61000
+ message: external_exports.string().optional(),
61001
+ /** On a hosted computer: the values are placeholders the egress proxy swaps. */
61002
+ boundary: vaultBoundaryHandoutSchema.optional()
61002
61003
  }),
61003
61004
  external_exports.object({
61004
61005
  outcome: external_exports.literal("ask"),
@@ -61039,7 +61040,9 @@ var vaultEgressReleaseInputSchemaDefinition = external_exports.object({
61039
61040
  reason: external_exports.string(),
61040
61041
  command: external_exports.array(external_exports.string()).default([]),
61041
61042
  /** The run's P-256 public key, base64url; a sealed connection is released only to it. */
61042
- recipient: external_exports.string().max(200).optional()
61043
+ recipient: external_exports.string().max(200).optional(),
61044
+ /** Set by a computer's egress proxy: a key it swaps comes back as shapes, not values. */
61045
+ placeholders: external_exports.boolean().default(false)
61043
61046
  });
61044
61047
  var vaultEgressReleaseInputSchema = vaultEgressReleaseInputSchemaDefinition;
61045
61048
  var vaultEgressStatusInputSchemaDefinition = external_exports.object({
@@ -62445,7 +62448,7 @@ var vaultBatchReleaseInputSchemaDefinition = external_exports.object({
62445
62448
  var vaultBatchReleaseInputSchema = vaultBatchReleaseInputSchemaDefinition;
62446
62449
  var vaultEgressBatchReleaseInputSchemaDefinition = external_exports.object({
62447
62450
  ...vaultBatchReleaseInputSchemaDefinition.shape,
62448
- /** The computer holds placeholders: a key swapped at the boundary comes back as `boundary`. */
62451
+ /** Set by a computer's egress proxy: a key it swaps comes back as `boundary`, not values. */
62449
62452
  placeholders: external_exports.boolean().default(false)
62450
62453
  });
62451
62454
  var vaultBatchConnectionSchemaDefinition = external_exports.object({
@@ -62460,8 +62463,8 @@ var vaultBatchEntrySchemaDefinition = external_exports.object({
62460
62463
  ref: external_exports.string(),
62461
62464
  connection: vaultBatchConnectionSchema.nullable(),
62462
62465
  release: vaultRunReleaseSchema.nullable(),
62463
- /** The key is swapped at the egress boundary: the computer's own placeholder stands in for it. */
62464
- boundary: external_exports.object({ connectionId: external_exports.string() }).optional()
62466
+ /** A key swapped at the egress boundary: its shapes, which the proxy makes placeholders of. */
62467
+ boundary: vaultBoundaryHandoutSchema.optional()
62465
62468
  });
62466
62469
  var vaultBatchEntrySchema = vaultBatchEntrySchemaDefinition;
62467
62470
  var vaultBatchReleaseSchemaDefinition = external_exports.object({
@@ -62497,7 +62500,7 @@ var vaultSessionSchemaDefinition = external_exports.object({
62497
62500
  });
62498
62501
  var vaultSessionSchema = vaultSessionSchemaDefinition;
62499
62502
  var vaultSessionReleaseInputSchemaDefinition = external_exports.object({
62500
- ...vaultEgressReleaseInputSchema.omit({ agentId: true }).shape,
62503
+ ...vaultEgressReleaseInputSchema.omit({ agentId: true, placeholders: true }).shape,
62501
62504
  session: vaultSessionSchema
62502
62505
  });
62503
62506
  var vaultSessionStatusInputSchemaDefinition = external_exports.object({
@@ -62716,6 +62719,25 @@ var vaultSecretOfferedSchemaDefinition = external_exports.object({
62716
62719
  state: external_exports.enum(["pending", "denied", "expired"])
62717
62720
  });
62718
62721
 
62722
+ // ../../modules/vault/contract/src/vault-agent-setup.ts
62723
+ var VAULT_CLI_INSTALL = "npm i -g @lazehq/cli";
62724
+ var VAULT_CLI_LOGIN = "laze login";
62725
+ var VAULT_AGENT_PROMPT = `I keep my API keys and passwords in the Laze vault. Use them through the laze CLI, which is signed in as me. I approve uses on my phone or computer, so a command may wait for me.
62726
+
62727
+ If \`laze\` is missing, run \`${VAULT_CLI_INSTALL}\`, then ask me to run \`${VAULT_CLI_LOGIN}\`.
62728
+
62729
+ Commands:
62730
+ - \`laze vault list\` shows the keys you may use: names, fields and levels, never values.
62731
+ - \`laze vault run <name> --reason "<one plain sentence>" -- <command>\` runs the command with the key's fields as environment variables. To put a value in an argument, let a shell expand it inside the run, for example: \`laze vault run openai --reason "List the models our account can use" -- sh -c 'curl -s https://api.openai.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"'\`
62732
+ - \`laze vault env --reason "<one plain sentence>" -- <command>\` runs the command with every key a \`.env.vault\` file names, in this folder or a parent. One line per variable: \`KEY\` (the key that holds that field), \`KEY={{vault:<name>}}\`, or a key's name for all its fields. \`--env <x>\` reads \`.env.<x>.vault\` instead. \`laze vault env --names\` shows what each line resolves to, never a value.
62733
+ - \`laze vault aws <name> --reason "<one plain sentence>" -- <aws command>\` runs the command with a short-lived AWS session made from that key.
62734
+
62735
+ Rules:
62736
+ - The reason is one short sentence I can read on my phone: what you want to do and why. Never a command.
62737
+ - A run may wait until I answer its approval card. Let it wait and do not start it again. Exit 75: the wait ran out, run it again. Exit 77: I denied it, so stop and ask me. Exit 2: rewrite the reason.
62738
+ - Never print, echo or log a value. Never write one into a file, a commit, a message or your notes.
62739
+ - If no key fits, tell me the name and fields you need. Never ask me to paste a secret into the chat.`;
62740
+
62719
62741
  // ../../modules/chat/contract/src/chat.close.ts
62720
62742
  var conversationOpenDaysSchemaDefinition = external_exports.union([external_exports.literal(7), external_exports.literal(14), external_exports.literal(30), external_exports.literal(90)]).nullable();
62721
62743
  var conversationOpenDaysSchema = conversationOpenDaysSchemaDefinition;
@@ -63948,6 +63970,7 @@ var reachableConversationSchemaDefinition = external_exports.object({
63948
63970
  readable: external_exports.boolean()
63949
63971
  });
63950
63972
  var replySideSchema = external_exports.enum(["laze", "slack"]);
63973
+ var sendViaSchema = external_exports.enum(["laze", "slack", "both"]);
63951
63974
  var conversationSummarySchemaDefinition = external_exports.object({
63952
63975
  ...conversationSchemaDefinition.shape,
63953
63976
  lastReadSeq: external_exports.number().int().nonnegative(),
@@ -64308,6 +64331,11 @@ var postMessageInputSchemaDefinition = external_exports.object({
64308
64331
  notifyAnyway: external_exports.boolean().optional(),
64309
64332
  /** In a Laze DM: also post it to this paired Slack DM, as the sender; one Laze message. */
64310
64333
  alsoSendTo: idSchema4.optional(),
64334
+ /**
64335
+ * In a Laze DM paired with the sender's Slack DM: where this post goes. Absent, a person's
64336
+ * top-level post follows the side they picked in that DM, both when they picked none.
64337
+ */
64338
+ via: sendViaSchema.optional(),
64311
64339
  attachmentIds: external_exports.array(idSchema4).max(10).default([]),
64312
64340
  /** The feed cards an agent's reply links; chat keeps them only when an agent posts. */
64313
64341
  feedRefs: external_exports.array(messageFeedRefSchemaDefinition).max(MESSAGE_FEED_REFS_MAX).optional(),
@@ -65210,7 +65238,7 @@ var chatConversationsTrpc = defineTrpcContract("chat").query("overview", { mirro
65210
65238
  var chatChannelRolesTrpc = defineTrpcContract("chat").mutation("setChannelRole").withInput(setChannelRoleInputSchema).withOutput(conversationSchema).mutation("extendChannel").withInput(extendChannelInputSchema).withOutput(conversationSchema).build();
65211
65239
  var chatMessagesTrpc = defineTrpcContract("chat").query("history", { mirrored: historyMirror }).withInput(historyInputSchema).withOutput(historyPageSchema).query("thread").withInput(messageInputSchema).withOutput(threadSchema).query("message").withInput(messageInputSchema).withOutput(messageSchema).mutation("post").withInput(postMessageInputSchema).withOutput(messageSchema).mutation("forward").withInput(forwardMessageInputSchema).withOutput(messageSchema).mutation("addMentioned").withInput(addMentionedInputSchema).withOutput(messageSchema).mutation("edit").withInput(editMessageInputSchema).withOutput(messageSchema).mutation("delete").withInput(messageInputSchema).withOutput(messageSchema).mutation("remove").withInput(messageInputSchema).withOutput(messageSchema).mutation("react").withInput(reactInputSchema).withOutput(messageSchema).mutation("signalTyping").withInput(signalTypingInputSchema).withOutput(external_exports.object({ sent: external_exports.literal(true) })).mutation("markRead").withInput(markReadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).mutation("markUnread").withInput(markUnreadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).query("search").withInput(searchInputSchema).withOutput(searchResultSchema).build();
65212
65240
  var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).mutation("transcribeVoiceSegment").withInput(transcribeVoiceSegmentInputSchema).withOutput(voiceSegmentTextSchema).mutation("abortUpload").withInput(fileInputSchema).withOutput(external_exports.object({ aborted: external_exports.literal(true) })).query("fileLink").withInput(fileLinkInputSchema).withOutput(fileLinkSchema).query("channelFiles").withInput(channelFilesInputSchema).withOutput(channelFilesSchema).mutation("renameAttachment").withInput(renameAttachmentInputSchema).withOutput(attachmentSchema).mutation("hideUnfurl").withInput(hideUnfurlInputSchema).withOutput(messageSchema).query("unfurlImage").withInput(unfurlImageInputSchema).withOutput(fileLinkSchema).query("searchGifs").withInput(searchGifsInputSchema).withOutput(gifResultsSchema).build();
65213
- var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("setReplySide").withInput(setReplySideInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads", { mirrored: threadsMirror }).withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).mutation("retryMirrorDelivery").withInput(messageInputSchema).withOutput(external_exports.object({ retried: external_exports.boolean() })).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
65241
+ var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("setReplySide").withInput(setReplySideInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads", { mirrored: threadsMirror }).withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).mutation("retryMirrorDelivery").withInput(messageInputSchema).withOutput(external_exports.object({ retried: external_exports.boolean() })).mutation("alsoSendToSlack").withInput(messageInputSchema).withOutput(messageSchema).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
65214
65242
  var chatSessionTrpc = defineTrpcContract("chat").mutation("realtimeToken").withInput(workspaceInputSchema).withOutput(realtimeTokenSchema).query("drafts").withInput(workspaceInputSchema).withOutput(draftListSchema).mutation("saveDraft").withInput(saveDraftInputSchema).withOutput(draftSavedSchema).mutation("deleteDraft").withInput(deleteDraftInputSchema).withOutput(draftSavedSchema).query("sent").withInput(listSentInputSchema).withOutput(sentPageSchema).query("sidebarLayout").withInput(workspaceInputSchema).withOutput(sidebarLayoutSchema).mutation("editSidebar").withInput(editSidebarInputSchema).withOutput(sidebarLayoutSchema).query("readerPreferences").withInput(workspaceInputSchema).withOutput(readerPreferencesSchema).mutation("setReaderPreferences").withInput(setReaderPreferencesInputSchema).withOutput(readerPreferencesSchema).mutation("star").withInput(starInputSchema).withOutput(starStatusSchema).query("starred").withInput(workspaceInputSchema).withOutput(starredListSchema).mutation("scrubSecrets").withInput(scrubChatInputSchema).withOutput(chatScrubReportSchema).mutation("restoreScrubbed").withInput(messageInputSchema).withOutput(messageSchema).build();
65215
65243
  var chatScheduledTrpc = defineTrpcContract("chat").mutation("scheduleMessage").withInput(scheduleMessageInputSchema).withOutput(scheduledMessageSchema).query("scheduled").withInput(listScheduledInputSchema).withOutput(scheduledListSchema).mutation("editScheduled").withInput(editScheduledInputSchema).withOutput(scheduledMessageSchema).mutation("sendScheduledNow").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).mutation("cancelScheduled").withInput(scheduledInputSchema).withOutput(scheduledMessageSchema).build();
65216
65244
  var chatPresenceTrpc = defineTrpcContract("chat").mutation("heartbeat").withInput(workspaceInputSchema).withOutput(heartbeatSchema).query("presence").withInput(workspaceInputSchema).withOutput(presenceListSchema).mutation("setStatus").withInput(setStatusInputSchema).withOutput(personPresenceSchema).mutation("clearStatus").withInput(workspaceInputSchema).withOutput(personPresenceSchema).mutation("setAway").withInput(setAwayInputSchema).withOutput(personPresenceSchema).build();
@@ -67513,17 +67541,6 @@ var egressConnectionSchemaDefinition = external_exports.object({
67513
67541
  message: "A connection holds a secret or is the vault's, never both"
67514
67542
  });
67515
67543
  var egressConnectionSchema = egressConnectionSchemaDefinition;
67516
- var boundaryKeySchemaDefinition = external_exports.object({
67517
- connectionId: external_exports.string().min(1),
67518
- name: external_exports.string().min(1),
67519
- field: external_exports.string().min(1),
67520
- shape: external_exports.object({
67521
- kept: external_exports.string().max(8),
67522
- classes: external_exports.string().regex(/^[luds]*$/),
67523
- symbols: external_exports.string()
67524
- })
67525
- });
67526
- var BOUNDARY_KEYS_MAX = 1e3;
67527
67544
  var claudeGatewayModelsSchemaDefinition = external_exports.object({
67528
67545
  opus: external_exports.string().min(1),
67529
67546
  sonnet: external_exports.string().min(1),
@@ -67559,8 +67576,6 @@ var agentSandboxSpecSchemaDefinition = external_exports.object({
67559
67576
  /** The harness model's context window, when Laze knows it: compaction is set against it. */
67560
67577
  contextWindow: external_exports.number().int().positive().optional(),
67561
67578
  connections: external_exports.array(egressConnectionSchema).default([]),
67562
- /** Vault keys swapped at the egress boundary; only for an agent in a Laze computer. */
67563
- boundaryKeys: external_exports.array(boundaryKeySchemaDefinition).max(BOUNDARY_KEYS_MAX).optional(),
67564
67579
  /** Harness credentials that must live inside the sandbox (a user's own subscription token). */
67565
67580
  harnessEnvironment: external_exports.record(external_exports.string(), external_exports.string()).default({}),
67566
67581
  /** Files the supervisor writes under the home folder at every start, by relative path. */
@@ -68703,9 +68718,11 @@ function launchEffortOf({ agent: agent3 }) {
68703
68718
  const effort = agent3.effort ?? (!running || running.efforts.includes(AGENT_DEFAULT_EFFORT) ? AGENT_DEFAULT_EFFORT : running.defaultEffort);
68704
68719
  return effort ? { kind: "set", effort } : { kind: "none" };
68705
68720
  }
68706
- function describeEffort({ agent: agent3 }) {
68721
+ function describeEffortLine({ agent: agent3 }) {
68707
68722
  const launched = launchEffortOf({ agent: agent3 });
68708
- return launched.kind === "set" ? effortLabelOf({ effort: launched.effort }) : null;
68723
+ if (launched.kind !== "set") return null;
68724
+ const label3 = effortLabelOf({ effort: launched.effort });
68725
+ return agent3.effort ? label3 : `Default (${label3})`;
68709
68726
  }
68710
68727
  function claudeWindowOf({ model }) {
68711
68728
  const name3 = model ? `${model.name} ${model.description} ${model.id}` : "";
@@ -68727,7 +68744,7 @@ function contextLineOf({ agent: agent3 }) {
68727
68744
  function agentRunSummaryOf({ agent: agent3 }) {
68728
68745
  return {
68729
68746
  model: modelLineOf({ agent: agent3 }),
68730
- effort: describeEffort({ agent: agent3 }),
68747
+ effort: describeEffortLine({ agent: agent3 }),
68731
68748
  context: contextLineOf({ agent: agent3 })
68732
68749
  };
68733
68750
  }
@@ -71957,7 +71974,12 @@ var postAsCallerInputSchemaDefinition = external_exports.object({
71957
71974
  /** Files the caller uploaded to this conversation, carried as the composer's attachments are. */
71958
71975
  attachmentIds: external_exports.array(idSchema19).max(10).optional(),
71959
71976
  /** The messages of the agent's turn this post answers. */
71960
- answers: external_exports.array(idSchema19).max(200).optional()
71977
+ answers: external_exports.array(idSchema19).max(200).optional(),
71978
+ /**
71979
+ * In a Laze DM paired with the person's Slack DM: Laze, Slack or both for this one post. Absent
71980
+ * follows the side the person picked in that DM, as the composer does.
71981
+ */
71982
+ via: sendViaSchema.optional()
71961
71983
  });
71962
71984
  var replyAsCallerInputSchemaDefinition = external_exports.object({
71963
71985
  messageId: idSchema19,
@@ -71971,7 +71993,12 @@ var replyAsCallerInputSchemaDefinition = external_exports.object({
71971
71993
  /** Files the caller uploaded to the reply's conversation, carried as the composer's are. */
71972
71994
  attachmentIds: external_exports.array(idSchema19).max(10).optional(),
71973
71995
  /** The other messages of the agent's turn this reply answers. */
71974
- answers: external_exports.array(idSchema19).max(200).optional()
71996
+ answers: external_exports.array(idSchema19).max(200).optional(),
71997
+ /**
71998
+ * In a Laze DM paired with the person's Slack DM: Laze, Slack or both for this one post. Absent
71999
+ * follows the side the person picked in that DM, as the composer does.
72000
+ */
72001
+ via: sendViaSchema.optional()
71975
72002
  });
71976
72003
  var postedMessageSchemaDefinition = external_exports.object({
71977
72004
  messageId: idSchema19,
@@ -72078,7 +72105,11 @@ var agentTurnTokenSchemaDefinition = external_exports.object({
72078
72105
  turnToken: external_exports.string(),
72079
72106
  expiresAt: external_exports.iso.datetime()
72080
72107
  });
72081
- var { agentId: _agentId, ...releaseShape } = vaultEgressReleaseInputSchema.shape;
72108
+ var {
72109
+ agentId: _agentId,
72110
+ placeholders: _placeholders,
72111
+ ...releaseShape
72112
+ } = vaultEgressReleaseInputSchema.shape;
72082
72113
  var agentVaultReleaseInputSchemaDefinition = external_exports.object({
72083
72114
  ...releaseShape,
72084
72115
  channelId: external_exports.string().min(1).max(80).nullable().default(null)
@@ -72136,7 +72167,9 @@ var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").wit
72136
72167
  var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19, channelId: idSchema19 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).mutation("useLazeModelsUntilReset").withInput(useLazeModelsUntilResetInputSchema).withOutput(lazeModelsUntilResetSchema).query("agentLoginChoices").withInput(agentLoginChoicesInputSchema).withOutput(agentLoginChoicesSchema).mutation("switchAgentLogin").withInput(switchAgentLoginInputSchema).withOutput(switchedAgentLoginSchema).build();
72137
72168
  var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
72138
72169
  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();
72139
- var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("workspaceDefault").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(workspaceDefaultAgentSchema).mutation("setWorkspaceDefault").withInput(setWorkspaceDefaultAgentInputSchema).withOutput(workspaceDefaultAgentSchema).build();
72170
+ var talkableAgentsSchemaDefinition = external_exports.object({ agentIds: external_exports.array(idSchema19) });
72171
+ var talkableAgentsSchema = talkableAgentsSchemaDefinition;
72172
+ var agentWorkspaceDefaultTrpc = defineTrpcContract("agents").query("talkable").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(talkableAgentsSchema).query("workspaceDefault").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(workspaceDefaultAgentSchema).mutation("setWorkspaceDefault").withInput(setWorkspaceDefaultAgentInputSchema).withOutput(workspaceDefaultAgentSchema).build();
72140
72173
  var agentRuntimeChoiceTrpc = defineTrpcContract("agents").query("setup").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(agentSetupReadingSchema).mutation("retrySetup").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema19 })).withOutput(agentSchema).query("lastRuntime").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(lastRuntimeSchema).build();
72141
72174
  var agentArchiveTrpc = defineTrpcContract("agents").query("archived").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).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: workspaceIdSchema14 })).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();
72142
72175
  var agentLangwatchTrpc = defineTrpcContract("agents").query("langwatchTracing").withInput(agentLangwatchInputSchema).withOutput(agentLangwatchTracingSchema).mutation("setLangwatchTracing").withInput(setAgentLangwatchInputSchema).withOutput(agentLangwatchTracingSchema).query("langwatchAgents").withInput(agentLangwatchListInputSchema).withOutput(agentLangwatchRowsSchema).build();
@@ -76648,8 +76681,19 @@ function turnAnswersOf({ context }) {
76648
76681
  return answers.length > 0 ? { answers } : {};
76649
76682
  }
76650
76683
  var FILES_USAGE = "[--image <path|url|fileId>]... [--file <path|url|fileId>]... (at most 6)";
76651
- var POST_USAGE = `Usage: laze post <channel> <text|-> [--thread <id>] ${FILES_USAGE} [--at <time> [--tz <zone>]] [--json]`;
76652
- var REPLY_USAGE = `Usage: laze reply <message-id> <text|-> [--new-thread] [--also-channel] ${FILES_USAGE} [--at <time> [--tz <zone>]]`;
76684
+ var VIA_USAGE = "[--via laze|slack|both]";
76685
+ var POST_USAGE = `Usage: laze post <channel> <text|-> [--thread <id>] ${VIA_USAGE} ${FILES_USAGE} [--at <time> [--tz <zone>]] [--json]`;
76686
+ var REPLY_USAGE = `Usage: laze reply <message-id> <text|-> [--new-thread] [--also-channel] ${VIA_USAGE} ${FILES_USAGE} [--at <time> [--tz <zone>]]`;
76687
+ var VIAS = ["laze", "slack", "both"];
76688
+ function viaOf({ args, usage: usage2 }) {
76689
+ const via = flagText({ args, name: "via" });
76690
+ if (!via) return {};
76691
+ if (!VIAS.includes(via)) {
76692
+ throw new CliUsageError(`--via takes laze, slack or both.
76693
+ ${usage2}`);
76694
+ }
76695
+ return { via };
76696
+ }
76653
76697
  function keyedPost({
76654
76698
  client,
76655
76699
  path,
@@ -76692,6 +76736,7 @@ async function post({
76692
76736
  const leaves = leavesLazeOf({ client, channel });
76693
76737
  const body = await textToSend({ context, args, profile, client, text: typed, leaves });
76694
76738
  const thread2 = flagText({ args, name: "thread" });
76739
+ const via = viaOf({ args, usage: POST_USAGE });
76695
76740
  const files2 = await filesOf({ context, args, client, at: at8, channel: async () => channel });
76696
76741
  if (at8) {
76697
76742
  const target = { channel, ...thread2 ? { threadRootId: thread2 } : {} };
@@ -76704,6 +76749,7 @@ async function post({
76704
76749
  channel,
76705
76750
  body,
76706
76751
  ...thread2 ? { threadRootId: thread2 } : {},
76752
+ ...via,
76707
76753
  ...files2,
76708
76754
  ...turnAnswersOf({ context })
76709
76755
  }
@@ -76729,6 +76775,7 @@ async function reply({
76729
76775
  const at8 = scheduleAtOf({ args, usage: REPLY_USAGE });
76730
76776
  const { client, profile, name: name3 } = await signedIn({ context, args });
76731
76777
  const channel = flagText({ args, name: "channel" });
76778
+ const via = viaOf({ args, usage: REPLY_USAGE });
76732
76779
  const typed = await textOf({ context, args, from: 2 });
76733
76780
  const leaves = leavesLazeOf({ client, channel });
76734
76781
  const body = await textToSend({ context, args, profile, client, text: typed, leaves });
@@ -76751,6 +76798,7 @@ async function reply({
76751
76798
  ...channel ? { channel } : {},
76752
76799
  ...args.flags["new-thread"] === true ? { thread: true } : {},
76753
76800
  ...args.flags["also-channel"] === true ? { alsoInChannel: true } : {},
76801
+ ...via,
76754
76802
  ...files2,
76755
76803
  ...turnAnswersOf({ context })
76756
76804
  }
@@ -79855,6 +79903,26 @@ someone an action cannot be done because Laze refused it earlier, run \`laze cha
79855
79903
  again. When a change lifts a refusal you hit in a conversation, tell the people there once that
79856
79904
  it works now.
79857
79905
 
79906
+ ## Keys from the vault
79907
+
79908
+ Your owner keeps API keys and passwords in the Laze vault. Use them only through these commands:
79909
+
79910
+ - \`laze vault list\` shows the keys you may use: names, fields and levels, never values.
79911
+ - \`laze vault run <name> --reason "<one plain sentence>" -- <command>\` runs the command with the
79912
+ key's fields as environment variables. To put a value in an argument, let a shell expand it
79913
+ inside the run: \`-- sh -c 'curl -H "Authorization: Bearer $OPENAI_API_KEY" <url>'\`.
79914
+ - \`laze vault env --reason "<one plain sentence>" -- <command>\` runs it with every key a
79915
+ \`.env.vault\` file names (\`--env <x>\` reads \`.env.<x>.vault\`, \`--names\` shows what each line
79916
+ resolves to, never a value).
79917
+ - \`laze vault aws <name> --reason "<one plain sentence>" -- <aws command>\` runs it with a
79918
+ short-lived AWS session made from that key.
79919
+
79920
+ The reason is one short sentence a person reads on a phone: what you want to do and why, never a
79921
+ command. A run may wait for an approval card: let it wait and do not start it again. Exit 75: the
79922
+ wait ran out, run it again. Exit 77: denied, so stop and ask. Exit 2: rewrite the reason. Never
79923
+ print, echo or log a value, and never write one into a file, a commit, a message or your notes.
79924
+ If no key fits, ask for it by name; never ask anyone to paste a secret into the chat.
79925
+
79858
79926
  ## Browser tabs and sign-ins
79859
79927
 
79860
79928
  - \`laze browser tabs\` lists the live browser tabs of your conversations. You drive every tab
@@ -85275,6 +85343,44 @@ function vaultSessionOf({
85275
85343
  return { ...base, harness: "script", id: folder.slice(0, 200) || "script" };
85276
85344
  }
85277
85345
 
85346
+ // src/services/vault-placeholders-file.service.ts
85347
+ async function placeholdersOf({ env }) {
85348
+ const path = env.LAZE_VAULT_PLACEHOLDERS;
85349
+ if (!path) return {};
85350
+ const parsed = await readStateJson({ path });
85351
+ return parsed && typeof parsed === "object" ? parsed : {};
85352
+ }
85353
+ async function remember({
85354
+ env,
85355
+ connectionId,
85356
+ fields
85357
+ }) {
85358
+ const path = env.LAZE_VAULT_PLACEHOLDERS;
85359
+ if (!path) return;
85360
+ await withStateLock({
85361
+ path,
85362
+ work: async () => {
85363
+ const held = await placeholdersOf({ env });
85364
+ const value = { ...held, [connectionId]: { ...held[connectionId], ...fields } };
85365
+ await writeStateJson({ path, value, pretty: true });
85366
+ }
85367
+ });
85368
+ }
85369
+ async function handedOut({
85370
+ context,
85371
+ name: name3,
85372
+ connectionId,
85373
+ fields
85374
+ }) {
85375
+ await remember({ env: context.environment.inherited, connectionId, fields }).catch(
85376
+ () => void 0
85377
+ );
85378
+ context.err(
85379
+ `laze vault: ${Object.keys(fields).join(", ")} of ${name3} hold a stand-in; Laze's proxy puts the key in only on sites approved for it. A command that needs the value itself (signing, a database) needs ${name3} marked "Used on the computer only".
85380
+ `
85381
+ );
85382
+ }
85383
+
85278
85384
  // src/services/vault-commands.service.ts
85279
85385
  var USAGE3 = `Usage: laze vault run <connection> --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
85280
85386
  Runs the command with the connection's values in its environment, on a Laze agent's computer,
@@ -85454,7 +85560,8 @@ async function vaultRelease({
85454
85560
  args,
85455
85561
  connection,
85456
85562
  reason: reason2,
85457
- command
85563
+ command,
85564
+ value = false
85458
85565
  }) {
85459
85566
  const deadline = deadlineOf({ args, nowMs: context.nowMs() });
85460
85567
  const env = context.environment.inherited;
@@ -85467,7 +85574,13 @@ async function vaultRelease({
85467
85574
  };
85468
85575
  const keyPath = runKeyPathOf({ turnFile, connection });
85469
85576
  const run4 = await runKeyAt({ path: keyPath });
85470
- const body = JSON.stringify({ connection, reason: reason2, command, recipient: run4.publicKey });
85577
+ const body = JSON.stringify({
85578
+ connection,
85579
+ reason: reason2,
85580
+ command,
85581
+ recipient: run4.publicKey,
85582
+ ...value && { value: true }
85583
+ });
85471
85584
  let release2;
85472
85585
  try {
85473
85586
  const first = await releaseOf({
@@ -85510,7 +85623,7 @@ async function settled2({
85510
85623
  if (!leaseHolds({ release: release2, nowMs: context.nowMs() })) await rm11(keyPath, { force: true });
85511
85624
  if (release2.message) context.err(`${release2.message}
85512
85625
  `);
85513
- return { env: values };
85626
+ return { env: values, ...release2.boundary && { boundary: release2.boundary } };
85514
85627
  }
85515
85628
  function refusedRelease(error63) {
85516
85629
  if (!(error63 instanceof LazeApiError)) throw error63;
@@ -85594,6 +85707,10 @@ ${USAGE3}`);
85594
85707
  }
85595
85708
  const released = await vaultRelease({ context, args, connection, reason: reason2, command: args.rest });
85596
85709
  if ("exitCode" in released) return released.exitCode;
85710
+ if (released.boundary) {
85711
+ const { connectionId } = released.boundary;
85712
+ await handedOut({ context, name: connection, connectionId, fields: released.env });
85713
+ }
85597
85714
  const prepared = preparedCommand({
85598
85715
  command: args.rest,
85599
85716
  released: /* @__PURE__ */ new Map([[connection, released.env]])
@@ -85826,7 +85943,8 @@ ${BROWSER_TAB_USAGE}`
85826
85943
  args,
85827
85944
  connection,
85828
85945
  reason: reason2,
85829
- command: ["laze", "browser", "login", tab]
85946
+ command: ["laze", "browser", "login", tab],
85947
+ value: true
85830
85948
  });
85831
85949
  if ("exitCode" in released) return released.exitCode;
85832
85950
  const [problem] = unusableFieldProblems({ fields: released.env });
@@ -94129,11 +94247,11 @@ async function suggestServer({
94129
94247
  }
94130
94248
 
94131
94249
  // src/services/connector-commands.service.ts
94132
- import { readFile as readFile24 } from "node:fs/promises";
94250
+ import { readFile as readFile23 } from "node:fs/promises";
94133
94251
  import { resolve as resolve14 } from "node:path";
94134
94252
 
94135
94253
  // src/services/vault-keychain-commands.service.ts
94136
- import { readFile as readFile23 } from "node:fs/promises";
94254
+ import { readFile as readFile22 } from "node:fs/promises";
94137
94255
 
94138
94256
  // src/rules/vault-input.rules.ts
94139
94257
  function secondsOf(text3) {
@@ -94426,273 +94544,6 @@ var listDevices = async ({ context, args }) => {
94426
94544
  }
94427
94545
  };
94428
94546
 
94429
- // src/services/vault-batch.service.ts
94430
- import { readFile as readFile22, rm as rm16 } from "node:fs/promises";
94431
- async function placeholdersOf({
94432
- env
94433
- }) {
94434
- const path = env.LAZE_VAULT_PLACEHOLDERS;
94435
- if (!path || !proxyOf({ env })) return {};
94436
- try {
94437
- const parsed = JSON.parse(await readFile22(path, "utf8"));
94438
- return parsed && typeof parsed === "object" ? parsed : {};
94439
- } catch {
94440
- return {};
94441
- }
94442
- }
94443
- async function batchOf({ response }) {
94444
- const text3 = await response.text();
94445
- if (!response.ok) {
94446
- const code4 = /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1] ?? `status ${response.status}`;
94447
- throw new CliUsageError(`laze vault: the batch was refused (${code4})`);
94448
- }
94449
- return JSON.parse(text3);
94450
- }
94451
- async function doorOf({
94452
- context,
94453
- args,
94454
- keyName
94455
- }) {
94456
- const env = context.environment.inherited;
94457
- const proxy = proxyOf({ env });
94458
- if (proxy) {
94459
- const turnFile = turnFileOf({ env });
94460
- const headers = {
94461
- "proxy-authorization": proxy.authorization,
94462
- "x-laze-turn": await turnTokenOf2({ env, turnFile, command: "laze vault env" })
94463
- };
94464
- return {
94465
- keyPath: runKeyPathOf({ turnFile, connection: keyName }),
94466
- ask: async (body) => batchOf({
94467
- response: await reach({
94468
- context,
94469
- url: `${proxy.origin}/vault/release-batch`,
94470
- init: {
94471
- method: "POST",
94472
- headers: { ...headers, "content-type": "application/json" },
94473
- body: JSON.stringify(body)
94474
- }
94475
- })
94476
- }),
94477
- status: async (requestId) => releaseOf({
94478
- response: await reach({
94479
- context,
94480
- url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
94481
- init: { method: "GET", headers }
94482
- })
94483
- })
94484
- };
94485
- }
94486
- const signed2 = await signedIn({ context, args }).catch(() => null);
94487
- if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
94488
- throw new CliUsageError(`laze vault env ${WHERE}`);
94489
- }
94490
- const { name: name3 } = signed2;
94491
- const harnessSession = await currentSessionOf({ context, args });
94492
- const client = forSession({ client: signed2.client, session: harnessSession });
94493
- const door = signed2.profile.kind === "person" ? {
94494
- ask: "/api/vault/session/release-batch",
94495
- status: "/api/vault/session/release-status",
94496
- extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
94497
- } : {
94498
- ask: "/api/agents/me/vault/release-batch",
94499
- status: "/api/agents/me/vault/release-status",
94500
- extra: { channelId: flagText({ args, name: "channel" }) || null }
94501
- };
94502
- return {
94503
- keyPath: runKeyPathOf({ turnFile: void 0, connection: keyName, profile: name3 }),
94504
- ask: async (body) => {
94505
- try {
94506
- return await client.post(door.ask, { ...body, ...door.extra });
94507
- } catch (error63) {
94508
- if (!(error63 instanceof LazeApiError)) throw error63;
94509
- throw new CliUsageError(`laze vault: the batch was refused: ${refusalText(error63)}`);
94510
- }
94511
- },
94512
- status: (requestId) => patiently({
94513
- context,
94514
- call: () => client.post(door.status, { requestId, ...door.extra })
94515
- }).catch(refusedRelease)
94516
- };
94517
- }
94518
- async function resolveBatch({
94519
- context,
94520
- args,
94521
- refs
94522
- }) {
94523
- const door = await doorOf({ context, args, keyName: "env-names" });
94524
- const answer6 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
94525
- return answer6.entries;
94526
- }
94527
- var keyOf = (entry2) => entry2.connection?.name ?? entry2.ref;
94528
- async function untilAllAnswered({
94529
- context,
94530
- door,
94531
- waiting,
94532
- deadline
94533
- }) {
94534
- const answered = /* @__PURE__ */ new Map();
94535
- if (waiting.size === 0) return answered;
94536
- const [first] = waiting.values();
94537
- context.err(
94538
- `laze vault: ${[...waiting.keys()].join(", ")} wait for an answer (${first?.message ?? "a card"}); cards expire after 24 hours...
94539
- `
94540
- );
94541
- while (waiting.size > 0) {
94542
- if (context.nowMs() + POLL_MS > deadline) {
94543
- context.err(
94544
- `laze vault: ${[...waiting.keys()].join(", ")} not approved yet; ask again later.
94545
- `
94546
- );
94547
- return "capped";
94548
- }
94549
- await context.sleep(POLL_MS);
94550
- for (const [key, pending2] of waiting) {
94551
- const next = await door.status(pending2.requestId);
94552
- if (next.outcome === "ask") waiting.set(key, next);
94553
- else {
94554
- waiting.delete(key);
94555
- answered.set(key, next);
94556
- }
94557
- }
94558
- }
94559
- return answered;
94560
- }
94561
- async function releaseBatch({
94562
- context,
94563
- args,
94564
- refs,
94565
- reason: reason2,
94566
- command
94567
- }) {
94568
- const deadline = deadlineOf({ args, nowMs: context.nowMs() });
94569
- const door = await doorOf({ context, args, keyName: `env:${[...refs].toSorted().join(",")}` });
94570
- const run4 = await runKeyAt({ path: door.keyPath });
94571
- const placeholders = await placeholdersOf({ env: context.environment.inherited });
94572
- let answer6;
94573
- let settled3;
94574
- try {
94575
- answer6 = await door.ask({
94576
- refs,
94577
- reason: reason2,
94578
- command,
94579
- recipient: run4.publicKey,
94580
- ...Object.keys(placeholders).length > 0 && { placeholders: true }
94581
- });
94582
- const missing = answer6.entries.filter((entry2) => !entry2.connection);
94583
- if (missing.length > 0) {
94584
- context.err(
94585
- `laze vault: no key named ${missing.map((entry2) => entry2.ref).join(", ")} in your vault or reachable by this agent
94586
- `
94587
- );
94588
- return { exitCode: 1 };
94589
- }
94590
- const sorted = sortedReleasesOf({ entries: answer6.entries });
94591
- settled3 = sorted.settled;
94592
- const { waiting } = sorted;
94593
- const later = await untilAllAnswered({ context, door, waiting, deadline });
94594
- if (later === "capped") return { exitCode: 75 };
94595
- for (const [key, release2] of later) settled3.set(key, release2);
94596
- } catch (error63) {
94597
- if (!(error63 instanceof ServerGoneError)) throw error63;
94598
- context.err(`${error63.message}. Run the command again to keep waiting.
94599
- `);
94600
- return { exitCode: 75 };
94601
- }
94602
- const swapped = swappedOf({ context, entries: answer6.entries, placeholders });
94603
- if (!swapped) return { exitCode: 1 };
94604
- const outcome = await valuesOf({
94605
- context,
94606
- entries: answer6.entries,
94607
- settled: settled3,
94608
- run: run4,
94609
- keyPath: door.keyPath
94610
- });
94611
- if ("exitCode" in outcome) return outcome;
94612
- for (const [ref2, fields] of swapped) outcome.released.set(ref2, { fields });
94613
- return outcome;
94614
- }
94615
- function swappedOf({
94616
- context,
94617
- entries,
94618
- placeholders
94619
- }) {
94620
- const swapped = /* @__PURE__ */ new Map();
94621
- for (const entry2 of entries) {
94622
- if (!entry2.boundary || !entry2.connection) continue;
94623
- const held = placeholders[entry2.boundary.connectionId] ?? {};
94624
- const fields = Object.fromEntries(
94625
- entry2.connection.fieldNames.flatMap((field) => {
94626
- const placeholder = held[field];
94627
- return placeholder ? [[field, placeholder]] : [];
94628
- })
94629
- );
94630
- if (Object.keys(fields).length === 0) {
94631
- context.err(
94632
- `laze vault: ${entry2.connection.name} is swapped by Laze's proxy, but this computer holds no placeholder for it yet; it gets one on its next start
94633
- `
94634
- );
94635
- return null;
94636
- }
94637
- swapped.set(entry2.ref, fields);
94638
- }
94639
- return swapped;
94640
- }
94641
- function sortedReleasesOf({ entries }) {
94642
- const settled3 = /* @__PURE__ */ new Map();
94643
- const waiting = /* @__PURE__ */ new Map();
94644
- for (const entry2 of entries) {
94645
- const release2 = entry2.release;
94646
- if (!release2) continue;
94647
- if (release2.outcome === "ask") waiting.set(keyOf(entry2), release2);
94648
- else settled3.set(keyOf(entry2), release2);
94649
- }
94650
- return { settled: settled3, waiting };
94651
- }
94652
- function refusalOf({
94653
- context,
94654
- settled: settled3
94655
- }) {
94656
- const codes = [];
94657
- for (const release2 of settled3.values()) {
94658
- if (release2.outcome !== "deny") continue;
94659
- context.err(`${release2.message}
94660
- `);
94661
- codes.push(release2.exitCode || 1);
94662
- }
94663
- if (codes.length === 0) return 0;
94664
- return codes.includes(77) ? 77 : codes[0] ?? 1;
94665
- }
94666
- async function valuesOf({
94667
- context,
94668
- entries,
94669
- settled: settled3,
94670
- run: run4,
94671
- keyPath
94672
- }) {
94673
- const refused = refusalOf({ context, settled: settled3 });
94674
- if (refused !== 0) {
94675
- await rm16(keyPath, { force: true });
94676
- return { exitCode: refused };
94677
- }
94678
- const opened = /* @__PURE__ */ new Map();
94679
- let keep2 = false;
94680
- for (const [key, release2] of settled3) {
94681
- if (release2.outcome !== "allow") continue;
94682
- opened.set(key, await envOf({ release: release2, run: run4 }));
94683
- if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
94684
- if (release2.message) context.err(`${release2.message}
94685
- `);
94686
- }
94687
- if (!keep2) await rm16(keyPath, { force: true });
94688
- const released = /* @__PURE__ */ new Map();
94689
- for (const entry2 of entries) {
94690
- const fields = opened.get(keyOf(entry2));
94691
- if (fields) released.set(entry2.ref, { fields });
94692
- }
94693
- return { released, entries };
94694
- }
94695
-
94696
94547
  // src/services/vault-share-commands.service.ts
94697
94548
  var SHARE_USAGE2 = "Usage: laze vault share <connection> --with <email|userId> [--for 1h]";
94698
94549
  var WAITING_LINE = "It waits for the owner's approval with a passkey or Face ID, in Settings > Vault.";
@@ -94821,7 +94672,7 @@ async function secretText({ context, args }) {
94821
94672
  );
94822
94673
  }
94823
94674
  const file4 = flagText({ args, name: "from-file" });
94824
- const text3 = file4 ? await readFile23(file4, "utf8") : await context.readStdin();
94675
+ const text3 = file4 ? await readFile22(file4, "utf8") : await context.readStdin();
94825
94676
  const trimmed = text3.replace(/\r?\n$/, "");
94826
94677
  if (!trimmed.trim()) throw new CliUsageError("No value: pipe it on stdin or use --from-file.");
94827
94678
  const held = await placeholdersOf({ env: context.environment.inherited });
@@ -95066,7 +94917,7 @@ async function keyText({ context, args }) {
95066
94917
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
95067
94918
  }
95068
94919
  const file4 = flagText({ args, name: "from-file" });
95069
- const text3 = file4 ? await readFile24(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
94920
+ const text3 = file4 ? await readFile23(resolve14(context.cwd, file4), "utf8") : await context.readStdin();
95070
94921
  const trimmed = text3.trim();
95071
94922
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
95072
94923
  return trimmed;
@@ -95455,7 +95306,7 @@ async function conversationDelete({ context, args }) {
95455
95306
  }
95456
95307
 
95457
95308
  // src/services/discord-commands.service.ts
95458
- import { readFile as readFile25 } from "node:fs/promises";
95309
+ import { readFile as readFile24 } from "node:fs/promises";
95459
95310
  import { resolve as resolve15 } from "node:path";
95460
95311
 
95461
95312
  // ../../modules/discord/contract/src/discord.ts
@@ -95803,7 +95654,7 @@ async function secretsOf({ context, args }) {
95803
95654
  const fromConnection = flagText({ args, name: "from-vault" });
95804
95655
  if (fromConnection) return { fromConnection };
95805
95656
  const file4 = flagText({ args, name: "from-file" });
95806
- const text3 = file4 ? await readFile25(resolve15(context.cwd, file4), "utf8") : await context.readStdin();
95657
+ const text3 = file4 ? await readFile24(resolve15(context.cwd, file4), "utf8") : await context.readStdin();
95807
95658
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
95808
95659
  if (lines2.length !== 2) {
95809
95660
  throw new CliUsageError(
@@ -96106,7 +95957,7 @@ async function domains({ context, args }) {
96106
95957
  }
96107
95958
 
96108
95959
  // src/services/emoji-commands.service.ts
96109
- import { readFile as readFile26 } from "node:fs/promises";
95960
+ import { readFile as readFile25 } from "node:fs/promises";
96110
95961
  import { resolve as resolve16 } from "node:path";
96111
95962
  var EMOJI_USAGE = `Usage:
96112
95963
  laze emoji list [--json] the workspace's custom emoji, aliases and who added each
@@ -96147,7 +95998,7 @@ async function addEmoji({ context, args, client }) {
96147
95998
  const file4 = wordAt4(args, 3);
96148
95999
  let bytes;
96149
96000
  try {
96150
- bytes = new Uint8Array(await readFile26(resolve16(context.cwd, file4)));
96001
+ bytes = new Uint8Array(await readFile25(resolve16(context.cwd, file4)));
96151
96002
  } catch {
96152
96003
  throw new CliUsageError(`Cannot read ${file4}.`);
96153
96004
  }
@@ -96486,7 +96337,7 @@ var ExternalChannelBannerSlot = externalUi.component("channel-banner");
96486
96337
  var ExternalSharingHooksToken = externalUi.hooks("sharing");
96487
96338
 
96488
96339
  // src/services/workspace-commands.service.ts
96489
- import { readFile as readFile27 } from "node:fs/promises";
96340
+ import { readFile as readFile26 } from "node:fs/promises";
96490
96341
  import { resolve as resolve17 } from "node:path";
96491
96342
  var ROLE_NAMES2 = {
96492
96343
  OWNER: "Owner",
@@ -96669,7 +96520,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
96669
96520
  async function readLogo({ context, file: file4 }) {
96670
96521
  let bytes;
96671
96522
  try {
96672
- bytes = new Uint8Array(await readFile27(resolve17(context.cwd, file4)));
96523
+ bytes = new Uint8Array(await readFile26(resolve17(context.cwd, file4)));
96673
96524
  } catch {
96674
96525
  throw new CliUsageError(`No file to read at ${file4}.`);
96675
96526
  }
@@ -97304,7 +97155,7 @@ async function agentFeedAccess({
97304
97155
  }
97305
97156
 
97306
97157
  // src/services/feed-commands.service.ts
97307
- import { readFile as readFile28 } from "node:fs/promises";
97158
+ import { readFile as readFile27 } from "node:fs/promises";
97308
97159
  import { resolve as resolve18 } from "node:path";
97309
97160
 
97310
97161
  // ../../modules/feed/contract/src/feed.delegate.ts
@@ -98458,7 +98309,7 @@ async function feedTurnOf({
98458
98309
  const read4 = async () => {
98459
98310
  const pinned = env.LAZE_TURN_TOKEN?.trim();
98460
98311
  if (pinned) return pinned;
98461
- if (env.LAZE_TURN_FILE) return (await readFile28(env.LAZE_TURN_FILE, "utf8")).trim();
98312
+ if (env.LAZE_TURN_FILE) return (await readFile27(env.LAZE_TURN_FILE, "utf8")).trim();
98462
98313
  return agent3 ? connectedTurnTokenOf({ client, channelId: channel }) : "";
98463
98314
  };
98464
98315
  const turn = await read4().catch(() => "");
@@ -98532,7 +98383,7 @@ async function bodyOf2({
98532
98383
  flags: flags2
98533
98384
  }) {
98534
98385
  const body = { ...flags2.fields };
98535
- const read4 = (source) => "file" in source ? readFile28(resolve18(context.cwd, source.file), "utf8") : source.text;
98386
+ const read4 = (source) => "file" in source ? readFile27(resolve18(context.cwd, source.file), "utf8") : source.text;
98536
98387
  for (const [field, source] of Object.entries(flags2.texts)) body[field] = await read4(source);
98537
98388
  if (flags2.rich) {
98538
98389
  const text3 = await read4(flags2.rich.source);
@@ -98809,7 +98660,7 @@ async function textFlag({
98809
98660
  }) {
98810
98661
  const value = flagText({ args, name: name3 });
98811
98662
  if (!value.startsWith("@")) return value;
98812
- return readFile28(resolve18(context.cwd, value.slice(1)), "utf8");
98663
+ return readFile27(resolve18(context.cwd, value.slice(1)), "utf8");
98813
98664
  }
98814
98665
  async function feedList({ context, args }) {
98815
98666
  const { client, profile } = await signedIn({ context, args });
@@ -98899,7 +98750,7 @@ async function ranksOf({
98899
98750
  }) {
98900
98751
  const file4 = flagText({ args, name: "file" });
98901
98752
  if (file4) {
98902
- const parsed = JSON.parse(await readFile28(resolve18(context.cwd, file4), "utf8"));
98753
+ const parsed = JSON.parse(await readFile27(resolve18(context.cwd, file4), "utf8"));
98903
98754
  if (Array.isArray(parsed)) return parsed;
98904
98755
  throw new CliUsageError("--file holds a list of {itemId, priority}");
98905
98756
  }
@@ -99014,7 +98865,7 @@ async function feed({ context, args }) {
99014
98865
  }
99015
98866
 
99016
98867
  // src/services/github-commands.service.ts
99017
- import { readFile as readFile29 } from "node:fs/promises";
98868
+ import { readFile as readFile28 } from "node:fs/promises";
99018
98869
 
99019
98870
  // src/rules/github-signature.rules.ts
99020
98871
  var TURN_SEPARATOR = "~";
@@ -99084,7 +98935,7 @@ var REAL_GH = "/usr/bin/gh";
99084
98935
  var NOT_SET = "laze: agent_github_not_set: this agent has no GitHub connection. Run `laze github request --repo <owner/name>` to post a card that gets it in one click, or its owner runs `laze agent set-github <agent> <connection>`.";
99085
98936
  async function turnFileToken({ env }) {
99086
98937
  if (!env.LAZE_TURN_FILE) return "";
99087
- return readFile29(env.LAZE_TURN_FILE, "utf8").then(
98938
+ return readFile28(env.LAZE_TURN_FILE, "utf8").then(
99088
98939
  (text3) => text3.trim(),
99089
98940
  () => ""
99090
98941
  );
@@ -99118,7 +98969,7 @@ async function githubGh({
99118
98969
  args: args.rest,
99119
98970
  agentName: profile.name ?? "An agent",
99120
98971
  threadUrl: threadUrlOf({ env, workspaceId: profile.workspaceId }),
99121
- readBodyFile: (path) => path === "-" ? context.readStdin() : readFile29(path, "utf8")
98972
+ readBodyFile: (path) => path === "-" ? context.readStdin() : readFile28(path, "utf8")
99122
98973
  });
99123
98974
  return context.runCommand({
99124
98975
  command: [REAL_GH, ...ghArgs],
@@ -99782,7 +99633,7 @@ async function ip({ context, args }) {
99782
99633
  }
99783
99634
 
99784
99635
  // src/services/join-commands.service.ts
99785
- import { rm as rm17 } from "node:fs/promises";
99636
+ import { rm as rm16 } from "node:fs/promises";
99786
99637
  import { hostname as hostname9 } from "node:os";
99787
99638
  import { dirname as dirname22, join as join31 } from "node:path";
99788
99639
  var DEFAULT_WAIT_SECONDS2 = 100;
@@ -99804,7 +99655,7 @@ async function keepPending({ context, pending: pending2 }) {
99804
99655
  await writeStateJson({ path: pendingPathOf({ context }), value: pending2 });
99805
99656
  }
99806
99657
  async function dropPending({ context }) {
99807
- await rm17(pendingPathOf({ context }), { force: true });
99658
+ await rm16(pendingPathOf({ context }), { force: true });
99808
99659
  }
99809
99660
  function waitSecondsOf3({ args }) {
99810
99661
  const raw = flagText({ args, name: "timeout" });
@@ -100734,7 +100585,14 @@ ${USAGE13}`);
100734
100585
  ${USAGE13}`);
100735
100586
  const env = {};
100736
100587
  for (const connection of new Set(connections)) {
100737
- const released = await vaultRelease({ context, args, connection, reason: reason2, command: args.rest });
100588
+ const released = await vaultRelease({
100589
+ context,
100590
+ args,
100591
+ connection,
100592
+ reason: reason2,
100593
+ command: args.rest,
100594
+ value: true
100595
+ });
100738
100596
  if ("exitCode" in released) return released;
100739
100597
  Object.assign(env, released.env);
100740
100598
  }
@@ -101063,18 +100921,18 @@ async function serveMcp({
101063
100921
  }
101064
100922
 
101065
100923
  // src/services/memory-commands.service.ts
101066
- import { readdir as readdir7, readFile as readFile31 } from "node:fs/promises";
100924
+ import { readdir as readdir7, readFile as readFile30 } from "node:fs/promises";
101067
100925
  import { join as join32, resolve as resolve20 } from "node:path";
101068
100926
 
101069
100927
  // src/services/mount-files.service.ts
101070
- import { mkdir as mkdir11, readFile as readFile30, rm as rm18, writeFile as writeFile8 } from "node:fs/promises";
100928
+ import { mkdir as mkdir11, readFile as readFile29, rm as rm17, writeFile as writeFile8 } from "node:fs/promises";
101071
100929
  import { dirname as dirname23, relative as relative4, resolve as resolve19 } from "node:path";
101072
100930
  async function textArgument({
101073
100931
  context,
101074
100932
  value
101075
100933
  }) {
101076
100934
  if (value === "-") return context.readStdin();
101077
- if (value.startsWith("@")) return readFile30(resolve19(context.cwd, value.slice(1)), "utf8");
100935
+ if (value.startsWith("@")) return readFile29(resolve19(context.cwd, value.slice(1)), "utf8");
101078
100936
  return value;
101079
100937
  }
101080
100938
  function turnChannel({ context, args }) {
@@ -101087,7 +100945,7 @@ async function writeMount({
101087
100945
  files: files2
101088
100946
  }) {
101089
100947
  const root = resolve19(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
101090
- await rm18(root, { recursive: true, force: true });
100948
+ await rm17(root, { recursive: true, force: true });
101091
100949
  await mkdir11(root, { recursive: true });
101092
100950
  for (const file4 of files2) {
101093
100951
  const target = resolve19(root, file4.path);
@@ -101221,7 +101079,7 @@ async function turnTokenOf5({ context }) {
101221
101079
  const pinned = env.LAZE_TURN_TOKEN?.trim();
101222
101080
  if (pinned) return pinned;
101223
101081
  if (!env.LAZE_TURN_FILE) return "";
101224
- return readFile31(env.LAZE_TURN_FILE, "utf8").then(
101082
+ return readFile30(env.LAZE_TURN_FILE, "utf8").then(
101225
101083
  (text3) => text3.trim(),
101226
101084
  () => ""
101227
101085
  );
@@ -101351,7 +101209,7 @@ async function siestaImport({
101351
101209
  dir
101352
101210
  }) {
101353
101211
  const root = resolve20(context.cwd, dir);
101354
- const log = await readFile31(join32(root, "LOG.md"));
101212
+ const log = await readFile30(join32(root, "LOG.md"));
101355
101213
  const names = (await readdir7(join32(root, "tree")).catch(() => [])).filter(
101356
101214
  (name3) => /^\d{1,6}-\d{1,6}\.md$/.test(name3)
101357
101215
  );
@@ -101359,7 +101217,7 @@ async function siestaImport({
101359
101217
  await Promise.all(
101360
101218
  names.map(async (name3) => [
101361
101219
  name3.slice(0, -3),
101362
- (await readFile31(join32(root, "tree", name3))).toString("base64")
101220
+ (await readFile30(join32(root, "tree", name3))).toString("base64")
101363
101221
  ])
101364
101222
  )
101365
101223
  );
@@ -101379,7 +101237,7 @@ async function memoryImport({ context, args }) {
101379
101237
  const dir = flagText({ args, name: "optmem" });
101380
101238
  if (!dir) throw new CliUsageError(USAGE14);
101381
101239
  const root = resolve20(context.cwd, dir);
101382
- const log = await readFile31(join32(root, "LOG.txt"));
101240
+ const log = await readFile30(join32(root, "LOG.txt"));
101383
101241
  const sizes2 = (await readdir7(join32(root, "TREE")).catch(() => [])).filter(
101384
101242
  (name3) => /^\d{1,4}$/.test(name3)
101385
101243
  );
@@ -101387,7 +101245,7 @@ async function memoryImport({ context, args }) {
101387
101245
  await Promise.all(
101388
101246
  sizes2.map(async (size) => [
101389
101247
  size,
101390
- (await readFile31(join32(root, "TREE", size))).toString("base64")
101248
+ (await readFile30(join32(root, "TREE", size))).toString("base64")
101391
101249
  ])
101392
101250
  )
101393
101251
  );
@@ -101984,7 +101842,7 @@ async function openclaw({
101984
101842
 
101985
101843
  // src/services/operator-key-commands.service.ts
101986
101844
  import { createHash as createHash10, randomBytes as randomBytes5 } from "node:crypto";
101987
- import { mkdir as mkdir12, readFile as readFile32, rm as rm19, writeFile as writeFile9 } from "node:fs/promises";
101845
+ import { mkdir as mkdir12, readFile as readFile31, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
101988
101846
  import { dirname as dirname24, join as join33 } from "node:path";
101989
101847
 
101990
101848
  // ../../modules/audit-log/contract/src/audit-log.api.ts
@@ -103923,7 +103781,7 @@ async function forgetIfOver({
103923
103781
  const key = await client.post(OPERATOR_KEY_REST_PATHS.status, { keyId });
103924
103782
  const windowOver = key.endsAt !== null && Temporal3.Instant.from(key.endsAt).epochMilliseconds <= context.nowMs();
103925
103783
  if (key.status !== "pending" && (key.status !== "approved" || windowOver || key.spentAt)) {
103926
- await rm19(keyFile({ context, keyId }), { force: true });
103784
+ await rm18(keyFile({ context, keyId }), { force: true });
103927
103785
  }
103928
103786
  return key;
103929
103787
  }
@@ -103936,7 +103794,7 @@ async function useKey({
103936
103794
  if (!keyId) throw new CliUsageError(OPERATOR_KEY_USAGE);
103937
103795
  const { client } = await signedIn({ context, args });
103938
103796
  const path = keyFile({ context, keyId });
103939
- const secret = await readFile32(path, "utf8").catch(() => null);
103797
+ const secret = await readFile31(path, "utf8").catch(() => null);
103940
103798
  if (secret === null) {
103941
103799
  throw new CliUsageError(`No operator key ${keyId} is kept on this machine.`);
103942
103800
  }
@@ -104135,7 +103993,7 @@ function watchingRelease({
104135
103993
  }
104136
103994
 
104137
103995
  // src/services/rush-guard.service.ts
104138
- import { rm as rm20 } from "node:fs/promises";
103996
+ import { rm as rm19 } from "node:fs/promises";
104139
103997
  var WATCH_MS3 = 2e3;
104140
103998
  async function guardRound(guard) {
104141
103999
  const { context, client, name: name3, lock, claudePid, session, rush, launch } = guard;
@@ -104222,10 +104080,10 @@ async function rushWakeHook({ context, args }) {
104222
104080
  return await guardRounds(guard);
104223
104081
  } finally {
104224
104082
  if ((await holderOf({ path: lock }))?.pid === context.processes.pid)
104225
- await rm20(lock, { force: true });
104083
+ await rm19(lock, { force: true });
104226
104084
  }
104227
104085
  } finally {
104228
- await rm20(path, { force: true });
104086
+ await rm19(path, { force: true });
104229
104087
  }
104230
104088
  }
104231
104089
 
@@ -104394,7 +104252,7 @@ async function schedule({ context, args }) {
104394
104252
  }
104395
104253
 
104396
104254
  // src/services/skill-commands.service.ts
104397
- import { readdir as readdir8, readFile as readFile33 } from "node:fs/promises";
104255
+ import { readdir as readdir8, readFile as readFile32 } from "node:fs/promises";
104398
104256
  import { join as join35, relative as relative5, resolve as resolve22 } from "node:path";
104399
104257
  var USAGE18 = `Usage:
104400
104258
  laze skill list [--agent <agentId>]
@@ -104417,7 +104275,7 @@ async function folderFiles({ root }) {
104417
104275
  for (const entry2 of entries) {
104418
104276
  if (!entry2.isFile()) continue;
104419
104277
  const full = join35(entry2.parentPath, entry2.name);
104420
- files2.push({ path: relative5(root, full), content: await readFile33(full, "utf8") });
104278
+ files2.push({ path: relative5(root, full), content: await readFile32(full, "utf8") });
104421
104279
  }
104422
104280
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
104423
104281
  }
@@ -104515,7 +104373,7 @@ async function skillUpdate({ context, args }) {
104515
104373
  if (!name3 || !newName && description === void 0 && !skillMdFile) {
104516
104374
  throw new CliUsageError(USAGE18);
104517
104375
  }
104518
- const skillMd = skillMdFile ? await readFile33(resolve22(context.cwd, skillMdFile), "utf8") : void 0;
104376
+ const skillMd = skillMdFile ? await readFile32(resolve22(context.cwd, skillMdFile), "utf8") : void 0;
104519
104377
  const { client } = await signedIn({ context, args });
104520
104378
  const updated = await client.post("/api/skills/update", {
104521
104379
  name: name3,
@@ -104561,7 +104419,7 @@ async function skill({ context, args }) {
104561
104419
  }
104562
104420
 
104563
104421
  // src/services/slack-commands.service.ts
104564
- import { readFile as readFile34 } from "node:fs/promises";
104422
+ import { readFile as readFile33 } from "node:fs/promises";
104565
104423
  import { resolve as resolve23 } from "node:path";
104566
104424
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
104567
104425
  laze slack overview connected Slack workspaces, mirrors, your link
@@ -104612,7 +104470,7 @@ async function secretLines({ context, args }) {
104612
104470
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
104613
104471
  }
104614
104472
  const file4 = flagText({ args, name: "from-file" });
104615
- const text3 = file4 ? await readFile34(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
104473
+ const text3 = file4 ? await readFile33(resolve23(context.cwd, file4), "utf8") : await context.readStdin();
104616
104474
  return text3.split("\n").map((line) => line.trim()).filter(Boolean);
104617
104475
  }
104618
104476
  async function secretsOf2({
@@ -104930,7 +104788,7 @@ async function slack({
104930
104788
  }
104931
104789
 
104932
104790
  // src/services/sso-commands.service.ts
104933
- import { readFile as readFile35 } from "node:fs/promises";
104791
+ import { readFile as readFile34 } from "node:fs/promises";
104934
104792
  var SSO_USAGE = `Usage:
104935
104793
  laze sso domains claimed domains and how each signs in (admins)
104936
104794
  laze sso claim <domain> the TXT record that proves the domain
@@ -105017,7 +104875,7 @@ function refuseSecretFlags({ args }) {
105017
104875
  }
105018
104876
  async function clientSecretOf({ context, args }) {
105019
104877
  const file4 = flagText({ args, name: "from-file" });
105020
- const text3 = file4 ? await readFile35(file4, "utf8") : await context.readStdin();
104878
+ const text3 = file4 ? await readFile34(file4, "utf8") : await context.readStdin();
105021
104879
  const secret = text3.trim();
105022
104880
  if (!secret) throw new CliUsageError("No client secret: pipe it on stdin or use --from-file.");
105023
104881
  return secret;
@@ -105361,7 +105219,7 @@ async function checkInstalled({
105361
105219
  }
105362
105220
 
105363
105221
  // src/services/vault-env-commands.service.ts
105364
- import { readFile as readFile36, stat as stat12 } from "node:fs/promises";
105222
+ import { readFile as readFile35, stat as stat12 } from "node:fs/promises";
105365
105223
  import { dirname as dirname26, join as join36, resolve as resolve24 } from "node:path";
105366
105224
 
105367
105225
  // src/rules/vault-manifest.rules.ts
@@ -105449,6 +105307,243 @@ function credentialProcessJson(fields) {
105449
105307
  });
105450
105308
  }
105451
105309
 
105310
+ // src/services/vault-batch.service.ts
105311
+ import { rm as rm20 } from "node:fs/promises";
105312
+ async function batchOf({ response }) {
105313
+ const text3 = await response.text();
105314
+ if (!response.ok) {
105315
+ const code4 = /"code"\s*:\s*"([^"]+)"/.exec(text3)?.[1] ?? `status ${response.status}`;
105316
+ throw new CliUsageError(`laze vault: the batch was refused (${code4})`);
105317
+ }
105318
+ return JSON.parse(text3);
105319
+ }
105320
+ async function doorOf({
105321
+ context,
105322
+ args,
105323
+ keyName
105324
+ }) {
105325
+ const env = context.environment.inherited;
105326
+ const proxy = proxyOf({ env });
105327
+ if (proxy) {
105328
+ const turnFile = turnFileOf({ env });
105329
+ const headers = {
105330
+ "proxy-authorization": proxy.authorization,
105331
+ "x-laze-turn": await turnTokenOf2({ env, turnFile, command: "laze vault env" })
105332
+ };
105333
+ return {
105334
+ keyPath: runKeyPathOf({ turnFile, connection: keyName }),
105335
+ ask: async (body) => batchOf({
105336
+ response: await reach({
105337
+ context,
105338
+ url: `${proxy.origin}/vault/release-batch`,
105339
+ init: {
105340
+ method: "POST",
105341
+ headers: { ...headers, "content-type": "application/json" },
105342
+ body: JSON.stringify(body)
105343
+ }
105344
+ })
105345
+ }),
105346
+ status: async (requestId) => releaseOf({
105347
+ response: await reach({
105348
+ context,
105349
+ url: `${proxy.origin}/vault/release/${encodeURIComponent(requestId)}`,
105350
+ init: { method: "GET", headers }
105351
+ })
105352
+ })
105353
+ };
105354
+ }
105355
+ const signed2 = await signedIn({ context, args }).catch(() => null);
105356
+ if (signed2?.profile.kind !== "agent" && signed2?.profile.kind !== "person") {
105357
+ throw new CliUsageError(`laze vault env ${WHERE}`);
105358
+ }
105359
+ const { name: name3 } = signed2;
105360
+ const harnessSession = await currentSessionOf({ context, args });
105361
+ const client = forSession({ client: signed2.client, session: harnessSession });
105362
+ const door = signed2.profile.kind === "person" ? {
105363
+ ask: "/api/vault/session/release-batch",
105364
+ status: "/api/vault/session/release-status",
105365
+ extra: { session: await vaultSessionFor({ context, args, harnessSession }) }
105366
+ } : {
105367
+ ask: "/api/agents/me/vault/release-batch",
105368
+ status: "/api/agents/me/vault/release-status",
105369
+ extra: { channelId: flagText({ args, name: "channel" }) || null }
105370
+ };
105371
+ return {
105372
+ keyPath: runKeyPathOf({ turnFile: void 0, connection: keyName, profile: name3 }),
105373
+ ask: async (body) => {
105374
+ try {
105375
+ return await client.post(door.ask, { ...body, ...door.extra });
105376
+ } catch (error63) {
105377
+ if (!(error63 instanceof LazeApiError)) throw error63;
105378
+ throw new CliUsageError(`laze vault: the batch was refused: ${refusalText(error63)}`);
105379
+ }
105380
+ },
105381
+ status: (requestId) => patiently({
105382
+ context,
105383
+ call: () => client.post(door.status, { requestId, ...door.extra })
105384
+ }).catch(refusedRelease)
105385
+ };
105386
+ }
105387
+ async function resolveBatch({
105388
+ context,
105389
+ args,
105390
+ refs
105391
+ }) {
105392
+ const door = await doorOf({ context, args, keyName: "env-names" });
105393
+ const answer6 = await door.ask({ refs, reason: "", command: [], resolveOnly: true });
105394
+ return answer6.entries;
105395
+ }
105396
+ var keyOf = (entry2) => entry2.connection?.name ?? entry2.ref;
105397
+ async function untilAllAnswered({
105398
+ context,
105399
+ door,
105400
+ waiting,
105401
+ deadline
105402
+ }) {
105403
+ const answered = /* @__PURE__ */ new Map();
105404
+ if (waiting.size === 0) return answered;
105405
+ const [first] = waiting.values();
105406
+ context.err(
105407
+ `laze vault: ${[...waiting.keys()].join(", ")} wait for an answer (${first?.message ?? "a card"}); cards expire after 24 hours...
105408
+ `
105409
+ );
105410
+ while (waiting.size > 0) {
105411
+ if (context.nowMs() + POLL_MS > deadline) {
105412
+ context.err(
105413
+ `laze vault: ${[...waiting.keys()].join(", ")} not approved yet; ask again later.
105414
+ `
105415
+ );
105416
+ return "capped";
105417
+ }
105418
+ await context.sleep(POLL_MS);
105419
+ for (const [key, pending2] of waiting) {
105420
+ const next = await door.status(pending2.requestId);
105421
+ if (next.outcome === "ask") waiting.set(key, next);
105422
+ else {
105423
+ waiting.delete(key);
105424
+ answered.set(key, next);
105425
+ }
105426
+ }
105427
+ }
105428
+ return answered;
105429
+ }
105430
+ async function releaseBatch({
105431
+ context,
105432
+ args,
105433
+ refs,
105434
+ reason: reason2,
105435
+ command
105436
+ }) {
105437
+ const deadline = deadlineOf({ args, nowMs: context.nowMs() });
105438
+ const door = await doorOf({ context, args, keyName: `env:${[...refs].toSorted().join(",")}` });
105439
+ const run4 = await runKeyAt({ path: door.keyPath });
105440
+ let answer6;
105441
+ let settled3;
105442
+ try {
105443
+ answer6 = await door.ask({
105444
+ refs,
105445
+ reason: reason2,
105446
+ command,
105447
+ recipient: run4.publicKey
105448
+ });
105449
+ const missing = answer6.entries.filter((entry2) => !entry2.connection);
105450
+ if (missing.length > 0) {
105451
+ context.err(
105452
+ `laze vault: no key named ${missing.map((entry2) => entry2.ref).join(", ")} in your vault or reachable by this agent
105453
+ `
105454
+ );
105455
+ return { exitCode: 1 };
105456
+ }
105457
+ const sorted = sortedReleasesOf({ entries: answer6.entries });
105458
+ settled3 = sorted.settled;
105459
+ const { waiting } = sorted;
105460
+ const later = await untilAllAnswered({ context, door, waiting, deadline });
105461
+ if (later === "capped") return { exitCode: 75 };
105462
+ for (const [key, release2] of later) settled3.set(key, release2);
105463
+ } catch (error63) {
105464
+ if (!(error63 instanceof ServerGoneError)) throw error63;
105465
+ context.err(`${error63.message}. Run the command again to keep waiting.
105466
+ `);
105467
+ return { exitCode: 75 };
105468
+ }
105469
+ const unswapped = answer6.entries.find((entry2) => entry2.boundary && !entry2.release);
105470
+ if (unswapped) {
105471
+ context.err(
105472
+ `laze vault: ${unswapped.ref} is swapped by Laze's proxy, which did not hand out its stand-in; run the command again
105473
+ `
105474
+ );
105475
+ return { exitCode: 75 };
105476
+ }
105477
+ const outcome = await valuesOf({
105478
+ context,
105479
+ entries: answer6.entries,
105480
+ settled: settled3,
105481
+ run: run4,
105482
+ keyPath: door.keyPath
105483
+ });
105484
+ if ("exitCode" in outcome) return outcome;
105485
+ for (const [key, release2] of settled3) {
105486
+ if (release2.outcome !== "allow" || !release2.boundary) continue;
105487
+ const { connectionId } = release2.boundary;
105488
+ await handedOut({ context, name: key, connectionId, fields: release2.env });
105489
+ }
105490
+ return outcome;
105491
+ }
105492
+ function sortedReleasesOf({ entries }) {
105493
+ const settled3 = /* @__PURE__ */ new Map();
105494
+ const waiting = /* @__PURE__ */ new Map();
105495
+ for (const entry2 of entries) {
105496
+ const release2 = entry2.release;
105497
+ if (!release2) continue;
105498
+ if (release2.outcome === "ask") waiting.set(keyOf(entry2), release2);
105499
+ else settled3.set(keyOf(entry2), release2);
105500
+ }
105501
+ return { settled: settled3, waiting };
105502
+ }
105503
+ function refusalOf({
105504
+ context,
105505
+ settled: settled3
105506
+ }) {
105507
+ const codes = [];
105508
+ for (const release2 of settled3.values()) {
105509
+ if (release2.outcome !== "deny") continue;
105510
+ context.err(`${release2.message}
105511
+ `);
105512
+ codes.push(release2.exitCode || 1);
105513
+ }
105514
+ if (codes.length === 0) return 0;
105515
+ return codes.includes(77) ? 77 : codes[0] ?? 1;
105516
+ }
105517
+ async function valuesOf({
105518
+ context,
105519
+ entries,
105520
+ settled: settled3,
105521
+ run: run4,
105522
+ keyPath
105523
+ }) {
105524
+ const refused = refusalOf({ context, settled: settled3 });
105525
+ if (refused !== 0) {
105526
+ await rm20(keyPath, { force: true });
105527
+ return { exitCode: refused };
105528
+ }
105529
+ const opened = /* @__PURE__ */ new Map();
105530
+ let keep2 = false;
105531
+ for (const [key, release2] of settled3) {
105532
+ if (release2.outcome !== "allow") continue;
105533
+ opened.set(key, await envOf({ release: release2, run: run4 }));
105534
+ if (leaseHolds({ release: release2, nowMs: context.nowMs() })) keep2 = true;
105535
+ if (release2.message) context.err(`${release2.message}
105536
+ `);
105537
+ }
105538
+ if (!keep2) await rm20(keyPath, { force: true });
105539
+ const released = /* @__PURE__ */ new Map();
105540
+ for (const entry2 of entries) {
105541
+ const fields = opened.get(keyOf(entry2));
105542
+ if (fields) released.set(entry2.ref, { fields });
105543
+ }
105544
+ return { released, entries };
105545
+ }
105546
+
105452
105547
  // src/services/vault-env-commands.service.ts
105453
105548
  var ENV_USAGE = `Usage: laze vault env [<file>] [--env <name>] --reason "<one plain sentence>" [--wait <s>] -- <command> [args...]
105454
105549
  laze vault env [<file>] [--env <name>] --names
@@ -105518,7 +105613,7 @@ async function manifestOf({
105518
105613
  args
105519
105614
  }) {
105520
105615
  const file4 = await manifestPathOf({ context, args });
105521
- const text3 = await readFile36(file4, "utf8").catch(() => {
105616
+ const text3 = await readFile35(file4, "utf8").catch(() => {
105522
105617
  throw new CliUsageError(`laze vault: cannot read ${file4}`);
105523
105618
  });
105524
105619
  return { file: file4, lines: parseManifest({ text: text3, file: file4 }) };
@@ -105880,7 +105975,7 @@ async function vaultScrub({ context, args }) {
105880
105975
  }
105881
105976
 
105882
105977
  // src/services/whatsapp-business-commands.service.ts
105883
- import { readFile as readFile37 } from "node:fs/promises";
105978
+ import { readFile as readFile36 } from "node:fs/promises";
105884
105979
  import { resolve as resolve25 } from "node:path";
105885
105980
 
105886
105981
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
@@ -106377,7 +106472,7 @@ async function secretsOf3({ context, args }) {
106377
106472
  const fromConnection = flagText({ args, name: "from-vault" });
106378
106473
  if (fromConnection) return { fromConnection };
106379
106474
  const file4 = flagText({ args, name: "from-file" });
106380
- const text3 = file4 ? await readFile37(resolve25(context.cwd, file4), "utf8") : await context.readStdin();
106475
+ const text3 = file4 ? await readFile36(resolve25(context.cwd, file4), "utf8") : await context.readStdin();
106381
106476
  const lines2 = text3.split("\n").map((line) => line.trim()).filter(Boolean);
106382
106477
  if (lines2.length !== 2) {
106383
106478
  throw new CliUsageError(
@@ -107093,6 +107188,8 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
107093
107188
  your reply is the post or reply: once it is where it belongs, end the turn with no recap
107094
107189
  --new-thread on reply starts a thread under a top-level message instead
107095
107190
  --also-channel on a thread reply shows it in the channel too, as "Also send to #channel" does
107191
+ in a DM paired with Slack a post goes where you picked in that DM (via Laze and Slack unless
107192
+ you changed it); --via laze|slack|both on post or reply sends this one message elsewhere
107096
107193
  --image <path|url|fileId> and --file <path|url|fileId> on post or reply attach files
107097
107194
  (repeatable, at most 6), uploaded to the conversation as the web composer does
107098
107195
  --at 2026-10-20T09:00 [--tz Europe/Amsterdam] on post or reply sends it later instead
@@ -107582,7 +107679,7 @@ import {
107582
107679
  randomBytes as randomBytes6,
107583
107680
  sign
107584
107681
  } from "node:crypto";
107585
- import { chmod, link, mkdir as mkdir13, readFile as readFile38, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
107682
+ import { chmod, link, mkdir as mkdir13, readFile as readFile37, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
107586
107683
  import { dirname as dirname27, join as join37 } from "node:path";
107587
107684
  var KEYCHAIN_SERVICE = "laze-cli-machine-key";
107588
107685
  var runProgram = ({ program, args, stdin: stdin2, timeoutMs }) => new Promise((resolve27, reject) => {
@@ -107655,7 +107752,7 @@ var MachineKeyStore = class _MachineKeyStore {
107655
107752
  async read() {
107656
107753
  let meta3;
107657
107754
  try {
107658
- meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile38(this.metaPath, "utf8")));
107755
+ meta3 = machineKeyRegistrationSchema.parse(JSON.parse(await readFile37(this.metaPath, "utf8")));
107659
107756
  } catch {
107660
107757
  return null;
107661
107758
  }
@@ -107670,7 +107767,7 @@ var MachineKeyStore = class _MachineKeyStore {
107670
107767
  "-w"
107671
107768
  ],
107672
107769
  timeoutMs: 1e4
107673
- }) : await readFile38(this.pemPathOf(meta3.jwk), "utf8");
107770
+ }) : await readFile37(this.pemPathOf(meta3.jwk), "utf8");
107674
107771
  return keyOf2({ meta: meta3, privateKey: createPrivateKey(pemOf(pem)) });
107675
107772
  }
107676
107773
  async make() {
@@ -107812,7 +107909,7 @@ function machineProofFetch({
107812
107909
  // src/services/processes.service.ts
107813
107910
  import { execFile as execFile3, spawn as spawn4, spawnSync } from "node:child_process";
107814
107911
  import { closeSync, mkdirSync, openSync, renameSync, statSync } from "node:fs";
107815
- import { readFile as readFile39, readlink } from "node:fs/promises";
107912
+ import { readFile as readFile38, readlink } from "node:fs/promises";
107816
107913
  import { dirname as dirname28 } from "node:path";
107817
107914
  import { promisify as promisify2 } from "node:util";
107818
107915
  var run3 = promisify2(execFile3);
@@ -107826,14 +107923,14 @@ function alive(pid) {
107826
107923
  }
107827
107924
  }
107828
107925
  async function argsOf2(pid) {
107829
- const raw = await readFile39(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
107926
+ const raw = await readFile38(`/proc/${pid}/cmdline`, "utf8").catch(() => void 0);
107830
107927
  if (raw) return raw.split("\0").filter(Boolean);
107831
107928
  const listed = await run3("ps", ["-o", "args=", "-p", String(pid)]).catch(() => void 0);
107832
107929
  const line = listed?.stdout.trim();
107833
107930
  return line ? line.split(/\s+/) : void 0;
107834
107931
  }
107835
107932
  async function parentOf(pid) {
107836
- const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
107933
+ const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
107837
107934
  const fromStat = stat13 ? Number(stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[1]) : NaN;
107838
107935
  if (fromStat > 0) return fromStat;
107839
107936
  const listed = await run3("ps", ["-o", "ppid=", "-p", String(pid)]).catch(() => void 0);
@@ -107841,7 +107938,7 @@ async function parentOf(pid) {
107841
107938
  return parent > 0 ? parent : void 0;
107842
107939
  }
107843
107940
  async function startOf(pid) {
107844
- const stat13 = await readFile39(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
107941
+ const stat13 = await readFile38(`/proc/${pid}/stat`, "utf8").catch(() => void 0);
107845
107942
  const ticks = stat13 ? stat13.slice(stat13.lastIndexOf(")") + 2).split(" ")[19] : void 0;
107846
107943
  if (ticks) return ticks;
107847
107944
  const listed = await run3("ps", ["-o", "lstart=", "-p", String(pid)]).catch(() => void 0);