peachsim 0.1.2762 → 0.1.2764

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/detox/index.ts +42 -2
  2. package/detox/proof-observer.ts +4 -0
  3. package/dist-lib/agent-daemon-client.cjs +1 -1
  4. package/dist-lib/agent-events.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +2 -2
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +5 -5
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +3 -3
  15. package/dist-lib/bundle-channel.cjs +60 -21
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +3 -3
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +3 -3
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +2 -2
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +7 -7
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/config.mjs +5 -5
  26. package/dist-lib/detox/index.cjs +29 -2
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/esm-chunks/{acorn-4S4QEKUH.mjs → acorn-P6GSYUBW.mjs} +3 -3
  29. package/dist-lib/esm-chunks/{chunk-YS66XSMK.mjs → chunk-3ZYHM2HA.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-4ZZTNTW6.mjs → chunk-6KSNVVTC.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-45RVUCLW.mjs → chunk-AP5YIIQM.mjs} +2 -2
  32. package/dist-lib/esm-chunks/{chunk-MLIC3NR6.mjs → chunk-B4676W6W.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-T5V72EHF.mjs → chunk-BHZZ6HY3.mjs} +6 -6
  34. package/dist-lib/esm-chunks/{chunk-HB43KEJO.mjs → chunk-CFZYMPZH.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-JE6KHJMR.mjs → chunk-DJRXI3MV.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-JLJPYBC6.mjs → chunk-DSRMRZLO.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-QYIAL2FW.mjs → chunk-ECWMAETO.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-TCCCICYM.mjs → chunk-EHRVGFTC.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-57UDPKKC.mjs → chunk-F2LGS5FX.mjs} +6 -6
  40. package/dist-lib/esm-chunks/{chunk-MALIBFAO.mjs → chunk-GF622ETF.mjs} +4 -4
  41. package/dist-lib/esm-chunks/{chunk-4QOZJQSQ.mjs → chunk-I2LXBHBV.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-LI5BVGTV.mjs → chunk-JHNBG6VU.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-AE56UCLG.mjs → chunk-LTSKSKKD.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-I4C62SOU.mjs → chunk-N3A2K3F3.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-XHAMWSZP.mjs → chunk-RA4YYWXZ.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-EXI2LBO5.mjs → chunk-RCJZKQAZ.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-HYSM5JUW.mjs → chunk-RHDDK6LA.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-JKFD7KTP.mjs → chunk-TDBGN3SP.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-XC7K5JYJ.mjs → chunk-TXWKYX3I.mjs} +5 -5
  50. package/dist-lib/esm-chunks/{chunk-GHCZN43N.mjs → chunk-VVLCV6KA.mjs} +3 -3
  51. package/dist-lib/esm-chunks/{chunk-IZ54ZJUN.mjs → chunk-YOVGPRMD.mjs} +1 -1
  52. package/dist-lib/esm-chunks/{chunk-EDTW6FEK.mjs → chunk-ZLLG2IAT.mjs} +39 -24
  53. package/dist-lib/esm-chunks/{metro-layout-parser-C245BQMH.mjs → metro-layout-parser-YQ2KF5TM.mjs} +3 -3
  54. package/dist-lib/esm-chunks/{swift-package-prebuilt-3CYV5L3E.mjs → swift-package-prebuilt-6MWRW7BU.mjs} +12 -12
  55. package/dist-lib/esm-chunks/{swift-sdk-app-module-EIWWG2YJ.mjs → swift-sdk-app-module-W4C26XYM.mjs} +47 -23
  56. package/dist-lib/esm-chunks/{swift-sdk-image-PTMGH6L6.mjs → swift-sdk-image-DLCQDKRO.mjs} +16 -16
  57. package/dist-lib/esm-chunks/{swift-sdk-image-producer-U5TYUU2Q.mjs → swift-sdk-image-producer-AYXDHRYM.mjs} +5 -5
  58. package/dist-lib/expo-swift-bundle.cjs +60 -21
  59. package/dist-lib/expo-swift-metadata.cjs +1 -1
  60. package/dist-lib/expo-swift-metadata.mjs +7 -7
  61. package/dist-lib/home-paths.cjs +1 -1
  62. package/dist-lib/host/bridge-host.cjs +60 -21
  63. package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
  64. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  65. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  66. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  67. package/dist-lib/host/websocket-proxy.cjs +1 -1
  68. package/dist-lib/index.cjs +1 -1
  69. package/dist-lib/kotlin-host.cjs +1 -1
  70. package/dist-lib/menu.cjs +1 -1
  71. package/dist-lib/menu.mjs +3 -3
  72. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  73. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  74. package/dist-lib/metro-production-bundle.cjs +1 -1
  75. package/dist-lib/metro-production-bundle.mjs +4 -4
  76. package/dist-lib/native-app-identity-project.cjs +1 -1
  77. package/dist-lib/native-app-identity-project.mjs +15 -15
  78. package/dist-lib/native-app-identity.cjs +1 -1
  79. package/dist-lib/native-app-identity.mjs +6 -6
  80. package/dist-lib/native-firebase-metadata.cjs +1 -1
  81. package/dist-lib/native-firebase-metadata.mjs +3 -3
  82. package/dist-lib/pdfium-raster.cjs +1 -1
  83. package/dist-lib/pdfium-raster.mjs +2 -2
  84. package/dist-lib/plist.cjs +1 -1
  85. package/dist-lib/plist.mjs +3 -3
  86. package/dist-lib/profiles.cjs +1 -1
  87. package/dist-lib/public-brand.cjs +1 -1
  88. package/dist-lib/public-origins-lib-esm.json +85 -85
  89. package/dist-lib/public-origins-lib.json +64 -64
  90. package/dist-lib/react-native-host-modules.cjs +1 -1
  91. package/dist-lib/react-native-host-modules.mjs +2 -2
  92. package/dist-lib/reap-browser.cjs +1 -1
  93. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  94. package/dist-lib/sdk.cjs +1 -1
  95. package/dist-lib/sdk.mjs +8 -8
  96. package/dist-lib/skills.cjs +60 -21
  97. package/dist-lib/swift-compile.cjs +57 -18
  98. package/dist-lib/swift-compile.mjs +12 -12
  99. package/dist-lib/swift-package.cjs +1 -1
  100. package/dist-lib/swift-package.mjs +3 -3
  101. package/dist-lib/swift-submit.cjs +1 -1
  102. package/dist-lib/swift-submit.mjs +6 -6
  103. package/dist-lib/swift-svg-raster.cjs +1 -1
  104. package/dist-lib/swift-svg-raster.mjs +2 -2
  105. package/dist-lib/swift-toolchain.cjs +1 -1
  106. package/dist-lib/swift.cjs +1 -1
  107. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  108. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  109. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  110. package/dist-lib/vendor/acorn.cjs +1 -1
  111. package/dist-lib/vendor/magic-string.cjs +1 -1
  112. package/dist-lib/vendor/stream-json.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  116. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  117. package/dist-lib/vendor/sucrase.cjs +1 -1
  118. package/dist-lib/vendor/terser.cjs +1 -1
  119. package/dist-lib/vendor/valibot.cjs +1 -1
  120. package/dist-lib/vendor/ws.cjs +1 -1
  121. package/dist-lib/vendor/zod.cjs +1 -1
  122. package/dist-lib/worklet-executable.cjs +1 -1
  123. package/dist-lib/worklet-executable.mjs +3 -3
  124. package/dist-types/packages/peach-engine/src/engine/native-node-queries.d.ts +2 -2
  125. package/dist-types/packages/peach-engine/src/engine/native-scene-program.d.ts +1 -2
  126. package/dist-types/packages/peach-engine/src/engine/scroll-physics-native.d.ts +0 -1
  127. package/dist-types/packages/peach-engine/src/render-worker/compositor-runtime/presentation-book-host.d.ts +1 -1
  128. package/dist-types/packages/peach-engine/src/render-worker/live-frame-mirror.d.ts +2 -4
  129. package/dist-types/packages/peach-engine/src/render-worker/scene-commit-ring.d.ts +9 -3
  130. package/package.json +1 -1
  131. package/src/one-native-controls-package.ts +14 -1
  132. package/src/swift-compile.ts +11 -1
  133. package/src/swift-guest-compile.ts +15 -7
  134. package/src/swift-sdk-app-module.ts +35 -7
  135. package/src/swiftSdkLinkContract.ts +6 -0
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2762 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2764 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2762 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2764 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2762 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2764 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,12 +1,12 @@
1
- /*! peach v0.1.2762 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2764 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  parse
4
- } from "./esm-chunks/chunk-QYIAL2FW.mjs";
4
+ } from "./esm-chunks/chunk-ECWMAETO.mjs";
5
5
  import {
6
6
  __privateAdd,
7
7
  __privateGet,
8
8
  __publicField
9
- } from "./esm-chunks/chunk-AE56UCLG.mjs";
9
+ } from "./esm-chunks/chunk-LTSKSKKD.mjs";
10
10
 
11
11
  // src/worklet-kernel.ts
12
12
  var Unsupported = class extends Error {
@@ -10,11 +10,11 @@ interface NativeNodeQueryHost {
10
10
  authoredClient(tag: number, liveOnly?: boolean): SootSimChild | undefined;
11
11
  authoredClients(): IterableIterator<SootSimChild>;
12
12
  collectText(slot: number): string;
13
- seedStyle(slot: number, style: SootSimStyle, resolve: (value: unknown) => unknown, layout: Readonly<Record<string, unknown>> | null): void;
13
+ seedStyle(slot: number, style: SootSimStyle, resolve: (value: unknown) => unknown): void;
14
14
  }
15
15
  export declare function bindNativeNodeQueries(value: NativeNodeQueryHost): void;
16
16
  export declare function nativeNodeInRoot(node: SootSimNode, root: SootSimNode): boolean;
17
- export declare function seedNativeSceneStyle(slot: number, style: SootSimStyle, resolve: (value: unknown) => unknown, layout: Readonly<Record<string, unknown>> | null): void;
17
+ export declare function seedNativeSceneStyle(slot: number, style: SootSimStyle, resolve: (value: unknown) => unknown): void;
18
18
  export declare function hasMirroredResponderHandler(node: SootSimNode, key?: string): boolean;
19
19
  export declare function nodeStyle(node: SootSimNode): Record<string, any>;
20
20
  export declare function isSootSimNode(node: unknown): node is SootSimNode;
@@ -1,5 +1,5 @@
1
1
  import type { SceneNativeBinding } from './scene-native-binding.d.ts';
2
- import type { SootSimStyle, ParsedFilterOp } from './types.d.ts';
2
+ import type { ParsedFilterOp } from './types.d.ts';
3
3
  export declare function compileNativeSceneProgram(native: SceneNativeBinding, template: Record<string, unknown>, slotIds: readonly number[], folded: readonly string[], heldInsets: readonly string[], laneRef: (lane: number, unit?: string) => unknown): SceneLaneProgram | string;
4
4
  declare class SceneLaneReader {
5
5
  readonly lane: number;
@@ -24,6 +24,5 @@ export interface SceneLaneProgram {
24
24
  }
25
25
  export declare function compileSceneLaneProgram(native: SceneNativeBinding, template: Record<string, unknown>, slotIds: readonly number[], foldedGlassKeys?: readonly string[], heldInsets?: readonly string[]): SceneLaneProgram | string;
26
26
  export declare function readSceneLaneValues(words: () => Float64Array, slot: number, program: SceneLaneProgram, programId: number): Record<string, unknown>;
27
- export declare function seedPresentationStyle(slot: number, style: SootSimStyle, program: SceneLaneProgram, resolve: (value: unknown) => unknown): void;
28
27
  export declare function laneStyleValues(slot: number, program: SceneLaneProgram, programId: number): Record<string, unknown>;
29
28
  export {};
@@ -4,7 +4,6 @@ import type { NativeValueAddress, NativeValueModule } from './native-value.d.ts'
4
4
  import type { NativeAuthoredClockBinding } from './touch/types.d.ts';
5
5
  export interface ScrollPhysicsNative extends NativeAuthoredClockBinding, NativeValueModule, NativeMemory {
6
6
  _peach_scroll_anchor_index(address: number, count: number, minimum: number, horizontal: number, offset: number): number;
7
- peachScrollTrackerStep?: (handle: number) => void;
8
7
  peachScrollHost?: (host: number, op: number, address: number) => number;
9
8
  _peach_shell_scroll_create(tracker: number): number;
10
9
  _peach_shell_scroll_input(words: number): number;
@@ -33,7 +33,7 @@ export interface PresentationBookImports extends NativeValueModule {
33
33
  peach_presentation_lane_inset_names?: (client: number) => number;
34
34
  peach_presentation_inset_samples?: (host: number, node: number, needed: number) => number;
35
35
  peach_presentation_inset_controlled?: (client: number, index: number) => number;
36
- peach_presentation_lane_seed?: (host: number, client: number, node: number) => void;
36
+ peach_presentation_lane_seed?: (host: number, node: number) => void;
37
37
  peach_presentation_lane_android?: (host: number) => number;
38
38
  peach_presentation_lane_values?: (host: number, client: number, node: number, id: number) => number;
39
39
  peach_presentation_lane_readers?: (host: number, client: number, node: number, id: number, command: NativeValueAddress<ReaderCommand>) => number;
@@ -1,4 +1,5 @@
1
1
  import { type ImageFrameSource } from './image-pixel-contract.d.ts';
2
+ import { type SceneCommitRing } from './scene-commit-ring.d.ts';
2
3
  import type { WebGpuWireFromRenderer, WebGpuWireToRenderer } from './webgpu-wire-protocol.d.ts';
3
4
  export interface RemoteLiveFrameIdentity {
4
5
  sessionId: string;
@@ -15,10 +16,7 @@ export type LiveFrameMirrorEnvelope = {
15
16
  export interface TenantLiveFramePort {
16
17
  port: MessagePort;
17
18
  presented: SharedArrayBuffer | null;
18
- sceneRing?: {
19
- memory: WebAssembly.Memory;
20
- epoch: number;
21
- };
19
+ sceneRing?: SceneCommitRing;
22
20
  }
23
21
  export declare function readTenantLiveFramePort(message: object): TenantLiveFramePort | null;
24
22
  export type LiveFramePortMessage = WebGpuWireToRenderer | {
@@ -1,5 +1,11 @@
1
1
  import type { FrameCopyBoundary } from '../../../peach-globals/src/frameBreakdownContract.d.ts';
2
- export declare function allocateSceneCommitRing(): WebAssembly.Memory | undefined;
2
+ export interface SceneCommitRing {
3
+ memory: WebAssembly.Memory;
4
+ address: number;
5
+ epoch: number;
6
+ }
7
+ export declare function readSceneCommitRing(value: unknown): SceneCommitRing | undefined;
8
+ export declare function allocateSceneCommitRing(epoch: number): SceneCommitRing | undefined;
3
9
  export declare class SceneCommitWriter {
4
10
  private readonly table;
5
11
  private readonly reservePacket;
@@ -10,7 +16,7 @@ export declare class SceneCommitWriter {
10
16
  private released;
11
17
  private reserved;
12
18
  readonly slot: number;
13
- constructor(memory: WebAssembly.Memory);
19
+ constructor(ring: SceneCommitRing);
14
20
  reserve(): number;
15
21
  publish(size: number): number;
16
22
  waitForSpace(): Promise<void> | undefined;
@@ -31,7 +37,7 @@ export declare class SceneCommitReader {
31
37
  private readonly pull;
32
38
  private readonly discard;
33
39
  private readonly boundary;
34
- constructor(memory: WebAssembly.Memory, realm: 'compositor' | 'shell');
40
+ constructor(ring: SceneCommitRing, realm: 'compositor' | 'shell');
35
41
  consume(packet: RingScenePacket, apply: () => void): void;
36
42
  }
37
43
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2762",
3
+ "version": "0.1.2764",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -2231,6 +2231,11 @@ export async function stageOneNativeControlsRelease(
2231
2231
  metadata: SwiftEntryModuleArgs
2232
2232
  files: Map<string, Blob>
2233
2233
  oneSDKModules?: string[]
2234
+ appLink?: {
2235
+ bytes: Buffer
2236
+ sdkSha256: string
2237
+ rawBindingSha256: string
2238
+ }
2234
2239
  }> {
2235
2240
  const {
2236
2241
  packagePath,
@@ -2258,5 +2263,13 @@ export async function stageOneNativeControlsRelease(
2258
2263
  ONE_NATIVE_CONTROLS_PACKAGE,
2259
2264
  metadata,
2260
2265
  )
2261
- return { packagePath, metadataPath, metadata, files, oneSDKModules }
2266
+ const image = projectFor(packagePath).artifacts.find(
2267
+ ({ hash }) => hash === metadata.hash,
2268
+ )?.sdk
2269
+ const appLink = image?.binding.appLink && {
2270
+ bytes: image.binding.appLink,
2271
+ sdkSha256: image.sha256,
2272
+ rawBindingSha256: image.binding.sha256,
2273
+ }
2274
+ return { packagePath, metadataPath, metadata, files, oneSDKModules, appLink }
2262
2275
  }
@@ -5871,10 +5871,16 @@ function readCompiledArtifact(
5871
5871
  const liveSlots = readFileSync(path.join(directory, 'sdk-live-slots.bin'))
5872
5872
  if (createHash('sha256').update(liveSlots).digest('hex') !== image.liveSlots)
5873
5873
  return null
5874
+ const appLink =
5875
+ typeof image.appLink === 'string'
5876
+ ? readFileSync(path.join(directory, 'app-link.json.gz'))
5877
+ : undefined
5878
+ if (appLink && createHash('sha256').update(appLink).digest('hex') !== image.appLink)
5879
+ return null
5874
5880
  const sdk: SwiftSdkModuleAsset = {
5875
5881
  key: image.key,
5876
5882
  sha256: image.sha256,
5877
- binding: { bytes: binding, sha256: image.binding, liveSlots },
5883
+ binding: { bytes: binding, sha256: image.binding, liveSlots, appLink },
5878
5884
  }
5879
5885
  return { hash, bytes, icu: { sha256: receipt.icu, gzip }, sdk }
5880
5886
  } catch (error) {
@@ -5892,6 +5898,8 @@ function saveCompiledArtifact(root: string, artifact: SwiftCompileArtifact): voi
5892
5898
  mkdirSync(directory, { recursive: true })
5893
5899
  const pending = mkdtempSync(path.join(root, '.artifact-'))
5894
5900
  try {
5901
+ const appLink = artifact.sdk?.binding.appLink
5902
+ if (appLink) writeFileSync(path.join(pending, 'app-link.json.gz'), appLink)
5895
5903
  writeFileSync(path.join(pending, 'app.wasm'), artifact.bytes)
5896
5904
  writeFileSync(path.join(pending, 'icu.gz'), artifact.icu.gzip)
5897
5905
  if (artifact.sdk) {
@@ -5911,6 +5919,7 @@ function saveCompiledArtifact(root: string, artifact: SwiftCompileArtifact): voi
5911
5919
  key: artifact.sdk.key,
5912
5920
  sha256: artifact.sdk.sha256,
5913
5921
  binding: artifact.sdk.binding.sha256,
5922
+ appLink: appLink && createHash('sha256').update(appLink).digest('hex'),
5914
5923
  liveSlots: createHash('sha256')
5915
5924
  .update(artifact.sdk.binding.liveSlots)
5916
5925
  .digest('hex'),
@@ -5921,6 +5930,7 @@ function saveCompiledArtifact(root: string, artifact: SwiftCompileArtifact): voi
5921
5930
  // both content digests unless they contain this exact verified result.
5922
5931
  const outputs = ['app.wasm', 'icu.gz']
5923
5932
  if (artifact.sdk) outputs.push('sdk-binding.bin', 'sdk-live-slots.bin')
5933
+ if (appLink) outputs.push('app-link.json.gz')
5924
5934
  for (const file of [...outputs, 'artifact.json']) {
5925
5935
  renameSync(path.join(pending, file), path.join(directory, file))
5926
5936
  }
@@ -547,6 +547,7 @@ export async function compileGuestLink(options: {
547
547
  linkSwiftAppModule,
548
548
  readSwiftSdkUsage,
549
549
  swiftAppModuleThunkSection,
550
+ swiftSdkProjectionDigest,
550
551
  swiftSdkProjectionSpans,
551
552
  writeSwiftSdkAppLink,
552
553
  } = await import('./swift-sdk-app-module')
@@ -717,16 +718,23 @@ export async function compileGuestLink(options: {
717
718
  swiftAppModuleThunkSection(finalized.wasm),
718
719
  ]),
719
720
  )
720
- if (!project) {
721
- const replayDirectory = path.join(options.buildDirectory, '.peach-sdk-module')
722
- mkdirSync(replayDirectory, { recursive: true })
723
- writeSwiftSdkAppLink(path.join(replayDirectory, 'app-link.json.gz'), {
721
+ if (project) return binding
722
+ const replayDirectory = path.join(options.buildDirectory, '.peach-sdk-module')
723
+ mkdirSync(replayDirectory, { recursive: true })
724
+ const appLink = writeSwiftSdkAppLink(
725
+ path.join(replayDirectory, 'app-link.json.gz'),
726
+ {
724
727
  linkage,
725
728
  usage,
726
729
  scopedLookups: true,
727
- })
728
- }
729
- return binding
730
+ sdkProjection: {
731
+ objects: [...sdkObjectImages],
732
+ products: [...sdkProductImages],
733
+ layoutSha256: swiftSdkProjectionDigest(sdkSpans),
734
+ },
735
+ },
736
+ )
737
+ return { ...binding, appLink }
730
738
  }
731
739
  } finally {
732
740
  if (result.finalLinkDone) await Promise.allSettled([result.finalLinkDone])
@@ -137,13 +137,13 @@ export async function buildSwiftAppModule(options: {
137
137
  throw error
138
138
  }
139
139
  await lowerPromise
140
- if (!project)
141
- writeSwiftSdkAppLink(path.join(work, 'app-link.json.gz'), {
142
- linkage: link.linkage,
143
- usage,
144
- })
145
140
  finishSwiftAppModuleFile(options.output)
146
- return binding
141
+ if (project) return binding
142
+ const appLink = writeSwiftSdkAppLink(path.join(work, 'app-link.json.gz'), {
143
+ linkage: link.linkage,
144
+ usage,
145
+ })
146
+ return { ...binding, appLink }
147
147
  }
148
148
 
149
149
  export function swiftAppModuleThunkSection(
@@ -1301,7 +1301,9 @@ const SCANNED = new Set([
1301
1301
  const RUN_GAP = 64
1302
1302
 
1303
1303
  export function writeSwiftSdkAppLink(file: string, link: SwiftSdkAppLink) {
1304
- writeFileSync(file, gzipSync(JSON.stringify(link), { level: 1 }))
1304
+ const bytes = gzipSync(JSON.stringify(link), { level: 1 })
1305
+ writeFileSync(file, bytes)
1306
+ return bytes
1305
1307
  }
1306
1308
 
1307
1309
  export function readSwiftSdkAppLink(file: string): SwiftSdkAppLink {
@@ -1397,6 +1399,32 @@ export function swiftSdkProjectionSpans(
1397
1399
  return spans
1398
1400
  }
1399
1401
 
1402
+ export function swiftSdkProjectionDigest(spans: readonly GuestLinkedSpan[]): string {
1403
+ const ordered = [...spans].sort(
1404
+ (left, right) =>
1405
+ left.image - right.image ||
1406
+ left.space.localeCompare(right.space) ||
1407
+ left.address - right.address ||
1408
+ left.length - right.length,
1409
+ )
1410
+ return createHash('sha256').update(JSON.stringify(ordered)).digest('hex')
1411
+ }
1412
+
1413
+ export function assertSwiftSdkReplayLayout(link: SwiftSdkAppLink, sdk: SwiftSdkImage) {
1414
+ const projection = link.sdkProjection
1415
+ if (!projection) return
1416
+ const objects = new Map(projection.objects)
1417
+ const products = new Map(projection.products)
1418
+ const spans = swiftSdkProjectionSpans(
1419
+ sdk,
1420
+ (object, product) => objects.get(object) ?? products.get(product),
1421
+ )
1422
+ if (swiftSdkProjectionDigest(spans) !== projection.layoutSha256)
1423
+ throw new Error(
1424
+ 'SDK image changes the retained app’s projected memory or table ownership',
1425
+ )
1426
+ }
1427
+
1400
1428
  /**
1401
1429
  * the sdk data an app uses, as runs the loader writes before the sdk instantiates: the data
1402
1430
  * pieces its pruned link keeps, their transitive dependencies, the live swift record table and
@@ -29,12 +29,18 @@ export interface SwiftSdkAppLink {
29
29
  readonly linkage: SwiftSdkAppLinkage
30
30
  readonly usage: SwiftSdkUsage
31
31
  readonly scopedLookups?: boolean
32
+ readonly sdkProjection?: {
33
+ readonly objects: readonly (readonly [string, number])[]
34
+ readonly products: readonly (readonly [string, number])[]
35
+ readonly layoutSha256: string
36
+ }
32
37
  }
33
38
 
34
39
  export interface SwiftSdkBindingAsset {
35
40
  readonly sha256: string
36
41
  readonly bytes: Buffer
37
42
  readonly liveSlots: Buffer
43
+ readonly appLink?: Buffer
38
44
  }
39
45
 
40
46
  export interface SwiftSdkModuleAsset {