mixdog 0.9.55 → 0.9.59

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 (120) hide show
  1. package/package.json +3 -1
  2. package/scripts/_smoke_wd.mjs +7 -0
  3. package/scripts/agent-terminal-reap-test.mjs +127 -2
  4. package/scripts/compact-file-reattach-test.mjs +88 -0
  5. package/scripts/compact-pressure-test.mjs +45 -21
  6. package/scripts/compact-recall-digest-test.mjs +57 -0
  7. package/scripts/compact-smoke.mjs +35 -39
  8. package/scripts/desktop-session-bridge-test.mjs +271 -9
  9. package/scripts/generate-oc-icons.mjs +11 -0
  10. package/scripts/live-share-test.mjs +148 -0
  11. package/scripts/live-worker-smoke.mjs +1 -1
  12. package/scripts/max-output-recovery-test.mjs +12 -1
  13. package/scripts/mouse-tracking-restore-smoke.mjs +107 -0
  14. package/scripts/provider-admission-scheduler-test.mjs +100 -0
  15. package/scripts/provider-contract-test.mjs +49 -0
  16. package/scripts/resource-admission-test.mjs +5 -2
  17. package/scripts/session-ingest-compaction-smoke.mjs +38 -0
  18. package/scripts/steering-drain-buckets-test.mjs +15 -0
  19. package/scripts/submit-commandbusy-race-test.mjs +54 -3
  20. package/scripts/tool-smoke.mjs +2 -3
  21. package/scripts/tui-ambiguous-width-test.mjs +113 -0
  22. package/scripts/tui-runtime-load-bench.mjs +5 -0
  23. package/scripts/tui-transcript-perf-test.mjs +167 -0
  24. package/src/app.mjs +23 -0
  25. package/src/cli.mjs +6 -0
  26. package/src/lib/keychain-cjs.cjs +70 -20
  27. package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +4 -2
  28. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +18 -17
  29. package/src/runtime/agent/orchestrator/agent-trace-format.mjs +18 -0
  30. package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +111 -0
  31. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +6 -6
  32. package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +61 -2
  33. package/src/runtime/agent/orchestrator/session/agent-loop.mjs +13 -4
  34. package/src/runtime/agent/orchestrator/session/compact/engine.mjs +43 -2
  35. package/src/runtime/agent/orchestrator/session/compact/file-reattach.mjs +112 -0
  36. package/src/runtime/agent/orchestrator/session/context-utils.mjs +203 -49
  37. package/src/runtime/agent/orchestrator/session/loop/compact-debug.mjs +6 -2
  38. package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +110 -15
  39. package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +2 -0
  40. package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +7 -1
  41. package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +109 -2
  42. package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +15 -7
  43. package/src/runtime/agent/orchestrator/session/manager/idle-cleanup.mjs +39 -39
  44. package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +108 -4
  45. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +19 -0
  46. package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +22 -11
  47. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +132 -24
  48. package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +1 -1
  49. package/src/runtime/agent/orchestrator/session/manager.mjs +16 -1
  50. package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +39 -21
  51. package/src/runtime/agent/orchestrator/session/save-session-worker.mjs +18 -0
  52. package/src/runtime/agent/orchestrator/session/store/paths-heartbeat.mjs +91 -1
  53. package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +14 -33
  54. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +169 -0
  55. package/src/runtime/agent/orchestrator/session/store.mjs +474 -42
  56. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +17 -2
  57. package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +36 -1
  58. package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +20 -0
  59. package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +5 -1
  60. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +249 -11
  61. package/src/runtime/channels/data/voice-runtime-manifest.json +21 -5
  62. package/src/runtime/channels/lib/scheduler.mjs +8 -6
  63. package/src/runtime/channels/lib/voice-runtime-fetcher.mjs +71 -8
  64. package/src/runtime/channels/lib/voice-transcription.mjs +2 -2
  65. package/src/runtime/channels/lib/whisper-language.mjs +4 -0
  66. package/src/runtime/memory/lib/embedding-provider.mjs +7 -0
  67. package/src/runtime/memory/lib/embedding-worker.mjs +20 -0
  68. package/src/runtime/memory/lib/query-handlers.mjs +10 -4
  69. package/src/runtime/memory/lib/recall-format.mjs +43 -2
  70. package/src/runtime/memory/lib/session-ingest-runtime.mjs +90 -64
  71. package/src/runtime/shared/err-text.mjs +4 -1
  72. package/src/runtime/shared/resource-admission.mjs +11 -0
  73. package/src/runtime/shared/schedule-model-ref.mjs +28 -0
  74. package/src/runtime/shared/schedule-session-run.mjs +63 -0
  75. package/src/runtime/shared/schedules-db.mjs +8 -3
  76. package/src/runtime/shared/tool-result-summary.mjs +4 -1
  77. package/src/runtime/shared/tool-surface.mjs +7 -7
  78. package/src/runtime/shared/transcript-writer.mjs +17 -0
  79. package/src/session-runtime/channel-config-api.mjs +11 -0
  80. package/src/session-runtime/config-helpers.mjs +9 -6
  81. package/src/session-runtime/context-status.mjs +80 -3
  82. package/src/session-runtime/lifecycle-api.mjs +154 -40
  83. package/src/session-runtime/provider-auth-api.mjs +21 -2
  84. package/src/session-runtime/provider-usage.mjs +4 -1
  85. package/src/session-runtime/resource-api.mjs +12 -11
  86. package/src/session-runtime/runtime-core.mjs +45 -11
  87. package/src/session-runtime/session-text.mjs +56 -6
  88. package/src/session-runtime/session-turn-api.mjs +70 -2
  89. package/src/session-runtime/tool-catalog.mjs +2 -1
  90. package/src/session-runtime/workflow-agents-api.mjs +2 -2
  91. package/src/standalone/agent-tool/render.mjs +5 -1
  92. package/src/standalone/agent-tool.mjs +63 -3
  93. package/src/standalone/channel-admin.mjs +19 -3
  94. package/src/standalone/channel-daemon.mjs +40 -0
  95. package/src/tui/app/resume-picker.mjs +5 -1
  96. package/src/tui/app/settings-picker.mjs +19 -0
  97. package/src/tui/app/transcript-window.mjs +45 -8
  98. package/src/tui/app/use-mouse-input.mjs +101 -31
  99. package/src/tui/app/use-transcript-window.mjs +53 -9
  100. package/src/tui/components/ToolExecution.jsx +3 -4
  101. package/src/tui/components/TranscriptItem.jsx +3 -0
  102. package/src/tui/dist/index.mjs +17391 -14920
  103. package/src/tui/engine/context-state.mjs +10 -1
  104. package/src/tui/engine/live-share.mjs +390 -0
  105. package/src/tui/engine/queue-helpers.mjs +23 -0
  106. package/src/tui/engine/session-api-ext.mjs +439 -40
  107. package/src/tui/engine/session-api.mjs +7 -1
  108. package/src/tui/engine/session-flow.mjs +21 -7
  109. package/src/tui/engine/tool-card-results.mjs +3 -1
  110. package/src/tui/engine/turn.mjs +57 -4
  111. package/src/tui/engine.mjs +211 -7
  112. package/src/tui/index.jsx +2 -0
  113. package/src/tui/lib/voice-setup.mjs +10 -4
  114. package/src/tui/paste-attachments.mjs +4 -1
  115. package/src/vendor/statusline/src/gateway/session-routes.mjs +24 -1
  116. package/src/workflows/default/WORKFLOW.md +3 -0
  117. package/vendor/ink/build/display-width.js +14 -0
  118. package/vendor/ink/build/output.js +24 -3
  119. package/vendor/ink/build/wrap-text.d.ts +2 -0
  120. package/vendor/ink/build/wrap-text.js +45 -4
