@within-7/minto 0.2.0 → 0.3.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 (254) hide show
  1. package/dist/commands/agents/AgentsCommand.js +22 -24
  2. package/dist/commands/agents/AgentsCommand.js.map +2 -2
  3. package/dist/commands/context.js +2 -1
  4. package/dist/commands/context.js.map +2 -2
  5. package/dist/commands/export.js +2 -1
  6. package/dist/commands/export.js.map +2 -2
  7. package/dist/commands/mcp-interactive.js +7 -6
  8. package/dist/commands/mcp-interactive.js.map +2 -2
  9. package/dist/commands/model.js +3 -2
  10. package/dist/commands/model.js.map +2 -2
  11. package/dist/commands/permissions.js +4 -3
  12. package/dist/commands/permissions.js.map +2 -2
  13. package/dist/commands/plugin/AddMarketplaceForm.js +3 -2
  14. package/dist/commands/plugin/AddMarketplaceForm.js.map +2 -2
  15. package/dist/commands/plugin/ConfirmDialog.js +2 -1
  16. package/dist/commands/plugin/ConfirmDialog.js.map +2 -2
  17. package/dist/commands/plugin/ErrorView.js +2 -1
  18. package/dist/commands/plugin/ErrorView.js.map +2 -2
  19. package/dist/commands/plugin/InstalledPluginsByMarketplace.js +5 -4
  20. package/dist/commands/plugin/InstalledPluginsByMarketplace.js.map +2 -2
  21. package/dist/commands/plugin/InstalledPluginsManager.js +5 -4
  22. package/dist/commands/plugin/InstalledPluginsManager.js.map +2 -2
  23. package/dist/commands/plugin/MainMenu.js +2 -1
  24. package/dist/commands/plugin/MainMenu.js.map +2 -2
  25. package/dist/commands/plugin/MarketplaceManager.js +5 -4
  26. package/dist/commands/plugin/MarketplaceManager.js.map +2 -2
  27. package/dist/commands/plugin/MarketplaceSelector.js +4 -3
  28. package/dist/commands/plugin/MarketplaceSelector.js.map +2 -2
  29. package/dist/commands/plugin/PlaceholderScreen.js +3 -2
  30. package/dist/commands/plugin/PlaceholderScreen.js.map +2 -2
  31. package/dist/commands/plugin/PluginBrowser.js +6 -5
  32. package/dist/commands/plugin/PluginBrowser.js.map +2 -2
  33. package/dist/commands/plugin/PluginDetailsInstall.js +5 -4
  34. package/dist/commands/plugin/PluginDetailsInstall.js.map +2 -2
  35. package/dist/commands/plugin/PluginDetailsManage.js +4 -3
  36. package/dist/commands/plugin/PluginDetailsManage.js.map +2 -2
  37. package/dist/commands/plugin.js +16 -15
  38. package/dist/commands/plugin.js.map +2 -2
  39. package/dist/commands/sandbox.js +4 -3
  40. package/dist/commands/sandbox.js.map +2 -2
  41. package/dist/commands/setup.js +2 -1
  42. package/dist/commands/setup.js.map +2 -2
  43. package/dist/commands/status.js +2 -1
  44. package/dist/commands/status.js.map +2 -2
  45. package/dist/commands/undo.js +245 -0
  46. package/dist/commands/undo.js.map +7 -0
  47. package/dist/commands.js +2 -0
  48. package/dist/commands.js.map +2 -2
  49. package/dist/components/AgentThinkingBlock.js +1 -1
  50. package/dist/components/AgentThinkingBlock.js.map +2 -2
  51. package/dist/components/AsciiLogo.js +7 -8
  52. package/dist/components/AsciiLogo.js.map +2 -2
  53. package/dist/components/AskUserQuestionDialog/AskUserQuestionDialog.js +3 -2
  54. package/dist/components/AskUserQuestionDialog/AskUserQuestionDialog.js.map +2 -2
  55. package/dist/components/AskUserQuestionDialog/QuestionView.js +2 -1
  56. package/dist/components/AskUserQuestionDialog/QuestionView.js.map +2 -2
  57. package/dist/components/CollapsibleHint.js +2 -1
  58. package/dist/components/CollapsibleHint.js.map +2 -2
  59. package/dist/components/Config.js +3 -2
  60. package/dist/components/Config.js.map +2 -2
  61. package/dist/components/ConsoleOAuthFlow.js +2 -1
  62. package/dist/components/ConsoleOAuthFlow.js.map +2 -2
  63. package/dist/components/Cost.js +2 -1
  64. package/dist/components/Cost.js.map +2 -2
  65. package/dist/components/HeaderBar.js +13 -8
  66. package/dist/components/HeaderBar.js.map +2 -2
  67. package/dist/components/HistorySearchOverlay.js +4 -3
  68. package/dist/components/HistorySearchOverlay.js.map +2 -2
  69. package/dist/components/HotkeyHelpPanel.js +8 -11
  70. package/dist/components/HotkeyHelpPanel.js.map +2 -2
  71. package/dist/components/InvalidConfigDialog.js +2 -1
  72. package/dist/components/InvalidConfigDialog.js.map +2 -2
  73. package/dist/components/Logo.js +23 -67
  74. package/dist/components/Logo.js.map +2 -2
  75. package/dist/components/MCPServerApprovalDialog.js +2 -1
  76. package/dist/components/MCPServerApprovalDialog.js.map +2 -2
  77. package/dist/components/MCPServerDialogCopy.js +2 -1
  78. package/dist/components/MCPServerDialogCopy.js.map +2 -2
  79. package/dist/components/MCPServerMultiselectDialog.js +2 -1
  80. package/dist/components/MCPServerMultiselectDialog.js.map +2 -2
  81. package/dist/components/MessageSelector.js +4 -3
  82. package/dist/components/MessageSelector.js.map +2 -2
  83. package/dist/components/ModeIndicator.js +2 -1
  84. package/dist/components/ModeIndicator.js.map +2 -2
  85. package/dist/components/ModelConfig.js +4 -3
  86. package/dist/components/ModelConfig.js.map +2 -2
  87. package/dist/components/ModelListManager.js +4 -3
  88. package/dist/components/ModelListManager.js.map +2 -2
  89. package/dist/components/ModelSelector/ModelSelector.js +26 -13
  90. package/dist/components/ModelSelector/ModelSelector.js.map +2 -2
  91. package/dist/components/Onboarding.js +3 -2
  92. package/dist/components/Onboarding.js.map +2 -2
  93. package/dist/components/OperationSummary.js +130 -0
  94. package/dist/components/OperationSummary.js.map +7 -0
  95. package/dist/components/PromptInput.js +88 -75
  96. package/dist/components/PromptInput.js.map +2 -2
  97. package/dist/components/SensitiveFileWarning.js +31 -0
  98. package/dist/components/SensitiveFileWarning.js.map +7 -0
  99. package/dist/components/Spinner.js +71 -22
  100. package/dist/components/Spinner.js.map +2 -2
  101. package/dist/components/StructuredDiff.js +6 -8
  102. package/dist/components/StructuredDiff.js.map +2 -2
  103. package/dist/components/SubagentBlock.js +4 -2
  104. package/dist/components/SubagentBlock.js.map +2 -2
  105. package/dist/components/SubagentProgress.js +7 -4
  106. package/dist/components/SubagentProgress.js.map +2 -2
  107. package/dist/components/TaskCard.js +14 -11
  108. package/dist/components/TaskCard.js.map +2 -2
  109. package/dist/components/TextInput.js +9 -1
  110. package/dist/components/TextInput.js.map +2 -2
  111. package/dist/components/TodoPanel.js +44 -26
  112. package/dist/components/TodoPanel.js.map +2 -2
  113. package/dist/components/ToolUseLoader.js +2 -2
  114. package/dist/components/ToolUseLoader.js.map +2 -2
  115. package/dist/components/TreeConnector.js +4 -3
  116. package/dist/components/TreeConnector.js.map +2 -2
  117. package/dist/components/TrustDialog.js +2 -1
  118. package/dist/components/TrustDialog.js.map +2 -2
  119. package/dist/components/binary-feedback/BinaryFeedbackView.js +2 -1
  120. package/dist/components/binary-feedback/BinaryFeedbackView.js.map +2 -2
  121. package/dist/components/messages/AssistantTextMessage.js +17 -9
  122. package/dist/components/messages/AssistantTextMessage.js.map +2 -2
  123. package/dist/components/messages/AssistantToolUseMessage.js +8 -4
  124. package/dist/components/messages/AssistantToolUseMessage.js.map +2 -2
  125. package/dist/components/messages/GroupRenderer.js +2 -1
  126. package/dist/components/messages/GroupRenderer.js.map +2 -2
  127. package/dist/components/messages/NestedTasksPreview.js +13 -1
  128. package/dist/components/messages/NestedTasksPreview.js.map +2 -2
  129. package/dist/components/messages/ParallelTasksGroupView.js +4 -3
  130. package/dist/components/messages/ParallelTasksGroupView.js.map +2 -2
  131. package/dist/components/messages/TaskInModuleView.js +35 -15
  132. package/dist/components/messages/TaskInModuleView.js.map +2 -2
  133. package/dist/components/messages/TaskOutputContent.js +9 -6
  134. package/dist/components/messages/TaskOutputContent.js.map +2 -2
  135. package/dist/components/messages/UserPromptMessage.js +2 -2
  136. package/dist/components/messages/UserPromptMessage.js.map +2 -2
  137. package/dist/constants/colors.js +90 -72
  138. package/dist/constants/colors.js.map +2 -2
  139. package/dist/constants/toolInputExamples.js +84 -0
  140. package/dist/constants/toolInputExamples.js.map +7 -0
  141. package/dist/core/backupManager.js +321 -0
  142. package/dist/core/backupManager.js.map +7 -0
  143. package/dist/core/costTracker.js +9 -18
  144. package/dist/core/costTracker.js.map +2 -2
  145. package/dist/core/gitAutoCommit.js +287 -0
  146. package/dist/core/gitAutoCommit.js.map +7 -0
  147. package/dist/core/index.js +3 -0
  148. package/dist/core/index.js.map +2 -2
  149. package/dist/core/operationTracker.js +212 -0
  150. package/dist/core/operationTracker.js.map +7 -0
  151. package/dist/core/permissions/rules/allowedToolsRule.js +1 -1
  152. package/dist/core/permissions/rules/allowedToolsRule.js.map +2 -2
  153. package/dist/core/permissions/rules/autoEscalationRule.js +5 -0
  154. package/dist/core/permissions/rules/autoEscalationRule.js.map +2 -2
  155. package/dist/core/permissions/rules/projectBoundaryRule.js +5 -0
  156. package/dist/core/permissions/rules/projectBoundaryRule.js.map +2 -2
  157. package/dist/core/permissions/rules/sensitivePathsRule.js +5 -0
  158. package/dist/core/permissions/rules/sensitivePathsRule.js.map +2 -2
  159. package/dist/core/tokenStats.js +9 -0
  160. package/dist/core/tokenStats.js.map +7 -0
  161. package/dist/core/tokenStatsManager.js +331 -0
  162. package/dist/core/tokenStatsManager.js.map +7 -0
  163. package/dist/entrypoints/cli.js +115 -87
  164. package/dist/entrypoints/cli.js.map +2 -2
  165. package/dist/hooks/useAgentTokenStats.js +72 -0
  166. package/dist/hooks/useAgentTokenStats.js.map +7 -0
  167. package/dist/hooks/useAgentTranscripts.js +30 -6
  168. package/dist/hooks/useAgentTranscripts.js.map +2 -2
  169. package/dist/hooks/useLogMessages.js +12 -1
  170. package/dist/hooks/useLogMessages.js.map +2 -2
  171. package/dist/i18n/locales/en.js +6 -5
  172. package/dist/i18n/locales/en.js.map +2 -2
  173. package/dist/i18n/locales/zh-CN.js +6 -5
  174. package/dist/i18n/locales/zh-CN.js.map +2 -2
  175. package/dist/i18n/types.js.map +1 -1
  176. package/dist/permissions.js +28 -1
  177. package/dist/permissions.js.map +2 -2
  178. package/dist/query.js +78 -4
  179. package/dist/query.js.map +3 -3
  180. package/dist/screens/REPL.js +23 -3
  181. package/dist/screens/REPL.js.map +2 -2
  182. package/dist/services/claude.js +54 -3
  183. package/dist/services/claude.js.map +2 -2
  184. package/dist/services/intelligentCompactor.js +1 -1
  185. package/dist/services/intelligentCompactor.js.map +2 -2
  186. package/dist/services/mcpClient.js +81 -25
  187. package/dist/services/mcpClient.js.map +2 -2
  188. package/dist/services/sandbox/filesystemBoundary.js +58 -17
  189. package/dist/services/sandbox/filesystemBoundary.js.map +2 -2
  190. package/dist/tools/AskExpertModelTool/AskExpertModelTool.js +3 -2
  191. package/dist/tools/AskExpertModelTool/AskExpertModelTool.js.map +2 -2
  192. package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js +2 -1
  193. package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js.map +2 -2
  194. package/dist/tools/BashTool/BashTool.js +22 -3
  195. package/dist/tools/BashTool/BashTool.js.map +2 -2
  196. package/dist/tools/BashTool/prompt.js +178 -34
  197. package/dist/tools/BashTool/prompt.js.map +2 -2
  198. package/dist/tools/FileEditTool/prompt.js +6 -3
  199. package/dist/tools/FileEditTool/prompt.js.map +2 -2
  200. package/dist/tools/FileWriteTool/prompt.js +4 -2
  201. package/dist/tools/FileWriteTool/prompt.js.map +2 -2
  202. package/dist/tools/MultiEditTool/prompt.js +5 -3
  203. package/dist/tools/MultiEditTool/prompt.js.map +2 -2
  204. package/dist/tools/NotebookEditTool/NotebookEditTool.js +2 -1
  205. package/dist/tools/NotebookEditTool/NotebookEditTool.js.map +2 -2
  206. package/dist/tools/PlanModeTool/EnterPlanModeTool.js +3 -2
  207. package/dist/tools/PlanModeTool/EnterPlanModeTool.js.map +2 -2
  208. package/dist/tools/PlanModeTool/ExitPlanModeTool.js +3 -2
  209. package/dist/tools/PlanModeTool/ExitPlanModeTool.js.map +2 -2
  210. package/dist/tools/PlanModeTool/prompt.js +1 -1
  211. package/dist/tools/PlanModeTool/prompt.js.map +1 -1
  212. package/dist/tools/SkillTool/SkillTool.js +4 -3
  213. package/dist/tools/SkillTool/SkillTool.js.map +2 -2
  214. package/dist/tools/SkillTool/prompt.js +1 -1
  215. package/dist/tools/SkillTool/prompt.js.map +1 -1
  216. package/dist/tools/TaskOutputTool/TaskOutputTool.js +3 -2
  217. package/dist/tools/TaskOutputTool/TaskOutputTool.js.map +2 -2
  218. package/dist/tools/TaskTool/TaskTool.js +8 -0
  219. package/dist/tools/TaskTool/TaskTool.js.map +2 -2
  220. package/dist/utils/CircuitBreaker.js +242 -0
  221. package/dist/utils/CircuitBreaker.js.map +7 -0
  222. package/dist/utils/ask.js +2 -0
  223. package/dist/utils/ask.js.map +2 -2
  224. package/dist/utils/config.js +47 -5
  225. package/dist/utils/config.js.map +2 -2
  226. package/dist/utils/credentials/CredentialStore.js +1 -0
  227. package/dist/utils/credentials/CredentialStore.js.map +7 -0
  228. package/dist/utils/credentials/EncryptedFileStore.js +157 -0
  229. package/dist/utils/credentials/EncryptedFileStore.js.map +7 -0
  230. package/dist/utils/credentials/index.js +37 -0
  231. package/dist/utils/credentials/index.js.map +7 -0
  232. package/dist/utils/credentials/migration.js +82 -0
  233. package/dist/utils/credentials/migration.js.map +7 -0
  234. package/dist/utils/markdown.js +13 -1
  235. package/dist/utils/markdown.js.map +2 -2
  236. package/dist/utils/permissions/filesystem.js +5 -1
  237. package/dist/utils/permissions/filesystem.js.map +2 -2
  238. package/dist/utils/safePath.js +132 -0
  239. package/dist/utils/safePath.js.map +7 -0
  240. package/dist/utils/sensitiveFiles.js +125 -0
  241. package/dist/utils/sensitiveFiles.js.map +7 -0
  242. package/dist/utils/taskDisplayUtils.js +9 -9
  243. package/dist/utils/taskDisplayUtils.js.map +2 -2
  244. package/dist/utils/theme.js +6 -6
  245. package/dist/utils/theme.js.map +1 -1
  246. package/dist/utils/toolRiskClassification.js +207 -0
  247. package/dist/utils/toolRiskClassification.js.map +7 -0
  248. package/dist/utils/tooling/safeRender.js +5 -4
  249. package/dist/utils/tooling/safeRender.js.map +2 -2
  250. package/dist/version.js +2 -2
  251. package/dist/version.js.map +1 -1
  252. package/package.json +9 -7
  253. package/dist/hooks/useCancelRequest.js +0 -31
  254. package/dist/hooks/useCancelRequest.js.map +0 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools/NotebookEditTool/NotebookEditTool.tsx"],
