@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,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical home for provider error classification (audit Rank 5, Phase 1).
|
|
3
|
+
*
|
|
4
|
+
* Behaviour-PRESERVING extraction: each call site's predicate + pattern set is
|
|
5
|
+
* moved here VERBATIM under a site-specific name — NOT merged into a superset.
|
|
6
|
+
* A superset would change which errors each provider retries or falls back on,
|
|
7
|
+
* a behaviour change the audit Do-NOT list forbids ("don't ship a behaviour
|
|
8
|
+
* change dressed as a refactor"). The providers import these and re-export under
|
|
9
|
+
* their existing public names, so importers + tests are untouched. agent.ts's
|
|
10
|
+
* classifier is a THIRD semantics (rate-limit + 5xx folded into "transient") and
|
|
11
|
+
* is deliberately NOT folded in here yet (deferred per the roadmap).
|
|
12
|
+
*
|
|
13
|
+
* test/error-classification.test.ts pins every predicate against a battery of
|
|
14
|
+
* real error shapes captured from the pre-extraction code, so any drift is red.
|
|
15
|
+
*/
|
|
16
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
17
|
+
// resilientProvider classifiers — LIVE (the fallback path in agentController +
|
|
18
|
+
// the retry loop in withProviderResilience). Patterns + logic verbatim.
|
|
19
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
20
|
+
export const RESILIENT_RATE_LIMIT_PATTERNS = [
|
|
21
|
+
'rate limit',
|
|
22
|
+
'rate_limit',
|
|
23
|
+
'ratelimit',
|
|
24
|
+
'too many requests',
|
|
25
|
+
'429',
|
|
26
|
+
'quota exceeded',
|
|
27
|
+
'request limit',
|
|
28
|
+
'throttled',
|
|
29
|
+
'overloaded',
|
|
30
|
+
'capacity',
|
|
31
|
+
];
|
|
32
|
+
export const RESILIENT_TRANSIENT_ERROR_PATTERNS = [
|
|
33
|
+
'timeout',
|
|
34
|
+
'timed out',
|
|
35
|
+
'network',
|
|
36
|
+
'connection',
|
|
37
|
+
'econnrefused',
|
|
38
|
+
'econnreset',
|
|
39
|
+
'enotfound',
|
|
40
|
+
'epipe',
|
|
41
|
+
'econnaborted',
|
|
42
|
+
'ehostunreach',
|
|
43
|
+
'enetunreach',
|
|
44
|
+
'socket',
|
|
45
|
+
'temporarily unavailable',
|
|
46
|
+
'502',
|
|
47
|
+
'503',
|
|
48
|
+
'504',
|
|
49
|
+
'bad gateway',
|
|
50
|
+
'service unavailable',
|
|
51
|
+
'gateway timeout',
|
|
52
|
+
'internal server error',
|
|
53
|
+
'500',
|
|
54
|
+
// Stream and fetch errors
|
|
55
|
+
'premature close',
|
|
56
|
+
'premature end',
|
|
57
|
+
'unexpected end',
|
|
58
|
+
'stream',
|
|
59
|
+
'aborted',
|
|
60
|
+
'fetcherror',
|
|
61
|
+
'fetch error',
|
|
62
|
+
'invalid response body',
|
|
63
|
+
'response body',
|
|
64
|
+
'gunzip',
|
|
65
|
+
'decompress',
|
|
66
|
+
'zlib',
|
|
67
|
+
'content-encoding',
|
|
68
|
+
'chunked encoding',
|
|
69
|
+
'transfer-encoding',
|
|
70
|
+
// SSL/TLS errors
|
|
71
|
+
'ssl',
|
|
72
|
+
'tls',
|
|
73
|
+
'certificate',
|
|
74
|
+
'cert',
|
|
75
|
+
'handshake',
|
|
76
|
+
];
|
|
77
|
+
export const FALLBACK_ELIGIBLE_PATTERNS = [
|
|
78
|
+
// Quota/billing errors
|
|
79
|
+
'insufficient_quota',
|
|
80
|
+
'quota exceeded',
|
|
81
|
+
'exceeded your current quota',
|
|
82
|
+
'billing',
|
|
83
|
+
'payment required',
|
|
84
|
+
'account suspended',
|
|
85
|
+
'account disabled',
|
|
86
|
+
// API key errors
|
|
87
|
+
'api key expired',
|
|
88
|
+
'api_key_invalid',
|
|
89
|
+
'invalid api key',
|
|
90
|
+
'invalid_api_key',
|
|
91
|
+
'api key not valid',
|
|
92
|
+
// Model availability errors
|
|
93
|
+
'model not found',
|
|
94
|
+
'model_not_found',
|
|
95
|
+
'does not exist',
|
|
96
|
+
'not available',
|
|
97
|
+
'deprecated',
|
|
98
|
+
'access denied',
|
|
99
|
+
'permission denied',
|
|
100
|
+
'unauthorized',
|
|
101
|
+
'401',
|
|
102
|
+
'403',
|
|
103
|
+
'400',
|
|
104
|
+
'invalid_argument',
|
|
105
|
+
// Regional/access restrictions
|
|
106
|
+
'region',
|
|
107
|
+
'not supported in your',
|
|
108
|
+
'country',
|
|
109
|
+
'restricted',
|
|
110
|
+
];
|
|
111
|
+
/**
|
|
112
|
+
* Check if an error warrants trying a different provider (fallback).
|
|
113
|
+
* These are non-transient errors that won't be fixed by retrying the same provider.
|
|
114
|
+
*/
|
|
115
|
+
export function isFallbackEligibleError(error) {
|
|
116
|
+
if (!(error instanceof Error))
|
|
117
|
+
return false;
|
|
118
|
+
const message = error.message.toLowerCase();
|
|
119
|
+
// Check message for fallback patterns
|
|
120
|
+
if (FALLBACK_ELIGIBLE_PATTERNS.some(pattern => message.includes(pattern))) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
// Check error code/type/reason if present (OpenAI and Google style errors).
|
|
124
|
+
// The TypeScript types here are aspirational — provider SDKs throw errors
|
|
125
|
+
// with `.status` as a number (HTTP code) or `.code`/`.type` as objects, so
|
|
126
|
+
// every lookup must be coerced through String() before .toLowerCase() or
|
|
127
|
+
// the whole error path crashes with `(...).toLowerCase is not a function`.
|
|
128
|
+
// Bug seen in 1.1.7: a DeepSeek error's numeric `.status` killed the
|
|
129
|
+
// submission flow on the first prompt of a fresh session.
|
|
130
|
+
const errorWithCode = error;
|
|
131
|
+
const code = String(errorWithCode.code ?? '').toLowerCase();
|
|
132
|
+
const type = String(errorWithCode.type ?? '').toLowerCase();
|
|
133
|
+
const reason = String(errorWithCode.reason ?? '').toLowerCase();
|
|
134
|
+
const status = String(errorWithCode.status ?? '').toLowerCase();
|
|
135
|
+
// OpenAI style errors
|
|
136
|
+
if (code === 'insufficient_quota' || type === 'insufficient_quota') {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
if (code === 'model_not_found' || type === 'model_not_found') {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
if (code === 'invalid_api_key' || type === 'invalid_api_key') {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
// Google style errors
|
|
146
|
+
if (reason === 'api_key_invalid' || status === 'invalid_argument') {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
if (code === '400' || code === '401' || code === '403') {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get a user-friendly description of why fallback is needed
|
|
156
|
+
*/
|
|
157
|
+
export function getFallbackReason(error) {
|
|
158
|
+
if (!(error instanceof Error))
|
|
159
|
+
return 'Unknown error';
|
|
160
|
+
const message = error.message.toLowerCase();
|
|
161
|
+
if (message.includes('quota') || message.includes('billing')) {
|
|
162
|
+
return 'API quota exceeded or billing issue';
|
|
163
|
+
}
|
|
164
|
+
if (message.includes('expired') || message.includes('api_key_invalid') || message.includes('api key')) {
|
|
165
|
+
return 'API key expired or invalid';
|
|
166
|
+
}
|
|
167
|
+
if (message.includes('model') && (message.includes('not found') || message.includes('not exist'))) {
|
|
168
|
+
return 'Model not available';
|
|
169
|
+
}
|
|
170
|
+
if (message.includes('unauthorized') || message.includes('401') || message.includes('invalid_api_key')) {
|
|
171
|
+
return 'Invalid API key';
|
|
172
|
+
}
|
|
173
|
+
if (message.includes('403') || message.includes('permission') || message.includes('access denied')) {
|
|
174
|
+
return 'Access denied';
|
|
175
|
+
}
|
|
176
|
+
if (message.includes('400') || message.includes('invalid_argument')) {
|
|
177
|
+
return 'Invalid request or API key';
|
|
178
|
+
}
|
|
179
|
+
if (message.includes('region') || message.includes('country') || message.includes('restricted')) {
|
|
180
|
+
return 'Regional restriction';
|
|
181
|
+
}
|
|
182
|
+
return 'Provider error';
|
|
183
|
+
}
|
|
184
|
+
export function isResilientRateLimitError(error) {
|
|
185
|
+
if (!(error instanceof Error))
|
|
186
|
+
return false;
|
|
187
|
+
const message = error.message.toLowerCase();
|
|
188
|
+
return RESILIENT_RATE_LIMIT_PATTERNS.some(pattern => message.includes(pattern));
|
|
189
|
+
}
|
|
190
|
+
export function isResilientTransientError(error) {
|
|
191
|
+
if (!(error instanceof Error))
|
|
192
|
+
return false;
|
|
193
|
+
// Check message
|
|
194
|
+
const message = error.message.toLowerCase();
|
|
195
|
+
if (RESILIENT_TRANSIENT_ERROR_PATTERNS.some(pattern => message.includes(pattern))) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
// Check error name/type (FetchError, AbortError, etc.)
|
|
199
|
+
const errorName = error.name?.toLowerCase() ?? '';
|
|
200
|
+
if (errorName.includes('fetch') || errorName.includes('abort') || errorName.includes('network')) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
// Check error code if present (Node.js style)
|
|
204
|
+
const errorCode = error.code?.toLowerCase() ?? '';
|
|
205
|
+
if (errorCode && RESILIENT_TRANSIENT_ERROR_PATTERNS.some(pattern => errorCode.includes(pattern))) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
// Check cause chain for nested errors
|
|
209
|
+
const cause = error.cause;
|
|
210
|
+
if (cause instanceof Error) {
|
|
211
|
+
return isResilientTransientError(cause);
|
|
212
|
+
}
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
export function shouldRetryResilient(error) {
|
|
216
|
+
return isResilientRateLimitError(error) || isResilientTransientError(error);
|
|
217
|
+
}
|
|
218
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
219
|
+
// baseProvider classifiers — kept DISTINCT from the resilient set (e.g. base
|
|
220
|
+
// has no enotfound/ssl). Currently consumed only by tests + baseProvider's own
|
|
221
|
+
// withRetry default. Patterns + logic verbatim.
|
|
222
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
223
|
+
/** Patterns that indicate transient/retryable errors */
|
|
224
|
+
export const BASE_TRANSIENT_ERROR_PATTERNS = [
|
|
225
|
+
'premature close',
|
|
226
|
+
'premature end',
|
|
227
|
+
'unexpected end',
|
|
228
|
+
'aborted',
|
|
229
|
+
'fetcherror',
|
|
230
|
+
'invalid response body',
|
|
231
|
+
'gunzip',
|
|
232
|
+
'decompress',
|
|
233
|
+
'econnreset',
|
|
234
|
+
'econnrefused',
|
|
235
|
+
'epipe',
|
|
236
|
+
'socket hang up',
|
|
237
|
+
'network',
|
|
238
|
+
'timeout',
|
|
239
|
+
'500',
|
|
240
|
+
'502',
|
|
241
|
+
'503',
|
|
242
|
+
'504',
|
|
243
|
+
'overloaded',
|
|
244
|
+
];
|
|
245
|
+
/** Check if an error is transient and can be retried */
|
|
246
|
+
export function isBaseTransientError(error) {
|
|
247
|
+
if (!(error instanceof Error))
|
|
248
|
+
return false;
|
|
249
|
+
const message = error.message.toLowerCase();
|
|
250
|
+
const errorName = error.name?.toLowerCase() ?? '';
|
|
251
|
+
const errorCode = error.code?.toLowerCase() ?? '';
|
|
252
|
+
const allText = `${message} ${errorName} ${errorCode}`;
|
|
253
|
+
return BASE_TRANSIENT_ERROR_PATTERNS.some((pattern) => allText.includes(pattern));
|
|
254
|
+
}
|
|
255
|
+
/** Check if an error is a rate limit error */
|
|
256
|
+
export function isBaseRateLimitError(error) {
|
|
257
|
+
if (!(error instanceof Error))
|
|
258
|
+
return false;
|
|
259
|
+
const message = error.message.toLowerCase();
|
|
260
|
+
// Check for common rate limit indicators
|
|
261
|
+
if (message.includes('rate limit') ||
|
|
262
|
+
message.includes('rate_limit') ||
|
|
263
|
+
message.includes('too many requests') ||
|
|
264
|
+
message.includes('429')) {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
// Check for status code
|
|
268
|
+
const status = error.status;
|
|
269
|
+
return status === 429;
|
|
270
|
+
}
|
|
271
|
+
/** Check if an error is an authentication error */
|
|
272
|
+
export function isAuthError(error) {
|
|
273
|
+
if (!(error instanceof Error))
|
|
274
|
+
return false;
|
|
275
|
+
const message = error.message.toLowerCase();
|
|
276
|
+
const status = error.status;
|
|
277
|
+
return (status === 401 ||
|
|
278
|
+
status === 403 ||
|
|
279
|
+
message.includes('unauthorized') ||
|
|
280
|
+
message.includes('invalid api key') ||
|
|
281
|
+
message.includes('authentication'));
|
|
282
|
+
}
|
|
283
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
284
|
+
// agent.ts classifiers — a THIRD semantics: isAgentTransientError folds rate
|
|
285
|
+
// limits + 5xx + "server error" INTO "transient" (the agent retries all of them
|
|
286
|
+
// the same way), unlike the base/resilient split. Kept distinct. Verbatim.
|
|
287
|
+
// ════════════════════════════════════════════════════════════════════════════
|
|
288
|
+
/** Check if an error is a context overflow error */
|
|
289
|
+
export function isContextOverflowError(error) {
|
|
290
|
+
if (!(error instanceof Error))
|
|
291
|
+
return false;
|
|
292
|
+
const message = error.message.toLowerCase();
|
|
293
|
+
return (message.includes('context length') ||
|
|
294
|
+
message.includes('token') && (message.includes('limit') || message.includes('exceed') || message.includes('maximum')) ||
|
|
295
|
+
message.includes('too long') ||
|
|
296
|
+
message.includes('too many tokens') ||
|
|
297
|
+
message.includes('max_tokens') ||
|
|
298
|
+
message.includes('context window'));
|
|
299
|
+
}
|
|
300
|
+
/** Check if an error is transient/retryable from the agent loop's perspective
|
|
301
|
+
* (network issues, rate limits, AND server errors all fold into "transient"). */
|
|
302
|
+
export function isAgentTransientError(error) {
|
|
303
|
+
if (!(error instanceof Error))
|
|
304
|
+
return false;
|
|
305
|
+
const message = error.message.toLowerCase();
|
|
306
|
+
// Network errors (including streaming-specific termination patterns from undici/node-fetch)
|
|
307
|
+
const networkPatterns = [
|
|
308
|
+
'econnrefused', 'econnreset', 'enotfound', 'etimedout', 'epipe',
|
|
309
|
+
'network error', 'connection error', 'fetch failed', 'socket hang up',
|
|
310
|
+
'network is unreachable', 'connection refused', 'connection reset',
|
|
311
|
+
// Streaming-specific: server closes connection mid-stream
|
|
312
|
+
'premature close', 'premature end', 'unexpected end',
|
|
313
|
+
'aborted', 'fetcherror', 'invalid response body',
|
|
314
|
+
];
|
|
315
|
+
if (networkPatterns.some(p => message.includes(p))) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
// Rate limit errors
|
|
319
|
+
if (message.includes('rate limit') || message.includes('429') || message.includes('too many requests')) {
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
// Server errors (5xx)
|
|
323
|
+
if (message.includes('500') || message.includes('502') || message.includes('503') || message.includes('504')) {
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
// Temporary service errors
|
|
327
|
+
if (message.includes('service unavailable') || message.includes('temporarily unavailable') ||
|
|
328
|
+
message.includes('overloaded') || message.includes('server error')) {
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=errorClassification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorClassification.js","sourceRoot":"","sources":["../../src/core/errorClassification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,+EAA+E;AAC/E,+EAA+E;AAC/E,wEAAwE;AACxE,+EAA+E;AAE/E,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,mBAAmB;IACnB,KAAK;IACL,gBAAgB;IAChB,eAAe;IACf,WAAW;IACX,YAAY;IACZ,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,SAAS;IACT,WAAW;IACX,SAAS;IACT,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,WAAW;IACX,OAAO;IACP,cAAc;IACd,cAAc;IACd,aAAa;IACb,QAAQ;IACR,yBAAyB;IACzB,KAAK;IACL,KAAK;IACL,KAAK;IACL,aAAa;IACb,qBAAqB;IACrB,iBAAiB;IACjB,uBAAuB;IACvB,KAAK;IACL,0BAA0B;IAC1B,iBAAiB;IACjB,eAAe;IACf,gBAAgB;IAChB,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,aAAa;IACb,uBAAuB;IACvB,eAAe;IACf,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,KAAK;IACL,KAAK;IACL,aAAa;IACb,MAAM;IACN,WAAW;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,uBAAuB;IACvB,oBAAoB;IACpB,gBAAgB;IAChB,6BAA6B;IAC7B,SAAS;IACT,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,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O,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProviderId } from '../types.js';
|
|
2
|
+
import { type SecretDefinition } from '../secretStore.js';
|
|
3
|
+
export type ApiKeyErrorType = 'missing' | 'invalid';
|
|
4
|
+
export interface ApiKeyErrorInfo {
|
|
5
|
+
type: ApiKeyErrorType;
|
|
6
|
+
provider: ProviderId | null;
|
|
7
|
+
secret?: SecretDefinition | null;
|
|
8
|
+
message?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function detectApiKeyError(error: unknown, provider?: ProviderId | null): ApiKeyErrorInfo | null;
|
|
11
|
+
//# sourceMappingURL=apiKeyErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKeyErrors.d.ts","sourceRoot":"","sources":["../../../src/core/errors/apiKeyErrors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG,eAAe,GAAG,IAAI,CAuBtG"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { MissingSecretError, getSecretDefinitionForProvider, } from '../secretStore.js';
|
|
2
|
+
export function detectApiKeyError(error, provider) {
|
|
3
|
+
if (error instanceof MissingSecretError) {
|
|
4
|
+
const primaryProvider = error.secret.providers[0] ?? null;
|
|
5
|
+
return {
|
|
6
|
+
type: 'missing',
|
|
7
|
+
provider: provider ?? primaryProvider,
|
|
8
|
+
secret: error.secret,
|
|
9
|
+
message: error.message,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (isUnauthorizedError(error)) {
|
|
13
|
+
const labelProvider = provider ?? extractProviderFromError(error);
|
|
14
|
+
const secret = labelProvider ? getSecretDefinitionForProvider(labelProvider) : null;
|
|
15
|
+
return {
|
|
16
|
+
type: 'invalid',
|
|
17
|
+
provider: labelProvider,
|
|
18
|
+
secret,
|
|
19
|
+
message: extractErrorMessage(error),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function isUnauthorizedError(error) {
|
|
25
|
+
const status = extractStatus(error);
|
|
26
|
+
if (status === 401 || status === 403) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
const payload = extractStructuredError(error);
|
|
30
|
+
if (payload) {
|
|
31
|
+
// Check type and code fields
|
|
32
|
+
const normalizedType = normalize(payload.type) || normalize(payload.code);
|
|
33
|
+
if (normalizedType && containsAuthKeyword(normalizedType)) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
// Check status field (e.g., "PERMISSION_DENIED")
|
|
37
|
+
if (payload.status && containsAuthKeyword(normalize(payload.status))) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
// Check reason field (e.g., "forbidden")
|
|
41
|
+
if (payload.reason && containsAuthKeyword(normalize(payload.reason))) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
// Check message field
|
|
45
|
+
if (payload.message && containsAuthKeyword(normalize(payload.message))) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const message = normalize(extractErrorMessage(error));
|
|
50
|
+
if (!message) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return containsAuthKeyword(message);
|
|
54
|
+
}
|
|
55
|
+
function extractStatus(error) {
|
|
56
|
+
if (!error || typeof error !== 'object') {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const directStatus = error.status;
|
|
60
|
+
if (typeof directStatus === 'number') {
|
|
61
|
+
return directStatus;
|
|
62
|
+
}
|
|
63
|
+
const response = error.response;
|
|
64
|
+
if (response && typeof response.status === 'number') {
|
|
65
|
+
return response.status;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function extractStructuredError(error) {
|
|
70
|
+
if (!error || typeof error !== 'object') {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
// Handle nested error.error structure (common in Google/Gemini errors)
|
|
74
|
+
if ('error' in error) {
|
|
75
|
+
const candidate = error.error;
|
|
76
|
+
if (candidate && typeof candidate === 'object') {
|
|
77
|
+
const structured = candidate;
|
|
78
|
+
// Extract reason from nested errors array (Gemini format)
|
|
79
|
+
let reason = structured.reason;
|
|
80
|
+
if (!reason && structured.errors && Array.isArray(structured.errors) && structured.errors[0]?.reason) {
|
|
81
|
+
reason = structured.errors[0].reason;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
type: structured.type,
|
|
85
|
+
code: typeof structured.code === 'number' ? String(structured.code) : structured.code,
|
|
86
|
+
message: structured.message,
|
|
87
|
+
status: structured.status,
|
|
88
|
+
reason,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Handle direct status/reason on error object
|
|
93
|
+
const directError = error;
|
|
94
|
+
if (directError.status || directError.reason || directError.code) {
|
|
95
|
+
return {
|
|
96
|
+
status: directError.status,
|
|
97
|
+
reason: directError.reason,
|
|
98
|
+
code: typeof directError.code === 'number' ? String(directError.code) : directError.code,
|
|
99
|
+
message: directError.message,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function extractProviderFromError(error) {
|
|
105
|
+
if (!error || typeof error !== 'object') {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
const provider = error.provider;
|
|
109
|
+
if (typeof provider === 'string' && provider.trim()) {
|
|
110
|
+
return provider.trim();
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
function extractErrorMessage(error) {
|
|
115
|
+
if (typeof error === 'string') {
|
|
116
|
+
return error;
|
|
117
|
+
}
|
|
118
|
+
if (error instanceof Error) {
|
|
119
|
+
return error.message ?? '';
|
|
120
|
+
}
|
|
121
|
+
if (error && typeof error === 'object') {
|
|
122
|
+
const payload = extractStructuredError(error);
|
|
123
|
+
if (payload?.message) {
|
|
124
|
+
return payload.message;
|
|
125
|
+
}
|
|
126
|
+
if ('message' in error && typeof error.message === 'string') {
|
|
127
|
+
return error.message;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return '';
|
|
131
|
+
}
|
|
132
|
+
function containsAuthKeyword(value) {
|
|
133
|
+
if (!value) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
return (value.includes('api key') ||
|
|
137
|
+
value.includes('apikey') ||
|
|
138
|
+
value.includes('api-key') ||
|
|
139
|
+
value.includes('authentication') ||
|
|
140
|
+
value.includes('unauthorized') ||
|
|
141
|
+
value.includes('permission_denied') ||
|
|
142
|
+
value.includes('permission denied') ||
|
|
143
|
+
value.includes('forbidden') ||
|
|
144
|
+
value.includes('invalid_api_key') ||
|
|
145
|
+
value.includes('invalid api key') ||
|
|
146
|
+
value.includes('access_denied') ||
|
|
147
|
+
value.includes('access denied') ||
|
|
148
|
+
value.includes('not authorized') ||
|
|
149
|
+
value.includes('credentials') ||
|
|
150
|
+
value.includes('entitlement') ||
|
|
151
|
+
value.includes('subscription'));
|
|
152
|
+
}
|
|
153
|
+
function normalize(value) {
|
|
154
|
+
if (!value || typeof value !== 'string') {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return value.toLowerCase();
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=apiKeyErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiKeyErrors.js","sourceRoot":"","sources":["../../../src/core/errors/apiKeyErrors.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAElB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAW3B,MAAM,UAAU,iBAAiB,CAAC,KAAc,EAAE,QAA4B;IAC5E,IAAI,KAAK,YAAY,kBAAkB,EAAE,CAAC;QACxC,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QAC1D,OAAO;YACL,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,QAAQ,IAAI,eAAe;YACrC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC;IACJ,CAAC;IAED,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,aAAa,GAAG,QAAQ,IAAI,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAClE,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,8BAA8B,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACpF,OAAO;YACL,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,aAAa;YACvB,MAAM;YACN,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC;SACpC,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAc;IACzC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;I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@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive Error Classification System
|
|
3
|
+
*
|
|
4
|
+
* Provides structured error handling with:
|
|
5
|
+
* - Error categorization (dangerous, blocked, invalid, etc.)
|
|
6
|
+
* - Severity levels (critical, error, warning, info)
|
|
7
|
+
* - Auto-fixing suggestions
|
|
8
|
+
* - Recovery strategies
|
|
9
|
+
*/
|
|
10
|
+
export declare enum ErrorSeverity {
|
|
11
|
+
CRITICAL = "critical",// System-level failure, cannot continue
|
|
12
|
+
ERROR = "error",// Operation failed, but system stable
|
|
13
|
+
WARNING = "warning",// Risky but allowed
|
|
14
|
+
INFO = "info"
|
|
15
|
+
}
|
|
16
|
+
export declare enum ErrorCategory {
|
|
17
|
+
DANGEROUS = "dangerous",// Operation could harm system
|
|
18
|
+
BLOCKED = "blocked",// Explicitly forbidden by policy
|
|
19
|
+
INVALID = "invalid",// Malformed input/arguments
|
|
20
|
+
PERMISSION = "permission",// Authorization issue
|
|
21
|
+
RESOURCE = "resource",// Resource limit exceeded
|
|
22
|
+
NETWORK = "network",// Network/connectivity issue
|
|
23
|
+
TIMEOUT = "timeout",// Operation timed out
|
|
24
|
+
VALIDATION = "validation",// Schema/type validation failed
|
|
25
|
+
CONTEXT_OVERFLOW = "context_overflow",// Token/context limit exceeded
|
|
26
|
+
NOT_FOUND = "not_found",// Resource doesn't exist
|
|
27
|
+
UNKNOWN = "unknown"
|
|
28
|
+
}
|
|
29
|
+
export type ErrorSuggestion = {
|
|
30
|
+
readonly action: string;
|
|
31
|
+
readonly example?: string;
|
|
32
|
+
readonly autoFixable: true;
|
|
33
|
+
readonly autoFix: () => unknown;
|
|
34
|
+
} | {
|
|
35
|
+
readonly action: string;
|
|
36
|
+
readonly example?: string;
|
|
37
|
+
readonly autoFixable: false;
|
|
38
|
+
};
|
|
39
|
+
export type StructuredErrorDetails = {
|
|
40
|
+
readonly severity: ErrorSeverity;
|
|
41
|
+
readonly category: ErrorCategory;
|
|
42
|
+
readonly message: string;
|
|
43
|
+
readonly originalInput?: string;
|
|
44
|
+
readonly suggestions: readonly ErrorSuggestion[];
|
|
45
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
46
|
+
readonly timestamp: string;
|
|
47
|
+
readonly recoverable: boolean;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Base class for all structured errors
|
|
51
|
+
*/
|
|
52
|
+
export declare abstract class StructuredError extends Error {
|
|
53
|
+
readonly severity: ErrorSeverity;
|
|
54
|
+
readonly category: ErrorCategory;
|
|
55
|
+
readonly suggestions: ErrorSuggestion[];
|
|
56
|
+
readonly originalInput?: string;
|
|
57
|
+
readonly metadata?: Record<string, unknown>;
|
|
58
|
+
readonly timestamp: string;
|
|
59
|
+
readonly recoverable: boolean;
|
|
60
|
+
constructor(details: StructuredErrorDetails);
|
|
61
|
+
/**
|
|
62
|
+
* Format error for display with suggestions
|
|
63
|
+
*/
|
|
64
|
+
toDisplayString(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Convert to JSON for logging/telemetry
|
|
67
|
+
*/
|
|
68
|
+
toJSON(): Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Try to auto-fix the error if possible
|
|
71
|
+
*/
|
|
72
|
+
tryAutoFix(): {
|
|
73
|
+
fixed: boolean;
|
|
74
|
+
result?: any;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Dangerous operation error - operation could harm the system
|
|
79
|
+
*/
|
|
80
|
+
export declare class DangerousOperationError extends StructuredError {
|
|
81
|
+
constructor(operation: string, reason: string, safeAlternative?: string);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Blocked operation error - explicitly forbidden by policy
|
|
85
|
+
*/
|
|
86
|
+
export declare class BlockedOperationError extends StructuredError {
|
|
87
|
+
constructor(operation: string, policy: string, allowedAlternatives?: string[]);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Context overflow error - token/character limits exceeded
|
|
91
|
+
*/
|
|
92
|
+
export declare class ContextOverflowError extends StructuredError {
|
|
93
|
+
constructor(actual: number, limit: number, unit?: 'tokens' | 'chars' | 'lines', truncatable?: boolean);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Resource error - limits exceeded
|
|
97
|
+
*/
|
|
98
|
+
export declare class ResourceLimitError extends StructuredError {
|
|
99
|
+
constructor(resource: string, actual: number, limit: number, reducible?: boolean);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Validation error - input/schema validation failed
|
|
103
|
+
*/
|
|
104
|
+
export declare class ValidationError extends StructuredError {
|
|
105
|
+
constructor(field: string, code: string, message: string);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Format any error as a structured error
|
|
109
|
+
*/
|
|
110
|
+
export declare function toStructuredError(error: unknown): StructuredError;
|
|
111
|
+
//# sourceMappingURL=errorTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorTypes.d.ts","sourceRoot":"","sources":["../../../src/core/errors/errorTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oBAAY,aAAa;IACvB,QAAQ,aAAa,CAAG,wCAAwC;IAChE,KAAK,UAAU,CAAS,sCAAsC;IAC9D,OAAO,YAAY,CAAK,oBAAoB;IAC5C,IAAI,SAAS;CACd;AAED,oBAAY,aAAa;IACvB,SAAS,cAAc,CAAO,8BAA8B;IAC5D,OAAO,YAAY,CAAW,iCAAiC;IAC/D,OAAO,YAAY,CAAW,4BAA4B;IAC1D,UAAU,eAAe,CAAK,sBAAsB;IACpD,QAAQ,aAAa,CAAS,0BAA0B;IACxD,OAAO,YAAY,CAAW,6BAA6B;IAC3D,OAAO,YAAY,CAAW,sBAAsB;IACpD,UAAU,eAAe,CAAK,gCAAgC;IAC9D,gBAAgB,qBAAqB,CAAE,+BAA+B;IACtE,SAAS,cAAc,CAAO,yBAAyB;IACvD,OAAO,YAAY;CACpB;AAGD,MAAM,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