@tomflow/chatloop-extension 0.3.36 → 0.3.37
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/extension/loop/core.js
CHANGED
|
@@ -8,14 +8,19 @@
|
|
|
8
8
|
const match = MARKER.exec(lines.at(-1)?.trim() || "");
|
|
9
9
|
if (!match) return "UNKNOWN";
|
|
10
10
|
const markers = text.match(ALL_MARKERS) || [];
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
11
|
+
// Status is a protocol line, not any occurrence of its token in prose.
|
|
12
|
+
// A reply may describe a previous Turn as, e.g., "it ended with
|
|
13
|
+
// [CHAT_LOOP_STATUS:CONTINUE]" and still legitimately finish with DONE.
|
|
14
|
+
// Require exactly one standalone status line, at the end. Never accept
|
|
15
|
+
// two standalone statuses (even if they have the same value).
|
|
16
|
+
const standalone = lines.filter(line => MARKER.test(line.trim()));
|
|
17
|
+
// Historical HANDOFF packets may embed prior standalone statuses. Keep
|
|
18
|
+
// its compatibility rule while requiring only one HANDOFF token total.
|
|
14
19
|
if (match[1] === "HANDOFF") {
|
|
15
20
|
return markers.filter(v => v === "[CHAT_LOOP_STATUS:HANDOFF]").length === 1
|
|
16
21
|
? "HANDOFF" : "UNKNOWN";
|
|
17
22
|
}
|
|
18
|
-
if (
|
|
23
|
+
if (standalone.length !== 1) return "UNKNOWN";
|
|
19
24
|
return match[1];
|
|
20
25
|
}
|
|
21
26
|
function fingerprint(text) {
|
package/extension/manifest.json
CHANGED