@anvia/core 0.26.0 → 1.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +303 -94
  2. package/dist/agent/index.d.ts +36 -70
  3. package/dist/agent/index.js +25 -18
  4. package/dist/agent-yBG8e9Jj.d.ts +153 -0
  5. package/dist/chunk-4WI3VGZK.js +127 -0
  6. package/dist/chunk-4WI3VGZK.js.map +1 -0
  7. package/dist/chunk-77AIYARB.js +654 -0
  8. package/dist/chunk-77AIYARB.js.map +1 -0
  9. package/dist/chunk-AI5JMUW7.js +45 -0
  10. package/dist/chunk-AI5JMUW7.js.map +1 -0
  11. package/dist/chunk-BEYBU7VJ.js +53 -0
  12. package/dist/chunk-BEYBU7VJ.js.map +1 -0
  13. package/dist/chunk-CWM7B2OO.js +315 -0
  14. package/dist/chunk-CWM7B2OO.js.map +1 -0
  15. package/dist/chunk-D37WMSP6.js +131 -0
  16. package/dist/chunk-D37WMSP6.js.map +1 -0
  17. package/dist/chunk-DBSCKTUL.js +3793 -0
  18. package/dist/chunk-DBSCKTUL.js.map +1 -0
  19. package/dist/chunk-EINTGEGY.js +629 -0
  20. package/dist/chunk-EINTGEGY.js.map +1 -0
  21. package/dist/chunk-FMHLROPQ.js +351 -0
  22. package/dist/chunk-FMHLROPQ.js.map +1 -0
  23. package/dist/chunk-FN7HLLAZ.js +211 -0
  24. package/dist/chunk-FN7HLLAZ.js.map +1 -0
  25. package/dist/chunk-GKDERULJ.js +50 -0
  26. package/dist/chunk-GKDERULJ.js.map +1 -0
  27. package/dist/{chunk-CWUJUSOS.js → chunk-KIDGIJM7.js} +26 -5
  28. package/dist/chunk-KIDGIJM7.js.map +1 -0
  29. package/dist/chunk-KR3RCCHJ.js +500 -0
  30. package/dist/chunk-KR3RCCHJ.js.map +1 -0
  31. package/dist/chunk-MGNTXGTX.js +37 -0
  32. package/dist/chunk-MGNTXGTX.js.map +1 -0
  33. package/dist/{chunk-MRQLEK2B.js → chunk-OJH6HWHX.js} +63 -51
  34. package/dist/chunk-OJH6HWHX.js.map +1 -0
  35. package/dist/chunk-QOUPWOGW.js +29 -0
  36. package/dist/chunk-QOUPWOGW.js.map +1 -0
  37. package/dist/chunk-TIZYTPJO.js +208 -0
  38. package/dist/chunk-TIZYTPJO.js.map +1 -0
  39. package/dist/{chunk-NCPN4SJR.js → chunk-XKYYBABH.js} +13 -13
  40. package/dist/chunk-XKYYBABH.js.map +1 -0
  41. package/dist/client-B8DT1vUG.d.ts +83 -0
  42. package/dist/completion/index.d.ts +6 -36
  43. package/dist/completion/index.js +25 -29
  44. package/dist/dynamic-tools-KwEGRbHp.d.ts +45 -0
  45. package/dist/embeddings/index.d.ts +11 -9
  46. package/dist/embeddings/index.js +2 -4
  47. package/dist/evals/index.d.ts +47 -20
  48. package/dist/evals/index.js +104 -65
  49. package/dist/evals/index.js.map +1 -1
  50. package/dist/extractor/index.d.ts +27 -42
  51. package/dist/extractor/index.js +7 -22
  52. package/dist/guardrails/index.d.ts +3 -2
  53. package/dist/guardrails/index.js +1 -1
  54. package/dist/image-generation/index.d.ts +23 -23
  55. package/dist/image-generation/index.js +5 -39
  56. package/dist/image-generation/index.js.map +1 -1
  57. package/dist/index.d.ts +25 -20
  58. package/dist/index.js +60 -63
  59. package/dist/internal/agent.d.ts +163 -9
  60. package/dist/internal/agent.js +25 -18
  61. package/dist/loaders/index.d.ts +6 -10
  62. package/dist/loaders/index.js.map +1 -1
  63. package/dist/mcp/index.d.ts +19 -13
  64. package/dist/mcp/index.js +13 -348
  65. package/dist/mcp/index.js.map +1 -1
  66. package/dist/memory/index.d.ts +20 -6
  67. package/dist/memory/index.js +9 -10
  68. package/dist/message-schema-Cn7ezRfJ.d.ts +52 -0
  69. package/dist/middleware-C7PdmKF7.d.ts +56 -0
  70. package/dist/model-call-options-CZkSw_xN.d.ts +6 -0
  71. package/dist/model-listing/index.d.ts +3 -1
  72. package/dist/observability/index.d.ts +20 -3
  73. package/dist/observability/index.js +8 -5
  74. package/dist/observability/index.js.map +1 -1
  75. package/dist/pipeline/index.d.ts +114 -72
  76. package/dist/pipeline/index.js +478 -286
  77. package/dist/pipeline/index.js.map +1 -1
  78. package/dist/retry-CjvSlKGW.d.ts +16 -0
  79. package/dist/skills/index.d.ts +5 -4
  80. package/dist/skills/index.js +7 -8
  81. package/dist/speech-generation/index.d.ts +37 -0
  82. package/dist/speech-generation/index.js +8 -0
  83. package/dist/streaming/index.js +37 -3
  84. package/dist/streaming/index.js.map +1 -1
  85. package/dist/{think-tool-DfCMuO8e.d.ts → think-tool-6H2QNQzQ.d.ts} +5 -5
  86. package/dist/tool/index.d.ts +10 -6
  87. package/dist/tool/index.js +15 -21
  88. package/dist/tool--Mz4v1eL.d.ts +57 -0
  89. package/dist/transcription/index.d.ts +29 -22
  90. package/dist/transcription/index.js +5 -57
  91. package/dist/transcription/index.js.map +1 -1
  92. package/dist/type-utils-CtHVDRn_.d.ts +6 -0
  93. package/dist/types-3x3mOLHU.d.ts +379 -0
  94. package/dist/types-BVzM4RsC.d.ts +155 -0
  95. package/dist/types-CQ_ioXWK.d.ts +319 -0
  96. package/dist/types-Cr4uiYo5.d.ts +99 -0
  97. package/dist/{types-04LqWrmy.d.ts → types-DiJqJejp.d.ts} +1 -1
  98. package/dist/types-Dld1TpWj.d.ts +130 -0
  99. package/dist/vector-store/index.d.ts +33 -34
  100. package/dist/vector-store/index.js +6 -6
  101. package/package.json +6 -18
  102. package/dist/agent-x3YTyv5i.d.ts +0 -222
  103. package/dist/audio-generation/index.d.ts +0 -33
  104. package/dist/audio-generation/index.js +0 -42
  105. package/dist/audio-generation/index.js.map +0 -1
  106. package/dist/chunk-2ODTMRHP.js +0 -54
  107. package/dist/chunk-2ODTMRHP.js.map +0 -1
  108. package/dist/chunk-ADH7NNCS.js +0 -512
  109. package/dist/chunk-ADH7NNCS.js.map +0 -1
  110. package/dist/chunk-BALBBVI3.js +0 -2732
  111. package/dist/chunk-BALBBVI3.js.map +0 -1
  112. package/dist/chunk-CWUJUSOS.js.map +0 -1
  113. package/dist/chunk-DALYP4PX.js +0 -225
  114. package/dist/chunk-DALYP4PX.js.map +0 -1
  115. package/dist/chunk-HYUYZEAJ.js +0 -223
  116. package/dist/chunk-HYUYZEAJ.js.map +0 -1
  117. package/dist/chunk-I6XOQ4LK.js +0 -466
  118. package/dist/chunk-I6XOQ4LK.js.map +0 -1
  119. package/dist/chunk-JI5YZWNT.js +0 -220
  120. package/dist/chunk-JI5YZWNT.js.map +0 -1
  121. package/dist/chunk-MC3CCKEB.js +0 -221
  122. package/dist/chunk-MC3CCKEB.js.map +0 -1
  123. package/dist/chunk-MELYDKWQ.js +0 -337
  124. package/dist/chunk-MELYDKWQ.js.map +0 -1
  125. package/dist/chunk-MNWK2USR.js +0 -243
  126. package/dist/chunk-MNWK2USR.js.map +0 -1
  127. package/dist/chunk-MRQLEK2B.js.map +0 -1
  128. package/dist/chunk-NCPN4SJR.js.map +0 -1
  129. package/dist/chunk-OIMLU4SF.js +0 -20
  130. package/dist/chunk-OIMLU4SF.js.map +0 -1
  131. package/dist/chunk-Q25IWLBT.js +0 -138
  132. package/dist/chunk-Q25IWLBT.js.map +0 -1
  133. package/dist/chunk-UQX6EXWG.js +0 -33
  134. package/dist/chunk-UQX6EXWG.js.map +0 -1
  135. package/dist/chunk-WQKHFADH.js +0 -12
  136. package/dist/chunk-WQKHFADH.js.map +0 -1
  137. package/dist/chunk-XUUY2L2D.js +0 -42
  138. package/dist/chunk-XUUY2L2D.js.map +0 -1
  139. package/dist/chunk-XWUC7CIT.js +0 -1
  140. package/dist/chunk-XWUC7CIT.js.map +0 -1
  141. package/dist/chunk-YLMDBQO4.js +0 -141
  142. package/dist/chunk-YLMDBQO4.js.map +0 -1
  143. package/dist/errors-2moLDuuN.d.ts +0 -17
  144. package/dist/hooks/index.d.ts +0 -12
  145. package/dist/hooks/index.js +0 -17
  146. package/dist/index-BxSbmOMr.d.ts +0 -257
  147. package/dist/json-BVPssigK.d.ts +0 -39
  148. package/dist/middleware-Dp3d_pxi.d.ts +0 -90
  149. package/dist/request/index.d.ts +0 -28
  150. package/dist/request/index.js +0 -25
  151. package/dist/request/index.js.map +0 -1
  152. package/dist/tool-Cohdv5GC.d.ts +0 -65
  153. package/dist/types-BCTRUGex.d.ts +0 -47
  154. package/dist/types-BrLbKnEz.d.ts +0 -119
  155. package/dist/types-D9JpeAPF.d.ts +0 -114
  156. package/dist/types-G12i56s2.d.ts +0 -354
  157. package/dist/types-JJCxRnaZ.d.ts +0 -70
  158. package/dist/types-O-abTIin.d.ts +0 -79
  159. package/dist/ui/index.d.ts +0 -107
  160. package/dist/ui/index.js +0 -10
  161. package/dist/ui/index.js.map +0 -1
  162. /package/dist/{hooks → speech-generation}/index.js.map +0 -0
