@lazehq/cli 0.1.110 → 0.1.111

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 +347 -42
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -31656,7 +31656,7 @@ function isLazeId(token2) {
31656
31656
  if (value >> 152n !== 0n) return false;
31657
31657
  const seconds = value >> 104n & 0xffffffffn;
31658
31658
  const echo = value >> 136n & 0xffffn;
31659
- if (echo !== (seconds & 0xffffn)) return false;
31659
+ if (echo !== 0n && echo !== (seconds & 0xffffn)) return false;
31660
31660
  return seconds >= FIRST_SECOND && seconds <= LAST_SECOND;
31661
31661
  }
31662
31662
  function isLazeIdText(text3) {
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
36960
36960
  }
36961
36961
 
36962
36962
  // src/rules/cli-version.rules.ts
36963
- var STAMPED = "0.1.110";
36963
+ var STAMPED = "0.1.111";
36964
36964
  function cliVersionOf({ stamped = STAMPED } = {}) {
36965
36965
  return stamped.startsWith("__") ? "dev" : stamped;
36966
36966
  }
@@ -63236,8 +63236,13 @@ var budgetCardSchemaDefinition = external_exports.object({
63236
63236
  window: external_exports.enum(["day", "week", "month"]),
63237
63237
  /** The plain first line: "Scout is paused on its daily budget." */
63238
63238
  line: external_exports.string().min(1).max(400),
63239
+ /** Provider cost in USD, as the gateway enforces it. */
63239
63240
  limitUsd: external_exports.number().nonnegative(),
63240
63241
  spentUsd: external_exports.number().nonnegative(),
63242
+ /** What Laze charges, in `currency`; absent on cards from before charged budgets. */
63243
+ chargedLimit: external_exports.number().nonnegative().optional(),
63244
+ chargedSpent: external_exports.number().nonnegative().optional(),
63245
+ currency: external_exports.enum(["usd", "eur"]).optional(),
63241
63246
  /** When the window resets and the agent answers again. */
63242
63247
  resumeAt: external_exports.iso.datetime(),
63243
63248
  /** The people who may raise the budget: the owner and the admins when it paused. */
@@ -63248,6 +63253,7 @@ var budgetCardSchemaDefinition = external_exports.object({
63248
63253
  /** What happened, once resumed: "Ada raised the daily budget to 10.00 USD." */
63249
63254
  outcome: external_exports.string().max(400)
63250
63255
  });
63256
+ var creditsCardSchemaDefinition = external_exports.object({ type: external_exports.literal("credits") });
63251
63257
  var feedCardSchemaDefinition = external_exports.object({
63252
63258
  type: external_exports.literal("feed"),
63253
63259
  itemId: idSchema4,
@@ -63306,6 +63312,7 @@ var messageCardSchemaDefinition = external_exports.discriminatedUnion("type", [
63306
63312
  heldCardSchemaDefinition,
63307
63313
  hopLimitCardSchemaDefinition,
63308
63314
  budgetCardSchemaDefinition,
63315
+ creditsCardSchemaDefinition,
63309
63316
  feedCardSchemaDefinition,
63310
63317
  failureCardSchemaDefinition,
63311
63318
  welcomeCardSchemaDefinition,
@@ -63891,6 +63898,8 @@ var postNoticeInputSchemaDefinition = external_exports.object({
63891
63898
  details: external_exports.string().trim().min(1).max(NOTICE_DETAILS_MAX).optional(),
63892
63899
  /** Try again under the notice, for the message the agent did not answer. */
63893
63900
  retry: failureRetrySchemaDefinition.optional(),
63901
+ /** An agent's notice that work waits for a top-up: drawn as the credits card. */
63902
+ credits: external_exports.literal(true).optional(),
63894
63903
  /** One notice per key: a second post with it answers the first. */
63895
63904
  clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
63896
63905
  });
@@ -67722,10 +67731,20 @@ var raiseBudgetInputSchemaDefinition = external_exports.object({
67722
67731
  workspaceId: external_exports.string().min(1),
67723
67732
  /** The pause card the person pressed Raise budget on. */
67724
67733
  messageId: external_exports.string().min(1),
67725
- /** The paused window's new limit in USD. */
67726
- limitUsd: external_exports.number().positive().max(1e5)
67734
+ /** The paused window's new limit in provider USD, as clients before charged budgets send. */
67735
+ limitUsd: external_exports.number().positive().max(1e5).optional(),
67736
+ /** The paused window's new limit in what Laze charges, in the workspace currency. */
67737
+ chargedLimit: external_exports.number().positive().max(1e5).optional()
67727
67738
  });
67728
67739
  var raiseBudgetInputSchema = raiseBudgetInputSchemaDefinition;
67740
+ var raisedBudgetSchemaDefinition = external_exports.object({
67741
+ /** The paused window's new provider limit in USD. */
67742
+ limitUsd: external_exports.number(),
67743
+ /** The same limit in what Laze charges; absent from a server without charged budgets. */
67744
+ chargedLimit: external_exports.number().optional(),
67745
+ currency: external_exports.enum(["usd", "eur"]).optional()
67746
+ });
67747
+ var raisedBudgetSchema = raisedBudgetSchemaDefinition;
67729
67748
 
67730
67749
  // ../../modules/agent/contract/src/agent-catch-up.ts
67731
67750
  var CATCH_UP_QUESTION_MAX = 4e3;
@@ -69592,6 +69611,58 @@ var harnessSignInPollSchemaDefinition = external_exports.discriminatedUnion("sta
69592
69611
  external_exports.object({ status: external_exports.literal("approved"), flow: external_exports.string() })
69593
69612
  ]);
69594
69613
  var harnessSignInPollSchema = harnessSignInPollSchemaDefinition;
69614
+ var loginStateSchema = external_exports.enum(["ready", "out_of_usage", "invalid"]);
69615
+ var isoSchema = external_exports.iso.datetime();
69616
+ var loginStatesSchemaDefinition = external_exports.object({
69617
+ /** Logins signed in on a person's own Laze computer; Laze holds only the fact. */
69618
+ computerLogins: external_exports.array(
69619
+ external_exports.object({ userId: external_exports.string(), harness: harnessSchema2, savedAt: isoSchema })
69620
+ ),
69621
+ /** Logins in people's personal keychains in the vault. */
69622
+ personalLogins: external_exports.array(
69623
+ external_exports.object({
69624
+ id: external_exports.string(),
69625
+ ownerUserId: external_exports.string(),
69626
+ harness: harnessSchema2,
69627
+ state: loginStateSchema,
69628
+ /** The vault's own state: `needs_reconnect`, or still waiting for an admin's approval. */
69629
+ vaultStatus: external_exports.enum(["active", "needs_reconnect"]),
69630
+ waitingApproval: external_exports.boolean(),
69631
+ limitedUntil: isoSchema.nullable(),
69632
+ checkedAt: isoSchema.nullable(),
69633
+ createdAt: isoSchema,
69634
+ updatedAt: isoSchema
69635
+ })
69636
+ ),
69637
+ pools: external_exports.array(
69638
+ external_exports.object({
69639
+ id: external_exports.string(),
69640
+ createdAt: isoSchema,
69641
+ members: external_exports.number().int().nonnegative(),
69642
+ logins: external_exports.array(
69643
+ external_exports.object({
69644
+ id: external_exports.string(),
69645
+ harness: harnessSchema2,
69646
+ state: loginStateSchema,
69647
+ contributedByUserId: external_exports.string(),
69648
+ limitedUntil: isoSchema.nullable(),
69649
+ createdAt: isoSchema
69650
+ })
69651
+ )
69652
+ })
69653
+ ),
69654
+ /** Each Laze-hosted agent and the login its next turn runs on; connected agents are left out. */
69655
+ agents: external_exports.array(
69656
+ external_exports.object({
69657
+ id: external_exports.string(),
69658
+ harness: external_exports.string(),
69659
+ source: external_exports.enum(["keychain", "computer", "pool", "laze_models", "none"]),
69660
+ loginPoolId: external_exports.string().nullable(),
69661
+ activeLoginId: external_exports.string().nullable()
69662
+ })
69663
+ )
69664
+ });
69665
+ var loginStatesSchema = loginStatesSchemaDefinition;
69595
69666
 
69596
69667
  // ../../modules/agent/contract/src/agent-migration.ts
69597
69668
  var workspaceIdSchema10 = external_exports.string().min(1);
@@ -70584,7 +70655,7 @@ var agentsCopy = {
70584
70655
  paintOnly: true,
70585
70656
  storable: agentsForDisk
70586
70657
  };
70587
- var agentCoreTrpc = defineTrpcContract("agents").query("list", { mirrored: agentsCopy }).withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).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: workspaceIdSchema14 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(external_exports.object({ limitUsd: external_exports.number() })).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).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: workspaceIdSchema14 })).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: workspaceIdSchema14, agentId: idSchema18 })).withOutput(external_exports.object({ channelId: idSchema18 })).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: workspaceIdSchema14, agentId: idSchema18 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).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();
70658
+ var agentCoreTrpc = defineTrpcContract("agents").query("list", { mirrored: agentsCopy }).withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(agentListEntrySchema)).mutation("create").withInput(createAgentInputSchema).withOutput(agentSchema).mutation("update").withInput(updateAgentInputSchema).withOutput(agentSchema).mutation("remove").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).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: workspaceIdSchema14 })).withOutput(external_exports.array(agentFaceSchema)).query("presence").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(external_exports.array(agentPresenceSchema)).mutation("uploadAvatar").withInput(uploadAgentAvatarInputSchema).withOutput(uploadedAgentAvatarSchema).query("access").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).withOutput(agentAccessSchema).query("loginActivity").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).withOutput(loginActivitySchema).mutation("raiseBudget").withInput(raiseBudgetInputSchema).withOutput(raisedBudgetSchema).query("permissionPrompts").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).withOutput(external_exports.array(agentPermissionPromptSchema)).mutation("share").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).mutation("unshare").withInput(shareAgentInputSchema).withOutput(agentAccessSchema).query("harnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).withOutput(harnessLoginsSchema).mutation("saveHarnessLogin").withInput(saveHarnessLoginInputSchema).withOutput(harnessLoginsSchema).mutation("removeHarnessLogin").withInput(removeHarnessLoginInputSchema).withOutput(harnessLoginsSchema).query("listHarnessLogins").withInput(external_exports.object({ workspaceId: workspaceIdSchema14 })).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: workspaceIdSchema14 })).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: workspaceIdSchema14, agentId: idSchema18 })).withOutput(external_exports.object({ channelId: idSchema18 })).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: workspaceIdSchema14, agentId: idSchema18 })).withOutput(external_exports.object({ disconnected: external_exports.literal(true) })).mutation("setGithub").withInput(setAgentGithubInputSchema).withOutput(agentSchema).query("githubWatches").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).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();
70588
70659
  var agentTurnTrpc = defineTrpcContract("agents").mutation("answerAttention").withInput(answerAttentionInputSchema).withOutput(external_exports.object({ answered: external_exports.literal(true) })).query("attentionDetail").withInput(attentionDetailInputSchema).withOutput(attentionDetailSchema).mutation("stopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ stopped: external_exports.literal(true) })).query("mayStopTurn").withInput(stopAgentTurnInputSchema).withOutput(external_exports.object({ allowed: external_exports.boolean() })).mutation("retryTurn").withInput(retryAgentTurnInputSchema).withOutput(external_exports.object({ retried: external_exports.literal(true) })).query("retryState").withInput(retryAgentTurnInputSchema).withOutput(agentRetryStateSchema).query("liveSteps").withInput(liveStepsInputSchema).withOutput(liveStepsSchema).query("workingNow").withInput(agentWorkingInputSchema).withOutput(agentWorkingSchema).mutation("compactSession").withInput(compactAgentSessionInputSchema).withOutput(external_exports.object({ requested: external_exports.literal(true) })).mutation("catchUp").withInput(startCatchUpInputSchema).withOutput(catchUpRunSchema).mutation("catchUpAsk").withInput(askCatchUpInputSchema).withOutput(catchUpRunSchema).query("catchUpRun").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("catchUpStop").withInput(catchUpRunInputSchema).withOutput(catchUpRunSchema).mutation("restartComputer").withInput(restartAgentComputerInputSchema).withOutput(external_exports.object({ restarted: external_exports.boolean() })).build();
70589
70660
  var agentChannelSettingsTrpc = defineTrpcContract("agents").query("monitors").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18 })).withOutput(external_exports.array(agentMonitorSchema)).query("channelLevel").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema18, channelId: idSchema18 })).withOutput(channelLevelSchema).mutation("setChannelLevel").withInput(setChannelLevelInputSchema).withOutput(channelLevelSchema).mutation("unmuteChannel").withInput(unmuteAgentChannelInputSchema).withOutput(channelLevelSchema).mutation("cancelHeld").withInput(cancelHeldInputSchema).withOutput(cancelHeldResultSchema).mutation("useLazeModelsUntilReset").withInput(useLazeModelsUntilResetInputSchema).withOutput(lazeModelsUntilResetSchema).build();
