@tanstack/ai 0.54.0 → 0.55.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/index.js +17 -1
- package/dist/esm/activities/chat/index.js.map +1 -1
- package/dist/esm/activities/chat/messages.d.ts +21 -1
- package/dist/esm/activities/chat/messages.js +50 -1
- package/dist/esm/activities/chat/messages.js.map +1 -1
- package/dist/esm/activities/chat/stream/processor.d.ts +17 -0
- package/dist/esm/activities/chat/stream/processor.js +27 -0
- package/dist/esm/activities/chat/stream/processor.js.map +1 -1
- package/package.json +3 -3
- package/skills/ai-core/adapter-configuration/SKILL.md +1 -1
- package/skills/ai-core/media-generation/SKILL.md +22 -12
- package/src/activities/chat/index.ts +23 -0
- package/src/activities/chat/messages.ts +60 -0
- package/src/activities/chat/stream/processor.ts +31 -0
|
@@ -18,7 +18,7 @@ import { INTERRUPT_PAYLOAD_METADATA_KEY, createInterruptBinding, rehydrateInterr
|
|
|
18
18
|
import { readGenericInterruptContinuation } from "../../generic-interrupt-continuation.js";
|
|
19
19
|
import { normalizeToolResult } from "../../utilities/tool-result.js";
|
|
20
20
|
import { isProviderExecutedToolCall } from "../../utilities/provider-executed.js";
|
|
21
|
-
import { convertMessagesToModelMessages, generateMessageId, modelMessagesToUIMessages, safeJsonStringify } from "./messages.js";
|
|
21
|
+
import { appendUiResourceToModelMessages, convertMessagesToModelMessages, generateMessageId, modelMessagesToUIMessages, safeJsonStringify, uiResourcePartFromCustomValue } from "./messages.js";
|
|
22
22
|
import { uiMessagesToWire } from "../../utilities/ag-ui-wire.js";
|
|
23
23
|
import { restorePublicUsage } from "../../utilities/restore-inbound-chunk.js";
|
|
24
24
|
import { LazyToolManager } from "./tools/lazy-tool-manager.js";
|
|
@@ -1207,6 +1207,21 @@ var TextEngine = class {
|
|
|
1207
1207
|
}
|
|
1208
1208
|
};
|
|
1209
1209
|
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Record a `ui-resource` CUSTOM chunk on the assistant ModelMessage owning
|
|
1212
|
+
* its `toolCallId` so the resource survives later MESSAGES_SNAPSHOT chunks
|
|
1213
|
+
* (e.g. the interrupt snapshot emitted when the run pauses on a client
|
|
1214
|
+
* tool). Mirrors the anchor-preserving approach used for
|
|
1215
|
+
* `toolCallMetadata` (#867). See #1397.
|
|
1216
|
+
*/
|
|
1217
|
+
recordEmittedUiResource(value) {
|
|
1218
|
+
const part = uiResourcePartFromCustomValue(value);
|
|
1219
|
+
if (!part) return;
|
|
1220
|
+
const next = appendUiResourceToModelMessages(this.messages, part);
|
|
1221
|
+
if (next === this.messages) return;
|
|
1222
|
+
this.messages = next;
|
|
1223
|
+
this.middlewareCtx.messages = this.messages;
|
|
1224
|
+
}
|
|
1210
1225
|
buildMessagesSnapshotChunk() {
|
|
1211
1226
|
const withIds = this.messages.map((message, index) => ({
|
|
1212
1227
|
...message,
|
|
@@ -2120,6 +2135,7 @@ var TextEngine = class {
|
|
|
2120
2135
|
if (this.hasPublicRunStarted) continue;
|
|
2121
2136
|
this.hasPublicRunStarted = true;
|
|
2122
2137
|
}
|
|
2138
|
+
if (spec.type === EventType.CUSTOM && spec.name === "ui-resource") this.recordEmittedUiResource(spec.value);
|
|
2123
2139
|
yield spec;
|
|
2124
2140
|
this.middlewareCtx.chunkIndex++;
|
|
2125
2141
|
}
|