@within-7/minto 0.3.0 → 0.3.3

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 (80) hide show
  1. package/dist/components/SubagentProgress.js +10 -2
  2. package/dist/components/SubagentProgress.js.map +2 -2
  3. package/dist/constants/prompts.js +22 -1
  4. package/dist/constants/prompts.js.map +2 -2
  5. package/dist/entrypoints/cli.js +15 -9
  6. package/dist/entrypoints/cli.js.map +2 -2
  7. package/dist/permissions.js +121 -2
  8. package/dist/permissions.js.map +2 -2
  9. package/dist/screens/ResumeConversation.js +2 -0
  10. package/dist/screens/ResumeConversation.js.map +2 -2
  11. package/dist/services/taskStore.js +205 -0
  12. package/dist/services/taskStore.js.map +7 -0
  13. package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js +40 -3
  14. package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js.map +2 -2
  15. package/dist/tools/BashTool/BashTool.js +21 -4
  16. package/dist/tools/BashTool/BashTool.js.map +2 -2
  17. package/dist/tools/BashTool/prompt.js +6 -0
  18. package/dist/tools/BashTool/prompt.js.map +2 -2
  19. package/dist/tools/FileEditTool/FileEditTool.js +24 -9
  20. package/dist/tools/FileEditTool/FileEditTool.js.map +2 -2
  21. package/dist/tools/FileEditTool/prompt.js +4 -1
  22. package/dist/tools/FileEditTool/prompt.js.map +2 -2
  23. package/dist/tools/FileEditTool/utils.js +10 -4
  24. package/dist/tools/FileEditTool/utils.js.map +2 -2
  25. package/dist/tools/FileReadTool/FileReadTool.js +1 -1
  26. package/dist/tools/FileReadTool/FileReadTool.js.map +1 -1
  27. package/dist/tools/FileReadTool/prompt.js +16 -1
  28. package/dist/tools/FileReadTool/prompt.js.map +2 -2
  29. package/dist/tools/FileWriteTool/FileWriteTool.js +1 -1
  30. package/dist/tools/FileWriteTool/FileWriteTool.js.map +1 -1
  31. package/dist/tools/FileWriteTool/prompt.js +8 -1
  32. package/dist/tools/FileWriteTool/prompt.js.map +2 -2
  33. package/dist/tools/GlobTool/prompt.js +12 -1
  34. package/dist/tools/GlobTool/prompt.js.map +2 -2
  35. package/dist/tools/GrepTool/GrepTool.js +333 -65
  36. package/dist/tools/GrepTool/GrepTool.js.map +2 -2
  37. package/dist/tools/GrepTool/prompt.js +15 -8
  38. package/dist/tools/GrepTool/prompt.js.map +2 -2
  39. package/dist/tools/NotebookEditTool/NotebookEditTool.js +57 -45
  40. package/dist/tools/NotebookEditTool/NotebookEditTool.js.map +2 -2
  41. package/dist/tools/NotebookEditTool/prompt.js +1 -1
  42. package/dist/tools/NotebookEditTool/prompt.js.map +1 -1
  43. package/dist/tools/TaskCreateTool/TaskCreateTool.js +102 -0
  44. package/dist/tools/TaskCreateTool/TaskCreateTool.js.map +7 -0
  45. package/dist/tools/TaskCreateTool/prompt.js +47 -0
  46. package/dist/tools/TaskCreateTool/prompt.js.map +7 -0
  47. package/dist/tools/TaskGetTool/TaskGetTool.js +115 -0
  48. package/dist/tools/TaskGetTool/TaskGetTool.js.map +7 -0
  49. package/dist/tools/TaskGetTool/prompt.js +28 -0
  50. package/dist/tools/TaskGetTool/prompt.js.map +7 -0
  51. package/dist/tools/TaskListTool/TaskListTool.js +102 -0
  52. package/dist/tools/TaskListTool/TaskListTool.js.map +7 -0
  53. package/dist/tools/TaskListTool/prompt.js +27 -0
  54. package/dist/tools/TaskListTool/prompt.js.map +7 -0
  55. package/dist/tools/TaskStopTool/TaskStopTool.js +150 -0
  56. package/dist/tools/TaskStopTool/TaskStopTool.js.map +7 -0
  57. package/dist/tools/TaskStopTool/prompt.js +15 -0
  58. package/dist/tools/TaskStopTool/prompt.js.map +7 -0
  59. package/dist/tools/TaskTool/TaskTool.js +41 -1
  60. package/dist/tools/TaskTool/TaskTool.js.map +2 -2
  61. package/dist/tools/TaskUpdateTool/TaskUpdateTool.js +134 -0
  62. package/dist/tools/TaskUpdateTool/TaskUpdateTool.js.map +7 -0
  63. package/dist/tools/TaskUpdateTool/prompt.js +81 -0
  64. package/dist/tools/TaskUpdateTool/prompt.js.map +7 -0
  65. package/dist/tools/URLFetcherTool/prompt.js +1 -1
  66. package/dist/tools/URLFetcherTool/prompt.js.map +1 -1
  67. package/dist/tools.js +12 -0
  68. package/dist/tools.js.map +2 -2
  69. package/dist/utils/config.js.map +2 -2
  70. package/dist/utils/model.js +15 -2
  71. package/dist/utils/model.js.map +2 -2
  72. package/dist/utils/ripgrep.js +53 -1
  73. package/dist/utils/ripgrep.js.map +2 -2
  74. package/dist/utils/terminal.js +12 -0
  75. package/dist/utils/terminal.js.map +2 -2
  76. package/dist/utils/tooling/safeRender.js +13 -14
  77. package/dist/utils/tooling/safeRender.js.map +2 -2
  78. package/dist/version.js +2 -2
  79. package/dist/version.js.map +1 -1
  80. package/package.json +20 -28
