zames_pro 2.83.1 → 2.83.2

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.83.2] - 2026-10-27
11
+
12
+ ### Fixed
13
+
14
+ - **ui:** repaint the model answer and the code highlighting on a theme switch
15
+
10
16
  ## [2.83.1] - 2026-10-27
11
17
 
12
18
  ### Added
package/dist/markdown.js CHANGED
@@ -1,30 +1,73 @@
1
1
  import { render } from 'markdansi';
2
- import { highlight } from 'cli-highlight';
2
+ import { highlight, DEFAULT_THEME as HL_DEFAULT_THEME, plain, } from 'cli-highlight';
3
3
  import supportsHyperlinks from 'supports-hyperlinks';
4
- const theme = {
5
- heading: { color: '#9fb8d8', bold: true },
6
- strong: { color: '#e6e0cc', bold: true },
7
- emph: { color: '#cfc9b0', italic: true },
8
- inlineCode: { color: '#9ecb9e' },
9
- blockCode: { color: '#c9d1c9' },
10
- code: { color: '#9ecb9e' },
11
- link: { color: '#8fb8d8', underline: true },
12
- quote: { color: '#8a8f9a', italic: true },
13
- hr: { color: '#5b616e' },
14
- listMarker: { color: '#8a9bb5' },
15
- tableHeader: { color: '#9fb8d8', bold: true },
16
- tableCell: { color: '#d0d0d0' },
17
- };
18
- function highlighter(code, lang) {
19
- try {
20
- return highlight(code, {
21
- language: lang || 'plaintext',
22
- ignoreIllegals: true,
23
- });
24
- }
25
- catch {
26
- return code;
27
- }
4
+ import { themeColors } from './theme.js';
5
+ /**
6
+ * The Markdown theme for one palette. Rebuilt on every render (it is cheap) so
7
+ * the answers follow a live theme switch; the module no longer freezes the
8
+ * colors at import time.
9
+ */
10
+ function mdTheme(p) {
11
+ return {
12
+ heading: { color: p.taskSummary, bold: true },
13
+ strong: { color: p.assistant, bold: true },
14
+ emph: { color: p.assistant, italic: true },
15
+ inlineCode: { color: p.success },
16
+ blockCode: { color: p.toolResult },
17
+ code: { color: p.success },
18
+ link: { color: p.dir, underline: true },
19
+ quote: { color: p.system, italic: true },
20
+ hr: { color: p.dim },
21
+ listMarker: { color: p.tool },
22
+ tableHeader: { color: p.taskSummary, bold: true },
23
+ tableCell: { color: p.assistant },
24
+ };
25
+ }
26
+ /**
27
+ * Syntax highlighting for a code block, mapped onto the palette. Without this
28
+ * the highlighter used cli-highlight's DEFAULT_THEME (chalk's blue/red/green),
29
+ * which ignores the selected theme entirely and looked off in every non-zames
30
+ * palette. Tokens we do not map fall back to `plain` — NOT to the default
31
+ * theme — so nothing outside the palette can leak in.
32
+ */
33
+ function hlTheme(p) {
34
+ return {
35
+ keyword: (s) => wrap(p.prompt, s),
36
+ built_in: (s) => wrap(p.tool, s),
37
+ type: (s) => wrap(p.taskSummary, s),
38
+ literal: (s) => wrap(p.prompt, s),
39
+ number: (s) => wrap(p.success, s),
40
+ regexp: (s) => wrap(p.error, s),
41
+ string: (s) => wrap(p.success, s),
42
+ comment: (s) => wrap(p.dim, s),
43
+ class: (s) => wrap(p.taskSummary, s),
44
+ function: (s) => wrap(p.dir, s),
45
+ title: (s) => wrap(p.dir, s),
46
+ params: (s) => wrap(p.assistant, s),
47
+ attr: (s) => wrap(p.tool, s),
48
+ variable: (s) => wrap(p.assistant, s),
49
+ doctag: (s) => wrap(p.system, s),
50
+ meta: (s) => wrap(p.system, s),
51
+ tag: (s) => wrap(p.prompt, s),
52
+ name: (s) => wrap(p.prompt, s),
53
+ section: (s) => wrap(p.taskSummary, s),
54
+ link: (s) => wrap(p.dir, s),
55
+ addition: (s) => wrap(p.success, s),
56
+ deletion: (s) => wrap(p.error, s),
57
+ };
58
+ }
59
+ /** Apply a palette color to a highlighted token. */
60
+ function wrap(hex, s) {
61
+ return '\x1b[38;2;' + rgb(hex) + 'm' + s + '\x1b[39m';
62
+ }
63
+ /** `#rrggbb` -> the `r;g;b` part of a truecolor SGR sequence. */
64
+ function rgb(hex) {
65
+ const h = hex.replace('#', '');
66
+ return (parseInt(h.slice(0, 2), 16) +
67
+ ';' +
68
+ parseInt(h.slice(2, 4), 16) +
69
+ ';' +
70
+ parseInt(h.slice(4, 6), 16));
28
71
  }
29
72
  // The answer width is the SHARED content width (src/width.ts), the same one
30
73
  // the operator's echoed text, the tool previews, the warnings and the divider
@@ -43,6 +86,7 @@ export function renderMarkdown(text) {
43
86
  // stay colored while everything else went plain.
44
87
  if (process.env.NO_COLOR)
45
88
  return String(text);
89
+ const p = themeColors();
46
90
  try {
47
91
  const width = contentWidth();
48
92
  return render(String(text), {
@@ -53,8 +97,12 @@ export function renderMarkdown(text) {
53
97
  // looked unformatted). `color: true` makes it always emit SGR; the ONE
54
98
  // opt-out is NO_COLOR, handled above.
55
99
  color: true,
56
- theme: theme,
57
- highlighter,
100
+ theme: mdTheme(p),
101
+ highlighter: (code, lang) => highlight(code, {
102
+ language: lang || 'plaintext',
103
+ ignoreIllegals: true,
104
+ theme: hlTheme(p),
105
+ }),
58
106
  codeBox: true,
59
107
  tableBorder: 'unicode',
60
108
  listIndent: 2,
@@ -68,4 +116,8 @@ export function renderMarkdown(text) {
68
116
  return String(text);
69
117
  }
70
118
  }
119
+ // Keep the import meaningful for tree-shakers/readers: the default theme is
120
+ // deliberately NOT used (see hlTheme), `plain` is the fallback contract.
121
+ void HL_DEFAULT_THEME;
122
+ void plain;
71
123
  export default renderMarkdown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.83.1",
3
+ "version": "2.83.2",
4
4
  "description": "Terminal coding agent that drives a real browser to chat with DeepSeek, Qwen or GLM — no API key required. Reads and edits files, runs commands, commits to git, like Claude Code / Codex CLI.",
5
5
  "type": "module",
6
6
  "bin": {