## ADDED Requirements ### Requirement: Programmatic execution The engine SHALL export an `executeWorkflow()` function that accepts a workflow definition, store, and options. #### Scenario: Execute workflow from code - **WHEN** a host application calls `executeWorkflow(workflowDef, store, { userMessage: "..." })` - **THEN** the workflow SHALL execute and return a `WorkflowExecutionResult` ### Requirement: Workflow parsing The engine SHALL export `parseWorkflow(yaml: string): WorkflowDefinition` and `parseWorkflowFile(path: string): WorkflowDefinition` functions. #### Scenario: Parse YAML string - **WHEN** a host application calls `parseWorkflow(yamlString)` - **THEN** it SHALL return a validated `WorkflowDefinition` #### Scenario: Parse YAML file - **WHEN** a host application calls `parseWorkflowFile("./workflows/my-workflow.yaml")` - **THEN** it SHALL read and parse the file, returning a validated `WorkflowDefinition` ### Requirement: Workflow discovery The engine SHALL export `discoverWorkflows(cwd: string): WorkflowLoadResult` for finding workflows in the filesystem. #### Scenario: Discover workflows - **WHEN** a host application calls `discoverWorkflows(cwd)` - **THEN** it SHALL return all discovered workflows from the project's `.archon/workflows/` directory ### Requirement: Store constructors The engine SHALL export store constructors for each backend: `createFsStore(path)`, `createSqliteStore(path)`, `createPostgresStore(connectionString)`. #### Scenario: Create filesystem store - **WHEN** a host application calls `createFsStore("./data")` - **THEN** it SHALL return an initialized `IWorkflowStore` using the filesystem backend #### Scenario: Create SQLite store - **WHEN** a host application calls `createSqliteStore("./ion.db")` - **THEN** it SHALL return an initialized `IWorkflowStore` using SQLite ### Requirement: TypeScript types All public APIs SHALL export full TypeScript type definitions. #### Scenario: Types available - **WHEN** a host application imports from the package - **THEN** `WorkflowDefinition`, `DagNode`, `NodeOutput`, `WorkflowRun`, `WorkflowExecutionResult`, `IWorkflowStore` types SHALL all be exported