n8n/packages/@n8n/instance-ai/evaluations/binaryChecks/checks/has-trigger.ts
Benjamin Schroth c961849226
feat(ai-builder): Add sub-agent evaluation harness with binary checks (no-changelog) (#28289)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-24 07:50:46 +00:00

17 lines
489 B
TypeScript

import type { BinaryCheck } from '../types';
import { isTriggerNode } from '../utils';
export const hasTrigger: BinaryCheck = {
name: 'has_trigger',
description: 'Workflow contains a trigger or start node',
kind: 'deterministic',
run(workflow) {
const nodes = workflow.nodes ?? [];
const triggers = nodes.filter((n) => isTriggerNode(n.type));
return {
pass: triggers.length > 0,
...(triggers.length === 0 ? { comment: 'No trigger or start node found' } : {}),
};
},
};