@anvia/core 0.13.3 → 0.13.5

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 (68) hide show
  1. package/dist/agent/index.d.ts +11 -11
  2. package/dist/agent/index.js +8 -8
  3. package/dist/{agent-3qSfIKIj.d.ts → agent-W8sT6P5T.d.ts} +27 -8
  4. package/dist/audio-generation/index.d.ts +1 -1
  5. package/dist/{chunk-VPRJIWTP.js → chunk-3LB36HON.js} +269 -30
  6. package/dist/chunk-3LB36HON.js.map +1 -0
  7. package/dist/{chunk-NS7W4G26.js → chunk-3LMKHICK.js} +2 -2
  8. package/dist/{chunk-AWTFWDMY.js → chunk-6FLW6XS6.js} +3 -3
  9. package/dist/{chunk-DC2GJDPR.js → chunk-77D7XBWL.js} +2 -2
  10. package/dist/{chunk-I7TM7TKX.js → chunk-F3C5653H.js} +4 -4
  11. package/dist/{chunk-CNTGKNZ3.js → chunk-FE5QL4G3.js} +32 -1
  12. package/dist/chunk-FE5QL4G3.js.map +1 -0
  13. package/dist/{chunk-YTF65GYU.js → chunk-IBKCOBAS.js} +2 -2
  14. package/dist/{chunk-J3R7WC2W.js → chunk-LJT67CFB.js} +5 -5
  15. package/dist/{chunk-AXBW7OYU.js → chunk-TTKCFLW6.js} +6 -6
  16. package/dist/{chunk-WHHQWT7D.js → chunk-XH6LZMGH.js} +6 -6
  17. package/dist/completion/index.d.ts +3 -3
  18. package/dist/completion/index.js +4 -2
  19. package/dist/evals/index.d.ts +8 -8
  20. package/dist/evals/index.js +9 -9
  21. package/dist/extractor/index.d.ts +8 -8
  22. package/dist/extractor/index.js +9 -9
  23. package/dist/guardrails/index.d.ts +1 -1
  24. package/dist/hooks/index.d.ts +3 -3
  25. package/dist/image-generation/index.d.ts +1 -1
  26. package/dist/{index-ZQAiHW5Q.d.ts → index-BtyK30mL.d.ts} +2 -2
  27. package/dist/index.d.ts +13 -13
  28. package/dist/index.js +13 -11
  29. package/dist/internal/agent.d.ts +8 -8
  30. package/dist/internal/agent.js +7 -7
  31. package/dist/{json-C5a6auAm.d.ts → json-BOHFS4AG.d.ts} +1 -1
  32. package/dist/loaders/index.d.ts +1 -1
  33. package/dist/mcp/index.d.ts +4 -4
  34. package/dist/memory/index.d.ts +3 -3
  35. package/dist/{middleware-Cc_-sosu.d.ts → middleware-D6p0Uzky.d.ts} +3 -3
  36. package/dist/observability/index.d.ts +3 -3
  37. package/dist/pipeline/index.d.ts +8 -8
  38. package/dist/request/index.d.ts +8 -8
  39. package/dist/request/index.js +6 -6
  40. package/dist/skills/index.d.ts +4 -4
  41. package/dist/skills/index.js +5 -5
  42. package/dist/{think-tool-DvhOlrL8.d.ts → think-tool-B7p_7_5P.d.ts} +1 -1
  43. package/dist/tool/index.d.ts +5 -5
  44. package/dist/tool/index.js +5 -5
  45. package/dist/{tool-6f9bK92X.d.ts → tool-DhT6kR0Z.d.ts} +1 -1
  46. package/dist/transcription/index.d.ts +1 -1
  47. package/dist/{types-C708DOhL.d.ts → types-9TeQF79I.d.ts} +1 -1
  48. package/dist/{types-DzdJOf35.d.ts → types-BNq9tWdA.d.ts} +7 -1
  49. package/dist/{types-BaYwqozV.d.ts → types-BjPcB4PA.d.ts} +1 -1
  50. package/dist/types-CaXSh3vK.d.ts +72 -0
  51. package/dist/{types-BG3s2WzI.d.ts → types-CibT6_rS.d.ts} +2 -2
  52. package/dist/{types-BZQlZ4Vs.d.ts → types-Cz24JCei.d.ts} +1 -1
  53. package/dist/ui/index.d.ts +1 -1
  54. package/dist/ui/index.js +2 -2
  55. package/dist/vector-store/index.d.ts +4 -4
  56. package/dist/vector-store/index.js +2 -2
  57. package/package.json +1 -1
  58. package/dist/chunk-CNTGKNZ3.js.map +0 -1
  59. package/dist/chunk-VPRJIWTP.js.map +0 -1
  60. package/dist/types-CNeDsGjw.d.ts +0 -42
  61. /package/dist/{chunk-NS7W4G26.js.map → chunk-3LMKHICK.js.map} +0 -0
  62. /package/dist/{chunk-AWTFWDMY.js.map → chunk-6FLW6XS6.js.map} +0 -0
  63. /package/dist/{chunk-DC2GJDPR.js.map → chunk-77D7XBWL.js.map} +0 -0
  64. /package/dist/{chunk-I7TM7TKX.js.map → chunk-F3C5653H.js.map} +0 -0
  65. /package/dist/{chunk-YTF65GYU.js.map → chunk-IBKCOBAS.js.map} +0 -0
  66. /package/dist/{chunk-J3R7WC2W.js.map → chunk-LJT67CFB.js.map} +0 -0
  67. /package/dist/{chunk-AXBW7OYU.js.map → chunk-TTKCFLW6.js.map} +0 -0
  68. /package/dist/{chunk-WHHQWT7D.js.map → chunk-XH6LZMGH.js.map} +0 -0
