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
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
// isolated homes instead of redoing the prepare and the workspace read.
|
|
5
5
|
// entries address content only; a store that cannot prove its paths refuses
|
|
6
6
|
// rather than serve bytes another home cannot trust.
|
|
7
|
-
// bodies, target metadata and units are separate content-addressed records.
|
|
8
|
-
// repeated headers and header maps share bytes without building one discovery-
|
|
9
|
-
// sized string on either the write or read path.
|
|
10
7
|
import { createHash, randomUUID } from 'node:crypto'
|
|
11
8
|
import fs from 'node:fs'
|
|
12
9
|
import path from 'node:path'
|
|
10
|
+
import { zstdCompressSync, zstdDecompressSync } from 'node:zlib'
|
|
13
11
|
import { EXPO_EAGER_NATIVE_VIEWS } from '../../peach-compat/src/stubs/native-seams/expo-eager-seam-contract'
|
|
14
12
|
import { peachAnsweredNativePackages } from './answeredNativePackages'
|
|
15
13
|
import { expoNativeCompilerDigestValue } from './expo-native-compiler-digest'
|
|
@@ -22,7 +20,7 @@ import { sharedCacheDir } from './swift-toolchain'
|
|
|
22
20
|
import { isSwiftNativeTargets, isSwiftResourceBundles } from './swiftContract'
|
|
23
21
|
import type { ExpoSwiftSourceUnit } from './expoSwiftContract'
|
|
24
22
|
|
|
25
|
-
const FORMAT = 'expo-discovery-
|
|
23
|
+
const FORMAT = 'expo-discovery-v6'
|
|
26
24
|
|
|
27
25
|
function peachPin(): string {
|
|
28
26
|
return createHash('sha256')
|
|
@@ -71,9 +69,7 @@ export function expoDiscoveryCacheDir(): string {
|
|
|
71
69
|
return path.join(sharedCacheDir(path.join(ambientHomeDir(), 'cache')), 'expo-discovery')
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
//
|
|
75
|
-
// blobs unused for a week. a reader that loses the race reads a miss and
|
|
76
|
-
// rediscovers. frameworks stay: a unit names their paths directly.
|
|
72
|
+
// frameworks stay: a unit names their paths directly.
|
|
77
73
|
const EXPIRY_MS = 7 * 24 * 3_600_000
|
|
78
74
|
const ORPHAN_TEMPORARY_MS = 24 * 3_600_000
|
|
79
75
|
|
|
@@ -136,15 +132,14 @@ function isExpoSwiftSourceUnit(value: unknown): value is ExpoSwiftSourceUnit {
|
|
|
136
132
|
)
|
|
137
133
|
}
|
|
138
134
|
|
|
139
|
-
// a stored unit holds blob digests where a live unit holds bodies.
|
|
140
135
|
type StoredExpoSwiftSourceUnit = Omit<
|
|
141
136
|
ExpoSwiftSourceUnit,
|
|
142
137
|
'files' | 'nativeFiles' | 'resources' | 'nativeTargets'
|
|
143
138
|
> & {
|
|
144
|
-
files: Record<string,
|
|
145
|
-
nativeFiles?: Record<string,
|
|
146
|
-
resources?: Record<string,
|
|
147
|
-
nativeTargets?:
|
|
139
|
+
files: Record<string, number>
|
|
140
|
+
nativeFiles?: Record<string, number>
|
|
141
|
+
resources?: Record<string, number>
|
|
142
|
+
nativeTargets?: number[]
|
|
148
143
|
}
|
|
149
144
|
|
|
150
145
|
const isDigest = (value: string): boolean => /^[0-9a-f]{64}$/.test(value)
|
|
@@ -152,6 +147,12 @@ const isDigest = (value: string): boolean => /^[0-9a-f]{64}$/.test(value)
|
|
|
152
147
|
const digestRecord = (value: unknown): value is Record<string, string> =>
|
|
153
148
|
stringRecord(value) && Object.values(value).every(isDigest)
|
|
154
149
|
|
|
150
|
+
const isBodyOffset = (value: unknown): value is number =>
|
|
151
|
+
typeof value === 'number' && Number.isSafeInteger(value) && value >= 0
|
|
152
|
+
|
|
153
|
+
const isBodyOffsets = (value: unknown): value is Record<string, number> =>
|
|
154
|
+
isRecord(value) && Object.values(value).every(isBodyOffset)
|
|
155
|
+
|
|
155
156
|
function isStoredUnit(value: unknown): value is StoredExpoSwiftSourceUnit {
|
|
156
157
|
return (
|
|
157
158
|
isRecord(value) &&
|
|
@@ -161,14 +162,14 @@ function isStoredUnit(value: unknown): value is StoredExpoSwiftSourceUnit {
|
|
|
161
162
|
strings(value.bridgeModules) &&
|
|
162
163
|
strings(value.appDelegateSubscribers) &&
|
|
163
164
|
strings(value.reactDelegateHandlers) &&
|
|
164
|
-
|
|
165
|
+
isBodyOffsets(value.files) &&
|
|
165
166
|
strings(value.frameworks) &&
|
|
166
167
|
(value.reactNativeProvider === undefined || value.reactNativeProvider === true) &&
|
|
167
168
|
(value.workspaceSources === undefined || strings(value.workspaceSources)) &&
|
|
168
169
|
(value.nativeTargets === undefined ||
|
|
169
|
-
(
|
|
170
|
-
(value.nativeFiles === undefined ||
|
|
171
|
-
(value.resources === undefined ||
|
|
170
|
+
(Array.isArray(value.nativeTargets) && value.nativeTargets.every(isBodyOffset))) &&
|
|
171
|
+
(value.nativeFiles === undefined || isBodyOffsets(value.nativeFiles)) &&
|
|
172
|
+
(value.resources === undefined || isBodyOffsets(value.resources)) &&
|
|
172
173
|
(value.resourceBundles === undefined ||
|
|
173
174
|
isSwiftResourceBundles(value.resourceBundles)) &&
|
|
174
175
|
(value.swiftLanguageMode === undefined || typeof value.swiftLanguageMode === 'number')
|
|
@@ -200,45 +201,57 @@ export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | u
|
|
|
200
201
|
} catch {
|
|
201
202
|
return undefined
|
|
202
203
|
}
|
|
203
|
-
renew(record)
|
|
204
|
-
if (parsed.units === null) return null
|
|
205
|
-
if (!strings(parsed.units) || !parsed.units.every(isDigest)) return undefined
|
|
206
|
-
const blobs = new Map<string, string>()
|
|
207
|
-
const read = (digest: string): string => {
|
|
208
|
-
const known = blobs.get(digest)
|
|
209
|
-
if (known !== undefined) return known
|
|
210
|
-
const blob = path.join(expoDiscoveryCacheDir(), 'blobs', digest)
|
|
211
|
-
const body = fs.readFileSync(blob, 'utf8')
|
|
212
|
-
if (createHash('sha256').update(body).digest('hex') !== digest)
|
|
213
|
-
throw new Error('discovery blob differs from its digest')
|
|
214
|
-
blobs.set(digest, body)
|
|
215
|
-
renew(blob)
|
|
216
|
-
return body
|
|
217
|
-
}
|
|
218
|
-
const resolve = (refs: Record<string, string>): Record<string, string> => {
|
|
219
|
-
const bodies: Record<string, string> = {}
|
|
220
|
-
for (const [name, digest] of Object.entries(refs)) {
|
|
221
|
-
bodies[name] = read(digest)
|
|
222
|
-
}
|
|
223
|
-
return bodies
|
|
224
|
-
}
|
|
225
|
-
const units: ExpoSwiftSourceUnit[] = []
|
|
226
204
|
try {
|
|
227
|
-
|
|
228
|
-
|
|
205
|
+
if (parsed.units === null) {
|
|
206
|
+
renew(record)
|
|
207
|
+
return null
|
|
208
|
+
}
|
|
209
|
+
if (!Array.isArray(parsed.units) || !parsed.units.every(isBodyOffset))
|
|
210
|
+
return undefined
|
|
211
|
+
if (typeof parsed.archive !== 'string' || !isDigest(parsed.archive)) return undefined
|
|
212
|
+
const archive = path.join(expoDiscoveryCacheDir(), 'blobs', `${parsed.archive}.zst`)
|
|
213
|
+
const bytes = fs.readFileSync(archive)
|
|
214
|
+
if (createHash('sha256').update(bytes).digest('hex') !== parsed.archive)
|
|
215
|
+
return undefined
|
|
216
|
+
const bodies = zstdDecompressSync(bytes)
|
|
217
|
+
const decoded = new Map<number, string>()
|
|
218
|
+
const read = (offset: number): string => {
|
|
219
|
+
const known = decoded.get(offset)
|
|
220
|
+
if (known !== undefined) return known
|
|
221
|
+
const start = offset + 4
|
|
222
|
+
const end = start + bodies.readUInt32LE(offset)
|
|
223
|
+
if (end > bodies.length) throw new Error('discovery archive body is truncated')
|
|
224
|
+
const body = bodies.toString('utf8', start, end)
|
|
225
|
+
decoded.set(offset, body)
|
|
226
|
+
return body
|
|
227
|
+
}
|
|
228
|
+
const resolve = (refs: Record<string, number>): Record<string, string> =>
|
|
229
|
+
Object.fromEntries(
|
|
230
|
+
Object.entries(refs).map(([name, offset]) => [name, read(offset)]),
|
|
231
|
+
)
|
|
232
|
+
const units: ExpoSwiftSourceUnit[] = []
|
|
233
|
+
for (const offset of parsed.units) {
|
|
234
|
+
const stored: unknown = JSON.parse(read(offset))
|
|
229
235
|
if (!isStoredUnit(stored)) return undefined
|
|
230
|
-
const
|
|
236
|
+
const {
|
|
237
|
+
files: fileOffsets,
|
|
238
|
+
nativeFiles: nativeFileOffsets,
|
|
239
|
+
resources: resourceOffsets,
|
|
240
|
+
nativeTargets: nativeTargetOffsets,
|
|
241
|
+
...metadata
|
|
242
|
+
} = stored
|
|
243
|
+
const nativeTargets: unknown = nativeTargetOffsets?.map((ref) =>
|
|
231
244
|
JSON.parse(read(ref)),
|
|
232
245
|
)
|
|
233
246
|
if (nativeTargets !== undefined && !isSwiftNativeTargets(nativeTargets))
|
|
234
247
|
return undefined
|
|
235
|
-
const files = resolve(
|
|
248
|
+
const files = resolve(fileOffsets)
|
|
236
249
|
const nativeFiles =
|
|
237
|
-
|
|
250
|
+
nativeFileOffsets === undefined ? undefined : resolve(nativeFileOffsets)
|
|
238
251
|
const resources =
|
|
239
|
-
|
|
252
|
+
resourceOffsets === undefined ? undefined : resolve(resourceOffsets)
|
|
240
253
|
const unit: ExpoSwiftSourceUnit = {
|
|
241
|
-
...
|
|
254
|
+
...metadata,
|
|
242
255
|
nativeTargets,
|
|
243
256
|
files,
|
|
244
257
|
...(nativeFiles === undefined ? {} : { nativeFiles }),
|
|
@@ -247,6 +260,8 @@ export function readExpoDiscovery(key: string): ExpoSwiftSourceUnit[] | null | u
|
|
|
247
260
|
if (!isExpoSwiftSourceUnit(unit)) return undefined
|
|
248
261
|
units.push(unit)
|
|
249
262
|
}
|
|
263
|
+
renew(archive)
|
|
264
|
+
renew(record)
|
|
250
265
|
return units
|
|
251
266
|
} catch {
|
|
252
267
|
return undefined
|
|
@@ -557,54 +572,62 @@ export function writeExpoDiscovery(options: {
|
|
|
557
572
|
signal: options.signal,
|
|
558
573
|
})
|
|
559
574
|
if ('refuse' in rewritten) return rewritten.refuse
|
|
560
|
-
// one
|
|
561
|
-
// once: string hashes memoize, so a shared body is a cheap map hit.
|
|
575
|
+
// one read and digest cover the archive; units share repeated bodies by offset.
|
|
562
576
|
const blobDir = path.join(dir, 'blobs')
|
|
563
577
|
fs.mkdirSync(blobDir, { recursive: true })
|
|
564
|
-
const seen = new Map<string,
|
|
565
|
-
const
|
|
578
|
+
const seen = new Map<string, number>()
|
|
579
|
+
const chunks: Buffer[] = []
|
|
580
|
+
let size = 0
|
|
581
|
+
const offsetFor = (body: string): number => {
|
|
566
582
|
const known = seen.get(body)
|
|
567
583
|
if (known !== undefined) return known
|
|
568
584
|
options.signal?.throwIfAborted()
|
|
569
585
|
if (body.includes(preparedRoot))
|
|
570
586
|
throw new Error('a prepared path survives the rewrite')
|
|
571
|
-
const
|
|
572
|
-
const
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
}
|
|
580
|
-
seen.set(body, digest)
|
|
581
|
-
return digest
|
|
587
|
+
const offset = size
|
|
588
|
+
const bytes = Buffer.from(body)
|
|
589
|
+
const header = Buffer.alloc(4)
|
|
590
|
+
header.writeUInt32LE(bytes.length)
|
|
591
|
+
chunks.push(header, bytes)
|
|
592
|
+
size += header.length + bytes.length
|
|
593
|
+
seen.set(body, offset)
|
|
594
|
+
return offset
|
|
582
595
|
}
|
|
583
596
|
const reference = (bodies: Record<string, string>) =>
|
|
584
597
|
Object.fromEntries(
|
|
585
|
-
Object.entries(bodies).map(([name, body]) => [name,
|
|
598
|
+
Object.entries(bodies).map(([name, body]) => [name, offsetFor(body)]),
|
|
586
599
|
)
|
|
587
|
-
const stored = rewritten.units.map(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
? {}
|
|
597
|
-
: {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
600
|
+
const stored = rewritten.units.map(
|
|
601
|
+
({ files, nativeFiles, resources, nativeTargets, ...metadata }) => {
|
|
602
|
+
options.signal?.throwIfAborted()
|
|
603
|
+
const value: StoredExpoSwiftSourceUnit = {
|
|
604
|
+
...metadata,
|
|
605
|
+
nativeTargets: nativeTargets?.map((target) =>
|
|
606
|
+
offsetFor(JSON.stringify(target)),
|
|
607
|
+
),
|
|
608
|
+
files: reference(files),
|
|
609
|
+
...(nativeFiles === undefined ? {} : { nativeFiles: reference(nativeFiles) }),
|
|
610
|
+
...(resources === undefined ? {} : { resources: reference(resources) }),
|
|
611
|
+
}
|
|
612
|
+
return offsetFor(JSON.stringify(value))
|
|
613
|
+
},
|
|
614
|
+
)
|
|
615
|
+
const contents = zstdCompressSync(Buffer.concat(chunks, size))
|
|
616
|
+
const archive = createHash('sha256').update(contents).digest('hex')
|
|
617
|
+
const temporary = path.join(blobDir, '.' + randomUUID() + '.tmp')
|
|
618
|
+
try {
|
|
619
|
+
fs.writeFileSync(temporary, contents)
|
|
620
|
+
fs.renameSync(temporary, path.join(blobDir, `${archive}.zst`))
|
|
621
|
+
} finally {
|
|
622
|
+
fs.rmSync(temporary, { force: true })
|
|
623
|
+
}
|
|
602
624
|
fs.writeFileSync(
|
|
603
625
|
tmp,
|
|
604
626
|
JSON.stringify({
|
|
605
627
|
format: FORMAT,
|
|
606
628
|
key: options.key,
|
|
607
629
|
units: stored,
|
|
630
|
+
archive,
|
|
608
631
|
dependencies: rewritten.dependencies,
|
|
609
632
|
frameworks: rewritten.frameworks,
|
|
610
633
|
}),
|
package/src/host/bridge-host.ts
CHANGED
|
@@ -286,6 +286,7 @@ export interface BridgeHostOptions {
|
|
|
286
286
|
* `peach serve` command resolves this with the same probe the
|
|
287
287
|
* upload itself uses (`resolveDefaultUploadOrigin`). */
|
|
288
288
|
contrastOrigin?: string
|
|
289
|
+
serveResource?: (req: IncomingMessage, res: ServerResponse, url: URL) => boolean
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
const DAEMON_HEARTBEAT_INTERVAL_MS = 5_000
|
|
@@ -455,6 +456,7 @@ export class SootSimBridgeHost {
|
|
|
455
456
|
private shouldWriteDevLockfile: boolean
|
|
456
457
|
private getShellPort: (() => number | null) | null
|
|
457
458
|
private contrastOrigin: string | null = null
|
|
459
|
+
private readonly serveResource: BridgeHostOptions['serveResource']
|
|
458
460
|
private effectivePort = 0
|
|
459
461
|
private startedAt = 0
|
|
460
462
|
private heartbeatTimer: NodeJS.Timeout | null = null
|
|
@@ -486,6 +488,7 @@ export class SootSimBridgeHost {
|
|
|
486
488
|
getExcludePorts: opts.agentScanExcludes,
|
|
487
489
|
})
|
|
488
490
|
this.contrastOrigin = opts.contrastOrigin?.replace(/\/$/, '') || null
|
|
491
|
+
this.serveResource = opts.serveResource
|
|
489
492
|
}
|
|
490
493
|
|
|
491
494
|
/** expose the agent host so tests and embedders can inspect state or
|
|
@@ -1563,7 +1566,10 @@ export class SootSimBridgeHost {
|
|
|
1563
1566
|
url.pathname,
|
|
1564
1567
|
)
|
|
1565
1568
|
if (!publicEngineFont && rejectUntrustedBridgeOrigin(req, res)) return
|
|
1566
|
-
if (
|
|
1569
|
+
if (
|
|
1570
|
+
(method === 'GET' || method === 'HEAD') &&
|
|
1571
|
+
(this.serveResource?.(req, res, url) || serveAppPackageResource(req, res))
|
|
1572
|
+
)
|
|
1567
1573
|
return
|
|
1568
1574
|
if (req.url === '/__peach/fetch-transport') {
|
|
1569
1575
|
res.writeHead(200, {
|
package/src/swift-compile.ts
CHANGED
|
@@ -8092,6 +8092,7 @@ async function compileSwiftProjectOnce(
|
|
|
8092
8092
|
moduleRoot,
|
|
8093
8093
|
!!guestGraph,
|
|
8094
8094
|
distribution ? [] : linkedFrameworkTargets(moduleRoot, input).imports,
|
|
8095
|
+
{ signal: options.signal },
|
|
8095
8096
|
)
|
|
8096
8097
|
: undefined
|
|
8097
8098
|
const inputHash = swiftCompileInputHash(input, options.release)
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { execFile, execFileSync } from 'node:child_process'
|
|
2
|
+
import { randomUUID } from 'node:crypto'
|
|
3
|
+
import {
|
|
4
|
+
existsSync,
|
|
5
|
+
mkdirSync,
|
|
6
|
+
readFileSync,
|
|
7
|
+
renameSync,
|
|
8
|
+
rmSync,
|
|
9
|
+
writeFileSync,
|
|
10
|
+
} from 'node:fs'
|
|
11
|
+
import path from 'node:path'
|
|
12
|
+
import { setTimeout as sleep } from 'node:timers/promises'
|
|
13
|
+
import { promisify } from 'node:util'
|
|
14
|
+
import { windowAdmission } from './admitted-mac-build'
|
|
15
|
+
import { isRecord } from './is-record'
|
|
16
|
+
import { withSwiftRootLock } from './swift-root-lock'
|
|
17
|
+
import { swiftCacheDir } from './swift-toolchain'
|
|
18
|
+
|
|
19
|
+
const run = promisify(execFile)
|
|
20
|
+
const environmentNames = [
|
|
21
|
+
'CONTRAST_BUILDERS_ROOT',
|
|
22
|
+
'PEACH_HOME',
|
|
23
|
+
'PEACH_SWIFT_SDKS_PATH',
|
|
24
|
+
'CONTRAST_SWIFT_TOOLCHAINS',
|
|
25
|
+
'PEACH_SWIFT_PRIVATE_COMPILER_RELEASE',
|
|
26
|
+
'PEACH_SWIFT_NAMES',
|
|
27
|
+
] as const
|
|
28
|
+
|
|
29
|
+
interface Request {
|
|
30
|
+
key: string
|
|
31
|
+
launchId: string
|
|
32
|
+
created: number
|
|
33
|
+
scopedLookups: boolean
|
|
34
|
+
imports: string[]
|
|
35
|
+
cache: string
|
|
36
|
+
environment: Record<string, string>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function readRequest(file: string): Request {
|
|
40
|
+
const value: unknown = JSON.parse(readFileSync(file, 'utf8'))
|
|
41
|
+
if (
|
|
42
|
+
!isRecord(value) ||
|
|
43
|
+
typeof value.key !== 'string' ||
|
|
44
|
+
!/^[a-f0-9]{32}$/.test(value.key) ||
|
|
45
|
+
typeof value.launchId !== 'string' ||
|
|
46
|
+
typeof value.created !== 'number' ||
|
|
47
|
+
typeof value.scopedLookups !== 'boolean' ||
|
|
48
|
+
!Array.isArray(value.imports) ||
|
|
49
|
+
value.imports.some((name) => typeof name !== 'string') ||
|
|
50
|
+
typeof value.cache !== 'string' ||
|
|
51
|
+
!path.isAbsolute(value.cache) ||
|
|
52
|
+
!isRecord(value.environment) ||
|
|
53
|
+
Object.entries(value.environment).some(
|
|
54
|
+
([name, item]) =>
|
|
55
|
+
!environmentNames.some((allowed) => allowed === name) || typeof item !== 'string',
|
|
56
|
+
)
|
|
57
|
+
)
|
|
58
|
+
throw new Error(`invalid Swift SDK producer request: ${file}`)
|
|
59
|
+
const environment: Record<string, string> = {}
|
|
60
|
+
for (const name of environmentNames) {
|
|
61
|
+
const item = value.environment[name]
|
|
62
|
+
if (typeof item === 'string') environment[name] = item
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
key: value.key,
|
|
66
|
+
launchId: value.launchId,
|
|
67
|
+
created: value.created,
|
|
68
|
+
scopedLookups: value.scopedLookups,
|
|
69
|
+
imports: value.imports,
|
|
70
|
+
cache: value.cache,
|
|
71
|
+
environment,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function swiftSdkProducerRequest(file: string): Request {
|
|
76
|
+
return readRequest(file)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function applySwiftSdkProducerEnvironment(environment: Record<string, string>) {
|
|
80
|
+
for (const name of environmentNames) {
|
|
81
|
+
const value = environment[name]
|
|
82
|
+
if (value === undefined) delete process.env[name]
|
|
83
|
+
else process.env[name] = value
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function writeSwiftSdkProducerResult(
|
|
88
|
+
file: string,
|
|
89
|
+
launchId: string,
|
|
90
|
+
error?: string,
|
|
91
|
+
) {
|
|
92
|
+
const temporary = `${file}.${randomUUID()}`
|
|
93
|
+
writeFileSync(temporary, JSON.stringify({ launchId, error: error ?? null }))
|
|
94
|
+
renameSync(temporary, file)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const launcher = `set -eu
|
|
98
|
+
tm detach "$TM_SESSION" >/dev/null
|
|
99
|
+
printf '%s\\n' "$TM_SESSION" > "$1.tmp"
|
|
100
|
+
mv "$1.tmp" "$1"
|
|
101
|
+
shift
|
|
102
|
+
export GIT_ALTERNATE_OBJECT_DIRECTORIES="$2/objects"
|
|
103
|
+
set +e
|
|
104
|
+
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
|
|
105
|
+
status=$?
|
|
106
|
+
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
|
|
107
|
+
exit "$status"
|
|
108
|
+
`
|
|
109
|
+
|
|
110
|
+
function retainSnapshotObjects(repo: string, capture: string): void {
|
|
111
|
+
const target = path.join(capture, 'objects')
|
|
112
|
+
const original = readFileSync(path.join(target, 'info/alternates'), 'utf8').trim()
|
|
113
|
+
const inherited = path.join(original, 'info/alternates')
|
|
114
|
+
const retainedAlternates = existsSync(inherited)
|
|
115
|
+
? readFileSync(inherited, 'utf8')
|
|
116
|
+
.split('\n')
|
|
117
|
+
.filter(Boolean)
|
|
118
|
+
.map((entry) => path.resolve(original, entry))
|
|
119
|
+
: []
|
|
120
|
+
const env: NodeJS.ProcessEnv = {
|
|
121
|
+
...process.env,
|
|
122
|
+
GIT_OBJECT_DIRECTORY: target,
|
|
123
|
+
GIT_NO_LAZY_FETCH: '1',
|
|
124
|
+
}
|
|
125
|
+
delete env.GIT_ALTERNATE_OBJECT_DIRECTORIES
|
|
126
|
+
const roots = ['source-commit', 'staged-tree', 'worktree-tree'].map((file) =>
|
|
127
|
+
readFileSync(path.join(capture, file), 'utf8').trim(),
|
|
128
|
+
)
|
|
129
|
+
const inventoryArgs = [
|
|
130
|
+
'-C',
|
|
131
|
+
repo,
|
|
132
|
+
'rev-list',
|
|
133
|
+
'--objects',
|
|
134
|
+
'--no-object-names',
|
|
135
|
+
'--missing=print',
|
|
136
|
+
'--no-walk',
|
|
137
|
+
...roots,
|
|
138
|
+
]
|
|
139
|
+
const inventory = execFileSync('git', inventoryArgs, {
|
|
140
|
+
encoding: 'utf8',
|
|
141
|
+
env,
|
|
142
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
143
|
+
})
|
|
144
|
+
if (inventory.split('\n').some((line) => line.startsWith('?')))
|
|
145
|
+
throw new Error('Swift SDK producer snapshot is missing source objects')
|
|
146
|
+
const history = execFileSync(
|
|
147
|
+
'git',
|
|
148
|
+
['-C', repo, 'rev-list', '--first-parent', roots[0]!],
|
|
149
|
+
{
|
|
150
|
+
encoding: 'utf8',
|
|
151
|
+
env,
|
|
152
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
153
|
+
},
|
|
154
|
+
)
|
|
155
|
+
mkdirSync(path.join(target, 'pack'), { recursive: true })
|
|
156
|
+
execFileSync('git', ['-C', repo, 'pack-objects', path.join(target, 'pack/source')], {
|
|
157
|
+
input: `${inventory}${history}`,
|
|
158
|
+
env,
|
|
159
|
+
stdio: ['pipe', 'ignore', 'inherit'],
|
|
160
|
+
})
|
|
161
|
+
rmSync(path.join(target, 'info/alternates'), { force: true })
|
|
162
|
+
const retained = execFileSync('git', inventoryArgs, {
|
|
163
|
+
encoding: 'utf8',
|
|
164
|
+
env,
|
|
165
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
166
|
+
})
|
|
167
|
+
if (retained.split('\n').some((line) => line.startsWith('?')))
|
|
168
|
+
throw new Error('Swift SDK producer could not retain its source objects')
|
|
169
|
+
if (retainedAlternates.length)
|
|
170
|
+
writeFileSync(
|
|
171
|
+
path.join(target, 'info/alternates'),
|
|
172
|
+
`${retainedAlternates.join('\n')}\n`,
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function producerSession(file: string): { session: string; state: string } | null {
|
|
177
|
+
if (!existsSync(file)) return null
|
|
178
|
+
const session = readFileSync(file, 'utf8').trim()
|
|
179
|
+
if (!/^[a-z0-9-]+$/.test(session))
|
|
180
|
+
throw new Error(`invalid Swift SDK producer session: ${file}`)
|
|
181
|
+
const status: unknown = JSON.parse(
|
|
182
|
+
execFileSync('tm', ['show', 'record', session], { encoding: 'utf8' }),
|
|
183
|
+
)
|
|
184
|
+
if (!isRecord(status) || typeof status.state !== 'string')
|
|
185
|
+
throw new Error(`cannot inspect Swift SDK producer ${session}`)
|
|
186
|
+
return { session, state: status.state }
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function producerSettled(directory: string): boolean {
|
|
190
|
+
if (producerSession(path.join(directory, 'session'))?.state !== 'exited') return false
|
|
191
|
+
const receipt = path.join(directory, 'delivery/cleanup.json')
|
|
192
|
+
if (!existsSync(receipt)) return false
|
|
193
|
+
const value: unknown = JSON.parse(readFileSync(receipt, 'utf8'))
|
|
194
|
+
return isRecord(value) && value.released === true
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Runs a source SDK image build in a daemon-owned Linux scope; callers only observe it. */
|
|
198
|
+
export async function produceSwiftSdkImage(input: {
|
|
199
|
+
moduleRoot: string
|
|
200
|
+
key: string
|
|
201
|
+
frameworkKey: string
|
|
202
|
+
scopedLookups: boolean
|
|
203
|
+
imports: readonly string[]
|
|
204
|
+
ready: () => boolean
|
|
205
|
+
signal?: AbortSignal
|
|
206
|
+
}): Promise<void> {
|
|
207
|
+
const root = path.join(swiftCacheDir(), 'swift-sdk-image-producers', input.key)
|
|
208
|
+
const current = path.join(root, 'current')
|
|
209
|
+
input.signal?.throwIfAborted()
|
|
210
|
+
const claim = await withSwiftRootLock(
|
|
211
|
+
`${root}.claim`,
|
|
212
|
+
async () => {
|
|
213
|
+
if (input.ready()) return null
|
|
214
|
+
if (existsSync(current)) {
|
|
215
|
+
const generation = readFileSync(current, 'utf8').trim()
|
|
216
|
+
if (!/^[a-f0-9-]{36}$/.test(generation))
|
|
217
|
+
throw new Error(`invalid Swift SDK producer generation: ${current}`)
|
|
218
|
+
const directory = path.join(root, generation)
|
|
219
|
+
const request = readRequest(path.join(directory, 'request.json'))
|
|
220
|
+
if (request.launchId !== generation)
|
|
221
|
+
throw new Error(`Swift SDK producer generation differs: ${directory}`)
|
|
222
|
+
const session = producerSession(path.join(directory, 'session'))
|
|
223
|
+
if (session) {
|
|
224
|
+
if (!producerSettled(directory)) return { directory, request }
|
|
225
|
+
rmSync(path.join(directory, 'snapshot'), {
|
|
226
|
+
recursive: true,
|
|
227
|
+
force: true,
|
|
228
|
+
})
|
|
229
|
+
} else if (Date.now() - request.created <= 60_000) {
|
|
230
|
+
return { directory, request }
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const repo = path.resolve(input.moduleRoot, '../..')
|
|
234
|
+
const launchId = randomUUID()
|
|
235
|
+
const directory = path.join(root, launchId)
|
|
236
|
+
const requestFile = path.join(directory, 'request.json')
|
|
237
|
+
const sessionFile = path.join(directory, 'session')
|
|
238
|
+
const capture = path.join(root, `.capture-${launchId}`)
|
|
239
|
+
mkdirSync(root, { recursive: true })
|
|
240
|
+
try {
|
|
241
|
+
execFileSync(
|
|
242
|
+
'bash',
|
|
243
|
+
[path.join(repo, 'scripts/lib/remote-source-snapshot.sh'), repo, capture],
|
|
244
|
+
{
|
|
245
|
+
stdio: 'inherit',
|
|
246
|
+
},
|
|
247
|
+
)
|
|
248
|
+
retainSnapshotObjects(repo, capture)
|
|
249
|
+
mkdirSync(directory)
|
|
250
|
+
renameSync(capture, path.join(directory, 'snapshot'))
|
|
251
|
+
const environment: Record<string, string> = {}
|
|
252
|
+
for (const name of environmentNames) {
|
|
253
|
+
const value = process.env[name]
|
|
254
|
+
if (value !== undefined) environment[name] = value
|
|
255
|
+
}
|
|
256
|
+
const record: Request = {
|
|
257
|
+
key: input.key,
|
|
258
|
+
launchId,
|
|
259
|
+
created: Date.now(),
|
|
260
|
+
scopedLookups: input.scopedLookups,
|
|
261
|
+
imports: [...input.imports],
|
|
262
|
+
cache: swiftCacheDir(),
|
|
263
|
+
environment,
|
|
264
|
+
}
|
|
265
|
+
writeFileSync(requestFile, JSON.stringify(record), { flag: 'wx' })
|
|
266
|
+
const next = `${current}.${launchId}`
|
|
267
|
+
writeFileSync(next, launchId, { flag: 'wx' })
|
|
268
|
+
renameSync(next, current)
|
|
269
|
+
const admitted = windowAdmission()?.cores ?? Number(process.env.TM_EXEC_CPU_CORES)
|
|
270
|
+
const cores =
|
|
271
|
+
Number.isSafeInteger(admitted) && admitted > 0 ? Math.max(4, admitted) : 4
|
|
272
|
+
const launched = await run(
|
|
273
|
+
'tm',
|
|
274
|
+
[
|
|
275
|
+
'run',
|
|
276
|
+
'--here',
|
|
277
|
+
'--in-place',
|
|
278
|
+
'--quiet',
|
|
279
|
+
'--no-finish-notice',
|
|
280
|
+
'--slug',
|
|
281
|
+
`swift-sdk-image-${record.launchId.slice(0, 8)}`,
|
|
282
|
+
'--',
|
|
283
|
+
'/bin/sh',
|
|
284
|
+
'-c',
|
|
285
|
+
launcher,
|
|
286
|
+
'swift-sdk-image',
|
|
287
|
+
sessionFile,
|
|
288
|
+
String(cores),
|
|
289
|
+
path.join(directory, 'snapshot'),
|
|
290
|
+
requestFile,
|
|
291
|
+
path.join(directory, 'delivery'),
|
|
292
|
+
input.frameworkKey,
|
|
293
|
+
],
|
|
294
|
+
{ cwd: repo },
|
|
295
|
+
)
|
|
296
|
+
if (!launched.stdout.trim())
|
|
297
|
+
throw new Error(`Swift SDK producer launch was not confirmed: ${directory}`)
|
|
298
|
+
return { directory, request: record }
|
|
299
|
+
} finally {
|
|
300
|
+
rmSync(capture, { recursive: true, force: true })
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
input.signal,
|
|
304
|
+
)
|
|
305
|
+
if (!claim) return
|
|
306
|
+
const { directory, request } = claim
|
|
307
|
+
const sessionFile = path.join(directory, 'session')
|
|
308
|
+
const resultFile = path.join(directory, 'result.json')
|
|
309
|
+
if (request.key !== input.key || request.cache !== swiftCacheDir())
|
|
310
|
+
throw new Error(`Swift SDK producer identity mismatch: ${directory}`)
|
|
311
|
+
for (;;) {
|
|
312
|
+
if (existsSync(resultFile)) {
|
|
313
|
+
const result: unknown = JSON.parse(readFileSync(resultFile, 'utf8'))
|
|
314
|
+
if (
|
|
315
|
+
!isRecord(result) ||
|
|
316
|
+
result.launchId !== request.launchId ||
|
|
317
|
+
!(result.error === null || typeof result.error === 'string')
|
|
318
|
+
)
|
|
319
|
+
throw new Error(`invalid Swift SDK producer result: ${resultFile}`)
|
|
320
|
+
if (result.error) throw new Error(`Swift SDK producer failed: ${result.error}`)
|
|
321
|
+
return
|
|
322
|
+
}
|
|
323
|
+
const status = producerSession(sessionFile)
|
|
324
|
+
if (status) {
|
|
325
|
+
if (status.state === 'exited') {
|
|
326
|
+
if (existsSync(resultFile)) continue
|
|
327
|
+
throw new Error(
|
|
328
|
+
`Swift SDK producer ${status.session} exited without a result; inspect its session before retrying`,
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
} else if (Date.now() - request.created > 60_000) {
|
|
332
|
+
throw new Error(`Swift SDK producer launch is unconfirmed: ${directory}`)
|
|
333
|
+
}
|
|
334
|
+
await sleep(2000, undefined, { signal: input.signal })
|
|
335
|
+
}
|
|
336
|
+
}
|