claude-simple 0.2.14 → 0.2.16

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.
File without changes
package/dist/xterm.min.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-simple",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude-simple": "server.js",
package/public/index.html CHANGED
@@ -83,7 +83,7 @@
83
83
  <link id="hljs-theme" rel="stylesheet" href="/vendor/highlight-dark.min.css">
84
84
  <script src="/vendor/highlight.min.js"></script>
85
85
  <script src="/vendor/mermaid.min.js"></script>
86
- <link rel="stylesheet" href="style.css?v=ui-14">
86
+ <link rel="stylesheet" href="style.css?v=ui-15">
87
87
  </head>
88
88
  <body class="h-dvh overflow-hidden flex flex-col bg-base-100 text-base-content">
89
89
  <div id="root" class="flex flex-col flex-1 overflow-hidden"></div>
@@ -99,6 +99,6 @@
99
99
  }
100
100
  }, 10000);
101
101
  </script>
102
- <script type="module" src="app.js?v=ui-14"></script>
102
+ <script type="module" src="app.js?v=ui-15"></script>
103
103
  </body>
104
104
  </html>
package/public/mermaid.js CHANGED
@@ -16,6 +16,19 @@ function setup() {
16
16
  return api;
17
17
  }
18
18
 
19
+ function normalizeSource(raw) {
20
+ let source = String(raw || '').replace(/\r\n?/g, '\n').trim();
21
+ // Some agents include the Markdown fence or language name inside an already
22
+ // fenced Mermaid block. Mermaid treats both as grammar tokens and renders
23
+ // its own error SVG, so remove that transport wrapper defensively.
24
+ source = source.replace(/^```(?:mermaid)?\s*/i, '').replace(/\s*```$/, '').trim();
25
+ source = source.replace(/^mermaid\s*\n/i, '');
26
+ // `graph` remains an alias, but normalising it avoids version-specific
27
+ // parser behaviour in Mermaid 11 and keeps generated diagrams consistent.
28
+ source = source.replace(/^graph\s+(TD|TB|BT|RL|LR)\b/i, 'flowchart $1');
29
+ return source;
30
+ }
31
+
19
32
  /** Render fenced ```mermaid blocks below a freshly-rendered Markdown root. */
20
33
  export function renderMermaid(root) {
21
34
  const api = setup();
@@ -23,7 +36,7 @@ export function renderMermaid(root) {
23
36
  root.querySelectorAll('pre code.language-mermaid, pre code.lang-mermaid').forEach(code => {
24
37
  if (code.dataset.mermaidHandled) return;
25
38
  const pre = code.closest('pre');
26
- const source = code.textContent?.trim();
39
+ const source = normalizeSource(code.textContent);
27
40
  if (!pre || !source) return;
28
41
  code.dataset.mermaidHandled = '1';
29
42
 
@@ -34,7 +47,10 @@ export function renderMermaid(root) {
34
47
  pre.replaceWith(host);
35
48
  const id = `mermaid-diagram-${++sequence}`;
36
49
 
37
- Promise.resolve(api.render(id, source)).then(({ svg, bindFunctions }) => {
50
+ // Mermaid.render may resolve with an error SVG for invalid syntax rather
51
+ // than reject. Parse first so invalid generated content always takes the
52
+ // clean code-block fallback below.
53
+ Promise.resolve(api.parse(source)).then(() => api.render(id, source)).then(({ svg, bindFunctions }) => {
38
54
  host.innerHTML = svg;
39
55
  bindFunctions?.(host);
40
56
  }).catch(error => {
@@ -273,6 +273,10 @@ export async function resumeSession(sid, cwd, configDir, agent, machineId, opts
273
273
  const q = new URLSearchParams({
274
274
  tail: '0',
275
275
  compact: '1',
276
+ // Hub keeps a short-lived compact copy after completed turns. This
277
+ // makes a mobile re-open cache-first while the live WS remains the
278
+ // source for an in-progress answer.
279
+ cache: 'prefer',
276
280
  });
277
281
  if (agent) q.set('agent', agent);
278
282
  // Also put machine in query for proxies that drop custom headers.
package/public/sw.js CHANGED
@@ -1,12 +1,12 @@
1
1
  /* Agent UI service worker — cache shell assets only.
2
2
  * Never intercepts WebSocket or mutates API semantics beyond offline fallback.
3
3
  * Bump CACHE when shipping UI that must invalidate old shells. */
4
- const CACHE = 'agent-ui-shell-v19';
4
+ const CACHE = 'agent-ui-shell-v20';
5
5
  const PRECACHE = [
6
6
  '/',
7
7
  '/index.html',
8
8
  '/manifest.webmanifest',
9
- '/style.css?v=ui-14',
9
+ '/style.css?v=ui-15',
10
10
  '/style.css',
11
11
  '/ui.min.css',
12
12
  '/vendor/mini-react.min.js',
@@ -14,7 +14,7 @@ const PRECACHE = [
14
14
  '/vendor/highlight.min.js',
15
15
  '/vendor/highlight-dark.min.css',
16
16
  '/vendor/mermaid.min.js',
17
- '/app.js?v=ui-14',
17
+ '/app.js?v=ui-15',
18
18
  '/icons/icon-192.png',
19
19
  '/icons/icon-512.png',
20
20
  '/icons/icon-maskable-512.png',