@@ -1,11 +1,11 @@
1
- export { b as CreateThinkToolOptions, C as CreateToolOptions, c as createThinkTool, a as createTool } from '../think-tool-DvhOlrL8.js';
2
- export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, D as DynamicToolIndex, E as EmbedToolsOptions, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolMiddleware, f as ToolOutputMiddlewareArgs, g as ToolOutputMiddlewareResult, h as ToolResultMiddlewareArgs, k as ToolSearchDocument, l as ToolSet, i as createMiddleware, m as createToolIndex, j as createToolMiddleware, n as embedTools, o as isDynamicToolIndex } from '../middleware-Cc_-sosu.js';
3
- export { A as AnyTool, N as NormalizedToolOutput, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, h as ToolApprovalRunContext, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent, i as ToolOutput, n as normalizeToolResultOutput, p as parseToolArgs, t as toolResultContentToText } from '../tool-6f9bK92X.js';
4
- export { r as isToolResultContentArray, s as serializeToolOutput } from '../types-DzdJOf35.js';
1
+ export { b as CreateThinkToolOptions, C as CreateToolOptions, c as createThinkTool, a as createTool } from '../think-tool-B7p_7_5P.js';
2
+ export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, D as DynamicToolIndex, E as EmbedToolsOptions, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolMiddleware, f as ToolOutputMiddlewareArgs, g as ToolOutputMiddlewareResult, h as ToolResultMiddlewareArgs, k as ToolSearchDocument, l as ToolSet, i as createMiddleware, m as createToolIndex, j as createToolMiddleware, n as embedTools, o as isDynamicToolIndex } from '../middleware-D6p0Uzky.js';
3
+ export { A as AnyTool, N as NormalizedToolOutput, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, h as ToolApprovalRunContext, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent, i as ToolOutput, n as normalizeToolResultOutput, p as parseToolArgs, t as toolResultContentToText } from '../tool-DhT6kR0Z.js';
4
+ export { t as isToolResultContentArray, u as serializeToolOutput } from '../types-BNq9tWdA.js';
5
5
  import 'zod';
6
6
  import '../zod-schema-C7F4clpm.js';
7
7
  import '../types-DHHZztGO.js';
8
- import '../types-C708DOhL.js';
8
+ import '../types-9TeQF79I.js';
9
9
 
10
10
  declare class ToolCallError extends Error {
11
11
  readonly cause?: unknown | undefined;
@@ -13,17 +13,17 @@ import {
13
13
  normalizeToolResultOutput,
14
14
  parseToolArgs,
15
15
  toolResultContentToText
16
- } from "../chunk-WHHQWT7D.js";
16
+ } from "../chunk-XH6LZMGH.js";
17
17
  import {
18
18
  createTool
19
- } from "../chunk-I7TM7TKX.js";
19
+ } from "../chunk-F3C5653H.js";
20
+ import "../chunk-YBBD4HZ3.js";
21
+ import "../chunk-OIMLU4SF.js";
20
22
  import {
21
23
  isToolResultContentArray,
22
24
  serializeToolResultOutput
23
- } from "../chunk-CNTGKNZ3.js";
25
+ } from "../chunk-FE5QL4G3.js";
24
26
  import "../chunk-WQKHFADH.js";
