@absolutejs/ai 0.2.5 → 0.2.7
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/README.md +13 -0
- package/changelog.json +276 -244
- package/dist/ai/index.js +37 -15
- package/dist/ai/index.js.map +7 -7
- package/dist/ai/providers/anthropic.js +34 -15
- package/dist/ai/providers/anthropic.js.map +5 -5
- package/dist/ai/providers/gemini.js +3 -2
- package/dist/ai/providers/gemini.js.map +4 -4
- package/dist/ai/providers/ollama.js +2 -2
- package/dist/ai/providers/ollama.js.map +3 -3
- package/dist/ai/providers/openai.js +3 -2
- package/dist/ai/providers/openai.js.map +4 -4
- package/dist/ai/providers/openaiCompatible.js +3 -2
- package/dist/ai/providers/openaiCompatible.js.map +4 -4
- package/dist/ai/providers/openaiResponses.js +3 -2
- package/dist/ai/providers/openaiResponses.js.map +4 -4
- package/dist/ai/providers/openrouter.js +34 -15
- package/dist/ai/providers/openrouter.js.map +5 -5
- package/dist/ai/research.js +84 -0
- package/dist/ai/research.js.map +10 -0
- package/dist/src/ai/generateAI.d.ts +2 -0
- package/dist/src/ai/inputCapacity.d.ts +4 -0
- package/dist/src/ai/research.d.ts +33 -0
- package/dist/src/ai/research.test.d.ts +1 -0
- package/dist/types/ai.d.ts +4 -0
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ 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.2.7 — 2026-09-24
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Add injected evidence research orchestration and per-request transport retry limits for host-owned accounting** (`GenerateAIOptions`, `GenerateObjectAIOptions`, `AIProviderStreamParams`)
|
|
14
|
+
|
|
15
|
+
## 0.2.6 — 2026-09-20
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Count supported Anthropic caller input when hosted tools cannot be pre-counted, preserving full generation requests and exposing honest count scope** (`anthropic`, `inspectAIInput`, `AIInputCapacity`, `AIProviderConfig`, `createAIProviderRouter`)
|
|
20
|
+
|
|
9
21
|
## 0.2.5 — 2026-09-20
|
|
10
22
|
|
|
11
23
|
### Fixed
|
package/README.md
CHANGED
|
@@ -388,6 +388,17 @@ Unknown models/providers fail with `AIInputError` (`capacity_unavailable`) rathe
|
|
|
388
388
|
than guessing. Custom providers can implement the optional `inputCapacity`
|
|
389
389
|
capability. Existing `stream` calls remain unchanged.
|
|
390
390
|
|
|
391
|
+
Anthropic cannot pre-count hosted web search, web fetch, code execution or tool
|
|
392
|
+
search definitions. The adapter omits only those definitions (and dependent tool
|
|
393
|
+
choice) from the counting request, preserving system text, messages and client
|
|
394
|
+
tools. `inspectAIInput(...).inputTokenScope` is `"caller-input"` in this case,
|
|
395
|
+
and `"request"` otherwise; provider routers preserve the scope. `fits` describes
|
|
396
|
+
the counted scope, not a guarantee that future hosted results fit. Generation
|
|
397
|
+
still sends the complete hosted-tool configuration, and Anthropic validates the
|
|
398
|
+
full request and reports actual usage. No guessed overhead or paid probe is used.
|
|
399
|
+
Custom providers can expose `inputCapacity.countScope(params)` without changing
|
|
400
|
+
the numeric `countTokens` contract. See the [Anthropic counting limitations](https://platform.claude.com/docs/en/build-with-claude/token-counting).
|
|
401
|
+
|
|
391
402
|
Automatic preparation supports text-only history. It rejects oversized tool or
|
|
392
403
|
multimodal histories rather than flattening them. Handle preparation errors in
|
|
393
404
|
the UI while preserving the original input; expose retry without clearing the
|
|
@@ -528,3 +539,5 @@ Consumers must separately explain whether attachments, hosted search, structured
|
|
|
528
539
|
output, and media generation are enabled in their UI and endpoint. Context windows
|
|
529
540
|
are documented provider limits, not a substitute for runtime token budgeting.
|
|
530
541
|
Regional features are omitted when they are not consistently supported.
|
|
542
|
+
|
|
543
|
+
`@absolutejs/ai/research` separates an injected `SearchProvider` from evidence-only synthesis. It returns sources, findings, searches, limitations and explicit availability, and excludes invented source references/quotes. Quotation checks establish provenance; they are not a substitute for claim entailment or entity review. Hosts can set `maxRetries: 0` on one-shot or stream requests when they own attempt accounting, and independently bound `maxRepairAttempts` and disable context recovery.
|
package/changelog.json
CHANGED
|
@@ -1,246 +1,278 @@
|
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
2
|
+
"contract": 1,
|
|
3
|
+
"name": "@absolutejs/ai",
|
|
4
|
+
"releases": [
|
|
5
|
+
{
|
|
6
|
+
"changes": [
|
|
7
|
+
{
|
|
8
|
+
"kind": "added",
|
|
9
|
+
"summary": "Add injected evidence research orchestration and per-request transport retry limits for host-owned accounting",
|
|
10
|
+
"symbols": [
|
|
11
|
+
"GenerateAIOptions",
|
|
12
|
+
"GenerateObjectAIOptions",
|
|
13
|
+
"AIProviderStreamParams"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"date": "2026-09-24",
|
|
18
|
+
"version": "0.2.7"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"changes": [
|
|
22
|
+
{
|
|
23
|
+
"kind": "fixed",
|
|
24
|
+
"summary": "Count supported Anthropic caller input when hosted tools cannot be pre-counted, preserving full generation requests and exposing honest count scope",
|
|
25
|
+
"symbols": [
|
|
26
|
+
"anthropic",
|
|
27
|
+
"inspectAIInput",
|
|
28
|
+
"AIInputCapacity",
|
|
29
|
+
"AIProviderConfig",
|
|
30
|
+
"createAIProviderRouter"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"date": "2026-09-20",
|
|
35
|
+
"version": "0.2.6"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"changes": [
|
|
39
|
+
{
|
|
40
|
+
"kind": "fixed",
|
|
41
|
+
"summary": "Allow SSE tool loops to reread changed files without silently completing; retain turn, time and token limits",
|
|
42
|
+
"symbols": [
|
|
43
|
+
"streamAIToSSE"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"date": "2026-09-20",
|
|
48
|
+
"version": "0.2.5"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"changes": [
|
|
52
|
+
{
|
|
53
|
+
"kind": "added",
|
|
54
|
+
"summary": "Add reviewed per-model reasoning controls, provider translations, and compatible thinking stream replay.",
|
|
55
|
+
"symbols": [
|
|
56
|
+
"MODEL_REASONING",
|
|
57
|
+
"REASONING_EFFORTS",
|
|
58
|
+
"getModelReasoning",
|
|
59
|
+
"isReasoningSelection",
|
|
60
|
+
"supportsReasoningSelection",
|
|
61
|
+
"reasoningSelectionLabel",
|
|
62
|
+
"ModelReasoning",
|
|
63
|
+
"ReasoningSelection",
|
|
64
|
+
"ReasoningEffort"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"date": "2026-09-20",
|
|
69
|
+
"version": "0.2.4"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"changes": [
|
|
73
|
+
{
|
|
74
|
+
"kind": "internal",
|
|
75
|
+
"summary": "Republish the capability catalog using npm packaging after the 0.2.2 registry artifact remained unavailable"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"date": "2026-09-20",
|
|
79
|
+
"version": "0.2.3"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"changes": [
|
|
83
|
+
{
|
|
84
|
+
"kind": "added",
|
|
85
|
+
"summary": "Add browser-safe typed model capability metadata with verified provider sources, separate input and output modalities, context windows, and capability descriptions",
|
|
86
|
+
"symbols": [
|
|
87
|
+
"ModelModality",
|
|
88
|
+
"ModelFeature",
|
|
89
|
+
"ModelMetadata",
|
|
90
|
+
"ModelCapability",
|
|
91
|
+
"MODEL_CAPABILITY_DESCRIPTIONS",
|
|
92
|
+
"MODEL_METADATA",
|
|
93
|
+
"modelCapabilities",
|
|
94
|
+
"getModelMetadata"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"date": "2026-09-20",
|
|
99
|
+
"version": "0.2.2"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"changes": [
|
|
103
|
+
{
|
|
104
|
+
"kind": "fixed",
|
|
105
|
+
"summary": "Preserve provider output reservations and context-error recognition when routing models",
|
|
106
|
+
"symbols": [
|
|
107
|
+
"createAIProviderRouter"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"date": "2026-09-16",
|
|
112
|
+
"version": "0.2.1"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"changes": [
|
|
116
|
+
{
|
|
117
|
+
"kind": "added",
|
|
118
|
+
"summary": "Expose each tool-loop turn response metadata so consumers can price the actual served processing tier",
|
|
119
|
+
"symbols": [
|
|
120
|
+
"streamAIWithTools",
|
|
121
|
+
"StreamAIWithToolsEvent"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"kind": "added",
|
|
126
|
+
"summary": "Route exact model IDs to the same provider for token counting, capacity checks, preparation and generation",
|
|
127
|
+
"symbols": [
|
|
128
|
+
"createAIProviderRouter"
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"date": "2026-09-16",
|
|
133
|
+
"version": "0.2.0"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"changes": [
|
|
137
|
+
{
|
|
138
|
+
"kind": "fixed",
|
|
139
|
+
"summary": "Exclude OpenAI cache-write tokens from ordinary input so cache-aware billing never charges the same tokens twice",
|
|
140
|
+
"symbols": [
|
|
141
|
+
"openai",
|
|
142
|
+
"openaiResponses"
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"date": "2026-09-16",
|
|
147
|
+
"version": "0.1.3"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"changes": [
|
|
151
|
+
{
|
|
152
|
+
"kind": "fixed",
|
|
153
|
+
"summary": "Preserve every parallel OpenAI tool result and subsequent conversation turn without overwriting expanded messages",
|
|
154
|
+
"symbols": [
|
|
155
|
+
"openai"
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
"date": "2026-09-16",
|
|
160
|
+
"version": "0.1.2"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"changes": [
|
|
164
|
+
{
|
|
165
|
+
"kind": "added",
|
|
166
|
+
"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",
|
|
167
|
+
"symbols": [
|
|
168
|
+
"PrepareAITextInputOptions",
|
|
169
|
+
"prepareAITextInput",
|
|
170
|
+
"prepareAITextInputStep"
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"kind": "fixed",
|
|
175
|
+
"summary": "Fill preparation sections with bounded tokenizer-checked refinement, avoid duplicate final counting, and honor cancellation before generation",
|
|
176
|
+
"symbols": [
|
|
177
|
+
"prepareAITextInput",
|
|
178
|
+
"prepareAITextInputStep"
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"date": "2026-09-16",
|
|
183
|
+
"version": "0.1.1"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"changes": [
|
|
187
|
+
{
|
|
188
|
+
"kind": "changed",
|
|
189
|
+
"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.",
|
|
190
|
+
"symbols": [
|
|
191
|
+
"generateAI",
|
|
192
|
+
"generateAIWithTools",
|
|
193
|
+
"generateObjectAI",
|
|
194
|
+
"streamAI",
|
|
195
|
+
"streamAIToSSE",
|
|
196
|
+
"streamAIWithTools",
|
|
197
|
+
"inspectAIContext",
|
|
198
|
+
"createAIStoredToolResultRecovery",
|
|
199
|
+
"StreamAIWithToolsOptions",
|
|
200
|
+
"GenerateAIOptions",
|
|
201
|
+
"GenerateAIResult",
|
|
202
|
+
"GenerateObjectAIOptions",
|
|
203
|
+
"AIProviderConfig",
|
|
204
|
+
"StreamAIOptions",
|
|
205
|
+
"AIChatPluginConfig"
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"kind": "added",
|
|
210
|
+
"summary": "Add one-section text preparation steps for durable workers, with explicit pending/ready outcomes and checkpoint persistence before yielding",
|
|
211
|
+
"symbols": [
|
|
212
|
+
"prepareAITextInputStep",
|
|
213
|
+
"AITextPreparationStep"
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"kind": "added",
|
|
218
|
+
"summary": "Budget final retrieval instructions and tools before compacting text, with matching checkpoint invalidation",
|
|
219
|
+
"symbols": [
|
|
220
|
+
"PrepareAITextInputOptions",
|
|
221
|
+
"prepareAITextInput"
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"kind": "fixed",
|
|
226
|
+
"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",
|
|
227
|
+
"symbols": [
|
|
228
|
+
"prepareAITextInput",
|
|
229
|
+
"prepareAITextInputStep"
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
"date": "2026-09-16",
|
|
234
|
+
"version": "0.1.0"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"changes": [
|
|
238
|
+
{
|
|
239
|
+
"kind": "added",
|
|
240
|
+
"summary": "Keep compacted text useful with read-only original-source search, checkpointed ingestion, and capacity-checked terminal tool loops",
|
|
241
|
+
"symbols": [
|
|
242
|
+
"createAITextSource",
|
|
243
|
+
"prepareAITextInput",
|
|
244
|
+
"PrepareAITextInputOptions",
|
|
245
|
+
"streamAIWithTools",
|
|
246
|
+
"StreamAIWithToolsOptions"
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
"date": "2026-09-15",
|
|
251
|
+
"version": "0.0.58"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"changes": [
|
|
255
|
+
{
|
|
256
|
+
"kind": "internal",
|
|
257
|
+
"summary": "Regenerate the OpenRouter client declaration with equivalent reordered response union types",
|
|
258
|
+
"symbols": [
|
|
259
|
+
"createOpenRouterClient"
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"kind": "added",
|
|
264
|
+
"summary": "Add model-specific token capacity, optional provider capacity configuration, and recoverable long-text preparation",
|
|
265
|
+
"symbols": [
|
|
266
|
+
"inspectAIInput",
|
|
267
|
+
"prepareAITextInput",
|
|
268
|
+
"AIProviderConfig",
|
|
269
|
+
"OpenAIConfig",
|
|
270
|
+
"OpenAIResponsesConfig"
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"date": "2026-09-15",
|
|
275
|
+
"version": "0.0.57"
|
|
276
|
+
}
|
|
277
|
+
]
|
|
246
278
|
}
|