feat(core): Implement lifecycle hooks to support streaming responses (no-changelog) (#16391)

This commit is contained in:
Benjamin Schroth
2025-06-24 15:38:03 +02:00
committed by GitHub
parent c4a50df824
commit 1086914080
19 changed files with 752 additions and 11 deletions

View File

@@ -919,6 +919,7 @@ export type IExecuteFunctions = ExecuteFunctions.GetNodeParameterFn &
putExecutionToWait(waitTill: Date): Promise<void>;
sendMessageToUI(message: any): void;
sendResponse(response: IExecuteResponsePromiseData): void;
sendChunk(type: ChunkType, content?: IDataObject | string): void;
// TODO: Make this one then only available in the new config one
addInputData(
@@ -2094,7 +2095,12 @@ export interface IWebhookResponseData {
}
export type WebhookResponseData = 'allEntries' | 'firstEntryJson' | 'firstEntryBinary' | 'noData';
export type WebhookResponseMode = 'onReceived' | 'lastNode' | 'responseNode' | 'formPage';
export type WebhookResponseMode =
| 'onReceived'
| 'lastNode'
| 'responseNode'
| 'formPage'
| 'streaming';
export interface INodeTypes {
getByName(nodeType: string): INodeType | IVersionedNodeType;
@@ -2325,6 +2331,8 @@ export interface IWorkflowExecutionDataProcess {
data?: ITaskData;
};
agentRequest?: AiAgentRequest;
httpResponse?: express.Response; // Used for streaming responses
streamingEnabled?: boolean;
}
export interface ExecuteWorkflowOptions {
@@ -2916,3 +2924,14 @@ export type IPersonalizationSurveyAnswersV4 = {
reportedSource?: string | null;
reportedSourceOther?: string | null;
};
export type ChunkType = 'begin' | 'item' | 'end' | 'error';
export interface StructuredChunk {
type: ChunkType;
content?: string;
metadata: {
nodeId: string;
nodeName: string;
timestamp: number;
};
}