Skip to content

Commit 75b414a

Browse files
authored
refactor(move): runtime assembly pair into command-runtime (#3294) (#3299)
* refactor(move): move the runtime assembly pair into the command-runtime folder createAgentDeviceRuntime and the command-surface binding over it are the in-process runtime assembly #3288 already classifies as command-runtime. They now live under src/command-runtime/, where topFolder derives that zone from the folder instead of per-file ROOT_MODULE_ZONES rows. Both files move as one group: the surface file composes the factory's result, and neither is importable from the other's consumers separately. Importers (src/runtime.ts and the daemon runtime modules) re-point. * docs(adr): record the runtime assembly pair as moved with its PR link The rows and prose claim only this change's collocation; the diagnostics-scope wording inherited from #3297 is left untouched. * chore(gates): drop the moved runtime assembly rows from ROOT_MODULE_ZONES Both files now live under src/command-runtime/, so topFolder derives their command-runtime zone from the folder and the per-file rows are redundant. The drift test proves the declaration matches the tree; the fallow comment follows the moved factory path.
1 parent 8c5bce0 commit 75b414a

11 files changed

Lines changed: 23 additions & 23 deletions

‎.fallowrc.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@
562562
]
563563
},
564564
{
565-
"comment": "src/runtime.ts keeps its published type surface while its implementation moves to src/runtime-factory.ts (#2540). These two re-exports have no in-repo consumer; they stay so the module's exported shape is unchanged.",
565+
"comment": "src/runtime.ts keeps its published type surface while its implementation moves to src/command-runtime/runtime-factory.ts (#2540, #3294). These two re-exports have no in-repo consumer; they stay so the module's exported shape is unchanged.",
566566
"file": "src/runtime.ts",
567567
"exports": ["CommandPolicy", "CommandSessionRecord"]
568568
}

