@lazehq/cli 0.1.60 → 0.1.61

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 +667 -794
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -35647,7 +35647,7 @@ function differenceInCalendarDays(later, earlier, options) {
35647
35647
  // src/config.ts
35648
35648
  import { homedir } from "node:os";
35649
35649
  import { join } from "node:path";
35650
- var DEFAULT_LAZE_URL = "https://laze.langwatch.ai";
35650
+ var DEFAULT_LAZE_URL = "https://laze.so";
35651
35651
  function harnessOf({
35652
35652
  env
35653
35653
  }) {
@@ -35883,7 +35883,7 @@ function flagText({
35883
35883
  }
35884
35884
 
35885
35885
  // src/rules/cli-version.rules.ts
35886
- var STAMPED = "0.1.60";
35886
+ var STAMPED = "0.1.61";
35887
35887
  function cliVersionOf({ stamped = STAMPED } = {}) {
35888
35888
  return stamped.startsWith("__") ? "dev" : stamped;
35889
35889
  }
@@ -57737,6 +57737,7 @@ var FEATURE_NAMES = [
57737
57737
  "compute",
57738
57738
  "connector",
57739
57739
  "discord",
57740
+ "download",
57740
57741
  "entitlement",
57741
57742
  "external-connection",
57742
57743
  "feature-flag",
@@ -58092,6 +58093,216 @@ var apiKeyMachineAlertSettledPayloadSchemaDefinition = external_exports.object({
58092
58093
  at: external_exports.iso.datetime()
58093
58094
  });
58094
58095
 
58096
+ // ../../packages/config/src/config.ts
58097
+ var ConfigLeaf = class {
58098
+ constructor(env, schema) {
58099
+ this.env = env;
58100
+ this.schema = schema;
58101
+ }
58102
+ env;
58103
+ schema;
58104
+ };
58105
+ var definer = {
58106
+ env: (env, schema) => new ConfigLeaf(env, schema)
58107
+ };
58108
+ var Config = {
58109
+ define(build) {
58110
+ return build(definer);
58111
+ }
58112
+ };
58113
+
58114
+ // ../../packages/config/src/env-schemas.ts
58115
+ var nodeEnvironmentSchema = external_exports.enum(["development", "test", "production"]);
58116
+ var environmentBooleanSchema = external_exports.union([external_exports.boolean(), external_exports.literal("true"), external_exports.literal("false"), external_exports.literal("1"), external_exports.literal("0")]).transform((value) => value === true || value === "true" || value === "1");
58117
+ var environmentExactOnSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value === true || value === "on");
58118
+ var environmentNotExactOffSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value !== false && value !== "off");
58119
+ var environmentOneOrTrueSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform(
58120
+ (value) => value === true || typeof value === "string" && (value === "1" || value.toLowerCase() === "true")
58121
+ );
58122
+ var environmentPresenceSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value === true || typeof value === "string" && value.length > 0);
58123
+ var environmentExactOneSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value === true || value === "1");
58124
+ var environmentNotExactOneSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value !== "1");
58125
+ var environmentLegacyTruthySchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform(
58126
+ (value) => value === true || typeof value === "string" && /^(1|true|yes)$/i.test(value)
58127
+ );
58128
+
58129
+ // ../../packages/config/src/deployment-facts.ts
58130
+ var positiveInteger = external_exports.coerce.number().int().positive();
58131
+ var optionalSetting = external_exports.preprocess(
58132
+ (value) => value === "" ? void 0 : value,
58133
+ external_exports.string().min(1).optional()
58134
+ );
58135
+ var { logSettings } = Config.define((c) => ({
58136
+ logSettings: {
58137
+ LOG_LEVEL: c.env("LOG_LEVEL", optionalSetting),
58138
+ LOG_CONSOLE_LEVEL: c.env("LOG_CONSOLE_LEVEL", optionalSetting),
58139
+ LOG_OTEL_LEVEL: c.env("LOG_OTEL_LEVEL", optionalSetting),
58140
+ LOG_FORMAT: c.env("LOG_FORMAT", external_exports.enum(["pretty", "json"]).optional()),
58141
+ PINO_LOG_LEVEL: c.env("PINO_LOG_LEVEL", optionalSetting),
58142
+ _LOG_LEVEL: c.env("_LOG_LEVEL", optionalSetting),
58143
+ PINO_CONSOLE_LEVEL: c.env("PINO_CONSOLE_LEVEL", optionalSetting),
58144
+ PINO_OTEL_LEVEL: c.env("PINO_OTEL_LEVEL", optionalSetting)
58145
+ }
58146
+ }));
58147
+ var { isSaas } = Config.define((c) => ({
58148
+ isSaas: c.env("IS_SAAS", environmentOneOrTrueSchema)
58149
+ }));
58150
+ var { nodeEnvironment } = Config.define((c) => ({
58151
+ nodeEnvironment: c.env("NODE_ENV", external_exports.string().optional())
58152
+ }));
58153
+ var { rawSocketPort } = Config.define((c) => ({
58154
+ rawSocketPort: c.env("VOICE_WS_PORT", external_exports.coerce.number().int().min(0).max(65535).default(3300))
58155
+ }));
58156
+ var { outboundProxy } = Config.define((c) => ({
58157
+ outboundProxy: {
58158
+ HTTPS_PROXY: c.env("HTTPS_PROXY", external_exports.string().optional()),
58159
+ https_proxy: c.env("https_proxy", external_exports.string().optional()),
58160
+ HTTP_PROXY: c.env("HTTP_PROXY", external_exports.string().optional()),
58161
+ http_proxy: c.env("http_proxy", external_exports.string().optional()),
58162
+ NO_PROXY: c.env("NO_PROXY", external_exports.string().optional()),
58163
+ no_proxy: c.env("no_proxy", external_exports.string().optional())
58164
+ }
58165
+ }));
58166
+ var { blockLocalHttpCalls, allowedProxyHosts } = Config.define((c) => ({
58167
+ blockLocalHttpCalls: c.env("BLOCK_LOCAL_HTTP_CALLS", environmentOneOrTrueSchema),
58168
+ /** An unset allowlist is EMPTY, never a wildcard. */
58169
+ allowedProxyHosts: c.env(
58170
+ "ALLOWED_PROXY_HOSTS",
58171
+ external_exports.string().optional().transform(
58172
+ (value) => (value ?? "").split(",").map((host2) => host2.trim()).filter((host2) => host2.length > 0)
58173
+ )
58174
+ )
58175
+ }));
58176
+ var { telemetryExporterEndpoint } = Config.define((c) => ({
58177
+ telemetryExporterEndpoint: c.env(
58178
+ "OTEL_EXPORTER_OTLP_ENDPOINT",
58179
+ external_exports.preprocess((value) => value === "" ? void 0 : value, external_exports.string().min(1).optional())
58180
+ )
58181
+ }));
58182
+ var { publicBaseUrl } = Config.define((c) => ({
58183
+ publicBaseUrl: c.env(
58184
+ "BASE_HOST",
58185
+ external_exports.string().optional().transform((value) => value?.trim() || void 0)
58186
+ )
58187
+ }));
58188
+ var { publicOriginAliases } = Config.define((c) => ({
58189
+ publicOriginAliases: c.env(
58190
+ "BASE_HOST_ALIASES",
58191
+ external_exports.string().optional().transform((value) => originsOf({ list: value ?? "" }))
58192
+ )
58193
+ }));
58194
+ function originsOf({ list: list11 }) {
58195
+ const origins = list11.split(",").map((entry) => entry.trim()).filter((entry) => URL.canParse(entry)).map((entry) => new URL(entry)).filter((url2) => url2.protocol === "https:" || url2.protocol === "http:").map((url2) => url2.origin);
58196
+ return [...new Set(origins)];
58197
+ }
58198
+ var { appsDomain } = Config.define((c) => ({
58199
+ appsDomain: c.env("APPS_DOMAIN", external_exports.string().min(1).default("lazeapps.com"))
58200
+ }));
58201
+ var optionalNonBlank = external_exports.preprocess(
58202
+ (value) => value === "" ? void 0 : value,
58203
+ external_exports.string().min(1).optional()
58204
+ );
58205
+ var { grafana } = Config.define((c) => ({
58206
+ grafana: {
58207
+ baseUrl: c.env("GRAFANA_BASE_URL", optionalNonBlank),
58208
+ tempoDatasourceUid: c.env("GRAFANA_TEMPO_DATASOURCE_UID", optionalNonBlank),
58209
+ lokiDatasourceUid: c.env("GRAFANA_LOKI_DATASOURCE_UID", optionalNonBlank)
58210
+ }
58211
+ }));
58212
+ var { serviceVersion, otelResourceAttributes } = Config.define((c) => ({
58213
+ serviceVersion: c.env("SERVICE_VERSION", optionalNonBlank),
58214
+ otelResourceAttributes: c.env("OTEL_RESOURCE_ATTRIBUTES", optionalNonBlank)
58215
+ }));
58216
+ var { lazeDefaultModel } = Config.define((c) => ({
58217
+ lazeDefaultModel: c.env(
58218
+ "LAZE_DEFAULT_MODEL",
58219
+ external_exports.string().optional().transform((value) => value?.trim() || void 0)
58220
+ )
58221
+ }));
58222
+ var { gatewayPublicUrl, gatewayInternalUrl, gatewayLegacyUrl } = Config.define((c) => ({
58223
+ gatewayPublicUrl: c.env("LW_GATEWAY_PUBLIC_URL", external_exports.string().optional()),
58224
+ gatewayInternalUrl: c.env("LW_GATEWAY_INTERNAL_URL", external_exports.string().optional()),
58225
+ gatewayLegacyUrl: c.env("LW_GATEWAY_BASE_URL", external_exports.string().optional())
58226
+ }));
58227
+ var publicProviderField = external_exports.string().min(1).optional();
58228
+ var signInProviders = Config.define((c) => ({
58229
+ authProvider: c.env("AUTH_PROVIDER", publicProviderField),
58230
+ /** The NextAuth-era name for `AUTH_PROVIDER`: deprecated, still applied. */
58231
+ legacyProvider: c.env("NEXTAUTH_PROVIDER", publicProviderField),
58232
+ googleClientId: c.env("GOOGLE_CLIENT_ID", publicProviderField),
58233
+ githubClientId: c.env("GITHUB_CLIENT_ID", publicProviderField),
58234
+ gitlabClientId: c.env("GITLAB_CLIENT_ID", publicProviderField),
58235
+ azureAdClientId: c.env("AZURE_AD_CLIENT_ID", publicProviderField),
58236
+ azureAdTenantId: c.env("AZURE_AD_TENANT_ID", publicProviderField),
58237
+ auth0ClientId: c.env("AUTH0_CLIENT_ID", publicProviderField),
58238
+ auth0Issuer: c.env("AUTH0_ISSUER", publicProviderField),
58239
+ oktaClientId: c.env("OKTA_CLIENT_ID", publicProviderField),
58240
+ oktaIssuer: c.env("OKTA_ISSUER", publicProviderField),
58241
+ cognitoClientId: c.env("COGNITO_CLIENT_ID", publicProviderField),
58242
+ cognitoIssuer: c.env("COGNITO_ISSUER", publicProviderField),
58243
+ oneLoginClientId: c.env("ONELOGIN_CLIENT_ID", publicProviderField),
58244
+ oneLoginIssuer: c.env("ONELOGIN_ISSUER", publicProviderField),
58245
+ oidcClientId: c.env("OIDC_CLIENT_ID", publicProviderField),
58246
+ oidcIssuer: c.env("OIDC_ISSUER", publicProviderField)
58247
+ }));
58248
+ var { adminEmails } = Config.define((c) => ({
58249
+ adminEmails: c.env(
58250
+ "ADMIN_EMAILS",
58251
+ external_exports.string().optional().transform(
58252
+ (raw) => (raw ?? "").split(",").map((email3) => email3.trim()).filter((email3) => email3.length > 0)
58253
+ )
58254
+ )
58255
+ }));
58256
+ var { signUpMode, signUpAllowedDomains } = Config.define((c) => ({
58257
+ /** `open` admits anybody who reaches the installation; `invite_only` admits invited addresses. */
58258
+ signUpMode: c.env(
58259
+ "SIGN_UP_MODE",
58260
+ external_exports.preprocess(
58261
+ (value) => value === "" ? void 0 : value,
58262
+ external_exports.enum(["open", "invite_only"]).default("open")
58263
+ )
58264
+ ),
58265
+ /** Lowercased domains without a leading `@`; empty admits any domain. */
58266
+ signUpAllowedDomains: c.env(
58267
+ "SIGN_UP_ALLOWED_DOMAINS",
58268
+ external_exports.string().optional().transform(
58269
+ (raw) => (raw ?? "").split(",").map((domain2) => domain2.trim().toLowerCase().replace(/^@/, "")).filter((domain2) => domain2.length > 0)
58270
+ )
58271
+ )
58272
+ }));
58273
+ var { passkeysEnabled, mfaEnrollmentOpen, localPasswords } = Config.define((c) => ({
58274
+ passkeysEnabled: c.env("PASSKEYS_ENABLED", environmentNotExactOffSchema),
58275
+ mfaEnrollmentOpen: c.env("MFA_ENROLLMENT_OPEN", environmentExactOnSchema),
58276
+ localPasswords: c.env("LOCAL_PASSWORDS_ENABLED", environmentExactOnSchema)
58277
+ }));
58278
+ var { trustedIdpOrigins, idpSimulatorUrl } = Config.define((c) => ({
58279
+ trustedIdpOrigins: c.env("SSO_TRUSTED_IDP_ORIGINS", external_exports.string().optional()),
58280
+ idpSimulatorUrl: c.env("LAZE_IDPSIM_URL", external_exports.string().optional())
58281
+ }));
58282
+ var { posthogKey, posthogHost } = Config.define((c) => ({
58283
+ posthogKey: c.env("POSTHOG_KEY", external_exports.string().optional()),
58284
+ posthogHost: c.env("POSTHOG_HOST", external_exports.string().optional())
58285
+ }));
58286
+ var { foldCacheTtlSeconds } = Config.define((c) => ({
58287
+ foldCacheTtlSeconds: c.env("LAZE_FOLD_CACHE_TTL_SECONDS", positiveInteger.default(300))
58288
+ }));
58289
+ var { slackApiBase, slackWebhookBase } = Config.define((c) => ({
58290
+ slackApiBase: c.env("SLACK_API_BASE", external_exports.string().url().default("https://slack.com/api")),
58291
+ slackWebhookBase: c.env(
58292
+ "SLACK_WEBHOOK_BASE",
58293
+ external_exports.string().url().default("https://hooks.slack.com")
58294
+ )
58295
+ }));
58296
+ var { allowInsecureLocalUrls } = Config.define((c) => ({
58297
+ allowInsecureLocalUrls: c.env(
58298
+ "WEBHOOKS_UNSAFE_ALLOW_LOCAL_URLS",
58299
+ external_exports.union([external_exports.boolean(), external_exports.literal("1"), external_exports.literal("0"), external_exports.literal("")]).optional().transform((value) => value === true || value === "1")
58300
+ )
58301
+ }));
58302
+
58303
+ // ../../modules/api-key/contract/src/api-key.config.ts
58304
+ var apiKeyConfig = Config.define(() => ({ publicBaseUrl }));
58305
+
58095
58306
  // ../../modules/chat/contract/src/chat.emoji.ts
58096
58307
  var CUSTOM_EMOJI_MAX_BYTES = 256 * 1024;
58097
58308
  var CUSTOM_EMOJI_UPLOAD_MAX_BYTES = 5 * 1024 * 1024;
@@ -58296,6 +58507,41 @@ var messageLayoutSchemaDefinition = external_exports.object({
58296
58507
  });
58297
58508
  var messageLayoutSchema = messageLayoutSchemaDefinition;
58298
58509
 
