mixdog 1.4.4 → 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 (218) hide show
  1. package/package.json +1 -2
  2. package/src/cli.mjs +5 -1
  3. package/src/defaults/shipped-history.json +26 -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 -240
  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 +16 -20
  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 +72 -13
  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/lead/LEAD.md +3 -1
  64. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +8 -30
  65. package/src/runtime/agent/orchestrator/agent-runtime/title-completion.mjs +5 -0
  66. package/src/runtime/agent/orchestrator/mcp/oauth-request.mjs +21 -2
  67. package/src/runtime/agent/orchestrator/providers/account-pool.mjs +3 -0
  68. package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -2
  69. package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +2 -0
  70. package/src/runtime/agent/orchestrator/providers/anthropic-message-threads.mjs +583 -0
  71. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
  72. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +81 -19
  73. package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +180 -13
  74. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +56 -6
  75. package/src/runtime/agent/orchestrator/providers/cursor-wire.mjs +4 -2
  76. package/src/runtime/agent/orchestrator/providers/gemini-error-contract.mjs +6 -6
  77. package/src/runtime/agent/orchestrator/providers/gemini-model-redirect.mjs +44 -0
  78. package/src/runtime/agent/orchestrator/providers/gemini-reasoning-relay.mjs +5 -0
  79. package/src/runtime/agent/orchestrator/providers/gemini-request-body.mjs +34 -5
  80. package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +10 -0
  81. package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +11 -6
  82. package/src/runtime/agent/orchestrator/providers/gemini-sdk-request.mjs +4 -100
  83. package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +3 -227
  84. package/src/runtime/agent/orchestrator/providers/gemini.mjs +226 -118
  85. package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +11 -1
  86. package/src/runtime/agent/orchestrator/providers/lib/claude-bridge-schema.mjs +15 -3
  87. package/src/runtime/agent/orchestrator/providers/lib/gemini-model-catalog.mjs +2 -1
  88. package/src/runtime/agent/orchestrator/providers/openai-direct-request.mjs +5 -28
  89. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +50 -28
  90. package/src/runtime/agent/orchestrator/providers/openai-ws-stream/socket-handlers.mjs +14 -10
  91. package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +1 -3
  92. package/src/runtime/agent/orchestrator/providers/stream-json-pool/worker-slots/slot-spawn.mjs +8 -3
  93. package/src/runtime/agent/orchestrator/providers/vertex-ai-maas.mjs +2 -2
  94. package/src/runtime/agent/orchestrator/runtime-core/config-helpers.mjs +4 -5
  95. package/src/runtime/agent/orchestrator/runtime-core/goal-tool-defs.mjs +2 -2
  96. package/src/runtime/agent/orchestrator/runtime-core/provider-request-tools.mjs +15 -8
  97. package/src/runtime/agent/orchestrator/runtime-core/session-title.mjs +1 -0
  98. package/src/runtime/agent/orchestrator/runtime-core/todo-list.mjs +9 -32
  99. package/src/runtime/agent/orchestrator/runtime-core/todo-tool-defs.mjs +4 -5
  100. package/src/runtime/agent/orchestrator/session/compact/summary-route.mjs +1 -3
  101. package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +5 -2
  102. package/src/runtime/agent/orchestrator/session/loop/no-tool-turn/todo-check.mjs +2 -17
  103. package/src/runtime/agent/orchestrator/session/loop/usage.mjs +7 -3
  104. package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +9 -2
  105. package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +26 -13
  106. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +4 -5
  107. package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +16 -5
  108. package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +22 -1
  109. package/src/runtime/agent/orchestrator/session/store/live-state.mjs +4 -0
  110. package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +11 -9
  111. package/src/runtime/agent/orchestrator/tools/builtin/grep-formatting.mjs +2 -8
  112. package/src/runtime/agent/orchestrator/tools/builtin/lib/search-input-helpers.mjs +1 -9
  113. package/src/runtime/agent/orchestrator/tools/builtin/local-search-telemetry.mjs +2 -2
  114. package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +1 -1
  115. package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.mjs +12 -3
  116. package/src/runtime/agent/orchestrator/tools/code-graph/ast-calls.mjs +9 -2
  117. package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +137 -7
  118. package/src/runtime/agent/orchestrator/tools/code-graph/calls-cache.mjs +43 -14
  119. package/src/runtime/agent/orchestrator/tools/code-graph/calls-sidecar-worker.mjs +33 -0
  120. package/src/runtime/agent/orchestrator/tools/code-graph/disk-cache.mjs +146 -11
  121. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +31 -24
  122. package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary/spawn-jsonl.mjs +172 -25
  123. package/src/runtime/agent/orchestrator/tools/code-graph/graph-model.mjs +100 -2
  124. package/src/runtime/agent/orchestrator/tools/code-graph/main-thread-slice.mjs +18 -0
  125. package/src/runtime/agent/orchestrator/tools/code-graph/mask-pool.mjs +219 -0
  126. package/src/runtime/agent/orchestrator/tools/code-graph/mask-worker.mjs +12 -0
  127. package/src/runtime/agent/orchestrator/tools/code-graph/memory-cache.mjs +6 -1
  128. package/src/runtime/agent/orchestrator/tools/code-graph/modes/calls.mjs +9 -2
  129. package/src/runtime/agent/orchestrator/tools/code-graph/modes/dependents.mjs +5 -1
  130. package/src/runtime/agent/orchestrator/tools/code-graph/modes/structure.mjs +8 -2
  131. package/src/runtime/agent/orchestrator/tools/code-graph/modes/symbols.mjs +14 -11
  132. package/src/runtime/agent/orchestrator/tools/code-graph/search-references.mjs +41 -18
  133. package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +391 -83
  134. package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +109 -9
  135. package/src/runtime/agent/orchestrator/tools/code-graph/text-mask.mjs +73 -29
  136. package/src/runtime/agent/orchestrator/tools/code-graph-prewarm-worker.mjs +6 -5
  137. package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.mjs +7 -3
  138. package/src/runtime/channels/lib/crash-log.mjs +21 -1
  139. package/src/runtime/channels/lib/worker-main.mjs +8 -25
  140. package/src/runtime/media/jobs.mjs +5 -0
  141. package/src/runtime/media/store.mjs +146 -3
  142. package/src/runtime/office/core/office-write-ledger.mjs +2 -2
  143. package/src/runtime/shared/agent-reap-state.mjs +19 -0
  144. package/src/runtime/shared/desktop-notice-host.d.mts +13 -0
  145. package/src/runtime/shared/desktop-notice-host.mjs +87 -0
  146. package/src/runtime/shared/file-lock.mjs +2 -2
  147. package/src/runtime/shared/heap-cap.mjs +9 -11
  148. package/src/runtime/shared/llm/http-agent.mjs +11 -1
  149. package/src/runtime/shared/llm/system-proxy.mjs +100 -25
  150. package/src/runtime/shared/llm/usage-accounting.mjs +18 -7
  151. package/src/runtime/shared/llm/usage-context.mjs +2 -2
  152. package/src/runtime/shared/llm/usage-ledger-requests.mjs +10 -3
  153. package/src/runtime/shared/llm/usage-ledger.mjs +13 -1
  154. package/src/runtime/shared/provider-accounts.mjs +22 -0
  155. package/src/runtime/shared/provider-auth-binding.mjs +2 -2
  156. package/src/runtime/shared/resource-admission.mjs +2 -2
  157. package/src/runtime/shared/root-async-context.mjs +51 -0
  158. package/src/runtime/shared/run-child.mjs +18 -1
  159. package/src/runtime/shared/slow-span.mjs +2 -2
  160. package/src/runtime/shared/tool-execution-owner.mjs +2 -2
  161. package/src/runtime/shared/tool-work-units.mjs +2 -0
  162. package/src/runtime/shared/turn-snapshot-store.mjs +75 -18
  163. package/src/runtime/shared/turn-worktree-snapshot.mjs +38 -8
  164. package/src/runtime/shared/user-cwd.mjs +2 -2
  165. package/src/runtime/shared/worker-requests.mjs +3 -1
  166. package/src/runtime/shared/worktrees/lock.mjs +2 -2
  167. package/src/runtime/visualize-bridge/client.mjs +26 -4
  168. package/src/runtime/visualize-bridge/tool-defs.mjs +46 -5
  169. package/src/session-runtime/boot/apis.mjs +1 -0
  170. package/src/session-runtime/boot/begin.mjs +2 -0
  171. package/src/session-runtime/media-api.mjs +15 -0
  172. package/src/session-runtime/provider-readiness.mjs +10 -2
  173. package/src/session-runtime/runtime-core.mjs +35 -8
  174. package/src/session-runtime/runtime-review-api.mjs +3 -1
  175. package/src/session-runtime/services/agent-tool/close-flow.mjs +6 -1
  176. package/src/session-runtime/services/agent-tool/execute-resume.mjs +94 -0
  177. package/src/session-runtime/services/agent-tool/execute-send.mjs +77 -27
  178. package/src/session-runtime/services/agent-tool/execute-spawn.mjs +28 -7
  179. package/src/session-runtime/services/agent-tool/execute.mjs +6 -1
  180. package/src/session-runtime/services/agent-tool/helpers.mjs +11 -0
  181. package/src/session-runtime/services/agent-tool/job-views/job-render.mjs +13 -10
  182. package/src/session-runtime/services/agent-tool/render.mjs +2 -0
  183. package/src/session-runtime/services/agent-tool/send-flow.mjs +1 -0
  184. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-prep.mjs +6 -0
  185. package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +2 -1
  186. package/src/session-runtime/services/agent-tool/tag-registry/reaped-sessions.mjs +82 -0
  187. package/src/session-runtime/services/agent-tool/tag-registry/record-facts-worker.mjs +36 -0
  188. package/src/session-runtime/services/agent-tool/tag-registry.mjs +4 -0
  189. package/src/session-runtime/services/agent-tool/terminal-reaper/row-helpers.mjs +29 -0
  190. package/src/session-runtime/services/agent-tool/terminal-reaper/scan-admission.mjs +11 -3
  191. package/src/session-runtime/services/agent-tool/terminal-reaper/stale-rows.mjs +19 -8
  192. package/src/session-runtime/services/agent-tool/terminal-reaper.mjs +5 -2
  193. package/src/session-runtime/services/agent-tool/worker-index.mjs +1 -0
  194. package/src/session-runtime/services/daemon-crash-capture/daemon-exit-record.mjs +2 -2
  195. package/src/session-runtime/session-create.mjs +5 -0
  196. package/src/session-runtime/setup-tool/settings-contract.mjs +2 -0
  197. package/src/session-runtime/usage-stats-api.mjs +3 -0
  198. package/src/session-runtime/workspace/admission-gate.mjs +25 -7
  199. package/src/session-runtime/workspace/transitions.mjs +4 -0
  200. package/src/standalone/daemon-log.mjs +28 -4
  201. package/src/standalone/daemon-owner.mjs +41 -7
  202. package/src/standalone/daemon-work-gate.mjs +139 -0
  203. package/src/standalone/daemon.mjs +80 -11
  204. package/src/standalone/desktop-service-registry.mjs +11 -4
  205. package/src/standalone/session-client.mjs +57 -5
  206. package/src/standalone/session-protocol.mjs +5 -0
  207. package/src/standalone/session-service/agent-tree/agent-cancel.mjs +17 -1
  208. package/src/standalone/session-service/agent-tree.mjs +7 -0
  209. package/src/standalone/session-service/session-calls/session-turns.mjs +12 -5
  210. package/src/standalone/session-transport/call-route.mjs +10 -4
  211. package/src/standalone/session-transport/routes.mjs +21 -0
  212. package/src/standalone/session-transport/stack.mjs +3 -1
  213. package/src/standalone/session-transport.mjs +5 -0
  214. package/src/tui/dist/index.mjs +495 -477
  215. package/src/tui/session/session-api/media.mjs +5 -0
  216. package/src/tui/session/turn.mjs +13 -0
  217. package/src/runtime/agent/orchestrator/providers/gemini-sdk-stream/cancellation.mjs +0 -71
  218. 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
  };