4
- "sourcesContent": ["import { existsSync, readFileSync } from 'fs'\nimport { Box, Text } from 'ink'\nimport { extname, isAbsolute, relative, resolve } from 'path'\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { HighlightedCode } from '@components/HighlightedCode'\nimport type { Tool } from '@tool'\nimport { NotebookCellType, NotebookContent } from '@minto-types/notebook'\nimport {\n detectFileEncoding,\n detectLineEndings,\n writeTextContent,\n} from '@utils/file'\nimport { safeParseJSON } from '@utils/json'\nimport { getCwd } from '@utils/state'\nimport { DESCRIPTION, PROMPT } from './prompt'\nimport { hasWritePermission } from '@utils/permissions/filesystem'\nimport { emitReminderEvent } from '@services/systemReminder'\nimport { recordFileEdit } from '@services/fileFreshness'\n\nconst inputSchema = z.strictObject({\n notebook_path: z\n .string()\n .describe(\n 'The absolute path to the Jupyter notebook file to edit (must be absolute, not relative)',\n ),\n cell_number: z.number().describe('The index of the cell to edit (0-based)'),\n new_source: z.string().describe('The new source for the cell'),\n cell_type: z\n .enum(['code', 'markdown'])\n .optional()\n .describe(\n 'The type of the cell (code or markdown). If not specified, it defaults to the current cell type. If using edit_mode=insert, this is required.',\n ),\n edit_mode: z\n .string()\n .optional()\n .describe(\n 'The type of edit to make (replace, insert, delete). Defaults to replace.',\n ),\n})\n\nexport const NotebookEditTool = {\n name: 'NotebookEditCell',\n async description() {\n return DESCRIPTION\n },\n async prompt() {\n return PROMPT\n },\n inputSchema,\n userFacingName() {\n return 'Edit Notebook'\n },\n async isEnabled() {\n return true\n },\n isReadOnly() {\n return false\n },\n isConcurrencySafe() {\n return false // NotebookEditTool modifies state/files, not safe for concurrent execution\n },\n needsPermissions({ notebook_path }) {\n return !hasWritePermission(notebook_path)\n },\n renderResultForAssistant({ cell_number, edit_mode, new_source, error }) {\n if (error) {\n return error\n }\n switch (edit_mode) {\n case 'replace':\n return `Updated cell ${cell_number} with ${new_source}`\n case 'insert':\n return `Inserted cell ${cell_number} with ${new_source}`\n case 'delete':\n return `Deleted cell ${cell_number}`\n }\n },\n renderToolUseMessage(input, { verbose }) {\n return `notebook_path: ${verbose ? input.notebook_path : relative(getCwd(), input.notebook_path)}, cell: ${input.cell_number}, content: ${input.new_source.slice(0, 30)}\u2026, cell_type: ${input.cell_type}, edit_mode: ${input.edit_mode ?? 'replace'}`\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output) {\n // Guard against undefined or null output\n if (!output) {\n return (\n <Box flexDirection=\"column\">\n <Text>Notebook cell updated</Text>\n </Box>\n )\n }\n\n const { cell_number, new_source, language, error } = output\n\n if (error) {\n return (\n <Box flexDirection=\"column\">\n <Text color=\"red\">{error}</Text>\n </Box>\n )\n }\n\n return (\n <Box flexDirection=\"column\">\n <Text>Updated cell {cell_number}:</Text>\n <Box marginLeft={2}>\n <HighlightedCode code={new_source} language={language} />\n </Box>\n </Box>\n )\n },\n async validateInput({\n notebook_path,\n cell_number,\n cell_type,\n edit_mode = 'replace',\n }) {\n const fullPath = isAbsolute(notebook_path)\n ? notebook_path\n : resolve(getCwd(), notebook_path)\n\n if (!existsSync(fullPath)) {\n return {\n result: false,\n message: 'Notebook file does not exist.',\n }\n }\n\n if (extname(fullPath) !== '.ipynb') {\n return {\n result: false,\n message:\n 'File must be a Jupyter notebook (.ipynb file). For editing other file types, use the FileEdit tool.',\n }\n }\n\n if (cell_number < 0) {\n return {\n result: false,\n message: 'Cell number must be non-negative.',\n }\n }\n\n if (\n edit_mode !== 'replace' &&\n edit_mode !== 'insert' &&\n edit_mode !== 'delete'\n ) {\n return {\n result: false,\n message: 'Edit mode must be replace, insert, or delete.',\n }\n }\n\n if (edit_mode === 'insert' && !cell_type) {\n return {\n result: false,\n message: 'Cell type is required when using edit_mode=insert.',\n }\n }\n\n const enc = detectFileEncoding(fullPath)\n const content = readFileSync(fullPath, enc)\n const notebook = safeParseJSON(content) as NotebookContent | null\n if (!notebook) {\n return {\n result: false,\n message: 'Notebook is not valid JSON.',\n }\n }\n\n if (edit_mode === 'insert' && cell_number > notebook.cells.length) {\n return {\n result: false,\n message: `Cell number is out of bounds. For insert mode, the maximum value is ${notebook.cells.length} (to append at the end).`,\n }\n } else if (\n (edit_mode === 'replace' || edit_mode === 'delete') &&\n (cell_number >= notebook.cells.length || !notebook.cells[cell_number])\n ) {\n return {\n result: false,\n message: `Cell number is out of bounds. Notebook has ${notebook.cells.length} cells.`,\n }\n }\n\n return { result: true }\n },\n async *call({\n notebook_path,\n cell_number,\n new_source,\n cell_type,\n edit_mode,\n }) {\n const fullPath = isAbsolute(notebook_path)\n ? notebook_path\n : resolve(getCwd(), notebook_path)\n\n try {\n const enc = detectFileEncoding(fullPath)\n const content = readFileSync(fullPath, enc)\n const notebook = JSON.parse(content) as NotebookContent\n const language = notebook.metadata.language_info?.name ?? 'python'\n\n if (edit_mode === 'delete') {\n // Delete the specified cell\n notebook.cells.splice(cell_number, 1)\n } else if (edit_mode === 'insert') {\n // Insert the new cell\n const new_cell = {\n cell_type: cell_type!, // validateInput ensures cell_type is not undefined\n source: new_source,\n metadata: {},\n }\n notebook.cells.splice(\n cell_number,\n 0,\n cell_type == 'markdown' ? new_cell : { ...new_cell, outputs: [] },\n )\n } else {\n // Find the specified cell\n const targetCell = notebook.cells[cell_number]! // validateInput ensures cell_number is in bounds\n targetCell.source = new_source\n // Reset execution count and clear outputs since cell was modified\n targetCell.execution_count = undefined\n targetCell.outputs = []\n if (cell_type && cell_type !== targetCell.cell_type) {\n targetCell.cell_type = cell_type\n }\n }\n // Write back to file\n const endings = detectLineEndings(fullPath)\n const updatedNotebook = JSON.stringify(notebook, null, 1)\n writeTextContent(fullPath, updatedNotebook, enc, endings!)\n\n // Record Agent edit operation for file freshness tracking\n recordFileEdit(fullPath, updatedNotebook)\n\n // Emit file edited event for system reminders\n emitReminderEvent('file:edited', {\n filePath: fullPath,\n cellNumber: cell_number,\n newSource: new_source,\n cellType: cell_type,\n editMode: edit_mode || 'replace',\n timestamp: Date.now(),\n operation: 'notebook_edit',\n })\n const data = {\n cell_number,\n new_source,\n cell_type: cell_type ?? 'code',\n language,\n edit_mode: edit_mode ?? 'replace',\n error: '',\n }\n yield {\n type: 'result',\n data,\n resultForAssistant: this.renderResultForAssistant(data),\n }\n } catch (error) {\n if (error instanceof Error) {\n const data = {\n cell_number,\n new_source,\n cell_type: cell_type ?? 'code',\n language: 'python',\n edit_mode: 'replace',\n error: error.message,\n }\n yield {\n type: 'result',\n data,\n resultForAssistant: this.renderResultForAssistant(data),\n }\n return\n }\n const data = {\n cell_number,\n new_source,\n cell_type: cell_type ?? 'code',\n language: 'python',\n edit_mode: 'replace',\n error: 'Unknown error occurred while editing notebook',\n }\n yield {\n type: 'result',\n data,\n resultForAssistant: this.renderResultForAssistant(data),\n }\n }\n },\n} satisfies Tool<\n typeof inputSchema,\n {\n cell_number: number\n new_source: string\n cell_type: NotebookCellType\n language: string\n edit_mode: string\n error?: string\n }\n>\n"],
5
- "mappings": "AAAA,SAAS,YAAY,oBAAoB;AACzC,SAAS,KAAK,YAAY;AAC1B,SAAS,SAAS,YAAY,UAAU,eAAe;AACvD,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAC/C,SAAS,uBAAuB;AAGhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,aAAa,cAAc;AACpC,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAE/B,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,eAAe,EACZ,OAAO,EACP;AAAA,IACC;AAAA,EACF;AAAA,EACF,aAAa,EAAE,OAAO,EAAE,SAAS,yCAAyC;AAAA,EAC1E,YAAY,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M,UAAU,kBAAkB,QAAQ;AAC1C,YAAM,kBAAkB,KAAK,UAAU,UAAU,MAAM,CAAC;AACxD,uBAAiB,UAAU,iBAAiB,KAAK,OAAQ;AAGzD,qBAAe,UAAU,eAAe;AAGxC,wBAAkB,eAAe;AAAA,QAC/B,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,UAAU;AAAA,QACV,UAAU,aAAa;AAAA,QACvB,WAAW,KAAK,IAAI;AAAA,QACpB,WAAW;AAAA,MACb,CAAC;AACD,YAAM,OAAO;AAAA,QACX;AAAA,QACA;AAAA,QACA,WAAW,aAAa;AAAA,QACxB;AAAA,QACA,WAAW,aAAa;AAAA,QACxB,OAAO;AAAA,MACT;AACA,YAAM;AAAA,QACJ,MAAM;AAAA,QACN;AAAA,QACA,oBAAoB,KAAK,yBAAyB,IAAI;AAAA,MACxD;AAAA,IACF,SAAS,OAAO;AACd,UAAI,iBAAiB,OAAO;AAC1B,cAAMA,QAAO;AAAA,UACX;AAAA,UACA;AAAA,UACA,WAAW,aAAa;AAAA,UACxB,UAAU;AAAA,UACV,WAAW;AAAA,UACX,OAAO,MAAM;AAAA,QACf;AACA,cAAM;AAAA,UACJ,MAAM;AAAA,UACN,MAAAA;AAAA,UACA,oBAAoB,KAAK,yBAAyBA,KAAI;AAAA,QACxD;AACA;AAAA,MACF;AACA,YAAM,OAAO;AAAA,QACX;AAAA,QACA;AAAA,QACA,WAAW,aAAa;AAAA,QACxB,UAAU;AAAA,QACV,WAAW;AAAA,QACX,OAAO;AAAA,MACT;AACA,YAAM;AAAA,QACJ,MAAM;AAAA,QACN;AAAA,QACA,oBAAoB,KAAK,yBAAyB,IAAI;AAAA,MACxD;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { existsSync, readFileSync } from 'fs'\nimport { Box, Text } from 'ink'\nimport { extname, isAbsolute, relative, resolve } from 'path'\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { HighlightedCode } from '@components/HighlightedCode'\nimport type { Tool } from '@tool'\nimport { NotebookCellType, NotebookContent } from '@minto-types/notebook'\nimport {\n detectFileEncoding,\n detectLineEndings,\n writeTextContent,\n} from '@utils/file'\nimport { safeParseJSON } from '@utils/json'\nimport { getCwd } from '@utils/state'\nimport { DESCRIPTION, PROMPT } from './prompt'\nimport { hasWritePermission } from '@utils/permissions/filesystem'\nimport { emitReminderEvent } from '@services/systemReminder'\nimport { recordFileEdit } from '@services/fileFreshness'\nimport { FileEditTool } from '@tools/FileEditTool/FileEditTool'\n\nconst inputSchema = z.strictObject({\n notebook_path: z\n .string()\n .describe(\n 'The absolute path to the Jupyter notebook file to edit (must be absolute, not relative)',\n ),\n cell_number: z.number().describe('The index of the cell to edit (0-based)'),\n new_source: z.string().describe('The new source for the cell'),\n cell_type: z\n .enum(['code', 'markdown'])\n .optional()\n .describe(\n 'The type of the cell (code or markdown). If not specified, it defaults to the current cell type. If using edit_mode=insert, this is required.',\n ),\n edit_mode: z\n .string()\n .optional()\n .describe(\n 'The type of edit to make (replace, insert, delete). Defaults to replace.',\n ),\n})\n\nexport const NotebookEditTool = {\n name: 'NotebookEditCell',\n async description() {\n return DESCRIPTION\n },\n async prompt() {\n return PROMPT\n },\n inputSchema,\n userFacingName() {\n return 'Edit Notebook'\n },\n async isEnabled() {\n return true\n },\n isReadOnly() {\n return false\n },\n isConcurrencySafe() {\n return false // NotebookEditTool modifies state/files, not safe for concurrent execution\n },\n needsPermissions({ notebook_path }) {\n return !hasWritePermission(notebook_path)\n },\n renderResultForAssistant({ cell_number, edit_mode, new_source, error }) {\n if (error) {\n return error\n }\n switch (edit_mode) {\n case 'replace':\n return `Updated cell ${cell_number} with ${new_source}`\n case 'insert':\n return `Inserted cell ${cell_number} with ${new_source}`\n case 'delete':\n return `Deleted cell ${cell_number}`\n }\n },\n renderToolUseMessage(input, { verbose }) {\n return `notebook_path: ${verbose ? input.notebook_path : relative(getCwd(), input.notebook_path)}, cell: ${input.cell_number}, content: ${input.new_source.slice(0, 30)}\u2026, cell_type: ${input.cell_type}, edit_mode: ${input.edit_mode ?? 'replace'}`\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output) {\n // Guard against undefined or null output\n if (!output) {\n return (\n <Box flexDirection=\"column\">\n <Text>Notebook cell updated</Text>\n </Box>\n )\n }\n\n const { cell_number, new_source, language, error } = output\n\n if (error) {\n return (\n <Box flexDirection=\"column\">\n <Text color=\"red\">{error}</Text>\n </Box>\n )\n }\n\n return (\n <Box flexDirection=\"column\">\n <Text>Updated cell {cell_number}:</Text>\n <Box marginLeft={2}>\n <HighlightedCode code={new_source} language={language} />\n </Box>\n </Box>\n )\n },\n async validateInput({\n notebook_path,\n cell_number,\n cell_type,\n edit_mode = 'replace',\n }) {\n const fullPath = isAbsolute(notebook_path)\n ? notebook_path\n : resolve(getCwd(), notebook_path)\n\n if (!existsSync(fullPath)) {\n return {\n result: false,\n message: 'Notebook file does not exist.',\n }\n }\n\n if (extname(fullPath) !== '.ipynb') {\n return {\n result: false,\n message: `File must be a Jupyter notebook (.ipynb file). For editing other file types, use the ${FileEditTool.name} tool.`,\n }\n }\n\n if (cell_number < 0) {\n return {\n result: false,\n message: 'Cell number must be non-negative.',\n }\n }\n\n if (\n edit_mode !== 'replace' &&\n edit_mode !== 'insert' &&\n edit_mode !== 'delete'\n ) {\n return {\n result: false,\n message: 'Edit mode must be replace, insert, or delete.',\n }\n }\n\n if (edit_mode === 'insert' && !cell_type) {\n return {\n result: false,\n message: 'Cell type is required when using edit_mode=insert.',\n }\n }\n\n const enc = detectFileEncoding(fullPath)\n const content = readFileSync(fullPath, enc)\n const notebook = safeParseJSON(content) as NotebookContent | null\n if (!notebook) {\n return {\n result: false,\n message: 'Notebook is not valid JSON.',\n }\n }\n\n if (edit_mode === 'insert' && cell_number > notebook.cells.length) {\n return {\n result: false,\n message: `Cell number is out of bounds. For insert mode, the maximum value is ${notebook.cells.length} (to append at the end).`,\n }\n } else if (\n (edit_mode === 'replace' || edit_mode === 'delete') &&\n (cell_number >= notebook.cells.length || !notebook.cells[cell_number])\n ) {\n return {\n result: false,\n message: `Cell number is out of bounds. Notebook has ${notebook.cells.length} cells.`,\n }\n }\n\n return { result: true }\n },\n async *call({\n notebook_path,\n cell_number,\n new_source,\n cell_type,\n edit_mode,\n }) {\n const fullPath = isAbsolute(notebook_path)\n ? notebook_path\n : resolve(getCwd(), notebook_path)\n\n try {\n const enc = detectFileEncoding(fullPath)\n const content = readFileSync(fullPath, enc)\n const notebook = JSON.parse(content) as NotebookContent\n const language = notebook.metadata.language_info?.name ?? 'python'\n\n if (edit_mode === 'delete') {\n // Delete the specified cell\n notebook.cells.splice(cell_number, 1)\n } else if (edit_mode === 'insert') {\n // Insert the new cell\n const new_cell = {\n cell_type: cell_type!, // validateInput ensures cell_type is not undefined\n source: new_source,\n metadata: {},\n }\n notebook.cells.splice(\n cell_number,\n 0,\n cell_type == 'markdown' ? new_cell : { ...new_cell, outputs: [] },\n )\n } else {\n // Find the specified cell\n const targetCell = notebook.cells[cell_number]! // validateInput ensures cell_number is in bounds\n targetCell.source = new_source\n // Reset execution count and clear outputs since cell was modified\n targetCell.execution_count = undefined\n targetCell.outputs = []\n if (cell_type && cell_type !== targetCell.cell_type) {\n targetCell.cell_type = cell_type\n }\n }\n // Write back to file\n const endings = detectLineEndings(fullPath)\n const updatedNotebook = JSON.stringify(notebook, null, 1)\n writeTextContent(fullPath, updatedNotebook, enc, endings!)\n\n // Record Agent edit operation for file freshness tracking\n recordFileEdit(fullPath, updatedNotebook)\n\n // Emit file edited event for system reminders\n emitReminderEvent('file:edited', {\n filePath: fullPath,\n cellNumber: cell_number,\n newSource: new_source,\n cellType: cell_type,\n editMode: edit_mode || 'replace',\n timestamp: Date.now(),\n operation: 'notebook_edit',\n })\n const data = {\n cell_number,\n new_source,\n cell_type: cell_type ?? 'code',\n language,\n edit_mode: edit_mode ?? 'replace',\n error: '',\n }\n yield {\n type: 'result',\n data,\n resultForAssistant: this.renderResultForAssistant(data),\n }\n } catch (error) {\n if (error instanceof Error) {\n const data = {\n cell_number,\n new_source,\n cell_type: cell_type ?? 'code',\n language: 'python',\n edit_mode: 'replace',\n error: error.message,\n }\n yield {\n type: 'result',\n data,\n resultForAssistant: this.renderResultForAssistant(data),\n }\n return\n }\n const data = {\n cell_number,\n new_source,\n cell_type: cell_type ?? 'code',\n language: 'python',\n edit_mode: 'replace',\n error: 'Unknown error occurred while editing notebook',\n }\n yield {\n type: 'result',\n data,\n resultForAssistant: this.renderResultForAssistant(data),\n }\n }\n },\n} satisfies Tool<\n typeof inputSchema,\n {\n cell_number: number\n new_source: string\n cell_type: NotebookCellType\n language: string\n edit_mode: string\n error?: string\n }\n>\n"],
5
+ "mappings": "AAAA,SAAS,YAAY,oBAAoB;AACzC,SAAS,KAAK,YAAY;AAC1B,SAAS,SAAS,YAAY,UAAU,eAAe;AACvD,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAC/C,SAAS,uBAAuB;AAGhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,aAAa,cAAc;AACpC,SAAS,0BAA0B;AACnC,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAE7B,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,eAAe,EACZ,OAAO,EACP;AAAA,IACC;AAAA,EACF;AAAA,EACF,aAAa,EAAE,OAAO,EAAE,SAAS,yCAAyC;AAAA,EAC1E,YAAY,EAAE,OAAO,EAAE,SAAS,6BAA6B;AAAA,EAC7D,WAAW,EACR,KAAK,CAAC,QAAQ,UAAU,CAAC,EACzB,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAW,EACR,OAAO,EACP,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ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C/B,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,WAAW;AAAA,QACX,UAAU;AAAA,QACV,UAAU,aAAa;AAAA,QACvB,WAAW,KAAK,IAAI;AAAA,QACpB,WAAW;AAAA,MACb,CAAC;AACD,YAAM,OAAO;AAAA,QACX;AAAA,QACA;AAAA,QACA,WAAW,aAAa;AAAA,QACxB;AAAA,QACA,WAAW,aAAa;AAAA,QACxB,OAAO;AAAA,MACT;AACA,YAAM;AAAA,QACJ,MAAM;AAAA,QACN;AAAA,QACA,oBAAoB,KAAK,yBAAyB,IAAI;AAAA,MACxD;AAAA,IACF,SAAS,OAAO;AACd,UAAI,iBAAiB,OAAO;AAC1B,cAAMA,QAAO;AAAA,UACX;AAAA,UACA;AAAA,UACA,WAAW,aAAa;AAAA,UACxB,UAAU;AAAA,UACV,WAAW;AAAA,UACX,OAAO,MAAM;AAAA,QACf;AACA,cAAM;AAAA,UACJ,MAAM;AAAA,UACN,MAAAA;AAAA,UACA,oBAAoB,KAAK,yBAAyBA,KAAI;AAAA,QACxD;AACA;AAAA,MACF;AACA,YAAM,OAAO;AAAA,QACX;AAAA,QACA;AAAA,QACA,WAAW,aAAa;AAAA,QACxB,UAAU;AAAA,QACV,WAAW;AAAA,QACX,OAAO;AAAA,MACT;AACA,YAAM;AAAA,QACJ,MAAM;AAAA,QACN;AAAA,QACA,oBAAoB,KAAK,yBAAyB,IAAI;AAAA,MACxD;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": ["data"]
7
7
  }
