@8wave/ai-elements 0.100.0 → 0.101.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.
Files changed (37) hide show
  1. package/dist/ai-elements.es.js +1522 -1519
  2. package/dist/ai-elements.es.js.map +1 -1
  3. package/dist-vue/PkChatbot.js +1 -1
  4. package/dist-vue/PkChatbotViewChat.js +1 -1
  5. package/dist-vue/PkChatbotViewConversations.js +1 -1
  6. package/dist-vue/PkChatbotViewFiles.js +1 -1
  7. package/dist-vue/PkChatbotViewProfile.js +1 -1
  8. package/dist-vue/_chunks/{PkChatbot-bWzP1psN.js → PkChatbot-BraWzebX.js} +6 -6
  9. package/dist-vue/_chunks/{PkChatbot-bWzP1psN.js.map → PkChatbot-BraWzebX.js.map} +1 -1
  10. package/dist-vue/_chunks/{PkChatbotViewChat-glcxrv5f.js → PkChatbotViewChat-BhwV8BzI.js} +2 -2
  11. package/dist-vue/_chunks/{PkChatbotViewChat-glcxrv5f.js.map → PkChatbotViewChat-BhwV8BzI.js.map} +1 -1
  12. package/dist-vue/_chunks/{PkChatbotViewConversations-CNZuX3Rl.js → PkChatbotViewConversations-Dmv8R7EN.js} +2 -2
  13. package/dist-vue/_chunks/{PkChatbotViewConversations-CNZuX3Rl.js.map → PkChatbotViewConversations-Dmv8R7EN.js.map} +1 -1
  14. package/dist-vue/_chunks/{PkChatbotViewFiles-CyBqTzjY.js → PkChatbotViewFiles-DKuu-7Hw.js} +2 -2
  15. package/dist-vue/_chunks/{PkChatbotViewFiles-CyBqTzjY.js.map → PkChatbotViewFiles-DKuu-7Hw.js.map} +1 -1
  16. package/dist-vue/_chunks/{PkChatbotViewProfile-BCPCO6mp.js → PkChatbotViewProfile-CIO0mBFM.js} +2 -2
  17. package/dist-vue/_chunks/{PkChatbotViewProfile-BCPCO6mp.js.map → PkChatbotViewProfile-CIO0mBFM.js.map} +1 -1
  18. package/dist-vue/_chunks/{createChatbotApiClient-BGkXm2NB.js → createChatbotApiClient-2iaBCziJ.js} +362 -346
  19. package/dist-vue/_chunks/createChatbotApiClient-2iaBCziJ.js.map +1 -0
  20. package/dist-vue/_chunks/{useChatbotStore-D9b5Fz-e.js → useChatbotStore-BK1xv_i6.js} +2 -2
  21. package/dist-vue/_chunks/{useChatbotStore-D9b5Fz-e.js.map → useChatbotStore-BK1xv_i6.js.map} +1 -1
  22. package/dist-vue/api.js +1 -1
  23. package/dist-vue/composables.js +2 -2
  24. package/dist-vue/index.js +2872 -2858
  25. package/dist-vue/index.js.map +1 -1
  26. package/dist-vue/locales.js +2 -0
  27. package/dist-vue/packages/auth/src/index.d.ts +4 -4
  28. package/dist-vue/packages/models/src/schema/Agent.d.ts +114 -5
  29. package/dist-vue/packages/models/src/schema/Chat.d.ts +7 -0
  30. package/dist-vue/packages/models/src/schema/OpenAiCompat.d.ts +192 -0
  31. package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +6 -0
  32. package/dist-vue/packages/models/src/schema/SubAgent.d.ts +6 -0
  33. package/dist-vue/packages/models/src/schema/TimingLog.d.ts +153 -0
  34. package/dist-vue/packages/models/src/schema/UserOverview.d.ts +1 -1
  35. package/dist-vue/packages/models/src/schema/index.d.ts +2 -0
  36. package/package.json +1 -1
  37. package/dist-vue/_chunks/createChatbotApiClient-BGkXm2NB.js.map +0 -1
