Skip to content

refactor: sink package-closed src modules into existing packages - #2106

Merged
thymikee merged 4 commits into
mainfrom
refactor/src-package-closed-modules
Aug 28, 2026
Merged

refactor: sink package-closed src modules into existing packages#2106
thymikee merged 4 commits into
mainfrom
refactor/src-package-closed-modules

Conversation

@thymikee

@thymikee thymikee commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary

Operators, CLI, daemon, and MCP behavior are unchanged. Package-closed codec modules move into @agent-device/ad-script, screenshot geometry into kernel, and DaemonCommandDescriptor is declared in core so the type graph can ratchet. Executable policy does not go into contracts or capture-kit.

  • interaction-outcome WeakMap lifecycle → src/core/interaction-outcome.ts
  • snapshot quality warning rendering → src/snapshot/snapshot-presentation/quality-warnings.ts
  • request-scoped inventory ALS → src/request/device-inventory-context.ts
  • screenshot geometry → @agent-device/kernel/screenshot-geometry
  • replay format / recorded-input / evidence-tree / parseReplayInput@agent-device/ad-script (still exports only .)
  • DaemonCommandDescriptor is generic over DispatchedCommand in core; daemon re-exports the live table. R6 inversions 7→5. R9 pins the remaining 6-file provider-webdriver type cycle.

R18 rejects packages/contracts/src/interaction-outcome.ts and snapshot-quality-warnings.ts. R70 rejects capture-kit async_hooks/AsyncLocalStorage and a reintroduced src/contracts/ tree. Both were observed red on the pre-move tree.

Related to #2082 (does not close it). Rebased onto main after W1–W3 (#2088 / #2090 / #2100).

Validation

Rebased onto origin/main (2e87347bee) at f48d2d983b. Local typecheck, layering (including planted R18/R70), and eager-closure budgets are green. Command output and routing are unchanged (moves, specifier swaps, type relocation, and layering gates).

Docs: AGENTS.md points cross-layer contracts at @agent-device/contracts and keeps W1 request-cancel/progress in capture-kit; findings.md §0 records the remaining five R6 inversions. ADR 0012 still cites the historical src/compat/replay-input.ts path.

Published and reported, not merge-ready: CI on f48d2d983b is still the authority.

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.48 MB 2.48 MB +14 B
JS gzip 834.8 kB 834.8 kB -9 B
npm tarball 958.3 kB 958.3 kB -27 B
npm unpacked 3.32 MB 3.32 MB +14 B

npm unpacked components

Component Base Current Diff
JS / dist source 2.64 MB 2.64 MB +14 B
Apple runner source/project 581.1 kB 581.1 kB 0 B
macOS helper source 54.8 kB 54.8 kB 0 B
Android helper artifacts 0 B 0 B 0 B
Other package files 45.4 kB 45.4 kB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 30.6 ms 29.3 ms -1.3 ms
CLI --help 84.9 ms 81.7 ms -3.2 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/internal/daemon.js +13 B -19 B
dist/src/perf-runtime-plan.js +6 B +11 B
dist/src/session-store.js 0 B +5 B
dist/src/session2.js 0 B -3 B
dist/src/registry.js 0 B -1 B

Top changed packed files

Packed file Base Current Diff
dist/src/internal/daemon.js 107.3 kB 107.3 kB +13 B
dist/src/perf-runtime-plan.js 63.6 kB 63.6 kB +6 B
dist/src/runtime.js 64.8 kB 64.8 kB -5 B

@thymikee

Copy link
Copy Markdown
Member Author

Not ready. This turns contracts/capture-kit into generic sinks: mutable interaction-outcome WeakMap lifecycle is not vocabulary, snapshot warning selection/rendering is executable presentation policy, and request-scoped AsyncLocalStorage inventory dispatch is not durable-capture mechanics. Move them behind focused interaction, snapshot-presentation, and root-runtime owners; add planted semantic/root-shape gates rather than expanding export allowlists. Remove touched history/control-flow narration and wait for exact-head CI.

@thymikee

Copy link
Copy Markdown
Member Author

Addressed on 06324aecfc.

The three sinks are no longer in contracts/capture-kit:

  • interaction-outcome WeakMap lifecycle → src/core/interaction-outcome.ts
  • snapshot quality warning rendering → src/snapshot/snapshot-presentation/quality-warnings.ts
  • request-scoped inventory ALS → src/request/device-inventory-context.ts

Planted gates instead of export-map growth: R18 rejects those two contracts paths (observed red on the pre-move tree, including the WeakMap/snapshot-quality-warnings hits); R70 rejects capture-kit async_hooks/AsyncLocalStorage and a reintroduced src/contracts/ tree. Screenshot geometry stays in kernel; ad-script and the descriptor genericization are unchanged.

Exact-head CI on c3638a1ad0 was green; this head reruns it.

