@wingman-ai/gateway 0.5.2 → 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-D07GBGp0.js +0 -215
- package/dist/webui/assets/index-DV8IYeOw.css +0 -11
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
2
|
-
import { AgentLoader } from "../../agent/config/agentLoader.js";
|
|
3
|
-
import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
|
4
|
-
import { join } from "path";
|
|
5
|
-
import { tmpdir } from "os";
|
|
6
|
-
describe("Agent Invocation Integration", ()=>{
|
|
7
|
-
let testDir;
|
|
8
|
-
let configDir;
|
|
9
|
-
let agentsDir;
|
|
10
|
-
beforeEach(()=>{
|
|
11
|
-
testDir = join(tmpdir(), `wingman-integration-${Date.now()}`);
|
|
12
|
-
configDir = join(testDir, ".wingman");
|
|
13
|
-
agentsDir = join(configDir, "agents");
|
|
14
|
-
mkdirSync(agentsDir, {
|
|
15
|
-
recursive: true
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
afterEach(()=>{
|
|
19
|
-
if (existsSync(testDir)) rmSync(testDir, {
|
|
20
|
-
recursive: true,
|
|
21
|
-
force: true
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
describe("Agent Loading", ()=>{
|
|
25
|
-
it("should load agent with tools", ()=>{
|
|
26
|
-
const agentConfig = {
|
|
27
|
-
name: "test-agent",
|
|
28
|
-
description: "Test agent for integration testing",
|
|
29
|
-
systemPrompt: "You are a test agent",
|
|
30
|
-
tools: [
|
|
31
|
-
"think",
|
|
32
|
-
"internet_search"
|
|
33
|
-
]
|
|
34
|
-
};
|
|
35
|
-
const agentDir = join(agentsDir, "test-agent");
|
|
36
|
-
mkdirSync(agentDir, {
|
|
37
|
-
recursive: true
|
|
38
|
-
});
|
|
39
|
-
writeFileSync(join(agentDir, "agent.json"), JSON.stringify(agentConfig));
|
|
40
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
41
|
-
const agents = loader.loadAllAgentConfigs();
|
|
42
|
-
expect(agents).toHaveLength(1);
|
|
43
|
-
expect(agents[0].name).toBe("test-agent");
|
|
44
|
-
expect(agents[0].tools).toEqual([
|
|
45
|
-
"think",
|
|
46
|
-
"internet_search"
|
|
47
|
-
]);
|
|
48
|
-
});
|
|
49
|
-
it("should load multiple agents", ()=>{
|
|
50
|
-
const agent1Config = {
|
|
51
|
-
name: "agent1",
|
|
52
|
-
description: "First test agent",
|
|
53
|
-
systemPrompt: "You are agent 1",
|
|
54
|
-
tools: [
|
|
55
|
-
"think"
|
|
56
|
-
]
|
|
57
|
-
};
|
|
58
|
-
const agent2Config = {
|
|
59
|
-
name: "agent2",
|
|
60
|
-
description: "Second test agent",
|
|
61
|
-
systemPrompt: "You are agent 2",
|
|
62
|
-
tools: [
|
|
63
|
-
"internet_search"
|
|
64
|
-
]
|
|
65
|
-
};
|
|
66
|
-
const agent1Dir = join(agentsDir, "agent1");
|
|
67
|
-
const agent2Dir = join(agentsDir, "agent2");
|
|
68
|
-
mkdirSync(agent1Dir, {
|
|
69
|
-
recursive: true
|
|
70
|
-
});
|
|
71
|
-
mkdirSync(agent2Dir, {
|
|
72
|
-
recursive: true
|
|
73
|
-
});
|
|
74
|
-
writeFileSync(join(agent1Dir, "agent.json"), JSON.stringify(agent1Config));
|
|
75
|
-
writeFileSync(join(agent2Dir, "agent.json"), JSON.stringify(agent2Config));
|
|
76
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
77
|
-
const agents = loader.loadAllAgentConfigs();
|
|
78
|
-
expect(agents).toHaveLength(2);
|
|
79
|
-
expect(agents.map((a)=>a.name)).toContain("agent1");
|
|
80
|
-
expect(agents.map((a)=>a.name)).toContain("agent2");
|
|
81
|
-
});
|
|
82
|
-
it("should create agent with command_execute tool and safety options", ()=>{
|
|
83
|
-
const agentConfig = {
|
|
84
|
-
name: "coder-agent",
|
|
85
|
-
description: "Agent with command execution",
|
|
86
|
-
systemPrompt: "You are a coding agent",
|
|
87
|
-
tools: [
|
|
88
|
-
"command_execute"
|
|
89
|
-
],
|
|
90
|
-
blockedCommands: [
|
|
91
|
-
"rm",
|
|
92
|
-
"sudo"
|
|
93
|
-
],
|
|
94
|
-
allowScriptExecution: false,
|
|
95
|
-
commandTimeout: 30000
|
|
96
|
-
};
|
|
97
|
-
const agentDir = join(agentsDir, "coder-agent");
|
|
98
|
-
mkdirSync(agentDir, {
|
|
99
|
-
recursive: true
|
|
100
|
-
});
|
|
101
|
-
writeFileSync(join(agentDir, "agent.json"), JSON.stringify(agentConfig));
|
|
102
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
103
|
-
const agents = loader.loadAllAgentConfigs();
|
|
104
|
-
expect(agents).toHaveLength(1);
|
|
105
|
-
expect(agents[0].name).toBe("coder-agent");
|
|
106
|
-
expect(agents[0].tools).toEqual([
|
|
107
|
-
"command_execute"
|
|
108
|
-
]);
|
|
109
|
-
expect(agents[0].blockedCommands).toEqual([
|
|
110
|
-
"rm",
|
|
111
|
-
"sudo"
|
|
112
|
-
]);
|
|
113
|
-
expect(agents[0].allowScriptExecution).toBe(false);
|
|
114
|
-
expect(agents[0].commandTimeout).toBe(30000);
|
|
115
|
-
});
|
|
116
|
-
it("should find specific agent by name", async ()=>{
|
|
117
|
-
const agentConfig = {
|
|
118
|
-
name: "specific-agent",
|
|
119
|
-
description: "Specific test agent",
|
|
120
|
-
systemPrompt: "You are a specific agent"
|
|
121
|
-
};
|
|
122
|
-
const agentDir = join(agentsDir, "specific-agent");
|
|
123
|
-
mkdirSync(agentDir, {
|
|
124
|
-
recursive: true
|
|
125
|
-
});
|
|
126
|
-
writeFileSync(join(agentDir, "agent.json"), JSON.stringify(agentConfig));
|
|
127
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
128
|
-
const agent = await loader.loadAgent("specific-agent");
|
|
129
|
-
expect(agent).toBeDefined();
|
|
130
|
-
expect(agent?.name).toBe("specific-agent");
|
|
131
|
-
});
|
|
132
|
-
it("should return undefined for non-existent agent", async ()=>{
|
|
133
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
134
|
-
const agent = await loader.loadAgent("non-existent-agent");
|
|
135
|
-
expect(agent).toBeUndefined();
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe("Agent Configuration Validation", ()=>{
|
|
139
|
-
it("should skip agents with invalid configuration", ()=>{
|
|
140
|
-
const validConfig = {
|
|
141
|
-
name: "valid-agent",
|
|
142
|
-
description: "Valid agent",
|
|
143
|
-
systemPrompt: "You are valid"
|
|
144
|
-
};
|
|
145
|
-
const invalidConfig = {
|
|
146
|
-
name: "invalid-agent"
|
|
147
|
-
};
|
|
148
|
-
const validDir = join(agentsDir, "valid-agent");
|
|
149
|
-
const invalidDir = join(agentsDir, "invalid-agent");
|
|
150
|
-
mkdirSync(validDir, {
|
|
151
|
-
recursive: true
|
|
152
|
-
});
|
|
153
|
-
mkdirSync(invalidDir, {
|
|
154
|
-
recursive: true
|
|
155
|
-
});
|
|
156
|
-
writeFileSync(join(validDir, "agent.json"), JSON.stringify(validConfig));
|
|
157
|
-
writeFileSync(join(invalidDir, "agent.json"), JSON.stringify(invalidConfig));
|
|
158
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
159
|
-
const agents = loader.loadAllAgentConfigs();
|
|
160
|
-
expect(agents).toHaveLength(1);
|
|
161
|
-
expect(agents[0].name).toBe("valid-agent");
|
|
162
|
-
});
|
|
163
|
-
it("should skip agents with invalid tool names", ()=>{
|
|
164
|
-
const agentConfig = {
|
|
165
|
-
name: "test-agent",
|
|
166
|
-
description: "Test agent with invalid tool",
|
|
167
|
-
systemPrompt: "You are a test agent",
|
|
168
|
-
tools: [
|
|
169
|
-
"invalid_tool"
|
|
170
|
-
]
|
|
171
|
-
};
|
|
172
|
-
const agentDir = join(agentsDir, "test-agent");
|
|
173
|
-
mkdirSync(agentDir, {
|
|
174
|
-
recursive: true
|
|
175
|
-
});
|
|
176
|
-
writeFileSync(join(agentDir, "agent.json"), JSON.stringify(agentConfig));
|
|
177
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
178
|
-
const agents = loader.loadAllAgentConfigs();
|
|
179
|
-
expect(agents).toHaveLength(0);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
describe("Agent with Model Override", ()=>{
|
|
183
|
-
it("should support model override", ()=>{
|
|
184
|
-
const agentConfig = {
|
|
185
|
-
name: "custom-model-agent",
|
|
186
|
-
description: "Agent with custom model",
|
|
187
|
-
systemPrompt: "You are an agent with custom model",
|
|
188
|
-
model: "anthropic:claude-opus-4-5"
|
|
189
|
-
};
|
|
190
|
-
const agentDir = join(agentsDir, "custom-model-agent");
|
|
191
|
-
mkdirSync(agentDir, {
|
|
192
|
-
recursive: true
|
|
193
|
-
});
|
|
194
|
-
writeFileSync(join(agentDir, "agent.json"), JSON.stringify(agentConfig));
|
|
195
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
196
|
-
const agents = loader.loadAllAgentConfigs();
|
|
197
|
-
expect(agents).toHaveLength(1);
|
|
198
|
-
expect(agents[0].name).toBe("custom-model-agent");
|
|
199
|
-
expect(agents[0].model).toBeDefined();
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
describe("Subagent Loading", ()=>{
|
|
203
|
-
it("should load agent with subagents", ()=>{
|
|
204
|
-
const agentConfig = {
|
|
205
|
-
name: "parent-agent",
|
|
206
|
-
description: "Parent agent with subagents",
|
|
207
|
-
systemPrompt: "You are a parent agent",
|
|
208
|
-
subagents: [
|
|
209
|
-
{
|
|
210
|
-
name: "subagent1",
|
|
211
|
-
description: "First subagent",
|
|
212
|
-
systemPrompt: "You are subagent 1",
|
|
213
|
-
tools: [
|
|
214
|
-
"think"
|
|
215
|
-
]
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
name: "subagent2",
|
|
219
|
-
description: "Second subagent",
|
|
220
|
-
systemPrompt: "You are subagent 2",
|
|
221
|
-
tools: [
|
|
222
|
-
"internet_search"
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
]
|
|
226
|
-
};
|
|
227
|
-
const agentDir = join(agentsDir, "parent-agent");
|
|
228
|
-
mkdirSync(agentDir, {
|
|
229
|
-
recursive: true
|
|
230
|
-
});
|
|
231
|
-
writeFileSync(join(agentDir, "agent.json"), JSON.stringify(agentConfig));
|
|
232
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
233
|
-
const agents = loader.loadAllAgentConfigs();
|
|
234
|
-
expect(agents).toHaveLength(1);
|
|
235
|
-
expect(agents[0].name).toBe("parent-agent");
|
|
236
|
-
expect(agents[0].subAgents).toBeDefined();
|
|
237
|
-
expect(agents[0].subAgents?.length).toBe(2);
|
|
238
|
-
expect(agents[0].subAgents?.[0].name).toBe("subagent1");
|
|
239
|
-
expect(agents[0].subAgents?.[1].name).toBe("subagent2");
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
describe("Empty Workspace", ()=>{
|
|
243
|
-
it("should return empty array when no agents exist", ()=>{
|
|
244
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
245
|
-
const agents = loader.loadAllAgentConfigs();
|
|
246
|
-
expect(agents).toEqual([]);
|
|
247
|
-
});
|
|
248
|
-
it("should return empty array when agents directory doesn't exist", ()=>{
|
|
249
|
-
rmSync(agentsDir, {
|
|
250
|
-
recursive: true,
|
|
251
|
-
force: true
|
|
252
|
-
});
|
|
253
|
-
const loader = new AgentLoader(configDir, testDir);
|
|
254
|
-
const agents = loader.loadAllAgentConfigs();
|
|
255
|
-
expect(agents).toEqual([]);
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_exports__ = {};
|
|
3
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
4
|
-
const FINNHUB_BASE_URL = process.env.FINNHUB_BASE_URL?.trim() || "https://finnhub.io/api/v1";
|
|
5
|
-
const FINNHUB_API_KEY = process.env.FINNHUB_API_KEY?.trim();
|
|
6
|
-
const RUN_LIVE = "1" === process.env.FINNHUB_LIVE_TESTS;
|
|
7
|
-
const describeLive = FINNHUB_API_KEY && RUN_LIVE ? external_vitest_namespaceObject.describe : external_vitest_namespaceObject.describe.skip;
|
|
8
|
-
const secondsPerDay = 86400;
|
|
9
|
-
const buildCandleUrl = (scenario)=>{
|
|
10
|
-
const to = Math.floor(Date.now() / 1000);
|
|
11
|
-
const from = to - scenario.lookbackDays * secondsPerDay;
|
|
12
|
-
const url = new URL(`${FINNHUB_BASE_URL}/stock/candle`);
|
|
13
|
-
url.searchParams.set("symbol", scenario.symbol);
|
|
14
|
-
url.searchParams.set("resolution", scenario.resolution);
|
|
15
|
-
url.searchParams.set("from", String(from));
|
|
16
|
-
url.searchParams.set("to", String(to));
|
|
17
|
-
url.searchParams.set("token", FINNHUB_API_KEY || "");
|
|
18
|
-
return url.toString();
|
|
19
|
-
};
|
|
20
|
-
const scenarios = [
|
|
21
|
-
{
|
|
22
|
-
label: "daily-365",
|
|
23
|
-
symbol: "AAPL",
|
|
24
|
-
resolution: "D",
|
|
25
|
-
lookbackDays: 365
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: "daily-180",
|
|
29
|
-
symbol: "AAPL",
|
|
30
|
-
resolution: "D",
|
|
31
|
-
lookbackDays: 180
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: "daily-90",
|
|
35
|
-
symbol: "AAPL",
|
|
36
|
-
resolution: "D",
|
|
37
|
-
lookbackDays: 90
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: "hourly-180",
|
|
41
|
-
symbol: "AAPL",
|
|
42
|
-
resolution: "60",
|
|
43
|
-
lookbackDays: 180
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: "hourly-90",
|
|
47
|
-
symbol: "AAPL",
|
|
48
|
-
resolution: "60",
|
|
49
|
-
lookbackDays: 90
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
label: "hourly-30",
|
|
53
|
-
symbol: "AAPL",
|
|
54
|
-
resolution: "60",
|
|
55
|
-
lookbackDays: 30
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: "15m-30",
|
|
59
|
-
symbol: "AAPL",
|
|
60
|
-
resolution: "15",
|
|
61
|
-
lookbackDays: 30
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: "1m-7",
|
|
65
|
-
symbol: "AAPL",
|
|
66
|
-
resolution: "1",
|
|
67
|
-
lookbackDays: 7
|
|
68
|
-
}
|
|
69
|
-
];
|
|
70
|
-
describeLive("Finnhub candle access (live)", ()=>{
|
|
71
|
-
(0, external_vitest_namespaceObject.it)("does not return 403 for supported ranges", async ()=>{
|
|
72
|
-
const failures = [];
|
|
73
|
-
for (const scenario of scenarios){
|
|
74
|
-
const url = buildCandleUrl(scenario);
|
|
75
|
-
const response = await fetch(url, {
|
|
76
|
-
headers: {
|
|
77
|
-
"User-Agent": "wingman-finnhub-test"
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
const body = await response.text();
|
|
81
|
-
console.info(`Finnhub candle ${scenario.label} -> ${response.status}`);
|
|
82
|
-
if (403 === response.status) {
|
|
83
|
-
failures.push(`403 for ${scenario.label} (${scenario.resolution}, ${scenario.lookbackDays}d): ${body.slice(0, 200)}`);
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (429 === response.status) {
|
|
87
|
-
console.warn(`Rate limited for ${scenario.label}; skipping assert.`);
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
(0, external_vitest_namespaceObject.expect)(response.status).toBe(200);
|
|
91
|
-
}
|
|
92
|
-
if (failures.length > 0) throw new Error(failures.join("\n"));
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
96
|
-
Object.defineProperty(exports, '__esModule', {
|
|
97
|
-
value: true
|
|
98
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
const FINNHUB_BASE_URL = process.env.FINNHUB_BASE_URL?.trim() || "https://finnhub.io/api/v1";
|
|
3
|
-
const FINNHUB_API_KEY = process.env.FINNHUB_API_KEY?.trim();
|
|
4
|
-
const RUN_LIVE = "1" === process.env.FINNHUB_LIVE_TESTS;
|
|
5
|
-
const describeLive = FINNHUB_API_KEY && RUN_LIVE ? describe : describe.skip;
|
|
6
|
-
const secondsPerDay = 86400;
|
|
7
|
-
const buildCandleUrl = (scenario)=>{
|
|
8
|
-
const to = Math.floor(Date.now() / 1000);
|
|
9
|
-
const from = to - scenario.lookbackDays * secondsPerDay;
|
|
10
|
-
const url = new URL(`${FINNHUB_BASE_URL}/stock/candle`);
|
|
11
|
-
url.searchParams.set("symbol", scenario.symbol);
|
|
12
|
-
url.searchParams.set("resolution", scenario.resolution);
|
|
13
|
-
url.searchParams.set("from", String(from));
|
|
14
|
-
url.searchParams.set("to", String(to));
|
|
15
|
-
url.searchParams.set("token", FINNHUB_API_KEY || "");
|
|
16
|
-
return url.toString();
|
|
17
|
-
};
|
|
18
|
-
const scenarios = [
|
|
19
|
-
{
|
|
20
|
-
label: "daily-365",
|
|
21
|
-
symbol: "AAPL",
|
|
22
|
-
resolution: "D",
|
|
23
|
-
lookbackDays: 365
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
label: "daily-180",
|
|
27
|
-
symbol: "AAPL",
|
|
28
|
-
resolution: "D",
|
|
29
|
-
lookbackDays: 180
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: "daily-90",
|
|
33
|
-
symbol: "AAPL",
|
|
34
|
-
resolution: "D",
|
|
35
|
-
lookbackDays: 90
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: "hourly-180",
|
|
39
|
-
symbol: "AAPL",
|
|
40
|
-
resolution: "60",
|
|
41
|
-
lookbackDays: 180
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: "hourly-90",
|
|
45
|
-
symbol: "AAPL",
|
|
46
|
-
resolution: "60",
|
|
47
|
-
lookbackDays: 90
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
label: "hourly-30",
|
|
51
|
-
symbol: "AAPL",
|
|
52
|
-
resolution: "60",
|
|
53
|
-
lookbackDays: 30
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
label: "15m-30",
|
|
57
|
-
symbol: "AAPL",
|
|
58
|
-
resolution: "15",
|
|
59
|
-
lookbackDays: 30
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
label: "1m-7",
|
|
63
|
-
symbol: "AAPL",
|
|
64
|
-
resolution: "1",
|
|
65
|
-
lookbackDays: 7
|
|
66
|
-
}
|
|
67
|
-
];
|
|
68
|
-
describeLive("Finnhub candle access (live)", ()=>{
|
|
69
|
-
it("does not return 403 for supported ranges", async ()=>{
|
|
70
|
-
const failures = [];
|
|
71
|
-
for (const scenario of scenarios){
|
|
72
|
-
const url = buildCandleUrl(scenario);
|
|
73
|
-
const response = await fetch(url, {
|
|
74
|
-
headers: {
|
|
75
|
-
"User-Agent": "wingman-finnhub-test"
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
const body = await response.text();
|
|
79
|
-
console.info(`Finnhub candle ${scenario.label} -> ${response.status}`);
|
|
80
|
-
if (403 === response.status) {
|
|
81
|
-
failures.push(`403 for ${scenario.label} (${scenario.resolution}, ${scenario.lookbackDays}d): ${body.slice(0, 200)}`);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (429 === response.status) {
|
|
85
|
-
console.warn(`Rate limited for ${scenario.label}; skipping assert.`);
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
expect(response.status).toBe(200);
|
|
89
|
-
}
|
|
90
|
-
if (failures.length > 0) throw new Error(failures.join("\n"));
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_exports__ = {};
|
|
3
|
-
const external_deepagents_namespaceObject = require("deepagents");
|
|
4
|
-
const external_vitest_namespaceObject = require("vitest");
|
|
5
|
-
const messages_namespaceObject = require("@langchain/core/messages");
|
|
6
|
-
const chat_models_namespaceObject = require("@langchain/core/language_models/chat_models");
|
|
7
|
-
const langgraph_namespaceObject = require("@langchain/langgraph");
|
|
8
|
-
const agentInvoker_cjs_namespaceObject = require("../../cli/core/agentInvoker.cjs");
|
|
9
|
-
function _define_property(obj, key, value) {
|
|
10
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
11
|
-
value: value,
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true
|
|
15
|
-
});
|
|
16
|
-
else obj[key] = value;
|
|
17
|
-
return obj;
|
|
18
|
-
}
|
|
19
|
-
const ciValue = (process.env.CI ?? "").toLowerCase();
|
|
20
|
-
const isCiEnvironment = "" !== ciValue && "0" !== ciValue && "false" !== ciValue;
|
|
21
|
-
const RUN_SUMMARIZATION_E2E = "1" === process.env.WINGMAN_SUMMARIZATION_E2E && !isCiEnvironment;
|
|
22
|
-
const describeE2E = RUN_SUMMARIZATION_E2E ? external_vitest_namespaceObject.describe : external_vitest_namespaceObject.describe.skip;
|
|
23
|
-
const THREAD_ID = "summarization-e2e-thread";
|
|
24
|
-
class LocalEchoChatModel extends chat_models_namespaceObject.BaseChatModel {
|
|
25
|
-
bindTools(tools) {
|
|
26
|
-
const next = new LocalEchoChatModel();
|
|
27
|
-
next.tools = [
|
|
28
|
-
...this.tools,
|
|
29
|
-
...tools
|
|
30
|
-
];
|
|
31
|
-
return next;
|
|
32
|
-
}
|
|
33
|
-
_llmType() {
|
|
34
|
-
return "local-echo-chat-model";
|
|
35
|
-
}
|
|
36
|
-
_combineLLMOutput() {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
async _generate(messages) {
|
|
40
|
-
const text = messages.map((message)=>{
|
|
41
|
-
const content = message.content;
|
|
42
|
-
if ("string" == typeof content) return content;
|
|
43
|
-
return JSON.stringify(content);
|
|
44
|
-
}).join("\n");
|
|
45
|
-
const message = new messages_namespaceObject.AIMessage({
|
|
46
|
-
content: text
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
generations: [
|
|
50
|
-
{
|
|
51
|
-
text,
|
|
52
|
-
message
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
llmOutput: {}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
constructor(){
|
|
59
|
-
super({}), _define_property(this, "tools", []);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const extractStateMessages = (state)=>{
|
|
63
|
-
if (!state || "object" != typeof state) return [];
|
|
64
|
-
const record = state;
|
|
65
|
-
const values = record.values && "object" == typeof record.values ? record.values : null;
|
|
66
|
-
const direct = values?.messages;
|
|
67
|
-
if (Array.isArray(direct)) return direct.filter((entry)=>Boolean(entry) && "object" == typeof entry && !Array.isArray(entry));
|
|
68
|
-
return [];
|
|
69
|
-
};
|
|
70
|
-
const isSummarizationMessage = (message)=>{
|
|
71
|
-
const additionalKwargs = message.additional_kwargs && "object" == typeof message.additional_kwargs && !Array.isArray(message.additional_kwargs) ? message.additional_kwargs : null;
|
|
72
|
-
return additionalKwargs?.lc_source === "summarization";
|
|
73
|
-
};
|
|
74
|
-
describeE2E("Summarization E2E Integration (manual-only)", ()=>{
|
|
75
|
-
(0, external_vitest_namespaceObject.it)("summarizes thread history when low token threshold is exceeded", async ()=>{
|
|
76
|
-
const model = new LocalEchoChatModel();
|
|
77
|
-
let agent = (0, external_deepagents_namespaceObject.createDeepAgent)({
|
|
78
|
-
model,
|
|
79
|
-
tools: [],
|
|
80
|
-
systemPrompt: "You are a test agent.",
|
|
81
|
-
checkpointer: new langgraph_namespaceObject.MemorySaver()
|
|
82
|
-
});
|
|
83
|
-
(0, agentInvoker_cjs_namespaceObject.configureDeepAgentSummarizationMiddleware)(agent, {
|
|
84
|
-
maxTokensBeforeSummary: 30,
|
|
85
|
-
messagesToKeep: 1
|
|
86
|
-
}, model);
|
|
87
|
-
agent = (0, agentInvoker_cjs_namespaceObject.recompileDeepAgentWithMiddlewareOverrides)(agent);
|
|
88
|
-
const invocationConfig = {
|
|
89
|
-
configurable: {
|
|
90
|
-
thread_id: THREAD_ID
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
await agent.invoke({
|
|
94
|
-
messages: [
|
|
95
|
-
{
|
|
96
|
-
role: "user",
|
|
97
|
-
content: "Turn one: collect and retain these details for later synthesis."
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
}, invocationConfig);
|
|
101
|
-
await agent.invoke({
|
|
102
|
-
messages: [
|
|
103
|
-
{
|
|
104
|
-
role: "user",
|
|
105
|
-
content: "Turn two: include additional context and constraints for the prior request."
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
}, invocationConfig);
|
|
109
|
-
await agent.invoke({
|
|
110
|
-
messages: [
|
|
111
|
-
{
|
|
112
|
-
role: "user",
|
|
113
|
-
content: "Turn three: force context growth so the summarization middleware must compress history."
|
|
114
|
-
}
|
|
115
|
-
]
|
|
116
|
-
}, invocationConfig);
|
|
117
|
-
const state = await agent.getState(invocationConfig);
|
|
118
|
-
const stateMessages = extractStateMessages(state);
|
|
119
|
-
const summaryMessages = stateMessages.filter(isSummarizationMessage);
|
|
120
|
-
(0, external_vitest_namespaceObject.expect)(summaryMessages.length).toBeGreaterThan(0);
|
|
121
|
-
(0, external_vitest_namespaceObject.expect)(stateMessages.length).toBeLessThan(6);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
125
|
-
Object.defineProperty(exports, '__esModule', {
|
|
126
|
-
value: true
|
|
127
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|