feat: AI Workflow Builder agent (no-changelog) (#17423)

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
oleg
2025-07-21 11:18:26 +02:00
committed by GitHub
parent c0f1867429
commit 632b38119b
133 changed files with 18499 additions and 2867 deletions

View File

@@ -1,8 +1,43 @@
import type { IRunExecutionData, IWorkflowBase, NodeExecutionSchema } from 'n8n-workflow';
import { z } from 'zod';
import { Z } from 'zod-class';
export class AiBuilderChatRequestDto extends Z.class({
payload: z.object({
question: z.string(),
role: z.literal('user'),
type: z.literal('message'),
text: z.string(),
workflowContext: z.object({
currentWorkflow: z
.custom<Partial<IWorkflowBase>>((val: Partial<IWorkflowBase>) => {
if (!val.nodes && !val.connections) {
return false;
}
return val;
})
.optional(),
executionData: z
.custom<IRunExecutionData['resultData']>((val: IRunExecutionData['resultData']) => {
if (!val.runData && !val.error) {
return false;
}
return val;
})
.optional(),
executionSchema: z
.custom<NodeExecutionSchema[]>((val: NodeExecutionSchema[]) => {
// Check if the array is empty or if all items have nodeName and schema properties
if (!Array.isArray(val) || val.every((item) => !item.nodeName || !item.schema)) {
return false;
}
return val;
})
.optional(),
}),
}),
}) {}

View File

@@ -0,0 +1,6 @@
import { z } from 'zod';
import { Z } from 'zod-class';
export class AiSessionRetrievalRequestDto extends Z.class({
workflowId: z.string().optional(),
}) {}

View File

@@ -3,6 +3,7 @@ export { AiChatRequestDto } from './ai/ai-chat-request.dto';
export { AiBuilderChatRequestDto } from './ai/ai-build-request.dto';
export { AiApplySuggestionRequestDto } from './ai/ai-apply-suggestion-request.dto';
export { AiFreeCreditsRequestDto } from './ai/ai-free-credits-request.dto';
export { AiSessionRetrievalRequestDto } from './ai/ai-session-retrieval-request.dto';
export { BinaryDataQueryDto } from './binary-data/binary-data-query.dto';
export { BinaryDataSignedQueryDto } from './binary-data/binary-data-signed-query.dto';