@yeaft/webchat-agent 0.1.449 → 0.1.450
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/crew/routing.js +4 -0
- package/package.json +1 -1
package/crew/routing.js
CHANGED
|
@@ -39,6 +39,10 @@ function _appendTextToContent(content, text) {
|
|
|
39
39
|
export function parseRoutes(text) {
|
|
40
40
|
const routes = [];
|
|
41
41
|
|
|
42
|
+
// ─── Pre-pass: Strip fenced code blocks to avoid parsing quoted ROUTE examples ──
|
|
43
|
+
// Replaces ```...``` content with whitespace of same length to preserve positions
|
|
44
|
+
text = text.replace(/```[\s\S]*?```/g, m => ' '.repeat(m.length));
|
|
45
|
+
|
|
42
46
|
// ─── Phase 1: Standard ROUTE blocks (with END_ROUTE) ──────────
|
|
43
47
|
// ★ Tolerate both underscore and space variants: ---END_ROUTE--- or ---END ROUTE---
|
|
44
48
|
// ★ Use negative lookahead to not cross another ---ROUTE--- boundary
|