58510
+ // ../../modules/chat/contract/src/chat.possible-secrets.ts
58511
+ var possibleSecretInputSchemaDefinition = external_exports.object({
58512
+ workspaceId: external_exports.string().min(1),
58513
+ messageId: external_exports.string().min(1),
58514
+ /** The `{{vault:<name>}}` the message shows: `possible-<vendor>-<8 hex>`. */
58515
+ name: external_exports.string().regex(/^possible-[a-z0-9-]+-[0-9a-f]{8}$/)
58516
+ });
58517
+ var possibleSecretInputSchema = possibleSecretInputSchemaDefinition;
58518
+ var possibleSecretSchemaDefinition = external_exports.object({
58519
+ name: external_exports.string(),
58520
+ messageId: external_exports.string(),
58521
+ channelId: external_exports.string(),
58522
+ /** The kind the detector took it for, as people say it: "OpenAI key", "Secret key". */
58523
+ kindLabel: external_exports.string(),
58524
+ /** The variable name a save suggests, such as OPENAI_API_KEY. */
58525
+ field: external_exports.string(),
58526
+ poster: external_exports.object({
58527
+ kind: external_exports.enum(["person", "agent", "external"]),
58528
+ id: external_exports.string(),
58529
+ /** The name the source gave, for a mirrored message; null for a Laze author. */
58530
+ sourceName: external_exports.string().nullable()
58531
+ }),
58532
+ /** Where it was posted, in words: "#ops, mirrored from Slack (ACME)". */
58533
+ where: external_exports.string(),
58534
+ /** slack, discord, whatsapp_business or laze when a mirror brought the message in. */
58535
+ source: external_exports.string().nullable(),
58536
+ unmasked: external_exports.boolean(),
58537
+ /** The reader may say it is not a secret: the poster, or anyone for a mirrored message. */
58538
+ mayUnmask: external_exports.boolean()
58539
+ });
58540
+ var possibleSecretSchema = possibleSecretSchemaDefinition;
58541
+ var possibleSecretValueSchemaDefinition = external_exports.object({ value: external_exports.string() });
58542
+ var possibleSecretValueSchema = possibleSecretValueSchemaDefinition;
58543
+ var chatPossibleSecretsTrpc = defineTrpcContract("chat").query("possibleSecret").withInput(possibleSecretInputSchema).withOutput(possibleSecretSchema).mutation("revealPossibleSecret").withInput(possibleSecretInputSchema).withOutput(possibleSecretValueSchema).mutation("unmaskPossibleSecret").withInput(possibleSecretInputSchema).withOutput(external_exports.object({ unmasked: external_exports.boolean() })).build();
58544
+
58299
58545
  // ../../modules/chat/contract/src/chat.presence.ts
58300
58546
  var STATUS_TEXT_MAX = 100;
58301
58547
  var idSchema = external_exports.string().min(1).max(64);
