peachsim 0.1.2477 → 0.1.2479
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.
- package/cli/agent-note.ts +14 -0
- package/cli/command-agent.ts +2 -0
- package/cli/commands/control.ts +6 -3
- package/cli/commands/stream.ts +40 -13
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +2 -2
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +5 -5
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +3 -3
- package/dist-lib/bundle-channel.cjs +5465 -5123
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +3 -3
- package/dist-lib/cloud-contract.cjs +2 -1
- package/dist-lib/cloud-contract.mjs +3 -3
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +2 -2
- package/dist-lib/cloud.cjs +2 -1
- package/dist-lib/cloud.mjs +7 -7
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +5 -5
- package/dist-lib/detox/index.cjs +5 -2
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/esm-chunks/{acorn-4HUH3ELI.mjs → acorn-6T74WJEH.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-5JLFMFUF.mjs → chunk-2LPGM53Y.mjs} +2 -1
- package/dist-lib/esm-chunks/{chunk-FSO65QED.mjs → chunk-3ZA6FTBR.mjs} +1 -1
- package/dist-lib/esm-chunks/chunk-AEZPI62A.mjs +1475 -0
- package/dist-lib/esm-chunks/{chunk-4YZ3OAE4.mjs → chunk-AYJWQFTP.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ZYOVIBJC.mjs → chunk-BZT6SR75.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-U7FCROUI.mjs → chunk-C4R3TCHX.mjs} +3 -3
- package/dist-lib/esm-chunks/{chunk-TDGYE3LD.mjs → chunk-D7WY4WGU.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GIQYZ6ZF.mjs → chunk-FNLQ2DEH.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-GIYXQPSW.mjs → chunk-G4WYTA67.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-TTLRUKIC.mjs → chunk-GPU6YJ5I.mjs} +10 -8
- package/dist-lib/esm-chunks/{chunk-FDUWENW3.mjs → chunk-IHHNYCWO.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-V62JSITY.mjs → chunk-MQX3VV72.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-BMBCN4GH.mjs → chunk-OER7EEIH.mjs} +37 -7
- package/dist-lib/esm-chunks/{chunk-DGRSBSGJ.mjs → chunk-PFCYY52I.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-EUJUDXGT.mjs → chunk-QHX5XHZQ.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-LUKNK67S.mjs → chunk-R2TIEVD6.mjs} +2 -2
- package/dist-lib/esm-chunks/{chunk-H6XY7V2J.mjs → chunk-RQYBISJH.mjs} +4 -4
- package/dist-lib/esm-chunks/{chunk-Y43XZHN5.mjs → chunk-TVVDHHO3.mjs} +2059 -3500
- package/dist-lib/esm-chunks/{chunk-XHVKSOC4.mjs → chunk-UWPIIUE4.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-ILDKGIWE.mjs → chunk-V4TJGQ5E.mjs} +1 -1
- package/dist-lib/esm-chunks/{chunk-4G7Z5PSE.mjs → chunk-XWTX6G5Q.mjs} +1 -1
- package/dist-lib/esm-chunks/{metro-layout-parser-KANGAXGA.mjs → metro-layout-parser-LMCYOPJD.mjs} +3 -3
- package/dist-lib/esm-chunks/{swift-package-prebuilt-RWY4PF5Y.mjs → swift-package-prebuilt-NSH43QDM.mjs} +10 -9
- package/dist-lib/esm-chunks/{swift-sdk-app-module-44XKCG3I.mjs → swift-sdk-app-module-RZ5BXP7S.mjs} +15 -13
- package/dist-lib/esm-chunks/{swift-sdk-image-UR3CJPBF.mjs → swift-sdk-image-3TJP3PYO.mjs} +13 -12
- package/dist-lib/esm-chunks/swift-sdk-image-producer-SZLGEC7P.mjs +294 -0
- package/dist-lib/expo-swift-bundle.cjs +4443 -4101
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +7 -7
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +5368 -5023
- package/dist-lib/host/fetch-proxy-handler.cjs +15 -14
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +4 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +3 -3
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +3 -3
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +4 -4
- package/dist-lib/native-app-identity-project.cjs +2 -2
- package/dist-lib/native-app-identity-project.mjs +17 -15
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +6 -6
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +3 -3
- package/dist-lib/pdfium-raster.cjs +1 -1
- package/dist-lib/pdfium-raster.mjs +2 -2
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +3 -3
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +92 -81
- package/dist-lib/public-origins-lib.json +74 -69
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +2 -2
- package/dist-lib/reap-browser.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +7 -7
- package/dist-lib/skills.cjs +6003 -5638
- package/dist-lib/swift-compile.cjs +1280 -965
- package/dist-lib/swift-compile.mjs +10 -9
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +3 -3
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +5 -5
- package/dist-lib/swift-svg-raster.cjs +1 -1
- package/dist-lib/swift-svg-raster.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
- package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
- package/dist-lib/vendor/@xmldom/xmldom.cjs +1 -1
- package/dist-lib/vendor/acorn.cjs +1 -1
- package/dist-lib/vendor/bplist-parser.cjs +1 -1
- package/dist-lib/vendor/ignore.cjs +1 -1
- package/dist-lib/vendor/magic-string.cjs +1 -1
- package/dist-lib/vendor/plist.cjs +1 -1
- package/dist-lib/vendor/smol-toml.cjs +1 -1
- package/dist-lib/vendor/stream-json.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
- package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
- package/dist-lib/vendor/sucrase.cjs +1 -1
- package/dist-lib/vendor/terser.cjs +1 -1
- package/dist-lib/vendor/valibot.cjs +1 -1
- package/dist-lib/vendor/ws.cjs +1 -1
- package/dist-lib/vendor/zod.cjs +1 -1
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +3 -3
- package/dist-types/packages/peach-engine/src/engine/remote-display-protocol.d.ts +9 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/webview-automation-host.d.ts +4 -2
- package/dist-types/packages/peach-globals/src/compositorBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +3 -2
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/src/bridge-contract.ts +1 -0
- package/src/cloud-contract.ts +1 -0
- package/src/expo-discovery-cache.ts +100 -77
- package/src/host/bridge-host.ts +7 -1
- package/src/swift-compile.ts +1 -0
- package/src/swift-sdk-image-producer.ts +336 -0
- package/src/swift-sdk-image.ts +37 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2479 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
|
|
3
3
|
// ../../node_modules/acorn/dist/acorn.mjs
|
|
4
4
|
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 78, 5, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 199, 7, 137, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 55, 9, 266, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 233, 0, 3, 0, 8, 1, 6, 0, 475, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
package/dist-lib/esm-chunks/{metro-layout-parser-KANGAXGA.mjs → metro-layout-parser-LMCYOPJD.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
2
|
-
import "./chunk-
|
|
1
|
+
/*! peach v0.1.2479 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
|
+
import "./chunk-G4WYTA67.mjs";
|
|
3
3
|
|
|
4
4
|
// src/metro-layout-parser.ts
|
|
5
5
|
var whitespace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/y;
|
|
@@ -8,7 +8,7 @@ var lineBreak = /[\r\n\u2028\u2029]/;
|
|
|
8
8
|
var metroLayoutParser;
|
|
9
9
|
async function loadMetroLayoutParser() {
|
|
10
10
|
if (metroLayoutParser) return metroLayoutParser;
|
|
11
|
-
const { Parser } = await import("./acorn-
|
|
11
|
+
const { Parser } = await import("./acorn-6T74WJEH.mjs");
|
|
12
12
|
metroLayoutParser = Parser.extend(
|
|
13
13
|
(Base) => {
|
|
14
14
|
const parseFunctionBody = Reflect.get(Base.prototype, "parseFunctionBody");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2479 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
compileTargets,
|
|
4
4
|
fetchNativeEntry,
|
|
@@ -6,18 +6,19 @@ import {
|
|
|
6
6
|
swiftAvailableModules,
|
|
7
7
|
swiftDistributionAt,
|
|
8
8
|
swiftImportNames
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TVVDHHO3.mjs";
|
|
10
|
+
import "./chunk-AEZPI62A.mjs";
|
|
10
11
|
import {
|
|
11
12
|
SWIFT_REMOTE_PACKAGES_DIR
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PFCYY52I.mjs";
|
|
13
14
|
import {
|
|
14
15
|
manifestCalls
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-FNLQ2DEH.mjs";
|
|
17
|
+
import "./chunk-QHX5XHZQ.mjs";
|
|
18
|
+
import "./chunk-3ZA6FTBR.mjs";
|
|
19
|
+
import "./chunk-IHHNYCWO.mjs";
|
|
20
|
+
import "./chunk-UWPIIUE4.mjs";
|
|
21
|
+
import "./chunk-G4WYTA67.mjs";
|
|
21
22
|
|
|
22
23
|
// src/swift-package-prebuilt.ts
|
|
23
24
|
import { createHash } from "node:crypto";
|
package/dist-lib/esm-chunks/{swift-sdk-app-module-44XKCG3I.mjs → swift-sdk-app-module-RZ5BXP7S.mjs}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2479 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
SWIFT_SDK_APP_MEMORY_BASE,
|
|
4
4
|
SWIFT_SDK_APP_TABLE_BASE,
|
|
5
5
|
SWIFT_SDK_MEMORY_BASE,
|
|
6
6
|
SWIFT_SDK_PIECE_FIELDS,
|
|
7
7
|
readSwiftSdkManifest
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-OER7EEIH.mjs";
|
|
9
|
+
import "./chunk-GPU6YJ5I.mjs";
|
|
10
|
+
import "./chunk-BZT6SR75.mjs";
|
|
11
11
|
import {
|
|
12
12
|
ADDEND_RELOCATIONS,
|
|
13
13
|
KEEP_WASM_NAMES,
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
NATIVE_SDK_THUNK_SECTION,
|
|
18
18
|
SWIFT_PRUNED_LINK_MAP,
|
|
19
19
|
SWIFT_SDK_FUNCTION_ADDRESS_PREFIX,
|
|
20
|
-
SWIFT_WASM_TRIPLE,
|
|
21
20
|
chunkKey,
|
|
22
21
|
constructorKeys,
|
|
23
22
|
guestLazyExports,
|
|
@@ -35,14 +34,17 @@ import {
|
|
|
35
34
|
wasmReader,
|
|
36
35
|
wasmSections,
|
|
37
36
|
writeWasmCustomSection
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-TVVDHHO3.mjs";
|
|
38
|
+
import {
|
|
39
|
+
SWIFT_WASM_TRIPLE
|
|
40
|
+
} from "./chunk-AEZPI62A.mjs";
|
|
41
|
+
import "./chunk-PFCYY52I.mjs";
|
|
42
|
+
import "./chunk-FNLQ2DEH.mjs";
|
|
43
|
+
import "./chunk-QHX5XHZQ.mjs";
|
|
44
|
+
import "./chunk-3ZA6FTBR.mjs";
|
|
45
|
+
import "./chunk-IHHNYCWO.mjs";
|
|
46
|
+
import "./chunk-UWPIIUE4.mjs";
|
|
47
|
+
import "./chunk-G4WYTA67.mjs";
|
|
46
48
|
|
|
47
49
|
// src/swift-sdk-app-module.ts
|
|
48
50
|
import { execFile } from "node:child_process";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! peach v0.1.
|
|
1
|
+
/*! peach v0.1.2479 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
SWIFT_SDK_APP_MEMORY_BASE,
|
|
4
4
|
SWIFT_SDK_APP_TABLE_BASE,
|
|
@@ -15,17 +15,18 @@ import {
|
|
|
15
15
|
swiftSdkImageFile,
|
|
16
16
|
swiftSdkImageKey,
|
|
17
17
|
swiftSdkImageProducts
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-OER7EEIH.mjs";
|
|
19
|
+
import "./chunk-GPU6YJ5I.mjs";
|
|
20
|
+
import "./chunk-BZT6SR75.mjs";
|
|
21
|
+
import "./chunk-TVVDHHO3.mjs";
|
|
22
|
+
import "./chunk-AEZPI62A.mjs";
|
|
23
|
+
import "./chunk-PFCYY52I.mjs";
|
|
24
|
+
import "./chunk-FNLQ2DEH.mjs";
|
|
25
|
+
import "./chunk-QHX5XHZQ.mjs";
|
|
26
|
+
import "./chunk-3ZA6FTBR.mjs";
|
|
27
|
+
import "./chunk-IHHNYCWO.mjs";
|
|
28
|
+
import "./chunk-UWPIIUE4.mjs";
|
|
29
|
+
import "./chunk-G4WYTA67.mjs";
|
|
29
30
|
export {
|
|
30
31
|
SWIFT_SDK_APP_MEMORY_BASE,
|
|
31
32
|
SWIFT_SDK_APP_TABLE_BASE,
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/*! peach v0.1.2479 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
|
|
2
|
+
import {
|
|
3
|
+
swiftCacheDir,
|
|
4
|
+
windowAdmission,
|
|
5
|
+
withSwiftRootLock
|
|
6
|
+
} from "./chunk-AEZPI62A.mjs";
|
|
7
|
+
import {
|
|
8
|
+
isRecord
|
|
9
|
+
} from "./chunk-UWPIIUE4.mjs";
|
|
10
|
+
import "./chunk-G4WYTA67.mjs";
|
|
11
|
+
|
|
12
|
+
// src/swift-sdk-image-producer.ts
|
|
13
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
14
|
+
import { randomUUID } from "node:crypto";
|
|
15
|
+
import {
|
|
16
|
+
existsSync,
|
|
17
|
+
mkdirSync,
|
|
18
|
+
readFileSync,
|
|
19
|
+
renameSync,
|
|
20
|
+
rmSync,
|
|
21
|
+
writeFileSync
|
|
22
|
+
} from "node:fs";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
25
|
+
import { promisify } from "node:util";
|
|
26
|
+
var run = promisify(execFile);
|
|
27
|
+
var environmentNames = [
|
|
28
|
+
"CONTRAST_BUILDERS_ROOT",
|
|
29
|
+
"PEACH_HOME",
|
|
30
|
+
"PEACH_SWIFT_SDKS_PATH",
|
|
31
|
+
"CONTRAST_SWIFT_TOOLCHAINS",
|
|
32
|
+
"PEACH_SWIFT_PRIVATE_COMPILER_RELEASE",
|
|
33
|
+
"PEACH_SWIFT_NAMES"
|
|
34
|
+
];
|
|
35
|
+
function readRequest(file) {
|
|
36
|
+
const value = JSON.parse(readFileSync(file, "utf8"));
|
|
37
|
+
if (!isRecord(value) || typeof value.key !== "string" || !/^[a-f0-9]{32}$/.test(value.key) || typeof value.launchId !== "string" || typeof value.created !== "number" || typeof value.scopedLookups !== "boolean" || !Array.isArray(value.imports) || value.imports.some((name) => typeof name !== "string") || typeof value.cache !== "string" || !path.isAbsolute(value.cache) || !isRecord(value.environment) || Object.entries(value.environment).some(
|
|
38
|
+
([name, item]) => !environmentNames.some((allowed) => allowed === name) || typeof item !== "string"
|
|
39
|
+
))
|
|
40
|
+
throw new Error(`invalid Swift SDK producer request: ${file}`);
|
|
41
|
+
const environment = {};
|
|
42
|
+
for (const name of environmentNames) {
|
|
43
|
+
const item = value.environment[name];
|
|
44
|
+
if (typeof item === "string") environment[name] = item;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
key: value.key,
|
|
48
|
+
launchId: value.launchId,
|
|
49
|
+
created: value.created,
|
|
50
|
+
scopedLookups: value.scopedLookups,
|
|
51
|
+
imports: value.imports,
|
|
52
|
+
cache: value.cache,
|
|
53
|
+
environment
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function swiftSdkProducerRequest(file) {
|
|
57
|
+
return readRequest(file);
|
|
58
|
+
}
|
|
59
|
+
function applySwiftSdkProducerEnvironment(environment) {
|
|
60
|
+
for (const name of environmentNames) {
|
|
61
|
+
const value = environment[name];
|
|
62
|
+
if (value === void 0) delete process.env[name];
|
|
63
|
+
else process.env[name] = value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function writeSwiftSdkProducerResult(file, launchId, error) {
|
|
67
|
+
const temporary = `${file}.${randomUUID()}`;
|
|
68
|
+
writeFileSync(temporary, JSON.stringify({ launchId, error: error ?? null }));
|
|
69
|
+
renameSync(temporary, file);
|
|
70
|
+
}
|
|
71
|
+
var launcher = `set -eu
|
|
72
|
+
tm detach "$TM_SESSION" >/dev/null
|
|
73
|
+
printf '%s\\n' "$TM_SESSION" > "$1.tmp"
|
|
74
|
+
mv "$1.tmp" "$1"
|
|
75
|
+
shift
|
|
76
|
+
export GIT_ALTERNATE_OBJECT_DIRECTORIES="$2/objects"
|
|
77
|
+
set +e
|
|
78
|
+
env -u TM_WINDOW -u TM_WAIT_DEADLINE_MS -u TM_EXEC_OUTER_DEADLINE_MS -u REMOTE_BUILD_DEADLINE -u TM_EXEC_ADMITTED -u LINUX_BUILD_SCOPE -u TM_EXEC_CPU_CORES -u TM_EXEC_LINUX_MEMORY_MAX -u CONTRAST_HEAVY_ADMITTED -u CONTRAST_HEAVY_CPU_CORES tm exec --local --kind build-linux --cores "$1" --timeout 90m --param wait=true --param "source-snapshot=$2" --param "delivery-dir=$4" --param "serial-key=swift-sdk-$5" -- bun scripts/ops/produce-swift-sdk-image.ts "$3" </dev/null
|
|
79
|
+
status=$?
|
|
80
|
+
if bun -e 'try { if (JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8")).released !== true) process.exit(1) } catch { process.exit(1) }' "$4/cleanup.json"; then rm -rf "$2"; fi
|
|
81
|
+
exit "$status"
|
|
82
|
+
`;
|
|
83
|
+
function retainSnapshotObjects(repo, capture) {
|
|
84
|
+
const target = path.join(capture, "objects");
|
|
85
|
+
const original = readFileSync(path.join(target, "info/alternates"), "utf8").trim();
|
|
86
|
+
const inherited = path.join(original, "info/alternates");
|
|
87
|
+
const retainedAlternates = existsSync(inherited) ? readFileSync(inherited, "utf8").split("\n").filter(Boolean).map((entry) => path.resolve(original, entry)) : [];
|
|
88
|
+
const env = {
|
|
89
|
+
...process.env,
|
|
90
|
+
GIT_OBJECT_DIRECTORY: target,
|
|
91
|
+
GIT_NO_LAZY_FETCH: "1"
|
|
92
|
+
};
|
|
93
|
+
delete env.GIT_ALTERNATE_OBJECT_DIRECTORIES;
|
|
94
|
+
const roots = ["source-commit", "staged-tree", "worktree-tree"].map(
|
|
95
|
+
(file) => readFileSync(path.join(capture, file), "utf8").trim()
|
|
96
|
+
);
|
|
97
|
+
const inventoryArgs = [
|
|
98
|
+
"-C",
|
|
99
|
+
repo,
|
|
100
|
+
"rev-list",
|
|
101
|
+
"--objects",
|
|
102
|
+
"--no-object-names",
|
|
103
|
+
"--missing=print",
|
|
104
|
+
"--no-walk",
|
|
105
|
+
...roots
|
|
106
|
+
];
|
|
107
|
+
const inventory = execFileSync("git", inventoryArgs, {
|
|
108
|
+
encoding: "utf8",
|
|
109
|
+
env,
|
|
110
|
+
maxBuffer: 64 * 1024 * 1024
|
|
111
|
+
});
|
|
112
|
+
if (inventory.split("\n").some((line) => line.startsWith("?")))
|
|
113
|
+
throw new Error("Swift SDK producer snapshot is missing source objects");
|
|
114
|
+
const history = execFileSync(
|
|
115
|
+
"git",
|
|
116
|
+
["-C", repo, "rev-list", "--first-parent", roots[0]],
|
|
117
|
+
{
|
|
118
|
+
encoding: "utf8",
|
|
119
|
+
env,
|
|
120
|
+
maxBuffer: 64 * 1024 * 1024
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
mkdirSync(path.join(target, "pack"), { recursive: true });
|
|
124
|
+
execFileSync("git", ["-C", repo, "pack-objects", path.join(target, "pack/source")], {
|
|
125
|
+
input: `${inventory}${history}`,
|
|
126
|
+
env,
|
|
127
|
+
stdio: ["pipe", "ignore", "inherit"]
|
|
128
|
+
});
|
|
129
|
+
rmSync(path.join(target, "info/alternates"), { force: true });
|
|
130
|
+
const retained = execFileSync("git", inventoryArgs, {
|
|
131
|
+
encoding: "utf8",
|
|
132
|
+
env,
|
|
133
|
+
maxBuffer: 64 * 1024 * 1024
|
|
134
|
+
});
|
|
135
|
+
if (retained.split("\n").some((line) => line.startsWith("?")))
|
|
136
|
+
throw new Error("Swift SDK producer could not retain its source objects");
|
|
137
|
+
if (retainedAlternates.length)
|
|
138
|
+
writeFileSync(
|
|
139
|
+
path.join(target, "info/alternates"),
|
|
140
|
+
`${retainedAlternates.join("\n")}
|
|
141
|
+
`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
function producerSession(file) {
|
|
145
|
+
if (!existsSync(file)) return null;
|
|
146
|
+
const session = readFileSync(file, "utf8").trim();
|
|
147
|
+
if (!/^[a-z0-9-]+$/.test(session))
|
|
148
|
+
throw new Error(`invalid Swift SDK producer session: ${file}`);
|
|
149
|
+
const status = JSON.parse(
|
|
150
|
+
execFileSync("tm", ["show", "record", session], { encoding: "utf8" })
|
|
151
|
+
);
|
|
152
|
+
if (!isRecord(status) || typeof status.state !== "string")
|
|
153
|
+
throw new Error(`cannot inspect Swift SDK producer ${session}`);
|
|
154
|
+
return { session, state: status.state };
|
|
155
|
+
}
|
|
156
|
+
function producerSettled(directory) {
|
|
157
|
+
if (producerSession(path.join(directory, "session"))?.state !== "exited") return false;
|
|
158
|
+
const receipt = path.join(directory, "delivery/cleanup.json");
|
|
159
|
+
if (!existsSync(receipt)) return false;
|
|
160
|
+
const value = JSON.parse(readFileSync(receipt, "utf8"));
|
|
161
|
+
return isRecord(value) && value.released === true;
|
|
162
|
+
}
|
|
163
|
+
async function produceSwiftSdkImage(input) {
|
|
164
|
+
const root = path.join(swiftCacheDir(), "swift-sdk-image-producers", input.key);
|
|
165
|
+
const current = path.join(root, "current");
|
|
166
|
+
input.signal?.throwIfAborted();
|
|
167
|
+
const claim = await withSwiftRootLock(
|
|
168
|
+
`${root}.claim`,
|
|
169
|
+
async () => {
|
|
170
|
+
if (input.ready()) return null;
|
|
171
|
+
if (existsSync(current)) {
|
|
172
|
+
const generation = readFileSync(current, "utf8").trim();
|
|
173
|
+
if (!/^[a-f0-9-]{36}$/.test(generation))
|
|
174
|
+
throw new Error(`invalid Swift SDK producer generation: ${current}`);
|
|
175
|
+
const directory3 = path.join(root, generation);
|
|
176
|
+
const request2 = readRequest(path.join(directory3, "request.json"));
|
|
177
|
+
if (request2.launchId !== generation)
|
|
178
|
+
throw new Error(`Swift SDK producer generation differs: ${directory3}`);
|
|
179
|
+
const session = producerSession(path.join(directory3, "session"));
|
|
180
|
+
if (session) {
|
|
181
|
+
if (!producerSettled(directory3)) return { directory: directory3, request: request2 };
|
|
182
|
+
rmSync(path.join(directory3, "snapshot"), {
|
|
183
|
+
recursive: true,
|
|
184
|
+
force: true
|
|
185
|
+
});
|
|
186
|
+
} else if (Date.now() - request2.created <= 6e4) {
|
|
187
|
+
return { directory: directory3, request: request2 };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const repo = path.resolve(input.moduleRoot, "../..");
|
|
191
|
+
const launchId = randomUUID();
|
|
192
|
+
const directory2 = path.join(root, launchId);
|
|
193
|
+
const requestFile = path.join(directory2, "request.json");
|
|
194
|
+
const sessionFile2 = path.join(directory2, "session");
|
|
195
|
+
const capture = path.join(root, `.capture-${launchId}`);
|
|
196
|
+
mkdirSync(root, { recursive: true });
|
|
197
|
+
try {
|
|
198
|
+
execFileSync(
|
|
199
|
+
"bash",
|
|
200
|
+
[path.join(repo, "scripts/lib/remote-source-snapshot.sh"), repo, capture],
|
|
201
|
+
{
|
|
202
|
+
stdio: "inherit"
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
retainSnapshotObjects(repo, capture);
|
|
206
|
+
mkdirSync(directory2);
|
|
207
|
+
renameSync(capture, path.join(directory2, "snapshot"));
|
|
208
|
+
const environment = {};
|
|
209
|
+
for (const name of environmentNames) {
|
|
210
|
+
const value = process.env[name];
|
|
211
|
+
if (value !== void 0) environment[name] = value;
|
|
212
|
+
}
|
|
213
|
+
const record = {
|
|
214
|
+
key: input.key,
|
|
215
|
+
launchId,
|
|
216
|
+
created: Date.now(),
|
|
217
|
+
scopedLookups: input.scopedLookups,
|
|
218
|
+
imports: [...input.imports],
|
|
219
|
+
cache: swiftCacheDir(),
|
|
220
|
+
environment
|
|
221
|
+
};
|
|
222
|
+
writeFileSync(requestFile, JSON.stringify(record), { flag: "wx" });
|
|
223
|
+
const next = `${current}.${launchId}`;
|
|
224
|
+
writeFileSync(next, launchId, { flag: "wx" });
|
|
225
|
+
renameSync(next, current);
|
|
226
|
+
const admitted = windowAdmission()?.cores ?? Number(process.env.TM_EXEC_CPU_CORES);
|
|
227
|
+
const cores = Number.isSafeInteger(admitted) && admitted > 0 ? Math.max(4, admitted) : 4;
|
|
228
|
+
const launched = await run(
|
|
229
|
+
"tm",
|
|
230
|
+
[
|
|
231
|
+
"run",
|
|
232
|
+
"--here",
|
|
233
|
+
"--in-place",
|
|
234
|
+
"--quiet",
|
|
235
|
+
"--no-finish-notice",
|
|
236
|
+
"--slug",
|
|
237
|
+
`swift-sdk-image-${record.launchId.slice(0, 8)}`,
|
|
238
|
+
"--",
|
|
239
|
+
"/bin/sh",
|
|
240
|
+
"-c",
|
|
241
|
+
launcher,
|
|
242
|
+
"swift-sdk-image",
|
|
243
|
+
sessionFile2,
|
|
244
|
+
String(cores),
|
|
245
|
+
path.join(directory2, "snapshot"),
|
|
246
|
+
requestFile,
|
|
247
|
+
path.join(directory2, "delivery"),
|
|
248
|
+
input.frameworkKey
|
|
249
|
+
],
|
|
250
|
+
{ cwd: repo }
|
|
251
|
+
);
|
|
252
|
+
if (!launched.stdout.trim())
|
|
253
|
+
throw new Error(`Swift SDK producer launch was not confirmed: ${directory2}`);
|
|
254
|
+
return { directory: directory2, request: record };
|
|
255
|
+
} finally {
|
|
256
|
+
rmSync(capture, { recursive: true, force: true });
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
input.signal
|
|
260
|
+
);
|
|
261
|
+
if (!claim) return;
|
|
262
|
+
const { directory, request } = claim;
|
|
263
|
+
const sessionFile = path.join(directory, "session");
|
|
264
|
+
const resultFile = path.join(directory, "result.json");
|
|
265
|
+
if (request.key !== input.key || request.cache !== swiftCacheDir())
|
|
266
|
+
throw new Error(`Swift SDK producer identity mismatch: ${directory}`);
|
|
267
|
+
for (; ; ) {
|
|
268
|
+
if (existsSync(resultFile)) {
|
|
269
|
+
const result = JSON.parse(readFileSync(resultFile, "utf8"));
|
|
270
|
+
if (!isRecord(result) || result.launchId !== request.launchId || !(result.error === null || typeof result.error === "string"))
|
|
271
|
+
throw new Error(`invalid Swift SDK producer result: ${resultFile}`);
|
|
272
|
+
if (result.error) throw new Error(`Swift SDK producer failed: ${result.error}`);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const status = producerSession(sessionFile);
|
|
276
|
+
if (status) {
|
|
277
|
+
if (status.state === "exited") {
|
|
278
|
+
if (existsSync(resultFile)) continue;
|
|
279
|
+
throw new Error(
|
|
280
|
+
`Swift SDK producer ${status.session} exited without a result; inspect its session before retrying`
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
} else if (Date.now() - request.created > 6e4) {
|
|
284
|
+
throw new Error(`Swift SDK producer launch is unconfirmed: ${directory}`);
|
|
285
|
+
}
|
|
286
|
+
await sleep(2e3, void 0, { signal: input.signal });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
export {
|
|
290
|
+
applySwiftSdkProducerEnvironment,
|
|
291
|
+
produceSwiftSdkImage,
|
|
292
|
+
swiftSdkProducerRequest,
|
|
293
|
+
writeSwiftSdkProducerResult
|
|
294
|
+
};
|