@wingman-ai/gateway 0.2.5 → 0.3.1
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/README.md +9 -0
- package/dist/agent/config/agentConfig.cjs +12 -0
- package/dist/agent/config/agentConfig.d.ts +26 -0
- package/dist/agent/config/agentConfig.js +10 -1
- package/dist/agent/config/agentLoader.cjs +9 -0
- package/dist/agent/config/agentLoader.js +9 -0
- package/dist/agent/config/mcpClientManager.cjs +44 -10
- package/dist/agent/config/mcpClientManager.d.ts +6 -2
- package/dist/agent/config/mcpClientManager.js +44 -10
- package/dist/agent/config/toolRegistry.cjs +20 -1
- package/dist/agent/config/toolRegistry.d.ts +15 -0
- package/dist/agent/config/toolRegistry.js +20 -1
- package/dist/agent/tests/agentConfig.test.cjs +6 -1
- package/dist/agent/tests/agentConfig.test.js +6 -1
- package/dist/agent/tests/browserControlHelpers.test.cjs +35 -0
- package/dist/agent/tests/browserControlHelpers.test.d.ts +1 -0
- package/dist/agent/tests/browserControlHelpers.test.js +29 -0
- package/dist/agent/tests/browserControlTool.test.cjs +2117 -0
- package/dist/agent/tests/browserControlTool.test.d.ts +1 -0
- package/dist/agent/tests/browserControlTool.test.js +2111 -0
- package/dist/agent/tests/mcpClientManager.test.cjs +124 -0
- package/dist/agent/tests/mcpClientManager.test.d.ts +1 -0
- package/dist/agent/tests/mcpClientManager.test.js +118 -0
- package/dist/agent/tests/toolRegistry.test.cjs +6 -0
- package/dist/agent/tests/toolRegistry.test.js +6 -0
- package/dist/agent/tools/browser_control.cjs +1282 -0
- package/dist/agent/tools/browser_control.d.ts +478 -0
- package/dist/agent/tools/browser_control.js +1242 -0
- package/dist/agent/tools/command_execute.cjs +1 -1
- package/dist/agent/tools/command_execute.js +1 -1
- package/dist/cli/commands/agent.cjs +16 -2
- package/dist/cli/commands/agent.js +16 -2
- package/dist/cli/commands/browser.cjs +603 -0
- package/dist/cli/commands/browser.d.ts +13 -0
- package/dist/cli/commands/browser.js +566 -0
- package/dist/cli/commands/gateway.cjs +18 -7
- package/dist/cli/commands/gateway.d.ts +5 -1
- package/dist/cli/commands/gateway.js +18 -7
- package/dist/cli/commands/init.cjs +134 -45
- package/dist/cli/commands/init.js +134 -45
- package/dist/cli/commands/skill.cjs +3 -2
- package/dist/cli/commands/skill.js +3 -2
- package/dist/cli/config/loader.cjs +15 -0
- package/dist/cli/config/loader.js +15 -0
- package/dist/cli/config/schema.cjs +51 -2
- package/dist/cli/config/schema.d.ts +51 -0
- package/dist/cli/config/schema.js +44 -1
- package/dist/cli/core/agentInvoker.cjs +55 -66
- package/dist/cli/core/agentInvoker.d.ts +10 -13
- package/dist/cli/core/agentInvoker.js +42 -62
- package/dist/cli/core/imagePersistence.cjs +125 -0
- package/dist/cli/core/imagePersistence.d.ts +24 -0
- package/dist/cli/core/imagePersistence.js +85 -0
- package/dist/cli/core/sessionManager.cjs +297 -40
- package/dist/cli/core/sessionManager.d.ts +9 -0
- package/dist/cli/core/sessionManager.js +297 -40
- package/dist/cli/core/workspace.cjs +89 -0
- package/dist/cli/core/workspace.d.ts +1 -0
- package/dist/cli/core/workspace.js +55 -0
- package/dist/cli/index.cjs +53 -5
- package/dist/cli/index.js +53 -5
- package/dist/cli/types/browser.cjs +18 -0
- package/dist/cli/types/browser.d.ts +9 -0
- package/dist/cli/types/browser.js +0 -0
- package/dist/debug/terminalProbe.cjs +57 -0
- package/dist/debug/terminalProbe.d.ts +10 -0
- package/dist/debug/terminalProbe.js +20 -0
- package/dist/debug/terminalProbeAuth.cjs +140 -0
- package/dist/debug/terminalProbeAuth.d.ts +20 -0
- package/dist/debug/terminalProbeAuth.js +97 -0
- package/dist/gateway/browserRelayServer.cjs +338 -0
- package/dist/gateway/browserRelayServer.d.ts +38 -0
- package/dist/gateway/browserRelayServer.js +301 -0
- package/dist/gateway/http/agents.cjs +22 -0
- package/dist/gateway/http/agents.js +22 -0
- package/dist/gateway/http/fs.cjs +76 -0
- package/dist/gateway/http/fs.js +77 -1
- package/dist/gateway/http/sessions.cjs +25 -5
- package/dist/gateway/http/sessions.js +25 -5
- package/dist/gateway/server.cjs +155 -17
- package/dist/gateway/server.d.ts +6 -1
- package/dist/gateway/server.js +148 -16
- package/dist/gateway/transport/websocket.cjs +45 -10
- package/dist/gateway/transport/websocket.d.ts +1 -0
- package/dist/gateway/transport/websocket.js +41 -9
- package/dist/gateway/types.d.ts +4 -0
- package/dist/tests/agentInvokerSummarization.test.cjs +56 -37
- package/dist/tests/agentInvokerSummarization.test.js +58 -39
- package/dist/tests/agentInvokerWorkdir.test.cjs +50 -0
- package/dist/tests/agentInvokerWorkdir.test.js +52 -2
- package/dist/tests/agents-api.test.cjs +52 -0
- package/dist/tests/agents-api.test.js +53 -1
- package/dist/tests/browser-command.test.cjs +264 -0
- package/dist/tests/browser-command.test.d.ts +1 -0
- package/dist/tests/browser-command.test.js +258 -0
- package/dist/tests/browser-relay-server.test.cjs +20 -0
- package/dist/tests/browser-relay-server.test.d.ts +1 -0
- package/dist/tests/browser-relay-server.test.js +14 -0
- package/dist/tests/cli-config-loader.test.cjs +43 -0
- package/dist/tests/cli-config-loader.test.js +43 -0
- package/dist/tests/cli-init.test.cjs +61 -2
- package/dist/tests/cli-init.test.js +61 -2
- package/dist/tests/cli-workspace-root.test.cjs +114 -0
- package/dist/tests/cli-workspace-root.test.d.ts +1 -0
- package/dist/tests/cli-workspace-root.test.js +108 -0
- package/dist/tests/falRuntime.test.cjs +78 -0
- package/dist/tests/falRuntime.test.d.ts +1 -0
- package/dist/tests/falRuntime.test.js +72 -0
- package/dist/tests/falSummary.test.cjs +51 -0
- package/dist/tests/falSummary.test.d.ts +1 -0
- package/dist/tests/falSummary.test.js +45 -0
- package/dist/tests/fs-api.test.cjs +138 -0
- package/dist/tests/fs-api.test.d.ts +1 -0
- package/dist/tests/fs-api.test.js +132 -0
- package/dist/tests/gateway-command-workspace.test.cjs +150 -0
- package/dist/tests/gateway-command-workspace.test.d.ts +1 -0
- package/dist/tests/gateway-command-workspace.test.js +144 -0
- package/dist/tests/gateway-request-execution-overrides.test.cjs +42 -0
- package/dist/tests/gateway-request-execution-overrides.test.d.ts +1 -0
- package/dist/tests/gateway-request-execution-overrides.test.js +36 -0
- package/dist/tests/gateway.test.cjs +140 -1
- package/dist/tests/gateway.test.js +140 -1
- package/dist/tests/imagePersistence.test.cjs +143 -0
- package/dist/tests/imagePersistence.test.d.ts +1 -0
- package/dist/tests/imagePersistence.test.js +137 -0
- package/dist/tests/sessionMessageAttachments.test.cjs +30 -0
- package/dist/tests/sessionMessageAttachments.test.js +30 -0
- package/dist/tests/sessionStateMessages.test.cjs +126 -0
- package/dist/tests/sessionStateMessages.test.js +126 -0
- package/dist/tests/sessions-api.test.cjs +117 -3
- package/dist/tests/sessions-api.test.js +118 -4
- package/dist/tests/terminalProbe.test.cjs +45 -0
- package/dist/tests/terminalProbe.test.d.ts +1 -0
- package/dist/tests/terminalProbe.test.js +39 -0
- package/dist/tests/terminalProbeAuth.test.cjs +85 -0
- package/dist/tests/terminalProbeAuth.test.d.ts +1 -0
- package/dist/tests/terminalProbeAuth.test.js +79 -0
- package/dist/tests/websocket-transport.test.cjs +31 -0
- package/dist/tests/websocket-transport.test.d.ts +1 -0
- package/dist/tests/websocket-transport.test.js +25 -0
- package/dist/tools/fal/runtime.cjs +103 -0
- package/dist/tools/fal/runtime.d.ts +10 -0
- package/dist/tools/fal/runtime.js +60 -0
- package/dist/tools/fal/summary.cjs +78 -0
- package/dist/tools/fal/summary.d.ts +22 -0
- package/dist/tools/fal/summary.js +41 -0
- package/dist/tools/mcp-fal-ai.cjs +1041 -0
- package/dist/tools/mcp-fal-ai.d.ts +1 -0
- package/dist/tools/mcp-fal-ai.js +1025 -0
- package/dist/types/mcp.cjs +2 -0
- package/dist/types/mcp.d.ts +8 -0
- package/dist/types/mcp.js +3 -1
- package/dist/webui/assets/index-BW9nM0J2.css +11 -0
- package/dist/webui/assets/index-C8-oboEC.js +278 -0
- package/dist/webui/index.html +2 -2
- package/extensions/wingman-browser-extension/README.md +27 -0
- package/extensions/wingman-browser-extension/background.js +416 -0
- package/extensions/wingman-browser-extension/manifest.json +19 -0
- package/extensions/wingman-browser-extension/options.html +156 -0
- package/extensions/wingman-browser-extension/options.js +106 -0
- package/package.json +18 -13
- package/{.wingman → templates}/agents/README.md +2 -1
- package/{.wingman → templates}/agents/coding/agent.md +5 -1
- package/{.wingman → templates}/agents/coding-v2/agent.md +58 -1
- package/templates/agents/game-dev/agent.md +101 -0
- package/templates/agents/game-dev/art-generation.md +38 -0
- package/templates/agents/game-dev/asset-refinement.md +17 -0
- package/templates/agents/game-dev/planning-idea.md +17 -0
- package/templates/agents/game-dev/ui-specialist.md +17 -0
- package/templates/agents/main/agent.md +29 -0
- package/{.wingman → templates}/agents/researcher/agent.md +9 -0
- package/{.wingman → templates}/agents/stock-trader/agent.md +1 -0
- package/.wingman/agents/main/agent.md +0 -22
- package/dist/webui/assets/index-C7EuTbnE.js +0 -270
- package/dist/webui/assets/index-DVWQluit.css +0 -11
- /package/{.wingman → templates}/agents/coding-v2/implementor.md +0 -0
- /package/{.wingman → templates}/agents/stock-trader/chain-curator.md +0 -0
- /package/{.wingman → templates}/agents/stock-trader/goal-translator.md +0 -0
- /package/{.wingman → templates}/agents/stock-trader/guardrails-veto.md +0 -0
- /package/{.wingman → templates}/agents/stock-trader/path-planner.md +0 -0
- /package/{.wingman → templates}/agents/stock-trader/regime-analyst.md +0 -0
- /package/{.wingman → templates}/agents/stock-trader/risk.md +0 -0
- /package/{.wingman → templates}/agents/stock-trader/selection.md +0 -0
- /package/{.wingman → templates}/agents/stock-trader/strategy-composer.md +0 -0
|
@@ -16,6 +16,34 @@ const SkillsConfigSchema = object({
|
|
|
16
16
|
githubToken: string().optional().describe("GitHub personal access token for higher API rate limits"),
|
|
17
17
|
skillsDirectory: string().default("skills").describe("Directory to install skills in")
|
|
18
18
|
});
|
|
19
|
+
const BrowserTransportSchema = external_zod_enum([
|
|
20
|
+
"auto",
|
|
21
|
+
"playwright",
|
|
22
|
+
"relay"
|
|
23
|
+
]).describe("Browser automation transport preference");
|
|
24
|
+
const BrowserConfigSchema = object({
|
|
25
|
+
profilesDir: string().optional().default(".wingman/browser-profiles").describe("Base directory for named browser_control profiles (relative to workspace unless absolute)"),
|
|
26
|
+
profiles: record(string(), string()).optional().default({}).describe("Optional mapping of profile ID to explicit profile path (relative to workspace unless absolute)"),
|
|
27
|
+
extensionsDir: string().optional().default(".wingman/browser-extensions").describe("Base directory for named browser extensions (relative to workspace unless absolute)"),
|
|
28
|
+
extensions: record(string(), string()).optional().default({}).describe("Optional mapping of extension ID to unpacked extension path (relative to workspace unless absolute)"),
|
|
29
|
+
defaultExtensions: array(string().min(1)).optional().default([]).describe("Optional default extension IDs loaded for browser profile open and browser_control runs"),
|
|
30
|
+
defaultProfile: string().min(1).optional().describe("Optional default browser profile ID used when an agent does not specify browserProfile"),
|
|
31
|
+
transport: BrowserTransportSchema.optional().default("auto").describe('Default browser transport preference for browser_control ("auto", "playwright", or "relay")'),
|
|
32
|
+
relay: object({
|
|
33
|
+
enabled: external_zod_boolean().optional().default(false).describe("Enable local browser relay server for extension/CDP bridging"),
|
|
34
|
+
host: string().optional().default("127.0.0.1").describe("Relay bind host (security: keep this loopback)"),
|
|
35
|
+
port: number().int().min(1).max(65535).optional().default(18792).describe("Relay bind port"),
|
|
36
|
+
requireAuth: external_zod_boolean().optional().default(true).describe("Require relay clients to authenticate with a token"),
|
|
37
|
+
authToken: string().min(16).optional().describe("Relay shared secret for extension/CDP clients"),
|
|
38
|
+
maxMessageBytes: number().int().min(1024).max(2097152).optional().default(262144).describe("Maximum relay websocket message size")
|
|
39
|
+
}).optional().default({
|
|
40
|
+
enabled: false,
|
|
41
|
+
host: "127.0.0.1",
|
|
42
|
+
port: 18792,
|
|
43
|
+
requireAuth: true,
|
|
44
|
+
maxMessageBytes: 262144
|
|
45
|
+
})
|
|
46
|
+
});
|
|
19
47
|
const SummarizationConfigSchema = object({
|
|
20
48
|
enabled: external_zod_boolean().optional().default(true).describe("Enable conversation history summarization"),
|
|
21
49
|
maxTokensBeforeSummary: number().min(1000).max(1000000).optional().default(12000).describe("Token threshold before summarizing conversation history"),
|
|
@@ -238,6 +266,21 @@ const WingmanConfigSchema = object({
|
|
|
238
266
|
repositoryName: "skills",
|
|
239
267
|
skillsDirectory: "skills"
|
|
240
268
|
}),
|
|
269
|
+
browser: BrowserConfigSchema.optional().default({
|
|
270
|
+
profilesDir: ".wingman/browser-profiles",
|
|
271
|
+
profiles: {},
|
|
272
|
+
extensionsDir: ".wingman/browser-extensions",
|
|
273
|
+
extensions: {},
|
|
274
|
+
defaultExtensions: [],
|
|
275
|
+
transport: "auto",
|
|
276
|
+
relay: {
|
|
277
|
+
enabled: false,
|
|
278
|
+
host: "127.0.0.1",
|
|
279
|
+
port: 18792,
|
|
280
|
+
requireAuth: true,
|
|
281
|
+
maxMessageBytes: 262144
|
|
282
|
+
}
|
|
283
|
+
}),
|
|
241
284
|
gateway: GatewayConfigSchema.optional().default({
|
|
242
285
|
host: "127.0.0.1",
|
|
243
286
|
port: 18789,
|
|
@@ -279,4 +322,4 @@ function validateConfig(data) {
|
|
|
279
322
|
};
|
|
280
323
|
}
|
|
281
324
|
}
|
|
282
|
-
export { AgentsConfigSchema, GatewayConfigSchema, HumanInTheLoopConfigSchema, ModelRetryConfigSchema, SearchConfigSchema, SkillsConfigSchema, SummarizationConfigSchema, ToolRetryConfigSchema, WingmanConfigSchema, validateConfig };
|
|
325
|
+
export { AgentsConfigSchema, BrowserConfigSchema, BrowserTransportSchema, GatewayConfigSchema, HumanInTheLoopConfigSchema, ModelRetryConfigSchema, SearchConfigSchema, SkillsConfigSchema, SummarizationConfigSchema, ToolRetryConfigSchema, WingmanConfigSchema, validateConfig };
|
|
@@ -26,7 +26,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
resolveToolRetryMiddlewareSettings: ()=>resolveToolRetryMiddlewareSettings,
|
|
28
28
|
resolveSummarizationMiddlewareSettings: ()=>resolveSummarizationMiddlewareSettings,
|
|
29
|
+
resolveAgentMemorySources: ()=>resolveAgentMemorySources,
|
|
29
30
|
OUTPUT_VIRTUAL_PATH: ()=>OUTPUT_VIRTUAL_PATH,
|
|
31
|
+
emitCompletionAndContinuePostProcessing: ()=>emitCompletionAndContinuePostProcessing,
|
|
30
32
|
resolveExecutionWorkspace: ()=>resolveExecutionWorkspace,
|
|
31
33
|
buildUserContent: ()=>buildUserContent,
|
|
32
34
|
detectStreamErrorMessage: ()=>detectStreamErrorMessage,
|
|
@@ -34,15 +36,16 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
34
36
|
chunkHasAssistantText: ()=>chunkHasAssistantText,
|
|
35
37
|
resolveModelRetryMiddlewareSettings: ()=>resolveModelRetryMiddlewareSettings,
|
|
36
38
|
AgentInvoker: ()=>AgentInvoker,
|
|
37
|
-
WORKDIR_VIRTUAL_PATH: ()=>WORKDIR_VIRTUAL_PATH,
|
|
38
39
|
configureDeepAgentSummarizationMiddleware: ()=>configureDeepAgentSummarizationMiddleware,
|
|
40
|
+
WORKDIR_VIRTUAL_PATH: ()=>WORKDIR_VIRTUAL_PATH,
|
|
39
41
|
detectToolEventContext: ()=>detectToolEventContext,
|
|
40
42
|
resolveExternalOutputMount: ()=>resolveExternalOutputMount,
|
|
41
|
-
evaluateStreamingCompletion: ()=>evaluateStreamingCompletion,
|
|
42
43
|
resolveHumanInTheLoopSettings: ()=>resolveHumanInTheLoopSettings,
|
|
43
44
|
trackRootLangGraphRunId: ()=>trackRootLangGraphRunId,
|
|
44
45
|
isRootLangGraphTerminalEvent: ()=>isRootLangGraphTerminalEvent,
|
|
45
|
-
selectStreamingFallbackText: ()=>selectStreamingFallbackText
|
|
46
|
+
selectStreamingFallbackText: ()=>selectStreamingFallbackText,
|
|
47
|
+
AGENTS_MEMORY_VIRTUAL_PATHS: ()=>AGENTS_MEMORY_VIRTUAL_PATHS,
|
|
48
|
+
resolveAgentExecutionWorkspace: ()=>resolveAgentExecutionWorkspace
|
|
46
49
|
});
|
|
47
50
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
48
51
|
const external_node_path_namespaceObject = require("node:path");
|
|
@@ -70,6 +73,9 @@ function _define_property(obj, key, value) {
|
|
|
70
73
|
}
|
|
71
74
|
const WORKDIR_VIRTUAL_PATH = "/workdir/";
|
|
72
75
|
const OUTPUT_VIRTUAL_PATH = "/output/";
|
|
76
|
+
const AGENTS_MEMORY_VIRTUAL_PATHS = [
|
|
77
|
+
"/AGENTS.md"
|
|
78
|
+
];
|
|
73
79
|
const DEFAULT_DEEPAGENT_MODEL = "claude-sonnet-4-5-20250929";
|
|
74
80
|
const isPathWithinRoot = (targetPath, rootPath)=>{
|
|
75
81
|
const normalizedTarget = (0, external_node_path_namespaceObject.normalize)(targetPath);
|
|
@@ -81,6 +87,11 @@ const resolveExecutionWorkspace = (workspace, workdir)=>{
|
|
|
81
87
|
if ((0, external_node_path_namespaceObject.isAbsolute)(workdir)) return (0, external_node_path_namespaceObject.normalize)(workdir);
|
|
82
88
|
return (0, external_node_path_namespaceObject.normalize)((0, external_node_path_namespaceObject.join)(workspace, workdir));
|
|
83
89
|
};
|
|
90
|
+
const resolveAgentExecutionWorkspace = (workspace, workdir, defaultOutputDir)=>{
|
|
91
|
+
const preferredWorkdir = workdir || defaultOutputDir || null;
|
|
92
|
+
return resolveExecutionWorkspace(workspace, preferredWorkdir);
|
|
93
|
+
};
|
|
94
|
+
const resolveAgentMemorySources = (executionWorkspace)=>AGENTS_MEMORY_VIRTUAL_PATHS.filter((memoryPath)=>(0, external_node_fs_namespaceObject.existsSync)((0, external_node_path_namespaceObject.join)(executionWorkspace, memoryPath.replace(/^\/+/, ""))));
|
|
84
95
|
const toWorkspaceAliasVirtualPath = (absolutePath)=>{
|
|
85
96
|
const normalized = (0, external_node_path_namespaceObject.normalize)(absolutePath);
|
|
86
97
|
if (!(0, external_node_path_namespaceObject.isAbsolute)(normalized)) return null;
|
|
@@ -284,24 +295,19 @@ const trackRootLangGraphRunId = (currentRootLangGraphRunId, chunk)=>{
|
|
|
284
295
|
return extractEventRunId(eventRecord) || currentRootLangGraphRunId;
|
|
285
296
|
};
|
|
286
297
|
const isRootLangGraphTerminalEvent = (chunk, rootLangGraphRunId)=>{
|
|
287
|
-
if (!rootLangGraphRunId) return false;
|
|
288
298
|
const eventRecord = extractStreamEventRecord(chunk);
|
|
289
299
|
if (!eventRecord || !isRootLangGraphChainEvent(eventRecord, "on_chain_end")) return false;
|
|
300
|
+
if (!rootLangGraphRunId) return true;
|
|
290
301
|
const chunkRunId = extractEventRunId(eventRecord);
|
|
302
|
+
if (!chunkRunId) return true;
|
|
291
303
|
return Boolean(chunkRunId && chunkRunId === rootLangGraphRunId);
|
|
292
304
|
};
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
message
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
return {
|
|
303
|
-
status: "ok"
|
|
304
|
-
};
|
|
305
|
+
const emitCompletionAndContinuePostProcessing = (input)=>{
|
|
306
|
+
input.outputManager.emitAgentComplete(input.result);
|
|
307
|
+
if (!input.postProcess) return;
|
|
308
|
+
input.postProcess().catch((error)=>{
|
|
309
|
+
input.logger?.debug("Failed post-completion processing for streamed agent response", error);
|
|
310
|
+
});
|
|
305
311
|
};
|
|
306
312
|
class AgentInvoker {
|
|
307
313
|
findAllAgents() {
|
|
@@ -315,14 +321,11 @@ class AgentInvoker {
|
|
|
315
321
|
let cancellationHandled = false;
|
|
316
322
|
let activeToolName = null;
|
|
317
323
|
let lastToolName = null;
|
|
318
|
-
let sawAssistantText = false;
|
|
319
|
-
let streamErrorMessage;
|
|
320
324
|
let rootLangGraphRunId;
|
|
321
|
-
let preInvocationMessages = null;
|
|
322
325
|
const isCancelled = ()=>options?.signal?.aborted === true;
|
|
323
326
|
try {
|
|
324
327
|
const hookSessionId = sessionId || (0, external_uuid_namespaceObject.v4)();
|
|
325
|
-
const executionWorkspace =
|
|
328
|
+
const executionWorkspace = resolveAgentExecutionWorkspace(this.workspace, this.workdir, this.defaultOutputDir);
|
|
326
329
|
const effectiveWorkdir = this.workdir ? executionWorkspace : null;
|
|
327
330
|
const loader = new agentLoader_cjs_namespaceObject.AgentLoader(this.configDir, this.workspace, this.wingmanConfig, executionWorkspace, {
|
|
328
331
|
terminalOwnerId: `${agentName}:${hookSessionId}`,
|
|
@@ -341,7 +344,9 @@ class AgentInvoker {
|
|
|
341
344
|
if (targetAgent.mcpUseGlobal && this.wingmanConfig.mcp) mcpConfigs.push(this.wingmanConfig.mcp);
|
|
342
345
|
if (mcpConfigs.length > 0) {
|
|
343
346
|
this.logger.debug("Initializing MCP client for agent invocation");
|
|
344
|
-
this.mcpManager = new mcpClientManager_cjs_namespaceObject.MCPClientManager(mcpConfigs, this.logger
|
|
347
|
+
this.mcpManager = new mcpClientManager_cjs_namespaceObject.MCPClientManager(mcpConfigs, this.logger, {
|
|
348
|
+
executionWorkspace
|
|
349
|
+
});
|
|
345
350
|
await this.mcpManager.initialize();
|
|
346
351
|
const mcpTools = await this.mcpManager.getTools();
|
|
347
352
|
if (mcpTools.length > 0) {
|
|
@@ -358,6 +363,7 @@ class AgentInvoker {
|
|
|
358
363
|
const normalizedSkillsDirectory = skillsDirectory.replace(/^\/+|\/+$/g, "");
|
|
359
364
|
const skillsVirtualPath = `/${normalizedSkillsDirectory}/`;
|
|
360
365
|
const outputMount = resolveExternalOutputMount(executionWorkspace, effectiveWorkdir, this.defaultOutputDir);
|
|
366
|
+
const memorySources = resolveAgentMemorySources(executionWorkspace);
|
|
361
367
|
const middleware = [
|
|
362
368
|
(0, media_compat_cjs_namespaceObject.mediaCompatibilityMiddleware)({
|
|
363
369
|
model: targetAgent.model
|
|
@@ -442,6 +448,7 @@ class AgentInvoker {
|
|
|
442
448
|
middleware: middleware,
|
|
443
449
|
interruptOn: hitlSettings?.interruptOn,
|
|
444
450
|
skills: skillsSources,
|
|
451
|
+
memory: memorySources,
|
|
445
452
|
subagents: targetAgent.subagents || [],
|
|
446
453
|
checkpointer: checkpointer
|
|
447
454
|
});
|
|
@@ -450,15 +457,6 @@ class AgentInvoker {
|
|
|
450
457
|
const userContent = buildUserContent(prompt, attachments, targetAgent.model);
|
|
451
458
|
if (this.sessionManager && sessionId) {
|
|
452
459
|
this.logger.debug(`Using streaming with session: ${sessionId}`);
|
|
453
|
-
try {
|
|
454
|
-
const messages = await this.sessionManager.listMessages(sessionId);
|
|
455
|
-
preInvocationMessages = messages.map((message)=>({
|
|
456
|
-
role: message.role,
|
|
457
|
-
content: message.content
|
|
458
|
-
}));
|
|
459
|
-
} catch (stateError) {
|
|
460
|
-
this.logger.debug("Failed to capture pre-invocation session state", stateError);
|
|
461
|
-
}
|
|
462
460
|
const stream = await standaloneAgent.streamEvents({
|
|
463
461
|
messages: [
|
|
464
462
|
{
|
|
@@ -476,8 +474,6 @@ class AgentInvoker {
|
|
|
476
474
|
});
|
|
477
475
|
for await (const chunk of stream){
|
|
478
476
|
rootLangGraphRunId = trackRootLangGraphRunId(rootLangGraphRunId, chunk);
|
|
479
|
-
if (!sawAssistantText && chunkHasAssistantText(chunk)) sawAssistantText = true;
|
|
480
|
-
if (!streamErrorMessage) streamErrorMessage = detectStreamErrorMessage(chunk);
|
|
481
477
|
const toolEvent = detectToolEventContext(chunk);
|
|
482
478
|
if (toolEvent) {
|
|
483
479
|
lastToolName = toolEvent.toolName;
|
|
@@ -507,37 +503,15 @@ class AgentInvoker {
|
|
|
507
503
|
cancelled: true
|
|
508
504
|
};
|
|
509
505
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
this.logger
|
|
519
|
-
}
|
|
520
|
-
const completionOutcome = evaluateStreamingCompletion({
|
|
521
|
-
sawAssistantText,
|
|
522
|
-
fallbackText,
|
|
523
|
-
streamErrorMessage
|
|
524
|
-
});
|
|
525
|
-
if ("blocked" === completionOutcome.status) {
|
|
526
|
-
this.logger.warn(completionOutcome.message);
|
|
527
|
-
this.outputManager.emitAgentError(completionOutcome.message);
|
|
528
|
-
return {
|
|
529
|
-
blocked: true,
|
|
530
|
-
reason: completionOutcome.reason
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
this.logger.info("Agent streaming completed successfully", {
|
|
534
|
-
usedFallbackText: Boolean(fallbackText)
|
|
535
|
-
});
|
|
536
|
-
this.outputManager.emitAgentComplete({
|
|
537
|
-
streaming: true,
|
|
538
|
-
...fallbackText ? {
|
|
539
|
-
fallbackText
|
|
540
|
-
} : {}
|
|
506
|
+
this.logger.info("Agent streaming completed successfully");
|
|
507
|
+
const completionPayload = {
|
|
508
|
+
streaming: true
|
|
509
|
+
};
|
|
510
|
+
emitCompletionAndContinuePostProcessing({
|
|
511
|
+
outputManager: this.outputManager,
|
|
512
|
+
result: completionPayload,
|
|
513
|
+
postProcess: ()=>this.materializeSessionImages(sessionId),
|
|
514
|
+
logger: this.logger
|
|
541
515
|
});
|
|
542
516
|
return {
|
|
543
517
|
streaming: true
|
|
@@ -573,7 +547,12 @@ class AgentInvoker {
|
|
|
573
547
|
};
|
|
574
548
|
}
|
|
575
549
|
this.logger.info("Agent completed successfully");
|
|
576
|
-
|
|
550
|
+
emitCompletionAndContinuePostProcessing({
|
|
551
|
+
outputManager: this.outputManager,
|
|
552
|
+
result,
|
|
553
|
+
postProcess: ()=>this.materializeSessionImages(sessionId),
|
|
554
|
+
logger: this.logger
|
|
555
|
+
});
|
|
577
556
|
return result;
|
|
578
557
|
}
|
|
579
558
|
} catch (error) {
|
|
@@ -605,6 +584,10 @@ class AgentInvoker {
|
|
|
605
584
|
description: a.description
|
|
606
585
|
}));
|
|
607
586
|
}
|
|
587
|
+
async materializeSessionImages(sessionId) {
|
|
588
|
+
if (!this.sessionManager || !sessionId) return;
|
|
589
|
+
await this.sessionManager.listMessages(sessionId);
|
|
590
|
+
}
|
|
608
591
|
constructor(options){
|
|
609
592
|
_define_property(this, "loader", void 0);
|
|
610
593
|
_define_property(this, "outputManager", void 0);
|
|
@@ -815,6 +798,7 @@ function buildAttachmentPreview(attachments) {
|
|
|
815
798
|
if (hasImage) return "[image]";
|
|
816
799
|
return "";
|
|
817
800
|
}
|
|
801
|
+
exports.AGENTS_MEMORY_VIRTUAL_PATHS = __webpack_exports__.AGENTS_MEMORY_VIRTUAL_PATHS;
|
|
818
802
|
exports.AgentInvoker = __webpack_exports__.AgentInvoker;
|
|
819
803
|
exports.OUTPUT_VIRTUAL_PATH = __webpack_exports__.OUTPUT_VIRTUAL_PATH;
|
|
820
804
|
exports.WORKDIR_VIRTUAL_PATH = __webpack_exports__.WORKDIR_VIRTUAL_PATH;
|
|
@@ -823,8 +807,10 @@ exports.chunkHasAssistantText = __webpack_exports__.chunkHasAssistantText;
|
|
|
823
807
|
exports.configureDeepAgentSummarizationMiddleware = __webpack_exports__.configureDeepAgentSummarizationMiddleware;
|
|
824
808
|
exports.detectStreamErrorMessage = __webpack_exports__.detectStreamErrorMessage;
|
|
825
809
|
exports.detectToolEventContext = __webpack_exports__.detectToolEventContext;
|
|
826
|
-
exports.
|
|
810
|
+
exports.emitCompletionAndContinuePostProcessing = __webpack_exports__.emitCompletionAndContinuePostProcessing;
|
|
827
811
|
exports.isRootLangGraphTerminalEvent = __webpack_exports__.isRootLangGraphTerminalEvent;
|
|
812
|
+
exports.resolveAgentExecutionWorkspace = __webpack_exports__.resolveAgentExecutionWorkspace;
|
|
813
|
+
exports.resolveAgentMemorySources = __webpack_exports__.resolveAgentMemorySources;
|
|
828
814
|
exports.resolveExecutionWorkspace = __webpack_exports__.resolveExecutionWorkspace;
|
|
829
815
|
exports.resolveExternalOutputMount = __webpack_exports__.resolveExternalOutputMount;
|
|
830
816
|
exports.resolveHumanInTheLoopSettings = __webpack_exports__.resolveHumanInTheLoopSettings;
|
|
@@ -835,6 +821,7 @@ exports.selectStreamingFallbackText = __webpack_exports__.selectStreamingFallbac
|
|
|
835
821
|
exports.toWorkspaceAliasVirtualPath = __webpack_exports__.toWorkspaceAliasVirtualPath;
|
|
836
822
|
exports.trackRootLangGraphRunId = __webpack_exports__.trackRootLangGraphRunId;
|
|
837
823
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
824
|
+
"AGENTS_MEMORY_VIRTUAL_PATHS",
|
|
838
825
|
"AgentInvoker",
|
|
839
826
|
"OUTPUT_VIRTUAL_PATH",
|
|
840
827
|
"WORKDIR_VIRTUAL_PATH",
|
|
@@ -843,8 +830,10 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
843
830
|
"configureDeepAgentSummarizationMiddleware",
|
|
844
831
|
"detectStreamErrorMessage",
|
|
845
832
|
"detectToolEventContext",
|
|
846
|
-
"
|
|
833
|
+
"emitCompletionAndContinuePostProcessing",
|
|
847
834
|
"isRootLangGraphTerminalEvent",
|
|
835
|
+
"resolveAgentExecutionWorkspace",
|
|
836
|
+
"resolveAgentMemorySources",
|
|
848
837
|
"resolveExecutionWorkspace",
|
|
849
838
|
"resolveExternalOutputMount",
|
|
850
839
|
"resolveHumanInTheLoopSettings",
|
|
@@ -78,6 +78,7 @@ type UserContentPart = {
|
|
|
78
78
|
};
|
|
79
79
|
export declare const WORKDIR_VIRTUAL_PATH = "/workdir/";
|
|
80
80
|
export declare const OUTPUT_VIRTUAL_PATH = "/output/";
|
|
81
|
+
export declare const AGENTS_MEMORY_VIRTUAL_PATHS: readonly ["/AGENTS.md"];
|
|
81
82
|
export type ExternalOutputMount = {
|
|
82
83
|
virtualPath: string | null;
|
|
83
84
|
absolutePath: string | null;
|
|
@@ -105,6 +106,8 @@ export type HumanInTheLoopSettings = {
|
|
|
105
106
|
}>;
|
|
106
107
|
};
|
|
107
108
|
export declare const resolveExecutionWorkspace: (workspace: string, workdir?: string | null) => string;
|
|
109
|
+
export declare const resolveAgentExecutionWorkspace: (workspace: string, workdir?: string | null, defaultOutputDir?: string | null) => string;
|
|
110
|
+
export declare const resolveAgentMemorySources: (executionWorkspace: string) => string[];
|
|
108
111
|
export declare const toWorkspaceAliasVirtualPath: (absolutePath: string) => string | null;
|
|
109
112
|
export declare const resolveExternalOutputMount: (workspace: string, workdir?: string | null, defaultOutputDir?: string | null) => ExternalOutputMount;
|
|
110
113
|
export declare const resolveSummarizationMiddlewareSettings: (config: WingmanConfigType) => SummarizationMiddlewareSettings | null;
|
|
@@ -128,19 +131,12 @@ export declare const selectStreamingFallbackText: (previousMessages: Array<{
|
|
|
128
131
|
export declare const detectStreamErrorMessage: (chunk: unknown) => string | undefined;
|
|
129
132
|
export declare const trackRootLangGraphRunId: (currentRootLangGraphRunId: string | undefined, chunk: unknown) => string | undefined;
|
|
130
133
|
export declare const isRootLangGraphTerminalEvent: (chunk: unknown, rootLangGraphRunId?: string) => boolean;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
};
|
|
138
|
-
type EvaluateStreamingCompletionInput = {
|
|
139
|
-
sawAssistantText: boolean;
|
|
140
|
-
fallbackText?: string;
|
|
141
|
-
streamErrorMessage?: string;
|
|
142
|
-
};
|
|
143
|
-
export declare const evaluateStreamingCompletion: (input: EvaluateStreamingCompletionInput) => StreamingCompletionOutcome;
|
|
134
|
+
export declare const emitCompletionAndContinuePostProcessing: (input: {
|
|
135
|
+
outputManager: Pick<OutputManager, "emitAgentComplete">;
|
|
136
|
+
result: unknown;
|
|
137
|
+
postProcess?: () => Promise<void>;
|
|
138
|
+
logger?: Pick<Logger, "debug">;
|
|
139
|
+
}) => void;
|
|
144
140
|
export declare class AgentInvoker {
|
|
145
141
|
private loader;
|
|
146
142
|
private outputManager;
|
|
@@ -170,6 +166,7 @@ export declare class AgentInvoker {
|
|
|
170
166
|
name: string;
|
|
171
167
|
description: string;
|
|
172
168
|
}>;
|
|
169
|
+
private materializeSessionImages;
|
|
173
170
|
}
|
|
174
171
|
export declare function buildUserContent(prompt: string, attachments?: MediaAttachment[], model?: unknown): string | UserContentPart[];
|
|
175
172
|
export {};
|
|
@@ -24,6 +24,9 @@ function _define_property(obj, key, value) {
|
|
|
24
24
|
}
|
|
25
25
|
const WORKDIR_VIRTUAL_PATH = "/workdir/";
|
|
26
26
|
const OUTPUT_VIRTUAL_PATH = "/output/";
|
|
27
|
+
const AGENTS_MEMORY_VIRTUAL_PATHS = [
|
|
28
|
+
"/AGENTS.md"
|
|
29
|
+
];
|
|
27
30
|
const DEFAULT_DEEPAGENT_MODEL = "claude-sonnet-4-5-20250929";
|
|
28
31
|
const isPathWithinRoot = (targetPath, rootPath)=>{
|
|
29
32
|
const normalizedTarget = normalize(targetPath);
|
|
@@ -35,6 +38,11 @@ const resolveExecutionWorkspace = (workspace, workdir)=>{
|
|
|
35
38
|
if (isAbsolute(workdir)) return normalize(workdir);
|
|
36
39
|
return normalize(join(workspace, workdir));
|
|
37
40
|
};
|
|
41
|
+
const resolveAgentExecutionWorkspace = (workspace, workdir, defaultOutputDir)=>{
|
|
42
|
+
const preferredWorkdir = workdir || defaultOutputDir || null;
|
|
43
|
+
return resolveExecutionWorkspace(workspace, preferredWorkdir);
|
|
44
|
+
};
|
|
45
|
+
const resolveAgentMemorySources = (executionWorkspace)=>AGENTS_MEMORY_VIRTUAL_PATHS.filter((memoryPath)=>existsSync(join(executionWorkspace, memoryPath.replace(/^\/+/, ""))));
|
|
38
46
|
const toWorkspaceAliasVirtualPath = (absolutePath)=>{
|
|
39
47
|
const normalized = normalize(absolutePath);
|
|
40
48
|
if (!isAbsolute(normalized)) return null;
|
|
@@ -238,24 +246,19 @@ const trackRootLangGraphRunId = (currentRootLangGraphRunId, chunk)=>{
|
|
|
238
246
|
return extractEventRunId(eventRecord) || currentRootLangGraphRunId;
|
|
239
247
|
};
|
|
240
248
|
const isRootLangGraphTerminalEvent = (chunk, rootLangGraphRunId)=>{
|
|
241
|
-
if (!rootLangGraphRunId) return false;
|
|
242
249
|
const eventRecord = extractStreamEventRecord(chunk);
|
|
243
250
|
if (!eventRecord || !isRootLangGraphChainEvent(eventRecord, "on_chain_end")) return false;
|
|
251
|
+
if (!rootLangGraphRunId) return true;
|
|
244
252
|
const chunkRunId = extractEventRunId(eventRecord);
|
|
253
|
+
if (!chunkRunId) return true;
|
|
245
254
|
return Boolean(chunkRunId && chunkRunId === rootLangGraphRunId);
|
|
246
255
|
};
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
message
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
return {
|
|
257
|
-
status: "ok"
|
|
258
|
-
};
|
|
256
|
+
const emitCompletionAndContinuePostProcessing = (input)=>{
|
|
257
|
+
input.outputManager.emitAgentComplete(input.result);
|
|
258
|
+
if (!input.postProcess) return;
|
|
259
|
+
input.postProcess().catch((error)=>{
|
|
260
|
+
input.logger?.debug("Failed post-completion processing for streamed agent response", error);
|
|
261
|
+
});
|
|
259
262
|
};
|
|
260
263
|
class AgentInvoker {
|
|
261
264
|
findAllAgents() {
|
|
@@ -269,14 +272,11 @@ class AgentInvoker {
|
|
|
269
272
|
let cancellationHandled = false;
|
|
270
273
|
let activeToolName = null;
|
|
271
274
|
let lastToolName = null;
|
|
272
|
-
let sawAssistantText = false;
|
|
273
|
-
let streamErrorMessage;
|
|
274
275
|
let rootLangGraphRunId;
|
|
275
|
-
let preInvocationMessages = null;
|
|
276
276
|
const isCancelled = ()=>options?.signal?.aborted === true;
|
|
277
277
|
try {
|
|
278
278
|
const hookSessionId = sessionId || v4();
|
|
279
|
-
const executionWorkspace =
|
|
279
|
+
const executionWorkspace = resolveAgentExecutionWorkspace(this.workspace, this.workdir, this.defaultOutputDir);
|
|
280
280
|
const effectiveWorkdir = this.workdir ? executionWorkspace : null;
|
|
281
281
|
const loader = new AgentLoader(this.configDir, this.workspace, this.wingmanConfig, executionWorkspace, {
|
|
282
282
|
terminalOwnerId: `${agentName}:${hookSessionId}`,
|
|
@@ -295,7 +295,9 @@ class AgentInvoker {
|
|
|
295
295
|
if (targetAgent.mcpUseGlobal && this.wingmanConfig.mcp) mcpConfigs.push(this.wingmanConfig.mcp);
|
|
296
296
|
if (mcpConfigs.length > 0) {
|
|
297
297
|
this.logger.debug("Initializing MCP client for agent invocation");
|
|
298
|
-
this.mcpManager = new MCPClientManager(mcpConfigs, this.logger
|
|
298
|
+
this.mcpManager = new MCPClientManager(mcpConfigs, this.logger, {
|
|
299
|
+
executionWorkspace
|
|
300
|
+
});
|
|
299
301
|
await this.mcpManager.initialize();
|
|
300
302
|
const mcpTools = await this.mcpManager.getTools();
|
|
301
303
|
if (mcpTools.length > 0) {
|
|
@@ -312,6 +314,7 @@ class AgentInvoker {
|
|
|
312
314
|
const normalizedSkillsDirectory = skillsDirectory.replace(/^\/+|\/+$/g, "");
|
|
313
315
|
const skillsVirtualPath = `/${normalizedSkillsDirectory}/`;
|
|
314
316
|
const outputMount = resolveExternalOutputMount(executionWorkspace, effectiveWorkdir, this.defaultOutputDir);
|
|
317
|
+
const memorySources = resolveAgentMemorySources(executionWorkspace);
|
|
315
318
|
const middleware = [
|
|
316
319
|
mediaCompatibilityMiddleware({
|
|
317
320
|
model: targetAgent.model
|
|
@@ -396,6 +399,7 @@ class AgentInvoker {
|
|
|
396
399
|
middleware: middleware,
|
|
397
400
|
interruptOn: hitlSettings?.interruptOn,
|
|
398
401
|
skills: skillsSources,
|
|
402
|
+
memory: memorySources,
|
|
399
403
|
subagents: targetAgent.subagents || [],
|
|
400
404
|
checkpointer: checkpointer
|
|
401
405
|
});
|
|
@@ -404,15 +408,6 @@ class AgentInvoker {
|
|
|
404
408
|
const userContent = buildUserContent(prompt, attachments, targetAgent.model);
|
|
405
409
|
if (this.sessionManager && sessionId) {
|
|
406
410
|
this.logger.debug(`Using streaming with session: ${sessionId}`);
|
|
407
|
-
try {
|
|
408
|
-
const messages = await this.sessionManager.listMessages(sessionId);
|
|
409
|
-
preInvocationMessages = messages.map((message)=>({
|
|
410
|
-
role: message.role,
|
|
411
|
-
content: message.content
|
|
412
|
-
}));
|
|
413
|
-
} catch (stateError) {
|
|
414
|
-
this.logger.debug("Failed to capture pre-invocation session state", stateError);
|
|
415
|
-
}
|
|
416
411
|
const stream = await standaloneAgent.streamEvents({
|
|
417
412
|
messages: [
|
|
418
413
|
{
|
|
@@ -430,8 +425,6 @@ class AgentInvoker {
|
|
|
430
425
|
});
|
|
431
426
|
for await (const chunk of stream){
|
|
432
427
|
rootLangGraphRunId = trackRootLangGraphRunId(rootLangGraphRunId, chunk);
|
|
433
|
-
if (!sawAssistantText && chunkHasAssistantText(chunk)) sawAssistantText = true;
|
|
434
|
-
if (!streamErrorMessage) streamErrorMessage = detectStreamErrorMessage(chunk);
|
|
435
428
|
const toolEvent = detectToolEventContext(chunk);
|
|
436
429
|
if (toolEvent) {
|
|
437
430
|
lastToolName = toolEvent.toolName;
|
|
@@ -461,37 +454,15 @@ class AgentInvoker {
|
|
|
461
454
|
cancelled: true
|
|
462
455
|
};
|
|
463
456
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
this.logger
|
|
473
|
-
}
|
|
474
|
-
const completionOutcome = evaluateStreamingCompletion({
|
|
475
|
-
sawAssistantText,
|
|
476
|
-
fallbackText,
|
|
477
|
-
streamErrorMessage
|
|
478
|
-
});
|
|
479
|
-
if ("blocked" === completionOutcome.status) {
|
|
480
|
-
this.logger.warn(completionOutcome.message);
|
|
481
|
-
this.outputManager.emitAgentError(completionOutcome.message);
|
|
482
|
-
return {
|
|
483
|
-
blocked: true,
|
|
484
|
-
reason: completionOutcome.reason
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
this.logger.info("Agent streaming completed successfully", {
|
|
488
|
-
usedFallbackText: Boolean(fallbackText)
|
|
489
|
-
});
|
|
490
|
-
this.outputManager.emitAgentComplete({
|
|
491
|
-
streaming: true,
|
|
492
|
-
...fallbackText ? {
|
|
493
|
-
fallbackText
|
|
494
|
-
} : {}
|
|
457
|
+
this.logger.info("Agent streaming completed successfully");
|
|
458
|
+
const completionPayload = {
|
|
459
|
+
streaming: true
|
|
460
|
+
};
|
|
461
|
+
emitCompletionAndContinuePostProcessing({
|
|
462
|
+
outputManager: this.outputManager,
|
|
463
|
+
result: completionPayload,
|
|
464
|
+
postProcess: ()=>this.materializeSessionImages(sessionId),
|
|
465
|
+
logger: this.logger
|
|
495
466
|
});
|
|
496
467
|
return {
|
|
497
468
|
streaming: true
|
|
@@ -527,7 +498,12 @@ class AgentInvoker {
|
|
|
527
498
|
};
|
|
528
499
|
}
|
|
529
500
|
this.logger.info("Agent completed successfully");
|
|
530
|
-
|
|
501
|
+
emitCompletionAndContinuePostProcessing({
|
|
502
|
+
outputManager: this.outputManager,
|
|
503
|
+
result,
|
|
504
|
+
postProcess: ()=>this.materializeSessionImages(sessionId),
|
|
505
|
+
logger: this.logger
|
|
506
|
+
});
|
|
531
507
|
return result;
|
|
532
508
|
}
|
|
533
509
|
} catch (error) {
|
|
@@ -559,6 +535,10 @@ class AgentInvoker {
|
|
|
559
535
|
description: a.description
|
|
560
536
|
}));
|
|
561
537
|
}
|
|
538
|
+
async materializeSessionImages(sessionId) {
|
|
539
|
+
if (!this.sessionManager || !sessionId) return;
|
|
540
|
+
await this.sessionManager.listMessages(sessionId);
|
|
541
|
+
}
|
|
562
542
|
constructor(options){
|
|
563
543
|
_define_property(this, "loader", void 0);
|
|
564
544
|
_define_property(this, "outputManager", void 0);
|
|
@@ -769,4 +749,4 @@ function buildAttachmentPreview(attachments) {
|
|
|
769
749
|
if (hasImage) return "[image]";
|
|
770
750
|
return "";
|
|
771
751
|
}
|
|
772
|
-
export { AgentInvoker, OUTPUT_VIRTUAL_PATH, WORKDIR_VIRTUAL_PATH, buildUserContent, chunkHasAssistantText, configureDeepAgentSummarizationMiddleware, detectStreamErrorMessage, detectToolEventContext,
|
|
752
|
+
export { AGENTS_MEMORY_VIRTUAL_PATHS, AgentInvoker, OUTPUT_VIRTUAL_PATH, WORKDIR_VIRTUAL_PATH, buildUserContent, chunkHasAssistantText, configureDeepAgentSummarizationMiddleware, detectStreamErrorMessage, detectToolEventContext, emitCompletionAndContinuePostProcessing, isRootLangGraphTerminalEvent, resolveAgentExecutionWorkspace, resolveAgentMemorySources, resolveExecutionWorkspace, resolveExternalOutputMount, resolveHumanInTheLoopSettings, resolveModelRetryMiddlewareSettings, resolveSummarizationMiddlewareSettings, resolveToolRetryMiddlewareSettings, selectStreamingFallbackText, toWorkspaceAliasVirtualPath, trackRootLangGraphRunId };
|