/** * TypeScript Parser * * Parses TypeScript workflow files using ts-morph * Extracts metadata from decorators and class structure */ import { WorkflowAST } from '../types.js'; /** * Parse TypeScript workflow file */ export declare class TypeScriptParser { private project; /** * Regular expression pattern for valid TypeScript identifiers. * Uses Unicode property escapes for full Unicode letter coverage (requires `u` flag). * Matches: ASCII word chars (\w = letters, digits, underscore) plus any Unicode letter * (\p{Letter}), covering CJK, Hangul, Kana, Cyrillic, Arabic, Devanagari, etc. * Kept in sync with the `\p{Letter}` usage in naming.ts so every identifier that * naming.ts can produce is also parseable by the TypeScript parser. */ private static readonly IDENTIFIER_PATTERN; /** Pre-compiled patterns reusing IDENTIFIER_PATTERN (avoid rebuilding per-call). */ private static readonly USES_PATTERN; private static readonly OUTPUT_REF_PATTERN; private static readonly ERROR_CONN_PATTERN; private static readonly NORMAL_CONN_PATTERN; constructor(); /** * Parse TypeScript file */ parseFile(filePath: string): Promise; /** * Parse TypeScript code string */ parseCode(code: string): Promise; /** * Parse source file to AST */ private parseSourceFile; /** * Find class decorated with @workflow */ private findWorkflowClass; /** * Extract workflow metadata from @workflow decorator */ private extractWorkflowMetadata; /** * Extract nodes from class properties with @node decorator */ private extractNodes; /** * Extract connections from @links method */ private extractConnections; /** * Extract AI dependencies from .uses() calls in @links method * * Example: * this.AgentIa.uses({ * ai_languageModel: this.OpenaiChatModel.output, * ai_memory: this.Mmoire.output, * ai_tool: [this.Tool1.output, this.Tool2.output] * }); */ private extractAIDependencies; /** * Parse AI dependencies object from .uses() call * * Input: "ai_languageModel: this.Model.output, ai_memory: this.Memory.output" * Output: { ai_languageModel: "Model", ai_memory: "Memory" } */ private parseAIDependencies; /** * Split string by commas, but not inside brackets */ private splitByTopLevelCommas; /** * Parse tool array * * Input: "[this.Tool1.output, this.Tool2.output]" * Output: ["Tool1", "Tool2"] */ private parseToolArray; /** * Parse a connection statement * * Examples: * this.ScheduleTrigger.out(0).to(this.HttpRequest.in(0)); * this.GithubCheck.error().to(this.CreateBranch.in(0)); */ private parseConnectionStatement; /** * Extract a JavaScript value by walking a ts-morph AST node. * * Supported: string/number/boolean literals, null, undefined, plain object * literals, array literals, no-substitution template literals, and * negative number literals. * * For any other expression (function calls, identifiers, template * expressions with substitutions, etc.) a clear error is thrown. * The parser is intentionally static — the workflow file is TypeScript * as a notation, not a runtime. */ private extractValueFromASTNode; } //# sourceMappingURL=typescript-parser.d.ts.map