@lazehq/cli 0.1.40 → 0.1.42

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 +123 -51
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -35670,7 +35670,8 @@ var SWITCHES = /* @__PURE__ */ new Set([
35670
35670
  "clear",
35671
35671
  "wait-reply",
35672
35672
  "no-publish",
35673
- "local"
35673
+ "local",
35674
+ "done"
35674
35675
  ]);
35675
35676
  function parseArgs({ argv }) {
35676
35677
  const words = [];
@@ -35708,7 +35709,7 @@ function flagText({
35708
35709
  }
35709
35710
 
35710
35711
  // src/rules/cli-version.rules.ts
35711
- var STAMPED = "0.1.40";
35712
+ var STAMPED = "0.1.42";
35712
35713
  function cliVersionOf({ stamped = STAMPED } = {}) {
35713
35714
  return stamped.startsWith("__") ? "dev" : stamped;
35714
35715
  }
@@ -62744,7 +62745,9 @@ var computerNoticeSchemaDefinition = external_exports.discriminatedUnion("type",
62744
62745
  external_exports.object({
62745
62746
  type: external_exports.literal("memory_stop"),
62746
62747
  /** "stopped: your agent computer is out of memory (3.9 of 4 GB)". */
62747
- text: external_exports.string().min(1).max(500)
62748
+ text: external_exports.string().min(1).max(500),
62749
+ /** False when the computer's own services held most of the memory: no bigger size to offer. */
62750
+ agentLoad: external_exports.boolean().optional()
62748
62751
  }),
62749
62752
  external_exports.object({
62750
62753
  type: external_exports.literal("disk_warning"),
@@ -64102,22 +64105,6 @@ var liveStepsSchemaDefinition = external_exports.object({
64102
64105
  visible: external_exports.boolean()
64103
64106
  });
64104
64107
  var liveStepsSchema = liveStepsSchemaDefinition;
64105
- var replyStepsInputSchemaDefinition = external_exports.object({
64106
- workspaceId: external_exports.string().min(1),
64107
- channelId: external_exports.string().min(1),
64108
- messageIds: external_exports.array(external_exports.string().min(1)).max(200)
64109
- });
64110
- var replyStepsInputSchema = replyStepsInputSchemaDefinition;
64111
- var replyStepsSchemaDefinition = external_exports.array(
64112
- external_exports.object({
64113
- messageId: external_exports.string().min(1),
64114
- agentId: external_exports.string().min(1),
64115
- turnKey: external_exports.string().min(1),
64116
- state: liveTurnStateSchema,
64117
- tools: external_exports.number().int().nonnegative()
64118
- })
64119
- );
64120
- var replyStepsSchema = replyStepsSchemaDefinition;
64121
64108
 
64122
64109
  // ../../modules/agent/contract/src/agent-login-trouble.ts
64123
64110
  var loginCardActionInputSchemaDefinition = external_exports.object({
@@ -65188,7 +65175,7 @@ var codexLoginRefreshInputSchemaDefinition = external_exports.object({
65188
65175
  });
65189
65176
  var AgentApi = moduleApi()("agent");
65190
65177
  var agentCoreTrpc = defineTrpcContract("agents").query("list").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).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: workspaceIdSchema10 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(external_exports.object({ limitUsd: external_exports.number() })).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema10 })).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: workspaceIdSchema10 })).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: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.object({ channelId: idSchema14 })).mutation("startConversation").withInput(startConversationInputSchema).withOutput(startedConversationSchema).query("conversations").withInput(listConversationsInputSchema).withOutput(external_exports.array(conversationSummarySchema2)).mutation("joinConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("renameConversation").withInput(renameConversationInputSchema).withOutput(conversationSummarySchema2).mutation("leaveConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("deleteConversation").withInput(conversationInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("mintLink").withInput(mintLinkInputSchema).withOutput(mintedLinkSchema).query("linkRedemption").withInput(linkRedemptionInputSchema).withOutput(linkRedemptionSchema).query("oauthRequest").withInput(oauthRequestInputSchema).withOutput(oauthRequestViewSchema).mutation("oauthApprove").withInput(approveOAuthInputSchema).withOutput(oauthRedirectSchema).mutation("oauthDeny").withInput(oauthRequestInputSchema).withOutput(oauthRedirectSchema).mutation("disconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).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();
65191
- var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("workingNow").withInput(agentWorkingInputSchema).withOutput(agentWorkingSchema).query("replySteps").withInput(replyStepsInputSchema).withOutput(replyStepsSchema).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();
65178
+ var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("workingNow").withInput(agentWorkingInputSchema).withOutput(agentWorkingSchema).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
65192
65179
  var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema10, agentId: idSchema14, channelId: idSchema14 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).build();
65193
65180
  var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
65194
65181
  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();
@@ -76216,12 +76203,12 @@ async function browserTabCdp({
76216
76203
  args,
76217
76204
  client
76218
76205
  }) {
76219
- const channel = channelOf({ context, args });
76220
- if (!channel.channel) return null;
76221
76206
  try {
76207
+ const channel = channelOf({ context, args });
76222
76208
  return await client.post(BROWSER_TAB_PATHS.cdp, { tab: word({ args, at: 2 }), ...channel });
76223
76209
  } catch (error62) {
76224
- if (error62 instanceof LazeApiError && error62.code === "browser_tab_not_found") return null;
76210
+ const missing = ["browser_tab_not_found", "not_found"];
76211
+ if (error62 instanceof LazeApiError && missing.includes(error62.code)) return null;
76225
76212
  throw error62;
76226
76213
  }
76227
76214
  }
@@ -76349,13 +76336,38 @@ async function browserCall({
76349
76336
  if (reply2.error) reject(new Error(`${method}: ${JSON.stringify(reply2.error)}`));
76350
76337
  else resolve17(reply2.result ?? {});
76351
76338
  });
76352
- socket.once("close", () => reject(new Error(`${method}: the machine closed the socket`)));
76339
+ socket.once(
76340
+ "close",
76341
+ (_code, reason) => reject(
76342
+ new Error(`${method}: ${reason.toString("utf8") || "the machine closed the socket"}`)
76343
+ )
76344
+ );
76353
76345
  socket.send(JSON.stringify({ id: 1, method, params }));
76354
76346
  });