@@ -1,114 +0,0 @@
1
- import { M as Message, U as Usage, g as CompletionResponse, u as ToolResultContent } from './types-G12i56s2.js';
2
-
3
- type HookAction = {
4
- type: "continue";
5
- } | {
6
- type: "terminate";
7
- reason: string;
8
- };
9
- type ToolApprovalRequestOptions = {
10
- reason?: string;
11
- rejectMessage?: string;
12
- };
13
- type ToolCallHookAction = {
14
- type: "continue";
15
- } | {
16
- type: "skip";
17
- reason: string;
18
- } | {
19
- type: "terminate";
20
- reason: string;
21
- } | ({
22
- type: "approval_request";
23
- } & ToolApprovalRequestOptions);
24
- type RunControl = {
25
- continue(): HookAction;
26
- cancel(reason: string): HookAction;
27
- };
28
- type ToolCallControl = {
29
- run(): ToolCallHookAction;
30
- skip(reason: string): ToolCallHookAction;
31
- cancel(reason: string): ToolCallHookAction;
32
- requestApproval(options?: ToolApprovalRequestOptions): ToolCallHookAction;
33
- };
34
- type HookResult = HookAction | undefined;
35
- type ToolCallHookResult = ToolCallHookAction | undefined;
36
- type HookCallback<Args> = (args: Args) => HookAction | Promise<HookAction | undefined> | Promise<void> | void;
37
- type ToolCallHookCallback<Args> = (args: Args) => ToolCallHookAction | Promise<ToolCallHookAction | undefined> | Promise<void> | void;
38
- type CompletionCallHookArgs = {
39
- prompt: Message;
40
- history: Message[];
41
- run: RunControl;
42
- };
43
- type RunStartHookArgs = {
44
- prompt: Message;
45
- history: Message[];
46
- maxTurns: number;
47
- run: RunControl;
48
- };
49
- type RunEndHookArgs = {
50
- output: string;
51
- usage: Usage;
52
- messages: Message[];
53
- run: RunControl;
54
- };
55
- type RunErrorHookArgs = {
56
- error: unknown;
57
- usage: Usage;
58
- messages: Message[];
59
- run: RunControl;
60
- };
61
- type TurnStartHookArgs = {
62
- turn: number;
63
- prompt: Message;
64
- history: Message[];
65
- run: RunControl;
66
- };
67
- type TurnEndHookArgs<RawResponse = unknown> = {
68
- turn: number;
69
- response: CompletionResponse<RawResponse>;
70
- run: RunControl;
71
- };
72
- type CompletionResponseHookArgs<RawResponse = unknown> = {
73
- prompt: Message;
74
- response: CompletionResponse<RawResponse>;
75
- run: RunControl;
76
- };
77
- type CompletionErrorHookArgs = {
78
- prompt: Message;
79
- error: unknown;
80
- run: RunControl;
81
- };
82
- type ToolHookArgs = {
83
- toolName: string;
84
- toolCallId?: string;
85
- internalCallId: string;
86
- args: string;
87
- };
88
- type ToolCallHookArgs = ToolHookArgs & {
89
- tool: ToolCallControl;
90
- };
91
- type ToolResultHookArgs = ToolHookArgs & {
92
- result: string;
93
- structuredResult?: ToolResultContent[] | undefined;
94
- run: RunControl;
95
- };
96
- type ToolErrorHookArgs = ToolHookArgs & {
97
- error: unknown;
98
- run: RunControl;
99
- };
100
- interface PromptHook<RawResponse = unknown> {
101
- onRunStart?: HookCallback<RunStartHookArgs>;
102
- onRunEnd?: HookCallback<RunEndHookArgs>;
103
- onRunError?: HookCallback<RunErrorHookArgs>;
104
- onTurnStart?: HookCallback<TurnStartHookArgs>;
105
- onTurnEnd?: HookCallback<TurnEndHookArgs<RawResponse>>;
106
- onCompletionCall?: HookCallback<CompletionCallHookArgs>;
107
- onCompletionResponse?: HookCallback<CompletionResponseHookArgs<RawResponse>>;
108
- onCompletionError?: HookCallback<CompletionErrorHookArgs>;
109
- onToolCall?: ToolCallHookCallback<ToolCallHookArgs>;
110
- onToolResult?: HookCallback<ToolResultHookArgs>;
111
- onToolError?: HookCallback<ToolErrorHookArgs>;
112
- }
113
-
114
- export type { CompletionCallHookArgs as C, HookAction as H, PromptHook as P, RunControl as R, ToolApprovalRequestOptions as T, ToolCallHookAction as a, ToolCallControl as b, CompletionErrorHookArgs as c, CompletionResponseHookArgs as d, HookResult as e, RunEndHookArgs as f, RunErrorHookArgs as g, RunStartHookArgs as h, ToolCallHookArgs as i, ToolCallHookResult as j, ToolErrorHookArgs as k, ToolHookArgs as l, ToolResultHookArgs as m, TurnEndHookArgs as n, TurnStartHookArgs as o };
@@ -1,354 +0,0 @@
1
- type JsonPrimitive = string | number | boolean | null;
2
- type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
3
- type JsonObject = {
4
- [key: string]: JsonValue | undefined;
5
- };
6
- type Document = {
7
- id: string;
8
- text: string;
9
- additionalProps?: Record<string, string>;
10
- };
11
- type Text = {
12
- type: "text";
13
- text: string;
14
- signature?: string;
15
- };
16
- type ImageDetail = "auto" | "low" | "high";
17
- type ImageContent = {
18
- type: "image";
19
- source: {
20
- type: "url";
21
- url: string;
22
- } | {
23
- type: "base64";
24
- data: string;
25
- mediaType: string;
26
- };
27
- detail?: ImageDetail;
28
- };
29
- type DocumentContent = {
30
- type: "document";
31
- source: {
32
- type: "url";
33
- url: string;
34
- mediaType: string;
35
- filename?: string;
36
- } | {
37
- type: "base64";
38
- data: string;
39
- mediaType: string;
40
- filename?: string;
41
- } | {
42
- type: "text";
43
- text: string;
44
- mediaType?: string;
45
- filename?: string;
46
- };
47
- };
48
- type Reasoning = {
49
- type: "reasoning";
50
- text: string;
51
- id?: string;
52
- content?: ReasoningContent[];
53
- };
54
- type ReasoningContent = {
55
- type: "text";
56
- text: string;
57
- signature?: string;
58
- } | {
59
- type: "summary";
60
- text: string;
61
- } | {
62
- type: "encrypted";
63
- data: string;
64
- } | {
65
- type: "redacted";
66
- data: string;
67
- };
68
- type ReasoningContentType = ReasoningContent["type"];
69
- type ToolFunction = {
70
- name: string;
71
- arguments: JsonValue;
72
- };
73
- type ToolCall = {
74
- type: "tool_call";
75
- id: string;
76
- callId?: string;
77
- function: ToolFunction;
78
- signature?: string;
79
- additionalParams?: JsonValue;
80
- };
81
- type ToolResultContent = {
82
- type: "text";
83
- text: string;
84
- } | {
85
- type: "image";
86
- data: string;
87
- mediaType?: string;
88
- };
89
- type ToolResult = {
90
- type: "tool_result";
91
- id: string;
92
- callId?: string;
93
- toolName?: string;
94
- content: ToolResultContent[];
95
- };
96
- type MessageOptions = {
97
- metadata?: JsonValue | undefined;
98
- };
99
- type AssistantMessageOptions = MessageOptions & {
100
- id?: string | undefined;
101
- };
102
- type ToolResultOptions = {
103
- callId?: string | undefined;
104
- toolName?: string | undefined;
105
- };
106
- type ToolResultMessageOptions = ToolResultOptions & MessageOptions;
107
- type SystemMessage = {
108
- role: "system";
109
- content: string;
110
- metadata?: JsonValue;
111
- };
112
- type UserMessage = {
113
- role: "user";
114
- content: UserContent[];
115
- metadata?: JsonValue;
116
- };
117
- type AssistantMessage = {
118
- role: "assistant";
119
- id?: string;
120
- content: AssistantContent[];
121
- metadata?: JsonValue;
122
- };
123
- type ToolMessage = {
124
- role: "tool";
125
- content: ToolContent[];
126
- metadata?: JsonValue;
127
- };
128
- type UserContent = Text | ImageContent | DocumentContent;
129
- declare const UserContent: {
130
- text(text: string): Text;
131
- imageUrl(url: string, options?: {
132
- detail?: ImageDetail;
133
- }): ImageContent;
134
- imageBase64(data: string, mediaType: string, options?: {
135
- detail?: ImageDetail;
136
- }): ImageContent;
137
- documentUrl(url: string, mediaType: string, options?: {
138
- filename?: string | undefined;
139
- }): DocumentContent;
140
- documentBase64(data: string, mediaType: string, options?: {
141
- filename?: string | undefined;
142
- }): DocumentContent;
143
- documentText(text: string): Text;
144
- };
145
- type ToolContent = ToolResult;
146
- declare const ToolContent: {
147
- toolResult(id: string, content: string | ToolResultContent[], callIdOrOptions?: string | ToolResultOptions, toolName?: string): ToolResult;
148
- };
149
- declare function serializeToolResultOutput(output: unknown): string;
150
- declare function isToolResultContentArray(value: unknown): value is ToolResultContent[];
151
- type AssistantContent = Text | ToolCall | Reasoning | ImageContent;
152
- declare const AssistantContent: {
153
- text(text: string): Text;
154
- imageUrl(url: string, options?: {
155
- detail?: ImageDetail;
156
- }): ImageContent;
157
- imageBase64(data: string, mediaType: string, options?: {
158
- detail?: ImageDetail;
159
- }): ImageContent;
160
- reasoning(text: string, id?: string): Reasoning;
161
- reasoningFromContent(content: ReasoningContent[], id?: string): Reasoning;
162
- reasoningSummary(text: string, id?: string): Reasoning;
163
- reasoningEncrypted(data: string, id?: string): Reasoning;
164
- reasoningRedacted(data: string, id?: string): Reasoning;
165
- toolCall(id: string, name: string, args: JsonValue, callId?: string): ToolCall;
166
- };
167
- declare function reasoningDisplayText(reasoning: Reasoning | ReasoningContent[]): string;
168
- type Message = SystemMessage | UserMessage | AssistantMessage | ToolMessage;
169
- declare const Message: {
170
- system(content: string, options?: MessageOptions): Message;
171
- user(content: string | UserContent[], options?: MessageOptions): Message;
172
- assistant(content: string | AssistantContent[], idOrOptions?: string | AssistantMessageOptions): Message;
173
- tool(content: ToolContent | ToolContent[], options?: MessageOptions): Message;
174
- toolResult(id: string, output: unknown, options?: ToolResultMessageOptions): Message;
175
- };
176
- type ToolChoice = "auto" | "required" | "none" | {
177
- type: "function";
178
- name: string;
179
- };
180
- type ToolDefinition = {
181
- name: string;
182
- description: string;
183
- parameters: JsonObject;
184
- };
185
- /**
186
- * A tool executed by the model provider rather than by Anvia's local tool runtime.
187
- *
188
- * Provider packages expose typed factories for these values. Application code can
189
- * pass them through the same high-level `tools` APIs used for local tools.
190
- */
191
- type ProviderTool = {
192
- kind: "provider";
193
- provider: string;
194
- name: string;
195
- configuration?: JsonObject;
196
- };
197
- type CompletionTool = ToolDefinition | ProviderTool;
198
- declare function isProviderTool(value: unknown): value is ProviderTool;
199
- type CompletionSource = {
200
- type: "url";
201
- url: string;
202
- title?: string;
203
- id?: string;
204
- startIndex?: number;
205
- endIndex?: number;
206
- };
207
- type ProviderToolCall = {
208
- id: string;
209
- name: string;
210
- status?: string;
211
- details?: JsonObject;
212
- };
213
- /**
214
- * Provider-normalized, mutually exclusive usage buckets.
215
- *
216
- * Every token should appear in exactly one non-total bucket. `total` is the
217
- * only aggregate key and should equal the sum of the other buckets.
218
- */
219
- type UsageDetails = Record<string, number>;
220
- type ModelContextLimits = {
221
- contextWindow: number;
222
- maxInputTokens?: number;
223
- maxOutputTokens?: number;
224
- };
225
- type CompletionModelInfo<ModelName extends string = string> = {
226
- id: ModelName;
227
- context: ModelContextLimits;
228
- };
229
- type CompletionModelMetadataOptions = {
230
- modelOverrides?: Readonly<Record<string, ModelContextLimits>>;
231
- };
232
- type ContextUsage<ModelName extends string = string> = {
233
- model: CompletionModelInfo<ModelName>;
234
- usedTokens: number;
235
- remainingTokens: number;
236
- usedPercent: number;
237
- remainingPercent: number;
238
- };
239
- declare function calculateContextUsage<ModelName extends string>(usage: Usage, model: CompletionModelInfo<ModelName> | undefined): ContextUsage<ModelName> | undefined;
240
- declare function withContextUsage<RawResponse, ModelName extends string>(response: CompletionResponse<RawResponse>, model: CompletionModelInfo<ModelName> | undefined): CompletionResponse<RawResponse>;
241
- declare function resolveCompletionModelInfo<ModelName extends string>(model: ModelName, catalog: Readonly<Record<string, ModelContextLimits>>, overrides?: Readonly<Record<string, ModelContextLimits>>): CompletionModelInfo<ModelName> | undefined;
242
- type AssistantGenerationMetadata = {
243
- provider: string;
244
- model: string;
245
- usage: Usage;
246
- contextUsage?: ContextUsage;
247
- sources?: CompletionSource[];
248
- providerToolCalls?: ProviderToolCall[];
249
- };
250
- type Usage = {
251
- inputTokens: number;
252
- outputTokens: number;
253
- totalTokens: number;
254
- cachedInputTokens: number;
255
- cacheCreationInputTokens: number;
256
- details?: UsageDetails;
257
- };
258
- declare const Usage: {
259
- empty(): Usage;
260
- add(left: Usage, right: Usage): Usage;
261
- };
262
- declare function getAssistantGenerationMetadata(message: Message): AssistantGenerationMetadata | undefined;
263
- type CompletionRequest<ModelName extends string = string> = {
264
- model?: ModelName;
265
- instructions?: string;
266
- chatHistory: Message[];
267
- documents: Document[];
268
- tools: ToolDefinition[];
269
- providerTools?: ProviderTool[];
270
- temperature?: number;
271
- maxTokens?: number;
272
- toolChoice?: ToolChoice;
273
- additionalParams?: JsonValue;
274
- outputSchema?: JsonObject;
275
- };
276
- type CompletionResponse<RawResponse = unknown> = {
277
- choice: AssistantContent[];
278
- usage: Usage;
279
- contextUsage?: ContextUsage;
280
- rawResponse: RawResponse;
281
- messageId?: string;
282
- sources?: CompletionSource[];
283
- providerToolCalls?: ProviderToolCall[];
284
- };
285
- type CompletionModelCapabilities = {
286
- streaming: boolean;
287
- tools: boolean;
288
- toolChoice: boolean;
289
- imageInput: boolean;
290
- documentInput: boolean;
291
- outputSchema: boolean;
292
- reasoning: boolean;
293
- providerTools?: boolean;
294
- };
295
- interface CompletionModel<RawResponse = unknown, ModelName extends string = string> {
296
- readonly provider: string;
297
- readonly defaultModel: ModelName;
298
- readonly capabilities: CompletionModelCapabilities;
299
- getModelInfo?(model?: ModelName): CompletionModelInfo<ModelName> | undefined;
300
- traceRequest?(request: CompletionRequest<ModelName>, options?: {
301
- stream?: boolean | undefined;
302
- }): JsonObject | undefined;
303
- completion(request: CompletionRequest<ModelName>): Promise<CompletionResponse<RawResponse>>;
304
- }
305
- type ToolCallArgumentsMode = "append" | "replace";
306
- type CompletionStreamEvent<RawResponse = unknown> = {
307
- type: "text_delta";
308
- delta: string;
309
- } | {
310
- type: "reasoning_delta";
311
- delta: string;
312
- id?: string;
313
- contentType?: ReasoningContentType;
314
- signature?: string;
315
- } | {
316
- type: "tool_call_delta";
317
- id: string;
318
- callId?: string;
319
- name?: string;
320
- argumentsDelta?: string;
321
- argumentsMode?: ToolCallArgumentsMode;
322
- signature?: string;
323
- } | {
324
- type: "tool_call";
325
- toolCall: ToolCall;
326
- } | {
327
- type: "source";
328
- source: CompletionSource;
329
- } | {
330
- type: "provider_tool_call";
331
- toolCall: ProviderToolCall;
332
- } | {
333
- type: "message_id";
334
- id: string;
335
- } | {
336
- type: "final";
337
- response: CompletionResponse<RawResponse>;
338
- } | {
339
- type: "error";
340
- error: unknown;
341
- usage?: Usage;
342
- };
343
- interface StreamingCompletionModel<RawResponse = unknown, ModelName extends string = string> extends CompletionModel<RawResponse, ModelName> {
344
- streamCompletion(request: CompletionRequest<ModelName>): AsyncIterable<CompletionStreamEvent<RawResponse>>;
345
- }
346
- declare class CompletionCapabilityError extends Error {
347
- constructor(message: string);
348
- }
349
- declare function assertCompletionRequestSupported(model: CompletionModel, request: CompletionRequest, options?: {
350
- streaming?: boolean | undefined;
351
- }): void;
352
- declare function textFromAssistantContent(content: AssistantContent[]): string;
353
-
354
- export { type ToolFunction as $, AssistantContent as A, getAssistantGenerationMetadata as B, type CompletionModel as C, type Document as D, isProviderTool as E, resolveCompletionModelInfo as F, withContextUsage as G, isToolResultContentArray as H, type ImageContent as I, type JsonObject as J, serializeToolResultOutput as K, type ToolChoice as L, Message as M, CompletionCapabilityError as N, type CompletionModelCapabilities as O, type ProviderTool as P, type CompletionStreamEvent as Q, type DocumentContent as R, type SystemMessage as S, type Text as T, Usage as U, type ImageDetail as V, type Reasoning as W, type ReasoningContent as X, type ReasoningContentType as Y, type StreamingCompletionModel as Z, type ToolCallArgumentsMode as _, type AssistantGenerationMetadata as a, type UsageDetails as a0, assertCompletionRequestSupported as a1, reasoningDisplayText as a2, textFromAssistantContent as a3, type AssistantMessage as b, type AssistantMessageOptions as c, type CompletionModelInfo as d, type CompletionModelMetadataOptions as e, type CompletionRequest as f, type CompletionResponse as g, type CompletionSource as h, type CompletionTool as i, type ContextUsage as j, type JsonPrimitive as k, type JsonValue as l, type MessageOptions as m, type ModelContextLimits as n, type ProviderToolCall as o, type ToolCall as p, ToolContent as q, type ToolDefinition as r, type ToolMessage as s, type ToolResult as t, type ToolResultContent as u, type ToolResultMessageOptions as v, type ToolResultOptions as w, UserContent as x, type UserMessage as y, calculateContextUsage as z };
@@ -1,70 +0,0 @@
1
- import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
2
- import { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
3
- import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
4
- import { J as JsonObject } from './types-G12i56s2.js';
5
- import { A as AnyTool } from './tool-Cohdv5GC.js';
6
-
7
- type McpToolDefinition = {
8
- name: string;
9
- description?: string | undefined;
10
- inputSchema: JsonObject;
11
- };
12
- type McpToolCallContent = {
13
- type: "text";
14
- text: string;
15
- } | {
16
- type: "image";
17
- data: string;
18
- mimeType: string;
19
- } | {
20
- type: "resource";
21
- resource: {
22
- uri: string;
23
- text: string;
24
- mimeType?: string | undefined;
25
- } | {
26
- uri: string;
27
- blob: string;
28
- mimeType?: string | undefined;
29
- };
30
- };
31
- type McpToolCallResult = {
32
- content: McpToolCallContent[];
33
- isError?: boolean | undefined;
34
- } | {
35
- toolResult: unknown;
36
- };
37
- type McpClient = {
38
- listTools(): Promise<{
39
- tools: McpToolDefinition[];
40
- }>;
41
- callTool(params: {
42
- name: string;
43
- arguments?: Record<string, unknown>;
44
- }): Promise<McpToolCallResult>;
45
- close(): Promise<void>;
46
- };
47
- type McpConnection = {
48
- readonly name: string;
49
- connect(): Promise<McpClient>;
50
- };
51
- type McpServer = {
52
- readonly name: string;
53
- readonly tools: AnyTool[];
54
- close(): Promise<void>;
55
- };
56
- type McpStdioOptions = StdioServerParameters & {
57
- name: string;
58
- };
59
- type McpHttpOptions = {
60
- name: string;
61
- url: string | URL;
62
- transport?: StreamableHTTPClientTransportOptions | undefined;
63
- };
64
- type McpSseOptions = {
65
- name: string;
66
- url: string | URL;
67
- transport?: SSEClientTransportOptions | undefined;
68
- };
69
-
70
- export type { McpConnection as M, McpServer as a, McpStdioOptions as b, McpHttpOptions as c, McpSseOptions as d, McpClient as e, McpToolCallContent as f, McpToolCallResult as g, McpToolDefinition as h };
@@ -1,79 +0,0 @@
1
- import { V as VectorMetadata, a as VectorMetadataValue } from './types-BCTRUGex.js';
2
- import { T as Tool } from './tool-Cohdv5GC.js';
3
-
4
- type VectorFilter = {
5
- type: "eq";
6
- key: string;
7
- value: VectorMetadataValue;
8
- } | {
9
- type: "gt";
10
- key: string;
11
- value: VectorMetadataValue;
12
- } | {
13
- type: "lt";
14
- key: string;
15
- value: VectorMetadataValue;
16
- } | {
17
- type: "and";
18
- filters: [VectorFilter, VectorFilter];
19
- } | {
20
- type: "or";
21
- filters: [VectorFilter, VectorFilter];
22
- };
23
- type LshOptions = {
24
- type: "lsh";
25
- numTables: number;
26
- numHyperplanes: number;
27
- seed?: number | undefined;
28
- };
29
- type IndexStrategy = {
30
- type: "bruteForce";
31
- } | LshOptions;
32
- type VectorSearchRequest = {
33
- query: string;
34
- topK: number;
35
- threshold?: number | undefined;
36
- filter?: VectorFilter | undefined;
37
- };
38
- type VectorSearchResult<T = unknown, Metadata extends VectorMetadata = VectorMetadata> = {
39
- score: number;
40
- id: string;
41
- document: T;
42
- metadata?: Metadata | undefined;
43
- };
44
- type VectorInspectRequest = {
45
- limit: number;
46
- cursor?: string | undefined;
47
- filter?: VectorFilter | undefined;
48
- };
49
- type VectorInspectItem<T = unknown, Metadata extends VectorMetadata = VectorMetadata> = {
50
- id: string;
51
- document: T;
52
- metadata?: Metadata | undefined;
53
- };
54
- type VectorInspectPage<T = unknown, Metadata extends VectorMetadata = VectorMetadata> = {
55
- items: Array<VectorInspectItem<T, Metadata>>;
56
- nextCursor?: string | undefined;
57
- totalCount?: number | undefined;
58
- };
59
- interface VectorSearchIndex<T = unknown, Metadata extends VectorMetadata = VectorMetadata> {
60
- search(request: VectorSearchRequest): Promise<Array<VectorSearchResult<T, Metadata>>>;
61
- searchIds(request: VectorSearchRequest): Promise<Array<{
62
- score: number;
63
- id: string;
64
- }>>;
65
- asTool(options: VectorSearchToolOptions): Tool<{
66
- query: string;
67
- topK?: number;
68
- }, unknown>;
69
- inspect?(request: VectorInspectRequest): Promise<VectorInspectPage<T, Metadata>>;
70
- }
71
- type VectorSearchToolOptions = {
72
- name: string;
73
- description?: string | undefined;
74
- topK?: number | undefined;
75
- threshold?: number | undefined;
76
- filter?: VectorFilter | undefined;
77
- };
78
-
79
- export type { IndexStrategy as I, LshOptions as L, VectorFilter as V, VectorSearchIndex as a, VectorSearchRequest as b, VectorSearchResult as c, VectorInspectRequest as d, VectorInspectPage as e, VectorSearchToolOptions as f, VectorInspectItem as g };