@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.
Files changed (42) hide show
  1. package/.absolutejs/eslint-cache +1 -1
  2. package/.absolutejs/prettier.cache.json +17 -13
  3. package/.absolutejs/vue-tsc.tsbuildinfo +1 -1
  4. package/.claude/settings.local.json +2 -1
  5. package/.playwright-mcp/page-2026-03-31T16-05-33-392Z.png +0 -0
  6. package/dist/ai/index.js +667 -11
  7. package/dist/ai/index.js.map +10 -8
  8. package/dist/ai/providers/anthropic.js +7 -1
  9. package/dist/ai/providers/anthropic.js.map +3 -3
  10. package/dist/ai/providers/gemini.js +331 -0
  11. package/dist/ai/providers/gemini.js.map +10 -0
  12. package/dist/ai/providers/ollama.js.map +2 -2
  13. package/dist/ai/providers/openai.js +11 -3
  14. package/dist/ai/providers/openai.js.map +3 -3
  15. package/dist/ai/providers/openaiCompatible.js +11 -3
  16. package/dist/ai/providers/openaiCompatible.js.map +4 -4
  17. package/dist/ai/providers/openaiResponses.js +432 -0
  18. package/dist/ai/providers/openaiResponses.js.map +10 -0
  19. package/dist/ai-client/angular/ai/index.js +61 -1
  20. package/dist/ai-client/react/ai/index.js +61 -1
  21. package/dist/ai-client/vue/ai/index.js +61 -1
  22. package/dist/angular/ai/index.js +62 -2
  23. package/dist/angular/ai/index.js.map +5 -5
  24. package/dist/build.js +3 -1
  25. package/dist/build.js.map +3 -3
  26. package/dist/index.js +3 -1
  27. package/dist/index.js.map +3 -3
  28. package/dist/react/ai/index.js +62 -2
  29. package/dist/react/ai/index.js.map +6 -6
  30. package/dist/src/ai/client/actions.d.ts +43 -0
  31. package/dist/src/ai/index.d.ts +2 -0
  32. package/dist/src/ai/providers/gemini.d.ts +7 -0
  33. package/dist/src/ai/providers/openaiResponses.d.ts +10 -0
  34. package/dist/svelte/ai/index.js +62 -2
  35. package/dist/svelte/ai/index.js.map +5 -5
  36. package/dist/types/ai.d.ts +48 -3
  37. package/dist/vue/ai/index.js +62 -2
  38. package/dist/vue/ai/index.js.map +5 -5
  39. package/package.json +9 -1
  40. package/scripts/build.ts +2 -0
  41. package/types/ai.ts +80 -6
  42. 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 AIChunk = AITextChunk | AIThinkingChunk | AIToolUseChunk | AIDoneChunk;
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: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp';
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?: AIToolMap | ((providerName: string, model: string) => AIToolMap | undefined);
291
- thinking?: boolean | { budgetTokens: number } | ((providerName: string, model: string) => boolean | { budgetTokens: number } | undefined);
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) => { content: string; model?: string; providerName: string };
295
- onComplete?: (conversationId: string, fullResponse: string, usage?: AIUsage) => void;
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 ─── */
@@ -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':