@invergent/agent-chat-react 2.4.6 → 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.cjs
CHANGED
|
@@ -6867,6 +6867,7 @@ function useSmoothStream(target, isStreaming) {
|
|
|
6867
6867
|
|
|
6868
6868
|
// src/lib/next-action.ts
|
|
6869
6869
|
var _NEXT_ACTION_RE = /<next_action([^>]*)>([\s\S]*?)<\/next_action>\s*/gi;
|
|
6870
|
+
var _PARTIAL_NEXT_ACTION_FOOTER_RE = /(?:^|\n)\s*<next_action\b[\s\S]*$/i;
|
|
6870
6871
|
var _ATTR_RE = /(\w+)="([^"]*)"/g;
|
|
6871
6872
|
var _VALID_COMPLEXITY = /* @__PURE__ */ new Set([
|
|
6872
6873
|
"low",
|
|
@@ -6892,6 +6893,11 @@ function _inferNarration(text) {
|
|
|
6892
6893
|
if (!firstSentence || firstSentence.length > 200) return null;
|
|
6893
6894
|
return firstSentence;
|
|
6894
6895
|
}
|
|
6896
|
+
function _stripPartialNextActionFooter(text) {
|
|
6897
|
+
const match = _PARTIAL_NEXT_ACTION_FOOTER_RE.exec(text);
|
|
6898
|
+
if (!match) return text;
|
|
6899
|
+
return text.slice(0, match.index).trimEnd();
|
|
6900
|
+
}
|
|
6895
6901
|
function stripAndParseNextAction(text) {
|
|
6896
6902
|
if (!text) {
|
|
6897
6903
|
return { cleaned: text ?? "", action: null, inferredNarration: null };
|
|
@@ -6899,10 +6905,11 @@ function stripAndParseNextAction(text) {
|
|
|
6899
6905
|
let last = null;
|
|
6900
6906
|
const matches = Array.from(text.matchAll(_NEXT_ACTION_RE));
|
|
6901
6907
|
if (matches.length === 0) {
|
|
6908
|
+
const cleaned2 = _stripPartialNextActionFooter(text);
|
|
6902
6909
|
return {
|
|
6903
|
-
cleaned:
|
|
6910
|
+
cleaned: cleaned2,
|
|
6904
6911
|
action: null,
|
|
6905
|
-
inferredNarration: _inferNarration(text)
|
|
6912
|
+
inferredNarration: cleaned2 === text ? _inferNarration(text) : null
|
|
6906
6913
|
};
|
|
6907
6914
|
}
|
|
6908
6915
|
for (const match of matches) {
|
|
@@ -6914,7 +6921,9 @@ function stripAndParseNextAction(text) {
|
|
|
6914
6921
|
const body = (match[2] ?? "").trim() || "done";
|
|
6915
6922
|
last = { complexity, summary, body };
|
|
6916
6923
|
}
|
|
6917
|
-
const cleaned =
|
|
6924
|
+
const cleaned = _stripPartialNextActionFooter(
|
|
6925
|
+
text.replace(_NEXT_ACTION_RE, "").trimEnd()
|
|
6926
|
+
);
|
|
6918
6927
|
return { cleaned, action: last, inferredNarration: null };
|
|
6919
6928
|
}
|
|
6920
6929
|
|