@anvia/core 1.0.0-rc.1 → 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.
- package/README.md +283 -84
- package/dist/agent/index.d.ts +26 -18
- package/dist/agent/index.js +19 -15
- package/dist/agent-yBG8e9Jj.d.ts +153 -0
- package/dist/chunk-4WI3VGZK.js +127 -0
- package/dist/chunk-4WI3VGZK.js.map +1 -0
- package/dist/{chunk-R2LJSQUW.js → chunk-77AIYARB.js} +251 -104
- package/dist/chunk-77AIYARB.js.map +1 -0
- package/dist/chunk-AI5JMUW7.js +45 -0
- package/dist/chunk-AI5JMUW7.js.map +1 -0
- package/dist/chunk-BEYBU7VJ.js +53 -0
- package/dist/chunk-BEYBU7VJ.js.map +1 -0
- package/dist/chunk-CWM7B2OO.js +315 -0
- package/dist/chunk-CWM7B2OO.js.map +1 -0
- package/dist/{chunk-6WGGTJE6.js → chunk-D37WMSP6.js} +52 -60
- package/dist/chunk-D37WMSP6.js.map +1 -0
- package/dist/{chunk-IL3ZSNJI.js → chunk-DBSCKTUL.js} +845 -800
- package/dist/chunk-DBSCKTUL.js.map +1 -0
- package/dist/chunk-EINTGEGY.js +629 -0
- package/dist/chunk-EINTGEGY.js.map +1 -0
- package/dist/chunk-FMHLROPQ.js +351 -0
- package/dist/chunk-FMHLROPQ.js.map +1 -0
- package/dist/{chunk-A3UBYTJT.js → chunk-FN7HLLAZ.js} +60 -6
- package/dist/chunk-FN7HLLAZ.js.map +1 -0
- package/dist/chunk-GKDERULJ.js +50 -0
- package/dist/chunk-GKDERULJ.js.map +1 -0
- package/dist/{chunk-FNQB2JEH.js → chunk-KIDGIJM7.js} +26 -5
- package/dist/chunk-KIDGIJM7.js.map +1 -0
- package/dist/chunk-KR3RCCHJ.js +500 -0
- package/dist/chunk-KR3RCCHJ.js.map +1 -0
- package/dist/{chunk-I6G7BC42.js → chunk-MGNTXGTX.js} +2 -6
- package/dist/chunk-MGNTXGTX.js.map +1 -0
- package/dist/{chunk-5XKDW36Z.js → chunk-OJH6HWHX.js} +64 -75
- package/dist/chunk-OJH6HWHX.js.map +1 -0
- package/dist/chunk-QOUPWOGW.js +29 -0
- package/dist/chunk-QOUPWOGW.js.map +1 -0
- package/dist/chunk-TIZYTPJO.js +208 -0
- package/dist/chunk-TIZYTPJO.js.map +1 -0
- package/dist/{chunk-DMPUP4R3.js → chunk-XKYYBABH.js} +5 -5
- package/dist/client-B8DT1vUG.d.ts +83 -0
- package/dist/completion/index.d.ts +5 -4
- package/dist/completion/index.js +25 -28
- package/dist/{dynamic-tools-i9woysFa.d.ts → dynamic-tools-KwEGRbHp.d.ts} +21 -9
- package/dist/embeddings/index.d.ts +11 -9
- package/dist/embeddings/index.js +2 -3
- package/dist/evals/index.d.ts +44 -24
- package/dist/evals/index.js +86 -69
- package/dist/evals/index.js.map +1 -1
- package/dist/extractor/index.d.ts +23 -26
- package/dist/extractor/index.js +7 -8
- package/dist/guardrails/index.d.ts +2 -1
- package/dist/guardrails/index.js +1 -1
- package/dist/image-generation/index.d.ts +18 -16
- package/dist/image-generation/index.js +2 -2
- package/dist/index.d.ts +24 -22
- package/dist/index.js +50 -48
- package/dist/internal/agent.d.ts +30 -19
- package/dist/internal/agent.js +13 -11
- package/dist/loaders/index.d.ts +2 -1
- package/dist/mcp/index.d.ts +19 -13
- package/dist/mcp/index.js +13 -348
- package/dist/mcp/index.js.map +1 -1
- package/dist/memory/index.d.ts +20 -6
- package/dist/memory/index.js +10 -10
- package/dist/message-schema-Cn7ezRfJ.d.ts +52 -0
- package/dist/{middleware-KynLg_RW.d.ts → middleware-C7PdmKF7.d.ts} +4 -4
- package/dist/model-call-options-CZkSw_xN.d.ts +6 -0
- package/dist/model-listing/index.d.ts +3 -1
- package/dist/observability/index.d.ts +19 -5
- package/dist/observability/index.js +8 -5
- package/dist/observability/index.js.map +1 -1
- package/dist/pipeline/index.d.ts +105 -56
- package/dist/pipeline/index.js +422 -230
- package/dist/pipeline/index.js.map +1 -1
- package/dist/{retry-D3Ruy-ba.d.ts → retry-CjvSlKGW.d.ts} +2 -1
- package/dist/skills/index.d.ts +5 -4
- package/dist/skills/index.js +7 -7
- package/dist/speech-generation/index.d.ts +37 -0
- package/dist/speech-generation/index.js +8 -0
- package/dist/{think-tool-DZqZj2LV.d.ts → think-tool-6H2QNQzQ.d.ts} +1 -1
- package/dist/tool/index.d.ts +9 -7
- package/dist/tool/index.js +7 -10
- package/dist/{tool-C_8GudXn.d.ts → tool--Mz4v1eL.d.ts} +15 -7
- package/dist/transcription/index.d.ts +23 -14
- package/dist/transcription/index.js +2 -2
- package/dist/{index-DxB74ybJ.d.ts → types-3x3mOLHU.d.ts} +94 -64
- package/dist/types-BVzM4RsC.d.ts +155 -0
- package/dist/types-CQ_ioXWK.d.ts +319 -0
- package/dist/types-Cr4uiYo5.d.ts +99 -0
- package/dist/{types-DhQfwiZn.d.ts → types-DiJqJejp.d.ts} +1 -1
- package/dist/types-Dld1TpWj.d.ts +130 -0
- package/dist/vector-store/index.d.ts +33 -34
- package/dist/vector-store/index.js +6 -6
- package/package.json +6 -10
- package/dist/agent-DGYY_onS.d.ts +0 -145
- package/dist/audio-generation/index.d.ts +0 -31
- package/dist/audio-generation/index.js +0 -8
- package/dist/chunk-5XKDW36Z.js.map +0 -1
- package/dist/chunk-6WGGTJE6.js.map +0 -1
- package/dist/chunk-A3UBYTJT.js.map +0 -1
- package/dist/chunk-ADH7NNCS.js +0 -512
- package/dist/chunk-ADH7NNCS.js.map +0 -1
- package/dist/chunk-DZ3CKYTH.js +0 -267
- package/dist/chunk-DZ3CKYTH.js.map +0 -1
- package/dist/chunk-FNQB2JEH.js.map +0 -1
- package/dist/chunk-I6G7BC42.js.map +0 -1
- package/dist/chunk-IL3ZSNJI.js.map +0 -1
- package/dist/chunk-J6GNQART.js +0 -122
- package/dist/chunk-J6GNQART.js.map +0 -1
- package/dist/chunk-M3IOWB4Y.js +0 -280
- package/dist/chunk-M3IOWB4Y.js.map +0 -1
- package/dist/chunk-QY5GZ7HR.js +0 -39
- package/dist/chunk-QY5GZ7HR.js.map +0 -1
- package/dist/chunk-R2LJSQUW.js.map +0 -1
- package/dist/chunk-RFDVKCIE.js +0 -12
- package/dist/chunk-RFDVKCIE.js.map +0 -1
- package/dist/chunk-RMUBRRSK.js +0 -34
- package/dist/chunk-RMUBRRSK.js.map +0 -1
- package/dist/chunk-RXKHOYEH.js +0 -466
- package/dist/chunk-RXKHOYEH.js.map +0 -1
- package/dist/chunk-XDRSPSR7.js +0 -38
- package/dist/chunk-XDRSPSR7.js.map +0 -1
- package/dist/chunk-XWUC7CIT.js +0 -1
- package/dist/chunk-XWUC7CIT.js.map +0 -1
- package/dist/errors-CYKUcU89.d.ts +0 -17
- package/dist/json-Zo7K3xmt.d.ts +0 -40
- package/dist/types-B3A4YxaA.d.ts +0 -354
- package/dist/types-BBEGKB9m.d.ts +0 -119
- package/dist/types-DT3nEemY.d.ts +0 -79
- package/dist/types-DulRCYdB.d.ts +0 -70
- package/dist/types-p55Jc-sr.d.ts +0 -47
- package/dist/ui/index.d.ts +0 -107
- package/dist/ui/index.js +0 -10
- package/dist/ui/index.js.map +0 -1
- /package/dist/{chunk-DMPUP4R3.js.map → chunk-XKYYBABH.js.map} +0 -0
- /package/dist/{audio-generation → speech-generation}/index.js.map +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { M as Message,
|
|
1
|
+
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
2
|
+
import { M as Message, f as CompletionResponse, U as Usage, R as ReasoningContentType, t as ToolCallPart, h as CompletionSource, q as ProviderToolCall, E as UserMessage, k as ContextUsage, e as CompletionRequest, y as ToolResultOutput, x as ToolResultContentPart, X as ToolCallArgumentsMode, J as JsonObject, Q as CompletionModelCapabilities, v as ToolDefinition } from './types-CQ_ioXWK.js';
|
|
3
3
|
import { GuardrailPolicyInput, GuardrailDecisionRecord } from './guardrails/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { e as MemoryCompactionInfo, z as MemoryScope } from './types-BVzM4RsC.js';
|
|
5
5
|
import { D as DeepReadonly, M as MaybePromise } from './type-utils-CtHVDRn_.js';
|
|
6
|
-
import { d as ToolCallStreamEvent } from './tool
|
|
6
|
+
import { d as ToolCallStreamEvent } from './tool--Mz4v1eL.js';
|
|
7
|
+
import { A as AgentMiddleware } from './middleware-C7PdmKF7.js';
|
|
7
8
|
|
|
8
9
|
type AgentLifecycleRunEvent = {
|
|
9
10
|
runId: string;
|
|
@@ -34,39 +35,64 @@ type AgentToolFinishEvent = (AgentToolFinishEventBase & {
|
|
|
34
35
|
success: false;
|
|
35
36
|
error: unknown;
|
|
36
37
|
});
|
|
37
|
-
type
|
|
38
|
-
|
|
38
|
+
type AgentFinishEventBase = AgentLifecycleRunEvent & {
|
|
39
|
+
text: string;
|
|
39
40
|
usage: DeepReadonly<Usage>;
|
|
40
41
|
messages: DeepReadonly<Message[]>;
|
|
42
|
+
memoryCompaction?: DeepReadonly<MemoryCompactionInfo> | undefined;
|
|
41
43
|
};
|
|
44
|
+
type AgentFinishEvent<Output = string> = (AgentFinishEventBase & {
|
|
45
|
+
status: "completed";
|
|
46
|
+
output: DeepReadonly<Output>;
|
|
47
|
+
}) | (AgentFinishEventBase & {
|
|
48
|
+
status: "blocked";
|
|
49
|
+
stage: "input" | "output";
|
|
50
|
+
});
|
|
42
51
|
type AgentErrorEvent = AgentLifecycleRunEvent & {
|
|
43
52
|
error: unknown;
|
|
44
53
|
usage: DeepReadonly<Usage>;
|
|
45
54
|
messages: DeepReadonly<Message[]>;
|
|
46
55
|
};
|
|
47
|
-
type AgentLifecycle<RawResponse = unknown> = {
|
|
56
|
+
type AgentLifecycle<Output = string, RawResponse = unknown> = {
|
|
48
57
|
onStart?(event: AgentStartEvent): MaybePromise<void>;
|
|
49
58
|
onStepFinish?(event: AgentStepFinishEvent<RawResponse>): MaybePromise<void>;
|
|
50
59
|
onToolStart?(event: AgentToolStartEvent): MaybePromise<void>;
|
|
51
60
|
onToolFinish?(event: AgentToolFinishEvent): MaybePromise<void>;
|
|
52
|
-
onFinish?(event: AgentFinishEvent): MaybePromise<void>;
|
|
61
|
+
onFinish?(event: AgentFinishEvent<Output>): MaybePromise<void>;
|
|
53
62
|
onError?(event: AgentErrorEvent): MaybePromise<void>;
|
|
54
63
|
};
|
|
55
64
|
|
|
56
|
-
type
|
|
57
|
-
type
|
|
65
|
+
type AgentPrompt = string | UserMessage;
|
|
66
|
+
type AgentInput = {
|
|
67
|
+
prompt: AgentPrompt;
|
|
68
|
+
messages?: never;
|
|
69
|
+
session?: MemoryScope | undefined;
|
|
70
|
+
} | {
|
|
71
|
+
messages: readonly Message[];
|
|
72
|
+
prompt?: never;
|
|
73
|
+
session?: never;
|
|
74
|
+
};
|
|
75
|
+
type AgentSteerInput = {
|
|
76
|
+
prompt: AgentPrompt;
|
|
77
|
+
messages?: never;
|
|
78
|
+
} | {
|
|
79
|
+
messages: readonly UserMessage[];
|
|
80
|
+
prompt?: never;
|
|
81
|
+
};
|
|
82
|
+
type AgentRunSettings<Output = string, RawResponse = unknown> = {
|
|
58
83
|
maxTurns?: number | undefined;
|
|
59
|
-
retries?:
|
|
60
|
-
|
|
84
|
+
retries?: RetrySetting | undefined;
|
|
85
|
+
abortSignal?: AbortSignal | undefined;
|
|
86
|
+
lifecycle?: AgentLifecycle<Output, RawResponse> | undefined;
|
|
61
87
|
guardrails?: GuardrailPolicyInput | undefined;
|
|
62
88
|
toolConcurrency?: number | undefined;
|
|
63
89
|
middlewares?: readonly AgentMiddleware[] | undefined;
|
|
64
90
|
trace?: AgentTraceOptions | undefined;
|
|
65
91
|
};
|
|
66
|
-
type
|
|
67
|
-
|
|
92
|
+
type AgentRunOptions<Output = string, RawResponse = unknown> = AgentInput & AgentRunSettings<Output, RawResponse>;
|
|
93
|
+
type AgentResultBase = {
|
|
68
94
|
runId: string;
|
|
69
|
-
|
|
95
|
+
text: string;
|
|
70
96
|
usage: Usage;
|
|
71
97
|
contextUsage?: ContextUsage | undefined;
|
|
72
98
|
messages: Message[];
|
|
@@ -74,6 +100,15 @@ type AgentResponse = {
|
|
|
74
100
|
guardrails?: GuardrailDecisionRecord[] | undefined;
|
|
75
101
|
sources?: CompletionSource[] | undefined;
|
|
76
102
|
providerToolCalls?: ProviderToolCall[] | undefined;
|
|
103
|
+
memoryCompaction?: MemoryCompactionInfo | undefined;
|
|
104
|
+
};
|
|
105
|
+
type AgentResponse<Output = string> = AgentResultBase & {
|
|
106
|
+
status: "completed";
|
|
107
|
+
output: Output;
|
|
108
|
+
};
|
|
109
|
+
type AgentBlockedResult = AgentResultBase & {
|
|
110
|
+
status: "blocked";
|
|
111
|
+
stage: "input" | "output";
|
|
77
112
|
};
|
|
78
113
|
type AgentApprovalRequiredResult = {
|
|
79
114
|
status: "approval_required";
|
|
@@ -81,8 +116,9 @@ type AgentApprovalRequiredResult = {
|
|
|
81
116
|
approval: AgentToolApprovalRequest;
|
|
82
117
|
usage: Usage;
|
|
83
118
|
messages: Message[];
|
|
119
|
+
memoryCompaction?: MemoryCompactionInfo | undefined;
|
|
84
120
|
};
|
|
85
|
-
type AgentResult = AgentResponse | AgentApprovalRequiredResult;
|
|
121
|
+
type AgentResult<Output = string> = AgentResponse<Output> | AgentBlockedResult | AgentApprovalRequiredResult;
|
|
86
122
|
type AgentToolApprovalRequest = {
|
|
87
123
|
id: string;
|
|
88
124
|
toolName: string;
|
|
@@ -111,7 +147,7 @@ type AgentDeltaEvent = {
|
|
|
111
147
|
signature?: string;
|
|
112
148
|
} | {
|
|
113
149
|
type: "tool_call";
|
|
114
|
-
toolCall:
|
|
150
|
+
toolCall: ToolCallPart;
|
|
115
151
|
} | {
|
|
116
152
|
type: "source";
|
|
117
153
|
source: CompletionSource;
|
|
@@ -124,10 +160,6 @@ type AgentErrorStreamEvent = {
|
|
|
124
160
|
error: unknown;
|
|
125
161
|
usage: Usage;
|
|
126
162
|
};
|
|
127
|
-
type AgentStreamOptions = AgentRunOptions & {
|
|
128
|
-
/** @default true */
|
|
129
|
-
includeToolCallDeltas?: boolean;
|
|
130
|
-
};
|
|
131
163
|
type AgentToolCallDeltaEvent = {
|
|
132
164
|
type: "tool_call_delta";
|
|
133
165
|
turn: number;
|
|
@@ -138,7 +170,10 @@ type AgentToolCallDeltaEvent = {
|
|
|
138
170
|
argumentsMode?: ToolCallArgumentsMode;
|
|
139
171
|
signature?: string;
|
|
140
172
|
};
|
|
141
|
-
type
|
|
173
|
+
type AgentMemoryCompactionEvent = MemoryCompactionInfo & {
|
|
174
|
+
type: "memory_compaction";
|
|
175
|
+
};
|
|
176
|
+
type AgentChildStreamEventBase<Output = string, RawResponse = unknown> = {
|
|
142
177
|
type: "turn_start";
|
|
143
178
|
turn: number;
|
|
144
179
|
prompt: Message;
|
|
@@ -162,7 +197,7 @@ type AgentChildStreamEventBase<RawResponse = unknown> = {
|
|
|
162
197
|
} | {
|
|
163
198
|
type: "tool_call";
|
|
164
199
|
turn: number;
|
|
165
|
-
toolCall:
|
|
200
|
+
toolCall: ToolCallPart;
|
|
166
201
|
} | {
|
|
167
202
|
type: "source";
|
|
168
203
|
turn: number;
|
|
@@ -175,11 +210,13 @@ type AgentChildStreamEventBase<RawResponse = unknown> = {
|
|
|
175
210
|
type: "tool_result";
|
|
176
211
|
turn: number;
|
|
177
212
|
toolName: string;
|
|
178
|
-
toolCallId
|
|
213
|
+
toolCallId: string;
|
|
214
|
+
callId?: string;
|
|
179
215
|
internalCallId: string;
|
|
180
216
|
args: string;
|
|
217
|
+
output: ToolResultOutput;
|
|
181
218
|
result: string;
|
|
182
|
-
structuredResult?:
|
|
219
|
+
structuredResult?: readonly ToolResultContentPart[] | undefined;
|
|
183
220
|
} | {
|
|
184
221
|
type: "turn_end";
|
|
185
222
|
turn: number;
|
|
@@ -189,22 +226,12 @@ type AgentChildStreamEventBase<RawResponse = unknown> = {
|
|
|
189
226
|
type: "guardrail_decision";
|
|
190
227
|
turn?: number | undefined;
|
|
191
228
|
decision: GuardrailDecisionRecord;
|
|
192
|
-
} | {
|
|
229
|
+
} | AgentMemoryCompactionEvent | {
|
|
193
230
|
type: "final";
|
|
194
|
-
|
|
195
|
-
output: string;
|
|
196
|
-
usage: Usage;
|
|
197
|
-
contextUsage?: ContextUsage | undefined;
|
|
198
|
-
messages: Message[];
|
|
199
|
-
trace?: AgentTraceInfo | undefined;
|
|
200
|
-
guardrails?: GuardrailDecisionRecord[] | undefined;
|
|
201
|
-
sources?: CompletionSource[] | undefined;
|
|
202
|
-
providerToolCalls?: ProviderToolCall[] | undefined;
|
|
231
|
+
result: AgentResponse<Output> | AgentBlockedResult;
|
|
203
232
|
} | AgentApprovalRequiredEvent | AgentErrorStreamEvent;
|
|
204
|
-
type
|
|
205
|
-
type
|
|
206
|
-
type AgentChildStreamEventWithToolCallDeltas<RawResponse = unknown> = AgentChildStreamEvent<RawResponse>;
|
|
207
|
-
type AgentToolStreamEvent<ChildEvent> = {
|
|
233
|
+
type AgentChildStreamEvent<Output = string, RawResponse = unknown> = AgentChildStreamEventBase<Output, RawResponse> | AgentToolCallDeltaEvent;
|
|
234
|
+
type AgentToolStreamEvent = {
|
|
208
235
|
type: "agent_tool_event";
|
|
209
236
|
turn: number;
|
|
210
237
|
toolName: string;
|
|
@@ -212,28 +239,27 @@ type AgentToolStreamEvent<ChildEvent> = {
|
|
|
212
239
|
internalCallId: string;
|
|
213
240
|
agentId: string;
|
|
214
241
|
agentName?: string;
|
|
215
|
-
event:
|
|
242
|
+
event: AgentChildStreamEvent<unknown, unknown>;
|
|
216
243
|
};
|
|
217
|
-
type
|
|
218
|
-
type AgentStreamEvent<RawResponse = unknown> = AgentChildStreamEvent<RawResponse> | AgentToolStreamEvent<AgentChildStreamEvent<RawResponse>>;
|
|
219
|
-
type AgentStreamEventWithToolCallDeltas<RawResponse = unknown> = AgentStreamEvent<RawResponse>;
|
|
244
|
+
type AgentStreamEvent<Output = string, RawResponse = unknown> = AgentChildStreamEvent<Output, RawResponse> | AgentToolStreamEvent;
|
|
220
245
|
interface AgentStream<Event = AgentStreamEvent> extends AsyncIterable<Event> {
|
|
221
|
-
steer(input:
|
|
246
|
+
steer(input: AgentSteerInput): boolean;
|
|
222
247
|
}
|
|
223
248
|
|
|
224
249
|
type AgentTraceInfo = {
|
|
250
|
+
readonly observer: string;
|
|
225
251
|
readonly traceId?: string | undefined;
|
|
226
252
|
readonly observationId?: string | undefined;
|
|
227
253
|
};
|
|
254
|
+
type AgentObserverTraceInfo = Omit<AgentTraceInfo, "observer">;
|
|
228
255
|
type AgentTraceOptions = {
|
|
229
256
|
readonly name?: string | undefined;
|
|
230
257
|
readonly userId?: string | undefined;
|
|
231
258
|
readonly sessionId?: string | undefined;
|
|
232
|
-
readonly metadata?:
|
|
259
|
+
readonly metadata?: DeepReadonly<JsonObject> | undefined;
|
|
233
260
|
readonly tags?: readonly string[] | undefined;
|
|
234
261
|
readonly version?: string | undefined;
|
|
235
262
|
readonly traceId?: string | undefined;
|
|
236
|
-
readonly failOnObserverError?: boolean | undefined;
|
|
237
263
|
readonly promptRef?: AgentRunPromptRef | undefined;
|
|
238
264
|
};
|
|
239
265
|
type AgentRunPromptRef = {
|
|
@@ -251,13 +277,20 @@ type AgentRunStartArgs = {
|
|
|
251
277
|
readonly history: readonly DeepReadonly<Message>[];
|
|
252
278
|
readonly maxTurns: number;
|
|
253
279
|
};
|
|
254
|
-
type
|
|
255
|
-
readonly
|
|
280
|
+
type AgentRunEndArgsBase = {
|
|
281
|
+
readonly text: string;
|
|
256
282
|
readonly usage: DeepReadonly<Usage>;
|
|
257
283
|
readonly messages: readonly DeepReadonly<Message>[];
|
|
258
284
|
readonly sources?: readonly DeepReadonly<CompletionSource>[] | undefined;
|
|
259
285
|
readonly providerToolCalls?: readonly DeepReadonly<ProviderToolCall>[] | undefined;
|
|
260
286
|
};
|
|
287
|
+
type AgentRunEndArgs = (AgentRunEndArgsBase & {
|
|
288
|
+
readonly status: "completed";
|
|
289
|
+
readonly output: unknown;
|
|
290
|
+
}) | (AgentRunEndArgsBase & {
|
|
291
|
+
readonly status: "blocked";
|
|
292
|
+
readonly stage: "input" | "output";
|
|
293
|
+
});
|
|
261
294
|
type AgentRunErrorArgs = {
|
|
262
295
|
readonly error: unknown;
|
|
263
296
|
readonly usage: DeepReadonly<Usage>;
|
|
@@ -265,7 +298,7 @@ type AgentRunErrorArgs = {
|
|
|
265
298
|
};
|
|
266
299
|
type AgentGenerationModelInfo = {
|
|
267
300
|
readonly provider: string;
|
|
268
|
-
readonly
|
|
301
|
+
readonly modelId: string;
|
|
269
302
|
readonly capabilities?: DeepReadonly<CompletionModelCapabilities> | undefined;
|
|
270
303
|
};
|
|
271
304
|
type AgentGenerationStartArgs = {
|
|
@@ -289,13 +322,13 @@ type AgentGenerationUpdateArgs = {
|
|
|
289
322
|
};
|
|
290
323
|
type AgentRunEventArgs = {
|
|
291
324
|
readonly name: string;
|
|
292
|
-
readonly attributes?:
|
|
325
|
+
readonly attributes?: DeepReadonly<JsonObject> | undefined;
|
|
293
326
|
readonly level?: "DEFAULT" | "WARNING" | "ERROR" | undefined;
|
|
294
|
-
readonly timestamp?:
|
|
327
|
+
readonly timestamp?: string | undefined;
|
|
295
328
|
};
|
|
296
329
|
type AgentToolStartArgs = {
|
|
297
330
|
readonly turn: number;
|
|
298
|
-
readonly toolCall: DeepReadonly<
|
|
331
|
+
readonly toolCall: DeepReadonly<ToolCallPart>;
|
|
299
332
|
readonly toolName: string;
|
|
300
333
|
readonly args: string;
|
|
301
334
|
readonly internalCallId: string;
|
|
@@ -305,7 +338,7 @@ type AgentToolStartArgs = {
|
|
|
305
338
|
};
|
|
306
339
|
type AgentToolEndArgs = AgentToolStartArgs & {
|
|
307
340
|
readonly result: string;
|
|
308
|
-
readonly structuredResult?: readonly DeepReadonly<
|
|
341
|
+
readonly structuredResult?: readonly DeepReadonly<ToolResultContentPart>[] | undefined;
|
|
309
342
|
readonly skipped: boolean;
|
|
310
343
|
};
|
|
311
344
|
type AgentToolErrorArgs = AgentToolStartArgs & {
|
|
@@ -325,7 +358,7 @@ interface AgentToolObserver {
|
|
|
325
358
|
error?(args: AgentToolErrorArgs): void | Promise<void>;
|
|
326
359
|
}
|
|
327
360
|
interface AgentRunObserver {
|
|
328
|
-
readonly trace?:
|
|
361
|
+
readonly trace?: AgentObserverTraceInfo | undefined;
|
|
329
362
|
startGeneration?(args: AgentGenerationStartArgs): AgentGenerationObserver | undefined | Promise<AgentGenerationObserver | undefined>;
|
|
330
363
|
startTool?(args: AgentToolStartArgs): AgentToolObserver | undefined | Promise<AgentToolObserver | undefined>;
|
|
331
364
|
end(args: AgentRunEndArgs): void | Promise<void>;
|
|
@@ -334,16 +367,13 @@ interface AgentRunObserver {
|
|
|
334
367
|
}
|
|
335
368
|
interface AgentObserver {
|
|
336
369
|
startRun(args: AgentRunStartArgs): AgentRunObserver | undefined | Promise<AgentRunObserver | undefined>;
|
|
337
|
-
flush?(): void | Promise<void>;
|
|
338
|
-
shutdown?(): void | Promise<void>;
|
|
339
370
|
}
|
|
340
|
-
type
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
readonly
|
|
371
|
+
type AgentObserverMap = Readonly<Record<string, AgentObserver>>;
|
|
372
|
+
type AgentObserverErrorPolicy = "ignore" | "throw";
|
|
373
|
+
type AgentObservabilityOptions<Observers extends AgentObserverMap = AgentObserverMap> = {
|
|
374
|
+
readonly observers: Observers;
|
|
375
|
+
readonly primaryTrace?: Extract<keyof Observers, string> | undefined;
|
|
376
|
+
readonly errorPolicy?: AgentObserverErrorPolicy | undefined;
|
|
346
377
|
};
|
|
347
|
-
declare function createObserver(observer: AgentObserver): AgentObserver;
|
|
348
378
|
|
|
349
|
-
export {
|
|
379
|
+
export type { AgentApprovalDecision as A, AgentGenerationErrorArgs as B, AgentGenerationModelInfo as C, AgentGenerationObserver as D, AgentGenerationStartArgs as E, AgentGenerationUpdateArgs as F, AgentObservabilityOptions as G, AgentObserver as H, AgentObserverErrorPolicy as I, AgentObserverMap as J, AgentObserverTraceInfo as K, AgentRunEndArgs as L, AgentRunErrorArgs as M, AgentRunEventArgs as N, AgentRunObserver as O, AgentRunPromptRef as P, AgentRunStartArgs as Q, AgentToolEndArgs as R, AgentToolErrorArgs as S, AgentToolObserver as T, AgentToolStartArgs as U, AgentToolStreamEventArgs as V, AgentTraceInfo as W, AgentTraceOptions as X, AgentApprovalRequiredEvent as a, AgentApprovalRequiredResult as b, AgentBlockedResult as c, AgentChildStreamEvent as d, AgentDeltaEvent as e, AgentErrorEvent as f, AgentErrorStreamEvent as g, AgentFinishEvent as h, AgentInput as i, AgentLifecycle as j, AgentMemoryCompactionEvent as k, AgentPrompt as l, AgentResponse as m, AgentResult as n, AgentRunOptions as o, AgentRunSettings as p, AgentStartEvent as q, AgentSteerInput as r, AgentStepFinishEvent as s, AgentStream as t, AgentStreamEvent as u, AgentToolApprovalRequest as v, AgentToolCallDeltaEvent as w, AgentToolFinishEvent as x, AgentToolStartEvent as y, AgentGenerationEndArgs as z };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { U as Usage, J as JsonObject, M as Message, S as SystemMessage, C as CompletionModel } from './types-CQ_ioXWK.js';
|
|
2
|
+
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
3
|
+
|
|
4
|
+
type MemorySavePolicy = "message" | "turn" | "run";
|
|
5
|
+
type MemoryScope = {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
userId?: string | undefined;
|
|
8
|
+
metadata?: JsonObject | undefined;
|
|
9
|
+
};
|
|
10
|
+
type MemoryScopeKeyOptions = {
|
|
11
|
+
includeUserId?: boolean | undefined;
|
|
12
|
+
metadataKeys?: readonly string[] | undefined;
|
|
13
|
+
};
|
|
14
|
+
type CreateMemoryScopeKeyOptions = MemoryScopeKeyOptions & {
|
|
15
|
+
scope: MemoryScope;
|
|
16
|
+
};
|
|
17
|
+
type MemoryScopeKeyResolver = MemoryScopeKeyOptions | ((options: {
|
|
18
|
+
scope: MemoryScope;
|
|
19
|
+
}) => string);
|
|
20
|
+
type MemoryLoadOptions = {
|
|
21
|
+
scope: MemoryScope;
|
|
22
|
+
};
|
|
23
|
+
type MemoryAppendOptions = {
|
|
24
|
+
scope: MemoryScope;
|
|
25
|
+
runId: string;
|
|
26
|
+
turn: number;
|
|
27
|
+
messages: Message[];
|
|
28
|
+
};
|
|
29
|
+
type MemoryClearOptions = {
|
|
30
|
+
scope: MemoryScope;
|
|
31
|
+
};
|
|
32
|
+
type MemoryErrorOptions = {
|
|
33
|
+
scope: MemoryScope;
|
|
34
|
+
runId: string;
|
|
35
|
+
error: unknown;
|
|
36
|
+
messages: Message[];
|
|
37
|
+
};
|
|
38
|
+
type MemoryConversationListOptions = {
|
|
39
|
+
limit: number;
|
|
40
|
+
userId?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
type MemoryConversationGetOptions = {
|
|
43
|
+
ref: string;
|
|
44
|
+
};
|
|
45
|
+
type MemoryConversationSummary = {
|
|
46
|
+
/** Opaque, store-specific reference used to retrieve this exact conversation. */
|
|
47
|
+
ref: string;
|
|
48
|
+
sessionId: string;
|
|
49
|
+
userId?: string | undefined;
|
|
50
|
+
metadata?: JsonObject | undefined;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
messageCount: number;
|
|
54
|
+
};
|
|
55
|
+
type MemoryConversationMessage = {
|
|
56
|
+
position: number;
|
|
57
|
+
runId: string;
|
|
58
|
+
turn: number;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
message: Message;
|
|
61
|
+
};
|
|
62
|
+
type MemoryConversation = MemoryConversationSummary & {
|
|
63
|
+
messages: MemoryConversationMessage[];
|
|
64
|
+
};
|
|
65
|
+
/** Optional, read-only discovery surface for developer tooling such as Studio. */
|
|
66
|
+
interface MemoryInspector {
|
|
67
|
+
listConversations(options: MemoryConversationListOptions): Promise<MemoryConversationSummary[]>;
|
|
68
|
+
getConversation(options: MemoryConversationGetOptions): Promise<MemoryConversation | undefined>;
|
|
69
|
+
}
|
|
70
|
+
interface MemoryStore {
|
|
71
|
+
readonly inspector?: MemoryInspector | undefined;
|
|
72
|
+
readonly compaction?: MemoryCompactionCapability | undefined;
|
|
73
|
+
load(options: MemoryLoadOptions): Promise<Message[]>;
|
|
74
|
+
append(options: MemoryAppendOptions): Promise<void>;
|
|
75
|
+
clear(options: MemoryClearOptions): Promise<void>;
|
|
76
|
+
recordError?(options: MemoryErrorOptions): Promise<void>;
|
|
77
|
+
}
|
|
78
|
+
type MemoryCompactionMetadata = {
|
|
79
|
+
version: 1;
|
|
80
|
+
compactedMessageCount: number;
|
|
81
|
+
};
|
|
82
|
+
type MemoryCompactionMessage = Omit<SystemMessage, "metadata"> & {
|
|
83
|
+
metadata: {
|
|
84
|
+
anvia: {
|
|
85
|
+
memoryCompaction: MemoryCompactionMetadata;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
type MemoryCompactionSnapshot = {
|
|
90
|
+
/** Opaque store revision used to reject stale compaction replacements. */
|
|
91
|
+
revision: string;
|
|
92
|
+
messages: Message[];
|
|
93
|
+
};
|
|
94
|
+
type MemoryCompactionSnapshotOptions = {
|
|
95
|
+
scope: MemoryScope;
|
|
96
|
+
};
|
|
97
|
+
type MemoryCompactionReplacePrefixOptions = {
|
|
98
|
+
scope: MemoryScope;
|
|
99
|
+
revision: string;
|
|
100
|
+
messageCount: number;
|
|
101
|
+
replacement: MemoryCompactionMessage;
|
|
102
|
+
runId: string;
|
|
103
|
+
};
|
|
104
|
+
type MemoryCompactionReplacePrefixResult = {
|
|
105
|
+
status: "committed" | "conflict";
|
|
106
|
+
};
|
|
107
|
+
/** Optional atomic prefix-replacement capability used by automatic memory compaction. */
|
|
108
|
+
interface MemoryCompactionCapability {
|
|
109
|
+
snapshot(options: MemoryCompactionSnapshotOptions): Promise<MemoryCompactionSnapshot>;
|
|
110
|
+
replacePrefix(options: MemoryCompactionReplacePrefixOptions): Promise<MemoryCompactionReplacePrefixResult>;
|
|
111
|
+
}
|
|
112
|
+
type MemoryCompactorInput = {
|
|
113
|
+
scope: MemoryScope;
|
|
114
|
+
messages: Message[];
|
|
115
|
+
abortSignal?: AbortSignal | undefined;
|
|
116
|
+
};
|
|
117
|
+
type MemoryCompactorResult = {
|
|
118
|
+
summary: string;
|
|
119
|
+
usage?: Usage | undefined;
|
|
120
|
+
};
|
|
121
|
+
type MemoryCompactor = (input: MemoryCompactorInput) => Promise<MemoryCompactorResult>;
|
|
122
|
+
type CreateSummaryMemoryCompactorOptions = {
|
|
123
|
+
model: CompletionModel;
|
|
124
|
+
instructions?: string | undefined;
|
|
125
|
+
maxTokens?: number | undefined;
|
|
126
|
+
temperature?: number | undefined;
|
|
127
|
+
providerOptions?: JsonObject | undefined;
|
|
128
|
+
retries?: RetrySetting | undefined;
|
|
129
|
+
};
|
|
130
|
+
type MemoryCompactionConflictRetryOptions = {
|
|
131
|
+
maxAttempts: number;
|
|
132
|
+
};
|
|
133
|
+
type MemoryCompactionOptions = {
|
|
134
|
+
trigger: {
|
|
135
|
+
afterMessages: number;
|
|
136
|
+
};
|
|
137
|
+
retention?: {
|
|
138
|
+
recentUserTurns?: number | undefined;
|
|
139
|
+
};
|
|
140
|
+
compactor: MemoryCompactor;
|
|
141
|
+
conflictRetries?: false | MemoryCompactionConflictRetryOptions | undefined;
|
|
142
|
+
};
|
|
143
|
+
type MemoryOptions = {
|
|
144
|
+
savePolicy?: MemorySavePolicy | undefined;
|
|
145
|
+
compaction?: MemoryCompactionOptions | undefined;
|
|
146
|
+
};
|
|
147
|
+
type MemoryCompactionInfo = {
|
|
148
|
+
originalMessageCount: number;
|
|
149
|
+
compactedMessageCount: number;
|
|
150
|
+
retainedMessageCount: number;
|
|
151
|
+
attempts: number;
|
|
152
|
+
usage: Usage;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type { MemoryScopeKeyOptions as A, MemoryScopeKeyResolver as B, CreateMemoryScopeKeyOptions as C, MemoryStore as D, 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, MemoryCompactionSnapshot as k, MemoryCompactionSnapshotOptions as l, MemoryCompactor as m, MemoryCompactorInput as n, MemoryCompactorResult as o, MemoryConversation as p, MemoryConversationGetOptions as q, MemoryConversationListOptions as r, MemoryConversationMessage as s, MemoryConversationSummary as t, MemoryErrorOptions as u, MemoryInspector as v, MemoryLoadOptions as w, MemoryOptions as x, MemorySavePolicy as y, MemoryScope as z };
|