25
- import "../chunk-YBBD4HZ3.js";
26
- import "../chunk-OIMLU4SF.js";
27
27
  export {
28
28
  ToolCallError,
29
29
  ToolJsonError,
@@ -1,4 +1,4 @@
1
- import { J as JsonObject, j as ToolDefinition, m as ToolResultContent, f as JsonValue } from './types-DzdJOf35.js';
1
+ import { J as JsonObject, k as ToolDefinition, n as ToolResultContent, g as JsonValue } from './types-BNq9tWdA.js';
2
2
 
3
3
  type ToolApprovalRunContext = {
4
4
  agentId: string;
@@ -1,4 +1,4 @@
1
- import { f as JsonValue } from '../types-DzdJOf35.js';
1
+ import { g as JsonValue } from '../types-BNq9tWdA.js';
2
2
 
3
3
  type TranscriptionRequest = {
4
4
  data: Uint8Array;
@@ -1,5 +1,5 @@
1
1
  import { V as VectorMetadata, a as VectorMetadataValue } from './types-DHHZztGO.js';
2
- import { T as Tool } from './tool-6f9bK92X.js';
2
+ import { T as Tool } from './tool-DhT6kR0Z.js';
3
3
 
4
4
  type VectorFilter = {
5
5
  type: "eq";
@@ -182,6 +182,11 @@ type ToolDefinition = {
182
182
  description: string;
183
183
  parameters: JsonObject;
184
184
  };
185
+ type AssistantGenerationMetadata = {
186
+ provider: string;
187
+ model: string;
188
+ usage: Usage;
189
+ };
185
190
  type Usage = {
186
191
  inputTokens: number;
187
192
  outputTokens: number;
@@ -193,6 +198,7 @@ declare const Usage: {
193
198
  empty(): Usage;
194
199
  add(left: Usage, right: Usage): Usage;
195
200
  };
201
+ declare function getAssistantGenerationMetadata(message: Message): AssistantGenerationMetadata | undefined;
196
202
  type CompletionRequest<ModelName extends string = string> = {
197
203
  model?: ModelName;
198
204
  instructions?: string;
@@ -269,4 +275,4 @@ declare function assertCompletionRequestSupported(model: CompletionModel, reques
269
275
  }): void;
270
276
  declare function textFromAssistantContent(content: AssistantContent[]): string;
271
277
 
272
- export { AssistantContent as A, type ReasoningContentType as B, type CompletionModel as C, type Document as D, type StreamingCompletionModel as E, type ToolFunction as F, assertCompletionRequestSupported as G, reasoningDisplayText as H, type ImageContent as I, type JsonObject as J, textFromAssistantContent as K, Message as M, type Reasoning as R, type SystemMessage as S, type Text as T, Usage as U, type AssistantMessage as a, type AssistantMessageOptions as b, type CompletionRequest as c, type CompletionResponse as d, type JsonPrimitive as e, type JsonValue as f, type MessageOptions as g, type ToolCall as h, ToolContent as i, type ToolDefinition as j, type ToolMessage as k, type ToolResult as l, type ToolResultContent as m, type ToolResultMessageOptions as n, type ToolResultOptions as o, UserContent as p, type UserMessage as q, isToolResultContentArray as r, serializeToolResultOutput as s, type ToolChoice as t, CompletionCapabilityError as u, type CompletionModelCapabilities as v, type CompletionStreamEvent as w, type DocumentContent as x, type ImageDetail as y, type ReasoningContent as z };
278
+ export { AssistantContent as A, type ImageDetail as B, type CompletionModel as C, type Document as D, type ReasoningContent as E, type ReasoningContentType as F, type StreamingCompletionModel as G, type ToolFunction as H, type ImageContent as I, type JsonObject as J, assertCompletionRequestSupported as K, reasoningDisplayText as L, Message as M, textFromAssistantContent as N, type Reasoning as R, type SystemMessage as S, type Text as T, Usage as U, type AssistantGenerationMetadata as a, type AssistantMessage as b, type AssistantMessageOptions as c, type CompletionRequest as d, type CompletionResponse as e, type JsonPrimitive as f, type JsonValue as g, type MessageOptions as h, type ToolCall as i, ToolContent as j, type ToolDefinition as k, type ToolMessage as l, type ToolResult as m, type ToolResultContent as n, type ToolResultMessageOptions as o, type ToolResultOptions as p, UserContent as q, type UserMessage as r, getAssistantGenerationMetadata as s, isToolResultContentArray as t, serializeToolResultOutput as u, type ToolChoice as v, CompletionCapabilityError as w, type CompletionModelCapabilities as x, type CompletionStreamEvent as y, type DocumentContent as z };
@@ -1,4 +1,4 @@
1
- import { M as Message, U as Usage, d as CompletionResponse, m as ToolResultContent } from './types-DzdJOf35.js';
1
+ import { M as Message, U as Usage, e as CompletionResponse, n as ToolResultContent } from './types-BNq9tWdA.js';
2
2
 
3
3
  type HookAction = {
4
4
  type: "continue";
@@ -0,0 +1,72 @@
1
+ import { J as JsonObject, M as Message } from './types-BNq9tWdA.js';
2
+
3
+ type MemorySavePolicy = "message" | "turn" | "run";
4
+ type MemoryContext = {
5
+ sessionId: string;
6
+ userId?: string | undefined;
7
+ metadata?: JsonObject | undefined;
8
+ };
9
+ type MemoryAppendInput = {
10
+ context: MemoryContext;
11
+ runId: string;
12
+ turn: number;
13
+ messages: Message[];
14
+ };
15
+ type MemoryErrorInput = {
16
+ context: MemoryContext;
17
+ runId: string;
18
+ error: unknown;
19
+ messages: Message[];
20
+ };
21
+ type MemoryConversationListOptions = {
22
+ limit: number;
23
+ userId?: string | undefined;
24
+ };
25
+ type MemoryConversationSummary = {
26
+ /** Opaque, store-specific reference used to retrieve this exact conversation. */
27
+ ref: string;
28
+ sessionId: string;
29
+ userId?: string | undefined;
30
+ metadata?: JsonObject | undefined;
31
+ createdAt: string;
32
+ updatedAt: string;
33
+ messageCount: number;
34
+ };
35
+ type MemoryConversationMessage = {
36
+ position: number;
37
+ runId: string;
38
+ turn: number;
39
+ createdAt: string;
40
+ message: Message;
41
+ };
42
+ type MemoryConversation = MemoryConversationSummary & {
43
+ messages: MemoryConversationMessage[];
44
+ };
45
+ /** Optional, read-only discovery surface for developer tooling such as Studio. */
46
+ interface MemoryInspector {
47
+ listConversations(options: MemoryConversationListOptions): Promise<MemoryConversationSummary[]>;
48
+ getConversation(ref: string): Promise<MemoryConversation | undefined>;
49
+ }
50
+ interface MemoryStore {
51
+ readonly inspector?: MemoryInspector | undefined;
52
+ load(context: MemoryContext): Promise<Message[]>;
53
+ append(input: MemoryAppendInput): Promise<void>;
54
+ clear(context: MemoryContext): Promise<void>;
55
+ recordError?(input: MemoryErrorInput): Promise<void>;
56
+ }
57
+ type MemoryOptions = {
58
+ savePolicy?: MemorySavePolicy | undefined;
59
+ };
60
+ type ResolvedMemoryOptions = {
61
+ savePolicy: MemorySavePolicy;
62
+ };
63
+ type MemoryRegistration = {
64
+ store: MemoryStore;
65
+ options: ResolvedMemoryOptions;
66
+ };
67
+ type SessionOptions = {
68
+ userId?: string | undefined;
69
+ metadata?: JsonObject | undefined;
70
+ };
71
+
72
+ export type { MemoryConversation as M, ResolvedMemoryOptions as R, SessionOptions as S, MemoryConversationListOptions as a, MemoryConversationMessage as b, MemoryConversationSummary as c, MemoryInspector as d, MemoryStore as e, MemoryOptions as f, MemoryAppendInput as g, MemoryContext as h, MemoryErrorInput as i, MemoryRegistration as j, MemorySavePolicy as k };
@@ -1,8 +1,8 @@
1
1
  import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
2
2
  import { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
3
3
  import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
4
- import { J as JsonObject } from './types-DzdJOf35.js';
5
- import { A as AnyTool } from './tool-6f9bK92X.js';
4
+ import { J as JsonObject } from './types-BNq9tWdA.js';
5
+ import { A as AnyTool } from './tool-DhT6kR0Z.js';
6
6
 
7
7
  type McpToolDefinition = {
8
8
  name: string;
@@ -1,4 +1,4 @@
1
- import { A as AnyTool } from './tool-6f9bK92X.js';
1
+ import { A as AnyTool } from './tool-DhT6kR0Z.js';
2
2
 
3
3
  type Skill = {
4
4
  readonly name: string;
@@ -1,4 +1,4 @@
1
- import { y as ImageDetail, f as JsonValue, U as Usage, M as Message } from '../types-DzdJOf35.js';
1
+ import { B as ImageDetail, g as JsonValue, U as Usage, M as Message } from '../types-BNq9tWdA.js';
2
2
 
3
3
  type UIMessageRole = "system" | "user" | "assistant" | "tool";
4
4
  type UIError = {
package/dist/ui/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  coreMessagesToUIMessages,
3
3
  uiMessagesToCoreMessages
4
- } from "../chunk-NS7W4G26.js";
5
- import "../chunk-CNTGKNZ3.js";
4
+ } from "../chunk-3LMKHICK.js";
5
+ import "../chunk-FE5QL4G3.js";
6
6
  export {
7
7
  coreMessagesToUIMessages,
8
8
  uiMessagesToCoreMessages
@@ -1,8 +1,8 @@
1
1
  import { a as VectorMetadataValue, V as VectorMetadata, E as EmbeddingModel, c as EmbeddedDocument, d as Embedding } from '../types-DHHZztGO.js';
2
- import { T as Tool } from '../tool-6f9bK92X.js';
3
- import { V as VectorFilter, a as VectorSearchIndex, I as IndexStrategy, b as VectorSearchRequest, c as VectorSearchResult, d as VectorInspectRequest, e as VectorInspectPage, f as VectorSearchToolOptions } from '../types-C708DOhL.js';
4
- export { L as LshOptions, g as VectorInspectItem } from '../types-C708DOhL.js';
5
- import '../types-DzdJOf35.js';
2
+ import { T as Tool } from '../tool-DhT6kR0Z.js';
3
+ import { V as VectorFilter, a as VectorSearchIndex, I as IndexStrategy, b as VectorSearchRequest, c as VectorSearchResult, d as VectorInspectRequest, e as VectorInspectPage, f as VectorSearchToolOptions } from '../types-9TeQF79I.js';
4
+ export { L as LshOptions, g as VectorInspectItem } from '../types-9TeQF79I.js';
5
+ import '../types-BNq9tWdA.js';
6
6
 
7
7
  declare const vectorFilter: {
8
8
  eq(key: string, value: VectorMetadataValue): VectorFilter;
@@ -3,10 +3,10 @@ import {
3
3
  InMemoryVectorStore,
4
4
  createVectorSearchTool,
5
5
  vectorFilter
6
- } from "../chunk-I7TM7TKX.js";
7
- import "../chunk-WQKHFADH.js";
6
+ } from "../chunk-F3C5653H.js";
8
7
  import "../chunk-YBBD4HZ3.js";
9
8
  import "../chunk-OIMLU4SF.js";
9
+ import "../chunk-WQKHFADH.js";
10
10
  export {
11
11
  InMemoryVectorIndex,
12
12
  InMemoryVectorStore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvia/core",
3
- "version": "0.13.3",
3
+ "version": "0.13.5",
4
4
  "description": "Core runtime primitives for context-aware Anvia agents.",
5
5
  "author": "anvia",
6
6
  "maintainer": "Indra Zulfi",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/completion/json.ts","../src/completion/types.ts"],"sourcesContent":["import type { JsonValue } from \"./types\";\n\nexport function isJsonValue(value: unknown): value is JsonValue {\n return isJsonValueWithAncestors(value, new WeakSet<object>());\n}\n\nfunction isJsonValueWithAncestors(value: unknown, ancestors: WeakSet<object>): value is JsonValue {\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\") {\n return true;\n }\n if (typeof value === \"number\") {\n return Number.isFinite(value);\n }\n if (typeof value !== \"object\" || ancestors.has(value)) {\n return false;\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n if (!hasOnlyDenseArrayProperties(value)) {\n return false;\n }\n for (let index = 0; index < value.length; index += 1) {\n if (!isJsonValueWithAncestors(value[index], ancestors)) {\n return false;\n }\n }\n return true;\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n return false;\n }\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== \"string\") {\n return false;\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (\n descriptor === undefined ||\n !descriptor.enumerable ||\n !(\"value\" in descriptor) ||\n !isJsonValueWithAncestors(descriptor.value, ancestors)\n ) {\n return false;\n }\n }\n return true;\n } catch {\n return false;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction hasOnlyDenseArrayProperties(value: unknown[]): boolean {\n const keys = Reflect.ownKeys(value);\n if (keys.length !== value.length + 1 || keys.at(-1) !== \"length\") {\n return false;\n }\n for (let index = 0; index < value.length; index += 1) {\n const key = String(index);\n if (keys[index] !== key) {\n return false;\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !descriptor.enumerable || !(\"value\" in descriptor)) {\n return false;\n }\n }\n return true;\n}\n","import { isJsonValue } from \"./json\";\n\nexport type JsonPrimitive = string | number | boolean | null;\nexport type JsonValue = JsonPrimitive | JsonObject | JsonValue[];\nexport type JsonObject = { [key: string]: JsonValue | undefined };\n\nexport type Document = {\n id: string;\n text: string;\n additionalProps?: Record<string, string>;\n};\n\nexport type Text = {\n type: \"text\";\n text: string;\n signature?: string;\n};\n\nexport type ImageDetail = \"auto\" | \"low\" | \"high\";\n\nexport type ImageContent = {\n type: \"image\";\n source:\n | {\n type: \"url\";\n url: string;\n }\n | {\n type: \"base64\";\n data: string;\n mediaType: string;\n };\n detail?: ImageDetail;\n};\n\nexport type DocumentContent = {\n type: \"document\";\n source:\n | {\n type: \"url\";\n url: string;\n mediaType: string;\n filename?: string;\n }\n | {\n type: \"base64\";\n data: string;\n mediaType: string;\n filename?: string;\n }\n | {\n type: \"text\";\n text: string;\n mediaType?: string;\n filename?: string;\n };\n};\n\nexport type Reasoning = {\n type: \"reasoning\";\n text: string;\n id?: string;\n content?: ReasoningContent[];\n};\n\nexport type ReasoningContent =\n | {\n type: \"text\";\n text: string;\n signature?: string;\n }\n | {\n type: \"summary\";\n text: string;\n }\n | {\n type: \"encrypted\";\n data: string;\n }\n | {\n type: \"redacted\";\n data: string;\n };\n\nexport type ReasoningContentType = ReasoningContent[\"type\"];\n\nexport type ToolFunction = {\n name: string;\n arguments: JsonValue;\n};\n\nexport type ToolCall = {\n type: \"tool_call\";\n id: string;\n callId?: string;\n function: ToolFunction;\n signature?: string;\n additionalParams?: JsonValue;\n};\n\nexport type ToolResultContent =\n | { type: \"text\"; text: string }\n | { type: \"image\"; data: string; mediaType?: string };\n\nexport type ToolResult = {\n type: \"tool_result\";\n id: string;\n callId?: string;\n toolName?: string;\n content: ToolResultContent[];\n};\n\nexport type MessageOptions = {\n metadata?: JsonValue | undefined;\n};\n\nexport type AssistantMessageOptions = MessageOptions & {\n id?: string | undefined;\n};\n\nexport type ToolResultOptions = {\n callId?: string | undefined;\n toolName?: string | undefined;\n};\n\nexport type ToolResultMessageOptions = ToolResultOptions & MessageOptions;\n\nexport type UserContent = Text | ImageContent | DocumentContent;\nexport type AssistantContent = Text | ToolCall | Reasoning | ImageContent;\nexport type ToolContent = ToolResult;\n\nexport type SystemMessage = {\n role: \"system\";\n content: string;\n metadata?: JsonValue;\n};\n\nexport type UserMessage = {\n role: \"user\";\n content: UserContent[];\n metadata?: JsonValue;\n};\n\nexport type AssistantMessage = {\n role: \"assistant\";\n id?: string;\n content: AssistantContent[];\n metadata?: JsonValue;\n};\n\nexport type ToolMessage = {\n role: \"tool\";\n content: ToolContent[];\n metadata?: JsonValue;\n};\n\nexport type Message = SystemMessage | UserMessage | AssistantMessage | ToolMessage;\n\nexport const UserContent = {\n text(text: string): Text {\n return { type: \"text\", text };\n },\n imageUrl(url: string, options: { detail?: ImageDetail } = {}): ImageContent {\n const image: ImageContent = { type: \"image\", source: { type: \"url\", url } };\n if (options.detail !== undefined) {\n image.detail = options.detail;\n }\n return image;\n },\n imageBase64(\n data: string,\n mediaType: string,\n options: { detail?: ImageDetail } = {},\n ): ImageContent {\n const image: ImageContent = {\n type: \"image\",\n source: { type: \"base64\", data, mediaType },\n };\n if (options.detail !== undefined) {\n image.detail = options.detail;\n }\n return image;\n },\n documentUrl(\n url: string,\n mediaType: string,\n options: { filename?: string | undefined } = {},\n ): DocumentContent {\n return {\n type: \"document\",\n source:\n options.filename === undefined\n ? { type: \"url\", url, mediaType }\n : { type: \"url\", url, mediaType, filename: options.filename },\n };\n },\n documentBase64(\n data: string,\n mediaType: string,\n options: { filename?: string | undefined } = {},\n ): DocumentContent {\n return {\n type: \"document\",\n source:\n options.filename === undefined\n ? { type: \"base64\", data, mediaType }\n : { type: \"base64\", data, mediaType, filename: options.filename },\n };\n },\n documentText(text: string): Text {\n return { type: \"text\", text };\n },\n};\n\nexport const ToolContent = {\n toolResult(\n id: string,\n content: string | ToolResultContent[],\n callIdOrOptions?: string | ToolResultOptions,\n toolName?: string,\n ): ToolResult {\n const normalized =\n typeof content === \"string\" ? [{ type: \"text\" as const, text: content }] : content;\n const options = normalizeToolResultOptions(callIdOrOptions, toolName);\n const result: ToolResult = { type: \"tool_result\", id, content: normalized };\n if (options.callId !== undefined) {\n result.callId = options.callId;\n }\n if (options.toolName !== undefined) {\n result.toolName = options.toolName;\n }\n return result;\n },\n};\n\nfunction normalizeToolResultOptions(\n callIdOrOptions?: string | ToolResultOptions,\n toolName?: string,\n): ToolResultOptions {\n if (callIdOrOptions === undefined) {\n return toolName === undefined ? {} : { toolName };\n }\n if (typeof callIdOrOptions === \"string\") {\n return toolName === undefined\n ? { callId: callIdOrOptions }\n : { callId: callIdOrOptions, toolName };\n }\n return toolName === undefined ? callIdOrOptions : { ...callIdOrOptions, toolName };\n}\n\nexport function serializeToolResultOutput(output: unknown): string {\n if (typeof output === \"string\") {\n return output;\n }\n\n try {\n const serialized = JSON.stringify(output);\n return serialized === undefined ? String(output) : serialized;\n } catch {\n return String(output);\n }\n}\n\nexport function isToolResultContentArray(value: unknown): value is ToolResultContent[] {\n return (\n Array.isArray(value) &&\n value.length > 0 &&\n value.every((item) => {\n if (typeof item !== \"object\" || item === null || !(\"type\" in item)) {\n return false;\n }\n if (item.type === \"text\") {\n return \"text\" in item && typeof item.text === \"string\";\n }\n if (item.type === \"image\") {\n return (\n \"data\" in item &&\n typeof item.data === \"string\" &&\n (!(\"mediaType\" in item) ||\n item.mediaType === undefined ||\n typeof item.mediaType === \"string\")\n );\n }\n return false;\n })\n );\n}\n\nexport const AssistantContent = {\n text(text: string): Text {\n return { type: \"text\", text };\n },\n imageUrl(url: string, options: { detail?: ImageDetail } = {}): ImageContent {\n const image: ImageContent = { type: \"image\", source: { type: \"url\", url } };\n if (options.detail !== undefined) {\n image.detail = options.detail;\n }\n return image;\n },\n imageBase64(\n data: string,\n mediaType: string,\n options: { detail?: ImageDetail } = {},\n ): ImageContent {\n const image: ImageContent = {\n type: \"image\",\n source: { type: \"base64\", data, mediaType },\n };\n if (options.detail !== undefined) {\n image.detail = options.detail;\n }\n return image;\n },\n reasoning(text: string, id?: string): Reasoning {\n return id === undefined ? { type: \"reasoning\", text } : { type: \"reasoning\", text, id };\n },\n reasoningFromContent(content: ReasoningContent[], id?: string): Reasoning {\n const text = reasoningDisplayText(content);\n const reasoning: Reasoning = { type: \"reasoning\", text, content };\n return id === undefined ? reasoning : { ...reasoning, id };\n },\n reasoningSummary(text: string, id?: string): Reasoning {\n return AssistantContent.reasoningFromContent([{ type: \"summary\", text }], id);\n },\n reasoningEncrypted(data: string, id?: string): Reasoning {\n return AssistantContent.reasoningFromContent([{ type: \"encrypted\", data }], id);\n },\n reasoningRedacted(data: string, id?: string): Reasoning {\n return AssistantContent.reasoningFromContent([{ type: \"redacted\", data }], id);\n },\n toolCall(id: string, name: string, args: JsonValue, callId?: string): ToolCall {\n const base: ToolCall = {\n type: \"tool_call\",\n id,\n function: {\n name,\n arguments: args,\n },\n };\n return callId === undefined ? base : { ...base, callId };\n },\n};\n\nexport function reasoningDisplayText(reasoning: Reasoning | ReasoningContent[]): string {\n const content = Array.isArray(reasoning) ? reasoning : reasoning.content;\n if (content === undefined) {\n return Array.isArray(reasoning) ? \"\" : reasoning.text;\n }\n return content\n .flatMap((item) => {\n if (item.type === \"text\" || item.type === \"summary\") {\n return [item.text];\n }\n return [];\n })\n .join(\"\");\n}\n\nexport const Message = {\n system(content: string, options: MessageOptions = {}): Message {\n return { role: \"system\", content, ...messageMetadata(options) };\n },\n user(content: string | UserContent[], options: MessageOptions = {}): Message {\n return {\n role: \"user\",\n content: typeof content === \"string\" ? [UserContent.text(content)] : content,\n ...messageMetadata(options),\n };\n },\n assistant(\n content: string | AssistantContent[],\n idOrOptions?: string | AssistantMessageOptions,\n ): Message {\n const normalized = typeof content === \"string\" ? [AssistantContent.text(content)] : content;\n const options = typeof idOrOptions === \"string\" ? { id: idOrOptions } : (idOrOptions ?? {});\n const metadata = messageMetadata(options).metadata;\n const message: AssistantMessage =\n options.id === undefined\n ? { role: \"assistant\", content: normalized }\n : { role: \"assistant\", id: options.id, content: normalized };\n if (metadata !== undefined) {\n message.metadata = metadata;\n }\n return message;\n },\n tool(content: ToolContent | ToolContent[], options: MessageOptions = {}): Message {\n return {\n role: \"tool\",\n content: Array.isArray(content) ? content : [content],\n ...messageMetadata(options),\n };\n },\n toolResult(id: string, output: unknown, options: ToolResultMessageOptions = {}): Message {\n const content = isToolResultContentArray(output) ? output : serializeToolResultOutput(output);\n return Message.tool(\n ToolContent.toolResult(id, content, {\n callId: options.callId,\n toolName: options.toolName,\n }),\n { metadata: options.metadata },\n );\n },\n};\n\nfunction messageMetadata(options: MessageOptions): { metadata?: JsonValue } {\n if (options.metadata === undefined) {\n return {};\n }\n if (!isJsonValue(options.metadata)) {\n throw new TypeError(\"Message metadata must be a strict JSON value.\");\n }\n return { metadata: options.metadata };\n}\n\nexport type ToolChoice =\n | \"auto\"\n | \"required\"\n | \"none\"\n | {\n type: \"function\";\n name: string;\n };\n\nexport type ToolDefinition = {\n name: string;\n description: string;\n parameters: JsonObject;\n};\n\nexport type Usage = {\n inputTokens: number;\n outputTokens: number;\n totalTokens: number;\n cachedInputTokens: number;\n cacheCreationInputTokens: number;\n};\n\nexport const Usage = {\n empty(): Usage {\n return {\n inputTokens: 0,\n outputTokens: 0,\n totalTokens: 0,\n cachedInputTokens: 0,\n cacheCreationInputTokens: 0,\n };\n },\n add(left: Usage, right: Usage): Usage {\n return {\n inputTokens: left.inputTokens + right.inputTokens,\n outputTokens: left.outputTokens + right.outputTokens,\n totalTokens: left.totalTokens + right.totalTokens,\n cachedInputTokens: left.cachedInputTokens + right.cachedInputTokens,\n cacheCreationInputTokens: left.cacheCreationInputTokens + right.cacheCreationInputTokens,\n };\n },\n};\n\nexport type CompletionRequest<ModelName extends string = string> = {\n model?: ModelName;\n instructions?: string;\n chatHistory: Message[];\n documents: Document[];\n tools: ToolDefinition[];\n temperature?: number;\n maxTokens?: number;\n toolChoice?: ToolChoice;\n additionalParams?: JsonValue;\n outputSchema?: JsonObject;\n};\n\nexport type CompletionResponse<RawResponse = unknown> = {\n choice: AssistantContent[];\n usage: Usage;\n rawResponse: RawResponse;\n messageId?: string;\n};\n\nexport type CompletionModelCapabilities = {\n streaming: boolean;\n tools: boolean;\n toolChoice: boolean;\n imageInput: boolean;\n documentInput: boolean;\n outputSchema: boolean;\n reasoning: boolean;\n};\n\nexport interface CompletionModel<RawResponse = unknown, ModelName extends string = string> {\n readonly provider: string;\n readonly defaultModel: ModelName;\n readonly capabilities: CompletionModelCapabilities;\n traceRequest?(\n request: CompletionRequest<ModelName>,\n options?: { stream?: boolean | undefined },\n ): JsonObject | undefined;\n completion(request: CompletionRequest<ModelName>): Promise<CompletionResponse<RawResponse>>;\n}\n\nexport type CompletionStreamEvent<RawResponse = unknown> =\n | {\n type: \"text_delta\";\n delta: string;\n }\n | {\n type: \"reasoning_delta\";\n delta: string;\n id?: string;\n contentType?: ReasoningContentType;\n signature?: string;\n }\n | {\n type: \"tool_call_delta\";\n id: string;\n callId?: string;\n name?: string;\n argumentsDelta?: string;\n signature?: string;\n }\n | {\n type: \"tool_call\";\n toolCall: ToolCall;\n }\n | {\n type: \"message_id\";\n id: string;\n }\n | {\n type: \"final\";\n response: CompletionResponse<RawResponse>;\n }\n | {\n type: \"error\";\n error: unknown;\n };\n\nexport interface StreamingCompletionModel<RawResponse = unknown, ModelName extends string = string>\n extends CompletionModel<RawResponse, ModelName> {\n streamCompletion(\n request: CompletionRequest<ModelName>,\n ): AsyncIterable<CompletionStreamEvent<RawResponse>>;\n}\n\nexport class CompletionCapabilityError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CompletionCapabilityError\";\n }\n}\n\nexport function assertCompletionRequestSupported(\n model: CompletionModel,\n request: CompletionRequest,\n options: { streaming?: boolean | undefined } = {},\n): void {\n const modelLabel = `${model.provider}:${request.model ?? model.defaultModel}`;\n const capabilities = model.capabilities;\n\n if (options.streaming === true && !capabilities.streaming) {\n throw new CompletionCapabilityError(`${modelLabel} does not support streaming completions.`);\n }\n\n if (request.tools.length > 0 && !capabilities.tools) {\n throw new CompletionCapabilityError(`${modelLabel} does not support tool definitions.`);\n }\n\n if (request.toolChoice !== undefined && !capabilities.toolChoice) {\n throw new CompletionCapabilityError(`${modelLabel} does not support tool choice.`);\n }\n\n if (request.outputSchema !== undefined && !capabilities.outputSchema) {\n throw new CompletionCapabilityError(`${modelLabel} does not support output schemas.`);\n }\n\n if (!capabilities.imageInput && requestHasImageInput(request)) {\n throw new CompletionCapabilityError(`${modelLabel} does not support image input.`);\n }\n\n if (!capabilities.documentInput && requestHasFileDocumentInput(request)) {\n throw new CompletionCapabilityError(`${modelLabel} does not support document file input.`);\n }\n}\n\nexport function textFromAssistantContent(content: AssistantContent[]): string {\n return content.flatMap((item) => (item.type === \"text\" ? [item.text] : [])).join(\"\\n\");\n}\n\nfunction requestHasImageInput(request: CompletionRequest): boolean {\n return request.chatHistory.some((message) =>\n message.role === \"system\" ? false : message.content.some((content) => content.type === \"image\"),\n );\n}\n\nfunction requestHasFileDocumentInput(request: CompletionRequest): boolean {\n return request.chatHistory.some((message) =>\n message.role === \"user\"\n ? message.content.some(\n (content) => content.type === \"document\" && content.source.type !== \"text\",\n )\n : false,\n );\n}\n"],"mappings":";AAEO,SAAS,YAAY,OAAoC;AAC9D,SAAO,yBAAyB,OAAO,oBAAI,QAAgB,CAAC;AAC9D;AAEA,SAAS,yBAAyB,OAAgB,WAAgD;AAChG,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW;AAC7E,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,OAAO,SAAS,KAAK;AAAA,EAC9B;AACA,MAAI,OAAO,UAAU,YAAY,UAAU,IAAI,KAAK,GAAG;AACrD,WAAO;AAAA,EACT;AAEA,YAAU,IAAI,KAAK;AACnB,MAAI;AACF,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,UAAI,CAAC,4BAA4B,KAAK,GAAG;AACvC,eAAO;AAAA,MACT;AACA,eAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpD,YAAI,CAAC,yBAAyB,MAAM,KAAK,GAAG,SAAS,GAAG;AACtD,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAEA,UAAM,YAAY,OAAO,eAAe,KAAK;AAC7C,QAAI,cAAc,OAAO,aAAa,cAAc,MAAM;AACxD,aA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