mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-09-14 14:01:28 +08:00
350bcf0606
Phase 7 (substrate-layer compiler):
- domain/workflow.ts — CompiledWorkflow schema with WorkflowStep (primary
SelectorSpec + ordered fallback chain), WorkflowRequirements (sessionCapsule,
origins[], taskClass), WorkflowGuards (irreversibleAction,
requiresUserConfirmation), WorkflowReplay (maxRetries, timeoutMs).
ProductionUctSignals/Weights for the production-aware UCT formula.
- application/workflow-compiler.ts — WorkflowCompiler.compile() walks a signed
trajectory envelope's steps, extracts the primary locator from each step
input, derives an ordered selector fallback chain from observed snapshot
metadata (role+name → text → ref), classifies highest-risk action via
Phase 6 RiskClassifier, gates requirements + guards. toYaml() emits
deterministic, parseable YAML for VCS check-in.
- application/production-uct.ts — productionUct(input, weights) implements
the full substrate scoring formula:
score = Q + C·√(ln(N)/n) + λ_R·replayability
− λ_risk·risk − μ_cost·cost − α_auth·auth_fragility
Unvisited branches still return +Infinity for parity with Phase 4 UCB1.
blendQ() linearly mixes scorer value + replay-success-rate.
- 12 new tests: compile login flow + fallback chain, financial-action
guard escalation, origin extraction, deterministic YAML output, UCT
invariants (infinity for unvisited, prefers safe over risky, penalises
cost, rewards replayability, custom weights honoured), blendQ linearity.
Renames in src/index.ts re-export: WorkflowStep → CompiledWorkflowStep
(avoids collision with workflow-templates.ts's pre-existing WorkflowStep).
230/230 tests passing (+12 for Phase 7). Build + typecheck clean.
Beyond SOTA: no other web agent compiles MCTS traces into signed, replayable
YAML workflows with selector fallback graphs. The compiler is the "output of
the substrate" — what makes browser experience truly reusable.
Co-Authored-By: RuFlo <ruv@ruv.net>