‎docs/adr/0033-collocation-decision-table.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ already owns the operations behind the vocabulary.
121121
`platform-runtime` rank 4, …) while leaving the files physically in place. Per the maintainer
122122
design decision, that reclassification is **not** completed collocation: the physical moves under
123123
#3294 (child of #3276) replace each file's row with folder-derived ownership.
124-
`daemon-diagnostics-scope.ts` has moved into `src/daemon-contracts/`; `runtime-command-surface.ts`
125-
and `runtime-factory.ts` remain outstanding. The other rows below are keeps: the
124+
`daemon-diagnostics-scope.ts` has moved into `src/daemon-contracts/`; the runtime assembly pair
125+
`runtime-command-surface.ts` / `runtime-factory.ts` has moved into `src/command-runtime/`.
126+
The other rows below are keeps: the
126127
daemon ⇄ client shared files (`daemon-policy-file.ts`, `provider-credential-fingerprint.ts`,
127128
`request-progress-protocol.ts`) trace to #2559, which relocated the shared contracts **to the
128129
process root** so the client stops importing `src/daemon/` at all; R78 keeps any client→daemon
@@ -143,8 +144,8 @@ constrain a relocation, they are not independent proof the placement is optimal.
143144
| `src/provider-credential-fingerprint.ts` | keep | Daemon ⇄ client shared contract from the same #2559 decision as `daemon-policy-file.ts`; #3288 declares its zone beside the provider composition that reads the credentials it fingerprints. |
144145
| `src/provider-limrun-runtime.ts` | keep | Proposed → provider-limrun, but there is no seam: the class's constructor self-builds the root dependency factory (`src/sdk/limrun-runtime-dependencies.ts`), which is the ADR 0019 composition seam — it loads the root's adb-host binder, core Android interactor, and platform-runtime app-state helpers that the package must not import. Moving the class means moving that composition, which is design, not a move. |
145146
| `src/request-progress-protocol.ts` | keep | Daemon ⇄ client shared contract from the same #2559 decision — the client reads it statically (`daemon-client-progress.ts`) and the server through `src/daemon/server/`, so only #2559's shared-placement boundary and the wire-compat ledgers pin it; declared `daemon-contracts` by #3288. Contracts was considered and R18 keeps contracts free of envelope validation mechanics. |
146-
| `src/runtime-command-surface.ts` | move (outstanding, #3294) | Confirmed as an outstanding physical move, not reconsidered. Importers: `src/runtime.ts` (static) and daemon runtime modules; #3288's `command-runtime` assignment classifies it only — #3294 owns the physical move and the `ROOT_MODULE_ZONES` row deletion. |
147-
| `src/runtime-factory.ts` | move (outstanding, #3294) | Same: statically imported by `src/runtime.ts` and two daemon modules; outstanding physical move tracked by #3294. |
147+
| `src/runtime-command-surface.ts` | moved → `src/command-runtime/runtime-command-surface.ts` ([#3299](https://github.com/callstack/agent-device/pull/3299)) | Physical move landed with `runtime-factory.ts` as one assembly group: the command-surface binding sits beside the factory it composes, under the folder that derives its `command-runtime` zone, so `topFolder` replaces the per-file `ROOT_MODULE_ZONES` row. |
148+
| `src/runtime-factory.ts` | moved → `src/command-runtime/runtime-factory.ts` ([#3299](https://github.com/callstack/agent-device/pull/3299)) | Physical move landed: the runtime assembly now lives under the folder that derives its `command-runtime` zone, with the same row deletion through folder-derived ownership. |
148149

149150
### sdk
150151

@@ -167,10 +168,11 @@ files have no seam (published facade, public-type collision, root dependency fac
167168

168169
- Physical root-pass moves under [#3294](https://github.com/callstack/agent-device/issues/3294)
169170
(child of #3276): `daemon-diagnostics-scope.ts` has moved into `src/daemon-contracts/`
170-
([#3297](https://github.com/callstack/agent-device/pull/3297)); `runtime-command-surface.ts` and
171-
`runtime-factory.ts` remain **outstanding** under #3294. The folder derives its zone, replacing
172-
the moved file's `ROOT_MODULE_ZONES` row; #3288's zone assignment alone was classification, and
173-
this move completes that file's collocation.
171+
([#3297](https://github.com/callstack/agent-device/pull/3297)); the runtime assembly pair
172+
`runtime-command-surface.ts` / `runtime-factory.ts` is collocated in `src/command-runtime/`
173+
([#3299](https://github.com/callstack/agent-device/pull/3299)). Each folder derives its zone,
174+
replacing the moved files' `ROOT_MODULE_ZONES` rows; #3288's zone assignments alone were
175+
classification, and each landed move completes its own file's collocation.
174176

175177
## Refuted alternatives
176178

‎scripts/layering/root-module-zones.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ export const ROOT_MODULE_ZONES: Readonly<Record<string, readonly string[]>> = {
4040
'src/backend-snapshot-options.ts',
4141
'src/backend.ts',
4242
'src/io.ts',
43-
'src/runtime-command-surface.ts',
4443
'src/runtime-contract.ts',
45-
'src/runtime-factory.ts',
4644
'src/runtime.ts',
4745
],
4846
// The platform composition the daemon, CLI and SDK import eagerly. It shares the zone with its

src/runtime-command-surface.ts renamed to src/command-runtime/runtime-command-surface.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import {
33
bindSelectorCommands,
44
type BoundInteractionCommands,
55
type BoundSelectorCommands,
6-
} from './commands/interaction/runtime/index.ts';
6+
} from '../commands/interaction/runtime/index.ts';
77
import {
88
bindCaptureCommands,
99
type BoundCaptureCommands,
10-
} from './commands/capture/runtime/index.ts';
10+
} from '../commands/capture/runtime/index.ts';
1111
import { createAgentDeviceRuntime } from './runtime-factory.ts';
12-
import type { AgentDeviceRuntime, AgentDeviceRuntimeConfig } from './runtime-contract.ts';
12+
import type { AgentDeviceRuntime, AgentDeviceRuntimeConfig } from '../runtime-contract.ts';
1313

1414
/**
1515
* The command surface an in-process executor dispatches through: capture, selector reads and
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
CommandPolicy,
55
CommandSessionRecord,
66
CommandSessionStore,
7-
} from './runtime-contract.ts';
7+
} from '../runtime-contract.ts';
88

99
/**
1010
* Assembles an in-process runtime from its backend, artifact adapter, session store, policy and

‎src/daemon/interaction/internal/interaction-runtime.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
BackendActionResult,
77
BackendSnapshotResult,
88
} from '../../../backend.ts';
9-
import { createCommandSurfaceAgentDevice } from '../../../runtime-command-surface.ts';
9+
import { createCommandSurfaceAgentDevice } from '../../../command-runtime/runtime-command-surface.ts';
1010
import { getRequestSignal } from '@agent-device/host-kit/request';
1111
import type { Rect } from '@agent-device/kernel/snapshot';
1212
import type { DaemonCommandContext } from '../../context.ts';

‎src/daemon/runtime-policy.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { AgentDeviceRuntimeConfig } from '../runtime-contract.ts';
2-
import { localCommandPolicy } from '../runtime-factory.ts';
2+
import { localCommandPolicy } from '../command-runtime/runtime-factory.ts';
33
import { createUnsupportedArtifactAdapter } from './runtime-artifacts.ts';
44

55
export function createDaemonRuntimePolicy(

‎src/daemon/screenshot-runtime.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import os from 'node:os';
1515
import path from 'node:path';
1616
import type { AgentDeviceBackend } from '../backend.ts';
1717
import type { ArtifactAdapter } from '../io.ts';
18-
import { localCommandPolicy } from '../runtime-factory.ts';
19-
import { createCommandSurfaceAgentDevice } from '../runtime-command-surface.ts';
18+
import { localCommandPolicy } from '../command-runtime/runtime-factory.ts';
19+
import { createCommandSurfaceAgentDevice } from '../command-runtime/runtime-command-surface.ts';
2020
import {
2121
assertSupportedScreenshotPixelDensity,
2222
readScreenshotResultMetadata,

‎src/daemon/selector-runtime-backend.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
BackendSnapshotResult,
55
} from '../backend.ts';
66
import { resolveTargetDevice } from '@agent-device/device-selection/dispatch-resolve';
7-
import { createCommandSurfaceAgentDevice } from '../runtime-command-surface.ts';
7+
import { createCommandSurfaceAgentDevice } from '../command-runtime/runtime-command-surface.ts';
88
import { publicPlatformString } from '@agent-device/kernel/device';
99
import type { SnapshotState, SnapshotNode } from '@agent-device/kernel/snapshot';
1010
import { createDaemonRuntimePolicy } from './runtime-policy.ts';

‎src/daemon/snapshot-command-runtime.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { publicPlatformString } from '@agent-device/kernel/device';
99
import { AppError } from '@agent-device/kernel/errors';
1010
import type { AgentDeviceBackend, BackendSnapshotResult } from '../backend.ts';
1111
import type { CommandSessionRecord } from '../runtime-contract.ts';
12-
import { createCommandSurfaceAgentDevice } from '../runtime-command-surface.ts';
12+
import { createCommandSurfaceAgentDevice } from '../command-runtime/runtime-command-surface.ts';
1313
import { getRequestSignal } from '@agent-device/host-kit/request';
1414
import { maybeBuildAndroidSnapshotTimeoutFailure } from './android-snapshot-timeout-evidence.ts';
1515
import { captureSnapshot } from './snapshot-capture.ts';

0 commit comments

Comments
 (0)