@dudousxd/nestjs-agent-react 0.29.1 → 0.29.2
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 +23 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -679,6 +679,7 @@ var AgentChatTransport = class {
|
|
|
679
679
|
return null;
|
|
680
680
|
}
|
|
681
681
|
this.captureHeaderMeta(response);
|
|
682
|
+
this.options.onResumeAttached?.(response.runId ?? runId);
|
|
682
683
|
return this.toChunkStream(response, {
|
|
683
684
|
runId,
|
|
684
685
|
...headers !== void 0 ? { headers } : {}
|
|
@@ -4803,6 +4804,14 @@ function storedMessageToUiMessage(message) {
|
|
|
4803
4804
|
approved: false,
|
|
4804
4805
|
...refusalReason(result) !== void 0 ? { reason: refusalReason(result) } : {}
|
|
4805
4806
|
}
|
|
4807
|
+
} : typeof result.error === "string" && result.error !== "" ? {
|
|
4808
|
+
// A call that FAILED — the tool threw, its input was refused, or its turn died
|
|
4809
|
+
// before it was settled — is not an available output either. The live stream says
|
|
4810
|
+
// so with `tool-output-error`; a reloaded thread has to say the same, or the card of
|
|
4811
|
+
// an action that never ran comes back reading as one that completed.
|
|
4812
|
+
state: "output-error",
|
|
4813
|
+
input: call.input,
|
|
4814
|
+
errorText: result.error
|
|
4806
4815
|
} : { state: "output-available", input: call.input, output: result.output } : { state: "input-available", input: call.input }
|
|
4807
4816
|
});
|
|
4808
4817
|
parts.push(...pushedByCall.get(call.id) ?? []);
|
|
@@ -5040,6 +5049,12 @@ function useAgentChat(options = {}) {
|
|
|
5040
5049
|
return { ...turnBody(), ...regenerate2 ? { regenerate: true } : {} };
|
|
5041
5050
|
},
|
|
5042
5051
|
getResumeRunId: () => latest.current.resumeRunId ?? autoResumeRunIdRef.current,
|
|
5052
|
+
// A stream attached to after a reload carries no `meta` frame: without this the chat would
|
|
5053
|
+
// be reading a run it cannot name, and `cancel()` would stop nothing.
|
|
5054
|
+
onResumeAttached: (resumedRunId) => {
|
|
5055
|
+
settlingRunIdRef.current = resumedRunId;
|
|
5056
|
+
setRunId(resumedRunId);
|
|
5057
|
+
},
|
|
5043
5058
|
onMeta,
|
|
5044
5059
|
onAttemptStart: () => {
|
|
5045
5060
|
settlingRunIdRef.current = void 0;
|
|
@@ -5509,7 +5524,14 @@ function useAgentChat(options = {}) {
|
|
|
5509
5524
|
} catch {
|
|
5510
5525
|
}
|
|
5511
5526
|
}
|
|
5512
|
-
|
|
5527
|
+
const threadId = currentThreadId();
|
|
5528
|
+
if (threadId !== void 0 && queueStateRef.current.items.length > 0 && typeof client.getQueue === "function") {
|
|
5529
|
+
try {
|
|
5530
|
+
applyQueue(await client.getQueue(threadId));
|
|
5531
|
+
} catch {
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
5534
|
+
}, [client, currentThreadId, applyQueue]);
|
|
5513
5535
|
const approve = (0, import_react23.useCallback)(
|
|
5514
5536
|
async ({ toolCallId, remember, via }) => {
|
|
5515
5537
|
await requireBackendMethod(
|