mu-harness 0.24.0 → 0.25.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.
@@ -39,6 +39,9 @@ const AUDIO_MIME = {
39
39
  '.webm': 'audio/webm',
40
40
  };
41
41
  const ATTACHMENT_PLACEHOLDER = /\[(?:image|audio) #\d+\]/g;
42
+ // Cap raw attachment bytes so the base64 chat frame (~1.34x) stays under a typical
43
+ // 16MB WS payload limit, with headroom for text + JSON. Fail loudly, not silently.
44
+ const MAX_ATTACHMENT_BYTES = 11 * 1024 * 1024;
42
45
  const lastAssistantText = (messages) => {
43
46
  for (let i = messages.length - 1; i >= 0; i--) {
44
47
  const message = messages[i];
@@ -584,6 +587,11 @@ export class ChatApp {
584
587
  this.tui.requestRender();
585
588
  return;
586
589
  }
590
+ if (data.byteLength > MAX_ATTACHMENT_BYTES) {
591
+ this.setStatus(`${kind} too large (${Math.round(data.byteLength / (1024 * 1024))}MB) — not attached`);
592
+ this.tui.requestRender();
593
+ return;
594
+ }
587
595
  const placeholder = `[${kind} #${++this.attachSeq}]`;
588
596
  this.attachments.set(placeholder, kind === 'image' ? image(mime, data) : audio(mime, data));
589
597
  const value = this.editor.getValue();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mu-harness",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "Agent harness: createHarness wires mu-core into a host — XDG paths, model registry, plugins, disk-loaded agents & skills, sub-agents, sessions (JSONL + SQLite catalog), slash commands, permission/approval hooks, an optional scheduler, and a composable TUI chat app",
5
5
  "license": "MIT",
6
6
  "main": "./script/index.js",
@@ -23,8 +23,8 @@
23
23
  "@swc/wasm-typescript": "^1.15.0",
24
24
  "cli-highlight": "^2.1.11",
25
25
  "croner": "^9.0.0",
26
- "mu-core": "^0.24.0",
27
- "mu-tui": "^0.24.0",
26
+ "mu-core": "^0.25.0",
27
+ "mu-tui": "^0.25.0",
28
28
  "ws": "^8.18.0"
29
29
  },
30
30
  "_generatedBy": "dnt@dev",
@@ -42,6 +42,9 @@ const AUDIO_MIME = {
42
42
  '.webm': 'audio/webm',
43
43
  };
44
44
  const ATTACHMENT_PLACEHOLDER = /\[(?:image|audio) #\d+\]/g;
45
+ // Cap raw attachment bytes so the base64 chat frame (~1.34x) stays under a typical
46
+ // 16MB WS payload limit, with headroom for text + JSON. Fail loudly, not silently.
47
+ const MAX_ATTACHMENT_BYTES = 11 * 1024 * 1024;
45
48
  const lastAssistantText = (messages) => {
46
49
  for (let i = messages.length - 1; i >= 0; i--) {
47
50
  const message = messages[i];
@@ -587,6 +590,11 @@ class ChatApp {
587
590
  this.tui.requestRender();
588
591
  return;
589
592
  }
593
+ if (data.byteLength > MAX_ATTACHMENT_BYTES) {
594
+ this.setStatus(`${kind} too large (${Math.round(data.byteLength / (1024 * 1024))}MB) — not attached`);
595
+ this.tui.requestRender();
596
+ return;
597
+ }
590
598
  const placeholder = `[${kind} #${++this.attachSeq}]`;
591
599
  this.attachments.set(placeholder, kind === 'image' ? (0, mu_core_1.image)(mime, data) : (0, mu_core_1.audio)(mime, data));
592
600
  const value = this.editor.getValue();