@@ -1,5 +1,7 @@
1
1
  import wrapAnsi from 'wrap-ansi';
2
2
  import cliTruncate from 'cli-truncate';
3
+ import sliceAnsi from 'slice-ansi';
4
+ import stringWidth from 'string-width';
3
5
  import stripAnsi from 'strip-ansi';
4
6
  import { AMBIGUOUS_WIDE, displayStringWidth } from './display-width.js';
5
7
  const cache = {};
@@ -20,7 +22,7 @@ const SGR_RESET = '\u001B[0m';
20
22
  // OSC 8 hyperlink open (with a URL) and universal close. Cutting inside a link
21
23
  // must close it on head and re-open it on tail, exactly like an open SGR style.
22
24
  const OSC8_CLOSE = '\u001B]8;;\u0007';
23
- const OSC8_RE = /^\u001B\]8;;([^\u0007\u001B]*)(?:\u0007|\u001B\\)/;
25
+ const OSC8_RE = /^\u001B\]8;([^\u0007\u001B]*);([^\u0007\u001B]*)(?:\u0007|\u001B\\)/;
24
26
  // Split one ANSI line at the first grapheme boundary where VISIBLE displayWidth
25
27
  // would exceed `max`. Walks grapheme CLUSTERS (not code points) so a clustered
26
28
  // glyph (e.g. `↔️` = U+2194 U+FE0F) is measured/kept whole. Returns
