@lazehq/cli 0.1.7 → 0.1.8

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 +271 -103
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -96,9 +96,9 @@ var require_node_gyp_build = __commonJS({
96
96
  var debug = getFirst(path.join(dir, "build/Debug"), matchBuild);
97
97
  if (debug) return debug;
98
98
  }
99
- var prebuild = resolve14(dir);
99
+ var prebuild = resolve15(dir);
100
100
  if (prebuild) return prebuild;
101
- var nearby = resolve14(path.dirname(process.execPath));
101
+ var nearby = resolve15(path.dirname(process.execPath));
102
102
  if (nearby) return nearby;
103
103
  var target = [
104
104
  "platform=" + platform,
@@ -114,7 +114,7 @@ var require_node_gyp_build = __commonJS({
114
114
  // eslint-disable-line
115
115
  ].filter(Boolean).join(" ");
116
116
  throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
117
- function resolve14(dir2) {
117
+ function resolve15(dir2) {
118
118
  var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
119
119
  var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
120
120
  if (!tuple2) return;
@@ -4541,7 +4541,7 @@ function runRedacted({
4541
4541
  cwd
4542
4542
  }) {
4543
4543
  const values = Object.values(env);
4544
- return new Promise((resolve14, reject) => {
4544
+ return new Promise((resolve15, reject) => {
4545
4545
  const [file3, ...args] = command;
4546
4546
  const child = spawn(file3, args, {
4547
4547
  env: { ...baseEnv, ...env },
@@ -4562,7 +4562,7 @@ function runRedacted({
4562
4562
  const drained = Promise.all([pipe2(child.stdout, stdout2), pipe2(child.stderr, stderr2)]);
4563
4563
  child.on("error", reject);
4564
4564
  child.on("close", (code, signal) => {
4565
- void drained.then(() => resolve14(code ?? (signal ? 128 + signalNumber(signal) : 1)));
4565
+ void drained.then(() => resolve15(code ?? (signal ? 128 + signalNumber(signal) : 1)));
4566
4566
  });
4567
4567
  });
4568
4568
  }
@@ -8604,7 +8604,7 @@ function flagText({
8604
8604
  }
8605
8605
 
8606
8606
  // src/rules/cli-version.rules.ts
8607
- var STAMPED = "0.1.7";
8607
+ var STAMPED = "0.1.8";
8608
8608
  function cliVersionOf({ stamped = STAMPED } = {}) {
8609
8609
  return stamped.startsWith("__") ? "dev" : stamped;
8610
8610
  }
@@ -13643,7 +13643,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
13643
13643
  var NONE = 0;
13644
13644
  var ASSUMED = 1;
13645
13645
  var PROVEN = 2;
13646
- function isRecursive(inst, stack, resolve14) {
13646
+ function isRecursive(inst, stack, resolve15) {
13647
13647
  const cached2 = recursive.get(inst);
13648
13648
  if (cached2 !== void 0)
13649
13649
  return cached2 ? PROVEN : NONE;
@@ -13653,7 +13653,7 @@ function isRecursive(inst, stack, resolve14) {
13653
13653
  let result = NONE;
13654
13654
  const check3 = (child) => {
13655
13655
  if (result !== PROVEN && child?._zod) {
13656
- const answer4 = isRecursive(child, stack, resolve14);
13656
+ const answer4 = isRecursive(child, stack, resolve15);
13657
13657
  if (answer4 > result)
13658
13658
  result = answer4;
13659
13659
  }
@@ -13664,7 +13664,7 @@ function isRecursive(inst, stack, resolve14) {
13664
13664
  const desc = Object.getOwnPropertyDescriptor(sh, key);
13665
13665
  if (spread && !desc.enumerable)
13666
13666
  continue;
13667
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve14) : NONE;
13667
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve15) : NONE;
13668
13668
  if (child > answer4)
13669
13669
  answer4 = child;
13670
13670
  }
@@ -13728,7 +13728,7 @@ function isRecursive(inst, stack, resolve14) {
13728
13728
  break;
13729
13729
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
13730
13730
  case "lazy": {
13731
- const inner = def._cachedInner ?? (resolve14 ? inst._zod.innerType : void 0);
13731
+ const inner = def._cachedInner ?? (resolve15 ? inst._zod.innerType : void 0);
13732
13732
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
13733
13733
  break;
13734
13734
  }
@@ -31100,13 +31100,24 @@ var loginCardSchemaDefinition = external_exports.object({
31100
31100
  /** What happened, once settled: "Back on Personal. Sam switched me." */
31101
31101
  outcome: external_exports.string().max(400)
31102
31102
  });
31103
+ var heldCardStateSchema = external_exports.enum(["held", "running", "cancelled"]);
31104
+ var heldCardSchemaDefinition = external_exports.object({
31105
+ type: external_exports.literal("held"),
31106
+ agentId: idSchema4,
31107
+ /** The waiting message. */
31108
+ messageId: idSchema4,
31109
+ /** Who sent it; they may cancel it, and so may the agent's owner. */
31110
+ senderId: idSchema4,
31111
+ state: heldCardStateSchema
31112
+ });
31103
31113
  var messageCardSchemaDefinition = external_exports.discriminatedUnion("type", [
31104
31114
  attentionCardSchemaDefinition,
31105
31115
  connectCardSchemaDefinition,
31106
31116
  appCardSchemaDefinition,
31107
31117
  computerCardSchemaDefinition,
31108
31118
  muteCardSchemaDefinition,
31109
- loginCardSchemaDefinition
31119
+ loginCardSchemaDefinition,
31120
+ heldCardSchemaDefinition
31110
31121
  ]);
31111
31122
  var messageRefSchemaDefinition = external_exports.object({
31112
31123
  /** `conversation` points at a conversation with the agent, by its channel. */
@@ -31190,6 +31201,10 @@ var conversationSchemaDefinition = external_exports.object({
31190
31201
  admins: external_exports.array(chatActorSchemaDefinition).default([]),
31191
31202
  /** A temporary channel archives itself then; null for a channel that stays. */
31192
31203
  endsAt: external_exports.iso.datetime().nullable().default(null),
31204
+ /** No agent answers unless named there, whatever each agent's setting. */
31205
+ mentionedOnly: external_exports.boolean().optional(),
31206
+ /** The agent that answers messages naming no agent; null when the channel has none. */
31207
+ defaultAgentId: external_exports.string().nullable().optional(),
31193
31208
  lastSeq: external_exports.number().int().nonnegative(),
31194
31209
  lastMessageAt: external_exports.iso.datetime().nullable(),
31195
31210
  createdAt: external_exports.iso.datetime(),
@@ -31316,9 +31331,17 @@ var updateChannelInputSchemaDefinition = external_exports.object({
31316
31331
  topic: external_exports.string().trim().max(CHANNEL_TOPIC_MAX).optional(),
31317
31332
  description: external_exports.string().trim().max(CHANNEL_DESCRIPTION_MAX).optional(),
31318
31333
  /** Makes a public channel private; the creator's or a workspace Admin's change, one way only. */
31319
- visibility: external_exports.literal("private").optional()
31334
+ visibility: external_exports.literal("private").optional(),
31335
+ /** No agent answers unless named; a channel Admin's or a workspace Admin's change. */
31336
+ mentionedOnly: external_exports.boolean().optional()
31320
31337
  });
31321
31338
  var updateChannelInputSchema = updateChannelInputSchemaDefinition;
31339
+ var setDefaultAgentInputSchemaDefinition = external_exports.object({
31340
+ workspaceId: workspaceIdSchema,
31341
+ channelId: idSchema4,
31342
+ agentId: external_exports.string().min(1).max(200).nullable()
31343
+ });
31344
+ var setDefaultAgentInputSchema = setDefaultAgentInputSchemaDefinition;
31322
31345
  var newMemberSchemaDefinition = external_exports.object({
31323
31346
  kind: chatActorKindSchema,
31324
31347
  id: idSchema4,
@@ -31402,7 +31425,9 @@ var openAgentDirectInputSchemaDefinition = external_exports.object({
31402
31425
  name: external_exports.string().min(1).max(80),
31403
31426
  /** Where the agent runs; left out, its other memberships decide. */
31404
31427
  runsOutside: external_exports.boolean().optional()
31405
- })
31428
+ }),
31429
+ /** The name an agent opening the DM joins under; a person keeps their own. */
31430
+ openerName: external_exports.string().trim().min(1).max(80).optional()
31406
31431
  });
31407
31432
  var agentChatMemberInputSchemaDefinition = external_exports.object({
31408
31433
  ...openAgentDirectInputSchemaDefinition.shape,
@@ -31973,7 +31998,7 @@ var readableTextInputSchemaDefinition = external_exports.object({
31973
31998
  bodies: external_exports.array(external_exports.string()).max(HISTORY_PAGE_MAX)
31974
31999
  });
31975
32000
  var ChatApi = moduleApi()("chat");
31976
- var chatConversationsTrpc = defineTrpcContract("chat").query("overview").withInput(workspaceInputSchema).withOutput(chatOverviewSchema).query("unreadSummary").withInput(external_exports.object({})).withOutput(external_exports.array(workspaceUnreadSchema)).query("browse").withInput(workspaceInputSchema).withOutput(external_exports.array(browsableChannelSchema)).mutation("createChannel").withInput(createChannelInputSchema).withOutput(conversationSchema).mutation("join").withInput(channelInputSchema).withOutput(conversationSchema).mutation("leave").withInput(channelInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("updateChannel").withInput(updateChannelInputSchema).withOutput(conversationSchema).mutation("archiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("unarchiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("addMembers").withInput(addMembersInputSchema).withOutput(conversationSchema).mutation("removeMember").withInput(removeMemberInputSchema).withOutput(conversationSchema).mutation("openDirect").withInput(openDirectInputSchema).withOutput(conversationSchema).query("conversation").withInput(channelInputSchema).withOutput(conversationSchema).build();
32001
+ var chatConversationsTrpc = defineTrpcContract("chat").query("overview").withInput(workspaceInputSchema).withOutput(chatOverviewSchema).query("unreadSummary").withInput(external_exports.object({})).withOutput(external_exports.array(workspaceUnreadSchema)).query("browse").withInput(workspaceInputSchema).withOutput(external_exports.array(browsableChannelSchema)).mutation("createChannel").withInput(createChannelInputSchema).withOutput(conversationSchema).mutation("join").withInput(channelInputSchema).withOutput(conversationSchema).mutation("leave").withInput(channelInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("updateChannel").withInput(updateChannelInputSchema).withOutput(conversationSchema).mutation("setDefaultAgent").withInput(setDefaultAgentInputSchema).withOutput(conversationSchema).mutation("archiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("unarchiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("addMembers").withInput(addMembersInputSchema).withOutput(conversationSchema).mutation("removeMember").withInput(removeMemberInputSchema).withOutput(conversationSchema).mutation("openDirect").withInput(openDirectInputSchema).withOutput(conversationSchema).query("conversation").withInput(channelInputSchema).withOutput(conversationSchema).build();
31977
32002
  var chatChannelRolesTrpc = defineTrpcContract("chat").mutation("setChannelRole").withInput(setChannelRoleInputSchema).withOutput(conversationSchema).mutation("extendChannel").withInput(extendChannelInputSchema).withOutput(conversationSchema).build();
31978
32003
  var chatMessagesTrpc = defineTrpcContract("chat").query("history").withInput(historyInputSchema).withOutput(historyPageSchema).query("thread").withInput(messageInputSchema).withOutput(threadSchema).mutation("post").withInput(postMessageInputSchema).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();
31979
32004
  var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).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(hideUnfurlInputSchema).withOutput(fileLinkSchema).build();
@@ -32611,7 +32636,9 @@ var messagePostedPayloadSchemaDefinition = external_exports.object({
32611
32636
  attachmentIds: external_exports.array(external_exports.string()),
32612
32637
  createdAt: external_exports.iso.datetime(),
32613
32638
  /** Set when a mirror brought the message in, so the mirror does not send it back out. */
32614
- origin: external_exports.object({ source: mirrorSourceSchema, key: external_exports.string() }).nullable().default(null)
32639
+ origin: external_exports.object({ source: mirrorSourceSchema, key: external_exports.string() }).nullable().default(null),
32640
+ /** The key the sender posted it under, so a module that posts for someone knows its own. */
32641
+ clientKey: external_exports.string().optional()
32615
32642
  });
32616
32643
  var messageChangedPayloadSchemaDefinition = external_exports.object({
32617
32644
  workspaceId: external_exports.string().min(1),
@@ -32867,7 +32894,9 @@ var lazeAgentEventSchemaDefinition = external_exports.discriminatedUnion("type",
32867
32894
  /** Every Laze message the turn took in, prompted or steered: Laze marks them answered. */
32868
32895
  messageIds: external_exports.array(external_exports.string().min(1)).optional(),
32869
32896
  /** Set when the session sends the turn's messages again then (epoch ms): not a failure yet. */
32870
- retryAt: external_exports.number().int().nonnegative().optional()
32897
+ retryAt: external_exports.number().int().nonnegative().optional(),
32898
+ /** Why a failed turn failed, as the session's error event said it. */
32899
+ failure: external_exports.object({ code: external_exports.string().min(1), message: external_exports.string() }).optional()
32871
32900
  }),
32872
32901
  external_exports.object({ type: external_exports.literal("text_delta"), messageId: external_exports.string().optional(), text: external_exports.string() }),
32873
32902
  external_exports.object({
@@ -32898,7 +32927,9 @@ var lazeAgentEventSchemaDefinition = external_exports.discriminatedUnion("type",
32898
32927
  type: external_exports.literal("compaction_ended"),
32899
32928
  trigger: compactionTriggerSchema,
32900
32929
  tokensBefore: external_exports.number().int().nonnegative().optional(),
32901
- tokensAfter: external_exports.number().int().nonnegative().optional()
32930
+ tokensAfter: external_exports.number().int().nonnegative().optional(),
32931
+ /** From its start to its end, when the supervisor saw both. */
32932
+ durationMs: external_exports.number().int().nonnegative().optional()
32902
32933
  }),
32903
32934
  external_exports.object({
32904
32935
  type: external_exports.literal("usage"),
@@ -33701,6 +33732,12 @@ var stopAgentTurnInputSchemaDefinition = external_exports.object({
33701
33732
  channelId: idSchema6
33702
33733
  });
33703
33734
  var stopAgentTurnInputSchema = stopAgentTurnInputSchemaDefinition;
33735
+ var compactAgentSessionInputSchemaDefinition = external_exports.object({
33736
+ workspaceId: workspaceIdSchema3,
33737
+ agentId: idSchema6,
33738
+ channelId: idSchema6
33739
+ });
33740
+ var compactAgentSessionInputSchema = compactAgentSessionInputSchemaDefinition;
33704
33741
  var agentAttentionRequestedPayloadSchemaDefinition = external_exports.object({
33705
33742
  workspaceId: external_exports.string().min(1),
33706
33743
  attentionId: external_exports.string().min(1),
@@ -33742,6 +33779,13 @@ var agentTurnStopRequestedPayloadSchemaDefinition = external_exports.object({
33742
33779
  /** A session reset: the turn stops and the harness starts a fresh session in the main thread. */
33743
33780
  freshSession: external_exports.boolean().optional()
33744
33781
  });
33782
+ var agentCompactRequestedPayloadSchemaDefinition = external_exports.object({
33783
+ workspaceId: external_exports.string().min(1),
33784
+ agentId: external_exports.string().min(1),
33785
+ channelId: external_exports.string().min(1),
33786
+ compactId: external_exports.string().min(1),
33787
+ requestedByUserId: external_exports.string().min(1)
33788
+ });
33745
33789
  var agentAttentionExpiryStateSchemaDefinition = external_exports.object({
33746
33790
  workspaceId: external_exports.string(),
33747
33791
  expiresAt: external_exports.number().nullable()
@@ -35080,6 +35124,7 @@ var vaultPasskeySetUpPayloadSchemaDefinition = external_exports.object({
35080
35124
 
35081
35125
  // ../../modules/vault/contract/src/vault-reference-chip.ts
35082
35126
  var VaultReferenceChipSlot = uiTokens("vault").component("referenceChip");
35127
+ var VaultMessageFootSlot = uiTokens("vault").component("messageFoot");
35083
35128
 
35084
35129
  // ../../modules/vault/contract/src/vault-pending.ts
35085
35130
  var connectionName2 = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
@@ -35927,6 +35972,17 @@ var unwatchGithubAsCallerInputSchemaDefinition = external_exports.object({
35927
35972
  });
35928
35973
  var githubCallerQuerySchemaDefinition = external_exports.object({ agent: callerAgentSchema });
35929
35974
 
35975
+ // ../../modules/agent/contract/src/agent-held.ts
35976
+ var cancelHeldInputSchemaDefinition = external_exports.object({
35977
+ workspaceId: external_exports.string().min(1),
35978
+ agentId: external_exports.string().min(1),
35979
+ /** The waiting message. */
35980
+ messageId: external_exports.string().min(1)
35981
+ });
35982
+ var cancelHeldInputSchema = cancelHeldInputSchemaDefinition;
35983
+ var cancelHeldResultSchemaDefinition = external_exports.object({ cancelled: external_exports.boolean() });
35984
+ var cancelHeldResultSchema = cancelHeldResultSchemaDefinition;
35985
+
35930
35986
  // ../../modules/agent/contract/src/agent-lifecycle.ts
35931
35987
  var workspaceIdSchema5 = external_exports.string().min(1);
35932
35988
  var idSchema9 = external_exports.string().min(1).max(200);
@@ -36168,6 +36224,7 @@ var setAgentPoolAsCallerInputSchema = setAgentPoolInputSchemaDefinition.omit({
36168
36224
  workspaceId: true
36169
36225
  });
36170
36226
  var agentLoginSchemaDefinition = external_exports.object({
36227
+ /** The login's name; empty for a pooled agent that has not run on one of its logins yet. */
36171
36228
  name: external_exports.string(),
36172
36229
  source: external_exports.enum(["personal", "pool"]),
36173
36230
  poolName: external_exports.string().nullable()
@@ -36705,13 +36762,15 @@ var codexLoginRefreshInputSchemaDefinition = external_exports.object({
36705
36762
  authJson: external_exports.string().min(2).max(CODEX_LOGIN_MAX_LENGTH)
36706
36763
  });
36707
36764
  var AgentApi = moduleApi()("agent");
36708
- var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId: workspaceIdSchema8 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).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: workspaceIdSchema8 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema8 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).withOutput(agentAccessSchema).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema8 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema8 })).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: workspaceIdSchema8 })).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: workspaceIdSchema8, agentId: idSchema12 })).withOutput(external_exports.object({ channelId: idSchema12 })).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("oauthRequest").withInput(oauthRequestInputSchema).withOutput(oauthRequestViewSchema).mutation("oauthApprove").withInput(approveOAuthInputSchema).withOutput(oauthRedirectSchema).mutation("oauthDeny").withInput(oauthRequestInputSchema).withOutput(oauthRedirectSchema).mutation("disconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).withOutput(external_exports.array(agentGithubWatchSchema)).mutation("watchGithub").withInput(watchGithubInputSchema).withOutput(agentGithubWatchSchema).mutation("unwatchGithub").withInput(unwatchGithubInputSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).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) })).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
36709
- var agentChannelSettingsTrpc = defineTrpcContract("agents").query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12, channelId: idSchema12 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).build();
36765
+ var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId: workspaceIdSchema8 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).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: workspaceIdSchema8 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema8 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).withOutput(agentAccessSchema).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema8 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema8 })).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: workspaceIdSchema8 })).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: workspaceIdSchema8, agentId: idSchema12 })).withOutput(external_exports.object({ channelId: idSchema12 })).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("oauthRequest").withInput(oauthRequestInputSchema).withOutput(oauthRequestViewSchema).mutation("oauthApprove").withInput(approveOAuthInputSchema).withOutput(oauthRedirectSchema).mutation("oauthDeny").withInput(oauthRequestInputSchema).withOutput(oauthRedirectSchema).mutation("disconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12 })).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();
36766
+ 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) })).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
36767
+ var agentChannelSettingsTrpc = defineTrpcContract("agents").query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema8, agentId: idSchema12, channelId: idSchema12 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).build();
36710
36768
  var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
36711
36769
  var agentLoginTroubleTrpc = defineTrpcContract("agents").mutation("replaceHarnessLogin").withInput(replaceHarnessLoginInputSchema).withOutput(harnessLoginListSchema).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();
36712
36770
  var agentTrpc = joinTrpcContracts(
36713
36771
  "agents",
36714
36772
  agentCoreTrpc,
36773
+ agentTurnTrpc,
36715
36774
  agentChannelSettingsTrpc,
36716
36775
  agentJoinTrpc,
36717
36776
  agentLoginTroubleTrpc
@@ -36722,6 +36781,7 @@ var AgentAttentionCardSlot = agentUi.component("attentionCard");
36722
36781
  var AgentComputerCardSlot = agentUi.component("computerCard");
36723
36782
  var AgentLoginCardSlot = agentUi.component("loginCard");
36724
36783
  var AgentStopTurnSlot = agentUi.component("stopTurn");
36784
+ var AgentSessionHooksToken = agentUi.hooks("session");
36725
36785
  var AgentCreateDialogSlot = agentUi.component("createDialog");
36726
36786
  var AgentEditDialogSlot = agentUi.component("editDialog");
36727
36787
  var AgentFaceSlot = agentUi.component("face");
@@ -36729,6 +36789,7 @@ var AgentAccessSlot = agentUi.component("access");
36729
36789
  var AgentConnectDialogSlot = agentUi.component("connectDialog");
36730
36790
  var AgentChannelLevelSlot = agentUi.component("channelLevel");
36731
36791
  var AgentMuteNoticeSlot = agentUi.component("muteNotice");
36792
+ var AgentHeldNoticeSlot = agentUi.component("heldNotice");
36732
36793
 
36733
36794
  // ../../modules/agent/contract/src/agent.config.ts
36734
36795
  var positiveInt3 = external_exports.coerce.number().int().positive();
@@ -36796,12 +36857,16 @@ var agentTurnEndedPayloadSchemaDefinition = external_exports.object({
36796
36857
  turnId: external_exports.string().min(1).max(200),
36797
36858
  failed: external_exports.boolean(),
36798
36859
  /** What the session said when the turn failed. */
36799
- reason: external_exports.string().max(500).optional()
36860
+ reason: external_exports.string().max(500).optional(),
36861
+ /** The failure's kind (`model_error`, `model_key_denied`...); one kind makes one streak. */
36862
+ code: external_exports.string().max(80).optional()
36800
36863
  });
36801
36864
  var agentTurnFailuresStateSchemaDefinition = external_exports.object({
36802
36865
  workspaceId: external_exports.string(),
36803
36866
  failures: external_exports.number().int().nonnegative(),
36804
36867
  reason: external_exports.string(),
36868
+ /** The streak's failure kind; empty for a failure that named none. */
36869
+ code: external_exports.string().default(""),
36805
36870
  /** The first failed turn of the streak, which names its card. */
36806
36871
  streakId: external_exports.string()
36807
36872
  });
@@ -36881,16 +36946,27 @@ var agentTriggeredTurnFiledPayloadSchemaDefinition = external_exports.object({
36881
36946
  error: external_exports.string().nullable(),
36882
36947
  at: external_exports.iso.datetime()
36883
36948
  });
36949
+ var agentTurnAnchorSchema = external_exports.object({
36950
+ messageId: external_exports.string().min(1),
36951
+ seq: external_exports.number().int().positive(),
36952
+ createdAt: external_exports.iso.datetime(),
36953
+ threadRootId: external_exports.string().min(1).nullable()
36954
+ });
36884
36955
  var fileAgentTurnInputSchemaDefinition = external_exports.object({
36885
36956
  workspaceId: external_exports.string().min(1),
36886
36957
  agentId: external_exports.string().min(1),
36887
36958
  requesterUserId: external_exports.string().min(1),
36888
36959
  /** The conversation the turn runs in; null runs it in the requester's DM with the agent. */
36889
36960
  channelId: external_exports.string().min(1).nullable(),
36890
- notice: external_exports.string().min(1),
36961
+ notice: external_exports.string().min(1).optional(),
36962
+ anchor: agentTurnAnchorSchema.optional(),
36891
36963
  prompt: external_exports.string().min(1),
36892
36964
  /** The caller's id for this turn: the same key again files nothing new. */
36893
36965
  key: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/)
36966
+ }).refine((input2) => input2.notice !== void 0 || input2.anchor !== void 0, {
36967
+ message: "A turn carries a notice to post or the anchor it hangs off"
36968
+ }).refine((input2) => input2.anchor === void 0 || input2.channelId !== null, {
36969
+ message: "An anchored turn names the conversation its anchor is in"
36894
36970
  });
36895
36971
 
36896
36972
  // ../../modules/agent/contract/src/agent-removed.ts
@@ -37535,7 +37611,7 @@ ${link.prompt}
37535
37611
 
37536
37612
  // src/services/agent-commands.service.ts
37537
37613
  import { mkdir as mkdir6, readFile as readFile5, writeFile as writeFile6 } from "node:fs/promises";
37538
- import { join as join6 } from "node:path";
37614
+ import { join as join6, resolve as resolve3 } from "node:path";
37539
37615
 
37540
37616
  // src/rules/cli-invocation.rules.ts
37541
37617
  var NPX_CACHE = /[\\/]_npx[\\/]/;
@@ -39094,7 +39170,7 @@ function channelLabelIn(channel) {
39094
39170
  // src/services/claude-project.service.ts
39095
39171
  import { stat } from "node:fs/promises";
39096
39172
  import { homedir as homedir2 } from "node:os";
39097
- import { basename, dirname as dirname4, join as join4, resolve as resolve2 } from "node:path";
39173
+ import { basename, dirname as dirname4, isAbsolute, join as join4, relative, resolve as resolve2 } from "node:path";
39098
39174
  async function isDirectory(path) {
39099
39175
  return stat(path).then(
39100
39176
  (found) => found.isDirectory(),
@@ -39124,18 +39200,25 @@ async function nearestHarnessOf({ context }) {
39124
39200
  }
39125
39201
  return void 0;
39126
39202
  }
39203
+ function holds({ folder, inner }) {
39204
+ const rel = relative(resolve2(folder), resolve2(inner));
39205
+ return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
39206
+ }
39127
39207
  async function claudeProjectOf({
39128
39208
  context,
39129
39209
  claudePid
39130
39210
  }) {
39131
39211
  const env = context.environment.inherited;
39132
- const found = claudePid ? await context.processes.cwdOf(claudePid) : void 0;
39133
- if (found) return found;
39134
- if (env.CLAUDE_PROJECT_DIR) return resolve2(env.CLAUDE_PROJECT_DIR);
39135
39212
  const pid = Number(env.CLAUDE_PID);
39136
- const folder = pid > 0 ? await context.processes.cwdOf(pid) : void 0;
39137
- if (folder) return folder;
39138
- return nearestProjectOf({ start: context.cwd, home: resolve2(env.HOME || homedir2()) });
39213
+ const candidates = [
39214
+ claudePid ? await context.processes.cwdOf(claudePid) : void 0,
39215
+ env.CLAUDE_PROJECT_DIR ? resolve2(env.CLAUDE_PROJECT_DIR) : void 0,
39216
+ pid > 0 ? await context.processes.cwdOf(pid) : void 0
39217
+ ].filter((folder) => Boolean(folder));
39218
+ if (candidates.length === 0) {
39219
+ return nearestProjectOf({ start: context.cwd, home: resolve2(env.HOME || homedir2()) });
39220
+ }
39221
+ return candidates.find((folder) => holds({ folder, inner: context.cwd })) ?? resolve2(context.cwd);
39139
39222
  }
39140
39223
 
39141
39224
  // src/services/codex-adopt.service.ts
@@ -39200,8 +39283,8 @@ var CodexAppServer = class _CodexAppServer {
39200
39283
  }
39201
39284
  async call(method, params) {
39202
39285
  const id = ++this.#nextId;
39203
- const reply2 = await new Promise((resolve14) => {
39204
- this.#pending.set(id, resolve14);
39286
+ const reply2 = await new Promise((resolve15) => {
39287
+ this.#pending.set(id, resolve15);
39205
39288
  this.write({ id, method, params });
39206
39289
  });
39207
39290
  if (reply2.error !== void 0) throw new Error(`${method}: ${JSON.stringify(reply2.error)}`);
@@ -39213,12 +39296,12 @@ var CodexAppServer = class _CodexAppServer {
39213
39296
  /** Starts one turn; `done` settles when it completes, keeping its last agent message. */
39214
39297
  async startTurn({ threadId, text: text2 }) {
39215
39298
  const result = { answer: "" };
39216
- const done = new Promise((resolve14) => {
39299
+ const done = new Promise((resolve15) => {
39217
39300
  const listen = (message2) => {
39218
39301
  absorbTurnEvent({ result, message: message2 });
39219
39302
  if (message2.method !== "turn/completed") return;
39220
39303
  this.#listeners.delete(listen);
39221
- resolve14(result);
39304
+ resolve15(result);
39222
39305
  };
39223
39306
  this.#listeners.add(listen);
39224
39307
  });
@@ -39750,6 +39833,16 @@ async function linkAgent({ context, args }) {
39750
39833
  }).catch((error62) => sandboxed({ context, error: error62 }));
39751
39834
  await settleLinked({ context, args, url: url2, harness, pid, linked });
39752
39835
  }
39836
+ async function sessionFolderOf({
39837
+ context,
39838
+ args,
39839
+ claude,
39840
+ pid
39841
+ }) {
39842
+ const asked = flagText({ args, name: "project" });
39843
+ if (asked) return resolve3(context.cwd, asked);
39844
+ return claude ? claudeProjectOf({ context, claudePid: pid }) : context.cwd;
39845
+ }
39753
39846
  async function settleLinked({
39754
39847
  context,
39755
39848
  args,
@@ -39760,7 +39853,7 @@ async function settleLinked({
39760
39853
  }) {
39761
39854
  const name2 = flagText({ args, name: "profile" }) || `agent-${slugOf(linked.agent.name)}`;
39762
39855
  const claude = harness === "claude-code";
39763
- const directory = claude ? await claudeProjectOf({ context, claudePid: pid }) : context.cwd;
39856
+ const directory = await sessionFolderOf({ context, args, claude, pid });
39764
39857
  await context.store.saveProfile({
39765
39858
  name: name2,
39766
39859
  bindDirectory: directory,
@@ -39863,7 +39956,7 @@ async function stopHook({ context, args }) {
39863
39956
 
39864
39957
  // src/services/agent-manage-commands.service.ts
39865
39958
  import { readFile as readFile6 } from "node:fs/promises";
39866
- import { extname, resolve as resolve3 } from "node:path";
39959
+ import { extname, resolve as resolve4 } from "node:path";
39867
39960
 
39868
39961
  // src/rules/login-format.rules.ts
39869
39962
  var HARNESS_NAMES = {
@@ -39973,7 +40066,7 @@ async function avatarOf({
39973
40066
  }) {
39974
40067
  const path = flagText({ args, name: "avatar" });
39975
40068
  if (!path) return void 0;
39976
- const bytes = await readFile6(resolve3(context.cwd, path)).catch(() => {
40069
+ const bytes = await readFile6(resolve4(context.cwd, path)).catch(() => {
39977
40070
  throw new CliUsageError(`laze: cannot read the avatar file ${path}.`);
39978
40071
  });
39979
40072
  const uploaded = await client.post("/api/agents/avatars", {
@@ -40508,7 +40601,7 @@ async function setAgentPool({
40508
40601
 
40509
40602
  // src/services/app-commands.service.ts
40510
40603
  import { mkdir as mkdir7, readdir as readdir2, readFile as readFile7, writeFile as writeFile8 } from "node:fs/promises";
40511
- import { dirname as dirname7, join as join8, relative, resolve as resolve4, sep } from "node:path";
40604
+ import { dirname as dirname7, join as join8, relative as relative2, resolve as resolve5, sep } from "node:path";
40512
40605
 
40513
40606
  // ../../modules/app/contract/src/app.connections.ts
40514
40607
  var appFunctionNameSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
@@ -41511,6 +41604,7 @@ var appTriggerFiredPayloadSchemaDefinition = external_exports.object({
41511
41604
  });
41512
41605
 
41513
41606
  // ../../modules/app/contract/src/app.pins.ts
41607
+ var APP_PINS_PER_CHANNEL_MAX = 6;
41514
41608
  var appPinChangedPayloadSchemaDefinition = external_exports.object({
41515
41609
  workspaceId: external_exports.string().min(1),
41516
41610
  channelId: external_exports.string().min(1),
@@ -41542,7 +41636,7 @@ var appPinViewSchemaDefinition = external_exports.object({
41542
41636
  var channelAppPinsSchemaDefinition = external_exports.object({
41543
41637
  workspaceId: external_exports.string().min(1),
41544
41638
  channelId: external_exports.string().min(1),
41545
- /** Oldest pin first, the order the tabs show. */
41639
+ /** In the conversation's shared tab order. */
41546
41640
  pins: external_exports.array(appPinSchemaDefinition),
41547
41641
  view: appPinViewSchemaDefinition
41548
41642
  });
@@ -41567,6 +41661,13 @@ var setPinViewInputSchemaDefinition = external_exports.object({
41567
41661
  minimised: external_exports.boolean().optional()
41568
41662
  });
41569
41663
  var setPinViewInputSchema = setPinViewInputSchemaDefinition;
41664
+ var reorderPinsInputSchemaDefinition = external_exports.object({
41665
+ workspaceId: external_exports.string().min(1),
41666
+ channel: external_exports.string().trim().min(1).max(120),
41667
+ /** The pinned apps in their new tab order; pins left out keep their order after these. */
41668
+ appIds: external_exports.array(external_exports.string().min(1)).min(1).max(APP_PINS_PER_CHANNEL_MAX)
41669
+ });
41670
+ var reorderPinsInputSchema = reorderPinsInputSchemaDefinition;
41570
41671
  var pinAppByKeyInputSchemaDefinition = external_exports.object({
41571
41672
  appId: external_exports.string().min(1),
41572
41673
  /** Absent in an agent's turn means the conversation the turn runs in. */
@@ -41575,6 +41676,9 @@ var pinAppByKeyInputSchemaDefinition = external_exports.object({
41575
41676
  var channelPinsByKeyInputSchemaDefinition = channelPinsInputSchemaDefinition.omit({
41576
41677
  workspaceId: true
41577
41678
  });
41679
+ var reorderPinsByKeyInputSchemaDefinition = reorderPinsInputSchemaDefinition.omit({
41680
+ workspaceId: true
41681
+ });
41578
41682
 
41579
41683
  // ../../modules/app/contract/src/app.backup.ts
41580
41684
  var appBackupCheckFailureSchemaDefinition = external_exports.object({
@@ -41598,7 +41702,7 @@ var appBackupCheckAlertsSchemaDefinition = external_exports.object({
41598
41702
  // ../../modules/app/contract/src/app.trpc.ts
41599
41703
  var appMainTrpc = defineTrpcContract("app").query("list").withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(appVersionSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(siteRefSchema).withOutput(external_exports.array(collectionSchema)).query("records").withInput(listRecordsInputSchema).withOutput(recordPageSchema).mutation("writeRecord").withInput(writeRecordInputSchema).withOutput(appRecordSchema).mutation("deleteRecord").withInput(deleteRecordInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("views").withInput(siteRefSchema).withOutput(external_exports.array(appViewSchema)).mutation("saveView").withInput(saveViewInputSchema).withOutput(appViewSchema).mutation("deleteView").withInput(deleteViewInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("chooseCardRows").withInput(chooseCardRowsInputSchema).withOutput(appCardChoiceSchema).query("exportRecords").withInput(exportRecordsInputSchema).withOutput(recordExportSchema).mutation("importRecords").withInput(importRecordsInputSchema).withOutput(recordImportSchema).mutation("decidePublish").withInput(decidePublishInputSchema).withOutput(publishOutcomeSchema).mutation("nameVersion").withInput(nameVersionInputSchema).withOutput(appVersionSchema).mutation("makeInternal").withInput(appRefSchema).withOutput(appSchema).mutation("revokePublishLease").withInput(appRefSchema).withOutput(appSchema).mutation("signInHandoff").withInput(signInHandoffInputSchema).withOutput(signInHandoffSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).query("access").withInput(appRefSchema).withOutput(appAccessSchema).mutation("grantAccess").withInput(grantAppAccessInputSchema).withOutput(appAccessSchema).mutation("revokeAccess").withInput(revokeAppAccessInputSchema).withOutput(appAccessSchema).mutation("setVisibility").withInput(setAppVisibilityInputSchema).withOutput(visibilityOutcomeSchema).mutation("setMemberRole").withInput(setMemberRoleInputSchema).withOutput(appAccessSchema).mutation("unpublish").withInput(appRefSchema).withOutput(appSchema).query("door").withInput(appRefSchema).withOutput(appDoorSchema).mutation("requestAccess").withInput(appRefSchema).withOutput(appDoorSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).query("backups").withInput(appRefSchema).withOutput(appBackupStatusSchema).mutation("restoreData").withInput(restoreAppDataInputSchema).withOutput(appRestoreSchema).query("cost").withInput(appRefSchema).withOutput(appCostSchema).mutation("setBudget").withInput(setAppBudgetInputSchema).withOutput(appCostSchema).query("triggers").withInput(appRefSchema).withOutput(appTriggersSchema).mutation("setTriggerPaused").withInput(setAppTriggerPausedInputSchema).withOutput(appTriggerSchema).mutation("removeTrigger").withInput(appTriggerRefSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
41600
41704
  var appConnectionsTrpc = defineTrpcContract("app").query("connections").withInput(appRefSchema).withOutput(appConnectionsSchema).mutation("allowConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).mutation("revokeConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).build();
41601
- var appPinsTrpc = defineTrpcContract("app").query("pins").withInput(channelPinsInputSchema).withOutput(channelAppPinsSchema).mutation("pin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("unpin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("setPinView").withInput(setPinViewInputSchema).withOutput(channelAppPinsSchema).build();
41705
+ var appPinsTrpc = defineTrpcContract("app").query("pins").withInput(channelPinsInputSchema).withOutput(channelAppPinsSchema).mutation("pin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("unpin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("setPinView").withInput(setPinViewInputSchema).withOutput(channelAppPinsSchema).mutation("reorderPins").withInput(reorderPinsInputSchema).withOutput(channelAppPinsSchema).build();
41602
41706
  var appTrpc = joinTrpcContracts("app", appMainTrpc, appConnectionsTrpc, appPinsTrpc);
41603
41707
 
41604
41708
  // ../../modules/app/contract/src/app.rest.ts
@@ -42798,7 +42902,7 @@ var appManageCommands = {
42798
42902
  var USAGE3 = `Usage:
42799
42903
  laze app pin [app] --channel <c>
42800
42904
  laze app unpin [app] --channel <c>
42801
- laze app pins <channel>`;
42905
+ laze app pins <channel> [--order <app,app,...>]`;
42802
42906
  function print3({
42803
42907
  context,
42804
42908
  args,
@@ -42850,7 +42954,9 @@ async function appPinsCommand({
42850
42954
  const channel = args.words[2] ?? flagText({ args, name: "channel" });
42851
42955
  if (!channel) throw new CliUsageError(USAGE3);
42852
42956
  const client = await signed2();
42853
- const listed = await client.post("/api/apps/pins", { channel });
42957
+ const order = flagText({ args, name: "order" });
42958
+ const appIds = order.split(",").map((id) => id.trim()).filter(Boolean);
42959
+ const listed = appIds.length ? await client.post("/api/apps/pins/order", { channel, appIds }) : await client.post("/api/apps/pins", { channel });
42854
42960
  print3({ context, args, value: listed, text: pinsText({ channel, listed }) });
42855
42961
  }
42856
42962
 
@@ -43064,7 +43170,7 @@ function siteOf(args, fallback) {
43064
43170
  return site;
43065
43171
  }
43066
43172
  function folderOf({ context, word: word2 }) {
43067
- return resolve4(context.cwd, word2 ?? ".");
43173
+ return resolve5(context.cwd, word2 ?? ".");
43068
43174
  }
43069
43175
  async function readManifest(folder) {
43070
43176
  const text2 = await readFile7(join8(folder, APP_MANIFEST_FILE), "utf8").catch(() => void 0);
@@ -43102,7 +43208,7 @@ async function jsonFlag({
43102
43208
  }) {
43103
43209
  const raw = flagText({ args, name: name2 });
43104
43210
  if (!raw) return void 0;
43105
- const text2 = raw.startsWith("@") ? await readFile7(resolve4(context.cwd, raw.slice(1)), "utf8") : raw;
43211
+ const text2 = raw.startsWith("@") ? await readFile7(resolve5(context.cwd, raw.slice(1)), "utf8") : raw;
43106
43212
  try {
43107
43213
  return JSON.parse(text2);
43108
43214
  } catch {
@@ -43116,7 +43222,7 @@ async function listFiles(folder) {
43116
43222
  const current2 = pending.pop() ?? folder;
43117
43223
  for (const entry of await readdir2(current2, { withFileTypes: true })) {
43118
43224
  const path = join8(current2, entry.name);
43119
- const rel = relative(folder, path).split(sep).join("/");
43225
+ const rel = relative2(folder, path).split(sep).join("/");
43120
43226
  if (isSkippedPath({ path: rel })) continue;
43121
43227
  if (entry.isDirectory()) pending.push(path);
43122
43228
  else if (entry.isFile()) found.push(path);
@@ -43155,7 +43261,7 @@ var appCreate = async ({ context, args }) => {
43155
43261
  ...channel ? { channel } : {},
43156
43262
  ...visibility ? { visibility } : {}
43157
43263
  });
43158
- const folder = resolve4(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
43264
+ const folder = resolve5(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
43159
43265
  await mkdir7(folder, { recursive: true });
43160
43266
  const files2 = template ? templateFiles({ template, name: name2 }) : {};
43161
43267
  for (const [path, content] of Object.entries(files2)) {
@@ -43174,8 +43280,8 @@ var appCreate = async ({ context, args }) => {
43174
43280
  context,
43175
43281
  args,
43176
43282
  value: { app: app2, folder },
43177
- text: `Created ${app2.name} (${app2.id}) in ${relative(context.cwd, folder) || "."}${template ? ` from the ${templateName} template` : ""}.
43178
- Next: cd ${relative(context.cwd, folder) || "."} && laze app push -m "First version" --seed
43283
+ text: `Created ${app2.name} (${app2.id}) in ${relative2(context.cwd, folder) || "."}${template ? ` from the ${templateName} template` : ""}.
43284
+ Next: cd ${relative2(context.cwd, folder) || "."} && laze app push -m "First version" --seed
43179
43285
  `
43180
43286
  });
43181
43287
  };
@@ -43204,7 +43310,7 @@ var appPush = async ({ context, args }) => {
43204
43310
  const files2 = await Promise.all(
43205
43311
  paths.map(
43206
43312
  async (path) => buildFileOf({
43207
- path: relative(folder, path).split(sep).join("/"),
43313
+ path: relative2(folder, path).split(sep).join("/"),
43208
43314
  bytes: await readFile7(path)
43209
43315
  })
43210
43316
  )
@@ -43558,16 +43664,16 @@ var appExport = async ({ context, args }) => {
43558
43664
  });
43559
43665
  const out = flagText({ args, name: "out" });
43560
43666
  if (!out) return context.out(exported.body);
43561
- const target = resolve4(context.cwd, out);
43667
+ const target = resolve5(context.cwd, out);
43562
43668
  await writeFile8(target, exported.body);
43563
- context.out(`Wrote ${exported.rows} records to ${relative(context.cwd, target)}
43669
+ context.out(`Wrote ${exported.rows} records to ${relative2(context.cwd, target)}
43564
43670
  `);
43565
43671
  };
43566
43672
  var appImport = async ({ context, args }) => {
43567
43673
  const words = args.words.slice(2);
43568
43674
  const [named, collection, file3] = words.length >= 3 ? words : [void 0, ...words];
43569
43675
  if (!collection || !file3) throw new CliUsageError(USAGE5);
43570
- const csv = await readFile7(resolve4(context.cwd, file3), "utf8").catch(() => {
43676
+ const csv = await readFile7(resolve5(context.cwd, file3), "utf8").catch(() => {
43571
43677
  throw new CliUsageError(`Cannot read ${file3}`);
43572
43678
  });
43573
43679
  const scoped = named ? { ...args, flags: { ...args.flags, app: named } } : args;
@@ -43586,7 +43692,7 @@ var appImport = async ({ context, args }) => {
43586
43692
  });
43587
43693
  const refusedOut = flagText({ args, name: "refused" });
43588
43694
  if (refusedOut && result.refusedCsv) {
43589
- await writeFile8(resolve4(context.cwd, refusedOut), result.refusedCsv);
43695
+ await writeFile8(resolve5(context.cwd, refusedOut), result.refusedCsv);
43590
43696
  }
43591
43697
  const fitting = result.rows - result.refused.length;
43592
43698
  const skipped = result.refused.slice(0, 20).map((row) => ` line ${row.line}: ${row.reason}
@@ -44178,7 +44284,7 @@ function tunnel({
44178
44284
  host: host2,
44179
44285
  port
44180
44286
  }) {
44181
- return new Promise((resolve14, reject) => {
44287
+ return new Promise((resolve15, reject) => {
44182
44288
  const socket = connectTcp(proxy.port, proxy.host);
44183
44289
  let answer4 = "";
44184
44290
  const auth = proxy.authorization ? `Proxy-Authorization: ${proxy.authorization}\r
@@ -44195,7 +44301,7 @@ ${auth}\r
44195
44301
  answer4 += chunk.toString("latin1");
44196
44302
  if (!answer4.includes(HEADER_END)) return;
44197
44303
  socket.off("data", onData);
44198
- if (/^HTTP\/1\.[01] 200/.test(answer4)) return resolve14(socket);
44304
+ if (/^HTTP\/1\.[01] 200/.test(answer4)) return resolve15(socket);
44199
44305
  socket.destroy();
44200
44306
  reject(new Error(`proxy refused the tunnel: ${answer4.split("\r\n")[0] ?? ""}`));
44201
44307
  };
@@ -44208,8 +44314,8 @@ async function upstreamOf({ target, proxy }) {
44208
44314
  const raw = proxy ? await tunnel({ proxy, host: target.hostname, port }) : connectTcp(port, target.hostname);
44209
44315
  if (!secure) return raw;
44210
44316
  const tls = connectTls({ socket: raw, servername: target.hostname });
44211
- await new Promise((resolve14, reject) => {
44212
- tls.once("secureConnect", () => resolve14());
44317
+ await new Promise((resolve15, reject) => {
44318
+ tls.once("secureConnect", () => resolve15());
44213
44319
  tls.once("error", reject);
44214
44320
  });
44215
44321
  return tls;
@@ -44251,8 +44357,8 @@ async function browserSocket({
44251
44357
  createConnection: () => upstream,
44252
44358
  perMessageDeflate: false
44253
44359
  });
44254
- await new Promise((resolve14, reject) => {
44255
- socket.once("open", () => resolve14());
44360
+ await new Promise((resolve15, reject) => {
44361
+ socket.once("open", () => resolve15());
44256
44362
  socket.once("error", reject);
44257
44363
  });
44258
44364
  return socket;
@@ -44265,12 +44371,12 @@ async function browserCall({
44265
44371
  }) {
44266
44372
  const socket = await browserSocket({ target, proxy });
44267
44373
  try {
44268
- return await new Promise((resolve14, reject) => {
44374
+ return await new Promise((resolve15, reject) => {
44269
44375
  socket.on("message", (data) => {
44270
44376
  const reply2 = JSON.parse(textOf2(data));
44271
44377
  if (reply2.id !== 1) return;
44272
44378
  if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
44273
- else resolve14(reply2.result ?? {});
44379
+ else resolve15(reply2.result ?? {});
44274
44380
  });
44275
44381
  socket.once("close", () => reject(new Error(`${method}: the machine closed the socket`)));
44276
44382
  socket.send(JSON.stringify({ id: 1, method, params }));
@@ -44409,18 +44515,18 @@ function retargetCdpBridge({
44409
44515
  target,
44410
44516
  expiresAt
44411
44517
  }) {
44412
- return new Promise((resolve14) => {
44518
+ return new Promise((resolve15) => {
44413
44519
  const call = httpRequest(
44414
44520
  { host: "127.0.0.1", port, path: TARGET_PATH, method: "PUT", timeout: 2e3 },
44415
44521
  (response) => {
44416
44522
  response.resume();
44417
- resolve14(response.statusCode === 204);
44523
+ resolve15(response.statusCode === 204);
44418
44524
  }
44419
44525
  );
44420
44526
  call.setHeader(KEY_HEADER, key);
44421
44527
  call.setHeader("content-type", "application/json");
44422
44528
  call.once("timeout", () => call.destroy());
44423
- call.once("error", () => resolve14(false));
44529
+ call.once("error", () => resolve15(false));
44424
44530
  call.end(JSON.stringify({ target, expiresAt }));
44425
44531
  });
44426
44532
  }
@@ -44469,15 +44575,15 @@ async function startCdpBridge({
44469
44575
  (socket) => relayPage({ client: socket, targetId, target: url2, proxy })
44470
44576
  );
44471
44577
  });
44472
- await new Promise((resolve14) => server.listen(0, "127.0.0.1", resolve14));
44578
+ await new Promise((resolve15) => server.listen(0, "127.0.0.1", resolve15));
44473
44579
  const port = server.address().port;
44474
44580
  return {
44475
44581
  port,
44476
- close: () => new Promise((resolve14) => {
44582
+ close: () => new Promise((resolve15) => {
44477
44583
  for (const client of relayed) client.destroy();
44478
44584
  pages.close();
44479
44585
  server.closeAllConnections();
44480
- server.close(() => resolve14());
44586
+ server.close(() => resolve15());
44481
44587
  })
44482
44588
  };
44483
44589
  }
@@ -44494,7 +44600,7 @@ function launchCdpBridge({
44494
44600
  stdio: ["ignore", "pipe", "ignore"],
44495
44601
  env: { ...env, LAZE_CDP_TARGET: target, LAZE_CDP_EXPIRES_AT: expiresAt, LAZE_CDP_KEY: key }
44496
44602
  });
44497
- return new Promise((resolve14, reject) => {
44603
+ return new Promise((resolve15, reject) => {
44498
44604
  let printed = "";
44499
44605
  child.once("error", reject);
44500
44606
  child.once("exit", (code) => reject(new Error(`the CDP bridge stopped (${code})`)));
@@ -44505,7 +44611,7 @@ function launchCdpBridge({
44505
44611
  child.stdout.destroy();
44506
44612
  child.removeAllListeners("exit");
44507
44613
  child.unref();
44508
- if (Number.isInteger(port) && port > 0) resolve14(port);
44614
+ if (Number.isInteger(port) && port > 0) resolve15(port);
44509
44615
  else reject(new Error("the CDP bridge printed no port"));
44510
44616
  });
44511
44617
  });
@@ -45226,7 +45332,7 @@ async function channelSettings({ context, args }) {
45226
45332
 
45227
45333
  // src/services/chat-actions-commands.service.ts
45228
45334
  import { readFile as readFile9 } from "node:fs/promises";
45229
- import { basename as basename2, resolve as resolve5 } from "node:path";
45335
+ import { basename as basename2, resolve as resolve6 } from "node:path";
45230
45336
  var CHAT_ACTIONS_USAGE = `Usage:
45231
45337
  laze thread <messageId> a message's thread: its root and replies
45232
45338
  laze thread follow <messageId> [--off] follow a thread, or stop
@@ -45466,7 +45572,7 @@ async function sendParts({
45466
45572
  return ticket.mode === "multipart" ? parts : [];
45467
45573
  }
45468
45574
  var fileUpload = async ({ context, args, client }) => {
45469
- const path = resolve5(context.cwd, wordAt(args, 3));
45575
+ const path = resolve6(context.cwd, wordAt(args, 3));
45470
45576
  const bytes = new Uint8Array(await readFile9(path));
45471
45577
  const ticket = await client.post(CHAT_KEY_PATHS.startUpload, {
45472
45578
  channel: wordAt(args, 2),
@@ -47285,7 +47391,7 @@ async function connect({
47285
47391
 
47286
47392
  // src/services/connector-commands.service.ts
47287
47393
  import { readFile as readFile14 } from "node:fs/promises";
47288
- import { resolve as resolve6 } from "node:path";
47394
+ import { resolve as resolve7 } from "node:path";
47289
47395
 
47290
47396
  // src/services/vault-keychain-commands.service.ts
47291
47397
  import { readFile as readFile13 } from "node:fs/promises";
@@ -47797,7 +47903,7 @@ async function keyText({ context, args }) {
47797
47903
  throw new CliUsageError("A key never goes in a flag: pipe it on stdin or use --from-file.");
47798
47904
  }
47799
47905
  const file3 = flagText({ args, name: "from-file" });
47800
- const text2 = file3 ? await readFile14(resolve6(context.cwd, file3), "utf8") : await context.readStdin();
47906
+ const text2 = file3 ? await readFile14(resolve7(context.cwd, file3), "utf8") : await context.readStdin();
47801
47907
  const trimmed = text2.trim();
47802
47908
  if (!trimmed) throw new CliUsageError("No key: pipe it on stdin or use --from-file.");
47803
47909
  return trimmed;
@@ -48217,7 +48323,7 @@ async function domains({ context, args }) {
48217
48323
 
48218
48324
  // src/services/feed-commands.service.ts
48219
48325
  import { readFile as readFile15 } from "node:fs/promises";
48220
- import { resolve as resolve7 } from "node:path";
48326
+ import { resolve as resolve8 } from "node:path";
48221
48327
 
48222
48328
  // src/rules/feed-input.rules.ts
48223
48329
  var TEXT_FLAGS = { body: "body", draft: "draft", summary: "summary" };
@@ -48287,7 +48393,7 @@ var USAGE8 = `Usage:
48287
48393
  [--link <label>=<url>]... [--action <label>=<message>]... [--to <userId>]...
48288
48394
  [--urgent] [--done-label <line>] [--show-at <ISO time>]
48289
48395
  [--snooze-for <userId>... --until <ISO time>]
48290
- [--brief <YYYY-MM-DD> [--class money|promise|decide|nudge|risk|fyi]] [--loop <key>]
48396
+ [--brief <YYYY-MM-DD> [--class money|promise|decide|nudge|risk|fyi]] [--loop <key> [--reopen]]
48291
48397
  [--auto-send-on <YYYY-MM-DD>]
48292
48398
  laze feed update <id> [the post flags that change] [--title <title>]
48293
48399
  [--auto-send-on <YYYY-MM-DD>|none]
@@ -48295,6 +48401,8 @@ var USAGE8 = `Usage:
48295
48401
  laze feed reply <id> <text> [--urgent]
48296
48402
  laze feed read <id>
48297
48403
  laze feed inbox
48404
+ laze feed close <id>|--loop <key> --note <text>
48405
+ laze feed loops
48298
48406
  laze feed brief-summary <YYYY-MM-DD>
48299
48407
  laze feed list [--json]
48300
48408
  laze feed count
@@ -48316,7 +48424,7 @@ async function bodyOf2({
48316
48424
  }) {
48317
48425
  const body = { ...flags2.fields };
48318
48426
  for (const [field, source] of Object.entries(flags2.texts)) {
48319
- body[field] = "file" in source ? await readFile15(resolve7(context.cwd, source.file), "utf8") : source.text;
48427
+ body[field] = "file" in source ? await readFile15(resolve8(context.cwd, source.file), "utf8") : source.text;
48320
48428
  }
48321
48429
  return body;
48322
48430
  }
@@ -48348,6 +48456,7 @@ async function feedPost({ context, args }) {
48348
48456
  title,
48349
48457
  ...channel ? { channel } : {},
48350
48458
  ...loop ? { loop } : {},
48459
+ ...loop && args.flags.reopen ? { reopen: true } : {},
48351
48460
  to: [...args.lists.to ?? []]
48352
48461
  });
48353
48462
  if (args.flags.json) return printItem({ context, args, item: posted });
@@ -48398,6 +48507,34 @@ async function feedInbox({ context, args }) {
48398
48507
  `);
48399
48508
  for (const item of items) printItem({ context, args, item });
48400
48509
  }
48510
+ async function feedClose({ context, args }) {
48511
+ const itemId = args.words[2];
48512
+ const loop = flagText({ args, name: "loop" });
48513
+ const note = flagText({ args, name: "note" });
48514
+ if (!note || Boolean(itemId) === Boolean(loop)) throw new CliUsageError(USAGE8);
48515
+ const { client } = await signedIn({ context, args });
48516
+ const closed = await client.post("/api/feed/items/close", {
48517
+ ...itemId ? { itemId } : { loop },
48518
+ note
48519
+ });
48520
+ if (args.flags.json) return printItem({ context, args, item: closed });
48521
+ context.out(`${closed.item.id} closed ${closed.item.title}
48522
+ `);
48523
+ }
48524
+ async function feedLoops({ context, args }) {
48525
+ const { client } = await signedIn({ context, args });
48526
+ const loops = await client.get("/api/feed/loops");
48527
+ if (args.flags.json) return context.out(`${JSON.stringify(loops, null, 2)}
48528
+ `);
48529
+ if (loops.length === 0) return context.out("No open loops.\n");
48530
+ for (const loop of loops) {
48531
+ const people = loop.recipients.map((row) => `${row.userId}:${row.state}`).join(" ");
48532
+ context.out(`${loop.loop} ${loop.itemId} ${loop.lastActivityAt} ${loop.title}
48533
+ `);
48534
+ context.out(` ${people}
48535
+ `);
48536
+ }
48537
+ }
48401
48538
  async function feedBriefSummary({ context, args }) {
48402
48539
  const date5 = args.words[2];
48403
48540
  if (!date5) throw new CliUsageError(USAGE8);
@@ -48438,7 +48575,7 @@ async function textFlag({
48438
48575
  }) {
48439
48576
  const value = flagText({ args, name: name2 });
48440
48577
  if (!value.startsWith("@")) return value;
48441
- return readFile15(resolve7(context.cwd, value.slice(1)), "utf8");
48578
+ return readFile15(resolve8(context.cwd, value.slice(1)), "utf8");
48442
48579
  }
48443
48580
  async function feedList({ context, args }) {
48444
48581
  const { client } = await signedIn({ context, args });
@@ -48527,6 +48664,8 @@ var FEED_COMMANDS = {
48527
48664
  read: feedRead,
48528
48665
  inbox: feedInbox,
48529
48666
  "brief-summary": feedBriefSummary,
48667
+ close: feedClose,
48668
+ loops: feedLoops,
48530
48669
  list: feedList,
48531
48670
  count: feedCount,
48532
48671
  act: feedAct,
@@ -49039,7 +49178,7 @@ async function ip({ context, args }) {
49039
49178
  import { mkdir as mkdir10, readFile as readFile18, rename as rename4, rm as rm6, writeFile as writeFile11 } from "node:fs/promises";
49040
49179
  import { dirname as dirname10, join as join10 } from "node:path";
49041
49180
  var DEFAULT_WAIT_SECONDS = 100;
49042
- var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>]";
49181
+ var JOIN_USAGE = "Usage: laze join [--workspace <name|id|invite link>] [--for <email>] [--name <name>] [--note <text>] [--timeout <seconds>] [--project <folder>]";
49043
49182
  function pendingPathOf({ context }) {
49044
49183
  return join10(dirname10(context.environment.configPath), "join", "pending.json");
49045
49184
  }
@@ -50116,13 +50255,13 @@ async function serveMcp({
50116
50255
 
50117
50256
  // src/services/mount-files.service.ts
50118
50257
  import { mkdir as mkdir12, readFile as readFile20, rm as rm8, writeFile as writeFile13 } from "node:fs/promises";
50119
- import { dirname as dirname12, relative as relative2, resolve as resolve8 } from "node:path";
50258
+ import { dirname as dirname12, relative as relative3, resolve as resolve9 } from "node:path";
50120
50259
  async function textArgument({
50121
50260
  context,
50122
50261
  value
50123
50262
  }) {
50124
50263
  if (value === "-") return context.readStdin();
50125
- if (value.startsWith("@")) return readFile20(resolve8(context.cwd, value.slice(1)), "utf8");
50264
+ if (value.startsWith("@")) return readFile20(resolve9(context.cwd, value.slice(1)), "utf8");
50126
50265
  return value;
50127
50266
  }
50128
50267
  function turnChannel({ context, args }) {
@@ -50134,12 +50273,12 @@ async function writeMount({
50134
50273
  folder,
50135
50274
  files: files2
50136
50275
  }) {
50137
- const root = resolve8(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
50276
+ const root = resolve9(context.cwd, flagText({ args, name: "dir", fallback: ".laze" }), folder);
50138
50277
  await rm8(root, { recursive: true, force: true });
50139
50278
  await mkdir12(root, { recursive: true });
50140
50279
  for (const file3 of files2) {
50141
- const target = resolve8(root, file3.path);
50142
- const inside = relative2(root, target);
50280
+ const target = resolve9(root, file3.path);
50281
+ const inside = relative3(root, target);
50143
50282
  if (!inside || inside.startsWith(".."))
50144
50283
  throw new Error(`Refusing to write outside ${root}: ${file3.path}`);
50145
50284
  await mkdir12(dirname12(target), { recursive: true });
@@ -50837,6 +50976,15 @@ function updatePlanOf({ script }) {
50837
50976
  command: [...found.command, ...prefix ? ["--prefix", prefix] : [], CLI_PACKAGE_LATEST]
50838
50977
  };
50839
50978
  }
50979
+ var RELEASE_AGE_REFUSAL = /\b(ENOVERSIONS|ETARGET)\b/;
50980
+ function releaseAgeRetryOf({
50981
+ plan: plan2,
50982
+ stderr: stderr2
50983
+ }) {
50984
+ if (plan2.manager !== "npm" || !RELEASE_AGE_REFUSAL.test(stderr2)) return null;
50985
+ const at = plan2.command.indexOf(CLI_PACKAGE_LATEST);
50986
+ return [...plan2.command.slice(0, at), "--min-release-age=0", ...plan2.command.slice(at)];
50987
+ }
50840
50988
 
50841
50989
  // src/rules/cli-release.rules.ts
50842
50990
  var CLI_RELEASE_HEADER = "x-laze-cli-release";
@@ -51029,7 +51177,7 @@ async function schedule({ context, args }) {
51029
51177
 
51030
51178
  // src/services/skill-commands.service.ts
51031
51179
  import { readdir as readdir3, readFile as readFile21 } from "node:fs/promises";
51032
- import { join as join12, relative as relative3, resolve as resolve9 } from "node:path";
51180
+ import { join as join12, relative as relative4, resolve as resolve10 } from "node:path";
51033
51181
  var USAGE15 = `Usage:
51034
51182
  laze skill list [--agent <agentId>]
51035
51183
  laze skill install <catalogue-id> [--as <name>] [--agent <agentId>]
@@ -51047,7 +51195,7 @@ async function folderFiles({ root }) {
51047
51195
  for (const entry of entries) {
51048
51196
  if (!entry.isFile()) continue;
51049
51197
  const full = join12(entry.parentPath, entry.name);
51050
- files2.push({ path: relative3(root, full), content: await readFile21(full, "utf8") });
51198
+ files2.push({ path: relative4(root, full), content: await readFile21(full, "utf8") });
51051
51199
  }
51052
51200
  return files2.toSorted((a, b) => a.path.localeCompare(b.path));
51053
51201
  }
@@ -51072,7 +51220,7 @@ async function skillInstall({ context, args }) {
51072
51220
  if (!catalogueId === !from) throw new CliUsageError(USAGE15);
51073
51221
  const name2 = flagText({ args, name: "as" });
51074
51222
  const agent2 = flagText({ args, name: "agent" });
51075
- const files2 = from ? await folderFiles({ root: resolve9(context.cwd, from) }) : void 0;
51223
+ const files2 = from ? await folderFiles({ root: resolve10(context.cwd, from) }) : void 0;
51076
51224
  const { client } = await signedIn({ context, args });
51077
51225
  const installed = await client.post("/api/skills/install", {
51078
51226
  ...catalogueId ? { catalogueId } : {},
@@ -51139,7 +51287,7 @@ async function skillUpdate({ context, args }) {
51139
51287
  if (!name2 || !newName && description === void 0 && !skillMdFile) {
51140
51288
  throw new CliUsageError(USAGE15);
51141
51289
  }
51142
- const skillMd = skillMdFile ? await readFile21(resolve9(context.cwd, skillMdFile), "utf8") : void 0;
51290
+ const skillMd = skillMdFile ? await readFile21(resolve10(context.cwd, skillMdFile), "utf8") : void 0;
51143
51291
  const { client } = await signedIn({ context, args });
51144
51292
  const updated = await client.post("/api/skills/update", {
51145
51293
  name: name2,
@@ -51170,7 +51318,7 @@ async function skill({ context, args }) {
51170
51318
 
51171
51319
  // src/services/slack-commands.service.ts
51172
51320
  import { readFile as readFile22 } from "node:fs/promises";
51173
- import { resolve as resolve10 } from "node:path";
51321
+ import { resolve as resolve11 } from "node:path";
51174
51322
  var SLACK_USAGE = `Usage (a person's key; Slack stays the source, the bot joins no channel by itself):
51175
51323
  laze slack overview connected Slack workspaces, mirrors, your link
51176
51324
  laze slack link-prompts Slack workspaces you have not linked yet
@@ -51213,7 +51361,7 @@ async function secretLines({ context, args }) {
51213
51361
  throw new CliUsageError("A secret never goes in a flag: pipe it on stdin or use --from-file.");
51214
51362
  }
51215
51363
  const file3 = flagText({ args, name: "from-file" });
51216
- const text2 = file3 ? await readFile22(resolve10(context.cwd, file3), "utf8") : await context.readStdin();
51364
+ const text2 = file3 ? await readFile22(resolve11(context.cwd, file3), "utf8") : await context.readStdin();
51217
51365
  return text2.split("\n").map((line) => line.trim()).filter(Boolean);
51218
51366
  }
51219
51367
  async function secretsOf({
@@ -51806,8 +51954,28 @@ async function update2({
51806
51954
  }
51807
51955
  context.out(`Updating laze ${cliVersionOf()} with ${plan2.manager}: ${line}
51808
51956
  `);
51809
- const code = await context.runCommand({ command: plan2.command, env: {} });
51810
- if (code !== 0) {
51957
+ let stderr2 = "";
51958
+ const tee = {
51959
+ write: (chunk) => {
51960
+ stderr2 += chunk;
51961
+ context.err(chunk);
51962
+ }
51963
+ };
51964
+ let code = await context.runCommand({ command: plan2.command, env: {}, stderr: tee });
51965
+ const retry = code === 0 ? null : releaseAgeRetryOf({ plan: plan2, stderr: stderr2 });
51966
+ if (retry) {
51967
+ const retryLine = retry.join(" ");
51968
+ context.out(
51969
+ `npm's min-release-age setting held back the latest release. Trying once more with the guard off for @lazehq/cli only: ${retryLine}
51970
+ `
51971
+ );
51972
+ code = await context.runCommand({ command: retry, env: {} });
51973
+ if (code !== 0) {
51974
+ context.err(`npm exited ${code}. Update by hand with: ${retryLine}
51975
+ `);
51976
+ return code;
51977
+ }
51978
+ } else if (code !== 0) {
51811
51979
  context.err(`${plan2.manager} exited ${code}. Update by hand with: ${line}
51812
51980
  `);
51813
51981
  return code;
@@ -51873,7 +52041,7 @@ async function vaultScrub({ context, args }) {
51873
52041
 
51874
52042
  // src/services/whatsapp-business-commands.service.ts
51875
52043
  import { readFile as readFile24 } from "node:fs/promises";
51876
- import { resolve as resolve11 } from "node:path";
52044
+ import { resolve as resolve12 } from "node:path";
51877
52045
 
51878
52046
  // ../../modules/whatsapp-business/contract/src/whatsapp-business.prices.ts
51879
52047
  var whatsappBusinessCategorySchema = external_exports.enum([
@@ -52292,7 +52460,7 @@ async function secretsOf2({ context, args }) {
52292
52460
  const fromConnection = flagText({ args, name: "from-vault" });
52293
52461
  if (fromConnection) return { fromConnection };
52294
52462
  const file3 = flagText({ args, name: "from-file" });
52295
- const text2 = file3 ? await readFile24(resolve11(context.cwd, file3), "utf8") : await context.readStdin();
52463
+ const text2 = file3 ? await readFile24(resolve12(context.cwd, file3), "utf8") : await context.readStdin();
52296
52464
  const lines = text2.split("\n").map((line) => line.trim()).filter(Boolean);
52297
52465
  if (lines.length !== 2) {
52298
52466
  throw new CliUsageError(
@@ -52494,7 +52662,7 @@ async function whatsappBusiness({
52494
52662
 
52495
52663
  // src/services/whatsapp-pairing-commands.service.ts
52496
52664
  import { writeFile as writeFile14 } from "node:fs/promises";
52497
- import { resolve as resolve12 } from "node:path";
52665
+ import { resolve as resolve13 } from "node:path";
52498
52666
  var WHATSAPP_PAIRING_USAGE = [
52499
52667
  " laze whatsapp pair <machine> [--qr <file.svg>] link WhatsApp on your machine; scan the code (owner)",
52500
52668
  " laze whatsapp pairing <pairing-id> [--qr <file.svg>] where the linking stands, with a fresh code",
@@ -52513,7 +52681,7 @@ function svgOf(dataUrl) {
52513
52681
  return decodeURIComponent(body);
52514
52682
  }
52515
52683
  async function report({ context, args, pairing: pairing2 }) {
52516
- const qrFile = pairing2.qrSvg ? resolve12(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
52684
+ const qrFile = pairing2.qrSvg ? resolve13(context.cwd, flagText({ args, name: "qr", fallback: "whatsapp-qr.svg" })) : null;
52517
52685
  if (qrFile && pairing2.qrSvg) await writeFile14(qrFile, svgOf(pairing2.qrSvg), "utf8");
52518
52686
  if (args.flags.json) return context.out(`${JSON.stringify({ ...pairing2, qrFile }, null, 2)}
52519
52687
  `);
@@ -52874,7 +53042,7 @@ async function flags({ context, args }) {
52874
53042
 
52875
53043
  // src/services/workspace-commands.service.ts
52876
53044
  import { readFile as readFile25 } from "node:fs/promises";
52877
- import { resolve as resolve13 } from "node:path";
53045
+ import { resolve as resolve14 } from "node:path";
52878
53046
  var ROLE_NAMES2 = {
52879
53047
  OWNER: "Owner",
52880
53048
  ADMIN: "Admin",
@@ -53056,7 +53224,7 @@ var LOGO_USAGE = "Usage: laze workspace logo set <file.png|jpg|webp> | laze work
53056
53224
  async function readLogo({ context, file: file3 }) {
53057
53225
  let bytes;
53058
53226
  try {
53059
- bytes = new Uint8Array(await readFile25(resolve13(context.cwd, file3)));
53227
+ bytes = new Uint8Array(await readFile25(resolve14(context.cwd, file3)));
53060
53228
  } catch {
53061
53229
  throw new CliUsageError(`No file to read at ${file3}.`);
53062
53230
  }
@@ -53294,7 +53462,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
53294
53462
  laze channel remove <channel> <member> take a member out of a channel (channel admins)
53295
53463
  laze channel notify <channel> default|all|mentions|nothing|mute|unmute [--until <time>] your notifications
53296
53464
  laze channel hide <channel> out of your sidebar until a new message lands there
53297
- laze dm <person>... open a direct message with people, then laze post to it
53465
+ laze dm <person>... open a direct message with people (an agent may name one agent), then laze post to it
53298
53466
  laze activity [--mentions|--threads|--reactions] [--limit <n>] your mentions, replies and reactions
53299
53467
  laze activity read mark your Activity read (people; agents use laze inbox)
53300
53468
  laze status set <emoji> [text] [--for 30m|1h|4h|today|week|never] your status next to your name (people)
@@ -53345,8 +53513,8 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
53345
53513
  laze app create <name> --template crm ... build an app: create, push, preview, publish, revert
53346
53514
  laze app every laze app command, with its flags
53347
53515
  laze agents list | laze agents status <name> the workspace's agents and their context
53348
- laze join [--workspace <name|link>] [--for <email>] [--name <name>] ask to join as an agent: a person approves once in their feed
53349
- laze agent link --token <token> [--name <name>] connect this Claude Code or Codex session
53516
+ laze join [--workspace <name|link>] [--for <email>] [--name <name>] [--project <folder>] ask to join as an agent: a person approves once in their feed
53517
+ laze agent link --token <token> [--name <name>] [--project <folder>] connect this Claude Code or Codex session
53350
53518
  laze agent create --name <name> [--description <text>] [--harness laze-models|claude-code|codex] [--avatar <file>]
53351
53519
  make an agent for your owner (or for you): personal, opened in their direct messages
53352
53520
  --team makes a team agent; on Claude Code or Codex it needs --pool <pool>, a login pool to draw from
@@ -53737,15 +53905,15 @@ function terminalAsk() {
53737
53905
  };
53738
53906
  }
53739
53907
  function sleep(ms, signal) {
53740
- return new Promise((resolve14) => {
53741
- if (signal?.aborted) return resolve14();
53908
+ return new Promise((resolve15) => {
53909
+ if (signal?.aborted) return resolve15();
53742
53910
  const stop2 = () => {
53743
53911
  clearTimeout(timer);
53744
- resolve14();
53912
+ resolve15();
53745
53913
  };
53746
53914
  const timer = setTimeout(() => {
53747
53915
  signal?.removeEventListener("abort", stop2);
53748
- resolve14();
53916
+ resolve15();
53749
53917
  }, ms);
53750
53918
  signal?.addEventListener("abort", stop2, { once: true });
53751
53919
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazehq/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "The Laze command line: sign in, read and post in chat, and connect your own Claude Code or Codex session as an agent.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",