@@ -3,6 +3,7 @@ import React from "react";
3
3
  import { z } from "zod";
4
4
  import { enterPlanMode } from "../../utils/plan/planMode.js";
5
5
  import { ENTER_DESCRIPTION, ENTER_PROMPT, ENTER_TOOL_NAME } from "./prompt.js";
6
+ import { SEMANTIC_COLORS } from "../../constants/colors.js";
6
7
  const inputSchema = z.strictObject({});
7
8
  const EnterPlanModeTool = {
8
9
  name: ENTER_TOOL_NAME,
@@ -35,10 +36,10 @@ const EnterPlanModeTool = {
35
36
  return "";
36
37
  },
37
38
  renderToolUseRejectedMessage() {
38
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "User declined to enter plan mode"));
39
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, "User declined to enter plan mode"));
39
40
  },
40
41
  renderToolResultMessage(_output) {
41
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "\u25CF"), /* @__PURE__ */ React.createElement(Text, null, " Entered plan mode")), /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "Minto is now exploring and designing an implementation approach.")));
42
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "\u25CF"), /* @__PURE__ */ React.createElement(Text, null, " Entered plan mode")), /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, "Minto is now exploring and designing an implementation approach.")));
42
43
  },
43
44
  renderResultForAssistant(output) {
44
45
  return `${output.message}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools/PlanModeTool/EnterPlanModeTool.tsx"],
4
- "sourcesContent": ["/**\n * Enter Plan Mode Tool\n *\n * Requests permission to enter plan mode for complex tasks.\n */\n\nimport { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport { Tool } from '@tool'\nimport { enterPlanMode } from '@utils/plan/planMode'\nimport { ENTER_DESCRIPTION, ENTER_PROMPT, ENTER_TOOL_NAME } from './prompt'\n\nconst inputSchema = z.strictObject({})\n\ntype Output = {\n message: string\n}\n\nexport const EnterPlanModeTool = {\n name: ENTER_TOOL_NAME,\n async description() {\n return ENTER_DESCRIPTION\n },\n userFacingName() {\n return ''\n },\n inputSchema,\n isReadOnly() {\n return true\n },\n isConcurrencySafe() {\n return true\n },\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return true\n },\n requiresUserInteraction() {\n return true\n },\n async prompt() {\n return ENTER_PROMPT\n },\n renderToolUseMessage() {\n return ''\n },\n renderToolUseRejectedMessage() {\n return (\n <Box flexDirection=\"row\" marginTop={1}>\n <Text dimColor>User declined to enter plan mode</Text>\n </Box>\n )\n },\n renderToolResultMessage(_output: Output) {\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Box flexDirection=\"row\">\n <Text color=\"cyan\">\u25CF</Text>\n <Text> Entered plan mode</Text>\n </Box>\n <Box paddingLeft={2}>\n <Text dimColor>\n Minto is now exploring and designing an implementation approach.\n </Text>\n </Box>\n </Box>\n )\n },\n renderResultForAssistant(output: Output) {\n return `${output.message}\n\nIn plan mode, you should:\n1. Thoroughly explore the codebase to understand existing patterns\n2. Identify similar features and architectural approaches\n3. Consider multiple approaches and their trade-offs\n4. Use AskUserQuestion if you need to clarify the approach\n5. Design a concrete implementation strategy\n6. When ready, use ExitPlanMode to present your plan for approval\n\nRemember: DO NOT write or edit any files yet. This is a read-only exploration and planning phase.`\n },\n async *call(_input: z.infer<typeof inputSchema>, context: any) {\n if (context?.agentId) {\n throw new Error('EnterPlanMode tool cannot be used in agent contexts')\n }\n\n enterPlanMode(context)\n\n const output: Output = {\n message:\n 'Entered plan mode. You should now focus on exploring the codebase and designing an implementation approach.',\n }\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n },\n} satisfies Tool<typeof inputSchema, Output>\n"],
5
- "mappings": "AAMA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAElB,SAA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;AAAA,MACN,MAAM;AAAA,MACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,IAC1D;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["/**\n * Enter Plan Mode Tool\n *\n * Requests permission to enter plan mode for complex tasks.\n */\n\nimport { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport { Tool } from '@tool'\nimport { enterPlanMode } from '@utils/plan/planMode'\nimport { ENTER_DESCRIPTION, ENTER_PROMPT, ENTER_TOOL_NAME } from './prompt'\nimport { SEMANTIC_COLORS } from '@constants/colors'\n\nconst inputSchema = z.strictObject({})\n\ntype Output = {\n message: string\n}\n\nexport const EnterPlanModeTool = {\n name: ENTER_TOOL_NAME,\n async description() {\n return ENTER_DESCRIPTION\n },\n userFacingName() {\n return ''\n },\n inputSchema,\n isReadOnly() {\n return true\n },\n isConcurrencySafe() {\n return true\n },\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return true\n },\n requiresUserInteraction() {\n return true\n },\n async prompt() {\n return ENTER_PROMPT\n },\n renderToolUseMessage() {\n return ''\n },\n renderToolUseRejectedMessage() {\n return (\n <Box flexDirection=\"row\" marginTop={1}>\n <Text color={SEMANTIC_COLORS.dim}>\n User declined to enter plan mode\n </Text>\n </Box>\n )\n },\n renderToolResultMessage(_output: Output) {\n return (\n <Box flexDirection=\"column\" marginTop={1}>\n <Box flexDirection=\"row\">\n <Text color=\"cyan\">\u25CF</Text>\n <Text> Entered plan mode</Text>\n </Box>\n <Box paddingLeft={2}>\n <Text color={SEMANTIC_COLORS.dim}>\n Minto is now exploring and designing an implementation approach.\n </Text>\n </Box>\n </Box>\n )\n },\n renderResultForAssistant(output: Output) {\n return `${output.message}\n\nIn plan mode, you should:\n1. Thoroughly explore the codebase to understand existing patterns\n2. Identify similar features and architectural approaches\n3. Consider multiple approaches and their trade-offs\n4. Use AskUserQuestion if you need to clarify the approach\n5. Design a concrete implementation strategy\n6. When ready, use ExitPlanMode to present your plan for approval\n\nRemember: DO NOT write or edit any files yet. This is a read-only exploration and planning phase.`\n },\n async *call(_input: z.infer<typeof inputSchema>, context: any) {\n if (context?.agentId) {\n throw new Error('EnterPlanMode tool cannot be used in agent contexts')\n }\n\n enterPlanMode(context)\n\n const output: Output = {\n message:\n 'Entered plan mode. You should now focus on exploring the codebase and designing an implementation approach.',\n }\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n },\n} satisfies Tool<typeof inputSchema, Output>\n"],
5
+ "mappings": "AAMA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAElB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB,cAAc,uBAAuB;AACjE,SAAS,uBAAuB;AAEhC,MAAM,cAAc,EAAE,aAAa,CAAC,CAAC;AAM9B,MAAM,oBAAoB;AAAA,EAC/B,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA,aAAa;AACX,WAAO;AAAA,EACT;AAAA,EACA,oBAAoB;AAClB,WAAO;AAAA,EACT;AAAA,EACA,MAAM,YAAY;AAChB,WAAO;AAAA,EACT;AAAA,EACA,mBAAmB;AACjB,WAAO;AAAA,EACT;AAAA,EACA,0BAA0B;AACxB,WAAO;AAAA,EACT;AAAA,EACA,MAAM,SAAS;AACb,WAAO;AAAA,EACT;AAAA,EACA,uBAAuB;AACrB,WAAO;AAAA,EACT;AAAA,EACA,+BAA+B;AAC7B,WACE,oCAAC,OAAI,eAAc,OAAM,WAAW,KAClC,oCAAC,QAAK,OAAO,gBAAgB,OAAK,kCAElC,CACF;AAAA,EAEJ;AAAA,EACA,wBAAwB,SAAiB;AACvC,WACE,oCAAC,OAAI,eAAc,UAAS,WAAW,KACrC,oCAAC,OAAI,eAAc,SACjB,oCAAC,QAAK,OAAM,UAAO,QAAC,GACpB,oCAAC,YAAK,oBAAkB,CAC1B,GACA,oCAAC,OAAI,aAAa,KAChB,oCAAC,QAAK,OAAO,gBAAgB,OAAK,kEAElC,CACF,CACF;AAAA,EAEJ;AAAA,EACA,yBAAyB,QAAgB;AACvC,WAAO,GAAG,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW1B;AAAA,EACA,OAAO,KAAK,QAAqC,SAAc;AAC7D,QAAI,SAAS,SAAS;AACpB,YAAM,IAAI,MAAM,qDAAqD;AAAA,IACvE;AAEA,kBAAc,OAAO;AAErB,UAAM,SAAiB;AAAA,MACrB,SACE;AAAA,IACJ;AACA,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,IAC1D;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -7,6 +7,7 @@ import {
7
7
  readPlanFile
8
8
  } from "../../utils/plan/planMode.js";
9
9
  import { EXIT_DESCRIPTION, EXIT_PROMPT, EXIT_TOOL_NAME } from "./prompt.js";
10
+ import { SEMANTIC_COLORS } from "../../constants/colors.js";
10
11
  function getExitPlanModePlanText(conversationKey) {
11
12
  const { content } = readPlanFile(void 0, conversationKey);
12
13
  return content || "No plan found. Please write your plan to the plan file first.";
@@ -54,7 +55,7 @@ const ExitPlanModeTool = {
54
55
  paddingX: 1,
55
56
  overflow: "hidden"
56
57
  },
57
- /* @__PURE__ */ React.createElement(Text, { dimColor: true }, plan)
58
+ /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, plan)
58
59
  ))));
59
60
  },
60
61
  renderToolResultMessage(output) {
@@ -63,7 +64,7 @@ const ExitPlanModeTool = {
63
64
  }
64
65
  const planPath = typeof output.filePath === "string" ? output.filePath : null;
65
66
  const plan = output.plan || "No plan found";
66
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", marginTop: 1, width: "100%" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "\u25CF"), /* @__PURE__ */ React.createElement(Text, null, " User approved the plan")), /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, planPath ? /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "Plan saved to: ", planPath) : null, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, plan.substring(0, 200), "..."))));
67
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", marginTop: 1, width: "100%" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "\u25CF"), /* @__PURE__ */ React.createElement(Text, null, " User approved the plan")), /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, planPath ? /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, "Plan saved to: ", planPath) : null, /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, plan.substring(0, 200), "..."))));
67
68
  },
68
69
  renderResultForAssistant(output) {
69
70
  if (!output) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools/PlanModeTool/ExitPlanModeTool.tsx"],
4
- "sourcesContent": ["/**\n * Exit Plan Mode Tool\n *\n * Prompts the user to exit plan mode and start coding.\n */\n\nimport { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport { Tool } from '@tool'\nimport {\n getPlanConversationKey,\n getPlanFilePath,\n readPlanFile,\n} from '@utils/plan/planMode'\nimport { EXIT_DESCRIPTION, EXIT_PROMPT, EXIT_TOOL_NAME } from './prompt'\n\nfunction getExitPlanModePlanText(conversationKey?: string): string {\n const { content } = readPlanFile(undefined, conversationKey)\n return (\n content || 'No plan found. Please write your plan to the plan file first.'\n )\n}\n\nconst inputSchema = z.strictObject({}).passthrough()\n\ntype Output = {\n plan: string\n isAgent: boolean\n filePath?: string\n}\n\nexport const ExitPlanModeTool = {\n name: EXIT_TOOL_NAME,\n async description() {\n return EXIT_DESCRIPTION\n },\n userFacingName() {\n return ''\n },\n inputSchema,\n isReadOnly() {\n return false\n },\n isConcurrencySafe() {\n return true\n },\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return true\n },\n requiresUserInteraction() {\n return true\n },\n async prompt() {\n return EXIT_PROMPT\n },\n renderToolUseMessage() {\n return ''\n },\n renderToolUseRejectedMessage(\n _input: z.infer<typeof inputSchema>,\n options: { conversationKey?: string } = {},\n ) {\n const conversationKey =\n typeof options.conversationKey === 'string' &&\n options.conversationKey.trim()\n ? options.conversationKey.trim()\n : undefined\n\n const plan = getExitPlanModePlanText(conversationKey)\n\n return (\n <Box flexDirection=\"column\" marginTop={1} width=\"100%\">\n <Box flexDirection=\"row\">\n <Text>&nbsp;&nbsp;\u23BF &nbsp;</Text>\n <Box flexDirection=\"column\" width=\"100%\">\n <Text color=\"red\">User rejected the plan:</Text>\n <Box\n borderStyle=\"round\"\n borderColor=\"cyan\"\n borderDimColor\n paddingX={1}\n overflow=\"hidden\"\n >\n <Text dimColor>{plan}</Text>\n </Box>\n </Box>\n </Box>\n </Box>\n )\n },\n renderToolResultMessage(output: Output) {\n if (!output) {\n return (\n <Box paddingLeft={2}>\n <Text>Plan mode completed</Text>\n </Box>\n )\n }\n\n const planPath =\n typeof output.filePath === 'string' ? output.filePath : null\n const plan = output.plan || 'No plan found'\n\n return (\n <Box flexDirection=\"column\" marginTop={1} width=\"100%\">\n <Box flexDirection=\"row\">\n <Text color=\"cyan\">\u25CF</Text>\n <Text> User approved the plan</Text>\n </Box>\n <Box flexDirection=\"row\">\n <Text>&nbsp;&nbsp;\u23BF &nbsp;</Text>\n <Box flexDirection=\"column\">\n {planPath ? <Text dimColor>Plan saved to: {planPath}</Text> : null}\n <Text dimColor>{plan.substring(0, 200)}...</Text>\n </Box>\n </Box>\n </Box>\n )\n },\n renderResultForAssistant(output: Output) {\n if (!output) {\n return 'Plan mode completed'\n }\n\n if (output.isAgent) {\n return 'User has approved the plan. There is nothing else needed from you now. Please respond with \"ok\"'\n }\n\n return `User has approved your plan. You can now start coding. Start with updating your todo list if applicable\n\nYour plan has been saved to: ${output.filePath}\nYou can refer back to it if needed during implementation.\n\n## Approved Plan:\n${output.plan}`\n },\n async *call(input: z.infer<typeof inputSchema>, context: any) {\n const conversationKey = getPlanConversationKey(context)\n const planFilePath = getPlanFilePath(context?.agentId, conversationKey)\n const { content, exists } = readPlanFile(context?.agentId, conversationKey)\n\n if (!exists) {\n throw new Error(\n `No plan file found at ${planFilePath}. Please write your plan to this file before calling ExitPlanMode.`,\n )\n }\n\n const isAgent = !!context?.agentId\n const output: Output = {\n plan: content,\n isAgent,\n filePath: planFilePath,\n }\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n },\n} satisfies Tool<typeof inputSchema, Output>\n"],
5
- "mappings": "AAMA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB,aAAa,sBAAsB;AAE9D,SAAS,wBAAwB,iBAAkC;AACjE,QAAM,EAAE,QAAQ,IAAI,aAAa,QAAW,eAAe;AAC3D,SACE,WAAW;AAEf;AAEA,MAAM,cAAc,EAAE,aAAa,CAAC,CAAC,EAAE,YAAY;AAQ5C,MAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA,aAAa;AACX,WAAO;AAAA,EACT;AAAA,EACA,oBAAoB;AAClB,WAAO;AAAA,EACT;AAAA,E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,oCAAC,QAAK,UAAQ,QAAC,mBAAgB,QAAS,IAAU,MAC9D,oCAAC,QAAK,UAAQ,QAAE,KAAK,UAAU,GAAG,GAAG,GAAE,KAAG,CAC5C,CACF,CACF;AAAA,EAEJ;AAAA,EACA,yBAAyB,QAAgB;AACvC,QAAI,CAAC,QAAQ;AACX,aAAO;AAAA,IACT;AAEA,QAAI,OAAO,SAAS;AAClB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA;AAAA,+BAEoB,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA,EAI5C,OAAO,IAAI;AAAA,EACX;AAAA,EACA,OAAO,KAAK,OAAoC,SAAc;AAC5D,UAAM,kBAAkB,uBAAuB,OAAO;AACtD,UAAM,eAAe,gBAAgB,SAAS,SAAS,eAAe;AACtE,UAAM,EAAE,SAAS,OAAO,IAAI,aAAa,SAAS,SAAS,eAAe;AAE1E,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI;AAAA,QACR,yBAAyB,YAAY;AAAA,MACvC;AAAA,IACF;AAEA,UAAM,UAAU,CAAC,CAAC,SAAS;AAC3B,UAAM,SAAiB;AAAA,MACrB,MAAM;AAAA,MACN;AAAA,MACA,UAAU;AAAA,IACZ;AACA,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,IAC1D;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["/**\n * Exit Plan Mode Tool\n *\n * Prompts the user to exit plan mode and start coding.\n */\n\nimport { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport { Tool } from '@tool'\nimport {\n getPlanConversationKey,\n getPlanFilePath,\n readPlanFile,\n} from '@utils/plan/planMode'\nimport { EXIT_DESCRIPTION, EXIT_PROMPT, EXIT_TOOL_NAME } from './prompt'\nimport { SEMANTIC_COLORS } from '@constants/colors'\n\nfunction getExitPlanModePlanText(conversationKey?: string): string {\n const { content } = readPlanFile(undefined, conversationKey)\n return (\n content || 'No plan found. Please write your plan to the plan file first.'\n )\n}\n\nconst inputSchema = z.strictObject({}).passthrough()\n\ntype Output = {\n plan: string\n isAgent: boolean\n filePath?: string\n}\n\nexport const ExitPlanModeTool = {\n name: EXIT_TOOL_NAME,\n async description() {\n return EXIT_DESCRIPTION\n },\n userFacingName() {\n return ''\n },\n inputSchema,\n isReadOnly() {\n return false\n },\n isConcurrencySafe() {\n return true\n },\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return true\n },\n requiresUserInteraction() {\n return true\n },\n async prompt() {\n return EXIT_PROMPT\n },\n renderToolUseMessage() {\n return ''\n },\n renderToolUseRejectedMessage(\n _input: z.infer<typeof inputSchema>,\n options: { conversationKey?: string } = {},\n ) {\n const conversationKey =\n typeof options.conversationKey === 'string' &&\n options.conversationKey.trim()\n ? options.conversationKey.trim()\n : undefined\n\n const plan = getExitPlanModePlanText(conversationKey)\n\n return (\n <Box flexDirection=\"column\" marginTop={1} width=\"100%\">\n <Box flexDirection=\"row\">\n <Text>&nbsp;&nbsp;\u23BF &nbsp;</Text>\n <Box flexDirection=\"column\" width=\"100%\">\n <Text color=\"red\">User rejected the plan:</Text>\n <Box\n borderStyle=\"round\"\n borderColor=\"cyan\"\n borderDimColor\n paddingX={1}\n overflow=\"hidden\"\n >\n <Text color={SEMANTIC_COLORS.dim}>{plan}</Text>\n </Box>\n </Box>\n </Box>\n </Box>\n )\n },\n renderToolResultMessage(output: Output) {\n if (!output) {\n return (\n <Box paddingLeft={2}>\n <Text>Plan mode completed</Text>\n </Box>\n )\n }\n\n const planPath =\n typeof output.filePath === 'string' ? output.filePath : null\n const plan = output.plan || 'No plan found'\n\n return (\n <Box flexDirection=\"column\" marginTop={1} width=\"100%\">\n <Box flexDirection=\"row\">\n <Text color=\"cyan\">\u25CF</Text>\n <Text> User approved the plan</Text>\n </Box>\n <Box flexDirection=\"row\">\n <Text>&nbsp;&nbsp;\u23BF &nbsp;</Text>\n <Box flexDirection=\"column\">\n {planPath ? (\n <Text color={SEMANTIC_COLORS.dim}>Plan saved to: {planPath}</Text>\n ) : null}\n <Text color={SEMANTIC_COLORS.dim}>{plan.substring(0, 200)}...</Text>\n </Box>\n </Box>\n </Box>\n )\n },\n renderResultForAssistant(output: Output) {\n if (!output) {\n return 'Plan mode completed'\n }\n\n if (output.isAgent) {\n return 'User has approved the plan. There is nothing else needed from you now. Please respond with \"ok\"'\n }\n\n return `User has approved your plan. You can now start coding. Start with updating your todo list if applicable\n\nYour plan has been saved to: ${output.filePath}\nYou can refer back to it if needed during implementation.\n\n## Approved Plan:\n${output.plan}`\n },\n async *call(input: z.infer<typeof inputSchema>, context: any) {\n const conversationKey = getPlanConversationKey(context)\n const planFilePath = getPlanFilePath(context?.agentId, conversationKey)\n const { content, exists } = readPlanFile(context?.agentId, conversationKey)\n\n if (!exists) {\n throw new Error(\n `No plan file found at ${planFilePath}. Please write your plan to this file before calling ExitPlanMode.`,\n )\n }\n\n const isAgent = !!context?.agentId\n const output: Output = {\n plan: content,\n isAgent,\n filePath: planFilePath,\n }\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n },\n} satisfies Tool<typeof inputSchema, Output>\n"],
5
+ "mappings": "AAMA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB,aAAa,sBAAsB;AAC9D,SAAS,uBAAuB;AAEhC,SAAS,wBAAwB,iBAAkC;AACjE,QAAM,EAAE,QAAQ,IAAI,aAAa,QAAW,eAAe;AAC3D,SACE,WAAW;AAEf;AAEA,MAAM,cAAc,EAAE,aAAa,CAAC,CAAC,EAAE,YAAY;AAQ5C,MAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA,aAAa;AAC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OAAI,eAAc,SACjB,oCAAC,YAAK,qBAAoB,GAC1B,oCAAC,OAAI,eAAc,YAChB,WACC,oCAAC,QAAK,OAAO,gBAAgB,OAAK,mBAAgB,QAAS,IACzD,MACJ,oCAAC,QAAK,OAAO,gBAAgB,OAAM,KAAK,UAAU,GAAG,GAAG,GAAE,KAAG,CAC/D,CACF,CACF;AAAA,EAEJ;AAAA,EACA,yBAAyB,QAAgB;AACvC,QAAI,CAAC,QAAQ;AACX,aAAO;AAAA,IACT;AAEA,QAAI,OAAO,SAAS;AAClB,aAAO;AAAA,IACT;AAEA,WAAO;AAAA;AAAA,+BAEoB,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA,EAI5C,OAAO,IAAI;AAAA,EACX;AAAA,EACA,OAAO,KAAK,OAAoC,SAAc;AAC5D,UAAM,kBAAkB,uBAAuB,OAAO;AACtD,UAAM,eAAe,gBAAgB,SAAS,SAAS,eAAe;AACtE,UAAM,EAAE,SAAS,OAAO,IAAI,aAAa,SAAS,SAAS,eAAe;AAE1E,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI;AAAA,QACR,yBAAyB,YAAY;AAAA,MACvC;AAAA,IACF;AAEA,UAAM,UAAU,CAAC,CAAC,SAAS;AAC3B,UAAM,SAAiB;AAAA,MACrB,MAAM;AAAA,MACN;AAAA,MACA,UAAU;AAAA,IACZ;AACA,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,IAC1D;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -46,7 +46,7 @@ Only skip EnterPlanMode for simple tasks:
46
46
  ## What Happens in Plan Mode
47
47
 
48
48
  In plan mode, you'll:
49
- 1. Thoroughly explore the codebase using Glob, Grep, and Read tools
49
+ 1. Thoroughly explore the codebase using Glob, Grep, and View tools
50
50
  2. Understand existing patterns and architecture
51
51
  3. Design an implementation approach
52
52
  4. Present your plan to the user for approval
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools/PlanModeTool/prompt.ts"],
4
- "sourcesContent": ["export const ENTER_TOOL_NAME = 'EnterPlanMode'\nexport const EXIT_TOOL_NAME = 'ExitPlanMode'\n\nexport const ENTER_DESCRIPTION =\n 'Requests permission to enter plan mode for complex tasks requiring exploration and design'\n\nexport const ENTER_PROMPT = `Use this tool proactively when you're about to start a non-trivial implementation task. Getting user sign-off on your approach before writing code prevents wasted effort and ensures alignment. This tool transitions you into plan mode where you can explore the codebase and design an implementation approach for user approval.\n\n## When to Use This Tool\n\n**Prefer using EnterPlanMode** for implementation tasks unless they're simple. Use it when ANY of these conditions apply:\n\n1. **New Feature Implementation**: Adding meaningful new functionality\n - Example: \"Add a logout button\" - where should it go? What should happen on click?\n - Example: \"Add form validation\" - what rules? What error messages?\n\n2. **Multiple Valid Approaches**: The task can be solved in several different ways\n - Example: \"Add caching to the API\" - could use Redis, in-memory, file-based, etc.\n - Example: \"Improve performance\" - many optimization strategies possible\n\n3. **Code Modifications**: Changes that affect existing behavior or structure\n - Example: \"Update the login flow\" - what exactly should change?\n - Example: \"Refactor this component\" - what's the target architecture?\n\n4. **Architectural Decisions**: The task requires choosing between patterns or technologies\n - Example: \"Add real-time updates\" - WebSockets vs SSE vs polling\n - Example: \"Implement state management\" - Redux vs Context vs custom solution\n\n5. **Multi-File Changes**: The task will likely touch more than 2-3 files\n - Example: \"Refactor the authentication system\"\n - Example: \"Add a new API endpoint with tests\"\n\n6. **Unclear Requirements**: You need to explore before understanding the full scope\n - Example: \"Make the app faster\" - need to profile and identify bottlenecks\n - Example: \"Fix the bug in checkout\" - need to investigate root cause\n\n7. **User Preferences Matter**: The implementation could reasonably go multiple ways\n - If you would use AskUserQuestion to clarify the approach, use EnterPlanMode instead\n - Plan mode lets you explore first, then present options with context\n\n## When NOT to Use This Tool\n\nOnly skip EnterPlanMode for simple tasks:\n- Single-line or few-line fixes (typos, obvious bugs, small tweaks)\n- Adding a single function with clear requirements\n- Tasks where the user has given very specific, detailed instructions\n- Pure research/exploration tasks (use the Task tool with explore agent instead)\n\n## What Happens in Plan Mode\n\nIn plan mode, you'll:\n1. Thoroughly explore the codebase using Glob, Grep, and Read tools\n2. Understand existing patterns and architecture\n3. Design an implementation approach\n4. Present your plan to the user for approval\n5. Use AskUserQuestion if you need to clarify approaches\n6. Exit plan mode with ExitPlanMode when ready to implement\n\n## Important Notes\n\n- This tool REQUIRES user approval - they must consent to entering plan mode\n- If unsure whether to use it, err on the side of planning - it's better to get alignment upfront than to redo work\n- Users appreciate being consulted before significant changes are made to their codebase`\n\nexport const EXIT_DESCRIPTION =\n 'Prompts the user to exit plan mode and start coding'\n\nexport const EXIT_PROMPT = `Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.\n\n## How This Tool Works\n- You should have already written your plan to the plan file specified in the plan mode system message\n- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote\n- This tool simply signals that you're done planning and ready for the user to review and approve\n- The user will see the contents of your plan file when they review it\n\n## When to Use This Tool\nIMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.\n\n## Handling Ambiguity in Plans\nBefore using this tool, ensure your plan is clear and unambiguous. If there are multiple valid approaches or unclear requirements:\n1. Use the AskUserQuestion tool to clarify with the user\n2. Ask about specific implementation choices (e.g., architectural patterns, which library to use)\n3. Clarify any assumptions that could affect the implementation\n4. Edit your plan file to incorporate user feedback\n5. Only proceed with ExitPlanMode after resolving ambiguities and updating the plan file\n\n## Examples\n\n1. Initial task: \"Search for and understand the implementation of vim mode in the codebase\" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.\n2. Initial task: \"Help me implement yank mode for vim\" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.\n3. Initial task: \"Add a new feature to handle user authentication\" - If unsure about auth method (OAuth, JWT, etc.), use AskUserQuestion first, then use exit plan mode tool after clarifying the approach.`\n"],
4
+ "sourcesContent": ["export const ENTER_TOOL_NAME = 'EnterPlanMode'\nexport const EXIT_TOOL_NAME = 'ExitPlanMode'\n\nexport const ENTER_DESCRIPTION =\n 'Requests permission to enter plan mode for complex tasks requiring exploration and design'\n\nexport const ENTER_PROMPT = `Use this tool proactively when you're about to start a non-trivial implementation task. Getting user sign-off on your approach before writing code prevents wasted effort and ensures alignment. This tool transitions you into plan mode where you can explore the codebase and design an implementation approach for user approval.\n\n## When to Use This Tool\n\n**Prefer using EnterPlanMode** for implementation tasks unless they're simple. Use it when ANY of these conditions apply:\n\n1. **New Feature Implementation**: Adding meaningful new functionality\n - Example: \"Add a logout button\" - where should it go? What should happen on click?\n - Example: \"Add form validation\" - what rules? What error messages?\n\n2. **Multiple Valid Approaches**: The task can be solved in several different ways\n - Example: \"Add caching to the API\" - could use Redis, in-memory, file-based, etc.\n - Example: \"Improve performance\" - many optimization strategies possible\n\n3. **Code Modifications**: Changes that affect existing behavior or structure\n - Example: \"Update the login flow\" - what exactly should change?\n - Example: \"Refactor this component\" - what's the target architecture?\n\n4. **Architectural Decisions**: The task requires choosing between patterns or technologies\n - Example: \"Add real-time updates\" - WebSockets vs SSE vs polling\n - Example: \"Implement state management\" - Redux vs Context vs custom solution\n\n5. **Multi-File Changes**: The task will likely touch more than 2-3 files\n - Example: \"Refactor the authentication system\"\n - Example: \"Add a new API endpoint with tests\"\n\n6. **Unclear Requirements**: You need to explore before understanding the full scope\n - Example: \"Make the app faster\" - need to profile and identify bottlenecks\n - Example: \"Fix the bug in checkout\" - need to investigate root cause\n\n7. **User Preferences Matter**: The implementation could reasonably go multiple ways\n - If you would use AskUserQuestion to clarify the approach, use EnterPlanMode instead\n - Plan mode lets you explore first, then present options with context\n\n## When NOT to Use This Tool\n\nOnly skip EnterPlanMode for simple tasks:\n- Single-line or few-line fixes (typos, obvious bugs, small tweaks)\n- Adding a single function with clear requirements\n- Tasks where the user has given very specific, detailed instructions\n- Pure research/exploration tasks (use the Task tool with explore agent instead)\n\n## What Happens in Plan Mode\n\nIn plan mode, you'll:\n1. Thoroughly explore the codebase using Glob, Grep, and View tools\n2. Understand existing patterns and architecture\n3. Design an implementation approach\n4. Present your plan to the user for approval\n5. Use AskUserQuestion if you need to clarify approaches\n6. Exit plan mode with ExitPlanMode when ready to implement\n\n## Important Notes\n\n- This tool REQUIRES user approval - they must consent to entering plan mode\n- If unsure whether to use it, err on the side of planning - it's better to get alignment upfront than to redo work\n- Users appreciate being consulted before significant changes are made to their codebase`\n\nexport const EXIT_DESCRIPTION =\n 'Prompts the user to exit plan mode and start coding'\n\nexport const EXIT_PROMPT = `Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.\n\n## How This Tool Works\n- You should have already written your plan to the plan file specified in the plan mode system message\n- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote\n- This tool simply signals that you're done planning and ready for the user to review and approve\n- The user will see the contents of your plan file when they review it\n\n## When to Use This Tool\nIMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.\n\n## Handling Ambiguity in Plans\nBefore using this tool, ensure your plan is clear and unambiguous. If there are multiple valid approaches or unclear requirements:\n1. Use the AskUserQuestion tool to clarify with the user\n2. Ask about specific implementation choices (e.g., architectural patterns, which library to use)\n3. Clarify any assumptions that could affect the implementation\n4. Edit your plan file to incorporate user feedback\n5. Only proceed with ExitPlanMode after resolving ambiguities and updating the plan file\n\n## Examples\n\n1. Initial task: \"Search for and understand the implementation of vim mode in the codebase\" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.\n2. Initial task: \"Help me implement yank mode for vim\" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.\n3. Initial task: \"Add a new feature to handle user authentication\" - If unsure about auth method (OAuth, JWT, etc.), use AskUserQuestion first, then use exit plan mode tool after clarifying the approach.`\n"],
5
5
  "mappings": "AAAO,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;AAEvB,MAAM,oBACX;AAEK,MAAM,eAAe;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;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;AA0DrB,MAAM,mBACX;AAEK,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -10,6 +10,7 @@ import {
10
10
  getSkillCount
11
11
  } from "../../utils/skillLoader.js";
12
12
  import { DESCRIPTION, PROMPT } from "./prompt.js";
13
+ import { SEMANTIC_COLORS } from "../../constants/colors.js";
13
14
  const inputSchema = z.strictObject({
14
15
  action: z.enum(["list", "load", "search"]).describe(
15
16
  "Action to perform: list all skills, load a specific skill, or search skills"
@@ -106,11 +107,11 @@ ${skill.content}
106
107
  }
107
108
  if (output.type === "list") {
108
109
  const skills = output.skills || [];
109
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { color: "green" }, "\u2713 Found ", skills.length, " skill", skills.length !== 1 ? "s" : ""), skills.slice(0, 10).map((skill, i) => /* @__PURE__ */ React.createElement(Box, { key: i, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, skill?.name || "Unknown"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " (", skill?.plugin || "Unknown", ")")), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " ", skill?.description || ""))), skills.length > 10 && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " ... and ", skills.length - 10, " more"));
110
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { color: "green" }, "\u2713 Found ", skills.length, " skill", skills.length !== 1 ? "s" : ""), skills.slice(0, 10).map((skill, i) => /* @__PURE__ */ React.createElement(Box, { key: i, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, skill?.name || "Unknown"), /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "(", skill?.plugin || "Unknown", ")")), /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", skill?.description || ""))), skills.length > 10 && /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "... and ", skills.length - 10, " more"));
110
111
  }
