@absolutejs/absolute 0.19.0-beta.247 → 0.19.0-beta.249
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/.absolutejs/eslint-cache +1 -1
- package/.absolutejs/prettier.cache.json +17 -13
- package/.absolutejs/vue-tsc.tsbuildinfo +1 -1
- package/.claude/settings.local.json +2 -1
- package/.playwright-mcp/page-2026-03-31T16-05-33-392Z.png +0 -0
- package/dist/ai/index.js +667 -11
- package/dist/ai/index.js.map +10 -8
- package/dist/ai/providers/anthropic.js +7 -1
- package/dist/ai/providers/anthropic.js.map +3 -3
- package/dist/ai/providers/gemini.js +331 -0
- package/dist/ai/providers/gemini.js.map +10 -0
- package/dist/ai/providers/ollama.js.map +2 -2
- package/dist/ai/providers/openai.js +11 -3
- package/dist/ai/providers/openai.js.map +3 -3
- package/dist/ai/providers/openaiCompatible.js +11 -3
- package/dist/ai/providers/openaiCompatible.js.map +4 -4
- package/dist/ai/providers/openaiResponses.js +432 -0
- package/dist/ai/providers/openaiResponses.js.map +10 -0
- package/dist/ai-client/angular/ai/index.js +61 -1
- package/dist/ai-client/react/ai/index.js +61 -1
- package/dist/ai-client/vue/ai/index.js +61 -1
- package/dist/angular/ai/index.js +62 -2
- package/dist/angular/ai/index.js.map +5 -5
- package/dist/build.js +3 -1
- package/dist/build.js.map +3 -3
- package/dist/index.js +3 -1
- package/dist/index.js.map +3 -3
- package/dist/react/ai/index.js +62 -2
- package/dist/react/ai/index.js.map +6 -6
- package/dist/src/ai/client/actions.d.ts +43 -0
- package/dist/src/ai/index.d.ts +2 -0
- package/dist/src/ai/providers/gemini.d.ts +7 -0
- package/dist/src/ai/providers/openaiResponses.d.ts +10 -0
- package/dist/svelte/ai/index.js +62 -2
- package/dist/svelte/ai/index.js.map +5 -5
- package/dist/types/ai.d.ts +48 -3
- package/dist/vue/ai/index.js +62 -2
- package/dist/vue/ai/index.js.map +5 -5
- package/package.json +9 -1
- package/scripts/build.ts +2 -0
- package/types/ai.ts +80 -6
- package/types/typeGuards.ts +11 -0
package/types/ai.ts
CHANGED
|
@@ -29,7 +29,21 @@ export type AIThinkingChunk = {
|
|
|
29
29
|
content: string;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export type
|
|
32
|
+
export type AIImageChunk = {
|
|
33
|
+
type: 'image';
|
|
34
|
+
data: string;
|
|
35
|
+
format: string;
|
|
36
|
+
isPartial: boolean;
|
|
37
|
+
revisedPrompt?: string;
|
|
38
|
+
imageId?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type AIChunk =
|
|
42
|
+
| AITextChunk
|
|
43
|
+
| AIThinkingChunk
|
|
44
|
+
| AIToolUseChunk
|
|
45
|
+
| AIImageChunk
|
|
46
|
+
| AIDoneChunk;
|
|
33
47
|
|
|
34
48
|
export type AIProviderStreamParams = {
|
|
35
49
|
model: string;
|
|
@@ -51,9 +65,16 @@ export type AIImageSource = {
|
|
|
51
65
|
media_type: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp';
|
|
52
66
|
};
|
|
53
67
|
|
|
68
|
+
export type AIDocumentSource = {
|
|
69
|
+
type: 'base64';
|
|
70
|
+
data: string;
|
|
71
|
+
media_type: 'application/pdf';
|
|
72
|
+
};
|
|
73
|
+
|
|
54
74
|
export type AIProviderContentBlock =
|
|
55
75
|
| { type: 'text'; content: string }
|
|
56
76
|
| { type: 'image'; source: AIImageSource }
|
|
77
|
+
| { type: 'document'; source: AIDocumentSource; name?: string }
|
|
57
78
|
| { type: 'tool_use'; id: string; name: string; input: unknown }
|
|
58
79
|
| { type: 'tool_result'; tool_use_id: string; content: string };
|
|
59
80
|
|
|
@@ -81,7 +102,12 @@ export type AIToolMap = Record<string, AIToolDefinition>;
|
|
|
81
102
|
|
|
82
103
|
export type AIAttachment = {
|
|
83
104
|
data: string;
|
|
84
|
-
media_type:
|
|
105
|
+
media_type:
|
|
106
|
+
| 'image/png'
|
|
107
|
+
| 'image/jpeg'
|
|
108
|
+
| 'image/gif'
|
|
109
|
+
| 'image/webp'
|
|
110
|
+
| 'application/pdf';
|
|
85
111
|
name?: string;
|
|
86
112
|
};
|
|
87
113
|
|
|
@@ -144,6 +170,17 @@ export type AICompleteMessage = {
|
|
|
144
170
|
usage?: AIUsage;
|
|
145
171
|
};
|
|
146
172
|
|
|
173
|
+
export type AIImageMessage = {
|
|
174
|
+
type: 'image';
|
|
175
|
+
data: string;
|
|
176
|
+
format: string;
|
|
177
|
+
isPartial: boolean;
|
|
178
|
+
revisedPrompt?: string;
|
|
179
|
+
imageId?: string;
|
|
180
|
+
messageId: string;
|
|
181
|
+
conversationId: string;
|
|
182
|
+
};
|
|
183
|
+
|
|
147
184
|
export type AIErrorMessage = {
|
|
148
185
|
type: 'error';
|
|
149
186
|
message: string;
|
|
@@ -155,6 +192,7 @@ export type AIServerMessage =
|
|
|
155
192
|
| AIChunkMessage
|
|
156
193
|
| AIThinkingMessage
|
|
157
194
|
| AIToolStatusMessage
|
|
195
|
+
| AIImageMessage
|
|
158
196
|
| AICompleteMessage
|
|
159
197
|
| AIErrorMessage;
|
|
160
198
|
|
|
@@ -169,6 +207,14 @@ export type AIToolCall = {
|
|
|
169
207
|
result?: string;
|
|
170
208
|
};
|
|
171
209
|
|
|
210
|
+
export type AIImageData = {
|
|
211
|
+
data: string;
|
|
212
|
+
format: string;
|
|
213
|
+
isPartial: boolean;
|
|
214
|
+
revisedPrompt?: string;
|
|
215
|
+
imageId?: string;
|
|
216
|
+
};
|
|
217
|
+
|
|
172
218
|
export type AIMessage = {
|
|
173
219
|
id: string;
|
|
174
220
|
role: AIRole;
|
|
@@ -178,6 +224,7 @@ export type AIMessage = {
|
|
|
178
224
|
attachments?: AIAttachment[];
|
|
179
225
|
thinking?: string;
|
|
180
226
|
toolCalls?: AIToolCall[];
|
|
227
|
+
images?: AIImageData[];
|
|
181
228
|
isStreaming?: boolean;
|
|
182
229
|
model?: string;
|
|
183
230
|
usage?: AIUsage;
|
|
@@ -214,6 +261,7 @@ export type StreamAIOptions = {
|
|
|
214
261
|
onChunk?: (chunk: AITextChunk) => AITextChunk | void;
|
|
215
262
|
onComplete?: (fullResponse: string, usage?: AIUsage) => void;
|
|
216
263
|
onToolUse?: (name: string, input: unknown, result: string) => void;
|
|
264
|
+
onImage?: (imageData: AIImageData) => void;
|
|
217
265
|
maxTurns?: number;
|
|
218
266
|
signal?: AbortSignal;
|
|
219
267
|
};
|
|
@@ -257,6 +305,16 @@ export type AIStoreAction =
|
|
|
257
305
|
model?: string;
|
|
258
306
|
usage?: AIUsage;
|
|
259
307
|
}
|
|
308
|
+
| {
|
|
309
|
+
type: 'image';
|
|
310
|
+
conversationId: string;
|
|
311
|
+
messageId: string;
|
|
312
|
+
data: string;
|
|
313
|
+
format: string;
|
|
314
|
+
isPartial: boolean;
|
|
315
|
+
revisedPrompt?: string;
|
|
316
|
+
imageId?: string;
|
|
317
|
+
}
|
|
260
318
|
| { type: 'error'; message: string }
|
|
261
319
|
| {
|
|
262
320
|
type: 'send';
|
|
@@ -287,12 +345,28 @@ export type AIChatPluginConfig = {
|
|
|
287
345
|
path?: string;
|
|
288
346
|
provider: (providerName: string) => AIProviderConfig;
|
|
289
347
|
model?: string | ((providerName: string) => string);
|
|
290
|
-
tools?:
|
|
291
|
-
|
|
348
|
+
tools?:
|
|
349
|
+
| AIToolMap
|
|
350
|
+
| ((providerName: string, model: string) => AIToolMap | undefined);
|
|
351
|
+
thinking?:
|
|
352
|
+
| boolean
|
|
353
|
+
| { budgetTokens: number }
|
|
354
|
+
| ((
|
|
355
|
+
providerName: string,
|
|
356
|
+
model: string
|
|
357
|
+
) => boolean | { budgetTokens: number } | undefined);
|
|
292
358
|
systemPrompt?: string;
|
|
293
359
|
maxTurns?: number;
|
|
294
|
-
parseProvider?: (content: string) => {
|
|
295
|
-
|
|
360
|
+
parseProvider?: (content: string) => {
|
|
361
|
+
content: string;
|
|
362
|
+
model?: string;
|
|
363
|
+
providerName: string;
|
|
364
|
+
};
|
|
365
|
+
onComplete?: (
|
|
366
|
+
conversationId: string,
|
|
367
|
+
fullResponse: string,
|
|
368
|
+
usage?: AIUsage
|
|
369
|
+
) => void;
|
|
296
370
|
};
|
|
297
371
|
|
|
298
372
|
/* ─── Connection options ─── */
|
package/types/typeGuards.ts
CHANGED
|
@@ -69,6 +69,17 @@ export const isValidAIServerMessage = (
|
|
|
69
69
|
'messageId' in data &&
|
|
70
70
|
'conversationId' in data
|
|
71
71
|
);
|
|
72
|
+
case 'image':
|
|
73
|
+
return (
|
|
74
|
+
'data' in data &&
|
|
75
|
+
typeof data.data === 'string' &&
|
|
76
|
+
'format' in data &&
|
|
77
|
+
typeof data.format === 'string' &&
|
|
78
|
+
'isPartial' in data &&
|
|
79
|
+
typeof data.isPartial === 'boolean' &&
|
|
80
|
+
'messageId' in data &&
|
|
81
|
+
'conversationId' in data
|
|
82
|
+
);
|
|
72
83
|
case 'complete':
|
|
73
84
|
return 'messageId' in data && 'conversationId' in data;
|
|
74
85
|
case 'error':
|