Skip to content

Commit c137b5b

Browse files
authored
refactor(daemon): make the layer folders the declaration (PR 10) (#3520)
* refactor(move): move every daemon file into its layer folder Codemod-only: 662 renames of packages/daemon/src files under the five layer folders (core, resources, execution, sessions, server), with every relative specifier, path mention, and package-manifest entry retargeted by the same pass. The map is the layer-manifest claim plus deterministic owner-layer rules for tests and support files; two support-only tests fall to core, and the one fixture a testing pattern consumes across layer folders follows its pattern's members so ./testing/interaction/internal/__tests__/* keeps a single target. The former transport folder does not fold onto its layer's name: the map places it at server/http/, so the package never carries a server/server path. The narrowed facade keeps every export KEY and rewrites only TARGETS: 107 named entries follow their file, and the four ./testing/<dir>/* pattern folders follow the folder their consumed members move into. Importers outside the package are untouched. Generated with assistance. * docs(adr): name the live path for row 23 of the hop trace The row cited src/daemon/device-claim-admission.ts, stale since the package extraction; it now names the file's home in the resources layer. The other src/daemon/ citations in the ADRs name files the tree no longer carries at all and keep their historical spelling. (cherry picked from commit 563b382) * fix(gates): retarget the teardown closure probe the extraction left stale The probe walked src/daemon/session-teardown.ts, a path the package extraction had already orphaned; it now resolves through packages/daemon/src/sessions/, where the move put the teardown owner. The non-vacuity pins (closure size, materialized-path-registry membership) carry over unchanged. (cherry picked from commit 7937155) (cherry picked from commit 5d943ca) # Conflicts: # src/__tests__/daemon-composition/session-teardown-import-closure.test.ts * refactor(gates): R81 derives the daemon layer from its folder The five layer folders now carry the claim the manifest carried: the first path segment under the daemon root is the file's layer, an unknown segment or a production file at the zone root fails, and the edge rule over core < resources < execution < sessions < server is unchanged. The manifest JSON and its drift check retire with this commit — the folder is the declaration, so ownership moves with the file and cannot decay into fiction separately from the tree. The rule derives its root from the shared DAEMON_SOURCE_ROOT constant and refuses an empty input set, so a stale scan filter cannot pass it silently. * chore(gates): retarget fallow config, URL-based ownership probe, and audit scope The route-handler and interaction-facade fallow entries follow their files into the sessions/execution layers. The atomic-publish ownership probe reads its judged sources through new URL(...) relative to the test, so its specifiers follow the move by hand. The daemon-shaped test-support file the move brought into the audit diff joins the per-file test-support exemption: every consumer is test-tree code --production analysis cannot see. (cherry picked from commit 687b53d) (cherry picked from commit 977fbd7) * chore(gates): retarget source-reading test probes to layer paths Ownership probes and eager-closure walks that read daemon modules by path follow them into their layer folders: the replay ownership scan's synthetic probe locations move one folder deeper, and the daemon- shaped test-support fallow entry settles on the one file the move actually brought into the audit diff. (cherry picked from commit 41fa23b, minus the lease.test.ts plugin-manifest hop: the 11b lineage removed that probe's file body, so nothing follows the move there) (cherry picked from commit 665850c) * chore(gates): settle self-review findings on the package base Dead oxlint override for a file deleted before this stack, the vacuous device-lane fixture pin (now asserts the fixture exists, at its path in this tree), the R81 helpers that never needed to leave their module, and the closure-probe hops that follow the interaction routes and replay probes into their layer folders. (cherry picked from commit baebba2; the ime-capture fixture pin tracks its 11b home under packages/platform-android/src/fixtures/) (cherry picked from commit 5e88063) * refactor(gates): measure R75 in head coordinates only The review caught that mergeBaseRatchets already canonicalizes every merge-base path onto its head path through renamedSince, so the overlay's pre-fold handlers/ root, the pre-fold SessionStore spelling, and the handlerKey fold matched nothing in either measured tree, and the record-owner regex carried the same dead alternatives. R75 now keeps only the two live handler roots and the single store target; its tests moved onto those paths, so the live roots are what the suite exercises. * refactor(gates): hold R75 and its fixtures to the live layer roots The first pass dropped the dead spellings but still hardcoded the two handler roots as literals and left the rest of scripts/layering planting synthetic daemon fixtures under the pre-fold handlers/ root. R75 now derives both roots and the SessionStore target from DAEMON_SOURCE_ROOT, gains an end-to-end classification case for each live handler folder (the pre-fold spelling stays measurable but out of the ratcheted subset, and each root is bite-proofed against a rename), and gains a case that measures the real merge-base through mergeBaseRatchets and asserts its handler-owned set arrives in head coordinates and the base really held src/daemon/handlers/. Nine synthetic fixtures moved onto sessions/handlers/. The R10 retired-handler path lists keep their historical spelling on purpose: they name deleted files, and retargeting them would reject legitimate new files in the live folders. * refactor(gates): measure the rename canonicalization on a fixture repo The merge-base overlay test read the real merge-base and asserted the base tree still held src/daemon/handlers/. That pins one repo state — this stack's — and starts failing on main and every later PR the moment the stack lands, because check:layering runs these tests. The test now builds a fixture repo whose base commit holds the pre-rename flat handlers/ layout (padded so the specifier-rewriting move stays rename-pairable) and whose head is the git mv into layer folders, then injects that base through mergeBaseRatchets' new baseRef override and asserts the rule: every base handler member survives canonicalization, arrives under a live handler root, and the non-handler importer stays out of the scoped set. No fetched origin/main, no repo history. * fix(gates): name the layer path in the two comments the sweep skipped The move sweep's path lookahead refused any match followed by a period, so comment literals ending a sentence ("...device-claim-conflict.ts. This path...") kept their pre-fold spelling. The owner's review caught the help-conformance sample; the same class left one cross-reference in the offscreen double-check test. Both now name the live layer paths. The codemod kit's lookahead is fixed alongside (#3520 re-run kit, not a repo file), so the next re-run sweeps these forms automatically. * chore(gates): re-flow the lines the move and its retargets widened The codemod lengthened retargeted specifiers and path literals past the print width; oxfmt settles them. Formatting only, no semantics. Generated with assistance. * refactor(gates): call daemonLayerOf from rankedPair directly layerOfEdgeEnd only wrapped daemonLayerOf — a leftover from the manifest version of R81 — so rankedPair, its only caller, names the layer owner itself (#3520 review). Behavior unchanged; the layering suite and R81's reported edges are identical. * refactor(gates): own the handler-folder rule once as isDaemonHandlerFile The split of the old handlers/ tree into sessions/handlers/ and execution/handlers/ was pasted as a pair of path roots in four places: three arrays in architecture-ownership.ts and HANDLER_ROOTS in session-authority-overlay.ts. The rule is the folder shape — any <layer>/handlers/ folder under a declared layer — so daemon-layers.ts, which already owns the layer folders, exports isDaemonHandlerFile and the policies gained forbiddenTargetShapes beside the path roots. A handler folder planted under another layer now joins R75's ratchet and the facade policies with no rule edit; pinned by planted cases at both gates (the pre-fold two-path rule fails exactly those pins).
1 parent 8d3f292 commit c137b5b

774 files changed

Lines changed: 3708 additions & 3452 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.device-evidence/CHECKLIST.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ appended warning:
9999
### Proof the review asked for on this lane
100100

101101
The false-attribution class is covered by unit tests rather than a device run, because the device
102-
cannot show a cache hit on command: `packages/daemon/src/__tests__/selector-capture-runtime.test.ts`
102+
cannot show a cache hit on command: `packages/daemon/src/execution/__tests__/selector-capture-runtime.test.ts`
103103
drives a session-snapshot cache hit and pins that the consumed tree earns no repair proof and
104-
discloses nothing, `packages/daemon/src/__tests__/capture-disclosure-target-activation.test.ts`
104+
discloses nothing, `packages/daemon/src/core/__tests__/capture-disclosure-target-activation.test.ts`
105105
pins that the response builder never borrows a repair the stored snapshot happens to carry, and
106106
`src/__tests__/daemon-composition/interaction/interaction-capture-disclosure.test.ts` pins that
107107
a press which consumed no capture is not disclosed against an older tree.

‎.fallowrc.json‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"scripts/help-conformance-sample-outputs.d.mts",
6666
"scripts/help-conformance-runner-output.d.mts"
6767
],
68-
"dynamicallyLoaded": ["packages/daemon/src/interaction/index.ts"],
68+
"dynamicallyLoaded": ["packages/daemon/src/execution/interaction/index.ts"],
6969
"ignoreDependencies": [
7070
"@theme",
7171
// @agent-device/maestro owns the source import, while the published root
@@ -155,19 +155,23 @@
155155
},
156156
{
157157
// Daemon route handlers are reached only through the dynamic `import()` table in request-handler-chain.ts, which --production analysis cannot follow to a consumer.
158-
"file": "packages/daemon/src/handlers/{human-control,lease,session,snapshot,react-native,record-trace}.ts",
158+
"file": "packages/daemon/src/sessions/handlers/{human-control,lease,session,snapshot,record-trace}.ts",
159159
"exports": [
160160
"handleHumanControlCommand",
161161
"handleLeaseCommands",
162162
"handleSessionCommands",
163163
"handleSnapshotCommands",
164-
"handleReactNativeCommands",
165164
"handleRecordTraceCommands"
166165
]
167166
},
167+
{
168+
// The react-native route handler lives in the execution layer with its mechanics; same dynamic-loader exemption as the sessions-side route handlers above.
169+
"file": "packages/daemon/src/execution/handlers/react-native.ts",
170+
"exports": ["handleReactNativeCommands"]
171+
},
168172
{
169173
// The interaction facade exposes #2178's deferred route handlers plus the existing ref mutation response consumed by help conformance. Fallow's production graph cannot follow the request-handler-chain dynamic imports, so this exact list is the facade contract.
170-
"file": "packages/daemon/src/interaction/index.ts",
174+
"file": "packages/daemon/src/execution/interaction/index.ts",
171175
"exports": ["refMutationAdmissionResponse", "handleFindCommands", "handleInteractionCommands"]
172176
},
173177
{
@@ -251,7 +255,7 @@
251255
]
252256
},
253257
{
254-
// packages/daemon/src/__tests__/request-runtime-binding.test.ts drives the daemon's exact bind through the recovery authority, whose cancellation race is what rejects; production reaches it only through finishRecoveredDurableCapture and recoverDurableCaptureResource in the same package.
258+
// packages/daemon/src/core/__tests__/request-runtime-binding.test.ts drives the daemon's exact bind through the recovery authority, whose cancellation race is what rejects; production reaches it only through finishRecoveredDurableCapture and recoverDurableCaptureResource in the same package.
255259
"file": "packages/capture-kit/src/durable-capture/index.ts",
256260
"exports": ["acquireDurableCaptureRecoveryAuthorityBeforeDeadline"]
257261
},

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ Read the declaration rather than maintaining a prose copy:
4949

5050
- commands and their surface, runtime-use, batch, and timeout traits:
5151
`packages/command-registry/src/registry.ts`
52-
- daemon route ownership and request-policy traits: `packages/daemon/src/daemon-command-registry.ts`
52+
- daemon route ownership and request-policy traits: `packages/daemon/src/core/daemon-command-registry.ts`
5353
- interaction paths and guarantees: `packages/contracts/src/interaction-guarantees.ts`
5454
- canonical command names: `packages/command-registry/src/catalog.ts`
5555
- device runtime-use declarations and fact admission:
56-
`packages/command-registry/src/registry.ts`, `packages/daemon/src/runtime-admission.ts`, and
56+
`packages/command-registry/src/registry.ts`, `packages/daemon/src/core/runtime-admission.ts`, and
5757
`src/platform-runtime-gateway.ts`
5858
- common command input fields, and which surface may write an input key (model, operator, retired):
5959
`src/commands/common-input-fields.ts` and `src/commands/input-audience.ts`
@@ -110,7 +110,7 @@ under `contracts/fixtures/`.
110110
## Runtime and diagnostics seams
111111

112112
Diagnostics use `@agent-device/host-kit/diagnostics`. Request diagnostics belong in the session request log;
113-
session artifact paths come from `packages/daemon/src/session-artifact-paths.ts`. App/device logs remain in `app.log`;
113+
session artifact paths come from `packages/daemon/src/core/session-artifact-paths.ts`. App/device logs remain in `app.log`;
114114
Apple runner and xcodebuild output remains in `runner.log`.
115115

116116
Normalize failures with `normalizeError` and preserve `hint`, `diagnosticId`, `logPath`, and typed

‎docs/adr/0003-daemon-command-registry.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ to public command identity, and it required duplicate command sets to stay align
2121
Keep public command identity in `src/command-catalog.ts` and public input/output contracts in
2222
`src/commands/**`.
2323

24-
Add `packages/daemon/src/daemon-command-registry.ts` as the daemon-side source of truth for command route
24+
Add `packages/daemon/src/core/daemon-command-registry.ts` as the daemon-side source of truth for command route
2525
ownership and daemon request-policy traits. Request modules consume predicate functions from the
2626
registry instead of recreating command string sets. Handler modules own execution logic only; they do
2727
not export duplicate coverage tables to prove route membership.
@@ -85,5 +85,5 @@ derived daemon registry is therefore permitted **only if** it preserves all of t
8585
A single flat public descriptor whose daemon fields leak into public views is **not** permitted — that is
8686
the "collapse daemon policy into a public command registry" failure this ADR exists to prevent. Compose
8787
facets owned by their domains; derive the registry from them. Until that derivation lands and is pinned
88-
by the registry tests, the hand-authored `packages/daemon/src/daemon-command-registry.ts` remains the source of
88+
by the registry tests, the hand-authored `packages/daemon/src/core/daemon-command-registry.ts` remains the source of
8989
truth and the operating rule in `AGENTS.md` is unchanged.

‎docs/adr/0004-ios-snapshot-backend-strategy.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ facet in `@agent-device/capture-kit` owns snapshot policy generally rather than
115115
stated as a duration budget; the loop derives the deadline from the window's `markedAt` itself, so
116116
the budget is always spent from the action and a caller has no absolute instant it could get
117117
wrong.
118-
`packages/daemon/src/session-snapshot-freshness.ts` keeps only what needs a session: reading and retiring
118+
`packages/daemon/src/core/session-snapshot-freshness.ts` keeps only what needs a session: reading and retiring
119119
the window on store-owned `SessionState`, and choosing the comparison baseline from snapshot
120120
lineage. It remains the declared R7 owner of `androidSnapshotFreshness`.
121121
- **Timeout evidence.** Whether a capture failed because the hierarchy never arrived is decided
@@ -150,7 +150,7 @@ those roots and are outside that gate. It carries a positive control, because a
150150
matching would look identical to a boundary being obeyed.
151151

152152
The residual call sites #1983 also named are audited and deliberately left in place.
153-
`packages/daemon/src/direct-ios-selector.ts` carries no presentation policy: `isLocalIosRunnerSession` and
153+
`packages/daemon/src/core/direct-ios-selector.ts` carries no presentation policy: `isLocalIosRunnerSession` and
154154
`readSimpleIosSelectorTarget` are session routing (device family, provider ownership, the
155155
stabilization window), while `deriveDirectIosNodeSelector` and `isDirectIosSelectorFallbackError`
156156
are selector derivation and ADR 0011 delegation-on-error. The latter two are pure and

‎docs/adr/0008-command-descriptor-registry.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Accepted
2424
A command's identity is restated, by hand, across roughly ten tables that must stay aligned by
2525
convention: `PUBLIC_COMMANDS` (`src/command-catalog.ts`), the per-command metadata and family facets
2626
(`src/commands/**`), the capability matrix (`src/core/capabilities.ts`), the daemon command registry
27-
(`packages/daemon/src/daemon-command-registry.ts`, ADR 0003), the structured-batch allowlist
27+
(`packages/daemon/src/core/daemon-command-registry.ts`, ADR 0003), the structured-batch allowlist
2828
(`src/batch-policy.ts`), the MCP exposure sets, the Node client interface and impl (`src/client-types.ts`,
2929
`src/client.ts`), and the generic-dispatch `switch` (`src/core/dispatch.ts`, whose `default: throw` makes a
3030
missing or renamed command a runtime error, not a compile error). Adding one command touches ~24 files, the

‎docs/adr/0012-interactive-replay.md‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ path — no text editing, no silent similarity-heal.
730730

731731
**Core mechanism — the healed script IS `session.actions`.** No new splice engine. `session.actions`
732732
already accumulates every executed action for the session's lifetime
733-
(`packages/daemon/src/session-action-recorder.ts:92`, unconditional push), and the divergence refusal is
733+
(`packages/daemon/src/core/session-action-recorder.ts:92`, unconditional push), and the divergence refusal is
734734
pre-dispatch (target verification refuses before the device action, decision 3), so a divergent step is
735735
never pushed. Across a repair session: original steps that verified and dispatched land in
736736
`session.actions`; the divergent step is absent (refused pre-dispatch, never recorded); the agent's
@@ -766,7 +766,7 @@ works" and "healed scripts are always valid":
766766
steps are re-executed during the repair replay; only if recording is armed from the start do they land
767767
in `session.actions` with fresh `target-v1` evidence. Arming late yields a hybrid healed script (an
768768
annotated corrective step glued to a bare, unannotated prefix) that re-diverges on its own next replay
769-
(`packages/daemon/src/interaction/internal/interaction-common.ts:64-65` attaches evidence only when `recordSession` was
769+
(`packages/daemon/src/execution/interaction/internal/interaction-common.ts:64-65` attaches evidence only when `recordSession` was
770770
true when the step ran).
771771
- **R2 — `--from` continuation only; never re-run the full replay on the same session.** After a
772772
divergence at step N and the corrective action, the agent must continue with `replay --from k
@@ -808,8 +808,8 @@ works" and "healed scripts are always valid":
808808
instead of leaving it to agent judgment.
809809
- **R4 — corrective actions must materialize to selector form; the writer fails loudly on a bare `@ref`
810810
cross-session export.** A `press @e12` normally resolves a `selectorChain` at runtime
811-
(`packages/daemon/src/interaction/internal/interaction-touch-targets.ts`), which `buildOptimizedActions`
812-
(`packages/daemon/src/session-script-writer.ts:368-377`) rewrites to a selector line. If no `selectorChain` was
811+
(`packages/daemon/src/execution/interaction/internal/interaction-touch-targets.ts`), which `buildOptimizedActions`
812+
(`packages/daemon/src/core/session-script-writer.ts:368-377`) rewrites to a selector line. If no `selectorChain` was
813813
captured, the writer must refuse to emit a bare `@ref` line into a persisted `.ad` — a session-bound
814814
ref will not resolve in a fresh run. It **fails loudly**: an error surfaced to the user with a non-zero
815815
exit, never a swallowed or silently-dropped line (existing session-write paths swallow such failures;
@@ -893,7 +893,7 @@ by construction. The healed `.ad` is written only when the repair ends (below) a
893893
- The healed `.ad` is published when a teardown commits the transaction at state `COMPLETE` — normally the
894894
agent's own `close`/`close --save-script <out>`, but any teardown of a completed transaction commits
895895
(see the commit state machine below) — reusing the existing `session.actions` serializer
896-
(`SessionScriptWriter.write`, `packages/daemon/src/session-script-writer.ts:120-158`) over the post-watermark slice
896+
(`SessionScriptWriter.write`, `packages/daemon/src/core/session-script-writer.ts:120-158`) over the post-watermark slice
897897
only (R6). When no
898898
`<out>` path is given, the default is the **`<original-stem>.healed.ad` sibling**: the original script's
899899
path with its `.ad` extension replaced by `.healed.ad` (e.g. `flows/login.ad` → `flows/login.healed.ad`),
@@ -943,7 +943,7 @@ a separate naming change, not part of this decision.
943943

944944
**Scope: this refusal is uniform across repair AND ordinary recording, not repair-only.** Everything
945945
above is written in the context of decision 6's repair-armed heal, but `publishHealedScriptAtomically`
946-
(`packages/daemon/src/session-script-writer.ts`) is the single publish primitive `SessionScriptWriter.write` calls
946+
(`packages/daemon/src/core/session-script-writer.ts`) is the single publish primitive `SessionScriptWriter.write` calls
947947
for every `--save-script` target, with no repair-armed-vs-ordinary branch — a repair-armed heal
948948
(`saveScriptBoundary` set) and an ordinary, non-repair `open --save-script`/`close --save-script`
949949
recording (`saveScriptBoundary` absent) publish through the exact same exclusive `linkSync`. Before this
@@ -1002,10 +1002,10 @@ The tombstone itself expires after its bounded window, after which the key is fu
10021002
> Provenance travels as `internal.replayPlanStep`, stamped by `invokeResolvedReplayAction`
10031003
> (`src/daemon/handlers/session-replay-action-runtime.ts`) — the single point every plan step is
10041004
> dispatched, so the marker covers annotated and unannotated steps alike. `internal` is a daemon-only
1005-
> channel (`toDaemonRequest`, `packages/daemon/src/server/http-rpc-methods.ts`, never copies it off the wire), so
1005+
> channel (`toDaemonRequest`, `packages/daemon/src/server/http/http-rpc-methods.ts`, never copies it off the wire), so
10061006
> authored provenance cannot be spoofed by a client; this is the same channel `replayTargetGuard` and
10071007
> `findResolvedTarget` already use. The rule is written once, in `isInteractiveObservation`
1008-
> (`packages/daemon/src/session-action-recorder.ts`), and both recording call sites consume it.
1008+
> (`packages/daemon/src/core/session-action-recorder.ts`), and both recording call sites consume it.
10091009
>
10101010
> **2. The corrective-read trap: why even out-of-band reads need an opt-in.** Excluding every out-of-band
10111011
> read is still not safe on its own: a divergence's **correction** can itself be a read. In the wave-3 E3 drift, the diverged step **was** a `get`, so its corrective replacement is a
@@ -1044,11 +1044,11 @@ The tombstone itself expires after its bounded window, after which the key is fu
10441044
>
10451045
> **4. How the rule projects across CLI/Node/MCP surfaces.** The exclusion is enforced at a single
10461046
> daemon-side choke point — `isExcludedRepairSegmentObservation` in `recordActionEntry`
1047-
> (`packages/daemon/src/session-action-recorder.ts`), gated on `session.saveScriptBoundary !== undefined` (set ONLY
1047+
> (`packages/daemon/src/core/session-action-recorder.ts`), gated on `session.saveScriptBoundary !== undefined` (set ONLY
10481048
> by a repair-armed `replay --save-script`; an ordinary, non-repair `open --save-script`/`close --save-script`
10491049
> authoring recording never sets it — see decision 6's "Scope" note above) and on the entry's
10501050
> `interactiveObservation` marker, which both recording call sites
1051-
> (`packages/daemon/src/selector-recording.ts` for `get`/`is`/read-only `find`, `packages/daemon/src/snapshot-runtime.ts` for
1051+
> (`packages/daemon/src/core/selector-recording.ts` for `get`/`is`/read-only `find`, `packages/daemon/src/sessions/snapshot-runtime.ts` for
10521052
> `snapshot`) compute from the shared `isInteractiveObservation` predicate rather than each re-deriving it.
10531053
> Every surface reaches this same function because every surface's request reaches the same daemon.
10541054
>
@@ -1159,8 +1159,8 @@ above and the gates they name are the authoritative record of current behavior.
11591159

11601160
At acceptance, replay was deterministic. `.ad` scripts were plain text — one action per line, `#`
11611161
comments, and a `context platform=... device=... theme=...` header (`src/replay/script.ts`) — recorded
1162-
via `open --save-script` (`packages/daemon/src/session-action-recorder.ts`,
1163-
`packages/daemon/src/session-script-writer.ts`) or hand-written, and executed step-by-step by
1162+
via `open --save-script` (`packages/daemon/src/core/session-action-recorder.ts`,
1163+
`packages/daemon/src/core/session-script-writer.ts`) or hand-written, and executed step-by-step by
11641164
`runReplayScriptFile`
11651165
(`src/daemon/handlers/session-replay-runtime.ts`) under the daemon's `replay`/`test` commands
11661166
(`src/daemon/handlers/session-replay.ts`). Recorded touch/fill/get targets are selector chains with
@@ -1289,15 +1289,15 @@ both `.ad` and Maestro paths) grounds the same conclusions from the caller's sea
12891289
"Retry with --debug and inspect diagnostics log for details." (`defaultHintForCode`,
12901290
`src/kernel/errors.ts:253-254`).
12911291
- **Recordings contain zero verification steps.** The script writer strips every recorded `snapshot`
1292-
action (`buildOptimizedActions`, `packages/daemon/src/session-script-writer.ts:315`: `if (action.command ===
1292+
action (`buildOptimizedActions`, `packages/daemon/src/core/session-script-writer.ts:315`: `if (action.command ===
12931293
'snapshot') continue;` — only synthetic ref-scoped snapshots are re-inserted, as resolution aids, not
12941294
observations), and the record-time flag allowlist (`RECORDED_FLAG_KEYS` from the flag
1295-
declarations' `recorded` field, `packages/daemon/src/session-action-recorder.ts:367-381`) carries neither `settle`/`settleQuietMs` nor `verify`,
1295+
declarations' `recorded` field, `packages/daemon/src/core/session-action-recorder.ts:367-381`) carries neither `settle`/`settleQuietMs` nor `verify`,
12961296
so `--settle`/`--verify` are dropped from recorded steps. A recording therefore replays actions with
12971297
no outcome observation at all — exactly the gap decision 3's record-time identity evidence fills.
12981298

12991299
A related, currently under-used precedent: recorded `@ref` steps already carry an optional identity
1300-
hint in the `.ad` file. `appendRefLabel` (`packages/daemon/src/session-script-writer.ts:532-537`) writes the
1300+
hint in the `.ad` file. `appendRefLabel` (`packages/daemon/src/core/session-script-writer.ts:532-537`) writes the
13011301
node's label as a trailing token, parsed back into `action.result.refLabel`
13021302
(`src/replay/script.ts:269,295,315`). Today that label is used only as a fallback LOOKUP key
13031303
(`tryResolveRefNode`'s `fallbackLabel`, `resolution.ts:393,413-430`) when the ref itself fails to

‎docs/adr/0014-session-ref-frame-lifetime.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ref-frame vocabulary is promoted into `CONTEXT.md`.
2020
issuance scope) — kept separate from the latest operational observation (`session.snapshot`).
2121
The frame is one value on `SessionState`, replaced whole by a transition and never edited in
2222
place; its type is nominal (`#`-private fields), so no module outside
23-
`packages/daemon/src/ref-frame.ts` can construct a frame, edit one, or derive one from an existing
23+
`packages/daemon/src/core/ref-frame.ts` can construct a frame, edit one, or derive one from an existing
2424
frame. What the type cannot judge is a whole frame moved unchanged — clearing the field, or
2525
assigning another session's frame — which the field-owner gate still covers.
2626
- A complete snapshot activates an `all` frame; `find`, settled diffs, and replay divergence

‎docs/adr/0016-active-session-script-publication.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Status
44

5-
Accepted; implemented on `main` (`packages/daemon/src/handlers/session-script-publication.ts`,
6-
`packages/daemon/src/session-script-active-publication.ts`), including the #1349 identity-level
5+
Accepted; implemented on `main` (`packages/daemon/src/sessions/handlers/session-script-publication.ts`,
6+
`packages/daemon/src/core/session-script-active-publication.ts`), including the #1349 identity-level
77
destination-guard amendment.
88

99
## Rules at a glance

0 commit comments

Comments
 (0)