@@ -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" | "list" | "set-role" | "impersonate-admins" | "set-password" | "set-email")[] | undefined;
1085
- readonly session?: ("delete" | "list" | "revoke")[] | undefined;
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" | "list" | "set-role" | "impersonate-admins" | "set-password" | "set-email")[] | undefined;
2797
- readonly session?: ("delete" | "list" | "revoke")[] | undefined;
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;
@@ -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
- * only the provider config matching the model prefix is considered.
144
- * Note: for Anthropic with `display: 'omitted'` reasoning runs but no
145
- * reasoning parts are streamed to the client.
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, reasoning: AgentReasoning | null | undefined): boolean;
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>;
@@ -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<{
@@ -0,0 +1,153 @@
1
+ import * as z from 'zod';
2
+ /**
3
+ * Shape of a turn timing record, shared by the backend tracker that produces it,
4
+ * the debug endpoint that serves it and the frontend page that renders it.
5
+ *
6
+ * It lives here because the three used to declare it independently and the
7
+ * response schema strips unknown keys: a field added to the tracker but not to
8
+ * the schema disappears from the API without any error, which is exactly how a
9
+ * new measurement ends up silently missing.
10
+ */
11
+ /**
12
+ * Redis list holding the timing entries (newest first). Declared here, with the
13
+ * shape, so both the tracker that writes it and the operational scripts that
14
+ * read it use one name without dragging the backend DI container into a script.
15
+ */
16
+ export declare const TIMING_REDIS_KEY = "debug:timing:logs";
17
+ export declare const TimingPhasePosition: {
18
+ readonly Pre: "pre";
19
+ readonly Post: "post";
20
+ };
21
+ export type TimingPhasePosition = (typeof TimingPhasePosition)[keyof typeof TimingPhasePosition];
22
+ export declare const TimingToolCallDetailSchema: z.ZodObject<{
23
+ toolCallId: z.ZodString;
24
+ name: z.ZodString;
25
+ args: z.ZodString;
26
+ result: z.ZodString;
27
+ }, z.core.$strip>;
28
+ export declare const TimingPhaseRecordSchema: z.ZodObject<{
29
+ label: z.ZodString;
30
+ durationMs: z.ZodNumber;
31
+ position: z.ZodEnum<{
32
+ pre: "pre";
33
+ post: "post";
34
+ }>;
35
+ startOffsetMs: z.ZodOptional<z.ZodNumber>;
36
+ endOffsetMs: z.ZodOptional<z.ZodNumber>;
37
+ }, z.core.$strip>;
38
+ export declare const TimingStepRecordSchema: z.ZodObject<{
39
+ stepIndex: z.ZodNumber;
40
+ stepKind: z.ZodString;
41
+ durationMs: z.ZodNumber;
42
+ modelId: z.ZodString;
43
+ inputTokens: z.ZodNumber;
44
+ outputTokens: z.ZodNumber;
45
+ reasoningTokens: z.ZodNumber;
46
+ cacheReadTokens: z.ZodOptional<z.ZodNumber>;
47
+ toolCalls: z.ZodArray<z.ZodString>;
48
+ toolCallDetails: z.ZodDefault<z.ZodArray<z.ZodObject<{
49
+ toolCallId: z.ZodString;
50
+ name: z.ZodString;
51
+ args: z.ZodString;
52
+ result: z.ZodString;
53
+ }, z.core.$strip>>>;
54
+ text: z.ZodDefault<z.ZodString>;
55
+ tokenStreamMs: z.ZodOptional<z.ZodNumber>;
56
+ responseId: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strip>;
58
+ /**
59
+ * Named instants on the turn timeline, as offsets from the timing origin (the
60
+ * request entering Fastify when the anchor hook ran, otherwise tracker
61
+ * construction). Recorded only when the turn reaches them.
62
+ */
63
+ export declare const TimingMilestonesSchema: z.ZodObject<{
64
+ turnStarted: z.ZodOptional<z.ZodNumber>;
65
+ providerInvoked: z.ZodOptional<z.ZodNumber>;
66
+ providerFirstEvent: z.ZodOptional<z.ZodNumber>;
67
+ providerFirstTextDelta: z.ZodOptional<z.ZodNumber>;
68
+ responseFirstTextDelta: z.ZodOptional<z.ZodNumber>;
69
+ }, z.core.$strip>;
70
+ /**
71
+ * Event-loop lag observed process-wide when the entry was written, in ms.
72
+ * Distinguishes "waiting on the network" from "blocking the thread", which is
73
+ * the difference between an I/O fix and a CPU fix.
74
+ */
75
+ export declare const TimingEventLoopLagSchema: z.ZodObject<{
76
+ meanMs: z.ZodNumber;
77
+ p50Ms: z.ZodNumber;
78
+ p95Ms: z.ZodNumber;
79
+ maxMs: z.ZodNumber;
80
+ }, z.core.$strip>;
81
+ export declare const TimingEntrySchema: z.ZodObject<{
82
+ id: z.ZodString;
83
+ timestamp: z.ZodNumber;
84
+ label: z.ZodString;
85
+ type: z.ZodEnum<{
86
+ main: "main";
87
+ subagent: "subagent";
88
+ }>;
89
+ totalMs: z.ZodNumber;
90
+ requestTotalMs: z.ZodOptional<z.ZodNumber>;
91
+ steps: z.ZodArray<z.ZodObject<{
92
+ stepIndex: z.ZodNumber;
93
+ stepKind: z.ZodString;
94
+ durationMs: z.ZodNumber;
95
+ modelId: z.ZodString;
96
+ inputTokens: z.ZodNumber;
97
+ outputTokens: z.ZodNumber;
98
+ reasoningTokens: z.ZodNumber;
99
+ cacheReadTokens: z.ZodOptional<z.ZodNumber>;
100
+ toolCalls: z.ZodArray<z.ZodString>;
101
+ toolCallDetails: z.ZodDefault<z.ZodArray<z.ZodObject<{
102
+ toolCallId: z.ZodString;
103
+ name: z.ZodString;
104
+ args: z.ZodString;
105
+ result: z.ZodString;
106
+ }, z.core.$strip>>>;
107
+ text: z.ZodDefault<z.ZodString>;
108
+ tokenStreamMs: z.ZodOptional<z.ZodNumber>;
109
+ responseId: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$strip>>;
111
+ totalInputTokens: z.ZodNumber;
112
+ totalOutputTokens: z.ZodNumber;
113
+ totalReasoningTokens: z.ZodNumber;
114
+ toolCallsSummary: z.ZodArray<z.ZodString>;
115
+ output: z.ZodOptional<z.ZodString>;
116
+ userPrompt: z.ZodOptional<z.ZodString>;
117
+ chatId: z.ZodOptional<z.ZodString>;
118
+ agentId: z.ZodOptional<z.ZodString>;
119
+ transport: z.ZodOptional<z.ZodString>;
120
+ phases: z.ZodOptional<z.ZodArray<z.ZodObject<{
121
+ label: z.ZodString;
122
+ durationMs: z.ZodNumber;
123
+ position: z.ZodEnum<{
124
+ pre: "pre";
125
+ post: "post";
126
+ }>;
127
+ startOffsetMs: z.ZodOptional<z.ZodNumber>;
128
+ endOffsetMs: z.ZodOptional<z.ZodNumber>;
129
+ }, z.core.$strip>>>;
130
+ totalPreStreamingMs: z.ZodOptional<z.ZodNumber>;
131
+ totalPostStreamingMs: z.ZodOptional<z.ZodNumber>;
132
+ milestones: z.ZodOptional<z.ZodObject<{
133
+ turnStarted: z.ZodOptional<z.ZodNumber>;
134
+ providerInvoked: z.ZodOptional<z.ZodNumber>;
135
+ providerFirstEvent: z.ZodOptional<z.ZodNumber>;
136
+ providerFirstTextDelta: z.ZodOptional<z.ZodNumber>;
137
+ responseFirstTextDelta: z.ZodOptional<z.ZodNumber>;
138
+ }, z.core.$strip>>;
139
+ phaseCoverage: z.ZodOptional<z.ZodNumber>;
140
+ benchmarkRunId: z.ZodOptional<z.ZodString>;
141
+ eventLoopLag: z.ZodOptional<z.ZodObject<{
142
+ meanMs: z.ZodNumber;
143
+ p50Ms: z.ZodNumber;
144
+ p95Ms: z.ZodNumber;
145
+ maxMs: z.ZodNumber;
146
+ }, z.core.$strip>>;
147
+ }, z.core.$strip>;
148
+ export type TimingToolCallDetail = z.infer<typeof TimingToolCallDetailSchema>;
149
+ export type TimingPhaseRecord = z.infer<typeof TimingPhaseRecordSchema>;
150
+ export type TimingStepRecord = z.infer<typeof TimingStepRecordSchema>;
151
+ export type TimingMilestones = z.infer<typeof TimingMilestonesSchema>;
152
+ export type TimingEventLoopLag = z.infer<typeof TimingEventLoopLagSchema>;
153
+ export type TimingEntry = z.infer<typeof TimingEntrySchema>;
@@ -22,7 +22,7 @@ export declare const UserOverviewSchema: z.ZodObject<{
22
22
  }, z.core.$strip>;
23
23
  files: z.ZodObject<{
24
24
  documents: z.ZodNumber;
25
- attachments: z.ZodNumber;
25
+ attachmentsNotInKb: z.ZodNumber;
26
26
  bytes: z.ZodNumber;
27
27
  }, z.core.$strip>;
28
28
  memories: z.ZodObject<{
@@ -24,6 +24,7 @@ export * from './Media';
24
24
  export * from './Member';
25
25
  export * from './MessageFeedback';
26
26
  export * from './Notification';
27
+ export * from './OpenAiCompat';
27
28
  export * from './Organization';
28
29
  export * from './OrganizationExternalAuth';
29
30
  export * from './OrganizationIdentityProvider';
@@ -33,6 +34,7 @@ export * from './ReasoningChat';
33
34
  export * from './RevisedAnswer';
34
35
  export * from './StreamError';
35
36
  export * from './SubAgent';
37
+ export * from './TimingLog';
36
38
  export * from './DocumentFolder';
37
39
  export * from './User';
38
40
  export * from './UserOverview';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8wave/ai-elements",
3
3
  "private": false,
4
- "version": "0.100.0",
4
+ "version": "0.101.0-beta.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite --port 8082 --open --host",