111
112
  if (output.type === "search") {
112
113
  const skills = output.skills || [];
113
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { color: "green" }, "\u2713 Found ", skills.length, " skill", skills.length !== 1 ? "s" : "", ' matching "', output.query || "", '"'), skills.slice(0, 10).map((skill, i) => /* @__PURE__ */ React.createElement(Box, { key: i, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, skill?.name || "Unknown"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " (", skill?.plugin || "Unknown", ")")), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " ", skill?.description || ""))), skills.length > 10 && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " ... and ", skills.length - 10, " more"));
114
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { color: "green" }, "\u2713 Found ", skills.length, " skill", skills.length !== 1 ? "s" : "", ' matching "', output.query || "", '"'), skills.slice(0, 10).map((skill, i) => /* @__PURE__ */ React.createElement(Box, { key: i, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Text, { bold: true }, skill?.name || "Unknown"), /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "(", skill?.plugin || "Unknown", ")")), /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", skill?.description || ""))), skills.length > 10 && /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "... and ", skills.length - 10, " more"));
114
115
  }
115
116
  if (output.type === "load") {
116
117
  const skill = output.skill || {
@@ -119,7 +120,7 @@ ${skill.content}
119
120
  plugin: "",
120
121
  content: ""
121
122
  };
122
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { color: "green" }, "\u2713 Loaded skill: ", skill.name || "Unknown"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " Plugin: ", skill.plugin || "Unknown"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " ", "Content: ", (skill.content || "").length, " characters"));
123
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { color: "green" }, "\u2713 Loaded skill: ", skill.name || "Unknown"), /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "Plugin: ", skill.plugin || "Unknown"), /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "Content: ", (skill.content || "").length, " characters"));
123
124
  }
