@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,257 +0,0 @@
1
- import { Y as ReasoningContentType, p as ToolCall, h as CompletionSource, o as ProviderToolCall, U as Usage, j as ContextUsage, M as Message, f as CompletionRequest, u as ToolResultContent, g as CompletionResponse, _ as ToolCallArgumentsMode, J as JsonObject, O as CompletionModelCapabilities, r as ToolDefinition, l as JsonValue } from './types-G12i56s2.js';
2
- import { GuardrailDecisionRecord } from './guardrails/index.js';
3
- import { g as ToolCallStreamEvent } from './tool-Cohdv5GC.js';
4
-
5
- type PromptResponse = {
6
- output: string;
7
- usage: Usage;
8
- contextUsage?: ContextUsage | undefined;
9
- messages: Message[];
10
- trace?: AgentTraceInfo | undefined;
11
- guardrails?: GuardrailDecisionRecord[] | undefined;
12
- sources?: CompletionSource[] | undefined;
13
- providerToolCalls?: ProviderToolCall[] | undefined;
14
- };
15
- type AgentDeltaEvent = {
16
- type: "text_delta";
17
- delta: string;
18
- } | {
19
- type: "reasoning_delta";
20
- delta: string;
21
- id?: string;
22
- contentType?: ReasoningContentType;
23
- signature?: string;
24
- } | {
25
- type: "tool_call";
26
- toolCall: ToolCall;
27
- } | {
28
- type: "source";
29
- source: CompletionSource;
30
- } | {
31
- type: "provider_tool_call";
32
- toolCall: ProviderToolCall;
33
- };
34
- type AgentErrorStreamEvent = {
35
- type: "error";
36
- error: unknown;
37
- usage: Usage;
38
- };
39
- type AgentStreamOptions = {
40
- /** @default true */
41
- includeToolCallDeltas?: boolean;
42
- };
43
- type AgentToolCallDeltaEvent = {
44
- type: "tool_call_delta";
45
- turn: number;
46
- id: string;
47
- callId?: string;
48
- name?: string;
49
- argumentsDelta?: string;
50
- argumentsMode?: ToolCallArgumentsMode;
51
- signature?: string;
52
- };
53
- type AgentChildStreamEventBase<RawResponse = unknown> = {
54
- type: "turn_start";
55
- turn: number;
56
- prompt: Message;
57
- history: Message[];
58
- } | {
59
- type: "generation_start";
60
- turn: number;
61
- request: CompletionRequest;
62
- modelInfo: AgentGenerationModelInfo;
63
- } | {
64
- type: "text_delta";
65
- turn: number;
66
- delta: string;
67
- } | {
68
- type: "reasoning_delta";
69
- turn: number;
70
- delta: string;
71
- id?: string;
72
- contentType?: ReasoningContentType;
73
- signature?: string;
74
- } | {
75
- type: "tool_call";
76
- turn: number;
77
- toolCall: ToolCall;
78
- } | {
79
- type: "source";
80
- turn: number;
81
- source: CompletionSource;
82
- } | {
83
- type: "provider_tool_call";
84
- turn: number;
85
- toolCall: ProviderToolCall;
86
- } | {
87
- type: "tool_result";
88
- turn: number;
89
- toolName: string;
90
- toolCallId?: string;
91
- internalCallId: string;
92
- args: string;
93
- result: string;
94
- structuredResult?: ToolResultContent[] | undefined;
95
- } | {
96
- type: "turn_end";
97
- turn: number;
98
- response: CompletionResponse<RawResponse>;
99
- firstDeltaMs?: number | undefined;
100
- } | {
101
- type: "guardrail_decision";
102
- turn?: number | undefined;
103
- decision: GuardrailDecisionRecord;
104
- } | {
105
- type: "final";
106
- runId: string;
107
- output: string;
108
- usage: Usage;
109
- contextUsage?: ContextUsage | undefined;
110
- messages: Message[];
111
- trace?: AgentTraceInfo | undefined;
112
- guardrails?: GuardrailDecisionRecord[] | undefined;
113
- sources?: CompletionSource[] | undefined;
114
- providerToolCalls?: ProviderToolCall[] | undefined;
115
- } | AgentErrorStreamEvent;
116
- type AgentChildStreamEventWithoutToolCallDeltas<RawResponse = unknown> = AgentChildStreamEventBase<RawResponse>;
117
- type AgentChildStreamEvent<RawResponse = unknown> = AgentChildStreamEventBase<RawResponse> | AgentToolCallDeltaEvent;
118
- type AgentChildStreamEventWithToolCallDeltas<RawResponse = unknown> = AgentChildStreamEvent<RawResponse>;
119
- type AgentToolStreamEvent<ChildEvent> = {
120
- type: "agent_tool_event";
121
- turn: number;
122
- toolName: string;
123
- toolCallId?: string;
124
- internalCallId: string;
125
- agentId: string;
126
- agentName?: string;
127
- event: ChildEvent;
128
- };
129
- type AgentStreamEventWithoutToolCallDeltas<RawResponse = unknown> = AgentChildStreamEventWithoutToolCallDeltas<RawResponse> | AgentToolStreamEvent<AgentChildStreamEventWithoutToolCallDeltas<RawResponse>>;
130
- type AgentStreamEvent<RawResponse = unknown> = AgentChildStreamEvent<RawResponse> | AgentToolStreamEvent<AgentChildStreamEvent<RawResponse>>;
131
- type AgentStreamEventWithToolCallDeltas<RawResponse = unknown> = AgentStreamEvent<RawResponse>;
132
-
133
- type AgentTraceInfo = {
134
- traceId?: string | undefined;
135
- observationId?: string | undefined;
136
- };
137
- type AgentTraceOptions = {
138
- name?: string | undefined;
139
- userId?: string | undefined;
140
- sessionId?: string | undefined;
141
- metadata?: Record<string, unknown> | undefined;
142
- tags?: string[] | undefined;
143
- version?: string | undefined;
144
- traceId?: string | undefined;
145
- failOnObserverError?: boolean | undefined;
146
- promptRef?: AgentRunPromptRef | undefined;
147
- };
148
- type AgentRunPromptRef = {
149
- name: string;
150
- version?: number | undefined;
151
- };
152
- type AgentRunStartArgs = {
153
- agentName?: string | undefined;
154
- agentDescription?: string | undefined;
155
- instructions?: string | undefined;
156
- trace?: AgentTraceOptions | undefined;
157
- prompt: Message;
158
- promptRef?: AgentRunPromptRef | undefined;
159
- history: Message[];
160
- maxTurns: number;
161
- };
162
- type AgentRunEndArgs = {
163
- output: string;
164
- usage: Usage;
165
- messages: Message[];
166
- sources?: CompletionSource[] | undefined;
167
- providerToolCalls?: ProviderToolCall[] | undefined;
168
- };
169
- type AgentRunErrorArgs = {
170
- error: unknown;
171
- usage: Usage;
172
- messages: Message[];
173
- };
174
- type AgentGenerationModelInfo = {
175
- provider: string;
176
- defaultModel: string;
177
- capabilities?: CompletionModelCapabilities | undefined;
178
- };
179
- type AgentGenerationStartArgs = {
180
- turn: number;
181
- request: CompletionRequest;
182
- providerRequest?: JsonObject | undefined;
183
- modelInfo?: AgentGenerationModelInfo | undefined;
184
- };
185
- type AgentGenerationEndArgs<RawResponse = unknown> = {
186
- turn: number;
187
- response: CompletionResponse<RawResponse>;
188
- firstDeltaMs?: number | undefined;
189
- };
190
- type AgentGenerationErrorArgs = {
191
- turn: number;
192
- error: unknown;
193
- };
194
- type AgentGenerationUpdateArgs = {
195
- turn: number;
196
- delta: AgentDeltaEvent;
197
- };
198
- type AgentRunEventArgs = {
199
- name: string;
200
- attributes?: Record<string, JsonValue | undefined> | undefined;
201
- level?: "DEFAULT" | "WARNING" | "ERROR" | undefined;
202
- timestamp?: Date | string | undefined;
203
- };
204
- type AgentToolStartArgs = {
205
- turn: number;
206
- toolCall: ToolCall;
207
- toolName: string;
208
- args: string;
209
- internalCallId: string;
210
- toolCallId?: string | undefined;
211
- toolDefinition?: ToolDefinition | undefined;
212
- toolMetadata?: JsonObject | undefined;
213
- };
214
- type AgentToolEndArgs = AgentToolStartArgs & {
215
- result: string;
216
- structuredResult?: ToolResultContent[] | undefined;
217
- skipped: boolean;
218
- };
219
- type AgentToolErrorArgs = AgentToolStartArgs & {
220
- error: unknown;
221
- };
222
- type AgentToolStreamEventArgs = AgentToolStartArgs & {
223
- event: ToolCallStreamEvent;
224
- };
225
- interface AgentGenerationObserver {
226
- end(args: AgentGenerationEndArgs): void | Promise<void>;
227
- error?(args: AgentGenerationErrorArgs): void | Promise<void>;
228
- update?(args: AgentGenerationUpdateArgs): void | Promise<void>;
229
- }
230
- interface AgentToolObserver {
231
- streamEvent?(args: AgentToolStreamEventArgs): void | Promise<void>;
232
- end(args: AgentToolEndArgs): void | Promise<void>;
233
- error?(args: AgentToolErrorArgs): void | Promise<void>;
234
- }
235
- interface AgentRunObserver {
236
- readonly trace?: AgentTraceInfo | undefined;
237
- startGeneration?(args: AgentGenerationStartArgs): AgentGenerationObserver | undefined | Promise<AgentGenerationObserver | undefined>;
238
- startTool?(args: AgentToolStartArgs): AgentToolObserver | undefined | Promise<AgentToolObserver | undefined>;
239
- end(args: AgentRunEndArgs): void | Promise<void>;
240
- error?(args: AgentRunErrorArgs): void | Promise<void>;
241
- event?(args: AgentRunEventArgs): void | Promise<void>;
242
- }
243
- interface AgentObserver {
244
- startRun(args: AgentRunStartArgs): AgentRunObserver | undefined | Promise<AgentRunObserver | undefined>;
245
- flush?(): void | Promise<void>;
246
- shutdown?(): void | Promise<void>;
247
- }
248
- type AgentObserverRegistration = {
249
- observer: AgentObserver;
250
- failOnObserverError?: boolean | undefined;
251
- };
252
- type ObserveOptions = {
253
- failOnObserverError?: boolean | undefined;
254
- };
255
- declare function createObserver(observer: AgentObserver): AgentObserver;
256
-
257
- export { type AgentChildStreamEvent as A, type AgentToolObserver as B, type AgentToolStartArgs as C, type AgentToolStreamEventArgs as D, type AgentTraceInfo as E, createObserver as F, type ObserveOptions as O, type PromptResponse as P, type AgentChildStreamEventWithToolCallDeltas as a, type AgentChildStreamEventWithoutToolCallDeltas as b, type AgentErrorStreamEvent as c, type AgentStreamEvent as d, type AgentStreamEventWithToolCallDeltas as e, type AgentStreamEventWithoutToolCallDeltas as f, type AgentStreamOptions as g, type AgentToolCallDeltaEvent as h, type AgentObserver as i, type AgentTraceOptions as j, type AgentObserverRegistration as k, type AgentDeltaEvent as l, type AgentGenerationEndArgs as m, type AgentGenerationErrorArgs as n, type AgentGenerationModelInfo as o, type AgentGenerationObserver as p, type AgentGenerationStartArgs as q, type AgentGenerationUpdateArgs as r, type AgentRunEndArgs as s, type AgentRunErrorArgs as t, type AgentRunEventArgs as u, type AgentRunObserver as v, type AgentRunPromptRef as w, type AgentRunStartArgs as x, type AgentToolEndArgs as y, type AgentToolErrorArgs as z };
@@ -1,39 +0,0 @@
1
- import { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
2
- import { M as Message, D as Document, i as CompletionTool, L as ToolChoice, J as JsonObject, l as JsonValue, A as AssistantContent, U as Usage, g as CompletionResponse, C as CompletionModel, Z as StreamingCompletionModel, Q as CompletionStreamEvent } from './types-G12i56s2.js';
3
-
4
- type CreateCompletionInput = string | Message | Message[];
5
- type CreateCompletionBaseOptions = {
6
- input?: CreateCompletionInput | undefined;
7
- messages?: Message[] | undefined;
8
- instructions?: string | undefined;
9
- documents?: Document[] | undefined;
10
- tools?: CompletionTool[] | undefined;
11
- temperature?: number | undefined;
12
- maxTokens?: number | undefined;
13
- toolChoice?: ToolChoice | undefined;
14
- outputSchema?: JsonObject | undefined;
15
- params?: JsonValue | undefined;
16
- };
17
- type CreateCompletionOptions = CreateCompletionBaseOptions;
18
- type CreateCompletionStreamOptions = CreateCompletionBaseOptions;
19
- type CreateParsedCompletionOptions<T> = Omit<CreateCompletionBaseOptions, "outputSchema"> & {
20
- schema: ZodSchema<T>;
21
- };
22
- type CreateCompletionResult<RawResponse = unknown> = {
23
- text: string;
24
- content: AssistantContent[];
25
- usage: Usage;
26
- response: CompletionResponse<RawResponse>;
27
- };
28
- type CreateParsedCompletionResult<T, RawResponse = unknown> = CreateCompletionResult<RawResponse> & {
29
- data: T;
30
- };
31
- type RawResponseOf<Model> = Model extends CompletionModel<infer RawResponse, infer _ModelName> ? RawResponse : unknown;
32
- declare function createCompletion<Model extends CompletionModel>(model: Model, options: CreateCompletionOptions): Promise<CreateCompletionResult<RawResponseOf<Model>>>;
33
- declare function createCompletionStream<Model extends StreamingCompletionModel>(model: Model, options: CreateCompletionStreamOptions): AsyncIterable<CompletionStreamEvent<RawResponseOf<Model>>>;
34
- declare function createParsedCompletion<T, Model extends CompletionModel>(model: Model, options: CreateParsedCompletionOptions<T>): Promise<CreateParsedCompletionResult<T, RawResponseOf<Model>>>;
35
- declare function isStreamingCompletionModel(model: CompletionModel): model is StreamingCompletionModel;
36
-
37
- declare function isJsonValue(value: unknown): value is JsonValue;
38
-
39
- export { type CreateCompletionBaseOptions as C, type CreateCompletionInput as a, type CreateCompletionOptions as b, type CreateCompletionResult as c, type CreateCompletionStreamOptions as d, type CreateParsedCompletionOptions as e, type CreateParsedCompletionResult as f, createCompletion as g, createCompletionStream as h, createParsedCompletion as i, isJsonValue as j, isStreamingCompletionModel as k };
@@ -1,90 +0,0 @@
1
- import { r as ToolDefinition, f as CompletionRequest, g as CompletionResponse, l as JsonValue, u as ToolResultContent } from './types-G12i56s2.js';
2
- import { V as VectorMetadata, E as EmbeddingModel, c as EmbeddedDocument } from './types-BCTRUGex.js';
3
- import { A as AnyTool, f as ToolCallContext, N as NormalizedToolOutput } from './tool-Cohdv5GC.js';
4
- import { a as VectorSearchIndex } from './types-O-abTIin.js';
5
-
6
- declare class ToolSet {
7
- private readonly tools;
8
- static fromTools(tools: AnyTool[]): ToolSet;
9
- addTool(tool: AnyTool): this;
10
- addTools(tools: AnyTool[] | ToolSet): this;
11
- deleteTool(toolName: string): boolean;
12
- contains(toolName: string): boolean;
13
- get(toolName: string): AnyTool | undefined;
14
- values(): AnyTool[];
15
- getToolDefinitions(prompt?: string): Promise<ToolDefinition[]>;
16
- call(toolName: string, args: string, context?: ToolCallContext): Promise<NormalizedToolOutput>;
17
- }
18
-
19
- type ToolSearchDocument<Metadata extends VectorMetadata = VectorMetadata> = {
20
- toolName: string;
21
- definition: ToolDefinition;
22
- text: string;
23
- metadata?: Metadata | undefined;
24
- };
25
- type EmbedToolsOptions<Metadata extends VectorMetadata = VectorMetadata> = {
26
- content?: ((tool: AnyTool, definition: ToolDefinition) => string | string[]) | undefined;
27
- metadata?: ((tool: AnyTool, definition: ToolDefinition) => Metadata | undefined) | undefined;
28
- concurrency?: number | undefined;
29
- };
30
- interface DynamicToolIndex<Metadata extends VectorMetadata = VectorMetadata> extends VectorSearchIndex<ToolSearchDocument<Metadata>, Metadata> {
31
- readonly toolSet: ToolSet;
32
- }
33
- declare function embedTools<Metadata extends VectorMetadata = VectorMetadata>(model: EmbeddingModel, tools: AnyTool[] | ToolSet, options?: EmbedToolsOptions<Metadata>): Promise<Array<EmbeddedDocument<ToolSearchDocument<Metadata>, Metadata>>>;
34
- declare function createToolIndex<Metadata extends VectorMetadata = VectorMetadata>(model: EmbeddingModel, tools: AnyTool[] | ToolSet, options?: EmbedToolsOptions<Metadata>): Promise<DynamicToolIndex<Metadata>>;
35
- declare function isDynamicToolIndex(value: unknown): value is DynamicToolIndex;
36
-
37
- type MaybePromise<T> = T | Promise<T>;
38
- type CompletionRequestMiddlewareArgs = {
39
- turn: number;
40
- request: CompletionRequest;
41
- originalRequest: CompletionRequest;
42
- };
43
- type CompletionRequestMiddlewareResult = {
44
- request: CompletionRequest;
45
- } | undefined;
46
- type CompletionResponseMiddlewareArgs<RawResponse = unknown> = {
47
- turn: number;
48
- request: CompletionRequest;
49
- response: CompletionResponse<RawResponse>;
50
- originalResponse: CompletionResponse<RawResponse>;
51
- };
52
- type CompletionResponseMiddlewareResult<RawResponse = unknown> = {
53
- response: CompletionResponse<RawResponse>;
54
- } | undefined;
55
- type ToolInputMiddlewareArgs = {
56
- toolName: string;
57
- args: string;
58
- originalArgs: string;
59
- turn: number;
60
- toolCallId?: string | undefined;
61
- internalCallId: string;
62
- };
63
- type ToolInputMiddlewareResult = {
64
- args: JsonValue | string;
65
- } | undefined;
66
- type ToolResultMiddlewareArgs = {
67
- toolName: string;
68
- args: string;
69
- result: string;
70
- originalResult: string;
71
- structuredResult?: ToolResultContent[] | undefined;
72
- originalStructuredResult?: ToolResultContent[] | undefined;
73
- turn: number;
74
- toolCallId?: string | undefined;
75
- internalCallId: string;
76
- };
77
- type ToolOutputMiddlewareArgs = ToolResultMiddlewareArgs;
78
- type ToolOutputMiddlewareResult = string | {
79
- result?: string | undefined;
80
- structuredResult?: ToolResultContent[] | undefined;
81
- } | undefined;
82
- interface AgentMiddleware<RawResponse = unknown> {
83
- onCompletionRequest?(args: CompletionRequestMiddlewareArgs): MaybePromise<CompletionRequestMiddlewareResult>;
84
- onCompletionResponse?(args: CompletionResponseMiddlewareArgs<RawResponse>): MaybePromise<CompletionResponseMiddlewareResult<RawResponse>>;
85
- onToolInput?(args: ToolInputMiddlewareArgs): MaybePromise<ToolInputMiddlewareResult>;
86
- onToolOutput?(args: ToolOutputMiddlewareArgs): MaybePromise<ToolOutputMiddlewareResult>;
87
- }
88
- declare function createMiddleware<RawResponse = unknown>(middleware: AgentMiddleware<RawResponse>): AgentMiddleware<RawResponse>;
89
-
90
- export { type AgentMiddleware as A, type CompletionRequestMiddlewareArgs as C, type DynamicToolIndex as D, type EmbedToolsOptions as E, type ToolInputMiddlewareArgs as T, type CompletionRequestMiddlewareResult as a, type CompletionResponseMiddlewareArgs as b, type CompletionResponseMiddlewareResult as c, type ToolInputMiddlewareResult as d, type ToolOutputMiddlewareArgs as e, type ToolOutputMiddlewareResult as f, type ToolResultMiddlewareArgs as g, createMiddleware as h, type ToolSearchDocument as i, ToolSet as j, createToolIndex as k, embedTools as l, isDynamicToolIndex as m };
@@ -1,28 +0,0 @@
1
- import { M as Message } from '../types-G12i56s2.js';
2
- import { d as ToolApprovalRequest } from '../tool-Cohdv5GC.js';
3
- export { C as CompletionRetryContext, a as CompletionRetryOptions, P as PromptRequest } from '../agent-x3YTyv5i.js';
4
- export { A as AgentChildStreamEvent, a as AgentChildStreamEventWithToolCallDeltas, b as AgentChildStreamEventWithoutToolCallDeltas, l as AgentDeltaEvent, c as AgentErrorStreamEvent, d as AgentStreamEvent, e as AgentStreamEventWithToolCallDeltas, f as AgentStreamEventWithoutToolCallDeltas, g as AgentStreamOptions, h as AgentToolCallDeltaEvent, P as PromptResponse } from '../index-BxSbmOMr.js';
5
- import '../guardrails/index.js';
6
- import '../types-D9JpeAPF.js';
7
- import '../types-BrLbKnEz.js';
8
- import '../middleware-Dp3d_pxi.js';
9
- import '../types-BCTRUGex.js';
10
- import '../types-O-abTIin.js';
11
-
12
- declare class MaxTurnsError extends Error {
13
- readonly maxTurns: number;
14
- readonly chatHistory: Message[];
15
- readonly prompt: Message;
16
- constructor(maxTurns: number, chatHistory: Message[], prompt: Message);
17
- }
18
- declare class PromptCancelledError extends Error {
19
- readonly chatHistory: Message[];
20
- readonly reason: string;
21
- constructor(chatHistory: Message[], reason: string);
22
- }
23
- declare class ToolApprovalRequiredError extends Error {
24
- readonly request: ToolApprovalRequest;
25
- constructor(request: ToolApprovalRequest);
26
- }
27
-
28
- export { MaxTurnsError, PromptCancelledError, ToolApprovalRequiredError };
@@ -1,25 +0,0 @@
1
- import {
2
- MaxTurnsError,
3
- PromptCancelledError,
4
- PromptRequest,
5
- ToolApprovalRequiredError
6
- } from "../chunk-BALBBVI3.js";
7
- import "../chunk-XUUY2L2D.js";
8
- import "../chunk-HYUYZEAJ.js";
9
- import "../chunk-MELYDKWQ.js";
10
- import "../chunk-2ODTMRHP.js";
11
- import "../chunk-MRQLEK2B.js";
12
- import "../chunk-MNWK2USR.js";
13
- import "../chunk-OIMLU4SF.js";
14
- import "../chunk-Q25IWLBT.js";
15
- import "../chunk-MC3CCKEB.js";
16
- import "../chunk-ADH7NNCS.js";
17
- import "../chunk-WQKHFADH.js";
18
- import "../chunk-CWUJUSOS.js";
19
- export {
20
- MaxTurnsError,
21
- PromptCancelledError,
22
- PromptRequest,
23
- ToolApprovalRequiredError
24
- };
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,65 +0,0 @@
1
- import { J as JsonObject, r as ToolDefinition, u as ToolResultContent, l as JsonValue } from './types-G12i56s2.js';
2
-
3
- type ToolApprovalRunContext = {
4
- agentId: string;
5
- runId: string;
6
- sessionId?: string;
7
- metadata?: JsonObject;
8
- };
9
- type ToolApprovalContext<Args = unknown> = {
10
- toolName: string;
11
- args: Args;
12
- rawArgs: string;
13
- toolCallId?: string;
14
- internalCallId: string;
15
- run: ToolApprovalRunContext;
16
- };
17
- type ToolApprovalPolicy<Args = unknown> = {
18
- when(ctx: ToolApprovalContext<Args>): boolean | Promise<boolean>;
19
- reason?: string | ((ctx: ToolApprovalContext<Args>) => string | Promise<string>);
20
- rejectMessage?: string | ((ctx: ToolApprovalContext<Args>) => string | Promise<string>);
21
- };
22
- type ToolApprovalRequest<Args = unknown> = ToolApprovalContext<Args> & {
23
- reason?: string;
24
- rejectMessage?: string;
25
- };
26
- type ToolApprovalDecision = boolean | {
27
- approved: true;
28
- reason?: string;
29
- } | {
30
- approved: false;
31
- reason?: string;
32
- rejectMessage?: string;
33
- };
34
- type ToolApprovalsOptions = {
35
- handler(request: ToolApprovalRequest): ToolApprovalDecision | Promise<ToolApprovalDecision>;
36
- };
37
- type ToolCallStreamEvent = {
38
- agentId: string;
39
- agentName?: string | undefined;
40
- event: unknown;
41
- };
42
- type ToolCallContext = {
43
- emitStreamEvent?(event: ToolCallStreamEvent): void | Promise<void>;
44
- includeToolCallDeltas?: boolean;
45
- };
46
- interface Tool<Args = unknown, Output = unknown> {
47
- readonly name: string;
48
- readonly approval?: ToolApprovalPolicy<Args>;
49
- definition(prompt: string): ToolDefinition | Promise<ToolDefinition>;
50
- call(args: Args, context?: ToolCallContext): Output | Promise<Output>;
51
- parseApprovalArgs?(args: unknown): Args;
52
- }
53
- type AnyTool = Omit<Tool<unknown, unknown>, "approval"> & {
54
- readonly approval?: unknown;
55
- };
56
- type NormalizedToolOutput = string | ToolResultContent[];
57
- declare const ToolOutput: {
58
- content(content: ToolResultContent[]): ToolResultContent[];
59
- };
60
-
61
- declare function normalizeToolResultOutput(output: unknown): NormalizedToolOutput;
62
- declare function toolResultContentToText(content: ToolResultContent[]): string;
63
- declare function parseToolArgs(args: string): JsonValue;
64
-
65
- export { type AnyTool as A, type NormalizedToolOutput as N, type Tool as T, type ToolApprovalContext as a, type ToolApprovalDecision as b, type ToolApprovalPolicy as c, type ToolApprovalRequest as d, type ToolApprovalsOptions as e, type ToolCallContext as f, type ToolCallStreamEvent as g, type ToolApprovalRunContext as h, ToolOutput as i, normalizeToolResultOutput as n, parseToolArgs as p, toolResultContentToText as t };
@@ -1,47 +0,0 @@
1
- type Embedding = {
2
- document: string;
3
- vector: number[];
4
- };
5
- type SparseVector = {
6
- indices: number[];
7
- values: number[];
8
- };
9
- type SparseEmbedding = {
10
- document: string;
11
- vector: SparseVector;
12
- };
13
- interface EmbeddingModel {
14
- readonly dimensions?: number | undefined;
15
- readonly maxBatchSize?: number | undefined;
16
- embedTexts(texts: string[]): Promise<Embedding[]>;
17
- }
18
- /** Sparse lexical/neural encoder used for hybrid retrieval channels. */
19
- interface SparseEmbeddingModel {
20
- readonly maxBatchSize?: number | undefined;
21
- /** Embed passage/document texts for indexing. */
22
- embedTexts(texts: string[]): Promise<SparseEmbedding[]>;
23
- /** Embed a search query (may differ from passage encoding for models like SPLADE). */
24
- embedQuery(query: string): Promise<SparseEmbedding>;
25
- }
26
- type EmbeddedDocument<T, Metadata extends VectorMetadata = VectorMetadata> = {
27
- id: string;
28
- document: T;
29
- metadata?: Metadata | undefined;
30
- embeddings: Embedding[];
31
- /** Optional sparse vectors aligned 1:1 with `embeddings` by chunk index. */
32
- sparseEmbeddings?: SparseEmbedding[] | undefined;
33
- };
34
- type VectorMetadataValue = string | number | boolean | null;
35
- type VectorMetadata = Record<string, VectorMetadataValue>;
36
- type EmbedDocumentsOptions<T, Metadata extends VectorMetadata = VectorMetadata> = {
37
- id?: ((document: T, index: number) => string) | undefined;
38
- content(document: T, index: number): string | string[];
39
- metadata?: ((document: T, index: number) => Metadata | undefined) | undefined;
40
- concurrency?: number | undefined;
41
- };
42
- type EmbedHybridDocumentsOptions = {
43
- dense: EmbeddingModel;
44
- sparse: SparseEmbeddingModel;
45
- };
46
-
47
- export type { EmbeddingModel as E, SparseEmbeddingModel as S, VectorMetadata as V, VectorMetadataValue as a, EmbedDocumentsOptions as b, EmbeddedDocument as c, EmbedHybridDocumentsOptions as d, SparseEmbedding as e, Embedding as f, SparseVector as g };
@@ -1,119 +0,0 @@
1
- import { J as JsonObject, M as Message, S as SystemMessage, U as Usage } from './types-G12i56s2.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
- readonly compaction?: MemoryCompactionStore | undefined;
53
- load(context: MemoryContext): Promise<Message[]>;
54
- append(input: MemoryAppendInput): Promise<void>;
55
- clear(context: MemoryContext): Promise<void>;
56
- recordError?(input: MemoryErrorInput): Promise<void>;
57
- }
58
- type MemoryCompactionSnapshot = {
59
- /** Opaque store revision used to reject stale compaction commits. */
60
- revision: string;
61
- messages: Message[];
62
- };
63
- type MemoryCompactionCommitInput = {
64
- context: MemoryContext;
65
- revision: string;
66
- compactedMessageCount: number;
67
- summary: SystemMessage;
68
- runId: string;
69
- };
70
- type MemoryCompactionCommitResult = "committed" | "conflict";
71
- /** Optional durable prefix-replacement capability used by automatic memory compaction. */
72
- interface MemoryCompactionStore {
73
- load(context: MemoryContext): Promise<MemoryCompactionSnapshot>;
74
- commit(input: MemoryCompactionCommitInput): Promise<MemoryCompactionCommitResult>;
75
- }
76
- type MemoryCompactorInput = {
77
- context: MemoryContext;
78
- messages: Message[];
79
- };
80
- type MemoryCompactorResult = {
81
- summary: string;
82
- usage?: Usage | undefined;
83
- };
84
- type MemoryCompactor = (input: MemoryCompactorInput) => Promise<MemoryCompactorResult>;
85
- type SummaryMemoryCompactorOptions = {
86
- instructions?: string | undefined;
87
- maxTokens?: number | undefined;
88
- temperature?: number | undefined;
89
- };
90
- type MemoryCompactionOptions = {
91
- maxMessages: number;
92
- keepRecentUserTurns?: number | undefined;
93
- compactor: MemoryCompactor;
94
- conflictRetries?: number | undefined;
95
- };
96
- type ResolvedMemoryCompactionOptions = {
97
- maxMessages: number;
98
- keepRecentUserTurns: number;
99
- compactor: MemoryCompactor;
100
- conflictRetries: number;
101
- };
102
- type MemoryOptions = {
103
- savePolicy?: MemorySavePolicy | undefined;
104
- compaction?: MemoryCompactionOptions | undefined;
105
- };
106
- type ResolvedMemoryOptions = {
107
- savePolicy: MemorySavePolicy;
108
- compaction?: ResolvedMemoryCompactionOptions | undefined;
109
- };
110
- type MemoryRegistration = {
111
- store: MemoryStore;
112
- options: ResolvedMemoryOptions;
113
- };
114
- type SessionOptions = {
115
- userId?: string | undefined;
116
- metadata?: JsonObject | undefined;
117
- };
118
-
119
- export type { MemoryCompactionCommitInput as M, ResolvedMemoryCompactionOptions as R, SummaryMemoryCompactorOptions as S, MemoryCompactionCommitResult as a, MemoryCompactionOptions as b, MemoryCompactionSnapshot as c, MemoryCompactionStore as d, MemoryCompactor as e, MemoryCompactorInput as f, MemoryCompactorResult as g, MemoryConversation as h, MemoryConversationListOptions as i, MemoryConversationMessage as j, MemoryConversationSummary as k, MemoryInspector as l, MemoryStore as m, MemoryOptions as n, ResolvedMemoryOptions as o, MemoryAppendInput as p, MemoryContext as q, MemoryErrorInput as r, MemoryRegistration as s, MemorySavePolicy as t, SessionOptions as u };