@wingman-ai/gateway 0.5.3 → 0.5.4
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/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/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 +1189 -0
- package/dist/agent/tools/browser_runtime.d.ts +560 -0
- package/dist/agent/tools/browser_runtime.js +1122 -0
- package/dist/agent/tools/browser_session.cjs +153 -0
- package/dist/agent/tools/browser_session.d.ts +741 -0
- package/dist/agent/tools/browser_session.js +110 -0
- package/dist/agent/tools/browser_session_manager.cjs +202 -0
- package/dist/agent/tools/browser_session_manager.d.ts +64 -0
- package/dist/agent/tools/browser_session_manager.js +165 -0
- package/dist/cli/commands/init.cjs +5 -1
- package/dist/cli/commands/init.js +5 -1
- 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 +86 -22
- package/dist/cli/core/agentInvoker.d.ts +10 -3
- package/dist/cli/core/agentInvoker.js +86 -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/types.d.ts +2 -1
- package/dist/webui/assets/index-XrEnkZiq.css +11 -0
- package/dist/webui/assets/index-mDs6HbKM.js +215 -0
- package/dist/webui/index.html +2 -2
- package/package.json +10 -10
- package/templates/agents/README.md +2 -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 +8 -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 +5 -0
- package/templates/agents/researcher/agent.md +11 -0
- 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
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { AgentLoader } from "../config/agentLoader.js";
|
|
4
|
-
const testDir = join(process.cwd(), ".test-subagents");
|
|
5
|
-
const testAgentsDir = join(testDir, "agents");
|
|
6
|
-
function cleanup() {
|
|
7
|
-
if (existsSync(testDir)) {
|
|
8
|
-
unlinkSync(join(testAgentsDir, "parent-agent.json"));
|
|
9
|
-
process.chdir(process.cwd());
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
if (!existsSync(testDir)) mkdirSync(testDir, {
|
|
14
|
-
recursive: true
|
|
15
|
-
});
|
|
16
|
-
if (!existsSync(testAgentsDir)) mkdirSync(testAgentsDir, {
|
|
17
|
-
recursive: true
|
|
18
|
-
});
|
|
19
|
-
console.log("\n=== Test 1: Agent with subagents ===");
|
|
20
|
-
const agentWithSubagents = {
|
|
21
|
-
name: "parent-agent",
|
|
22
|
-
description: "Parent agent with subagents",
|
|
23
|
-
systemPrompt: "You are a parent agent that delegates to subagents.",
|
|
24
|
-
tools: [
|
|
25
|
-
"think"
|
|
26
|
-
],
|
|
27
|
-
subagents: [
|
|
28
|
-
{
|
|
29
|
-
name: "child-1",
|
|
30
|
-
description: "First child agent",
|
|
31
|
-
systemPrompt: "You are child agent 1",
|
|
32
|
-
tools: [
|
|
33
|
-
"web_crawler"
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "child-2",
|
|
38
|
-
description: "Second child agent",
|
|
39
|
-
systemPrompt: "You are child agent 2",
|
|
40
|
-
tools: [
|
|
41
|
-
"internet_search"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
};
|
|
46
|
-
writeFileSync(join(testAgentsDir, "parent-agent.json"), JSON.stringify(agentWithSubagents, null, 2));
|
|
47
|
-
const loader1 = new AgentLoader(".wingman", testDir);
|
|
48
|
-
const agents1 = loader1.loadAllAgentConfigs();
|
|
49
|
-
console.log(`Loaded ${agents1.length} agent(s)`);
|
|
50
|
-
console.log(`Agent name: ${agents1[0]?.name}`);
|
|
51
|
-
console.log(`Agent has subagents: ${agents1[0]?.subagents ? "Yes" : "No"}`);
|
|
52
|
-
if (agents1[0]?.subagents) {
|
|
53
|
-
console.log(`Number of subagents: ${agents1[0].subagents.length}`);
|
|
54
|
-
agents1[0].subagents.forEach((sub, i)=>{
|
|
55
|
-
console.log(` Subagent ${i + 1}: ${sub.name} - ${sub.description}`);
|
|
56
|
-
console.log(` Tools: ${sub.tools?.length || 0}`);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
console.log("\n=== Test 2: Validation - Subagents cannot have subagents ===");
|
|
60
|
-
const invalidAgent = {
|
|
61
|
-
name: "invalid-agent",
|
|
62
|
-
description: "Agent with nested subagents (should fail)",
|
|
63
|
-
systemPrompt: "Invalid config",
|
|
64
|
-
subagents: [
|
|
65
|
-
{
|
|
66
|
-
name: "child",
|
|
67
|
-
description: "Child with its own subagents",
|
|
68
|
-
systemPrompt: "Child agent",
|
|
69
|
-
subagents: [
|
|
70
|
-
{
|
|
71
|
-
name: "grandchild",
|
|
72
|
-
description: "This should fail validation",
|
|
73
|
-
systemPrompt: "Grandchild"
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
]
|
|
78
|
-
};
|
|
79
|
-
writeFileSync(join(testAgentsDir, "parent-agent.json"), JSON.stringify(invalidAgent, null, 2));
|
|
80
|
-
const loader2 = new AgentLoader(".wingman", testDir);
|
|
81
|
-
const agents2 = loader2.loadAllAgentConfigs();
|
|
82
|
-
if (0 === agents2.length) console.log("✓ Validation correctly rejected nested subagents");
|
|
83
|
-
else {
|
|
84
|
-
console.log("✗ ERROR: Validation should have rejected nested subagents");
|
|
85
|
-
process.exit(1);
|
|
86
|
-
}
|
|
87
|
-
console.log("\n✓ All subagent tests passed!");
|
|
88
|
-
cleanup();
|
|
89
|
-
} catch (error) {
|
|
90
|
-
console.error("Test failed:", error);
|
|
91
|
-
cleanup();
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_exports__ = {};
|
|
3
|
-
const external_node_fs_namespaceObject = require("node:fs");
|
|
4
|
-
const external_node_os_namespaceObject = require("node:os");
|
|
5
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
6
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
7
|
-
const toolRegistry_cjs_namespaceObject = require("../config/toolRegistry.cjs");
|
|
8
|
-
const terminal_session_manager_cjs_namespaceObject = require("../tools/terminal_session_manager.cjs");
|
|
9
|
-
(0, external_vitest_namespaceObject.describe)("Tool Registry", ()=>{
|
|
10
|
-
(0, external_vitest_namespaceObject.describe)("createTool", ()=>{
|
|
11
|
-
(0, external_vitest_namespaceObject.it)("should create internet_search tool", ()=>{
|
|
12
|
-
const tool = (0, toolRegistry_cjs_namespaceObject.createTool)("internet_search");
|
|
13
|
-
(0, external_vitest_namespaceObject.expect)(tool).not.toBeNull();
|
|
14
|
-
(0, external_vitest_namespaceObject.expect)(tool?.name).toBe("internet_search");
|
|
15
|
-
});
|
|
16
|
-
(0, external_vitest_namespaceObject.it)("should create web_crawler tool", ()=>{
|
|
17
|
-
const tool = (0, toolRegistry_cjs_namespaceObject.createTool)("web_crawler");
|
|
18
|
-
(0, external_vitest_namespaceObject.expect)(tool).not.toBeNull();
|
|
19
|
-
(0, external_vitest_namespaceObject.expect)(tool?.name).toBe("web_crawler");
|
|
20
|
-
});
|
|
21
|
-
(0, external_vitest_namespaceObject.it)("should create browser_control tool", ()=>{
|
|
22
|
-
const tool = (0, toolRegistry_cjs_namespaceObject.createTool)("browser_control");
|
|
23
|
-
(0, external_vitest_namespaceObject.expect)(tool).not.toBeNull();
|
|
24
|
-
(0, external_vitest_namespaceObject.expect)(tool?.name).toBe("browser_control");
|
|
25
|
-
});
|
|
26
|
-
(0, external_vitest_namespaceObject.it)("should create command_execute tool with default options", ()=>{
|
|
27
|
-
const tool = (0, toolRegistry_cjs_namespaceObject.createTool)("command_execute");
|
|
28
|
-
(0, external_vitest_namespaceObject.expect)(tool).not.toBeNull();
|
|
29
|
-
(0, external_vitest_namespaceObject.expect)(tool?.name).toBe("command_execute");
|
|
30
|
-
});
|
|
31
|
-
(0, external_vitest_namespaceObject.it)("should create command_execute tool with custom options", ()=>{
|
|
32
|
-
const tool = (0, toolRegistry_cjs_namespaceObject.createTool)("command_execute", {
|
|
33
|
-
workspace: "/custom/path",
|
|
34
|
-
blockedCommands: [
|
|
35
|
-
"rm",
|
|
36
|
-
"mv"
|
|
37
|
-
],
|
|
38
|
-
allowScriptExecution: false,
|
|
39
|
-
timeout: 60000
|
|
40
|
-
});
|
|
41
|
-
(0, external_vitest_namespaceObject.expect)(tool).not.toBeNull();
|
|
42
|
-
(0, external_vitest_namespaceObject.expect)(tool?.name).toBe("command_execute");
|
|
43
|
-
});
|
|
44
|
-
(0, external_vitest_namespaceObject.it)("should create terminal tools", ()=>{
|
|
45
|
-
const manager = new terminal_session_manager_cjs_namespaceObject.TerminalSessionManager();
|
|
46
|
-
const terminalTool = (0, toolRegistry_cjs_namespaceObject.createTool)("background_terminal", {
|
|
47
|
-
terminalOwnerId: "owner-1",
|
|
48
|
-
terminalSessionManager: manager
|
|
49
|
-
});
|
|
50
|
-
(0, external_vitest_namespaceObject.expect)(terminalTool?.name).toBe("background_terminal");
|
|
51
|
-
manager.dispose();
|
|
52
|
-
});
|
|
53
|
-
(0, external_vitest_namespaceObject.it)("should execute command tools in executionWorkspace when provided", async ()=>{
|
|
54
|
-
const executionWorkspace = (0, external_node_fs_namespaceObject.mkdtempSync)((0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), "wingman-tool-workspace-"));
|
|
55
|
-
const tool = (0, toolRegistry_cjs_namespaceObject.createTool)("command_execute", {
|
|
56
|
-
workspace: "/custom/path",
|
|
57
|
-
executionWorkspace
|
|
58
|
-
});
|
|
59
|
-
(0, external_vitest_namespaceObject.expect)(tool).not.toBeNull();
|
|
60
|
-
if (!tool) throw new Error("Expected command_execute tool to be created");
|
|
61
|
-
const result = await tool.invoke({
|
|
62
|
-
command: 'node -e "process.stdout.write(process.cwd())"'
|
|
63
|
-
});
|
|
64
|
-
(0, external_vitest_namespaceObject.expect)(String(result)).toContain(executionWorkspace);
|
|
65
|
-
});
|
|
66
|
-
(0, external_vitest_namespaceObject.it)("should create think tool", ()=>{
|
|
67
|
-
const tool = (0, toolRegistry_cjs_namespaceObject.createTool)("think");
|
|
68
|
-
(0, external_vitest_namespaceObject.expect)(tool).not.toBeNull();
|
|
69
|
-
(0, external_vitest_namespaceObject.expect)(tool?.name).toBe("think");
|
|
70
|
-
});
|
|
71
|
-
(0, external_vitest_namespaceObject.it)("should return null for unknown tool name", ()=>{
|
|
72
|
-
const tool = (0, toolRegistry_cjs_namespaceObject.createTool)("unknown_tool");
|
|
73
|
-
(0, external_vitest_namespaceObject.expect)(tool).toBeNull();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
(0, external_vitest_namespaceObject.describe)("createTools", ()=>{
|
|
77
|
-
(0, external_vitest_namespaceObject.it)("should create multiple tools from array", async ()=>{
|
|
78
|
-
const tools = await (0, toolRegistry_cjs_namespaceObject.createTools)([
|
|
79
|
-
"internet_search",
|
|
80
|
-
"web_crawler",
|
|
81
|
-
"think"
|
|
82
|
-
]);
|
|
83
|
-
(0, external_vitest_namespaceObject.expect)(tools).toHaveLength(3);
|
|
84
|
-
(0, external_vitest_namespaceObject.expect)(tools[0].name).toBe("internet_search");
|
|
85
|
-
(0, external_vitest_namespaceObject.expect)(tools[1].name).toBe("web_crawler");
|
|
86
|
-
(0, external_vitest_namespaceObject.expect)(tools[2].name).toBe("think");
|
|
87
|
-
});
|
|
88
|
-
(0, external_vitest_namespaceObject.it)("should create empty array for empty input", async ()=>{
|
|
89
|
-
const tools = await (0, toolRegistry_cjs_namespaceObject.createTools)([]);
|
|
90
|
-
(0, external_vitest_namespaceObject.expect)(tools).toHaveLength(0);
|
|
91
|
-
});
|
|
92
|
-
(0, external_vitest_namespaceObject.it)("should skip unknown tool names", async ()=>{
|
|
93
|
-
const tools = await (0, toolRegistry_cjs_namespaceObject.createTools)([
|
|
94
|
-
"internet_search",
|
|
95
|
-
"unknown_tool",
|
|
96
|
-
"think"
|
|
97
|
-
]);
|
|
98
|
-
(0, external_vitest_namespaceObject.expect)(tools).toHaveLength(2);
|
|
99
|
-
(0, external_vitest_namespaceObject.expect)(tools[0].name).toBe("internet_search");
|
|
100
|
-
(0, external_vitest_namespaceObject.expect)(tools[1].name).toBe("think");
|
|
101
|
-
});
|
|
102
|
-
(0, external_vitest_namespaceObject.it)("should pass options to all tools", async ()=>{
|
|
103
|
-
const tools = await (0, toolRegistry_cjs_namespaceObject.createTools)([
|
|
104
|
-
"command_execute"
|
|
105
|
-
], {
|
|
106
|
-
workspace: "/test/path",
|
|
107
|
-
timeout: 30000
|
|
108
|
-
});
|
|
109
|
-
(0, external_vitest_namespaceObject.expect)(tools).toHaveLength(1);
|
|
110
|
-
(0, external_vitest_namespaceObject.expect)(tools[0].name).toBe("command_execute");
|
|
111
|
-
});
|
|
112
|
-
(0, external_vitest_namespaceObject.it)("should create all available tools", async ()=>{
|
|
113
|
-
const availableTools = (0, toolRegistry_cjs_namespaceObject.getAvailableTools)();
|
|
114
|
-
const tools = await (0, toolRegistry_cjs_namespaceObject.createTools)(availableTools);
|
|
115
|
-
(0, external_vitest_namespaceObject.expect)(tools).toHaveLength(availableTools.length);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
(0, external_vitest_namespaceObject.describe)("getAvailableTools", ()=>{
|
|
119
|
-
(0, external_vitest_namespaceObject.it)("should return all available tool names", ()=>{
|
|
120
|
-
const tools = (0, toolRegistry_cjs_namespaceObject.getAvailableTools)();
|
|
121
|
-
(0, external_vitest_namespaceObject.expect)(tools).toEqual([
|
|
122
|
-
"internet_search",
|
|
123
|
-
"web_crawler",
|
|
124
|
-
"browser_control",
|
|
125
|
-
"command_execute",
|
|
126
|
-
"background_terminal",
|
|
127
|
-
"node_notify",
|
|
128
|
-
"node_run",
|
|
129
|
-
"think",
|
|
130
|
-
"code_search",
|
|
131
|
-
"git_status",
|
|
132
|
-
"ui_registry_list",
|
|
133
|
-
"ui_registry_get",
|
|
134
|
-
"ui_present"
|
|
135
|
-
]);
|
|
136
|
-
});
|
|
137
|
-
(0, external_vitest_namespaceObject.it)("should return a consistent list", ()=>{
|
|
138
|
-
const tools1 = (0, toolRegistry_cjs_namespaceObject.getAvailableTools)();
|
|
139
|
-
const tools2 = (0, toolRegistry_cjs_namespaceObject.getAvailableTools)();
|
|
140
|
-
(0, external_vitest_namespaceObject.expect)(tools1).toEqual(tools2);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
145
|
-
Object.defineProperty(exports, '__esModule', {
|
|
146
|
-
value: true
|
|
147
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { mkdtempSync } from "node:fs";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { describe, expect, it } from "vitest";
|
|
5
|
-
import { createTool, createTools, getAvailableTools } from "../config/toolRegistry.js";
|
|
6
|
-
import { TerminalSessionManager } from "../tools/terminal_session_manager.js";
|
|
7
|
-
describe("Tool Registry", ()=>{
|
|
8
|
-
describe("createTool", ()=>{
|
|
9
|
-
it("should create internet_search tool", ()=>{
|
|
10
|
-
const tool = createTool("internet_search");
|
|
11
|
-
expect(tool).not.toBeNull();
|
|
12
|
-
expect(tool?.name).toBe("internet_search");
|
|
13
|
-
});
|
|
14
|
-
it("should create web_crawler tool", ()=>{
|
|
15
|
-
const tool = createTool("web_crawler");
|
|
16
|
-
expect(tool).not.toBeNull();
|
|
17
|
-
expect(tool?.name).toBe("web_crawler");
|
|
18
|
-
});
|
|
19
|
-
it("should create browser_control tool", ()=>{
|
|
20
|
-
const tool = createTool("browser_control");
|
|
21
|
-
expect(tool).not.toBeNull();
|
|
22
|
-
expect(tool?.name).toBe("browser_control");
|
|
23
|
-
});
|
|
24
|
-
it("should create command_execute tool with default options", ()=>{
|
|
25
|
-
const tool = createTool("command_execute");
|
|
26
|
-
expect(tool).not.toBeNull();
|
|
27
|
-
expect(tool?.name).toBe("command_execute");
|
|
28
|
-
});
|
|
29
|
-
it("should create command_execute tool with custom options", ()=>{
|
|
30
|
-
const tool = createTool("command_execute", {
|
|
31
|
-
workspace: "/custom/path",
|
|
32
|
-
blockedCommands: [
|
|
33
|
-
"rm",
|
|
34
|
-
"mv"
|
|
35
|
-
],
|
|
36
|
-
allowScriptExecution: false,
|
|
37
|
-
timeout: 60000
|
|
38
|
-
});
|
|
39
|
-
expect(tool).not.toBeNull();
|
|
40
|
-
expect(tool?.name).toBe("command_execute");
|
|
41
|
-
});
|
|
42
|
-
it("should create terminal tools", ()=>{
|
|
43
|
-
const manager = new TerminalSessionManager();
|
|
44
|
-
const terminalTool = createTool("background_terminal", {
|
|
45
|
-
terminalOwnerId: "owner-1",
|
|
46
|
-
terminalSessionManager: manager
|
|
47
|
-
});
|
|
48
|
-
expect(terminalTool?.name).toBe("background_terminal");
|
|
49
|
-
manager.dispose();
|
|
50
|
-
});
|
|
51
|
-
it("should execute command tools in executionWorkspace when provided", async ()=>{
|
|
52
|
-
const executionWorkspace = mkdtempSync(join(tmpdir(), "wingman-tool-workspace-"));
|
|
53
|
-
const tool = createTool("command_execute", {
|
|
54
|
-
workspace: "/custom/path",
|
|
55
|
-
executionWorkspace
|
|
56
|
-
});
|
|
57
|
-
expect(tool).not.toBeNull();
|
|
58
|
-
if (!tool) throw new Error("Expected command_execute tool to be created");
|
|
59
|
-
const result = await tool.invoke({
|
|
60
|
-
command: 'node -e "process.stdout.write(process.cwd())"'
|
|
61
|
-
});
|
|
62
|
-
expect(String(result)).toContain(executionWorkspace);
|
|
63
|
-
});
|
|
64
|
-
it("should create think tool", ()=>{
|
|
65
|
-
const tool = createTool("think");
|
|
66
|
-
expect(tool).not.toBeNull();
|
|
67
|
-
expect(tool?.name).toBe("think");
|
|
68
|
-
});
|
|
69
|
-
it("should return null for unknown tool name", ()=>{
|
|
70
|
-
const tool = createTool("unknown_tool");
|
|
71
|
-
expect(tool).toBeNull();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
describe("createTools", ()=>{
|
|
75
|
-
it("should create multiple tools from array", async ()=>{
|
|
76
|
-
const tools = await createTools([
|
|
77
|
-
"internet_search",
|
|
78
|
-
"web_crawler",
|
|
79
|
-
"think"
|
|
80
|
-
]);
|
|
81
|
-
expect(tools).toHaveLength(3);
|
|
82
|
-
expect(tools[0].name).toBe("internet_search");
|
|
83
|
-
expect(tools[1].name).toBe("web_crawler");
|
|
84
|
-
expect(tools[2].name).toBe("think");
|
|
85
|
-
});
|
|
86
|
-
it("should create empty array for empty input", async ()=>{
|
|
87
|
-
const tools = await createTools([]);
|
|
88
|
-
expect(tools).toHaveLength(0);
|
|
89
|
-
});
|
|
90
|
-
it("should skip unknown tool names", async ()=>{
|
|
91
|
-
const tools = await createTools([
|
|
92
|
-
"internet_search",
|
|
93
|
-
"unknown_tool",
|
|
94
|
-
"think"
|
|
95
|
-
]);
|
|
96
|
-
expect(tools).toHaveLength(2);
|
|
97
|
-
expect(tools[0].name).toBe("internet_search");
|
|
98
|
-
expect(tools[1].name).toBe("think");
|
|
99
|
-
});
|
|
100
|
-
it("should pass options to all tools", async ()=>{
|
|
101
|
-
const tools = await createTools([
|
|
102
|
-
"command_execute"
|
|
103
|
-
], {
|
|
104
|
-
workspace: "/test/path",
|
|
105
|
-
timeout: 30000
|
|
106
|
-
});
|
|
107
|
-
expect(tools).toHaveLength(1);
|
|
108
|
-
expect(tools[0].name).toBe("command_execute");
|
|
109
|
-
});
|
|
110
|
-
it("should create all available tools", async ()=>{
|
|
111
|
-
const availableTools = getAvailableTools();
|
|
112
|
-
const tools = await createTools(availableTools);
|
|
113
|
-
expect(tools).toHaveLength(availableTools.length);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
describe("getAvailableTools", ()=>{
|
|
117
|
-
it("should return all available tool names", ()=>{
|
|
118
|
-
const tools = getAvailableTools();
|
|
119
|
-
expect(tools).toEqual([
|
|
120
|
-
"internet_search",
|
|
121
|
-
"web_crawler",
|
|
122
|
-
"browser_control",
|
|
123
|
-
"command_execute",
|
|
124
|
-
"background_terminal",
|
|
125
|
-
"node_notify",
|
|
126
|
-
"node_run",
|
|
127
|
-
"think",
|
|
128
|
-
"code_search",
|
|
129
|
-
"git_status",
|
|
130
|
-
"ui_registry_list",
|
|
131
|
-
"ui_registry_get",
|
|
132
|
-
"ui_present"
|
|
133
|
-
]);
|
|
134
|
-
});
|
|
135
|
-
it("should return a consistent list", ()=>{
|
|
136
|
-
const tools1 = getAvailableTools();
|
|
137
|
-
const tools2 = getAvailableTools();
|
|
138
|
-
expect(tools1).toEqual(tools2);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
});
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
3
|
-
return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
|
-
}();
|
|
5
|
-
var __webpack_exports__ = {};
|
|
6
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
7
|
-
const external_node_fs_namespaceObject = require("node:fs");
|
|
8
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
9
|
-
const external_node_url_namespaceObject = require("node:url");
|
|
10
|
-
const ui_registry_cjs_namespaceObject = require("../tools/ui_registry.cjs");
|
|
11
|
-
const resolveWorkspace = ()=>{
|
|
12
|
-
const cwd = process.cwd();
|
|
13
|
-
if ((0, external_node_fs_namespaceObject.existsSync)((0, external_node_path_namespaceObject.join)(cwd, "skills", "ui-registry", "registry.json"))) return cwd;
|
|
14
|
-
const candidate = (0, external_node_path_namespaceObject.join)((0, external_node_path_namespaceObject.dirname)((0, external_node_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__)), "../../../..");
|
|
15
|
-
if ((0, external_node_fs_namespaceObject.existsSync)((0, external_node_path_namespaceObject.join)(candidate, "skills", "ui-registry", "registry.json"))) return candidate;
|
|
16
|
-
return cwd;
|
|
17
|
-
};
|
|
18
|
-
const workspace = resolveWorkspace();
|
|
19
|
-
const skillsDir = "skills";
|
|
20
|
-
(0, external_vitest_namespaceObject.describe)("UI Registry Tools", ()=>{
|
|
21
|
-
(0, external_vitest_namespaceObject.it)("lists registry components", async ()=>{
|
|
22
|
-
const tool = (0, ui_registry_cjs_namespaceObject.createUiRegistryListTool)(workspace, skillsDir);
|
|
23
|
-
const result = await tool.invoke({});
|
|
24
|
-
const ids = result.components.map((component)=>component.id);
|
|
25
|
-
(0, external_vitest_namespaceObject.expect)(ids.includes("stat_grid")).toBe(true);
|
|
26
|
-
(0, external_vitest_namespaceObject.expect)(ids.includes("line_chart")).toBe(true);
|
|
27
|
-
(0, external_vitest_namespaceObject.expect)(ids.includes("area_chart")).toBe(true);
|
|
28
|
-
(0, external_vitest_namespaceObject.expect)(ids.includes("bar_chart")).toBe(true);
|
|
29
|
-
(0, external_vitest_namespaceObject.expect)(ids.includes("data_table")).toBe(true);
|
|
30
|
-
(0, external_vitest_namespaceObject.expect)(ids.includes("timeline")).toBe(true);
|
|
31
|
-
(0, external_vitest_namespaceObject.expect)(ids.includes("status_list")).toBe(true);
|
|
32
|
-
});
|
|
33
|
-
(0, external_vitest_namespaceObject.it)("returns schema details for a registry component", async ()=>{
|
|
34
|
-
const tool = (0, ui_registry_cjs_namespaceObject.createUiRegistryGetTool)(workspace, skillsDir);
|
|
35
|
-
const result = await tool.invoke({
|
|
36
|
-
componentId: "stat_grid"
|
|
37
|
-
});
|
|
38
|
-
(0, external_vitest_namespaceObject.expect)(result.componentId).toBe("stat_grid");
|
|
39
|
-
(0, external_vitest_namespaceObject.expect)(result.propsSchema).toBeTruthy();
|
|
40
|
-
});
|
|
41
|
-
(0, external_vitest_namespaceObject.it)("returns schema details for new registry components", async ()=>{
|
|
42
|
-
const tool = (0, ui_registry_cjs_namespaceObject.createUiRegistryGetTool)(workspace, skillsDir);
|
|
43
|
-
for (const componentId of [
|
|
44
|
-
"line_chart",
|
|
45
|
-
"area_chart",
|
|
46
|
-
"bar_chart",
|
|
47
|
-
"data_table",
|
|
48
|
-
"timeline",
|
|
49
|
-
"status_list"
|
|
50
|
-
]){
|
|
51
|
-
const result = await tool.invoke({
|
|
52
|
-
componentId
|
|
53
|
-
});
|
|
54
|
-
(0, external_vitest_namespaceObject.expect)(result.componentId).toBe(componentId);
|
|
55
|
-
(0, external_vitest_namespaceObject.expect)(result.propsSchema).toBeTruthy();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
(0, external_vitest_namespaceObject.it)("exposes axis scale options for chart components", async ()=>{
|
|
59
|
-
const tool = (0, ui_registry_cjs_namespaceObject.createUiRegistryGetTool)(workspace, skillsDir);
|
|
60
|
-
for (const componentId of [
|
|
61
|
-
"line_chart",
|
|
62
|
-
"area_chart",
|
|
63
|
-
"bar_chart"
|
|
64
|
-
]){
|
|
65
|
-
const result = await tool.invoke({
|
|
66
|
-
componentId
|
|
67
|
-
});
|
|
68
|
-
const props = result.propsSchema?.properties ?? {};
|
|
69
|
-
(0, external_vitest_namespaceObject.expect)(props.xScale).toBeTruthy();
|
|
70
|
-
(0, external_vitest_namespaceObject.expect)(props.yScale).toBeTruthy();
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
(0, external_vitest_namespaceObject.it)("renders UI payload when enabled", async ()=>{
|
|
74
|
-
const tool = (0, ui_registry_cjs_namespaceObject.createUiPresentTool)(workspace, skillsDir, true);
|
|
75
|
-
const result = await tool.invoke({
|
|
76
|
-
componentId: "stat_grid",
|
|
77
|
-
props: {
|
|
78
|
-
title: "Summary",
|
|
79
|
-
stats: [
|
|
80
|
-
{
|
|
81
|
-
label: "Alpha",
|
|
82
|
-
value: "1"
|
|
83
|
-
}
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
textFallback: "Summary: Alpha 1",
|
|
87
|
-
uiOnly: true
|
|
88
|
-
});
|
|
89
|
-
(0, external_vitest_namespaceObject.expect)(result.ui).toBeTruthy();
|
|
90
|
-
(0, external_vitest_namespaceObject.expect)(result.textFallback).toBe("Summary: Alpha 1");
|
|
91
|
-
});
|
|
92
|
-
(0, external_vitest_namespaceObject.it)("suppresses UI payload when disabled", async ()=>{
|
|
93
|
-
const tool = (0, ui_registry_cjs_namespaceObject.createUiPresentTool)(workspace, skillsDir, false);
|
|
94
|
-
const result = await tool.invoke({
|
|
95
|
-
componentId: "stat_grid",
|
|
96
|
-
props: {
|
|
97
|
-
title: "Summary",
|
|
98
|
-
stats: [
|
|
99
|
-
{
|
|
100
|
-
label: "Alpha",
|
|
101
|
-
value: "1"
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
|
-
textFallback: "Summary: Alpha 1"
|
|
106
|
-
});
|
|
107
|
-
(0, external_vitest_namespaceObject.expect)(result.ui).toBeUndefined();
|
|
108
|
-
(0, external_vitest_namespaceObject.expect)(result.uiOnly).toBe(false);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
112
|
-
Object.defineProperty(exports, '__esModule', {
|
|
113
|
-
value: true
|
|
114
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { createUiPresentTool, createUiRegistryGetTool, createUiRegistryListTool } from "../tools/ui_registry.js";
|
|
6
|
-
const resolveWorkspace = ()=>{
|
|
7
|
-
const cwd = process.cwd();
|
|
8
|
-
if (existsSync(join(cwd, "skills", "ui-registry", "registry.json"))) return cwd;
|
|
9
|
-
const candidate = join(dirname(fileURLToPath(import.meta.url)), "../../../..");
|
|
10
|
-
if (existsSync(join(candidate, "skills", "ui-registry", "registry.json"))) return candidate;
|
|
11
|
-
return cwd;
|
|
12
|
-
};
|
|
13
|
-
const workspace = resolveWorkspace();
|
|
14
|
-
const skillsDir = "skills";
|
|
15
|
-
describe("UI Registry Tools", ()=>{
|
|
16
|
-
it("lists registry components", async ()=>{
|
|
17
|
-
const tool = createUiRegistryListTool(workspace, skillsDir);
|
|
18
|
-
const result = await tool.invoke({});
|
|
19
|
-
const ids = result.components.map((component)=>component.id);
|
|
20
|
-
expect(ids.includes("stat_grid")).toBe(true);
|
|
21
|
-
expect(ids.includes("line_chart")).toBe(true);
|
|
22
|
-
expect(ids.includes("area_chart")).toBe(true);
|
|
23
|
-
expect(ids.includes("bar_chart")).toBe(true);
|
|
24
|
-
expect(ids.includes("data_table")).toBe(true);
|
|
25
|
-
expect(ids.includes("timeline")).toBe(true);
|
|
26
|
-
expect(ids.includes("status_list")).toBe(true);
|
|
27
|
-
});
|
|
28
|
-
it("returns schema details for a registry component", async ()=>{
|
|
29
|
-
const tool = createUiRegistryGetTool(workspace, skillsDir);
|
|
30
|
-
const result = await tool.invoke({
|
|
31
|
-
componentId: "stat_grid"
|
|
32
|
-
});
|
|
33
|
-
expect(result.componentId).toBe("stat_grid");
|
|
34
|
-
expect(result.propsSchema).toBeTruthy();
|
|
35
|
-
});
|
|
36
|
-
it("returns schema details for new registry components", async ()=>{
|
|
37
|
-
const tool = createUiRegistryGetTool(workspace, skillsDir);
|
|
38
|
-
for (const componentId of [
|
|
39
|
-
"line_chart",
|
|
40
|
-
"area_chart",
|
|
41
|
-
"bar_chart",
|
|
42
|
-
"data_table",
|
|
43
|
-
"timeline",
|
|
44
|
-
"status_list"
|
|
45
|
-
]){
|
|
46
|
-
const result = await tool.invoke({
|
|
47
|
-
componentId
|
|
48
|
-
});
|
|
49
|
-
expect(result.componentId).toBe(componentId);
|
|
50
|
-
expect(result.propsSchema).toBeTruthy();
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
it("exposes axis scale options for chart components", async ()=>{
|
|
54
|
-
const tool = createUiRegistryGetTool(workspace, skillsDir);
|
|
55
|
-
for (const componentId of [
|
|
56
|
-
"line_chart",
|
|
57
|
-
"area_chart",
|
|
58
|
-
"bar_chart"
|
|
59
|
-
]){
|
|
60
|
-
const result = await tool.invoke({
|
|
61
|
-
componentId
|
|
62
|
-
});
|
|
63
|
-
const props = result.propsSchema?.properties ?? {};
|
|
64
|
-
expect(props.xScale).toBeTruthy();
|
|
65
|
-
expect(props.yScale).toBeTruthy();
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
it("renders UI payload when enabled", async ()=>{
|
|
69
|
-
const tool = createUiPresentTool(workspace, skillsDir, true);
|
|
70
|
-
const result = await tool.invoke({
|
|
71
|
-
componentId: "stat_grid",
|
|
72
|
-
props: {
|
|
73
|
-
title: "Summary",
|
|
74
|
-
stats: [
|
|
75
|
-
{
|
|
76
|
-
label: "Alpha",
|
|
77
|
-
value: "1"
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
textFallback: "Summary: Alpha 1",
|
|
82
|
-
uiOnly: true
|
|
83
|
-
});
|
|
84
|
-
expect(result.ui).toBeTruthy();
|
|
85
|
-
expect(result.textFallback).toBe("Summary: Alpha 1");
|
|
86
|
-
});
|
|
87
|
-
it("suppresses UI payload when disabled", async ()=>{
|
|
88
|
-
const tool = createUiPresentTool(workspace, skillsDir, false);
|
|
89
|
-
const result = await tool.invoke({
|
|
90
|
-
componentId: "stat_grid",
|
|
91
|
-
props: {
|
|
92
|
-
title: "Summary",
|
|
93
|
-
stats: [
|
|
94
|
-
{
|
|
95
|
-
label: "Alpha",
|
|
96
|
-
value: "1"
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
},
|
|
100
|
-
textFallback: "Summary: Alpha 1"
|
|
101
|
-
});
|
|
102
|
-
expect(result.ui).toBeUndefined();
|
|
103
|
-
expect(result.uiOnly).toBe(false);
|
|
104
|
-
});
|
|
105
|
-
});
|