@within-7/minto 0.3.9 → 0.4.0

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 (383) hide show
  1. package/dist/Tool.js.map +2 -2
  2. package/dist/commands/agents/AgentsCommand.js +461 -657
  3. package/dist/commands/agents/AgentsCommand.js.map +2 -2
  4. package/dist/commands/agents/types.js +1 -0
  5. package/dist/commands/agents/types.js.map +2 -2
  6. package/dist/commands/agents/utils/fileOperations.js +96 -36
  7. package/dist/commands/agents/utils/fileOperations.js.map +3 -3
  8. package/dist/commands/agents/utils/index.js +3 -1
  9. package/dist/commands/agents/utils/index.js.map +2 -2
  10. package/dist/commands/context.js +54 -23
  11. package/dist/commands/context.js.map +2 -2
  12. package/dist/commands/ctx_viz.js +1 -1
  13. package/dist/commands/effort.js +87 -0
  14. package/dist/commands/effort.js.map +7 -0
  15. package/dist/commands/export.js +684 -94
  16. package/dist/commands/export.js.map +2 -2
  17. package/dist/commands/ide.js +18 -0
  18. package/dist/commands/ide.js.map +7 -0
  19. package/dist/commands/language.js +19 -46
  20. package/dist/commands/language.js.map +2 -2
  21. package/dist/commands/mcp-interactive.js +425 -217
  22. package/dist/commands/mcp-interactive.js.map +2 -2
  23. package/dist/commands/memory.js +168 -0
  24. package/dist/commands/memory.js.map +7 -0
  25. package/dist/commands/model.js +457 -65
  26. package/dist/commands/model.js.map +2 -2
  27. package/dist/commands/outputStyle.js +64 -0
  28. package/dist/commands/outputStyle.js.map +7 -0
  29. package/dist/commands/permissions.js +75 -49
  30. package/dist/commands/permissions.js.map +2 -2
  31. package/dist/commands/plugin/utils.js +33 -1
  32. package/dist/commands/plugin/utils.js.map +2 -2
  33. package/dist/commands/plugin.js +891 -185
  34. package/dist/commands/plugin.js.map +3 -3
  35. package/dist/commands/refreshCommands.js +2 -0
  36. package/dist/commands/refreshCommands.js.map +2 -2
  37. package/dist/commands/resume.js +1 -1
  38. package/dist/commands/resume.js.map +1 -1
  39. package/dist/commands/review.js +51 -0
  40. package/dist/commands/review.js.map +7 -0
  41. package/dist/commands/sandbox.js +168 -70
  42. package/dist/commands/sandbox.js.map +2 -2
  43. package/dist/commands/setup.js +593 -107
  44. package/dist/commands/setup.js.map +2 -2
  45. package/dist/commands/stats.js +188 -131
  46. package/dist/commands/stats.js.map +2 -2
  47. package/dist/commands/status.js +75 -13
  48. package/dist/commands/status.js.map +2 -2
  49. package/dist/commands/terminalSetup.js +6 -0
  50. package/dist/commands/terminalSetup.js.map +2 -2
  51. package/dist/commands/undo.js +146 -174
  52. package/dist/commands/undo.js.map +2 -2
  53. package/dist/commands/vim.js +22 -0
  54. package/dist/commands/vim.js.map +7 -0
  55. package/dist/commands.js +12 -0
  56. package/dist/commands.js.map +2 -2
  57. package/dist/components/Help.js +165 -32
  58. package/dist/components/Help.js.map +2 -2
  59. package/dist/components/HighlightedCode.js +1 -0
  60. package/dist/components/HighlightedCode.js.map +2 -2
  61. package/dist/components/InfoPanel/InfoPanel.js +123 -0
  62. package/dist/components/InfoPanel/InfoPanel.js.map +7 -0
  63. package/dist/components/InfoPanel/index.js +5 -0
  64. package/dist/components/InfoPanel/index.js.map +7 -0
  65. package/dist/components/InfoPanel/types.js +1 -0
  66. package/dist/components/InfoPanel/types.js.map +7 -0
  67. package/dist/components/ModelSelector/BrandTextInput.js +43 -0
  68. package/dist/components/ModelSelector/BrandTextInput.js.map +7 -0
  69. package/dist/components/ModelSelector/ModelSelector.js +590 -565
  70. package/dist/components/ModelSelector/ModelSelector.js.map +2 -2
  71. package/dist/components/ModelSelector/WizardContainer.js +45 -0
  72. package/dist/components/ModelSelector/WizardContainer.js.map +7 -0
  73. package/dist/components/ModelSelector/index.js +1 -3
  74. package/dist/components/ModelSelector/index.js.map +2 -2
  75. package/dist/components/PromptInput.js +26 -11
  76. package/dist/components/PromptInput.js.map +2 -2
  77. package/dist/components/PulseLabel.js +44 -0
  78. package/dist/components/PulseLabel.js.map +7 -0
  79. package/dist/components/RequestStatusIndicator.js +1 -1
  80. package/dist/components/RequestStatusIndicator.js.map +1 -1
  81. package/dist/components/SimpleSelector/SimpleSelector.js +154 -0
  82. package/dist/components/SimpleSelector/SimpleSelector.js.map +7 -0
  83. package/dist/components/SimpleSelector/index.js +5 -0
  84. package/dist/components/SimpleSelector/index.js.map +7 -0
  85. package/dist/components/SimpleSelector/types.js +1 -0
  86. package/dist/components/SimpleSelector/types.js.map +7 -0
  87. package/dist/components/Spinner.js +12 -42
  88. package/dist/components/Spinner.js.map +3 -3
  89. package/dist/components/StartupStatus.js +57 -0
  90. package/dist/components/StartupStatus.js.map +7 -0
  91. package/dist/components/StatusOverlayContent.js +21 -0
  92. package/dist/components/StatusOverlayContent.js.map +7 -0
  93. package/dist/components/SubagentBlock.js +43 -6
  94. package/dist/components/SubagentBlock.js.map +2 -2
  95. package/dist/components/TabbedListView/ScrollableList.js +31 -5
  96. package/dist/components/TabbedListView/ScrollableList.js.map +2 -2
  97. package/dist/components/TabbedListView/TabBar.js +13 -8
  98. package/dist/components/TabbedListView/TabBar.js.map +2 -2
  99. package/dist/components/TabbedListView/TabbedListView.js +123 -48
  100. package/dist/components/TabbedListView/TabbedListView.js.map +2 -2
  101. package/dist/components/TodoPanel.js +1 -1
  102. package/dist/components/TodoPanel.js.map +1 -1
  103. package/dist/components/ToolUseLoader.js +5 -0
  104. package/dist/components/ToolUseLoader.js.map +2 -2
  105. package/dist/components/TrustDialog.js +0 -2
  106. package/dist/components/TrustDialog.js.map +2 -2
  107. package/dist/components/messages/TaskInModuleView.js +1 -1
  108. package/dist/components/messages/TaskInModuleView.js.map +2 -2
  109. package/dist/components/messages/TaskToolMessage.js +1 -1
  110. package/dist/components/messages/TaskToolMessage.js.map +2 -2
  111. package/dist/components/messages/UserPromptMessage.js +6 -1
  112. package/dist/components/messages/UserPromptMessage.js.map +2 -2
  113. package/dist/constants/modelCapabilities.js +103 -18
  114. package/dist/constants/modelCapabilities.js.map +2 -2
  115. package/dist/constants/product.js +2 -0
  116. package/dist/constants/product.js.map +2 -2
  117. package/dist/constants/prompts/agentPrompt.js +30 -0
  118. package/dist/constants/prompts/agentPrompt.js.map +7 -0
  119. package/dist/constants/prompts/codeConventions.js +27 -0
  120. package/dist/constants/prompts/codeConventions.js.map +7 -0
  121. package/dist/constants/prompts/doingTasks.js +15 -0
  122. package/dist/constants/prompts/doingTasks.js.map +7 -0
  123. package/dist/constants/prompts/envInfo.js +17 -0
  124. package/dist/constants/prompts/envInfo.js.map +7 -0
  125. package/dist/constants/prompts/executingWithCare.js +17 -0
  126. package/dist/constants/prompts/executingWithCare.js.map +7 -0
  127. package/dist/constants/prompts/identity.js +10 -0
  128. package/dist/constants/prompts/identity.js.map +7 -0
  129. package/dist/constants/prompts/index.js +78 -0
  130. package/dist/constants/prompts/index.js.map +7 -0
  131. package/dist/constants/prompts/taskManagement.js +60 -0
  132. package/dist/constants/prompts/taskManagement.js.map +7 -0
  133. package/dist/constants/prompts/toneAndStyle.js +62 -0
  134. package/dist/constants/prompts/toneAndStyle.js.map +7 -0
  135. package/dist/constants/prompts/toolUsagePolicy.js +38 -0
  136. package/dist/constants/prompts/toolUsagePolicy.js.map +7 -0
  137. package/dist/constants/prompts.js +5 -176
  138. package/dist/constants/prompts.js.map +2 -2
  139. package/dist/constants/providerRegistry.js +235 -0
  140. package/dist/constants/providerRegistry.js.map +7 -0
  141. package/dist/constants/providers.js +35 -0
  142. package/dist/constants/providers.js.map +7 -0
  143. package/dist/context/PermissionContext.js +0 -1
  144. package/dist/context/PermissionContext.js.map +2 -2
  145. package/dist/context.js +87 -31
  146. package/dist/context.js.map +2 -2
  147. package/dist/core/backupHook.js +29 -0
  148. package/dist/core/backupHook.js.map +7 -0
  149. package/dist/core/config/defaults.js +11 -2
  150. package/dist/core/config/defaults.js.map +2 -2
  151. package/dist/core/config/schema.js +21 -3
  152. package/dist/core/config/schema.js.map +2 -2
  153. package/dist/core/costTracker.js +18 -16
  154. package/dist/core/costTracker.js.map +2 -2
  155. package/dist/core/index.js +0 -1
  156. package/dist/core/index.js.map +2 -2
  157. package/dist/core/tokenStatsManager.js +22 -4
  158. package/dist/core/tokenStatsManager.js.map +2 -2
  159. package/dist/cost-tracker.js +0 -16
  160. package/dist/cost-tracker.js.map +2 -2
  161. package/dist/entrypoints/bootstrap.js +3 -1
  162. package/dist/entrypoints/bootstrap.js.map +2 -2
  163. package/dist/entrypoints/cli.js +81 -68
  164. package/dist/entrypoints/cli.js.map +2 -2
  165. package/dist/hooks/useAgentTokenStats.js +1 -1
  166. package/dist/hooks/useAgentTokenStats.js.map +2 -2
  167. package/dist/hooks/useAgentTranscripts.js +2 -1
  168. package/dist/hooks/useAgentTranscripts.js.map +2 -2
  169. package/dist/hooks/useBackgroundShells.js +29 -0
  170. package/dist/hooks/useBackgroundShells.js.map +7 -0
  171. package/dist/hooks/useCanUseTool.js +1 -1
  172. package/dist/hooks/useCanUseTool.js.map +2 -2
  173. package/dist/hooks/useDeferredLoading.js +64 -0
  174. package/dist/hooks/useDeferredLoading.js.map +7 -0
  175. package/dist/hooks/useHookStatus.js +1 -1
  176. package/dist/hooks/useHookStatus.js.map +2 -2
  177. package/dist/hooks/useSessionTracking.js +55 -0
  178. package/dist/hooks/useSessionTracking.js.map +7 -0
  179. package/dist/hooks/useTerminalSize.js +21 -0
  180. package/dist/hooks/useTerminalSize.js.map +2 -2
  181. package/dist/hooks/useTextInput.js +1 -0
  182. package/dist/hooks/useTextInput.js.map +2 -2
  183. package/dist/hooks/useUnifiedCompletion.js +3 -2
  184. package/dist/hooks/useUnifiedCompletion.js.map +2 -2
  185. package/dist/i18n/locales/en.js +299 -1
  186. package/dist/i18n/locales/en.js.map +2 -2
  187. package/dist/i18n/locales/zh-CN.js +300 -2
  188. package/dist/i18n/locales/zh-CN.js.map +2 -2
  189. package/dist/i18n/types.js.map +1 -1
  190. package/dist/messages.js +41 -17
  191. package/dist/messages.js.map +2 -2
  192. package/dist/permissions.js +94 -1
  193. package/dist/permissions.js.map +2 -2
  194. package/dist/query.js +27 -19
  195. package/dist/query.js.map +2 -2
  196. package/dist/screens/REPL.js +83 -74
  197. package/dist/screens/REPL.js.map +2 -2
  198. package/dist/services/adapters/responsesAPI.js +6 -0
  199. package/dist/services/adapters/responsesAPI.js.map +2 -2
  200. package/dist/services/agentTeams/index.js +35 -0
  201. package/dist/services/agentTeams/index.js.map +7 -0
  202. package/dist/services/agentTeams/mailbox.js +114 -0
  203. package/dist/services/agentTeams/mailbox.js.map +7 -0
  204. package/dist/services/agentTeams/teamManager.js +149 -0
  205. package/dist/services/agentTeams/teamManager.js.map +7 -0
  206. package/dist/services/agentTeams/teamTaskStore.js +114 -0
  207. package/dist/services/agentTeams/teamTaskStore.js.map +7 -0
  208. package/dist/services/agentTeams/teammateSpawner.js +80 -0
  209. package/dist/services/agentTeams/teammateSpawner.js.map +7 -0
  210. package/dist/services/checkpointManager.js +16 -3
  211. package/dist/services/checkpointManager.js.map +2 -2
  212. package/dist/services/claude.js +19 -1728
  213. package/dist/services/claude.js.map +3 -3
  214. package/dist/services/customCommands.js +30 -8
  215. package/dist/services/customCommands.js.map +2 -2
  216. package/dist/services/gpt5ConnectionTest.js +4 -2
  217. package/dist/services/gpt5ConnectionTest.js.map +2 -2
  218. package/dist/services/hookExecutor.js +411 -127
  219. package/dist/services/hookExecutor.js.map +2 -2
  220. package/dist/services/llm/anthropicProvider.js +807 -0
  221. package/dist/services/llm/anthropicProvider.js.map +7 -0
  222. package/dist/services/llm/dispatch.js +218 -0
  223. package/dist/services/llm/dispatch.js.map +7 -0
  224. package/dist/services/llm/index.js +44 -0
  225. package/dist/services/llm/index.js.map +7 -0
  226. package/dist/services/llm/mintoContext.js +69 -0
  227. package/dist/services/llm/mintoContext.js.map +7 -0
  228. package/dist/services/llm/openaiProvider.js +622 -0
  229. package/dist/services/llm/openaiProvider.js.map +7 -0
  230. package/dist/services/llm/types.js +157 -0
  231. package/dist/services/llm/types.js.map +7 -0
  232. package/dist/services/mcpClient.js +183 -33
  233. package/dist/services/mcpClient.js.map +2 -2
  234. package/dist/services/notifier.js +14 -0
  235. package/dist/services/notifier.js.map +2 -2
  236. package/dist/services/oauth.js +4 -2
  237. package/dist/services/oauth.js.map +2 -2
  238. package/dist/services/openai.js +66 -56
  239. package/dist/services/openai.js.map +3 -3
  240. package/dist/services/outputStyles.js +102 -21
  241. package/dist/services/outputStyles.js.map +2 -2
  242. package/dist/services/plugins/lspServers.js +1 -1
  243. package/dist/services/plugins/lspServers.js.map +2 -2
  244. package/dist/services/plugins/pluginRuntime.js +2 -1
  245. package/dist/services/plugins/pluginRuntime.js.map +2 -2
  246. package/dist/services/plugins/pluginValidation.js +10 -3
  247. package/dist/services/plugins/pluginValidation.js.map +2 -2
  248. package/dist/services/plugins/skillMarketplace.js +20 -9
  249. package/dist/services/plugins/skillMarketplace.js.map +2 -2
  250. package/dist/services/sentry.js +1 -1
  251. package/dist/services/sentry.js.map +2 -2
  252. package/dist/services/sessionMemory.js +16 -3
  253. package/dist/services/sessionMemory.js.map +2 -2
  254. package/dist/services/systemReminder.js +367 -9
  255. package/dist/services/systemReminder.js.map +2 -2
  256. package/dist/services/taskStore.js +19 -0
  257. package/dist/services/taskStore.js.map +2 -2
  258. package/dist/tools/ArchitectTool/ArchitectTool.js.map +1 -1
  259. package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js.map +1 -1
  260. package/dist/tools/BashOutputTool/BashOutputTool.js.map +1 -1
  261. package/dist/tools/BashTool/BashTool.js +28 -0
  262. package/dist/tools/BashTool/BashTool.js.map +2 -2
  263. package/dist/tools/FileEditTool/FileEditTool.js +8 -1
  264. package/dist/tools/FileEditTool/FileEditTool.js.map +2 -2
  265. package/dist/tools/FileReadTool/FileReadTool.js +14 -0
  266. package/dist/tools/FileReadTool/FileReadTool.js.map +2 -2
  267. package/dist/tools/FileWriteTool/FileWriteTool.js +10 -1
  268. package/dist/tools/FileWriteTool/FileWriteTool.js.map +2 -2
  269. package/dist/tools/GlobTool/GlobTool.js.map +1 -1
  270. package/dist/tools/GrepTool/GrepTool.js.map +1 -1
  271. package/dist/tools/KillShellTool/KillShellTool.js.map +1 -1
  272. package/dist/tools/ListMcpResourcesTool/ListMcpResourcesTool.js.map +2 -2
  273. package/dist/tools/LspTool/LspTool.js +11 -2
  274. package/dist/tools/LspTool/LspTool.js.map +2 -2
  275. package/dist/tools/MCPTool/MCPTool.js.map +1 -1
  276. package/dist/tools/MemoryReadTool/MemoryReadTool.js +2 -1
  277. package/dist/tools/MemoryReadTool/MemoryReadTool.js.map +2 -2
  278. package/dist/tools/MemoryWriteTool/MemoryWriteTool.js +2 -1
  279. package/dist/tools/MemoryWriteTool/MemoryWriteTool.js.map +2 -2
  280. package/dist/tools/MultiEditTool/MultiEditTool.js +7 -0
  281. package/dist/tools/MultiEditTool/MultiEditTool.js.map +2 -2
  282. package/dist/tools/NotebookEditTool/NotebookEditTool.js +2 -0
  283. package/dist/tools/NotebookEditTool/NotebookEditTool.js.map +2 -2
  284. package/dist/tools/NotebookReadTool/NotebookReadTool.js.map +1 -1
  285. package/dist/tools/PlanModeTool/EnterPlanModeTool.js +8 -2
  286. package/dist/tools/PlanModeTool/EnterPlanModeTool.js.map +2 -2
  287. package/dist/tools/PlanModeTool/ExitPlanModeTool.js +2 -0
  288. package/dist/tools/PlanModeTool/ExitPlanModeTool.js.map +2 -2
  289. package/dist/tools/ReadMcpResourceTool/ReadMcpResourceTool.js.map +1 -1
  290. package/dist/tools/SlashCommandTool/SlashCommandTool.js +174 -18
  291. package/dist/tools/SlashCommandTool/SlashCommandTool.js.map +3 -3
  292. package/dist/tools/TaskCreateTool/TaskCreateTool.js.map +1 -1
  293. package/dist/tools/TaskGetTool/TaskGetTool.js.map +1 -1
  294. package/dist/tools/TaskListTool/TaskListTool.js.map +1 -1
  295. package/dist/tools/TaskOutputTool/TaskOutputTool.js.map +1 -1
  296. package/dist/tools/TaskStopTool/TaskStopTool.js.map +1 -1
  297. package/dist/tools/TaskTool/TaskTool.js +84 -11
  298. package/dist/tools/TaskTool/TaskTool.js.map +2 -2
  299. package/dist/tools/TaskTool/prompt.js +12 -6
  300. package/dist/tools/TaskTool/prompt.js.map +2 -2
  301. package/dist/tools/TaskUpdateTool/TaskUpdateTool.js.map +1 -1
  302. package/dist/tools/ThinkTool/ThinkTool.js.map +1 -1
  303. package/dist/tools/TodoWriteTool/TodoWriteTool.js.map +1 -1
  304. package/dist/tools/URLFetcherTool/URLFetcherTool.js.map +1 -1
  305. package/dist/tools/WebSearchTool/WebSearchTool.js.map +1 -1
  306. package/dist/tools/WebSearchTool/searchProviders.js +2 -1
  307. package/dist/tools/WebSearchTool/searchProviders.js.map +2 -2
  308. package/dist/tools/lsTool/lsTool.js.map +2 -2
  309. package/dist/tools/lsTool/prompt.js.map +1 -1
  310. package/dist/tools.js +14 -3
  311. package/dist/tools.js.map +2 -2
  312. package/dist/types/PermissionMode.js +21 -1
  313. package/dist/types/PermissionMode.js.map +2 -2
  314. package/dist/types/agentTeams.js +1 -0
  315. package/dist/types/agentTeams.js.map +7 -0
  316. package/dist/types/hooks.js +8 -2
  317. package/dist/types/hooks.js.map +2 -2
  318. package/dist/types/plugin.js +3 -5
  319. package/dist/types/plugin.js.map +2 -2
  320. package/dist/utils/agentHookExecutor.js +1 -4
  321. package/dist/utils/agentHookExecutor.js.map +2 -2
  322. package/dist/utils/agentLoader.js +91 -15
  323. package/dist/utils/agentLoader.js.map +2 -2
  324. package/dist/utils/agentMemory.js.map +2 -2
  325. package/dist/utils/animationManager.js +1 -1
  326. package/dist/utils/animationManager.js.map +2 -2
  327. package/dist/utils/ask.js +1 -1
  328. package/dist/utils/async.js +5 -1
  329. package/dist/utils/async.js.map +2 -2
  330. package/dist/utils/autoCompactCore.js +60 -0
  331. package/dist/utils/autoCompactCore.js.map +2 -2
  332. package/dist/utils/claudeCodeSync.js +439 -0
  333. package/dist/utils/claudeCodeSync.js.map +7 -0
  334. package/dist/utils/config.js +27 -151
  335. package/dist/utils/config.js.map +2 -2
  336. package/dist/utils/configSchema.js +227 -0
  337. package/dist/utils/configSchema.js.map +7 -0
  338. package/dist/utils/debugLogger.js.map +2 -2
  339. package/dist/utils/env.js +4 -3
  340. package/dist/utils/env.js.map +2 -2
  341. package/dist/utils/envConfig.js +34 -0
  342. package/dist/utils/envConfig.js.map +3 -3
  343. package/dist/utils/execFileNoThrow.js +2 -1
  344. package/dist/utils/execFileNoThrow.js.map +2 -2
  345. package/dist/utils/gpt5.js +146 -0
  346. package/dist/utils/gpt5.js.map +7 -0
  347. package/dist/utils/hookManager.js +374 -140
  348. package/dist/utils/hookManager.js.map +2 -2
  349. package/dist/utils/markdown.js +47 -0
  350. package/dist/utils/markdown.js.map +2 -2
  351. package/dist/utils/marketplaceManager.js +80 -43
  352. package/dist/utils/marketplaceManager.js.map +2 -2
  353. package/dist/utils/memoizeWithTTL.js +25 -0
  354. package/dist/utils/memoizeWithTTL.js.map +7 -0
  355. package/dist/utils/messages.js +2 -2
  356. package/dist/utils/messages.js.map +2 -2
  357. package/dist/utils/model.js +34 -9
  358. package/dist/utils/model.js.map +2 -2
  359. package/dist/utils/pluginInstaller.js +68 -29
  360. package/dist/utils/pluginInstaller.js.map +2 -2
  361. package/dist/utils/pluginLoader.js +249 -57
  362. package/dist/utils/pluginLoader.js.map +2 -2
  363. package/dist/utils/repoFetcher.js +110 -0
  364. package/dist/utils/repoFetcher.js.map +7 -0
  365. package/dist/utils/safeFetch.js +45 -0
  366. package/dist/utils/safeFetch.js.map +7 -0
  367. package/dist/utils/skillLoader.js +77 -12
  368. package/dist/utils/skillLoader.js.map +2 -2
  369. package/dist/utils/streamingState.js +52 -0
  370. package/dist/utils/streamingState.js.map +7 -0
  371. package/dist/utils/stringSubstitution.js +4 -5
  372. package/dist/utils/stringSubstitution.js.map +2 -2
  373. package/dist/utils/style.js +6 -3
  374. package/dist/utils/style.js.map +2 -2
  375. package/dist/utils/teamConfig.js +162 -16
  376. package/dist/utils/teamConfig.js.map +2 -2
  377. package/dist/utils/terminal.js +1 -1
  378. package/dist/utils/terminal.js.map +2 -2
  379. package/dist/utils/toolRiskClassification.js +0 -6
  380. package/dist/utils/toolRiskClassification.js.map +2 -2
  381. package/dist/version.js +2 -2
  382. package/dist/version.js.map +1 -1
  383. package/package.json +7 -6
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/constants/prompts/toolUsagePolicy.ts"],
4
+ "sourcesContent": ["import { BashTool } from '@tools/BashTool/BashTool'\n\nexport function getToolUsagePolicyPrompt(): string {\n return `# Tool usage policy\n- When doing file search, prefer to use the Task tool in order to reduce context usage.\n- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance.\n- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\n- It is always better to speculatively read multiple files as a batch that are potentially useful.\n- It is always better to speculatively perform multiple searches as a batch that are potentially useful.\n- For making multiple edits to the same file, prefer using the MultiEdit tool over multiple Edit tool calls.\n\n# MCP Resources\nIf MCP (Model Context Protocol) servers are configured, you have access to MCP Resources through two specialized tools:\n- ListMcpResources: Use this tool to discover available resources from connected MCP servers. Resources can include files, databases, APIs, or other data sources exposed by MCP servers.\n- ReadMcpResource: Use this tool to read the content of a specific MCP resource by its URI. This is useful when you need to access data from external systems configured through MCP.\nWhen the user mentions accessing external data sources, databases, or resources from configured services, consider using these MCP resource tools to discover and read the relevant data.\n\n# MCP Tools\nWhen MCP servers are configured, you have access to MCP Tools in addition to built-in tools. MCP tools are named with the prefix \"mcp__\" (e.g., mcp__BrightData__search_engine).\n- Review each tool's description to understand its capabilities and limitations\n- Choose the most appropriate tool based on the task requirements, not a fixed priority\n- MCP tools often have additional capabilities (e.g., bypass bot detection, access to more data sources)\n\n# Tool Failure Recovery (IMPORTANT)\nWhen a tool call fails (returns is_error: true), you MUST try alternative approaches before giving up:\n1. **Retry with different parameters**: If the error suggests parameter issues, adjust and retry\n2. **Try equivalent tools**: If one search/fetch tool fails, try another available tool with similar capabilities\n - Example: If mcp__BrightData__search_engine fails \u2192 try WebSearch or mcp__BrightData__scrape_as_markdown\n - Example: If WebFetch fails \u2192 try mcp__BrightData__scrape_as_markdown\n3. **Try different strategies**: Break down the task or use alternative approaches\n4. **Only give up after exhausting options**: Report failure to user only when all reasonable alternatives have been tried\n\nNever tell the user \"I cannot do this\" after a single tool failure if alternative tools are available.\n\n- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.`\n}\n"],
5
+ "mappings": "AAEO,SAAS,2BAAmC;AACjD,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCT;",
6
+ "names": []
7
+ }
@@ -1,180 +1,9 @@
1
- import { env } from "../utils/env.js";
2
- import { getIsGit } from "../utils/git.js";
3
1
  import {
4
- INTERRUPT_MESSAGE,
5
- INTERRUPT_MESSAGE_FOR_TOOL_USE
6
- } from "../utils/messages.js";
7
- import { getCwd } from "../utils/state.js";
8
- import { PRODUCT_NAME, PROJECT_FILE, PRODUCT_COMMAND } from "./product.js";
9
- import { BashTool } from "../tools/BashTool/BashTool.js";
10
- import { MACRO } from "./macros.js";
11
- function getCLISyspromptPrefix() {
12
- return `You are ${PRODUCT_NAME}, ShareAI-lab's Agent AI CLI for terminal & coding.`;
13
- }
14
- async function getSystemPrompt() {
15
- return [
16
- `
17
- You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
18
-
19
- IMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.
20
- IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).
21
-
22
- Here are useful slash commands users can run to interact with you:
23
- - /help: Get help with using ${PRODUCT_NAME}
24
- - /compact: Compact and continue the conversation. This is useful if the conversation is reaching the context limit
25
- There are additional slash commands and flags available to the user. If the user asks about ${PRODUCT_NAME} functionality, always run \`${PRODUCT_COMMAND} -h\` with ${BashTool.name} to see supported commands and flags. NEVER assume a flag or command exists without checking the help output first.
26
- To give feedback, users should ${MACRO.ISSUES_EXPLAINER}.
27
-
28
- # Task Management
29
- You have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
30
- These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.
31
-
32
- It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.
33
-
34
- # Memory
35
- If the current working directory contains a file called ${PROJECT_FILE}, it will be automatically added to your context. This file serves multiple purposes:
36
- 1. Storing frequently used bash commands (build, test, lint, etc.) so you can use them without searching each time
37
- 2. Recording the user's code style preferences (naming conventions, preferred libraries, etc.)
38
- 3. Maintaining useful information about the codebase structure and organization
39
-
40
- When you spend time searching for commands to typecheck, lint, build, or test, you should ask the user if it's okay to add those commands to ${PROJECT_FILE}. Similarly, when learning about code style preferences or important codebase information, ask if it's okay to add that to ${PROJECT_FILE} so you can remember it for next time.
41
-
42
- # Tone and style
43
- You should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).
44
- Remember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
45
- Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like ${BashTool.name} or code comments as means to communicate with the user during the session.
46
- If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.
47
- IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.
48
- IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.
49
- IMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...".
50
- - Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
51
-
52
- # No time estimates
53
- Never give time estimates or predictions for how long tasks will take. Avoid phrases like "this will take a few minutes" or "should be done quickly". Focus on what needs to be done, not how long it might take.
54
-
55
- # Professional objectivity
56
- Prioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving. Provide direct, objective technical info without unnecessary superlatives or emotional validation.
57
-
58
- Examples of appropriate verbosity:
59
- <example>
60
- user: 2 + 2
61
- assistant: 4
62
- </example>
63
- <example>
64
- user: what command should I run to list files?
65
- assistant: ls
66
- </example>
67
- <example>
68
- user: what files are in src/?
69
- assistant: [runs ls] foo.c, bar.c, baz.c
70
- </example>
71
- <example>
72
- user: write tests for new feature
73
- assistant: [uses search tools to find test patterns, reads relevant files concurrently, uses edit tool to write tests]
74
- </example>
75
-
76
- # Proactiveness
77
- You are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:
78
- 1. Doing the right thing when asked, including taking actions and follow-up actions
79
- 2. Not surprising the user with actions you take without asking
80
- For example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.
81
- 3. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.
82
-
83
- # Synthetic messages
84
- Sometimes, the conversation will contain messages like ${INTERRUPT_MESSAGE} or ${INTERRUPT_MESSAGE_FOR_TOOL_USE}. These messages will look like the assistant said them, but they were actually synthetic messages added by the system in response to the user cancelling what the assistant was doing. You should not respond to these messages. You must NEVER send messages like this yourself.
85
-
86
- # Following conventions
87
- When making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.
88
- - NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).
89
- - When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.
90
- - When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.
91
- - Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.
92
-
93
- # Code style
94
- - Do not add comments to the code you write, unless the user asks you to, or the code is complex and requires additional context.
95
-
96
- # Doing tasks
97
- The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
98
- - Use the TodoWrite tool to plan the task if required
99
- - Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.
100
- - Implement the solution using all tools available to you
101
- - Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.
102
- - VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to ${PROJECT_FILE} so that you will know to run it next time.
103
- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
104
-
105
- # Git Safety Protocol
106
- - NEVER update the git config
107
- - NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions
108
- - NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
109
- - NEVER run force push to main/master, warn the user if they request it
110
- - CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen \u2014 so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit
111
- - When staging files, prefer adding specific files by name rather than using "git add -A" or "git add .", which can accidentally include sensitive files (.env, credentials) or large binaries
112
- - NEVER commit changes unless the user explicitly asks you to
113
-
114
- # Code References
115
- When referencing specific functions or pieces of code, include the pattern \`file_path:line_number\` to allow the user to easily navigate to the source code location.
116
-
117
- - Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.
118
-
119
- # Tool usage policy
120
- - When doing file search, prefer to use the Task tool in order to reduce context usage.
121
- - You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance.
122
- - When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel.
123
- - It is always better to speculatively read multiple files as a batch that are potentially useful.
124
- - It is always better to speculatively perform multiple searches as a batch that are potentially useful.
125
- - For making multiple edits to the same file, prefer using the MultiEdit tool over multiple Edit tool calls.
126
-
127
- # MCP Resources
128
- If MCP (Model Context Protocol) servers are configured, you have access to MCP Resources through two specialized tools:
129
- - ListMcpResources: Use this tool to discover available resources from connected MCP servers. Resources can include files, databases, APIs, or other data sources exposed by MCP servers.
130
- - ReadMcpResource: Use this tool to read the content of a specific MCP resource by its URI. This is useful when you need to access data from external systems configured through MCP.
131
- When the user mentions accessing external data sources, databases, or resources from configured services, consider using these MCP resource tools to discover and read the relevant data.
132
-
133
- # MCP Tools
134
- When MCP servers are configured, you have access to MCP Tools in addition to built-in tools. MCP tools are named with the prefix "mcp__" (e.g., mcp__BrightData__search_engine).
135
- - Review each tool's description to understand its capabilities and limitations
136
- - Choose the most appropriate tool based on the task requirements, not a fixed priority
137
- - MCP tools often have additional capabilities (e.g., bypass bot detection, access to more data sources)
138
-
139
- # Tool Failure Recovery (IMPORTANT)
140
- When a tool call fails (returns is_error: true), you MUST try alternative approaches before giving up:
141
- 1. **Retry with different parameters**: If the error suggests parameter issues, adjust and retry
142
- 2. **Try equivalent tools**: If one search/fetch tool fails, try another available tool with similar capabilities
143
- - Example: If mcp__BrightData__search_engine fails \u2192 try WebSearch or mcp__BrightData__scrape_as_markdown
144
- - Example: If WebFetch fails \u2192 try mcp__BrightData__scrape_as_markdown
145
- 3. **Try different strategies**: Break down the task or use alternative approaches
146
- 4. **Only give up after exhausting options**: Report failure to user only when all reasonable alternatives have been tried
147
-
148
- Never tell the user "I cannot do this" after a single tool failure if alternative tools are available.
149
-
150
- You MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.
151
- `,
152
- `
153
- ${await getEnvInfo()}`
154
- ];
155
- }
156
- async function getEnvInfo() {
157
- const isGit = await getIsGit();
158
- return `Here is useful information about the environment you are running in:
159
- <env>
160
- Working directory: ${getCwd()}
161
- Is directory a git repo: ${isGit ? "Yes" : "No"}
162
- Platform: ${env.platform}
163
- Today's date: ${(/* @__PURE__ */ new Date()).toLocaleDateString()}
164
- </env>`;
165
- }
166
- async function getAgentPrompt() {
167
- return [
168
- `
169
- You are an agent for ${PRODUCT_NAME}. Given the user's prompt, you should use the tools available to you to answer the user's question.
170
-
171
- Notes:
172
- 1. IMPORTANT: You should be concise, direct, and to the point, since your responses will be displayed on a command line interface. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...".
173
- 2. When relevant, share file names and code snippets relevant to the query
174
- 3. Any file paths you return in your final response MUST be absolute. DO NOT use relative paths.`,
175
- `${await getEnvInfo()}`
176
- ];
177
- }
2
+ getSystemPrompt,
3
+ getAgentPrompt,
4
+ getEnvInfo,
5
+ getCLISyspromptPrefix
6
+ } from "./prompts/index.js";
178
7
  export {
179
8
  getAgentPrompt,
180
9
  getCLISyspromptPrefix,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/constants/prompts.ts"],
4
- "sourcesContent": ["import { env } from '@utils/env'\nimport { getIsGit } from '@utils/git'\nimport {\n INTERRUPT_MESSAGE,\n INTERRUPT_MESSAGE_FOR_TOOL_USE,\n} from '@utils/messages'\nimport { getCwd } from '@utils/state'\nimport { PRODUCT_NAME, PROJECT_FILE, PRODUCT_COMMAND } from './product'\nimport { BashTool } from '@tools/BashTool/BashTool'\nimport { MACRO } from './macros'\n\n// // Security policy constant matching reference implementation\n// export const SECURITY_POLICY =\n// 'IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.'\n\nexport function getCLISyspromptPrefix(): string {\n return `You are ${PRODUCT_NAME}, ShareAI-lab's Agent AI CLI for terminal & coding.`\n}\n\nexport async function getSystemPrompt(): Promise<string[]> {\n return [\n `\nYou are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.\nIMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).\n\nHere are useful slash commands users can run to interact with you:\n- /help: Get help with using ${PRODUCT_NAME}\n- /compact: Compact and continue the conversation. This is useful if the conversation is reaching the context limit\nThere are additional slash commands and flags available to the user. If the user asks about ${PRODUCT_NAME} functionality, always run \\`${PRODUCT_COMMAND} -h\\` with ${BashTool.name} to see supported commands and flags. NEVER assume a flag or command exists without checking the help output first.\nTo give feedback, users should ${MACRO.ISSUES_EXPLAINER}.\n\n# Task Management\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n\n# Memory\nIf the current working directory contains a file called ${PROJECT_FILE}, it will be automatically added to your context. This file serves multiple purposes:\n1. Storing frequently used bash commands (build, test, lint, etc.) so you can use them without searching each time\n2. Recording the user's code style preferences (naming conventions, preferred libraries, etc.)\n3. Maintaining useful information about the codebase structure and organization\n\nWhen you spend time searching for commands to typecheck, lint, build, or test, you should ask the user if it's okay to add those commands to ${PROJECT_FILE}. Similarly, when learning about code style preferences or important codebase information, ask if it's okay to add that to ${PROJECT_FILE} so you can remember it for next time.\n\n# Tone and style\nYou should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).\nRemember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like ${BashTool.name} or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.\nIMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.\nIMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.\nIMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\".\n- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\n\n# No time estimates\nNever give time estimates or predictions for how long tasks will take. Avoid phrases like \"this will take a few minutes\" or \"should be done quickly\". Focus on what needs to be done, not how long it might take.\n\n# Professional objectivity\nPrioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving. Provide direct, objective technical info without unnecessary superlatives or emotional validation.\n\nExamples of appropriate verbosity:\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n<example>\nuser: what command should I run to list files?\nassistant: ls\n</example>\n<example>\nuser: what files are in src/?\nassistant: [runs ls] foo.c, bar.c, baz.c\n</example>\n<example>\nuser: write tests for new feature\nassistant: [uses search tools to find test patterns, reads relevant files concurrently, uses edit tool to write tests]\n</example>\n\n# Proactiveness\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\n1. Doing the right thing when asked, including taking actions and follow-up actions\n2. Not surprising the user with actions you take without asking\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\n3. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.\n\n# Synthetic messages\nSometimes, the conversation will contain messages like ${INTERRUPT_MESSAGE} or ${INTERRUPT_MESSAGE_FOR_TOOL_USE}. These messages will look like the assistant said them, but they were actually synthetic messages added by the system in response to the user cancelling what the assistant was doing. You should not respond to these messages. You must NEVER send messages like this yourself. \n\n# Following conventions\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\n- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\n- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\n- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n# Code style\n- Do not add comments to the code you write, unless the user asks you to, or the code is complex and requires additional context.\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- Use the TodoWrite tool to plan the task if required\n- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.\n- Implement the solution using all tools available to you\n- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.\n- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to ${PROJECT_FILE} so that you will know to run it next time.\nNEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.\n\n# Git Safety Protocol\n- NEVER update the git config\n- NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions\n- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it\n- NEVER run force push to main/master, warn the user if they request it\n- CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen \u2014 so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit\n- When staging files, prefer adding specific files by name rather than using \"git add -A\" or \"git add .\", which can accidentally include sensitive files (.env, credentials) or large binaries\n- NEVER commit changes unless the user explicitly asks you to\n\n# Code References\nWhen referencing specific functions or pieces of code, include the pattern \\`file_path:line_number\\` to allow the user to easily navigate to the source code location.\n\n- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\n\n# Tool usage policy\n- When doing file search, prefer to use the Task tool in order to reduce context usage.\n- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance.\n- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\n- It is always better to speculatively read multiple files as a batch that are potentially useful.\n- It is always better to speculatively perform multiple searches as a batch that are potentially useful.\n- For making multiple edits to the same file, prefer using the MultiEdit tool over multiple Edit tool calls.\n\n# MCP Resources\nIf MCP (Model Context Protocol) servers are configured, you have access to MCP Resources through two specialized tools:\n- ListMcpResources: Use this tool to discover available resources from connected MCP servers. Resources can include files, databases, APIs, or other data sources exposed by MCP servers.\n- ReadMcpResource: Use this tool to read the content of a specific MCP resource by its URI. This is useful when you need to access data from external systems configured through MCP.\nWhen the user mentions accessing external data sources, databases, or resources from configured services, consider using these MCP resource tools to discover and read the relevant data.\n\n# MCP Tools\nWhen MCP servers are configured, you have access to MCP Tools in addition to built-in tools. MCP tools are named with the prefix \"mcp__\" (e.g., mcp__BrightData__search_engine).\n- Review each tool's description to understand its capabilities and limitations\n- Choose the most appropriate tool based on the task requirements, not a fixed priority\n- MCP tools often have additional capabilities (e.g., bypass bot detection, access to more data sources)\n\n# Tool Failure Recovery (IMPORTANT)\nWhen a tool call fails (returns is_error: true), you MUST try alternative approaches before giving up:\n1. **Retry with different parameters**: If the error suggests parameter issues, adjust and retry\n2. **Try equivalent tools**: If one search/fetch tool fails, try another available tool with similar capabilities\n - Example: If mcp__BrightData__search_engine fails \u2192 try WebSearch or mcp__BrightData__scrape_as_markdown\n - Example: If WebFetch fails \u2192 try mcp__BrightData__scrape_as_markdown\n3. **Try different strategies**: Break down the task or use alternative approaches\n4. **Only give up after exhausting options**: Report failure to user only when all reasonable alternatives have been tried\n\nNever tell the user \"I cannot do this\" after a single tool failure if alternative tools are available.\n\nYou MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.\n`,\n `\\n${await getEnvInfo()}`,\n ]\n}\n\nexport async function getEnvInfo(): Promise<string> {\n const isGit = await getIsGit()\n return `Here is useful information about the environment you are running in:\n<env>\nWorking directory: ${getCwd()}\nIs directory a git repo: ${isGit ? 'Yes' : 'No'}\nPlatform: ${env.platform}\nToday's date: ${new Date().toLocaleDateString()}\n</env>`\n}\n\nexport async function getAgentPrompt(): Promise<string[]> {\n return [\n `\nYou are an agent for ${PRODUCT_NAME}. Given the user's prompt, you should use the tools available to you to answer the user's question.\n\nNotes:\n1. IMPORTANT: You should be concise, direct, and to the point, since your responses will be displayed on a command line interface. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\".\n2. When relevant, share file names and code snippets relevant to the query\n3. Any file paths you return in your final response MUST be absolute. DO NOT use relative paths.`,\n `${await getEnvInfo()}`,\n ]\n}\n"],
5
- "mappings": "AAAA,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,cAAc,cAAc,uBAAuB;AAC5D,SAAS,gBAAgB;AACzB,SAAS,aAAa;AAMf,SAAS,wBAAgC;AAC9C,SAAO,WAAW,YAAY;AAChC;AAEA,eAAsB,kBAAqC;AACzD,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAO2B,YAAY;AAAA;AAAA,8FAEmD,YAAY,gCAAgC,eAAe,cAAc,SAAS,IAAI;AAAA,iCACnJ,MAAM,gBAAgB;AAAA;AA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B,GAAG,MAAM,WAAW,CAAC;AAAA,EACvB;AACF;",
4
+ "sourcesContent": ["/**\n * Backward compatibility re-exports\n *\n * All prompt logic has been modularized into src/constants/prompts/\n * This file re-exports the public API for existing consumers.\n */\nexport {\n getSystemPrompt,\n getAgentPrompt,\n getEnvInfo,\n getCLISyspromptPrefix,\n} from './prompts/index'\n"],
5
+ "mappings": "AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,235 @@
1
+ const PROVIDER_REGISTRY = {
2
+ openai: {
3
+ maxTokensField: "max_completion_tokens",
4
+ temperatureRange: { min: 0, max: 2 },
5
+ supportsSystemRole: true,
6
+ supportsToolChoice: true,
7
+ maxStopSequences: null,
8
+ supportsStreaming: true,
9
+ supportsReasoningEffort: false,
10
+ apiType: "chat-completions"
11
+ },
12
+ "openai-responses": {
13
+ maxTokensField: "max_output_tokens",
14
+ temperatureRange: "omit",
15
+ supportsSystemRole: false,
16
+ systemRoleAlternative: "instruction",
17
+ supportsToolChoice: true,
18
+ maxStopSequences: null,
19
+ supportsStreaming: false,
20
+ supportsReasoningEffort: true,
21
+ apiType: "responses"
22
+ },
23
+ gemini: {
24
+ maxTokensField: "max_tokens",
25
+ temperatureRange: { min: 0, max: 2 },
26
+ supportsSystemRole: true,
27
+ supportsToolChoice: true,
28
+ maxStopSequences: null,
29
+ supportsStreaming: true,
30
+ supportsReasoningEffort: false,
31
+ apiType: "chat-completions"
32
+ },
33
+ deepseek: {
34
+ maxTokensField: "max_tokens",
35
+ temperatureRange: { min: 0, max: 2 },
36
+ supportsSystemRole: true,
37
+ supportsToolChoice: true,
38
+ maxStopSequences: null,
39
+ supportsStreaming: true,
40
+ supportsReasoningEffort: false,
41
+ apiType: "chat-completions"
42
+ },
43
+ mistral: {
44
+ maxTokensField: "max_tokens",
45
+ temperatureRange: { min: 0, max: 1.5 },
46
+ supportsSystemRole: true,
47
+ supportsToolChoice: true,
48
+ maxStopSequences: null,
49
+ supportsStreaming: true,
50
+ supportsReasoningEffort: false,
51
+ apiType: "chat-completions"
52
+ },
53
+ qwen: {
54
+ maxTokensField: "max_tokens",
55
+ temperatureRange: { min: 0, max: 2 },
56
+ supportsSystemRole: true,
57
+ supportsToolChoice: true,
58
+ maxStopSequences: null,
59
+ supportsStreaming: true,
60
+ supportsReasoningEffort: false,
61
+ apiType: "chat-completions"
62
+ },
63
+ glm: {
64
+ maxTokensField: "max_tokens",
65
+ temperatureRange: { min: 0, max: 1 },
66
+ supportsSystemRole: true,
67
+ supportsToolChoice: "auto-only",
68
+ maxStopSequences: 1,
69
+ supportsStreaming: true,
70
+ supportsReasoningEffort: false,
71
+ apiType: "chat-completions"
72
+ },
73
+ kimi: {
74
+ maxTokensField: "max_tokens",
75
+ temperatureRange: { min: 0, max: 1 },
76
+ supportsSystemRole: true,
77
+ supportsToolChoice: true,
78
+ maxStopSequences: null,
79
+ supportsStreaming: true,
80
+ supportsReasoningEffort: false,
81
+ apiType: "chat-completions"
82
+ },
83
+ minimax: {
84
+ maxTokensField: "max_completion_tokens",
85
+ temperatureRange: { min: 0, max: 1 },
86
+ supportsSystemRole: true,
87
+ supportsToolChoice: true,
88
+ maxStopSequences: null,
89
+ supportsStreaming: true,
90
+ supportsReasoningEffort: false,
91
+ apiType: "chat-completions"
92
+ },
93
+ groq: {
94
+ maxTokensField: "max_completion_tokens",
95
+ temperatureRange: { min: 0, max: 2 },
96
+ supportsSystemRole: true,
97
+ supportsToolChoice: true,
98
+ maxStopSequences: null,
99
+ supportsStreaming: true,
100
+ supportsReasoningEffort: false,
101
+ apiType: "chat-completions"
102
+ },
103
+ xai: {
104
+ maxTokensField: "max_tokens",
105
+ temperatureRange: { min: 0, max: 2 },
106
+ supportsSystemRole: true,
107
+ supportsToolChoice: true,
108
+ maxStopSequences: null,
109
+ supportsStreaming: true,
110
+ supportsReasoningEffort: false,
111
+ apiType: "chat-completions"
112
+ },
113
+ ollama: {
114
+ maxTokensField: "max_tokens",
115
+ temperatureRange: { min: 0, max: 2 },
116
+ supportsSystemRole: true,
117
+ supportsToolChoice: true,
118
+ maxStopSequences: null,
119
+ supportsStreaming: true,
120
+ supportsReasoningEffort: false,
121
+ apiType: "chat-completions"
122
+ },
123
+ azure: {
124
+ maxTokensField: "max_tokens",
125
+ temperatureRange: { min: 0, max: 2 },
126
+ supportsSystemRole: true,
127
+ supportsToolChoice: true,
128
+ maxStopSequences: null,
129
+ supportsStreaming: true,
130
+ supportsReasoningEffort: false,
131
+ apiType: "chat-completions"
132
+ },
133
+ "baidu-qianfan": {
134
+ maxTokensField: "max_tokens",
135
+ temperatureRange: { min: 0, max: 1 },
136
+ supportsSystemRole: true,
137
+ supportsToolChoice: "auto-only",
138
+ maxStopSequences: null,
139
+ supportsStreaming: true,
140
+ supportsReasoningEffort: false,
141
+ apiType: "chat-completions"
142
+ },
143
+ siliconflow: {
144
+ maxTokensField: "max_tokens",
145
+ temperatureRange: { min: 0, max: 2 },
146
+ supportsSystemRole: true,
147
+ supportsToolChoice: true,
148
+ maxStopSequences: null,
149
+ supportsStreaming: true,
150
+ supportsReasoningEffort: false,
151
+ apiType: "chat-completions"
152
+ },
153
+ "custom-openai": {
154
+ maxTokensField: "max_tokens",
155
+ temperatureRange: { min: 0, max: 2 },
156
+ supportsSystemRole: true,
157
+ supportsToolChoice: true,
158
+ maxStopSequences: null,
159
+ supportsStreaming: true,
160
+ supportsReasoningEffort: false,
161
+ apiType: "chat-completions"
162
+ }
163
+ };
164
+ const MODEL_OVERRIDES = {
165
+ // OpenAI reasoning models - temperature must be omitted
166
+ "o1-mini": {
167
+ temperatureRange: "omit",
168
+ supportsReasoningEffort: false,
169
+ maxTokensField: "max_completion_tokens"
170
+ },
171
+ "o1-preview": {
172
+ temperatureRange: "omit",
173
+ supportsReasoningEffort: false,
174
+ maxTokensField: "max_completion_tokens"
175
+ },
176
+ o1: {
177
+ temperatureRange: "omit",
178
+ supportsReasoningEffort: false,
179
+ maxTokensField: "max_completion_tokens"
180
+ },
181
+ "o3-mini": {
182
+ temperatureRange: "omit",
183
+ supportsReasoningEffort: true,
184
+ maxTokensField: "max_completion_tokens"
185
+ },
186
+ o3: {
187
+ temperatureRange: "omit",
188
+ supportsReasoningEffort: true,
189
+ maxTokensField: "max_completion_tokens"
190
+ },
191
+ "o4-mini": {
192
+ temperatureRange: "omit",
193
+ supportsReasoningEffort: true,
194
+ maxTokensField: "max_completion_tokens"
195
+ },
196
+ // GPT-5 models - temperature must be omitted, uses Responses API
197
+ "gpt-5": {
198
+ temperatureRange: "omit",
199
+ supportsReasoningEffort: true,
200
+ maxTokensField: "max_output_tokens",
201
+ apiType: "responses"
202
+ },
203
+ // Kimi reasoning models - temperature must be exactly 1 (omit and let API default)
204
+ "kimi-k2": {
205
+ temperatureRange: "omit",
206
+ supportsReasoningEffort: false
207
+ },
208
+ // DeepSeek reasoning models - temperature must be omitted
209
+ "deepseek-reasoner": {
210
+ temperatureRange: "omit",
211
+ supportsReasoningEffort: false
212
+ }
213
+ };
214
+ function getEffectiveCapabilities(provider, modelName) {
215
+ const providerCaps = PROVIDER_REGISTRY[provider] || PROVIDER_REGISTRY["custom-openai"];
216
+ let override = MODEL_OVERRIDES[modelName];
217
+ if (!override) {
218
+ for (const [prefix, overrideValue] of Object.entries(MODEL_OVERRIDES)) {
219
+ if (modelName.startsWith(prefix)) {
220
+ override = overrideValue;
221
+ break;
222
+ }
223
+ }
224
+ }
225
+ if (override) {
226
+ return { ...providerCaps, ...override };
227
+ }
228
+ return providerCaps;
229
+ }
230
+ export {
231
+ MODEL_OVERRIDES,
232
+ PROVIDER_REGISTRY,
233
+ getEffectiveCapabilities
234
+ };
235
+ //# sourceMappingURL=providerRegistry.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/constants/providerRegistry.ts"],
4
+ "sourcesContent": ["/**\n * Provider-level capabilities and model-specific overrides.\n * Used by normalizeRequestParams() to transform API requests\n * before they're sent to each provider.\n */\n\nexport interface ProviderCapabilities {\n /** Which parameter name to use for max tokens */\n maxTokensField: 'max_tokens' | 'max_completion_tokens' | 'max_output_tokens'\n /** Temperature range, or 'omit' if model doesn't support temperature */\n temperatureRange: { min: number; max: number } | 'omit'\n /** Whether the provider supports system role messages */\n supportsSystemRole: boolean\n /** Alternative role name for system messages if not supported */\n systemRoleAlternative?: 'developer' | 'instruction'\n /** tool_choice support: true = full, 'auto-only' = only auto, false = none */\n supportsToolChoice: boolean | 'auto-only'\n /** Maximum number of stop sequences, or null for unlimited */\n maxStopSequences: number | null\n /** Whether provider supports streaming */\n supportsStreaming: boolean\n /** Whether provider supports reasoning_effort parameter */\n supportsReasoningEffort: boolean\n /** API type */\n apiType: 'chat-completions' | 'responses'\n}\n\n/**\n * Provider-level default capabilities.\n * These are the defaults for all models from a given provider.\n */\nexport const PROVIDER_REGISTRY: Record<string, ProviderCapabilities> = {\n openai: {\n maxTokensField: 'max_completion_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n 'openai-responses': {\n maxTokensField: 'max_output_tokens',\n temperatureRange: 'omit',\n supportsSystemRole: false,\n systemRoleAlternative: 'instruction',\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: false,\n supportsReasoningEffort: true,\n apiType: 'responses',\n },\n gemini: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n deepseek: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n mistral: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 1.5 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n qwen: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n glm: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 1.0 },\n supportsSystemRole: true,\n supportsToolChoice: 'auto-only',\n maxStopSequences: 1,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n kimi: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 1.0 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n minimax: {\n maxTokensField: 'max_completion_tokens',\n temperatureRange: { min: 0, max: 1.0 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n groq: {\n maxTokensField: 'max_completion_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n xai: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n ollama: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n azure: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n 'baidu-qianfan': {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 1.0 },\n supportsSystemRole: true,\n supportsToolChoice: 'auto-only',\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n siliconflow: {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n 'custom-openai': {\n maxTokensField: 'max_tokens',\n temperatureRange: { min: 0, max: 2 },\n supportsSystemRole: true,\n supportsToolChoice: true,\n maxStopSequences: null,\n supportsStreaming: true,\n supportsReasoningEffort: false,\n apiType: 'chat-completions',\n },\n}\n\n/**\n * Model-specific overrides that take precedence over provider defaults.\n * Use model name prefixes for matching.\n */\nexport const MODEL_OVERRIDES: Record<string, Partial<ProviderCapabilities>> = {\n // OpenAI reasoning models - temperature must be omitted\n 'o1-mini': {\n temperatureRange: 'omit',\n supportsReasoningEffort: false,\n maxTokensField: 'max_completion_tokens',\n },\n 'o1-preview': {\n temperatureRange: 'omit',\n supportsReasoningEffort: false,\n maxTokensField: 'max_completion_tokens',\n },\n o1: {\n temperatureRange: 'omit',\n supportsReasoningEffort: false,\n maxTokensField: 'max_completion_tokens',\n },\n 'o3-mini': {\n temperatureRange: 'omit',\n supportsReasoningEffort: true,\n maxTokensField: 'max_completion_tokens',\n },\n o3: {\n temperatureRange: 'omit',\n supportsReasoningEffort: true,\n maxTokensField: 'max_completion_tokens',\n },\n 'o4-mini': {\n temperatureRange: 'omit',\n supportsReasoningEffort: true,\n maxTokensField: 'max_completion_tokens',\n },\n // GPT-5 models - temperature must be omitted, uses Responses API\n 'gpt-5': {\n temperatureRange: 'omit',\n supportsReasoningEffort: true,\n maxTokensField: 'max_output_tokens',\n apiType: 'responses',\n },\n // Kimi reasoning models - temperature must be exactly 1 (omit and let API default)\n 'kimi-k2': {\n temperatureRange: 'omit',\n supportsReasoningEffort: false,\n },\n // DeepSeek reasoning models - temperature must be omitted\n 'deepseek-reasoner': {\n temperatureRange: 'omit',\n supportsReasoningEffort: false,\n },\n}\n\n/**\n * Get effective capabilities for a provider + model combination.\n * Model overrides take precedence over provider defaults.\n */\nexport function getEffectiveCapabilities(\n provider: string,\n modelName: string,\n): ProviderCapabilities {\n // Start with provider defaults\n const providerCaps =\n PROVIDER_REGISTRY[provider] || PROVIDER_REGISTRY['custom-openai']\n\n // Check for exact model match first, then prefix matches\n let override: Partial<ProviderCapabilities> | undefined =\n MODEL_OVERRIDES[modelName]\n\n if (!override) {\n // Try prefix matching (e.g., 'gpt-5' matches 'gpt-5-mini')\n for (const [prefix, overrideValue] of Object.entries(MODEL_OVERRIDES)) {\n if (modelName.startsWith(prefix)) {\n override = overrideValue\n break\n }\n }\n }\n\n if (override) {\n return { ...providerCaps, ...override }\n }\n\n return providerCaps\n}\n"],
5
+ "mappings": "AA+BO,MAAM,oBAA0D;AAAA,EACrE,QAAQ;AAAA,IACN,gBAAgB;AAAA,IAChB,kBAAkB,EAAE,KAAK,GAAG,KAAK,EAAE;AAAA,IACnC,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,IACzB,SAAS;AAAA,EACX;AAAA,EACA,oBAAoB;AAAA,IAClB,gBAAgB;AAAA,IAChB,kBAAkB;AAAA,IAClB,oBAAoB;AAAA,IACpB,uBAAuB;AAAA,IACvB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,yBAAyB;AAAA,IACzB,SAAS;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,IACN,gBAAgB;AAAA,IA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AAAA;AAAA,EAEA,WAAW;AAAA,IACT,kBAAkB;AAAA,IAClB,yBAAyB;AAAA,EAC3B;AAAA;AAAA,EAEA,qBAAqB;AAAA,IACnB,kBAAkB;AAAA,IAClB,yBAAyB;AAAA,EAC3B;AACF;AAMO,SAAS,yBACd,UACA,WACsB;AAEtB,QAAM,eACJ,kBAAkB,QAAQ,KAAK,kBAAkB,eAAe;AAGlE,MAAI,WACF,gBAAgB,SAAS;AAE3B,MAAI,CAAC,UAAU;AAEb,eAAW,CAAC,QAAQ,aAAa,KAAK,OAAO,QAAQ,eAAe,GAAG;AACrE,UAAI,UAAU,WAAW,MAAM,GAAG;AAChC,mBAAW;AACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,UAAU;AACZ,WAAO,EAAE,GAAG,cAAc,GAAG,SAAS;AAAA,EACxC;AAEA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,35 @@
1
+ const OPENAI_COMPATIBLE_PROVIDERS = [
2
+ "minimax",
3
+ "kimi",
4
+ "deepseek",
5
+ "siliconflow",
6
+ "qwen",
7
+ "glm",
8
+ "baidu-qianfan",
9
+ "openai",
10
+ "mistral",
11
+ "xai",
12
+ "groq",
13
+ "gemini",
14
+ "ollama",
15
+ "azure",
16
+ "custom-openai"
17
+ ];
18
+ function isOpenAICompatibleProvider(provider) {
19
+ return OPENAI_COMPATIBLE_PROVIDERS.includes(provider);
20
+ }
21
+ const ANTHROPIC_NATIVE_PROVIDERS = [
22
+ "anthropic",
23
+ "bigdream",
24
+ "opendev"
25
+ ];
26
+ function isAnthropicNativeProvider(provider) {
27
+ return ANTHROPIC_NATIVE_PROVIDERS.includes(provider);
28
+ }
29
+ export {
30
+ ANTHROPIC_NATIVE_PROVIDERS,
31
+ OPENAI_COMPATIBLE_PROVIDERS,
32
+ isAnthropicNativeProvider,
33
+ isOpenAICompatibleProvider
34
+ };
35
+ //# sourceMappingURL=providers.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/constants/providers.ts"],
4
+ "sourcesContent": ["/**\n * Consolidated list of OpenAI-compatible providers.\n * Single source of truth - import this everywhere instead of duplicating the list.\n */\nexport const OPENAI_COMPATIBLE_PROVIDERS = [\n 'minimax',\n 'kimi',\n 'deepseek',\n 'siliconflow',\n 'qwen',\n 'glm',\n 'baidu-qianfan',\n 'openai',\n 'mistral',\n 'xai',\n 'groq',\n 'gemini',\n 'ollama',\n 'azure',\n 'custom-openai',\n] as const\n\nexport type OpenAICompatibleProvider =\n (typeof OPENAI_COMPATIBLE_PROVIDERS)[number]\n\n/**\n * Check if a provider uses OpenAI-compatible API\n */\nexport function isOpenAICompatibleProvider(provider: string): boolean {\n return (OPENAI_COMPATIBLE_PROVIDERS as readonly string[]).includes(provider)\n}\n\n/**\n * Providers that use the Anthropic native SDK\n */\nexport const ANTHROPIC_NATIVE_PROVIDERS = [\n 'anthropic',\n 'bigdream',\n 'opendev',\n] as const\n\nexport type AnthropicNativeProvider =\n (typeof ANTHROPIC_NATIVE_PROVIDERS)[number]\n\n/**\n * Check if a provider uses the Anthropic native SDK\n */\nexport function isAnthropicNativeProvider(provider: string): boolean {\n return (ANTHROPIC_NATIVE_PROVIDERS as readonly string[]).includes(provider)\n}\n"],
5
+ "mappings": "AAIO,MAAM,8BAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAQO,SAAS,2BAA2B,UAA2B;AACpE,SAAQ,4BAAkD,SAAS,QAAQ;AAC7E;AAKO,MAAM,6BAA6B;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AACF;AAQO,SAAS,0BAA0B,UAA2B;AACnE,SAAQ,2BAAiD,SAAS,QAAQ;AAC5E;",
6
+ "names": []
7
+ }
@@ -35,7 +35,6 @@ function PermissionProvider({
35
35
  isBypassPermissionsModeAvailable
36
36
  );
37
37
  const modeConfig = MODE_CONFIGS[nextMode];
38
- console.log(`\u{1F504} Mode cycle: ${prev.mode} \u2192 ${nextMode}`);
39
38
  return {
40
39
  ...prev,
41
40
  mode: nextMode,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/context/PermissionContext.tsx"],
4
- "sourcesContent": ["import React, {\n createContext,\n useContext,\n useState,\n useCallback,\n ReactNode,\n} from 'react'\nimport {\n PermissionMode,\n PermissionContext as IPermissionContext,\n getNextPermissionMode,\n MODE_CONFIGS,\n} from '@minto-types/PermissionMode'\n\ninterface PermissionContextValue {\n permissionContext: IPermissionContext\n currentMode: PermissionMode\n cycleMode: () => void\n setMode: (mode: PermissionMode) => void\n isToolAllowed: (toolName: string) => boolean\n getModeConfig: () => (typeof MODE_CONFIGS)[PermissionMode]\n}\n\nconst PermissionContext = createContext<PermissionContextValue | undefined>(\n undefined,\n)\n\ninterface PermissionProviderProps {\n children: ReactNode\n isBypassPermissionsModeAvailable?: boolean\n}\n\nexport function PermissionProvider({\n children,\n isBypassPermissionsModeAvailable = false,\n}: PermissionProviderProps) {\n const [permissionContext, setPermissionContext] =\n useState<IPermissionContext>({\n mode: 'default',\n allowedTools: ['*'],\n allowedPaths: [process.cwd()],\n restrictions: {\n readOnly: false,\n requireConfirmation: true,\n bypassValidation: false,\n },\n metadata: {\n transitionCount: 0,\n },\n })\n\n const cycleMode = useCallback(() => {\n setPermissionContext(prev => {\n const nextMode = getNextPermissionMode(\n prev.mode,\n isBypassPermissionsModeAvailable,\n )\n const modeConfig = MODE_CONFIGS[nextMode]\n\n console.log(`\uD83D\uDD04 Mode cycle: ${prev.mode} \u2192 ${nextMode}`)\n\n return {\n ...prev,\n mode: nextMode,\n allowedTools: modeConfig.allowedTools,\n restrictions: modeConfig.restrictions,\n metadata: {\n ...prev.metadata,\n previousMode: prev.mode,\n activatedAt: new Date().toISOString(),\n transitionCount: prev.metadata.transitionCount + 1,\n },\n }\n })\n }, [isBypassPermissionsModeAvailable])\n\n const setMode = useCallback((mode: PermissionMode) => {\n setPermissionContext(prev => {\n const modeConfig = MODE_CONFIGS[mode]\n\n return {\n ...prev,\n mode,\n allowedTools: modeConfig.allowedTools,\n restrictions: modeConfig.restrictions,\n metadata: {\n ...prev.metadata,\n previousMode: prev.mode,\n activatedAt: new Date().toISOString(),\n transitionCount: prev.metadata.transitionCount + 1,\n },\n }\n })\n }, [])\n\n const isToolAllowed = useCallback(\n (toolName: string) => {\n const { allowedTools } = permissionContext\n\n // If '*' is in allowed tools, all tools are allowed\n if (allowedTools.includes('*')) {\n return true\n }\n\n // Check if specific tool is in allowed list\n return allowedTools.includes(toolName)\n },\n [permissionContext],\n )\n\n const getModeConfig = useCallback(() => {\n return MODE_CONFIGS[permissionContext.mode]\n }, [permissionContext.mode])\n\n const value: PermissionContextValue = {\n permissionContext,\n currentMode: permissionContext.mode,\n cycleMode,\n setMode,\n isToolAllowed,\n getModeConfig,\n }\n\n return (\n <PermissionContext.Provider value={value}>\n {children}\n </PermissionContext.Provider>\n )\n}\n\nexport function usePermissionContext(): PermissionContextValue {\n const context = useContext(PermissionContext)\n if (context === undefined) {\n throw new Error(\n 'usePermissionContext must be used within a PermissionProvider',\n )\n }\n return context\n}\n\n// Hook for components that need to respond to permission mode changes\nexport function usePermissionMode(): [\n PermissionMode,\n (mode: PermissionMode) => void,\n () => void,\n] {\n const { currentMode, setMode, cycleMode } = usePermissionContext()\n return [currentMode, setMode, cycleMode]\n}\n"],
5
- "mappings": "AAAA,OAAO;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAWP,MAAM,oBAAoB;AAAA,EACxB;AACF;AAOO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA,mCAAmC;AACrC,GAA4B;AAC1B,QAAM,CAAC,mBAAmB,oBAAoB,IAC5C,S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,IAAI;AAGzB,UAAI,aAAa,SAAS,GAAG,GAAG;AAC9B,eAAO;AAAA,MACT;AAGA,aAAO,aAAa,SAAS,QAAQ;AAAA,IACvC;AAAA,IACA,CAAC,iBAAiB;AAAA,EACpB;AAEA,QAAM,gBAAgB,YAAY,MAAM;AACtC,WAAO,aAAa,kBAAkB,IAAI;AAAA,EAC5C,GAAG,CAAC,kBAAkB,IAAI,CAAC;AAE3B,QAAM,QAAgC;AAAA,IACpC;AAAA,IACA,aAAa,kBAAkB;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SACE,oCAAC,kBAAkB,UAAlB,EAA2B,SACzB,QACH;AAEJ;AAEO,SAAS,uBAA+C;AAC7D,QAAM,UAAU,WAAW,iBAAiB;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAGO,SAAS,oBAId;AACA,QAAM,EAAE,aAAa,SAAS,UAAU,IAAI,qBAAqB;AACjE,SAAO,CAAC,aAAa,SAAS,SAAS;AACzC;",
4
+ "sourcesContent": ["import React, {\n createContext,\n useContext,\n useState,\n useCallback,\n ReactNode,\n} from 'react'\nimport {\n PermissionMode,\n PermissionContext as IPermissionContext,\n getNextPermissionMode,\n MODE_CONFIGS,\n} from '@minto-types/PermissionMode'\n\ninterface PermissionContextValue {\n permissionContext: IPermissionContext\n currentMode: PermissionMode\n cycleMode: () => void\n setMode: (mode: PermissionMode) => void\n isToolAllowed: (toolName: string) => boolean\n getModeConfig: () => (typeof MODE_CONFIGS)[PermissionMode]\n}\n\nconst PermissionContext = createContext<PermissionContextValue | undefined>(\n undefined,\n)\n\ninterface PermissionProviderProps {\n children: ReactNode\n isBypassPermissionsModeAvailable?: boolean\n}\n\nexport function PermissionProvider({\n children,\n isBypassPermissionsModeAvailable = false,\n}: PermissionProviderProps) {\n const [permissionContext, setPermissionContext] =\n useState<IPermissionContext>({\n mode: 'default',\n allowedTools: ['*'],\n allowedPaths: [process.cwd()],\n restrictions: {\n readOnly: false,\n requireConfirmation: true,\n bypassValidation: false,\n },\n metadata: {\n transitionCount: 0,\n },\n })\n\n const cycleMode = useCallback(() => {\n setPermissionContext(prev => {\n const nextMode = getNextPermissionMode(\n prev.mode,\n isBypassPermissionsModeAvailable,\n )\n const modeConfig = MODE_CONFIGS[nextMode]\n\n return {\n ...prev,\n mode: nextMode,\n allowedTools: modeConfig.allowedTools,\n restrictions: modeConfig.restrictions,\n metadata: {\n ...prev.metadata,\n previousMode: prev.mode,\n activatedAt: new Date().toISOString(),\n transitionCount: prev.metadata.transitionCount + 1,\n },\n }\n })\n }, [isBypassPermissionsModeAvailable])\n\n const setMode = useCallback((mode: PermissionMode) => {\n setPermissionContext(prev => {\n const modeConfig = MODE_CONFIGS[mode]\n\n return {\n ...prev,\n mode,\n allowedTools: modeConfig.allowedTools,\n restrictions: modeConfig.restrictions,\n metadata: {\n ...prev.metadata,\n previousMode: prev.mode,\n activatedAt: new Date().toISOString(),\n transitionCount: prev.metadata.transitionCount + 1,\n },\n }\n })\n }, [])\n\n const isToolAllowed = useCallback(\n (toolName: string) => {\n const { allowedTools } = permissionContext\n\n // If '*' is in allowed tools, all tools are allowed\n if (allowedTools.includes('*')) {\n return true\n }\n\n // Check if specific tool is in allowed list\n return allowedTools.includes(toolName)\n },\n [permissionContext],\n )\n\n const getModeConfig = useCallback(() => {\n return MODE_CONFIGS[permissionContext.mode]\n }, [permissionContext.mode])\n\n const value: PermissionContextValue = {\n permissionContext,\n currentMode: permissionContext.mode,\n cycleMode,\n setMode,\n isToolAllowed,\n getModeConfig,\n }\n\n return (\n <PermissionContext.Provider value={value}>\n {children}\n </PermissionContext.Provider>\n )\n}\n\nexport function usePermissionContext(): PermissionContextValue {\n const context = useContext(PermissionContext)\n if (context === undefined) {\n throw new Error(\n 'usePermissionContext must be used within a PermissionProvider',\n )\n }\n return context\n}\n\n// Hook for components that need to respond to permission mode changes\nexport function usePermissionMode(): [\n PermissionMode,\n (mode: PermissionMode) => void,\n () => void,\n] {\n const { currentMode, setMode, cycleMode } = usePermissionContext()\n return [currentMode, setMode, cycleMode]\n}\n"],
5
+ "mappings": "AAAA,OAAO;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAWP,MAAM,oBAAoB;AAAA,EACxB;AACF;AAOO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA,mCAAmC;AACrC,GAA4B;AAC1B,QAAM,CAAC,mBAAmB,oBAAoB,IAC5C,SAA6B;AAAA,IAC3B,MAAM;AAAA,IACN,cAAc,CAAC,GAAG;AAAA,IAClB,cAAc,CAAC,QAAQ,IAAI,CAAC;AAAA,IAC5B,cAAc;AAAA,MACZ,UAAU;AAAA,MACV,qBAAqB;AAAA,MACrB,kBAAkB;AAAA,IACpB;AAAA,IACA,UAAU;AAAA,MACR,iBAAiB;AAAA,IACnB;AAAA,EACF,CAAC;AAEH,QAAM,YAAY,YAAY,MAAM;AAClC,yBAAqB,UAAQ;AAC3B,YAAM,WAAW;AAAA,QACf,KAAK;AAAA,QACL;AAAA,MACF;AACA,YAAM,aAAa,aAAa,QAAQ;AAExC,aAAO;AAAA,QACL,GAAG;AAAA,QACH,MAAM;AAAA,QACN,cAAc,WAAW;AAAA,QACzB,cAAc,WAAW;AAAA,QACzB,UAAU;AAAA,UACR,GAAG,KAAK;AAAA,UACR,cAAc,KAAK;AAAA,UACnB,cAAa,oBAAI,KAAK,GAAE,YAAY;AAAA,UACpC,iBAAiB,KAAK,SAAS,kBAAkB;AAAA,QACnD;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,gCAAgC,CAAC;AAErC,QAAM,UAAU,YAAY,CAAC,SAAyB;AACpD,yBAAqB,UAAQ;AAC3B,YAAM,aAAa,aAAa,IAAI;AAEpC,aAAO;AAAA,QACL,GAAG;AAAA,QACH;AAAA,QAC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