124
125
  return /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, null, "Skill operation completed"));
125
126
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools/SkillTool/SkillTool.tsx"],
4
- "sourcesContent": ["import { Box, Text } from 'ink'\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool } from '@tool'\nimport {\n loadAllSkills,\n getSkill,\n loadSkillContent,\n searchSkills,\n getSkillCount,\n} from '@utils/skillLoader'\nimport { DESCRIPTION, PROMPT } from './prompt'\n\nconst inputSchema = z.strictObject({\n action: z\n .enum(['list', 'load', 'search'])\n .describe(\n 'Action to perform: list all skills, load a specific skill, or search skills',\n ),\n name: z\n .string()\n .optional()\n .describe('Name of skill to load (required for \"load\" action)'),\n query: z\n .string()\n .optional()\n .describe('Search query (required for \"search\" action)'),\n})\n\ntype SkillToolOutput =\n | {\n type: 'list'\n skills: Array<{ name: string; description: string; plugin: string }>\n }\n | {\n type: 'load'\n skill: {\n name: string\n description: string\n plugin: string\n content: string\n }\n }\n | {\n type: 'search'\n skills: Array<{ name: string; description: string; plugin: string }>\n query: string\n }\n\nexport const SkillTool = {\n name: 'Skill',\n async description() {\n return DESCRIPTION\n },\n async prompt() {\n return PROMPT\n },\n inputSchema,\n userFacingName() {\n return 'Skill'\n },\n async isEnabled() {\n // Enable if there are any skills available\n return getSkillCount() > 0\n },\n isReadOnly() {\n return true // Skills are read-only resources\n },\n isConcurrencySafe() {\n return true // Reading skills is safe for concurrent execution\n },\n needsPermissions() {\n return false // No permissions needed for reading skills\n },\n renderResultForAssistant(output: SkillToolOutput) {\n if (output.type === 'list') {\n if (output.skills.length === 0) {\n return 'No skills available. Install plugins with skills to use this feature.'\n }\n\n const skillsList = output.skills\n .map(\n skill =>\n `- **${skill.name}** (${skill.plugin}): ${skill.description}`,\n )\n .join('\\n')\n\n return `Available skills (${output.skills.length}):\\n\\n${skillsList}\\n\\nUse the \"load\" action to get full skill content.`\n }\n\n if (output.type === 'search') {\n if (output.skills.length === 0) {\n return `No skills found matching \"${output.query}\".`\n }\n\n const skillsList = output.skills\n .map(\n skill =>\n `- **${skill.name}** (${skill.plugin}): ${skill.description}`,\n )\n .join('\\n')\n\n return `Skills matching \"${output.query}\" (${output.skills.length}):\\n\\n${skillsList}\\n\\nUse the \"load\" action to get full skill content.`\n }\n\n if (output.type === 'load') {\n const { skill } = output\n return `# Skill: ${skill.name}\n\n**Plugin**: ${skill.plugin}\n**Description**: ${skill.description}\n\n---\n\n${skill.content}\n\n---\n\n*End of skill content. Apply these instructions to complete your task.*`\n }\n\n return 'Unknown skill operation'\n },\n renderToolUseMessage(input, { verbose }) {\n if (input.action === 'list') {\n return 'Listing all available skills'\n }\n if (input.action === 'load' && input.name) {\n return `Loading skill: ${input.name}`\n }\n if (input.action === 'search' && input.query) {\n return `Searching skills for: ${input.query}`\n }\n return Object.entries(input)\n .map(([key, value]) => `${key}: ${JSON.stringify(value)}`)\n .join(', ')\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: SkillToolOutput) {\n // Guard against undefined or null output\n if (!output || !output.type) {\n return (\n <Box paddingLeft={2}>\n <Text>Skill operation completed</Text>\n </Box>\n )\n }\n\n if (output.type === 'list') {\n const skills = output.skills || []\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n <Text color=\"green\">\n \u2713 Found {skills.length} skill\n {skills.length !== 1 ? 's' : ''}\n </Text>\n {skills.slice(0, 10).map((skill, i) => (\n <Box key={i} flexDirection=\"column\">\n <Text>\n <Text bold>{skill?.name || 'Unknown'}</Text>\n <Text dimColor> ({skill?.plugin || 'Unknown'})</Text>\n </Text>\n <Text dimColor> {skill?.description || ''}</Text>\n </Box>\n ))}\n {skills.length > 10 && (\n <Text dimColor> ... and {skills.length - 10} more</Text>\n )}\n </Box>\n )\n }\n\n if (output.type === 'search') {\n const skills = output.skills || []\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n <Text color=\"green\">\n \u2713 Found {skills.length} skill\n {skills.length !== 1 ? 's' : ''} matching &quot;\n {output.query || ''}&quot;\n </Text>\n {skills.slice(0, 10).map((skill, i) => (\n <Box key={i} flexDirection=\"column\">\n <Text>\n <Text bold>{skill?.name || 'Unknown'}</Text>\n <Text dimColor> ({skill?.plugin || 'Unknown'})</Text>\n </Text>\n <Text dimColor> {skill?.description || ''}</Text>\n </Box>\n ))}\n {skills.length > 10 && (\n <Text dimColor> ... and {skills.length - 10} more</Text>\n )}\n </Box>\n )\n }\n\n if (output.type === 'load') {\n const skill = output.skill || {\n name: '',\n description: '',\n plugin: '',\n content: '',\n }\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n <Text color=\"green\">\u2713 Loaded skill: {skill.name || 'Unknown'}</Text>\n <Text dimColor> Plugin: {skill.plugin || 'Unknown'}</Text>\n <Text dimColor>\n {' '}\n Content: {(skill.content || '').length} characters\n </Text>\n </Box>\n )\n }\n\n return (\n <Box paddingLeft={2}>\n <Text>Skill operation completed</Text>\n </Box>\n )\n },\n async validateInput(input) {\n if (input.action === 'load') {\n if (!input.name) {\n return {\n result: false,\n message: 'Skill name is required for \"load\" action',\n }\n }\n\n const skill = getSkill(input.name)\n if (!skill) {\n const allSkills = loadAllSkills()\n const availableNames = allSkills.map(s => s.name).join(', ')\n return {\n result: false,\n message: `Skill \"${input.name}\" not found. Available skills: ${availableNames}`,\n }\n }\n }\n\n if (input.action === 'search') {\n if (!input.query) {\n return {\n result: false,\n message: 'Query is required for \"search\" action',\n }\n }\n }\n\n return { result: true }\n },\n async *call(input) {\n try {\n // List all skills\n if (input.action === 'list') {\n const skills = loadAllSkills()\n const skillsList = skills.map(skill => ({\n name: skill.name,\n description: skill.config.description,\n plugin: skill.pluginName,\n }))\n\n const output: SkillToolOutput = {\n type: 'list',\n skills: skillsList,\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n // Load specific skill\n if (input.action === 'load' && input.name) {\n const skill = getSkill(input.name)\n if (!skill) {\n throw new Error(`Skill \"${input.name}\" not found`)\n }\n\n // Load full content\n const content = await loadSkillContent(skill)\n\n const output: SkillToolOutput = {\n type: 'load',\n skill: {\n name: skill.name,\n description: skill.config.description,\n plugin: skill.pluginName,\n content,\n },\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n // Search skills\n if (input.action === 'search' && input.query) {\n const skills = searchSkills(input.query)\n const skillsList = skills.map(skill => ({\n name: skill.name,\n description: skill.config.description,\n plugin: skill.pluginName,\n }))\n\n const output: SkillToolOutput = {\n type: 'search',\n skills: skillsList,\n query: input.query,\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n throw new Error('Invalid skill action or missing required parameters')\n } catch (error) {\n throw new Error(\n `Skill operation failed: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n },\n} satisfies Tool<typeof inputSchema, SkillToolOutput>\n"],
5
- "mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAE/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,cAAc;AAEpC,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,QAAQ,EACL,KAAK,CAAC,QAAQ,QAAQ,QAAQ,CAAC,EAC/B;AAAA,IACC;AAAA,EACF;AAAA,EACF,MAAM,EACH,OAAO,EACP,SAAS,EACT,SAAS,oDAAoD;AAAA,EAChE,OAAO,EACJ,OAAO,EACP,SAAS,EACT,SAAS,6CAA6C;AAC3D,CAAC;AAsBM,MAAM,YAAY;AAAA,EACvB,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,MAAM,SAAS;AACb,WAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA,MAAM,YAAY;AAEhB,WAAO,cAAc,IAAI;AAAA,EAC3B;AAAA,E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aAAa,MAAM,KAAK;AACvC,cAAM,aAAa,OAAO,IAAI,YAAU;AAAA,UACtC,MAAM,MAAM;AAAA,UACZ,aAAa,MAAM,OAAO;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAChB,EAAE;AAEF,cAAM,SAA0B;AAAA,UAC9B,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,OAAO,MAAM;AAAA,QACf;AAEA,cAAM;AAAA,UACJ,MAAM;AAAA,UACN,MAAM;AAAA,UACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,QAC1D;AACA;AAAA,MACF;AAEA,YAAM,IAAI,MAAM,qDAAqD;AAAA,IACvE,SAAS,OAAO;AACd,YAAM,IAAI;AAAA,QACR,2BAA2B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,MACnF;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { Box, Text } from 'ink'\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool } from '@tool'\nimport {\n loadAllSkills,\n getSkill,\n loadSkillContent,\n searchSkills,\n getSkillCount,\n} from '@utils/skillLoader'\nimport { DESCRIPTION, PROMPT } from './prompt'\nimport { SEMANTIC_COLORS } from '@constants/colors'\n\nconst inputSchema = z.strictObject({\n action: z\n .enum(['list', 'load', 'search'])\n .describe(\n 'Action to perform: list all skills, load a specific skill, or search skills',\n ),\n name: z\n .string()\n .optional()\n .describe('Name of skill to load (required for \"load\" action)'),\n query: z\n .string()\n .optional()\n .describe('Search query (required for \"search\" action)'),\n})\n\ntype SkillToolOutput =\n | {\n type: 'list'\n skills: Array<{ name: string; description: string; plugin: string }>\n }\n | {\n type: 'load'\n skill: {\n name: string\n description: string\n plugin: string\n content: string\n }\n }\n | {\n type: 'search'\n skills: Array<{ name: string; description: string; plugin: string }>\n query: string\n }\n\nexport const SkillTool = {\n name: 'Skill',\n async description() {\n return DESCRIPTION\n },\n async prompt() {\n return PROMPT\n },\n inputSchema,\n userFacingName() {\n return 'Skill'\n },\n async isEnabled() {\n // Enable if there are any skills available\n return getSkillCount() > 0\n },\n isReadOnly() {\n return true // Skills are read-only resources\n },\n isConcurrencySafe() {\n return true // Reading skills is safe for concurrent execution\n },\n needsPermissions() {\n return false // No permissions needed for reading skills\n },\n renderResultForAssistant(output: SkillToolOutput) {\n if (output.type === 'list') {\n if (output.skills.length === 0) {\n return 'No skills available. Install plugins with skills to use this feature.'\n }\n\n const skillsList = output.skills\n .map(\n skill =>\n `- **${skill.name}** (${skill.plugin}): ${skill.description}`,\n )\n .join('\\n')\n\n return `Available skills (${output.skills.length}):\\n\\n${skillsList}\\n\\nUse the \"load\" action to get full skill content.`\n }\n\n if (output.type === 'search') {\n if (output.skills.length === 0) {\n return `No skills found matching \"${output.query}\".`\n }\n\n const skillsList = output.skills\n .map(\n skill =>\n `- **${skill.name}** (${skill.plugin}): ${skill.description}`,\n )\n .join('\\n')\n\n return `Skills matching \"${output.query}\" (${output.skills.length}):\\n\\n${skillsList}\\n\\nUse the \"load\" action to get full skill content.`\n }\n\n if (output.type === 'load') {\n const { skill } = output\n return `# Skill: ${skill.name}\n\n**Plugin**: ${skill.plugin}\n**Description**: ${skill.description}\n\n---\n\n${skill.content}\n\n---\n\n*End of skill content. Apply these instructions to complete your task.*`\n }\n\n return 'Unknown skill operation'\n },\n renderToolUseMessage(input, { verbose }) {\n if (input.action === 'list') {\n return 'Listing all available skills'\n }\n if (input.action === 'load' && input.name) {\n return `Loading skill: ${input.name}`\n }\n if (input.action === 'search' && input.query) {\n return `Searching skills for: ${input.query}`\n }\n return Object.entries(input)\n .map(([key, value]) => `${key}: ${JSON.stringify(value)}`)\n .join(', ')\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: SkillToolOutput) {\n // Guard against undefined or null output\n if (!output || !output.type) {\n return (\n <Box paddingLeft={2}>\n <Text>Skill operation completed</Text>\n </Box>\n )\n }\n\n if (output.type === 'list') {\n const skills = output.skills || []\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n <Text color=\"green\">\n \u2713 Found {skills.length} skill\n {skills.length !== 1 ? 's' : ''}\n </Text>\n {skills.slice(0, 10).map((skill, i) => (\n <Box key={i} flexDirection=\"column\">\n <Text>\n <Text bold>{skill?.name || 'Unknown'}</Text>\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n ({skill?.plugin || 'Unknown'})\n </Text>\n </Text>\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n {skill?.description || ''}\n </Text>\n </Box>\n ))}\n {skills.length > 10 && (\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n ... and {skills.length - 10} more\n </Text>\n )}\n </Box>\n )\n }\n\n if (output.type === 'search') {\n const skills = output.skills || []\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n <Text color=\"green\">\n \u2713 Found {skills.length} skill\n {skills.length !== 1 ? 's' : ''} matching &quot;\n {output.query || ''}&quot;\n </Text>\n {skills.slice(0, 10).map((skill, i) => (\n <Box key={i} flexDirection=\"column\">\n <Text>\n <Text bold>{skill?.name || 'Unknown'}</Text>\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n ({skill?.plugin || 'Unknown'})\n </Text>\n </Text>\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n {skill?.description || ''}\n </Text>\n </Box>\n ))}\n {skills.length > 10 && (\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n ... and {skills.length - 10} more\n </Text>\n )}\n </Box>\n )\n }\n\n if (output.type === 'load') {\n const skill = output.skill || {\n name: '',\n description: '',\n plugin: '',\n content: '',\n }\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n <Text color=\"green\">\u2713 Loaded skill: {skill.name || 'Unknown'}</Text>\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n Plugin: {skill.plugin || 'Unknown'}\n </Text>\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n Content: {(skill.content || '').length} characters\n </Text>\n </Box>\n )\n }\n\n return (\n <Box paddingLeft={2}>\n <Text>Skill operation completed</Text>\n </Box>\n )\n },\n async validateInput(input) {\n if (input.action === 'load') {\n if (!input.name) {\n return {\n result: false,\n message: 'Skill name is required for \"load\" action',\n }\n }\n\n const skill = getSkill(input.name)\n if (!skill) {\n const allSkills = loadAllSkills()\n const availableNames = allSkills.map(s => s.name).join(', ')\n return {\n result: false,\n message: `Skill \"${input.name}\" not found. Available skills: ${availableNames}`,\n }\n }\n }\n\n if (input.action === 'search') {\n if (!input.query) {\n return {\n result: false,\n message: 'Query is required for \"search\" action',\n }\n }\n }\n\n return { result: true }\n },\n async *call(input) {\n try {\n // List all skills\n if (input.action === 'list') {\n const skills = loadAllSkills()\n const skillsList = skills.map(skill => ({\n name: skill.name,\n description: skill.config.description,\n plugin: skill.pluginName,\n }))\n\n const output: SkillToolOutput = {\n type: 'list',\n skills: skillsList,\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n // Load specific skill\n if (input.action === 'load' && input.name) {\n const skill = getSkill(input.name)\n if (!skill) {\n throw new Error(`Skill \"${input.name}\" not found`)\n }\n\n // Load full content\n const content = await loadSkillContent(skill)\n\n const output: SkillToolOutput = {\n type: 'load',\n skill: {\n name: skill.name,\n description: skill.config.description,\n plugin: skill.pluginName,\n content,\n },\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n // Search skills\n if (input.action === 'search' && input.query) {\n const skills = searchSkills(input.query)\n const skillsList = skills.map(skill => ({\n name: skill.name,\n description: skill.config.description,\n plugin: skill.pluginName,\n }))\n\n const output: SkillToolOutput = {\n type: 'search',\n skills: skillsList,\n query: input.query,\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n throw new Error('Invalid skill action or missing required parameters')\n } catch (error) {\n throw new Error(\n `Skill operation failed: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n },\n} satisfies Tool<typeof inputSchema, SkillToolOutput>\n"],
5
+ "mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAE/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,cAAc;AACpC,SAAS,uBAAuB;AAEhC,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,QAAQ,EACL,KAAK,CAAC,QAAQ,QAAQ,QAAQ,CAAC,EAC/B;AAAA,IACC;AAAA,EACF;AAAA,EACF,MAAM,EACH,OAAO,EACP,SAAS,EACT,SAAS,oDAAoD;AAAA,EAChE,OAAO,EACJ,OAAO,EACP,SAAS,EACT,SAAS,6CAA6C;AAC3D,CAAC;AAsBM,MAAM,YAAY;AAAA,EACvB,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,MAAM,SAAS;AACb,WAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA,MAAM,YAAY;AAEhB,WAAO,cAAc,IAAI;AAAA,EAC3B;AAAA,EACA,aAAa;AACX,WAAO;AAAA,EACT;AAAA,EACA,oBAAoB;AAClB,WAAO;AAAA,EACT;AAAA,EACA,mBAAmB;AACjB,WAAO;AAAA,EACT;AAAA,EACA,yBAAyB,QAAyB;AAChD,QAAI,OAAO,SAAS,QAAQ;AAC1B,UAAI,OAAO,OAAO,WAAW,GAAG;AAC9B,eAAO;AAAA,MACT;AAEA,YAAM,aAAa,OAAO,OACvB;AAAA,QACC,WACE,OAAO,MAAM,IAAI,OAAO,MAAM,MAAM,MAAM,MAAM,WAAW;AAAA,MAC/D,EACC,KAAK,IAAI;AAEZ,aAAO,qBAAqB,OAAO,OAAO,MAAM;AAAA;AAAA,EAAS,U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A,QAC1D;AACA;AAAA,MACF;AAEA,YAAM,IAAI,MAAM,qDAAqD;AAAA,IACvE,SAAS,OAAO;AACd,YAAM,IAAI;AAAA,QACR,2BAA2B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,MACnF;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -64,7 +64,7 @@ Skills typically include:
64
64
  2. Search or list skills to find "microservices-patterns"
