mixdog 0.9.152 → 0.9.154

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 (300) hide show
  1. package/LICENSES/browser-import-NOTICE.txt +11 -0
  2. package/NOTICE.md +11 -0
  3. package/README.md +8 -10
  4. package/package.json +19 -3
  5. package/scripts/computer-task-cost-report.mjs +144 -0
  6. package/scripts/run-office-live-tests.mjs +32 -0
  7. package/src/agents/front-worker/AGENT.md +13 -0
  8. package/src/agents/front-worker/agent.json +6 -0
  9. package/src/agents/heavy-worker/AGENT.md +10 -11
  10. package/src/agents/heavy-worker/agent.json +1 -1
  11. package/src/agents/maintainer/AGENT.md +0 -2
  12. package/src/agents/reviewer/AGENT.md +9 -13
  13. package/src/agents/reviewer/agent.json +1 -1
  14. package/src/agents/security/AGENT.md +14 -0
  15. package/src/agents/security/agent.json +6 -0
  16. package/src/agents/worker/AGENT.md +8 -8
  17. package/src/agents/worker/agent.json +1 -1
  18. package/src/agents/writer/AGENT.md +14 -0
  19. package/src/agents/writer/agent.json +6 -0
  20. package/src/rules/agent/00-common.md +4 -7
  21. package/src/rules/lead/01-general.md +0 -3
  22. package/src/rules/shared/10-tool-workflow.md +10 -2
  23. package/src/rules/shared/60-verification.md +2 -0
  24. package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +183 -26
  25. package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +4 -0
  26. package/src/runtime/agent/orchestrator/cache-break-trace.mjs +109 -0
  27. package/src/runtime/agent/orchestrator/config.mjs +7 -2
  28. package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +16 -3
  29. package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +9 -1
  30. package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +30 -9
  31. package/src/runtime/agent/orchestrator/providers/openai-codex-metadata.mjs +18 -26
  32. package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +25 -2
  33. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +103 -10
  34. package/src/runtime/agent/orchestrator/providers/openai-turn-state.mjs +68 -0
  35. package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +36 -11
  36. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +140 -86
  37. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +9 -13
  38. package/src/runtime/agent/orchestrator/session/agent-loop.mjs +72 -4
  39. package/src/runtime/agent/orchestrator/session/browser-snapshot-supersession.mjs +61 -0
  40. package/src/runtime/agent/orchestrator/session/compact/handoff.mjs +0 -22
  41. package/src/runtime/agent/orchestrator/session/compact/messages.mjs +2 -2
  42. package/src/runtime/agent/orchestrator/session/compact/runner.mjs +11 -23
  43. package/src/runtime/agent/orchestrator/session/compact/summary.mjs +28 -269
  44. package/src/runtime/agent/orchestrator/session/compact.mjs +0 -6
  45. package/src/runtime/agent/orchestrator/session/context-utils.mjs +86 -11
  46. package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +17 -1
  47. package/src/runtime/agent/orchestrator/session/image-strip-recovery.mjs +12 -8
  48. package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +110 -2
  49. package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +3 -16
  50. package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +80 -18
  51. package/src/runtime/agent/orchestrator/session/loop/steering.mjs +6 -0
  52. package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +3 -0
  53. package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +6 -0
  54. package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +80 -21
  55. package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +33 -72
  56. package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +21 -2
  57. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +25 -51
  58. package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +3 -0
  59. package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +4 -110
  60. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +39 -15
  61. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +14 -4
  62. package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +41 -8
  63. package/src/runtime/agent/orchestrator/session/provider-prefix-guard.mjs +129 -12
  64. package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +2 -2
  65. package/src/runtime/agent/orchestrator/session/store/listing.mjs +8 -1
  66. package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +15 -1
  67. package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +36 -2
  68. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +157 -30
  69. package/src/runtime/agent/orchestrator/session/store-summary-visibility.mjs +57 -0
  70. package/src/runtime/agent/orchestrator/session/store.mjs +3 -1
  71. package/src/runtime/agent/orchestrator/session/tool-batch.mjs +22 -0
  72. package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +6 -6
  73. package/src/runtime/agent/orchestrator/tools/progress-message.mjs +4 -0
  74. package/src/runtime/attachments/pdf-extract.mjs +3 -0
  75. package/src/runtime/attachments/pdfjs-runtime.mjs +13 -0
  76. package/src/runtime/browser-bridge/action-schema.mjs +251 -0
  77. package/src/runtime/browser-bridge/client.mjs +75 -26
  78. package/src/runtime/browser-bridge/tool-defs.mjs +132 -15
  79. package/src/runtime/computer-bridge/action-schema.mjs +653 -0
  80. package/src/runtime/computer-bridge/client.mjs +211 -28
  81. package/src/runtime/computer-bridge/tool-defs.mjs +25 -45
  82. package/src/runtime/office/assurance-benchmark.mjs +358 -0
  83. package/src/runtime/office/assurance.mjs +833 -0
  84. package/src/runtime/office/benchmark.mjs +496 -0
  85. package/src/runtime/office/capabilities.mjs +551 -0
  86. package/src/runtime/office/com-adapter.mjs +283 -0
  87. package/src/runtime/office/content-model.mjs +183 -0
  88. package/src/runtime/office/contract-benchmark.mjs +105 -0
  89. package/src/runtime/office/design-library.mjs +1562 -0
  90. package/src/runtime/office/design-system.mjs +1966 -0
  91. package/src/runtime/office/index.mjs +2413 -0
  92. package/src/runtime/office/journal.mjs +82 -0
  93. package/src/runtime/office/office-com-host.ps1 +3781 -0
  94. package/src/runtime/office/office-com-session-host.ps1 +855 -0
  95. package/src/runtime/office/ooxml-validator.mjs +271 -0
  96. package/src/runtime/office/pagination.mjs +132 -0
  97. package/src/runtime/office/pdf-adapter.mjs +591 -0
  98. package/src/runtime/office/pdf-analysis.mjs +372 -0
  99. package/src/runtime/office/pdf-render.mjs +167 -0
  100. package/src/runtime/office/pdf-security.mjs +63 -0
  101. package/src/runtime/office/polish-benchmark.mjs +190 -0
  102. package/src/runtime/office/portable-ooxml.mjs +1867 -0
  103. package/src/runtime/office/quality-live-benchmark.mjs +486 -0
  104. package/src/runtime/office/quality-pipeline.mjs +136 -0
  105. package/src/runtime/office/tabular.mjs +302 -0
  106. package/src/runtime/office/templates/mixdog-executive.pptx +0 -0
  107. package/src/runtime/office/templates/mixdog-executive.pptx.mixdog.json +190 -0
  108. package/src/runtime/office/tool-defs.mjs +113 -0
  109. package/src/runtime/office/visual-diff.mjs +89 -0
  110. package/src/runtime/office/xlsx-assertions.mjs +172 -0
  111. package/src/runtime/office/xlsx-contract.mjs +147 -0
  112. package/src/runtime/shared/agent-route-config.mjs +9 -0
  113. package/src/runtime/shared/tool-execution-contract.mjs +16 -0
  114. package/src/runtime/shared/tool-surface.mjs +9 -0
  115. package/src/session-runtime/context-status.mjs +9 -3
  116. package/src/session-runtime/deferred-tool-delta.mjs +104 -0
  117. package/src/session-runtime/goal-runtime.mjs +617 -197
  118. package/src/session-runtime/lifecycle-api.mjs +50 -8
  119. package/src/session-runtime/provider-request-snapshot.mjs +33 -9
  120. package/src/session-runtime/resource-api.mjs +31 -94
  121. package/src/session-runtime/runtime-core.mjs +78 -26
  122. package/src/session-runtime/session-lifecycle.mjs +34 -12
  123. package/src/session-runtime/session-title.mjs +2 -2
  124. package/src/session-runtime/session-turn-api.mjs +15 -14
  125. package/src/session-runtime/tool-catalog-data.mjs +1 -1
  126. package/src/session-runtime/tool-catalog.mjs +38 -99
  127. package/src/session-runtime/tool-defs.mjs +6 -1
  128. package/src/session-runtime/tool-surface.mjs +18 -8
  129. package/src/session-runtime/workflow-agents-api.mjs +8 -25
  130. package/src/session-runtime/workflow.mjs +8 -6
  131. package/src/standalone/agent-tool/helpers.mjs +2 -2
  132. package/src/standalone/agent-tool/job-views.mjs +3 -1
  133. package/src/standalone/agent-tool/notify.mjs +5 -1
  134. package/src/standalone/agent-tool/render.mjs +3 -0
  135. package/src/standalone/agent-tool/spawn-flow.mjs +61 -16
  136. package/src/standalone/agent-tool/tool-def.mjs +1 -1
  137. package/src/standalone/agent-tool/worker-index.mjs +123 -0
  138. package/src/standalone/agent-tool/worker-rows.mjs +2 -1
  139. package/src/standalone/agent-tool.mjs +57 -10
  140. package/src/standalone/daemon.mjs +105 -6
  141. package/src/standalone/session-runtime-host.mjs +61 -48
  142. package/src/standalone/session-runtime-inline-host.mjs +34 -127
  143. package/src/standalone/session-runtime-worker.mjs +20 -198
  144. package/src/standalone/session-service.mjs +632 -7
  145. package/src/tui/dist/index.mjs +24 -1
  146. package/src/tui/lib/voice-setup.mjs +4 -1
  147. package/src/tui/session/context-state.mjs +2 -13
  148. package/src/tui/session/goal-continuation.mjs +38 -7
  149. package/src/tui/session/session-api-ext.mjs +9 -0
  150. package/src/tui/session/session-api.mjs +15 -1
  151. package/src/tui/session/session-flow.mjs +25 -1
  152. package/src/tui/session/turn.mjs +88 -16
  153. package/src/tui/session-local.mjs +25 -3
  154. package/src/vendor/statusline/src/gateway/route-meta.mjs +31 -0
  155. package/scripts/generate-voice-runtime-manifest.test.mjs +0 -135
  156. package/scripts/native-binary-arch.test.mjs +0 -111
  157. package/scripts/patch-replay.test.mjs +0 -94
  158. package/src/headless-exec.test.mjs +0 -539
  159. package/src/runtime/agent/orchestrator/agent-trace-timing.test.mjs +0 -57
  160. package/src/runtime/agent/orchestrator/context/collect-skills.test.mjs +0 -153
  161. package/src/runtime/agent/orchestrator/mcp/cancellation.test.mjs +0 -139
  162. package/src/runtime/agent/orchestrator/mcp/features.test.mjs +0 -66
  163. package/src/runtime/agent/orchestrator/mcp/security.test.mjs +0 -80
  164. package/src/runtime/agent/orchestrator/providers/anthropic-fast-mode.test.mjs +0 -90
  165. package/src/runtime/agent/orchestrator/providers/anthropic-server-fallback.test.mjs +0 -215
  166. package/src/runtime/agent/orchestrator/providers/antigravity-oauth.test.mjs +0 -165
  167. package/src/runtime/agent/orchestrator/providers/media-parity.test.mjs +0 -142
  168. package/src/runtime/agent/orchestrator/providers/openai-codex-identity.test.mjs +0 -153
  169. package/src/runtime/agent/orchestrator/providers/openai-codex-model.test.mjs +0 -24
  170. package/src/runtime/agent/orchestrator/providers/openai-ws-delta-parity.test.mjs +0 -190
  171. package/src/runtime/agent/orchestrator/providers/provider-replay.test.mjs +0 -235
  172. package/src/runtime/agent/orchestrator/providers/sse-framing.test.mjs +0 -719
  173. package/src/runtime/agent/orchestrator/session/cache/prefetch-cache.test.mjs +0 -40
  174. package/src/runtime/agent/orchestrator/session/compact-policy.test.mjs +0 -176
  175. package/src/runtime/agent/orchestrator/session/compaction-read-reset.test.mjs +0 -161
  176. package/src/runtime/agent/orchestrator/session/eager-dispatch.test.mjs +0 -115
  177. package/src/runtime/agent/orchestrator/session/evidence-union.test.mjs +0 -228
  178. package/src/runtime/agent/orchestrator/session/image-strip-recovery.test.mjs +0 -245
  179. package/src/runtime/agent/orchestrator/session/lossless-tool-output.test.mjs +0 -125
  180. package/src/runtime/agent/orchestrator/session/manager/pending-messages-persistence.test.mjs +0 -325
  181. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.test.mjs +0 -70
  182. package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.test.mjs +0 -457
  183. package/src/runtime/agent/orchestrator/session/provider-prefix-guard.test.mjs +0 -117
  184. package/src/runtime/agent/orchestrator/session/reduction-metrics.test.mjs +0 -87
  185. package/src/runtime/agent/orchestrator/session/store/serialize.test.mjs +0 -60
  186. package/src/runtime/agent/orchestrator/session/store-summary-reader.test.mjs +0 -583
  187. package/src/runtime/agent/orchestrator/session/task-wait-control.test.mjs +0 -78
  188. package/src/runtime/agent/orchestrator/tools/builtin/absence-absorption.test.mjs +0 -43
  189. package/src/runtime/agent/orchestrator/tools/builtin/absolute-glob-expand.test.mjs +0 -63
  190. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool-cwd-env.test.mjs +0 -14
  191. package/src/runtime/agent/orchestrator/tools/builtin/edit-encoding-eol.test.mjs +0 -224
  192. package/src/runtime/agent/orchestrator/tools/builtin/edit-sequential-occupation.test.mjs +0 -224
  193. package/src/runtime/agent/orchestrator/tools/builtin/enoent-outside-project.test.mjs +0 -56
  194. package/src/runtime/agent/orchestrator/tools/builtin/find-search-budget.test.mjs +0 -103
  195. package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.test.mjs +0 -30
  196. package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.test.mjs +0 -390
  197. package/src/runtime/agent/orchestrator/tools/builtin/git-repo-rw-lock.test.mjs +0 -83
  198. package/src/runtime/agent/orchestrator/tools/builtin/grep-output-budget.test.mjs +0 -31
  199. package/src/runtime/agent/orchestrator/tools/builtin/grep-single-file-rescue.test.mjs +0 -106
  200. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.test.mjs +0 -102
  201. package/src/runtime/agent/orchestrator/tools/builtin/list-tool-integrity.test.mjs +0 -152
  202. package/src/runtime/agent/orchestrator/tools/builtin/native-search-health.test.mjs +0 -24
  203. package/src/runtime/agent/orchestrator/tools/builtin/native-search-transport.test.mjs +0 -24
  204. package/src/runtime/agent/orchestrator/tools/builtin/noise-dir-visibility.test.mjs +0 -69
  205. package/src/runtime/agent/orchestrator/tools/builtin/read-glob-survey.test.mjs +0 -71
  206. package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.test.mjs +0 -56
  207. package/src/runtime/agent/orchestrator/tools/builtin/search-builders.test.mjs +0 -16
  208. package/src/runtime/agent/orchestrator/tools/builtin/search-glob-top-k.test.mjs +0 -39
  209. package/src/runtime/agent/orchestrator/tools/builtin/write-symlink.test.mjs +0 -153
  210. package/src/runtime/agent/orchestrator/tools/code-graph/aggregate-anchor-relocation.test.mjs +0 -55
  211. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.test.mjs +0 -88
  212. package/src/runtime/agent/orchestrator/tools/code-graph/loose-file-target.test.mjs +0 -72
  213. package/src/runtime/agent/orchestrator/tools/code-graph/memory-cache.test.mjs +0 -54
  214. package/src/runtime/agent/orchestrator/tools/code-graph/search-references.test.mjs +0 -20
  215. package/src/runtime/agent/orchestrator/tools/code-graph/symbol-search-scope.test.mjs +0 -55
  216. package/src/runtime/agent/orchestrator/tools/code-graph/text-span-mask.test.mjs +0 -268
  217. package/src/runtime/agent/orchestrator/tools/env-scrub.test.mjs +0 -57
  218. package/src/runtime/agent/orchestrator/tools/graph-binary-fetcher.test.mjs +0 -19
  219. package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.test.mjs +0 -104
  220. package/src/runtime/agent/orchestrator/tools/patch/engine-contract-gate.test.mjs +0 -661
  221. package/src/runtime/agent/orchestrator/tools/patch/patch-codec-eol.test.mjs +0 -552
  222. package/src/runtime/agent/orchestrator/tools/patch/patch-symlink.test.mjs +0 -141
  223. package/src/runtime/agent/orchestrator/tools/patch/v4a-pure-move.test.mjs +0 -57
  224. package/src/runtime/agent/orchestrator/tools/patch/v4a-section-coalesce.test.mjs +0 -81
  225. package/src/runtime/agent/orchestrator/tools/spawn-binary-fetcher.test.mjs +0 -52
  226. package/src/runtime/attachments/store.test.mjs +0 -209
  227. package/src/runtime/channels/lib/voice-runtime-fetcher.test.mjs +0 -17
  228. package/src/runtime/channels/lib/webhook/deliveries.test.mjs +0 -18
  229. package/src/runtime/channels/lib/webhook/relay-tunnel.test.mjs +0 -68
  230. package/src/runtime/media/adapters/codex-image.test.mjs +0 -22
  231. package/src/runtime/media/download.test.mjs +0 -52
  232. package/src/runtime/media/renditions.test.mjs +0 -99
  233. package/src/runtime/media/store.test.mjs +0 -159
  234. package/src/runtime/memory/lib/archive-security.test.mjs +0 -128
  235. package/src/runtime/memory/lib/embedding-model-config.test.mjs +0 -33
  236. package/src/runtime/memory/lib/http-wire.test.mjs +0 -15
  237. package/src/runtime/memory/lib/memory-cycle-packets.test.mjs +0 -49
  238. package/src/runtime/memory/lib/memory-cycle2-shared.test.mjs +0 -78
  239. package/src/runtime/memory/lib/memory-embedding-migration.test.mjs +0 -50
  240. package/src/runtime/memory/lib/pg/process.test.mjs +0 -36
  241. package/src/runtime/memory/lib/trace-store.test.mjs +0 -57
  242. package/src/runtime/memory/lib/transcript-ingest.test.mjs +0 -52
  243. package/src/runtime/shared/background-tasks.test.mjs +0 -78
  244. package/src/runtime/shared/bounded-download.test.mjs +0 -41
  245. package/src/runtime/shared/channel-notification-routing.test.mjs +0 -25
  246. package/src/runtime/shared/child-spawn-remote.test.mjs +0 -124
  247. package/src/runtime/shared/remote-intent.test.mjs +0 -40
  248. package/src/runtime/shared/resource-admission.test.mjs +0 -43
  249. package/src/runtime/shared/runtime-root.test.mjs +0 -34
  250. package/src/runtime/shared/schedule-time.test.mjs +0 -29
  251. package/src/runtime/shared/session-runtime-health.test.mjs +0 -83
  252. package/src/runtime/shared/skill-document.test.mjs +0 -81
  253. package/src/runtime/shared/tool-surface.test.mjs +0 -87
  254. package/src/runtime/shared/update-checker.test.mjs +0 -33
  255. package/src/runtime/shared/user-cwd.test.mjs +0 -43
  256. package/src/runtime/shared/webhook-session-run.test.mjs +0 -14
  257. package/src/session-runtime/agent-disable.test.mjs +0 -123
  258. package/src/session-runtime/cwd-plugins.test.mjs +0 -75
  259. package/src/session-runtime/cwd-tool-routing.test.mjs +0 -61
  260. package/src/session-runtime/global-extensions.test.mjs +0 -28
  261. package/src/session-runtime/goal-runtime.test.mjs +0 -108
  262. package/src/session-runtime/lifecycle-api.test.mjs +0 -21
  263. package/src/session-runtime/model-settings-persist.test.mjs +0 -105
  264. package/src/session-runtime/notification-bus.test.mjs +0 -148
  265. package/src/session-runtime/plugin-mcp-standard.test.mjs +0 -177
  266. package/src/session-runtime/prewarm.test.mjs +0 -52
  267. package/src/session-runtime/provider-request-snapshot.test.mjs +0 -37
  268. package/src/session-runtime/resource-api-global.test.mjs +0 -69
  269. package/src/session-runtime/session-lifecycle.test.mjs +0 -125
  270. package/src/session-runtime/session-title.test.mjs +0 -36
  271. package/src/session-runtime/skills-api.test.mjs +0 -99
  272. package/src/session-runtime/tool-policy-surface.test.mjs +0 -331
  273. package/src/standalone/agent-tool/helpers.test.mjs +0 -62
  274. package/src/standalone/agent-tool/notify.test.mjs +0 -37
  275. package/src/standalone/agent-tool/spawn-flow.test.mjs +0 -63
  276. package/src/standalone/channel-restart.test.mjs +0 -145
  277. package/src/standalone/channel-session-router.test.mjs +0 -37
  278. package/src/standalone/channel-worker-heartbeat.test.mjs +0 -30
  279. package/src/standalone/hook-bus/handlers.test.mjs +0 -88
  280. package/src/standalone/plugin-admin.test.mjs +0 -173
  281. package/src/standalone/session-runtime-agent-control-client.test.mjs +0 -71
  282. package/src/standalone/session-runtime-dispatch-cancel.test.mjs +0 -139
  283. package/src/standalone/session-runtime-host-factory.test.mjs +0 -31
  284. package/src/standalone/session-runtime-host-health.test.mjs +0 -160
  285. package/src/standalone/session-runtime-inline-host.test.mjs +0 -83
  286. package/src/standalone/session-runtime-provider-cooldown.test.mjs +0 -80
  287. package/src/standalone/session-runtime-shard-host.test.mjs +0 -569
  288. package/src/standalone/session-runtime-shard-router.test.mjs +0 -101
  289. package/src/tui/app/live-spinner-visibility.test.mjs +0 -44
  290. package/src/tui/app/panel-epoch.test.mjs +0 -1009
  291. package/src/tui/app/panel-handoff.test.mjs +0 -311
  292. package/src/tui/app/prompt-submit.test.mjs +0 -206
  293. package/src/tui/session/completion-card-restore.test.mjs +0 -111
  294. package/src/tui/session/goal-continuation.test.mjs +0 -84
  295. package/src/tui/session/oauth-flows.test.mjs +0 -134
  296. package/src/tui/session/queue-helpers.test.mjs +0 -46
  297. package/src/tui/session/session-action-surface.test.mjs +0 -108
  298. package/src/tui/session/task-wait-submit.test.mjs +0 -80
  299. package/src/tui/session/tool-result-status.test.mjs +0 -131
  300. package/src/tui/session/tui-steering-persist.test.mjs +0 -104
