@deepseekdev/coder 1.0.74
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/LICENSE +21 -0
- package/agents/agi-code.rules.json +159 -0
- package/agents/general.rules.json +181 -0
- package/dist/bin/cliMode.d.ts +8 -0
- package/dist/bin/cliMode.d.ts.map +1 -0
- package/dist/bin/cliMode.js +20 -0
- package/dist/bin/cliMode.js.map +1 -0
- package/dist/bin/deepseek.d.ts +3 -0
- package/dist/bin/deepseek.d.ts.map +1 -0
- package/dist/bin/deepseek.js +137 -0
- package/dist/bin/deepseek.js.map +1 -0
- package/dist/bin/erosolar.d.ts +7 -0
- package/dist/bin/erosolar.d.ts.map +1 -0
- package/dist/bin/erosolar.js +7 -0
- package/dist/bin/erosolar.js.map +1 -0
- package/dist/bin/lean.d.ts +9 -0
- package/dist/bin/lean.d.ts.map +1 -0
- package/dist/bin/lean.js +333 -0
- package/dist/bin/lean.js.map +1 -0
- package/dist/bin/selfTest.d.ts +14 -0
- package/dist/bin/selfTest.d.ts.map +1 -0
- package/dist/bin/selfTest.js +298 -0
- package/dist/bin/selfTest.js.map +1 -0
- package/dist/capabilities/baseCapability.d.ts +72 -0
- package/dist/capabilities/baseCapability.d.ts.map +1 -0
- package/dist/capabilities/baseCapability.js +183 -0
- package/dist/capabilities/baseCapability.js.map +1 -0
- package/dist/capabilities/bashCapability.d.ts +13 -0
- package/dist/capabilities/bashCapability.d.ts.map +1 -0
- package/dist/capabilities/bashCapability.js +24 -0
- package/dist/capabilities/bashCapability.js.map +1 -0
- package/dist/capabilities/editCapability.d.ts +17 -0
- package/dist/capabilities/editCapability.d.ts.map +1 -0
- package/dist/capabilities/editCapability.js +27 -0
- package/dist/capabilities/editCapability.js.map +1 -0
- package/dist/capabilities/enhancedGitCapability.d.ts +7 -0
- package/dist/capabilities/enhancedGitCapability.d.ts.map +1 -0
- package/dist/capabilities/enhancedGitCapability.js +220 -0
- package/dist/capabilities/enhancedGitCapability.js.map +1 -0
- package/dist/capabilities/filesystemCapability.d.ts +13 -0
- package/dist/capabilities/filesystemCapability.d.ts.map +1 -0
- package/dist/capabilities/filesystemCapability.js +24 -0
- package/dist/capabilities/filesystemCapability.js.map +1 -0
- package/dist/capabilities/gitHistoryCapability.d.ts +6 -0
- package/dist/capabilities/gitHistoryCapability.d.ts.map +1 -0
- package/dist/capabilities/gitHistoryCapability.js +160 -0
- package/dist/capabilities/gitHistoryCapability.js.map +1 -0
- package/dist/capabilities/hitlCapability.d.ts +18 -0
- package/dist/capabilities/hitlCapability.d.ts.map +1 -0
- package/dist/capabilities/hitlCapability.js +29 -0
- package/dist/capabilities/hitlCapability.js.map +1 -0
- package/dist/capabilities/index.d.ts +11 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +13 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/searchCapability.d.ts +19 -0
- package/dist/capabilities/searchCapability.d.ts.map +1 -0
- package/dist/capabilities/searchCapability.js +29 -0
- package/dist/capabilities/searchCapability.js.map +1 -0
- package/dist/capabilities/toolManifest.d.ts +3 -0
- package/dist/capabilities/toolManifest.d.ts.map +1 -0
- package/dist/capabilities/toolManifest.js +163 -0
- package/dist/capabilities/toolManifest.js.map +1 -0
- package/dist/capabilities/toolRegistry.d.ts +25 -0
- package/dist/capabilities/toolRegistry.d.ts.map +1 -0
- package/dist/capabilities/toolRegistry.js +150 -0
- package/dist/capabilities/toolRegistry.js.map +1 -0
- package/dist/capabilities/unifiedCodingCapability.d.ts +48 -0
- package/dist/capabilities/unifiedCodingCapability.d.ts.map +1 -0
- package/dist/capabilities/unifiedCodingCapability.js +631 -0
- package/dist/capabilities/unifiedCodingCapability.js.map +1 -0
- package/dist/capabilities/webCapability.d.ts +23 -0
- package/dist/capabilities/webCapability.d.ts.map +1 -0
- package/dist/capabilities/webCapability.js +33 -0
- package/dist/capabilities/webCapability.js.map +1 -0
- package/dist/config.d.ts +25 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +155 -0
- package/dist/config.js.map +1 -0
- package/dist/contracts/agent-profiles.schema.json +43 -0
- package/dist/contracts/agent-schemas.json +480 -0
- package/dist/contracts/models.schema.json +9 -0
- package/dist/contracts/module-schema.json +430 -0
- package/dist/contracts/schemas/agent-profile.schema.json +157 -0
- package/dist/contracts/schemas/agent-rules.schema.json +238 -0
- package/dist/contracts/schemas/agent-schemas.schema.json +528 -0
- package/dist/contracts/schemas/agent.schema.json +90 -0
- package/dist/contracts/schemas/tool-selection.schema.json +174 -0
- package/dist/contracts/tools.schema.json +82 -0
- package/dist/contracts/unified-schema.json +757 -0
- package/dist/contracts/v1/agent.d.ts +187 -0
- package/dist/contracts/v1/agent.d.ts.map +1 -0
- package/dist/contracts/v1/agent.js +8 -0
- package/dist/contracts/v1/agent.js.map +1 -0
- package/dist/contracts/v1/agentProfileManifest.d.ts +60 -0
- package/dist/contracts/v1/agentProfileManifest.d.ts.map +1 -0
- package/dist/contracts/v1/agentProfileManifest.js +9 -0
- package/dist/contracts/v1/agentProfileManifest.js.map +1 -0
- package/dist/contracts/v1/agentRules.d.ts +60 -0
- package/dist/contracts/v1/agentRules.d.ts.map +1 -0
- package/dist/contracts/v1/agentRules.js +10 -0
- package/dist/contracts/v1/agentRules.js.map +1 -0
- package/dist/contracts/v1/provider.d.ts +149 -0
- package/dist/contracts/v1/provider.d.ts.map +1 -0
- package/dist/contracts/v1/provider.js +7 -0
- package/dist/contracts/v1/provider.js.map +1 -0
- package/dist/contracts/v1/tool.d.ts +136 -0
- package/dist/contracts/v1/tool.d.ts.map +1 -0
- package/dist/contracts/v1/tool.js +7 -0
- package/dist/contracts/v1/tool.js.map +1 -0
- package/dist/contracts/v1/toolAccess.d.ts +43 -0
- package/dist/contracts/v1/toolAccess.d.ts.map +1 -0
- package/dist/contracts/v1/toolAccess.js +9 -0
- package/dist/contracts/v1/toolAccess.js.map +1 -0
- package/dist/core/agent.d.ts +320 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +1627 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/agentProfileManifest.d.ts +3 -0
- package/dist/core/agentProfileManifest.d.ts.map +1 -0
- package/dist/core/agentProfileManifest.js +188 -0
- package/dist/core/agentProfileManifest.js.map +1 -0
- package/dist/core/agentProfiles.d.ts +22 -0
- package/dist/core/agentProfiles.d.ts.map +1 -0
- package/dist/core/agentProfiles.js +35 -0
- package/dist/core/agentProfiles.js.map +1 -0
- package/dist/core/agentRulebook.d.ts +11 -0
- package/dist/core/agentRulebook.d.ts.map +1 -0
- package/dist/core/agentRulebook.js +136 -0
- package/dist/core/agentRulebook.js.map +1 -0
- package/dist/core/agentSchemaLoader.d.ts +131 -0
- package/dist/core/agentSchemaLoader.d.ts.map +1 -0
- package/dist/core/agentSchemaLoader.js +235 -0
- package/dist/core/agentSchemaLoader.js.map +1 -0
- package/dist/core/agiCore.d.ts +312 -0
- package/dist/core/agiCore.d.ts.map +1 -0
- package/dist/core/agiCore.js +1585 -0
- package/dist/core/agiCore.js.map +1 -0
- package/dist/core/aiErrorFixer.d.ts +57 -0
- package/dist/core/aiErrorFixer.d.ts.map +1 -0
- package/dist/core/aiErrorFixer.js +214 -0
- package/dist/core/aiErrorFixer.js.map +1 -0
- package/dist/core/bashCommandGuidance.d.ts +16 -0
- package/dist/core/bashCommandGuidance.d.ts.map +1 -0
- package/dist/core/bashCommandGuidance.js +40 -0
- package/dist/core/bashCommandGuidance.js.map +1 -0
- package/dist/core/constants.d.ts +31 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +62 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/contextManager.d.ts +271 -0
- package/dist/core/contextManager.d.ts.map +1 -0
- package/dist/core/contextManager.js +1073 -0
- package/dist/core/contextManager.js.map +1 -0
- package/dist/core/contextWindow.d.ts +42 -0
- package/dist/core/contextWindow.d.ts.map +1 -0
- package/dist/core/contextWindow.js +123 -0
- package/dist/core/contextWindow.js.map +1 -0
- package/dist/core/customCommands.d.ts +19 -0
- package/dist/core/customCommands.d.ts.map +1 -0
- package/dist/core/customCommands.js +85 -0
- package/dist/core/customCommands.js.map +1 -0
- package/dist/core/deepBugAnalyzer.d.ts +25 -0
- package/dist/core/deepBugAnalyzer.d.ts.map +1 -0
- package/dist/core/deepBugAnalyzer.js +44 -0
- package/dist/core/deepBugAnalyzer.js.map +1 -0
- package/dist/core/dynamicGuardrails.d.ts +207 -0
- package/dist/core/dynamicGuardrails.d.ts.map +1 -0
- package/dist/core/dynamicGuardrails.js +455 -0
- package/dist/core/dynamicGuardrails.js.map +1 -0
- package/dist/core/embeddingProviders.d.ts +80 -0
- package/dist/core/embeddingProviders.d.ts.map +1 -0
- package/dist/core/embeddingProviders.js +241 -0
- package/dist/core/embeddingProviders.js.map +1 -0
- package/dist/core/episodicMemory.d.ts +259 -0
- package/dist/core/episodicMemory.d.ts.map +1 -0
- package/dist/core/episodicMemory.js +834 -0
- package/dist/core/episodicMemory.js.map +1 -0
- package/dist/core/errors/apiKeyErrors.d.ts +11 -0
- package/dist/core/errors/apiKeyErrors.d.ts.map +1 -0
- package/dist/core/errors/apiKeyErrors.js +159 -0
- package/dist/core/errors/apiKeyErrors.js.map +1 -0
- package/dist/core/errors/errorTypes.d.ts +111 -0
- package/dist/core/errors/errorTypes.d.ts.map +1 -0
- package/dist/core/errors/errorTypes.js +345 -0
- package/dist/core/errors/errorTypes.js.map +1 -0
- package/dist/core/errors/index.d.ts +50 -0
- package/dist/core/errors/index.d.ts.map +1 -0
- package/dist/core/errors/index.js +156 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/errors/networkErrors.d.ts +14 -0
- package/dist/core/errors/networkErrors.d.ts.map +1 -0
- package/dist/core/errors/networkErrors.js +53 -0
- package/dist/core/errors/networkErrors.js.map +1 -0
- package/dist/core/errors/safetyValidator.d.ts +109 -0
- package/dist/core/errors/safetyValidator.d.ts.map +1 -0
- package/dist/core/errors/safetyValidator.js +271 -0
- package/dist/core/errors/safetyValidator.js.map +1 -0
- package/dist/core/errors.d.ts +4 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +33 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/finalResponseFormatter.d.ts +10 -0
- package/dist/core/finalResponseFormatter.d.ts.map +1 -0
- package/dist/core/finalResponseFormatter.js +14 -0
- package/dist/core/finalResponseFormatter.js.map +1 -0
- package/dist/core/flowProtection.d.ts +154 -0
- package/dist/core/flowProtection.d.ts.map +1 -0
- package/dist/core/flowProtection.js +439 -0
- package/dist/core/flowProtection.js.map +1 -0
- package/dist/core/gitWorktreeManager.d.ts +126 -0
- package/dist/core/gitWorktreeManager.d.ts.map +1 -0
- package/dist/core/gitWorktreeManager.js +403 -0
- package/dist/core/gitWorktreeManager.js.map +1 -0
- package/dist/core/global-macbook-access.d.ts +59 -0
- package/dist/core/global-macbook-access.d.ts.map +1 -0
- package/dist/core/global-macbook-access.js +101 -0
- package/dist/core/global-macbook-access.js.map +1 -0
- package/dist/core/guardrails.d.ts +146 -0
- package/dist/core/guardrails.d.ts.map +1 -0
- package/dist/core/guardrails.js +361 -0
- package/dist/core/guardrails.js.map +1 -0
- package/dist/core/hallucinationGuard.d.ts +57 -0
- package/dist/core/hallucinationGuard.d.ts.map +1 -0
- package/dist/core/hallucinationGuard.js +237 -0
- package/dist/core/hallucinationGuard.js.map +1 -0
- package/dist/core/hitl.d.ts +109 -0
- package/dist/core/hitl.d.ts.map +1 -0
- package/dist/core/hitl.js +371 -0
- package/dist/core/hitl.js.map +1 -0
- package/dist/core/hooks.d.ts +113 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +364 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/hotReload.d.ts +154 -0
- package/dist/core/hotReload.d.ts.map +1 -0
- package/dist/core/hotReload.js +451 -0
- package/dist/core/hotReload.js.map +1 -0
- package/dist/core/hypothesisEngine.d.ts +27 -0
- package/dist/core/hypothesisEngine.d.ts.map +1 -0
- package/dist/core/hypothesisEngine.js +58 -0
- package/dist/core/hypothesisEngine.js.map +1 -0
- package/dist/core/index.d.ts +18 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +40 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/initialExplorer.d.ts +53 -0
- package/dist/core/initialExplorer.d.ts.map +1 -0
- package/dist/core/initialExplorer.js +423 -0
- package/dist/core/initialExplorer.js.map +1 -0
- package/dist/core/inputProtection.d.ts +122 -0
- package/dist/core/inputProtection.d.ts.map +1 -0
- package/dist/core/inputProtection.js +422 -0
- package/dist/core/inputProtection.js.map +1 -0
- package/dist/core/liveGCPVerification.d.ts +41 -0
- package/dist/core/liveGCPVerification.d.ts.map +1 -0
- package/dist/core/liveGCPVerification.js +745 -0
- package/dist/core/liveGCPVerification.js.map +1 -0
- package/dist/core/modelDiscovery.d.ts +105 -0
- package/dist/core/modelDiscovery.d.ts.map +1 -0
- package/dist/core/modelDiscovery.js +768 -0
- package/dist/core/modelDiscovery.js.map +1 -0
- package/dist/core/multilinePasteHandler.d.ts +35 -0
- package/dist/core/multilinePasteHandler.d.ts.map +1 -0
- package/dist/core/multilinePasteHandler.js +81 -0
- package/dist/core/multilinePasteHandler.js.map +1 -0
- package/dist/core/parallelExecutor.d.ts +215 -0
- package/dist/core/parallelExecutor.d.ts.map +1 -0
- package/dist/core/parallelExecutor.js +584 -0
- package/dist/core/parallelExecutor.js.map +1 -0
- package/dist/core/preferences.d.ts +71 -0
- package/dist/core/preferences.d.ts.map +1 -0
- package/dist/core/preferences.js +341 -0
- package/dist/core/preferences.js.map +1 -0
- package/dist/core/productTestHarness.d.ts +46 -0
- package/dist/core/productTestHarness.d.ts.map +1 -0
- package/dist/core/productTestHarness.js +128 -0
- package/dist/core/productTestHarness.js.map +1 -0
- package/dist/core/providerKeys.d.ts +20 -0
- package/dist/core/providerKeys.d.ts.map +1 -0
- package/dist/core/providerKeys.js +40 -0
- package/dist/core/providerKeys.js.map +1 -0
- package/dist/core/resultVerification.d.ts +47 -0
- package/dist/core/resultVerification.d.ts.map +1 -0
- package/dist/core/resultVerification.js +126 -0
- package/dist/core/resultVerification.js.map +1 -0
- package/dist/core/revenueEnvValidator.d.ts +30 -0
- package/dist/core/revenueEnvValidator.d.ts.map +1 -0
- package/dist/core/revenueEnvValidator.js +244 -0
- package/dist/core/revenueEnvValidator.js.map +1 -0
- package/dist/core/schemaValidator.d.ts +49 -0
- package/dist/core/schemaValidator.d.ts.map +1 -0
- package/dist/core/schemaValidator.js +234 -0
- package/dist/core/schemaValidator.js.map +1 -0
- package/dist/core/secretStore.d.ts +48 -0
- package/dist/core/secretStore.d.ts.map +1 -0
- package/dist/core/secretStore.js +295 -0
- package/dist/core/secretStore.js.map +1 -0
- package/dist/core/selfUpgrade.d.ts +79 -0
- package/dist/core/selfUpgrade.d.ts.map +1 -0
- package/dist/core/selfUpgrade.js +92 -0
- package/dist/core/selfUpgrade.js.map +1 -0
- package/dist/core/sessionStorage.d.ts +10 -0
- package/dist/core/sessionStorage.d.ts.map +1 -0
- package/dist/core/sessionStorage.js +46 -0
- package/dist/core/sessionStorage.js.map +1 -0
- package/dist/core/sessionStore.d.ts +35 -0
- package/dist/core/sessionStore.d.ts.map +1 -0
- package/dist/core/sessionStore.js +191 -0
- package/dist/core/sessionStore.js.map +1 -0
- package/dist/core/shutdown.d.ts +34 -0
- package/dist/core/shutdown.d.ts.map +1 -0
- package/dist/core/shutdown.js +173 -0
- package/dist/core/shutdown.js.map +1 -0
- package/dist/core/sudoPasswordManager.d.ts +52 -0
- package/dist/core/sudoPasswordManager.d.ts.map +1 -0
- package/dist/core/sudoPasswordManager.js +115 -0
- package/dist/core/sudoPasswordManager.js.map +1 -0
- package/dist/core/taskCompletionDetector.d.ts +112 -0
- package/dist/core/taskCompletionDetector.d.ts.map +1 -0
- package/dist/core/taskCompletionDetector.js +469 -0
- package/dist/core/taskCompletionDetector.js.map +1 -0
- package/dist/core/testFailureMonitor.d.ts +67 -0
- package/dist/core/testFailureMonitor.d.ts.map +1 -0
- package/dist/core/testFailureMonitor.js +262 -0
- package/dist/core/testFailureMonitor.js.map +1 -0
- package/dist/core/toolPreconditions.d.ts +34 -0
- package/dist/core/toolPreconditions.d.ts.map +1 -0
- package/dist/core/toolPreconditions.js +242 -0
- package/dist/core/toolPreconditions.js.map +1 -0
- package/dist/core/toolRuntime.d.ts +185 -0
- package/dist/core/toolRuntime.d.ts.map +1 -0
- package/dist/core/toolRuntime.js +412 -0
- package/dist/core/toolRuntime.js.map +1 -0
- package/dist/core/types/utilityTypes.d.ts +183 -0
- package/dist/core/types/utilityTypes.d.ts.map +1 -0
- package/dist/core/types/utilityTypes.js +273 -0
- package/dist/core/types/utilityTypes.js.map +1 -0
- package/dist/core/types.d.ts +334 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +76 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/unifiedOrchestrator.d.ts +47 -0
- package/dist/core/unifiedOrchestrator.d.ts.map +1 -0
- package/dist/core/unifiedOrchestrator.js +103 -0
- package/dist/core/unifiedOrchestrator.js.map +1 -0
- package/dist/core/unrestricted-mode.d.ts +42 -0
- package/dist/core/unrestricted-mode.d.ts.map +1 -0
- package/dist/core/unrestricted-mode.js +88 -0
- package/dist/core/unrestricted-mode.js.map +1 -0
- package/dist/core/updateChecker.d.ts +148 -0
- package/dist/core/updateChecker.d.ts.map +1 -0
- package/dist/core/updateChecker.js +593 -0
- package/dist/core/updateChecker.js.map +1 -0
- package/dist/headless/interactiveShell.d.ts +22 -0
- package/dist/headless/interactiveShell.d.ts.map +1 -0
- package/dist/headless/interactiveShell.js +4045 -0
- package/dist/headless/interactiveShell.js.map +1 -0
- package/dist/headless/quickMode.d.ts +26 -0
- package/dist/headless/quickMode.d.ts.map +1 -0
- package/dist/headless/quickMode.js +236 -0
- package/dist/headless/quickMode.js.map +1 -0
- package/dist/leanAgent.d.ts +73 -0
- package/dist/leanAgent.d.ts.map +1 -0
- package/dist/leanAgent.js +175 -0
- package/dist/leanAgent.js.map +1 -0
- package/dist/orchestration/index.d.ts +14 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +12 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/plugins/index.d.ts +49 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +104 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/providers/anthropic/index.d.ts +9 -0
- package/dist/plugins/providers/anthropic/index.d.ts.map +1 -0
- package/dist/plugins/providers/anthropic/index.js +48 -0
- package/dist/plugins/providers/anthropic/index.js.map +1 -0
- package/dist/plugins/providers/deepseek/index.d.ts +11 -0
- package/dist/plugins/providers/deepseek/index.d.ts.map +1 -0
- package/dist/plugins/providers/deepseek/index.js +54 -0
- package/dist/plugins/providers/deepseek/index.js.map +1 -0
- package/dist/plugins/providers/index.d.ts +2 -0
- package/dist/plugins/providers/index.d.ts.map +1 -0
- package/dist/plugins/providers/index.js +17 -0
- package/dist/plugins/providers/index.js.map +1 -0
- package/dist/plugins/providers/openai/index.d.ts +10 -0
- package/dist/plugins/providers/openai/index.d.ts.map +1 -0
- package/dist/plugins/providers/openai/index.js +47 -0
- package/dist/plugins/providers/openai/index.js.map +1 -0
- package/dist/plugins/providers/xai/index.d.ts +10 -0
- package/dist/plugins/providers/xai/index.d.ts.map +1 -0
- package/dist/plugins/providers/xai/index.js +47 -0
- package/dist/plugins/providers/xai/index.js.map +1 -0
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts +10 -0
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js +110 -0
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js.map +1 -0
- package/dist/plugins/tools/bash/localBashPlugin.d.ts +3 -0
- package/dist/plugins/tools/bash/localBashPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/bash/localBashPlugin.js +14 -0
- package/dist/plugins/tools/bash/localBashPlugin.js.map +1 -0
- package/dist/plugins/tools/edit/editPlugin.d.ts +9 -0
- package/dist/plugins/tools/edit/editPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/edit/editPlugin.js +15 -0
- package/dist/plugins/tools/edit/editPlugin.js.map +1 -0
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts +3 -0
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js +9 -0
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js.map +1 -0
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts +3 -0
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.js +14 -0
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.js.map +1 -0
- package/dist/plugins/tools/gitHistory/gitHistoryPlugin.d.ts +3 -0
- package/dist/plugins/tools/gitHistory/gitHistoryPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/gitHistory/gitHistoryPlugin.js +9 -0
- package/dist/plugins/tools/gitHistory/gitHistoryPlugin.js.map +1 -0
- package/dist/plugins/tools/index.d.ts +3 -0
- package/dist/plugins/tools/index.d.ts.map +1 -0
- package/dist/plugins/tools/index.js +3 -0
- package/dist/plugins/tools/index.js.map +1 -0
- package/dist/plugins/tools/integrity/integrityPlugin.d.ts +3 -0
- package/dist/plugins/tools/integrity/integrityPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/integrity/integrityPlugin.js +31 -0
- package/dist/plugins/tools/integrity/integrityPlugin.js.map +1 -0
- package/dist/plugins/tools/mcp/mcpPlugin.d.ts +3 -0
- package/dist/plugins/tools/mcp/mcpPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/mcp/mcpPlugin.js +27 -0
- package/dist/plugins/tools/mcp/mcpPlugin.js.map +1 -0
- package/dist/plugins/tools/nodeDefaults.d.ts +13 -0
- package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -0
- package/dist/plugins/tools/nodeDefaults.js +31 -0
- package/dist/plugins/tools/nodeDefaults.js.map +1 -0
- package/dist/plugins/tools/orchestration/orchestrationPlugin.d.ts +3 -0
- package/dist/plugins/tools/orchestration/orchestrationPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/orchestration/orchestrationPlugin.js +340 -0
- package/dist/plugins/tools/orchestration/orchestrationPlugin.js.map +1 -0
- package/dist/plugins/tools/registry.d.ts +22 -0
- package/dist/plugins/tools/registry.d.ts.map +1 -0
- package/dist/plugins/tools/registry.js +58 -0
- package/dist/plugins/tools/registry.js.map +1 -0
- package/dist/plugins/tools/search/localSearchPlugin.d.ts +3 -0
- package/dist/plugins/tools/search/localSearchPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/search/localSearchPlugin.js +14 -0
- package/dist/plugins/tools/search/localSearchPlugin.js.map +1 -0
- package/dist/plugins/tools/skills/skillPlugin.d.ts +3 -0
- package/dist/plugins/tools/skills/skillPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/skills/skillPlugin.js +27 -0
- package/dist/plugins/tools/skills/skillPlugin.js.map +1 -0
- package/dist/providers/baseProvider.d.ts +148 -0
- package/dist/providers/baseProvider.d.ts.map +1 -0
- package/dist/providers/baseProvider.js +284 -0
- package/dist/providers/baseProvider.js.map +1 -0
- package/dist/providers/openaiChatCompletionsProvider.d.ts +64 -0
- package/dist/providers/openaiChatCompletionsProvider.d.ts.map +1 -0
- package/dist/providers/openaiChatCompletionsProvider.js +1003 -0
- package/dist/providers/openaiChatCompletionsProvider.js.map +1 -0
- package/dist/providers/providerFactory.d.ts +22 -0
- package/dist/providers/providerFactory.d.ts.map +1 -0
- package/dist/providers/providerFactory.js +25 -0
- package/dist/providers/providerFactory.js.map +1 -0
- package/dist/providers/resilientProvider.d.ts +103 -0
- package/dist/providers/resilientProvider.d.ts.map +1 -0
- package/dist/providers/resilientProvider.js +462 -0
- package/dist/providers/resilientProvider.js.map +1 -0
- package/dist/runtime/agentController.d.ts +114 -0
- package/dist/runtime/agentController.d.ts.map +1 -0
- package/dist/runtime/agentController.js +707 -0
- package/dist/runtime/agentController.js.map +1 -0
- package/dist/runtime/agentHost.d.ts +61 -0
- package/dist/runtime/agentHost.d.ts.map +1 -0
- package/dist/runtime/agentHost.js +157 -0
- package/dist/runtime/agentHost.js.map +1 -0
- package/dist/runtime/agentSession.d.ts +45 -0
- package/dist/runtime/agentSession.d.ts.map +1 -0
- package/dist/runtime/agentSession.js +210 -0
- package/dist/runtime/agentSession.js.map +1 -0
- package/dist/runtime/agentWorkerPool.d.ts +167 -0
- package/dist/runtime/agentWorkerPool.d.ts.map +1 -0
- package/dist/runtime/agentWorkerPool.js +435 -0
- package/dist/runtime/agentWorkerPool.js.map +1 -0
- package/dist/runtime/node.d.ts +7 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +25 -0
- package/dist/runtime/node.js.map +1 -0
- package/dist/runtime/universal.d.ts +18 -0
- package/dist/runtime/universal.d.ts.map +1 -0
- package/dist/runtime/universal.js +21 -0
- package/dist/runtime/universal.js.map +1 -0
- package/dist/shell/autoExecutor.d.ts +70 -0
- package/dist/shell/autoExecutor.d.ts.map +1 -0
- package/dist/shell/autoExecutor.js +320 -0
- package/dist/shell/autoExecutor.js.map +1 -0
- package/dist/shell/commandRegistry.d.ts +122 -0
- package/dist/shell/commandRegistry.d.ts.map +1 -0
- package/dist/shell/commandRegistry.js +398 -0
- package/dist/shell/commandRegistry.js.map +1 -0
- package/dist/shell/composableMessage.d.ts +178 -0
- package/dist/shell/composableMessage.d.ts.map +1 -0
- package/dist/shell/composableMessage.js +384 -0
- package/dist/shell/composableMessage.js.map +1 -0
- package/dist/shell/liveStatus.d.ts +27 -0
- package/dist/shell/liveStatus.d.ts.map +1 -0
- package/dist/shell/liveStatus.js +53 -0
- package/dist/shell/liveStatus.js.map +1 -0
- package/dist/shell/systemPrompt.d.ts +12 -0
- package/dist/shell/systemPrompt.d.ts.map +1 -0
- package/dist/shell/systemPrompt.js +16 -0
- package/dist/shell/systemPrompt.js.map +1 -0
- package/dist/shell/vimMode.d.ts +66 -0
- package/dist/shell/vimMode.d.ts.map +1 -0
- package/dist/shell/vimMode.js +435 -0
- package/dist/shell/vimMode.js.map +1 -0
- package/dist/tools/bashTools.d.ts +7 -0
- package/dist/tools/bashTools.d.ts.map +1 -0
- package/dist/tools/bashTools.js +773 -0
- package/dist/tools/bashTools.js.map +1 -0
- package/dist/tools/diffUtils.d.ts +43 -0
- package/dist/tools/diffUtils.d.ts.map +1 -0
- package/dist/tools/diffUtils.js +607 -0
- package/dist/tools/diffUtils.js.map +1 -0
- package/dist/tools/editTools.d.ts +29 -0
- package/dist/tools/editTools.d.ts.map +1 -0
- package/dist/tools/editTools.js +673 -0
- package/dist/tools/editTools.js.map +1 -0
- package/dist/tools/emailTools.d.ts +140 -0
- package/dist/tools/emailTools.d.ts.map +1 -0
- package/dist/tools/emailTools.js +793 -0
- package/dist/tools/emailTools.js.map +1 -0
- package/dist/tools/fileChangeTracker.d.ts +47 -0
- package/dist/tools/fileChangeTracker.d.ts.map +1 -0
- package/dist/tools/fileChangeTracker.js +154 -0
- package/dist/tools/fileChangeTracker.js.map +1 -0
- package/dist/tools/fileReadTracker.d.ts +69 -0
- package/dist/tools/fileReadTracker.d.ts.map +1 -0
- package/dist/tools/fileReadTracker.js +213 -0
- package/dist/tools/fileReadTracker.js.map +1 -0
- package/dist/tools/fileTools.d.ts +3 -0
- package/dist/tools/fileTools.d.ts.map +1 -0
- package/dist/tools/fileTools.js +333 -0
- package/dist/tools/fileTools.js.map +1 -0
- package/dist/tools/grepTools.d.ts +3 -0
- package/dist/tools/grepTools.d.ts.map +1 -0
- package/dist/tools/grepTools.js +128 -0
- package/dist/tools/grepTools.js.map +1 -0
- package/dist/tools/hitlTools.d.ts +7 -0
- package/dist/tools/hitlTools.d.ts.map +1 -0
- package/dist/tools/hitlTools.js +189 -0
- package/dist/tools/hitlTools.js.map +1 -0
- package/dist/tools/humanOpsTools.d.ts +3 -0
- package/dist/tools/humanOpsTools.d.ts.map +1 -0
- package/dist/tools/humanOpsTools.js +86 -0
- package/dist/tools/humanOpsTools.js.map +1 -0
- package/dist/tools/localExplore.d.ts +38 -0
- package/dist/tools/localExplore.d.ts.map +1 -0
- package/dist/tools/localExplore.js +30 -0
- package/dist/tools/localExplore.js.map +1 -0
- package/dist/tools/metaTools.d.ts +3 -0
- package/dist/tools/metaTools.d.ts.map +1 -0
- package/dist/tools/metaTools.js +148 -0
- package/dist/tools/metaTools.js.map +1 -0
- package/dist/tools/planningTools.d.ts +81 -0
- package/dist/tools/planningTools.d.ts.map +1 -0
- package/dist/tools/planningTools.js +370 -0
- package/dist/tools/planningTools.js.map +1 -0
- package/dist/tools/searchTools.d.ts +12 -0
- package/dist/tools/searchTools.d.ts.map +1 -0
- package/dist/tools/searchTools.js +363 -0
- package/dist/tools/searchTools.js.map +1 -0
- package/dist/tools/telemetryTools.d.ts +10 -0
- package/dist/tools/telemetryTools.d.ts.map +1 -0
- package/dist/tools/telemetryTools.js +9 -0
- package/dist/tools/telemetryTools.js.map +1 -0
- package/dist/tools/unifiedOps.d.ts +3 -0
- package/dist/tools/unifiedOps.d.ts.map +1 -0
- package/dist/tools/unifiedOps.js +57 -0
- package/dist/tools/unifiedOps.js.map +1 -0
- package/dist/tools/webTools.d.ts +26 -0
- package/dist/tools/webTools.d.ts.map +1 -0
- package/dist/tools/webTools.js +227 -0
- package/dist/tools/webTools.js.map +1 -0
- package/dist/ui/PromptController.d.ts +193 -0
- package/dist/ui/PromptController.d.ts.map +1 -0
- package/dist/ui/PromptController.js +394 -0
- package/dist/ui/PromptController.js.map +1 -0
- package/dist/ui/UnifiedUIRenderer.d.ts +843 -0
- package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -0
- package/dist/ui/UnifiedUIRenderer.js +5711 -0
- package/dist/ui/UnifiedUIRenderer.js.map +1 -0
- package/dist/ui/animatedStatus.d.ts +140 -0
- package/dist/ui/animatedStatus.d.ts.map +1 -0
- package/dist/ui/animatedStatus.js +480 -0
- package/dist/ui/animatedStatus.js.map +1 -0
- package/dist/ui/animation/AnimationScheduler.d.ts +197 -0
- package/dist/ui/animation/AnimationScheduler.d.ts.map +1 -0
- package/dist/ui/animation/AnimationScheduler.js +440 -0
- package/dist/ui/animation/AnimationScheduler.js.map +1 -0
- package/dist/ui/codeHighlighter.d.ts +6 -0
- package/dist/ui/codeHighlighter.d.ts.map +1 -0
- package/dist/ui/codeHighlighter.js +855 -0
- package/dist/ui/codeHighlighter.js.map +1 -0
- package/dist/ui/designSystem.d.ts +26 -0
- package/dist/ui/designSystem.d.ts.map +1 -0
- package/dist/ui/designSystem.js +114 -0
- package/dist/ui/designSystem.js.map +1 -0
- package/dist/ui/errorFormatter.d.ts +64 -0
- package/dist/ui/errorFormatter.d.ts.map +1 -0
- package/dist/ui/errorFormatter.js +316 -0
- package/dist/ui/errorFormatter.js.map +1 -0
- package/dist/ui/globalWriteLock.d.ts +63 -0
- package/dist/ui/globalWriteLock.d.ts.map +1 -0
- package/dist/ui/globalWriteLock.js +173 -0
- package/dist/ui/globalWriteLock.js.map +1 -0
- package/dist/ui/index.d.ts +32 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +54 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/interrupts/InterruptManager.d.ts +157 -0
- package/dist/ui/interrupts/InterruptManager.d.ts.map +1 -0
- package/dist/ui/interrupts/InterruptManager.js +501 -0
- package/dist/ui/interrupts/InterruptManager.js.map +1 -0
- package/dist/ui/layout.d.ts +27 -0
- package/dist/ui/layout.d.ts.map +1 -0
- package/dist/ui/layout.js +184 -0
- package/dist/ui/layout.js.map +1 -0
- package/dist/ui/outputMode.d.ts +44 -0
- package/dist/ui/outputMode.d.ts.map +1 -0
- package/dist/ui/outputMode.js +123 -0
- package/dist/ui/outputMode.js.map +1 -0
- package/dist/ui/overlay/OverlayManager.d.ts +105 -0
- package/dist/ui/overlay/OverlayManager.d.ts.map +1 -0
- package/dist/ui/overlay/OverlayManager.js +304 -0
- package/dist/ui/overlay/OverlayManager.js.map +1 -0
- package/dist/ui/premiumComponents.d.ts +54 -0
- package/dist/ui/premiumComponents.d.ts.map +1 -0
- package/dist/ui/premiumComponents.js +241 -0
- package/dist/ui/premiumComponents.js.map +1 -0
- package/dist/ui/richText.d.ts +13 -0
- package/dist/ui/richText.d.ts.map +1 -0
- package/dist/ui/richText.js +444 -0
- package/dist/ui/richText.js.map +1 -0
- package/dist/ui/telemetry/ResponseTracker.d.ts +22 -0
- package/dist/ui/telemetry/ResponseTracker.d.ts.map +1 -0
- package/dist/ui/telemetry/ResponseTracker.js +60 -0
- package/dist/ui/telemetry/ResponseTracker.js.map +1 -0
- package/dist/ui/telemetry/UITelemetry.d.ts +181 -0
- package/dist/ui/telemetry/UITelemetry.d.ts.map +1 -0
- package/dist/ui/telemetry/UITelemetry.js +446 -0
- package/dist/ui/telemetry/UITelemetry.js.map +1 -0
- package/dist/ui/textHighlighter.d.ts +83 -0
- package/dist/ui/textHighlighter.d.ts.map +1 -0
- package/dist/ui/textHighlighter.js +267 -0
- package/dist/ui/textHighlighter.js.map +1 -0
- package/dist/ui/theme.d.ts +364 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +471 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/ui/toolDisplay.d.ts +221 -0
- package/dist/ui/toolDisplay.d.ts.map +1 -0
- package/dist/ui/toolDisplay.js +1654 -0
- package/dist/ui/toolDisplay.js.map +1 -0
- package/dist/ui/uiConstants.d.ts +288 -0
- package/dist/ui/uiConstants.d.ts.map +1 -0
- package/dist/ui/uiConstants.js +472 -0
- package/dist/ui/uiConstants.js.map +1 -0
- package/dist/utils/askUserPrompt.d.ts +21 -0
- package/dist/utils/askUserPrompt.d.ts.map +1 -0
- package/dist/utils/askUserPrompt.js +87 -0
- package/dist/utils/askUserPrompt.js.map +1 -0
- package/dist/utils/asyncUtils.d.ts +95 -0
- package/dist/utils/asyncUtils.d.ts.map +1 -0
- package/dist/utils/asyncUtils.js +286 -0
- package/dist/utils/asyncUtils.js.map +1 -0
- package/dist/utils/debugLogger.d.ts +6 -0
- package/dist/utils/debugLogger.d.ts.map +1 -0
- package/dist/utils/debugLogger.js +39 -0
- package/dist/utils/debugLogger.js.map +1 -0
- package/dist/utils/errorUtils.d.ts +12 -0
- package/dist/utils/errorUtils.d.ts.map +1 -0
- package/dist/utils/errorUtils.js +83 -0
- package/dist/utils/errorUtils.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +10 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +78 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/packageInfo.d.ts +14 -0
- package/dist/utils/packageInfo.d.ts.map +1 -0
- package/dist/utils/packageInfo.js +45 -0
- package/dist/utils/packageInfo.js.map +1 -0
- package/dist/utils/planFormatter.d.ts +34 -0
- package/dist/utils/planFormatter.d.ts.map +1 -0
- package/dist/utils/planFormatter.js +141 -0
- package/dist/utils/planFormatter.js.map +1 -0
- package/dist/utils/securityUtils.d.ts +132 -0
- package/dist/utils/securityUtils.d.ts.map +1 -0
- package/dist/utils/securityUtils.js +324 -0
- package/dist/utils/securityUtils.js.map +1 -0
- package/dist/utils/statusReporter.d.ts +6 -0
- package/dist/utils/statusReporter.d.ts.map +1 -0
- package/dist/utils/statusReporter.js +26 -0
- package/dist/utils/statusReporter.js.map +1 -0
- package/dist/workspace.d.ts +8 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +135 -0
- package/dist/workspace.js.map +1 -0
- package/dist/workspace.validator.d.ts +49 -0
- package/dist/workspace.validator.d.ts.map +1 -0
- package/dist/workspace.validator.js +215 -0
- package/dist/workspace.validator.js.map +1 -0
- package/package.json +121 -0
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UNIFIED CODING CAPABILITY
|
|
3
|
+
*
|
|
4
|
+
* A lean, consolidated capability module that provides all essential
|
|
5
|
+
* tools for an AI coding assistant in a single, coherent interface.
|
|
6
|
+
*
|
|
7
|
+
* Consolidates: Filesystem, Edit, Bash, Search, Git, Web
|
|
8
|
+
*/
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import { execSync } from 'child_process';
|
|
12
|
+
import { buildDiffWithContext, formatDiffClaudeStyle } from '../tools/diffUtils.js';
|
|
13
|
+
import { recordFileChange } from '../tools/fileChangeTracker.js';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// SCHEMA HELPERS
|
|
16
|
+
// ============================================================================
|
|
17
|
+
function stringProp(description, enumValues) {
|
|
18
|
+
const prop = {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description,
|
|
21
|
+
};
|
|
22
|
+
if (enumValues) {
|
|
23
|
+
return { ...prop, enum: enumValues };
|
|
24
|
+
}
|
|
25
|
+
return prop;
|
|
26
|
+
}
|
|
27
|
+
function objectSchema(properties, required) {
|
|
28
|
+
return {
|
|
29
|
+
type: 'object',
|
|
30
|
+
properties,
|
|
31
|
+
required,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export class UnifiedCodingCapabilityModule {
|
|
35
|
+
id = 'unified-coding';
|
|
36
|
+
options;
|
|
37
|
+
constructor(options = {}) {
|
|
38
|
+
this.options = {
|
|
39
|
+
workingDir: options.workingDir ?? process.cwd(),
|
|
40
|
+
enableGit: options.enableGit ?? true,
|
|
41
|
+
enableWeb: options.enableWeb ?? true,
|
|
42
|
+
enableBash: options.enableBash ?? true,
|
|
43
|
+
maxFileSize: options.maxFileSize ?? 10 * 1024 * 1024, // 10MB
|
|
44
|
+
timeout: options.timeout ?? 30000, // 30s
|
|
45
|
+
provider: options.provider,
|
|
46
|
+
providerId: options.providerId,
|
|
47
|
+
modelId: options.modelId,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async create(_context) {
|
|
51
|
+
return {
|
|
52
|
+
id: this.id,
|
|
53
|
+
description: 'Unified coding assistant tools',
|
|
54
|
+
toolSuite: this.buildToolSuite(),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
buildToolSuite() {
|
|
58
|
+
const tools = [];
|
|
59
|
+
// === FILESYSTEM TOOLS ===
|
|
60
|
+
tools.push(this.createReadFileTool());
|
|
61
|
+
tools.push(this.createWriteFileTool());
|
|
62
|
+
tools.push(this.createListFilesTool());
|
|
63
|
+
tools.push(this.createFileExistsTool());
|
|
64
|
+
// === EDIT TOOLS ===
|
|
65
|
+
tools.push(this.createEditFileTool());
|
|
66
|
+
tools.push(this.createSearchReplaceTool());
|
|
67
|
+
// === SEARCH TOOLS ===
|
|
68
|
+
tools.push(this.createGrepTool());
|
|
69
|
+
tools.push(this.createGlobTool());
|
|
70
|
+
// === BASH TOOLS ===
|
|
71
|
+
if (this.options.enableBash) {
|
|
72
|
+
tools.push(this.createBashTool());
|
|
73
|
+
}
|
|
74
|
+
// === GIT TOOLS ===
|
|
75
|
+
if (this.options.enableGit) {
|
|
76
|
+
tools.push(this.createGitTool());
|
|
77
|
+
}
|
|
78
|
+
// === WEB TOOLS ===
|
|
79
|
+
if (this.options.enableWeb) {
|
|
80
|
+
tools.push(this.createWebFetchTool());
|
|
81
|
+
}
|
|
82
|
+
// === PARALLEL AGENTS TOOL ===
|
|
83
|
+
if (this.options.provider) {
|
|
84
|
+
tools.push(this.createParallelAgentsTool());
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
id: 'unified-coding-tools',
|
|
88
|
+
description: 'Unified coding assistant tools for file operations, editing, search, and execution',
|
|
89
|
+
tools,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
// ============================================================================
|
|
93
|
+
// FILESYSTEM TOOLS
|
|
94
|
+
// ============================================================================
|
|
95
|
+
createReadFileTool() {
|
|
96
|
+
return {
|
|
97
|
+
name: 'read_file',
|
|
98
|
+
description: 'Read the contents of a file. Returns the file content as a string.',
|
|
99
|
+
parameters: objectSchema({
|
|
100
|
+
path: stringProp('Absolute or relative path to the file'),
|
|
101
|
+
encoding: stringProp('File encoding (default: utf-8)'),
|
|
102
|
+
}, ['path']),
|
|
103
|
+
handler: async (args) => {
|
|
104
|
+
try {
|
|
105
|
+
const filePath = this.resolvePath(args.path);
|
|
106
|
+
const stat = fs.statSync(filePath);
|
|
107
|
+
if (stat.size > this.options.maxFileSize) {
|
|
108
|
+
return `Error: File too large (${stat.size} bytes). Max: ${this.options.maxFileSize} bytes`;
|
|
109
|
+
}
|
|
110
|
+
const content = fs.readFileSync(filePath, { encoding: args.encoding ?? 'utf-8' });
|
|
111
|
+
return content;
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
return `Error reading file: ${error.message}`;
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
createWriteFileTool() {
|
|
120
|
+
return {
|
|
121
|
+
name: 'write_file',
|
|
122
|
+
description: 'Write content to a file. Creates the file if it does not exist.',
|
|
123
|
+
parameters: objectSchema({
|
|
124
|
+
path: stringProp('Absolute or relative path to the file'),
|
|
125
|
+
content: stringProp('Content to write to the file'),
|
|
126
|
+
createDirs: stringProp('Create parent directories if they do not exist (default: true)'),
|
|
127
|
+
}, ['path', 'content']),
|
|
128
|
+
handler: async (args) => {
|
|
129
|
+
try {
|
|
130
|
+
const filePath = this.resolvePath(args.path);
|
|
131
|
+
// Read old content if file exists (for diff)
|
|
132
|
+
let oldContent = '';
|
|
133
|
+
const fileExists = fs.existsSync(filePath);
|
|
134
|
+
if (fileExists) {
|
|
135
|
+
oldContent = fs.readFileSync(filePath, 'utf-8');
|
|
136
|
+
}
|
|
137
|
+
if (args.createDirs !== 'false') {
|
|
138
|
+
const dir = path.dirname(filePath);
|
|
139
|
+
if (!fs.existsSync(dir)) {
|
|
140
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Record for revert before writing
|
|
144
|
+
recordFileChange(filePath);
|
|
145
|
+
fs.writeFileSync(filePath, args.content, 'utf-8');
|
|
146
|
+
// Generate diff output
|
|
147
|
+
const relativePath = path.relative(this.options.workingDir, filePath);
|
|
148
|
+
const displayPath = relativePath && !relativePath.startsWith('..') ? relativePath : filePath;
|
|
149
|
+
const diffResult = buildDiffWithContext(oldContent, args.content, 2);
|
|
150
|
+
const { additions, removals } = diffResult;
|
|
151
|
+
// Format diff with colors (limit to 10 lines)
|
|
152
|
+
const MAX_DIFF_LINES = 10;
|
|
153
|
+
const truncatedSegments = diffResult.segments.slice(0, MAX_DIFF_LINES);
|
|
154
|
+
const diffLines = formatDiffClaudeStyle(truncatedSegments, true);
|
|
155
|
+
const remainingChanges = diffResult.segments.length - MAX_DIFF_LINES;
|
|
156
|
+
if (remainingChanges > 0) {
|
|
157
|
+
diffLines.push(` ... +${remainingChanges} more changes`);
|
|
158
|
+
}
|
|
159
|
+
const diffBlock = diffLines.length > 0 ? diffLines.join('\n') : ' (No visual diff)';
|
|
160
|
+
// Build summary
|
|
161
|
+
const action = fileExists ? 'Update' : 'Create';
|
|
162
|
+
const additionText = additions === 1 ? '1 addition' : `${additions} additions`;
|
|
163
|
+
const removalText = removals === 1 ? '1 removal' : `${removals} removals`;
|
|
164
|
+
const summaryParts = [];
|
|
165
|
+
if (additions > 0)
|
|
166
|
+
summaryParts.push(additionText);
|
|
167
|
+
if (removals > 0)
|
|
168
|
+
summaryParts.push(removalText);
|
|
169
|
+
const summaryText = summaryParts.length > 0 ? summaryParts.join(' and ') : 'no changes';
|
|
170
|
+
return [
|
|
171
|
+
`⏺ ${action}(${displayPath})`,
|
|
172
|
+
` ⎿ ${action}d ${displayPath} with ${summaryText}`,
|
|
173
|
+
diffBlock,
|
|
174
|
+
].join('\n');
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
return `Error writing file: ${error.message}`;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
createListFilesTool() {
|
|
183
|
+
return {
|
|
184
|
+
name: 'list_files',
|
|
185
|
+
description: 'List files in a directory. Optionally filter by pattern and recurse into subdirectories.',
|
|
186
|
+
parameters: objectSchema({
|
|
187
|
+
path: stringProp('Directory path to list'),
|
|
188
|
+
recursive: stringProp('Recurse into subdirectories (default: false)'),
|
|
189
|
+
pattern: stringProp('Glob pattern to filter files (e.g., "*.ts")'),
|
|
190
|
+
}, ['path']),
|
|
191
|
+
handler: async (args) => {
|
|
192
|
+
try {
|
|
193
|
+
const dirPath = this.resolvePath(args.path);
|
|
194
|
+
const files = this.listDirectory(dirPath, args.recursive === 'true', args.pattern);
|
|
195
|
+
return files.join('\n');
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
return `Error listing files: ${error.message}`;
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
createFileExistsTool() {
|
|
204
|
+
return {
|
|
205
|
+
name: 'file_exists',
|
|
206
|
+
description: 'Check if a file or directory exists.',
|
|
207
|
+
parameters: objectSchema({
|
|
208
|
+
path: stringProp('Path to check'),
|
|
209
|
+
}, ['path']),
|
|
210
|
+
handler: async (args) => {
|
|
211
|
+
const filePath = this.resolvePath(args.path);
|
|
212
|
+
const exists = fs.existsSync(filePath);
|
|
213
|
+
if (exists) {
|
|
214
|
+
const stat = fs.statSync(filePath);
|
|
215
|
+
return `Exists: ${stat.isDirectory() ? 'directory' : 'file'}`;
|
|
216
|
+
}
|
|
217
|
+
return 'Does not exist';
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
// ============================================================================
|
|
222
|
+
// EDIT TOOLS
|
|
223
|
+
// ============================================================================
|
|
224
|
+
createEditFileTool() {
|
|
225
|
+
return {
|
|
226
|
+
name: 'edit_file',
|
|
227
|
+
description: 'Edit a file by replacing specific text. The oldText must match exactly.',
|
|
228
|
+
parameters: objectSchema({
|
|
229
|
+
path: stringProp('Path to the file to edit'),
|
|
230
|
+
oldText: stringProp('Exact text to find and replace'),
|
|
231
|
+
newText: stringProp('Text to replace with'),
|
|
232
|
+
}, ['path', 'oldText', 'newText']),
|
|
233
|
+
handler: async (args) => {
|
|
234
|
+
try {
|
|
235
|
+
const filePath = this.resolvePath(args.path);
|
|
236
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
237
|
+
if (!content.includes(args.oldText)) {
|
|
238
|
+
return `Error: Could not find the specified text in ${filePath}`;
|
|
239
|
+
}
|
|
240
|
+
const newContent = content.replace(args.oldText, args.newText);
|
|
241
|
+
fs.writeFileSync(filePath, newContent, 'utf-8');
|
|
242
|
+
return `Successfully edited ${filePath}`;
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
return `Error editing file: ${error.message}`;
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
createSearchReplaceTool() {
|
|
251
|
+
return {
|
|
252
|
+
name: 'search_replace',
|
|
253
|
+
description: 'Search and replace text in a file. Supports regex patterns.',
|
|
254
|
+
parameters: objectSchema({
|
|
255
|
+
path: stringProp('Path to the file'),
|
|
256
|
+
search: stringProp('Text or regex pattern to search for'),
|
|
257
|
+
replace: stringProp('Replacement text'),
|
|
258
|
+
regex: stringProp('Treat search as regex (default: false)'),
|
|
259
|
+
global: stringProp('Replace all occurrences (default: true)'),
|
|
260
|
+
}, ['path', 'search', 'replace']),
|
|
261
|
+
handler: async (args) => {
|
|
262
|
+
try {
|
|
263
|
+
const filePath = this.resolvePath(args.path);
|
|
264
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
265
|
+
let pattern;
|
|
266
|
+
if (args.regex === 'true') {
|
|
267
|
+
const flags = args.global !== 'false' ? 'g' : '';
|
|
268
|
+
pattern = new RegExp(args.search, flags);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
pattern = args.global !== 'false'
|
|
272
|
+
? new RegExp(this.escapeRegex(args.search), 'g')
|
|
273
|
+
: args.search;
|
|
274
|
+
}
|
|
275
|
+
const newContent = content.replace(pattern, args.replace);
|
|
276
|
+
const matchCount = (content.match(pattern instanceof RegExp ? pattern : new RegExp(this.escapeRegex(args.search), 'g')) || []).length;
|
|
277
|
+
fs.writeFileSync(filePath, newContent, 'utf-8');
|
|
278
|
+
return `Replaced ${matchCount} occurrence(s) in ${filePath}`;
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
return `Error in search/replace: ${error.message}`;
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
// ============================================================================
|
|
287
|
+
// SEARCH TOOLS
|
|
288
|
+
// ============================================================================
|
|
289
|
+
createGrepTool() {
|
|
290
|
+
return {
|
|
291
|
+
name: 'grep',
|
|
292
|
+
description: 'Search for a pattern in files. Returns matching lines with file names and line numbers.',
|
|
293
|
+
parameters: objectSchema({
|
|
294
|
+
pattern: stringProp('Regex pattern to search for'),
|
|
295
|
+
path: stringProp('Directory or file to search in (default: working directory)'),
|
|
296
|
+
filePattern: stringProp('Filter files by glob pattern (e.g., "*.ts")'),
|
|
297
|
+
contextLines: stringProp('Number of context lines around matches (default: 0)'),
|
|
298
|
+
}, ['pattern']),
|
|
299
|
+
handler: async (args) => {
|
|
300
|
+
try {
|
|
301
|
+
const searchPath = this.resolvePath(args.path ?? '.');
|
|
302
|
+
const results = [];
|
|
303
|
+
const files = fs.statSync(searchPath).isDirectory()
|
|
304
|
+
? this.listDirectory(searchPath, true, args.filePattern)
|
|
305
|
+
: [searchPath];
|
|
306
|
+
// Use regex without 'g' flag for test() to avoid lastIndex issues
|
|
307
|
+
const regex = new RegExp(args.pattern, 'i');
|
|
308
|
+
const contextLines = parseInt(args.contextLines ?? '0', 10) || 0;
|
|
309
|
+
const matchedLineSet = new Set(); // Prevent duplicate context lines
|
|
310
|
+
for (const file of files.slice(0, 100)) { // Limit to 100 files
|
|
311
|
+
try {
|
|
312
|
+
// Skip binary files by checking for null bytes
|
|
313
|
+
const buffer = fs.readFileSync(file);
|
|
314
|
+
if (buffer.includes(0))
|
|
315
|
+
continue; // Binary file
|
|
316
|
+
const content = buffer.toString('utf-8');
|
|
317
|
+
// Skip very large files
|
|
318
|
+
if (content.length > 1024 * 1024)
|
|
319
|
+
continue; // > 1MB
|
|
320
|
+
const lines = content.split('\n');
|
|
321
|
+
const fileMatches = [];
|
|
322
|
+
// First pass: find all matching line numbers
|
|
323
|
+
for (let i = 0; i < lines.length; i++) {
|
|
324
|
+
if (regex.test(lines[i])) {
|
|
325
|
+
fileMatches.push(i);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// Second pass: output with context, avoiding duplicates
|
|
329
|
+
for (const matchIdx of fileMatches) {
|
|
330
|
+
const start = Math.max(0, matchIdx - contextLines);
|
|
331
|
+
const end = Math.min(lines.length - 1, matchIdx + contextLines);
|
|
332
|
+
for (let j = start; j <= end; j++) {
|
|
333
|
+
const lineKey = `${file}:${j}`;
|
|
334
|
+
if (!matchedLineSet.has(lineKey)) {
|
|
335
|
+
matchedLineSet.add(lineKey);
|
|
336
|
+
const prefix = j === matchIdx ? '>' : ' ';
|
|
337
|
+
results.push(`${file}:${j + 1}:${prefix} ${lines[j]}`);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (contextLines > 0 && matchIdx < fileMatches[fileMatches.length - 1]) {
|
|
341
|
+
results.push('--');
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
// Skip unreadable files
|
|
347
|
+
}
|
|
348
|
+
// Stop if we have enough results
|
|
349
|
+
if (results.length > 500)
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
return results.length > 0
|
|
353
|
+
? results.slice(0, 500).join('\n')
|
|
354
|
+
: 'No matches found';
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
return `Error in grep: ${error.message}`;
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
createGlobTool() {
|
|
363
|
+
return {
|
|
364
|
+
name: 'glob',
|
|
365
|
+
description: 'Find files matching a glob pattern.',
|
|
366
|
+
parameters: objectSchema({
|
|
367
|
+
pattern: stringProp('Glob pattern (e.g., "**/*.ts", "src/**/*.js")'),
|
|
368
|
+
path: stringProp('Base directory (default: working directory)'),
|
|
369
|
+
}, ['pattern']),
|
|
370
|
+
handler: async (args) => {
|
|
371
|
+
try {
|
|
372
|
+
const basePath = this.resolvePath(args.path ?? '.');
|
|
373
|
+
const files = this.listDirectory(basePath, true, args.pattern);
|
|
374
|
+
return files.length > 0
|
|
375
|
+
? files.slice(0, 200).join('\n')
|
|
376
|
+
: 'No files found matching pattern';
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
return `Error in glob: ${error.message}`;
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
// ============================================================================
|
|
385
|
+
// BASH TOOL
|
|
386
|
+
// ============================================================================
|
|
387
|
+
createBashTool() {
|
|
388
|
+
return {
|
|
389
|
+
name: 'bash',
|
|
390
|
+
description: 'Execute a bash command and return the output. Use for running builds, tests, git commands, etc.',
|
|
391
|
+
parameters: objectSchema({
|
|
392
|
+
command: stringProp('The command to execute'),
|
|
393
|
+
timeout: stringProp('Timeout in milliseconds (default: 30000)'),
|
|
394
|
+
cwd: stringProp('Working directory for the command'),
|
|
395
|
+
}, ['command']),
|
|
396
|
+
handler: async (args) => {
|
|
397
|
+
return new Promise((resolve) => {
|
|
398
|
+
try {
|
|
399
|
+
const timeout = parseInt(args.timeout ?? String(this.options.timeout), 10);
|
|
400
|
+
const cwd = args.cwd ? this.resolvePath(args.cwd) : this.options.workingDir;
|
|
401
|
+
const result = execSync(args.command, {
|
|
402
|
+
cwd,
|
|
403
|
+
timeout,
|
|
404
|
+
encoding: 'utf-8',
|
|
405
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
406
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
407
|
+
});
|
|
408
|
+
resolve(result.trim() || '(no output)');
|
|
409
|
+
}
|
|
410
|
+
catch (error) {
|
|
411
|
+
const execError = error;
|
|
412
|
+
const stdout = execError.stdout ?? '';
|
|
413
|
+
const stderr = execError.stderr ?? '';
|
|
414
|
+
resolve(`Error: ${execError.message}\nStdout: ${stdout}\nStderr: ${stderr}`);
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
// ============================================================================
|
|
421
|
+
// GIT TOOL
|
|
422
|
+
// ============================================================================
|
|
423
|
+
createGitTool() {
|
|
424
|
+
return {
|
|
425
|
+
name: 'git',
|
|
426
|
+
description: 'Execute git operations. Supports: status, diff, log, add, commit, push, pull, branch, checkout, merge, stash',
|
|
427
|
+
parameters: objectSchema({
|
|
428
|
+
operation: stringProp('Git operation', ['status', 'diff', 'log', 'add', 'commit', 'push', 'pull', 'branch', 'checkout', 'merge', 'stash', 'reset', 'fetch']),
|
|
429
|
+
args: stringProp('Additional arguments for the git command'),
|
|
430
|
+
}, ['operation']),
|
|
431
|
+
handler: async (args) => {
|
|
432
|
+
try {
|
|
433
|
+
const command = `git ${args.operation}${args.args ? ' ' + args.args : ''}`;
|
|
434
|
+
const result = execSync(command, {
|
|
435
|
+
cwd: this.options.workingDir,
|
|
436
|
+
encoding: 'utf-8',
|
|
437
|
+
timeout: this.options.timeout,
|
|
438
|
+
});
|
|
439
|
+
return result.trim() || '(no output)';
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
const execError = error;
|
|
443
|
+
return `Git error: ${execError.stderr || execError.message}`;
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
// ============================================================================
|
|
449
|
+
// WEB TOOL
|
|
450
|
+
// ============================================================================
|
|
451
|
+
createWebFetchTool() {
|
|
452
|
+
return {
|
|
453
|
+
name: 'web_fetch',
|
|
454
|
+
description: 'Fetch content from a URL. Useful for downloading documentation or API responses.',
|
|
455
|
+
parameters: objectSchema({
|
|
456
|
+
url: stringProp('URL to fetch'),
|
|
457
|
+
method: stringProp('HTTP method (default: GET)'),
|
|
458
|
+
headers: stringProp('JSON string of headers'),
|
|
459
|
+
}, ['url']),
|
|
460
|
+
handler: async (args) => {
|
|
461
|
+
try {
|
|
462
|
+
const headers = args.headers ? JSON.parse(args.headers) : {};
|
|
463
|
+
const response = await fetch(args.url, {
|
|
464
|
+
method: args.method ?? 'GET',
|
|
465
|
+
headers,
|
|
466
|
+
});
|
|
467
|
+
if (!response.ok) {
|
|
468
|
+
return `HTTP ${response.status}: ${response.statusText}`;
|
|
469
|
+
}
|
|
470
|
+
const contentType = response.headers.get('content-type') ?? '';
|
|
471
|
+
if (contentType.includes('application/json')) {
|
|
472
|
+
const json = await response.json();
|
|
473
|
+
return JSON.stringify(json, null, 2);
|
|
474
|
+
}
|
|
475
|
+
const text = await response.text();
|
|
476
|
+
return text.slice(0, 50000); // Limit response size
|
|
477
|
+
}
|
|
478
|
+
catch (error) {
|
|
479
|
+
return `Fetch error: ${error.message}`;
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
// ============================================================================
|
|
485
|
+
// PARALLEL AGENTS TOOL
|
|
486
|
+
// ============================================================================
|
|
487
|
+
createParallelAgentsTool() {
|
|
488
|
+
const MAX_CONCURRENCY = 5;
|
|
489
|
+
const opts = {
|
|
490
|
+
provider: this.options.provider,
|
|
491
|
+
workingDir: this.options.workingDir,
|
|
492
|
+
providerId: this.options.providerId,
|
|
493
|
+
modelId: this.options.modelId,
|
|
494
|
+
};
|
|
495
|
+
// Dynamic import to avoid circular dependency at module level
|
|
496
|
+
const LeanAgentModule = import('../leanAgent.js');
|
|
497
|
+
return {
|
|
498
|
+
name: 'parallel_agents',
|
|
499
|
+
description: 'Execute multiple independent tasks in parallel using sub-agents. ' +
|
|
500
|
+
'Each sub-agent gets its own tool suite (filesystem, edit, bash, search, git, web) and works independently. ' +
|
|
501
|
+
'Use this when you need to perform several independent operations simultaneously ' +
|
|
502
|
+
'(e.g., creating multiple files, searching in different places, running independent edits). ' +
|
|
503
|
+
'Do NOT use for tasks that depend on each other or for single small tasks.\n\n' +
|
|
504
|
+
'Parameter `tasks`: A JSON string encoding an array of objects, each with:\n' +
|
|
505
|
+
' - id: unique string identifier for the task\n' +
|
|
506
|
+
' - description: short label (3-5 words)\n' +
|
|
507
|
+
' - prompt: full instructions for the sub-agent',
|
|
508
|
+
parameters: objectSchema({
|
|
509
|
+
tasks: stringProp('JSON array of task objects: [{"id":"string","description":"short label","prompt":"full instructions"}]'),
|
|
510
|
+
}, ['tasks']),
|
|
511
|
+
handler: async (args) => {
|
|
512
|
+
let taskSpecs;
|
|
513
|
+
try {
|
|
514
|
+
taskSpecs = JSON.parse(args.tasks);
|
|
515
|
+
}
|
|
516
|
+
catch {
|
|
517
|
+
return 'Error: Could not parse tasks JSON. Provide a valid JSON array of {id, description, prompt} objects.';
|
|
518
|
+
}
|
|
519
|
+
if (!Array.isArray(taskSpecs) || taskSpecs.length === 0) {
|
|
520
|
+
return 'Error: tasks must be a non-empty JSON array.';
|
|
521
|
+
}
|
|
522
|
+
if (taskSpecs.length > MAX_CONCURRENCY) {
|
|
523
|
+
return `Error: Maximum ${MAX_CONCURRENCY} parallel tasks allowed. Got ${taskSpecs.length}.`;
|
|
524
|
+
}
|
|
525
|
+
// Validate each task
|
|
526
|
+
for (const t of taskSpecs) {
|
|
527
|
+
if (!t.id || !t.prompt) {
|
|
528
|
+
return `Error: Each task must have "id" and "prompt" fields. Invalid task: ${JSON.stringify(t)}`;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
// Import LeanAgent dynamically to avoid circular dependency
|
|
532
|
+
const { LeanAgent } = await LeanAgentModule;
|
|
533
|
+
// Execute tasks in parallel
|
|
534
|
+
const results = await Promise.all(taskSpecs.map(async (task) => {
|
|
535
|
+
try {
|
|
536
|
+
const subAgent = new LeanAgent({
|
|
537
|
+
provider: opts.provider,
|
|
538
|
+
workingDir: opts.workingDir ?? process.cwd(),
|
|
539
|
+
providerId: opts.providerId,
|
|
540
|
+
modelId: opts.modelId,
|
|
541
|
+
systemPrompt: 'You are a focused sub-agent executing a specific task. ' +
|
|
542
|
+
'Complete the task efficiently and report what you did. ' +
|
|
543
|
+
`Working directory: ${opts.workingDir ?? process.cwd()}`,
|
|
544
|
+
});
|
|
545
|
+
const response = await subAgent.chat(task.prompt, false);
|
|
546
|
+
return {
|
|
547
|
+
id: task.id,
|
|
548
|
+
description: task.description || task.id,
|
|
549
|
+
success: true,
|
|
550
|
+
output: response.content,
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
catch (error) {
|
|
554
|
+
return {
|
|
555
|
+
id: task.id,
|
|
556
|
+
description: task.description || task.id,
|
|
557
|
+
success: false,
|
|
558
|
+
output: `Error: ${error.message}`,
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
}));
|
|
562
|
+
// Format results
|
|
563
|
+
const lines = [`Parallel execution complete: ${results.length} tasks`];
|
|
564
|
+
for (const r of results) {
|
|
565
|
+
const status = r.success ? 'OK' : 'FAILED';
|
|
566
|
+
lines.push(`\n--- [${status}] ${r.id}: ${r.description} ---`);
|
|
567
|
+
lines.push(r.output);
|
|
568
|
+
}
|
|
569
|
+
return lines.join('\n');
|
|
570
|
+
},
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
// ============================================================================
|
|
574
|
+
// UTILITY METHODS
|
|
575
|
+
// ============================================================================
|
|
576
|
+
resolvePath(inputPath) {
|
|
577
|
+
if (path.isAbsolute(inputPath)) {
|
|
578
|
+
return inputPath;
|
|
579
|
+
}
|
|
580
|
+
return path.resolve(this.options.workingDir, inputPath);
|
|
581
|
+
}
|
|
582
|
+
listDirectory(dir, recursive, pattern) {
|
|
583
|
+
const results = [];
|
|
584
|
+
const regex = pattern ? this.globToRegex(pattern) : null;
|
|
585
|
+
const walk = (currentDir) => {
|
|
586
|
+
try {
|
|
587
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
588
|
+
for (const entry of entries) {
|
|
589
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
590
|
+
// Skip hidden files and common ignore patterns
|
|
591
|
+
if (entry.name.startsWith('.') || entry.name === 'node_modules') {
|
|
592
|
+
continue;
|
|
593
|
+
}
|
|
594
|
+
if (entry.isDirectory()) {
|
|
595
|
+
if (recursive) {
|
|
596
|
+
walk(fullPath);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
if (!regex || regex.test(entry.name) || regex.test(fullPath)) {
|
|
601
|
+
results.push(fullPath);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
catch {
|
|
607
|
+
// Skip unreadable directories
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
walk(dir);
|
|
611
|
+
return results;
|
|
612
|
+
}
|
|
613
|
+
globToRegex(pattern) {
|
|
614
|
+
const escaped = pattern
|
|
615
|
+
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
616
|
+
.replace(/\*/g, '.*')
|
|
617
|
+
.replace(/\?/g, '.');
|
|
618
|
+
return new RegExp(escaped, 'i');
|
|
619
|
+
}
|
|
620
|
+
escapeRegex(str) {
|
|
621
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
// ============================================================================
|
|
625
|
+
// FACTORY & CONVENIENCE EXPORTS
|
|
626
|
+
// ============================================================================
|
|
627
|
+
export function createUnifiedCodingCapability(options) {
|
|
628
|
+
return new UnifiedCodingCapabilityModule(options);
|
|
629
|
+
}
|
|
630
|
+
export default UnifiedCodingCapabilityModule;
|
|
631
|
+
//# sourceMappingURL=unifiedCodingCapability.js.map
|