@thymikee
thymikee force-pushed the refactor/src-package-closed-modules branch from 06324ae to f5612d9 Compare August 27, 2026 18:50
@thymikee

Copy link
Copy Markdown
Member Author

Rebased onto origin/main (04758c992c) at f5612d929b. Conflicts were session-inventory.ts (keep registry import + src/request inventory ALS) and the eager-closure registry pin after capabilities.ts left main. Typecheck, layering, and budget tests are green on the new head.

@thymikee

Copy link
Copy Markdown
Member Author

The contracts/capture ownership repair is now sound: runtime state is back in core/request/snapshot-presentation owners, the bad public subpaths are retired, and R18/R70 have planted regression proof. Not ready under current main's comment rule: remove the moved implementation/history narration from packages/ad-script/src/index.ts, src/snapshot/snapshot-presentation/quality-warnings.ts, src/core/interaction-outcome.ts, and src/request/device-inventory-context.ts; names, types, module boundaries, and tests should carry those invariants. Native smoke is still incomplete.

@thymikee

Copy link
Copy Markdown
Member Author

Addressed on be2c611472.

Removed the moved implementation/history narration from:

  • packages/ad-script/src/index.ts
  • src/snapshot/snapshot-presentation/quality-warnings.ts
  • src/core/interaction-outcome.ts
  • src/request/device-inventory-context.ts

Names, types, module boundaries, and tests carry those invariants. Native smoke is still incomplete; this head is published, not merge-ready.

@thymikee

Copy link
Copy Markdown
Member Author

Re-reviewed be2c611472: the prior comment-policy blocker is fully resolved. The delta only removes the identified implementation/history narration; package ownership, planted R18/R70 proof, and code review remain clean.

Not merge-ready solely on exact-head evidence. Android smoke failed at wait for landscape with wait_capture_stalled and zero readable captures after this comment-only delta. That is not attributable to the code change, but without a rerun or same-load base comparison it remains an unroot-caused native/infrastructure failure, not a declared flake. iOS smoke is still incomplete. Update Validation from the old commit stamps when final exact-head evidence is available.

@thymikee

Copy link
Copy Markdown
Member Author

Re-reviewed be2c611472: the narration-only follow-up is sound; the contracts/capture ownership repair and planted R18/R70 coverage remain intact. All substantive exact-head checks are green, including Coverage, Integration, Repo Guards, and Android/iOS/macOS/Linux smoke lanes. Code review is clean; ready for human merge.

Minor PR-body hygiene: replace the stale “not merge-ready” / 06324aecfc evidence with this exact green head. That does not block the code verdict.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Aug 27, 2026
@thymikee

Copy link
Copy Markdown
Member Author

Validation is now stamped to exact-head be2c611472: Coverage, Integration, Repo Guards, and Android/iOS/macOS/Linux smoke are green (Android/iOS after same-head reruns). Body no longer carries the stale 06324aecfc / not-merge-ready claim.

thymikee and others added 4 commits August 28, 2026 07:50
Move closed modules into contracts, kernel, capture-kit, and ad-script,
and declare DaemonCommandDescriptor in core so R6/R9 can pin the remaining
provider-webdriver type cycle.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move interaction-outcome, snapshot warning rendering, and inventory ALS
behind focused owners, and plant R18/R70 domain-shape gates so they
cannot return as package export-map growth.

Co-authored-by: Cursor <cursoragent@cursor.com>
Names, types, and tests already carry those invariants; the relocated
files should not keep review-history or control-flow narration.

Co-authored-by: Cursor <cursoragent@cursor.com>
W1 moved the verdict into capture-kit and this PR moved warning rendering
into snapshot-presentation, so the ranked zone no longer has production files.

Co-authored-by: Cursor <cursoragent@cursor.com>
@thymikee
thymikee force-pushed the refactor/src-package-closed-modules branch from be2c611 to f48d2d9 Compare August 28, 2026 05:53
@thymikee

Copy link
Copy Markdown
Member Author

Rebased onto origin/main (2e87347bee, includes W1–W3) at f48d2d983b.

Conflicts were the expected mechanical surfaces: kernel/capture-kit package.json, eager-closure pins, package-boundaries, and specifier merges against host-kit/capture-kit moves. Inventory ALS stays in src/request (git had suggested host-kit; that was a rename false positive). Dropped the now-empty ranked snapshot-quality zone after W1 took the verdict and this PR took warning rendering.

Typecheck, layering, and eager-closure budgets are green locally. Exact-head CI on this rebase is still the authority — not merge-ready.

@thymikee
thymikee merged commit ddb415a into main Aug 28, 2026
19 checks passed
@thymikee
thymikee deleted the refactor/src-package-closed-modules branch August 28, 2026 05:56
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-28 05:58 UTC

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

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant