@dudousxd/nestjs-agent-react 0.12.0 → 0.13.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/index.cjs +20 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -673,6 +673,8 @@ interface TranscriptUiBlock {
|
|
|
673
673
|
props: Record<string, unknown>;
|
|
674
674
|
/** Schema version of `props`; `null` when the server did not stamp one. */
|
|
675
675
|
version: number | null;
|
|
676
|
+
/** The tool call that pushed it (`ctx.emitUi`); `null` for a component pushed outside a tool. */
|
|
677
|
+
toolCallId: string | null;
|
|
676
678
|
}
|
|
677
679
|
/** One choice a question offers, with its live selection state. */
|
|
678
680
|
interface TranscriptQuestionOption {
|
package/dist/index.d.ts
CHANGED
|
@@ -673,6 +673,8 @@ interface TranscriptUiBlock {
|
|
|
673
673
|
props: Record<string, unknown>;
|
|
674
674
|
/** Schema version of `props`; `null` when the server did not stamp one. */
|
|
675
675
|
version: number | null;
|
|
676
|
+
/** The tool call that pushed it (`ctx.emitUi`); `null` for a component pushed outside a tool. */
|
|
677
|
+
toolCallId: string | null;
|
|
676
678
|
}
|
|
677
679
|
/** One choice a question offers, with its live selection state. */
|
|
678
680
|
interface TranscriptQuestionOption {
|
package/dist/index.js
CHANGED
|
@@ -460,6 +460,9 @@ var AgentChatTransport = class {
|
|
|
460
460
|
props: event.props,
|
|
461
461
|
...event.version !== void 0 ? {
|
|
462
462
|
version: event.version
|
|
463
|
+
} : {},
|
|
464
|
+
...event.toolCallId !== void 0 ? {
|
|
465
|
+
toolCallId: event.toolCallId
|
|
463
466
|
} : {}
|
|
464
467
|
}
|
|
465
468
|
});
|
|
@@ -1816,7 +1819,8 @@ function readUiComponent(part) {
|
|
|
1816
1819
|
id,
|
|
1817
1820
|
component: data.component,
|
|
1818
1821
|
props: isRecord2(data.props) ? data.props : {},
|
|
1819
|
-
version: typeof data.version === "number" ? data.version : null
|
|
1822
|
+
version: typeof data.version === "number" ? data.version : null,
|
|
1823
|
+
toolCallId: typeof data.toolCallId === "string" ? data.toolCallId : null
|
|
1820
1824
|
};
|
|
1821
1825
|
}
|
|
1822
1826
|
__name(readUiComponent, "readUiComponent");
|
|
@@ -3254,8 +3258,10 @@ function storedMessageToUiMessage(message) {
|
|
|
3254
3258
|
url: attachment.url
|
|
3255
3259
|
});
|
|
3256
3260
|
}
|
|
3261
|
+
const toolCallIds = new Set((message.toolCalls ?? []).map((call) => call.id));
|
|
3262
|
+
const pushedByCall = /* @__PURE__ */ new Map();
|
|
3257
3263
|
for (const component of message.ui ?? []) {
|
|
3258
|
-
|
|
3264
|
+
const part = {
|
|
3259
3265
|
type: "data-ui",
|
|
3260
3266
|
id: component.id,
|
|
3261
3267
|
data: {
|
|
@@ -3264,9 +3270,19 @@ function storedMessageToUiMessage(message) {
|
|
|
3264
3270
|
props: component.props,
|
|
3265
3271
|
...component.version !== void 0 ? {
|
|
3266
3272
|
version: component.version
|
|
3273
|
+
} : {},
|
|
3274
|
+
...component.toolCallId !== void 0 ? {
|
|
3275
|
+
toolCallId: component.toolCallId
|
|
3267
3276
|
} : {}
|
|
3268
3277
|
}
|
|
3269
|
-
}
|
|
3278
|
+
};
|
|
3279
|
+
if (component.toolCallId !== void 0 && toolCallIds.has(component.toolCallId)) {
|
|
3280
|
+
const list = pushedByCall.get(component.toolCallId) ?? [];
|
|
3281
|
+
list.push(part);
|
|
3282
|
+
pushedByCall.set(component.toolCallId, list);
|
|
3283
|
+
} else {
|
|
3284
|
+
parts.push(part);
|
|
3285
|
+
}
|
|
3270
3286
|
}
|
|
3271
3287
|
for (const approval of message.approvals ?? []) {
|
|
3272
3288
|
parts.push({
|
|
@@ -3337,6 +3353,7 @@ function storedMessageToUiMessage(message) {
|
|
|
3337
3353
|
input: call.input
|
|
3338
3354
|
}
|
|
3339
3355
|
});
|
|
3356
|
+
parts.push(...pushedByCall.get(call.id) ?? []);
|
|
3340
3357
|
}
|
|
3341
3358
|
return {
|
|
3342
3359
|
id: message.id,
|