@anvia/core 1.2.1 → 1.3.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 +16 -0
- package/dist/agent/agent-tool.js +10 -8
- package/dist/agent/agent.js +24 -22
- package/dist/agent/index.d.ts +12 -12
- package/dist/agent/index.js +30 -28
- package/dist/agent/interactions/index.d.ts +1 -1
- package/dist/agent/resolve-options.js +8 -8
- package/dist/agent/resolved-agent.js +25 -23
- package/dist/agent/team/agent-team.js +30 -28
- package/dist/agent/team/index.js +30 -28
- package/dist/agent/tool-catalog.js +7 -7
- package/dist/{agent-C9VhENdj.d.ts → agent-D3iyrJQb.d.ts} +9 -9
- package/dist/{chunk-UTAB3XQI.js → chunk-2JZV4LUS.js} +2 -2
- package/dist/{chunk-G336L2IE.js → chunk-4BDSO4PQ.js} +2 -2
- package/dist/{chunk-KZGSXJKU.js → chunk-4VDDYI6P.js} +4 -4
- package/dist/{chunk-LKIABZNR.js → chunk-5SJBSCG2.js} +3 -3
- package/dist/{chunk-MHOJJYDK.js → chunk-647TQE3E.js} +2 -2
- package/dist/chunk-6OO5C5GW.js +32 -0
- package/dist/chunk-6OO5C5GW.js.map +1 -0
- package/dist/{chunk-UOGM62JL.js → chunk-7TUAAGVR.js} +3 -3
- package/dist/{chunk-RT5LUEO3.js → chunk-A3DGCDGF.js} +11 -11
- package/dist/{chunk-J4SINPUA.js → chunk-B57NNDEF.js} +23 -11
- package/dist/chunk-B57NNDEF.js.map +1 -0
- package/dist/{chunk-B47EXUHL.js → chunk-CJKGTEN4.js} +2 -2
- package/dist/{chunk-HP34GRQX.js → chunk-E44DRLUL.js} +2 -2
- package/dist/{chunk-T4KS577P.js → chunk-FSBDE6RF.js} +7 -6
- package/dist/chunk-FSBDE6RF.js.map +1 -0
- package/dist/{chunk-F3E2RLC7.js → chunk-GE46NHN4.js} +3 -3
- package/dist/{chunk-CKKNO4XB.js → chunk-GSVOMQEE.js} +2 -2
- package/dist/{chunk-IDNL6IH4.js → chunk-HJ6KTQTZ.js} +7 -1
- package/dist/chunk-HJ6KTQTZ.js.map +1 -0
- package/dist/{chunk-T4IAJJUU.js → chunk-IYDGPF3C.js} +3 -3
- package/dist/{chunk-PPJ7SYQL.js → chunk-JMNIWUFV.js} +3 -3
- package/dist/{chunk-72LBHKYP.js → chunk-JWD43K7W.js} +2 -2
- package/dist/{chunk-MNYMLWWA.js → chunk-KNZNSNP4.js} +2 -2
- package/dist/{chunk-4S4OECPW.js → chunk-KRUDSNFN.js} +11 -11
- package/dist/{chunk-O6DTOCBM.js → chunk-KX2TRKO2.js} +2 -2
- package/dist/{chunk-BDDC72GF.js → chunk-LJGQ6VQB.js} +2 -2
- package/dist/chunk-NMPDZTBM.js +1 -0
- package/dist/chunk-NMPDZTBM.js.map +1 -0
- package/dist/{chunk-6N4ENZO4.js → chunk-OYHU4HNC.js} +2 -2
- package/dist/{chunk-Y7JTHNCU.js → chunk-RFFOL6ON.js} +2 -2
- package/dist/{chunk-47NTHIVB.js → chunk-SCFWN3T2.js} +2 -1
- package/dist/chunk-SCFWN3T2.js.map +1 -0
- package/dist/{chunk-QUS6S2NB.js → chunk-SIXS4CCU.js} +2 -2
- package/dist/{chunk-IV6YQTY2.js → chunk-T3ZOZEAB.js} +2 -2
- package/dist/{chunk-AOG6KSV4.js → chunk-T4UW4SUK.js} +3 -3
- package/dist/{chunk-BUPC72Y2.js → chunk-V5DWNXVH.js} +3 -3
- package/dist/{chunk-SIYZDPVH.js → chunk-VKRGWGA4.js} +39 -30
- package/dist/chunk-VKRGWGA4.js.map +1 -0
- package/dist/{chunk-5FCZ64HM.js → chunk-WCWSPU74.js} +3 -3
- package/dist/{chunk-XV3DH5GC.js → chunk-Y365ABZY.js} +5 -5
- package/dist/{chunk-BDKFFFVX.js → chunk-YMTBHHLQ.js} +64 -15
- package/dist/chunk-YMTBHHLQ.js.map +1 -0
- package/dist/{chunk-XJRNBTIV.js → chunk-YNA3UR42.js} +2 -2
- package/dist/chunk-YOLOFTAY.js +144 -0
- package/dist/chunk-YOLOFTAY.js.map +1 -0
- package/dist/{chunk-TIZGADU4.js → chunk-ZGDUEOSH.js} +7 -7
- package/dist/{chunk-TIZGADU4.js.map → chunk-ZGDUEOSH.js.map} +1 -1
- package/dist/completion/generate-completion.js +6 -4
- package/dist/completion/index.d.ts +3 -4
- package/dist/completion/index.js +6 -4
- package/dist/completion/stream-accumulator.js +2 -2
- package/dist/completion/types.js +1 -1
- package/dist/{dynamic-tools-CNHSPXr1.d.ts → dynamic-tools-BXXLc34l.d.ts} +3 -3
- package/dist/evals/advanced-metrics.js +9 -7
- package/dist/evals/cli.js +8 -6
- package/dist/evals/index.d.ts +5 -5
- package/dist/evals/index.js +12 -10
- package/dist/evals/judge.js +8 -6
- package/dist/evals/metrics.js +8 -6
- package/dist/evals/runner.js +7 -5
- package/dist/extractor/extractor.js +7 -5
- package/dist/extractor/index.d.ts +1 -1
- package/dist/extractor/index.js +7 -5
- package/dist/guardrails/index.d.ts +4 -4
- package/dist/image-generation/index.d.ts +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +44 -38
- package/dist/internal/agent-runtime/agent-run.js +20 -18
- package/dist/internal/agent-runtime/continuation-state.js +6 -4
- package/dist/internal/agent-runtime/interaction-suspension.js +6 -4
- package/dist/internal/agent-runtime/memory.js +8 -6
- package/dist/internal/agent-runtime/prepared-tool-call.js +2 -2
- package/dist/internal/agent-runtime/retrieval.js +5 -5
- package/dist/internal/agent-runtime/tool-execution.js +16 -14
- package/dist/internal/agent.d.ts +45 -12
- package/dist/internal/agent.js +25 -23
- package/dist/internal/completion-request.js +2 -2
- package/dist/internal/team-runtime/member.js +7 -5
- package/dist/internal/team-runtime/run.js +28 -26
- package/dist/internal/team-runtime/tools.js +4 -4
- package/dist/mcp/index.d.ts +4 -4
- package/dist/memory/compaction.js +7 -5
- package/dist/memory/index.d.ts +3 -3
- package/dist/memory/index.js +7 -5
- package/dist/{middleware-CWjnMbiH.d.ts → middleware-DORuwSy-.d.ts} +67 -4
- package/dist/observability/group.js +7 -5
- package/dist/observability/index.d.ts +5 -5
- package/dist/observability/index.js +7 -5
- package/dist/pipeline/index.d.ts +10 -10
- package/dist/pipeline/index.js +8 -6
- package/dist/pipeline/pipeline.js +8 -6
- package/dist/provider-output-error-CQD0MWey.d.ts +221 -0
- package/dist/schema/index.js +7 -0
- package/dist/schema/standard-json-schema.js +10 -0
- package/dist/schema/standard-json-schema.js.map +1 -0
- package/dist/schema/standard-schema.js +11 -0
- package/dist/schema/standard-schema.js.map +1 -0
- package/dist/skills/index.d.ts +4 -4
- package/dist/skills/index.js +12 -12
- package/dist/skills/load.js +11 -11
- package/dist/skills/tools.js +10 -10
- package/dist/speech-generation/index.d.ts +1 -1
- package/dist/speech-generation/index.js +1 -1
- package/dist/{text-GbW4WYMg.d.ts → text-CklbSG7K.d.ts} +1 -1
- package/dist/{think-tool-YWsV98I5.d.ts → think-tool-2unWbq1w.d.ts} +1 -1
- package/dist/tool/create-tool.js +3 -3
- package/dist/tool/dynamic-tools.js +6 -6
- package/dist/tool/index.d.ts +8 -8
- package/dist/tool/index.js +11 -11
- package/dist/tool/question-tool.js +4 -4
- package/dist/tool/think-tool.js +4 -4
- package/dist/tool/tool.js +1 -1
- package/dist/{tool-DQMZpZSS.d.ts → tool-D_jV3cRZ.d.ts} +38 -1
- package/dist/transcription/index.d.ts +1 -1
- package/dist/{types-DfRPfehE.d.ts → types-0t3BczrD.d.ts} +2 -2
- package/dist/{types-CODGMHnp.d.ts → types-ChyQISt-.d.ts} +1 -1
- package/dist/{types-Bqw0AuFl.d.ts → types-CqiX-4_C.d.ts} +1 -1
- package/dist/{types-C1xYKXF2.d.ts → types-Cu2tEf3V.d.ts} +1 -1
- package/dist/{types-CiHjqE6J.d.ts → types-DYqZKDA8.d.ts} +140 -0
- package/dist/{types-CafU6Ux5.d.ts → types-DhWxTobb.d.ts} +37 -1
- package/dist/vector-store/index.d.ts +4 -4
- package/dist/vector-store/index.js +8 -8
- package/package.json +9 -1
- package/dist/chunk-47NTHIVB.js.map +0 -1
- package/dist/chunk-BDKFFFVX.js.map +0 -1
- package/dist/chunk-IDNL6IH4.js.map +0 -1
- package/dist/chunk-J4SINPUA.js.map +0 -1
- package/dist/chunk-SIYZDPVH.js.map +0 -1
- package/dist/chunk-T4KS577P.js.map +0 -1
- package/dist/provider-output-error-OQ4fjw5W.d.ts +0 -107
- /package/dist/{chunk-UTAB3XQI.js.map → chunk-2JZV4LUS.js.map} +0 -0
- /package/dist/{chunk-G336L2IE.js.map → chunk-4BDSO4PQ.js.map} +0 -0
- /package/dist/{chunk-KZGSXJKU.js.map → chunk-4VDDYI6P.js.map} +0 -0
- /package/dist/{chunk-LKIABZNR.js.map → chunk-5SJBSCG2.js.map} +0 -0
- /package/dist/{chunk-MHOJJYDK.js.map → chunk-647TQE3E.js.map} +0 -0
- /package/dist/{chunk-UOGM62JL.js.map → chunk-7TUAAGVR.js.map} +0 -0
- /package/dist/{chunk-RT5LUEO3.js.map → chunk-A3DGCDGF.js.map} +0 -0
- /package/dist/{chunk-B47EXUHL.js.map → chunk-CJKGTEN4.js.map} +0 -0
- /package/dist/{chunk-HP34GRQX.js.map → chunk-E44DRLUL.js.map} +0 -0
- /package/dist/{chunk-F3E2RLC7.js.map → chunk-GE46NHN4.js.map} +0 -0
- /package/dist/{chunk-CKKNO4XB.js.map → chunk-GSVOMQEE.js.map} +0 -0
- /package/dist/{chunk-T4IAJJUU.js.map → chunk-IYDGPF3C.js.map} +0 -0
- /package/dist/{chunk-PPJ7SYQL.js.map → chunk-JMNIWUFV.js.map} +0 -0
- /package/dist/{chunk-72LBHKYP.js.map → chunk-JWD43K7W.js.map} +0 -0
- /package/dist/{chunk-MNYMLWWA.js.map → chunk-KNZNSNP4.js.map} +0 -0
- /package/dist/{chunk-4S4OECPW.js.map → chunk-KRUDSNFN.js.map} +0 -0
- /package/dist/{chunk-O6DTOCBM.js.map → chunk-KX2TRKO2.js.map} +0 -0
- /package/dist/{chunk-BDDC72GF.js.map → chunk-LJGQ6VQB.js.map} +0 -0
- /package/dist/{chunk-6N4ENZO4.js.map → chunk-OYHU4HNC.js.map} +0 -0
- /package/dist/{chunk-Y7JTHNCU.js.map → chunk-RFFOL6ON.js.map} +0 -0
- /package/dist/{chunk-QUS6S2NB.js.map → chunk-SIXS4CCU.js.map} +0 -0
- /package/dist/{chunk-IV6YQTY2.js.map → chunk-T3ZOZEAB.js.map} +0 -0
- /package/dist/{chunk-AOG6KSV4.js.map → chunk-T4UW4SUK.js.map} +0 -0
- /package/dist/{chunk-BUPC72Y2.js.map → chunk-V5DWNXVH.js.map} +0 -0
- /package/dist/{chunk-5FCZ64HM.js.map → chunk-WCWSPU74.js.map} +0 -0
- /package/dist/{chunk-XV3DH5GC.js.map → chunk-Y365ABZY.js.map} +0 -0
- /package/dist/{chunk-XJRNBTIV.js.map → chunk-YNA3UR42.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { M as Message, k as CompletionResponse, U as Usage, R as ReasoningContentType, y as ToolCallPart, m as CompletionSource, v as ProviderToolCall, e as CompletionModelControls, O as UserMessage, C as CompletionControlValues, c as CompletionFinishReason, p as ContextUsage, j as CompletionRequest, H as ToolResultOutput, G as ToolResultContentPart, a3 as ToolInteractionResponsePart, a2 as ToolCallArgumentsMode, J as JsonObject, _ as CompletionModelCapabilities, B as ToolDefinition, t as JsonValue } from './types-
|
|
2
|
-
import { D as DeepReadonly, M as MaybePromise, d as GuardrailPolicyInput, a as GuardrailDecisionRecord } from './types-
|
|
1
|
+
import { M as Message, k as CompletionResponse, U as Usage, R as ReasoningContentType, y as ToolCallPart, m as CompletionSource, v as ProviderToolCall, e as CompletionModelControls, O as UserMessage, C as CompletionControlValues, c as CompletionFinishReason, p as ContextUsage, j as CompletionRequest, H as ToolResultOutput, G as ToolResultContentPart, a3 as ToolInteractionResponsePart, a2 as ToolCallArgumentsMode, J as JsonObject, _ as CompletionModelCapabilities, B as ToolDefinition, t as JsonValue } from './types-DYqZKDA8.js';
|
|
2
|
+
import { D as DeepReadonly, M as MaybePromise, d as GuardrailPolicyInput, a as GuardrailDecisionRecord } from './types-CqiX-4_C.js';
|
|
3
3
|
import { AgentInteractionRequest, AgentContinuation, AgentInteractionResponse } from './agent/interactions/index.js';
|
|
4
4
|
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
5
|
-
import { e as MemoryCompactionInfo, A as MemoryScope } from './types-
|
|
6
|
-
import { d as ToolCallStreamEvent } from './tool-
|
|
5
|
+
import { e as MemoryCompactionInfo, A as MemoryScope } from './types-DhWxTobb.js';
|
|
6
|
+
import { d as ToolCallStreamEvent } from './tool-D_jV3cRZ.js';
|
|
7
7
|
|
|
8
8
|
type AgentLifecycleRunEvent = {
|
|
9
9
|
runId: string;
|
|
@@ -64,7 +64,16 @@ type AgentLifecycle<Output = string, RawResponse = unknown> = {
|
|
|
64
64
|
onError?(event: AgentErrorEvent): MaybePromise<void>;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
/** A run prompt: plain text or a full user message. */
|
|
67
68
|
type AgentPrompt = string | UserMessage;
|
|
69
|
+
/**
|
|
70
|
+
* What a run starts from — exactly one of:
|
|
71
|
+
*
|
|
72
|
+
* - `prompt`: a new run from a prompt
|
|
73
|
+
* - `messages`: a new run from a full message history
|
|
74
|
+
* - `continuation` + `response`: resumption of a run suspended on a human
|
|
75
|
+
* interaction, delivering the human's answer
|
|
76
|
+
*/
|
|
68
77
|
type AgentInput = {
|
|
69
78
|
prompt: AgentPrompt;
|
|
70
79
|
messages?: never;
|
|
@@ -84,6 +93,7 @@ type AgentInput = {
|
|
|
84
93
|
messages?: never;
|
|
85
94
|
session?: never;
|
|
86
95
|
};
|
|
96
|
+
/** Mid-run input that is queued and applied at the next turn boundary. */
|
|
87
97
|
type AgentSteerInput = {
|
|
88
98
|
prompt: AgentPrompt;
|
|
89
99
|
messages?: never;
|
|
@@ -91,7 +101,11 @@ type AgentSteerInput = {
|
|
|
91
101
|
messages: readonly UserMessage[];
|
|
92
102
|
prompt?: never;
|
|
93
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Per-run overrides applied on top of the agent's constructor settings.
|
|
106
|
+
*/
|
|
94
107
|
type AgentRunSettings<Output = string, RawResponse = unknown, Controls extends CompletionModelControls = CompletionModelControls> = {
|
|
108
|
+
/** Maximum tool-loop turns for this run; overrides the agent's `defaultMaxTurns`. */
|
|
95
109
|
maxTurns?: number | undefined;
|
|
96
110
|
retries?: RetrySetting | undefined;
|
|
97
111
|
abortSignal?: AbortSignal | undefined;
|
|
@@ -102,46 +116,68 @@ type AgentRunSettings<Output = string, RawResponse = unknown, Controls extends C
|
|
|
102
116
|
trace?: AgentTraceOptions | undefined;
|
|
103
117
|
controls?: CompletionControlValues<Controls> | undefined;
|
|
104
118
|
};
|
|
119
|
+
/** Input and settings for one agent run. */
|
|
105
120
|
type AgentRunOptions<Output = string, RawResponse = unknown, Controls extends CompletionModelControls = CompletionModelControls> = AgentInput & AgentRunSettings<Output, RawResponse, Controls>;
|
|
121
|
+
/** Options for triggering memory compaction on a session. */
|
|
106
122
|
type AgentMemoryCompactionOptions = {
|
|
107
123
|
session: MemoryScope;
|
|
108
124
|
abortSignal?: AbortSignal | undefined;
|
|
109
125
|
};
|
|
126
|
+
/** Links a resumed run to the suspended run it continues. */
|
|
110
127
|
type AgentRunLink = Readonly<{
|
|
111
128
|
runId: string;
|
|
112
129
|
interactionId: string;
|
|
113
130
|
}>;
|
|
131
|
+
/** Fields shared by every terminal run outcome. */
|
|
114
132
|
type AgentOutcomeBase = {
|
|
115
133
|
runId: string;
|
|
134
|
+
/** The final assistant text of the run. */
|
|
116
135
|
text: string;
|
|
117
136
|
usage: Usage;
|
|
118
137
|
finishReason?: CompletionFinishReason | undefined;
|
|
119
138
|
providerFinishReason?: string | undefined;
|
|
120
139
|
contextUsage?: ContextUsage | undefined;
|
|
140
|
+
/** The full message history produced by the run, ready to replay. */
|
|
121
141
|
messages: Message[];
|
|
122
142
|
trace?: AgentTraceInfo | undefined;
|
|
123
143
|
guardrails?: GuardrailDecisionRecord[] | undefined;
|
|
124
144
|
sources?: CompletionSource[] | undefined;
|
|
125
145
|
providerToolCalls?: ProviderToolCall[] | undefined;
|
|
126
146
|
memoryCompaction?: MemoryCompactionInfo | undefined;
|
|
147
|
+
/** Set when this run resumed a prior run suspended on an interaction. */
|
|
127
148
|
resumedFrom?: AgentRunLink | undefined;
|
|
128
149
|
};
|
|
150
|
+
/** The run finished and produced an output. */
|
|
129
151
|
type AgentResponse<Output = string> = AgentOutcomeBase & {
|
|
130
152
|
type: "response";
|
|
131
153
|
output: Output;
|
|
132
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* The run was stopped by a guardrail. `stage` reports whether the input prompt
|
|
157
|
+
* or the generated output was rejected.
|
|
158
|
+
*/
|
|
133
159
|
type AgentBlockedOutcome = AgentOutcomeBase & {
|
|
134
160
|
type: "blocked";
|
|
135
161
|
stage: "input" | "output";
|
|
136
162
|
reason: string;
|
|
137
163
|
message?: string | undefined;
|
|
138
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* The run suspended to wait for a human interaction (approval or question).
|
|
167
|
+
* Resume it by passing the returned `continuation` together with an
|
|
168
|
+
* {@link AgentInteractionResponse} as the next run's input.
|
|
169
|
+
*/
|
|
139
170
|
type AgentInteractionOutcome = AgentOutcomeBase & {
|
|
140
171
|
type: "interaction";
|
|
141
172
|
interaction: AgentInteractionRequest;
|
|
142
173
|
continuation: AgentContinuation;
|
|
143
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* Terminal result of a run: a response, a guardrail block, or a suspension on
|
|
177
|
+
* a human interaction.
|
|
178
|
+
*/
|
|
144
179
|
type AgentOutcome<Output = string> = AgentResponse<Output> | AgentBlockedOutcome | AgentInteractionOutcome;
|
|
180
|
+
/** Run-level content deltas, not tagged with a turn. */
|
|
145
181
|
type AgentDeltaEvent = {
|
|
146
182
|
type: "text_delta";
|
|
147
183
|
delta: string;
|
|
@@ -161,11 +197,13 @@ type AgentDeltaEvent = {
|
|
|
161
197
|
type: "provider_tool_call";
|
|
162
198
|
toolCall: ProviderToolCall;
|
|
163
199
|
};
|
|
200
|
+
/** Terminal error event carrying the usage accumulated before the failure. */
|
|
164
201
|
type AgentErrorStreamEvent = {
|
|
165
202
|
type: "error";
|
|
166
203
|
error: unknown;
|
|
167
204
|
usage: Usage;
|
|
168
205
|
};
|
|
206
|
+
/** Partial tool-call input arriving mid-generation within one turn. */
|
|
169
207
|
type AgentToolCallDeltaEvent = {
|
|
170
208
|
type: "tool_call_delta";
|
|
171
209
|
turn: number;
|
|
@@ -176,18 +214,22 @@ type AgentToolCallDeltaEvent = {
|
|
|
176
214
|
argumentsMode?: ToolCallArgumentsMode;
|
|
177
215
|
signature?: string;
|
|
178
216
|
};
|
|
217
|
+
/** Emitted when the run compacts session memory mid-run. */
|
|
179
218
|
type AgentMemoryCompactionEvent = MemoryCompactionInfo & {
|
|
180
219
|
type: "memory_compaction";
|
|
181
220
|
};
|
|
221
|
+
/** Emitted when a sibling run in the same session answers a tool interaction. */
|
|
182
222
|
type AgentInteractionResponseEvent = {
|
|
183
223
|
type: "interaction_response";
|
|
184
224
|
response: ToolInteractionResponsePart;
|
|
185
225
|
sourceRunId: string;
|
|
186
226
|
};
|
|
227
|
+
/** Acknowledgement that steering input was accepted and queued. */
|
|
187
228
|
type AgentSteerReceipt = Readonly<{
|
|
188
229
|
id: string;
|
|
189
230
|
status: "queued";
|
|
190
231
|
}>;
|
|
232
|
+
/** Confirms a queued steer input was applied, at the turn it landed in. */
|
|
191
233
|
type AgentSteeringAppliedEvent = {
|
|
192
234
|
type: "steering_applied";
|
|
193
235
|
id: string;
|
|
@@ -248,6 +290,13 @@ type AgentChildStreamEventBase<Output = string, RawResponse = unknown> = {
|
|
|
248
290
|
turn?: number | undefined;
|
|
249
291
|
decision: GuardrailDecisionRecord;
|
|
250
292
|
} | AgentMemoryCompactionEvent | AgentInteractionResponseEvent | AgentSteeringAppliedEvent | AgentOutcome<Output> | AgentErrorStreamEvent;
|
|
293
|
+
/**
|
|
294
|
+
* Events of a single agent run: turn-tagged progress events (deltas, tool
|
|
295
|
+
* calls and results, guardrail decisions), plus run-level events such as
|
|
296
|
+
* steering confirmations, memory compaction, and interaction responses. The
|
|
297
|
+
* stream always ends with an {@link AgentOutcome} or an
|
|
298
|
+
* {@link AgentErrorStreamEvent}.
|
|
299
|
+
*/
|
|
251
300
|
type AgentChildStreamEvent<Output = string, RawResponse = unknown> = AgentChildStreamEventBase<Output, RawResponse> | AgentToolCallDeltaEvent;
|
|
252
301
|
type AgentToolStreamEvent = {
|
|
253
302
|
type: "agent_tool_event";
|
|
@@ -259,13 +308,27 @@ type AgentToolStreamEvent = {
|
|
|
259
308
|
agentName?: string;
|
|
260
309
|
event: AgentChildStreamEvent<unknown, unknown>;
|
|
261
310
|
};
|
|
311
|
+
/**
|
|
312
|
+
* The complete event family for an agent run: the run's own child stream
|
|
313
|
+
* events, plus events from child agent runs invoked through agent tools.
|
|
314
|
+
*/
|
|
262
315
|
type AgentStreamEvent<Output = string, RawResponse = unknown> = AgentChildStreamEvent<Output, RawResponse> | AgentToolStreamEvent;
|
|
316
|
+
/**
|
|
317
|
+
* Async stream of run events. The run is driven by consuming the stream —
|
|
318
|
+
* iterating events or awaiting `text`/`result`. The stream can be consumed
|
|
319
|
+
* once; abandoning it before completion cancels the run.
|
|
320
|
+
*/
|
|
263
321
|
interface AgentStream<Output = string, RawResponse = unknown> extends AsyncIterable<AgentStreamEvent<Output, RawResponse>> {
|
|
264
322
|
readonly events: AsyncIterable<AgentStreamEvent<Output, RawResponse>>;
|
|
323
|
+
/** Incremental text deltas only, with turn metadata stripped. */
|
|
265
324
|
readonly textStream: AsyncIterable<string>;
|
|
325
|
+
/** Resolves with the run's final assistant text; rejects if the run errors. */
|
|
266
326
|
readonly text: Promise<string>;
|
|
327
|
+
/** Resolves with the run's terminal outcome; rejects if the run errors. */
|
|
267
328
|
readonly result: Promise<AgentOutcome<Output>>;
|
|
329
|
+
/** Queues input to inject at the next turn boundary. Throws if the run already ended. */
|
|
268
330
|
steer(input: AgentSteerInput): AgentSteerReceipt;
|
|
331
|
+
/** Cancels the run; in-flight tool calls and generation are aborted. */
|
|
269
332
|
cancel(reason?: string): void;
|
|
270
333
|
}
|
|
271
334
|
|
|
@@ -4,17 +4,19 @@ import {
|
|
|
4
4
|
ActiveToolObservers,
|
|
5
5
|
AgentObserverDispatchError,
|
|
6
6
|
startAgentRunObservers
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-YNA3UR42.js";
|
|
8
8
|
import "../chunk-H3H74RWJ.js";
|
|
9
9
|
import "../chunk-TP3MCUXS.js";
|
|
10
10
|
import "../chunk-6RQYWZI3.js";
|
|
11
11
|
import "../chunk-NF6WBPFG.js";
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-YMTBHHLQ.js";
|
|
13
|
+
import "../chunk-YOLOFTAY.js";
|
|
14
|
+
import "../chunk-6OO5C5GW.js";
|
|
15
|
+
import "../chunk-GSVOMQEE.js";
|
|
14
16
|
import "../chunk-4ONUNWGC.js";
|
|
15
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-2JZV4LUS.js";
|
|
16
18
|
import "../chunk-XQV3XNVT.js";
|
|
17
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-HJ6KTQTZ.js";
|
|
18
20
|
import "../chunk-BONQTXRQ.js";
|
|
19
21
|
import "../chunk-4C7AXYOM.js";
|
|
20
22
|
import "../chunk-SQAAVYJG.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { J as AgentGenerationEndArgs, K as AgentGenerationErrorArgs, L as AgentGenerationModelInfo, M as AgentGenerationObserver, N as AgentGenerationStartArgs, O as AgentGenerationUpdateArgs, P as AgentObservabilityOptions, Q as AgentObserver, R as AgentObserverErrorPolicy, S as AgentObserverMap, U as AgentObserverTraceInfo, V as AgentRunEndArgs, W as AgentRunErrorArgs, X as AgentRunEventArgs, Y as AgentRunObserver, Z as AgentRunPromptRef, _ as AgentRunStartArgs, $ as AgentToolEndArgs, a0 as AgentToolErrorArgs, a1 as AgentToolObserver, a2 as AgentToolStartArgs, a3 as AgentToolStreamEventArgs, a4 as AgentToolSuspendedArgs, a5 as AgentTraceInfo, a6 as AgentTraceOptions } from '../middleware-
|
|
2
|
-
import '../types-
|
|
1
|
+
export { J as AgentGenerationEndArgs, K as AgentGenerationErrorArgs, L as AgentGenerationModelInfo, M as AgentGenerationObserver, N as AgentGenerationStartArgs, O as AgentGenerationUpdateArgs, P as AgentObservabilityOptions, Q as AgentObserver, R as AgentObserverErrorPolicy, S as AgentObserverMap, U as AgentObserverTraceInfo, V as AgentRunEndArgs, W as AgentRunErrorArgs, X as AgentRunEventArgs, Y as AgentRunObserver, Z as AgentRunPromptRef, _ as AgentRunStartArgs, $ as AgentToolEndArgs, a0 as AgentToolErrorArgs, a1 as AgentToolObserver, a2 as AgentToolStartArgs, a3 as AgentToolStreamEventArgs, a4 as AgentToolSuspendedArgs, a5 as AgentTraceInfo, a6 as AgentTraceOptions } from '../middleware-DORuwSy-.js';
|
|
2
|
+
import '../types-DYqZKDA8.js';
|
|
3
3
|
import '../model-call-options-CZkSw_xN.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-CqiX-4_C.js';
|
|
5
5
|
import '../agent/interactions/index.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '../retry-CjvSlKGW.js';
|
|
8
|
-
import '../types-
|
|
9
|
-
import '../tool-
|
|
8
|
+
import '../types-DhWxTobb.js';
|
|
9
|
+
import '../tool-D_jV3cRZ.js';
|
|
10
10
|
|
|
11
11
|
type AgentObserverFailure = {
|
|
12
12
|
readonly observer: string;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentObserverDispatchError
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-YNA3UR42.js";
|
|
4
4
|
import "../chunk-H3H74RWJ.js";
|
|
5
5
|
import "../chunk-TP3MCUXS.js";
|
|
6
6
|
import "../chunk-6RQYWZI3.js";
|
|
7
7
|
import "../chunk-NF6WBPFG.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-YMTBHHLQ.js";
|
|
9
|
+
import "../chunk-YOLOFTAY.js";
|
|
10
|
+
import "../chunk-6OO5C5GW.js";
|
|
11
|
+
import "../chunk-GSVOMQEE.js";
|
|
10
12
|
import "../chunk-4ONUNWGC.js";
|
|
11
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-2JZV4LUS.js";
|
|
12
14
|
import "../chunk-XQV3XNVT.js";
|
|
13
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-HJ6KTQTZ.js";
|
|
14
16
|
import "../chunk-BONQTXRQ.js";
|
|
15
17
|
import "../chunk-4C7AXYOM.js";
|
|
16
18
|
import "../chunk-SQAAVYJG.js";
|
package/dist/pipeline/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { g as AgentInteractionOutcome, a6 as AgentTraceOptions, U as AgentObserverTraceInfo, R as AgentObserverErrorPolicy, a5 as AgentTraceInfo, f as AgentInput, p as AgentRunSettings } from '../middleware-
|
|
2
|
-
import { A as Agent } from '../agent-
|
|
3
|
-
import { J as JsonObject, d as CompletionModel, f as CompletionModelControlsOf } from '../types-
|
|
1
|
+
import { g as AgentInteractionOutcome, a6 as AgentTraceOptions, U as AgentObserverTraceInfo, R as AgentObserverErrorPolicy, a5 as AgentTraceInfo, f as AgentInput, p as AgentRunSettings } from '../middleware-DORuwSy-.js';
|
|
2
|
+
import { A as Agent } from '../agent-D3iyrJQb.js';
|
|
3
|
+
import { J as JsonObject, d as CompletionModel, f as CompletionModelControlsOf } from '../types-DYqZKDA8.js';
|
|
4
4
|
import { ExtractOptions } from '../extractor/index.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-CqiX-4_C.js';
|
|
7
7
|
import '../agent/interactions/index.js';
|
|
8
8
|
import '../retry-CjvSlKGW.js';
|
|
9
|
-
import '../types-
|
|
10
|
-
import '../tool-
|
|
9
|
+
import '../types-DhWxTobb.js';
|
|
10
|
+
import '../tool-D_jV3cRZ.js';
|
|
11
|
+
import '../types-0t3BczrD.js';
|
|
11
12
|
import '../zod-schema-C7F4clpm.js';
|
|
12
|
-
import '../types-
|
|
13
|
-
import '../
|
|
14
|
-
import '../dynamic-tools-CNHSPXr1.js';
|
|
13
|
+
import '../types-Cu2tEf3V.js';
|
|
14
|
+
import '../dynamic-tools-BXXLc34l.js';
|
|
15
15
|
import '../types-Cr4uiYo5.js';
|
|
16
16
|
import '../model-call-options-CZkSw_xN.js';
|
|
17
|
-
import '../types-
|
|
17
|
+
import '../types-ChyQISt-.js';
|
|
18
18
|
|
|
19
19
|
declare class PipelineAgentSuspensionError extends Error {
|
|
20
20
|
readonly result: AgentInteractionOutcome;
|
package/dist/pipeline/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Pipeline
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZGDUEOSH.js";
|
|
4
4
|
import "../chunk-ETYB5JO6.js";
|
|
5
5
|
import "../chunk-EKZRAWBP.js";
|
|
6
6
|
import {
|
|
@@ -9,18 +9,20 @@ import {
|
|
|
9
9
|
} from "../chunk-R6722CIU.js";
|
|
10
10
|
import "../chunk-V3FFZWF3.js";
|
|
11
11
|
import "../chunk-3P3YVJ7V.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-7TUAAGVR.js";
|
|
13
13
|
import "../chunk-H3H74RWJ.js";
|
|
14
14
|
import "../chunk-TP3MCUXS.js";
|
|
15
15
|
import "../chunk-6RQYWZI3.js";
|
|
16
16
|
import "../chunk-NF6WBPFG.js";
|
|
17
17
|
import "../chunk-4FIVU53H.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-YMTBHHLQ.js";
|
|
19
|
+
import "../chunk-YOLOFTAY.js";
|
|
20
|
+
import "../chunk-6OO5C5GW.js";
|
|
21
|
+
import "../chunk-GSVOMQEE.js";
|
|
20
22
|
import "../chunk-4ONUNWGC.js";
|
|
21
|
-
import "../chunk-
|
|
23
|
+
import "../chunk-2JZV4LUS.js";
|
|
22
24
|
import "../chunk-XQV3XNVT.js";
|
|
23
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-HJ6KTQTZ.js";
|
|
24
26
|
import "../chunk-BONQTXRQ.js";
|
|
25
27
|
import "../chunk-4C7AXYOM.js";
|
|
26
28
|
import "../chunk-SQAAVYJG.js";
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Pipeline
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZGDUEOSH.js";
|
|
4
4
|
import "../chunk-ETYB5JO6.js";
|
|
5
5
|
import "../chunk-EKZRAWBP.js";
|
|
6
6
|
import "../chunk-R6722CIU.js";
|
|
7
7
|
import "../chunk-V3FFZWF3.js";
|
|
8
8
|
import "../chunk-3P3YVJ7V.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-7TUAAGVR.js";
|
|
10
10
|
import "../chunk-H3H74RWJ.js";
|
|
11
11
|
import "../chunk-TP3MCUXS.js";
|
|
12
12
|
import "../chunk-6RQYWZI3.js";
|
|
13
13
|
import "../chunk-NF6WBPFG.js";
|
|
14
14
|
import "../chunk-4FIVU53H.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-YMTBHHLQ.js";
|
|
16
|
+
import "../chunk-YOLOFTAY.js";
|
|
17
|
+
import "../chunk-6OO5C5GW.js";
|
|
18
|
+
import "../chunk-GSVOMQEE.js";
|
|
17
19
|
import "../chunk-4ONUNWGC.js";
|
|
18
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-2JZV4LUS.js";
|
|
19
21
|
import "../chunk-XQV3XNVT.js";
|
|
20
|
-
import "../chunk-
|
|
22
|
+
import "../chunk-HJ6KTQTZ.js";
|
|
21
23
|
import "../chunk-BONQTXRQ.js";
|
|
22
24
|
import "../chunk-4C7AXYOM.js";
|
|
23
25
|
import "../chunk-SQAAVYJG.js";
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { h as CompletionModelSelectControl, e as CompletionModelControls, C as CompletionControlValues, d as CompletionModel, M as Message, D as Document, o as CompletionTool, z as ToolChoice, f as CompletionModelControlsOf, J as JsonObject, U as Usage, k as CompletionResponse, a0 as StreamingCompletionModel, l as CompletionResult, n as CompletionStreamEvent, t as JsonValue, c as CompletionFinishReason } from './types-DYqZKDA8.js';
|
|
2
|
+
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
declare const REASONING_EFFORT_CONTROL_ID = "reasoningEffort";
|
|
6
|
+
type ReasoningEffortControls<Effort extends string = string> = Readonly<{
|
|
7
|
+
reasoningEffort: CompletionModelSelectControl<Effort>;
|
|
8
|
+
}>;
|
|
9
|
+
declare function defineCompletionModelControls<const Controls extends CompletionModelControls>(controls: Controls): Controls;
|
|
10
|
+
declare function mergeCompletionControlValues<Controls extends CompletionModelControls>(defaults: CompletionControlValues<Controls> | undefined, overrides: CompletionControlValues<Controls> | undefined): Readonly<Record<string, string>> | undefined;
|
|
11
|
+
|
|
12
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
13
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
14
|
+
/** The Standard properties. */
|
|
15
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
16
|
+
}
|
|
17
|
+
declare namespace StandardTypedV1 {
|
|
18
|
+
/** The Standard Typed properties interface. */
|
|
19
|
+
interface Props<Input = unknown, Output = Input> {
|
|
20
|
+
/** The version number of the standard. */
|
|
21
|
+
readonly version: 1;
|
|
22
|
+
/** The vendor name of the schema library. */
|
|
23
|
+
readonly vendor: string;
|
|
24
|
+
/** Inferred types associated with the schema. */
|
|
25
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** The Standard Typed types interface. */
|
|
28
|
+
interface Types<Input = unknown, Output = Input> {
|
|
29
|
+
/** The input type of the schema. */
|
|
30
|
+
readonly input: Input;
|
|
31
|
+
/** The output type of the schema. */
|
|
32
|
+
readonly output: Output;
|
|
33
|
+
}
|
|
34
|
+
/** Infers the input type of a Standard Typed. */
|
|
35
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
36
|
+
/** Infers the output type of a Standard Typed. */
|
|
37
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
38
|
+
}
|
|
39
|
+
/** The Standard Schema interface for schemas that validate data. */
|
|
40
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> extends StandardTypedV1<Input, Output> {
|
|
41
|
+
/** The Standard Schema properties. */
|
|
42
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
43
|
+
}
|
|
44
|
+
declare namespace StandardSchemaV1 {
|
|
45
|
+
/** The Standard Schema properties interface. */
|
|
46
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
47
|
+
/** Validates unknown input values. */
|
|
48
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
|
|
49
|
+
}
|
|
50
|
+
/** The result interface of the validate function. */
|
|
51
|
+
type Result<Output> = StandardSchemaV1.SuccessResult<Output> | StandardSchemaV1.FailureResult;
|
|
52
|
+
/** The result interface if validation succeeds. */
|
|
53
|
+
interface SuccessResult<Output> {
|
|
54
|
+
/** The typed output value. */
|
|
55
|
+
readonly value: Output;
|
|
56
|
+
/** A falsy value for `issues` indicates success. */
|
|
57
|
+
readonly issues?: undefined;
|
|
58
|
+
}
|
|
59
|
+
/** The options interface of the validate function. */
|
|
60
|
+
interface Options {
|
|
61
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
62
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
63
|
+
}
|
|
64
|
+
/** The result interface if validation fails. */
|
|
65
|
+
interface FailureResult {
|
|
66
|
+
/** The issues of failed validation. */
|
|
67
|
+
readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
|
|
68
|
+
}
|
|
69
|
+
/** The issue interface of the failure output. */
|
|
70
|
+
interface Issue {
|
|
71
|
+
/** The error message of the issue. */
|
|
72
|
+
readonly message: string;
|
|
73
|
+
/** The path of the issue, if any. */
|
|
74
|
+
readonly path?: ReadonlyArray<PropertyKey | StandardSchemaV1.PathSegment> | undefined;
|
|
75
|
+
}
|
|
76
|
+
/** The path segment interface of the issue path. */
|
|
77
|
+
interface PathSegment {
|
|
78
|
+
/** The key representing a path segment. */
|
|
79
|
+
readonly key: PropertyKey;
|
|
80
|
+
}
|
|
81
|
+
/** The Standard types interface. */
|
|
82
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
|
|
83
|
+
}
|
|
84
|
+
/** Infers the input type of a Standard Schema. */
|
|
85
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
86
|
+
/** Infers the output type of a Standard Schema. */
|
|
87
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The Standard JSON Schema interface for entities that can convert themselves
|
|
91
|
+
* to JSON Schema. Schema libraries may expose it alongside
|
|
92
|
+
* {@link StandardSchemaV1} on the same `"~standard"` property bag.
|
|
93
|
+
*/
|
|
94
|
+
interface StandardJSONSchemaV1<Input = unknown, Output = Input> extends StandardTypedV1<Input, Output> {
|
|
95
|
+
/** The Standard JSON Schema properties. */
|
|
96
|
+
readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
|
|
97
|
+
}
|
|
98
|
+
declare namespace StandardJSONSchemaV1 {
|
|
99
|
+
/** The Standard JSON Schema properties interface. */
|
|
100
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
101
|
+
/** Methods for generating the input/output JSON Schema. */
|
|
102
|
+
readonly jsonSchema: StandardJSONSchemaV1.Converter;
|
|
103
|
+
}
|
|
104
|
+
/** The Standard JSON Schema converter interface. */
|
|
105
|
+
interface Converter {
|
|
106
|
+
/** Converts the input type to JSON Schema. May throw if conversion is not supported. */
|
|
107
|
+
readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
108
|
+
/** Converts the output type to JSON Schema. May throw if conversion is not supported. */
|
|
109
|
+
readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
/** The options for the input/output methods. */
|
|
112
|
+
interface Options {
|
|
113
|
+
/** The target version of the generated JSON Schema. */
|
|
114
|
+
readonly target: StandardJSONSchemaV1.Target;
|
|
115
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
116
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
117
|
+
}
|
|
118
|
+
/** The target version of the generated JSON Schema. */
|
|
119
|
+
type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
|
|
120
|
+
/** The Standard types interface. */
|
|
121
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** Checks whether a value looks like a Standard Schema. */
|
|
125
|
+
declare function isStandardSchema(value: unknown): value is StandardSchemaV1;
|
|
126
|
+
|
|
127
|
+
type CompletionStructuredOutputPhase = "truncated" | "content-filter" | "parse" | "schema";
|
|
128
|
+
declare class CompletionStructuredOutputError extends Error {
|
|
129
|
+
readonly phase: CompletionStructuredOutputPhase;
|
|
130
|
+
readonly outputLength: number;
|
|
131
|
+
readonly usage: Usage;
|
|
132
|
+
readonly finishReason: CompletionResponse["finishReason"];
|
|
133
|
+
readonly providerFinishReason: string | undefined;
|
|
134
|
+
constructor(options: {
|
|
135
|
+
phase: CompletionStructuredOutputPhase;
|
|
136
|
+
outputLength: number;
|
|
137
|
+
usage: Usage;
|
|
138
|
+
finishReason?: CompletionResponse["finishReason"];
|
|
139
|
+
providerFinishReason?: string | undefined;
|
|
140
|
+
cause?: unknown;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
type CompletionInput = {
|
|
144
|
+
prompt: string;
|
|
145
|
+
messages?: never;
|
|
146
|
+
} | {
|
|
147
|
+
messages: readonly Message[];
|
|
148
|
+
prompt?: never;
|
|
149
|
+
};
|
|
150
|
+
type CompletionBaseOptions<Model extends CompletionModel = CompletionModel> = CompletionInput & {
|
|
151
|
+
model: Model;
|
|
152
|
+
instructions?: string | undefined;
|
|
153
|
+
documents?: readonly Document[] | undefined;
|
|
154
|
+
tools?: readonly CompletionTool[] | undefined;
|
|
155
|
+
temperature?: number | undefined;
|
|
156
|
+
maxTokens?: number | undefined;
|
|
157
|
+
toolChoice?: ToolChoice | undefined;
|
|
158
|
+
controls?: CompletionControlValues<CompletionModelControlsOf<Model>> | undefined;
|
|
159
|
+
providerOptions?: JsonObject | undefined;
|
|
160
|
+
retries?: RetrySetting | undefined;
|
|
161
|
+
abortSignal?: AbortSignal | undefined;
|
|
162
|
+
};
|
|
163
|
+
type GenerateCompletionOptions<Model extends CompletionModel = CompletionModel> = CompletionBaseOptions<Model> & {
|
|
164
|
+
outputSchema?: never;
|
|
165
|
+
};
|
|
166
|
+
type GenerateStructuredCompletionOptions<Output, Model extends CompletionModel = CompletionModel> = CompletionBaseOptions<Model> & {
|
|
167
|
+
outputSchema: StandardSchemaV1<unknown, Output>;
|
|
168
|
+
};
|
|
169
|
+
type StreamCompletionOptions<Model extends StreamingCompletionModel = StreamingCompletionModel> = GenerateCompletionOptions<Model>;
|
|
170
|
+
type StreamStructuredCompletionOptions<Output, Model extends StreamingCompletionModel = StreamingCompletionModel> = GenerateStructuredCompletionOptions<Output, Model>;
|
|
171
|
+
type RawResponseOf<Model> = Model extends CompletionModel<infer RawResponse> ? RawResponse : unknown;
|
|
172
|
+
declare function generateCompletion<Output, Model extends CompletionModel>(options: GenerateStructuredCompletionOptions<Output, Model>): Promise<CompletionResult<Output, RawResponseOf<Model>>>;
|
|
173
|
+
declare function generateCompletion<Model extends CompletionModel>(options: GenerateCompletionOptions<Model>): Promise<CompletionResult<string, RawResponseOf<Model>>>;
|
|
174
|
+
declare function streamCompletion<Output, Model extends StreamingCompletionModel>(options: StreamStructuredCompletionOptions<Output, Model>): AsyncIterable<CompletionStreamEvent<Output, RawResponseOf<Model>>>;
|
|
175
|
+
declare function streamCompletion<Model extends StreamingCompletionModel>(options: StreamCompletionOptions<Model>): AsyncIterable<CompletionStreamEvent<string, RawResponseOf<Model>>>;
|
|
176
|
+
declare function isStreamingCompletionModel(model: CompletionModel): model is StreamingCompletionModel;
|
|
177
|
+
|
|
178
|
+
declare function isJsonValue(value: unknown): value is JsonValue;
|
|
179
|
+
|
|
180
|
+
type MessageMetadataSchema<Metadata extends JsonObject> = z.ZodType<Metadata>;
|
|
181
|
+
declare function createMessageSchema<Metadata extends JsonObject>(options: {
|
|
182
|
+
metadataSchema: MessageMetadataSchema<Metadata>;
|
|
183
|
+
}): z.ZodType<Message<Metadata>>;
|
|
184
|
+
declare const messageSchema: z.ZodType<Message<JsonObject>, unknown, z.core.$ZodTypeInternals<Message<JsonObject>, unknown>>;
|
|
185
|
+
declare const messagesSchema: z.ZodArray<z.ZodType<Message<JsonObject>, unknown, z.core.$ZodTypeInternals<Message<JsonObject>, unknown>>>;
|
|
186
|
+
declare function parseMessage(value: unknown): Message;
|
|
187
|
+
declare function parseMessages(value: unknown): Message[];
|
|
188
|
+
declare function isMessage(value: unknown): value is Message;
|
|
189
|
+
|
|
190
|
+
declare const COMPLETION_PROVIDER_OUTPUT_ERROR_CODE: "ANVIA_COMPLETION_PROVIDER_OUTPUT";
|
|
191
|
+
type CompletionProviderOutputErrorKind = "malformed-tool-arguments" | "invalid-tool-arguments" | "invalid-stream-event" | "invalid-response" | "incomplete-stream" | "incomplete-tool-call" | "invalid-tool-call" | "truncated-tool-call" | "filtered-tool-call";
|
|
192
|
+
type CompletionProviderOutputErrorBaseOptions = Readonly<{
|
|
193
|
+
toolCallId?: string | undefined;
|
|
194
|
+
usage?: Usage | undefined;
|
|
195
|
+
}>;
|
|
196
|
+
type CompletionProviderOutputErrorOptions = Readonly<CompletionProviderOutputErrorBaseOptions & {
|
|
197
|
+
kind: "truncated-tool-call";
|
|
198
|
+
finishReason: "length";
|
|
199
|
+
}> | Readonly<CompletionProviderOutputErrorBaseOptions & {
|
|
200
|
+
kind: "filtered-tool-call";
|
|
201
|
+
finishReason: "content-filter";
|
|
202
|
+
}> | Readonly<CompletionProviderOutputErrorBaseOptions & {
|
|
203
|
+
kind: Exclude<CompletionProviderOutputErrorKind, "truncated-tool-call" | "filtered-tool-call">;
|
|
204
|
+
finishReason?: Exclude<CompletionFinishReason, "length" | "content-filter"> | undefined;
|
|
205
|
+
}>;
|
|
206
|
+
/**
|
|
207
|
+
* A provider returned incomplete output or a tool call that cannot be consumed safely.
|
|
208
|
+
*
|
|
209
|
+
* The error intentionally excludes raw model arguments. Provider output can contain
|
|
210
|
+
* credentials or other sensitive values and must not become log metadata by default.
|
|
211
|
+
*/
|
|
212
|
+
declare class CompletionProviderOutputError extends Error {
|
|
213
|
+
readonly code: "ANVIA_COMPLETION_PROVIDER_OUTPUT";
|
|
214
|
+
readonly kind: CompletionProviderOutputErrorKind;
|
|
215
|
+
readonly toolCallId: string | undefined;
|
|
216
|
+
readonly finishReason: CompletionFinishReason | undefined;
|
|
217
|
+
readonly usage: Usage | undefined;
|
|
218
|
+
constructor(options: CompletionProviderOutputErrorOptions);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export { COMPLETION_PROVIDER_OUTPUT_ERROR_CODE as C, type GenerateCompletionOptions as G, type MessageMetadataSchema as M, REASONING_EFFORT_CONTROL_ID as R, StandardJSONSchemaV1 as S, type CompletionBaseOptions as a, type CompletionInput as b, CompletionProviderOutputError as c, type CompletionProviderOutputErrorKind as d, type CompletionProviderOutputErrorOptions as e, CompletionStructuredOutputError as f, type CompletionStructuredOutputPhase as g, type GenerateStructuredCompletionOptions as h, type ReasoningEffortControls as i, StandardSchemaV1 as j, type StreamCompletionOptions as k, type StreamStructuredCompletionOptions as l, createMessageSchema as m, defineCompletionModelControls as n, generateCompletion as o, isJsonValue as p, isMessage as q, isStandardSchema as r, messageSchema as s, messagesSchema as t, parseMessage as u, parseMessages as v, streamCompletion as w, isStreamingCompletionModel as x, mergeCompletionControlValues as y };
|
package/dist/schema/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toProviderJsonSchemaFromStandardSchema,
|
|
3
|
+
tryToProviderJsonSchemaFromStandardSchema
|
|
4
|
+
} from "../chunk-YOLOFTAY.js";
|
|
5
|
+
import "../chunk-SQAAVYJG.js";
|
|
6
|
+
export {
|
|
7
|
+
toProviderJsonSchemaFromStandardSchema,
|
|
8
|
+
tryToProviderJsonSchemaFromStandardSchema
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=standard-json-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as SkillLoader, a as SkillSet } from '../types-
|
|
2
|
-
export { c as Skill, S as SkillValidationError, d as SkillValidationIssue } from '../types-
|
|
3
|
-
import '../tool-
|
|
4
|
-
import '../types-
|
|
1
|
+
import { b as SkillLoader, a as SkillSet } from '../types-Cu2tEf3V.js';
|
|
2
|
+
export { c as Skill, S as SkillValidationError, d as SkillValidationIssue } from '../types-Cu2tEf3V.js';
|
|
3
|
+
import '../tool-D_jV3cRZ.js';
|
|
4
|
+
import '../types-DYqZKDA8.js';
|
|
5
5
|
import '../model-call-options-CZkSw_xN.js';
|
|
6
6
|
|
|
7
7
|
declare function loadSkills(loaders: SkillLoader | SkillLoader[]): Promise<SkillSet>;
|