shadok-ai 0.3.89 → 0.3.90
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/public/live-text.js +17 -7
package/package.json
CHANGED
package/public/live-text.js
CHANGED
|
@@ -6,25 +6,35 @@
|
|
|
6
6
|
// .jsonl transcript only writes a text block once FINISHED; the screen shows it
|
|
7
7
|
// as it is typed → the only token-granular source.
|
|
8
8
|
//
|
|
9
|
-
// An assistant text block = a "
|
|
10
|
-
//
|
|
11
|
-
// "
|
|
9
|
+
// An assistant text block = a "<bullet> <prose>" line at column 0, followed by
|
|
10
|
+
// continuations indented by 2 spaces. A tool_use renders as
|
|
11
|
+
// "<bullet> Name(args)"; a tool result renders as " ⎿ …".
|
|
12
|
+
//
|
|
13
|
+
// TWO bullets, and both are load-bearing: Claude Code used "⏺" (U+23FA) and
|
|
14
|
+
// switched to "●" (U+25CF) in 2.1. Matching only one makes `extractLiveText`
|
|
15
|
+
// find nothing at all — the web live preview goes dark with no error anywhere,
|
|
16
|
+
// on every session running that version. Support for "●" was added once,
|
|
17
|
+
// removed by a translation pass that also deleted its tests (so CI stayed
|
|
18
|
+
// green), and restored here. Do not "simplify" this back to a single marker.
|
|
12
19
|
|
|
13
|
-
const
|
|
20
|
+
const MARKERS = ["⏺ ", "● "];
|
|
21
|
+
const markerOf = (line) => MARKERS.find((m) => line.startsWith(m)) ?? null;
|
|
14
22
|
|
|
15
23
|
/** The last visible assistant text block, unwrapped; "" otherwise. */
|
|
16
24
|
export function extractLiveText(screen) {
|
|
17
25
|
if (typeof screen !== "string" || !screen) return "";
|
|
18
26
|
const lines = screen.split("\n");
|
|
19
27
|
|
|
20
|
-
// Find the last
|
|
28
|
+
// Find the last block marker at column 0, whichever bullet it uses.
|
|
21
29
|
let start = -1;
|
|
30
|
+
let marker = null;
|
|
22
31
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
23
|
-
|
|
32
|
+
const m = markerOf(lines[i]);
|
|
33
|
+
if (m) { start = i; marker = m; break; }
|
|
24
34
|
}
|
|
25
35
|
if (start < 0) return "";
|
|
26
36
|
|
|
27
|
-
const head = lines[start].slice(
|
|
37
|
+
const head = lines[start].slice(marker.length).trim();
|
|
28
38
|
// Exclude TOOL lines (not assistant text):
|
|
29
39
|
// - tool_use : "⏺ Name(...)" — an identifier glued to a parenthesis;
|
|
30
40
|
// - running tool: "⏺ Running 1 shell command" / "⏺ Ran 1 shell command".
|