pi-cc-extensions 0.7.10 → 0.8.0
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/README.md +36 -9
- package/extensions/claude-code-style.ts +298 -135
- package/extensions/compact-style.ts +1136 -0
- package/extensions/tool-result-sanitize.ts +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const UNSAFE_TERMINAL_ESCAPE = new RegExp(
|
|
2
|
+
"\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\x5C)"
|
|
3
|
+
+ "|\\u001B[PX^_][\\s\\S]*?\\u001B\\x5C"
|
|
4
|
+
+ "|(?:\\u001B\\[|\\u009B)[0-?]*[ -/]*[@-~]"
|
|
5
|
+
+ "|\\u001B[@-_]",
|
|
6
|
+
"g",
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
/** Prevent captured terminal control responses from being replayed by tool renderers. */
|
|
10
|
+
export function sanitizeToolResultText(value: string): string {
|
|
11
|
+
return value
|
|
12
|
+
.replace(UNSAFE_TERMINAL_ESCAPE, "")
|
|
13
|
+
.replace(/\x1B/g, "")
|
|
14
|
+
.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, "")
|
|
15
|
+
.replace(/\r\n/g, "\n")
|
|
16
|
+
.replace(/\r/g, "\n");
|
|
17
|
+
}
|