@@ -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);
@@ -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);
@@ -61686,7 +61704,7 @@ var OPENROUTER_SORT_OPTION = Object.freeze({
61686
61704
 
61687
61705
  // src/tui/app/model-picker/route-selection/fast-parameters.mjs
61688
61706
  var TOGGLE_PARAMETER_IDS = /* @__PURE__ */ new Set(["thinking", DAYBREAK_PARAMETER_ID]);
61689
- function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isStateRoute, getSelectedEffort }) {
61707
+ function createFastParameterSelection({ state: state2, currentRoute, isCurrentRoute, isStateRoute, getSelectedEffort }) {
61690
61708
  const selectedFast = /* @__PURE__ */ new Map();
61691
61709
  const selectedModelParameters = /* @__PURE__ */ new Map();
61692
61710
  const modelParametersFor = (model) => {
@@ -61718,7 +61736,7 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
61718
61736
  const modelDefaultFast = (model) => {
61719
61737
  if (!fastAvailableFor(model)) return false;
61720
61738
  if (isCurrentRoute(model) && typeof currentRoute.fast === "boolean") return currentRoute.fast;
61721
- if (isStateRoute(model) && typeof state.fast === "boolean") return state.fast;
61739
+ if (isStateRoute(model) && typeof state2.fast === "boolean") return state2.fast;
61722
61740
  if (typeof model.savedFast === "boolean") return model.savedFast;
61723
61741
  return model.fastPreferred === true;
61724
61742
  };
@@ -61782,10 +61800,10 @@ function createFastParameterSelection({ state, currentRoute, isCurrentRoute, isS
61782
61800
  }
61783
61801
 
61784
61802
  // src/tui/app/model-picker/route-selection.mjs
61785
- function createRouteSelection({ providerModels, state, currentRoute }) {
61803
+ function createRouteSelection({ providerModels, state: state2, currentRoute }) {
61786
61804
  const isCurrentRoute = (model) => currentRoute?.provider === model.provider && currentRoute?.model === model.id;
61787
- const isStateRoute = (model) => model.provider === state.provider && model.id === state.model;
61788
- 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 };
61789
61807
  const effort = createEffortSelection({ providerModels, ...seeds });
61790
61808
  const fast = createFastParameterSelection({ ...seeds, getSelectedEffort: effort.getSelectedEffort });
61791
61809
  const context = createContextSelection(seeds);
@@ -61867,9 +61885,9 @@ function saveSelectedRoute({
61867
61885
  });
61868
61886
  }
61869
61887
  function openProviderModelsPicker({ view, provider, onBack, saveRoute }) {
61870
- const { options, state, models, activeRoute, returnTo, returnLabel, returnOnNestedCancel, cancelModelPicker } = view;
61888
+ const { options, state: state2, models, activeRoute, returnTo, returnLabel, returnOnNestedCancel, cancelModelPicker } = view;
61871
61889
  const providerModels = models.filter((model) => model.provider === provider);
61872
- const selection = createRouteSelection({ providerModels, state, currentRoute: options.currentRoute || null });
61890
+ const selection = createRouteSelection({ providerModels, state: state2, currentRoute: options.currentRoute || null });
61873
61891
  const render2 = () => {
61874
61892
  const providerModelItems = buildProviderModelItems(models, provider, activeRoute);
61875
61893
  const providerModelInitialIndex = Math.max(
@@ -61938,7 +61956,7 @@ function createModelPicker({
61938
61956
  }) {
61939
61957
  const catalog = createModelCatalog({ store, providerModelsCacheRef, webSearchModelsCacheRef });
61940
61958
  const openModelPicker = async (options = {}) => {
61941
- const state = getState();
61959
+ const state2 = getState();
61942
61960
  const own = surface.claim();
61943
61961
  setProviderPrompt(null);
61944
61962
  setSettingsPrompt(null);
@@ -61981,16 +61999,16 @@ function createModelPicker({
61981
61999
  const providerNames = catalogProviderDisplayNames(models, await loadProviderDisplayNames(store));
61982
62000
  const catalogFailures = await loadProviderCatalogFailures(store);
61983
62001
  const activeRoute = options.currentRoute || {
61984
- provider: state.provider,
61985
- model: state.model,
61986
- effort: state.effort,
61987
- fast: state.fast,
61988
- modelParameters: state.modelParameters,
61989
- 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
61990
62008
  };
61991
62009
  const view = {
61992
62010
  options,
61993
- state,
62011
+ state: state2,
61994
62012
  models,
61995
62013
  activeRoute,
61996
62014
  providerNames,
@@ -63633,7 +63651,7 @@ var updateMeta = (upd = {}) => {
63633
63651
  if (!upd.currentVersion) return "unknown";
63634
63652
  return `${current} (latest)`;
63635
63653
  };
63636
- function readSettingsView({ snapshot, heavyCache, state }) {
63654
+ function readSettingsView({ snapshot, heavyCache, state: state2 }) {
63637
63655
  const autoClear = snapshot.autoClear || {};
63638
63656
  const toolModules = snapshot.toolModules || {};
63639
63657
  return {
@@ -63644,7 +63662,7 @@ function readSettingsView({ snapshot, heavyCache, state }) {
63644
63662
  memoryToolsOn: toolModules.memory?.enabled !== false,
63645
63663
  systemShell: snapshot.systemShell || { source: "auto", command: "", effective: "" },
63646
63664
  outputStyle: snapshot.outputStyle || {},
63647
- workflow: state.workflow || {},
63665
+ workflow: state2.workflow || {},
63648
63666
  mcp: heavyCache ? heavyCache.mcp : snapshot.mcp || { connectedCount: 0, configuredCount: 0, failedCount: 0 },
63649
63667
  plugins: heavyCache ? heavyCache.plugins : snapshot.plugins || { count: 0 },
63650
63668
  skills: heavyCache ? heavyCache.skills : snapshot.skills || { count: 0 }
@@ -63653,7 +63671,7 @@ function readSettingsView({ snapshot, heavyCache, state }) {
63653
63671
  function buildSettingsItems({
63654
63672
  snapshot,
63655
63673
  view,
63656
- state,
63674
+ state: state2,
63657
63675
  store,
63658
63676
  formatDuration: formatDuration2,
63659
63677
  displayModelName: displayModelName3,
@@ -63670,7 +63688,7 @@ function buildSettingsItems({
63670
63688
  {
63671
63689
  value: "model",
63672
63690
  label: "Model",
63673
- meta: displayModelName3(state.model, state.provider),
63691
+ meta: displayModelName3(state2.model, state2.provider),
63674
63692
  description: "Main chat model.",
63675
63693
  _action: "model"
63676
63694
  },
@@ -63989,7 +64007,7 @@ var heavyGateOf = (cacheRef) => {
63989
64007
  };
63990
64008
  function createSettingsPicker({
63991
64009
  store,
63992
- state,
64010
+ state: state2,
63993
64011
  surface,
63994
64012
  setProviderPrompt,
63995
64013
  setSettingsPrompt,
@@ -64018,7 +64036,7 @@ function createSettingsPicker({
64018
64036
  const gate = heavyGateOf(settingsHeavyCacheRef);
64019
64037
  const freshWritesAtStart = gate.freshWrites;
64020
64038
  const snapshot = await store.getSettingsSnapshot?.({ heavy: !heavyCache }) || {};
64021
- const view = readSettingsView({ snapshot, heavyCache, state });
64039
+ const view = readSettingsView({ snapshot, heavyCache, state: state2 });
64022
64040
  if (!isCurrentSettingsRequest(requestId)) {
64023
64041
  if (!heavyCache && own.owns() && gate.freshWrites === freshWritesAtStart) gate.queued = true;
64024
64042
  return;
@@ -64043,7 +64061,7 @@ function createSettingsPicker({
64043
64061
  const items = buildSettingsItems({
64044
64062
  snapshot,
64045
64063
  view,
64046
- state,
64064
+ state: state2,
64047
64065
  store,
64048
64066
  formatDuration: formatDuration2,
64049
64067
  displayModelName: displayModelName3,
@@ -64240,8 +64258,8 @@ var routeCommands = {
64240
64258
  return true;
64241
64259
  },
64242
64260
  outputstyle(ctx, arg) {
64243
- const { state, store, openSlashPanel, deps } = ctx;
64244
- if (state.busy) {
64261
+ const { state: state2, store, openSlashPanel, deps } = ctx;
64262
+ if (state2.busy) {
64245
64263
  store.pushNotice("wait for the current turn to finish before /OutputStyle", "warn");
64246
64264
  return false;
64247
64265
  }
@@ -64302,8 +64320,8 @@ var routeCommands = {
64302
64320
  return true;
64303
64321
  },
64304
64322
  effort(ctx, arg) {
64305
- const { state, store, openSlashPanel, deps } = ctx;
64306
- 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)" : "";
64307
64325
  if (!arg) {
64308
64326
  openSlashPanel("effort", "Effort", () => deps.openEffortPicker());
64309
64327
  return true;
@@ -64317,7 +64335,7 @@ var routeCommands = {
64317
64335
  return true;
64318
64336
  },
64319
64337
  fast(ctx, arg) {
64320
- const { state, store } = ctx;
64338
+ const { state: state2, store } = ctx;
64321
64339
  const value = String(arg || "").trim().toLowerCase();
64322
64340
  let setTo = null;
64323
64341
  if (!value) setTo = void 0;
@@ -64337,7 +64355,7 @@ var routeCommands = {
64337
64355
  const fastModeLabel = enabled ? "Fast mode on" : "Fast mode off";
64338
64356
  const modeLabel = setTo === "ultrafast" ? "Ultrafast" : fastModeLabel;
64339
64357
  store.pushNotice(
64340
- `${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)" : ""),
64341
64359
  "info"
64342
64360
  );
64343
64361
  }).catch((e) => store.pushNotice(`Couldn\u2019t update fast mode: ${e?.message || e}`, "error"));
@@ -64365,8 +64383,8 @@ var refuseWhileBusy = (store, command) => {
64365
64383
  };
64366
64384
  var sessionCommands = {
64367
64385
  clear(ctx, _arg, rawName) {
64368
- const { state, store } = ctx;
64369
- if (state.busy || state.commandBusy) {
64386
+ const { state: state2, store } = ctx;
64387
+ if (state2.busy || state2.commandBusy) {
64370
64388
  store.pushNotice(
64371
64389
  `wait for the current session command to finish before /${rawName === "new" ? "new" : "clear"}`,
64372
64390
  "warn"
@@ -64387,8 +64405,8 @@ var sessionCommands = {
64387
64405
  return true;
64388
64406
  },
64389
64407
  compact(ctx) {
64390
- const { state, store } = ctx;
64391
- if (state.busy) return refuseWhileBusy(store, "compact");
64408
+ const { state: state2, store } = ctx;
64409
+ if (state2.busy) return refuseWhileBusy(store, "compact");
64392
64410
  void store.compact().then((r) => store.pushNotice(...compactOutcomeNotice(r))).catch((error) => store.pushNotice(compactFailureNotice(error), "error"));
64393
64411
  return true;
64394
64412
  },
@@ -64415,8 +64433,8 @@ var sessionCommands = {
64415
64433
  return true;
64416
64434
  },
64417
64435
  resume(ctx, arg) {
64418
- const { state, store, openSlashPanel, deps } = ctx;
64419
- if (state.busy) return refuseWhileBusy(store, "resume");
64436
+ const { state: state2, store, openSlashPanel, deps } = ctx;
64437
+ if (state2.busy) return refuseWhileBusy(store, "resume");
64420
64438
  if (arg) {
64421
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"));
64422
64440
  } else {
@@ -64425,8 +64443,8 @@ var sessionCommands = {
64425
64443
  return true;
64426
64444
  },
64427
64445
  fork(ctx, _arg, rawName) {
64428
- const { state, store } = ctx;
64429
- 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");
64430
64448
  void Promise.resolve(store.inheritSession?.()).then((result) => {
64431
64449
  if (!result) {
64432
64450
  store.pushNotice("nothing to fork", "warn");
@@ -64512,8 +64530,8 @@ var sessionCommands = {
64512
64530
  return true;
64513
64531
  },
64514
64532
  doctor(ctx) {
64515
- const { state, store, deps } = ctx;
64516
- if (state.commandBusy) {
64533
+ const { state: state2, store, deps } = ctx;
64534
+ if (state2.commandBusy) {
64517
64535
  store.pushNotice("wait for the current command to finish before /doctor", "warn");
64518
64536
  return false;
64519
64537
  }
@@ -64568,8 +64586,8 @@ function createSlashPanelOpener({ surface, store }) {
64568
64586
 
64569
64587
  // src/tui/app/slash-dispatch.mjs
64570
64588
  var commands = { ...routeCommands, ...sessionCommands, ...panelCommands };
64571
- function createSlashDispatch({ state, store, normalizeSlashCommandName: normalizeSlashCommandName2, surface, closeUsagePanel, ...deps }) {
64572
- 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 }) };
64573
64591
  const runSlashCommand = (cmd, arg = "") => {
64574
64592
  const rawName = String(cmd || "").toLowerCase();
64575
64593
  cmd = normalizeSlashCommandName2(cmd);
@@ -64587,7 +64605,7 @@ function createSlashDispatch({ state, store, normalizeSlashCommandName: normaliz
64587
64605
 
64588
64606
  // src/tui/app/create-app-pickers.mjs
64589
64607
  function createAppPickers({
64590
- state,
64608
+ state: state2,
64591
64609
  store,
64592
64610
  surface,
64593
64611
  setProviderPrompt,
@@ -64615,7 +64633,7 @@ function createAppPickers({
64615
64633
  openContextPicker
64616
64634
  }) {
64617
64635
  const { openThemePicker, openEffortPicker } = createThemeEffortPickers({
64618
- state,
64636
+ state: state2,
64619
64637
  store,
64620
64638
  surface,
64621
64639
  setProviderPrompt,
@@ -64693,7 +64711,7 @@ function createAppPickers({
64693
64711
  });
64694
64712
  const { openModelPicker } = createModelPicker({
64695
64713
  store,
64696
- getState: () => state,
64714
+ getState: () => state2,
64697
64715
  surface,
64698
64716
  setProviderPrompt,
64699
64717
  setSettingsPrompt,
@@ -64705,7 +64723,7 @@ function createAppPickers({
64705
64723
  });
64706
64724
  const { openWebSearchPicker, openAgentsPicker, openWorkflowPicker, openOutputStylePicker } = createRoutePickers({
64707
64725
  store,
64708
- state,
64726
+ state: state2,
64709
64727
  surface,
64710
64728
  setProviderPrompt,
64711
64729
  setSettingsPrompt,
@@ -64719,7 +64737,7 @@ function createAppPickers({
64719
64737
  });
64720
64738
  const { openSettingsPicker } = createSettingsPicker({
64721
64739
  store,
64722
- state,
64740
+ state: state2,
64723
64741
  surface,
64724
64742
  setProviderPrompt,
64725
64743
  setSettingsPrompt,
@@ -64749,7 +64767,7 @@ function createAppPickers({
64749
64767
  openDeveloperPicker: (...a) => openDeveloperPicker(...a)
64750
64768
  });
64751
64769
  const { runSlashCommand } = createSlashDispatch({
64752
- state,
64770
+ state: state2,
64753
64771
  store,
64754
64772
  normalizeSlashCommandName,
64755
64773
  surface,
@@ -64955,7 +64973,7 @@ function runRestoreQueuedToPrompt(options, deps) {
64955
64973
  // src/tui/app/use-prompt-queue-history.mjs
64956
64974
  function usePromptQueueHistory({
64957
64975
  store,
64958
- state,
64976
+ state: state2,
64959
64977
  exit,
64960
64978
  exitRequestedRef,
64961
64979
  setExiting,
@@ -64998,7 +65016,7 @@ function usePromptQueueHistory({
64998
65016
  const restoreQueuedToPrompt = useCallback19(
64999
65017
  (options = {}) => runRestoreQueuedToPrompt(options, {
65000
65018
  store,
65001
- queued: state?.queued,
65019
+ queued: state2?.queued,
65002
65020
  promptDraft,
65003
65021
  promptValueRef,
65004
65022
  inFlightRef: queuedRestoreInFlightRef,
@@ -65011,7 +65029,7 @@ function usePromptQueueHistory({
65011
65029
  }),
65012
65030
  [
65013
65031
  store,
65014
- state?.queued,
65032
+ state2?.queued,
65015
65033
  promptDraft,
65016
65034
  promptValueRef,
65017
65035
  showPromptHint,
@@ -65023,9 +65041,9 @@ function usePromptQueueHistory({
65023
65041
  ]
65024
65042
  );
65025
65043
  const recentPromptHistory = useMemo6(() => {
65026
- if (Array.isArray(state.promptHistoryList)) return state.promptHistoryList;
65027
- return scanPromptHistory(Array.isArray(state.items) ? state.items : []);
65028
- }, [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]);
65029
65047
  const resetPromptHistoryNav = useCallback19(() => {
65030
65048
  promptHistoryNavRef.current = { active: false, index: -1, seed: "", lastValue: "" };
65031
65049
  }, [promptHistoryNavRef]);
@@ -65055,7 +65073,7 @@ function messageSelectorLabel(text, width = 56) {
65055
65073
  }
65056
65074
  function useMessageSelector({
65057
65075
  store,
65058
- state,
65076
+ state: state2,
65059
65077
  surface,
65060
65078
  setPromptDraftOverride,
65061
65079
  syncPromptLayoutRows,
@@ -65065,10 +65083,10 @@ function useMessageSelector({
65065
65083
  installPastedTexts
65066
65084
  }) {
65067
65085
  const hasUserMessages = useMemo7(
65068
- () => (Array.isArray(state.items) ? state.items : []).some(
65086
+ () => (Array.isArray(state2.items) ? state2.items : []).some(
65069
65087
  (item) => item?.kind === "user" && String(item?.text || "").trim()
65070
65088
  ),
65071
- [state.items]
65089
+ [state2.items]
65072
65090
  );
65073
65091
  const applyRewind = useCallback20(
65074
65092
  (restored) => {
@@ -65095,7 +65113,7 @@ function useMessageSelector({
65095
65113
  ]
65096
65114
  );
65097
65115
  const openMessageSelector = useCallback20(() => {
65098
- const items = store.getState?.().items ?? state.items;
65116
+ const items = store.getState?.().items ?? state2.items;
65099
65117
  const rows2 = selectableUserItems(items);
65100
65118
  if (rows2.length === 0) {
65101
65119
  showPromptHint("No message to jump back to.", "info");
@@ -65126,7 +65144,7 @@ function useMessageSelector({
65126
65144
  onCancel: () => own.close()
65127
65145
  });
65128
65146
  return true;
65129
- }, [store, state.items, surface, applyRewind, showPromptHint]);
65147
+ }, [store, state2.items, surface, applyRewind, showPromptHint]);
65130
65148
  return { hasUserMessages, openMessageSelector };
65131
65149
  }
65132
65150
 
@@ -65253,34 +65271,34 @@ function createMeasureState() {
65253
65271
  streak: { count: 0, timer: null }
65254
65272
  };
65255
65273
  }
65256
- function resetMeasureState(state) {
65257
- state.els.clear();
65258
- state.refCache.clear();
65259
- state.items.clear();
65260
- state.gate = freshGate();
65261
- 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 };
65262
65280
  if (hasStreamingRowStateToPrune()) pruneStreamingMeasuredRowsById(/* @__PURE__ */ new Set());
65263
65281
  }
65264
- function measureRefFor(state, item) {
65282
+ function measureRefFor(state2, item) {
65265
65283
  if (!TRANSCRIPT_MEASURED_ROWS || !item || item.id == null) return void 0;
65266
65284
  if (shouldSuppressFullyFailedToolItem(item)) {
65267
65285
  transcriptMeasuredRowsCache.delete(item);
65268
- state.els.delete(item.id);
65269
- state.items.delete(item.id);
65286
+ state2.els.delete(item.id);
65287
+ state2.items.delete(item.id);
65270
65288
  return void 0;
65271
65289
  }
65272
65290
  const key = item.id;
65273
- state.items.set(key, item);
65274
- let fn = state.refCache.get(key);
65291
+ state2.items.set(key, item);
65292
+ let fn = state2.refCache.get(key);
65275
65293
  if (!fn) {
65276
65294
  fn = (el) => {
65277
65295
  if (el) {
65278
- state.els.set(key, el);
65296
+ state2.els.set(key, el);
65279
65297
  } else {
65280
- state.els.delete(key);
65298
+ state2.els.delete(key);
65281
65299
  }
65282
65300
  };
65283
- state.refCache.set(key, fn);
65301
+ state2.refCache.set(key, fn);
65284
65302
  }
65285
65303
  return fn;
65286
65304
  }
@@ -65317,8 +65335,8 @@ function measureMountedRow(item, yoga, { frameColumns, toolOutputExpanded }) {
65317
65335
  const estimateRows = prev ? -1 : estimateTranscriptItemRowsCached(item, frameColumns, toolOutputExpanded);
65318
65336
  return prev || measured !== estimateRows ? measured : null;
65319
65337
  }
65320
- function bumpAfterMeasurementChange(state, changedKeys, bumpMeasuredRowsVersion) {
65321
- const streak = state.streak;
65338
+ function bumpAfterMeasurementChange(state2, changedKeys, bumpMeasuredRowsVersion) {
65339
+ const streak = state2.streak;
65322
65340
  if (streak.count >= HARVEST_BUMP_STREAK_LIMIT) {
65323
65341
  traceHarvestBreaker(changedKeys);
65324
65342
  return;
@@ -65331,11 +65349,11 @@ function bumpAfterMeasurementChange(state, changedKeys, bumpMeasuredRowsVersion)
65331
65349
  }, 0);
65332
65350
  if (typeof streak.timer?.unref === "function") streak.timer.unref();
65333
65351
  }
65334
- state.gate.forceNext = true;
65352
+ state2.gate.forceNext = true;
65335
65353
  bumpMeasuredRowsVersion();
65336
65354
  }
65337
- function pruneMeasureMaps(state) {
65338
- const { els, items, refCache } = state;
65355
+ function pruneMeasureMaps(state2) {
65356
+ const { els, items, refCache } = state2;
65339
65357
  if (items.size > els.size) {
65340
65358
  for (const key of items.keys()) {
65341
65359
  if (!els.has(key)) items.delete(key);
@@ -65348,29 +65366,29 @@ function pruneMeasureMaps(state) {
65348
65366
  }
65349
65367
  if (hasStreamingRowStateToPrune()) pruneStreamingMeasuredRowsById(new Set(items.keys()));
65350
65368
  }
65351
- function harvestMeasuredRows(state, { dragActive, inputs, frameColumns, toolOutputExpanded, bumpMeasuredRowsVersion }) {
65369
+ function harvestMeasuredRows(state2, { dragActive, inputs, frameColumns, toolOutputExpanded, bumpMeasuredRowsVersion }) {
65352
65370
  if (!TRANSCRIPT_MEASURED_ROWS) return;
65353
- const gate = state.gate;
65371
+ const gate = state2.gate;
65354
65372
  if (dragActive) {
65355
65373
  gate.skippedForDrag = true;
65356
65374
  return;
65357
65375
  }
65358
65376
  if (!gate.skippedForDrag && !gate.forceNext && transcriptHarvestInputsEqual(gate.inputs, inputs)) return;
65359
- const els = state.els;
65377
+ const els = state2.els;
65360
65378
  if (!els || els.size === 0) return;
65361
65379
  gate.inputs = inputs;
65362
65380
  gate.skippedForDrag = false;
65363
65381
  gate.forceNext = false;
65364
65382
  const changedKeys = [];
65365
65383
  for (const [key, el] of els.entries()) {
65366
- const item = state.items.get(key);
65384
+ const item = state2.items.get(key);
65367
65385
  const yoga = el?.yogaNode;
65368
65386
  if (!item || !yoga) continue;
65369
65387
  const change = measureMountedRow(item, yoga, { frameColumns, toolOutputExpanded });
65370
65388
  if (change != null) changedKeys.push(`${key}=${change}`);
65371
65389
  }
65372
- if (changedKeys.length > 0) bumpAfterMeasurementChange(state, changedKeys, bumpMeasuredRowsVersion);
65373
- pruneMeasureMaps(state);
65390
+ if (changedKeys.length > 0) bumpAfterMeasurementChange(state2, changedKeys, bumpMeasuredRowsVersion);
65391
+ pruneMeasureMaps(state2);
65374
65392
  }
65375
65393
 
65376
65394
  // src/tui/app/transcript-anchor-lock.mjs
@@ -65606,13 +65624,13 @@ function useTranscriptInstanceState({ sessionKey, scrollOffset, setScrollOffset,
65606
65624
  // src/tui/app/use-transcript-window/geometry.mjs
65607
65625
  import { useMemo as useMemo8 } from "react";
65608
65626
  var SUPPRESS_MEASURED_ROW_HEIGHTS = false;
65609
- function publishMaxScrollRows(state, transcriptWindow, { maxScrollRowsRef, frameColumns, toolOutputExpanded }) {
65627
+ function publishMaxScrollRows(state2, transcriptWindow, { maxScrollRowsRef, frameColumns, toolOutputExpanded }) {
65610
65628
  const estimateMaxScrollRows = Math.max(0, Number(transcriptWindow.maxScrollRows) || 0);
65611
- const holdCommittedMax = TRANSCRIPT_MEASURED_ROWS && estimateMaxScrollRows > state.committedMaxScrollRowsRef.current && mountedSliceAwaitingMeasure(transcriptWindow.items || [], frameColumns, toolOutputExpanded);
65612
- if (!holdCommittedMax) state.committedMaxScrollRowsRef.current = estimateMaxScrollRows;
65613
- 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;
65614
65632
  }
65615
- function useTranscriptGeometry(state, props) {
65633
+ function useTranscriptGeometry(state2, props) {
65616
65634
  const {
65617
65635
  settledItems,
65618
65636
  structureRevision,
@@ -65637,7 +65655,7 @@ function useTranscriptGeometry(state, props) {
65637
65655
  const tailRows = streamingTailItem ? estimateTranscriptItemRowsCached(streamingTailItem, frameColumns, toolOutputExpanded) : 0;
65638
65656
  const tailSig = streamingTailItem ? `${streamingTailItem.id}:${tailRows}` : "_";
65639
65657
  const revision = Math.max(0, Number(structureRevision) || 0);
65640
- const transcriptItems = transcriptItemsWithStableTail(settledItems, streamingTailItem, state.transcriptItemsCacheRef);
65658
+ const transcriptItems = transcriptItemsWithStableTail(settledItems, streamingTailItem, state2.transcriptItemsCacheRef);
65641
65659
  const transcriptStructureSig = transcriptStructureSignature(
65642
65660
  transcriptItems,
65643
65661
  frameColumns,
@@ -65651,11 +65669,11 @@ function useTranscriptGeometry(state, props) {
65651
65669
  toolOutputExpanded,
65652
65670
  suppressMeasuredRowHeights: SUPPRESS_MEASURED_ROW_HEIGHTS,
65653
65671
  measuredRowsVersion,
65654
- cacheRef: state.incrementalRowIndexCacheRef,
65672
+ cacheRef: state2.incrementalRowIndexCacheRef,
65655
65673
  prefixRevision: revision,
65656
65674
  streamingTailItem
65657
65675
  }),
65658
- [revision, tailSig, frameColumns, toolOutputExpanded, measuredRowsVersion, state.incrementalRowIndexCacheRef]
65676
+ [revision, tailSig, frameColumns, toolOutputExpanded, measuredRowsVersion, state2.incrementalRowIndexCacheRef]
65659
65677
  );
65660
65678
  const renderScrollOffset = resolveRenderScrollOffset({
65661
65679
  scrollOffset,
@@ -65668,7 +65686,7 @@ function useTranscriptGeometry(state, props) {
65668
65686
  followingRef,
65669
65687
  scrollTargetRef,
65670
65688
  geomRef: transcriptGeomRef,
65671
- prevViewportRef: state.prevViewportGeomRef
65689
+ prevViewportRef: state2.prevViewportGeomRef
65672
65690
  });
65673
65691
  const transcriptWindow = useMemo8(
65674
65692
  () => transcriptRenderWindow(transcriptItems, {
@@ -65687,7 +65705,7 @@ function useTranscriptGeometry(state, props) {
65687
65705
  toolOutputExpanded
65688
65706
  ]
65689
65707
  );
65690
- publishMaxScrollRows(state, transcriptWindow, { maxScrollRowsRef, frameColumns, toolOutputExpanded });
65708
+ publishMaxScrollRows(state2, transcriptWindow, { maxScrollRowsRef, frameColumns, toolOutputExpanded });
65691
65709
  transcriptGeomRef.current = {
65692
65710
  prefixRows: transcriptRowIndex?.prefixRows || null,
65693
65711
  totalRows: Math.max(0, Number(transcriptWindow.totalRows) || 0),
@@ -65809,13 +65827,13 @@ function useTranscriptWindow({
65809
65827
  followingRef,
65810
65828
  selectionLayoutRef
65811
65829
  };
65812
- const state = useTranscriptInstanceState({ sessionKey, scrollOffset, setScrollOffset, refs });
65830
+ const state2 = useTranscriptInstanceState({ sessionKey, scrollOffset, setScrollOffset, refs });
65813
65831
  const transcriptMeasureRef = useCallback21(
65814
- (item) => measureRefFor(state.measureStateRef.current, item),
65815
- [state.measureStateRef]
65832
+ (item) => measureRefFor(state2.measureStateRef.current, item),
65833
+ [state2.measureStateRef]
65816
65834
  );
65817
65835
  const { revision, streamingTailItem, transcriptItems, transcriptRowIndex, transcriptWindow } = useTranscriptGeometry(
65818
- state,
65836
+ state2,
65819
65837
  {
65820
65838
  settledItems,
65821
65839
  structureRevision,
@@ -65854,7 +65872,7 @@ function useTranscriptWindow({
65854
65872
  [transcriptAnchorRef, transcriptAnchorDirtyRef, scrollTargetRef, scrollPositionRef, followingRef]
65855
65873
  );
65856
65874
  useLayoutEffect9(() => {
65857
- harvestMeasuredRows(state.measureStateRef.current, {
65875
+ harvestMeasuredRows(state2.measureStateRef.current, {
65858
65876
  dragActive: dragRef.current.active,
65859
65877
  inputs: harvestInputs,
65860
65878
  frameColumns,
@@ -65864,8 +65882,8 @@ function useTranscriptWindow({
65864
65882
  });
65865
65883
  useLayoutEffect9(() => {
65866
65884
  const totalRows = Math.max(0, Number(transcriptWindow.totalRows) || 0);
65867
- const previousTotalRows = Math.max(0, Number(state.transcriptTotalRowsRef.current) || 0);
65868
- state.transcriptTotalRowsRef.current = totalRows;
65885
+ const previousTotalRows = Math.max(0, Number(state2.transcriptTotalRowsRef.current) || 0);
65886
+ state2.transcriptTotalRowsRef.current = totalRows;
65869
65887
  syncReadingAnchorAfterCommit({
65870
65888
  refs: scrollRefs,
65871
65889
  dragActive: dragRef.current.active,
@@ -65887,7 +65905,7 @@ function useTranscriptWindow({
65887
65905
  scrollOffset,
65888
65906
  stopSmoothScroll,
65889
65907
  scrollRefs,
65890
- state.transcriptTotalRowsRef,
65908
+ state2.transcriptTotalRowsRef,
65891
65909
  dragRef,
65892
65910
  setScrollOffset
65893
65911
  ]);
@@ -65928,9 +65946,9 @@ import { useCallback as useCallback22, useRef as useRef29 } from "react";
65928
65946
 
65929
65947
  // src/tui/app/workflow-cycle.mjs
65930
65948
  var REPEAT_GUARD_MS = 300;
65931
- function cycleWorkflowFromPrompt({ store, state, cycleGuard }) {
65949
+ function cycleWorkflowFromPrompt({ store, state: state2, cycleGuard }) {
65932
65950
  const now = Date.now();
65933
- if (state.commandBusy || cycleGuard.pending || now - cycleGuard.lastAt < REPEAT_GUARD_MS) {
65951
+ if (state2.commandBusy || cycleGuard.pending || now - cycleGuard.lastAt < REPEAT_GUARD_MS) {
65934
65952
  cycleGuard.lastAt = now;
65935
65953
  return true;
65936
65954
  }
@@ -65942,7 +65960,7 @@ function cycleWorkflowFromPrompt({ store, state, cycleGuard }) {
65942
65960
  store.pushNotice("no workflows available", "warn");
65943
65961
  return null;
65944
65962
  }
65945
- const workflow = state.workflow || {};
65963
+ const workflow = state2.workflow || {};
65946
65964
  if (workflows.length < 2) {
65947
65965
  store.pushNotice(`Workflow: ${workflowDisplayName(workflows[0] || workflow)}`, "info");
65948
65966
  return null;
@@ -65969,7 +65987,7 @@ function cycleWorkflowFromPrompt({ store, state, cycleGuard }) {
65969
65987
  // src/tui/app/use-workflow-tab-cycle.mjs
65970
65988
  function useWorkflowTabCycle({
65971
65989
  store,
65972
- state,
65990
+ state: state2,
65973
65991
  slashPaletteOpen,
65974
65992
  toolApproval,
65975
65993
  picker,
@@ -65979,7 +65997,7 @@ function useWorkflowTabCycle({
65979
65997
  usagePanel
65980
65998
  }) {
65981
65999
  const workflowTabCycleRef = useRef29({ pending: false, lastAt: 0 });
65982
- const { commandBusy, workflow } = state;
66000
+ const { commandBusy, workflow } = state2;
65983
66001
  return useCallback22(() => {
65984
66002
  if (slashPaletteOpen || toolApproval || picker || settingsPrompt || providerPrompt || contextPanel || usagePanel)
65985
66003
  return true;
@@ -66003,8 +66021,8 @@ function projectPickerHelp(loading, initialEntry) {
66003
66021
  if (loading) return "Waiting for the project service\u2026";
66004
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";
66005
66023
  }
66006
- function buildProjectPickerState({ state, surface }, actions, { initialEntry = false, projects = [], loading = false, requestId = null } = {}) {
66007
- 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() || "");
66008
66026
  const items = [];
66009
66027
  if (!loading) {
66010
66028
  for (const project of projects) {
@@ -66059,7 +66077,7 @@ function buildProjectPickerState({ state, surface }, actions, { initialEntry = f
66059
66077
  }
66060
66078
 
66061
66079
  // src/tui/app/project-picker/create-flow.mjs
66062
- function createProjectCreateFlow({ state, surface, setProviderPrompt, setSettingsPrompt, closeUsagePanel, pickFolder: pickFolder2 }, actions) {
66080
+ function createProjectCreateFlow({ state: state2, surface, setProviderPrompt, setSettingsPrompt, closeUsagePanel, pickFolder: pickFolder2 }, actions) {
66063
66081
  const beginNewProjectManual = (reason = "") => {
66064
66082
  const own = surface.claim();
66065
66083
  own.context(null);
@@ -66092,7 +66110,7 @@ function createProjectCreateFlow({ state, surface, setProviderPrompt, setSetting
66092
66110
  });
66093
66111
  void pickFolder2({
66094
66112
  title: "Select a project folder",
66095
- initialPath: String(state.cwd || process.cwd() || "")
66113
+ initialPath: String(state2.cwd || process.cwd() || "")
66096
66114
  }).then((result) => {
66097
66115
  if (!own.owns()) return;
66098
66116
  if (!result || result.available === false) {
@@ -66411,15 +66429,15 @@ function pasteFromClipboard({ readText, readImage, processText, registerPastedIm
66411
66429
  }
66412
66430
 
66413
66431
  // src/tui/app/prompt-handlers/use-prompt-paste.mjs
66414
- function usePromptPaste({ state, showPromptHint, registerPastedImage, registerPastedText }) {
66432
+ function usePromptPaste({ state: state2, showPromptHint, registerPastedImage, registerPastedText }) {
66415
66433
  return useCallback25(
66416
66434
  (text, meta = {}) => {
66417
66435
  const source = String(meta?.source || "paste");
66418
66436
  const value = String(text ?? "");
66419
66437
  const attachImagePath = async (pathText) => {
66420
66438
  try {
66421
- const image2 = await readImageAttachmentFromPath(pathText, state.cwd || process.cwd(), {
66422
- provider: state.provider || ""
66439
+ const image2 = await readImageAttachmentFromPath(pathText, state2.cwd || process.cwd(), {
66440
+ provider: state2.provider || ""
66423
66441
  });
66424
66442
  if (!image2) return pathText;
66425
66443
  const ref = registerPastedImage(image2);
@@ -66434,7 +66452,7 @@ function usePromptPaste({ state, showPromptHint, registerPastedImage, registerPa
66434
66452
  if (source === "clipboard-shortcut" && !value) {
66435
66453
  return pasteFromClipboard({
66436
66454
  readText: readClipboardText,
66437
- readImage: () => readClipboardImageAttachment({ provider: state.provider || "" }),
66455
+ readImage: () => readClipboardImageAttachment({ provider: state2.provider || "" }),
66438
66456
  processText,
66439
66457
  registerPastedImage,
66440
66458
  showPromptHint
@@ -66442,14 +66460,14 @@ function usePromptPaste({ state, showPromptHint, registerPastedImage, registerPa
66442
66460
  }
66443
66461
  return processText(value);
66444
66462
  },
66445
- [registerPastedImage, registerPastedText, showPromptHint, state.cwd, state.provider]
66463
+ [registerPastedImage, registerPastedText, showPromptHint, state2.cwd, state2.provider]
66446
66464
  );
66447
66465
  }
66448
66466
 
66449
66467
  // src/tui/app/use-prompt-handlers.mjs
66450
66468
  function usePromptHandlers({
66451
66469
  store,
66452
- state,
66470
+ state: state2,
66453
66471
  // refs
66454
66472
  promptValueRef,
66455
66473
  promptHistoryNavRef,
@@ -66478,7 +66496,7 @@ function usePromptHandlers({
66478
66496
  clearPastedTextsSnapshot,
66479
66497
  registerPastedText
66480
66498
  }) {
66481
- const handlePromptPaste = usePromptPaste({ state, showPromptHint, registerPastedImage, registerPastedText });
66499
+ const handlePromptPaste = usePromptPaste({ state: state2, showPromptHint, registerPastedImage, registerPastedText });
66482
66500
  const handlePromptHistoryNavigate = usePromptHistoryNavigation({
66483
66501
  promptHistoryNavRef,
66484
66502
  promptHistoryDraftChangeRef,
@@ -66548,7 +66566,7 @@ function usePromptHandlers({
66548
66566
  );
66549
66567
  const handlePromptInterrupt = usePromptInterrupt({
66550
66568
  store,
66551
- busy: state.busy,
66569
+ busy: state2.busy,
66552
66570
  promptValueRef,
66553
66571
  installPastedImages,
66554
66572
  installPastedTexts,
@@ -66733,7 +66751,7 @@ function usePanelOwnership() {
66733
66751
  };
66734
66752
  }
66735
66753
  function useProjectPickerBoot({
66736
- state,
66754
+ state: state2,
66737
66755
  store,
66738
66756
  surface,
66739
66757
  setProviderPrompt,
@@ -66746,7 +66764,7 @@ function useProjectPickerBoot({
66746
66764
  }) {
66747
66765
  const projectPickerRef = useRef33(null);
66748
66766
  const projectPicker = createProjectPicker({
66749
- state,
66767
+ state: state2,
66750
66768
  store,
66751
66769
  surface,
66752
66770
  setProviderPrompt,
@@ -66760,7 +66778,7 @@ function useProjectPickerBoot({
66760
66778
  if (!initialPickerBuiltRef.current) {
66761
66779
  initialPickerBuiltRef.current = true;
66762
66780
  const onboardingOwnsScreen = !resolveOnboardingCompleted(store, onboardingCompleted) || forceOnboarding;
66763
- if (!onboardingOwnsScreen && state.items.length === 0) {
66781
+ if (!onboardingOwnsScreen && state2.items.length === 0) {
66764
66782
  setPicker(projectPicker.buildProjectPickerState({ initialEntry: true, loading: true }));
66765
66783
  }
66766
66784
  }
@@ -66771,7 +66789,7 @@ function useProjectPickerBoot({
66771
66789
  return projectPicker;
66772
66790
  }
66773
66791
  function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardingCompleted = void 0 }) {
66774
- const state = useSession(store);
66792
+ const state2 = useSession(store);
66775
66793
  const [toolOutputExpanded, setToolOutputExpanded] = useState26(false);
66776
66794
  const [onboardingActive, setOnboardingActive] = useState26(false);
66777
66795
  const { exit } = use_app_default();
@@ -66811,18 +66829,18 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66811
66829
  surface,
66812
66830
  closeUsagePanel
66813
66831
  } = usePanelOwnership();
66814
- const { btwPanel, btw } = useBtwPanel({ store, sessionId: state.sessionId });
66832
+ const { btwPanel, btw } = useBtwPanel({ store, sessionId: state2.sessionId });
66815
66833
  const settingsHeavyCacheRef = useRef33(null);
66816
66834
  const settingsRequestRef = useRef33(0);
66817
66835
  const settingsLiveRefreshRef = useRef33(null);
66818
66836
  useEffect36(() => {
66819
- if (state.setupChanged) settingsLiveRefreshRef.current?.();
66820
- }, [state.setupChanged]);
66837
+ if (state2.setupChanged) settingsLiveRefreshRef.current?.();
66838
+ }, [state2.setupChanged]);
66821
66839
  const [providerPrompt, setProviderPrompt] = useState26(null);
66822
66840
  const oauthSubmitRef = useRef33(false);
66823
66841
  const [settingsPrompt, setSettingsPrompt] = useState26(null);
66824
66842
  const { registerProject, enterProject, openProjectPicker } = useProjectPickerBoot({
66825
- state,
66843
+ state: state2,
66826
66844
  store,
66827
66845
  surface,
66828
66846
  setProviderPrompt,
@@ -66834,7 +66852,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66834
66852
  onboardingCompleted
66835
66853
  });
66836
66854
  const { disabledSkills, setDisabledSkills } = useDisabledSkills({ store });
66837
- const toolApproval = state.toolApproval || null;
66855
+ const toolApproval = state2.toolApproval || null;
66838
66856
  const {
66839
66857
  promptDraft,
66840
66858
  setPromptDraft,
@@ -66873,8 +66891,8 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66873
66891
  clearPromptHint
66874
66892
  } = usePromptHint();
66875
66893
  const toastErrorSignature = useMemo10(
66876
- () => (state.toasts || []).filter((toast) => toast?.tone === "error").map((toast) => `${toast.id || ""}:${toast.text || ""}`).join("|"),
66877
- [state.toasts]
66894
+ () => (state2.toasts || []).filter((toast) => toast?.tone === "error").map((toast) => `${toast.id || ""}:${toast.text || ""}`).join("|"),
66895
+ [state2.toasts]
66878
66896
  );
66879
66897
  const {
66880
66898
  welcomePromptHintDismissed,
@@ -66882,7 +66900,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66882
66900
  welcomePromptHintRef,
66883
66901
  welcomePromptHintVisibleRef,
66884
66902
  dismissWelcomePromptHint
66885
- } = useWelcomePromptHint({ store, state, toastErrorSignature });
66903
+ } = useWelcomePromptHint({ store, state: state2, toastErrorSignature });
66886
66904
  const { slashIndex, setSlashIndex, slashDismissedFor, setSlashDismissedFor, slashPaletteRef } = useSlashPaletteState();
66887
66905
  const scrollFocusRef = useRef33({});
66888
66906
  const onboardingRef = useRef33({
@@ -66912,7 +66930,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66912
66930
  openDeveloperPicker,
66913
66931
  runSlashCommand
66914
66932
  } = createAppPickers({
66915
- state,
66933
+ state: state2,
66916
66934
  store,
66917
66935
  surface,
66918
66936
  setProviderPrompt,
@@ -66940,7 +66958,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
66940
66958
  openContextPicker: (...a) => openContextPicker(...a)
66941
66959
  });
66942
66960
  useUiOpenRequest({
66943
- uiOpenRequest: state.uiOpenRequest,
66961
+ uiOpenRequest: state2.uiOpenRequest,
66944
66962
  runSlashCommand,
66945
66963
  sections: { openDeveloperPicker, openSettingsPicker, pushNotice: (...a) => store.pushNotice(...a) }
66946
66964
  });
@@ -67039,10 +67057,10 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67039
67057
  setMeasuredRowsVersion,
67040
67058
  clearStitchBuffer
67041
67059
  });
67042
- useTranscriptSwapReset({ items: state.items, lastItemsCountRef, lastFirstItemIdRef, resetTranscriptScroll });
67060
+ useTranscriptSwapReset({ items: state2.items, lastItemsCountRef, lastFirstItemIdRef, resetTranscriptScroll });
67043
67061
  const { requestExit, restoreQueuedToPrompt, recentPromptHistory, resetPromptHistoryNav } = usePromptQueueHistory({
67044
67062
  store,
67045
- state,
67063
+ state: state2,
67046
67064
  exit,
67047
67065
  exitRequestedRef,
67048
67066
  setExiting,
@@ -67058,7 +67076,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67058
67076
  });
67059
67077
  const { hasUserMessages, openMessageSelector } = useMessageSelector({
67060
67078
  store,
67061
- state,
67079
+ state: state2,
67062
67080
  surface,
67063
67081
  setPromptDraftOverride,
67064
67082
  syncPromptLayoutRows,
@@ -67069,7 +67087,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67069
67087
  });
67070
67088
  const { handlePromptPaste, handlePromptHistoryNavigate, handlePromptEscape, handlePromptInterrupt } = usePromptHandlers({
67071
67089
  store,
67072
- state,
67090
+ state: state2,
67073
67091
  promptValueRef,
67074
67092
  promptHistoryNavRef,
67075
67093
  promptHistoryDraftChangeRef,
@@ -67123,13 +67141,13 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67123
67141
  });
67124
67142
  const { openUsagePanel, openContextPicker } = createUsageContextPanels({
67125
67143
  store,
67126
- state,
67144
+ state: state2,
67127
67145
  surface,
67128
67146
  setProviderPrompt,
67129
67147
  setSettingsPrompt,
67130
67148
  closeUsagePanel
67131
67149
  });
67132
- useContextPanelRefresh({ contextPanelKind: contextPanel?.kind, state, openContextPicker });
67150
+ useContextPanelRefresh({ contextPanelKind: contextPanel?.kind, state: state2, openContextPicker });
67133
67151
  useOnboardingStart({
67134
67152
  store,
67135
67153
  forceOnboarding,
@@ -67139,7 +67157,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67139
67157
  });
67140
67158
  const { onSubmit } = createPromptSubmit({
67141
67159
  store,
67142
- state,
67160
+ state: state2,
67143
67161
  providerPrompt,
67144
67162
  settingsPrompt,
67145
67163
  setProviderPrompt,
@@ -67177,7 +67195,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67177
67195
  usagePanel,
67178
67196
  picker,
67179
67197
  exiting,
67180
- commandBusy: state.commandBusy
67198
+ commandBusy: state2.commandBusy
67181
67199
  });
67182
67200
  scrollFocusRef.current = {
67183
67201
  slashPaletteOpen,
@@ -67225,7 +67243,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67225
67243
  runSlashCommand
67226
67244
  });
67227
67245
  const resizeEpoch = resizeState.epoch;
67228
- const { agentRevision, activeTools, statuslineStats } = useTranscriptActivity({ state });
67246
+ const { agentRevision, activeTools, statuslineStats } = useTranscriptActivity({ state: state2 });
67229
67247
  const layout = computeShellLayout({
67230
67248
  providerPrompt,
67231
67249
  settingsPrompt,
@@ -67238,7 +67256,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67238
67256
  btwPanel,
67239
67257
  slashPaletteOpen,
67240
67258
  tuiReady,
67241
- state,
67259
+ state: state2,
67242
67260
  resizeState,
67243
67261
  frameColumns,
67244
67262
  promptHint,
@@ -67290,13 +67308,13 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67290
67308
  overlayHintFallbackRow,
67291
67309
  transcriptMeasureRef
67292
67310
  } = useTranscriptWindow({
67293
- items: state.transcriptViewItems || state.items,
67294
- structureRevision: state.transcriptViewItems ? state.transcriptViewRevision : state.structureRevision,
67295
- sessionKey: state.sessionId || "",
67311
+ items: state2.transcriptViewItems || state2.items,
67312
+ structureRevision: state2.transcriptViewItems ? state2.transcriptViewRevision : state2.structureRevision,
67313
+ sessionKey: state2.sessionId || "",
67296
67314
  // Historical pages are contiguous settled windows. Keep the independently
67297
67315
  // growing live tail hidden until paging forward reaches the live window.
67298
- streamingTail: state.transcriptViewItems ? null : state.streamingTail,
67299
- themeEpoch: state.themeEpoch,
67316
+ streamingTail: state2.transcriptViewItems ? null : state2.streamingTail,
67317
+ themeEpoch: state2.themeEpoch,
67300
67318
  frameColumns,
67301
67319
  toolOutputExpanded,
67302
67320
  transcriptContentHeight,
@@ -67323,7 +67341,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67323
67341
  });
67324
67342
  const cycleWorkflowFromPrompt2 = useWorkflowTabCycle({
67325
67343
  store,
67326
- state,
67344
+ state: state2,
67327
67345
  slashPaletteOpen,
67328
67346
  toolApproval,
67329
67347
  picker,
@@ -67384,7 +67402,7 @@ function App2({ store, initialStatusLine = "", forceOnboarding = false, onboardi
67384
67402
  slashCommands,
67385
67403
  slashIndex,
67386
67404
  slashPaletteOpen,
67387
- state,
67405
+ state: state2,
67388
67406
  statuslineStats,
67389
67407
  store,
67390
67408
  surface,