openmsg 0.4.0 → 0.4.1
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/deliver.mjs +2 -1
- package/src/envelope.mjs +5 -4
package/package.json
CHANGED
package/src/deliver.mjs
CHANGED
|
@@ -8,7 +8,8 @@ import { layoutOf, compose, bodyRange } from "./envelope.mjs";
|
|
|
8
8
|
|
|
9
9
|
// `parts` is the layout of the text that the model reads: the frame and the text
|
|
10
10
|
// of the sender. Each adapter shows the two apart in its own way:
|
|
11
|
-
// Claude Code shows the color of an escape sequence, so the frame is gray
|
|
11
|
+
// Claude Code shows the color of an escape sequence, so the frame is gray
|
|
12
|
+
// and the text of the sender is blue.
|
|
12
13
|
// Codex removes each escape sequence, but it draws a byte range in its accent
|
|
13
14
|
// color. The text of the sender gets that color, and the model never sees it.
|
|
14
15
|
// OpenCode gets the plain text. Its display is not tested.
|
package/src/envelope.mjs
CHANGED
|
@@ -56,11 +56,12 @@ export function layout(head, body, foot) {
|
|
|
56
56
|
return { head, body: clean(body), foot };
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// With `ansi`, each line of the frame is gray
|
|
60
|
-
// with its own color, so the color must open
|
|
59
|
+
// With `ansi`, each line of the frame is gray, and each line of the body is
|
|
60
|
+
// blue. Claude Code starts each line with its own color, so the color must open
|
|
61
|
+
// and close on each line. Blue is the blue of the theme of each terminal.
|
|
61
62
|
export function compose({ head, body, foot }, { ansi = false } = {}) {
|
|
62
|
-
const
|
|
63
|
-
return [...
|
|
63
|
+
const paint = (code, lines) => (ansi ? lines.map((l) => `\x1b[${code}m${l}\x1b[39m`) : lines);
|
|
64
|
+
return [...paint(90, head), ...paint(34, body.split("\n")), ...paint(90, foot)].join("\n");
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
// The byte range of the body inside the plain text. Codex draws a range in its
|