mixdog 0.9.65 → 0.9.66

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.
Files changed (31) hide show
  1. package/package.json +1 -1
  2. package/src/app.mjs +2 -2
  3. package/src/cli.mjs +1 -1
  4. package/src/repl.mjs +72 -6
  5. package/src/runtime/agent/orchestrator/session/context-utils.mjs +76 -21
  6. package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +45 -4
  7. package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +11 -1
  8. package/src/runtime/agent/orchestrator/session/store/summary-cache.mjs +36 -13
  9. package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +79 -18
  10. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +4 -0
  11. package/src/runtime/agent/orchestrator/session/store.mjs +37 -2
  12. package/src/session-runtime/context-status.mjs +2 -1
  13. package/src/session-runtime/provider-request-tools.mjs +6 -0
  14. package/src/session-runtime/tool-catalog-schema.mjs +5 -1
  15. package/src/tui/app/transcript-window.mjs +16 -0
  16. package/src/tui/app/use-transcript-window.mjs +36 -1
  17. package/src/tui/components/Markdown.jsx +15 -1
  18. package/src/tui/components/Message.jsx +1 -1
  19. package/src/tui/components/PromptInput.jsx +7 -0
  20. package/src/tui/dist/index.mjs +307 -79
  21. package/src/tui/engine/frame-batched-store.mjs +5 -3
  22. package/src/tui/engine/render-timing.mjs +28 -0
  23. package/src/tui/engine/session-api-ext.mjs +7 -0
  24. package/src/tui/engine/tui-steering-persist.mjs +25 -4
  25. package/src/tui/engine.mjs +9 -1
  26. package/src/tui/index.jsx +11 -3
  27. package/src/tui/markdown/measure-rendered-rows.mjs +28 -16
  28. package/src/tui/markdown/render-ansi.mjs +34 -1
  29. package/src/tui/markdown/stream-fence.mjs +44 -7
  30. package/src/tui/markdown/streaming-markdown.mjs +95 -27
  31. package/src/ui/stream-finalize.mjs +45 -0
@@ -0,0 +1,45 @@
1
+ import { visibleWidth } from './ansi.mjs';
2
+
3
+ /**
4
+ * Build a conservative in-place final-format patch for a streamed terminal
5
+ * block. Logical rows must map 1:1 to physical rows; wrapped or structurally
6
+ * changed output returns null so the caller can use the full-redraw fallback.
7
+ */
8
+ export function buildStreamFinalPatch(rawText, renderedText, { columns = 80 } = {}) {
9
+ const raw = String(rawText ?? '');
10
+ const rendered = String(renderedText ?? '');
11
+ if (raw.includes('\r') || rendered.includes('\r')) return null;
12
+ const rawLines = raw.split('\n');
13
+ const renderedLines = rendered.split('\n');
14
+ if (rawLines.length !== renderedLines.length) return null;
15
+
16
+ const width = Math.max(1, Math.floor(Number(columns) || 80));
17
+ for (let index = 0; index < rawLines.length; index += 1) {
18
+ if (visibleWidth(rawLines[index]) >= width || visibleWidth(renderedLines[index]) >= width) {
19
+ return null;
20
+ }
21
+ }
22
+
23
+ const changedRows = [];
24
+ for (let index = 0; index < rawLines.length; index += 1) {
25
+ if (rawLines[index] !== renderedLines[index]) changedRows.push(index);
26
+ }
27
+ if (changedRows.length === 0) {
28
+ return { output: '', changedRows: 0, totalRows: rawLines.length };
29
+ }
30
+
31
+ let output = '\r';
32
+ for (let index = rawLines.length - 1; index >= 0; index -= 1) {
33
+ if (rawLines[index] !== renderedLines[index]) {
34
+ output += `\x1b[2K${renderedLines[index]}`;
35
+ }
36
+ if (index > 0) output += '\r\x1b[1A';
37
+ }
38
+ if (rawLines.length > 1) {
39
+ output += `\r\x1b[${rawLines.length - 1}B`;
40
+ const lastWidth = visibleWidth(renderedLines.at(-1) || '');
41
+ if (lastWidth > 0) output += `\x1b[${lastWidth}C`;
42
+ }
43
+
44
+ return { output, changedRows: changedRows.length, totalRows: rawLines.length };
45
+ }