@kairos-sdk/core 0.4.5 → 0.5.1
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/README.md +28 -11
- package/dist/{chunk-4TS6GW6O.js → chunk-GVZKMS53.js} +27 -16
- package/dist/chunk-GVZKMS53.js.map +1 -0
- package/dist/{chunk-6CLI43FI.js → chunk-MYAGTDQ2.js} +109 -13
- package/dist/chunk-MYAGTDQ2.js.map +1 -0
- package/dist/{chunk-CR2NHLOH.js → chunk-V2IZBZGB.js} +57 -11
- package/dist/chunk-V2IZBZGB.js.map +1 -0
- package/dist/{chunk-6IXW3WCC.js → chunk-VPPWTMRJ.js} +533 -77
- package/dist/chunk-VPPWTMRJ.js.map +1 -0
- package/dist/cli.cjs +790 -145
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +54 -16
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +740 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +5 -5
- package/dist/mcp-server.cjs +960 -347
- package/dist/mcp-server.cjs.map +1 -1
- package/dist/mcp-server.js +374 -261
- package/dist/mcp-server.js.map +1 -1
- package/dist/{reader-CpUcHhKW.d.ts → reader-B5mV20H6.d.cts} +34 -4
- package/dist/{reader-CpUcHhKW.d.cts → reader-B5mV20H6.d.ts} +34 -4
- package/dist/standalone.cjs +603 -85
- package/dist/standalone.cjs.map +1 -1
- package/dist/standalone.d.cts +2 -1
- package/dist/standalone.d.ts +2 -1
- package/dist/standalone.js +3 -3
- package/package.json +15 -5
- package/dist/chunk-4TS6GW6O.js.map +0 -1
- package/dist/chunk-6CLI43FI.js.map +0 -1
- package/dist/chunk-6IXW3WCC.js.map +0 -1
- package/dist/chunk-CR2NHLOH.js.map +0 -1
package/dist/mcp-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mcp-server.ts","../src/validation/node-syncer.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Kairos MCP Server — decomposed architecture.\n *\n * The host LLM (Claude, GPT, Gemini, whatever) generates the workflow.\n * Kairos provides the knowledge (system prompt, library, failure patterns)\n * and guardrails (validator, deployer). Zero Anthropic API key needed.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { z } from 'zod'\nimport { FileLibrary } from './library/file-library.js'\nimport { N8nValidator } from './validation/validator.js'\nimport { N8nFieldStripper } from './providers/n8n/stripper.js'\nimport { N8nApiClient } from './providers/n8n/api-client.js'\nimport { PromptBuilder } from './generation/prompt-builder.js'\nimport { TelemetryReader } from './telemetry/reader.js'\nimport { PatternAnalyzer } from './telemetry/pattern-analyzer.js'\nimport { NodeSyncer, type SyncResult } from './validation/node-syncer.js'\nimport { TelemetryCollector } from './telemetry/collector.js'\nimport { nullLogger } from './utils/logger.js'\nimport { generateUUID } from './utils/uuid.js'\nimport { inferWorkflowType } from './utils/workflow-type.js'\nimport type { N8nWorkflow } from './types/workflow.js'\nimport { readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { homedir } from 'node:os'\nimport { fileURLToPath } from 'node:url'\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\nconst pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')) as { version: string }\n\nconst library = new FileLibrary()\nlet validator = new N8nValidator()\nconst nodeSyncer = new NodeSyncer()\nlet lastSync: SyncResult | null = null\nconst stripper = new N8nFieldStripper()\nconst promptBuilder = new PromptBuilder(getMcpPatternsPath())\n\nfunction getMcpTelemetry(): TelemetryCollector | null {\n const val = process.env['KAIROS_TELEMETRY']\n if (!val || val === 'false') return null\n return val === 'true' ? new TelemetryCollector() : new TelemetryCollector(val)\n}\n\n/**\n * Derive the patterns.json path from KAIROS_TELEMETRY so the MCP server's\n * PromptBuilder reads from the same location that PatternAnalyzer.fromEnv() writes to.\n */\nfunction getMcpPatternsPath(): string {\n const val = process.env['KAIROS_TELEMETRY']\n if (val && val !== 'false' && val !== 'true') {\n return join(val, '..', 'patterns.json')\n }\n return join(homedir(), '.kairos', 'patterns.json')\n}\n\nconst mcpTelemetry = getMcpTelemetry()\n\ninterface McpBuildSession {\n description: string\n startTime: number\n validateAttempts: number\n warnedRules: number[]\n workflowType: string | null\n}\nconst mcpSessions = new Map<string, McpBuildSession>()\nconst SESSION_TTL_MS = 60 * 60 * 1000 // 1 hour: abandon sessions not completed by deploy\n\nfunction evictStaleSessions(): void {\n const cutoff = Date.now() - SESSION_TTL_MS\n for (const [id, session] of mcpSessions) {\n if (session.startTime < cutoff) mcpSessions.delete(id)\n }\n}\n\nfunction getTelemetryReader(): TelemetryReader | null {\n try {\n return new TelemetryReader()\n } catch {\n return null\n }\n}\n\nfunction isAllowed(action: 'deploy' | 'activate' | 'delete'): boolean {\n const key = `KAIROS_MCP_ALLOW_${action.toUpperCase()}`\n return process.env[key] === 'true'\n}\n\nfunction getApiClient(): N8nApiClient {\n const baseUrl = process.env['N8N_BASE_URL']\n const apiKey = process.env['N8N_API_KEY']\n if (!baseUrl || !apiKey) {\n throw new Error('N8N_BASE_URL and N8N_API_KEY environment variables are required for n8n operations')\n }\n return new N8nApiClient(baseUrl, apiKey, nullLogger)\n}\n\nasync function autoSync(): Promise<SyncResult | null> {\n if (lastSync) return lastSync\n const baseUrl = process.env['N8N_BASE_URL']\n const apiKey = process.env['N8N_API_KEY']\n if (!baseUrl || !apiKey) return null\n try {\n const client = new N8nApiClient(baseUrl, apiKey, nullLogger)\n const nodeTypes = await client.getNodeTypes()\n if (nodeTypes.length === 0) return null\n lastSync = nodeSyncer.sync(nodeTypes)\n validator = new N8nValidator(lastSync.registry)\n return lastSync\n } catch {\n return null\n }\n}\n\nconst server = new McpServer({\n name: 'kairos',\n version: pkg.version,\n})\n\n// ── Core generation tools (no API key needed) ──────────────────────────────\n\nserver.tool(\n 'kairos_prompt',\n 'Get the specialized n8n workflow generation context. Returns a system prompt with node catalog, connection rules, validation rules, plus library matches and failure patterns for the given description. Feed this to yourself as context, then generate the workflow JSON.',\n {\n description: z.string().describe('Plain-English description of the workflow to build'),\n name: z.string().optional().describe('Optional workflow name override'),\n },\n async ({ description, name }) => {\n evictStaleSessions()\n\n const baseUrl = process.env['N8N_BASE_URL']\n const apiKey = process.env['N8N_API_KEY']\n if (!baseUrl || !apiKey) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({ error: 'N8N_BASE_URL and N8N_API_KEY are required. Kairos needs to sync your n8n instance\\'s node types to generate accurate workflows.' }),\n }],\n isError: true,\n }\n }\n\n const runId = generateUUID()\n const workflowType = inferWorkflowType(description)\n\n await library.initialize()\n const syncResult = await autoSync()\n const matches = await library.search(description)\n const telemetryReader = getTelemetryReader()\n const failureRates = await telemetryReader?.getFailureRates() ?? []\n\n const request = { description, ...(name ? { name } : {}) }\n const built = promptBuilder.build(request, matches, failureRates, syncResult?.catalogText)\n\n if (mcpTelemetry) {\n mcpSessions.set(runId, {\n description,\n startTime: Date.now(),\n validateAttempts: 0,\n warnedRules: promptBuilder.getWarnedRules(),\n workflowType,\n })\n await mcpTelemetry.emit('build_start', { description, model: 'mcp-decomposed', dryRun: false }, runId)\n }\n\n const systemText = built.system.map(block => block.text).join('\\n\\n---\\n\\n')\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n kairos_run_id: runId,\n mode: built.mode,\n matchCount: matches.length,\n topMatchScore: matches[0]?.score ?? null,\n nodeCatalog: syncResult ? 'synced' : 'static',\n nodeCount: syncResult?.nodeCount ?? null,\n ...(syncResult ? {} : { syncWarning: 'Could not sync node types from your n8n instance. Using static fallback catalog — generated workflows may not match your exact n8n setup.' }),\n systemPrompt: systemText,\n userMessage: built.userMessage,\n outputFormat: {\n description: 'Generate a JSON object with this exact structure. The workflow field contains the n8n workflow. credentialsNeeded lists services requiring credentials.',\n schema: {\n workflow: {\n name: 'string — descriptive workflow name',\n nodes: 'array — n8n node objects with id (UUID v4), type, typeVersion, name, position, parameters',\n connections: 'object — keyed by source node NAME, maps to target nodes',\n settings: 'object — include executionOrder: \"v1\"',\n },\n credentialsNeeded: [{\n service: 'string — e.g. \"Slack\"',\n credentialType: 'string — e.g. \"slackOAuth2Api\"',\n description: 'string — what the user needs to set up',\n }],\n },\n },\n }, null, 2),\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_validate',\n 'Validate n8n workflow JSON against 26 structural rules. Returns pass/fail with specific issues. If validation fails, fix the issues and call this again. Errors block deployment; warnings are advisory.',\n {\n workflow: z.string().describe('The workflow JSON string to validate'),\n kairos_run_id: z.string().optional().describe('Run ID from kairos_prompt — enables telemetry correlation'),\n },\n async ({ workflow: workflowStr, kairos_run_id }) => {\n let parsed: N8nWorkflow\n try {\n parsed = JSON.parse(workflowStr) as N8nWorkflow\n } catch (e) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n valid: false,\n error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}`,\n }, null, 2),\n }],\n }\n }\n\n const result = validator.validate(parsed)\n const errors = result.issues.filter(i => i.severity === 'error')\n const warnings = result.issues.filter(i => i.severity === 'warn')\n\n if (mcpTelemetry && kairos_run_id) {\n const session = mcpSessions.get(kairos_run_id)\n if (session) {\n session.validateAttempts++\n await mcpTelemetry.emit('generation_attempt', {\n description: session.description,\n attempt: session.validateAttempts,\n temperature: 0,\n durationMs: 0,\n tokensInput: 0,\n tokensOutput: 0,\n validationPassed: result.valid,\n issueCount: result.issues.length,\n issues: result.issues.map(i => ({ rule: i.rule, severity: i.severity, message: i.message, nodeId: i.nodeId ?? null })),\n workflowType: session.workflowType,\n }, kairos_run_id)\n }\n }\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n valid: result.valid,\n errorCount: errors.length,\n warningCount: warnings.length,\n errors: errors.map(i => ({\n rule: i.rule,\n message: i.message,\n nodeId: i.nodeId ?? null,\n })),\n warnings: warnings.map(i => ({\n rule: i.rule,\n message: i.message,\n nodeId: i.nodeId ?? null,\n })),\n deployable: errors.length === 0,\n }, null, 2),\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_deploy',\n 'Deploy a validated workflow to n8n. Pass the workflow JSON that passed kairos_validate. Strips server-assigned fields automatically. Requires N8N_BASE_URL and N8N_API_KEY.',\n {\n workflow: z.string().describe('The validated workflow JSON string to deploy'),\n activate: z.boolean().default(false).describe('Activate the workflow immediately after deployment'),\n kairos_run_id: z.string().optional().describe('Run ID from kairos_prompt — enables telemetry correlation'),\n },\n async ({ workflow: workflowStr, activate, kairos_run_id }) => {\n if (!isAllowed('deploy')) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({ error: 'Deploy is disabled. Set KAIROS_MCP_ALLOW_DEPLOY=true to enable.' }),\n }],\n isError: true,\n }\n }\n\n let parsed: N8nWorkflow\n try {\n parsed = JSON.parse(workflowStr) as N8nWorkflow\n } catch (e) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({ error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` }),\n }],\n }\n }\n\n const validation = validator.validate(parsed)\n const errors = validation.issues.filter(i => i.severity === 'error')\n if (errors.length > 0) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n error: 'Workflow has validation errors — fix them before deploying',\n errors: errors.map(i => ({ rule: i.rule, message: i.message })),\n }, null, 2),\n }],\n }\n }\n\n const client = getApiClient()\n const stripped = stripper.stripForCreate(parsed)\n const response = await client.createWorkflow(stripped)\n\n if (activate) {\n if (!isAllowed('activate')) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n workflowId: response.id,\n name: response.name,\n activated: false,\n warning: 'Workflow deployed but activation is disabled. Set KAIROS_MCP_ALLOW_ACTIVATE=true to enable.',\n url: `${process.env['N8N_BASE_URL']}/workflow/${response.id}`,\n }, null, 2),\n }],\n }\n }\n await client.activateWorkflow(response.id)\n }\n\n // Save to library for future retrieval\n await library.initialize()\n await library.save(parsed, {\n description: parsed.name,\n generationMode: 'scratch',\n generationAttempts: 1,\n })\n\n if (mcpTelemetry && kairos_run_id) {\n const session = mcpSessions.get(kairos_run_id)\n if (session) {\n await mcpTelemetry.emit('build_complete', {\n description: session.description,\n success: true,\n totalAttempts: session.validateAttempts,\n totalDurationMs: Date.now() - session.startTime,\n totalTokensInput: 0,\n totalTokensOutput: 0,\n workflowName: response.name,\n workflowId: response.id,\n dryRun: false,\n credentialsNeeded: 0,\n warnedRules: session.warnedRules,\n workflowType: session.workflowType,\n }, kairos_run_id)\n mcpSessions.delete(kairos_run_id)\n PatternAnalyzer.fromEnv().analyzeAndSave().catch(() => {})\n }\n }\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n workflowId: response.id,\n name: response.name,\n activated: activate,\n url: `${process.env['N8N_BASE_URL']}/workflow/${response.id}`,\n }, null, 2),\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_search',\n 'Search the local workflow library for similar past builds. Returns matching workflows with scores, useful for finding examples and reusing patterns.',\n {\n query: z.string().describe('Search query — a workflow description or keywords'),\n limit: z.number().default(5).describe('Maximum number of results'),\n },\n async ({ query, limit }) => {\n await library.initialize()\n const matches = await library.search(query)\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify(\n matches.slice(0, limit).map(m => ({\n score: Number(m.score.toFixed(3)),\n mode: m.mode,\n description: m.workflow.description,\n nodeCount: m.workflow.workflow.nodes.length,\n nodes: m.workflow.workflow.nodes.map(n => n.name),\n failurePatterns: m.workflow.failurePatterns ?? [],\n })),\n null,\n 2,\n ),\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_sync',\n 'Sync the node catalog from your live n8n instance. Fetches all installed node types and versions so Kairos knows exactly what your n8n supports. Automatically called by kairos_prompt when n8n credentials are set, but you can call this manually to force a refresh.',\n {},\n async () => {\n const baseUrl = process.env['N8N_BASE_URL']\n const apiKey = process.env['N8N_API_KEY']\n if (!baseUrl || !apiKey) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({ error: 'N8N_BASE_URL and N8N_API_KEY are required for sync.' }),\n }],\n isError: true,\n }\n }\n\n lastSync = null\n const result = await autoSync()\n if (!result) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({ error: 'Failed to fetch node types from n8n. Check your credentials and that your instance is running.' }),\n }],\n isError: true,\n }\n }\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({\n synced: true,\n nodeCount: result.nodeCount,\n newNodes: result.newNodes,\n message: `Synced ${result.nodeCount} node types from your n8n instance (${result.newNodes} not in default catalog).`,\n }, null, 2),\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_patterns',\n 'Analyze telemetry data and return failure patterns, build stats, and credential breakdowns. Useful for understanding what goes wrong most often and how to prevent it.',\n {\n days: z.number().default(30).describe('Number of days of telemetry to analyze'),\n limit: z.number().optional().describe('Maximum number of failure patterns to return'),\n },\n async ({ days, limit }) => {\n const analyzer = PatternAnalyzer.fromEnv()\n const analysis = await analyzer.analyzeAndSave(days)\n\n if (limit !== undefined && limit > 0) {\n analysis.topFailureRules = analysis.topFailureRules.slice(0, limit)\n }\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify(analysis, null, 2),\n }],\n }\n },\n)\n\n// ── n8n management tools (need N8N_BASE_URL + N8N_API_KEY) ─────────────────\n\nserver.tool(\n 'kairos_list',\n 'List all workflows deployed on the connected n8n instance.',\n {},\n async () => {\n const client = getApiClient()\n const workflows = await client.listWorkflows()\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify(workflows, null, 2),\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_get',\n 'Get the full JSON definition of a specific workflow by ID.',\n {\n workflow_id: z.string().describe('The n8n workflow ID'),\n },\n async ({ workflow_id }) => {\n const client = getApiClient()\n const workflow = await client.getWorkflow(workflow_id)\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify(workflow, null, 2),\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_activate',\n 'Activate a deployed workflow so it starts running on triggers.',\n {\n workflow_id: z.string().describe('The n8n workflow ID to activate'),\n },\n async ({ workflow_id }) => {\n if (!isAllowed('activate')) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({ error: 'Activate is disabled. Set KAIROS_MCP_ALLOW_ACTIVATE=true to enable.' }),\n }],\n isError: true,\n }\n }\n\n const client = getApiClient()\n await client.activateWorkflow(workflow_id)\n\n return {\n content: [{\n type: 'text' as const,\n text: `Activated workflow ${workflow_id}`,\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_deactivate',\n 'Deactivate a running workflow.',\n {\n workflow_id: z.string().describe('The n8n workflow ID to deactivate'),\n },\n async ({ workflow_id }) => {\n const client = getApiClient()\n await client.deactivateWorkflow(workflow_id)\n\n return {\n content: [{\n type: 'text' as const,\n text: `Deactivated workflow ${workflow_id}`,\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_delete',\n 'Delete a workflow from n8n. This is irreversible.',\n {\n workflow_id: z.string().describe('The n8n workflow ID to delete'),\n },\n async ({ workflow_id }) => {\n if (!isAllowed('delete')) {\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify({ error: 'Delete is disabled. Set KAIROS_MCP_ALLOW_DELETE=true to enable.' }),\n }],\n isError: true,\n }\n }\n\n const client = getApiClient()\n await client.deleteWorkflow(workflow_id)\n\n return {\n content: [{\n type: 'text' as const,\n text: `Deleted workflow ${workflow_id}`,\n }],\n }\n },\n)\n\nserver.tool(\n 'kairos_executions',\n 'List recent executions for a workflow, showing status and timing.',\n {\n workflow_id: z.string().optional().describe('Filter to a specific workflow ID (omit for all)'),\n limit: z.number().default(20).describe('Maximum number of executions to return'),\n },\n async ({ workflow_id, limit }) => {\n const client = getApiClient()\n const executions = await client.getExecutions(workflow_id, { limit })\n\n return {\n content: [{\n type: 'text' as const,\n text: JSON.stringify(executions, null, 2),\n }],\n }\n },\n)\n\nasync function main() {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n}\n\nmain().catch((err: unknown) => {\n console.error('Kairos MCP server failed to start:', err)\n process.exit(1)\n})\n","import type { N8nNodeTypeInfo } from '../providers/n8n/types.js'\nimport type { NodeDefinition } from './registry.js'\nimport { NodeRegistry, DEFAULT_REGISTRY } from './registry.js'\n\nconst TRIGGER_PATTERNS = [/trigger/i, /Trigger$/]\n\nexport interface SyncResult {\n registry: NodeRegistry\n catalogText: string\n nodeCount: number\n newNodes: number\n}\n\nexport class NodeSyncer {\n private readonly baseRegistry: Map<string, NodeDefinition>\n\n constructor() {\n this.baseRegistry = new Map(DEFAULT_REGISTRY.map(d => [d.type, d]))\n }\n\n sync(liveNodes: N8nNodeTypeInfo[]): SyncResult {\n const merged = new Map(this.baseRegistry)\n let newNodes = 0\n\n for (const node of liveNodes) {\n const versions = Array.isArray(node.version) ? node.version : [node.version]\n const isTrigger = TRIGGER_PATTERNS.some(p => p.test(node.name))\n const credentialType = node.credentials?.[0]?.name\n\n const existing = merged.get(node.name)\n if (existing) {\n const allVersions = new Set([...existing.safeTypeVersions, ...versions])\n merged.set(node.name, {\n ...existing,\n safeTypeVersions: [...allVersions].sort((a, b) => a - b),\n })\n } else {\n newNodes++\n merged.set(node.name, {\n type: node.name,\n safeTypeVersions: versions.sort((a, b) => a - b),\n requiredParams: [],\n ...(credentialType ? { credentialType } : {}),\n ...(isTrigger ? { isTrigger: true } : {}),\n })\n }\n }\n\n const definitions = [...merged.values()]\n const registry = new NodeRegistry(definitions)\n const catalogText = this.buildCatalog(definitions)\n\n return { registry, catalogText, nodeCount: definitions.length, newNodes }\n }\n\n private buildCatalog(definitions: NodeDefinition[]): string {\n const triggers = definitions.filter(d => d.isTrigger)\n const regular = definitions.filter(d => !d.isTrigger)\n\n const formatEntry = (d: NodeDefinition): string => {\n const versions = d.safeTypeVersions.join(', ')\n const cred = d.credentialType ? ` — cred: ${d.credentialType}` : ''\n return `${d.type} typeVersion: ${versions}${cred}`\n }\n\n const triggerLines = triggers.map(formatEntry).join('\\n')\n const regularLines = regular.map(formatEntry).join('\\n')\n\n return `## NODE CATALOG — synced from your n8n instance (${definitions.length} node types)\n\n### Triggers:\n${triggerLines}\n\n### Regular nodes:\n${regularLines}`\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;;;ACRlB,IAAM,mBAAmB,CAAC,YAAY,UAAU;AASzC,IAAM,aAAN,MAAiB;AAAA,EACL;AAAA,EAEjB,cAAc;AACZ,SAAK,eAAe,IAAI,IAAI,iBAAiB,IAAI,OAAK,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAAA,EACpE;AAAA,EAEA,KAAK,WAA0C;AAC7C,UAAM,SAAS,IAAI,IAAI,KAAK,YAAY;AACxC,QAAI,WAAW;AAEf,eAAW,QAAQ,WAAW;AAC5B,YAAM,WAAW,MAAM,QAAQ,KAAK,OAAO,IAAI,KAAK,UAAU,CAAC,KAAK,OAAO;AAC3E,YAAM,YAAY,iBAAiB,KAAK,OAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAC9D,YAAM,iBAAiB,KAAK,cAAc,CAAC,GAAG;AAE9C,YAAM,WAAW,OAAO,IAAI,KAAK,IAAI;AACrC,UAAI,UAAU;AACZ,cAAM,cAAc,oBAAI,IAAI,CAAC,GAAG,SAAS,kBAAkB,GAAG,QAAQ,CAAC;AACvE,eAAO,IAAI,KAAK,MAAM;AAAA,UACpB,GAAG;AAAA,UACH,kBAAkB,CAAC,GAAG,WAAW,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,QACzD,CAAC;AAAA,MACH,OAAO;AACL;AACA,eAAO,IAAI,KAAK,MAAM;AAAA,UACpB,MAAM,KAAK;AAAA,UACX,kBAAkB,SAAS,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AAAA,UAC/C,gBAAgB,CAAC;AAAA,UACjB,GAAI,iBAAiB,EAAE,eAA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AAS,aAAa;AAC5B,UAAM,aAAa,MAAM,OAAO,cAAc,aAAa,EAAE,MAAM,CAAC;AAEpE,WAAO;AAAA,MACL,SAAS,CAAC;AAAA,QACR,MAAM;AAAA,QACN,MAAM,KAAK,UAAU,YAAY,MAAM,CAAC;AAAA,MAC1C,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEA,eAAe,OAAO;AACpB,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAiB;AAC7B,UAAQ,MAAM,sCAAsC,GAAG;AACvD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/mcp-server.ts","../src/validation/node-syncer.ts","../src/utils/node-catalog-cache.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * Kairos MCP Server — decomposed architecture.\n *\n * The host LLM (Claude, GPT, Gemini, whatever) generates the workflow.\n * Kairos provides the knowledge (system prompt, library, failure patterns)\n * and guardrails (validator, deployer). Zero Anthropic API key needed.\n */\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js'\nimport { createServer } from 'node:http'\nimport { z } from 'zod'\nimport { FileLibrary } from './library/file-library.js'\nimport { N8nValidator } from './validation/validator.js'\nimport { N8nFieldStripper } from './providers/n8n/stripper.js'\nimport { N8nApiClient } from './providers/n8n/api-client.js'\nimport { PromptBuilder } from './generation/prompt-builder.js'\nimport { TelemetryReader } from './telemetry/reader.js'\nimport { PatternAnalyzer } from './telemetry/pattern-analyzer.js'\nimport { NodeSyncer, type SyncResult } from './validation/node-syncer.js'\nimport { TelemetryCollector } from './telemetry/collector.js'\nimport { nullLogger } from './utils/logger.js'\nimport { GuardError } from './errors/guard-error.js'\nimport { generateUUID } from './utils/uuid.js'\nimport { inferWorkflowType } from './utils/workflow-type.js'\nimport type { N8nWorkflow } from './types/workflow.js'\nimport { readFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { homedir } from 'node:os'\nimport { fileURLToPath } from 'node:url'\nimport { readCatalogCache, writeCatalogCache } from './utils/node-catalog-cache.js'\n\nconst __dirname = dirname(fileURLToPath(import.meta.url))\nconst pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')) as { version: string }\n\nconst library = new FileLibrary()\nlet _validator = new N8nValidator()\n// Accessor so kairos_sync can swap the registry without callers closing over the old instance\nfunction getValidator(): N8nValidator { return _validator }\nconst nodeSyncer = new NodeSyncer()\nlet lastSync: SyncResult | null = null\nconst AUTO_SYNC_TIMEOUT_MS = 5_000 // cap how long kairos_prompt waits for n8n node sync\nconst stripper = new N8nFieldStripper()\nconst promptBuilder = new PromptBuilder(getMcpPatternsPath())\n\nfunction getMcpTelemetry(): TelemetryCollector | null {\n const val = process.env['KAIROS_TELEMETRY']\n if (!val || val === 'false') return null\n return val === 'true' ? new TelemetryCollector() : new TelemetryCollector(val)\n}\n\n/**\n * Derive the patterns.json path from KAIROS_TELEMETRY so the MCP server's\n * PromptBuilder reads from the same location that PatternAnalyzer.fromEnv() writes to.\n */\nfunction getMcpPatternsPath(): string {\n const val = process.env['KAIROS_TELEMETRY']\n if (val && val !== 'false' && val !== 'true') {\n return join(val, '..', 'patterns.json')\n }\n return join(homedir(), '.kairos', 'patterns.json')\n}\n\nconst mcpTelemetry = getMcpTelemetry()\n\ninterface McpBuildSession {\n description: string\n startTime: number\n validateAttempts: number\n warnedRules: number[]\n workflowType: string | null\n matchCount: number\n}\nconst mcpSessions = new Map<string, McpBuildSession>()\nconst SESSION_TTL_MS = 60 * 60 * 1000 // 1 hour: abandon sessions not completed by deploy\n\nfunction evictStaleSessions(): void {\n const cutoff = Date.now() - SESSION_TTL_MS\n for (const [id, session] of mcpSessions) {\n if (session.startTime < cutoff) mcpSessions.delete(id)\n }\n}\n\nfunction getTelemetryReader(): TelemetryReader | null {\n try {\n return new TelemetryReader()\n } catch {\n return null\n }\n}\n\ntype McpMode = 'readonly' | 'validate' | 'deploy'\n\nfunction getMcpMode(): McpMode {\n const mode = process.env['KAIROS_MCP_MODE']?.toLowerCase()\n if (mode === 'readonly' || mode === 'validate') return mode\n return 'deploy'\n}\n\nfunction isAllowed(action: 'deploy' | 'activate' | 'delete'): boolean {\n // readonly and validate modes block all write ops — mode restriction overrides ALLOW_* flags\n const mode = getMcpMode()\n if (mode === 'readonly' || mode === 'validate') return false\n // deploy mode (default): require explicit opt-in via ALLOW_* flags (preserves existing behavior)\n const key = `KAIROS_MCP_ALLOW_${action.toUpperCase()}`\n return process.env[key] === 'true'\n}\n\ntype McpTextContent = { type: 'text'; text: string }\ntype McpToolResult = { content: McpTextContent[]; isError?: true }\n\nfunction mcpText(text: string): McpToolResult { return { content: [{ type: 'text', text }] } }\nfunction mcpError(text: string): McpToolResult { return { content: [{ type: 'text', text }], isError: true } }\n\n/**\n * Returns an error result if KAIROS_MCP_SECRET is set and the provided secret\n * doesn't match. Returns null if auth passes (no secret configured, or correct secret).\n */\nfunction checkMcpAuth(provided: string | undefined): McpToolResult | null {\n const expected = process.env['KAIROS_MCP_SECRET']\n if (!expected) return null\n if (provided === expected) return null\n return mcpError(JSON.stringify({ error: 'Unauthorized: missing or incorrect kairos_secret' }))\n}\n\nfunction getApiClient(): N8nApiClient {\n const baseUrl = process.env['N8N_BASE_URL']\n const apiKey = process.env['N8N_API_KEY']\n if (!baseUrl || !apiKey) {\n throw new GuardError('N8N_BASE_URL and N8N_API_KEY environment variables are required for n8n operations')\n }\n return new N8nApiClient(baseUrl, apiKey, nullLogger)\n}\n\nfunction getCatalogCachePath(): string {\n const telemetry = process.env['KAIROS_TELEMETRY']\n const base = telemetry ? join(telemetry, '..') : join(homedir(), '.kairos')\n return join(base, 'node-catalog-cache.json')\n}\n\nasync function autoSync(): Promise<SyncResult | null> {\n if (lastSync) return lastSync\n\n // Try disk cache before hitting the network\n const cachePath = getCatalogCachePath()\n const cached = await readCatalogCache(cachePath)\n if (cached) {\n lastSync = cached\n _validator = new N8nValidator(lastSync.registry)\n return lastSync\n }\n\n const baseUrl = process.env['N8N_BASE_URL']\n const apiKey = process.env['N8N_API_KEY']\n if (!baseUrl || !apiKey) return null\n try {\n const client = new N8nApiClient(baseUrl, apiKey, nullLogger)\n const nodeTypes = await client.getNodeTypes()\n if (nodeTypes.length === 0) return null\n lastSync = nodeSyncer.sync(nodeTypes)\n _validator = new N8nValidator(lastSync.registry)\n writeCatalogCache(cachePath, lastSync).catch(() => {})\n return lastSync\n } catch {\n return null\n }\n}\n\nconst server = new McpServer({\n name: 'kairos',\n version: pkg.version,\n})\n\n// ── Core generation tools (no API key needed) ──────────────────────────────\n\nserver.tool(\n 'kairos_prompt',\n 'Get the specialized n8n workflow generation context. Returns a system prompt with node catalog, connection rules, validation rules, plus library matches and failure patterns for the given description. Feed this to yourself as context, then generate the workflow JSON.',\n {\n description: z.string().describe('Plain-English description of the workflow to build'),\n name: z.string().optional().describe('Optional workflow name override'),\n },\n async ({ description, name }) => {\n evictStaleSessions()\n\n const runId = generateUUID()\n const workflowType = inferWorkflowType(description)\n const hasN8nCreds = !!(process.env['N8N_BASE_URL'] && process.env['N8N_API_KEY'])\n\n // Start sync in background — race against timeout so slow n8n instances don't block the prompt\n const syncPromise = autoSync()\n const syncTimeout = new Promise<null>((resolve) => setTimeout(() => resolve(null), AUTO_SYNC_TIMEOUT_MS))\n\n await library.initialize()\n const [syncResult, matches, failureRates] = await Promise.all([\n Promise.race([syncPromise, syncTimeout]),\n library.search(description),\n (async () => {\n const reader = getTelemetryReader()\n return reader ? reader.getFailureRates() : []\n })(),\n ])\n\n const request = { description, ...(name ? { name } : {}) }\n const built = promptBuilder.build(request, matches, failureRates, syncResult?.catalogText)\n\n if (mcpTelemetry) {\n mcpSessions.set(runId, {\n description,\n startTime: Date.now(),\n validateAttempts: 0,\n warnedRules: promptBuilder.getWarnedRules(),\n workflowType,\n matchCount: matches.length,\n })\n await mcpTelemetry.emit('build_start', { description, model: 'mcp-decomposed', dryRun: false }, runId)\n }\n\n const systemText = built.system.map(block => block.text).join('\\n\\n---\\n\\n')\n\n return mcpText(JSON.stringify({\n kairos_run_id: runId,\n mode: built.mode,\n matchCount: matches.length,\n topMatchScore: matches[0]?.score ?? null,\n nodeCatalog: syncResult ? 'synced' : 'static',\n nodeCount: syncResult?.nodeCount ?? null,\n ...(syncResult ? {} : {\n syncWarning: hasN8nCreds\n ? 'Could not sync node types from your n8n instance. Using static fallback catalog — generated workflows may not match your exact n8n setup.'\n : 'N8N_BASE_URL and N8N_API_KEY are not set. Using static fallback catalog — node types may not match your n8n instance. Set these env vars to enable accurate generation and deployment.',\n }),\n systemPrompt: systemText,\n userMessage: built.userMessage,\n outputFormat: {\n description: 'Generate a JSON object with this exact structure. The workflow field contains the n8n workflow. credentialsNeeded lists services requiring credentials.',\n schema: {\n workflow: {\n name: 'string — descriptive workflow name',\n nodes: 'array — n8n node objects with id (UUID v4), type, typeVersion, name, position, parameters',\n connections: 'object — keyed by source node NAME, maps to target nodes',\n settings: 'object — include executionOrder: \"v1\"',\n },\n credentialsNeeded: [{\n service: 'string — e.g. \"Slack\"',\n credentialType: 'string — e.g. \"slackOAuth2Api\"',\n description: 'string — what the user needs to set up',\n }],\n },\n },\n }, null, 2))\n },\n)\n\nserver.tool(\n 'kairos_validate',\n 'Validate n8n workflow JSON against 34 structural rules. Returns pass/fail with specific issues. If validation fails, fix the issues and call this again. Errors block deployment; warnings are advisory.',\n {\n workflow: z.string().describe('The workflow JSON string to validate'),\n kairos_run_id: z.string().optional().describe('Run ID from kairos_prompt — enables telemetry correlation'),\n },\n async ({ workflow: workflowStr, kairos_run_id }) => {\n let parsed: N8nWorkflow\n try {\n parsed = JSON.parse(workflowStr) as N8nWorkflow\n } catch (e) {\n return mcpText(JSON.stringify({ valid: false, error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` }, null, 2))\n }\n\n const result = getValidator().validate(parsed)\n const errors = result.issues.filter(i => i.severity === 'error')\n const warnings = result.issues.filter(i => i.severity === 'warn')\n\n if (mcpTelemetry && kairos_run_id) {\n const session = mcpSessions.get(kairos_run_id)\n if (session) {\n session.validateAttempts++\n await mcpTelemetry.emit('generation_attempt', {\n description: session.description,\n attempt: session.validateAttempts,\n temperature: 0,\n durationMs: 0,\n tokensInput: 0,\n tokensOutput: 0,\n validationPassed: result.valid,\n issueCount: result.issues.length,\n issues: result.issues.map(i => ({ rule: i.rule, severity: i.severity, message: i.message, nodeId: i.nodeId ?? null })),\n workflowType: session.workflowType,\n }, kairos_run_id)\n }\n }\n\n return mcpText(JSON.stringify({\n valid: result.valid,\n errorCount: errors.length,\n warningCount: warnings.length,\n errors: errors.map(i => ({ rule: i.rule, message: i.message, nodeId: i.nodeId ?? null })),\n warnings: warnings.map(i => ({ rule: i.rule, message: i.message, nodeId: i.nodeId ?? null })),\n deployable: errors.length === 0,\n }, null, 2))\n },\n)\n\nserver.tool(\n 'kairos_deploy',\n 'Deploy a validated workflow to n8n. Pass the workflow JSON that passed kairos_validate. Strips server-assigned fields automatically. Requires N8N_BASE_URL and N8N_API_KEY.',\n {\n workflow: z.string().describe('The validated workflow JSON string to deploy'),\n activate: z.boolean().default(false).describe('Activate the workflow immediately after deployment'),\n description: z.string().optional().describe('The original user intent / description for this workflow — used to improve library search quality over time'),\n kairos_run_id: z.string().optional().describe('Run ID from kairos_prompt — enables telemetry correlation'),\n kairos_secret: z.string().optional().describe('Required when KAIROS_MCP_SECRET env var is set'),\n },\n async ({ workflow: workflowStr, activate, description: userDescription, kairos_run_id, kairos_secret }) => {\n const authError = checkMcpAuth(kairos_secret)\n if (authError) return authError\n\n if (!isAllowed('deploy')) {\n return mcpError(JSON.stringify({ error: 'Deploy is disabled. Set KAIROS_MCP_ALLOW_DEPLOY=true to enable.' }))\n }\n\n let parsed: N8nWorkflow\n try {\n parsed = JSON.parse(workflowStr) as N8nWorkflow\n } catch (e) {\n return mcpError(JSON.stringify({ error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` }))\n }\n\n const validation = getValidator().validate(parsed)\n const errors = validation.issues.filter(i => i.severity === 'error')\n if (errors.length > 0) {\n return mcpError(JSON.stringify({\n error: 'Workflow has validation errors — fix them before deploying',\n errors: errors.map(i => ({ rule: i.rule, message: i.message })),\n }, null, 2))\n }\n\n const client = getApiClient()\n const stripped = stripper.stripForCreate(parsed)\n const response = await client.createWorkflow(stripped)\n\n if (activate) {\n if (!isAllowed('activate')) {\n return mcpText(JSON.stringify({\n workflowId: response.id,\n name: response.name,\n activated: false,\n warning: 'Workflow deployed but activation is disabled. Set KAIROS_MCP_ALLOW_ACTIVATE=true to enable.',\n url: `${process.env['N8N_BASE_URL']}/workflow/${response.id}`,\n }, null, 2))\n }\n await client.activateWorkflow(response.id)\n }\n\n const session = kairos_run_id ? mcpSessions.get(kairos_run_id) : undefined\n\n // Warn when kairos_run_id is provided but no matching session exists — telemetry will be skipped\n const missingSessionWarning = (kairos_run_id && !session)\n ? `\\n\\nNote: kairos_run_id \"${kairos_run_id}\" was provided but no active session was found. This usually means kairos_deploy was called without a prior kairos_prompt call, or the session expired. Telemetry and pattern learning for this build were skipped.`\n : ''\n\n // Save to library (n8nWorkflowId enables dedup on future redeployment)\n await library.initialize()\n await library.save(parsed, {\n description: session?.description ?? userDescription ?? parsed.name,\n generationMode: session && session.matchCount > 0 ? 'reference' : 'scratch',\n generationAttempts: session?.validateAttempts ?? 1,\n n8nWorkflowId: response.id,\n })\n\n if (mcpTelemetry && kairos_run_id && session) {\n await mcpTelemetry.emit('build_complete', {\n description: session.description,\n success: true,\n totalAttempts: session.validateAttempts,\n totalDurationMs: Date.now() - session.startTime,\n totalTokensInput: 0,\n totalTokensOutput: 0,\n workflowName: response.name,\n workflowId: response.id,\n dryRun: false,\n credentialsNeeded: 0,\n warnedRules: session.warnedRules,\n workflowType: session.workflowType,\n }, kairos_run_id)\n mcpSessions.delete(kairos_run_id)\n PatternAnalyzer.fromEnv().analyzeAndSave().catch(() => {})\n }\n\n return mcpText(JSON.stringify({\n workflowId: response.id,\n name: response.name,\n activated: activate,\n url: `${process.env['N8N_BASE_URL']}/workflow/${response.id}`,\n }, null, 2) + missingSessionWarning)\n },\n)\n\nserver.tool(\n 'kairos_replace',\n 'Replace an existing n8n workflow with a new version. Validates before updating. Use kairos_prompt → kairos_validate → kairos_replace for iteration on existing workflows.',\n {\n workflow_id: z.string().describe('The n8n workflow ID to replace'),\n workflow: z.string().describe('The validated workflow JSON string'),\n description: z.string().optional().describe('The original user intent / description for this workflow — used to improve library search quality over time'),\n kairos_run_id: z.string().optional().describe('Run ID from kairos_prompt — enables telemetry correlation'),\n kairos_secret: z.string().optional().describe('Required when KAIROS_MCP_SECRET env var is set'),\n },\n async ({ workflow_id, workflow: workflowStr, description: userDescription, kairos_run_id, kairos_secret }) => {\n const authError = checkMcpAuth(kairos_secret)\n if (authError) return authError\n\n if (!isAllowed('deploy')) {\n return mcpError(JSON.stringify({ error: 'Replace is disabled. Set KAIROS_MCP_ALLOW_DEPLOY=true or KAIROS_MCP_MODE=deploy to enable.' }))\n }\n\n let parsed: N8nWorkflow\n try {\n parsed = JSON.parse(workflowStr) as N8nWorkflow\n } catch (e) {\n return mcpError(JSON.stringify({ error: `Invalid JSON: ${e instanceof Error ? e.message : String(e)}` }))\n }\n\n const validation = getValidator().validate(parsed)\n const errors = validation.issues.filter(i => i.severity === 'error')\n if (errors.length > 0) {\n return mcpError(JSON.stringify({\n error: 'Workflow has validation errors — fix them before replacing',\n errors: errors.map(i => ({ rule: i.rule, message: i.message })),\n }, null, 2))\n }\n\n const client = getApiClient()\n const stripped = stripper.stripForUpdate(parsed)\n const response = await client.updateWorkflow(workflow_id, stripped)\n\n const session = kairos_run_id ? mcpSessions.get(kairos_run_id) : undefined\n const missingSessionWarning = (kairos_run_id && !session)\n ? `\\n\\nNote: kairos_run_id \"${kairos_run_id}\" was provided but no active session was found.`\n : ''\n\n // Save to library — D4 dedup updates the existing entry rather than creating a duplicate\n await library.initialize()\n await library.save(parsed, {\n description: session?.description ?? userDescription ?? parsed.name,\n generationMode: session && session.matchCount > 0 ? 'reference' : 'scratch',\n generationAttempts: session?.validateAttempts ?? 1,\n n8nWorkflowId: workflow_id,\n })\n\n if (mcpTelemetry && kairos_run_id && session) {\n await mcpTelemetry.emit('build_complete', {\n description: session.description,\n success: true,\n totalAttempts: session.validateAttempts,\n totalDurationMs: Date.now() - session.startTime,\n totalTokensInput: 0,\n totalTokensOutput: 0,\n workflowName: response.name,\n workflowId: response.id,\n dryRun: false,\n credentialsNeeded: 0,\n warnedRules: session.warnedRules,\n workflowType: session.workflowType,\n }, kairos_run_id)\n mcpSessions.delete(kairos_run_id)\n PatternAnalyzer.fromEnv().analyzeAndSave().catch(() => {})\n }\n\n return mcpText(JSON.stringify({\n workflowId: response.id,\n name: response.name,\n url: `${process.env['N8N_BASE_URL']}/workflow/${response.id}`,\n }, null, 2) + missingSessionWarning)\n },\n)\n\nserver.tool(\n 'kairos_search',\n 'Search the local workflow library for similar past builds. Returns matching workflows with scores, useful for finding examples and reusing patterns.',\n {\n query: z.string().describe('Search query — a workflow description or keywords'),\n limit: z.number().default(5).describe('Maximum number of results'),\n },\n async ({ query, limit }) => {\n await library.initialize()\n const matches = await library.search(query)\n\n return mcpText(JSON.stringify(\n matches.slice(0, limit).map(m => ({\n id: m.workflow.id,\n score: Number(m.score.toFixed(3)),\n mode: m.mode,\n description: m.workflow.description,\n nodeCount: m.workflow.workflow.nodes.length,\n nodes: m.workflow.workflow.nodes.map(n => n.name),\n n8nWorkflowId: m.workflow.n8nWorkflowId ?? null,\n failurePatterns: m.workflow.failurePatterns ?? [],\n })),\n null,\n 2,\n ))\n },\n)\n\nserver.tool(\n 'kairos_sync',\n 'Sync the node catalog from your live n8n instance. Fetches all installed node types and versions so Kairos knows exactly what your n8n supports. Automatically called by kairos_prompt when n8n credentials are set, but you can call this manually to force a refresh.',\n {},\n async () => {\n const baseUrl = process.env['N8N_BASE_URL']\n const apiKey = process.env['N8N_API_KEY']\n if (!baseUrl || !apiKey) {\n return mcpError(JSON.stringify({ error: 'N8N_BASE_URL and N8N_API_KEY are required for sync.' }))\n }\n\n lastSync = null\n const result = await autoSync()\n if (!result) {\n return mcpError(JSON.stringify({ error: 'Failed to fetch node types from n8n. Check your credentials and that your instance is running.' }))\n }\n\n return mcpText(JSON.stringify({\n synced: true,\n nodeCount: result.nodeCount,\n newNodes: result.newNodes,\n message: `Synced ${result.nodeCount} node types from your n8n instance (${result.newNodes} not in default catalog).`,\n }, null, 2))\n },\n)\n\nserver.tool(\n 'kairos_patterns',\n 'Analyze telemetry data and return failure patterns, build stats, and credential breakdowns. Useful for understanding what goes wrong most often and how to prevent it.',\n {\n days: z.number().default(30).describe('Number of days of telemetry to analyze'),\n limit: z.number().optional().describe('Maximum number of failure patterns to return'),\n },\n async ({ days, limit }) => {\n const analyzer = PatternAnalyzer.fromEnv()\n const analysis = await analyzer.analyzeAndSave(days)\n\n if (limit !== undefined && limit > 0) {\n analysis.topFailureRules = analysis.topFailureRules.slice(0, limit)\n }\n\n return mcpText(JSON.stringify(analysis, null, 2))\n },\n)\n\nserver.tool(\n 'kairos_library',\n 'Browse the local Kairos workflow library. Returns saved workflow metadata. Use the optional query to search, or omit it to list all entries.',\n {\n query: z.string().optional().describe('Optional search query — omit to list all entries'),\n limit: z.number().default(20).describe('Maximum entries to return'),\n },\n async ({ query, limit }) => {\n await library.initialize()\n\n if (query) {\n const matches = await library.search(query)\n return mcpText(JSON.stringify(\n matches.slice(0, limit).map(m => ({\n id: m.workflow.id,\n description: m.workflow.description,\n score: Number(m.score.toFixed(3)),\n mode: m.mode,\n nodeCount: m.workflow.workflow.nodes.length,\n nodes: m.workflow.workflow.nodes.map(n => n.name),\n deployCount: m.workflow.deployCount,\n n8nWorkflowId: m.workflow.n8nWorkflowId ?? null,\n createdAt: m.workflow.createdAt,\n })),\n null, 2,\n ))\n }\n\n const all = await library.list()\n return mcpText(JSON.stringify(\n all.slice(0, limit).map(w => ({\n id: w.id,\n description: w.description,\n nodeCount: w.workflow.nodes.length,\n nodes: w.workflow.nodes.map(n => n.name),\n deployCount: w.deployCount,\n n8nWorkflowId: w.n8nWorkflowId ?? null,\n timesRetrieved: w.timesRetrieved ?? 0,\n createdAt: w.createdAt,\n })),\n null, 2,\n ))\n },\n)\n\nserver.tool(\n 'kairos_outcome',\n 'Record the outcome of a workflow build against a library entry. Trains the pattern learning system to know what works and what fails over time.',\n {\n library_id: z.string().describe('The Kairos library entry ID (returned by kairos_deploy, kairos_replace, or kairos_library)'),\n attempts: z.number().describe('Number of generation+validation attempts before success'),\n first_try_pass: z.boolean().describe('Whether the first attempt passed validation'),\n failed_rules: z.array(z.number()).describe('Validation rule IDs that failed during generation'),\n mode: z.enum(['direct', 'reference']).describe('How the library entry was used during generation'),\n },\n async ({ library_id, attempts, first_try_pass, failed_rules, mode }) => {\n await library.initialize()\n await library.recordOutcome(library_id, {\n attempts,\n firstTryPass: first_try_pass,\n failedRules: failed_rules,\n mode,\n })\n return mcpText(JSON.stringify({ recorded: true, libraryId: library_id }))\n },\n)\n\n// ── n8n management tools (need N8N_BASE_URL + N8N_API_KEY) ─────────────────\n\nserver.tool(\n 'kairos_list',\n 'List all workflows deployed on the connected n8n instance.',\n {},\n async () => {\n const client = getApiClient()\n const workflows = await client.listWorkflows()\n\n return mcpText(JSON.stringify(workflows, null, 2))\n },\n)\n\nserver.tool(\n 'kairos_get',\n 'Get the full JSON definition of a specific workflow by ID.',\n {\n workflow_id: z.string().describe('The n8n workflow ID'),\n },\n async ({ workflow_id }) => {\n const client = getApiClient()\n const workflow = await client.getWorkflow(workflow_id)\n\n return mcpText(JSON.stringify(workflow, null, 2))\n },\n)\n\nserver.tool(\n 'kairos_activate',\n 'Activate a deployed workflow so it starts running on triggers.',\n {\n workflow_id: z.string().describe('The n8n workflow ID to activate'),\n },\n async ({ workflow_id }) => {\n if (!isAllowed('activate')) {\n return mcpError(JSON.stringify({ error: 'Activate is disabled. Set KAIROS_MCP_ALLOW_ACTIVATE=true to enable.' }))\n }\n\n const client = getApiClient()\n await client.activateWorkflow(workflow_id)\n\n return mcpText(`Activated workflow ${workflow_id}`)\n },\n)\n\nserver.tool(\n 'kairos_deactivate',\n 'Deactivate a running workflow.',\n {\n workflow_id: z.string().describe('The n8n workflow ID to deactivate'),\n },\n async ({ workflow_id }) => {\n const client = getApiClient()\n await client.deactivateWorkflow(workflow_id)\n\n return mcpText(`Deactivated workflow ${workflow_id}`)\n },\n)\n\nserver.tool(\n 'kairos_delete',\n 'Delete a workflow from n8n. This is irreversible.',\n {\n workflow_id: z.string().describe('The n8n workflow ID to delete'),\n kairos_secret: z.string().optional().describe('Required when KAIROS_MCP_SECRET env var is set'),\n },\n async ({ workflow_id, kairos_secret }) => {\n const authError = checkMcpAuth(kairos_secret)\n if (authError) return authError\n\n if (!isAllowed('delete')) {\n return mcpError(JSON.stringify({ error: 'Delete is disabled. Set KAIROS_MCP_ALLOW_DELETE=true to enable.' }))\n }\n\n const client = getApiClient()\n await client.deleteWorkflow(workflow_id)\n\n return mcpText(`Deleted workflow ${workflow_id}`)\n },\n)\n\nserver.tool(\n 'kairos_executions',\n 'List recent executions for a workflow, showing status and timing.',\n {\n workflow_id: z.string().optional().describe('Filter to a specific workflow ID (omit for all)'),\n limit: z.number().default(20).describe('Maximum number of executions to return'),\n },\n async ({ workflow_id, limit }) => {\n const client = getApiClient()\n const executions = await client.getExecutions(workflow_id, { limit })\n\n return mcpText(JSON.stringify(executions, null, 2))\n },\n)\n\nasync function main() {\n if (!process.env['ANTHROPIC_API_KEY']) {\n process.stderr.write(\n '[kairos-mcp] WARNING: ANTHROPIC_API_KEY is not set — kairos_prompt will fail. Set it before using workflow generation tools.\\n',\n )\n }\n\n const useHttp = process.argv.includes('--http')\n\n if (useHttp) {\n const port = parseInt(process.env['KAIROS_MCP_PORT'] ?? '3000', 10)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const transport = new StreamableHTTPServerTransport() as any\n await server.connect(transport)\n\n const httpServer = createServer(async (req, res) => {\n if (req.method === 'GET' || req.method === 'POST' || req.method === 'DELETE') {\n await transport.handleRequest(req, res)\n } else {\n res.writeHead(405, { 'Content-Type': 'application/json' })\n res.end(JSON.stringify({ error: 'Method not allowed' }))\n }\n })\n\n httpServer.listen(port, () => {\n process.stderr.write(`[kairos-mcp] HTTP transport listening on port ${port}\\n`)\n })\n } else {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n }\n}\n\nmain().catch((err: unknown) => {\n console.error('Kairos MCP server failed to start:', err)\n process.exit(1)\n})\n","import type { N8nNodeTypeInfo } from '../providers/n8n/types.js'\nimport type { NodeDefinition } from './registry.js'\nimport { NodeRegistry, DEFAULT_REGISTRY } from './registry.js'\n\nconst TRIGGER_PATTERNS = [/trigger/i, /Trigger$/]\n\nexport interface SyncResult {\n registry: NodeRegistry\n catalogText: string\n nodeCount: number\n newNodes: number\n}\n\nexport class NodeSyncer {\n private readonly baseRegistry: Map<string, NodeDefinition>\n\n constructor() {\n this.baseRegistry = new Map(DEFAULT_REGISTRY.map(d => [d.type, d]))\n }\n\n sync(liveNodes: N8nNodeTypeInfo[]): SyncResult {\n const merged = new Map(this.baseRegistry)\n let newNodes = 0\n\n for (const node of liveNodes) {\n const versions = Array.isArray(node.version) ? node.version : [node.version]\n const isTrigger = TRIGGER_PATTERNS.some(p => p.test(node.name))\n const credentialType = node.credentials?.[0]?.name\n\n const existing = merged.get(node.name)\n if (existing) {\n const allVersions = new Set([...existing.safeTypeVersions, ...versions])\n merged.set(node.name, {\n ...existing,\n safeTypeVersions: [...allVersions].sort((a, b) => a - b),\n })\n } else {\n newNodes++\n merged.set(node.name, {\n type: node.name,\n safeTypeVersions: versions.sort((a, b) => a - b),\n requiredParams: [],\n ...(credentialType ? { credentialType } : {}),\n ...(isTrigger ? { isTrigger: true } : {}),\n })\n }\n }\n\n const definitions = [...merged.values()]\n const registry = new NodeRegistry(definitions)\n const catalogText = this.buildCatalog(definitions)\n\n return { registry, catalogText, nodeCount: definitions.length, newNodes }\n }\n\n private buildCatalog(definitions: NodeDefinition[]): string {\n const triggers = definitions.filter(d => d.isTrigger)\n const regular = definitions.filter(d => !d.isTrigger)\n\n const formatEntry = (d: NodeDefinition): string => {\n const versions = d.safeTypeVersions.join(', ')\n const cred = d.credentialType ? ` — cred: ${d.credentialType}` : ''\n return `${d.type} typeVersion: ${versions}${cred}`\n }\n\n const triggerLines = triggers.map(formatEntry).join('\\n')\n const regularLines = regular.map(formatEntry).join('\\n')\n\n return `## NODE CATALOG — synced from your n8n instance (${definitions.length} node types)\n\n### Triggers:\n${triggerLines}\n\n### Regular nodes:\n${regularLines}`\n }\n}\n","import { readFile, writeFile, mkdir } from 'node:fs/promises'\nimport { dirname } from 'node:path'\nimport type { SyncResult } from '../validation/node-syncer.js'\n\nconst CACHE_TTL_MS = 24 * 60 * 60 * 1000 // 24 hours\n\ninterface CachedCatalog {\n cachedAt: number\n syncResult: SyncResult\n}\n\nexport async function readCatalogCache(cachePath: string): Promise<SyncResult | null> {\n try {\n const raw = await readFile(cachePath, 'utf-8')\n const cached = JSON.parse(raw) as CachedCatalog\n if (Date.now() - cached.cachedAt > CACHE_TTL_MS) return null\n return cached.syncResult\n } catch {\n return null\n }\n}\n\nexport async function writeCatalogCache(cachePath: string, syncResult: SyncResult): Promise<void> {\n try {\n await mkdir(dirname(cachePath), { recursive: true })\n const payload: CachedCatalog = { cachedAt: Date.now(), syncResult }\n await writeFile(cachePath, JSON.stringify(payload), 'utf-8')\n } catch {\n // Cache write failure is non-fatal — next startup will just re-fetch\n }\n}\n\nexport function isCacheExpired(cachedAt: number, ttlMs = CACHE_TTL_MS): boolean {\n return Date.now() - cachedAt > ttlMs\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,qCAAqC;AAC9C,SAAS,oB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IACF;AAAA,EACF;AAEA,QAAM,UAAU,QAAQ,KAAK,SAAS,QAAQ;AAE9C,MAAI,SAAS;AACX,UAAM,OAAO,SAAS,QAAQ,IAAI,iBAAiB,KAAK,QAAQ,EAAE;AAElE,UAAM,YAAY,IAAI,8BAA8B;AACpD,UAAM,OAAO,QAAQ,SAAS;AAE9B,UAAM,aAAa,aAAa,OAAO,KAAK,QAAQ;AAClD,UAAI,IAAI,WAAW,SAAS,IAAI,WAAW,UAAU,IAAI,WAAW,UAAU;AAC5E,cAAM,UAAU,cAAc,KAAK,GAAG;AAAA,MACxC,OAAO;AACL,YAAI,UAAU,KAAK,EAAE,gBAAgB,mBAAmB,CAAC;AACzD,YAAI,IAAI,KAAK,UAAU,EAAE,OAAO,qBAAqB,CAAC,CAAC;AAAA,MACzD;AAAA,IACF,CAAC;AAED,eAAW,OAAO,MAAM,MAAM;AAC5B,cAAQ,OAAO,MAAM,iDAAiD,IAAI;AAAA,CAAI;AAAA,IAChF,CAAC;AAAA,EACH,OAAO;AACL,UAAM,YAAY,IAAI,qBAAqB;AAC3C,UAAM,OAAO,QAAQ,SAAS;AAAA,EAChC;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,QAAiB;AAC7B,UAAQ,MAAM,sCAAsC,GAAG;AACvD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["dirname","dirname"]}
|
|
@@ -64,6 +64,14 @@ interface CredentialRequirement {
|
|
|
64
64
|
credentialType: string;
|
|
65
65
|
description: string;
|
|
66
66
|
}
|
|
67
|
+
type SmokeTestStatus = 'passed' | 'failed' | 'error' | 'skipped' | 'not-applicable';
|
|
68
|
+
interface SmokeTestResult {
|
|
69
|
+
status: SmokeTestStatus;
|
|
70
|
+
triggerType: 'manual' | 'webhook' | 'not-applicable';
|
|
71
|
+
executionId?: string;
|
|
72
|
+
durationMs?: number;
|
|
73
|
+
error?: string;
|
|
74
|
+
}
|
|
67
75
|
interface BuildResult {
|
|
68
76
|
workflowId: string | null;
|
|
69
77
|
name: string;
|
|
@@ -72,6 +80,7 @@ interface BuildResult {
|
|
|
72
80
|
activationRequired: boolean;
|
|
73
81
|
generationAttempts: number;
|
|
74
82
|
dryRun: boolean;
|
|
83
|
+
smokeTest?: SmokeTestResult;
|
|
75
84
|
}
|
|
76
85
|
interface DeployResult {
|
|
77
86
|
workflowId: string;
|
|
@@ -133,6 +142,7 @@ interface WorkflowMetadataInput {
|
|
|
133
142
|
sourceId?: string;
|
|
134
143
|
sourceUrl?: string;
|
|
135
144
|
trustLevel?: TrustLevel;
|
|
145
|
+
n8nWorkflowId?: string;
|
|
136
146
|
}
|
|
137
147
|
interface OutcomeData {
|
|
138
148
|
attempts: number;
|
|
@@ -169,6 +179,7 @@ interface StoredWorkflow {
|
|
|
169
179
|
timesUsedAsDirect?: number;
|
|
170
180
|
timesUsedAsReference?: number;
|
|
171
181
|
outcomeStats?: OutcomeStats;
|
|
182
|
+
n8nWorkflowId?: string;
|
|
172
183
|
}
|
|
173
184
|
interface WorkflowMatch {
|
|
174
185
|
workflow: StoredWorkflow;
|
|
@@ -187,7 +198,7 @@ interface IWorkflowLibrary {
|
|
|
187
198
|
initialize(): Promise<void>;
|
|
188
199
|
search(description: string, options?: SearchOptions): Promise<WorkflowMatch[]>;
|
|
189
200
|
save(workflow: N8nWorkflow, metadata: WorkflowMetadataInput): Promise<string>;
|
|
190
|
-
recordDeployment(id: string): Promise<void>;
|
|
201
|
+
recordDeployment(id: string, n8nWorkflowId?: string): Promise<void>;
|
|
191
202
|
recordOutcome(id: string, outcome: OutcomeData): Promise<void>;
|
|
192
203
|
get(id: string): Promise<StoredWorkflow | null>;
|
|
193
204
|
list(filters?: LibraryFilters): Promise<StoredWorkflow[]>;
|
|
@@ -206,6 +217,7 @@ interface BuildOptions {
|
|
|
206
217
|
dryRun?: boolean;
|
|
207
218
|
activate?: boolean;
|
|
208
219
|
name?: string;
|
|
220
|
+
smokeTest?: boolean;
|
|
209
221
|
}
|
|
210
222
|
interface DeleteOptions {
|
|
211
223
|
confirm: true;
|
|
@@ -284,6 +296,8 @@ declare class N8nApiClient {
|
|
|
284
296
|
tagWorkflow(workflowId: string, tagIds: string[]): Promise<void>;
|
|
285
297
|
untagWorkflow(workflowId: string, tagIds: string[]): Promise<void>;
|
|
286
298
|
getNodeTypes(): Promise<N8nNodeTypeInfo[]>;
|
|
299
|
+
triggerManual(workflowId: string): Promise<string>;
|
|
300
|
+
triggerWebhookTest(path: string): Promise<number>;
|
|
287
301
|
private mapExecution;
|
|
288
302
|
}
|
|
289
303
|
|
|
@@ -311,6 +325,9 @@ declare class N8nProvider implements IProvider {
|
|
|
311
325
|
createTag(name: string): Promise<Tag>;
|
|
312
326
|
tag(workflowId: string, tagIds: string[]): Promise<void>;
|
|
313
327
|
untag(workflowId: string, tagIds: string[]): Promise<void>;
|
|
328
|
+
smokeTest(workflowId: string, workflow: N8nWorkflow): Promise<SmokeTestResult>;
|
|
329
|
+
private detectTrigger;
|
|
330
|
+
private pollExecution;
|
|
314
331
|
}
|
|
315
332
|
|
|
316
333
|
declare class NullLibrary implements IWorkflowLibrary {
|
|
@@ -335,6 +352,7 @@ declare class FileLibrary implements IWorkflowLibrary {
|
|
|
335
352
|
private workflowFilePath;
|
|
336
353
|
initialize(): Promise<void>;
|
|
337
354
|
private doInitialize;
|
|
355
|
+
private scanForOrphansAndCleanup;
|
|
338
356
|
/**
|
|
339
357
|
* One-time transparent migration from v0.4.x monolithic index.json.
|
|
340
358
|
* Splits each stored workflow into a per-file workflow JSON and a lightweight
|
|
@@ -351,12 +369,14 @@ declare class FileLibrary implements IWorkflowLibrary {
|
|
|
351
369
|
private makeSearchShell;
|
|
352
370
|
search(description: string, options?: SearchOptions): Promise<WorkflowMatch[]>;
|
|
353
371
|
save(workflow: N8nWorkflow, metadata: WorkflowMetadataInput): Promise<string>;
|
|
354
|
-
recordDeployment(id: string): Promise<void>;
|
|
372
|
+
recordDeployment(id: string, n8nWorkflowId?: string): Promise<void>;
|
|
355
373
|
recordOutcome(id: string, outcome: OutcomeData): Promise<void>;
|
|
356
374
|
drain(): Promise<void>;
|
|
357
375
|
get(id: string): Promise<StoredWorkflow | null>;
|
|
358
376
|
list(filters?: LibraryFilters): Promise<StoredWorkflow[]>;
|
|
359
377
|
private deduplicateFailurePatterns;
|
|
378
|
+
private get lockPath();
|
|
379
|
+
private acquireLock;
|
|
360
380
|
/**
|
|
361
381
|
* Direct write used only during migration (before writeQueue is needed).
|
|
362
382
|
*/
|
|
@@ -424,6 +444,7 @@ declare class NodeRegistry {
|
|
|
424
444
|
isTrigger(type: string): boolean;
|
|
425
445
|
isKnown(type: string): boolean;
|
|
426
446
|
isVersionSafe(type: string, version: number): boolean;
|
|
447
|
+
isVersionNewer(type: string, version: number): boolean;
|
|
427
448
|
getRequiredParams(type: string): string[];
|
|
428
449
|
}
|
|
429
450
|
|
|
@@ -454,13 +475,21 @@ declare class N8nValidator {
|
|
|
454
475
|
private checkRule18;
|
|
455
476
|
private checkRule19;
|
|
456
477
|
private checkRule20;
|
|
478
|
+
private checkRule21;
|
|
457
479
|
private checkRule22;
|
|
458
480
|
private checkRule23;
|
|
459
481
|
private checkRule24;
|
|
460
482
|
private checkRule25;
|
|
461
483
|
private checkRule26;
|
|
462
484
|
private extractExpressions;
|
|
463
|
-
private
|
|
485
|
+
private checkRule27;
|
|
486
|
+
private checkRule28;
|
|
487
|
+
private checkRule29;
|
|
488
|
+
private checkRule30;
|
|
489
|
+
private checkRule31;
|
|
490
|
+
private checkRule32;
|
|
491
|
+
private checkRule33;
|
|
492
|
+
private checkRule34;
|
|
464
493
|
}
|
|
465
494
|
|
|
466
495
|
declare class KairosError extends Error {
|
|
@@ -534,6 +563,7 @@ declare class TemplateSyncer {
|
|
|
534
563
|
private readonly logger;
|
|
535
564
|
constructor(library: IWorkflowLibrary, logger: ILogger);
|
|
536
565
|
sync(options?: SyncOptions): Promise<SyncProgress>;
|
|
566
|
+
private fetchWithBackoff;
|
|
537
567
|
private fetchTemplateIds;
|
|
538
568
|
private processTemplate;
|
|
539
569
|
private cleanDescription;
|
|
@@ -563,4 +593,4 @@ declare class TelemetryReader {
|
|
|
563
593
|
private readRecentEvents;
|
|
564
594
|
}
|
|
565
595
|
|
|
566
|
-
export {
|
|
596
|
+
export { buildSearchCorpus as $, ApiError as A, type BuildOptions as B, type ClientOptions as C, type DeleteOptions as D, type ExecutionFilter as E, type FailurePattern as F, GenerationError as G, TelemetryCollector as H, type ILogger as I, type TelemetryEvent as J, KairosError as K, TelemetryReader as L, TemplateSyncer as M, type N8nWorkflow as N, type OutcomeData as O, ProviderError as P, type TrustLevel as Q, ResponseParseError as R, type ScoredEntry as S, type Tag as T, type ValidationIssue as U, ValidationError as V, type WorkflowListItem as W, type ValidationResult as X, type WorkflowCluster as Y, type WorkflowMatch as Z, type WorkflowMetadataInput as _, type BuildResult as a, clusterWorkflows as a0, hybridScore as a1, nullLogger as a2, rerank as a3, tokenize as a4, type SmokeTestStatus as a5, type ExecutionSummary as b, type ExecutionDetail as c, type AttemptMetadata as d, type CredentialRequirement as e, DEFAULT_REGISTRY as f, type DeployResult as g, FileLibrary as h, GuardError as i, type IProvider as j, type IWorkflowLibrary as k, N8nApiClient as l, type N8nConnections as m, N8nFieldStripper as n, type N8nNode as o, N8nProvider as p, type N8nSettings as q, N8nValidator as r, NodeRegistry as s, NullLibrary as t, type OutcomeStats as u, type RuleFailureRate as v, type SmokeTestResult as w, type SourceKind as x, type StoredWorkflow as y, type SyncProgress as z };
|
|
@@ -64,6 +64,14 @@ interface CredentialRequirement {
|
|
|
64
64
|
credentialType: string;
|
|
65
65
|
description: string;
|
|
66
66
|
}
|
|
67
|
+
type SmokeTestStatus = 'passed' | 'failed' | 'error' | 'skipped' | 'not-applicable';
|
|
68
|
+
interface SmokeTestResult {
|
|
69
|
+
status: SmokeTestStatus;
|
|
70
|
+
triggerType: 'manual' | 'webhook' | 'not-applicable';
|
|
71
|
+
executionId?: string;
|
|
72
|
+
durationMs?: number;
|
|
73
|
+
error?: string;
|
|
74
|
+
}
|
|
67
75
|
interface BuildResult {
|
|
68
76
|
workflowId: string | null;
|
|
69
77
|
name: string;
|
|
@@ -72,6 +80,7 @@ interface BuildResult {
|
|
|
72
80
|
activationRequired: boolean;
|
|
73
81
|
generationAttempts: number;
|
|
74
82
|
dryRun: boolean;
|
|
83
|
+
smokeTest?: SmokeTestResult;
|
|
75
84
|
}
|
|
76
85
|
interface DeployResult {
|
|
77
86
|
workflowId: string;
|
|
@@ -133,6 +142,7 @@ interface WorkflowMetadataInput {
|
|
|
133
142
|
sourceId?: string;
|
|
134
143
|
sourceUrl?: string;
|
|
135
144
|
trustLevel?: TrustLevel;
|
|
145
|
+
n8nWorkflowId?: string;
|
|
136
146
|
}
|
|
137
147
|
interface OutcomeData {
|
|
138
148
|
attempts: number;
|
|
@@ -169,6 +179,7 @@ interface StoredWorkflow {
|
|
|
169
179
|
timesUsedAsDirect?: number;
|
|
170
180
|
timesUsedAsReference?: number;
|
|
171
181
|
outcomeStats?: OutcomeStats;
|
|
182
|
+
n8nWorkflowId?: string;
|
|
172
183
|
}
|
|
173
184
|
interface WorkflowMatch {
|
|
174
185
|
workflow: StoredWorkflow;
|
|
@@ -187,7 +198,7 @@ interface IWorkflowLibrary {
|
|
|
187
198
|
initialize(): Promise<void>;
|
|
188
199
|
search(description: string, options?: SearchOptions): Promise<WorkflowMatch[]>;
|
|
189
200
|
save(workflow: N8nWorkflow, metadata: WorkflowMetadataInput): Promise<string>;
|
|
190
|
-
recordDeployment(id: string): Promise<void>;
|
|
201
|
+
recordDeployment(id: string, n8nWorkflowId?: string): Promise<void>;
|
|
191
202
|
recordOutcome(id: string, outcome: OutcomeData): Promise<void>;
|
|
192
203
|
get(id: string): Promise<StoredWorkflow | null>;
|
|
193
204
|
list(filters?: LibraryFilters): Promise<StoredWorkflow[]>;
|
|
@@ -206,6 +217,7 @@ interface BuildOptions {
|
|
|
206
217
|
dryRun?: boolean;
|
|
207
218
|
activate?: boolean;
|
|
208
219
|
name?: string;
|
|
220
|
+
smokeTest?: boolean;
|
|
209
221
|
}
|
|
210
222
|
interface DeleteOptions {
|
|
211
223
|
confirm: true;
|
|
@@ -284,6 +296,8 @@ declare class N8nApiClient {
|
|
|
284
296
|
tagWorkflow(workflowId: string, tagIds: string[]): Promise<void>;
|
|
285
297
|
untagWorkflow(workflowId: string, tagIds: string[]): Promise<void>;
|
|
286
298
|
getNodeTypes(): Promise<N8nNodeTypeInfo[]>;
|
|
299
|
+
triggerManual(workflowId: string): Promise<string>;
|
|
300
|
+
triggerWebhookTest(path: string): Promise<number>;
|
|
287
301
|
private mapExecution;
|
|
288
302
|
}
|
|
289
303
|
|
|
@@ -311,6 +325,9 @@ declare class N8nProvider implements IProvider {
|
|
|
311
325
|
createTag(name: string): Promise<Tag>;
|
|
312
326
|
tag(workflowId: string, tagIds: string[]): Promise<void>;
|
|
313
327
|
untag(workflowId: string, tagIds: string[]): Promise<void>;
|
|
328
|
+
smokeTest(workflowId: string, workflow: N8nWorkflow): Promise<SmokeTestResult>;
|
|
329
|
+
private detectTrigger;
|
|
330
|
+
private pollExecution;
|
|
314
331
|
}
|
|
315
332
|
|
|
316
333
|
declare class NullLibrary implements IWorkflowLibrary {
|
|
@@ -335,6 +352,7 @@ declare class FileLibrary implements IWorkflowLibrary {
|
|
|
335
352
|
private workflowFilePath;
|
|
336
353
|
initialize(): Promise<void>;
|
|
337
354
|
private doInitialize;
|
|
355
|
+
private scanForOrphansAndCleanup;
|
|
338
356
|
/**
|
|
339
357
|
* One-time transparent migration from v0.4.x monolithic index.json.
|
|
340
358
|
* Splits each stored workflow into a per-file workflow JSON and a lightweight
|
|
@@ -351,12 +369,14 @@ declare class FileLibrary implements IWorkflowLibrary {
|
|
|
351
369
|
private makeSearchShell;
|
|
352
370
|
search(description: string, options?: SearchOptions): Promise<WorkflowMatch[]>;
|
|
353
371
|
save(workflow: N8nWorkflow, metadata: WorkflowMetadataInput): Promise<string>;
|
|
354
|
-
recordDeployment(id: string): Promise<void>;
|
|
372
|
+
recordDeployment(id: string, n8nWorkflowId?: string): Promise<void>;
|
|
355
373
|
recordOutcome(id: string, outcome: OutcomeData): Promise<void>;
|
|
356
374
|
drain(): Promise<void>;
|
|
357
375
|
get(id: string): Promise<StoredWorkflow | null>;
|
|
358
376
|
list(filters?: LibraryFilters): Promise<StoredWorkflow[]>;
|
|
359
377
|
private deduplicateFailurePatterns;
|
|
378
|
+
private get lockPath();
|
|
379
|
+
private acquireLock;
|
|
360
380
|
/**
|
|
361
381
|
* Direct write used only during migration (before writeQueue is needed).
|
|
362
382
|
*/
|
|
@@ -424,6 +444,7 @@ declare class NodeRegistry {
|
|
|
424
444
|
isTrigger(type: string): boolean;
|
|
425
445
|
isKnown(type: string): boolean;
|
|
426
446
|
isVersionSafe(type: string, version: number): boolean;
|
|
447
|
+
isVersionNewer(type: string, version: number): boolean;
|
|
427
448
|
getRequiredParams(type: string): string[];
|
|
428
449
|
}
|
|
429
450
|
|
|
@@ -454,13 +475,21 @@ declare class N8nValidator {
|
|
|
454
475
|
private checkRule18;
|
|
455
476
|
private checkRule19;
|
|
456
477
|
private checkRule20;
|
|
478
|
+
private checkRule21;
|
|
457
479
|
private checkRule22;
|
|
458
480
|
private checkRule23;
|
|
459
481
|
private checkRule24;
|
|
460
482
|
private checkRule25;
|
|
461
483
|
private checkRule26;
|
|
462
484
|
private extractExpressions;
|
|
463
|
-
private
|
|
485
|
+
private checkRule27;
|
|
486
|
+
private checkRule28;
|
|
487
|
+
private checkRule29;
|
|
488
|
+
private checkRule30;
|
|
489
|
+
private checkRule31;
|
|
490
|
+
private checkRule32;
|
|
491
|
+
private checkRule33;
|
|
492
|
+
private checkRule34;
|
|
464
493
|
}
|
|
465
494
|
|
|
466
495
|
declare class KairosError extends Error {
|
|
@@ -534,6 +563,7 @@ declare class TemplateSyncer {
|
|
|
534
563
|
private readonly logger;
|
|
535
564
|
constructor(library: IWorkflowLibrary, logger: ILogger);
|
|
536
565
|
sync(options?: SyncOptions): Promise<SyncProgress>;
|
|
566
|
+
private fetchWithBackoff;
|
|
537
567
|
private fetchTemplateIds;
|
|
538
568
|
private processTemplate;
|
|
539
569
|
private cleanDescription;
|
|
@@ -563,4 +593,4 @@ declare class TelemetryReader {
|
|
|
563
593
|
private readRecentEvents;
|
|
564
594
|
}
|
|
565
595
|
|
|
566
|
-
export {
|
|
596
|
+
export { buildSearchCorpus as $, ApiError as A, type BuildOptions as B, type ClientOptions as C, type DeleteOptions as D, type ExecutionFilter as E, type FailurePattern as F, GenerationError as G, TelemetryCollector as H, type ILogger as I, type TelemetryEvent as J, KairosError as K, TelemetryReader as L, TemplateSyncer as M, type N8nWorkflow as N, type OutcomeData as O, ProviderError as P, type TrustLevel as Q, ResponseParseError as R, type ScoredEntry as S, type Tag as T, type ValidationIssue as U, ValidationError as V, type WorkflowListItem as W, type ValidationResult as X, type WorkflowCluster as Y, type WorkflowMatch as Z, type WorkflowMetadataInput as _, type BuildResult as a, clusterWorkflows as a0, hybridScore as a1, nullLogger as a2, rerank as a3, tokenize as a4, type SmokeTestStatus as a5, type ExecutionSummary as b, type ExecutionDetail as c, type AttemptMetadata as d, type CredentialRequirement as e, DEFAULT_REGISTRY as f, type DeployResult as g, FileLibrary as h, GuardError as i, type IProvider as j, type IWorkflowLibrary as k, N8nApiClient as l, type N8nConnections as m, N8nFieldStripper as n, type N8nNode as o, N8nProvider as p, type N8nSettings as q, N8nValidator as r, NodeRegistry as s, NullLibrary as t, type OutcomeStats as u, type RuleFailureRate as v, type SmokeTestResult as w, type SourceKind as x, type StoredWorkflow as y, type SyncProgress as z };
|