65
65
  3. Load the skill to get detailed instructions
66
66
  4. Follow skill guidance to architect the system
67
- 5. Use referenced tools (FileWrite, etc.) to implement
67
+ 5. Use referenced tools (Replace, Edit, etc.) to implement
68
68
 
69
69
  ## Important Notes
70
70
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools/SkillTool/prompt.ts"],
4
- "sourcesContent": ["export const DESCRIPTION = `Use this tool to discover and load skills from installed plugins. Skills provide specialized knowledge and instructions for specific tasks (e.g., API design, testing patterns, architecture patterns).\n\nSkills use progressive disclosure - list skills to see what's available, then load specific skills to get detailed instructions.`\n\nexport const PROMPT = `# Skill Tool\n\n## Purpose\nLoad and apply skills from plugins. Skills provide expert knowledge, best practices, and step-by-step instructions for specialized tasks.\n\n## Available Operations\n\n### List Skills\n\\`\\`\\`json\n{\n \"action\": \"list\"\n}\n\\`\\`\\`\nReturns all available skills with their names, descriptions, and source plugins.\n\n### Load Skill\n\\`\\`\\`json\n{\n \"action\": \"load\",\n \"name\": \"skill-name\"\n}\n\\`\\`\\`\nLoads and displays the full content of a specific skill. Use this when you need detailed instructions for a task.\n\n### Search Skills\n\\`\\`\\`json\n{\n \"action\": \"search\",\n \"query\": \"search-term\"\n}\n\\`\\`\\`\nSearches skills by name, description, or plugin name. Returns matching skills.\n\n## Usage Pattern\n\n1. **Discover**: Use \"list\" or \"search\" to find relevant skills\n2. **Load**: Use \"load\" to get full skill instructions\n3. **Apply**: Follow the skill's instructions to complete the task\n4. **Context**: Skills may reference tools, patterns, or other resources\n\n## When to Use Skills\n\n- User requests expertise in a specific domain (e.g., \"design a REST API\")\n- Task matches a skill description (e.g., backend architecture, testing)\n- Need best practices or patterns for a technology\n- Want step-by-step guidance for complex operations\n\n## Skill Content Structure\n\nSkills typically include:\n- Overview and purpose\n- Key concepts and principles\n- Step-by-step instructions\n- Code examples and patterns\n- Best practices and anti-patterns\n- Common pitfalls and solutions\n\n## Example Workflow\n\n1. User: \"Help me design a microservices architecture\"\n2. Search or list skills to find \"microservices-patterns\"\n3. Load the skill to get detailed instructions\n4. Follow skill guidance to architect the system\n5. Use referenced tools (FileWrite, etc.) to implement\n\n## Important Notes\n\n- Skills are loaded from installed plugins\n- Each skill comes from a specific plugin source\n- Skills are cached for performance\n- Load skills progressively - metadata first, full content on demand\n- Skills complement your existing knowledge - use them as guides, not rigid rules\n`\n"],
4
+ "sourcesContent": ["export const DESCRIPTION = `Use this tool to discover and load skills from installed plugins. Skills provide specialized knowledge and instructions for specific tasks (e.g., API design, testing patterns, architecture patterns).\n\nSkills use progressive disclosure - list skills to see what's available, then load specific skills to get detailed instructions.`\n\nexport const PROMPT = `# Skill Tool\n\n## Purpose\nLoad and apply skills from plugins. Skills provide expert knowledge, best practices, and step-by-step instructions for specialized tasks.\n\n## Available Operations\n\n### List Skills\n\\`\\`\\`json\n{\n \"action\": \"list\"\n}\n\\`\\`\\`\nReturns all available skills with their names, descriptions, and source plugins.\n\n### Load Skill\n\\`\\`\\`json\n{\n \"action\": \"load\",\n \"name\": \"skill-name\"\n}\n\\`\\`\\`\nLoads and displays the full content of a specific skill. Use this when you need detailed instructions for a task.\n\n### Search Skills\n\\`\\`\\`json\n{\n \"action\": \"search\",\n \"query\": \"search-term\"\n}\n\\`\\`\\`\nSearches skills by name, description, or plugin name. Returns matching skills.\n\n## Usage Pattern\n\n1. **Discover**: Use \"list\" or \"search\" to find relevant skills\n2. **Load**: Use \"load\" to get full skill instructions\n3. **Apply**: Follow the skill's instructions to complete the task\n4. **Context**: Skills may reference tools, patterns, or other resources\n\n## When to Use Skills\n\n- User requests expertise in a specific domain (e.g., \"design a REST API\")\n- Task matches a skill description (e.g., backend architecture, testing)\n- Need best practices or patterns for a technology\n- Want step-by-step guidance for complex operations\n\n## Skill Content Structure\n\nSkills typically include:\n- Overview and purpose\n- Key concepts and principles\n- Step-by-step instructions\n- Code examples and patterns\n- Best practices and anti-patterns\n- Common pitfalls and solutions\n\n## Example Workflow\n\n1. User: \"Help me design a microservices architecture\"\n2. Search or list skills to find \"microservices-patterns\"\n3. Load the skill to get detailed instructions\n4. Follow skill guidance to architect the system\n5. Use referenced tools (Replace, Edit, etc.) to implement\n\n## Important Notes\n\n- Skills are loaded from installed plugins\n- Each skill comes from a specific plugin source\n- Skills are cached for performance\n- Load skills progressively - metadata first, full content on demand\n- Skills complement your existing knowledge - use them as guides, not rigid rules\n`\n"],
5
5
  "mappings": "AAAO,MAAM,cAAc;AAAA;AAAA;AAIpB,MAAM,SAAS;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;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -6,6 +6,7 @@ import { BackgroundShellManager } from "../../utils/BackgroundShellManager.js";
