@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 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
- "contract": 1,
3
- "name": "@absolutejs/ai",
4
- "releases": [
5
- {
6
- "changes": [
7
- {
8
- "kind": "fixed",
9
- "summary": "Allow SSE tool loops to reread changed files without silently completing; retain turn, time and token limits",
10
- "symbols": [
11
- "streamAIToSSE"
12
- ]
13
- }
14
- ],
15
- "date": "2026-09-20",
16
- "version": "0.2.5"
17
- },
18
- {
19
- "changes": [
20
- {
21
- "kind": "added",
22
- "summary": "Add reviewed per-model reasoning controls, provider translations, and compatible thinking stream replay.",
23
- "symbols": [
24
- "MODEL_REASONING",
25
- "REASONING_EFFORTS",
26
- "getModelReasoning",
27
- "isReasoningSelection",
28
- "supportsReasoningSelection",
29
- "reasoningSelectionLabel",
30
- "ModelReasoning",
31
- "ReasoningSelection",
32
- "ReasoningEffort"
33
- ]
34
- }
35
- ],
36
- "date": "2026-09-20",
37
- "version": "0.2.4"
38
- },
39
- {
40
- "changes": [
41
- {
42
- "kind": "internal",
43
- "summary": "Republish the capability catalog using npm packaging after the 0.2.2 registry artifact remained unavailable"
44
- }
45
- ],
46
- "date": "2026-09-20",
47
- "version": "0.2.3"
48
- },
49
- {
50
- "changes": [
51
- {
52
- "kind": "added",
53
- "summary": "Add browser-safe typed model capability metadata with verified provider sources, separate input and output modalities, context windows, and capability descriptions",
54
- "symbols": [
55
- "ModelModality",
56
- "ModelFeature",
57
- "ModelMetadata",
58
- "ModelCapability",
59
- "MODEL_CAPABILITY_DESCRIPTIONS",
60
- "MODEL_METADATA",
61
- "modelCapabilities",
62
- "getModelMetadata"
63
- ]
64
- }
65
- ],
66
- "date": "2026-09-20",
67
- "version": "0.2.2"
68
- },
69
- {
70
- "changes": [
71
- {
72
- "kind": "fixed",
73
- "summary": "Preserve provider output reservations and context-error recognition when routing models",
74
- "symbols": [
75
- "createAIProviderRouter"
76
- ]
77
- }
78
- ],
79
- "date": "2026-09-16",
80
- "version": "0.2.1"
81
- },
82
- {
83
- "changes": [
84
- {
85
- "kind": "added",
86
- "summary": "Expose each tool-loop turn response metadata so consumers can price the actual served processing tier",
87
- "symbols": [
88
- "streamAIWithTools",
89
- "StreamAIWithToolsEvent"
90
- ]
91
- },
92
- {
93
- "kind": "added",
94
- "summary": "Route exact model IDs to the same provider for token counting, capacity checks, preparation and generation",
95
- "symbols": [
96
- "createAIProviderRouter"
97
- ]
98
- }
99
- ],
100
- "date": "2026-09-16",
101
- "version": "0.2.0"
102
- },
103
- {
104
- "changes": [
105
- {
106
- "kind": "fixed",
107
- "summary": "Exclude OpenAI cache-write tokens from ordinary input so cache-aware billing never charges the same tokens twice",
108
- "symbols": [
109
- "openai",
110
- "openaiResponses"
111
- ]
112
- }
113
- ],
114
- "date": "2026-09-16",
115
- "version": "0.1.3"
116
- },
117
- {
118
- "changes": [
119
- {
120
- "kind": "fixed",
121
- "summary": "Preserve every parallel OpenAI tool result and subsequent conversation turn without overwriting expanded messages",
122
- "symbols": [
123
- "openai"
124
- ]
125
- }
126
- ],
127
- "date": "2026-09-16",
128
- "version": "0.1.2"
129
- },
130
- {
131
- "changes": [
132
- {
133
- "kind": "added",
134
- "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",
135
- "symbols": [
136
- "PrepareAITextInputOptions",
137
- "prepareAITextInput",
138
- "prepareAITextInputStep"
139
- ]
140
- },
141
- {
142
- "kind": "fixed",
143
- "summary": "Fill preparation sections with bounded tokenizer-checked refinement, avoid duplicate final counting, and honor cancellation before generation",
144
- "symbols": [
145
- "prepareAITextInput",
146
- "prepareAITextInputStep"
147
- ]
148
- }
149
- ],
150
- "date": "2026-09-16",
151
- "version": "0.1.1"
152
- },
153
- {
154
- "changes": [
155
- {
156
- "kind": "changed",
157
- "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.",
158
- "symbols": [
159
- "generateAI",
160
- "generateAIWithTools",
161
- "generateObjectAI",
162
- "streamAI",
163
- "streamAIToSSE",
164
- "streamAIWithTools",
165
- "inspectAIContext",
166
- "createAIStoredToolResultRecovery",
167
- "StreamAIWithToolsOptions",
168
- "GenerateAIOptions",
169
- "GenerateAIResult",
170
- "GenerateObjectAIOptions",
171
- "AIProviderConfig",
172
- "StreamAIOptions",
173
- "AIChatPluginConfig"
174
- ]
175
- },
176
- {
177
- "kind": "added",
178
- "summary": "Add one-section text preparation steps for durable workers, with explicit pending/ready outcomes and checkpoint persistence before yielding",
179
- "symbols": [
180
- "prepareAITextInputStep",
181
- "AITextPreparationStep"
182
- ]
183
- },
184
- {
185
- "kind": "added",
186
- "summary": "Budget final retrieval instructions and tools before compacting text, with matching checkpoint invalidation",
187
- "symbols": [
188
- "PrepareAITextInputOptions",
189
- "prepareAITextInput"
190
- ]
191
- },
192
- {
193
- "kind": "fixed",
194
- "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",
195
- "symbols": [
196
- "prepareAITextInput",
197
- "prepareAITextInputStep"
198
- ]
199
- }
200
- ],
201
- "date": "2026-09-16",
202
- "version": "0.1.0"
203
- },
204
- {
205
- "changes": [
206
- {
207
- "kind": "added",
208
- "summary": "Keep compacted text useful with read-only original-source search, checkpointed ingestion, and capacity-checked terminal tool loops",
209
- "symbols": [
210
- "createAITextSource",
211
- "prepareAITextInput",
212
- "PrepareAITextInputOptions",
213
- "streamAIWithTools",
214
- "StreamAIWithToolsOptions"
215
- ]
216
- }
217
- ],
218
- "date": "2026-09-15",
219
- "version": "0.0.58"
220
- },
221
- {
222
- "changes": [
223
- {
224
- "kind": "internal",
225
- "summary": "Regenerate the OpenRouter client declaration with equivalent reordered response union types",
226
- "symbols": [
227
- "createOpenRouterClient"
228
- ]
229
- },
230
- {
231
- "kind": "added",
232
- "summary": "Add model-specific token capacity, optional provider capacity configuration, and recoverable long-text preparation",
233
- "symbols": [
234
- "inspectAIInput",
235
- "prepareAITextInput",
236
- "AIProviderConfig",
237
- "OpenAIConfig",
238
- "OpenAIResponsesConfig"
239
- ]
240
- }
241
- ],
242
- "date": "2026-09-15",
243
- "version": "0.0.57"
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
  }