@anvia/core 0.8.0 → 0.10.1-preview.20260628T075832.6067ada
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.
- package/README.md +14 -0
- package/dist/agent/index.d.ts +10 -9
- package/dist/agent/index.js +7 -7
- package/dist/{agent-BW19m79B.d.ts → agent-DpjRlKHm.d.ts} +6 -66
- package/dist/audio-generation/index.d.ts +1 -1
- package/dist/{chunk-VQE5PAAT.js → chunk-66IJDP6L.js} +4 -4
- package/dist/{chunk-RAHDO2B2.js → chunk-753U5JNI.js} +3 -3
- package/dist/chunk-FJNGCBYO.js +616 -0
- package/dist/chunk-FJNGCBYO.js.map +1 -0
- package/dist/chunk-GH4IY7FX.js +244 -0
- package/dist/chunk-GH4IY7FX.js.map +1 -0
- package/dist/{chunk-USWULPZJ.js → chunk-IA47SXLS.js} +5 -5
- package/dist/{chunk-4KQ536VD.js → chunk-JGBQKRUR.js} +5 -5
- package/dist/{chunk-EIBAVYOR.js → chunk-RYEZK44O.js} +7 -7
- package/dist/{chunk-ITYXP4CL.js → chunk-ZT2YH2GA.js} +2 -2
- package/dist/completion/index.d.ts +3 -3
- package/dist/completion/index.js +1 -1
- package/dist/create-completion-DowjAvxG.d.ts +113 -0
- package/dist/evals/index.d.ts +5 -4
- package/dist/evals/index.js +8 -8
- package/dist/extractor/index.d.ts +5 -4
- package/dist/extractor/index.js +8 -8
- package/dist/image-generation/index.d.ts +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.js +24 -10
- package/dist/internal/agent.d.ts +5 -4
- package/dist/internal/agent.js +6 -6
- package/dist/loaders/index.d.ts +1 -1
- package/dist/mcp/index.d.ts +4 -4
- package/dist/memory/index.d.ts +1 -1
- package/dist/{middleware-CZocYAtZ.d.ts → middleware-ChM15MzS.d.ts} +2 -2
- package/dist/observability/index.d.ts +2 -2
- package/dist/pipeline/index.d.ts +5 -4
- package/dist/request-types-B9pyrfw6.d.ts +65 -0
- package/dist/skills/index.d.ts +4 -4
- package/dist/skills/index.js +5 -5
- package/dist/{think-tool-B8Rqw2i_.d.ts → think-tool-2lP4pcTq.d.ts} +1 -1
- package/dist/tool/index.d.ts +4 -4
- package/dist/tool/index.js +4 -4
- package/dist/{tool-BLypI31e.d.ts → tool-tQWfAemw.d.ts} +1 -1
- package/dist/transcription/index.d.ts +1 -1
- package/dist/{types-C8loR4il.d.ts → types-ChMOgWQy.d.ts} +1 -1
- package/dist/{types-CIwm9p4w.d.ts → types-DO_bx10g.d.ts} +2 -2
- package/dist/{types-D-YTJdLj.d.ts → types-vaEHqvr-.d.ts} +1 -1
- package/dist/ui/index.d.ts +33 -0
- package/dist/ui/index.js +21 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/vector-store/index.d.ts +2 -2
- package/dist/vector-store/index.js +2 -2
- package/package.json +6 -2
- package/dist/chunk-S5IGJ4RB.js +0 -224
- package/dist/chunk-S5IGJ4RB.js.map +0 -1
- package/dist/create-completion-BEbtU5pX.d.ts +0 -37
- /package/dist/{chunk-VQE5PAAT.js.map → chunk-66IJDP6L.js.map} +0 -0
- /package/dist/{chunk-RAHDO2B2.js.map → chunk-753U5JNI.js.map} +0 -0
- /package/dist/{chunk-USWULPZJ.js.map → chunk-IA47SXLS.js.map} +0 -0
- /package/dist/{chunk-4KQ536VD.js.map → chunk-JGBQKRUR.js.map} +0 -0
- /package/dist/{chunk-EIBAVYOR.js.map → chunk-RYEZK44O.js.map} +0 -0
- /package/dist/{chunk-ITYXP4CL.js.map → chunk-ZT2YH2GA.js.map} +0 -0
package/README.md
CHANGED
|
@@ -96,6 +96,20 @@ for await (const event of createCompletionStream(model, {
|
|
|
96
96
|
}
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
React hooks send standardized `UIMessage[]` in their request body. Pass those messages directly to
|
|
100
|
+
`createCompletionStream`; the helper normalizes them before calling the provider:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { createCompletionStream } from "@anvia/core";
|
|
104
|
+
import type { UIStreamRequest } from "@anvia/core/ui";
|
|
105
|
+
|
|
106
|
+
const body = (await request.json()) as UIStreamRequest;
|
|
107
|
+
|
|
108
|
+
const events = createCompletionStream(model, {
|
|
109
|
+
messages: body.messages,
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
99
113
|
Use `createParsedCompletion` when you want a direct completion to return schema-validated data:
|
|
100
114
|
|
|
101
115
|
```ts
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { A as AnyTool, e as ToolApprovalsOptions, d as ToolApprovalRequest } from '../tool-
|
|
2
|
-
export { b as ToolApprovalDecision } from '../tool-
|
|
3
|
-
import { k as ToolSearchDocument, l as ToolSet, A as AgentMiddleware, e as ToolMiddleware } from '../middleware-
|
|
4
|
-
export { C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, f as ToolOutputMiddlewareArgs, g as ToolOutputMiddlewareResult, h as ToolResultMiddlewareArgs, i as createMiddleware, j as createToolMiddleware } from '../middleware-
|
|
5
|
-
import { D as DynamicContextOptions,
|
|
6
|
-
export {
|
|
1
|
+
import { A as AnyTool, e as ToolApprovalsOptions, d as ToolApprovalRequest } from '../tool-tQWfAemw.js';
|
|
2
|
+
export { b as ToolApprovalDecision } from '../tool-tQWfAemw.js';
|
|
3
|
+
import { k as ToolSearchDocument, l as ToolSet, A as AgentMiddleware, e as ToolMiddleware } from '../middleware-ChM15MzS.js';
|
|
4
|
+
export { C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, f as ToolOutputMiddlewareArgs, g as ToolOutputMiddlewareResult, h as ToolResultMiddlewareArgs, i as createMiddleware, j as createToolMiddleware } from '../middleware-ChM15MzS.js';
|
|
5
|
+
import { D as DynamicContextOptions, d as DynamicToolOptions, P as PromptHook, e as AgentEventStore, f as AgentEventStoreOptions, A as Agent } from '../agent-DpjRlKHm.js';
|
|
6
|
+
export { g as AgentEventAppendInput, h as AgentEventRecord, i as AgentEventStoreInclude, C as CompletionCallHookArgs, j as CompletionErrorHookArgs, k as CompletionResponseHookArgs, H as HookAction, l as HookResult, R as RunControl, m as RunEndHookArgs, n as RunErrorHookArgs, o as RunStartHookArgs, T as ToolApprovalRequestOptions, p as ToolCallControl, q as ToolCallHookAction, u as ToolCallHookArgs, v as ToolCallHookResult, w as ToolErrorHookArgs, x as ToolHookArgs, y as ToolResultHookArgs, z as TurnEndHookArgs, B as TurnStartHookArgs, c as cancelPrompt, a as createHook, r as requestToolApproval, b as runControl, s as skipTool, t as toolCallControl } from '../agent-DpjRlKHm.js';
|
|
7
7
|
import { Z as ZodSchema } from '../zod-schema-C7F4clpm.js';
|
|
8
|
-
import { C as CompletionModel, e as JsonValue,
|
|
9
|
-
import { a as McpServer } from '../types-
|
|
8
|
+
import { C as CompletionModel, e as JsonValue, o as ToolChoice, M as Message } from '../types-ChMOgWQy.js';
|
|
9
|
+
import { a as McpServer } from '../types-DO_bx10g.js';
|
|
10
10
|
import { MemoryStore, MemoryOptions } from '../memory/index.js';
|
|
11
11
|
import { AgentObserver, ObserveOptions } from '../observability/index.js';
|
|
12
|
-
import { a as SkillSet } from '../types-
|
|
12
|
+
import { a as SkillSet } from '../types-vaEHqvr-.js';
|
|
13
13
|
import { VectorSearchIndex } from '../vector-store/index.js';
|
|
14
|
+
export { A as AgentChildStreamEvent, a as AgentStreamEvent, P as PromptResponse } from '../request-types-B9pyrfw6.js';
|
|
14
15
|
import '../types-IB2e9u5M.js';
|
|
15
16
|
import 'zod';
|
|
16
17
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
package/dist/agent/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentBuilder
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-753U5JNI.js";
|
|
4
4
|
import {
|
|
5
5
|
MaxTurnsError,
|
|
6
6
|
PromptCancelledError,
|
|
@@ -11,21 +11,21 @@ import {
|
|
|
11
11
|
runControl,
|
|
12
12
|
skipTool,
|
|
13
13
|
toolCallControl
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-RYEZK44O.js";
|
|
15
15
|
import "../chunk-XUUY2L2D.js";
|
|
16
16
|
import "../chunk-XXT2UCAR.js";
|
|
17
17
|
import "../chunk-YK4WAAS4.js";
|
|
18
18
|
import {
|
|
19
19
|
createMiddleware,
|
|
20
20
|
createToolMiddleware
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-IA47SXLS.js";
|
|
22
|
+
import "../chunk-66IJDP6L.js";
|
|
23
23
|
import "../chunk-MMHG7WAM.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-OIMLU4SF.js";
|
|
26
|
-
import "../chunk-S5IGJ4RB.js";
|
|
24
|
+
import "../chunk-FJNGCBYO.js";
|
|
27
25
|
import "../chunk-WJO6NVE2.js";
|
|
28
26
|
import "../chunk-WQKHFADH.js";
|
|
27
|
+
import "../chunk-FTO3W4UP.js";
|
|
28
|
+
import "../chunk-OIMLU4SF.js";
|
|
29
29
|
export {
|
|
30
30
|
AgentBuilder,
|
|
31
31
|
MaxTurnsError,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { M as Message, U as Usage, c as CompletionResponse, k as ToolResultContent,
|
|
1
|
+
import { M as Message, U as Usage, c as CompletionResponse, k as ToolResultContent, C as CompletionModel, D as Document, e as JsonValue, o as ToolChoice, J as JsonObject } from './types-ChMOgWQy.js';
|
|
2
2
|
import { MemoryContext, MemoryRegistration, SessionOptions } from './memory/index.js';
|
|
3
|
-
import {
|
|
4
|
-
import { A as AgentMiddleware, e as ToolMiddleware, l as ToolSet, k as ToolSearchDocument } from './middleware-
|
|
5
|
-
import { e as ToolApprovalsOptions, T as Tool, A as AnyTool, f as ToolCallContext, N as NormalizedToolOutput } from './tool-
|
|
3
|
+
import { AgentTraceOptions, AgentObserverRegistration } from './observability/index.js';
|
|
4
|
+
import { A as AgentMiddleware, e as ToolMiddleware, l as ToolSet, k as ToolSearchDocument } from './middleware-ChM15MzS.js';
|
|
5
|
+
import { e as ToolApprovalsOptions, T as Tool, A as AnyTool, f as ToolCallContext, N as NormalizedToolOutput } from './tool-tQWfAemw.js';
|
|
6
6
|
import { VectorFilter, VectorSearchResult, VectorSearchIndex } from './vector-store/index.js';
|
|
7
|
+
import { P as PromptResponse, a as AgentStreamEvent } from './request-types-B9pyrfw6.js';
|
|
7
8
|
|
|
8
9
|
type HookAction = {
|
|
9
10
|
type: "continue";
|
|
@@ -122,67 +123,6 @@ interface PromptHook<RawResponse = unknown> {
|
|
|
122
123
|
onToolError?: HookCallback<ToolErrorHookArgs>;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
type PromptResponse = {
|
|
126
|
-
output: string;
|
|
127
|
-
usage: Usage;
|
|
128
|
-
messages: Message[];
|
|
129
|
-
trace?: AgentTraceInfo | undefined;
|
|
130
|
-
};
|
|
131
|
-
type AgentChildStreamEvent<RawResponse = unknown> = {
|
|
132
|
-
type: "turn_start";
|
|
133
|
-
turn: number;
|
|
134
|
-
prompt: Message;
|
|
135
|
-
history: Message[];
|
|
136
|
-
} | {
|
|
137
|
-
type: "text_delta";
|
|
138
|
-
turn: number;
|
|
139
|
-
delta: string;
|
|
140
|
-
} | {
|
|
141
|
-
type: "reasoning_delta";
|
|
142
|
-
turn: number;
|
|
143
|
-
delta: string;
|
|
144
|
-
id?: string;
|
|
145
|
-
contentType?: ReasoningContentType;
|
|
146
|
-
signature?: string;
|
|
147
|
-
} | {
|
|
148
|
-
type: "tool_call";
|
|
149
|
-
turn: number;
|
|
150
|
-
toolCall: ToolCall;
|
|
151
|
-
} | {
|
|
152
|
-
type: "tool_result";
|
|
153
|
-
turn: number;
|
|
154
|
-
toolName: string;
|
|
155
|
-
toolCallId?: string;
|
|
156
|
-
internalCallId: string;
|
|
157
|
-
args: string;
|
|
158
|
-
result: string;
|
|
159
|
-
structuredResult?: ToolResultContent[] | undefined;
|
|
160
|
-
} | {
|
|
161
|
-
type: "turn_end";
|
|
162
|
-
turn: number;
|
|
163
|
-
response: CompletionResponse<RawResponse>;
|
|
164
|
-
} | {
|
|
165
|
-
type: "final";
|
|
166
|
-
runId: string;
|
|
167
|
-
output: string;
|
|
168
|
-
usage: Usage;
|
|
169
|
-
messages: Message[];
|
|
170
|
-
trace?: AgentTraceInfo | undefined;
|
|
171
|
-
} | {
|
|
172
|
-
type: "error";
|
|
173
|
-
error: unknown;
|
|
174
|
-
};
|
|
175
|
-
type AgentStreamEvent<RawResponse = unknown> = AgentChildStreamEvent<RawResponse> | {
|
|
176
|
-
type: "agent_tool_event";
|
|
177
|
-
turn: number;
|
|
178
|
-
toolName: string;
|
|
179
|
-
toolCallId?: string;
|
|
180
|
-
internalCallId: string;
|
|
181
|
-
agentId: string;
|
|
182
|
-
agentName?: string;
|
|
183
|
-
event: AgentChildStreamEvent<RawResponse>;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
126
|
declare class PromptRequest<M extends CompletionModel = CompletionModel> {
|
|
187
127
|
private readonly agent;
|
|
188
128
|
private readonly promptMessage;
|
|
@@ -374,4 +314,4 @@ declare class AgentSession<M extends CompletionModel = CompletionModel> {
|
|
|
374
314
|
clear(): Promise<void>;
|
|
375
315
|
}
|
|
376
316
|
|
|
377
|
-
export {
|
|
317
|
+
export { Agent as A, type TurnStartHookArgs as B, type CompletionCallHookArgs as C, type DynamicContextOptions as D, type AgentEventStoreRegistration as E, type AgentOptions as F, AgentSession as G, type HookAction as H, type AgentToolOptions as I, DEFAULT_MAX_TURNS as J, type DynamicContextRegistration as K, type DynamicToolRegistration as L, type PromptHook as P, type RunControl as R, type ToolApprovalRequestOptions as T, createHook as a, runControl as b, cancelPrompt as c, type DynamicToolOptions as d, type AgentEventStore as e, type AgentEventStoreOptions as f, type AgentEventAppendInput as g, type AgentEventRecord as h, type AgentEventStoreInclude as i, type CompletionErrorHookArgs as j, type CompletionResponseHookArgs as k, type HookResult as l, type RunEndHookArgs as m, type RunErrorHookArgs as n, type RunStartHookArgs as o, type ToolCallControl as p, type ToolCallHookAction as q, requestToolApproval as r, skipTool as s, toolCallControl as t, type ToolCallHookArgs as u, type ToolCallHookResult as v, type ToolErrorHookArgs as w, type ToolHookArgs as x, type ToolResultHookArgs as y, type TurnEndHookArgs as z };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compact
|
|
3
3
|
} from "./chunk-MMHG7WAM.js";
|
|
4
|
+
import {
|
|
5
|
+
toProviderJsonSchema
|
|
6
|
+
} from "./chunk-WQKHFADH.js";
|
|
4
7
|
import {
|
|
5
8
|
cosineSimilarity,
|
|
6
9
|
embedText
|
|
7
10
|
} from "./chunk-FTO3W4UP.js";
|
|
8
|
-
import {
|
|
9
|
-
toProviderJsonSchema
|
|
10
|
-
} from "./chunk-WQKHFADH.js";
|
|
11
11
|
|
|
12
12
|
// src/vector-store/index.ts
|
|
13
13
|
import { z } from "zod";
|
|
@@ -325,4 +325,4 @@ export {
|
|
|
325
325
|
InMemoryVectorIndex,
|
|
326
326
|
createVectorSearchTool
|
|
327
327
|
};
|
|
328
|
-
//# sourceMappingURL=chunk-
|
|
328
|
+
//# sourceMappingURL=chunk-66IJDP6L.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent,
|
|
3
3
|
normalizeAgentId
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RYEZK44O.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveMemoryOptions
|
|
7
7
|
} from "./chunk-XXT2UCAR.js";
|
|
8
8
|
import {
|
|
9
9
|
ToolSet
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IA47SXLS.js";
|
|
11
11
|
import {
|
|
12
12
|
toProviderJsonSchema
|
|
13
13
|
} from "./chunk-WQKHFADH.js";
|
|
@@ -203,4 +203,4 @@ var AgentBuilder = class {
|
|
|
203
203
|
export {
|
|
204
204
|
AgentBuilder
|
|
205
205
|
};
|
|
206
|
-
//# sourceMappingURL=chunk-
|
|
206
|
+
//# sourceMappingURL=chunk-753U5JNI.js.map
|