@@ -1,24 +0,0 @@
1
- import assert from 'node:assert/strict';
2
- import { test } from 'node:test';
3
-
4
- import {
5
- _codexMaxContextWindow,
6
- _normalizeCodexModel,
7
- } from './openai-codex-model.mjs';
8
-
9
- test('validated GPT-5.6 Codex models expose a 272k default and 1M maximum', () => {
10
- for (const id of ['gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna']) {
11
- const model = _normalizeCodexModel({
12
- slug: id,
13
- context_window: 272_000,
14
- max_context_window: 272_000,
15
- });
16
- assert.equal(model.contextWindow, 272_000);
17
- assert.equal(model.maxContextWindow, 1_000_000);
18
- }
19
- });
20
-
21
- test('Codex maximum overrides preserve larger provider values and unrelated models', () => {
22
- assert.equal(_codexMaxContextWindow('gpt-5.6-sol', 1_050_000), 1_050_000);
23
- assert.equal(_codexMaxContextWindow('gpt-5.5', 272_000), 272_000);
24
- });
@@ -1,190 +0,0 @@
1
- import assert from 'node:assert/strict';
2
- import { test } from 'node:test';
3
-
4
- import {
5
- _computeDelta,
6
- _sansInput,
7
- _stableStringify,
8
- } from './openai-ws-delta.mjs';
9
- import { _applyReasoningReplayPolicy } from './openai-oauth-ws.mjs';
10
- import { _captureTurnStateFromEvent } from './openai-ws-stream.mjs';
11
- import { _convertMessagesToResponsesInputForTest } from './openai-responses-payload.mjs';
12
-
13
- // A turn may reason, speak, then reason again before calling a tool. Replaying
14
- // every retained item in front of the text invents an order the response never
15
- // produced, and the next request's incremental check fails on the message item.
16
- test('a turn that reasons, speaks, then reasons again replays in that order', () => {
17
- const beforeText = { id: 'rs-1', encrypted_content: 'e1', summary: [] };
18
- const afterText = { id: 'rs-2', encrypted_content: 'e2', summary: [], afterText: true };
19
- const input = _convertMessagesToResponsesInputForTest([
20
- { role: 'user', content: 'task' },
21
- {
22
- role: 'assistant',
23
- content: 'looking now',
24
- reasoningItems: [beforeText, afterText],
25
- toolCalls: [{ id: 'call-1', name: 'read', arguments: { path: 'a' } }],
26
- },
27
- { role: 'tool', toolCallId: 'call-1', content: 'contents' },
28
- ], { replayEncryptedReasoning: true });
29
-
30
- assert.deepEqual(input.map((item) => item.type ?? 'message'), [
31
- 'message',
32
- 'reasoning',
33
- 'message',
34
- 'reasoning',
35
- 'function_call',
36
- 'function_call_output',
37
- ]);
38
- assert.equal(input[1].id, 'rs-1');
39
- assert.equal(input[3].id, 'rs-2');
40
- // The ordering marker is bookkeeping, never a wire field.
41
- assert.equal(input[3].afterText, undefined);
42
- });
43
-
44
- // A live chain's sticky-routing token can never be swapped mid-session: the
45
- // entry holds it write-once, whichever path first supplied it.
46
- test('a live turn-state token is never replaced by a later event token', () => {
47
- const entry = {};
48
- _captureTurnStateFromEvent(entry, {
49
- type: 'response.created',
50
- headers: { 'x-codex-turn-state': 'handshake-token' },
51
- });
52
- _captureTurnStateFromEvent(entry, {
53
- type: 'response.created',
54
- headers: { 'x-codex-turn-state': 'later-token' },
55
- });
56
- assert.equal(entry.turnState, 'handshake-token');
57
- });
58
-
59
- // The logical request history always carries retained reasoning — a pooled
60
- // entry with a live chain included. Only the duplicate-rejection retry drops it.
61
- test('reasoning stays in the logical history on every send', () => {
62
- const reasoning = {
63
- type: 'reasoning',
64
- id: 'rs-1',
65
- encrypted_content: 'encrypted',
66
- summary: [],
67
- };
68
- const toolOutput = { type: 'function_call_output', call_id: 'call-1', output: 'ok' };
69
- const body = { input: [reasoning, toolOutput] };
70
- const entry = { lastResponseId: 'resp-1', lastRequestInput: [] };
71
-
72
- const retained = _applyReasoningReplayPolicy(entry, body);
73
- assert.equal(retained, body);
74
- assert.equal(retained.input[0], reasoning);
75
- assert.equal(entry.replayReasoning, true);
76
-
77
- const suppressed = _applyReasoningReplayPolicy(entry, body, { suppress: true });
78
- assert.equal(entry.replayReasoning, false);
79
- assert.deepEqual(suppressed.input, [toolOutput]);
80
- });
81
-
82
- test('Codex delta parity falls back when a previous response item is absent', (t) => {
83
- const priorTransport = process.env.MIXDOG_OAI_TRANSPORT;
84
- process.env.MIXDOG_OAI_TRANSPORT = 'ws-delta';
85
- t.after(() => {
86
- if (priorTransport == null) delete process.env.MIXDOG_OAI_TRANSPORT;
87
- else process.env.MIXDOG_OAI_TRANSPORT = priorTransport;
88
- });
89
-
90
- const previousInput = [{
91
- type: 'message',
92
- role: 'user',
93
- content: [{ type: 'input_text', text: 'task' }],
94
- }];
95
- const previousCall = {
96
- type: 'function_call',
97
- call_id: 'call-1',
98
- name: 'read',
99
- arguments: '{"path":"/app/input.txt"}',
100
- };
101
- const body = {
102
- model: 'gpt-5.6-sol',
103
- input: [
104
- ...previousInput,
105
- // The reasoning item from the previous response is missing here.
106
- previousCall,
107
- {
108
- type: 'function_call_output',
109
- call_id: 'call-1',
110
- output: 'fixture',
111
- },
112
- ],
113
- };
114
- const entry = {
115
- lastRequestSansInput: _stableStringify(_sansInput({
116
- model: body.model,
117
- input: previousInput,
118
- })),
119
- lastRequestInput: previousInput,
120
- lastResponseId: 'resp-1',
121
- lastResponseItems: [
122
- {
123
- type: 'reasoning',
124
- id: 'rs-1',
125
- encrypted_content: 'encrypted',
126
- },
127
- previousCall,
128
- ],
129
- turnState: 'sticky',
130
- };
131
-
132
- const delta = _computeDelta({ entry, body, traceProvider: 'openai-oauth' });
133
- assert.equal(delta.mode, 'full');
134
- assert.equal(delta.reason, 'response_output_mismatch:reasoning');
135
- assert.equal(delta.frame.previous_response_id, undefined);
136
- assert.deepEqual(delta.frame.input, body.input);
137
- });
138
-
139
- // Retained reasoning rides the logical history, and the delta builder is what
140
- // keeps it off the wire: it belongs to the anchored previous response, so the
141
- // frame carries only what is genuinely new. This is the whole reason the
142
- // history keeps the item instead of dropping it before the delta runs.
143
- test('the delta frame drops the anchored reasoning item from the wire tail', (t) => {
144
- const priorTransport = process.env.MIXDOG_OAI_TRANSPORT;
145
- process.env.MIXDOG_OAI_TRANSPORT = 'ws-delta';
146
- t.after(() => {
147
- if (priorTransport == null) delete process.env.MIXDOG_OAI_TRANSPORT;
148
- else process.env.MIXDOG_OAI_TRANSPORT = priorTransport;
149
- });
150
-
151
- const previousInput = [{
152
- type: 'message',
153
- role: 'user',
154
- content: [{ type: 'input_text', text: 'task' }],
155
- }];
156
- const reasoning = { type: 'reasoning', id: 'rs-1', encrypted_content: 'encrypted' };
157
- const previousCall = {
158
- type: 'function_call',
159
- call_id: 'call-1',
160
- name: 'read',
161
- arguments: '{"path":"/app/input.txt"}',
162
- };
163
- const toolOutput = {
164
- type: 'function_call_output',
165
- call_id: 'call-1',
166
- output: 'fixture',
167
- };
168
- const body = {
169
- model: 'gpt-5.6-sol',
170
- input: [...previousInput, reasoning, previousCall, toolOutput],
171
- };
172
- const entry = {
173
- lastRequestSansInput: _stableStringify(_sansInput({
174
- model: body.model,
175
- input: previousInput,
176
- })),
177
- lastRequestInput: previousInput,
178
- lastResponseId: 'resp-1',
179
- lastResponseItems: [reasoning, previousCall],
180
- replayReasoning: true,
181
- turnState: 'sticky',
182
- };
183
-
184
- const delta = _computeDelta({ entry, body, traceProvider: 'openai-oauth' });
185
- assert.equal(delta.mode, 'delta');
186
- assert.equal(delta.reason, null);
187
- assert.equal(delta.frame.previous_response_id, 'resp-1');
188
- assert.deepEqual(delta.frame.input, [toolOutput]);
189
- assert.equal(delta.strippedResponseItems, 2);
190
- });
@@ -1,235 +0,0 @@
1
- import assert from 'node:assert/strict';
2
- import { test } from 'node:test';
3
-
4
- import {
5
- createProviderReplay,
6
- providerReplayItems,
7
- } from './lib/provider-replay.mjs';
8
- import { toAnthropicMessages } from './lib/anthropic-request-utils.mjs';
9
- import { parseSSEStream as parseAnthropicSSEStream } from './anthropic-sse.mjs';
10
- import { toGeminiContents } from './gemini-schema.mjs';
11
- import { convertMessagesToResponsesInput } from './openai-responses-payload.mjs';
12
- import { toOpenAIMessages, toXaiResponsesInput } from './openai-compat-wire.mjs';
13
- import { estimateMessagesTokens } from '../session/context-utils.mjs';
14
- import { _sessionForDisk } from '../session/store/serialize.mjs';
15
-
16
- function interleavedAnthropicBlocks() {
17
- const blocks = [{ type: 'thinking', thinking: '', signature: 'sig-a' }];
18
- for (let index = 1; index <= 10; index += 1) {
19
- blocks.push({
20
- type: 'tool_use',
21
- id: `toolu_${index}`,
22
- name: 'read',
23
- input: { index },
24
- });
25
- }
26
- blocks.push({ type: 'thinking', thinking: '', signature: 'sig-b' });
27
- blocks.push({
28
- type: 'tool_use',
29
- id: 'toolu_11',
30
- name: 'read',
31
- input: { index: 11 },
32
- });
33
- return blocks;
34
- }
35
-
36
- function interleavedResponsesItems() {
37
- const items = [{
38
- type: 'reasoning',
39
- id: 'rs_1',
40
- encrypted_content: 'cipher-a',
41
- summary: [],
42
- }];
43
- for (let index = 1; index <= 10; index += 1) {
44
- items.push({
45
- type: 'function_call',
46
- call_id: `call_${index}`,
47
- name: 'read',
48
- arguments: JSON.stringify({ index }),
49
- });
50
- }
51
- items.push({
52
- type: 'reasoning',
53
- id: 'rs_2',
54
- encrypted_content: 'cipher-b',
55
- summary: [],
56
- });
57
- items.push({
58
- type: 'function_call',
59
- call_id: 'call_11',
60
- name: 'read',
61
- arguments: '{"index":11}',
62
- });
63
- return items;
64
- }
65
-
66
- function anthropicSseResponse(events) {
67
- const body = events
68
- .map((event) => `event: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`)
69
- .join('');
70
- return new Response(body, { headers: { 'content-type': 'text/event-stream' } });
71
- }
72
-
73
- test('provider replay is detached and scoped to its originating provider', () => {
74
- const source = [{ type: 'thinking', thinking: 'plan', signature: 'sig' }];
75
- const replay = createProviderReplay('anthropic', source);
76
- source[0].signature = 'mutated';
77
-
78
- assert.equal(replay.items[0].signature, 'sig');
79
- assert.deepEqual(providerReplayItems({ providerReplay: replay }, 'anthropic'), replay.items);
80
- assert.equal(providerReplayItems({ providerReplay: replay }, 'gemini'), undefined);
81
- });
82
-
83
- test('Anthropic keeps interleaved thinking at content[11]', () => {
84
- const blocks = interleavedAnthropicBlocks();
85
- const message = {
86
- role: 'assistant',
87
- content: '',
88
- toolCalls: blocks
89
- .filter((block) => block.type === 'tool_use')
90
- .map((block) => ({
91
- id: block.id,
92
- name: block.name,
93
- arguments: block.input,
94
- })),
95
- providerReplay: createProviderReplay('anthropic', blocks),
96
- };
97
- const lowered = toAnthropicMessages([message]);
98
-
99
- assert.deepEqual(lowered[0].content, blocks);
100
- assert.equal(lowered[0].content[11].type, 'thinking');
101
- assert.equal(lowered[0].content[11].signature, 'sig-b');
102
- });
103
-
104
- test('Anthropic SSE parse to next-request replay keeps content[11] unchanged', async () => {
105
- const events = [
106
- { type: 'message_start', message: { model: 'claude-test', usage: { input_tokens: 1 } } },
107
- { type: 'content_block_start', index: 0, content_block: { type: 'thinking', thinking: '' } },
108
- { type: 'content_block_delta', index: 0, delta: { type: 'signature_delta', signature: 'sig-a' } },
109
- { type: 'content_block_stop', index: 0 },
110
- ];
111
- for (let index = 1; index <= 10; index += 1) {
112
- events.push(
113
- {
114
- type: 'content_block_start',
115
- index,
116
- content_block: { type: 'tool_use', id: `toolu_${index}`, name: 'read' },
117
- },
118
- {
119
- type: 'content_block_delta',
120
- index,
121
- delta: { type: 'input_json_delta', partial_json: JSON.stringify({ index }) },
122
- },
123
- { type: 'content_block_stop', index },
124
- );
125
- }
126
- events.push(
127
- { type: 'content_block_start', index: 11, content_block: { type: 'thinking', thinking: '' } },
128
- { type: 'content_block_delta', index: 11, delta: { type: 'signature_delta', signature: 'sig-b' } },
129
- { type: 'content_block_stop', index: 11 },
130
- {
131
- type: 'content_block_start',
132
- index: 12,
133
- content_block: { type: 'tool_use', id: 'toolu_11', name: 'read' },
134
- },
135
- {
136
- type: 'content_block_delta',
137
- index: 12,
138
- delta: { type: 'input_json_delta', partial_json: '{"index":11}' },
139
- },
140
- { type: 'content_block_stop', index: 12 },
141
- { type: 'message_delta', delta: { stop_reason: 'tool_use' }, usage: { output_tokens: 1 } },
142
- { type: 'message_stop' },
143
- );
144
- const parsed = await parseAnthropicSSEStream(
145
- anthropicSseResponse(events),
146
- null,
147
- () => {},
148
- () => {},
149
- () => {},
150
- {},
151
- null,
152
- new Set(['read']),
153
- );
154
- const lowered = toAnthropicMessages([{
155
- role: 'assistant',
156
- content: parsed.content || '',
157
- toolCalls: parsed.toolCalls,
158
- providerReplay: parsed.providerReplay,
159
- }]);
160
-
161
- assert.equal(parsed.providerReplay.items[11].type, 'thinking');
162
- assert.deepEqual(lowered[0].content, parsed.providerReplay.items);
163
- });
164
-
165
- test('Gemini keeps signed thought Parts interleaved with function calls', () => {
166
- const parts = [{ text: 'plan-a', thought: true, thoughtSignature: 'sig-a' }];
167
- for (let index = 1; index <= 10; index += 1) {
168
- parts.push({ functionCall: { id: `call_${index}`, name: 'read', args: { index } } });
169
- }
170
- parts.push({ text: 'plan-b', thought: true, thoughtSignature: 'sig-b' });
171
- parts.push({ functionCall: { id: 'call_11', name: 'read', args: { index: 11 } } });
172
- const contents = toGeminiContents([{
173
- role: 'assistant',
174
- content: '',
175
- toolCalls: [],
176
- providerReplay: createProviderReplay('gemini', parts),
177
- }], 'gemini-3-pro');
178
-
179
- assert.deepEqual(contents[0].parts, parts);
180
- assert.equal(contents[0].parts[11].thoughtSignature, 'sig-b');
181
- });
182
-
183
- test('OpenAI Responses recovery keeps reasoning between function calls', () => {
184
- const items = interleavedResponsesItems();
185
- const input = convertMessagesToResponsesInput([{
186
- role: 'assistant',
187
- content: '',
188
- toolCalls: [],
189
- providerReplay: createProviderReplay('openai-responses', items),
190
- }], { replayEncryptedReasoning: true });
191
-
192
- assert.deepEqual(input, items);
193
- assert.equal(input[11].type, 'reasoning');
194
- assert.equal(input[11].id, 'rs_2');
195
- });
196
-
197
- test('xAI stateless recovery keeps encrypted reasoning output order', () => {
198
- const items = interleavedResponsesItems();
199
- const result = toXaiResponsesInput([{
200
- role: 'assistant',
201
- content: '',
202
- toolCalls: [],
203
- providerReplay: createProviderReplay('xai-responses', items),
204
- }], null);
205
-
206
- assert.deepEqual(result.input, items);
207
- assert.equal(result.input[11].type, 'reasoning');
208
- });
209
-
210
- test('OpenRouter reasoning_details remains an unmodified assistant field', () => {
211
- const reasoningDetails = [
212
- { type: 'reasoning.text', text: 'plan', signature: 'opaque' },
213
- { type: 'reasoning.encrypted', data: 'ciphertext' },
214
- ];
215
- const wire = toOpenAIMessages([{
216
- role: 'assistant',
217
- content: '',
218
- toolCalls: [{ id: 'call_1', name: 'read', arguments: { path: 'a' } }],
219
- providerMetadata: { openrouter: { reasoning_details: reasoningDetails } },
220
- }], 'openrouter');
221
-
222
- assert.equal(wire[0].reasoning_details, reasoningDetails);
223
- });
224
-
225
- test('provider replay survives disk projection and contributes to context size', () => {
226
- const providerReplay = createProviderReplay('openai-responses', interleavedResponsesItems());
227
- const message = { role: 'assistant', content: '', providerReplay };
228
- const stored = _sessionForDisk({ id: 's', messages: [message] });
229
-
230
- assert.deepEqual(stored.messages[0].providerReplay, providerReplay);
231
- assert.ok(
232
- estimateMessagesTokens([message])
233
- > estimateMessagesTokens([{ role: 'assistant', content: '' }]),
234
- );
235
- });