@absolutejs/ai 0.1.1 → 0.1.2
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 +6 -0
- package/changelog.json +132 -119
- package/dist/ai/index.js +8 -31
- package/dist/ai/index.js.map +3 -3
- package/dist/ai/providers/openai.js +6 -29
- package/dist/ai/providers/openai.js.map +3 -3
- package/dist/ai/providers/openaiCompatible.js +6 -29
- package/dist/ai/providers/openaiCompatible.js.map +3 -3
- package/dist/ai/providers/openrouter.js +6 -29
- package/dist/ai/providers/openrouter.js.map +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ This file is generated by `absolute-changelog` from the entries in
|
|
|
6
6
|
`changelog/`. Edit an entry, not this file — and add new ones under
|
|
7
7
|
`changelog/unreleased/`.
|
|
8
8
|
|
|
9
|
+
## 0.1.2 — 2026-09-16
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **Preserve every parallel OpenAI tool result and subsequent conversation turn without overwriting expanded messages** (`openai`)
|
|
14
|
+
|
|
9
15
|
## 0.1.1 — 2026-09-16
|
|
10
16
|
|
|
11
17
|
### Added
|
package/changelog.json
CHANGED
|
@@ -1,121 +1,134 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
2
|
+
"contract": 1,
|
|
3
|
+
"name": "@absolutejs/ai",
|
|
4
|
+
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "fixed",
|
|
9
|
+
"summary": "Preserve every parallel OpenAI tool result and subsequent conversation turn without overwriting expanded messages",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"openai"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"date": "2026-09-16",
|
|
16
|
+
"version": "0.1.2"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"changes": [
|
|
20
|
+
{
|
|
21
|
+
"kind": "added",
|
|
22
|
+
"summary": "Allow a separate preparation model with its own verified capacity while preserving the final answer model and invalidating notes when the preparation model changes",
|
|
23
|
+
"symbols": [
|
|
24
|
+
"PrepareAITextInputOptions",
|
|
25
|
+
"prepareAITextInput",
|
|
26
|
+
"prepareAITextInputStep"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"kind": "fixed",
|
|
31
|
+
"summary": "Fill preparation sections with bounded tokenizer-checked refinement, avoid duplicate final counting, and honor cancellation before generation",
|
|
32
|
+
"symbols": [
|
|
33
|
+
"prepareAITextInput",
|
|
34
|
+
"prepareAITextInputStep"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"date": "2026-09-16",
|
|
39
|
+
"version": "0.1.1"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"changes": [
|
|
43
|
+
{
|
|
44
|
+
"kind": "changed",
|
|
45
|
+
"summary": "Validate model capacity by default across generation, structured output, WebSocket and SSE entry points; reserve token headroom and support one protocol-preserving context recovery attempt. Providers without counting capability now fail explicitly; contextPolicy: false opts into raw behavior.",
|
|
46
|
+
"symbols": [
|
|
47
|
+
"generateAI",
|
|
48
|
+
"generateAIWithTools",
|
|
49
|
+
"generateObjectAI",
|
|
50
|
+
"streamAI",
|
|
51
|
+
"streamAIToSSE",
|
|
52
|
+
"streamAIWithTools",
|
|
53
|
+
"inspectAIContext",
|
|
54
|
+
"createAIStoredToolResultRecovery",
|
|
55
|
+
"StreamAIWithToolsOptions",
|
|
56
|
+
"GenerateAIOptions",
|
|
57
|
+
"GenerateAIResult",
|
|
58
|
+
"GenerateObjectAIOptions",
|
|
59
|
+
"AIProviderConfig",
|
|
60
|
+
"StreamAIOptions",
|
|
61
|
+
"AIChatPluginConfig"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"kind": "added",
|
|
66
|
+
"summary": "Add one-section text preparation steps for durable workers, with explicit pending/ready outcomes and checkpoint persistence before yielding",
|
|
67
|
+
"symbols": [
|
|
68
|
+
"prepareAITextInputStep",
|
|
69
|
+
"AITextPreparationStep"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"kind": "added",
|
|
74
|
+
"summary": "Budget final retrieval instructions and tools before compacting text, with matching checkpoint invalidation",
|
|
75
|
+
"symbols": [
|
|
76
|
+
"PrepareAITextInputOptions",
|
|
77
|
+
"prepareAITextInput"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"kind": "fixed",
|
|
82
|
+
"summary": "Preserve conversation origin across long-text preparation sections, distinguish source facts from embedded instructions, reserve more of the available context for factual notes, and invalidate checkpoints from the previous preparation policy",
|
|
83
|
+
"symbols": [
|
|
84
|
+
"prepareAITextInput",
|
|
85
|
+
"prepareAITextInputStep"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"date": "2026-09-16",
|
|
90
|
+
"version": "0.1.0"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"changes": [
|
|
94
|
+
{
|
|
95
|
+
"kind": "added",
|
|
96
|
+
"summary": "Keep compacted text useful with read-only original-source search, checkpointed ingestion, and capacity-checked terminal tool loops",
|
|
97
|
+
"symbols": [
|
|
98
|
+
"createAITextSource",
|
|
99
|
+
"prepareAITextInput",
|
|
100
|
+
"PrepareAITextInputOptions",
|
|
101
|
+
"streamAIWithTools",
|
|
102
|
+
"StreamAIWithToolsOptions"
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"date": "2026-09-15",
|
|
107
|
+
"version": "0.0.58"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"changes": [
|
|
111
|
+
{
|
|
112
|
+
"kind": "internal",
|
|
113
|
+
"summary": "Regenerate the OpenRouter client declaration with equivalent reordered response union types",
|
|
114
|
+
"symbols": [
|
|
115
|
+
"createOpenRouterClient"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"kind": "added",
|
|
120
|
+
"summary": "Add model-specific token capacity, optional provider capacity configuration, and recoverable long-text preparation",
|
|
121
|
+
"symbols": [
|
|
122
|
+
"inspectAIInput",
|
|
123
|
+
"prepareAITextInput",
|
|
124
|
+
"AIProviderConfig",
|
|
125
|
+
"OpenAIConfig",
|
|
126
|
+
"OpenAIResponsesConfig"
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"date": "2026-09-15",
|
|
131
|
+
"version": "0.0.57"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
121
134
|
}
|
package/dist/ai/index.js
CHANGED
|
@@ -1262,30 +1262,6 @@ var buildToolMessages = (blocks) => {
|
|
|
1262
1262
|
}
|
|
1263
1263
|
return messages;
|
|
1264
1264
|
};
|
|
1265
|
-
var processMessageAtIndex = (result, msg, idx) => {
|
|
1266
|
-
if (!hasArrayContent(msg)) {
|
|
1267
|
-
return;
|
|
1268
|
-
}
|
|
1269
|
-
const hasToolBlocks2 = msg.content.some((block) => block.type === "tool_use" || block.type === "tool_result");
|
|
1270
|
-
if (!hasToolBlocks2) {
|
|
1271
|
-
return;
|
|
1272
|
-
}
|
|
1273
|
-
const toolMessages = buildToolMessages(msg.content);
|
|
1274
|
-
result.splice(idx, 1, ...toolMessages);
|
|
1275
|
-
};
|
|
1276
|
-
var convertSingleMessage = (result, msg, idx) => {
|
|
1277
|
-
if (!msg) {
|
|
1278
|
-
return;
|
|
1279
|
-
}
|
|
1280
|
-
processMessageAtIndex(result, msg, idx);
|
|
1281
|
-
};
|
|
1282
|
-
var convertToolResultMessages = (messages, params) => {
|
|
1283
|
-
const result = [...messages];
|
|
1284
|
-
for (let idx = 0;idx < params.messages.length; idx++) {
|
|
1285
|
-
convertSingleMessage(result, params.messages[idx], idx);
|
|
1286
|
-
}
|
|
1287
|
-
return result;
|
|
1288
|
-
};
|
|
1289
1265
|
var mapToolDefinitions = (tools) => tools.map((tool) => ({
|
|
1290
1266
|
function: {
|
|
1291
1267
|
description: tool.description,
|
|
@@ -1342,10 +1318,11 @@ var mapOpenAIContent = (msg) => {
|
|
|
1342
1318
|
return msg.content.map(mapContentBlockToOpenAI).filter((mapped) => mapped !== null);
|
|
1343
1319
|
};
|
|
1344
1320
|
var buildRequestBody = (params, capabilityModel = params.model) => {
|
|
1345
|
-
const messages =
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1321
|
+
const messages = params.messages.flatMap((msg) => {
|
|
1322
|
+
if (hasArrayContent(msg) && msg.content.some((block) => block.type === "tool_use" || block.type === "tool_result"))
|
|
1323
|
+
return buildToolMessages(msg.content);
|
|
1324
|
+
return [{ content: mapOpenAIContent(msg), role: msg.role }];
|
|
1325
|
+
});
|
|
1349
1326
|
if (params.systemPrompt) {
|
|
1350
1327
|
messages.unshift({ content: params.systemPrompt, role: "system" });
|
|
1351
1328
|
}
|
|
@@ -1882,7 +1859,7 @@ var convertMessageContent = (content) => {
|
|
|
1882
1859
|
return content.map(mapContentBlock).filter((mapped) => mapped !== null);
|
|
1883
1860
|
};
|
|
1884
1861
|
var hasFunctionResponse = (content) => content.some((block) => block.type === "tool_result");
|
|
1885
|
-
var
|
|
1862
|
+
var convertSingleMessage = (msg) => {
|
|
1886
1863
|
if (typeof msg.content !== "string" && hasFunctionResponse(msg.content)) {
|
|
1887
1864
|
return { parts: convertMessageContent(msg.content), role: "user" };
|
|
1888
1865
|
}
|
|
@@ -1891,7 +1868,7 @@ var convertSingleMessage2 = (msg) => {
|
|
|
1891
1868
|
role: mapRole(msg.role)
|
|
1892
1869
|
};
|
|
1893
1870
|
};
|
|
1894
|
-
var convertMessages = (messages) => messages.map(
|
|
1871
|
+
var convertMessages = (messages) => messages.map(convertSingleMessage);
|
|
1895
1872
|
var mapToolDefinitions2 = (tools) => tools.map((tool) => ({
|
|
1896
1873
|
description: tool.description,
|
|
1897
1874
|
name: tool.name,
|
|
@@ -8727,5 +8704,5 @@ export {
|
|
|
8727
8704
|
xai
|
|
8728
8705
|
};
|
|
8729
8706
|
|
|
8730
|
-
//# debugId=
|
|
8707
|
+
//# debugId=5DA989DD67F99C1B64756E2164756E21
|
|
8731
8708
|
//# sourceMappingURL=index.js.map
|