@@ -52,8 +52,16 @@ function renderExpandedView(subagent, theme, tools, verbose, tokenCount) {
52
52
  if (content.type === "tool_result") {
53
53
  const resultContent = Array.isArray(content.content) ? content.content.find((c) => c.type === "text")?.text : typeof content.content === "string" ? content.content : "";
54
54
  if (resultContent && resultContent.trim()) {
55
- const lines = resultContent.trim().split("\n");
56
- const preview = lines.length > 3 ? lines.slice(0, 3).join("\n") + "\n..." : resultContent.trim();
55
+ const trimmedContent = resultContent.trim();
56
+ if (trimmedContent.startsWith("{") && trimmedContent.endsWith("}")) {
57
+ try {
58
+ JSON.parse(trimmedContent);
59
+ return null;
60
+ } catch {
61
+ }
62
+ }
63
+ const lines = trimmedContent.split("\n");
64
+ const preview = lines.length > 3 ? lines.slice(0, 3).join("\n") + "\n..." : trimmedContent;
57
65
  return /* @__PURE__ */ React.createElement(Box, { key: `${idx}-${contentIdx}`, flexDirection: "column" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, { color: theme.dim }, " \u23BFS5 "), /* @__PURE__ */ React.createElement(Text, { color: theme.secondaryText }, preview.split("\n")[0])), preview.split("\n").slice(1).map((line, lineIdx) => /* @__PURE__ */ React.createElement(Box, { key: lineIdx, marginLeft: 7 }, /* @__PURE__ */ React.createElement(Text, { color: theme.secondaryText }, line))));
58
66
  }
59
67
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/SubagentProgress.tsx"],
4
- "sourcesContent": ["import React, { useRef } from 'react'\nimport { Box, Text } from 'ink'\nimport { getTheme } from '@utils/theme'\nimport { formatNumber, formatDuration } from '@utils/format'\nimport { SYMBOLS } from '@constants/symbols'\nimport { getAgentColor } from '@constants/colors'\nimport { SpinnerSymbol } from './SpinnerSymbol'\nimport type { SubagentState } from '@minto-types/subagent'\nimport { Message } from './Message'\nimport type { Tool } from '@tool'\nimport { useUnifiedAnimation } from '@utils/animationManager'\nimport { useAgentTokenStats, formatTokenCount } from '@hooks/useAgentTokenStats'\n\ninterface SubagentProgressProps {\n subagent: SubagentState\n isExpanded: boolean\n tools?: Tool[]\n verbose?: boolean\n debug?: boolean\n}\n\n/**\n * \u5355\u4E2A Subagent \u7684\u8FDB\u5EA6\u663E\u793A\u7EC4\u4EF6\n *\n * \u7EDF\u4E00\u663E\u793A\u683C\u5F0F\uFF1A\n * - \u7B2C1\u884C\uFF1ASpinner + Task\u540D\u79F0 + Agent\u7C7B\u578B + Status + Metrics\u6458\u8981\n * - Ctrl+O\u5C55\u5F00\u540E\uFF1A\u663E\u793A\u8BE6\u7EC6\u7684\u6D88\u606F\u6D41\n *\n * \u4F7F\u7528\u7EDF\u4E00\u52A8\u753B\u7BA1\u7406\u5668\u4EE3\u66FF setInterval\uFF0C\u51CF\u5C11\u5C4F\u5E55\u95EA\u70C1\n */\nexport function SubagentProgress({\n subagent,\n isExpanded,\n tools = [],\n verbose = false,\n debug = false,\n}: SubagentProgressProps) {\n const theme = getTheme()\n const { metrics, taskName, status, messages, agentType, agentColor } =\n subagent\n\n // Get real-time token stats from unified TokenStatsManager\n const tokenStats = useAgentTokenStats(subagent.id)\n const tokenCount = tokenStats?.grandTotalTokens ?? 0\n\n // \u83B7\u53D6 agent \u989C\u8272\n const color = getAgentColor(agentColor, theme)\n\n // \u5224\u65AD\u662F\u5426\u6B63\u5728\u8FD0\u884C\uFF08\u51B3\u5B9A\u662F\u5426\u95EA\u70C1\uFF09\n const isRunning =\n status === 'initializing' || status === 'running' || status === 'queued'\n\n // Use unified animation manager for periodic time updates\n const startTimeRef = useRef(metrics.startTime)\n const { elapsedTime } = useUnifiedAnimation({\n enabled: isRunning,\n startTime: startTimeRef.current,\n spinnerFrameCount: 1,\n componentId: `subagent-${subagent.id}`,\n })\n\n // \u8BA1\u7B97\u6301\u7EED\u65F6\u95F4\uFF08\u5728\u6BCF\u6B21\u6E32\u67D3\u65F6\u91CD\u65B0\u8BA1\u7B97\uFF09\n const duration = metrics.endTime\n ? metrics.endTime - metrics.startTime\n : Date.now() - metrics.startTime\n\n // \u72B6\u6001\u6587\u672C\n const statusText = getStatusText(status)\n\n return (\n <Box flexDirection=\"column\" marginY={0}>\n {/* \u7B2C1\u884C\uFF1A\u4EFB\u52A1\u540D\u79F0 */}\n <Box flexDirection=\"row\">\n <SpinnerSymbol isRunning={isRunning} color={agentColor} />\n <Text> Task({taskName})</Text>\n </Box>\n\n {/* \u7B2C2\u884C\uFF1A\u8BE6\u7EC6\u4FE1\u606F\uFF08\u72B6\u6001\u3001\u6307\u6807\uFF09 - Claude Code CLI \u6807\u51C6\u683C\u5F0F */}\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS1 </Text>\n <Text color={getStatusColor(status, theme)}>{statusText}</Text>\n <Text color={theme.secondaryText}> \u00B7 </Text>\n <Text color={theme.secondaryText}>\n {metrics.toolUseCount} tool use{metrics.toolUseCount !== 1 ? 's' : ''}\n </Text>\n <Text color={theme.secondaryText}> \u00B7 </Text>\n <Text color={theme.secondaryText}>\n {formatTokenCount(tokenCount)} tokens\n </Text>\n <Text color={theme.secondaryText}> \u00B7 </Text>\n <Text color={theme.secondaryText}>{formatDuration(duration)}</Text>\n {!isExpanded && <Text color={theme.dim}> \u00B7 (ctrl-o to expand)</Text>}\n </Box>\n\n {/* Ctrl+O \u5C55\u5F00\u540E\u663E\u793A\u8BE6\u7EC6\u6D88\u606F\u6D41 - Claude Code CLI \u6807\u51C6\u683C\u5F0F */}\n {isExpanded && (\n <Box flexDirection=\"column\" marginTop={0}>\n {renderExpandedView(subagent, theme, tools, verbose, tokenCount)}\n </Box>\n )}\n </Box>\n )\n}\n\n/**\n * \u6E32\u67D3\u5C55\u5F00\u89C6\u56FE - Claude Code CLI \u6807\u51C6\u683C\u5F0F\n */\nfunction renderExpandedView(\n subagent: SubagentState,\n theme: ReturnType<typeof getTheme>,\n tools: Tool[],\n verbose: boolean,\n tokenCount: number,\n) {\n const { prompt, messages, status, metrics } = subagent\n const duration = metrics.endTime\n ? metrics.endTime - metrics.startTime\n : Date.now() - metrics.startTime\n\n return (\n <Box flexDirection=\"column\">\n {/* Prompt \u90E8\u5206 */}\n {prompt && (\n <Box flexDirection=\"column\">\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS2 </Text>\n <Text>Prompt:</Text>\n </Box>\n <Box flexDirection=\"column\" marginLeft={7}>\n <Text>{prompt}</Text>\n </Box>\n </Box>\n )}\n\n {/* \u5DE5\u5177\u8C03\u7528\u3001\u7ED3\u679C\u548C\u54CD\u5E94 */}\n {messages\n .map((msg, idx) => {\n if (msg.type === 'assistant') {\n return msg.message.content\n .map((content, contentIdx) => {\n if (content.type === 'tool_use') {\n const tool = tools.find(t => t.name === content.name)\n const toolName =\n (tool?.userFacingName &&\n typeof tool.userFacingName === 'function'\n ? tool.userFacingName()\n : undefined) || content.name\n return (\n <Box key={`${idx}-${contentIdx}`} flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS3 </Text>\n <Text>{toolName}</Text>\n </Box>\n )\n } else if (content.type === 'text' && content.text.trim()) {\n // \u663E\u793A Response \u6587\u672C\n const lines = content.text.trim().split('\\n')\n return (\n <Box key={`${idx}-${contentIdx}`} flexDirection=\"column\">\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS4 </Text>\n <Text>Response:</Text>\n </Box>\n <Box flexDirection=\"column\" marginLeft={7}>\n {lines.map((line, lineIdx) => (\n <Text>{line}</Text>\n ))}\n </Box>\n </Box>\n )\n }\n return null\n })\n .filter(item => item !== null)\n } else if (msg.type === 'user') {\n // \u5DE5\u5177\u7ED3\u679C\n return msg.message.content\n .map((content, contentIdx) => {\n if (content.type === 'tool_result') {\n const resultContent = Array.isArray(content.content)\n ? content.content.find(c => c.type === 'text')?.text\n : typeof content.content === 'string'\n ? content.content\n : ''\n\n if (resultContent && resultContent.trim()) {\n const lines = resultContent.trim().split('\\n')\n const preview =\n lines.length > 3\n ? lines.slice(0, 3).join('\\n') + '\\n...'\n : resultContent.trim()\n return (\n <Box key={`${idx}-${contentIdx}`} flexDirection=\"column\">\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS5 </Text>\n <Text color={theme.secondaryText}>\n {preview.split('\\n')[0]}\n </Text>\n </Box>\n {preview\n .split('\\n')\n .slice(1)\n .map((line, lineIdx) => (\n <Box key={lineIdx} marginLeft={7}>\n <Text color={theme.secondaryText}>{line}</Text>\n </Box>\n ))}\n </Box>\n )\n }\n }\n return null\n })\n .filter(item => item !== null)\n }\n return null\n })\n .flat()\n .filter(item => item !== null)}\n\n {/* Done \u72B6\u6001\uFF08\u4EC5\u5728\u5B8C\u6210\u65F6\u663E\u793A\uFF09 */}\n {status === 'completed' && (\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS6 </Text>\n <Text color={theme.success}>Done</Text>\n <Text color={theme.secondaryText}>\n {' '}\n ({metrics.toolUseCount} tool use\n {metrics.toolUseCount !== 1 ? 's' : ''} \u00B7{' '}\n {formatTokenCount(tokenCount)} tokens \u00B7 {formatDuration(duration)})\n </Text>\n </Box>\n )}\n </Box>\n )\n}\n\n/**\n * \u83B7\u53D6\u72B6\u6001\u6587\u672C\n */\nfunction getStatusText(status: SubagentState['status']): string {\n switch (status) {\n case 'initializing':\n return 'Initialize\u2026'\n case 'queued':\n return 'Queued\u2026'\n case 'running':\n return 'In progress\u2026'\n case 'completed':\n return 'Done'\n case 'error':\n return 'Error'\n }\n}\n\n/**\n * \u83B7\u53D6\u72B6\u6001\u989C\u8272\n */\nfunction getStatusColor(\n status: SubagentState['status'],\n theme: ReturnType<typeof getTheme>,\n): string {\n switch (status) {\n case 'initializing':\n return theme.secondaryText\n case 'queued':\n return theme.secondaryText\n case 'running':\n return theme.minto\n case 'completed':\n return theme.success\n case 'error':\n return theme.error\n }\n}\n\n/**\n * \u6E32\u67D3\u6D88\u606F\u9884\u89C8 - \u4F7F\u7528\u5B8C\u6574\u7684 Message \u7EC4\u4EF6\u6765\u663E\u793A\u5DE5\u5177\u8C03\u7528\u548C\u7ED3\u679C\n */\nfunction renderMessagePreview(\n message: any,\n theme: ReturnType<typeof getTheme>,\n tools: Tool[],\n verbose: boolean,\n) {\n // \u4F7F\u7528 Message \u7EC4\u4EF6\u6765\u6E32\u67D3\uFF0C\u8FD9\u6837\u53EF\u4EE5\u663E\u793A\u5B8C\u6574\u7684\u5DE5\u5177\u8C03\u7528\u548C\u7ED3\u679C\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n <Message\n message={message}\n messages={[message]}\n addMargin={false}\n tools={tools}\n verbose={verbose}\n debug={false}\n erroredToolUseIDs={new Set()}\n inProgressToolUseIDs={new Set()}\n unresolvedToolUseIDs={new Set()}\n shouldAnimate={false}\n shouldShowDot={false}\n />\n </Box>\n )\n}\n"],
5
- "mappings": "AAAA,OAAO,SAAS,cAAc;AAC9B,SAAS,KAAK,YAAY;AAC1B,SAAS,gBAAgB;AACzB,SAAuB,sBAAsB;AAE7C,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAE9B,SAAS,eAAe;AAExB,SAAS,2BAA2B;AACpC,SAAS,oBAAoB,wBAAwB;AAmB9C,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,QAAQ,CAA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{ getTheme } from '@utils/theme'\nimport { formatNumber, formatDuration } from '@utils/format'\nimport { SYMBOLS } from '@constants/symbols'\nimport { getAgentColor } from '@constants/colors'\nimport { SpinnerSymbol } from './SpinnerSymbol'\nimport type { SubagentState } from '@minto-types/subagent'\nimport { Message } from './Message'\nimport type { Tool } from '@tool'\nimport { useUnifiedAnimation } from '@utils/animationManager'\nimport { useAgentTokenStats, formatTokenCount } from '@hooks/useAgentTokenStats'\n\ninterface SubagentProgressProps {\n subagent: SubagentState\n isExpanded: boolean\n tools?: Tool[]\n verbose?: boolean\n debug?: boolean\n}\n\n/**\n * \u5355\u4E2A Subagent \u7684\u8FDB\u5EA6\u663E\u793A\u7EC4\u4EF6\n *\n * \u7EDF\u4E00\u663E\u793A\u683C\u5F0F\uFF1A\n * - \u7B2C1\u884C\uFF1ASpinner + Task\u540D\u79F0 + Agent\u7C7B\u578B + Status + Metrics\u6458\u8981\n * - Ctrl+O\u5C55\u5F00\u540E\uFF1A\u663E\u793A\u8BE6\u7EC6\u7684\u6D88\u606F\u6D41\n *\n * \u4F7F\u7528\u7EDF\u4E00\u52A8\u753B\u7BA1\u7406\u5668\u4EE3\u66FF setInterval\uFF0C\u51CF\u5C11\u5C4F\u5E55\u95EA\u70C1\n */\nexport function SubagentProgress({\n subagent,\n isExpanded,\n tools = [],\n verbose = false,\n debug = false,\n}: SubagentProgressProps) {\n const theme = getTheme()\n const { metrics, taskName, status, messages, agentType, agentColor } =\n subagent\n\n // Get real-time token stats from unified TokenStatsManager\n const tokenStats = useAgentTokenStats(subagent.id)\n const tokenCount = tokenStats?.grandTotalTokens ?? 0\n\n // \u83B7\u53D6 agent \u989C\u8272\n const color = getAgentColor(agentColor, theme)\n\n // \u5224\u65AD\u662F\u5426\u6B63\u5728\u8FD0\u884C\uFF08\u51B3\u5B9A\u662F\u5426\u95EA\u70C1\uFF09\n const isRunning =\n status === 'initializing' || status === 'running' || status === 'queued'\n\n // Use unified animation manager for periodic time updates\n const startTimeRef = useRef(metrics.startTime)\n const { elapsedTime } = useUnifiedAnimation({\n enabled: isRunning,\n startTime: startTimeRef.current,\n spinnerFrameCount: 1,\n componentId: `subagent-${subagent.id}`,\n })\n\n // \u8BA1\u7B97\u6301\u7EED\u65F6\u95F4\uFF08\u5728\u6BCF\u6B21\u6E32\u67D3\u65F6\u91CD\u65B0\u8BA1\u7B97\uFF09\n const duration = metrics.endTime\n ? metrics.endTime - metrics.startTime\n : Date.now() - metrics.startTime\n\n // \u72B6\u6001\u6587\u672C\n const statusText = getStatusText(status)\n\n return (\n <Box flexDirection=\"column\" marginY={0}>\n {/* \u7B2C1\u884C\uFF1A\u4EFB\u52A1\u540D\u79F0 */}\n <Box flexDirection=\"row\">\n <SpinnerSymbol isRunning={isRunning} color={agentColor} />\n <Text> Task({taskName})</Text>\n </Box>\n\n {/* \u7B2C2\u884C\uFF1A\u8BE6\u7EC6\u4FE1\u606F\uFF08\u72B6\u6001\u3001\u6307\u6807\uFF09 - Claude Code CLI \u6807\u51C6\u683C\u5F0F */}\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS1 </Text>\n <Text color={getStatusColor(status, theme)}>{statusText}</Text>\n <Text color={theme.secondaryText}> \u00B7 </Text>\n <Text color={theme.secondaryText}>\n {metrics.toolUseCount} tool use{metrics.toolUseCount !== 1 ? 's' : ''}\n </Text>\n <Text color={theme.secondaryText}> \u00B7 </Text>\n <Text color={theme.secondaryText}>\n {formatTokenCount(tokenCount)} tokens\n </Text>\n <Text color={theme.secondaryText}> \u00B7 </Text>\n <Text color={theme.secondaryText}>{formatDuration(duration)}</Text>\n {!isExpanded && <Text color={theme.dim}> \u00B7 (ctrl-o to expand)</Text>}\n </Box>\n\n {/* Ctrl+O \u5C55\u5F00\u540E\u663E\u793A\u8BE6\u7EC6\u6D88\u606F\u6D41 - Claude Code CLI \u6807\u51C6\u683C\u5F0F */}\n {isExpanded && (\n <Box flexDirection=\"column\" marginTop={0}>\n {renderExpandedView(subagent, theme, tools, verbose, tokenCount)}\n </Box>\n )}\n </Box>\n )\n}\n\n/**\n * \u6E32\u67D3\u5C55\u5F00\u89C6\u56FE - Claude Code CLI \u6807\u51C6\u683C\u5F0F\n */\nfunction renderExpandedView(\n subagent: SubagentState,\n theme: ReturnType<typeof getTheme>,\n tools: Tool[],\n verbose: boolean,\n tokenCount: number,\n) {\n const { prompt, messages, status, metrics } = subagent\n const duration = metrics.endTime\n ? metrics.endTime - metrics.startTime\n : Date.now() - metrics.startTime\n\n return (\n <Box flexDirection=\"column\">\n {/* Prompt \u90E8\u5206 */}\n {prompt && (\n <Box flexDirection=\"column\">\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS2 </Text>\n <Text>Prompt:</Text>\n </Box>\n <Box flexDirection=\"column\" marginLeft={7}>\n <Text>{prompt}</Text>\n </Box>\n </Box>\n )}\n\n {/* \u5DE5\u5177\u8C03\u7528\u3001\u7ED3\u679C\u548C\u54CD\u5E94 */}\n {messages\n .map((msg, idx) => {\n if (msg.type === 'assistant') {\n return msg.message.content\n .map((content, contentIdx) => {\n if (content.type === 'tool_use') {\n const tool = tools.find(t => t.name === content.name)\n const toolName =\n (tool?.userFacingName &&\n typeof tool.userFacingName === 'function'\n ? tool.userFacingName()\n : undefined) || content.name\n return (\n <Box key={`${idx}-${contentIdx}`} flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS3 </Text>\n <Text>{toolName}</Text>\n </Box>\n )\n } else if (content.type === 'text' && content.text.trim()) {\n // \u663E\u793A Response \u6587\u672C\n const lines = content.text.trim().split('\\n')\n return (\n <Box key={`${idx}-${contentIdx}`} flexDirection=\"column\">\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS4 </Text>\n <Text>Response:</Text>\n </Box>\n <Box flexDirection=\"column\" marginLeft={7}>\n {lines.map((line, lineIdx) => (\n <Text>{line}</Text>\n ))}\n </Box>\n </Box>\n )\n }\n return null\n })\n .filter(item => item !== null)\n } else if (msg.type === 'user') {\n // \u5DE5\u5177\u7ED3\u679C\n return msg.message.content\n .map((content, contentIdx) => {\n if (content.type === 'tool_result') {\n const resultContent = Array.isArray(content.content)\n ? content.content.find(c => c.type === 'text')?.text\n : typeof content.content === 'string'\n ? content.content\n : ''\n\n if (resultContent && resultContent.trim()) {\n // Skip displaying raw JSON objects (e.g., tool data objects)\n // These look like { \"key\": \"value\", ... } and shouldn't be shown\n const trimmedContent = resultContent.trim()\n if (\n trimmedContent.startsWith('{') &&\n trimmedContent.endsWith('}')\n ) {\n try {\n // If it's valid JSON, skip it - it's internal tool data\n JSON.parse(trimmedContent)\n return null\n } catch {\n // Not valid JSON, show it\n }\n }\n\n const lines = trimmedContent.split('\\n')\n const preview =\n lines.length > 3\n ? lines.slice(0, 3).join('\\n') + '\\n...'\n : trimmedContent\n return (\n <Box key={`${idx}-${contentIdx}`} flexDirection=\"column\">\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS5 </Text>\n <Text color={theme.secondaryText}>\n {preview.split('\\n')[0]}\n </Text>\n </Box>\n {preview\n .split('\\n')\n .slice(1)\n .map((line, lineIdx) => (\n <Box key={lineIdx} marginLeft={7}>\n <Text color={theme.secondaryText}>{line}</Text>\n </Box>\n ))}\n </Box>\n )\n }\n }\n return null\n })\n .filter(item => item !== null)\n }\n return null\n })\n .flat()\n .filter(item => item !== null)}\n\n {/* Done \u72B6\u6001\uFF08\u4EC5\u5728\u5B8C\u6210\u65F6\u663E\u793A\uFF09 */}\n {status === 'completed' && (\n <Box flexDirection=\"row\">\n <Text color={theme.dim}> \u23BFS6 </Text>\n <Text color={theme.success}>Done</Text>\n <Text color={theme.secondaryText}>\n {' '}\n ({metrics.toolUseCount} tool use\n {metrics.toolUseCount !== 1 ? 's' : ''} \u00B7{' '}\n {formatTokenCount(tokenCount)} tokens \u00B7 {formatDuration(duration)})\n </Text>\n </Box>\n )}\n </Box>\n )\n}\n\n/**\n * \u83B7\u53D6\u72B6\u6001\u6587\u672C\n */\nfunction getStatusText(status: SubagentState['status']): string {\n switch (status) {\n case 'initializing':\n return 'Initialize\u2026'\n case 'queued':\n return 'Queued\u2026'\n case 'running':\n return 'In progress\u2026'\n case 'completed':\n return 'Done'\n case 'error':\n return 'Error'\n }\n}\n\n/**\n * \u83B7\u53D6\u72B6\u6001\u989C\u8272\n */\nfunction getStatusColor(\n status: SubagentState['status'],\n theme: ReturnType<typeof getTheme>,\n): string {\n switch (status) {\n case 'initializing':\n return theme.secondaryText\n case 'queued':\n return theme.secondaryText\n case 'running':\n return theme.minto\n case 'completed':\n return theme.success\n case 'error':\n return theme.error\n }\n}\n\n/**\n * \u6E32\u67D3\u6D88\u606F\u9884\u89C8 - \u4F7F\u7528\u5B8C\u6574\u7684 Message \u7EC4\u4EF6\u6765\u663E\u793A\u5DE5\u5177\u8C03\u7528\u548C\u7ED3\u679C\n */\nfunction renderMessagePreview(\n message: any,\n theme: ReturnType<typeof getTheme>,\n tools: Tool[],\n verbose: boolean,\n) {\n // \u4F7F\u7528 Message \u7EC4\u4EF6\u6765\u6E32\u67D3\uFF0C\u8FD9\u6837\u53EF\u4EE5\u663E\u793A\u5B8C\u6574\u7684\u5DE5\u5177\u8C03\u7528\u548C\u7ED3\u679C\n return (\n <Box flexDirection=\"column\" marginLeft={2}>\n <Message\n message={message}\n messages={[message]}\n addMargin={false}\n tools={tools}\n verbose={verbose}\n debug={false}\n erroredToolUseIDs={new Set()}\n inProgressToolUseIDs={new Set()}\n unresolvedToolUseIDs={new Set()}\n shouldAnimate={false}\n shouldShowDot={false}\n />\n </Box>\n )\n}\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,cAAc;AAC9B,SAAS,KAAK,YAAY;AAC1B,SAAS,gBAAgB;AACzB,SAAuB,sBAAsB;AAE7C,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAE9B,SAAS,eAAe;AAExB,SAAS,2BAA2B;AACpC,SAAS,oBAAoB,wBAAwB;AAmB9C,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA,Q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AAI,IAAI;AAAA,MAC9B,sBAAsB,oBAAI,IAAI;AAAA,MAC9B,eAAe;AAAA,MACf,eAAe;AAAA;AAAA,EACjB,CACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -46,7 +46,16 @@ Output text to communicate with the user; all text you output outside of tool us
46
46
  If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.
47
47
  IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.
48
48
  IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.
49
- IMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...". Examples of appropriate verbosity:
49
+ IMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...".
50
+ - Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
51
+
52
+ # No time estimates
53
+ Never give time estimates or predictions for how long tasks will take. Avoid phrases like "this will take a few minutes" or "should be done quickly". Focus on what needs to be done, not how long it might take.
54
+
55
+ # Professional objectivity
56
+ Prioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving. Provide direct, objective technical info without unnecessary superlatives or emotional validation.
57
+
58
+ Examples of appropriate verbosity:
50
59
  <example>
51
60
  user: 2 + 2
52
61
  assistant: 4
@@ -93,6 +102,18 @@ The user will primarily request you perform software engineering tasks. This inc
93
102
  - VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to ${PROJECT_FILE} so that you will know to run it next time.
94
103
  NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
95
104
 
105
+ # Git Safety Protocol
106
+ - NEVER update the git config
107
+ - NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions
108
+ - NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
109
+ - NEVER run force push to main/master, warn the user if they request it
110
+ - CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen \u2014 so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit
111
+ - When staging files, prefer adding specific files by name rather than using "git add -A" or "git add .", which can accidentally include sensitive files (.env, credentials) or large binaries
112
+ - NEVER commit changes unless the user explicitly asks you to
113
+
114
+ # Code References
115
+ When referencing specific functions or pieces of code, include the pattern \`file_path:line_number\` to allow the user to easily navigate to the source code location.
116
+
96
117
  - Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.
97
118
 
98
119
  # Tool usage policy
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/constants/prompts.ts"],
4
- "sourcesContent": ["import { env } from '@utils/env'\nimport { getIsGit } from '@utils/git'\nimport {\n INTERRUPT_MESSAGE,\n INTERRUPT_MESSAGE_FOR_TOOL_USE,\n} from '@utils/messages'\nimport { getCwd } from '@utils/state'\nimport { PRODUCT_NAME, PROJECT_FILE, PRODUCT_COMMAND } from './product'\nimport { BashTool } from '@tools/BashTool/BashTool'\nimport { MACRO } from './macros'\n\n// // Security policy constant matching reference implementation\n// export const SECURITY_POLICY =\n// 'IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.'\n\nexport function getCLISyspromptPrefix(): string {\n return `You are ${PRODUCT_NAME}, ShareAI-lab's Agent AI CLI for terminal & coding.`\n}\n\nexport async function getSystemPrompt(): Promise<string[]> {\n return [\n `\nYou are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.\nIMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).\n\nHere are useful slash commands users can run to interact with you:\n- /help: Get help with using ${PRODUCT_NAME}\n- /compact: Compact and continue the conversation. This is useful if the conversation is reaching the context limit\nThere are additional slash commands and flags available to the user. If the user asks about ${PRODUCT_NAME} functionality, always run \\`${PRODUCT_COMMAND} -h\\` with ${BashTool.name} to see supported commands and flags. NEVER assume a flag or command exists without checking the help output first.\nTo give feedback, users should ${MACRO.ISSUES_EXPLAINER}.\n\n# Task Management\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n\n# Memory\nIf the current working directory contains a file called ${PROJECT_FILE}, it will be automatically added to your context. This file serves multiple purposes:\n1. Storing frequently used bash commands (build, test, lint, etc.) so you can use them without searching each time\n2. Recording the user's code style preferences (naming conventions, preferred libraries, etc.)\n3. Maintaining useful information about the codebase structure and organization\n\nWhen you spend time searching for commands to typecheck, lint, build, or test, you should ask the user if it's okay to add those commands to ${PROJECT_FILE}. Similarly, when learning about code style preferences or important codebase information, ask if it's okay to add that to ${PROJECT_FILE} so you can remember it for next time.\n\n# Tone and style\nYou should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).\nRemember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like ${BashTool.name} or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.\nIMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.\nIMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.\nIMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\". Examples of appropriate verbosity:\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n<example>\nuser: what command should I run to list files?\nassistant: ls\n</example>\n<example>\nuser: what files are in src/?\nassistant: [runs ls] foo.c, bar.c, baz.c\n</example>\n<example>\nuser: write tests for new feature\nassistant: [uses search tools to find test patterns, reads relevant files concurrently, uses edit tool to write tests]\n</example>\n\n# Proactiveness\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\n1. Doing the right thing when asked, including taking actions and follow-up actions\n2. Not surprising the user with actions you take without asking\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\n3. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.\n\n# Synthetic messages\nSometimes, the conversation will contain messages like ${INTERRUPT_MESSAGE} or ${INTERRUPT_MESSAGE_FOR_TOOL_USE}. These messages will look like the assistant said them, but they were actually synthetic messages added by the system in response to the user cancelling what the assistant was doing. You should not respond to these messages. You must NEVER send messages like this yourself. \n\n# Following conventions\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\n- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\n- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\n- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n# Code style\n- Do not add comments to the code you write, unless the user asks you to, or the code is complex and requires additional context.\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- Use the TodoWrite tool to plan the task if required\n- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.\n- Implement the solution using all tools available to you\n- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.\n- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to ${PROJECT_FILE} so that you will know to run it next time.\nNEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.\n\n- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\n\n# Tool usage policy\n- When doing file search, prefer to use the Task tool in order to reduce context usage.\n- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance.\n- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\n- It is always better to speculatively read multiple files as a batch that are potentially useful.\n- It is always better to speculatively perform multiple searches as a batch that are potentially useful.\n- For making multiple edits to the same file, prefer using the MultiEdit tool over multiple Edit tool calls.\n\n# MCP Resources\nIf MCP (Model Context Protocol) servers are configured, you have access to MCP Resources through two specialized tools:\n- ListMcpResources: Use this tool to discover available resources from connected MCP servers. Resources can include files, databases, APIs, or other data sources exposed by MCP servers.\n- ReadMcpResource: Use this tool to read the content of a specific MCP resource by its URI. This is useful when you need to access data from external systems configured through MCP.\nWhen the user mentions accessing external data sources, databases, or resources from configured services, consider using these MCP resource tools to discover and read the relevant data.\n\nYou MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.\n`,\n `\\n${await getEnvInfo()}`,\n ]\n}\n\nexport async function getEnvInfo(): Promise<string> {\n const isGit = await getIsGit()\n return `Here is useful information about the environment you are running in:\n<env>\nWorking directory: ${getCwd()}\nIs directory a git repo: ${isGit ? 'Yes' : 'No'}\nPlatform: ${env.platform}\nToday's date: ${new Date().toLocaleDateString()}\n</env>`\n}\n\nexport async function getAgentPrompt(): Promise<string[]> {\n return [\n `\nYou are an agent for ${PRODUCT_NAME}. Given the user's prompt, you should use the tools available to you to answer the user's question.\n\nNotes:\n1. IMPORTANT: You should be concise, direct, and to the point, since your responses will be displayed on a command line interface. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\".\n2. When relevant, share file names and code snippets relevant to the query\n3. Any file paths you return in your final response MUST be absolute. DO NOT use relative paths.`,\n `${await getEnvInfo()}`,\n ]\n}\n"],
5
- "mappings": "AAAA,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,cAAc,cAAc,uBAAuB;AAC5D,SAAS,gBAAgB;AACzB,SAAS,aAAa;AAMf,SAAS,wBAAgC;AAC9C,SAAO,WAAW,YAAY;AAChC;AAEA,eAAsB,kBAAqC;AACzD,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAO2B,YAAY;AAAA;AAAA,8FAEmD,YAAY,gCAAgC,eAAe,cAAc,SAAS,IAAI;AAAA,iCACnJ,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0DASG,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,+IAKyE,YAAY,8HAA8H,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,qKAKhI,SAAS,IAAI;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,yDA8BzH,iBAAiB,OAAO,8BAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4VAkB6O,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAqBpW;AAAA,EAAK,MAAM,WAAW,CAAC;AAAA,EACzB;AACF;AAEA,eAAsB,aAA8B;AAClD,QAAM,QAAQ,MAAM,SAAS;AAC7B,SAAO;AAAA;AAAA,qBAEY,OAAO,CAAC;AAAA,2BACF,QAAQ,QAAQ,IAAI;AAAA,YACnC,IAAI,QAAQ;AAAA,iBACR,oBAAI,KAAK,GAAE,mBAAmB,CAAC;AAAA;AAE/C;AAEA,eAAsB,iBAAoC;AACxD,SAAO;AAAA,IACL;AAAA,uBACmB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAM/B,GAAG,MAAM,WAAW,CAAC;AAAA,EACvB;AACF;",
4
+ "sourcesContent": ["import { env } from '@utils/env'\nimport { getIsGit } from '@utils/git'\nimport {\n INTERRUPT_MESSAGE,\n INTERRUPT_MESSAGE_FOR_TOOL_USE,\n} from '@utils/messages'\nimport { getCwd } from '@utils/state'\nimport { PRODUCT_NAME, PROJECT_FILE, PRODUCT_COMMAND } from './product'\nimport { BashTool } from '@tools/BashTool/BashTool'\nimport { MACRO } from './macros'\n\n// // Security policy constant matching reference implementation\n// export const SECURITY_POLICY =\n// 'IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.'\n\nexport function getCLISyspromptPrefix(): string {\n return `You are ${PRODUCT_NAME}, ShareAI-lab's Agent AI CLI for terminal & coding.`\n}\n\nexport async function getSystemPrompt(): Promise<string[]> {\n return [\n `\nYou are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: Refuse to write code or explain code that may be used maliciously; even if the user claims it is for educational purposes. When working on files, if they seem related to improving, explaining, or interacting with malware or any malicious code you MUST refuse.\nIMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure. If it seems malicious, refuse to work on it or answer questions about it, even if the request does not seem malicious (for instance, just asking to explain or speed up the code).\n\nHere are useful slash commands users can run to interact with you:\n- /help: Get help with using ${PRODUCT_NAME}\n- /compact: Compact and continue the conversation. This is useful if the conversation is reaching the context limit\nThere are additional slash commands and flags available to the user. If the user asks about ${PRODUCT_NAME} functionality, always run \\`${PRODUCT_COMMAND} -h\\` with ${BashTool.name} to see supported commands and flags. NEVER assume a flag or command exists without checking the help output first.\nTo give feedback, users should ${MACRO.ISSUES_EXPLAINER}.\n\n# Task Management\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n\n# Memory\nIf the current working directory contains a file called ${PROJECT_FILE}, it will be automatically added to your context. This file serves multiple purposes:\n1. Storing frequently used bash commands (build, test, lint, etc.) so you can use them without searching each time\n2. Recording the user's code style preferences (naming conventions, preferred libraries, etc.)\n3. Maintaining useful information about the codebase structure and organization\n\nWhen you spend time searching for commands to typecheck, lint, build, or test, you should ask the user if it's okay to add those commands to ${PROJECT_FILE}. Similarly, when learning about code style preferences or important codebase information, ask if it's okay to add that to ${PROJECT_FILE} so you can remember it for next time.\n\n# Tone and style\nYou should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).\nRemember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like ${BashTool.name} or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.\nIMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.\nIMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.\nIMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\".\n- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\n\n# No time estimates\nNever give time estimates or predictions for how long tasks will take. Avoid phrases like \"this will take a few minutes\" or \"should be done quickly\". Focus on what needs to be done, not how long it might take.\n\n# Professional objectivity\nPrioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving. Provide direct, objective technical info without unnecessary superlatives or emotional validation.\n\nExamples of appropriate verbosity:\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n<example>\nuser: what command should I run to list files?\nassistant: ls\n</example>\n<example>\nuser: what files are in src/?\nassistant: [runs ls] foo.c, bar.c, baz.c\n</example>\n<example>\nuser: write tests for new feature\nassistant: [uses search tools to find test patterns, reads relevant files concurrently, uses edit tool to write tests]\n</example>\n\n# Proactiveness\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\n1. Doing the right thing when asked, including taking actions and follow-up actions\n2. Not surprising the user with actions you take without asking\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\n3. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.\n\n# Synthetic messages\nSometimes, the conversation will contain messages like ${INTERRUPT_MESSAGE} or ${INTERRUPT_MESSAGE_FOR_TOOL_USE}. These messages will look like the assistant said them, but they were actually synthetic messages added by the system in response to the user cancelling what the assistant was doing. You should not respond to these messages. You must NEVER send messages like this yourself. \n\n# Following conventions\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\n- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\n- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\n- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n# Code style\n- Do not add comments to the code you write, unless the user asks you to, or the code is complex and requires additional context.\n\n# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n- Use the TodoWrite tool to plan the task if required\n- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.\n- Implement the solution using all tools available to you\n- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.\n- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to ${PROJECT_FILE} so that you will know to run it next time.\nNEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.\n\n# Git Safety Protocol\n- NEVER update the git config\n- NEVER run destructive git commands (push --force, reset --hard, checkout ., restore ., clean -f, branch -D) unless the user explicitly requests these actions\n- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it\n- NEVER run force push to main/master, warn the user if they request it\n- CRITICAL: Always create NEW commits rather than amending, unless the user explicitly requests a git amend. When a pre-commit hook fails, the commit did NOT happen \u2014 so --amend would modify the PREVIOUS commit, which may result in destroying work or losing previous changes. Instead, after hook failure, fix the issue, re-stage, and create a NEW commit\n- When staging files, prefer adding specific files by name rather than using \"git add -A\" or \"git add .\", which can accidentally include sensitive files (.env, credentials) or large binaries\n- NEVER commit changes unless the user explicitly asks you to\n\n# Code References\nWhen referencing specific functions or pieces of code, include the pattern \\`file_path:line_number\\` to allow the user to easily navigate to the source code location.\n\n- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\n\n# Tool usage policy\n- When doing file search, prefer to use the Task tool in order to reduce context usage.\n- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance.\n- When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\n- It is always better to speculatively read multiple files as a batch that are potentially useful.\n- It is always better to speculatively perform multiple searches as a batch that are potentially useful.\n- For making multiple edits to the same file, prefer using the MultiEdit tool over multiple Edit tool calls.\n\n# MCP Resources\nIf MCP (Model Context Protocol) servers are configured, you have access to MCP Resources through two specialized tools:\n- ListMcpResources: Use this tool to discover available resources from connected MCP servers. Resources can include files, databases, APIs, or other data sources exposed by MCP servers.\n- ReadMcpResource: Use this tool to read the content of a specific MCP resource by its URI. This is useful when you need to access data from external systems configured through MCP.\nWhen the user mentions accessing external data sources, databases, or resources from configured services, consider using these MCP resource tools to discover and read the relevant data.\n\nYou MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.\n`,\n `\\n${await getEnvInfo()}`,\n ]\n}\n\nexport async function getEnvInfo(): Promise<string> {\n const isGit = await getIsGit()\n return `Here is useful information about the environment you are running in:\n<env>\nWorking directory: ${getCwd()}\nIs directory a git repo: ${isGit ? 'Yes' : 'No'}\nPlatform: ${env.platform}\nToday's date: ${new Date().toLocaleDateString()}\n</env>`\n}\n\nexport async function getAgentPrompt(): Promise<string[]> {\n return [\n `\nYou are an agent for ${PRODUCT_NAME}. Given the user's prompt, you should use the tools available to you to answer the user's question.\n\nNotes:\n1. IMPORTANT: You should be concise, direct, and to the point, since your responses will be displayed on a command line interface. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\".\n2. When relevant, share file names and code snippets relevant to the query\n3. Any file paths you return in your final response MUST be absolute. DO NOT use relative paths.`,\n `${await getEnvInfo()}`,\n ]\n}\n"],
5
+ "mappings": "AAAA,SAAS,WAAW;AACpB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,cAAc,cAAc,uBAAuB;AAC5D,SAAS,gBAAgB;AACzB,SAAS,aAAa;AAMf,SAAS,wBAAgC;AAC9C,SAAO,WAAW,YAAY;AAChC;AAEA,eAAsB,kBAAqC;AACzD,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAO2B,YAAY;AAAA;AAAA,8FAEmD,YAAY,gCAAgC,eAAe,cAAc,SAAS,IAAI;AAAA,iCACnJ,MAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0DASG,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,+IAKyE,YAAY,8HAA8H,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,qKAKhI,SAAS,IAAI;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,yDAuCzH,iBAAiB,OAAO,8BAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4VAkB6O,YAAY;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,IAiCpW;AAAA,EAAK,MAAM,WAAW,CAAC;AAAA,EACzB;AACF;AAEA,eAAsB,aAA8B;AAClD,QAAM,QAAQ,MAAM,SAAS;AAC7B,SAAO;AAAA;AAAA,qBAEY,OAAO,CAAC;AAAA,2BACF,QAAQ,QAAQ,IAAI;AAAA,YACnC,IAAI,QAAQ;AAAA,iBACR,oBAAI,KAAK,GAAE,mBAAmB,CAAC;AAAA;AAE/C;AAEA,eAAsB,iBAAoC;AACxD,SAAO;AAAA,IACL;AAAA,uBACmB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAM/B,GAAG,MAAM,WAAW,CAAC;AAAA,EACvB;AACF;",
6
6
  "names": []
7
7
  }
