mixdog 1.4.3 → 1.4.5

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 (281) hide show
  1. package/package.json +1 -2
  2. package/src/cli.mjs +5 -1
  3. package/src/defaults/shipped-history.json +30 -2
  4. package/src/defaults/skills/browser-use/SKILL.md +148 -273
  5. package/src/defaults/skills/browser-use/references/devtools.md +14 -0
  6. package/src/defaults/skills/browser-use/references/page-flows.md +66 -0
  7. package/src/defaults/skills/browser-use/references/sign-in.md +70 -0
  8. package/src/defaults/skills/code-tidy/SKILL.md +60 -84
  9. package/src/defaults/skills/code-tidy/references/agent-cleanup.md +27 -2
  10. package/src/defaults/skills/computer-use/SKILL.md +145 -229
  11. package/src/defaults/skills/computer-use/references/flows.md +35 -0
  12. package/src/defaults/skills/computer-use/references/operations.md +22 -0
  13. package/src/defaults/skills/computer-use/references/platforms.md +12 -0
  14. package/src/defaults/skills/docx/SKILL.md +23 -31
  15. package/src/defaults/skills/docx/references/native-authoring.md +26 -3
  16. package/src/defaults/skills/docx/references/redlining.md +15 -0
  17. package/src/defaults/skills/image/SKILL.md +37 -77
  18. package/src/defaults/skills/image/references/prompt-forms.md +51 -0
  19. package/src/defaults/skills/image/references/text.md +6 -0
  20. package/src/defaults/skills/local-provider/SKILL.md +75 -105
  21. package/src/defaults/skills/local-provider/references/lifecycle.md +14 -0
  22. package/src/defaults/skills/local-provider/references/maintenance.md +19 -0
  23. package/src/defaults/skills/local-provider/references/recovery.md +30 -0
  24. package/src/defaults/skills/memory-management/SKILL.md +22 -21
  25. package/src/defaults/skills/pdf/SKILL.md +21 -23
  26. package/src/defaults/skills/pdf/references/blocks.md +20 -0
  27. package/src/defaults/skills/pdf/references/forms.md +12 -0
  28. package/src/defaults/skills/pdf/references/html.md +2 -2
  29. package/src/defaults/skills/pdf/references/ocr.md +7 -0
  30. package/src/defaults/skills/pdf/references/security.md +8 -0
  31. package/src/defaults/skills/pptx/SKILL.md +30 -109
  32. package/src/defaults/skills/pptx/references/audit.md +45 -0
  33. package/src/defaults/skills/pptx/references/brief-critique.md +47 -0
  34. package/src/defaults/skills/pptx/references/editing.md +24 -0
  35. package/src/defaults/skills/pptx/references/html.md +1 -1
  36. package/src/defaults/skills/pptx/references/script.md +33 -0
  37. package/src/defaults/skills/setup/SKILL.md +34 -102
  38. package/src/defaults/skills/setup/references/actions.md +73 -14
  39. package/src/defaults/skills/setup/references/surfaces.md +23 -8
  40. package/src/defaults/skills/setup-guide/SKILL.md +28 -115
  41. package/src/defaults/skills/setup-guide/references/features.md +36 -0
  42. package/src/defaults/skills/setup-guide/references/glossary.md +38 -0
  43. package/src/defaults/skills/setup-guide/references/workflow-models.md +62 -0
  44. package/src/defaults/skills/test-suite/SKILL.md +15 -127
  45. package/src/defaults/skills/test-suite/references/case-management.md +17 -9
  46. package/src/defaults/skills/test-suite/references/diagnose.md +23 -0
  47. package/src/defaults/skills/test-suite/references/prune.md +27 -0
  48. package/src/defaults/skills/test-suite/references/write.md +44 -0
  49. package/src/defaults/skills/video/SKILL.md +28 -42
  50. package/src/defaults/skills/video/references/prompting.md +31 -0
  51. package/src/defaults/skills/visualize/SKILL.md +73 -107
  52. package/src/defaults/skills/visualize/references/craft.md +1 -2
  53. package/src/defaults/skills/visualize/references/feedback.md +36 -0
  54. package/src/defaults/skills/visualize/references/showing.md +13 -0
  55. package/src/defaults/skills/xlsx/SKILL.md +23 -50
  56. package/src/defaults/skills/xlsx/references/editing.md +15 -0
  57. package/src/defaults/skills/xlsx/references/model-conventions.md +1 -1
  58. package/src/defaults/skills/xlsx/references/recalculation.md +37 -0
  59. package/src/defaults/skills/xlsx/references/report-design.md +18 -2
  60. package/src/lib/keychain-cjs.cjs +22 -1
  61. package/src/lib/rules-builder.cjs +1 -1
  62. package/src/rules/agent/AGENT.md +3 -0
  63. package/src/rules/agent-mode/MIXY.md +5 -3
  64. package/src/rules/lead/LEAD.md +3 -1
  65. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +8 -30
  66. package/src/runtime/agent/orchestrator/agent-runtime/title-completion.mjs +5 -0
  67. package/src/runtime/agent/orchestrator/mcp/oauth-request.mjs +21 -2
  68. package/src/runtime/agent/orchestrator/providers/account-pool.mjs +3 -0
  69. package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +4 -3
  70. package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +11 -1
  71. package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +2 -0
  72. package/src/runtime/agent/orchestrator/providers/anthropic-message-threads.mjs +583 -0
  73. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
  74. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +81 -19
  75. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-start.mjs +4 -0
  76. package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-outcome.mjs +2 -0
  77. package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +180 -13
  78. package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -0
  79. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +58 -6
  80. package/src/runtime/agent/orchestrator/providers/cursor-wire.mjs +4 -2
  81. package/src/runtime/agent/orchestrator/providers/custom-provider-config.mjs +121 -9
  82. package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +4 -1
  83. package/src/runtime/agent/orchestrator/providers/gemini-error-contract.mjs +6 -6
  84. package/src/runtime/agent/orchestrator/providers/gemini-model-redirect.mjs +44 -0
  85. package/src/runtime/agent/orchestrator/providers/gemini-reasoning-relay.mjs +5 -0
  86. package/src/runtime/agent/orchestrator/providers/gemini-request-body.mjs +34 -5
  87. package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +10 -0
  88. package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +11 -6
  89. package/src/runtime/agent/orchestrator/providers/gemini-sdk-request.mjs +4 -100
  90. package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +3 -227
  91. package/src/runtime/agent/orchestrator/providers/gemini.mjs +226 -118
  92. package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +11 -1
  93. package/src/runtime/agent/orchestrator/providers/lib/claude-bridge-schema.mjs +15 -3
  94. package/src/runtime/agent/orchestrator/providers/lib/gemini-model-catalog.mjs +2 -1
  95. package/src/runtime/agent/orchestrator/providers/lib/generation-window.mjs +9 -0
  96. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +9 -1
  97. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-result.mjs +2 -0
  98. package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +5 -0
  99. package/src/runtime/agent/orchestrator/providers/openai-compat-options.mjs +3 -0
  100. package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +2 -0
  101. package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +10 -1
  102. package/src/runtime/agent/orchestrator/providers/openai-direct-request.mjs +5 -28
  103. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +3 -0
  104. package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +2 -0
  105. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +50 -28
  106. package/src/runtime/agent/orchestrator/providers/openai-ws-response-state.mjs +9 -2
  107. package/src/runtime/agent/orchestrator/providers/openai-ws-stream/socket-handlers.mjs +14 -10
  108. package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +1 -3
  109. package/src/runtime/agent/orchestrator/providers/openrouter-provider-routing.mjs +28 -0
  110. package/src/runtime/agent/orchestrator/providers/openrouter.mjs +4 -1
  111. package/src/runtime/agent/orchestrator/providers/registry.mjs +30 -25
  112. package/src/runtime/agent/orchestrator/providers/stream-json-pool/worker-slots/slot-spawn.mjs +8 -3
  113. package/src/runtime/agent/orchestrator/providers/vertex-ai-maas.mjs +2 -2
  114. package/src/runtime/agent/orchestrator/runtime-core/ask-user-result.mjs +66 -0
  115. package/src/runtime/agent/orchestrator/runtime-core/config-helpers.mjs +4 -5
  116. package/src/runtime/agent/orchestrator/runtime-core/goal-tool-defs.mjs +2 -2
  117. package/src/runtime/agent/orchestrator/runtime-core/provider-request-tools.mjs +15 -8
  118. package/src/runtime/agent/orchestrator/runtime-core/session-title.mjs +1 -0
  119. package/src/runtime/agent/orchestrator/runtime-core/todo-list.mjs +9 -32
  120. package/src/runtime/agent/orchestrator/runtime-core/todo-tool-defs.mjs +4 -5
  121. package/src/runtime/agent/orchestrator/session/compact/summary-route.mjs +1 -3
  122. package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +5 -2
  123. package/src/runtime/agent/orchestrator/session/loop/no-tool-turn/todo-check.mjs +2 -17
  124. package/src/runtime/agent/orchestrator/session/loop/usage.mjs +7 -3
  125. package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +9 -2
  126. package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +8 -1
  127. package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +26 -13
  128. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +4 -5
  129. package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +16 -5
  130. package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +22 -1
  131. package/src/runtime/agent/orchestrator/session/store/live-state.mjs +4 -0
  132. package/src/runtime/agent/orchestrator/session/store.mjs +12 -6
  133. package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +11 -9
  134. package/src/runtime/agent/orchestrator/tools/builtin/grep-formatting.mjs +2 -8
  135. package/src/runtime/agent/orchestrator/tools/builtin/lib/search-input-helpers.mjs +1 -9
  136. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-output-silence.mjs +64 -0
  137. package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +20 -6
  138. package/src/runtime/agent/orchestrator/tools/builtin/local-search-telemetry.mjs +2 -2
  139. package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +1 -1
  140. package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.mjs +12 -3
  141. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +12 -1
  142. package/src/runtime/agent/orchestrator/tools/code-graph/ast-calls.mjs +9 -2
  143. package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +137 -7
  144. package/src/runtime/agent/orchestrator/tools/code-graph/calls-cache.mjs +43 -14
  145. package/src/runtime/agent/orchestrator/tools/code-graph/calls-sidecar-worker.mjs +33 -0
  146. package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +146 -11
  147. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +31 -24
  148. package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary/spawn-jsonl.mjs +172 -25
  149. package/src/runtime/agent/orchestrator/tools/code-graph/graph-model.mjs +100 -2
  150. package/src/runtime/agent/orchestrator/tools/code-graph/main-thread-slice.mjs +18 -0
  151. package/src/runtime/agent/orchestrator/tools/code-graph/mask-pool.mjs +219 -0
  152. package/src/runtime/agent/orchestrator/tools/code-graph/mask-worker.mjs +12 -0
  153. package/src/runtime/agent/orchestrator/tools/code-graph/memory-cache.mjs +6 -1
  154. package/src/runtime/agent/orchestrator/tools/code-graph/modes/calls.mjs +9 -2
  155. package/src/runtime/agent/orchestrator/tools/code-graph/modes/dependents.mjs +5 -1
  156. package/src/runtime/agent/orchestrator/tools/code-graph/modes/structure.mjs +8 -2
  157. package/src/runtime/agent/orchestrator/tools/code-graph/modes/symbols.mjs +14 -11
  158. package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +41 -18
  159. package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +391 -83
  160. package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +109 -9
  161. package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +73 -29
  162. package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +6 -5
  163. package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.mjs +7 -3
  164. package/src/runtime/channels/lib/crash-log.mjs +21 -1
  165. package/src/runtime/channels/lib/routines-db.mjs +35 -0
  166. package/src/runtime/channels/lib/schedules-db.mjs +4 -0
  167. package/src/runtime/channels/lib/webhooks-db.mjs +4 -0
  168. package/src/runtime/channels/lib/worker-main.mjs +8 -25
  169. package/src/runtime/computer-bridge/action-schema.mjs +2 -2
  170. package/src/runtime/computer-bridge/core-actions.mjs +16 -2
  171. package/src/runtime/computer-bridge/result-canonical.mjs +6 -0
  172. package/src/runtime/media/jobs.mjs +5 -0
  173. package/src/runtime/media/store.mjs +146 -3
  174. package/src/runtime/memory/tool-defs.mjs +1 -1
  175. package/src/runtime/office/core/office-write-ledger.mjs +2 -2
  176. package/src/runtime/shared/agent-reap-state.mjs +19 -0
  177. package/src/runtime/shared/desktop-notice-host.d.mts +13 -0
  178. package/src/runtime/shared/desktop-notice-host.mjs +87 -0
  179. package/src/runtime/shared/file-lock.mjs +2 -2
  180. package/src/runtime/shared/heap-cap.mjs +9 -11
  181. package/src/runtime/shared/llm/http-agent.mjs +11 -1
  182. package/src/runtime/shared/llm/system-proxy.mjs +100 -25
  183. package/src/runtime/shared/llm/usage-accounting.mjs +121 -19
  184. package/src/runtime/shared/llm/usage-context.mjs +3 -3
  185. package/src/runtime/shared/llm/usage-ledger-quota.mjs +2 -0
  186. package/src/runtime/shared/llm/usage-ledger-requests.mjs +190 -0
  187. package/src/runtime/shared/llm/usage-ledger-rollup.mjs +7 -3
  188. package/src/runtime/shared/llm/usage-ledger-worker.mjs +2 -0
  189. package/src/runtime/shared/llm/usage-ledger.mjs +69 -1
  190. package/src/runtime/shared/llm/usage-request-status.mjs +48 -0
  191. package/src/runtime/shared/provider-accounts.mjs +22 -0
  192. package/src/runtime/shared/provider-auth-binding.mjs +2 -2
  193. package/src/runtime/shared/resource-admission.mjs +2 -2
  194. package/src/runtime/shared/root-async-context.mjs +51 -0
  195. package/src/runtime/shared/run-child.mjs +18 -1
  196. package/src/runtime/shared/slow-span.mjs +2 -2
  197. package/src/runtime/shared/tool-execution-owner.mjs +2 -2
  198. package/src/runtime/shared/tool-result-summary.mjs +1 -1
  199. package/src/runtime/shared/tool-work-units.mjs +2 -0
  200. package/src/runtime/shared/turn-snapshot-store.mjs +75 -18
  201. package/src/runtime/shared/turn-worktree-snapshot.mjs +38 -8
  202. package/src/runtime/shared/user-cwd.mjs +2 -2
  203. package/src/runtime/shared/worker-requests.mjs +3 -1
  204. package/src/runtime/shared/worktrees/lock.mjs +2 -2
  205. package/src/runtime/visualize-bridge/client.mjs +26 -4
  206. package/src/runtime/visualize-bridge/tool-defs.mjs +46 -5
  207. package/src/session-runtime/agent-home-delivery.mjs +76 -8
  208. package/src/session-runtime/agent-task-sessions.mjs +63 -22
  209. package/src/session-runtime/boot/apis.mjs +16 -0
  210. package/src/session-runtime/boot/begin.mjs +2 -0
  211. package/src/session-runtime/boot/tools.mjs +8 -2
  212. package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +3 -58
  213. package/src/session-runtime/media-api.mjs +15 -0
  214. package/src/session-runtime/model-route/route-persist.mjs +12 -4
  215. package/src/session-runtime/provider-models/row-hydration.mjs +2 -0
  216. package/src/session-runtime/provider-readiness.mjs +10 -2
  217. package/src/session-runtime/routine-owner.mjs +9 -3
  218. package/src/session-runtime/runtime-core.mjs +35 -8
  219. package/src/session-runtime/runtime-review-api.mjs +3 -1
  220. package/src/session-runtime/services/agent-task-status.mjs +29 -1
  221. package/src/session-runtime/services/agent-tool/close-flow.mjs +6 -1
  222. package/src/session-runtime/services/agent-tool/execute-resume.mjs +94 -0
  223. package/src/session-runtime/services/agent-tool/execute-send.mjs +77 -27
  224. package/src/session-runtime/services/agent-tool/execute-spawn.mjs +28 -7
  225. package/src/session-runtime/services/agent-tool/execute.mjs +6 -1
  226. package/src/session-runtime/services/agent-tool/helpers.mjs +11 -0
  227. package/src/session-runtime/services/agent-tool/job-views/job-render.mjs +13 -10
  228. package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +3 -0
  229. package/src/session-runtime/services/agent-tool/render.mjs +8 -1
  230. package/src/session-runtime/services/agent-tool/send-flow.mjs +1 -0
  231. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-prep.mjs +6 -0
  232. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +2 -1
  233. package/src/session-runtime/services/agent-tool/tag-registry/reaped-sessions.mjs +82 -0
  234. package/src/session-runtime/services/agent-tool/tag-registry/record-facts-worker.mjs +36 -0
  235. package/src/session-runtime/services/agent-tool/tag-registry.mjs +4 -0
  236. package/src/session-runtime/services/agent-tool/terminal-reaper/row-helpers.mjs +29 -0
  237. package/src/session-runtime/services/agent-tool/terminal-reaper/scan-admission.mjs +11 -3
  238. package/src/session-runtime/services/agent-tool/terminal-reaper/stale-rows.mjs +19 -8
  239. package/src/session-runtime/services/agent-tool/terminal-reaper.mjs +5 -2
  240. package/src/session-runtime/services/agent-tool/worker-index.mjs +1 -0
  241. package/src/session-runtime/services/channel-admin.mjs +44 -3
  242. package/src/session-runtime/services/daemon-crash-capture/daemon-exit-record.mjs +2 -2
  243. package/src/session-runtime/services/plugin-admin.mjs +46 -7
  244. package/src/session-runtime/services/provider-admin.mjs +5 -0
  245. package/src/session-runtime/session-create.mjs +5 -0
  246. package/src/session-runtime/setup-tool/agent-settings-actions.mjs +1 -1
  247. package/src/session-runtime/setup-tool/executor.mjs +1 -1
  248. package/src/session-runtime/setup-tool/extended-actions.mjs +1 -1
  249. package/src/session-runtime/setup-tool/settings-contract.mjs +4 -2
  250. package/src/session-runtime/usage-stats-api.mjs +120 -1
  251. package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +36 -29
  252. package/src/session-runtime/workflow-agents-api/agent-editor.mjs +183 -23
  253. package/src/session-runtime/workspace/admission-gate.mjs +25 -7
  254. package/src/session-runtime/workspace/transitions.mjs +4 -0
  255. package/src/standalone/daemon-log.mjs +28 -4
  256. package/src/standalone/daemon-owner.mjs +41 -7
  257. package/src/standalone/daemon-work-gate.mjs +139 -0
  258. package/src/standalone/daemon.mjs +80 -11
  259. package/src/standalone/desktop-service-registry.mjs +11 -4
  260. package/src/standalone/session-client.mjs +57 -5
  261. package/src/standalone/session-protocol.mjs +6 -0
  262. package/src/standalone/session-service/agent-tree/agent-cancel.mjs +17 -1
  263. package/src/standalone/session-service/agent-tree.mjs +7 -0
  264. package/src/standalone/session-service/retention/busy.mjs +3 -2
  265. package/src/standalone/session-service/session-calls/session-turns.mjs +12 -5
  266. package/src/standalone/session-transport/call-route.mjs +10 -4
  267. package/src/standalone/session-transport/routes.mjs +21 -0
  268. package/src/standalone/session-transport/stack.mjs +3 -1
  269. package/src/standalone/session-transport.mjs +5 -0
  270. package/src/tui/app/model-picker/model-footer.mjs +1 -1
  271. package/src/tui/app/model-picker/provider-models-list.mjs +7 -3
  272. package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +23 -3
  273. package/src/tui/app/model-picker/route-selection.mjs +1 -0
  274. package/src/tui/dist/index.mjs +536 -484
  275. package/src/tui/session/session-api/integrations.mjs +3 -0
  276. package/src/tui/session/session-api/media.mjs +5 -0
  277. package/src/tui/session/tool-approval-settle.mjs +24 -4
  278. package/src/tui/session/tool-approval.mjs +35 -10
  279. package/src/tui/session/turn.mjs +13 -0
  280. package/src/runtime/agent/orchestrator/providers/gemini-sdk-stream/cancellation.mjs +0 -71
  281. package/src/runtime/agent/orchestrator/providers/gemini-sdk-stream/reader.mjs +0 -108
