@lota-sdk/shared 0.4.6 → 0.4.7
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/package.json +1 -1
- package/src/utils/assistant-text.ts +10 -0
package/package.json
CHANGED
|
@@ -103,10 +103,20 @@ function stripRawToolPayloadObjects(value: string): string {
|
|
|
103
103
|
return result
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/** Strip bracketed plan/node status labels the LLM sometimes appends to titles (e.g. "Plan Title [blocked]") */
|
|
107
|
+
const BRACKETED_STATUS_PATTERN = /\s*\[(blocked|failed|running|stalled|inactive|paused|cancelled|errored)\]/gi
|
|
108
|
+
|
|
109
|
+
/** Strip raw execution plan run/node IDs the LLM sometimes echoes (e.g. "Run: 019d6382-...") */
|
|
110
|
+
const RAW_RUN_ID_PATTERN = /\bRun:\s*[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}\b/gi
|
|
111
|
+
const RAW_PLAN_RUN_ID_PATTERN = /\bplanRun:[\w⟨⟩-]+/g
|
|
112
|
+
|
|
106
113
|
export function sanitizeAssistantVisibleText(value: string): string {
|
|
107
114
|
let next = value
|
|
108
115
|
|
|
109
116
|
next = next.replace(/\[REDACTED\]/gi, '')
|
|
117
|
+
next = next.replace(BRACKETED_STATUS_PATTERN, '')
|
|
118
|
+
next = next.replace(RAW_RUN_ID_PATTERN, '')
|
|
119
|
+
next = next.replace(RAW_PLAN_RUN_ID_PATTERN, '')
|
|
110
120
|
|
|
111
121
|
for (const pattern of INTERNAL_BLOCK_PATTERNS) {
|
|
112
122
|
next = next.replace(pattern, '')
|