@trenchwork/coder 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +16 -0
- package/README.md +173 -0
- package/agents/trenchwork-code.rules.json +199 -0
- package/dist/bin/deepseek.d.ts +3 -0
- package/dist/bin/deepseek.d.ts.map +1 -0
- package/dist/bin/deepseek.js +23 -0
- package/dist/bin/deepseek.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 +184 -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 +16 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/memoryCapability.d.ts +10 -0
- package/dist/capabilities/memoryCapability.d.ts.map +1 -0
- package/dist/capabilities/memoryCapability.js +22 -0
- package/dist/capabilities/memoryCapability.js.map +1 -0
- package/dist/capabilities/notebookCapability.d.ts +6 -0
- package/dist/capabilities/notebookCapability.d.ts.map +1 -0
- package/dist/capabilities/notebookCapability.js +17 -0
- package/dist/capabilities/notebookCapability.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/skillCapability.d.ts +6 -0
- package/dist/capabilities/skillCapability.d.ts.map +1 -0
- package/dist/capabilities/skillCapability.js +17 -0
- package/dist/capabilities/skillCapability.js.map +1 -0
- package/dist/capabilities/todoCapability.d.ts +11 -0
- package/dist/capabilities/todoCapability.d.ts.map +1 -0
- package/dist/capabilities/todoCapability.js +22 -0
- package/dist/capabilities/todoCapability.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 +62 -0
- package/dist/capabilities/unifiedCodingCapability.d.ts.map +1 -0
- package/dist/capabilities/unifiedCodingCapability.js +790 -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 +181 -0
- package/dist/config.js.map +1 -0
- package/dist/contracts/agent-profiles.schema.json +25 -0
- package/dist/contracts/agent-schemas.json +158 -0
- package/dist/contracts/models.schema.json +9 -0
- package/dist/contracts/module-schema.json +367 -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 +42 -0
- package/dist/contracts/unified-schema.json +40 -0
- package/dist/contracts/v1/agent.d.ts +225 -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/adversarial.d.ts +38 -0
- package/dist/core/adversarial.d.ts.map +1 -0
- package/dist/core/adversarial.js +106 -0
- package/dist/core/adversarial.js.map +1 -0
- package/dist/core/adversarialCorrection.d.ts +22 -0
- package/dist/core/adversarialCorrection.d.ts.map +1 -0
- package/dist/core/adversarialCorrection.js +25 -0
- package/dist/core/adversarialCorrection.js.map +1 -0
- package/dist/core/agent.d.ts +331 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +1637 -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/agentRegistry.d.ts +111 -0
- package/dist/core/agentRegistry.d.ts.map +1 -0
- package/dist/core/agentRegistry.js +229 -0
- package/dist/core/agentRegistry.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/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/compactionNote.d.ts +13 -0
- package/dist/core/compactionNote.d.ts.map +1 -0
- package/dist/core/compactionNote.js +13 -0
- package/dist/core/compactionNote.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 +1076 -0
- package/dist/core/contextManager.js.map +1 -0
- package/dist/core/contextUsage.d.ts +28 -0
- package/dist/core/contextUsage.d.ts.map +1 -0
- package/dist/core/contextUsage.js +62 -0
- package/dist/core/contextUsage.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 +127 -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/diffPanel.d.ts +30 -0
- package/dist/core/diffPanel.d.ts.map +1 -0
- package/dist/core/diffPanel.js +48 -0
- package/dist/core/diffPanel.js.map +1 -0
- package/dist/core/errorClassification.d.ts +44 -0
- package/dist/core/errorClassification.d.ts.map +1 -0
- package/dist/core/errorClassification.js +333 -0
- package/dist/core/errorClassification.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 +272 -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/failureRegistry.d.ts +30 -0
- package/dist/core/failureRegistry.d.ts.map +1 -0
- package/dist/core/failureRegistry.js +74 -0
- package/dist/core/failureRegistry.js.map +1 -0
- package/dist/core/fileMentions.d.ts +40 -0
- package/dist/core/fileMentions.d.ts.map +1 -0
- package/dist/core/fileMentions.js +136 -0
- package/dist/core/fileMentions.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/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/hitl.d.ts +119 -0
- package/dist/core/hitl.d.ts.map +1 -0
- package/dist/core/hitl.js +396 -0
- package/dist/core/hitl.js.map +1 -0
- package/dist/core/hooks.d.ts +95 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +236 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/hostedAuth.d.ts +88 -0
- package/dist/core/hostedAuth.d.ts.map +1 -0
- package/dist/core/hostedAuth.js +219 -0
- package/dist/core/hostedAuth.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/modelDiscovery.d.ts +102 -0
- package/dist/core/modelDiscovery.d.ts.map +1 -0
- package/dist/core/modelDiscovery.js +416 -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/permissionMode.d.ts +40 -0
- package/dist/core/permissionMode.d.ts.map +1 -0
- package/dist/core/permissionMode.js +86 -0
- package/dist/core/permissionMode.js.map +1 -0
- package/dist/core/postWriteDiagnostics.d.ts +32 -0
- package/dist/core/postWriteDiagnostics.d.ts.map +1 -0
- package/dist/core/postWriteDiagnostics.js +127 -0
- package/dist/core/postWriteDiagnostics.js.map +1 -0
- package/dist/core/preferences.d.ts +66 -0
- package/dist/core/preferences.d.ts.map +1 -0
- package/dist/core/preferences.js +310 -0
- package/dist/core/preferences.js.map +1 -0
- package/dist/core/quota.d.ts +61 -0
- package/dist/core/quota.d.ts.map +1 -0
- package/dist/core/quota.js +104 -0
- package/dist/core/quota.js.map +1 -0
- package/dist/core/quotaErrors.d.ts +42 -0
- package/dist/core/quotaErrors.d.ts.map +1 -0
- package/dist/core/quotaErrors.js +86 -0
- package/dist/core/quotaErrors.js.map +1 -0
- package/dist/core/refusalDetection.d.ts +2 -0
- package/dist/core/refusalDetection.d.ts.map +1 -0
- package/dist/core/refusalDetection.js +51 -0
- package/dist/core/refusalDetection.js.map +1 -0
- package/dist/core/relativeTime.d.ts +8 -0
- package/dist/core/relativeTime.d.ts.map +1 -0
- package/dist/core/relativeTime.js +29 -0
- package/dist/core/relativeTime.js.map +1 -0
- package/dist/core/resultVerification.d.ts +48 -0
- package/dist/core/resultVerification.d.ts.map +1 -0
- package/dist/core/resultVerification.js +127 -0
- package/dist/core/resultVerification.js.map +1 -0
- package/dist/core/rewind.d.ts +14 -0
- package/dist/core/rewind.d.ts.map +1 -0
- package/dist/core/rewind.js +25 -0
- package/dist/core/rewind.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 +59 -0
- package/dist/core/secretStore.d.ts.map +1 -0
- package/dist/core/secretStore.js +278 -0
- package/dist/core/secretStore.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 +190 -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 +186 -0
- package/dist/core/shutdown.js.map +1 -0
- package/dist/core/slashCommands.d.ts +38 -0
- package/dist/core/slashCommands.d.ts.map +1 -0
- package/dist/core/slashCommands.js +72 -0
- package/dist/core/slashCommands.js.map +1 -0
- package/dist/core/subAgentNote.d.ts +15 -0
- package/dist/core/subAgentNote.d.ts.map +1 -0
- package/dist/core/subAgentNote.js +16 -0
- package/dist/core/subAgentNote.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 +117 -0
- package/dist/core/taskCompletionDetector.d.ts.map +1 -0
- package/dist/core/taskCompletionDetector.js +532 -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/thinkingVerbs.d.ts +31 -0
- package/dist/core/thinkingVerbs.d.ts.map +1 -0
- package/dist/core/thinkingVerbs.js +58 -0
- package/dist/core/thinkingVerbs.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 +193 -0
- package/dist/core/toolRuntime.d.ts.map +1 -0
- package/dist/core/toolRuntime.js +526 -0
- package/dist/core/toolRuntime.js.map +1 -0
- package/dist/core/turnGovernor.d.ts +63 -0
- package/dist/core/turnGovernor.d.ts.map +1 -0
- package/dist/core/turnGovernor.js +94 -0
- package/dist/core/turnGovernor.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/updateChecker.d.ts +148 -0
- package/dist/core/updateChecker.d.ts.map +1 -0
- package/dist/core/updateChecker.js +605 -0
- package/dist/core/updateChecker.js.map +1 -0
- package/dist/core/usage.d.ts +28 -0
- package/dist/core/usage.d.ts.map +1 -0
- package/dist/core/usage.js +77 -0
- package/dist/core/usage.js.map +1 -0
- package/dist/headless/interactiveShell.d.ts +47 -0
- package/dist/headless/interactiveShell.d.ts.map +1 -0
- package/dist/headless/interactiveShell.js +2495 -0
- package/dist/headless/interactiveShell.js.map +1 -0
- package/dist/leanAgent.d.ts +73 -0
- package/dist/leanAgent.d.ts.map +1 -0
- package/dist/leanAgent.js +177 -0
- package/dist/leanAgent.js.map +1 -0
- package/dist/plugins/providers/deepseek/index.d.ts +12 -0
- package/dist/plugins/providers/deepseek/index.d.ts.map +1 -0
- package/dist/plugins/providers/deepseek/index.js +123 -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 +10 -0
- package/dist/plugins/providers/index.js.map +1 -0
- package/dist/providers/baseProvider.d.ts +140 -0
- package/dist/providers/baseProvider.d.ts.map +1 -0
- package/dist/providers/baseProvider.js +230 -0
- package/dist/providers/baseProvider.js.map +1 -0
- package/dist/providers/openaiChatCompletionsProvider.d.ts +70 -0
- package/dist/providers/openaiChatCompletionsProvider.d.ts.map +1 -0
- package/dist/providers/openaiChatCompletionsProvider.js +971 -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 +96 -0
- package/dist/providers/resilientProvider.d.ts.map +1 -0
- package/dist/providers/resilientProvider.js +251 -0
- package/dist/providers/resilientProvider.js.map +1 -0
- package/dist/runtime/agentController.d.ts +137 -0
- package/dist/runtime/agentController.d.ts.map +1 -0
- package/dist/runtime/agentController.js +784 -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 +158 -0
- package/dist/runtime/agentHost.js.map +1 -0
- package/dist/runtime/agentSession.d.ts +49 -0
- package/dist/runtime/agentSession.d.ts.map +1 -0
- package/dist/runtime/agentSession.js +218 -0
- package/dist/runtime/agentSession.js.map +1 -0
- package/dist/runtime/agentSpawningWiring.d.ts +32 -0
- package/dist/runtime/agentSpawningWiring.d.ts.map +1 -0
- package/dist/runtime/agentSpawningWiring.js +114 -0
- package/dist/runtime/agentSpawningWiring.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 +50 -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/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/toolPresentation.d.ts +54 -0
- package/dist/shell/toolPresentation.d.ts.map +1 -0
- package/dist/shell/toolPresentation.js +334 -0
- package/dist/shell/toolPresentation.js.map +1 -0
- package/dist/tools/bashTools.d.ts +11 -0
- package/dist/tools/bashTools.d.ts.map +1 -0
- package/dist/tools/bashTools.js +785 -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 +792 -0
- package/dist/tools/editTools.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 +389 -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 +137 -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 +185 -0
- package/dist/tools/hitlTools.js.map +1 -0
- package/dist/tools/memoryTools.d.ts +27 -0
- package/dist/tools/memoryTools.d.ts.map +1 -0
- package/dist/tools/memoryTools.js +197 -0
- package/dist/tools/memoryTools.js.map +1 -0
- package/dist/tools/notebookTools.d.ts +20 -0
- package/dist/tools/notebookTools.d.ts.map +1 -0
- package/dist/tools/notebookTools.js +140 -0
- package/dist/tools/notebookTools.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 +414 -0
- package/dist/tools/searchTools.js.map +1 -0
- package/dist/tools/skillTools.d.ts +24 -0
- package/dist/tools/skillTools.d.ts.map +1 -0
- package/dist/tools/skillTools.js +140 -0
- package/dist/tools/skillTools.js.map +1 -0
- package/dist/tools/todoTools.d.ts +23 -0
- package/dist/tools/todoTools.d.ts.map +1 -0
- package/dist/tools/todoTools.js +120 -0
- package/dist/tools/todoTools.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 +467 -0
- package/dist/tools/webTools.js.map +1 -0
- package/dist/ui/ink/App.d.ts +53 -0
- package/dist/ui/ink/App.d.ts.map +1 -0
- package/dist/ui/ink/App.js +13 -0
- package/dist/ui/ink/App.js.map +1 -0
- package/dist/ui/ink/ChatStatic.d.ts +30 -0
- package/dist/ui/ink/ChatStatic.d.ts.map +1 -0
- package/dist/ui/ink/ChatStatic.js +83 -0
- package/dist/ui/ink/ChatStatic.js.map +1 -0
- package/dist/ui/ink/InkPromptController.d.ts +321 -0
- package/dist/ui/ink/InkPromptController.d.ts.map +1 -0
- package/dist/ui/ink/InkPromptController.js +667 -0
- package/dist/ui/ink/InkPromptController.js.map +1 -0
- package/dist/ui/ink/Menu.d.ts +21 -0
- package/dist/ui/ink/Menu.d.ts.map +1 -0
- package/dist/ui/ink/Menu.js +61 -0
- package/dist/ui/ink/Menu.js.map +1 -0
- package/dist/ui/ink/Prompt.d.ts +47 -0
- package/dist/ui/ink/Prompt.d.ts.map +1 -0
- package/dist/ui/ink/Prompt.js +571 -0
- package/dist/ui/ink/Prompt.js.map +1 -0
- package/dist/ui/ink/StatusLine.d.ts +35 -0
- package/dist/ui/ink/StatusLine.d.ts.map +1 -0
- package/dist/ui/ink/StatusLine.js +66 -0
- package/dist/ui/ink/StatusLine.js.map +1 -0
- package/dist/ui/ink/pasteBuffer.d.ts +44 -0
- package/dist/ui/ink/pasteBuffer.d.ts.map +1 -0
- package/dist/ui/ink/pasteBuffer.js +73 -0
- package/dist/ui/ink/pasteBuffer.js.map +1 -0
- package/dist/ui/theme.d.ts +351 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +435 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/utils/analytics.d.ts +2 -0
- package/dist/utils/analytics.d.ts.map +1 -0
- package/dist/utils/analytics.js +51 -0
- package/dist/utils/analytics.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 +116 -0
- package/scripts/postinstall.cjs +56 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type StatusSink = (message: string) => void;
|
|
2
|
+
export declare function setStatusSink(sink: StatusSink | null): void;
|
|
3
|
+
export declare function reportStatus(message: string): void;
|
|
4
|
+
export declare function reportStatusError(error: unknown, prefix?: string): void;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=statusReporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statusReporter.d.ts","sourceRoot":"","sources":["../../src/utils/statusReporter.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAO5C,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI,CAE3D;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAUlD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,GAAE,MAAgB,GAAG,IAAI,CAOhF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { stdout } from 'node:process';
|
|
2
|
+
let statusSink = null;
|
|
3
|
+
const normalizeStatusMessage = (message) => message.replace(/\s+/g, ' ').trim();
|
|
4
|
+
export function setStatusSink(sink) {
|
|
5
|
+
statusSink = sink;
|
|
6
|
+
}
|
|
7
|
+
export function reportStatus(message) {
|
|
8
|
+
const normalized = normalizeStatusMessage(message);
|
|
9
|
+
if (!normalized) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (statusSink) {
|
|
13
|
+
statusSink(normalized);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
stdout.write(`${normalized}\n`);
|
|
17
|
+
}
|
|
18
|
+
export function reportStatusError(error, prefix = 'Error') {
|
|
19
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
20
|
+
const safePrefix = prefix.trim();
|
|
21
|
+
const text = safePrefix
|
|
22
|
+
? `${safePrefix}${safePrefix.endsWith(':') ? '' : ':'} ${message}`
|
|
23
|
+
: message;
|
|
24
|
+
reportStatus(text);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=statusReporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statusReporter.js","sourceRoot":"","sources":["../../src/utils/statusReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,IAAI,UAAU,GAAsB,IAAI,CAAC;AAEzC,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAU,EAAE,CACzD,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,IAAuB;IACnD,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,UAAU,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACnD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;IACT,CAAC;IACD,IAAI,UAAU,EAAE,CAAC;QACf,UAAU,CAAC,UAAU,CAAC,CAAC;QACvB,OAAO;IACT,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAc,EAAE,SAAiB,OAAO;IACxE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,IAAI,GAAG,UAAU;QACrB,CAAC,CAAC,GAAG,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,EAAE;QAClE,CAAC,CAAC,OAAO,CAAC;IACZ,YAAY,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface WorkspaceCaptureOptions {
|
|
2
|
+
treeDepth?: number;
|
|
3
|
+
maxEntries?: number;
|
|
4
|
+
docExcerptLimit?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function resolveWorkspaceCaptureOptions(env?: NodeJS.ProcessEnv): WorkspaceCaptureOptions;
|
|
7
|
+
export declare function buildWorkspaceContext(root: string, options?: WorkspaceCaptureOptions): string | null;
|
|
8
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,8BAA8B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,uBAAuB,CAM5G;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B,GAAG,MAAM,GAAG,IAAI,CA4DxG"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { safeWorkspaceContext, validateWorkspaceOptions } from './workspace.validator.js';
|
|
4
|
+
import { reportStatus, reportStatusError } from './utils/statusReporter.js';
|
|
5
|
+
const PRIORITY_DOCS = ['README.md']; // Removed package.json to save context
|
|
6
|
+
const IGNORED_DIRS = new Set([
|
|
7
|
+
'.git', 'node_modules', 'dist', '.trenchwork', 'build', 'coverage', '.next', 'out',
|
|
8
|
+
'__pycache__', '.pytest_cache', '.mypy_cache', 'venv', '.venv', 'env',
|
|
9
|
+
'target', 'bin', 'obj', '.idea', '.vscode', '.DS_Store'
|
|
10
|
+
]);
|
|
11
|
+
const IGNORED_FILES = new Set(['package-lock.json', 'yarn.lock', 'pnpm-lock.yaml']);
|
|
12
|
+
const DEFAULT_TREE_DEPTH = 1; // Reduced from 2 to 1 for critical context savings
|
|
13
|
+
const DEFAULT_MAX_ENTRIES = 30; // Further reduced from 50 to 30 - emergency reduction
|
|
14
|
+
const DEFAULT_DOC_LIMIT = 200; // Further reduced from 300 to 200 - emergency reduction
|
|
15
|
+
const DEBUG_CONTEXT_ERRORS = Boolean(process.env['DEBUG_CONTEXT_ERRORS']);
|
|
16
|
+
export function resolveWorkspaceCaptureOptions(env = process.env) {
|
|
17
|
+
return {
|
|
18
|
+
treeDepth: parsePositiveInt(env['TRENCHWORK_CONTEXT_TREE_DEPTH']),
|
|
19
|
+
maxEntries: parsePositiveInt(env['TRENCHWORK_CONTEXT_MAX_ENTRIES']),
|
|
20
|
+
docExcerptLimit: parsePositiveInt(env['TRENCHWORK_CONTEXT_DOC_LIMIT']),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function buildWorkspaceContext(root, options = {}) {
|
|
24
|
+
// CRITICAL: Validate options BEFORE building context
|
|
25
|
+
const optionsValidation = validateWorkspaceOptions(options);
|
|
26
|
+
if (!optionsValidation.valid) {
|
|
27
|
+
// Only log in debug mode to avoid polluting chat
|
|
28
|
+
if (process.env['DEBUG_CONTEXT']) {
|
|
29
|
+
reportStatus(`[Workspace Context] Invalid options: ${optionsValidation.errors.join(', ')}`);
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`Invalid workspace options: ${optionsValidation.errors.join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
// Warnings only in debug mode
|
|
34
|
+
if (optionsValidation.warnings.length > 0 && process.env['DEBUG_CONTEXT']) {
|
|
35
|
+
console.warn('[Workspace Context] Warnings:', optionsValidation.warnings);
|
|
36
|
+
}
|
|
37
|
+
const treeDepth = options.treeDepth ?? DEFAULT_TREE_DEPTH;
|
|
38
|
+
const maxEntries = options.maxEntries ?? DEFAULT_MAX_ENTRIES;
|
|
39
|
+
const docLimit = options.docExcerptLimit ?? DEFAULT_DOC_LIMIT;
|
|
40
|
+
try {
|
|
41
|
+
const treeLines = formatFileTree(root, treeDepth, maxEntries);
|
|
42
|
+
const docSnippets = capturePriorityDocs(root, docLimit);
|
|
43
|
+
const sections = [`cwd: ${root}`];
|
|
44
|
+
if (treeLines.length) {
|
|
45
|
+
sections.push('files:', ...treeLines);
|
|
46
|
+
}
|
|
47
|
+
if (docSnippets.length) {
|
|
48
|
+
sections.push(docSnippets.join('\n\n'));
|
|
49
|
+
}
|
|
50
|
+
const rawContent = sections.filter((section) => section.trim().length > 0).join('\n');
|
|
51
|
+
const safe = safeWorkspaceContext(rawContent, {
|
|
52
|
+
truncate: true,
|
|
53
|
+
throwOnError: false,
|
|
54
|
+
});
|
|
55
|
+
if (process.env['DEBUG_CONTEXT']) {
|
|
56
|
+
console.log('[Workspace Context] Stats:', safe.stats);
|
|
57
|
+
}
|
|
58
|
+
if (!safe.content.trim()) {
|
|
59
|
+
if (DEBUG_CONTEXT_ERRORS) {
|
|
60
|
+
console.warn('[Workspace Context] Captured context is empty after filtering.');
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return safe.content;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
// Only log errors in debug mode to avoid polluting chat
|
|
68
|
+
if (DEBUG_CONTEXT_ERRORS || process.env['DEBUG_CONTEXT']) {
|
|
69
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
70
|
+
reportStatus(`[Workspace Context] Failed to build context: ${message}`);
|
|
71
|
+
reportStatusError(error, '[Workspace Context] Error');
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function capturePriorityDocs(root, docLimit) {
|
|
77
|
+
return PRIORITY_DOCS.filter((name) => existsSync(join(root, name))).map((name) => {
|
|
78
|
+
try {
|
|
79
|
+
const content = readFileSync(join(root, name), 'utf8');
|
|
80
|
+
// Safety: Hard limit to prevent context explosion
|
|
81
|
+
const safeLimit = Math.min(docLimit, 300);
|
|
82
|
+
const snippet = content.length > safeLimit ? `${content.slice(0, safeLimit)}\n...` : content;
|
|
83
|
+
return `--- ${name} ---\n${snippet.trim()}`;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return `--- ${name} ---\n[Could not read file]`;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function formatFileTree(root, maxDepth, maxEntries) {
|
|
91
|
+
const lines = [];
|
|
92
|
+
const walk = (dir, depth, prefix) => {
|
|
93
|
+
if (depth > maxDepth || lines.length >= maxEntries) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const entries = safeReadDir(dir)
|
|
97
|
+
.filter((entry) => !IGNORED_DIRS.has(entry.name))
|
|
98
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
99
|
+
for (const entry of entries) {
|
|
100
|
+
if (entry.isFile() && IGNORED_FILES.has(entry.name)) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (lines.length >= maxEntries) {
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
const isDir = entry.isDirectory();
|
|
107
|
+
lines.push(`${prefix}${entry.name}${isDir ? '/' : ''}`);
|
|
108
|
+
if (isDir && depth < maxDepth) {
|
|
109
|
+
walk(join(dir, entry.name), depth + 1, `${prefix} `);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
walk(root, 0, '');
|
|
114
|
+
return lines;
|
|
115
|
+
}
|
|
116
|
+
function safeReadDir(dir) {
|
|
117
|
+
try {
|
|
118
|
+
return readdirSync(dir, { withFileTypes: true });
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (DEBUG_CONTEXT_ERRORS) {
|
|
122
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
123
|
+
console.warn(`[Workspace Context] Skipping ${dir}: ${message}`);
|
|
124
|
+
}
|
|
125
|
+
return [];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function parsePositiveInt(raw) {
|
|
129
|
+
if (!raw) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const value = Number.parseInt(raw, 10);
|
|
133
|
+
return Number.isFinite(value) && value > 0 ? value : undefined;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0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AAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO,CAAC,IAAI,CAAC,gCAAgC,GAAG,KAAK,OAAO,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAY;IACpC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Context Validator - Enforces strict safety limits
|
|
3
|
+
*
|
|
4
|
+
* CRITICAL: Prevents context explosion by validating all workspace context
|
|
5
|
+
* before it's sent to the LLM. Multiple safety layers ensure we never
|
|
6
|
+
* exceed token limits.
|
|
7
|
+
*/
|
|
8
|
+
export interface ValidationResult {
|
|
9
|
+
valid: boolean;
|
|
10
|
+
errors: string[];
|
|
11
|
+
warnings: string[];
|
|
12
|
+
stats: ContextStats;
|
|
13
|
+
}
|
|
14
|
+
export interface ContextStats {
|
|
15
|
+
totalChars: number;
|
|
16
|
+
totalLines: number;
|
|
17
|
+
estimatedTokens: number;
|
|
18
|
+
fileEntries: number;
|
|
19
|
+
docChars: number;
|
|
20
|
+
}
|
|
21
|
+
export interface WorkspaceContextSafe {
|
|
22
|
+
content: string;
|
|
23
|
+
stats: ContextStats;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validate workspace context options BEFORE building context
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateWorkspaceOptions(options: {
|
|
29
|
+
treeDepth?: number;
|
|
30
|
+
maxEntries?: number;
|
|
31
|
+
docExcerptLimit?: number;
|
|
32
|
+
}): ValidationResult;
|
|
33
|
+
/**
|
|
34
|
+
* Validate workspace context AFTER building - CRITICAL SAFETY CHECK
|
|
35
|
+
* This is the final line of defense against context explosion
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateWorkspaceContext(content: string): ValidationResult;
|
|
38
|
+
/**
|
|
39
|
+
* Safe truncation - if content exceeds limits, truncate intelligently
|
|
40
|
+
*/
|
|
41
|
+
export declare function truncateWorkspaceContext(content: string): WorkspaceContextSafe;
|
|
42
|
+
/**
|
|
43
|
+
* Validate and enforce limits in a single call - RECOMMENDED USAGE
|
|
44
|
+
*/
|
|
45
|
+
export declare function safeWorkspaceContext(content: string | null, options?: {
|
|
46
|
+
truncate?: boolean;
|
|
47
|
+
throwOnError?: boolean;
|
|
48
|
+
}): WorkspaceContextSafe;
|
|
49
|
+
//# sourceMappingURL=workspace.validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.validator.d.ts","sourceRoot":"","sources":["../src/workspace.validator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,YAAY,CAAC;CACrB;AASD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,gBAAgB,CAuDnB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAuE1E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,CA2C9E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GACvD,oBAAoB,CAiDtB"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Context Validator - Enforces strict safety limits
|
|
3
|
+
*
|
|
4
|
+
* CRITICAL: Prevents context explosion by validating all workspace context
|
|
5
|
+
* before it's sent to the LLM. Multiple safety layers ensure we never
|
|
6
|
+
* exceed token limits.
|
|
7
|
+
*/
|
|
8
|
+
import { ContextOverflowError, ResourceLimitError } from './core/errors/errorTypes.js';
|
|
9
|
+
import { logDebug } from './utils/debugLogger.js';
|
|
10
|
+
// ABSOLUTE MAXIMUM LIMITS - Never exceed these under any circumstances
|
|
11
|
+
const ABSOLUTE_MAX_CHARS = 5000; // ~1,250 tokens (4 chars per token)
|
|
12
|
+
const ABSOLUTE_MAX_LINES = 100; // Maximum lines in any context
|
|
13
|
+
const ABSOLUTE_MAX_FILE_ENTRIES = 50; // Maximum files in tree
|
|
14
|
+
const ABSOLUTE_MAX_DOC_CHARS = 300; // Maximum chars per priority doc
|
|
15
|
+
const WARNING_THRESHOLD = 0.7; // Warn at 70% of max
|
|
16
|
+
/**
|
|
17
|
+
* Estimate token count (rough: 1 token ≈ 4 characters)
|
|
18
|
+
*/
|
|
19
|
+
function estimateTokens(text) {
|
|
20
|
+
return Math.ceil(text.length / 4);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Validate workspace context options BEFORE building context
|
|
24
|
+
*/
|
|
25
|
+
export function validateWorkspaceOptions(options) {
|
|
26
|
+
const errors = [];
|
|
27
|
+
const warnings = [];
|
|
28
|
+
// Validate tree depth
|
|
29
|
+
if (options.treeDepth !== undefined) {
|
|
30
|
+
if (options.treeDepth < 0) {
|
|
31
|
+
errors.push('treeDepth cannot be negative');
|
|
32
|
+
}
|
|
33
|
+
if (options.treeDepth > 2) {
|
|
34
|
+
errors.push(`treeDepth ${options.treeDepth} exceeds maximum of 2`);
|
|
35
|
+
}
|
|
36
|
+
if (options.treeDepth > 1) {
|
|
37
|
+
warnings.push('treeDepth > 1 can significantly increase context size');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Validate max entries
|
|
41
|
+
if (options.maxEntries !== undefined) {
|
|
42
|
+
if (options.maxEntries < 0) {
|
|
43
|
+
errors.push('maxEntries cannot be negative');
|
|
44
|
+
}
|
|
45
|
+
if (options.maxEntries > ABSOLUTE_MAX_FILE_ENTRIES) {
|
|
46
|
+
errors.push(`maxEntries ${options.maxEntries} exceeds maximum of ${ABSOLUTE_MAX_FILE_ENTRIES}`);
|
|
47
|
+
}
|
|
48
|
+
if (options.maxEntries > 40) {
|
|
49
|
+
warnings.push('maxEntries > 40 may use significant context');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Validate doc excerpt limit
|
|
53
|
+
if (options.docExcerptLimit !== undefined) {
|
|
54
|
+
if (options.docExcerptLimit < 0) {
|
|
55
|
+
errors.push('docExcerptLimit cannot be negative');
|
|
56
|
+
}
|
|
57
|
+
if (options.docExcerptLimit > ABSOLUTE_MAX_DOC_CHARS) {
|
|
58
|
+
errors.push(`docExcerptLimit ${options.docExcerptLimit} exceeds maximum of ${ABSOLUTE_MAX_DOC_CHARS}`);
|
|
59
|
+
}
|
|
60
|
+
if (options.docExcerptLimit > 250) {
|
|
61
|
+
warnings.push('docExcerptLimit > 250 may use significant context');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
valid: errors.length === 0,
|
|
66
|
+
errors,
|
|
67
|
+
warnings,
|
|
68
|
+
stats: {
|
|
69
|
+
totalChars: 0,
|
|
70
|
+
totalLines: 0,
|
|
71
|
+
estimatedTokens: 0,
|
|
72
|
+
fileEntries: options.maxEntries ?? 0,
|
|
73
|
+
docChars: options.docExcerptLimit ?? 0,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Validate workspace context AFTER building - CRITICAL SAFETY CHECK
|
|
79
|
+
* This is the final line of defense against context explosion
|
|
80
|
+
*/
|
|
81
|
+
export function validateWorkspaceContext(content) {
|
|
82
|
+
const errors = [];
|
|
83
|
+
const warnings = [];
|
|
84
|
+
// Count basic metrics
|
|
85
|
+
const totalChars = content.length;
|
|
86
|
+
const lines = content.split('\n');
|
|
87
|
+
const totalLines = lines.length;
|
|
88
|
+
const estimatedTokens = estimateTokens(content);
|
|
89
|
+
// Count file entries (lines that look like file paths)
|
|
90
|
+
const fileEntries = lines.filter(line => line.trim() && !line.startsWith('---') && !line.startsWith('cwd:')).length;
|
|
91
|
+
// Count chars in priority docs section
|
|
92
|
+
const docMatch = content.match(/--- .* ---[\s\S]*?(?=\n\n|$)/g);
|
|
93
|
+
const docChars = docMatch ? docMatch.join('').length : 0;
|
|
94
|
+
const stats = {
|
|
95
|
+
totalChars,
|
|
96
|
+
totalLines,
|
|
97
|
+
estimatedTokens,
|
|
98
|
+
fileEntries,
|
|
99
|
+
docChars,
|
|
100
|
+
};
|
|
101
|
+
// CRITICAL: Check absolute maximum character limit
|
|
102
|
+
if (totalChars > ABSOLUTE_MAX_CHARS) {
|
|
103
|
+
const error = new ContextOverflowError(totalChars, ABSOLUTE_MAX_CHARS, 'chars', true);
|
|
104
|
+
errors.push(`Context exceeds ABSOLUTE maximum: ${error.message}`);
|
|
105
|
+
}
|
|
106
|
+
// CRITICAL: Check absolute maximum line limit
|
|
107
|
+
if (totalLines > ABSOLUTE_MAX_LINES) {
|
|
108
|
+
const error = new ContextOverflowError(totalLines, ABSOLUTE_MAX_LINES, 'lines', true);
|
|
109
|
+
errors.push(`Context exceeds ABSOLUTE maximum: ${error.message}`);
|
|
110
|
+
}
|
|
111
|
+
// CRITICAL: Check absolute maximum file entries
|
|
112
|
+
if (fileEntries > ABSOLUTE_MAX_FILE_ENTRIES) {
|
|
113
|
+
const error = new ResourceLimitError('file entries', fileEntries, ABSOLUTE_MAX_FILE_ENTRIES, false);
|
|
114
|
+
errors.push(`Context exceeds ABSOLUTE maximum: ${error.message}`);
|
|
115
|
+
}
|
|
116
|
+
// WARNING: Approaching limits
|
|
117
|
+
if (totalChars > ABSOLUTE_MAX_CHARS * WARNING_THRESHOLD) {
|
|
118
|
+
warnings.push(`Context size ${totalChars} chars is ${Math.round(totalChars / ABSOLUTE_MAX_CHARS * 100)}% of maximum. ` +
|
|
119
|
+
`Consider reducing treeDepth, maxEntries, or docExcerptLimit.`);
|
|
120
|
+
}
|
|
121
|
+
if (estimatedTokens > 1000) {
|
|
122
|
+
warnings.push(`Estimated ${estimatedTokens} tokens in workspace context. This is high and may impact performance.`);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
valid: errors.length === 0,
|
|
126
|
+
errors,
|
|
127
|
+
warnings,
|
|
128
|
+
stats,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Safe truncation - if content exceeds limits, truncate intelligently
|
|
133
|
+
*/
|
|
134
|
+
export function truncateWorkspaceContext(content) {
|
|
135
|
+
const validation = validateWorkspaceContext(content);
|
|
136
|
+
// If valid, return as-is
|
|
137
|
+
if (validation.valid) {
|
|
138
|
+
return {
|
|
139
|
+
content,
|
|
140
|
+
stats: validation.stats,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
// CRITICAL: Content exceeds limits, must truncate
|
|
144
|
+
const lines = content.split('\n');
|
|
145
|
+
const truncatedLines = [];
|
|
146
|
+
let charCount = 0;
|
|
147
|
+
// Keep up to absolute maximums
|
|
148
|
+
for (const line of lines) {
|
|
149
|
+
if (truncatedLines.length >= ABSOLUTE_MAX_LINES) {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
if (charCount + line.length > ABSOLUTE_MAX_CHARS) {
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
truncatedLines.push(line);
|
|
156
|
+
charCount += line.length + 1; // +1 for newline
|
|
157
|
+
}
|
|
158
|
+
// Add truncation notice
|
|
159
|
+
if (truncatedLines.length < lines.length) {
|
|
160
|
+
truncatedLines.push('');
|
|
161
|
+
truncatedLines.push('[Workspace context truncated to prevent context overflow]');
|
|
162
|
+
truncatedLines.push(`[Showing ${truncatedLines.length} of ${lines.length} lines]`);
|
|
163
|
+
}
|
|
164
|
+
const truncatedContent = truncatedLines.join('\n');
|
|
165
|
+
const stats = validateWorkspaceContext(truncatedContent).stats;
|
|
166
|
+
return {
|
|
167
|
+
content: truncatedContent,
|
|
168
|
+
stats,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Validate and enforce limits in a single call - RECOMMENDED USAGE
|
|
173
|
+
*/
|
|
174
|
+
export function safeWorkspaceContext(content, options) {
|
|
175
|
+
const { truncate = true, throwOnError = false } = options ?? {};
|
|
176
|
+
if (!content) {
|
|
177
|
+
return {
|
|
178
|
+
content: '',
|
|
179
|
+
stats: {
|
|
180
|
+
totalChars: 0,
|
|
181
|
+
totalLines: 0,
|
|
182
|
+
estimatedTokens: 0,
|
|
183
|
+
fileEntries: 0,
|
|
184
|
+
docChars: 0,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const validation = validateWorkspaceContext(content);
|
|
189
|
+
// Log warnings to debug
|
|
190
|
+
if (validation.warnings.length > 0) {
|
|
191
|
+
logDebug('[Workspace Context Validator] Warnings:');
|
|
192
|
+
for (const warning of validation.warnings) {
|
|
193
|
+
logDebug(` - ${warning}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// Handle errors
|
|
197
|
+
if (!validation.valid) {
|
|
198
|
+
logDebug('[Workspace Context Validator] CRITICAL ERRORS:');
|
|
199
|
+
for (const error of validation.errors) {
|
|
200
|
+
logDebug(` - ${error}`);
|
|
201
|
+
}
|
|
202
|
+
if (throwOnError) {
|
|
203
|
+
throw new Error(`Workspace context validation failed:\n${validation.errors.join('\n')}`);
|
|
204
|
+
}
|
|
205
|
+
if (truncate) {
|
|
206
|
+
logDebug('[Workspace Context Validator] Auto-truncating to safe limits...');
|
|
207
|
+
return truncateWorkspaceContext(content);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
content,
|
|
212
|
+
stats: validation.stats,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=workspace.validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.validator.js","sourceRoot":"","sources":["../src/workspace.validator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,uEAAuE;AACvE,MAAM,kBAAkB,GAAG,IAAI,CAAC,CAAQ,oCAAoC;AAC5E,MAAM,kBAAkB,GAAG,GAAG,CAAC,CAAS,+BAA+B;AACvE,MAAM,yBAAyB,GAAG,EAAE,CAAC,CAAG,wBAAwB;AAChE,MAAM,sBAAsB,GAAG,GAAG,CAAC,CAAK,iCAAiC;AACzE,MAAM,iBAAiB,GAAG,GAAG,CAAC,CAAU,qBAAqB;AAsB7D;;GAEG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CA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AAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,yCAAyC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxE,CAAC;QACJ,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,iEAAiE,CAAC,CAAC;YAC5E,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,KAAK,EAAE,UAAU,CAAC,KAAK;KACxB,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@trenchwork/coder",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Claude Code–class Ink TUI agent for DeepSeek v4 Pro (max thought, ultracode always on). Live follow-up queue, Shift+Tab permission modes, colored diffs, adversarial verifier — your keys, no login. Independent; inspired by Project Glasswing.",
|
|
5
|
+
"deepseek": {
|
|
6
|
+
"rulebookSchema": "src/contracts/schemas/agent-rules.schema.json"
|
|
7
|
+
},
|
|
8
|
+
"main": "dist/bin/deepseek.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/bin/deepseek.js",
|
|
11
|
+
"./capabilities": "./dist/capabilities/index.js"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"scripts/postinstall.cjs",
|
|
17
|
+
"README.md",
|
|
18
|
+
"agents",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"deepseek": "dist/bin/deepseek.js",
|
|
23
|
+
"trenchwork": "dist/bin/deepseek.js",
|
|
24
|
+
"trenchwork-coder": "dist/bin/deepseek.js"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"postinstall": "node scripts/postinstall.cjs",
|
|
28
|
+
"prebuild": "npm run clean",
|
|
29
|
+
"clean": "node -e \"const { rmSync } = require('fs'); for (const target of ['dist', '.tsbuildinfo']) { try { rmSync(target, { recursive: true, force: true, maxRetries: 10 }); } catch (error) { console.warn('Clean warning:', error.code, 'for', target); } }\"",
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"build:watch": "tsc --watch",
|
|
32
|
+
"build:prod": "NODE_ENV=production MINIFY=true npm run build",
|
|
33
|
+
"optimize": "node scripts/optimize-build.mjs",
|
|
34
|
+
"release": "chmod +x scripts/create-release.sh && scripts/create-release.sh patch",
|
|
35
|
+
"release:minor": "chmod +x scripts/create-release.sh && scripts/create-release.sh minor",
|
|
36
|
+
"release:major": "chmod +x scripts/create-release.sh && scripts/create-release.sh major",
|
|
37
|
+
"prepublishOnly": "npm run build",
|
|
38
|
+
"pretest": "npm run build",
|
|
39
|
+
"postbuild": "node scripts/postbuild.mjs",
|
|
40
|
+
"cli": "node dist/bin/deepseek.js",
|
|
41
|
+
"dev": "node --loader ts-node/esm src/bin/deepseek.ts",
|
|
42
|
+
"dev:watch": "node --watch --loader ts-node/esm src/bin/deepseek.ts",
|
|
43
|
+
"start": "node dist/bin/deepseek.js",
|
|
44
|
+
"test": "jest --config jest.config.cjs",
|
|
45
|
+
"test:watch": "jest --config jest.config.cjs --watch",
|
|
46
|
+
"test:coverage": "jest --config jest.config.cjs --coverage",
|
|
47
|
+
"lint": "eslint src/**/*.ts --max-warnings 200",
|
|
48
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
49
|
+
"type-check": "tsc --noEmit"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"ai",
|
|
53
|
+
"cli",
|
|
54
|
+
"agent",
|
|
55
|
+
"llm",
|
|
56
|
+
"deepseek",
|
|
57
|
+
"code-assistant",
|
|
58
|
+
"automation",
|
|
59
|
+
"developer-tools"
|
|
60
|
+
],
|
|
61
|
+
"author": "",
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "git+https://github.com/Aroxora/trenchwork-coder.git"
|
|
66
|
+
},
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/Aroxora/trenchwork-coder/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/Aroxora/trenchwork-coder#readme",
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=20.0.0"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@babel/core": "^7.28.5",
|
|
76
|
+
"@babel/preset-env": "^7.28.5",
|
|
77
|
+
"@babel/preset-react": "^7.28.5",
|
|
78
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
79
|
+
"@eslint/js": "^9.39.2",
|
|
80
|
+
"@types/glob": "^8.1.0",
|
|
81
|
+
"@types/gradient-string": "^1.1.6",
|
|
82
|
+
"@types/jest": "30.0.0",
|
|
83
|
+
"@types/node": "25.0.2",
|
|
84
|
+
"@types/react": "^19.2.0",
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "8.49.0",
|
|
86
|
+
"@typescript-eslint/parser": "8.49.0",
|
|
87
|
+
"@xterm/headless": "^6.0.0",
|
|
88
|
+
"babel-jest": "^30.2.0",
|
|
89
|
+
"eslint": "9.39.2",
|
|
90
|
+
"eslint-plugin-import": "^2.32.0",
|
|
91
|
+
"ink-testing-library": "^4.0.0",
|
|
92
|
+
"jest": "30.2.0",
|
|
93
|
+
"node-pty": "^1.1.0",
|
|
94
|
+
"ts-jest": "29.4.6",
|
|
95
|
+
"ts-node": "^10.9.2",
|
|
96
|
+
"typescript-eslint": "^8.50.0"
|
|
97
|
+
},
|
|
98
|
+
"overrides": {
|
|
99
|
+
"uuid": "^14.0.0"
|
|
100
|
+
},
|
|
101
|
+
"dependencies": {
|
|
102
|
+
"boxen": "^8.0.1",
|
|
103
|
+
"chalk": "^5.6.2",
|
|
104
|
+
"cli-spinners": "^3.3.0",
|
|
105
|
+
"gradient-string": "^3.0.0",
|
|
106
|
+
"ink": "^7.0.1",
|
|
107
|
+
"ink-spinner": "^5.0.0",
|
|
108
|
+
"nanospinner": "1.2.2",
|
|
109
|
+
"open": "^11.0.0",
|
|
110
|
+
"openai": "^6.10.0",
|
|
111
|
+
"ora": "^9.0.0",
|
|
112
|
+
"react": "^19.2.0",
|
|
113
|
+
"react-devtools-core": "^7.0.1",
|
|
114
|
+
"typescript": "5.9.3"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall:
|
|
4
|
+
* 1. chmod the bin entrypoints so they're executable on POSIX (no-op on Windows).
|
|
5
|
+
* 2. On Windows, print a friendly one-time notice about PowerShell execution
|
|
6
|
+
* policy and the canonical command forms so users don't get blocked the
|
|
7
|
+
* first time they type `trenchwork` in PowerShell.
|
|
8
|
+
*
|
|
9
|
+
* Errors are intentionally swallowed: a postinstall must never fail an
|
|
10
|
+
* `npm install` for a non-essential courtesy step.
|
|
11
|
+
*/
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const os = require('os');
|
|
16
|
+
const path = require('path');
|
|
17
|
+
|
|
18
|
+
const BINS = [
|
|
19
|
+
'dist/bin/deepseek.js',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
for (const rel of BINS) {
|
|
23
|
+
try {
|
|
24
|
+
fs.chmodSync(path.resolve(__dirname, '..', rel), 0o755);
|
|
25
|
+
} catch {
|
|
26
|
+
// Missing files (clean tree pre-build) and Windows chmod no-ops both land here.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (process.platform === 'win32' && !process.env['TRENCHWORK_QUIET_POSTINSTALL']) {
|
|
31
|
+
// Single, scannable message — no banners, no marketing. Users see this once
|
|
32
|
+
// per global install and can move on.
|
|
33
|
+
const lines = [
|
|
34
|
+
'',
|
|
35
|
+
'[36mTrenchwork Coder[0m installed. Two notes for Windows:',
|
|
36
|
+
'',
|
|
37
|
+
' [2m• Commands available on PATH:[0m trenchwork · trenchwork-coder · deepseek',
|
|
38
|
+
' These work in [1mCommand Prompt[0m and [1mPowerShell[0m via the .cmd shims',
|
|
39
|
+
' npm installs automatically.',
|
|
40
|
+
'',
|
|
41
|
+
' [2m• If PowerShell says "running scripts is disabled on this system",[0m',
|
|
42
|
+
' run this [2m(once, no admin needed)[0m and reopen the shell:',
|
|
43
|
+
'',
|
|
44
|
+
' [33mSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser[0m',
|
|
45
|
+
'',
|
|
46
|
+
' Or invoke the .cmd shim directly: [33mtrenchwork.cmd[0m',
|
|
47
|
+
'',
|
|
48
|
+
];
|
|
49
|
+
// Use stderr so the notice is visible even when npm is captured to stdout
|
|
50
|
+
// by automation. The notice is short and bounded.
|
|
51
|
+
try {
|
|
52
|
+
process.stderr.write(lines.join(os.EOL) + os.EOL);
|
|
53
|
+
} catch {
|
|
54
|
+
// Even the notice itself is non-essential.
|
|
55
|
+
}
|
|
56
|
+
}
|