@@ -59298,7 +59544,7 @@ var postMirroredInputSchemaDefinition = external_exports.object({
59298
59544
  channelId: idSchema4,
59299
59545
  /** The Laze person behind the outside account when linked; else the outside author. */
59300
59546
  author: messageAuthorSchemaDefinition,
59301
- /** Whose vault holds a key in the text: the linked author, else whoever mirrored the channel. */
59547
+ /** The Laze person the mirror acts for: the linked author, else whoever mirrored the channel. */
59302
59548
  keyOwnerUserId: idSchema4,
59303
59549
  origin: messageOriginSchemaDefinition,
59304
59550
  body: external_exports.string().max(MESSAGE_BODY_MAX),
@@ -59314,7 +59560,7 @@ var postMirroredInputSchemaDefinition = external_exports.object({
59314
59560
  var updateMirroredInputSchemaDefinition = external_exports.object({
59315
59561
  workspaceId: workspaceIdSchema,
59316
59562
  messageId: idSchema4,
59317
- /** Whose vault holds a key in the new text: the linked author, else whoever mirrored it. */
59563
+ /** The Laze person the mirror acts for: the linked author, else whoever mirrored it. */
59318
59564
  keyOwnerUserId: idSchema4,
59319
59565
  body: external_exports.string().max(MESSAGE_BODY_MAX).optional(),
59320
59566
  /** The source's blocks and attachments now; null drops them; left out keeps them. */
@@ -59908,7 +60154,7 @@ var joinedChannelSchemaDefinition = external_exports.object({
59908
60154
  var ChatApi = moduleApi()("chat");
59909
60155
  var chatConversationsTrpc = defineTrpcContract("chat").query("overview").withInput(workspaceInputSchema).withOutput(chatOverviewSchema).query("unreadSummary").withInput(external_exports.object({})).withOutput(external_exports.array(workspaceUnreadSchema)).query("browse").withInput(workspaceInputSchema).withOutput(external_exports.array(browsableChannelSchema)).mutation("createChannel").withInput(createChannelInputSchema).withOutput(conversationSchema).mutation("join").withInput(channelInputSchema).withOutput(conversationSchema).mutation("leave").withInput(channelInputSchema).withOutput(external_exports.object({ left: external_exports.literal(true) })).mutation("updateChannel").withInput(updateChannelInputSchema).withOutput(conversationSchema).mutation("setDefaultAgent").withInput(setDefaultAgentInputSchema).withOutput(conversationSchema).query("logChannelHint").withInput(channelInputSchema).withOutput(logChannelHintSchema).mutation("dismissLogChannelHint").withInput(channelInputSchema).withOutput(external_exports.object({ dismissed: external_exports.literal(true) })).query("externalNotice").withInput(channelInputSchema).withOutput(externalNoticeSchema).mutation("dismissExternalNotice").withInput(dismissExternalNoticeInputSchema).withOutput(externalNoticeSchema).mutation("archiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("unarchiveChannel").withInput(channelInputSchema).withOutput(conversationSchema).mutation("addMembers").withInput(addMembersInputSchema).withOutput(conversationSchema).mutation("removeMember").withInput(removeMemberInputSchema).withOutput(conversationSchema).mutation("openDirect").withInput(openDirectInputSchema).withOutput(conversationSchema).query("conversation").withInput(channelInputSchema).withOutput(conversationSchema).build();
59910
60156
  var chatChannelRolesTrpc = defineTrpcContract("chat").mutation("setChannelRole").withInput(setChannelRoleInputSchema).withOutput(conversationSchema).mutation("extendChannel").withInput(extendChannelInputSchema).withOutput(conversationSchema).build();
59911
- var chatMessagesTrpc = defineTrpcContract("chat").query("history").withInput(historyInputSchema).withOutput(historyPageSchema).query("thread").withInput(messageInputSchema).withOutput(threadSchema).mutation("post").withInput(postMessageInputSchema).withOutput(messageSchema).mutation("forward").withInput(forwardMessageInputSchema).withOutput(messageSchema).mutation("addMentioned").withInput(addMentionedInputSchema).withOutput(messageSchema).mutation("edit").withInput(editMessageInputSchema).withOutput(messageSchema).mutation("delete").withInput(messageInputSchema).withOutput(messageSchema).mutation("remove").withInput(messageInputSchema).withOutput(messageSchema).mutation("react").withInput(reactInputSchema).withOutput(messageSchema).mutation("signalTyping").withInput(signalTypingInputSchema).withOutput(external_exports.object({ sent: external_exports.literal(true) })).mutation("markRead").withInput(markReadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).mutation("markUnread").withInput(markUnreadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).query("search").withInput(searchInputSchema).withOutput(searchResultSchema).build();
60157
+ var chatMessagesTrpc = defineTrpcContract("chat").query("history").withInput(historyInputSchema).withOutput(historyPageSchema).query("thread").withInput(messageInputSchema).withOutput(threadSchema).query("message").withInput(messageInputSchema).withOutput(messageSchema).mutation("post").withInput(postMessageInputSchema).withOutput(messageSchema).mutation("forward").withInput(forwardMessageInputSchema).withOutput(messageSchema).mutation("addMentioned").withInput(addMentionedInputSchema).withOutput(messageSchema).mutation("edit").withInput(editMessageInputSchema).withOutput(messageSchema).mutation("delete").withInput(messageInputSchema).withOutput(messageSchema).mutation("remove").withInput(messageInputSchema).withOutput(messageSchema).mutation("react").withInput(reactInputSchema).withOutput(messageSchema).mutation("signalTyping").withInput(signalTypingInputSchema).withOutput(external_exports.object({ sent: external_exports.literal(true) })).mutation("markRead").withInput(markReadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).mutation("markUnread").withInput(markUnreadInputSchema).withOutput(external_exports.object({ lastReadSeq: external_exports.number().int().nonnegative() })).query("search").withInput(searchInputSchema).withOutput(searchResultSchema).build();
59912
60158
  var chatFilesTrpc = defineTrpcContract("chat").mutation("startUpload").withInput(startUploadInputSchema).withOutput(uploadTicketSchema).mutation("completeUpload").withInput(completeUploadInputSchema).withOutput(attachmentSchema).mutation("abortUpload").withInput(fileInputSchema).withOutput(external_exports.object({ aborted: external_exports.literal(true) })).query("fileLink").withInput(fileLinkInputSchema).withOutput(fileLinkSchema).query("channelFiles").withInput(channelFilesInputSchema).withOutput(channelFilesSchema).mutation("renameAttachment").withInput(renameAttachmentInputSchema).withOutput(attachmentSchema).mutation("hideUnfurl").withInput(hideUnfurlInputSchema).withOutput(messageSchema).query("unfurlImage").withInput(unfurlImageInputSchema).withOutput(fileLinkSchema).query("searchGifs").withInput(searchGifsInputSchema).withOutput(gifResultsSchema).build();
59913
60159
  var chatFollowingTrpc = defineTrpcContract("chat").mutation("setNotify").withInput(setNotifyInputSchema).withOutput(conversationSummarySchema).mutation("hideConversation").withInput(channelInputSchema).withOutput(external_exports.object({ hidden: external_exports.literal(true) })).mutation("followThread").withInput(followThreadInputSchema).withOutput(threadFollowSchema).query("threadFollow").withInput(messageInputSchema).withOutput(threadFollowSchema).query("threads").withInput(threadsInputSchema).withOutput(threadsPageSchema).query("threadsUnread").withInput(workspaceInputSchema).withOutput(threadsUnreadSchema).query("notificationCount").withInput(workspaceInputSchema).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).mutation("markThreadRead").withInput(messageInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).mutation("pin").withInput(pinMessageInputSchema).withOutput(messageSchema).query("pins").withInput(channelInputSchema).withOutput(pinsPageSchema).query("saved").withInput(savedInputSchema).withOutput(savedPageSchema).query("savedMarks").withInput(workspaceInputSchema).withOutput(savedMarksSchema).mutation("saveMessage").withInput(saveMessageInputSchema).withOutput(savedStatusSchema).mutation("markSavedDone").withInput(markSavedDoneInputSchema).withOutput(savedStatusSchema).mutation("setReminder").withInput(setReminderInputSchema).withOutput(savedStatusSchema).query("activity").withInput(activityInputSchema).withOutput(activityPageSchema).mutation("markActivityRead").withInput(markActivityReadInputSchema).withOutput(external_exports.object({ read: external_exports.literal(true) })).build();
59914
60160
  var chatSessionTrpc = defineTrpcContract("chat").mutation("realtimeToken").withInput(workspaceInputSchema).withOutput(realtimeTokenSchema).query("drafts").withInput(workspaceInputSchema).withOutput(draftListSchema).mutation("saveDraft").withInput(saveDraftInputSchema).withOutput(draftSavedSchema).mutation("deleteDraft").withInput(deleteDraftInputSchema).withOutput(draftSavedSchema).query("sent").withInput(listSentInputSchema).withOutput(sentPageSchema).query("sidebarLayout").withInput(workspaceInputSchema).withOutput(sidebarLayoutSchema).mutation("editSidebar").withInput(editSidebarInputSchema).withOutput(sidebarLayoutSchema).mutation("star").withInput(starInputSchema).withOutput(starStatusSchema).query("starred").withInput(workspaceInputSchema).withOutput(starredListSchema).mutation("scrubSecrets").withInput(scrubChatInputSchema).withOutput(chatScrubReportSchema).mutation("restoreScrubbed").withInput(messageInputSchema).withOutput(messageSchema).build();
@@ -59924,7 +60170,8 @@ var chatTrpc = joinTrpcContracts(
59924
60170
  chatFollowingTrpc,
59925
60171
  chatSessionTrpc,
59926
60172
  chatScheduledTrpc,
59927
- chatPresenceTrpc
60173
+ chatPresenceTrpc,
60174
+ chatPossibleSecretsTrpc
59928
60175
  );
59929
60176
 
59930
60177
  // ../../modules/notification/contract/src/apns.ts
@@ -59972,7 +60219,17 @@ var apnsPayloadSchemaDefinition = external_exports.object({
59972
60219
  link: external_exports.string().startsWith("laze://").max(2048).optional(),
59973
60220
  /** The message's place in its conversation, so a later clear can match it. */
59974
60221
  seq: external_exports.number().int().nonnegative().optional(),
59975
- clear: external_exports.object({ threadId: external_exports.string().min(1).max(200), upToSeq: external_exports.number().int().nonnegative() }).strict().optional()
60222
+ clear: external_exports.object({ threadId: external_exports.string().min(1).max(200), upToSeq: external_exports.number().int().nonnegative() }).strict().optional(),
60223
+ /** Absent on an alert; "read" on the silent push a read sends. */
60224
+ type: external_exports.literal("read").optional(),
60225
+ /** The conversation an alert tells of, or a read push covers. */
60226
+ conversationId: external_exports.string().min(1).max(200).optional(),
60227
+ /** The thread's root message, when the alert or the read is in a thread. */
60228
+ threadRootId: external_exports.string().min(1).max(200).optional(),
60229
+ /** A read push: everything in the conversation (or thread) up to this seq is read. */
60230
+ readUpToSeq: external_exports.number().int().nonnegative().optional(),
60231
+ /** A read push: the person's Notifications total, the number alert pushes carry. */
60232
+ badge: external_exports.number().int().nonnegative().optional()
59976
60233
  }).strict();
59977
60234
 
59978
60235
  // ../../modules/notification/contract/src/web-push.ts
@@ -60060,6 +60317,13 @@ var emailMessageSchemaDefinition = external_exports.discriminatedUnion("template
60060
60317
  lines: external_exports.array(external_exports.string()).min(1),
60061
60318
  action: external_exports.string().min(1)
60062
60319
  }),
60320
+ /** A Laze app a person waited for is out; `url` is its store page. */
60321
+ external_exports.object({
60322
+ template: external_exports.literal("appAvailable"),
60323
+ to: external_exports.email(),
60324
+ url: external_exports.url(),
60325
+ platformName: external_exports.string().min(1).max(40)
60326
+ }),
60063
60327
  /** An app's own end user signs in: sent from the app's name, replies go to `replyTo`. */
60064
60328
  external_exports.object({
60065
60329
  template: external_exports.literal("appUserCode"),
@@ -60308,213 +60572,6 @@ var notificationTrpc = defineTrpcContract("notification").query("settings").with
60308
60572
  })
60309
60573
  ).withOutput(external_exports.object({ subscribed: external_exports.literal(true) })).mutation("unsubscribeWebPush").withInput(external_exports.object({ workspaceId: workspaceIdSchema2, endpoint: external_exports.string().min(1).max(2048) })).withOutput(external_exports.object({ unsubscribed: external_exports.literal(true) })).query("apnsStatus").withInput(workspaceInputSchema2).withOutput(apnsStatusSchema).mutation("registerApnsDevice").withInput(registerApnsDeviceInputSchema).withOutput(external_exports.object({ registered: external_exports.literal(true) })).mutation("unregisterApnsDevice").withInput(unregisterApnsDeviceInputSchema).withOutput(external_exports.object({ unregistered: external_exports.literal(true) })).build();
60310
60574
 
60311
- // ../../packages/config/src/config.ts
60312
- var ConfigLeaf = class {
60313
- constructor(env, schema) {
60314
- this.env = env;
60315
- this.schema = schema;
60316
- }
60317
- env;
60318
- schema;
60319
- };
60320
- var definer = {
60321
- env: (env, schema) => new ConfigLeaf(env, schema)
60322
- };
60323
- var Config = {
60324
- define(build) {
60325
- return build(definer);
60326
- }
60327
- };
60328
-
60329
- // ../../packages/config/src/env-schemas.ts
60330
- var nodeEnvironmentSchema = external_exports.enum(["development", "test", "production"]);
60331
- var environmentBooleanSchema = external_exports.union([external_exports.boolean(), external_exports.literal("true"), external_exports.literal("false"), external_exports.literal("1"), external_exports.literal("0")]).transform((value) => value === true || value === "true" || value === "1");
60332
- var environmentExactOnSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value === true || value === "on");
60333
- var environmentNotExactOffSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value !== false && value !== "off");
60334
- var environmentOneOrTrueSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform(
60335
- (value) => value === true || typeof value === "string" && (value === "1" || value.toLowerCase() === "true")
60336
- );
60337
- var environmentPresenceSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value === true || typeof value === "string" && value.length > 0);
60338
- var environmentExactOneSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value === true || value === "1");
60339
- var environmentNotExactOneSchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform((value) => value !== "1");
60340
- var environmentLegacyTruthySchema = external_exports.union([external_exports.string(), external_exports.boolean()]).optional().transform(
60341
- (value) => value === true || typeof value === "string" && /^(1|true|yes)$/i.test(value)
60342
- );
60343
-
60344
- // ../../packages/config/src/deployment-facts.ts
60345
- var positiveInteger = external_exports.coerce.number().int().positive();
60346
- var optionalSetting = external_exports.preprocess(
60347
- (value) => value === "" ? void 0 : value,
60348
- external_exports.string().min(1).optional()
60349
- );
60350
- var { logSettings } = Config.define((c) => ({
60351
- logSettings: {
60352
- LOG_LEVEL: c.env("LOG_LEVEL", optionalSetting),
60353
- LOG_CONSOLE_LEVEL: c.env("LOG_CONSOLE_LEVEL", optionalSetting),
60354
- LOG_OTEL_LEVEL: c.env("LOG_OTEL_LEVEL", optionalSetting),
60355
- LOG_FORMAT: c.env("LOG_FORMAT", external_exports.enum(["pretty", "json"]).optional()),
60356
- PINO_LOG_LEVEL: c.env("PINO_LOG_LEVEL", optionalSetting),
60357
- _LOG_LEVEL: c.env("_LOG_LEVEL", optionalSetting),
60358
- PINO_CONSOLE_LEVEL: c.env("PINO_CONSOLE_LEVEL", optionalSetting),
60359
- PINO_OTEL_LEVEL: c.env("PINO_OTEL_LEVEL", optionalSetting)
60360
- }
60361
- }));
60362
- var { isSaas } = Config.define((c) => ({
60363
- isSaas: c.env("IS_SAAS", environmentOneOrTrueSchema)
60364
- }));
60365
- var { nodeEnvironment } = Config.define((c) => ({
60366
- nodeEnvironment: c.env("NODE_ENV", external_exports.string().optional())
60367
- }));
60368
- var { rawSocketPort } = Config.define((c) => ({
60369
- rawSocketPort: c.env("VOICE_WS_PORT", external_exports.coerce.number().int().min(0).max(65535).default(3300))
60370
- }));
60371
- var { outboundProxy } = Config.define((c) => ({
60372
- outboundProxy: {
60373
- HTTPS_PROXY: c.env("HTTPS_PROXY", external_exports.string().optional()),
60374
- https_proxy: c.env("https_proxy", external_exports.string().optional()),
60375
- HTTP_PROXY: c.env("HTTP_PROXY", external_exports.string().optional()),
60376
- http_proxy: c.env("http_proxy", external_exports.string().optional()),
60377
- NO_PROXY: c.env("NO_PROXY", external_exports.string().optional()),
60378
- no_proxy: c.env("no_proxy", external_exports.string().optional())
60379
- }
60380
- }));
60381
- var { blockLocalHttpCalls, allowedProxyHosts } = Config.define((c) => ({
60382
- blockLocalHttpCalls: c.env("BLOCK_LOCAL_HTTP_CALLS", environmentOneOrTrueSchema),
60383
- /** An unset allowlist is EMPTY, never a wildcard. */
60384
- allowedProxyHosts: c.env(
60385
- "ALLOWED_PROXY_HOSTS",
60386
- external_exports.string().optional().transform(
60387
- (value) => (value ?? "").split(",").map((host2) => host2.trim()).filter((host2) => host2.length > 0)
60388
- )
60389
- )
60390
- }));
60391
- var { telemetryExporterEndpoint } = Config.define((c) => ({
60392
- telemetryExporterEndpoint: c.env(
60393
- "OTEL_EXPORTER_OTLP_ENDPOINT",
60394
- external_exports.preprocess((value) => value === "" ? void 0 : value, external_exports.string().min(1).optional())
60395
- )
60396
- }));
60397
- var { publicBaseUrl } = Config.define((c) => ({
60398
- publicBaseUrl: c.env(
60399
- "BASE_HOST",
60400
- external_exports.string().optional().transform((value) => value?.trim() || void 0)
60401
- )
60402
- }));
60403
- var { publicOriginAliases } = Config.define((c) => ({
60404
- publicOriginAliases: c.env(
60405
- "BASE_HOST_ALIASES",
60406
- external_exports.string().optional().transform((value) => originsOf({ list: value ?? "" }))
60407
- )
60408
- }));
60409
- function originsOf({ list: list11 }) {
60410
- const origins = list11.split(",").map((entry) => entry.trim()).filter((entry) => URL.canParse(entry)).map((entry) => new URL(entry)).filter((url2) => url2.protocol === "https:" || url2.protocol === "http:").map((url2) => url2.origin);
60411
- return [...new Set(origins)];
60412
- }
60413
- var { appsDomain } = Config.define((c) => ({
60414
- appsDomain: c.env("APPS_DOMAIN", external_exports.string().min(1).default("lazeapps.com"))
60415
- }));
60416
- var optionalNonBlank = external_exports.preprocess(
60417
- (value) => value === "" ? void 0 : value,
60418
- external_exports.string().min(1).optional()
60419
- );
60420
- var { grafana } = Config.define((c) => ({
60421
- grafana: {
60422
- baseUrl: c.env("GRAFANA_BASE_URL", optionalNonBlank),
60423
- tempoDatasourceUid: c.env("GRAFANA_TEMPO_DATASOURCE_UID", optionalNonBlank),
60424
- lokiDatasourceUid: c.env("GRAFANA_LOKI_DATASOURCE_UID", optionalNonBlank)
60425
- }
60426
- }));
60427
- var { serviceVersion, otelResourceAttributes } = Config.define((c) => ({
60428
- serviceVersion: c.env("SERVICE_VERSION", optionalNonBlank),
60429
- otelResourceAttributes: c.env("OTEL_RESOURCE_ATTRIBUTES", optionalNonBlank)
60430
- }));
60431
- var { lazeDefaultModel } = Config.define((c) => ({
60432
- lazeDefaultModel: c.env(
60433
- "LAZE_DEFAULT_MODEL",
60434
- external_exports.string().optional().transform((value) => value?.trim() || void 0)
60435
- )
60436
- }));
60437
- var { gatewayPublicUrl, gatewayInternalUrl, gatewayLegacyUrl } = Config.define((c) => ({
60438
- gatewayPublicUrl: c.env("LW_GATEWAY_PUBLIC_URL", external_exports.string().optional()),
60439
- gatewayInternalUrl: c.env("LW_GATEWAY_INTERNAL_URL", external_exports.string().optional()),
60440
- gatewayLegacyUrl: c.env("LW_GATEWAY_BASE_URL", external_exports.string().optional())
60441
- }));
60442
- var publicProviderField = external_exports.string().min(1).optional();
60443
- var signInProviders = Config.define((c) => ({
60444
- authProvider: c.env("AUTH_PROVIDER", publicProviderField),
60445
- /** The NextAuth-era name for `AUTH_PROVIDER`: deprecated, still applied. */
60446
- legacyProvider: c.env("NEXTAUTH_PROVIDER", publicProviderField),
60447
- googleClientId: c.env("GOOGLE_CLIENT_ID", publicProviderField),
60448
- githubClientId: c.env("GITHUB_CLIENT_ID", publicProviderField),
60449
- gitlabClientId: c.env("GITLAB_CLIENT_ID", publicProviderField),
60450
- azureAdClientId: c.env("AZURE_AD_CLIENT_ID", publicProviderField),
60451
- azureAdTenantId: c.env("AZURE_AD_TENANT_ID", publicProviderField),
60452
- auth0ClientId: c.env("AUTH0_CLIENT_ID", publicProviderField),
60453
- auth0Issuer: c.env("AUTH0_ISSUER", publicProviderField),
60454
- oktaClientId: c.env("OKTA_CLIENT_ID", publicProviderField),
60455
- oktaIssuer: c.env("OKTA_ISSUER", publicProviderField),
60456
- cognitoClientId: c.env("COGNITO_CLIENT_ID", publicProviderField),
60457
- cognitoIssuer: c.env("COGNITO_ISSUER", publicProviderField),
60458
- oneLoginClientId: c.env("ONELOGIN_CLIENT_ID", publicProviderField),
60459
- oneLoginIssuer: c.env("ONELOGIN_ISSUER", publicProviderField),
60460
- oidcClientId: c.env("OIDC_CLIENT_ID", publicProviderField),
60461
- oidcIssuer: c.env("OIDC_ISSUER", publicProviderField)
60462
- }));
60463
- var { adminEmails } = Config.define((c) => ({
60464
- adminEmails: c.env(
60465
- "ADMIN_EMAILS",
60466
- external_exports.string().optional().transform(
60467
- (raw) => (raw ?? "").split(",").map((email3) => email3.trim()).filter((email3) => email3.length > 0)
60468
- )
60469
- )
60470
- }));
60471
- var { signUpMode, signUpAllowedDomains } = Config.define((c) => ({
60472
- /** `open` admits anybody who reaches the installation; `invite_only` admits invited addresses. */
60473
- signUpMode: c.env(
60474
- "SIGN_UP_MODE",
60475
- external_exports.preprocess(
60476
- (value) => value === "" ? void 0 : value,
60477
- external_exports.enum(["open", "invite_only"]).default("open")
60478
- )
60479
- ),
60480
- /** Lowercased domains without a leading `@`; empty admits any domain. */
60481
- signUpAllowedDomains: c.env(
60482
- "SIGN_UP_ALLOWED_DOMAINS",
60483
- external_exports.string().optional().transform(
60484
- (raw) => (raw ?? "").split(",").map((domain2) => domain2.trim().toLowerCase().replace(/^@/, "")).filter((domain2) => domain2.length > 0)
60485
- )
60486
- )
60487
- }));
60488
- var { passkeysEnabled, mfaEnrollmentOpen, localPasswords } = Config.define((c) => ({
60489
- passkeysEnabled: c.env("PASSKEYS_ENABLED", environmentNotExactOffSchema),
60490
- mfaEnrollmentOpen: c.env("MFA_ENROLLMENT_OPEN", environmentExactOnSchema),
60491
- localPasswords: c.env("LOCAL_PASSWORDS_ENABLED", environmentExactOnSchema)
60492
- }));
60493
- var { trustedIdpOrigins, idpSimulatorUrl } = Config.define((c) => ({
60494
- trustedIdpOrigins: c.env("SSO_TRUSTED_IDP_ORIGINS", external_exports.string().optional()),
60495
- idpSimulatorUrl: c.env("LAZE_IDPSIM_URL", external_exports.string().optional())
60496
- }));
60497
- var { posthogKey, posthogHost } = Config.define((c) => ({
60498
- posthogKey: c.env("POSTHOG_KEY", external_exports.string().optional()),
60499
- posthogHost: c.env("POSTHOG_HOST", external_exports.string().optional())
60500
- }));
60501
- var { foldCacheTtlSeconds } = Config.define((c) => ({
60502
- foldCacheTtlSeconds: c.env("LAZE_FOLD_CACHE_TTL_SECONDS", positiveInteger.default(300))
60503
- }));
60504
- var { slackApiBase, slackWebhookBase } = Config.define((c) => ({
60505
- slackApiBase: c.env("SLACK_API_BASE", external_exports.string().url().default("https://slack.com/api")),
60506
- slackWebhookBase: c.env(
60507
- "SLACK_WEBHOOK_BASE",
60508
- external_exports.string().url().default("https://hooks.slack.com")
60509
- )
60510
- }));
60511
- var { allowInsecureLocalUrls } = Config.define((c) => ({
60512
- allowInsecureLocalUrls: c.env(
60513
- "WEBHOOKS_UNSAFE_ALLOW_LOCAL_URLS",
60514
- external_exports.union([external_exports.boolean(), external_exports.literal("1"), external_exports.literal("0"), external_exports.literal("")]).optional().transform((value) => value === true || value === "1")
60515
- )
60516
- }));
60517
-
60518
60575
  // ../../modules/notification/contract/src/notification.config.ts
60519
60576
  var notificationConfig = Config.define((c) => ({
60520
60577
  emailProvider: c.env("EMAIL_PROVIDER", external_exports.enum(["scaleway-tem", "smtp"]).default("smtp")),
@@ -60991,6 +61048,7 @@ var ChatPlaceHooksToken = chatUi.hooks("place");
60991
61048
  var ChatPresenceHooksToken = chatUi.hooks("presence");
60992
61049
  var ChatStatusDialogSlot = chatUi.component("status-dialog");
60993
61050
  var ChatExternalPersonCardSlot = chatUi.extension("external-person-card");
61051
+ var ChatNewChannelDialogSlot = chatUi.component("new-channel-dialog");
60994
61052
 
60995
61053
  // ../../modules/chat/contract/src/chat.text.ts
60996
61054
  function withoutMarkdownMarks(text2) {
@@ -61166,6 +61224,7 @@ var vaultSealedApprovalSchema = vaultSealedApprovalSchemaDefinition;
61166
61224
  var vaultUi = uiTokens("vault");
61167
61225
  var VaultSealedApprovalSlot = vaultUi.component("sealedApproval");
61168
61226
  var VaultShareApprovalSlot = vaultUi.component("shareApproval");
61227
+ var VaultMachineKeyApprovalSlot = vaultUi.component("machineKeyApproval");
61169
61228
  var VaultPasskeyStepSlot = vaultUi.component("passkeyStep");
61170
61229
  var VaultNavSlot = vaultUi.component("nav");
61171
61230
  var answerSealedApprovalInputSchemaDefinition = external_exports.object({
@@ -61551,6 +61610,29 @@ var approveVaultShareInputSchemaDefinition = external_exports.object({
61551
61610
  reauthToken: external_exports.string().min(1)
61552
61611
  });
61553
61612
  var approveVaultShareInputSchema = approveVaultShareInputSchemaDefinition;
61613
+ var approveVaultMachineKeyInputSchemaDefinition = external_exports.object({
61614
+ workspaceId: external_exports.string().min(1),
61615
+ apiKeyId: external_exports.string().min(1),
61616
+ reauthToken: external_exports.string().min(1)
61617
+ });
61618
+ var approveVaultMachineKeyInputSchema = approveVaultMachineKeyInputSchemaDefinition;
61619
+ var approvedVaultMachineKeySchemaDefinition = external_exports.object({
61620
+ /** When the key needs the owner's passkey again. */
61621
+ recheckDueAt: external_exports.string().nullable()
61622
+ });
61623
+ var approvedVaultMachineKeySchema = approvedVaultMachineKeySchemaDefinition;
61624
+ var vaultReadLockSchemaDefinition = external_exports.object({
61625
+ locked: external_exports.boolean(),
61626
+ /** The CLI key whose burst locked them, as it named itself; null when not locked. */
61627
+ clientName: external_exports.string().nullable(),
61628
+ lockedAt: external_exports.iso.datetime().nullable()
61629
+ });
61630
+ var vaultReadLockSchema = vaultReadLockSchemaDefinition;
61631
+ var unlockVaultReadsInputSchemaDefinition = external_exports.object({
61632
+ workspaceId: external_exports.string().min(1),
61633
+ reauthToken: external_exports.string().min(1)
61634
+ });
61635
+ var unlockVaultReadsInputSchema = unlockVaultReadsInputSchemaDefinition;
61554
61636
  var revokeVaultGrantInputSchemaDefinition = external_exports.object({
61555
61637
  workspaceId: external_exports.string().min(1),
61556
61638
  grantId: external_exports.string().min(1),
@@ -61958,7 +62040,7 @@ var vaultTrpc = defineTrpcContract("vault").mutation("createConnection").withInp
61958
62040
  reason: external_exports.string().trim().min(1).max(200),
61959
62041
  reauthToken: external_exports.string().min(1).max(200).optional()
61960
62042
  })
61961
- ).withOutput(external_exports.object({ fields: external_exports.record(external_exports.string(), external_exports.string()) })).mutation("beginReauth").withInput(workspaceInput).withOutput(vaultReauthChallengeSchema).mutation("confirmReauth").withInput(confirmVaultReauthInputSchema).withOutput(vaultReauthProofSchema).mutation("grantConnection").withInput(grantVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("lendToChannel").withInput(lendVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("revokeGrant").withInput(revokeVaultGrantInputSchema).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).query("listGrants").withInput(connectionInput).withOutput(external_exports.array(vaultGrantSchema)).mutation("shareConnection").withInput(shareVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("approveShare").withInput(approveVaultShareInputSchema).withOutput(vaultGrantSchema).mutation("sealConnection").withInput(sealVaultConnectionInputSchema).withOutput(vaultConnectionSchema).query("listApprovals").withInput(external_exports.object({ ...workspaceInput.shape, state: vaultApprovalListStateSchema.optional() })).withOutput(external_exports.array(vaultApprovalRequestSchema)).mutation("answerApproval").withInput(answerVaultApprovalInputSchema).withOutput(vaultApprovalRequestSchema).query("listAudit").withInput(vaultAuditReadInputSchema).withOutput(vaultAuditPageSchema).query("listActivity").withInput(vaultAuditReadInputSchema).withOutput(external_exports.array(vaultAuditEntrySchema)).query("listLeases").withInput(workspaceInput).withOutput(external_exports.array(vaultLeaseSchema)).mutation("endLease").withInput(endVaultLeaseInputSchema).withOutput(external_exports.object({ ended: external_exports.literal(true) })).query("mostAsked").withInput(vaultMostAskedInputSchema).withOutput(vaultMostAskedSchema).query("judgeStatus").withInput(workspaceInput).withOutput(vaultJudgeStatusSchema).query("listLevelLimits").withInput(workspaceInput).withOutput(external_exports.array(vaultLevelLimitSchema)).mutation("setLevelLimit").withInput(setVaultLevelLimitInputSchema).withOutput(external_exports.array(vaultLevelLimitSchema)).query("listDevices").withInput(workspaceInput).withOutput(external_exports.array(vaultDeviceSchema)).mutation("beginDeviceEnrolment").withInput(workspaceInput).withOutput(vaultDeviceEnrolmentSchema).mutation("finishDeviceEnrolment").withInput(finishVaultDeviceEnrolmentInputSchema).withOutput(vaultDeviceSchema).mutation("beginDeviceApproval").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ challenge: external_exports.string(), sealed: external_exports.array(vaultSealedMaterialSchema) })).mutation("approveDevice").withInput(approveVaultDeviceInputSchema).withOutput(vaultDeviceSchema).mutation("removeDevice").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("createSealedConnection").withInput(createSealedConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("resealConnection").withInput(resealConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("openSealedConnection").withInput(
62043
+ ).withOutput(external_exports.object({ fields: external_exports.record(external_exports.string(), external_exports.string()) })).mutation("beginReauth").withInput(workspaceInput).withOutput(vaultReauthChallengeSchema).mutation("confirmReauth").withInput(confirmVaultReauthInputSchema).withOutput(vaultReauthProofSchema).mutation("grantConnection").withInput(grantVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("lendToChannel").withInput(lendVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("revokeGrant").withInput(revokeVaultGrantInputSchema).withOutput(external_exports.object({ revoked: external_exports.literal(true) })).query("listGrants").withInput(connectionInput).withOutput(external_exports.array(vaultGrantSchema)).mutation("shareConnection").withInput(shareVaultConnectionInputSchema).withOutput(vaultGrantSchema).mutation("approveShare").withInput(approveVaultShareInputSchema).withOutput(vaultGrantSchema).mutation("approveMachineKey").withInput(approveVaultMachineKeyInputSchema).withOutput(approvedVaultMachineKeySchema).query("readLock").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(vaultReadLockSchema).mutation("unlockReads").withInput(unlockVaultReadsInputSchema).withOutput(vaultReadLockSchema).mutation("sealConnection").withInput(sealVaultConnectionInputSchema).withOutput(vaultConnectionSchema).query("listApprovals").withInput(external_exports.object({ ...workspaceInput.shape, state: vaultApprovalListStateSchema.optional() })).withOutput(external_exports.array(vaultApprovalRequestSchema)).mutation("answerApproval").withInput(answerVaultApprovalInputSchema).withOutput(vaultApprovalRequestSchema).query("listAudit").withInput(vaultAuditReadInputSchema).withOutput(vaultAuditPageSchema).query("listActivity").withInput(vaultAuditReadInputSchema).withOutput(external_exports.array(vaultAuditEntrySchema)).query("listLeases").withInput(workspaceInput).withOutput(external_exports.array(vaultLeaseSchema)).mutation("endLease").withInput(endVaultLeaseInputSchema).withOutput(external_exports.object({ ended: external_exports.literal(true) })).query("mostAsked").withInput(vaultMostAskedInputSchema).withOutput(vaultMostAskedSchema).query("judgeStatus").withInput(workspaceInput).withOutput(vaultJudgeStatusSchema).query("listLevelLimits").withInput(workspaceInput).withOutput(external_exports.array(vaultLevelLimitSchema)).mutation("setLevelLimit").withInput(setVaultLevelLimitInputSchema).withOutput(external_exports.array(vaultLevelLimitSchema)).query("listDevices").withInput(workspaceInput).withOutput(external_exports.array(vaultDeviceSchema)).mutation("beginDeviceEnrolment").withInput(workspaceInput).withOutput(vaultDeviceEnrolmentSchema).mutation("finishDeviceEnrolment").withInput(finishVaultDeviceEnrolmentInputSchema).withOutput(vaultDeviceSchema).mutation("beginDeviceApproval").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ challenge: external_exports.string(), sealed: external_exports.array(vaultSealedMaterialSchema) })).mutation("approveDevice").withInput(approveVaultDeviceInputSchema).withOutput(vaultDeviceSchema).mutation("removeDevice").withInput(external_exports.object({ ...workspaceInput.shape, deviceId: external_exports.string().min(1) })).withOutput(external_exports.object({ removed: external_exports.literal(true) })).mutation("createSealedConnection").withInput(createSealedConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("resealConnection").withInput(resealConnectionInputSchema).withOutput(vaultConnectionSchema).mutation("openSealedConnection").withInput(
61962
62044
  external_exports.object({
61963
62045
  ...connectionInput.shape,
61964
62046
  reason: external_exports.string().trim().min(1).max(200),
@@ -62389,28 +62471,26 @@ var vaultAlertRaisedPayloadSchemaDefinition = external_exports.object({
62389
62471
  at: external_exports.iso.datetime()
62390
62472
  });
62391
62473
 
62392
- // ../../modules/vault/contract/src/vault-reference-chip.ts
62393
- var VaultReferenceChipSlot = uiTokens("vault").component("referenceChip");
62394
- var VaultMessageFootSlot = uiTokens("vault").component("messageFoot");
62395
- var REFERENCE = /\{\{vault:([A-Za-z0-9_][A-Za-z0-9_./:-]*)\}\}/g;
62396
- function vaultReferenceNames({ text: text2 }) {
62397
- return [...new Set([...text2.matchAll(REFERENCE)].map((match) => match[1] ?? ""))].filter(
62398
- (name3) => name3 !== ""
62399
- );
62400
- }
62401
- function vaultReferenceConnectionName({ name: name3 }) {
62402
- return name3.split(".")[0] ?? name3;
62403
- }
62404
-
62405
62474
  // ../../modules/vault/contract/src/vault-pending.ts
62406
62475
  var connectionName2 = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
62476
+ var VAULT_HOLD_MAX_TEXTS = 64;
62407
62477
  var holdPastedSecretsInputSchemaDefinition = external_exports.object({
62408
62478
  workspaceId: external_exports.string().min(1),
62409
62479
  senderUserId: external_exports.string().min(1),
62410
62480
  channelId: external_exports.string().min(1),
62411
62481
  /** The message the text belongs to; only its own delivery opens what it held. */
62412
62482
  messageId: external_exports.string().min(1),
62413
- texts: external_exports.array(external_exports.string().max(VAULT_SCRUB_MAX_TEXT)).min(1).max(64)
62483
+ texts: external_exports.array(external_exports.string().max(VAULT_SCRUB_MAX_TEXT)).min(1).max(VAULT_HOLD_MAX_TEXTS),
62484
+ /**
62485
+ * `pending`: new keys go to the sender's vault. `possible`: the text is someone else's (a
62486
+ * mirror brought it in), so new keys are saved nowhere and come back as possible secrets.
62487
+ */
62488
+ found: external_exports.enum(["pending", "possible"]).default("pending"),
62489
+ /**
62490
+ * Seals each run of many flagged values (a stack trace, a log) as one redacted block, returned
62491
+ * in `possible` and saved in no vault. Chat messages ask for it; other texts hold per value.
62492
+ */
62493
+ blocks: external_exports.boolean().default(false)
62414
62494
  });
62415
62495
  var vaultPendingSecretSchemaDefinition = external_exports.object({
62416
62496
  pendingId: external_exports.string().min(1),
@@ -62421,12 +62501,23 @@ var vaultPendingSecretSchemaDefinition = external_exports.object({
62421
62501
  /** The connection's one field, such as `OPENAI_API_KEY`. */
62422
62502
  field: external_exports.string().min(1)
62423
62503
  });
62504
+ var vaultPossibleSecretSchemaDefinition = external_exports.object({
62505
+ name: connectionName2,
62506
+ value: external_exports.string().min(1),
62507
+ vendor: external_exports.string().min(1),
62508
+ field: external_exports.string().min(1)
62509
+ });
62424
62510
  var vaultHeldSecretsSchemaDefinition = external_exports.object({
62425
62511
  texts: external_exports.array(external_exports.string()),
62426
62512
  changed: external_exports.boolean(),
62427
62513
  /** Values the vault already held, now references. */
62428
62514
  held: external_exports.number().int().nonnegative(),
62429
- pending: external_exports.array(vaultPendingSecretSchemaDefinition)
62515
+ pending: external_exports.array(vaultPendingSecretSchemaDefinition),
62516
+ /**
62517
+ * With `found: "possible"`: each flagged value once, as its `{{vault:NAME}}` in `texts`. With
62518
+ * `blocks`: each redacted block too, in either mode.
62519
+ */
62520
+ possible: external_exports.array(vaultPossibleSecretSchemaDefinition).optional()
62430
62521
  });
62431
62522
  var vaultRevealRecipientSchemaDefinition = external_exports.discriminatedUnion("kind", [
62432
62523
  external_exports.object({ kind: external_exports.literal("laze_agent"), agentId: external_exports.string().min(1) }),
@@ -62491,6 +62582,114 @@ var vaultPendingSecretReleasedPayloadSchemaDefinition = external_exports.object(
62491
62582
  text: external_exports.string().min(1).max(VAULT_SCRUB_MAX_TEXT),
62492
62583
  at: external_exports.iso.datetime()
62493
62584
  });
62585
+ var vaultPendingKeepReasonSchema = external_exports.enum(["named", "used", "shared", "sealed"]);
62586
+
62587
+ // ../../modules/vault/contract/src/vault-redacted-block.ts
62588
+ var REDACTED_BLOCK_MIN_VALUES = 3;
62589
+ var REDACTED_BLOCK_MIN_LINES = 2;
62590
+ var REDACTED_BLOCK_MAX_GAP = 3;
62591
+ var FENCE = /^\s*(?:>\s?)*(`{3,}|~{3,})/;
62592
+ var BLANK = /^\s*(?:>\s*)*$/;
62593
+ function segmentsOf({ lines: lines2 }) {
62594
+ const out = [];
62595
+ let open4 = null;
62596
+ let fence = null;
62597
+ const close = (end) => {
62598
+ if (open4 && end >= open4.start) out.push({ start: open4.start, end, fenced: open4.fenced });
62599
+ open4 = null;
62600
+ };
62601
+ lines2.forEach((line, index) => {
62602
+ const marker = FENCE.exec(line)?.[1];
62603
+ if (fence !== null) {
62604
+ if (marker && marker[0] === fence[0] && marker.length >= fence.length) {
62605
+ close(index - 1);
62606
+ fence = null;
62607
+ } else if (!open4) open4 = { start: index, fenced: true };
62608
+ return;
62609
+ }
62610
+ if (marker) {
62611
+ close(index - 1);
62612
+ fence = marker;
62613
+ return;
62614
+ }
62615
+ if (BLANK.test(line)) close(index - 1);
62616
+ else if (!open4) open4 = { start: index, fenced: false };
62617
+ });
62618
+ close(lines2.length - 1);
62619
+ return out;
62620
+ }
62621
+ function clustersIn({
62622
+ segment,
62623
+ flagged
62624
+ }) {
62625
+ const out = [];
62626
+ let current2 = null;
62627
+ for (let index = segment.start; index <= segment.end; index += 1) {
62628
+ const count5 = flagged[index] ?? 0;
62629
+ if (count5 === 0) continue;
62630
+ if (current2 && index - current2.end - 1 <= REDACTED_BLOCK_MAX_GAP) {
62631
+ current2.end = index;
62632
+ current2.values += count5;
62633
+ continue;
62634
+ }
62635
+ if (current2) out.push(current2);
62636
+ current2 = { start: index, end: index, values: count5 };
62637
+ }
62638
+ if (current2) out.push(current2);
62639
+ return out;
62640
+ }
62641
+ function redactedBlocks({
62642
+ lines: lines2,
62643
+ flagged
62644
+ }) {
62645
+ const out = [];
62646
+ for (const segment of segmentsOf({ lines: lines2 })) {
62647
+ for (const cluster of clustersIn({ segment, flagged })) {
62648
+ const span = cluster.end - cluster.start + 1;
62649
+ if (cluster.values < REDACTED_BLOCK_MIN_VALUES || span < REDACTED_BLOCK_MIN_LINES) continue;
62650
+ const whole = segment.fenced && cluster.start === segment.start && cluster.end === segment.end;
62651
+ const closed = whole && FENCE.test(lines2[segment.end + 1] ?? "");
62652
+ out.push(closed ? { ...cluster, start: cluster.start - 1, end: cluster.end + 1 } : cluster);
62653
+ }
62654
+ }
62655
+ return out;
62656
+ }
62657
+ function redactedBlocksAt({
62658
+ text: text2,
62659
+ offsets
62660
+ }) {
62661
+ const lines2 = text2.split("\n");
62662
+ const starts = [];
62663
+ let at = 0;
62664
+ for (const line of lines2) {
62665
+ starts.push(at);
62666
+ at += line.length + 1;
62667
+ }
62668
+ const lineAt = (offset) => starts.findLastIndex((start2) => start2 <= offset);
62669
+ const flagged = lines2.map(() => 0);
62670
+ for (const offset of offsets) {
62671
+ const line = lineAt(offset);
62672
+ flagged[line] = (flagged[line] ?? 0) + 1;
62673
+ }
62674
+ const blocks = redactedBlocks({ lines: lines2, flagged });
62675
+ const inside = (line) => blocks.some((block2) => line >= block2.start && line <= block2.end);
62676
+ const values = flagged.reduce((sum, count5, line) => inside(line) ? sum + count5 : sum, 0);
62677
+ return { values, insideAt: (offset) => inside(lineAt(offset)) };
62678
+ }
62679
+
62680
+ // ../../modules/vault/contract/src/vault-reference-chip.ts
62681
+ var VaultReferenceChipSlot = uiTokens("vault").component("referenceChip");
62682
+ var VaultSaveFoundSecretSlot = uiTokens("vault").component("saveFoundSecret");
62683
+ var VaultMessageFootSlot = uiTokens("vault").component("messageFoot");
62684
+ var REFERENCE = /\{\{vault:([A-Za-z0-9_][A-Za-z0-9_./:-]*)\}\}/g;
62685
+ function vaultReferenceNames({ text: text2 }) {
62686
+ return [...new Set([...text2.matchAll(REFERENCE)].map((match) => match[1] ?? ""))].filter(
62687
+ (name3) => name3 !== ""
62688
+ );
62689
+ }
62690
+ function vaultReferenceConnectionName({ name: name3 }) {
62691
+ return name3.split(".")[0] ?? name3;
62692
+ }
62494
62693
 
62495
62694
  // ../../modules/vault/contract/src/vault-apps.ts
62496
62695
  var vaultAppConnectionSchemaDefinition = external_exports.object({
@@ -62631,6 +62830,13 @@ var vaultLockdownSchemaDefinition = external_exports.object({
62631
62830
  }).nullable(),
62632
62831
  override: vaultLockdownOverrideSchemaDefinition.nullable()
62633
62832
  });
62833
+ var vaultAlertsSettleRequestedPayloadSchemaDefinition = external_exports.object({
62834
+ workspaceId: external_exports.string().min(1),
62835
+ kind: external_exports.string().regex(/^[a-z_]{1,64}$/),
62836
+ label: external_exports.string().min(1).max(80),
62837
+ requestId: external_exports.string().min(1),
62838
+ at: external_exports.iso.datetime()
62839
+ });
62634
62840
  var vaultWatchReportReceivedPayloadSchemaDefinition = external_exports.object({
62635
62841
  /** The alert workspace (VAULT_ALERT_WORKSPACE_ID), where a stopped watchdog's card lands. */
62636
62842
  workspaceId: external_exports.string().min(1),
@@ -64123,7 +64329,9 @@ var startConversationInputSchemaDefinition = external_exports.object({
64123
64329
  agentId: idSchema7,
64124
64330
  /** The first message: a conversation is only made once there is something to say. */
64125
64331
  body: firstMessageSchema,
64126
- clientKey: clientKeySchema
64332
+ clientKey: clientKeySchema,
64333
+ /** A message the starter may read: the first message quotes it, as a forward does. */
64334
+ contextMessageId: idSchema7.optional()
64127
64335
  });
64128
64336
  var startConversationInputSchema = startConversationInputSchemaDefinition;
64129
64337
  var startedConversationSchemaDefinition = external_exports.object({
@@ -64150,7 +64358,8 @@ var listConversationsInputSchema = listConversationsInputSchemaDefinition;
64150
64358
  var conversationSummarySchema2 = chatSummarySchema;
64151
64359
  var startConversationAsCallerInputSchemaDefinition = external_exports.object({
64152
64360
  agent: agentRefSchema2,
64153
- text: firstMessageSchema
64361
+ text: firstMessageSchema,
64362
+ about: idSchema7.optional().describe("The id of a message to continue from: the first message quotes it.")
64154
64363
  });
64155
64364
  var listConversationsAsCallerInputSchemaDefinition = external_exports.object({
64156
64365
  agent: agentRefSchema2.optional(),
@@ -65913,6 +66122,8 @@ var remoteHttpRequestSchemaDefinition = external_exports.object({
65913
66122
  authorization: external_exports.string().optional(),
65914
66123
  contentType: external_exports.string().optional(),
65915
66124
  body: external_exports.string(),
66125
+ /** The host the request came to (`X-Forwarded-Host`, else `Host`): the origin it names. */
66126
+ host: external_exports.string().optional(),
65916
66127
  /** This api process on loopback, where the MCP tools call the REST operations. */
65917
66128
  loopbackOrigin: external_exports.string(),
65918
66129
  /** The MCP-Protocol-Version, Mcp-Method and Mcp-Name headers, which 2026-07-28 checks. */
@@ -66315,6 +66526,16 @@ var inboxWaitingSchemaDefinition = external_exports.object({
66315
66526
  oldestPostedAt: external_exports.iso.datetime().nullable(),
66316
66527
  session: agentSessionSchemaDefinition.nullable()
66317
66528
  });
66529
+ var inboxPreviewSchemaDefinition = external_exports.object({
66530
+ messageId: idSchema17,
66531
+ channelId: idSchema17,
66532
+ channelName: external_exports.string(),
66533
+ channelKind: external_exports.enum(["public", "private", "dm", "group", "chat"]),
66534
+ author: external_exports.object({ kind: external_exports.enum(["person", "agent"]), id: idSchema17, name: external_exports.string() }),
66535
+ /** At most 200 characters of the message. */
66536
+ preview: external_exports.string().max(200),
66537
+ postedAt: external_exports.iso.datetime()
66538
+ });
66318
66539
  var callerSchemaDefinition = external_exports.object({
66319
66540
  kind: external_exports.enum(["person", "agent"]),
66320
66541
  id: idSchema17,
@@ -66323,6 +66544,8 @@ var callerSchemaDefinition = external_exports.object({
66323
66544
  agent: agentSchemaDefinition.nullable(),
66324
66545
  /** Messages waiting in the agent's inbox, not taken yet; 0 for a person. */
66325
66546
  pendingCount: external_exports.number().int().min(0).optional(),
66547
+ /** The newest of them, at most 3, still waiting for read_inbox; absent when none wait. */
66548
+ pendingNewest: external_exports.array(inboxPreviewSchemaDefinition).max(3).optional(),
66326
66549
  /** The person's language, or the agent owner's (BCP 47; en-US until they pick one). */
66327
66550
  language: external_exports.string().optional(),
66328
66551
  /** The person's time zone, or the agent owner's (IANA; UTC while Laze does not know it). */
@@ -66603,6 +66826,16 @@ var agentConfig = Config.define((c) => ({
66603
66826
  attentionTimeoutMinutes: c.env("AGENT_ATTENTION_TIMEOUT_MINUTES", positiveInt3.default(30)),
66604
66827
  /** Where a GitHub signature links back; the origin the connect command fetches the CLI from. */
66605
66828
  publicBaseUrl,
66829
+ /** Other origins this Laze answers on; MCP and OAuth describe the one a request used. */
66830
+ publicOriginAliases,
66831
+ /**
66832
+ * The origin people and agents are told to connect to (MCP server URL, setup prompt, link
66833
+ * command): `BASE_HOST` or one of its aliases, else ignored for `BASE_HOST`. docs/ops/domains.md
66834
+ */
66835
+ connectOrigin: c.env(
66836
+ "AGENT_CONNECT_ORIGIN",
66837
+ external_exports.string().optional().transform((value) => value?.trim() || void 0)
66838
+ ),
66606
66839
  /** The packed Laze CLI tarballs and their `laze-cli.json` manifest, from scripts/pack-cli.mjs. */
66607
66840
  cliPackageDirectory: c.env(
66608
66841
  "AGENT_CLI_PACKAGE_DIR",
@@ -66615,6 +66848,12 @@ var agentConfig = Config.define((c) => ({
66615
66848
  )
66616
66849
  }));
66617
66850
 
66851
+ // ../../modules/agent/contract/src/agent-browser-config.ts
66852
+ var agentBrowserConfigDefinition = external_exports.strictObject({
66853
+ /** The origin the connect dialog names (`AGENT_CONNECT_ORIGIN`); null shows the page's own. */
66854
+ connectOrigin: external_exports.string().nullable()
66855
+ });
66856
+
66618
66857
  // ../../modules/agent/contract/src/agent-delivery.ts
66619
66858
  var agentDeliveryDuePayloadSchemaDefinition = external_exports.object({
66620
66859
  workspaceId: external_exports.string().min(1),
@@ -67509,7 +67748,7 @@ async function namingFirst({ client, args }) {
67509
67748
  throw new CliUsageError(namingFirstTextOf({ channelIds: unnamed.map((chat) => chat.id) }));
67510
67749
  }
67511
67750
  function serverUrlOf({ context, args }) {
67512
- return flagText({ args, name: "url" }) || context.environment.url || "https://laze.langwatch.ai";
67751
+ return flagText({ args, name: "url" }) || context.environment.url || DEFAULT_LAZE_URL;
67513
67752
  }
67514
67753
 
67515
67754
  // src/services/agent-access-commands.service.ts
@@ -69752,12 +69991,15 @@ async function actOn({
69752
69991
  // src/services/secret-offer.service.ts
69753
69992
  function secretsIn(text2) {
69754
69993
  const seen = /* @__PURE__ */ new Set();
69755
- return draftSecretsIn({ text: text2 }).flatMap((secret) => {
69756
- if (seen.has(secret.value)) return [];
69994
+ const found = draftSecretsIn({ text: text2 });
69995
+ const blocks = redactedBlocksAt({ text: text2, offsets: found.map((secret) => secret.start) });
69996
+ const secrets = found.flatMap((secret) => {
69997
+ if (seen.has(secret.value) || blocks.insideAt(secret.start)) return [];
69757
69998
  seen.add(secret.value);
69758
69999
  const field = secret.suggestedName;
69759
70000
  return [{ value: secret.value, field, suggested: connectionNameForField(field) }];
69760
70001
  });
70002
+ return { secrets, blockValues: blocks.values };
69761
70003
  }
69762
70004
  function keychainOf(args) {
69763
70005
  const keychain2 = flagText({ args, name: "keychain", fallback: "personal" });
@@ -69802,7 +70044,13 @@ async function textToSend({
69802
70044
  leaves
69803
70045
  }) {
69804
70046
  if (profile.kind !== "person" || args.flags["as-is"]) return text2;
69805
- const secrets = secretsIn(text2);
70047
+ const { secrets, blockValues } = secretsIn(text2);
70048
+ if (blockValues > 0) {
70049
+ context.err(
70050
+ `This looks like a log or stack trace: ${blockValues} flagged values go as one redacted block, saved in no vault.
70051
+ `
70052
+ );
70053
+ }
69806
70054
  if (secrets.length === 0) return text2;
69807
70055
  const keychain2 = keychainOf(args);
69808
70056
  if (!args.flags.save && !await leaves()) return text2;
@@ -70432,8 +70680,8 @@ var openclawConfig = Config.define((c) => ({
70432
70680
  reconnectMaxSeconds: c.env("OPENCLAW_RECONNECT_MAX_SECONDS", positiveInt5.default(60)),
70433
70681
  /** How long one inbox read waits for an agent's next message. */
70434
70682
  inboxWaitSeconds: c.env("OPENCLAW_INBOX_WAIT_SECONDS", positiveInt5.max(55).default(25)),
70435
- /** A run that shows no progress for this long is given up and said so in the conversation. */
70436
- runTimeoutMinutes: c.env("OPENCLAW_RUN_TIMEOUT_MINUTES", positiveInt5.default(30)),
70683
+ /** A run that shows no progress for this long is aborted and said so in the conversation. */
70684
+ runTimeoutMinutes: c.env("OPENCLAW_RUN_TIMEOUT_MINUTES", positiveInt5.default(15)),
70437
70685
  /** The hard limit of one run, progress or not; OpenClaw gets it as the run's `timeoutMs`. */
70438
70686
  runMaxHours: c.env("OPENCLAW_RUN_MAX_HOURS", positiveInt5.default(6)),
70439
70687
  /** Where the progress board ops card for a gateway that stopped answering is written. */
@@ -72270,10 +72518,14 @@ are waiting, if you think one was missed.
72270
72518
  ## Apps
72271
72519
 
72272
72520
  Asked for an app (a tracker, a CRM, a dashboard, a page that explains something), read the full
72273
- guide first: https://laze.langwatch.ai/docs/agents/apps.md. The short version:
72274
-
72275
- - Create it where it was asked for, from the closest template:
72276
- \`laze app create "<Name>" --template tracker|crm|dashboard|form --channel <channel>\`.
72521
+ guide first: https://laze.so/docs/agents/apps.md. The short version:
72522
+
72523
+ - Create it where it was asked for, from the closest template (\`laze app templates\` lists
72524
+ them): \`laze app create "<Name>" --template <template> --channel <channel>\`. The template is
72525
+ the first live version, copied into a folder that is yours to change.
72526
+ - Slides, a deck or a talk: start from \`laze app create <name> --template slides\`. Each slide
72527
+ is a file in slides/, listed in order in slides/deck.json; the deck presents full screen and
72528
+ exports PDF and HTML on its own.
72277
72529
  An app that already exists goes in with \`laze app pin <app> --channel <channel>\`, never as a
72278
72530
  pinned message with a link. A pin opens it to everyone there, and their agents may build on it.
72279
72531
  - A new app is Restricted. Do not share it with only the person who asked when they asked in a
@@ -72332,7 +72584,7 @@ function lazePluginFiles({
72332
72584
  const json7 = (value) => `${JSON.stringify(value, null, 2)}
72333
72585
  `;
72334
72586
  const description = "Laze messages reach this session, and the laze tools to answer them";
72335
- const author = { name: "Laze", url: "https://laze.langwatch.ai" };
72587
+ const author = { name: "Laze", url: "https://laze.so" };
72336
72588
  return {
72337
72589
  ".claude-plugin/marketplace.json": json7({
72338
72590
  name: LAZE_PLUGIN,
@@ -72345,7 +72597,7 @@ function lazePluginFiles({
72345
72597
  version: version2,
72346
72598
  description,
72347
72599
  author,
72348
- homepage: "https://laze.langwatch.ai/docs/agents/connect",
72600
+ homepage: "https://laze.so/docs/agents/connect",
72349
72601
  keywords: ["laze", "chat", "agents"],
72350
72602
  extensions: { "ai.laze": { delivery: "ai.laze/delivery.json" } }
72351
72603
  }),
@@ -74334,6 +74586,7 @@ var appConnectionAnswerSchemaDefinition = external_exports.object({
74334
74586
 
74335
74587
  // ../../modules/app/contract/src/app.api.ts
74336
74588
  var appSlugSchema = external_exports.string().min(2).max(24).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "lower case letters and digits, joined by single hyphens");
74589
+ var appTemplateNameSchema = external_exports.string().min(2).max(40).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "lower case letters and digits, joined by single hyphens");
74337
74590
  var APP_VISIBILITIES = ["restricted", "channel", "internal", "public"];
74338
74591
  var appVisibilitySchema = external_exports.enum(APP_VISIBILITIES);
74339
74592
  var APP_ROLES = ["viewer", "editor", "builder"];
@@ -74400,6 +74653,10 @@ var appSchemaDefinition = external_exports.object({
74400
74653
  role: appRoleSchema.nullable().optional(),
74401
74654
  /** The agent that built it, a Builder by standing; null or absent when a person did. */
74402
74655
  creatorAgentId: external_exports.string().nullable().optional(),
74656
+ /** The template the app started from; null or absent for an app built from nothing. */
74657
+ templateName: external_exports.string().nullable().optional(),
74658
+ /** That template's version when the app was made, so a later version can be offered. */
74659
+ templateVersion: external_exports.number().int().positive().nullable().optional(),
74403
74660
  createdAt: external_exports.iso.datetime(),
74404
74661
  updatedAt: external_exports.iso.datetime()
74405
74662
  });
@@ -74499,7 +74756,9 @@ var createAppInputSchemaDefinition = external_exports.object({
74499
74756
  /** Restricted unless chosen: owner, admins, shares and the conversations it is pinned to. */
74500
74757
  visibility: appVisibilitySchema.default("restricted"),
74501
74758
  /** The agent a person hands the new app to, which becomes its creator and a Builder. */
74502
- creatorAgentId: external_exports.string().min(1).optional()
74759
+ creatorAgentId: external_exports.string().min(1).optional(),
74760
+ /** Starts the app from this template: its files are the first live version. */
74761
+ template: appTemplateNameSchema.optional()
74503
74762
  });
74504
74763
  var createAppInputSchema = createAppInputSchemaDefinition;
74505
74764
  var listAppsInputSchemaDefinition = external_exports.object({
@@ -75124,7 +75383,7 @@ var appFaultClaimsSchemaDefinition = external_exports.object({
75124
75383
  ver: external_exports.string().min(1).max(64),
75125
75384
  vid: external_exports.string().min(1),
75126
75385
  vname: external_exports.string().max(200),
75127
- kind: external_exports.enum(["error", "rejection", "banner", "api"]),
75386
+ kind: external_exports.enum(["error", "rejection", "banner", "api", "resource", "csp"]),
75128
75387
  msg: external_exports.string().min(1).max(1e3),
75129
75388
  stack: external_exports.string().max(4e3).optional(),
75130
75389
  req: external_exports.object({
@@ -75133,6 +75392,14 @@ var appFaultClaimsSchemaDefinition = external_exports.object({
75133
75392
  status: external_exports.number().int(),
75134
75393
  code: external_exports.string().max(160).optional()
75135
75394
  }).optional(),
75395
+ /** Files the page could not load, with the policy directive that blocked each, if one did. */
75396
+ res: external_exports.array(
75397
+ external_exports.object({
75398
+ el: external_exports.string().max(80),
75399
+ url: external_exports.string().max(600),
75400
+ dir: external_exports.string().max(80).optional()
75401
+ })
75402
+ ).max(10).optional(),
75136
75403
  act: external_exports.string().max(400),
75137
75404
  page: external_exports.string().max(600)
75138
75405
  });
@@ -75584,11 +75851,55 @@ var appBackupCheckAlertsSchemaDefinition = external_exports.object({
75584
75851
  adminUserIds: external_exports.array(external_exports.string())
75585
75852
  });
75586
75853
 
75854
+ // ../../modules/app/contract/src/app.templates.ts
75855
+ var APP_TEMPLATE_SOURCES = ["laze"];
75856
+ var templateCollectionsSchema = external_exports.record(
75857
+ collectionNameSchema,
75858
+ external_exports.object({
75859
+ fields: external_exports.array(collectionFieldSchema).min(1),
75860
+ rules: collectionRulesSchema.optional()
75861
+ })
75862
+ ).default({});
75863
+ var appTemplateManifestSchemaDefinition = external_exports.object({
75864
+ name: appTemplateNameSchema,
75865
+ title: external_exports.string().trim().min(1).max(60),
75866
+ description: external_exports.string().trim().min(1).max(300),
75867
+ /** Grows when the template changes; an app records the version it copied. */
75868
+ version: external_exports.number().int().positive(),
75869
+ /** The page the app opens on, a path in the folder. */
75870
+ entry: external_exports.string().min(1).max(200),
75871
+ /** One or two sentences an agent reads first: how to change an app made from it. */
75872
+ guide: external_exports.string().trim().max(500).optional(),
75873
+ collections: templateCollectionsSchema,
75874
+ views: external_exports.array(appViewSpecSchema).default([]),
75875
+ seed: external_exports.record(collectionNameSchema, external_exports.array(appRecordSchema)).default({})
75876
+ });
75877
+ var appTemplateSchemaDefinition = external_exports.object({
75878
+ ...appTemplateManifestSchemaDefinition.shape,
75879
+ source: external_exports.enum(APP_TEMPLATE_SOURCES)
75880
+ });
75881
+ var appTemplateSchema = appTemplateSchemaDefinition;
75882
+ var writeAppFilesShape = {
75883
+ appId: external_exports.string().min(1),
75884
+ files: external_exports.array(appFileSchema).max(200).default([]),
75885
+ /** Paths to remove from the version. */
75886
+ remove: external_exports.array(appFileSchema.shape.path).max(200).default([]),
75887
+ /** What changed, for a person; empty or throwaway messages are refused. */
75888
+ message: external_exports.string().trim().max(500)
75889
+ };
75890
+ var somethingToWrite = {
75891
+ check: (input2) => input2.files.length + input2.remove.length > 0,
75892
+ message: "Give a file to write or a path to remove"
75893
+ };
75894
+ var writeAppFilesInputSchemaDefinition = external_exports.object({ workspaceId: external_exports.string().min(1), ...writeAppFilesShape }).refine(somethingToWrite.check, { message: somethingToWrite.message });
75895
+ var writeAppFilesByKeyInputSchemaDefinition = external_exports.object(writeAppFilesShape).refine(somethingToWrite.check, { message: somethingToWrite.message });
75896
+ var appTemplatesByKeyQuerySchemaDefinition = external_exports.object({});
75897
+
75587
75898
  // ../../modules/app/contract/src/app.trpc.ts
75588
75899
  var appMainTrpc = defineTrpcContract("app").query("list").withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(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).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();
75589
75900
  var appConnectionsTrpc = defineTrpcContract("app").query("connections").withInput(appRefSchema).withOutput(appConnectionsSchema).mutation("allowConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).mutation("revokeConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).build();
75590
75901
  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();
75591
- var appSettingsTrpc = defineTrpcContract("app").query("workspaceSettings").withInput(appWorkspaceRefSchema).withOutput(appWorkspaceSettingsSchema).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).mutation("setPublicAppsAllowed").withInput(setPublicAppsAllowedInputSchema).withOutput(appFunctionSettingsSchema).build();
75902
+ var appSettingsTrpc = defineTrpcContract("app").query("workspaceSettings").withInput(appWorkspaceRefSchema).withOutput(appWorkspaceSettingsSchema).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).mutation("setPublicAppsAllowed").withInput(setPublicAppsAllowedInputSchema).withOutput(appFunctionSettingsSchema).query("templates").withInput(appWorkspaceRefSchema).withOutput(external_exports.array(appTemplateSchema)).build();
75592
75903
  var appTrpc = joinTrpcContracts(
75593
75904
  "app",
75594
75905
  appMainTrpc,
@@ -75654,7 +75965,6 @@ var deleteAppUserByKeyInputSchemaDefinition = deleteAppUserInputSchema.omit(byKe
75654
75965
  var appListByKeyQuerySchemaDefinition = external_exports.object({ archived: external_exports.enum(["true"]).optional() });
75655
75966
 
75656
75967
  // ../../modules/app/contract/src/app.cli.ts
75657
- var APP_TEMPLATES = ["tracker", "crm", "dashboard", "form"];
75658
75968
  var APP_MANIFEST_FILE = "laze.app.json";
75659
75969
  var appManifestSchemaDefinition = external_exports.object({
75660
75970
  app: external_exports.object({ id: external_exports.string().min(1), name: external_exports.string(), slug: appSlugSchema }),
@@ -75684,8 +75994,14 @@ var appCliCommands = [
75684
75994
  {
75685
75995
  command: "laze app create",
75686
75996
  operation: "createApp",
75687
- arguments: ["<name>", "--template tracker|crm|dashboard|form", "--dir <dir>", "--channel <c>"],
75688
- summary: "Create an app and scaffold a starter template into a folder linked to it"
75997
+ arguments: ["<name>", "--template <template>", "--dir <dir>", "--channel <c>"],
75998
+ summary: "Create an app in a folder linked to it. --template starts it from a template (laze app templates lists them; decks start from slides): its files are the first live version and land in the folder to change"
75999
+ },
76000
+ {
76001
+ command: "laze app templates",
76002
+ operation: "listTemplates",
76003
+ arguments: [],
76004
+ summary: "List the templates an app can start from, with their versions"
75689
76005
  },
75690
76006
  {
75691
76007
  command: "laze app list",
@@ -75699,6 +76015,12 @@ var appCliCommands = [
75699
76015
  arguments: ["[dir]", "-m <what changed>", "--seed"],
75700
76016
  summary: `Record the folder as a new version: it is the live app at once, with laze.app.json's collections applied to the live data (records keep their values). -m says what changed in plain words ("update" or "wip" is refused). Going live waits only when an admin must approve it, and the push asks. Server functions in functions/<name>.js ship with it`
75701
76017
  },
76018
+ {
76019
+ command: "laze app write",
76020
+ operation: "writeFiles",
76021
+ arguments: ["<file>...", "-m <what changed>", "--remove <path,...>"],
76022
+ summary: "Write some files of the app's folder over the live version and keep every other file, or remove paths: a new live version like a push, for changing one slide or page without pushing the whole folder"
76023
+ },
75702
76024
  {
75703
76025
  command: "laze app logs",
75704
76026
  operation: "listFunctionLogs",
@@ -76108,530 +76430,6 @@ function unknownCollectionsOf({
76108
76430
  );
76109
76431
  }
76110
76432
 
76111
- // src/templates/crm.template.ts
76112
- var APP_JS = String.raw`(function () {
76113
- var h = Laze.h;
76114
- var contacts = Laze.records("contacts");
76115
- var STAGES = ["lead", "qualified", "proposal", "won", "lost"];
76116
- var TONE = { lead: "", qualified: "info", proposal: "primary", won: "success", lost: "danger" };
76117
- var view = "board";
76118
- var adding = false;
76119
- var rows = [];
76120
-
76121
- function badge(stage) {
76122
- return h("span", { class: "lz-badge" + (TONE[stage] ? " lz-badge-" + TONE[stage] : "") }, stage);
76123
- }
76124
-
76125
- function stagePicker(contact) {
76126
- return h("select", {
76127
- class: "lz-select", "aria-label": "Stage of " + contact.name,
76128
- onchange: function (event) { contacts.update(contact.id, { stage: event.target.value }).then(load, Laze.fail); },
76129
- }, STAGES.map(function (stage) {
76130
- return h("option", { value: stage, selected: stage === contact.stage }, stage);
76131
- }));
76132
- }
76133
-
76134
- function board() {
76135
- return h("div", { class: "lz-board" }, STAGES.map(function (stage) {
76136
- var inStage = rows.filter(function (row) { return row.stage === stage; });
76137
- var total = inStage.reduce(function (sum, row) { return sum + Number(row.value || 0); }, 0);
76138
- return h("section", { class: "lz-column", "aria-label": stage },
76139
- h("div", { class: "lz-column-head" }, badge(stage), h("span", { class: "lz-muted" }, Laze.money(total))),
76140
- inStage.length ? inStage.map(function (row) {
76141
- return h("article", { class: "lz-tile" },
76142
- h("strong", {}, row.name),
76143
- h("span", { class: "lz-muted" }, row.company || "No company"),
76144
- h("span", {}, Laze.money(row.value)));
76145
- }) : h("p", { class: "lz-muted" }, "No one here yet"));
76146
- }));
76147
- }
76148
-
76149
- function table() {
76150
- return h("div", { class: "lz-card lz-table-wrap" }, h("table", { class: "lz-table" },
76151
- h("thead", {}, h("tr", {}, ["Name", "Company", "Email", "Stage", "Value"].map(function (label) {
76152
- return h("th", { class: label === "Value" ? "lz-num" : "" }, label);
76153
- }))),
76154
- h("tbody", {}, rows.map(function (row) {
76155
- return h("tr", {},
76156
- h("td", {}, h("strong", {}, row.name)),
76157
- h("td", {}, row.company || ""),
76158
- h("td", { class: "lz-muted" }, row.email || ""),
76159
- h("td", {}, stagePicker(row)),
76160
- h("td", { class: "lz-num" }, Laze.money(row.value)));
76161
- }))));
76162
- }
76163
-
76164
- function addForm() {
76165
- var form = h("form", { class: "lz-card lz-card-body lz-form", onsubmit: function (event) {
76166
- event.preventDefault();
76167
- var data = Object.fromEntries(new FormData(form).entries());
76168
- data.value = Number(data.value || 0);
76169
- contacts.create(data).then(function () { form.reset(); adding = false; load(); }, Laze.fail);
76170
- } },
76171
- h("label", { class: "lz-field" }, "Name", h("input", { class: "lz-input", name: "name", required: true })),
76172
- h("label", { class: "lz-field" }, "Company", h("input", { class: "lz-input", name: "company" })),
76173
- h("label", { class: "lz-field" }, "Email", h("input", { class: "lz-input", name: "email", type: "email" })),
76174
- h("label", { class: "lz-field" }, "Value", h("input", { class: "lz-input", name: "value", type: "number", min: "0" })),
76175
- h("button", { class: "lz-btn lz-btn-primary", type: "submit" }, "Add contact"),
76176
- rows.length ? h("button", { class: "lz-btn lz-btn-ghost", type: "button", onclick: function () { adding = false; render(); } }, "Cancel") : null);
76177
- return form;
76178
- }
76179
-
76180
- function render() {
76181
- var open = rows.filter(function (row) { return row.stage !== "won" && row.stage !== "lost"; });
76182
- var pipeline = open.reduce(function (sum, row) { return sum + Number(row.value || 0); }, 0);
76183
- Laze.mount(h("div", { class: "lz-page" },
76184
- h("header", { class: "lz-header" },
76185
- h("div", {}, h("h1", { class: "lz-title" }, document.title),
76186
- h("p", { class: "lz-lede" }, open.length + " open deals worth " + Laze.money(pipeline) + ".")),
76187
- h("div", { class: "lz-row" },
76188
- h("div", { class: "lz-tabs", role: "group", "aria-label": "View" }, ["board", "table"].map(function (name) {
76189
- return h("button", { class: "lz-tab", "aria-pressed": String(view === name), onclick: function () { view = name; render(); } },
76190
- name === "board" ? "Pipeline" : "Table");
76191
- })),
76192
- adding ? null : h("button", { class: "lz-btn lz-btn-primary", onclick: function () { adding = true; render(); } }, "New contact"))),
76193
- adding || !rows.length ? addForm() : null,
76194
- view === "board" ? board() : table()));
76195
- }
76196
-
76197
- function load() {
76198
- return contacts.list({ sort: "-value" }).then(function (items) { rows = items; render(); }, Laze.fail);
76199
- }
76200
-
76201
- load();
76202
- Laze.subscribe("contacts", load);
76203
- })();
76204
- `;
76205
- var CRM_TEMPLATE = {
76206
- title: "CRM",
76207
- summary: "Contacts on a pipeline board and a table, with stages and deal values",
76208
- appJs: APP_JS,
76209
- collections: {
76210
- contacts: {
76211
- fields: [
76212
- { name: "name", type: "text", required: true },
76213
- { name: "company", type: "text" },
76214
- { name: "email", type: "text" },
76215
- {
76216
- name: "stage",
76217
- type: "select",
76218
- options: ["lead", "qualified", "proposal", "won", "lost"],
76219
- default: "lead"
76220
- },
76221
- { name: "value", type: "number", default: 0 },
76222
- { name: "notes", type: "text" }
76223
- ]
76224
- }
76225
- },
76226
- seed: {
76227
- contacts: [
76228
- {
76229
- name: "Ada Park",
76230
- company: "ACME Corp",
76231
- email: "ada@acme.example",
76232
- stage: "proposal",
76233
- value: 18e3
76234
- },
76235
- {
76236
- name: "Ben Ito",
76237
- company: "ACME Labs",
76238
- email: "ben@acme.example",
76239
- stage: "qualified",
76240
- value: 9500
76241
- },
76242
- {
76243
- name: "Cleo Ruiz",
76244
- company: "ACME Retail",
76245
- email: "cleo@acme.example",
76246
- stage: "lead",
76247
- value: 4e3
76248
- },
76249
- {
76250
- name: "Dev Shah",
76251
- company: "ACME Freight",
76252
- email: "dev@acme.example",
76253
- stage: "won",
76254
- value: 22e3
76255
- }
76256
- ]
76257
- }
76258
- };
76259
-
76260
- // src/templates/dashboard.template.ts
76261
- var APP_JS2 = String.raw`(function () {
76262
- // One stat tile and one chart per metric name, newest period last. "better" on a metric's
76263
- // newest row says whether a rise is good ("up") or bad ("down"), which colours its change.
76264
- var h = Laze.h;
76265
- var metrics = Laze.records("metrics");
76266
-
76267
- function number(value) { return Number(value) || 0; }
76268
- function shown(row) { return number(row.value).toLocaleString() + (row.unit ? " " + row.unit : ""); }
76269
-
76270
- function seriesOf(rows) {
76271
- var names = [];
76272
- rows.forEach(function (row) { if (names.indexOf(row.name) < 0) names.push(row.name); });
76273
- return names.map(function (name) {
76274
- var series = rows.filter(function (row) { return row.name === name; })
76275
- .sort(function (a, b) { return String(a.period).localeCompare(String(b.period)); });
76276
- return { name: name, series: series, last: series[series.length - 1], before: series[series.length - 2] };
76277
- });
76278
- }
76279
-
76280
- function tile(entry) {
76281
- var change = entry.before ? number(entry.last.value) - number(entry.before.value) : null;
76282
- var good = change === null || change === 0 ? null : (change > 0) === (entry.last.better !== "down");
76283
- return h("div", { class: "lz-card lz-card-body" },
76284
- h("p", { class: "lz-card-title" }, entry.name),
76285
- h("div", { class: "lz-stat-value" }, shown(entry.last)),
76286
- change === null ? h("span", { class: "lz-muted" }, Laze.day(entry.last.period)) :
76287
- h("span", { class: "lz-badge" + (good === null ? "" : good ? " lz-badge-success" : " lz-badge-danger") },
76288
- (change > 0 ? "+" : "") + change.toLocaleString() + " vs " + Laze.day(entry.before.period)));
76289
- }
76290
-
76291
- function chart(entry) {
76292
- var peak = Math.max.apply(null, entry.series.map(function (row) { return number(row.value); })) || 1;
76293
- return h("section", { class: "lz-card lz-card-body" },
76294
- h("p", { class: "lz-card-title" }, entry.name + " by period"),
76295
- h("div", { class: "lz-chart", role: "img", "aria-label": entry.name + " by period" }, entry.series.map(function (row) {
76296
- return h("div", { class: "lz-chart-col" },
76297
- h("div", { class: "lz-chart-track" },
76298
- h("div", { class: "lz-chart-bar", title: shown(row), style: "height:" + Math.max(1, Math.round((number(row.value) / peak) * 100)) + "%" },
76299
- h("span", { class: "lz-chart-value" }, number(row.value).toLocaleString()))),
76300
- h("span", { class: "lz-chart-label" }, Laze.day(row.period)));
76301
- })));
76302
- }
76303
-
76304
- function render(rows) {
76305
- var all = seriesOf(rows);
76306
- Laze.mount(h("div", { class: "lz-page" },
76307
- h("header", { class: "lz-header" }, h("div", {}, h("h1", { class: "lz-title" }, document.title),
76308
- h("p", { class: "lz-lede" }, all.length ? "Updated " + Laze.day(rows.reduce(function (latest, row) {
76309
- return String(row.period) > String(latest) ? row.period : latest;
76310
- }, "")) + "." : "The numbers an agent keeps current for this channel."))),
76311
- all.length ? [
76312
- h("section", { class: "lz-stats" }, all.map(tile)),
76313
- h("div", { class: "lz-grid" }, all.map(chart)),
76314
- ] : h("div", { class: "lz-card lz-empty" }, "No numbers yet. Records in metrics show here, one tile and one chart per name.")));
76315
- }
76316
-
76317
- function load() { return metrics.list({ sort: "period" }).then(render, Laze.fail); }
76318
- load();
76319
- Laze.subscribe("metrics", load);
76320
- })();
76321
- `;
76322
- var DASHBOARD_TEMPLATE = {
76323
- title: "Dashboard",
76324
- summary: "A stat tile and a bar chart per metric, its change coloured by whether up is good",
76325
- appJs: APP_JS2,
76326
- collections: {
76327
- metrics: {
76328
- fields: [
76329
- { name: "name", type: "text", required: true },
76330
- { name: "value", type: "number", required: true },
76331
- { name: "unit", type: "text" },
76332
- { name: "period", type: "date", required: true },
76333
- { name: "better", type: "select", options: ["up", "down"], default: "up" }
76334
- ]
76335
- }
76336
- },
76337
- seed: {
76338
- metrics: [
76339
- { name: "Signups", value: 120, period: "2026-07-01" },
76340
- { name: "Signups", value: 164, period: "2026-08-01" },
76341
- { name: "Signups", value: 151, period: "2026-09-01" },
76342
- { name: "Signups", value: 203, period: "2026-10-01" },
76343
- { name: "Open tickets", value: 38, period: "2026-07-01", better: "down" },
76344
- { name: "Open tickets", value: 35, period: "2026-08-01", better: "down" },
76345
- { name: "Open tickets", value: 31, period: "2026-09-01", better: "down" },
76346
- { name: "Open tickets", value: 24, period: "2026-10-01", better: "down" }
76347
- ]
76348
- }
76349
- };
76350
-
76351
- // src/templates/form.template.ts
76352
- var APP_JS3 = String.raw`(function () {
76353
- var h = Laze.h;
76354
- var responses = Laze.records("responses");
76355
- var sent = false;
76356
-
76357
- function render(rows) {
76358
- var form = h("form", { class: "lz-card lz-card-body", onsubmit: function (event) {
76359
- event.preventDefault();
76360
- var data = Object.fromEntries(new FormData(form).entries());
76361
- data.rating = Number(data.rating || 0);
76362
- responses.create(data).then(function () { sent = true; load(); }, Laze.fail);
76363
- } },
76364
- h("div", { class: "lz-form" },
76365
- h("label", { class: "lz-field" }, "Your name", h("input", { class: "lz-input", name: "name", required: true })),
76366
- h("label", { class: "lz-field" }, "Email", h("input", { class: "lz-input", name: "email", type: "email" })),
76367
- h("label", { class: "lz-field" }, "Rating", h("select", { class: "lz-select", name: "rating" },
76368
- [5, 4, 3, 2, 1].map(function (n) { return h("option", { value: n }, n + " of 5"); })))),
76369
- h("label", { class: "lz-field", style: "margin-top:10px" }, "Message",
76370
- h("textarea", { class: "lz-textarea", name: "message", rows: 4 })),
76371
- h("div", { class: "lz-row", style: "margin-top:12px" },
76372
- h("button", { class: "lz-btn lz-btn-primary", type: "submit" }, "Send"),
76373
- sent ? h("span", { class: "lz-badge lz-badge-success" }, "Thanks, it is in.") : null));
76374
- Laze.mount(h("div", { class: "lz-page" },
76375
- h("header", { class: "lz-header" }, h("div", {}, h("h1", { class: "lz-title" }, document.title),
76376
- h("p", { class: "lz-lede" }, "Tell us how it went. Answers land in this app's responses.")),
76377
- rows && rows.length ? h("div", { class: "lz-row" },
76378
- h("span", { class: "lz-badge lz-badge-primary" }, rows.length + (rows.length === 1 ? " answer" : " answers")),
76379
- h("span", { class: "lz-badge" }, "Average " + (rows.reduce(function (sum, row) { return sum + (Number(row.rating) || 0); }, 0) / rows.length).toFixed(1) + " of 5")) : null),
76380
- form,
76381
- rows && rows.length ? h("section", { class: "lz-card lz-table-wrap" }, h("table", { class: "lz-table" },
76382
- h("thead", {}, h("tr", {}, h("th", {}, "Name"), h("th", {}, "Rating"), h("th", {}, "Message"))),
76383
- h("tbody", {}, rows.map(function (row) {
76384
- return h("tr", {}, h("td", {}, row.name), h("td", { "data-label": "Rating" }, row.rating + " of 5"), h("td", { class: "lz-muted", "data-label": "Message" }, row.message || ""));
76385
- })))) : rows ? h("p", { class: "lz-card lz-empty" }, "No answers yet.") : null));
76386
- }
76387
-
76388
- function load() {
76389
- return responses.list().then(render, function () { render(null); });
76390
- }
76391
- load();
76392
- })();
76393
- `;
76394
- var FORM_TEMPLATE = {
76395
- title: "Form",
76396
- summary: "A feedback form with a rating, and the answers below it",
76397
- appJs: APP_JS3,
76398
- collections: {
76399
- responses: {
76400
- fields: [
76401
- { name: "name", type: "text", required: true },
76402
- { name: "email", type: "text" },
76403
- { name: "rating", type: "number", default: 5 },
76404
- { name: "message", type: "text" }
76405
- ]
76406
- }
76407
- },
76408
- seed: {
76409
- responses: [
76410
- { name: "Ada", email: "ada@acme.example", rating: 5, message: "Fast and clear." },
76411
- {
76412
- name: "Ben",
76413
- email: "ben@acme.example",
76414
- rating: 4,
76415
- message: "Good, the export could be quicker."
76416
- }
76417
- ]
76418
- }
76419
- };
76420
-
76421
- // src/templates/shared.template.ts
76422
- function indexHtml({ title }) {
76423
- return String.raw`<!doctype html>
76424
- <html lang="en">
76425
- <head>
76426
- <meta charset="utf-8" />
76427
- <meta name="viewport" content="width=device-width, initial-scale=1" />
76428
- <title>${title}</title>
76429
- <link rel="stylesheet" href="/_laze/theme.css" />
76430
- <link rel="stylesheet" href="/_laze/kit.css" />
76431
- </head>
76432
- <body>
76433
- <main id="app"><p class="lz-page lz-muted">Loading...</p></main>
76434
- <script src="/_laze/laze.js"></script>
76435
- <script src="/app.js"></script>
76436
- </body>
76437
- </html>
76438
- `;
76439
- }
76440
-
76441
- // src/templates/tracker.template.ts
76442
- var APP_JS4 = String.raw`(function () {
76443
- // The page reads its fields from the app's schema, so renaming or adding fields in
76444
- // laze.app.json needs no change here. The status field is the select named "status"
76445
- // (or the first select); its last option counts as done.
76446
- var h = Laze.h;
76447
- var name = "items";
76448
- var fields = [];
76449
- var status = null;
76450
- var shown = "open";
76451
- var adding = false;
76452
- var rows = [];
76453
- var EMPTY = { open: "Nothing open.", done: "Nothing done yet.", all: "No items yet." };
76454
- var TONES = ["", "info", "warning", "success"];
76455
-
76456
- function label(text) { return text.charAt(0).toUpperCase() + text.slice(1).replace(/_/g, " "); }
76457
- function options() { return status ? status.options || [] : []; }
76458
- function isDone(row) { return status ? row[status.name] === options()[options().length - 1] : false; }
76459
- function next(value) { var all = options(); return all[(all.indexOf(value) + 1) % all.length]; }
76460
- function tone(value) {
76461
- var all = options();
76462
- if (value === all[all.length - 1]) return "success";
76463
- return TONES[Math.min(all.indexOf(value), TONES.length - 2)] || "";
76464
- }
76465
-
76466
- function input(field) {
76467
- var props = { class: "lz-input", name: field.name };
76468
- if (field.required) props.required = true;
76469
- if (field.type === "select") {
76470
- return h("select", { class: "lz-input", name: field.name },
76471
- (field.options || []).map(function (option) {
76472
- return h("option", option === field.default ? { value: option, selected: true } : { value: option }, option);
76473
- }));
76474
- }
76475
- if (field.type === "number") props.type = "number";
76476
- if (field.type === "date") props.type = "date";
76477
- if (field.type === "bool") { props.type = "checkbox"; props.class = ""; }
76478
- return h("input", props);
76479
- }
76480
-
76481
- function cell(field, row) {
76482
- var value = row[field.name];
76483
- if (value === undefined || value === null || value === "") return "";
76484
- if (field.type === "date") return Laze.day(value);
76485
- if (field.type === "bool") return value ? "Yes" : "No";
76486
- if (field.type === "json") return JSON.stringify(value);
76487
- return String(value);
76488
- }
76489
-
76490
- function render() {
76491
- var first = fields[0];
76492
- var others = fields.filter(function (field) { return field !== first && field !== status && field.type !== "file"; });
76493
- var visible = rows.filter(function (row) {
76494
- return shown === "all" || (shown === "open" ? !isDone(row) : isDone(row));
76495
- });
76496
- var form = h("form", { class: "lz-card lz-card-body lz-form", onsubmit: function (event) {
76497
- event.preventDefault();
76498
- var data = {};
76499
- fields.forEach(function (field) {
76500
- var element = form.elements[field.name];
76501
- if (!element) return;
76502
- if (field.type === "bool") data[field.name] = element.checked;
76503
- else if (element.value === "") return;
76504
- else data[field.name] = field.type === "number" ? Number(element.value) : element.value;
76505
- });
76506
- Laze.records(name).create(data).then(function () { form.reset(); adding = false; load(); }, Laze.fail);
76507
- } },
76508
- fields.filter(function (field) { return field.type !== "file" && field.type !== "json"; }).map(function (field) {
76509
- return h("label", { class: "lz-field" }, label(field.name), input(field));
76510
- }),
76511
- h("button", { class: "lz-btn lz-btn-primary", type: "submit" }, "Add"),
76512
- rows.length ? h("button", { class: "lz-btn lz-btn-ghost", type: "button", onclick: function () { adding = false; render(); } }, "Cancel") : null);
76513
- var open = rows.filter(function (row) { return !isDone(row); }).length;
76514
- Laze.mount(h("div", { class: "lz-page" },
76515
- h("header", { class: "lz-header" },
76516
- h("div", {}, h("h1", { class: "lz-title" }, document.title),
76517
- h("p", { class: "lz-lede" }, open + (open === 1 ? " open item." : " open items."))),
76518
- h("div", { class: "lz-row" },
76519
- status ? h("div", { class: "lz-tabs", role: "group", "aria-label": "Show" }, ["open", "done", "all"].map(function (tab) {
76520
- return h("button", { class: "lz-tab", "aria-pressed": String(shown === tab), onclick: function () { shown = tab; render(); } }, label(tab));
76521
- })) : null,
76522
- adding ? null : h("button", { class: "lz-btn lz-btn-primary", onclick: function () { adding = true; render(); } }, "New item"))),
76523
- adding || !rows.length ? form : null,
76524
- h("div", { class: "lz-card lz-table-wrap" }, visible.length ? h("table", { class: "lz-table" },
76525
- h("thead", {}, h("tr", {},
76526
- h("th", {}, label(first.name)),
76527
- others.map(function (field) { return h("th", {}, label(field.name)); }),
76528
- status ? h("th", {}, label(status.name)) : null)),
76529
- h("tbody", {}, visible.map(function (row) {
76530
- return h("tr", {},
76531
- h("td", {}, h("strong", {}, cell(first, row))),
76532
- others.map(function (field) { return h("td", { class: "lz-muted", "data-label": label(field.name) }, cell(field, row)); }),
76533
- status ? h("td", {}, h("button", { class: "lz-btn lz-btn-ghost", title: "Move to " + next(row[status.name]),
76534
- onclick: function () {
76535
- var change = {};
76536
- change[status.name] = next(row[status.name]);
76537
- Laze.records(name).update(row.id, change).then(load, Laze.fail);
76538
- } },
76539
- h("span", { class: "lz-badge" + (tone(row[status.name]) ? " lz-badge-" + tone(row[status.name]) : "") }, row[status.name] || ""))) : null);
76540
- }))) : h("p", { class: "lz-empty" }, status ? EMPTY[shown] : EMPTY.all))));
76541
- }
76542
-
76543
- function load() {
76544
- return Laze.records(name).list({ sort: "-created" }).then(function (list) { rows = list; render(); }, Laze.fail);
76545
- }
76546
-
76547
- Laze.collections().then(function (all) {
76548
- var collection = all.filter(function (c) { return c.name === name; })[0] || all[0];
76549
- if (!collection) return Laze.fail(new Error("This app has no collection yet"));
76550
- name = collection.name;
76551
- fields = collection.schema.fields;
76552
- var selects = fields.filter(function (field) { return field.type === "select"; });
76553
- status = selects.filter(function (field) { return field.name === "status"; })[0] || selects[0] || null;
76554
- load();
76555
- Laze.subscribe(name, load);
76556
- }, Laze.fail);
76557
- })();
76558
- `;
76559
- var SUMMARY_FUNCTION = `// A server function: the app's origin answers /_laze/fn/summary by running this file.
76560
- // env.LAZE reads and writes this app's records as the person who asked; there is no other network.
76561
- export default {
76562
- async fetch(request, env) {
76563
- const page = await env.LAZE.records("items").list({ filter: "status != 'done'", perPage: 500 });
76564
- const today = new Date().toISOString().slice(0, 10);
76565
- const byStatus = {};
76566
- const byOwner = {};
76567
- let overdue = 0;
76568
- for (const item of page.items) {
76569
- byStatus[item.status] = (byStatus[item.status] || 0) + 1;
76570
- const owner = item.owner || "Unassigned";
76571
- byOwner[owner] = (byOwner[owner] || 0) + 1;
76572
- if (item.due && item.due.slice(0, 10) < today) overdue += 1;
76573
- }
76574
- console.log("summarised", page.totalItems, "open items");
76575
- return Response.json({ open: page.totalItems, overdue, byStatus, byOwner });
76576
- },
76577
- };
76578
- `;
76579
- var TRACKER_TEMPLATE = {
76580
- title: "Tracker",
76581
- summary: "A list of items with a status you click forward; the page follows the fields in laze.app.json",
76582
- appJs: APP_JS4,
76583
- functions: { summary: SUMMARY_FUNCTION },
76584
- collections: {
76585
- items: {
76586
- fields: [
76587
- { name: "title", type: "text", required: true },
76588
- { name: "owner", type: "text" },
76589
- { name: "due", type: "date" },
76590
- { name: "status", type: "select", options: ["todo", "doing", "done"], default: "todo" }
76591
- ]
76592
- }
76593
- },
76594
- views: [
76595
- {
76596
- name: "Board by status",
76597
- collection: "items",
76598
- type: "board",
76599
- groupBy: "status",
76600
- fields: ["owner", "due"]
76601
- }
76602
- ],
76603
- seed: {
76604
- items: [
76605
- { title: "Send the October invoices", owner: "Ada", status: "doing", due: "2026-10-20" },
76606
- { title: "Renew the ACME contract", owner: "Ben", status: "todo", due: "2026-10-28" },
76607
- { title: "Book the offsite venue", owner: "Cleo", status: "done", due: "2026-10-10" }
76608
- ]
76609
- }
76610
- };
76611
-
76612
- // src/templates/app-templates.ts
76613
- var STARTER_TEMPLATES = {
76614
- tracker: TRACKER_TEMPLATE,
76615
- crm: CRM_TEMPLATE,
76616
- dashboard: DASHBOARD_TEMPLATE,
76617
- form: FORM_TEMPLATE
76618
- };
76619
- function templateFiles({
76620
- template,
76621
- name: name3
76622
- }) {
76623
- return {
76624
- "index.html": indexHtml({ title: name3.replaceAll("&", "&amp;").replaceAll("<", "&lt;") }),
76625
- "app.js": template.appJs,
76626
- ...Object.fromEntries(
76627
- Object.entries(template.functions ?? {}).map(([fn, source]) => [
76628
- `functions/${fn}.js`,
76629
- source
76630
- ])
76631
- )
76632
- };
76633
- }
76634
-
76635
76433
  // src/services/app-connection-commands.service.ts
76636
76434
  var USAGE2 = `Usage:
76637
76435
  laze app connections
@@ -77394,13 +77192,7 @@ function print5({
77394
77192
  var appCreate = async ({ context, args }) => {
77395
77193
  const name3 = args.words.slice(2).join(" ").trim();
77396
77194
  if (!name3) throw new CliUsageError(USAGE5);
77397
- const templateName = flagText({ args, name: "template" });
77398
- if (templateName && !APP_TEMPLATES.includes(templateName)) {
77399
- throw new CliUsageError(
77400
- `No template called ${templateName}: pick one of ${APP_TEMPLATES.join(", ")}`
77401
- );
77402
- }
77403
- const template = templateName ? STARTER_TEMPLATES[templateName] : void 0;
77195
+ const template = flagText({ args, name: "template" });
77404
77196
  const client = await appClient({ context, args });
77405
77197
  const channel = flagText({ args, name: "channel" });
77406
77198
  const slug = flagText({ args, name: "slug" });
@@ -77409,32 +77201,67 @@ var appCreate = async ({ context, args }) => {
77409
77201
  name: name3,
77410
77202
  ...slug ? { slug } : {},
77411
77203
  ...channel ? { channel } : {},
77412
- ...visibility ? { visibility } : {}
77204
+ ...visibility ? { visibility } : {},
77205
+ ...template ? { template } : {}
77413
77206
  });
77414
77207
  const folder = resolve6(context.cwd, flagText({ args, name: "dir", fallback: app2.slug }));
77415
77208
  await mkdir16(folder, { recursive: true });
77416
- const files2 = template ? templateFiles({ template, name: name3 }) : {};
77417
- for (const [path, content] of Object.entries(files2)) {
77418
- await mkdir16(dirname16(join20(folder, path)), { recursive: true });
77419
- await writeFile16(join20(folder, path), content);
77209
+ const start2 = template ? await templateStart({ client, appId: app2.id, template }) : null;
77210
+ for (const file3 of start2?.files ?? []) {
77211
+ const target = join20(folder, ...file3.path.split("/"));
77212
+ await mkdir16(dirname16(target), { recursive: true });
77213
+ await writeFile16(
77214
+ target,
77215
+ file3.encoding === "base64" ? Buffer.from(file3.content, "base64") : file3.content
77216
+ );
77420
77217
  }
77421
77218
  const manifest = {
77422
77219
  app: { id: app2.id, name: app2.name, slug: app2.slug },
77423
- collections: template ? { ...template.collections } : {},
77424
- views: template?.views ? [...template.views] : [],
77425
- seed: template ? { ...template.seed } : {}
77220
+ collections: { ...start2?.template.collections },
77221
+ views: [...start2?.template.views ?? []],
77222
+ seed: { ...start2?.template.seed }
77426
77223
  };
77427
77224
  await writeFile16(join20(folder, APP_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}
77428
77225
  `);
77226
+ const where = relative3(context.cwd, folder) || ".";
77429
77227
  print5({
77430
77228
  context,
77431
77229
  args,
77432
77230
  value: { app: app2, folder },
77433
- text: `Created ${app2.name} (${app2.id}) in ${relative3(context.cwd, folder) || "."}${template ? ` from the ${templateName} template` : ""}.
77434
- Next: cd ${relative3(context.cwd, folder) || "."} && laze app push -m "First version" --seed
77231
+ text: start2 ? `Created ${app2.name} (${app2.id}) from the ${template} template in ${where}; its first version is live at ${app2.publishedUrl}.
77232
+ Next: change the files in ${where} (start with README.md when there is one), then laze app push -m "<what changed>"
77233
+ ` : `Created ${app2.name} (${app2.id}) in ${where}.
77234
+ Next: cd ${where} && laze app push -m "First version" --seed
77435
77235
  `
77436
77236
  });
77437
77237
  };
77238
+ async function templateStart({
77239
+ client,
77240
+ appId,
77241
+ template
77242
+ }) {
77243
+ const [pulled, templates2] = await Promise.all([
77244
+ client.post("/api/apps/pull", { appId }),
77245
+ client.get("/api/apps/templates")
77246
+ ]);
77247
+ const found = templates2.find((entry) => entry.name === template);
77248
+ if (!found) throw new CliUsageError(`No template called ${template}`);
77249
+ return { files: pulled.files, template: found };
77250
+ }
77251
+ var appTemplates = async ({ context, args }) => {
77252
+ const client = await appClient({ context, args });
77253
+ const templates2 = await client.get("/api/apps/templates");
77254
+ const lines2 = templates2.map(
77255
+ (template) => `${template.name} v${template.version} ${template.description}
77256
+ `
77257
+ );
77258
+ print5({
77259
+ context,
77260
+ args,
77261
+ value: templates2,
77262
+ text: lines2.join("") + 'Start one with laze app create "<name>" --template <template>; its files are yours to change.\n'
77263
+ });
77264
+ };
77438
77265
  var appList = async ({ context, args }) => {
77439
77266
  const client = await appClient({ context, args });
77440
77267
  const apps = await client.get("/api/apps");
@@ -77521,6 +77348,45 @@ var appPush = async ({ context, args }) => {
77521
77348
  ` + (seeded ? seedLine(seeded) : "") + publishLine(publish)
77522
77349
  });
77523
77350
  };
77351
+ var appWrite = async ({ context, args }) => {
77352
+ const { message: message2, words } = messageOf({ args });
77353
+ const verdict = versionMessageVerdict(message2);
77354
+ if (verdict !== "ok") {
77355
+ throw new CliUsageError(
77356
+ `laze: a write needs -m "<what changed, in plain words>", such as -m "Agenda names the three goals" (${verdict})`
77357
+ );
77358
+ }
77359
+ const folder = folderOf({ context, word: void 0 });
77360
+ const remove7 = (flagText({ args, name: "remove" }) ?? "").split(",").map((path) => path.trim()).filter(Boolean);
77361
+ const files2 = await Promise.all(
77362
+ words.slice(2).map(async (word3) => {
77363
+ const path = resolve6(context.cwd, word3);
77364
+ const { bytes: _bytes, ...file3 } = buildFileOf({
77365
+ path: relative3(folder, path).split(sep3).join("/"),
77366
+ bytes: await readFile18(path)
77367
+ });
77368
+ return file3;
77369
+ })
77370
+ );
77371
+ if (files2.length + remove7.length === 0) {
77372
+ throw new CliUsageError("laze app write needs a file to write or --remove <path,...>");
77373
+ }
77374
+ const client = await appClient({ context, args });
77375
+ const appId = await appIdOf({ client, args, folder });
77376
+ const { publish, ...version2 } = await client.post("/api/apps/files/write", {
77377
+ appId,
77378
+ files: files2,
77379
+ remove: remove7,
77380
+ message: message2
77381
+ });
77382
+ print5({
77383
+ context,
77384
+ args,
77385
+ value: { version: version2, app: publish.app, publish },
77386
+ text: `Wrote ${version2.version.slice(0, 7)} "${version2.message}" (${files2.length} written, ${remove7.length} removed)
77387
+ ` + publishLine(publish)
77388
+ });
77389
+ };
77524
77390
  function seedLine(seeded) {
77525
77391
  const created = Object.entries(seeded.created).map(([name3, count5]) => `${count5} in ${name3}`);
77526
77392
  const parts = [
@@ -78278,8 +78144,10 @@ function managed(command) {
78278
78144
  }
78279
78145
  var APP_COMMANDS = {
78280
78146
  create: appCreate,
78147
+ templates: appTemplates,
78281
78148
  list: appList,
78282
78149
  push: appPush,
78150
+ write: appWrite,
78283
78151
  url: appUrl,
78284
78152
  preview: appUrl,
78285
78153
  serve: appServe,
@@ -81487,6 +81355,8 @@ var computeConfig = Config.define((c) => ({
81487
81355
  var priceId = external_exports.string().min(1).optional();
81488
81356
  var billingConfig = Config.define((c) => ({
81489
81357
  publicBaseUrl,
81358
+ /** The first alias (`laze.so` on prod) is the short origin referral links are shared on. */
81359
+ publicOriginAliases,
81490
81360
  /** Stripe's API, or the payment simulator in tests and local stacks. */
81491
81361
  stripeApiBase: c.env("STRIPE_API_BASE", external_exports.url().default("https://api.stripe.com")),
81492
81362
  /** Team's graduated per-person price (`TEAM_PRICING`), one quantity per person. */
@@ -84181,6 +84051,7 @@ function conversationLineOf(chat) {
84181
84051
  // src/services/conversation-commands.service.ts
84182
84052
  var CONVERSATION_USAGE = `Usage:
84183
84053
  laze conversation new <agent> <text|-> start a conversation with an agent (people)
84054
+ [--about <message id>] continue from a message: the first one quotes it
84184
84055
  laze conversation list [--agent <agent>] yours (an agent: its own; --unnamed for untitled)
84185
84056
  laze conversation rename <id> <title> name it (its agent, or a person in it)
84186
84057
  laze conversation join <id> open one of an agent shared with you
@@ -84201,9 +84072,11 @@ async function conversationNew({ context, args }) {
84201
84072
  text: typed,
84202
84073
  leaves: async () => false
84203
84074
  });
84075
+ const about = flagText({ args, name: "about" });
84204
84076
  const started = await client.post("/api/agents/me/conversations", {
84205
84077
  agent: agent3,
84206
- text: text2
84078
+ text: text2,
84079
+ ...about ? { about } : {}
84207
84080
  });
84208
84081
  if (args.flags.json) return context.out(`${JSON.stringify(started, null, 2)}
84209
84082
  `);
@@ -92599,7 +92472,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
92599
92472
  laze emoji list | add <name> <file> [--alias <a,b>] | alias <alias> <name> | remove <name> the workspace's custom emoji
92600
92473
  laze status set <emoji> [text] [--for 30m|1h|4h|today|week|never] your status next to your name (people)
92601
92474
  laze status clear | away | active clear it, or set yourself away by hand until active
92602
- laze conversation new <agent> <text|-> start a conversation with an agent; it names it
92475
+ laze conversation new <agent> <text|-> [--about <message id>] start a conversation with an agent; it names it
92603
92476
  laze conversation list [--agent <agent>] [--unnamed] your conversations with agents
92604
92477
  laze conversation rename <id> <title> name a conversation (its agent, or a person in it)
92605
92478
  laze conversation join|close <id> open one of an agent shared with you, or leave it
@@ -92643,7 +92516,7 @@ var HELP = `laze: work in a Laze workspace from your terminal or your agent.
92643
92516
  laze memory get|set|append|history <file>, search, pull SOUL.md, AGENTS.md, a channel's MEMORY.md
92644
92517
  laze wiki list|get|put|search|history|mv|rm the workspace wiki
92645
92518
  laze skill list|install|show|pull|rm|update|pin|unpin your agent's skills and the catalogue
92646
- laze app create <name> --template crm ... build an app: create, push (live at once), versions, revert
92519
+ laze app create <name> --template slides ... build an app from a template (laze app templates), push, revert
92647
92520
  laze app every laze app command, with its flags
92648
92521
  laze agents list | laze agents status <name> the workspace's agents and their context
92649
92522
  laze agents show <name> [--json] an agent's profile: kind, how it runs, intelligence