@absolutejs/ai 0.3.4 → 0.4.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/CHANGELOG.md +12 -0
- package/changelog.json +24 -0
- package/dist/ai/index.js +89 -7
- package/dist/ai/index.js.map +4 -4
- package/dist/ai/providers/anthropic.js +71 -3
- package/dist/ai/providers/anthropic.js.map +3 -3
- package/dist/ai/providers/openrouter.js +71 -3
- package/dist/ai/providers/openrouter.js.map +3 -3
- package/dist/types/ai.d.ts +15 -1
- package/dist/types/anthropic.d.ts +2 -0
- package/package.json +1 -1
package/dist/types/ai.d.ts
CHANGED
|
@@ -118,6 +118,20 @@ export type AIToolUseChunk = {
|
|
|
118
118
|
/** Opaque provider state that must be replayed with this tool call. */
|
|
119
119
|
providerData?: Record<string, unknown>;
|
|
120
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* A tool call whose input is still streaming. Long inputs (a whole file) take
|
|
123
|
+
* the model a minute or more to produce, and nothing else arrives meanwhile;
|
|
124
|
+
* this says which tool, how much of its input has arrived, and the short
|
|
125
|
+
* fields already complete (such as a path), so a UI can show the work.
|
|
126
|
+
*/
|
|
127
|
+
export type AIToolInputChunk = {
|
|
128
|
+
type: "tool_input";
|
|
129
|
+
id: string;
|
|
130
|
+
name: string;
|
|
131
|
+
receivedChars: number;
|
|
132
|
+
/** Complete top-level string fields of up to 200 characters, so far. */
|
|
133
|
+
fields: Record<string, string>;
|
|
134
|
+
};
|
|
121
135
|
export type AIProviderEventChunk = {
|
|
122
136
|
type: "provider_event";
|
|
123
137
|
provider: string;
|
|
@@ -169,7 +183,7 @@ export type AIUsageUpdateChunk = {
|
|
|
169
183
|
type: "usage_update";
|
|
170
184
|
usage: AIUsage;
|
|
171
185
|
};
|
|
172
|
-
export type AIChunk = AITextChunk | AIThinkingChunk | AIToolUseChunk | AIImageChunk | AIAudioChunk | AICitationChunk | AIUsageUpdateChunk | AIProviderEventChunk | AIDoneChunk;
|
|
186
|
+
export type AIChunk = AITextChunk | AIThinkingChunk | AIToolUseChunk | AIToolInputChunk | AIImageChunk | AIAudioChunk | AICitationChunk | AIUsageUpdateChunk | AIProviderEventChunk | AIDoneChunk;
|
|
173
187
|
export type AIProviderToolChoice = "auto" | "none" | "required" | {
|
|
174
188
|
name: string;
|
|
175
189
|
};
|
|
@@ -58,6 +58,8 @@ export type AnthropicSSEState = {
|
|
|
58
58
|
stopReason: string;
|
|
59
59
|
thinkingSignature: string;
|
|
60
60
|
toolInputJson: string;
|
|
61
|
+
/** Input length when progress was last reported for the current tool. */
|
|
62
|
+
toolInputReported: number;
|
|
61
63
|
usage: AIUsage | undefined;
|
|
62
64
|
metadata?: AIResponseMetadata;
|
|
63
65
|
providerName: string;
|