11/**
2- * The `ad-replay` package façade (#1478 P5 stage A ).
2+ * The `ad-replay` package façade (#1478 P5 stage D — narrowed ).
33 *
4- * STAGE-A WIDE FAÇADE — TEMPORARY. This re-exports every symbol carried over
5- * by the mechanical move so root consumers keep working unchanged apart from
6- * their import specifier. It is not the intended final shape: a later stage
7- * narrows this façade to `inspectAdReplay`/`runAdReplay` once the daemon
8- * handlers and runtime wiring move into this package too. Do not treat the
9- * current export list as a design decision — it is scaffolding.
4+ * The binding design (issue comment 5156017698) is `inspectAdReplay` +
5+ * `runAdReplay` and nothing else. Staged reality is wider than that: the
6+ * daemon wire-builders and handlers call several engine POLICY functions
7+ * directly rather than only through the two entrypoints (var substitution,
8+ * plan-digest, target-identity/-verification, report shaping). Every export
9+ * below is a `façade-deviation` from the binding-design ideal EXCEPT
10+ * `inspectAdReplay`/`runAdReplay` themselves; each deviation names its real
11+ * root consumer(s) so the PR body's deviation table is generated straight
12+ * from this file. No selector AST, no engine IR, no prepared-plan type, and
13+ * no internal subpath is exported — everything here has a live import site
14+ * outside this package (see `packages/ad-replay/src/index.ts`'s sibling
15+ * consumer grep in the P5 stage D commit message for the full map).
1016 */
1117
18+ // ---------------------------------------------------------------------------
19+ // vars.ts — `.ad` variable substitution surface.
20+ // façade-deviation: the daemon resolves an action's variables directly
21+ // (`session-replay-target-verification.ts`, `session-replay-action-runtime.ts`)
22+ // and builds/collects env-derived scopes outside the step loop
23+ // (`session-replay-runtime.ts`, `session-replay-maestro-runtime.ts`,
24+ // `session-replay-runtime-failure.ts`) instead of only receiving resolved
25+ // actions back from `runAdReplay`.
26+ // ---------------------------------------------------------------------------
1227export {
1328 buildReplayVarScope ,
1429 collectReplayScrubbableVarValues ,
@@ -17,26 +32,44 @@ export {
1732 readReplayCliEnvEntries ,
1833 readReplayShellEnvSource ,
1934 resolveReplayAction ,
20- resolveReplayString ,
2135} from './internal/vars.ts' ;
22- export type { ReplayVarScope , ReplayVarSources } from './internal/vars.ts' ;
36+ export type { ReplayVarScope } from './internal/vars.ts' ;
2337
38+ // ---------------------------------------------------------------------------
39+ // plan-digest.ts — the `--from`/`--plan-digest` resume and save-script digest.
40+ // façade-deviation: `session-replay-runtime-plan.ts`'s resume path and
41+ // `request-router-repair-expired.test.ts` compute/read the digest directly,
42+ // ahead of and independent from any `runAdReplay` call.
43+ // ---------------------------------------------------------------------------
2444export { computeReplayPlanDigest } from './internal/plan-digest.ts' ;
2545export type { ReplayPlanDigestMetadata } from './internal/plan-digest.ts' ;
2646
47+ // ---------------------------------------------------------------------------
48+ // inspect.ts — the read-only `.ad` manifest reader. On-design: this IS one
49+ // of the two binding-design entrypoints.
50+ // ---------------------------------------------------------------------------
2751export { inspectAdReplay } from './internal/inspect.ts' ;
2852export type { AdReplayManifest } from './internal/inspect.ts' ;
2953
54+ // ---------------------------------------------------------------------------
55+ // step-loop.ts — the `.ad` step loop. On-design: this IS the other binding-
56+ // design entrypoint; `AdReplayStepRuntime` is the runtime capability bag the
57+ // daemon adapter (`session-replay-runtime.ts`) implements to thread it.
58+ // ---------------------------------------------------------------------------
3059export { formatReplaySuccessMessage , runAdReplay } from './internal/step-loop.ts' ;
31- export type {
32- AdReplayProgressSink ,
33- AdReplayProgressStep ,
34- AdReplayResponse ,
35- AdReplayRunOutcome ,
36- AdReplayRunRequest ,
37- AdReplayStepRuntime ,
38- } from './internal/step-loop.ts' ;
60+ export type { AdReplayStepRuntime } from './internal/step-loop.ts' ;
3961
62+ // ---------------------------------------------------------------------------
63+ // target-identity.ts — record/replay local-identity primitives (ADR 0012
64+ // decision 3).
65+ // façade-deviation: the record-time writer (`src/daemon/session-target-evidence.ts`)
66+ // and replay-time classification core (`session-replay-target-classification.ts`)
67+ // call these identity functions directly so both sides compute the SAME
68+ // ordinal by construction; `wait`'s landmark poll
69+ // (`src/commands/interaction/runtime/selector-wait.ts`) and the shared
70+ // replay-zone tree helpers (`src/replay/target-evidence-tree.ts`,
71+ // `src/replay/target-identity-node.ts`) also call in below `runAdReplay`.
72+ // ---------------------------------------------------------------------------
4073export {
4174 annotationLocalIdentity ,
4275 classifyTargetBindingMatch ,
@@ -45,49 +78,57 @@ export {
4578 matchesAncestryPrefix ,
4679 matchesLocalIdentity ,
4780} from './internal/target-identity.ts' ;
48- export type {
49- LocalIdentity ,
50- TargetBindingClassification ,
51- TargetBindingClassificationInput ,
52- } from './internal/target-identity.ts' ;
81+ export type { LocalIdentity } from './internal/target-identity.ts' ;
5382
54- // #1478 P5 stage C2a: the target-verification ENGINE policy split out of
55- // `session-replay-target-verification.ts` — pre-capture verification gating
56- // and post-dispatch mismatch-evidence derivation. See
57- // `./internal/target-verification.ts` for the daemon/engine ownership split.
83+ // ---------------------------------------------------------------------------
84+ // target-verification.ts — #1478 P5 stage C2a target-verification ENGINE
85+ // policy (pre-capture verification gating, post-dispatch mismatch-evidence
86+ // derivation), split out of `session-replay-target-verification.ts`.
87+ // façade-deviation: that same daemon wire-builder is the direct caller of
88+ // all four functions below — see `./internal/target-verification.ts` for the
89+ // daemon/engine ownership split.
90+ // ---------------------------------------------------------------------------
5891export {
5992 deriveReplayTargetGuardMismatchEvidence ,
6093 deriveWaitLandmarkMismatchEvidence ,
61- describeStructuralMismatch ,
6294 planPostResolutionTargetVerification ,
6395 planPreDispatchTargetVerification ,
64- readAncestryEntries ,
65- readGuardMismatchObservedIdentity ,
66- } from './internal/target-verification.ts' ;
67- export type {
68- ReplayPostDispatchMismatchEvidence ,
69- ReplayPostResolutionVerificationPlan ,
70- ReplayPreDispatchVerificationPlan ,
7196} from './internal/target-verification.ts' ;
97+ export type { ReplayPostDispatchMismatchEvidence } from './internal/target-verification.ts' ;
7298
99+ // ---------------------------------------------------------------------------
100+ // session-replay-report-action.ts / session-replay-suggestion-ranking.ts —
101+ // the divergence-report action shape and repair-suggestion ranking.
102+ // façade-deviation: `session-replay-maestro-failure.ts`, `session-replay-heal.ts`,
103+ // and `session-replay-divergence.ts` build/rank divergence reports directly;
104+ // none of this rides back through `runAdReplay`'s return value.
105+ // ---------------------------------------------------------------------------
73106export type { ReplayReportAction } from './internal/session-replay-report-action.ts' ;
74-
75107export { rankAndDedupeReplaySuggestions } from './internal/session-replay-suggestion-ranking.ts' ;
76108
77- // #1478 P5 stage B: the port TYPE only — root's production adapter
78- // (`src/daemon/replay-selector-port.ts`) implements it against
79- // `ReplaySelectorPort`'s three operations. The type is what rides in via
80- // `runAdReplay`'s runtime parameter once the daemon threads it (stage C); no
81- // selector AST type is ever exported here.
109+ // ---------------------------------------------------------------------------
110+ // selector-port.ts — the `ReplaySelectorPort` port TYPE only (#1478 P5 stage
111+ // B, the amendment's explicit rejection of a "seven-function selector-AST
112+ // mirror"). Two adapters implement it: the production adapter
113+ // (`src/daemon/replay-selector-port.ts`) and the in-memory adapter for this
114+ // package's own contract suite, relocated to
115+ // `src/__tests__/test-utils/in-memory-replay-selector-port.ts` (#1478 P5
116+ // stage D — package-internal code may not "reach back into root `src/`",
117+ // R11, so the adapter could not stay inside `packages/ad-replay` once its
118+ // only remaining consumer was a root test).
119+ // façade-deviation: daemon handlers thread `ReplaySelectorPort` values
120+ // directly (`session-replay-target-token.ts`, `session-replay-heal.ts`,
121+ // `session-replay-target-classification.ts`, `session-replay-runtime-failure.ts`,
122+ // `session-replay-runtime.ts`, `session-replay-target-verification.ts`) —
123+ // the port rides in as `runAdReplay`'s runtime threads it, but the type
124+ // itself is named at every one of those call sites.
125+ // ---------------------------------------------------------------------------
82126export type {
83- ReplaySelectorPort ,
84- ReplaySelectorGrammar ,
85- ReplaySelectorExpressionOutcome ,
86- ReplayRecordedTargetPolicy ,
87127 ReplayRecordedTargetDisambiguation ,
88- ReplayRecordedTargetResolved ,
89- ReplayRecordedTargetUnresolved ,
128+ ReplayRecordedTargetPolicy ,
90129 ReplayRecordedTargetResolution ,
91- ReplaySelectorCandidateAction ,
92130 ReplaySelectorCandidateOptions ,
131+ ReplaySelectorExpressionOutcome ,
132+ ReplaySelectorGrammar ,
133+ ReplaySelectorPort ,
93134} from './internal/selector-port.ts' ;
0 commit comments