import type { ParsedWorkflow, ImportDiagnostic, WorkflowRefResolver } from './types.js'; import { type CredentialInstance } from './credentials.js'; export interface ManifestEntry { rpcName: string; n8nType: string; n8nName: string; parameters: Record; credentials?: Record; /** Addon instance name this node's credential binds to, when it has one. */ credentialInstance?: string; isAgentTool: boolean; agentName?: string; } export interface GenerateResult { /** path -> file content */ files: Record; manifest: ManifestEntry[]; /** Encapsulated addon instances (one per distinct n8n credential). */ credentialInstances: CredentialInstance[]; /** * Reasons the workflow could not be imported. When any has `type: 'error'`, * the workflow is skipped — `files` is empty and nothing should be written. */ diagnostics: ImportDiagnostic[]; } export interface GenerateOptions { /** * Resolve a sub-workflow's n8n id → the registered Pikku workflow name, built * from the whole import set. Absent (single-file import) ⇒ only self-recursion * resolves; every cross-workflow reference is reported as missing. */ resolveWorkflowRef?: WorkflowRefResolver; /** * Prefix applied to every generated *stub* rpc name (integration / agent-tool / * code / vector / unmapped-control). Stub functions are locally defined, so * importing several workflows into one project would otherwise collide on a * shared name (a `DUPLICATE_FUNCTION_NAME` critical). Addon rpcs (`graph:*`, * `service:*`), sub-workflow names, and agent names are shared and never * prefixed. No prefix ⇒ names are unchanged (single-file import). */ rpcPrefix?: string; } /** * Generate Pikku source from a parsed n8n workflow. Pure — returns a path→content * map plus the integration manifest. No filesystem access. */ export declare function generateWorkflowFromN8n(parsed: ParsedWorkflow, opts?: GenerateOptions): GenerateResult;