@8wave/ai-elements 0.104.0 → 0.105.0-beta.1
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.
- package/dist/_chunks/{Agent-DG4nPG72.js → Agent-VhugusRf.js} +2 -2
- package/dist/_chunks/Agent-VhugusRf.js.map +1 -0
- package/dist/_chunks/{Document-DXkvvAnt.js → Document-DjNrISX1.js} +2 -2
- package/dist/_chunks/{Document-DXkvvAnt.js.map → Document-DjNrISX1.js.map} +1 -1
- package/dist/_chunks/{Media-3Mo4NRj7.js → Media-hjgDyEMr.js} +2 -2
- package/dist/_chunks/Media-hjgDyEMr.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js → PkStreamingMarkdown-B4eMb97I.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-YKd9F3xU.js.map → PkStreamingMarkdown-B4eMb97I.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-sf6LpUN_.js → PkToolRequestGeolocation-Bp-D2nDb.js} +3 -3
- package/{dist-vue/_chunks/PkToolRequestGeolocation-BdX5DzEN.js.map → dist/_chunks/PkToolRequestGeolocation-Bp-D2nDb.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js → PkToolRequestOAuthConnection-CjjyDj9A.js} +3 -3
- package/dist/_chunks/{PkToolRequestOAuthConnection-BB8mlQit.js.map → PkToolRequestOAuthConnection-CjjyDj9A.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js → PkToolShowArtifact-Dl8f7Q7q.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-54saXXCe.js.map → PkToolShowArtifact-Dl8f7Q7q.js.map} +1 -1
- package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js → PkToolShowCalendarEvent-B_QmZrlZ.js} +2 -2
- package/dist/_chunks/{PkToolShowCalendarEvent-B_HPVUDk.js.map → PkToolShowCalendarEvent-B_QmZrlZ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js → PkToolShowContactForm-CXE0485W.js} +14 -14
- package/dist/_chunks/{PkToolShowContactForm-BtcNCixq.js.map → PkToolShowContactForm-CXE0485W.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js → PkToolShowDiagram-D-TyCkCB.js} +2 -2
- package/dist/_chunks/{PkToolShowDiagram-cA64c2_N.js.map → PkToolShowDiagram-D-TyCkCB.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-DdBAG0Qs.js → PkToolShowForm-BzaibKAz.js} +101 -115
- package/dist/_chunks/PkToolShowForm-BzaibKAz.js.map +1 -0
- package/dist/_chunks/{PkToolShowSources-0qudS-bu.js → PkToolShowSources-CoTIoupP.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-0qudS-bu.js.map → PkToolShowSources-CoTIoupP.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js → PkToolShowSuggestedReply-DA2Bi7k4.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-B2IB6ioR.js.map → PkToolShowSuggestedReply-DA2Bi7k4.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js → PkToolShowWeather-ChDHtOLz.js} +2 -2
- package/dist/_chunks/{PkToolShowWeather-Bl3Yoscl.js.map → PkToolShowWeather-ChDHtOLz.js.map} +1 -1
- package/dist/_chunks/{browser-DuzNfJq0.js → browser-BXy4OnXA.js} +804 -779
- package/dist/_chunks/browser-BXy4OnXA.js.map +1 -0
- package/dist/_chunks/index.es-CnpsLhp_.js +1006 -0
- package/dist/_chunks/index.es-CnpsLhp_.js.map +1 -0
- package/dist/_chunks/utils-DtJdKlnF.js +185 -0
- package/dist/_chunks/utils-DtJdKlnF.js.map +1 -0
- package/dist/_chunks/{vue-i18n-_ouwlDGE.js → vue-i18n-C3J36GV4.js} +2 -2
- package/dist/_chunks/{vue-i18n-_ouwlDGE.js.map → vue-i18n-C3J36GV4.js.map} +1 -1
- package/dist/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
- package/dist/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
- package/dist/ai-elements.es.js +2100 -2159
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-gCuDMxHN.js → Agent-CpIgGdU4.js} +2 -2
- package/dist-vue/_chunks/Agent-CpIgGdU4.js.map +1 -0
- package/dist-vue/_chunks/{Document-iH61Cw06.js → Document-CiaGPYTR.js} +2 -2
- package/dist-vue/_chunks/{Document-iH61Cw06.js.map → Document-CiaGPYTR.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js → PkChatbot-xmjKbljL.js} +7 -7
- package/dist-vue/_chunks/{PkChatbot-Bg9oercD.js.map → PkChatbot-xmjKbljL.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js → PkChatbotMessages-tHQ2JQrb.js} +75 -75
- package/dist-vue/_chunks/{PkChatbotMessages-DUQxuYaG.js.map → PkChatbotMessages-tHQ2JQrb.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js → PkChatbotStepPayload-BtsnkJIV.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-hCmy4XG9.js.map → PkChatbotStepPayload-BtsnkJIV.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-B0WU0HcD.js → PkChatbotStepToolDetail-CCa95eBO.js} +116 -101
- package/dist-vue/_chunks/PkChatbotStepToolDetail-CCa95eBO.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js +180 -0
- package/dist-vue/_chunks/PkChatbotSteps-CPBzs7Gi.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js → PkChatbotViewChat-CdiPjQLq.js} +6 -6
- package/dist-vue/_chunks/{PkChatbotViewChat-YwjWNoqf.js.map → PkChatbotViewChat-CdiPjQLq.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js → PkChatbotViewConversations-BP-NJvlK.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-vo57eSwy.js.map → PkChatbotViewConversations-BP-NJvlK.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js → PkChatbotViewFiles-DRUVmxU5.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-DDPugn7F.js.map → PkChatbotViewFiles-DRUVmxU5.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js → PkChatbotViewProfile-ywvIs6N5.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-Dww5KI21.js.map → PkChatbotViewProfile-ywvIs6N5.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-BdX5DzEN.js → PkToolRequestGeolocation-BdIyXoPQ.js} +2 -2
- package/{dist/_chunks/PkToolRequestGeolocation-sf6LpUN_.js.map → dist-vue/_chunks/PkToolRequestGeolocation-BdIyXoPQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js → PkToolRequestOAuthConnection-Dnch7xAB.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BUmnRgMi.js.map → PkToolRequestOAuthConnection-Dnch7xAB.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js → PkToolShowDiagram-DgLxNNp7.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-YMo-iVWr.js.map → PkToolShowDiagram-DgLxNNp7.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-D2n2rA6J.js → PkToolShowForm-6eLi6Wr0.js} +103 -117
- package/dist-vue/_chunks/PkToolShowForm-6eLi6Wr0.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js → PkToolShowSources-DTJgvDiB.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-DUAsrrzC.js.map → PkToolShowSources-DTJgvDiB.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js → PkToolShowSuggestedReply-D9RY2h6Z.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-Dm28RIJF.js.map → PkToolShowSuggestedReply-D9RY2h6Z.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js → createChatbotApiClient-12eL7hul.js} +2 -2
- package/dist-vue/_chunks/{createChatbotApiClient-CAX-3-oK.js.map → createChatbotApiClient-12eL7hul.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-Rj18hAUf.js → useChatbotStore-Chtzi5jc.js} +1086 -1016
- package/dist-vue/_chunks/useChatbotStore-Chtzi5jc.js.map +1 -0
- package/dist-vue/_chunks/{utils-B0jsOUqd.js → utils-DKNWwMTQ.js} +46 -23
- package/dist-vue/_chunks/utils-DKNWwMTQ.js.map +1 -0
- package/dist-vue/_chunks/{web-DnPxEADy.js → web-CzR5jWfC.js} +46 -45
- package/dist-vue/_chunks/{web-DnPxEADy.js.map → web-CzR5jWfC.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +3 -3
- package/dist-vue/index.js +259 -259
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +10 -4
- package/dist-vue/packages/components/src/PkEditorRepeater.d.ts +1 -1
- package/dist-vue/packages/components/src/chat/constants.d.ts +12 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +37 -0
- package/dist-vue/packages/models/src/schema/Agent.d.ts +24 -16
- package/dist-vue/packages/models/src/schema/AgentChatStatistics.d.ts +1 -1
- package/dist-vue/packages/models/src/schema/Chat.d.ts +9 -9
- package/dist-vue/packages/models/src/schema/Document.d.ts +6 -6
- package/dist-vue/packages/models/src/schema/DocumentFolder.d.ts +0 -1
- package/dist-vue/packages/models/src/schema/McpServer.d.ts +2 -2
- package/dist-vue/packages/models/src/schema/Member.d.ts +2 -2
- package/dist-vue/packages/models/src/schema/Organization.d.ts +4 -4
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +29 -29
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +20 -20
- package/dist-vue/packages/models/src/schema/User.d.ts +6 -6
- package/dist-vue/packages/models/src/schema/constants.d.ts +2 -0
- package/package.json +10 -5
- package/dist/_chunks/Agent-DG4nPG72.js.map +0 -1
- package/dist/_chunks/Media-3Mo4NRj7.js.map +0 -1
- package/dist/_chunks/PkToolShowForm-DdBAG0Qs.js.map +0 -1
- package/dist/_chunks/browser-DuzNfJq0.js.map +0 -1
- package/dist/_chunks/index.es-DXx8DNKf.js +0 -2986
- package/dist/_chunks/index.es-DXx8DNKf.js.map +0 -1
- package/dist-vue/_chunks/Agent-gCuDMxHN.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotStepToolDetail-B0WU0HcD.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js +0 -177
- package/dist-vue/_chunks/PkChatbotSteps-BrvTsAeZ.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowForm-D2n2rA6J.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-Rj18hAUf.js.map +0 -1
- package/dist-vue/_chunks/utils-B0jsOUqd.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as e, _ as t, a as n, b as r, d as i, f as a, g as o, h as s, i as c, l, n as u, o as d, v as f, x as p } from "./schemas-U769m8P5.js";
|
|
2
|
-
import { a as ee, c as te, l as m, n as ne, s as h, t as re, u as g } from "./Media-
|
|
2
|
+
import { a as ee, c as te, l as m, n as ne, s as h, t as re, u as g } from "./Media-hjgDyEMr.js";
|
|
3
3
|
//#region ../../packages/models/src/schema/DeviceContext.ts
|
|
4
4
|
var _ = o({
|
|
5
5
|
dateTime: f().optional(),
|
|
@@ -452,4 +452,4 @@ l("requiresAuth", [Q, $]), l("requiresAuth", [Q.extend({ authMethods: Z }), $.ex
|
|
|
452
452
|
//#endregion
|
|
453
453
|
export { x as a, xe as c, _ as d, A as i, de as l, G as n, v as o, R as r, P as s, j as t, pe as u };
|
|
454
454
|
|
|
455
|
-
//# sourceMappingURL=Agent-
|
|
455
|
+
//# sourceMappingURL=Agent-VhugusRf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Agent-VhugusRf.js","names":[],"sources":["../../../../packages/models/src/schema/DeviceContext.ts","../../../../packages/models/src/schema/Agent.ts"],"sourcesContent":["import * as z from 'zod'\n\n/**\n * What the client knows about the device the conversation is happening on.\n *\n * Its own module rather than part of `Chat`: both the chat request and the\n * voice session request carry it, and `Chat` already imports `Agent`, so\n * keeping it there would make the two import each other.\n */\nexport const DeviceContextSchema = z.object({\n dateTime: z.string().optional(),\n timezone: z.string().optional(),\n language: z.string().optional(),\n languages: z.array(z.string()).optional(),\n url: z.string().optional(),\n pathname: z.string().optional(),\n pageTitle: z.string().optional(),\n referrer: z.string().optional(),\n screenWidth: z.number().optional(),\n screenHeight: z.number().optional(),\n viewportWidth: z.number().optional(),\n viewportHeight: z.number().optional(),\n devicePixelRatio: z.number().optional(),\n maxTouchPoints: z.number().optional(),\n hardwareConcurrency: z.number().optional(),\n deviceMemory: z.number().optional(),\n platform: z.string().optional(),\n connectionType: z.string().optional(),\n connectionEffectiveType: z.string().optional(),\n connectionDownlink: z.number().optional(),\n connectionRtt: z.number().optional(),\n saveData: z.boolean().optional(),\n darkMode: z.boolean().optional(),\n reducedMotion: z.boolean().optional(),\n historyLength: z.number().optional(),\n geolocationLatitude: z.number().optional(),\n geolocationLongitude: z.number().optional(),\n geolocationAccuracy: z.number().optional(),\n geolocationCity: z.string().optional(),\n})\n\nexport type DeviceContext = z.infer<typeof DeviceContextSchema>\n","import * as z from 'zod'\nimport { zodQs, jsonSchemaField, decodeOnly } from '../utils'\nimport { LanguageModel } from './constants'\nimport { DeviceContextSchema } from './DeviceContext'\nimport { MediaSchema, MIME_TYPE_REGEX } from './Media'\n\nexport enum AgentStatus {\n Draft = 'draft',\n Active = 'active',\n Inactive = 'inactive',\n}\n\nexport enum AgentVisibility {\n Public = 'public',\n Private = 'private',\n Organization = 'organization',\n}\n\nexport enum AgentType {\n Chat = 'chat',\n Reasoning = 'reasoning',\n}\n\nexport enum AgentSearchMode {\n Semantic = 'semantic',\n Balanced = 'balanced',\n Keyword = 'keyword',\n}\n\n/**\n * Provider-specific reasoning configurations.\n *\n * Four providers have a reasoning API of their own to model:\n * - OpenAI (GPT-5, o-series): `reasoningEffort` + `reasoningSummary`\n * - Anthropic (Claude 4.6+): adaptive thinking with `effort` levels, or legacy `budgetTokens`\n * - Google (Gemini 3/3.1): `thinkingLevel`; Gemini 2.5: `thinkingBudget`\n * - DeepSeek: on/off thinking toggle\n *\n * Everything else in the catalog (Alibaba, Meta, Moonshot AI, xAI, z.ai) is one\n * effort level and shares {@link GenericReasoningSchema}.\n *\n * Only the matching provider's config is used at runtime (based on model prefix).\n * Admins can pre-configure multiple providers for easy model switching.\n */\n\n/**\n * Levels each provider accepts, exported so the agent form builds its fields\n * from the same list the request is validated against. They were written twice,\n * once here and once in the template, and the two drifted: `max` reached the\n * OpenAI API with the 5.6 family and was added to the form for Anthropic only,\n * so an OpenAI agent could not be configured for a level the provider had.\n */\nexport const OPENAI_REASONING_EFFORTS = [\n 'none',\n 'low',\n 'medium',\n 'high',\n 'xhigh',\n 'max',\n] as const\nexport const ANTHROPIC_THINKING_EFFORTS = [\n 'low',\n 'medium',\n 'high',\n 'xhigh',\n 'max',\n] as const\nexport const GOOGLE_THINKING_LEVELS = [\n 'minimal',\n 'low',\n 'medium',\n 'high',\n] as const\nexport const OPENAI_REASONING_SUMMARIES = [\n 'auto',\n 'detailed',\n 'concise',\n] as const\n\nexport const OpenAIReasoningSchema = z.object({\n reasoningEffort: z.enum(OPENAI_REASONING_EFFORTS).optional(),\n reasoningSummary: z.enum(OPENAI_REASONING_SUMMARIES).optional(),\n})\nexport type OpenAIReasoning = z.infer<typeof OpenAIReasoningSchema>\n\nexport const AnthropicReasoningSchema = z.object({\n type: z.enum(['adaptive', 'enabled', 'disabled']).optional(),\n effort: z.enum(ANTHROPIC_THINKING_EFFORTS).optional(),\n display: z.enum(['summarized', 'omitted']).optional(),\n budgetTokens: z.number().int().positive().optional(),\n})\nexport type AnthropicReasoning = z.infer<typeof AnthropicReasoningSchema>\n\nexport const GoogleReasoningSchema = z.object({\n thinkingLevel: z.enum(GOOGLE_THINKING_LEVELS).optional(),\n thinkingBudget: z.number().int().optional(),\n includeThoughts: z.boolean().optional(),\n})\nexport type GoogleReasoning = z.infer<typeof GoogleReasoningSchema>\n\nexport const DeepSeekReasoningSchema = z.object({\n type: z.enum(['enabled', 'disabled']).optional(),\n})\nexport type DeepSeekReasoning = z.infer<typeof DeepSeekReasoningSchema>\n\n/**\n * Providers whose whole reasoning configuration is one effort level.\n *\n * They expose no reasoning API of their own to model: the standardized AI SDK\n * effort is the only knob, and the gateway maps it onto whatever each model\n * accepts. One shape covers them all, so a new brand costs a line here instead\n * of a schema, a runtime branch and a form.\n *\n * Verified against the gateway on 2026-08-25: every catalog model of these\n * families advertises the `reasoning` parameter, a family that only offers\n * `high`/`xhigh` clamps a lower level instead of rejecting the request, and\n * `none` does bring reasoning tokens to zero.\n */\nexport const GENERIC_REASONING_PROVIDERS = [\n 'alibaba',\n 'meta',\n 'moonshotai',\n 'spacexai',\n 'zai',\n] as const\n\nexport type GenericReasoningProvider =\n (typeof GENERIC_REASONING_PROVIDERS)[number]\n\nexport function isGenericReasoningProvider(\n provider: string,\n): provider is GenericReasoningProvider {\n return (GENERIC_REASONING_PROVIDERS as readonly string[]).includes(provider)\n}\n\n/**\n * The standardized AI SDK effort union minus `provider-default`, which is what\n * an absent configuration already means: offering it as a value would give the\n * form two ways to say the same thing.\n */\nexport const GENERIC_REASONING_EFFORTS = [\n 'none',\n 'minimal',\n 'low',\n 'medium',\n 'high',\n 'xhigh',\n] as const\n\nexport const GenericReasoningSchema = z.object({\n reasoningEffort: z.enum(GENERIC_REASONING_EFFORTS).optional(),\n})\nexport type GenericReasoning = z.infer<typeof GenericReasoningSchema>\n\n/**\n * A legacy value on the target provider's own scale, or `undefined` when that\n * scale cannot express it.\n *\n * The legacy format stored one OpenAI level for every provider and the\n * migration copied it over verbatim, so a value the target enum does not have\n * (`xhigh` on Google, `minimal` on OpenAI) failed the codec's own output\n * validation: reading such an agent threw instead of migrating it. Leaving the\n * provider out instead puts it on the platform default, which is a\n * configuration every provider accepts.\n */\nfunction legacyLevel<T extends string>(\n value: string | undefined,\n accepted: readonly T[],\n): T | undefined {\n return value && (accepted as readonly string[]).includes(value)\n ? (value as T)\n : undefined\n}\n\n/**\n * Migrates legacy format `{ effort: 'high', reasoningSummary: 'auto' }` to the new\n * per-provider format. Applied via preprocess so old DB data auto-migrates on parse.\n */\nconst AgentReasoningObjectSchema = z.object({\n openai: OpenAIReasoningSchema.optional(),\n anthropic: AnthropicReasoningSchema.optional(),\n google: GoogleReasoningSchema.optional(),\n deepseek: DeepSeekReasoningSchema.optional(),\n alibaba: GenericReasoningSchema.optional(),\n meta: GenericReasoningSchema.optional(),\n moonshotai: GenericReasoningSchema.optional(),\n spacexai: GenericReasoningSchema.optional(),\n zai: GenericReasoningSchema.optional(),\n})\n\ntype AgentReasoningInput = z.input<typeof AgentReasoningObjectSchema>\n\nfunction migrateReasoningConfig(val: unknown): AgentReasoningInput {\n if (!val || typeof val !== 'object') {\n // Output validity is enforced by the codec's output schema at runtime.\n return val as AgentReasoningInput\n }\n const obj = val as Record<string, unknown>\n // Detect legacy format: has `effort` key with old enum values\n const isAlreadyMigrated = [\n 'openai',\n 'anthropic',\n 'google',\n 'deepseek',\n ...GENERIC_REASONING_PROVIDERS,\n ].some((provider) => provider in obj)\n if ('effort' in obj && !isAlreadyMigrated) {\n const effort = obj.effort as string | undefined\n const reasoningSummary = obj.reasoningSummary as string | undefined\n const migrated: Record<string, unknown> = {}\n\n // `off` is the legacy spelling of \"do not think\", `none` is the same\n // instruction in the vocabulary the providers ended up using: both must\n // reach the branch that disables, or an agent that asked for silence\n // starts reasoning again on every provider that has a default.\n const thinks = !!effort && effort !== 'off' && effort !== 'none'\n if (thinks) {\n const openaiEffort = legacyLevel(effort, OPENAI_REASONING_EFFORTS)\n const summary = legacyLevel(\n reasoningSummary,\n OPENAI_REASONING_SUMMARIES,\n )\n if (openaiEffort || summary) {\n migrated.openai = {\n ...(openaiEffort && { reasoningEffort: openaiEffort }),\n ...(summary && { reasoningSummary: summary }),\n }\n }\n const anthropicEffort = legacyLevel(\n effort,\n ANTHROPIC_THINKING_EFFORTS,\n )\n if (anthropicEffort) {\n migrated.anthropic = {\n type: 'adaptive' as const,\n effort: anthropicEffort,\n }\n }\n // Google's scale stops at `high`: `xhigh` and `max` are OpenAI\n // levels, so they land on the highest level it does have.\n const googleLevel = legacyLevel(\n effort === 'xhigh' || effort === 'max' ? 'high' : effort,\n GOOGLE_THINKING_LEVELS,\n )\n if (googleLevel) {\n migrated.google = { thinkingLevel: googleLevel }\n }\n migrated.deepseek = { type: 'enabled' as const }\n // Same for the single-level providers, whose highest level is\n // `xhigh`.\n const genericEffort = legacyLevel(\n effort === 'max' ? 'xhigh' : effort,\n GENERIC_REASONING_EFFORTS,\n )\n if (genericEffort) {\n for (const provider of GENERIC_REASONING_PROVIDERS) {\n migrated[provider] = { reasoningEffort: genericEffort }\n }\n }\n } else {\n // 'off' must stay off on every provider, not just the two that had\n // an explicit disable. Leaving anthropic and google absent made the\n // runtime send no directive at all (`getReasoningOptions` returns\n // nothing without a provider config), so switching such an agent to\n // Claude or Gemini silently turned thinking back on: the config said\n // off, the model reasoned, and the first token paid for it.\n migrated.openai = { reasoningEffort: 'none' }\n migrated.anthropic = { type: 'disabled' as const }\n // Gemini 3+ cannot disable thinking (the budget is clamped to >= 1),\n // so the lowest level available is what 'off' can mean there.\n migrated.google = { thinkingLevel: 'minimal' as const }\n migrated.deepseek = { type: 'disabled' as const }\n for (const provider of GENERIC_REASONING_PROVIDERS) {\n migrated[provider] = { reasoningEffort: 'none' as const }\n }\n }\n return migrated as AgentReasoningInput\n }\n return val as AgentReasoningInput\n}\n\n// Codec instead of z.preprocess: the legacy-format migration only runs on\n// decode, while encode (used by response serialization) is the identity.\n// `.optional()` wraps the codec (not the inner object) so a missing\n// `reasoning` key still parses, matching the old z.preprocess semantics.\nexport const AgentReasoningSchema = decodeOnly(\n z.unknown(),\n AgentReasoningObjectSchema,\n migrateReasoningConfig,\n).optional()\n\nexport type AgentReasoning = z.infer<typeof AgentReasoningSchema>\n\n/** Provider an agent model belongs to, from its `provider/model` id. */\nexport function modelProvider(model: string): string {\n const [provider = ''] = model.split('/')\n return provider\n}\n\n/**\n * Explicit reasoning configuration for an agent that has none for the provider\n * it is running on.\n *\n * Without it the request carries no reasoning directive at all and the provider\n * applies its own default, which on the current families means thinking is ON:\n * measured on the turn-latency bench, **each reasoning token costs about 8ms of\n * time to first token** (~125 tok/s of decode), so a default nobody chose is\n * worth seconds per turn. The lowest tier that still reasons is the deliberate\n * choice: tool selection and the presentation contract both degrade when a chat\n * agent stops deliberating entirely, and that is a worse trade than the latency\n * it would buy.\n *\n * The single-level providers are here for the same reason, and it is measured\n * on them too: on 2026-08-25 a one-token `hi` sent to `spacexai/grok-4.6` with no\n * directive came back having spent 37 reasoning tokens, and 0 with an explicit\n * `none`. They accept the level (out-of-range clamps, it does not 400), so\n * there is no reason to leave them on a default nobody chose.\n *\n * DeepSeek is deliberately absent: its thinking is model-intrinsic and its\n * configuration here is a bare on/off toggle, with no level to ask for, so a\n * blanket directive could contradict the model itself. It is now the only\n * provider left on the provider's own default, and it stays there until someone\n * measures that family.\n */\nexport const DEFAULT_REASONING_BY_PROVIDER: NonNullable<AgentReasoning> = {\n openai: { reasoningEffort: 'low' },\n anthropic: { type: 'adaptive', effort: 'low' },\n google: { thinkingLevel: 'low' },\n alibaba: { reasoningEffort: 'low' },\n meta: { reasoningEffort: 'low' },\n moonshotai: { reasoningEffort: 'low' },\n spacexai: { reasoningEffort: 'low' },\n zai: { reasoningEffort: 'low' },\n}\n\n/**\n * Whether a per-provider block actually configures something.\n *\n * A block whose every value is `undefined` says nothing, and it is not a\n * hypothetical: clearing a combobox in the agent settings writes\n * `{ thinkingLevel: undefined }`, which becomes `{}` once the row round-trips\n * through jsonb. Treating that as \"configured\" would leave exactly the agents\n * this default exists for on the provider's own default.\n */\nfunction configuresSomething(config: unknown): boolean {\n return (\n !!config &&\n typeof config === 'object' &&\n Object.values(config).some((value) => value !== undefined)\n )\n}\n\n/**\n * What will actually reach `provider`: the agent's own block when it configures\n * anything, otherwise the platform default.\n *\n * Shared on purpose. The runtime reaches it through\n * {@link resolveEffectiveReasoning}, and the agent form calls it directly to\n * display the value: a form that showed an empty level while the turn sends\n * `low` would describe a behaviour that does not exist.\n *\n * Returns the stored block **by identity** when there is one, so a caller can\n * tell a configured value from a default with `===`.\n */\nexport function effectiveProviderReasoning<\n P extends keyof NonNullable<AgentReasoning>,\n>(\n provider: P,\n reasoning: AgentReasoning | null | undefined,\n): NonNullable<AgentReasoning>[P] {\n const configured = reasoning?.[provider]\n if (configuresSomething(configured)) {\n return configured\n }\n return DEFAULT_REASONING_BY_PROVIDER[provider]\n}\n\n/**\n * The reasoning configuration that will actually reach the provider: the\n * agent's own when it has one for this model's provider, otherwise the explicit\n * default above.\n *\n * Cross-provider is the case that motivated it: an agent configured for OpenAI\n * and switched to Gemini has `reasoning.openai` set and `reasoning.google`\n * empty, so before this it silently inherited Gemini's default.\n */\nexport function resolveEffectiveReasoning(\n model: string,\n reasoning: AgentReasoning | null | undefined,\n): AgentReasoning {\n const provider = modelProvider(model) as keyof NonNullable<AgentReasoning>\n const effective = effectiveProviderReasoning(provider, reasoning)\n // Nothing to add: either the agent configured this provider, or there is no\n // default for it (DeepSeek).\n if (!effective || effective === reasoning?.[provider]) {\n return reasoning ?? undefined\n }\n // Merged, not replaced: the other providers' configurations stay intact for\n // the day the agent is switched back to one of them.\n return { ...reasoning, [provider]: effective }\n}\n\n/**\n * Whether reasoning is effectively enabled for the given model.\n *\n * Mirrors the runtime semantics of `getReasoningOptions` (backend): only the\n * provider config matching the model prefix is considered, and an agent with no\n * config for that provider gets {@link DEFAULT_REASONING_BY_PROVIDER}, exactly\n * as the turn does. Note: for Anthropic with `display: 'omitted'` reasoning runs\n * but no reasoning parts are streamed to the client.\n */\nexport function isReasoningEnabled(\n model: string,\n agentReasoning: AgentReasoning | null | undefined,\n): boolean {\n const reasoning = resolveEffectiveReasoning(model, agentReasoning)\n if (!reasoning) {\n return false\n }\n\n const provider = modelProvider(model)\n\n if (provider === 'openai') {\n const config = reasoning.openai\n return Boolean(\n config?.reasoningEffort && config.reasoningEffort !== 'none',\n )\n }\n\n if (provider === 'anthropic') {\n const config = reasoning.anthropic\n return Boolean(config && config.type !== 'disabled')\n }\n\n if (provider === 'google') {\n const config = reasoning.google\n if (!config || config.thinkingBudget === 0) {\n return false\n }\n return Boolean(\n (config.thinkingLevel && config.thinkingLevel !== 'minimal') ||\n config.thinkingBudget ||\n config.includeThoughts,\n )\n }\n\n if (provider === 'deepseek') {\n return reasoning.deepseek?.type === 'enabled'\n }\n\n if (isGenericReasoningProvider(provider)) {\n const effort = reasoning[provider]?.reasoningEffort\n return Boolean(effort && effort !== 'none')\n }\n\n return false\n}\n\nexport enum AgentBuiltInTool {\n Geocode = 'geocode',\n GetWeather = 'getWeather',\n ReadDocumentFile = 'readDocumentFile',\n RequestConfirm = 'requestConfirm',\n RequestGeolocation = 'requestGeolocation',\n RetrieveRevisedAnswers = 'retrieveRevisedAnswers',\n SearchInKnowledgeBase = 'searchInKnowledgeBase',\n SearchInUserFiles = 'searchInUserFiles',\n UserMemory = 'userMemory',\n RunWorker = 'runWorker',\n FetchTeamsChannelHistory = 'fetchTeamsChannelHistory',\n ShowArtifact = 'showArtifact',\n ShowCalendarEvent = 'showCalendarEvent',\n ShowComparison = 'showComparison',\n ShowContactForm = 'showContactForm',\n ShowDiagram = 'showDiagram',\n ShowEmail = 'showEmail',\n ShowImageGallery = 'showImageGallery',\n ShowLocation = 'showLocation',\n ShowMessage = 'showMessage',\n ShowForm = 'showForm',\n ShowProductList = 'showProductList',\n ShowQrCode = 'showQrCode',\n ShowSources = 'showSources',\n ShowSuggestedReply = 'showSuggestedReply',\n ShowVideo = 'showVideo',\n ShowWeather = 'showWeather',\n ShowWebPages = 'showWebPages',\n // deprecated tools - to be removed in favor of more specific tools above\n ShowMultipleChoice = 'showMultipleChoice',\n}\n\n/**\n * Prefixes the runtime tool set uses for the tools an agent configures. They are\n * part of a contract shared by three places: the services that build the tool\n * set, the approval list that matches names against it, and the backoffice UI\n * that writes those names. A mismatch is silent (a name matching no tool simply\n * never gates anything), so the prefixes live here and nowhere else.\n */\nexport const MCP_TOOL_PREFIX = 'mcp-'\nexport const API_TOOL_PREFIX = 'api-'\nexport const SUBAGENT_TOOL_PREFIX = 'subagent-'\n\n/** Tool-set key of an MCP tool, from the name the server advertises. */\nexport const mcpToolKey = (toolName: string) => `${MCP_TOOL_PREFIX}${toolName}`\n\n/** Tool-set key of an agent API tool, from its configured name. */\nexport const apiToolKey = (toolName: string) => `${API_TOOL_PREFIX}${toolName}`\n\n/** Tool-set key of a sub-agent, from its camel-cased name. */\nexport const subAgentToolKey = (subAgentName: string) =>\n `${SUBAGENT_TOOL_PREFIX}${subAgentName}`\n\n/**\n * Returns true if the tool can be put behind the user-approval gate\n * (`settings.tools.approval.tools`, see docs/specs/tool-approval-interface.md).\n *\n * Only tools that run server-side qualify: a presentation tool has nothing to\n * approve, and a client-resolved one (geolocation, OAuth connect) already asks\n * the user by construction, since it is the browser or the user who answers it.\n */\nexport function canRequireApproval(toolName: string): boolean {\n return (\n !isPresentationTool(toolName) &&\n toolName !== AgentBuiltInTool.RequestGeolocation\n )\n}\n\n/**\n * Returns true if the tool renders a UI element (card, form, list, etc.).\n * Used in `prepareStep` to prevent duplicate UI elements across streaming steps.\n */\nexport function isPresentationTool(toolName: string): boolean {\n return (\n toolName === AgentBuiltInTool.RequestConfirm ||\n toolName === AgentBuiltInTool.ShowArtifact ||\n toolName === AgentBuiltInTool.ShowCalendarEvent ||\n toolName === AgentBuiltInTool.ShowComparison ||\n toolName === AgentBuiltInTool.ShowContactForm ||\n toolName === AgentBuiltInTool.ShowDiagram ||\n toolName === AgentBuiltInTool.ShowEmail ||\n toolName === AgentBuiltInTool.ShowImageGallery ||\n toolName === AgentBuiltInTool.ShowLocation ||\n toolName === AgentBuiltInTool.ShowMessage ||\n toolName === AgentBuiltInTool.ShowForm ||\n toolName === AgentBuiltInTool.ShowMultipleChoice ||\n toolName === AgentBuiltInTool.ShowProductList ||\n toolName === AgentBuiltInTool.ShowQrCode ||\n toolName === AgentBuiltInTool.ShowSources ||\n toolName === AgentBuiltInTool.ShowSuggestedReply ||\n toolName === AgentBuiltInTool.ShowVideo ||\n toolName === AgentBuiltInTool.ShowWeather ||\n toolName === AgentBuiltInTool.ShowWebPages\n )\n}\n\n/**\n * Tools that render natively as cards on messaging platforms (Teams/WhatsApp).\n * Must mirror the coverage of the backend `platformToolRenderer` (the renderers\n * + the resumable confirm/form and the tappable suggested-reply). Tools not in\n * this set fall back to the model's plain-text reply on those channels.\n */\nexport const PLATFORM_RENDERED_TOOLS = new Set<string>([\n AgentBuiltInTool.RequestConfirm,\n AgentBuiltInTool.ShowArtifact,\n AgentBuiltInTool.ShowWeather,\n AgentBuiltInTool.ShowLocation,\n AgentBuiltInTool.ShowComparison,\n AgentBuiltInTool.ShowProductList,\n AgentBuiltInTool.ShowWebPages,\n AgentBuiltInTool.ShowImageGallery,\n AgentBuiltInTool.ShowVideo,\n AgentBuiltInTool.ShowSources,\n AgentBuiltInTool.ShowSuggestedReply,\n AgentBuiltInTool.ShowCalendarEvent,\n AgentBuiltInTool.ShowEmail,\n AgentBuiltInTool.ShowMessage,\n AgentBuiltInTool.ShowForm,\n])\n\n/** True if the tool renders natively on Teams/WhatsApp (not just web). */\nexport function isPlatformRenderedTool(toolName: string): boolean {\n return PLATFORM_RENDERED_TOOLS.has(toolName)\n}\n\n/**\n * Client tools whose CALL waits for the person to answer it: until they do,\n * the tool loop is suspended and the turn has not said its last word.\n *\n * Every other client tool renders from the call input and is never answered: a\n * sources list, an artifact, a product list have nothing to send back, and the\n * contact form posts its lead through its own endpoint. Two places need that\n * distinction, and both got it wrong before (reported 2026-08-27 on a\n * knowledge-base turn, whose forced sources closure lands in the same step as\n * a form):\n * - the web resume condition (`sendAutomaticallyWhen` in `useChatbotStore`),\n * which must require a tool OUTPUT from these and from nothing else, or the\n * answers the user just submitted stay in the browser;\n * - `computeRequiredClosures` server-side, which owes no closure to a turn left\n * waiting on one of them: the sources of an answer that is still a question.\n *\n * Membership is about what the CALL waits for, not about the surface that\n * renders it: whether the answer comes back as a browser tool output or as a\n * Teams dialog submit makes no difference here, and a spoken turn resolves\n * these tools server-side with a render acknowledgement (`withRenderAck`), so\n * it is never left waiting in the first place.\n *\n * `requestOAuthConnection` is not an `AgentBuiltInTool`: it is injected by the\n * MCP layer, not configured on the agent.\n */\nexport const USER_ANSWERED_TOOLS: ReadonlySet<string> = new Set([\n AgentBuiltInTool.RequestConfirm,\n AgentBuiltInTool.RequestGeolocation,\n AgentBuiltInTool.ShowForm,\n AgentBuiltInTool.ShowMultipleChoice,\n 'requestOAuthConnection',\n])\n\n/** True if this tool's call waits for an answer from the person on the other side. */\nexport function isUserAnsweredTool(toolName: string): boolean {\n return USER_ANSWERED_TOOLS.has(toolName)\n}\n\n/**\n * Transport a turn arrived through. Recorded on the chat metadata and on the\n * latency histograms, and it is what decides {@link ClientToolSurface}: the\n * transport is a fact of the request, not a per-agent setting.\n */\nexport enum ChatTransport {\n /** Web chat and embeddable widget: the reference surface. */\n Web = 'web',\n /** Messaging channels (Teams, WhatsApp) through the platform runner. */\n Platform = 'platform',\n /** OpenAI-compatible REST surface: automations, SDKs. */\n OpenAiApi = 'openai-api',\n /**\n * Spoken conversation: the request arrives on the same OpenAI-compatible\n * surface, but through a voice session opened by us, so the turn knows it\n * will be heard rather than read. Distinct from {@link OpenAiApi} because\n * that is what decides the answer style and what isolates voice in the\n * cost and latency reports.\n */\n Voice = 'voice',\n}\n\n/**\n * What the caller of a turn can actually DO with a client-side tool.\n *\n * Client tools have no `execute`: something on the other side has to render the\n * widget and post the result back. Offering one to a caller that cannot is not\n * a missing nicety, it is a defect with a measured cost: the model spends a\n * full round trip calling it (`showSuggestedReply` on every sample of the\n * turn-latency baseline), the call is never answered, and its guidance sits in\n * the system prompt of every turn.\n */\nexport enum ClientToolSurface {\n /** Full client runtime: every enabled client tool renders. */\n Web = 'web',\n /** Renders only {@link PLATFORM_RENDERED_TOOLS}; the rest never resolve. */\n Platform = 'platform',\n /**\n * Spoken answer, written conversation on screen: the widgets appear when the\n * client reloads the conversation after the turn, so everything that renders\n * without an answer works, and everything that waits for one does not.\n * See {@link VOICE_RENDERED_TOOLS}.\n */\n Voice = 'voice',\n /** No client runtime at all: the caller consumes text (and tool results). */\n Headless = 'headless',\n}\n\n/**\n * Presentation tools that need nothing back from the client DURING the turn.\n *\n * A voice turn is answered through the provider, so no tool call ever reaches\n * the browser live: what reaches it is the persisted message, reloaded when the\n * turn ends. Anything that renders and stops is therefore fine; anything that\n * would suspend the tool loop waiting for the model's answer (a confirmation, a\n * location request, a quick reply) would sit unanswered in a conversation the\n * user is not typing into.\n *\n * The ones that ask the caller something are here too, and they are not an\n * exception to the rule above: none of them answers the tool loop.\n * - the contact form posts its lead through its own endpoint. Asked to be\n * recontacted mid-call, an agent without it can only apologize (reported\n * 2026-08-06, and collecting the lead is what a voice agent is for);\n * - the forms, the quick replies, a confirmation and a position request are\n * answered on screen and go back to the agent as a spoken user message (see\n * {@link VOICE_RENDER_ACK_PREFIX}), so the caller taps and the agent replies\n * out loud, in the same call. On a screen a tap and a sentence are two roads\n * to the same turn.\n */\nexport const VOICE_RENDERED_TOOLS: ReadonlySet<string> = new Set([\n AgentBuiltInTool.RequestConfirm,\n AgentBuiltInTool.RequestGeolocation,\n AgentBuiltInTool.ShowArtifact,\n AgentBuiltInTool.ShowCalendarEvent,\n AgentBuiltInTool.ShowContactForm,\n AgentBuiltInTool.ShowComparison,\n AgentBuiltInTool.ShowDiagram,\n AgentBuiltInTool.ShowEmail,\n AgentBuiltInTool.ShowForm,\n AgentBuiltInTool.ShowImageGallery,\n AgentBuiltInTool.ShowLocation,\n AgentBuiltInTool.ShowMessage,\n AgentBuiltInTool.ShowMultipleChoice,\n AgentBuiltInTool.ShowProductList,\n AgentBuiltInTool.ShowQrCode,\n AgentBuiltInTool.ShowSources,\n AgentBuiltInTool.ShowSuggestedReply,\n AgentBuiltInTool.ShowVideo,\n AgentBuiltInTool.ShowWeather,\n AgentBuiltInTool.ShowWebPages,\n])\n\n/**\n * The provider's own system tool for hanging up: it watches our completion\n * stream for a call by this exact name, speaks its `message` argument and\n * closes the line. Shared here because three places must agree on the spelling:\n * the tool we offer the model, the stream that forwards the call, and the\n * refusal we speak when a turn cannot run at all.\n */\nexport const VOICE_END_CALL_TOOL = 'end_call'\n\n/**\n * Opening of the output a voice turn gives itself for a widget the client draws\n * (see `withRenderAck` in the backend tool set).\n *\n * It is the model's evidence that the screen was written to, and on the client\n * it is the opposite of an answer: a form carrying it has been drawn and not\n * filled in, so it must stay interactive rather than render as answered with\n * this sentence in place of the caller's reply.\n *\n * It is deliberately a label and not a sentence. The wording it replaced,\n * \"Shown on the caller's screen\", was read back by the model as content it had\n * produced: quick replies are acknowledged the same way as a document, so a\n * turn whose only widget was three chips still ended in \"I have prepared a\n * summary on your screen\", with nothing there (measured 2026-08-07, twelve\n * times in one call). What was on screen now comes after the label, per tool.\n */\nexport const VOICE_RENDER_ACK_PREFIX = 'Voice turn note'\n\n/** The pre 2026-08-07 wording, still sitting in persisted conversations. */\nconst LEGACY_VOICE_RENDER_ACK_PREFIX = \"Shown on the caller's screen\"\n\n/**\n * The output {@link VOICE_RENDER_ACK_PREFIX} describes, for one tool.\n *\n * Three shapes, because three things happen. A presentation tool puts something\n * the caller can read on the screen, and the note ends by telling the model not\n * to say its sentence again: being told \"it was drawn\" is exactly what made it\n * restate the whole answer in the next step, heard twice on a call and printed\n * twice in the conversation (measured 2026-08-07). Quick replies put nothing\n * there at all, so their note says so, in the words the model would otherwise\n * use to claim the opposite.\n *\n * Sources are the one card worth naming out loud: on a call nobody is watching\n * the screen, so a silent list is a list nobody opens. Their note grants ONE\n * short mention, and the grant stays narrow (no reading the list, no naming\n * documents, no restating the answer) because the wording that let the model\n * talk freely about the screen is the wording that made it invent what was on\n * it.\n *\n * That note is the secondary lever, not the main one: in the turn shape the\n * voice prompt asks for (spoken sentence and presentation call in the SAME\n * reply) it never runs at all, because the closure gate refuses a closure\n * called in the answering step and the server writes the card itself, so\n * nothing executes. The spoken mention is therefore asked for in `<voice_turn>`\n * as well, where it costs no round trip; this note covers only the turns that\n * call the tool a step later.\n */\nexport const voiceRenderAck = (toolName: string): string => {\n if (toolName === AgentBuiltInTool.ShowSuggestedReply) {\n return `${VOICE_RENDER_ACK_PREFIX} (${toolName}): the quick replies are attached to your message. They are taps, not content: NOTHING was written on the caller's screen by this call, so do not say you showed, prepared, summarized or wrote anything, and do not mention the replies out loud.`\n }\n if (toolName === AgentBuiltInTool.ShowSources) {\n return `${VOICE_RENDER_ACK_PREFIX} (${toolName}): the sources of the answer you just gave are listed in the chat, where the caller can read them. If you have not said so already, you MAY tell them once, in a few words. Nothing more: do not read the list out loud, do not name the documents, and do not repeat or summarize the answer itself.`\n }\n return `${VOICE_RENDER_ACK_PREFIX} (${toolName}): drawn in the conversation, where the caller can read it. You have already said your sentence out loud: do not say it again, either add something new or stop here.`\n}\n\n/** True when a tool output is our own \"it was drawn\" note and not a result. */\nexport function isVoiceRenderAck(output: unknown): boolean {\n return (\n typeof output === 'string' &&\n (output.startsWith(VOICE_RENDER_ACK_PREFIX) ||\n output.startsWith(LEGACY_VOICE_RENDER_ACK_PREFIX))\n )\n}\n\n/** True if the tool shows something on screen during a call and needs no reply. */\nexport function isVoiceRenderedTool(toolName: string): boolean {\n return VOICE_RENDERED_TOOLS.has(toolName)\n}\n\n/** Single availability rule for a client tool, shared by tool set and prompt. */\nexport function supportsClientTool(\n surface: ClientToolSurface,\n toolName: string,\n): boolean {\n if (surface === ClientToolSurface.Headless) {\n return false\n }\n if (surface === ClientToolSurface.Platform) {\n return isPlatformRenderedTool(toolName)\n }\n if (surface === ClientToolSurface.Voice) {\n return isVoiceRenderedTool(toolName)\n }\n return true\n}\n\n/**\n * Surface of a transport. Unknown transports are treated as Web, which is the\n * historical behaviour: a new caller has to opt into being headless, so adding\n * one can never silently strip the widgets from an existing channel.\n */\nexport function clientToolSurfaceOf(\n transport: ChatTransport | string | undefined,\n): ClientToolSurface {\n switch (transport) {\n case ChatTransport.OpenAiApi:\n return ClientToolSurface.Headless\n // Voice is not headless: the caller hears the answer and reads the same\n // conversation on screen, where the client reloads it once the turn is\n // over. The provider never sees the tool calls (they are not forwarded\n // on the callback stream), the persisted message carries them.\n case ChatTransport.Voice:\n return ClientToolSurface.Voice\n case ChatTransport.Platform:\n return ClientToolSurface.Platform\n default:\n return ClientToolSurface.Web\n }\n}\n\n/**\n * True when nobody is watching the response render: the transport delivers text\n * to a program (or to a speech synthesizer), so anything that paces the stream\n * for the human eye is pure added latency.\n */\nexport function isHeadlessTransport(\n transport: ChatTransport | string | undefined,\n): boolean {\n // Voice counts here even though it renders widgets: nobody watches the\n // stream arrive, a synthesizer consumes it, and the widgets appear with the\n // reload at the end of the turn. Pacing the deltas would only delay speech.\n return (\n transport === ChatTransport.Voice ||\n clientToolSurfaceOf(transport) === ClientToolSurface.Headless\n )\n}\n\n/**\n * Shape of the forms `showForm` asks for. Both values GUIDE the model from the\n * tool's descriptions: they are not bounds of its inputSchema, because a cap\n * there refuses the whole call instead of trimming it and there is no repair\n * for it (see `showForm.tool.ts` and the gotchas entry \"A configurable cap does\n * not belong in an inputSchema\"). Their own `.max(10)` is what the tool keeps\n * as its hard ceiling, so a configuration can reach it but never exceed it.\n */\nexport const AgentFormSettingsSchema = z.object({\n maxSteps: z.number().int().min(1).max(10).optional().default(5),\n maxOptionsPerStep: z.number().int().min(2).max(10).optional().default(5),\n})\nexport type AgentFormSettings = z.infer<typeof AgentFormSettingsSchema>\n\n/*\n * The two closure \"mode\" settings (suggestedReply.mode and showSources.mode)\n * were removed on 2026-09-01. Neither said what it looked like it said: the\n * prompt demands both closures whenever their tool is enabled, so the mode\n * only decided whether the SERVER repaired an omission, and nobody wants an\n * agent configured to leave the user without the widget the prompt promised.\n * A closure is unavailable by disabling its tool, as for any other tool.\n * showSources is therefore repaired on every answered turn that used the\n * knowledge base (it fired 321 times in the 7 days to 2026-09-01), and\n * showSuggestedReply is best-effort with the recovery of a gate-refused call.\n * Zod strips unknown keys, so the values still stored in `settings` are\n * ignored on read and disappear on the next save.\n */\n\nexport const DEFAULT_MAX_STEP_COUNT = 10\nexport const DEFAULT_SUB_AGENT_MAX_STEP_COUNT = 6\nexport const DEFAULT_ENDPOINT_MAX_STEP_COUNT = 5\n\n/**\n * Ceiling on the tool steps of a SPOKEN turn, whatever the agent allows in\n * writing.\n *\n * Every step is another round trip carrying the whole accumulated context, and\n * the caller hears all of it as silence. Six is what a call can spend: enough\n * for a retrieval, a check and a widget, and short of the marathons that reach\n * a minute (measured 2026-08-07: a turn that searched for about fifty seconds\n * was dropped by the provider with \"Generating the LLM response took too long\",\n * and the caller heard the waiting sentence four times and no answer).\n */\nexport const VOICE_MAX_STEP_COUNT = 6\n\nexport enum WebSearchProvider {\n Perplexity = 'perplexity',\n Parallel = 'parallel',\n Native = 'native',\n}\n\nexport const PerplexitySearchConfigSchema = z.object({\n maxResults: z.number().int().min(1).max(20).optional(),\n maxTokens: z.number().int().positive().max(1_000_000).optional(),\n maxTokensPerPage: z.number().int().positive().optional(),\n country: z.string().max(2).optional(),\n searchLanguageFilter: z.array(z.string().max(5)).max(10).optional(),\n searchDomainFilter: z.array(z.string()).max(20).optional(),\n searchRecencyFilter: z.enum(['day', 'week', 'month', 'year']).optional(),\n})\nexport type PerplexitySearchConfig = z.infer<\n typeof PerplexitySearchConfigSchema\n>\n\nexport const ParallelSearchConfigSchema = z.object({\n mode: z.enum(['one-shot', 'agentic']).optional(),\n maxResults: z.number().int().min(1).max(20).optional(),\n sourcePolicy: z\n .object({\n includeDomains: z.array(z.string()).optional(),\n excludeDomains: z.array(z.string()).optional(),\n afterDate: z.string().optional(),\n })\n .optional(),\n excerpts: z\n .object({\n maxCharsPerResult: z.number().int().positive().optional(),\n maxCharsTotal: z.number().int().positive().optional(),\n })\n .optional(),\n fetchPolicy: z\n .object({\n maxAgeSeconds: z.number().int().positive().optional(),\n })\n .optional(),\n})\nexport type ParallelSearchConfig = z.infer<typeof ParallelSearchConfigSchema>\n\nexport const NativeWebSearchConfigSchema = z.object({\n openai: z.object({}).optional(),\n anthropic: z\n .object({\n maxUses: z.number().int().positive().optional(),\n allowedDomains: z.array(z.string()).optional(),\n blockedDomains: z.array(z.string()).optional(),\n userLocation: z\n .object({\n type: z.literal('approximate').optional(),\n country: z.string().optional(),\n region: z.string().optional(),\n city: z.string().optional(),\n timezone: z.string().optional(),\n })\n .optional(),\n })\n .optional(),\n google: z.object({}).optional(),\n})\nexport type NativeWebSearchConfig = z.infer<typeof NativeWebSearchConfigSchema>\n\nexport const AgentWebSearchSchema = z.object({\n enabled: z.boolean().default(false),\n provider: z\n .enum(WebSearchProvider)\n .optional()\n .default(WebSearchProvider.Native),\n perplexity: PerplexitySearchConfigSchema.optional(),\n parallel: ParallelSearchConfigSchema.optional(),\n native: NativeWebSearchConfigSchema.optional(),\n})\nexport type AgentWebSearch = z.infer<typeof AgentWebSearchSchema>\n\n// Cross-agent personalization sub-options. Default OFF = current agent-bound\n// behavior. Only meaningful when the parent tool (UserMemory / SearchInUserFiles)\n// is enabled in `disabled`.\nexport const AgentUserMemorySchema = z.object({\n // Read the user's memories across ALL their agents (aggregated), not just\n // this agent's. Writes stay per-agent (scope='agent').\n useAllUserKb: z.boolean().default(false),\n})\nexport type AgentUserMemory = z.infer<typeof AgentUserMemorySchema>\n\nexport const AgentUserFilesSchema = z.object({\n // Search ALL the user's files, not just those pinned to this agent\n // (or globally shared agent_id IS NULL).\n useAllUserFiles: z.boolean().default(false),\n})\nexport type AgentUserFiles = z.infer<typeof AgentUserFilesSchema>\n\n/**\n * Human-in-the-loop approval settings. Lists the tools whose calls must be\n * approved by the user before they execute. Names are matched against the tool\n * set of the turn, so any tool can be listed: built-in (`sendEmail`), API tools\n * (`api-<name>`) and MCP tools (`mcp-<server>_<tool>`).\n *\n * The gate is UX, not security: it only suspends execution on interactive\n * channels. On non-interactive ones (messaging platforms, API, scheduled runs)\n * a listed tool is denied instead of hanging forever, see `toolApproval.ts`.\n */\nexport const AgentToolApprovalSchema = z.object({\n tools: z.array(z.string()).default([]),\n})\nexport type AgentToolApproval = z.infer<typeof AgentToolApprovalSchema>\n\nexport const AgentToolsSchema = z.object({\n // New agents start with user memory, user-files search and the generic\n // worker OFF (opt-in). Existing agents keep whatever `disabled` they stored.\n disabled: z\n .array(z.enum(AgentBuiltInTool))\n .default([\n AgentBuiltInTool.UserMemory,\n AgentBuiltInTool.SearchInUserFiles,\n AgentBuiltInTool.RunWorker,\n AgentBuiltInTool.FetchTeamsChannelHistory,\n ]),\n showForm: AgentFormSettingsSchema.optional().default(() =>\n AgentFormSettingsSchema.parse({}),\n ),\n webSearch: AgentWebSearchSchema.optional().default(() =>\n AgentWebSearchSchema.parse({}),\n ),\n userMemory: AgentUserMemorySchema.optional().default(() =>\n AgentUserMemorySchema.parse({}),\n ),\n userFiles: AgentUserFilesSchema.optional().default(() =>\n AgentUserFilesSchema.parse({}),\n ),\n approval: AgentToolApprovalSchema.optional().default(() =>\n AgentToolApprovalSchema.parse({}),\n ),\n})\nexport type AgentTools = z.infer<typeof AgentToolsSchema>\n\n/**\n * Ranking configuration schema for smart chunk retrieval.\n * Controls freshness boost, document priority, and MMR.\n * Semantic deduplication is always applied at sync time (not configurable per-agent).\n */\nexport const AgentRankingSchema = z\n .object({\n freshness: z\n .object({\n enabled: z.boolean().default(false),\n /** Half-life in seconds (1 day – 1 year) */\n scale: z\n .number()\n .int()\n .min(86400)\n .max(31536000)\n .default(7776000),\n /** Weight multiplier for freshness boost in formula */\n weight: z.number().min(0.05).max(0.5).default(0.1),\n })\n .prefault({}),\n priority: z\n .object({\n /** Always enabled by default — priority is per-document, not per-agent */\n enabled: z.boolean().default(true),\n })\n .prefault({}),\n mmr: z\n .object({\n enabled: z.boolean().default(false),\n /** Diversity tradeoff (0.0 = relevance only, 1.0 = diversity only) */\n diversity: z.number().min(0.0).max(1.0).default(0.3),\n /**\n * Candidates pre-selected before MMR. Capped at 100: in\n * balanced mode the RRF fusion of two 50-candidate prefetch\n * legs can never yield more. The pool is diversified by\n * Qdrant's native MMR, so no vector crosses the wire for it\n * (it used to, at 38 KB each, when MMR ran in JavaScript).\n */\n candidatesLimit: z.number().int().min(20).max(100).default(50),\n })\n .prefault({}),\n })\n .prefault({})\nexport type AgentRanking = z.infer<typeof AgentRankingSchema>\n\nexport const AgentModelSchema = z.object({\n prompt: z.string().optional(),\n temperature: z.number().min(0).max(2).optional().default(0.6),\n maxOutputTokens: z.number().positive().optional(),\n presencePenalty: z.number().min(-2).max(2).optional(),\n frequencyPenalty: z.number().min(-2).max(2).optional(),\n searchMode: z\n .enum(AgentSearchMode)\n .optional()\n .default(AgentSearchMode.Balanced),\n limit: z.number().positive().max(100).optional().default(10),\n maxStepCount: z\n .number()\n .int()\n .min(1)\n .max(40)\n .optional()\n .default(DEFAULT_MAX_STEP_COUNT),\n reasoning: AgentReasoningSchema,\n /** Smart ranking configuration (freshness, priority, MMR) */\n ranking: AgentRankingSchema.optional().default(() =>\n AgentRankingSchema.parse({}),\n ),\n})\nexport type AgentModel = z.infer<typeof AgentModelSchema>\n\nexport const LocalizedStringSchema = decodeOnly(\n z.unknown(),\n z.record(z.string(), z.string()),\n // Output validity is enforced by the codec's output schema at runtime.\n (val) =>\n (typeof val === 'string' ? { it: val } : val) as Record<string, string>,\n)\nexport type LocalizedString = z.infer<typeof LocalizedStringSchema>\n\nexport const DEFAULT_WIDGET_URL =\n 'https://cdn.jsdelivr.net/npm/@8wave/ai-elements/dist/ai-elements.es.js'\n\nexport enum AgentLoaderStrategy {\n InlineModule = 'inline-module',\n ScriptSrc = 'script-src',\n DynamicImport = 'dynamic-import',\n}\n\nexport enum AgentChannel {\n Frontoffice = 'frontoffice',\n App = 'app',\n Widget = 'widget',\n}\n\nexport const ALL_AGENT_CHANNELS = Object.values(AgentChannel) as AgentChannel[]\n\nexport const AgentInterfaceSchema = z.object({\n media: MediaSchema.optional(),\n logo: z.string().optional(),\n theme: z.enum(['light', 'dark', 'auto']).optional().default('auto'),\n mainColor: z\n .string()\n .regex(/^#[0-9A-Fa-f]{6}$/)\n .optional()\n .default('#000000'),\n textColor: z.enum(['auto', 'white', 'black']).optional().default('auto'),\n useColorsForAgentHeader: z.boolean().optional().default(false),\n initialMessage: LocalizedStringSchema.optional(),\n greeting: z.array(LocalizedStringSchema).min(1).max(10).optional(),\n messagePlaceholder: LocalizedStringSchema.optional(),\n dismissableNotice: LocalizedStringSchema.optional(),\n footerMessage: LocalizedStringSchema.optional(),\n privacyPolicyNotice: LocalizedStringSchema.optional(),\n /**\n * (A) Voluntary self-service sign-in for anonymous users of PUBLIC agents.\n * When false, the in-chat \"sign in\" menu item and the `view-auth` slot are\n * hidden. Does not touch the external token flow, nor the required login\n * gate of private/organization agents (there it is a no-op). Default true\n * for backward compatibility.\n */\n interactiveLogin: z.boolean().optional().default(true),\n welcomePopup: z.boolean().optional().default(false),\n floatingButtonPosition: z\n .enum(['left', 'right'])\n .optional()\n .default('right'),\n maxMessageLength: z.number().int().positive().optional(),\n widgetUrl: z.url().default(DEFAULT_WIDGET_URL),\n loadDelay: z.number().int().min(0).max(30000).optional().default(0),\n loaderStrategy: z\n .enum(AgentLoaderStrategy)\n .optional()\n .default(AgentLoaderStrategy.InlineModule),\n customCss: z.string().optional(),\n smoothStream: z.boolean().optional().default(false),\n /**\n * Show every agent step (reasoning, tool calls) as an expanded timeline\n * in the chat instead of the compact activity indicator. Only meaningful\n * when reasoning is enabled on the agent model.\n */\n showExtendedSteps: z.boolean().optional().default(false),\n})\nexport type AgentInterface = z.infer<typeof AgentInterfaceSchema>\n\nexport const CHAT_FILE_UPLOAD_DEFAULT_MIME_TYPES = [\n 'image/jpeg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'application/pdf',\n 'text/plain',\n 'text/markdown',\n 'text/csv',\n] as const\n\nexport type ChatFileUploadMimeType =\n (typeof CHAT_FILE_UPLOAD_DEFAULT_MIME_TYPES)[number]\n\nexport const CHAT_FILE_UPLOAD_MAX_FILE_SIZE_BYTES = 104_857_600 // 100 MB\n\nexport const AgentFileUploadSchema = z.object({\n enabled: z.boolean().default(false),\n maxFileSizeBytes: z\n .number()\n .int()\n .positive()\n .max(CHAT_FILE_UPLOAD_MAX_FILE_SIZE_BYTES)\n .optional()\n .default(20_971_520),\n allowedMimeTypes: z\n .array(z.string().regex(MIME_TYPE_REGEX))\n .optional()\n .default([...CHAT_FILE_UPLOAD_DEFAULT_MIME_TYPES]),\n maxFilesPerMessage: z\n .number()\n .int()\n .positive()\n .max(10)\n .optional()\n .default(5),\n maxFilesPerChat: z.number().int().positive().max(50).optional().default(20),\n})\nexport type AgentFileUpload = z.infer<typeof AgentFileUploadSchema>\n\nexport const AgentGatewayOptionsSchema = z.object({\n zeroDataRetention: z.boolean().default(true),\n disallowPromptTraining: z.boolean().default(true),\n providerTimeoutMs: z.number().int().min(1000).max(789000).optional(),\n})\nexport type AgentGatewayOptions = z.infer<typeof AgentGatewayOptionsSchema>\n\n/**\n * Exposure of the agent through the OpenAI-compatible surface\n * (`/api/openai/v1`), where any third-party client that speaks chat\n * completions can consume it as if it were a model. Off by default: turning it\n * on makes the agent reachable with an organization API key.\n */\nexport const AgentOpenAiApiSchema = z.object({\n enabled: z.boolean().default(false),\n})\nexport type AgentOpenAiApi = z.infer<typeof AgentOpenAiApiSchema>\n\n/**\n * Shortest first-token deadline the provider actually honours. Below it the\n * turn does not fall back on their model, it fails outright with \"LLM Cascade\n * Error: Brain returned no response\" (production, 2026-08-27).\n */\nexport const VOICE_MIN_CASCADE_TIMEOUT_SECONDS = 5\n\n/** And the longest they accept: their own ceiling, measured 2026-08-06. */\nexport const VOICE_MAX_CASCADE_TIMEOUT_SECONDS = 15\n\n/**\n * Voice conversation through ElevenLabs Agents, which provides the voice layer\n * (ASR, turn taking, barge-in, TTS) and calls back into our own turn as a\n * custom LLM on `/api/openai/v1`. Everything that makes the turn worth having\n * (RAG, MCP, memory, credits, persistence) therefore stays where it already is.\n *\n * The provider-side agent is created and kept in sync by the backend, so\n * `providerAgentId` is written by us and is not part of the editable surface.\n * See docs/specs/voice-channel.md.\n */\nexport const AgentVoiceSchema = z.object({\n enabled: z.boolean().default(false),\n /** Provider voice id. Empty means the provider default. */\n voiceId: z.string().optional(),\n /** Language passed to the provider's ASR and TTS. */\n language: z.string().min(2).max(5).default('it'),\n /** Hard server-side cap on a single voice session. */\n maxSessionSeconds: z.number().int().min(30).max(3600).default(600),\n /**\n * How long the provider waits for our first token before falling back to\n * its own model.\n *\n * It has to cover more than the model: our first byte goes out only once\n * the turn has been SET UP (agent read, credit, session, prompt, tool\n * loading, and MCP servers are the slow part), so everything before the\n * first chunk counts against this deadline. Ten seconds was not enough for\n * a heavy agent in production (2026-08-27), so the default is now the\n * provider's own ceiling and the room to go lower is a knob, not a\n * default.\n *\n * Never below {@link VOICE_MIN_CASCADE_TIMEOUT_SECONDS}. Clamped rather\n * than refused, because agents were saved with less before we knew: a\n * stored 3 must keep the voice working, not fail every session on\n * validation.\n */\n cascadeTimeoutSeconds: z\n .number()\n .min(1)\n .max(VOICE_MAX_CASCADE_TIMEOUT_SECONDS)\n .default(VOICE_MAX_CASCADE_TIMEOUT_SECONDS)\n .transform((seconds) =>\n Math.max(VOICE_MIN_CASCADE_TIMEOUT_SECONDS, seconds),\n ),\n /**\n * Seconds before the agent says it is working, while the real answer is\n * still coming. Spoken by our own stream, not by the provider: measured on\n * 2026-08-06, a turn that retrieves takes far longer than any deadline they\n * accept, and the keepalive that keeps it alive also disarms their filler.\n * Four seconds when left empty, which a fast turn never reaches.\n */\n fillerAfterSeconds: z.number().min(0.5).max(8).optional(),\n /**\n * Said while waiting. Empty means a default sentence in the agent's voice\n * language (\"Un attimo, sto controllando\").\n */\n fillerMessage: z.string().max(200).optional(),\n /**\n * Ignore voices that are not the person talking to the agent. Off on the\n * provider side, which in a room with other people (or a television) leaves\n * the turn open on noise: the agent hears \"someone is still speaking\" and\n * waits. On by default here, because the browser is rarely a quiet booth.\n */\n ignoreBackgroundVoices: z.boolean().default(true),\n /**\n * How readily the provider decides the user has finished speaking.\n * `eager` cuts the wait at the price of interrupting a slow speaker,\n * `patient` is for people who pause mid-sentence.\n */\n turnEagerness: z.enum(['patient', 'normal', 'eager']).default('normal'),\n /**\n * How long the agent waits for speech before taking the turn back. The\n * provider default is 7 seconds, which is the silence that reads as \"it\n * hung\": 5 still leaves room to think.\n */\n turnTimeoutSeconds: z.number().min(1).max(30).default(5),\n /**\n * Spoken as soon as the session opens, before the user says anything. It\n * also covers the cold start of the first turn, which is the slowest one\n * (measured p50 4598ms against 2592ms for the rest).\n */\n firstMessage: z.string().max(300).optional(),\n /** Id of the provider-side agent, written by the backend on sync. */\n providerAgentId: z.string().optional(),\n /**\n * Id of the provider-side secret holding the API key it calls us back with.\n * The key itself is never stored here, nor anywhere else on our side.\n */\n providerSecretId: z.string().optional(),\n /**\n * Our own id for that API key, kept so it can be revoked when the voice is\n * turned off or the agent is deleted. Without it the key is unreachable:\n * the value never comes back from the provider, and nothing else on the row\n * says which of the organization's keys belongs to this agent's voice.\n */\n providerApiKeyId: z.string().optional(),\n})\nexport type AgentVoice = z.infer<typeof AgentVoiceSchema>\n\n/**\n * What a chat client needs to know about voice: whether it is offered. The voice\n * id, the timeouts and the provider ids stay server-side, so this is also what\n * the public agent payload carries. Structurally a subset of\n * {@link AgentVoiceSchema}, so a backoffice caller can pass the full block.\n */\nexport const AgentVoiceCapabilitySchema = z.object({\n enabled: z.boolean(),\n})\nexport type AgentVoiceCapability = z.infer<typeof AgentVoiceCapabilitySchema>\n\n/** Body of a voice session request: which conversation to talk into. */\nexport const VoiceSessionRequestSchema = z.object({\n /**\n * Conversation the spoken turns are persisted into. Optional: without one\n * the backend opens a new conversation and returns its id, which is what\n * makes the switch back to typing land in the same thread.\n */\n chatId: z.string().min(1).optional(),\n /**\n * The browser the call is made from, sent once when the session opens and\n * then stamped on every spoken turn.\n *\n * A spoken turn reaches the backend from the voice provider, not from this\n * browser, so it is the only chance to know the device: without it the same\n * conversation shows the context of what the person typed and nothing at\n * all for what they said.\n */\n deviceContext: DeviceContextSchema.optional(),\n /**\n * What the host application knows about this visitor, sent once for the\n * same reason as {@link VoiceSessionRequestSchema.shape.deviceContext}: the\n * turn arrives from the provider and carries nothing of the page.\n *\n * Validated per turn against the agent's `externalContextSchema`, exactly\n * as a typed turn is: keeping it in the session record decides only where\n * it comes from, never what is trusted.\n */\n externalContext: z.record(z.string(), z.unknown()).optional(),\n})\nexport type VoiceSessionRequest = z.infer<typeof VoiceSessionRequestSchema>\n\n/**\n * What the client receives to open a voice session. The signed URL is\n * short-lived and issued per session, so no provider credential ever reaches\n * the browser.\n */\nexport const VoiceSessionSchema = z.object({\n /**\n * Opaque id of the server-side session record. The client echoes it back\n * through the provider (`custom_llm_extra_body`), and it is what binds a\n * spoken turn to its conversation: the chat id is never taken from the\n * client, because a browser could then name someone else's conversation.\n */\n sessionId: z.string(),\n signedUrl: z.string(),\n providerAgentId: z.string(),\n /** Conversation the turns of this session are persisted into. */\n chatId: z.string(),\n maxSessionSeconds: z.number().int(),\n})\nexport type VoiceSession = z.infer<typeof VoiceSessionSchema>\n\n/** A provider voice, as offered in the agent configuration. */\nexport const VoiceOptionSchema = z.object({\n voiceId: z.string(),\n name: z.string(),\n /** Provider category (premade, professional, generated): shown as a chip. */\n category: z.string().optional(),\n /** Short sample, for the preview button in the configuration panel. */\n previewUrl: z.string().optional(),\n /** Provider labels (accent, gender, use case): free-form, shown as chips. */\n labels: z.record(z.string(), z.string()).optional(),\n})\nexport type VoiceOption = z.infer<typeof VoiceOptionSchema>\n\nexport const VoiceOptionListSchema = z.array(VoiceOptionSchema)\n\nexport const AgentSettingsSchema = z.object({\n model: AgentModelSchema,\n interface: AgentInterfaceSchema,\n tools: AgentToolsSchema.optional().default(() =>\n AgentToolsSchema.parse({}),\n ),\n fileUpload: AgentFileUploadSchema.optional().default(() =>\n AgentFileUploadSchema.parse({}),\n ),\n gatewayOptions: AgentGatewayOptionsSchema.optional().default(() =>\n AgentGatewayOptionsSchema.parse({}),\n ),\n channels: z\n .array(z.enum(AgentChannel))\n .optional()\n .default(() => [...ALL_AGENT_CHANNELS]),\n /**\n * JSON Schema definition for the `externalContext` field accepted in chat\n * requests. Only top-level string-keyed properties that match this schema\n * will be forwarded to the LLM. When absent, all external context is\n * silently ignored (deny-by-default).\n */\n externalContextSchema: jsonSchemaField.optional(),\n openaiApi: AgentOpenAiApiSchema.optional().default(() =>\n AgentOpenAiApiSchema.parse({}),\n ),\n voice: AgentVoiceSchema.optional().default(() =>\n AgentVoiceSchema.parse({}),\n ),\n})\nexport type AgentSettings = z.infer<typeof AgentSettingsSchema>\n\nexport const AgentSecuritySchema = z.object({\n rateLimits: z.object({\n minuteRateLimit: z.number().int().min(0).optional(),\n hourRateLimit: z.number().int().min(0).optional(),\n dayRateLimit: z.number().int().min(0).optional(),\n monthRateLimit: z.number().int().min(0).optional(),\n }),\n trustedOrigins: z\n .object({\n origins: z\n .array(z.url().or(z.literal('')))\n .overwrite((items) => {\n return items?.filter((item) => item?.trim())\n })\n .default([]),\n })\n .default({ origins: [] }),\n})\nexport type AgentSecurity = z.infer<typeof AgentSecuritySchema>\n\nexport const AgentDtoSchema = z.object({\n id: z.string().optional(),\n name: z.string(),\n prompt: z.string().optional(),\n model: z.string().default(LanguageModel.gpt56Terra),\n fallbackModels: z.array(z.string()).default([]),\n status: z.enum(AgentStatus).default(AgentStatus.Draft),\n visibility: z.enum(AgentVisibility).default(AgentVisibility.Organization),\n settings: AgentSettingsSchema,\n security: AgentSecuritySchema.nullish(),\n type: z.enum(AgentType).default(AgentType.Chat),\n organizationId: z.string(),\n})\n\nexport const AgentSchema = z.lazy(() =>\n z.object({\n id: z.string(),\n name: z.string(),\n prompt: z.string(),\n model: z.string(),\n fallbackModels: z.array(z.string()).nullable().default([]),\n status: z.enum(AgentStatus).default(AgentStatus.Draft),\n visibility: z\n .enum(AgentVisibility)\n .default(AgentVisibility.Organization),\n settings: AgentSettingsSchema,\n security: AgentSecuritySchema.nullable(),\n type: z.enum(AgentType).default(AgentType.Chat),\n organizationId: z.string(),\n createdAt: z.coerce.date(),\n createdBy: z.string(),\n updatedAt: z.coerce.date(),\n updatedBy: z.string(),\n deleted: z.boolean(),\n deletedAt: z.coerce.date().nullable(),\n deletedBy: z.string().nullable(),\n outOfBudget: z.boolean().optional().default(false),\n outOfBudgetReason: z.string().optional().default(''),\n }),\n)\n\n/* -------------------------------------------------------------------------- *\n * Agent exposure tiers\n *\n * The same agent is serialized at decreasing levels of detail depending on\n * who is asking. Each tier is a strict narrowing of the one above it:\n *\n * Agent Full internal entity — prompt, model, settings, security.\n * Never leaves the trusted (admin/backoffice) boundary.\n * AgentPublic Client view for a viewer who ALREADY HAS ACCESS. \"Public\"\n * means \"safe to expose to the client\", NOT \"visibility =\n * public\": a private/organization agent is still served as\n * AgentPublic once the viewer is authorized.\n * AgentBranding Minimal, safe subset shown to ANONYMOUS viewers on the\n * pre-login screen — just enough to render branded chrome.\n * AgentAccess Envelope returned by the `/access` endpoint: a discriminated\n * union on `requiresAuth` that resolves to either an\n * AgentPublic (access granted) or an AgentBranding (login\n * required), plus the available auth methods.\n * -------------------------------------------------------------------------- */\n\nexport const AgentPublicSchema = z.object({\n id: z.string(),\n name: z.string(),\n status: z.enum(AgentStatus),\n visibility: z.enum(AgentVisibility),\n organizationId: z.string(),\n interface: AgentInterfaceSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n capabilities: z.object({\n fileUpload: AgentFileUploadSchema,\n voice: AgentVoiceCapabilitySchema,\n }),\n channels: z\n .array(z.enum(AgentChannel))\n .default(() => [...ALL_AGENT_CHANNELS]),\n})\n\n/**\n * Safe subset of `AgentInterface` exposed to anonymous users on the public\n * \"access\" endpoint to render a branded login screen. Mirrors the field names\n * of `AgentInterfaceSchema` (via `pick`) so consumers can read branding the\n * same way for both `AgentPublic.interface` and `AgentBranding.interface`.\n *\n * 🔒 NEVER add sensitive fields here (system prompt, models, tools, …).\n */\nexport const AgentBrandingInterfaceSchema = AgentInterfaceSchema.pick({\n logo: true,\n mainColor: true,\n textColor: true,\n theme: true,\n floatingButtonPosition: true,\n customCss: true,\n})\nexport type AgentBrandingInterface = z.infer<\n typeof AgentBrandingInterfaceSchema\n>\n\nexport const AgentBrandingSchema = AgentPublicSchema.pick({\n id: true,\n name: true,\n organizationId: true,\n}).extend({\n interface: AgentBrandingInterfaceSchema,\n})\nexport type AgentBranding = z.infer<typeof AgentBrandingSchema>\n\nexport const AuthMethodsSchema = z.object({\n emailPassword: z.boolean(),\n google: z.boolean(),\n microsoft: z.boolean(),\n})\nexport type AuthMethods = z.infer<typeof AuthMethodsSchema>\n\n/**\n * Access decision for an agent, WITHOUT the auth methods.\n *\n * Discriminated on `requiresAuth` so the two outcomes are mutually exclusive at\n * the type level — no caller has to null-check `agent`/`branding` by hand:\n * - `requiresAuth: false` → access granted, full `agent` is present.\n * - `requiresAuth: true` → login required, only `branding` is present.\n *\n * This is what the service returns; the controller layers `authMethods` on top\n * to produce {@link AgentAccessSchema}.\n */\nexport const AgentAccessGrantedSchema = z.object({\n requiresAuth: z.literal(false),\n agent: AgentPublicSchema,\n branding: z.null(),\n})\n\nexport const AgentAccessRequiresAuthSchema = z.object({\n requiresAuth: z.literal(true),\n agent: z.null(),\n branding: AgentBrandingSchema,\n})\n\nexport const AgentAccessDecisionSchema = z.discriminatedUnion('requiresAuth', [\n AgentAccessGrantedSchema,\n AgentAccessRequiresAuthSchema,\n])\nexport type AgentAccessDecision = z.infer<typeof AgentAccessDecisionSchema>\n\n/**\n * Full payload returned by the public `/access` endpoint: the\n * {@link AgentAccessDecisionSchema} plus the auth methods the client may offer\n * on the login screen.\n */\nexport const AgentAccessSchema = z.discriminatedUnion('requiresAuth', [\n AgentAccessGrantedSchema.extend({ authMethods: AuthMethodsSchema }),\n AgentAccessRequiresAuthSchema.extend({ authMethods: AuthMethodsSchema }),\n])\nexport type AgentAccess = z.infer<typeof AgentAccessSchema>\n\n/**\n * Per-member allowlist of `organization`-visibility agents. An empty `agentIds`\n * means \"no restriction\" — the member can use every organization agent (the\n * default). A non-empty list limits the member to those agents. Owners/admins\n * always bypass it. `id` is the member's user id, so the resource can be\n * cached/updated as a keyed entity by the frontend store. Used as both the GET\n * response and the PUT body of the backoffice `/members/:userId/agent-access`\n * endpoint.\n */\nexport const MemberAgentAccessSchema = z.object({\n id: z.uuid(),\n agentIds: z.array(z.uuid()),\n})\nexport type MemberAgentAccess = z.infer<typeof MemberAgentAccessSchema>\n\nexport const AgentsQuerystringSchema = z.object({\n ...zodQs.pagination(),\n ...zodQs.sort([\n 'id',\n 'updatedAt',\n 'createdAt',\n 'name',\n 'type',\n 'status',\n 'visibility',\n 'model',\n ]),\n ...zodQs.filters(['done', 'type']),\n ...zodQs.filter('id'),\n ...zodQs.fullText(),\n ...zodQs.ids(),\n})\n\nexport type AgentDto = z.infer<typeof AgentDtoSchema>\nexport type Agent = z.infer<typeof AgentSchema>\nexport type AgentPublic = z.infer<typeof AgentPublicSchema>\n\nexport type AgentQuerystring = z.infer<typeof AgentsQuerystringSchema>\n"],"mappings":";;;AASA,IAAa,IAAsB,EAAS;CACxC,UAAU,EAAS,CAAC,CAAC,SAAS;CAC9B,UAAU,EAAS,CAAC,CAAC,SAAS;CAC9B,UAAU,EAAS,CAAC,CAAC,SAAS;CAC9B,WAAW,EAAQ,EAAS,CAAC,CAAC,CAAC,SAAS;CACxC,KAAK,EAAS,CAAC,CAAC,SAAS;CACzB,UAAU,EAAS,CAAC,CAAC,SAAS;CAC9B,WAAW,EAAS,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAS,CAAC,CAAC,SAAS;CAC9B,aAAa,EAAS,CAAC,CAAC,SAAS;CACjC,cAAc,EAAS,CAAC,CAAC,SAAS;CAClC,eAAe,EAAS,CAAC,CAAC,SAAS;CACnC,gBAAgB,EAAS,CAAC,CAAC,SAAS;CACpC,kBAAkB,EAAS,CAAC,CAAC,SAAS;CACtC,gBAAgB,EAAS,CAAC,CAAC,SAAS;CACpC,qBAAqB,EAAS,CAAC,CAAC,SAAS;CACzC,cAAc,EAAS,CAAC,CAAC,SAAS;CAClC,UAAU,EAAS,CAAC,CAAC,SAAS;CAC9B,gBAAgB,EAAS,CAAC,CAAC,SAAS;CACpC,yBAAyB,EAAS,CAAC,CAAC,SAAS;CAC7C,oBAAoB,EAAS,CAAC,CAAC,SAAS;CACxC,eAAe,EAAS,CAAC,CAAC,SAAS;CACnC,UAAU,EAAU,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAU,CAAC,CAAC,SAAS;CAC/B,eAAe,EAAU,CAAC,CAAC,SAAS;CACpC,eAAe,EAAS,CAAC,CAAC,SAAS;CACnC,qBAAqB,EAAS,CAAC,C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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as e, _ as t, a as n, b as r, g as i, h as a, n as o, o as s, v as c, x as l, y as u } from "./schemas-U769m8P5.js";
|
|
2
|
-
import { i as d, l as f, n as p, o as m, r as h, s as g, u as _ } from "./Media-
|
|
2
|
+
import { i as d, l as f, n as p, o as m, r as h, s as g, u as _ } from "./Media-hjgDyEMr.js";
|
|
3
3
|
//#region ../../packages/utils/src/markdown.ts
|
|
4
4
|
var v = (e) => {
|
|
5
5
|
if (e) return e.replace(/!\[.*?\]\(.*?\)/g, "").replace(/\[([^\]]+)\]\(.*?\)/g, "$1").replace(/`{1,3}[^`]*`{1,3}/g, "").replace(/#{1,6}\s/g, "").replace(/(\*{1,3}|_{1,3})(.*?)\1/g, "$2").replace(/~~(.*?)~~/g, "$1").replace(/^\s*[-*+>]\s+/gm, "").replace(/\n+/g, " ").trim();
|
|
@@ -220,4 +220,4 @@ var T = (e) => {
|
|
|
220
220
|
//#endregion
|
|
221
221
|
export { v as a, D as i, T as n, E as r, k as t };
|
|
222
222
|
|
|
223
|
-
//# sourceMappingURL=Document-
|
|
223
|
+
//# sourceMappingURL=Document-DjNrISX1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Document-DXkvvAnt.js","names":[],"sources":["../../../../packages/utils/src/markdown.ts","../../../../packages/models/src/schema/Header.ts","../../../../packages/models/src/schema/Document.ts"],"sourcesContent":["export const stripMarkdown = (text?: string | null) => {\n if (!text) {\n return undefined\n }\n return text\n .replace(/!\\[.*?\\]\\(.*?\\)/g, '') // images\n .replace(/\\[([^\\]]+)\\]\\(.*?\\)/g, '$1') // links\n .replace(/`{1,3}[^`]*`{1,3}/g, '') // inline code / code blocks\n .replace(/#{1,6}\\s/g, '') // headings\n .replace(/(\\*{1,3}|_{1,3})(.*?)\\1/g, '$2') // bold / italic\n .replace(/~~(.*?)~~/g, '$1') // strikethrough\n .replace(/^\\s*[-*+>]\\s+/gm, '') // lists and blockquotes\n .replace(/\\n+/g, ' ') // newlines\n .trim()\n}\n","import * as z from 'zod'\nimport { decodeOnly } from '../utils'\n\nexport const HeaderSchema = z.object({\n key: z.string().optional(),\n value: z.string().optional(),\n})\n\nexport const HeadesSchema = decodeOnly(\n z.array(HeaderSchema),\n z.array(z.object({ key: z.string(), value: z.string() })),\n (headers) =>\n headers?.filter(\n (header) => header.key?.trim() && header.value?.trim(),\n ) as Array<{ key: string; value: string }>,\n)\n\nexport type Header = z.infer<typeof HeaderSchema>\nexport type Headers = z.infer<typeof HeadesSchema>\n","import * as z from 'zod'\nimport { zodQs, decodeOnly } from '../utils'\nimport {\n SupportedLanguage,\n ExtractionStrategy,\n BrowserEngine,\n} from './constants'\nimport { MediaSchema } from './Media'\nimport { HeadesSchema } from './Header'\n\n/**\n * Processing status for document indexing and embedding generation\n */\nexport enum IndexStatus {\n Pending = 'pending',\n Processing = 'processing',\n Success = 'success',\n Failed = 'failed',\n}\n\n// ===== Document Source Types =====\n\n/**\n * Conversion options for document processing\n * Used when creating or reprocessing documents\n */\nexport const ConversionOptionsSchema = z.object({\n extractionStrategy: z.enum(ExtractionStrategy).optional(),\n browserEngine: z\n .enum(BrowserEngine)\n .optional()\n .default(BrowserEngine.FETCH),\n headers: HeadesSchema.nullish(),\n aiDescriptionModel: z.string().optional(),\n aiDescriptionPrompt: z.string().max(5000).optional(),\n language: z.string().optional(),\n forceOcr: z.boolean().default(false),\n pages: z\n .string()\n .max(100)\n .regex(/^\\d+(\\s*-\\s*\\d+)?(\\s*,\\s*\\d+(\\s*-\\s*\\d+)?)*$/)\n .optional(),\n})\n\nexport type ConversionOptions = z.infer<typeof ConversionOptionsSchema>\n\n/**\n * Metadata structure for document.metadata column\n * Consolidates all metadata from converters and source info\n */\nexport const DocumentMetadataSchema = z\n .object({\n // === Source Info (URL documents only) ===\n source: z\n .object({\n url: z.string(),\n lastScrapedAt: z.string(),\n })\n .optional(),\n\n // === Media Info (File documents only) ===\n media: MediaSchema.optional(),\n\n // === Common Fields (all document types) ===\n title: z.string().optional(),\n author: z.string().optional(),\n description: z.string().optional(),\n summary: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n\n // === PDF Specific ===\n subject: z.string().optional(),\n creator: z.string().optional(), // Original application\n producer: z.string().optional(), // PDF generator software\n creationDate: z.string().optional(),\n modificationDate: z.string().optional(),\n pageCount: decodeOnly(\n z.union([z.number(), z.array(z.unknown())]),\n z.number(),\n (val) => (Array.isArray(val) ? val.length : val),\n ).optional(),\n encrypted: z.boolean().optional(),\n\n // === DOCX Specific ===\n characterCount: z.number().optional(),\n lineCount: z.number().optional(),\n\n // === URL Specific ===\n siteName: z.string().optional(),\n canonicalUrl: z.url().optional(),\n imageUrl: z.url().optional(),\n favicon: z.url().optional(),\n type: z.string().optional(), // og:type (article, website, etc.)\n locale: z.string().optional(),\n tags: z.array(z.string()).optional(),\n publishedTime: z.string().optional(),\n modifiedTime: z.string().optional(),\n\n // === Metrics (all document types) ===\n wordCount: z.number().optional(),\n paragraphCount: z.number().optional(),\n readingTime: z.number().optional(), // in minutes\n\n // === OCR (PDF documents) ===\n ocrUsed: z.boolean().optional(),\n ocrProvider: z.string().optional(),\n ocrModel: z.string().optional(),\n ocrPages: z.string().optional(),\n ocrCost: z.number().optional(),\n ocrError: z.string().optional(),\n\n // === RAG / Duplicates / Sync Info ===\n chunksCount: z.number().optional(),\n redundantChunksCount: z.number().optional(),\n hasRedundantChunks: z.boolean().optional(),\n qdrantSynced: z.boolean().optional(),\n\n // === Conversion Options (for reprocessing) ===\n conversionOptions: ConversionOptionsSchema.optional(),\n })\n .loose() // Allow additional custom fields\n\nexport type DocumentMetadata = z.infer<typeof DocumentMetadataSchema>\n\n/**\n * Document type enum\n *\n * - 'file': Document created from uploaded file (PDF, DOCX)\n * - 'url': Document created from web scraping\n * - 'revised-answer': Document created from revised AI answer\n * - 'plain-text': Document created from plain text input\n */\nexport enum DocumentType {\n File = 'file',\n Url = 'url',\n RevisedAnswer = 'revised-answer',\n PlainText = 'plain-text',\n}\n\n// ===== Schemas =====\n\n/**\n * Full document schema from database\n * Extended with computed field chunksCount\n */\nconst BaseDocumentSchema = z.object({\n id: z.string(),\n externalId: z.string().nullable(),\n name: z.string(),\n content: z.string(),\n type: z.string(),\n language: z.string(),\n metadata: z.record(z.string(), z.unknown()),\n indexStatus: z.string(),\n processedAt: z.coerce.date().nullable(),\n createdAt: z.coerce.date(),\n createdBy: z.string(),\n updatedAt: z.coerce.date(),\n updatedBy: z.string(),\n deleted: z.boolean(),\n deletedAt: z.coerce.date().nullable(),\n deletedBy: z.string().nullable(),\n organizationId: z.string(),\n priority: z.number().int().min(1).max(5).default(3),\n})\n\nexport const DocumentSchema = BaseDocumentSchema.extend({\n type: z.enum(DocumentType),\n indexStatus: z.enum(IndexStatus),\n metadata: DocumentMetadataSchema,\n // Add computed field for chunks count (populated by service layer)\n chunksCount: z.number().optional(),\n // Computed fields for redundancy tracking\n redundantChunksCount: z.number().optional(),\n hasRedundantChunks: z.boolean().optional(),\n // Qdrant sync status\n qdrantSynced: z.boolean().optional(),\n // Agent IDs associated with this document (populated in single-item reads)\n agentIds: z.array(z.string()).optional(),\n // Folder ID for this document within an agent context (populated in agent-scoped reads)\n folderId: z.string().nullable().optional(),\n // Full folder path string e.g. \"Parent / Child\" (populated in list reads when agentId is set)\n folderPath: z.string().nullable().optional(),\n})\n\n/**\n * Query parameters for listing documents with pagination, sorting, and filters\n */\nexport const DocumentQuerystringSchema = z.object({\n ...zodQs.pagination(),\n ...zodQs.sort(['id', 'updatedAt', 'createdAt', 'name']),\n ...zodQs.filters(['type', 'language', 'agentId', 'indexStatus']),\n ...zodQs.fullText(),\n ...zodQs.ids(),\n 'filter[similarity]': z.string().optional(),\n // UUID = documents in that folder; 'null' = documents at root (no folder); absent = all documents\n 'filter[folderId]': z.string().optional(),\n 'filter[hasRedundantChunks]': z.string().optional(),\n})\n\n/**\n * Document creation schema for POST /documents endpoint\n *\n * Supports three types:\n * - 'file': Requires media object with uploaded file info\n * - 'url': Requires url string for web scraping\n * - 'revised-answer': Requires content (created from revisedAnswer service)\n */\nexport const DocumentCreateDtoSchema = z\n .object({\n type: z.enum(DocumentType).default(DocumentType.File),\n name: z.string().min(1).max(255).optional(),\n language: z.enum(SupportedLanguage).optional(),\n organizationId: z.string(),\n agentIds: z.array(z.string()).min(1, 'At least one agent is required'),\n folderId: z.uuid().nullable().optional(),\n media: MediaSchema.optional(),\n url: z.url().optional(),\n content: z.string().optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n extractionStrategy: z.enum(ExtractionStrategy).optional(),\n browserEngine: z.enum(BrowserEngine).optional(),\n headers: HeadesSchema.nullish().default([]),\n aiDescriptionModel: z.string().optional(),\n aiDescriptionPrompt: z.string().max(5000).optional(),\n forceOcr: z.boolean().default(false),\n pages: z\n .string()\n .max(100)\n .regex(/^\\d+(\\s*-\\s*\\d+)?(\\s*,\\s*\\d+(\\s*-\\s*\\d+)?)*$/)\n .optional(),\n priority: z.number().int().min(1).max(5).default(3).optional(),\n })\n .superRefine((data, ctx) => {\n if (data.type === DocumentType.File && !data.media) {\n ctx.addIssue({\n code: 'custom',\n params: {\n i18n: 'errors.required',\n },\n path: ['media'],\n })\n return\n }\n if (data.type === DocumentType.Url && !data.url) {\n ctx.addIssue({\n code: 'custom',\n params: {\n i18n: 'errors.required',\n },\n path: ['url'],\n })\n }\n if (\n data.type === DocumentType.PlainText &&\n !(data.name || data.language)\n ) {\n if (!data.name) {\n ctx.addIssue({\n code: 'custom',\n params: {\n i18n: 'errors.required',\n },\n path: ['name'],\n })\n }\n if (!data.language) {\n ctx.addIssue({\n code: 'custom',\n params: {\n i18n: 'errors.required',\n },\n path: ['language'],\n })\n }\n }\n })\n\n/**\n * Document update schema for PUT /documents/:id endpoint\n *\n * All fields are optional, but at least one must be provided\n */\nexport const DocumentUpdateDtoSchema = z.object({\n id: z.string(),\n organizationId: z.string(),\n content: z.string().optional(),\n name: z.string().min(1).max(255).optional(),\n language: z.enum(SupportedLanguage).optional(),\n priority: z.number().int().min(1).max(5).optional(),\n agentIds: z.array(z.string()).min(1).optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n})\n\n// ===== Type Exports =====\n\nexport type Document = z.infer<typeof DocumentSchema>\nexport type DocumentQuerystring = z.infer<typeof DocumentQuerystringSchema>\nexport type DocumentCreateDto = z.infer<typeof DocumentCreateDtoSchema>\nexport type DocumentUpdateDto = z.infer<typeof DocumentUpdateDtoSchema>\n\n// ===== Helper Functions =====\n\nexport const getStatusColor = (status: IndexStatus) => {\n switch (status) {\n case IndexStatus.Success:\n return 'success'\n case IndexStatus.Failed:\n return 'danger'\n case IndexStatus.Processing:\n return 'warning'\n default:\n return 'info'\n }\n}\n\nexport const getStatusIcon = (status: IndexStatus) => {\n switch (status) {\n case IndexStatus.Success:\n return 'ri:check-line'\n case IndexStatus.Failed:\n return 'ri:error-warning-line'\n case IndexStatus.Processing:\n return 'ri:hourglass-line'\n default:\n return 'ri:time-line'\n }\n}\n\nexport const getTypeIcon = (type: DocumentType) => {\n switch (type) {\n case DocumentType.File:\n return 'ri:file-line'\n case DocumentType.Url:\n return 'ri:link'\n case DocumentType.RevisedAnswer:\n return 'ri:feedback-line'\n default:\n return 'ri:input-method-line'\n }\n}\n\nexport const getFileIcon = (extension: string) => {\n const ext = (\n extension.startsWith('.') ? extension.slice(1) : extension\n ).toLowerCase()\n switch (ext) {\n case 'pdf':\n return 'ri:file-pdf-2-line'\n case 'doc':\n case 'docx':\n return 'ri:file-word-line'\n case 'xls':\n case 'xlsx':\n return 'ri:file-excel-line'\n case 'ppt':\n case 'pptx':\n return 'ri:file-ppt-line'\n case 'txt':\n return 'ri:file-text-line'\n case 'mp3':\n case 'wav':\n case 'ogg':\n return 'ri:file-music-line'\n case 'mp4':\n case 'avi':\n case 'mkv':\n return 'ri:file-video-line'\n case 'jpg':\n case 'jpeg':\n case 'png':\n case 'gif':\n case 'bmp':\n case 'svg':\n return 'ri:file-image-line'\n case 'zip':\n case 'rar':\n case '7z':\n return 'ri:file-zip-line'\n default:\n return 'ri:file-line'\n }\n}\n\n/** Whether a MIME type is an image. */\nexport const isImageMime = (mimeType?: string | null): boolean =>\n (mimeType ?? '').startsWith('image/')\n\n/** Whether a file MIME type can be previewed inline in the browser (image or\n * PDF) instead of being forced as a download. Shared by every file-list surface\n * so the preview/download decision stays consistent. */\nexport const isInlineViewable = (mimeType?: string | null): boolean =>\n isImageMime(mimeType) || mimeType === 'application/pdf'\n\n/** File-type identity for list rows and previews: icon, accent color\n * (CSS value driving glyph and tile tint) and a short human kind label. */\nexport interface FileKind {\n icon: string\n accent: string\n label: string\n}\n\n/** File-type identity derived from a MIME type. Accents match the chat\n * attachment cards (PkChatbotFilePreview) so files read the same everywhere. */\nexport const fileKindForMime = (mimeType?: string | null): FileKind => {\n const mime = mimeType ?? ''\n if (isImageMime(mime)) {\n return { icon: 'ri:image-line', accent: '#ec4899', label: 'Image' }\n }\n if (mime === 'application/pdf') {\n return { icon: 'ri:file-pdf-2-line', accent: '#e2483d', label: 'PDF' }\n }\n if (mime === 'application/msword' || mime.includes('wordprocessingml')) {\n return { icon: 'ri:file-word-line', accent: '#2b7de9', label: 'Word' }\n }\n if (mime === 'application/vnd.ms-excel' || mime.includes('spreadsheetml')) {\n return {\n icon: 'ri:file-excel-line',\n accent: '#1f9d57',\n label: 'Spreadsheet',\n }\n }\n if (\n mime === 'application/vnd.ms-powerpoint' ||\n mime.includes('presentationml')\n ) {\n return {\n icon: 'ri:file-ppt-line',\n accent: '#d98324',\n label: 'Presentation',\n }\n }\n if (mime.startsWith('audio/')) {\n return { icon: 'ri:file-music-line', accent: '#8b5cf6', label: 'Audio' }\n }\n if (mime.startsWith('video/')) {\n return { icon: 'ri:file-video-line', accent: '#6366f1', label: 'Video' }\n }\n if (\n mime === 'application/zip' ||\n mime === 'application/x-rar-compressed' ||\n mime === 'application/x-7z-compressed'\n ) {\n return { icon: 'ri:file-zip-line', accent: '#c08a1e', label: 'Archive' }\n }\n if (mime.startsWith('text/')) {\n return { icon: 'ri:file-text-line', accent: '#64748b', label: 'Text' }\n }\n return { icon: 'ri:file-line', accent: '#64748b', label: 'File' }\n}\n\n/** Icon for a file-list row, derived from its MIME type. */\nexport const fileIconForMime = (mimeType?: string | null): string =>\n fileKindForMime(mimeType).icon\n"],"mappings":";;;AAAA,IAAa,KAAiB,MAAyB;CAC9C,OAGL,OAAO,EACF,QAAQ,oBAAoB,EAAE,CAAC,CAC/B,QAAQ,wBAAwB,IAAI,CAAC,CACrC,QAAQ,sBAAsB,EAAE,CAAC,CACjC,QAAQ,aAAa,EAAE,CAAC,CACxB,QAAQ,4BAA4B,IAAI,CAAC,CACzC,QAAQ,cAAc,IAAI,CAAC,CAC3B,QAAQ,mBAAmB,EAAE,CAAC,CAC9B,QAAQ,QAAQ,GAAG,CAAC,CACpB,KAAK;AACd,GCXa,IAAe,EAAS;CACjC,KAAK,EAAS,CAAC,CAAC,SAAS;CACzB,OAAO,EAAS,CAAC,CAAC,SAAS;AAC/B,CAAC,GAEY,IAAe,EACxB,EAAQ,CAAY,GACpB,EAAQ,EAAS;CAAE,KAAK,EAAS;CAAG,OAAO,EAAS;AAAE,CAAC,CAAC,IACvD,MACG,GAAS,QACJ,MAAW,EAAO,KAAK,KAAK,KAAK,EAAO,OAAO,KAAK,CACzD,CACR,GCFY,IAAL,yBAAA,GAAA;QACH,EAAA,UAAA,WACA,EAAA,aAAA,cACA,EAAA,UAAA,WACA,EAAA,SAAA;AACJ,EAAA,CAAA,CAAA,GAQa,IAA0B,EAAS;CAC5C,oBAAoB,EAAO,CAAkB,CAAC,CAAC,SAAS;CACxD,eAAe,EACL,CAAa,CAAC,CACnB,SAAS,CAAC,CACV,QAAQ,EAAc,KAAK;CAChC,SAAS,EAAa,QAAQ;CAC9B,oBAAoB,EAAS,CAAC,CAAC,SAAS;CACxC,qBAAqB,EAAS,CAAC,CAAC,IAAI,GAAI,CAAC,CAAC,SAAS;CACnD,UAAU,EAAS,CAAC,CAAC,SAAS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AO;CAAQ,IAGvE,MAAS,qBACT,MAAS,kCACT,MAAS,gCAEF;EAAE,MAAM;EAAoB,QAAQ;EAAW,OAAO;CAAU,IAEvE,EAAK,WAAW,OAAO,IAChB;EAAE,MAAM;EAAqB,QAAQ;EAAW,OAAO;CAAO,IAElE;EAAE,MAAM;EAAgB,QAAQ;EAAW,OAAO;CAAO;AACpE,GAGa,KAAmB,MAC5B,EAAgB,CAAQ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"Document-DjNrISX1.js","names":[],"sources":["../../../../packages/utils/src/markdown.ts","../../../../packages/models/src/schema/Header.ts","../../../../packages/models/src/schema/Document.ts"],"sourcesContent":["export const stripMarkdown = (text?: string | null) => {\n if (!text) {\n return undefined\n }\n return text\n .replace(/!\\[.*?\\]\\(.*?\\)/g, '') // images\n .replace(/\\[([^\\]]+)\\]\\(.*?\\)/g, '$1') // links\n .replace(/`{1,3}[^`]*`{1,3}/g, '') // inline code / code blocks\n .replace(/#{1,6}\\s/g, '') // headings\n .replace(/(\\*{1,3}|_{1,3})(.*?)\\1/g, '$2') // bold / italic\n .replace(/~~(.*?)~~/g, '$1') // strikethrough\n .replace(/^\\s*[-*+>]\\s+/gm, '') // lists and blockquotes\n .replace(/\\n+/g, ' ') // newlines\n .trim()\n}\n","import * as z from 'zod'\nimport { decodeOnly } from '../utils'\n\nexport const HeaderSchema = z.object({\n key: z.string().optional(),\n value: z.string().optional(),\n})\n\nexport const HeadesSchema = decodeOnly(\n z.array(HeaderSchema),\n z.array(z.object({ key: z.string(), value: z.string() })),\n (headers) =>\n headers?.filter(\n (header) => header.key?.trim() && header.value?.trim(),\n ) as Array<{ key: string; value: string }>,\n)\n\nexport type Header = z.infer<typeof HeaderSchema>\nexport type Headers = z.infer<typeof HeadesSchema>\n","import * as z from 'zod'\nimport { zodQs, decodeOnly } from '../utils'\nimport {\n SupportedLanguage,\n ExtractionStrategy,\n BrowserEngine,\n} from './constants'\nimport { MediaSchema } from './Media'\nimport { HeadesSchema } from './Header'\n\n/**\n * Processing status for document indexing and embedding generation\n */\nexport enum IndexStatus {\n Pending = 'pending',\n Processing = 'processing',\n Success = 'success',\n Failed = 'failed',\n}\n\n// ===== Document Source Types =====\n\n/**\n * Conversion options for document processing\n * Used when creating or reprocessing documents\n */\nexport const ConversionOptionsSchema = z.object({\n extractionStrategy: z.enum(ExtractionStrategy).optional(),\n browserEngine: z\n .enum(BrowserEngine)\n .optional()\n .default(BrowserEngine.FETCH),\n headers: HeadesSchema.nullish(),\n aiDescriptionModel: z.string().optional(),\n aiDescriptionPrompt: z.string().max(5000).optional(),\n language: z.string().optional(),\n forceOcr: z.boolean().default(false),\n pages: z\n .string()\n .max(100)\n .regex(/^\\d+(\\s*-\\s*\\d+)?(\\s*,\\s*\\d+(\\s*-\\s*\\d+)?)*$/)\n .optional(),\n})\n\nexport type ConversionOptions = z.infer<typeof ConversionOptionsSchema>\n\n/**\n * Metadata structure for document.metadata column\n * Consolidates all metadata from converters and source info\n */\nexport const DocumentMetadataSchema = z\n .object({\n // === Source Info (URL documents only) ===\n source: z\n .object({\n url: z.string(),\n lastScrapedAt: z.string(),\n })\n .optional(),\n\n // === Media Info (File documents only) ===\n media: MediaSchema.optional(),\n\n // === Common Fields (all document types) ===\n title: z.string().optional(),\n author: z.string().optional(),\n description: z.string().optional(),\n summary: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n\n // === PDF Specific ===\n subject: z.string().optional(),\n creator: z.string().optional(), // Original application\n producer: z.string().optional(), // PDF generator software\n creationDate: z.string().optional(),\n modificationDate: z.string().optional(),\n pageCount: decodeOnly(\n z.union([z.number(), z.array(z.unknown())]),\n z.number(),\n (val) => (Array.isArray(val) ? val.length : val),\n ).optional(),\n encrypted: z.boolean().optional(),\n\n // === DOCX Specific ===\n characterCount: z.number().optional(),\n lineCount: z.number().optional(),\n\n // === URL Specific ===\n siteName: z.string().optional(),\n canonicalUrl: z.url().optional(),\n imageUrl: z.url().optional(),\n favicon: z.url().optional(),\n type: z.string().optional(), // og:type (article, website, etc.)\n locale: z.string().optional(),\n tags: z.array(z.string()).optional(),\n publishedTime: z.string().optional(),\n modifiedTime: z.string().optional(),\n\n // === Metrics (all document types) ===\n wordCount: z.number().optional(),\n paragraphCount: z.number().optional(),\n readingTime: z.number().optional(), // in minutes\n\n // === OCR (PDF documents) ===\n ocrUsed: z.boolean().optional(),\n ocrProvider: z.string().optional(),\n ocrModel: z.string().optional(),\n ocrPages: z.string().optional(),\n ocrCost: z.number().optional(),\n ocrError: z.string().optional(),\n\n // === RAG / Duplicates / Sync Info ===\n chunksCount: z.number().optional(),\n redundantChunksCount: z.number().optional(),\n hasRedundantChunks: z.boolean().optional(),\n qdrantSynced: z.boolean().optional(),\n\n // === Conversion Options (for reprocessing) ===\n conversionOptions: ConversionOptionsSchema.optional(),\n })\n .loose() // Allow additional custom fields\n\nexport type DocumentMetadata = z.infer<typeof DocumentMetadataSchema>\n\n/**\n * Document type enum\n *\n * - 'file': Document created from uploaded file (PDF, DOCX)\n * - 'url': Document created from web scraping\n * - 'revised-answer': Document created from revised AI answer\n * - 'plain-text': Document created from plain text input\n */\nexport enum DocumentType {\n File = 'file',\n Url = 'url',\n RevisedAnswer = 'revised-answer',\n PlainText = 'plain-text',\n}\n\n// ===== Schemas =====\n\n/**\n * Full document schema from database\n * Extended with computed field chunksCount\n */\nconst BaseDocumentSchema = z.object({\n id: z.string(),\n externalId: z.string().nullable(),\n name: z.string(),\n content: z.string(),\n type: z.string(),\n language: z.string(),\n metadata: z.record(z.string(), z.unknown()),\n indexStatus: z.string(),\n processedAt: z.coerce.date().nullable(),\n createdAt: z.coerce.date(),\n createdBy: z.string(),\n updatedAt: z.coerce.date(),\n updatedBy: z.string(),\n deleted: z.boolean(),\n deletedAt: z.coerce.date().nullable(),\n deletedBy: z.string().nullable(),\n organizationId: z.string(),\n priority: z.number().int().min(1).max(5).default(3),\n})\n\nexport const DocumentSchema = BaseDocumentSchema.extend({\n type: z.enum(DocumentType),\n indexStatus: z.enum(IndexStatus),\n metadata: DocumentMetadataSchema,\n // Add computed field for chunks count (populated by service layer)\n chunksCount: z.number().optional(),\n // Computed fields for redundancy tracking\n redundantChunksCount: z.number().optional(),\n hasRedundantChunks: z.boolean().optional(),\n // Qdrant sync status\n qdrantSynced: z.boolean().optional(),\n // Agent IDs associated with this document (populated in single-item reads)\n agentIds: z.array(z.string()).optional(),\n // Folder ID for this document within an agent context (populated in agent-scoped reads)\n folderId: z.string().nullable().optional(),\n // Full folder path string e.g. \"Parent / Child\" (populated in list reads when agentId is set)\n folderPath: z.string().nullable().optional(),\n})\n\n/**\n * Query parameters for listing documents with pagination, sorting, and filters\n */\nexport const DocumentQuerystringSchema = z.object({\n ...zodQs.pagination(),\n ...zodQs.sort(['id', 'updatedAt', 'createdAt', 'name']),\n ...zodQs.filters(['type', 'language', 'agentId', 'indexStatus']),\n ...zodQs.fullText(),\n ...zodQs.ids(),\n 'filter[similarity]': z.string().optional(),\n // UUID = documents in that folder; 'null' = documents at root (no folder); absent = all documents\n 'filter[folderId]': z.string().optional(),\n 'filter[hasRedundantChunks]': z.string().optional(),\n})\n\n/**\n * Document creation schema for POST /documents endpoint\n *\n * Supports three types:\n * - 'file': Requires media object with uploaded file info\n * - 'url': Requires url string for web scraping\n * - 'revised-answer': Requires content (created from revisedAnswer service)\n */\nexport const DocumentCreateDtoSchema = z\n .object({\n type: z.enum(DocumentType).default(DocumentType.File),\n name: z.string().min(1).max(255).optional(),\n language: z.enum(SupportedLanguage).optional(),\n organizationId: z.string(),\n agentIds: z.array(z.string()).min(1, 'At least one agent is required'),\n folderId: z.uuid().nullable().optional(),\n media: MediaSchema.optional(),\n url: z.url().optional(),\n content: z.string().optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n extractionStrategy: z.enum(ExtractionStrategy).optional(),\n browserEngine: z.enum(BrowserEngine).optional(),\n headers: HeadesSchema.nullish().default([]),\n aiDescriptionModel: z.string().optional(),\n aiDescriptionPrompt: z.string().max(5000).optional(),\n forceOcr: z.boolean().default(false),\n pages: z\n .string()\n .max(100)\n .regex(/^\\d+(\\s*-\\s*\\d+)?(\\s*,\\s*\\d+(\\s*-\\s*\\d+)?)*$/)\n .optional(),\n priority: z.number().int().min(1).max(5).default(3).optional(),\n })\n .superRefine((data, ctx) => {\n if (data.type === DocumentType.File && !data.media) {\n ctx.addIssue({\n code: 'custom',\n params: {\n i18n: 'errors.required',\n },\n path: ['media'],\n })\n return\n }\n if (data.type === DocumentType.Url && !data.url) {\n ctx.addIssue({\n code: 'custom',\n params: {\n i18n: 'errors.required',\n },\n path: ['url'],\n })\n }\n if (\n data.type === DocumentType.PlainText &&\n !(data.name || data.language)\n ) {\n if (!data.name) {\n ctx.addIssue({\n code: 'custom',\n params: {\n i18n: 'errors.required',\n },\n path: ['name'],\n })\n }\n if (!data.language) {\n ctx.addIssue({\n code: 'custom',\n params: {\n i18n: 'errors.required',\n },\n path: ['language'],\n })\n }\n }\n })\n\n/**\n * Document update schema for PUT /documents/:id endpoint\n *\n * All fields are optional, but at least one must be provided\n */\nexport const DocumentUpdateDtoSchema = z.object({\n id: z.string(),\n organizationId: z.string(),\n content: z.string().optional(),\n name: z.string().min(1).max(255).optional(),\n language: z.enum(SupportedLanguage).optional(),\n priority: z.number().int().min(1).max(5).optional(),\n agentIds: z.array(z.string()).min(1).optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n})\n\n// ===== Type Exports =====\n\nexport type Document = z.infer<typeof DocumentSchema>\nexport type DocumentQuerystring = z.infer<typeof DocumentQuerystringSchema>\nexport type DocumentCreateDto = z.infer<typeof DocumentCreateDtoSchema>\nexport type DocumentUpdateDto = z.infer<typeof DocumentUpdateDtoSchema>\n\n// ===== Helper Functions =====\n\nexport const getStatusColor = (status: IndexStatus) => {\n switch (status) {\n case IndexStatus.Success:\n return 'success'\n case IndexStatus.Failed:\n return 'danger'\n case IndexStatus.Processing:\n return 'warning'\n default:\n return 'info'\n }\n}\n\nexport const getStatusIcon = (status: IndexStatus) => {\n switch (status) {\n case IndexStatus.Success:\n return 'ri:check-line'\n case IndexStatus.Failed:\n return 'ri:error-warning-line'\n case IndexStatus.Processing:\n return 'ri:hourglass-line'\n default:\n return 'ri:time-line'\n }\n}\n\nexport const getTypeIcon = (type: DocumentType) => {\n switch (type) {\n case DocumentType.File:\n return 'ri:file-line'\n case DocumentType.Url:\n return 'ri:link'\n case DocumentType.RevisedAnswer:\n return 'ri:feedback-line'\n default:\n return 'ri:input-method-line'\n }\n}\n\nexport const getFileIcon = (extension: string) => {\n const ext = (\n extension.startsWith('.') ? extension.slice(1) : extension\n ).toLowerCase()\n switch (ext) {\n case 'pdf':\n return 'ri:file-pdf-2-line'\n case 'doc':\n case 'docx':\n return 'ri:file-word-line'\n case 'xls':\n case 'xlsx':\n return 'ri:file-excel-line'\n case 'ppt':\n case 'pptx':\n return 'ri:file-ppt-line'\n case 'txt':\n return 'ri:file-text-line'\n case 'mp3':\n case 'wav':\n case 'ogg':\n return 'ri:file-music-line'\n case 'mp4':\n case 'avi':\n case 'mkv':\n return 'ri:file-video-line'\n case 'jpg':\n case 'jpeg':\n case 'png':\n case 'gif':\n case 'bmp':\n case 'svg':\n return 'ri:file-image-line'\n case 'zip':\n case 'rar':\n case '7z':\n return 'ri:file-zip-line'\n default:\n return 'ri:file-line'\n }\n}\n\n/** Whether a MIME type is an image. */\nexport const isImageMime = (mimeType?: string | null): boolean =>\n (mimeType ?? '').startsWith('image/')\n\n/** Whether a file MIME type can be previewed inline in the browser (image or\n * PDF) instead of being forced as a download. Shared by every file-list surface\n * so the preview/download decision stays consistent. */\nexport const isInlineViewable = (mimeType?: string | null): boolean =>\n isImageMime(mimeType) || mimeType === 'application/pdf'\n\n/** File-type identity for list rows and previews: icon, accent color\n * (CSS value driving glyph and tile tint) and a short human kind label. */\nexport interface FileKind {\n icon: string\n accent: string\n label: string\n}\n\n/** File-type identity derived from a MIME type. Accents match the chat\n * attachment cards (PkChatbotFilePreview) so files read the same everywhere. */\nexport const fileKindForMime = (mimeType?: string | null): FileKind => {\n const mime = mimeType ?? ''\n if (isImageMime(mime)) {\n return { icon: 'ri:image-line', accent: '#ec4899', label: 'Image' }\n }\n if (mime === 'application/pdf') {\n return { icon: 'ri:file-pdf-2-line', accent: '#e2483d', label: 'PDF' }\n }\n if (mime === 'application/msword' || mime.includes('wordprocessingml')) {\n return { icon: 'ri:file-word-line', accent: '#2b7de9', label: 'Word' }\n }\n if (mime === 'application/vnd.ms-excel' || mime.includes('spreadsheetml')) {\n return {\n icon: 'ri:file-excel-line',\n accent: '#1f9d57',\n label: 'Spreadsheet',\n }\n }\n if (\n mime === 'application/vnd.ms-powerpoint' ||\n mime.includes('presentationml')\n ) {\n return {\n icon: 'ri:file-ppt-line',\n accent: '#d98324',\n label: 'Presentation',\n }\n }\n if (mime.startsWith('audio/')) {\n return { icon: 'ri:file-music-line', accent: '#8b5cf6', label: 'Audio' }\n }\n if (mime.startsWith('video/')) {\n return { icon: 'ri:file-video-line', accent: '#6366f1', label: 'Video' }\n }\n if (\n mime === 'application/zip' ||\n mime === 'application/x-rar-compressed' ||\n mime === 'application/x-7z-compressed'\n ) {\n return { icon: 'ri:file-zip-line', accent: '#c08a1e', label: 'Archive' }\n }\n if (mime.startsWith('text/')) {\n return { icon: 'ri:file-text-line', accent: '#64748b', label: 'Text' }\n }\n return { icon: 'ri:file-line', accent: '#64748b', label: 'File' }\n}\n\n/** Icon for a file-list row, derived from its MIME type. */\nexport const fileIconForMime = (mimeType?: string | null): string =>\n fileKindForMime(mimeType).icon\n"],"mappings":";;;AAAA,IAAa,KAAiB,MAAyB;CAC9C,OAGL,OAAO,EACF,QAAQ,oBAAoB,EAAE,CAAC,CAC/B,QAAQ,wBAAwB,IAAI,CAAC,CACrC,QAAQ,sBAAsB,EAAE,CAAC,CACjC,QAAQ,aAAa,EAAE,CAAC,CACxB,QAAQ,4BAA4B,IAAI,CAAC,CACzC,QAAQ,cAAc,IAAI,CAAC,CAC3B,QAAQ,mBAAmB,EAAE,CAAC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"openai/gpt-5-mini", e.gpt51Thinking = "openai/gpt-5.1-thinking", e.gpt52 = "openai/gpt-5.2", e.gpt54nano = "openai/gpt-5.4-nano", e.gpt54mini = "openai/gpt-5.4-mini", e.gpt54 = "openai/gpt-5.4", e.gpt54Pro = "openai/gpt-5.4-pro", e.gpt55 = "openai/gpt-5.5", e.gpt55Pro = "openai/gpt-5.5-pro", e.gpt56Luna = "openai/gpt-5.6-luna", e.gpt56Terra = "openai/gpt-5.6-terra", e.gpt56Sol = "openai/gpt-5.6-sol", e.gpt56LunaFast = "openai/gpt-5.6-luna-fast", e.gpt56TerraFast = "openai/gpt-5.6-terra-fast", e.gpt56SolFast = "openai/gpt-5.6-sol-fast", e.gemini25FlashLite = "google/gemini-2.5-flash-lite", e.gemini25Flash = "google/gemini-2.5-flash", e.gemini25Pro = "google/gemini-2.5-pro", e.gemini3Flash = "google/gemini-3-flash", e.gemini31ProPreview = "google/gemini-3.1-pro-preview", e.gemini31FlashLite = "google/gemini-3.1-flash-lite", e.gemini35Flash = "google/gemini-3.5-flash", e.gemini35FlashLite = "google/gemini-3.5-flash-lite", e.gemini36Flash = "google/gemini-3.6-flash", e.gemini37Flash = "google/gemini-3.7-flash", e.gemini38Flash = "google/gemini-3.8-flash", e.claudeHaiku45 = "anthropic/claude-haiku-4.5", e.claudeSonnet46 = "anthropic/claude-sonnet-4.6", e.claudeSonnet5 = "anthropic/claude-sonnet-5", e.claudeOpus46 = "anthropic/claude-opus-4.6", e.claudeOpus47 = "anthropic/claude-opus-4.7", e.claudeOpus48 = "anthropic/claude-opus-4.8", e.claudeOpus5 = "anthropic/claude-opus-5", e.claudeOpus5Fast = "anthropic/claude-opus-5-fast", e.claudeFable5 = "anthropic/claude-fable-5", e.claudeFable51 = "anthropic/claude-fable-5.1", e.deepseek32 = "deepseek/deepseek-v3.2", e.deepseek4Flash0731 = "deepseek/deepseek-v4-flash-0731", e.alibabaQwen36Plus = "alibaba/qwen3.6-plus", e.alibabaQwen37Max = "alibaba/qwen3.7-max", e.alibabaQwen37Plus = "alibaba/qwen3.7-plus", e.alibabaQwen37Flash = "alibaba/qwen3.7-flash", e.alibabaQwen38Max = "alibaba/qwen3.8-max", e.alibabaQwen3827b = "alibaba/qwen3.8-27b", e.alibabaQwen38Max0902 = "alibaba/qwen3.8-max-0902", e.spacexaiGrok43 = "spacexai/grok-4.3", e.spacexaiGrok46 = "spacexai/grok-4.6", e.zaiGlm52 = "zai/glm-5.2", e.zaiGlm52Fast = "zai/glm-5.2-fast", e.zaiGlm53 = "zai/glm-5.3", e.zaiGlm53Flash = "zai/glm-5.3-flash", e.zaiGlm53Fast = "zai/glm-5.3-fast", e.zaiGlm53Promo50 = "zai/glm-5.3-promo-50", e.metaMuseSpark11 = "meta/muse-spark-1.1", e.metaMuseSpark12 = "meta/muse-spark-1.2", e.moonshotaiKimiK3 = "moonshotai/kimi-k3", e.moonshotaiKimiK3Fast = "moonshotai/kimi-k3-fast", e;
|
|
35
|
+
return e.gpt5Nano = "openai/gpt-5-nano", e.gpt5Mini = "openai/gpt-5-mini", e.gpt51Thinking = "openai/gpt-5.1-thinking", e.gpt52 = "openai/gpt-5.2", e.gpt54nano = "openai/gpt-5.4-nano", e.gpt54mini = "openai/gpt-5.4-mini", e.gpt54 = "openai/gpt-5.4", e.gpt54Pro = "openai/gpt-5.4-pro", e.gpt55 = "openai/gpt-5.5", e.gpt55Pro = "openai/gpt-5.5-pro", e.gpt56Luna = "openai/gpt-5.6-luna", e.gpt56Terra = "openai/gpt-5.6-terra", e.gpt56Sol = "openai/gpt-5.6-sol", e.gpt56LunaFast = "openai/gpt-5.6-luna-fast", e.gpt56TerraFast = "openai/gpt-5.6-terra-fast", e.gpt56SolFast = "openai/gpt-5.6-sol-fast", e.gpt6Astra = "openai/gpt-6-astra", e.gpt6AstraFast = "openai/gpt-6-astra-fast", e.gemini25FlashLite = "google/gemini-2.5-flash-lite", e.gemini25Flash = "google/gemini-2.5-flash", e.gemini25Pro = "google/gemini-2.5-pro", e.gemini3Flash = "google/gemini-3-flash", e.gemini31ProPreview = "google/gemini-3.1-pro-preview", e.gemini31FlashLite = "google/gemini-3.1-flash-lite", e.gemini35Flash = "google/gemini-3.5-flash", e.gemini35FlashLite = "google/gemini-3.5-flash-lite", e.gemini36Flash = "google/gemini-3.6-flash", e.gemini37Flash = "google/gemini-3.7-flash", e.gemini38Flash = "google/gemini-3.8-flash", e.claudeHaiku45 = "anthropic/claude-haiku-4.5", e.claudeSonnet46 = "anthropic/claude-sonnet-4.6", e.claudeSonnet5 = "anthropic/claude-sonnet-5", e.claudeOpus46 = "anthropic/claude-opus-4.6", e.claudeOpus47 = "anthropic/claude-opus-4.7", e.claudeOpus48 = "anthropic/claude-opus-4.8", e.claudeOpus5 = "anthropic/claude-opus-5", e.claudeOpus5Fast = "anthropic/claude-opus-5-fast", e.claudeFable5 = "anthropic/claude-fable-5", e.claudeFable51 = "anthropic/claude-fable-5.1", e.deepseek32 = "deepseek/deepseek-v3.2", e.deepseek4Flash0731 = "deepseek/deepseek-v4-flash-0731", e.alibabaQwen36Plus = "alibaba/qwen3.6-plus", e.alibabaQwen37Max = "alibaba/qwen3.7-max", e.alibabaQwen37Plus = "alibaba/qwen3.7-plus", e.alibabaQwen37Flash = "alibaba/qwen3.7-flash", e.alibabaQwen38Max = "alibaba/qwen3.8-max", e.alibabaQwen3827b = "alibaba/qwen3.8-27b", e.alibabaQwen38Max0902 = "alibaba/qwen3.8-max-0902", e.spacexaiGrok43 = "spacexai/grok-4.3", e.spacexaiGrok46 = "spacexai/grok-4.6", e.zaiGlm52 = "zai/glm-5.2", e.zaiGlm52Fast = "zai/glm-5.2-fast", e.zaiGlm53 = "zai/glm-5.3", e.zaiGlm53Flash = "zai/glm-5.3-flash", e.zaiGlm53Fast = "zai/glm-5.3-fast", e.zaiGlm53Promo50 = "zai/glm-5.3-promo-50", e.metaMuseSpark11 = "meta/muse-spark-1.1", e.metaMuseSpark12 = "meta/muse-spark-1.2", e.moonshotaiKimiK3 = "moonshotai/kimi-k3", e.moonshotaiKimiK3Fast = "moonshotai/kimi-k3-fast", e;
|
|
36
36
|
}({});
|
|
37
37
|
(/* @__PURE__ */ (function(e) {
|
|
38
38
|
return e.textEmbedding3Small = "openai/text-embedding-3-small", e.geminiEmbedding2 = "google/gemini-embedding-2", e;
|
|
@@ -122,4 +122,4 @@ c("type", [
|
|
|
122
122
|
//#endregion
|
|
123
123
|
export { C as a, y as c, T as i, S as l, N as n, w as o, E as r, _ as s, D as t, g as u };
|
|
124
124
|
|
|
125
|
-
//# sourceMappingURL=Media-
|
|
125
|
+
//# sourceMappingURL=Media-hjgDyEMr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Media-hjgDyEMr.js","names":["core._coercedDate","schemas.ZodDate"],"sources":["../../../../node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/coerce.js","../../../../packages/models/src/utils.ts","../../../../packages/models/src/schema/constants.ts","../../../../packages/models/src/schema/Media.ts"],"sourcesContent":["import * as core from \"../core/index.js\";\nimport * as schemas from \"./schemas.js\";\nexport function string(params) {\n return core._coercedString(schemas.ZodString, params);\n}\nexport function number(params) {\n return core._coercedNumber(schemas.ZodNumber, params);\n}\nexport function boolean(params) {\n return core._coercedBoolean(schemas.ZodBoolean, params);\n}\nexport function bigint(params) {\n return core._coercedBigint(schemas.ZodBigInt, params);\n}\nexport function date(params) {\n return core._coercedDate(schemas.ZodDate, params);\n}\n","import * as z from 'zod'\n\n/**\n * Bidirectional wrapper for decode-time normalizations.\n *\n * Response serialization must never hit a unidirectional transform\n * (z.preprocess/.transform throw ZodEncodeError under zod encode), so\n * normalizing schemas are expressed as codecs: `decode` runs the\n * normalization (output validity is enforced by the output schema at\n * runtime), while `encode` is the identity for already-normalized data.\n */\nexport const decodeOnly = <Input extends z.ZodType, Output extends z.ZodType>(\n input: Input,\n output: Output,\n decode: (value: z.output<Input>) => z.input<Output>,\n) =>\n z.codec(input, output, {\n // Identity: already-normalized data is serialized unchanged. The\n // input schema re-validates at runtime, so the cast is type-only.\n encode: (value) => value as z.output<Input>,\n decode,\n })\n\nconst MAX_SCHEMA_SIZE_BYTES = 50 * 1024 // 50 KB\n\n/** Reusable Zod field for JSON Schema objects with a 50 KB size limit. */\nexport const jsonSchemaField = z\n .record(z.string(), z.unknown())\n .refine((val) => JSON.stringify(val).length <= MAX_SCHEMA_SIZE_BYTES, {\n message: `Schema must not exceed ${MAX_SCHEMA_SIZE_BYTES / 1024} KB`,\n })\n\nexport type QueryStringFilter<T extends string = string> = `filter[${T}]`\nexport type Querystring = {\n 'page[number]'?: number | string\n 'page[size]'?: number | string\n sort?: string[] | string\n [filterKeys: QueryStringFilter]: unknown\n [otherKeys: string]: unknown\n}\n\nexport const makeSortEnum = <const T extends string>(input: T) => {\n return [`${input}`, `-${input}`] as [T, `-${T}`]\n}\n\nexport const makeSortEnums = <const T extends string>(input: readonly T[]) => {\n return input.flatMap((i) => makeSortEnum(i))\n}\n\nexport const zodQs = {\n pagination: (defaultNumber = 1, defaultSize = 10) => {\n return {\n 'page[number]': z\n .number()\n .or(z.string())\n .transform((v) => Number(v))\n .default(defaultNumber),\n 'page[size]': z\n .number()\n .or(z.string())\n .transform((v) => Number(v))\n .default(defaultSize),\n }\n },\n filter: <const T extends string>(input: T) => {\n return { [`filter[${input}]`]: z.string().optional() } as Record<\n `filter[${T}]`,\n z.ZodOptional<z.ZodString | z.ZodArray<z.ZodString>>\n >\n },\n include: <const T extends string>(input: T) => {\n return { [`include[${input}]`]: z.string().optional() } as Record<\n `include[${T}]`,\n z.ZodOptional<z.ZodArray<z.ZodString> | z.ZodString>\n >\n },\n range: <const T extends string>(input: T) => {\n return {\n [`from[${input}]`]: z.string().optional(),\n [`to[${input}]`]: z.string().optional(),\n } as Record<`from[${T}]` | `to[${T}]`, z.ZodOptional<z.ZodString>>\n },\n has: <const T extends string>(input: T) => {\n return { [`has[${input}]`]: z.boolean().optional() } as Record<\n `has[${T}]`,\n z.ZodOptional<z.ZodBoolean>\n >\n },\n fullText: () => {\n return { [`filter[fullText]`]: z.string().optional() }\n },\n ids: () => {\n return { ids: z.union([z.string(), z.array(z.string())]).optional() }\n },\n deleted: () => {\n return { 'filter[isDeleted]': z.boolean().default(false) }\n },\n filters: <const T extends string>(input: readonly T[]) => {\n return input\n .map((i) => zodQs.filter(i))\n .reduce((a, b) => ({ ...a, ...b }))\n },\n sort: <const S extends string>(sort: S[]) => {\n const sortEnums = makeSortEnums(sort) as [S, ...`-${S}`[]]\n return {\n // @ts-expect-error: zod does not support tuple types\n sort: z.enum(sortEnums).optional().default(sortEnums[0]),\n }\n },\n}\n","/**\n * Models an agent can run on.\n *\n * The picker is this enum (`MODELS` in `packages/components/src/chat`), so\n * **declaration order is the order users see** and the two cannot drift apart\n * any more: reorder a line here and you reorder the dropdown. Retiring a model\n * means deleting its line, which breaks every reference at compile time; agents\n * already saved on it keep the id as data, because `Agent.model` is a plain\n * string.\n *\n * Embedding models are not here, they are not selectable: see\n * {@link EmbeddingModel}.\n */\nexport enum LanguageModel {\n // OpenAI\n gpt5Nano = 'openai/gpt-5-nano',\n gpt5Mini = 'openai/gpt-5-mini',\n gpt51Thinking = 'openai/gpt-5.1-thinking',\n gpt52 = 'openai/gpt-5.2',\n gpt54nano = 'openai/gpt-5.4-nano',\n gpt54mini = 'openai/gpt-5.4-mini',\n gpt54 = 'openai/gpt-5.4',\n gpt54Pro = 'openai/gpt-5.4-pro',\n gpt55 = 'openai/gpt-5.5',\n gpt55Pro = 'openai/gpt-5.5-pro',\n gpt56Luna = 'openai/gpt-5.6-luna',\n gpt56Terra = 'openai/gpt-5.6-terra',\n gpt56Sol = 'openai/gpt-5.6-sol',\n gpt56LunaFast = 'openai/gpt-5.6-luna-fast',\n gpt56TerraFast = 'openai/gpt-5.6-terra-fast',\n gpt56SolFast = 'openai/gpt-5.6-sol-fast',\n gpt6Astra = 'openai/gpt-6-astra',\n gpt6AstraFast = 'openai/gpt-6-astra-fast',\n // Google Gemini\n gemini25FlashLite = 'google/gemini-2.5-flash-lite',\n gemini25Flash = 'google/gemini-2.5-flash',\n gemini25Pro = 'google/gemini-2.5-pro',\n gemini3Flash = 'google/gemini-3-flash',\n gemini31ProPreview = 'google/gemini-3.1-pro-preview',\n gemini31FlashLite = 'google/gemini-3.1-flash-lite',\n gemini35Flash = 'google/gemini-3.5-flash',\n gemini35FlashLite = 'google/gemini-3.5-flash-lite',\n gemini36Flash = 'google/gemini-3.6-flash',\n gemini37Flash = 'google/gemini-3.7-flash',\n gemini38Flash = 'google/gemini-3.8-flash',\n // Anthropic Claude\n claudeHaiku45 = 'anthropic/claude-haiku-4.5',\n claudeSonnet46 = 'anthropic/claude-sonnet-4.6',\n claudeSonnet5 = 'anthropic/claude-sonnet-5',\n claudeOpus46 = 'anthropic/claude-opus-4.6',\n claudeOpus47 = 'anthropic/claude-opus-4.7',\n claudeOpus48 = 'anthropic/claude-opus-4.8',\n claudeOpus5 = 'anthropic/claude-opus-5',\n claudeOpus5Fast = 'anthropic/claude-opus-5-fast',\n claudeFable5 = 'anthropic/claude-fable-5',\n claudeFable51 = 'anthropic/claude-fable-5.1',\n // Deepseek\n deepseek32 = 'deepseek/deepseek-v3.2',\n deepseek4Flash0731 = 'deepseek/deepseek-v4-flash-0731',\n // Alibaba\n alibabaQwen36Plus = 'alibaba/qwen3.6-plus',\n alibabaQwen37Max = 'alibaba/qwen3.7-max',\n alibabaQwen37Plus = 'alibaba/qwen3.7-plus',\n alibabaQwen37Flash = 'alibaba/qwen3.7-flash',\n alibabaQwen38Max = 'alibaba/qwen3.8-max',\n alibabaQwen3827b = 'alibaba/qwen3.8-27b',\n alibabaQwen38Max0902 = 'alibaba/qwen3.8-max-0902',\n // SpaceXAI\n spacexaiGrok43 = 'spacexai/grok-4.3',\n spacexaiGrok46 = 'spacexai/grok-4.6',\n // z.ai\n zaiGlm52 = 'zai/glm-5.2',\n zaiGlm52Fast = 'zai/glm-5.2-fast',\n zaiGlm53 = 'zai/glm-5.3',\n zaiGlm53Flash = 'zai/glm-5.3-flash',\n zaiGlm53Fast = 'zai/glm-5.3-fast',\n zaiGlm53Promo50 = 'zai/glm-5.3-promo-50',\n // Meta\n metaMuseSpark11 = 'meta/muse-spark-1.1',\n metaMuseSpark12 = 'meta/muse-spark-1.2',\n // Moonshot AI\n moonshotaiKimiK3 = 'moonshotai/kimi-k3',\n moonshotaiKimiK3Fast = 'moonshotai/kimi-k3-fast',\n}\n\n/**\n * Models used to vectorize text, never to answer. Kept apart from\n * {@link LanguageModel} so the chat plumbing, which types its `model` parameter\n * with that enum, cannot be handed an embedding id.\n */\nexport enum EmbeddingModel {\n textEmbedding3Small = 'openai/text-embedding-3-small',\n geminiEmbedding2 = 'google/gemini-embedding-2',\n}\n\nexport const EMBED_MODEL = EmbeddingModel.geminiEmbedding2\n\nexport enum LanguageModelBrand {\n openai = 'openai',\n google = 'google',\n anthropic = 'anthropic',\n deepseek = 'deepseek',\n spacexai = 'spacexai',\n zai = 'zai',\n meta = 'meta',\n alibaba = 'alibaba',\n moonshotai = 'moonshotai',\n}\n\n/**\n * Supported languages for documents and revised answers\n */\nexport enum SupportedLanguage {\n it = 'it',\n en = 'en',\n es = 'es',\n fr = 'fr',\n de = 'de',\n}\n\n/**\n * Language display names (i18n keys)\n */\nexport const LANGUAGE_NAMES: Record<SupportedLanguage, string> = {\n [SupportedLanguage.it]: 'language.italian',\n [SupportedLanguage.en]: 'language.english',\n [SupportedLanguage.es]: 'language.spanish',\n [SupportedLanguage.fr]: 'language.french',\n [SupportedLanguage.de]: 'language.german',\n}\n\n/**\n * Content extraction strategies for URL scraping\n */\nexport enum ExtractionStrategy {\n /** Use Mozilla Readability for content extraction (fast, free, no API calls) */\n READABILITY = 'readability',\n /** Use AI-based extraction (better for complex layouts, requires API calls) */\n AI = 'ai',\n}\n\n/**\n * Browser engine options for URL scraping\n */\nexport enum BrowserEngine {\n /** Use simple HTTP fetch (fast, lightweight, no JavaScript support) */\n FETCH = 'fetch',\n /** Use Puppeteer with headless Chrome (full browser, JavaScript support) */\n PUPPETEER = 'puppeteer',\n /** Delegate browser rendering to an external pdf-image-generator service */\n REMOTE = 'remote',\n}\n\n/**\n * Which report family has to account for a credit charge.\n *\n * The hourly reconciliation trusts `cost_reports` (the gateway's own billing,\n * copied in house) as the source of truth for what an organization spent. A\n * charge whose supplier is not the gateway has no counterpart there, so it must\n * be told apart or the reconciliation forgives it: that is what happened to the\n * voice minutes until 2026-08-31.\n *\n * Declared here, written on the ledger row at charge time, never inferred from\n * `source` downstream: the next non-gateway supplier must be a compile-time\n * decision, not a string nobody remembered to add to a list.\n */\nexport enum BillingSource {\n /** Billed by the AI gateway, so it lands in `cost_reports`. */\n GATEWAY = 'gateway',\n /** Billed by another supplier (voice minutes, OCR): the ledger is the only record. */\n INTERNAL = 'internal',\n}\n\n/**\n * Kinds of row on the credit ledger.\n *\n * It used to be a free string with exactly one value ever written, `debit`.\n * Adding a second one is not free: the hourly reconciliation sums debits to\n * rebuild the real-time estimate, and the analytics endpoint sums the ledger to\n * chart spend, so a new type that nobody filters out is a number silently\n * doubled.\n */\nexport enum CreditTransactionType {\n /** A charge for something consumed, written in real time. */\n DEBIT = 'debit',\n /** The hourly settlement against the gateway report: the audit trail of a balance move. */\n RECONCILIATION = 'reconciliation',\n}\n","import { z } from 'zod'\n\n// ===== Constants =====\n\nexport const MAX_FILE_SIZE = 100 * 1024 * 1024 // 100MB\n\nexport const MIME_TYPE_REGEX = /^[a-z]+\\/[a-z0-9\\-+.]+$/i\n\nexport const SUPPORTED_IMAGE_TYPES = [\n 'image/jpeg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'image/svg+xml',\n] as const\n\nexport const SUPPORTED_DOCUMENT_TYPES = [\n 'application/pdf',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/vnd.ms-excel',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'text/plain',\n 'text/markdown',\n] as const\n\nexport const SUPPORTED_VIDEO_TYPES = [\n 'video/mp4',\n 'video/webm',\n 'video/ogg',\n] as const\n\nexport const SUPPORTED_AUDIO_TYPES = [\n 'audio/mpeg',\n 'audio/wav',\n 'audio/ogg',\n] as const\n\n// ===== Enums =====\n\nexport enum StoragePolicy {\n DEFAULT = 'default',\n COLD = 'cold',\n HOT = 'hot',\n ARCHIVE = 'archive',\n}\n\nexport enum PreviewStatus {\n Pending = 'pending',\n Done = 'done',\n Failed = 'failed',\n}\n\n// ===== Storage Handle Schemas =====\n\nconst AzureBlobStorageHandleSchema = z.object({\n type: z.literal('azure-blob'),\n blobUri: z.url(),\n containerName: z.string().min(1),\n pathRelativeToContainer: z.string().min(1),\n})\n\nconst S3StorageHandleSchema = z.object({\n type: z.literal('s3'),\n bucket: z.string().min(1),\n key: z.string().min(1),\n region: z.string().min(1),\n})\n\nconst StorageHandleSchema = z.discriminatedUnion('type', [\n AzureBlobStorageHandleSchema,\n S3StorageHandleSchema,\n])\n\n// ===== Media Upload Schema =====\n\n/**\n * Media upload information for preparing a file upload\n */\nexport const MediaUploadSchema = z.object({\n /** Media type category (picture, video, audio, etc.) */\n type: z.string().min(1),\n /** Original filename */\n name: z.string().min(1),\n /** MIME type (e.g., 'image/jpeg') */\n mimeType: z.string().regex(MIME_TYPE_REGEX),\n /** File size in bytes (must be positive) */\n bytesCount: z.number().positive(),\n /** File extension with dot (e.g., '.jpg') */\n extension: z\n .string()\n .regex(/^\\.[a-zA-Z0-9]+$/)\n .overwrite((ext) => ext.toLowerCase()),\n /** Optional custom stored filename */\n storedFileName: z.string().optional(),\n /** Additional metadata key-value pairs */\n metadata: z.record(z.string(), z.string()).default({}),\n /** Storage tags for categorization */\n tags: z.record(z.string(), z.string()).default({}),\n})\nexport type MediaUpload = z.infer<typeof MediaUploadSchema>\n\n// ===== Media Source Schema =====\n\n/**\n * Complete media source information including storage details\n */\nexport const MediaSourceSchema = MediaUploadSchema.extend({\n /** Storage backend configuration */\n storageHandle: StorageHandleSchema,\n /** Storage tier/policy */\n storagePolicy: z.enum(StoragePolicy),\n /** Optional signature data for verification */\n signData: z.string().optional(),\n /** Actual stored filename (required) */\n storedFileName: z.string().min(1),\n})\nexport type MediaSource = z.infer<typeof MediaSourceSchema>\n\n// ===== Media Schema =====\n\n/**\n * Complete media object with source and optional variants\n */\nexport const MediaSchema = z.object({\n /** Display name for the media */\n name: z.string().min(1),\n /** Primary media source */\n src: MediaSourceSchema,\n /** Optional additional sources (e.g., different resolutions) */\n srcSet: z.array(MediaSourceSchema).default([]),\n /** Type-specific metadata (dimensions, duration, etc.) */\n rawOptions: z.custom<RawOptions>().optional(),\n})\nexport type Media = z.infer<typeof MediaSchema>\n\n// ===== Upload Handle Schema =====\n\n/**\n * Upload handle containing SAS URI and metadata for client-side upload\n */\nexport const MediaUploadHandleSchema = z.object({\n /** Media source information */\n src: MediaSourceSchema,\n /** Upload credentials and metadata */\n uploadHandle: z.object({\n /** Shared Access Signature URI for upload */\n uploadSasuri: z.url(),\n /** Metadata to attach to the blob */\n metadata: z.record(z.string(), z.string()).default({}),\n /** Tags to attach to the blob */\n tags: z.record(z.string(), z.string()).default({}),\n }),\n})\nexport type MediaUploadHandle = z.infer<typeof MediaUploadHandleSchema>\n\n// ===== Download Handle Schema =====\n\n/**\n * Download handle containing SAS URIs for different access patterns\n */\nexport const MediaDownloadHandleSchema = z.object({\n /** Media source information */\n src: MediaSourceSchema,\n /** Download credentials and URIs */\n downloadHandle: z.object({\n /** SAS URI for file download */\n downloadSasuri: z.url(),\n /** SAS URI for inline viewing */\n viewSasuri: z.url(),\n /** Optional SAS URI for preview thumbnail */\n previewSasuri: z.url().optional(),\n /** Expiration timestamp for the SAS URIs */\n expiresOn: z.string().datetime(),\n /** Storage backend type */\n type: z.string(),\n }),\n})\nexport type MediaDownloadHandle = z.infer<typeof MediaDownloadHandleSchema>\n\n// ===== Media Types =====\n\nexport enum MediaType {\n picture = 'picture',\n video = 'video',\n audio = 'audio',\n office = 'office',\n archive = 'archive',\n binary = 'binary',\n executable = 'executable',\n}\n\n// ===== Raw Options Schemas =====\n\nconst PictureRawOptionsSchema = z.object({\n type: z.literal(MediaType.picture),\n width: z.number().positive(),\n height: z.number().positive(),\n blurhash: z.string().optional(),\n})\n\nconst VideoRawOptionsSchema = z.object({\n type: z.literal(MediaType.video),\n width: z.number().positive(),\n height: z.number().positive(),\n duration: z.number().nonnegative(),\n})\n\nconst AudioRawOptionsSchema = z.object({\n type: z.literal(MediaType.audio),\n duration: z.number().nonnegative(),\n})\n\nconst OfficeRawOptionsSchema = z.object({\n type: z.literal(MediaType.office),\n})\n\nconst ArchiveRawOptionsSchema = z.object({\n type: z.literal(MediaType.archive),\n})\n\nconst BinaryRawOptionsSchema = z.object({\n type: z.literal(MediaType.binary),\n})\n\nconst ExecutableRawOptionsSchema = z.object({\n type: z.literal(MediaType.executable),\n})\n\nexport const RawOptionsSchema = z.discriminatedUnion('type', [\n PictureRawOptionsSchema,\n VideoRawOptionsSchema,\n AudioRawOptionsSchema,\n OfficeRawOptionsSchema,\n ArchiveRawOptionsSchema,\n BinaryRawOptionsSchema,\n ExecutableRawOptionsSchema,\n])\n\n// ===== Raw Options Types =====\n\n// ===== Raw Options Types =====\n\nexport type PictureRawOptions = z.infer<typeof PictureRawOptionsSchema>\nexport type VideoRawOptions = z.infer<typeof VideoRawOptionsSchema>\nexport type AudioRawOptions = z.infer<typeof AudioRawOptionsSchema>\nexport type OfficeRawOptions = z.infer<typeof OfficeRawOptionsSchema>\nexport type ArchiveRawOptions = z.infer<typeof ArchiveRawOptionsSchema>\nexport type BinaryRawOptions = z.infer<typeof BinaryRawOptionsSchema>\nexport type ExecutableRawOptions = z.infer<typeof ExecutableRawOptionsSchema>\n\nexport type RawOptions = z.infer<typeof RawOptionsSchema>\n\n// ===== Uploaded File Type =====\n\nexport type UploadedFile<Source = undefined> = Source extends undefined\n ? {\n name: string\n size: number\n type: string\n url: string\n lastModified?: number\n }\n : {\n name: string\n size: number\n type: string\n url: string\n lastModified?: number\n source: Source\n }\n\n// ===== Helper Functions =====\n\n/**\n * Check if a MIME type is a supported image format\n */\nexport const isSupportedImageType = (mimeType: string): boolean => {\n return mimeType.startsWith('image/')\n}\n\n/**\n * Check if a MIME type supports preview generation\n */\nexport const isSupportedPreviewType = (mimeType: string): boolean => {\n return mimeType.startsWith('image/') || mimeType === 'application/pdf'\n}\n\n/**\n * Determine MediaType from MIME type\n */\nexport const getMediaTypeFromMime = (mimeType: string): MediaType => {\n if (mimeType.startsWith('image/')) return MediaType.picture\n if (mimeType.startsWith('video/')) return MediaType.video\n if (mimeType.startsWith('audio/')) return MediaType.audio\n if (\n mimeType.startsWith('application/pdf') ||\n mimeType.startsWith('application/msword') ||\n mimeType.startsWith('application/vnd.openxmlformats') ||\n mimeType.startsWith('application/vnd.ms-')\n ) {\n return MediaType.office\n }\n if (\n mimeType === 'application/zip' ||\n mimeType === 'application/x-rar-compressed' ||\n mimeType === 'application/x-7z-compressed'\n ) {\n return MediaType.archive\n }\n if (\n mimeType.startsWith('application/x-') &&\n mimeType.includes('executable')\n ) {\n return MediaType.executable\n }\n return MediaType.binary\n}\n\n/**\n * Extract file extension from filename\n */\nexport const getExtensionFromFilename = (filename: string): string => {\n const lastDot = filename.lastIndexOf('.')\n return lastDot === -1 ? '' : filename.slice(lastDot).toLowerCase()\n}\n\n/**\n * Format bytes to human-readable string\n */\nexport const formatBytes = (bytes: number, decimals = 2): string => {\n if (bytes === 0) return '0 Bytes'\n const k = 1024\n const dm = decimals < 0 ? 0 : decimals\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']\n const i = Math.floor(Math.log(bytes) / Math.log(k))\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`\n}\n\n// ===== Type Guards =====\n\nexport const isPictureOptions = (\n options: RawOptions,\n): options is PictureRawOptions => {\n return options.type === MediaType.picture\n}\n\nexport const isVideoOptions = (\n options: RawOptions,\n): options is VideoRawOptions => {\n return options.type === MediaType.video\n}\n\nexport const isAudioOptions = (\n options: RawOptions,\n): options is AudioRawOptions => {\n return options.type === MediaType.audio\n}\n\nexport const isOfficeOptions = (\n options: RawOptions,\n): options is OfficeRawOptions => {\n return options.type === MediaType.office\n}\n\nexport const isArchiveOptions = (\n options: RawOptions,\n): options is ArchiveRawOptions => {\n return options.type === MediaType.archive\n}\n\nexport const isBinaryOptions = (\n options: RawOptions,\n): options is BinaryRawOptions => {\n return options.type === MediaType.binary\n}\n\nexport const isExecutableOptions = (\n options: RawOptions,\n): options is ExecutableRawOptions => {\n return options.type === MediaType.executable\n}\n"],"x_google_ignoreList":[0],"mappings":";;AAcA,SAAgB,EAAK,GAAQ;CACzB,OAAOA,EAAkBC,GAAiB,CAAM;AACpD;;;ACLA,IAAa,KACT,GACA,GACA,MAEA,EAAQ,GAAO,GAAQ;CAGnB,SAAS,MAAU;CACnB;AACJ,CAAC,GAEC,IAAwB,OAGjB,IAAkB,EACnB,EAAS,GAAG,EAAU,CAAC,CAAC,CAC/B,QAAQ,MAAQ,KAAK,UAAU,CAAG,CAAC,CAAC,UAAU,GAAuB,EAClE,SAAS,0BAA0B,IAAwB,KAAK,KACpE,CAAC,GAWQ,KAAwC,MAC1C,CAAC,GAAG,KAAS,IAAI,GAAO,GAGtB,KAAyC,MAC3C,EAAM,SAAS,MAAM,EAAa,CAAC,CAAC,GAGlC,IAAQ;CACjB,aAAa,IAAgB,GAAG,IAAc,QACnC;EACH,gBAAgB,EACJ,CAAC,CACR,GAAG,EAAS,CAAC,CAAC,CACd,WAAW,MAAM,OAAO,CAAC,CAAC,CAAC,CAC3B,QAAQ,CAAa;EAC1B,cAAc,EACF,CAAC,CACR,GAAG,EAAS,CAAC,CAAC,CACd,WAAW,MAAM,OAAO,CAAC,CAAC,CAAC,CAC3B,QAAQ,CAAW;CAC5B;CAEJ,SAAiC,OACtB,GAAG,UAAU,EAAM,KAAK,EAAS,CAAC,CAAC,SAAS,EAAE;CAKzD,UAAkC,OACvB,GAAG,WAAW,EAAM,KAAK,E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AU,EAAU,OAAO,EACrC,CAAC,GAEK,IAAyB,EAAS,EACpC,MAAM,EAAU,EAAU,MAAM,EACpC,CAAC,GAEK,IAA6B,EAAS,EACxC,MAAM,EAAU,EAAU,UAAU,EACxC,CAAC;AAE+B,EAAqB,QAAQ;CACzD;CACA;CACA;CACA;CACA;CACA;CACA;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as e, F as t, J as n, L as r, N as i, O as a, P as o, X as s, m as c, v as l } from "./vue.runtime.esm-bundler-D6KKITU0.js";
|
|
2
|
-
import {
|
|
2
|
+
import { r as u } from "./vue-i18n-C3J36GV4.js";
|
|
3
3
|
import { n as d, t as f } from "./cdn-css-JUUNhyQ6.js";
|
|
4
4
|
import "./src-Co0-iQeD.js";
|
|
5
5
|
import { n as p } from "./url-validation-uLMZ5-AU.js";
|
|
@@ -2325,4 +2325,4 @@ var Jn = ["innerHTML"], Yn = /*#__PURE__*/ ee(/* @__PURE__ */ e({
|
|
|
2325
2325
|
//#endregion
|
|
2326
2326
|
export { Yn as t };
|
|
2327
2327
|
|
|
2328
|
-
//# sourceMappingURL=PkStreamingMarkdown-
|
|
2328
|
+
//# sourceMappingURL=PkStreamingMarkdown-B4eMb97I.js.map
|