…internal modules
Post-#1636 review feedback: internal src modules were re-exporting package
types (export type { X } from '@agent-device/...'), giving one declaration
several import paths and hiding its provenance. New rule applied repo-wide:
internal modules import directly from the owning package; only published
entry surfaces (src/sdk/* entries, client-types, finders, metro composition,
remote-config-schema) may re-export.
Eleven internal re-exports removed and ~110 import sites redirected to the
packages, the big two being CommandFlags (core/dispatch chain, 39 sites) and
SessionAction (daemon/types.ts, 19 sites). Two were already dead
(RefFrameEffect via daemon-command-registry, DiffSnapshotCommandResult via
capture/runtime/snapshot). Entry-surface chains now re-export from the
package rather than laundering through a second internal module
(client-types/client-metro MetroBridgeScope).
Side effect: the R9 type cycle shrinks again, 49 -> 47 (daemon-server
19 -> 17); ceilings lowered to match.
Follow-up to #1636 review feedback (the
export type { ScreenshotResultData } from '@agent-device/contracts/capture'inutils/screenshot-result.ts): internal modules should not re-export package types — consumers import directly from the owning package. This PR applies that rule repo-wide.The rule
Internal src modules import package types directly from
@agent-device/*. Only published entry surfaces may re-export. The kept re-export surfaces (all feed the npm exports map or the public client type surface):src/sdk/*entries,src/client/client-types.ts,src/finders.ts,src/metro/{client-metro,metro-types}.ts,src/remote/remote-config-schema.ts.What moved
Eleven internal re-exports removed; ~110 import sites across 115 files redirected to the packages (
git diffis one-line import rewrites, −24 net):core/dispatch.ts+core/dispatch-context.tsCommandFlagsdaemon/types.tsSessionActionrequest/progress.tsRequestProgressEvent/Sinksnapshot/snapshot-quality.tsSnapshotQualityVerdictclient/client-companion-tunnel-contract.tsCompanionTunnelScope,MetroBridgeScopecommands/cli-grammar/flag-types.tsCliFlagsutils/screenshot-result.tsScreenshotResultDatacommands/command-input.tsRepeatedInputsnapshot/snapshot-diff.tsSnapshotDiffLine/Summarydaemon/daemon-command-registry.tsRefFrameEffectcommands/capture/runtime/snapshot.tsDiffSnapshotCommandResultcore/batch.tsDaemonBatchSteprunBatchonly)Entry-surface chains that previously laundered through a second internal module now re-export from the package (
client-types.ts/client-metro.ts→MetroBridgeScopefromcontracts/remote).Measured side effect
The R9 type cycle shrinks again: 49 → 47 (
daemon-server19 → 17) —core/dispatch.ts's type re-export was itself a cycle edge. Ceilings lowered to the measured values.Verification
check:layering(47/17), fallow audit (115 changed files) + production-exports: green.srcsuite: 609 files / 5,341 tests green. (One earlier run hit two pid-liveness assertion flakes in device-claim tests — pass in isolation and on rerun, pre-existing class per test: make pid-liveness fixtures deterministic under load #1556's own commit message; test-side hardening flagged separately, no product code involved.)