Skip to content

refactor: daemon and contracts decoupling, wave 3 (registry package, type split, leaf moves) #2335

Description

@thymikee

Purpose

Third decoupling wave for src/daemon and @agent-device/contracts, following #2316, #2317 and #2318. Measured on main at 27a97ee619 with a production-only import graph (1,629 files, 8,805 edges):

  • src/daemon: 350 production files, 56.8k lines; 197 flat top-level files (30k lines). The value graph is acyclic and the daemon has zero edges into platform packages. It has 154 value edges into 67 root src/ files; the top hubs are command-catalog.ts (15 daemon files), core/command-descriptor/registry.ts (13), core/dispatch-resolve.ts (12), provider-device-runtime.ts (11).
  • @agent-device/contracts: 190 modules, 18.2k lines, 118 subpaths. 106 modules export runtime code (13k lines). 146 modules are reachable from a platform/provider package; 44 are not; 19 are reachable from no package at all.

The command descriptor registry is the keystone: it is package-ready today (its only root dependency is core/parse-timeout.ts) and it is what forbids packaging the daemon client and the session event journal under R11.

Children (dependency order)

Rules for every child

Evaluated and not scheduled

  • @agent-device/gestures (gesture-plan, android-touch-plan, apple-multitouch-support, gesture-admission; ~780 lines with a clean DAG below the contracts hubs): viable, deferred for new-package cost.
  • Client-contracts audience split (client-* ×14 + facades/client.ts, 1.4k lines, all type-only consumers): buys ownership clarity, not coupling reduction.
  • src/daemon/session-target-evidence.ts: needs capture-kit and ad-script; no package depends on both.
  • HTTP artifact transfer cluster (15 top-level files, 1,984 lines, 0 root deps): a logical module, not a package; belongs with refactor(daemon): audit and retire residual semantic platform coupling #2278's ownership work.
  • Maestro adapter fold into replay/: rejected, R9 engine-cycle prefix.

Completion

All children closed with their completion conditions met, and the two measurements above re-run and recorded here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions