@8wave/ai-elements 0.100.0 → 0.101.0-beta.2
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/ai-elements.es.js +1590 -1556
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.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/PkChatbot-OT6Vj9xn.js +264 -0
- package/dist-vue/_chunks/PkChatbot-OT6Vj9xn.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotMessages-Cj974POl.js.map +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-glcxrv5f.js → PkChatbotViewChat-BhwV8BzI.js} +2 -2
- package/dist-vue/_chunks/PkChatbotViewChat-BhwV8BzI.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-CNZuX3Rl.js → PkChatbotViewConversations-EuLSiakV.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-CNZuX3Rl.js.map → PkChatbotViewConversations-EuLSiakV.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-CyBqTzjY.js → PkChatbotViewFiles-CIr-0xpK.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-CyBqTzjY.js.map → PkChatbotViewFiles-CIr-0xpK.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-BCPCO6mp.js → PkChatbotViewProfile-CIO0mBFM.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-BCPCO6mp.js.map → PkChatbotViewProfile-CIO0mBFM.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-BGkXm2NB.js → createChatbotApiClient-2iaBCziJ.js} +362 -346
- package/dist-vue/_chunks/createChatbotApiClient-2iaBCziJ.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-D9b5Fz-e.js → useChatbotStore-BK1xv_i6.js} +2 -2
- package/dist-vue/_chunks/{useChatbotStore-D9b5Fz-e.js.map → useChatbotStore-BK1xv_i6.js.map} +1 -1
- package/dist-vue/_chunks/{useDialogConfirm-DaoekZdk.js → useDialogConfirm-CMTIKoWn.js} +12 -11
- package/dist-vue/_chunks/useDialogConfirm-CMTIKoWn.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +3 -3
- package/dist-vue/apps/web-component/src/lib.d.ts +3 -1
- package/dist-vue/composables.js +2 -2
- package/dist-vue/index.js +2875 -2861
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +2 -0
- package/dist-vue/packages/auth/src/index.d.ts +4 -4
- package/dist-vue/packages/components/src/chat/PkChatbot.d.ts +9 -9
- package/dist-vue/packages/components/src/chat/PkChatbotViewChat.d.ts +2 -2
- package/dist-vue/packages/composable/src/useDialog.d.ts +2 -0
- package/dist-vue/packages/models/src/schema/Agent.d.ts +114 -5
- package/dist-vue/packages/models/src/schema/Chat.d.ts +7 -0
- package/dist-vue/packages/models/src/schema/OpenAiCompat.d.ts +192 -0
- package/dist-vue/packages/models/src/schema/OrganizationExternalAuth.d.ts +7 -0
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +6 -0
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +6 -0
- package/dist-vue/packages/models/src/schema/TimingLog.d.ts +153 -0
- package/dist-vue/packages/models/src/schema/UserOverview.d.ts +1 -1
- package/dist-vue/packages/models/src/schema/index.d.ts +2 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist-vue/_chunks/PkChatbot-bWzP1psN.js +0 -236
- package/dist-vue/_chunks/PkChatbot-bWzP1psN.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-glcxrv5f.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BGkXm2NB.js.map +0 -1
- package/dist-vue/_chunks/useDialogConfirm-DaoekZdk.js.map +0 -1
package/dist-vue/locales.js
CHANGED
|
@@ -364,6 +364,7 @@ var e = {
|
|
|
364
364
|
app: "The agent is accessible via the dedicated public page.",
|
|
365
365
|
widget: "The agent can be embedded in websites via embed script."
|
|
366
366
|
},
|
|
367
|
+
reasoningDefault: "Platform default, applied until you choose a different value.",
|
|
367
368
|
includeThoughts: "Streams the model's thoughts to the client along with the response.",
|
|
368
369
|
reasoningNotSupported: "Reasoning is not supported for the selected provider.",
|
|
369
370
|
webSearchEnabled: "Allow the agent to search the web during conversations.",
|
|
@@ -851,6 +852,7 @@ var e = {
|
|
|
851
852
|
app: "L'agente è accessibile tramite la pagina pubblica dedicata.",
|
|
852
853
|
widget: "L'agente è incorporabile nei siti web tramite embed script."
|
|
853
854
|
},
|
|
855
|
+
reasoningDefault: "Valore predefinito della piattaforma, si applica finché non scegli un valore diverso.",
|
|
854
856
|
includeThoughts: "Invia i pensieri del modello al client insieme alla risposta.",
|
|
855
857
|
reasoningNotSupported: "Il reasoning non è supportato per il provider selezionato.",
|
|
856
858
|
webSearchEnabled: "Permetti all'agente di cercare informazioni sul web durante le conversazioni.",
|
|
@@ -1081,8 +1081,8 @@ export declare const config: {
|
|
|
1081
1081
|
$Infer: {
|
|
1082
1082
|
body: {
|
|
1083
1083
|
permissions: {
|
|
1084
|
-
readonly user?: ("create" | "update" | "delete" | "impersonate" | "ban" | "get" | "
|
|
1085
|
-
readonly session?: ("
|
|
1084
|
+
readonly user?: ("list" | "create" | "update" | "delete" | "impersonate" | "ban" | "get" | "set-role" | "impersonate-admins" | "set-password" | "set-email")[] | undefined;
|
|
1085
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
1086
1086
|
};
|
|
1087
1087
|
} & {
|
|
1088
1088
|
userId?: string | undefined;
|
|
@@ -2793,8 +2793,8 @@ export declare const auth: Auth<{
|
|
|
2793
2793
|
$Infer: {
|
|
2794
2794
|
body: {
|
|
2795
2795
|
permissions: {
|
|
2796
|
-
readonly user?: ("create" | "update" | "delete" | "impersonate" | "ban" | "get" | "
|
|
2797
|
-
readonly session?: ("
|
|
2796
|
+
readonly user?: ("list" | "create" | "update" | "delete" | "impersonate" | "ban" | "get" | "set-role" | "impersonate-admins" | "set-password" | "set-email")[] | undefined;
|
|
2797
|
+
readonly session?: ("list" | "delete" | "revoke")[] | undefined;
|
|
2798
2798
|
};
|
|
2799
2799
|
} & {
|
|
2800
2800
|
userId?: string | undefined;
|
|
@@ -20,8 +20,8 @@ type __VLS_Props = {
|
|
|
20
20
|
fallbackModels?: string[];
|
|
21
21
|
gatewayOptions?: Partial<AgentGatewayOptions>;
|
|
22
22
|
externalContext?: Record<string, unknown>;
|
|
23
|
-
/** Layout modifier: `widget` (default) keeps the contained layout with header, `fullscreen` removes header/background for full-page usage (the page provides the chrome) */
|
|
24
|
-
modifier?: 'widget' | 'fullscreen';
|
|
23
|
+
/** Layout modifier: `widget` (default) keeps the contained layout with header, `fullscreen` removes header/background for full-page usage (the page provides the chrome), `panel` keeps the header but slims it down for a docked side panel (the host provides background and border) */
|
|
24
|
+
modifier?: 'widget' | 'fullscreen' | 'panel';
|
|
25
25
|
/** Display name of the current user, used for the `{name}` placeholder in the fullscreen greeting */
|
|
26
26
|
userName?: string;
|
|
27
27
|
/** Show the "Files in this chat" menu for hosts that don't provide the
|
|
@@ -39,25 +39,25 @@ declare var __VLS_24: {
|
|
|
39
39
|
contrastColor: "white" | "black";
|
|
40
40
|
startNewChat: () => Promise<string>;
|
|
41
41
|
stopGeneration: () => Promise<void>;
|
|
42
|
-
},
|
|
42
|
+
}, __VLS_117: {
|
|
43
43
|
mainColor: string | undefined;
|
|
44
44
|
useColorsForAgentHeader: boolean | undefined;
|
|
45
45
|
contrastColor: "white" | "black";
|
|
46
46
|
startNewChat: () => Promise<string>;
|
|
47
47
|
stopGeneration: () => Promise<void>;
|
|
48
|
-
},
|
|
48
|
+
}, __VLS_141: string, __VLS_142: any, __VLS_152: string, __VLS_153: any, __VLS_160: {}, __VLS_170: string, __VLS_171: any;
|
|
49
49
|
type __VLS_Slots = {} & {
|
|
50
|
-
[K in NonNullable<typeof
|
|
50
|
+
[K in NonNullable<typeof __VLS_141>]?: (props: typeof __VLS_142) => any;
|
|
51
51
|
} & {
|
|
52
|
-
[K in NonNullable<typeof
|
|
52
|
+
[K in NonNullable<typeof __VLS_152>]?: (props: typeof __VLS_153) => any;
|
|
53
53
|
} & {
|
|
54
|
-
[K in NonNullable<typeof
|
|
54
|
+
[K in NonNullable<typeof __VLS_170>]?: (props: typeof __VLS_171) => any;
|
|
55
55
|
} & {
|
|
56
56
|
'header-actions'?: (props: typeof __VLS_24) => any;
|
|
57
57
|
} & {
|
|
58
|
-
actions?: (props: typeof
|
|
58
|
+
actions?: (props: typeof __VLS_117) => any;
|
|
59
59
|
} & {
|
|
60
|
-
'view-auth'?: (props: typeof
|
|
60
|
+
'view-auth'?: (props: typeof __VLS_160) => any;
|
|
61
61
|
};
|
|
62
62
|
declare const __VLS_base: DefineComponent<__VLS_PublicProps, {
|
|
63
63
|
startNewChat: () => Promise<string>;
|
|
@@ -2,8 +2,8 @@ import { UIChatMessage } from '../../../models/src';
|
|
|
2
2
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
agentId: string;
|
|
5
|
-
/** Mirrors the PkChatbot `modifier` prop: `fullscreen` shows a centered empty state (greeting) instead of the welcome message */
|
|
6
|
-
modifier?: 'widget' | 'fullscreen';
|
|
5
|
+
/** Mirrors the PkChatbot `modifier` prop: `fullscreen` shows a centered empty state (greeting) instead of the welcome message, `panel` behaves like `widget` */
|
|
6
|
+
modifier?: 'widget' | 'fullscreen' | 'panel';
|
|
7
7
|
/** Display name of the current user, used for the `{name}` greeting placeholder */
|
|
8
8
|
userName?: string;
|
|
9
9
|
};
|
|
@@ -2,6 +2,8 @@ import { VNode, DefineComponent, ComponentOptionsMixin, PublicProps, ComponentPr
|
|
|
2
2
|
type DialogProps = {
|
|
3
3
|
title?: string;
|
|
4
4
|
transition?: string;
|
|
5
|
+
modifiers?: string | string[];
|
|
6
|
+
/** @deprecated use modifiers instead */
|
|
5
7
|
size?: 'small' | 'standard' | 'fullscreen';
|
|
6
8
|
role?: 'alert' | 'alertdialog';
|
|
7
9
|
keepOpen?: boolean;
|
|
@@ -136,15 +136,60 @@ export declare const AgentReasoningSchema: z.ZodOptional<z.ZodCodec<z.ZodUnknown
|
|
|
136
136
|
}, z.core.$strip>>;
|
|
137
137
|
}, z.core.$strip>>>;
|
|
138
138
|
export type AgentReasoning = z.infer<typeof AgentReasoningSchema>;
|
|
139
|
+
/** Provider an agent model belongs to, from its `provider/model` id. */
|
|
140
|
+
export declare function modelProvider(model: string): string;
|
|
141
|
+
/**
|
|
142
|
+
* Explicit reasoning configuration for an agent that has none for the provider
|
|
143
|
+
* it is running on.
|
|
144
|
+
*
|
|
145
|
+
* Without it the request carries no reasoning directive at all and the provider
|
|
146
|
+
* applies its own default, which on the current families means thinking is ON:
|
|
147
|
+
* measured on the turn-latency bench, **each reasoning token costs about 8ms of
|
|
148
|
+
* time to first token** (~125 tok/s of decode), so a default nobody chose is
|
|
149
|
+
* worth seconds per turn. The lowest tier that still reasons is the deliberate
|
|
150
|
+
* choice: tool selection and the presentation contract both degrade when a chat
|
|
151
|
+
* agent stops deliberating entirely, and that is a worse trade than the latency
|
|
152
|
+
* it would buy.
|
|
153
|
+
*
|
|
154
|
+
* DeepSeek is deliberately absent: its thinking is model-intrinsic (there are
|
|
155
|
+
* `-thinking` model ids) and a blanket directive there could contradict the
|
|
156
|
+
* model itself. Agents on DeepSeek keep the provider default until someone
|
|
157
|
+
* measures that family.
|
|
158
|
+
*/
|
|
159
|
+
export declare const DEFAULT_REASONING_BY_PROVIDER: NonNullable<AgentReasoning>;
|
|
160
|
+
/**
|
|
161
|
+
* What will actually reach `provider`: the agent's own block when it configures
|
|
162
|
+
* anything, otherwise the platform default.
|
|
163
|
+
*
|
|
164
|
+
* Shared on purpose. The runtime reaches it through
|
|
165
|
+
* {@link resolveEffectiveReasoning}, and the agent form calls it directly to
|
|
166
|
+
* display the value: a form that showed an empty level while the turn sends
|
|
167
|
+
* `low` would describe a behaviour that does not exist.
|
|
168
|
+
*
|
|
169
|
+
* Returns the stored block **by identity** when there is one, so a caller can
|
|
170
|
+
* tell a configured value from a default with `===`.
|
|
171
|
+
*/
|
|
172
|
+
export declare function effectiveProviderReasoning<P extends keyof NonNullable<AgentReasoning>>(provider: P, reasoning: AgentReasoning | null | undefined): NonNullable<AgentReasoning>[P];
|
|
173
|
+
/**
|
|
174
|
+
* The reasoning configuration that will actually reach the provider: the
|
|
175
|
+
* agent's own when it has one for this model's provider, otherwise the explicit
|
|
176
|
+
* default above.
|
|
177
|
+
*
|
|
178
|
+
* Cross-provider is the case that motivated it: an agent configured for OpenAI
|
|
179
|
+
* and switched to Gemini has `reasoning.openai` set and `reasoning.google`
|
|
180
|
+
* empty, so before this it silently inherited Gemini's default.
|
|
181
|
+
*/
|
|
182
|
+
export declare function resolveEffectiveReasoning(model: string, reasoning: AgentReasoning | null | undefined): AgentReasoning;
|
|
139
183
|
/**
|
|
140
184
|
* Whether reasoning is effectively enabled for the given model.
|
|
141
185
|
*
|
|
142
|
-
* Mirrors the runtime semantics of `getReasoningOptions` (backend):
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
186
|
+
* Mirrors the runtime semantics of `getReasoningOptions` (backend): only the
|
|
187
|
+
* provider config matching the model prefix is considered, and an agent with no
|
|
188
|
+
* config for that provider gets {@link DEFAULT_REASONING_BY_PROVIDER}, exactly
|
|
189
|
+
* as the turn does. Note: for Anthropic with `display: 'omitted'` reasoning runs
|
|
190
|
+
* but no reasoning parts are streamed to the client.
|
|
146
191
|
*/
|
|
147
|
-
export declare function isReasoningEnabled(model: string,
|
|
192
|
+
export declare function isReasoningEnabled(model: string, agentReasoning: AgentReasoning | null | undefined): boolean;
|
|
148
193
|
export declare enum AgentBuiltInTool {
|
|
149
194
|
Geocode = "geocode",
|
|
150
195
|
GetWeather = "getWeather",
|
|
@@ -212,6 +257,51 @@ export declare function isPresentationTool(toolName: string): boolean;
|
|
|
212
257
|
export declare const PLATFORM_RENDERED_TOOLS: Set<string>;
|
|
213
258
|
/** True if the tool renders natively on Teams/WhatsApp (not just web). */
|
|
214
259
|
export declare function isPlatformRenderedTool(toolName: string): boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Transport a turn arrived through. Recorded on the chat metadata and on the
|
|
262
|
+
* latency histograms, and it is what decides {@link ClientToolSurface}: the
|
|
263
|
+
* transport is a fact of the request, not a per-agent setting.
|
|
264
|
+
*/
|
|
265
|
+
export declare enum ChatTransport {
|
|
266
|
+
/** Web chat and embeddable widget: the reference surface. */
|
|
267
|
+
Web = "web",
|
|
268
|
+
/** Messaging channels (Teams, WhatsApp) through the platform runner. */
|
|
269
|
+
Platform = "platform",
|
|
270
|
+
/** OpenAI-compatible REST surface: automations, SDKs, voice agents. */
|
|
271
|
+
OpenAiApi = "openai-api"
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* What the caller of a turn can actually DO with a client-side tool.
|
|
275
|
+
*
|
|
276
|
+
* Client tools have no `execute`: something on the other side has to render the
|
|
277
|
+
* widget and post the result back. Offering one to a caller that cannot is not
|
|
278
|
+
* a missing nicety, it is a defect with a measured cost: the model spends a
|
|
279
|
+
* full round trip calling it (`showSuggestedReply` on every sample of the
|
|
280
|
+
* turn-latency baseline), the call is never answered, and its guidance sits in
|
|
281
|
+
* the system prompt of every turn.
|
|
282
|
+
*/
|
|
283
|
+
export declare enum ClientToolSurface {
|
|
284
|
+
/** Full client runtime: every enabled client tool renders. */
|
|
285
|
+
Web = "web",
|
|
286
|
+
/** Renders only {@link PLATFORM_RENDERED_TOOLS}; the rest never resolve. */
|
|
287
|
+
Platform = "platform",
|
|
288
|
+
/** No client runtime at all: the caller consumes text (and tool results). */
|
|
289
|
+
Headless = "headless"
|
|
290
|
+
}
|
|
291
|
+
/** Single availability rule for a client tool, shared by tool set and prompt. */
|
|
292
|
+
export declare function supportsClientTool(surface: ClientToolSurface, toolName: string): boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Surface of a transport. Unknown transports are treated as Web, which is the
|
|
295
|
+
* historical behaviour: a new caller has to opt into being headless, so adding
|
|
296
|
+
* one can never silently strip the widgets from an existing channel.
|
|
297
|
+
*/
|
|
298
|
+
export declare function clientToolSurfaceOf(transport: ChatTransport | string | undefined): ClientToolSurface;
|
|
299
|
+
/**
|
|
300
|
+
* True when nobody is watching the response render: the transport delivers text
|
|
301
|
+
* to a program (or to a speech synthesizer), so anything that paces the stream
|
|
302
|
+
* for the human eye is pure added latency.
|
|
303
|
+
*/
|
|
304
|
+
export declare function isHeadlessTransport(transport: ChatTransport | string | undefined): boolean;
|
|
215
305
|
export declare const AgentFormSettingsSchema: z.ZodObject<{
|
|
216
306
|
maxSteps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
217
307
|
maxOptionsPerStep: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -724,6 +814,16 @@ export declare const AgentGatewayOptionsSchema: z.ZodObject<{
|
|
|
724
814
|
providerTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
725
815
|
}, z.core.$strip>;
|
|
726
816
|
export type AgentGatewayOptions = z.infer<typeof AgentGatewayOptionsSchema>;
|
|
817
|
+
/**
|
|
818
|
+
* Exposure of the agent through the OpenAI-compatible surface
|
|
819
|
+
* (`/api/openai/v1`), where any third-party client that speaks chat
|
|
820
|
+
* completions can consume it as if it were a model. Off by default: turning it
|
|
821
|
+
* on makes the agent reachable with an organization API key.
|
|
822
|
+
*/
|
|
823
|
+
export declare const AgentOpenAiApiSchema: z.ZodObject<{
|
|
824
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
825
|
+
}, z.core.$strip>;
|
|
826
|
+
export type AgentOpenAiApi = z.infer<typeof AgentOpenAiApiSchema>;
|
|
727
827
|
export declare const AgentSettingsSchema: z.ZodObject<{
|
|
728
828
|
model: z.ZodObject<{
|
|
729
829
|
prompt: z.ZodOptional<z.ZodString>;
|
|
@@ -1022,6 +1122,9 @@ export declare const AgentSettingsSchema: z.ZodObject<{
|
|
|
1022
1122
|
}, z.core.$strip>>>;
|
|
1023
1123
|
channels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AgentChannel>>>>;
|
|
1024
1124
|
externalContextSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1125
|
+
openaiApi: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1126
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1127
|
+
}, z.core.$strip>>>;
|
|
1025
1128
|
}, z.core.$strip>;
|
|
1026
1129
|
export type AgentSettings = z.infer<typeof AgentSettingsSchema>;
|
|
1027
1130
|
export declare const AgentSecuritySchema: z.ZodObject<{
|
|
@@ -1342,6 +1445,9 @@ export declare const AgentDtoSchema: z.ZodObject<{
|
|
|
1342
1445
|
}, z.core.$strip>>>;
|
|
1343
1446
|
channels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AgentChannel>>>>;
|
|
1344
1447
|
externalContextSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1448
|
+
openaiApi: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1449
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1450
|
+
}, z.core.$strip>>>;
|
|
1345
1451
|
}, z.core.$strip>;
|
|
1346
1452
|
security: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1347
1453
|
rateLimits: z.ZodObject<{
|
|
@@ -1663,6 +1769,9 @@ export declare const AgentSchema: z.ZodLazy<z.ZodObject<{
|
|
|
1663
1769
|
}, z.core.$strip>>>;
|
|
1664
1770
|
channels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<typeof AgentChannel>>>>;
|
|
1665
1771
|
externalContextSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1772
|
+
openaiApi: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1773
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1774
|
+
}, z.core.$strip>>>;
|
|
1666
1775
|
}, z.core.$strip>;
|
|
1667
1776
|
security: z.ZodNullable<z.ZodObject<{
|
|
1668
1777
|
rateLimits: z.ZodObject<{
|
|
@@ -233,8 +233,15 @@ export declare enum BlockedReasonCode {
|
|
|
233
233
|
}
|
|
234
234
|
export type ChatMetadata = {
|
|
235
235
|
ipAddress: string;
|
|
236
|
+
/** HTTP `Origin` of the request, empty for a server-to-server caller. */
|
|
236
237
|
origin: string;
|
|
237
238
|
userAgent: string;
|
|
239
|
+
/**
|
|
240
|
+
* Non-default transport the conversation arrived through (for example
|
|
241
|
+
* `openai-api`), so cost and usage reports can isolate it. Absent for the
|
|
242
|
+
* web and widget chat.
|
|
243
|
+
*/
|
|
244
|
+
transport?: string;
|
|
238
245
|
};
|
|
239
246
|
export type ChatMessageActions = 'show-info' | 'revise' | 'regenerate' | 'upvote' | 'downvote' | 'feedback';
|
|
240
247
|
export type Chat = z.infer<typeof ChatSchema>;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Subset of the OpenAI chat completions protocol spoken by the agent-facing
|
|
4
|
+
* compatibility surface (`/api/openai/v1`).
|
|
5
|
+
*
|
|
6
|
+
* The request schemas are deliberately loose: a third-party client sends the
|
|
7
|
+
* fields its own SDK produces, and rejecting an otherwise legal OpenAI request
|
|
8
|
+
* because of a field we do not use would break integrations for no gain.
|
|
9
|
+
* Unknown fields are therefore accepted and ignored.
|
|
10
|
+
*/
|
|
11
|
+
export declare enum OpenAiCompatRole {
|
|
12
|
+
System = "system",
|
|
13
|
+
Developer = "developer",
|
|
14
|
+
User = "user",
|
|
15
|
+
Assistant = "assistant",
|
|
16
|
+
Tool = "tool"
|
|
17
|
+
}
|
|
18
|
+
/** Reasons reported back to the caller, in OpenAI's vocabulary. */
|
|
19
|
+
export declare enum OpenAiCompatFinishReason {
|
|
20
|
+
Stop = "stop",
|
|
21
|
+
Length = "length",
|
|
22
|
+
ToolCalls = "tool_calls",
|
|
23
|
+
ContentFilter = "content_filter"
|
|
24
|
+
}
|
|
25
|
+
/** Error codes emitted by the compatibility surface. */
|
|
26
|
+
export declare enum OpenAiCompatErrorCode {
|
|
27
|
+
InvalidApiKey = "invalid_api_key",
|
|
28
|
+
ModelNotFound = "model_not_found",
|
|
29
|
+
RateLimitExceeded = "rate_limit_exceeded",
|
|
30
|
+
InsufficientQuota = "insufficient_quota",
|
|
31
|
+
InvalidRequestError = "invalid_request_error",
|
|
32
|
+
InternalError = "internal_error"
|
|
33
|
+
}
|
|
34
|
+
export declare const OPENAI_COMPAT_MODEL_OBJECT = "model";
|
|
35
|
+
export declare const OPENAI_COMPAT_COMPLETION_OBJECT = "chat.completion";
|
|
36
|
+
export declare const OPENAI_COMPAT_CHUNK_OBJECT = "chat.completion.chunk";
|
|
37
|
+
export declare const OpenAiCompatContentPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
38
|
+
type: z.ZodLiteral<"text">;
|
|
39
|
+
text: z.ZodString;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"image_url">;
|
|
42
|
+
image_url: z.ZodObject<{
|
|
43
|
+
url: z.ZodString;
|
|
44
|
+
}, z.core.$loose>;
|
|
45
|
+
}, z.core.$strip>], "type">;
|
|
46
|
+
export type OpenAiCompatContentPart = z.infer<typeof OpenAiCompatContentPartSchema>;
|
|
47
|
+
export declare const OpenAiCompatMessageSchema: z.ZodObject<{
|
|
48
|
+
role: z.ZodEnum<typeof OpenAiCompatRole>;
|
|
49
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
50
|
+
type: z.ZodLiteral<"text">;
|
|
51
|
+
text: z.ZodString;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"image_url">;
|
|
54
|
+
image_url: z.ZodObject<{
|
|
55
|
+
url: z.ZodString;
|
|
56
|
+
}, z.core.$loose>;
|
|
57
|
+
}, z.core.$strip>], "type">>]>>>;
|
|
58
|
+
name: z.ZodOptional<z.ZodString>;
|
|
59
|
+
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$loose>;
|
|
61
|
+
export type OpenAiCompatMessage = z.infer<typeof OpenAiCompatMessageSchema>;
|
|
62
|
+
export declare const OpenAiCompatChatRequestSchema: z.ZodObject<{
|
|
63
|
+
model: z.ZodString;
|
|
64
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
65
|
+
role: z.ZodEnum<typeof OpenAiCompatRole>;
|
|
66
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
|
+
type: z.ZodLiteral<"text">;
|
|
68
|
+
text: z.ZodString;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
type: z.ZodLiteral<"image_url">;
|
|
71
|
+
image_url: z.ZodObject<{
|
|
72
|
+
url: z.ZodString;
|
|
73
|
+
}, z.core.$loose>;
|
|
74
|
+
}, z.core.$strip>], "type">>]>>>;
|
|
75
|
+
name: z.ZodOptional<z.ZodString>;
|
|
76
|
+
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$loose>>;
|
|
78
|
+
stream: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
stream_options: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
include_usage: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
}, z.core.$loose>>;
|
|
82
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
83
|
+
elevenlabs_extra_body: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
84
|
+
user: z.ZodOptional<z.ZodString>;
|
|
85
|
+
tools: z.ZodOptional<z.ZodUnknown>;
|
|
86
|
+
tool_choice: z.ZodOptional<z.ZodUnknown>;
|
|
87
|
+
}, z.core.$loose>;
|
|
88
|
+
export type OpenAiCompatChatRequest = z.infer<typeof OpenAiCompatChatRequestSchema>;
|
|
89
|
+
export declare const OpenAiCompatUsageSchema: z.ZodObject<{
|
|
90
|
+
prompt_tokens: z.ZodNumber;
|
|
91
|
+
completion_tokens: z.ZodNumber;
|
|
92
|
+
total_tokens: z.ZodNumber;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export type OpenAiCompatUsage = z.infer<typeof OpenAiCompatUsageSchema>;
|
|
95
|
+
export declare const OpenAiCompatToolCallSchema: z.ZodObject<{
|
|
96
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
id: z.ZodOptional<z.ZodString>;
|
|
98
|
+
type: z.ZodOptional<z.ZodLiteral<"function">>;
|
|
99
|
+
function: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
name: z.ZodOptional<z.ZodString>;
|
|
101
|
+
arguments: z.ZodOptional<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
export type OpenAiCompatToolCall = z.infer<typeof OpenAiCompatToolCallSchema>;
|
|
105
|
+
export declare const OpenAiCompatChunkSchema: z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
object: z.ZodLiteral<"chat.completion.chunk">;
|
|
108
|
+
created: z.ZodNumber;
|
|
109
|
+
model: z.ZodString;
|
|
110
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
111
|
+
index: z.ZodNumber;
|
|
112
|
+
delta: z.ZodObject<{
|
|
113
|
+
role: z.ZodOptional<z.ZodLiteral<"assistant">>;
|
|
114
|
+
content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
+
reasoning_content: z.ZodOptional<z.ZodString>;
|
|
116
|
+
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
117
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
id: z.ZodOptional<z.ZodString>;
|
|
119
|
+
type: z.ZodOptional<z.ZodLiteral<"function">>;
|
|
120
|
+
function: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
name: z.ZodOptional<z.ZodString>;
|
|
122
|
+
arguments: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strip>>;
|
|
124
|
+
}, z.core.$strip>>>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
finish_reason: z.ZodNullable<z.ZodEnum<typeof OpenAiCompatFinishReason>>;
|
|
127
|
+
}, z.core.$strip>>;
|
|
128
|
+
usage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
129
|
+
prompt_tokens: z.ZodNumber;
|
|
130
|
+
completion_tokens: z.ZodNumber;
|
|
131
|
+
total_tokens: z.ZodNumber;
|
|
132
|
+
}, z.core.$strip>>>;
|
|
133
|
+
}, z.core.$strip>;
|
|
134
|
+
export type OpenAiCompatChunk = z.infer<typeof OpenAiCompatChunkSchema>;
|
|
135
|
+
export declare const OpenAiCompatCompletionSchema: z.ZodObject<{
|
|
136
|
+
id: z.ZodString;
|
|
137
|
+
object: z.ZodLiteral<"chat.completion">;
|
|
138
|
+
created: z.ZodNumber;
|
|
139
|
+
model: z.ZodString;
|
|
140
|
+
choices: z.ZodArray<z.ZodObject<{
|
|
141
|
+
index: z.ZodNumber;
|
|
142
|
+
message: z.ZodObject<{
|
|
143
|
+
role: z.ZodLiteral<"assistant">;
|
|
144
|
+
content: z.ZodNullable<z.ZodString>;
|
|
145
|
+
reasoning_content: z.ZodOptional<z.ZodString>;
|
|
146
|
+
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
147
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
id: z.ZodOptional<z.ZodString>;
|
|
149
|
+
type: z.ZodOptional<z.ZodLiteral<"function">>;
|
|
150
|
+
function: z.ZodOptional<z.ZodObject<{
|
|
151
|
+
name: z.ZodOptional<z.ZodString>;
|
|
152
|
+
arguments: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strip>>;
|
|
154
|
+
}, z.core.$strip>>>;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
finish_reason: z.ZodNullable<z.ZodEnum<typeof OpenAiCompatFinishReason>>;
|
|
157
|
+
}, z.core.$strip>>;
|
|
158
|
+
usage: z.ZodObject<{
|
|
159
|
+
prompt_tokens: z.ZodNumber;
|
|
160
|
+
completion_tokens: z.ZodNumber;
|
|
161
|
+
total_tokens: z.ZodNumber;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
export type OpenAiCompatCompletion = z.infer<typeof OpenAiCompatCompletionSchema>;
|
|
165
|
+
export declare const OpenAiCompatModelSchema: z.ZodObject<{
|
|
166
|
+
id: z.ZodString;
|
|
167
|
+
object: z.ZodLiteral<"model">;
|
|
168
|
+
created: z.ZodNumber;
|
|
169
|
+
owned_by: z.ZodString;
|
|
170
|
+
display_name: z.ZodString;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
export type OpenAiCompatModel = z.infer<typeof OpenAiCompatModelSchema>;
|
|
173
|
+
export declare const OpenAiCompatModelListSchema: z.ZodObject<{
|
|
174
|
+
object: z.ZodLiteral<"list">;
|
|
175
|
+
data: z.ZodArray<z.ZodObject<{
|
|
176
|
+
id: z.ZodString;
|
|
177
|
+
object: z.ZodLiteral<"model">;
|
|
178
|
+
created: z.ZodNumber;
|
|
179
|
+
owned_by: z.ZodString;
|
|
180
|
+
display_name: z.ZodString;
|
|
181
|
+
}, z.core.$strip>>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export type OpenAiCompatModelList = z.infer<typeof OpenAiCompatModelListSchema>;
|
|
184
|
+
export declare const OpenAiCompatErrorSchema: z.ZodObject<{
|
|
185
|
+
error: z.ZodObject<{
|
|
186
|
+
message: z.ZodString;
|
|
187
|
+
type: z.ZodString;
|
|
188
|
+
code: z.ZodEnum<typeof OpenAiCompatErrorCode>;
|
|
189
|
+
param: z.ZodNullable<z.ZodString>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
export type OpenAiCompatError = z.infer<typeof OpenAiCompatErrorSchema>;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Display name stored when an external token carries no usable name claim and
|
|
4
|
+
* none can be derived from the other claims. It means "unknown", not "this is
|
|
5
|
+
* the user's name": consumers must never surface it (greeting someone with
|
|
6
|
+
* "Hi External User" is a visible defect).
|
|
7
|
+
*/
|
|
8
|
+
export declare const EXTERNAL_USER_PLACEHOLDER_NAME = "External User";
|
|
2
9
|
export declare const OrganizationExternalAuthSchema: z.ZodObject<{
|
|
3
10
|
id: z.ZodString;
|
|
4
11
|
organizationId: z.ZodString;
|
|
@@ -325,6 +325,9 @@ export declare const ReasoningChatSchema: z.ZodObject<{
|
|
|
325
325
|
}, z.core.$strip>>>;
|
|
326
326
|
channels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum< AgentChannel>>>>;
|
|
327
327
|
externalContextSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
328
|
+
openaiApi: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
329
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
330
|
+
}, z.core.$strip>>>;
|
|
328
331
|
}, z.core.$strip>;
|
|
329
332
|
security: z.ZodNullable<z.ZodObject<{
|
|
330
333
|
rateLimits: z.ZodObject<{
|
|
@@ -697,6 +700,9 @@ export declare const ReasoningChatSchema: z.ZodObject<{
|
|
|
697
700
|
}, z.core.$strip>>>;
|
|
698
701
|
channels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum< AgentChannel>>>>;
|
|
699
702
|
externalContextSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
703
|
+
openaiApi: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
704
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
705
|
+
}, z.core.$strip>>>;
|
|
700
706
|
}, z.core.$strip>;
|
|
701
707
|
security: z.ZodNullable<z.ZodObject<{
|
|
702
708
|
rateLimits: z.ZodObject<{
|
|
@@ -325,6 +325,9 @@ export declare const SubAgentSchema: z.ZodObject<{
|
|
|
325
325
|
}, z.core.$strip>>>;
|
|
326
326
|
channels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum< AgentChannel>>>>;
|
|
327
327
|
externalContextSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
328
|
+
openaiApi: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
329
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
330
|
+
}, z.core.$strip>>>;
|
|
328
331
|
}, z.core.$strip>;
|
|
329
332
|
security: z.ZodNullable<z.ZodObject<{
|
|
330
333
|
rateLimits: z.ZodObject<{
|
|
@@ -655,6 +658,9 @@ export declare const SubAgentSchema: z.ZodObject<{
|
|
|
655
658
|
}, z.core.$strip>>>;
|
|
656
659
|
channels: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum< AgentChannel>>>>;
|
|
657
660
|
externalContextSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
661
|
+
openaiApi: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
662
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
663
|
+
}, z.core.$strip>>>;
|
|
658
664
|
}, z.core.$strip>;
|
|
659
665
|
security: z.ZodNullable<z.ZodObject<{
|
|
660
666
|
rateLimits: z.ZodObject<{
|