@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,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_exports__ = {};
|
|
3
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
4
|
-
const agentInvoker_cjs_namespaceObject = require("../cli/core/agentInvoker.cjs");
|
|
5
|
-
(0, external_vitest_namespaceObject.describe)("agentInvoker token usage extraction", ()=>{
|
|
6
|
-
(0, external_vitest_namespaceObject.it)("extracts usage from nested usage_metadata payloads", ()=>{
|
|
7
|
-
const usage = (0, agentInvoker_cjs_namespaceObject.extractTokenUsageSnapshot)({
|
|
8
|
-
event: "on_chat_model_end",
|
|
9
|
-
data: {
|
|
10
|
-
output: {
|
|
11
|
-
usage_metadata: {
|
|
12
|
-
input_tokens: 8420,
|
|
13
|
-
output_tokens: 512,
|
|
14
|
-
total_tokens: 8932
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
(0, external_vitest_namespaceObject.expect)(usage).toEqual({
|
|
20
|
-
inputTokens: 8420,
|
|
21
|
-
outputTokens: 512,
|
|
22
|
-
totalTokens: 8932
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
(0, external_vitest_namespaceObject.it)("extracts usage from explicit tokenUsage payloads", ()=>{
|
|
26
|
-
const usage = (0, agentInvoker_cjs_namespaceObject.extractTokenUsageSnapshot)({
|
|
27
|
-
tokenUsage: {
|
|
28
|
-
inputTokens: 9300,
|
|
29
|
-
outputTokens: 712,
|
|
30
|
-
totalTokens: 10012
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
(0, external_vitest_namespaceObject.expect)(usage).toEqual({
|
|
34
|
-
inputTokens: 9300,
|
|
35
|
-
outputTokens: 712,
|
|
36
|
-
totalTokens: 10012
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
(0, external_vitest_namespaceObject.it)("merges snapshots by keeping the highest observed counters", ()=>{
|
|
40
|
-
const merged = (0, agentInvoker_cjs_namespaceObject.mergeTokenUsageSnapshots)({
|
|
41
|
-
inputTokens: 4000,
|
|
42
|
-
outputTokens: 300,
|
|
43
|
-
totalTokens: 4300
|
|
44
|
-
}, {
|
|
45
|
-
inputTokens: 6200,
|
|
46
|
-
outputTokens: 280,
|
|
47
|
-
totalTokens: 6480
|
|
48
|
-
});
|
|
49
|
-
(0, external_vitest_namespaceObject.expect)(merged).toEqual({
|
|
50
|
-
inputTokens: 6200,
|
|
51
|
-
outputTokens: 300,
|
|
52
|
-
totalTokens: 6480
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
(0, external_vitest_namespaceObject.it)("estimates context tokens from stream chunks containing message arrays", ()=>{
|
|
56
|
-
const toolCalls = [
|
|
57
|
-
{
|
|
58
|
-
id: "call-1",
|
|
59
|
-
name: "search",
|
|
60
|
-
args: {
|
|
61
|
-
q: "wingman"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
];
|
|
65
|
-
const estimate = (0, agentInvoker_cjs_namespaceObject.estimateContextTokensFromChunk)({
|
|
66
|
-
event: "on_chain_start",
|
|
67
|
-
data: {
|
|
68
|
-
input: {
|
|
69
|
-
messages: [
|
|
70
|
-
{
|
|
71
|
-
id: [
|
|
72
|
-
"langchain_core",
|
|
73
|
-
"messages",
|
|
74
|
-
"HumanMessage"
|
|
75
|
-
],
|
|
76
|
-
kwargs: {
|
|
77
|
-
content: "Hello there"
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: [
|
|
82
|
-
"langchain_core",
|
|
83
|
-
"messages",
|
|
84
|
-
"AIMessage"
|
|
85
|
-
],
|
|
86
|
-
kwargs: {
|
|
87
|
-
content: "I can help with that.",
|
|
88
|
-
tool_calls: toolCalls
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
id: [
|
|
93
|
-
"langchain_core",
|
|
94
|
-
"messages",
|
|
95
|
-
"ToolMessage"
|
|
96
|
-
],
|
|
97
|
-
kwargs: {
|
|
98
|
-
content: "Search complete",
|
|
99
|
-
tool_call_id: "call-1"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
const expectedChars = 32 + JSON.stringify(toolCalls).length + 15 + 6;
|
|
107
|
-
(0, external_vitest_namespaceObject.expect)(estimate).toBe(Math.ceil(expectedChars / 4));
|
|
108
|
-
});
|
|
109
|
-
(0, external_vitest_namespaceObject.it)("returns null when no message arrays are present", ()=>{
|
|
110
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.estimateContextTokensFromChunk)({
|
|
111
|
-
event: "on_tool_start",
|
|
112
|
-
name: "read_file",
|
|
113
|
-
data: {
|
|
114
|
-
input: {
|
|
115
|
-
path: "/tmp/file.txt"
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
})).toBeNull();
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
122
|
-
Object.defineProperty(exports, '__esModule', {
|
|
123
|
-
value: true
|
|
124
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { estimateContextTokensFromChunk, extractTokenUsageSnapshot, mergeTokenUsageSnapshots } from "../cli/core/agentInvoker.js";
|
|
3
|
-
describe("agentInvoker token usage extraction", ()=>{
|
|
4
|
-
it("extracts usage from nested usage_metadata payloads", ()=>{
|
|
5
|
-
const usage = extractTokenUsageSnapshot({
|
|
6
|
-
event: "on_chat_model_end",
|
|
7
|
-
data: {
|
|
8
|
-
output: {
|
|
9
|
-
usage_metadata: {
|
|
10
|
-
input_tokens: 8420,
|
|
11
|
-
output_tokens: 512,
|
|
12
|
-
total_tokens: 8932
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
expect(usage).toEqual({
|
|
18
|
-
inputTokens: 8420,
|
|
19
|
-
outputTokens: 512,
|
|
20
|
-
totalTokens: 8932
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
it("extracts usage from explicit tokenUsage payloads", ()=>{
|
|
24
|
-
const usage = extractTokenUsageSnapshot({
|
|
25
|
-
tokenUsage: {
|
|
26
|
-
inputTokens: 9300,
|
|
27
|
-
outputTokens: 712,
|
|
28
|
-
totalTokens: 10012
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
expect(usage).toEqual({
|
|
32
|
-
inputTokens: 9300,
|
|
33
|
-
outputTokens: 712,
|
|
34
|
-
totalTokens: 10012
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
it("merges snapshots by keeping the highest observed counters", ()=>{
|
|
38
|
-
const merged = mergeTokenUsageSnapshots({
|
|
39
|
-
inputTokens: 4000,
|
|
40
|
-
outputTokens: 300,
|
|
41
|
-
totalTokens: 4300
|
|
42
|
-
}, {
|
|
43
|
-
inputTokens: 6200,
|
|
44
|
-
outputTokens: 280,
|
|
45
|
-
totalTokens: 6480
|
|
46
|
-
});
|
|
47
|
-
expect(merged).toEqual({
|
|
48
|
-
inputTokens: 6200,
|
|
49
|
-
outputTokens: 300,
|
|
50
|
-
totalTokens: 6480
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
it("estimates context tokens from stream chunks containing message arrays", ()=>{
|
|
54
|
-
const toolCalls = [
|
|
55
|
-
{
|
|
56
|
-
id: "call-1",
|
|
57
|
-
name: "search",
|
|
58
|
-
args: {
|
|
59
|
-
q: "wingman"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
|
-
const estimate = estimateContextTokensFromChunk({
|
|
64
|
-
event: "on_chain_start",
|
|
65
|
-
data: {
|
|
66
|
-
input: {
|
|
67
|
-
messages: [
|
|
68
|
-
{
|
|
69
|
-
id: [
|
|
70
|
-
"langchain_core",
|
|
71
|
-
"messages",
|
|
72
|
-
"HumanMessage"
|
|
73
|
-
],
|
|
74
|
-
kwargs: {
|
|
75
|
-
content: "Hello there"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: [
|
|
80
|
-
"langchain_core",
|
|
81
|
-
"messages",
|
|
82
|
-
"AIMessage"
|
|
83
|
-
],
|
|
84
|
-
kwargs: {
|
|
85
|
-
content: "I can help with that.",
|
|
86
|
-
tool_calls: toolCalls
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: [
|
|
91
|
-
"langchain_core",
|
|
92
|
-
"messages",
|
|
93
|
-
"ToolMessage"
|
|
94
|
-
],
|
|
95
|
-
kwargs: {
|
|
96
|
-
content: "Search complete",
|
|
97
|
-
tool_call_id: "call-1"
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
const expectedChars = 32 + JSON.stringify(toolCalls).length + 15 + 6;
|
|
105
|
-
expect(estimate).toBe(Math.ceil(expectedChars / 4));
|
|
106
|
-
});
|
|
107
|
-
it("returns null when no message arrays are present", ()=>{
|
|
108
|
-
expect(estimateContextTokensFromChunk({
|
|
109
|
-
event: "on_tool_start",
|
|
110
|
-
name: "read_file",
|
|
111
|
-
data: {
|
|
112
|
-
input: {
|
|
113
|
-
path: "/tmp/file.txt"
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
})).toBeNull();
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
|
-
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: definition[key]
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
})();
|
|
20
|
-
(()=>{
|
|
21
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
-
})();
|
|
23
|
-
var __webpack_exports__ = {};
|
|
24
|
-
const external_node_fs_namespaceObject = require("node:fs");
|
|
25
|
-
const external_node_os_namespaceObject = require("node:os");
|
|
26
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
27
|
-
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
28
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
29
|
-
const agentInvoker_cjs_namespaceObject = require("../cli/core/agentInvoker.cjs");
|
|
30
|
-
(0, external_vitest_namespaceObject.describe)("resolveExternalOutputMount", ()=>{
|
|
31
|
-
const workspace = external_node_path_default().resolve("workspace");
|
|
32
|
-
(0, external_vitest_namespaceObject.it)("mounts external workdir paths", ()=>{
|
|
33
|
-
const workdir = external_node_path_default().resolve("outside", "session-output");
|
|
34
|
-
const mount = (0, agentInvoker_cjs_namespaceObject.resolveExternalOutputMount)(workspace, workdir, null);
|
|
35
|
-
(0, external_vitest_namespaceObject.expect)(mount).toEqual({
|
|
36
|
-
virtualPath: agentInvoker_cjs_namespaceObject.WORKDIR_VIRTUAL_PATH,
|
|
37
|
-
absolutePath: workdir
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
(0, external_vitest_namespaceObject.it)("does not mount workdir when it is inside workspace", ()=>{
|
|
41
|
-
const workdir = external_node_path_default().join(workspace, "outputs");
|
|
42
|
-
const mount = (0, agentInvoker_cjs_namespaceObject.resolveExternalOutputMount)(workspace, workdir, null);
|
|
43
|
-
(0, external_vitest_namespaceObject.expect)(mount).toEqual({
|
|
44
|
-
virtualPath: null,
|
|
45
|
-
absolutePath: null
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
(0, external_vitest_namespaceObject.it)("mounts external default output when no workdir is set", ()=>{
|
|
49
|
-
const defaultOutputDir = external_node_path_default().resolve("external-default-output");
|
|
50
|
-
const mount = (0, agentInvoker_cjs_namespaceObject.resolveExternalOutputMount)(workspace, null, defaultOutputDir);
|
|
51
|
-
(0, external_vitest_namespaceObject.expect)(mount).toEqual({
|
|
52
|
-
virtualPath: agentInvoker_cjs_namespaceObject.OUTPUT_VIRTUAL_PATH,
|
|
53
|
-
absolutePath: defaultOutputDir
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
(0, external_vitest_namespaceObject.it)("prefers workdir mount over default output mount", ()=>{
|
|
57
|
-
const workdir = external_node_path_default().resolve("outside", "session-output");
|
|
58
|
-
const defaultOutputDir = external_node_path_default().resolve("external-default-output");
|
|
59
|
-
const mount = (0, agentInvoker_cjs_namespaceObject.resolveExternalOutputMount)(workspace, workdir, defaultOutputDir);
|
|
60
|
-
(0, external_vitest_namespaceObject.expect)(mount).toEqual({
|
|
61
|
-
virtualPath: agentInvoker_cjs_namespaceObject.WORKDIR_VIRTUAL_PATH,
|
|
62
|
-
absolutePath: workdir
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
(0, external_vitest_namespaceObject.it)("does not request an extra external mount when workdir is execution workspace", ()=>{
|
|
66
|
-
const executionWorkspace = external_node_path_default().resolve("outside", "session-output");
|
|
67
|
-
const mount = (0, agentInvoker_cjs_namespaceObject.resolveExternalOutputMount)(executionWorkspace, executionWorkspace, external_node_path_default().resolve("external-default-output"));
|
|
68
|
-
(0, external_vitest_namespaceObject.expect)(mount).toEqual({
|
|
69
|
-
virtualPath: null,
|
|
70
|
-
absolutePath: null
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
(0, external_vitest_namespaceObject.describe)("resolveExecutionWorkspace", ()=>{
|
|
75
|
-
const workspace = external_node_path_default().resolve("workspace");
|
|
76
|
-
(0, external_vitest_namespaceObject.it)("uses workspace when workdir is not set", ()=>{
|
|
77
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.resolveExecutionWorkspace)(workspace, null)).toBe(external_node_path_default().normalize(workspace));
|
|
78
|
-
});
|
|
79
|
-
(0, external_vitest_namespaceObject.it)("resolves relative workdir from workspace", ()=>{
|
|
80
|
-
const resolved = (0, agentInvoker_cjs_namespaceObject.resolveExecutionWorkspace)(workspace, "outputs/session");
|
|
81
|
-
(0, external_vitest_namespaceObject.expect)(resolved).toBe(external_node_path_default().normalize(external_node_path_default().join(workspace, "outputs/session")));
|
|
82
|
-
});
|
|
83
|
-
(0, external_vitest_namespaceObject.it)("uses absolute workdir directly", ()=>{
|
|
84
|
-
const absolute = external_node_path_default().resolve("outside", "session-output");
|
|
85
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.resolveExecutionWorkspace)(workspace, absolute)).toBe(external_node_path_default().normalize(absolute));
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
(0, external_vitest_namespaceObject.describe)("resolveAgentExecutionWorkspace", ()=>{
|
|
89
|
-
const workspace = external_node_path_default().resolve("workspace");
|
|
90
|
-
(0, external_vitest_namespaceObject.it)("prefers explicit workdir over default output dir", ()=>{
|
|
91
|
-
const workdir = external_node_path_default().resolve("outside", "session-output");
|
|
92
|
-
const defaultOutputDir = external_node_path_default().resolve("outside", "default-output");
|
|
93
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.resolveAgentExecutionWorkspace)(workspace, workdir, defaultOutputDir)).toBe(external_node_path_default().normalize(workdir));
|
|
94
|
-
});
|
|
95
|
-
(0, external_vitest_namespaceObject.it)("uses default output dir when session workdir is unset", ()=>{
|
|
96
|
-
const defaultOutputDir = external_node_path_default().resolve("outside", "default-output");
|
|
97
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.resolveAgentExecutionWorkspace)(workspace, null, defaultOutputDir)).toBe(external_node_path_default().normalize(defaultOutputDir));
|
|
98
|
-
});
|
|
99
|
-
(0, external_vitest_namespaceObject.it)("falls back to workspace when neither workdir nor default output dir exist", ()=>{
|
|
100
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.resolveAgentExecutionWorkspace)(workspace, null, null)).toBe(external_node_path_default().normalize(workspace));
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
(0, external_vitest_namespaceObject.describe)("toWorkspaceAliasVirtualPath", ()=>{
|
|
104
|
-
(0, external_vitest_namespaceObject.it)("builds an alias path for absolute workspaces", ()=>{
|
|
105
|
-
const absolute = external_node_path_default().resolve("outside", "session-output");
|
|
106
|
-
const alias = (0, agentInvoker_cjs_namespaceObject.toWorkspaceAliasVirtualPath)(absolute);
|
|
107
|
-
const expected = `/${absolute.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "")}/`;
|
|
108
|
-
(0, external_vitest_namespaceObject.expect)(alias).toBe(expected);
|
|
109
|
-
});
|
|
110
|
-
(0, external_vitest_namespaceObject.it)("returns null for non-absolute workspace paths", ()=>{
|
|
111
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.toWorkspaceAliasVirtualPath)("relative/workspace")).toBeNull();
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
(0, external_vitest_namespaceObject.describe)("resolveAgentMemorySources", ()=>{
|
|
115
|
-
const tempDirs = [];
|
|
116
|
-
(0, external_vitest_namespaceObject.afterEach)(()=>{
|
|
117
|
-
for (const dir of tempDirs)(0, external_node_fs_namespaceObject.rmSync)(dir, {
|
|
118
|
-
recursive: true,
|
|
119
|
-
force: true
|
|
120
|
-
});
|
|
121
|
-
tempDirs.length = 0;
|
|
122
|
-
});
|
|
123
|
-
(0, external_vitest_namespaceObject.it)("returns /AGENTS.md when present in execution workspace", ()=>{
|
|
124
|
-
const workspace = (0, external_node_fs_namespaceObject.mkdtempSync)(external_node_path_default().join((0, external_node_os_namespaceObject.tmpdir)(), "wingman-memory-"));
|
|
125
|
-
tempDirs.push(workspace);
|
|
126
|
-
(0, external_node_fs_namespaceObject.writeFileSync)(external_node_path_default().join(workspace, "AGENTS.md"), "# Agent Memory");
|
|
127
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.resolveAgentMemorySources)(workspace)).toEqual([
|
|
128
|
-
"/AGENTS.md"
|
|
129
|
-
]);
|
|
130
|
-
});
|
|
131
|
-
(0, external_vitest_namespaceObject.it)("returns no sources when AGENTS.md is absent", ()=>{
|
|
132
|
-
const workspace = (0, external_node_fs_namespaceObject.mkdtempSync)(external_node_path_default().join((0, external_node_os_namespaceObject.tmpdir)(), "wingman-memory-"));
|
|
133
|
-
tempDirs.push(workspace);
|
|
134
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.resolveAgentMemorySources)(workspace)).toEqual([]);
|
|
135
|
-
});
|
|
136
|
-
(0, external_vitest_namespaceObject.it)("ignores .deepagents/AGENTS.md when top-level AGENTS.md is missing", ()=>{
|
|
137
|
-
const workspace = (0, external_node_fs_namespaceObject.mkdtempSync)(external_node_path_default().join((0, external_node_os_namespaceObject.tmpdir)(), "wingman-memory-"));
|
|
138
|
-
tempDirs.push(workspace);
|
|
139
|
-
const deepagentsDir = external_node_path_default().join(workspace, ".deepagents");
|
|
140
|
-
(0, external_node_fs_namespaceObject.mkdirSync)(deepagentsDir, {
|
|
141
|
-
recursive: true
|
|
142
|
-
});
|
|
143
|
-
(0, external_node_fs_namespaceObject.writeFileSync)(external_node_path_default().join(deepagentsDir, "AGENTS.md"), "# Nested Memory");
|
|
144
|
-
(0, external_vitest_namespaceObject.expect)((0, agentInvoker_cjs_namespaceObject.resolveAgentMemorySources)(workspace)).toEqual([]);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
148
|
-
Object.defineProperty(exports, '__esModule', {
|
|
149
|
-
value: true
|
|
150
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import node_path from "node:path";
|
|
4
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
5
|
-
import { OUTPUT_VIRTUAL_PATH, WORKDIR_VIRTUAL_PATH, resolveAgentExecutionWorkspace, resolveAgentMemorySources, resolveExecutionWorkspace, resolveExternalOutputMount, toWorkspaceAliasVirtualPath } from "../cli/core/agentInvoker.js";
|
|
6
|
-
describe("resolveExternalOutputMount", ()=>{
|
|
7
|
-
const workspace = node_path.resolve("workspace");
|
|
8
|
-
it("mounts external workdir paths", ()=>{
|
|
9
|
-
const workdir = node_path.resolve("outside", "session-output");
|
|
10
|
-
const mount = resolveExternalOutputMount(workspace, workdir, null);
|
|
11
|
-
expect(mount).toEqual({
|
|
12
|
-
virtualPath: WORKDIR_VIRTUAL_PATH,
|
|
13
|
-
absolutePath: workdir
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
it("does not mount workdir when it is inside workspace", ()=>{
|
|
17
|
-
const workdir = node_path.join(workspace, "outputs");
|
|
18
|
-
const mount = resolveExternalOutputMount(workspace, workdir, null);
|
|
19
|
-
expect(mount).toEqual({
|
|
20
|
-
virtualPath: null,
|
|
21
|
-
absolutePath: null
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
it("mounts external default output when no workdir is set", ()=>{
|
|
25
|
-
const defaultOutputDir = node_path.resolve("external-default-output");
|
|
26
|
-
const mount = resolveExternalOutputMount(workspace, null, defaultOutputDir);
|
|
27
|
-
expect(mount).toEqual({
|
|
28
|
-
virtualPath: OUTPUT_VIRTUAL_PATH,
|
|
29
|
-
absolutePath: defaultOutputDir
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
it("prefers workdir mount over default output mount", ()=>{
|
|
33
|
-
const workdir = node_path.resolve("outside", "session-output");
|
|
34
|
-
const defaultOutputDir = node_path.resolve("external-default-output");
|
|
35
|
-
const mount = resolveExternalOutputMount(workspace, workdir, defaultOutputDir);
|
|
36
|
-
expect(mount).toEqual({
|
|
37
|
-
virtualPath: WORKDIR_VIRTUAL_PATH,
|
|
38
|
-
absolutePath: workdir
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
it("does not request an extra external mount when workdir is execution workspace", ()=>{
|
|
42
|
-
const executionWorkspace = node_path.resolve("outside", "session-output");
|
|
43
|
-
const mount = resolveExternalOutputMount(executionWorkspace, executionWorkspace, node_path.resolve("external-default-output"));
|
|
44
|
-
expect(mount).toEqual({
|
|
45
|
-
virtualPath: null,
|
|
46
|
-
absolutePath: null
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
describe("resolveExecutionWorkspace", ()=>{
|
|
51
|
-
const workspace = node_path.resolve("workspace");
|
|
52
|
-
it("uses workspace when workdir is not set", ()=>{
|
|
53
|
-
expect(resolveExecutionWorkspace(workspace, null)).toBe(node_path.normalize(workspace));
|
|
54
|
-
});
|
|
55
|
-
it("resolves relative workdir from workspace", ()=>{
|
|
56
|
-
const resolved = resolveExecutionWorkspace(workspace, "outputs/session");
|
|
57
|
-
expect(resolved).toBe(node_path.normalize(node_path.join(workspace, "outputs/session")));
|
|
58
|
-
});
|
|
59
|
-
it("uses absolute workdir directly", ()=>{
|
|
60
|
-
const absolute = node_path.resolve("outside", "session-output");
|
|
61
|
-
expect(resolveExecutionWorkspace(workspace, absolute)).toBe(node_path.normalize(absolute));
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
describe("resolveAgentExecutionWorkspace", ()=>{
|
|
65
|
-
const workspace = node_path.resolve("workspace");
|
|
66
|
-
it("prefers explicit workdir over default output dir", ()=>{
|
|
67
|
-
const workdir = node_path.resolve("outside", "session-output");
|
|
68
|
-
const defaultOutputDir = node_path.resolve("outside", "default-output");
|
|
69
|
-
expect(resolveAgentExecutionWorkspace(workspace, workdir, defaultOutputDir)).toBe(node_path.normalize(workdir));
|
|
70
|
-
});
|
|
71
|
-
it("uses default output dir when session workdir is unset", ()=>{
|
|
72
|
-
const defaultOutputDir = node_path.resolve("outside", "default-output");
|
|
73
|
-
expect(resolveAgentExecutionWorkspace(workspace, null, defaultOutputDir)).toBe(node_path.normalize(defaultOutputDir));
|
|
74
|
-
});
|
|
75
|
-
it("falls back to workspace when neither workdir nor default output dir exist", ()=>{
|
|
76
|
-
expect(resolveAgentExecutionWorkspace(workspace, null, null)).toBe(node_path.normalize(workspace));
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
describe("toWorkspaceAliasVirtualPath", ()=>{
|
|
80
|
-
it("builds an alias path for absolute workspaces", ()=>{
|
|
81
|
-
const absolute = node_path.resolve("outside", "session-output");
|
|
82
|
-
const alias = toWorkspaceAliasVirtualPath(absolute);
|
|
83
|
-
const expected = `/${absolute.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "")}/`;
|
|
84
|
-
expect(alias).toBe(expected);
|
|
85
|
-
});
|
|
86
|
-
it("returns null for non-absolute workspace paths", ()=>{
|
|
87
|
-
expect(toWorkspaceAliasVirtualPath("relative/workspace")).toBeNull();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
describe("resolveAgentMemorySources", ()=>{
|
|
91
|
-
const tempDirs = [];
|
|
92
|
-
afterEach(()=>{
|
|
93
|
-
for (const dir of tempDirs)rmSync(dir, {
|
|
94
|
-
recursive: true,
|
|
95
|
-
force: true
|
|
96
|
-
});
|
|
97
|
-
tempDirs.length = 0;
|
|
98
|
-
});
|
|
99
|
-
it("returns /AGENTS.md when present in execution workspace", ()=>{
|
|
100
|
-
const workspace = mkdtempSync(node_path.join(tmpdir(), "wingman-memory-"));
|
|
101
|
-
tempDirs.push(workspace);
|
|
102
|
-
writeFileSync(node_path.join(workspace, "AGENTS.md"), "# Agent Memory");
|
|
103
|
-
expect(resolveAgentMemorySources(workspace)).toEqual([
|
|
104
|
-
"/AGENTS.md"
|
|
105
|
-
]);
|
|
106
|
-
});
|
|
107
|
-
it("returns no sources when AGENTS.md is absent", ()=>{
|
|
108
|
-
const workspace = mkdtempSync(node_path.join(tmpdir(), "wingman-memory-"));
|
|
109
|
-
tempDirs.push(workspace);
|
|
110
|
-
expect(resolveAgentMemorySources(workspace)).toEqual([]);
|
|
111
|
-
});
|
|
112
|
-
it("ignores .deepagents/AGENTS.md when top-level AGENTS.md is missing", ()=>{
|
|
113
|
-
const workspace = mkdtempSync(node_path.join(tmpdir(), "wingman-memory-"));
|
|
114
|
-
tempDirs.push(workspace);
|
|
115
|
-
const deepagentsDir = node_path.join(workspace, ".deepagents");
|
|
116
|
-
mkdirSync(deepagentsDir, {
|
|
117
|
-
recursive: true
|
|
118
|
-
});
|
|
119
|
-
writeFileSync(node_path.join(deepagentsDir, "AGENTS.md"), "# Nested Memory");
|
|
120
|
-
expect(resolveAgentMemorySources(workspace)).toEqual([]);
|
|
121
|
-
});
|
|
122
|
-
});
|