@invergent/agent-chat-react 2.4.7 → 2.4.8
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 +12 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6583,6 +6583,7 @@ function useSmoothStream(target, isStreaming) {
|
|
|
6583
6583
|
|
|
6584
6584
|
// src/lib/next-action.ts
|
|
6585
6585
|
var _NEXT_ACTION_RE = /<next_action([^>]*)>([\s\S]*?)<\/next_action>\s*/gi;
|
|
6586
|
+
var _PARTIAL_NEXT_ACTION_FOOTER_RE = /(?:^|\n)\s*<next_action\b[\s\S]*$/i;
|
|
6586
6587
|
var _ATTR_RE = /(\w+)="([^"]*)"/g;
|
|
6587
6588
|
var _VALID_COMPLEXITY = /* @__PURE__ */ new Set([
|
|
6588
6589
|
"low",
|
|
@@ -6608,6 +6609,11 @@ function _inferNarration(text) {
|
|
|
6608
6609
|
if (!firstSentence || firstSentence.length > 200) return null;
|
|
6609
6610
|
return firstSentence;
|
|
6610
6611
|
}
|
|
6612
|
+
function _stripPartialNextActionFooter(text) {
|
|
6613
|
+
const match = _PARTIAL_NEXT_ACTION_FOOTER_RE.exec(text);
|
|
6614
|
+
if (!match) return text;
|
|
6615
|
+
return text.slice(0, match.index).trimEnd();
|
|
6616
|
+
}
|
|
6611
6617
|
function stripAndParseNextAction(text) {
|
|
6612
6618
|
if (!text) {
|
|
6613
6619
|
return { cleaned: text ?? "", action: null, inferredNarration: null };
|
|
@@ -6615,10 +6621,11 @@ function stripAndParseNextAction(text) {
|
|
|
6615
6621
|
let last = null;
|
|
6616
6622
|
const matches = Array.from(text.matchAll(_NEXT_ACTION_RE));
|
|
6617
6623
|
if (matches.length === 0) {
|
|
6624
|
+
const cleaned2 = _stripPartialNextActionFooter(text);
|
|
6618
6625
|
return {
|
|
6619
|
-
cleaned:
|
|
6626
|
+
cleaned: cleaned2,
|
|
6620
6627
|
action: null,
|
|
6621
|
-
inferredNarration: _inferNarration(text)
|
|
6628
|
+
inferredNarration: cleaned2 === text ? _inferNarration(text) : null
|
|
6622
6629
|
};
|
|
6623
6630
|
}
|
|
6624
6631
|
for (const match of matches) {
|
|
@@ -6630,7 +6637,9 @@ function stripAndParseNextAction(text) {
|
|
|
6630
6637
|
const body = (match[2] ?? "").trim() || "done";
|
|
6631
6638
|
last = { complexity, summary, body };
|
|
6632
6639
|
}
|
|
6633
|
-
const cleaned =
|
|
6640
|
+
const cleaned = _stripPartialNextActionFooter(
|
|
6641
|
+
text.replace(_NEXT_ACTION_RE, "").trimEnd()
|
|
6642
|
+
);
|
|
6634
6643
|
return { cleaned, action: last, inferredNarration: null };
|
|
6635
6644
|
}
|
|
6636
6645
|
var Artifact = ({ className, ...props }) => /* @__PURE__ */ jsx(
|