@iaforged/context-code 2.1.7 → 2.2.4

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 (411) hide show
  1. package/dist/src/Task.js +1 -1
  2. package/dist/src/commands/login/login.js +1 -1
  3. package/dist/src/components/ConsoleOAuthFlow.js +1 -1
  4. package/dist/src/constants/oauth.js +1 -1
  5. package/dist/src/context/mailbox.js +1 -1
  6. package/dist/src/context/voice.js +1 -1
  7. package/dist/src/hooks/useTerminalSize.js +1 -1
  8. package/dist/src/ink/Ansi.js +1 -1
  9. package/dist/src/ink/clearTerminal.js +1 -1
  10. package/dist/src/ink/colorize.js +1 -1
  11. package/dist/src/ink/components/App.js +1 -1
  12. package/dist/src/ink/components/Button.js +1 -1
  13. package/dist/src/ink/components/ClockContext.js +1 -1
  14. package/dist/src/ink/components/CursorDeclarationContext.js +1 -1
  15. package/dist/src/ink/components/Link.js +1 -1
  16. package/dist/src/ink/components/StdinContext.js +1 -1
  17. package/dist/src/ink/components/TerminalFocusContext.js +1 -1
  18. package/dist/src/ink/dom.js +1 -1
  19. package/dist/src/ink/events/keyboard-event.js +1 -1
  20. package/dist/src/ink/hit-test.js +1 -1
  21. package/dist/src/ink/hooks/use-animation-frame.js +1 -1
  22. package/dist/src/ink/hooks/use-app.js +1 -1
  23. package/dist/src/ink/hooks/use-input.js +1 -1
  24. package/dist/src/ink/hooks/use-interval.js +1 -1
  25. package/dist/src/ink/hooks/use-selection.js +1 -1
  26. package/dist/src/ink/hooks/use-tab-status.js +1 -1
  27. package/dist/src/ink/hooks/use-terminal-focus.js +1 -1
  28. package/dist/src/ink/hooks/use-terminal-title.js +1 -1
  29. package/dist/src/ink/hooks/use-terminal-viewport.js +1 -1
  30. package/dist/src/ink/ink.js +1 -1
  31. package/dist/src/ink/layout/yoga.js +1 -1
  32. package/dist/src/ink/line-width-cache.js +1 -1
  33. package/dist/src/ink/log-update.js +1 -1
  34. package/dist/src/ink/measure-text.js +1 -1
  35. package/dist/src/ink/output.js +1 -1
  36. package/dist/src/ink/parse-keypress.js +1 -1
  37. package/dist/src/ink/reconciler.js +1 -1
  38. package/dist/src/ink/render-border.js +1 -1
  39. package/dist/src/ink/render-node-to-output.js +1 -1
  40. package/dist/src/ink/render-to-screen.js +1 -1
  41. package/dist/src/ink/renderer.js +1 -1
  42. package/dist/src/ink/root.js +1 -1
  43. package/dist/src/ink/screen.js +1 -1
  44. package/dist/src/ink/searchHighlight.js +1 -1
  45. package/dist/src/ink/selection.js +1 -1
  46. package/dist/src/ink/squash-text-nodes.js +1 -1
  47. package/dist/src/ink/stringWidth.js +1 -1
  48. package/dist/src/ink/tabstops.js +1 -1
  49. package/dist/src/ink/terminal.js +1 -1
  50. package/dist/src/ink/termio/osc.js +1 -1
  51. package/dist/src/ink/termio/parser.js +1 -1
  52. package/dist/src/ink/termio/tokenize.js +1 -1
  53. package/dist/src/ink/useTerminalNotification.js +1 -1
  54. package/dist/src/ink/warn.js +1 -1
  55. package/dist/src/ink/widest-line.js +1 -1
  56. package/dist/src/ink/wrap-text.js +1 -1
  57. package/dist/src/ink/wrapAnsi.js +1 -1
  58. package/dist/src/native-ts/yoga-layout/index.js +1 -1
  59. package/dist/src/schemas/hooks.js +1 -1
  60. package/dist/src/services/SessionMemory/sessionMemoryUtils.js +1 -1
  61. package/dist/src/services/api/client.js +1 -1
  62. package/dist/src/services/api/dumpPrompts.js +1 -1
  63. package/dist/src/services/api/errorUtils.js +1 -1
  64. package/dist/src/services/api/promptCacheBreakDetection.js +1 -1
  65. package/dist/src/services/api/withRetry.js +1 -1
  66. package/dist/src/services/autoDream/consolidationLock.js +1 -1
  67. package/dist/src/services/mcp/elicitationHandler.js +1 -1
  68. package/dist/src/services/mcp/mcpStringUtils.js +1 -1
  69. package/dist/src/services/mcp/oauthPort.js +1 -1
  70. package/dist/src/services/mcp/vscodeSdkMcp.js +1 -1
  71. package/dist/src/services/oauth/client.js +1 -1
  72. package/dist/src/services/oauth/getOauthProfile.js +1 -1
  73. package/dist/src/services/objetivo/types.js +1 -1
  74. package/dist/src/services/rateLimitMocking.js +1 -1
  75. package/dist/src/services/remoteManagedSettings/syncCacheState.js +1 -1
  76. package/dist/src/skills/bundledSkills.js +1 -1
  77. package/dist/src/tasks/DreamTask/DreamTask.js +1 -1
  78. package/dist/src/tools/AgentTool/agentMemory.js +1 -1
  79. package/dist/src/tools/AgentTool/forkSubagent.js +1 -1
  80. package/dist/src/tools/BashTool/BashToolResultMessage.js +1 -1
  81. package/dist/src/tools/BashTool/UI.js +1 -1
  82. package/dist/src/tools/BashTool/sedEditParser.js +1 -1
  83. package/dist/src/tools/BashTool/utils.js +1 -1
  84. package/dist/src/tools/FileReadTool/imageProcessor.js +1 -1
  85. package/dist/src/tools/FileReadTool/prompt.js +1 -1
  86. package/dist/src/tools/ListMcpResourcesTool/ListMcpResourcesTool.js +1 -1
  87. package/dist/src/tools/ListMcpResourcesTool/UI.js +1 -1
  88. package/dist/src/tools/MCPTool/MCPTool.js +1 -1
  89. package/dist/src/tools/MCPTool/UI.js +1 -1
  90. package/dist/src/tools/McpAuthTool/McpAuthTool.js +1 -1
  91. package/dist/src/tools/NotebookEditTool/prompt.js +1 -1
  92. package/dist/src/tools/PowerShellTool/PowerShellTool.js +1 -1
  93. package/dist/src/tools/PowerShellTool/UI.js +1 -1
  94. package/dist/src/tools/PowerShellTool/gitSafety.js +1 -1
  95. package/dist/src/tools/PowerShellTool/modeValidation.js +1 -1
  96. package/dist/src/tools/PowerShellTool/pathValidation.js +1 -1
  97. package/dist/src/tools/PowerShellTool/powershellPermissions.js +1 -1
  98. package/dist/src/tools/PowerShellTool/powershellSecurity.js +1 -1
  99. package/dist/src/tools/PowerShellTool/prompt.js +1 -1
  100. package/dist/src/tools/PowerShellTool/readOnlyValidation.js +1 -1
  101. package/dist/src/tools/REPLTool/constants.js +1 -1
  102. package/dist/src/tools/REPLTool/primitiveTools.js +1 -1
  103. package/dist/src/tools/ReadMcpResourceTool/ReadMcpResourceTool.js +1 -1
  104. package/dist/src/tools/ReadMcpResourceTool/UI.js +1 -1
  105. package/dist/src/tools/ScheduleCronTool/prompt.js +1 -1
  106. package/dist/src/tools/SkillTool/prompt.js +1 -1
  107. package/dist/src/tools/TodoWriteTool/TodoWriteTool.js +1 -1
  108. package/dist/src/tools/ToolSearchTool/prompt.js +1 -1
  109. package/dist/src/tools/WebSearchTool/prompt.js +1 -1
  110. package/dist/src/tools/shared/gitOperationTracking.js +1 -1
  111. package/dist/src/types/permissions.js +1 -1
  112. package/dist/src/utils/Cursor.js +1 -1
  113. package/dist/src/utils/QueryGuard.js +1 -1
  114. package/dist/src/utils/Shell.js +1 -1
  115. package/dist/src/utils/ShellCommand.js +1 -1
  116. package/dist/src/utils/activityManager.js +1 -1
  117. package/dist/src/utils/advisor.js +1 -1
  118. package/dist/src/utils/appleTerminalBackup.js +1 -1
  119. package/dist/src/utils/argumentSubstitution.js +1 -1
  120. package/dist/src/utils/authFileDescriptor.js +1 -1
  121. package/dist/src/utils/autoUpdater.js +1 -1
  122. package/dist/src/utils/background/remote/preconditions.js +1 -1
  123. package/dist/src/utils/background/remote/remoteSession.js +1 -1
  124. package/dist/src/utils/bash/ShellSnapshot.js +1 -1
  125. package/dist/src/utils/bash/ast.js +1 -1
  126. package/dist/src/utils/bash/bashParser.js +1 -1
  127. package/dist/src/utils/bash/bashPipeCommand.js +1 -1
  128. package/dist/src/utils/bash/parser.js +1 -1
  129. package/dist/src/utils/bash/shellQuote.js +1 -1
  130. package/dist/src/utils/bash/shellQuoting.js +1 -1
  131. package/dist/src/utils/billing.js +1 -1
  132. package/dist/src/utils/caCerts.js +1 -1
  133. package/dist/src/utils/claudeInChrome/common.js +1 -1
  134. package/dist/src/utils/claudeInChrome/setupPortable.js +1 -1
  135. package/dist/src/utils/claudemd.js +1 -1
  136. package/dist/src/utils/collapseBackgroundBashNotifications.js +1 -1
  137. package/dist/src/utils/collapseReadSearch.js +1 -1
  138. package/dist/src/utils/completionCache.js +1 -1
  139. package/dist/src/utils/computerUse/common.js +1 -1
  140. package/dist/src/utils/concurrentSessions.js +1 -1
  141. package/dist/src/utils/context.js +1 -1
  142. package/dist/src/utils/cron.js +1 -1
  143. package/dist/src/utils/cronTasks.js +1 -1
  144. package/dist/src/utils/cwd.js +1 -1
  145. package/dist/src/utils/debug.js +1 -1
  146. package/dist/src/utils/debugFilter.js +1 -1
  147. package/dist/src/utils/detectRepository.js +1 -1
  148. package/dist/src/utils/diagLogs.js +1 -1
  149. package/dist/src/utils/diff.js +1 -1
  150. package/dist/src/utils/directMemberMessage.js +1 -1
  151. package/dist/src/utils/doctorDiagnostic.js +1 -1
  152. package/dist/src/utils/dxt/helpers.js +1 -1
  153. package/dist/src/utils/dxt/zip.js +1 -1
  154. package/dist/src/utils/earlyInput.js +1 -1
  155. package/dist/src/utils/editor.js +1 -1
  156. package/dist/src/utils/effort.js +1 -1
  157. package/dist/src/utils/embeddedTools.js +1 -1
  158. package/dist/src/utils/envDynamic.js +1 -1
  159. package/dist/src/utils/envUtils.js +1 -1
  160. package/dist/src/utils/execFileNoThrowPortable.js +1 -1
  161. package/dist/src/utils/execSyncWrapper.js +1 -1
  162. package/dist/src/utils/exportRenderer.js +1 -1
  163. package/dist/src/utils/extraUsage.js +1 -1
  164. package/dist/src/utils/fastMode.js +1 -1
  165. package/dist/src/utils/fileOperationAnalytics.js +1 -1
  166. package/dist/src/utils/fileRead.js +1 -1
  167. package/dist/src/utils/findExecutable.js +1 -1
  168. package/dist/src/utils/format.js +1 -1
  169. package/dist/src/utils/frontmatterParser.js +1 -1
  170. package/dist/src/utils/fsOperations.js +1 -1
  171. package/dist/src/utils/fullscreen.js +1 -1
  172. package/dist/src/utils/genericProcessUtils.js +1 -1
  173. package/dist/src/utils/getWorktreePaths.js +1 -1
  174. package/dist/src/utils/git/gitConfigParser.js +1 -1
  175. package/dist/src/utils/git/gitFilesystem.js +1 -1
  176. package/dist/src/utils/git/gitignore.js +1 -1
  177. package/dist/src/utils/gitDiff.js +1 -1
  178. package/dist/src/utils/gitSettings.js +1 -1
  179. package/dist/src/utils/glob.js +1 -1
  180. package/dist/src/utils/gracefulShutdown.js +1 -1
  181. package/dist/src/utils/groupToolUses.js +1 -1
  182. package/dist/src/utils/handlePromptSubmit.js +1 -1
  183. package/dist/src/utils/hash.js +1 -1
  184. package/dist/src/utils/hooks/fileChangedWatcher.js +1 -1
  185. package/dist/src/utils/hooks/hooksSettings.js +1 -1
  186. package/dist/src/utils/hooks/registerSkillHooks.js +1 -1
  187. package/dist/src/utils/hooks/sessionHooks.js +1 -1
  188. package/dist/src/utils/http.js +1 -1
  189. package/dist/src/utils/hyperlink.js +1 -1
  190. package/dist/src/utils/ide.js +1 -1
  191. package/dist/src/utils/idePathConversion.js +1 -1
  192. package/dist/src/utils/imagePaste.js +1 -1
  193. package/dist/src/utils/imageResizer.js +1 -1
  194. package/dist/src/utils/imageStore.js +1 -1
  195. package/dist/src/utils/inProcessTeammateHelpers.js +1 -1
  196. package/dist/src/utils/ink.js +1 -1
  197. package/dist/src/utils/jetbrains.js +1 -1
  198. package/dist/src/utils/json.js +1 -1
  199. package/dist/src/utils/listSessionsImpl.js +1 -1
  200. package/dist/src/utils/localInstaller.js +1 -1
  201. package/dist/src/utils/lockfile.js +1 -1
  202. package/dist/src/utils/logoV2Utils.js +1 -1
  203. package/dist/src/utils/markdown.js +1 -1
  204. package/dist/src/utils/mcp/dateTimeParser.js +1 -1
  205. package/dist/src/utils/mcpOutputStorage.js +1 -1
  206. package/dist/src/utils/mcpValidation.js +1 -1
  207. package/dist/src/utils/memoize.js +1 -1
  208. package/dist/src/utils/memory/types.js +1 -1
  209. package/dist/src/utils/memoryFileDetection.js +1 -1
  210. package/dist/src/utils/messageQueueManager.js +1 -1
  211. package/dist/src/utils/messages/mappers.js +1 -1
  212. package/dist/src/utils/messages/systemInit.js +1 -1
  213. package/dist/src/utils/model/antModels.js +1 -1
  214. package/dist/src/utils/model/check1mAccess.js +1 -1
  215. package/dist/src/utils/model/contextWindowUpgradeCheck.js +1 -1
  216. package/dist/src/utils/model/model.js +1 -1
  217. package/dist/src/utils/model/modelAllowlist.js +1 -1
  218. package/dist/src/utils/model/modelCapabilities.js +1 -1
  219. package/dist/src/utils/model/modelOptions.js +1 -1
  220. package/dist/src/utils/model/modelStrings.js +1 -1
  221. package/dist/src/utils/model/providerBaseUrls.js +1 -1
  222. package/dist/src/utils/model/providerCatalog.js +1 -1
  223. package/dist/src/utils/model/providerModels.js +1 -1
  224. package/dist/src/utils/model/providerProfiles.js +1 -1
  225. package/dist/src/utils/model/providerProfilesDb.js +1 -1
  226. package/dist/src/utils/model/providerSwitch.js +1 -1
  227. package/dist/src/utils/model/providers.js +1 -1
  228. package/dist/src/utils/modelCost.js +1 -1
  229. package/dist/src/utils/modifiers.js +1 -1
  230. package/dist/src/utils/mtls.js +1 -1
  231. package/dist/src/utils/nativeInstaller/download.js +1 -1
  232. package/dist/src/utils/nativeInstaller/installer.js +1 -1
  233. package/dist/src/utils/nativeInstaller/packageManagers.js +1 -1
  234. package/dist/src/utils/nativeInstaller/pidLock.js +1 -1
  235. package/dist/src/utils/notebook.js +1 -1
  236. package/dist/src/utils/pasteStore.js +1 -1
  237. package/dist/src/utils/path.js +1 -1
  238. package/dist/src/utils/permissions/PermissionMode.js +1 -1
  239. package/dist/src/utils/permissions/PermissionPromptToolResultSchema.js +1 -1
  240. package/dist/src/utils/permissions/PermissionUpdate.js +1 -1
  241. package/dist/src/utils/permissions/PermissionUpdateSchema.js +1 -1
  242. package/dist/src/utils/permissions/autoModeState.js +1 -1
  243. package/dist/src/utils/permissions/bypassPermissionsKillswitch.js +1 -1
  244. package/dist/src/utils/permissions/filesystem.js +1 -1
  245. package/dist/src/utils/permissions/getNextPermissionMode.js +1 -1
  246. package/dist/src/utils/permissions/pathValidation.js +1 -1
  247. package/dist/src/utils/permissions/permissionRuleParser.js +1 -1
  248. package/dist/src/utils/permissions/permissionsDb.js +1 -1
  249. package/dist/src/utils/permissions/permissionsLoader.js +1 -1
  250. package/dist/src/utils/permissions/shellRuleMatching.js +1 -1
  251. package/dist/src/utils/planModeV2.js +1 -1
  252. package/dist/src/utils/plans.js +1 -1
  253. package/dist/src/utils/platform.js +1 -1
  254. package/dist/src/utils/plugins/addDirPluginSettings.js +1 -1
  255. package/dist/src/utils/plugins/cacheUtils.js +1 -1
  256. package/dist/src/utils/plugins/dependencyResolver.js +1 -1
  257. package/dist/src/utils/plugins/fetchTelemetry.js +1 -1
  258. package/dist/src/utils/plugins/gitAvailability.js +1 -1
  259. package/dist/src/utils/plugins/hintRecommendation.js +1 -1
  260. package/dist/src/utils/plugins/installedPluginsManager.js +1 -1
  261. package/dist/src/utils/plugins/loadPluginAgents.js +1 -1
  262. package/dist/src/utils/plugins/loadPluginCommands.js +1 -1
  263. package/dist/src/utils/plugins/loadPluginHooks.js +1 -1
  264. package/dist/src/utils/plugins/loadPluginOutputStyles.js +1 -1
  265. package/dist/src/utils/plugins/lspPluginIntegration.js +1 -1
  266. package/dist/src/utils/plugins/lspRecommendation.js +1 -1
  267. package/dist/src/utils/plugins/managedPlugins.js +1 -1
  268. package/dist/src/utils/plugins/marketplaceHelpers.js +1 -1
  269. package/dist/src/utils/plugins/marketplaceManager.js +1 -1
  270. package/dist/src/utils/plugins/mcpPluginIntegration.js +1 -1
  271. package/dist/src/utils/plugins/mcpbHandler.js +1 -1
  272. package/dist/src/utils/plugins/officialMarketplaceGcs.js +1 -1
  273. package/dist/src/utils/plugins/officialMarketplaceStartupCheck.js +1 -1
  274. package/dist/src/utils/plugins/orphanedPluginFilter.js +1 -1
  275. package/dist/src/utils/plugins/performStartupChecks.js +1 -1
  276. package/dist/src/utils/plugins/pluginAutoupdate.js +1 -1
  277. package/dist/src/utils/plugins/pluginBlocklist.js +1 -1
  278. package/dist/src/utils/plugins/pluginDirectories.js +1 -1
  279. package/dist/src/utils/plugins/pluginFlagging.js +1 -1
  280. package/dist/src/utils/plugins/pluginInstallationHelpers.js +1 -1
  281. package/dist/src/utils/plugins/pluginLoader.js +1 -1
  282. package/dist/src/utils/plugins/pluginOptionsStorage.js +1 -1
  283. package/dist/src/utils/plugins/pluginPolicy.js +1 -1
  284. package/dist/src/utils/plugins/pluginStartupCheck.js +1 -1
  285. package/dist/src/utils/plugins/pluginVersioning.js +1 -1
  286. package/dist/src/utils/plugins/reconciler.js +1 -1
  287. package/dist/src/utils/plugins/refresh.js +1 -1
  288. package/dist/src/utils/plugins/schemas.js +1 -1
  289. package/dist/src/utils/plugins/walkPluginMarkdown.js +1 -1
  290. package/dist/src/utils/plugins/zipCache.js +1 -1
  291. package/dist/src/utils/powershell/parser.js +1 -1
  292. package/dist/src/utils/processUserInput/processBashCommand.js +1 -1
  293. package/dist/src/utils/processUserInput/processSlashCommand.js +1 -1
  294. package/dist/src/utils/processUserInput/processTextPrompt.js +1 -1
  295. package/dist/src/utils/processUserInput/processUserInput.js +1 -1
  296. package/dist/src/utils/profilerBase.js +1 -1
  297. package/dist/src/utils/promptCategory.js +1 -1
  298. package/dist/src/utils/promptEditor.js +1 -1
  299. package/dist/src/utils/promptShellExecution.js +1 -1
  300. package/dist/src/utils/proxy.js +1 -1
  301. package/dist/src/utils/queryHelpers.js +1 -1
  302. package/dist/src/utils/queryProfiler.js +1 -1
  303. package/dist/src/utils/queueProcessor.js +1 -1
  304. package/dist/src/utils/readFileInRange.js +1 -1
  305. package/dist/src/utils/releaseNotes.js +1 -1
  306. package/dist/src/utils/renderOptions.js +1 -1
  307. package/dist/src/utils/ripgrep.js +1 -1
  308. package/dist/src/utils/sandbox/sandbox-adapter.js +1 -1
  309. package/dist/src/utils/sdkEventQueue.js +1 -1
  310. package/dist/src/utils/secureStorage/index.js +1 -1
  311. package/dist/src/utils/secureStorage/macOsKeychainHelpers.js +1 -1
  312. package/dist/src/utils/secureStorage/macOsKeychainStorage.js +1 -1
  313. package/dist/src/utils/secureStorage/plainTextStorage.js +1 -1
  314. package/dist/src/utils/secureStorage/sqliteStorage.js +1 -1
  315. package/dist/src/utils/sessionEnvironment.js +1 -1
  316. package/dist/src/utils/sessionIngressAuth.js +1 -1
  317. package/dist/src/utils/sessionRestore.js +1 -1
  318. package/dist/src/utils/sessionStart.js +1 -1
  319. package/dist/src/utils/sessionTitle.js +1 -1
  320. package/dist/src/utils/settings/managedPath.js +1 -1
  321. package/dist/src/utils/settings/mdm/rawRead.js +1 -1
  322. package/dist/src/utils/settings/mdm/settings.js +1 -1
  323. package/dist/src/utils/settings/permissionValidation.js +1 -1
  324. package/dist/src/utils/settings/pluginOnlyPolicy.js +1 -1
  325. package/dist/src/utils/settings/schemaOutput.js +1 -1
  326. package/dist/src/utils/settings/settings.js +1 -1
  327. package/dist/src/utils/settings/types.js +1 -1
  328. package/dist/src/utils/settings/validateEditTool.js +1 -1
  329. package/dist/src/utils/settings/validation.js +1 -1
  330. package/dist/src/utils/shell/bashProvider.js +1 -1
  331. package/dist/src/utils/shell/powershellDetection.js +1 -1
  332. package/dist/src/utils/shell/powershellProvider.js +1 -1
  333. package/dist/src/utils/shell/readOnlyCommandValidation.js +1 -1
  334. package/dist/src/utils/shell/resolveDefaultShell.js +1 -1
  335. package/dist/src/utils/shell/shellToolUtils.js +1 -1
  336. package/dist/src/utils/shell/specPrefix.js +1 -1
  337. package/dist/src/utils/shellConfig.js +1 -1
  338. package/dist/src/utils/sideQuestion.js +1 -1
  339. package/dist/src/utils/skills/skillChangeDetector.js +1 -1
  340. package/dist/src/utils/slashCommandParsing.js +1 -1
  341. package/dist/src/utils/sliceAnsi.js +1 -1
  342. package/dist/src/utils/slowOperations.js +1 -1
  343. package/dist/src/utils/standaloneAgent.js +1 -1
  344. package/dist/src/utils/startupProfiler.js +1 -1
  345. package/dist/src/utils/staticRender.js +1 -1
  346. package/dist/src/utils/status.js +1 -1
  347. package/dist/src/utils/statusNoticeDefinitions.js +1 -1
  348. package/dist/src/utils/suggestions/commandSuggestions.js +1 -1
  349. package/dist/src/utils/suggestions/directoryCompletion.js +1 -1
  350. package/dist/src/utils/suggestions/shellHistoryCompletion.js +1 -1
  351. package/dist/src/utils/suggestions/skillUsageTracking.js +1 -1
  352. package/dist/src/utils/suggestions/slackChannelSuggestions.js +1 -1
  353. package/dist/src/utils/swarm/backends/detection.js +1 -1
  354. package/dist/src/utils/swarm/permissionSync.js +1 -1
  355. package/dist/src/utils/swarm/reconnection.js +1 -1
  356. package/dist/src/utils/swarm/spawnUtils.js +1 -91
  357. package/dist/src/utils/swarm/teammateInit.js +1 -1
  358. package/dist/src/utils/systemDirectories.js +1 -1
  359. package/dist/src/utils/systemPrompt.js +1 -1
  360. package/dist/src/utils/systemTheme.js +1 -1
  361. package/dist/src/utils/task/TaskOutput.js +1 -1
  362. package/dist/src/utils/task/diskOutput.js +1 -1
  363. package/dist/src/utils/tasks.js +1 -1
  364. package/dist/src/utils/teamDiscovery.js +1 -1
  365. package/dist/src/utils/teamMemoryOps.js +1 -1
  366. package/dist/src/utils/teammateMailbox.js +1 -1
  367. package/dist/src/utils/telemetry/betaSessionTracing.js +1 -1
  368. package/dist/src/utils/telemetry/bigqueryExporter.js +1 -1
  369. package/dist/src/utils/telemetry/events.js +1 -1
  370. package/dist/src/utils/telemetry/instrumentation.js +1 -1
  371. package/dist/src/utils/telemetry/logger.js +1 -1
  372. package/dist/src/utils/telemetry/perfettoTracing.js +1 -1
  373. package/dist/src/utils/telemetry/pluginTelemetry.js +1 -1
  374. package/dist/src/utils/telemetry/sessionTracing.js +1 -1
  375. package/dist/src/utils/telemetryAttributes.js +1 -1
  376. package/dist/src/utils/teleport/api.js +1 -1
  377. package/dist/src/utils/teleport/environments.js +1 -1
  378. package/dist/src/utils/teleport/gitBundle.js +1 -1
  379. package/dist/src/utils/teleport.js +1 -1
  380. package/dist/src/utils/tempfile.js +1 -1
  381. package/dist/src/utils/terminal.js +1 -1
  382. package/dist/src/utils/terminalPanel.js +1 -1
  383. package/dist/src/utils/textHighlighting.js +1 -1
  384. package/dist/src/utils/theme.js +1 -1
  385. package/dist/src/utils/themes/bootstrap.js +1 -1
  386. package/dist/src/utils/themes/loader.js +1 -1
  387. package/dist/src/utils/thinking.js +1 -1
  388. package/dist/src/utils/tmuxSocket.js +1 -1
  389. package/dist/src/utils/tokens.js +1 -1
  390. package/dist/src/utils/toolPool.js +1 -1
  391. package/dist/src/utils/toolResultStorage.js +1 -1
  392. package/dist/src/utils/transcriptSearch.js +1 -1
  393. package/dist/src/utils/truncate.js +1 -1
  394. package/dist/src/utils/ultraplan/keyword.js +1 -1
  395. package/dist/src/utils/unaryLogging.js +1 -1
  396. package/dist/src/utils/undercover.js +1 -1
  397. package/dist/src/utils/user.js +1 -1
  398. package/dist/src/utils/userPromptKeywords.js +1 -1
  399. package/dist/src/utils/which.js +1 -1
  400. package/dist/src/utils/windowsPaths.js +1 -1
  401. package/dist/src/utils/worktree.js +1 -1
  402. package/dist/src/utils/zodToJsonSchema.js +1 -1
  403. package/dist/src/vim/operators.js +1 -1
  404. package/dist/src/vim/textObjects.js +1 -1
  405. package/dist/src/vim/transitions.js +1 -1
  406. package/dist/src/voice/voiceModeEnabled.js +1 -1
  407. package/dist/src/webapp/auth.js +1 -1
  408. package/dist/src/webapp/tunnel.js +1 -1
  409. package/dist/src/whatsapp/bridge.js +1 -1
  410. package/dist/src/whatsapp/mirror.js +1 -1
  411. package/package.json +41 -3