@@ -94,7 +94,7 @@ import {
94
94
  import { gt } from "semver";
95
95
  import { CACHE_PATHS } from "../utils/log.js";
96
96
  import { onShellCrash } from "../utils/PersistentShell.js";
97
- import { clearTerminal } from "../utils/terminal.js";
97
+ import { clearTerminal, prepareTerminalForREPL } from "../utils/terminal.js";
98
98
  import { setupExitHandlers } from "../utils/exit.js";
99
99
  import { showInvalidConfigDialog } from "../components/InvalidConfigDialog.js";
100
100
  import { ConfigParseError } from "../utils/errors.js";
@@ -368,6 +368,10 @@ ${commandList}`
368
368
  "-p, --print",
369
369
  "Print response and exit (useful for pipes)",
370
370
  () => true
371
+ ).option(
372
+ "--free",
373
+ "Enable Free safety mode (project directory operations auto-allowed, outside requires confirmation)",
374
+ () => true
371
375
  ).option(
372
376
  "--smart",
373
377
  "Enable Smart safety mode (dangerous operations need confirmation)",
@@ -395,6 +399,7 @@ ${commandList}`
395
399
  verbose,
396
400
  enableArchitect,
397
401
  print,
402
+ free,
398
403
  smart,
399
404
  strict,
400
405
  new: startNew,
@@ -405,7 +410,7 @@ ${commandList}`
405
410
  setLanguage(lang);
406
411
  }
407
412
  const envSafetyMode = process.env.MINTO_SAFETY_MODE;
408
- const safetyMode = envSafetyMode ? envSafetyMode : strict ? "strict" : smart ? "smart" : "yolo";
413
+ const safetyMode = envSafetyMode ? envSafetyMode : strict ? "strict" : smart ? "smart" : free ? "free" : "yolo";
409
414
  const safeMode = safetyMode !== "yolo";
410
415
  await showSetupScreens(safeMode, print, rawModeSupported);
411
416
  await setup(cwd2, safeMode);
@@ -508,11 +513,7 @@ ${commandList}`
508
513
  {
509
514
  const { render } = await import("ink");
510
515
  const { REPL } = await import("../screens/REPL.js");
511
- if (process.stdout.isTTY) {
512
- await new Promise((resolve) => {
513
- process.stdout.write("\x1B[?25h\n", () => resolve());
514
- });
515
- }
516
+ await prepareTerminalForREPL();
516
517
  render(
517
518
  /* @__PURE__ */ React.createElement(
518
519
  REPL,
@@ -1083,6 +1084,10 @@ ${commandList}`
1083
1084
  "[identifier]",
1084
1085
  "A number (0, 1, 2, etc.) or file path to resume a specific conversation"
1085
1086
  ).option("-c, --cwd <cwd>", "The current working directory", String, cwd()).option("-e, --enable-architect", "Enable the Architect tool", () => true).option("-v, --verbose", "Do not truncate message output", () => true).option(
1087
+ "--free",
1088
+ "Enable Free safety mode (project directory operations auto-allowed, outside requires confirmation)",
1089
+ () => true
1090
+ ).option(
1086
1091
  "--smart",
1087
1092
  "Enable Smart safety mode (dangerous operations need confirmation)",
1088
1093
  () => true
@@ -1091,9 +1096,9 @@ ${commandList}`
1091
1096
  "Enable Strict safety mode (all write operations need confirmation)",
1092
1097
  () => true
1093
1098
  ).action(
1094
- async (identifier, { cwd: cwd2, enableArchitect, smart, strict, verbose }) => {
1099
+ async (identifier, { cwd: cwd2, enableArchitect, free, smart, strict, verbose }) => {
1095
1100
  const envSafetyMode = process.env.MINTO_SAFETY_MODE;
1096
- const safetyMode = envSafetyMode ? envSafetyMode : strict ? "strict" : smart ? "smart" : "yolo";
1101
+ const safetyMode = envSafetyMode ? envSafetyMode : strict ? "strict" : smart ? "smart" : free ? "free" : "yolo";
1097
1102
  const safeMode = safetyMode !== "yolo";
1098
1103
  await setup(cwd2, safeMode);
1099
1104
  assertMinVersion();
@@ -1137,6 +1142,7 @@ ${commandList}`
1137
1142
  {
1138
1143
  const { render } = await import("ink");
1139
1144
  const { REPL } = await import("../screens/REPL.js");
1145
+ await prepareTerminalForREPL();
1140
1146
  render(
1141
1147
  /* @__PURE__ */ React.createElement(
1142
1148
  REPL,