@iaforged/context-code 1.0.72 → 1.0.74

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 (2050) hide show
  1. package/context-bootstrap.js +7 -8
  2. package/dist/src/QueryEngine.js +928 -0
  3. package/dist/src/Task.js +49 -0
  4. package/dist/src/Tool.js +56 -0
  5. package/dist/src/assistant/AssistantSessionChooser.js +16 -0
  6. package/dist/src/assistant/index.js +16 -0
  7. package/dist/src/assistant/sessionDiscovery.js +16 -0
  8. package/dist/src/assistant/sessionHistory.js +47 -0
  9. package/dist/src/bootstrap/state.js +1165 -0
  10. package/dist/src/bridge/bridgeApi.js +304 -0
  11. package/dist/src/bridge/bridgeConfig.js +39 -0
  12. package/dist/src/bridge/bridgeDebug.js +73 -0
  13. package/dist/src/bridge/bridgeEnabled.js +187 -0
  14. package/dist/src/bridge/bridgeMain.js +2289 -0
  15. package/dist/src/bridge/bridgeMessaging.js +353 -0
  16. package/dist/src/bridge/bridgePermissionCallbacks.js +10 -0
  17. package/dist/src/bridge/bridgePointer.js +175 -0
  18. package/dist/src/bridge/bridgeStatusUtil.js +105 -0
  19. package/dist/src/bridge/bridgeUI.js +412 -0
  20. package/dist/src/bridge/capacityWake.js +35 -0
  21. package/dist/src/bridge/codeSessionApi.js +111 -0
  22. package/dist/src/bridge/createSession.js +273 -0
  23. package/dist/src/bridge/debugUtils.js +115 -0
  24. package/dist/src/bridge/envLessBridgeConfig.js +121 -0
  25. package/dist/src/bridge/flushGate.js +65 -0
  26. package/dist/src/bridge/inboundAttachments.js +152 -0
  27. package/dist/src/bridge/inboundMessages.js +63 -0
  28. package/dist/src/bridge/initReplBridge.js +428 -0
  29. package/dist/src/bridge/jwtUtils.js +185 -0
  30. package/dist/src/bridge/pollConfig.js +85 -0
  31. package/dist/src/bridge/pollConfigDefaults.js +62 -0
  32. package/dist/src/bridge/remoteBridgeCore.js +712 -0
  33. package/dist/src/bridge/replBridge.js +1720 -0
  34. package/dist/src/bridge/replBridgeHandle.js +30 -0
  35. package/dist/src/bridge/replBridgeTransport.js +236 -0
  36. package/dist/src/bridge/sessionIdCompat.js +56 -0
  37. package/dist/src/bridge/sessionRunner.js +421 -0
  38. package/dist/src/bridge/trustedDevice.js +172 -0
  39. package/dist/src/bridge/types.js +9 -0
  40. package/dist/src/bridge/workSecret.js +99 -0
  41. package/dist/src/buddy/CompanionSprite.js +349 -0
  42. package/dist/src/buddy/companion.js +107 -0
  43. package/dist/src/buddy/prompt.js +33 -0
  44. package/dist/src/buddy/sprites.js +488 -0
  45. package/dist/src/buddy/types.js +90 -0
  46. package/dist/src/buddy/useBuddyNotification.js +90 -0
  47. package/dist/src/cli/bg.js +16 -0
  48. package/dist/src/cli/exit.js +30 -0
  49. package/dist/src/cli/handlers/agents.js +55 -0
  50. package/dist/src/cli/handlers/ant.js +16 -0
  51. package/dist/src/cli/handlers/auth.js +315 -0
  52. package/dist/src/cli/handlers/autoMode.js +128 -0
  53. package/dist/src/cli/handlers/mcp.js +334 -0
  54. package/dist/src/cli/handlers/plugins.js +634 -0
  55. package/dist/src/cli/handlers/projects_bridge.js +40 -0
  56. package/dist/src/cli/handlers/provider.js +42 -0
  57. package/dist/src/cli/handlers/templateJobs.js +16 -0
  58. package/dist/src/cli/handlers/util.js +76 -0
  59. package/dist/src/cli/ndjsonSafeStringify.js +27 -0
  60. package/dist/src/cli/print.js +4225 -0
  61. package/dist/src/cli/remoteIO.js +208 -0
  62. package/dist/src/cli/rollback.js +16 -0
  63. package/dist/src/cli/structuredIO.js +644 -0
  64. package/dist/src/cli/transports/HybridTransport.js +233 -0
  65. package/dist/src/cli/transports/SSETransport.js +538 -0
  66. package/dist/src/cli/transports/SerialBatchEventUploader.js +224 -0
  67. package/dist/src/cli/transports/Transport.js +1 -0
  68. package/dist/src/cli/transports/WebSocketTransport.js +613 -0
  69. package/dist/src/cli/transports/WorkerStateUploader.js +88 -0
  70. package/dist/src/cli/transports/ccrClient.js +711 -0
  71. package/dist/src/cli/transports/transportUtils.js +39 -0
  72. package/dist/src/cli/up.js +16 -0
  73. package/dist/src/cli/update.js +315 -0
  74. package/dist/src/commands/add-dir/add-dir.js +121 -0
  75. package/dist/src/commands/add-dir/index.js +8 -0
  76. package/dist/src/commands/add-dir/validation.js +76 -0
  77. package/dist/src/commands/advisor.js +88 -0
  78. package/dist/src/commands/agent/agent.js +283 -0
  79. package/dist/src/commands/agent/agentStore.js +120 -0
  80. package/dist/src/commands/agent/index.js +9 -0
  81. package/dist/src/commands/agents/agents.js +9 -0
  82. package/dist/src/commands/agents/index.js +7 -0
  83. package/dist/src/commands/ant-trace/index.js +1 -0
  84. package/dist/src/commands/assistant/assistant.js +16 -0
  85. package/dist/src/commands/autofix-pr/index.js +1 -0
  86. package/dist/src/commands/backfill-sessions/index.js +1 -0
  87. package/dist/src/commands/branch/branch.js +205 -0
  88. package/dist/src/commands/branch/index.js +11 -0
  89. package/dist/src/commands/break-cache/index.js +1 -0
  90. package/dist/src/commands/bridge/bridge.js +512 -0
  91. package/dist/src/commands/bridge/index.js +22 -0
  92. package/dist/src/commands/bridge-kick.js +179 -0
  93. package/dist/src/commands/brief.js +94 -0
  94. package/dist/src/commands/btw/btw.js +234 -0
  95. package/dist/src/commands/btw/index.js +9 -0
  96. package/dist/src/commands/bughunter/index.js +1 -0
  97. package/dist/src/commands/chrome/chrome.js +291 -0
  98. package/dist/src/commands/chrome/index.js +11 -0
  99. package/dist/src/commands/clear/caches.js +116 -0
  100. package/dist/src/commands/clear/clear.js +5 -0
  101. package/dist/src/commands/clear/conversation.js +191 -0
  102. package/dist/src/commands/clear/index.js +9 -0
  103. package/dist/src/commands/color/color.js +58 -0
  104. package/dist/src/commands/color/index.js +9 -0
  105. package/dist/src/commands/commit-push-pr.js +137 -0
  106. package/dist/src/commands/commit.js +80 -0
  107. package/dist/src/commands/compact/compact.js +196 -0
  108. package/dist/src/commands/compact/index.js +11 -0
  109. package/dist/src/commands/config/config.js +5 -0
  110. package/dist/src/commands/config/index.js +8 -0
  111. package/dist/src/commands/context/context-noninteractive.js +221 -0
  112. package/dist/src/commands/context/context.js +46 -0
  113. package/dist/src/commands/context/index.js +21 -0
  114. package/dist/src/commands/copy/copy.js +366 -0
  115. package/dist/src/commands/copy/index.js +7 -0
  116. package/dist/src/commands/cost/cost.js +21 -0
  117. package/dist/src/commands/cost/index.js +16 -0
  118. package/dist/src/commands/createMovedToPluginCommand.js +33 -0
  119. package/dist/src/commands/ctx_viz/index.js +1 -0
  120. package/dist/src/commands/debug-tool-call/index.js +1 -0
  121. package/dist/src/commands/desktop/desktop.js +5 -0
  122. package/dist/src/commands/desktop/index.js +22 -0
  123. package/dist/src/commands/diff/diff.js +5 -0
  124. package/dist/src/commands/diff/index.js +6 -0
  125. package/dist/src/commands/doctor/doctor.js +5 -0
  126. package/dist/src/commands/doctor/index.js +9 -0
  127. package/dist/src/commands/effort/effort.js +166 -0
  128. package/dist/src/commands/effort/index.js +11 -0
  129. package/dist/src/commands/env/index.js +1 -0
  130. package/dist/src/commands/exit/exit.js +31 -0
  131. package/dist/src/commands/exit/index.js +9 -0
  132. package/dist/src/commands/export/export.js +86 -0
  133. package/dist/src/commands/export/index.js +8 -0
  134. package/dist/src/commands/extra-usage/extra-usage-core.js +99 -0
  135. package/dist/src/commands/extra-usage/extra-usage-noninteractive.js +13 -0
  136. package/dist/src/commands/extra-usage/extra-usage.js +14 -0
  137. package/dist/src/commands/extra-usage/index.js +27 -0
  138. package/dist/src/commands/fast/fast.js +275 -0
  139. package/dist/src/commands/fast/index.js +20 -0
  140. package/dist/src/commands/feedback/feedback.js +10 -0
  141. package/dist/src/commands/feedback/index.js +21 -0
  142. package/dist/src/commands/files/files.js +11 -0
  143. package/dist/src/commands/files/index.js +9 -0
  144. package/dist/src/commands/good-claude/index.js +1 -0
  145. package/dist/src/commands/heapdump/heapdump.js +14 -0
  146. package/dist/src/commands/heapdump/index.js +9 -0
  147. package/dist/src/commands/help/help.js +5 -0
  148. package/dist/src/commands/help/index.js +7 -0
  149. package/dist/src/commands/hooks/hooks.js +11 -0
  150. package/dist/src/commands/hooks/index.js +8 -0
  151. package/dist/src/commands/ide/ide.js +615 -0
  152. package/dist/src/commands/ide/index.js +8 -0
  153. package/dist/src/commands/init-verifiers.js +258 -0
  154. package/dist/src/commands/init.js +249 -0
  155. package/dist/src/commands/insights.js +2555 -0
  156. package/dist/src/commands/install-github-app/ApiKeyStep.js +230 -0
  157. package/dist/src/commands/install-github-app/CheckExistingSecretStep.js +194 -0
  158. package/dist/src/commands/install-github-app/CheckGitHubStep.js +15 -0
  159. package/dist/src/commands/install-github-app/ChooseRepoStep.js +211 -0
  160. package/dist/src/commands/install-github-app/CreatingStep.js +52 -0
  161. package/dist/src/commands/install-github-app/ErrorStep.js +83 -0
  162. package/dist/src/commands/install-github-app/ExistingWorkflowStep.js +104 -0
  163. package/dist/src/commands/install-github-app/InstallAppStep.js +96 -0
  164. package/dist/src/commands/install-github-app/OAuthFlowStep.js +190 -0
  165. package/dist/src/commands/install-github-app/SuccessStep.js +93 -0
  166. package/dist/src/commands/install-github-app/WarningsStep.js +70 -0
  167. package/dist/src/commands/install-github-app/index.js +10 -0
  168. package/dist/src/commands/install-github-app/install-github-app.js +593 -0
  169. package/dist/src/commands/install-github-app/setupGitHubActions.js +227 -0
  170. package/dist/src/commands/install-slack-app/index.js +9 -0
  171. package/dist/src/commands/install-slack-app/install-slack-app.js +25 -0
  172. package/dist/src/commands/install.js +118 -0
  173. package/dist/src/commands/issue/index.js +1 -0
  174. package/dist/src/commands/keybindings/index.js +10 -0
  175. package/dist/src/commands/keybindings/keybindings.js +47 -0
  176. package/dist/src/commands/limites/index.js +8 -0
  177. package/dist/src/commands/limites/limites.js +214 -0
  178. package/dist/src/commands/login/index.js +11 -0
  179. package/dist/src/commands/login/login.js +120 -0
  180. package/dist/src/commands/login-openai/index.js +7 -0
  181. package/dist/src/commands/login-openai/login-openai.js +54 -0
  182. package/dist/src/commands/logout/index.js +8 -0
  183. package/dist/src/commands/logout/logout.js +72 -0
  184. package/dist/src/commands/mcp/addCommand.js +183 -0
  185. package/dist/src/commands/mcp/index.js +9 -0
  186. package/dist/src/commands/mcp/mcp.js +78 -0
  187. package/dist/src/commands/mcp/xaaIdpCommand.js +193 -0
  188. package/dist/src/commands/memory/index.js +7 -0
  189. package/dist/src/commands/memory/memory.js +71 -0
  190. package/dist/src/commands/mobile/index.js +9 -0
  191. package/dist/src/commands/mobile/mobile.js +278 -0
  192. package/dist/src/commands/mock-limits/index.js +1 -0
  193. package/dist/src/commands/model/index.js +14 -0
  194. package/dist/src/commands/model/model.js +297 -0
  195. package/dist/src/commands/oauth-refresh/index.js +1 -0
  196. package/dist/src/commands/onboarding/index.js +1 -0
  197. package/dist/src/commands/orchestrate/index.js +8 -0
  198. package/dist/src/commands/orchestrate/orchestrate.js +542 -0
  199. package/dist/src/commands/output-style/index.js +8 -0
  200. package/dist/src/commands/output-style/output-style.js +6 -0
  201. package/dist/src/commands/passes/index.js +17 -0
  202. package/dist/src/commands/passes/passes.js +22 -0
  203. package/dist/src/commands/perf-issue/index.js +1 -0
  204. package/dist/src/commands/permissions/index.js +8 -0
  205. package/dist/src/commands/permissions/permissions.js +8 -0
  206. package/dist/src/commands/plan/index.js +8 -0
  207. package/dist/src/commands/plan/plan.js +115 -0
  208. package/dist/src/commands/plugin/AddMarketplace.js +95 -0
  209. package/dist/src/commands/plugin/BrowseMarketplace.js +576 -0
  210. package/dist/src/commands/plugin/DiscoverPlugins.js +613 -0
  211. package/dist/src/commands/plugin/ManageMarketplaces.js +582 -0
  212. package/dist/src/commands/plugin/ManagePlugins.js +1783 -0
  213. package/dist/src/commands/plugin/PluginErrors.js +124 -0
  214. package/dist/src/commands/plugin/PluginOptionsDialog.js +367 -0
  215. package/dist/src/commands/plugin/PluginOptionsFlow.js +97 -0
  216. package/dist/src/commands/plugin/PluginSettings.js +1042 -0
  217. package/dist/src/commands/plugin/PluginTrustWarning.js +34 -0
  218. package/dist/src/commands/plugin/UnifiedInstalledCell.js +615 -0
  219. package/dist/src/commands/plugin/ValidatePlugin.js +95 -0
  220. package/dist/src/commands/plugin/index.js +10 -0
  221. package/dist/src/commands/plugin/parseArgs.js +71 -0
  222. package/dist/src/commands/plugin/plugin.js +5 -0
  223. package/dist/src/commands/plugin/pluginDetailsHelpers.js +89 -0
  224. package/dist/src/commands/plugin/usePagination.js +89 -0
  225. package/dist/src/commands/policy/index.js +9 -0
  226. package/dist/src/commands/policy/policy.js +84 -0
  227. package/dist/src/commands/pr_comments/index.js +49 -0
  228. package/dist/src/commands/privacy-settings/index.js +11 -0
  229. package/dist/src/commands/privacy-settings/privacy-settings.js +54 -0
  230. package/dist/src/commands/profile/index.js +9 -0
  231. package/dist/src/commands/profile/profile.js +482 -0
  232. package/dist/src/commands/provider/index.js +8 -0
  233. package/dist/src/commands/provider/provider.js +457 -0
  234. package/dist/src/commands/rate-limit-options/index.js +15 -0
  235. package/dist/src/commands/rate-limit-options/rate-limit-options.js +213 -0
  236. package/dist/src/commands/release-notes/index.js +9 -0
  237. package/dist/src/commands/release-notes/release-notes.js +38 -0
  238. package/dist/src/commands/reload-plugins/index.js +11 -0
  239. package/dist/src/commands/reload-plugins/reload-plugins.js +52 -0
  240. package/dist/src/commands/remote-env/index.js +12 -0
  241. package/dist/src/commands/remote-env/remote-env.js +5 -0
  242. package/dist/src/commands/remote-setup/api.js +155 -0
  243. package/dist/src/commands/remote-setup/index.js +15 -0
  244. package/dist/src/commands/remote-setup/remote-setup.js +149 -0
  245. package/dist/src/commands/rename/generateSessionName.js +58 -0
  246. package/dist/src/commands/rename/index.js +9 -0
  247. package/dist/src/commands/rename/rename.js +52 -0
  248. package/dist/src/commands/reset-limits/index.js +4 -0
  249. package/dist/src/commands/resume/index.js +9 -0
  250. package/dist/src/commands/resume/resume.js +239 -0
  251. package/dist/src/commands/review/UltrareviewOverageDialog.js +97 -0
  252. package/dist/src/commands/review/reviewRemote.js +259 -0
  253. package/dist/src/commands/review/ultrareviewCommand.js +57 -0
  254. package/dist/src/commands/review/ultrareviewEnabled.js +10 -0
  255. package/dist/src/commands/review.js +50 -0
  256. package/dist/src/commands/rewind/index.js +10 -0
  257. package/dist/src/commands/rewind/rewind.js +7 -0
  258. package/dist/src/commands/run/index.js +9 -0
  259. package/dist/src/commands/run/run.js +1126 -0
  260. package/dist/src/commands/sandbox-toggle/index.js +41 -0
  261. package/dist/src/commands/sandbox-toggle/sandbox-toggle.js +72 -0
  262. package/dist/src/commands/security-review.js +231 -0
  263. package/dist/src/commands/session/index.js +13 -0
  264. package/dist/src/commands/session/session.js +142 -0
  265. package/dist/src/commands/share/index.js +1 -0
  266. package/dist/src/commands/skills/index.js +8 -0
  267. package/dist/src/commands/skills/skills.js +97 -0
  268. package/dist/src/commands/stats/index.js +7 -0
  269. package/dist/src/commands/stats/stats.js +5 -0
  270. package/dist/src/commands/status/index.js +8 -0
  271. package/dist/src/commands/status/status.js +5 -0
  272. package/dist/src/commands/statusline.js +22 -0
  273. package/dist/src/commands/stickers/index.js +9 -0
  274. package/dist/src/commands/stickers/stickers.js +14 -0
  275. package/dist/src/commands/summary/index.js +1 -0
  276. package/dist/src/commands/tag/index.js +9 -0
  277. package/dist/src/commands/tag/tag.js +215 -0
  278. package/dist/src/commands/tasks/index.js +8 -0
  279. package/dist/src/commands/tasks/tasks.js +5 -0
  280. package/dist/src/commands/team/index.js +9 -0
  281. package/dist/src/commands/team/team.js +582 -0
  282. package/dist/src/commands/team-auto/index.js +9 -0
  283. package/dist/src/commands/team-auto/teamAuto.js +340 -0
  284. package/dist/src/commands/telegram/index.js +9 -0
  285. package/dist/src/commands/telegram/telegram.js +118 -0
  286. package/dist/src/commands/teleport/index.js +1 -0
  287. package/dist/src/commands/terminalSetup/index.js +18 -0
  288. package/dist/src/commands/terminalSetup/terminalSetup.js +491 -0
  289. package/dist/src/commands/theme/index.js +7 -0
  290. package/dist/src/commands/theme/theme.js +50 -0
  291. package/dist/src/commands/thinkback/index.js +9 -0
  292. package/dist/src/commands/thinkback/thinkback.js +527 -0
  293. package/dist/src/commands/thinkback-play/index.js +13 -0
  294. package/dist/src/commands/thinkback-play/thinkback-play.js +34 -0
  295. package/dist/src/commands/ultraplan.js +418 -0
  296. package/dist/src/commands/upgrade/index.js +12 -0
  297. package/dist/src/commands/upgrade/upgrade.js +37 -0
  298. package/dist/src/commands/version.js +18 -0
  299. package/dist/src/commands/vim/index.js +8 -0
  300. package/dist/src/commands/vim/vim.js +25 -0
  301. package/dist/src/commands/voice/index.js +14 -0
  302. package/dist/src/commands/voice/voice.js +130 -0
  303. package/dist/src/commands/whatsapp/index.js +9 -0
  304. package/dist/src/commands/whatsapp/whatsapp.js +326 -0
  305. package/dist/src/commands/workspace/index.js +9 -0
  306. package/dist/src/commands/workspace/workspace.js +701 -0
  307. package/dist/src/commands.js +635 -0
  308. package/dist/src/components/AgentProgressLine.js +111 -0
  309. package/dist/src/components/App.js +45 -0
  310. package/dist/src/components/ApproveApiKey.js +124 -0
  311. package/dist/src/components/AutoModeOptInDialog.js +140 -0
  312. package/dist/src/components/AutoUpdater.js +157 -0
  313. package/dist/src/components/AutoUpdaterWrapper.js +78 -0
  314. package/dist/src/components/AwsAuthStatusBox.js +88 -0
  315. package/dist/src/components/BaseTextInput.js +105 -0
  316. package/dist/src/components/BashModeProgress.js +48 -0
  317. package/dist/src/components/BridgeDialog.js +414 -0
  318. package/dist/src/components/BypassPermissionsModeDialog.js +87 -0
  319. package/dist/src/components/ChannelDowngradeDialog.js +100 -0
  320. package/dist/src/components/ClaudeCodeHint/PluginHintMenu.js +37 -0
  321. package/dist/src/components/ClaudeInChromeOnboarding.js +126 -0
  322. package/dist/src/components/ClaudeMdExternalIncludesDialog.js +137 -0
  323. package/dist/src/components/ClickableImageRef.js +64 -0
  324. package/dist/src/components/CompactSummary.js +119 -0
  325. package/dist/src/components/ConfigurableShortcutHint.js +34 -0
  326. package/dist/src/components/ConsoleOAuthFlow.js +758 -0
  327. package/dist/src/components/ContextSuggestions.js +43 -0
  328. package/dist/src/components/ContextVisualization.js +483 -0
  329. package/dist/src/components/CoordinatorAgentStatus.js +261 -0
  330. package/dist/src/components/CostThresholdDialog.js +48 -0
  331. package/dist/src/components/CtrlOToExpand.js +50 -0
  332. package/dist/src/components/CustomSelect/SelectMulti.js +149 -0
  333. package/dist/src/components/CustomSelect/index.js +2 -0
  334. package/dist/src/components/CustomSelect/option-map.js +32 -0
  335. package/dist/src/components/CustomSelect/select-input-option.js +426 -0
  336. package/dist/src/components/CustomSelect/select-option.js +23 -0
  337. package/dist/src/components/CustomSelect/select.js +518 -0
  338. package/dist/src/components/CustomSelect/use-multi-select-state.js +214 -0
  339. package/dist/src/components/CustomSelect/use-select-input.js +170 -0
  340. package/dist/src/components/CustomSelect/use-select-navigation.js +366 -0
  341. package/dist/src/components/CustomSelect/use-select-state.js +22 -0
  342. package/dist/src/components/DesktopHandoff.js +195 -0
  343. package/dist/src/components/DesktopUpsell/DesktopUpsellStartup.js +173 -0
  344. package/dist/src/components/DevBar.js +50 -0
  345. package/dist/src/components/DevChannelsDialog.js +103 -0
  346. package/dist/src/components/DiagnosticsDisplay.js +91 -0
  347. package/dist/src/components/EffortCallout.js +264 -0
  348. package/dist/src/components/EffortIndicator.js +29 -0
  349. package/dist/src/components/ExitFlow.js +40 -0
  350. package/dist/src/components/ExportDialog.js +101 -0
  351. package/dist/src/components/FallbackToolUseErrorMessage.js +115 -0
  352. package/dist/src/components/FallbackToolUseRejectedMessage.js +16 -0
  353. package/dist/src/components/FastIcon.js +42 -0
  354. package/dist/src/components/Feedback.js +439 -0
  355. package/dist/src/components/FeedbackSurvey/FeedbackSurvey.js +150 -0
  356. package/dist/src/components/FeedbackSurvey/FeedbackSurveyView.js +103 -0
  357. package/dist/src/components/FeedbackSurvey/TranscriptSharePrompt.js +83 -0
  358. package/dist/src/components/FeedbackSurvey/submitTranscriptShare.js +81 -0
  359. package/dist/src/components/FeedbackSurvey/useDebouncedDigitInput.js +51 -0
  360. package/dist/src/components/FeedbackSurvey/useFeedbackSurvey.js +258 -0
  361. package/dist/src/components/FeedbackSurvey/useMemorySurvey.js +191 -0
  362. package/dist/src/components/FeedbackSurvey/usePostCompactSurvey.js +202 -0
  363. package/dist/src/components/FeedbackSurvey/useSurveyState.js +80 -0
  364. package/dist/src/components/FileEditToolDiff.js +166 -0
  365. package/dist/src/components/FileEditToolUpdatedMessage.js +111 -0
  366. package/dist/src/components/FileEditToolUseRejectedMessage.js +157 -0
  367. package/dist/src/components/FilePathLink.js +34 -0
  368. package/dist/src/components/FullscreenLayout.js +578 -0
  369. package/dist/src/components/GlobalSearchDialog.js +339 -0
  370. package/dist/src/components/HelpV2/Commands.js +65 -0
  371. package/dist/src/components/HelpV2/General.js +24 -0
  372. package/dist/src/components/HelpV2/HelpV2.js +186 -0
  373. package/dist/src/components/HighlightedCode/Fallback.js +193 -0
  374. package/dist/src/components/HighlightedCode.js +184 -0
  375. package/dist/src/components/HistorySearchDialog.js +92 -0
  376. package/dist/src/components/IdeAutoConnectDialog.js +153 -0
  377. package/dist/src/components/IdeOnboardingDialog.js +174 -0
  378. package/dist/src/components/IdeStatusIndicator.js +49 -0
  379. package/dist/src/components/IdleReturnDialog.js +116 -0
  380. package/dist/src/components/InterruptedByUser.js +15 -0
  381. package/dist/src/components/InvalidConfigDialog.js +134 -0
  382. package/dist/src/components/InvalidSettingsDialog.js +84 -0
  383. package/dist/src/components/KeybindingWarnings.js +54 -0
  384. package/dist/src/components/LanguagePicker.js +84 -0
  385. package/dist/src/components/LogSelector.js +1579 -0
  386. package/dist/src/components/LogoV2/AnimatedAsterisk.js +42 -0
  387. package/dist/src/components/LogoV2/AnimatedClawd.js +111 -0
  388. package/dist/src/components/LogoV2/ChannelsNotice.js +258 -0
  389. package/dist/src/components/LogoV2/Clawd.js +12 -0
  390. package/dist/src/components/LogoV2/CondensedLogo.js +144 -0
  391. package/dist/src/components/LogoV2/EmergencyTip.js +47 -0
  392. package/dist/src/components/LogoV2/Feed.js +84 -0
  393. package/dist/src/components/LogoV2/FeedColumn.js +55 -0
  394. package/dist/src/components/LogoV2/GuestPassesUpsell.js +71 -0
  395. package/dist/src/components/LogoV2/LogoV2.js +564 -0
  396. package/dist/src/components/LogoV2/Opus1mMergeNotice.js +56 -0
  397. package/dist/src/components/LogoV2/OverageCreditUpsell.js +160 -0
  398. package/dist/src/components/LogoV2/VoiceModeNotice.js +70 -0
  399. package/dist/src/components/LogoV2/WelcomeV2.js +8 -0
  400. package/dist/src/components/LogoV2/feedConfigs.js +78 -0
  401. package/dist/src/components/LspRecommendation/LspRecommendationMenu.js +46 -0
  402. package/dist/src/components/MCPServerApprovalDialog.js +113 -0
  403. package/dist/src/components/MCPServerDesktopImportDialog.js +206 -0
  404. package/dist/src/components/MCPServerDialogCopy.js +15 -0
  405. package/dist/src/components/MCPServerMultiselectDialog.js +133 -0
  406. package/dist/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +149 -0
  407. package/dist/src/components/ManagedSettingsSecurityDialog/utils.js +105 -0
  408. package/dist/src/components/Markdown.js +217 -0
  409. package/dist/src/components/MarkdownTable.js +279 -0
  410. package/dist/src/components/MemoryUsageIndicator.js +27 -0
  411. package/dist/src/components/Message.js +566 -0
  412. package/dist/src/components/MessageModel.js +36 -0
  413. package/dist/src/components/MessageResponse.js +73 -0
  414. package/dist/src/components/MessageRow.js +346 -0
  415. package/dist/src/components/MessageSelector.js +743 -0
  416. package/dist/src/components/MessageTimestamp.js +57 -0
  417. package/dist/src/components/Messages.js +637 -0
  418. package/dist/src/components/ModelPicker.js +493 -0
  419. package/dist/src/components/NativeAutoUpdater.js +153 -0
  420. package/dist/src/components/NotebookEditToolUseRejectedMessage.js +83 -0
  421. package/dist/src/components/OffscreenFreeze.js +35 -0
  422. package/dist/src/components/Onboarding.js +174 -0
  423. package/dist/src/components/OutputStylePicker.js +102 -0
  424. package/dist/src/components/PackageManagerAutoUpdater.js +100 -0
  425. package/dist/src/components/Passes/Passes.js +113 -0
  426. package/dist/src/components/PrBadge.js +90 -0
  427. package/dist/src/components/PressEnterToContinue.js +15 -0
  428. package/dist/src/components/PromptInput/HistorySearchInput.js +44 -0
  429. package/dist/src/components/PromptInput/IssueFlagBanner.js +8 -0
  430. package/dist/src/components/PromptInput/Notifications.js +221 -0
  431. package/dist/src/components/PromptInput/PromptInput.js +1998 -0
  432. package/dist/src/components/PromptInput/PromptInputFooter.js +84 -0
  433. package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +409 -0
  434. package/dist/src/components/PromptInput/PromptInputFooterSuggestions.js +280 -0
  435. package/dist/src/components/PromptInput/PromptInputHelpMenu.js +379 -0
  436. package/dist/src/components/PromptInput/PromptInputModeIndicator.js +72 -0
  437. package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +105 -0
  438. package/dist/src/components/PromptInput/PromptInputStashNotice.js +20 -0
  439. package/dist/src/components/PromptInput/SandboxPromptFooterHint.js +65 -0
  440. package/dist/src/components/PromptInput/ShimmeredInput.js +132 -0
  441. package/dist/src/components/PromptInput/VoiceIndicator.js +136 -0
  442. package/dist/src/components/PromptInput/inputModes.js +24 -0
  443. package/dist/src/components/PromptInput/inputPaste.js +62 -0
  444. package/dist/src/components/PromptInput/useMaybeTruncateInput.js +33 -0
  445. package/dist/src/components/PromptInput/usePromptInputPlaceholder.js +55 -0
  446. package/dist/src/components/PromptInput/useShowFastIconHint.js +23 -0
  447. package/dist/src/components/PromptInput/useSwarmBanner.js +112 -0
  448. package/dist/src/components/PromptInput/utils.js +50 -0
  449. package/dist/src/components/QuickOpenDialog.js +243 -0
  450. package/dist/src/components/RemoteCallout.js +53 -0
  451. package/dist/src/components/RemoteEnvironmentDialog.js +345 -0
  452. package/dist/src/components/ResumeTask.js +173 -0
  453. package/dist/src/components/SandboxViolationExpandedView.js +102 -0
  454. package/dist/src/components/ScrollKeybindingHandler.js +982 -0
  455. package/dist/src/components/SearchBox.js +55 -0
  456. package/dist/src/components/SentryErrorBoundary.js +16 -0
  457. package/dist/src/components/SessionBackgroundHint.js +104 -0
  458. package/dist/src/components/SessionPreview.js +200 -0
  459. package/dist/src/components/Settings/Config.js +1628 -0
  460. package/dist/src/components/Settings/Settings.js +129 -0
  461. package/dist/src/components/Settings/Status.js +239 -0
  462. package/dist/src/components/Settings/Usage.js +341 -0
  463. package/dist/src/components/ShowInIDEPrompt.js +151 -0
  464. package/dist/src/components/SkillImprovementSurvey.js +130 -0
  465. package/dist/src/components/Spinner/FlashingChar.js +51 -0
  466. package/dist/src/components/Spinner/GlimmerMessage.js +328 -0
  467. package/dist/src/components/Spinner/ShimmerChar.js +22 -0
  468. package/dist/src/components/Spinner/SpinnerAnimationRow.js +169 -0
  469. package/dist/src/components/Spinner/SpinnerGlyph.js +69 -0
  470. package/dist/src/components/Spinner/TeammateSpinnerLine.js +170 -0
  471. package/dist/src/components/Spinner/TeammateSpinnerTree.js +268 -0
  472. package/dist/src/components/Spinner/index.js +11 -0
  473. package/dist/src/components/Spinner/teammateSelectHint.js +1 -0
  474. package/dist/src/components/Spinner/useShimmerAnimation.js +22 -0
  475. package/dist/src/components/Spinner/useStalledAnimation.js +63 -0
  476. package/dist/src/components/Spinner/utils.js +77 -0
  477. package/dist/src/components/Spinner.js +470 -0
  478. package/dist/src/components/Stats.js +1000 -0
  479. package/dist/src/components/StatusLine.js +288 -0
  480. package/dist/src/components/StatusNotices.js +50 -0
  481. package/dist/src/components/StructuredDiff/Fallback.js +335 -0
  482. package/dist/src/components/StructuredDiff/colorDiff.js +26 -0
  483. package/dist/src/components/StructuredDiff.js +152 -0
  484. package/dist/src/components/StructuredDiffList.js +8 -0
  485. package/dist/src/components/TagTabs.js +100 -0
  486. package/dist/src/components/TaskListV2.js +333 -0
  487. package/dist/src/components/TeammateViewHeader.js +87 -0
  488. package/dist/src/components/TeleportError.js +191 -0
  489. package/dist/src/components/TeleportProgress.js +130 -0
  490. package/dist/src/components/TeleportRepoMismatchDialog.js +98 -0
  491. package/dist/src/components/TeleportResumeWrapper.js +158 -0
  492. package/dist/src/components/TeleportStash.js +82 -0
  493. package/dist/src/components/TextInput.js +108 -0
  494. package/dist/src/components/ThemePicker.js +330 -0
  495. package/dist/src/components/ThinkingToggle.js +153 -0
  496. package/dist/src/components/TokenWarning.js +172 -0
  497. package/dist/src/components/ToolUseLoader.js +34 -0
  498. package/dist/src/components/TrustDialog/TrustDialog.js +113 -0
  499. package/dist/src/components/TrustDialog/utils.js +199 -0
  500. package/dist/src/components/ValidationErrorsList.js +146 -0
  501. package/dist/src/components/VimTextInput.js +136 -0
  502. package/dist/src/components/VirtualMessageList.js +892 -0
  503. package/dist/src/components/WorkflowMultiselectDialog.js +118 -0
  504. package/dist/src/components/WorktreeExitDialog.js +222 -0
  505. package/dist/src/components/agents/AgentDetail.js +226 -0
  506. package/dist/src/components/agents/AgentEditor.js +146 -0
  507. package/dist/src/components/agents/AgentNavigationFooter.js +21 -0
  508. package/dist/src/components/agents/AgentsList.js +436 -0
  509. package/dist/src/components/agents/AgentsMenu.js +848 -0
  510. package/dist/src/components/agents/ColorPicker.js +110 -0
  511. package/dist/src/components/agents/ModelSelector.js +62 -0
  512. package/dist/src/components/agents/SnapshotUpdateDialog.js +16 -0
  513. package/dist/src/components/agents/ToolSelector.js +557 -0
  514. package/dist/src/components/agents/agentFileUtils.js +187 -0
  515. package/dist/src/components/agents/generateAgent.js +161 -0
  516. package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +88 -0
  517. package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +80 -0
  518. package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +386 -0
  519. package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +63 -0
  520. package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +126 -0
  521. package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +118 -0
  522. package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +92 -0
  523. package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +120 -0
  524. package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +79 -0
  525. package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +48 -0
  526. package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +131 -0
  527. package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +51 -0
  528. package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +100 -0
  529. package/dist/src/components/agents/types.js +4 -0
  530. package/dist/src/components/agents/utils.js +14 -0
  531. package/dist/src/components/agents/validateAgent.js +79 -0
  532. package/dist/src/components/design-system/Byline.js +72 -0
  533. package/dist/src/components/design-system/Dialog.js +116 -0
  534. package/dist/src/components/design-system/Divider.js +109 -0
  535. package/dist/src/components/design-system/FuzzyPicker.js +187 -0
  536. package/dist/src/components/design-system/KeyboardShortcutHint.js +67 -0
  537. package/dist/src/components/design-system/ListItem.js +183 -0
  538. package/dist/src/components/design-system/LoadingState.js +68 -0
  539. package/dist/src/components/design-system/Pane.js +68 -0
  540. package/dist/src/components/design-system/ProgressBar.js +62 -0
  541. package/dist/src/components/design-system/Ratchet.js +71 -0
  542. package/dist/src/components/design-system/StatusIcon.js +69 -0
  543. package/dist/src/components/design-system/Tabs.js +269 -0
  544. package/dist/src/components/design-system/ThemeProvider.js +137 -0
  545. package/dist/src/components/design-system/ThemedBox.js +125 -0
  546. package/dist/src/components/design-system/ThemedText.js +60 -0
  547. package/dist/src/components/design-system/color.js +22 -0
  548. package/dist/src/components/diff/DiffDetailView.js +284 -0
  549. package/dist/src/components/diff/DiffDialog.js +387 -0
  550. package/dist/src/components/diff/DiffFileList.js +291 -0
  551. package/dist/src/components/grove/Grove.js +483 -0
  552. package/dist/src/components/hooks/HooksConfigMenu.js +570 -0
  553. package/dist/src/components/hooks/PromptDialog.js +81 -0
  554. package/dist/src/components/hooks/SelectEventMode.js +117 -0
  555. package/dist/src/components/hooks/SelectHookMode.js +93 -0
  556. package/dist/src/components/hooks/SelectMatcherMode.js +124 -0
  557. package/dist/src/components/hooks/ViewHookMode.js +197 -0
  558. package/dist/src/components/mcp/CapabilitiesSection.js +55 -0
  559. package/dist/src/components/mcp/ElicitationDialog.js +945 -0
  560. package/dist/src/components/mcp/MCPAgentServerMenu.js +95 -0
  561. package/dist/src/components/mcp/MCPListPanel.js +504 -0
  562. package/dist/src/components/mcp/MCPReconnect.js +168 -0
  563. package/dist/src/components/mcp/MCPRemoteServerMenu.js +460 -0
  564. package/dist/src/components/mcp/MCPSettings.js +414 -0
  565. package/dist/src/components/mcp/MCPStdioServerMenu.js +95 -0
  566. package/dist/src/components/mcp/MCPToolDetailView.js +219 -0
  567. package/dist/src/components/mcp/MCPToolListView.js +136 -0
  568. package/dist/src/components/mcp/McpParsingWarnings.js +211 -0
  569. package/dist/src/components/mcp/index.js +8 -0
  570. package/dist/src/components/mcp/types.js +3 -0
  571. package/dist/src/components/mcp/utils/reconnectHelpers.js +35 -0
  572. package/dist/src/components/memory/MemoryFileSelector.js +455 -0
  573. package/dist/src/components/memory/MemoryUpdateNotification.js +42 -0
  574. package/dist/src/components/messageActions.js +418 -0
  575. package/dist/src/components/messages/AdvisorMessage.js +151 -0
  576. package/dist/src/components/messages/AssistantRedactedThinkingMessage.js +27 -0
  577. package/dist/src/components/messages/AssistantTextMessage.js +274 -0
  578. package/dist/src/components/messages/AssistantThinkingMessage.js +69 -0
  579. package/dist/src/components/messages/AssistantToolUseMessage.js +323 -0
  580. package/dist/src/components/messages/AttachmentMessage.js +418 -0
  581. package/dist/src/components/messages/CollapsedReadSearchContent.js +362 -0
  582. package/dist/src/components/messages/CompactBoundaryMessage.js +18 -0
  583. package/dist/src/components/messages/GroupedToolUseContent.js +37 -0
  584. package/dist/src/components/messages/HighlightedThinkingText.js +164 -0
  585. package/dist/src/components/messages/HookProgressMessage.js +110 -0
  586. package/dist/src/components/messages/PlanApprovalMessage.js +212 -0
  587. package/dist/src/components/messages/RateLimitMessage.js +149 -0
  588. package/dist/src/components/messages/ShutdownMessage.js +123 -0
  589. package/dist/src/components/messages/SystemAPIErrorMessage.js +135 -0
  590. package/dist/src/components/messages/SystemTextMessage.js +843 -0
  591. package/dist/src/components/messages/TaskAssignmentMessage.js +71 -0
  592. package/dist/src/components/messages/UserAgentNotificationMessage.js +77 -0
  593. package/dist/src/components/messages/UserBashInputMessage.js +51 -0
  594. package/dist/src/components/messages/UserBashOutputMessage.js +54 -0
  595. package/dist/src/components/messages/UserChannelMessage.js +129 -0
  596. package/dist/src/components/messages/UserCommandMessage.js +106 -0
  597. package/dist/src/components/messages/UserImageMessage.js +53 -0
  598. package/dist/src/components/messages/UserLocalCommandOutputMessage.js +169 -0
  599. package/dist/src/components/messages/UserMemoryInputMessage.js +72 -0
  600. package/dist/src/components/messages/UserPlanMessage.js +37 -0
  601. package/dist/src/components/messages/UserPromptMessage.js +63 -0
  602. package/dist/src/components/messages/UserResourceUpdateMessage.js +101 -0
  603. package/dist/src/components/messages/UserTeammateMessage.js +156 -0
  604. package/dist/src/components/messages/UserTextMessage.js +271 -0
  605. package/dist/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +27 -0
  606. package/dist/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +16 -0
  607. package/dist/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +16 -0
  608. package/dist/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +91 -0
  609. package/dist/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +73 -0
  610. package/dist/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +83 -0
  611. package/dist/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +58 -0
  612. package/dist/src/components/messages/UserToolResultMessage/utils.js +43 -0
  613. package/dist/src/components/messages/nullRenderingAttachments.js +58 -0
  614. package/dist/src/components/messages/teamMemCollapsed.js +142 -0
  615. package/dist/src/components/messages/teamMemSaved.js +17 -0
  616. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +654 -0
  617. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +219 -0
  618. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +227 -0
  619. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +174 -0
  620. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +444 -0
  621. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +136 -0
  622. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +100 -0
  623. package/dist/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +404 -0
  624. package/dist/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +110 -0
  625. package/dist/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +448 -0
  626. package/dist/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +125 -0
  627. package/dist/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +649 -0
  628. package/dist/src/components/permissions/FallbackPermissionRequest.js +348 -0
  629. package/dist/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +184 -0
  630. package/dist/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +108 -0
  631. package/dist/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +13 -0
  632. package/dist/src/components/permissions/FilePermissionDialog/permissionOptions.js +136 -0
  633. package/dist/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +131 -0
  634. package/dist/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +86 -0
  635. package/dist/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +163 -0
  636. package/dist/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +78 -0
  637. package/dist/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +112 -0
  638. package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +163 -0
  639. package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +217 -0
  640. package/dist/src/components/permissions/PermissionDecisionDebugInfo.js +466 -0
  641. package/dist/src/components/permissions/PermissionDialog.js +54 -0
  642. package/dist/src/components/permissions/PermissionExplanation.js +269 -0
  643. package/dist/src/components/permissions/PermissionPrompt.js +316 -0
  644. package/dist/src/components/permissions/PermissionRequest.js +160 -0
  645. package/dist/src/components/permissions/PermissionRequestTitle.js +57 -0
  646. package/dist/src/components/permissions/PermissionRuleExplanation.js +116 -0
  647. package/dist/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +178 -0
  648. package/dist/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +73 -0
  649. package/dist/src/components/permissions/SandboxPermissionRequest.js +161 -0
  650. package/dist/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +228 -0
  651. package/dist/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +384 -0
  652. package/dist/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +258 -0
  653. package/dist/src/components/permissions/WorkerBadge.js +43 -0
  654. package/dist/src/components/permissions/WorkerPendingPermission.js +106 -0
  655. package/dist/src/components/permissions/hooks.js +163 -0
  656. package/dist/src/components/permissions/rules/AddPermissionRules.js +172 -0
  657. package/dist/src/components/permissions/rules/AddWorkspaceDirectory.js +334 -0
  658. package/dist/src/components/permissions/rules/PermissionRuleDescription.js +77 -0
  659. package/dist/src/components/permissions/rules/PermissionRuleInput.js +135 -0
  660. package/dist/src/components/permissions/rules/PermissionRuleList.js +1189 -0
  661. package/dist/src/components/permissions/rules/RecentDenialsTab.js +204 -0
  662. package/dist/src/components/permissions/rules/RemoveWorkspaceDirectory.js +102 -0
  663. package/dist/src/components/permissions/rules/WorkspaceTab.js +132 -0
  664. package/dist/src/components/permissions/shellPermissionHelpers.js +111 -0
  665. package/dist/src/components/permissions/useShellPermissionFeedback.js +108 -0
  666. package/dist/src/components/permissions/utils.js +14 -0
  667. package/dist/src/components/sandbox/SandboxConfigTab.js +47 -0
  668. package/dist/src/components/sandbox/SandboxDependenciesTab.js +122 -0
  669. package/dist/src/components/sandbox/SandboxDoctorSection.js +46 -0
  670. package/dist/src/components/sandbox/SandboxOverridesTab.js +192 -0
  671. package/dist/src/components/sandbox/SandboxSettings.js +296 -0
  672. package/dist/src/components/shell/ExpandShellOutputContext.js +33 -0
  673. package/dist/src/components/shell/OutputLine.js +110 -0
  674. package/dist/src/components/shell/ShellProgressMessage.js +143 -0
  675. package/dist/src/components/shell/ShellTimeDisplay.js +71 -0
  676. package/dist/src/components/skills/SkillsMenu.js +238 -0
  677. package/dist/src/components/tasks/AsyncAgentDetailDialog.js +234 -0
  678. package/dist/src/components/tasks/BackgroundTask.js +363 -0
  679. package/dist/src/components/tasks/BackgroundTaskStatus.js +419 -0
  680. package/dist/src/components/tasks/BackgroundTasksDialog.js +496 -0
  681. package/dist/src/components/tasks/DreamDetailDialog.js +250 -0
  682. package/dist/src/components/tasks/InProcessTeammateDetailDialog.js +274 -0
  683. package/dist/src/components/tasks/RemoteSessionDetailDialog.js +868 -0
  684. package/dist/src/components/tasks/RemoteSessionProgress.js +249 -0
  685. package/dist/src/components/tasks/ShellDetailDialog.js +403 -0
  686. package/dist/src/components/tasks/ShellProgress.js +76 -0
  687. package/dist/src/components/tasks/renderToolActivity.js +28 -0
  688. package/dist/src/components/tasks/taskStatusUtils.js +94 -0
  689. package/dist/src/components/teams/TeamStatus.js +76 -0
  690. package/dist/src/components/teams/TeamsDialog.js +672 -0
  691. package/dist/src/components/ui/ContextCard.js +5 -0
  692. package/dist/src/components/ui/OrderedList.js +66 -0
  693. package/dist/src/components/ui/OrderedListItem.js +41 -0
  694. package/dist/src/components/ui/TreeSelect.js +300 -0
  695. package/dist/src/components/wizard/WizardDialogLayout.js +47 -0
  696. package/dist/src/components/wizard/WizardNavigationFooter.js +10 -0
  697. package/dist/src/components/wizard/WizardProvider.js +217 -0
  698. package/dist/src/components/wizard/index.js +4 -0
  699. package/dist/src/components/wizard/useWizard.js +9 -0
  700. package/dist/src/constants/apiLimits.js +81 -0
  701. package/dist/src/constants/betas.js +45 -0
  702. package/dist/src/constants/common.js +29 -0
  703. package/dist/src/constants/cyberRiskInstruction.js +24 -0
  704. package/dist/src/constants/errorIds.js +14 -0
  705. package/dist/src/constants/figures.js +38 -0
  706. package/dist/src/constants/files.js +150 -0
  707. package/dist/src/constants/github-app.js +139 -0
  708. package/dist/src/constants/keys.js +10 -0
  709. package/dist/src/constants/messages.js +1 -0
  710. package/dist/src/constants/oauth.js +221 -0
  711. package/dist/src/constants/outputStyles.js +162 -0
  712. package/dist/src/constants/product.js +56 -0
  713. package/dist/src/constants/prompts.js +752 -0
  714. package/dist/src/constants/spinnerVerbs.js +202 -0
  715. package/dist/src/constants/system.js +77 -0
  716. package/dist/src/constants/systemPromptSections.js +39 -0
  717. package/dist/src/constants/toolLimits.js +50 -0
  718. package/dist/src/constants/tools.js +103 -0
  719. package/dist/src/constants/turnCompletionVerbs.js +12 -0
  720. package/dist/src/constants/xml.js +73 -0
  721. package/dist/src/context/QueuedMessageContext.js +51 -0
  722. package/dist/src/context/fpsMetrics.js +22 -0
  723. package/dist/src/context/mailbox.js +35 -0
  724. package/dist/src/context/modalContext.js +34 -0
  725. package/dist/src/context/notifications.js +199 -0
  726. package/dist/src/context/overlayContext.js +149 -0
  727. package/dist/src/context/promptOverlayContext.js +118 -0
  728. package/dist/src/context/stats.js +207 -0
  729. package/dist/src/context/voice.js +74 -0
  730. package/dist/src/context.js +146 -0
  731. package/dist/src/coordinator/coordinatorMode.js +349 -0
  732. package/dist/src/cost-tracker.js +208 -0
  733. package/dist/src/costHook.js +17 -0
  734. package/dist/src/daemon/main.js +16 -0
  735. package/dist/src/daemon/workerRegistry.js +16 -0
  736. package/dist/src/dialogLaunchers.js +68 -0
  737. package/dist/src/entrypoints/agentSdkTypes.js +202 -0
  738. package/dist/src/entrypoints/cli.js +252 -0
  739. package/dist/src/entrypoints/init.js +265 -0
  740. package/dist/src/entrypoints/mcp.js +142 -0
  741. package/dist/src/entrypoints/sandboxTypes.js +112 -0
  742. package/dist/src/entrypoints/sdk/controlSchemas.js +452 -0
  743. package/dist/src/entrypoints/sdk/controlTypes.js +1 -0
  744. package/dist/src/entrypoints/sdk/coreSchemas.js +1331 -0
  745. package/dist/src/entrypoints/sdk/coreTypes.generated.js +1 -0
  746. package/dist/src/entrypoints/sdk/coreTypes.js +49 -0
  747. package/dist/src/entrypoints/sdk/runtimeTypes.js +1 -0
  748. package/dist/src/entrypoints/sdk/toolTypes.js +1 -0
  749. package/dist/src/environment-runner/main.js +16 -0
  750. package/dist/src/history.js +386 -0
  751. package/dist/src/hooks/fileSuggestions.js +635 -0
  752. package/dist/src/hooks/notifs/useAutoModeUnavailableNotification.js +47 -0
  753. package/dist/src/hooks/notifs/useCanSwitchToExistingSubscription.js +57 -0
  754. package/dist/src/hooks/notifs/useDeprecationWarningNotification.js +43 -0
  755. package/dist/src/hooks/notifs/useFastModeNotification.js +164 -0
  756. package/dist/src/hooks/notifs/useIDEStatusIndicator.js +174 -0
  757. package/dist/src/hooks/notifs/useInstallMessages.js +27 -0
  758. package/dist/src/hooks/notifs/useLspInitializationNotification.js +144 -0
  759. package/dist/src/hooks/notifs/useMcpConnectivityStatus.js +80 -0
  760. package/dist/src/hooks/notifs/useModelMigrationNotifications.js +53 -0
  761. package/dist/src/hooks/notifs/useNpmDeprecationNotification.js +24 -0
  762. package/dist/src/hooks/notifs/usePluginAutoupdateNotification.js +82 -0
  763. package/dist/src/hooks/notifs/usePluginInstallationStatus.js +127 -0
  764. package/dist/src/hooks/notifs/useRateLimitWarningNotification.js +118 -0
  765. package/dist/src/hooks/notifs/useSettingsErrors.js +64 -0
  766. package/dist/src/hooks/notifs/useStartupNotification.js +33 -0
  767. package/dist/src/hooks/notifs/useTeammateShutdownNotification.js +64 -0
  768. package/dist/src/hooks/renderPlaceholder.js +26 -0
  769. package/dist/src/hooks/toolPermission/PermissionContext.js +211 -0
  770. package/dist/src/hooks/toolPermission/handlers/coordinatorHandler.js +44 -0
  771. package/dist/src/hooks/toolPermission/handlers/interactiveHandler.js +397 -0
  772. package/dist/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +108 -0
  773. package/dist/src/hooks/toolPermission/permissionLogging.js +145 -0
  774. package/dist/src/hooks/unifiedSuggestions.js +130 -0
  775. package/dist/src/hooks/useAfterFirstRender.js +12 -0
  776. package/dist/src/hooks/useApiKeyVerification.js +63 -0
  777. package/dist/src/hooks/useArrowKeyHistory.js +203 -0
  778. package/dist/src/hooks/useAssistantHistory.js +194 -0
  779. package/dist/src/hooks/useAwaySummary.js +105 -0
  780. package/dist/src/hooks/useBackgroundTaskNavigation.js +204 -0
  781. package/dist/src/hooks/useBlink.js +28 -0
  782. package/dist/src/hooks/useCanUseTool.js +192 -0
  783. package/dist/src/hooks/useCancelRequest.js +195 -0
  784. package/dist/src/hooks/useChromeExtensionNotification.js +49 -0
  785. package/dist/src/hooks/useClaudeCodeHintRecommendation.js +117 -0
  786. package/dist/src/hooks/useClipboardImageHint.js +59 -0
  787. package/dist/src/hooks/useCommandKeybindings.js +87 -0
  788. package/dist/src/hooks/useCommandQueue.js +10 -0
  789. package/dist/src/hooks/useCopyOnSelect.js +88 -0
  790. package/dist/src/hooks/useDeferredHookMessages.js +43 -0
  791. package/dist/src/hooks/useDiffData.js +69 -0
  792. package/dist/src/hooks/useDiffInIDE.js +252 -0
  793. package/dist/src/hooks/useDirectConnect.js +150 -0
  794. package/dist/src/hooks/useDoublePress.js +44 -0
  795. package/dist/src/hooks/useDynamicConfig.js +17 -0
  796. package/dist/src/hooks/useElapsedTime.js +25 -0
  797. package/dist/src/hooks/useExitOnCtrlCD.js +57 -0
  798. package/dist/src/hooks/useExitOnCtrlCDWithKeybindings.js +17 -0
  799. package/dist/src/hooks/useFileHistorySnapshotInit.js +14 -0
  800. package/dist/src/hooks/useGlobalKeybindings.js +215 -0
  801. package/dist/src/hooks/useHistorySearch.js +241 -0
  802. package/dist/src/hooks/useIDEIntegration.js +56 -0
  803. package/dist/src/hooks/useIdeAtMentioned.js +51 -0
  804. package/dist/src/hooks/useIdeConnectionStatus.js +21 -0
  805. package/dist/src/hooks/useIdeLogging.js +29 -0
  806. package/dist/src/hooks/useIdeSelection.js +106 -0
  807. package/dist/src/hooks/useInboxPoller.js +709 -0
  808. package/dist/src/hooks/useInputBuffer.js +73 -0
  809. package/dist/src/hooks/useIssueFlagBanner.js +115 -0
  810. package/dist/src/hooks/useLogMessages.js +98 -0
  811. package/dist/src/hooks/useLspPluginRecommendation.js +176 -0
  812. package/dist/src/hooks/useMailboxBridge.js +15 -0
  813. package/dist/src/hooks/useMainLoopModel.js +25 -0
  814. package/dist/src/hooks/useManagePlugins.js +261 -0
  815. package/dist/src/hooks/useMemoryUsage.js +28 -0
  816. package/dist/src/hooks/useMergedClients.js +11 -0
  817. package/dist/src/hooks/useMergedCommands.js +10 -0
  818. package/dist/src/hooks/useMergedTools.js +32 -0
  819. package/dist/src/hooks/useMinDisplayTime.js +26 -0
  820. package/dist/src/hooks/useNotifyAfterTimeout.js +51 -0
  821. package/dist/src/hooks/useOfficialMarketplaceNotification.js +46 -0
  822. package/dist/src/hooks/usePasteHandler.js +188 -0
  823. package/dist/src/hooks/usePluginRecommendationBase.js +101 -0
  824. package/dist/src/hooks/usePrStatus.js +91 -0
  825. package/dist/src/hooks/usePromptSuggestion.js +128 -0
  826. package/dist/src/hooks/usePromptsFromClaudeInChrome.js +66 -0
  827. package/dist/src/hooks/useQueueProcessor.js +46 -0
  828. package/dist/src/hooks/useRemoteSession.js +431 -0
  829. package/dist/src/hooks/useReplBridge.js +717 -0
  830. package/dist/src/hooks/useSSHSession.js +167 -0
  831. package/dist/src/hooks/useScheduledTasks.js +104 -0
  832. package/dist/src/hooks/useSearchInput.js +302 -0
  833. package/dist/src/hooks/useSessionBackgrounding.js +132 -0
  834. package/dist/src/hooks/useSettings.js +10 -0
  835. package/dist/src/hooks/useSettingsChange.js +13 -0
  836. package/dist/src/hooks/useSkillImprovementSurvey.js +69 -0
  837. package/dist/src/hooks/useSkillsChange.js +51 -0
  838. package/dist/src/hooks/useSwarmInitialization.js +67 -0
  839. package/dist/src/hooks/useSwarmPermissionPoller.js +215 -0
  840. package/dist/src/hooks/useTaskListWatcher.js +157 -0
  841. package/dist/src/hooks/useTasksV2.js +220 -0
  842. package/dist/src/hooks/useTeammateViewAutoExit.js +55 -0
  843. package/dist/src/hooks/useTelegramMirror.js +47 -0
  844. package/dist/src/hooks/useTeleportResume.js +81 -0
  845. package/dist/src/hooks/useTerminalSize.js +9 -0
  846. package/dist/src/hooks/useTextInput.js +397 -0
  847. package/dist/src/hooks/useTimeout.js +10 -0
  848. package/dist/src/hooks/useTurnDiffs.js +160 -0
  849. package/dist/src/hooks/useTypeahead.js +1617 -0
  850. package/dist/src/hooks/useUpdateNotification.js +22 -0
  851. package/dist/src/hooks/useVimInput.js +232 -0
  852. package/dist/src/hooks/useVirtualScroll.js +627 -0
  853. package/dist/src/hooks/useVoice.js +954 -0
  854. package/dist/src/hooks/useVoiceEnabled.js +21 -0
  855. package/dist/src/hooks/useVoiceIntegration.js +631 -0
  856. package/dist/src/hooks/useWhatsAppMirror.js +46 -0
  857. package/dist/src/index.js +18 -0
  858. package/dist/src/ink/Ansi.js +269 -0
  859. package/dist/src/ink/bidi.js +117 -0
  860. package/dist/src/ink/clearTerminal.js +58 -0
  861. package/dist/src/ink/colorize.js +198 -0
  862. package/dist/src/ink/components/AlternateScreen.js +74 -0
  863. package/dist/src/ink/components/App.js +558 -0
  864. package/dist/src/ink/components/AppContext.js +11 -0
  865. package/dist/src/ink/components/Box.js +153 -0
  866. package/dist/src/ink/components/Button.js +166 -0
  867. package/dist/src/ink/components/ClockContext.js +108 -0
  868. package/dist/src/ink/components/CursorDeclarationContext.js +3 -0
  869. package/dist/src/ink/components/ErrorOverview.js +49 -0
  870. package/dist/src/ink/components/Link.js +33 -0
  871. package/dist/src/ink/components/Newline.js +29 -0
  872. package/dist/src/ink/components/NoSelect.js +56 -0
  873. package/dist/src/ink/components/RawAnsi.js +45 -0
  874. package/dist/src/ink/components/ScrollBox.js +170 -0
  875. package/dist/src/ink/components/Spacer.js +19 -0
  876. package/dist/src/ink/components/StdinContext.js +16 -0
  877. package/dist/src/ink/components/TerminalFocusContext.js +45 -0
  878. package/dist/src/ink/components/TerminalSizeContext.js +3 -0
  879. package/dist/src/ink/components/Text.js +194 -0
  880. package/dist/src/ink/constants.js +2 -0
  881. package/dist/src/ink/devtools.js +16 -0
  882. package/dist/src/ink/dom.js +298 -0
  883. package/dist/src/ink/events/click-event.js +36 -0
  884. package/dist/src/ink/events/dispatcher.js +172 -0
  885. package/dist/src/ink/events/emitter.js +31 -0
  886. package/dist/src/ink/events/event-handlers.js +30 -0
  887. package/dist/src/ink/events/event.js +9 -0
  888. package/dist/src/ink/events/focus-event.js +16 -0
  889. package/dist/src/ink/events/input-event.js +161 -0
  890. package/dist/src/ink/events/keyboard-event.js +45 -0
  891. package/dist/src/ink/events/terminal-event.js +78 -0
  892. package/dist/src/ink/events/terminal-focus-event.js +15 -0
  893. package/dist/src/ink/focus.js +158 -0
  894. package/dist/src/ink/frame.js +30 -0
  895. package/dist/src/ink/get-max-width.js +23 -0
  896. package/dist/src/ink/hit-test.js +113 -0
  897. package/dist/src/ink/hooks/use-animation-frame.js +48 -0
  898. package/dist/src/ink/hooks/use-app.js +7 -0
  899. package/dist/src/ink/hooks/use-declared-cursor.js +60 -0
  900. package/dist/src/ink/hooks/use-input.js +70 -0
  901. package/dist/src/ink/hooks/use-interval.js +54 -0
  902. package/dist/src/ink/hooks/use-search-highlight.js +32 -0
  903. package/dist/src/ink/hooks/use-selection.js +60 -0
  904. package/dist/src/ink/hooks/use-stdin.js +7 -0
  905. package/dist/src/ink/hooks/use-tab-status.js +57 -0
  906. package/dist/src/ink/hooks/use-terminal-focus.js +15 -0
  907. package/dist/src/ink/hooks/use-terminal-title.js +29 -0
  908. package/dist/src/ink/hooks/use-terminal-viewport.js +77 -0
  909. package/dist/src/ink/ink.js +1644 -0
  910. package/dist/src/ink/instances.js +7 -0
  911. package/dist/src/ink/layout/engine.js +4 -0
  912. package/dist/src/ink/layout/geometry.js +61 -0
  913. package/dist/src/ink/layout/node.js +62 -0
  914. package/dist/src/ink/layout/yoga.js +237 -0
  915. package/dist/src/ink/line-width-cache.js +19 -0
  916. package/dist/src/ink/log-update.js +583 -0
  917. package/dist/src/ink/measure-element.js +8 -0
  918. package/dist/src/ink/measure-text.js +35 -0
  919. package/dist/src/ink/node-cache.js +30 -0
  920. package/dist/src/ink/optimizer.js +81 -0
  921. package/dist/src/ink/output.js +556 -0
  922. package/dist/src/ink/parse-keypress.js +695 -0
  923. package/dist/src/ink/reconciler.js +384 -0
  924. package/dist/src/ink/render-border.js +134 -0
  925. package/dist/src/ink/render-node-to-output.js +1216 -0
  926. package/dist/src/ink/render-to-screen.js +171 -0
  927. package/dist/src/ink/renderer.js +129 -0
  928. package/dist/src/ink/root.js +80 -0
  929. package/dist/src/ink/screen.js +1132 -0
  930. package/dist/src/ink/searchHighlight.js +78 -0
  931. package/dist/src/ink/selection.js +792 -0
  932. package/dist/src/ink/squash-text-nodes.js +56 -0
  933. package/dist/src/ink/stringWidth.js +200 -0
  934. package/dist/src/ink/styles.js +299 -0
  935. package/dist/src/ink/supports-hyperlinks.js +40 -0
  936. package/dist/src/ink/tabstops.js +39 -0
  937. package/dist/src/ink/terminal-focus-state.js +35 -0
  938. package/dist/src/ink/terminal-querier.js +173 -0
  939. package/dist/src/ink/terminal.js +208 -0
  940. package/dist/src/ink/termio/ansi.js +70 -0
  941. package/dist/src/ink/termio/csi.js +260 -0
  942. package/dist/src/ink/termio/dec.js +53 -0
  943. package/dist/src/ink/termio/esc.js +55 -0
  944. package/dist/src/ink/termio/osc.js +432 -0
  945. package/dist/src/ink/termio/parser.js +356 -0
  946. package/dist/src/ink/termio/sgr.js +292 -0
  947. package/dist/src/ink/termio/tokenize.js +264 -0
  948. package/dist/src/ink/termio/types.js +55 -0
  949. package/dist/src/ink/termio.js +24 -0
  950. package/dist/src/ink/useTerminalNotification.js +57 -0
  951. package/dist/src/ink/warn.js +10 -0
  952. package/dist/src/ink/widest-line.js +14 -0
  953. package/dist/src/ink/wrap-text.js +54 -0
  954. package/dist/src/ink/wrapAnsi.js +6 -0
  955. package/dist/src/ink.js +50 -0
  956. package/dist/src/interactiveHelpers.js +317 -0
  957. package/dist/src/keybindings/KeybindingContext.js +184 -0
  958. package/dist/src/keybindings/KeybindingProviderSetup.js +259 -0
  959. package/dist/src/keybindings/defaultBindings.js +333 -0
  960. package/dist/src/keybindings/loadUserBindings.js +393 -0
  961. package/dist/src/keybindings/match.js +111 -0
  962. package/dist/src/keybindings/parser.js +184 -0
  963. package/dist/src/keybindings/reservedShortcuts.js +109 -0
  964. package/dist/src/keybindings/resolver.js +182 -0
  965. package/dist/src/keybindings/schema.js +205 -0
  966. package/dist/src/keybindings/shortcutFormat.js +48 -0
  967. package/dist/src/keybindings/template.js +40 -0
  968. package/dist/src/keybindings/useKeybinding.js +161 -0
  969. package/dist/src/keybindings/useShortcutDisplay.js +43 -0
  970. package/dist/src/keybindings/validate.js +395 -0
  971. package/dist/src/main.js +4080 -0
  972. package/dist/src/memdir/findRelevantMemories.js +101 -0
  973. package/dist/src/memdir/memdir.js +408 -0
  974. package/dist/src/memdir/memoryAge.js +52 -0
  975. package/dist/src/memdir/memoryScan.js +65 -0
  976. package/dist/src/memdir/memoryTypes.js +260 -0
  977. package/dist/src/memdir/paths.js +236 -0
  978. package/dist/src/memdir/teamMemPaths.js +261 -0
  979. package/dist/src/memdir/teamMemPrompts.js +82 -0
  980. package/dist/src/migrations/migrateAutoUpdatesToSettings.js +47 -0
  981. package/dist/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +32 -0
  982. package/dist/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +83 -0
  983. package/dist/src/migrations/migrateFennecToOpus.js +39 -0
  984. package/dist/src/migrations/migrateLegacyOpusToCurrent.js +44 -0
  985. package/dist/src/migrations/migrateOpusToOpus1m.js +31 -0
  986. package/dist/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +23 -0
  987. package/dist/src/migrations/migrateSonnet1mToSonnet45.js +38 -0
  988. package/dist/src/migrations/migrateSonnet45ToSonnet46.js +48 -0
  989. package/dist/src/migrations/resetAutoModeOptInForDefaultOffer.js +47 -0
  990. package/dist/src/migrations/resetProToOpusDefault.js +46 -0
  991. package/dist/src/mirrors/shared.js +186 -0
  992. package/dist/src/moreright/useMoreRight.js +13 -0
  993. package/dist/src/native-ts/color-diff/index.js +821 -0
  994. package/dist/src/native-ts/file-index/index.js +328 -0
  995. package/dist/src/native-ts/yoga-layout/enums.js +101 -0
  996. package/dist/src/native-ts/yoga-layout/index.js +2113 -0
  997. package/dist/src/outputStyles/loadOutputStylesDir.js +73 -0
  998. package/dist/src/plugins/builtinPlugins.js +132 -0
  999. package/dist/src/plugins/bundled/index.js +22 -0
  1000. package/dist/src/projectOnboardingState.js +61 -0
  1001. package/dist/src/query/config.js +17 -0
  1002. package/dist/src/query/deps.js +12 -0
  1003. package/dist/src/query/stopHooks.js +334 -0
  1004. package/dist/src/query/tokenBudget.js +49 -0
  1005. package/dist/src/query.js +1330 -0
  1006. package/dist/src/recovery/bunBundleShim.js +11 -0
  1007. package/dist/src/remote/RemoteSessionManager.js +195 -0
  1008. package/dist/src/remote/SessionsWebSocket.js +305 -0
  1009. package/dist/src/remote/remotePermissionBridge.js +70 -0
  1010. package/dist/src/remote/sdkMessageAdapter.js +227 -0
  1011. package/dist/src/replLauncher.js +6 -0
  1012. package/dist/src/schemas/hooks.js +174 -0
  1013. package/dist/src/screens/Doctor.js +581 -0
  1014. package/dist/src/screens/REPL.js +4434 -0
  1015. package/dist/src/screens/ResumeConversation.js +341 -0
  1016. package/dist/src/self-hosted-runner/main.js +16 -0
  1017. package/dist/src/server/backends/dangerousBackend.js +16 -0
  1018. package/dist/src/server/connectHeadless.js +16 -0
  1019. package/dist/src/server/createDirectConnectSession.js +62 -0
  1020. package/dist/src/server/directConnectManager.js +153 -0
  1021. package/dist/src/server/lockfile.js +16 -0
  1022. package/dist/src/server/parseConnectUrl.js +16 -0
  1023. package/dist/src/server/server.js +16 -0
  1024. package/dist/src/server/serverBanner.js +16 -0
  1025. package/dist/src/server/serverLog.js +16 -0
  1026. package/dist/src/server/sessionManager.js +16 -0
  1027. package/dist/src/server/types.js +7 -0
  1028. package/dist/src/services/AgentSummary/agentSummary.js +147 -0
  1029. package/dist/src/services/MagicDocs/magicDocs.js +193 -0
  1030. package/dist/src/services/MagicDocs/prompts.js +110 -0
  1031. package/dist/src/services/PromptSuggestion/promptSuggestion.js +402 -0
  1032. package/dist/src/services/PromptSuggestion/speculation.js +643 -0
  1033. package/dist/src/services/SessionMemory/prompts.js +254 -0
  1034. package/dist/src/services/SessionMemory/sessionMemory.js +358 -0
  1035. package/dist/src/services/SessionMemory/sessionMemoryUtils.js +157 -0
  1036. package/dist/src/services/analytics/config.js +33 -0
  1037. package/dist/src/services/analytics/datadog.js +259 -0
  1038. package/dist/src/services/analytics/firstPartyEventLogger.js +342 -0
  1039. package/dist/src/services/analytics/firstPartyEventLoggingExporter.js +594 -0
  1040. package/dist/src/services/analytics/growthbook.js +952 -0
  1041. package/dist/src/services/analytics/index.js +114 -0
  1042. package/dist/src/services/analytics/metadata.js +698 -0
  1043. package/dist/src/services/analytics/sink.js +95 -0
  1044. package/dist/src/services/analytics/sinkKillswitch.js +19 -0
  1045. package/dist/src/services/api/adminRequests.js +57 -0
  1046. package/dist/src/services/api/bootstrap.js +149 -0
  1047. package/dist/src/services/api/claude.js +2461 -0
  1048. package/dist/src/services/api/client.js +325 -0
  1049. package/dist/src/services/api/dumpPrompts.js +174 -0
  1050. package/dist/src/services/api/emptyUsage.js +20 -0
  1051. package/dist/src/services/api/errorUtils.js +203 -0
  1052. package/dist/src/services/api/errors.js +934 -0
  1053. package/dist/src/services/api/filesApi.js +523 -0
  1054. package/dist/src/services/api/firstTokenDate.js +49 -0
  1055. package/dist/src/services/api/grove.js +272 -0
  1056. package/dist/src/services/api/index.js +23 -0
  1057. package/dist/src/services/api/logging.js +484 -0
  1058. package/dist/src/services/api/metricsOptOut.js +129 -0
  1059. package/dist/src/services/api/openai.js +1187 -0
  1060. package/dist/src/services/api/openrouter.js +30 -0
  1061. package/dist/src/services/api/overageCreditGrant.js +123 -0
  1062. package/dist/src/services/api/promptCacheBreakDetection.js +510 -0
  1063. package/dist/src/services/api/referral.js +219 -0
  1064. package/dist/src/services/api/sessionIngress.js +358 -0
  1065. package/dist/src/services/api/ultrareviewQuota.js +29 -0
  1066. package/dist/src/services/api/usage.js +31 -0
  1067. package/dist/src/services/api/withRetry.js +599 -0
  1068. package/dist/src/services/autoDream/autoDream.js +244 -0
  1069. package/dist/src/services/autoDream/config.js +17 -0
  1070. package/dist/src/services/autoDream/consolidationLock.js +122 -0
  1071. package/dist/src/services/autoDream/consolidationPrompt.js +56 -0
  1072. package/dist/src/services/awaySummary.js +61 -0
  1073. package/dist/src/services/claudeAiLimits.js +331 -0
  1074. package/dist/src/services/claudeAiLimitsHook.js +15 -0
  1075. package/dist/src/services/compact/apiMicrocompact.js +97 -0
  1076. package/dist/src/services/compact/autoCompact.js +236 -0
  1077. package/dist/src/services/compact/cachedMicrocompact.js +16 -0
  1078. package/dist/src/services/compact/compact.js +1258 -0
  1079. package/dist/src/services/compact/compactWarningHook.js +12 -0
  1080. package/dist/src/services/compact/compactWarningState.js +15 -0
  1081. package/dist/src/services/compact/grouping.js +58 -0
  1082. package/dist/src/services/compact/microCompact.js +414 -0
  1083. package/dist/src/services/compact/postCompactCleanup.js +72 -0
  1084. package/dist/src/services/compact/prompt.js +327 -0
  1085. package/dist/src/services/compact/sessionMemoryCompact.js +467 -0
  1086. package/dist/src/services/compact/timeBasedMCConfig.js +11 -0
  1087. package/dist/src/services/diagnosticTracking.js +282 -0
  1088. package/dist/src/services/extractMemories/extractMemories.js +444 -0
  1089. package/dist/src/services/extractMemories/prompts.js +129 -0
  1090. package/dist/src/services/internalLogging.js +68 -0
  1091. package/dist/src/services/limits/adapters/claude.js +219 -0
  1092. package/dist/src/services/limits/adapters/minimax.js +177 -0
  1093. package/dist/src/services/limits/adapters/ollama.js +189 -0
  1094. package/dist/src/services/limits/adapters/openai.js +167 -0
  1095. package/dist/src/services/limits/adapters/openrouter.js +166 -0
  1096. package/dist/src/services/limits/adapters/zai.js +154 -0
  1097. package/dist/src/services/limits/index.js +2 -0
  1098. package/dist/src/services/limits/registry.js +179 -0
  1099. package/dist/src/services/limits/sessionCounter.js +168 -0
  1100. package/dist/src/services/limits/types.js +1 -0
  1101. package/dist/src/services/lsp/LSPClient.js +306 -0
  1102. package/dist/src/services/lsp/LSPDiagnosticRegistry.js +277 -0
  1103. package/dist/src/services/lsp/LSPServerInstance.js +390 -0
  1104. package/dist/src/services/lsp/LSPServerManager.js +305 -0
  1105. package/dist/src/services/lsp/config.js +57 -0
  1106. package/dist/src/services/lsp/manager.js +246 -0
  1107. package/dist/src/services/lsp/passiveFeedback.js +226 -0
  1108. package/dist/src/services/mcp/InProcessTransport.js +54 -0
  1109. package/dist/src/services/mcp/MCPConnectionManager.js +50 -0
  1110. package/dist/src/services/mcp/SdkControlTransport.js +115 -0
  1111. package/dist/src/services/mcp/auth.js +1882 -0
  1112. package/dist/src/services/mcp/channelAllowlist.js +57 -0
  1113. package/dist/src/services/mcp/channelNotification.js +236 -0
  1114. package/dist/src/services/mcp/channelPermissions.js +192 -0
  1115. package/dist/src/services/mcp/claudeai.js +123 -0
  1116. package/dist/src/services/mcp/client.js +2480 -0
  1117. package/dist/src/services/mcp/config.js +1277 -0
  1118. package/dist/src/services/mcp/elicitationHandler.js +192 -0
  1119. package/dist/src/services/mcp/envExpansion.js +30 -0
  1120. package/dist/src/services/mcp/headersHelper.js +94 -0
  1121. package/dist/src/services/mcp/mcpStringUtils.js +85 -0
  1122. package/dist/src/services/mcp/normalization.js +21 -0
  1123. package/dist/src/services/mcp/oauthPort.js +69 -0
  1124. package/dist/src/services/mcp/officialRegistry.js +58 -0
  1125. package/dist/src/services/mcp/types.js +94 -0
  1126. package/dist/src/services/mcp/useManageMCPConnections.js +820 -0
  1127. package/dist/src/services/mcp/utils.js +433 -0
  1128. package/dist/src/services/mcp/vscodeSdkMcp.js +69 -0
  1129. package/dist/src/services/mcp/xaa.js +342 -0
  1130. package/dist/src/services/mcp/xaaIdpLogin.js +377 -0
  1131. package/dist/src/services/mcpServerApproval.js +29 -0
  1132. package/dist/src/services/mockRateLimits.js +666 -0
  1133. package/dist/src/services/notifier.js +114 -0
  1134. package/dist/src/services/oauth/auth-code-listener.js +236 -0
  1135. package/dist/src/services/oauth/client.js +545 -0
  1136. package/dist/src/services/oauth/crypto.js +19 -0
  1137. package/dist/src/services/oauth/getOauthProfile.js +48 -0
  1138. package/dist/src/services/oauth/index.js +152 -0
  1139. package/dist/src/services/oauth/types.js +1 -0
  1140. package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +315 -0
  1141. package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +1147 -0
  1142. package/dist/src/services/orchestration/execution/index.js +2 -0
  1143. package/dist/src/services/orchestration/execution/types.js +1 -0
  1144. package/dist/src/services/orchestration/global/GlobalOrchestratorRuntime.js +140 -0
  1145. package/dist/src/services/orchestration/global/index.js +3 -0
  1146. package/dist/src/services/orchestration/global/reporting.js +541 -0
  1147. package/dist/src/services/orchestration/global/types.js +1 -0
  1148. package/dist/src/services/orchestration/index.js +4 -0
  1149. package/dist/src/services/orchestration/policy/index.js +2 -0
  1150. package/dist/src/services/orchestration/policy/scoring.js +291 -0
  1151. package/dist/src/services/orchestration/policy/types.js +1 -0
  1152. package/dist/src/services/orchestration/squad/SquadOrchestratorRuntime.js +198 -0
  1153. package/dist/src/services/orchestration/squad/index.js +3 -0
  1154. package/dist/src/services/orchestration/squad/reporting.js +525 -0
  1155. package/dist/src/services/orchestration/squad/types.js +1 -0
  1156. package/dist/src/services/plugins/PluginInstallationManager.js +139 -0
  1157. package/dist/src/services/plugins/pluginCliCommands.js +230 -0
  1158. package/dist/src/services/plugins/pluginOperations.js +826 -0
  1159. package/dist/src/services/policyLimits/index.js +547 -0
  1160. package/dist/src/services/policyLimits/types.js +9 -0
  1161. package/dist/src/services/preventSleep.js +143 -0
  1162. package/dist/src/services/rateLimitMessages.js +271 -0
  1163. package/dist/src/services/rateLimitMocking.js +91 -0
  1164. package/dist/src/services/remoteManagedSettings/index.js +534 -0
  1165. package/dist/src/services/remoteManagedSettings/securityCheck.js +59 -0
  1166. package/dist/src/services/remoteManagedSettings/syncCache.js +90 -0
  1167. package/dist/src/services/remoteManagedSettings/syncCacheState.js +89 -0
  1168. package/dist/src/services/remoteManagedSettings/types.js +12 -0
  1169. package/dist/src/services/settingsSync/index.js +478 -0
  1170. package/dist/src/services/settingsSync/types.js +35 -0
  1171. package/dist/src/services/teamMemorySync/index.js +976 -0
  1172. package/dist/src/services/teamMemorySync/secretScanner.js +275 -0
  1173. package/dist/src/services/teamMemorySync/teamMemSecretGuard.js +35 -0
  1174. package/dist/src/services/teamMemorySync/types.js +47 -0
  1175. package/dist/src/services/teamMemorySync/watcher.js +326 -0
  1176. package/dist/src/services/tips/tipHistory.js +17 -0
  1177. package/dist/src/services/tips/tipRegistry.js +589 -0
  1178. package/dist/src/services/tips/tipScheduler.js +40 -0
  1179. package/dist/src/services/tokenEstimation.js +365 -0
  1180. package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +87 -0
  1181. package/dist/src/services/tools/StreamingToolExecutor.js +413 -0
  1182. package/dist/src/services/tools/toolExecution.js +1218 -0
  1183. package/dist/src/services/tools/toolHooks.js +454 -0
  1184. package/dist/src/services/tools/toolOrchestration.js +110 -0
  1185. package/dist/src/services/vcr.js +291 -0
  1186. package/dist/src/services/voice.js +394 -0
  1187. package/dist/src/services/voiceKeyterms.js +94 -0
  1188. package/dist/src/services/voiceStreamSTT.js +406 -0
  1189. package/dist/src/setup.js +349 -0
  1190. package/dist/src/skills/bundled/batch.js +114 -0
  1191. package/dist/src/skills/bundled/claudeApi.js +145 -0
  1192. package/dist/src/skills/bundled/claudeApiContent.js +14 -0
  1193. package/dist/src/skills/bundled/claudeInChrome.js +27 -0
  1194. package/dist/src/skills/bundled/debug.js +99 -0
  1195. package/dist/src/skills/bundled/index.js +5 -0
  1196. package/dist/src/skills/bundled/keybindings.js +292 -0
  1197. package/dist/src/skills/bundled/loop.js +81 -0
  1198. package/dist/src/skills/bundled/loremIpsum.js +266 -0
  1199. package/dist/src/skills/bundled/remember.js +75 -0
  1200. package/dist/src/skills/bundled/scheduleRemoteAgents.js +373 -0
  1201. package/dist/src/skills/bundled/simplify.js +66 -0
  1202. package/dist/src/skills/bundled/skillify.js +184 -0
  1203. package/dist/src/skills/bundled/stuck.js +75 -0
  1204. package/dist/src/skills/bundled/updateConfig.js +463 -0
  1205. package/dist/src/skills/bundled/verify.js +25 -0
  1206. package/dist/src/skills/bundled/verifyContent.js +7 -0
  1207. package/dist/src/skills/bundledSkills.js +159 -0
  1208. package/dist/src/skills/loadSkillsDir.js +751 -0
  1209. package/dist/src/skills/mcpSkillBuilders.js +10 -0
  1210. package/dist/src/ssh/createSSHSession.js +16 -0
  1211. package/dist/src/state/AppState.js +184 -0
  1212. package/dist/src/state/AppStateStore.js +120 -0
  1213. package/dist/src/state/onChangeAppState.js +132 -0
  1214. package/dist/src/state/selectors.js +51 -0
  1215. package/dist/src/state/store.js +21 -0
  1216. package/dist/src/state/teammateViewHelpers.js +124 -0
  1217. package/dist/src/tasks/DreamTask/DreamTask.js +99 -0
  1218. package/dist/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +116 -0
  1219. package/dist/src/tasks/InProcessTeammateTask/types.js +35 -0
  1220. package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +507 -0
  1221. package/dist/src/tasks/LocalMainSessionTask.js +338 -0
  1222. package/dist/src/tasks/LocalShellTask/LocalShellTask.js +475 -0
  1223. package/dist/src/tasks/LocalShellTask/guards.js +9 -0
  1224. package/dist/src/tasks/LocalShellTask/killShellTasks.js +59 -0
  1225. package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +742 -0
  1226. package/dist/src/tasks/pillLabel.js +69 -0
  1227. package/dist/src/tasks/stopTask.js +67 -0
  1228. package/dist/src/tasks/types.js +18 -0
  1229. package/dist/src/tasks.js +39 -0
  1230. package/dist/src/telegram/bridge.js +329 -0
  1231. package/dist/src/telegram/config.js +89 -0
  1232. package/dist/src/telegram/mirror.js +91 -0
  1233. package/dist/src/tools/AgentTool/AgentTool.js +1222 -0
  1234. package/dist/src/tools/AgentTool/UI.js +592 -0
  1235. package/dist/src/tools/AgentTool/agentColorManager.js +43 -0
  1236. package/dist/src/tools/AgentTool/agentDisplay.js +72 -0
  1237. package/dist/src/tools/AgentTool/agentMemory.js +139 -0
  1238. package/dist/src/tools/AgentTool/agentMemorySnapshot.js +136 -0
  1239. package/dist/src/tools/AgentTool/agentToolUtils.js +456 -0
  1240. package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +175 -0
  1241. package/dist/src/tools/AgentTool/built-in/exploreAgent.js +76 -0
  1242. package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +28 -0
  1243. package/dist/src/tools/AgentTool/built-in/planAgent.js +87 -0
  1244. package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +140 -0
  1245. package/dist/src/tools/AgentTool/built-in/verificationAgent.js +146 -0
  1246. package/dist/src/tools/AgentTool/builtInAgents.js +59 -0
  1247. package/dist/src/tools/AgentTool/constants.js +11 -0
  1248. package/dist/src/tools/AgentTool/forkSubagent.js +177 -0
  1249. package/dist/src/tools/AgentTool/loadAgentsDir.js +497 -0
  1250. package/dist/src/tools/AgentTool/prompt.js +262 -0
  1251. package/dist/src/tools/AgentTool/resumeAgent.js +182 -0
  1252. package/dist/src/tools/AgentTool/runAgent.js +629 -0
  1253. package/dist/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +237 -0
  1254. package/dist/src/tools/AskUserQuestionTool/prompt.js +38 -0
  1255. package/dist/src/tools/BashTool/BashTool.js +1008 -0
  1256. package/dist/src/tools/BashTool/BashToolResultMessage.js +168 -0
  1257. package/dist/src/tools/BashTool/UI.js +133 -0
  1258. package/dist/src/tools/BashTool/bashCommandHelpers.js +184 -0
  1259. package/dist/src/tools/BashTool/bashPermissions.js +2023 -0
  1260. package/dist/src/tools/BashTool/bashSecurity.js +2267 -0
  1261. package/dist/src/tools/BashTool/commandSemantics.js +105 -0
  1262. package/dist/src/tools/BashTool/commentLabel.js +14 -0
  1263. package/dist/src/tools/BashTool/destructiveCommandWarning.js +88 -0
  1264. package/dist/src/tools/BashTool/modeValidation.js +86 -0
  1265. package/dist/src/tools/BashTool/pathValidation.js +1080 -0
  1266. package/dist/src/tools/BashTool/prompt.js +334 -0
  1267. package/dist/src/tools/BashTool/readOnlyValidation.js +1794 -0
  1268. package/dist/src/tools/BashTool/sedEditParser.js +282 -0
  1269. package/dist/src/tools/BashTool/sedValidation.js +580 -0
  1270. package/dist/src/tools/BashTool/shouldUseSandbox.js +125 -0
  1271. package/dist/src/tools/BashTool/toolName.js +2 -0
  1272. package/dist/src/tools/BashTool/utils.js +180 -0
  1273. package/dist/src/tools/BriefTool/BriefTool.js +172 -0
  1274. package/dist/src/tools/BriefTool/UI.js +66 -0
  1275. package/dist/src/tools/BriefTool/attachments.js +86 -0
  1276. package/dist/src/tools/BriefTool/prompt.js +19 -0
  1277. package/dist/src/tools/BriefTool/upload.js +136 -0
  1278. package/dist/src/tools/ConfigTool/ConfigTool.js +398 -0
  1279. package/dist/src/tools/ConfigTool/UI.js +24 -0
  1280. package/dist/src/tools/ConfigTool/constants.js +1 -0
  1281. package/dist/src/tools/ConfigTool/prompt.js +82 -0
  1282. package/dist/src/tools/ConfigTool/supportedSettings.js +180 -0
  1283. package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +98 -0
  1284. package/dist/src/tools/EnterPlanModeTool/UI.js +13 -0
  1285. package/dist/src/tools/EnterPlanModeTool/constants.js +1 -0
  1286. package/dist/src/tools/EnterPlanModeTool/prompt.js +164 -0
  1287. package/dist/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +104 -0
  1288. package/dist/src/tools/EnterWorktreeTool/UI.js +8 -0
  1289. package/dist/src/tools/EnterWorktreeTool/constants.js +1 -0
  1290. package/dist/src/tools/EnterWorktreeTool/prompt.js +30 -0
  1291. package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +385 -0
  1292. package/dist/src/tools/ExitPlanModeTool/UI.js +31 -0
  1293. package/dist/src/tools/ExitPlanModeTool/constants.js +2 -0
  1294. package/dist/src/tools/ExitPlanModeTool/prompt.js +27 -0
  1295. package/dist/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +257 -0
  1296. package/dist/src/tools/ExitWorktreeTool/UI.js +9 -0
  1297. package/dist/src/tools/ExitWorktreeTool/constants.js +1 -0
  1298. package/dist/src/tools/ExitWorktreeTool/prompt.js +32 -0
  1299. package/dist/src/tools/FileEditTool/FileEditTool.js +480 -0
  1300. package/dist/src/tools/FileEditTool/UI.js +201 -0
  1301. package/dist/src/tools/FileEditTool/constants.js +7 -0
  1302. package/dist/src/tools/FileEditTool/prompt.js +24 -0
  1303. package/dist/src/tools/FileEditTool/types.js +50 -0
  1304. package/dist/src/tools/FileEditTool/utils.js +579 -0
  1305. package/dist/src/tools/FileReadTool/FileReadTool.js +889 -0
  1306. package/dist/src/tools/FileReadTool/UI.js +125 -0
  1307. package/dist/src/tools/FileReadTool/imageProcessor.js +46 -0
  1308. package/dist/src/tools/FileReadTool/limits.js +70 -0
  1309. package/dist/src/tools/FileReadTool/prompt.js +31 -0
  1310. package/dist/src/tools/FileWriteTool/FileWriteTool.js +341 -0
  1311. package/dist/src/tools/FileWriteTool/UI.js +338 -0
  1312. package/dist/src/tools/FileWriteTool/prompt.js +15 -0
  1313. package/dist/src/tools/GlobTool/GlobTool.js +161 -0
  1314. package/dist/src/tools/GlobTool/UI.js +39 -0
  1315. package/dist/src/tools/GlobTool/prompt.js +6 -0
  1316. package/dist/src/tools/GrepTool/GrepTool.js +439 -0
  1317. package/dist/src/tools/GrepTool/UI.js +154 -0
  1318. package/dist/src/tools/GrepTool/prompt.js +16 -0
  1319. package/dist/src/tools/LSPTool/LSPTool.js +660 -0
  1320. package/dist/src/tools/LSPTool/UI.js +204 -0
  1321. package/dist/src/tools/LSPTool/formatters.js +445 -0
  1322. package/dist/src/tools/LSPTool/prompt.js +20 -0
  1323. package/dist/src/tools/LSPTool/schemas.js +197 -0
  1324. package/dist/src/tools/LSPTool/symbolContext.js +75 -0
  1325. package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +100 -0
  1326. package/dist/src/tools/ListMcpResourcesTool/UI.js +16 -0
  1327. package/dist/src/tools/ListMcpResourcesTool/prompt.js +18 -0
  1328. package/dist/src/tools/MCPTool/MCPTool.js +60 -0
  1329. package/dist/src/tools/MCPTool/UI.js +342 -0
  1330. package/dist/src/tools/MCPTool/classifyForCollapse.js +597 -0
  1331. package/dist/src/tools/MCPTool/prompt.js +3 -0
  1332. package/dist/src/tools/McpAuthTool/McpAuthTool.js +162 -0
  1333. package/dist/src/tools/NotebookEditTool/NotebookEditTool.js +421 -0
  1334. package/dist/src/tools/NotebookEditTool/UI.js +40 -0
  1335. package/dist/src/tools/NotebookEditTool/constants.js +2 -0
  1336. package/dist/src/tools/NotebookEditTool/prompt.js +2 -0
  1337. package/dist/src/tools/PowerShellTool/PowerShellTool.js +899 -0
  1338. package/dist/src/tools/PowerShellTool/UI.js +57 -0
  1339. package/dist/src/tools/PowerShellTool/clmTypes.js +207 -0
  1340. package/dist/src/tools/PowerShellTool/commandSemantics.js +115 -0
  1341. package/dist/src/tools/PowerShellTool/commonParameters.js +27 -0
  1342. package/dist/src/tools/PowerShellTool/destructiveCommandWarning.js +92 -0
  1343. package/dist/src/tools/PowerShellTool/gitSafety.js +185 -0
  1344. package/dist/src/tools/PowerShellTool/modeValidation.js +357 -0
  1345. package/dist/src/tools/PowerShellTool/pathValidation.js +1712 -0
  1346. package/dist/src/tools/PowerShellTool/powershellPermissions.js +1351 -0
  1347. package/dist/src/tools/PowerShellTool/powershellSecurity.js +942 -0
  1348. package/dist/src/tools/PowerShellTool/prompt.js +134 -0
  1349. package/dist/src/tools/PowerShellTool/readOnlyValidation.js +1633 -0
  1350. package/dist/src/tools/PowerShellTool/toolName.js +2 -0
  1351. package/dist/src/tools/REPLTool/constants.js +43 -0
  1352. package/dist/src/tools/REPLTool/primitiveTools.js +36 -0
  1353. package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +112 -0
  1354. package/dist/src/tools/ReadMcpResourceTool/UI.js +23 -0
  1355. package/dist/src/tools/ReadMcpResourceTool/prompt.js +15 -0
  1356. package/dist/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +142 -0
  1357. package/dist/src/tools/RemoteTriggerTool/UI.js +11 -0
  1358. package/dist/src/tools/RemoteTriggerTool/prompt.js +12 -0
  1359. package/dist/src/tools/ScheduleCronTool/CronCreateTool.js +120 -0
  1360. package/dist/src/tools/ScheduleCronTool/CronDeleteTool.js +74 -0
  1361. package/dist/src/tools/ScheduleCronTool/CronListTool.js +77 -0
  1362. package/dist/src/tools/ScheduleCronTool/UI.js +28 -0
  1363. package/dist/src/tools/ScheduleCronTool/prompt.js +115 -0
  1364. package/dist/src/tools/SendMessageTool/SendMessageTool.js +675 -0
  1365. package/dist/src/tools/SendMessageTool/UI.js +23 -0
  1366. package/dist/src/tools/SendMessageTool/constants.js +1 -0
  1367. package/dist/src/tools/SendMessageTool/prompt.js +47 -0
  1368. package/dist/src/tools/SkillTool/SkillTool.js +827 -0
  1369. package/dist/src/tools/SkillTool/UI.js +60 -0
  1370. package/dist/src/tools/SkillTool/constants.js +1 -0
  1371. package/dist/src/tools/SkillTool/prompt.js +184 -0
  1372. package/dist/src/tools/SleepTool/prompt.js +14 -0
  1373. package/dist/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +138 -0
  1374. package/dist/src/tools/TaskCreateTool/TaskCreateTool.js +104 -0
  1375. package/dist/src/tools/TaskCreateTool/constants.js +1 -0
  1376. package/dist/src/tools/TaskCreateTool/prompt.js +52 -0
  1377. package/dist/src/tools/TaskGetTool/TaskGetTool.js +106 -0
  1378. package/dist/src/tools/TaskGetTool/constants.js +1 -0
  1379. package/dist/src/tools/TaskGetTool/prompt.js +23 -0
  1380. package/dist/src/tools/TaskListTool/TaskListTool.js +89 -0
  1381. package/dist/src/tools/TaskListTool/constants.js +1 -0
  1382. package/dist/src/tools/TaskListTool/prompt.js +44 -0
  1383. package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +535 -0
  1384. package/dist/src/tools/TaskOutputTool/constants.js +1 -0
  1385. package/dist/src/tools/TaskStopTool/TaskStopTool.js +110 -0
  1386. package/dist/src/tools/TaskStopTool/UI.js +30 -0
  1387. package/dist/src/tools/TaskStopTool/prompt.js +7 -0
  1388. package/dist/src/tools/TaskUpdateTool/TaskUpdateTool.js +301 -0
  1389. package/dist/src/tools/TaskUpdateTool/constants.js +1 -0
  1390. package/dist/src/tools/TaskUpdateTool/prompt.js +76 -0
  1391. package/dist/src/tools/TeamCreateTool/TeamCreateTool.js +177 -0
  1392. package/dist/src/tools/TeamCreateTool/UI.js +4 -0
  1393. package/dist/src/tools/TeamCreateTool/constants.js +1 -0
  1394. package/dist/src/tools/TeamCreateTool/prompt.js +113 -0
  1395. package/dist/src/tools/TeamDeleteTool/TeamDeleteTool.js +102 -0
  1396. package/dist/src/tools/TeamDeleteTool/UI.js +13 -0
  1397. package/dist/src/tools/TeamDeleteTool/constants.js +1 -0
  1398. package/dist/src/tools/TeamDeleteTool/prompt.js +16 -0
  1399. package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +99 -0
  1400. package/dist/src/tools/TodoWriteTool/constants.js +1 -0
  1401. package/dist/src/tools/TodoWriteTool/prompt.js +181 -0
  1402. package/dist/src/tools/ToolSearchTool/ToolSearchTool.js +357 -0
  1403. package/dist/src/tools/ToolSearchTool/constants.js +1 -0
  1404. package/dist/src/tools/ToolSearchTool/prompt.js +99 -0
  1405. package/dist/src/tools/TungstenTool/TungstenLiveMonitor.js +7 -0
  1406. package/dist/src/tools/TungstenTool/TungstenTool.js +3 -0
  1407. package/dist/src/tools/WebFetchTool/UI.js +30 -0
  1408. package/dist/src/tools/WebFetchTool/WebFetchTool.js +246 -0
  1409. package/dist/src/tools/WebFetchTool/preapproved.js +155 -0
  1410. package/dist/src/tools/WebFetchTool/prompt.js +39 -0
  1411. package/dist/src/tools/WebFetchTool/utils.js +381 -0
  1412. package/dist/src/tools/WebSearchTool/UI.js +66 -0
  1413. package/dist/src/tools/WebSearchTool/WebSearchTool.js +352 -0
  1414. package/dist/src/tools/WebSearchTool/prompt.js +32 -0
  1415. package/dist/src/tools/WorkflowTool/constants.js +2 -0
  1416. package/dist/src/tools/shared/gitOperationTracking.js +220 -0
  1417. package/dist/src/tools/shared/spawnMultiAgent.js +805 -0
  1418. package/dist/src/tools/testing/TestingPermissionTool.js +72 -0
  1419. package/dist/src/tools/utils.js +24 -0
  1420. package/dist/src/tools.js +332 -0
  1421. package/dist/src/types/command.js +10 -0
  1422. package/dist/src/types/connectorText.js +2 -0
  1423. package/dist/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +673 -0
  1424. package/dist/src/types/generated/events_mono/common/v1/auth.js +49 -0
  1425. package/dist/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +147 -0
  1426. package/dist/src/types/generated/google/protobuf/timestamp.js +38 -0
  1427. package/dist/src/types/hooks.js +153 -0
  1428. package/dist/src/types/ids.js +27 -0
  1429. package/dist/src/types/logs.js +11 -0
  1430. package/dist/src/types/message.js +1 -0
  1431. package/dist/src/types/permissions.js +25 -0
  1432. package/dist/src/types/plugin.js +72 -0
  1433. package/dist/src/types/textInputTypes.js +20 -0
  1434. package/dist/src/types/utils.js +5 -0
  1435. package/dist/src/upstreamproxy/relay.js +346 -0
  1436. package/dist/src/upstreamproxy/upstreamproxy.js +236 -0
  1437. package/dist/src/utils/CircularBuffer.js +75 -0
  1438. package/dist/src/utils/Cursor.js +1229 -0
  1439. package/dist/src/utils/QueryGuard.js +115 -0
  1440. package/dist/src/utils/Shell.js +374 -0
  1441. package/dist/src/utils/ShellCommand.js +338 -0
  1442. package/dist/src/utils/abortController.js +74 -0
  1443. package/dist/src/utils/activityManager.js +127 -0
  1444. package/dist/src/utils/advisor.js +77 -0
  1445. package/dist/src/utils/agentContext.js +91 -0
  1446. package/dist/src/utils/agentId.js +83 -0
  1447. package/dist/src/utils/agentSwarmsEnabled.js +37 -0
  1448. package/dist/src/utils/agenticSessionSearch.js +255 -0
  1449. package/dist/src/utils/analyzeContext.js +848 -0
  1450. package/dist/src/utils/ansiToPng.js +259 -0
  1451. package/dist/src/utils/ansiToSvg.js +207 -0
  1452. package/dist/src/utils/api.js +555 -0
  1453. package/dist/src/utils/apiPreconnect.js +62 -0
  1454. package/dist/src/utils/appleTerminalBackup.js +95 -0
  1455. package/dist/src/utils/argumentSubstitution.js +114 -0
  1456. package/dist/src/utils/array.js +12 -0
  1457. package/dist/src/utils/asciicast.js +200 -0
  1458. package/dist/src/utils/attachments.js +2514 -0
  1459. package/dist/src/utils/attribution.js +308 -0
  1460. package/dist/src/utils/attributionHooks.js +16 -0
  1461. package/dist/src/utils/attributionTrailer.js +16 -0
  1462. package/dist/src/utils/auth.js +2022 -0
  1463. package/dist/src/utils/authFileDescriptor.js +152 -0
  1464. package/dist/src/utils/authPortable.js +14 -0
  1465. package/dist/src/utils/autoModeDenials.js +15 -0
  1466. package/dist/src/utils/autoRunIssue.js +112 -0
  1467. package/dist/src/utils/autoUpdater.js +461 -0
  1468. package/dist/src/utils/aws.js +44 -0
  1469. package/dist/src/utils/awsAuthStatusManager.js +66 -0
  1470. package/dist/src/utils/background/remote/preconditions.js +175 -0
  1471. package/dist/src/utils/background/remote/remoteSession.js +53 -0
  1472. package/dist/src/utils/backgroundHousekeeping.js +66 -0
  1473. package/dist/src/utils/bash/ParsedCommand.js +241 -0
  1474. package/dist/src/utils/bash/ShellSnapshot.js +489 -0
  1475. package/dist/src/utils/bash/ast.js +2590 -0
  1476. package/dist/src/utils/bash/bashParser.js +4355 -0
  1477. package/dist/src/utils/bash/bashPipeCommand.js +249 -0
  1478. package/dist/src/utils/bash/commands.js +1131 -0
  1479. package/dist/src/utils/bash/heredoc.js +647 -0
  1480. package/dist/src/utils/bash/parser.js +195 -0
  1481. package/dist/src/utils/bash/prefix.js +154 -0
  1482. package/dist/src/utils/bash/registry.js +23 -0
  1483. package/dist/src/utils/bash/shellCompletion.js +196 -0
  1484. package/dist/src/utils/bash/shellPrefix.js +25 -0
  1485. package/dist/src/utils/bash/shellQuote.js +253 -0
  1486. package/dist/src/utils/bash/shellQuoting.js +106 -0
  1487. package/dist/src/utils/bash/specs/alias.js +11 -0
  1488. package/dist/src/utils/bash/specs/index.js +16 -0
  1489. package/dist/src/utils/bash/specs/nohup.js +10 -0
  1490. package/dist/src/utils/bash/specs/pyright.js +88 -0
  1491. package/dist/src/utils/bash/specs/sleep.js +10 -0
  1492. package/dist/src/utils/bash/specs/srun.js +28 -0
  1493. package/dist/src/utils/bash/specs/time.js +10 -0
  1494. package/dist/src/utils/bash/specs/timeout.js +17 -0
  1495. package/dist/src/utils/bash/treeSitterAnalysis.js +407 -0
  1496. package/dist/src/utils/betas.js +332 -0
  1497. package/dist/src/utils/billing.js +54 -0
  1498. package/dist/src/utils/binaryCheck.js +40 -0
  1499. package/dist/src/utils/browser.js +58 -0
  1500. package/dist/src/utils/bufferedWriter.js +77 -0
  1501. package/dist/src/utils/bundledMode.js +19 -0
  1502. package/dist/src/utils/caCerts.js +93 -0
  1503. package/dist/src/utils/caCertsConfig.js +77 -0
  1504. package/dist/src/utils/cachePaths.js +28 -0
  1505. package/dist/src/utils/ccshareResume.js +16 -0
  1506. package/dist/src/utils/classifierApprovals.js +66 -0
  1507. package/dist/src/utils/classifierApprovalsHook.js +10 -0
  1508. package/dist/src/utils/claudeCodeHints.js +142 -0
  1509. package/dist/src/utils/claudeDesktop.js +108 -0
  1510. package/dist/src/utils/claudeInChrome/chromeNativeHost.js +416 -0
  1511. package/dist/src/utils/claudeInChrome/common.js +466 -0
  1512. package/dist/src/utils/claudeInChrome/mcpServer.js +237 -0
  1513. package/dist/src/utils/claudeInChrome/prompt.js +79 -0
  1514. package/dist/src/utils/claudeInChrome/setup.js +320 -0
  1515. package/dist/src/utils/claudeInChrome/setupPortable.js +172 -0
  1516. package/dist/src/utils/claudeInChrome/toolRendering.js +234 -0
  1517. package/dist/src/utils/claudemd.js +1054 -0
  1518. package/dist/src/utils/cleanup.js +514 -0
  1519. package/dist/src/utils/cleanupRegistry.js +22 -0
  1520. package/dist/src/utils/cliArgs.js +53 -0
  1521. package/dist/src/utils/cliHighlight.js +45 -0
  1522. package/dist/src/utils/codeIndexing.js +149 -0
  1523. package/dist/src/utils/collapseBackgroundBashNotifications.js +70 -0
  1524. package/dist/src/utils/collapseHookSummaries.js +48 -0
  1525. package/dist/src/utils/collapseReadSearch.js +871 -0
  1526. package/dist/src/utils/collapseTeammateShutdowns.js +44 -0
  1527. package/dist/src/utils/combinedAbortSignal.js +40 -0
  1528. package/dist/src/utils/commandLifecycle.js +7 -0
  1529. package/dist/src/utils/commitAttribution.js +720 -0
  1530. package/dist/src/utils/completionCache.js +138 -0
  1531. package/dist/src/utils/computerUse/appNames.js +170 -0
  1532. package/dist/src/utils/computerUse/cleanup.js +66 -0
  1533. package/dist/src/utils/computerUse/common.js +56 -0
  1534. package/dist/src/utils/computerUse/computerUseLock.js +183 -0
  1535. package/dist/src/utils/computerUse/drainRunLoop.js +71 -0
  1536. package/dist/src/utils/computerUse/escHotkey.js +53 -0
  1537. package/dist/src/utils/computerUse/executor.js +480 -0
  1538. package/dist/src/utils/computerUse/gates.js +55 -0
  1539. package/dist/src/utils/computerUse/hostAdapter.js +62 -0
  1540. package/dist/src/utils/computerUse/inputLoader.js +27 -0
  1541. package/dist/src/utils/computerUse/mcpServer.js +84 -0
  1542. package/dist/src/utils/computerUse/setup.js +42 -0
  1543. package/dist/src/utils/computerUse/swiftLoader.js +20 -0
  1544. package/dist/src/utils/computerUse/toolRendering.js +100 -0
  1545. package/dist/src/utils/computerUse/wrapper.js +318 -0
  1546. package/dist/src/utils/concurrentSessions.js +179 -0
  1547. package/dist/src/utils/config.js +1084 -0
  1548. package/dist/src/utils/configConstants.js +18 -0
  1549. package/dist/src/utils/contentArray.js +45 -0
  1550. package/dist/src/utils/context.js +185 -0
  1551. package/dist/src/utils/contextAnalysis.js +171 -0
  1552. package/dist/src/utils/contextSuggestions.js +158 -0
  1553. package/dist/src/utils/controlMessageCompat.js +31 -0
  1554. package/dist/src/utils/conversationRecovery.js +436 -0
  1555. package/dist/src/utils/cron.js +260 -0
  1556. package/dist/src/utils/cronJitterConfig.js +62 -0
  1557. package/dist/src/utils/cronScheduler.js +388 -0
  1558. package/dist/src/utils/cronTasks.js +332 -0
  1559. package/dist/src/utils/cronTasksLock.js +164 -0
  1560. package/dist/src/utils/crossProjectResume.js +46 -0
  1561. package/dist/src/utils/crypto.js +13 -0
  1562. package/dist/src/utils/cwd.js +29 -0
  1563. package/dist/src/utils/databaseMcp/common.js +48 -0
  1564. package/dist/src/utils/databaseMcp/mcpServer.js +2 -0
  1565. package/dist/src/utils/databaseMcp/server/connection.js +243 -0
  1566. package/dist/src/utils/databaseMcp/server/index.js +1442 -0
  1567. package/dist/src/utils/databaseMcp/server/queries.js +683 -0
  1568. package/dist/src/utils/databaseMcp/server/types.js +7 -0
  1569. package/dist/src/utils/databaseMcp/setup.js +28 -0
  1570. package/dist/src/utils/debug.js +220 -0
  1571. package/dist/src/utils/debugFilter.js +125 -0
  1572. package/dist/src/utils/deepLink/banner.js +103 -0
  1573. package/dist/src/utils/deepLink/parseDeepLink.js +138 -0
  1574. package/dist/src/utils/deepLink/protocolHandler.js +119 -0
  1575. package/dist/src/utils/deepLink/registerProtocol.js +291 -0
  1576. package/dist/src/utils/deepLink/terminalLauncher.js +455 -0
  1577. package/dist/src/utils/deepLink/terminalPreference.js +51 -0
  1578. package/dist/src/utils/desktopDeepLink.js +208 -0
  1579. package/dist/src/utils/detectRepository.js +157 -0
  1580. package/dist/src/utils/diagLogs.js +74 -0
  1581. package/dist/src/utils/diff.js +108 -0
  1582. package/dist/src/utils/directMemberMessage.js +34 -0
  1583. package/dist/src/utils/displayTags.js +46 -0
  1584. package/dist/src/utils/doctorContextWarnings.js +179 -0
  1585. package/dist/src/utils/doctorDiagnostic.js +495 -0
  1586. package/dist/src/utils/dxt/helpers.js +64 -0
  1587. package/dist/src/utils/dxt/zip.js +167 -0
  1588. package/dist/src/utils/earlyInput.js +166 -0
  1589. package/dist/src/utils/editor.js +163 -0
  1590. package/dist/src/utils/effort.js +278 -0
  1591. package/dist/src/utils/embeddedTools.js +26 -0
  1592. package/dist/src/utils/env.js +358 -0
  1593. package/dist/src/utils/envDynamic.js +130 -0
  1594. package/dist/src/utils/envUtils.js +192 -0
  1595. package/dist/src/utils/envValidation.js +26 -0
  1596. package/dist/src/utils/errorLogSink.js +197 -0
  1597. package/dist/src/utils/errors.js +207 -0
  1598. package/dist/src/utils/eventLoopStallDetector.js +16 -0
  1599. package/dist/src/utils/exampleCommands.js +165 -0
  1600. package/dist/src/utils/execFileNoThrow.js +93 -0
  1601. package/dist/src/utils/execFileNoThrowPortable.js +111 -0
  1602. package/dist/src/utils/execSyncWrapper.js +68 -0
  1603. package/dist/src/utils/exportRenderer.js +71 -0
  1604. package/dist/src/utils/extraUsage.js +19 -0
  1605. package/dist/src/utils/fastMode.js +393 -0
  1606. package/dist/src/utils/file.js +467 -0
  1607. package/dist/src/utils/fileHistory.js +851 -0
  1608. package/dist/src/utils/fileOperationAnalytics.js +45 -0
  1609. package/dist/src/utils/filePersistence/filePersistence.js +212 -0
  1610. package/dist/src/utils/filePersistence/outputsScanner.js +104 -0
  1611. package/dist/src/utils/filePersistence/types.js +5 -0
  1612. package/dist/src/utils/fileRead.js +81 -0
  1613. package/dist/src/utils/fileReadCache.js +78 -0
  1614. package/dist/src/utils/fileStateCache.js +99 -0
  1615. package/dist/src/utils/findExecutable.js +13 -0
  1616. package/dist/src/utils/fingerprint.js +59 -0
  1617. package/dist/src/utils/forkedAgent.js +410 -0
  1618. package/dist/src/utils/format.js +238 -0
  1619. package/dist/src/utils/formatBriefTimestamp.js +72 -0
  1620. package/dist/src/utils/fpsTracker.js +34 -0
  1621. package/dist/src/utils/frontmatterParser.js +260 -0
  1622. package/dist/src/utils/fsOperations.js +834 -0
  1623. package/dist/src/utils/fullscreen.js +194 -0
  1624. package/dist/src/utils/generatedFiles.js +122 -0
  1625. package/dist/src/utils/generators.js +67 -0
  1626. package/dist/src/utils/genericProcessUtils.js +155 -0
  1627. package/dist/src/utils/getWorktreePaths.js +56 -0
  1628. package/dist/src/utils/getWorktreePathsPortable.js +23 -0
  1629. package/dist/src/utils/ghPrStatus.js +71 -0
  1630. package/dist/src/utils/git/gitConfigParser.js +226 -0
  1631. package/dist/src/utils/git/gitFilesystem.js +606 -0
  1632. package/dist/src/utils/git/gitignore.js +84 -0
  1633. package/dist/src/utils/git.js +725 -0
  1634. package/dist/src/utils/gitDiff.js +395 -0
  1635. package/dist/src/utils/gitSettings.js +18 -0
  1636. package/dist/src/utils/github/ghAuthStatus.js +23 -0
  1637. package/dist/src/utils/githubRepoPathMapping.js +135 -0
  1638. package/dist/src/utils/glob.js +90 -0
  1639. package/dist/src/utils/gracefulShutdown.js +447 -0
  1640. package/dist/src/utils/groupToolUses.js +126 -0
  1641. package/dist/src/utils/handlePromptSubmit.js +398 -0
  1642. package/dist/src/utils/hash.js +46 -0
  1643. package/dist/src/utils/headlessProfiler.js +147 -0
  1644. package/dist/src/utils/heapDumpService.js +202 -0
  1645. package/dist/src/utils/heatmap.js +151 -0
  1646. package/dist/src/utils/highlightMatch.js +28 -0
  1647. package/dist/src/utils/hooks/AsyncHookRegistry.js +187 -0
  1648. package/dist/src/utils/hooks/apiQueryHookHelper.js +77 -0
  1649. package/dist/src/utils/hooks/execAgentHook.js +257 -0
  1650. package/dist/src/utils/hooks/execHttpHook.js +184 -0
  1651. package/dist/src/utils/hooks/execPromptHook.js +171 -0
  1652. package/dist/src/utils/hooks/fileChangedWatcher.js +161 -0
  1653. package/dist/src/utils/hooks/hookEvents.js +111 -0
  1654. package/dist/src/utils/hooks/hookHelpers.js +60 -0
  1655. package/dist/src/utils/hooks/hooksConfigManager.js +323 -0
  1656. package/dist/src/utils/hooks/hooksConfigSnapshot.js +114 -0
  1657. package/dist/src/utils/hooks/hooksSettings.js +204 -0
  1658. package/dist/src/utils/hooks/postSamplingHooks.js +39 -0
  1659. package/dist/src/utils/hooks/registerFrontmatterHooks.js +47 -0
  1660. package/dist/src/utils/hooks/registerSkillHooks.js +40 -0
  1661. package/dist/src/utils/hooks/sessionHooks.js +252 -0
  1662. package/dist/src/utils/hooks/skillImprovement.js +211 -0
  1663. package/dist/src/utils/hooks/ssrfGuard.js +258 -0
  1664. package/dist/src/utils/hooks.js +3668 -0
  1665. package/dist/src/utils/horizontalScroll.js +108 -0
  1666. package/dist/src/utils/http.js +121 -0
  1667. package/dist/src/utils/hyperlink.js +28 -0
  1668. package/dist/src/utils/iTermBackup.js +48 -0
  1669. package/dist/src/utils/ide.js +1235 -0
  1670. package/dist/src/utils/idePathConversion.js +66 -0
  1671. package/dist/src/utils/idleTimeout.js +44 -0
  1672. package/dist/src/utils/imagePaste.js +329 -0
  1673. package/dist/src/utils/imageResizer.js +664 -0
  1674. package/dist/src/utils/imageStore.js +150 -0
  1675. package/dist/src/utils/imageValidation.js +92 -0
  1676. package/dist/src/utils/immediateCommand.js +12 -0
  1677. package/dist/src/utils/inProcessTeammateHelpers.js +71 -0
  1678. package/dist/src/utils/ink.js +20 -0
  1679. package/dist/src/utils/intl.js +83 -0
  1680. package/dist/src/utils/jetbrains.js +152 -0
  1681. package/dist/src/utils/json.js +295 -0
  1682. package/dist/src/utils/jsonRead.js +14 -0
  1683. package/dist/src/utils/keyboardShortcuts.js +11 -0
  1684. package/dist/src/utils/lazySchema.js +8 -0
  1685. package/dist/src/utils/listSessionsImpl.js +332 -0
  1686. package/dist/src/utils/localInstaller.js +131 -0
  1687. package/dist/src/utils/lockfile.js +22 -0
  1688. package/dist/src/utils/log.js +280 -0
  1689. package/dist/src/utils/logoV2Utils.js +290 -0
  1690. package/dist/src/utils/mailbox.js +50 -0
  1691. package/dist/src/utils/managedEnv.js +160 -0
  1692. package/dist/src/utils/managedEnvConstants.js +200 -0
  1693. package/dist/src/utils/markdown.js +300 -0
  1694. package/dist/src/utils/markdownConfigLoader.js +494 -0
  1695. package/dist/src/utils/mcp/dateTimeParser.js +102 -0
  1696. package/dist/src/utils/mcp/elicitationValidation.js +259 -0
  1697. package/dist/src/utils/mcpInstructionsDelta.js +97 -0
  1698. package/dist/src/utils/mcpOutputStorage.js +159 -0
  1699. package/dist/src/utils/mcpValidation.js +165 -0
  1700. package/dist/src/utils/mcpWebSocketTransport.js +180 -0
  1701. package/dist/src/utils/memoize.js +205 -0
  1702. package/dist/src/utils/memory/types.js +9 -0
  1703. package/dist/src/utils/memory/versions.js +7 -0
  1704. package/dist/src/utils/memoryFileDetection.js +247 -0
  1705. package/dist/src/utils/messagePredicates.js +6 -0
  1706. package/dist/src/utils/messageQueueManager.js +430 -0
  1707. package/dist/src/utils/messages/mappers.js +240 -0
  1708. package/dist/src/utils/messages/systemInit.js +74 -0
  1709. package/dist/src/utils/messages.js +4273 -0
  1710. package/dist/src/utils/model/agent.js +128 -0
  1711. package/dist/src/utils/model/aliases.js +21 -0
  1712. package/dist/src/utils/model/antModels.js +25 -0
  1713. package/dist/src/utils/model/bedrock.js +220 -0
  1714. package/dist/src/utils/model/check1mAccess.js +64 -0
  1715. package/dist/src/utils/model/configs.js +93 -0
  1716. package/dist/src/utils/model/contextWindowUpgradeCheck.js +41 -0
  1717. package/dist/src/utils/model/deprecation.js +72 -0
  1718. package/dist/src/utils/model/model.js +641 -0
  1719. package/dist/src/utils/model/modelAllowlist.js +148 -0
  1720. package/dist/src/utils/model/modelCapabilities.js +107 -0
  1721. package/dist/src/utils/model/modelOptions.js +645 -0
  1722. package/dist/src/utils/model/modelStrings.js +144 -0
  1723. package/dist/src/utils/model/modelSupportOverrides.js +40 -0
  1724. package/dist/src/utils/model/openrouter.js +51 -0
  1725. package/dist/src/utils/model/providerBaseUrls.js +77 -0
  1726. package/dist/src/utils/model/providerCatalog.js +81 -0
  1727. package/dist/src/utils/model/providerModels.js +334 -0
  1728. package/dist/src/utils/model/providerProfiles.js +392 -0
  1729. package/dist/src/utils/model/providerProfilesDb.js +886 -0
  1730. package/dist/src/utils/model/providerSwitch.js +50 -0
  1731. package/dist/src/utils/model/providerWorkspaces.js +36 -0
  1732. package/dist/src/utils/model/providers.js +199 -0
  1733. package/dist/src/utils/model/validateModel.js +257 -0
  1734. package/dist/src/utils/modelCost.js +160 -0
  1735. package/dist/src/utils/modifiers.js +35 -0
  1736. package/dist/src/utils/mtls.js +134 -0
  1737. package/dist/src/utils/nativeInstaller/download.js +370 -0
  1738. package/dist/src/utils/nativeInstaller/index.js +8 -0
  1739. package/dist/src/utils/nativeInstaller/installer.js +1396 -0
  1740. package/dist/src/utils/nativeInstaller/packageManagers.js +258 -0
  1741. package/dist/src/utils/nativeInstaller/pidLock.js +347 -0
  1742. package/dist/src/utils/notebook.js +176 -0
  1743. package/dist/src/utils/objectGroupBy.js +15 -0
  1744. package/dist/src/utils/orchestration/store/index.js +6 -0
  1745. package/dist/src/utils/orchestration/store/orchestrationDb.js +42 -0
  1746. package/dist/src/utils/orchestration/store/providerAgentStore.js +244 -0
  1747. package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +125 -0
  1748. package/dist/src/utils/orchestration/store/runStore.js +486 -0
  1749. package/dist/src/utils/orchestration/store/teamStore.js +285 -0
  1750. package/dist/src/utils/orchestration/store/types.js +1 -0
  1751. package/dist/src/utils/pasteStore.js +93 -0
  1752. package/dist/src/utils/path.js +140 -0
  1753. package/dist/src/utils/pdf.js +236 -0
  1754. package/dist/src/utils/pdfUtils.js +61 -0
  1755. package/dist/src/utils/peerAddress.js +20 -0
  1756. package/dist/src/utils/permissions/PermissionMode.js +95 -0
  1757. package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +85 -0
  1758. package/dist/src/utils/permissions/PermissionResult.js +11 -0
  1759. package/dist/src/utils/permissions/PermissionRule.js +19 -0
  1760. package/dist/src/utils/permissions/PermissionUpdate.js +330 -0
  1761. package/dist/src/utils/permissions/PermissionUpdateSchema.js +61 -0
  1762. package/dist/src/utils/permissions/autoModeState.js +34 -0
  1763. package/dist/src/utils/permissions/bashClassifier.js +30 -0
  1764. package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +115 -0
  1765. package/dist/src/utils/permissions/classifierDecision.js +88 -0
  1766. package/dist/src/utils/permissions/classifierShared.js +28 -0
  1767. package/dist/src/utils/permissions/dangerousPatterns.js +78 -0
  1768. package/dist/src/utils/permissions/denialTracking.js +34 -0
  1769. package/dist/src/utils/permissions/filesystem.js +1426 -0
  1770. package/dist/src/utils/permissions/getNextPermissionMode.js +74 -0
  1771. package/dist/src/utils/permissions/pathValidation.js +351 -0
  1772. package/dist/src/utils/permissions/permissionExplainer.js +188 -0
  1773. package/dist/src/utils/permissions/permissionRuleParser.js +177 -0
  1774. package/dist/src/utils/permissions/permissionSetup.js +1164 -0
  1775. package/dist/src/utils/permissions/permissions.js +1106 -0
  1776. package/dist/src/utils/permissions/permissionsDb.js +322 -0
  1777. package/dist/src/utils/permissions/permissionsLoader.js +217 -0
  1778. package/dist/src/utils/permissions/shadowedRuleDetection.js +149 -0
  1779. package/dist/src/utils/permissions/shellRuleMatching.js +174 -0
  1780. package/dist/src/utils/permissions/yoloClassifier.js +1195 -0
  1781. package/dist/src/utils/planModeV2.js +75 -0
  1782. package/dist/src/utils/plans.js +334 -0
  1783. package/dist/src/utils/platform.js +122 -0
  1784. package/dist/src/utils/plugins/addDirPluginSettings.js +53 -0
  1785. package/dist/src/utils/plugins/cacheUtils.js +174 -0
  1786. package/dist/src/utils/plugins/dependencyResolver.js +244 -0
  1787. package/dist/src/utils/plugins/fetchTelemetry.js +108 -0
  1788. package/dist/src/utils/plugins/gitAvailability.js +65 -0
  1789. package/dist/src/utils/plugins/headlessPluginInstall.js +136 -0
  1790. package/dist/src/utils/plugins/hintRecommendation.js +136 -0
  1791. package/dist/src/utils/plugins/installCounts.js +218 -0
  1792. package/dist/src/utils/plugins/installedPluginsManager.js +1003 -0
  1793. package/dist/src/utils/plugins/loadPluginAgents.js +219 -0
  1794. package/dist/src/utils/plugins/loadPluginCommands.js +595 -0
  1795. package/dist/src/utils/plugins/loadPluginHooks.js +239 -0
  1796. package/dist/src/utils/plugins/loadPluginOutputStyles.js +112 -0
  1797. package/dist/src/utils/plugins/lspPluginIntegration.js +293 -0
  1798. package/dist/src/utils/plugins/lspRecommendation.js +278 -0
  1799. package/dist/src/utils/plugins/managedPlugins.js +26 -0
  1800. package/dist/src/utils/plugins/marketplaceHelpers.js +470 -0
  1801. package/dist/src/utils/plugins/marketplaceManager.js +1939 -0
  1802. package/dist/src/utils/plugins/mcpPluginIntegration.js +465 -0
  1803. package/dist/src/utils/plugins/mcpbHandler.js +708 -0
  1804. package/dist/src/utils/plugins/officialMarketplace.js +21 -0
  1805. package/dist/src/utils/plugins/officialMarketplaceGcs.js +195 -0
  1806. package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +338 -0
  1807. package/dist/src/utils/plugins/orphanedPluginFilter.js +96 -0
  1808. package/dist/src/utils/plugins/parseMarketplaceInput.js +143 -0
  1809. package/dist/src/utils/plugins/performStartupChecks.js +66 -0
  1810. package/dist/src/utils/plugins/pluginAutoupdate.js +210 -0
  1811. package/dist/src/utils/plugins/pluginBlocklist.js +93 -0
  1812. package/dist/src/utils/plugins/pluginDirectories.js +172 -0
  1813. package/dist/src/utils/plugins/pluginFlagging.js +173 -0
  1814. package/dist/src/utils/plugins/pluginIdentifier.js +78 -0
  1815. package/dist/src/utils/plugins/pluginInstallationHelpers.js +400 -0
  1816. package/dist/src/utils/plugins/pluginLoader.js +2426 -0
  1817. package/dist/src/utils/plugins/pluginOptionsStorage.js +311 -0
  1818. package/dist/src/utils/plugins/pluginPolicy.js +18 -0
  1819. package/dist/src/utils/plugins/pluginStartupCheck.js +261 -0
  1820. package/dist/src/utils/plugins/pluginVersioning.js +128 -0
  1821. package/dist/src/utils/plugins/reconciler.js +181 -0
  1822. package/dist/src/utils/plugins/refresh.js +162 -0
  1823. package/dist/src/utils/plugins/schemas.js +1283 -0
  1824. package/dist/src/utils/plugins/validatePlugin.js +765 -0
  1825. package/dist/src/utils/plugins/walkPluginMarkdown.js +49 -0
  1826. package/dist/src/utils/plugins/zipCache.js +346 -0
  1827. package/dist/src/utils/plugins/zipCacheAdapters.js +133 -0
  1828. package/dist/src/utils/postCommitAttribution.js +16 -0
  1829. package/dist/src/utils/powershell/dangerousCmdlets.js +174 -0
  1830. package/dist/src/utils/powershell/parser.js +1357 -0
  1831. package/dist/src/utils/powershell/staticPrefix.js +277 -0
  1832. package/dist/src/utils/preflightChecks.js +147 -0
  1833. package/dist/src/utils/privacyLevel.js +49 -0
  1834. package/dist/src/utils/process.js +56 -0
  1835. package/dist/src/utils/processUserInput/processBashCommand.js +119 -0
  1836. package/dist/src/utils/processUserInput/processSlashCommand.js +859 -0
  1837. package/dist/src/utils/processUserInput/processTextPrompt.js +68 -0
  1838. package/dist/src/utils/processUserInput/processUserInput.js +326 -0
  1839. package/dist/src/utils/profilerBase.js +29 -0
  1840. package/dist/src/utils/promptCategory.js +39 -0
  1841. package/dist/src/utils/promptEditor.js +151 -0
  1842. package/dist/src/utils/promptShellExecution.js +119 -0
  1843. package/dist/src/utils/proxy.js +347 -0
  1844. package/dist/src/utils/queryContext.js +110 -0
  1845. package/dist/src/utils/queryHelpers.js +436 -0
  1846. package/dist/src/utils/queryProfiler.js +242 -0
  1847. package/dist/src/utils/queueProcessor.js +70 -0
  1848. package/dist/src/utils/readEditContext.js +176 -0
  1849. package/dist/src/utils/readFileInRange.js +278 -0
  1850. package/dist/src/utils/releaseNotes.js +304 -0
  1851. package/dist/src/utils/renderOptions.js +67 -0
  1852. package/dist/src/utils/ripgrep.js +540 -0
  1853. package/dist/src/utils/sandbox/sandbox-adapter.js +751 -0
  1854. package/dist/src/utils/sandbox/sandbox-ui-utils.js +11 -0
  1855. package/dist/src/utils/sanitization.js +72 -0
  1856. package/dist/src/utils/screenshotClipboard.js +89 -0
  1857. package/dist/src/utils/sdkEventQueue.js +49 -0
  1858. package/dist/src/utils/sdkHeapDumpMonitor.js +16 -0
  1859. package/dist/src/utils/secureStorage/fallbackStorage.js +59 -0
  1860. package/dist/src/utils/secureStorage/index.js +14 -0
  1861. package/dist/src/utils/secureStorage/keychainPrefetch.js +91 -0
  1862. package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +91 -0
  1863. package/dist/src/utils/secureStorage/macOsKeychainStorage.js +192 -0
  1864. package/dist/src/utils/secureStorage/plainTextStorage.js +81 -0
  1865. package/dist/src/utils/secureStorage/secureStoreDefs.js +1 -0
  1866. package/dist/src/utils/secureStorage/sqliteStorage.js +224 -0
  1867. package/dist/src/utils/secureStorage/types.js +1 -0
  1868. package/dist/src/utils/semanticBoolean.js +23 -0
  1869. package/dist/src/utils/semanticNumber.js +34 -0
  1870. package/dist/src/utils/semver.js +53 -0
  1871. package/dist/src/utils/sequential.js +43 -0
  1872. package/dist/src/utils/sessionActivity.js +120 -0
  1873. package/dist/src/utils/sessionDataUploader.js +16 -0
  1874. package/dist/src/utils/sessionEnvVars.js +18 -0
  1875. package/dist/src/utils/sessionEnvironment.js +131 -0
  1876. package/dist/src/utils/sessionFileAccessHooks.js +207 -0
  1877. package/dist/src/utils/sessionIngressAuth.js +113 -0
  1878. package/dist/src/utils/sessionRestore.js +359 -0
  1879. package/dist/src/utils/sessionStart.js +165 -0
  1880. package/dist/src/utils/sessionState.js +76 -0
  1881. package/dist/src/utils/sessionStorage.js +4162 -0
  1882. package/dist/src/utils/sessionStoragePortable.js +665 -0
  1883. package/dist/src/utils/sessionTitle.js +120 -0
  1884. package/dist/src/utils/sessionUrl.js +50 -0
  1885. package/dist/src/utils/set.js +50 -0
  1886. package/dist/src/utils/settings/allErrors.js +29 -0
  1887. package/dist/src/utils/settings/applySettingsChange.js +65 -0
  1888. package/dist/src/utils/settings/changeDetector.js +409 -0
  1889. package/dist/src/utils/settings/constants.js +166 -0
  1890. package/dist/src/utils/settings/internalWrites.js +33 -0
  1891. package/dist/src/utils/settings/managedPath.js +29 -0
  1892. package/dist/src/utils/settings/mdm/constants.js +62 -0
  1893. package/dist/src/utils/settings/mdm/rawRead.js +97 -0
  1894. package/dist/src/utils/settings/mdm/settings.js +254 -0
  1895. package/dist/src/utils/settings/permissionValidation.js +224 -0
  1896. package/dist/src/utils/settings/pluginOnlyPolicy.js +53 -0
  1897. package/dist/src/utils/settings/schemaOutput.js +7 -0
  1898. package/dist/src/utils/settings/settings.js +844 -0
  1899. package/dist/src/utils/settings/settingsCache.js +47 -0
  1900. package/dist/src/utils/settings/toolValidationConfig.js +76 -0
  1901. package/dist/src/utils/settings/types.js +846 -0
  1902. package/dist/src/utils/settings/validateEditTool.js +34 -0
  1903. package/dist/src/utils/settings/validation.js +192 -0
  1904. package/dist/src/utils/settings/validationTips.js +111 -0
  1905. package/dist/src/utils/shell/bashProvider.js +202 -0
  1906. package/dist/src/utils/shell/outputLimits.js +7 -0
  1907. package/dist/src/utils/shell/powershellDetection.js +96 -0
  1908. package/dist/src/utils/shell/powershellProvider.js +104 -0
  1909. package/dist/src/utils/shell/prefix.js +246 -0
  1910. package/dist/src/utils/shell/readOnlyCommandValidation.js +1776 -0
  1911. package/dist/src/utils/shell/resolveDefaultShell.js +13 -0
  1912. package/dist/src/utils/shell/shellProvider.js +2 -0
  1913. package/dist/src/utils/shell/shellToolUtils.js +21 -0
  1914. package/dist/src/utils/shell/specPrefix.js +198 -0
  1915. package/dist/src/utils/shellConfig.js +136 -0
  1916. package/dist/src/utils/sideQuery.js +195 -0
  1917. package/dist/src/utils/sideQuestion.js +121 -0
  1918. package/dist/src/utils/signal.js +34 -0
  1919. package/dist/src/utils/sinks.js +15 -0
  1920. package/dist/src/utils/skills/skillChangeDetector.js +266 -0
  1921. package/dist/src/utils/slashCommandParsing.js +46 -0
  1922. package/dist/src/utils/sleep.js +72 -0
  1923. package/dist/src/utils/sliceAnsi.js +74 -0
  1924. package/dist/src/utils/slowOperations.js +323 -0
  1925. package/dist/src/utils/standaloneAgent.js +20 -0
  1926. package/dist/src/utils/startupProfiler.js +158 -0
  1927. package/dist/src/utils/staticRender.js +103 -0
  1928. package/dist/src/utils/stats.js +802 -0
  1929. package/dist/src/utils/statsCache.js +330 -0
  1930. package/dist/src/utils/status.js +552 -0
  1931. package/dist/src/utils/statusNoticeDefinitions.js +112 -0
  1932. package/dist/src/utils/statusNoticeHelpers.js +15 -0
  1933. package/dist/src/utils/stream.js +73 -0
  1934. package/dist/src/utils/streamJsonStdoutGuard.js +107 -0
  1935. package/dist/src/utils/streamlinedTransform.js +162 -0
  1936. package/dist/src/utils/stringUtils.js +202 -0
  1937. package/dist/src/utils/subprocessEnv.js +87 -0
  1938. package/dist/src/utils/suggestions/commandSuggestions.js +458 -0
  1939. package/dist/src/utils/suggestions/directoryCompletion.js +191 -0
  1940. package/dist/src/utils/suggestions/shellHistoryCompletion.js +95 -0
  1941. package/dist/src/utils/suggestions/skillUsageTracking.js +50 -0
  1942. package/dist/src/utils/suggestions/slackChannelSuggestions.js +169 -0
  1943. package/dist/src/utils/swarm/It2SetupPrompt.js +386 -0
  1944. package/dist/src/utils/swarm/backends/ITermBackend.js +276 -0
  1945. package/dist/src/utils/swarm/backends/InProcessBackend.js +237 -0
  1946. package/dist/src/utils/swarm/backends/PaneBackendExecutor.js +250 -0
  1947. package/dist/src/utils/swarm/backends/TmuxBackend.js +574 -0
  1948. package/dist/src/utils/swarm/backends/detection.js +112 -0
  1949. package/dist/src/utils/swarm/backends/it2Setup.js +185 -0
  1950. package/dist/src/utils/swarm/backends/registry.js +369 -0
  1951. package/dist/src/utils/swarm/backends/teammateModeSnapshot.js +68 -0
  1952. package/dist/src/utils/swarm/backends/types.js +9 -0
  1953. package/dist/src/utils/swarm/constants.js +29 -0
  1954. package/dist/src/utils/swarm/inProcessRunner.js +1021 -0
  1955. package/dist/src/utils/swarm/leaderPermissionBridge.js +31 -0
  1956. package/dist/src/utils/swarm/permissionSync.js +667 -0
  1957. package/dist/src/utils/swarm/reconnection.js +82 -0
  1958. package/dist/src/utils/swarm/spawnInProcess.js +218 -0
  1959. package/dist/src/utils/swarm/spawnUtils.js +123 -0
  1960. package/dist/src/utils/swarm/teamHelpers.js +484 -0
  1961. package/dist/src/utils/swarm/teammateInit.js +87 -0
  1962. package/dist/src/utils/swarm/teammateLayoutManager.js +82 -0
  1963. package/dist/src/utils/swarm/teammateModel.js +9 -0
  1964. package/dist/src/utils/swarm/teammatePromptAddendum.js +17 -0
  1965. package/dist/src/utils/systemDirectories.js +51 -0
  1966. package/dist/src/utils/systemPrompt.js +91 -0
  1967. package/dist/src/utils/systemPromptType.js +9 -0
  1968. package/dist/src/utils/systemTheme.js +108 -0
  1969. package/dist/src/utils/systemThemeWatcher.js +16 -0
  1970. package/dist/src/utils/taggedId.js +49 -0
  1971. package/dist/src/utils/task/TaskOutput.js +320 -0
  1972. package/dist/src/utils/task/diskOutput.js +387 -0
  1973. package/dist/src/utils/task/framework.js +236 -0
  1974. package/dist/src/utils/task/outputFormatting.js +24 -0
  1975. package/dist/src/utils/task/sdkProgress.js +24 -0
  1976. package/dist/src/utils/tasks.js +672 -0
  1977. package/dist/src/utils/teamDiscovery.js +48 -0
  1978. package/dist/src/utils/teamMemoryOps.js +67 -0
  1979. package/dist/src/utils/teammate.js +237 -0
  1980. package/dist/src/utils/teammateContext.js +56 -0
  1981. package/dist/src/utils/teammateMailbox.js +793 -0
  1982. package/dist/src/utils/telemetry/betaSessionTracing.js +371 -0
  1983. package/dist/src/utils/telemetry/bigqueryExporter.js +181 -0
  1984. package/dist/src/utils/telemetry/events.js +57 -0
  1985. package/dist/src/utils/telemetry/instrumentation.js +617 -0
  1986. package/dist/src/utils/telemetry/logger.js +25 -0
  1987. package/dist/src/utils/telemetry/perfettoTracing.js +882 -0
  1988. package/dist/src/utils/telemetry/pluginTelemetry.js +157 -0
  1989. package/dist/src/utils/telemetry/sessionTracing.js +693 -0
  1990. package/dist/src/utils/telemetry/skillLoadedEvent.js +26 -0
  1991. package/dist/src/utils/telemetryAttributes.js +57 -0
  1992. package/dist/src/utils/teleport/api.js +299 -0
  1993. package/dist/src/utils/teleport/environmentSelection.js +55 -0
  1994. package/dist/src/utils/teleport/environments.js +84 -0
  1995. package/dist/src/utils/teleport/gitBundle.js +192 -0
  1996. package/dist/src/utils/teleport.js +1041 -0
  1997. package/dist/src/utils/tempfile.js +26 -0
  1998. package/dist/src/utils/terminal.js +105 -0
  1999. package/dist/src/utils/terminalPanel.js +155 -0
  2000. package/dist/src/utils/textHighlighting.js +113 -0
  2001. package/dist/src/utils/theme.js +525 -0
  2002. package/dist/src/utils/thinking.js +130 -0
  2003. package/dist/src/utils/timeouts.js +35 -0
  2004. package/dist/src/utils/tmuxSocket.js +373 -0
  2005. package/dist/src/utils/todo/types.js +9 -0
  2006. package/dist/src/utils/tokenBudget.js +62 -0
  2007. package/dist/src/utils/tokens.js +223 -0
  2008. package/dist/src/utils/toolErrors.js +101 -0
  2009. package/dist/src/utils/toolPool.js +63 -0
  2010. package/dist/src/utils/toolResultStorage.js +769 -0
  2011. package/dist/src/utils/toolSchemaCache.js +7 -0
  2012. package/dist/src/utils/toolSearch.js +551 -0
  2013. package/dist/src/utils/transcriptSearch.js +200 -0
  2014. package/dist/src/utils/treeify.js +111 -0
  2015. package/dist/src/utils/truncate.js +164 -0
  2016. package/dist/src/utils/udsClient.js +16 -0
  2017. package/dist/src/utils/udsMessaging.js +16 -0
  2018. package/dist/src/utils/ultraplan/ccrSession.js +264 -0
  2019. package/dist/src/utils/ultraplan/keyword.js +122 -0
  2020. package/dist/src/utils/ultraplan/prompt.txt +1 -0
  2021. package/dist/src/utils/unaryLogging.js +16 -0
  2022. package/dist/src/utils/undercover.js +89 -0
  2023. package/dist/src/utils/user.js +138 -0
  2024. package/dist/src/utils/userAgent.js +13 -0
  2025. package/dist/src/utils/userPromptKeywords.js +21 -0
  2026. package/dist/src/utils/uuid.js +22 -0
  2027. package/dist/src/utils/warningHandler.js +97 -0
  2028. package/dist/src/utils/which.js +75 -0
  2029. package/dist/src/utils/windowsPaths.js +150 -0
  2030. package/dist/src/utils/withResolvers.js +13 -0
  2031. package/dist/src/utils/words.js +793 -0
  2032. package/dist/src/utils/workloadContext.js +42 -0
  2033. package/dist/src/utils/worktree.js +1145 -0
  2034. package/dist/src/utils/worktreeModeEnabled.js +11 -0
  2035. package/dist/src/utils/xdg.js +52 -0
  2036. package/dist/src/utils/xml.js +15 -0
  2037. package/dist/src/utils/yaml.js +16 -0
  2038. package/dist/src/utils/zodToJsonSchema.js +19 -0
  2039. package/dist/src/vim/motions.js +73 -0
  2040. package/dist/src/vim/operators.js +401 -0
  2041. package/dist/src/vim/textObjects.js +153 -0
  2042. package/dist/src/vim/transitions.js +340 -0
  2043. package/dist/src/vim/types.js +93 -0
  2044. package/dist/src/voice/voiceModeEnabled.js +48 -0
  2045. package/dist/src/whatsapp/bridge.js +267 -0
  2046. package/dist/src/whatsapp/config.js +153 -0
  2047. package/dist/src/whatsapp/markdown.js +37 -0
  2048. package/dist/src/whatsapp/mirror.js +74 -0
  2049. package/dist/src/whatsapp/session.js +142 -0
  2050. package/package.json +2 -1
