Skip to content

Commit 557cbd6

Browse files
committed
fix(contracts): keep the fold coordinate-space constant off the CLI closure
FOLD_SCREEN_COORDINATE_SPACE lived in fold-runtime.ts, a module the CLI closure did not otherwise load. Importing it directly from src/commands/system/index.ts pulled fold-runtime.ts (and its own dependents) into cli.ts's eager import graph, tripping the eager-closure-budgets gate (295 -> 296 modules). Move the constant to device-rotation.ts, which the same file already loads via the @agent-device/contracts/device facade for DEVICE_ROTATIONS/FOLD_POSES, and re-export it from the device facade so importers reach it there. fold-runtime.ts keeps only a type-only import of the new FoldScreenCoordinateSpace type alias for FoldScreenReport's field, so its own eager closure does not grow either; its one runtime value consumer (platform-apple's fold pose runtime) now takes the constant from the device facade it already imports.
1 parent 110cb57 commit 557cbd6

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎packages/contracts/src/device-rotation.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { AppError } from '@agent-device/kernel/errors';
22

3+
/** Single source of truth for the discriminator the Apple owner sets and the MCP schema advertises. */
4+
export const FOLD_SCREEN_COORDINATE_SPACE = 'native-panel' as const;
5+
export type FoldScreenCoordinateSpace = typeof FOLD_SCREEN_COORDINATE_SPACE;
6+
37
export const DEVICE_ROTATIONS = [
48
'portrait',
59
'portrait-upside-down',

‎packages/contracts/src/facades/device.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export type {
3131
export {
3232
DEVICE_ROTATIONS,
3333
DEVICE_ROTATION_SURFACE_INDEX,
34+
FOLD_SCREEN_COORDINATE_SPACE,
3435
MAX_FOLD_DURATION_MS,
3536
MAX_FOLD_KEYFRAMES,
3637
parseFoldInput,
@@ -47,6 +48,7 @@ export type {
4748
DeviceRotation,
4849
FoldPose,
4950
FoldKeyframe,
51+
FoldScreenCoordinateSpace,
5052
SetFoldPoseInput,
5153
} from '../device-rotation.ts';
5254
export type { BootCommandResult, ShutdownCommandResult } from '../device.ts';

‎packages/contracts/src/fold-runtime.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
import type { FoldPose, SetFoldPoseInput } from './device-rotation.ts';
1+
import type { FoldPose, FoldScreenCoordinateSpace, SetFoldPoseInput } from './device-rotation.ts';
22
import type { RuntimeOperationFact } from './platform-runtime.ts';
33

4-
/** Single source of truth for the discriminator the Apple owner sets and the MCP schema advertises. */
5-
export const FOLD_SCREEN_COORDINATE_SPACE = 'native-panel' as const;
6-
74
/**
85
* The panel the device lights after the pose settled, in that panel's own native points: its pixel
96
* size divided by its point scale, never rotated. `coordinateSpace` is always
10-
* {@link FOLD_SCREEN_COORDINATE_SPACE}, and these numbers are NOT snapshot coordinates — the active
7+
* {@link FoldScreenCoordinateSpace}, and these numbers are NOT snapshot coordinates — the active
118
* app window can differ from the panel (iPhone Duo: a 669x951 inner panel hosts a 951x669 app
129
* window), so they cannot place a tap. A caller that needs the app viewport must take a fresh
1310
* snapshot.
@@ -16,7 +13,7 @@ export type FoldScreenReport = Readonly<{
1613
/** The CoreDevice display name of the panel the device now lights. */
1714
display: string;
1815
/** Marks these dimensions as the panel's native points, never a snapshot's app viewport. */
19-
coordinateSpace: typeof FOLD_SCREEN_COORDINATE_SPACE;
16+
coordinateSpace: FoldScreenCoordinateSpace;
2017
widthPt: number;
2118
heightPt: number;
2219
}>;

‎packages/platform-apple/src/foldable/pose.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import {
22
type SetFoldPoseInput,
33
foldPoseForHingeAngle,
4+
FOLD_SCREEN_COORDINATE_SPACE,
45
type FoldPose,
56
} from '@agent-device/contracts/device';
6-
import {
7-
FOLD_SCREEN_COORDINATE_SPACE,
8-
type FoldScreenReport,
9-
type SetFoldPoseResult,
10-
} from '@agent-device/contracts/fold-runtime';
7+
import type { FoldScreenReport, SetFoldPoseResult } from '@agent-device/contracts/fold-runtime';
118
import type { DeviceInfo } from '@agent-device/kernel/device';
129
import { AppError } from '@agent-device/kernel/errors';
1310
import { emitDiagnostic } from '@agent-device/host-kit/diagnostics';

0 commit comments

Comments
 (0)