@within-7/minto 0.3.0 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/setup.js +40 -2
- package/dist/commands/setup.js.map +2 -2
- package/dist/components/SubagentProgress.js +10 -2
- package/dist/components/SubagentProgress.js.map +2 -2
- package/dist/constants/prompts.js +22 -1
- package/dist/constants/prompts.js.map +2 -2
- package/dist/entrypoints/cli.js +15 -9
- package/dist/entrypoints/cli.js.map +2 -2
- package/dist/permissions.js +121 -2
- package/dist/permissions.js.map +2 -2
- package/dist/screens/ResumeConversation.js +2 -0
- package/dist/screens/ResumeConversation.js.map +2 -2
- package/dist/services/taskStore.js +205 -0
- package/dist/services/taskStore.js.map +7 -0
- package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js +40 -3
- package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js.map +2 -2
- package/dist/tools/BashTool/BashTool.js +21 -4
- package/dist/tools/BashTool/BashTool.js.map +2 -2
- package/dist/tools/BashTool/prompt.js +6 -0
- package/dist/tools/BashTool/prompt.js.map +2 -2
- package/dist/tools/FileEditTool/FileEditTool.js +24 -9
- package/dist/tools/FileEditTool/FileEditTool.js.map +2 -2
- package/dist/tools/FileEditTool/prompt.js +4 -1
- package/dist/tools/FileEditTool/prompt.js.map +2 -2
- package/dist/tools/FileEditTool/utils.js +10 -4
- package/dist/tools/FileEditTool/utils.js.map +2 -2
- package/dist/tools/FileReadTool/FileReadTool.js +1 -1
- package/dist/tools/FileReadTool/FileReadTool.js.map +1 -1
- package/dist/tools/FileReadTool/prompt.js +16 -1
- package/dist/tools/FileReadTool/prompt.js.map +2 -2
- package/dist/tools/FileWriteTool/FileWriteTool.js +1 -1
- package/dist/tools/FileWriteTool/FileWriteTool.js.map +1 -1
- package/dist/tools/FileWriteTool/prompt.js +8 -1
- package/dist/tools/FileWriteTool/prompt.js.map +2 -2
- package/dist/tools/GlobTool/prompt.js +12 -1
- package/dist/tools/GlobTool/prompt.js.map +2 -2
- package/dist/tools/GrepTool/GrepTool.js +333 -65
- package/dist/tools/GrepTool/GrepTool.js.map +2 -2
- package/dist/tools/GrepTool/prompt.js +15 -8
- package/dist/tools/GrepTool/prompt.js.map +2 -2
- package/dist/tools/NotebookEditTool/NotebookEditTool.js +57 -45
- package/dist/tools/NotebookEditTool/NotebookEditTool.js.map +2 -2
- package/dist/tools/NotebookEditTool/prompt.js +1 -1
- package/dist/tools/NotebookEditTool/prompt.js.map +1 -1
- package/dist/tools/TaskCreateTool/TaskCreateTool.js +102 -0
- package/dist/tools/TaskCreateTool/TaskCreateTool.js.map +7 -0
- package/dist/tools/TaskCreateTool/prompt.js +47 -0
- package/dist/tools/TaskCreateTool/prompt.js.map +7 -0
- package/dist/tools/TaskGetTool/TaskGetTool.js +115 -0
- package/dist/tools/TaskGetTool/TaskGetTool.js.map +7 -0
- package/dist/tools/TaskGetTool/prompt.js +28 -0
- package/dist/tools/TaskGetTool/prompt.js.map +7 -0
- package/dist/tools/TaskListTool/TaskListTool.js +102 -0
- package/dist/tools/TaskListTool/TaskListTool.js.map +7 -0
- package/dist/tools/TaskListTool/prompt.js +27 -0
- package/dist/tools/TaskListTool/prompt.js.map +7 -0
- package/dist/tools/TaskStopTool/TaskStopTool.js +150 -0
- package/dist/tools/TaskStopTool/TaskStopTool.js.map +7 -0
- package/dist/tools/TaskStopTool/prompt.js +15 -0
- package/dist/tools/TaskStopTool/prompt.js.map +7 -0
- package/dist/tools/TaskTool/TaskTool.js +41 -1
- package/dist/tools/TaskTool/TaskTool.js.map +2 -2
- package/dist/tools/TaskUpdateTool/TaskUpdateTool.js +134 -0
- package/dist/tools/TaskUpdateTool/TaskUpdateTool.js.map +7 -0
- package/dist/tools/TaskUpdateTool/prompt.js +81 -0
- package/dist/tools/TaskUpdateTool/prompt.js.map +7 -0
- package/dist/tools/URLFetcherTool/prompt.js +1 -1
- package/dist/tools/URLFetcherTool/prompt.js.map +1 -1
- package/dist/tools.js +12 -0
- package/dist/tools.js.map +2 -2
- package/dist/utils/config.js.map +2 -2
- package/dist/utils/model.js +15 -2
- package/dist/utils/model.js.map +2 -2
- package/dist/utils/ripgrep.js +53 -1
- package/dist/utils/ripgrep.js.map +2 -2
- package/dist/utils/teamConfig.js +160 -0
- package/dist/utils/teamConfig.js.map +3 -3
- package/dist/utils/terminal.js +12 -0
- package/dist/utils/terminal.js.map +2 -2
- package/dist/utils/tooling/safeRender.js +13 -14
- package/dist/utils/tooling/safeRender.js.map +2 -2
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/package.json +20 -28
package/dist/commands/setup.js
CHANGED
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
loadTeamConfigFromFile,
|
|
8
8
|
applyTeamConfig,
|
|
9
9
|
addMarketplaces,
|
|
10
|
-
installPlugins
|
|
10
|
+
installPlugins,
|
|
11
|
+
installRemoteAgents,
|
|
12
|
+
installInlineAgents,
|
|
13
|
+
installTeamHooks
|
|
11
14
|
} from "../utils/teamConfig.js";
|
|
12
15
|
function SetupComponent({
|
|
13
16
|
source,
|
|
@@ -39,6 +42,33 @@ function SetupComponent({
|
|
|
39
42
|
const pluginResult = await installPlugins(teamConfig.plugins.install);
|
|
40
43
|
pluginsInstalled = pluginResult.installed;
|
|
41
44
|
}
|
|
45
|
+
let agentsInstalled = 0;
|
|
46
|
+
if (shouldInstallPlugins && teamConfig.agents) {
|
|
47
|
+
const remoteCount = teamConfig.agents.remoteAgents?.length || 0;
|
|
48
|
+
const inlineCount = teamConfig.agents.inlineAgents?.length || 0;
|
|
49
|
+
const totalAgents = remoteCount + inlineCount;
|
|
50
|
+
if (totalAgents > 0) {
|
|
51
|
+
setState({ stage: "installing-agents", total: totalAgents });
|
|
52
|
+
if (teamConfig.agents.remoteAgents) {
|
|
53
|
+
const remoteResult = await installRemoteAgents(
|
|
54
|
+
teamConfig.agents.remoteAgents
|
|
55
|
+
);
|
|
56
|
+
agentsInstalled += remoteResult.installed;
|
|
57
|
+
}
|
|
58
|
+
if (teamConfig.agents.inlineAgents) {
|
|
59
|
+
const inlineResult = await installInlineAgents(
|
|
60
|
+
teamConfig.agents.inlineAgents
|
|
61
|
+
);
|
|
62
|
+
agentsInstalled += inlineResult.installed;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let hooksInstalled = false;
|
|
67
|
+
if (shouldInstallPlugins && teamConfig.hooks) {
|
|
68
|
+
setState({ stage: "installing-hooks" });
|
|
69
|
+
const hookResult = await installTeamHooks(teamConfig.hooks);
|
|
70
|
+
hooksInstalled = hookResult.installed;
|
|
71
|
+
}
|
|
42
72
|
setState({
|
|
43
73
|
stage: "success",
|
|
44
74
|
modelsAdded: result.modelsAdded,
|
|
@@ -46,6 +76,8 @@ function SetupComponent({
|
|
|
46
76
|
settingsUpdated: result.settingsUpdated,
|
|
47
77
|
marketplacesAdded: marketplacesAdded > 0 ? marketplacesAdded : void 0,
|
|
48
78
|
pluginsInstalled: pluginsInstalled > 0 ? pluginsInstalled : void 0,
|
|
79
|
+
agentsInstalled: agentsInstalled > 0 ? agentsInstalled : void 0,
|
|
80
|
+
hooksInstalled: hooksInstalled || void 0,
|
|
49
81
|
instructions: teamConfig.postInstallInstructions
|
|
50
82
|
});
|
|
51
83
|
setTimeout(() => onDone("Configuration applied successfully"), 2e3);
|
|
@@ -72,10 +104,16 @@ function SetupComponent({
|
|
|
72
104
|
if (state.stage === "installing-plugins") {
|
|
73
105
|
return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Installing ", state.total, " plugin", state.total !== 1 ? "s" : "", "..."));
|
|
74
106
|
}
|
|
107
|
+
if (state.stage === "installing-agents") {
|
|
108
|
+
return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Installing ", state.total, " agent", state.total !== 1 ? "s" : "", "..."));
|
|
109
|
+
}
|
|
110
|
+
if (state.stage === "installing-hooks") {
|
|
111
|
+
return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, /* @__PURE__ */ React.createElement(SimpleSpinner, null), " Installing hooks..."));
|
|
112
|
+
}
|
|
75
113
|
if (state.stage === "error") {
|
|
76
114
|
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, { color: "red" }, "\u2717 Initialization failed"), /* @__PURE__ */ React.createElement(Text, { color: "red" }, state.message));
|
|
77
115
|
}
|
|
78
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingY: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "green", bold: true }, "\u2713 Configuration applied successfully!"), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingTop: 1 }, state.modelsAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.modelsAdded), " model profile", state.modelsAdded !== 1 ? "s" : ""), state.mcpServersAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.mcpServersAdded), " MCP server", state.mcpServersAdded !== 1 ? "s" : ""), state.settingsUpdated.length > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Updated ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.settingsUpdated.length), " ", "setting", state.settingsUpdated.length !== 1 ? "s" : "", ":", " ", state.settingsUpdated.join(", ")), state.marketplacesAdded !== void 0 && state.marketplacesAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.marketplacesAdded), " ", "marketplace", state.marketplacesAdded !== 1 ? "s" : ""), state.pluginsInstalled !== void 0 && state.pluginsInstalled > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Installed ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.pluginsInstalled), " ", "plugin", state.pluginsInstalled !== 1 ? "s" : "")), state.instructions && /* @__PURE__ */ React.createElement(
|
|
116
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingY: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "green", bold: true }, "\u2713 Configuration applied successfully!"), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingTop: 1 }, state.modelsAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.modelsAdded), " model profile", state.modelsAdded !== 1 ? "s" : ""), state.mcpServersAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.mcpServersAdded), " MCP server", state.mcpServersAdded !== 1 ? "s" : ""), state.settingsUpdated.length > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Updated ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.settingsUpdated.length), " ", "setting", state.settingsUpdated.length !== 1 ? "s" : "", ":", " ", state.settingsUpdated.join(", ")), state.marketplacesAdded !== void 0 && state.marketplacesAdded > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Added ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.marketplacesAdded), " ", "marketplace", state.marketplacesAdded !== 1 ? "s" : ""), state.pluginsInstalled !== void 0 && state.pluginsInstalled > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Installed ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.pluginsInstalled), " ", "plugin", state.pluginsInstalled !== 1 ? "s" : ""), state.agentsInstalled !== void 0 && state.agentsInstalled > 0 && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Installed ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, state.agentsInstalled), " agent", state.agentsInstalled !== 1 ? "s" : ""), state.hooksInstalled && /* @__PURE__ */ React.createElement(Text, null, "\u2022 Installed ", /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "hooks"), " configuration")), state.instructions && /* @__PURE__ */ React.createElement(
|
|
79
117
|
Box,
|
|
80
118
|
{
|
|
81
119
|
flexDirection: "column",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/commands/setup.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * Setup Command\n *\n * Initialize Minto with a team configuration from a remote URL or local file\n */\n\nimport React from 'react'\nimport { Text, Box } from 'ink'\nimport { SimpleSpinner } from '@components/Spinner'\nimport type { Command } from '@commands'\nimport { SEMANTIC_COLORS } from '@constants/colors'\nimport {\n fetchTeamConfig,\n loadTeamConfigFromFile,\n applyTeamConfig,\n addMarketplaces,\n installPlugins,\n type MergeStrategy,\n} from '@utils/teamConfig'\n\ntype SetupProps = {\n source: string // URL or file path\n strategy?: MergeStrategy\n installPlugins?: boolean\n onDone: (result?: string) => void\n}\n\ntype SetupState =\n | { stage: 'loading' }\n | { stage: 'applying' }\n | { stage: 'adding-marketplaces'; total: number }\n | { stage: 'installing-plugins'; total: number }\n | {\n stage: 'success'\n modelsAdded: number\n mcpServersAdded: number\n settingsUpdated: string[]\n marketplacesAdded?: number\n pluginsInstalled?: number\n instructions?: string\n }\n | { stage: 'error'; message: string }\n\nexport function SetupComponent({\n source,\n strategy = 'merge',\n installPlugins: shouldInstallPlugins = true,\n onDone,\n}: SetupProps) {\n const [state, setState] = React.useState<SetupState>({ stage: 'loading' })\n\n React.useEffect(() => {\n async function init() {\n try {\n // Step 1: Load configuration\n setState({ stage: 'loading' })\n\n const teamConfig =\n source.startsWith('http://') || source.startsWith('https://')\n ? await fetchTeamConfig(source)\n : loadTeamConfigFromFile(source)\n\n // Step 2: Apply configuration\n setState({ stage: 'applying' })\n\n const result = applyTeamConfig(teamConfig, strategy)\n\n // Step 3: Add marketplaces (if configured)\n let marketplacesAdded = 0\n if (shouldInstallPlugins && teamConfig.plugins?.marketplaces) {\n const marketplaceCount = teamConfig.plugins.marketplaces.length\n setState({ stage: 'adding-marketplaces', total: marketplaceCount })\n\n const marketplaceResult = await addMarketplaces(\n teamConfig.plugins.marketplaces,\n )\n\n marketplacesAdded = marketplaceResult.added\n }\n\n // Step 4: Install plugins (if configured)\n let pluginsInstalled = 0\n if (shouldInstallPlugins && teamConfig.plugins?.install) {\n const pluginCount = teamConfig.plugins.install.length\n setState({ stage: 'installing-plugins', total: pluginCount })\n\n const pluginResult = await installPlugins(teamConfig.plugins.install)\n\n pluginsInstalled = pluginResult.installed\n }\n\n // Success\n setState({\n stage: 'success',\n modelsAdded: result.modelsAdded,\n mcpServersAdded: result.mcpServersAdded,\n settingsUpdated: result.settingsUpdated,\n marketplacesAdded:\n marketplacesAdded > 0 ? marketplacesAdded : undefined,\n pluginsInstalled: pluginsInstalled > 0 ? pluginsInstalled : undefined,\n instructions: teamConfig.postInstallInstructions,\n })\n\n // Notify parent component\n setTimeout(() => onDone('Configuration applied successfully'), 2000)\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error)\n setState({\n stage: 'error',\n message: errorMessage,\n })\n\n // Notify parent component of error\n setTimeout(() => onDone(), 2000)\n }\n }\n\n init()\n }, [source, strategy, shouldInstallPlugins, onDone])\n\n if (state.stage === 'loading') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Loading configuration from {source}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'applying') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Applying configuration...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'adding-marketplaces') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Adding {state.total} marketplace\n {state.total !== 1 ? 's' : ''}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'installing-plugins') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Installing {state.total} plugin\n {state.total !== 1 ? 's' : ''}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'error') {\n return (\n <Box flexDirection=\"column\">\n <Text color=\"red\">\u2717 Initialization failed</Text>\n <Text color=\"red\">{state.message}</Text>\n </Box>\n )\n }\n\n // Success state\n return (\n <Box flexDirection=\"column\" paddingY={1}>\n <Text color=\"green\" bold>\n \u2713 Configuration applied successfully!\n </Text>\n\n <Box flexDirection=\"column\" paddingTop={1}>\n {state.modelsAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.modelsAdded}</Text> model profile\n {state.modelsAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.mcpServersAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.mcpServersAdded}</Text> MCP server\n {state.mcpServersAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.settingsUpdated.length > 0 && (\n <Text>\n \u2022 Updated <Text color=\"cyan\">{state.settingsUpdated.length}</Text>{' '}\n setting\n {state.settingsUpdated.length !== 1 ? 's' : ''}:{' '}\n {state.settingsUpdated.join(', ')}\n </Text>\n )}\n\n {state.marketplacesAdded !== undefined &&\n state.marketplacesAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.marketplacesAdded}</Text>{' '}\n marketplace\n {state.marketplacesAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.pluginsInstalled !== undefined && state.pluginsInstalled > 0 && (\n <Text>\n \u2022 Installed <Text color=\"cyan\">{state.pluginsInstalled}</Text>{' '}\n plugin\n {state.pluginsInstalled !== 1 ? 's' : ''}\n </Text>\n )}\n </Box>\n\n {state.instructions && (\n <Box\n flexDirection=\"column\"\n paddingTop={1}\n borderStyle=\"round\"\n borderColor=\"yellow\"\n paddingX={1}\n >\n <Text color=\"yellow\" bold>\n \uD83D\uDCCB Next Steps:\n </Text>\n <Text>{state.instructions}</Text>\n </Box>\n )}\n\n <Box paddingTop={1}>\n <Text color={SEMANTIC_COLORS.dim}>\n Run <Text color=\"cyan\">minto</Text> to start using your configured\n setup.\n </Text>\n </Box>\n </Box>\n )\n}\n\n// Command definition\nconst command = {\n type: 'local-jsx',\n name: 'setup',\n description: 'Initialize Minto with team configuration from a URL or file',\n isEnabled: true,\n isHidden: false,\n userFacingName() {\n return 'setup'\n },\n async call(onDone, _context) {\n // Parse arguments\n const args = process.argv.slice(2)\n const fromIndex = args.findIndex(arg => arg === '--from')\n const strategyIndex = args.findIndex(arg => arg === '--strategy')\n const noPluginsFlag = args.includes('--no-plugins')\n\n if (fromIndex === -1 || !args[fromIndex + 1]) {\n onDone()\n return (\n <Box flexDirection=\"column\">\n <Text color=\"red\">Error: --from parameter is required</Text>\n <Text>\n Usage: minto setup --from <url|path> [--strategy\n <merge|replace|skip-existing>] [--no-plugins]\n </Text>\n </Box>\n )\n }\n\n const source = args[fromIndex + 1]\n const strategy: MergeStrategy =\n strategyIndex !== -1 && args[strategyIndex + 1]\n ? (args[strategyIndex + 1] as MergeStrategy)\n : 'merge'\n const shouldInstallPlugins = !noPluginsFlag\n\n return (\n <SetupComponent\n source={source}\n strategy={strategy}\n installPlugins={shouldInstallPlugins}\n onDone={onDone}\n />\n )\n },\n} satisfies Command\n\nexport default command\n"],
|
|
5
|
-
"mappings": "AAMA,OAAO,WAAW;AAClB,SAAS,MAAM,WAAW;AAC1B,SAAS,qBAAqB;AAE9B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;
|
|
4
|
+
"sourcesContent": ["/**\n * Setup Command\n *\n * Initialize Minto with a team configuration from a remote URL or local file\n */\n\nimport React from 'react'\nimport { Text, Box } from 'ink'\nimport { SimpleSpinner } from '@components/Spinner'\nimport type { Command } from '@commands'\nimport { SEMANTIC_COLORS } from '@constants/colors'\nimport {\n fetchTeamConfig,\n loadTeamConfigFromFile,\n applyTeamConfig,\n addMarketplaces,\n installPlugins,\n installRemoteAgents,\n installInlineAgents,\n installTeamHooks,\n type MergeStrategy,\n} from '@utils/teamConfig'\n\ntype SetupProps = {\n source: string // URL or file path\n strategy?: MergeStrategy\n installPlugins?: boolean\n onDone: (result?: string) => void\n}\n\ntype SetupState =\n | { stage: 'loading' }\n | { stage: 'applying' }\n | { stage: 'adding-marketplaces'; total: number }\n | { stage: 'installing-plugins'; total: number }\n | { stage: 'installing-agents'; total: number }\n | { stage: 'installing-hooks' }\n | {\n stage: 'success'\n modelsAdded: number\n mcpServersAdded: number\n settingsUpdated: string[]\n marketplacesAdded?: number\n pluginsInstalled?: number\n agentsInstalled?: number\n hooksInstalled?: boolean\n instructions?: string\n }\n | { stage: 'error'; message: string }\n\nexport function SetupComponent({\n source,\n strategy = 'merge',\n installPlugins: shouldInstallPlugins = true,\n onDone,\n}: SetupProps) {\n const [state, setState] = React.useState<SetupState>({ stage: 'loading' })\n\n React.useEffect(() => {\n async function init() {\n try {\n // Step 1: Load configuration\n setState({ stage: 'loading' })\n\n const teamConfig =\n source.startsWith('http://') || source.startsWith('https://')\n ? await fetchTeamConfig(source)\n : loadTeamConfigFromFile(source)\n\n // Step 2: Apply configuration\n setState({ stage: 'applying' })\n\n const result = applyTeamConfig(teamConfig, strategy)\n\n // Step 3: Add marketplaces (if configured)\n let marketplacesAdded = 0\n if (shouldInstallPlugins && teamConfig.plugins?.marketplaces) {\n const marketplaceCount = teamConfig.plugins.marketplaces.length\n setState({ stage: 'adding-marketplaces', total: marketplaceCount })\n\n const marketplaceResult = await addMarketplaces(\n teamConfig.plugins.marketplaces,\n )\n\n marketplacesAdded = marketplaceResult.added\n }\n\n // Step 4: Install plugins (if configured)\n let pluginsInstalled = 0\n if (shouldInstallPlugins && teamConfig.plugins?.install) {\n const pluginCount = teamConfig.plugins.install.length\n setState({ stage: 'installing-plugins', total: pluginCount })\n\n const pluginResult = await installPlugins(teamConfig.plugins.install)\n\n pluginsInstalled = pluginResult.installed\n }\n\n // Step 5: Install agents (if configured)\n let agentsInstalled = 0\n if (shouldInstallPlugins && teamConfig.agents) {\n const remoteCount = teamConfig.agents.remoteAgents?.length || 0\n const inlineCount = teamConfig.agents.inlineAgents?.length || 0\n const totalAgents = remoteCount + inlineCount\n\n if (totalAgents > 0) {\n setState({ stage: 'installing-agents', total: totalAgents })\n\n if (teamConfig.agents.remoteAgents) {\n const remoteResult = await installRemoteAgents(\n teamConfig.agents.remoteAgents,\n )\n agentsInstalled += remoteResult.installed\n }\n\n if (teamConfig.agents.inlineAgents) {\n const inlineResult = await installInlineAgents(\n teamConfig.agents.inlineAgents,\n )\n agentsInstalled += inlineResult.installed\n }\n }\n }\n\n // Step 6: Install hooks (if configured)\n let hooksInstalled = false\n if (shouldInstallPlugins && teamConfig.hooks) {\n setState({ stage: 'installing-hooks' })\n const hookResult = await installTeamHooks(teamConfig.hooks)\n hooksInstalled = hookResult.installed\n }\n\n // Success\n setState({\n stage: 'success',\n modelsAdded: result.modelsAdded,\n mcpServersAdded: result.mcpServersAdded,\n settingsUpdated: result.settingsUpdated,\n marketplacesAdded:\n marketplacesAdded > 0 ? marketplacesAdded : undefined,\n pluginsInstalled: pluginsInstalled > 0 ? pluginsInstalled : undefined,\n agentsInstalled: agentsInstalled > 0 ? agentsInstalled : undefined,\n hooksInstalled: hooksInstalled || undefined,\n instructions: teamConfig.postInstallInstructions,\n })\n\n // Notify parent component\n setTimeout(() => onDone('Configuration applied successfully'), 2000)\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error)\n setState({\n stage: 'error',\n message: errorMessage,\n })\n\n // Notify parent component of error\n setTimeout(() => onDone(), 2000)\n }\n }\n\n init()\n }, [source, strategy, shouldInstallPlugins, onDone])\n\n if (state.stage === 'loading') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Loading configuration from {source}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'applying') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Applying configuration...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'adding-marketplaces') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Adding {state.total} marketplace\n {state.total !== 1 ? 's' : ''}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'installing-plugins') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Installing {state.total} plugin\n {state.total !== 1 ? 's' : ''}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'installing-agents') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Installing {state.total} agent\n {state.total !== 1 ? 's' : ''}...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'installing-hooks') {\n return (\n <Box>\n <Text color=\"cyan\">\n <SimpleSpinner /> Installing hooks...\n </Text>\n </Box>\n )\n }\n\n if (state.stage === 'error') {\n return (\n <Box flexDirection=\"column\">\n <Text color=\"red\">\u2717 Initialization failed</Text>\n <Text color=\"red\">{state.message}</Text>\n </Box>\n )\n }\n\n // Success state\n return (\n <Box flexDirection=\"column\" paddingY={1}>\n <Text color=\"green\" bold>\n \u2713 Configuration applied successfully!\n </Text>\n\n <Box flexDirection=\"column\" paddingTop={1}>\n {state.modelsAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.modelsAdded}</Text> model profile\n {state.modelsAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.mcpServersAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.mcpServersAdded}</Text> MCP server\n {state.mcpServersAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.settingsUpdated.length > 0 && (\n <Text>\n \u2022 Updated <Text color=\"cyan\">{state.settingsUpdated.length}</Text>{' '}\n setting\n {state.settingsUpdated.length !== 1 ? 's' : ''}:{' '}\n {state.settingsUpdated.join(', ')}\n </Text>\n )}\n\n {state.marketplacesAdded !== undefined &&\n state.marketplacesAdded > 0 && (\n <Text>\n \u2022 Added <Text color=\"cyan\">{state.marketplacesAdded}</Text>{' '}\n marketplace\n {state.marketplacesAdded !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.pluginsInstalled !== undefined && state.pluginsInstalled > 0 && (\n <Text>\n \u2022 Installed <Text color=\"cyan\">{state.pluginsInstalled}</Text>{' '}\n plugin\n {state.pluginsInstalled !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.agentsInstalled !== undefined && state.agentsInstalled > 0 && (\n <Text>\n \u2022 Installed <Text color=\"cyan\">{state.agentsInstalled}</Text> agent\n {state.agentsInstalled !== 1 ? 's' : ''}\n </Text>\n )}\n\n {state.hooksInstalled && (\n <Text>\n \u2022 Installed <Text color=\"cyan\">hooks</Text> configuration\n </Text>\n )}\n </Box>\n\n {state.instructions && (\n <Box\n flexDirection=\"column\"\n paddingTop={1}\n borderStyle=\"round\"\n borderColor=\"yellow\"\n paddingX={1}\n >\n <Text color=\"yellow\" bold>\n \uD83D\uDCCB Next Steps:\n </Text>\n <Text>{state.instructions}</Text>\n </Box>\n )}\n\n <Box paddingTop={1}>\n <Text color={SEMANTIC_COLORS.dim}>\n Run <Text color=\"cyan\">minto</Text> to start using your configured\n setup.\n </Text>\n </Box>\n </Box>\n )\n}\n\n// Command definition\nconst command = {\n type: 'local-jsx',\n name: 'setup',\n description: 'Initialize Minto with team configuration from a URL or file',\n isEnabled: true,\n isHidden: false,\n userFacingName() {\n return 'setup'\n },\n async call(onDone, _context) {\n // Parse arguments\n const args = process.argv.slice(2)\n const fromIndex = args.findIndex(arg => arg === '--from')\n const strategyIndex = args.findIndex(arg => arg === '--strategy')\n const noPluginsFlag = args.includes('--no-plugins')\n\n if (fromIndex === -1 || !args[fromIndex + 1]) {\n onDone()\n return (\n <Box flexDirection=\"column\">\n <Text color=\"red\">Error: --from parameter is required</Text>\n <Text>\n Usage: minto setup --from <url|path> [--strategy\n <merge|replace|skip-existing>] [--no-plugins]\n </Text>\n </Box>\n )\n }\n\n const source = args[fromIndex + 1]\n const strategy: MergeStrategy =\n strategyIndex !== -1 && args[strategyIndex + 1]\n ? (args[strategyIndex + 1] as MergeStrategy)\n : 'merge'\n const shouldInstallPlugins = !noPluginsFlag\n\n return (\n <SetupComponent\n source={source}\n strategy={strategy}\n installPlugins={shouldInstallPlugins}\n onDone={onDone}\n />\n )\n },\n} satisfies Command\n\nexport default command\n"],
|
|
5
|
+
"mappings": "AAMA,OAAO,WAAW;AAClB,SAAS,MAAM,WAAW;AAC1B,SAAS,qBAAqB;AAE9B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AA6BA,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA,WAAW;AAAA,EACX,gBAAgB,uBAAuB;AAAA,EACvC;AACF,GAAe;AACb,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAqB,EAAE,OAAO,UAAU,CAAC;AAEzE,QAAM,UAAU,MAAM;AACpB,mBAAe,OAAO;AACpB,UAAI;AAEF,iBAAS,EAAE,OAAO,UAAU,CAAC;AAE7B,cAAM,aACJ,OAAO,WAAW,SAAS,KAAK,OAAO,WAAW,UAAU,IACxD,MAAM,gBAAgB,MAAM,IAC5B,uBAAuB,MAAM;AAGnC,iBAAS,EAAE,OAAO,WAAW,CAAC;AAE9B,cAAM,SAAS,gBAAgB,YAAY,QAAQ;AAGnD,YAAI,oBAAoB;AACxB,YAAI,wBAAwB,WAAW,SAAS,cAAc;AAC5D,gBAAM,mBAAmB,WAAW,QAAQ,aAAa;AACzD,mBAAS,EAAE,OAAO,uBAAuB,OAAO,iBAAiB,CAAC;AAElE,gBAAM,oBAAoB,MAAM;AAAA,YAC9B,WAAW,QAAQ;AAAA,UACrB;AAEA,8BAAoB,kBAAkB;AAAA,QACxC;AAGA,YAAI,mBAAmB;AACvB,YAAI,wBAAwB,WAAW,SAAS,SAAS;AACvD,gBAAM,cAAc,WAAW,QAAQ,QAAQ;A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
|
7
7
|
}
|
|
@@ -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
|
|
56
|
-
|
|
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,CAAC;AAAA,EACT,UAAU;AAAA,EACV,QAAQ;AACV,GAA0B;AACxB,QAAM,QAAQ,SAAS;AACvB,QAAM,EAAE,SAAS,UAAU,QAAQ,UAAU,WAAW,WAAW,IACjE;AAGF,QAAM,aAAa,mBAAmB,SAAS,EAAE;AACjD,QAAM,aAAa,YAAY,oBAAoB;AAGnD,QAAM,QAAQ,cAAc,YAAY,KAAK;AAG7C,QAAM,YACJ,WAAW,kBAAkB,WAAW,aAAa,WAAW;AAGlE,QAAM,eAAe,OAAO,QAAQ,SAAS;AAC7C,QAAM,EAAE,YAAY,IAAI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eAAe;AAC5B,YAAI,QAAQ,SAAS,eAAe;AAClC,gBAAM,gBAAgB,MAAM,QAAQ,QAAQ,OAAO,IAC/C,QAAQ,QAAQ,KAAK,OAAK,EAAE,SAAS,MAAM,GAAG,OAC9C,OAAO,QAAQ,YAAY,WACzB,QAAQ,UACR;AAEN,cAAI,iBAAiB,cAAc,KAAK,GAAG;
|
|
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 // 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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IACf,KAAK;AACH,aAAO,MAAM;AAAA,EACjB;AACF;AAKA,SAAS,qBACP,SACA,OACA,OACA,SACA;AAEA,SACE,oCAAC,OAAI,eAAc,UAAS,YAAY,KACtC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,UAAU,CAAC,OAAO;AAAA,MAClB,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,mBAAmB,oBAAI,IAAI;AAAA,MAC3B,sBAAsB,oBAAI,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...".
|
|
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,
|
|
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
|
}
|
package/dist/entrypoints/cli.js
CHANGED
|
@@ -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
|
-
|
|
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,
|