@kairos-sdk/core 0.3.2 → 0.4.5

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client.ts","../src/generation/designer.ts"],"sourcesContent":["import Anthropic from '@anthropic-ai/sdk'\nimport type { N8nWorkflow, Tag } from './types/workflow.js'\nimport type { BuildResult, WorkflowListItem, ExecutionSummary, ExecutionDetail } from './types/result.js'\nimport type { ClientOptions, BuildOptions, DeleteOptions, ExecutionFilter } from './types/options.js'\nimport type { IWorkflowLibrary, WorkflowMatch, WorkflowMetadataInput } from './library/types.js'\nimport { NullLibrary } from './library/null-library.js'\nimport { N8nApiClient } from './providers/n8n/api-client.js'\nimport { N8nFieldStripper } from './providers/n8n/stripper.js'\nimport { N8nProvider } from './providers/n8n/provider.js'\nimport { N8nValidator } from './validation/validator.js'\nimport { WorkflowDesigner } from './generation/designer.js'\nimport type { DesignResult } from './generation/types.js'\nimport { TelemetryCollector } from './telemetry/collector.js'\nimport { TelemetryReader } from './telemetry/reader.js'\nimport { PatternAnalyzer } from './telemetry/pattern-analyzer.js'\nimport { nullLogger } from './utils/logger.js'\nimport type { ILogger } from './utils/logger.js'\nimport { scoreToMode } from './utils/thresholds.js'\nimport { GuardError } from './errors/guard-error.js'\nimport { ValidationError } from './errors/validation-error.js'\nimport { inferWorkflowType } from './utils/workflow-type.js'\nimport { generateUUID } from './utils/uuid.js'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\n\nconst DEFAULT_MODEL = 'claude-sonnet-4-6'\n\nexport class Kairos {\n private readonly provider: N8nProvider | null\n private readonly designer: WorkflowDesigner\n private readonly validator: N8nValidator\n private readonly library: IWorkflowLibrary\n private readonly logger: ILogger\n private readonly telemetry: TelemetryCollector | null\n private readonly telemetryReader: TelemetryReader | null\n private readonly patternAnalyzer: PatternAnalyzer | null\n private readonly model: string\n private saveQueue: Promise<string | null> = Promise.resolve(null)\n\n constructor(options: ClientOptions) {\n const logger = options.logger ?? nullLogger\n this.model = options.model ?? DEFAULT_MODEL\n\n if (options.n8nBaseUrl && options.n8nApiKey) {\n try {\n new URL(options.n8nBaseUrl)\n } catch {\n throw new GuardError(`Invalid n8nBaseUrl: \"${options.n8nBaseUrl}\" — must be a valid URL`)\n }\n const apiClient = new N8nApiClient(options.n8nBaseUrl, options.n8nApiKey, logger)\n const stripper = new N8nFieldStripper()\n this.provider = new N8nProvider(apiClient, stripper)\n } else {\n this.provider = null\n }\n\n const anthropic = new Anthropic({ apiKey: options.anthropicApiKey })\n const patternsPath = typeof options.telemetry === 'string'\n ? join(options.telemetry, '..', 'patterns.json')\n : join(homedir(), '.kairos', 'patterns.json')\n this.designer = new WorkflowDesigner(anthropic, this.model, logger, patternsPath)\n this.validator = new N8nValidator()\n this.library = options.library ?? new NullLibrary()\n this.logger = logger\n\n if (options.telemetry === true) {\n this.telemetry = new TelemetryCollector()\n this.telemetryReader = new TelemetryReader()\n this.patternAnalyzer = new PatternAnalyzer()\n } else if (typeof options.telemetry === 'string') {\n this.telemetry = new TelemetryCollector(options.telemetry)\n this.telemetryReader = new TelemetryReader(options.telemetry)\n this.patternAnalyzer = new PatternAnalyzer(options.telemetry)\n } else {\n this.telemetry = null\n this.telemetryReader = null\n this.patternAnalyzer = null\n }\n }\n\n private requireProvider(): N8nProvider {\n if (!this.provider) {\n throw new GuardError('n8nBaseUrl and n8nApiKey are required for this operation — set them in the Kairos constructor, or use { dryRun: true } for generation-only mode')\n }\n return this.provider\n }\n\n private validateDescription(description: string): void {\n if (!description || description.trim().length === 0) {\n throw new GuardError('Description is required and must be non-empty')\n }\n }\n\n async build(description: string, options?: BuildOptions): Promise<BuildResult> {\n this.validateDescription(description)\n this.logger.info('Kairos.build', { description, dryRun: options?.dryRun })\n const buildStart = Date.now()\n const runId = generateUUID()\n const workflowType = inferWorkflowType(description)\n\n await this.telemetry?.emit('build_start', {\n description,\n model: this.model,\n dryRun: options?.dryRun ?? false,\n }, runId)\n\n await this.library.initialize()\n const matches = await this.library.search(description)\n\n if (matches.length > 0) {\n const top = matches[0]!\n this.logger.info(`Library: ${matches.length} match(es), top=\"${top.workflow.description.slice(0, 50)}\" score=${top.score.toFixed(2)} mode=${top.mode}`)\n } else {\n this.logger.info('Library: no matches (scratch mode)')\n }\n\n const globalFailureRates = await this.telemetryReader?.getFailureRates() ?? []\n\n if (globalFailureRates.length > 0) {\n const highFreq = globalFailureRates.filter((r) => r.rate >= 0.15)\n if (highFreq.length > 0) {\n this.logger.info(`Telemetry: ${highFreq.length} high-frequency failure rule(s) will be warned about`)\n }\n }\n\n let designResult: DesignResult\n try {\n designResult = await this.designer.design(\n { description, ...(options?.name ? { name: options.name } : {}) },\n matches,\n globalFailureRates,\n )\n } catch (err) {\n if (err instanceof ValidationError && err.attemptMetadata) {\n for (const meta of err.attemptMetadata) {\n await this.telemetry?.emit('generation_attempt', {\n description,\n attempt: meta.attempt,\n temperature: meta.temperature,\n durationMs: meta.durationMs,\n tokensInput: meta.tokensInput,\n tokensOutput: meta.tokensOutput,\n validationPassed: meta.validationPassed,\n issueCount: meta.issues.length,\n issues: meta.issues.map((i) => ({ rule: i.rule, severity: i.severity, message: i.message, nodeId: i.nodeId ?? null, nodeType: i.nodeType ?? null })),\n workflowType,\n }, runId)\n }\n await this.telemetry?.emit('build_complete', {\n description,\n success: false,\n totalAttempts: err.attemptMetadata.length,\n totalDurationMs: Date.now() - buildStart,\n totalTokensInput: err.attemptMetadata.reduce((s, m) => s + m.tokensInput, 0),\n totalTokensOutput: err.attemptMetadata.reduce((s, m) => s + m.tokensOutput, 0),\n workflowName: null,\n workflowId: null,\n dryRun: options?.dryRun ?? false,\n credentialsNeeded: 0,\n warnedRules: err.warnedRules ?? [],\n workflowType,\n }, runId)\n this.updatePatterns()\n }\n throw err\n }\n\n await this.emitAttemptTelemetry(description, designResult, workflowType, runId)\n\n const workflow = options?.name\n ? { ...designResult.workflow, name: options.name }\n : designResult.workflow\n\n this.saveToLibrary(workflow, description, designResult, matches)\n\n if (options?.dryRun) {\n const totalTokensInput = designResult.attemptMetadata.reduce((s, m) => s + m.tokensInput, 0)\n const totalTokensOutput = designResult.attemptMetadata.reduce((s, m) => s + m.tokensOutput, 0)\n\n await this.telemetry?.emit('build_complete', {\n description,\n success: true,\n totalAttempts: designResult.attempts,\n totalDurationMs: Date.now() - buildStart,\n totalTokensInput,\n totalTokensOutput,\n workflowName: workflow.name,\n workflowId: null,\n dryRun: true,\n credentialsNeeded: designResult.credentialsNeeded.length,\n warnedRules: designResult.warnedRules,\n workflowType,\n }, runId)\n\n this.updatePatterns()\n\n return {\n workflowId: null,\n name: workflow.name,\n workflow,\n credentialsNeeded: designResult.credentialsNeeded,\n activationRequired: true,\n generationAttempts: designResult.attempts,\n dryRun: true,\n }\n }\n\n const provider = this.requireProvider()\n const deployed = await provider.deploy(workflow)\n this.recordDeploy()\n\n if (options?.activate) {\n await provider.activate(deployed.workflowId)\n }\n\n const totalTokensInput = designResult.attemptMetadata.reduce((s, m) => s + m.tokensInput, 0)\n const totalTokensOutput = designResult.attemptMetadata.reduce((s, m) => s + m.tokensOutput, 0)\n\n await this.telemetry?.emit('build_complete', {\n description,\n success: true,\n totalAttempts: designResult.attempts,\n totalDurationMs: Date.now() - buildStart,\n totalTokensInput,\n totalTokensOutput,\n workflowName: deployed.name,\n workflowId: deployed.workflowId,\n dryRun: false,\n credentialsNeeded: designResult.credentialsNeeded.length,\n warnedRules: designResult.warnedRules,\n workflowType,\n }, runId)\n\n this.updatePatterns()\n\n return {\n workflowId: deployed.workflowId,\n name: deployed.name,\n workflow,\n credentialsNeeded: designResult.credentialsNeeded,\n activationRequired: !options?.activate,\n generationAttempts: designResult.attempts,\n dryRun: false,\n }\n }\n\n async replace(id: string, description: string): Promise<BuildResult> {\n this.validateDescription(description)\n this.logger.info('Kairos.update', { id, description })\n const buildStart = Date.now()\n const runId = generateUUID()\n const workflowType = inferWorkflowType(description)\n\n await this.telemetry?.emit('build_start', {\n description,\n model: this.model,\n dryRun: false,\n }, runId)\n\n await this.library.initialize()\n const matches = await this.library.search(description)\n const globalFailureRates = await this.telemetryReader?.getFailureRates() ?? []\n\n let designResult: DesignResult\n try {\n designResult = await this.designer.design({ description }, matches, globalFailureRates)\n } catch (err) {\n if (err instanceof ValidationError && err.attemptMetadata) {\n for (const meta of err.attemptMetadata) {\n await this.telemetry?.emit('generation_attempt', {\n description,\n attempt: meta.attempt,\n temperature: meta.temperature,\n durationMs: meta.durationMs,\n tokensInput: meta.tokensInput,\n tokensOutput: meta.tokensOutput,\n validationPassed: meta.validationPassed,\n issueCount: meta.issues.length,\n issues: meta.issues.map((i) => ({ rule: i.rule, severity: i.severity, message: i.message, nodeId: i.nodeId ?? null, nodeType: i.nodeType ?? null })),\n workflowType,\n }, runId)\n }\n await this.telemetry?.emit('build_complete', {\n description,\n success: false,\n totalAttempts: err.attemptMetadata.length,\n totalDurationMs: Date.now() - buildStart,\n totalTokensInput: err.attemptMetadata.reduce((s, m) => s + m.tokensInput, 0),\n totalTokensOutput: err.attemptMetadata.reduce((s, m) => s + m.tokensOutput, 0),\n workflowName: null,\n workflowId: null,\n dryRun: false,\n credentialsNeeded: 0,\n warnedRules: err.warnedRules ?? [],\n workflowType,\n }, runId)\n this.updatePatterns()\n }\n throw err\n }\n\n await this.emitAttemptTelemetry(description, designResult, workflowType, runId)\n\n const provider = this.requireProvider()\n const deployed = await provider.update(id, designResult.workflow)\n\n this.saveToLibrary(designResult.workflow, description, designResult, matches)\n this.recordDeploy()\n\n const totalTokensInput = designResult.attemptMetadata.reduce((s, m) => s + m.tokensInput, 0)\n const totalTokensOutput = designResult.attemptMetadata.reduce((s, m) => s + m.tokensOutput, 0)\n\n await this.telemetry?.emit('build_complete', {\n description,\n success: true,\n totalAttempts: designResult.attempts,\n totalDurationMs: Date.now() - buildStart,\n totalTokensInput,\n totalTokensOutput,\n workflowName: deployed.name,\n workflowId: deployed.workflowId,\n dryRun: false,\n credentialsNeeded: designResult.credentialsNeeded.length,\n warnedRules: designResult.warnedRules,\n workflowType,\n }, runId)\n\n this.updatePatterns()\n\n return {\n workflowId: deployed.workflowId,\n name: deployed.name,\n workflow: designResult.workflow,\n credentialsNeeded: designResult.credentialsNeeded,\n activationRequired: true,\n generationAttempts: designResult.attempts,\n dryRun: false,\n }\n }\n\n async drain(): Promise<void> {\n await this.saveQueue.catch(() => {})\n }\n\n private updatePatterns(): void {\n if (!this.patternAnalyzer) return\n this.saveQueue = this.saveQueue\n .then(() => this.patternAnalyzer!.analyzeAndSave())\n .then(() => null)\n .catch((err: unknown) => {\n this.logger.warn('Pattern analysis failed (non-fatal)', { err: String(err) })\n return null\n })\n }\n\n private async emitAttemptTelemetry(description: string, designResult: DesignResult, workflowType: string | null, runId: string): Promise<void> {\n for (const meta of designResult.attemptMetadata) {\n await this.telemetry?.emit('generation_attempt', {\n description,\n attempt: meta.attempt,\n temperature: meta.temperature,\n durationMs: meta.durationMs,\n tokensInput: meta.tokensInput,\n tokensOutput: meta.tokensOutput,\n validationPassed: meta.validationPassed,\n issueCount: meta.issues.length,\n issues: meta.issues.map((i) => ({ rule: i.rule, severity: i.severity, message: i.message, nodeId: i.nodeId ?? null, nodeType: i.nodeType ?? null })),\n workflowType,\n }, runId)\n }\n }\n\n private recordDeploy(): void {\n this.saveQueue = this.saveQueue\n .then(async (savedId) => {\n if (savedId) {\n await this.library.recordDeployment(savedId)\n }\n return savedId\n })\n .catch((err: unknown) => {\n this.logger.warn('Failed to record deployment (non-fatal)', { err: String(err) })\n return null\n })\n }\n\n private saveToLibrary(\n workflow: N8nWorkflow,\n description: string,\n designResult: DesignResult,\n matches: WorkflowMatch[],\n ): void {\n const failedAttempts = designResult.attemptMetadata.filter((m) => !m.validationPassed)\n const failurePatterns = failedAttempts.flatMap((m) =>\n m.issues.map((i) => ({ rule: i.rule, message: i.message })),\n )\n const topMatch = matches[0]\n const generationMode = topMatch ? scoreToMode(topMatch.score) : 'scratch' as const\n\n const autoTags = Array.from(new Set(\n workflow.nodes.flatMap((n) => {\n const bare = n.type.split('.').pop() ?? ''\n const tags = [bare]\n if (n.type.includes('Trigger') || n.type.includes('trigger')) tags.push(`trigger:${bare}`)\n if (n.type.includes('langchain')) tags.push('ai')\n return tags\n }),\n ))\n\n const metadata: WorkflowMetadataInput = {\n description,\n generationMode,\n generationAttempts: designResult.attempts,\n }\n if (autoTags.length > 0) metadata.tags = autoTags\n if (failurePatterns.length > 0) metadata.failurePatterns = failurePatterns\n if (matches.length > 0) metadata.sourceWorkflowIds = matches.map((m) => m.workflow.id)\n if (topMatch) metadata.topMatchScore = topMatch.score\n if (designResult.credentialsNeeded.length > 0) metadata.credentialsNeeded = designResult.credentialsNeeded\n\n const firstTryPass = designResult.attemptMetadata.length > 0\n && designResult.attemptMetadata[0]!.validationPassed\n const failedRules = Array.from(new Set(\n designResult.attemptMetadata\n .filter((m) => !m.validationPassed)\n .flatMap((m) => m.issues.map((i) => i.rule)),\n ))\n\n this.saveQueue = this.saveQueue\n .then(async () => {\n const savedId = await this.library.save(workflow, metadata)\n\n for (const match of matches) {\n if (match.mode === 'direct' || match.mode === 'reference') {\n await this.library.recordOutcome(match.workflow.id, {\n attempts: designResult.attempts,\n firstTryPass,\n failedRules,\n mode: match.mode,\n })\n }\n }\n\n return savedId\n })\n .catch((err: unknown) => {\n this.logger.warn('Failed to save workflow to library (non-fatal)', { err: String(err) })\n return null\n })\n }\n\n async get(id: string): Promise<N8nWorkflow> {\n return this.requireProvider().get(id)\n }\n\n async list(): Promise<WorkflowListItem[]> {\n return this.requireProvider().list()\n }\n\n async activate(id: string): Promise<void> {\n await this.requireProvider().activate(id)\n }\n\n async deactivate(id: string): Promise<void> {\n await this.requireProvider().deactivate(id)\n }\n\n async delete(id: string, options: DeleteOptions): Promise<void> {\n await this.requireProvider().delete(id, options)\n }\n\n async executions(workflowId?: string, filter?: ExecutionFilter): Promise<ExecutionSummary[]> {\n return this.requireProvider().executions(workflowId, filter)\n }\n\n async execution(id: string): Promise<ExecutionDetail> {\n return this.requireProvider().execution(id)\n }\n\n async listTags(): Promise<Tag[]> {\n return this.requireProvider().listTags()\n }\n\n async createTag(name: string): Promise<Tag> {\n return this.requireProvider().createTag(name)\n }\n\n async tag(workflowId: string, tagIds: string[]): Promise<void> {\n await this.requireProvider().tag(workflowId, tagIds)\n }\n\n async untag(workflowId: string, tagIds: string[]): Promise<void> {\n await this.requireProvider().untag(workflowId, tagIds)\n }\n}\n","import Anthropic from '@anthropic-ai/sdk'\nimport type { WorkflowMatch } from '../library/types.js'\nimport type { N8nWorkflow } from '../types/workflow.js'\nimport type { CredentialRequirement } from '../types/result.js'\nimport type { ILogger } from '../utils/logger.js'\nimport { GenerationError } from '../errors/generation-error.js'\nimport { ResponseParseError } from '../errors/response-parse-error.js'\nimport { ValidationError } from '../errors/validation-error.js'\nimport type { ValidationIssue } from '../errors/validation-error.js'\nimport { N8nValidator } from '../validation/validator.js'\nimport { PromptBuilder } from './prompt-builder.js'\nimport type { AttemptMetadata } from '../telemetry/types.js'\nimport type { RuleFailureRate } from '../telemetry/reader.js'\nimport type { DesignRequest, DesignResult, SystemPromptBlock } from './types.js'\n\nconst MAX_ATTEMPTS = 3\nconst BASE_TEMPERATURE = 0.2\nconst FINAL_TEMPERATURE = 0.1\n\nconst GENERATE_WORKFLOW_TOOL: Anthropic.Tool = {\n name: 'generate_workflow',\n description: 'Generate a valid n8n workflow JSON object',\n input_schema: {\n type: 'object',\n properties: {\n workflow: {\n type: 'object',\n description: 'The complete n8n workflow object',\n properties: {\n name: { type: 'string' },\n nodes: { type: 'array' },\n connections: { type: 'object' },\n settings: { type: 'object' },\n },\n required: ['name', 'nodes', 'connections'],\n },\n credentialsNeeded: {\n type: 'array',\n description: 'List of credentials the user must configure before activating',\n items: {\n type: 'object',\n properties: {\n service: { type: 'string' },\n credentialType: { type: 'string' },\n description: { type: 'string' },\n },\n required: ['service', 'credentialType', 'description'],\n },\n },\n error: {\n type: 'string',\n description: 'Set this if the request cannot be fulfilled — explain why',\n },\n },\n required: [],\n },\n}\n\ninterface ToolUseResult {\n workflow: N8nWorkflow\n credentialsNeeded: CredentialRequirement[]\n error?: string\n}\n\nexport class WorkflowDesigner {\n private readonly validator: N8nValidator\n private readonly promptBuilder: PromptBuilder\n\n constructor(\n private readonly anthropic: Anthropic,\n private readonly model: string,\n private readonly logger: ILogger,\n patternsPath?: string,\n ) {\n this.validator = new N8nValidator()\n this.promptBuilder = new PromptBuilder(patternsPath)\n }\n\n async design(request: DesignRequest, matches: WorkflowMatch[], globalFailureRates: RuleFailureRate[] = []): Promise<DesignResult> {\n const attemptMetadata: AttemptMetadata[] = []\n let lastErrors: ValidationIssue[] = []\n let attempts = 0\n const built = this.promptBuilder.build(request, matches, globalFailureRates)\n\n for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {\n attempts = attempt\n const temperature = attempt === MAX_ATTEMPTS ? FINAL_TEMPERATURE : BASE_TEMPERATURE\n\n let userMessage: string\n if (attempt === 1) {\n userMessage = built.userMessage\n this.logger.debug('WorkflowDesigner: attempt 1', { description: request.description })\n } else {\n const issueLines = lastErrors.map(\n (i) => `- [Rule ${i.rule}] ${i.message}${i.nodeId ? ` (node: ${i.nodeId})` : ''}`,\n )\n userMessage = this.promptBuilder.buildCorrectionMessage(request, matches, issueLines, attempt - 1)\n this.logger.debug(`WorkflowDesigner: correction attempt ${attempt}`, { issueCount: lastErrors.length })\n }\n\n const start = Date.now()\n const message = await this.callClaude(built.system, userMessage, temperature)\n const durationMs = Date.now() - start\n const parsed = this.extractToolUse(message)\n\n if (parsed.error) {\n throw new GenerationError(`Claude declined to generate workflow: ${parsed.error}`)\n }\n\n const validation = this.validator.validate(parsed.workflow)\n const errors = validation.issues.filter((i) => i.severity === 'error')\n\n attemptMetadata.push({\n attempt,\n temperature,\n durationMs,\n tokensInput: message.usage.input_tokens,\n tokensOutput: message.usage.output_tokens,\n validationPassed: validation.valid,\n issues: validation.issues,\n })\n\n if (validation.valid) {\n return { workflow: parsed.workflow, credentialsNeeded: parsed.credentialsNeeded, attempts, attemptMetadata, warnedRules: this.promptBuilder.getWarnedRules() }\n }\n\n lastErrors = errors\n this.logger.warn(`WorkflowDesigner: validation failed on attempt ${attempt}`, {\n errorCount: errors.length,\n })\n }\n\n const finalIssues = attemptMetadata.at(-1)?.issues ?? lastErrors\n throw new ValidationError(\n `Workflow failed validation after ${MAX_ATTEMPTS} attempts`,\n finalIssues,\n attemptMetadata,\n this.promptBuilder.getWarnedRules(),\n )\n }\n\n private async callClaude(\n system: SystemPromptBlock[],\n userMessage: string,\n temperature: number,\n ): Promise<Anthropic.Message> {\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), 120_000)\n try {\n return await this.anthropic.messages.create(\n {\n model: this.model,\n max_tokens: 8192,\n temperature,\n system: system.map((b) => ({ type: b.type, text: b.text, ...(b.cache_control ? { cache_control: b.cache_control } : {}) })),\n messages: [{ role: 'user', content: userMessage }],\n tools: [GENERATE_WORKFLOW_TOOL],\n tool_choice: { type: 'tool', name: 'generate_workflow' },\n },\n { signal: controller.signal },\n )\n } catch (err) {\n const detail = err instanceof Error ? err.message : String(err)\n throw new GenerationError(`Anthropic API call failed: ${detail}`, err)\n } finally {\n clearTimeout(timer)\n }\n }\n\n private extractToolUse(message: Anthropic.Message): ToolUseResult {\n if (message.stop_reason === 'max_tokens') {\n throw new GenerationError(\n 'Claude response was truncated (max_tokens reached) — the workflow may be too large. Try a simpler description or break it into smaller workflows.',\n )\n }\n\n const toolUseBlock = message.content.find(\n (block): block is Anthropic.ToolUseBlock => block.type === 'tool_use',\n )\n if (!toolUseBlock) {\n throw new ResponseParseError(\n 'Claude response contained no tool_use block — forced tool_choice failed unexpectedly',\n )\n }\n\n const input = toolUseBlock.input as Record<string, unknown>\n\n if (typeof input['error'] === 'string') {\n return {\n workflow: { name: '', nodes: [], connections: {} },\n credentialsNeeded: [],\n error: input['error'],\n }\n }\n\n if (!input['workflow'] || typeof input['workflow'] !== 'object') {\n throw new ResponseParseError('generate_workflow tool call missing workflow field')\n }\n\n const workflow = input['workflow'] as N8nWorkflow\n const credentialsNeeded = (input['credentialsNeeded'] as CredentialRequirement[] | undefined) ?? []\n\n return { workflow, credentialsNeeded }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe;;;ACetB,IAAM,eAAe;AACrB,IAAM,mBAAmB;AACzB,IAAM,oBAAoB;AAE1B,IAAM,yBAAyC;AAAA,EAC7C,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,YAAY;AAAA,MACV,UAAU;AAAA,QACR,MAAM;AAAA,QACN,aAAa;AAAA,QACb,YAAY;AAAA,UACV,MAAM,EAAE,MAAM,SAAS;AAAA,UACvB,OAAO,EAAE,MAAM,QAAQ;AAAA,UACvB,aAAa,EAAE,MAAM,SAAS;AAAA,UAC9B,UAAU,EAAE,MAAM,SAAS;AAAA,QAC7B;AAAA,QACA,UAAU,CAAC,QAAQ,SAAS,aAAa;AAAA,MAC3C;AAAA,MACA,mBAAmB;AAAA,QACjB,MAAM;AAAA,QACN,aAAa;AAAA,QACb,OAAO;AAAA,UACL,MAAM;AAAA,UACN,YAAY;AAAA,YACV,SAAS,EAAE,MAAM,SAAS;AAAA,YAC1B,gBAAgB,EAAE,MAAM,SAAS;AAAA,YACjC,aAAa,EAAE,MAAM,SAAS;AAAA,UAChC;AAAA,UACA,UAAU,CAAC,WAAW,kBAAkB,aAAa;AAAA,QACvD;AAAA,MACF;AAAA,MACA,OAAO;AAAA,QACL,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,UAAU,CAAC;AAAA,EACb;AACF;AAQO,IAAM,mBAAN,MAAuB;AAAA,EAI5B,YACmB,WACA,OACA,QACjB,cACA;AAJiB;AACA;AACA;AAGjB,SAAK,YAAY,IAAI,aAAa;AAClC,SAAK,gBAAgB,IAAI,cAAc,YAAY;AAAA,EACrD;AAAA,EAP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,KAAK,gBAAgB,EAAE,WAAW,EAAE;AAAA,EAC5C;AAAA,EAEA,MAAM,OAAO,IAAY,SAAuC;AAC9D,UAAM,KAAK,gBAAgB,EAAE,OAAO,IAAI,OAAO;AAAA,EACjD;AAAA,EAEA,MAAM,WAAW,YAAqB,QAAuD;AAC3F,WAAO,KAAK,gBAAgB,EAAE,WAAW,YAAY,MAAM;AAAA,EAC7D;AAAA,EAEA,MAAM,UAAU,IAAsC;AACpD,WAAO,KAAK,gBAAgB,EAAE,UAAU,EAAE;AAAA,EAC5C;AAAA,EAEA,MAAM,WAA2B;AAC/B,WAAO,KAAK,gBAAgB,EAAE,SAAS;AAAA,EACzC;AAAA,EAEA,MAAM,UAAU,MAA4B;AAC1C,WAAO,KAAK,gBAAgB,EAAE,UAAU,IAAI;AAAA,EAC9C;AAAA,EAEA,MAAM,IAAI,YAAoB,QAAiC;AAC7D,UAAM,KAAK,gBAAgB,EAAE,IAAI,YAAY,MAAM;AAAA,EACrD;AAAA,EAEA,MAAM,MAAM,YAAoB,QAAiC;AAC/D,UAAM,KAAK,gBAAgB,EAAE,MAAM,YAAY,MAAM;AAAA,EACvD;AACF;","names":["totalTokensInput","totalTokensOutput"]}
@@ -0,0 +1,315 @@
1
+ import {
2
+ KairosError,
3
+ N8nValidator,
4
+ generateUUID
5
+ } from "./chunk-6IXW3WCC.js";
6
+
7
+ // src/library/null-library.ts
8
+ var NullLibrary = class {
9
+ async initialize() {
10
+ }
11
+ async search(_description, _options) {
12
+ return [];
13
+ }
14
+ async save(_workflow, _metadata) {
15
+ return generateUUID();
16
+ }
17
+ async recordDeployment(_id) {
18
+ }
19
+ async recordOutcome(_id, _outcome) {
20
+ }
21
+ async get(_id) {
22
+ return null;
23
+ }
24
+ async list(_filters) {
25
+ return [];
26
+ }
27
+ };
28
+
29
+ // src/errors/guard-error.ts
30
+ var GuardError = class extends KairosError {
31
+ constructor(message) {
32
+ super(message);
33
+ this.name = "GuardError";
34
+ }
35
+ };
36
+
37
+ // src/providers/n8n/provider.ts
38
+ var N8nProvider = class {
39
+ constructor(client, stripper) {
40
+ this.client = client;
41
+ this.stripper = stripper;
42
+ }
43
+ client;
44
+ stripper;
45
+ platform = "n8n";
46
+ async deploy(workflow) {
47
+ const stripped = this.stripper.stripForCreate(workflow);
48
+ const response = await this.client.createWorkflow(stripped);
49
+ return { workflowId: response.id, name: response.name };
50
+ }
51
+ async update(id, workflow) {
52
+ const stripped = this.stripper.stripForUpdate(workflow);
53
+ const response = await this.client.updateWorkflow(id, stripped);
54
+ return { workflowId: response.id, name: response.name };
55
+ }
56
+ async get(id) {
57
+ const response = await this.client.getWorkflow(id);
58
+ return {
59
+ name: response.name,
60
+ nodes: response.nodes,
61
+ connections: response.connections,
62
+ ...response.settings !== void 0 ? { settings: response.settings } : {},
63
+ ...response.tags !== void 0 ? { tags: response.tags } : {}
64
+ };
65
+ }
66
+ async list() {
67
+ return this.client.listWorkflows();
68
+ }
69
+ async activate(id) {
70
+ await this.client.activateWorkflow(id);
71
+ }
72
+ async deactivate(id) {
73
+ await this.client.deactivateWorkflow(id);
74
+ }
75
+ async delete(id, options) {
76
+ if (options.confirm !== true) {
77
+ throw new GuardError("delete() requires { confirm: true } to prevent accidental deletion");
78
+ }
79
+ await this.client.deleteWorkflow(id);
80
+ }
81
+ async executions(workflowId, filter) {
82
+ return this.client.getExecutions(workflowId, filter);
83
+ }
84
+ async execution(id) {
85
+ return this.client.getExecution(id);
86
+ }
87
+ async listTags() {
88
+ return this.client.listTags();
89
+ }
90
+ async createTag(name) {
91
+ return this.client.createTag(name);
92
+ }
93
+ async tag(workflowId, tagIds) {
94
+ await this.client.tagWorkflow(workflowId, tagIds);
95
+ }
96
+ async untag(workflowId, tagIds) {
97
+ await this.client.untagWorkflow(workflowId, tagIds);
98
+ }
99
+ };
100
+
101
+ // src/errors/generation-error.ts
102
+ var GenerationError = class extends KairosError {
103
+ constructor(message, cause) {
104
+ super(message, cause);
105
+ this.name = "GenerationError";
106
+ }
107
+ };
108
+
109
+ // src/errors/response-parse-error.ts
110
+ var ResponseParseError = class extends KairosError {
111
+ constructor(message, cause) {
112
+ super(message, cause);
113
+ this.name = "ResponseParseError";
114
+ }
115
+ };
116
+
117
+ // src/errors/validation-error.ts
118
+ var ValidationError = class extends KairosError {
119
+ constructor(message, issues, attemptMetadata, warnedRules) {
120
+ super(message);
121
+ this.issues = issues;
122
+ this.attemptMetadata = attemptMetadata;
123
+ this.warnedRules = warnedRules;
124
+ this.name = "ValidationError";
125
+ }
126
+ issues;
127
+ attemptMetadata;
128
+ warnedRules;
129
+ };
130
+
131
+ // src/templates/safety.ts
132
+ var BLOCKED_NODE_TYPES = /* @__PURE__ */ new Set([
133
+ "n8n-nodes-base.code",
134
+ "n8n-nodes-base.executeCommand",
135
+ "n8n-nodes-base.ssh"
136
+ ]);
137
+ var REVIEW_NODE_TYPES = /* @__PURE__ */ new Set([
138
+ "n8n-nodes-base.httpRequest"
139
+ ]);
140
+ var SECRET_PATTERNS = [
141
+ /sk-[a-zA-Z0-9]{20,}/,
142
+ /ghp_[a-zA-Z0-9]{36}/,
143
+ /xoxb-[0-9]+-[0-9]+-[a-zA-Z0-9]+/,
144
+ /AIza[a-zA-Z0-9_-]{35}/,
145
+ /AKIA[A-Z0-9]{16}/
146
+ ];
147
+ function assessTemplateSafety(workflow) {
148
+ const reasons = [];
149
+ let worst = "safe";
150
+ const escalate = (level, reason) => {
151
+ reasons.push(reason);
152
+ if (level === "blocked") worst = "blocked";
153
+ else if (level === "review" && worst === "safe") worst = "review";
154
+ };
155
+ for (const node of workflow.nodes) {
156
+ if (BLOCKED_NODE_TYPES.has(node.type)) {
157
+ escalate("blocked", `Contains ${node.type} node "${node.name}"`);
158
+ }
159
+ if (REVIEW_NODE_TYPES.has(node.type)) {
160
+ escalate("review", `Contains ${node.type} node "${node.name}"`);
161
+ }
162
+ const paramStr = JSON.stringify(node.parameters);
163
+ for (const pattern of SECRET_PATTERNS) {
164
+ if (pattern.test(paramStr)) {
165
+ escalate("blocked", `Node "${node.name}" parameters contain a hardcoded secret`);
166
+ break;
167
+ }
168
+ }
169
+ }
170
+ return { trustLevel: worst, reasons };
171
+ }
172
+
173
+ // src/templates/syncer.ts
174
+ var N8N_TEMPLATE_API = "https://api.n8n.io/api/templates";
175
+ var PAGE_SIZE = 50;
176
+ var DELAY_BETWEEN_FETCHES_MS = 200;
177
+ var DEFAULT_SETTINGS = {
178
+ executionOrder: "v1",
179
+ saveManualExecutions: true,
180
+ timezone: "UTC"
181
+ };
182
+ var TemplateSyncer = class {
183
+ constructor(library, logger) {
184
+ this.library = library;
185
+ this.validator = new N8nValidator();
186
+ this.logger = logger;
187
+ }
188
+ library;
189
+ validator;
190
+ logger;
191
+ async sync(options) {
192
+ const maxTemplates = options?.maxTemplates ?? 500;
193
+ await this.library.initialize();
194
+ const existing = await this.library.list();
195
+ const existingSourceIds = new Set(
196
+ existing.filter((w) => w.sourceKind === "n8n-template" && w.sourceId).map((w) => w.sourceId)
197
+ );
198
+ const progress = {
199
+ total: 0,
200
+ processed: 0,
201
+ saved: 0,
202
+ skippedPaid: 0,
203
+ skippedDuplicate: 0,
204
+ blocked: 0,
205
+ reviewed: 0
206
+ };
207
+ const templateIds = await this.fetchTemplateIds(maxTemplates, progress);
208
+ for (const id of templateIds) {
209
+ if (existingSourceIds.has(String(id))) {
210
+ progress.skippedDuplicate++;
211
+ progress.processed++;
212
+ options?.onProgress?.(progress);
213
+ continue;
214
+ }
215
+ try {
216
+ await this.processTemplate(id, progress);
217
+ } catch (err) {
218
+ this.logger.warn(`Failed to process template ${id}`, { err: String(err) });
219
+ }
220
+ progress.processed++;
221
+ options?.onProgress?.(progress);
222
+ await new Promise((resolve) => setTimeout(resolve, DELAY_BETWEEN_FETCHES_MS));
223
+ }
224
+ return progress;
225
+ }
226
+ async fetchTemplateIds(max, progress) {
227
+ const ids = [];
228
+ let page = 1;
229
+ while (ids.length < max) {
230
+ const url = `${N8N_TEMPLATE_API}/search?page=${page}&rows=${PAGE_SIZE}`;
231
+ const response = await fetch(url);
232
+ if (!response.ok) break;
233
+ const data = await response.json();
234
+ progress.total = Math.min(data.totalWorkflows, max);
235
+ for (const template of data.workflows) {
236
+ if (ids.length >= max) break;
237
+ if (template.price && template.price > 0) {
238
+ progress.skippedPaid++;
239
+ continue;
240
+ }
241
+ ids.push(template.id);
242
+ }
243
+ if (data.workflows.length < PAGE_SIZE) break;
244
+ page++;
245
+ await new Promise((resolve) => setTimeout(resolve, DELAY_BETWEEN_FETCHES_MS));
246
+ }
247
+ return ids;
248
+ }
249
+ async processTemplate(id, progress) {
250
+ const url = `${N8N_TEMPLATE_API}/workflows/${id}`;
251
+ const response = await fetch(url);
252
+ if (!response.ok) return;
253
+ const data = await response.json();
254
+ const templateMeta = data.workflow;
255
+ const rawWorkflow = templateMeta.workflow;
256
+ if (!rawWorkflow?.nodes?.length) return;
257
+ const workflow = {
258
+ name: templateMeta.name,
259
+ nodes: rawWorkflow.nodes.filter((n) => n.type && n.name),
260
+ connections: rawWorkflow.connections,
261
+ settings: rawWorkflow.settings ? { executionOrder: "v1", ...rawWorkflow.settings } : { ...DEFAULT_SETTINGS }
262
+ };
263
+ const validation = this.validator.validate(workflow);
264
+ const validationErrors = validation.issues.filter((i) => i.severity === "error");
265
+ if (validationErrors.length > 0) {
266
+ progress.blocked++;
267
+ this.logger.debug(`Template ${id} blocked: ${validationErrors.length} validation errors`);
268
+ return;
269
+ }
270
+ const safety = assessTemplateSafety(workflow);
271
+ if (safety.trustLevel === "blocked") {
272
+ progress.blocked++;
273
+ this.logger.debug(`Template ${id} blocked: ${safety.reasons.join(", ")}`);
274
+ return;
275
+ }
276
+ if (safety.trustLevel === "review") {
277
+ progress.reviewed++;
278
+ }
279
+ const description = this.cleanDescription(templateMeta.description);
280
+ const autoTags = Array.from(new Set(
281
+ workflow.nodes.flatMap((n) => {
282
+ const bare = n.type.split(".").pop() ?? "";
283
+ const tags = [bare];
284
+ if (n.type.includes("Trigger") || n.type.includes("trigger")) tags.push(`trigger:${bare}`);
285
+ if (n.type.includes("langchain")) tags.push("ai");
286
+ return tags;
287
+ })
288
+ ));
289
+ const metadata = {
290
+ description,
291
+ tags: autoTags,
292
+ sourceKind: "n8n-template",
293
+ sourceId: String(id),
294
+ sourceUrl: `https://n8n.io/workflows/${id}`,
295
+ trustLevel: safety.trustLevel
296
+ };
297
+ await this.library.save(workflow, metadata);
298
+ progress.saved++;
299
+ this.logger.debug(`Template ${id} saved: "${templateMeta.name}" (${safety.trustLevel})`);
300
+ }
301
+ cleanDescription(raw) {
302
+ return raw.replace(/#{1,6}\s*/g, "").replace(/\*{1,2}([^*]+)\*{1,2}/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\n{3,}/g, "\n\n").trim().slice(0, 500);
303
+ }
304
+ };
305
+
306
+ export {
307
+ NullLibrary,
308
+ GuardError,
309
+ N8nProvider,
310
+ GenerationError,
311
+ ResponseParseError,
312
+ ValidationError,
313
+ TemplateSyncer
314
+ };
315
+ //# sourceMappingURL=chunk-6CLI43FI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/library/null-library.ts","../src/errors/guard-error.ts","../src/providers/n8n/provider.ts","../src/errors/generation-error.ts","../src/errors/response-parse-error.ts","../src/errors/validation-error.ts","../src/templates/safety.ts","../src/templates/syncer.ts"],"sourcesContent":["import type { IWorkflowLibrary, WorkflowMatch, StoredWorkflow, WorkflowMetadataInput, LibraryFilters, SearchOptions, OutcomeData } from './types.js'\nimport type { N8nWorkflow } from '../types/workflow.js'\nimport { generateUUID } from '../utils/uuid.js'\n\nexport class NullLibrary implements IWorkflowLibrary {\n async initialize(): Promise<void> {}\n\n async search(_description: string, _options?: SearchOptions): Promise<WorkflowMatch[]> {\n return []\n }\n\n async save(_workflow: N8nWorkflow, _metadata: WorkflowMetadataInput): Promise<string> {\n return generateUUID()\n }\n\n async recordDeployment(_id: string): Promise<void> {}\n\n async recordOutcome(_id: string, _outcome: OutcomeData): Promise<void> {}\n\n async get(_id: string): Promise<StoredWorkflow | null> {\n return null\n }\n\n async list(_filters?: LibraryFilters): Promise<StoredWorkflow[]> {\n return []\n }\n}\n","import { KairosError } from './base.js'\n\nexport class GuardError extends KairosError {\n constructor(message: string) {\n super(message)\n this.name = 'GuardError'\n }\n}\n","import type { N8nWorkflow, Tag } from '../../types/workflow.js'\nimport type { DeployResult, WorkflowListItem, ExecutionSummary, ExecutionDetail } from '../../types/result.js'\nimport type { DeleteOptions, ExecutionFilter } from '../../types/options.js'\nimport type { IProvider } from '../types.js'\nimport { GuardError } from '../../errors/guard-error.js'\nimport { N8nApiClient } from './api-client.js'\nimport { N8nFieldStripper } from './stripper.js'\n\nexport class N8nProvider implements IProvider {\n readonly platform = 'n8n'\n\n constructor(\n private readonly client: N8nApiClient,\n private readonly stripper: N8nFieldStripper,\n ) {}\n\n async deploy(workflow: N8nWorkflow): Promise<DeployResult> {\n const stripped = this.stripper.stripForCreate(workflow)\n const response = await this.client.createWorkflow(stripped)\n return { workflowId: response.id, name: response.name }\n }\n\n async update(id: string, workflow: N8nWorkflow): Promise<DeployResult> {\n const stripped = this.stripper.stripForUpdate(workflow)\n const response = await this.client.updateWorkflow(id, stripped)\n return { workflowId: response.id, name: response.name }\n }\n\n async get(id: string): Promise<N8nWorkflow> {\n const response = await this.client.getWorkflow(id)\n return {\n name: response.name,\n nodes: response.nodes,\n connections: response.connections,\n ...(response.settings !== undefined ? { settings: response.settings } : {}),\n ...(response.tags !== undefined ? { tags: response.tags } : {}),\n }\n }\n\n async list(): Promise<WorkflowListItem[]> {\n return this.client.listWorkflows()\n }\n\n async activate(id: string): Promise<void> {\n await this.client.activateWorkflow(id)\n }\n\n async deactivate(id: string): Promise<void> {\n await this.client.deactivateWorkflow(id)\n }\n\n async delete(id: string, options: DeleteOptions): Promise<void> {\n if (options.confirm !== true) {\n throw new GuardError('delete() requires { confirm: true } to prevent accidental deletion')\n }\n await this.client.deleteWorkflow(id)\n }\n\n async executions(workflowId?: string, filter?: ExecutionFilter): Promise<ExecutionSummary[]> {\n return this.client.getExecutions(workflowId, filter)\n }\n\n async execution(id: string): Promise<ExecutionDetail> {\n return this.client.getExecution(id)\n }\n\n async listTags(): Promise<Tag[]> {\n return this.client.listTags()\n }\n\n async createTag(name: string): Promise<Tag> {\n return this.client.createTag(name)\n }\n\n async tag(workflowId: string, tagIds: string[]): Promise<void> {\n await this.client.tagWorkflow(workflowId, tagIds)\n }\n\n async untag(workflowId: string, tagIds: string[]): Promise<void> {\n await this.client.untagWorkflow(workflowId, tagIds)\n }\n}\n","import { KairosError } from './base.js'\n\nexport class GenerationError extends KairosError {\n constructor(message: string, cause?: unknown) {\n super(message, cause)\n this.name = 'GenerationError'\n }\n}\n","import { KairosError } from './base.js'\n\nexport class ResponseParseError extends KairosError {\n constructor(message: string, cause?: unknown) {\n super(message, cause)\n this.name = 'ResponseParseError'\n }\n}\n","import { KairosError } from './base.js'\nimport type { ValidationIssue } from '../validation/types.js'\nimport type { AttemptMetadata } from '../telemetry/types.js'\n\nexport type { ValidationIssue }\n\nexport class ValidationError extends KairosError {\n constructor(\n message: string,\n public readonly issues: ValidationIssue[],\n public readonly attemptMetadata?: AttemptMetadata[],\n public readonly warnedRules?: number[],\n ) {\n super(message)\n this.name = 'ValidationError'\n }\n}\n","import type { TrustLevel } from '../library/types.js'\nimport type { N8nWorkflow } from '../types/workflow.js'\n\ninterface SafetyResult {\n trustLevel: TrustLevel\n reasons: string[]\n}\n\nconst BLOCKED_NODE_TYPES = new Set([\n 'n8n-nodes-base.code',\n 'n8n-nodes-base.executeCommand',\n 'n8n-nodes-base.ssh',\n])\n\nconst REVIEW_NODE_TYPES = new Set([\n 'n8n-nodes-base.httpRequest',\n])\n\nconst SECRET_PATTERNS = [\n /sk-[a-zA-Z0-9]{20,}/,\n /ghp_[a-zA-Z0-9]{36}/,\n /xoxb-[0-9]+-[0-9]+-[a-zA-Z0-9]+/,\n /AIza[a-zA-Z0-9_-]{35}/,\n /AKIA[A-Z0-9]{16}/,\n]\n\nexport function assessTemplateSafety(workflow: N8nWorkflow): SafetyResult {\n const reasons: string[] = []\n let worst: TrustLevel = 'safe'\n\n const escalate = (level: TrustLevel, reason: string) => {\n reasons.push(reason)\n if (level === 'blocked') worst = 'blocked'\n else if (level === 'review' && worst === 'safe') worst = 'review'\n }\n\n for (const node of workflow.nodes) {\n if (BLOCKED_NODE_TYPES.has(node.type)) {\n escalate('blocked', `Contains ${node.type} node \"${node.name}\"`)\n }\n\n if (REVIEW_NODE_TYPES.has(node.type)) {\n escalate('review', `Contains ${node.type} node \"${node.name}\"`)\n }\n\n const paramStr = JSON.stringify(node.parameters)\n for (const pattern of SECRET_PATTERNS) {\n if (pattern.test(paramStr)) {\n escalate('blocked', `Node \"${node.name}\" parameters contain a hardcoded secret`)\n break\n }\n }\n }\n\n return { trustLevel: worst, reasons }\n}\n","import type { IWorkflowLibrary, WorkflowMetadataInput } from '../library/types.js'\nimport type { N8nWorkflow, N8nNode } from '../types/workflow.js'\nimport type { ILogger } from '../utils/logger.js'\nimport type { TemplateSearchResponse, TemplateDetailResponse, SyncProgress } from './types.js'\nimport { N8nValidator } from '../validation/validator.js'\nimport { assessTemplateSafety } from './safety.js'\n\nconst N8N_TEMPLATE_API = 'https://api.n8n.io/api/templates'\nconst PAGE_SIZE = 50\nconst DELAY_BETWEEN_FETCHES_MS = 200\n\nconst DEFAULT_SETTINGS: N8nWorkflow['settings'] = {\n executionOrder: 'v1',\n saveManualExecutions: true,\n timezone: 'UTC',\n}\n\nexport interface SyncOptions {\n maxTemplates?: number\n onProgress?: (progress: SyncProgress) => void\n}\n\nexport class TemplateSyncer {\n private readonly validator: N8nValidator\n private readonly logger: ILogger\n\n constructor(\n private readonly library: IWorkflowLibrary,\n logger: ILogger,\n ) {\n this.validator = new N8nValidator()\n this.logger = logger\n }\n\n async sync(options?: SyncOptions): Promise<SyncProgress> {\n const maxTemplates = options?.maxTemplates ?? 500\n\n await this.library.initialize()\n\n const existing = await this.library.list()\n const existingSourceIds = new Set(\n existing\n .filter((w) => w.sourceKind === 'n8n-template' && w.sourceId)\n .map((w) => w.sourceId!),\n )\n\n const progress: SyncProgress = {\n total: 0,\n processed: 0,\n saved: 0,\n skippedPaid: 0,\n skippedDuplicate: 0,\n blocked: 0,\n reviewed: 0,\n }\n\n const templateIds = await this.fetchTemplateIds(maxTemplates, progress)\n\n for (const id of templateIds) {\n if (existingSourceIds.has(String(id))) {\n progress.skippedDuplicate++\n progress.processed++\n options?.onProgress?.(progress)\n continue\n }\n\n try {\n await this.processTemplate(id, progress)\n } catch (err) {\n this.logger.warn(`Failed to process template ${id}`, { err: String(err) })\n }\n\n progress.processed++\n options?.onProgress?.(progress)\n\n await new Promise((resolve) => setTimeout(resolve, DELAY_BETWEEN_FETCHES_MS))\n }\n\n return progress\n }\n\n private async fetchTemplateIds(max: number, progress: SyncProgress): Promise<number[]> {\n const ids: number[] = []\n let page = 1\n\n while (ids.length < max) {\n const url = `${N8N_TEMPLATE_API}/search?page=${page}&rows=${PAGE_SIZE}`\n const response = await fetch(url)\n if (!response.ok) break\n\n const data = (await response.json()) as TemplateSearchResponse\n progress.total = Math.min(data.totalWorkflows, max)\n\n for (const template of data.workflows) {\n if (ids.length >= max) break\n if (template.price && template.price > 0) {\n progress.skippedPaid++\n continue\n }\n ids.push(template.id)\n }\n\n if (data.workflows.length < PAGE_SIZE) break\n page++\n\n await new Promise((resolve) => setTimeout(resolve, DELAY_BETWEEN_FETCHES_MS))\n }\n\n return ids\n }\n\n private async processTemplate(id: number, progress: SyncProgress): Promise<void> {\n const url = `${N8N_TEMPLATE_API}/workflows/${id}`\n const response = await fetch(url)\n if (!response.ok) return\n\n const data = (await response.json()) as TemplateDetailResponse\n const templateMeta = data.workflow\n const rawWorkflow = templateMeta.workflow\n\n if (!rawWorkflow?.nodes?.length) return\n\n const workflow: N8nWorkflow = {\n name: templateMeta.name,\n nodes: rawWorkflow.nodes.filter((n) => n.type && n.name) as N8nNode[],\n connections: rawWorkflow.connections as N8nWorkflow['connections'],\n settings: rawWorkflow.settings\n ? { executionOrder: 'v1' as const, ...rawWorkflow.settings }\n : { ...DEFAULT_SETTINGS },\n }\n\n const validation = this.validator.validate(workflow)\n const validationErrors = validation.issues.filter((i) => i.severity === 'error')\n\n if (validationErrors.length > 0) {\n progress.blocked++\n this.logger.debug(`Template ${id} blocked: ${validationErrors.length} validation errors`)\n return\n }\n\n const safety = assessTemplateSafety(workflow)\n\n if (safety.trustLevel === 'blocked') {\n progress.blocked++\n this.logger.debug(`Template ${id} blocked: ${safety.reasons.join(', ')}`)\n return\n }\n\n if (safety.trustLevel === 'review') {\n progress.reviewed++\n }\n\n const description = this.cleanDescription(templateMeta.description)\n\n const autoTags = Array.from(new Set(\n workflow.nodes.flatMap((n) => {\n const bare = n.type.split('.').pop() ?? ''\n const tags = [bare]\n if (n.type.includes('Trigger') || n.type.includes('trigger')) tags.push(`trigger:${bare}`)\n if (n.type.includes('langchain')) tags.push('ai')\n return tags\n }),\n ))\n\n const metadata: WorkflowMetadataInput = {\n description,\n tags: autoTags,\n sourceKind: 'n8n-template',\n sourceId: String(id),\n sourceUrl: `https://n8n.io/workflows/${id}`,\n trustLevel: safety.trustLevel,\n }\n\n await this.library.save(workflow, metadata)\n progress.saved++\n this.logger.debug(`Template ${id} saved: \"${templateMeta.name}\" (${safety.trustLevel})`)\n }\n\n private cleanDescription(raw: string): string {\n return raw\n .replace(/#{1,6}\\s*/g, '')\n .replace(/\\*{1,2}([^*]+)\\*{1,2}/g, '$1')\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim()\n .slice(0, 500)\n }\n}\n"],"mappings":";;;;;;;AAIO,IAAM,cAAN,MAA8C;AAAA,EACnD,MAAM,aAA4B;AAAA,EAAC;AAAA,EAEnC,MAAM,OAAO,cAAsB,UAAoD;AACrF,WAAO,CAAC;AAAA,EACV;AAAA,EAEA,MAAM,KAAK,WAAwB,WAAmD;AACpF,WA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