@wingman-ai/gateway 0.1.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/.wingman/agents/README.md +161 -0
- package/.wingman/agents/coding/agent.md +147 -0
- package/.wingman/agents/coding/implementor.md +56 -0
- package/.wingman/agents/main/agent.md +19 -0
- package/.wingman/agents/researcher/agent.md +62 -0
- package/.wingman/agents/stock-trader/agent.md +223 -0
- package/.wingman/agents/stock-trader/chain-curator.md +24 -0
- package/.wingman/agents/stock-trader/goal-translator.md +42 -0
- package/.wingman/agents/stock-trader/guardrails-veto.md +11 -0
- package/.wingman/agents/stock-trader/path-planner.md +23 -0
- package/.wingman/agents/stock-trader/regime-analyst.md +15 -0
- package/.wingman/agents/stock-trader/risk.md +20 -0
- package/.wingman/agents/stock-trader/selection.md +22 -0
- package/.wingman/agents/stock-trader/strategy-composer.md +38 -0
- package/.wingman/agents/wingman/agent.json +12 -0
- package/bin/wingman +7 -0
- package/dist/agent/config/agentConfig.cjs +95 -0
- package/dist/agent/config/agentConfig.d.ts +187 -0
- package/dist/agent/config/agentConfig.js +52 -0
- package/dist/agent/config/agentLoader.cjs +242 -0
- package/dist/agent/config/agentLoader.d.ts +42 -0
- package/dist/agent/config/agentLoader.js +208 -0
- package/dist/agent/config/mcpClientManager.cjs +168 -0
- package/dist/agent/config/mcpClientManager.d.ts +41 -0
- package/dist/agent/config/mcpClientManager.js +134 -0
- package/dist/agent/config/modelFactory.cjs +175 -0
- package/dist/agent/config/modelFactory.d.ts +33 -0
- package/dist/agent/config/modelFactory.js +141 -0
- package/dist/agent/config/toolRegistry.cjs +111 -0
- package/dist/agent/config/toolRegistry.d.ts +25 -0
- package/dist/agent/config/toolRegistry.js +71 -0
- package/dist/agent/middleware/additional-messages.cjs +60 -0
- package/dist/agent/middleware/additional-messages.d.ts +7 -0
- package/dist/agent/middleware/additional-messages.js +26 -0
- package/dist/agent/middleware/hooks/executor.cjs +137 -0
- package/dist/agent/middleware/hooks/executor.d.ts +52 -0
- package/dist/agent/middleware/hooks/executor.js +103 -0
- package/dist/agent/middleware/hooks/input-builder.cjs +55 -0
- package/dist/agent/middleware/hooks/input-builder.d.ts +15 -0
- package/dist/agent/middleware/hooks/input-builder.js +21 -0
- package/dist/agent/middleware/hooks/matcher.cjs +59 -0
- package/dist/agent/middleware/hooks/matcher.d.ts +27 -0
- package/dist/agent/middleware/hooks/matcher.js +22 -0
- package/dist/agent/middleware/hooks/merger.cjs +54 -0
- package/dist/agent/middleware/hooks/merger.d.ts +18 -0
- package/dist/agent/middleware/hooks/merger.js +20 -0
- package/dist/agent/middleware/hooks/types.cjs +62 -0
- package/dist/agent/middleware/hooks/types.d.ts +82 -0
- package/dist/agent/middleware/hooks/types.js +19 -0
- package/dist/agent/middleware/hooks.cjs +79 -0
- package/dist/agent/middleware/hooks.d.ts +19 -0
- package/dist/agent/middleware/hooks.js +45 -0
- package/dist/agent/middleware/media-compat.cjs +80 -0
- package/dist/agent/middleware/media-compat.d.ts +7 -0
- package/dist/agent/middleware/media-compat.js +46 -0
- package/dist/agent/tests/agentConfig.test.cjs +132 -0
- package/dist/agent/tests/agentConfig.test.d.ts +1 -0
- package/dist/agent/tests/agentConfig.test.js +126 -0
- package/dist/agent/tests/agentLoader.test.cjs +235 -0
- package/dist/agent/tests/agentLoader.test.d.ts +1 -0
- package/dist/agent/tests/agentLoader.test.js +229 -0
- package/dist/agent/tests/modelFactory.test.cjs +114 -0
- package/dist/agent/tests/modelFactory.test.d.ts +1 -0
- package/dist/agent/tests/modelFactory.test.js +108 -0
- package/dist/agent/tests/test-agent-loader.cjs +33 -0
- package/dist/agent/tests/test-agent-loader.d.ts +1 -0
- package/dist/agent/tests/test-agent-loader.js +27 -0
- package/dist/agent/tests/test-subagent-loading.cjs +99 -0
- package/dist/agent/tests/test-subagent-loading.d.ts +1 -0
- package/dist/agent/tests/test-subagent-loading.js +93 -0
- package/dist/agent/tests/toolRegistry.test.cjs +109 -0
- package/dist/agent/tests/toolRegistry.test.d.ts +1 -0
- package/dist/agent/tests/toolRegistry.test.js +103 -0
- package/dist/agent/tools/code_search.cjs +108 -0
- package/dist/agent/tools/code_search.d.ts +24 -0
- package/dist/agent/tools/code_search.js +74 -0
- package/dist/agent/tools/command_execute.cjs +136 -0
- package/dist/agent/tools/command_execute.d.ts +12 -0
- package/dist/agent/tools/command_execute.js +99 -0
- package/dist/agent/tools/git_status.cjs +126 -0
- package/dist/agent/tools/git_status.d.ts +15 -0
- package/dist/agent/tools/git_status.js +92 -0
- package/dist/agent/tools/internet_search.cjs +93 -0
- package/dist/agent/tools/internet_search.d.ts +25 -0
- package/dist/agent/tools/internet_search.js +56 -0
- package/dist/agent/tools/think.cjs +53 -0
- package/dist/agent/tools/think.d.ts +26 -0
- package/dist/agent/tools/think.js +16 -0
- package/dist/agent/tools/web_crawler.cjs +180 -0
- package/dist/agent/tools/web_crawler.d.ts +31 -0
- package/dist/agent/tools/web_crawler.js +143 -0
- package/dist/agent/utils.cjs +54 -0
- package/dist/agent/utils.d.ts +1 -0
- package/dist/agent/utils.js +10 -0
- package/dist/cli/commands/agent.cjs +169 -0
- package/dist/cli/commands/agent.d.ts +15 -0
- package/dist/cli/commands/agent.js +125 -0
- package/dist/cli/commands/gateway.cjs +601 -0
- package/dist/cli/commands/gateway.d.ts +12 -0
- package/dist/cli/commands/gateway.js +567 -0
- package/dist/cli/commands/init.cjs +681 -0
- package/dist/cli/commands/init.d.ts +10 -0
- package/dist/cli/commands/init.js +634 -0
- package/dist/cli/commands/provider.cjs +208 -0
- package/dist/cli/commands/provider.d.ts +5 -0
- package/dist/cli/commands/provider.js +174 -0
- package/dist/cli/commands/skill.cjs +145 -0
- package/dist/cli/commands/skill.d.ts +10 -0
- package/dist/cli/commands/skill.js +111 -0
- package/dist/cli/config/loader.cjs +143 -0
- package/dist/cli/config/loader.d.ts +14 -0
- package/dist/cli/config/loader.js +109 -0
- package/dist/cli/config/schema.cjs +262 -0
- package/dist/cli/config/schema.d.ts +268 -0
- package/dist/cli/config/schema.js +213 -0
- package/dist/cli/core/agentInvoker.cjs +284 -0
- package/dist/cli/core/agentInvoker.d.ts +77 -0
- package/dist/cli/core/agentInvoker.js +247 -0
- package/dist/cli/core/commandHandler.cjs +257 -0
- package/dist/cli/core/commandHandler.d.ts +62 -0
- package/dist/cli/core/commandHandler.js +223 -0
- package/dist/cli/core/database/bunSqliteAdapter.cjs +87 -0
- package/dist/cli/core/database/bunSqliteAdapter.d.ts +34 -0
- package/dist/cli/core/database/bunSqliteAdapter.js +53 -0
- package/dist/cli/core/loggerBridge.cjs +42 -0
- package/dist/cli/core/loggerBridge.d.ts +8 -0
- package/dist/cli/core/loggerBridge.js +8 -0
- package/dist/cli/core/outputManager.cjs +106 -0
- package/dist/cli/core/outputManager.d.ts +43 -0
- package/dist/cli/core/outputManager.js +72 -0
- package/dist/cli/core/sessionManager.cjs +535 -0
- package/dist/cli/core/sessionManager.d.ts +111 -0
- package/dist/cli/core/sessionManager.js +486 -0
- package/dist/cli/core/streamParser.cjs +328 -0
- package/dist/cli/core/streamParser.d.ts +42 -0
- package/dist/cli/core/streamParser.js +288 -0
- package/dist/cli/index.cjs +211 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +205 -0
- package/dist/cli/services/skillRepository.cjs +178 -0
- package/dist/cli/services/skillRepository.d.ts +35 -0
- package/dist/cli/services/skillRepository.js +144 -0
- package/dist/cli/services/skillService.cjs +336 -0
- package/dist/cli/services/skillService.d.ts +48 -0
- package/dist/cli/services/skillService.js +302 -0
- package/dist/cli/types/gateway.cjs +18 -0
- package/dist/cli/types/gateway.d.ts +18 -0
- package/dist/cli/types/gateway.js +0 -0
- package/dist/cli/types/init.cjs +18 -0
- package/dist/cli/types/init.d.ts +13 -0
- package/dist/cli/types/init.js +0 -0
- package/dist/cli/types/provider.cjs +18 -0
- package/dist/cli/types/provider.d.ts +9 -0
- package/dist/cli/types/provider.js +0 -0
- package/dist/cli/types/skill.cjs +18 -0
- package/dist/cli/types/skill.d.ts +71 -0
- package/dist/cli/types/skill.js +0 -0
- package/dist/cli/types.cjs +18 -0
- package/dist/cli/types.d.ts +175 -0
- package/dist/cli/types.js +0 -0
- package/dist/cli/ui/AgentOutput.cjs +82 -0
- package/dist/cli/ui/AgentOutput.d.ts +8 -0
- package/dist/cli/ui/AgentOutput.js +38 -0
- package/dist/cli/ui/App.cjs +285 -0
- package/dist/cli/ui/App.d.ts +6 -0
- package/dist/cli/ui/App.js +241 -0
- package/dist/cli/ui/ErrorDisplay.cjs +65 -0
- package/dist/cli/ui/ErrorDisplay.d.ts +8 -0
- package/dist/cli/ui/ErrorDisplay.js +21 -0
- package/dist/cli/ui/LogDisplay.cjs +74 -0
- package/dist/cli/ui/LogDisplay.d.ts +13 -0
- package/dist/cli/ui/LogDisplay.js +30 -0
- package/dist/cli/ui/SessionListDisplay.cjs +135 -0
- package/dist/cli/ui/SessionListDisplay.d.ts +9 -0
- package/dist/cli/ui/SessionListDisplay.js +91 -0
- package/dist/cli/ui/blockHelpers.cjs +80 -0
- package/dist/cli/ui/blockHelpers.d.ts +21 -0
- package/dist/cli/ui/blockHelpers.js +40 -0
- package/dist/cli/ui/components/ToolCallDisplay.cjs +207 -0
- package/dist/cli/ui/components/ToolCallDisplay.d.ts +7 -0
- package/dist/cli/ui/components/ToolCallDisplay.js +162 -0
- package/dist/cli/ui/components/ToolResultDisplay.cjs +86 -0
- package/dist/cli/ui/components/ToolResultDisplay.d.ts +8 -0
- package/dist/cli/ui/components/ToolResultDisplay.js +42 -0
- package/dist/cli/ui/toolDisplayHelpers.cjs +112 -0
- package/dist/cli/ui/toolDisplayHelpers.d.ts +3 -0
- package/dist/cli/ui/toolDisplayHelpers.js +72 -0
- package/dist/gateway/adapters/discord.cjs +298 -0
- package/dist/gateway/adapters/discord.d.ts +42 -0
- package/dist/gateway/adapters/discord.js +246 -0
- package/dist/gateway/auth.cjs +94 -0
- package/dist/gateway/auth.d.ts +36 -0
- package/dist/gateway/auth.js +60 -0
- package/dist/gateway/broadcast.cjs +131 -0
- package/dist/gateway/broadcast.d.ts +76 -0
- package/dist/gateway/broadcast.js +97 -0
- package/dist/gateway/client.cjs +282 -0
- package/dist/gateway/client.d.ts +141 -0
- package/dist/gateway/client.js +248 -0
- package/dist/gateway/daemon.cjs +195 -0
- package/dist/gateway/daemon.d.ts +67 -0
- package/dist/gateway/daemon.js +161 -0
- package/dist/gateway/discovery/index.cjs +72 -0
- package/dist/gateway/discovery/index.d.ts +3 -0
- package/dist/gateway/discovery/index.js +3 -0
- package/dist/gateway/discovery/mdns.cjs +221 -0
- package/dist/gateway/discovery/mdns.d.ts +37 -0
- package/dist/gateway/discovery/mdns.js +177 -0
- package/dist/gateway/discovery/tailscale.cjs +140 -0
- package/dist/gateway/discovery/tailscale.d.ts +31 -0
- package/dist/gateway/discovery/tailscale.js +106 -0
- package/dist/gateway/discovery/types.cjs +18 -0
- package/dist/gateway/discovery/types.d.ts +41 -0
- package/dist/gateway/discovery/types.js +0 -0
- package/dist/gateway/env.cjs +45 -0
- package/dist/gateway/env.d.ts +2 -0
- package/dist/gateway/env.js +8 -0
- package/dist/gateway/hooks/loader.cjs +137 -0
- package/dist/gateway/hooks/loader.d.ts +10 -0
- package/dist/gateway/hooks/loader.js +103 -0
- package/dist/gateway/hooks/registry.cjs +128 -0
- package/dist/gateway/hooks/registry.d.ts +13 -0
- package/dist/gateway/hooks/registry.js +94 -0
- package/dist/gateway/hooks/types.cjs +58 -0
- package/dist/gateway/hooks/types.d.ts +50 -0
- package/dist/gateway/hooks/types.js +18 -0
- package/dist/gateway/http/agents.cjs +280 -0
- package/dist/gateway/http/agents.d.ts +2 -0
- package/dist/gateway/http/agents.js +246 -0
- package/dist/gateway/http/fs.cjs +81 -0
- package/dist/gateway/http/fs.d.ts +2 -0
- package/dist/gateway/http/fs.js +47 -0
- package/dist/gateway/http/providers.cjs +120 -0
- package/dist/gateway/http/providers.d.ts +2 -0
- package/dist/gateway/http/providers.js +86 -0
- package/dist/gateway/http/routines.cjs +196 -0
- package/dist/gateway/http/routines.d.ts +20 -0
- package/dist/gateway/http/routines.js +159 -0
- package/dist/gateway/http/sessions.cjs +241 -0
- package/dist/gateway/http/sessions.d.ts +2 -0
- package/dist/gateway/http/sessions.js +207 -0
- package/dist/gateway/http/types.cjs +18 -0
- package/dist/gateway/http/types.d.ts +25 -0
- package/dist/gateway/http/types.js +0 -0
- package/dist/gateway/http/voice.cjs +167 -0
- package/dist/gateway/http/voice.d.ts +2 -0
- package/dist/gateway/http/voice.js +133 -0
- package/dist/gateway/http/webhooks.cjs +353 -0
- package/dist/gateway/http/webhooks.d.ts +22 -0
- package/dist/gateway/http/webhooks.js +313 -0
- package/dist/gateway/index.cjs +119 -0
- package/dist/gateway/index.d.ts +8 -0
- package/dist/gateway/index.js +9 -0
- package/dist/gateway/node.cjs +218 -0
- package/dist/gateway/node.d.ts +112 -0
- package/dist/gateway/node.js +184 -0
- package/dist/gateway/router.cjs +85 -0
- package/dist/gateway/router.d.ts +9 -0
- package/dist/gateway/router.js +51 -0
- package/dist/gateway/rpcClient.cjs +152 -0
- package/dist/gateway/rpcClient.d.ts +24 -0
- package/dist/gateway/rpcClient.js +118 -0
- package/dist/gateway/server.cjs +1175 -0
- package/dist/gateway/server.d.ts +185 -0
- package/dist/gateway/server.js +1138 -0
- package/dist/gateway/transport/http.cjs +153 -0
- package/dist/gateway/transport/http.d.ts +25 -0
- package/dist/gateway/transport/http.js +119 -0
- package/dist/gateway/transport/index.cjs +40 -0
- package/dist/gateway/transport/index.d.ts +3 -0
- package/dist/gateway/transport/index.js +3 -0
- package/dist/gateway/transport/types.cjs +18 -0
- package/dist/gateway/transport/types.d.ts +59 -0
- package/dist/gateway/transport/types.js +0 -0
- package/dist/gateway/transport/websocket.cjs +132 -0
- package/dist/gateway/transport/websocket.d.ts +21 -0
- package/dist/gateway/transport/websocket.js +98 -0
- package/dist/gateway/types.cjs +18 -0
- package/dist/gateway/types.d.ts +215 -0
- package/dist/gateway/types.js +0 -0
- package/dist/gateway/validation.cjs +225 -0
- package/dist/gateway/validation.d.ts +157 -0
- package/dist/gateway/validation.js +158 -0
- package/dist/index.cjs +95 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/logger.cjs +270 -0
- package/dist/logger.d.ts +54 -0
- package/dist/logger.js +215 -0
- package/dist/providers/copilot.cjs +148 -0
- package/dist/providers/copilot.d.ts +3 -0
- package/dist/providers/copilot.js +114 -0
- package/dist/providers/credentials.cjs +154 -0
- package/dist/providers/credentials.d.ts +26 -0
- package/dist/providers/credentials.js +99 -0
- package/dist/providers/oauth.cjs +279 -0
- package/dist/providers/oauth.d.ts +13 -0
- package/dist/providers/oauth.js +245 -0
- package/dist/providers/registry.cjs +138 -0
- package/dist/providers/registry.d.ts +32 -0
- package/dist/providers/registry.js +98 -0
- package/dist/tests/additionalMessageMiddleware.test.cjs +45 -0
- package/dist/tests/additionalMessageMiddleware.test.d.ts +1 -0
- package/dist/tests/additionalMessageMiddleware.test.js +39 -0
- package/dist/tests/agent-config-voice.test.cjs +25 -0
- package/dist/tests/agent-config-voice.test.d.ts +1 -0
- package/dist/tests/agent-config-voice.test.js +19 -0
- package/dist/tests/agentInvokerAttachments.test.cjs +67 -0
- package/dist/tests/agentInvokerAttachments.test.d.ts +1 -0
- package/dist/tests/agentInvokerAttachments.test.js +61 -0
- package/dist/tests/attachments-utils.test.cjs +46 -0
- package/dist/tests/attachments-utils.test.d.ts +1 -0
- package/dist/tests/attachments-utils.test.js +40 -0
- package/dist/tests/bunSqliteAdapter.test.cjs +265 -0
- package/dist/tests/bunSqliteAdapter.test.d.ts +1 -0
- package/dist/tests/bunSqliteAdapter.test.js +259 -0
- package/dist/tests/candleRange.test.cjs +48 -0
- package/dist/tests/candleRange.test.d.ts +1 -0
- package/dist/tests/candleRange.test.js +42 -0
- package/dist/tests/cli-config-loader.test.cjs +364 -0
- package/dist/tests/cli-config-loader.test.d.ts +1 -0
- package/dist/tests/cli-config-loader.test.js +358 -0
- package/dist/tests/cli-init.test.cjs +82 -0
- package/dist/tests/cli-init.test.d.ts +1 -0
- package/dist/tests/cli-init.test.js +76 -0
- package/dist/tests/discord-adapter.test.cjs +55 -0
- package/dist/tests/discord-adapter.test.d.ts +1 -0
- package/dist/tests/discord-adapter.test.js +49 -0
- package/dist/tests/gateway.test.cjs +319 -0
- package/dist/tests/gateway.test.d.ts +1 -0
- package/dist/tests/gateway.test.js +313 -0
- package/dist/tests/hooks-matcher.test.cjs +309 -0
- package/dist/tests/hooks-matcher.test.d.ts +1 -0
- package/dist/tests/hooks-matcher.test.js +303 -0
- package/dist/tests/hooks-merger.test.cjs +528 -0
- package/dist/tests/hooks-merger.test.d.ts +1 -0
- package/dist/tests/hooks-merger.test.js +522 -0
- package/dist/tests/integration/agent-invocation.integration.test.cjs +264 -0
- package/dist/tests/integration/agent-invocation.integration.test.d.ts +1 -0
- package/dist/tests/integration/agent-invocation.integration.test.js +258 -0
- package/dist/tests/integration/finnhub-candles.integration.test.cjs +98 -0
- package/dist/tests/integration/finnhub-candles.integration.test.d.ts +1 -0
- package/dist/tests/integration/finnhub-candles.integration.test.js +92 -0
- package/dist/tests/logger.test.cjs +353 -0
- package/dist/tests/logger.test.d.ts +1 -0
- package/dist/tests/logger.test.js +347 -0
- package/dist/tests/mediaCompatibilityMiddleware.test.cjs +106 -0
- package/dist/tests/mediaCompatibilityMiddleware.test.d.ts +1 -0
- package/dist/tests/mediaCompatibilityMiddleware.test.js +100 -0
- package/dist/tests/routines-api.test.cjs +107 -0
- package/dist/tests/routines-api.test.d.ts +1 -0
- package/dist/tests/routines-api.test.js +101 -0
- package/dist/tests/sessionMessageAttachments.test.cjs +108 -0
- package/dist/tests/sessionMessageAttachments.test.d.ts +1 -0
- package/dist/tests/sessionMessageAttachments.test.js +102 -0
- package/dist/tests/sessionMessageRole.test.cjs +44 -0
- package/dist/tests/sessionMessageRole.test.d.ts +1 -0
- package/dist/tests/sessionMessageRole.test.js +38 -0
- package/dist/tests/sessionStateMessages.test.cjs +72 -0
- package/dist/tests/sessionStateMessages.test.d.ts +1 -0
- package/dist/tests/sessionStateMessages.test.js +66 -0
- package/dist/tests/sessions-api.test.cjs +68 -0
- package/dist/tests/sessions-api.test.d.ts +1 -0
- package/dist/tests/sessions-api.test.js +62 -0
- package/dist/tests/technicalIndicators.test.cjs +82 -0
- package/dist/tests/technicalIndicators.test.d.ts +1 -0
- package/dist/tests/technicalIndicators.test.js +76 -0
- package/dist/tests/toolDisplayHelpers.test.cjs +43 -0
- package/dist/tests/toolDisplayHelpers.test.d.ts +1 -0
- package/dist/tests/toolDisplayHelpers.test.js +37 -0
- package/dist/tests/voice-config.test.cjs +35 -0
- package/dist/tests/voice-config.test.d.ts +1 -0
- package/dist/tests/voice-config.test.js +29 -0
- package/dist/tests/yahooCandles.test.cjs +111 -0
- package/dist/tests/yahooCandles.test.d.ts +1 -0
- package/dist/tests/yahooCandles.test.js +105 -0
- package/dist/tools/finance/candleRange.cjs +71 -0
- package/dist/tools/finance/candleRange.d.ts +21 -0
- package/dist/tools/finance/candleRange.js +28 -0
- package/dist/tools/finance/optionsAnalytics.cjs +222 -0
- package/dist/tools/finance/optionsAnalytics.d.ts +44 -0
- package/dist/tools/finance/optionsAnalytics.js +188 -0
- package/dist/tools/finance/optionsAnalytics.test.cjs +128 -0
- package/dist/tools/finance/optionsAnalytics.test.d.ts +1 -0
- package/dist/tools/finance/optionsAnalytics.test.js +122 -0
- package/dist/tools/finance/technicalIndicators.cjs +111 -0
- package/dist/tools/finance/technicalIndicators.d.ts +15 -0
- package/dist/tools/finance/technicalIndicators.js +68 -0
- package/dist/tools/finance/yahooCandles.cjs +125 -0
- package/dist/tools/finance/yahooCandles.d.ts +41 -0
- package/dist/tools/finance/yahooCandles.js +85 -0
- package/dist/tools/mcp-finance.cjs +649 -0
- package/dist/tools/mcp-finance.d.ts +1 -0
- package/dist/tools/mcp-finance.js +631 -0
- package/dist/types/agents.cjs +18 -0
- package/dist/types/agents.d.ts +11 -0
- package/dist/types/agents.js +0 -0
- package/dist/types/hooks.cjs +18 -0
- package/dist/types/hooks.d.ts +82 -0
- package/dist/types/hooks.js +0 -0
- package/dist/types/mcp.cjs +86 -0
- package/dist/types/mcp.d.ts +107 -0
- package/dist/types/mcp.js +40 -0
- package/dist/types/voice.cjs +103 -0
- package/dist/types/voice.d.ts +117 -0
- package/dist/types/voice.js +51 -0
- package/dist/utils/attachments.cjs +46 -0
- package/dist/utils/attachments.d.ts +7 -0
- package/dist/utils/attachments.js +12 -0
- package/dist/voice/config.cjs +52 -0
- package/dist/voice/config.d.ts +8 -0
- package/dist/voice/config.js +18 -0
- package/dist/webui/assets/index-BA0HaStz.css +1 -0
- package/dist/webui/assets/index-NHgTZsWN.js +112 -0
- package/dist/webui/assets/wingman_icon-DOy91UEF.webp +0 -0
- package/dist/webui/assets/wingman_logo-Cogyt3qm.webp +0 -0
- package/dist/webui/index.html +19 -0
- package/package.json +130 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
mergeHooks: ()=>mergeHooks
|
|
28
|
+
});
|
|
29
|
+
function mergeHooks(globalHooks, agentHooks) {
|
|
30
|
+
if (!globalHooks && !agentHooks) return;
|
|
31
|
+
if (!globalHooks) return agentHooks;
|
|
32
|
+
if (!agentHooks) return globalHooks;
|
|
33
|
+
const merged = {};
|
|
34
|
+
if (globalHooks.PreToolUse || agentHooks.PreToolUse) merged.PreToolUse = [
|
|
35
|
+
...globalHooks.PreToolUse || [],
|
|
36
|
+
...agentHooks.PreToolUse || []
|
|
37
|
+
];
|
|
38
|
+
if (globalHooks.PostToolUse || agentHooks.PostToolUse) merged.PostToolUse = [
|
|
39
|
+
...globalHooks.PostToolUse || [],
|
|
40
|
+
...agentHooks.PostToolUse || []
|
|
41
|
+
];
|
|
42
|
+
if (globalHooks.Stop || agentHooks.Stop) merged.Stop = [
|
|
43
|
+
...globalHooks.Stop || [],
|
|
44
|
+
...agentHooks.Stop || []
|
|
45
|
+
];
|
|
46
|
+
return merged;
|
|
47
|
+
}
|
|
48
|
+
exports.mergeHooks = __webpack_exports__.mergeHooks;
|
|
49
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
50
|
+
"mergeHooks"
|
|
51
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
52
|
+
Object.defineProperty(exports, '__esModule', {
|
|
53
|
+
value: true
|
|
54
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Configuration Merger
|
|
3
|
+
*
|
|
4
|
+
* Merges global and agent-specific hook configurations
|
|
5
|
+
*/
|
|
6
|
+
import type { HooksConfig } from "@/types/hooks.js";
|
|
7
|
+
/**
|
|
8
|
+
* Merge global and agent-specific hooks configurations
|
|
9
|
+
*
|
|
10
|
+
* Both global and agent hooks are executed. Hooks from both sources are concatenated
|
|
11
|
+
* for each event type. No deduplication is performed - if the same hook is defined
|
|
12
|
+
* in both places, it will run twice.
|
|
13
|
+
*
|
|
14
|
+
* @param globalHooks - Hooks from wingman.config.json
|
|
15
|
+
* @param agentHooks - Hooks from agent.json
|
|
16
|
+
* @returns Merged hooks configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare function mergeHooks(globalHooks: HooksConfig | undefined, agentHooks: HooksConfig | undefined): HooksConfig | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function mergeHooks(globalHooks, agentHooks) {
|
|
2
|
+
if (!globalHooks && !agentHooks) return;
|
|
3
|
+
if (!globalHooks) return agentHooks;
|
|
4
|
+
if (!agentHooks) return globalHooks;
|
|
5
|
+
const merged = {};
|
|
6
|
+
if (globalHooks.PreToolUse || agentHooks.PreToolUse) merged.PreToolUse = [
|
|
7
|
+
...globalHooks.PreToolUse || [],
|
|
8
|
+
...agentHooks.PreToolUse || []
|
|
9
|
+
];
|
|
10
|
+
if (globalHooks.PostToolUse || agentHooks.PostToolUse) merged.PostToolUse = [
|
|
11
|
+
...globalHooks.PostToolUse || [],
|
|
12
|
+
...agentHooks.PostToolUse || []
|
|
13
|
+
];
|
|
14
|
+
if (globalHooks.Stop || agentHooks.Stop) merged.Stop = [
|
|
15
|
+
...globalHooks.Stop || [],
|
|
16
|
+
...agentHooks.Stop || []
|
|
17
|
+
];
|
|
18
|
+
return merged;
|
|
19
|
+
}
|
|
20
|
+
export { mergeHooks };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
HookSchema: ()=>HookSchema,
|
|
28
|
+
StopHookSchema: ()=>StopHookSchema,
|
|
29
|
+
HookMatcherSchema: ()=>HookMatcherSchema,
|
|
30
|
+
HooksConfigSchema: ()=>HooksConfigSchema
|
|
31
|
+
});
|
|
32
|
+
const external_zod_namespaceObject = require("zod");
|
|
33
|
+
const HookSchema = external_zod_namespaceObject.z.object({
|
|
34
|
+
type: external_zod_namespaceObject.z.literal("command").describe("Type of hook - currently only 'command' is supported"),
|
|
35
|
+
command: external_zod_namespaceObject.z.string().min(1).describe("Shell command to execute"),
|
|
36
|
+
timeout: external_zod_namespaceObject.z.number().positive().optional().default(60).describe("Timeout in seconds (default: 60)")
|
|
37
|
+
});
|
|
38
|
+
const HookMatcherSchema = external_zod_namespaceObject.z.object({
|
|
39
|
+
matcher: external_zod_namespaceObject.z.string().optional().describe("Pattern to match tool names (pipe-separated, wildcard, or regex)"),
|
|
40
|
+
hooks: external_zod_namespaceObject.z.array(HookSchema).min(1).describe("Array of hooks to execute when pattern matches")
|
|
41
|
+
});
|
|
42
|
+
const StopHookSchema = external_zod_namespaceObject.z.object({
|
|
43
|
+
hooks: external_zod_namespaceObject.z.array(HookSchema).min(1).describe("Array of hooks to execute when agent stops")
|
|
44
|
+
});
|
|
45
|
+
const HooksConfigSchema = external_zod_namespaceObject.z.object({
|
|
46
|
+
PreToolUse: external_zod_namespaceObject.z.array(HookMatcherSchema).optional().describe("Hooks that fire before tool execution (can block)"),
|
|
47
|
+
PostToolUse: external_zod_namespaceObject.z.array(HookMatcherSchema).optional().describe("Hooks that fire after tool completes (non-blocking)"),
|
|
48
|
+
Stop: external_zod_namespaceObject.z.array(StopHookSchema).optional().describe("Hooks that fire when agent completes (non-blocking)")
|
|
49
|
+
});
|
|
50
|
+
exports.HookMatcherSchema = __webpack_exports__.HookMatcherSchema;
|
|
51
|
+
exports.HookSchema = __webpack_exports__.HookSchema;
|
|
52
|
+
exports.HooksConfigSchema = __webpack_exports__.HooksConfigSchema;
|
|
53
|
+
exports.StopHookSchema = __webpack_exports__.StopHookSchema;
|
|
54
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
55
|
+
"HookMatcherSchema",
|
|
56
|
+
"HookSchema",
|
|
57
|
+
"HooksConfigSchema",
|
|
58
|
+
"StopHookSchema"
|
|
59
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
60
|
+
Object.defineProperty(exports, '__esModule', {
|
|
61
|
+
value: true
|
|
62
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal Hooks Types and Zod Schemas
|
|
3
|
+
*
|
|
4
|
+
* Validation schemas for hook configurations and runtime execution context
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import type { ToolCallRequest, ToolMessage } from "langchain";
|
|
8
|
+
/**
|
|
9
|
+
* Zod schema for individual hook configuration
|
|
10
|
+
*/
|
|
11
|
+
export declare const HookSchema: z.ZodObject<{
|
|
12
|
+
type: z.ZodLiteral<"command">;
|
|
13
|
+
command: z.ZodString;
|
|
14
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/**
|
|
17
|
+
* Zod schema for hook matcher (PreToolUse, PostToolUse)
|
|
18
|
+
*/
|
|
19
|
+
export declare const HookMatcherSchema: z.ZodObject<{
|
|
20
|
+
matcher: z.ZodOptional<z.ZodString>;
|
|
21
|
+
hooks: z.ZodArray<z.ZodObject<{
|
|
22
|
+
type: z.ZodLiteral<"command">;
|
|
23
|
+
command: z.ZodString;
|
|
24
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/**
|
|
28
|
+
* Zod schema for Stop hooks (no matcher)
|
|
29
|
+
*/
|
|
30
|
+
export declare const StopHookSchema: z.ZodObject<{
|
|
31
|
+
hooks: z.ZodArray<z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"command">;
|
|
33
|
+
command: z.ZodString;
|
|
34
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
/**
|
|
38
|
+
* Zod schema for complete hooks configuration
|
|
39
|
+
*/
|
|
40
|
+
export declare const HooksConfigSchema: z.ZodObject<{
|
|
41
|
+
PreToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
42
|
+
matcher: z.ZodOptional<z.ZodString>;
|
|
43
|
+
hooks: z.ZodArray<z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"command">;
|
|
45
|
+
command: z.ZodString;
|
|
46
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>>>;
|
|
49
|
+
PostToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
50
|
+
matcher: z.ZodOptional<z.ZodString>;
|
|
51
|
+
hooks: z.ZodArray<z.ZodObject<{
|
|
52
|
+
type: z.ZodLiteral<"command">;
|
|
53
|
+
command: z.ZodString;
|
|
54
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
}, z.core.$strip>>>;
|
|
57
|
+
Stop: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
58
|
+
hooks: z.ZodArray<z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"command">;
|
|
60
|
+
command: z.ZodString;
|
|
61
|
+
timeout: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
62
|
+
}, z.core.$strip>>;
|
|
63
|
+
}, z.core.$strip>>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
/**
|
|
66
|
+
* Hook event names
|
|
67
|
+
*/
|
|
68
|
+
export type HookEventName = "PreToolUse" | "PostToolUse" | "Stop";
|
|
69
|
+
/**
|
|
70
|
+
* Runtime context for hook execution
|
|
71
|
+
* Contains all data needed to execute hooks for a specific event
|
|
72
|
+
*/
|
|
73
|
+
export interface HookExecutionContext {
|
|
74
|
+
/** Unique session identifier */
|
|
75
|
+
sessionId: string;
|
|
76
|
+
/** Current working directory */
|
|
77
|
+
cwd: string;
|
|
78
|
+
/** Tool call request (for PreToolUse/PostToolUse) */
|
|
79
|
+
toolCallRequest?: ToolCallRequest;
|
|
80
|
+
/** Tool result (for PostToolUse only) */
|
|
81
|
+
toolResult?: ToolMessage;
|
|
82
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const HookSchema = z.object({
|
|
3
|
+
type: z.literal("command").describe("Type of hook - currently only 'command' is supported"),
|
|
4
|
+
command: z.string().min(1).describe("Shell command to execute"),
|
|
5
|
+
timeout: z.number().positive().optional().default(60).describe("Timeout in seconds (default: 60)")
|
|
6
|
+
});
|
|
7
|
+
const HookMatcherSchema = z.object({
|
|
8
|
+
matcher: z.string().optional().describe("Pattern to match tool names (pipe-separated, wildcard, or regex)"),
|
|
9
|
+
hooks: z.array(HookSchema).min(1).describe("Array of hooks to execute when pattern matches")
|
|
10
|
+
});
|
|
11
|
+
const StopHookSchema = z.object({
|
|
12
|
+
hooks: z.array(HookSchema).min(1).describe("Array of hooks to execute when agent stops")
|
|
13
|
+
});
|
|
14
|
+
const HooksConfigSchema = z.object({
|
|
15
|
+
PreToolUse: z.array(HookMatcherSchema).optional().describe("Hooks that fire before tool execution (can block)"),
|
|
16
|
+
PostToolUse: z.array(HookMatcherSchema).optional().describe("Hooks that fire after tool completes (non-blocking)"),
|
|
17
|
+
Stop: z.array(StopHookSchema).optional().describe("Hooks that fire when agent completes (non-blocking)")
|
|
18
|
+
});
|
|
19
|
+
export { HookMatcherSchema, HookSchema, HooksConfigSchema, StopHookSchema };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
createHooksMiddleware: ()=>createHooksMiddleware
|
|
28
|
+
});
|
|
29
|
+
const external_langchain_namespaceObject = require("langchain");
|
|
30
|
+
const executor_cjs_namespaceObject = require("./hooks/executor.cjs");
|
|
31
|
+
function createHooksMiddleware(hooksConfig, workspace, sessionId, logger) {
|
|
32
|
+
const executor = new executor_cjs_namespaceObject.HookExecutor(workspace, logger);
|
|
33
|
+
return {
|
|
34
|
+
name: "hooks-middleware",
|
|
35
|
+
[external_langchain_namespaceObject.MIDDLEWARE_BRAND]: true,
|
|
36
|
+
wrapToolCall: async (request, handler)=>{
|
|
37
|
+
const context = {
|
|
38
|
+
sessionId,
|
|
39
|
+
cwd: workspace,
|
|
40
|
+
toolCallRequest: request
|
|
41
|
+
};
|
|
42
|
+
if (hooksConfig.PreToolUse && hooksConfig.PreToolUse.length > 0) try {
|
|
43
|
+
await executor.executeHooksForEvent("PreToolUse", hooksConfig.PreToolUse, context, true);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
logger.error(`PreToolUse hook blocked tool execution: ${error instanceof Error ? error.message : String(error)}`);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
const result = await handler(request);
|
|
49
|
+
if (hooksConfig.PostToolUse && hooksConfig.PostToolUse.length > 0 && "content" in result) {
|
|
50
|
+
const postContext = {
|
|
51
|
+
...context,
|
|
52
|
+
toolResult: result
|
|
53
|
+
};
|
|
54
|
+
executor.executeHooksForEvent("PostToolUse", hooksConfig.PostToolUse, postContext, false).catch((error)=>{
|
|
55
|
+
logger.warn(`PostToolUse hook failed (non-blocking): ${error instanceof Error ? error.message : String(error)}`);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
},
|
|
60
|
+
afterAgent: async ()=>{
|
|
61
|
+
if (hooksConfig.Stop && hooksConfig.Stop.length > 0) {
|
|
62
|
+
const context = {
|
|
63
|
+
sessionId,
|
|
64
|
+
cwd: workspace
|
|
65
|
+
};
|
|
66
|
+
executor.executeStopHooks(hooksConfig.Stop, context).catch((error)=>{
|
|
67
|
+
logger.warn(`Stop hook failed (non-blocking): ${error instanceof Error ? error.message : String(error)}`);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
exports.createHooksMiddleware = __webpack_exports__.createHooksMiddleware;
|
|
74
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
75
|
+
"createHooksMiddleware"
|
|
76
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
77
|
+
Object.defineProperty(exports, '__esModule', {
|
|
78
|
+
value: true
|
|
79
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks Middleware
|
|
3
|
+
*
|
|
4
|
+
* Integrates with deepagent's middleware system to execute user-defined hooks
|
|
5
|
+
* at specific lifecycle points (PreToolUse, PostToolUse, Stop)
|
|
6
|
+
*/
|
|
7
|
+
import { type AgentMiddleware } from "langchain";
|
|
8
|
+
import type { HooksConfig } from "@/types/hooks.js";
|
|
9
|
+
import type { Logger } from "@/logger.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create hooks middleware for deepagent
|
|
12
|
+
*
|
|
13
|
+
* @param hooksConfig - Merged hooks configuration (global + agent-specific)
|
|
14
|
+
* @param workspace - Workspace directory path
|
|
15
|
+
* @param sessionId - Unique session identifier
|
|
16
|
+
* @param logger - Logger instance
|
|
17
|
+
* @returns AgentMiddleware instance
|
|
18
|
+
*/
|
|
19
|
+
export declare function createHooksMiddleware(hooksConfig: HooksConfig, workspace: string, sessionId: string, logger: Logger): AgentMiddleware;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MIDDLEWARE_BRAND } from "langchain";
|
|
2
|
+
import { HookExecutor } from "./hooks/executor.js";
|
|
3
|
+
function createHooksMiddleware(hooksConfig, workspace, sessionId, logger) {
|
|
4
|
+
const executor = new HookExecutor(workspace, logger);
|
|
5
|
+
return {
|
|
6
|
+
name: "hooks-middleware",
|
|
7
|
+
[MIDDLEWARE_BRAND]: true,
|
|
8
|
+
wrapToolCall: async (request, handler)=>{
|
|
9
|
+
const context = {
|
|
10
|
+
sessionId,
|
|
11
|
+
cwd: workspace,
|
|
12
|
+
toolCallRequest: request
|
|
13
|
+
};
|
|
14
|
+
if (hooksConfig.PreToolUse && hooksConfig.PreToolUse.length > 0) try {
|
|
15
|
+
await executor.executeHooksForEvent("PreToolUse", hooksConfig.PreToolUse, context, true);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
logger.error(`PreToolUse hook blocked tool execution: ${error instanceof Error ? error.message : String(error)}`);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
const result = await handler(request);
|
|
21
|
+
if (hooksConfig.PostToolUse && hooksConfig.PostToolUse.length > 0 && "content" in result) {
|
|
22
|
+
const postContext = {
|
|
23
|
+
...context,
|
|
24
|
+
toolResult: result
|
|
25
|
+
};
|
|
26
|
+
executor.executeHooksForEvent("PostToolUse", hooksConfig.PostToolUse, postContext, false).catch((error)=>{
|
|
27
|
+
logger.warn(`PostToolUse hook failed (non-blocking): ${error instanceof Error ? error.message : String(error)}`);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
},
|
|
32
|
+
afterAgent: async ()=>{
|
|
33
|
+
if (hooksConfig.Stop && hooksConfig.Stop.length > 0) {
|
|
34
|
+
const context = {
|
|
35
|
+
sessionId,
|
|
36
|
+
cwd: workspace
|
|
37
|
+
};
|
|
38
|
+
executor.executeStopHooks(hooksConfig.Stop, context).catch((error)=>{
|
|
39
|
+
logger.warn(`Stop hook failed (non-blocking): ${error instanceof Error ? error.message : String(error)}`);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export { createHooksMiddleware };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
mediaCompatibilityMiddleware: ()=>mediaCompatibilityMiddleware
|
|
28
|
+
});
|
|
29
|
+
const anthropic_namespaceObject = require("@langchain/anthropic");
|
|
30
|
+
const external_langchain_namespaceObject = require("langchain");
|
|
31
|
+
const DEFAULT_AUDIO_PLACEHOLDER = "[Audio omitted: current model does not support audio inputs]";
|
|
32
|
+
const mediaCompatibilityMiddleware = (options = {})=>({
|
|
33
|
+
name: "media-compat-middleware",
|
|
34
|
+
[external_langchain_namespaceObject.MIDDLEWARE_BRAND]: true,
|
|
35
|
+
beforeAgent: async (input)=>{
|
|
36
|
+
if (!shouldStripAudio(options.model)) return input;
|
|
37
|
+
let mutated = false;
|
|
38
|
+
for (const message of input.messages){
|
|
39
|
+
const content = message.content;
|
|
40
|
+
if (!Array.isArray(content)) continue;
|
|
41
|
+
const { cleaned, removed } = stripAudioBlocks(content);
|
|
42
|
+
if (removed) {
|
|
43
|
+
mutated = true;
|
|
44
|
+
message.content = cleaned.length > 0 ? cleaned : options.audioPlaceholder || DEFAULT_AUDIO_PLACEHOLDER;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return mutated ? {
|
|
48
|
+
messages: input.messages
|
|
49
|
+
} : input;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
function shouldStripAudio(model) {
|
|
53
|
+
if (!model || "object" != typeof model) return false;
|
|
54
|
+
if (model instanceof anthropic_namespaceObject.ChatAnthropic) return true;
|
|
55
|
+
const ctorName = model?.constructor?.name;
|
|
56
|
+
return "string" == typeof ctorName && "chatanthropic" === ctorName.toLowerCase();
|
|
57
|
+
}
|
|
58
|
+
function stripAudioBlocks(blocks) {
|
|
59
|
+
let removed = false;
|
|
60
|
+
const cleaned = blocks.filter((block)=>{
|
|
61
|
+
if (!block || "object" != typeof block) return true;
|
|
62
|
+
const type = "string" == typeof block.type ? block.type.toLowerCase() : "";
|
|
63
|
+
if ("audio" === type || "audio_url" === type || "input_audio" === type) {
|
|
64
|
+
removed = true;
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
cleaned,
|
|
71
|
+
removed
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
exports.mediaCompatibilityMiddleware = __webpack_exports__.mediaCompatibilityMiddleware;
|
|
75
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
76
|
+
"mediaCompatibilityMiddleware"
|
|
77
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
78
|
+
Object.defineProperty(exports, '__esModule', {
|
|
79
|
+
value: true
|
|
80
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ChatAnthropic } from "@langchain/anthropic";
|
|
2
|
+
import { MIDDLEWARE_BRAND } from "langchain";
|
|
3
|
+
const DEFAULT_AUDIO_PLACEHOLDER = "[Audio omitted: current model does not support audio inputs]";
|
|
4
|
+
const mediaCompatibilityMiddleware = (options = {})=>({
|
|
5
|
+
name: "media-compat-middleware",
|
|
6
|
+
[MIDDLEWARE_BRAND]: true,
|
|
7
|
+
beforeAgent: async (input)=>{
|
|
8
|
+
if (!shouldStripAudio(options.model)) return input;
|
|
9
|
+
let mutated = false;
|
|
10
|
+
for (const message of input.messages){
|
|
11
|
+
const content = message.content;
|
|
12
|
+
if (!Array.isArray(content)) continue;
|
|
13
|
+
const { cleaned, removed } = stripAudioBlocks(content);
|
|
14
|
+
if (removed) {
|
|
15
|
+
mutated = true;
|
|
16
|
+
message.content = cleaned.length > 0 ? cleaned : options.audioPlaceholder || DEFAULT_AUDIO_PLACEHOLDER;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return mutated ? {
|
|
20
|
+
messages: input.messages
|
|
21
|
+
} : input;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
function shouldStripAudio(model) {
|
|
25
|
+
if (!model || "object" != typeof model) return false;
|
|
26
|
+
if (model instanceof ChatAnthropic) return true;
|
|
27
|
+
const ctorName = model?.constructor?.name;
|
|
28
|
+
return "string" == typeof ctorName && "chatanthropic" === ctorName.toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
function stripAudioBlocks(blocks) {
|
|
31
|
+
let removed = false;
|
|
32
|
+
const cleaned = blocks.filter((block)=>{
|
|
33
|
+
if (!block || "object" != typeof block) return true;
|
|
34
|
+
const type = "string" == typeof block.type ? block.type.toLowerCase() : "";
|
|
35
|
+
if ("audio" === type || "audio_url" === type || "input_audio" === type) {
|
|
36
|
+
removed = true;
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
cleaned,
|
|
43
|
+
removed
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export { mediaCompatibilityMiddleware };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_exports__ = {};
|
|
3
|
+
const external_vitest_namespaceObject = require("vitest");
|
|
4
|
+
const agentConfig_cjs_namespaceObject = require("../config/agentConfig.cjs");
|
|
5
|
+
(0, external_vitest_namespaceObject.describe)("Agent Configuration Schema", ()=>{
|
|
6
|
+
(0, external_vitest_namespaceObject.describe)("validateAgentConfig", ()=>{
|
|
7
|
+
(0, external_vitest_namespaceObject.it)("should validate a valid minimal agent config", ()=>{
|
|
8
|
+
const config = {
|
|
9
|
+
name: "test-agent",
|
|
10
|
+
description: "A test agent",
|
|
11
|
+
systemPrompt: "You are a test agent"
|
|
12
|
+
};
|
|
13
|
+
const result = (0, agentConfig_cjs_namespaceObject.validateAgentConfig)(config);
|
|
14
|
+
(0, external_vitest_namespaceObject.expect)(result.success).toBe(true);
|
|
15
|
+
if (result.success) {
|
|
16
|
+
(0, external_vitest_namespaceObject.expect)(result.data.name).toBe("test-agent");
|
|
17
|
+
(0, external_vitest_namespaceObject.expect)(result.data.description).toBe("A test agent");
|
|
18
|
+
(0, external_vitest_namespaceObject.expect)(result.data.systemPrompt).toBe("You are a test agent");
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
(0, external_vitest_namespaceObject.it)("should validate a complete agent config with all fields", ()=>{
|
|
22
|
+
const config = {
|
|
23
|
+
name: "data-analyst",
|
|
24
|
+
description: "Analyzes data",
|
|
25
|
+
systemPrompt: "You are a data analyst",
|
|
26
|
+
tools: [
|
|
27
|
+
"command_execute",
|
|
28
|
+
"think"
|
|
29
|
+
],
|
|
30
|
+
model: "anthropic:claude-opus-4-5",
|
|
31
|
+
blockedCommands: [
|
|
32
|
+
"rm",
|
|
33
|
+
"mv"
|
|
34
|
+
],
|
|
35
|
+
allowScriptExecution: true,
|
|
36
|
+
commandTimeout: 300000
|
|
37
|
+
};
|
|
38
|
+
const result = (0, agentConfig_cjs_namespaceObject.validateAgentConfig)(config);
|
|
39
|
+
(0, external_vitest_namespaceObject.expect)(result.success).toBe(true);
|
|
40
|
+
if (result.success) {
|
|
41
|
+
(0, external_vitest_namespaceObject.expect)(result.data.tools).toEqual([
|
|
42
|
+
"command_execute",
|
|
43
|
+
"think"
|
|
44
|
+
]);
|
|
45
|
+
(0, external_vitest_namespaceObject.expect)(result.data.model).toBe("anthropic:claude-opus-4-5");
|
|
46
|
+
(0, external_vitest_namespaceObject.expect)(result.data.blockedCommands).toEqual([
|
|
47
|
+
"rm",
|
|
48
|
+
"mv"
|
|
49
|
+
]);
|
|
50
|
+
(0, external_vitest_namespaceObject.expect)(result.data.allowScriptExecution).toBe(true);
|
|
51
|
+
(0, external_vitest_namespaceObject.expect)(result.data.commandTimeout).toBe(300000);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
(0, external_vitest_namespaceObject.it)("should allow subagents to override models", ()=>{
|
|
55
|
+
const config = {
|
|
56
|
+
name: "parent-agent",
|
|
57
|
+
description: "Parent agent",
|
|
58
|
+
systemPrompt: "You are the parent agent",
|
|
59
|
+
subAgents: [
|
|
60
|
+
{
|
|
61
|
+
name: "research-agent",
|
|
62
|
+
description: "Researches topics",
|
|
63
|
+
systemPrompt: "You are a researcher",
|
|
64
|
+
model: "openai:gpt-4o"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
};
|
|
68
|
+
const result = (0, agentConfig_cjs_namespaceObject.validateAgentConfig)(config);
|
|
69
|
+
(0, external_vitest_namespaceObject.expect)(result.success).toBe(true);
|
|
70
|
+
if (result.success) (0, external_vitest_namespaceObject.expect)(result.data.subAgents?.[0].model).toBe("openai:gpt-4o");
|
|
71
|
+
});
|
|
72
|
+
(0, external_vitest_namespaceObject.it)("should fail validation for missing required fields", ()=>{
|
|
73
|
+
const config = {
|
|
74
|
+
name: "test-agent"
|
|
75
|
+
};
|
|
76
|
+
const result = (0, agentConfig_cjs_namespaceObject.validateAgentConfig)(config);
|
|
77
|
+
(0, external_vitest_namespaceObject.expect)(result.success).toBe(false);
|
|
78
|
+
if (!result.success) {
|
|
79
|
+
(0, external_vitest_namespaceObject.expect)(result.error).toContain("description");
|
|
80
|
+
(0, external_vitest_namespaceObject.expect)(result.error).toContain("systemPrompt");
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
(0, external_vitest_namespaceObject.it)("should fail validation for invalid tool names", ()=>{
|
|
84
|
+
const config = {
|
|
85
|
+
name: "test-agent",
|
|
86
|
+
description: "Test",
|
|
87
|
+
systemPrompt: "Test",
|
|
88
|
+
tools: [
|
|
89
|
+
"invalid_tool"
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
const result = (0, agentConfig_cjs_namespaceObject.validateAgentConfig)(config);
|
|
93
|
+
(0, external_vitest_namespaceObject.expect)(result.success).toBe(false);
|
|
94
|
+
});
|
|
95
|
+
(0, external_vitest_namespaceObject.it)("should apply default values for optional fields", ()=>{
|
|
96
|
+
const config = {
|
|
97
|
+
name: "test-agent",
|
|
98
|
+
description: "Test",
|
|
99
|
+
systemPrompt: "Test"
|
|
100
|
+
};
|
|
101
|
+
const parsed = agentConfig_cjs_namespaceObject.AgentConfigSchema.parse(config);
|
|
102
|
+
(0, external_vitest_namespaceObject.expect)(parsed.allowScriptExecution).toBe(true);
|
|
103
|
+
(0, external_vitest_namespaceObject.expect)(parsed.commandTimeout).toBe(300000);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
(0, external_vitest_namespaceObject.describe)("Tool names enum", ()=>{
|
|
107
|
+
(0, external_vitest_namespaceObject.it)("should accept all valid tool names", ()=>{
|
|
108
|
+
const validTools = [
|
|
109
|
+
"internet_search",
|
|
110
|
+
"web_crawler",
|
|
111
|
+
"command_execute",
|
|
112
|
+
"think"
|
|
113
|
+
];
|
|
114
|
+
for (const tool of validTools){
|
|
115
|
+
const config = {
|
|
116
|
+
name: "test",
|
|
117
|
+
description: "test",
|
|
118
|
+
systemPrompt: "test",
|
|
119
|
+
tools: [
|
|
120
|
+
tool
|
|
121
|
+
]
|
|
122
|
+
};
|
|
123
|
+
const result = (0, agentConfig_cjs_namespaceObject.validateAgentConfig)(config);
|
|
124
|
+
(0, external_vitest_namespaceObject.expect)(result.success).toBe(true);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
130
|
+
Object.defineProperty(exports, '__esModule', {
|
|
131
|
+
value: true
|
|
132
|
+
});
|