buildInitialWorkflowData creates the initial WorkflowData struct with basic fields populated
( result *parser.FrontmatterResult, toolsResult *toolsProcessingResult, engineSetup *engineSetupResult, importsResult *parser.ImportsResult, )
| 17 | |
| 18 | // buildInitialWorkflowData creates the initial WorkflowData struct with basic fields populated |
| 19 | func (c *Compiler) buildInitialWorkflowData( |
| 20 | result *parser.FrontmatterResult, |
| 21 | toolsResult *toolsProcessingResult, |
| 22 | engineSetup *engineSetupResult, |
| 23 | importsResult *parser.ImportsResult, |
| 24 | ) *WorkflowData { |
| 25 | workflowBuilderLog.Print("Building initial workflow data") |
| 26 | |
| 27 | inlinedImports := resolveInlinedImports(result.Frontmatter) |
| 28 | |
| 29 | // When inlined-imports is true, agent file content is already inlined via ImportPaths → step 1b. |
| 30 | // Clear AgentFile/AgentImportSpec so engines don't read it from disk separately at runtime. |
| 31 | agentFile := importsResult.AgentFile |
| 32 | agentImportSpec := importsResult.AgentImportSpec |
| 33 | if inlinedImports { |
| 34 | agentFile = "" |
| 35 | agentImportSpec = "" |
| 36 | } |
| 37 | |
| 38 | workflowData := &WorkflowData{ |
| 39 | Name: toolsResult.workflowName, |
| 40 | FrontmatterName: toolsResult.frontmatterName, |
| 41 | FrontmatterEmoji: toolsResult.frontmatterEmoji, |
| 42 | FrontmatterYAML: strings.Join(result.FrontmatterLines, "\n"), |
| 43 | FrontmatterFieldLines: result.FieldLines, |
| 44 | RawMarkdown: result.Markdown, |
| 45 | Description: c.extractDescription(result.Frontmatter), |
| 46 | Source: c.extractSource(result.Frontmatter), |
| 47 | Redirect: c.extractRedirect(result.Frontmatter), |
| 48 | TrackerID: toolsResult.trackerID, |
| 49 | MaxDailyAICredits: resolveMaxDailyAIC(result.Frontmatter, importsResult.MergedMaxDailyAICredits), |
| 50 | ImportedFiles: importsResult.ImportedFiles, |
| 51 | Skills: extractFrontmatterSkills(toolsResult.parsedFrontmatter, result.Frontmatter), |
| 52 | SkillReferences: extractFrontmatterSkillReferences(toolsResult.parsedFrontmatter, result.Frontmatter), |
| 53 | ImportedMarkdown: toolsResult.importedMarkdown, // Only imports WITH inputs |
| 54 | ImportPaths: toolsResult.importPaths, // Import paths for runtime-import macros (imports without inputs) |
| 55 | PromptImports: toolsResult.promptImports, // Ordered prompt contributions from imports |
| 56 | MainWorkflowMarkdown: toolsResult.mainWorkflowMarkdown, |
| 57 | IncludedFiles: toolsResult.allIncludedFiles, |
| 58 | ImportInputs: importsResult.ImportInputs, |
| 59 | Tools: toolsResult.tools, |
| 60 | LSP: extractLSPConfig(toolsResult.parsedFrontmatter, result.Frontmatter), |
| 61 | ParsedTools: NewTools(toolsResult.tools), |
| 62 | Runtimes: toolsResult.runtimes, |
| 63 | RunInstallScripts: toolsResult.runInstallScripts, |
| 64 | MarkdownContent: toolsResult.markdownContent, |
| 65 | AI: engineSetup.engineSetting, |
| 66 | EngineConfig: engineSetup.engineConfig, |
| 67 | AgentFile: agentFile, |
| 68 | AgentImportSpec: agentImportSpec, |
| 69 | RepositoryImports: importsResult.RepositoryImports, |
| 70 | NetworkPermissions: engineSetup.networkPermissions, |
| 71 | SandboxConfig: applySandboxDefaults(engineSetup.sandboxConfig, engineSetup.engineConfig), |
| 72 | RunnerConfig: extractRunnerConfig(result.Frontmatter), |
| 73 | NeedsTextOutput: toolsResult.needsTextOutput, |
| 74 | ToolsTimeout: toolsResult.toolsTimeout, |
| 75 | ToolsStartupTimeout: toolsResult.toolsStartupTimeout, |
| 76 | TrialMode: c.trialMode, |