@@ -28,7 +30,7 @@ const OSC8_RE = /^\u001B\]8;;([^\u0007\u001B]*)(?:\u0007|\u001B\\)/;
28
30
  // style is still open at the cut so styling doesn't bleed); tail is the
29
31
  // remaining visible content, prefixed with the carried-over open SGR codes so
30
32
  // it renders with the same style it was cut from. ANSI escapes cost 0 width.
31
- const splitAtDisplayWidth = (line, max) => {
33
+ const splitAtDisplayWidth = (line, max, forceFirst = true) => {
32
34
  if (displayStringWidth(line) <= max)
33
35
  return { head: line, tail: '' };
34
36
  let head = '';
@@ -59,7 +61,9 @@ const splitAtDisplayWidth = (line, max) => {
59
61
  else {
60
62
  const osc = OSC8_RE.exec(m[0]);
61
63
  if (osc)
62
- openLink = osc[1] ? m[0] : '';
64
+ // Preserve the complete OSC 8 opener, including optional
65
+ // params such as `id=x`, when carrying a link to the tail.
66
+ openLink = osc[2] ? m[0] : '';
63
67
  }
64
68
  rest = rest.slice(m[0].length);
65
69
  continue;
@@ -69,7 +73,7 @@ const splitAtDisplayWidth = (line, max) => {
69
73
  // Progress guarantee: if nothing visible has landed on head yet, force
70
74
  // the first grapheme through even when it alone exceeds max (a 1-cluster
71
75
  // overflow is unavoidable and preferable to a zero-progress loop).
72
- if (width + w > max && width > 0)
76
+ if (width + w > max && (width > 0 || !forceFirst))
73
77
  break;
74
78
  head += segment;
75
79
  width += w;
@@ -109,6 +113,43 @@ const reflowToDisplayWidth = (line, max) => {
109
113
  // truncate-end: cutting is the intended behavior — drop the overflow but still
110
114
  // cut on grapheme boundaries and close open styles.
111
115
  const hardCutToDisplayWidth = (line, max) => splitAtDisplayWidth(line, max).head;
116
+ // Clipping cannot use wrapping's progress guarantee: a two-cell grapheme in a
117
+ // one-cell remainder must be dropped, never forced through the clip edge.
118
+ const strictCutToDisplayWidth = (line, max) => max <= 0
119
+ ? ''
120
+ : splitAtDisplayWidth(line, max, false).head;
121
+ // [mixdog fork] Policy-aware ANSI slice for Output's horizontal clipping.
122
+ // `slice-ansi` measures ambiguous glyphs with plain string-width, so its
123
+ // from/to columns drift whenever a clipped transcript row contains ①/②/③.
124
+ // Keep the same split primitive as wrapping so clipping and measurement use
125
+ // identical terminal-cell boundaries.
126
+ export const sliceTextByDisplayWidthWithPolicy = (line, from, to, wide) => {
127
+ const start = Math.max(0, Math.floor(Number(from) || 0));
128
+ const end = Math.max(start, Math.floor(Number(to) || 0));
129
+ const source = String(line ?? '');
130
+ const plain = stripAnsi(source);
131
+ // Preserve exact upstream bytes (including its choice of SGR close code)
132
+ // unless the active policy actually changes this line's measured width.
133
+ // The broad trigger regex also contains ←/↑/→/↓ and ↻, which the true
134
+ // policy deliberately excludes; a width-delta check keeps those lines on
135
+ // slice-ansi's byte-identical path.
136
+ if (!wide || displayStringWidth(plain) === stringWidth(plain))
137
+ return sliceAnsi(source, start, end);
138
+ if (end <= start)
139
+ return '';
140
+ let remainder = source;
141
+ if (start > 0) {
142
+ const prefix = splitAtDisplayWidth(remainder, start);
143
+ remainder = prefix.tail;
144
+ // If `start` lands inside a wide grapheme, consume that whole grapheme:
145
+ // rendering half of it at x1 would still cross the left clip boundary.
146
+ if (remainder && displayStringWidth(prefix.head) < start) {
147
+ remainder = splitAtDisplayWidth(remainder, 1).tail;
148
+ }
149
+ }
150
+ return strictCutToDisplayWidth(remainder, end - start);
151
+ };
152
+ export const sliceTextByDisplayWidth = (line, from, to) => sliceTextByDisplayWidthWithPolicy(line, from, to, AMBIGUOUS_WIDE);
112
153
  // Re-enforce the display-width budget on every produced line when the policy is
113
154
  // ON and the source contains a problem glyph. No-op otherwise (byte-identical
114
155
  // to upstream wrap-ansi output), so terminals without the wide policy are