@anvia/core 0.26.0 → 1.0.0-rc.10

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 (184) hide show
  1. package/README.md +400 -94
  2. package/dist/agent/index.d.ts +67 -71
  3. package/dist/agent/index.js +36 -18
  4. package/dist/agent/interactions/index.d.ts +122 -0
  5. package/dist/agent/interactions/index.js +20 -0
  6. package/dist/agent-DWzW9SoH.d.ts +150 -0
  7. package/dist/chunk-3RM57ZT2.js +31 -0
  8. package/dist/chunk-3RM57ZT2.js.map +1 -0
  9. package/dist/chunk-3RWESPUG.js +331 -0
  10. package/dist/chunk-3RWESPUG.js.map +1 -0
  11. package/dist/{chunk-NCPN4SJR.js → chunk-3SKZ2BKP.js} +15 -13
  12. package/dist/chunk-3SKZ2BKP.js.map +1 -0
  13. package/dist/chunk-3XQGVDU5.js +69 -0
  14. package/dist/chunk-3XQGVDU5.js.map +1 -0
  15. package/dist/{chunk-MRQLEK2B.js → chunk-5C6B6ZRH.js} +69 -51
  16. package/dist/chunk-5C6B6ZRH.js.map +1 -0
  17. package/dist/chunk-6BBOCFHV.js +323 -0
  18. package/dist/chunk-6BBOCFHV.js.map +1 -0
  19. package/dist/chunk-7JLAIN6E.js +15 -0
  20. package/dist/chunk-7JLAIN6E.js.map +1 -0
  21. package/dist/chunk-7PHMK7W4.js +1516 -0
  22. package/dist/chunk-7PHMK7W4.js.map +1 -0
  23. package/dist/{chunk-CWUJUSOS.js → chunk-AZB6N7P4.js} +94 -65
  24. package/dist/chunk-AZB6N7P4.js.map +1 -0
  25. package/dist/chunk-D4PACGPA.js +37 -0
  26. package/dist/chunk-D4PACGPA.js.map +1 -0
  27. package/dist/chunk-EFLT7XZD.js +51 -0
  28. package/dist/chunk-EFLT7XZD.js.map +1 -0
  29. package/dist/chunk-EMZKPRE6.js +667 -0
  30. package/dist/chunk-EMZKPRE6.js.map +1 -0
  31. package/dist/chunk-I3Q7XSBB.js +59 -0
  32. package/dist/chunk-I3Q7XSBB.js.map +1 -0
  33. package/dist/chunk-J6LVLV6P.js +13 -0
  34. package/dist/chunk-J6LVLV6P.js.map +1 -0
  35. package/dist/chunk-LTXABCOO.js +127 -0
  36. package/dist/chunk-LTXABCOO.js.map +1 -0
  37. package/dist/chunk-OJBFDBLG.js +164 -0
  38. package/dist/chunk-OJBFDBLG.js.map +1 -0
  39. package/dist/chunk-QGX73TSQ.js +177 -0
  40. package/dist/chunk-QGX73TSQ.js.map +1 -0
  41. package/dist/chunk-QOUPWOGW.js +29 -0
  42. package/dist/chunk-QOUPWOGW.js.map +1 -0
  43. package/dist/chunk-SJMSS5SI.js +171 -0
  44. package/dist/chunk-SJMSS5SI.js.map +1 -0
  45. package/dist/chunk-T2C3CGDQ.js +56 -0
  46. package/dist/chunk-T2C3CGDQ.js.map +1 -0
  47. package/dist/chunk-VX3HS6PE.js +4569 -0
  48. package/dist/chunk-VX3HS6PE.js.map +1 -0
  49. package/dist/chunk-X4LK4ODN.js +86 -0
  50. package/dist/chunk-X4LK4ODN.js.map +1 -0
  51. package/dist/chunk-ZA564323.js +331 -0
  52. package/dist/chunk-ZA564323.js.map +1 -0
  53. package/dist/completion/index.d.ts +6 -36
  54. package/dist/completion/index.js +34 -29
  55. package/dist/documents/index.d.ts +34 -0
  56. package/dist/documents/index.js +340 -0
  57. package/dist/documents/index.js.map +1 -0
  58. package/dist/dynamic-tools-aIZlg5x1.d.ts +45 -0
  59. package/dist/embeddings/index.d.ts +11 -9
  60. package/dist/embeddings/index.js +3 -4
  61. package/dist/evals/index.d.ts +57 -21
  62. package/dist/evals/index.js +209 -104
  63. package/dist/evals/index.js.map +1 -1
  64. package/dist/extractor/index.d.ts +27 -42
  65. package/dist/extractor/index.js +9 -22
  66. package/dist/guardrails/index.d.ts +7 -129
  67. package/dist/guardrails/index.js +1 -1
  68. package/dist/image-generation/index.d.ts +23 -23
  69. package/dist/image-generation/index.js +7 -39
  70. package/dist/image-generation/index.js.map +1 -1
  71. package/dist/index.d.ts +24 -22
  72. package/dist/index.js +85 -68
  73. package/dist/internal/agent.d.ts +156 -10
  74. package/dist/internal/agent.js +58 -18
  75. package/dist/internal/agent.js.map +1 -1
  76. package/dist/mcp/index.d.ts +7 -15
  77. package/dist/mcp/index.js +3 -348
  78. package/dist/mcp/index.js.map +1 -1
  79. package/dist/memory/index.d.ts +20 -6
  80. package/dist/memory/index.js +11 -10
  81. package/dist/middleware-kcF8AusP.d.ts +59 -0
  82. package/dist/model-call-options-CZkSw_xN.d.ts +6 -0
  83. package/dist/model-listing/index.d.ts +3 -1
  84. package/dist/observability/index.d.ts +23 -4
  85. package/dist/observability/index.js +10 -5
  86. package/dist/observability/index.js.map +1 -1
  87. package/dist/pipeline/index.d.ts +111 -73
  88. package/dist/pipeline/index.js +471 -286
  89. package/dist/pipeline/index.js.map +1 -1
  90. package/dist/provider-output-error-BEwDgVv3.d.ts +99 -0
  91. package/dist/retry-CjvSlKGW.d.ts +16 -0
  92. package/dist/skills/index.d.ts +5 -4
  93. package/dist/skills/index.js +8 -8
  94. package/dist/speech-generation/index.d.ts +37 -0
  95. package/dist/speech-generation/index.js +10 -0
  96. package/dist/streaming/index.js +37 -3
  97. package/dist/streaming/index.js.map +1 -1
  98. package/dist/text-ZLECpQE7.d.ts +32 -0
  99. package/dist/think-tool-BwCsJ365.d.ts +40 -0
  100. package/dist/tool/index.d.ts +11 -6
  101. package/dist/tool/index.js +21 -21
  102. package/dist/tool-BpqpoRSE.d.ts +58 -0
  103. package/dist/transcription/index.d.ts +29 -22
  104. package/dist/transcription/index.js +7 -57
  105. package/dist/transcription/index.js.map +1 -1
  106. package/dist/type-utils-CtHVDRn_.d.ts +6 -0
  107. package/dist/types-CXNE592e.d.ts +130 -0
  108. package/dist/types-Cr4uiYo5.d.ts +99 -0
  109. package/dist/{types-04LqWrmy.d.ts → types-DC1U1XwW.d.ts} +1 -1
  110. package/dist/types-DKOXVTcq.d.ts +155 -0
  111. package/dist/types-DgvozfPc.d.ts +349 -0
  112. package/dist/types-DhkodEft.d.ts +105 -0
  113. package/dist/types-DjqRHeAi.d.ts +31 -0
  114. package/dist/types-Sue2hb_L.d.ts +403 -0
  115. package/dist/vector-store/index.d.ts +34 -34
  116. package/dist/vector-store/index.js +10 -6
  117. package/package.json +22 -24
  118. package/dist/agent-x3YTyv5i.d.ts +0 -222
  119. package/dist/audio-generation/index.d.ts +0 -33
  120. package/dist/audio-generation/index.js +0 -42
  121. package/dist/audio-generation/index.js.map +0 -1
  122. package/dist/chunk-2ODTMRHP.js +0 -54
  123. package/dist/chunk-2ODTMRHP.js.map +0 -1
  124. package/dist/chunk-ADH7NNCS.js +0 -512
  125. package/dist/chunk-ADH7NNCS.js.map +0 -1
  126. package/dist/chunk-BALBBVI3.js +0 -2732
  127. package/dist/chunk-BALBBVI3.js.map +0 -1
  128. package/dist/chunk-CQNNSZPG.js +0 -9
  129. package/dist/chunk-CQNNSZPG.js.map +0 -1
  130. package/dist/chunk-CWUJUSOS.js.map +0 -1
  131. package/dist/chunk-DALYP4PX.js +0 -225
  132. package/dist/chunk-DALYP4PX.js.map +0 -1
  133. package/dist/chunk-HYUYZEAJ.js +0 -223
  134. package/dist/chunk-HYUYZEAJ.js.map +0 -1
  135. package/dist/chunk-I6XOQ4LK.js +0 -466
  136. package/dist/chunk-I6XOQ4LK.js.map +0 -1
  137. package/dist/chunk-JI5YZWNT.js +0 -220
  138. package/dist/chunk-JI5YZWNT.js.map +0 -1
  139. package/dist/chunk-MC3CCKEB.js +0 -221
  140. package/dist/chunk-MC3CCKEB.js.map +0 -1
  141. package/dist/chunk-MELYDKWQ.js +0 -337
  142. package/dist/chunk-MELYDKWQ.js.map +0 -1
  143. package/dist/chunk-MNWK2USR.js +0 -243
  144. package/dist/chunk-MNWK2USR.js.map +0 -1
  145. package/dist/chunk-MRQLEK2B.js.map +0 -1
  146. package/dist/chunk-NCPN4SJR.js.map +0 -1
  147. package/dist/chunk-OIMLU4SF.js +0 -20
  148. package/dist/chunk-OIMLU4SF.js.map +0 -1
  149. package/dist/chunk-Q25IWLBT.js +0 -138
  150. package/dist/chunk-Q25IWLBT.js.map +0 -1
  151. package/dist/chunk-UQX6EXWG.js +0 -33
  152. package/dist/chunk-UQX6EXWG.js.map +0 -1
  153. package/dist/chunk-WQKHFADH.js +0 -12
  154. package/dist/chunk-WQKHFADH.js.map +0 -1
  155. package/dist/chunk-XUUY2L2D.js +0 -42
  156. package/dist/chunk-XUUY2L2D.js.map +0 -1
  157. package/dist/chunk-XWUC7CIT.js +0 -1
  158. package/dist/chunk-XWUC7CIT.js.map +0 -1
  159. package/dist/chunk-YLMDBQO4.js +0 -141
  160. package/dist/chunk-YLMDBQO4.js.map +0 -1
  161. package/dist/errors-2moLDuuN.d.ts +0 -17
  162. package/dist/hooks/index.d.ts +0 -12
  163. package/dist/hooks/index.js +0 -17
  164. package/dist/index-BxSbmOMr.d.ts +0 -257
  165. package/dist/json-BVPssigK.d.ts +0 -39
  166. package/dist/loaders/index.d.ts +0 -91
  167. package/dist/loaders/index.js +0 -299
  168. package/dist/loaders/index.js.map +0 -1
  169. package/dist/middleware-Dp3d_pxi.d.ts +0 -90
  170. package/dist/request/index.d.ts +0 -28
  171. package/dist/request/index.js +0 -25
  172. package/dist/think-tool-DfCMuO8e.d.ts +0 -26
  173. package/dist/tool-Cohdv5GC.d.ts +0 -65
  174. package/dist/types-BCTRUGex.d.ts +0 -47
  175. package/dist/types-BrLbKnEz.d.ts +0 -119
  176. package/dist/types-D9JpeAPF.d.ts +0 -114
  177. package/dist/types-G12i56s2.d.ts +0 -354
  178. package/dist/types-JJCxRnaZ.d.ts +0 -70
  179. package/dist/types-O-abTIin.d.ts +0 -79
  180. package/dist/ui/index.d.ts +0 -107
  181. package/dist/ui/index.js +0 -10
  182. package/dist/ui/index.js.map +0 -1
  183. /package/dist/{hooks → agent/interactions}/index.js.map +0 -0
  184. /package/dist/{request → speech-generation}/index.js.map +0 -0