6
6
  import {
7
7
  getAgentTranscript
8
8
  } from "../../utils/agentTranscripts.js";
9
+ import { SEMANTIC_COLORS } from "../../constants/colors.js";
9
10
  const inputSchema = z.strictObject({
10
11
  task_id: z.string().describe("The task ID to get output from"),
11
12
  block: z.boolean().default(true).optional().describe("Whether to wait for completion"),
@@ -40,7 +41,7 @@ const TaskOutputTool = {
40
41
  return `task_id: "${input.task_id}", mode: ${blocking}`;
41
42
  },
42
43
  renderToolUseRejectedMessage() {
43
- return /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "Task output request rejected"));
44
+ return /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, "Task output request rejected"));
44
45
  },
45
46
  renderToolResultMessage(output, options) {
46
47
  if (!output) {
@@ -60,7 +61,7 @@ const TaskOutputTool = {
60
61
  return output.output.substring(0, maxLen) + "...";
61
62
  };
62
63
  const outputPreview = getOutputPreview();
63
- return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, output.task_type === "agent" ? "Agent" : "Task", " "), /* @__PURE__ */ React.createElement(Text, { bold: true }, output.task_id), /* @__PURE__ */ React.createElement(Text, null, ": "), /* @__PURE__ */ React.createElement(Text, { color: statusColor }, output.status), output.exitCode !== void 0 && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " (exit: ", output.exitCode, ")")), output.task_type === "agent" && output.agentType && /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "Type: ", output.agentType), output.messageCount !== void 0 && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " | Messages: ", output.messageCount), output.toolUseCount !== void 0 && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " | Tools: ", output.toolUseCount), output.tokenUsage && verbose && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " ", "| Tokens:", " ", output.tokenUsage.inputTokens + output.tokenUsage.outputTokens)), outputPreview && /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, outputPreview)));
64
+ return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingLeft: 2 }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, output.task_type === "agent" ? "Agent" : "Task", " "), /* @__PURE__ */ React.createElement(Text, { bold: true }, output.task_id), /* @__PURE__ */ React.createElement(Text, null, ": "), /* @__PURE__ */ React.createElement(Text, { color: statusColor }, output.status), output.exitCode !== void 0 && /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " (exit: ", output.exitCode, ")")), output.task_type === "agent" && output.agentType && /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, "Type: ", output.agentType), output.messageCount !== void 0 && /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "| Messages: ", output.messageCount), output.toolUseCount !== void 0 && /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "| Tools: ", output.toolUseCount), output.tokenUsage && verbose && /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, " ", "| Tokens:", " ", output.tokenUsage.inputTokens + output.tokenUsage.outputTokens)), outputPreview && /* @__PURE__ */ React.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React.createElement(Text, { color: SEMANTIC_COLORS.dim }, outputPreview)));
64
65
  },
