@wingman-ai/gateway 0.5.3 → 0.6.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/dist/agent/backend/filtered-backend.cjs +130 -0
- package/dist/agent/backend/filtered-backend.d.ts +10 -0
- package/dist/agent/backend/filtered-backend.js +87 -0
- package/dist/agent/config/agentConfig.cjs +4 -0
- package/dist/agent/config/agentConfig.d.ts +12 -0
- package/dist/agent/config/agentConfig.js +4 -0
- package/dist/agent/config/toolRegistry.cjs +75 -1
- package/dist/agent/config/toolRegistry.d.ts +3 -0
- package/dist/agent/config/toolRegistry.js +75 -1
- package/dist/agent/middleware/additional-messages.cjs +4 -1
- package/dist/agent/middleware/additional-messages.js +4 -1
- package/dist/agent/middleware/large-tool-results.cjs +207 -0
- package/dist/agent/middleware/large-tool-results.d.ts +16 -0
- package/dist/agent/middleware/large-tool-results.js +173 -0
- package/dist/agent/tools/browser_control.cjs +9 -1231
- package/dist/agent/tools/browser_control.d.ts +126 -234
- package/dist/agent/tools/browser_control.js +7 -1226
- package/dist/agent/tools/browser_runtime.cjs +1358 -0
- package/dist/agent/tools/browser_runtime.d.ts +617 -0
- package/dist/agent/tools/browser_runtime.js +1288 -0
- package/dist/agent/tools/browser_session.cjs +189 -0
- package/dist/agent/tools/browser_session.d.ts +686 -0
- package/dist/agent/tools/browser_session.js +146 -0
- package/dist/agent/tools/browser_session_manager.cjs +213 -0
- package/dist/agent/tools/browser_session_manager.d.ts +70 -0
- package/dist/agent/tools/browser_session_manager.js +176 -0
- package/dist/cli/commands/init.cjs +80 -98
- package/dist/cli/commands/init.js +80 -98
- package/dist/cli/config/loader.cjs +0 -5
- package/dist/cli/config/loader.js +0 -5
- package/dist/cli/config/schema.cjs +3 -7
- package/dist/cli/config/schema.d.ts +6 -6
- package/dist/cli/config/schema.js +3 -7
- package/dist/cli/core/agentInvoker.cjs +88 -22
- package/dist/cli/core/agentInvoker.d.ts +10 -3
- package/dist/cli/core/agentInvoker.js +88 -25
- package/dist/cli/core/outputManager.cjs +7 -2
- package/dist/cli/core/outputManager.d.ts +2 -2
- package/dist/cli/core/outputManager.js +7 -2
- package/dist/cli/core/sessionManager.cjs +208 -41
- package/dist/cli/core/sessionManager.d.ts +20 -0
- package/dist/cli/core/sessionManager.js +208 -41
- package/dist/cli/index.cjs +16 -1
- package/dist/cli/index.js +16 -1
- package/dist/cli/services/updateCheck.cjs +212 -0
- package/dist/cli/services/updateCheck.d.ts +26 -0
- package/dist/cli/services/updateCheck.js +166 -0
- package/dist/cli/types.d.ts +2 -1
- package/dist/gateway/server.cjs +7 -0
- package/dist/gateway/server.js +7 -0
- package/dist/webui/assets/index-D3x3G75t.css +11 -0
- package/dist/webui/assets/index-UpMmcU1f.js +215 -0
- package/dist/webui/index.html +2 -2
- package/package.json +12 -12
- package/templates/agents/README.md +3 -1
- package/templates/agents/coding/agent.md +6 -13
- package/templates/agents/coding-v2/agent.md +6 -1
- package/templates/agents/game-dev/agent.md +9 -2
- package/templates/agents/game-dev/game-designer.md +4 -0
- package/templates/agents/game-dev/scene-engineer.md +4 -0
- package/templates/agents/main/agent.md +7 -2
- package/templates/agents/researcher/agent.md +14 -3
- package/templates/agents/stock-trader/agent.md +4 -0
- package/dist/agent/tests/agentConfig.test.cjs +0 -224
- package/dist/agent/tests/agentConfig.test.d.ts +0 -1
- package/dist/agent/tests/agentConfig.test.js +0 -218
- package/dist/agent/tests/agentLoader.test.cjs +0 -335
- package/dist/agent/tests/agentLoader.test.d.ts +0 -1
- package/dist/agent/tests/agentLoader.test.js +0 -329
- package/dist/agent/tests/backgroundTerminal.test.cjs +0 -70
- package/dist/agent/tests/backgroundTerminal.test.d.ts +0 -1
- package/dist/agent/tests/backgroundTerminal.test.js +0 -64
- package/dist/agent/tests/browserControlHelpers.test.cjs +0 -35
- package/dist/agent/tests/browserControlHelpers.test.d.ts +0 -1
- package/dist/agent/tests/browserControlHelpers.test.js +0 -29
- package/dist/agent/tests/browserControlTool.test.cjs +0 -2117
- package/dist/agent/tests/browserControlTool.test.d.ts +0 -1
- package/dist/agent/tests/browserControlTool.test.js +0 -2111
- package/dist/agent/tests/commandExecuteTool.test.cjs +0 -29
- package/dist/agent/tests/commandExecuteTool.test.d.ts +0 -1
- package/dist/agent/tests/commandExecuteTool.test.js +0 -23
- package/dist/agent/tests/internet_search.test.cjs +0 -107
- package/dist/agent/tests/internet_search.test.d.ts +0 -1
- package/dist/agent/tests/internet_search.test.js +0 -101
- package/dist/agent/tests/mcpClientManager.test.cjs +0 -290
- package/dist/agent/tests/mcpClientManager.test.d.ts +0 -1
- package/dist/agent/tests/mcpClientManager.test.js +0 -284
- package/dist/agent/tests/mcpResourceTools.test.cjs +0 -101
- package/dist/agent/tests/mcpResourceTools.test.d.ts +0 -1
- package/dist/agent/tests/mcpResourceTools.test.js +0 -95
- package/dist/agent/tests/modelFactory.test.cjs +0 -190
- package/dist/agent/tests/modelFactory.test.d.ts +0 -1
- package/dist/agent/tests/modelFactory.test.js +0 -184
- package/dist/agent/tests/terminalSessionManager.test.cjs +0 -121
- package/dist/agent/tests/terminalSessionManager.test.d.ts +0 -1
- package/dist/agent/tests/terminalSessionManager.test.js +0 -115
- package/dist/agent/tests/test-agent-loader.cjs +0 -33
- package/dist/agent/tests/test-agent-loader.d.ts +0 -1
- package/dist/agent/tests/test-agent-loader.js +0 -27
- package/dist/agent/tests/test-subagent-loading.cjs +0 -99
- package/dist/agent/tests/test-subagent-loading.d.ts +0 -1
- package/dist/agent/tests/test-subagent-loading.js +0 -93
- package/dist/agent/tests/toolRegistry.test.cjs +0 -147
- package/dist/agent/tests/toolRegistry.test.d.ts +0 -1
- package/dist/agent/tests/toolRegistry.test.js +0 -141
- package/dist/agent/tests/uiRegistryTools.test.cjs +0 -114
- package/dist/agent/tests/uiRegistryTools.test.d.ts +0 -1
- package/dist/agent/tests/uiRegistryTools.test.js +0 -105
- package/dist/agent/tests/xaiImageModel.test.cjs +0 -194
- package/dist/agent/tests/xaiImageModel.test.d.ts +0 -1
- package/dist/agent/tests/xaiImageModel.test.js +0 -188
- package/dist/tests/additionalMessageMiddleware.test.cjs +0 -216
- package/dist/tests/additionalMessageMiddleware.test.d.ts +0 -1
- package/dist/tests/additionalMessageMiddleware.test.js +0 -188
- package/dist/tests/agent-config-voice.test.cjs +0 -25
- package/dist/tests/agent-config-voice.test.d.ts +0 -1
- package/dist/tests/agent-config-voice.test.js +0 -19
- package/dist/tests/agentInvokerAttachments.test.cjs +0 -190
- package/dist/tests/agentInvokerAttachments.test.d.ts +0 -1
- package/dist/tests/agentInvokerAttachments.test.js +0 -184
- package/dist/tests/agentInvokerSummarization.test.cjs +0 -613
- package/dist/tests/agentInvokerSummarization.test.d.ts +0 -1
- package/dist/tests/agentInvokerSummarization.test.js +0 -607
- package/dist/tests/agentInvokerTokenUsage.test.cjs +0 -124
- package/dist/tests/agentInvokerTokenUsage.test.d.ts +0 -1
- package/dist/tests/agentInvokerTokenUsage.test.js +0 -118
- package/dist/tests/agentInvokerWorkdir.test.cjs +0 -150
- package/dist/tests/agentInvokerWorkdir.test.d.ts +0 -1
- package/dist/tests/agentInvokerWorkdir.test.js +0 -122
- package/dist/tests/agents-api.test.cjs +0 -324
- package/dist/tests/agents-api.test.d.ts +0 -1
- package/dist/tests/agents-api.test.js +0 -318
- package/dist/tests/attachments-utils.test.cjs +0 -46
- package/dist/tests/attachments-utils.test.d.ts +0 -1
- package/dist/tests/attachments-utils.test.js +0 -40
- package/dist/tests/browser-command.test.cjs +0 -264
- package/dist/tests/browser-command.test.d.ts +0 -1
- package/dist/tests/browser-command.test.js +0 -258
- package/dist/tests/browser-relay-server.test.cjs +0 -20
- package/dist/tests/browser-relay-server.test.d.ts +0 -1
- package/dist/tests/browser-relay-server.test.js +0 -14
- package/dist/tests/bunSqliteAdapter.test.cjs +0 -265
- package/dist/tests/bunSqliteAdapter.test.d.ts +0 -1
- package/dist/tests/bunSqliteAdapter.test.js +0 -259
- package/dist/tests/candleRange.test.cjs +0 -48
- package/dist/tests/candleRange.test.d.ts +0 -1
- package/dist/tests/candleRange.test.js +0 -42
- package/dist/tests/cli-config-loader.test.cjs +0 -532
- package/dist/tests/cli-config-loader.test.d.ts +0 -1
- package/dist/tests/cli-config-loader.test.js +0 -526
- package/dist/tests/cli-config-warnings.test.cjs +0 -94
- package/dist/tests/cli-config-warnings.test.d.ts +0 -1
- package/dist/tests/cli-config-warnings.test.js +0 -88
- package/dist/tests/cli-init.test.cjs +0 -225
- package/dist/tests/cli-init.test.d.ts +0 -1
- package/dist/tests/cli-init.test.js +0 -219
- package/dist/tests/cli-workspace-root.test.cjs +0 -114
- package/dist/tests/cli-workspace-root.test.d.ts +0 -1
- package/dist/tests/cli-workspace-root.test.js +0 -108
- package/dist/tests/codex-credentials-precedence.test.cjs +0 -94
- package/dist/tests/codex-credentials-precedence.test.d.ts +0 -1
- package/dist/tests/codex-credentials-precedence.test.js +0 -88
- package/dist/tests/codex-provider.test.cjs +0 -383
- package/dist/tests/codex-provider.test.d.ts +0 -1
- package/dist/tests/codex-provider.test.js +0 -377
- package/dist/tests/config-json-schema.test.cjs +0 -37
- package/dist/tests/config-json-schema.test.d.ts +0 -1
- package/dist/tests/config-json-schema.test.js +0 -31
- package/dist/tests/discord-adapter.test.cjs +0 -89
- package/dist/tests/discord-adapter.test.d.ts +0 -1
- package/dist/tests/discord-adapter.test.js +0 -83
- package/dist/tests/falRuntime.test.cjs +0 -78
- package/dist/tests/falRuntime.test.d.ts +0 -1
- package/dist/tests/falRuntime.test.js +0 -72
- package/dist/tests/falSummary.test.cjs +0 -51
- package/dist/tests/falSummary.test.d.ts +0 -1
- package/dist/tests/falSummary.test.js +0 -45
- package/dist/tests/fs-api.test.cjs +0 -138
- package/dist/tests/fs-api.test.d.ts +0 -1
- package/dist/tests/fs-api.test.js +0 -132
- package/dist/tests/gateway-command-workspace.test.cjs +0 -150
- package/dist/tests/gateway-command-workspace.test.d.ts +0 -1
- package/dist/tests/gateway-command-workspace.test.js +0 -144
- package/dist/tests/gateway-http-security.test.cjs +0 -318
- package/dist/tests/gateway-http-security.test.d.ts +0 -1
- package/dist/tests/gateway-http-security.test.js +0 -312
- package/dist/tests/gateway-node-mode.test.cjs +0 -174
- package/dist/tests/gateway-node-mode.test.d.ts +0 -1
- package/dist/tests/gateway-node-mode.test.js +0 -168
- package/dist/tests/gateway-origin-policy.test.cjs +0 -82
- package/dist/tests/gateway-origin-policy.test.d.ts +0 -1
- package/dist/tests/gateway-origin-policy.test.js +0 -76
- package/dist/tests/gateway-request-execution-overrides.test.cjs +0 -42
- package/dist/tests/gateway-request-execution-overrides.test.d.ts +0 -1
- package/dist/tests/gateway-request-execution-overrides.test.js +0 -36
- package/dist/tests/gateway.test.cjs +0 -700
- package/dist/tests/gateway.test.d.ts +0 -1
- package/dist/tests/gateway.test.js +0 -694
- package/dist/tests/hooks-matcher.test.cjs +0 -309
- package/dist/tests/hooks-matcher.test.d.ts +0 -1
- package/dist/tests/hooks-matcher.test.js +0 -303
- package/dist/tests/hooks-merger.test.cjs +0 -528
- package/dist/tests/hooks-merger.test.d.ts +0 -1
- package/dist/tests/hooks-merger.test.js +0 -522
- package/dist/tests/imagePersistence.test.cjs +0 -169
- package/dist/tests/imagePersistence.test.d.ts +0 -1
- package/dist/tests/imagePersistence.test.js +0 -163
- package/dist/tests/integration/agent-invocation.integration.test.cjs +0 -264
- package/dist/tests/integration/agent-invocation.integration.test.d.ts +0 -1
- package/dist/tests/integration/agent-invocation.integration.test.js +0 -258
- package/dist/tests/integration/finnhub-candles.integration.test.cjs +0 -98
- package/dist/tests/integration/finnhub-candles.integration.test.d.ts +0 -1
- package/dist/tests/integration/finnhub-candles.integration.test.js +0 -92
- package/dist/tests/integration/summarization-e2e.integration.test.cjs +0 -127
- package/dist/tests/integration/summarization-e2e.integration.test.d.ts +0 -1
- package/dist/tests/integration/summarization-e2e.integration.test.js +0 -121
- package/dist/tests/logger.test.cjs +0 -353
- package/dist/tests/logger.test.d.ts +0 -1
- package/dist/tests/logger.test.js +0 -347
- package/dist/tests/mediaCompatibilityMiddleware.test.cjs +0 -106
- package/dist/tests/mediaCompatibilityMiddleware.test.d.ts +0 -1
- package/dist/tests/mediaCompatibilityMiddleware.test.js +0 -100
- package/dist/tests/node-tools.test.cjs +0 -77
- package/dist/tests/node-tools.test.d.ts +0 -1
- package/dist/tests/node-tools.test.js +0 -71
- package/dist/tests/nodes-api.test.cjs +0 -86
- package/dist/tests/nodes-api.test.d.ts +0 -1
- package/dist/tests/nodes-api.test.js +0 -80
- package/dist/tests/outputManagerContextSummarized.test.cjs +0 -43
- package/dist/tests/outputManagerContextSummarized.test.d.ts +0 -1
- package/dist/tests/outputManagerContextSummarized.test.js +0 -37
- package/dist/tests/provider-command-codex.test.cjs +0 -57
- package/dist/tests/provider-command-codex.test.d.ts +0 -1
- package/dist/tests/provider-command-codex.test.js +0 -51
- package/dist/tests/routines-api.test.cjs +0 -107
- package/dist/tests/routines-api.test.d.ts +0 -1
- package/dist/tests/routines-api.test.js +0 -101
- package/dist/tests/run-terminal-bench-official-script.test.cjs +0 -61
- package/dist/tests/run-terminal-bench-official-script.test.d.ts +0 -1
- package/dist/tests/run-terminal-bench-official-script.test.js +0 -55
- package/dist/tests/sessionManager-uionly.test.cjs +0 -50
- package/dist/tests/sessionManager-uionly.test.d.ts +0 -1
- package/dist/tests/sessionManager-uionly.test.js +0 -44
- package/dist/tests/sessionMessageAttachments.test.cjs +0 -197
- package/dist/tests/sessionMessageAttachments.test.d.ts +0 -1
- package/dist/tests/sessionMessageAttachments.test.js +0 -191
- package/dist/tests/sessionMessageRole.test.cjs +0 -44
- package/dist/tests/sessionMessageRole.test.d.ts +0 -1
- package/dist/tests/sessionMessageRole.test.js +0 -38
- package/dist/tests/sessionStateMessages.test.cjs +0 -236
- package/dist/tests/sessionStateMessages.test.d.ts +0 -1
- package/dist/tests/sessionStateMessages.test.js +0 -230
- package/dist/tests/sessions-api.test.cjs +0 -250
- package/dist/tests/sessions-api.test.d.ts +0 -1
- package/dist/tests/sessions-api.test.js +0 -244
- package/dist/tests/skill-activation.test.cjs +0 -86
- package/dist/tests/skill-activation.test.d.ts +0 -1
- package/dist/tests/skill-activation.test.js +0 -80
- package/dist/tests/skill-metadata.test.cjs +0 -119
- package/dist/tests/skill-metadata.test.d.ts +0 -1
- package/dist/tests/skill-metadata.test.js +0 -113
- package/dist/tests/skill-repository.test.cjs +0 -469
- package/dist/tests/skill-repository.test.d.ts +0 -1
- package/dist/tests/skill-repository.test.js +0 -463
- package/dist/tests/skill-security-scanner.test.cjs +0 -126
- package/dist/tests/skill-security-scanner.test.d.ts +0 -1
- package/dist/tests/skill-security-scanner.test.js +0 -120
- package/dist/tests/sms-api.test.cjs +0 -183
- package/dist/tests/sms-api.test.d.ts +0 -1
- package/dist/tests/sms-api.test.js +0 -177
- package/dist/tests/sms-commands.test.cjs +0 -90
- package/dist/tests/sms-commands.test.d.ts +0 -1
- package/dist/tests/sms-commands.test.js +0 -84
- package/dist/tests/sms-policy-store.test.cjs +0 -69
- package/dist/tests/sms-policy-store.test.d.ts +0 -1
- package/dist/tests/sms-policy-store.test.js +0 -63
- package/dist/tests/teams-adapter.test.cjs +0 -58
- package/dist/tests/teams-adapter.test.d.ts +0 -1
- package/dist/tests/teams-adapter.test.js +0 -52
- package/dist/tests/technicalIndicators.test.cjs +0 -82
- package/dist/tests/technicalIndicators.test.d.ts +0 -1
- package/dist/tests/technicalIndicators.test.js +0 -76
- package/dist/tests/terminal-bench-adapters-helpers.test.cjs +0 -64
- package/dist/tests/terminal-bench-adapters-helpers.test.d.ts +0 -1
- package/dist/tests/terminal-bench-adapters-helpers.test.js +0 -58
- package/dist/tests/terminal-bench-cleanup.test.cjs +0 -93
- package/dist/tests/terminal-bench-cleanup.test.d.ts +0 -1
- package/dist/tests/terminal-bench-cleanup.test.js +0 -87
- package/dist/tests/terminal-bench-config.test.cjs +0 -62
- package/dist/tests/terminal-bench-config.test.d.ts +0 -1
- package/dist/tests/terminal-bench-config.test.js +0 -56
- package/dist/tests/terminal-bench-official.test.cjs +0 -194
- package/dist/tests/terminal-bench-official.test.d.ts +0 -1
- package/dist/tests/terminal-bench-official.test.js +0 -188
- package/dist/tests/terminal-bench-runner.test.cjs +0 -82
- package/dist/tests/terminal-bench-runner.test.d.ts +0 -1
- package/dist/tests/terminal-bench-runner.test.js +0 -76
- package/dist/tests/terminal-bench-scoring.test.cjs +0 -128
- package/dist/tests/terminal-bench-scoring.test.d.ts +0 -1
- package/dist/tests/terminal-bench-scoring.test.js +0 -122
- package/dist/tests/terminalProbe.test.cjs +0 -45
- package/dist/tests/terminalProbe.test.d.ts +0 -1
- package/dist/tests/terminalProbe.test.js +0 -39
- package/dist/tests/terminalProbeAuth.test.cjs +0 -85
- package/dist/tests/terminalProbeAuth.test.d.ts +0 -1
- package/dist/tests/terminalProbeAuth.test.js +0 -79
- package/dist/tests/toolDisplayHelpers.test.cjs +0 -46
- package/dist/tests/toolDisplayHelpers.test.d.ts +0 -1
- package/dist/tests/toolDisplayHelpers.test.js +0 -40
- package/dist/tests/uv.test.cjs +0 -47
- package/dist/tests/uv.test.d.ts +0 -1
- package/dist/tests/uv.test.js +0 -41
- package/dist/tests/voice-config.test.cjs +0 -35
- package/dist/tests/voice-config.test.d.ts +0 -1
- package/dist/tests/voice-config.test.js +0 -29
- package/dist/tests/websocket-transport.test.cjs +0 -31
- package/dist/tests/websocket-transport.test.d.ts +0 -1
- package/dist/tests/websocket-transport.test.js +0 -25
- package/dist/tests/yahooCandles.test.cjs +0 -111
- package/dist/tests/yahooCandles.test.d.ts +0 -1
- package/dist/tests/yahooCandles.test.js +0 -105
- package/dist/tools/finance/optionsAnalytics.test.cjs +0 -128
- package/dist/tools/finance/optionsAnalytics.test.d.ts +0 -1
- package/dist/tools/finance/optionsAnalytics.test.js +0 -122
- package/dist/webui/assets/index-BMf95nv5.js +0 -215
- package/dist/webui/assets/index-DhJQ8Mbn.css +0 -11
- package/dist/webui/assets/wingman_logo-Cogyt3qm.webp +0 -0
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { MCPClientManager } from "../config/mcpClientManager.js";
|
|
3
|
-
const testLogger = {
|
|
4
|
-
debug: ()=>{},
|
|
5
|
-
info: ()=>{},
|
|
6
|
-
warn: ()=>{},
|
|
7
|
-
error: ()=>{}
|
|
8
|
-
};
|
|
9
|
-
const getClientConfig = (manager)=>manager.buildClientConfig();
|
|
10
|
-
describe("MCPClientManager runtime env", ()=>{
|
|
11
|
-
it("injects workdir for stdio servers", ()=>{
|
|
12
|
-
const executionWorkspace = "/tmp/wingman-workdir";
|
|
13
|
-
const configs = [
|
|
14
|
-
{
|
|
15
|
-
servers: [
|
|
16
|
-
{
|
|
17
|
-
name: "fal-ai",
|
|
18
|
-
transport: "stdio",
|
|
19
|
-
command: "bun",
|
|
20
|
-
args: [
|
|
21
|
-
"run",
|
|
22
|
-
"src/tools/mcp-fal-ai.ts"
|
|
23
|
-
],
|
|
24
|
-
env: {
|
|
25
|
-
EXISTING: "value"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
const manager = new MCPClientManager(configs, testLogger, {
|
|
32
|
-
executionWorkspace
|
|
33
|
-
});
|
|
34
|
-
const clientConfig = getClientConfig(manager);
|
|
35
|
-
const env = clientConfig.mcpServers["fal-ai"].env;
|
|
36
|
-
expect(env.EXISTING).toBe("value");
|
|
37
|
-
expect(env.WINGMAN_WORKDIR).toBe(executionWorkspace);
|
|
38
|
-
});
|
|
39
|
-
it("does not inject workdir when no execution workspace is provided", ()=>{
|
|
40
|
-
const configs = [
|
|
41
|
-
{
|
|
42
|
-
servers: [
|
|
43
|
-
{
|
|
44
|
-
name: "fal-ai",
|
|
45
|
-
transport: "stdio",
|
|
46
|
-
command: "bun",
|
|
47
|
-
args: [
|
|
48
|
-
"run",
|
|
49
|
-
"src/tools/mcp-fal-ai.ts"
|
|
50
|
-
],
|
|
51
|
-
env: {
|
|
52
|
-
EXISTING: "value"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
];
|
|
58
|
-
const manager = new MCPClientManager(configs, testLogger);
|
|
59
|
-
const clientConfig = getClientConfig(manager);
|
|
60
|
-
const env = clientConfig.mcpServers["fal-ai"].env;
|
|
61
|
-
expect(env.EXISTING).toBe("value");
|
|
62
|
-
expect(env.WINGMAN_WORKDIR).toBeUndefined();
|
|
63
|
-
});
|
|
64
|
-
it("resolves env placeholders", ()=>{
|
|
65
|
-
const original = process.env.FAL_API_KEY;
|
|
66
|
-
process.env.FAL_API_KEY = "test-key";
|
|
67
|
-
try {
|
|
68
|
-
const configs = [
|
|
69
|
-
{
|
|
70
|
-
servers: [
|
|
71
|
-
{
|
|
72
|
-
name: "fal-ai",
|
|
73
|
-
transport: "stdio",
|
|
74
|
-
command: "bun",
|
|
75
|
-
args: [
|
|
76
|
-
"run",
|
|
77
|
-
"src/tools/mcp-fal-ai.ts"
|
|
78
|
-
],
|
|
79
|
-
env: {
|
|
80
|
-
FAL_API_KEY: "${FAL_API_KEY}"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
];
|
|
86
|
-
const manager = new MCPClientManager(configs, testLogger);
|
|
87
|
-
const clientConfig = getClientConfig(manager);
|
|
88
|
-
expect(clientConfig.mcpServers["fal-ai"].env.FAL_API_KEY).toBe("test-key");
|
|
89
|
-
} finally{
|
|
90
|
-
if ("string" == typeof original) process.env.FAL_API_KEY = original;
|
|
91
|
-
else delete process.env.FAL_API_KEY;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
it("passes through per-server default tool timeout", ()=>{
|
|
95
|
-
const configs = [
|
|
96
|
-
{
|
|
97
|
-
servers: [
|
|
98
|
-
{
|
|
99
|
-
name: "fal-ai",
|
|
100
|
-
transport: "stdio",
|
|
101
|
-
command: "bun",
|
|
102
|
-
args: [
|
|
103
|
-
"run",
|
|
104
|
-
"src/tools/mcp-fal-ai.ts"
|
|
105
|
-
],
|
|
106
|
-
defaultToolTimeout: 300000,
|
|
107
|
-
env: {
|
|
108
|
-
EXISTING: "value"
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
];
|
|
114
|
-
const manager = new MCPClientManager(configs, testLogger);
|
|
115
|
-
const clientConfig = getClientConfig(manager);
|
|
116
|
-
expect(clientConfig.mcpServers["fal-ai"].defaultToolTimeout).toBe(300000);
|
|
117
|
-
});
|
|
118
|
-
it("wraps stdio servers with proxy command when enabled", ()=>{
|
|
119
|
-
const configs = [
|
|
120
|
-
{
|
|
121
|
-
servers: [
|
|
122
|
-
{
|
|
123
|
-
name: "fal-ai",
|
|
124
|
-
transport: "stdio",
|
|
125
|
-
command: "bun",
|
|
126
|
-
args: [
|
|
127
|
-
"run",
|
|
128
|
-
"src/tools/mcp-fal-ai.ts"
|
|
129
|
-
],
|
|
130
|
-
env: {
|
|
131
|
-
EXISTING: "value"
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
];
|
|
137
|
-
const manager = new MCPClientManager(configs, testLogger, {
|
|
138
|
-
proxyConfig: {
|
|
139
|
-
enabled: true,
|
|
140
|
-
command: "uvx",
|
|
141
|
-
baseArgs: [
|
|
142
|
-
"invariant-gateway@latest",
|
|
143
|
-
"mcp"
|
|
144
|
-
],
|
|
145
|
-
projectName: "wingman-gateway",
|
|
146
|
-
apiKey: "test-api-key",
|
|
147
|
-
apiUrl: "https://explorer.invariantlabs.ai"
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
const clientConfig = getClientConfig(manager);
|
|
151
|
-
const server = clientConfig.mcpServers["fal-ai"];
|
|
152
|
-
expect(server.command).toBe("uvx");
|
|
153
|
-
expect(server.args).toEqual([
|
|
154
|
-
"invariant-gateway@latest",
|
|
155
|
-
"mcp",
|
|
156
|
-
"--project-name",
|
|
157
|
-
"wingman-gateway",
|
|
158
|
-
"--exec",
|
|
159
|
-
"bun",
|
|
160
|
-
"run",
|
|
161
|
-
"src/tools/mcp-fal-ai.ts"
|
|
162
|
-
]);
|
|
163
|
-
expect(server.env.EXISTING).toBe("value");
|
|
164
|
-
expect(server.env.INVARIANT_API_KEY).toBe("test-api-key");
|
|
165
|
-
expect(server.env.INVARIANT_API_URL).toBe("https://explorer.invariantlabs.ai");
|
|
166
|
-
expect(server.env.GUARDRAILS_API_URL).toBe("https://explorer.invariantlabs.ai");
|
|
167
|
-
});
|
|
168
|
-
it("keeps MCP multimodal output handling in artifact mode", ()=>{
|
|
169
|
-
const configs = [
|
|
170
|
-
{
|
|
171
|
-
servers: [
|
|
172
|
-
{
|
|
173
|
-
name: "fal-ai",
|
|
174
|
-
transport: "stdio",
|
|
175
|
-
command: "bun",
|
|
176
|
-
args: [
|
|
177
|
-
"run",
|
|
178
|
-
"src/tools/mcp-fal-ai.ts"
|
|
179
|
-
]
|
|
180
|
-
}
|
|
181
|
-
]
|
|
182
|
-
}
|
|
183
|
-
];
|
|
184
|
-
const manager = new MCPClientManager(configs, testLogger);
|
|
185
|
-
const clientConfig = getClientConfig(manager);
|
|
186
|
-
expect(clientConfig.outputHandling).toEqual({
|
|
187
|
-
image: "artifact",
|
|
188
|
-
audio: "artifact",
|
|
189
|
-
resource: "artifact"
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
it("lists resources from MCP client", async ()=>{
|
|
193
|
-
const listResources = vi.fn().mockResolvedValue({
|
|
194
|
-
fal: [
|
|
195
|
-
{
|
|
196
|
-
uri: "fal://jobs/123",
|
|
197
|
-
name: "Job 123",
|
|
198
|
-
description: "Generated asset",
|
|
199
|
-
mimeType: "application/json"
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
});
|
|
203
|
-
const manager = new MCPClientManager([], testLogger);
|
|
204
|
-
manager.client = {
|
|
205
|
-
listResources
|
|
206
|
-
};
|
|
207
|
-
const result = await manager.listResources([
|
|
208
|
-
"fal"
|
|
209
|
-
]);
|
|
210
|
-
expect(listResources).toHaveBeenCalledWith("fal");
|
|
211
|
-
expect(result).toEqual({
|
|
212
|
-
fal: [
|
|
213
|
-
{
|
|
214
|
-
uri: "fal://jobs/123",
|
|
215
|
-
name: "Job 123",
|
|
216
|
-
description: "Generated asset",
|
|
217
|
-
mimeType: "application/json"
|
|
218
|
-
}
|
|
219
|
-
]
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
it("lists resource templates from MCP client", async ()=>{
|
|
223
|
-
const listResourceTemplates = vi.fn().mockResolvedValue({
|
|
224
|
-
fal: [
|
|
225
|
-
{
|
|
226
|
-
uriTemplate: "fal://jobs/{jobId}",
|
|
227
|
-
name: "Fal Job",
|
|
228
|
-
description: "Job by ID",
|
|
229
|
-
mimeType: "application/json"
|
|
230
|
-
}
|
|
231
|
-
]
|
|
232
|
-
});
|
|
233
|
-
const manager = new MCPClientManager([], testLogger);
|
|
234
|
-
manager.client = {
|
|
235
|
-
listResourceTemplates
|
|
236
|
-
};
|
|
237
|
-
const result = await manager.listResourceTemplates([
|
|
238
|
-
"fal"
|
|
239
|
-
]);
|
|
240
|
-
expect(listResourceTemplates).toHaveBeenCalledWith("fal");
|
|
241
|
-
expect(result).toEqual({
|
|
242
|
-
fal: [
|
|
243
|
-
{
|
|
244
|
-
uriTemplate: "fal://jobs/{jobId}",
|
|
245
|
-
name: "Fal Job",
|
|
246
|
-
description: "Job by ID",
|
|
247
|
-
mimeType: "application/json"
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
it("reads resources from MCP client", async ()=>{
|
|
253
|
-
const readResource = vi.fn().mockResolvedValue([
|
|
254
|
-
{
|
|
255
|
-
uri: "fal://jobs/123",
|
|
256
|
-
mimeType: "application/json",
|
|
257
|
-
text: '{"status":"completed"}'
|
|
258
|
-
}
|
|
259
|
-
]);
|
|
260
|
-
const manager = new MCPClientManager([], testLogger);
|
|
261
|
-
manager.client = {
|
|
262
|
-
readResource
|
|
263
|
-
};
|
|
264
|
-
const result = await manager.readResource("fal", "fal://jobs/123");
|
|
265
|
-
expect(readResource).toHaveBeenCalledWith("fal", "fal://jobs/123");
|
|
266
|
-
expect(result).toEqual([
|
|
267
|
-
{
|
|
268
|
-
uri: "fal://jobs/123",
|
|
269
|
-
mimeType: "application/json",
|
|
270
|
-
text: '{"status":"completed"}'
|
|
271
|
-
}
|
|
272
|
-
]);
|
|
273
|
-
});
|
|
274
|
-
it("calls close on cleanup", async ()=>{
|
|
275
|
-
const close = vi.fn().mockResolvedValue(void 0);
|
|
276
|
-
const manager = new MCPClientManager([], testLogger);
|
|
277
|
-
manager.client = {
|
|
278
|
-
close
|
|
279
|
-
};
|
|
280
|
-
await manager.cleanup();
|
|
281
|
-
expect(close).toHaveBeenCalledTimes(1);
|
|
282
|
-
expect(manager.client).toBeNull();
|
|
283
|
-
});
|
|
284
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_exports__ = {};
|
|
3
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
4
|
-
const mcp_resources_cjs_namespaceObject = require("../tools/mcp_resources.cjs");
|
|
5
|
-
const createManagerStub = ()=>{
|
|
6
|
-
const listResources = external_vitest_namespaceObject.vi.fn();
|
|
7
|
-
const listResourceTemplates = external_vitest_namespaceObject.vi.fn();
|
|
8
|
-
const readResource = external_vitest_namespaceObject.vi.fn();
|
|
9
|
-
const manager = {
|
|
10
|
-
listResources,
|
|
11
|
-
listResourceTemplates,
|
|
12
|
-
readResource
|
|
13
|
-
};
|
|
14
|
-
return {
|
|
15
|
-
manager,
|
|
16
|
-
listResources,
|
|
17
|
-
listResourceTemplates,
|
|
18
|
-
readResource
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
(0, external_vitest_namespaceObject.describe)("mcp resource tools", ()=>{
|
|
22
|
-
(0, external_vitest_namespaceObject.it)("lists resources and templates", async ()=>{
|
|
23
|
-
const { manager, listResources, listResourceTemplates } = createManagerStub();
|
|
24
|
-
listResources.mockResolvedValue({
|
|
25
|
-
fal: [
|
|
26
|
-
{
|
|
27
|
-
uri: "fal://jobs/1",
|
|
28
|
-
name: "Job 1",
|
|
29
|
-
mimeType: "application/json"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
});
|
|
33
|
-
listResourceTemplates.mockResolvedValue({
|
|
34
|
-
fal: [
|
|
35
|
-
{
|
|
36
|
-
uriTemplate: "fal://jobs/{id}",
|
|
37
|
-
name: "Job by id"
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
});
|
|
41
|
-
const [listTool] = (0, mcp_resources_cjs_namespaceObject.createMCPResourceTools)(manager);
|
|
42
|
-
const output = await listTool.invoke({
|
|
43
|
-
includeTemplates: true
|
|
44
|
-
});
|
|
45
|
-
const parsed = JSON.parse(String(output));
|
|
46
|
-
(0, external_vitest_namespaceObject.expect)(listResources).toHaveBeenCalledWith([]);
|
|
47
|
-
(0, external_vitest_namespaceObject.expect)(listResourceTemplates).toHaveBeenCalledWith([]);
|
|
48
|
-
(0, external_vitest_namespaceObject.expect)(parsed.resourceCount).toBe(1);
|
|
49
|
-
(0, external_vitest_namespaceObject.expect)(parsed.resourceTemplateCount).toBe(1);
|
|
50
|
-
(0, external_vitest_namespaceObject.expect)(parsed.resources.fal[0].uri).toBe("fal://jobs/1");
|
|
51
|
-
});
|
|
52
|
-
(0, external_vitest_namespaceObject.it)("reads resource content without inlining binary blobs by default", async ()=>{
|
|
53
|
-
const { manager, readResource } = createManagerStub();
|
|
54
|
-
readResource.mockResolvedValue([
|
|
55
|
-
{
|
|
56
|
-
uri: "fal://jobs/1",
|
|
57
|
-
mimeType: "application/json",
|
|
58
|
-
text: "abcdefghijklmnopqrstuvwxyz",
|
|
59
|
-
blob: "YWJjZA=="
|
|
60
|
-
}
|
|
61
|
-
]);
|
|
62
|
-
const tools = (0, mcp_resources_cjs_namespaceObject.createMCPResourceTools)(manager);
|
|
63
|
-
const readTool = tools.find((entry)=>"mcp_read_resource" === entry.name);
|
|
64
|
-
if (!readTool) throw new Error("mcp_read_resource tool missing");
|
|
65
|
-
const output = await readTool.invoke({
|
|
66
|
-
server: "fal",
|
|
67
|
-
uri: "fal://jobs/1",
|
|
68
|
-
maxTextChars: 10
|
|
69
|
-
});
|
|
70
|
-
const parsed = JSON.parse(String(output));
|
|
71
|
-
(0, external_vitest_namespaceObject.expect)(readResource).toHaveBeenCalledWith("fal", "fal://jobs/1");
|
|
72
|
-
(0, external_vitest_namespaceObject.expect)(parsed.content[0].text).toBe("abcdefghij");
|
|
73
|
-
(0, external_vitest_namespaceObject.expect)(parsed.content[0].truncated).toBe(true);
|
|
74
|
-
(0, external_vitest_namespaceObject.expect)(parsed.content[0].blobLength).toBe(8);
|
|
75
|
-
(0, external_vitest_namespaceObject.expect)(parsed.content[0].blob).toBeUndefined();
|
|
76
|
-
});
|
|
77
|
-
(0, external_vitest_namespaceObject.it)("can include binary blobs when requested", async ()=>{
|
|
78
|
-
const { manager, readResource } = createManagerStub();
|
|
79
|
-
readResource.mockResolvedValue([
|
|
80
|
-
{
|
|
81
|
-
uri: "fal://jobs/2",
|
|
82
|
-
mimeType: "image/png",
|
|
83
|
-
blob: "YWJjZA=="
|
|
84
|
-
}
|
|
85
|
-
]);
|
|
86
|
-
const tools = (0, mcp_resources_cjs_namespaceObject.createMCPResourceTools)(manager);
|
|
87
|
-
const readTool = tools.find((entry)=>"mcp_read_resource" === entry.name);
|
|
88
|
-
if (!readTool) throw new Error("mcp_read_resource tool missing");
|
|
89
|
-
const output = await readTool.invoke({
|
|
90
|
-
server: "fal",
|
|
91
|
-
uri: "fal://jobs/2",
|
|
92
|
-
includeBinary: true
|
|
93
|
-
});
|
|
94
|
-
const parsed = JSON.parse(String(output));
|
|
95
|
-
(0, external_vitest_namespaceObject.expect)(parsed.content[0].blob).toBe("YWJjZA==");
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
99
|
-
Object.defineProperty(exports, '__esModule', {
|
|
100
|
-
value: true
|
|
101
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { createMCPResourceTools } from "../tools/mcp_resources.js";
|
|
3
|
-
const createManagerStub = ()=>{
|
|
4
|
-
const listResources = vi.fn();
|
|
5
|
-
const listResourceTemplates = vi.fn();
|
|
6
|
-
const readResource = vi.fn();
|
|
7
|
-
const manager = {
|
|
8
|
-
listResources,
|
|
9
|
-
listResourceTemplates,
|
|
10
|
-
readResource
|
|
11
|
-
};
|
|
12
|
-
return {
|
|
13
|
-
manager,
|
|
14
|
-
listResources,
|
|
15
|
-
listResourceTemplates,
|
|
16
|
-
readResource
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
describe("mcp resource tools", ()=>{
|
|
20
|
-
it("lists resources and templates", async ()=>{
|
|
21
|
-
const { manager, listResources, listResourceTemplates } = createManagerStub();
|
|
22
|
-
listResources.mockResolvedValue({
|
|
23
|
-
fal: [
|
|
24
|
-
{
|
|
25
|
-
uri: "fal://jobs/1",
|
|
26
|
-
name: "Job 1",
|
|
27
|
-
mimeType: "application/json"
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
});
|
|
31
|
-
listResourceTemplates.mockResolvedValue({
|
|
32
|
-
fal: [
|
|
33
|
-
{
|
|
34
|
-
uriTemplate: "fal://jobs/{id}",
|
|
35
|
-
name: "Job by id"
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
const [listTool] = createMCPResourceTools(manager);
|
|
40
|
-
const output = await listTool.invoke({
|
|
41
|
-
includeTemplates: true
|
|
42
|
-
});
|
|
43
|
-
const parsed = JSON.parse(String(output));
|
|
44
|
-
expect(listResources).toHaveBeenCalledWith([]);
|
|
45
|
-
expect(listResourceTemplates).toHaveBeenCalledWith([]);
|
|
46
|
-
expect(parsed.resourceCount).toBe(1);
|
|
47
|
-
expect(parsed.resourceTemplateCount).toBe(1);
|
|
48
|
-
expect(parsed.resources.fal[0].uri).toBe("fal://jobs/1");
|
|
49
|
-
});
|
|
50
|
-
it("reads resource content without inlining binary blobs by default", async ()=>{
|
|
51
|
-
const { manager, readResource } = createManagerStub();
|
|
52
|
-
readResource.mockResolvedValue([
|
|
53
|
-
{
|
|
54
|
-
uri: "fal://jobs/1",
|
|
55
|
-
mimeType: "application/json",
|
|
56
|
-
text: "abcdefghijklmnopqrstuvwxyz",
|
|
57
|
-
blob: "YWJjZA=="
|
|
58
|
-
}
|
|
59
|
-
]);
|
|
60
|
-
const tools = createMCPResourceTools(manager);
|
|
61
|
-
const readTool = tools.find((entry)=>"mcp_read_resource" === entry.name);
|
|
62
|
-
if (!readTool) throw new Error("mcp_read_resource tool missing");
|
|
63
|
-
const output = await readTool.invoke({
|
|
64
|
-
server: "fal",
|
|
65
|
-
uri: "fal://jobs/1",
|
|
66
|
-
maxTextChars: 10
|
|
67
|
-
});
|
|
68
|
-
const parsed = JSON.parse(String(output));
|
|
69
|
-
expect(readResource).toHaveBeenCalledWith("fal", "fal://jobs/1");
|
|
70
|
-
expect(parsed.content[0].text).toBe("abcdefghij");
|
|
71
|
-
expect(parsed.content[0].truncated).toBe(true);
|
|
72
|
-
expect(parsed.content[0].blobLength).toBe(8);
|
|
73
|
-
expect(parsed.content[0].blob).toBeUndefined();
|
|
74
|
-
});
|
|
75
|
-
it("can include binary blobs when requested", async ()=>{
|
|
76
|
-
const { manager, readResource } = createManagerStub();
|
|
77
|
-
readResource.mockResolvedValue([
|
|
78
|
-
{
|
|
79
|
-
uri: "fal://jobs/2",
|
|
80
|
-
mimeType: "image/png",
|
|
81
|
-
blob: "YWJjZA=="
|
|
82
|
-
}
|
|
83
|
-
]);
|
|
84
|
-
const tools = createMCPResourceTools(manager);
|
|
85
|
-
const readTool = tools.find((entry)=>"mcp_read_resource" === entry.name);
|
|
86
|
-
if (!readTool) throw new Error("mcp_read_resource tool missing");
|
|
87
|
-
const output = await readTool.invoke({
|
|
88
|
-
server: "fal",
|
|
89
|
-
uri: "fal://jobs/2",
|
|
90
|
-
includeBinary: true
|
|
91
|
-
});
|
|
92
|
-
const parsed = JSON.parse(String(output));
|
|
93
|
-
expect(parsed.content[0].blob).toBe("YWJjZA==");
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_exports__ = {};
|
|
3
|
-
const anthropic_namespaceObject = require("@langchain/anthropic");
|
|
4
|
-
const ollama_namespaceObject = require("@langchain/ollama");
|
|
5
|
-
const openai_namespaceObject = require("@langchain/openai");
|
|
6
|
-
const xai_namespaceObject = require("@langchain/xai");
|
|
7
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
8
|
-
const modelFactory_cjs_namespaceObject = require("../config/modelFactory.cjs");
|
|
9
|
-
const xaiImageModel_cjs_namespaceObject = require("../config/xaiImageModel.cjs");
|
|
10
|
-
const originalAnthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
11
|
-
const originalXaiApiKey = process.env.XAI_API_KEY;
|
|
12
|
-
(0, external_vitest_namespaceObject.beforeEach)(()=>{
|
|
13
|
-
process.env.ANTHROPIC_API_KEY = "test-anthropic-api-key";
|
|
14
|
-
process.env.XAI_API_KEY = "test-xai-api-key";
|
|
15
|
-
});
|
|
16
|
-
(0, external_vitest_namespaceObject.afterEach)(()=>{
|
|
17
|
-
if (void 0 === originalAnthropicApiKey) delete process.env.ANTHROPIC_API_KEY;
|
|
18
|
-
else process.env.ANTHROPIC_API_KEY = originalAnthropicApiKey;
|
|
19
|
-
if (void 0 === originalXaiApiKey) return void delete process.env.XAI_API_KEY;
|
|
20
|
-
process.env.XAI_API_KEY = originalXaiApiKey;
|
|
21
|
-
});
|
|
22
|
-
(0, external_vitest_namespaceObject.describe)("ModelFactory", ()=>{
|
|
23
|
-
(0, external_vitest_namespaceObject.describe)("createModel", ()=>{
|
|
24
|
-
(0, external_vitest_namespaceObject.it)("should create an Anthropic model", ()=>{
|
|
25
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("anthropic:claude-opus-4-5");
|
|
26
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(anthropic_namespaceObject.ChatAnthropic);
|
|
27
|
-
});
|
|
28
|
-
(0, external_vitest_namespaceObject.it)("should create an OpenAI model", ()=>{
|
|
29
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("openai:gpt-4o");
|
|
30
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
31
|
-
});
|
|
32
|
-
(0, external_vitest_namespaceObject.it)("should create a Codex model", ()=>{
|
|
33
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("codex:codex-mini-latest");
|
|
34
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
35
|
-
(0, external_vitest_namespaceObject.expect)(model.useResponsesApi).toBe(true);
|
|
36
|
-
(0, external_vitest_namespaceObject.expect)(model.zdrEnabled).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
(0, external_vitest_namespaceObject.it)("should force OpenAI models onto the responses API", ()=>{
|
|
39
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("openai:gpt-5.2-codex");
|
|
40
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
41
|
-
(0, external_vitest_namespaceObject.expect)(model.useResponsesApi).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
(0, external_vitest_namespaceObject.it)("should apply reasoning effort for supported OpenAI reasoning models", ()=>{
|
|
44
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("openai:gpt-5.2-codex", {
|
|
45
|
-
reasoningEffort: "high"
|
|
46
|
-
});
|
|
47
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
48
|
-
(0, external_vitest_namespaceObject.expect)(model.reasoning).toEqual({
|
|
49
|
-
effort: "high"
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
(0, external_vitest_namespaceObject.it)("should ignore reasoning effort for unsupported OpenAI models", ()=>{
|
|
53
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("openai:gpt-4o", {
|
|
54
|
-
reasoningEffort: "medium"
|
|
55
|
-
});
|
|
56
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
57
|
-
(0, external_vitest_namespaceObject.expect)(model.reasoning).toBeUndefined();
|
|
58
|
-
});
|
|
59
|
-
(0, external_vitest_namespaceObject.it)("should map reasoning effort to anthropic thinking budget", ()=>{
|
|
60
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("anthropic:claude-sonnet-4-5", {
|
|
61
|
-
reasoningEffort: "medium"
|
|
62
|
-
});
|
|
63
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(anthropic_namespaceObject.ChatAnthropic);
|
|
64
|
-
(0, external_vitest_namespaceObject.expect)(model.thinking).toEqual({
|
|
65
|
-
type: "enabled",
|
|
66
|
-
budget_tokens: 4096
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
(0, external_vitest_namespaceObject.it)("should create an OpenRouter model", ()=>{
|
|
70
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("openrouter:openai/gpt-4o");
|
|
71
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
72
|
-
});
|
|
73
|
-
(0, external_vitest_namespaceObject.it)("should ignore reasoning effort for unsupported providers", ()=>{
|
|
74
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("openrouter:openai/gpt-5", {
|
|
75
|
-
reasoningEffort: "high"
|
|
76
|
-
});
|
|
77
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
78
|
-
(0, external_vitest_namespaceObject.expect)(model.reasoning).toBeUndefined();
|
|
79
|
-
});
|
|
80
|
-
(0, external_vitest_namespaceObject.it)("should create a Copilot model", ()=>{
|
|
81
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("copilot:gpt-4o");
|
|
82
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
83
|
-
});
|
|
84
|
-
(0, external_vitest_namespaceObject.it)("should create an LMStudio model", ()=>{
|
|
85
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("lmstudio:llama-3.1-8b");
|
|
86
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(openai_namespaceObject.ChatOpenAI);
|
|
87
|
-
});
|
|
88
|
-
(0, external_vitest_namespaceObject.it)("should create an Ollama model", ()=>{
|
|
89
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("ollama:llama3.2");
|
|
90
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(ollama_namespaceObject.ChatOllama);
|
|
91
|
-
(0, external_vitest_namespaceObject.expect)(model.baseUrl).toBe("http://localhost:11434");
|
|
92
|
-
});
|
|
93
|
-
(0, external_vitest_namespaceObject.it)("should allow model names with additional colons", ()=>{
|
|
94
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("ollama:phi4:14b-q8_0");
|
|
95
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(ollama_namespaceObject.ChatOllama);
|
|
96
|
-
});
|
|
97
|
-
(0, external_vitest_namespaceObject.it)("should create native xAI image model for grok-imagine-image", ()=>{
|
|
98
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("xai:grok-imagine-image");
|
|
99
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(xaiImageModel_cjs_namespaceObject.NativeXAIImageModel);
|
|
100
|
-
});
|
|
101
|
-
(0, external_vitest_namespaceObject.it)("should keep text xAI models on ChatXAI", ()=>{
|
|
102
|
-
const model = modelFactory_cjs_namespaceObject.ModelFactory.createModel("xai:grok-beta");
|
|
103
|
-
(0, external_vitest_namespaceObject.expect)(model).toBeInstanceOf(xai_namespaceObject.ChatXAI);
|
|
104
|
-
});
|
|
105
|
-
(0, external_vitest_namespaceObject.it)("should throw error for invalid format (missing colon)", ()=>{
|
|
106
|
-
(0, external_vitest_namespaceObject.expect)(()=>{
|
|
107
|
-
modelFactory_cjs_namespaceObject.ModelFactory.createModel("anthropic-claude-opus");
|
|
108
|
-
}).toThrow(/Invalid model format/);
|
|
109
|
-
});
|
|
110
|
-
(0, external_vitest_namespaceObject.it)("should throw error for invalid format (empty provider)", ()=>{
|
|
111
|
-
(0, external_vitest_namespaceObject.expect)(()=>{
|
|
112
|
-
modelFactory_cjs_namespaceObject.ModelFactory.createModel(":claude-opus-4-5");
|
|
113
|
-
}).toThrow(/Invalid model format/);
|
|
114
|
-
});
|
|
115
|
-
(0, external_vitest_namespaceObject.it)("should throw error for invalid format (empty model)", ()=>{
|
|
116
|
-
(0, external_vitest_namespaceObject.expect)(()=>{
|
|
117
|
-
modelFactory_cjs_namespaceObject.ModelFactory.createModel("anthropic:");
|
|
118
|
-
}).toThrow(/Invalid model format/);
|
|
119
|
-
});
|
|
120
|
-
(0, external_vitest_namespaceObject.it)("should throw error for unsupported provider", ()=>{
|
|
121
|
-
(0, external_vitest_namespaceObject.expect)(()=>{
|
|
122
|
-
modelFactory_cjs_namespaceObject.ModelFactory.createModel("unsupported:model-name");
|
|
123
|
-
}).toThrow(/Unknown model provider/);
|
|
124
|
-
});
|
|
125
|
-
(0, external_vitest_namespaceObject.it)("should be case insensitive for provider names", ()=>{
|
|
126
|
-
const model1 = modelFactory_cjs_namespaceObject.ModelFactory.createModel("Anthropic:claude-opus-4-5");
|
|
127
|
-
const model2 = modelFactory_cjs_namespaceObject.ModelFactory.createModel("ANTHROPIC:claude-opus-4-5");
|
|
128
|
-
(0, external_vitest_namespaceObject.expect)(model1).toBeInstanceOf(anthropic_namespaceObject.ChatAnthropic);
|
|
129
|
-
(0, external_vitest_namespaceObject.expect)(model2).toBeInstanceOf(anthropic_namespaceObject.ChatAnthropic);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
(0, external_vitest_namespaceObject.describe)("validateModelString", ()=>{
|
|
133
|
-
(0, external_vitest_namespaceObject.it)("should validate correct model strings", ()=>{
|
|
134
|
-
const validModels = [
|
|
135
|
-
"anthropic:claude-opus-4-5",
|
|
136
|
-
"openai:gpt-4o",
|
|
137
|
-
"codex:codex-mini-latest",
|
|
138
|
-
"anthropic:claude-sonnet-4-5-20250929",
|
|
139
|
-
"openrouter:openai/gpt-4o",
|
|
140
|
-
"copilot:gpt-4o",
|
|
141
|
-
"lmstudio:llama-3.1-8b",
|
|
142
|
-
"ollama:llama3.2",
|
|
143
|
-
"ollama:phi4:14b-q8_0"
|
|
144
|
-
];
|
|
145
|
-
for (const modelString of validModels){
|
|
146
|
-
const result = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString(modelString);
|
|
147
|
-
(0, external_vitest_namespaceObject.expect)(result.valid).toBe(true);
|
|
148
|
-
(0, external_vitest_namespaceObject.expect)(result.error).toBeUndefined();
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
(0, external_vitest_namespaceObject.it)("should reject invalid format", ()=>{
|
|
152
|
-
const result = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("invalid-format");
|
|
153
|
-
(0, external_vitest_namespaceObject.expect)(result.valid).toBe(false);
|
|
154
|
-
(0, external_vitest_namespaceObject.expect)(result.error).toContain("Invalid format");
|
|
155
|
-
});
|
|
156
|
-
(0, external_vitest_namespaceObject.it)("should reject empty provider", ()=>{
|
|
157
|
-
const result = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString(":model-name");
|
|
158
|
-
(0, external_vitest_namespaceObject.expect)(result.valid).toBe(false);
|
|
159
|
-
(0, external_vitest_namespaceObject.expect)(result.error).toContain("required");
|
|
160
|
-
});
|
|
161
|
-
(0, external_vitest_namespaceObject.it)("should reject empty model", ()=>{
|
|
162
|
-
const result = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("anthropic:");
|
|
163
|
-
(0, external_vitest_namespaceObject.expect)(result.valid).toBe(false);
|
|
164
|
-
(0, external_vitest_namespaceObject.expect)(result.error).toContain("required");
|
|
165
|
-
});
|
|
166
|
-
(0, external_vitest_namespaceObject.it)("should reject unsupported provider", ()=>{
|
|
167
|
-
const result = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("unsupported:model");
|
|
168
|
-
(0, external_vitest_namespaceObject.expect)(result.valid).toBe(false);
|
|
169
|
-
(0, external_vitest_namespaceObject.expect)(result.error).toContain("Unknown provider");
|
|
170
|
-
});
|
|
171
|
-
(0, external_vitest_namespaceObject.it)("should accept case variations of providers", ()=>{
|
|
172
|
-
const result1 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("Anthropic:model");
|
|
173
|
-
const result2 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("OPENAI:model");
|
|
174
|
-
const result3 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("CODEX:model");
|
|
175
|
-
const result4 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("Copilot:model");
|
|
176
|
-
const result5 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("LMStudio:model");
|
|
177
|
-
const result6 = modelFactory_cjs_namespaceObject.ModelFactory.validateModelString("OLLAMA:model");
|
|
178
|
-
(0, external_vitest_namespaceObject.expect)(result1.valid).toBe(true);
|
|
179
|
-
(0, external_vitest_namespaceObject.expect)(result2.valid).toBe(true);
|
|
180
|
-
(0, external_vitest_namespaceObject.expect)(result3.valid).toBe(true);
|
|
181
|
-
(0, external_vitest_namespaceObject.expect)(result4.valid).toBe(true);
|
|
182
|
-
(0, external_vitest_namespaceObject.expect)(result5.valid).toBe(true);
|
|
183
|
-
(0, external_vitest_namespaceObject.expect)(result6.valid).toBe(true);
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
188
|
-
Object.defineProperty(exports, '__esModule', {
|
|
189
|
-
value: true
|
|
190
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|