@@ -2709,8 +2709,8 @@ var require_react_reconciler_production = __commonJS({
2709
2709
  function findFirstSuspended(row) {
2710
2710
  for (var node = row; null !== node; ) {
2711
2711
  if (13 === node.tag) {
2712
- var state = node.memoizedState;
2713
- if (null !== state && (state = state.dehydrated, null === state || isSuspenseInstancePending(state) || isSuspenseInstanceFallback(state)))
2712
+ var state2 = node.memoizedState;
2713
+ if (null !== state2 && (state2 = state2.dehydrated, null === state2 || isSuspenseInstancePending(state2) || isSuspenseInstanceFallback(state2)))
2714
2714
  return node;
2715
2715
  } else if (19 === node.tag && ("forwards" === node.memoizedProps.revealOrder || "backwards" === node.memoizedProps.revealOrder || "unstable_legacy-backwards" === node.memoizedProps.revealOrder || "together" === node.memoizedProps.revealOrder)) {
2716
2716
  if (0 !== (node.flags & 128)) return node;
@@ -2900,8 +2900,8 @@ var require_react_reconciler_production = __commonJS({
2900
2900
  memoCache.index++;
2901
2901
  return updateQueue;
2902
2902
  }
2903
- function basicStateReducer(state, action) {
2904
- return "function" === typeof action ? action(state) : action;
2903
+ function basicStateReducer(state2, action) {
2904
+ return "function" === typeof action ? action(state2) : action;
2905
2905
  }
2906
2906
  function updateReducer(reducer) {
2907
2907
  var hook = updateWorkInProgressHook();
@@ -3255,12 +3255,12 @@ var require_react_reconciler_production = __commonJS({
3255
3255
  stateHook = updateReducer(basicStateReducer)[0];
3256
3256
  if ("object" === typeof currentStateHook && null !== currentStateHook && "function" === typeof currentStateHook.then)
3257
3257
  try {
3258
- var state = useThenable(currentStateHook);
3258
+ var state2 = useThenable(currentStateHook);
3259
3259
  } catch (x) {
3260
3260
  if (x === SuspenseException) throw SuspenseActionException;
3261
3261
  throw x;
3262
3262
  }
3263
- else state = currentStateHook;
3263
+ else state2 = currentStateHook;
3264
3264
  currentStateHook = updateWorkInProgressHook();
3265
3265
  var actionQueue = currentStateHook.queue, dispatch = actionQueue.dispatch;
3266
3266
  action !== currentStateHook.memoizedState && (currentlyRenderingFiber.flags |= 2048, pushSimpleEffect(
@@ -3269,7 +3269,7 @@ var require_react_reconciler_production = __commonJS({
3269
3269
  actionStateActionEffect.bind(null, actionQueue, action),
3270
3270
  null
3271
3271
  ));
3272
- return [state, dispatch, stateHook];
3272
+ return [state2, dispatch, stateHook];
3273
3273
  }
3274
3274
  function actionStateActionEffect(actionQueue, action) {
3275
3275
  actionQueue.action = action;
@@ -12684,8 +12684,8 @@ var require_react_reconciler_development = __commonJS({
12684
12684
  function findFirstSuspended(row) {
12685
12685
  for (var node = row; null !== node; ) {
12686
12686
  if (13 === node.tag) {
12687
- var state = node.memoizedState;
12688
- if (null !== state && (state = state.dehydrated, null === state || isSuspenseInstancePending(state) || isSuspenseInstanceFallback(state)))
12687
+ var state2 = node.memoizedState;
12688
+ if (null !== state2 && (state2 = state2.dehydrated, null === state2 || isSuspenseInstancePending(state2) || isSuspenseInstanceFallback(state2)))
12689
12689
  return node;
12690
12690
  } else if (19 === node.tag && ("forwards" === node.memoizedProps.revealOrder || "backwards" === node.memoizedProps.revealOrder || "unstable_legacy-backwards" === node.memoizedProps.revealOrder || "together" === node.memoizedProps.revealOrder)) {
12691
12691
  if (0 !== (node.flags & 128)) return node;
@@ -12979,8 +12979,8 @@ var require_react_reconciler_development = __commonJS({
12979
12979
  memoCache.index++;
12980
12980
  return updateQueue;
12981
12981
  }
12982
- function basicStateReducer(state, action) {
12983
- return "function" === typeof action ? action(state) : action;
12982
+ function basicStateReducer(state2, action) {
12983
+ return "function" === typeof action ? action(state2) : action;
12984
12984
  }
12985
12985
  function mountReducer(reducer, initialArg, init) {
12986
12986
  var hook = mountWorkInProgressHook();
@@ -13470,12 +13470,12 @@ var require_react_reconciler_development = __commonJS({
13470
13470
  stateHook = updateReducer(basicStateReducer)[0];
13471
13471
  if ("object" === typeof currentStateHook && null !== currentStateHook && "function" === typeof currentStateHook.then)
13472
13472
  try {
13473
- var state = useThenable(currentStateHook);
13473
+ var state2 = useThenable(currentStateHook);
13474
13474
  } catch (x) {
13475
13475
  if (x === SuspenseException) throw SuspenseActionException;
13476
13476
  throw x;
13477
13477
  }
13478
- else state = currentStateHook;
13478
+ else state2 = currentStateHook;
13479
13479
  currentStateHook = updateWorkInProgressHook();
13480
13480
  var actionQueue = currentStateHook.queue, dispatch = actionQueue.dispatch;
13481
13481
  action !== currentStateHook.memoizedState && (currentlyRenderingFiber.flags |= 2048, pushSimpleEffect(
@@ -13484,7 +13484,7 @@ var require_react_reconciler_development = __commonJS({
13484
13484
  actionStateActionEffect.bind(null, actionQueue, action),
13485
13485
  null
13486
13486
  ));
13487
- return [state, dispatch, stateHook];
13487
+ return [state2, dispatch, stateHook];
13488
13488
  }
13489
13489
  function actionStateActionEffect(actionQueue, action) {
13490
13490
  actionQueue.action = action;
@@ -14548,11 +14548,11 @@ var require_react_reconciler_development = __commonJS({
14548
14548
  function updateClassComponent(current2, workInProgress2, Component, nextProps, renderLanes2) {
14549
14549
  switch (shouldErrorImpl(workInProgress2)) {
14550
14550
  case false:
14551
- var _instance = workInProgress2.stateNode, state = new workInProgress2.type(
14551
+ var _instance = workInProgress2.stateNode, state2 = new workInProgress2.type(
14552
14552
  workInProgress2.memoizedProps,
14553
14553
  _instance.context
14554
14554
  ).state;
14555
- _instance.updater.enqueueSetState(_instance, state, null);
14555
+ _instance.updater.enqueueSetState(_instance, state2, null);
14556
14556
  break;
14557
14557
  case true:
14558
14558
  workInProgress2.flags |= 128;
@@ -14560,15 +14560,15 @@ var require_react_reconciler_development = __commonJS({
14560
14560
  _instance = Error("Simulated error coming from DevTools");
14561
14561
  var lane = renderLanes2 & -renderLanes2;
14562
14562
  workInProgress2.lanes |= lane;
14563
- state = workInProgressRoot;
14564
- if (null === state)
14563
+ state2 = workInProgressRoot;
14564
+ if (null === state2)
14565
14565
  throw Error(
14566
14566
  "Expected a work-in-progress root. This is a bug in React. Please file an issue."
14567
14567
  );
14568
14568
  lane = createClassErrorUpdate(lane);
14569
14569
  initializeClassErrorUpdate(
14570
14570
  lane,
14571
- state,
14571
+ state2,
14572
14572
  workInProgress2,
14573
14573
  createCapturedValueAtFiber(_instance, workInProgress2)
14574
14574
  );
@@ -14576,84 +14576,84 @@ var require_react_reconciler_development = __commonJS({
14576
14576
  }
14577
14577
  prepareToReadContext(workInProgress2);
14578
14578
  if (null === workInProgress2.stateNode) {
14579
- state = emptyContextObject;
14579
+ state2 = emptyContextObject;
14580
14580
  _instance = Component.contextType;
14581
14581
  "contextType" in Component && null !== _instance && (void 0 === _instance || _instance.$$typeof !== REACT_CONTEXT_TYPE) && !didWarnAboutInvalidateContextType.has(Component) && (didWarnAboutInvalidateContextType.add(Component), lane = void 0 === _instance ? " However, it is set to undefined. This can be caused by a typo or by mixing up named and default imports. This can also happen due to a circular dependency, so try moving the createContext() call to a separate file." : "object" !== typeof _instance ? " However, it is set to a " + typeof _instance + "." : _instance.$$typeof === REACT_CONSUMER_TYPE ? " Did you accidentally pass the Context.Consumer instead?" : " However, it is set to an object with keys {" + Object.keys(_instance).join(", ") + "}.", console.error(
14582
14582
  "%s defines an invalid contextType. contextType should point to the Context object returned by React.createContext().%s",
14583
14583
  getComponentNameFromType(Component) || "Component",
14584
14584
  lane
14585
14585
  ));
14586
- "object" === typeof _instance && null !== _instance && (state = readContext(_instance));
14587
- _instance = new Component(nextProps, state);
14586
+ "object" === typeof _instance && null !== _instance && (state2 = readContext(_instance));
14587
+ _instance = new Component(nextProps, state2);
14588
14588
  if (workInProgress2.mode & 8) {
14589
14589
  setIsStrictModeForDevtools(true);
14590
14590
  try {
14591
- _instance = new Component(nextProps, state);
14591
+ _instance = new Component(nextProps, state2);
14592
14592
  } finally {
14593
14593
  setIsStrictModeForDevtools(false);
14594
14594
  }
14595
14595
  }
14596
- state = workInProgress2.memoizedState = null !== _instance.state && void 0 !== _instance.state ? _instance.state : null;
14596
+ state2 = workInProgress2.memoizedState = null !== _instance.state && void 0 !== _instance.state ? _instance.state : null;
14597
14597
  _instance.updater = classComponentUpdater;
14598
14598
  workInProgress2.stateNode = _instance;
14599
14599
  _instance._reactInternals = workInProgress2;
14600
14600
  _instance._reactInternalInstance = fakeInternalInstance;
14601
- "function" === typeof Component.getDerivedStateFromProps && null === state && (state = getComponentNameFromType(Component) || "Component", didWarnAboutUninitializedState.has(state) || (didWarnAboutUninitializedState.add(state), console.error(
14601
+ "function" === typeof Component.getDerivedStateFromProps && null === state2 && (state2 = getComponentNameFromType(Component) || "Component", didWarnAboutUninitializedState.has(state2) || (didWarnAboutUninitializedState.add(state2), console.error(
14602
14602
  "`%s` uses `getDerivedStateFromProps` but its initial state is %s. This is not recommended. Instead, define the initial state by assigning an object to `this.state` in the constructor of `%s`. This ensures that `getDerivedStateFromProps` arguments have a consistent shape.",
14603
- state,
14603
+ state2,
14604
14604
  null === _instance.state ? "null" : "undefined",
14605
- state
14605
+ state2
14606
14606
  )));
14607
14607
  if ("function" === typeof Component.getDerivedStateFromProps || "function" === typeof _instance.getSnapshotBeforeUpdate) {
14608
- var foundWillUpdateName = lane = state = null;
14609
- "function" === typeof _instance.componentWillMount && true !== _instance.componentWillMount.__suppressDeprecationWarning ? state = "componentWillMount" : "function" === typeof _instance.UNSAFE_componentWillMount && (state = "UNSAFE_componentWillMount");
14608
+ var foundWillUpdateName = lane = state2 = null;
14609
+ "function" === typeof _instance.componentWillMount && true !== _instance.componentWillMount.__suppressDeprecationWarning ? state2 = "componentWillMount" : "function" === typeof _instance.UNSAFE_componentWillMount && (state2 = "UNSAFE_componentWillMount");
14610
14610
  "function" === typeof _instance.componentWillReceiveProps && true !== _instance.componentWillReceiveProps.__suppressDeprecationWarning ? lane = "componentWillReceiveProps" : "function" === typeof _instance.UNSAFE_componentWillReceiveProps && (lane = "UNSAFE_componentWillReceiveProps");
14611
14611
  "function" === typeof _instance.componentWillUpdate && true !== _instance.componentWillUpdate.__suppressDeprecationWarning ? foundWillUpdateName = "componentWillUpdate" : "function" === typeof _instance.UNSAFE_componentWillUpdate && (foundWillUpdateName = "UNSAFE_componentWillUpdate");
14612
- if (null !== state || null !== lane || null !== foundWillUpdateName) {
14612
+ if (null !== state2 || null !== lane || null !== foundWillUpdateName) {
14613
14613
  _instance = getComponentNameFromType(Component) || "Component";
14614
14614
  var newApiName = "function" === typeof Component.getDerivedStateFromProps ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()";
14615
14615
  didWarnAboutLegacyLifecyclesAndDerivedState.has(_instance) || (didWarnAboutLegacyLifecyclesAndDerivedState.add(_instance), console.error(
14616
14616
  "Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://react.dev/link/unsafe-component-lifecycles",
14617
14617
  _instance,
14618
14618
  newApiName,
14619
- null !== state ? "\n " + state : "",
14619
+ null !== state2 ? "\n " + state2 : "",
14620
14620
  null !== lane ? "\n " + lane : "",
14621
14621
  null !== foundWillUpdateName ? "\n " + foundWillUpdateName : ""
14622
14622
  ));
14623
14623
  }
14624
14624
  }
14625
14625
  _instance = workInProgress2.stateNode;
14626
- state = getComponentNameFromType(Component) || "Component";
14626
+ state2 = getComponentNameFromType(Component) || "Component";
14627
14627
  _instance.render || (Component.prototype && "function" === typeof Component.prototype.render ? console.error(
14628
14628
  "No `render` method found on the %s instance: did you accidentally return an object from the constructor?",
14629
- state
14629
+ state2
14630
14630
  ) : console.error(
14631
14631
  "No `render` method found on the %s instance: you may have forgotten to define `render`.",
14632
- state
14632
+ state2
14633
14633
  ));
14634
14634
  !_instance.getInitialState || _instance.getInitialState.isReactClassApproved || _instance.state || console.error(
14635
14635
  "getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?",
14636
- state
14636
+ state2
14637
14637
  );
14638
14638
  _instance.getDefaultProps && !_instance.getDefaultProps.isReactClassApproved && console.error(
14639
14639
  "getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.",
14640
- state
14640
+ state2
14641
14641
  );
14642
14642
  _instance.contextType && console.error(
14643
14643
  "contextType was defined as an instance property on %s. Use a static property to define contextType instead.",
14644
- state
14644
+ state2
14645
14645
  );
14646
14646
  Component.childContextTypes && !didWarnAboutChildContextTypes.has(Component) && (didWarnAboutChildContextTypes.add(Component), console.error(
14647
14647
  "%s uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead. (https://react.dev/link/legacy-context)",
14648
- state
14648
+ state2
14649
14649
  ));
14650
14650
  Component.contextTypes && !didWarnAboutContextTypes$1.has(Component) && (didWarnAboutContextTypes$1.add(Component), console.error(
14651
14651
  "%s uses the legacy contextTypes API which was removed in React 19. Use React.createContext() with static contextType instead. (https://react.dev/link/legacy-context)",
14652
- state
14652
+ state2
14653
14653
  ));
14654
14654
  "function" === typeof _instance.componentShouldUpdate && console.error(
14655
14655
  "%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.",
14656
- state
14656
+ state2
14657
14657
  );
14658
14658
  Component.prototype && Component.prototype.isPureReactComponent && "undefined" !== typeof _instance.shouldComponentUpdate && console.error(
14659
14659
  "%s has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.",
@@ -14661,29 +14661,29 @@ var require_react_reconciler_development = __commonJS({
14661
14661
  );
14662
14662
  "function" === typeof _instance.componentDidUnmount && console.error(
14663
14663
  "%s has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?",
14664
- state
14664
+ state2
14665
14665
  );
14666
14666
  "function" === typeof _instance.componentDidReceiveProps && console.error(
14667
14667
  "%s has a method called componentDidReceiveProps(). But there is no such lifecycle method. If you meant to update the state in response to changing props, use componentWillReceiveProps(). If you meant to fetch data or run side-effects or mutations after React has updated the UI, use componentDidUpdate().",
14668
- state
14668
+ state2
14669
14669
  );
14670
14670
  "function" === typeof _instance.componentWillRecieveProps && console.error(
14671
14671
  "%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?",
14672
- state
14672
+ state2
14673
14673
  );
14674
14674
  "function" === typeof _instance.UNSAFE_componentWillRecieveProps && console.error(
14675
14675
  "%s has a method called UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?",
14676
- state
14676
+ state2
14677
14677
  );
14678
14678
  lane = _instance.props !== nextProps;
14679
14679
  void 0 !== _instance.props && lane && console.error(
14680
14680
  "When calling super() in `%s`, make sure to pass up the same props that your component's constructor was passed.",
14681
- state
14681
+ state2
14682
14682
  );
14683
14683
  _instance.defaultProps && console.error(
14684
14684
  "Setting defaultProps as an instance property on %s is not supported and will be ignored. Instead, define defaultProps as a static property on %s.",
14685
- state,
14686
- state
14685
+ state2,
14686
+ state2
14687
14687
  );
14688
14688
  "function" !== typeof _instance.getSnapshotBeforeUpdate || "function" === typeof _instance.componentDidUpdate || didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(Component) || (didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(Component), console.error(
14689
14689
  "%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). This component defines getSnapshotBeforeUpdate() only.",
@@ -14691,31 +14691,31 @@ var require_react_reconciler_development = __commonJS({
14691
14691
  ));
14692
14692
  "function" === typeof _instance.getDerivedStateFromProps && console.error(
14693
14693
  "%s: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.",
14694
- state
14694
+ state2
14695
14695
  );
14696
14696
  "function" === typeof _instance.getDerivedStateFromError && console.error(
14697
14697
  "%s: getDerivedStateFromError() is defined as an instance method and will be ignored. Instead, declare it as a static method.",
14698
- state
14698
+ state2
14699
14699
  );
14700
14700
  "function" === typeof Component.getSnapshotBeforeUpdate && console.error(
14701
14701
  "%s: getSnapshotBeforeUpdate() is defined as a static method and will be ignored. Instead, declare it as an instance method.",
14702
- state
14702
+ state2
14703
14703
  );
14704
- (lane = _instance.state) && ("object" !== typeof lane || isArrayImpl(lane)) && console.error("%s.state: must be set to an object or null", state);
14704
+ (lane = _instance.state) && ("object" !== typeof lane || isArrayImpl(lane)) && console.error("%s.state: must be set to an object or null", state2);
14705
14705
  "function" === typeof _instance.getChildContext && "object" !== typeof Component.childContextTypes && console.error(
14706
14706
  "%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().",
14707
- state
14707
+ state2
14708
14708
  );
14709
14709
  _instance = workInProgress2.stateNode;
14710
14710
  _instance.props = nextProps;
14711
14711
  _instance.state = workInProgress2.memoizedState;
14712
14712
  _instance.refs = {};
14713
14713
  initializeUpdateQueue(workInProgress2);
14714
- state = Component.contextType;
14715
- _instance.context = "object" === typeof state && null !== state ? readContext(state) : emptyContextObject;
14716
- _instance.state === nextProps && (state = getComponentNameFromType(Component) || "Component", didWarnAboutDirectlyAssigningPropsToState.has(state) || (didWarnAboutDirectlyAssigningPropsToState.add(state), console.error(
14714
+ state2 = Component.contextType;
14715
+ _instance.context = "object" === typeof state2 && null !== state2 ? readContext(state2) : emptyContextObject;
14716
+ _instance.state === nextProps && (state2 = getComponentNameFromType(Component) || "Component", didWarnAboutDirectlyAssigningPropsToState.has(state2) || (didWarnAboutDirectlyAssigningPropsToState.add(state2), console.error(
14717
14717
  "%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.",
14718
- state
14718
+ state2
14719
14719
  )));
14720
14720
  workInProgress2.mode & 8 && ReactStrictModeWarnings.recordLegacyContextWarning(
14721
14721
  workInProgress2,
@@ -14726,14 +14726,14 @@ var require_react_reconciler_development = __commonJS({
14726
14726
  _instance
14727
14727
  );
14728
14728
  _instance.state = workInProgress2.memoizedState;
14729
- state = Component.getDerivedStateFromProps;
14730
- "function" === typeof state && (applyDerivedStateFromProps(
14729
+ state2 = Component.getDerivedStateFromProps;
14730
+ "function" === typeof state2 && (applyDerivedStateFromProps(
14731
14731
  workInProgress2,
14732
14732
  Component,
14733
- state,
14733
+ state2,
14734
14734
  nextProps
14735
14735
  ), _instance.state = workInProgress2.memoizedState);
14736
- "function" === typeof Component.getDerivedStateFromProps || "function" === typeof _instance.getSnapshotBeforeUpdate || "function" !== typeof _instance.UNSAFE_componentWillMount && "function" !== typeof _instance.componentWillMount || (state = _instance.state, "function" === typeof _instance.componentWillMount && _instance.componentWillMount(), "function" === typeof _instance.UNSAFE_componentWillMount && _instance.UNSAFE_componentWillMount(), state !== _instance.state && (console.error(
14736
+ "function" === typeof Component.getDerivedStateFromProps || "function" === typeof _instance.getSnapshotBeforeUpdate || "function" !== typeof _instance.UNSAFE_componentWillMount && "function" !== typeof _instance.componentWillMount || (state2 = _instance.state, "function" === typeof _instance.componentWillMount && _instance.componentWillMount(), "function" === typeof _instance.UNSAFE_componentWillMount && _instance.UNSAFE_componentWillMount(), state2 !== _instance.state && (console.error(
14737
14737
  "%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.",
14738
14738
  getComponentNameFromFiber(workInProgress2) || "Component"
14739
14739
  ), classComponentUpdater.enqueueReplaceState(
@@ -14751,16 +14751,16 @@ var require_react_reconciler_development = __commonJS({
14751
14751
  _instance.props = lane;
14752
14752
  var oldContext = _instance.context;
14753
14753
  foundWillUpdateName = Component.contextType;
14754
- state = emptyContextObject;
14755
- "object" === typeof foundWillUpdateName && null !== foundWillUpdateName && (state = readContext(foundWillUpdateName));
14754
+ state2 = emptyContextObject;
14755
+ "object" === typeof foundWillUpdateName && null !== foundWillUpdateName && (state2 = readContext(foundWillUpdateName));
14756
14756
  newApiName = Component.getDerivedStateFromProps;
14757
14757
  foundWillUpdateName = "function" === typeof newApiName || "function" === typeof _instance.getSnapshotBeforeUpdate;
14758
14758
  unresolvedOldProps = workInProgress2.pendingProps !== unresolvedOldProps;
14759
- foundWillUpdateName || "function" !== typeof _instance.UNSAFE_componentWillReceiveProps && "function" !== typeof _instance.componentWillReceiveProps || (unresolvedOldProps || oldContext !== state) && callComponentWillReceiveProps(
14759
+ foundWillUpdateName || "function" !== typeof _instance.UNSAFE_componentWillReceiveProps && "function" !== typeof _instance.componentWillReceiveProps || (unresolvedOldProps || oldContext !== state2) && callComponentWillReceiveProps(
14760
14760
  workInProgress2,
14761
14761
  _instance,
14762
14762
  nextProps,
14763
- state
14763
+ state2
14764
14764
  );
14765
14765
  hasForceUpdate = false;
14766
14766
  var oldState = workInProgress2.memoizedState;
@@ -14780,13 +14780,13 @@ var require_react_reconciler_development = __commonJS({
14780
14780
  nextProps,
14781
14781
  oldState,
14782
14782
  oldContext,
14783
- state
14784
- )) ? (foundWillUpdateName || "function" !== typeof _instance.UNSAFE_componentWillMount && "function" !== typeof _instance.componentWillMount || ("function" === typeof _instance.componentWillMount && _instance.componentWillMount(), "function" === typeof _instance.UNSAFE_componentWillMount && _instance.UNSAFE_componentWillMount()), "function" === typeof _instance.componentDidMount && (workInProgress2.flags |= 4194308), (workInProgress2.mode & 16) !== NoMode && (workInProgress2.flags |= 134217728)) : ("function" === typeof _instance.componentDidMount && (workInProgress2.flags |= 4194308), (workInProgress2.mode & 16) !== NoMode && (workInProgress2.flags |= 134217728), workInProgress2.memoizedProps = nextProps, workInProgress2.memoizedState = oldContext), _instance.props = nextProps, _instance.state = oldContext, _instance.context = state, _instance = lane) : ("function" === typeof _instance.componentDidMount && (workInProgress2.flags |= 4194308), (workInProgress2.mode & 16) !== NoMode && (workInProgress2.flags |= 134217728), _instance = false);
14783
+ state2
14784
+ )) ? (foundWillUpdateName || "function" !== typeof _instance.UNSAFE_componentWillMount && "function" !== typeof _instance.componentWillMount || ("function" === typeof _instance.componentWillMount && _instance.componentWillMount(), "function" === typeof _instance.UNSAFE_componentWillMount && _instance.UNSAFE_componentWillMount()), "function" === typeof _instance.componentDidMount && (workInProgress2.flags |= 4194308), (workInProgress2.mode & 16) !== NoMode && (workInProgress2.flags |= 134217728)) : ("function" === typeof _instance.componentDidMount && (workInProgress2.flags |= 4194308), (workInProgress2.mode & 16) !== NoMode && (workInProgress2.flags |= 134217728), workInProgress2.memoizedProps = nextProps, workInProgress2.memoizedState = oldContext), _instance.props = nextProps, _instance.state = oldContext, _instance.context = state2, _instance = lane) : ("function" === typeof _instance.componentDidMount && (workInProgress2.flags |= 4194308), (workInProgress2.mode & 16) !== NoMode && (workInProgress2.flags |= 134217728), _instance = false);
14785
14785
  } else {
14786
14786
  _instance = workInProgress2.stateNode;
14787
14787
  cloneUpdateQueue(current2, workInProgress2);
14788
- state = workInProgress2.memoizedProps;
14789
- foundWillUpdateName = resolveClassComponentProps(Component, state);
14788
+ state2 = workInProgress2.memoizedProps;
14789
+ foundWillUpdateName = resolveClassComponentProps(Component, state2);
14790
14790
  _instance.props = foundWillUpdateName;
14791
14791
  newApiName = workInProgress2.pendingProps;
14792
14792
  oldState = _instance.context;
@@ -14794,7 +14794,7 @@ var require_react_reconciler_development = __commonJS({
14794
14794
  lane = emptyContextObject;
14795
14795
  "object" === typeof oldContext && null !== oldContext && (lane = readContext(oldContext));
14796
14796
  unresolvedOldProps = Component.getDerivedStateFromProps;
14797
- (oldContext = "function" === typeof unresolvedOldProps || "function" === typeof _instance.getSnapshotBeforeUpdate) || "function" !== typeof _instance.UNSAFE_componentWillReceiveProps && "function" !== typeof _instance.componentWillReceiveProps || (state !== newApiName || oldState !== lane) && callComponentWillReceiveProps(
14797
+ (oldContext = "function" === typeof unresolvedOldProps || "function" === typeof _instance.getSnapshotBeforeUpdate) || "function" !== typeof _instance.UNSAFE_componentWillReceiveProps && "function" !== typeof _instance.componentWillReceiveProps || (state2 !== newApiName || oldState !== lane) && callComponentWillReceiveProps(
14798
14798
  workInProgress2,
14799
14799
  _instance,
14800
14800
  nextProps,
@@ -14806,7 +14806,7 @@ var require_react_reconciler_development = __commonJS({
14806
14806
  processUpdateQueue(workInProgress2, nextProps, _instance, renderLanes2);
14807
14807
  suspendIfUpdateReadFromEntangledAsyncAction();
14808
14808
  var newState = workInProgress2.memoizedState;
14809
- state !== newApiName || oldState !== newState || hasForceUpdate || null !== current2 && null !== current2.dependencies && checkIfContextChanged(current2.dependencies) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps(
14809
+ state2 !== newApiName || oldState !== newState || hasForceUpdate || null !== current2 && null !== current2.dependencies && checkIfContextChanged(current2.dependencies) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps(
14810
14810
  workInProgress2,
14811
14811
  Component,
14812
14812
  unresolvedOldProps,
@@ -14823,15 +14823,15 @@ var require_react_reconciler_development = __commonJS({
14823
14823
  nextProps,
14824
14824
  newState,
14825
14825
  lane
14826
- )), "function" === typeof _instance.componentDidUpdate && (workInProgress2.flags |= 4), "function" === typeof _instance.getSnapshotBeforeUpdate && (workInProgress2.flags |= 1024)) : ("function" !== typeof _instance.componentDidUpdate || state === current2.memoizedProps && oldState === current2.memoizedState || (workInProgress2.flags |= 4), "function" !== typeof _instance.getSnapshotBeforeUpdate || state === current2.memoizedProps && oldState === current2.memoizedState || (workInProgress2.flags |= 1024), workInProgress2.memoizedProps = nextProps, workInProgress2.memoizedState = newState), _instance.props = nextProps, _instance.state = newState, _instance.context = lane, _instance = foundWillUpdateName) : ("function" !== typeof _instance.componentDidUpdate || state === current2.memoizedProps && oldState === current2.memoizedState || (workInProgress2.flags |= 4), "function" !== typeof _instance.getSnapshotBeforeUpdate || state === current2.memoizedProps && oldState === current2.memoizedState || (workInProgress2.flags |= 1024), _instance = false);
14826
+ )), "function" === typeof _instance.componentDidUpdate && (workInProgress2.flags |= 4), "function" === typeof _instance.getSnapshotBeforeUpdate && (workInProgress2.flags |= 1024)) : ("function" !== typeof _instance.componentDidUpdate || state2 === current2.memoizedProps && oldState === current2.memoizedState || (workInProgress2.flags |= 4), "function" !== typeof _instance.getSnapshotBeforeUpdate || state2 === current2.memoizedProps && oldState === current2.memoizedState || (workInProgress2.flags |= 1024), workInProgress2.memoizedProps = nextProps, workInProgress2.memoizedState = newState), _instance.props = nextProps, _instance.state = newState, _instance.context = lane, _instance = foundWillUpdateName) : ("function" !== typeof _instance.componentDidUpdate || state2 === current2.memoizedProps && oldState === current2.memoizedState || (workInProgress2.flags |= 4), "function" !== typeof _instance.getSnapshotBeforeUpdate || state2 === current2.memoizedProps && oldState === current2.memoizedState || (workInProgress2.flags |= 1024), _instance = false);
14827
14827
  }
14828
14828
  lane = _instance;
14829
14829
  markRef(current2, workInProgress2);
14830
- state = 0 !== (workInProgress2.flags & 128);
14831
- if (lane || state) {
14830
+ state2 = 0 !== (workInProgress2.flags & 128);
14831
+ if (lane || state2) {
14832
14832
  lane = workInProgress2.stateNode;
14833
14833
  setCurrentFiber(workInProgress2);
14834
- if (state && "function" !== typeof Component.getDerivedStateFromError)
14834
+ if (state2 && "function" !== typeof Component.getDerivedStateFromError)
14835
14835
  Component = null, profilerStartTime = -1;
14836
14836
  else if (Component = callRenderInDEV(lane), workInProgress2.mode & 8) {
14837
14837
  setIsStrictModeForDevtools(true);
@@ -14842,7 +14842,7 @@ var require_react_reconciler_development = __commonJS({
14842
14842
  }
14843
14843
  }
14844
14844
  workInProgress2.flags |= 1;
14845
- null !== current2 && state ? (workInProgress2.child = reconcileChildFibers(
14845
+ null !== current2 && state2 ? (workInProgress2.child = reconcileChildFibers(
14846
14846
  workInProgress2,
14847
14847
  current2.child,
14848
14848
  null,
@@ -23112,6 +23112,22 @@ var require_stack_utils = __commonJS({
23112
23112
  }
23113
23113
  });
23114
23114
 
23115
+ // src/runtime/shared/root-async-context.mjs
23116
+ import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
23117
+ function runtimeAsyncLocalStorage() {
23118
+ const store = new AsyncLocalStorage();
23119
+ state.stores.add(new WeakRef(store));
23120
+ return store;
23121
+ }
23122
+ var STATE_KEY, state;
23123
+ var init_root_async_context = __esm({
23124
+ "src/runtime/shared/root-async-context.mjs"() {
23125
+ STATE_KEY = /* @__PURE__ */ Symbol.for("mixdog.rootAsyncContext");
23126
+ globalThis[STATE_KEY] ??= { root: null, stores: /* @__PURE__ */ new Set() };
23127
+ state = globalThis[STATE_KEY];
23128
+ }
23129
+ });
23130
+
23115
23131
  // src/runtime/shared/file-permissions.mjs
23116
23132
  import { existsSync as existsSync3 } from "node:fs";
23117
23133
  import { dirname, join, resolve as resolve2 } from "node:path";
@@ -23510,7 +23526,6 @@ import {
23510
23526
  } from "node:fs/promises";
23511
23527
  import { basename as basename2, dirname as dirname2, join as join2 } from "node:path";
23512
23528
  import { randomBytes as randomBytes2 } from "node:crypto";
23513
- import { AsyncLocalStorage } from "node:async_hooks";
23514
23529
  function markOsHeld(lockPath) {
23515
23530
  osHeldPaths.set(lockPath, (osHeldPaths.get(lockPath) || 0) + 1);
23516
23531
  }
@@ -23883,6 +23898,7 @@ async function withOsFileLock(lockPath, fn, opts = {}, queueWaitMs = 0) {
23883
23898
  var LOCK_WAIT_CODES, RETRY_MAX_MS, DEFAULT_BACKOFFS_MS, configuredLockTimeoutMs, DEFAULT_LOCK_TIMEOUT_MS, OWNER_TOKEN, osHeldPaths, lockQueue, heldLockPaths, RECLAIM_GUARD_STALE_MS, LOCK_WAIT_WARN_MS, LOCK_WAIT_WARN_INTERVAL_MS, LOCK_HELD_WARN_MS, lockWaitWarnedAt, lockHeldWarnedAt, SYNC_IO, ASYNC_IO, STAGED_LOCK_FILE_STALE_MS, sweptLockPaths;
23884
23899
  var init_file_lock = __esm({
23885
23900
  "src/runtime/shared/file-lock.mjs"() {
23901
+ init_root_async_context();
23886
23902
  init_file_permissions();
23887
23903
  init_keyed_serial_queue();
23888
23904
  init_sleep();
@@ -23894,7 +23910,7 @@ var init_file_lock = __esm({
23894
23910
  OWNER_TOKEN = randomBytes2(12).toString("hex");
23895
23911
  osHeldPaths = /* @__PURE__ */ new Map();
23896
23912
  lockQueue = createKeyedSerialQueue();
23897
- heldLockPaths = new AsyncLocalStorage();
23913
+ heldLockPaths = runtimeAsyncLocalStorage();
23898
23914
  RECLAIM_GUARD_STALE_MS = 3e4;
23899
23915
  LOCK_WAIT_WARN_MS = 500;
23900
23916
  LOCK_WAIT_WARN_INTERVAL_MS = 1e4;
@@ -31544,10 +31560,10 @@ var renderNodeToScreenReaderOutput = (node, options = {}) => {
31544
31560
  }).filter(Boolean).join(separator);
31545
31561
  }
31546
31562
  if (node.internal_accessibility) {
31547
- const { role, state } = node.internal_accessibility;
31548
- if (state) {
31549
- const stateKeys = Object.keys(state);
31550
- const stateDescription = stateKeys.filter((key) => state[key]).join(", ");
31563
+ const { role, state: state2 } = node.internal_accessibility;
31564
+ if (state2) {
31565
+ const stateKeys = Object.keys(state2);
31566
+ const stateDescription = stateKeys.filter((key) => state2[key]).join(", ");
31551
31567
  if (stateDescription) {
31552
31568
  output = `(${stateDescription}) ${output}`;
31553
31569
  }
@@ -33570,21 +33586,21 @@ function parseMultipleKeypresses(prevState, input = "") {
33570
33586
  var escape = "\x1B";
33571
33587
  var pasteStart = "\x1B[200~";
33572
33588
  var createInputParser = () => {
33573
- let state = { ...INITIAL_STATE };
33589
+ let state2 = { ...INITIAL_STATE };
33574
33590
  return {
33575
33591
  push(chunk) {
33576
- const [events, next] = parseMultipleKeypresses(state, chunk);
33577
- state = next;
33592
+ const [events, next] = parseMultipleKeypresses(state2, chunk);
33593
+ state2 = next;
33578
33594
  return events;
33579
33595
  },
33580
33596
  flush() {
33581
- const [events, next] = parseMultipleKeypresses(state, null);
33582
- state = next;
33597
+ const [events, next] = parseMultipleKeypresses(state2, null);
33598
+ state2 = next;
33583
33599
  return events;
33584
33600
  },
33585
33601
  hasPendingEscape() {
33586
- const pending = state.incomplete;
33587
- return state.mode !== "IN_PASTE" && pending.startsWith(escape) && // Suppress ONLY while assembling the exact paste-start marker
33602
+ const pending = state2.incomplete;
33603
+ return state2.mode !== "IN_PASTE" && pending.startsWith(escape) && // Suppress ONLY while assembling the exact paste-start marker
33588
33604
  // (`\u001B[200~`) or its penultimate prefix (`\u001B[200`) —
33589
33605
  // both complete on their own and must never flush as literal
33590
33606
  // input. Any other partial escape (`\x1b[`, `\x1b[2`, `\x1b[20`,
@@ -33593,16 +33609,16 @@ var createInputParser = () => {
33593
33609
  !pending.startsWith(pasteStart) && pending !== "\x1B[200";
33594
33610
  },
33595
33611
  flushPendingEscape() {
33596
- const pending = state.incomplete;
33597
- if (state.mode === "IN_PASTE" || !pending.startsWith(escape)) {
33612
+ const pending = state2.incomplete;
33613
+ if (state2.mode === "IN_PASTE" || !pending.startsWith(escape)) {
33598
33614
  return void 0;
33599
33615
  }
33600
- const [events, next] = parseMultipleKeypresses(state, null);
33601
- state = next;
33616
+ const [events, next] = parseMultipleKeypresses(state2, null);
33617
+ state2 = next;
33602
33618
  return events.length > 0 ? events : void 0;
33603
33619
  },
33604
33620
  reset() {
33605
- state = { ...INITIAL_STATE };
33621
+ state2 = { ...INITIAL_STATE };
33606
33622
  }
33607
33623
  };
33608
33624
  };
@@ -40657,7 +40673,7 @@ function textBetweenTag(text, tag) {
40657
40673
  function stripInlineMarkdown(value) {
40658
40674
  return String(value ?? "").replace(/^\s{0,3}(?:#{1,6}\s+|>\s+|[-*+]\s+|\d+\.\s+)/, "").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/__([^_]+)__/g, "$1").replace(/(?<!\*)\*(?!\*)([^*]+)\*(?!\*)/g, "$1").replace(/`([^`]+)`/g, "$1").trim();
40659
40675
  }
40660
- var ENVELOPE_FIELD_LINE_RE = /^(?:agent task|background task|status|type|target|role|agent|preset|model|effort|fast|limits|session|task-id|task_id|surface|operation|label|exit_code|timed_out|signal|notification|queueDepth|worker|worker_stage|last_progress|silent_for|watchdog|queued_followups|diagnostic|started|finished|elapsed|reused|result|message|output|protocol|version):\s*/i;
40676
+ var ENVELOPE_FIELD_LINE_RE = /^(?:agent task|background task|status|type|target|role|agent|preset|model|effort|fast|limits|session|task-id|task_id|surface|operation|label|exit_code|timed_out|signal|notification|queueDepth|worker|worker_stage|last_progress|silent_for|tool_silent_for|watchdog|queued_followups|diagnostic|started|finished|elapsed|reused|result|message|output|protocol|version):\s*/i;
40661
40677
  var ENVELOPE_HEADER_LINE_RE = /^(?:agent result|background task)\b/i;
40662
40678
  var BRACKETED_FIELD_LINE_RE = /^\[[a-z-]+:\s*[^\]]*\]$/i;
40663
40679
  function firstAgentResultLine(text) {
@@ -41355,6 +41371,8 @@ function visualizeUnit(a) {
41355
41371
  return unitDescriptor("Visualize", { count: 1, active: "Checking", done: "Checked", noun: "page" });
41356
41372
  if (action === "inspect")
41357
41373
  return unitDescriptor("Visualize", { count: 1, active: "Inspecting", done: "Inspected", noun: "page" });
41374
+ if (action === "act")
41375
+ return unitDescriptor("Visualize", { count: 1, active: "Operating", done: "Operated", noun: "page" });
41358
41376
  if (action === "close")
41359
41377
  return unitDescriptor("Visualize", { count: 1, active: "Closing", done: "Closed", noun: "tab" });
41360
41378
  return unitDescriptor("Visualize", { count: 1, active: "Showing", done: "Showed", noun: "artifact" });
@@ -45312,14 +45330,14 @@ var TRANSCRIPT_WINDOW_TAIL_OVERSCAN_ROWS = envPositiveInt("MIXDOG_TUI_TRANSCRIPT
45312
45330
  var TRANSCRIPT_WINDOW_TAIL_MAX_ITEMS = envPositiveInt("MIXDOG_TUI_TRANSCRIPT_WINDOW_TAIL_ITEMS", 20);
45313
45331
  var SELECTION_PAINT_INTERVAL_MS = envPositiveInt("MIXDOG_TUI_SELECTION_PAINT_MS", 24);
45314
45332
  var SCROLL_COALESCE_MS = envPositiveInt("MIXDOG_TUI_SCROLL_COALESCE_MS", 16);
45315
- function accumulateDirectionalScrollDelta(state, deltaRows) {
45333
+ function accumulateDirectionalScrollDelta(state2, deltaRows) {
45316
45334
  const delta = Number(deltaRows) || 0;
45317
45335
  if (!delta) return false;
45318
45336
  const direction = Math.sign(delta);
45319
- const reversed = Boolean(state.direction && state.direction !== direction);
45320
- if (reversed) state.pendingRows = 0;
45321
- state.direction = direction;
45322
- state.pendingRows += delta;
45337
+ const reversed = Boolean(state2.direction && state2.direction !== direction);
45338
+ if (reversed) state2.pendingRows = 0;
45339
+ state2.direction = direction;
45340
+ state2.pendingRows += delta;
45323
45341
  return reversed;
45324
45342
  }
45325
45343
  var TRANSCRIPT_MEASURED_ROWS = envFlag("MIXDOG_TUI_TRANSCRIPT_MEASURED", true);
@@ -45773,24 +45791,24 @@ function useTranscriptSwapReset({ items, lastItemsCountRef, lastFirstItemIdRef,
45773
45791
 
45774
45792
  // src/tui/app/use-context-panel-refresh.mjs
45775
45793
  import { useEffect as useEffect11 } from "react";
45776
- function useContextPanelRefresh({ contextPanelKind, state, openContextPicker }) {
45794
+ function useContextPanelRefresh({ contextPanelKind, state: state2, openContextPicker }) {
45777
45795
  useEffect11(() => {
45778
45796
  if (contextPanelKind === "context") openContextPicker();
45779
45797
  }, [
45780
45798
  contextPanelKind,
45781
- state.stats,
45782
- state.contextWindow,
45783
- state.rawContextWindow,
45784
- state.sessionId,
45785
- state.toolMode,
45786
- state.agentWorkers,
45787
- state.agentJobs,
45788
- state.provider,
45789
- state.model,
45790
- state.effort,
45791
- state.fast,
45792
- state.cwd,
45793
- state.clientHostPid
45799
+ state2.stats,
45800
+ state2.contextWindow,
45801
+ state2.rawContextWindow,
45802
+ state2.sessionId,
45803
+ state2.toolMode,
45804
+ state2.agentWorkers,
45805
+ state2.agentJobs,
45806
+ state2.provider,
45807
+ state2.model,
45808
+ state2.effort,
45809
+ state2.fast,
45810
+ state2.cwd,
45811
+ state2.clientHostPid
45794
45812
  ]);
45795
45813
  }
45796
45814
 
@@ -47018,8 +47036,8 @@ var yieldToRenderer = ({ frames = 1 } = {}) => {
47018
47036
  // src/tui/app/use-selection-paint/paint-queue.mjs
47019
47037
  function publishSelectionRect(stateRef, clippedRect, { store, rememberText, rememberSelectionTextSoon, harvestStitchRowsSoon }) {
47020
47038
  const nextRect = clippedRect || null;
47021
- const state = stateRef.current;
47022
- if (selectionRectsEqual(state.rect, nextRect)) {
47039
+ const state2 = stateRef.current;
47040
+ if (selectionRectsEqual(state2.rect, nextRect)) {
47023
47041
  const needsCapture = nextRect && rememberText && nextRect.captureText !== false;
47024
47042
  if (!needsCapture) return false;
47025
47043
  store.setRenderSelection?.(nextRect);
@@ -47027,45 +47045,45 @@ function publishSelectionRect(stateRef, clippedRect, { store, rememberText, reme
47027
47045
  harvestStitchRowsSoon();
47028
47046
  return true;
47029
47047
  }
47030
- state.rect = nextRect;
47031
- state.t = Date.now();
47048
+ state2.rect = nextRect;
47049
+ state2.t = Date.now();
47032
47050
  store.setRenderSelection?.(nextRect);
47033
47051
  if (nextRect && rememberText && nextRect.captureText !== false) rememberSelectionTextSoon();
47034
47052
  if (nextRect) harvestStitchRowsSoon();
47035
47053
  return true;
47036
47054
  }
47037
47055
  function cancelPendingPaint(stateRef) {
47038
- const state = stateRef.current;
47039
- if (state.timer) {
47040
- clearTimeout(state.timer);
47041
- state.timer = null;
47056
+ const state2 = stateRef.current;
47057
+ if (state2.timer) {
47058
+ clearTimeout(state2.timer);
47059
+ state2.timer = null;
47042
47060
  }
47043
- state.pending = null;
47061
+ state2.pending = null;
47044
47062
  }
47045
47063
  function flushPendingPaint(stateRef, paint) {
47046
- const state = stateRef.current;
47047
- if (!state.timer && !state.pending) return;
47048
- const pending = state.pending;
47049
- if (state.timer) {
47050
- clearTimeout(state.timer);
47051
- state.timer = null;
47052
- }
47053
- state.pending = null;
47064
+ const state2 = stateRef.current;
47065
+ if (!state2.timer && !state2.pending) return;
47066
+ const pending = state2.pending;
47067
+ if (state2.timer) {
47068
+ clearTimeout(state2.timer);
47069
+ state2.timer = null;
47070
+ }
47071
+ state2.pending = null;
47054
47072
  if (pending) paint(pending, { rememberText: false });
47055
47073
  }
47056
47074
  function scheduleThrottledPaint(stateRef, clippedRect, { paint, cancelPending }) {
47057
- const state = stateRef.current;
47058
- if (selectionRectsEqual(state.rect, clippedRect)) return;
47075
+ const state2 = stateRef.current;
47076
+ if (selectionRectsEqual(state2.rect, clippedRect)) return;
47059
47077
  const now = Date.now();
47060
- const elapsed = now - state.t;
47078
+ const elapsed = now - state2.t;
47061
47079
  if (elapsed >= SELECTION_PAINT_INTERVAL_MS) {
47062
47080
  cancelPending();
47063
47081
  paint(clippedRect, { rememberText: false });
47064
47082
  return;
47065
47083
  }
47066
- state.pending = clippedRect || null;
47067
- if (!state.timer) {
47068
- state.timer = setTimeout(
47084
+ state2.pending = clippedRect || null;
47085
+ if (!state2.timer) {
47086
+ state2.timer = setTimeout(
47069
47087
  () => {
47070
47088
  const current = stateRef.current;
47071
47089
  const pending = current.pending;
@@ -47075,7 +47093,7 @@ function scheduleThrottledPaint(stateRef, clippedRect, { paint, cancelPending })
47075
47093
  },
47076
47094
  Math.max(1, SELECTION_PAINT_INTERVAL_MS - elapsed)
47077
47095
  );
47078
- state.timer.unref?.();
47096
+ state2.timer.unref?.();
47079
47097
  }
47080
47098
  }
47081
47099
 
@@ -47376,36 +47394,36 @@ function useScrollCoalescer(scrollTranscriptRows) {
47376
47394
  const scrollCoalesceRef = useRef12({ pendingRows: 0, direction: 0, timer: null });
47377
47395
  useEffect18(
47378
47396
  () => () => {
47379
- const state = scrollCoalesceRef.current;
47380
- if (state.timer) clearTimeout(state.timer);
47381
- state.timer = null;
47382
- state.pendingRows = 0;
47383
- state.direction = 0;
47397
+ const state2 = scrollCoalesceRef.current;
47398
+ if (state2.timer) clearTimeout(state2.timer);
47399
+ state2.timer = null;
47400
+ state2.pendingRows = 0;
47401
+ state2.direction = 0;
47384
47402
  },
47385
47403
  []
47386
47404
  );
47387
47405
  return useCallback12(
47388
47406
  (deltaRows) => {
47389
- const state = scrollCoalesceRef.current;
47390
- const reversed = accumulateDirectionalScrollDelta(state, deltaRows);
47391
- if (reversed && state.timer) {
47392
- clearTimeout(state.timer);
47393
- state.timer = null;
47394
- }
47395
- if (state.timer) return;
47396
- const rows2 = state.pendingRows;
47397
- state.pendingRows = 0;
47407
+ const state2 = scrollCoalesceRef.current;
47408
+ const reversed = accumulateDirectionalScrollDelta(state2, deltaRows);
47409
+ if (reversed && state2.timer) {
47410
+ clearTimeout(state2.timer);
47411
+ state2.timer = null;
47412
+ }
47413
+ if (state2.timer) return;
47414
+ const rows2 = state2.pendingRows;
47415
+ state2.pendingRows = 0;
47398
47416
  scrollTranscriptRows(rows2);
47399
- state.timer = setTimeout(() => {
47400
- state.timer = null;
47401
- state.direction = 0;
47402
- if (state.pendingRows !== 0) {
47403
- const remaining = state.pendingRows;
47404
- state.pendingRows = 0;
47417
+ state2.timer = setTimeout(() => {
47418
+ state2.timer = null;
47419
+ state2.direction = 0;
47420
+ if (state2.pendingRows !== 0) {
47421
+ const remaining = state2.pendingRows;
47422
+ state2.pendingRows = 0;
47405
47423
  scrollTranscriptRows(remaining);
47406
47424
  }
47407
47425
  }, SCROLL_COALESCE_MS);
47408
- state.timer.unref?.();
47426
+ state2.timer.unref?.();
47409
47427
  },
47410
47428
  [scrollTranscriptRows]
47411
47429
  );
@@ -48952,7 +48970,7 @@ function cleanRightMessage(value) {
48952
48970
  }
48953
48971
 
48954
48972
  // src/tui/app/use-welcome-prompt-hint.mjs
48955
- function useWelcomePromptHint({ store, state, toastErrorSignature }) {
48973
+ function useWelcomePromptHint({ store, state: state2, toastErrorSignature }) {
48956
48974
  const [welcomePromptHintDismissed, setWelcomePromptHintDismissed] = useState14(false);
48957
48975
  const [conditionalWelcomePromptHint, setConditionalWelcomePromptHint] = useState14("");
48958
48976
  const welcomePromptHintRef = useRef18(null);
@@ -48983,8 +49001,8 @@ function useWelcomePromptHint({ store, state, toastErrorSignature }) {
48983
49001
  } catch {
48984
49002
  }
48985
49003
  if (!next) {
48986
- const activeProvider = String(state.provider || "").trim();
48987
- const activeModel = String(state.model || "").trim();
49004
+ const activeProvider = String(state2.provider || "").trim();
49005
+ const activeModel = String(state2.model || "").trim();
48988
49006
  if (!activeProvider || !activeModel) {
48989
49007
  next = CONDITIONAL_WELCOME_PROMPT_HINTS.noModel;
48990
49008
  } else {
@@ -48999,10 +49017,10 @@ function useWelcomePromptHint({ store, state, toastErrorSignature }) {
48999
49017
  }
49000
49018
  let activeWorkflow = null;
49001
49019
  try {
49002
- activeWorkflow = await activeWorkflowSummaryForStore(store, state.workflow || {});
49020
+ activeWorkflow = await activeWorkflowSummaryForStore(store, state2.workflow || {});
49003
49021
  } catch {
49004
49022
  }
49005
- if (!next && String(activeWorkflow?.id || state.workflow?.id || "").toLowerCase() === "solo") {
49023
+ if (!next && String(activeWorkflow?.id || state2.workflow?.id || "").toLowerCase() === "solo") {
49006
49024
  next = CONDITIONAL_WELCOME_PROMPT_HINTS.soloWorkflow;
49007
49025
  }
49008
49026
  if (!next) {
@@ -49017,7 +49035,7 @@ function useWelcomePromptHint({ store, state, toastErrorSignature }) {
49017
49035
  if (defaultWebSearchRoute) {
49018
49036
  try {
49019
49037
  const models = await listQuickModels();
49020
- const current = Array.isArray(models) ? models.find((model) => model?.provider === state.provider && model?.id === state.model) : null;
49038
+ const current = Array.isArray(models) ? models.find((model) => model?.provider === state2.provider && model?.id === state2.model) : null;
49021
49039
  if (current && current.supportsWebSearch !== true) {
49022
49040
  next = CONDITIONAL_WELCOME_PROMPT_HINTS.webSearchDefaultUnsupported;
49023
49041
  }
@@ -49035,7 +49053,7 @@ function useWelcomePromptHint({ store, state, toastErrorSignature }) {
49035
49053
  return () => {
49036
49054
  alive = false;
49037
49055
  };
49038
- }, [store, state.provider, state.model, state.workflow?.id, toastErrorSignature]);
49056
+ }, [store, state2.provider, state2.model, state2.workflow?.id, toastErrorSignature]);
49039
49057
  return {
49040
49058
  welcomePromptHintDismissed,
49041
49059
  conditionalWelcomePromptHint,
@@ -49175,7 +49193,7 @@ function compactBufferTokens(compaction, compactBoundary, compactTrigger) {
49175
49193
  if (compactBoundary && compactTrigger) return Math.max(0, compactBoundary - compactTrigger);
49176
49194
  return null;
49177
49195
  }
49178
- function contextMetrics({ toolsStatus, mcpStatus, skillsStatus, pluginsStatus, contextStatus, state }) {
49196
+ function contextMetrics({ toolsStatus, mcpStatus, skillsStatus, pluginsStatus, contextStatus, state: state2 }) {
49179
49197
  const tools = toolsStatus || EMPTY_TOOLS;
49180
49198
  const mcp = mcpStatus || EMPTY_MCP;
49181
49199
  const skills = skillsStatus || { count: 0 };
@@ -49188,9 +49206,9 @@ function contextMetrics({ toolsStatus, mcpStatus, skillsStatus, pluginsStatus, c
49188
49206
  const schemaTokensFor = (buckets) => buckets.reduce((sum, bucket) => sum + Number(schemaBreakdown?.[bucket]?.tokens || 0), 0);
49189
49207
  const compaction = context.compaction || {};
49190
49208
  const windowTokens = Number(
49191
- context.effectiveContextWindow || context.contextWindow || state.contextWindow || context.rawContextWindow || state.rawContextWindow || 0
49209
+ context.effectiveContextWindow || context.contextWindow || state2.contextWindow || context.rawContextWindow || state2.rawContextWindow || 0
49192
49210
  );
49193
- const rawWindowTokens = Number(context.rawContextWindow || state.rawContextWindow || windowTokens || 0);
49211
+ const rawWindowTokens = Number(context.rawContextWindow || state2.rawContextWindow || windowTokens || 0);
49194
49212
  const compactBoundary = Number(compaction.boundaryTokens || windowTokens || 0);
49195
49213
  const compactTrigger = Number(compaction.triggerTokens || compactBoundary || 0);
49196
49214
  const measured = measuredContextUsage({ stats: contextMeasurementStats(context), contextWindow: windowTokens });
@@ -49427,7 +49445,7 @@ function createUsagePanelOpener({ store, surface, setProviderPrompt, setSettings
49427
49445
  // src/tui/app/usage-context-panels.mjs
49428
49446
  function createUsageContextPanels({
49429
49447
  store,
49430
- state,
49448
+ state: state2,
49431
49449
  surface,
49432
49450
  setProviderPrompt,
49433
49451
  setSettingsPrompt,
@@ -49457,7 +49475,7 @@ function createUsageContextPanels({
49457
49475
  pluginsStatus,
49458
49476
  contextStatus,
49459
49477
  sessionUsage,
49460
- state
49478
+ state: state2
49461
49479
  });
49462
49480
  if (!own.owns()) return;
49463
49481
  setProviderPrompt(null);
@@ -49943,8 +49961,8 @@ var SETTINGS_PROMPTS = {
49943
49961
  "core-delete-confirm": coreDeleteConfirm
49944
49962
  };
49945
49963
  function submitSettingsPrompt(ctx, settingsPrompt, commandText) {
49946
- const { store, state, settingsWrite } = ctx;
49947
- if (state.commandBusy) {
49964
+ const { store, state: state2, settingsWrite } = ctx;
49965
+ if (state2.commandBusy) {
49948
49966
  store.pushNotice("wait for the current command to finish", "warn");
49949
49967
  return false;
49950
49968
  }
@@ -49975,8 +49993,8 @@ function imageRestoreMeta(imageSnapshot) {
49975
49993
  );
49976
49994
  }
49977
49995
  function submitSlashCommand(ctx, commandText) {
49978
- const { store, state, runSlashCommand, clearPastedImagesSnapshot } = ctx;
49979
- if (state.commandBusy) {
49996
+ const { store, state: state2, runSlashCommand, clearPastedImagesSnapshot } = ctx;
49997
+ if (state2.commandBusy) {
49980
49998
  store.pushNotice("wait for the current command to finish", "warn");
49981
49999
  return false;
49982
50000
  }
@@ -49986,7 +50004,7 @@ function submitSlashCommand(ctx, commandText) {
49986
50004
  return accepted;
49987
50005
  }
49988
50006
  function submitChat(ctx, text) {
49989
- const { state, submitPrompt, armTranscriptFollow, clearPastedImagesSnapshot, clearPastedTextsSnapshot } = ctx;
50007
+ const { state: state2, submitPrompt, armTranscriptFollow, clearPastedImagesSnapshot, clearPastedTextsSnapshot } = ctx;
49990
50008
  const imageRefs = imageReferenceIds(text);
49991
50009
  const imageSnapshot = referencedSnapshot(ctx.pastedImagesRef, imageRefs);
49992
50010
  const hasImageSnapshot = Object.keys(imageSnapshot).length > 0;
@@ -50005,10 +50023,10 @@ function submitChat(ctx, text) {
50005
50023
  });
50006
50024
  if (accepted) {
50007
50025
  armTranscriptFollow();
50008
- if (imageRefs.size === 0 || !hasImageSnapshot && !state.busy) clearPastedImagesSnapshot();
50009
- else if (state.busy && hasImageSnapshot) clearPastedImagesSnapshot(imageSnapshot);
50010
- if (textRefs.size === 0 || !hasTextSnapshot && !state.busy) clearPastedTextsSnapshot();
50011
- else if (state.busy && hasTextSnapshot) clearPastedTextsSnapshot(textSnapshot);
50026
+ if (imageRefs.size === 0 || !hasImageSnapshot && !state2.busy) clearPastedImagesSnapshot();
50027
+ else if (state2.busy && hasImageSnapshot) clearPastedImagesSnapshot(imageSnapshot);
50028
+ if (textRefs.size === 0 || !hasTextSnapshot && !state2.busy) clearPastedTextsSnapshot();
50029
+ else if (state2.busy && hasTextSnapshot) clearPastedTextsSnapshot(textSnapshot);
50012
50030
  }
50013
50031
  return accepted;
50014
50032
  }
@@ -50080,7 +50098,7 @@ function deriveSurfaces({
50080
50098
  btwPanel,
50081
50099
  slashPaletteOpen,
50082
50100
  tuiReady,
50083
- state,
50101
+ state: state2,
50084
50102
  panelTransitionRef,
50085
50103
  projectBootInputLatchRef
50086
50104
  }) {
@@ -50091,7 +50109,7 @@ function deriveSurfaces({
50091
50109
  if (panelTransitionRef.current.signature.includes("picker:project") && !picker) {
50092
50110
  projectBootInputLatchRef.current = true;
50093
50111
  }
50094
- const bootSettling = !tuiReady && state.items.length === 0 && !hasFloatingPanel && !projectBootInputLatchRef.current;
50112
+ const bootSettling = !tuiReady && state2.items.length === 0 && !hasFloatingPanel && !projectBootInputLatchRef.current;
50095
50113
  const projectSelectionActive = picker?.kind === "project" || settingsPrompt?.kind === "project-new" || settingsPrompt?.kind === "project-create-confirm" || settingsPrompt?.kind === "project-rename";
50096
50114
  const inputBoxHidden = expandedOptionPanel || bootSettling;
50097
50115
  return {
@@ -50104,17 +50122,17 @@ function deriveSurfaces({
50104
50122
  inputBoxHidden
50105
50123
  };
50106
50124
  }
50107
- function deriveLiveHints({ state, promptHint, promptHintTone }) {
50125
+ function deriveLiveHints({ state: state2, promptHint, promptHintTone }) {
50108
50126
  let liveSpinner = null;
50109
- if (state.spinner?.active) liveSpinner = state.spinner;
50110
- else if (state.commandStatus?.active) liveSpinner = state.commandStatus;
50111
- const liveSpinnerIsCommand = !state.spinner?.active && !!state.commandStatus?.active;
50112
- const latestToast = state.toasts?.length ? state.toasts[state.toasts.length - 1] : null;
50127
+ if (state2.spinner?.active) liveSpinner = state2.spinner;
50128
+ else if (state2.commandStatus?.active) liveSpinner = state2.commandStatus;
50129
+ const liveSpinnerIsCommand = !state2.spinner?.active && !!state2.commandStatus?.active;
50130
+ const latestToast = state2.toasts?.length ? state2.toasts[state2.toasts.length - 1] : null;
50113
50131
  const toastHint = latestToast ? latestToast.text : "";
50114
- const progressHint = state.progressHint || null;
50132
+ const progressHint = state2.progressHint || null;
50115
50133
  const inputHint = promptHint || toastHint || progressHint?.text || "";
50116
50134
  const inputHintTone = promptHint ? promptHintTone : latestToast?.tone || progressHint?.tone || "info";
50117
- const latestTranscriptItem = state.items[state.items.length - 1] || null;
50135
+ const latestTranscriptItem = state2.items[state2.items.length - 1] || null;
50118
50136
  return {
50119
50137
  liveSpinner,
50120
50138
  liveSpinnerIsCommand,
@@ -50335,20 +50353,20 @@ function textEntryBudget(textEntryPrompt, textEntryLayoutRows, frameColumns, max
50335
50353
  TEXT_ENTRY_ROWS: PANEL_CHROME_ROWS + textEntryContentRows + textEntryDetailRows
50336
50354
  };
50337
50355
  }
50338
- function queuedBudget(queuedVisible, state, resizeState, frameColumns) {
50339
- const queuedFullRows = queuedVisible ? state.queued.reduce(
50356
+ function queuedBudget(queuedVisible, state2, resizeState, frameColumns) {
50357
+ const queuedFullRows = queuedVisible ? state2.queued.reduce(
50340
50358
  (sum, item) => sum + queuedBandRows(String(item.displayText || item.text || ""), Math.max(1, frameColumns - 4)),
50341
50359
  0
50342
50360
  ) : 0;
50343
50361
  const queuedRowBudget = Math.max(3, Math.floor(resizeState.rows / 3));
50344
50362
  const queuedCompact = queuedFullRows > queuedRowBudget;
50345
50363
  let queuedRows = 0;
50346
- if (queuedVisible) queuedRows = queuedCompact ? state.queued.length : queuedFullRows;
50364
+ if (queuedVisible) queuedRows = queuedCompact ? state2.queued.length : queuedFullRows;
50347
50365
  return { queuedFullRows, queuedRowBudget, queuedCompact, queuedRows };
50348
50366
  }
50349
- function welcomeBudget({ slashPaletteOpen, resizeState, INPUT_BOX_ROWS, state, surfaces, onboardingActive }) {
50367
+ function welcomeBudget({ slashPaletteOpen, resizeState, INPUT_BOX_ROWS, state: state2, surfaces, onboardingActive }) {
50350
50368
  const slashKeepsWelcomeBanner = slashPaletteOpen && resizeState.rows >= WELCOME_BANNER_ROWS + SLASH_PALETTE_ROWS + INPUT_BOX_ROWS + STATUSLINE_ROWS + 1;
50351
- const showWelcomeBanner = state.items.length === 0 && (!surfaces.hasFloatingPanel || slashKeepsWelcomeBanner) || surfaces.projectSelectionActive || onboardingActive;
50369
+ const showWelcomeBanner = state2.items.length === 0 && (!surfaces.hasFloatingPanel || slashKeepsWelcomeBanner) || surfaces.projectSelectionActive || onboardingActive;
50352
50370
  return { slashKeepsWelcomeBanner, showWelcomeBanner, WELCOME_ROWS: showWelcomeBanner ? WELCOME_BANNER_ROWS : 0 };
50353
50371
  }
50354
50372
  function floatingPanelBudget({
@@ -50400,7 +50418,7 @@ function layoutSignature({ toolApproval, picker, contextPanel, usagePanel, slash
50400
50418
  function computeRowBudgets({
50401
50419
  surfaces,
50402
50420
  hints,
50403
- state,
50421
+ state: state2,
50404
50422
  resizeState,
50405
50423
  frameColumns,
50406
50424
  textEntryLayoutRows,
@@ -50418,21 +50436,21 @@ function computeRowBudgets({
50418
50436
  const { liveSpinner, liveSpinnerIsCommand, latestTranscriptItem, inputHint } = hints;
50419
50437
  const prompt = promptBoxBudget(inputBoxHidden, promptLayoutValueRef, promptContentColumns);
50420
50438
  const OPTION_PANEL_EXTRA_ROWS = expandedOptionPanel ? 3 : 0;
50421
- const queuedVisible = !hasFloatingPanel && !inputBoxHidden && state.queued?.length > 0;
50439
+ const queuedVisible = !hasFloatingPanel && !inputBoxHidden && state2.queued?.length > 0;
50422
50440
  const promptMetaVisible = isLiveSpinnerMetaVisible({
50423
50441
  inputBoxHidden,
50424
50442
  slashPaletteOpen,
50425
50443
  liveSpinner,
50426
50444
  liveSpinnerIsCommand,
50427
50445
  latestTranscriptItem,
50428
- streamingTail: state.streamingTail,
50429
- transcriptViewActive: Boolean(state.transcriptViewItems)
50446
+ streamingTail: state2.streamingTail,
50447
+ transcriptViewActive: Boolean(state2.transcriptViewItems)
50430
50448
  });
50431
50449
  const promptMetaRows = promptMetaVisible ? 2 : 0;
50432
50450
  const overlayHintRequested = !inputBoxHidden && !hasFloatingPanel && !liveSpinner && !!inputHint && !queuedVisible;
50433
- const queued = queuedBudget(queuedVisible, state, resizeState, frameColumns);
50451
+ const queued = queuedBudget(queuedVisible, state2, resizeState, frameColumns);
50434
50452
  const INPUT_BOX_ROWS = prompt.promptBoxRows + promptMetaRows + OVERLAY_HINT_ROWS;
50435
- const welcome = welcomeBudget({ slashPaletteOpen, resizeState, INPUT_BOX_ROWS, state, surfaces, onboardingActive });
50453
+ const welcome = welcomeBudget({ slashPaletteOpen, resizeState, INPUT_BOX_ROWS, state: state2, surfaces, onboardingActive });
50436
50454
  const baseReserve = welcome.WELCOME_ROWS + SCROLL_HINT_ROWS + LIVE_STATUS_ROWS + INPUT_BOX_ROWS + STATUSLINE_ROWS + queued.queuedRows;
50437
50455
  const maxFloatingPanelRows = Math.max(0, resizeState.rows - baseReserve - 1);
50438
50456
  const textEntry = textEntryBudget(textEntryPrompt, textEntryLayoutRows, frameColumns, maxFloatingPanelRows);
@@ -50514,7 +50532,7 @@ function sameCommitBackfillRows({ prevSignature, nextSignature, latestTranscript
50514
50532
  function resolvePanelTransition({
50515
50533
  budgets,
50516
50534
  hints,
50517
- state,
50535
+ state: state2,
50518
50536
  panelTransitionEpoch,
50519
50537
  panelTransitionRef,
50520
50538
  panelCloseInkMaskRowsRef
@@ -50526,7 +50544,7 @@ function resolvePanelTransition({
50526
50544
  let panelTransitionGuardRows = 0;
50527
50545
  if (panelLayoutChanged) {
50528
50546
  const panelShrinkRows = Math.max(0, panelTransition.reserve - bottomClusterRows);
50529
- const initialProjectEntryClose = state.items.length === 0;
50547
+ const initialProjectEntryClose = state2.items.length === 0;
50530
50548
  const promptRowsOnlyChange = panelShrinkRows > 0 && panelKindSignature(panelTransition.signature) === panelKindSignature(panelLayoutSignature);
50531
50549
  const instantPanelClose = panelShrinkRows > 0 && (promptRowsOnlyChange || isInstantPanelCloseTransition(panelTransition.signature, panelLayoutSignature, initialProjectEntryClose));
50532
50550
  const slashOpenOnEmptyTranscript = initialProjectEntryClose && !panelSignatureFlags(panelTransition.signature).slash && panelSignatureFlags(panelLayoutSignature).slash;
@@ -50573,7 +50591,7 @@ function carveViewport({
50573
50591
  surfaces,
50574
50592
  hints,
50575
50593
  transition,
50576
- state,
50594
+ state: state2,
50577
50595
  resizeState,
50578
50596
  conditionalWelcomePromptHint,
50579
50597
  welcomePromptHintDismissed,
@@ -50596,11 +50614,11 @@ function carveViewport({
50596
50614
  );
50597
50615
  const welcomePromptHintText = conditionalWelcomePromptHint || welcomePromptHintRef.current || "";
50598
50616
  const welcomePromptHintVisible = Boolean(
50599
- welcomePromptHintText && !welcomePromptHintDismissed && state.items.length === 0 && !hasFloatingPanel && !inputBoxHidden && !budgets.queuedVisible && !liveSpinner && !inputHint
50617
+ welcomePromptHintText && !welcomePromptHintDismissed && state2.items.length === 0 && !hasFloatingPanel && !inputBoxHidden && !budgets.queuedVisible && !liveSpinner && !inputHint
50600
50618
  );
50601
50619
  const welcomePromptHintRows = welcomePromptHintVisible && viewportHeight - transcriptGuardRows >= 2 ? 1 : 0;
50602
50620
  welcomePromptHintVisibleRef.current = welcomePromptHintRows > 0;
50603
- const overlayHintBandRows = budgets.overlayHintRequested && state.items.length === 0 && viewportHeight - transcriptGuardRows - welcomePromptHintRows >= 2 ? 1 : 0;
50621
+ const overlayHintBandRows = budgets.overlayHintRequested && state2.items.length === 0 && viewportHeight - transcriptGuardRows - welcomePromptHintRows >= 2 ? 1 : 0;
50604
50622
  const panelCloseMaskRows = Math.min(
50605
50623
  transition.panelCloseInkMaskRows,
50606
50624
  Math.max(0, viewportHeight - transcriptGuardRows - welcomePromptHintRows - overlayHintBandRows - 1)
@@ -53865,12 +53883,12 @@ function clampMouseOffset(value, offset) {
53865
53883
  }
53866
53884
  function createPromptMouseSelection({ coalesceRef, draftRef, contentWidthRef, commitDraft }) {
53867
53885
  const cancelMouseExtendCoalesce = () => {
53868
- const state = coalesceRef.current;
53869
- if (state.timer) {
53870
- clearTimeout(state.timer);
53871
- state.timer = null;
53886
+ const state2 = coalesceRef.current;
53887
+ if (state2.timer) {
53888
+ clearTimeout(state2.timer);
53889
+ state2.timer = null;
53872
53890
  }
53873
- state.pendingNext = null;
53891
+ state2.pendingNext = null;
53874
53892
  };
53875
53893
  const queueMouseExtendCommit = (next, immediate = false) => {
53876
53894
  if (immediate) {
@@ -53884,18 +53902,18 @@ function createPromptMouseSelection({ coalesceRef, draftRef, contentWidthRef, co
53884
53902
  commitDraft(next, { throttledRender: true });
53885
53903
  return;
53886
53904
  }
53887
- const state = coalesceRef.current;
53888
- state.pendingNext = next;
53905
+ const state2 = coalesceRef.current;
53906
+ state2.pendingNext = next;
53889
53907
  const now = Date.now();
53890
- const elapsed = now - state.t;
53908
+ const elapsed = now - state2.t;
53891
53909
  if (elapsed >= MOUSE_EXTEND_COALESCE_MS) {
53892
53910
  cancelMouseExtendCoalesce();
53893
- state.t = now;
53911
+ state2.t = now;
53894
53912
  commitDraft(next, { throttledRender: true });
53895
53913
  return;
53896
53914
  }
53897
- if (state.timer) return;
53898
- state.timer = setTimeout(
53915
+ if (state2.timer) return;
53916
+ state2.timer = setTimeout(
53899
53917
  () => {
53900
53918
  const current = coalesceRef.current;
53901
53919
  const pending = current.pendingNext;
@@ -53906,7 +53924,7 @@ function createPromptMouseSelection({ coalesceRef, draftRef, contentWidthRef, co
53906
53924
  },
53907
53925
  Math.max(1, MOUSE_EXTEND_COALESCE_MS - elapsed)
53908
53926
  );
53909
- state.timer.unref?.();
53927
+ state2.timer.unref?.();
53910
53928
  };
53911
53929
  return {
53912
53930
  offsetAtCell: (row, col) => offsetAtCell(draftRef.current.value, row, col, contentWidthRef.current),
@@ -54149,10 +54167,10 @@ function PromptInput({
54149
54167
  }
54150
54168
  useEffect23(
54151
54169
  () => () => {
54152
- const state = mouseExtendCoalesceRef.current;
54153
- if (state.timer) clearTimeout(state.timer);
54154
- state.timer = null;
54155
- state.pendingNext = null;
54170
+ const state2 = mouseExtendCoalesceRef.current;
54171
+ if (state2.timer) clearTimeout(state2.timer);
54172
+ state2.timer = null;
54173
+ state2.pendingNext = null;
54156
54174
  },
54157
54175
  []
54158
54176
  );
@@ -54979,15 +54997,15 @@ function cleanTyped(value) {
54979
54997
  }
54980
54998
  function QuestionPanel({ questions, columns = 80, rows: rows2, onSubmit, onDismiss }) {
54981
54999
  const { isRawModeSupported } = use_stdin_default();
54982
- const [state, setState] = useState20(() => ({
55000
+ const [state2, setState] = useState20(() => ({
54983
55001
  qi: 0,
54984
55002
  cursors: questions.map(initialCursor),
54985
55003
  drafts: questions.map(() => ({ selected: [], text: "" })),
54986
55004
  typing: false,
54987
55005
  buf: ""
54988
55006
  }));
54989
- const ref = useRef24(state);
54990
- ref.current = state;
55007
+ const ref = useRef24(state2);
55008
+ ref.current = state2;
54991
55009
  const commit = (next) => {
54992
55010
  ref.current = next;
54993
55011
  setState(next);
@@ -55076,18 +55094,18 @@ function QuestionPanel({ questions, columns = 80, rows: rows2, onSubmit, onDismi
55076
55094
  },
55077
55095
  { isActive: isRawModeSupported }
55078
55096
  );
55079
- const question = questions[state.qi];
55097
+ const question = questions[state2.qi];
55080
55098
  const multi = question.multi_select === true;
55081
55099
  const layout = optionLayout(question, columns);
55082
55100
  const n = question.options.length;
55083
- const cursor = state.cursors[state.qi];
55084
- const draft = state.drafts[state.qi];
55101
+ const cursor = state2.cursors[state2.qi];
55102
+ const draft = state2.drafts[state2.qi];
55085
55103
  const avail = layout.avail;
55086
- const title = questions.length > 1 ? `Question ${state.qi + 1}/${questions.length}` : "Question";
55104
+ const title = questions.length > 1 ? `Question ${state2.qi + 1}/${questions.length}` : "Question";
55087
55105
  const tabs = questions.length > 1 ? questions.map((q, i) => ({
55088
55106
  text: truncatePanelText(String(q.header || `Q${i + 1}`), MAX_TAB_CELLS),
55089
- answered: answerFor(q, state.drafts[i]) !== null,
55090
- current: i === state.qi
55107
+ answered: answerFor(q, state2.drafts[i]) !== null,
55108
+ current: i === state2.qi
55091
55109
  })) : [];
55092
55110
  const indexText = (i) => padPanelCells(`${i + 1}.`, layout.indexCells - 1) + " ";
55093
55111
  const renderLine = (selected, children, key) => {
@@ -55121,9 +55139,9 @@ function QuestionPanel({ questions, columns = 80, rows: rows2, onSubmit, onDismi
55121
55139
  const customLead = `${customSelected ? "\u203A " : " "}${indexText(n)}`;
55122
55140
  const markerPad = multi ? " " : "";
55123
55141
  let customBody;
55124
- if (state.typing) {
55142
+ if (state2.typing) {
55125
55143
  const room = Math.max(1, avail - stringWidth10(customLead) - stringWidth10(markerPad) - 1);
55126
- let shown = Array.from(state.buf).slice(-room).join("");
55144
+ let shown = Array.from(state2.buf).slice(-room).join("");
55127
55145
  while (stringWidth10(shown) > room) shown = Array.from(shown).slice(1).join("");
55128
55146
  customBody = `${shown}\u258C`;
55129
55147
  } else if (draft.text) {
@@ -55131,13 +55149,13 @@ function QuestionPanel({ questions, columns = 80, rows: rows2, onSubmit, onDismi
55131
55149
  } else {
55132
55150
  customBody = CUSTOM_LABEL;
55133
55151
  }
55134
- const customColor = customSelected ? theme.selectionText : draft.text && !state.typing ? theme.text : theme.inactive;
55152
+ const customColor = customSelected ? theme.selectionText : draft.text && !state2.typing ? theme.text : theme.inactive;
55135
55153
  const customRow = () => renderLine(
55136
55154
  customSelected,
55137
55155
  /* @__PURE__ */ jsxs10(Fragment4, { children: [
55138
55156
  customLead,
55139
55157
  markerPad,
55140
- /* @__PURE__ */ jsx12(Text, { color: state.typing ? void 0 : customColor, children: customBody }),
55158
+ /* @__PURE__ */ jsx12(Text, { color: state2.typing ? void 0 : customColor, children: customBody }),
55141
55159
  customSelected ? " ".repeat(Math.max(0, avail - stringWidth10(customLead + markerPad + customBody))) : ""
55142
55160
  ] }),
55143
55161
  "custom"
@@ -55151,8 +55169,8 @@ function QuestionPanel({ questions, columns = 80, rows: rows2, onSubmit, onDismi
55151
55169
  if (plan.below > 0) out.push(moreRow("below", `\u2193 ${plan.below} more`));
55152
55170
  const help = questionHelp({
55153
55171
  multi,
55154
- typing: state.typing,
55155
- last: state.qi >= last,
55172
+ typing: state2.typing,
55173
+ last: state2.qi >= last,
55156
55174
  count: n,
55157
55175
  questionCount: questions.length
55158
55176
  });
@@ -56051,8 +56069,8 @@ function defaultState(defaultColor) {
56051
56069
  inverse: false
56052
56070
  };
56053
56071
  }
56054
- function cloneState(state) {
56055
- return { ...state };
56072
+ function cloneState(state2) {
56073
+ return { ...state2 };
56056
56074
  }
56057
56075
  var ANSI_256_NAMED = [30, 31, 32, 33, 34, 35, 36, 37, 90, 91, 92, 93, 94, 95, 96, 97];
56058
56076
  var ANSI_256_NAMED_BG = [40, 41, 42, 43, 44, 45, 46, 47, 100, 101, 102, 103, 104, 105, 106, 107];
@@ -56081,41 +56099,41 @@ function extendedColor(codes, index, palette) {
56081
56099
  }
56082
56100
  return null;
56083
56101
  }
56084
- function applySgr(state, codes, defaultColor, ansiColors) {
56102
+ function applySgr(state2, codes, defaultColor, ansiColors) {
56085
56103
  if (!codes.length) codes = [0];
56086
56104
  for (let i = 0; i < codes.length; i++) {
56087
56105
  const code = codes[i];
56088
56106
  switch (code) {
56089
56107
  case 0:
56090
- Object.assign(state, defaultState(defaultColor));
56108
+ Object.assign(state2, defaultState(defaultColor));
56091
56109
  break;
56092
56110
  case 1:
56093
- state.bold = true;
56111
+ state2.bold = true;
56094
56112
  break;
56095
56113
  case 2:
56096
- state.dimColor = true;
56114
+ state2.dimColor = true;
56097
56115
  break;
56098
56116
  case 3:
56099
- state.italic = true;
56117
+ state2.italic = true;
56100
56118
  break;
56101
56119
  case 4:
56102
- state.underline = true;
56120
+ state2.underline = true;
56103
56121
  break;
56104
56122
  case 7:
56105
- state.inverse = true;
56123
+ state2.inverse = true;
56106
56124
  break;
56107
56125
  case 22:
56108
- state.bold = false;
56109
- state.dimColor = false;
56126
+ state2.bold = false;
56127
+ state2.dimColor = false;
56110
56128
  break;
56111
56129
  case 23:
56112
- state.italic = false;
56130
+ state2.italic = false;
56113
56131
  break;
56114
56132
  case 24:
56115
- state.underline = false;
56133
+ state2.underline = false;
56116
56134
  break;
56117
56135
  case 27:
56118
- state.inverse = false;
56136
+ state2.inverse = false;
56119
56137
  break;
56120
56138
  case 38: {
56121
56139
  const resolved = extendedColor(
@@ -56124,7 +56142,7 @@ function applySgr(state, codes, defaultColor, ansiColors) {
56124
56142
  (value) => value < 16 ? ansiColors[ANSI_256_NAMED[value]] : xterm256Rgb(value)
56125
56143
  );
56126
56144
  if (resolved) {
56127
- state.color = resolved.color;
56145
+ state2.color = resolved.color;
56128
56146
  i += resolved.consumed;
56129
56147
  }
56130
56148
  break;
@@ -56136,22 +56154,22 @@ function applySgr(state, codes, defaultColor, ansiColors) {
56136
56154
  (value) => value < 16 ? ANSI_BG_COLORS[ANSI_256_NAMED_BG[value]] : xterm256Rgb(value)
56137
56155
  );
56138
56156
  if (resolved) {
56139
- state.backgroundColor = resolved.color;
56157
+ state2.backgroundColor = resolved.color;
56140
56158
  i += resolved.consumed;
56141
56159
  }
56142
56160
  break;
56143
56161
  }
56144
56162
  case 39:
56145
- state.color = defaultColor;
56163
+ state2.color = defaultColor;
56146
56164
  break;
56147
56165
  case 49:
56148
- state.backgroundColor = void 0;
56166
+ state2.backgroundColor = void 0;
56149
56167
  break;
56150
56168
  default:
56151
56169
  if (ansiColors[code]) {
56152
- state.color = ansiColors[code];
56170
+ state2.color = ansiColors[code];
56153
56171
  } else if (ANSI_BG_COLORS[code]) {
56154
- state.backgroundColor = ANSI_BG_COLORS[code];
56172
+ state2.backgroundColor = ANSI_BG_COLORS[code];
56155
56173
  }
56156
56174
  break;
56157
56175
  }
@@ -56160,19 +56178,19 @@ function applySgr(state, codes, defaultColor, ansiColors) {
56160
56178
  function parseAnsi(text, defaultColor) {
56161
56179
  const source = String(text ?? "");
56162
56180
  const spans = [];
56163
- const state = defaultState(defaultColor);
56181
+ const state2 = defaultState(defaultColor);
56164
56182
  const ansiColors = ansiColorMap();
56165
56183
  let lastIndex = 0;
56166
56184
  for (const match of source.matchAll(ANSI_RE2)) {
56167
56185
  if (match.index > lastIndex) {
56168
- spans.push({ text: source.slice(lastIndex, match.index), style: cloneState(state) });
56186
+ spans.push({ text: source.slice(lastIndex, match.index), style: cloneState(state2) });
56169
56187
  }
56170
56188
  const codes = String(match[1] || "").split(";").filter(Boolean).map((n) => Number(n));
56171
- applySgr(state, codes, defaultColor, ansiColors);
56189
+ applySgr(state2, codes, defaultColor, ansiColors);
56172
56190
  lastIndex = match.index + match[0].length;
56173
56191
  }
56174
56192
  if (lastIndex < source.length) {
56175
- spans.push({ text: source.slice(lastIndex), style: cloneState(state) });
56193
+ spans.push({ text: source.slice(lastIndex), style: cloneState(state2) });
56176
56194
  }
56177
56195
  return spans;
56178
56196
  }
@@ -56859,7 +56877,7 @@ function renderPicker({
56859
56877
  frameColumns,
56860
56878
  pickerVisibleRows,
56861
56879
  expandedOptionPanel,
56862
- state
56880
+ state: state2
56863
56881
  }) {
56864
56882
  return /* @__PURE__ */ jsx22(
56865
56883
  Picker,
@@ -56896,7 +56914,7 @@ function renderPicker({
56896
56914
  visibleCount: pickerVisibleRows,
56897
56915
  fillHeight: expandedOptionPanel,
56898
56916
  loading: picker.loading === true,
56899
- themeEpoch: state.themeEpoch || 0,
56917
+ themeEpoch: state2.themeEpoch || 0,
56900
56918
  confirmBar: picker.confirmBar
56901
56919
  },
56902
56920
  picker.pickerKey
@@ -57743,7 +57761,7 @@ function renderTranscriptRows(ctx) {
57743
57761
  overlayHintAttachItemIndex,
57744
57762
  overlayHintOnLastItem,
57745
57763
  renderedTranscriptItems,
57746
- state,
57764
+ state: state2,
57747
57765
  toolOutputExpanded,
57748
57766
  transcriptContentHeight,
57749
57767
  transcriptMeasureRef,
@@ -57768,14 +57786,14 @@ function renderTranscriptRows(ctx) {
57768
57786
  Item,
57769
57787
  {
57770
57788
  item,
57771
- prevKind: i > 0 ? arr[i - 1].kind : (state.transcriptViewItems || state.items)[transcriptWindow.startIndex - 1]?.kind ?? null,
57789
+ prevKind: i > 0 ? arr[i - 1].kind : (state2.transcriptViewItems || state2.items)[transcriptWindow.startIndex - 1]?.kind ?? null,
57772
57790
  columns: frameColumns,
57773
57791
  toolOutputExpanded,
57774
57792
  rightMessage: attachOverlayHint ? inputHint : "",
57775
57793
  rightTone: attachOverlayHint ? inputHintTone : "info",
57776
57794
  rightMessageWidth: attachOverlayHint ? guardHintWidth || transientStatusWidth || 24 : 24,
57777
- themeEpoch: state.themeEpoch || 0,
57778
- streamingWindowRows: transcriptTailPinned && item.id === state.streamingTail?.id ? transcriptContentHeight + TRANSCRIPT_WINDOW_TAIL_OVERSCAN_ROWS : 0
57795
+ themeEpoch: state2.themeEpoch || 0,
57796
+ streamingWindowRows: transcriptTailPinned && item.id === state2.streamingTail?.id ? transcriptContentHeight + TRANSCRIPT_WINDOW_TAIL_OVERSCAN_ROWS : 0
57779
57797
  }
57780
57798
  );
57781
57799
  return measureRef ? /* @__PURE__ */ jsx31(Box_default, { ref: measureRef, flexDirection: "column", flexShrink: 0, children: itemNode }, item.id) : /* @__PURE__ */ jsx31(React18.Fragment, { children: itemNode }, item.id);
@@ -57967,7 +57985,7 @@ function renderAppView(ctx) {
57967
57985
  showWelcomeBanner,
57968
57986
  slashCommands,
57969
57987
  slashPaletteOpen,
57970
- state,
57988
+ state: state2,
57971
57989
  statuslineStats,
57972
57990
  toolApproval,
57973
57991
  transientStatusWidth,
@@ -57980,7 +57998,7 @@ function renderAppView(ctx) {
57980
57998
  disabled: exiting || !!picker || !!contextPanel || !!toolApproval || !tuiReady,
57981
57999
  onDraftChange: onPromptDraftChange,
57982
58000
  onCaretChange: onPromptCaretChange,
57983
- interruptActive: state.busy,
58001
+ interruptActive: state2.busy,
57984
58002
  onInterrupt: handlePromptInterrupt,
57985
58003
  initialValue: promptDraft,
57986
58004
  draftOverride: promptDraftOverride,
@@ -58007,7 +58025,7 @@ function renderAppView(ctx) {
58007
58025
  onCommandPaletteCancel: cancelSlashPalette,
58008
58026
  onCommandPaletteComplete: completeSlashPalette,
58009
58027
  onRestoreQueued: restoreQueuedToPrompt,
58010
- hasQueuedMessages: Array.isArray(state.queued) && state.queued.length > 0,
58028
+ hasQueuedMessages: Array.isArray(state2.queued) && state2.queued.length > 0,
58011
58029
  hasMessages: hasUserMessages
58012
58030
  }
58013
58031
  );
@@ -58017,14 +58035,14 @@ function renderAppView(ctx) {
58017
58035
  verb: liveSpinner.verb,
58018
58036
  startedAt: liveSpinner.startedAt,
58019
58037
  outputTokens: liveSpinner?.outputTokens ?? liveSpinner?.tokens ?? 0,
58020
- thinking: !!(state.thinking || liveSpinner?.thinking),
58038
+ thinking: !!(state2.thinking || liveSpinner?.thinking),
58021
58039
  thinkingActiveSince: liveSpinner?.thinkingSegmentStartedAt ?? 0,
58022
58040
  thinkingMs: liveSpinner?.thinkingAccumulatedMs ?? 0,
58023
- effort: state.effort || "",
58041
+ effort: state2.effort || "",
58024
58042
  quiet: liveSpinner?.quiet ?? null,
58025
58043
  hasActiveTools: !!activeTools?.web_search?.count,
58026
58044
  paused: !!toolApproval,
58027
- interruptible: !!(state.busy && state.spinner?.active),
58045
+ interruptible: !!(state2.busy && state2.spinner?.active),
58028
58046
  mode: liveSpinner?.mode || "responding",
58029
58047
  columns: promptSpinnerColumns,
58030
58048
  marginTop: 0
@@ -58049,7 +58067,7 @@ function renderAppView(ctx) {
58049
58067
  ),
58050
58068
  /* @__PURE__ */ jsx34(Box_default, { height: 1, width: "100%", backgroundColor: surfaceBackground() })
58051
58069
  ] }) : null;
58052
- const queuedRow = queuedVisible ? /* @__PURE__ */ jsx34(QueuedCommands, { queued: state.queued, columns: frameColumns, compact: queuedCompact }) : null;
58070
+ const queuedRow = queuedVisible ? /* @__PURE__ */ jsx34(QueuedCommands, { queued: state2.queued, columns: frameColumns, compact: queuedCompact }) : null;
58053
58071
  return (
58054
58072
  // Fullscreen layout: a full-height column (height = terminal rows) pins the
58055
58073
  // input cluster + statusline to the physical bottom (flexShrink={0}), while
@@ -58058,7 +58076,7 @@ function renderAppView(ctx) {
58058
58076
  // stack to the bottom; the transcript itself is a fixed-height clipping
58059
58077
  // viewport (see viewportHeight above).
58060
58078
  /* @__PURE__ */ jsxs29(Box_default, { flexDirection: "column", width: frameColumns, height: resizeState.rows, backgroundColor: surfaceBackground(), children: [
58061
- showWelcomeBanner ? renderWelcomeBanner({ frameColumns, cwd: state.cwd }) : null,
58079
+ showWelcomeBanner ? renderWelcomeBanner({ frameColumns, cwd: state2.cwd }) : null,
58062
58080
  renderTranscriptViewport(ctx),
58063
58081
  /* @__PURE__ */ jsxs29(Box_default, { flexDirection: "column", flexShrink: 0, width: "100%", backgroundColor: surfaceBackground(), children: [
58064
58082
  panelTransitionClearRows > 0 ? /* @__PURE__ */ jsx34(
@@ -58104,28 +58122,28 @@ function renderAppView(ctx) {
58104
58122
  /* @__PURE__ */ jsx34(
58105
58123
  StatusLine,
58106
58124
  {
58107
- sessionId: state.sessionId,
58108
- clientHostPid: state.clientHostPid,
58109
- provider: state.provider,
58110
- model: state.model,
58111
- effort: state.effort,
58112
- fast: state.fast,
58113
- ultra: state.fast === true && state.modelParameters?.serviceTier === "ultrafast",
58114
- cwd: state.cwd,
58125
+ sessionId: state2.sessionId,
58126
+ clientHostPid: state2.clientHostPid,
58127
+ provider: state2.provider,
58128
+ model: state2.model,
58129
+ effort: state2.effort,
58130
+ fast: state2.fast,
58131
+ ultra: state2.fast === true && state2.modelParameters?.serviceTier === "ultrafast",
58132
+ cwd: state2.cwd,
58115
58133
  stats: statuslineStats,
58116
- contextWindow: state.contextWindow,
58117
- displayContextWindow: state.displayContextWindow,
58118
- compactBoundaryTokens: state.compactBoundaryTokens,
58119
- autoCompactTokenLimit: state.autoCompactTokenLimit,
58120
- rawContextWindow: state.rawContextWindow,
58134
+ contextWindow: state2.contextWindow,
58135
+ displayContextWindow: state2.displayContextWindow,
58136
+ compactBoundaryTokens: state2.compactBoundaryTokens,
58137
+ autoCompactTokenLimit: state2.autoCompactTokenLimit,
58138
+ rawContextWindow: state2.rawContextWindow,
58121
58139
  resizeEpoch,
58122
58140
  agentRevision,
58123
- agentWorkers: state.agentWorkers,
58124
- agentJobs: state.agentJobs,
58141
+ agentWorkers: state2.agentWorkers,
58142
+ agentJobs: state2.agentJobs,
58125
58143
  activeTools,
58126
58144
  initialLine: initialStatusLine,
58127
- workflow: state.workflow,
58128
- themeEpoch: state.themeEpoch || 0
58145
+ workflow: state2.workflow,
58146
+ themeEpoch: state2.themeEpoch || 0
58129
58147
  }
58130
58148
  )
58131
58149
  ] })
@@ -58345,17 +58363,17 @@ function pendingCategoryHits(it, count) {
58345
58363
  }
58346
58364
  return hits;
58347
58365
  }
58348
- function useTranscriptActivity({ state }) {
58366
+ function useTranscriptActivity({ state: state2 }) {
58349
58367
  const agentRevision = useMemo5(
58350
58368
  () => JSON.stringify({
58351
- workers: (state.agentWorkers || []).map((w) => [w.tag, w.status, w.stage, w.sessionId]).slice(0, 20),
58352
- jobs: (state.agentJobs || []).map((j) => [j.task_id, j.status, j.tag, j.sessionId, j.startedAt, j.finishedAt, j.error]).slice(0, 20)
58369
+ workers: (state2.agentWorkers || []).map((w) => [w.tag, w.status, w.stage, w.sessionId]).slice(0, 20),
58370
+ jobs: (state2.agentJobs || []).map((j) => [j.task_id, j.status, j.tag, j.sessionId, j.startedAt, j.finishedAt, j.error]).slice(0, 20)
58353
58371
  }),
58354
- [state.agentWorkers, state.agentJobs]
58372
+ [state2.agentWorkers, state2.agentJobs]
58355
58373
  );
58356
58374
  const activeToolsSignature = useMemo5(() => {
58357
- if (state.activeToolSummary !== void 0) return state.activeToolSummary || "";
58358
- const items = state.items || [];
58375
+ if (state2.activeToolSummary !== void 0) return state2.activeToolSummary || "";
58376
+ const items = state2.items || [];
58359
58377
  const counts = [0, 0, 0];
58360
58378
  const starts = [0, 0, 0];
58361
58379
  for (const it of items) {
@@ -58373,7 +58391,7 @@ function useTranscriptActivity({ state }) {
58373
58391
  }
58374
58392
  if (!counts.some(Boolean)) return "";
58375
58393
  return counts.map((total, slot) => `${total}:${starts[slot]}`).join(":");
58376
- }, [state.activeToolSummary, state.items]);
58394
+ }, [state2.activeToolSummary, state2.items]);
58377
58395
  const activeTools = useMemo5(() => {
58378
58396
  if (!activeToolsSignature) return null;
58379
58397
  const [hc, hs, sc, ss, ac, as] = activeToolsSignature.split(":").map((n) => Number(n) || 0);
@@ -58397,7 +58415,7 @@ function useTranscriptActivity({ state }) {
58397
58415
  cacheWriteTokens,
58398
58416
  promptTokens,
58399
58417
  turns
58400
- } = state.stats || {};
58418
+ } = state2.stats || {};
58401
58419
  const statuslineStats = useMemo5(
58402
58420
  () => ({
58403
58421
  currentContextSource: currentContextSource ?? null,
@@ -58436,7 +58454,7 @@ function useTranscriptActivity({ state }) {
58436
58454
  // src/tui/app/theme-effort-pickers.mjs
58437
58455
  var themeNotice = (applied) => `Theme set to ${applied?.label || applied?.id || "default"}`;
58438
58456
  function createThemeEffortPickers({
58439
- state,
58457
+ state: state2,
58440
58458
  store,
58441
58459
  surface,
58442
58460
  setProviderPrompt,
@@ -58539,12 +58557,12 @@ function createThemeEffortPickers({
58539
58557
  const own = surface.claim();
58540
58558
  setProviderPrompt(null);
58541
58559
  setSettingsPrompt(null);
58542
- const items = Array.isArray(state.effortOptions) ? state.effortOptions : [];
58560
+ const items = Array.isArray(state2.effortOptions) ? state2.effortOptions : [];
58543
58561
  if (!items.length) {
58544
58562
  store.pushNotice("Current model has no effort levels.", "warn");
58545
58563
  return;
58546
58564
  }
58547
- const current = state.effort || items[0]?.value || "";
58565
+ const current = state2.effort || items[0]?.value || "";
58548
58566
  const pickerItems = items.map((item) => ({
58549
58567
  ...item,
58550
58568
  marker: item?.value === current ? "\u2713" : "",
@@ -58557,7 +58575,7 @@ function createThemeEffortPickers({
58557
58575
  items: pickerItems,
58558
58576
  onSelect: (value) => {
58559
58577
  own.close();
58560
- const pendingTurn = state.busy ? " (applies from the next turn)" : "";
58578
+ const pendingTurn = state2.busy ? " (applies from the next turn)" : "";
58561
58579
  void store.setEffort(value).then(
58562
58580
  (result) => store.pushNotice(
58563
58581
  result ? `Effort set to ${result}${pendingTurn}` : "Effort switch is already running.",
@@ -60478,7 +60496,7 @@ function createModelsStep({
60478
60496
  return;
60479
60497
  }
60480
60498
  if (!stepData.hasAgents()) await stepData.loadAgents();
60481
- const state = onboardingRef.current;
60499
+ const state2 = onboardingRef.current;
60482
60500
  if (!own.owns()) return;
60483
60501
  setProviderPrompt(null);
60484
60502
  setSettingsPrompt(null);
@@ -60489,10 +60507,10 @@ function createModelsStep({
60489
60507
  labelWidth: 18,
60490
60508
  metaWidth: 33,
60491
60509
  items: modelsStepItems({
60492
- defaultRoute: state.defaultRoute,
60493
- webSearchRoute: state.webSearchRoute || null,
60494
- overrides: state.agentRoutes || {},
60495
- agents: state.agents || []
60510
+ defaultRoute: state2.defaultRoute,
60511
+ webSearchRoute: state2.webSearchRoute || null,
60512
+ overrides: state2.agentRoutes || {},
60513
+ agents: state2.agents || []
60496
60514
  }),
60497
60515
  confirmBar: {
60498
60516
  buttons: [
@@ -60551,20 +60569,20 @@ function routeStepDescription(isLead, isWebSearch, label) {
60551
60569
  return `Pick the model for ${label}, or Default to follow the Main Model.`;
60552
60570
  }
60553
60571
  var routeMatchesModel = (route, m) => route?.provider === m.provider && route?.model === m.id;
60554
- function currentRouteFor(state, target) {
60555
- if (target === "lead") return state.defaultRoute || null;
60556
- if (target === "webSearch") return state.webSearchRoute || null;
60557
- return state.agentRoutes?.[target] || null;
60572
+ function currentRouteFor(state2, target) {
60573
+ if (target === "lead") return state2.defaultRoute || null;
60574
+ if (target === "webSearch") return state2.webSearchRoute || null;
60575
+ return state2.agentRoutes?.[target] || null;
60558
60576
  }
60559
- function targetLabel(state, target) {
60577
+ function targetLabel(state2, target) {
60560
60578
  if (target === "lead") return "Main";
60561
60579
  if (target === "webSearch") return "Web Search";
60562
- return (state.agents || []).find((a) => a.id === target)?.label || target;
60580
+ return (state2.agents || []).find((a) => a.id === target)?.label || target;
60563
60581
  }
60564
- function roleModelItems({ target, models, state }) {
60582
+ function roleModelItems({ target, models, state: state2 }) {
60565
60583
  const isLead = target === "lead";
60566
60584
  const isWebSearch = target === "webSearch";
60567
- const currentRoute = currentRouteFor(state, target);
60585
+ const currentRoute = currentRouteFor(state2, target);
60568
60586
  const isUnset = isWebSearch ? !currentRoute || isWebSearchDefaultRoute(currentRoute) : !currentRoute;
60569
60587
  const modelItems = models.map((m) => ({
60570
60588
  value: `${m.provider}:${m.id}`,
@@ -60585,7 +60603,7 @@ function roleModelItems({ target, models, state }) {
60585
60603
  const matchIdx = models.findIndex((m) => routeMatchesModel(currentRoute, m));
60586
60604
  let initialIndex = isUnset || matchIdx < 0 ? 0 : matchIdx + 1;
60587
60605
  if (isLead) initialIndex = Math.max(0, matchIdx);
60588
- const label = targetLabel(state, target);
60606
+ const label = targetLabel(state2, target);
60589
60607
  return {
60590
60608
  title: `First Run \xB7 ${label}`,
60591
60609
  description: routeStepDescription(isLead, isWebSearch, label),
@@ -60593,22 +60611,22 @@ function roleModelItems({ target, models, state }) {
60593
60611
  items: isLead ? modelItems : [defaultItem, ...modelItems]
60594
60612
  };
60595
60613
  }
60596
- function applyRoleSelection(state, target, item) {
60614
+ function applyRoleSelection(state2, target, item) {
60597
60615
  if (item?._default) {
60598
60616
  if (target === "webSearch") {
60599
- state.webSearchRoute = { ...WEB_SEARCH_DEFAULT_ROUTE };
60617
+ state2.webSearchRoute = { ...WEB_SEARCH_DEFAULT_ROUTE };
60600
60618
  } else {
60601
- const nextOverrides = { ...state.agentRoutes || {} };
60619
+ const nextOverrides = { ...state2.agentRoutes || {} };
60602
60620
  delete nextOverrides[target];
60603
- state.agentRoutes = nextOverrides;
60621
+ state2.agentRoutes = nextOverrides;
60604
60622
  }
60605
60623
  return true;
60606
60624
  }
60607
60625
  const next = item?._model ? routeFromModel(item._model) : null;
60608
60626
  if (!next) return false;
60609
- if (target === "lead") state.defaultRoute = next;
60610
- else if (target === "webSearch") state.webSearchRoute = next;
60611
- else state.agentRoutes = { ...state.agentRoutes || {}, [target]: next };
60627
+ if (target === "lead") state2.defaultRoute = next;
60628
+ else if (target === "webSearch") state2.webSearchRoute = next;
60629
+ else state2.agentRoutes = { ...state2.agentRoutes || {}, [target]: next };
60612
60630
  return true;
60613
60631
  }
60614
60632
  function createRoleModelStep({ store, surface, onboardingRef, nav }) {
@@ -60640,12 +60658,12 @@ function createRoleModelStep({ store, surface, onboardingRef, nav }) {
60640
60658
  const own = surface.claim();
60641
60659
  const models = target === "webSearch" ? await loadWebSearchModels(own) : providerModels(own);
60642
60660
  if (!models) return;
60643
- const state = onboardingRef.current;
60661
+ const state2 = onboardingRef.current;
60644
60662
  if (!own.owns()) return;
60645
60663
  own.paint({
60646
- ...roleModelItems({ target, models, state }),
60664
+ ...roleModelItems({ target, models, state: state2 }),
60647
60665
  onSelect: (_value, item) => {
60648
- if (!applyRoleSelection(state, target, item)) store.pushNotice("select a provider model first", "warn");
60666
+ if (!applyRoleSelection(state2, target, item)) store.pushNotice("select a provider model first", "warn");
60649
60667
  void nav.openWorkflowStep();
60650
60668
  },
60651
60669
  onCancel: () => {
@@ -61507,14 +61525,14 @@ var preferredEffort = (values = []) => {
61507
61525
  };
61508
61526
  var effortItemsFor = (model) => Array.isArray(model?.effortOptions) && model.effortOptions.length > 0 ? model.effortOptions : [];
61509
61527
  var modelEffortValues = (model) => effortItemsFor(model).map((effort) => effort.value).filter(Boolean);
61510
- function createEffortSelection({ providerModels, state, currentRoute, isCurrentRoute, isStateRoute }) {
61528
+ function createEffortSelection({ providerModels, state: state2, currentRoute, isCurrentRoute, isStateRoute }) {
61511
61529
  const selectedEfforts = /* @__PURE__ */ new Map();
61512
61530
  const modelDefaultEffort = (model) => {
61513
61531
  const values = modelEffortValues(model);
61514
61532
  if (!values.length) return null;
61515
61533
  if (isCurrentRoute(model) && currentRoute.effort && values.includes(currentRoute.effort))
61516
61534
  return currentRoute.effort;
61517
- if (isStateRoute(model) && state.effort && values.includes(state.effort)) return state.effort;
61535
+ if (isStateRoute(model) && state2.effort && values.includes(state2.effort)) return state2.effort;
61518
61536
  if (model.savedEffort && values.includes(model.savedEffort)) return model.savedEffort;
61519
61537
  if (model.defaultEffort && values.includes(model.defaultEffort)) return model.defaultEffort;
61520
61538
  return preferredEffort(values);
@@ -61616,7 +61634,7 @@ function modelFooter(selection, model = null) {
61616
61634
  return {
61617
61635
  glyph: "\u25C7",
61618
61636
  color: theme.inactive,
61619
- text: `${parameter.label}: ${parameter.options?.find((option) => option.value === value)?.label || value} \xB7 T Toggle`
61637
+ text: `${parameter.label}: ${parameter.options?.find((option) => option.value === value)?.label || value} \xB7 ${parameter.id === "providerSort" ? "R Cycle" : "T Toggle"}`
61620
61638
  };
61621
61639
  });
61622
61640
  if (!values.length)
@@ -61636,7 +61654,7 @@ function modelFooter(selection, model = null) {
61636
61654
 
61637
61655
  // src/tui/app/model-picker/route-selection/context-window.mjs
61638
61656
  var clampPercent = (value) => Math.max(10, Math.min(100, value));
61639
- function createContextSelection({ state, currentRoute, isCurrentRoute, isStateRoute }) {
61657
+ function createContextSelection({ state: state2, currentRoute, isCurrentRoute, isStateRoute }) {
61640
61658
  const selectedContextPercent = /* @__PURE__ */ new Map();
61641
61659
  const contextSelectionFor = (model) => {
61642
61660
  const key = modelKey(model);
@@ -61649,7 +61667,7 @@ function createContextSelection({ state, currentRoute, isCurrentRoute, isStateRo
61649
61667
  if (isCurrentRoute(model)) {
61650
61668
  requested = currentRoute.contextPercent;
61651
61669
  } else if (isStateRoute(model)) {
61652
- requested = state.contextPercent;
61670
+ requested = state2.contextPercent;
61653
61671
  }
61654
61672
  const percent3 = Number.isFinite(Number(requested)) && Number(requested) > 0 ? clampPercent(Math.round(Number(requested) / 10) * 10) : defaultPercent;
61655
61673
  selectedContextPercent.set(key, percent3);
@@ -61670,9 +61688,23 @@ function createContextSelection({ state, currentRoute, isCurrentRoute, isStateRo
61670
61688
  return { contextSelectionFor, stepContext };
61671
61689
  }
61672
61690
 
61691
+ // src/runtime/agent/orchestrator/providers/openrouter-provider-routing.mjs
61692
+ var OPENROUTER_SORT_PARAMETER = "providerSort";
61693
+ var OPENROUTER_SORT_OPTION = Object.freeze({
61694
+ id: OPENROUTER_SORT_PARAMETER,
61695
+ label: "Routing",
61696
+ kind: "enum",
61697
+ options: [
61698
+ { value: "auto", label: "Auto" },
61699
+ { value: "price", label: "Price first" },
61700
+ { value: "throughput", label: "Speed first" },
61701
+ { value: "latency", label: "Latency first" }
61702
+ ]
61703
+ });
61704
+
61673
61705
  // src/tui/app/model-picker/route-selection/fast-parameters.mjs
61674
61706
  var TOGGLE_PARAMETER_IDS = /* @__PURE__ */ new Set(["thinking", DAYBREAK_PARAMETER_ID]);
61675
- function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isStateRoute, getSelectedEffort }) {
61707
+ function createFastParameterSelection({ state: state2, currentRoute, isCurrentRoute, isStateRoute, getSelectedEffort }) {
61676
61708
  const selectedFast = /* @__PURE__ */ new Map();
61677
61709
  const selectedModelParameters = /* @__PURE__ */ new Map();
61678
61710
  const modelParametersFor = (model) => {
@@ -61704,7 +61736,7 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
61704
61736
  const modelDefaultFast = (model) => {
61705
61737
  if (!fastAvailableFor(model)) return false;
61706
61738
  if (isCurrentRoute(model) && typeof currentRoute.fast === "boolean") return currentRoute.fast;
61707
- if (isStateRoute(model) && typeof state.fast === "boolean") return state.fast;
61739
+ if (isStateRoute(model) && typeof state2.fast === "boolean") return state2.fast;
61708
61740
  if (typeof model.savedFast === "boolean") return model.savedFast;
61709
61741
  return model.fastPreferred === true;
61710
61742
  };
@@ -61735,8 +61767,7 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
61735
61767
  else setSpeed(model, false, "priority");
61736
61768
  return true;
61737
61769
  };
61738
- const cycleThinking = (model) => {
61739
- const definition = (model.modelParameterOptions || []).find((parameter) => TOGGLE_PARAMETER_IDS.has(parameter.id));
61770
+ const cycleParameter = (model, definition) => {
61740
61771
  if (!definition?.options?.length) return false;
61741
61772
  const wanted = definition.id;
61742
61773
  const parameters = modelParametersFor(model);
@@ -61749,14 +61780,30 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
61749
61780
  if (!fastAvailableFor(model)) selectedFast.set(modelKey(model), false);
61750
61781
  return true;
61751
61782
  };
61752
- return { modelParametersFor, fastAvailableFor, getSelectedFast, isUltrafast, toggleFast, cycleThinking };
61783
+ const cycleThinking = (model) => cycleParameter(
61784
+ model,
61785
+ (model.modelParameterOptions || []).find((parameter) => TOGGLE_PARAMETER_IDS.has(parameter.id))
61786
+ );
61787
+ const cycleRouting = (model) => cycleParameter(
61788
+ model,
61789
+ (model.modelParameterOptions || []).find((parameter) => parameter.id === OPENROUTER_SORT_PARAMETER)
61790
+ );
61791
+ return {
61792
+ modelParametersFor,
61793
+ fastAvailableFor,
61794
+ getSelectedFast,
61795
+ isUltrafast,
61796
+ toggleFast,
61797
+ cycleThinking,
61798
+ cycleRouting
61799
+ };
61753
61800
  }
61754
61801
 
61755
61802
  // src/tui/app/model-picker/route-selection.mjs
61756
- function createRouteSelection({ providerModels, state, currentRoute }) {
61803
+ function createRouteSelection({ providerModels, state: state2, currentRoute }) {
61757
61804
  const isCurrentRoute = (model) => currentRoute?.provider === model.provider && currentRoute?.model === model.id;
61758
- const isStateRoute = (model) => model.provider === state.provider && model.id === state.model;
61759
- const seeds = { state, currentRoute, isCurrentRoute, isStateRoute };
61805
+ const isStateRoute = (model) => model.provider === state2.provider && model.id === state2.model;
61806
+ const seeds = { state: state2, currentRoute, isCurrentRoute, isStateRoute };
61760
61807
  const effort = createEffortSelection({ providerModels, ...seeds });
61761
61808
  const fast = createFastParameterSelection({ ...seeds, getSelectedEffort: effort.getSelectedEffort });
61762
61809
  const context = createContextSelection(seeds);
@@ -61792,12 +61839,13 @@ function createRouteSelection({ providerModels, state, currentRoute }) {
61792
61839
  toggleFast: fast.toggleFast,
61793
61840
  cycleEffort: effort.cycleEffort,
61794
61841
  cycleThinking: fast.cycleThinking,
61842
+ cycleRouting: fast.cycleRouting,
61795
61843
  routeInputFor
61796
61844
  };
61797
61845
  }
61798
61846
 
61799
61847
  // src/tui/app/model-picker/provider-models-list.mjs
61800
- var MODEL_LIST_HELP = "\u2191/\u2193 Select \xB7 \u2190/\u2192 Effort \xB7 C/Shift+C Context \xB7 Tab Fast \xB7 T Thinking \xB7 Enter Save";
61848
+ var MODEL_LIST_HELP = "\u2191/\u2193 Select \xB7 \u2190/\u2192 Effort \xB7 C/Shift+C Context \xB7 Tab Fast \xB7 T Thinking \xB7 R Routing \xB7 Enter Save";
61801
61849
  function saveSelectedRoute({
61802
61850
  store,
61803
61851
  options,
@@ -61837,9 +61885,9 @@ function saveSelectedRoute({
61837
61885
  });
61838
61886
  }
61839
61887
  function openProviderModelsPicker({ view, provider, onBack, saveRoute }) {
61840
- const { options, state, models, activeRoute, returnTo, returnLabel, returnOnNestedCancel, cancelModelPicker } = view;
61888
+ const { options, state: state2, models, activeRoute, returnTo, returnLabel, returnOnNestedCancel, cancelModelPicker } = view;
61841
61889
  const providerModels = models.filter((model) => model.provider === provider);
61842
- const selection = createRouteSelection({ providerModels, state, currentRoute: options.currentRoute || null });
61890
+ const selection = createRouteSelection({ providerModels, state: state2, currentRoute: options.currentRoute || null });
61843
61891
  const render2 = () => {
61844
61892
  const providerModelItems = buildProviderModelItems(models, provider, activeRoute);
61845
61893
  const providerModelInitialIndex = Math.max(
@@ -61873,11 +61921,15 @@ function openProviderModelsPicker({ view, provider, onBack, saveRoute }) {
61873
61921
  },
61874
61922
  onKey: (input, _key, item) => {
61875
61923
  const model = item?._model;
61876
- if (!model || !["c", "C", "t", "T"].includes(input)) return;
61924
+ if (!model || !["c", "C", "t", "T", "r", "R"].includes(input)) return;
61877
61925
  if (input.toLowerCase() === "c") {
61878
61926
  if (selection.stepContext(model, input === "C" ? -1 : 1)) render2();
61879
61927
  return;
61880
61928
  }
61929
+ if (input.toLowerCase() === "r") {
61930
+ if (selection.cycleRouting(model)) render2();
61931
+ return;
61932
+ }
61881
61933
  if (selection.cycleThinking(model)) render2();
61882
61934
  },
61883
61935
  onCancel: () => {
@@ -61904,7 +61956,7 @@ function createModelPicker({
61904
61956
  }) {
61905
61957
  const catalog = createModelCatalog({ store, providerModelsCacheRef, webSearchModelsCacheRef });
61906
61958
  const openModelPicker = async (options = {}) => {
61907
- const state = getState();
61959
+ const state2 = getState();
61908
61960
  const own = surface.claim();
61909
61961
  setProviderPrompt(null);
61910
61962
  setSettingsPrompt(null);
@@ -61947,16 +61999,16 @@ function createModelPicker({
61947
61999
  const providerNames = catalogProviderDisplayNames(models, await loadProviderDisplayNames(store));
61948
62000
  const catalogFailures = await loadProviderCatalogFailures(store);
61949
62001
  const activeRoute = options.currentRoute || {
61950
- provider: state.provider,
61951
- model: state.model,
61952
- effort: state.effort,
61953
- fast: state.fast,
61954
- modelParameters: state.modelParameters,
61955
- contextPercent: state.contextPercent
62002
+ provider: state2.provider,
62003
+ model: state2.model,
62004
+ effort: state2.effort,
62005
+ fast: state2.fast,
62006
+ modelParameters: state2.modelParameters,
62007
+ contextPercent: state2.contextPercent
61956
62008
  };
61957
62009
  const view = {
61958
62010
  options,
61959
- state,
62011
+ state: state2,
61960
62012
  models,
61961
62013
  activeRoute,
61962
62014
  providerNames,
@@ -63599,7 +63651,7 @@ var updateMeta = (upd = {}) => {
63599
63651
  if (!upd.currentVersion) return "unknown";
63600
63652
  return `${current} (latest)`;
63601
63653
  };
63602
- function readSettingsView({ snapshot, heavyCache, state }) {
63654
+ function readSettingsView({ snapshot, heavyCache, state: state2 }) {
63603
63655
  const autoClear = snapshot.autoClear || {};
63604
63656
  const toolModules = snapshot.toolModules || {};
63605
63657
  return {
@@ -63610,7 +63662,7 @@ function readSettingsView({ snapshot, heavyCache, state }) {
63610
63662
  memoryToolsOn: toolModules.memory?.enabled !== false,
63611
63663
  systemShell: snapshot.systemShell || { source: "auto", command: "", effective: "" },
63612
63664
  outputStyle: snapshot.outputStyle || {},
63613
- workflow: state.workflow || {},
63665
+ workflow: state2.workflow || {},
63614
63666
  mcp: heavyCache ? heavyCache.mcp : snapshot.mcp || { connectedCount: 0, configuredCount: 0, failedCount: 0 },
63615
63667
  plugins: heavyCache ? heavyCache.plugins : snapshot.plugins || { count: 0 },
63616
63668
  skills: heavyCache ? heavyCache.skills : snapshot.skills || { count: 0 }
@@ -63619,7 +63671,7 @@ function readSettingsView({ snapshot, heavyCache, state }) {
63619
63671
  function buildSettingsItems({
63620
63672
  snapshot,
63621
63673
  view,
63622
- state,
63674
+ state: state2,
63623
63675
  store,
63624
63676
  formatDuration: formatDuration2,
63625
63677
  displayModelName: displayModelName3,
@@ -63636,7 +63688,7 @@ function buildSettingsItems({
63636
63688
  {
63637
63689
  value: "model",
63638
63690
  label: "Model",
63639
- meta: displayModelName3(state.model, state.provider),
63691
+ meta: displayModelName3(state2.model, state2.provider),
63640
63692
  description: "Main chat model.",
63641
63693
  _action: "model"
63642
63694
  },
@@ -63955,7 +64007,7 @@ var heavyGateOf = (cacheRef) => {
63955
64007
  };
63956
64008
  function createSettingsPicker({
63957
64009
  store,
63958
- state,
64010
+ state: state2,
63959
64011
  surface,
63960
64012
  setProviderPrompt,
63961
64013
  setSettingsPrompt,
@@ -63984,7 +64036,7 @@ function createSettingsPicker({
63984
64036
  const gate = heavyGateOf(settingsHeavyCacheRef);
63985
64037
  const freshWritesAtStart = gate.freshWrites;
63986
64038
  const snapshot = await store.getSettingsSnapshot?.({ heavy: !heavyCache }) || {};
63987
- const view = readSettingsView({ snapshot, heavyCache, state });
64039
+ const view = readSettingsView({ snapshot, heavyCache, state: state2 });
63988
64040
  if (!isCurrentSettingsRequest(requestId)) {
63989
64041
  if (!heavyCache && own.owns() && gate.freshWrites === freshWritesAtStart) gate.queued = true;
63990
64042
  return;
@@ -64009,7 +64061,7 @@ function createSettingsPicker({
64009
64061
  const items = buildSettingsItems({
64010
64062
  snapshot,
64011
64063
  view,
64012
- state,
64064
+ state: state2,
64013
64065
  store,
64014
64066
  formatDuration: formatDuration2,
64015
64067
  displayModelName: displayModelName3,
@@ -64206,8 +64258,8 @@ var routeCommands = {
64206
64258
  return true;
64207
64259
  },
64208
64260
  outputstyle(ctx, arg) {
64209
- const { state, store, openSlashPanel, deps } = ctx;
64210
- if (state.busy) {
64261
+ const { state: state2, store, openSlashPanel, deps } = ctx;
64262
+ if (state2.busy) {
64211
64263
  store.pushNotice("wait for the current turn to finish before /OutputStyle", "warn");
64212
64264
  return false;
64213
64265
  }
@@ -64268,8 +64320,8 @@ var routeCommands = {
64268
64320
  return true;
64269
64321
  },
64270
64322
  effort(ctx, arg) {
64271
- const { state, store, openSlashPanel, deps } = ctx;
64272
- const pendingTurn = state.busy ? " (applies from the next turn)" : "";
64323
+ const { state: state2, store, openSlashPanel, deps } = ctx;
64324
+ const pendingTurn = state2.busy ? " (applies from the next turn)" : "";
64273
64325
  if (!arg) {
64274
64326
  openSlashPanel("effort", "Effort", () => deps.openEffortPicker());
64275
64327
  return true;
@@ -64283,7 +64335,7 @@ var routeCommands = {
64283
64335
  return true;
64284
64336
  },
64285
64337
  fast(ctx, arg) {
64286
- const { state, store } = ctx;
64338
+ const { state: state2, store } = ctx;
64287
64339
  const value = String(arg || "").trim().toLowerCase();
64288
64340
  let setTo = null;
64289
64341
  if (!value) setTo = void 0;
@@ -64303,7 +64355,7 @@ var routeCommands = {
64303
64355
  const fastModeLabel = enabled ? "Fast mode on" : "Fast mode off";
64304
64356
  const modeLabel = setTo === "ultrafast" ? "Ultrafast" : fastModeLabel;
64305
64357
  store.pushNotice(
64306
- `${modeLabel} for ${state.provider}/${state.model}` + (state.busy ? " (applies from the next turn)" : ""),
64358
+ `${modeLabel} for ${state2.provider}/${state2.model}` + (state2.busy ? " (applies from the next turn)" : ""),
64307
64359
  "info"
64308
64360
  );
64309
64361
  }).catch((e) => store.pushNotice(`Couldn\u2019t update fast mode: ${e?.message || e}`, "error"));
@@ -64331,8 +64383,8 @@ var refuseWhileBusy = (store, command) => {
64331
64383
  };
64332
64384
  var sessionCommands = {
64333
64385
  clear(ctx, _arg, rawName) {
64334
- const { state, store } = ctx;
64335
- if (state.busy || state.commandBusy) {
64386
+ const { state: state2, store } = ctx;
64387
+ if (state2.busy || state2.commandBusy) {
64336
64388
  store.pushNotice(
64337
64389
  `wait for the current session command to finish before /${rawName === "new" ? "new" : "clear"}`,
64338
64390
  "warn"
@@ -64353,8 +64405,8 @@ var sessionCommands = {
64353
64405
  return true;
64354
64406
  },
64355
64407
  compact(ctx) {
64356
- const { state, store } = ctx;
64357
- if (state.busy) return refuseWhileBusy(store, "compact");
64408
+ const { state: state2, store } = ctx;
64409
+ if (state2.busy) return refuseWhileBusy(store, "compact");
64358
64410
  void store.compact().then((r) => store.pushNotice(...compactOutcomeNotice(r))).catch((error) => store.pushNotice(compactFailureNotice(error), "error"));
64359
64411
  return true;
64360
64412
  },
@@ -64381,8 +64433,8 @@ var sessionCommands = {
64381
64433
  return true;
64382
64434
  },
64383
64435
  resume(ctx, arg) {
64384
- const { state, store, openSlashPanel, deps } = ctx;
64385
- if (state.busy) return refuseWhileBusy(store, "resume");
64436
+ const { state: state2, store, openSlashPanel, deps } = ctx;
64437
+ if (state2.busy) return refuseWhileBusy(store, "resume");
64386
64438
  if (arg) {
64387
64439
  void store.resume(arg).then((ok) => store.pushNotice(ok ? `Resumed ${arg}` : "Couldn\u2019t resume chat.", ok ? "info" : "warn")).catch((e) => store.pushNotice(`Couldn\u2019t resume chat: ${e?.message || e}`, "error"));
64388
64440
  } else {
@@ -64391,8 +64443,8 @@ var sessionCommands = {
64391
64443
  return true;
64392
64444
  },
64393
64445
  fork(ctx, _arg, rawName) {
64394
- const { state, store } = ctx;
64395
- if (state.busy) return refuseWhileBusy(store, rawName === "inherit" ? "inherit" : "fork");
64446
+ const { state: state2, store } = ctx;
64447
+ if (state2.busy) return refuseWhileBusy(store, rawName === "inherit" ? "inherit" : "fork");
64396
64448
  void Promise.resolve(store.inheritSession?.()).then((result) => {
64397
64449
  if (!result) {
64398
64450
  store.pushNotice("nothing to fork", "warn");
@@ -64478,8 +64530,8 @@ var sessionCommands = {
64478
64530
  return true;
64479
64531
  },
64480
64532
  doctor(ctx) {
64481
- const { state, store, deps } = ctx;
64482
- if (state.commandBusy) {
64533
+ const { state: state2, store, deps } = ctx;
64534
+ if (state2.commandBusy) {
64483
64535
  store.pushNotice("wait for the current command to finish before /doctor", "warn");
64484
64536
  return false;
64485
64537
  }
@@ -64534,8 +64586,8 @@ function createSlashPanelOpener({ surface, store }) {
64534
64586
 
64535
64587
  // src/tui/app/slash-dispatch.mjs
64536
64588
  var commands = { ...routeCommands, ...sessionCommands, ...panelCommands };
64537
- function createSlashDispatch({ state, store, normalizeSlashCommandName: normalizeSlashCommandName2, surface, closeUsagePanel, ...deps }) {
64538
- const ctx = { state, store, deps, surface, openSlashPanel: createSlashPanelOpener({ surface, store }) };
64589
+ function createSlashDispatch({ state: state2, store, normalizeSlashCommandName: normalizeSlashCommandName2, surface, closeUsagePanel, ...deps }) {
64590
+ const ctx = { state: state2, store, deps, surface, openSlashPanel: createSlashPanelOpener({ surface, store }) };
64539
64591
  const runSlashCommand = (cmd, arg = "") => {
64540
64592
  const rawName = String(cmd || "").toLowerCase();
64541
64593
  cmd = normalizeSlashCommandName2(cmd);
@@ -64553,7 +64605,7 @@ function createSlashDispatch({ state, store, normalizeSlashCommandName: normaliz
64553
64605
 
64554
64606
  // src/tui/app/create-app-pickers.mjs
64555
64607
  function createAppPickers({
64556
- state,
64608
+ state: state2,
64557
64609
  store,
64558
64610
  surface,
64559
64611
  setProviderPrompt,
@@ -64581,7 +64633,7 @@ function createAppPickers({
64581
64633
  openContextPicker
64582
64634
  }) {
64583
64635
  const { openThemePicker, openEffortPicker } = createThemeEffortPickers({
64584
- state,
64636
+ state: state2,
64585
64637
  store,
64586
64638
  surface,
64587
64639
  setProviderPrompt,
@@ -64659,7 +64711,7 @@ function createAppPickers({
64659
64711
  });
64660
64712
  const { openModelPicker } = createModelPicker({
64661
64713
  store,
64662
- getState: () => state,
64714
+ getState: () => state2,
64663
64715
  surface,
64664
64716
  setProviderPrompt,
64665
64717
  setSettingsPrompt,
@@ -64671,7 +64723,7 @@ function createAppPickers({
64671
64723
  });
64672
64724
  const { openWebSearchPicker, openAgentsPicker, openWorkflowPicker, openOutputStylePicker } = createRoutePickers({
64673
64725
  store,
64674
- state,
64726
+ state: state2,
64675
64727
  surface,
64676
64728
  setProviderPrompt,
64677
64729
  setSettingsPrompt,
@@ -64685,7 +64737,7 @@ function createAppPickers({
64685
64737
  });
64686
64738
  const { openSettingsPicker } = createSettingsPicker({
64687
64739
  store,
64688
- state,
64740
+ state: state2,
64689
64741
  surface,
64690
64742
  setProviderPrompt,
64691
64743
  setSettingsPrompt,
@@ -64715,7 +64767,7 @@ function createAppPickers({
64715
64767
  openDeveloperPicker: (...a) => openDeveloperPicker(...a)
64716
64768
  });
64717
64769
  const { runSlashCommand } = createSlashDispatch({
64718
- state,
64770
+ state: state2,
64719
64771
  store,
64720
64772
  normalizeSlashCommandName,
64721
64773
  surface,
@@ -64921,7 +64973,7 @@ function runRestoreQueuedToPrompt(options, deps) {
64921
64973
  // src/tui/app/use-prompt-queue-history.mjs
64922
64974
  function usePromptQueueHistory({
64923
64975
  store,
64924
- state,
64976
+ state: state2,
64925
64977
  exit,
64926
64978
  exitRequestedRef,
64927
64979
  setExiting,
@@ -64964,7 +65016,7 @@ function usePromptQueueHistory({
64964
65016
  const restoreQueuedToPrompt = useCallback19(
64965
65017
  (options = {}) => runRestoreQueuedToPrompt(options, {
64966
65018
  store,
64967
- queued: state?.queued,
65019
+ queued: state2?.queued,
64968
65020
  promptDraft,
64969
65021
  promptValueRef,
64970
65022
  inFlightRef: queuedRestoreInFlightRef,
@@ -64977,7 +65029,7 @@ function usePromptQueueHistory({
64977
65029
  }),
64978
65030
  [
64979
65031
  store,
64980
- state?.queued,
65032
+ state2?.queued,
64981
65033
  promptDraft,
64982
65034
  promptValueRef,
64983
65035
  showPromptHint,
@@ -64989,9 +65041,9 @@ function usePromptQueueHistory({
64989
65041
  ]
64990
65042
  );
64991
65043
  const recentPromptHistory = useMemo6(() => {
64992
- if (Array.isArray(state.promptHistoryList)) return state.promptHistoryList;
64993
- return scanPromptHistory(Array.isArray(state.items) ? state.items : []);
64994
- }, [state.promptHistoryList, state.items]);
65044
+ if (Array.isArray(state2.promptHistoryList)) return state2.promptHistoryList;
65045
+ return scanPromptHistory(Array.isArray(state2.items) ? state2.items : []);
65046
+ }, [state2.promptHistoryList, state2.items]);
64995
65047
  const resetPromptHistoryNav = useCallback19(() => {
64996
65048
  promptHistoryNavRef.current = { active: false, index: -1, seed: "", lastValue: "" };
64997
65049
  }, [promptHistoryNavRef]);
@@ -65021,7 +65073,7 @@ function messageSelectorLabel(text, width = 56) {
65021
65073
  }
65022
65074
  function useMessageSelector({
65023
65075
  store,
65024
- state,
65076
+ state: state2,
65025
65077
  surface,
65026
65078
  setPromptDraftOverride,
65027
65079
  syncPromptLayoutRows,
@@ -65031,10 +65083,10 @@ function useMessageSelector({
65031
65083
  installPastedTexts
65032
65084
  }) {
65033
65085
  const hasUserMessages = useMemo7(
65034
- () => (Array.isArray(state.items) ? state.items : []).some(
65086
+ () => (Array.isArray(state2.items) ? state2.items : []).some(
65035
65087
  (item) => item?.kind === "user" && String(item?.text || "").trim()
65036
65088
  ),
65037
- [state.items]
65089
+ [state2.items]
65038
65090
  );
65039
65091
  const applyRewind = useCallback20(
65040
65092
  (restored) => {
@@ -65061,7 +65113,7 @@ function useMessageSelector({
65061
65113
  ]
65062
65114
  );
65063
65115
  const openMessageSelector = useCallback20(() => {
65064
- const items = store.getState?.().items ?? state.items;
65116
+ const items = store.getState?.().items ?? state2.items;
65065
65117
  const rows2 = selectableUserItems(items);
65066
65118
  if (rows2.length === 0) {
65067
65119
  showPromptHint("No message to jump back to.", "info");
@@ -65092,7 +65144,7 @@ function useMessageSelector({
65092
65144
  onCancel: () => own.close()
65093
65145
  });
65094
65146
  return true;
65095
- }, [store, state.items, surface, applyRewind, showPromptHint]);
65147
+ }, [store, state2.items, surface, applyRewind, showPromptHint]);
65096
65148
  return { hasUserMessages, openMessageSelector };
65097
65149
  }
65098
65150
 
@@ -65219,34 +65271,34 @@ function createMeasureState() {
65219
65271
  streak: { count: 0, timer: null }
65220
65272
  };
65221
65273
  }
65222
- function resetMeasureState(state) {
65223
- state.els.clear();
65224
- state.refCache.clear();
65225
- state.items.clear();
65226
- state.gate = freshGate();
65227
- state.streak = { count: 0, timer: null };
65274
+ function resetMeasureState(state2) {
65275
+ state2.els.clear();
65276
+ state2.refCache.clear();
65277
+ state2.items.clear();
65278
+ state2.gate = freshGate();
65279
+ state2.streak = { count: 0, timer: null };
65228
65280
  if (hasStreamingRowStateToPrune()) pruneStreamingMeasuredRowsById(/* @__PURE__ */ new Set());
65229
65281
  }
65230
- function measureRefFor(state, item) {
65282
+ function measureRefFor(state2, item) {
65231
65283
  if (!TRANSCRIPT_MEASURED_ROWS || !item || item.id == null) return void 0;
65232
65284
  if (shouldSuppressFullyFailedToolItem(item)) {
65233
65285
  transcriptMeasuredRowsCache.delete(item);
65234
- state.els.delete(item.id);
65235
- state.items.delete(item.id);
65286
+ state2.els.delete(item.id);
65287
+ state2.items.delete(item.id);
65236
65288
  return void 0;
65237
65289
  }
65238
65290
  const key = item.id;
65239
- state.items.set(key, item);
65240
- let fn = state.refCache.get(key);
65291
+ state2.items.set(key, item);
65292
+ let fn = state2.refCache.get(key);
65241
65293
  if (!fn) {
65242
65294
  fn = (el) => {
65243
65295
  if (el) {
65244
- state.els.set(key, el);
65296
+ state2.els.set(key, el);
65245
65297
  } else {
65246
- state.els.delete(key);
65298
+ state2.els.delete(key);
65247
65299
  }
65248
65300
  };
65249
- state.refCache.set(key, fn);
65301
+ state2.refCache.set(key, fn);
65250
65302
  }
65251
65303
  return fn;
65252
65304
  }
@@ -65283,8 +65335,8 @@ function measureMountedRow(item, yoga, { frameColumns, toolOutputExpanded }) {
65283
65335
  const estimateRows = prev ? -1 : estimateTranscriptItemRowsCached(item, frameColumns, toolOutputExpanded);
65284
65336
  return prev || measured !== estimateRows ? measured : null;
65285
65337
  }
65286
- function bumpAfterMeasurementChange(state, changedKeys, bumpMeasuredRowsVersion) {
65287
- const streak = state.streak;
65338
+ function bumpAfterMeasurementChange(state2, changedKeys, bumpMeasuredRowsVersion) {
65339
+ const streak = state2.streak;
65288
65340
  if (streak.count >= HARVEST_BUMP_STREAK_LIMIT) {
65289
65341
  traceHarvestBreaker(changedKeys);
65290
65342
  return;
@@ -65297,11 +65349,11 @@ function bumpAfterMeasurementChange(state, changedKeys, bumpMeasuredRowsVersion)
65297
65349
  }, 0);
65298
65350
  if (typeof streak.timer?.unref === "function") streak.timer.unref();
65299
65351
  }
65300
- state.gate.forceNext = true;
65352
+ state2.gate.forceNext = true;
65301
65353
  bumpMeasuredRowsVersion();
65302
65354
  }
65303
- function pruneMeasureMaps(state) {
65304
- const { els, items, refCache } = state;
65355
+ function pruneMeasureMaps(state2) {
65356
+ const { els, items, refCache } = state2;
65305
65357
  if (items.size > els.size) {
65306
65358
  for (const key of items.keys()) {
65307
65359
  if (!els.has(key)) items.delete(key);
@@ -65314,29 +65366,29 @@ function pruneMeasureMaps(state) {
65314
65366
  }
65315
65367
  if (hasStreamingRowStateToPrune()) pruneStreamingMeasuredRowsById(new Set(items.keys()));
65316
65368
  }
65317
- function harvestMeasuredRows(state, { dragActive, inputs, frameColumns, toolOutputExpanded, bumpMeasuredRowsVersion }) {
65369
+ function harvestMeasuredRows(state2, { dragActive, inputs, frameColumns, toolOutputExpanded, bumpMeasuredRowsVersion }) {
65318
65370
  if (!TRANSCRIPT_MEASURED_ROWS) return;
65319
- const gate = state.gate;
65371
+ const gate = state2.gate;
65320
65372
  if (dragActive) {
65321
65373
  gate.skippedForDrag = true;
65322
65374
  return;
65323
65375
  }
65324
65376
  if (!gate.skippedForDrag && !gate.forceNext && transcriptHarvestInputsEqual(gate.inputs, inputs)) return;
65325
- const els = state.els;
65377
+ const els = state2.els;
65326
65378
  if (!els || els.size === 0) return;
65327
65379
  gate.inputs = inputs;
65328
65380
  gate.skippedForDrag = false;
65329
65381
  gate.forceNext = false;
65330
65382
  const changedKeys = [];
65331
65383
  for (const [key, el] of els.entries()) {
65332
- const item = state.items.get(key);
65384
+ const item = state2.items.get(key);
65333
65385
  const yoga = el?.yogaNode;
65334
65386
  if (!item || !yoga) continue;
65335
65387
  const change = measureMountedRow(item, yoga, { frameColumns, toolOutputExpanded });
65336
65388
  if (change != null) changedKeys.push(`${key}=${change}`);
65337
65389
  }
65338
- if (changedKeys.length > 0) bumpAfterMeasurementChange(state, changedKeys, bumpMeasuredRowsVersion);
65339
- pruneMeasureMaps(state);
65390
+ if (changedKeys.length > 0) bumpAfterMeasurementChange(state2, changedKeys, bumpMeasuredRowsVersion);
65391
+ pruneMeasureMaps(state2);
65340
65392
  }
65341
65393
 
65342
65394
  // src/tui/app/transcript-anchor-lock.mjs
@@ -65572,13 +65624,13 @@ function useTranscriptInstanceState({ sessionKey, scrollOffset, setScrollOffset,
65572
65624
  // src/tui/app/use-transcript-window/geometry.mjs
65573
65625
  import { useMemo as useMemo8 } from "react";
65574
65626
  var SUPPRESS_MEASURED_ROW_HEIGHTS = false;
65575
- function publishMaxScrollRows(state, transcriptWindow, { maxScrollRowsRef, frameColumns, toolOutputExpanded }) {
65627
+ function publishMaxScrollRows(state2, transcriptWindow, { maxScrollRowsRef, frameColumns, toolOutputExpanded }) {
65576
65628
  const estimateMaxScrollRows = Math.max(0, Number(transcriptWindow.maxScrollRows) || 0);
65577
- const holdCommittedMax = TRANSCRIPT_MEASURED_ROWS && estimateMaxScrollRows > state.committedMaxScrollRowsRef.current && mountedSliceAwaitingMeasure(transcriptWindow.items || [], frameColumns, toolOutputExpanded);
65578
- if (!holdCommittedMax) state.committedMaxScrollRowsRef.current = estimateMaxScrollRows;
65579
- maxScrollRowsRef.current = state.committedMaxScrollRowsRef.current;
65629
+ const holdCommittedMax = TRANSCRIPT_MEASURED_ROWS && estimateMaxScrollRows > state2.committedMaxScrollRowsRef.current && mountedSliceAwaitingMeasure(transcriptWindow.items || [], frameColumns, toolOutputExpanded);
65630
+ if (!holdCommittedMax) state2.committedMaxScrollRowsRef.current = estimateMaxScrollRows;
65631
+ maxScrollRowsRef.current = state2.committedMaxScrollRowsRef.current;
65580
65632
  }
65581
- function useTranscriptGeometry(state, props) {
65633
+ function useTranscriptGeometry(state2, props) {
65582
65634
  const {
65583
65635
  settledItems,
65584
65636
  structureRevision,
@@ -65603,7 +65655,7 @@ function useTranscriptGeometry(state, props) {
65603
65655
  const tailRows = streamingTailItem ? estimateTranscriptItemRowsCached(streamingTailItem, frameColumns, toolOutputExpanded) : 0;
65604
65656
  const tailSig = streamingTailItem ? `${streamingTailItem.id}:${tailRows}` : "_";
65605
65657
  const revision = Math.max(0, Number(structureRevision) || 0);
65606
- const transcriptItems = transcriptItemsWithStableTail(settledItems, streamingTailItem, state.transcriptItemsCacheRef);
65658
+ const transcriptItems = transcriptItemsWithStableTail(settledItems, streamingTailItem, state2.transcriptItemsCacheRef);
65607
65659
  const transcriptStructureSig = transcriptStructureSignature(
65608
65660
  transcriptItems,
65609
65661
  frameColumns,
@@ -65617,11 +65669,11 @@ function useTranscriptGeometry(state, props) {
65617
65669
  toolOutputExpanded,
65618
65670
  suppressMeasuredRowHeights: SUPPRESS_MEASURED_ROW_HEIGHTS,
65619
65671
  measuredRowsVersion,
65620
- cacheRef: state.incrementalRowIndexCacheRef,
65672
+ cacheRef: state2.incrementalRowIndexCacheRef,
65621
65673
  prefixRevision: revision,
65622
65674
  streamingTailItem
65623
65675
  }),
65624
- [revision, tailSig, frameColumns, toolOutputExpanded, measuredRowsVersion, state.incrementalRowIndexCacheRef]
65676
+ [revision, tailSig, frameColumns, toolOutputExpanded, measuredRowsVersion, state2.incrementalRowIndexCacheRef]
65625
65677
  );
65626
65678
  const renderScrollOffset = resolveRenderScrollOffset({
65627
65679
  scrollOffset,
@@ -65634,7 +65686,7 @@ function useTranscriptGeometry(state, props) {
65634
65686
  followingRef,
65635
65687
  scrollTargetRef,
65636
65688
  geomRef: transcriptGeomRef,
65637
- prevViewportRef: state.prevViewportGeomRef
65689
+ prevViewportRef: state2.prevViewportGeomRef
65638
65690
  });
65639
65691
  const transcriptWindow = useMemo8(
65640
65692
  () => transcriptRenderWindow(transcriptItems, {
@@ -65653,7 +65705,7 @@ function useTranscriptGeometry(state, props) {
65653
65705
  toolOutputExpanded
65654
65706
  ]
65655
65707
  );
65656
- publishMaxScrollRows(state, transcriptWindow, { maxScrollRowsRef, frameColumns, toolOutputExpanded });
65708
+ publishMaxScrollRows(state2, transcriptWindow, { maxScrollRowsRef, frameColumns, toolOutputExpanded });
65657
65709
  transcriptGeomRef.current = {
65658
65710
  prefixRows: transcriptRowIndex?.prefixRows || null,
65659
65711
  totalRows: Math.max(0, Number(transcriptWindow.totalRows) || 0),
@@ -65775,13 +65827,13 @@ function useTranscriptWindow({
65775
65827
  followingRef,
65776
65828
  selectionLayoutRef
65777
65829
  };
65778
- const state = useTranscriptInstanceState({ sessionKey, scrollOffset, setScrollOffset, refs });
65830
+ const state2 = useTranscriptInstanceState({ sessionKey, scrollOffset, setScrollOffset, refs });
65779
65831
  const transcriptMeasureRef = useCallback21(
65780
- (item) => measureRefFor(state.measureStateRef.current, item),
65781
- [state.measureStateRef]
65832
+ (item) => measureRefFor(state2.measureStateRef.current, item),
65833
+ [state2.measureStateRef]
65782
65834
  );
65783
65835
  const { revision, streamingTailItem, transcriptItems, transcriptRowIndex, transcriptWindow } = useTranscriptGeometry(
65784
- state,
65836
+ state2,
65785
65837
  {
65786
65838
  settledItems,
65787
65839
  structureRevision,
@@ -65820,7 +65872,7 @@ function useTranscriptWindow({
65820
65872
  [transcriptAnchorRef, transcriptAnchorDirtyRef, scrollTargetRef, scrollPositionRef, followingRef]
65821
65873
  );
65822
65874
  useLayoutEffect9(() => {
65823
- harvestMeasuredRows(state.measureStateRef.current, {
65875
+ harvestMeasuredRows(state2.measureStateRef.current, {
65824
65876
  dragActive: dragRef.current.active,
65825
65877
  inputs: harvestInputs,
65826
65878
  frameColumns,
@@ -65830,8 +65882,8 @@ function useTranscriptWindow({
65830
65882
  });
65831
65883
  useLayoutEffect9(() => {
65832
65884
  const totalRows = Math.max(0, Number(transcriptWindow.totalRows) || 0);
65833
- const previousTotalRows = Math.max(0, Number(state.transcriptTotalRowsRef.current) || 0);
65834
- state.transcriptTotalRowsRef.current = totalRows;
65885
+ const previousTotalRows = Math.max(0, Number(state2.transcriptTotalRowsRef.current) || 0);
65886
+ state2.transcriptTotalRowsRef.current = totalRows;
65835
65887
  syncReadingAnchorAfterCommit({
65836
65888
  refs: scrollRefs,
65837
65889
  dragActive: dragRef.current.active,
@@ -65853,7 +65905,7 @@ function useTranscriptWindow({
65853
65905
  scrollOffset,
65854
65906
  stopSmoothScroll,
65855
65907
  scrollRefs,
65856
- state.transcriptTotalRowsRef,
65908
+ state2.transcriptTotalRowsRef,
65857
65909
  dragRef,
65858
65910
  setScrollOffset
65859
65911
  ]);
@@ -65894,9 +65946,9 @@ import { useCallback as useCallback22, useRef as useRef29 } from "react";
65894
65946
 
65895
65947
  // src/tui/app/workflow-cycle.mjs
65896
65948
  var REPEAT_GUARD_MS = 300;
65897
- function cycleWorkflowFromPrompt({ store, state, cycleGuard }) {
65949
+ function cycleWorkflowFromPrompt({ store, state: state2, cycleGuard }) {
65898
65950
  const now = Date.now();
65899
- if (state.commandBusy || cycleGuard.pending || now - cycleGuard.lastAt < REPEAT_GUARD_MS) {
65951
+ if (state2.commandBusy || cycleGuard.pending || now - cycleGuard.lastAt < REPEAT_GUARD_MS) {
65900
65952
  cycleGuard.lastAt = now;
65901
65953
  return true;
65902
65954
  }
@@ -65908,7 +65960,7 @@ function cycleWorkflowFromPrompt({ store, state, cycleGuard }) {
65908
65960
  store.pushNotice("no workflows available", "warn");
65909
65961
  return null;
65910
65962
  }
65911
- const workflow = state.workflow || {};
65963
+ const workflow = state2.workflow || {};
65912
65964
  if (workflows.length < 2) {
65913
65965
  store.pushNotice(`Workflow: ${workflowDisplayName(workflows[0] || workflow)}`, "info");
65914
65966
  return null;
@@ -65935,7 +65987,7 @@ function cycleWorkflowFromPrompt({ store, state, cycleGuard }) {
65935
65987
  // src/tui/app/use-workflow-tab-cycle.mjs
65936
65988
  function useWorkflowTabCycle({
65937
65989
  store,
65938
- state,
65990
+ state: state2,
65939
65991
  slashPaletteOpen,
65940
65992
  toolApproval,
65941
65993
  picker,
@@ -65945,7 +65997,7 @@ function useWorkflowTabCycle({
65945
65997
  usagePanel
65946
65998
  }) {
65947
65999
  const workflowTabCycleRef = useRef29({ pending: false, lastAt: 0 });
65948
- const { commandBusy, workflow } = state;
66000
+ const { commandBusy, workflow } = state2;
65949
66001
  return useCallback22(() => {
65950
66002
  if (slashPaletteOpen || toolApproval || picker || settingsPrompt || providerPrompt || contextPanel || usagePanel)
65951
66003
  return true;
@@ -65969,8 +66021,8 @@ function projectPickerHelp(loading, initialEntry) {
65969
66021
  if (loading) return "Waiting for the project service\u2026";
65970
66022
  return initialEntry ? "\u2191/\u2193 Select \xB7 Enter Open \xB7 c Create \xB7 r Rename" : "\u2191/\u2193 Select \xB7 Enter Open \xB7 c Create \xB7 r Rename \xB7 Esc Back";
65971
66023
  }
65972
- function buildProjectPickerState({ state, surface }, actions, { initialEntry = false, projects = [], loading = false, requestId = null } = {}) {
65973
- const currentPath = String(state.cwd || process.cwd() || "");
66024
+ function buildProjectPickerState({ state: state2, surface }, actions, { initialEntry = false, projects = [], loading = false, requestId = null } = {}) {
66025
+ const currentPath = String(state2.cwd || process.cwd() || "");
65974
66026
  const items = [];
65975
66027
  if (!loading) {
65976
66028
  for (const project of projects) {
@@ -66025,7 +66077,7 @@ function buildProjectPickerState({ state, surface }, actions, { initialEntry = f
66025
66077
  }
66026
66078
 
66027
66079
  // src/tui/app/project-picker/create-flow.mjs
66028
- function createProjectCreateFlow({ state, surface, setProviderPrompt, setSettingsPrompt, closeUsagePanel, pickFolder: pickFolder2 }, actions) {
66080
+ function createProjectCreateFlow({ state: state2, surface, setProviderPrompt, setSettingsPrompt, closeUsagePanel, pickFolder: pickFolder2 }, actions) {
66029
66081
  const beginNewProjectManual = (reason = "") => {
66030
66082
  const own = surface.claim();
66031
66083
  own.context(null);
@@ -66058,7 +66110,7 @@ function createProjectCreateFlow({ state, surface, setProviderPrompt, setSetting
66058
66110
  });
66059
66111
  void pickFolder2({
66060
66112
  title: "Select a project folder",
66061
- initialPath: String(state.cwd || process.cwd() || "")
66113
+ initialPath: String(state2.cwd || process.cwd() || "")
66062
66114
  }).then((result) => {
66063
66115
  if (!own.owns()) return;
66064
66116
  if (!result || result.available === false) {
@@ -66377,15 +66429,15 @@ function pasteFromClipboard({ readText, readImage, processText, registerPastedIm
66377
66429
  }
66378
66430
 
66379
66431
  // src/tui/app/prompt-handlers/use-prompt-paste.mjs
66380
- function usePromptPaste({ state, showPromptHint, registerPastedImage, registerPastedText }) {
66432
+ function usePromptPaste({ state: state2, showPromptHint, registerPastedImage, registerPastedText }) {
66381
66433
  return useCallback25(
66382
66434
  (text, meta = {}) => {
66383
66435
  const source = String(meta?.source || "paste");
66384
66436
  const value = String(text ?? "");
66385
66437
  const attachImagePath = async (pathText) => {
66386
66438
  try {
66387
- const image2 = await readImageAttachmentFromPath(pathText, state.cwd || process.cwd(), {
66388
- provider: state.provider || ""
66439
+ const image2 = await readImageAttachmentFromPath(pathText, state2.cwd || process.cwd(), {
66440
+ provider: state2.provider || ""
66389
66441
  });
66390
66442
  if (!image2) return pathText;
66391
66443
  const ref = registerPastedImage(image2);
@@ -66400,7 +66452,7 @@ function usePromptPaste({ state, showPromptHint, registerPastedImage, registerPa
66400
66452
  if (source === "clipboard-shortcut" && !value) {
66401
66453
  return pasteFromClipboard({
66402
66454
  readText: readClipboardText,
66403
- readImage: () => readClipboardImageAttachment({ provider: state.provider || "" }),
66455
+ readImage: () => readClipboardImageAttachment({ provider: state2.provider || "" }),
66404
66456
  processText,
66405
66457
  registerPastedImage,
66406
66458
  showPromptHint
@@ -66408,14 +66460,14 @@ function usePromptPaste({ state, showPromptHint, registerPastedImage, registerPa
66408
66460
  }
66409
66461
  return processText(value);
66410
66462
  },
66411
- [registerPastedImage, registerPastedText, showPromptHint, state.cwd, state.provider]
66463
+ [registerPastedImage, registerPastedText, showPromptHint, state2.cwd, state2.provider]
66412
66464
  );
66413
66465
  }
66414
66466
 
66415
66467
  // src/tui/app/use-prompt-handlers.mjs
66416
66468
  function usePromptHandlers({
66417
66469
  store,
66418
- state,
66470
+ state: state2,
66419
66471
  // refs
66420
66472
  promptValueRef,
66421
66473
  promptHistoryNavRef,
@@ -66444,7 +66496,7 @@ function usePromptHandlers({
66444
66496
  clearPastedTextsSnapshot,
66445
66497
  registerPastedText
66446
66498
  }) {
66447
- const handlePromptPaste = usePromptPaste({ state, showPromptHint, registerPastedImage, registerPastedText });
66499
+ const handlePromptPaste = usePromptPaste({ state: state2, showPromptHint, registerPastedImage, registerPastedText });
66448
66500
  const handlePromptHistoryNavigate = usePromptHistoryNavigation({
66449
66501
  promptHistoryNavRef,
66450
66502
  promptHistoryDraftChangeRef,
@@ -66514,7 +66566,7 @@ function usePromptHandlers({
66514
66566
  );
66515
66567
  const handlePromptInterrupt = usePromptInterrupt({
66516
66568
  store,
66517
- busy: state.busy,
66569
+ busy: state2.busy,
66518
66570
  promptValueRef,
66519
66571
  installPastedImages,
66520
66572
  installPastedTexts,
@@ -66699,7 +66751,7 @@ function usePanelOwnership() {
66699
66751
  };
66700
66752
  }
66701
66753
  function useProjectPickerBoot({
66702
- state,
66754
+ state: state2,
66703
66755
  store,
66704
66756
  surface,
66705
66757
  setProviderPrompt,
@@ -66712,7 +66764,7 @@ function useProjectPickerBoot({
66712
66764
  }) {
66713
66765
  const projectPickerRef = useRef33(null);
66714
66766
  const projectPicker = createProjectPicker({
66715
- state,
66767
+ state: state2,
66716
66768
  store,
66717
66769
  surface,
66718
66770
  setProviderPrompt,
@@ -66726,7 +66778,7 @@ function useProjectPickerBoot({
66726
66778
  if (!initialPickerBuiltRef.current) {
66727
66779
  initialPickerBuiltRef.current = true;
66728
66780
  const onboardingOwnsScreen = !resolveOnboardingCompleted(store, onboardingCompleted) || forceOnboarding;
66729
- if (!onboardingOwnsScreen && state.items.length === 0) {
66781
+ if (!onboardingOwnsScreen && state2.items.length === 0) {
66730
66782
  setPicker(projectPicker.buildProjectPickerState({ initialEntry: true, loading: true }));
66731
66783
  }
66732
66784
  }
@@ -66737,7 +66789,7 @@ function useProjectPickerBoot({
66737
66789
  return projectPicker;
66738
66790
  }
66739
66791
  function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardingCompleted = void 0 }) {
66740
- const state = useSession(store);
66792
+ const state2 = useSession(store);
66741
66793
  const [toolOutputExpanded, setToolOutputExpanded] = useState26(false);
66742
66794
  const [onboardingActive, setOnboardingActive] = useState26(false);
66743
66795
  const { exit } = use_app_default();
@@ -66777,18 +66829,18 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66777
66829
  surface,
66778
66830
  closeUsagePanel
66779
66831
  } = usePanelOwnership();
66780
- const { btwPanel, btw } = useBtwPanel({ store, sessionId: state.sessionId });
66832
+ const { btwPanel, btw } = useBtwPanel({ store, sessionId: state2.sessionId });
66781
66833
  const settingsHeavyCacheRef = useRef33(null);
66782
66834
  const settingsRequestRef = useRef33(0);
66783
66835
  const settingsLiveRefreshRef = useRef33(null);
66784
66836
  useEffect36(() => {
66785
- if (state.setupChanged) settingsLiveRefreshRef.current?.();
66786
- }, [state.setupChanged]);
66837
+ if (state2.setupChanged) settingsLiveRefreshRef.current?.();
66838
+ }, [state2.setupChanged]);
66787
66839
  const [providerPrompt, setProviderPrompt] = useState26(null);
66788
66840
  const oauthSubmitRef = useRef33(false);
66789
66841
  const [settingsPrompt, setSettingsPrompt] = useState26(null);
66790
66842
  const { registerProject, enterProject, openProjectPicker } = useProjectPickerBoot({
66791
- state,
66843
+ state: state2,
66792
66844
  store,
66793
66845
  surface,
66794
66846
  setProviderPrompt,
@@ -66800,7 +66852,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66800
66852
  onboardingCompleted
66801
66853
  });
66802
66854
  const { disabledSkills, setDisabledSkills } = useDisabledSkills({ store });
66803
- const toolApproval = state.toolApproval || null;
66855
+ const toolApproval = state2.toolApproval || null;
66804
66856
  const {
66805
66857
  promptDraft,
66806
66858
  setPromptDraft,
@@ -66839,8 +66891,8 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66839
66891
  clearPromptHint
66840
66892
  } = usePromptHint();
66841
66893
  const toastErrorSignature = useMemo10(
66842
- () => (state.toasts || []).filter((toast) => toast?.tone === "error").map((toast) => `${toast.id || ""}:${toast.text || ""}`).join("|"),
66843
- [state.toasts]
66894
+ () => (state2.toasts || []).filter((toast) => toast?.tone === "error").map((toast) => `${toast.id || ""}:${toast.text || ""}`).join("|"),
66895
+ [state2.toasts]
66844
66896
  );
66845
66897
  const {
66846
66898
  welcomePromptHintDismissed,
@@ -66848,7 +66900,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66848
66900
  welcomePromptHintRef,
66849
66901
  welcomePromptHintVisibleRef,
66850
66902
  dismissWelcomePromptHint
66851
- } = useWelcomePromptHint({ store, state, toastErrorSignature });
66903
+ } = useWelcomePromptHint({ store, state: state2, toastErrorSignature });
66852
66904
  const { slashIndex, setSlashIndex, slashDismissedFor, setSlashDismissedFor, slashPaletteRef } = useSlashPaletteState();
66853
66905
  const scrollFocusRef = useRef33({});
66854
66906
  const onboardingRef = useRef33({
@@ -66878,7 +66930,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66878
66930
  openDeveloperPicker,
66879
66931
  runSlashCommand
66880
66932
  } = createAppPickers({
66881
- state,
66933
+ state: state2,
66882
66934
  store,
66883
66935
  surface,
66884
66936
  setProviderPrompt,
@@ -66906,7 +66958,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66906
66958
  openContextPicker: (...a) => openContextPicker(...a)
66907
66959
  });
66908
66960
  useUiOpenRequest({
66909
- uiOpenRequest: state.uiOpenRequest,
66961
+ uiOpenRequest: state2.uiOpenRequest,
66910
66962
  runSlashCommand,
66911
66963
  sections: { openDeveloperPicker, openSettingsPicker, pushNotice: (...a) => store.pushNotice(...a) }
66912
66964
  });
@@ -67005,10 +67057,10 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67005
67057
  setMeasuredRowsVersion,
67006
67058
  clearStitchBuffer
67007
67059
  });
67008
- useTranscriptSwapReset({ items: state.items, lastItemsCountRef, lastFirstItemIdRef, resetTranscriptScroll });
67060
+ useTranscriptSwapReset({ items: state2.items, lastItemsCountRef, lastFirstItemIdRef, resetTranscriptScroll });
67009
67061
  const { requestExit, restoreQueuedToPrompt, recentPromptHistory, resetPromptHistoryNav } = usePromptQueueHistory({
67010
67062
  store,
67011
- state,
67063
+ state: state2,
67012
67064
  exit,
67013
67065
  exitRequestedRef,
67014
67066
  setExiting,
@@ -67024,7 +67076,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67024
67076
  });
67025
67077
  const { hasUserMessages, openMessageSelector } = useMessageSelector({
67026
67078
  store,
67027
- state,
67079
+ state: state2,
67028
67080
  surface,
67029
67081
  setPromptDraftOverride,
67030
67082
  syncPromptLayoutRows,
@@ -67035,7 +67087,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67035
67087
  });
67036
67088
  const { handlePromptPaste, handlePromptHistoryNavigate, handlePromptEscape, handlePromptInterrupt } = usePromptHandlers({
67037
67089
  store,
67038
- state,
67090
+ state: state2,
67039
67091
  promptValueRef,
67040
67092
  promptHistoryNavRef,
67041
67093
  promptHistoryDraftChangeRef,
@@ -67089,13 +67141,13 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67089
67141
  });
67090
67142
  const { openUsagePanel, openContextPicker } = createUsageContextPanels({
67091
67143
  store,
67092
- state,
67144
+ state: state2,
67093
67145
  surface,
67094
67146
  setProviderPrompt,
67095
67147
  setSettingsPrompt,
67096
67148
  closeUsagePanel
67097
67149
  });
67098
- useContextPanelRefresh({ contextPanelKind: contextPanel?.kind, state, openContextPicker });
67150
+ useContextPanelRefresh({ contextPanelKind: contextPanel?.kind, state: state2, openContextPicker });
67099
67151
  useOnboardingStart({
67100
67152
  store,
67101
67153
  forceOnboarding,
@@ -67105,7 +67157,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67105
67157
  });
67106
67158
  const { onSubmit } = createPromptSubmit({
67107
67159
  store,
67108
- state,
67160
+ state: state2,
67109
67161
  providerPrompt,
67110
67162
  settingsPrompt,
67111
67163
  setProviderPrompt,
@@ -67143,7 +67195,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67143
67195
  usagePanel,
67144
67196
  picker,
67145
67197
  exiting,
67146
- commandBusy: state.commandBusy
67198
+ commandBusy: state2.commandBusy
67147
67199
  });
67148
67200
  scrollFocusRef.current = {
67149
67201
  slashPaletteOpen,
@@ -67191,7 +67243,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67191
67243
  runSlashCommand
67192
67244
  });
67193
67245
  const resizeEpoch = resizeState.epoch;
67194
- const { agentRevision, activeTools, statuslineStats } = useTranscriptActivity({ state });
67246
+ const { agentRevision, activeTools, statuslineStats } = useTranscriptActivity({ state: state2 });
67195
67247
  const layout = computeShellLayout({
67196
67248
  providerPrompt,
67197
67249
  settingsPrompt,
@@ -67204,7 +67256,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67204
67256
  btwPanel,
67205
67257
  slashPaletteOpen,
67206
67258
  tuiReady,
67207
- state,
67259
+ state: state2,
67208
67260
  resizeState,
67209
67261
  frameColumns,
67210
67262
  promptHint,
@@ -67256,13 +67308,13 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67256
67308
  overlayHintFallbackRow,
67257
67309
  transcriptMeasureRef
67258
67310
  } = useTranscriptWindow({
67259
- items: state.transcriptViewItems || state.items,
67260
- structureRevision: state.transcriptViewItems ? state.transcriptViewRevision : state.structureRevision,
67261
- sessionKey: state.sessionId || "",
67311
+ items: state2.transcriptViewItems || state2.items,
67312
+ structureRevision: state2.transcriptViewItems ? state2.transcriptViewRevision : state2.structureRevision,
67313
+ sessionKey: state2.sessionId || "",
67262
67314
  // Historical pages are contiguous settled windows. Keep the independently
67263
67315
  // growing live tail hidden until paging forward reaches the live window.
67264
- streamingTail: state.transcriptViewItems ? null : state.streamingTail,
67265
- themeEpoch: state.themeEpoch,
67316
+ streamingTail: state2.transcriptViewItems ? null : state2.streamingTail,
67317
+ themeEpoch: state2.themeEpoch,
67266
67318
  frameColumns,
67267
67319
  toolOutputExpanded,
67268
67320
  transcriptContentHeight,
@@ -67289,7 +67341,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67289
67341
  });
67290
67342
  const cycleWorkflowFromPrompt2 = useWorkflowTabCycle({
67291
67343
  store,
67292
- state,
67344
+ state: state2,
67293
67345
  slashPaletteOpen,
67294
67346
  toolApproval,
67295
67347
  picker,
@@ -67350,7 +67402,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67350
67402
  slashCommands,
67351
67403
  slashIndex,
67352
67404
  slashPaletteOpen,
67353
- state,
67405
+ state: state2,
67354
67406
  statuslineStats,
67355
67407
  store,
67356
67408
  surface,