@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,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_exports__ = {};
|
|
3
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
4
|
-
const attachments_cjs_namespaceObject = require("../utils/attachments.cjs");
|
|
5
|
-
(0, external_vitest_namespaceObject.describe)("extractImageFiles", ()=>{
|
|
6
|
-
(0, external_vitest_namespaceObject.it)("returns only image files from clipboard items", ()=>{
|
|
7
|
-
const image = new File([
|
|
8
|
-
"data"
|
|
9
|
-
], "chart.png", {
|
|
10
|
-
type: "image/png"
|
|
11
|
-
});
|
|
12
|
-
const text = new File([
|
|
13
|
-
"notes"
|
|
14
|
-
], "notes.txt", {
|
|
15
|
-
type: "text/plain"
|
|
16
|
-
});
|
|
17
|
-
const items = [
|
|
18
|
-
{
|
|
19
|
-
kind: "file",
|
|
20
|
-
type: "image/png",
|
|
21
|
-
getAsFile: ()=>image
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
kind: "file",
|
|
25
|
-
type: "text/plain",
|
|
26
|
-
getAsFile: ()=>text
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
kind: "string",
|
|
30
|
-
type: "text/plain",
|
|
31
|
-
getAsFile: ()=>null
|
|
32
|
-
}
|
|
33
|
-
];
|
|
34
|
-
const result = (0, attachments_cjs_namespaceObject.extractImageFiles)(items);
|
|
35
|
-
(0, external_vitest_namespaceObject.expect)(result).toEqual([
|
|
36
|
-
image
|
|
37
|
-
]);
|
|
38
|
-
});
|
|
39
|
-
(0, external_vitest_namespaceObject.it)("handles missing items", ()=>{
|
|
40
|
-
(0, external_vitest_namespaceObject.expect)((0, attachments_cjs_namespaceObject.extractImageFiles)(null)).toEqual([]);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
44
|
-
Object.defineProperty(exports, '__esModule', {
|
|
45
|
-
value: true
|
|
46
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { extractImageFiles } from "../utils/attachments.js";
|
|
3
|
-
describe("extractImageFiles", ()=>{
|
|
4
|
-
it("returns only image files from clipboard items", ()=>{
|
|
5
|
-
const image = new File([
|
|
6
|
-
"data"
|
|
7
|
-
], "chart.png", {
|
|
8
|
-
type: "image/png"
|
|
9
|
-
});
|
|
10
|
-
const text = new File([
|
|
11
|
-
"notes"
|
|
12
|
-
], "notes.txt", {
|
|
13
|
-
type: "text/plain"
|
|
14
|
-
});
|
|
15
|
-
const items = [
|
|
16
|
-
{
|
|
17
|
-
kind: "file",
|
|
18
|
-
type: "image/png",
|
|
19
|
-
getAsFile: ()=>image
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
kind: "file",
|
|
23
|
-
type: "text/plain",
|
|
24
|
-
getAsFile: ()=>text
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
kind: "string",
|
|
28
|
-
type: "text/plain",
|
|
29
|
-
getAsFile: ()=>null
|
|
30
|
-
}
|
|
31
|
-
];
|
|
32
|
-
const result = extractImageFiles(items);
|
|
33
|
-
expect(result).toEqual([
|
|
34
|
-
image
|
|
35
|
-
]);
|
|
36
|
-
});
|
|
37
|
-
it("handles missing items", ()=>{
|
|
38
|
-
expect(extractImageFiles(null)).toEqual([]);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
@@ -1,264 +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 browser_cjs_namespaceObject = require("../cli/commands/browser.cjs");
|
|
8
|
-
(0, external_vitest_namespaceObject.describe)("browser command", ()=>{
|
|
9
|
-
let workspace;
|
|
10
|
-
(0, external_vitest_namespaceObject.beforeEach)(()=>{
|
|
11
|
-
workspace = (0, external_node_path_namespaceObject.join)((0, external_node_os_namespaceObject.tmpdir)(), `wingman-browser-command-${Date.now()}`);
|
|
12
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(workspace, {
|
|
13
|
-
recursive: true
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
(0, external_vitest_namespaceObject.afterEach)(()=>{
|
|
17
|
-
if ((0, external_node_fs_namespaceObject.existsSync)(workspace)) (0, external_node_fs_namespaceObject.rmSync)(workspace, {
|
|
18
|
-
recursive: true,
|
|
19
|
-
force: true
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
(0, external_vitest_namespaceObject.it)("initializes a profile and writes browser config when config is missing", async ()=>{
|
|
23
|
-
await (0, browser_cjs_namespaceObject.executeBrowserCommand)({
|
|
24
|
-
subcommand: "profile",
|
|
25
|
-
args: [
|
|
26
|
-
"init",
|
|
27
|
-
"trading"
|
|
28
|
-
],
|
|
29
|
-
verbosity: "silent",
|
|
30
|
-
outputMode: "json",
|
|
31
|
-
options: {}
|
|
32
|
-
}, {
|
|
33
|
-
workspace
|
|
34
|
-
});
|
|
35
|
-
const configPath = (0, external_node_path_namespaceObject.join)(workspace, ".wingman", "wingman.config.json");
|
|
36
|
-
const profilePath = (0, external_node_path_namespaceObject.join)(workspace, ".wingman", "browser-profiles", "trading");
|
|
37
|
-
(0, external_vitest_namespaceObject.expect)((0, external_node_fs_namespaceObject.existsSync)(configPath)).toBe(true);
|
|
38
|
-
(0, external_vitest_namespaceObject.expect)((0, external_node_fs_namespaceObject.existsSync)(profilePath)).toBe(true);
|
|
39
|
-
const config = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(configPath, "utf-8"));
|
|
40
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.profilesDir).toBe(".wingman/browser-profiles");
|
|
41
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.defaultProfile).toBe("trading");
|
|
42
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.profiles?.trading).toBe(".wingman/browser-profiles/trading");
|
|
43
|
-
});
|
|
44
|
-
(0, external_vitest_namespaceObject.it)("uses existing browser.profilesDir when creating profile mapping", async ()=>{
|
|
45
|
-
const configRoot = (0, external_node_path_namespaceObject.join)(workspace, ".wingman");
|
|
46
|
-
const configPath = (0, external_node_path_namespaceObject.join)(configRoot, "wingman.config.json");
|
|
47
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(configRoot, {
|
|
48
|
-
recursive: true
|
|
49
|
-
});
|
|
50
|
-
(0, external_node_fs_namespaceObject.writeFileSync)(configPath, JSON.stringify({
|
|
51
|
-
logLevel: "info",
|
|
52
|
-
browser: {
|
|
53
|
-
profilesDir: ".wingman/profiles",
|
|
54
|
-
profiles: {}
|
|
55
|
-
}
|
|
56
|
-
}, null, 2));
|
|
57
|
-
await (0, browser_cjs_namespaceObject.executeBrowserCommand)({
|
|
58
|
-
subcommand: "profile",
|
|
59
|
-
args: [
|
|
60
|
-
"init",
|
|
61
|
-
"work"
|
|
62
|
-
],
|
|
63
|
-
verbosity: "silent",
|
|
64
|
-
outputMode: "json",
|
|
65
|
-
options: {}
|
|
66
|
-
}, {
|
|
67
|
-
workspace
|
|
68
|
-
});
|
|
69
|
-
const config = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(configPath, "utf-8"));
|
|
70
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.profiles?.work).toBe(".wingman/profiles/work");
|
|
71
|
-
(0, external_vitest_namespaceObject.expect)((0, external_node_fs_namespaceObject.existsSync)((0, external_node_path_namespaceObject.join)(workspace, ".wingman", "profiles", "work"))).toBe(true);
|
|
72
|
-
});
|
|
73
|
-
(0, external_vitest_namespaceObject.it)("fails when overwriting an existing profile mapping without --force", async ()=>{
|
|
74
|
-
const configRoot = (0, external_node_path_namespaceObject.join)(workspace, ".wingman");
|
|
75
|
-
const configPath = (0, external_node_path_namespaceObject.join)(configRoot, "wingman.config.json");
|
|
76
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(configRoot, {
|
|
77
|
-
recursive: true
|
|
78
|
-
});
|
|
79
|
-
(0, external_node_fs_namespaceObject.writeFileSync)(configPath, JSON.stringify({
|
|
80
|
-
browser: {
|
|
81
|
-
profilesDir: ".wingman/browser-profiles",
|
|
82
|
-
profiles: {
|
|
83
|
-
trading: ".wingman/browser-profiles/trading"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, null, 2));
|
|
87
|
-
const exitSpy = external_vitest_namespaceObject.vi.spyOn(process, "exit").mockImplementation((code)=>{
|
|
88
|
-
throw new Error(`process.exit(${code ?? "undefined"})`);
|
|
89
|
-
});
|
|
90
|
-
try {
|
|
91
|
-
await (0, external_vitest_namespaceObject.expect)((0, browser_cjs_namespaceObject.executeBrowserCommand)({
|
|
92
|
-
subcommand: "profile",
|
|
93
|
-
args: [
|
|
94
|
-
"init",
|
|
95
|
-
"trading"
|
|
96
|
-
],
|
|
97
|
-
verbosity: "silent",
|
|
98
|
-
outputMode: "json",
|
|
99
|
-
options: {
|
|
100
|
-
path: ".wingman/alternate/trading"
|
|
101
|
-
}
|
|
102
|
-
}, {
|
|
103
|
-
workspace
|
|
104
|
-
})).rejects.toThrow("process.exit(1)");
|
|
105
|
-
} finally{
|
|
106
|
-
exitSpy.mockRestore();
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
(0, external_vitest_namespaceObject.it)("registers an unpacked extension and marks it default", async ()=>{
|
|
110
|
-
const sourceExtensionDir = (0, external_node_path_namespaceObject.join)(workspace, "relay-extension");
|
|
111
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(sourceExtensionDir, {
|
|
112
|
-
recursive: true
|
|
113
|
-
});
|
|
114
|
-
(0, external_node_fs_namespaceObject.writeFileSync)((0, external_node_path_namespaceObject.join)(sourceExtensionDir, "manifest.json"), JSON.stringify({
|
|
115
|
-
manifest_version: 3,
|
|
116
|
-
name: "Relay",
|
|
117
|
-
version: "1.0.0"
|
|
118
|
-
}));
|
|
119
|
-
await (0, browser_cjs_namespaceObject.executeBrowserCommand)({
|
|
120
|
-
subcommand: "extension",
|
|
121
|
-
args: [
|
|
122
|
-
"install",
|
|
123
|
-
"relay"
|
|
124
|
-
],
|
|
125
|
-
verbosity: "silent",
|
|
126
|
-
outputMode: "json",
|
|
127
|
-
options: {
|
|
128
|
-
source: sourceExtensionDir,
|
|
129
|
-
default: true
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
workspace
|
|
133
|
-
});
|
|
134
|
-
const configPath = (0, external_node_path_namespaceObject.join)(workspace, ".wingman", "wingman.config.json");
|
|
135
|
-
const config = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(configPath, "utf-8"));
|
|
136
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.extensionsDir).toBe(".wingman/browser-extensions");
|
|
137
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.extensions?.relay).toBe(".wingman/browser-extensions/relay");
|
|
138
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.defaultExtensions).toContain("relay");
|
|
139
|
-
(0, external_vitest_namespaceObject.expect)((0, external_node_fs_namespaceObject.existsSync)((0, external_node_path_namespaceObject.join)(workspace, ".wingman", "browser-extensions", "relay"))).toBe(true);
|
|
140
|
-
});
|
|
141
|
-
(0, external_vitest_namespaceObject.it)("installs bundled Wingman extension when no ID/source is provided", async ()=>{
|
|
142
|
-
await (0, browser_cjs_namespaceObject.executeBrowserCommand)({
|
|
143
|
-
subcommand: "extension",
|
|
144
|
-
args: [
|
|
145
|
-
"install"
|
|
146
|
-
],
|
|
147
|
-
verbosity: "silent",
|
|
148
|
-
outputMode: "json",
|
|
149
|
-
options: {
|
|
150
|
-
default: true
|
|
151
|
-
}
|
|
152
|
-
}, {
|
|
153
|
-
workspace
|
|
154
|
-
});
|
|
155
|
-
const configPath = (0, external_node_path_namespaceObject.join)(workspace, ".wingman", "wingman.config.json");
|
|
156
|
-
const config = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(configPath, "utf-8"));
|
|
157
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.extensions?.wingman).toBe(".wingman/browser-extensions/wingman");
|
|
158
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.defaultExtensions).toContain("wingman");
|
|
159
|
-
const manifestPath = (0, external_node_path_namespaceObject.join)(workspace, ".wingman", "browser-extensions", "wingman", "manifest.json");
|
|
160
|
-
(0, external_vitest_namespaceObject.expect)((0, external_node_fs_namespaceObject.existsSync)(manifestPath)).toBe(true);
|
|
161
|
-
const manifest = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(manifestPath, "utf-8"));
|
|
162
|
-
(0, external_vitest_namespaceObject.expect)(manifest.name).toBe("Wingman Browser Relay");
|
|
163
|
-
(0, external_vitest_namespaceObject.expect)(manifest.background?.service_worker).toBe("background.js");
|
|
164
|
-
(0, external_vitest_namespaceObject.expect)(manifest.action?.default_title).toContain("Wingman Relay");
|
|
165
|
-
});
|
|
166
|
-
(0, external_vitest_namespaceObject.it)("pairs extension relay with secure defaults and token", async ()=>{
|
|
167
|
-
await (0, browser_cjs_namespaceObject.executeBrowserCommand)({
|
|
168
|
-
subcommand: "extension",
|
|
169
|
-
args: [
|
|
170
|
-
"pair"
|
|
171
|
-
],
|
|
172
|
-
verbosity: "silent",
|
|
173
|
-
outputMode: "json",
|
|
174
|
-
options: {
|
|
175
|
-
token: "test-relay-token-123456",
|
|
176
|
-
port: 18792
|
|
177
|
-
}
|
|
178
|
-
}, {
|
|
179
|
-
workspace
|
|
180
|
-
});
|
|
181
|
-
const configPath = (0, external_node_path_namespaceObject.join)(workspace, ".wingman", "wingman.config.json");
|
|
182
|
-
const config = JSON.parse((0, external_node_fs_namespaceObject.readFileSync)(configPath, "utf-8"));
|
|
183
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.relay).toMatchObject({
|
|
184
|
-
enabled: true,
|
|
185
|
-
host: "127.0.0.1",
|
|
186
|
-
port: 18792,
|
|
187
|
-
requireAuth: true,
|
|
188
|
-
authToken: "test-relay-token-123456"
|
|
189
|
-
});
|
|
190
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.defaultExtensions).toContain("wingman");
|
|
191
|
-
(0, external_vitest_namespaceObject.expect)(config.browser?.extensions?.wingman).toBe(".wingman/browser-extensions/wingman");
|
|
192
|
-
});
|
|
193
|
-
(0, external_vitest_namespaceObject.it)("opens a profile with configured default extensions", async ()=>{
|
|
194
|
-
const profileDir = (0, external_node_path_namespaceObject.join)(workspace, ".wingman", "browser-profiles", "trading");
|
|
195
|
-
const extensionDir = (0, external_node_path_namespaceObject.join)(workspace, ".wingman", "browser-extensions", "relay");
|
|
196
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(profileDir, {
|
|
197
|
-
recursive: true
|
|
198
|
-
});
|
|
199
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(extensionDir, {
|
|
200
|
-
recursive: true
|
|
201
|
-
});
|
|
202
|
-
(0, external_node_fs_namespaceObject.writeFileSync)((0, external_node_path_namespaceObject.join)(extensionDir, "manifest.json"), JSON.stringify({
|
|
203
|
-
manifest_version: 3,
|
|
204
|
-
name: "Relay",
|
|
205
|
-
version: "1.0.0"
|
|
206
|
-
}));
|
|
207
|
-
const configRoot = (0, external_node_path_namespaceObject.join)(workspace, ".wingman");
|
|
208
|
-
const configPath = (0, external_node_path_namespaceObject.join)(configRoot, "wingman.config.json");
|
|
209
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(configRoot, {
|
|
210
|
-
recursive: true
|
|
211
|
-
});
|
|
212
|
-
(0, external_node_fs_namespaceObject.writeFileSync)(configPath, JSON.stringify({
|
|
213
|
-
browser: {
|
|
214
|
-
profilesDir: ".wingman/browser-profiles",
|
|
215
|
-
defaultProfile: "trading",
|
|
216
|
-
profiles: {
|
|
217
|
-
trading: ".wingman/browser-profiles/trading"
|
|
218
|
-
},
|
|
219
|
-
extensionsDir: ".wingman/browser-extensions",
|
|
220
|
-
extensions: {
|
|
221
|
-
relay: ".wingman/browser-extensions/relay"
|
|
222
|
-
},
|
|
223
|
-
defaultExtensions: [
|
|
224
|
-
"relay"
|
|
225
|
-
]
|
|
226
|
-
}
|
|
227
|
-
}, null, 2));
|
|
228
|
-
let spawnedCommand = "";
|
|
229
|
-
let spawnedArgs = [];
|
|
230
|
-
let unrefCalled = false;
|
|
231
|
-
await (0, browser_cjs_namespaceObject.executeBrowserCommand)({
|
|
232
|
-
subcommand: "profile",
|
|
233
|
-
args: [
|
|
234
|
-
"open"
|
|
235
|
-
],
|
|
236
|
-
verbosity: "silent",
|
|
237
|
-
outputMode: "json",
|
|
238
|
-
options: {
|
|
239
|
-
url: "https://example.com/login"
|
|
240
|
-
}
|
|
241
|
-
}, {
|
|
242
|
-
workspace,
|
|
243
|
-
resolveExecutablePath: ()=>"/Applications/Google Chrome.app/chrome",
|
|
244
|
-
spawnProcess: (command, args)=>{
|
|
245
|
-
spawnedCommand = command;
|
|
246
|
-
spawnedArgs = args;
|
|
247
|
-
return {
|
|
248
|
-
unref: ()=>{
|
|
249
|
-
unrefCalled = true;
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
(0, external_vitest_namespaceObject.expect)(spawnedCommand).toContain("Google Chrome");
|
|
255
|
-
(0, external_vitest_namespaceObject.expect)(spawnedArgs).toContain("https://example.com/login");
|
|
256
|
-
(0, external_vitest_namespaceObject.expect)(spawnedArgs.some((arg)=>arg.startsWith("--user-data-dir="))).toBe(true);
|
|
257
|
-
(0, external_vitest_namespaceObject.expect)(spawnedArgs.some((arg)=>arg.startsWith("--load-extension="))).toBe(true);
|
|
258
|
-
(0, external_vitest_namespaceObject.expect)(unrefCalled).toBe(true);
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
262
|
-
Object.defineProperty(exports, '__esModule', {
|
|
263
|
-
value: true
|
|
264
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
import { executeBrowserCommand } from "../cli/commands/browser.js";
|
|
6
|
-
describe("browser command", ()=>{
|
|
7
|
-
let workspace;
|
|
8
|
-
beforeEach(()=>{
|
|
9
|
-
workspace = join(tmpdir(), `wingman-browser-command-${Date.now()}`);
|
|
10
|
-
mkdirSync(workspace, {
|
|
11
|
-
recursive: true
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
afterEach(()=>{
|
|
15
|
-
if (existsSync(workspace)) rmSync(workspace, {
|
|
16
|
-
recursive: true,
|
|
17
|
-
force: true
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
it("initializes a profile and writes browser config when config is missing", async ()=>{
|
|
21
|
-
await executeBrowserCommand({
|
|
22
|
-
subcommand: "profile",
|
|
23
|
-
args: [
|
|
24
|
-
"init",
|
|
25
|
-
"trading"
|
|
26
|
-
],
|
|
27
|
-
verbosity: "silent",
|
|
28
|
-
outputMode: "json",
|
|
29
|
-
options: {}
|
|
30
|
-
}, {
|
|
31
|
-
workspace
|
|
32
|
-
});
|
|
33
|
-
const configPath = join(workspace, ".wingman", "wingman.config.json");
|
|
34
|
-
const profilePath = join(workspace, ".wingman", "browser-profiles", "trading");
|
|
35
|
-
expect(existsSync(configPath)).toBe(true);
|
|
36
|
-
expect(existsSync(profilePath)).toBe(true);
|
|
37
|
-
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
38
|
-
expect(config.browser?.profilesDir).toBe(".wingman/browser-profiles");
|
|
39
|
-
expect(config.browser?.defaultProfile).toBe("trading");
|
|
40
|
-
expect(config.browser?.profiles?.trading).toBe(".wingman/browser-profiles/trading");
|
|
41
|
-
});
|
|
42
|
-
it("uses existing browser.profilesDir when creating profile mapping", async ()=>{
|
|
43
|
-
const configRoot = join(workspace, ".wingman");
|
|
44
|
-
const configPath = join(configRoot, "wingman.config.json");
|
|
45
|
-
mkdirSync(configRoot, {
|
|
46
|
-
recursive: true
|
|
47
|
-
});
|
|
48
|
-
writeFileSync(configPath, JSON.stringify({
|
|
49
|
-
logLevel: "info",
|
|
50
|
-
browser: {
|
|
51
|
-
profilesDir: ".wingman/profiles",
|
|
52
|
-
profiles: {}
|
|
53
|
-
}
|
|
54
|
-
}, null, 2));
|
|
55
|
-
await executeBrowserCommand({
|
|
56
|
-
subcommand: "profile",
|
|
57
|
-
args: [
|
|
58
|
-
"init",
|
|
59
|
-
"work"
|
|
60
|
-
],
|
|
61
|
-
verbosity: "silent",
|
|
62
|
-
outputMode: "json",
|
|
63
|
-
options: {}
|
|
64
|
-
}, {
|
|
65
|
-
workspace
|
|
66
|
-
});
|
|
67
|
-
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
68
|
-
expect(config.browser?.profiles?.work).toBe(".wingman/profiles/work");
|
|
69
|
-
expect(existsSync(join(workspace, ".wingman", "profiles", "work"))).toBe(true);
|
|
70
|
-
});
|
|
71
|
-
it("fails when overwriting an existing profile mapping without --force", async ()=>{
|
|
72
|
-
const configRoot = join(workspace, ".wingman");
|
|
73
|
-
const configPath = join(configRoot, "wingman.config.json");
|
|
74
|
-
mkdirSync(configRoot, {
|
|
75
|
-
recursive: true
|
|
76
|
-
});
|
|
77
|
-
writeFileSync(configPath, JSON.stringify({
|
|
78
|
-
browser: {
|
|
79
|
-
profilesDir: ".wingman/browser-profiles",
|
|
80
|
-
profiles: {
|
|
81
|
-
trading: ".wingman/browser-profiles/trading"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}, null, 2));
|
|
85
|
-
const exitSpy = vi.spyOn(process, "exit").mockImplementation((code)=>{
|
|
86
|
-
throw new Error(`process.exit(${code ?? "undefined"})`);
|
|
87
|
-
});
|
|
88
|
-
try {
|
|
89
|
-
await expect(executeBrowserCommand({
|
|
90
|
-
subcommand: "profile",
|
|
91
|
-
args: [
|
|
92
|
-
"init",
|
|
93
|
-
"trading"
|
|
94
|
-
],
|
|
95
|
-
verbosity: "silent",
|
|
96
|
-
outputMode: "json",
|
|
97
|
-
options: {
|
|
98
|
-
path: ".wingman/alternate/trading"
|
|
99
|
-
}
|
|
100
|
-
}, {
|
|
101
|
-
workspace
|
|
102
|
-
})).rejects.toThrow("process.exit(1)");
|
|
103
|
-
} finally{
|
|
104
|
-
exitSpy.mockRestore();
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
it("registers an unpacked extension and marks it default", async ()=>{
|
|
108
|
-
const sourceExtensionDir = join(workspace, "relay-extension");
|
|
109
|
-
mkdirSync(sourceExtensionDir, {
|
|
110
|
-
recursive: true
|
|
111
|
-
});
|
|
112
|
-
writeFileSync(join(sourceExtensionDir, "manifest.json"), JSON.stringify({
|
|
113
|
-
manifest_version: 3,
|
|
114
|
-
name: "Relay",
|
|
115
|
-
version: "1.0.0"
|
|
116
|
-
}));
|
|
117
|
-
await executeBrowserCommand({
|
|
118
|
-
subcommand: "extension",
|
|
119
|
-
args: [
|
|
120
|
-
"install",
|
|
121
|
-
"relay"
|
|
122
|
-
],
|
|
123
|
-
verbosity: "silent",
|
|
124
|
-
outputMode: "json",
|
|
125
|
-
options: {
|
|
126
|
-
source: sourceExtensionDir,
|
|
127
|
-
default: true
|
|
128
|
-
}
|
|
129
|
-
}, {
|
|
130
|
-
workspace
|
|
131
|
-
});
|
|
132
|
-
const configPath = join(workspace, ".wingman", "wingman.config.json");
|
|
133
|
-
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
134
|
-
expect(config.browser?.extensionsDir).toBe(".wingman/browser-extensions");
|
|
135
|
-
expect(config.browser?.extensions?.relay).toBe(".wingman/browser-extensions/relay");
|
|
136
|
-
expect(config.browser?.defaultExtensions).toContain("relay");
|
|
137
|
-
expect(existsSync(join(workspace, ".wingman", "browser-extensions", "relay"))).toBe(true);
|
|
138
|
-
});
|
|
139
|
-
it("installs bundled Wingman extension when no ID/source is provided", async ()=>{
|
|
140
|
-
await executeBrowserCommand({
|
|
141
|
-
subcommand: "extension",
|
|
142
|
-
args: [
|
|
143
|
-
"install"
|
|
144
|
-
],
|
|
145
|
-
verbosity: "silent",
|
|
146
|
-
outputMode: "json",
|
|
147
|
-
options: {
|
|
148
|
-
default: true
|
|
149
|
-
}
|
|
150
|
-
}, {
|
|
151
|
-
workspace
|
|
152
|
-
});
|
|
153
|
-
const configPath = join(workspace, ".wingman", "wingman.config.json");
|
|
154
|
-
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
155
|
-
expect(config.browser?.extensions?.wingman).toBe(".wingman/browser-extensions/wingman");
|
|
156
|
-
expect(config.browser?.defaultExtensions).toContain("wingman");
|
|
157
|
-
const manifestPath = join(workspace, ".wingman", "browser-extensions", "wingman", "manifest.json");
|
|
158
|
-
expect(existsSync(manifestPath)).toBe(true);
|
|
159
|
-
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
160
|
-
expect(manifest.name).toBe("Wingman Browser Relay");
|
|
161
|
-
expect(manifest.background?.service_worker).toBe("background.js");
|
|
162
|
-
expect(manifest.action?.default_title).toContain("Wingman Relay");
|
|
163
|
-
});
|
|
164
|
-
it("pairs extension relay with secure defaults and token", async ()=>{
|
|
165
|
-
await executeBrowserCommand({
|
|
166
|
-
subcommand: "extension",
|
|
167
|
-
args: [
|
|
168
|
-
"pair"
|
|
169
|
-
],
|
|
170
|
-
verbosity: "silent",
|
|
171
|
-
outputMode: "json",
|
|
172
|
-
options: {
|
|
173
|
-
token: "test-relay-token-123456",
|
|
174
|
-
port: 18792
|
|
175
|
-
}
|
|
176
|
-
}, {
|
|
177
|
-
workspace
|
|
178
|
-
});
|
|
179
|
-
const configPath = join(workspace, ".wingman", "wingman.config.json");
|
|
180
|
-
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
181
|
-
expect(config.browser?.relay).toMatchObject({
|
|
182
|
-
enabled: true,
|
|
183
|
-
host: "127.0.0.1",
|
|
184
|
-
port: 18792,
|
|
185
|
-
requireAuth: true,
|
|
186
|
-
authToken: "test-relay-token-123456"
|
|
187
|
-
});
|
|
188
|
-
expect(config.browser?.defaultExtensions).toContain("wingman");
|
|
189
|
-
expect(config.browser?.extensions?.wingman).toBe(".wingman/browser-extensions/wingman");
|
|
190
|
-
});
|
|
191
|
-
it("opens a profile with configured default extensions", async ()=>{
|
|
192
|
-
const profileDir = join(workspace, ".wingman", "browser-profiles", "trading");
|
|
193
|
-
const extensionDir = join(workspace, ".wingman", "browser-extensions", "relay");
|
|
194
|
-
mkdirSync(profileDir, {
|
|
195
|
-
recursive: true
|
|
196
|
-
});
|
|
197
|
-
mkdirSync(extensionDir, {
|
|
198
|
-
recursive: true
|
|
199
|
-
});
|
|
200
|
-
writeFileSync(join(extensionDir, "manifest.json"), JSON.stringify({
|
|
201
|
-
manifest_version: 3,
|
|
202
|
-
name: "Relay",
|
|
203
|
-
version: "1.0.0"
|
|
204
|
-
}));
|
|
205
|
-
const configRoot = join(workspace, ".wingman");
|
|
206
|
-
const configPath = join(configRoot, "wingman.config.json");
|
|
207
|
-
mkdirSync(configRoot, {
|
|
208
|
-
recursive: true
|
|
209
|
-
});
|
|
210
|
-
writeFileSync(configPath, JSON.stringify({
|
|
211
|
-
browser: {
|
|
212
|
-
profilesDir: ".wingman/browser-profiles",
|
|
213
|
-
defaultProfile: "trading",
|
|
214
|
-
profiles: {
|
|
215
|
-
trading: ".wingman/browser-profiles/trading"
|
|
216
|
-
},
|
|
217
|
-
extensionsDir: ".wingman/browser-extensions",
|
|
218
|
-
extensions: {
|
|
219
|
-
relay: ".wingman/browser-extensions/relay"
|
|
220
|
-
},
|
|
221
|
-
defaultExtensions: [
|
|
222
|
-
"relay"
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
}, null, 2));
|
|
226
|
-
let spawnedCommand = "";
|
|
227
|
-
let spawnedArgs = [];
|
|
228
|
-
let unrefCalled = false;
|
|
229
|
-
await executeBrowserCommand({
|
|
230
|
-
subcommand: "profile",
|
|
231
|
-
args: [
|
|
232
|
-
"open"
|
|
233
|
-
],
|
|
234
|
-
verbosity: "silent",
|
|
235
|
-
outputMode: "json",
|
|
236
|
-
options: {
|
|
237
|
-
url: "https://example.com/login"
|
|
238
|
-
}
|
|
239
|
-
}, {
|
|
240
|
-
workspace,
|
|
241
|
-
resolveExecutablePath: ()=>"/Applications/Google Chrome.app/chrome",
|
|
242
|
-
spawnProcess: (command, args)=>{
|
|
243
|
-
spawnedCommand = command;
|
|
244
|
-
spawnedArgs = args;
|
|
245
|
-
return {
|
|
246
|
-
unref: ()=>{
|
|
247
|
-
unrefCalled = true;
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
expect(spawnedCommand).toContain("Google Chrome");
|
|
253
|
-
expect(spawnedArgs).toContain("https://example.com/login");
|
|
254
|
-
expect(spawnedArgs.some((arg)=>arg.startsWith("--user-data-dir="))).toBe(true);
|
|
255
|
-
expect(spawnedArgs.some((arg)=>arg.startsWith("--load-extension="))).toBe(true);
|
|
256
|
-
expect(unrefCalled).toBe(true);
|
|
257
|
-
});
|
|
258
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_exports__ = {};
|
|
3
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
4
|
-
const browserRelayServer_cjs_namespaceObject = require("../gateway/browserRelayServer.cjs");
|
|
5
|
-
(0, external_vitest_namespaceObject.describe)("browser relay server", ()=>{
|
|
6
|
-
(0, external_vitest_namespaceObject.it)("accepts loopback hosts", ()=>{
|
|
7
|
-
(0, external_vitest_namespaceObject.expect)((0, browserRelayServer_cjs_namespaceObject.isLoopbackHost)("127.0.0.1")).toBe(true);
|
|
8
|
-
(0, external_vitest_namespaceObject.expect)((0, browserRelayServer_cjs_namespaceObject.isLoopbackHost)("localhost")).toBe(true);
|
|
9
|
-
(0, external_vitest_namespaceObject.expect)((0, browserRelayServer_cjs_namespaceObject.isLoopbackHost)("::1")).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
(0, external_vitest_namespaceObject.it)("rejects non-loopback hosts", ()=>{
|
|
12
|
-
(0, external_vitest_namespaceObject.expect)((0, browserRelayServer_cjs_namespaceObject.isLoopbackHost)("0.0.0.0")).toBe(false);
|
|
13
|
-
(0, external_vitest_namespaceObject.expect)((0, browserRelayServer_cjs_namespaceObject.isLoopbackHost)("192.168.1.4")).toBe(false);
|
|
14
|
-
(0, external_vitest_namespaceObject.expect)((0, browserRelayServer_cjs_namespaceObject.isLoopbackHost)("example.com")).toBe(false);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
18
|
-
Object.defineProperty(exports, '__esModule', {
|
|
19
|
-
value: true
|
|
20
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { isLoopbackHost } from "../gateway/browserRelayServer.js";
|
|
3
|
-
describe("browser relay server", ()=>{
|
|
4
|
-
it("accepts loopback hosts", ()=>{
|
|
5
|
-
expect(isLoopbackHost("127.0.0.1")).toBe(true);
|
|
6
|
-
expect(isLoopbackHost("localhost")).toBe(true);
|
|
7
|
-
expect(isLoopbackHost("::1")).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
it("rejects non-loopback hosts", ()=>{
|
|
10
|
-
expect(isLoopbackHost("0.0.0.0")).toBe(false);
|
|
11
|
-
expect(isLoopbackHost("192.168.1.4")).toBe(false);
|
|
12
|
-
expect(isLoopbackHost("example.com")).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
});
|