@within-7/minto 0.1.5 → 0.1.7
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/agents/AgentsCommand.js +2342 -0
- package/dist/commands/agents/AgentsCommand.js.map +7 -0
- package/dist/commands/agents/constants.js +58 -0
- package/dist/commands/agents/constants.js.map +7 -0
- package/dist/commands/agents/index.js +37 -0
- package/dist/commands/agents/index.js.map +7 -0
- package/dist/commands/agents/types.js +10 -0
- package/dist/commands/agents/types.js.map +7 -0
- package/dist/commands/agents/utils/fileOperations.js +185 -0
- package/dist/commands/agents/utils/fileOperations.js.map +7 -0
- package/dist/commands/agents/utils/index.js +21 -0
- package/dist/commands/agents/utils/index.js.map +7 -0
- package/dist/commands/bug.js +2 -2
- package/dist/commands/bug.js.map +2 -2
- package/dist/commands/compact.js +5 -5
- package/dist/commands/compact.js.map +2 -2
- package/dist/commands/ctx_viz.js +55 -22
- package/dist/commands/ctx_viz.js.map +2 -2
- package/dist/commands/mcp-interactive.js +11 -11
- package/dist/commands/mcp-interactive.js.map +2 -2
- package/dist/commands/model.js +94 -32
- package/dist/commands/model.js.map +3 -3
- package/dist/commands/plugin/AddMarketplaceForm.js +49 -21
- package/dist/commands/plugin/AddMarketplaceForm.js.map +2 -2
- package/dist/commands/plugin/ConfirmDialog.js +38 -26
- package/dist/commands/plugin/ConfirmDialog.js.map +2 -2
- package/dist/commands/plugin/InstalledPluginsByMarketplace.js +24 -8
- package/dist/commands/plugin/InstalledPluginsByMarketplace.js.map +2 -2
- package/dist/commands/plugin/InstalledPluginsManager.js +3 -1
- package/dist/commands/plugin/InstalledPluginsManager.js.map +2 -2
- package/dist/commands/plugin/MainMenu.js +16 -7
- package/dist/commands/plugin/MainMenu.js.map +2 -2
- package/dist/commands/plugin/MarketplaceManager.js +84 -39
- package/dist/commands/plugin/MarketplaceManager.js.map +2 -2
- package/dist/commands/plugin/MarketplaceSelector.js +7 -3
- package/dist/commands/plugin/MarketplaceSelector.js.map +2 -2
- package/dist/commands/plugin/PlaceholderScreen.js +16 -2
- package/dist/commands/plugin/PlaceholderScreen.js.map +2 -2
- package/dist/commands/plugin/PluginBrowser.js +4 -2
- package/dist/commands/plugin/PluginBrowser.js.map +2 -2
- package/dist/commands/plugin/PluginDetailsInstall.js +12 -6
- package/dist/commands/plugin/PluginDetailsInstall.js.map +2 -2
- package/dist/commands/plugin/PluginDetailsManage.js +14 -5
- package/dist/commands/plugin/PluginDetailsManage.js.map +2 -2
- package/dist/commands/plugin/example-usage.js.map +2 -2
- package/dist/commands/plugin/utils.js.map +2 -2
- package/dist/commands/plugin.js +226 -46
- package/dist/commands/plugin.js.map +2 -2
- package/dist/commands/refreshCommands.js +6 -3
- package/dist/commands/refreshCommands.js.map +2 -2
- package/dist/commands/resume.js +2 -1
- package/dist/commands/resume.js.map +2 -2
- package/dist/commands/setup.js +19 -5
- package/dist/commands/setup.js.map +2 -2
- package/dist/commands/terminalSetup.js +2 -2
- package/dist/commands/terminalSetup.js.map +1 -1
- package/dist/commands.js +14 -30
- package/dist/commands.js.map +2 -2
- package/dist/components/AskUserQuestionDialog/AskUserQuestionDialog.js.map +2 -2
- package/dist/components/AskUserQuestionDialog/QuestionView.js +10 -1
- package/dist/components/AskUserQuestionDialog/QuestionView.js.map +2 -2
- package/dist/components/BackgroundTasksPanel.js +5 -1
- package/dist/components/BackgroundTasksPanel.js.map +2 -2
- package/dist/components/Config.js +17 -4
- package/dist/components/Config.js.map +2 -2
- package/dist/components/ConsoleOAuthFlow.js.map +2 -2
- package/dist/components/CustomSelect/select-option.js +4 -1
- package/dist/components/CustomSelect/select-option.js.map +2 -2
- package/dist/components/Help.js +6 -8
- package/dist/components/Help.js.map +2 -2
- package/dist/components/Logo.js +1 -1
- package/dist/components/Logo.js.map +2 -2
- package/dist/components/ModelListManager.js.map +2 -2
- package/dist/components/ModelSelector/ModelSelector.js +2030 -0
- package/dist/components/ModelSelector/ModelSelector.js.map +7 -0
- package/dist/components/ModelSelector/ScreenContainer.js +27 -0
- package/dist/components/ModelSelector/ScreenContainer.js.map +7 -0
- package/dist/components/ModelSelector/constants.js +37 -0
- package/dist/components/ModelSelector/constants.js.map +7 -0
- package/dist/components/ModelSelector/hooks/index.js +5 -0
- package/dist/components/ModelSelector/hooks/index.js.map +7 -0
- package/dist/components/ModelSelector/hooks/useEscapeNavigation.js +21 -0
- package/dist/components/ModelSelector/hooks/useEscapeNavigation.js.map +7 -0
- package/dist/components/ModelSelector/index.js +17 -0
- package/dist/components/ModelSelector/index.js.map +7 -0
- package/dist/components/ModelSelector/types.js +1 -0
- package/dist/components/ModelSelector/types.js.map +7 -0
- package/dist/components/PressEnterToContinue.js +1 -1
- package/dist/components/PressEnterToContinue.js.map +2 -2
- package/dist/components/ProjectOnboarding.js +1 -1
- package/dist/components/ProjectOnboarding.js.map +2 -2
- package/dist/components/PromptInput.js +88 -37
- package/dist/components/PromptInput.js.map +2 -2
- package/dist/components/QuitSummary.js +17 -10
- package/dist/components/QuitSummary.js.map +2 -2
- package/dist/components/SentryErrorBoundary.js.map +2 -2
- package/dist/components/StreamingBashOutput.js.map +2 -2
- package/dist/components/StructuredDiff.js.map +2 -2
- package/dist/components/SubagentProgress.js.map +2 -2
- package/dist/components/TaskCard.js.map +2 -2
- package/dist/components/TextInput.js.map +1 -1
- package/dist/components/TodoItem.js.map +1 -1
- package/dist/components/binary-feedback/BinaryFeedbackOption.js +1 -3
- package/dist/components/binary-feedback/BinaryFeedbackOption.js.map +2 -2
- package/dist/components/messages/AssistantLocalCommandOutputMessage.js.map +1 -1
- package/dist/components/messages/AssistantToolUseMessage.js +3 -1
- package/dist/components/messages/AssistantToolUseMessage.js.map +2 -2
- package/dist/components/messages/TaskProgressMessage.js.map +2 -2
- package/dist/components/messages/TaskToolMessage.js.map +2 -2
- package/dist/components/messages/UserToolResultMessage/utils.js.map +2 -2
- package/dist/components/permissions/FileEditPermissionRequest/FileEditToolDiff.js.map +2 -2
- package/dist/components/permissions/FileWritePermissionRequest/FileWriteToolDiff.js.map +2 -2
- package/dist/components/permissions/hooks.js.map +2 -2
- package/dist/constants/modelCapabilities.js +1 -1
- package/dist/constants/modelCapabilities.js.map +2 -2
- package/dist/constants/prompts.js.map +1 -1
- package/dist/constants/timing.js +34 -0
- package/dist/constants/timing.js.map +7 -0
- package/dist/entrypoints/cli.js +128 -33
- package/dist/entrypoints/cli.js.map +3 -3
- package/dist/entrypoints/mcp.js +13 -18
- package/dist/entrypoints/mcp.js.map +2 -2
- package/dist/hooks/useCanUseTool.js.map +2 -2
- package/dist/hooks/useCancelRequest.js.map +1 -1
- package/dist/hooks/useHistorySearch.js.map +2 -2
- package/dist/hooks/useLogStartupTime.js.map +2 -2
- package/dist/hooks/usePermissionRequestLogging.js.map +2 -2
- package/dist/hooks/useTextInput.js.map +1 -1
- package/dist/hooks/useUnifiedCompletion.js +493 -394
- package/dist/hooks/useUnifiedCompletion.js.map +2 -2
- package/dist/index.js.map +2 -2
- package/dist/permissions.js +4 -7
- package/dist/permissions.js.map +2 -2
- package/dist/query.js +6 -1
- package/dist/query.js.map +2 -2
- package/dist/screens/REPL.js +72 -36
- package/dist/screens/REPL.js.map +2 -2
- package/dist/screens/ResumeConversation.js +2 -1
- package/dist/screens/ResumeConversation.js.map +2 -2
- package/dist/services/adapters/base.js.map +2 -2
- package/dist/services/adapters/chatCompletions.js.map +2 -2
- package/dist/services/adapters/responsesAPI.js +3 -1
- package/dist/services/adapters/responsesAPI.js.map +2 -2
- package/dist/services/claude.js +327 -328
- package/dist/services/claude.js.map +2 -2
- package/dist/services/customCommands.js +6 -1
- package/dist/services/customCommands.js.map +2 -2
- package/dist/services/fileFreshness.js.map +2 -2
- package/dist/services/gpt5ConnectionTest.js +20 -7
- package/dist/services/gpt5ConnectionTest.js.map +2 -2
- package/dist/services/hookExecutor.js +6 -12
- package/dist/services/hookExecutor.js.map +2 -2
- package/dist/services/mcpClient.js +29 -2
- package/dist/services/mcpClient.js.map +2 -2
- package/dist/services/mentionProcessor.js +23 -10
- package/dist/services/mentionProcessor.js.map +2 -2
- package/dist/services/modelAdapterFactory.js.map +2 -2
- package/dist/services/oauth.js.map +2 -2
- package/dist/services/openai.js +109 -72
- package/dist/services/openai.js.map +3 -3
- package/dist/services/responseStateManager.js.map +2 -2
- package/dist/services/systemReminder.js.map +2 -2
- package/dist/tools/ArchitectTool/ArchitectTool.js +10 -9
- package/dist/tools/ArchitectTool/ArchitectTool.js.map +2 -2
- package/dist/tools/AskExpertModelTool/AskExpertModelTool.js +14 -8
- package/dist/tools/AskExpertModelTool/AskExpertModelTool.js.map +2 -2
- package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js +8 -1
- package/dist/tools/AskUserQuestionTool/AskUserQuestionTool.js.map +2 -2
- package/dist/tools/BashOutputTool/BashOutputTool.js.map +2 -2
- package/dist/tools/BashTool/BashTool.js.map +2 -2
- package/dist/tools/FileReadTool/FileReadTool.js +23 -4
- package/dist/tools/FileReadTool/FileReadTool.js.map +2 -2
- package/dist/tools/FileWriteTool/FileWriteTool.js.map +2 -2
- package/dist/tools/GlobTool/GlobTool.js +11 -2
- package/dist/tools/GlobTool/GlobTool.js.map +2 -2
- package/dist/tools/GrepTool/GrepTool.js +7 -5
- package/dist/tools/GrepTool/GrepTool.js.map +2 -2
- package/dist/tools/MCPTool/MCPTool.js +11 -12
- package/dist/tools/MCPTool/MCPTool.js.map +2 -2
- package/dist/tools/MultiEditTool/MultiEditTool.js +4 -1
- package/dist/tools/MultiEditTool/MultiEditTool.js.map +2 -2
- package/dist/tools/NotebookReadTool/NotebookReadTool.js +11 -5
- package/dist/tools/NotebookReadTool/NotebookReadTool.js.map +2 -2
- package/dist/tools/SkillTool/SkillTool.js +18 -6
- package/dist/tools/SkillTool/SkillTool.js.map +2 -2
- package/dist/tools/TaskTool/TaskTool.js +37 -51
- package/dist/tools/TaskTool/TaskTool.js.map +2 -2
- package/dist/tools/TaskTool/prompt.js.map +2 -2
- package/dist/tools/ThinkTool/ThinkTool.js +6 -1
- package/dist/tools/ThinkTool/ThinkTool.js.map +2 -2
- package/dist/tools/TodoWriteTool/TodoWriteTool.js +29 -5
- package/dist/tools/TodoWriteTool/TodoWriteTool.js.map +2 -2
- package/dist/tools/URLFetcherTool/URLFetcherTool.js +5 -2
- package/dist/tools/URLFetcherTool/URLFetcherTool.js.map +2 -2
- package/dist/tools/URLFetcherTool/cache.js +6 -3
- package/dist/tools/URLFetcherTool/cache.js.map +2 -2
- package/dist/tools/URLFetcherTool/htmlToMarkdown.js +3 -1
- package/dist/tools/URLFetcherTool/htmlToMarkdown.js.map +2 -2
- package/dist/tools/WebSearchTool/WebSearchTool.js +6 -1
- package/dist/tools/WebSearchTool/WebSearchTool.js.map +2 -2
- package/dist/tools/WebSearchTool/prompt.js.map +2 -2
- package/dist/tools/WebSearchTool/searchProviders.js +15 -6
- package/dist/tools/WebSearchTool/searchProviders.js.map +2 -2
- package/dist/tools.js +4 -1
- package/dist/tools.js.map +2 -2
- package/dist/types/core.js +1 -0
- package/dist/types/core.js.map +7 -0
- package/dist/types/hooks.js +1 -4
- package/dist/types/hooks.js.map +2 -2
- package/dist/types/marketplace.js +8 -2
- package/dist/types/marketplace.js.map +2 -2
- package/dist/types/plugin.js +9 -6
- package/dist/types/plugin.js.map +2 -2
- package/dist/utils/BackgroundShellManager.js +76 -10
- package/dist/utils/BackgroundShellManager.js.map +2 -2
- package/dist/utils/PersistentShell.js +7 -2
- package/dist/utils/PersistentShell.js.map +2 -2
- package/dist/utils/advancedFuzzyMatcher.js +4 -1
- package/dist/utils/advancedFuzzyMatcher.js.map +2 -2
- package/dist/utils/agentLoader.js +69 -35
- package/dist/utils/agentLoader.js.map +2 -2
- package/dist/utils/agentStorage.js.map +2 -2
- package/dist/utils/async.js +163 -0
- package/dist/utils/async.js.map +7 -0
- package/dist/utils/autoUpdater.js +8 -2
- package/dist/utils/autoUpdater.js.map +2 -2
- package/dist/utils/commands.js +23 -11
- package/dist/utils/commands.js.map +2 -2
- package/dist/utils/commonUnixCommands.js +3 -1
- package/dist/utils/commonUnixCommands.js.map +2 -2
- package/dist/utils/compressionMode.js.map +2 -2
- package/dist/utils/config.js +30 -14
- package/dist/utils/config.js.map +2 -2
- package/dist/utils/debugLogger.js.map +2 -2
- package/dist/utils/env.js.map +2 -2
- package/dist/utils/envConfig.js +82 -0
- package/dist/utils/envConfig.js.map +7 -0
- package/dist/utils/errorHandling.js +89 -0
- package/dist/utils/errorHandling.js.map +7 -0
- package/dist/utils/expertChatStorage.js.map +2 -2
- package/dist/utils/fuzzyMatcher.js +13 -7
- package/dist/utils/fuzzyMatcher.js.map +2 -2
- package/dist/utils/hookManager.js +14 -4
- package/dist/utils/hookManager.js.map +2 -2
- package/dist/utils/log.js.map +2 -2
- package/dist/utils/marketplaceManager.js +44 -9
- package/dist/utils/marketplaceManager.js.map +2 -2
- package/dist/utils/messageContextManager.js.map +1 -1
- package/dist/utils/messages.js +6 -3
- package/dist/utils/messages.js.map +2 -2
- package/dist/utils/model.js +3 -1
- package/dist/utils/model.js.map +2 -2
- package/dist/utils/pluginInstaller.js +3 -15
- package/dist/utils/pluginInstaller.js.map +2 -2
- package/dist/utils/pluginLoader.js +41 -13
- package/dist/utils/pluginLoader.js.map +2 -2
- package/dist/utils/pluginRegistry.js.map +2 -2
- package/dist/utils/pluginValidator.js +71 -49
- package/dist/utils/pluginValidator.js.map +2 -2
- package/dist/utils/ptyCompat.js.map +2 -2
- package/dist/utils/roundConverter.js.map +2 -2
- package/dist/utils/secureFile.js +43 -14
- package/dist/utils/secureFile.js.map +2 -2
- package/dist/utils/sessionState.js.map +2 -2
- package/dist/utils/skillLoader.js.map +2 -2
- package/dist/utils/teamConfig.js +7 -4
- package/dist/utils/teamConfig.js.map +2 -2
- package/dist/utils/theme.js.map +2 -2
- package/dist/utils/thinking.js.map +2 -2
- package/dist/utils/unaryLogging.js.map +2 -2
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/package.json +5 -5
|
@@ -43,6 +43,9 @@ const URLFetcherTool = {
|
|
|
43
43
|
return /* @__PURE__ */ React.createElement(FallbackToolUseRejectedMessage, null);
|
|
44
44
|
},
|
|
45
45
|
renderToolResultMessage(output) {
|
|
46
|
+
if (!output) {
|
|
47
|
+
return /* @__PURE__ */ React.createElement(Box, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0URL fetch completed")));
|
|
48
|
+
}
|
|
46
49
|
const statusText = output.fromCache ? "from cache" : "fetched";
|
|
47
50
|
return /* @__PURE__ */ React.createElement(Box, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0Content "), /* @__PURE__ */ React.createElement(Text, { bold: true }, statusText, " "), /* @__PURE__ */ React.createElement(Text, null, "and analyzed")), /* @__PURE__ */ React.createElement(Cost, { costUSD: 0, durationMs: 0, debug: false }));
|
|
48
51
|
},
|
|
@@ -68,10 +71,10 @@ const URLFetcherTool = {
|
|
|
68
71
|
method: "GET",
|
|
69
72
|
headers: {
|
|
70
73
|
"User-Agent": "Mozilla/5.0 (compatible; URLFetcher/1.0)",
|
|
71
|
-
|
|
74
|
+
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
72
75
|
"Accept-Language": "en-US,en;q=0.5",
|
|
73
76
|
"Accept-Encoding": "gzip, deflate",
|
|
74
|
-
|
|
77
|
+
Connection: "keep-alive",
|
|
75
78
|
"Upgrade-Insecure-Requests": "1"
|
|
76
79
|
},
|
|
77
80
|
signal: abortController.signal,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/URLFetcherTool/URLFetcherTool.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport fetch from 'node-fetch'\nimport { Cost } from '@components/Cost'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool, ToolUseContext } from '@tool'\nimport { DESCRIPTION, TOOL_NAME_FOR_PROMPT } from './prompt'\nimport { convertHtmlToMarkdown } from './htmlToMarkdown'\nimport { urlCache } from './cache'\nimport { queryQuick } from '@services/claude'\n\nconst inputSchema = z.strictObject({\n url: z.string().url().describe('The URL to fetch content from'),\n prompt: z.string().describe('The prompt to run on the fetched content'),\n})\n\ntype Input = z.infer<typeof inputSchema>\ntype Output = {\n url: string\n fromCache: boolean\n aiAnalysis: string\n}\n\nfunction normalizeUrl(url: string): string {\n // Auto-upgrade HTTP to HTTPS\n if (url.startsWith('http://')) {\n return url.replace('http://', 'https://')\n }\n return url\n}\n\nexport const URLFetcherTool = {\n name: TOOL_NAME_FOR_PROMPT,\n async description() {\n return DESCRIPTION\n },\n userFacingName: () => 'URL Fetcher',\n inputSchema,\n isReadOnly: () => true,\n isConcurrencySafe: () => true,\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return false\n },\n async prompt() {\n return DESCRIPTION\n },\n renderToolUseMessage({ url, prompt }: Input) {\n return `Fetching content from ${url} and analyzing with prompt: \"${prompt}\"`\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: Output) {\n const statusText = output.fromCache ? 'from cache' : 'fetched'\n
|
|
5
|
-
"mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAClB,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,sCAAsC;AAE/C,SAAS,aAAa,4BAA4B;AAClD,SAAS,6BAA6B;AACtC,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAE3B,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,+BAA+B;AAAA,EAC9D,QAAQ,EAAE,OAAO,EAAE,SAAS,0CAA0C;AACxE,CAAC;AASD,SAAS,aAAa,KAAqB;AAEzC,MAAI,IAAI,WAAW,SAAS,GAAG;AAC7B,WAAO,IAAI,QAAQ,WAAW,UAAU;AAAA,EAC1C;AACA,SAAO;AACT;AAEO,MAAM,iBAAiB;AAAA,EAC5B,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,gBAAgB,MAAM;AAAA,EACtB;AAAA,EACA,YAAY,MAAM;AAAA,EAClB,mBAAmB,MAAM;AAAA,EACzB,MAAM,YAAY;AAChB,WAAO;AAAA,EACT;AAAA,EACA,mBAAmB;AACjB,WAAO;AAAA,EACT;AAAA,EACA,MAAM,SAAS;AACb,WAAO;AAAA,EACT;AAAA,EACA,qBAAqB,EAAE,KAAK,OAAO,GAAU;AAC3C,WAAO,yBAAyB,GAAG,gCAAgC,MAAM;AAAA,EAC3E;AAAA,EACA,+BAA+B;AAC7B,WAAO,oCAAC,oCAA+B;AAAA,EACzC;AAAA,EACA,wBAAwB,QAAgB;
|
|
4
|
+
"sourcesContent": ["import { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport fetch from 'node-fetch'\nimport { Cost } from '@components/Cost'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool, ToolUseContext } from '@tool'\nimport { DESCRIPTION, TOOL_NAME_FOR_PROMPT } from './prompt'\nimport { convertHtmlToMarkdown } from './htmlToMarkdown'\nimport { urlCache } from './cache'\nimport { queryQuick } from '@services/claude'\n\nconst inputSchema = z.strictObject({\n url: z.string().url().describe('The URL to fetch content from'),\n prompt: z.string().describe('The prompt to run on the fetched content'),\n})\n\ntype Input = z.infer<typeof inputSchema>\ntype Output = {\n url: string\n fromCache: boolean\n aiAnalysis: string\n}\n\nfunction normalizeUrl(url: string): string {\n // Auto-upgrade HTTP to HTTPS\n if (url.startsWith('http://')) {\n return url.replace('http://', 'https://')\n }\n return url\n}\n\nexport const URLFetcherTool = {\n name: TOOL_NAME_FOR_PROMPT,\n async description() {\n return DESCRIPTION\n },\n userFacingName: () => 'URL Fetcher',\n inputSchema,\n isReadOnly: () => true,\n isConcurrencySafe: () => true,\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return false\n },\n async prompt() {\n return DESCRIPTION\n },\n renderToolUseMessage({ url, prompt }: Input) {\n return `Fetching content from ${url} and analyzing with prompt: \"${prompt}\"`\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: Output) {\n // Guard against undefined or null output\n if (!output) {\n return (\n <Box justifyContent=\"space-between\" width=\"100%\">\n <Box flexDirection=\"row\">\n <Text> \u23BF URL fetch completed</Text>\n </Box>\n </Box>\n )\n }\n\n const statusText = output.fromCache ? 'from cache' : 'fetched'\n\n return (\n <Box justifyContent=\"space-between\" width=\"100%\">\n <Box flexDirection=\"row\">\n <Text> \u23BF Content </Text>\n <Text bold>{statusText} </Text>\n <Text>and analyzed</Text>\n </Box>\n <Cost costUSD={0} durationMs={0} debug={false} />\n </Box>\n )\n },\n renderResultForAssistant(output: Output) {\n if (!output.aiAnalysis.trim()) {\n return `No content could be analyzed from URL: ${output.url}`\n }\n\n return output.aiAnalysis\n },\n async *call({ url, prompt }: Input, {}: ToolUseContext) {\n const normalizedUrl = normalizeUrl(url)\n\n try {\n let content: string\n let fromCache = false\n\n // Check cache first\n const cachedContent = urlCache.get(normalizedUrl)\n if (cachedContent) {\n content = cachedContent\n fromCache = true\n } else {\n // Fetch from URL with AbortController for timeout\n const abortController = new AbortController()\n const timeout = setTimeout(() => abortController.abort(), 30000)\n\n const response = await fetch(normalizedUrl, {\n method: 'GET',\n headers: {\n 'User-Agent': 'Mozilla/5.0 (compatible; URLFetcher/1.0)',\n Accept:\n 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',\n 'Accept-Language': 'en-US,en;q=0.5',\n 'Accept-Encoding': 'gzip, deflate',\n Connection: 'keep-alive',\n 'Upgrade-Insecure-Requests': '1',\n },\n signal: abortController.signal,\n redirect: 'follow',\n })\n\n clearTimeout(timeout)\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n }\n\n const contentType = response.headers.get('content-type') || ''\n if (\n !contentType.includes('text/') &&\n !contentType.includes('application/')\n ) {\n throw new Error(`Unsupported content type: ${contentType}`)\n }\n\n const html = await response.text()\n content = convertHtmlToMarkdown(html)\n\n // Cache the result\n urlCache.set(normalizedUrl, content)\n fromCache = false\n }\n\n // Truncate content if too large (keep within reasonable token limits)\n const maxContentLength = 50000 // ~15k tokens approximately\n const truncatedContent =\n content.length > maxContentLength\n ? content.substring(0, maxContentLength) +\n '\\n\\n[Content truncated due to length]'\n : content\n\n // AI Analysis - always performed fresh, even with cached content\n const systemPrompt = [\n \"You are analyzing web content based on a user's specific request.\",\n 'The content has been extracted from a webpage and converted to markdown.',\n \"Provide a focused response that directly addresses the user's prompt.\",\n ]\n\n const userPrompt = `Here is the content from ${normalizedUrl}:\n\n${truncatedContent}\n\nUser request: ${prompt}`\n\n const aiResponse = await queryQuick({\n systemPrompt,\n userPrompt,\n enablePromptCaching: false,\n })\n\n const output: Output = {\n url: normalizedUrl,\n fromCache,\n aiAnalysis:\n aiResponse.message.content[0]?.text || 'Unable to analyze content',\n }\n\n yield {\n type: 'result' as const,\n resultForAssistant: this.renderResultForAssistant(output),\n data: output,\n }\n } catch (error: any) {\n const output: Output = {\n url: normalizedUrl,\n fromCache: false,\n aiAnalysis: '',\n }\n\n yield {\n type: 'result' as const,\n resultForAssistant: `Error processing URL ${normalizedUrl}: ${error.message}`,\n data: output,\n }\n }\n },\n} satisfies Tool<typeof inputSchema, Output>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAClB,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,sCAAsC;AAE/C,S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AM,mBAAmB;AACzB,YAAM,mBACJ,QAAQ,SAAS,mBACb,QAAQ,UAAU,GAAG,gBAAgB,IACrC,0CACA;AAGN,YAAM,eAAe;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,YAAM,aAAa,4BAA4B,aAAa;AAAA;AAAA,EAEhE,gBAAgB;AAAA;AAAA,gBAEF,MAAM;AAEhB,YAAM,aAAa,MAAM,WAAW;AAAA,QAClC;AAAA,QACA;AAAA,QACA,qBAAqB;AAAA,MACvB,CAAC;AAED,YAAM,SAAiB;AAAA,QACrB,KAAK;AAAA,QACL;AAAA,QACA,YACE,WAAW,QAAQ,QAAQ,CAAC,GAAG,QAAQ;AAAA,MAC3C;AAEA,YAAM;AAAA,QACJ,MAAM;AAAA,QACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,QACxD,MAAM;AAAA,MACR;AAAA,IACF,SAAS,OAAY;AACnB,YAAM,SAAiB;AAAA,QACrB,KAAK;AAAA,QACL,WAAW;AAAA,QACX,YAAY;AAAA,MACd;AAEA,YAAM;AAAA,QACJ,MAAM;AAAA,QACN,oBAAoB,wBAAwB,aAAa,KAAK,MAAM,OAAO;AAAA,QAC3E,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,9 +33,12 @@ class URLCache {
|
|
|
33
33
|
}
|
|
34
34
|
// Auto-clean expired entries every 5 minutes
|
|
35
35
|
constructor() {
|
|
36
|
-
setInterval(
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
setInterval(
|
|
37
|
+
() => {
|
|
38
|
+
this.cleanExpired();
|
|
39
|
+
},
|
|
40
|
+
5 * 60 * 1e3
|
|
41
|
+
);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
const urlCache = new URLCache();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/URLFetcherTool/cache.ts"],
|
|
4
|
-
"sourcesContent": ["interface CacheEntry {\n content: string\n timestamp: number\n}\n\nclass URLCache {\n private cache = new Map<string, CacheEntry>()\n private readonly CACHE_DURATION = 15 * 60 * 1000 // 15 minutes in milliseconds\n\n set(url: string, content: string): void {\n this.cache.set(url, {\n content,\n timestamp: Date.now()
|
|
5
|
-
"mappings": "AAKA,MAAM,SAAS;AAAA,EACL,QAAQ,oBAAI,IAAwB;AAAA,EAC3B,iBAAiB,KAAK,KAAK;AAAA;AAAA,EAE5C,IAAI,KAAa,SAAuB;AACtC,SAAK,MAAM,IAAI,KAAK;AAAA,MAClB;AAAA,MACA,WAAW,KAAK,IAAI;AAAA,IACtB,CAAC;AAAA,EACH;AAAA,EAEA,IAAI,KAA4B;AAC9B,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAChC,QAAI,CAAC,OAAO;AACV,aAAO;AAAA,IACT;AAGA,QAAI,KAAK,IAAI,IAAI,MAAM,YAAY,KAAK,gBAAgB;AACtD,WAAK,MAAM,OAAO,GAAG;AACrB,aAAO;AAAA,IACT;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,QAAc;AACZ,SAAK,MAAM,MAAM;AAAA,EACnB;AAAA;AAAA,EAGQ,eAAqB;AAC3B,UAAM,MAAM,KAAK,IAAI;AACrB,eAAW,CAAC,KAAK,KAAK,KAAK,KAAK,MAAM,QAAQ,GAAG;AAC/C,UAAI,MAAM,MAAM,YAAY,KAAK,gBAAgB;AAC/C,aAAK,MAAM,OAAO,GAAG;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA,cAAc;AACZ,
|
|
4
|
+
"sourcesContent": ["interface CacheEntry {\n content: string\n timestamp: number\n}\n\nclass URLCache {\n private cache = new Map<string, CacheEntry>()\n private readonly CACHE_DURATION = 15 * 60 * 1000 // 15 minutes in milliseconds\n\n set(url: string, content: string): void {\n this.cache.set(url, {\n content,\n timestamp: Date.now(),\n })\n }\n\n get(url: string): string | null {\n const entry = this.cache.get(url)\n if (!entry) {\n return null\n }\n\n // Check if entry has expired\n if (Date.now() - entry.timestamp > this.CACHE_DURATION) {\n this.cache.delete(url)\n return null\n }\n\n return entry.content\n }\n\n clear(): void {\n this.cache.clear()\n }\n\n // Clean expired entries\n private cleanExpired(): void {\n const now = Date.now()\n for (const [url, entry] of this.cache.entries()) {\n if (now - entry.timestamp > this.CACHE_DURATION) {\n this.cache.delete(url)\n }\n }\n }\n\n // Auto-clean expired entries every 5 minutes\n constructor() {\n setInterval(\n () => {\n this.cleanExpired()\n },\n 5 * 60 * 1000,\n ) // 5 minutes\n }\n}\n\n// Export singleton instance\nexport const urlCache = new URLCache()\n"],
|
|
5
|
+
"mappings": "AAKA,MAAM,SAAS;AAAA,EACL,QAAQ,oBAAI,IAAwB;AAAA,EAC3B,iBAAiB,KAAK,KAAK;AAAA;AAAA,EAE5C,IAAI,KAAa,SAAuB;AACtC,SAAK,MAAM,IAAI,KAAK;AAAA,MAClB;AAAA,MACA,WAAW,KAAK,IAAI;AAAA,IACtB,CAAC;AAAA,EACH;AAAA,EAEA,IAAI,KAA4B;AAC9B,UAAM,QAAQ,KAAK,MAAM,IAAI,GAAG;AAChC,QAAI,CAAC,OAAO;AACV,aAAO;AAAA,IACT;AAGA,QAAI,KAAK,IAAI,IAAI,MAAM,YAAY,KAAK,gBAAgB;AACtD,WAAK,MAAM,OAAO,GAAG;AACrB,aAAO;AAAA,IACT;AAEA,WAAO,MAAM;AAAA,EACf;AAAA,EAEA,QAAc;AACZ,SAAK,MAAM,MAAM;AAAA,EACnB;AAAA;AAAA,EAGQ,eAAqB;AAC3B,UAAM,MAAM,KAAK,IAAI;AACrB,eAAW,CAAC,KAAK,KAAK,KAAK,KAAK,MAAM,QAAQ,GAAG;AAC/C,UAAI,MAAM,MAAM,YAAY,KAAK,gBAAgB;AAC/C,aAAK,MAAM,OAAO,GAAG;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA,cAAc;AACZ;AAAA,MACE,MAAM;AACJ,aAAK,aAAa;AAAA,MACpB;AAAA,MACA,IAAI,KAAK;AAAA,IACX;AAAA,EACF;AACF;AAGO,MAAM,WAAW,IAAI,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,7 +33,9 @@ function convertHtmlToMarkdown(html) {
|
|
|
33
33
|
const markdown = turndownService.turndown(cleanHtml);
|
|
34
34
|
return markdown.replace(/\n{3,}/g, "\n\n").replace(/^\s+|\s+$/gm, "").trim();
|
|
35
35
|
} catch (error) {
|
|
36
|
-
throw new Error(
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Failed to convert HTML to markdown: ${error instanceof Error ? error.message : String(error)}`
|
|
38
|
+
);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/URLFetcherTool/htmlToMarkdown.ts"],
|
|
4
|
-
"sourcesContent": ["import TurndownService from 'turndown'\n\nconst turndownService = new TurndownService({\n headingStyle: 'atx',\n hr: '---',\n bulletListMarker: '-',\n codeBlockStyle: 'fenced',\n fence: '```',\n emDelimiter: '_',\n strongDelimiter: '**'
|
|
5
|
-
"mappings": "AAAA,OAAO,qBAAqB;AAE5B,MAAM,kBAAkB,IAAI,gBAAgB;AAAA,EAC1C,cAAc;AAAA,EACd,IAAI;AAAA,EACJ,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,iBAAiB;AACnB,CAAC;AAGD,gBAAgB,QAAQ,iBAAiB;AAAA,EACvC,QAAQ,CAAC,UAAU,SAAS,UAAU;AAAA,EACtC,aAAa,MAAM;AACrB,CAAC;AAED,gBAAgB,QAAQ,kBAAkB;AAAA,EACxC,QAAQ,
|
|
4
|
+
"sourcesContent": ["import TurndownService from 'turndown'\n\nconst turndownService = new TurndownService({\n headingStyle: 'atx',\n hr: '---',\n bulletListMarker: '-',\n codeBlockStyle: 'fenced',\n fence: '```',\n emDelimiter: '_',\n strongDelimiter: '**',\n})\n\n// Configure rules to handle common HTML elements\nturndownService.addRule('removeScripts', {\n filter: ['script', 'style', 'noscript'],\n replacement: () => '',\n})\n\nturndownService.addRule('removeComments', {\n filter: node => node.nodeType === 8, // Comment nodes\n replacement: () => '',\n})\n\nturndownService.addRule('cleanLinks', {\n filter: 'a',\n replacement: (content, node) => {\n const href = node.getAttribute('href')\n if (!href || href.startsWith('javascript:') || href.startsWith('#')) {\n return content\n }\n return `[${content}](${href})`\n },\n})\n\nexport function convertHtmlToMarkdown(html: string): string {\n try {\n // Clean up the HTML before conversion\n const cleanHtml = html\n .replace(/<script[^>]*>[\\s\\S]*?<\\/script>/gi, '') // Remove script tags\n .replace(/<style[^>]*>[\\s\\S]*?<\\/style>/gi, '') // Remove style tags\n .replace(/<!--[\\s\\S]*?-->/g, '') // Remove HTML comments\n .replace(/\\s+/g, ' ') // Normalize whitespace\n .trim()\n\n const markdown = turndownService.turndown(cleanHtml)\n\n // Clean up the resulting markdown\n return markdown\n .replace(/\\n{3,}/g, '\\n\\n') // Remove excessive line breaks\n .replace(/^\\s+|\\s+$/gm, '') // Remove leading/trailing spaces on each line\n .trim()\n } catch (error) {\n throw new Error(\n `Failed to convert HTML to markdown: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,qBAAqB;AAE5B,MAAM,kBAAkB,IAAI,gBAAgB;AAAA,EAC1C,cAAc;AAAA,EACd,IAAI;AAAA,EACJ,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,iBAAiB;AACnB,CAAC;AAGD,gBAAgB,QAAQ,iBAAiB;AAAA,EACvC,QAAQ,CAAC,UAAU,SAAS,UAAU;AAAA,EACtC,aAAa,MAAM;AACrB,CAAC;AAED,gBAAgB,QAAQ,kBAAkB;AAAA,EACxC,QAAQ,UAAQ,KAAK,aAAa;AAAA;AAAA,EAClC,aAAa,MAAM;AACrB,CAAC;AAED,gBAAgB,QAAQ,cAAc;AAAA,EACpC,QAAQ;AAAA,EACR,aAAa,CAAC,SAAS,SAAS;AAC9B,UAAM,OAAO,KAAK,aAAa,MAAM;AACrC,QAAI,CAAC,QAAQ,KAAK,WAAW,aAAa,KAAK,KAAK,WAAW,GAAG,GAAG;AACnE,aAAO;AAAA,IACT;AACA,WAAO,IAAI,OAAO,KAAK,IAAI;AAAA,EAC7B;AACF,CAAC;AAEM,SAAS,sBAAsB,MAAsB;AAC1D,MAAI;AAEF,UAAM,YAAY,KACf,QAAQ,qCAAqC,EAAE,EAC/C,QAAQ,mCAAmC,EAAE,EAC7C,QAAQ,oBAAoB,EAAE,EAC9B,QAAQ,QAAQ,GAAG,EACnB,KAAK;AAER,UAAM,WAAW,gBAAgB,SAAS,SAAS;AAGnD,WAAO,SACJ,QAAQ,WAAW,MAAM,EACzB,QAAQ,eAAe,EAAE,EACzB,KAAK;AAAA,EACV,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,uCAAuC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,IAC/F;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,7 +33,12 @@ const WebSearchTool = {
|
|
|
33
33
|
return /* @__PURE__ */ React.createElement(FallbackToolUseRejectedMessage, null);
|
|
34
34
|
},
|
|
35
35
|
renderToolResultMessage(output) {
|
|
36
|
-
|
|
36
|
+
if (!output) {
|
|
37
|
+
return /* @__PURE__ */ React.createElement(Box, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0Search completed")));
|
|
38
|
+
}
|
|
39
|
+
const resultsLength = output.results?.length ?? 0;
|
|
40
|
+
const durationMs = output.durationMs ?? 0;
|
|
41
|
+
return /* @__PURE__ */ React.createElement(Box, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0Found "), /* @__PURE__ */ React.createElement(Text, { bold: true }, resultsLength, " "), /* @__PURE__ */ React.createElement(Text, null, resultsLength === 1 ? "result" : "results", " using DuckDuckGo")), /* @__PURE__ */ React.createElement(Cost, { costUSD: 0, durationMs, debug: false }));
|
|
37
42
|
},
|
|
38
43
|
renderResultForAssistant(output) {
|
|
39
44
|
if (output.results.length === 0) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/WebSearchTool/WebSearchTool.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport { Cost } from '@components/Cost'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool, ToolUseContext } from '@tool'\nimport { DESCRIPTION, TOOL_NAME_FOR_PROMPT } from './prompt'\nimport { SearchResult, searchProviders } from './searchProviders'\n\nconst inputSchema = z.strictObject({\n query: z.string().describe('The search query'),\n})\n\ntype Input = z.infer<typeof inputSchema>\ntype Output = {\n durationMs: number\n results: SearchResult[]\n}\n\
|
|
5
|
-
"mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAClB,SAAS,YAAY;AACrB,SAAS,sCAAsC;AAE/C,SAAS,aAAa,4BAA4B;AAClD,SAAuB,uBAAuB;AAE9C,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,OAAO,EAAE,OAAO,EAAE,SAAS,kBAAkB;AAC/C,CAAC;
|
|
4
|
+
"sourcesContent": ["import { Box, Text } from 'ink'\nimport React from 'react'\nimport { z } from 'zod'\nimport { Cost } from '@components/Cost'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool, ToolUseContext } from '@tool'\nimport { DESCRIPTION, TOOL_NAME_FOR_PROMPT } from './prompt'\nimport { SearchResult, searchProviders } from './searchProviders'\n\nconst inputSchema = z.strictObject({\n query: z.string().describe('The search query'),\n})\n\ntype Input = z.infer<typeof inputSchema>\ntype Output = {\n durationMs: number\n results: SearchResult[]\n}\n\nexport const WebSearchTool = {\n name: TOOL_NAME_FOR_PROMPT,\n async description() {\n return DESCRIPTION\n },\n userFacingName: () => 'Web Search',\n inputSchema,\n isReadOnly: () => true,\n isConcurrencySafe: () => true,\n async isEnabled() {\n return true\n },\n needsPermissions() {\n return false\n },\n async prompt() {\n return DESCRIPTION\n },\n renderToolUseMessage({ query }: Input) {\n return `Searching for: \"${query}\" using DuckDuckGo`\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: Output) {\n // Guard against undefined or null output\n if (!output) {\n return (\n <Box justifyContent=\"space-between\" width=\"100%\">\n <Box flexDirection=\"row\">\n <Text> \u23BF Search completed</Text>\n </Box>\n </Box>\n )\n }\n\n const resultsLength = output.results?.length ?? 0\n const durationMs = output.durationMs ?? 0\n\n return (\n <Box justifyContent=\"space-between\" width=\"100%\">\n <Box flexDirection=\"row\">\n <Text> \u23BF Found </Text>\n <Text bold>{resultsLength} </Text>\n <Text>\n {resultsLength === 1 ? 'result' : 'results'} using DuckDuckGo\n </Text>\n </Box>\n <Cost costUSD={0} durationMs={durationMs} debug={false} />\n </Box>\n )\n },\n renderResultForAssistant(output: Output) {\n if (output.results.length === 0) {\n return `No results found using DuckDuckGo.`\n }\n\n let result = `Found ${output.results.length} search results using DuckDuckGo:\\n\\n`\n\n output.results.forEach((item, index) => {\n result += `${index + 1}. **${item.title}**\\n`\n result += ` ${item.snippet}\\n`\n result += ` Link: ${item.link}\\n\\n`\n })\n\n result += `You can reference these results to provide current, accurate information to the user.`\n return result\n },\n async *call({ query }: Input, {}: ToolUseContext) {\n const start = Date.now()\n\n try {\n const searchResults = await searchProviders.duckduckgo.search(query)\n\n const output: Output = {\n results: searchResults,\n durationMs: Date.now() - start,\n }\n\n yield {\n type: 'result' as const,\n resultForAssistant: this.renderResultForAssistant(output),\n data: output,\n }\n } catch (error: any) {\n const output: Output = {\n results: [],\n durationMs: Date.now() - start,\n }\n yield {\n type: 'result' as const,\n resultForAssistant: `An error occurred during web search with DuckDuckGo: ${error.message}`,\n data: output,\n }\n }\n },\n} satisfies Tool<typeof inputSchema, Output>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,OAAO,WAAW;AAClB,SAAS,SAAS;AAClB,SAAS,YAAY;AACrB,SAAS,sCAAsC;AAE/C,SAAS,aAAa,4BAA4B;AAClD,SAAuB,uBAAuB;AAE9C,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,OAAO,EAAE,OAAO,EAAE,SAAS,kBAAkB;AAC/C,CAAC;AAQM,MAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,gBAAgB,MAAM;AAAA,EACtB;AAAA,EACA,YAAY,MAAM;AAAA,EAClB,mBAAmB,MAAM;AAAA,EACzB,MAAM,YAAY;AAChB,WAAO;AAAA,EACT;AAAA,EACA,mBAAmB;AACjB,WAAO;AAAA,EACT;AAAA,EACA,MAAM,SAAS;AACb,WAAO;AAAA,EACT;AAAA,EACA,qBAAqB,EAAE,MAAM,GAAU;AACrC,WAAO,mBAAmB,KAAK;AAAA,EACjC;AAAA,EACA,+BAA+B;AAC7B,WAAO,oCAAC,oCAA+B;AAAA,EACzC;AAAA,EACA,wBAAwB,QAAgB;AAEtC,QAAI,CAAC,QAAQ;AACX,aACE,oCAAC,OAAI,gBAAe,iBAAgB,OAAM,UACxC,oCAAC,OAAI,eAAc,SACjB,oCAAC,YAAK,qCAAoC,CAC5C,CACF;AAAA,IAEJ;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AO;AAAA,QACzF,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/WebSearchTool/prompt.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export const TOOL_NAME_FOR_PROMPT = 'WebSearch'\nexport const DESCRIPTION = `- Allows Minto to search the web and use the results to inform responses\n- Provides up-to-date information for current events and recent data\n- Returns search result information formatted as search result blocks\n- Use this tool for accessing information beyond the Minto's knowledge cutoff\n- Searches are performed automatically within a single API call using DuckDuckGo\n\nUsage notes:\n- Use when you need current information not in training data\n- Effective for recent news, current events, product updates, or real-time data\n- Search queries should be specific and well-targeted for best results\n- Results include both title and snippet content for context`\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,uBAAuB;AAC7B,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,13 +3,18 @@ import { parse } from "node-html-parser";
|
|
|
3
3
|
const duckDuckGoSearchProvider = {
|
|
4
4
|
isEnabled: () => true,
|
|
5
5
|
search: async (query) => {
|
|
6
|
-
const response = await fetch(
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const response = await fetch(
|
|
7
|
+
`https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`,
|
|
8
|
+
{
|
|
9
|
+
headers: {
|
|
10
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
);
|
|
11
14
|
if (!response.ok) {
|
|
12
|
-
throw new Error(
|
|
15
|
+
throw new Error(
|
|
16
|
+
`DuckDuckGo search failed with status: ${response.status}`
|
|
17
|
+
);
|
|
13
18
|
}
|
|
14
19
|
const html = await response.text();
|
|
15
20
|
const root = parse(html);
|
|
@@ -32,7 +37,11 @@ const duckDuckGoSearchProvider = {
|
|
|
32
37
|
cleanLink = link;
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
|
-
results.push({
|
|
40
|
+
results.push({
|
|
41
|
+
title: title.trim(),
|
|
42
|
+
snippet: snippet.trim(),
|
|
43
|
+
link: cleanLink
|
|
44
|
+
});
|
|
36
45
|
}
|
|
37
46
|
}
|
|
38
47
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/WebSearchTool/searchProviders.ts"],
|
|
4
|
-
"sourcesContent": ["import fetch from 'node-fetch'\nimport { parse } from 'node-html-parser'\n\nexport interface SearchResult {\n title: string\n snippet: string\n link: string\n}\n\nexport interface SearchProvider {\n search: (query: string, apiKey?: string) => Promise<SearchResult[]>\n isEnabled: (apiKey?: string) => boolean\n}\n\
|
|
5
|
-
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,aAAa;
|
|
4
|
+
"sourcesContent": ["import fetch from 'node-fetch'\nimport { parse } from 'node-html-parser'\n\nexport interface SearchResult {\n title: string\n snippet: string\n link: string\n}\n\nexport interface SearchProvider {\n search: (query: string, apiKey?: string) => Promise<SearchResult[]>\n isEnabled: (apiKey?: string) => boolean\n}\n\nconst duckDuckGoSearchProvider: SearchProvider = {\n isEnabled: () => true,\n search: async (query: string): Promise<SearchResult[]> => {\n const response = await fetch(\n `https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`,\n {\n headers: {\n 'User-Agent':\n 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',\n },\n },\n )\n\n if (!response.ok) {\n throw new Error(\n `DuckDuckGo search failed with status: ${response.status}`,\n )\n }\n\n const html = await response.text()\n const root = parse(html)\n const results: SearchResult[] = []\n\n const resultNodes = root.querySelectorAll('.result.web-result')\n\n for (const node of resultNodes) {\n const titleNode = node.querySelector('.result__a')\n const snippetNode = node.querySelector('.result__snippet')\n\n if (titleNode && snippetNode) {\n const title = titleNode.text\n const link = titleNode.getAttribute('href')\n const snippet = snippetNode.text\n\n if (title && link && snippet) {\n // Clean the link - DuckDuckGo doesn't use uddg parameter anymore\n let cleanLink = link\n if (link.startsWith('https://duckduckgo.com/l/?uddg=')) {\n try {\n const url = new URL(link)\n cleanLink = url.searchParams.get('uddg') || link\n } catch {\n cleanLink = link\n }\n }\n results.push({\n title: title.trim(),\n snippet: snippet.trim(),\n link: cleanLink,\n })\n }\n }\n }\n\n return results\n },\n}\n\nexport const searchProviders = {\n duckduckgo: duckDuckGoSearchProvider,\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,aAAa;AAatB,MAAM,2BAA2C;AAAA,EAC/C,WAAW,MAAM;AAAA,EACjB,QAAQ,OAAO,UAA2C;AACxD,UAAM,WAAW,MAAM;AAAA,MACrB,uCAAuC,mBAAmB,KAAK,CAAC;AAAA,MAChE;AAAA,QACE,SAAS;AAAA,UACP,cACE;AAAA,QACJ;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI;AAAA,QACR,yCAAyC,SAAS,MAAM;AAAA,MAC1D;AAAA,IACF;AAEA,UAAM,OAAO,MAAM,SAAS,KAAK;AACjC,UAAM,OAAO,MAAM,IAAI;AACvB,UAAM,UAA0B,CAAC;AAEjC,UAAM,cAAc,KAAK,iBAAiB,oBAAoB;AAE9D,eAAW,QAAQ,aAAa;AAC9B,YAAM,YAAY,KAAK,cAAc,YAAY;AACjD,YAAM,cAAc,KAAK,cAAc,kBAAkB;AAEzD,UAAI,aAAa,aAAa;AAC5B,cAAM,QAAQ,UAAU;AACxB,cAAM,OAAO,UAAU,aAAa,MAAM;AAC1C,cAAM,UAAU,YAAY;AAE5B,YAAI,SAAS,QAAQ,SAAS;AAE5B,cAAI,YAAY;AAChB,cAAI,KAAK,WAAW,iCAAiC,GAAG;AACtD,gBAAI;AACF,oBAAM,MAAM,IAAI,IAAI,IAAI;AACxB,0BAAY,IAAI,aAAa,IAAI,MAAM,KAAK;AAAA,YAC9C,QAAQ;AACN,0BAAY;AAAA,YACd;AAAA,UACF;AACA,kBAAQ,KAAK;AAAA,YACX,OAAO,MAAM,KAAK;AAAA,YAClB,SAAS,QAAQ,KAAK;AAAA,YACtB,MAAM;AAAA,UACR,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,kBAAkB;AAAA,EAC7B,YAAY;AACd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/tools.js
CHANGED
|
@@ -23,7 +23,10 @@ import { WebSearchTool } from "./tools/WebSearchTool/WebSearchTool.js";
|
|
|
23
23
|
import { URLFetcherTool } from "./tools/URLFetcherTool/URLFetcherTool.js";
|
|
24
24
|
import { getMCPTools } from "./services/mcpClient.js";
|
|
25
25
|
import { memoize } from "lodash-es";
|
|
26
|
-
const ANT_ONLY_TOOLS = [
|
|
26
|
+
const ANT_ONLY_TOOLS = [
|
|
27
|
+
MemoryReadTool,
|
|
28
|
+
MemoryWriteTool
|
|
29
|
+
];
|
|
27
30
|
const getAllTools = () => {
|
|
28
31
|
return [
|
|
29
32
|
TaskTool,
|
package/dist/tools.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/tools.ts"],
|
|
4
|
-
"sourcesContent": ["import { Tool } from './Tool'\nimport { TaskTool } from './tools/TaskTool/TaskTool'\nimport { ArchitectTool } from './tools/ArchitectTool/ArchitectTool'\nimport { BashTool } from './tools/BashTool/BashTool'\nimport { BashOutputTool } from './tools/BashOutputTool/BashOutputTool'\nimport { KillShellTool } from './tools/KillShellTool/KillShellTool'\nimport { AskExpertModelTool } from './tools/AskExpertModelTool/AskExpertModelTool'\nimport { AskUserQuestionTool } from './tools/AskUserQuestionTool/AskUserQuestionTool'\nimport { FileEditTool } from './tools/FileEditTool/FileEditTool'\nimport { FileReadTool } from './tools/FileReadTool/FileReadTool'\nimport { FileWriteTool } from './tools/FileWriteTool/FileWriteTool'\nimport { GlobTool } from './tools/GlobTool/GlobTool'\nimport { GrepTool } from './tools/GrepTool/GrepTool'\nimport { LSTool } from './tools/lsTool/lsTool'\nimport { MemoryReadTool } from './tools/MemoryReadTool/MemoryReadTool'\nimport { MemoryWriteTool } from './tools/MemoryWriteTool/MemoryWriteTool'\nimport { MultiEditTool } from './tools/MultiEditTool/MultiEditTool'\nimport { NotebookEditTool } from './tools/NotebookEditTool/NotebookEditTool'\nimport { NotebookReadTool } from './tools/NotebookReadTool/NotebookReadTool'\nimport { SkillTool } from './tools/SkillTool/SkillTool'\nimport { ThinkTool } from './tools/ThinkTool/ThinkTool'\nimport { TodoWriteTool } from './tools/TodoWriteTool/TodoWriteTool'\nimport { WebSearchTool } from './tools/WebSearchTool/WebSearchTool'\nimport { URLFetcherTool } from './tools/URLFetcherTool/URLFetcherTool'\nimport { getMCPTools } from './services/mcpClient'\nimport { memoize } from 'lodash-es'\n\nconst ANT_ONLY_TOOLS = [MemoryReadTool as unknown as Tool
|
|
5
|
-
"mappings": "AACA,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAExB,MAAM,iBAAiB,
|
|
4
|
+
"sourcesContent": ["import { Tool } from './Tool'\nimport { TaskTool } from './tools/TaskTool/TaskTool'\nimport { ArchitectTool } from './tools/ArchitectTool/ArchitectTool'\nimport { BashTool } from './tools/BashTool/BashTool'\nimport { BashOutputTool } from './tools/BashOutputTool/BashOutputTool'\nimport { KillShellTool } from './tools/KillShellTool/KillShellTool'\nimport { AskExpertModelTool } from './tools/AskExpertModelTool/AskExpertModelTool'\nimport { AskUserQuestionTool } from './tools/AskUserQuestionTool/AskUserQuestionTool'\nimport { FileEditTool } from './tools/FileEditTool/FileEditTool'\nimport { FileReadTool } from './tools/FileReadTool/FileReadTool'\nimport { FileWriteTool } from './tools/FileWriteTool/FileWriteTool'\nimport { GlobTool } from './tools/GlobTool/GlobTool'\nimport { GrepTool } from './tools/GrepTool/GrepTool'\nimport { LSTool } from './tools/lsTool/lsTool'\nimport { MemoryReadTool } from './tools/MemoryReadTool/MemoryReadTool'\nimport { MemoryWriteTool } from './tools/MemoryWriteTool/MemoryWriteTool'\nimport { MultiEditTool } from './tools/MultiEditTool/MultiEditTool'\nimport { NotebookEditTool } from './tools/NotebookEditTool/NotebookEditTool'\nimport { NotebookReadTool } from './tools/NotebookReadTool/NotebookReadTool'\nimport { SkillTool } from './tools/SkillTool/SkillTool'\nimport { ThinkTool } from './tools/ThinkTool/ThinkTool'\nimport { TodoWriteTool } from './tools/TodoWriteTool/TodoWriteTool'\nimport { WebSearchTool } from './tools/WebSearchTool/WebSearchTool'\nimport { URLFetcherTool } from './tools/URLFetcherTool/URLFetcherTool'\nimport { getMCPTools } from './services/mcpClient'\nimport { memoize } from 'lodash-es'\n\nconst ANT_ONLY_TOOLS = [\n MemoryReadTool as unknown as Tool,\n MemoryWriteTool as unknown as Tool,\n]\n\n// Function to avoid circular dependencies that break bun\nexport const getAllTools = (): Tool[] => {\n return [\n TaskTool as unknown as Tool,\n AskExpertModelTool as unknown as Tool,\n AskUserQuestionTool as unknown as Tool,\n BashTool as unknown as Tool,\n BashOutputTool as unknown as Tool,\n KillShellTool as unknown as Tool,\n GlobTool as unknown as Tool,\n GrepTool as unknown as Tool,\n LSTool as unknown as Tool,\n FileReadTool as unknown as Tool,\n FileEditTool as unknown as Tool,\n MultiEditTool as unknown as Tool,\n FileWriteTool as unknown as Tool,\n NotebookReadTool as unknown as Tool,\n NotebookEditTool as unknown as Tool,\n SkillTool as unknown as Tool,\n ThinkTool as unknown as Tool,\n TodoWriteTool as unknown as Tool,\n WebSearchTool as unknown as Tool,\n URLFetcherTool as unknown as Tool,\n ...ANT_ONLY_TOOLS,\n ]\n}\n\nexport const getTools = memoize(\n async (enableArchitect?: boolean): Promise<Tool[]> => {\n const tools = [...getAllTools(), ...(await getMCPTools())]\n\n // Only include Architect tool if enabled via config or CLI flag\n if (enableArchitect) {\n tools.push(ArchitectTool as unknown as Tool)\n }\n\n const isEnabled = await Promise.all(tools.map(tool => tool.isEnabled()))\n return tools.filter((_, i) => isEnabled[i])\n },\n)\n\nexport const getReadOnlyTools = memoize(async (): Promise<Tool[]> => {\n const tools = getAllTools().filter(tool => tool.isReadOnly())\n const isEnabled = await Promise.all(tools.map(tool => tool.isEnabled()))\n return tools.filter((_, index) => isEnabled[index])\n})\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAC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 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=core.js.map
|
package/dist/types/hooks.js
CHANGED
|
@@ -24,10 +24,7 @@ const HookMatcherSchema = z.object({
|
|
|
24
24
|
});
|
|
25
25
|
const HooksConfigSchema = z.object({
|
|
26
26
|
description: z.string().optional(),
|
|
27
|
-
hooks: z.record(
|
|
28
|
-
z.nativeEnum(HookEvent),
|
|
29
|
-
z.array(HookMatcherSchema)
|
|
30
|
-
).optional()
|
|
27
|
+
hooks: z.record(z.nativeEnum(HookEvent), z.array(HookMatcherSchema)).optional()
|
|
31
28
|
});
|
|
32
29
|
export {
|
|
33
30
|
HookDefinitionSchema,
|
package/dist/types/hooks.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types/hooks.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Hooks System Type Definitions\n *\n * Fully compatible with Claude Code CLI hooks specification:\n * https://code.claude.com/docs/en/hooks\n */\n\nimport { z } from 'zod'\n\n/**\n * Hook lifecycle events\n */\nexport enum HookEvent {\n PreToolUse = 'PreToolUse',\n PostToolUse = 'PostToolUse',\n UserPromptSubmit = 'UserPromptSubmit',\n SessionStart = 'SessionStart',\n SessionEnd = 'SessionEnd',\n Stop = 'Stop',\n SubagentStop = 'SubagentStop',\n Notification = 'Notification',\n PreCompact = 'PreCompact',\n}\n\n/**\n * Hook execution types\n */\nexport type HookType = 'command' | 'prompt'\n\n/**\n * Hook matcher configuration\n */\nexport interface HookMatcher {\n /** Pattern to match tool names (regex supported). Use \"*\" or \"\" to match all. */\n matcher?: string\n\n /** Array of hooks to execute when matcher matches */\n hooks: HookDefinition[]\n}\n\n/**\n * Individual hook definition\n */\nexport interface HookDefinition {\n /** Hook execution type */\n type: HookType\n\n /** Bash command to execute (for type=\"command\") */\n command?: string\n\n /** Prompt to send to LLM (for type=\"prompt\") */\n prompt?: string\n\n /** Optional timeout in seconds (default: 60) */\n timeout?: number\n\n /** Optional description of what this hook does */\n description?: string\n}\n\n/**\n * hooks.json file schema\n */\nexport interface HooksConfig {\n /** Optional description for plugin hooks */\n description?: string\n\n /** Hook configurations by event type */\n hooks: Partial<Record<HookEvent, HookMatcher[]>>\n}\n\n/**\n * Hook execution input (passed to hook as JSON stdin)\n */\nexport interface HookInput {\n /** Session identifier */\n session_id: string\n\n /** Path to conversation transcript */\n transcript_path: string\n\n /** Current working directory */\n cwd: string\n\n /** Permission mode (default, plan, acceptEdits, bypassPermissions) */\n permission_mode: string\n\n /** Hook event name */\n hook_event_name: HookEvent\n\n /** Event-specific additional fields */\n [key: string]: any\n}\n\n/**\n * PreToolUse hook input\n */\nexport interface PreToolUseInput extends HookInput {\n hook_event_name: HookEvent.PreToolUse\n tool_name: string\n tool_input: Record<string, unknown>\n}\n\n/**\n * PostToolUse hook input\n */\nexport interface PostToolUseInput extends HookInput {\n hook_event_name: HookEvent.PostToolUse\n tool_name: string\n tool_input: Record<string, unknown>\n tool_output: Record<string, unknown>\n}\n\n/**\n * UserPromptSubmit hook input\n */\nexport interface UserPromptSubmitInput extends HookInput {\n hook_event_name: HookEvent.UserPromptSubmit\n user_prompt: string\n}\n\n/**\n * SessionStart hook input\n */\nexport interface SessionStartInput extends HookInput {\n hook_event_name: HookEvent.SessionStart\n source: 'startup' | 'resume' | 'clear' | 'compact'\n}\n\n/**\n * SessionEnd hook input\n */\nexport interface SessionEndInput extends HookInput {\n hook_event_name: HookEvent.SessionEnd\n reason: 'clear' | 'logout' | 'prompt_input_exit' | 'other'\n}\n\n/**\n * Stop/SubagentStop hook input\n */\nexport interface StopInput extends HookInput {\n hook_event_name: HookEvent.Stop | HookEvent.SubagentStop\n stop_hook_active: boolean\n}\n\n/**\n * Notification hook input\n */\nexport interface NotificationInput extends HookInput {\n hook_event_name: HookEvent.Notification\n message: string\n}\n\n/**\n * PreCompact hook input\n */\nexport interface PreCompactInput extends HookInput {\n hook_event_name: HookEvent.PreCompact\n trigger: 'manual' | 'auto'\n custom_instructions: string\n}\n\n/**\n * Hook execution output (from hook stdout as JSON)\n */\nexport interface HookOutput {\n /** Whether Claude should continue after hook execution */\n continue?: boolean\n\n /** Message shown when continue is false */\n stopReason?: string\n\n /** Hide stdout from transcript mode */\n suppressOutput?: boolean\n\n /** Optional warning message shown to user */\n systemMessage?: string\n\n /** Hook-specific output fields */\n hookSpecificOutput?: HookSpecificOutput\n\n /** Deprecated: Use hookSpecificOutput.permissionDecision instead */\n decision?: 'approve' | 'block'\n\n /** Deprecated: Use hookSpecificOutput.permissionDecisionReason instead */\n reason?: string\n}\n\n/**\n * Hook-specific output for different events\n */\nexport type HookSpecificOutput =\n | PreToolUseOutput\n | PostToolUseOutput\n | UserPromptSubmitOutput\n | SessionStartOutput\n\n/**\n * PreToolUse hook-specific output\n */\nexport interface PreToolUseOutput {\n hookEventName: HookEvent.PreToolUse\n\n /** Permission decision: allow (bypass), deny (block), ask (prompt user) */\n permissionDecision: 'allow' | 'deny' | 'ask'\n\n /** Reason shown to user (allow/ask) or Claude (deny) */\n permissionDecisionReason?: string\n\n /** Modified tool input parameters */\n updatedInput?: Record<string, unknown>\n}\n\n/**\n * PostToolUse hook-specific output\n */\nexport interface PostToolUseOutput {\n hookEventName: HookEvent.PostToolUse\n\n /** Additional context for Claude to consider */\n additionalContext?: string\n}\n\n/**\n * UserPromptSubmit hook-specific output\n */\nexport interface UserPromptSubmitOutput {\n hookEventName: HookEvent.UserPromptSubmit\n\n /** Additional context to add to conversation */\n additionalContext?: string\n}\n\n/**\n * SessionStart hook-specific output\n */\nexport interface SessionStartOutput {\n hookEventName: HookEvent.SessionStart\n\n /** Additional context to load at session start */\n additionalContext?: string\n}\n\n/**\n * Hook execution result (internal)\n */\nexport interface HookExecutionResult {\n /** Whether hook execution succeeded */\n success: boolean\n\n /** Exit code from hook command */\n exitCode: number\n\n /** Standard output */\n stdout: string\n\n /** Standard error */\n stderr: string\n\n /** Parsed JSON output (if valid) */\n output?: HookOutput\n\n /** Error if execution failed */\n error?: Error\n\n /** Execution time in milliseconds */\n executionTime: number\n}\n\n/**\n * Zod schema for hooks.json validation\n */\nexport const HookDefinitionSchema = z.object({\n type: z.enum(['command', 'prompt']),\n command: z.string().optional(),\n prompt: z.string().optional(),\n timeout: z.number().optional(),\n description: z.string().optional(),\n})\n\nexport const HookMatcherSchema = z.object({\n matcher: z.string().optional(),\n hooks: z.array(HookDefinitionSchema),\n})\n\nexport const HooksConfigSchema = z.object({\n description: z.string().optional(),\n hooks: z.record(
|
|
5
|
-
"mappings": "AAOA,SAAS,SAAS;AAKX,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,iBAAc;AACd,EAAAA,WAAA,sBAAmB;AACnB,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,gBAAa;AATH,SAAAA;AAAA,GAAA;AAoQL,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,MAAM,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;AAAA,EAClC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,SAAS;AACnC,CAAC;AAEM,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,OAAO,EAAE,MAAM,oBAAoB;AACrC,CAAC;AAEM,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,OAAO,
|
|
4
|
+
"sourcesContent": ["/**\n * Hooks System Type Definitions\n *\n * Fully compatible with Claude Code CLI hooks specification:\n * https://code.claude.com/docs/en/hooks\n */\n\nimport { z } from 'zod'\n\n/**\n * Hook lifecycle events\n */\nexport enum HookEvent {\n PreToolUse = 'PreToolUse',\n PostToolUse = 'PostToolUse',\n UserPromptSubmit = 'UserPromptSubmit',\n SessionStart = 'SessionStart',\n SessionEnd = 'SessionEnd',\n Stop = 'Stop',\n SubagentStop = 'SubagentStop',\n Notification = 'Notification',\n PreCompact = 'PreCompact',\n}\n\n/**\n * Hook execution types\n */\nexport type HookType = 'command' | 'prompt'\n\n/**\n * Hook matcher configuration\n */\nexport interface HookMatcher {\n /** Pattern to match tool names (regex supported). Use \"*\" or \"\" to match all. */\n matcher?: string\n\n /** Array of hooks to execute when matcher matches */\n hooks: HookDefinition[]\n}\n\n/**\n * Individual hook definition\n */\nexport interface HookDefinition {\n /** Hook execution type */\n type: HookType\n\n /** Bash command to execute (for type=\"command\") */\n command?: string\n\n /** Prompt to send to LLM (for type=\"prompt\") */\n prompt?: string\n\n /** Optional timeout in seconds (default: 60) */\n timeout?: number\n\n /** Optional description of what this hook does */\n description?: string\n}\n\n/**\n * hooks.json file schema\n */\nexport interface HooksConfig {\n /** Optional description for plugin hooks */\n description?: string\n\n /** Hook configurations by event type */\n hooks: Partial<Record<HookEvent, HookMatcher[]>>\n}\n\n/**\n * Hook execution input (passed to hook as JSON stdin)\n */\nexport interface HookInput {\n /** Session identifier */\n session_id: string\n\n /** Path to conversation transcript */\n transcript_path: string\n\n /** Current working directory */\n cwd: string\n\n /** Permission mode (default, plan, acceptEdits, bypassPermissions) */\n permission_mode: string\n\n /** Hook event name */\n hook_event_name: HookEvent\n\n /** Event-specific additional fields */\n [key: string]: any\n}\n\n/**\n * PreToolUse hook input\n */\nexport interface PreToolUseInput extends HookInput {\n hook_event_name: HookEvent.PreToolUse\n tool_name: string\n tool_input: Record<string, unknown>\n}\n\n/**\n * PostToolUse hook input\n */\nexport interface PostToolUseInput extends HookInput {\n hook_event_name: HookEvent.PostToolUse\n tool_name: string\n tool_input: Record<string, unknown>\n tool_output: Record<string, unknown>\n}\n\n/**\n * UserPromptSubmit hook input\n */\nexport interface UserPromptSubmitInput extends HookInput {\n hook_event_name: HookEvent.UserPromptSubmit\n user_prompt: string\n}\n\n/**\n * SessionStart hook input\n */\nexport interface SessionStartInput extends HookInput {\n hook_event_name: HookEvent.SessionStart\n source: 'startup' | 'resume' | 'clear' | 'compact'\n}\n\n/**\n * SessionEnd hook input\n */\nexport interface SessionEndInput extends HookInput {\n hook_event_name: HookEvent.SessionEnd\n reason: 'clear' | 'logout' | 'prompt_input_exit' | 'other'\n}\n\n/**\n * Stop/SubagentStop hook input\n */\nexport interface StopInput extends HookInput {\n hook_event_name: HookEvent.Stop | HookEvent.SubagentStop\n stop_hook_active: boolean\n}\n\n/**\n * Notification hook input\n */\nexport interface NotificationInput extends HookInput {\n hook_event_name: HookEvent.Notification\n message: string\n}\n\n/**\n * PreCompact hook input\n */\nexport interface PreCompactInput extends HookInput {\n hook_event_name: HookEvent.PreCompact\n trigger: 'manual' | 'auto'\n custom_instructions: string\n}\n\n/**\n * Hook execution output (from hook stdout as JSON)\n */\nexport interface HookOutput {\n /** Whether Claude should continue after hook execution */\n continue?: boolean\n\n /** Message shown when continue is false */\n stopReason?: string\n\n /** Hide stdout from transcript mode */\n suppressOutput?: boolean\n\n /** Optional warning message shown to user */\n systemMessage?: string\n\n /** Hook-specific output fields */\n hookSpecificOutput?: HookSpecificOutput\n\n /** Deprecated: Use hookSpecificOutput.permissionDecision instead */\n decision?: 'approve' | 'block'\n\n /** Deprecated: Use hookSpecificOutput.permissionDecisionReason instead */\n reason?: string\n}\n\n/**\n * Hook-specific output for different events\n */\nexport type HookSpecificOutput =\n | PreToolUseOutput\n | PostToolUseOutput\n | UserPromptSubmitOutput\n | SessionStartOutput\n\n/**\n * PreToolUse hook-specific output\n */\nexport interface PreToolUseOutput {\n hookEventName: HookEvent.PreToolUse\n\n /** Permission decision: allow (bypass), deny (block), ask (prompt user) */\n permissionDecision: 'allow' | 'deny' | 'ask'\n\n /** Reason shown to user (allow/ask) or Claude (deny) */\n permissionDecisionReason?: string\n\n /** Modified tool input parameters */\n updatedInput?: Record<string, unknown>\n}\n\n/**\n * PostToolUse hook-specific output\n */\nexport interface PostToolUseOutput {\n hookEventName: HookEvent.PostToolUse\n\n /** Additional context for Claude to consider */\n additionalContext?: string\n}\n\n/**\n * UserPromptSubmit hook-specific output\n */\nexport interface UserPromptSubmitOutput {\n hookEventName: HookEvent.UserPromptSubmit\n\n /** Additional context to add to conversation */\n additionalContext?: string\n}\n\n/**\n * SessionStart hook-specific output\n */\nexport interface SessionStartOutput {\n hookEventName: HookEvent.SessionStart\n\n /** Additional context to load at session start */\n additionalContext?: string\n}\n\n/**\n * Hook execution result (internal)\n */\nexport interface HookExecutionResult {\n /** Whether hook execution succeeded */\n success: boolean\n\n /** Exit code from hook command */\n exitCode: number\n\n /** Standard output */\n stdout: string\n\n /** Standard error */\n stderr: string\n\n /** Parsed JSON output (if valid) */\n output?: HookOutput\n\n /** Error if execution failed */\n error?: Error\n\n /** Execution time in milliseconds */\n executionTime: number\n}\n\n/**\n * Zod schema for hooks.json validation\n */\nexport const HookDefinitionSchema = z.object({\n type: z.enum(['command', 'prompt']),\n command: z.string().optional(),\n prompt: z.string().optional(),\n timeout: z.number().optional(),\n description: z.string().optional(),\n})\n\nexport const HookMatcherSchema = z.object({\n matcher: z.string().optional(),\n hooks: z.array(HookDefinitionSchema),\n})\n\nexport const HooksConfigSchema = z.object({\n description: z.string().optional(),\n hooks: z\n .record(z.nativeEnum(HookEvent), z.array(HookMatcherSchema))\n .optional(),\n})\n\n/**\n * Hook execution context (passed to executor)\n */\nexport interface HookExecutionContext {\n /** Hook definition to execute */\n hook: HookDefinition\n\n /** Hook input data */\n input: HookInput\n\n /** Environment variables to pass to hook */\n env?: Record<string, string>\n\n /** Abort signal for cancellation */\n abortSignal?: AbortSignal\n}\n\n/**\n * Hook decision result (processed from hook output)\n */\nexport interface HookDecision {\n /** Allow the action */\n allow: boolean\n\n /** Block the action */\n block: boolean\n\n /** Ask user for confirmation */\n ask: boolean\n\n /** Reason for decision */\n reason?: string\n\n /** Message to show to user */\n systemMessage?: string\n\n /** Stop execution entirely */\n stop: boolean\n\n /** Stop reason */\n stopReason?: string\n\n /** Additional context to inject */\n additionalContext?: string\n\n /** Modified tool input (for PreToolUse) */\n updatedInput?: Record<string, unknown>\n}\n\n/**\n * Loaded hook (runtime representation)\n */\nexport interface LoadedHook {\n /** Hook name/identifier */\n name: string\n\n /** File path to hook definition */\n filePath: string\n\n /** Hook configuration */\n config: HookDefinition\n\n /** Source plugin name */\n pluginName: string\n\n /** Hook event this hook responds to */\n event: HookEvent\n\n /** Matcher pattern (if applicable) */\n matcher?: string\n}\n"],
|
|
5
|
+
"mappings": "AAOA,SAAS,SAAS;AAKX,IAAK,YAAL,kBAAKA,eAAL;AACL,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,iBAAc;AACd,EAAAA,WAAA,sBAAmB;AACnB,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,gBAAa;AACb,EAAAA,WAAA,UAAO;AACP,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,kBAAe;AACf,EAAAA,WAAA,gBAAa;AATH,SAAAA;AAAA,GAAA;AAoQL,MAAM,uBAAuB,EAAE,OAAO;AAAA,EAC3C,MAAM,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;AAAA,EAClC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,SAAS;AACnC,CAAC;AAEM,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,OAAO,EAAE,MAAM,oBAAoB;AACrC,CAAC;AAEM,MAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,OAAO,EACJ,OAAO,EAAE,WAAW,SAAS,GAAG,EAAE,MAAM,iBAAiB,CAAC,EAC1D,SAAS;AACd,CAAC;",
|
|
6
6
|
"names": ["HookEvent"]
|
|
7
7
|
}
|
|
@@ -31,7 +31,10 @@ const AuthorSchema = z.union([
|
|
|
31
31
|
]);
|
|
32
32
|
const MarketplacePluginSchema = z.object({
|
|
33
33
|
// Required
|
|
34
|
-
name: z.string().min(1).regex(
|
|
34
|
+
name: z.string().min(1).regex(
|
|
35
|
+
/^[a-z0-9-]+$/,
|
|
36
|
+
"Plugin name must be lowercase alphanumeric with hyphens"
|
|
37
|
+
),
|
|
35
38
|
source: PluginSourceSchema,
|
|
36
39
|
// Optional metadata
|
|
37
40
|
description: z.string().optional(),
|
|
@@ -64,7 +67,10 @@ const MarketplaceMetadataSchema = z.object({
|
|
|
64
67
|
// Base path for relative sources
|
|
65
68
|
});
|
|
66
69
|
const MarketplaceManifestSchema = z.object({
|
|
67
|
-
name: z.string().min(1).regex(
|
|
70
|
+
name: z.string().min(1).regex(
|
|
71
|
+
/^[a-z0-9-]+$/,
|
|
72
|
+
"Marketplace name must be lowercase alphanumeric with hyphens"
|
|
73
|
+
),
|
|
68
74
|
owner: MarketplaceOwnerSchema,
|
|
69
75
|
plugins: z.array(MarketplacePluginSchema),
|
|
70
76
|
metadata: MarketplaceMetadataSchema.optional()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types/marketplace.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Plugin Marketplace Type Definitions\n *\n * Compatible with Claude Code CLI marketplace specification:\n * https://docs.claude.com/en/docs/claude-code/plugin-marketplaces\n */\n\nimport { z } from 'zod'\n\n/**\n * Plugin source types for marketplace entries\n */\nexport const PluginSourceSchema = z.union([\n // Relative path (within same repository)\n z.string(),\n\n // GitHub repository\n z.object({\n source: z.literal('github'),\n repo: z.string().regex(/^[\\w-]+\\/[\\w-]+$/, 'Must be in format: owner/repo'),\n ref: z.string().optional(), // branch, tag, or commit SHA\n }),\n\n // Generic git URL\n z.object({\n source: z.literal('url'),\n url: z.string().url(),\n ref: z.string().optional(),\n }),\n\n // Local path\n z.object({\n source: z.literal('local'),\n path: z.string(),\n }),\n])\n\nexport type PluginSourceType = z.infer<typeof PluginSourceSchema>\n\n/**\n * Author information (can be string or object)\n */\nexport const AuthorSchema = z.union([\n z.string(),\n z.object({\n name: z.string(),\n email: z.string().email().optional(),\n url: z.string().url().optional(),\n })
|
|
5
|
-
"mappings": "AAOA,SAAS,SAAS;AAKX,MAAM,qBAAqB,EAAE,MAAM;AAAA;AAAA,EAExC,EAAE,OAAO;AAAA;AAAA,EAGT,EAAE,OAAO;AAAA,IACP,QAAQ,EAAE,QAAQ,QAAQ;AAAA,IAC1B,MAAM,EAAE,OAAO,EAAE,MAAM,oBAAoB,+BAA+B;AAAA,IAC1E,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAC3B,CAAC;AAAA;AAAA,EAGD,EAAE,OAAO;AAAA,IACP,QAAQ,EAAE,QAAQ,KAAK;AAAA,IACvB,KAAK,EAAE,OAAO,EAAE,IAAI;AAAA,IACpB,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,CAAC;AAAA;AAAA,EAGD,EAAE,OAAO;AAAA,IACP,QAAQ,EAAE,QAAQ,OAAO;AAAA,IACzB,MAAM,EAAE,OAAO;AAAA,EACjB,CAAC;AACH,CAAC;AAOM,MAAM,eAAe,EAAE,MAAM;AAAA,EAClC,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,OAAO;AAAA,IACf,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS;AAAA,IACnC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACjC,CAAC;AACH,CAAC;AAKM,MAAM,0BAA0B,EAAE,OAAO;AAAA;AAAA,EAE9C,MAAM,
|
|
4
|
+
"sourcesContent": ["/**\n * Plugin Marketplace Type Definitions\n *\n * Compatible with Claude Code CLI marketplace specification:\n * https://docs.claude.com/en/docs/claude-code/plugin-marketplaces\n */\n\nimport { z } from 'zod'\n\n/**\n * Plugin source types for marketplace entries\n */\nexport const PluginSourceSchema = z.union([\n // Relative path (within same repository)\n z.string(),\n\n // GitHub repository\n z.object({\n source: z.literal('github'),\n repo: z.string().regex(/^[\\w-]+\\/[\\w-]+$/, 'Must be in format: owner/repo'),\n ref: z.string().optional(), // branch, tag, or commit SHA\n }),\n\n // Generic git URL\n z.object({\n source: z.literal('url'),\n url: z.string().url(),\n ref: z.string().optional(),\n }),\n\n // Local path\n z.object({\n source: z.literal('local'),\n path: z.string(),\n }),\n])\n\nexport type PluginSourceType = z.infer<typeof PluginSourceSchema>\n\n/**\n * Author information (can be string or object)\n */\nexport const AuthorSchema = z.union([\n z.string(),\n z.object({\n name: z.string(),\n email: z.string().email().optional(),\n url: z.string().url().optional(),\n }),\n])\n\n/**\n * Marketplace plugin entry\n */\nexport const MarketplacePluginSchema = z.object({\n // Required\n name: z\n .string()\n .min(1)\n .regex(\n /^[a-z0-9-]+$/,\n 'Plugin name must be lowercase alphanumeric with hyphens',\n ),\n source: PluginSourceSchema,\n\n // Optional metadata\n description: z.string().optional(),\n version: z.string().optional(),\n author: AuthorSchema.optional(),\n homepage: z.string().url().optional(),\n repository: z.string().url().optional(),\n license: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n category: z.string().optional(),\n tags: z.array(z.string()).optional(),\n\n // Component paths (relative to plugin root)\n commands: z.array(z.string()).optional(),\n agents: z.array(z.string()).optional(),\n hooks: z.array(z.string()).optional(),\n mcpServers: z.array(z.string()).optional(),\n skills: z.array(z.string()).optional(),\n\n // Strict mode: require plugin.json in plugin directory\n strict: z.boolean().optional().default(true),\n})\n\nexport type MarketplacePlugin = z.infer<typeof MarketplacePluginSchema>\n\n/**\n * Marketplace owner information\n */\nexport const MarketplaceOwnerSchema = z.object({\n name: z.string(),\n email: z.string().email().optional(),\n url: z.string().url().optional(),\n})\n\nexport type MarketplaceOwner = z.infer<typeof MarketplaceOwnerSchema>\n\n/**\n * Marketplace metadata\n */\nexport const MarketplaceMetadataSchema = z.object({\n description: z.string().optional(),\n version: z.string().optional(),\n pluginRoot: z.string().optional(), // Base path for relative sources\n})\n\nexport type MarketplaceMetadata = z.infer<typeof MarketplaceMetadataSchema>\n\n/**\n * Marketplace manifest (marketplace.json)\n */\nexport const MarketplaceManifestSchema = z.object({\n name: z\n .string()\n .min(1)\n .regex(\n /^[a-z0-9-]+$/,\n 'Marketplace name must be lowercase alphanumeric with hyphens',\n ),\n owner: MarketplaceOwnerSchema,\n plugins: z.array(MarketplacePluginSchema),\n metadata: MarketplaceMetadataSchema.optional(),\n})\n\nexport type MarketplaceManifest = z.infer<typeof MarketplaceManifestSchema>\n\n/**\n * Marketplace configuration source\n */\nexport type MarketplaceSource =\n | { type: 'github'; repo: string; ref?: string }\n | { type: 'url'; url: string; ref?: string }\n | { type: 'local'; path: string }\n\n/**\n * Registered marketplace\n */\nexport interface RegisteredMarketplace {\n name: string\n source: MarketplaceSource\n manifest: MarketplaceManifest\n lastUpdated: Date\n enabled: boolean\n}\n\n/**\n * Marketplace configuration in .claude/settings.json\n */\nexport interface MarketplaceSettings {\n extraKnownMarketplaces?: Record<\n string,\n {\n source: {\n source: 'github' | 'url' | 'local'\n repo?: string\n url?: string\n path?: string\n ref?: string\n }\n }\n >\n}\n\n/**\n * Marketplace error types\n */\nexport class MarketplaceError extends Error {\n constructor(\n message: string,\n public code: MarketplaceErrorCode,\n public marketplaceName?: string,\n public details?: any,\n ) {\n super(message)\n this.name = 'MarketplaceError'\n }\n}\n\nexport enum MarketplaceErrorCode {\n MANIFEST_INVALID = 'MANIFEST_INVALID',\n MANIFEST_NOT_FOUND = 'MANIFEST_NOT_FOUND',\n NETWORK_ERROR = 'NETWORK_ERROR',\n GIT_ERROR = 'GIT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AuB;AAAA,EACxC,UAAU,0BAA0B,SAAS;AAC/C,CAAC;AA4CM,MAAM,yBAAyB,MAAM;AAAA,EAC1C,YACE,SACO,MACA,iBACA,SACP;AACA,UAAM,OAAO;AAJN;AACA;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAK,uBAAL,kBAAKA,0BAAL;AACL,EAAAA,sBAAA,sBAAmB;AACnB,EAAAA,sBAAA,wBAAqB;AACrB,EAAAA,sBAAA,mBAAgB;AAChB,EAAAA,sBAAA,eAAY;AACZ,EAAAA,sBAAA,wBAAqB;AACrB,EAAAA,sBAAA,oBAAiB;AACjB,EAAAA,sBAAA,sBAAmB;AAPT,SAAAA;AAAA,GAAA;",
|
|
6
6
|
"names": ["MarketplaceErrorCode"]
|
|
7
7
|
}
|
package/dist/types/plugin.js
CHANGED
|
@@ -20,8 +20,14 @@ const MCPServerConfigSchema = z.object({
|
|
|
20
20
|
});
|
|
21
21
|
const PluginManifestSchema = z.object({
|
|
22
22
|
// Required fields
|
|
23
|
-
name: z.string().min(1).regex(
|
|
24
|
-
|
|
23
|
+
name: z.string().min(1).regex(
|
|
24
|
+
/^[a-z0-9-]+$/,
|
|
25
|
+
"Plugin name must be lowercase alphanumeric with hyphens"
|
|
26
|
+
),
|
|
27
|
+
version: z.string().regex(
|
|
28
|
+
/^\d+\.\d+\.\d+$/,
|
|
29
|
+
"Version must follow semver format (e.g., 1.0.0)"
|
|
30
|
+
),
|
|
25
31
|
description: z.string().min(1),
|
|
26
32
|
// Optional metadata
|
|
27
33
|
displayName: z.string().optional(),
|
|
@@ -37,10 +43,7 @@ const PluginManifestSchema = z.object({
|
|
|
37
43
|
// MCP servers support both:
|
|
38
44
|
// - Array of file paths: ["mcp-servers/server1.json"]
|
|
39
45
|
// - Object with inline configs: { "server1": { command: "..." } }
|
|
40
|
-
mcpServers: z.union([
|
|
41
|
-
z.array(z.string()),
|
|
42
|
-
z.record(MCPServerConfigSchema)
|
|
43
|
-
]).optional().default([]),
|
|
46
|
+
mcpServers: z.union([z.array(z.string()), z.record(MCPServerConfigSchema)]).optional().default([]),
|
|
44
47
|
// Dependencies
|
|
45
48
|
dependencies: z.record(z.string()).optional().default({}),
|
|
46
49
|
// Minto/Claude Code version requirements
|
package/dist/types/plugin.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types/plugin.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Plugin System Type Definitions\n *\n * Fully compatible with Claude Code CLI plugin specification:\n * https://docs.claude.com/en/docs/claude-code/plugins-reference\n */\n\nimport { z } from 'zod'\n\n/**\n * Author information (can be string or object)\n */\nexport const AuthorSchema = z.union([\n z.string(),\n z.object({\n name: z.string(),\n email: z.string().email().optional(),\n url: z.string().url().optional(),\n })
|
|
5
|
-
"mappings": "AAOA,SAAS,SAAS;AAKX,MAAM,eAAe,EAAE,MAAM;AAAA,EAClC,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,OAAO;AAAA,IACf,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS;AAAA,IACnC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EACjC,CAAC;AACH,CAAC;AAMM,MAAM,wBAAwB,EAAE,OAAO;AAAA;AAAA,EAE5C,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAC/C,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAC/C,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA;AAAA,EAG7B,MAAM,EAAE,KAAK,CAAC,SAAS,QAAQ,KAAK,CAAC,EAAE,SAAS,EAAE,QAAQ,OAAO;AAAA,EACjE,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,EACzB,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,SAAS;AACzC,CAAC;AAQM,MAAM,uBAAuB,EAAE,OAAO;AAAA;AAAA,EAE3C,MAAM,
|
|
4
|
+
"sourcesContent": ["/**\n * Plugin System Type Definitions\n *\n * Fully compatible with Claude Code CLI plugin specification:\n * https://docs.claude.com/en/docs/claude-code/plugins-reference\n */\n\nimport { z } from 'zod'\n\n/**\n * Author information (can be string or object)\n */\nexport const AuthorSchema = z.union([\n z.string(),\n z.object({\n name: z.string(),\n email: z.string().email().optional(),\n url: z.string().url().optional(),\n }),\n])\n\n/**\n * MCP Server Configuration Schema\n * Compatible with Claude Code CLI's .mcp.json format\n */\nexport const MCPServerConfigSchema = z.object({\n // Command-based (stdio) servers\n command: z.string().optional(),\n args: z.array(z.string()).optional().default([]),\n env: z.record(z.string()).optional().default({}),\n timeout: z.number().optional(),\n\n // HTTP/SSE servers\n type: z.enum(['stdio', 'http', 'sse']).optional().default('stdio'),\n url: z.string().optional(),\n headers: z.record(z.string()).optional(),\n})\n\nexport type MCPServerConfig = z.infer<typeof MCPServerConfigSchema>\n\n/**\n * Plugin Manifest Schema (plugin.json)\n * This is the source of truth for plugin metadata\n */\nexport const PluginManifestSchema = z.object({\n // Required fields\n name: z\n .string()\n .min(1)\n .regex(\n /^[a-z0-9-]+$/,\n 'Plugin name must be lowercase alphanumeric with hyphens',\n ),\n version: z\n .string()\n .regex(\n /^\\d+\\.\\d+\\.\\d+$/,\n 'Version must follow semver format (e.g., 1.0.0)',\n ),\n description: z.string().min(1),\n\n // Optional metadata\n displayName: z.string().optional(),\n author: AuthorSchema.optional(),\n homepage: z.string().url().optional(),\n repository: z.string().url().optional(),\n license: z.string().optional(),\n\n // Plugin components (relative paths from plugin root)\n agents: z.array(z.string()).optional().default([]),\n commands: z.array(z.string()).optional().default([]),\n skills: z.array(z.string()).optional().default([]),\n hooks: z.array(z.string()).optional().default([]),\n\n // MCP servers support both:\n // - Array of file paths: [\"mcp-servers/server1.json\"]\n // - Object with inline configs: { \"server1\": { command: \"...\" } }\n mcpServers: z\n .union([z.array(z.string()), z.record(MCPServerConfigSchema)])\n .optional()\n .default([]),\n\n // Dependencies\n dependencies: z.record(z.string()).optional().default({}),\n\n // Minto/Claude Code version requirements\n engines: z\n .object({\n minto: z.string().optional(),\n 'claude-code': z.string().optional(),\n node: z.string().optional(),\n })\n .optional(),\n\n // Plugin-specific configuration schema\n configSchema: z.record(z.any()).optional(),\n})\n\nexport type PluginManifest = z.infer<typeof PluginManifestSchema>\n\n/**\n * Loaded Plugin (runtime representation)\n */\nexport interface LoadedPlugin {\n name: string\n manifest: PluginManifest\n location: string // Absolute path to plugin directory\n source: PluginSource\n agents: LoadedAgent[]\n commands: LoadedCommand[]\n skills: LoadedSkill[]\n hooks: LoadedHook[]\n mcpServers: LoadedMCPServer[]\n enabled: boolean\n config?: Record<string, any>\n}\n\n/**\n * Plugin source types\n */\nexport type PluginSource =\n | { type: 'local'; path: string }\n | { type: 'git'; repo: string; ref?: string }\n | { type: 'npm'; package: string; version?: string }\n | { type: 'marketplace'; marketplace: string; name: string }\n\n/**\n * Agent component (from plugin)\n */\nexport interface LoadedAgent {\n name: string\n filePath: string\n config: {\n name: string\n description: string\n tools?: string | string[]\n model?: string\n content: string\n }\n pluginName: string\n}\n\n/**\n * Command component (from plugin)\n */\nexport interface LoadedCommand {\n name: string\n filePath: string\n config: {\n name: string\n description?: string\n aliases?: string[]\n enabled?: boolean\n hidden?: boolean\n progressMessage?: string\n argNames?: string[]\n 'allowed-tools'?: string[]\n content: string\n }\n pluginName: string\n}\n\n/**\n * Skill component (from plugin)\n */\nexport interface LoadedSkill {\n name: string\n filePath: string\n config: {\n name: string\n description: string\n content: string\n }\n pluginName: string\n}\n\n/**\n * Hook component (from plugin)\n */\nexport interface LoadedHook {\n name: string\n filePath: string\n config: {\n event: HookEvent\n matcher?: string\n type: 'command' | 'message' | 'notification'\n command?: string\n message?: string\n blocking?: boolean\n timeout?: number\n }\n pluginName: string\n event: HookEvent // Also store event at root level for easier access\n matcher?: string // Also store matcher at root level\n}\n\n/**\n * Hook lifecycle events\n */\nexport type HookEvent =\n | 'PreToolUse'\n | 'PostToolUse'\n | 'UserPromptSubmit'\n | 'SessionStart'\n | 'SessionEnd'\n | 'Stop'\n | 'SubagentStop'\n | 'Notification'\n | 'PreCompact'\n\n/**\n * MCP Server component (from plugin)\n */\nexport interface LoadedMCPServer {\n name: string\n filePath: string\n config: {\n command: string\n args?: string[]\n env?: Record<string, string>\n timeout?: number\n }\n pluginName: string\n}\n\n/**\n * Plugin installation options\n */\nexport interface PluginInstallOptions {\n source: PluginSource\n global?: boolean // Install globally vs project-level\n enable?: boolean // Auto-enable after install\n config?: Record<string, any> // Plugin-specific config\n}\n\n/**\n * Plugin marketplace configuration\n */\nexport interface PluginMarketplace {\n name: string\n source: PluginSource\n plugins: PluginManifest[]\n}\n\n/**\n * Plugin error types\n */\nexport class PluginError extends Error {\n constructor(\n message: string,\n public code: PluginErrorCode,\n public pluginName?: string,\n public details?: any,\n ) {\n super(message)\n this.name = 'PluginError'\n }\n}\n\nexport enum PluginErrorCode {\n MANIFEST_INVALID = 'MANIFEST_INVALID',\n MANIFEST_NOT_FOUND = 'MANIFEST_NOT_FOUND',\n VERSION_MISMATCH = 'VERSION_MISMATCH',\n DEPENDENCY_MISSING = 'DEPENDENCY_MISSING',\n COMPONENT_NOT_FOUND = 'COMPONENT_NOT_FOUND',\n COMPONENT_INVALID = 'COMPONENT_INVALID',\n ALREADY_INSTALLED = 'ALREADY_INSTALLED',\n NOT_INSTALLED = 'NOT_INSTALLED',\n PERMISSION_DENIED = 'PERMISSION_DENIED',\n}\n"],
|
|
5
|
+
"mappings": "AAOA,SAAS,SAAS;AAKX,MAAM,eAAe,EAAE,MAAM;AAAA,EAClC,EAAE,OAAO;AAAA,EACT,EAAE,OAAO;AAAA,IACP,MAAM,EAAE,OAAO;AAAA,IACf,OAAO,EAAE,OAAO,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