@@ -0,0 +1,1644 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import autoBind from 'auto-bind';
3
+ import { closeSync, constants as fsConstants, openSync, readSync, writeSync } from 'fs';
4
+ import noop from 'lodash-es/noop.js';
5
+ import throttle from 'lodash-es/throttle.js';
6
+ import { ConcurrentRoot } from 'react-reconciler/constants.js';
7
+ import { onExit } from 'signal-exit';
8
+ import { flushInteractionTime } from '../bootstrap/state.js';
9
+ import { getYogaCounters } from '../native-ts/yoga-layout/index.js';
10
+ import { logForDebugging } from '../utils/debug.js';
11
+ import { logError } from '../utils/log.js';
12
+ import { format } from 'util';
13
+ import { colorize } from './colorize.js';
14
+ import App from './components/App.js';
15
+ import { FRAME_INTERVAL_MS } from './constants.js';
16
+ import * as dom from './dom.js';
17
+ import { KeyboardEvent } from './events/keyboard-event.js';
18
+ import { FocusManager } from './focus.js';
19
+ import { emptyFrame } from './frame.js';
20
+ import { dispatchClick, dispatchHover } from './hit-test.js';
21
+ import instances from './instances.js';
22
+ import { LogUpdate } from './log-update.js';
23
+ import { nodeCache } from './node-cache.js';
24
+ import { optimize } from './optimizer.js';
25
+ import Output from './output.js';
26
+ import reconciler, { dispatcher, getLastCommitMs, getLastYogaMs, isDebugRepaintsEnabled, recordYogaMs, resetProfileCounters } from './reconciler.js';
27
+ import renderNodeToOutput, { consumeFollowScroll, didLayoutShift } from './render-node-to-output.js';
28
+ import { applyPositionedHighlight, scanPositions } from './render-to-screen.js';
29
+ import createRenderer from './renderer.js';
30
+ import { CharPool, cellAt, createScreen, HyperlinkPool, isEmptyCellAt, migrateScreenPools, StylePool } from './screen.js';
31
+ import { applySearchHighlight } from './searchHighlight.js';
32
+ import { applySelectionOverlay, captureScrolledRows, clearSelection, createSelectionState, extendSelection, findPlainTextUrlAt, getSelectedText, hasSelection, moveFocus, selectLineAt, selectWordAt, shiftAnchor, shiftSelection, shiftSelectionForFollow, startSelection, updateSelection } from './selection.js';
33
+ import { SYNC_OUTPUT_SUPPORTED, supportsExtendedKeys, writeDiffToTerminal } from './terminal.js';
34
+ import { CURSOR_HOME, cursorMove, cursorPosition, DISABLE_KITTY_KEYBOARD, DISABLE_MODIFY_OTHER_KEYS, ENABLE_KITTY_KEYBOARD, ENABLE_MODIFY_OTHER_KEYS, ERASE_SCREEN } from './termio/csi.js';
35
+ import { DBP, DFE, DISABLE_MOUSE_TRACKING, ENABLE_MOUSE_TRACKING, ENTER_ALT_SCREEN, EXIT_ALT_SCREEN, SHOW_CURSOR } from './termio/dec.js';
36
+ import { CLEAR_ITERM2_PROGRESS, CLEAR_TAB_STATUS, setClipboard, supportsTabStatus, wrapForMultiplexer } from './termio/osc.js';
37
+ import { TerminalWriteProvider } from './useTerminalNotification.js';
38
+ // Alt-screen: renderer.ts sets cursor.visible = !isTTY || screen.height===0,
39
+ // which is always false in alt-screen (TTY + content fills screen).
40
+ // Reusing a frozen object saves 1 allocation per frame.
41
+ const ALT_SCREEN_ANCHOR_CURSOR = Object.freeze({
42
+ x: 0,
43
+ y: 0,
44
+ visible: false
45
+ });
46
+ const CURSOR_HOME_PATCH = Object.freeze({
47
+ type: 'stdout',
48
+ content: CURSOR_HOME
49
+ });
50
+ const ERASE_THEN_HOME_PATCH = Object.freeze({
51
+ type: 'stdout',
52
+ content: ERASE_SCREEN + CURSOR_HOME
53
+ });
54
+ // Cached per-Ink-instance, invalidated on resize. frame.cursor.y for
55
+ // alt-screen is always terminalRows - 1 (renderer.ts).
56
+ function makeAltScreenParkPatch(terminalRows) {
57
+ return Object.freeze({
58
+ type: 'stdout',
59
+ content: cursorPosition(terminalRows, 1)
60
+ });
61
+ }
62
+ export default class Ink {
63
+ options;
64
+ log;
65
+ terminal;
66
+ scheduleRender;
67
+ // Ignore last render after unmounting a tree to prevent empty output before exit
68
+ isUnmounted = false;
69
+ isPaused = false;
70
+ container;
71
+ rootNode;
72
+ focusManager;
73
+ renderer;
74
+ stylePool;
75
+ charPool;
76
+ hyperlinkPool;
77
+ exitPromise;
78
+ restoreConsole;
79
+ restoreStderr;
80
+ unsubscribeTTYHandlers;
81
+ terminalColumns;
82
+ terminalRows;
83
+ currentNode = null;
84
+ frontFrame;
85
+ backFrame;
86
+ lastPoolResetTime = performance.now();
87
+ drainTimer = null;
88
+ lastYogaCounters = {
89
+ ms: 0,
90
+ visited: 0,
91
+ measured: 0,
92
+ cacheHits: 0,
93
+ live: 0
94
+ };
95
+ altScreenParkPatch;
96
+ // Text selection state (alt-screen only). Owned here so the overlay
97
+ // pass in onRender can read it and App.tsx can update it from mouse
98
+ // events. Public so instances.get() callers can access.
99
+ selection = createSelectionState();
100
+ // Search highlight query (alt-screen only). Setter below triggers
101
+ // scheduleRender; applySearchHighlight in onRender inverts matching cells.
102
+ searchHighlightQuery = '';
103
+ // Position-based highlight. VML scans positions ONCE (via
104
+ // scanElementSubtree, when the target message is mounted), stores them
105
+ // message-relative, sets this for every-frame apply. rowOffset =
106
+ // message's current screen-top. currentIdx = which position is
107
+ // "current" (yellow). null clears. Positions are known upfront —
108
+ // navigation is index arithmetic, no scan-feedback loop.
109
+ searchPositions = null;
110
+ // React-land subscribers for selection state changes (useHasSelection).
111
+ // Fired alongside the terminal repaint whenever the selection mutates
112
+ // so UI (e.g. footer hints) can react to selection appearing/clearing.
113
+ selectionListeners = new Set();
114
+ // DOM nodes currently under the pointer (mode-1003 motion). Held here
115
+ // so App.tsx's handleMouseEvent is stateless — dispatchHover diffs
116
+ // against this set and mutates it in place.
117
+ hoveredNodes = new Set();
118
+ // Set by <AlternateScreen> via setAltScreenActive(). Controls the
119
+ // renderer's cursor.y clamping (keeps cursor in-viewport to avoid
120
+ // LF-induced scroll when screen.height === terminalRows) and gates
121
+ // alt-screen-aware SIGCONT/resize/unmount handling.
122
+ altScreenActive = false;
123
+ // Set alongside altScreenActive so SIGCONT resume knows whether to
124
+ // re-enable mouse tracking (not all <AlternateScreen> uses want it).
125
+ altScreenMouseTracking = false;
126
+ // True when the previous frame's screen buffer cannot be trusted for
127
+ // blit — selection overlay mutated it, resetFramesForAltScreen()
128
+ // replaced it with blanks, or forceRedraw() reset it to 0×0. Forces
129
+ // one full-render frame; steady-state frames after clear it and regain
130
+ // the blit + narrow-damage fast path.
131
+ prevFrameContaminated = false;
132
+ // Set by handleResize: prepend ERASE_SCREEN to the next onRender's patches
133
+ // INSIDE the BSU/ESU block so clear+paint is atomic. Writing ERASE_SCREEN
134
+ // synchronously in handleResize would leave the screen blank for the ~80ms
135
+ // render() takes; deferring into the atomic block means old content stays
136
+ // visible until the new frame is fully ready.
137
+ needsEraseBeforePaint = false;
138
+ // Native cursor positioning: a component (via useDeclaredCursor) declares
139
+ // where the terminal cursor should be parked after each frame. Terminal
140
+ // emulators render IME preedit text at the physical cursor position, and
141
+ // screen readers / screen magnifiers track it — so parking at the text
142
+ // input's caret makes CJK input appear inline and lets a11y tools follow.
143
+ cursorDeclaration = null;
144
+ // Main-screen: physical cursor position after the declared-cursor move,
145
+ // tracked separately from frame.cursor (which must stay at content-bottom
146
+ // for log-update's relative-move invariants). Alt-screen doesn't need
147
+ // this — every frame begins with CSI H. null = no move emitted last frame.
148
+ displayCursor = null;
149
+ constructor(options) {
150
+ this.options = options;
151
+ autoBind(this);
152
+ if (this.options.patchConsole) {
153
+ this.restoreConsole = this.patchConsole();
154
+ this.restoreStderr = this.patchStderr();
155
+ }
156
+ this.terminal = {
157
+ stdout: options.stdout,
158
+ stderr: options.stderr
159
+ };
160
+ this.terminalColumns = options.stdout.columns || 80;
161
+ this.terminalRows = options.stdout.rows || 24;
162
+ this.altScreenParkPatch = makeAltScreenParkPatch(this.terminalRows);
163
+ this.stylePool = new StylePool();
164
+ this.charPool = new CharPool();
165
+ this.hyperlinkPool = new HyperlinkPool();
166
+ this.frontFrame = emptyFrame(this.terminalRows, this.terminalColumns, this.stylePool, this.charPool, this.hyperlinkPool);
167
+ this.backFrame = emptyFrame(this.terminalRows, this.terminalColumns, this.stylePool, this.charPool, this.hyperlinkPool);
168
+ this.log = new LogUpdate({
169
+ isTTY: options.stdout.isTTY || false,
170
+ stylePool: this.stylePool
171
+ });
172
+ // scheduleRender is called from the reconciler's resetAfterCommit, which
173
+ // runs BEFORE React's layout phase (ref attach + useLayoutEffect). Any
174
+ // state set in layout effects — notably the cursorDeclaration from
175
+ // useDeclaredCursor — would lag one commit behind if we rendered
176
+ // synchronously. Deferring to a microtask runs onRender after layout
177
+ // effects have committed, so the native cursor tracks the caret without
178
+ // a one-keystroke lag. Same event-loop tick, so throughput is unchanged.
179
+ // Test env uses onImmediateRender (direct onRender, no throttle) so
180
+ // existing synchronous lastFrame() tests are unaffected.
181
+ const deferredRender = () => queueMicrotask(this.onRender);
182
+ this.scheduleRender = throttle(deferredRender, FRAME_INTERVAL_MS, {
183
+ leading: true,
184
+ trailing: true
185
+ });
186
+ // Ignore last render after unmounting a tree to prevent empty output before exit
187
+ this.isUnmounted = false;
188
+ // Unmount when process exits
189
+ this.unsubscribeExit = onExit(this.unmount, {
190
+ alwaysLast: false
191
+ });
192
+ if (options.stdout.isTTY) {
193
+ options.stdout.on('resize', this.handleResize);
194
+ process.on('SIGCONT', this.handleResume);
195
+ this.unsubscribeTTYHandlers = () => {
196
+ options.stdout.off('resize', this.handleResize);
197
+ process.off('SIGCONT', this.handleResume);
198
+ };
199
+ }
200
+ this.rootNode = dom.createNode('ink-root');
201
+ this.focusManager = new FocusManager((target, event) => dispatcher.dispatchDiscrete(target, event));
202
+ this.rootNode.focusManager = this.focusManager;
203
+ this.renderer = createRenderer(this.rootNode, this.stylePool);
204
+ this.rootNode.onRender = this.scheduleRender;
205
+ this.rootNode.onImmediateRender = this.onRender;
206
+ this.rootNode.onComputeLayout = () => {
207
+ // Calculate layout during React's commit phase so useLayoutEffect hooks
208
+ // have access to fresh layout data
209
+ // Guard against accessing freed Yoga nodes after unmount
210
+ if (this.isUnmounted) {
211
+ return;
212
+ }
213
+ if (this.rootNode.yogaNode) {
214
+ const t0 = performance.now();
215
+ this.rootNode.yogaNode.setWidth(this.terminalColumns);
216
+ this.rootNode.yogaNode.calculateLayout(this.terminalColumns);
217
+ const ms = performance.now() - t0;
218
+ recordYogaMs(ms);
219
+ const c = getYogaCounters();
220
+ this.lastYogaCounters = {
221
+ ms,
222
+ ...c
223
+ };
224
+ }
225
+ };
226
+ // @ts-expect-error @types/react-reconciler@0.32.3 declares 11 args with transitionCallbacks,
227
+ // but react-reconciler 0.33.0 source only accepts 10 args (no transitionCallbacks)
228
+ this.container = reconciler.createContainer(this.rootNode, ConcurrentRoot, null, false, null, 'id', noop,
229
+ // onUncaughtError
230
+ noop,
231
+ // onCaughtError
232
+ noop,
233
+ // onRecoverableError
234
+ noop // onDefaultTransitionIndicator
235
+ );
236
+ if ("production" === 'development') {
237
+ reconciler.injectIntoDevTools({
238
+ bundleType: 0,
239
+ // Reporting React DOM's version, not Ink's
240
+ // See https://github.com/facebook/react/issues/16666#issuecomment-532639905
241
+ version: '16.13.1',
242
+ rendererPackageName: 'ink'
243
+ });
244
+ }
245
+ }
246
+ handleResume = () => {
247
+ if (!this.options.stdout.isTTY) {
248
+ return;
249
+ }
250
+ // Alt screen: after SIGCONT, content is stale (shell may have written
251
+ // to main screen, switching focus away) and mouse tracking was
252
+ // disabled by handleSuspend.
253
+ if (this.altScreenActive) {
254
+ this.reenterAltScreen();
255
+ return;
256
+ }
257
+ // Main screen: start fresh to prevent clobbering terminal content
258
+ this.frontFrame = emptyFrame(this.frontFrame.viewport.height, this.frontFrame.viewport.width, this.stylePool, this.charPool, this.hyperlinkPool);
259
+ this.backFrame = emptyFrame(this.backFrame.viewport.height, this.backFrame.viewport.width, this.stylePool, this.charPool, this.hyperlinkPool);
260
+ this.log.reset();
261
+ // Physical cursor position is unknown after the shell took over during
262
+ // suspend. Clear displayCursor so the next frame's cursor preamble
263
+ // doesn't emit a relative move from a stale park position.
264
+ this.displayCursor = null;
265
+ };
266
+ // NOT debounced. A debounce opens a window where stdout.columns is NEW
267
+ // but this.terminalColumns/Yoga are OLD — any scheduleRender during that
268
+ // window (spinner, clock) makes log-update detect a width change and
269
+ // clear the screen, then the debounce fires and clears again (double
270
+ // blank→paint flicker). useVirtualScroll's height scaling already bounds
271
+ // the per-resize cost; synchronous handling keeps dimensions consistent.
272
+ handleResize = () => {
273
+ const cols = this.options.stdout.columns || 80;
274
+ const rows = this.options.stdout.rows || 24;
275
+ // Terminals often emit 2+ resize events for one user action (window
276
+ // settling). Same-dimension events are no-ops; skip to avoid redundant
277
+ // frame resets and renders.
278
+ if (cols === this.terminalColumns && rows === this.terminalRows)
279
+ return;
280
+ this.terminalColumns = cols;
281
+ this.terminalRows = rows;
282
+ this.altScreenParkPatch = makeAltScreenParkPatch(this.terminalRows);
283
+ // Alt screen: reset frame buffers so the next render repaints from
284
+ // scratch (prevFrameContaminated → every cell written, wrapped in
285
+ // BSU/ESU — old content stays visible until the new frame swaps
286
+ // atomically). Re-assert mouse tracking (some emulators reset it on
287
+ // resize). Do NOT write ENTER_ALT_SCREEN: iTerm2 treats ?1049h as a
288
+ // buffer clear even when already in alt — that's the blank flicker.
289
+ // Self-healing re-entry (if something kicked us out of alt) is handled
290
+ // by handleResume (SIGCONT) and the sleep-wake detector; resize itself
291
+ // doesn't exit alt-screen. Do NOT write ERASE_SCREEN: render() below
292
+ // can take ~80ms; erasing first leaves the screen blank that whole time.
293
+ if (this.altScreenActive && !this.isPaused && this.options.stdout.isTTY) {
294
+ if (this.altScreenMouseTracking) {
295
+ this.options.stdout.write(ENABLE_MOUSE_TRACKING);
296
+ }
297
+ this.resetFramesForAltScreen();
298
+ this.needsEraseBeforePaint = true;
299
+ }
300
+ // Re-render the React tree with updated props so the context value changes.
301
+ // React's commit phase will call onComputeLayout() to recalculate yoga layout
302
+ // with the new dimensions, then call onRender() to render the updated frame.
303
+ // We don't call scheduleRender() here because that would render before the
304
+ // layout is updated, causing a mismatch between viewport and content dimensions.
305
+ if (this.currentNode !== null) {
306
+ this.render(this.currentNode);
307
+ }
308
+ };
309
+ resolveExitPromise = () => { };
310
+ rejectExitPromise = () => { };
311
+ unsubscribeExit = () => { };
312
+ /**
313
+ * Pause Ink and hand the terminal over to an external TUI (e.g. git
314
+ * commit editor). In non-fullscreen mode this enters the alt screen;
315
+ * in fullscreen mode we're already in alt so we just clear it.
316
+ * Call `exitAlternateScreen()` when done to restore Ink.
317
+ */
318
+ enterAlternateScreen() {
319
+ this.pause();
320
+ this.suspendStdin();
321
+ this.options.stdout.write(
322
+ // Disable extended key reporting first — editors that don't speak
323
+ // CSI-u (e.g. nano) show "Unknown sequence" for every Ctrl-<key> if
324
+ // kitty/modifyOtherKeys stays active. exitAlternateScreen re-enables.
325
+ DISABLE_KITTY_KEYBOARD + DISABLE_MODIFY_OTHER_KEYS + (this.altScreenMouseTracking ? DISABLE_MOUSE_TRACKING : '') + (
326
+ // disable mouse (no-op if off)
327
+ this.altScreenActive ? '' : '\x1b[?1049h') +
328
+ // enter alt (already in alt if fullscreen)
329
+ '\x1b[?1004l' +
330
+ // disable focus reporting
331
+ '\x1b[0m' +
332
+ // reset attributes
333
+ '\x1b[?25h' +
334
+ // show cursor
335
+ '\x1b[2J' +
336
+ // clear screen
337
+ '\x1b[H' // cursor home
338
+ );
339
+ }
340
+ /**
341
+ * Resume Ink after an external TUI handoff with a full repaint.
342
+ * In non-fullscreen mode this exits the alt screen back to main;
343
+ * in fullscreen mode we re-enter alt and clear + repaint.
344
+ *
345
+ * The re-enter matters: terminal editors (vim, nano, less) write
346
+ * smcup/rmcup (?1049h/?1049l), so even though we started in alt,
347
+ * the editor's rmcup on exit drops us to main screen. Without
348
+ * re-entering, the 2J below wipes the user's main-screen scrollback
349
+ * and subsequent renders land in main — native terminal scroll
350
+ * returns, fullscreen scroll is dead.
351
+ */
352
+ exitAlternateScreen() {
353
+ this.options.stdout.write((this.altScreenActive ? ENTER_ALT_SCREEN : '') +
354
+ // re-enter alt — vim's rmcup dropped us to main
355
+ '\x1b[2J' +
356
+ // clear screen (now alt if fullscreen)
357
+ '\x1b[H' + (
358
+ // cursor home
359
+ this.altScreenMouseTracking ? ENABLE_MOUSE_TRACKING : '') + (
360
+ // re-enable mouse (skip if CLAUDE_CODE_DISABLE_MOUSE)
361
+ this.altScreenActive ? '' : '\x1b[?1049l') +
362
+ // exit alt (non-fullscreen only)
363
+ '\x1b[?25l' // hide cursor (Ink manages)
364
+ );
365
+ this.resumeStdin();
366
+ if (this.altScreenActive) {
367
+ this.resetFramesForAltScreen();
368
+ }
369
+ else {
370
+ this.repaint();
371
+ }
372
+ this.resume();
373
+ // Re-enable focus reporting and extended key reporting — terminal
374
+ // editors (vim, nano, etc.) write their own modifyOtherKeys level on
375
+ // entry and reset it on exit, leaving us unable to distinguish
376
+ // ctrl+shift+<letter> from ctrl+<letter>. Pop-before-push keeps the
377
+ // Kitty stack balanced (a well-behaved editor restores our entry, so
378
+ // without the pop we'd accumulate depth on each editor round-trip).
379
+ this.options.stdout.write('\x1b[?1004h' + (supportsExtendedKeys() ? DISABLE_KITTY_KEYBOARD + ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS : ''));
380
+ }
381
+ onRender() {
382
+ if (this.isUnmounted || this.isPaused) {
383
+ return;
384
+ }
385
+ // Entering a render cancels any pending drain tick — this render will
386
+ // handle the drain (and re-schedule below if needed). Prevents a
387
+ // wheel-event-triggered render AND a drain-timer render both firing.
388
+ if (this.drainTimer !== null) {
389
+ clearTimeout(this.drainTimer);
390
+ this.drainTimer = null;
391
+ }
392
+ // Flush deferred interaction-time update before rendering so we call
393
+ // Date.now() at most once per frame instead of once per keypress.
394
+ // Done before the render to avoid dirtying state that would trigger
395
+ // an extra React re-render cycle.
396
+ flushInteractionTime();
397
+ const renderStart = performance.now();
398
+ const terminalWidth = this.options.stdout.columns || 80;
399
+ const terminalRows = this.options.stdout.rows || 24;
400
+ const frame = this.renderer({
401
+ frontFrame: this.frontFrame,
402
+ backFrame: this.backFrame,
403
+ isTTY: this.options.stdout.isTTY,
404
+ terminalWidth,
405
+ terminalRows,
406
+ altScreen: this.altScreenActive,
407
+ prevFrameContaminated: this.prevFrameContaminated
408
+ });
409
+ const rendererMs = performance.now() - renderStart;
410
+ // Sticky/auto-follow scrolled the ScrollBox this frame. Translate the
411
+ // selection by the same delta so the highlight stays anchored to the
412
+ // TEXT (native terminal behavior — the selection walks up the screen
413
+ // as content scrolls, eventually clipping at the top). frontFrame
414
+ // still holds the PREVIOUS frame's screen (swap is at ~500 below), so
415
+ // captureScrolledRows reads the rows that are about to scroll out
416
+ // before they're overwritten — the text stays copyable until the
417
+ // selection scrolls entirely off. During drag, focus tracks the mouse
418
+ // (screen-local) so only anchor shifts — selection grows toward the
419
+ // mouse as the anchor walks up. After release, both ends are text-
420
+ // anchored and move as a block.
421
+ const follow = consumeFollowScroll();
422
+ if (follow && this.selection.anchor &&
423
+ // Only translate if the selection is ON scrollbox content. Selections
424
+ // in the footer/prompt/StickyPromptHeader are on static text — the
425
+ // scroll doesn't move what's under them. Without this guard, a
426
+ // footer selection would be shifted by -delta then clamped to
427
+ // viewportBottom, teleporting it into the scrollbox. Mirror the
428
+ // bounds check the deleted check() in ScrollKeybindingHandler had.
429
+ this.selection.anchor.row >= follow.viewportTop && this.selection.anchor.row <= follow.viewportBottom) {
430
+ const { delta, viewportTop, viewportBottom } = follow;
431
+ // captureScrolledRows and shift* are a pair: capture grabs rows about
432
+ // to scroll off, shift moves the selection endpoint so the same rows
433
+ // won't intersect again next frame. Capturing without shifting leaves
434
+ // the endpoint in place, so the SAME viewport rows re-intersect every
435
+ // frame and scrolledOffAbove grows without bound — getSelectedText
436
+ // then returns ever-growing text on each re-copy. Keep capture inside
437
+ // each shift branch so the pairing can't be broken by a new guard.
438
+ if (this.selection.isDragging) {
439
+ if (hasSelection(this.selection)) {
440
+ captureScrolledRows(this.selection, this.frontFrame.screen, viewportTop, viewportTop + delta - 1, 'above');
441
+ }
442
+ shiftAnchor(this.selection, -delta, viewportTop, viewportBottom);
443
+ }
444
+ else if (
445
+ // Flag-3 guard: the anchor check above only proves ONE endpoint is
446
+ // on scrollbox content. A drag from row 3 (scrollbox) into the
447
+ // footer at row 6, then release, leaves focus outside the viewport
448
+ // — shiftSelectionForFollow would clamp it to viewportBottom,
449
+ // teleporting the highlight from static footer into the scrollbox.
450
+ // Symmetric check: require BOTH ends inside to translate. A
451
+ // straddling selection falls through to NEITHER shift NOR capture:
452
+ // the footer endpoint pins the selection, text scrolls away under
453
+ // the highlight, and getSelectedText reads the CURRENT screen
454
+ // contents — no accumulation. Dragging branch doesn't need this:
455
+ // shiftAnchor ignores focus, and the anchor DOES shift (so capture
456
+ // is correct there even when focus is in the footer).
457
+ !this.selection.focus || this.selection.focus.row >= viewportTop && this.selection.focus.row <= viewportBottom) {
458
+ if (hasSelection(this.selection)) {
459
+ captureScrolledRows(this.selection, this.frontFrame.screen, viewportTop, viewportTop + delta - 1, 'above');
460
+ }
461
+ const cleared = shiftSelectionForFollow(this.selection, -delta, viewportTop, viewportBottom);
462
+ // Auto-clear (both ends overshot minRow) must notify React-land
463
+ // so useHasSelection re-renders and the footer copy/escape hint
464
+ // disappears. notifySelectionChange() would recurse into onRender;
465
+ // fire the listeners directly — they schedule a React update for
466
+ // LATER, they don't re-enter this frame.
467
+ if (cleared)
468
+ for (const cb of this.selectionListeners)
469
+ cb();
470
+ }
471
+ }
472
+ // Selection overlay: invert cell styles in the screen buffer itself,
473
+ // so the diff picks up selection as ordinary cell changes and
474
+ // LogUpdate remains a pure diff engine.
475
+ //
476
+ // Full-screen damage (PR #20120) is a correctness backstop for the
477
+ // sibling-resize bleed: when flexbox siblings resize between frames
478
+ // (spinner appears → bottom grows → scrollbox shrinks), the
479
+ // cached-clear + clip-and-cull + setCellAt damage union can miss
480
+ // transition cells at the boundary. But that only happens when layout
481
+ // actually SHIFTS — didLayoutShift() tracks exactly this (any node's
482
+ // cached yoga position/size differs from current, or a child was
483
+ // removed). Steady-state frames (spinner rotate, clock tick, text
484
+ // stream into fixed-height box) don't shift layout, so normal damage
485
+ // bounds are correct and diffEach only compares the damaged region.
486
+ //
487
+ // Selection also requires full damage: overlay writes via setCellStyleId
488
+ // which doesn't track damage, and prev-frame overlay cells need to be
489
+ // compared when selection moves/clears. prevFrameContaminated covers
490
+ // the frame-after-selection-clears case.
491
+ let selActive = false;
492
+ let hlActive = false;
493
+ if (this.altScreenActive) {
494
+ selActive = hasSelection(this.selection);
495
+ if (selActive) {
496
+ applySelectionOverlay(frame.screen, this.selection, this.stylePool);
497
+ }
498
+ // Scan-highlight: inverse on ALL visible matches (less/vim style).
499
+ // Position-highlight (below) overlays CURRENT (yellow) on top.
500
+ hlActive = applySearchHighlight(frame.screen, this.searchHighlightQuery, this.stylePool);
501
+ // Position-based CURRENT: write yellow at positions[currentIdx] +
502
+ // rowOffset. No scanning — positions came from a prior scan when
503
+ // the message first mounted. Message-relative + rowOffset = screen.
504
+ if (this.searchPositions) {
505
+ const sp = this.searchPositions;
506
+ const posApplied = applyPositionedHighlight(frame.screen, this.stylePool, sp.positions, sp.rowOffset, sp.currentIdx);
507
+ hlActive = hlActive || posApplied;
508
+ }
509
+ }
510
+ // Full-damage backstop: applies on BOTH alt-screen and main-screen.
511
+ // Layout shifts (spinner appears, status line resizes) can leave stale
512
+ // cells at sibling boundaries that per-node damage tracking misses.
513
+ // Selection/highlight overlays write via setCellStyleId which doesn't
514
+ // track damage. prevFrameContaminated covers the cleanup frame.
515
+ if (didLayoutShift() || selActive || hlActive || this.prevFrameContaminated) {
516
+ frame.screen.damage = {
517
+ x: 0,
518
+ y: 0,
519
+ width: frame.screen.width,
520
+ height: frame.screen.height
521
+ };
522
+ }
523
+ // Alt-screen: anchor the physical cursor to (0,0) before every diff.
524
+ // All cursor moves in log-update are RELATIVE to prev.cursor; if tmux
525
+ // (or any emulator) perturbs the physical cursor out-of-band (status
526
+ // bar refresh, pane redraw, Cmd+K wipe), the relative moves drift and
527
+ // content creeps up 1 row/frame. CSI H resets the physical cursor;
528
+ // passing prev.cursor=(0,0) makes the diff compute from the same spot.
529
+ // Self-healing against any external cursor manipulation. Main-screen
530
+ // can't do this — cursor.y tracks scrollback rows CSI H can't reach.
531
+ // The CSI H write is deferred until after the diff is computed so we
532
+ // can skip it for empty diffs (no writes → physical cursor unused).
533
+ let prevFrame = this.frontFrame;
534
+ if (this.altScreenActive) {
535
+ prevFrame = {
536
+ ...this.frontFrame,
537
+ cursor: ALT_SCREEN_ANCHOR_CURSOR
538
+ };
539
+ }
540
+ const tDiff = performance.now();
541
+ const diff = this.log.render(prevFrame, frame, this.altScreenActive,
542
+ // DECSTBM needs BSU/ESU atomicity — without it the outer terminal
543
+ // renders the scrolled-but-not-yet-repainted intermediate state.
544
+ // tmux is the main case (re-emits DECSTBM with its own timing and
545
+ // doesn't implement DEC 2026, so SYNC_OUTPUT_SUPPORTED is false).
546
+ SYNC_OUTPUT_SUPPORTED);
547
+ const diffMs = performance.now() - tDiff;
548
+ // Swap buffers
549
+ this.backFrame = this.frontFrame;
550
+ this.frontFrame = frame;
551
+ // Periodically reset char/hyperlink pools to prevent unbounded growth
552
+ // during long sessions. 5 minutes is infrequent enough that the O(cells)
553
+ // migration cost is negligible. Reuses renderStart to avoid extra clock call.
554
+ if (renderStart - this.lastPoolResetTime > 5 * 60 * 1000) {
555
+ this.resetPools();
556
+ this.lastPoolResetTime = renderStart;
557
+ }
558
+ const flickers = [];
559
+ for (const patch of diff) {
560
+ if (patch.type === 'clearTerminal') {
561
+ flickers.push({
562
+ desiredHeight: frame.screen.height,
563
+ availableHeight: frame.viewport.height,
564
+ reason: patch.reason
565
+ });
566
+ if (isDebugRepaintsEnabled() && patch.debug) {
567
+ const chain = dom.findOwnerChainAtRow(this.rootNode, patch.debug.triggerY);
568
+ logForDebugging(`[REPAINT] full reset · ${patch.reason} · row ${patch.debug.triggerY}\n` + ` prev: "${patch.debug.prevLine}"\n` + ` next: "${patch.debug.nextLine}"\n` + ` culprit: ${chain.length ? chain.join(' < ') : '(no owner chain captured)'}`, {
569
+ level: 'warn'
570
+ });
571
+ }
572
+ }
573
+ }
574
+ const tOptimize = performance.now();
575
+ const optimized = optimize(diff);
576
+ const optimizeMs = performance.now() - tOptimize;
577
+ const hasDiff = optimized.length > 0;
578
+ if (this.altScreenActive && hasDiff) {
579
+ // Prepend CSI H to anchor the physical cursor to (0,0) so
580
+ // log-update's relative moves compute from a known spot (self-healing
581
+ // against out-of-band cursor drift, see the ALT_SCREEN_ANCHOR_CURSOR
582
+ // comment above). Append CSI row;1 H to park the cursor at the bottom
583
+ // row (where the prompt input is) — without this, the cursor ends
584
+ // wherever the last diff write landed (a different row every frame),
585
+ // making iTerm2's cursor guide flicker as it chases the cursor.
586
+ // BSU/ESU protects content atomicity but iTerm2's guide tracks cursor
587
+ // position independently. Parking at bottom (not 0,0) keeps the guide
588
+ // where the user's attention is.
589
+ //
590
+ // After resize, prepend ERASE_SCREEN too. The diff only writes cells
591
+ // that changed; cells where new=blank and prev-buffer=blank get skipped
592
+ // — but the physical terminal still has stale content there (shorter
593
+ // lines at new width leave old-width text tails visible). ERASE inside
594
+ // BSU/ESU is atomic: old content stays visible until the whole
595
+ // erase+paint lands, then swaps in one go. Writing ERASE_SCREEN
596
+ // synchronously in handleResize would blank the screen for the ~80ms
597
+ // render() takes.
598
+ if (this.needsEraseBeforePaint) {
599
+ this.needsEraseBeforePaint = false;
600
+ optimized.unshift(ERASE_THEN_HOME_PATCH);
601
+ }
602
+ else {
603
+ optimized.unshift(CURSOR_HOME_PATCH);
604
+ }
605
+ optimized.push(this.altScreenParkPatch);
606
+ }
607
+ // Native cursor positioning: park the terminal cursor at the declared
608
+ // position so IME preedit text renders inline and screen readers /
609
+ // magnifiers can follow the input. nodeCache holds the absolute screen
610
+ // rect populated by renderNodeToOutput this frame (including scrollTop
611
+ // translation) — if the declared node didn't render (stale declaration
612
+ // after remount, or scrolled out of view), it won't be in the cache
613
+ // and no move is emitted.
614
+ const decl = this.cursorDeclaration;
615
+ const rect = decl !== null ? nodeCache.get(decl.node) : undefined;
616
+ const target = decl !== null && rect !== undefined ? {
617
+ x: rect.x + decl.relativeX,
618
+ y: rect.y + decl.relativeY
619
+ } : null;
620
+ const parked = this.displayCursor;
621
+ // Preserve the empty-diff zero-write fast path: skip all cursor writes
622
+ // when nothing rendered AND the park target is unchanged.
623
+ const targetMoved = target !== null && (parked === null || parked.x !== target.x || parked.y !== target.y);
624
+ if (hasDiff || targetMoved || target === null && parked !== null) {
625
+ // Main-screen preamble: log-update's relative moves assume the
626
+ // physical cursor is at prevFrame.cursor. If last frame parked it
627
+ // elsewhere, move back before the diff runs. Alt-screen's CSI H
628
+ // already resets to (0,0) so no preamble needed.
629
+ if (parked !== null && !this.altScreenActive && hasDiff) {
630
+ const pdx = prevFrame.cursor.x - parked.x;
631
+ const pdy = prevFrame.cursor.y - parked.y;
632
+ if (pdx !== 0 || pdy !== 0) {
633
+ optimized.unshift({
634
+ type: 'stdout',
635
+ content: cursorMove(pdx, pdy)
636
+ });
637
+ }
638
+ }
639
+ if (target !== null) {
640
+ if (this.altScreenActive) {
641
+ // Absolute CUP (1-indexed); next frame's CSI H resets regardless.
642
+ // Emitted after altScreenParkPatch so the declared position wins.
643
+ const row = Math.min(Math.max(target.y + 1, 1), terminalRows);
644
+ const col = Math.min(Math.max(target.x + 1, 1), terminalWidth);
645
+ optimized.push({
646
+ type: 'stdout',
647
+ content: cursorPosition(row, col)
648
+ });
649
+ }
650
+ else {
651
+ // After the diff (or preamble), cursor is at frame.cursor. If no
652
+ // diff AND previously parked, it's still at the old park position
653
+ // (log-update wrote nothing). Otherwise it's at frame.cursor.
654
+ const from = !hasDiff && parked !== null ? parked : {
655
+ x: frame.cursor.x,
656
+ y: frame.cursor.y
657
+ };
658
+ const dx = target.x - from.x;
659
+ const dy = target.y - from.y;
660
+ if (dx !== 0 || dy !== 0) {
661
+ optimized.push({
662
+ type: 'stdout',
663
+ content: cursorMove(dx, dy)
664
+ });
665
+ }
666
+ }
667
+ this.displayCursor = target;
668
+ }
669
+ else {
670
+ // Declaration cleared (input blur, unmount). Restore physical cursor
671
+ // to frame.cursor before forgetting the park position — otherwise
672
+ // displayCursor=null lies about where the cursor is, and the NEXT
673
+ // frame's preamble (or log-update's relative moves) computes from a
674
+ // wrong spot. The preamble above handles hasDiff; this handles
675
+ // !hasDiff (e.g. accessibility mode where blur doesn't change
676
+ // renderedValue since invert is identity).
677
+ if (parked !== null && !this.altScreenActive && !hasDiff) {
678
+ const rdx = frame.cursor.x - parked.x;
679
+ const rdy = frame.cursor.y - parked.y;
680
+ if (rdx !== 0 || rdy !== 0) {
681
+ optimized.push({
682
+ type: 'stdout',
683
+ content: cursorMove(rdx, rdy)
684
+ });
685
+ }
686
+ }
687
+ this.displayCursor = null;
688
+ }
689
+ }
690
+ const tWrite = performance.now();
691
+ writeDiffToTerminal(this.terminal, optimized, this.altScreenActive && !SYNC_OUTPUT_SUPPORTED);
692
+ const writeMs = performance.now() - tWrite;
693
+ // Update blit safety for the NEXT frame. The frame just rendered
694
+ // becomes frontFrame (= next frame's prevScreen). If we applied the
695
+ // selection overlay, that buffer has inverted cells. selActive/hlActive
696
+ // are only ever true in alt-screen; in main-screen this is false→false.
697
+ this.prevFrameContaminated = selActive || hlActive;
698
+ // A ScrollBox has pendingScrollDelta left to drain — schedule the next
699
+ // frame. MUST NOT call this.scheduleRender() here: we're inside a
700
+ // trailing-edge throttle invocation, timerId is undefined, and lodash's
701
+ // debounce sees timeSinceLastCall >= wait (last call was at the start
702
+ // of this window) → leadingEdge fires IMMEDIATELY → double render ~0.1ms
703
+ // apart → jank. Use a plain timeout. If a wheel event arrives first,
704
+ // its scheduleRender path fires a render which clears this timer at
705
+ // the top of onRender — no double.
706
+ //
707
+ // Drain frames are cheap (DECSTBM + ~10 patches, ~200 bytes) so run at
708
+ // quarter interval (~250fps, setTimeout practical floor) for max scroll
709
+ // speed. Regular renders stay at FRAME_INTERVAL_MS via the throttle.
710
+ if (frame.scrollDrainPending) {
711
+ this.drainTimer = setTimeout(() => this.onRender(), FRAME_INTERVAL_MS >> 2);
712
+ }
713
+ const yogaMs = getLastYogaMs();
714
+ const commitMs = getLastCommitMs();
715
+ const yc = this.lastYogaCounters;
716
+ // Reset so drain-only frames (no React commit) don't repeat stale values.
717
+ resetProfileCounters();
718
+ this.lastYogaCounters = {
719
+ ms: 0,
720
+ visited: 0,
721
+ measured: 0,
722
+ cacheHits: 0,
723
+ live: 0
724
+ };
725
+ this.options.onFrame?.({
726
+ durationMs: performance.now() - renderStart,
727
+ phases: {
728
+ renderer: rendererMs,
729
+ diff: diffMs,
730
+ optimize: optimizeMs,
731
+ write: writeMs,
732
+ patches: diff.length,
733
+ yoga: yogaMs,
734
+ commit: commitMs,
735
+ yogaVisited: yc.visited,
736
+ yogaMeasured: yc.measured,
737
+ yogaCacheHits: yc.cacheHits,
738
+ yogaLive: yc.live
739
+ },
740
+ flickers
741
+ });
742
+ }
743
+ pause() {
744
+ // Flush pending React updates and render before pausing.
745
+ // @ts-expect-error flushSyncFromReconciler exists in react-reconciler 0.31 but not in @types/react-reconciler
746
+ reconciler.flushSyncFromReconciler();
747
+ this.onRender();
748
+ this.isPaused = true;
749
+ }
750
+ resume() {
751
+ this.isPaused = false;
752
+ this.onRender();
753
+ }
754
+ /**
755
+ * Reset frame buffers so the next render writes the full screen from scratch.
756
+ * Call this before resume() when the terminal content has been corrupted by
757
+ * an external process (e.g. tmux, shell, full-screen TUI).
758
+ */
759
+ repaint() {
760
+ this.frontFrame = emptyFrame(this.frontFrame.viewport.height, this.frontFrame.viewport.width, this.stylePool, this.charPool, this.hyperlinkPool);
761
+ this.backFrame = emptyFrame(this.backFrame.viewport.height, this.backFrame.viewport.width, this.stylePool, this.charPool, this.hyperlinkPool);
762
+ this.log.reset();
763
+ // Physical cursor position is unknown after external terminal corruption.
764
+ // Clear displayCursor so the cursor preamble doesn't emit a stale
765
+ // relative move from where we last parked it.
766
+ this.displayCursor = null;
767
+ }
768
+ /**
769
+ * Clear the physical terminal and force a full redraw.
770
+ *
771
+ * The traditional readline ctrl+l — clears the visible screen and
772
+ * redraws the current content. Also the recovery path when the terminal
773
+ * was cleared externally (macOS Cmd+K) and Ink's diff engine thinks
774
+ * unchanged cells don't need repainting. Scrollback is preserved.
775
+ */
776
+ forceRedraw() {
777
+ if (!this.options.stdout.isTTY || this.isUnmounted || this.isPaused)
778
+ return;
779
+ this.options.stdout.write(ERASE_SCREEN + CURSOR_HOME);
780
+ if (this.altScreenActive) {
781
+ this.resetFramesForAltScreen();
782
+ }
783
+ else {
784
+ this.repaint();
785
+ // repaint() resets frontFrame to 0×0. Without this flag the next
786
+ // frame's blit optimization copies from that empty screen and the
787
+ // diff sees no content. onRender resets the flag at frame end.
788
+ this.prevFrameContaminated = true;
789
+ }
790
+ this.onRender();
791
+ }
792
+ /**
793
+ * Mark the previous frame as untrustworthy for blit, forcing the next
794
+ * render to do a full-damage diff instead of the per-node fast path.
795
+ *
796
+ * Lighter than forceRedraw() — no screen clear, no extra write. Call
797
+ * from a useLayoutEffect cleanup when unmounting a tall overlay: the
798
+ * blit fast path can copy stale cells from the overlay frame into rows
799
+ * the shrunken layout no longer reaches, leaving a ghost title/divider.
800
+ * onRender resets the flag at frame end so it's one-shot.
801
+ */
802
+ invalidatePrevFrame() {
803
+ this.prevFrameContaminated = true;
804
+ }
805
+ /**
806
+ * Called by the <AlternateScreen> component on mount/unmount.
807
+ * Controls cursor.y clamping in the renderer and gates alt-screen-aware
808
+ * behavior in SIGCONT/resize/unmount handlers. Repaints on change so
809
+ * the first alt-screen frame (and first main-screen frame on exit) is
810
+ * a full redraw with no stale diff state.
811
+ */
812
+ setAltScreenActive(active, mouseTracking = false) {
813
+ if (this.altScreenActive === active)
814
+ return;
815
+ this.altScreenActive = active;
816
+ this.altScreenMouseTracking = active && mouseTracking;
817
+ if (active) {
818
+ this.resetFramesForAltScreen();
819
+ }
820
+ else {
821
+ this.repaint();
822
+ }
823
+ }
824
+ get isAltScreenActive() {
825
+ return this.altScreenActive;
826
+ }
827
+ /**
828
+ * Re-assert terminal modes after a gap (>5s stdin silence or event-loop
829
+ * stall). Catches tmux detach→attach, ssh reconnect, and laptop
830
+ * sleep/wake — none of which send SIGCONT. The terminal may reset DEC
831
+ * private modes on reconnect; this method restores them.
832
+ *
833
+ * Always re-asserts extended key reporting and mouse tracking. Mouse
834
+ * tracking is idempotent (DEC private mode set-when-set is a no-op). The
835
+ * Kitty keyboard protocol is NOT — CSI >1u is a stack push, so we pop
836
+ * first to keep depth balanced (pop on empty stack is a no-op per spec,
837
+ * so after a terminal reset this still restores depth 0→1). Without the
838
+ * pop, each >5s idle gap adds a stack entry, and the single pop on exit
839
+ * or suspend can't drain them — the shell is left in CSI u mode where
840
+ * Ctrl+C/Ctrl+D leak as escape sequences. The alt-screen
841
+ * re-entry (ERASE_SCREEN + frame reset) is NOT idempotent — it blanks the
842
+ * screen — so it's opt-in via includeAltScreen. The stdin-gap caller fires
843
+ * on ordinary >5s idle + keypress and must not erase; the event-loop stall
844
+ * detector fires on genuine sleep/wake and opts in. tmux attach / ssh
845
+ * reconnect typically send a resize, which already covers alt-screen via
846
+ * handleResize.
847
+ */
848
+ reassertTerminalModes = (includeAltScreen = false) => {
849
+ if (!this.options.stdout.isTTY)
850
+ return;
851
+ // Don't touch the terminal during an editor handoff — re-enabling kitty
852
+ // keyboard here would undo enterAlternateScreen's disable and nano would
853
+ // start seeing CSI-u sequences again.
854
+ if (this.isPaused)
855
+ return;
856
+ // Extended keys — re-assert if enabled (App.tsx enables these on
857
+ // allowlisted terminals at raw-mode entry; a terminal reset clears them).
858
+ // Pop-before-push keeps Kitty stack depth at 1 instead of accumulating
859
+ // on each call.
860
+ if (supportsExtendedKeys()) {
861
+ this.options.stdout.write(DISABLE_KITTY_KEYBOARD + ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS);
862
+ }
863
+ if (!this.altScreenActive)
864
+ return;
865
+ // Mouse tracking — idempotent, safe to re-assert on every stdin gap.
866
+ if (this.altScreenMouseTracking) {
867
+ this.options.stdout.write(ENABLE_MOUSE_TRACKING);
868
+ }
869
+ // Alt-screen re-entry — destructive (ERASE_SCREEN). Only for callers that
870
+ // have a strong signal the terminal actually dropped mode 1049.
871
+ if (includeAltScreen) {
872
+ this.reenterAltScreen();
873
+ }
874
+ };
875
+ /**
876
+ * Mark this instance as unmounted so future unmount() calls early-return.
877
+ * Called by gracefulShutdown's cleanupTerminalModes() after it has sent
878
+ * EXIT_ALT_SCREEN but before the remaining terminal-reset sequences.
879
+ * Without this, signal-exit's deferred ink.unmount() (triggered by
880
+ * process.exit()) runs the full unmount path: onRender() + writeSync
881
+ * cleanup block + updateContainerSync → AlternateScreen unmount cleanup.
882
+ * The result is 2-3 redundant EXIT_ALT_SCREEN sequences landing on the
883
+ * main screen AFTER printResumeHint(), which tmux (at least) interprets
884
+ * as restoring the saved cursor position — clobbering the resume hint.
885
+ */
886
+ detachForShutdown() {
887
+ this.isUnmounted = true;
888
+ // Cancel any pending throttled render so it doesn't fire between
889
+ // cleanupTerminalModes() and process.exit() and write to main screen.
890
+ this.scheduleRender.cancel?.();
891
+ // Restore stdin from raw mode. unmount() used to do this via React
892
+ // unmount (App.componentWillUnmount → handleSetRawMode(false)) but we're
893
+ // short-circuiting that path. Must use this.options.stdin — NOT
894
+ // process.stdin — because getStdinOverride() may have opened /dev/tty
895
+ // when stdin is piped.
896
+ const stdin = this.options.stdin;
897
+ this.drainStdin();
898
+ if (stdin.isTTY && stdin.isRaw && stdin.setRawMode) {
899
+ stdin.setRawMode(false);
900
+ }
901
+ }
902
+ /** @see drainStdin */
903
+ drainStdin() {
904
+ drainStdin(this.options.stdin);
905
+ }
906
+ /**
907
+ * Re-enter alt-screen, clear, home, re-enable mouse tracking, and reset
908
+ * frame buffers so the next render repaints from scratch. Self-heal for
909
+ * SIGCONT, resize, and stdin-gap/event-loop-stall (sleep/wake) — any of
910
+ * which can leave the terminal in main-screen mode while altScreenActive
911
+ * stays true. ENTER_ALT_SCREEN is a terminal-side no-op if already in alt.
912
+ */
913
+ reenterAltScreen() {
914
+ this.options.stdout.write(ENTER_ALT_SCREEN + ERASE_SCREEN + CURSOR_HOME + (this.altScreenMouseTracking ? ENABLE_MOUSE_TRACKING : ''));
915
+ this.resetFramesForAltScreen();
916
+ }
917
+ /**
918
+ * Seed prev/back frames with full-size BLANK screens (rows×cols of empty
919
+ * cells, not 0×0). In alt-screen mode, next.screen.height is always
920
+ * terminalRows; if prev.screen.height is 0 (emptyFrame's default),
921
+ * log-update sees heightDelta > 0 ('growing') and calls renderFrameSlice,
922
+ * whose trailing per-row CR+LF at the last row scrolls the alt screen,
923
+ * permanently desyncing the virtual and physical cursors by 1 row.
924
+ *
925
+ * With a rows×cols blank prev, heightDelta === 0 → standard diffEach
926
+ * → moveCursorTo (CSI cursorMove, no LF, no scroll).
927
+ *
928
+ * viewport.height = rows + 1 matches the renderer's alt-screen output,
929
+ * preventing a spurious resize trigger on the first frame. cursor.y = 0
930
+ * matches the physical cursor after ENTER_ALT_SCREEN + CSI H (home).
931
+ */
932
+ resetFramesForAltScreen() {
933
+ const rows = this.terminalRows;
934
+ const cols = this.terminalColumns;
935
+ const blank = () => ({
936
+ screen: createScreen(cols, rows, this.stylePool, this.charPool, this.hyperlinkPool),
937
+ viewport: {
938
+ width: cols,
939
+ height: rows + 1
940
+ },
941
+ cursor: {
942
+ x: 0,
943
+ y: 0,
944
+ visible: true
945
+ }
946
+ });
947
+ this.frontFrame = blank();
948
+ this.backFrame = blank();
949
+ this.log.reset();
950
+ // Defense-in-depth: alt-screen skips the cursor preamble anyway (CSI H
951
+ // resets), but a stale displayCursor would be misleading if we later
952
+ // exit to main-screen without an intervening render.
953
+ this.displayCursor = null;
954
+ // Fresh frontFrame is blank rows×cols — blitting from it would copy
955
+ // blanks over content. Next alt-screen frame must full-render.
956
+ this.prevFrameContaminated = true;
957
+ }
958
+ /**
959
+ * Copy the current selection to the clipboard without clearing the
960
+ * highlight. Matches iTerm2's copy-on-select behavior where the selected
961
+ * region stays visible after the automatic copy.
962
+ */
963
+ copySelectionNoClear() {
964
+ if (!hasSelection(this.selection))
965
+ return '';
966
+ const text = getSelectedText(this.selection, this.frontFrame.screen);
967
+ if (text) {
968
+ // Raw OSC 52, or DCS-passthrough-wrapped OSC 52 inside tmux (tmux
969
+ // drops it silently unless allow-passthrough is on — no regression).
970
+ void setClipboard(text).then(raw => {
971
+ if (raw)
972
+ this.options.stdout.write(raw);
973
+ });
974
+ }
975
+ return text;
976
+ }
977
+ /**
978
+ * Copy the current text selection to the system clipboard via OSC 52
979
+ * and clear the selection. Returns the copied text (empty if no selection).
980
+ */
981
+ copySelection() {
982
+ if (!hasSelection(this.selection))
983
+ return '';
984
+ const text = this.copySelectionNoClear();
985
+ clearSelection(this.selection);
986
+ this.notifySelectionChange();
987
+ return text;
988
+ }
989
+ /** Clear the current text selection without copying. */
990
+ clearTextSelection() {
991
+ if (!hasSelection(this.selection))
992
+ return;
993
+ clearSelection(this.selection);
994
+ this.notifySelectionChange();
995
+ }
996
+ /**
997
+ * Set the search highlight query. Non-empty → all visible occurrences
998
+ * are inverted (SGR 7) on the next frame; first one also underlined.
999
+ * Empty → clears (prevFrameContaminated handles the frame after). Same
1000
+ * damage-tracking machinery as selection — setCellStyleId doesn't track
1001
+ * damage, so the overlay forces full-frame damage while active.
1002
+ */
1003
+ setSearchHighlight(query) {
1004
+ if (this.searchHighlightQuery === query)
1005
+ return;
1006
+ this.searchHighlightQuery = query;
1007
+ this.scheduleRender();
1008
+ }
1009
+ /** Paint an EXISTING DOM subtree to a fresh Screen at its natural
1010
+ * height, scan for query. Returns positions relative to the element's
1011
+ * bounding box (row 0 = element top).
1012
+ *
1013
+ * The element comes from the MAIN tree — built with all real
1014
+ * providers, yoga already computed. We paint it to a fresh buffer
1015
+ * with offsets so it lands at (0,0). Same paint path as the main
1016
+ * render. Zero drift. No second React root, no context bridge.
1017
+ *
1018
+ * ~1-2ms (paint only, no reconcile — the DOM is already built). */
1019
+ scanElementSubtree(el) {
1020
+ if (!this.searchHighlightQuery || !el.yogaNode)
1021
+ return [];
1022
+ const width = Math.ceil(el.yogaNode.getComputedWidth());
1023
+ const height = Math.ceil(el.yogaNode.getComputedHeight());
1024
+ if (width <= 0 || height <= 0)
1025
+ return [];
1026
+ // renderNodeToOutput adds el's OWN computedLeft/Top to offsetX/Y.
1027
+ // Passing -elLeft/-elTop nets to 0 → paints at (0,0) in our buffer.
1028
+ const elLeft = el.yogaNode.getComputedLeft();
1029
+ const elTop = el.yogaNode.getComputedTop();
1030
+ const screen = createScreen(width, height, this.stylePool, this.charPool, this.hyperlinkPool);
1031
+ const output = new Output({
1032
+ width,
1033
+ height,
1034
+ stylePool: this.stylePool,
1035
+ screen
1036
+ });
1037
+ renderNodeToOutput(el, output, {
1038
+ offsetX: -elLeft,
1039
+ offsetY: -elTop,
1040
+ prevScreen: undefined
1041
+ });
1042
+ const rendered = output.get();
1043
+ // renderNodeToOutput wrote our offset positions to nodeCache —
1044
+ // corrupts the main render (it'd blit from wrong coords). Mark the
1045
+ // subtree dirty so the next main render repaints + re-caches
1046
+ // correctly. One extra paint of this message, but correct > fast.
1047
+ dom.markDirty(el);
1048
+ const positions = scanPositions(rendered, this.searchHighlightQuery);
1049
+ logForDebugging(`scanElementSubtree: q='${this.searchHighlightQuery}' ` + `el=${width}x${height}@(${elLeft},${elTop}) n=${positions.length} ` + `[${positions.slice(0, 10).map(p => `${p.row}:${p.col}`).join(',')}` + `${positions.length > 10 ? ',…' : ''}]`);
1050
+ return positions;
1051
+ }
1052
+ /** Set the position-based highlight state. Every frame, writes CURRENT
1053
+ * style at positions[currentIdx] + rowOffset. null clears. The scan-
1054
+ * highlight (inverse on all matches) still runs — this overlays yellow
1055
+ * on top. rowOffset changes as the user scrolls (= message's current
1056
+ * screen-top); positions stay stable (message-relative). */
1057
+ setSearchPositions(state) {
1058
+ this.searchPositions = state;
1059
+ this.scheduleRender();
1060
+ }
1061
+ /**
1062
+ * Set the selection highlight background color. Replaces the per-cell
1063
+ * SGR-7 inverse with a solid theme-aware bg (matches native terminal
1064
+ * selection). Accepts the same color formats as Text backgroundColor
1065
+ * (rgb(), ansi:name, #hex, ansi256()) — colorize() routes through
1066
+ * chalk so the tmux/xterm.js level clamps in colorize.ts apply and
1067
+ * the emitted SGR is correct for the current terminal.
1068
+ *
1069
+ * Called by React-land once theme is known (ScrollKeybindingHandler's
1070
+ * useEffect watching useTheme). Before that call, withSelectionBg
1071
+ * falls back to withInverse so selection still renders on the first
1072
+ * frame; the effect fires before any mouse input so the fallback is
1073
+ * unobservable in practice.
1074
+ */
1075
+ setSelectionBgColor(color) {
1076
+ // Wrap a NUL marker, then split on it to extract the open/close SGR.
1077
+ // colorize returns the input unchanged if the color string is bad —
1078
+ // no NUL-split then, so fall through to null (inverse fallback).
1079
+ const wrapped = colorize('\0', color, 'background');
1080
+ const nul = wrapped.indexOf('\0');
1081
+ if (nul <= 0 || nul === wrapped.length - 1) {
1082
+ this.stylePool.setSelectionBg(null);
1083
+ return;
1084
+ }
1085
+ this.stylePool.setSelectionBg({
1086
+ type: 'ansi',
1087
+ code: wrapped.slice(0, nul),
1088
+ endCode: wrapped.slice(nul + 1) // always \x1b[49m for bg
1089
+ });
1090
+ // No scheduleRender: this is called from a React effect that already
1091
+ // runs inside the render cycle, and the bg only matters once a
1092
+ // selection exists (which itself triggers a full-damage frame).
1093
+ }
1094
+ /**
1095
+ * Capture text from rows about to scroll out of the viewport during
1096
+ * drag-to-scroll. Must be called BEFORE the ScrollBox scrolls so the
1097
+ * screen buffer still holds the outgoing content. Accumulated into
1098
+ * the selection state and joined back in by getSelectedText.
1099
+ */
1100
+ captureScrolledRows(firstRow, lastRow, side) {
1101
+ captureScrolledRows(this.selection, this.frontFrame.screen, firstRow, lastRow, side);
1102
+ }
1103
+ /**
1104
+ * Shift anchor AND focus by dRow, clamped to [minRow, maxRow]. Used by
1105
+ * keyboard scroll handlers (PgUp/PgDn etc.) so the highlight tracks the
1106
+ * content instead of disappearing. Unlike shiftAnchor (drag-to-scroll),
1107
+ * this moves BOTH endpoints — the user isn't holding the mouse at one
1108
+ * edge. Supplies screen.width for the col-reset-on-clamp boundary.
1109
+ */
1110
+ shiftSelectionForScroll(dRow, minRow, maxRow) {
1111
+ const hadSel = hasSelection(this.selection);
1112
+ shiftSelection(this.selection, dRow, minRow, maxRow, this.frontFrame.screen.width);
1113
+ // shiftSelection clears when both endpoints overshoot the same edge
1114
+ // (Home/g/End/G page-jump past the selection). Notify subscribers so
1115
+ // useHasSelection updates. Safe to call notifySelectionChange here —
1116
+ // this runs from keyboard handlers, not inside onRender().
1117
+ if (hadSel && !hasSelection(this.selection)) {
1118
+ this.notifySelectionChange();
1119
+ }
1120
+ }
1121
+ /**
1122
+ * Keyboard selection extension (shift+arrow/home/end). Moves focus;
1123
+ * anchor stays fixed so the highlight grows or shrinks relative to it.
1124
+ * Left/right wrap across row boundaries — native macOS text-edit
1125
+ * behavior: shift+left at col 0 wraps to end of the previous row.
1126
+ * Up/down clamp at viewport edges (no scroll-to-extend yet). Drops to
1127
+ * char mode. No-op outside alt-screen or without an active selection.
1128
+ */
1129
+ moveSelectionFocus(move) {
1130
+ if (!this.altScreenActive)
1131
+ return;
1132
+ const { focus } = this.selection;
1133
+ if (!focus)
1134
+ return;
1135
+ const { width, height } = this.frontFrame.screen;
1136
+ const maxCol = width - 1;
1137
+ const maxRow = height - 1;
1138
+ let { col, row } = focus;
1139
+ switch (move) {
1140
+ case 'left':
1141
+ if (col > 0)
1142
+ col--;
1143
+ else if (row > 0) {
1144
+ col = maxCol;
1145
+ row--;
1146
+ }
1147
+ break;
1148
+ case 'right':
1149
+ if (col < maxCol)
1150
+ col++;
1151
+ else if (row < maxRow) {
1152
+ col = 0;
1153
+ row++;
1154
+ }
1155
+ break;
1156
+ case 'up':
1157
+ if (row > 0)
1158
+ row--;
1159
+ break;
1160
+ case 'down':
1161
+ if (row < maxRow)
1162
+ row++;
1163
+ break;
1164
+ case 'lineStart':
1165
+ col = 0;
1166
+ break;
1167
+ case 'lineEnd':
1168
+ col = maxCol;
1169
+ break;
1170
+ }
1171
+ if (col === focus.col && row === focus.row)
1172
+ return;
1173
+ moveFocus(this.selection, col, row);
1174
+ this.notifySelectionChange();
1175
+ }
1176
+ /** Whether there is an active text selection. */
1177
+ hasTextSelection() {
1178
+ return hasSelection(this.selection);
1179
+ }
1180
+ /**
1181
+ * Subscribe to selection state changes. Fires whenever the selection
1182
+ * is started, updated, cleared, or copied. Returns an unsubscribe fn.
1183
+ */
1184
+ subscribeToSelectionChange(cb) {
1185
+ this.selectionListeners.add(cb);
1186
+ return () => this.selectionListeners.delete(cb);
1187
+ }
1188
+ notifySelectionChange() {
1189
+ this.onRender();
1190
+ for (const cb of this.selectionListeners)
1191
+ cb();
1192
+ }
1193
+ /**
1194
+ * Hit-test the rendered DOM tree at (col, row) and bubble a ClickEvent
1195
+ * from the deepest hit node up through ancestors with onClick handlers.
1196
+ * Returns true if a DOM handler consumed the click. Gated on
1197
+ * altScreenActive — clicks only make sense with a fixed viewport where
1198
+ * nodeCache rects map 1:1 to terminal cells (no scrollback offset).
1199
+ */
1200
+ dispatchClick(col, row) {
1201
+ if (!this.altScreenActive)
1202
+ return false;
1203
+ const blank = isEmptyCellAt(this.frontFrame.screen, col, row);
1204
+ return dispatchClick(this.rootNode, col, row, blank);
1205
+ }
1206
+ dispatchHover(col, row) {
1207
+ if (!this.altScreenActive)
1208
+ return;
1209
+ dispatchHover(this.rootNode, col, row, this.hoveredNodes);
1210
+ }
1211
+ dispatchKeyboardEvent(parsedKey) {
1212
+ const target = this.focusManager.activeElement ?? this.rootNode;
1213
+ const event = new KeyboardEvent(parsedKey);
1214
+ dispatcher.dispatchDiscrete(target, event);
1215
+ // Tab cycling is the default action — only fires if no handler
1216
+ // called preventDefault(). Mirrors browser behavior.
1217
+ if (!event.defaultPrevented && parsedKey.name === 'tab' && !parsedKey.ctrl && !parsedKey.meta) {
1218
+ if (parsedKey.shift) {
1219
+ this.focusManager.focusPrevious(this.rootNode);
1220
+ }
1221
+ else {
1222
+ this.focusManager.focusNext(this.rootNode);
1223
+ }
1224
+ }
1225
+ }
1226
+ /**
1227
+ * Look up the URL at (col, row) in the current front frame. Checks for
1228
+ * an OSC 8 hyperlink first, then falls back to scanning the row for a
1229
+ * plain-text URL (mouse tracking intercepts the terminal's native
1230
+ * Cmd+Click URL detection, so we replicate it). This is a pure lookup
1231
+ * with no side effects — call it synchronously at click time so the
1232
+ * result reflects the screen the user actually clicked on, then defer
1233
+ * the browser-open action via a timer.
1234
+ */
1235
+ getHyperlinkAt(col, row) {
1236
+ if (!this.altScreenActive)
1237
+ return undefined;
1238
+ const screen = this.frontFrame.screen;
1239
+ const cell = cellAt(screen, col, row);
1240
+ let url = cell?.hyperlink;
1241
+ // SpacerTail cells (right half of wide/CJK/emoji chars) store the
1242
+ // hyperlink on the head cell at col-1.
1243
+ if (!url && cell?.width === 2 /* CellWidth.SpacerTail */ && col > 0) {
1244
+ url = cellAt(screen, col - 1, row)?.hyperlink;
1245
+ }
1246
+ return url ?? findPlainTextUrlAt(screen, col, row);
1247
+ }
1248
+ /**
1249
+ * Optional callback fired when clicking an OSC 8 hyperlink in fullscreen
1250
+ * mode. Set by FullscreenLayout via useLayoutEffect.
1251
+ */
1252
+ onHyperlinkClick;
1253
+ /**
1254
+ * Stable prototype wrapper for onHyperlinkClick. Passed to <App> as
1255
+ * onOpenHyperlink so the prop is a bound method (autoBind'd) that reads
1256
+ * the mutable field at call time — not the undefined-at-render value.
1257
+ */
1258
+ openHyperlink(url) {
1259
+ this.onHyperlinkClick?.(url);
1260
+ }
1261
+ /**
1262
+ * Handle a double- or triple-click at (col, row): select the word or
1263
+ * line under the cursor by reading the current screen buffer. Called on
1264
+ * PRESS (not release) so the highlight appears immediately and drag can
1265
+ * extend the selection word-by-word / line-by-line. Falls back to
1266
+ * char-mode startSelection if the click lands on a noSelect cell.
1267
+ */
1268
+ handleMultiClick(col, row, count) {
1269
+ if (!this.altScreenActive)
1270
+ return;
1271
+ const screen = this.frontFrame.screen;
1272
+ // selectWordAt/selectLineAt no-op on noSelect/out-of-bounds. Seed with
1273
+ // a char-mode selection so the press still starts a drag even if the
1274
+ // word/line scan finds nothing selectable.
1275
+ startSelection(this.selection, col, row);
1276
+ if (count === 2)
1277
+ selectWordAt(this.selection, screen, col, row);
1278
+ else
1279
+ selectLineAt(this.selection, screen, row);
1280
+ // Ensure hasSelection is true so release doesn't re-dispatch onClickAt.
1281
+ // selectWordAt no-ops on noSelect; selectLineAt no-ops out-of-bounds.
1282
+ if (!this.selection.focus)
1283
+ this.selection.focus = this.selection.anchor;
1284
+ this.notifySelectionChange();
1285
+ }
1286
+ /**
1287
+ * Handle a drag-motion at (col, row). In char mode updates focus to the
1288
+ * exact cell. In word/line mode snaps to word/line boundaries so the
1289
+ * selection extends by word/line like native macOS. Gated on
1290
+ * altScreenActive for the same reason as dispatchClick.
1291
+ */
1292
+ handleSelectionDrag(col, row) {
1293
+ if (!this.altScreenActive)
1294
+ return;
1295
+ const sel = this.selection;
1296
+ if (sel.anchorSpan) {
1297
+ extendSelection(sel, this.frontFrame.screen, col, row);
1298
+ }
1299
+ else {
1300
+ updateSelection(sel, col, row);
1301
+ }
1302
+ this.notifySelectionChange();
1303
+ }
1304
+ // Methods to properly suspend stdin for external editor usage
1305
+ // This is needed to prevent Ink from swallowing keystrokes when an external editor is active
1306
+ stdinListeners = [];
1307
+ wasRawMode = false;
1308
+ suspendStdin() {
1309
+ const stdin = this.options.stdin;
1310
+ if (!stdin.isTTY) {
1311
+ return;
1312
+ }
1313
+ // Store and remove all 'readable' event listeners temporarily
1314
+ // This prevents Ink from consuming stdin while the editor is active
1315
+ const readableListeners = stdin.listeners('readable');
1316
+ logForDebugging(`[stdin] suspendStdin: removing ${readableListeners.length} readable listener(s), wasRawMode=${stdin.isRaw ?? false}`);
1317
+ readableListeners.forEach(listener => {
1318
+ this.stdinListeners.push({
1319
+ event: 'readable',
1320
+ listener: listener
1321
+ });
1322
+ stdin.removeListener('readable', listener);
1323
+ });
1324
+ // If raw mode is enabled, disable it temporarily
1325
+ const stdinWithRaw = stdin;
1326
+ if (stdinWithRaw.isRaw && stdinWithRaw.setRawMode) {
1327
+ stdinWithRaw.setRawMode(false);
1328
+ this.wasRawMode = true;
1329
+ }
1330
+ }
1331
+ resumeStdin() {
1332
+ const stdin = this.options.stdin;
1333
+ if (!stdin.isTTY) {
1334
+ return;
1335
+ }
1336
+ // Re-attach all the stored listeners
1337
+ if (this.stdinListeners.length === 0 && !this.wasRawMode) {
1338
+ logForDebugging('[stdin] resumeStdin: called with no stored listeners and wasRawMode=false (possible desync)', {
1339
+ level: 'warn'
1340
+ });
1341
+ }
1342
+ logForDebugging(`[stdin] resumeStdin: re-attaching ${this.stdinListeners.length} listener(s), wasRawMode=${this.wasRawMode}`);
1343
+ this.stdinListeners.forEach(({ event, listener }) => {
1344
+ stdin.addListener(event, listener);
1345
+ });
1346
+ this.stdinListeners = [];
1347
+ // Re-enable raw mode if it was enabled before
1348
+ if (this.wasRawMode) {
1349
+ const stdinWithRaw = stdin;
1350
+ if (stdinWithRaw.setRawMode) {
1351
+ stdinWithRaw.setRawMode(true);
1352
+ }
1353
+ this.wasRawMode = false;
1354
+ }
1355
+ }
1356
+ // Stable identity for TerminalWriteContext. An inline arrow here would
1357
+ // change on every render() call (initial mount + each resize), which
1358
+ // cascades through useContext → <AlternateScreen>'s useLayoutEffect dep
1359
+ // array → spurious exit+re-enter of the alt screen on every SIGWINCH.
1360
+ writeRaw(data) {
1361
+ this.options.stdout.write(data);
1362
+ }
1363
+ setCursorDeclaration = (decl, clearIfNode) => {
1364
+ if (decl === null && clearIfNode !== undefined && this.cursorDeclaration?.node !== clearIfNode) {
1365
+ return;
1366
+ }
1367
+ this.cursorDeclaration = decl;
1368
+ };
1369
+ render(node) {
1370
+ this.currentNode = node;
1371
+ const tree = _jsx(App, { stdin: this.options.stdin, stdout: this.options.stdout, stderr: this.options.stderr, exitOnCtrlC: this.options.exitOnCtrlC, onExit: this.unmount, terminalColumns: this.terminalColumns, terminalRows: this.terminalRows, selection: this.selection, onSelectionChange: this.notifySelectionChange, onClickAt: this.dispatchClick, onHoverAt: this.dispatchHover, getHyperlinkAt: this.getHyperlinkAt, onOpenHyperlink: this.openHyperlink, onMultiClick: this.handleMultiClick, onSelectionDrag: this.handleSelectionDrag, onStdinResume: this.reassertTerminalModes, onCursorDeclaration: this.setCursorDeclaration, dispatchKeyboardEvent: this.dispatchKeyboardEvent, children: _jsx(TerminalWriteProvider, { value: this.writeRaw, children: node }) });
1372
+ // @ts-expect-error updateContainerSync exists in react-reconciler but not in @types/react-reconciler
1373
+ reconciler.updateContainerSync(tree, this.container, null, noop);
1374
+ // @ts-expect-error flushSyncWork exists in react-reconciler but not in @types/react-reconciler
1375
+ reconciler.flushSyncWork();
1376
+ }
1377
+ unmount(error) {
1378
+ if (this.isUnmounted) {
1379
+ return;
1380
+ }
1381
+ this.onRender();
1382
+ this.unsubscribeExit();
1383
+ if (typeof this.restoreConsole === 'function') {
1384
+ this.restoreConsole();
1385
+ }
1386
+ this.restoreStderr?.();
1387
+ this.unsubscribeTTYHandlers?.();
1388
+ // Non-TTY environments don't handle erasing ansi escapes well, so it's better to
1389
+ // only render last frame of non-static output
1390
+ const diff = this.log.renderPreviousOutput_DEPRECATED(this.frontFrame);
1391
+ writeDiffToTerminal(this.terminal, optimize(diff));
1392
+ // Clean up terminal modes synchronously before process exit.
1393
+ // React's componentWillUnmount won't run in time when process.exit() is called,
1394
+ // so we must reset terminal modes here to prevent escape sequence leakage.
1395
+ // Use writeSync to stdout (fd 1) to ensure writes complete before exit.
1396
+ // We unconditionally send all disable sequences because terminal detection
1397
+ // may not work correctly (e.g., in tmux, screen) and these are no-ops on
1398
+ // terminals that don't support them.
1399
+ /* eslint-disable custom-rules/no-sync-fs -- process exiting; async writes would be dropped */
1400
+ if (this.options.stdout.isTTY) {
1401
+ if (this.altScreenActive) {
1402
+ // <AlternateScreen>'s unmount effect won't run during signal-exit.
1403
+ // Exit alt screen FIRST so other cleanup sequences go to the main screen.
1404
+ writeSync(1, EXIT_ALT_SCREEN);
1405
+ }
1406
+ // Disable mouse tracking — unconditional because altScreenActive can be
1407
+ // stale if AlternateScreen's unmount (which flips the flag) raced a
1408
+ // blocked event loop + SIGINT. No-op if tracking was never enabled.
1409
+ writeSync(1, DISABLE_MOUSE_TRACKING);
1410
+ // Drain stdin so in-flight mouse events don't leak to the shell
1411
+ this.drainStdin();
1412
+ // Disable extended key reporting (both kitty and modifyOtherKeys)
1413
+ writeSync(1, DISABLE_MODIFY_OTHER_KEYS);
1414
+ writeSync(1, DISABLE_KITTY_KEYBOARD);
1415
+ // Disable focus events (DECSET 1004)
1416
+ writeSync(1, DFE);
1417
+ // Disable bracketed paste mode
1418
+ writeSync(1, DBP);
1419
+ // Show cursor
1420
+ writeSync(1, SHOW_CURSOR);
1421
+ // Clear iTerm2 progress bar
1422
+ writeSync(1, CLEAR_ITERM2_PROGRESS);
1423
+ // Clear tab status (OSC 21337) so a stale dot doesn't linger
1424
+ if (supportsTabStatus())
1425
+ writeSync(1, wrapForMultiplexer(CLEAR_TAB_STATUS));
1426
+ }
1427
+ /* eslint-enable custom-rules/no-sync-fs */
1428
+ this.isUnmounted = true;
1429
+ // Cancel any pending throttled renders to prevent accessing freed Yoga nodes
1430
+ this.scheduleRender.cancel?.();
1431
+ if (this.drainTimer !== null) {
1432
+ clearTimeout(this.drainTimer);
1433
+ this.drainTimer = null;
1434
+ }
1435
+ // @ts-expect-error updateContainerSync exists in react-reconciler but not in @types/react-reconciler
1436
+ reconciler.updateContainerSync(null, this.container, null, noop);
1437
+ // @ts-expect-error flushSyncWork exists in react-reconciler but not in @types/react-reconciler
1438
+ reconciler.flushSyncWork();
1439
+ instances.delete(this.options.stdout);
1440
+ // Free the root yoga node, then clear its reference. Children are already
1441
+ // freed by the reconciler's removeChildFromContainer; using .free() (not
1442
+ // .freeRecursive()) avoids double-freeing them.
1443
+ this.rootNode.yogaNode?.free();
1444
+ this.rootNode.yogaNode = undefined;
1445
+ if (error instanceof Error) {
1446
+ this.rejectExitPromise(error);
1447
+ }
1448
+ else {
1449
+ this.resolveExitPromise();
1450
+ }
1451
+ }
1452
+ async waitUntilExit() {
1453
+ this.exitPromise ||= new Promise((resolve, reject) => {
1454
+ this.resolveExitPromise = resolve;
1455
+ this.rejectExitPromise = reject;
1456
+ });
1457
+ return this.exitPromise;
1458
+ }
1459
+ resetLineCount() {
1460
+ if (this.options.stdout.isTTY) {
1461
+ // Swap so old front becomes back (for screen reuse), then reset front
1462
+ this.backFrame = this.frontFrame;
1463
+ this.frontFrame = emptyFrame(this.frontFrame.viewport.height, this.frontFrame.viewport.width, this.stylePool, this.charPool, this.hyperlinkPool);
1464
+ this.log.reset();
1465
+ // frontFrame is reset, so frame.cursor on the next render is (0,0).
1466
+ // Clear displayCursor so the preamble doesn't compute a stale delta.
1467
+ this.displayCursor = null;
1468
+ }
1469
+ }
1470
+ /**
1471
+ * Replace char/hyperlink pools with fresh instances to prevent unbounded
1472
+ * growth during long sessions. Migrates the front frame's screen IDs into
1473
+ * the new pools so diffing remains correct. The back frame doesn't need
1474
+ * migration — resetScreen zeros it before any reads.
1475
+ *
1476
+ * Call between conversation turns or periodically.
1477
+ */
1478
+ resetPools() {
1479
+ this.charPool = new CharPool();
1480
+ this.hyperlinkPool = new HyperlinkPool();
1481
+ migrateScreenPools(this.frontFrame.screen, this.charPool, this.hyperlinkPool);
1482
+ // Back frame's data is zeroed by resetScreen before reads, but its pool
1483
+ // references are used by the renderer to intern new characters. Point
1484
+ // them at the new pools so the next frame's IDs are comparable.
1485
+ this.backFrame.screen.charPool = this.charPool;
1486
+ this.backFrame.screen.hyperlinkPool = this.hyperlinkPool;
1487
+ }
1488
+ patchConsole() {
1489
+ // biome-ignore lint/suspicious/noConsole: intentionally patching global console
1490
+ const con = console;
1491
+ const originals = {};
1492
+ const toDebug = (...args) => logForDebugging(`console.log: ${format(...args)}`);
1493
+ const toError = (...args) => logError(new Error(`console.error: ${format(...args)}`));
1494
+ for (const m of CONSOLE_STDOUT_METHODS) {
1495
+ originals[m] = con[m];
1496
+ con[m] = toDebug;
1497
+ }
1498
+ for (const m of CONSOLE_STDERR_METHODS) {
1499
+ originals[m] = con[m];
1500
+ con[m] = toError;
1501
+ }
1502
+ originals.assert = con.assert;
1503
+ con.assert = (condition, ...args) => {
1504
+ if (!condition)
1505
+ toError(...args);
1506
+ };
1507
+ return () => Object.assign(con, originals);
1508
+ }
1509
+ /**
1510
+ * Intercept process.stderr.write so stray writes (config.ts, hooks.ts,
1511
+ * third-party deps) don't corrupt the alt-screen buffer. patchConsole only
1512
+ * hooks console.* methods — direct stderr writes bypass it, land at the
1513
+ * parked cursor, scroll the alt-screen, and desync frontFrame from the
1514
+ * physical terminal. Next diff writes only changed-in-React cells at
1515
+ * absolute coords → interleaved garbage.
1516
+ *
1517
+ * Swallows the write (routes text to the debug log) and, in alt-screen,
1518
+ * forces a full-damage repaint as a defensive recovery. Not patching
1519
+ * process.stdout — Ink itself writes there.
1520
+ */
1521
+ patchStderr() {
1522
+ const stderr = process.stderr;
1523
+ const originalWrite = stderr.write;
1524
+ let reentered = false;
1525
+ const intercept = (chunk, encodingOrCb, cb) => {
1526
+ const callback = typeof encodingOrCb === 'function' ? encodingOrCb : cb;
1527
+ // Reentrancy guard: logForDebugging → writeToStderr → here. Pass
1528
+ // through to the original so --debug-to-stderr still works and we
1529
+ // don't stack-overflow.
1530
+ if (reentered) {
1531
+ const encoding = typeof encodingOrCb === 'string' ? encodingOrCb : undefined;
1532
+ return originalWrite.call(stderr, chunk, encoding, callback);
1533
+ }
1534
+ reentered = true;
1535
+ try {
1536
+ const text = typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString('utf8');
1537
+ logForDebugging(`[stderr] ${text}`, {
1538
+ level: 'warn'
1539
+ });
1540
+ if (this.altScreenActive && !this.isUnmounted && !this.isPaused) {
1541
+ this.prevFrameContaminated = true;
1542
+ this.scheduleRender();
1543
+ }
1544
+ }
1545
+ finally {
1546
+ reentered = false;
1547
+ callback?.();
1548
+ }
1549
+ return true;
1550
+ };
1551
+ stderr.write = intercept;
1552
+ return () => {
1553
+ if (stderr.write === intercept) {
1554
+ stderr.write = originalWrite;
1555
+ }
1556
+ };
1557
+ }
1558
+ }
1559
+ /**
1560
+ * Discard pending stdin bytes so in-flight escape sequences (mouse tracking
1561
+ * reports, bracketed-paste markers) don't leak to the shell after exit.
1562
+ *
1563
+ * Two layers of trickiness:
1564
+ *
1565
+ * 1. setRawMode is termios, not fcntl — the stdin fd stays blocking, so
1566
+ * readSync on it would hang forever. Node doesn't expose fcntl, so we
1567
+ * open /dev/tty fresh with O_NONBLOCK (all fds to the controlling
1568
+ * terminal share one line-discipline input queue).
1569
+ *
1570
+ * 2. By the time forceExit calls this, detachForShutdown has already put
1571
+ * the TTY back in cooked (canonical) mode. Canonical mode line-buffers
1572
+ * input until newline, so O_NONBLOCK reads return EAGAIN even when
1573
+ * mouse bytes are sitting in the buffer. We briefly re-enter raw mode
1574
+ * so reads return any available bytes, then restore cooked mode.
1575
+ *
1576
+ * Safe to call multiple times. Call as LATE as possible in the exit path:
1577
+ * DISABLE_MOUSE_TRACKING has terminal round-trip latency, so events can
1578
+ * arrive for a few ms after it's written.
1579
+ */
1580
+ /* eslint-disable custom-rules/no-sync-fs -- must be sync; called from signal handler / unmount */
1581
+ export function drainStdin(stdin = process.stdin) {
1582
+ if (!stdin.isTTY)
1583
+ return;
1584
+ // Drain Node's stream buffer (bytes libuv already pulled in). read()
1585
+ // returns null when empty — never blocks.
1586
+ try {
1587
+ while (stdin.read() !== null) {
1588
+ /* discard */
1589
+ }
1590
+ }
1591
+ catch {
1592
+ /* stream may be destroyed */
1593
+ }
1594
+ // No /dev/tty on Windows; CONIN$ doesn't support O_NONBLOCK semantics.
1595
+ // Windows Terminal also doesn't buffer mouse reports the same way.
1596
+ if (process.platform === 'win32')
1597
+ return;
1598
+ // termios is per-device: flip stdin to raw so canonical-mode line
1599
+ // buffering doesn't hide partial input from the non-blocking read.
1600
+ // Restored in the finally block.
1601
+ const tty = stdin;
1602
+ const wasRaw = tty.isRaw === true;
1603
+ // Drain the kernel TTY buffer via a fresh O_NONBLOCK fd. Bounded at 64
1604
+ // reads (64KB) — a real mouse burst is a few hundred bytes; the cap
1605
+ // guards against a terminal that ignores O_NONBLOCK.
1606
+ let fd = -1;
1607
+ try {
1608
+ // setRawMode inside try: on revoked TTY (SIGHUP/SSH disconnect) the
1609
+ // ioctl throws EBADF — same recovery path as openSync/readSync below.
1610
+ if (!wasRaw)
1611
+ tty.setRawMode?.(true);
1612
+ fd = openSync('/dev/tty', fsConstants.O_RDONLY | fsConstants.O_NONBLOCK);
1613
+ const buf = Buffer.alloc(1024);
1614
+ for (let i = 0; i < 64; i++) {
1615
+ if (readSync(fd, buf, 0, buf.length, null) <= 0)
1616
+ break;
1617
+ }
1618
+ }
1619
+ catch {
1620
+ // EAGAIN (buffer empty — expected), ENXIO/ENOENT (no controlling tty),
1621
+ // EBADF/EIO (TTY revoked — SIGHUP, SSH disconnect)
1622
+ }
1623
+ finally {
1624
+ if (fd >= 0) {
1625
+ try {
1626
+ closeSync(fd);
1627
+ }
1628
+ catch {
1629
+ /* ignore */
1630
+ }
1631
+ }
1632
+ if (!wasRaw) {
1633
+ try {
1634
+ tty.setRawMode?.(false);
1635
+ }
1636
+ catch {
1637
+ /* TTY may be gone */
1638
+ }
1639
+ }
1640
+ }
1641
+ }
1642
+ /* eslint-enable custom-rules/no-sync-fs */
1643
+ const CONSOLE_STDOUT_METHODS = ['log', 'info', 'debug', 'dir', 'dirxml', 'count', 'countReset', 'group', 'groupCollapsed', 'groupEnd', 'table', 'time', 'timeEnd', 'timeLog'];
1644
+ const CONSOLE_STDERR_METHODS = ['warn', 'error', 'trace'];