Commit Graph

1 Commits

Author SHA1 Message Date
ruv 45f951143e feat(browser): #2041 ADR-122 Phase 6 + substrate reframing — Session Capsule + adapters + risk classes
ADR-122 reframed as **RuFlo Browser Substrate**: ruflo becomes the memory,
policy, replay, distributed-planning layer underneath browser agents. Stagehand,
Browser Use, Playwright, Browserbase, Surfer-H become execution targets — not
competitors. Added Architecture section: layered system, 6 runtime services,
risk-class taxonomy, Session Capsule schema, production-aware UCT, SOTA rubric.

Phase 6 implementation (substrate primitives):
- domain/session-capsule.ts — full SessionCapsulePayload with origins[],
  reusePolicy (allowedOrigins, allowedTaskClasses, maxReplays, requireFreshMfa,
  allowCrossDevice/Installation), consentProof (signed statement),
  browserProfile, witnessChainHead, expiry, replays counter. RiskClass enum
  (read-only / authenticated-read / draft-write / external-submission /
  financial / account-mutation / destructive) + AUTONOMOUS_CLASSES set.
- application/session-capsule-service.ts — create() with PII-scan gate,
  verify() with schema+signature+trust-list+expiry+maxReplays checks, mount()
  that increments replays + rolls witness chain head, revoke(), per-class
  RiskClassifier with verb+target regex taxonomy.
- domain/browser-adapter.ts — BrowserExecutionAdapter interface (single
  surface above the tool wars: open/snapshot/click/fill/type/screenshot/wait/
  getUrl/getTitle/getText/close/observe).
- infrastructure/agent-browser-execution-adapter.ts — first concrete adapter
  wraps existing AgentBrowserAdapter; future Phase 6.5+ adds Stagehand,
  Browserbase, local Chrome.
- 20 new tests: clean+PII create, tamper rejection, expired capsule, trust
  list, mount replays + chain head, maxReplays cap, origin/taskClass policy
  enforcement, revoke, RiskClassifier for all 7 classes (Class 1-3 autonomous,
  Class 4-7 human approval), inline-state PII detection regression fix
  (string-spread bug that prevented SSN regex matching).

218/218 tests passing (+20 for Phase 6). Build + typecheck clean.

Beyond SOTA: no public browser-agent system ships a signed-state capsule with
origin scope, consent proof, replay counter, witness chain, AND risk-class
gating. Stagehand v3 portability + Browserbase persistence + Surfer-H vision
are all *execution-layer* — ruflo is the substrate that sits above them.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-18 19:28:31 -04:00