76355
76347
  } finally {
76356
76348
  socket.close();
76357
76349
  }
76358
76350
  }
76351
+ async function checkCdp({
76352
+ target,
76353
+ env,
76354
+ timeoutMs
76355
+ }) {
76356
+ let timer;
76357
+ const late = new Promise((_, reject) => {
76358
+ timer = setTimeout(() => reject(new Error(`no answer in ${timeoutMs / 1e3} s`)), timeoutMs);
76359
+ });
76360
+ const call = browserCall({
76361
+ target: new URL(target),
76362
+ proxy: proxyOfEnv({ env }),
76363
+ method: "Target.getTargets"
76364
+ });
76365
+ try {
76366
+ await Promise.race([call, late]);
76367
+ } finally {
76368
+ clearTimeout(timer);
76369
+ }
76370
+ }
76359
76371
  function describeTarget({ info, port }) {
76360
76372
  return {
76361
76373
  id: info.targetId,
@@ -76589,6 +76601,7 @@ function launchCdpBridge({
76589
76601
  }
76590
76602
 
76591
76603
  // src/services/browser-commands.service.ts
76604
+ var CDP_CHECK_MS = 3e4;
76592
76605
  var PATHS2 = {
76593
76606
  machines: "/api/compute/machines",
76594
76607
  setup: "/api/compute/browser/setup",
@@ -76675,7 +76688,9 @@ The screen link goes to your requester's DM once it is ready. ${next}`
76675
76688
  }
76676
76689
  async function cdp({ context, args }) {
76677
76690
  const client = await computeClient({ context, args });
76678
- const access = await browserTabCdp({ context, args, client }) ?? await client.post(PATHS2.cdp, { machine: machineArg({ args }) });
76691
+ const tab = await browserTabCdp({ context, args, client });
76692
+ if (tab) await answering({ context, access: tab });
76693
+ const access = tab ?? await client.post(PATHS2.cdp, { machine: machineArg({ args }) });
76679
76694
  if (access.status === "waking") {
76680
76695
  if (args.flags.json) return context.out(`${JSON.stringify(access, null, 2)}
76681
76696
  `);
@@ -76693,6 +76708,17 @@ async function cdp({ context, args }) {
76693
76708
  context.err(`Valid until ${access.expiresAt}. Use it with chromium.connectOverCDP(url).
76694
76709
  `);
76695
76710
  }
76711
+ async function answering({
76712
+ context,
76713
+ access
76714
+ }) {
76715
+ const env = context.environment.inherited;
76716
+ await checkCdp({ target: access.url, env, timeoutMs: CDP_CHECK_MS }).catch((cause) => {
76717
+ const why = cause instanceof Error ? cause.message : String(cause);
76718
+ const text2 = `${access.machine}'s browser did not answer over CDP (${why}). Try again in a minute`;
76719
+ throw new LazeApiError(502, "browser_cdp_unreachable", text2);
76720
+ });
76721
+ }
76696
76722
  function bridgeStatePath({ context, machine: machine2 }) {
76697
76723
  const safe = machine2.replace(/[^a-zA-Z0-9_-]/g, "_");
76698
76724
  return join19(dirname17(context.environment.configPath), "bridges", `${safe}.json`);
@@ -78070,6 +78096,19 @@ var browserTabScreenDefinition = external_exports.discriminatedUnion("status", [
78070
78096
  external_exports.object({ status: external_exports.literal("starting"), retryAfterSeconds: external_exports.number().int().positive() })
78071
78097
  ]);
78072
78098
  var browserTabScreenSchema = browserTabScreenDefinition;
78099
+ var screenSizeDefinition = external_exports.object({
78100
+ ...browserTabRefDefinition.shape,
78101
+ width: external_exports.number().int().positive().max(1e5),
78102
+ height: external_exports.number().int().positive().max(1e5),
78103
+ cause: external_exports.enum(["open", "resize", "input"])
78104
+ });
78105
+ var browserTabScreenSizeInputSchema = screenSizeDefinition;
78106
+ var screenSizeAnswerDefinition = external_exports.object({
78107
+ follows: external_exports.boolean(),
78108
+ width: external_exports.number().int().positive(),
78109
+ height: external_exports.number().int().positive()
78110
+ });
78111
+ var browserTabScreenSizeSchema = screenSizeAnswerDefinition;
78073
78112
  var restOpenBrowserTabInputDefinition = openBrowserTabDefinition.omit({ workspaceId: true });
78074
78113
  var restBrowserTabListInputDefinition = browserTabListInputDefinition.omit({ workspaceId: true });
78075
78114
  var restBrowserTabInputDefinition = browserTabRefDefinition.omit({ workspaceId: true });
@@ -79317,7 +79356,7 @@ var ownMachineSshConnectDefinition = external_exports.object({
79317
79356
  var ownMachineSshConnectSchema = ownMachineSshConnectDefinition;
79318
79357
  var reconcileDefinition = external_exports.object({ workspaceId: workspaceIdSchema18, machineId: idSchema19 });
79319
79358
  var ComputeApi = moduleApi()("compute");
79320
- var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(machineRefSchema).withOutput(whatsappPairingSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
79359
+ var computeCoreTrpc = defineTrpcContract("compute").query("status").withInput(computeWorkspaceInputSchema).withOutput(computeStatusSchema).query("browserTabs").withInput(browserTabListInputSchema).withOutput(browserTabListSchema).query("browserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("openBrowserTab").withInput(openBrowserTabInputSchema).withOutput(browserTabSchema).mutation("browserTabScreen").withInput(browserTabInputSchema).withOutput(browserTabScreenSchema).mutation("sizeBrowserTabScreen").withInput(browserTabScreenSizeInputSchema).withOutput(browserTabScreenSizeSchema).mutation("gotoBrowserTab").withInput(browserTabGotoInputSchema).withOutput(browserTabPageSchema).mutation("doneOnBrowserTab").withInput(browserTabInputSchema).withOutput(browserTabSchema).mutation("shareBrowserTab").withInput(browserTabShareInputSchema).withOutput(browserTabSchema).mutation("closeBrowserTab").withInput(browserTabInputSchema).withOutput(external_exports.object({ closed: external_exports.literal(true) })).query("computer").withInput(computeWorkspaceInputSchema).withOutput(computerStatusSchema).mutation("setComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerSizeAnswerSchema).mutation("requestComputerSize").withInput(setComputerSizeInputSchema).withOutput(computerRequestSchema).mutation("cancelComputerRequest").withInput(computerRequestRefSchema).withOutput(computerRequestSchema).mutation("restartComputer").withInput(restartComputerInputSchema).withOutput(computerRestartAnswerSchema).query("computers").withInput(computeWorkspaceInputSchema).withOutput(computerListSchema).query("dedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpStatusSchema).mutation("setDedicatedIp").withInput(setDedicatedIpInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("turnOffDedicatedIp").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpAnswerSchema).mutation("setDedicatedIpDomains").withInput(setDedicatedIpDomainsInputSchema).withOutput(dedicatedIpAnswerSchema).query("dedicatedIps").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpListSchema).query("dedicatedIpCountries").withInput(computeWorkspaceInputSchema).withOutput(dedicatedIpCountriesSchema).query("dedicatedIpOffer").withInput(dedicatedIpOfferInputSchema).withOutput(dedicatedIpOfferSchema).query("list").withInput(computeWorkspaceInputSchema).withOutput(external_exports.array(machineSchema)).query("get").withInput(machineRefSchema).withOutput(machineSchema).mutation("setupBrowser").withInput(setupBrowserInputSchema).withOutput(machineSchema).mutation("sleep").withInput(machineRefSchema).withOutput(machineSchema).mutation("wake").withInput(machineRefSchema).withOutput(machineSchema).mutation("delete").withInput(machineRefSchema).withOutput(machineSchema).mutation("rename").withInput(renameMachineInputSchema).withOutput(machineSchema).mutation("grant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("revokeGrant").withInput(machineGrantInputSchema).withOutput(machineSchema).mutation("setBudget").withInput(setMachineBudgetInputSchema).withOutput(machineSchema).mutation("openScreen").withInput(openScreenInputSchema).withOutput(screenSessionSchema).mutation("finishScreen").withInput(screenRefSchema).withOutput(machineSchema).mutation("connectOwn").withInput(connectOwnMachineInputSchema).withOutput(ownMachineConnectSchema).mutation("newConnectCommand").withInput(machineRefSchema).withOutput(ownMachineConnectSchema).mutation("connectSsh").withInput(connectSshMachineInputSchema).withOutput(ownMachineSshConnectSchema).mutation("trustHostKey").withInput(trustHostKeyInputSchema).withOutput(machineSchema).mutation("checkHealth").withInput(machineRefSchema).withOutput(machineSchema).mutation("hostAgent").withInput(hostAgentInputSchema).withOutput(machineSchema).mutation("unhostAgent").withInput(unhostAgentInputSchema).withOutput(external_exports.object({ agentId: external_exports.string() })).mutation("pairWhatsapp").withInput(machineRefSchema).withOutput(whatsappPairingSchema).query("whatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("cancelWhatsappPairing").withInput(whatsappPairingRefSchema).withOutput(whatsappPairingSchema).mutation("unpairWhatsapp").withInput(machineRefSchema).withOutput(machineSchema).build();
79321
79360
  var computeFleetTrpc = defineTrpcContract("compute").query("myComputers").withInput(computeWorkspaceInputSchema).withOutput(myComputersSchema).mutation("createComputer").withInput(createComputerInputSchema).withOutput(computerStatusSchema).mutation("deleteComputer").withInput(deleteComputerInputSchema).withOutput(deleteComputerAnswerSchema).mutation("setComputerCreators").withInput(setComputerCreatorsInputSchema).withOutput(computerStatusSchema).mutation("setAgentComputer").withInput(setAgentComputerInputSchema).withOutput(agentComputerAnswerSchema).build();
79322
79361
  var computeTrpc = joinTrpcContracts("compute", computeCoreTrpc, computeFleetTrpc);
79323
79362
  var restMachineInputDefinition = external_exports.object({ machine: external_exports.string().min(1).max(64) });
@@ -79527,6 +79566,12 @@ function diskLine(status9) {
79527
79566
  const over = DISK_STATE_TEXT[disk.state];
79528
79567
  return `Disk: ${gb(disk.usedGb)} of ${gb(disk.totalGb)}${measured}${over}`;
79529
79568
  }
79569
+ function servicesLine(status9) {
79570
+ const agentsGb = status9.agents.reduce((sum, agent2) => sum + agent2.memoryGb, 0);
79571
+ const servicesGb = Math.max(0, status9.memory.usedGb - agentsGb);
79572
+ if (status9.memory.usedGb <= 0) return [];
79573
+ return [` Computer services (browser, desktop, system) memory ${gb(servicesGb)}`];
79574
+ }
79530
79575
  function printStatus({ context }, status9) {
79531
79576
  const current2 = status9.sizes.find((size) => size.current);
79532
79577
  const included = status9.sizes.find((size) => size.included);
@@ -79540,6 +79585,7 @@ function printStatus({ context }, status9) {
79540
79585
  ...status9.agents.map(
79541
79586
  (agent2) => ` ${agent2.name} ${agent2.state} CPU ${Number(agent2.cpuBusy.toFixed(1))} memory ${gb(agent2.memoryGb)}`
79542
79587
  ),
79588
+ ...servicesLine(status9),
79543
79589
  ...status9.memoryStops.length > 0 ? ["Memory stops:"] : [],
79544
79590
  ...status9.memoryStops.map(
79545
79591
  (stop3) => ` ${utc(stop3.at)} ${stop3.agentName} ${stop3.command} ${gb(stop3.memoryGb)}`
@@ -81196,7 +81242,9 @@ var feedActionSchemaDefinition = external_exports.object({
81196
81242
  message: external_exports.string(),
81197
81243
  style: external_exports.enum(["primary", "secondary"]).optional(),
81198
81244
  /** What the button says once pressed, and the handled line: "Sent". */
81199
- doneLabel: external_exports.string().optional()
81245
+ doneLabel: external_exports.string().optional(),
81246
+ /** A done action closes the card as it is pressed; the agent still hears which one. */
81247
+ done: external_exports.boolean().optional()
81200
81248
  });
81201
81249
  var feedActionSchema = feedActionSchemaDefinition;
81202
81250
  var feedItemActionSchemaDefinition = external_exports.object({
@@ -81204,7 +81252,9 @@ var feedItemActionSchemaDefinition = external_exports.object({
81204
81252
  label: external_exports.string(),
81205
81253
  message: external_exports.string(),
81206
81254
  style: external_exports.enum(["primary", "secondary"]),
81207
- doneLabel: external_exports.string().nullable()
81255
+ doneLabel: external_exports.string().nullable(),
81256
+ /** Present only on a done action: pressing it closes the card for everyone who gets it. */
81257
+ done: external_exports.literal(true).optional()
81208
81258
  });
81209
81259
  var feedItemActionSchema = feedItemActionSchemaDefinition;
81210
81260
  var feedLinkSchemaDefinition = external_exports.object({ label: external_exports.string(), url: external_exports.string() });
@@ -81320,7 +81370,9 @@ var replyFeedItemInputSchemaDefinition = external_exports.object({
81320
81370
  agent: feedAgentSchema,
81321
81371
  body: external_exports.string(),
81322
81372
  /** Wakes the item now for everyone who snoozed it. */
81323
- urgent: external_exports.boolean().default(false)
81373
+ urgent: external_exports.boolean().default(false),
81374
+ /** Closes the item with this reply: it leaves every feed and later replies keep it closed. */
81375
+ done: external_exports.boolean().default(false)
81324
81376
  });
81325
81377
  var feedEntrySchemaDefinition = external_exports.object({
81326
81378
  id: external_exports.string(),
@@ -81492,10 +81544,16 @@ var actFeedItemInputSchemaDefinition = external_exports.object({
81492
81544
  draft: external_exports.string().optional()
81493
81545
  });
81494
81546
  var actFeedItemInputSchema = actFeedItemInputSchemaDefinition;
81547
+ var feedCommentAfterSchemaDefinition = external_exports.discriminatedUnion("kind", [
81548
+ external_exports.object({ kind: external_exports.literal("done") }),
81549
+ external_exports.object({ kind: external_exports.literal("snooze"), until: external_exports.iso.datetime({ offset: true }) })
81550
+ ]);
81495
81551
  var commentFeedItemInputSchemaDefinition = external_exports.object({
81496
81552
  ...itemRef.shape,
81497
81553
  body: external_exports.string(),
81498
- draft: external_exports.string().optional()
81554
+ draft: external_exports.string().optional(),
81555
+ /** With an after-step the comment is a note on the card and the agent files no turn. */
81556
+ after: feedCommentAfterSchemaDefinition.nullable().default(null)
81499
81557
  });
81500
81558
  var commentFeedItemInputSchema = commentFeedItemInputSchemaDefinition;
81501
81559
  var snoozeFeedItemInputSchemaDefinition = external_exports.object({
@@ -81632,6 +81690,7 @@ var feedCommentByKeyInputSchemaDefinition = external_exports.object({
81632
81690
  itemId: external_exports.string().min(1),
81633
81691
  body: external_exports.string(),
81634
81692
  draft: external_exports.string().optional(),
81693
+ after: feedCommentAfterSchemaDefinition.nullable().default(null),
81635
81694
  /** Post the text as written even when the readability check pushes it back. */
81636
81695
  force: external_exports.boolean().default(false)
81637
81696
  });
@@ -81828,12 +81887,19 @@ function pairsOf(args) {
81828
81887
  });
81829
81888
  }
81830
81889
  const actions = args.lists.action ?? [];
81890
+ const doneLabels = new Set(args.lists["done-action"] ?? []);
81891
+ const labels = /* @__PURE__ */ new Set();
81831
81892
  if (actions.length > 0) {
81832
81893
  fields.actions = actions.map((value) => {
81833
81894
  const [label3, message2] = pairOf({ value, flag: "action" });
81834
- return { label: label3, message: message2 };
81895
+ labels.add(label3);
81896
+ return doneLabels.has(label3) ? { label: label3, message: message2, done: true } : { label: label3, message: message2 };
81835
81897
  });
81836
81898
  }
81899
+ for (const label3 of doneLabels) {
81900
+ if (!labels.has(label3))
81901
+ throw new Error(`--done-action "${label3}" names no --action of this card`);
81902
+ }
81837
81903
  return fields;
81838
81904
  }
81839
81905
  function feedFlagsOf({ args }) {
@@ -81934,7 +82000,8 @@ var USAGE10 = `Usage:
81934
82000
  [--draft <text|@file>] [--draft-header "To: ...\\nRe: ..."]
81935
82001
  [--metric <json|@file.json> | --table <csv|@file.csv>]
81936
82002
  [--image <path|url>]... [--file <path|url>]... (post only, at most 6)
81937
- [--link <label>=<url>]... [--action <label>=<message>]... [--to <userId>]...
82003
+ [--link <label>=<url>]... [--action <label>=<message>]... [--done-action <label>]...
82004
+ [--to <userId>]...
81938
82005
  [--urgent] [--done-label <line>] [--show-at <ISO time>]
81939
82006
  [--snooze-for <userId>... --until <ISO time>]
81940
82007
  [--group <name> [--label <word>]...] [--loop <key> [--reopen]]
@@ -81942,7 +82009,7 @@ var USAGE10 = `Usage:
81942
82009
  laze feed update <id> [the post flags that change] [--title <title>]
81943
82010
  [--auto-send-on <YYYY-MM-DD>|none]
81944
82011
  [--show-at <ISO time>|none] [--snooze-for <userId>... --until <ISO time>|none] [--reopen]
81945
- laze feed reply <id> <text> [--urgent] [--force]
82012
+ laze feed reply <id> <text> [--done] [--urgent] [--force]
81946
82013
  laze feed read <id>
81947
82014
  laze feed inbox
81948
82015
  laze feed close <id>|--loop <key> --note <text>
@@ -82043,7 +82110,8 @@ async function feedReply({ context, args }) {
82043
82110
  itemId,
82044
82111
  body: text2,
82045
82112
  urgent: Boolean(args.flags.urgent),
82046
- ...args.flags.force ? { force: true } : {}
82113
+ ...args.flags.force ? { force: true } : {},
82114
+ ...args.flags.done === true ? { done: true } : {}
82047
82115
  });
82048
82116
  printItem({ context, args, item: replied });
82049
82117
  }
@@ -84368,7 +84436,7 @@ function releaseWarningOf({
84368
84436
  sandbox
84369
84437
  }) {
84370
84438
  const skew = releaseSkewOf({ mine: mine4, server });
84371
- if (!skew) return null;
84439
+ if (!skew || skew === "other_build") return null;
84372
84440
  if (sandbox) {
84373
84441
  return `laze: this CLI is ${mine4}, but the server ships ${server}. Laze updates the computer's CLI each time the agent connects, so restart the agent if this stays.
84374
84442
  `;
@@ -84377,11 +84445,7 @@ function releaseWarningOf({
84377
84445
  return `laze: this CLI is ${mine4}, newer than the server's ${server}; a command the server does not have yet fails.
84378
84446
  `;
84379
84447
  }
84380
- const how = `Update it with npm i -g ${CLI_PACKAGE_LATEST} (or laze update).`;
84381
- if (skew === "older")
84382
- return `laze: this CLI is ${mine4}, older than the server's ${server}. ${how}
84383
- `;
84384
- return `laze: this CLI is ${mine4}, a different build from the server's ${server}. ${how}
84448
+ return `laze: this CLI is ${mine4}, older than the server's ${server}. Update it with npm i -g ${CLI_PACKAGE_LATEST} (or laze update).
84385
84449
  `;
84386
84450
  }
84387
84451
  function selfUpdateLineOf({
@@ -84423,9 +84487,24 @@ async function startedUpdate({
84423
84487
  });
84424
84488
  return { manager: plan2.manager };
84425
84489
  }
84490
+ async function noteRelease({
84491
+ context,
84492
+ mine: mine4,
84493
+ server,
84494
+ sandbox,
84495
+ quiet
84496
+ }) {
84497
+ const warning = releaseWarningOf({ mine: mine4, server, sandbox });
84498
+ if (!warning) return false;
84499
+ const older = !sandbox && releaseSkewOf({ mine: mine4, server }) === "older";
84500
+ const started = older ? await startedUpdate({ context, server }) : null;
84501
+ if (!quiet) context.err(started ? selfUpdateLineOf({ mine: mine4, server, ...started }) : warning);
84502
+ return true;
84503
+ }
84426
84504
  function watchingRelease({
84427
84505
  context,
84428
- mine: mine4 = cliVersionOf()
84506
+ mine: mine4 = cliVersionOf(),
84507
+ quiet = false
84429
84508
  }) {
84430
84509
  const sandbox = context.program.at(-1) === SANDBOX_CLI_PATH;
84431
84510
  let warned = false;
@@ -84434,15 +84513,7 @@ function watchingRelease({
84434
84513
  fetcher: async (input2, init) => {
84435
84514
  const response = await context.fetcher(input2, init);
84436
84515
  const server = response.headers.get(CLI_RELEASE_HEADER);
84437
- if (!warned && server) {
84438
- const warning = releaseWarningOf({ mine: mine4, server, sandbox });
84439
- if (warning) {
84440
- warned = true;
84441
- const older = !sandbox && releaseSkewOf({ mine: mine4, server }) === "older";
84442
- const started = older ? await startedUpdate({ context, server }) : null;
84443
- context.err(started ? selfUpdateLineOf({ mine: mine4, server, ...started }) : warning);
84444
- }
84445
- }
84516
+ if (!warned && server) warned = await noteRelease({ context, mine: mine4, server, sandbox, quiet });
84446
84517
  return response;
84447
84518
  }
84448
84519
  };
@@ -87536,7 +87607,8 @@ async function runCli({
87536
87607
  return command || args.flags.help ? 0 : 2;
87537
87608
  }
87538
87609
  try {
87539
- return await command({ context: watchingRelease({ context }), args }) ?? 0;
87610
+ const quiet = args.words[0] === "hook";
87611
+ return await command({ context: watchingRelease({ context, quiet }), args }) ?? 0;
87540
87612
  } catch (error62) {
87541
87613
  if (error62 instanceof CliUsageError) context.err(`${error62.message}
87542
87614
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazehq/cli",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
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",