@@ -1 +1 @@
1
- import{feature as e}from"bun:bundle";import{z as o}from"zod/v4";import{SandboxSettingsSchema as t}from"../../entrypoints/sandboxTypes.js";import{isEnvTruthy as s}from"../envUtils.js";import{lazySchema as r}from"../lazySchema.js";import{EXTERNAL_PERMISSION_MODES as i,PERMISSION_MODES as a}from"../permissions/PermissionMode.js";import{MarketplaceSourceSchema as n}from"../plugins/schemas.js";import{CLAUDE_CODE_SETTINGS_SCHEMA_URL as l}from"./constants.js";import{PermissionRuleSchema as c}from"./permissionValidation.js";export{HookCommandSchema,HookMatcherSchema,HooksSchema}from"../../schemas/hooks.js";import{HooksSchema as d}from"../../schemas/hooks.js";import{count as p}from"../array.js";export const EnvironmentVariablesSchema=r(()=>o.record(o.string(),o.coerce.string()));export const PermissionsSchema=r(()=>o.object({allow:o.array(c()).optional().describe("List of permission rules for allowed operations"),deny:o.array(c()).optional().describe("List of permission rules for denied operations"),ask:o.array(c()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:o.enum(e("TRANSCRIPT_CLASSIFIER")?a:i).optional().describe("Default permission mode when Context Code needs access"),disableBypassPermissionsMode:o.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...e("TRANSCRIPT_CLASSIFIER")?{disableAutoMode:o.enum(["disable"]).optional().describe("Disable auto mode")}:{},additionalDirectories:o.array(o.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough());export const ExtraKnownMarketplaceSchema=r(()=>o.object({source:n().describe("Where to fetch the marketplace from"),installLocation:o.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:o.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")}));export const AllowedMcpServerEntrySchema=r(()=>o.object({serverName:o.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:o.array(o.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:o.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine(e=>1===p([void 0!==e.serverName,void 0!==e.serverCommand,void 0!==e.serverUrl],Boolean),{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'}));export const DeniedMcpServerEntrySchema=r(()=>o.object({serverName:o.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:o.array(o.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:o.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine(e=>1===p([void 0!==e.serverName,void 0!==e.serverCommand,void 0!==e.serverUrl],Boolean),{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'}));export const CUSTOMIZATION_SURFACES=["skills","agents","hooks","mcp"];export const SettingsSchema=r(()=>o.object({$schema:o.literal(l).optional().describe("JSON Schema reference for Context Code settings"),apiKeyHelper:o.string().optional().describe("Path to a script that outputs authentication values"),awsCredentialExport:o.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:o.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:o.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),...s(process.env.CONTEXT_CODE_ENABLE_XAA)||s(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:o.object({issuer:o.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:o.string().describe("Context Code's client_id registered at the IdP"),callbackPort:o.number().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")}:{},fileSuggestion:o.object({type:o.literal("command"),command:o.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:o.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),cleanupPeriodDays:o.number().nonnegative().int().optional().describe("Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup."),env:EnvironmentVariablesSchema().optional().describe("Environment variables to set for Context Code sessions"),attribution:o.object({commit:o.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:o.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Context Code attribution if not set."),includeCoAuthoredBy:o.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Context's co-authored by attribution in commits and PRs (defaults to true)"),includeGitInstructions:o.boolean().optional().describe("Include built-in commit and PR workflow instructions in Context's system prompt (default: true)"),permissions:PermissionsSchema().optional().describe("Tool usage permissions configuration"),model:o.string().optional().describe("Override the default model used by Context Code"),availableModels:o.array(o.string()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),modelOverrides:o.record(o.string(),o.string()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),enableAllProjectMcpServers:o.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:o.array(o.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:o.array(o.string()).optional().describe("List of rejected MCP servers from .mcp.json"),allowedMcpServers:o.array(AllowedMcpServerEntrySchema()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:o.array(DeniedMcpServerEntrySchema()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:d().optional().describe("Custom commands to run before/after tool executions"),worktree:o.object({symlinkDirectories:o.array(o.string()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:o.array(o.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:o.boolean().optional().describe("Disable all hooks and statusLine execution"),defaultShell:o.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),allowManagedHooksOnly:o.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:o.array(o.string()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:o.array(o.string()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:o.boolean().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:o.boolean().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),strictPluginOnlyCustomization:o.preprocess(e=>Array.isArray(e)?e.filter(e=>CUSTOMIZATION_SURFACES.includes(e)):e,o.union([o.boolean(),o.array(o.enum(CUSTOMIZATION_SURFACES))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.context/{surface}/, .context/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:o.object({type:o.literal("command"),command:o.string(),padding:o.number().optional()}).optional().describe("Custom status line display configuration"),enabledPlugins:o.record(o.string(),o.union([o.array(o.string()),o.boolean(),o.undefined()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.'),extraKnownMarketplaces:o.record(o.string(),ExtraKnownMarketplaceSchema()).check(e=>{for(const[o,t]of Object.entries(e.value))"settings"===t.source.source&&t.source.name!==o&&e.issues.push({code:"custom",input:t.source.name,path:[o,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${o}" but source.name "${t.source.name}")`})}).optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),strictKnownMarketplaces:o.array(n()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),blockedMarketplaces:o.array(n()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),forceLoginMethod:o.enum(["claudeai","console"]).optional().describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing'),forceLoginOrgUUID:o.string().optional().describe("Organization UUID to use for OAuth login"),otelHeadersHelper:o.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:o.string().optional().describe("Controls the output style for assistant responses"),language:o.string().optional().describe('Idioma preferido para las respuestas de Context y el dictado local (por ejemplo, "japanese", "spanish")'),skipWebFetchPreflight:o.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:t().optional(),feedbackSurveyRate:o.number().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),spinnerTipsEnabled:o.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:o.object({mode:o.enum(["append","replace"]),verbs:o.array(o.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:o.object({excludeDefault:o.boolean().optional(),tips:o.array(o.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:o.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:o.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:o.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:o.enum("ant"===process.env.USER_TYPE?["low","medium","high","max"]:["low","medium","high"]).optional().catch(void 0).describe("Persisted effort level for supported models."),advisorModel:o.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:o.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:o.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:o.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),showClearContextOnPlanAccept:o.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),agent:o.string().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),companyAnnouncements:o.array(o.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:o.record(o.string(),o.object({mcpServers:o.record(o.string(),o.record(o.string(),o.union([o.string(),o.number(),o.boolean(),o.array(o.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:o.record(o.string(),o.union([o.string(),o.number(),o.boolean(),o.array(o.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")})).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:o.object({defaultEnvironmentId:o.string().optional().describe("Default environment ID to use for remote sessions")}).optional().describe("Remote session configuration"),autoUpdatesChannel:o.enum(["latest","stable"]).optional().describe("Release channel for auto-updates (latest or stable)"),...e("LODESTONE")?{disableDeepLinkRegistration:o.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")}:{},minimumVersion:o.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),plansDirectory:o.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.context/plans/"),..."ant"===process.env.USER_TYPE?{classifierPermissionsEnabled:o.boolean().optional().describe("Enable AI-based classification for Bash(prompt:...) permission rules")}:{},...e("PROACTIVE")||e("KAIROS")?{minSleepDurationMs:o.number().nonnegative().int().optional().describe("Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency."),maxSleepDurationMs:o.number().int().min(-1).optional().describe("Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.")}:{},...e("VOICE_MODE")?{voiceEnabled:o.boolean().optional().describe("Activar dictado local (mantener pulsado para hablar)")}:{},...e("KAIROS")?{assistant:o.boolean().optional().describe("Start Claude in assistant mode (custom system prompt, brief view, scheduled check-in skills)"),assistantName:o.string().optional().describe("Display name for the assistant, shown in the claude.ai session list")}:{},channelsEnabled:o.boolean().optional().describe("Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:o.array(o.object({marketplace:o.string(),plugin:o.string()})).optional().describe("Teams/Enterprise allowlist of channel plugins. When set, replaces the default Anthropic allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),...e("KAIROS")||e("KAIROS_BRIEF")?{defaultView:o.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")}:{},prefersReducedMotion:o.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),autoMemoryEnabled:o.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:o.string().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .context/settings.json) for security. When unset, defaults to ~/.context/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:o.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:o.boolean().optional().describe("Show thinking summaries in the transcript view (ctrl+o). Default: false."),skipDangerousModePermissionPrompt:o.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),...e("TRANSCRIPT_CLASSIFIER")?{skipAutoPermissionPrompt:o.boolean().optional().describe("Whether the user has accepted the auto mode opt-in dialog"),useAutoModeDuringPlan:o.boolean().optional().describe("Whether plan mode uses auto mode semantics when auto mode is available (default: true)"),autoMode:o.object({allow:o.array(o.string()).optional().describe("Rules for the auto mode classifier allow section"),soft_deny:o.array(o.string()).optional().describe("Rules for the auto mode classifier deny section"),..."ant"===process.env.USER_TYPE?{deny:o.array(o.string()).optional()}:{},environment:o.array(o.string()).optional().describe("Entries for the auto mode classifier environment section")}).optional().describe("Auto mode classifier prompt customization")}:{},disableAutoMode:o.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:o.array(o.object({id:o.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:o.string().describe("Display name for the SSH connection"),sshHost:o.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:o.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:o.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:o.string().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMdExcludes:o.array(o.string()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:o.string().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").')}).passthrough());export function isMcpServerNameEntry(e){return"serverName"in e&&void 0!==e.serverName}export function isMcpServerCommandEntry(e){return"serverCommand"in e&&void 0!==e.serverCommand}export function isMcpServerUrlEntry(e){return"serverUrl"in e&&void 0!==e.serverUrl}
1
+ import{feature as e}from"../../recovery/bunBundleShim.js";import{z as o}from"zod/v4";import{SandboxSettingsSchema as t}from"../../entrypoints/sandboxTypes.js";import{isEnvTruthy as s}from"../envUtils.js";import{lazySchema as r}from"../lazySchema.js";import{EXTERNAL_PERMISSION_MODES as i,PERMISSION_MODES as a}from"../permissions/PermissionMode.js";import{MarketplaceSourceSchema as n}from"../plugins/schemas.js";import{CLAUDE_CODE_SETTINGS_SCHEMA_URL as l}from"./constants.js";import{PermissionRuleSchema as d}from"./permissionValidation.js";export{HookCommandSchema,HookMatcherSchema,HooksSchema}from"../../schemas/hooks.js";import{HooksSchema as c}from"../../schemas/hooks.js";import{count as p}from"../array.js";export const EnvironmentVariablesSchema=r(()=>o.record(o.string(),o.coerce.string()));export const PermissionsSchema=r(()=>o.object({allow:o.array(d()).optional().describe("List of permission rules for allowed operations"),deny:o.array(d()).optional().describe("List of permission rules for denied operations"),ask:o.array(d()).optional().describe("List of permission rules that should always prompt for confirmation"),defaultMode:o.enum(e("TRANSCRIPT_CLASSIFIER")?a:i).optional().describe("Default permission mode when Context Code needs access"),disableBypassPermissionsMode:o.enum(["disable"]).optional().describe("Disable the ability to bypass permission prompts"),...e("TRANSCRIPT_CLASSIFIER")?{disableAutoMode:o.enum(["disable"]).optional().describe("Disable auto mode")}:{},additionalDirectories:o.array(o.string()).optional().describe("Additional directories to include in the permission scope")}).passthrough());export const ExtraKnownMarketplaceSchema=r(()=>o.object({source:n().describe("Where to fetch the marketplace from"),installLocation:o.string().optional().describe("Local cache path where marketplace manifest is stored (auto-generated if not provided)"),autoUpdate:o.boolean().optional().describe("Whether to automatically update this marketplace and its installed plugins on startup")}));export const AllowedMcpServerEntrySchema=r(()=>o.object({serverName:o.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that users are allowed to configure"),serverCommand:o.array(o.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for allowed stdio servers"),serverUrl:o.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers')}).refine(e=>1===p([void 0!==e.serverName,void 0!==e.serverCommand,void 0!==e.serverUrl],Boolean),{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'}));export const DeniedMcpServerEntrySchema=r(()=>o.object({serverName:o.string().regex(/^[a-zA-Z0-9_-]+$/,"Server name can only contain letters, numbers, hyphens, and underscores").optional().describe("Name of the MCP server that is explicitly blocked"),serverCommand:o.array(o.string()).min(1,"Server command must have at least one element (the command)").optional().describe("Command array [command, ...args] to match exactly for blocked stdio servers"),serverUrl:o.string().optional().describe('URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers')}).refine(e=>1===p([void 0!==e.serverName,void 0!==e.serverCommand,void 0!==e.serverUrl],Boolean),{message:'Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"'}));export const CUSTOMIZATION_SURFACES=["skills","agents","hooks","mcp"];export const SettingsSchema=r(()=>o.object({$schema:o.literal(l).optional().describe("JSON Schema reference for Context Code settings"),apiKeyHelper:o.string().optional().describe("Path to a script that outputs authentication values"),awsCredentialExport:o.string().optional().describe("Path to a script that exports AWS credentials"),awsAuthRefresh:o.string().optional().describe("Path to a script that refreshes AWS authentication"),gcpAuthRefresh:o.string().optional().describe("Command to refresh GCP authentication (e.g., gcloud auth application-default login)"),...s(process.env.CONTEXT_CODE_ENABLE_XAA)||s(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:o.object({issuer:o.string().url().describe("IdP issuer URL for OIDC discovery"),clientId:o.string().describe("Context Code's client_id registered at the IdP"),callbackPort:o.number().int().positive().optional().describe("Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.")}).optional().describe("XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.")}:{},fileSuggestion:o.object({type:o.literal("command"),command:o.string()}).optional().describe("Custom file suggestion configuration for @ mentions"),respectGitignore:o.boolean().optional().describe("Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected."),cleanupPeriodDays:o.number().nonnegative().int().optional().describe("Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup."),env:EnvironmentVariablesSchema().optional().describe("Environment variables to set for Context Code sessions"),attribution:o.object({commit:o.string().optional().describe("Attribution text for git commits, including any trailers. Empty string hides attribution."),pr:o.string().optional().describe("Attribution text for pull request descriptions. Empty string hides attribution.")}).optional().describe("Customize attribution text for commits and PRs. Each field defaults to the standard Context Code attribution if not set."),includeCoAuthoredBy:o.boolean().optional().describe("Deprecated: Use attribution instead. Whether to include Context's co-authored by attribution in commits and PRs (defaults to true)"),includeGitInstructions:o.boolean().optional().describe("Include built-in commit and PR workflow instructions in Context's system prompt (default: true)"),permissions:PermissionsSchema().optional().describe("Tool usage permissions configuration"),model:o.string().optional().describe("Override the default model used by Context Code"),availableModels:o.array(o.string()).optional().describe('Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.'),modelOverrides:o.record(o.string(),o.string()).optional().describe('Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.'),enableAllProjectMcpServers:o.boolean().optional().describe("Whether to automatically approve all MCP servers in the project"),enabledMcpjsonServers:o.array(o.string()).optional().describe("List of approved MCP servers from .mcp.json"),disabledMcpjsonServers:o.array(o.string()).optional().describe("List of rejected MCP servers from .mcp.json"),allowedMcpServers:o.array(AllowedMcpServerEntrySchema()).optional().describe("Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied."),deniedMcpServers:o.array(DeniedMcpServerEntrySchema()).optional().describe("Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied."),hooks:c().optional().describe("Custom commands to run before/after tool executions"),worktree:o.object({symlinkDirectories:o.array(o.string()).optional().describe('Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"'),sparsePaths:o.array(o.string()).optional().describe("Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.")}).optional().describe("Git worktree configuration for --worktree flag."),disableAllHooks:o.boolean().optional().describe("Disable all hooks and statusLine execution"),defaultShell:o.enum(["bash","powershell"]).optional().describe("Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip)."),allowManagedHooksOnly:o.boolean().optional().describe("When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored."),allowedHttpHookUrls:o.array(o.string()).optional().describe('Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).'),httpHookAllowedEnvVars:o.array(o.string()).optional().describe("Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers)."),allowManagedPermissionRulesOnly:o.boolean().optional().describe("When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored."),allowManagedMcpServersOnly:o.boolean().optional().describe("When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies."),strictPluginOnlyCustomization:o.preprocess(e=>Array.isArray(e)?e.filter(e=>CUSTOMIZATION_SURFACES.includes(e)):e,o.union([o.boolean(),o.array(o.enum(CUSTOMIZATION_SURFACES))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.context/{surface}/, .context/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:o.object({type:o.literal("command"),command:o.string(),padding:o.number().optional()}).optional().describe("Custom status line display configuration"),enabledPlugins:o.record(o.string(),o.union([o.array(o.string()),o.boolean(),o.undefined()])).optional().describe('Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.'),extraKnownMarketplaces:o.record(o.string(),ExtraKnownMarketplaceSchema()).check(e=>{for(const[o,t]of Object.entries(e.value))"settings"===t.source.source&&t.source.name!==o&&e.issues.push({code:"custom",input:t.source.name,path:[o,"source","name"],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${o}" but source.name "${t.source.name}")`})}).optional().describe("Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources."),strictKnownMarketplaces:o.array(n()).optional().describe("Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces."),blockedMarketplaces:o.array(n()).optional().describe("Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem."),forceLoginMethod:o.enum(["claudeai","console"]).optional().describe('Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing'),forceLoginOrgUUID:o.string().optional().describe("Organization UUID to use for OAuth login"),otelHeadersHelper:o.string().optional().describe("Path to a script that outputs OpenTelemetry headers"),outputStyle:o.string().optional().describe("Controls the output style for assistant responses"),language:o.string().optional().describe('Idioma preferido para las respuestas de Context y el dictado local (por ejemplo, "japanese", "spanish")'),skipWebFetchPreflight:o.boolean().optional().describe("Skip the WebFetch blocklist check for enterprise environments with restrictive security policies"),sandbox:t().optional(),feedbackSurveyRate:o.number().min(0).max(1).optional().describe("Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point."),spinnerTipsEnabled:o.boolean().optional().describe("Whether to show tips in the spinner"),spinnerVerbs:o.object({mode:o.enum(["append","replace"]),verbs:o.array(o.string())}).optional().describe('Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.'),spinnerTipsOverride:o.object({excludeDefault:o.boolean().optional(),tips:o.array(o.string())}).optional().describe("Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false)."),syntaxHighlightingDisabled:o.boolean().optional().describe("Whether to disable syntax highlighting in diffs"),terminalTitleFromRename:o.boolean().optional().describe("Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles."),alwaysThinkingEnabled:o.boolean().optional().describe("When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models."),effortLevel:o.enum("ant"===process.env.USER_TYPE?["low","medium","high","max"]:["low","medium","high"]).optional().catch(void 0).describe("Persisted effort level for supported models."),advisorModel:o.string().optional().describe("Advisor model for the server-side advisor tool."),fastMode:o.boolean().optional().describe("When true, fast mode is enabled. When absent or false, fast mode is off."),fastModePerSessionOptIn:o.boolean().optional().describe("When true, fast mode does not persist across sessions. Each session starts with fast mode off."),promptSuggestionEnabled:o.boolean().optional().describe("When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled."),showClearContextOnPlanAccept:o.boolean().optional().describe('When true, the plan-approval dialog offers a "clear context" option. Defaults to false.'),agent:o.string().optional().describe("Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model."),companyAnnouncements:o.array(o.string()).optional().describe("Company announcements to display at startup (one will be randomly selected if multiple are provided)"),pluginConfigs:o.record(o.string(),o.object({mcpServers:o.record(o.string(),o.record(o.string(),o.union([o.string(),o.number(),o.boolean(),o.array(o.string())]))).optional().describe("User configuration values for MCP servers keyed by server name"),options:o.record(o.string(),o.union([o.string(),o.number(),o.boolean(),o.array(o.string())])).optional().describe("Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.")})).optional().describe("Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)"),remote:o.object({defaultEnvironmentId:o.string().optional().describe("Default environment ID to use for remote sessions")}).optional().describe("Remote session configuration"),autoUpdatesChannel:o.enum(["latest","stable"]).optional().describe("Release channel for auto-updates (latest or stable)"),...e("LODESTONE")?{disableDeepLinkRegistration:o.enum(["disable"]).optional().describe("Prevent claude-cli:// protocol handler registration with the OS")}:{},minimumVersion:o.string().optional().describe("Minimum version to stay on - prevents downgrades when switching to stable channel"),plansDirectory:o.string().optional().describe("Custom directory for plan files, relative to project root. If not set, defaults to ~/.context/plans/"),..."ant"===process.env.USER_TYPE?{classifierPermissionsEnabled:o.boolean().optional().describe("Enable AI-based classification for Bash(prompt:...) permission rules")}:{},...e("PROACTIVE")||e("KAIROS")?{minSleepDurationMs:o.number().nonnegative().int().optional().describe("Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency."),maxSleepDurationMs:o.number().int().min(-1).optional().describe("Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.")}:{},...e("VOICE_MODE")?{voiceEnabled:o.boolean().optional().describe("Activar dictado local (mantener pulsado para hablar)")}:{},...e("KAIROS")?{assistant:o.boolean().optional().describe("Start Claude in assistant mode (custom system prompt, brief view, scheduled check-in skills)"),assistantName:o.string().optional().describe("Display name for the assistant, shown in the claude.ai session list")}:{},channelsEnabled:o.boolean().optional().describe("Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels."),allowedChannelPlugins:o.array(o.object({marketplace:o.string(),plugin:o.string()})).optional().describe("Teams/Enterprise allowlist of channel plugins. When set, replaces the default Anthropic allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true."),...e("KAIROS")||e("KAIROS_BRIEF")?{defaultView:o.enum(["chat","transcript"]).optional().describe("Default transcript view: chat (SendUserMessage checkpoints only) or transcript (full)")}:{},prefersReducedMotion:o.boolean().optional().describe("Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)"),autoMemoryEnabled:o.boolean().optional().describe("Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory."),autoMemoryDirectory:o.string().optional().describe("Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .context/settings.json) for security. When unset, defaults to ~/.context/projects/<sanitized-cwd>/memory/."),autoDreamEnabled:o.boolean().optional().describe("Enable background memory consolidation (auto-dream). When set, overrides the server-side default."),showThinkingSummaries:o.boolean().optional().describe("Show thinking summaries in the transcript view (ctrl+o). Default: false."),skipDangerousModePermissionPrompt:o.boolean().optional().describe("Whether the user has accepted the bypass permissions mode dialog"),...e("TRANSCRIPT_CLASSIFIER")?{skipAutoPermissionPrompt:o.boolean().optional().describe("Whether the user has accepted the auto mode opt-in dialog"),useAutoModeDuringPlan:o.boolean().optional().describe("Whether plan mode uses auto mode semantics when auto mode is available (default: true)"),autoMode:o.object({allow:o.array(o.string()).optional().describe("Rules for the auto mode classifier allow section"),soft_deny:o.array(o.string()).optional().describe("Rules for the auto mode classifier deny section"),..."ant"===process.env.USER_TYPE?{deny:o.array(o.string()).optional()}:{},environment:o.array(o.string()).optional().describe("Entries for the auto mode classifier environment section")}).optional().describe("Auto mode classifier prompt customization")}:{},disableAutoMode:o.enum(["disable"]).optional().describe("Disable auto mode"),sshConfigs:o.array(o.object({id:o.string().describe("Unique identifier for this SSH config. Used to match configs across settings sources."),name:o.string().describe("Display name for the SSH connection"),sshHost:o.string().describe('SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config'),sshPort:o.number().int().optional().describe("SSH port (default: 22)"),sshIdentityFile:o.string().optional().describe("Path to SSH identity file (private key)"),startDirectory:o.string().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe("SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members."),claudeMdExcludes:o.array(o.string()).optional().describe('Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"'),pluginTrustMessage:o.string().optional().describe('Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").')}).passthrough());export function isMcpServerNameEntry(e){return"serverName"in e&&void 0!==e.serverName}export function isMcpServerCommandEntry(e){return"serverCommand"in e&&void 0!==e.serverCommand}export function isMcpServerUrlEntry(e){return"serverUrl"in e&&void 0!==e.serverUrl}
@@ -1 +1 @@
1
- import{isClaudeSettingsPath as t}from"../permissions/filesystem.js";import{validateSettingsFileContent as e}from"./validation.js";export function validateInputForSettingsFileEdit(i,n,s){if(!t(i))return null;if(!e(n).isValid)return null;const l=s(),o=e(l);return o.isValid?null:{result:!1,message:`Context Code settings.json validation failed after edit:\n${o.error}\n\nFull schema:\n${o.fullSchema}\nIMPORTANT: Do not update the env unless explicitly instructed to do so.`,errorCode:10}}
1
+ import{isClaudeSettingsPath as e}from"../permissions/filesystem.js";import{validateSettingsFileContent as t}from"./validation.js";export function validateInputForSettingsFileEdit(i,n,l){if(!e(i))return null;if(!t(n).isValid)return null;const o=l(),r=t(o);return r.isValid?null:{result:!1,message:`Context Code settings.json validation failed after edit:\n${r.error}\n\nFull schema:\n${r.fullSchema}\nIMPORTANT: Do not update the env unless explicitly instructed to do so.`,errorCode:10}}
@@ -1 +1 @@
1
- import{jsonParse as e}from"../slowOperations.js";import{plural as s}from"../stringUtils.js";import{validatePermissionRule as i}from"./permissionValidation.js";import{generateSettingsJSONSchema as r}from"./schemaOutput.js";import{SettingsSchema as t}from"./types.js";import{getValidationTip as n}from"./validationTips.js";function isInvalidTypeIssue(e){return"invalid_type"===e.code}function isInvalidValueIssue(e){return"invalid_value"===e.code}function isTooSmallIssue(e){return"too_small"===e.code}function getReceivedType(e){return null===e?"null":void 0===e?"undefined":Array.isArray(e)?"array":typeof e}function extractReceivedFromMessage(e){const s=e.match(/received (\w+)/);return s?s[1]:void 0}export function formatZodError(e,i){return e.issues.map(e=>{const r=e.path.map(String).join(".");let t,o,a,l,u,c=e.message;if(isInvalidValueIssue(e))o=e.values.map(e=>String(e)),a=o.join(" | "),l=void 0,u=void 0;else if(isInvalidTypeIssue(e)){a=e.expected;const s=extractReceivedFromMessage(e.message);l=s??getReceivedType(e.input),u=s??getReceivedType(e.input)}else isTooSmallIssue(e)?a=String(e.minimum):"custom"===e.code&&"params"in e&&(l=e.params.received,u=l);const d=n({path:r,code:e.code,expected:a,received:l,enumValues:o,message:e.message,value:l});if(isInvalidValueIssue(e))t=o?.map(e=>`"${e}"`).join(", "),c=`Invalid value. Expected one of: ${t}`;else if(isInvalidTypeIssue(e)){const s=extractReceivedFromMessage(e.message)??getReceivedType(e.input);c="object"===e.expected&&"null"===s&&""===r?"Invalid or malformed JSON":`Expected ${e.expected}, but received ${s}`}else if(function(e){return"unrecognized_keys"===e.code}(e)){const i=e.keys.join(", ");c=`Unrecognized ${s(e.keys.length,"field")}: ${i}`}else isTooSmallIssue(e)&&(c=`Number must be greater than or equal to ${e.minimum}`,t=String(e.minimum));return{file:i,path:r,message:c,expected:t,invalidValue:u,suggestion:d?.suggestion,docLink:d?.docLink}})}export function validateSettingsFileContent(s){try{const i=e(s),n=t().strict().safeParse(i);if(n.success)return{isValid:!0};return{isValid:!1,error:"Settings validation failed:\n"+formatZodError(n.error,"settings").map(e=>`- ${e.path}: ${e.message}`).join("\n"),fullSchema:r()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:"Unknown parsing error"}`,fullSchema:r()}}}export function filterInvalidPermissionRules(e,s){if(!e||"object"!=typeof e)return[];const r=e;if(!r.permissions||"object"!=typeof r.permissions)return[];const t=r.permissions,n=[];for(const e of["allow","deny","ask"]){const r=t[e];Array.isArray(r)&&(t[e]=r.filter(r=>{if("string"!=typeof r)return n.push({file:s,path:`permissions.${e}`,message:`Non-string value in ${e} array was removed`,invalidValue:r}),!1;const t=i(r);if(!t.valid){let i=`Invalid permission rule "${r}" was skipped`;return t.error&&(i+=`: ${t.error}`),t.suggestion&&(i+=`. ${t.suggestion}`),n.push({file:s,path:`permissions.${e}`,message:i,invalidValue:r}),!1}return!0}))}return n}
1
+ import{jsonParse as e}from"../slowOperations.js";import{plural as i}from"../stringUtils.js";import{validatePermissionRule as s}from"./permissionValidation.js";import{generateSettingsJSONSchema as r}from"./schemaOutput.js";import{SettingsSchema as n}from"./types.js";import{getValidationTip as t}from"./validationTips.js";function isInvalidTypeIssue(e){return"invalid_type"===e.code}function isInvalidValueIssue(e){return"invalid_value"===e.code}function isTooSmallIssue(e){return"too_small"===e.code}function getReceivedType(e){return null===e?"null":void 0===e?"undefined":Array.isArray(e)?"array":typeof e}function extractReceivedFromMessage(e){const i=e.match(/received (\w+)/);return i?i[1]:void 0}export function formatZodError(e,s){return e.issues.map(e=>{const r=e.path.map(String).join(".");let n,o,a,l,u,c=e.message;if(isInvalidValueIssue(e))o=e.values.map(e=>String(e)),a=o.join(" | "),l=void 0,u=void 0;else if(isInvalidTypeIssue(e)){a=e.expected;const i=extractReceivedFromMessage(e.message);l=i??getReceivedType(e.input),u=i??getReceivedType(e.input)}else if(isTooSmallIssue(e))a=String(e.minimum);else if("custom"===e.code&&"params"in e){l=e.params.received,u=l}const d=t({path:r,code:e.code,expected:a,received:l,enumValues:o,message:e.message,value:l});if(isInvalidValueIssue(e))n=o?.map(e=>`"${e}"`).join(", "),c=`Invalid value. Expected one of: ${n}`;else if(isInvalidTypeIssue(e)){const i=extractReceivedFromMessage(e.message)??getReceivedType(e.input);c="object"===e.expected&&"null"===i&&""===r?"Invalid or malformed JSON":`Expected ${e.expected}, but received ${i}`}else if(function(e){return"unrecognized_keys"===e.code}(e)){const s=e.keys.join(", ");c=`Unrecognized ${i(e.keys.length,"field")}: ${s}`}else isTooSmallIssue(e)&&(c=`Number must be greater than or equal to ${e.minimum}`,n=String(e.minimum));return{file:s,path:r,message:c,expected:n,invalidValue:u,suggestion:d?.suggestion,docLink:d?.docLink}})}export function validateSettingsFileContent(i){try{const s=e(i),t=n().strict().safeParse(s);if(t.success)return{isValid:!0};const o=formatZodError(t.error,"settings");return{isValid:!1,error:"Settings validation failed:\n"+o.map(e=>`- ${e.path}: ${e.message}`).join("\n"),fullSchema:r()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:"Unknown parsing error"}`,fullSchema:r()}}}export function filterInvalidPermissionRules(e,i){if(!e||"object"!=typeof e)return[];const r=e;if(!r.permissions||"object"!=typeof r.permissions)return[];const n=r.permissions,t=[];for(const e of["allow","deny","ask"]){const r=n[e];Array.isArray(r)&&(n[e]=r.filter(r=>{if("string"!=typeof r)return t.push({file:i,path:`permissions.${e}`,message:`Non-string value in ${e} array was removed`,invalidValue:r}),!1;const n=s(r);if(!n.valid){let s=`Invalid permission rule "${r}" was skipped`;return n.error&&(s+=`: ${n.error}`),n.suggestion&&(s+=`. ${n.suggestion}`),t.push({file:i,path:`permissions.${e}`,message:s,invalidValue:r}),!1}return!0}))}return t}
@@ -1 +1 @@
1
- import{feature as s}from"bun:bundle";import{access as e}from"fs/promises";import{tmpdir as o}from"os";import{join as t}from"path";import{join as n}from"path/posix";import{rearrangePipeCommand as i}from"../bash/bashPipeCommand.js";import{createAndSaveSnapshot as r}from"../bash/ShellSnapshot.js";import{formatShellPrefixCommand as a}from"../bash/shellPrefix.js";import{quote as l}from"../bash/shellQuote.js";import{quoteShellCommand as d,rewriteWindowsNullRedirect as m,shouldAddStdinRedirect as c}from"../bash/shellQuoting.js";import{logForDebugging as p}from"../debug.js";import{getPlatform as u}from"../platform.js";import{getSessionEnvironmentScript as h}from"../sessionEnvironment.js";import{getSessionEnvVars as f}from"../sessionEnvVars.js";import{ensureSocketInitialized as E,getClaudeTmuxEnv as S,hasTmuxToolBeenUsed as w}from"../tmuxSocket.js";import{windowsPathToPosixPath as g}from"../windowsPaths.js";export async function createBashShellProvider(v,P){let b;const T=P?.skipSnapshot?Promise.resolve(void 0):r(v).catch(s=>{p(`Failed to create shell snapshot: ${s}`)});let _;return{type:"bash",shellPath:v,detached:!0,async buildExecCommand(r,f){let E=await T;if(E)try{await e(E)}catch{p(`Snapshot file missing, falling back to login shell: ${E}`),E=void 0}_=E,b=f.sandboxTmpDir;const S=o(),w="windows"===u()?g(S):S,P=f.useSandbox?n(f.sandboxTmpDir,`cwd-${f.id}`):n(w,`claude-${f.id}-cwd`),C=f.useSandbox?n(f.sandboxTmpDir,`cwd-${f.id}`):t(S,`claude-${f.id}-cwd`),D=m(r),x=c(D);let j=d(D,x);s("COMMIT_ATTRIBUTION")&&(r.includes("<<")||r.includes("\n"))&&(p(`Shell: Command before quoting (first 500 chars):\n${r.slice(0,500)}`),p(`Shell: Quoted command (first 500 chars):\n${j.slice(0,500)}`)),D.includes("|")&&x&&(j=i(D));const O=[];if(E){const s="windows"===u()?g(E):E;O.push(`source ${l([s])} 2>/dev/null || true`)}const L=await h();L&&O.push(L);const I=function(s){return process.env.CONTEXT_CODE_SHELL_PREFIX||process.env.CLAUDE_CODE_SHELL_PREFIX?"{ shopt -u extglob || setopt NO_EXTENDED_GLOB; } >/dev/null 2>&1 || true":s.includes("bash")?"shopt -u extglob 2>/dev/null || true":s.includes("zsh")?"setopt NO_EXTENDED_GLOB 2>/dev/null || true":null}(v);I&&O.push(I),O.push(`eval ${j}`),O.push(`pwd -P >| ${l([P])}`);let R=O.join(" && ");const $=process.env.CONTEXT_CODE_SHELL_PREFIX??process.env.CLAUDE_CODE_SHELL_PREFIX;return $&&(R=a($,R)),{commandString:R,cwdFilePath:C}},getSpawnArgs(s){const e=void 0!==_;return e&&p("Spawning shell without login (-l flag skipped)"),["-c",...e?[]:["-l"],s]},async getEnvironmentOverrides(s){const e=s.includes("tmux");"ant"===process.env.USER_TYPE&&(w()||e)&&await E();const o=S(),t={};if(o&&(t.TMUX=o),b){let s=b;"windows"===u()&&(s=g(s)),t.TMPDIR=s,t.CLAUDE_CODE_TMPDIR=s,t.TMPPREFIX=n(s,"zsh")}for(const[s,e]of f())t[s]=e;return t}}}
1
+ import{feature as s}from"../../recovery/bunBundleShim.js";import{access as o}from"fs/promises";import{tmpdir as e}from"os";import{join as t}from"path";import{join as n}from"path/posix";import{rearrangePipeCommand as r}from"../bash/bashPipeCommand.js";import{createAndSaveSnapshot as i}from"../bash/ShellSnapshot.js";import{formatShellPrefixCommand as l}from"../bash/shellPrefix.js";import{quote as a}from"../bash/shellQuote.js";import{quoteShellCommand as m,rewriteWindowsNullRedirect as c,shouldAddStdinRedirect as p}from"../bash/shellQuoting.js";import{logForDebugging as d}from"../debug.js";import{getPlatform as h}from"../platform.js";import{getSessionEnvironmentScript as u}from"../sessionEnvironment.js";import{getSessionEnvVars as f}from"../sessionEnvVars.js";import{ensureSocketInitialized as E,getClaudeTmuxEnv as w,hasTmuxToolBeenUsed as b}from"../tmuxSocket.js";import{windowsPathToPosixPath as v}from"../windowsPaths.js";export async function createBashShellProvider(_,S){let T;const D=S?.skipSnapshot?Promise.resolve(void 0):i(_).catch(s=>{d(`Failed to create shell snapshot: ${s}`)});let P;return{type:"bash",shellPath:_,detached:!0,async buildExecCommand(i,f){let E=await D;if(E)try{await o(E)}catch{d(`Snapshot file missing, falling back to login shell: ${E}`),E=void 0}P=E,T=f.sandboxTmpDir;const w=e(),b="windows"===h()?v(w):w,S=f.useSandbox?n(f.sandboxTmpDir,`cwd-${f.id}`):n(b,`claude-${f.id}-cwd`),g=f.useSandbox?n(f.sandboxTmpDir,`cwd-${f.id}`):t(w,`claude-${f.id}-cwd`),j=c(i),C=p(j);let O=m(j,C);s("COMMIT_ATTRIBUTION")&&(i.includes("<<")||i.includes("\n"))&&(d(`Shell: Command before quoting (first 500 chars):\n${i.slice(0,500)}`),d(`Shell: Quoted command (first 500 chars):\n${O.slice(0,500)}`)),j.includes("|")&&C&&(O=r(j));const x=[];if(E){const s="windows"===h()?v(E):E;x.push(`source ${a([s])} 2>/dev/null || true`)}const L=await u();L&&x.push(L);const $=function(s){return process.env.CONTEXT_CODE_SHELL_PREFIX||process.env.CLAUDE_CODE_SHELL_PREFIX?"{ shopt -u extglob || setopt NO_EXTENDED_GLOB; } >/dev/null 2>&1 || true":s.includes("bash")?"shopt -u extglob 2>/dev/null || true":s.includes("zsh")?"setopt NO_EXTENDED_GLOB 2>/dev/null || true":null}(_);$&&x.push($),x.push(`eval ${O}`),x.push(`pwd -P >| ${a([S])}`);let I=x.join(" && ");const X=process.env.CONTEXT_CODE_SHELL_PREFIX??process.env.CLAUDE_CODE_SHELL_PREFIX;return X&&(I=l(X,I)),{commandString:I,cwdFilePath:g}},getSpawnArgs(s){const o=void 0!==P;return o&&d("Spawning shell without login (-l flag skipped)"),["-c",...o?[]:["-l"],s]},async getEnvironmentOverrides(s){const o=s.includes("tmux");"ant"===process.env.USER_TYPE&&(b()||o)&&await E();const e=w(),t={};if(e&&(t.TMUX=e),T){let s=T;"windows"===h()&&(s=v(s)),t.TMPDIR=s,t.CLAUDE_CODE_TMPDIR=s,t.TMPPREFIX=n(s,"zsh")}for(const[s,o]of f())t[s]=o;return t}}}
@@ -1 +1 @@
1
- import{realpath as t,stat as e}from"fs/promises";import{getPlatform as r}from"../platform.js";import{which as a}from"../which.js";async function probePath(t){try{return(await e(t)).isFile()?t:null}catch{return null}}export async function findPowerShell(){const e=await a("pwsh");if(e){if("linux"===r()){const r=await t(e).catch(()=>e);if(e.startsWith("/snap/")||r.startsWith("/snap/")){const e=await probePath("/opt/microsoft/powershell/7/pwsh")??await probePath("/usr/bin/pwsh");if(e){const r=await t(e).catch(()=>e);if(!e.startsWith("/snap/")&&!r.startsWith("/snap/"))return e}}}return e}return await a("powershell")||null}let o=null;export function getCachedPowerShellPath(){return o||(o=findPowerShell()),o}export async function getPowerShellEdition(){const t=await getCachedPowerShellPath();return t?"pwsh"===t.split(/[/\\]/).pop().toLowerCase().replace(/\.exe$/,"")?"core":"desktop":null}export function resetPowerShellCache(){o=null}
1
+ import{realpath as t,stat as e}from"fs/promises";import{getPlatform as r}from"../platform.js";import{which as o}from"../which.js";async function probePath(t){try{return(await e(t)).isFile()?t:null}catch{return null}}export async function findPowerShell(){const e=await o("pwsh");if(e){if("linux"===r()){const r=await t(e).catch(()=>e);if(e.startsWith("/snap/")||r.startsWith("/snap/")){const e=await probePath("/opt/microsoft/powershell/7/pwsh")??await probePath("/usr/bin/pwsh");if(e){const r=await t(e).catch(()=>e);if(!e.startsWith("/snap/")&&!r.startsWith("/snap/"))return e}}}return e}const n=await o("powershell");return n||null}let n=null;export function getCachedPowerShellPath(){return n||(n=findPowerShell()),n}export async function getPowerShellEdition(){const t=await getCachedPowerShellPath();if(!t)return null;return"pwsh"===t.split(/[/\\]/).pop().toLowerCase().replace(/\.exe$/,"")?"core":"desktop"}export function resetPowerShellCache(){n=null}
@@ -1 +1 @@
1
- import{tmpdir as e}from"os";import{join as o}from"path";import{join as n}from"path/posix";import{getSessionEnvVars as r}from"../sessionEnvVars.js";export function buildPowerShellArgs(e){return["-NoProfile","-NonInteractive","-Command",e]}function encodePowerShellCommand(e){return Buffer.from(e,"utf16le").toString("base64")}export function createPowerShellProvider(t){let i;return{type:"powershell",shellPath:t,detached:!1,async buildExecCommand(r,a){i=a.useSandbox?a.sandboxTmpDir:void 0;const s=a.useSandbox&&a.sandboxTmpDir?n(a.sandboxTmpDir,`claude-pwd-ps-${a.id}`):o(e(),`claude-pwd-ps-${a.id}`),d=r+`\n; $_ec = if ($null -ne $LASTEXITCODE) { $LASTEXITCODE } elseif ($?) { 0 } else { 1 }\n; (Get-Location).Path | Out-File -FilePath '${s.replace(/'/g,"''")}' -Encoding utf8 -NoNewline\n; exit $_ec`;return{commandString:a.useSandbox?[`'${t.replace(/'/g,"'\\''")}'`,"-NoProfile","-NonInteractive","-EncodedCommand",encodePowerShellCommand(d)].join(" "):d,cwdFilePath:s}},getSpawnArgs:e=>buildPowerShellArgs(e),async getEnvironmentOverrides(){const e={};for(const[o,n]of r())e[o]=n;return i&&(e.TMPDIR=i,e.CLAUDE_CODE_TMPDIR=i),e}}}
1
+ import{tmpdir as e}from"os";import{join as o}from"path";import{join as n}from"path/posix";import{getSessionEnvVars as r}from"../sessionEnvVars.js";export function buildPowerShellArgs(e){return["-NoProfile","-NonInteractive","-Command",e]}function encodePowerShellCommand(e){return Buffer.from(e,"utf16le").toString("base64")}export function createPowerShellProvider(t){let i;return{type:"powershell",shellPath:t,detached:!1,async buildExecCommand(r,a){i=a.useSandbox?a.sandboxTmpDir:void 0;const l=a.useSandbox&&a.sandboxTmpDir?n(a.sandboxTmpDir,`claude-pwd-ps-${a.id}`):o(e(),`claude-pwd-ps-${a.id}`),d=r+`\n; $_ec = if ($null -ne $LASTEXITCODE) { $LASTEXITCODE } elseif ($?) { 0 } else { 1 }\n; (Get-Location).Path | Out-File -FilePath '${l.replace(/'/g,"''")}' -Encoding utf8 -NoNewline\n; exit $_ec`;return{commandString:a.useSandbox?[`'${t.replace(/'/g,"'\\''")}'`,"-NoProfile","-NonInteractive","-EncodedCommand",encodePowerShellCommand(d)].join(" "):d,cwdFilePath:l}},getSpawnArgs:e=>buildPowerShellArgs(e),async getEnvironmentOverrides(){const e={};for(const[o,n]of r())e[o]=n;return i&&(e.TMPDIR=i,e.CLAUDE_CODE_TMPDIR=i),e}}}
@@ -1 +1 @@
1
- import{getPlatform as n}from"../platform.js";const e={"--all":"none","--branches":"none","--tags":"none","--remotes":"none"},o={"--since":"string","--after":"string","--until":"string","--before":"string"},s={"--oneline":"none","--graph":"none","--decorate":"none","--no-decorate":"none","--date":"string","--relative-date":"none"},t={"--max-count":"number","-n":"number"},r={"--stat":"none","--numstat":"none","--shortstat":"none","--name-only":"none","--name-status":"none"},i={"--color":"none","--no-color":"none"},a={"--patch":"none","-p":"none","--no-patch":"none","--no-ext-diff":"none","-s":"none"},g={"--author":"string","--committer":"string","--grep":"string"};export const GIT_READ_ONLY_COMMANDS={"git diff":{safeFlags:{...r,...i,"--dirstat":"none","--summary":"none","--patch-with-stat":"none","--word-diff":"none","--word-diff-regex":"string","--color-words":"none","--no-renames":"none","--no-ext-diff":"none","--check":"none","--ws-error-highlight":"string","--full-index":"none","--binary":"none","--abbrev":"number","--break-rewrites":"none","--find-renames":"none","--find-copies":"none","--find-copies-harder":"none","--irreversible-delete":"none","--diff-algorithm":"string","--histogram":"none","--patience":"none","--minimal":"none","--ignore-space-at-eol":"none","--ignore-space-change":"none","--ignore-all-space":"none","--ignore-blank-lines":"none","--inter-hunk-context":"number","--function-context":"none","--exit-code":"none","--quiet":"none","--cached":"none","--staged":"none","--pickaxe-regex":"none","--pickaxe-all":"none","--no-index":"none","--relative":"string","--diff-filter":"string","-p":"none","-u":"none","-s":"none","-M":"none","-C":"none","-B":"none","-D":"none","-l":"none","-S":"string","-G":"string","-O":"string","-R":"none"}},"git log":{safeFlags:{...s,...e,...o,...t,...r,...i,...a,...g,"--abbrev-commit":"none","--full-history":"none","--dense":"none","--sparse":"none","--simplify-merges":"none","--ancestry-path":"none","--source":"none","--first-parent":"none","--merges":"none","--no-merges":"none","--reverse":"none","--walk-reflogs":"none","--skip":"number","--max-age":"number","--min-age":"number","--no-min-parents":"none","--no-max-parents":"none","--follow":"none","--no-walk":"none","--left-right":"none","--cherry-mark":"none","--cherry-pick":"none","--boundary":"none","--topo-order":"none","--date-order":"none","--author-date-order":"none","--pretty":"string","--format":"string","--diff-filter":"string","-S":"string","-G":"string","--pickaxe-regex":"none","--pickaxe-all":"none"}},"git show":{safeFlags:{...s,...r,...i,...a,"--abbrev-commit":"none","--word-diff":"none","--word-diff-regex":"string","--color-words":"none","--pretty":"string","--format":"string","--first-parent":"none","--raw":"none","--diff-filter":"string","-m":"none","--quiet":"none"}},"git shortlog":{safeFlags:{...e,...o,"-s":"none","--summary":"none","-n":"none","--numbered":"none","-e":"none","--email":"none","-c":"none","--committer":"none","--group":"string","--format":"string","--no-merges":"none","--author":"string"}},"git reflog":{safeFlags:{...s,...e,...o,...t,...g},additionalCommandIsDangerousCallback:(n,e)=>{const o=new Set(["expire","delete","exists"]);for(const n of e)if(n&&!n.startsWith("-"))return!!o.has(n);return!1}},"git stash list":{safeFlags:{...s,...e,...t}},"git ls-remote":{safeFlags:{"--branches":"none","-b":"none","--tags":"none","-t":"none","--heads":"none","-h":"none","--refs":"none","--quiet":"none","-q":"none","--exit-code":"none","--get-url":"none","--symref":"none","--sort":"string"}},"git status":{safeFlags:{"--short":"none","-s":"none","--branch":"none","-b":"none","--porcelain":"none","--long":"none","--verbose":"none","-v":"none","--untracked-files":"string","-u":"string","--ignored":"none","--ignore-submodules":"string","--column":"none","--no-column":"none","--ahead-behind":"none","--no-ahead-behind":"none","--renames":"none","--no-renames":"none","--find-renames":"string","-M":"string"}},"git blame":{safeFlags:{...i,"-L":"string","--porcelain":"none","-p":"none","--line-porcelain":"none","--incremental":"none","--root":"none","--show-stats":"none","--show-name":"none","--show-number":"none","-n":"none","--show-email":"none","-e":"none","-f":"none","--date":"string","-w":"none","--ignore-rev":"string","--ignore-revs-file":"string","-M":"none","-C":"none","--score-debug":"none","--abbrev":"number","-s":"none","-l":"none","-t":"none"}},"git ls-files":{safeFlags:{"--cached":"none","-c":"none","--deleted":"none","-d":"none","--modified":"none","-m":"none","--others":"none","-o":"none","--ignored":"none","-i":"none","--stage":"none","-s":"none","--killed":"none","-k":"none","--unmerged":"none","-u":"none","--directory":"none","--no-empty-directory":"none","--eol":"none","--full-name":"none","--abbrev":"number","--debug":"none","-z":"none","-t":"none","-v":"none","-f":"none","--exclude":"string","-x":"string","--exclude-from":"string","-X":"string","--exclude-per-directory":"string","--exclude-standard":"none","--error-unmatch":"none","--recurse-submodules":"none"}},"git config --get":{safeFlags:{"--local":"none","--global":"none","--system":"none","--worktree":"none","--default":"string","--type":"string","--bool":"none","--int":"none","--bool-or-int":"none","--path":"none","--expiry-date":"none","-z":"none","--null":"none","--name-only":"none","--show-origin":"none","--show-scope":"none"}},"git remote show":{safeFlags:{"-n":"none"},additionalCommandIsDangerousCallback:(n,e)=>{const o=e.filter(n=>"-n"!==n);return 1!==o.length||!/^[a-zA-Z0-9_-]+$/.test(o[0])}},"git remote":{safeFlags:{"-v":"none","--verbose":"none"},additionalCommandIsDangerousCallback:(n,e)=>e.some(n=>"-v"!==n&&"--verbose"!==n)},"git merge-base":{safeFlags:{"--is-ancestor":"none","--fork-point":"none","--octopus":"none","--independent":"none","--all":"none"}},"git rev-parse":{safeFlags:{"--verify":"none","--short":"string","--abbrev-ref":"none","--symbolic":"none","--symbolic-full-name":"none","--show-toplevel":"none","--show-cdup":"none","--show-prefix":"none","--git-dir":"none","--git-common-dir":"none","--absolute-git-dir":"none","--show-superproject-working-tree":"none","--is-inside-work-tree":"none","--is-inside-git-dir":"none","--is-bare-repository":"none","--is-shallow-repository":"none","--is-shallow-update":"none","--path-prefix":"none"}},"git rev-list":{safeFlags:{...e,...o,...t,...g,"--count":"none","--reverse":"none","--first-parent":"none","--ancestry-path":"none","--merges":"none","--no-merges":"none","--min-parents":"number","--max-parents":"number","--no-min-parents":"none","--no-max-parents":"none","--skip":"number","--max-age":"number","--min-age":"number","--walk-reflogs":"none","--oneline":"none","--abbrev-commit":"none","--pretty":"string","--format":"string","--abbrev":"number","--full-history":"none","--dense":"none","--sparse":"none","--source":"none","--graph":"none"}},"git describe":{safeFlags:{"--tags":"none","--match":"string","--exclude":"string","--long":"none","--abbrev":"number","--always":"none","--contains":"none","--first-match":"none","--exact-match":"none","--candidates":"number","--dirty":"none","--broken":"none"}},"git cat-file":{safeFlags:{"-t":"none","-s":"none","-p":"none","-e":"none","--batch-check":"none","--allow-undetermined-type":"none"}},"git for-each-ref":{safeFlags:{"--format":"string","--sort":"string","--count":"number","--contains":"string","--no-contains":"string","--merged":"string","--no-merged":"string","--points-at":"string"}},"git grep":{safeFlags:{"-e":"string","-E":"none","--extended-regexp":"none","-G":"none","--basic-regexp":"none","-F":"none","--fixed-strings":"none","-P":"none","--perl-regexp":"none","-i":"none","--ignore-case":"none","-v":"none","--invert-match":"none","-w":"none","--word-regexp":"none","-n":"none","--line-number":"none","-c":"none","--count":"none","-l":"none","--files-with-matches":"none","-L":"none","--files-without-match":"none","-h":"none","-H":"none","--heading":"none","--break":"none","--full-name":"none","--color":"none","--no-color":"none","-o":"none","--only-matching":"none","-A":"number","--after-context":"number","-B":"number","--before-context":"number","-C":"number","--context":"number","--and":"none","--or":"none","--not":"none","--max-depth":"number","--untracked":"none","--no-index":"none","--recurse-submodules":"none","--cached":"none","--threads":"number","-q":"none","--quiet":"none"}},"git stash show":{safeFlags:{...r,...i,...a,"--word-diff":"none","--word-diff-regex":"string","--diff-filter":"string","--abbrev":"number"}},"git worktree list":{safeFlags:{"--porcelain":"none","-v":"none","--verbose":"none","--expire":"string"}},"git tag":{safeFlags:{"-l":"none","--list":"none","-n":"number","--contains":"string","--no-contains":"string","--merged":"string","--no-merged":"string","--sort":"string","--format":"string","--points-at":"string","--column":"none","--no-column":"none","-i":"none","--ignore-case":"none"},additionalCommandIsDangerousCallback:(n,e)=>{const o=new Set(["--contains","--no-contains","--merged","--no-merged","--points-at","--sort","--format","-n"]);let s=0,t=!1,r=!1;for(;s<e.length;){const n=e[s];if(n)if("--"!==n||r)if(!r&&n.startsWith("-"))("--list"===n||"-l"===n||"-"===n[0]&&"-"!==n[1]&&n.length>2&&!n.includes("=")&&n.slice(1).includes("l"))&&(t=!0),n.includes("=")?s++:o.has(n)?s+=2:s++;else{if(!t)return!0;s++}else r=!0,s++;else s++}return!1}},"git branch":{safeFlags:{"-l":"none","--list":"none","-a":"none","--all":"none","-r":"none","--remotes":"none","-v":"none","-vv":"none","--verbose":"none","--color":"none","--no-color":"none","--column":"none","--no-column":"none","--abbrev":"number","--no-abbrev":"none","--contains":"string","--no-contains":"string","--merged":"none","--no-merged":"none","--points-at":"string","--sort":"string","--show-current":"none","-i":"none","--ignore-case":"none"},additionalCommandIsDangerousCallback:(n,e)=>{const o=new Set(["--contains","--no-contains","--points-at","--sort"]),s=new Set(["--merged","--no-merged"]);let t=0,r="",i=!1,a=!1;for(;t<e.length;){const n=e[t];if(n)if("--"!==n||a)if(!a&&n.startsWith("-"))("--list"===n||"-l"===n||"-"===n[0]&&"-"!==n[1]&&n.length>2&&!n.includes("=")&&n.slice(1).includes("l"))&&(i=!0),n.includes("=")?(r=n.split("=")[0]||"",t++):o.has(n)?(r=n,t+=2):(r=n,t++);else{const n=s.has(r);if(!i&&!n)return!0;t++}else a=!0,r="",t++;else t++}return!1}}};function ghIsDangerousCallback(n,e){for(const n of e){if(!n)continue;let e=n;if(n.startsWith("-")){const o=n.indexOf("=");if(-1===o)continue;if(e=n.slice(o+1),!e)continue}if(e.includes("/")||e.includes("://")||e.includes("@")){if(e.includes("://"))return!0;if(e.includes("@"))return!0;if((e.match(/\//g)||[]).length>=2)return!0}}return!1}export const GH_READ_ONLY_COMMANDS={"gh pr view":{safeFlags:{"--json":"string","--comments":"none","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh pr list":{safeFlags:{"--state":"string","-s":"string","--author":"string","--assignee":"string","--label":"string","--limit":"number","-L":"number","--base":"string","--head":"string","--search":"string","--json":"string","--draft":"none","--app":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh pr diff":{safeFlags:{"--color":"string","--name-only":"none","--patch":"none","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh pr checks":{safeFlags:{"--watch":"none","--required":"none","--fail-fast":"none","--json":"string","--interval":"number","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh issue view":{safeFlags:{"--json":"string","--comments":"none","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh issue list":{safeFlags:{"--state":"string","-s":"string","--assignee":"string","--author":"string","--label":"string","--limit":"number","-L":"number","--milestone":"string","--search":"string","--json":"string","--app":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh repo view":{safeFlags:{"--json":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh run list":{safeFlags:{"--branch":"string","-b":"string","--status":"string","-s":"string","--workflow":"string","-w":"string","--limit":"number","-L":"number","--json":"string","--repo":"string","-R":"string","--event":"string","-e":"string","--user":"string","-u":"string","--created":"string","--commit":"string","-c":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh run view":{safeFlags:{"--log":"none","--log-failed":"none","--exit-status":"none","--verbose":"none","-v":"none","--json":"string","--repo":"string","-R":"string","--job":"string","-j":"string","--attempt":"number","-a":"number"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh auth status":{safeFlags:{"--active":"none","-a":"none","--hostname":"string","-h":"string","--json":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh pr status":{safeFlags:{"--conflict-status":"none","-c":"none","--json":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh issue status":{safeFlags:{"--json":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh release list":{safeFlags:{"--exclude-drafts":"none","--exclude-pre-releases":"none","--json":"string","--limit":"number","-L":"number","--order":"string","-O":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh release view":{safeFlags:{"--json":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh workflow list":{safeFlags:{"--all":"none","-a":"none","--json":"string","--limit":"number","-L":"number","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh workflow view":{safeFlags:{"--ref":"string","-r":"string","--yaml":"none","-y":"none","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh label list":{safeFlags:{"--json":"string","--limit":"number","-L":"number","--order":"string","--search":"string","-S":"string","--sort":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh search repos":{safeFlags:{"--archived":"none","--created":"string","--followers":"string","--forks":"string","--good-first-issues":"string","--help-wanted-issues":"string","--include-forks":"string","--json":"string","--language":"string","--license":"string","--limit":"number","-L":"number","--match":"string","--number-topics":"string","--order":"string","--owner":"string","--size":"string","--sort":"string","--stars":"string","--topic":"string","--updated":"string","--visibility":"string"}},"gh search issues":{safeFlags:{"--app":"string","--assignee":"string","--author":"string","--closed":"string","--commenter":"string","--comments":"string","--created":"string","--include-prs":"none","--interactions":"string","--involves":"string","--json":"string","--label":"string","--language":"string","--limit":"number","-L":"number","--locked":"none","--match":"string","--mentions":"string","--milestone":"string","--no-assignee":"none","--no-label":"none","--no-milestone":"none","--no-project":"none","--order":"string","--owner":"string","--project":"string","--reactions":"string","--repo":"string","-R":"string","--sort":"string","--state":"string","--team-mentions":"string","--updated":"string","--visibility":"string"}},"gh search prs":{safeFlags:{"--app":"string","--assignee":"string","--author":"string","--base":"string","-B":"string","--checks":"string","--closed":"string","--commenter":"string","--comments":"string","--created":"string","--draft":"none","--head":"string","-H":"string","--interactions":"string","--involves":"string","--json":"string","--label":"string","--language":"string","--limit":"number","-L":"number","--locked":"none","--match":"string","--mentions":"string","--merged":"none","--merged-at":"string","--milestone":"string","--no-assignee":"none","--no-label":"none","--no-milestone":"none","--no-project":"none","--order":"string","--owner":"string","--project":"string","--reactions":"string","--repo":"string","-R":"string","--review":"string","--review-requested":"string","--reviewed-by":"string","--sort":"string","--state":"string","--team-mentions":"string","--updated":"string","--visibility":"string"}},"gh search commits":{safeFlags:{"--author":"string","--author-date":"string","--author-email":"string","--author-name":"string","--committer":"string","--committer-date":"string","--committer-email":"string","--committer-name":"string","--hash":"string","--json":"string","--limit":"number","-L":"number","--merge":"none","--order":"string","--owner":"string","--parent":"string","--repo":"string","-R":"string","--sort":"string","--tree":"string","--visibility":"string"}},"gh search code":{safeFlags:{"--extension":"string","--filename":"string","--json":"string","--language":"string","--limit":"number","-L":"number","--match":"string","--owner":"string","--repo":"string","-R":"string","--size":"string"}}};export const DOCKER_READ_ONLY_COMMANDS={"docker logs":{safeFlags:{"--follow":"none","-f":"none","--tail":"string","-n":"string","--timestamps":"none","-t":"none","--since":"string","--until":"string","--details":"none"}},"docker inspect":{safeFlags:{"--format":"string","-f":"string","--type":"string","--size":"none","-s":"none"}}};export const RIPGREP_READ_ONLY_COMMANDS={rg:{safeFlags:{"-e":"string","--regexp":"string","-f":"string","-i":"none","--ignore-case":"none","-S":"none","--smart-case":"none","-F":"none","--fixed-strings":"none","-w":"none","--word-regexp":"none","-v":"none","--invert-match":"none","-c":"none","--count":"none","-l":"none","--files-with-matches":"none","--files-without-match":"none","-n":"none","--line-number":"none","-o":"none","--only-matching":"none","-A":"number","--after-context":"number","-B":"number","--before-context":"number","-C":"number","--context":"number","-H":"none","-h":"none","--heading":"none","--no-heading":"none","-q":"none","--quiet":"none","--column":"none","-g":"string","--glob":"string","-t":"string","--type":"string","-T":"string","--type-not":"string","--type-list":"none","--hidden":"none","--no-ignore":"none","-u":"none","-m":"number","--max-count":"number","-d":"number","--max-depth":"number","-a":"none","--text":"none","-z":"none","-L":"none","--follow":"none","--color":"string","--json":"none","--stats":"none","--help":"none","--version":"none","--debug":"none","--":"none"}}};export const PYRIGHT_READ_ONLY_COMMANDS={pyright:{respectsDoubleDash:!1,safeFlags:{"--outputjson":"none","--project":"string","-p":"string","--pythonversion":"string","--pythonplatform":"string","--typeshedpath":"string","--venvpath":"string","--level":"string","--stats":"none","--verbose":"none","--version":"none","--dependencies":"none","--warnings":"none"},additionalCommandIsDangerousCallback:(n,e)=>e.some(n=>"--watch"===n||"-w"===n)}};export const EXTERNAL_READONLY_COMMANDS=["docker ps","docker images"];export function containsVulnerableUncPath(e){return"windows"===n()&&(!!/\\\\[^\s\\/]+(?:@(?:\d+|ssl))?(?:[\\/]|$|\s)/i.test(e)||(!!/(?<!:)\/\/[^\s\\/]+(?:@(?:\d+|ssl))?(?:[\\/]|$|\s)/i.test(e)||(!!/\/\\{2,}[^\s\\/]/.test(e)||!!(/\\{2,}\/[^\s\\/]/.test(e)||/@SSL@\d+/i.test(e)||/@\d+@SSL/i.test(e)||/DavWWWRoot/i.test(e)||/^\\\\(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[\\/]/.test(e)||/^\/\/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[\\/]/.test(e)||/^\\\\(\[[\da-fA-F:]+\])[\\/]/.test(e)||/^\/\/(\[[\da-fA-F:]+\])[\\/]/.test(e)))))}export const FLAG_PATTERN=/^-[a-zA-Z0-9_-]/;export function validateFlagArgument(n,e){switch(e){case"none":default:return!1;case"number":return/^\d+$/.test(n);case"string":return!0;case"char":return 1===n.length;case"{}":return"{}"===n;case"EOF":return"EOF"===n}}export function validateFlags(n,e,o,s){let t=e;for(;t<n.length;){let e=n[t];if(e){if(s?.xargsTargetCommands&&"xargs"===s.commandName&&(!e.startsWith("-")||"--"===e)){if("--"===e&&t+1<n.length&&(t++,e=n[t]),e&&s.xargsTargetCommands.includes(e))break;return!1}if("--"!==e)if(e.startsWith("-")&&e.length>1&&FLAG_PATTERN.test(e)){const r=e.includes("="),[i,...a]=e.split("="),g=a.join("=");if(!i)return!1;const l=o.safeFlags[i];if(!l){if("git"===s?.commandName&&i.match(/^-\d+$/)){t++;continue}if(("grep"===s?.commandName||"rg"===s?.commandName)&&i.startsWith("-")&&!i.startsWith("--")&&i.length>2){const n=i.substring(0,2),e=i.substring(2);if(o.safeFlags[n]&&/^\d+$/.test(e)){const s=o.safeFlags[n];if("number"===s||"string"===s){if(validateFlagArgument(e,s)){t++;continue}return!1}}}if(i.startsWith("-")&&!i.startsWith("--")&&i.length>2){for(let n=1;n<i.length;n++){const e="-"+i[n],s=o.safeFlags[e];if(!s)return!1;if("none"!==s)return!1}t++;continue}return!1}if("none"===l){if(r)return!1;t++}else{let e;if(r)e=g,t++;else{if(t+1>=n.length||n[t+1]&&n[t+1].startsWith("-")&&n[t+1].length>1&&FLAG_PATTERN.test(n[t+1]))return!1;e=n[t+1]||"",t+=2}if("string"===l&&e.startsWith("-")&&("--sort"!==i||"git"!==s?.commandName||!e.match(/^-[a-zA-Z]/)))return!1;if(!validateFlagArgument(e,l))return!1}}else t++;else{if(!1!==o.respectsDoubleDash){t++;break}t++}}else t++}return!0}
1
+ import{getPlatform as n}from"../platform.js";const e={"--all":"none","--branches":"none","--tags":"none","--remotes":"none"},o={"--since":"string","--after":"string","--until":"string","--before":"string"},s={"--oneline":"none","--graph":"none","--decorate":"none","--no-decorate":"none","--date":"string","--relative-date":"none"},t={"--max-count":"number","-n":"number"},r={"--stat":"none","--numstat":"none","--shortstat":"none","--name-only":"none","--name-status":"none"},i={"--color":"none","--no-color":"none"},a={"--patch":"none","-p":"none","--no-patch":"none","--no-ext-diff":"none","-s":"none"},g={"--author":"string","--committer":"string","--grep":"string"};export const GIT_READ_ONLY_COMMANDS={"git diff":{safeFlags:{...r,...i,"--dirstat":"none","--summary":"none","--patch-with-stat":"none","--word-diff":"none","--word-diff-regex":"string","--color-words":"none","--no-renames":"none","--no-ext-diff":"none","--check":"none","--ws-error-highlight":"string","--full-index":"none","--binary":"none","--abbrev":"number","--break-rewrites":"none","--find-renames":"none","--find-copies":"none","--find-copies-harder":"none","--irreversible-delete":"none","--diff-algorithm":"string","--histogram":"none","--patience":"none","--minimal":"none","--ignore-space-at-eol":"none","--ignore-space-change":"none","--ignore-all-space":"none","--ignore-blank-lines":"none","--inter-hunk-context":"number","--function-context":"none","--exit-code":"none","--quiet":"none","--cached":"none","--staged":"none","--pickaxe-regex":"none","--pickaxe-all":"none","--no-index":"none","--relative":"string","--diff-filter":"string","-p":"none","-u":"none","-s":"none","-M":"none","-C":"none","-B":"none","-D":"none","-l":"none","-S":"string","-G":"string","-O":"string","-R":"none"}},"git log":{safeFlags:{...s,...e,...o,...t,...r,...i,...a,...g,"--abbrev-commit":"none","--full-history":"none","--dense":"none","--sparse":"none","--simplify-merges":"none","--ancestry-path":"none","--source":"none","--first-parent":"none","--merges":"none","--no-merges":"none","--reverse":"none","--walk-reflogs":"none","--skip":"number","--max-age":"number","--min-age":"number","--no-min-parents":"none","--no-max-parents":"none","--follow":"none","--no-walk":"none","--left-right":"none","--cherry-mark":"none","--cherry-pick":"none","--boundary":"none","--topo-order":"none","--date-order":"none","--author-date-order":"none","--pretty":"string","--format":"string","--diff-filter":"string","-S":"string","-G":"string","--pickaxe-regex":"none","--pickaxe-all":"none"}},"git show":{safeFlags:{...s,...r,...i,...a,"--abbrev-commit":"none","--word-diff":"none","--word-diff-regex":"string","--color-words":"none","--pretty":"string","--format":"string","--first-parent":"none","--raw":"none","--diff-filter":"string","-m":"none","--quiet":"none"}},"git shortlog":{safeFlags:{...e,...o,"-s":"none","--summary":"none","-n":"none","--numbered":"none","-e":"none","--email":"none","-c":"none","--committer":"none","--group":"string","--format":"string","--no-merges":"none","--author":"string"}},"git reflog":{safeFlags:{...s,...e,...o,...t,...g},additionalCommandIsDangerousCallback:(n,e)=>{const o=new Set(["expire","delete","exists"]);for(const n of e)if(n&&!n.startsWith("-"))return!!o.has(n);return!1}},"git stash list":{safeFlags:{...s,...e,...t}},"git ls-remote":{safeFlags:{"--branches":"none","-b":"none","--tags":"none","-t":"none","--heads":"none","-h":"none","--refs":"none","--quiet":"none","-q":"none","--exit-code":"none","--get-url":"none","--symref":"none","--sort":"string"}},"git status":{safeFlags:{"--short":"none","-s":"none","--branch":"none","-b":"none","--porcelain":"none","--long":"none","--verbose":"none","-v":"none","--untracked-files":"string","-u":"string","--ignored":"none","--ignore-submodules":"string","--column":"none","--no-column":"none","--ahead-behind":"none","--no-ahead-behind":"none","--renames":"none","--no-renames":"none","--find-renames":"string","-M":"string"}},"git blame":{safeFlags:{...i,"-L":"string","--porcelain":"none","-p":"none","--line-porcelain":"none","--incremental":"none","--root":"none","--show-stats":"none","--show-name":"none","--show-number":"none","-n":"none","--show-email":"none","-e":"none","-f":"none","--date":"string","-w":"none","--ignore-rev":"string","--ignore-revs-file":"string","-M":"none","-C":"none","--score-debug":"none","--abbrev":"number","-s":"none","-l":"none","-t":"none"}},"git ls-files":{safeFlags:{"--cached":"none","-c":"none","--deleted":"none","-d":"none","--modified":"none","-m":"none","--others":"none","-o":"none","--ignored":"none","-i":"none","--stage":"none","-s":"none","--killed":"none","-k":"none","--unmerged":"none","-u":"none","--directory":"none","--no-empty-directory":"none","--eol":"none","--full-name":"none","--abbrev":"number","--debug":"none","-z":"none","-t":"none","-v":"none","-f":"none","--exclude":"string","-x":"string","--exclude-from":"string","-X":"string","--exclude-per-directory":"string","--exclude-standard":"none","--error-unmatch":"none","--recurse-submodules":"none"}},"git config --get":{safeFlags:{"--local":"none","--global":"none","--system":"none","--worktree":"none","--default":"string","--type":"string","--bool":"none","--int":"none","--bool-or-int":"none","--path":"none","--expiry-date":"none","-z":"none","--null":"none","--name-only":"none","--show-origin":"none","--show-scope":"none"}},"git remote show":{safeFlags:{"-n":"none"},additionalCommandIsDangerousCallback:(n,e)=>{const o=e.filter(n=>"-n"!==n);return 1!==o.length||!/^[a-zA-Z0-9_-]+$/.test(o[0])}},"git remote":{safeFlags:{"-v":"none","--verbose":"none"},additionalCommandIsDangerousCallback:(n,e)=>e.some(n=>"-v"!==n&&"--verbose"!==n)},"git merge-base":{safeFlags:{"--is-ancestor":"none","--fork-point":"none","--octopus":"none","--independent":"none","--all":"none"}},"git rev-parse":{safeFlags:{"--verify":"none","--short":"string","--abbrev-ref":"none","--symbolic":"none","--symbolic-full-name":"none","--show-toplevel":"none","--show-cdup":"none","--show-prefix":"none","--git-dir":"none","--git-common-dir":"none","--absolute-git-dir":"none","--show-superproject-working-tree":"none","--is-inside-work-tree":"none","--is-inside-git-dir":"none","--is-bare-repository":"none","--is-shallow-repository":"none","--is-shallow-update":"none","--path-prefix":"none"}},"git rev-list":{safeFlags:{...e,...o,...t,...g,"--count":"none","--reverse":"none","--first-parent":"none","--ancestry-path":"none","--merges":"none","--no-merges":"none","--min-parents":"number","--max-parents":"number","--no-min-parents":"none","--no-max-parents":"none","--skip":"number","--max-age":"number","--min-age":"number","--walk-reflogs":"none","--oneline":"none","--abbrev-commit":"none","--pretty":"string","--format":"string","--abbrev":"number","--full-history":"none","--dense":"none","--sparse":"none","--source":"none","--graph":"none"}},"git describe":{safeFlags:{"--tags":"none","--match":"string","--exclude":"string","--long":"none","--abbrev":"number","--always":"none","--contains":"none","--first-match":"none","--exact-match":"none","--candidates":"number","--dirty":"none","--broken":"none"}},"git cat-file":{safeFlags:{"-t":"none","-s":"none","-p":"none","-e":"none","--batch-check":"none","--allow-undetermined-type":"none"}},"git for-each-ref":{safeFlags:{"--format":"string","--sort":"string","--count":"number","--contains":"string","--no-contains":"string","--merged":"string","--no-merged":"string","--points-at":"string"}},"git grep":{safeFlags:{"-e":"string","-E":"none","--extended-regexp":"none","-G":"none","--basic-regexp":"none","-F":"none","--fixed-strings":"none","-P":"none","--perl-regexp":"none","-i":"none","--ignore-case":"none","-v":"none","--invert-match":"none","-w":"none","--word-regexp":"none","-n":"none","--line-number":"none","-c":"none","--count":"none","-l":"none","--files-with-matches":"none","-L":"none","--files-without-match":"none","-h":"none","-H":"none","--heading":"none","--break":"none","--full-name":"none","--color":"none","--no-color":"none","-o":"none","--only-matching":"none","-A":"number","--after-context":"number","-B":"number","--before-context":"number","-C":"number","--context":"number","--and":"none","--or":"none","--not":"none","--max-depth":"number","--untracked":"none","--no-index":"none","--recurse-submodules":"none","--cached":"none","--threads":"number","-q":"none","--quiet":"none"}},"git stash show":{safeFlags:{...r,...i,...a,"--word-diff":"none","--word-diff-regex":"string","--diff-filter":"string","--abbrev":"number"}},"git worktree list":{safeFlags:{"--porcelain":"none","-v":"none","--verbose":"none","--expire":"string"}},"git tag":{safeFlags:{"-l":"none","--list":"none","-n":"number","--contains":"string","--no-contains":"string","--merged":"string","--no-merged":"string","--sort":"string","--format":"string","--points-at":"string","--column":"none","--no-column":"none","-i":"none","--ignore-case":"none"},additionalCommandIsDangerousCallback:(n,e)=>{const o=new Set(["--contains","--no-contains","--merged","--no-merged","--points-at","--sort","--format","-n"]);let s=0,t=!1,r=!1;for(;s<e.length;){const n=e[s];if(n)if("--"!==n||r)if(!r&&n.startsWith("-"))("--list"===n||"-l"===n||"-"===n[0]&&"-"!==n[1]&&n.length>2&&!n.includes("=")&&n.slice(1).includes("l"))&&(t=!0),n.includes("=")?s++:o.has(n)?s+=2:s++;else{if(!t)return!0;s++}else r=!0,s++;else s++}return!1}},"git branch":{safeFlags:{"-l":"none","--list":"none","-a":"none","--all":"none","-r":"none","--remotes":"none","-v":"none","-vv":"none","--verbose":"none","--color":"none","--no-color":"none","--column":"none","--no-column":"none","--abbrev":"number","--no-abbrev":"none","--contains":"string","--no-contains":"string","--merged":"none","--no-merged":"none","--points-at":"string","--sort":"string","--show-current":"none","-i":"none","--ignore-case":"none"},additionalCommandIsDangerousCallback:(n,e)=>{const o=new Set(["--contains","--no-contains","--points-at","--sort"]),s=new Set(["--merged","--no-merged"]);let t=0,r="",i=!1,a=!1;for(;t<e.length;){const n=e[t];if(n)if("--"!==n||a)if(!a&&n.startsWith("-"))("--list"===n||"-l"===n||"-"===n[0]&&"-"!==n[1]&&n.length>2&&!n.includes("=")&&n.slice(1).includes("l"))&&(i=!0),n.includes("=")?(r=n.split("=")[0]||"",t++):o.has(n)?(r=n,t+=2):(r=n,t++);else{const n=s.has(r);if(!i&&!n)return!0;t++}else a=!0,r="",t++;else t++}return!1}}};function ghIsDangerousCallback(n,e){for(const n of e){if(!n)continue;let e=n;if(n.startsWith("-")){const o=n.indexOf("=");if(-1===o)continue;if(e=n.slice(o+1),!e)continue}if(!e.includes("/")&&!e.includes("://")&&!e.includes("@"))continue;if(e.includes("://"))return!0;if(e.includes("@"))return!0;if((e.match(/\//g)||[]).length>=2)return!0}return!1}export const GH_READ_ONLY_COMMANDS={"gh pr view":{safeFlags:{"--json":"string","--comments":"none","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh pr list":{safeFlags:{"--state":"string","-s":"string","--author":"string","--assignee":"string","--label":"string","--limit":"number","-L":"number","--base":"string","--head":"string","--search":"string","--json":"string","--draft":"none","--app":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh pr diff":{safeFlags:{"--color":"string","--name-only":"none","--patch":"none","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh pr checks":{safeFlags:{"--watch":"none","--required":"none","--fail-fast":"none","--json":"string","--interval":"number","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh issue view":{safeFlags:{"--json":"string","--comments":"none","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh issue list":{safeFlags:{"--state":"string","-s":"string","--assignee":"string","--author":"string","--label":"string","--limit":"number","-L":"number","--milestone":"string","--search":"string","--json":"string","--app":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh repo view":{safeFlags:{"--json":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh run list":{safeFlags:{"--branch":"string","-b":"string","--status":"string","-s":"string","--workflow":"string","-w":"string","--limit":"number","-L":"number","--json":"string","--repo":"string","-R":"string","--event":"string","-e":"string","--user":"string","-u":"string","--created":"string","--commit":"string","-c":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh run view":{safeFlags:{"--log":"none","--log-failed":"none","--exit-status":"none","--verbose":"none","-v":"none","--json":"string","--repo":"string","-R":"string","--job":"string","-j":"string","--attempt":"number","-a":"number"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh auth status":{safeFlags:{"--active":"none","-a":"none","--hostname":"string","-h":"string","--json":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh pr status":{safeFlags:{"--conflict-status":"none","-c":"none","--json":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh issue status":{safeFlags:{"--json":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh release list":{safeFlags:{"--exclude-drafts":"none","--exclude-pre-releases":"none","--json":"string","--limit":"number","-L":"number","--order":"string","-O":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh release view":{safeFlags:{"--json":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh workflow list":{safeFlags:{"--all":"none","-a":"none","--json":"string","--limit":"number","-L":"number","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh workflow view":{safeFlags:{"--ref":"string","-r":"string","--yaml":"none","-y":"none","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh label list":{safeFlags:{"--json":"string","--limit":"number","-L":"number","--order":"string","--search":"string","-S":"string","--sort":"string","--repo":"string","-R":"string"},additionalCommandIsDangerousCallback:ghIsDangerousCallback},"gh search repos":{safeFlags:{"--archived":"none","--created":"string","--followers":"string","--forks":"string","--good-first-issues":"string","--help-wanted-issues":"string","--include-forks":"string","--json":"string","--language":"string","--license":"string","--limit":"number","-L":"number","--match":"string","--number-topics":"string","--order":"string","--owner":"string","--size":"string","--sort":"string","--stars":"string","--topic":"string","--updated":"string","--visibility":"string"}},"gh search issues":{safeFlags:{"--app":"string","--assignee":"string","--author":"string","--closed":"string","--commenter":"string","--comments":"string","--created":"string","--include-prs":"none","--interactions":"string","--involves":"string","--json":"string","--label":"string","--language":"string","--limit":"number","-L":"number","--locked":"none","--match":"string","--mentions":"string","--milestone":"string","--no-assignee":"none","--no-label":"none","--no-milestone":"none","--no-project":"none","--order":"string","--owner":"string","--project":"string","--reactions":"string","--repo":"string","-R":"string","--sort":"string","--state":"string","--team-mentions":"string","--updated":"string","--visibility":"string"}},"gh search prs":{safeFlags:{"--app":"string","--assignee":"string","--author":"string","--base":"string","-B":"string","--checks":"string","--closed":"string","--commenter":"string","--comments":"string","--created":"string","--draft":"none","--head":"string","-H":"string","--interactions":"string","--involves":"string","--json":"string","--label":"string","--language":"string","--limit":"number","-L":"number","--locked":"none","--match":"string","--mentions":"string","--merged":"none","--merged-at":"string","--milestone":"string","--no-assignee":"none","--no-label":"none","--no-milestone":"none","--no-project":"none","--order":"string","--owner":"string","--project":"string","--reactions":"string","--repo":"string","-R":"string","--review":"string","--review-requested":"string","--reviewed-by":"string","--sort":"string","--state":"string","--team-mentions":"string","--updated":"string","--visibility":"string"}},"gh search commits":{safeFlags:{"--author":"string","--author-date":"string","--author-email":"string","--author-name":"string","--committer":"string","--committer-date":"string","--committer-email":"string","--committer-name":"string","--hash":"string","--json":"string","--limit":"number","-L":"number","--merge":"none","--order":"string","--owner":"string","--parent":"string","--repo":"string","-R":"string","--sort":"string","--tree":"string","--visibility":"string"}},"gh search code":{safeFlags:{"--extension":"string","--filename":"string","--json":"string","--language":"string","--limit":"number","-L":"number","--match":"string","--owner":"string","--repo":"string","-R":"string","--size":"string"}}};export const DOCKER_READ_ONLY_COMMANDS={"docker logs":{safeFlags:{"--follow":"none","-f":"none","--tail":"string","-n":"string","--timestamps":"none","-t":"none","--since":"string","--until":"string","--details":"none"}},"docker inspect":{safeFlags:{"--format":"string","-f":"string","--type":"string","--size":"none","-s":"none"}}};export const RIPGREP_READ_ONLY_COMMANDS={rg:{safeFlags:{"-e":"string","--regexp":"string","-f":"string","-i":"none","--ignore-case":"none","-S":"none","--smart-case":"none","-F":"none","--fixed-strings":"none","-w":"none","--word-regexp":"none","-v":"none","--invert-match":"none","-c":"none","--count":"none","-l":"none","--files-with-matches":"none","--files-without-match":"none","-n":"none","--line-number":"none","-o":"none","--only-matching":"none","-A":"number","--after-context":"number","-B":"number","--before-context":"number","-C":"number","--context":"number","-H":"none","-h":"none","--heading":"none","--no-heading":"none","-q":"none","--quiet":"none","--column":"none","-g":"string","--glob":"string","-t":"string","--type":"string","-T":"string","--type-not":"string","--type-list":"none","--hidden":"none","--no-ignore":"none","-u":"none","-m":"number","--max-count":"number","-d":"number","--max-depth":"number","-a":"none","--text":"none","-z":"none","-L":"none","--follow":"none","--color":"string","--json":"none","--stats":"none","--help":"none","--version":"none","--debug":"none","--":"none"}}};export const PYRIGHT_READ_ONLY_COMMANDS={pyright:{respectsDoubleDash:!1,safeFlags:{"--outputjson":"none","--project":"string","-p":"string","--pythonversion":"string","--pythonplatform":"string","--typeshedpath":"string","--venvpath":"string","--level":"string","--stats":"none","--verbose":"none","--version":"none","--dependencies":"none","--warnings":"none"},additionalCommandIsDangerousCallback:(n,e)=>e.some(n=>"--watch"===n||"-w"===n)}};export const EXTERNAL_READONLY_COMMANDS=["docker ps","docker images"];export function containsVulnerableUncPath(e){if("windows"!==n())return!1;if(/\\\\[^\s\\/]+(?:@(?:\d+|ssl))?(?:[\\/]|$|\s)/i.test(e))return!0;if(/(?<!:)\/\/[^\s\\/]+(?:@(?:\d+|ssl))?(?:[\\/]|$|\s)/i.test(e))return!0;if(/\/\\{2,}[^\s\\/]/.test(e))return!0;return!!/\\{2,}\/[^\s\\/]/.test(e)||(!(!/@SSL@\d+/i.test(e)&&!/@\d+@SSL/i.test(e))||(!!/DavWWWRoot/i.test(e)||(!(!/^\\\\(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[\\/]/.test(e)&&!/^\/\/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[\\/]/.test(e))||!(!/^\\\\(\[[\da-fA-F:]+\])[\\/]/.test(e)&&!/^\/\/(\[[\da-fA-F:]+\])[\\/]/.test(e)))))}export const FLAG_PATTERN=/^-[a-zA-Z0-9_-]/;export function validateFlagArgument(n,e){switch(e){case"none":default:return!1;case"number":return/^\d+$/.test(n);case"string":return!0;case"char":return 1===n.length;case"{}":return"{}"===n;case"EOF":return"EOF"===n}}export function validateFlags(n,e,o,s){let t=e;for(;t<n.length;){let e=n[t];if(e){if(s?.xargsTargetCommands&&"xargs"===s.commandName&&(!e.startsWith("-")||"--"===e)){if("--"===e&&t+1<n.length&&(t++,e=n[t]),e&&s.xargsTargetCommands.includes(e))break;return!1}if("--"!==e)if(e.startsWith("-")&&e.length>1&&FLAG_PATTERN.test(e)){const r=e.includes("="),[i,...a]=e.split("="),g=a.join("=");if(!i)return!1;const l=o.safeFlags[i];if(!l){if("git"===s?.commandName&&i.match(/^-\d+$/)){t++;continue}if(("grep"===s?.commandName||"rg"===s?.commandName)&&i.startsWith("-")&&!i.startsWith("--")&&i.length>2){const n=i.substring(0,2),e=i.substring(2);if(o.safeFlags[n]&&/^\d+$/.test(e)){const s=o.safeFlags[n];if("number"===s||"string"===s){if(validateFlagArgument(e,s)){t++;continue}return!1}}}if(i.startsWith("-")&&!i.startsWith("--")&&i.length>2){for(let n=1;n<i.length;n++){const e="-"+i[n],s=o.safeFlags[e];if(!s)return!1;if("none"!==s)return!1}t++;continue}return!1}if("none"===l){if(r)return!1;t++}else{let e;if(r)e=g,t++;else{if(t+1>=n.length||n[t+1]&&n[t+1].startsWith("-")&&n[t+1].length>1&&FLAG_PATTERN.test(n[t+1]))return!1;e=n[t+1]||"",t+=2}if("string"===l&&e.startsWith("-")&&("--sort"!==i||"git"!==s?.commandName||!e.match(/^-[a-zA-Z]/)))return!1;if(!validateFlagArgument(e,l))return!1}}else t++;else{if(!1!==o.respectsDoubleDash){t++;break}t++}}else t++}return!0}
@@ -1 +1 @@
1
- import{getInitialSettings as t}from"../settings/settings.js";export function resolveDefaultShell(){return t().defaultShell??"bash"}
1
+ import{getInitialSettings as e}from"../settings/settings.js";export function resolveDefaultShell(){return e().defaultShell??"bash"}
@@ -1 +1 @@
1
- import{BASH_TOOL_NAME as o}from"../../tools/BashTool/toolName.js";import{POWERSHELL_TOOL_NAME as s}from"../../tools/PowerShellTool/toolName.js";import{isEnvDefinedFalsy as r,isEnvTruthy as e}from"../envUtils.js";import{getPlatform as t}from"../platform.js";export const SHELL_TOOL_NAMES=[o,s];export function isPowerShellToolEnabled(){if("windows"!==t())return!1;const o=process.env.CONTEXT_CODE_USE_POWERSHELL_TOOL??process.env.CLAUDE_CODE_USE_POWERSHELL_TOOL;return"ant"===process.env.USER_TYPE?!r(o):e(o)}
1
+ import{BASH_TOOL_NAME as o}from"../../tools/BashTool/toolName.js";import{POWERSHELL_TOOL_NAME as r}from"../../tools/PowerShellTool/toolName.js";import{isEnvDefinedFalsy as e,isEnvTruthy as s}from"../envUtils.js";import{getPlatform as t}from"../platform.js";export const SHELL_TOOL_NAMES=[o,r];export function isPowerShellToolEnabled(){if("windows"!==t())return!1;const o=process.env.CONTEXT_CODE_USE_POWERSHELL_TOOL??process.env.CLAUDE_CODE_USE_POWERSHELL_TOOL;return"ant"===process.env.USER_TYPE?!e(o):s(o)}
@@ -1 +1 @@
1
- const n=["http://","https://","ftp://"];export const DEPTH_RULES={rg:2,"pre-commit":2,gcloud:4,"gcloud compute":6,"gcloud beta":6,aws:4,az:4,kubectl:3,docker:3,dotnet:3,"git push":2};const toArray=n=>Array.isArray(n)?n:[n];function isKnownSubcommand(n,s){if(!s?.subcommands?.length)return!1;const r=n.toLowerCase();return s.subcommands.some(n=>Array.isArray(n.name)?n.name.some(n=>n.toLowerCase()===r):n.name.toLowerCase()===r)}function flagTakesArg(n,s,r){if(r?.options){const s=r.options.find(s=>Array.isArray(s.name)?s.name.includes(n):s.name===n);if(s)return!!s.args}return!(!r?.subcommands?.length||!s||s.startsWith("-")||isKnownSubcommand(s,r))}export async function buildPrefix(n,s,r){const t=await async function(n,s,r){const t=function(n,s){for(let r=0;r<n.length;r++){const t=n[r];if(t)if(t.startsWith("-"))flagTakesArg(t,n[r+1],s)&&r++;else{if(!s?.subcommands?.length)return t;if(isKnownSubcommand(t,s))return t}}}(s,r),e=n.toLowerCase(),o=t?`${e} ${t.toLowerCase()}`:e;if(DEPTH_RULES[o])return DEPTH_RULES[o];if(DEPTH_RULES[e])return DEPTH_RULES[e];if(!r)return 2;if(r.options&&s.some(n=>n?.startsWith("-")))for(const n of s){if(!n?.startsWith("-"))continue;const s=r.options.find(s=>Array.isArray(s.name)?s.name.includes(n):s.name===n);if(s?.args&&toArray(s.args).some(n=>n?.isCommand||n?.isModule))return 3}if(t&&r.subcommands?.length){const n=t.toLowerCase(),s=r.subcommands.find(s=>Array.isArray(s.name)?s.name.some(s=>s.toLowerCase()===n):s.name.toLowerCase()===n);if(s){if(s.args){const n=toArray(s.args);if(n.some(n=>n?.isCommand))return 3;if(n.some(n=>n?.isVariadic))return 2}return s.subcommands?.length?4:s.args?3:2}}if(r.args){const n=toArray(r.args);if(n.some(n=>n?.isCommand))return!Array.isArray(r.args)&&r.args.isCommand?2:Math.min(2+n.findIndex(n=>n?.isCommand),3);if(!r.subcommands?.length){if(n.some(n=>n?.isVariadic))return 1;if(n[0]&&!n[0].isOptional)return 2}}return r.args&&toArray(r.args).some(n=>n?.isDangerous)?3:2}(n,s,r),e=[n],o=!!r?.subcommands?.length;let a=!1;for(let i=0;i<s.length;i++){const m=s[i];if(!m||e.length>=t)break;if(m.startsWith("-")){if("-c"===m&&["python","python3"].includes(n.toLowerCase()))break;if(r?.options){const n=r.options.find(n=>Array.isArray(n.name)?n.name.includes(m):n.name===m);if(n?.args&&toArray(n.args).some(n=>n?.isCommand||n?.isModule)){e.push(m);continue}}if(o&&!a){flagTakesArg(m,s[i+1],r)&&i++;continue}break}if(await shouldStopAtArg(m,s.slice(0,i),r))break;o&&!a&&(a=isKnownSubcommand(m,r)),e.push(m)}return e.join(" ")}async function shouldStopAtArg(s,r,t){if(s.startsWith("-"))return!0;const e=s.lastIndexOf("."),o=e>0&&e<s.length-1&&!s.substring(e+1).includes(":"),a=s.includes("/")||o,i=n.some(n=>s.startsWith(n));if(!a&&!i)return!1;if(t?.options&&r.length>0&&"-m"===r[r.length-1]){const n=t.options.find(n=>Array.isArray(n.name)?n.name.includes("-m"):"-m"===n.name);if(n?.args&&toArray(n.args).some(n=>n?.isModule))return!1}return!0}
1
+ const n=["http://","https://","ftp://"];export const DEPTH_RULES={rg:2,"pre-commit":2,gcloud:4,"gcloud compute":6,"gcloud beta":6,aws:4,az:4,kubectl:3,docker:3,dotnet:3,"git push":2};const toArray=n=>Array.isArray(n)?n:[n];function isKnownSubcommand(n,s){if(!s?.subcommands?.length)return!1;const r=n.toLowerCase();return s.subcommands.some(n=>Array.isArray(n.name)?n.name.some(n=>n.toLowerCase()===r):n.name.toLowerCase()===r)}function flagTakesArg(n,s,r){if(r?.options){const s=r.options.find(s=>Array.isArray(s.name)?s.name.includes(n):s.name===n);if(s)return!!s.args}return!(!r?.subcommands?.length||!s||s.startsWith("-"))&&!isKnownSubcommand(s,r)}export async function buildPrefix(n,s,r){const t=await async function(n,s,r){const t=function(n,s){for(let r=0;r<n.length;r++){const t=n[r];if(t)if(t.startsWith("-"))flagTakesArg(t,n[r+1],s)&&r++;else{if(!s?.subcommands?.length)return t;if(isKnownSubcommand(t,s))return t}}}(s,r),e=n.toLowerCase(),o=t?`${e} ${t.toLowerCase()}`:e;if(DEPTH_RULES[o])return DEPTH_RULES[o];if(DEPTH_RULES[e])return DEPTH_RULES[e];if(!r)return 2;if(r.options&&s.some(n=>n?.startsWith("-")))for(const n of s){if(!n?.startsWith("-"))continue;const s=r.options.find(s=>Array.isArray(s.name)?s.name.includes(n):s.name===n);if(s?.args&&toArray(s.args).some(n=>n?.isCommand||n?.isModule))return 3}if(t&&r.subcommands?.length){const n=t.toLowerCase(),s=r.subcommands.find(s=>Array.isArray(s.name)?s.name.some(s=>s.toLowerCase()===n):s.name.toLowerCase()===n);if(s){if(s.args){const n=toArray(s.args);if(n.some(n=>n?.isCommand))return 3;if(n.some(n=>n?.isVariadic))return 2}return s.subcommands?.length?4:s.args?3:2}}if(r.args){const n=toArray(r.args);if(n.some(n=>n?.isCommand))return!Array.isArray(r.args)&&r.args.isCommand?2:Math.min(2+n.findIndex(n=>n?.isCommand),3);if(!r.subcommands?.length){if(n.some(n=>n?.isVariadic))return 1;if(n[0]&&!n[0].isOptional)return 2}}return r.args&&toArray(r.args).some(n=>n?.isDangerous)?3:2}(n,s,r),e=[n],o=!!r?.subcommands?.length;let a=!1;for(let i=0;i<s.length;i++){const m=s[i];if(!m||e.length>=t)break;if(m.startsWith("-")){if("-c"===m&&["python","python3"].includes(n.toLowerCase()))break;if(r?.options){const n=r.options.find(n=>Array.isArray(n.name)?n.name.includes(m):n.name===m);if(n?.args&&toArray(n.args).some(n=>n?.isCommand||n?.isModule)){e.push(m);continue}}if(o&&!a){flagTakesArg(m,s[i+1],r)&&i++;continue}break}if(await shouldStopAtArg(m,s.slice(0,i),r))break;o&&!a&&(a=isKnownSubcommand(m,r)),e.push(m)}return e.join(" ")}async function shouldStopAtArg(s,r,t){if(s.startsWith("-"))return!0;const e=s.lastIndexOf("."),o=e>0&&e<s.length-1&&!s.substring(e+1).includes(":"),a=s.includes("/")||o,i=n.some(n=>s.startsWith(n));if(!a&&!i)return!1;if(t?.options&&r.length>0&&"-m"===r[r.length-1]){const n=t.options.find(n=>Array.isArray(n.name)?n.name.includes("-m"):"-m"===n.name);if(n?.args&&toArray(n.args).some(n=>n?.isModule))return!1}return!0}
@@ -1 +1 @@
1
- import{open as t,readFile as s,stat as i}from"fs/promises";import{homedir as a}from"os";import{join as e}from"path";import{isFsInaccessible as n}from"./errors.js";import{getLocalClaudePath as r}from"./localInstaller.js";export const CLAUDE_ALIAS_REGEX=/^\s*alias\s+claude\s*=/;export function getShellConfigPaths(t){const s=t?.homedir??a(),i=(t?.env??process.env).ZDOTDIR||s;return{zsh:e(i,".zshrc"),bash:e(s,".bashrc"),fish:e(s,".config/fish/config.fish")}}export function filterClaudeAliases(t){let s=!1;return{filtered:t.filter(t=>{if(CLAUDE_ALIAS_REGEX.test(t)){let i=t.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(i||(i=t.match(/alias\s+claude\s*=\s*([^#\n]+)/)),i&&i[1]&&i[1].trim()===r())return s=!0,!1}return!0}),hadAlias:s}}export async function readFileLines(t){try{return(await s(t,{encoding:"utf8"})).split("\n")}catch(t){if(n(t))return null;throw t}}export async function writeFileLines(s,i){const a=await t(s,"w");try{await a.writeFile(i.join("\n"),{encoding:"utf8"}),await a.datasync()}finally{await a.close()}}export async function findClaudeAlias(t){const s=getShellConfigPaths(t);for(const t of Object.values(s)){const s=await readFileLines(t);if(s)for(const t of s)if(CLAUDE_ALIAS_REGEX.test(t)){const s=t.match(/alias\s+claude=["']?([^"'\s]+)/);if(s&&s[1])return s[1]}}return null}export async function findValidClaudeAlias(t){const s=await findClaudeAlias(t);if(!s)return null;const e=t?.homedir??a(),n=s.startsWith("~")?s.replace("~",e):s;try{const t=await i(n);if(t.isFile()||t.isSymbolicLink())return s}catch{}return null}
1
+ import{open as t,readFile as i,stat as s}from"fs/promises";import{homedir as e}from"os";import{join as n}from"path";import{isFsInaccessible as r}from"./errors.js";import{getLocalClaudePath as a}from"./localInstaller.js";export const CLAUDE_ALIAS_REGEX=/^\s*alias\s+claude\s*=/;export function getShellConfigPaths(t){const i=t?.homedir??e(),s=(t?.env??process.env).ZDOTDIR||i;return{zsh:n(s,".zshrc"),bash:n(i,".bashrc"),fish:n(i,".config/fish/config.fish")}}export function filterClaudeAliases(t){let i=!1;return{filtered:t.filter(t=>{if(CLAUDE_ALIAS_REGEX.test(t)){let s=t.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(s||(s=t.match(/alias\s+claude\s*=\s*([^#\n]+)/)),s&&s[1]){if(s[1].trim()===a())return i=!0,!1}}return!0}),hadAlias:i}}export async function readFileLines(t){try{return(await i(t,{encoding:"utf8"})).split("\n")}catch(t){if(r(t))return null;throw t}}export async function writeFileLines(i,s){const e=await t(i,"w");try{await e.writeFile(s.join("\n"),{encoding:"utf8"}),await e.datasync()}finally{await e.close()}}export async function findClaudeAlias(t){const i=getShellConfigPaths(t);for(const t of Object.values(i)){const i=await readFileLines(t);if(i)for(const t of i)if(CLAUDE_ALIAS_REGEX.test(t)){const i=t.match(/alias\s+claude=["']?([^"'\s]+)/);if(i&&i[1])return i[1]}}return null}export async function findValidClaudeAlias(t){const i=await findClaudeAlias(t);if(!i)return null;const n=t?.homedir??e(),r=i.startsWith("~")?i.replace("~",n):i;try{const t=await s(r);if(t.isFile()||t.isSymbolicLink())return i}catch{}return null}
@@ -1 +1 @@
1
- import{formatAPIError as e}from"../services/api/errorUtils.js";import{runForkedAgent as n}from"./forkedAgent.js";import{createUserMessage as t,extractTextContent as o}from"./messages.js";const s=/^\/btw\b/gi;export function findBtwTriggerPositions(e){const n=[],t=e.matchAll(s);for(const e of t)void 0!==e.index&&n.push({word:e[0],start:e.index,end:e.index+e[0].length});return n}export async function runSideQuestion({question:e,cacheSafeParams:o}){const s=`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.\n\nIMPORTANT CONTEXT:\n- You are a separate, lightweight agent spawned to answer this one question\n- The main agent is NOT interrupted - it continues working independently in the background\n- You share the conversation context but are a completely separate instance\n- Do NOT reference being interrupted or what you were "previously doing" - that framing is incorrect\n\nCRITICAL CONSTRAINTS:\n- You have NO tools available - you cannot read files, run commands, search, or take any actions\n- This is a one-off response - there will be no follow-up turns\n- You can ONLY provide information based on what you already know from the conversation context\n- NEVER say things like "Let me try...", "I'll now...", "Let me check...", or promise to take any action\n- If you don't know the answer, say so - do not offer to look it up or investigate\n\nSimply answer the question with the information you have.</system-reminder>\n\n${e}`,r=await n({promptMessages:[t({content:s})],cacheSafeParams:o,canUseTool:async()=>({behavior:"deny",message:"Side questions cannot use tools",decisionReason:{type:"other",reason:"side_question"}}),querySource:"side_question",forkLabel:"side_question",maxTurns:1,skipCacheWrite:!0});return{response:extractSideQuestionResponse(r.messages),usage:r.totalUsage}}function extractSideQuestionResponse(n){const t=n.flatMap(e=>"assistant"===e.type?e.message.content:[]);if(t.length>0){const e=o(t,"\n\n").trim();if(e)return e;const n=t.find(e=>"tool_use"===e.type);if(n)return`(The model tried to call ${"name"in n?n.name:"a tool"} instead of answering directly. Try rephrasing or ask in the main conversation.)`}const s=n.find(e=>"system"===e.type&&"subtype"in e&&"api_error"===e.subtype);return s?`(API error: ${e(s.error)})`:null}
1
+ import{formatAPIError as e}from"../services/api/errorUtils.js";import{runForkedAgent as n}from"./forkedAgent.js";import{createUserMessage as t,extractTextContent as o}from"./messages.js";const s=/^\/btw\b/gi;export function findBtwTriggerPositions(e){const n=[],t=e.matchAll(s);for(const e of t)void 0!==e.index&&n.push({word:e[0],start:e.index,end:e.index+e[0].length});return n}export async function runSideQuestion({question:e,cacheSafeParams:o}){const s=`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.\n\nIMPORTANT CONTEXT:\n- You are a separate, lightweight agent spawned to answer this one question\n- The main agent is NOT interrupted - it continues working independently in the background\n- You share the conversation context but are a completely separate instance\n- Do NOT reference being interrupted or what you were "previously doing" - that framing is incorrect\n\nCRITICAL CONSTRAINTS:\n- You have NO tools available - you cannot read files, run commands, search, or take any actions\n- This is a one-off response - there will be no follow-up turns\n- You can ONLY provide information based on what you already know from the conversation context\n- NEVER say things like "Let me try...", "I'll now...", "Let me check...", or promise to take any action\n- If you don't know the answer, say so - do not offer to look it up or investigate\n\nSimply answer the question with the information you have.</system-reminder>\n\n${e}`,i=await n({promptMessages:[t({content:s})],cacheSafeParams:o,canUseTool:async()=>({behavior:"deny",message:"Side questions cannot use tools",decisionReason:{type:"other",reason:"side_question"}}),querySource:"side_question",forkLabel:"side_question",maxTurns:1,skipCacheWrite:!0});return{response:extractSideQuestionResponse(i.messages),usage:i.totalUsage}}function extractSideQuestionResponse(n){const t=n.flatMap(e=>"assistant"===e.type?e.message.content:[]);if(t.length>0){const e=o(t,"\n\n").trim();if(e)return e;const n=t.find(e=>"tool_use"===e.type);if(n){return`(The model tried to call ${"name"in n?n.name:"a tool"} instead of answering directly. Try rephrasing or ask in the main conversation.)`}}const s=n.find(e=>"system"===e.type&&"subtype"in e&&"api_error"===e.subtype);return s?`(API error: ${e(s.error)})`:null}
@@ -1 +1 @@
1
- import e from"chokidar";import*as t from"path";import{getAdditionalDirectoriesForClaudeMd as s}from"../../bootstrap/state.js";import{clearCommandMemoizationCaches as i,clearCommandsCache as o}from"../../commands.js";import{logEvent as a}from"../../services/analytics/index.js";import{clearSkillCaches as n,getSkillsPath as l,onDynamicSkillsLoaded as r}from"../../skills/loadSkillsDir.js";import{resetSentSkillNames as c}from"../attachments.js";import{registerCleanup as m}from"../cleanupRegistry.js";import{logForDebugging as u}from"../debug.js";import{getFsImplementation as h}from"../fsOperations.js";import{executeConfigChangeHooks as d,hasBlockingResult as g}from"../hooks.js";import{createSignal as p}from"../signal.js";const f="undefined"!=typeof Bun;let k=null,y=null;const C=new Set;let b=!1,j=!1,w=!1,S=null;const v=p();let T=null;export async function initialize(){if(b||j)return;b=!0,w||(w=!0,r(()=>{i(),v.emit()}));const o=await async function(){const e=h(),i=[],o=l("userSettings","skills");if(o)try{await e.stat(o),i.push(o)}catch{}const a=l("userSettings","commands");if(a)try{await e.stat(a),i.push(a)}catch{}const n=l("projectSettings","skills");if(n)try{const s=t.resolve(n);await e.stat(s),i.push(s)}catch{}const r=l("projectSettings","commands");if(r)try{const s=t.resolve(r);await e.stat(s),i.push(s)}catch{}for(const o of s())for(const s of[".context",".claude"]){const a=t.join(o,s,"skills");try{await e.stat(a),i.push(a)}catch{}}return i}();0!==o.length&&(u(`Watching for changes in skill/command directories: ${o.join(", ")}...`),k=e.watch(o,{persistent:!0,ignoreInitial:!0,depth:2,awaitWriteFinish:{stabilityThreshold:T?.stabilityThreshold??1e3,pollInterval:T?.pollInterval??500},ignored:(e,s)=>!(!s||s.isFile()||s.isDirectory())||e.split(t.sep).some(e=>".git"===e),ignorePermissionErrors:!0,usePolling:f,interval:T?.chokidarInterval??2e3,atomic:!0}),k.on("add",handleChange),k.on("change",handleChange),k.on("unlink",handleChange),S=m(async()=>{await dispose()}))}export function dispose(){j=!0,S&&(S(),S=null);let e=Promise.resolve();return k&&(e=k.close(),k=null),y&&(clearTimeout(y),y=null),C.clear(),v.clear(),e}export const subscribe=v.subscribe;function handleChange(e){u(`Detected skill change: ${e}`),a("tengu_skill_file_changed",{source:"chokidar"}),function(e){C.add(e),y&&clearTimeout(y),y=setTimeout(async()=>{y=null;const e=[...C];C.clear();const t=await d("skills",e[0]);g(t)?u(`ConfigChange hook blocked skill reload (${e.length} paths)`):(n(),o(),c(),v.emit())},T?.reloadDebounce??300)}(e)}export async function resetForTesting(e){k&&(await k.close(),k=null),y&&(clearTimeout(y),y=null),C.clear(),v.clear(),b=!1,j=!1,T=e??null}export const skillChangeDetector={initialize,dispose,subscribe,resetForTesting};
1
+ import t from"chokidar";import*as e from"path";import{getAdditionalDirectoriesForClaudeMd as s}from"../../bootstrap/state.js";import{clearCommandMemoizationCaches as i,clearCommandsCache as o}from"../../commands.js";import{logEvent as n}from"../../services/analytics/index.js";import{clearSkillCaches as r,getSkillsPath as l,onDynamicSkillsLoaded as a}from"../../skills/loadSkillsDir.js";import{resetSentSkillNames as c}from"../attachments.js";import{registerCleanup as u}from"../cleanupRegistry.js";import{logForDebugging as m}from"../debug.js";import{getFsImplementation as h}from"../fsOperations.js";import{executeConfigChangeHooks as p,hasBlockingResult as d}from"../hooks.js";import{createSignal as f}from"../signal.js";const g="undefined"!=typeof Bun;let k=null,y=null;const b=new Set;let j=!1,w=!1,T=!1,v=null;const x=f();let C=null;export async function initialize(){if(j||w)return;j=!0,T||(T=!0,a(()=>{i(),x.emit()}));const o=await async function(){const t=h(),i=[],o=l("userSettings","skills");if(o)try{await t.stat(o),i.push(o)}catch{}const n=l("userSettings","commands");if(n)try{await t.stat(n),i.push(n)}catch{}const r=l("projectSettings","skills");if(r)try{const s=e.resolve(r);await t.stat(s),i.push(s)}catch{}const a=l("projectSettings","commands");if(a)try{const s=e.resolve(a);await t.stat(s),i.push(s)}catch{}for(const o of s())for(const s of[".context",".claude"]){const n=e.join(o,s,"skills");try{await t.stat(n),i.push(n)}catch{}}return i}();0!==o.length&&(m(`Watching for changes in skill/command directories: ${o.join(", ")}...`),k=t.watch(o,{persistent:!0,ignoreInitial:!0,depth:2,awaitWriteFinish:{stabilityThreshold:C?.stabilityThreshold??1e3,pollInterval:C?.pollInterval??500},ignored:(t,s)=>!(!s||s.isFile()||s.isDirectory())||t.split(e.sep).some(t=>".git"===t),ignorePermissionErrors:!0,usePolling:g,interval:C?.chokidarInterval??2e3,atomic:!0}),k.on("add",handleChange),k.on("change",handleChange),k.on("unlink",handleChange),v=u(async()=>{await dispose()}))}export function dispose(){w=!0,v&&(v(),v=null);let t=Promise.resolve();return k&&(t=k.close(),k=null),y&&(clearTimeout(y),y=null),b.clear(),x.clear(),t}export const subscribe=x.subscribe;function handleChange(t){m(`Detected skill change: ${t}`),n("tengu_skill_file_changed",{source:"chokidar"}),function(t){b.add(t),y&&clearTimeout(y);y=setTimeout(async()=>{y=null;const t=[...b];b.clear();const e=await p("skills",t[0]);d(e)?m(`ConfigChange hook blocked skill reload (${t.length} paths)`):(r(),o(),c(),x.emit())},C?.reloadDebounce??300)}(t)}export async function resetForTesting(t){k&&(await k.close(),k=null),y&&(clearTimeout(y),y=null),b.clear(),x.clear(),j=!1,w=!1,C=t??null}export const skillChangeDetector={initialize,dispose,subscribe,resetForTesting};
@@ -1 +1 @@
1
- export function parseSlashCommand(t){const n=t.trim();if(!n.startsWith("/"))return null;const r=n.slice(1).split(" ");if(!r[0])return null;let s=r[0],e=!1,i=1;return r.length>1&&"(MCP)"===r[1]&&(s+=" (MCP)",e=!0,i=2),{commandName:s,args:r.slice(i).join(" "),isMcp:e}}
1
+ export function parseSlashCommand(t){const n=t.trim();if(!n.startsWith("/"))return null;const r=n.slice(1).split(" ");if(!r[0])return null;let s=r[0],e=!1,i=1;r.length>1&&"(MCP)"===r[1]&&(s+=" (MCP)",e=!0,i=2);return{commandName:s,args:r.slice(i).join(" "),isMcp:e}}
@@ -1 +1 @@
1
- import{ansiCodesToString as e,reduceAnsiCodes as t,tokenize as i,undoAnsiCodes as n}from"@alcalzone/ansi-tokenize";import{stringWidth as o}from"../ink/stringWidth.js";function filterStartCodes(e){return e.filter(e=>{return!((t=e).code===t.endCode);var t})}export default function sliceAnsi(s,r,a){const d=i(s);let f=[],l=0,u="",c=!1;for(const i of d){const n="ansi"===i.type?0:i.fullWidth?2:o(i.value);if(void 0!==a&&l>=a&&("ansi"===i.type||n>0||!c))break;if("ansi"===i.type)f.push(i),c&&(u+=i.code);else{if(!c&&l>=r){if(r>0&&0===n)continue;c=!0,f=filterStartCodes(t(f)),u=e(f)}c&&(u+=i.value),l+=n}}const p=filterStartCodes(t(f));return u+=e(n(p)),u}
1
+ import{ansiCodesToString as t,reduceAnsiCodes as e,tokenize as i,undoAnsiCodes as n}from"@alcalzone/ansi-tokenize";import{stringWidth as o}from"../ink/stringWidth.js";function filterStartCodes(t){return t.filter(t=>{return!((e=t).code===e.endCode);var e})}export default function sliceAnsi(r,s,f){const a=i(r);let l=[],c=0,d="",u=!1;for(const i of a){const n="ansi"===i.type?0:i.fullWidth?2:o(i.value);if(void 0!==f&&c>=f&&("ansi"===i.type||n>0||!u))break;if("ansi"===i.type)l.push(i),u&&(d+=i.code);else{if(!u&&c>=s){if(s>0&&0===n)continue;u=!0,l=filterStartCodes(e(l)),d=t(l)}u&&(d+=i.value),c+=n}}const p=filterStartCodes(e(l));return d+=t(n(p)),d}
@@ -1 +1 @@
1
- var r=this&&this.__addDisposableResource||function(r,e,o){if(null!=e){if("object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object expected.");var s,t;if(o){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(void 0===s){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],o&&(t=s)}if("function"!=typeof s)throw new TypeError("Object not disposable.");t&&(s=function(){try{t.call(this)}catch(r){return Promise.reject(r)}}),r.stack.push({value:e,dispose:s,async:o})}else o&&r.stack.push({async:!0});return e},e=this&&this.__disposeResources||function(r){return function(e){function fail(o){e.error=e.hasError?new r(o,e.error,"An error was suppressed during disposal."):o,e.hasError=!0}var o,s=0;return function next(){for(;o=e.stack.pop();)try{if(!o.async&&1===s)return s=0,e.stack.push(o),Promise.resolve().then(next);if(o.dispose){var r=o.dispose.call(o.value);if(o.async)return s|=2,Promise.resolve(r).then(next,function(r){return fail(r),next()})}else s|=1}catch(r){fail(r)}if(1===s)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}}("function"==typeof SuppressedError?SuppressedError:function(r,e,o){var s=new Error(o);return s.name="SuppressedError",s.error=r,s.suppressed=e,s});import{feature as o}from"bun:bundle";import{closeSync as s,writeFileSync as t,fsyncSync as n,openSync as i}from"fs";import c from"lodash-es/cloneDeep.js";import{addSlowOperation as a}from"../bootstrap/state.js";import{logForDebugging as l}from"./debug.js";const f=(()=>{const r=process.env.CONTEXT_CODE_SLOW_OPERATION_THRESHOLD_MS??process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(void 0!==r){const e=Number(r);if(!Number.isNaN(e)&&e>=0)return e}return"development"===process.env.NODE_ENV?20:"ant"===process.env.USER_TYPE?300:1/0})();export{f as SLOW_OPERATION_THRESHOLD_MS};let p=!1;export function callerFrame(r){if(!r)return"";for(const e of r.split("\n")){if(e.includes("slowOperations"))continue;const r=e.match(/([^/\\]+?):(\d+):\d+\)?$/);if(r)return` @ ${r[1]}:${r[2]}`}return""}class AntSlowLogger{startTime;args;err;constructor(r){this.startTime=performance.now(),this.args=r,this.err=new Error}[Symbol.dispose](){const r=performance.now()-this.startTime;if(r>f&&!p){p=!0;try{const e=function(r){const e=r[0];let o="";for(let s=0;s<e.length;s++)if(o+=e[s],s+1<r.length){const e=r[s+1];Array.isArray(e)?o+=`Array[${e.length}]`:o+=null!==e&&"object"==typeof e?`Object{${Object.keys(e).length} keys}`:"string"==typeof e?e.length>80?`${e.slice(0,80)}…`:e:String(e)}return o}(this.args)+callerFrame(this.err.stack);l(`[SLOW OPERATION DETECTED] ${e} (${r.toFixed(1)}ms)`),a(e,r)}finally{p=!1}}}}const u={[Symbol.dispose](){}};export const slowLogging=o("SLOW_OPERATION_LOGGING")?function(r,...e){return new AntSlowLogger(arguments)}:function(){return u};export function jsonStringify(o,s,t){const n={stack:[],error:void 0,hasError:!1};try{return r(n,slowLogging`JSON.stringify(${o})`,!1),JSON.stringify(o,s,t)}catch(r){n.error=r,n.hasError=!0}finally{e(n)}}export const jsonParse=(o,s)=>{const t={stack:[],error:void 0,hasError:!1};try{return r(t,slowLogging`JSON.parse(${o})`,!1),void 0===s?JSON.parse(o):JSON.parse(o,s)}catch(r){t.error=r,t.hasError=!0}finally{e(t)}};export function clone(o,s){const t={stack:[],error:void 0,hasError:!1};try{return r(t,slowLogging`structuredClone(${o})`,!1),structuredClone(o,s)}catch(r){t.error=r,t.hasError=!0}finally{e(t)}}export function cloneDeep(o){const s={stack:[],error:void 0,hasError:!1};try{return r(s,slowLogging`cloneDeep(${o})`,!1),c(o)}catch(r){s.error=r,s.hasError=!0}finally{e(s)}}export function writeFileSync_DEPRECATED(o,c,a){const l={stack:[],error:void 0,hasError:!1};try{if(r(l,slowLogging`fs.writeFileSync(${o}, ${c})`,!1),null!==a&&"object"==typeof a&&"flush"in a&&!0===a.flush){const r="object"==typeof a&&"encoding"in a?a.encoding:void 0,e="object"==typeof a&&"mode"in a?a.mode:void 0;let l;try{l=i(o,"w",e),t(l,c,{encoding:r??void 0}),n(l)}finally{void 0!==l&&s(l)}}else t(o,c,a)}catch(r){l.error=r,l.hasError=!0}finally{e(l)}}
1
+ import{feature as r}from"../recovery/bunBundleShim.js";var e=this&&this.__addDisposableResource||function(r,e,o){if(null!=e){if("object"!=typeof e&&"function"!=typeof e)throw new TypeError("Object expected.");var t,s;if(o){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");t=e[Symbol.asyncDispose]}if(void 0===t){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");t=e[Symbol.dispose],o&&(s=t)}if("function"!=typeof t)throw new TypeError("Object not disposable.");s&&(t=function(){try{s.call(this)}catch(r){return Promise.reject(r)}}),r.stack.push({value:e,dispose:t,async:o})}else o&&r.stack.push({async:!0});return e},o=this&&this.__disposeResources||function(r){return function(e){function fail(o){e.error=e.hasError?new r(o,e.error,"An error was suppressed during disposal."):o,e.hasError=!0}var o,t=0;return function next(){for(;o=e.stack.pop();)try{if(!o.async&&1===t)return t=0,e.stack.push(o),Promise.resolve().then(next);if(o.dispose){var r=o.dispose.call(o.value);if(o.async)return t|=2,Promise.resolve(r).then(next,function(r){return fail(r),next()})}else t|=1}catch(r){fail(r)}if(1===t)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}}("function"==typeof SuppressedError?SuppressedError:function(r,e,o){var t=new Error(o);return t.name="SuppressedError",t.error=r,t.suppressed=e,t});import{closeSync as t,writeFileSync as s,fsyncSync as n,openSync as i}from"fs";import c from"lodash-es/cloneDeep.js";import{addSlowOperation as a}from"../bootstrap/state.js";import{logForDebugging as l}from"./debug.js";const f=(()=>{const r=process.env.CONTEXT_CODE_SLOW_OPERATION_THRESHOLD_MS??process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(void 0!==r){const e=Number(r);if(!Number.isNaN(e)&&e>=0)return e}return"development"===process.env.NODE_ENV?20:"ant"===process.env.USER_TYPE?300:1/0})();export{f as SLOW_OPERATION_THRESHOLD_MS};let p=!1;export function callerFrame(r){if(!r)return"";for(const e of r.split("\n")){if(e.includes("slowOperations"))continue;const r=e.match(/([^/\\]+?):(\d+):\d+\)?$/);if(r)return` @ ${r[1]}:${r[2]}`}return""}class AntSlowLogger{startTime;args;err;constructor(r){this.startTime=performance.now(),this.args=r,this.err=new Error}[Symbol.dispose](){const r=performance.now()-this.startTime;if(r>f&&!p){p=!0;try{const e=function(r){const e=r[0];let o="";for(let t=0;t<e.length;t++)if(o+=e[t],t+1<r.length){const e=r[t+1];Array.isArray(e)?o+=`Array[${e.length}]`:o+=null!==e&&"object"==typeof e?`Object{${Object.keys(e).length} keys}`:"string"==typeof e?e.length>80?`${e.slice(0,80)}…`:e:String(e)}return o}(this.args)+callerFrame(this.err.stack);l(`[SLOW OPERATION DETECTED] ${e} (${r.toFixed(1)}ms)`),a(e,r)}finally{p=!1}}}}const u={[Symbol.dispose](){}};export const slowLogging=r("SLOW_OPERATION_LOGGING")?function(r,...e){return new AntSlowLogger(arguments)}:function(){return u};export function jsonStringify(r,t,s){const n={stack:[],error:void 0,hasError:!1};try{e(n,slowLogging`JSON.stringify(${r})`,!1);return JSON.stringify(r,t,s)}catch(r){n.error=r,n.hasError=!0}finally{o(n)}}export const jsonParse=(r,t)=>{const s={stack:[],error:void 0,hasError:!1};try{e(s,slowLogging`JSON.parse(${r})`,!1);return void 0===t?JSON.parse(r):JSON.parse(r,t)}catch(r){s.error=r,s.hasError=!0}finally{o(s)}};export function clone(r,t){const s={stack:[],error:void 0,hasError:!1};try{e(s,slowLogging`structuredClone(${r})`,!1);return structuredClone(r,t)}catch(r){s.error=r,s.hasError=!0}finally{o(s)}}export function cloneDeep(r){const t={stack:[],error:void 0,hasError:!1};try{e(t,slowLogging`cloneDeep(${r})`,!1);return c(r)}catch(r){t.error=r,t.hasError=!0}finally{o(t)}}export function writeFileSync_DEPRECATED(r,c,a){const l={stack:[],error:void 0,hasError:!1};try{e(l,slowLogging`fs.writeFileSync(${r}, ${c})`,!1);if(null!==a&&"object"==typeof a&&"flush"in a&&!0===a.flush){const e="object"==typeof a&&"encoding"in a?a.encoding:void 0,o="object"==typeof a&&"mode"in a?a.mode:void 0;let l;try{l=i(r,"w",o),s(l,c,{encoding:e??void 0}),n(l)}finally{void 0!==l&&t(l)}}else s(r,c,a)}catch(r){l.error=r,l.hasError=!0}finally{o(l)}}
@@ -1 +1 @@
1
- import{getTeamName as e}from"./teammate.js";export function getStandaloneAgentName(t){if(!e())return t.standaloneAgentContext?.name}
1
+ import{getTeamName as t}from"./teammate.js";export function getStandaloneAgentName(e){if(!t())return e.standaloneAgentContext?.name}
@@ -1 +1 @@
1
- import{dirname as t,join as e}from"path";import{appendFileSync as r}from"fs";import{getSessionId as o}from"src/bootstrap/state.js";import{logEvent as n}from"../services/analytics/index.js";import{logForDebugging as i}from"./debug.js";import{getClaudeConfigHomeDir as s,isEnvTruthy as a}from"./envUtils.js";import{getFsImplementation as p}from"./fsOperations.js";import{formatMs as f,formatTimelineLine as m,getPerformance as c}from"./profilerBase.js";import{writeFileSync_DEPRECATED as u}from"./slowOperations.js";const g=a(process.env.CONTEXT_CODE_PROFILE_STARTUP)||a(process.env.CLAUDE_CODE_PROFILE_STARTUP),l="ant"===process.env.USER_TYPE||Math.random()<.005,_=g||l,T=[],h={import_time:["cli_entry","main_tsx_imports_loaded"],init_time:["init_function_start","init_function_end"],settings_time:["eagerLoadSettings_start","eagerLoadSettings_end"],total_time:["cli_entry","main_after_run"]};_&&profileCheckpoint("profiler_initialized");export function profileCheckpoint(t){if(_){if(c().mark(t),process.env.CONTEXT_CODE_CHECKPOINT_LOG)try{r(process.env.CONTEXT_CODE_CHECKPOINT_LOG,`${(new Date).toISOString()} ${t}\n`,"utf8")}catch{}g&&T.push(process.memoryUsage())}}function getReport(){if(!g)return"Startup profiling not enabled";const t=c().getEntriesByType("mark");if(0===t.length)return"No profiling checkpoints recorded";const e=[];e.push("=".repeat(80)),e.push("STARTUP PROFILING REPORT"),e.push("=".repeat(80)),e.push("");let r=0;for(const[o,n]of t.entries())e.push(m(n.startTime,n.startTime-r,n.name,T[o],8,7)),r=n.startTime;const o=t[t.length-1];return e.push(""),e.push(`Total startup time: ${f(o?.startTime??0)}ms`),e.push("=".repeat(80)),e.join("\n")}let d=!1;export function profileReport(){if(!d&&(d=!0,logStartupPerf(),g)){const e=getStartupPerfLogPath(),r=t(e);p().mkdirSync(r),u(e,getReport(),{encoding:"utf8",flush:!0}),i("Startup profiling report:"),i(getReport())}}export function isDetailedProfilingEnabled(){return g}export function getStartupPerfLogPath(){return e(s(),"startup-perf",`${o()}.txt`)}export function logStartupPerf(){if(!l)return;const t=c().getEntriesByType("mark");if(0===t.length)return;const e=new Map;for(const r of t)e.set(r.name,r.startTime);const r={};for(const[t,[o,n]]of Object.entries(h)){const i=e.get(o),s=e.get(n);void 0!==i&&void 0!==s&&(r[`${t}_ms`]=Math.round(s-i))}r.checkpoint_count=t.length,n("tengu_startup_perf",r)}
1
+ import{dirname as t,join as e}from"path";import{appendFileSync as r}from"fs";import{getSessionId as o}from"../bootstrap/state.js";import{logEvent as n}from"../services/analytics/index.js";import{logForDebugging as i}from"./debug.js";import{getClaudeConfigHomeDir as s,isEnvTruthy as p}from"./envUtils.js";import{getFsImplementation as a}from"./fsOperations.js";import{formatMs as f,formatTimelineLine as c,getPerformance as m}from"./profilerBase.js";import{writeFileSync_DEPRECATED as u}from"./slowOperations.js";const _=p(process.env.CONTEXT_CODE_PROFILE_STARTUP)||p(process.env.CLAUDE_CODE_PROFILE_STARTUP),g="ant"===process.env.USER_TYPE||Math.random()<.005,l=_||g,h=[],T={import_time:["cli_entry","main_tsx_imports_loaded"],init_time:["init_function_start","init_function_end"],settings_time:["eagerLoadSettings_start","eagerLoadSettings_end"],total_time:["cli_entry","main_after_run"]};l&&profileCheckpoint("profiler_initialized");export function profileCheckpoint(t){if(!l)return;if(m().mark(t),process.env.CONTEXT_CODE_CHECKPOINT_LOG)try{r(process.env.CONTEXT_CODE_CHECKPOINT_LOG,`${(new Date).toISOString()} ${t}\n`,"utf8")}catch{}_&&h.push(process.memoryUsage())}function getReport(){if(!_)return"Startup profiling not enabled";const t=m().getEntriesByType("mark");if(0===t.length)return"No profiling checkpoints recorded";const e=[];e.push("=".repeat(80)),e.push("STARTUP PROFILING REPORT"),e.push("=".repeat(80)),e.push("");let r=0;for(const[o,n]of t.entries())e.push(c(n.startTime,n.startTime-r,n.name,h[o],8,7)),r=n.startTime;const o=t[t.length-1];return e.push(""),e.push(`Total startup time: ${f(o?.startTime??0)}ms`),e.push("=".repeat(80)),e.join("\n")}let d=!1;export function profileReport(){if(!d&&(d=!0,logStartupPerf(),_)){const e=getStartupPerfLogPath(),r=t(e);a().mkdirSync(r),u(e,getReport(),{encoding:"utf8",flush:!0}),i("Startup profiling report:"),i(getReport())}}export function isDetailedProfilingEnabled(){return _}export function getStartupPerfLogPath(){return e(s(),"startup-perf",`${o()}.txt`)}export function logStartupPerf(){if(!g)return;const t=m().getEntriesByType("mark");if(0===t.length)return;const e=new Map;for(const r of t)e.set(r.name,r.startTime);const r={};for(const[t,[o,n]]of Object.entries(T)){const i=e.get(o),s=e.get(n);void 0!==i&&void 0!==s&&(r[`${t}_ms`]=Math.round(s-i))}r.checkpoint_count=t.length,n("tengu_startup_perf",r)}
@@ -1 +1 @@
1
- import{Fragment as t,jsx as n}from"react/jsx-runtime";import{c as r}from"react/compiler-runtime";import{useLayoutEffect as e}from"react";import{PassThrough as i}from"stream";import o from"strip-ansi";import{render as s,useApp as a}from"../ink.js";function RenderOnceAndExit(i){const o=r(5),{children:s}=i,{exit:c}=a();let m,u,d;return o[0]!==c?(m=()=>{const t=setTimeout(c,0);return()=>clearTimeout(t)},u=[c],o[0]=c,o[1]=m,o[2]=u):(m=o[1],u=o[2]),e(m,u),o[3]!==s?(d=n(t,{children:s}),o[3]=s,o[4]=d):d=o[4],d}export function renderToAnsiString(t,r){return new Promise(async e=>{let o="";const a=new i;void 0!==r&&(a.columns=r),a.on("data",t=>{o+=t.toString()});const c=await s(n(RenderOnceAndExit,{children:t}),{stdout:a,patchConsole:!1});await c.waitUntilExit(),await e(function(t){const n=t.indexOf("[?2026h");if(-1===n)return t;const r=n+8,e=t.indexOf("[?2026l",r);return-1===e?t:t.slice(r,e)}(o))})}export async function renderToString(t,n){const r=await renderToAnsiString(t,n);return o(r)}
1
+ import{Fragment as t,jsx as n}from"react/jsx-runtime";import{c as r}from"react/compiler-runtime";import{useLayoutEffect as e}from"react";import{PassThrough as i}from"stream";import o from"strip-ansi";import{render as c,useApp as s}from"../ink.js";function RenderOnceAndExit(i){const o=r(5),{children:c}=i,{exit:a}=s();let m,u,d;return o[0]!==a?(m=()=>{const t=setTimeout(a,0);return()=>clearTimeout(t)},u=[a],o[0]=a,o[1]=m,o[2]=u):(m=o[1],u=o[2]),e(m,u),o[3]!==c?(d=n(t,{children:c}),o[3]=c,o[4]=d):d=o[4],d}const a="[?2026h";export function renderToAnsiString(t,r){return new Promise(async e=>{let o="";const s=new i;void 0!==r&&(s.columns=r),s.on("data",t=>{o+=t.toString()});const m=await c(n(RenderOnceAndExit,{children:t}),{stdout:s,patchConsole:!1});await m.waitUntilExit(),await e(function(t){const n=t.indexOf(a);if(-1===n)return t;const r=n+8,e=t.indexOf("[?2026l",r);return-1===e?t:t.slice(r,e)}(o))})}export async function renderToString(t,n){const r=await renderToAnsiString(t,n);return o(r)}