@tanstack/ai 0.58.0 → 0.61.0
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/dist/esm/activities/chat/adapter.d.ts +9 -0
- package/dist/esm/activities/chat/adapter.js +1 -0
- package/dist/esm/activities/chat/adapter.js.map +1 -1
- package/dist/esm/activities/chat/agents/define-agent.d.ts +81 -0
- package/dist/esm/activities/chat/agents/define-agent.js +34 -0
- package/dist/esm/activities/chat/agents/define-agent.js.map +1 -0
- package/dist/esm/activities/chat/agents/route.d.ts +53 -0
- package/dist/esm/activities/chat/agents/route.js +59 -0
- package/dist/esm/activities/chat/agents/route.js.map +1 -0
- package/dist/esm/activities/chat/agents/spawn.d.ts +124 -0
- package/dist/esm/activities/chat/agents/spawn.js +490 -0
- package/dist/esm/activities/chat/agents/spawn.js.map +1 -0
- package/dist/esm/activities/chat/agents/turn.d.ts +36 -0
- package/dist/esm/activities/chat/agents/turn.js +78 -0
- package/dist/esm/activities/chat/agents/turn.js.map +1 -0
- package/dist/esm/activities/chat/index.d.ts +13 -3
- package/dist/esm/activities/chat/index.js +462 -26
- package/dist/esm/activities/chat/index.js.map +1 -1
- package/dist/esm/activities/chat/messages.d.ts +7 -1
- package/dist/esm/activities/chat/messages.js +99 -19
- package/dist/esm/activities/chat/messages.js.map +1 -1
- package/dist/esm/activities/chat/middleware/run-store.d.ts +43 -7
- package/dist/esm/activities/chat/middleware/run-store.js +8 -1
- package/dist/esm/activities/chat/middleware/run-store.js.map +1 -1
- package/dist/esm/activities/chat/middleware/types.d.ts +47 -1
- package/dist/esm/activities/chat/middleware/types.js.map +1 -1
- package/dist/esm/activities/chat/stream/message-updaters.js +9 -2
- package/dist/esm/activities/chat/stream/message-updaters.js.map +1 -1
- package/dist/esm/activities/chat/stream/processor.d.ts +46 -1
- package/dist/esm/activities/chat/stream/processor.js +294 -18
- package/dist/esm/activities/chat/stream/processor.js.map +1 -1
- package/dist/esm/activities/chat/tools/tool-calls.d.ts +17 -3
- package/dist/esm/activities/chat/tools/tool-calls.js +56 -5
- package/dist/esm/activities/chat/tools/tool-calls.js.map +1 -1
- package/dist/esm/activities/embed/adapter.d.ts +7 -0
- package/dist/esm/activities/embed/adapter.js +1 -0
- package/dist/esm/activities/embed/adapter.js.map +1 -1
- package/dist/esm/activities/embed/index.js +2 -0
- package/dist/esm/activities/embed/index.js.map +1 -1
- package/dist/esm/activities/files/adapter.d.ts +97 -0
- package/dist/esm/activities/files/adapter.js +45 -0
- package/dist/esm/activities/files/adapter.js.map +1 -0
- package/dist/esm/activities/files/index.d.ts +66 -0
- package/dist/esm/activities/files/index.js +78 -0
- package/dist/esm/activities/files/index.js.map +1 -0
- package/dist/esm/activities/generateAudio/index.js +1 -1
- package/dist/esm/activities/generateImage/adapter.d.ts +8 -0
- package/dist/esm/activities/generateImage/adapter.js +1 -0
- package/dist/esm/activities/generateImage/adapter.js.map +1 -1
- package/dist/esm/activities/generateImage/index.js +3 -1
- package/dist/esm/activities/generateImage/index.js.map +1 -1
- package/dist/esm/activities/generateLiveVideo/index.js +1 -1
- package/dist/esm/activities/generateSpeech/index.js +1 -1
- package/dist/esm/activities/generateTranscription/index.js +1 -1
- package/dist/esm/activities/generateVideo/adapter.d.ts +8 -0
- package/dist/esm/activities/generateVideo/adapter.js +1 -0
- package/dist/esm/activities/generateVideo/adapter.js.map +1 -1
- package/dist/esm/activities/generateVideo/index.js +3 -0
- package/dist/esm/activities/generateVideo/index.js.map +1 -1
- package/dist/esm/activities/generateVoice/index.js +1 -1
- package/dist/esm/activities/generateWorld/adapter.d.ts +4 -2
- package/dist/esm/activities/generateWorld/adapter.js.map +1 -1
- package/dist/esm/activities/generateWorld/index.d.ts +4 -3
- package/dist/esm/activities/generateWorld/index.js +6 -5
- package/dist/esm/activities/generateWorld/index.js.map +1 -1
- package/dist/esm/activities/index.d.ts +9 -3
- package/dist/esm/activities/index.js +17 -13
- package/dist/esm/activities/summarize/chat-stream-summarize.d.ts +2 -0
- package/dist/esm/activities/summarize/chat-stream-summarize.js +8 -8
- package/dist/esm/activities/summarize/chat-stream-summarize.js.map +1 -1
- package/dist/esm/activities/summarize/index.js +1 -1
- package/dist/esm/client.d.ts +7 -36
- package/dist/esm/client.js +5 -37
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/index.d.ts +8 -2
- package/dist/esm/index.js +9 -4
- package/dist/esm/middlewares/content-guard.js.map +1 -1
- package/dist/esm/types.d.ts +179 -98
- package/dist/esm/utilities/adapter-yield-chunk.d.ts +5 -1
- package/dist/esm/utilities/ag-ui-usage.d.ts +9 -9
- package/dist/esm/utilities/ag-ui-usage.js +66 -3
- package/dist/esm/utilities/ag-ui-usage.js.map +1 -1
- package/dist/esm/utilities/ag-ui-wire.js +90 -13
- package/dist/esm/utilities/ag-ui-wire.js.map +1 -1
- package/dist/esm/utilities/content-source.d.ts +60 -0
- package/dist/esm/utilities/content-source.js +85 -0
- package/dist/esm/utilities/content-source.js.map +1 -0
- package/dist/esm/utilities/normalize-stream-chunk.js +7 -2
- package/dist/esm/utilities/normalize-stream-chunk.js.map +1 -1
- package/dist/esm/utilities/provider-executed.d.ts +7 -0
- package/dist/esm/utilities/provider-executed.js +10 -1
- package/dist/esm/utilities/provider-executed.js.map +1 -1
- package/dist/esm/utilities/spec-event-keys.js +13 -8
- package/dist/esm/utilities/spec-event-keys.js.map +1 -1
- package/dist/esm/utilities/subagent-wire.d.ts +36 -0
- package/dist/esm/utilities/subagent-wire.js +131 -0
- package/dist/esm/utilities/subagent-wire.js.map +1 -0
- package/dist/esm/utilities/tool-result.d.ts +12 -2
- package/dist/esm/utilities/tool-result.js +23 -3
- package/dist/esm/utilities/tool-result.js.map +1 -1
- package/package.json +3 -3
- package/skills/ai-core/adapter-configuration/SKILL.md +62 -0
- package/skills/ai-core/adapter-configuration/references/grok-adapter.md +1 -1
- package/skills/ai-core/chat-experience/SKILL.md +14 -0
- package/skills/ai-core/media-generation/SKILL.md +10 -2
- package/skills/ai-core/middleware/SKILL.md +7 -4
- package/src/activities/chat/adapter.ts +10 -0
- package/src/activities/chat/agents/define-agent.ts +121 -0
- package/src/activities/chat/agents/route.ts +115 -0
- package/src/activities/chat/agents/spawn.ts +806 -0
- package/src/activities/chat/agents/turn.ts +151 -0
- package/src/activities/chat/index.ts +734 -30
- package/src/activities/chat/messages.ts +137 -16
- package/src/activities/chat/middleware/run-store.ts +56 -7
- package/src/activities/chat/middleware/types.ts +47 -0
- package/src/activities/chat/stream/message-updaters.ts +24 -2
- package/src/activities/chat/stream/processor.ts +452 -30
- package/src/activities/chat/tools/tool-calls.ts +83 -11
- package/src/activities/embed/adapter.ts +7 -0
- package/src/activities/embed/index.ts +5 -0
- package/src/activities/files/adapter.ts +120 -0
- package/src/activities/files/index.ts +113 -0
- package/src/activities/generateImage/adapter.ts +8 -0
- package/src/activities/generateImage/index.ts +4 -0
- package/src/activities/generateVideo/adapter.ts +8 -0
- package/src/activities/generateVideo/index.ts +7 -0
- package/src/activities/generateWorld/adapter.ts +4 -2
- package/src/activities/generateWorld/index.ts +7 -6
- package/src/activities/index.ts +40 -1
- package/src/activities/summarize/chat-stream-summarize.ts +22 -12
- package/src/client.ts +29 -35
- package/src/index.ts +39 -0
- package/src/middlewares/content-guard.ts +7 -5
- package/src/types.ts +226 -103
- package/src/utilities/adapter-yield-chunk.ts +10 -2
- package/src/utilities/ag-ui-usage.test.ts +38 -0
- package/src/utilities/ag-ui-usage.ts +98 -11
- package/src/utilities/ag-ui-wire.ts +134 -16
- package/src/utilities/content-source.ts +138 -0
- package/src/utilities/normalize-stream-chunk.ts +10 -2
- package/src/utilities/provider-executed.ts +13 -0
- package/src/utilities/spec-event-keys.ts +34 -7
- package/src/utilities/subagent-wire.ts +184 -0
- package/src/utilities/tool-result.ts +38 -2
package/src/activities/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ import type { AnyRerankAdapter } from './rerank/adapter'
|
|
|
27
27
|
import type { AnyEvaluateAdapter } from './evaluate/adapter'
|
|
28
28
|
import type { AnyWorldAdapter } from './generateWorld/adapter'
|
|
29
29
|
import type { AnyLiveVideoAdapter } from './generateLiveVideo/adapter'
|
|
30
|
+
import type { AnyFilesAdapter } from './files/adapter'
|
|
30
31
|
|
|
31
32
|
// ===========================
|
|
32
33
|
// Chat Activity
|
|
@@ -39,6 +40,21 @@ export {
|
|
|
39
40
|
type TextActivityResult,
|
|
40
41
|
} from './chat/index'
|
|
41
42
|
|
|
43
|
+
export {
|
|
44
|
+
defineAgent,
|
|
45
|
+
type DefinedAgent,
|
|
46
|
+
type SubagentChoiceOptions,
|
|
47
|
+
type SubagentRunContext,
|
|
48
|
+
} from './chat/agents/define-agent'
|
|
49
|
+
export { subagentRoute, type SubagentRouteOptions } from './chat/agents/route'
|
|
50
|
+
export type {
|
|
51
|
+
SubagentOrder,
|
|
52
|
+
SubagentRouterPick,
|
|
53
|
+
SubagentRouterPlan,
|
|
54
|
+
SubagentStep,
|
|
55
|
+
SubagentStepsPlan,
|
|
56
|
+
} from './chat/agents/spawn'
|
|
57
|
+
|
|
42
58
|
export {
|
|
43
59
|
BaseTextAdapter,
|
|
44
60
|
type AnyTextAdapter,
|
|
@@ -315,11 +331,32 @@ export {
|
|
|
315
331
|
type AnyLiveVideoAdapter,
|
|
316
332
|
} from './generateLiveVideo/adapter'
|
|
317
333
|
|
|
334
|
+
// ===========================
|
|
335
|
+
// Files Activity
|
|
336
|
+
// ===========================
|
|
337
|
+
|
|
338
|
+
export {
|
|
339
|
+
kind as filesKind,
|
|
340
|
+
uploadFile,
|
|
341
|
+
getFile,
|
|
342
|
+
deleteFile,
|
|
343
|
+
fileSourceFromHandle,
|
|
344
|
+
} from './files/index'
|
|
345
|
+
|
|
346
|
+
export {
|
|
347
|
+
BaseFilesAdapter,
|
|
348
|
+
normalizeFileUploadInput,
|
|
349
|
+
type FilesAdapter,
|
|
350
|
+
type AnyFilesAdapter,
|
|
351
|
+
type FileHandle,
|
|
352
|
+
type FileUploadInput,
|
|
353
|
+
} from './files/adapter'
|
|
354
|
+
|
|
318
355
|
// ===========================
|
|
319
356
|
// Adapter Union Types
|
|
320
357
|
// ===========================
|
|
321
358
|
|
|
322
|
-
/** Union of all adapter types
|
|
359
|
+
/** Union of all adapter types across every activity kind */
|
|
323
360
|
export type AIAdapter =
|
|
324
361
|
| AnyTextAdapter
|
|
325
362
|
| AnySummarizeAdapter
|
|
@@ -334,6 +371,7 @@ export type AIAdapter =
|
|
|
334
371
|
| AnyEvaluateAdapter
|
|
335
372
|
| AnyWorldAdapter
|
|
336
373
|
| AnyLiveVideoAdapter
|
|
374
|
+
| AnyFilesAdapter
|
|
337
375
|
|
|
338
376
|
/** Union type of all adapter kinds */
|
|
339
377
|
export type AdapterKind =
|
|
@@ -350,3 +388,4 @@ export type AdapterKind =
|
|
|
350
388
|
| 'evaluate'
|
|
351
389
|
| 'world'
|
|
352
390
|
| 'liveVideo'
|
|
391
|
+
| 'files'
|
|
@@ -65,6 +65,8 @@ function throwRunError(
|
|
|
65
65
|
* `SummarizationOptions<TProviderOptions>` on the wrapper itself.
|
|
66
66
|
*/
|
|
67
67
|
export interface ChatStreamCapable {
|
|
68
|
+
/** Native token-limit option for adapters whose provider name is user-defined. */
|
|
69
|
+
readonly maxTokensKey?: string
|
|
68
70
|
chatStream: (options: TextOptions<any>) => AsyncIterable<AdapterYieldChunk>
|
|
69
71
|
}
|
|
70
72
|
|
|
@@ -151,8 +153,8 @@ function applyDefaultTemperature(
|
|
|
151
153
|
|
|
152
154
|
/**
|
|
153
155
|
* Resolve `maxLength` to the provider-native max-output-tokens key for the
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
+
* wrapped text adapter's explicit key, falling back to this wrapper's `name`,
|
|
157
|
+
* and merge it into a working copy of the caller's
|
|
156
158
|
* `modelOptions`. The caller always wins: if they already set any recognised
|
|
157
159
|
* token-limit key (flat or, for Ollama, nested `options.num_predict`), the
|
|
158
160
|
* default is left untouched. Unknown/unrecognised adapter names fall back to
|
|
@@ -172,10 +174,11 @@ function applyMaxLength(
|
|
|
172
174
|
adapterName: string,
|
|
173
175
|
maxLength: number,
|
|
174
176
|
modelOptions: Record<string, unknown>,
|
|
177
|
+
maxTokensKey?: string,
|
|
175
178
|
): Record<string, unknown> {
|
|
176
179
|
const merged: Record<string, unknown> = { ...modelOptions }
|
|
177
180
|
|
|
178
|
-
if (adapterName === 'ollama') {
|
|
181
|
+
if (adapterName === 'ollama' && maxTokensKey === undefined) {
|
|
179
182
|
// Honor a caller-set limit in either shape: a recognised flat key (e.g.
|
|
180
183
|
// left over from a migration) or the nested `options.num_predict`.
|
|
181
184
|
const callerSetFlatLimit = KNOWN_MAX_TOKENS_KEYS.some(
|
|
@@ -195,12 +198,12 @@ function applyMaxLength(
|
|
|
195
198
|
return merged
|
|
196
199
|
}
|
|
197
200
|
|
|
198
|
-
const key = MAX_TOKENS_KEY_BY_ADAPTER[adapterName]
|
|
201
|
+
const key = maxTokensKey ?? MAX_TOKENS_KEY_BY_ADAPTER[adapterName]
|
|
199
202
|
if (key === undefined) return merged
|
|
200
203
|
|
|
201
|
-
const callerSetLimit =
|
|
202
|
-
|
|
203
|
-
|
|
204
|
+
const callerSetLimit =
|
|
205
|
+
typeof merged[key] === 'number' ||
|
|
206
|
+
KNOWN_MAX_TOKENS_KEYS.some((k) => typeof merged[k] === 'number')
|
|
204
207
|
if (callerSetLimit) return merged
|
|
205
208
|
|
|
206
209
|
merged[key] = maxLength
|
|
@@ -372,17 +375,24 @@ export class ChatStreamSummarizeAdapter<
|
|
|
372
375
|
working = applyDefaultTemperature(this.name, 0.3, working)
|
|
373
376
|
// `maxLength` must reach the wire under the provider-native token key (it
|
|
374
377
|
// differs per provider, and no adapter reads a generic `maxTokens`).
|
|
375
|
-
//
|
|
376
|
-
//
|
|
377
|
-
// token limit.
|
|
378
|
+
// Prefer the wrapped adapter's explicit key, then this wrapper's name,
|
|
379
|
+
// never overriding a caller-supplied token limit.
|
|
378
380
|
if (options.maxLength !== undefined) {
|
|
379
|
-
if (
|
|
381
|
+
if (
|
|
382
|
+
this.textAdapter.maxTokensKey === undefined &&
|
|
383
|
+
!isKnownMaxTokensAdapter(this.name)
|
|
384
|
+
) {
|
|
380
385
|
options.logger.warn(
|
|
381
386
|
`summarize: maxLength=${options.maxLength} could not be mapped to a provider token key for adapter name "${this.name}" — it was dropped from modelOptions (the prompt still asks the model to stay under it). Construct ChatStreamSummarizeAdapter with a recognised provider name to forward the cap.`,
|
|
382
387
|
{ provider: this.name },
|
|
383
388
|
)
|
|
384
389
|
}
|
|
385
|
-
working = applyMaxLength(
|
|
390
|
+
working = applyMaxLength(
|
|
391
|
+
this.name,
|
|
392
|
+
options.maxLength,
|
|
393
|
+
working,
|
|
394
|
+
this.textAdapter.maxTokensKey,
|
|
395
|
+
)
|
|
386
396
|
}
|
|
387
397
|
const modelOptions = working as TProviderOptions
|
|
388
398
|
|
package/src/client.ts
CHANGED
|
@@ -224,41 +224,25 @@ export async function generationParamsFromRequest<TKind extends GenerationKind>(
|
|
|
224
224
|
return generationParamsFromBody(kind, body)
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
export
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
ACTIVITY_DELTA = 'ACTIVITY_DELTA',
|
|
247
|
-
RAW = 'RAW',
|
|
248
|
-
CUSTOM = 'CUSTOM',
|
|
249
|
-
RUN_STARTED = 'RUN_STARTED',
|
|
250
|
-
RUN_FINISHED = 'RUN_FINISHED',
|
|
251
|
-
RUN_ERROR = 'RUN_ERROR',
|
|
252
|
-
STEP_STARTED = 'STEP_STARTED',
|
|
253
|
-
STEP_FINISHED = 'STEP_FINISHED',
|
|
254
|
-
REASONING_START = 'REASONING_START',
|
|
255
|
-
REASONING_MESSAGE_START = 'REASONING_MESSAGE_START',
|
|
256
|
-
REASONING_MESSAGE_CONTENT = 'REASONING_MESSAGE_CONTENT',
|
|
257
|
-
REASONING_MESSAGE_END = 'REASONING_MESSAGE_END',
|
|
258
|
-
REASONING_MESSAGE_CHUNK = 'REASONING_MESSAGE_CHUNK',
|
|
259
|
-
REASONING_END = 'REASONING_END',
|
|
260
|
-
REASONING_ENCRYPTED_VALUE = 'REASONING_ENCRYPTED_VALUE',
|
|
261
|
-
}
|
|
227
|
+
export { EventType } from '@ag-ui/core'
|
|
228
|
+
|
|
229
|
+
export {
|
|
230
|
+
defineAgent,
|
|
231
|
+
type DefinedAgent,
|
|
232
|
+
type SubagentChoiceOptions,
|
|
233
|
+
type SubagentRunContext,
|
|
234
|
+
} from './activities/chat/agents/define-agent'
|
|
235
|
+
export {
|
|
236
|
+
subagentRoute,
|
|
237
|
+
type SubagentRouteOptions,
|
|
238
|
+
} from './activities/chat/agents/route'
|
|
239
|
+
export type {
|
|
240
|
+
SubagentOrder,
|
|
241
|
+
SubagentRouterPick,
|
|
242
|
+
SubagentRouterPlan,
|
|
243
|
+
SubagentStep,
|
|
244
|
+
SubagentStepsPlan,
|
|
245
|
+
} from './activities/chat/agents/spawn'
|
|
262
246
|
|
|
263
247
|
export {
|
|
264
248
|
toolDefinition,
|
|
@@ -345,10 +329,20 @@ export type { AdapterYieldChunk } from './utilities/adapter-yield-chunk'
|
|
|
345
329
|
export { getChunkRunId, getChunkThreadId } from './utilities/chunk-ids'
|
|
346
330
|
export type { WireMessage } from './utilities/ag-ui-wire'
|
|
347
331
|
|
|
332
|
+
// A browser client that received an uploaded handle from its server can build
|
|
333
|
+
// the `{ type: 'file' }` content source itself — `fileSourceFromHandle` is a
|
|
334
|
+
// pure object builder, so exporting it here keeps the documented client flow
|
|
335
|
+
// from pulling in the server entry.
|
|
336
|
+
export { fileSourceFromHandle } from './activities/files/index'
|
|
337
|
+
export type { FileHandle } from './activities/files/adapter'
|
|
338
|
+
|
|
348
339
|
export type {
|
|
349
340
|
AudioPart,
|
|
350
341
|
ContentPart,
|
|
351
342
|
ContentPartDataSource,
|
|
343
|
+
ContentPartFileSource,
|
|
344
|
+
SubagentHandleData,
|
|
345
|
+
SubagentStatus,
|
|
352
346
|
ContentPartSource,
|
|
353
347
|
ContentPartUrlSource,
|
|
354
348
|
CustomEvent,
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,10 @@ export {
|
|
|
18
18
|
embed,
|
|
19
19
|
generateWorld,
|
|
20
20
|
generateLiveVideo,
|
|
21
|
+
uploadFile,
|
|
22
|
+
getFile,
|
|
23
|
+
deleteFile,
|
|
24
|
+
fileSourceFromHandle,
|
|
21
25
|
} from './activities/index'
|
|
22
26
|
|
|
23
27
|
// Create options functions - for pre-defining typed configurations
|
|
@@ -70,6 +74,10 @@ export type {
|
|
|
70
74
|
WorldAdapter,
|
|
71
75
|
AnyLiveVideoAdapter,
|
|
72
76
|
LiveVideoAdapter,
|
|
77
|
+
FilesAdapter,
|
|
78
|
+
AnyFilesAdapter,
|
|
79
|
+
FileHandle,
|
|
80
|
+
FileUploadInput,
|
|
73
81
|
} from './activities/index'
|
|
74
82
|
|
|
75
83
|
// Rerank adapter base + types
|
|
@@ -78,6 +86,24 @@ export { BaseRerankAdapter } from './activities/rerank/adapter'
|
|
|
78
86
|
// Evaluate adapter base + types
|
|
79
87
|
export { BaseEvaluateAdapter } from './activities/evaluate/adapter'
|
|
80
88
|
|
|
89
|
+
export {
|
|
90
|
+
defineAgent,
|
|
91
|
+
type DefinedAgent,
|
|
92
|
+
type SubagentChoiceOptions,
|
|
93
|
+
type SubagentRunContext,
|
|
94
|
+
} from './activities/chat/agents/define-agent'
|
|
95
|
+
export {
|
|
96
|
+
subagentRoute,
|
|
97
|
+
type SubagentRouteOptions,
|
|
98
|
+
} from './activities/chat/agents/route'
|
|
99
|
+
export type {
|
|
100
|
+
SubagentOrder,
|
|
101
|
+
SubagentRouterPick,
|
|
102
|
+
SubagentRouterPlan,
|
|
103
|
+
SubagentStep,
|
|
104
|
+
SubagentStepsPlan,
|
|
105
|
+
} from './activities/chat/agents/spawn'
|
|
106
|
+
|
|
81
107
|
// Tool definition
|
|
82
108
|
export {
|
|
83
109
|
toolDefinition,
|
|
@@ -494,6 +520,11 @@ export { generationParamsFromBody, generationParamsFromRequest } from './client'
|
|
|
494
520
|
|
|
495
521
|
// AG-UI wire serialization (used internally by @tanstack/ai-client)
|
|
496
522
|
export { uiMessagesToWire } from './utilities/ag-ui-wire'
|
|
523
|
+
export type { SubagentWireInfo } from './utilities/subagent-wire'
|
|
524
|
+
export {
|
|
525
|
+
subagentHostMessageId,
|
|
526
|
+
wireSubagentInfo,
|
|
527
|
+
} from './utilities/subagent-wire'
|
|
497
528
|
export { mergeMetadata, withTanstackMetadata } from './utilities/merge-metadata'
|
|
498
529
|
export { fromSpecTokenUsage, toSpecTokenUsage } from './utilities/ag-ui-usage'
|
|
499
530
|
export type { SpecTokenUsage } from './utilities/ag-ui-usage'
|
|
@@ -506,6 +537,14 @@ export {
|
|
|
506
537
|
isContentPartArray,
|
|
507
538
|
normalizeToolResult,
|
|
508
539
|
} from './utilities/tool-result'
|
|
540
|
+
export {
|
|
541
|
+
assertMessagesFileSourceSupport,
|
|
542
|
+
assertPromptFileSourceSupport,
|
|
543
|
+
fileReferenceFor,
|
|
544
|
+
isFileSource,
|
|
545
|
+
unsupportedFileSourceError,
|
|
546
|
+
type FileSourceCapable,
|
|
547
|
+
} from './utilities/content-source'
|
|
509
548
|
|
|
510
549
|
export {
|
|
511
550
|
getProviderExecutedMetadata,
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
ChatMiddlewareContext,
|
|
4
4
|
} from '../activities/chat/middleware/types'
|
|
5
5
|
import type { StreamChunk } from '../types'
|
|
6
|
+
import type { AdapterYieldChunk } from '../utilities/adapter-yield-chunk'
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* A content guard rule — either a regex pattern with replacement, or a transform function.
|
|
@@ -142,11 +143,12 @@ function createDeltaStrategy(
|
|
|
142
143
|
|
|
143
144
|
if (blockOnMatch) return null // drop chunk
|
|
144
145
|
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
// Drop the adapter-era content field; the replacement event carries only
|
|
147
|
+
// the filtered delta.
|
|
148
|
+
const { content: _strippedContent, ...rest } = chunk as Extract<
|
|
149
|
+
AdapterYieldChunk,
|
|
150
|
+
{ type: 'TEXT_MESSAGE_CONTENT' }
|
|
151
|
+
>
|
|
150
152
|
void _strippedContent
|
|
151
153
|
return {
|
|
152
154
|
...rest,
|