4.8 KiB
4.8 KiB
1. Discovery and Dependencies
- 1.1 Confirm React Flow package choice (
@xyflow/react) and add it to the workspace dependencies. - 1.2 Confirm XState, p-queue, Croner, and SQLite package choices with runtime compatibility.
- 1.3 Define shared orchestration TypeScript contracts for workflows, nodes, edges, schedules, runs, events, and artifacts.
- 1.4 Decide whether initial persistence uses the current local runtime JSON store or SQLite immediately behind the repository interface. (Business orchestration now uses SQLite as primary storage when the local
sqlite3CLI is available, with JSON shadow fallback.)
2. Workbench Entry
- 2.1 Reuse the existing
/workflowroute, sidebar item, and App Center card instead of adding a second workflow entry. - 2.2 Audit the current
WorkflowPage,WORKFLOW_PRESETS, and/local-api/workflows/runbehavior. - 2.3 Convert useful old presets into graph templates.
- 2.4 Ensure search and navigation route users into the rebuilt module.
3. Visual Editor
- 3.1 Create the main
BusinessOrchestrationPagecomponent. - 3.2 Add the React Flow canvas with custom TrueGrowth node styling.
- 3.3 Add the node palette with supported node groups.
- 3.4 Support drag-to-create nodes, edge creation, node movement, delete, duplicate, zoom, minimap, and fit view.
- 3.5 Add the right inspector for detailed node configuration.
- 3.6 Add workflow-level settings for name, description, variables, concurrency, retry defaults, and failure behavior.
- 3.7 Add validation UI for cycles, missing required config, incompatible input/output contracts, and unsupported target capabilities.
4. Runtime DAG Engine
- 4.1 Implement graph validation and topological dependency planning.
- 4.2 Implement workflow and node lifecycle state transitions.
- 4.3 Add p-queue based global, provider, and platform concurrency limits.
- 4.4 Add cancellation, retry, timeout, skip, and partial-failure behavior.
- 4.5 Persist workflow run state and node events before and after transitions.
- 4.6 Expose local runtime endpoints for create/update workflow, validate, run, cancel, retry node, list runs, and stream events.
5. Real Node Adapters
- 5.1 Add an intelligence/news node adapter that outputs structured summaries and scripts.
- 5.2 Add an AI image node adapter using existing image/provider routes.
- 5.3 Add an AI video node adapter using existing video/provider routes.
- 5.4 Add a digital-human node adapter that outputs publishable video assets.
- 5.5 Add an intelligent editing node adapter using FunClip, FFmpeg, ASR, and subtitle bridge capabilities.
- 5.6 Add a publish-center node adapter that creates and tracks social publishing campaigns.
- 5.7 Normalize adapter progress, logs, output artifacts, and errors into orchestration events.
6. Scheduled Task Center
- 6.1 Add a scheduler tab/page inside the orchestration module.
- 6.2 Add cron expression, preset, timezone, start/end, overlap, and misfire controls.
- 6.3 Show next-run previews and validation messages.
- 6.4 Implement Croner-backed local scheduler registration and restore on runtime start.
- 6.5 Create immutable workflow runs for scheduled fires.
- 6.6 Add execution history, logs, artifacts, retry, cancel, enable/disable, and run-now actions.
7. Desktop Runtime Isolation
- 7.1 Keep orchestration APIs stable between browser dev and Electron packaged mode.
- 7.2 Move heavy FunClip/FFmpeg/ASR/browser publishing execution into Electron UtilityProcess where packaging requires it.
- 7.3 Add crash detection and recovery events for isolated sidecars.
8. Verification
- 8.1 Validate the OpenSpec change with
openspec validate add-visual-business-orchestration --strictwhen the CLI is available. (pnpm exec openspec validate add-visual-business-orchestration --strictis currently blocked because theopenspeccommand is not installed in this workspace.) - 8.2 Add unit tests for graph validation, topological ordering, cycle rejection, config validation, and scheduler next-run calculation.
- 8.3 Add runtime integration tests for a deterministic DAG with parallel branches, retries, cancellation, and recovery.
- 8.4 Add workbench tests for drag/drop creation, inspector editing, validation messages, save/load, run progress, and schedule creation. (Initial render, node add, schedule controls, schedule visibility, schedule request persistence, and run progress tests are in place.)
- 8.5 Add an end-to-end smoke test for a sample flow: news summary -> digital-human video -> intelligent edit -> publish draft. (Automated local API verifier covers validation, dependency order, execution, utility isolation, and social publishing draft/campaign artifact output.)