@voltagent/server-core 2.1.6 → 2.1.7
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/{edge-pCgIZLUz.d.mts → edge-BaWB_sdV.d.mts} +61 -1
- package/dist/{edge-pCgIZLUz.d.ts → edge-BaWB_sdV.d.ts} +61 -1
- package/dist/edge.d.mts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +283 -47
- package/dist/edge.js.map +1 -1
- package/dist/edge.mjs +282 -47
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +359 -143
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +360 -145
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -573,6 +573,32 @@ declare const WORKFLOW_ROUTES: {
|
|
|
573
573
|
};
|
|
574
574
|
};
|
|
575
575
|
};
|
|
576
|
+
readonly attachWorkflowStream: {
|
|
577
|
+
readonly method: "get";
|
|
578
|
+
readonly path: "/workflows/:id/executions/:executionId/stream";
|
|
579
|
+
readonly summary: "Attach to workflow execution stream";
|
|
580
|
+
readonly description: "Attach to an in-progress workflow execution stream and receive real-time events via Server-Sent Events (SSE). Use Last-Event-ID header or `fromSequence` query parameter to replay missed events on reconnect.";
|
|
581
|
+
readonly tags: readonly ["Workflow Management"];
|
|
582
|
+
readonly operationId: "attachWorkflowStream";
|
|
583
|
+
readonly responses: {
|
|
584
|
+
readonly 200: {
|
|
585
|
+
readonly description: "Successfully attached to workflow SSE stream";
|
|
586
|
+
readonly contentType: "text/event-stream";
|
|
587
|
+
};
|
|
588
|
+
readonly 404: {
|
|
589
|
+
readonly description: "Workflow or execution not found";
|
|
590
|
+
readonly contentType: "application/json";
|
|
591
|
+
};
|
|
592
|
+
readonly 409: {
|
|
593
|
+
readonly description: "Workflow execution is not streamable in current state";
|
|
594
|
+
readonly contentType: "application/json";
|
|
595
|
+
};
|
|
596
|
+
readonly 500: {
|
|
597
|
+
readonly description: "Failed to attach workflow stream due to server error";
|
|
598
|
+
readonly contentType: "application/json";
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
};
|
|
576
602
|
readonly suspendWorkflow: {
|
|
577
603
|
readonly method: "post";
|
|
578
604
|
readonly path: "/workflows/:id/executions/:executionId/suspend";
|
|
@@ -2179,6 +2205,32 @@ declare const ALL_ROUTES: {
|
|
|
2179
2205
|
};
|
|
2180
2206
|
};
|
|
2181
2207
|
};
|
|
2208
|
+
readonly attachWorkflowStream: {
|
|
2209
|
+
readonly method: "get";
|
|
2210
|
+
readonly path: "/workflows/:id/executions/:executionId/stream";
|
|
2211
|
+
readonly summary: "Attach to workflow execution stream";
|
|
2212
|
+
readonly description: "Attach to an in-progress workflow execution stream and receive real-time events via Server-Sent Events (SSE). Use Last-Event-ID header or `fromSequence` query parameter to replay missed events on reconnect.";
|
|
2213
|
+
readonly tags: readonly ["Workflow Management"];
|
|
2214
|
+
readonly operationId: "attachWorkflowStream";
|
|
2215
|
+
readonly responses: {
|
|
2216
|
+
readonly 200: {
|
|
2217
|
+
readonly description: "Successfully attached to workflow SSE stream";
|
|
2218
|
+
readonly contentType: "text/event-stream";
|
|
2219
|
+
};
|
|
2220
|
+
readonly 404: {
|
|
2221
|
+
readonly description: "Workflow or execution not found";
|
|
2222
|
+
readonly contentType: "application/json";
|
|
2223
|
+
};
|
|
2224
|
+
readonly 409: {
|
|
2225
|
+
readonly description: "Workflow execution is not streamable in current state";
|
|
2226
|
+
readonly contentType: "application/json";
|
|
2227
|
+
};
|
|
2228
|
+
readonly 500: {
|
|
2229
|
+
readonly description: "Failed to attach workflow stream due to server error";
|
|
2230
|
+
readonly contentType: "application/json";
|
|
2231
|
+
};
|
|
2232
|
+
};
|
|
2233
|
+
};
|
|
2182
2234
|
readonly suspendWorkflow: {
|
|
2183
2235
|
readonly method: "post";
|
|
2184
2236
|
readonly path: "/workflows/:id/executions/:executionId/suspend";
|
|
@@ -3103,6 +3155,14 @@ declare function handleExecuteWorkflow(workflowId: string, body: any, deps: Serv
|
|
|
3103
3155
|
* Returns a ReadableStream for SSE
|
|
3104
3156
|
*/
|
|
3105
3157
|
declare function handleStreamWorkflow(workflowId: string, body: any, deps: ServerProviderDeps, logger: Logger): Promise<ReadableStream | ErrorResponse>;
|
|
3158
|
+
/**
|
|
3159
|
+
* Handler for attaching to an existing workflow execution stream
|
|
3160
|
+
* Returns a ReadableStream for SSE
|
|
3161
|
+
*/
|
|
3162
|
+
declare function handleAttachWorkflowStream(workflowId: string, executionId: string, query: {
|
|
3163
|
+
fromSequence?: string | number;
|
|
3164
|
+
lastEventId?: string | null;
|
|
3165
|
+
}, deps: ServerProviderDeps, logger: Logger): Promise<ReadableStream | ErrorResponse>;
|
|
3106
3166
|
/**
|
|
3107
3167
|
* Handler for suspending a workflow
|
|
3108
3168
|
* Returns suspension result
|
|
@@ -3400,4 +3460,4 @@ declare function mapHandlerResponse(response: ApiResponse, type?: string): ApiRe
|
|
|
3400
3460
|
*/
|
|
3401
3461
|
declare function getResponseStatus(response: ApiResponse): number;
|
|
3402
3462
|
|
|
3403
|
-
export { handleStreamText as $, type ApiResponse as A, type JsonRpcResponse as B, type JsonRpcStream as C, type JsonRpcHandlerResult as D, type ErrorResponse as E, type JsonRpcRequest as F, type A2ARequestContext as G, type HttpMethod as H, type AgentCardSkill as I, type JsonRpcError as J, type AgentCardProviderInfo as K, LOG_ROUTES as L, type MemoryUserSummary as M, type AgentCardCapabilities as N, OBSERVABILITY_ROUTES as O, type AgentCard as P, A2AErrorCode as Q, type ResponseDefinition as R, type SuccessResponse as S, TOOL_ROUTES as T, UPDATE_ROUTES as U, VoltA2AError as V, WORKFLOW_ROUTES as W, normalizeError as X, isJsonRpcRequest as Y, handleGetAgents as Z, handleGenerateText as _, type A2AServerLikeWithHandlers as a, handleChatStream as a0, handleResumeChatStream as a1, handleGenerateObject as a2, handleStreamObject as a3, handleGetAgent as a4, handleGetAgentHistory as a5, handleGetAgentWorkspaceInfo as a6, handleListAgentWorkspaceFiles as a7, handleReadAgentWorkspaceFile as a8, handleListAgentWorkspaceSkills as a9,
|
|
3463
|
+
export { handleStreamText as $, type ApiResponse as A, type JsonRpcResponse as B, type JsonRpcStream as C, type JsonRpcHandlerResult as D, type ErrorResponse as E, type JsonRpcRequest as F, type A2ARequestContext as G, type HttpMethod as H, type AgentCardSkill as I, type JsonRpcError as J, type AgentCardProviderInfo as K, LOG_ROUTES as L, type MemoryUserSummary as M, type AgentCardCapabilities as N, OBSERVABILITY_ROUTES as O, type AgentCard as P, A2AErrorCode as Q, type ResponseDefinition as R, type SuccessResponse as S, TOOL_ROUTES as T, UPDATE_ROUTES as U, VoltA2AError as V, WORKFLOW_ROUTES as W, normalizeError as X, isJsonRpcRequest as Y, handleGetAgents as Z, handleGenerateText as _, type A2AServerLikeWithHandlers as a, handleChatStream as a0, handleResumeChatStream as a1, handleGenerateObject as a2, handleStreamObject as a3, handleGetAgent as a4, handleGetAgentHistory as a5, handleGetAgentWorkspaceInfo as a6, handleListAgentWorkspaceFiles as a7, handleReadAgentWorkspaceFile as a8, handleListAgentWorkspaceSkills as a9, listMemoryUsersHandler as aA, listMemoryConversationsHandler as aB, getConversationMessagesHandler as aC, getConversationStepsHandler as aD, getWorkingMemoryHandler as aE, mapLogResponse as aF, mapHandlerResponse as aG, getResponseStatus as aH, type OpenApiInfo as aI, type AppSetupConfig as aJ, getOrCreateLogger as aK, shouldEnableSwaggerUI as aL, getOpenApiDoc as aM, DEFAULT_CORS_OPTIONS as aN, handleGetAgentWorkspaceSkill as aa, handleGetWorkflows as ab, handleGetWorkflow as ac, handleExecuteWorkflow as ad, handleStreamWorkflow as ae, handleAttachWorkflowStream as af, handleSuspendWorkflow as ag, handleCancelWorkflow as ah, handleResumeWorkflow as ai, handleListWorkflowRuns as aj, handleGetWorkflowState as ak, type LogFilterOptions as al, type LogHandlerResponse as am, handleGetLogs as an, handleListMemoryConversations as ao, handleGetMemoryConversation as ap, handleListMemoryConversationMessages as aq, handleGetMemoryWorkingMemory as ar, handleSaveMemoryMessages as as, handleCreateMemoryConversation as at, handleUpdateMemoryConversation as au, handleDeleteMemoryConversation as av, handleCloneMemoryConversation as aw, handleUpdateMemoryWorkingMemory as ax, handleDeleteMemoryMessages as ay, handleSearchMemory as az, type StreamResponse as b, isSuccessResponse as c, type MemoryUserAgentSummary as d, type MemoryConversationSummary as e, type MemoryConversationMessagesResult as f, type MemoryConversationStepsResult as g, type MemoryWorkingMemoryResult as h, isErrorResponse as i, type MemoryListUsersQuery as j, type MemoryListConversationsQuery as k, type MemoryGetMessagesQuery as l, type MemoryGetStepsQuery as m, type RouteDefinition as n, AGENT_ROUTES as o, OBSERVABILITY_MEMORY_ROUTES as p, MEMORY_ROUTES as q, ALL_ROUTES as r, getAllRoutesArray as s, MCP_ROUTES as t, A2A_ROUTES as u, getRoutesByTag as v, parseJsonRpcRequest as w, resolveAgentCard as x, executeA2ARequest as y, type A2AJsonRpcId as z };
|
|
@@ -573,6 +573,32 @@ declare const WORKFLOW_ROUTES: {
|
|
|
573
573
|
};
|
|
574
574
|
};
|
|
575
575
|
};
|
|
576
|
+
readonly attachWorkflowStream: {
|
|
577
|
+
readonly method: "get";
|
|
578
|
+
readonly path: "/workflows/:id/executions/:executionId/stream";
|
|
579
|
+
readonly summary: "Attach to workflow execution stream";
|
|
580
|
+
readonly description: "Attach to an in-progress workflow execution stream and receive real-time events via Server-Sent Events (SSE). Use Last-Event-ID header or `fromSequence` query parameter to replay missed events on reconnect.";
|
|
581
|
+
readonly tags: readonly ["Workflow Management"];
|
|
582
|
+
readonly operationId: "attachWorkflowStream";
|
|
583
|
+
readonly responses: {
|
|
584
|
+
readonly 200: {
|
|
585
|
+
readonly description: "Successfully attached to workflow SSE stream";
|
|
586
|
+
readonly contentType: "text/event-stream";
|
|
587
|
+
};
|
|
588
|
+
readonly 404: {
|
|
589
|
+
readonly description: "Workflow or execution not found";
|
|
590
|
+
readonly contentType: "application/json";
|
|
591
|
+
};
|
|
592
|
+
readonly 409: {
|
|
593
|
+
readonly description: "Workflow execution is not streamable in current state";
|
|
594
|
+
readonly contentType: "application/json";
|
|
595
|
+
};
|
|
596
|
+
readonly 500: {
|
|
597
|
+
readonly description: "Failed to attach workflow stream due to server error";
|
|
598
|
+
readonly contentType: "application/json";
|
|
599
|
+
};
|
|
600
|
+
};
|
|
601
|
+
};
|
|
576
602
|
readonly suspendWorkflow: {
|
|
577
603
|
readonly method: "post";
|
|
578
604
|
readonly path: "/workflows/:id/executions/:executionId/suspend";
|
|
@@ -2179,6 +2205,32 @@ declare const ALL_ROUTES: {
|
|
|
2179
2205
|
};
|
|
2180
2206
|
};
|
|
2181
2207
|
};
|
|
2208
|
+
readonly attachWorkflowStream: {
|
|
2209
|
+
readonly method: "get";
|
|
2210
|
+
readonly path: "/workflows/:id/executions/:executionId/stream";
|
|
2211
|
+
readonly summary: "Attach to workflow execution stream";
|
|
2212
|
+
readonly description: "Attach to an in-progress workflow execution stream and receive real-time events via Server-Sent Events (SSE). Use Last-Event-ID header or `fromSequence` query parameter to replay missed events on reconnect.";
|
|
2213
|
+
readonly tags: readonly ["Workflow Management"];
|
|
2214
|
+
readonly operationId: "attachWorkflowStream";
|
|
2215
|
+
readonly responses: {
|
|
2216
|
+
readonly 200: {
|
|
2217
|
+
readonly description: "Successfully attached to workflow SSE stream";
|
|
2218
|
+
readonly contentType: "text/event-stream";
|
|
2219
|
+
};
|
|
2220
|
+
readonly 404: {
|
|
2221
|
+
readonly description: "Workflow or execution not found";
|
|
2222
|
+
readonly contentType: "application/json";
|
|
2223
|
+
};
|
|
2224
|
+
readonly 409: {
|
|
2225
|
+
readonly description: "Workflow execution is not streamable in current state";
|
|
2226
|
+
readonly contentType: "application/json";
|
|
2227
|
+
};
|
|
2228
|
+
readonly 500: {
|
|
2229
|
+
readonly description: "Failed to attach workflow stream due to server error";
|
|
2230
|
+
readonly contentType: "application/json";
|
|
2231
|
+
};
|
|
2232
|
+
};
|
|
2233
|
+
};
|
|
2182
2234
|
readonly suspendWorkflow: {
|
|
2183
2235
|
readonly method: "post";
|
|
2184
2236
|
readonly path: "/workflows/:id/executions/:executionId/suspend";
|
|
@@ -3103,6 +3155,14 @@ declare function handleExecuteWorkflow(workflowId: string, body: any, deps: Serv
|
|
|
3103
3155
|
* Returns a ReadableStream for SSE
|
|
3104
3156
|
*/
|
|
3105
3157
|
declare function handleStreamWorkflow(workflowId: string, body: any, deps: ServerProviderDeps, logger: Logger): Promise<ReadableStream | ErrorResponse>;
|
|
3158
|
+
/**
|
|
3159
|
+
* Handler for attaching to an existing workflow execution stream
|
|
3160
|
+
* Returns a ReadableStream for SSE
|
|
3161
|
+
*/
|
|
3162
|
+
declare function handleAttachWorkflowStream(workflowId: string, executionId: string, query: {
|
|
3163
|
+
fromSequence?: string | number;
|
|
3164
|
+
lastEventId?: string | null;
|
|
3165
|
+
}, deps: ServerProviderDeps, logger: Logger): Promise<ReadableStream | ErrorResponse>;
|
|
3106
3166
|
/**
|
|
3107
3167
|
* Handler for suspending a workflow
|
|
3108
3168
|
* Returns suspension result
|
|
@@ -3400,4 +3460,4 @@ declare function mapHandlerResponse(response: ApiResponse, type?: string): ApiRe
|
|
|
3400
3460
|
*/
|
|
3401
3461
|
declare function getResponseStatus(response: ApiResponse): number;
|
|
3402
3462
|
|
|
3403
|
-
export { handleStreamText as $, type ApiResponse as A, type JsonRpcResponse as B, type JsonRpcStream as C, type JsonRpcHandlerResult as D, type ErrorResponse as E, type JsonRpcRequest as F, type A2ARequestContext as G, type HttpMethod as H, type AgentCardSkill as I, type JsonRpcError as J, type AgentCardProviderInfo as K, LOG_ROUTES as L, type MemoryUserSummary as M, type AgentCardCapabilities as N, OBSERVABILITY_ROUTES as O, type AgentCard as P, A2AErrorCode as Q, type ResponseDefinition as R, type SuccessResponse as S, TOOL_ROUTES as T, UPDATE_ROUTES as U, VoltA2AError as V, WORKFLOW_ROUTES as W, normalizeError as X, isJsonRpcRequest as Y, handleGetAgents as Z, handleGenerateText as _, type A2AServerLikeWithHandlers as a, handleChatStream as a0, handleResumeChatStream as a1, handleGenerateObject as a2, handleStreamObject as a3, handleGetAgent as a4, handleGetAgentHistory as a5, handleGetAgentWorkspaceInfo as a6, handleListAgentWorkspaceFiles as a7, handleReadAgentWorkspaceFile as a8, handleListAgentWorkspaceSkills as a9,
|
|
3463
|
+
export { handleStreamText as $, type ApiResponse as A, type JsonRpcResponse as B, type JsonRpcStream as C, type JsonRpcHandlerResult as D, type ErrorResponse as E, type JsonRpcRequest as F, type A2ARequestContext as G, type HttpMethod as H, type AgentCardSkill as I, type JsonRpcError as J, type AgentCardProviderInfo as K, LOG_ROUTES as L, type MemoryUserSummary as M, type AgentCardCapabilities as N, OBSERVABILITY_ROUTES as O, type AgentCard as P, A2AErrorCode as Q, type ResponseDefinition as R, type SuccessResponse as S, TOOL_ROUTES as T, UPDATE_ROUTES as U, VoltA2AError as V, WORKFLOW_ROUTES as W, normalizeError as X, isJsonRpcRequest as Y, handleGetAgents as Z, handleGenerateText as _, type A2AServerLikeWithHandlers as a, handleChatStream as a0, handleResumeChatStream as a1, handleGenerateObject as a2, handleStreamObject as a3, handleGetAgent as a4, handleGetAgentHistory as a5, handleGetAgentWorkspaceInfo as a6, handleListAgentWorkspaceFiles as a7, handleReadAgentWorkspaceFile as a8, handleListAgentWorkspaceSkills as a9, listMemoryUsersHandler as aA, listMemoryConversationsHandler as aB, getConversationMessagesHandler as aC, getConversationStepsHandler as aD, getWorkingMemoryHandler as aE, mapLogResponse as aF, mapHandlerResponse as aG, getResponseStatus as aH, type OpenApiInfo as aI, type AppSetupConfig as aJ, getOrCreateLogger as aK, shouldEnableSwaggerUI as aL, getOpenApiDoc as aM, DEFAULT_CORS_OPTIONS as aN, handleGetAgentWorkspaceSkill as aa, handleGetWorkflows as ab, handleGetWorkflow as ac, handleExecuteWorkflow as ad, handleStreamWorkflow as ae, handleAttachWorkflowStream as af, handleSuspendWorkflow as ag, handleCancelWorkflow as ah, handleResumeWorkflow as ai, handleListWorkflowRuns as aj, handleGetWorkflowState as ak, type LogFilterOptions as al, type LogHandlerResponse as am, handleGetLogs as an, handleListMemoryConversations as ao, handleGetMemoryConversation as ap, handleListMemoryConversationMessages as aq, handleGetMemoryWorkingMemory as ar, handleSaveMemoryMessages as as, handleCreateMemoryConversation as at, handleUpdateMemoryConversation as au, handleDeleteMemoryConversation as av, handleCloneMemoryConversation as aw, handleUpdateMemoryWorkingMemory as ax, handleDeleteMemoryMessages as ay, handleSearchMemory as az, type StreamResponse as b, isSuccessResponse as c, type MemoryUserAgentSummary as d, type MemoryConversationSummary as e, type MemoryConversationMessagesResult as f, type MemoryConversationStepsResult as g, type MemoryWorkingMemoryResult as h, isErrorResponse as i, type MemoryListUsersQuery as j, type MemoryListConversationsQuery as k, type MemoryGetMessagesQuery as l, type MemoryGetStepsQuery as m, type RouteDefinition as n, AGENT_ROUTES as o, OBSERVABILITY_MEMORY_ROUTES as p, MEMORY_ROUTES as q, ALL_ROUTES as r, getAllRoutesArray as s, MCP_ROUTES as t, A2A_ROUTES as u, getRoutesByTag as v, parseJsonRpcRequest as w, resolveAgentCard as x, executeA2ARequest as y, type A2AJsonRpcId as z };
|
package/dist/edge.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { G as A2ARequestContext, u as A2A_ROUTES, o as AGENT_ROUTES, L as LOG_ROUTES, q as MEMORY_ROUTES, p as OBSERVABILITY_MEMORY_ROUTES, O as OBSERVABILITY_ROUTES, W as WORKFLOW_ROUTES, y as executeA2ARequest,
|
|
1
|
+
export { G as A2ARequestContext, u as A2A_ROUTES, o as AGENT_ROUTES, L as LOG_ROUTES, q as MEMORY_ROUTES, p as OBSERVABILITY_MEMORY_ROUTES, O as OBSERVABILITY_ROUTES, W as WORKFLOW_ROUTES, y as executeA2ARequest, aC as getConversationMessagesHandler, aD as getConversationStepsHandler, aK as getOrCreateLogger, aE as getWorkingMemoryHandler, af as handleAttachWorkflowStream, a0 as handleChatStream, aw as handleCloneMemoryConversation, at as handleCreateMemoryConversation, av as handleDeleteMemoryConversation, ay as handleDeleteMemoryMessages, ad as handleExecuteWorkflow, a2 as handleGenerateObject, _ as handleGenerateText, a4 as handleGetAgent, a5 as handleGetAgentHistory, Z as handleGetAgents, an as handleGetLogs, ap as handleGetMemoryConversation, ar as handleGetMemoryWorkingMemory, ac as handleGetWorkflow, ak as handleGetWorkflowState, ab as handleGetWorkflows, aq as handleListMemoryConversationMessages, ao as handleListMemoryConversations, aj as handleListWorkflowRuns, a1 as handleResumeChatStream, ai as handleResumeWorkflow, as as handleSaveMemoryMessages, az as handleSearchMemory, a3 as handleStreamObject, $ as handleStreamText, ae as handleStreamWorkflow, ag as handleSuspendWorkflow, au as handleUpdateMemoryConversation, ax as handleUpdateMemoryWorkingMemory, i as isErrorResponse, aB as listMemoryConversationsHandler, aA as listMemoryUsersHandler, aF as mapLogResponse, w as parseJsonRpcRequest, x as resolveAgentCard } from './edge-BaWB_sdV.mjs';
|
|
2
2
|
import '@voltagent/core';
|
|
3
3
|
import '@voltagent/internal';
|
|
4
4
|
import 'ai';
|
package/dist/edge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { G as A2ARequestContext, u as A2A_ROUTES, o as AGENT_ROUTES, L as LOG_ROUTES, q as MEMORY_ROUTES, p as OBSERVABILITY_MEMORY_ROUTES, O as OBSERVABILITY_ROUTES, W as WORKFLOW_ROUTES, y as executeA2ARequest,
|
|
1
|
+
export { G as A2ARequestContext, u as A2A_ROUTES, o as AGENT_ROUTES, L as LOG_ROUTES, q as MEMORY_ROUTES, p as OBSERVABILITY_MEMORY_ROUTES, O as OBSERVABILITY_ROUTES, W as WORKFLOW_ROUTES, y as executeA2ARequest, aC as getConversationMessagesHandler, aD as getConversationStepsHandler, aK as getOrCreateLogger, aE as getWorkingMemoryHandler, af as handleAttachWorkflowStream, a0 as handleChatStream, aw as handleCloneMemoryConversation, at as handleCreateMemoryConversation, av as handleDeleteMemoryConversation, ay as handleDeleteMemoryMessages, ad as handleExecuteWorkflow, a2 as handleGenerateObject, _ as handleGenerateText, a4 as handleGetAgent, a5 as handleGetAgentHistory, Z as handleGetAgents, an as handleGetLogs, ap as handleGetMemoryConversation, ar as handleGetMemoryWorkingMemory, ac as handleGetWorkflow, ak as handleGetWorkflowState, ab as handleGetWorkflows, aq as handleListMemoryConversationMessages, ao as handleListMemoryConversations, aj as handleListWorkflowRuns, a1 as handleResumeChatStream, ai as handleResumeWorkflow, as as handleSaveMemoryMessages, az as handleSearchMemory, a3 as handleStreamObject, $ as handleStreamText, ae as handleStreamWorkflow, ag as handleSuspendWorkflow, au as handleUpdateMemoryConversation, ax as handleUpdateMemoryWorkingMemory, i as isErrorResponse, aB as listMemoryConversationsHandler, aA as listMemoryUsersHandler, aF as mapLogResponse, w as parseJsonRpcRequest, x as resolveAgentCard } from './edge-BaWB_sdV.js';
|
|
2
2
|
import '@voltagent/core';
|
|
3
3
|
import '@voltagent/internal';
|
|
4
4
|
import 'ai';
|
package/dist/edge.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(edge_exports, {
|
|
|
33
33
|
getConversationStepsHandler: () => getConversationStepsHandler,
|
|
34
34
|
getOrCreateLogger: () => getOrCreateLogger,
|
|
35
35
|
getWorkingMemoryHandler: () => getWorkingMemoryHandler,
|
|
36
|
+
handleAttachWorkflowStream: () => handleAttachWorkflowStream,
|
|
36
37
|
handleChatStream: () => handleChatStream,
|
|
37
38
|
handleCloneMemoryConversation: () => handleCloneMemoryConversation,
|
|
38
39
|
handleCreateMemoryConversation: () => handleCreateMemoryConversation,
|
|
@@ -541,6 +542,32 @@ var WORKFLOW_ROUTES = {
|
|
|
541
542
|
}
|
|
542
543
|
}
|
|
543
544
|
},
|
|
545
|
+
attachWorkflowStream: {
|
|
546
|
+
method: "get",
|
|
547
|
+
path: "/workflows/:id/executions/:executionId/stream",
|
|
548
|
+
summary: "Attach to workflow execution stream",
|
|
549
|
+
description: "Attach to an in-progress workflow execution stream and receive real-time events via Server-Sent Events (SSE). Use Last-Event-ID header or `fromSequence` query parameter to replay missed events on reconnect.",
|
|
550
|
+
tags: ["Workflow Management"],
|
|
551
|
+
operationId: "attachWorkflowStream",
|
|
552
|
+
responses: {
|
|
553
|
+
200: {
|
|
554
|
+
description: "Successfully attached to workflow SSE stream",
|
|
555
|
+
contentType: "text/event-stream"
|
|
556
|
+
},
|
|
557
|
+
404: {
|
|
558
|
+
description: "Workflow or execution not found",
|
|
559
|
+
contentType: "application/json"
|
|
560
|
+
},
|
|
561
|
+
409: {
|
|
562
|
+
description: "Workflow execution is not streamable in current state",
|
|
563
|
+
contentType: "application/json"
|
|
564
|
+
},
|
|
565
|
+
500: {
|
|
566
|
+
description: "Failed to attach workflow stream due to server error",
|
|
567
|
+
contentType: "application/json"
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
},
|
|
544
571
|
suspendWorkflow: {
|
|
545
572
|
method: "post",
|
|
546
573
|
path: "/workflows/:id/executions/:executionId/suspend",
|
|
@@ -1968,7 +1995,168 @@ __name(handleGetLogs, "handleGetLogs");
|
|
|
1968
1995
|
|
|
1969
1996
|
// src/handlers/workflow.handlers.ts
|
|
1970
1997
|
var import_core5 = require("@voltagent/core");
|
|
1998
|
+
|
|
1999
|
+
// src/utils/sse.ts
|
|
1971
2000
|
var import_internal2 = require("@voltagent/internal");
|
|
2001
|
+
function formatSSE(data, event, id) {
|
|
2002
|
+
let message = "";
|
|
2003
|
+
if (id) {
|
|
2004
|
+
message += `id: ${id}
|
|
2005
|
+
`;
|
|
2006
|
+
}
|
|
2007
|
+
if (event) {
|
|
2008
|
+
message += `event: ${event}
|
|
2009
|
+
`;
|
|
2010
|
+
}
|
|
2011
|
+
const dataStr = typeof data === "string" ? data : (0, import_internal2.safeStringify)(data);
|
|
2012
|
+
const lines = dataStr.split("\n");
|
|
2013
|
+
for (const line of lines) {
|
|
2014
|
+
message += `data: ${line}
|
|
2015
|
+
`;
|
|
2016
|
+
}
|
|
2017
|
+
message += "\n";
|
|
2018
|
+
return message;
|
|
2019
|
+
}
|
|
2020
|
+
__name(formatSSE, "formatSSE");
|
|
2021
|
+
|
|
2022
|
+
// src/handlers/workflow.handlers.ts
|
|
2023
|
+
var MAX_STREAM_REPLAY_HISTORY = 500;
|
|
2024
|
+
var activeWorkflowStreamSessions = /* @__PURE__ */ new Map();
|
|
2025
|
+
function parseReplaySequence(value) {
|
|
2026
|
+
if (value === void 0 || value === null || value === "") {
|
|
2027
|
+
return void 0;
|
|
2028
|
+
}
|
|
2029
|
+
const parsed = typeof value === "number" ? value : Number(value);
|
|
2030
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
2031
|
+
return void 0;
|
|
2032
|
+
}
|
|
2033
|
+
return Math.floor(parsed);
|
|
2034
|
+
}
|
|
2035
|
+
__name(parseReplaySequence, "parseReplaySequence");
|
|
2036
|
+
function createWorkflowStreamSession(workflowId, executionId, streamExecution) {
|
|
2037
|
+
return {
|
|
2038
|
+
workflowId,
|
|
2039
|
+
executionId,
|
|
2040
|
+
subscribers: /* @__PURE__ */ new Set(),
|
|
2041
|
+
replayBuffer: [],
|
|
2042
|
+
nextSequence: 1,
|
|
2043
|
+
isClosed: false,
|
|
2044
|
+
streamExecution
|
|
2045
|
+
};
|
|
2046
|
+
}
|
|
2047
|
+
__name(createWorkflowStreamSession, "createWorkflowStreamSession");
|
|
2048
|
+
function unregisterWorkflowStreamSession(session) {
|
|
2049
|
+
activeWorkflowStreamSessions.delete(session.executionId);
|
|
2050
|
+
}
|
|
2051
|
+
__name(unregisterWorkflowStreamSession, "unregisterWorkflowStreamSession");
|
|
2052
|
+
function closeWorkflowStreamSession(session) {
|
|
2053
|
+
if (session.isClosed) {
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
session.isClosed = true;
|
|
2057
|
+
for (const subscriber of session.subscribers) {
|
|
2058
|
+
try {
|
|
2059
|
+
subscriber.controller.close();
|
|
2060
|
+
} catch {
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
session.subscribers.clear();
|
|
2064
|
+
unregisterWorkflowStreamSession(session);
|
|
2065
|
+
}
|
|
2066
|
+
__name(closeWorkflowStreamSession, "closeWorkflowStreamSession");
|
|
2067
|
+
function enqueueSSEMessage(subscriber, payload, sequence) {
|
|
2068
|
+
const ssePayload = formatSSE(payload, void 0, String(sequence));
|
|
2069
|
+
subscriber.controller.enqueue(subscriber.encoder.encode(ssePayload));
|
|
2070
|
+
}
|
|
2071
|
+
__name(enqueueSSEMessage, "enqueueSSEMessage");
|
|
2072
|
+
function appendReplayEvent(session, payload, sequence) {
|
|
2073
|
+
session.replayBuffer.push({ sequence, payload });
|
|
2074
|
+
if (session.replayBuffer.length > MAX_STREAM_REPLAY_HISTORY) {
|
|
2075
|
+
session.replayBuffer.splice(0, session.replayBuffer.length - MAX_STREAM_REPLAY_HISTORY);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
__name(appendReplayEvent, "appendReplayEvent");
|
|
2079
|
+
function broadcastWorkflowStreamEvent(session, payload) {
|
|
2080
|
+
if (session.isClosed) {
|
|
2081
|
+
return;
|
|
2082
|
+
}
|
|
2083
|
+
const sequence = session.nextSequence;
|
|
2084
|
+
session.nextSequence += 1;
|
|
2085
|
+
appendReplayEvent(session, payload, sequence);
|
|
2086
|
+
for (const subscriber of session.subscribers) {
|
|
2087
|
+
try {
|
|
2088
|
+
enqueueSSEMessage(subscriber, payload, sequence);
|
|
2089
|
+
} catch {
|
|
2090
|
+
session.subscribers.delete(subscriber);
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
__name(broadcastWorkflowStreamEvent, "broadcastWorkflowStreamEvent");
|
|
2095
|
+
function createWorkflowSessionStream(session, options) {
|
|
2096
|
+
let subscriber;
|
|
2097
|
+
const replayFrom = options?.fromSequence;
|
|
2098
|
+
return new ReadableStream({
|
|
2099
|
+
start(controller) {
|
|
2100
|
+
subscriber = {
|
|
2101
|
+
controller,
|
|
2102
|
+
encoder: new TextEncoder()
|
|
2103
|
+
};
|
|
2104
|
+
if (replayFrom !== void 0) {
|
|
2105
|
+
for (const replayEntry of session.replayBuffer) {
|
|
2106
|
+
if (replayEntry.sequence > replayFrom) {
|
|
2107
|
+
enqueueSSEMessage(subscriber, replayEntry.payload, replayEntry.sequence);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
if (session.isClosed) {
|
|
2112
|
+
controller.close();
|
|
2113
|
+
return;
|
|
2114
|
+
}
|
|
2115
|
+
session.subscribers.add(subscriber);
|
|
2116
|
+
},
|
|
2117
|
+
cancel() {
|
|
2118
|
+
if (!subscriber) {
|
|
2119
|
+
return;
|
|
2120
|
+
}
|
|
2121
|
+
session.subscribers.delete(subscriber);
|
|
2122
|
+
}
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
__name(createWorkflowSessionStream, "createWorkflowSessionStream");
|
|
2126
|
+
async function consumeWorkflowStream(session, deps, logger) {
|
|
2127
|
+
try {
|
|
2128
|
+
for await (const event of session.streamExecution) {
|
|
2129
|
+
broadcastWorkflowStreamEvent(session, event);
|
|
2130
|
+
}
|
|
2131
|
+
const terminalExecution = session.streamExecution;
|
|
2132
|
+
const result = await terminalExecution.result;
|
|
2133
|
+
const status = await terminalExecution.status;
|
|
2134
|
+
const endAt = await terminalExecution.endAt;
|
|
2135
|
+
const finalEvent = {
|
|
2136
|
+
type: "workflow-result",
|
|
2137
|
+
executionId: terminalExecution.executionId,
|
|
2138
|
+
status,
|
|
2139
|
+
result,
|
|
2140
|
+
endAt: endAt instanceof Date ? endAt.toISOString() : endAt
|
|
2141
|
+
};
|
|
2142
|
+
broadcastWorkflowStreamEvent(session, finalEvent);
|
|
2143
|
+
if (deps.workflowRegistry.activeExecutions) {
|
|
2144
|
+
deps.workflowRegistry.activeExecutions.delete(terminalExecution.executionId);
|
|
2145
|
+
}
|
|
2146
|
+
closeWorkflowStreamSession(session);
|
|
2147
|
+
} catch (error) {
|
|
2148
|
+
logger.error("Failed during workflow stream:", { error });
|
|
2149
|
+
if (deps.workflowRegistry.activeExecutions) {
|
|
2150
|
+
deps.workflowRegistry.activeExecutions.delete(session.executionId);
|
|
2151
|
+
}
|
|
2152
|
+
broadcastWorkflowStreamEvent(session, {
|
|
2153
|
+
type: "error",
|
|
2154
|
+
error: error instanceof Error ? error.message : "Stream failed"
|
|
2155
|
+
});
|
|
2156
|
+
closeWorkflowStreamSession(session);
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
__name(consumeWorkflowStream, "consumeWorkflowStream");
|
|
1972
2160
|
async function handleGetWorkflows(deps, logger) {
|
|
1973
2161
|
try {
|
|
1974
2162
|
const workflows = deps.workflowRegistry.getWorkflowsForApi();
|
|
@@ -2163,54 +2351,27 @@ async function handleStreamWorkflow(workflowId, body, deps, logger) {
|
|
|
2163
2351
|
throw new Error("Workflow does not support suspension");
|
|
2164
2352
|
}
|
|
2165
2353
|
const processedOptions = processWorkflowOptions(options, suspendController);
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
type: "workflow-result",
|
|
2186
|
-
executionId,
|
|
2187
|
-
status,
|
|
2188
|
-
result,
|
|
2189
|
-
endAt: endAt instanceof Date ? endAt.toISOString() : endAt
|
|
2190
|
-
};
|
|
2191
|
-
const sseFinalEvent = `data: ${(0, import_internal2.safeStringify)(finalEvent)}
|
|
2192
|
-
|
|
2193
|
-
`;
|
|
2194
|
-
controller.enqueue(encoder.encode(sseFinalEvent));
|
|
2195
|
-
if (executionId && deps.workflowRegistry.activeExecutions) {
|
|
2196
|
-
deps.workflowRegistry.activeExecutions.delete(executionId);
|
|
2197
|
-
}
|
|
2198
|
-
controller.close();
|
|
2199
|
-
} catch (error) {
|
|
2200
|
-
logger.error("Failed during workflow stream:", { error });
|
|
2201
|
-
const errorEvent = {
|
|
2202
|
-
type: "error",
|
|
2203
|
-
error: error instanceof Error ? error.message : "Stream failed"
|
|
2204
|
-
};
|
|
2205
|
-
const sseError = `data: ${(0, import_internal2.safeStringify)(errorEvent)}
|
|
2206
|
-
|
|
2207
|
-
`;
|
|
2208
|
-
controller.enqueue(encoder.encode(sseError));
|
|
2209
|
-
controller.close();
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2354
|
+
const workflowStream = registeredWorkflow.workflow.stream(
|
|
2355
|
+
input,
|
|
2356
|
+
processedOptions
|
|
2357
|
+
);
|
|
2358
|
+
const executionId = workflowStream.executionId;
|
|
2359
|
+
if (!executionId) {
|
|
2360
|
+
throw new Error("Workflow stream executionId is required");
|
|
2361
|
+
}
|
|
2362
|
+
if (deps.workflowRegistry.activeExecutions) {
|
|
2363
|
+
deps.workflowRegistry.activeExecutions.set(executionId, suspendController);
|
|
2364
|
+
}
|
|
2365
|
+
const existingSession = activeWorkflowStreamSessions.get(executionId);
|
|
2366
|
+
if (existingSession) {
|
|
2367
|
+
closeWorkflowStreamSession(existingSession);
|
|
2368
|
+
}
|
|
2369
|
+
const session = createWorkflowStreamSession(workflowId, executionId, workflowStream);
|
|
2370
|
+
activeWorkflowStreamSessions.set(executionId, session);
|
|
2371
|
+
consumeWorkflowStream(session, deps, logger).catch((error) => {
|
|
2372
|
+
logger.error("Unhandled workflow stream consumer error", { error });
|
|
2212
2373
|
});
|
|
2213
|
-
return
|
|
2374
|
+
return createWorkflowSessionStream(session);
|
|
2214
2375
|
} catch (error) {
|
|
2215
2376
|
logger.error("Failed to initiate workflow stream", { error });
|
|
2216
2377
|
return {
|
|
@@ -2220,6 +2381,59 @@ async function handleStreamWorkflow(workflowId, body, deps, logger) {
|
|
|
2220
2381
|
}
|
|
2221
2382
|
}
|
|
2222
2383
|
__name(handleStreamWorkflow, "handleStreamWorkflow");
|
|
2384
|
+
async function handleAttachWorkflowStream(workflowId, executionId, query, deps, logger) {
|
|
2385
|
+
try {
|
|
2386
|
+
const registeredWorkflow = deps.workflowRegistry.getWorkflow(workflowId);
|
|
2387
|
+
if (!registeredWorkflow) {
|
|
2388
|
+
return {
|
|
2389
|
+
success: false,
|
|
2390
|
+
error: "Workflow not found",
|
|
2391
|
+
httpStatus: 404
|
|
2392
|
+
};
|
|
2393
|
+
}
|
|
2394
|
+
const activeSession = activeWorkflowStreamSessions.get(executionId);
|
|
2395
|
+
if (activeSession && activeSession.workflowId === workflowId) {
|
|
2396
|
+
const replayFromSequence = parseReplaySequence(query.fromSequence) ?? parseReplaySequence(query.lastEventId);
|
|
2397
|
+
return createWorkflowSessionStream(activeSession, {
|
|
2398
|
+
fromSequence: replayFromSequence
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
const workflowState = await registeredWorkflow.workflow.memory.getWorkflowState(executionId);
|
|
2402
|
+
if (!workflowState || workflowState.workflowId !== workflowId) {
|
|
2403
|
+
return {
|
|
2404
|
+
success: false,
|
|
2405
|
+
error: "Workflow execution not found",
|
|
2406
|
+
httpStatus: 404
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
if (workflowState.status === "completed" || workflowState.status === "cancelled") {
|
|
2410
|
+
return {
|
|
2411
|
+
success: false,
|
|
2412
|
+
error: `Workflow execution is not streamable in '${workflowState.status}' status`,
|
|
2413
|
+
httpStatus: 409
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2416
|
+
if (workflowState.status === "error") {
|
|
2417
|
+
return {
|
|
2418
|
+
success: false,
|
|
2419
|
+
error: "Workflow execution is not streamable in 'error' status",
|
|
2420
|
+
httpStatus: 409
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
return {
|
|
2424
|
+
success: false,
|
|
2425
|
+
error: "Workflow execution has no active stream context to attach",
|
|
2426
|
+
httpStatus: 409
|
|
2427
|
+
};
|
|
2428
|
+
} catch (error) {
|
|
2429
|
+
logger.error("Failed to attach to workflow stream", { error });
|
|
2430
|
+
return {
|
|
2431
|
+
success: false,
|
|
2432
|
+
error: error instanceof Error ? error.message : "Failed to attach to workflow stream"
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
__name(handleAttachWorkflowStream, "handleAttachWorkflowStream");
|
|
2223
2437
|
async function handleSuspendWorkflow(executionId, body, deps, logger) {
|
|
2224
2438
|
try {
|
|
2225
2439
|
const { reason } = body || {};
|
|
@@ -2262,6 +2476,27 @@ __name(handleSuspendWorkflow, "handleSuspendWorkflow");
|
|
|
2262
2476
|
async function handleResumeWorkflow(workflowId, executionId, body, deps, logger) {
|
|
2263
2477
|
try {
|
|
2264
2478
|
const { resumeData, options } = body || {};
|
|
2479
|
+
const activeSession = activeWorkflowStreamSessions.get(executionId);
|
|
2480
|
+
if (activeSession && activeSession.workflowId === workflowId && typeof activeSession.streamExecution.resume === "function") {
|
|
2481
|
+
const resumedStreamExecution = await activeSession.streamExecution.resume(
|
|
2482
|
+
resumeData,
|
|
2483
|
+
options?.stepId ? { stepId: options.stepId } : void 0
|
|
2484
|
+
);
|
|
2485
|
+
activeSession.streamExecution = resumedStreamExecution;
|
|
2486
|
+
const status = await resumedStreamExecution.status;
|
|
2487
|
+
const result2 = await resumedStreamExecution.result;
|
|
2488
|
+
const endAt = await resumedStreamExecution.endAt;
|
|
2489
|
+
return {
|
|
2490
|
+
success: true,
|
|
2491
|
+
data: {
|
|
2492
|
+
executionId: resumedStreamExecution.executionId,
|
|
2493
|
+
startAt: resumedStreamExecution.startAt instanceof Date ? resumedStreamExecution.startAt.toISOString() : resumedStreamExecution.startAt,
|
|
2494
|
+
endAt: endAt instanceof Date ? endAt.toISOString() : endAt,
|
|
2495
|
+
status,
|
|
2496
|
+
result: result2
|
|
2497
|
+
}
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2265
2500
|
const result = await deps.workflowRegistry.resumeSuspendedWorkflow(
|
|
2266
2501
|
workflowId,
|
|
2267
2502
|
executionId,
|
|
@@ -3690,6 +3925,7 @@ __name(mapLogResponse, "mapLogResponse");
|
|
|
3690
3925
|
getConversationStepsHandler,
|
|
3691
3926
|
getOrCreateLogger,
|
|
3692
3927
|
getWorkingMemoryHandler,
|
|
3928
|
+
handleAttachWorkflowStream,
|
|
3693
3929
|
handleChatStream,
|
|
3694
3930
|
handleCloneMemoryConversation,
|
|
3695
3931
|
handleCreateMemoryConversation,
|