@absolutejs/ai 0.2.11 → 0.3.1

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.
@@ -1,5 +1,5 @@
1
1
  import { type AIContextPolicy } from "./contextPolicy";
2
- import type { AICitationChunk, AIProviderConfig, AIProviderContentBlock, AIProviderMessage, AIProviderResponseFormat, AIProviderToolChoice, AIProviderToolDefinition, AIResponseMetadata, AIToolMap, AIUsage, ReasoningConfig } from "../../types/ai";
2
+ import type { AICitationChunk, AIImageData, AIProviderConfig, AIProviderContentBlock, AIProviderMessage, AIProviderResponseFormat, AIProviderToolChoice, AIProviderToolDefinition, AIResponseMetadata, AIToolMap, AIUsage, ReasoningConfig } from "../../types/ai";
3
3
  export type GenerateAIToolCall = {
4
4
  id: string;
5
5
  name: string;
@@ -34,6 +34,8 @@ export type GenerateAIResult = {
34
34
  /** Actual request history after any context recovery. */
35
35
  requestMessages?: AIProviderMessage[];
36
36
  citations: AICitationChunk[];
37
+ /** Finished images the model generated (e.g. OpenAI's hosted image tool). */
38
+ images: AIImageData[];
37
39
  metadata?: AIResponseMetadata;
38
40
  text: string;
39
41
  toolCalls: GenerateAIToolCall[];
@@ -55,6 +57,8 @@ export type GenerateAIWithToolsOptions = Omit<GenerateAIOptions, "tools" | "tool
55
57
  };
56
58
  export type GenerateAIWithToolsResult = {
57
59
  text: string;
60
+ /** Finished images generated across every turn. */
61
+ images: AIImageData[];
58
62
  toolCalls: GenerateAIToolCall[];
59
63
  /** Model turns consumed, including a forced final synthesis when needed. */
60
64
  turns: number;
@@ -1,4 +1,4 @@
1
- import type { AIResponseMetadata, AIProviderToolChoice, AIToolMap, AIUsage } from "../../types/ai";
1
+ import type { AIImageData, AIResponseMetadata, AIProviderToolChoice, AIToolMap, AIUsage } from "../../types/ai";
2
2
  import { type GenerateAIOptions, type GenerateAIToolCall } from "./generateAI";
3
3
  export type StreamAIWithToolsOptions = Omit<GenerateAIOptions, "tools" | "toolChoice"> & {
4
4
  /** Tools the model may call — each with a `handler` the loop runs on its behalf. */
@@ -14,6 +14,8 @@ export type StreamAIWithToolsOptions = Omit<GenerateAIOptions, "tools" | "toolCh
14
14
  export type StreamAIWithToolsSummary = {
15
15
  /** All assistant text across every turn, concatenated in stream order. */
16
16
  text: string;
17
+ /** Finished images the model generated across every turn. */
18
+ images: AIImageData[];
17
19
  /** Every tool call the model made (executed or not), in order. */
18
20
  toolCalls: GenerateAIToolCall[];
19
21
  /** Model turns consumed (1 = no tool round-trips). */
@@ -27,7 +29,11 @@ export type StreamAIWithToolsEvent = {
27
29
  } | {
28
30
  type: "text";
29
31
  content: string;
30
- } | {
32
+ }
33
+ /** A generated image; `isPartial` previews arrive before the finished one. */
34
+ | ({
35
+ type: "image";
36
+ } & AIImageData) | {
31
37
  type: "audio";
32
38
  data: string;
33
39
  format: string;
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@absolutejs/ai",
3
- "version": "0.2.11",
3
+ "version": "0.3.1",
4
4
  "homepage": "https://github.com/absolutejs/ai",
5
5
  "bugs": {
6
6
  "url": "https://github.com/absolutejs/ai/issues"
7
7
  },
8
8
  "license": "BSL-1.1",
9
9
  "description": "AI runtime, providers, streaming, and framework adapters extracted from AbsoluteJS",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/absolutejs/ai.git"
13
+ },
10
14
  "type": "module",
11
15
  "main": "./dist/ai/index.js",
12
16
  "types": "./dist/src/ai/index.d.ts",