65
66
  renderResultForAssistant(output) {
66
67
  if (!output) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/tools/TaskOutputTool/TaskOutputTool.tsx"],
4
- "sourcesContent": ["/**\n * Task Output Tool\n *\n * Retrieves output from background tasks (shells, agents, remote sessions).\n * Supports both background shell commands and agent transcripts.\n */\n\nimport { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport { Tool } from '@tool'\nimport { DESCRIPTION, PROMPT, TOOL_NAME } from './prompt'\nimport { BackgroundShellManager } from '@utils/BackgroundShellManager'\nimport {\n getAgentTranscript,\n listAgentTranscripts,\n type AgentTranscript,\n type AgentStatus,\n} from '@utils/agentTranscripts'\n\nconst inputSchema = z.strictObject({\n task_id: z.string().describe('The task ID to get output from'),\n block: z\n .boolean()\n .default(true)\n .optional()\n .describe('Whether to wait for completion'),\n timeout: z\n .number()\n .min(0)\n .max(600000)\n .default(30000)\n .optional()\n .describe('Max wait time in ms'),\n})\n\ntype Output = {\n task_id: string\n task_type: 'shell' | 'agent'\n status: 'running' | 'completed' | 'failed' | 'interrupted' | 'not_found'\n output: string\n exitCode?: number\n // Agent-specific fields\n agentType?: string\n description?: string\n messageCount?: number\n toolUseCount?: number\n tokenUsage?: {\n inputTokens: number\n outputTokens: number\n }\n}\n\nexport const TaskOutputTool = {\n name: TOOL_NAME,\n async description() {\n return DESCRIPTION\n },\n userFacingName() {\n return 'Task Output'\n },\n inputSchema,\n isReadOnly() {\n return true\n },\n isConcurrencySafe() {\n return true\n },\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return false\n },\n async prompt() {\n return PROMPT\n },\n renderToolUseMessage(input: z.infer<typeof inputSchema>) {\n const blocking = input.block !== false ? 'blocking' : 'non-blocking'\n return `task_id: \"${input.task_id}\", mode: ${blocking}`\n },\n renderToolUseRejectedMessage() {\n return (\n <Box paddingLeft={2}>\n <Text dimColor>Task output request rejected</Text>\n </Box>\n )\n },\n renderToolResultMessage(output: Output, options?: { verbose?: boolean }) {\n if (!output) {\n return (\n <Box paddingLeft={2}>\n <Text>Task output retrieved</Text>\n </Box>\n )\n }\n\n const verbose = options?.verbose ?? false\n const statusColor =\n output.status === 'completed'\n ? 'green'\n : output.status === 'running'\n ? 'yellow'\n : output.status === 'failed' || output.status === 'interrupted'\n ? 'red'\n : 'gray'\n\n // Determine output truncation based on displayMode (via verbose flag)\n // minimal (verbose=false): Show only status line, no output content\n // compact (verbose=false): Show status + truncated output (200 chars)\n // detailed (verbose=true): Show status + full output (up to 2000 chars)\n const getOutputPreview = () => {\n if (!output.output) return null\n\n // For minimal mode, don't show output content at all in the summary\n // The full content is available via the tool result\n if (!verbose) {\n // Compact mode: show truncated output\n const maxLen = 200\n if (output.output.length <= maxLen) return output.output\n return output.output.substring(0, maxLen) + '...'\n }\n\n // Detailed mode: show more output\n const maxLen = 2000\n if (output.output.length <= maxLen) return output.output\n return output.output.substring(0, maxLen) + '...'\n }\n\n const outputPreview = getOutputPreview()\n\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n <Box flexDirection=\"row\">\n <Text>{output.task_type === 'agent' ? 'Agent' : 'Task'} </Text>\n <Text bold>{output.task_id}</Text>\n <Text>: </Text>\n <Text color={statusColor}>{output.status}</Text>\n {output.exitCode !== undefined && (\n <Text dimColor> (exit: {output.exitCode})</Text>\n )}\n </Box>\n {output.task_type === 'agent' && output.agentType && (\n <Box>\n <Text dimColor>Type: {output.agentType}</Text>\n {output.messageCount !== undefined && (\n <Text dimColor> | Messages: {output.messageCount}</Text>\n )}\n {output.toolUseCount !== undefined && (\n <Text dimColor> | Tools: {output.toolUseCount}</Text>\n )}\n {output.tokenUsage && verbose && (\n <Text dimColor>\n {' '}\n | Tokens:{' '}\n {output.tokenUsage.inputTokens + output.tokenUsage.outputTokens}\n </Text>\n )}\n </Box>\n )}\n {outputPreview && (\n <Box marginTop={1}>\n <Text dimColor>{outputPreview}</Text>\n </Box>\n )}\n </Box>\n )\n },\n renderResultForAssistant(output: Output) {\n if (!output) {\n return 'Task output retrieved'\n }\n\n const lines = [\n `Task ID: ${output.task_id}`,\n `Task Type: ${output.task_type}`,\n `Status: ${output.status}`,\n ]\n\n if (output.task_type === 'agent') {\n if (output.agentType) lines.push(`Agent Type: ${output.agentType}`)\n if (output.description) lines.push(`Description: ${output.description}`)\n if (output.messageCount !== undefined)\n lines.push(`Messages: ${output.messageCount}`)\n if (output.toolUseCount !== undefined)\n lines.push(`Tool Uses: ${output.toolUseCount}`)\n if (output.tokenUsage) {\n lines.push(\n `Tokens: ${output.tokenUsage.inputTokens + output.tokenUsage.outputTokens} (in: ${output.tokenUsage.inputTokens}, out: ${output.tokenUsage.outputTokens})`,\n )\n }\n }\n\n if (output.exitCode !== undefined) {\n lines.push(`Exit Code: ${output.exitCode}`)\n }\n\n if (output.output) {\n lines.push('', 'Output:', output.output)\n }\n\n return lines.join('\\n')\n },\n async *call(input: z.infer<typeof inputSchema>, _context: any) {\n const { task_id, block = true, timeout = 30000 } = input\n\n // First, check if this is an agent transcript\n const transcript = getAgentTranscript(task_id)\n if (transcript) {\n // Handle agent transcript\n let currentTranscript = transcript\n\n // If blocking and agent is running, poll for completion\n if (block && transcript.status === 'running') {\n const startTime = Date.now()\n const pollInterval = 500 // 500ms\n\n while (Date.now() - startTime < timeout) {\n const updated = getAgentTranscript(task_id)\n if (!updated || updated.status !== 'running') {\n currentTranscript = updated || currentTranscript\n break\n }\n await new Promise(resolve => setTimeout(resolve, pollInterval))\n }\n }\n\n // Extract final text output from transcript messages\n let outputText = ''\n const lastMessage =\n currentTranscript.messages[currentTranscript.messages.length - 1]\n if (lastMessage?.type === 'assistant') {\n const textBlocks = lastMessage.message.content.filter(\n (block: any) => block.type === 'text',\n )\n outputText = textBlocks.map((block: any) => block.text).join('\\n')\n }\n\n const output: Output = {\n task_id,\n task_type: 'agent',\n status: currentTranscript.status as Output['status'],\n output: outputText,\n agentType: currentTranscript.agentType,\n description: currentTranscript.description,\n messageCount: currentTranscript.messages.length,\n toolUseCount: currentTranscript.toolUseCount,\n tokenUsage: currentTranscript.tokenUsage,\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n // Fall back to background shell\n const manager = BackgroundShellManager.getInstance()\n const shell = manager.get(task_id)\n\n if (!shell) {\n const output: Output = {\n task_id,\n task_type: 'shell',\n status: 'not_found',\n output: `No task found with ID: ${task_id}. This could be a background shell or agent ID.`,\n }\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n // If blocking, wait for completion\n if (block && shell.status === 'running') {\n await new Promise<void>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n manager.removeListener('statusChange', listener)\n resolve()\n }, timeout)\n\n const listener = (shellId: string, status: string) => {\n if (shellId === task_id && status !== 'running') {\n clearTimeout(timeoutId)\n manager.removeListener('statusChange', listener)\n resolve()\n }\n }\n\n manager.on('statusChange', listener)\n })\n }\n\n // Get all output\n const shellOutput = manager.getAllOutput(task_id)\n const currentShell = manager.get(task_id)\n\n const output: Output = {\n task_id,\n task_type: 'shell',\n status:\n currentShell?.status === 'running'\n ? 'running'\n : currentShell?.exitCode === 0\n ? 'completed'\n : 'failed',\n output: shellOutput\n ? [...shellOutput.stdout, ...shellOutput.stderr].join('\\n')\n : '',\n exitCode: currentShell?.exitCode,\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n },\n} satisfies Tool<typeof inputSchema, Output>\n"],
5
- "mappings": "AAOA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAElB,SAAS,aAAa,QAAQ,iBAAiB;AAC/C,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,OAIK;AAEP,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,SAAS,EAAE,OAAO,EAAE,SAAS,gCAAgC;AAAA,EAC7D,OAAO,EACJ,QAAQ,EACR,QAAQ,IAAI,EACZ,SAAS,EACT,SAAS,gCAAgC;AAAA,EAC5C,SAAS,EACN,OAAO,EACP,IAAI,CAAC,EACL,IAAI,GAAM,EACV,QAAQ,GAAK,EACb,SAAS,EACT,SAAS,qBAAqB;AACnC,CAAC;AAmBM,MAAM,iBAAiB;AAAA,EAC5B,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA,aAAa;A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AM;AAAA,MACN,MAAM;AAAA,MACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,IAC1D;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["/**\n * Task Output Tool\n *\n * Retrieves output from background tasks (shells, agents, remote sessions).\n * Supports both background shell commands and agent transcripts.\n */\n\nimport { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport { Tool } from '@tool'\nimport { DESCRIPTION, PROMPT, TOOL_NAME } from './prompt'\nimport { BackgroundShellManager } from '@utils/BackgroundShellManager'\nimport {\n getAgentTranscript,\n listAgentTranscripts,\n type AgentTranscript,\n type AgentStatus,\n} from '@utils/agentTranscripts'\nimport { SEMANTIC_COLORS } from '@constants/colors'\n\nconst inputSchema = z.strictObject({\n task_id: z.string().describe('The task ID to get output from'),\n block: z\n .boolean()\n .default(true)\n .optional()\n .describe('Whether to wait for completion'),\n timeout: z\n .number()\n .min(0)\n .max(600000)\n .default(30000)\n .optional()\n .describe('Max wait time in ms'),\n})\n\ntype Output = {\n task_id: string\n task_type: 'shell' | 'agent'\n status: 'running' | 'completed' | 'failed' | 'interrupted' | 'not_found'\n output: string\n exitCode?: number\n // Agent-specific fields\n agentType?: string\n description?: string\n messageCount?: number\n toolUseCount?: number\n tokenUsage?: {\n inputTokens: number\n outputTokens: number\n }\n}\n\nexport const TaskOutputTool = {\n name: TOOL_NAME,\n async description() {\n return DESCRIPTION\n },\n userFacingName() {\n return 'Task Output'\n },\n inputSchema,\n isReadOnly() {\n return true\n },\n isConcurrencySafe() {\n return true\n },\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return false\n },\n async prompt() {\n return PROMPT\n },\n renderToolUseMessage(input: z.infer<typeof inputSchema>) {\n const blocking = input.block !== false ? 'blocking' : 'non-blocking'\n return `task_id: \"${input.task_id}\", mode: ${blocking}`\n },\n renderToolUseRejectedMessage() {\n return (\n <Box paddingLeft={2}>\n <Text color={SEMANTIC_COLORS.dim}>Task output request rejected</Text>\n </Box>\n )\n },\n renderToolResultMessage(output: Output, options?: { verbose?: boolean }) {\n if (!output) {\n return (\n <Box paddingLeft={2}>\n <Text>Task output retrieved</Text>\n </Box>\n )\n }\n\n const verbose = options?.verbose ?? false\n const statusColor =\n output.status === 'completed'\n ? 'green'\n : output.status === 'running'\n ? 'yellow'\n : output.status === 'failed' || output.status === 'interrupted'\n ? 'red'\n : 'gray'\n\n // Determine output truncation based on displayMode (via verbose flag)\n // minimal (verbose=false): Show only status line, no output content\n // compact (verbose=false): Show status + truncated output (200 chars)\n // detailed (verbose=true): Show status + full output (up to 2000 chars)\n const getOutputPreview = () => {\n if (!output.output) return null\n\n // For minimal mode, don't show output content at all in the summary\n // The full content is available via the tool result\n if (!verbose) {\n // Compact mode: show truncated output\n const maxLen = 200\n if (output.output.length <= maxLen) return output.output\n return output.output.substring(0, maxLen) + '...'\n }\n\n // Detailed mode: show more output\n const maxLen = 2000\n if (output.output.length <= maxLen) return output.output\n return output.output.substring(0, maxLen) + '...'\n }\n\n const outputPreview = getOutputPreview()\n\n return (\n <Box flexDirection=\"column\" paddingLeft={2}>\n <Box flexDirection=\"row\">\n <Text>{output.task_type === 'agent' ? 'Agent' : 'Task'} </Text>\n <Text bold>{output.task_id}</Text>\n <Text>: </Text>\n <Text color={statusColor}>{output.status}</Text>\n {output.exitCode !== undefined && (\n <Text color={SEMANTIC_COLORS.dim}> (exit: {output.exitCode})</Text>\n )}\n </Box>\n {output.task_type === 'agent' && output.agentType && (\n <Box>\n <Text color={SEMANTIC_COLORS.dim}>Type: {output.agentType}</Text>\n {output.messageCount !== undefined && (\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n | Messages: {output.messageCount}\n </Text>\n )}\n {output.toolUseCount !== undefined && (\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n | Tools: {output.toolUseCount}\n </Text>\n )}\n {output.tokenUsage && verbose && (\n <Text color={SEMANTIC_COLORS.dim}>\n {' '}\n | Tokens:{' '}\n {output.tokenUsage.inputTokens + output.tokenUsage.outputTokens}\n </Text>\n )}\n </Box>\n )}\n {outputPreview && (\n <Box marginTop={1}>\n <Text color={SEMANTIC_COLORS.dim}>{outputPreview}</Text>\n </Box>\n )}\n </Box>\n )\n },\n renderResultForAssistant(output: Output) {\n if (!output) {\n return 'Task output retrieved'\n }\n\n const lines = [\n `Task ID: ${output.task_id}`,\n `Task Type: ${output.task_type}`,\n `Status: ${output.status}`,\n ]\n\n if (output.task_type === 'agent') {\n if (output.agentType) lines.push(`Agent Type: ${output.agentType}`)\n if (output.description) lines.push(`Description: ${output.description}`)\n if (output.messageCount !== undefined)\n lines.push(`Messages: ${output.messageCount}`)\n if (output.toolUseCount !== undefined)\n lines.push(`Tool Uses: ${output.toolUseCount}`)\n if (output.tokenUsage) {\n lines.push(\n `Tokens: ${output.tokenUsage.inputTokens + output.tokenUsage.outputTokens} (in: ${output.tokenUsage.inputTokens}, out: ${output.tokenUsage.outputTokens})`,\n )\n }\n }\n\n if (output.exitCode !== undefined) {\n lines.push(`Exit Code: ${output.exitCode}`)\n }\n\n if (output.output) {\n lines.push('', 'Output:', output.output)\n }\n\n return lines.join('\\n')\n },\n async *call(input: z.infer<typeof inputSchema>, _context: any) {\n const { task_id, block = true, timeout = 30000 } = input\n\n // First, check if this is an agent transcript\n const transcript = getAgentTranscript(task_id)\n if (transcript) {\n // Handle agent transcript\n let currentTranscript = transcript\n\n // If blocking and agent is running, poll for completion\n if (block && transcript.status === 'running') {\n const startTime = Date.now()\n const pollInterval = 500 // 500ms\n\n while (Date.now() - startTime < timeout) {\n const updated = getAgentTranscript(task_id)\n if (!updated || updated.status !== 'running') {\n currentTranscript = updated || currentTranscript\n break\n }\n await new Promise(resolve => setTimeout(resolve, pollInterval))\n }\n }\n\n // Extract final text output from transcript messages\n let outputText = ''\n const lastMessage =\n currentTranscript.messages[currentTranscript.messages.length - 1]\n if (lastMessage?.type === 'assistant') {\n const textBlocks = lastMessage.message.content.filter(\n (block: any) => block.type === 'text',\n )\n outputText = textBlocks.map((block: any) => block.text).join('\\n')\n }\n\n const output: Output = {\n task_id,\n task_type: 'agent',\n status: currentTranscript.status as Output['status'],\n output: outputText,\n agentType: currentTranscript.agentType,\n description: currentTranscript.description,\n messageCount: currentTranscript.messages.length,\n toolUseCount: currentTranscript.toolUseCount,\n tokenUsage: currentTranscript.tokenUsage,\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n // Fall back to background shell\n const manager = BackgroundShellManager.getInstance()\n const shell = manager.get(task_id)\n\n if (!shell) {\n const output: Output = {\n task_id,\n task_type: 'shell',\n status: 'not_found',\n output: `No task found with ID: ${task_id}. This could be a background shell or agent ID.`,\n }\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n return\n }\n\n // If blocking, wait for completion\n if (block && shell.status === 'running') {\n await new Promise<void>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n manager.removeListener('statusChange', listener)\n resolve()\n }, timeout)\n\n const listener = (shellId: string, status: string) => {\n if (shellId === task_id && status !== 'running') {\n clearTimeout(timeoutId)\n manager.removeListener('statusChange', listener)\n resolve()\n }\n }\n\n manager.on('statusChange', listener)\n })\n }\n\n // Get all output\n const shellOutput = manager.getAllOutput(task_id)\n const currentShell = manager.get(task_id)\n\n const output: Output = {\n task_id,\n task_type: 'shell',\n status:\n currentShell?.status === 'running'\n ? 'running'\n : currentShell?.exitCode === 0\n ? 'completed'\n : 'failed',\n output: shellOutput\n ? [...shellOutput.stdout, ...shellOutput.stderr].join('\\n')\n : '',\n exitCode: currentShell?.exitCode,\n }\n\n yield {\n type: 'result',\n data: output,\n resultForAssistant: this.renderResultForAssistant(output),\n }\n },\n} satisfies Tool<typeof inputSchema, Output>\n"],
5
+ "mappings": "AAOA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAElB,SAAS,aAAa,QAAQ,iBAAiB;AAC/C,SAAS,8BAA8B;AACvC;AAAA,EACE;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B;AACpD,cAAI,YAAY,WAAW,WAAW,WAAW;AAC/C,yBAAa,SAAS;AACtB,oBAAQ,eAAe,gBAAgB,QAAQ;AAC/C,oBAAQ;AAAA,UACV;AAAA,QACF;AAEA,gBAAQ,GAAG,gBAAgB,QAAQ;AAAA,MACrC,CAAC;AAAA,IACH;AAGA,UAAM,cAAc,QAAQ,aAAa,OAAO;AAChD,UAAM,eAAe,QAAQ,IAAI,OAAO;AAExC,UAAM,SAAiB;AAAA,MACrB;AAAA,MACA,WAAW;AAAA,MACX,QACE,cAAc,WAAW,YACrB,YACA,cAAc,aAAa,IACzB,cACA;AAAA,MACR,QAAQ,cACJ,CAAC,GAAG,YAAY,QAAQ,GAAG,YAAY,MAAM,EAAE,KAAK,IAAI,IACxD;AAAA,MACJ,UAAU,cAAc;AAAA,IAC1B;AAEA,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,MAAM;AAAA,MACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,IAC1D;AAAA,EACF;AACF;",
6
6
  "names": ["maxLen", "block", "output"]
7
7
  }
@@ -44,6 +44,11 @@ import {
44
44
  registerToolUseAgent
45
45
  } from "../../utils/agentTranscripts.js";
46
46
  import { UserFriendlyError } from "../../utils/userFriendlyError.js";
47
+ import {
48
+ pushAgentContext,
49
+ popAgentContext,
50
+ cleanupAgentStreamingState
51
+ } from "../../components/Spinner.js";
47
52
  const inputSchema = z.object({
48
53
  description: z.string().describe("A short (3-5 word) description of the task"),
49
54
  prompt: z.string().describe("The task for the agent to perform"),
@@ -243,6 +248,7 @@ IMPORTANT: You are currently running as ${modelToUse}. You do not need to consul
243
248
  if (temperature !== void 0) {
244
249
  queryOptions["temperature"] = temperature;
245
250
  }
251
+ pushAgentContext(agentId);
246
252
  try {
247
253
  for await (const message of query(
248
254
  messages,
@@ -413,6 +419,8 @@ ${this.renderResultForAssistant(data)}` : this.renderResultForAssistant(data);
413
419
  }
414
420
  hasYieldedResult = true;
415
421
  } finally {
422
+ popAgentContext();
423
+ cleanupAgentStreamingState(agentId);
416
424
  if (!hasYieldedResult) {
417
425
  interruptAgentTranscript(agentId);
418
426
  yield {