70590
70661
  var agentJoinTrpc = defineTrpcContract("agents").query("joinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("approveJoinRequest").withInput(approveJoinRequestInputSchema).withOutput(joinRequestViewSchema).mutation("denyJoinRequest").withInput(joinRequestInputSchema).withOutput(joinRequestViewSchema).build();
@@ -80783,6 +80854,8 @@ var signInHandoffSchemaDefinition = external_exports.object({
80783
80854
  expiresAt: external_exports.iso.datetime()
80784
80855
  });
80785
80856
  var signInHandoffSchema = signInHandoffSchemaDefinition;
80857
+ var appOpenedSchemaDefinition = external_exports.object({ appId: external_exports.string() });
80858
+ var appOpenedSchema = appOpenedSchemaDefinition;
80786
80859
  var appViewerSchemaDefinition = external_exports.object({
80787
80860
  userId: external_exports.string().min(1),
80788
80861
  name: external_exports.string(),
@@ -82221,7 +82294,7 @@ var appsCopy = {
82221
82294
  paintOnly: true,
82222
82295
  storable: appsForDisk
82223
82296
  };
82224
- var appMainTrpc = defineTrpcContract("app").query("list", { mirrored: appsCopy }).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(appPushSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(appDataRefSchema).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(appDataRefSchema).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("access").withInput(appRefSchema).withOutput(appAccessSchema).query("members").withInput(appRefSchema).withOutput(appMembersSchema).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).query("openChoices").withInput(appRefSchema).withOutput(appOpenChoicesSchema).mutation("askToOpen").withInput(appRefSchema).withOutput(appAskedSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).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();
82297
+ var appMainTrpc = defineTrpcContract("app").query("list", { mirrored: appsCopy }).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(appPushSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(appDataRefSchema).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(appDataRefSchema).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).mutation("recordOpen").withInput(appRefSchema).withOutput(appOpenedSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("access").withInput(appRefSchema).withOutput(appAccessSchema).query("members").withInput(appRefSchema).withOutput(appMembersSchema).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).query("openChoices").withInput(appRefSchema).withOutput(appOpenChoicesSchema).mutation("askToOpen").withInput(appRefSchema).withOutput(appAskedSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).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();
82225
82298
  var appExternalTrpc = defineTrpcContract("app").mutation("externalSignInHandoff").withInput(externalSignInHandoffInputSchema).withOutput(signInHandoffSchema).mutation("setExternalRole").withInput(setExternalRoleInputSchema).withOutput(appAccessSchema).build();
82226
82299
  var appConnectionsTrpc = defineTrpcContract("app").query("connections").withInput(appRefSchema).withOutput(appConnectionsSchema).mutation("allowConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).mutation("revokeConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).build();
82227
82300
  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).mutation("setPinRole").withInput(setPinRoleInputSchema).withOutput(appAccessSchema).build();
@@ -85552,21 +85625,21 @@ var appUnpublish = async ({ context, args }) => {
85552
85625
  });
85553
85626
  };
