@anvia/core 1.0.0-rc.9 → 1.0.0
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 +99 -77
- package/dist/agent/index.d.ts +11 -16
- package/dist/agent/index.js +8 -8
- package/dist/{agent-XPQBM4rX.d.ts → agent-qRKa3ibC.d.ts} +11 -7
- package/dist/{chunk-PISJAAMX.js → chunk-3ZLM6OAZ.js} +318 -114
- package/dist/chunk-3ZLM6OAZ.js.map +1 -0
- package/dist/{chunk-WZVHZZW6.js → chunk-6BBOCFHV.js} +2 -2
- package/dist/{chunk-WTRGYFCD.js → chunk-7PHMK7W4.js} +4 -4
- package/dist/{chunk-X4LK4ODN.js → chunk-AHLKV6KP.js} +1 -1
- package/dist/chunk-AHLKV6KP.js.map +1 -0
- package/dist/chunk-J6LVLV6P.js +13 -0
- package/dist/chunk-J6LVLV6P.js.map +1 -0
- package/dist/{chunk-KIXN5DGS.js → chunk-LTXABCOO.js} +2 -2
- package/dist/{chunk-QOUPWOGW.js → chunk-SPD4XVR7.js} +1 -1
- package/dist/{chunk-TC4FILD3.js → chunk-YA7BMX7D.js} +51 -4
- package/dist/chunk-YA7BMX7D.js.map +1 -0
- package/dist/completion/index.js +2 -2
- package/dist/documents/index.js +26 -1
- package/dist/documents/index.js.map +1 -1
- package/dist/evals/index.d.ts +5 -5
- package/dist/evals/index.js +6 -6
- package/dist/evals/index.js.map +1 -1
- package/dist/extractor/index.js +3 -3
- package/dist/index.d.ts +7 -12
- package/dist/index.js +22 -20
- package/dist/internal/agent.d.ts +4 -9
- package/dist/internal/agent.js +8 -8
- package/dist/mcp/index.d.ts +3 -17
- package/dist/mcp/index.js +1 -15
- package/dist/memory/index.d.ts +6 -3
- package/dist/memory/index.js +6 -4
- package/dist/observability/index.d.ts +2 -2
- package/dist/observability/index.js +3 -3
- package/dist/pipeline/index.d.ts +6 -11
- package/dist/pipeline/index.js +6 -6
- package/dist/pipeline/index.js.map +1 -1
- package/dist/{types-Sue2hb_L.d.ts → types-CLCLFpAL.d.ts} +23 -15
- package/dist/{types-DKOXVTcq.d.ts → types-CSYt7-It.d.ts} +18 -3
- package/dist/types-DjqRHeAi.d.ts +31 -0
- package/package.json +10 -4
- package/dist/chunk-76JLMBVT.js +0 -716
- package/dist/chunk-76JLMBVT.js.map +0 -1
- package/dist/chunk-PISJAAMX.js.map +0 -1
- package/dist/chunk-TC4FILD3.js.map +0 -1
- package/dist/chunk-X4LK4ODN.js.map +0 -1
- package/dist/client-DTPl0hZv.d.ts +0 -84
- /package/dist/{chunk-WZVHZZW6.js.map → chunk-6BBOCFHV.js.map} +0 -0
- /package/dist/{chunk-WTRGYFCD.js.map → chunk-7PHMK7W4.js.map} +0 -0
- /package/dist/{chunk-KIXN5DGS.js.map → chunk-LTXABCOO.js.map} +0 -0
- /package/dist/{chunk-QOUPWOGW.js.map → chunk-SPD4XVR7.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import { AgentInteractionRequest, AgentContinuation, AgentInteractionResponse }
|
|
|
2
2
|
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
3
3
|
import { M as Message, g as CompletionResponse, U as Usage, R as ReasoningContentType, u as ToolCallPart, i as CompletionSource, r as ProviderToolCall, G as UserMessage, C as CompletionFinishReason, l as ContextUsage, f as CompletionRequest, z as ToolResultOutput, y as ToolResultContentPart, _ as ToolInteractionResponsePart, Z as ToolCallArgumentsMode, J as JsonObject, V as CompletionModelCapabilities, w as ToolDefinition } from './types-DgvozfPc.js';
|
|
4
4
|
import { d as GuardrailPolicyInput, a as GuardrailDecisionRecord } from './types-DhkodEft.js';
|
|
5
|
-
import { e as MemoryCompactionInfo,
|
|
5
|
+
import { e as MemoryCompactionInfo, A as MemoryScope } from './types-CSYt7-It.js';
|
|
6
6
|
import { D as DeepReadonly, M as MaybePromise } from './type-utils-CtHVDRn_.js';
|
|
7
7
|
import { d as ToolCallStreamEvent } from './tool-BpqpoRSE.js';
|
|
8
8
|
import { A as AgentMiddleware } from './middleware-kcF8AusP.js';
|
|
@@ -104,11 +104,15 @@ type AgentRunSettings<Output = string, RawResponse = unknown> = {
|
|
|
104
104
|
trace?: AgentTraceOptions | undefined;
|
|
105
105
|
};
|
|
106
106
|
type AgentRunOptions<Output = string, RawResponse = unknown> = AgentInput & AgentRunSettings<Output, RawResponse>;
|
|
107
|
+
type AgentMemoryCompactionOptions = {
|
|
108
|
+
session: MemoryScope;
|
|
109
|
+
abortSignal?: AbortSignal | undefined;
|
|
110
|
+
};
|
|
107
111
|
type AgentRunLink = Readonly<{
|
|
108
112
|
runId: string;
|
|
109
113
|
interactionId: string;
|
|
110
114
|
}>;
|
|
111
|
-
type
|
|
115
|
+
type AgentOutcomeBase = {
|
|
112
116
|
runId: string;
|
|
113
117
|
text: string;
|
|
114
118
|
usage: Usage;
|
|
@@ -123,20 +127,22 @@ type AgentResultBase = {
|
|
|
123
127
|
memoryCompaction?: MemoryCompactionInfo | undefined;
|
|
124
128
|
resumedFrom?: AgentRunLink | undefined;
|
|
125
129
|
};
|
|
126
|
-
type AgentResponse<Output = string> =
|
|
127
|
-
|
|
130
|
+
type AgentResponse<Output = string> = AgentOutcomeBase & {
|
|
131
|
+
type: "response";
|
|
128
132
|
output: Output;
|
|
129
133
|
};
|
|
130
|
-
type
|
|
131
|
-
|
|
134
|
+
type AgentBlockedOutcome = AgentOutcomeBase & {
|
|
135
|
+
type: "blocked";
|
|
132
136
|
stage: "input" | "output";
|
|
137
|
+
reason: string;
|
|
138
|
+
message?: string | undefined;
|
|
133
139
|
};
|
|
134
|
-
type
|
|
135
|
-
|
|
140
|
+
type AgentInteractionOutcome = AgentOutcomeBase & {
|
|
141
|
+
type: "interaction";
|
|
136
142
|
interaction: AgentInteractionRequest;
|
|
137
143
|
continuation: AgentContinuation;
|
|
138
144
|
};
|
|
139
|
-
type
|
|
145
|
+
type AgentOutcome<Output = string> = AgentResponse<Output> | AgentBlockedOutcome | AgentInteractionOutcome;
|
|
140
146
|
type AgentDeltaEvent = {
|
|
141
147
|
type: "text_delta";
|
|
142
148
|
delta: string;
|
|
@@ -241,10 +247,7 @@ type AgentChildStreamEventBase<Output = string, RawResponse = unknown> = {
|
|
|
241
247
|
type: "guardrail_decision";
|
|
242
248
|
turn?: number | undefined;
|
|
243
249
|
decision: GuardrailDecisionRecord;
|
|
244
|
-
} | AgentMemoryCompactionEvent | AgentInteractionResponseEvent | AgentSteeringAppliedEvent |
|
|
245
|
-
type: "final";
|
|
246
|
-
result: AgentResult<Output>;
|
|
247
|
-
} | AgentErrorStreamEvent;
|
|
250
|
+
} | AgentMemoryCompactionEvent | AgentInteractionResponseEvent | AgentSteeringAppliedEvent | AgentOutcome<Output> | AgentErrorStreamEvent;
|
|
248
251
|
type AgentChildStreamEvent<Output = string, RawResponse = unknown> = AgentChildStreamEventBase<Output, RawResponse> | AgentToolCallDeltaEvent;
|
|
249
252
|
type AgentToolStreamEvent = {
|
|
250
253
|
type: "agent_tool_event";
|
|
@@ -257,8 +260,13 @@ type AgentToolStreamEvent = {
|
|
|
257
260
|
event: AgentChildStreamEvent<unknown, unknown>;
|
|
258
261
|
};
|
|
259
262
|
type AgentStreamEvent<Output = string, RawResponse = unknown> = AgentChildStreamEvent<Output, RawResponse> | AgentToolStreamEvent;
|
|
260
|
-
interface AgentStream<
|
|
263
|
+
interface AgentStream<Output = string, RawResponse = unknown> extends AsyncIterable<AgentStreamEvent<Output, RawResponse>> {
|
|
264
|
+
readonly events: AsyncIterable<AgentStreamEvent<Output, RawResponse>>;
|
|
265
|
+
readonly textStream: AsyncIterable<string>;
|
|
266
|
+
readonly text: Promise<string>;
|
|
267
|
+
readonly result: Promise<AgentOutcome<Output>>;
|
|
261
268
|
steer(input: AgentSteerInput): AgentSteerReceipt;
|
|
269
|
+
cancel(reason?: string): void;
|
|
262
270
|
}
|
|
263
271
|
|
|
264
272
|
type AgentTraceInfo = {
|
|
@@ -400,4 +408,4 @@ type AgentObservabilityOptions<Observers extends AgentObserverMap = AgentObserve
|
|
|
400
408
|
readonly errorPolicy?: AgentObserverErrorPolicy | undefined;
|
|
401
409
|
};
|
|
402
410
|
|
|
403
|
-
export type {
|
|
411
|
+
export type { AgentBlockedOutcome as A, AgentGenerationModelInfo as B, AgentGenerationObserver as C, AgentGenerationStartArgs as D, AgentGenerationUpdateArgs as E, AgentObservabilityOptions as F, AgentObserver as G, AgentObserverErrorPolicy as H, AgentObserverMap as I, AgentObserverTraceInfo as J, AgentRunEndArgs as K, AgentRunErrorArgs as L, AgentRunEventArgs as M, AgentRunObserver as N, AgentRunPromptRef as O, AgentRunStartArgs as P, AgentToolEndArgs as Q, AgentToolErrorArgs as R, AgentToolObserver as S, AgentToolStartArgs as T, AgentToolStreamEventArgs as U, AgentToolSuspendedArgs as V, AgentTraceInfo as W, AgentTraceOptions as X, AgentChildStreamEvent as a, AgentDeltaEvent as b, AgentErrorEvent as c, AgentErrorStreamEvent as d, AgentFinishEvent as e, AgentInput as f, AgentInteractionOutcome as g, AgentLifecycle as h, AgentMemoryCompactionEvent as i, AgentMemoryCompactionOptions as j, AgentOutcome as k, AgentPrompt as l, AgentResponse as m, AgentRunOptions as n, AgentRunSettings as o, AgentStartEvent as p, AgentSteerInput as q, AgentSteerReceipt as r, AgentStepFinishEvent as s, AgentStream as t, AgentStreamEvent as u, AgentToolCallDeltaEvent as v, AgentToolFinishEvent as w, AgentToolStartEvent as x, AgentGenerationEndArgs as y, AgentGenerationErrorArgs as z };
|
|
@@ -119,6 +119,8 @@ type MemoryCompactorResult = {
|
|
|
119
119
|
usage?: Usage | undefined;
|
|
120
120
|
};
|
|
121
121
|
type MemoryCompactor = (input: MemoryCompactorInput) => Promise<MemoryCompactorResult>;
|
|
122
|
+
/** Counts the approximate or exact model tokens represented by a message list. */
|
|
123
|
+
type MemoryTokenCounter = (messages: readonly Message[]) => number | Promise<number>;
|
|
122
124
|
type CreateSummaryMemoryCompactorOptions = {
|
|
123
125
|
model: CompletionModel;
|
|
124
126
|
instructions?: string | undefined;
|
|
@@ -132,11 +134,12 @@ type MemoryCompactionConflictRetryOptions = {
|
|
|
132
134
|
};
|
|
133
135
|
type MemoryCompactionOptions = {
|
|
134
136
|
trigger: {
|
|
135
|
-
|
|
137
|
+
afterTokens: number;
|
|
136
138
|
};
|
|
137
139
|
retention?: {
|
|
138
|
-
|
|
140
|
+
recentTokens?: number | undefined;
|
|
139
141
|
};
|
|
142
|
+
tokenCounter?: MemoryTokenCounter | undefined;
|
|
140
143
|
compactor: MemoryCompactor;
|
|
141
144
|
conflictRetries?: false | MemoryCompactionConflictRetryOptions | undefined;
|
|
142
145
|
};
|
|
@@ -148,8 +151,20 @@ type MemoryCompactionInfo = {
|
|
|
148
151
|
originalMessageCount: number;
|
|
149
152
|
compactedMessageCount: number;
|
|
150
153
|
retainedMessageCount: number;
|
|
154
|
+
originalTokenCount: number;
|
|
155
|
+
compactedTokenCount: number;
|
|
156
|
+
retainedTokenCount: number;
|
|
157
|
+
resultTokenCount: number;
|
|
151
158
|
attempts: number;
|
|
152
159
|
usage: Usage;
|
|
153
160
|
};
|
|
161
|
+
type MemoryCompactionResult = ({
|
|
162
|
+
type: "compacted";
|
|
163
|
+
} & MemoryCompactionInfo) | {
|
|
164
|
+
type: "skipped";
|
|
165
|
+
reason: "nothing_to_compact";
|
|
166
|
+
originalMessageCount: number;
|
|
167
|
+
originalTokenCount: number;
|
|
168
|
+
};
|
|
154
169
|
|
|
155
|
-
export type {
|
|
170
|
+
export type { MemoryScope as A, MemoryScopeKeyOptions as B, CreateMemoryScopeKeyOptions as C, MemoryScopeKeyResolver as D, MemoryStore as E, MemoryTokenCounter as F, MemoryAppendOptions as M, CreateSummaryMemoryCompactorOptions as a, MemoryClearOptions as b, MemoryCompactionCapability as c, MemoryCompactionConflictRetryOptions as d, MemoryCompactionInfo as e, MemoryCompactionMessage as f, MemoryCompactionMetadata as g, MemoryCompactionOptions as h, MemoryCompactionReplacePrefixOptions as i, MemoryCompactionReplacePrefixResult as j, MemoryCompactionResult as k, MemoryCompactionSnapshot as l, MemoryCompactionSnapshotOptions as m, MemoryCompactor as n, MemoryCompactorInput as o, MemoryCompactorResult as p, MemoryConversation as q, MemoryConversationGetOptions as r, MemoryConversationListOptions as s, MemoryConversationMessage as t, MemoryConversationSummary as u, MemoryErrorOptions as v, MemoryInspector as w, MemoryLoadOptions as x, MemoryOptions as y, MemorySavePolicy as z };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { J as JsonObject } from './types-DgvozfPc.js';
|
|
2
|
+
import { A as AnyTool } from './tool-BpqpoRSE.js';
|
|
3
|
+
|
|
4
|
+
type McpServerInfo = {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly version: string;
|
|
7
|
+
readonly title?: string | undefined;
|
|
8
|
+
readonly description?: string | undefined;
|
|
9
|
+
readonly websiteUrl?: string | undefined;
|
|
10
|
+
readonly icons?: readonly {
|
|
11
|
+
readonly src: string;
|
|
12
|
+
readonly mimeType?: string | undefined;
|
|
13
|
+
readonly sizes?: readonly string[] | undefined;
|
|
14
|
+
readonly theme?: "light" | "dark" | undefined;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
type McpTool = AnyTool & {
|
|
18
|
+
readonly mcp: {
|
|
19
|
+
readonly serverName: string;
|
|
20
|
+
readonly remoteName: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type McpServer = {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly tools: readonly McpTool[];
|
|
26
|
+
readonly serverInfo?: McpServerInfo | undefined;
|
|
27
|
+
readonly capabilities?: JsonObject | undefined;
|
|
28
|
+
readonly instructions?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type { McpTool as M, McpServer as a, McpServerInfo as b };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvia/core",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Core runtime primitives for context-aware Anvia agents.",
|
|
5
5
|
"author": "anvia",
|
|
6
6
|
"maintainer": "Indra Zulfi",
|
|
@@ -111,18 +111,24 @@
|
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
|
-
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
115
|
-
"pdfjs-dist": "^6.2.108",
|
|
116
|
-
"undici": "^8.10.0",
|
|
117
114
|
"yaml": "^2.9.0",
|
|
118
115
|
"zod": "^4.4.3"
|
|
119
116
|
},
|
|
120
117
|
"devDependencies": {
|
|
121
118
|
"@types/node": "^24.9.1",
|
|
119
|
+
"pdfjs-dist": "^6.2.108",
|
|
122
120
|
"tsup": "^8.5.0",
|
|
123
121
|
"typescript": "^5.9.3",
|
|
124
122
|
"vitest": "^4.0.8"
|
|
125
123
|
},
|
|
124
|
+
"peerDependencies": {
|
|
125
|
+
"pdfjs-dist": "^6.2.108"
|
|
126
|
+
},
|
|
127
|
+
"peerDependenciesMeta": {
|
|
128
|
+
"pdfjs-dist": {
|
|
129
|
+
"optional": true
|
|
130
|
+
}
|
|
131
|
+
},
|
|
126
132
|
"scripts": {
|
|
127
133
|
"build": "tsup src/index.ts src/agent/index.ts src/agent/interactions/index.ts src/internal/agent.ts src/speech-generation/index.ts src/completion/index.ts src/embeddings/index.ts src/evals/index.ts src/image-generation/index.ts src/documents/index.ts src/extractor/index.ts src/guardrails/index.ts src/mcp/index.ts src/memory/index.ts src/model-listing/index.ts src/observability/index.ts src/pipeline/index.ts src/skills/index.ts src/streaming/index.ts src/tool/index.ts src/transcription/index.ts src/vector-store/index.ts --format esm --dts --sourcemap --clean",
|
|
128
134
|
"test": "vitest run",
|