@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,158 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const MessageTypeSchema = z["enum"]([
|
|
3
|
+
"connect",
|
|
4
|
+
"res",
|
|
5
|
+
"req:agent",
|
|
6
|
+
"event:agent",
|
|
7
|
+
"session_subscribe",
|
|
8
|
+
"session_unsubscribe",
|
|
9
|
+
"register",
|
|
10
|
+
"registered",
|
|
11
|
+
"unregister",
|
|
12
|
+
"join_group",
|
|
13
|
+
"leave_group",
|
|
14
|
+
"broadcast",
|
|
15
|
+
"direct",
|
|
16
|
+
"ping",
|
|
17
|
+
"pong",
|
|
18
|
+
"error",
|
|
19
|
+
"ack"
|
|
20
|
+
]);
|
|
21
|
+
const GatewayMessageSchema = z.object({
|
|
22
|
+
type: MessageTypeSchema,
|
|
23
|
+
id: z.string().optional(),
|
|
24
|
+
client: z.object({
|
|
25
|
+
instanceId: z.string().min(1),
|
|
26
|
+
clientType: z.string().min(1),
|
|
27
|
+
version: z.string().optional()
|
|
28
|
+
}).optional(),
|
|
29
|
+
auth: z.object({
|
|
30
|
+
token: z.string().optional(),
|
|
31
|
+
password: z.string().optional(),
|
|
32
|
+
deviceId: z.string().optional()
|
|
33
|
+
}).optional(),
|
|
34
|
+
ok: z.boolean().optional(),
|
|
35
|
+
clientId: z.string().optional(),
|
|
36
|
+
nodeId: z.string().optional(),
|
|
37
|
+
groupId: z.string().optional(),
|
|
38
|
+
roomId: z.string().optional(),
|
|
39
|
+
targetNodeId: z.string().optional(),
|
|
40
|
+
payload: z.unknown().optional(),
|
|
41
|
+
timestamp: z.number(),
|
|
42
|
+
messageId: z.string().optional()
|
|
43
|
+
});
|
|
44
|
+
const RegisterPayloadSchema = z.object({
|
|
45
|
+
name: z.string().min(1).max(100),
|
|
46
|
+
capabilities: z.array(z.string()).optional(),
|
|
47
|
+
token: z.string().optional()
|
|
48
|
+
});
|
|
49
|
+
const JoinGroupPayloadSchema = z.object({
|
|
50
|
+
groupId: z.string().optional(),
|
|
51
|
+
groupName: z.string().min(1).max(100).optional(),
|
|
52
|
+
createIfNotExists: z.boolean().optional(),
|
|
53
|
+
description: z.string().max(500).optional()
|
|
54
|
+
});
|
|
55
|
+
const BroadcastPayloadSchema = z.object({
|
|
56
|
+
groupId: z.string().min(1),
|
|
57
|
+
message: z.unknown()
|
|
58
|
+
});
|
|
59
|
+
const DirectPayloadSchema = z.object({
|
|
60
|
+
targetNodeId: z.string().min(1),
|
|
61
|
+
message: z.unknown()
|
|
62
|
+
});
|
|
63
|
+
const ErrorPayloadSchema = z.object({
|
|
64
|
+
code: z.string().min(1),
|
|
65
|
+
message: z.string().min(1),
|
|
66
|
+
details: z.unknown().optional()
|
|
67
|
+
});
|
|
68
|
+
function validateGatewayMessage(data) {
|
|
69
|
+
try {
|
|
70
|
+
const result = GatewayMessageSchema.safeParse(data);
|
|
71
|
+
if (!result.success) return {
|
|
72
|
+
success: false,
|
|
73
|
+
error: `Invalid message format: ${result.error.message}`
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
success: true,
|
|
77
|
+
data: result.data
|
|
78
|
+
};
|
|
79
|
+
} catch (error) {
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
error: error instanceof Error ? error.message : "Unknown validation error"
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function validateRegisterPayload(data) {
|
|
87
|
+
try {
|
|
88
|
+
const result = RegisterPayloadSchema.safeParse(data);
|
|
89
|
+
if (!result.success) return {
|
|
90
|
+
success: false,
|
|
91
|
+
error: `Invalid register payload: ${result.error.message}`
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
success: true,
|
|
95
|
+
data: result.data
|
|
96
|
+
};
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return {
|
|
99
|
+
success: false,
|
|
100
|
+
error: error instanceof Error ? error.message : "Unknown validation error"
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function validateJoinGroupPayload(data) {
|
|
105
|
+
try {
|
|
106
|
+
const result = JoinGroupPayloadSchema.safeParse(data);
|
|
107
|
+
if (!result.success) return {
|
|
108
|
+
success: false,
|
|
109
|
+
error: `Invalid join group payload: ${result.error.message}`
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
success: true,
|
|
113
|
+
data: result.data
|
|
114
|
+
};
|
|
115
|
+
} catch (error) {
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
error: error instanceof Error ? error.message : "Unknown validation error"
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function validateBroadcastPayload(data) {
|
|
123
|
+
try {
|
|
124
|
+
const result = BroadcastPayloadSchema.safeParse(data);
|
|
125
|
+
if (!result.success) return {
|
|
126
|
+
success: false,
|
|
127
|
+
error: `Invalid broadcast payload: ${result.error.message}`
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
success: true,
|
|
131
|
+
data: result.data
|
|
132
|
+
};
|
|
133
|
+
} catch (error) {
|
|
134
|
+
return {
|
|
135
|
+
success: false,
|
|
136
|
+
error: error instanceof Error ? error.message : "Unknown validation error"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function validateDirectPayload(data) {
|
|
141
|
+
try {
|
|
142
|
+
const result = DirectPayloadSchema.safeParse(data);
|
|
143
|
+
if (!result.success) return {
|
|
144
|
+
success: false,
|
|
145
|
+
error: `Invalid direct payload: ${result.error.message}`
|
|
146
|
+
};
|
|
147
|
+
return {
|
|
148
|
+
success: true,
|
|
149
|
+
data: result.data
|
|
150
|
+
};
|
|
151
|
+
} catch (error) {
|
|
152
|
+
return {
|
|
153
|
+
success: false,
|
|
154
|
+
error: error instanceof Error ? error.message : "Unknown validation error"
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
export { BroadcastPayloadSchema, DirectPayloadSchema, ErrorPayloadSchema, GatewayMessageSchema, JoinGroupPayloadSchema, MessageTypeSchema, RegisterPayloadSchema, validateBroadcastPayload, validateDirectPayload, validateGatewayMessage, validateJoinGroupPayload, validateRegisterPayload };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./agent/config/agentLoader.js" (module) {
|
|
4
|
+
module.exports = require("./agent/config/agentLoader.cjs");
|
|
5
|
+
},
|
|
6
|
+
"./cli/config/loader.js" (module) {
|
|
7
|
+
module.exports = require("./cli/config/loader.cjs");
|
|
8
|
+
},
|
|
9
|
+
"./cli/core/agentInvoker.js" (module) {
|
|
10
|
+
module.exports = require("./cli/core/agentInvoker.cjs");
|
|
11
|
+
},
|
|
12
|
+
"./cli/core/outputManager.js" (module) {
|
|
13
|
+
module.exports = require("./cli/core/outputManager.cjs");
|
|
14
|
+
},
|
|
15
|
+
"./logger.js" (module) {
|
|
16
|
+
module.exports = require("./logger.cjs");
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var __webpack_module_cache__ = {};
|
|
20
|
+
function __webpack_require__(moduleId) {
|
|
21
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
22
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
23
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
24
|
+
exports: {}
|
|
25
|
+
};
|
|
26
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
27
|
+
return module.exports;
|
|
28
|
+
}
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.n = (module)=>{
|
|
31
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
32
|
+
__webpack_require__.d(getter, {
|
|
33
|
+
a: getter
|
|
34
|
+
});
|
|
35
|
+
return getter;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
(()=>{
|
|
39
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
40
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: definition[key]
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
(()=>{
|
|
47
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
48
|
+
})();
|
|
49
|
+
(()=>{
|
|
50
|
+
__webpack_require__.r = (exports1)=>{
|
|
51
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
52
|
+
value: 'Module'
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
55
|
+
value: true
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
59
|
+
var __webpack_exports__ = {};
|
|
60
|
+
(()=>{
|
|
61
|
+
__webpack_require__.r(__webpack_exports__);
|
|
62
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
63
|
+
AgentConfigLoader: ()=>_agent_config_agentLoader_js__rspack_import_1.AgentLoader,
|
|
64
|
+
AgentInvoker: ()=>_cli_core_agentInvoker_js__rspack_import_3.AgentInvoker,
|
|
65
|
+
OutputManager: ()=>_cli_core_outputManager_js__rspack_import_2.OutputManager,
|
|
66
|
+
WingmanConfigLoader: ()=>_cli_config_loader_js__rspack_import_4.WingmanConfigLoader
|
|
67
|
+
});
|
|
68
|
+
var _logger_js__rspack_import_0 = __webpack_require__("./logger.js");
|
|
69
|
+
var __rspack_reexport = {};
|
|
70
|
+
for(const __rspack_import_key in _logger_js__rspack_import_0)if ([
|
|
71
|
+
"OutputManager",
|
|
72
|
+
"default",
|
|
73
|
+
"AgentInvoker",
|
|
74
|
+
"WingmanConfigLoader",
|
|
75
|
+
"AgentConfigLoader"
|
|
76
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_logger_js__rspack_import_0[__rspack_import_key];
|
|
77
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
78
|
+
var _agent_config_agentLoader_js__rspack_import_1 = __webpack_require__("./agent/config/agentLoader.js");
|
|
79
|
+
var _cli_core_outputManager_js__rspack_import_2 = __webpack_require__("./cli/core/outputManager.js");
|
|
80
|
+
var _cli_core_agentInvoker_js__rspack_import_3 = __webpack_require__("./cli/core/agentInvoker.js");
|
|
81
|
+
var _cli_config_loader_js__rspack_import_4 = __webpack_require__("./cli/config/loader.js");
|
|
82
|
+
})();
|
|
83
|
+
exports.AgentConfigLoader = __webpack_exports__.AgentConfigLoader;
|
|
84
|
+
exports.AgentInvoker = __webpack_exports__.AgentInvoker;
|
|
85
|
+
exports.OutputManager = __webpack_exports__.OutputManager;
|
|
86
|
+
exports.WingmanConfigLoader = __webpack_exports__.WingmanConfigLoader;
|
|
87
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
88
|
+
"AgentConfigLoader",
|
|
89
|
+
"AgentInvoker",
|
|
90
|
+
"OutputManager",
|
|
91
|
+
"WingmanConfigLoader"
|
|
92
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
93
|
+
Object.defineProperty(exports, '__esModule', {
|
|
94
|
+
value: true
|
|
95
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./logger.js";
|
|
2
|
+
export { AgentLoader as AgentConfigLoader } from "./agent/config/agentLoader.js";
|
|
3
|
+
export { OutputManager } from "./cli/core/outputManager.js";
|
|
4
|
+
export { AgentInvoker } from "./cli/core/agentInvoker.js";
|
|
5
|
+
export { WingmanConfigLoader } from "./cli/config/loader.js";
|
|
6
|
+
export type * from "./cli/types.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AgentLoader } from "./agent/config/agentLoader.js";
|
|
2
|
+
import { OutputManager } from "./cli/core/outputManager.js";
|
|
3
|
+
import { AgentInvoker } from "./cli/core/agentInvoker.js";
|
|
4
|
+
import { WingmanConfigLoader } from "./cli/config/loader.js";
|
|
5
|
+
export * from "./logger.js";
|
|
6
|
+
export { AgentLoader as AgentConfigLoader, AgentInvoker, OutputManager, WingmanConfigLoader };
|
package/dist/logger.cjs
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
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
|
+
EventLogger: ()=>EventLogger,
|
|
28
|
+
writeToLogFile: ()=>writeToLogFile,
|
|
29
|
+
createEventLogger: ()=>createEventLogger,
|
|
30
|
+
createLogger: ()=>createLogger,
|
|
31
|
+
WingmanLogger: ()=>WingmanLogger,
|
|
32
|
+
createLoggerFromConfig: ()=>createLoggerFromConfig,
|
|
33
|
+
getLogFilePath: ()=>getLogFilePath,
|
|
34
|
+
SilentLogger: ()=>SilentLogger
|
|
35
|
+
});
|
|
36
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
37
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
38
|
+
const external_node_os_namespaceObject = require("node:os");
|
|
39
|
+
function _define_property(obj, key, value) {
|
|
40
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
41
|
+
value: value,
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true
|
|
45
|
+
});
|
|
46
|
+
else obj[key] = value;
|
|
47
|
+
return obj;
|
|
48
|
+
}
|
|
49
|
+
const DEFAULT_LOG_FILE_NAME = "wingman.log";
|
|
50
|
+
const DEFAULT_LOG_DIR = (0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.homedir)(), ".wingman", "logs");
|
|
51
|
+
const DEFAULT_MAX_BYTES = parsePositiveInt(process.env.WINGMAN_LOG_MAX_BYTES, 5242880);
|
|
52
|
+
const DEFAULT_MAX_FILES = parsePositiveInt(process.env.WINGMAN_LOG_MAX_FILES, 5);
|
|
53
|
+
function serializeLogArg(arg) {
|
|
54
|
+
const isError = "function" == typeof Error.isError ? Error.isError(arg) : arg instanceof Error;
|
|
55
|
+
if (isError) return {
|
|
56
|
+
name: arg.name,
|
|
57
|
+
message: arg.message,
|
|
58
|
+
stack: arg.stack
|
|
59
|
+
};
|
|
60
|
+
return arg;
|
|
61
|
+
}
|
|
62
|
+
function parsePositiveInt(value, fallback) {
|
|
63
|
+
if (!value) return fallback;
|
|
64
|
+
const parsed = Number.parseInt(value, 10);
|
|
65
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
66
|
+
}
|
|
67
|
+
function resolveDefaultLogFileName() {
|
|
68
|
+
const isoDate = new Date().toISOString().slice(0, 10);
|
|
69
|
+
return `wingman-${isoDate}.log`;
|
|
70
|
+
}
|
|
71
|
+
function resolveLogFilePath() {
|
|
72
|
+
const explicitFile = process.env.WINGMAN_LOG_FILE;
|
|
73
|
+
if (explicitFile && explicitFile.trim().length > 0) return explicitFile;
|
|
74
|
+
const logDir = process.env.WINGMAN_LOG_DIR?.trim() || DEFAULT_LOG_DIR;
|
|
75
|
+
return (0, external_node_path_namespaceObject.join)(logDir, resolveDefaultLogFileName() || DEFAULT_LOG_FILE_NAME);
|
|
76
|
+
}
|
|
77
|
+
function getLogFilePath() {
|
|
78
|
+
return resolveLogFilePath();
|
|
79
|
+
}
|
|
80
|
+
function writeToLogFile(chunk) {
|
|
81
|
+
const text = "string" == typeof chunk ? chunk : chunk.toString("utf-8");
|
|
82
|
+
getSharedFileWriter().write(text);
|
|
83
|
+
}
|
|
84
|
+
class RollingFileWriter {
|
|
85
|
+
write(chunk) {
|
|
86
|
+
try {
|
|
87
|
+
this.ensureInitialized();
|
|
88
|
+
const bytes = Buffer.byteLength(chunk);
|
|
89
|
+
if (this.currentSize + bytes > this.maxBytes) {
|
|
90
|
+
this.rotate();
|
|
91
|
+
this.currentSize = 0;
|
|
92
|
+
}
|
|
93
|
+
(0, external_node_fs_namespaceObject.appendFileSync)(this.filePath, chunk);
|
|
94
|
+
this.currentSize += bytes;
|
|
95
|
+
} catch {}
|
|
96
|
+
}
|
|
97
|
+
ensureInitialized() {
|
|
98
|
+
if (this.initialized) return;
|
|
99
|
+
this.initialized = true;
|
|
100
|
+
(0, external_node_fs_namespaceObject.mkdirSync)((0, external_node_path_namespaceObject.dirname)(this.filePath), {
|
|
101
|
+
recursive: true
|
|
102
|
+
});
|
|
103
|
+
if ((0, external_node_fs_namespaceObject.existsSync)(this.filePath)) this.currentSize = (0, external_node_fs_namespaceObject.statSync)(this.filePath).size;
|
|
104
|
+
}
|
|
105
|
+
rotate() {
|
|
106
|
+
try {
|
|
107
|
+
const oldest = `${this.filePath}.${this.maxFiles}`;
|
|
108
|
+
if ((0, external_node_fs_namespaceObject.existsSync)(oldest)) (0, external_node_fs_namespaceObject.unlinkSync)(oldest);
|
|
109
|
+
for(let i = this.maxFiles - 1; i >= 1; i--){
|
|
110
|
+
const source = `${this.filePath}.${i}`;
|
|
111
|
+
if ((0, external_node_fs_namespaceObject.existsSync)(source)) (0, external_node_fs_namespaceObject.renameSync)(source, `${this.filePath}.${i + 1}`);
|
|
112
|
+
}
|
|
113
|
+
if ((0, external_node_fs_namespaceObject.existsSync)(this.filePath)) (0, external_node_fs_namespaceObject.renameSync)(this.filePath, `${this.filePath}.1`);
|
|
114
|
+
} catch {}
|
|
115
|
+
}
|
|
116
|
+
constructor(filePath, maxBytes, maxFiles){
|
|
117
|
+
_define_property(this, "currentSize", 0);
|
|
118
|
+
_define_property(this, "initialized", false);
|
|
119
|
+
_define_property(this, "filePath", void 0);
|
|
120
|
+
_define_property(this, "maxBytes", void 0);
|
|
121
|
+
_define_property(this, "maxFiles", void 0);
|
|
122
|
+
this.filePath = filePath;
|
|
123
|
+
this.maxBytes = Math.max(1, maxBytes);
|
|
124
|
+
this.maxFiles = Math.max(1, maxFiles);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
let sharedFileWriter = null;
|
|
128
|
+
function getSharedFileWriter() {
|
|
129
|
+
if (!sharedFileWriter) sharedFileWriter = new RollingFileWriter(resolveLogFilePath(), DEFAULT_MAX_BYTES, DEFAULT_MAX_FILES);
|
|
130
|
+
return sharedFileWriter;
|
|
131
|
+
}
|
|
132
|
+
class WingmanLogger {
|
|
133
|
+
shouldLog(level) {
|
|
134
|
+
const levels = [
|
|
135
|
+
"debug",
|
|
136
|
+
"info",
|
|
137
|
+
"warn",
|
|
138
|
+
"error",
|
|
139
|
+
"silent"
|
|
140
|
+
];
|
|
141
|
+
const currentIndex = levels.indexOf(this.level);
|
|
142
|
+
const messageIndex = levels.indexOf(level);
|
|
143
|
+
return "silent" !== this.level && messageIndex >= currentIndex;
|
|
144
|
+
}
|
|
145
|
+
log(level, message, ...args) {
|
|
146
|
+
if (!this.shouldLog(level)) return;
|
|
147
|
+
const timestamp = new Date().toISOString();
|
|
148
|
+
const prefix = `[${timestamp}] [${level.toUpperCase()}]`;
|
|
149
|
+
this.output.write(`${prefix} ${message}\n`);
|
|
150
|
+
if (args.length > 0) {
|
|
151
|
+
const serialized = args.map((arg)=>serializeLogArg(arg));
|
|
152
|
+
this.output.write(`${JSON.stringify(serialized, null, 2)}\n`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
debug(message, ...args) {
|
|
156
|
+
this.log("debug", message, ...args);
|
|
157
|
+
}
|
|
158
|
+
info(message, ...args) {
|
|
159
|
+
this.log("info", message, ...args);
|
|
160
|
+
}
|
|
161
|
+
warn(message, ...args) {
|
|
162
|
+
this.log("warn", message, ...args);
|
|
163
|
+
}
|
|
164
|
+
error(message, ...args) {
|
|
165
|
+
this.log("error", message, ...args);
|
|
166
|
+
}
|
|
167
|
+
constructor(level = "info", output = getSharedFileWriter()){
|
|
168
|
+
_define_property(this, "level", void 0);
|
|
169
|
+
_define_property(this, "output", void 0);
|
|
170
|
+
this.level = level;
|
|
171
|
+
this.output = output;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
class SilentLogger {
|
|
175
|
+
debug() {}
|
|
176
|
+
info() {}
|
|
177
|
+
warn() {}
|
|
178
|
+
error() {}
|
|
179
|
+
}
|
|
180
|
+
function createLogger(level = process.env.WINGMAN_LOG_LEVEL || "info") {
|
|
181
|
+
if ("silent" === level) return new SilentLogger();
|
|
182
|
+
return new WingmanLogger(level);
|
|
183
|
+
}
|
|
184
|
+
function createLoggerFromConfig(config) {
|
|
185
|
+
return createLogger(config.level);
|
|
186
|
+
}
|
|
187
|
+
class EventLogger {
|
|
188
|
+
shouldLog(level) {
|
|
189
|
+
const levels = [
|
|
190
|
+
"debug",
|
|
191
|
+
"info",
|
|
192
|
+
"warn",
|
|
193
|
+
"error",
|
|
194
|
+
"silent"
|
|
195
|
+
];
|
|
196
|
+
const currentIndex = levels.indexOf(this.level);
|
|
197
|
+
const messageIndex = levels.indexOf(level);
|
|
198
|
+
return "silent" !== this.level && messageIndex >= currentIndex;
|
|
199
|
+
}
|
|
200
|
+
log(level, message, ...args) {
|
|
201
|
+
if (!this.shouldLog(level)) return;
|
|
202
|
+
this.callback({
|
|
203
|
+
level,
|
|
204
|
+
message,
|
|
205
|
+
timestamp: new Date().toISOString(),
|
|
206
|
+
args: args.length > 0 ? args : void 0
|
|
207
|
+
});
|
|
208
|
+
if (!this.secondaryLogger) return;
|
|
209
|
+
switch(level){
|
|
210
|
+
case "debug":
|
|
211
|
+
this.secondaryLogger.debug(message, ...args);
|
|
212
|
+
break;
|
|
213
|
+
case "info":
|
|
214
|
+
this.secondaryLogger.info(message, ...args);
|
|
215
|
+
break;
|
|
216
|
+
case "warn":
|
|
217
|
+
this.secondaryLogger.warn(message, ...args);
|
|
218
|
+
break;
|
|
219
|
+
case "error":
|
|
220
|
+
this.secondaryLogger.error(message, ...args);
|
|
221
|
+
break;
|
|
222
|
+
case "silent":
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
debug(message, ...args) {
|
|
227
|
+
this.log("debug", message, ...args);
|
|
228
|
+
}
|
|
229
|
+
info(message, ...args) {
|
|
230
|
+
this.log("info", message, ...args);
|
|
231
|
+
}
|
|
232
|
+
warn(message, ...args) {
|
|
233
|
+
this.log("warn", message, ...args);
|
|
234
|
+
}
|
|
235
|
+
error(message, ...args) {
|
|
236
|
+
this.log("error", message, ...args);
|
|
237
|
+
}
|
|
238
|
+
constructor(callback, level = "info", secondaryLogger){
|
|
239
|
+
_define_property(this, "callback", void 0);
|
|
240
|
+
_define_property(this, "level", void 0);
|
|
241
|
+
_define_property(this, "secondaryLogger", void 0);
|
|
242
|
+
this.callback = callback;
|
|
243
|
+
this.level = level;
|
|
244
|
+
this.secondaryLogger = secondaryLogger;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function createEventLogger(callback, level = "info") {
|
|
248
|
+
return new EventLogger(callback, level, createLogger(level));
|
|
249
|
+
}
|
|
250
|
+
exports.EventLogger = __webpack_exports__.EventLogger;
|
|
251
|
+
exports.SilentLogger = __webpack_exports__.SilentLogger;
|
|
252
|
+
exports.WingmanLogger = __webpack_exports__.WingmanLogger;
|
|
253
|
+
exports.createEventLogger = __webpack_exports__.createEventLogger;
|
|
254
|
+
exports.createLogger = __webpack_exports__.createLogger;
|
|
255
|
+
exports.createLoggerFromConfig = __webpack_exports__.createLoggerFromConfig;
|
|
256
|
+
exports.getLogFilePath = __webpack_exports__.getLogFilePath;
|
|
257
|
+
exports.writeToLogFile = __webpack_exports__.writeToLogFile;
|
|
258
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
259
|
+
"EventLogger",
|
|
260
|
+
"SilentLogger",
|
|
261
|
+
"WingmanLogger",
|
|
262
|
+
"createEventLogger",
|
|
263
|
+
"createLogger",
|
|
264
|
+
"createLoggerFromConfig",
|
|
265
|
+
"getLogFilePath",
|
|
266
|
+
"writeToLogFile"
|
|
267
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
268
|
+
Object.defineProperty(exports, '__esModule', {
|
|
269
|
+
value: true
|
|
270
|
+
});
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type LogLevel = "debug" | "info" | "warn" | "error" | "silent";
|
|
2
|
+
interface LogWriter {
|
|
3
|
+
write(chunk: string): void;
|
|
4
|
+
}
|
|
5
|
+
export declare function getLogFilePath(): string;
|
|
6
|
+
export declare function writeToLogFile(chunk: string | Buffer): void;
|
|
7
|
+
export interface Logger {
|
|
8
|
+
debug(message: string, ...args: any[]): void;
|
|
9
|
+
info(message: string, ...args: any[]): void;
|
|
10
|
+
warn(message: string, ...args: any[]): void;
|
|
11
|
+
error(message: string, ...args: any[]): void;
|
|
12
|
+
}
|
|
13
|
+
export declare class WingmanLogger implements Logger {
|
|
14
|
+
private level;
|
|
15
|
+
private output;
|
|
16
|
+
constructor(level?: LogLevel, output?: LogWriter);
|
|
17
|
+
private shouldLog;
|
|
18
|
+
private log;
|
|
19
|
+
debug(message: string, ...args: any[]): void;
|
|
20
|
+
info(message: string, ...args: any[]): void;
|
|
21
|
+
warn(message: string, ...args: any[]): void;
|
|
22
|
+
error(message: string, ...args: any[]): void;
|
|
23
|
+
}
|
|
24
|
+
export declare class SilentLogger implements Logger {
|
|
25
|
+
debug(): void;
|
|
26
|
+
info(): void;
|
|
27
|
+
warn(): void;
|
|
28
|
+
error(): void;
|
|
29
|
+
}
|
|
30
|
+
export declare function createLogger(level?: LogLevel): Logger;
|
|
31
|
+
export interface SerializableLoggerConfig {
|
|
32
|
+
level: LogLevel;
|
|
33
|
+
}
|
|
34
|
+
export declare function createLoggerFromConfig(config: SerializableLoggerConfig): Logger;
|
|
35
|
+
export type LogEventCallback = (event: {
|
|
36
|
+
level: LogLevel;
|
|
37
|
+
message: string;
|
|
38
|
+
timestamp: string;
|
|
39
|
+
args?: any[];
|
|
40
|
+
}) => void;
|
|
41
|
+
export declare class EventLogger implements Logger {
|
|
42
|
+
private callback;
|
|
43
|
+
private level;
|
|
44
|
+
private secondaryLogger?;
|
|
45
|
+
constructor(callback: LogEventCallback, level?: LogLevel, secondaryLogger?: Logger | undefined);
|
|
46
|
+
private shouldLog;
|
|
47
|
+
private log;
|
|
48
|
+
debug(message: string, ...args: any[]): void;
|
|
49
|
+
info(message: string, ...args: any[]): void;
|
|
50
|
+
warn(message: string, ...args: any[]): void;
|
|
51
|
+
error(message: string, ...args: any[]): void;
|
|
52
|
+
}
|
|
53
|
+
export declare function createEventLogger(callback: LogEventCallback, level?: LogLevel): Logger;
|
|
54
|
+
export {};
|