@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,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live quota for the *included* (hosted) DeepSeek + Tavily keys, surfaced on
|
|
3
|
+
* the marketing site's login portal so a visitor can see how much of the
|
|
4
|
+
* included pool is left before signing in.
|
|
5
|
+
*
|
|
6
|
+
* Glasswing: the keys NEVER reach the browser. A server-side job
|
|
7
|
+
* (scripts/gen-quota.mjs, run in the deploy pipeline with the keys in env)
|
|
8
|
+
* calls these fetchers and writes the derived numbers to website/quota.json.
|
|
9
|
+
* The client reads only that file. The parsers are split out from the network
|
|
10
|
+
* so they can be unit-tested against the real API response shapes on CI, while
|
|
11
|
+
* the live fetch is exercised locally against the real endpoints (gated on the
|
|
12
|
+
* keys being present — never mocked).
|
|
13
|
+
*
|
|
14
|
+
* Real response shapes (probed 2026-06-03):
|
|
15
|
+
* DeepSeek GET /user/balance →
|
|
16
|
+
* {"is_available":true,"balance_infos":[{"currency":"USD",
|
|
17
|
+
* "total_balance":"10.22","granted_balance":"0.00","topped_up_balance":"10.22"}]}
|
|
18
|
+
* Tavily GET /usage →
|
|
19
|
+
* {"account":{"current_plan":"...","plan_usage":4710,"plan_limit":1000,...}, "key":{...}}
|
|
20
|
+
* Tavily's response carries no record of the one-time 5,000-credit bonus, so
|
|
21
|
+
* the included pool is the API's monthly allotment PLUS the documented bonus
|
|
22
|
+
* constant; "remaining" is that pool minus live cumulative usage.
|
|
23
|
+
*/
|
|
24
|
+
export interface DeepSeekQuota {
|
|
25
|
+
available: boolean;
|
|
26
|
+
balance: number | null;
|
|
27
|
+
currency: string | null;
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface TavilyQuota {
|
|
31
|
+
available: boolean;
|
|
32
|
+
used: number | null;
|
|
33
|
+
monthlyFree: number;
|
|
34
|
+
bonus: number;
|
|
35
|
+
included: number;
|
|
36
|
+
remaining: number | null;
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface Quota {
|
|
40
|
+
generated: string;
|
|
41
|
+
deepseek: DeepSeekQuota;
|
|
42
|
+
tavily: TavilyQuota;
|
|
43
|
+
}
|
|
44
|
+
export type FetchLike = (url: string, init?: {
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
}) => Promise<{
|
|
47
|
+
ok: boolean;
|
|
48
|
+
status: number;
|
|
49
|
+
json: () => Promise<unknown>;
|
|
50
|
+
}>;
|
|
51
|
+
export declare function parseDeepSeekBalance(json: any): DeepSeekQuota;
|
|
52
|
+
export declare function parseTavilyUsage(json: any): TavilyQuota;
|
|
53
|
+
export declare function fetchDeepSeekBalance(key: string, fetchImpl?: FetchLike): Promise<DeepSeekQuota>;
|
|
54
|
+
export declare function fetchTavilyUsage(key: string, fetchImpl?: FetchLike): Promise<TavilyQuota>;
|
|
55
|
+
export declare function buildLiveQuota(opts: {
|
|
56
|
+
deepseekKey?: string;
|
|
57
|
+
tavilyKey?: string;
|
|
58
|
+
now: string;
|
|
59
|
+
fetchImpl?: FetchLike;
|
|
60
|
+
}): Promise<Quota>;
|
|
61
|
+
//# sourceMappingURL=quota.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota.d.ts","sourceRoot":"","sources":["../../src/core/quota.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;CACrB;AAID,MAAM,MAAM,SAAS,GAAG,CACtB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,KACxC,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CAAC;AAG5E,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,GAAG,aAAa,CAW7D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,WAAW,CAevD;AAKD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAWrG;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAmB/F;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GAAG,OAAO,CAAC,KAAK,CAAC,CAMjB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live quota for the *included* (hosted) DeepSeek + Tavily keys, surfaced on
|
|
3
|
+
* the marketing site's login portal so a visitor can see how much of the
|
|
4
|
+
* included pool is left before signing in.
|
|
5
|
+
*
|
|
6
|
+
* Glasswing: the keys NEVER reach the browser. A server-side job
|
|
7
|
+
* (scripts/gen-quota.mjs, run in the deploy pipeline with the keys in env)
|
|
8
|
+
* calls these fetchers and writes the derived numbers to website/quota.json.
|
|
9
|
+
* The client reads only that file. The parsers are split out from the network
|
|
10
|
+
* so they can be unit-tested against the real API response shapes on CI, while
|
|
11
|
+
* the live fetch is exercised locally against the real endpoints (gated on the
|
|
12
|
+
* keys being present — never mocked).
|
|
13
|
+
*
|
|
14
|
+
* Real response shapes (probed 2026-06-03):
|
|
15
|
+
* DeepSeek GET /user/balance →
|
|
16
|
+
* {"is_available":true,"balance_infos":[{"currency":"USD",
|
|
17
|
+
* "total_balance":"10.22","granted_balance":"0.00","topped_up_balance":"10.22"}]}
|
|
18
|
+
* Tavily GET /usage →
|
|
19
|
+
* {"account":{"current_plan":"...","plan_usage":4710,"plan_limit":1000,...}, "key":{...}}
|
|
20
|
+
* Tavily's response carries no record of the one-time 5,000-credit bonus, so
|
|
21
|
+
* the included pool is the API's monthly allotment PLUS the documented bonus
|
|
22
|
+
* constant; "remaining" is that pool minus live cumulative usage.
|
|
23
|
+
*/
|
|
24
|
+
import { TAVILY_MONTHLY_FREE, TAVILY_ONE_TIME_BONUS } from './usage.js';
|
|
25
|
+
const DEEPSEEK_BALANCE_URL = 'https://api.deepseek.com/user/balance';
|
|
26
|
+
const TAVILY_USAGE_URL = 'https://api.tavily.com/usage';
|
|
27
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
28
|
+
export function parseDeepSeekBalance(json) {
|
|
29
|
+
const infos = Array.isArray(json?.balance_infos) ? json.balance_infos : [];
|
|
30
|
+
// Prefer the USD line; fall back to the first entry.
|
|
31
|
+
const info = infos.find((b) => b?.currency === 'USD') ?? infos[0];
|
|
32
|
+
const raw = info?.total_balance;
|
|
33
|
+
const balance = raw != null && raw !== '' ? Number(raw) : NaN;
|
|
34
|
+
return {
|
|
35
|
+
available: Boolean(json?.is_available),
|
|
36
|
+
balance: Number.isFinite(balance) ? balance : null,
|
|
37
|
+
currency: typeof info?.currency === 'string' ? info.currency : null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function parseTavilyUsage(json) {
|
|
41
|
+
const rawUsed = json?.account?.plan_usage;
|
|
42
|
+
const used = rawUsed != null ? Number(rawUsed) : NaN;
|
|
43
|
+
const monthlyFree = TAVILY_MONTHLY_FREE;
|
|
44
|
+
const bonus = TAVILY_ONE_TIME_BONUS;
|
|
45
|
+
const included = monthlyFree + bonus;
|
|
46
|
+
const u = Number.isFinite(used) ? used : null;
|
|
47
|
+
return {
|
|
48
|
+
available: u != null,
|
|
49
|
+
used: u,
|
|
50
|
+
monthlyFree,
|
|
51
|
+
bonus,
|
|
52
|
+
included,
|
|
53
|
+
remaining: u == null ? null : Math.max(0, included - u),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
57
|
+
// Error strings are deliberately key-free (status code only). A thrown network
|
|
58
|
+
// error is collapsed to a generic string so a stack/URL can never leak a key.
|
|
59
|
+
export async function fetchDeepSeekBalance(key, fetchImpl) {
|
|
60
|
+
const f = fetchImpl ?? globalThis.fetch;
|
|
61
|
+
const unavailable = (error) => ({ available: false, balance: null, currency: null, error });
|
|
62
|
+
if (!key)
|
|
63
|
+
return unavailable('no key');
|
|
64
|
+
try {
|
|
65
|
+
const res = await f(DEEPSEEK_BALANCE_URL, { headers: { Authorization: `Bearer ${key}` } });
|
|
66
|
+
if (!res.ok)
|
|
67
|
+
return unavailable(`HTTP ${res.status}`);
|
|
68
|
+
return parseDeepSeekBalance(await res.json());
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return unavailable('request failed');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export async function fetchTavilyUsage(key, fetchImpl) {
|
|
75
|
+
const f = fetchImpl ?? globalThis.fetch;
|
|
76
|
+
const unavailable = (error) => ({
|
|
77
|
+
available: false,
|
|
78
|
+
used: null,
|
|
79
|
+
monthlyFree: TAVILY_MONTHLY_FREE,
|
|
80
|
+
bonus: TAVILY_ONE_TIME_BONUS,
|
|
81
|
+
included: TAVILY_MONTHLY_FREE + TAVILY_ONE_TIME_BONUS,
|
|
82
|
+
remaining: null,
|
|
83
|
+
error,
|
|
84
|
+
});
|
|
85
|
+
if (!key)
|
|
86
|
+
return unavailable('no key');
|
|
87
|
+
try {
|
|
88
|
+
const res = await f(TAVILY_USAGE_URL, { headers: { Authorization: `Bearer ${key}` } });
|
|
89
|
+
if (!res.ok)
|
|
90
|
+
return unavailable(`HTTP ${res.status}`);
|
|
91
|
+
return parseTavilyUsage(await res.json());
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return unavailable('request failed');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export async function buildLiveQuota(opts) {
|
|
98
|
+
const [deepseek, tavily] = await Promise.all([
|
|
99
|
+
fetchDeepSeekBalance(opts.deepseekKey ?? '', opts.fetchImpl),
|
|
100
|
+
fetchTavilyUsage(opts.tavilyKey ?? '', opts.fetchImpl),
|
|
101
|
+
]);
|
|
102
|
+
return { generated: opts.now, deepseek, tavily };
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=quota.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota.js","sourceRoot":"","sources":["../../src/core/quota.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExE,MAAM,oBAAoB,GAAG,uCAAuC,CAAC;AACrE,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AAgCxD,uDAAuD;AACvD,MAAM,UAAU,oBAAoB,CAAC,IAAS;IAC5C,MAAM,KAAK,GAAU,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IAClF,qDAAqD;IACrD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,GAAG,GAAG,IAAI,EAAE,aAAa,CAAC;IAChC,MAAM,OAAO,GAAG,GAAG,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9D,OAAO;QACL,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CAAC,EAAE;YAAE,OAAO,WAAW,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACtD,OAAO,gBAAgB,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAKpC;IACC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC3C,oBAAoB,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC;QAC5D,gBAAgB,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC;KACvD,CAAC,CAAC;IACH,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quota / balance exhaustion handling for the two external services the
|
|
3
|
+
* agent leans on: Tavily (web search) and DeepSeek (the LLM provider).
|
|
4
|
+
*
|
|
5
|
+
* The goal is a single, recognizable user message when a paid quota or
|
|
6
|
+
* monthly free-tier cap is the actual cause of a failure — so the user
|
|
7
|
+
* isn't reading "Tavily API error: 432" or "402 Insufficient Balance"
|
|
8
|
+
* and guessing what to do. The helpers are pure (no I/O, no logging)
|
|
9
|
+
* so they can be exercised from both the web-tools layer and the
|
|
10
|
+
* provider layer without coupling.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TAVILY_QUOTA_MESSAGE: string;
|
|
13
|
+
export declare const DEEPSEEK_QUOTA_MESSAGE: string;
|
|
14
|
+
/**
|
|
15
|
+
* Detect a Tavily response that means "you've hit your monthly quota
|
|
16
|
+
* (or rate limit) — nothing else will succeed until you top up or
|
|
17
|
+
* the cycle resets". Tavily uses 432 for usage cap, 433 for plan
|
|
18
|
+
* paused, and 429 for short-window rate limits — all three deserve
|
|
19
|
+
* the same user-facing message because the user's remediation is
|
|
20
|
+
* identical.
|
|
21
|
+
*
|
|
22
|
+
* `bodyText` is the response body, lowercased by the caller (or
|
|
23
|
+
* empty if the body could not be read). It's checked as a defence
|
|
24
|
+
* against Tavily changing status codes — quota-language in the body
|
|
25
|
+
* is sufficient.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isTavilyQuotaResponse(status: number, bodyText: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Detect a DeepSeek error that means "your account balance is exhausted
|
|
30
|
+
* — top up or wait for a paid plan to refill". DeepSeek returns HTTP 402
|
|
31
|
+
* with `Insufficient Balance` in the body when the prepaid balance hits
|
|
32
|
+
* zero; that is the canonical signal. We also catch the lowercase / spaced
|
|
33
|
+
* variants and an explicit `status === 402` from the OpenAI SDK error
|
|
34
|
+
* shape (numeric `.status`, not a string).
|
|
35
|
+
*/
|
|
36
|
+
export declare function isDeepSeekQuotaError(error: unknown): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Build a quota-exhaustion Error for DeepSeek. Centralized so the
|
|
39
|
+
* agent-facing message is identical wherever a 402 is detected.
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildDeepSeekQuotaError(): Error;
|
|
42
|
+
//# sourceMappingURL=quotaErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotaErrors.d.ts","sourceRoot":"","sources":["../../src/core/quotaErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,oBAAoB,QAKrB,CAAC;AAEb,eAAO,MAAM,sBAAsB,QAIvB,CAAC;AAEb;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAY/E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAW5D;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,KAAK,CAO/C"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quota / balance exhaustion handling for the two external services the
|
|
3
|
+
* agent leans on: Tavily (web search) and DeepSeek (the LLM provider).
|
|
4
|
+
*
|
|
5
|
+
* The goal is a single, recognizable user message when a paid quota or
|
|
6
|
+
* monthly free-tier cap is the actual cause of a failure — so the user
|
|
7
|
+
* isn't reading "Tavily API error: 432" or "402 Insufficient Balance"
|
|
8
|
+
* and guessing what to do. The helpers are pure (no I/O, no logging)
|
|
9
|
+
* so they can be exercised from both the web-tools layer and the
|
|
10
|
+
* provider layer without coupling.
|
|
11
|
+
*/
|
|
12
|
+
export const TAVILY_QUOTA_MESSAGE = [
|
|
13
|
+
'Web search is disabled: the Tavily monthly free-tier quota is exhausted.',
|
|
14
|
+
' • This automatically re-enables on the 1st of next month (UTC reset).',
|
|
15
|
+
' • To restore search immediately, top up at https://app.tavily.com/billing',
|
|
16
|
+
' or set your own key: /key tvly-…',
|
|
17
|
+
].join('\n');
|
|
18
|
+
export const DEEPSEEK_QUOTA_MESSAGE = [
|
|
19
|
+
'DeepSeek API is disabled: your account balance is exhausted.',
|
|
20
|
+
' • Top up at https://platform.deepseek.com/billing (DeepSeek does not auto-reset).',
|
|
21
|
+
' • Or set a different key: /key sk-…',
|
|
22
|
+
].join('\n');
|
|
23
|
+
/**
|
|
24
|
+
* Detect a Tavily response that means "you've hit your monthly quota
|
|
25
|
+
* (or rate limit) — nothing else will succeed until you top up or
|
|
26
|
+
* the cycle resets". Tavily uses 432 for usage cap, 433 for plan
|
|
27
|
+
* paused, and 429 for short-window rate limits — all three deserve
|
|
28
|
+
* the same user-facing message because the user's remediation is
|
|
29
|
+
* identical.
|
|
30
|
+
*
|
|
31
|
+
* `bodyText` is the response body, lowercased by the caller (or
|
|
32
|
+
* empty if the body could not be read). It's checked as a defence
|
|
33
|
+
* against Tavily changing status codes — quota-language in the body
|
|
34
|
+
* is sufficient.
|
|
35
|
+
*/
|
|
36
|
+
export function isTavilyQuotaResponse(status, bodyText) {
|
|
37
|
+
if (status === 402 || status === 429 || status === 432 || status === 433) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
const text = bodyText.toLowerCase();
|
|
41
|
+
return (text.includes('usage limit') ||
|
|
42
|
+
text.includes('monthly limit') ||
|
|
43
|
+
text.includes('plan limit') ||
|
|
44
|
+
text.includes('usage_limit_exceeded') ||
|
|
45
|
+
text.includes('quota'));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Detect a DeepSeek error that means "your account balance is exhausted
|
|
49
|
+
* — top up or wait for a paid plan to refill". DeepSeek returns HTTP 402
|
|
50
|
+
* with `Insufficient Balance` in the body when the prepaid balance hits
|
|
51
|
+
* zero; that is the canonical signal. We also catch the lowercase / spaced
|
|
52
|
+
* variants and an explicit `status === 402` from the OpenAI SDK error
|
|
53
|
+
* shape (numeric `.status`, not a string).
|
|
54
|
+
*/
|
|
55
|
+
export function isDeepSeekQuotaError(error) {
|
|
56
|
+
if (!(error instanceof Error))
|
|
57
|
+
return false;
|
|
58
|
+
const status = error.status;
|
|
59
|
+
if (status === 402)
|
|
60
|
+
return true;
|
|
61
|
+
const message = error.message.toLowerCase();
|
|
62
|
+
if (message.includes('402'))
|
|
63
|
+
return true;
|
|
64
|
+
if (message.includes('insufficient balance'))
|
|
65
|
+
return true;
|
|
66
|
+
if (message.includes('insufficient_balance'))
|
|
67
|
+
return true;
|
|
68
|
+
if (message.includes('balance is not enough'))
|
|
69
|
+
return true;
|
|
70
|
+
if (message.includes('payment required'))
|
|
71
|
+
return true;
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Build a quota-exhaustion Error for DeepSeek. Centralized so the
|
|
76
|
+
* agent-facing message is identical wherever a 402 is detected.
|
|
77
|
+
*/
|
|
78
|
+
export function buildDeepSeekQuotaError() {
|
|
79
|
+
const err = new Error(DEEPSEEK_QUOTA_MESSAGE);
|
|
80
|
+
// Tag it so retry / circuit-breaker layers can treat it as
|
|
81
|
+
// non-transient without re-detecting via message scraping.
|
|
82
|
+
err.isQuotaExhausted = true;
|
|
83
|
+
err.provider = 'deepseek';
|
|
84
|
+
return err;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=quotaErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotaErrors.js","sourceRoot":"","sources":["../../src/core/quotaErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,0EAA0E;IAC1E,yEAAyE;IACzE,6EAA6E;IAC7E,sCAAsC;CACvC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,8DAA8D;IAC9D,qFAAqF;IACrF,uCAAuC;CACxC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAc,EAAE,QAAgB;IACpE,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACpC,OAAO,CACL,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC5B,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACrC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CACvB,CAAC;AACJ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
|
2
|
+
* Heuristic: did the model return a safety/policy refusal?
|
|
3
|
+
*
|
|
4
|
+
* Used by the interactive shell to short-circuit the auto-continue
|
|
5
|
+
* loop — a "no, I won't do that" response is the terminal turn rather
|
|
6
|
+
* than a stop the auto-continue logic should bulldoze through with
|
|
7
|
+
* another "continue" prompt. Extracted to a free function so it's
|
|
8
|
+
* unit-testable without standing up the whole shell.
|
|
9
|
+
*
|
|
10
|
+
* Looks at the first ~1KB of the buffered response — refusals lead
|
|
11
|
+
* with the decline, so a substring scan is enough and keeps the cost
|
|
12
|
+
* trivial.
|
|
13
|
+
*/
|
|
14
|
+
const DECLINE_PHRASES = [
|
|
15
|
+
"i can't help",
|
|
16
|
+
'i cannot help',
|
|
17
|
+
"i won't help",
|
|
18
|
+
'i will not help',
|
|
19
|
+
"i can't assist",
|
|
20
|
+
'i cannot assist',
|
|
21
|
+
"i won't assist",
|
|
22
|
+
"i'm not going to help",
|
|
23
|
+
'i am not going to help',
|
|
24
|
+
"i'm not able to help",
|
|
25
|
+
'i am not able to help',
|
|
26
|
+
"i'm unable to help",
|
|
27
|
+
"i'm not going to continue",
|
|
28
|
+
"i've declined",
|
|
29
|
+
'i have declined',
|
|
30
|
+
'i decline',
|
|
31
|
+
'i must decline',
|
|
32
|
+
'i need to decline',
|
|
33
|
+
"i'm declining",
|
|
34
|
+
"i'm not comfortable",
|
|
35
|
+
'against my guidelines',
|
|
36
|
+
'against my values',
|
|
37
|
+
'violates my',
|
|
38
|
+
];
|
|
39
|
+
export function isSafetyRefusal(text) {
|
|
40
|
+
if (!text)
|
|
41
|
+
return false;
|
|
42
|
+
const head = text.slice(0, 1024).toLowerCase();
|
|
43
|
+
if (!head.trim())
|
|
44
|
+
return false;
|
|
45
|
+
for (const phrase of DECLINE_PHRASES) {
|
|
46
|
+
if (head.includes(phrase))
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=refusalDetection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refusalDetection.js","sourceRoot":"","sources":["../../src/core/refusalDetection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,eAAe,GAAsB;IACzC,cAAc;IACd,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,uBAAuB;IACvB,wBAAwB;IACxB,sBAAsB;IACtB,uBAAuB;IACvB,oBAAoB;IACpB,2BAA2B;IAC3B,eAAe;IACf,iBAAiB;IACjB,WAAW;IACX,gBAAgB;IAChB,mBAAmB;IACnB,eAAe;IACf,qBAAqB;IACrB,uBAAuB;IACvB,mBAAmB;IACnB,aAAa;CACd,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,IAA+B;IAC7D,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,OAAO,KAAK,CAAC;IAC/B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact "time ago" label for session timestamps (e.g. "3m ago", "2d ago").
|
|
3
|
+
* `now` is injectable so tests stay deterministic. Returns '' for unparseable
|
|
4
|
+
* input rather than throwing — a malformed session index must not crash the
|
|
5
|
+
* /resume picker.
|
|
6
|
+
*/
|
|
7
|
+
export declare function relativeTime(iso: string, now?: number): string;
|
|
8
|
+
//# sourceMappingURL=relativeTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relativeTime.d.ts","sourceRoot":"","sources":["../../src/core/relativeTime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,CAgB1E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact "time ago" label for session timestamps (e.g. "3m ago", "2d ago").
|
|
3
|
+
* `now` is injectable so tests stay deterministic. Returns '' for unparseable
|
|
4
|
+
* input rather than throwing — a malformed session index must not crash the
|
|
5
|
+
* /resume picker.
|
|
6
|
+
*/
|
|
7
|
+
export function relativeTime(iso, now = Date.now()) {
|
|
8
|
+
const then = Date.parse(iso);
|
|
9
|
+
if (!Number.isFinite(then)) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
const sec = Math.max(0, Math.round((now - then) / 1000));
|
|
13
|
+
if (sec < 45)
|
|
14
|
+
return 'just now';
|
|
15
|
+
const min = Math.round(sec / 60);
|
|
16
|
+
if (min < 60)
|
|
17
|
+
return `${Math.max(1, min)}m ago`;
|
|
18
|
+
const hr = Math.round(min / 60);
|
|
19
|
+
if (hr < 24)
|
|
20
|
+
return `${hr}h ago`;
|
|
21
|
+
const day = Math.round(hr / 24);
|
|
22
|
+
if (day < 30)
|
|
23
|
+
return `${day}d ago`;
|
|
24
|
+
const mon = Math.round(day / 30);
|
|
25
|
+
if (mon < 12)
|
|
26
|
+
return `${mon}mo ago`;
|
|
27
|
+
return `${Math.round(mon / 12)}y ago`;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=relativeTime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relativeTime.js","sourceRoot":"","sources":["../../src/core/relativeTime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,MAAc,IAAI,CAAC,GAAG,EAAE;IAChE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACzD,IAAI,GAAG,GAAG,EAAE;QAAE,OAAO,UAAU,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IACjC,IAAI,GAAG,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAChD,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IAChC,IAAI,EAAE,GAAG,EAAE;QAAE,OAAO,GAAG,EAAE,OAAO,CAAC;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAChC,IAAI,GAAG,GAAG,EAAE;QAAE,OAAO,GAAG,GAAG,OAAO,CAAC;IACnC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IACjC,IAAI,GAAG,GAAG,EAAE;QAAE,OAAO,GAAG,GAAG,QAAQ,CAAC;IACpC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result Verification — canonical home for verifiedSuccess, verifiedFailure,
|
|
3
|
+
* analyzeOutput, OutputPatterns, etc. (Defined here, not re-exported; the
|
|
4
|
+
* orchestrationCapability module the old header named no longer exists.)
|
|
5
|
+
*/
|
|
6
|
+
export type VerificationStatus = 'VERIFIED_SUCCESS' | 'VERIFIED_FAILURE' | 'UNVERIFIED' | 'PARTIAL_SUCCESS' | 'REQUIRES_USER_ACTION';
|
|
7
|
+
export interface VerifiedResult {
|
|
8
|
+
status: VerificationStatus;
|
|
9
|
+
summary: string;
|
|
10
|
+
details: string;
|
|
11
|
+
verificationChecks?: VerificationCheck[];
|
|
12
|
+
suggestedActions?: string[];
|
|
13
|
+
verifiedAt: string;
|
|
14
|
+
durationMs?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface VerificationCheck {
|
|
17
|
+
check: string;
|
|
18
|
+
passed: boolean;
|
|
19
|
+
details?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const OutputPatterns: {
|
|
22
|
+
git: {
|
|
23
|
+
success: RegExp[];
|
|
24
|
+
failure: RegExp[];
|
|
25
|
+
};
|
|
26
|
+
npm: {
|
|
27
|
+
success: RegExp[];
|
|
28
|
+
failure: RegExp[];
|
|
29
|
+
};
|
|
30
|
+
command: {
|
|
31
|
+
success: RegExp[];
|
|
32
|
+
failure: RegExp[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare function verifiedSuccess(summary: string, details: string, checks?: VerificationCheck[], durationMs?: number): string;
|
|
36
|
+
export declare function verifiedFailure(summary: string, details: string, suggestedActions?: string[], checks?: VerificationCheck[], durationMs?: number): string;
|
|
37
|
+
export declare function analyzeOutput(output: string, patterns: {
|
|
38
|
+
success: RegExp[];
|
|
39
|
+
failure: RegExp[];
|
|
40
|
+
}, exitCode?: number): {
|
|
41
|
+
isSuccess: boolean;
|
|
42
|
+
isFailure: boolean;
|
|
43
|
+
matchedPattern?: string;
|
|
44
|
+
confidence: 'high' | 'medium' | 'low';
|
|
45
|
+
};
|
|
46
|
+
export declare function createCommandCheck(checkName: string, exitCode: number, output: string, expectedPatterns?: RegExp[]): VerificationCheck;
|
|
47
|
+
export declare function safeTruncate(content: string, maxLength: number, _label?: string): string;
|
|
48
|
+
//# sourceMappingURL=resultVerification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultVerification.d.ts","sourceRoot":"","sources":["../../src/core/resultVerification.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,kBAAkB,GAClB,YAAY,GACZ,iBAAiB,GACjB,sBAAsB,CAAC;AAE3B,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAa1B,CAAC;AA8BF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,iBAAiB,EAAE,EAC5B,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CASR;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAC3B,MAAM,CAAC,EAAE,iBAAiB,EAAE,EAC5B,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CAUR;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,EAClD,QAAQ,CAAC,EAAE,MAAM,GAChB;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;CAAE,CAa5G;AAED,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAC1B,iBAAiB,CAWnB;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,MAAkB,GAAG,MAAM,CAInG"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result Verification — canonical home for verifiedSuccess, verifiedFailure,
|
|
3
|
+
* analyzeOutput, OutputPatterns, etc. (Defined here, not re-exported; the
|
|
4
|
+
* orchestrationCapability module the old header named no longer exists.)
|
|
5
|
+
*/
|
|
6
|
+
// ANSI color codes for enhanced terminal output
|
|
7
|
+
const ANSI_RESET = '\x1b[0m';
|
|
8
|
+
const ANSI_RED = '\x1b[31m';
|
|
9
|
+
const ANSI_GREEN = '\x1b[32m';
|
|
10
|
+
const ANSI_YELLOW = '\x1b[33m';
|
|
11
|
+
const ANSI_BLUE = '\x1b[34m';
|
|
12
|
+
const ANSI_MAGENTA = '\x1b[35m';
|
|
13
|
+
const ANSI_CYAN = '\x1b[36m';
|
|
14
|
+
const ANSI_DIM = '\x1b[2m';
|
|
15
|
+
const ANSI_BOLD = '\x1b[1m';
|
|
16
|
+
const ANSI_RED_BOLD = '\x1b[1;31m';
|
|
17
|
+
const ANSI_GREEN_BOLD = '\x1b[1;32m';
|
|
18
|
+
const ANSI_YELLOW_BOLD = '\x1b[1;33m';
|
|
19
|
+
export const OutputPatterns = {
|
|
20
|
+
git: {
|
|
21
|
+
success: [/\[.+\s+\w+\]/, /pushed/i, /merged/i, /On branch/i, /nothing to commit/i, /Already up to date/i],
|
|
22
|
+
failure: [/fatal:/i, /error:/i, /conflict/i, /rejected/i, /CONFLICT/, /Aborting/i],
|
|
23
|
+
},
|
|
24
|
+
npm: {
|
|
25
|
+
success: [/npm notice/i, /\+ .+@\d+\.\d+\.\d+/, /published/i],
|
|
26
|
+
failure: [/npm ERR!/i, /ERESOLVE/i, /E404/i, /EINTEGRITY/i],
|
|
27
|
+
},
|
|
28
|
+
command: {
|
|
29
|
+
success: [/^(success|completed|done|finished)/im, /successfully/i],
|
|
30
|
+
failure: [/^error/im, /^fatal/im, /failed/i, /command not found/i, /permission denied/i, /ENOENT/i, /EACCES/i],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
function formatVerifiedResult(result) {
|
|
34
|
+
if (result.status === 'VERIFIED_SUCCESS')
|
|
35
|
+
return result.details || result.summary;
|
|
36
|
+
const lines = [];
|
|
37
|
+
switch (result.status) {
|
|
38
|
+
case 'VERIFIED_FAILURE':
|
|
39
|
+
lines.push(`${ANSI_RED_BOLD}═══ FAILED ═══${ANSI_RESET}`);
|
|
40
|
+
break;
|
|
41
|
+
case 'UNVERIFIED':
|
|
42
|
+
lines.push(`${ANSI_YELLOW_BOLD}═══ UNVERIFIED ═══${ANSI_RESET}`);
|
|
43
|
+
break;
|
|
44
|
+
case 'PARTIAL_SUCCESS':
|
|
45
|
+
lines.push(`${ANSI_YELLOW_BOLD}═══ PARTIAL SUCCESS ═══${ANSI_RESET}`);
|
|
46
|
+
break;
|
|
47
|
+
case 'REQUIRES_USER_ACTION':
|
|
48
|
+
lines.push(`${ANSI_CYAN}═══ ACTION REQUIRED ═══${ANSI_RESET}`);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
lines.push('', result.summary, '');
|
|
52
|
+
if (result.verificationChecks) {
|
|
53
|
+
const failedChecks = result.verificationChecks.filter(c => !c.passed);
|
|
54
|
+
if (failedChecks.length > 0) {
|
|
55
|
+
lines.push('Failed checks:');
|
|
56
|
+
for (const check of failedChecks) {
|
|
57
|
+
lines.push(` ${ANSI_RED}✗${ANSI_RESET} ${check.check}${check.details ? `: ${check.details}` : ''}`);
|
|
58
|
+
}
|
|
59
|
+
lines.push('');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (result.details)
|
|
63
|
+
lines.push(result.details, '');
|
|
64
|
+
if (result.suggestedActions?.length) {
|
|
65
|
+
lines.push('Suggested actions:');
|
|
66
|
+
for (const action of result.suggestedActions)
|
|
67
|
+
lines.push(` ${ANSI_GREEN}→${ANSI_RESET} ${action}`);
|
|
68
|
+
}
|
|
69
|
+
return lines.join('\n');
|
|
70
|
+
}
|
|
71
|
+
export function verifiedSuccess(summary, details, checks, durationMs) {
|
|
72
|
+
return formatVerifiedResult({
|
|
73
|
+
status: 'VERIFIED_SUCCESS',
|
|
74
|
+
summary,
|
|
75
|
+
details,
|
|
76
|
+
verificationChecks: checks,
|
|
77
|
+
verifiedAt: new Date().toISOString(),
|
|
78
|
+
durationMs,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export function verifiedFailure(summary, details, suggestedActions, checks, durationMs) {
|
|
82
|
+
return formatVerifiedResult({
|
|
83
|
+
status: 'VERIFIED_FAILURE',
|
|
84
|
+
summary,
|
|
85
|
+
details,
|
|
86
|
+
verificationChecks: checks,
|
|
87
|
+
suggestedActions,
|
|
88
|
+
verifiedAt: new Date().toISOString(),
|
|
89
|
+
durationMs,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export function analyzeOutput(output, patterns, exitCode) {
|
|
93
|
+
const normalizedOutput = output.normalize('NFC');
|
|
94
|
+
for (const pattern of patterns.failure) {
|
|
95
|
+
if (pattern.test(normalizedOutput))
|
|
96
|
+
return { isSuccess: false, isFailure: true, matchedPattern: pattern.source, confidence: 'high' };
|
|
97
|
+
}
|
|
98
|
+
for (const pattern of patterns.success) {
|
|
99
|
+
if (pattern.test(normalizedOutput))
|
|
100
|
+
return { isSuccess: true, isFailure: false, matchedPattern: pattern.source, confidence: 'high' };
|
|
101
|
+
}
|
|
102
|
+
if (exitCode !== undefined) {
|
|
103
|
+
if (exitCode !== 0)
|
|
104
|
+
return { isSuccess: false, isFailure: true, confidence: 'high' };
|
|
105
|
+
return { isSuccess: false, isFailure: false, confidence: 'low' };
|
|
106
|
+
}
|
|
107
|
+
return { isSuccess: false, isFailure: false, confidence: 'low' };
|
|
108
|
+
}
|
|
109
|
+
export function createCommandCheck(checkName, exitCode, output, expectedPatterns) {
|
|
110
|
+
let passed = exitCode === 0;
|
|
111
|
+
let details = exitCode === 0 ? 'Exit code 0' : `Exit code ${exitCode}`;
|
|
112
|
+
if (expectedPatterns && passed) {
|
|
113
|
+
const foundPattern = expectedPatterns.some((p) => p.test(output));
|
|
114
|
+
if (!foundPattern) {
|
|
115
|
+
passed = false;
|
|
116
|
+
details = 'Exit code 0 but expected output pattern not found';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return { check: checkName, passed, details };
|
|
120
|
+
}
|
|
121
|
+
export function safeTruncate(content, maxLength, _label = 'Content') {
|
|
122
|
+
if (content.length <= maxLength)
|
|
123
|
+
return content;
|
|
124
|
+
const hiddenChars = content.length - maxLength;
|
|
125
|
+
return `${content.slice(0, maxLength)}\n\n[... ${hiddenChars} characters truncated]`;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=resultVerification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultVerification.js","sourceRoot":"","sources":["../../src/core/resultVerification.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,gDAAgD;AAChD,MAAM,UAAU,GAAG,SAAS,CAAC;AAC7B,MAAM,QAAQ,GAAG,UAAU,CAAC;AAC5B,MAAM,UAAU,GAAG,UAAU,CAAC;AAC9B,MAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,MAAM,SAAS,GAAG,UAAU,CAA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AAiB,SAAS;IACzF,IAAI,OAAO,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,OAAO,CAAC;IAChD,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAC/C,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,YAAY,WAAW,wBAAwB,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* /rewind preview + result text. Pure + emoji-free (the UX contract §9 bans
|
|
3
|
+
* chrome emoji, and the legacy fileChangeTracker.getRevertSummary/revertAllChanges
|
|
4
|
+
* strings use 📋/⏪ + hardcode "/revert confirm" — so the Ink shell builds its
|
|
5
|
+
* own copy here and only calls revertAllChanges for the actual file restore).
|
|
6
|
+
*/
|
|
7
|
+
export interface RewindItem {
|
|
8
|
+
relPath: string;
|
|
9
|
+
/** true if the file existed before this run (restore); false if created (delete) */
|
|
10
|
+
existedBefore: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function rewindPreviewLines(items: RewindItem[]): string[];
|
|
13
|
+
export declare function rewindResultLine(restored: number, deleted: number): string;
|
|
14
|
+
//# sourceMappingURL=rewind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewind.d.ts","sourceRoot":"","sources":["../../src/core/rewind.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,CAShE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAK1E"}
|