85554
85627
  function costText({ name: name3, cost }) {
85555
- const money3 = (amount) => formatAppMoney({ amount, currency: cost.currency });
85628
+ const money4 = (amount) => formatAppMoney({ amount, currency: cost.currency });
85556
85629
  const month = Temporal3.PlainDate.from(`${cost.month}-01`).toLocaleString("en-GB", {
85557
85630
  month: "long",
85558
85631
  year: "numeric"
85559
85632
  });
85560
85633
  const rows = cost.lines.map((line) => {
85561
85634
  const used = appCostQuantityText(line);
85562
- return ` ${APP_COST_PART_LABELS[line.part].padEnd(16)} ${money3(line.amount).padStart(12)}${used ? ` ${used}` : ""}
85635
+ return ` ${APP_COST_PART_LABELS[line.part].padEnd(16)} ${money4(line.amount).padStart(12)}${used ? ` ${used}` : ""}
85563
85636
  `;
85564
85637
  });
85565
85638
  const { budget: budget2 } = cost;
85566
- const budgetLine = budget2.monthly === null ? "No budget. laze app budget <amount> sets one.\n" : `Budget ${money3(budget2.monthly)} a month, ${Math.round(cost.total / budget2.monthly * 100).toString()}% used.
85639
+ const budgetLine = budget2.monthly === null ? "No budget. laze app budget <amount> sets one.\n" : `Budget ${money4(budget2.monthly)} a month, ${Math.round(cost.total / budget2.monthly * 100).toString()}% used.
85567
85640
  `;
85568
85641
  const paused = budget2.paused ? "Paused: server functions and agent work on this app stop until the budget is raised or the month ends. Pages and records keep working.\n" : "";
85569
- return `${name3} cost ${money3(cost.total)} so far in ${month}, at Laze list prices:
85642
+ return `${name3} cost ${money4(cost.total)} so far in ${month}, at Laze list prices:
85570
85643
  ${rows.join("")}${budgetLine}${paused}`;
85571
85644
  }
85572
85645
  async function appOfWord({
@@ -85949,6 +86022,16 @@ function prepaidNoteOf(account, of) {
85949
86022
  ].filter((note) => note !== null);
85950
86023
  return notes.length > 0 ? ` (${notes.join(", ")})` : "";
85951
86024
  }
86025
+ function rechargeLineOf({
86026
+ recharge,
86027
+ of
86028
+ }) {
86029
+ if (!recharge.enabled) return "off";
86030
+ if (recharge.amount === null || recharge.monthlyLimit === null) {
86031
+ return "on, starts with the first payment (a top-up or a paid Team invoice)";
86032
+ }
86033
+ return `on, ${of(recharge.amount)} when credits run low, up to ${of(recharge.monthlyLimit)} a month (${of(recharge.rechargedThisMonth)} so far)`;
86034
+ }
85952
86035
  function printAccount({ context, args }, account) {
85953
86036
  if (args.flags.json) return printJson(context, account);
85954
86037
  const of = (amount) => money(amount, account.currency);
@@ -85967,8 +86050,7 @@ function printAccount({ context, args }, account) {
85967
86050
  `
85968
86051
  );
85969
86052
  const recharge = account.autoRecharge;
85970
- const rechargeLine = recharge.enabled ? `on, ${recharge.amount === null ? "after the first top-up" : of(recharge.amount)} when under ${of(recharge.rechargeBelow)}, limit ${recharge.monthlyLimit === null ? "set by the first top-up" : of(recharge.monthlyLimit)} a month (${of(recharge.rechargedThisMonth)} so far)` : "off";
85971
- context.out(`Auto-recharge: ${rechargeLine}
86053
+ context.out(`Auto-recharge: ${rechargeLineOf({ recharge, of })}
85972
86054
  `);
85973
86055
  if (recharge.lastFailure) context.out(`Last recharge failed: ${recharge.lastFailure.message}
85974
86056
  `);
@@ -88395,6 +88477,7 @@ var computerWaitlistChangedDefinition = external_exports.object({
88395
88477
 
88396
88478
  // ../../modules/billing/contract/src/billing.config.ts
88397
88479
  var priceId = external_exports.string().min(1).optional();
88480
+ var MAC_QA_WORKSPACE_ID = "workspace_0004i5nUrgRHO0Mz9PXEeGpqnPFDM";
88398
88481
  var billingConfig = Config.define((c) => ({
88399
88482
  publicBaseUrl,
88400
88483
  /** The first alias (`laze.so` on prod) is the short origin referral links are shared on. */
@@ -88420,8 +88503,7 @@ var billingConfig = Config.define((c) => ({
88420
88503
  automaticTax: c.env("STRIPE_AUTOMATIC_TAX", environmentBooleanSchema.default(true)),
88421
88504
  /** The coupon for a referral: `REFERRAL_TERMS` off, repeating for its months. */
88422
88505
  referralCouponId: c.env("STRIPE_COUPON_REFERRAL", external_exports.string().min(1).optional()),
88423
- /** List price over cost per usage category; never shown on the site. */
88424
- modelMarkup: c.env("LAZE_MARKUP_MODEL", external_exports.coerce.number().min(1).max(10).default(1.055)),
88506
+ /** List price over cost for machines and connectors; model calls follow `MODEL_FEE_TERMS`. */
88425
88507
  machineMarkup: c.env("LAZE_MARKUP_MACHINE", external_exports.coerce.number().min(1).max(10).default(2)),
88426
88508
  connectorMarkup: c.env("LAZE_MARKUP_CONNECTOR", external_exports.coerce.number().min(1).max(10).default(2)),
88427
88509
  /** The ECB daily reference rates EUR usage is priced at. */
@@ -88429,6 +88511,16 @@ var billingConfig = Config.define((c) => ({
88429
88511
  "LAZE_ECB_RATES_URL",
88430
88512
  external_exports.url().default("https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml")
88431
88513
  ),
88514
+ /**
88515
+ * QA workspaces billing-qa-credit-state may put in a credit state, comma separated ids; unset,
88516
+ * the prod Mac QA workspace. Spec: modules/billing/specs/qa-credit-state.feature.
88517
+ */
88518
+ qaWorkspaceIds: c.env(
88519
+ "LAZE_BILLING_QA_WORKSPACES",
88520
+ external_exports.string().default(MAC_QA_WORKSPACE_ID).transform(
88521
+ (value) => value.split(",").map((id4) => id4.trim()).filter(Boolean)
88522
+ )
88523
+ ),
88432
88524
  /** USD per euro until the first ECB rate is stored. */
88433
88525
  defaultUsdPerEur: c.env(
88434
88526
  "LAZE_DEFAULT_USD_PER_EUR",
@@ -88515,8 +88607,12 @@ var CREDIT_TERMS = {
88515
88607
  /** Auto-recharge tops up when the prepaid balance drops under this. */
88516
88608
  rechargeBelow: 5,
88517
88609
  autoRechargeByDefault: true,
88610
+ /** What each auto-recharge adds once a paid Team invoice turns it on without a top-up. */
88611
+ defaultRecharge: 10,
88518
88612
  /** A top-up raises the monthly auto-recharge limit to this many times its amount. */
88519
- limitPerTopUp: 2
88613
+ limitPerTopUp: 2,
88614
+ /** The monthly limit an admin can raise to in one tap once the limit holds recharges back. */
88615
+ suggestedMonthlyLimit: 100
88520
88616
  };
88521
88617
 
88522
88618
  // ../../modules/billing/contract/src/billing.events.ts
@@ -88563,6 +88659,10 @@ var usagePausedDefinition = external_exports.object({
88563
88659
  paused: external_exports.boolean(),
88564
88660
  /** `no_plan`, `canceled` and `budget` are from before prepaid credits. */
88565
88661
  reason: external_exports.enum(["credits", "no_plan", "canceled", "budget"]).nullable(),
88662
+ /** On a pause for credits: true when only the monthly limit kept auto-recharge from charging. */
88663
+ autoRechargeHeldByLimit: external_exports.boolean().optional(),
88664
+ /** Absent on facts from before it was recorded: the workspace's billing currency then. */
88665
+ currency: currencySchema.optional(),
88566
88666
  at: external_exports.iso.datetime()
88567
88667
  });
88568
88668
  var referralRewardedDefinition = external_exports.object({
@@ -88586,6 +88686,30 @@ var checkoutChangedDefinition = external_exports.object({
88586
88686
  byUserId: external_exports.string().nullable(),
88587
88687
  at: external_exports.iso.datetime()
88588
88688
  });
88689
+ var creditsLowDefinition = external_exports.object({
88690
+ workspaceId: external_exports.string().min(1),
88691
+ /** The usage entry that crossed the low mark; one fact per entry. */
88692
+ entryId: external_exports.string().min(1),
88693
+ plan: storedPlanSchema,
88694
+ /**
88695
+ * Whether auto-recharge tops the credits up before work pauses. Absent on facts from before
88696
+ * it was recorded: read it with `autoRechargeCoversLow`.
88697
+ */
88698
+ autoRechargeCovers: external_exports.boolean().optional(),
88699
+ /** True when the monthly limit is reached or the next recharge is the last under it. */
88700
+ autoRechargeHeldByLimit: external_exports.boolean().optional(),
88701
+ /** Absent on facts from before it was recorded: the workspace's billing currency then. */
88702
+ currency: currencySchema.optional(),
88703
+ at: external_exports.iso.datetime()
88704
+ });
88705
+ var autoRechargeStartedDefinition = external_exports.object({
88706
+ workspaceId: external_exports.string().min(1),
88707
+ /** What each recharge adds and the monthly limit, in the workspace currency. */
88708
+ amount: external_exports.number().positive(),
88709
+ monthlyLimit: external_exports.number().positive(),
88710
+ currency: currencySchema,
88711
+ at: external_exports.iso.datetime()
88712
+ });
88589
88713
  var creditCheckStateDefinition = external_exports.object({ nextWakeAt: external_exports.number().nullable() });
88590
88714
  var creditCheckIntentDefinition = external_exports.object({ workspaceId: external_exports.string().min(1) });
88591
88715
 
@@ -88676,17 +88800,24 @@ var billingAccountViewDefinition = external_exports.object({
88676
88800
  /** The one-off welcome credit given before 2026-10-21; 0 when it got none. */
88677
88801
  welcome: external_exports.number().default(0),
88678
88802
  paused: external_exports.boolean(),
88679
- pauseReason: pauseReasonSchema.nullable()
88803
+ pauseReason: pauseReasonSchema.nullable(),
88804
+ /** At or under the low mark and not paused yet. */
88805
+ low: external_exports.boolean().default(false)
88680
88806
  }),
88681
88807
  autoRecharge: external_exports.object({
88682
88808
  enabled: external_exports.boolean(),
88683
- /** What each recharge adds; null until the first top-up sets it. */
88809
+ /** What each recharge adds; null until the first top-up or paid Team invoice sets it. */
88684
88810
  amount: external_exports.number().nullable(),
88685
88811
  rechargeBelow: external_exports.number(),
88812
+ /** The monthly limit, double the amount unless set; null while the amount is. */
88686
88813
  monthlyLimit: external_exports.number().nullable(),
88687
88814
  rechargedThisMonth: external_exports.number(),
88688
88815
  cardSaved: external_exports.boolean(),
88689
- lastFailure: external_exports.object({ at: external_exports.iso.datetime(), message: external_exports.string() }).nullable()
88816
+ lastFailure: external_exports.object({ at: external_exports.iso.datetime(), message: external_exports.string() }).nullable(),
88817
+ /** The monthly limit holds the next recharge back; only when it could otherwise charge. */
88818
+ limitReached: external_exports.boolean().default(false),
88819
+ /** The next recharge is the last one under the monthly limit. */
88820
+ limitNear: external_exports.boolean().default(false)
88690
88821
  }),
88691
88822
  usage: external_exports.object({
88692
88823
  used: external_exports.number(),
@@ -88909,12 +89040,39 @@ var grantCreditsInputDefinition = external_exports.object({
88909
89040
  amount: external_exports.number().positive().max(1e4),
88910
89041
  reason: external_exports.string().trim().min(3).max(500)
88911
89042
  });
89043
+ var creditPausedAccountSchemaDefinition = external_exports.object({
89044
+ workspaceId: external_exports.string(),
89045
+ plan: planSchema,
89046
+ status: subscriptionStatusSchema,
89047
+ people: external_exports.number().int().nonnegative(),
89048
+ cardSaved: external_exports.boolean(),
89049
+ autoRechargeEnabled: external_exports.boolean(),
89050
+ rechargeFailedAt: external_exports.iso.datetime().nullable(),
89051
+ /** When the account last changed, which for most is the moment the pause began. */
89052
+ updatedAt: external_exports.iso.datetime()
89053
+ });
89054
+ var creditPausedAccountSchema = creditPausedAccountSchemaDefinition;
89055
+ var modelChargeBasisDefinition = external_exports.object({
89056
+ currency: currencySchema,
89057
+ /** The model fee on top of provider cost, by the people Team bills (`modelFeePercentOf`). */
89058
+ feePercent: external_exports.number().nonnegative(),
89059
+ /** USD per unit of the currency: 1 for USD, the stored ECB rate (or the default) for EUR. */
89060
+ usdPerUnit: external_exports.number().positive(),
89061
+ /** The ECB day of the rate; null for USD and for the configured default. */
89062
+ rateDay: external_exports.string().nullable()
89063
+ });
88912
89064
  var BillingApi = moduleApi()("billing");
88913
89065
  var billingTrpc = defineTrpcContract("billing").query("account").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).query("invoices").withInput(billingWorkspaceInputSchema).withOutput(external_exports.array(billingInvoiceSchema)).mutation("startCheckout").withInput(startCheckoutInputSchema).withOutput(billingRedirectSchema).query("inviteQuote").withInput(inviteQuoteInputSchema).withOutput(inviteQuoteSchema).mutation("openPortal").withInput(openPortalInputSchema).withOutput(billingRedirectSchema).mutation("setCurrency").withInput(setCurrencyInputSchema).withOutput(billingAccountViewSchema).mutation("topUp").withInput(topUpInputSchema).withOutput(billingRedirectSchema).mutation("setAutoRecharge").withInput(setAutoRechargeInputSchema).withOutput(billingAccountViewSchema).mutation("applyReferral").withInput(applyReferralInputSchema).withOutput(billingAccountViewSchema).query("referralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("dismissReferralCard").withInput(billingWorkspaceInputSchema).withOutput(referralCardSchema).mutation("claimReferral").withInput(claimReferralInputSchema).withOutput(claimReferralOutputSchema).mutation("applyPromotion").withInput(applyPromotionInputSchema).withOutput(billingAccountViewSchema).mutation("claimPromotion").withInput(claimPromotionInputSchema).withOutput(claimPromotionOutputSchema).query("billingDetails").withInput(billingWorkspaceInputSchema).withOutput(billingDetailsSchema).mutation("setBillingDetails").withInput(setBillingDetailsInputSchema).withOutput(billingDetailsSchema).mutation("cancelPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).mutation("keepPlan").withInput(billingWorkspaceInputSchema).withOutput(billingAccountViewSchema).build();
88914
89066
  var stripeWebhookHeadersDefinition = external_exports.object({
88915
89067
  "stripe-signature": external_exports.string().max(1e3).default("")
88916
89068
  });
88917
89069
 
89070
+ // ../../modules/billing/contract/src/billing.ui.ts
89071
+ var billingUi = uiTokens("billing");
89072
+ var CreditsBannerSlot = billingUi.component("creditsBanner");
89073
+ var CreditsCardSlot = billingUi.component("creditsCard");
89074
+ var CreditsComposerLineSlot = billingUi.component("creditsComposerLine");
89075
+
88918
89076
  // ../../modules/compute/contract/src/free-guards.ts
88919
89077
  var computeGuardEventKindSchema = external_exports.enum([
88920
89078
  "hours_warning",
@@ -90607,9 +90765,9 @@ function creatorsOf(args) {
90607
90765
  return { everyone: args.flags.everyone === true, userIds };
90608
90766
  }
90609
90767
  function lineOf3(computer2) {
90610
- const money3 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
90768
+ const money4 = `${computer2.monthlyCharge} ${computer2.currency.toUpperCase()} a month`;
90611
90769
  const agents = `${computer2.agents.length} agent(s)`;
90612
- return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money3} ${agents} ${computer2.state}`;
90770
+ return ` ${computer2.computerId} ${computer2.name} ${computer2.kind} ${computer2.size} ${money4} ${agents} ${computer2.state}`;
90613
90771
  }
90614
90772
  async function mine({ context, args }) {
90615
90773
  const client = await computeClient({ context, args });
@@ -90841,9 +90999,9 @@ async function list3({ context, args }) {
90841
90999
  const client = await computeClient({ context, args });
90842
91000
  const answer6 = await client.get(COMPUTER_REST_PATHS.all);
90843
91001
  if (args.flags.json) return printJson3(context, answer6);
90844
- const money3 = (amount) => `${amount} ${answer6.currency.toUpperCase()}`;
91002
+ const money4 = (amount) => `${amount} ${answer6.currency.toUpperCase()}`;
90845
91003
  const lines2 = answer6.computers.map(
90846
- (one) => ` ${one.name ?? one.ownerName} ${one.size} ${money3(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
91004
+ (one) => ` ${one.name ?? one.ownerName} ${one.size} ${money4(one.monthlyCharge)} a month ${one.agents} agent(s) ${one.state}`
90847
91005
  );
90848
91006
  context.out(
90849
91007
  `Everyone's computers (${answer6.includedSize} included per person):
@@ -96555,9 +96713,9 @@ async function list9({ context, args }) {
96555
96713
  const answer6 = await client.get(DEDICATED_IP_REST_PATHS.all);
96556
96714
  if (args.flags.json) return printJson7(context, answer6);
96557
96715
  if (answer6.ips.length === 0) return context.out("No one has a dedicated IP.\n");
96558
- const money3 = (amount) => `${amount} ${answer6.currency.toUpperCase()}`;
96716
+ const money4 = (amount) => `${amount} ${answer6.currency.toUpperCase()}`;
96559
96717
  const lines2 = answer6.ips.map(
96560
- (one) => ` ${one.ownerName} ${one.country.name} ${one.state === "on" ? "on" : "being bought"} ${money3(one.monthlyPrice)} a month`
96718
+ (one) => ` ${one.ownerName} ${one.country.name} ${one.state === "on" ? "on" : "being bought"} ${money4(one.monthlyPrice)} a month`
96561
96719
  );
96562
96720
  context.out(`Dedicated IPs:
96563
96721
  ${lines2.join("\n")}
@@ -98100,11 +98258,12 @@ async function memory({ context, args }) {
98100
98258
  var WINDOWS = ["day", "week", "month"];
98101
98259
  var USAGE15 = `Usage:
98102
98260
  laze models policy whether Laze models are on, the default budget and the cap
98103
- laze models set-policy [on|off] [--default-level small|frontier|none] [--default-day <usd|none>] [--cap-day <usd|none>] ... (admins)
98261
+ laze models set-policy [on|off] [--default-level small|frontier|none] [--default-day <amount|none>] [--cap-day <amount|none>] ... (admins)
98104
98262
  --default-level sets what agents on Default run (none: Laze Frontier, Laze's default)
98105
98263
  --default-week, --default-month, --cap-week and --cap-month set the other windows
98106
98264
  laze models agents each Laze-model agent's budget and spend
98107
- laze models budget <agent> [--day <usd|none>] [--week <usd|none>] [--month <usd|none>]
98265
+ laze models budget <agent> [--day <amount|none>] [--week <amount|none>] [--month <amount|none>]
98266
+ amounts are what Laze charges, in the workspace currency
98108
98267
  the agent's owner or an admin, up to the cap; never an agent's own key
98109
98268
  laze models spend the workspace's spend per window, agent and channel`;
98110
98269
  var LEVEL_LINES = {
@@ -98121,10 +98280,34 @@ function levelFrom({ args }) {
98121
98280
  throw new CliUsageError(`--default-level takes small, frontier or none.
98122
98281
  ${USAGE15}`);
98123
98282
  }
98124
- var usd = (value) => `${Number(value.toFixed(2))} USD`;
98125
- var limitsLine = (limits) => WINDOWS.map(
98126
- (window2) => `${window2} ${limits[window2] === null ? "none" : usd(limits[window2])}`
98283
+ var money3 = (value, currency2) => `${Number(value.toFixed(2))} ${currency2.toUpperCase()}`;
98284
+ var limitsLine = (limits, currency2) => WINDOWS.map(
98285
+ (window2) => `${window2} ${limits[window2] === null ? "none" : money3(limits[window2], currency2)}`
98127
98286
  ).join(", ");
98287
+ function policyLimitsOf(policy) {
98288
+ const { currency: currency2, chargedDefaultBudget, chargedCap } = policy;
98289
+ if (currency2 && chargedDefaultBudget && chargedCap) {
98290
+ return { currency: currency2, charged: true, defaultBudget: chargedDefaultBudget, cap: chargedCap };
98291
+ }
98292
+ return {
98293
+ currency: "usd",
98294
+ charged: false,
98295
+ defaultBudget: policy.defaultBudget,
98296
+ cap: policy.cap
98297
+ };
98298
+ }
98299
+ function agentLimitsOf(agent3) {
98300
+ if (agent3.currency && agent3.chargedBudget) {
98301
+ const spent = (line) => line.charged ?? line.usd;
98302
+ return { currency: agent3.currency, charged: true, budget: agent3.chargedBudget, spent };
98303
+ }
98304
+ return {
98305
+ currency: "usd",
98306
+ charged: false,
98307
+ budget: agent3.budget,
98308
+ spent: (line) => line.usd
98309
+ };
98310
+ }
98128
98311
  function limitsFrom({
98129
98312
  args,
98130
98313
  prefix,
@@ -98137,7 +98320,7 @@ function limitsFrom({
98137
98320
  if (!text3) continue;
98138
98321
  const value = text3 === "none" ? null : Number(text3);
98139
98322
  if (value !== null && (!Number.isFinite(value) || value < 0))
98140
- throw new CliUsageError(`--${prefix}${window2} takes an amount in USD or none.
98323
+ throw new CliUsageError(`--${prefix}${window2} takes an amount or none.
98141
98324
  ${USAGE15}`);
98142
98325
  next[window2] = value;
98143
98326
  changed = true;
@@ -98151,9 +98334,10 @@ function printPolicy(context, policy) {
98151
98334
  `);
98152
98335
  context.out(`Default level: ${LEVEL_LINES[policy.defaultLevel ?? "none"]}
98153
98336
  `);
98154
- context.out(`Default budget per agent: ${limitsLine(policy.defaultBudget)}
98337
+ const limits = policyLimitsOf(policy);
98338
+ context.out(`Default budget per agent: ${limitsLine(limits.defaultBudget, limits.currency)}
98155
98339
  `);
98156
- context.out(`Cap per agent: ${limitsLine(policy.cap)}
98340
+ context.out(`Cap per agent: ${limitsLine(limits.cap, limits.currency)}
98157
98341
  `);
98158
98342
  }
98159
98343
  async function showPolicy({ context, args }) {
@@ -98167,17 +98351,18 @@ async function setPolicy({ context, args }) {
98167
98351
  const state = args.words[2];
98168
98352
  if (state !== void 0 && state !== "on" && state !== "off") throw new CliUsageError(USAGE15);
98169
98353
  const { client } = await signedIn({ context, args });
98170
- const current3 = await client.get("/api/models/policy");
98354
+ const current3 = policyLimitsOf(await client.get("/api/models/policy"));
98171
98355
  const defaultBudget = limitsFrom({ args, prefix: "default-", current: current3.defaultBudget });
98172
98356
  const cap = limitsFrom({ args, prefix: "cap-", current: current3.cap });
98357
+ const names = current3.charged ? { defaultBudget: "chargedDefaultBudget", cap: "chargedCap" } : { defaultBudget: "defaultBudget", cap: "cap" };
98173
98358
  const defaultLevel = levelFrom({ args });
98174
98359
  if (!state && !defaultBudget && !cap && defaultLevel === void 0)
98175
98360
  throw new CliUsageError(USAGE15);
98176
98361
  const updated = await client.post("/api/models/policy", {
98177
98362
  ...state ? { lazeModels: state === "on" } : {},
98178
98363
  ...defaultLevel !== void 0 ? { defaultLevel } : {},
98179
- ...defaultBudget ? { defaultBudget } : {},
98180
- ...cap ? { cap } : {}
98364
+ ...defaultBudget ? { [names.defaultBudget]: defaultBudget } : {},
98365
+ ...cap ? { [names.cap]: cap } : {}
98181
98366
  });
98182
98367
  if (args.flags.json) return context.out(`${JSON.stringify(updated, null, 2)}
98183
98368
  `);
@@ -98187,9 +98372,10 @@ function printAgent(context, agent3) {
98187
98372
  const paused = agent3.pausedOn ? ` paused: ${agent3.pausedOn} budget reached` : "";
98188
98373
  context.out(`${agent3.agentName} ${agent3.agentId} ${agent3.status}${paused}
98189
98374
  `);
98190
- context.out(` budget: ${limitsLine(agent3.budget)}
98375
+ const limits = agentLimitsOf(agent3);
98376
+ context.out(` budget: ${limitsLine(limits.budget, limits.currency)}
98191
98377
  `);
98192
- const spent = agent3.spend.map((line) => `${line.window} ${usd(line.usd)}`).join(", ");
98378
+ const spent = agent3.spend.map((line) => `${line.window} ${money3(limits.spent(line), limits.currency)}`).join(", ");
98193
98379
  if (spent) context.out(` spent: ${spent}
98194
98380
  `);
98195
98381
  }
@@ -98217,11 +98403,12 @@ async function setBudget({ context, args }) {
98217
98403
  if (!name3) throw new CliUsageError(USAGE15);
98218
98404
  const { client } = await signedIn({ context, args });
98219
98405
  const agent3 = await agentNamed({ client, name: name3 });
98220
- const next = limitsFrom({ args, prefix: "", current: agent3.budget });
98406
+ const limits = agentLimitsOf(agent3);
98407
+ const next = limitsFrom({ args, prefix: "", current: limits.budget });
98221
98408
  if (!next) throw new CliUsageError(USAGE15);
98222
98409
  const updated = await client.post("/api/models/agents/budget", {
98223
98410
  agentId: agent3.agentId,
98224
- budget: next
98411
+ ...limits.charged ? { chargedBudget: next } : { budget: next }
98225
98412
  });
98226
98413
  if (args.flags.json) return context.out(`${JSON.stringify(updated, null, 2)}
98227
98414
  `);
@@ -98233,11 +98420,14 @@ async function showSpend({ context, args }) {
98233
98420
  if (args.flags.json) return context.out(`${JSON.stringify(summaries, null, 2)}
98234
98421
  `);
98235
98422
  for (const summary of summaries) {
98236
- context.out(`${summary.window} ${usd(summary.usd)}
98423
+ const charged = summary.currency !== void 0 && summary.charged !== void 0;
98424
+ const currency2 = charged ? summary.currency ?? "usd" : "usd";
98425
+ const amount = (line) => money3(charged ? line.charged ?? line.usd : line.usd, currency2);
98426
+ context.out(`${summary.window} ${amount(summary)}
98237
98427
  `);
98238
- for (const line of summary.byAgent) context.out(` agent ${line.id} ${usd(line.usd)}
98428
+ for (const line of summary.byAgent) context.out(` agent ${line.id} ${amount(line)}
98239
98429
  `);
98240
- for (const line of summary.byChannel) context.out(` channel ${line.id} ${usd(line.usd)}
98430
+ for (const line of summary.byChannel) context.out(` channel ${line.id} ${amount(line)}
98241
98431
  `);
98242
98432
  }
98243
98433
  }
@@ -100092,6 +100282,58 @@ var funnelOutputDefinition = external_exports.object({
100092
100282
  buckets: external_exports.array(external_exports.object({ at: external_exports.iso.datetime(), ...funnelCountsDefinition.shape })),
100093
100283
  totals: funnelCountsDefinition
100094
100284
  });
100285
+ var cohortInputDefinition = external_exports.object({
100286
+ from: external_exports.iso.datetime(),
100287
+ to: external_exports.iso.datetime(),
100288
+ limit: external_exports.number().int().min(1).max(100).default(25),
100289
+ cursor: cursorDefinition.optional()
100290
+ }).strict();
100291
+ var cohortOutputDefinition = external_exports.object({
100292
+ /** Read up to this time: every count runs from the workspace's creation to here. */
100293
+ until: external_exports.iso.datetime(),
100294
+ workspaces: pageOf(
100295
+ external_exports.object({
100296
+ workspaceId: external_exports.string(),
100297
+ createdAt: external_exports.iso.datetime(),
100298
+ /** The creator's first page and campaign tag, as their sign-up kept them. */
100299
+ landingPath: external_exports.string().nullable(),
100300
+ campaign: external_exports.string().nullable(),
100301
+ promotionId: external_exports.string().nullable(),
100302
+ plan: external_exports.string(),
100303
+ paying: external_exports.boolean(),
100304
+ members: count7,
100305
+ agents: external_exports.object({
100306
+ laze: count7,
100307
+ connected: count7,
100308
+ firstLazeAgentAt: external_exports.iso.datetime().nullable()
100309
+ }),
100310
+ turns: count7,
100311
+ appsCreated: count7,
100312
+ connectionsLinked: count7,
100313
+ creatorLastMessageAt: external_exports.iso.datetime().nullable(),
100314
+ /** Live messages per UTC day; days with none are left out. */
100315
+ days: external_exports.array(
100316
+ external_exports.object({
100317
+ day: external_exports.string(),
100318
+ byPeople: count7,
100319
+ byAgents: count7,
100320
+ people: count7
100321
+ })
100322
+ ),
100323
+ /** The once-only sends nurturing kept (first_agent_made, first_agent_nudge, ...). */
100324
+ lifecycle: external_exports.array(external_exports.object({ event: external_exports.string(), at: external_exports.iso.datetime() })),
100325
+ /** Mail sent to the creator since the workspace was made: template, state, times. */
100326
+ sentToCreator: external_exports.array(
100327
+ external_exports.object({
100328
+ template: external_exports.string(),
100329
+ state: external_exports.string(),
100330
+ sentAt: external_exports.iso.datetime(),
100331
+ updatedAt: external_exports.iso.datetime()
100332
+ })
100333
+ )
100334
+ })
100335
+ )
100336
+ });
100095
100337
  var noInputDefinition = external_exports.object({}).strict();
100096
100338
  var capacityOutputDefinition = external_exports.object({
100097
100339
  /** The pool now; null where the process runs no pool. */
@@ -100188,6 +100430,40 @@ var tenantAgentsDefinition = external_exports.object({
100188
100430
  })
100189
100431
  )
100190
100432
  });
100433
+ var tenantPeopleDefinition = external_exports.object({
100434
+ workspace: external_exports.object({
100435
+ id: external_exports.string(),
100436
+ name: external_exports.string(),
100437
+ createdByUserId: external_exports.string(),
100438
+ createdAt: external_exports.iso.datetime()
100439
+ }),
100440
+ members: external_exports.array(
100441
+ external_exports.object({
100442
+ userId: external_exports.string(),
100443
+ name: external_exports.string(),
100444
+ email: external_exports.string(),
100445
+ role: external_exports.string(),
100446
+ joinedAt: external_exports.iso.datetime()
100447
+ })
100448
+ ),
100449
+ /** Invitations not accepted yet, and who sent each. */
100450
+ invites: external_exports.array(
100451
+ external_exports.object({
100452
+ inviteId: external_exports.string(),
100453
+ email: external_exports.string(),
100454
+ role: external_exports.string(),
100455
+ status: external_exports.string(),
100456
+ invitedByUserId: external_exports.string(),
100457
+ createdAt: external_exports.iso.datetime(),
100458
+ expiresAt: external_exports.iso.datetime()
100459
+ })
100460
+ )
100461
+ });
100462
+ var creditPausedInputDefinition = external_exports.object({
100463
+ limit: external_exports.number().int().min(1).max(200).default(50),
100464
+ cursor: cursorDefinition.optional()
100465
+ }).strict();
100466
+ var creditPausedOutputDefinition = external_exports.object({ accounts: pageOf(creditPausedAccountSchema) });
100191
100467
  var tenantBillingDefinition = external_exports.object({
100192
100468
  plan: external_exports.string(),
100193
100469
  status: external_exports.string(),
@@ -100299,6 +100575,13 @@ var OPS_FUNCTIONS = {
100299
100575
  input: funnelInputDefinition,
100300
100576
  output: funnelOutputDefinition
100301
100577
  }),
100578
+ "signups.cohort": entry({
100579
+ title: "Each workspace made in a range: source, promotion, agents, messages per day and lifecycle mail",
100580
+ scope: "platform",
100581
+ view: "table",
100582
+ input: cohortInputDefinition,
100583
+ output: cohortOutputDefinition
100584
+ }),
100302
100585
  "computers.capacity": entry({
100303
100586
  title: "Computer pool capacity and host load",
100304
100587
  scope: "platform",
@@ -100341,6 +100624,21 @@ var OPS_FUNCTIONS = {
100341
100624
  input: noInputDefinition,
100342
100625
  output: tenantAgentsDefinition
100343
100626
  }),
100627
+ "tenant.logins": entry({
100628
+ title: "One workspace's Claude Code and Codex logins, pools and what each agent runs on",
100629
+ scope: "tenant",
100630
+ view: "table",
100631
+ input: noInputDefinition,
100632
+ output: loginStatesSchema
100633
+ }),
100634
+ "tenant.people": entry({
100635
+ title: "One workspace's people: members' names, emails and join times, and pending invites",
100636
+ scope: "tenant",
100637
+ view: "table",
100638
+ input: noInputDefinition,
100639
+ output: tenantPeopleDefinition,
100640
+ personal: true
100641
+ }),
100344
100642
  "tenant.billing": entry({
100345
100643
  title: "One workspace's plan, credits, auto-recharge, spend by agent and invoices",
100346
100644
  scope: "tenant",
@@ -100348,6 +100646,13 @@ var OPS_FUNCTIONS = {
100348
100646
  input: noInputDefinition,
100349
100647
  output: tenantBillingDefinition
100350
100648
  }),
100649
+ "billing.credit_paused": entry({
100650
+ title: "Workspaces whose Laze-hosted work is paused for credits now, with card and plan",
100651
+ scope: "platform",
100652
+ view: "table",
100653
+ input: creditPausedInputDefinition,
100654
+ output: creditPausedOutputDefinition
100655
+ }),
100351
100656
  "tenant.vault": entry({
100352
100657
  title: "One workspace's vault setup: judge, level limits and connections waiting",
100353
100658
  scope: "tenant",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazehq/cli",
3
- "version": "0.1.110",
3
+ "version": "0.1.111",
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",