@@ -0,0 +1,349 @@
1
+ import { M as ModelCallOptions } from './model-call-options-CZkSw_xN.js';
2
+
3
+ type JsonPrimitive = string | number | boolean | null;
4
+ type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
5
+ type JsonObject = {
6
+ [key: string]: JsonValue;
7
+ };
8
+ type Document = {
9
+ id: string;
10
+ text: string;
11
+ additionalProps?: Record<string, string>;
12
+ };
13
+ type TextPart = Readonly<{
14
+ type: "text";
15
+ text: string;
16
+ signature?: string;
17
+ }>;
18
+ type ImageDetail = "auto" | "low" | "high";
19
+ type FileData = Readonly<{
20
+ type: "url";
21
+ url: string;
22
+ }> | Readonly<{
23
+ type: "data";
24
+ data: string;
25
+ }> | Readonly<{
26
+ type: "text";
27
+ text: string;
28
+ }>;
29
+ type ImagePart = Readonly<{
30
+ type: "image";
31
+ image: Exclude<FileData, Readonly<{
32
+ type: "text";
33
+ text: string;
34
+ }>>;
35
+ mediaType?: string;
36
+ detail?: ImageDetail;
37
+ }>;
38
+ type FilePart = Readonly<{
39
+ type: "file";
40
+ data: FileData;
41
+ mediaType: string;
42
+ filename?: string;
43
+ }>;
44
+ type ReasoningPart = Readonly<{
45
+ type: "reasoning";
46
+ text: string;
47
+ id?: string;
48
+ details?: readonly ReasoningDetail[];
49
+ }>;
50
+ type ReasoningDetail = Readonly<{
51
+ type: "text";
52
+ text: string;
53
+ signature?: string;
54
+ }> | Readonly<{
55
+ type: "summary";
56
+ text: string;
57
+ }> | Readonly<{
58
+ type: "encrypted";
59
+ data: string;
60
+ }> | Readonly<{
61
+ type: "redacted";
62
+ data: string;
63
+ }>;
64
+ type ReasoningContentType = ReasoningDetail["type"];
65
+ type ToolCallPart = Readonly<{
66
+ type: "tool-call";
67
+ toolCallId: string;
68
+ callId?: string;
69
+ toolName: string;
70
+ input: JsonValue;
71
+ signature?: string;
72
+ }>;
73
+ type ToolResultContentPart = TextPart | FilePart;
74
+ type ToolResultOutput = Readonly<{
75
+ type: "text";
76
+ value: string;
77
+ }> | Readonly<{
78
+ type: "json";
79
+ value: JsonValue;
80
+ }> | Readonly<{
81
+ type: "content";
82
+ value: readonly ToolResultContentPart[];
83
+ }> | Readonly<{
84
+ type: "execution-denied";
85
+ reason?: string;
86
+ }> | Readonly<{
87
+ type: "error-text";
88
+ value: string;
89
+ }> | Readonly<{
90
+ type: "error-json";
91
+ value: JsonValue;
92
+ }>;
93
+ type ToolResultPart = Readonly<{
94
+ type: "tool-result";
95
+ toolCallId: string;
96
+ callId?: string;
97
+ toolName: string;
98
+ output: ToolResultOutput;
99
+ }>;
100
+ type ToolApprovalResponsePart = Readonly<{
101
+ type: "tool-approval-response";
102
+ interactionId: string;
103
+ toolCallId: string;
104
+ callId?: string;
105
+ toolName: string;
106
+ approved: boolean;
107
+ reason?: string;
108
+ }>;
109
+ type ToolQuestionAnswer = Readonly<{
110
+ questionId: string;
111
+ value: string;
112
+ }>;
113
+ type ToolQuestionResponsePart = Readonly<{
114
+ type: "tool-question-response";
115
+ interactionId: string;
116
+ toolCallId: string;
117
+ callId?: string;
118
+ toolName: string;
119
+ answers: readonly ToolQuestionAnswer[];
120
+ }>;
121
+ type ToolInteractionResponsePart = ToolApprovalResponsePart | ToolQuestionResponsePart;
122
+ type UserContentPart = TextPart | ImagePart | FilePart;
123
+ type AssistantContentPart = TextPart | ImagePart | FilePart | ReasoningPart | ToolCallPart;
124
+ type SystemMessage<Metadata extends JsonObject = JsonObject> = Readonly<{
125
+ role: "system";
126
+ content: string;
127
+ metadata?: Metadata;
128
+ }>;
129
+ type UserMessage<Metadata extends JsonObject = JsonObject> = Readonly<{
130
+ role: "user";
131
+ content: string | readonly UserContentPart[];
132
+ metadata?: Metadata;
133
+ }>;
134
+ type AssistantMessage<Metadata extends JsonObject = JsonObject> = Readonly<{
135
+ role: "assistant";
136
+ id?: string;
137
+ content: string | readonly AssistantContentPart[];
138
+ metadata?: Metadata;
139
+ }>;
140
+ type ToolMessage<Metadata extends JsonObject = JsonObject> = Readonly<{
141
+ role: "tool";
142
+ content: readonly (ToolResultPart | ToolInteractionResponsePart)[];
143
+ metadata?: Metadata;
144
+ }>;
145
+ type Message<Metadata extends JsonObject = JsonObject> = SystemMessage<Metadata> | UserMessage<Metadata> | AssistantMessage<Metadata> | ToolMessage<Metadata>;
146
+ declare function reasoningDisplayText(reasoning: ReasoningPart | readonly ReasoningDetail[]): string;
147
+ type ToolChoice = "auto" | "required" | "none" | {
148
+ type: "function";
149
+ name: string;
150
+ };
151
+ type ToolDefinition = {
152
+ name: string;
153
+ description: string;
154
+ parameters: JsonObject;
155
+ };
156
+ /**
157
+ * A tool executed by the model provider rather than by Anvia's local tool runtime.
158
+ *
159
+ * Provider packages expose typed factories for these values. Application code can
160
+ * pass them through the same high-level `tools` APIs used for local tools.
161
+ */
162
+ type ProviderTool = {
163
+ kind: "provider";
164
+ provider: string;
165
+ name: string;
166
+ configuration?: JsonObject;
167
+ };
168
+ type CompletionTool = ToolDefinition | ProviderTool;
169
+ declare function isProviderTool(value: unknown): value is ProviderTool;
170
+ type CompletionSource = {
171
+ type: "url";
172
+ url: string;
173
+ title?: string;
174
+ id?: string;
175
+ startIndex?: number;
176
+ endIndex?: number;
177
+ };
178
+ type ProviderToolCall = {
179
+ id: string;
180
+ name: string;
181
+ status?: string;
182
+ details?: JsonObject;
183
+ };
184
+ /**
185
+ * Provider-normalized, mutually exclusive usage buckets.
186
+ *
187
+ * Every token should appear in exactly one non-total bucket. `total` is the
188
+ * only aggregate key and should equal the sum of the other buckets.
189
+ */
190
+ type UsageDetails = Record<string, number>;
191
+ type ModelContextLimits = {
192
+ contextWindow: number;
193
+ maxInputTokens?: number;
194
+ maxOutputTokens?: number;
195
+ };
196
+ type CompletionModelInfo = {
197
+ modelId: string;
198
+ context: ModelContextLimits;
199
+ };
200
+ type ContextUsage = {
201
+ model: CompletionModelInfo;
202
+ usedTokens: number;
203
+ remainingTokens: number;
204
+ usedPercent: number;
205
+ remainingPercent: number;
206
+ };
207
+ declare function calculateContextUsage(usage: Usage, model: CompletionModelInfo | undefined): ContextUsage | undefined;
208
+ declare function withContextUsage<RawResponse>(response: CompletionResponse<RawResponse>, model: CompletionModelInfo | undefined): CompletionResponse<RawResponse>;
209
+ declare function resolveModelContextLimits(modelId: string, catalog: Readonly<Record<string, ModelContextLimits>>, override?: ModelContextLimits): ModelContextLimits | undefined;
210
+ type AssistantGenerationMetadata = {
211
+ provider: string;
212
+ modelId: string;
213
+ usage: Usage;
214
+ finishReason?: CompletionFinishReason;
215
+ providerFinishReason?: string;
216
+ contextUsage?: ContextUsage;
217
+ sources?: CompletionSource[];
218
+ providerToolCalls?: ProviderToolCall[];
219
+ };
220
+ type Usage = {
221
+ inputTokens: number;
222
+ outputTokens: number;
223
+ totalTokens: number;
224
+ cachedInputTokens: number;
225
+ cacheCreationInputTokens: number;
226
+ details?: UsageDetails;
227
+ };
228
+ declare const Usage: {
229
+ empty(): Usage;
230
+ add(left: Usage, right: Usage): Usage;
231
+ isEmpty(usage: Usage): boolean;
232
+ };
233
+ declare function getAssistantGenerationMetadata(message: Message): AssistantGenerationMetadata | undefined;
234
+ type CompletionRequest = {
235
+ instructions?: string;
236
+ chatHistory: Message[];
237
+ documents: Document[];
238
+ tools: ToolDefinition[];
239
+ providerTools?: ProviderTool[];
240
+ temperature?: number;
241
+ maxTokens?: number;
242
+ toolChoice?: ToolChoice;
243
+ providerOptions?: JsonObject;
244
+ outputSchema?: JsonObject;
245
+ };
246
+ type CompletionFinishReason = "stop" | "length" | "content-filter" | "tool-calls" | "other";
247
+ type CompletionResponse<RawResponse = unknown> = {
248
+ choice: AssistantContentPart[];
249
+ usage: Usage;
250
+ finishReason?: CompletionFinishReason;
251
+ providerFinishReason?: string;
252
+ contextUsage?: ContextUsage;
253
+ rawResponse: RawResponse;
254
+ messageId?: string;
255
+ sources?: CompletionSource[];
256
+ providerToolCalls?: ProviderToolCall[];
257
+ };
258
+ type CompletionResult<Output = string, RawResponse = unknown> = {
259
+ output: Output;
260
+ text: string;
261
+ content: readonly AssistantContentPart[];
262
+ usage: Usage;
263
+ finishReason?: CompletionFinishReason;
264
+ providerFinishReason?: string;
265
+ contextUsage?: ContextUsage;
266
+ rawResponse: RawResponse;
267
+ messageId?: string;
268
+ sources?: readonly CompletionSource[];
269
+ providerToolCalls?: readonly ProviderToolCall[];
270
+ };
271
+ type CompletionModelCapabilities = {
272
+ streaming: boolean;
273
+ tools: boolean;
274
+ toolChoice: boolean;
275
+ imageInput: boolean;
276
+ documentInput: boolean;
277
+ outputSchema: boolean;
278
+ reasoning: boolean;
279
+ providerTools?: boolean;
280
+ };
281
+ interface CompletionModel<RawResponse = unknown> {
282
+ readonly provider: string;
283
+ readonly modelId: string;
284
+ readonly contextLimits?: ModelContextLimits | undefined;
285
+ readonly capabilities: CompletionModelCapabilities;
286
+ traceRequest?(request: CompletionRequest, options?: {
287
+ stream?: boolean | undefined;
288
+ }): JsonObject | undefined;
289
+ completion(request: CompletionRequest, options?: ModelCallOptions): Promise<CompletionResponse<RawResponse>>;
290
+ }
291
+ type ToolCallArgumentsMode = "append" | "replace";
292
+ type CompletionStreamPart = {
293
+ type: "text_delta";
294
+ delta: string;
295
+ } | {
296
+ type: "reasoning_delta";
297
+ delta: string;
298
+ id?: string;
299
+ contentType?: ReasoningContentType;
300
+ signature?: string;
301
+ } | {
302
+ type: "tool_call_delta";
303
+ id: string;
304
+ callId?: string;
305
+ name?: string;
306
+ argumentsDelta?: string;
307
+ argumentsMode?: ToolCallArgumentsMode;
308
+ signature?: string;
309
+ } | {
310
+ type: "tool_call";
311
+ toolCall: ToolCallPart;
312
+ } | {
313
+ type: "source";
314
+ source: CompletionSource;
315
+ } | {
316
+ type: "provider_tool_call";
317
+ toolCall: ProviderToolCall;
318
+ } | {
319
+ type: "message_id";
320
+ id: string;
321
+ };
322
+ type CompletionModelStreamEvent<RawResponse = unknown> = CompletionStreamPart | {
323
+ type: "final";
324
+ response: CompletionResponse<RawResponse>;
325
+ } | {
326
+ type: "error";
327
+ error: unknown;
328
+ usage?: Usage;
329
+ };
330
+ type CompletionStreamEvent<Output = string, RawResponse = unknown> = CompletionStreamPart | {
331
+ type: "final";
332
+ result: CompletionResult<Output, RawResponse>;
333
+ } | {
334
+ type: "error";
335
+ error: unknown;
336
+ usage: Usage;
337
+ };
338
+ interface StreamingCompletionModel<RawResponse = unknown> extends CompletionModel<RawResponse> {
339
+ streamCompletion(request: CompletionRequest, options?: ModelCallOptions): AsyncIterable<CompletionModelStreamEvent<RawResponse>>;
340
+ }
341
+ declare class CompletionCapabilityError extends Error {
342
+ constructor(message: string);
343
+ }
344
+ declare function assertCompletionRequestSupported(model: CompletionModel, request: CompletionRequest, options?: {
345
+ streaming?: boolean | undefined;
346
+ }): void;
347
+ declare function textFromAssistantContent(content: readonly AssistantContentPart[]): string;
348
+
349
+ export { type ToolQuestionAnswer as $, type AssistantContentPart as A, type ToolResultPart as B, type CompletionFinishReason as C, type Document as D, type UserContentPart as E, type FileData as F, type UserMessage as G, calculateContextUsage as H, type ImageDetail as I, type JsonObject as J, getAssistantGenerationMetadata as K, isProviderTool as L, type Message as M, resolveModelContextLimits as N, withContextUsage as O, type ProviderTool as P, CompletionCapabilityError as Q, type ReasoningContentType as R, type SystemMessage as S, type TextPart as T, Usage as U, type CompletionModelCapabilities as V, type CompletionStreamPart as W, type StreamingCompletionModel as X, type ToolApprovalResponsePart as Y, type ToolCallArgumentsMode as Z, type ToolInteractionResponsePart as _, type AssistantGenerationMetadata as a, type ToolQuestionResponsePart as a0, type UsageDetails as a1, assertCompletionRequestSupported as a2, reasoningDisplayText as a3, textFromAssistantContent as a4, type AssistantMessage as b, type CompletionModel as c, type CompletionModelInfo as d, type CompletionModelStreamEvent as e, type CompletionRequest as f, type CompletionResponse as g, type CompletionResult as h, type CompletionSource as i, type CompletionStreamEvent as j, type CompletionTool as k, type ContextUsage as l, type FilePart as m, type ImagePart as n, type JsonPrimitive as o, type JsonValue as p, type ModelContextLimits as q, type ProviderToolCall as r, type ReasoningDetail as s, type ReasoningPart as t, type ToolCallPart as u, type ToolChoice as v, type ToolDefinition as w, type ToolMessage as x, type ToolResultContentPart as y, type ToolResultOutput as z };
@@ -0,0 +1,105 @@
1
+ import { M as Message, J as JsonObject, U as Usage } from './types-DgvozfPc.js';
2
+ import { M as MaybePromise } from './type-utils-CtHVDRn_.js';
3
+
4
+ type GuardrailMode = "enforce" | "observe";
5
+ type GuardrailBoundary = "input" | "output";
6
+ type GuardrailRunContext = {
7
+ agentId: string;
8
+ runId: string;
9
+ sessionId?: string | undefined;
10
+ metadata?: JsonObject | undefined;
11
+ };
12
+ type GuardrailDecisionRecord = {
13
+ policyId: string;
14
+ guardrailId: string;
15
+ boundary: GuardrailBoundary;
16
+ mode: GuardrailMode;
17
+ action: GuardrailActionName;
18
+ applied: boolean;
19
+ reason?: string | undefined;
20
+ message?: string | undefined;
21
+ metadata?: JsonObject | undefined;
22
+ latencyMs: number;
23
+ };
24
+ type GuardrailActionName = "allow" | "block" | "rewrite" | "error";
25
+ type GuardrailActionBase = {
26
+ reason?: string | undefined;
27
+ metadata?: JsonObject | undefined;
28
+ };
29
+ type GuardrailAllow = GuardrailActionBase & {
30
+ action: "allow";
31
+ };
32
+ type GuardrailBlock = GuardrailActionBase & {
33
+ action: "block";
34
+ reason: string;
35
+ message?: string | undefined;
36
+ };
37
+ type InputGuardrailRewrite = GuardrailActionBase & {
38
+ action: "rewrite";
39
+ prompt?: Message | undefined;
40
+ inputText?: string | undefined;
41
+ };
42
+ type OutputGuardrailRewrite = GuardrailActionBase & {
43
+ action: "rewrite";
44
+ outputText: string;
45
+ };
46
+ type InputGuardrailResult = GuardrailAllow | GuardrailBlock | InputGuardrailRewrite;
47
+ type OutputGuardrailResult = GuardrailAllow | GuardrailBlock | OutputGuardrailRewrite;
48
+ type GuardrailCommonActions = {
49
+ allow(options?: GuardrailActionBase): GuardrailAllow;
50
+ block(options: Omit<GuardrailBlock, "action">): GuardrailBlock;
51
+ };
52
+ type InputGuardrailActions = GuardrailCommonActions & {
53
+ rewrite(options: Omit<InputGuardrailRewrite, "action">): InputGuardrailRewrite;
54
+ };
55
+ type OutputGuardrailActions = GuardrailCommonActions & {
56
+ rewrite(options: Omit<OutputGuardrailRewrite, "action">): OutputGuardrailRewrite;
57
+ };
58
+ type InputGuardrailContext = {
59
+ prompt: Message;
60
+ history: Message[];
61
+ inputText: string;
62
+ run: GuardrailRunContext;
63
+ };
64
+ type OutputGuardrailContext = {
65
+ outputText: string;
66
+ messages: Message[];
67
+ usage: Usage;
68
+ run: GuardrailRunContext;
69
+ };
70
+ type InputGuardrail = {
71
+ id: string;
72
+ check(context: InputGuardrailContext, actions: InputGuardrailActions): MaybePromise<InputGuardrailResult | undefined>;
73
+ };
74
+ type OutputGuardrail = {
75
+ id: string;
76
+ check(context: OutputGuardrailContext, actions: OutputGuardrailActions): MaybePromise<OutputGuardrailResult | undefined>;
77
+ };
78
+ type GuardrailPolicy = {
79
+ id: string;
80
+ mode: GuardrailMode;
81
+ input: InputGuardrail[];
82
+ output: OutputGuardrail[];
83
+ };
84
+ type GuardrailPolicyOptions = {
85
+ id: string;
86
+ mode?: GuardrailMode | undefined;
87
+ input?: InputGuardrail[] | undefined;
88
+ output?: OutputGuardrail[] | undefined;
89
+ };
90
+ type GuardrailPolicyInput = GuardrailPolicy | GuardrailPolicy[];
91
+ type InputGuardrailRunResult = {
92
+ prompt: Message;
93
+ inputText: string;
94
+ blocked: boolean;
95
+ message?: string | undefined;
96
+ decisions: GuardrailDecisionRecord[];
97
+ };
98
+ type OutputGuardrailRunResult = {
99
+ outputText: string;
100
+ blocked: boolean;
101
+ message?: string | undefined;
102
+ decisions: GuardrailDecisionRecord[];
103
+ };
104
+
105
+ export type { GuardrailBoundary as G, InputGuardrail as I, OutputGuardrail as O, GuardrailDecisionRecord as a, GuardrailMode as b, GuardrailPolicy as c, GuardrailPolicyInput as d, GuardrailPolicyOptions as e, InputGuardrailActions as f, InputGuardrailContext as g, OutputGuardrailActions as h, OutputGuardrailContext as i, InputGuardrailRunResult as j, OutputGuardrailRunResult as k, GuardrailActionBase as l, GuardrailActionName as m, GuardrailAllow as n, GuardrailBlock as o, GuardrailCommonActions as p, GuardrailRunContext as q, InputGuardrailResult as r, InputGuardrailRewrite as s, OutputGuardrailResult as t, OutputGuardrailRewrite as u };
@@ -0,0 +1,31 @@
1
+ import { J as JsonObject } from './types-DgvozfPc.js';
2
+ import { A as AnyTool } from './tool-BpqpoRSE.js';
3
+
4
+ type McpServerInfo = {
5
+ readonly name: string;
6
+ readonly version: string;
7
+ readonly title?: string | undefined;
8
+ readonly description?: string | undefined;
9
+ readonly websiteUrl?: string | undefined;
10
+ readonly icons?: readonly {
11
+ readonly src: string;
12
+ readonly mimeType?: string | undefined;
13
+ readonly sizes?: readonly string[] | undefined;
14
+ readonly theme?: "light" | "dark" | undefined;
15
+ }[];
16
+ };
17
+ type McpTool = AnyTool & {
18
+ readonly mcp: {
19
+ readonly serverName: string;
20
+ readonly remoteName: string;
21
+ };
22
+ };
23
+ type McpServer = {
24
+ readonly name: string;
25
+ readonly tools: readonly McpTool[];
26
+ readonly serverInfo?: McpServerInfo | undefined;
27
+ readonly capabilities?: JsonObject | undefined;
28
+ readonly instructions?: string | undefined;
29
+ };
30
+
31
+ export type { McpTool as M, McpServer as a, McpServerInfo as b };