peachsim 0.1.788 → 0.1.790
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/outbound-endpoints.ts +0 -35
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.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 +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +83 -14
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.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 +1 -1
- package/dist-lib/skills.cjs +101 -26
- package/dist-lib/swift-compile.cjs +52 -1
- package/dist-lib/swift-compile.mjs +52 -1
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +54 -3
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/host/bridge-host.ts +5 -24
- package/src/host/lease-owner.test.ts +32 -0
- package/src/host/lease-owner.ts +40 -0
- package/src/swift-compile.ts +81 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/dist-lib/sdk.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/sdk.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
package/dist-lib/skills.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -30251,6 +30251,56 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
30251
30251
|
};
|
|
30252
30252
|
const hash = swiftArtifactHash(input, options.release, moduleRoot);
|
|
30253
30253
|
return serialize(root, async () => {
|
|
30254
|
+
if (process.platform === "darwin" && process.env.TM_SESSION && process.env.CI !== "true" && process.env.CONTRAST_HEAVY_ADMITTED !== "1" && moduleRoot === import_node_path7.default.resolve(import_meta2.dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
|
|
30255
|
+
const requestRoot = (0, import_node_fs7.mkdtempSync)(import_node_path7.default.join(root, ".builder-request-"));
|
|
30256
|
+
const output = import_node_path7.default.join(requestRoot, "output");
|
|
30257
|
+
const request = import_node_path7.default.join(requestRoot, "request.json");
|
|
30258
|
+
(0, import_node_fs7.writeFileSync)(
|
|
30259
|
+
request,
|
|
30260
|
+
JSON.stringify({
|
|
30261
|
+
input,
|
|
30262
|
+
hash,
|
|
30263
|
+
release: options.release,
|
|
30264
|
+
timeoutMs: options.timeoutMs,
|
|
30265
|
+
buildKey: (0, import_node_crypto3.createHash)("sha256").update(root).digest("hex").slice(0, 32)
|
|
30266
|
+
})
|
|
30267
|
+
);
|
|
30268
|
+
try {
|
|
30269
|
+
const repo = import_node_path7.default.resolve(moduleRoot, "../..");
|
|
30270
|
+
const pending = run2(
|
|
30271
|
+
"bun",
|
|
30272
|
+
[
|
|
30273
|
+
import_node_path7.default.join(repo, "scripts/build/swift-project.ts"),
|
|
30274
|
+
"--request",
|
|
30275
|
+
request,
|
|
30276
|
+
"--output",
|
|
30277
|
+
output
|
|
30278
|
+
],
|
|
30279
|
+
{ cwd: repo, timeout: options.timeoutMs, maxBuffer: 64 * 1024 * 1024 }
|
|
30280
|
+
);
|
|
30281
|
+
pending.child.stdout?.on("data", (bytes2) => process.stdout.write(bytes2));
|
|
30282
|
+
pending.child.stderr?.on("data", (bytes2) => process.stderr.write(bytes2));
|
|
30283
|
+
await pending;
|
|
30284
|
+
const receipt = JSON.parse(
|
|
30285
|
+
(0, import_node_fs7.readFileSync)(import_node_path7.default.join(output, "artifact.json"), "utf8")
|
|
30286
|
+
);
|
|
30287
|
+
if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string") {
|
|
30288
|
+
throw new Error(
|
|
30289
|
+
"swift-compile: builder artifact does not match the requested source"
|
|
30290
|
+
);
|
|
30291
|
+
}
|
|
30292
|
+
const bytes = (0, import_node_fs7.readFileSync)(import_node_path7.default.join(output, "app.wasm"));
|
|
30293
|
+
const gzip2 = (0, import_node_fs7.readFileSync)(import_node_path7.default.join(output, "icu.gz"));
|
|
30294
|
+
if ((0, import_node_crypto3.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto3.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016) {
|
|
30295
|
+
throw new Error(
|
|
30296
|
+
"swift-compile: builder artifact digest or wasm header is invalid"
|
|
30297
|
+
);
|
|
30298
|
+
}
|
|
30299
|
+
return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
30300
|
+
} finally {
|
|
30301
|
+
(0, import_node_fs7.rmSync)(requestRoot, { recursive: true, force: true });
|
|
30302
|
+
}
|
|
30303
|
+
}
|
|
30254
30304
|
writeSwiftProject(layout, input, moduleRoot);
|
|
30255
30305
|
const swift = import_node_path7.default.join(options.toolchainBin, "swift");
|
|
30256
30306
|
if (!(0, import_node_fs7.existsSync)(swift)) {
|
|
@@ -30301,7 +30351,7 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
30301
30351
|
};
|
|
30302
30352
|
});
|
|
30303
30353
|
}
|
|
30304
|
-
var import_node_child_process4, import_node_crypto3, import_node_fs7, import_node_os2, import_node_path7, import_node_util2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, sdkPaths, availableModules, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, compiledSource, ROOT_LOCKS, host, rootLocks;
|
|
30354
|
+
var import_node_child_process4, import_node_crypto3, import_node_fs7, import_node_os2, import_node_path7, import_node_util2, import_meta2, run2, WASM_TRIPLE, cores, BUILD_ENV, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, sdkPaths, availableModules, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, MULTI_MANIFEST_VERSION, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, compiledSource, ROOT_LOCKS, host, rootLocks;
|
|
30305
30355
|
var init_swift_compile = __esm({
|
|
30306
30356
|
"src/swift-compile.ts"() {
|
|
30307
30357
|
"use strict";
|
|
@@ -30314,6 +30364,7 @@ var init_swift_compile = __esm({
|
|
|
30314
30364
|
init_swift_distribution_contract();
|
|
30315
30365
|
init_swift_icu();
|
|
30316
30366
|
init_swift_package();
|
|
30367
|
+
import_meta2 = {};
|
|
30317
30368
|
run2 = (0, import_node_util2.promisify)(import_node_child_process4.execFile);
|
|
30318
30369
|
WASM_TRIPLE = "wasm32-unknown-wasip1";
|
|
30319
30370
|
cores = import_node_os2.default.availableParallelism();
|
|
@@ -31009,7 +31060,7 @@ function swiftDistributionRoot() {
|
|
|
31009
31060
|
return pending;
|
|
31010
31061
|
}
|
|
31011
31062
|
async function resolveSwiftModule() {
|
|
31012
|
-
const checkout2 = import_node_path11.default.resolve(
|
|
31063
|
+
const checkout2 = import_node_path11.default.resolve(import_meta3.dirname, "../../sootsim-swift");
|
|
31013
31064
|
if (import_node_fs11.default.existsSync(import_node_path11.default.join(checkout2, "toolchain.json"))) {
|
|
31014
31065
|
try {
|
|
31015
31066
|
return { root: checkout2, ...swiftModuleToolchain(checkout2) };
|
|
@@ -31027,7 +31078,7 @@ function swiftModuleToolchain(root) {
|
|
|
31027
31078
|
toolchainBin: swiftToolchain(pin.release, swiftModuleSdk(root))
|
|
31028
31079
|
};
|
|
31029
31080
|
}
|
|
31030
|
-
var import_node_fs11, import_node_path11,
|
|
31081
|
+
var import_node_fs11, import_node_path11, import_meta3, SWIFT_ENDPOINT_ENV, installs;
|
|
31031
31082
|
var init_swift_distribution = __esm({
|
|
31032
31083
|
"src/swift-distribution.ts"() {
|
|
31033
31084
|
"use strict";
|
|
@@ -31039,7 +31090,7 @@ var init_swift_distribution = __esm({
|
|
|
31039
31090
|
init_swift_distribution_contract();
|
|
31040
31091
|
init_swift_distribution_lock();
|
|
31041
31092
|
init_swift_toolchain();
|
|
31042
|
-
|
|
31093
|
+
import_meta3 = {};
|
|
31043
31094
|
SWIFT_ENDPOINT_ENV = "PEACH_SWIFT_ENDPOINT";
|
|
31044
31095
|
installs = /* @__PURE__ */ new Map();
|
|
31045
31096
|
}
|
|
@@ -39271,6 +39322,39 @@ var init_fetch_proxy_transport = __esm({
|
|
|
39271
39322
|
}
|
|
39272
39323
|
});
|
|
39273
39324
|
|
|
39325
|
+
// src/host/lease-owner.ts
|
|
39326
|
+
function isProcessGroupAlive(pgid) {
|
|
39327
|
+
if (!Number.isInteger(pgid) || pgid <= 1) return true;
|
|
39328
|
+
try {
|
|
39329
|
+
process.kill(-pgid, 0);
|
|
39330
|
+
return true;
|
|
39331
|
+
} catch (error) {
|
|
39332
|
+
const code = error && typeof error === "object" ? Reflect.get(error, "code") : null;
|
|
39333
|
+
return code !== "ESRCH";
|
|
39334
|
+
}
|
|
39335
|
+
}
|
|
39336
|
+
function isCliLeaseOwnerGone(lease, isGroupAlive = isProcessGroupAlive, isPidAlive = isProcessAlive2) {
|
|
39337
|
+
if (lease.kind !== "cli") return false;
|
|
39338
|
+
if (lease.ownerPgid !== void 0 && !isGroupAlive(lease.ownerPgid)) return true;
|
|
39339
|
+
const owner = /^gppid-(\d+)$/.exec(lease.cliIdentityKey);
|
|
39340
|
+
return owner !== null && !isPidAlive(Number(owner[1]));
|
|
39341
|
+
}
|
|
39342
|
+
function isProcessAlive2(pid) {
|
|
39343
|
+
if (!Number.isInteger(pid) || pid <= 1) return true;
|
|
39344
|
+
try {
|
|
39345
|
+
process.kill(pid, 0);
|
|
39346
|
+
return true;
|
|
39347
|
+
} catch (error) {
|
|
39348
|
+
const code = error && typeof error === "object" ? Reflect.get(error, "code") : null;
|
|
39349
|
+
return code !== "ESRCH";
|
|
39350
|
+
}
|
|
39351
|
+
}
|
|
39352
|
+
var init_lease_owner = __esm({
|
|
39353
|
+
"src/host/lease-owner.ts"() {
|
|
39354
|
+
"use strict";
|
|
39355
|
+
}
|
|
39356
|
+
});
|
|
39357
|
+
|
|
39274
39358
|
// src/host/open-url.ts
|
|
39275
39359
|
function buildOpenUrlCommand(url, options = {}) {
|
|
39276
39360
|
if (!url) throw new Error("openUrl requires a url");
|
|
@@ -44829,16 +44913,6 @@ __export(bridge_host_exports, {
|
|
|
44829
44913
|
SootSimBridgeHost: () => SootSimBridgeHost,
|
|
44830
44914
|
injectSharedConfigIntoHtml: () => injectSharedConfigIntoHtml
|
|
44831
44915
|
});
|
|
44832
|
-
function isProcessGroupAlive(pgid) {
|
|
44833
|
-
if (!Number.isInteger(pgid) || pgid <= 1) return true;
|
|
44834
|
-
try {
|
|
44835
|
-
process.kill(-pgid, 0);
|
|
44836
|
-
return true;
|
|
44837
|
-
} catch (error) {
|
|
44838
|
-
const code = error && typeof error === "object" ? Reflect.get(error, "code") : null;
|
|
44839
|
-
return code !== "ESRCH";
|
|
44840
|
-
}
|
|
44841
|
-
}
|
|
44842
44916
|
function shouldAcquireLease(msg) {
|
|
44843
44917
|
if (!msg || typeof msg.type !== "string") return false;
|
|
44844
44918
|
if (msg.acquireLock === true) return true;
|
|
@@ -44890,6 +44964,7 @@ var init_bridge_host = __esm({
|
|
|
44890
44964
|
init_agent_host();
|
|
44891
44965
|
init_fetch_proxy_handler();
|
|
44892
44966
|
init_fetch_proxy_transport();
|
|
44967
|
+
init_lease_owner();
|
|
44893
44968
|
init_open_url();
|
|
44894
44969
|
init_plane_host();
|
|
44895
44970
|
init_replacement_module_handler();
|
|
@@ -46517,7 +46592,7 @@ var init_bridge_host = __esm({
|
|
|
46517
46592
|
sim.cliLease = void 0;
|
|
46518
46593
|
return null;
|
|
46519
46594
|
}
|
|
46520
|
-
if (
|
|
46595
|
+
if (isCliLeaseOwnerGone(lease)) {
|
|
46521
46596
|
sim.cliLease = void 0;
|
|
46522
46597
|
return null;
|
|
46523
46598
|
}
|
|
@@ -49902,7 +49977,7 @@ function getSootsimRoot() {
|
|
|
49902
49977
|
if (_sootsimRoot !== void 0) return _sootsimRoot;
|
|
49903
49978
|
try {
|
|
49904
49979
|
_sootsimRoot = (0, import_path5.dirname)(
|
|
49905
|
-
(0, import_url2.fileURLToPath)(
|
|
49980
|
+
(0, import_url2.fileURLToPath)(import_meta4.resolve("peach-engine/package.json"))
|
|
49906
49981
|
);
|
|
49907
49982
|
} catch {
|
|
49908
49983
|
_sootsimRoot = null;
|
|
@@ -50152,7 +50227,7 @@ function buildMacLaunchUrl(url, opts, nativeApp = false) {
|
|
|
50152
50227
|
}
|
|
50153
50228
|
return deepLink.toString();
|
|
50154
50229
|
}
|
|
50155
|
-
var import_child_process5, import_fs6, import_path5, import_url2,
|
|
50230
|
+
var import_child_process5, import_fs6, import_path5, import_url2, import_meta4, _sootsimRoot, PEACH_BUNDLE_ID;
|
|
50156
50231
|
var init_desktop_companion = __esm({
|
|
50157
50232
|
"cli/desktop-companion.ts"() {
|
|
50158
50233
|
"use strict";
|
|
@@ -50161,7 +50236,7 @@ var init_desktop_companion = __esm({
|
|
|
50161
50236
|
import_path5 = require("path");
|
|
50162
50237
|
import_url2 = require("url");
|
|
50163
50238
|
init_desktop_host_delivery();
|
|
50164
|
-
|
|
50239
|
+
import_meta4 = {};
|
|
50165
50240
|
PEACH_BUNDLE_ID = "dev.peachsim.simulator";
|
|
50166
50241
|
}
|
|
50167
50242
|
});
|
|
@@ -52166,7 +52241,7 @@ function getSkillsDir() {
|
|
|
52166
52241
|
}
|
|
52167
52242
|
try {
|
|
52168
52243
|
const pkgPath = (0, import_url3.fileURLToPath)(
|
|
52169
|
-
|
|
52244
|
+
import_meta5.resolve(`${rnxPublicBrand.packageName}/package.json`)
|
|
52170
52245
|
);
|
|
52171
52246
|
return primaryCheckoutPath(path33.join(path33.dirname(pkgPath), "skills"));
|
|
52172
52247
|
} catch {
|
|
@@ -52272,7 +52347,7 @@ function listSkills() {
|
|
|
52272
52347
|
}
|
|
52273
52348
|
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
52274
52349
|
}
|
|
52275
|
-
var import_child_process7, fs29, os9, path33, import_url3,
|
|
52350
|
+
var import_child_process7, fs29, os9, path33, import_url3, import_meta5, skillsDirPath;
|
|
52276
52351
|
var init_skills = __esm({
|
|
52277
52352
|
"cli/commands/skills.ts"() {
|
|
52278
52353
|
"use strict";
|
|
@@ -52285,7 +52360,7 @@ var init_skills = __esm({
|
|
|
52285
52360
|
init_home_paths();
|
|
52286
52361
|
init_public_brand();
|
|
52287
52362
|
init_run_rnx();
|
|
52288
|
-
|
|
52363
|
+
import_meta5 = {};
|
|
52289
52364
|
}
|
|
52290
52365
|
});
|
|
52291
52366
|
|
|
@@ -53254,7 +53329,7 @@ async function waitForSimMatchOrHostExit(wsPort, commandTimeoutMs, predicate, ho
|
|
|
53254
53329
|
const attempts = opts.attempts ?? 30;
|
|
53255
53330
|
const intervalMs = opts.intervalMs ?? 500;
|
|
53256
53331
|
const watchHost = !!hostPid && Number.isInteger(hostPid) && hostPid > 1;
|
|
53257
|
-
const hostExited = () => watchHost && hostPid !== void 0 && !
|
|
53332
|
+
const hostExited = () => watchHost && hostPid !== void 0 && !isProcessAlive3(hostPid);
|
|
53258
53333
|
for (let i = 0; i < attempts; i++) {
|
|
53259
53334
|
opts.signal?.throwIfAborted();
|
|
53260
53335
|
if (hostExited()) {
|
|
@@ -53349,7 +53424,7 @@ ${detail.slice(-4e3)}` : detail;
|
|
|
53349
53424
|
);
|
|
53350
53425
|
}
|
|
53351
53426
|
}
|
|
53352
|
-
function
|
|
53427
|
+
function isProcessAlive3(pid) {
|
|
53353
53428
|
try {
|
|
53354
53429
|
process.kill(pid, 0);
|
|
53355
53430
|
return true;
|
|
@@ -53360,10 +53435,10 @@ function isProcessAlive2(pid) {
|
|
|
53360
53435
|
async function waitForProcessExit(pid, timeoutMs = 2500) {
|
|
53361
53436
|
const deadline = Date.now() + timeoutMs;
|
|
53362
53437
|
while (Date.now() < deadline) {
|
|
53363
|
-
if (!
|
|
53438
|
+
if (!isProcessAlive3(pid)) return true;
|
|
53364
53439
|
await sleep(100);
|
|
53365
53440
|
}
|
|
53366
|
-
return !
|
|
53441
|
+
return !isProcessAlive3(pid);
|
|
53367
53442
|
}
|
|
53368
53443
|
function isPlaywrightHostProcess(pid) {
|
|
53369
53444
|
const plain = (0, import_node_child_process16.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -307,6 +307,7 @@ function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
// src/swift-compile.ts
|
|
310
|
+
var import_meta = {};
|
|
310
311
|
var run2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
|
|
311
312
|
var WASM_TRIPLE = "wasm32-unknown-wasip1";
|
|
312
313
|
var cores = import_node_os.default.availableParallelism();
|
|
@@ -1709,6 +1710,56 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
1709
1710
|
};
|
|
1710
1711
|
const hash = swiftArtifactHash(input, options.release, moduleRoot);
|
|
1711
1712
|
return serialize(root, async () => {
|
|
1713
|
+
if (process.platform === "darwin" && process.env.TM_SESSION && process.env.CI !== "true" && process.env.CONTRAST_HEAVY_ADMITTED !== "1" && moduleRoot === import_node_path2.default.resolve(import_meta.dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
|
|
1714
|
+
const requestRoot = (0, import_node_fs2.mkdtempSync)(import_node_path2.default.join(root, ".builder-request-"));
|
|
1715
|
+
const output = import_node_path2.default.join(requestRoot, "output");
|
|
1716
|
+
const request = import_node_path2.default.join(requestRoot, "request.json");
|
|
1717
|
+
(0, import_node_fs2.writeFileSync)(
|
|
1718
|
+
request,
|
|
1719
|
+
JSON.stringify({
|
|
1720
|
+
input,
|
|
1721
|
+
hash,
|
|
1722
|
+
release: options.release,
|
|
1723
|
+
timeoutMs: options.timeoutMs,
|
|
1724
|
+
buildKey: (0, import_node_crypto2.createHash)("sha256").update(root).digest("hex").slice(0, 32)
|
|
1725
|
+
})
|
|
1726
|
+
);
|
|
1727
|
+
try {
|
|
1728
|
+
const repo = import_node_path2.default.resolve(moduleRoot, "../..");
|
|
1729
|
+
const pending = run2(
|
|
1730
|
+
"bun",
|
|
1731
|
+
[
|
|
1732
|
+
import_node_path2.default.join(repo, "scripts/build/swift-project.ts"),
|
|
1733
|
+
"--request",
|
|
1734
|
+
request,
|
|
1735
|
+
"--output",
|
|
1736
|
+
output
|
|
1737
|
+
],
|
|
1738
|
+
{ cwd: repo, timeout: options.timeoutMs, maxBuffer: 64 * 1024 * 1024 }
|
|
1739
|
+
);
|
|
1740
|
+
pending.child.stdout?.on("data", (bytes2) => process.stdout.write(bytes2));
|
|
1741
|
+
pending.child.stderr?.on("data", (bytes2) => process.stderr.write(bytes2));
|
|
1742
|
+
await pending;
|
|
1743
|
+
const receipt = JSON.parse(
|
|
1744
|
+
(0, import_node_fs2.readFileSync)(import_node_path2.default.join(output, "artifact.json"), "utf8")
|
|
1745
|
+
);
|
|
1746
|
+
if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string") {
|
|
1747
|
+
throw new Error(
|
|
1748
|
+
"swift-compile: builder artifact does not match the requested source"
|
|
1749
|
+
);
|
|
1750
|
+
}
|
|
1751
|
+
const bytes = (0, import_node_fs2.readFileSync)(import_node_path2.default.join(output, "app.wasm"));
|
|
1752
|
+
const gzip2 = (0, import_node_fs2.readFileSync)(import_node_path2.default.join(output, "icu.gz"));
|
|
1753
|
+
if ((0, import_node_crypto2.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto2.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016) {
|
|
1754
|
+
throw new Error(
|
|
1755
|
+
"swift-compile: builder artifact digest or wasm header is invalid"
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1758
|
+
return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
1759
|
+
} finally {
|
|
1760
|
+
(0, import_node_fs2.rmSync)(requestRoot, { recursive: true, force: true });
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1712
1763
|
writeSwiftProject(layout, input, moduleRoot);
|
|
1713
1764
|
const swift = import_node_path2.default.join(options.toolchainBin, "swift");
|
|
1714
1765
|
if (!(0, import_node_fs2.existsSync)(swift)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
|
|
3
3
|
// src/swift-compile.ts
|
|
4
4
|
import { execFile as execFile2, execFileSync } from "node:child_process";
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
cpSync,
|
|
8
8
|
existsSync,
|
|
9
9
|
mkdirSync,
|
|
10
|
+
mkdtempSync,
|
|
10
11
|
readFileSync as readFileSync2,
|
|
11
12
|
readdirSync,
|
|
12
13
|
realpathSync,
|
|
@@ -1658,6 +1659,56 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
1658
1659
|
};
|
|
1659
1660
|
const hash = swiftArtifactHash(input, options.release, moduleRoot);
|
|
1660
1661
|
return serialize(root, async () => {
|
|
1662
|
+
if (process.platform === "darwin" && process.env.TM_SESSION && process.env.CI !== "true" && process.env.CONTRAST_HEAVY_ADMITTED !== "1" && moduleRoot === path2.resolve(import.meta.dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
|
|
1663
|
+
const requestRoot = mkdtempSync(path2.join(root, ".builder-request-"));
|
|
1664
|
+
const output = path2.join(requestRoot, "output");
|
|
1665
|
+
const request = path2.join(requestRoot, "request.json");
|
|
1666
|
+
writeFileSync(
|
|
1667
|
+
request,
|
|
1668
|
+
JSON.stringify({
|
|
1669
|
+
input,
|
|
1670
|
+
hash,
|
|
1671
|
+
release: options.release,
|
|
1672
|
+
timeoutMs: options.timeoutMs,
|
|
1673
|
+
buildKey: createHash2("sha256").update(root).digest("hex").slice(0, 32)
|
|
1674
|
+
})
|
|
1675
|
+
);
|
|
1676
|
+
try {
|
|
1677
|
+
const repo = path2.resolve(moduleRoot, "../..");
|
|
1678
|
+
const pending = run2(
|
|
1679
|
+
"bun",
|
|
1680
|
+
[
|
|
1681
|
+
path2.join(repo, "scripts/build/swift-project.ts"),
|
|
1682
|
+
"--request",
|
|
1683
|
+
request,
|
|
1684
|
+
"--output",
|
|
1685
|
+
output
|
|
1686
|
+
],
|
|
1687
|
+
{ cwd: repo, timeout: options.timeoutMs, maxBuffer: 64 * 1024 * 1024 }
|
|
1688
|
+
);
|
|
1689
|
+
pending.child.stdout?.on("data", (bytes2) => process.stdout.write(bytes2));
|
|
1690
|
+
pending.child.stderr?.on("data", (bytes2) => process.stderr.write(bytes2));
|
|
1691
|
+
await pending;
|
|
1692
|
+
const receipt = JSON.parse(
|
|
1693
|
+
readFileSync2(path2.join(output, "artifact.json"), "utf8")
|
|
1694
|
+
);
|
|
1695
|
+
if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string") {
|
|
1696
|
+
throw new Error(
|
|
1697
|
+
"swift-compile: builder artifact does not match the requested source"
|
|
1698
|
+
);
|
|
1699
|
+
}
|
|
1700
|
+
const bytes = readFileSync2(path2.join(output, "app.wasm"));
|
|
1701
|
+
const gzip2 = readFileSync2(path2.join(output, "icu.gz"));
|
|
1702
|
+
if (createHash2("sha256").update(bytes).digest("hex") !== receipt.wasm || createHash2("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016) {
|
|
1703
|
+
throw new Error(
|
|
1704
|
+
"swift-compile: builder artifact digest or wasm header is invalid"
|
|
1705
|
+
);
|
|
1706
|
+
}
|
|
1707
|
+
return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
1708
|
+
} finally {
|
|
1709
|
+
rmSync(requestRoot, { recursive: true, force: true });
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1661
1712
|
writeSwiftProject(layout, input, moduleRoot);
|
|
1662
1713
|
const swift = path2.join(options.toolchainBin, "swift");
|
|
1663
1714
|
if (!existsSync(swift)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/dist-lib/swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __defProp = Object.defineProperty;
|
package/dist-lib/vite-swift.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
|
@@ -1707,6 +1707,7 @@ function swiftPackagePartition(manifest, resourcePaths = []) {
|
|
|
1707
1707
|
}
|
|
1708
1708
|
|
|
1709
1709
|
// src/swift-compile.ts
|
|
1710
|
+
var import_meta = {};
|
|
1710
1711
|
var run2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
|
|
1711
1712
|
var WASM_TRIPLE = "wasm32-unknown-wasip1";
|
|
1712
1713
|
var cores = import_node_os.default.availableParallelism();
|
|
@@ -3072,6 +3073,56 @@ function compileSwiftProjectUnit(input, options) {
|
|
|
3072
3073
|
};
|
|
3073
3074
|
const hash = swiftArtifactHash(input, options.release, moduleRoot);
|
|
3074
3075
|
return serialize(root, async () => {
|
|
3076
|
+
if (process.platform === "darwin" && process.env.TM_SESSION && process.env.CI !== "true" && process.env.CONTRAST_HEAVY_ADMITTED !== "1" && moduleRoot === import_node_path2.default.resolve(import_meta.dirname, "../../sootsim-swift") && !swiftDistributionAt(moduleRoot)) {
|
|
3077
|
+
const requestRoot = (0, import_node_fs2.mkdtempSync)(import_node_path2.default.join(root, ".builder-request-"));
|
|
3078
|
+
const output = import_node_path2.default.join(requestRoot, "output");
|
|
3079
|
+
const request = import_node_path2.default.join(requestRoot, "request.json");
|
|
3080
|
+
(0, import_node_fs2.writeFileSync)(
|
|
3081
|
+
request,
|
|
3082
|
+
JSON.stringify({
|
|
3083
|
+
input,
|
|
3084
|
+
hash,
|
|
3085
|
+
release: options.release,
|
|
3086
|
+
timeoutMs: options.timeoutMs,
|
|
3087
|
+
buildKey: (0, import_node_crypto2.createHash)("sha256").update(root).digest("hex").slice(0, 32)
|
|
3088
|
+
})
|
|
3089
|
+
);
|
|
3090
|
+
try {
|
|
3091
|
+
const repo = import_node_path2.default.resolve(moduleRoot, "../..");
|
|
3092
|
+
const pending = run2(
|
|
3093
|
+
"bun",
|
|
3094
|
+
[
|
|
3095
|
+
import_node_path2.default.join(repo, "scripts/build/swift-project.ts"),
|
|
3096
|
+
"--request",
|
|
3097
|
+
request,
|
|
3098
|
+
"--output",
|
|
3099
|
+
output
|
|
3100
|
+
],
|
|
3101
|
+
{ cwd: repo, timeout: options.timeoutMs, maxBuffer: 64 * 1024 * 1024 }
|
|
3102
|
+
);
|
|
3103
|
+
pending.child.stdout?.on("data", (bytes2) => process.stdout.write(bytes2));
|
|
3104
|
+
pending.child.stderr?.on("data", (bytes2) => process.stderr.write(bytes2));
|
|
3105
|
+
await pending;
|
|
3106
|
+
const receipt = JSON.parse(
|
|
3107
|
+
(0, import_node_fs2.readFileSync)(import_node_path2.default.join(output, "artifact.json"), "utf8")
|
|
3108
|
+
);
|
|
3109
|
+
if (!receipt || typeof receipt !== "object" || !("hash" in receipt) || receipt.hash !== hash || !("icu" in receipt) || typeof receipt.icu !== "string" || !("wasm" in receipt) || typeof receipt.wasm !== "string") {
|
|
3110
|
+
throw new Error(
|
|
3111
|
+
"swift-compile: builder artifact does not match the requested source"
|
|
3112
|
+
);
|
|
3113
|
+
}
|
|
3114
|
+
const bytes = (0, import_node_fs2.readFileSync)(import_node_path2.default.join(output, "app.wasm"));
|
|
3115
|
+
const gzip2 = (0, import_node_fs2.readFileSync)(import_node_path2.default.join(output, "icu.gz"));
|
|
3116
|
+
if ((0, import_node_crypto2.createHash)("sha256").update(bytes).digest("hex") !== receipt.wasm || (0, import_node_crypto2.createHash)("sha256").update(gzip2).digest("hex") !== receipt.icu || bytes.length < 8 || bytes.readUInt32LE(0) !== 1836278016) {
|
|
3117
|
+
throw new Error(
|
|
3118
|
+
"swift-compile: builder artifact digest or wasm header is invalid"
|
|
3119
|
+
);
|
|
3120
|
+
}
|
|
3121
|
+
return { hash, bytes, icu: { sha256: receipt.icu, gzip: gzip2 } };
|
|
3122
|
+
} finally {
|
|
3123
|
+
(0, import_node_fs2.rmSync)(requestRoot, { recursive: true, force: true });
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3075
3126
|
writeSwiftProject(layout, input, moduleRoot);
|
|
3076
3127
|
const swift = import_node_path2.default.join(options.toolchainBin, "swift");
|
|
3077
3128
|
if (!(0, import_node_fs2.existsSync)(swift)) {
|
|
@@ -4696,7 +4747,7 @@ var peachPublicBrand = Object.freeze({
|
|
|
4696
4747
|
var rnxPublicBrand = peachPublicBrand;
|
|
4697
4748
|
|
|
4698
4749
|
// src/cli-version.ts
|
|
4699
|
-
var
|
|
4750
|
+
var import_meta2 = {};
|
|
4700
4751
|
var cached = null;
|
|
4701
4752
|
function getCliVersion() {
|
|
4702
4753
|
if (cached != null) return cached;
|
|
@@ -4705,7 +4756,7 @@ function getCliVersion() {
|
|
|
4705
4756
|
return cached;
|
|
4706
4757
|
}
|
|
4707
4758
|
const candidates = [
|
|
4708
|
-
() => (0, import_node_url.fileURLToPath)(
|
|
4759
|
+
() => (0, import_node_url.fileURLToPath)(import_meta2.resolve(`${rnxPublicBrand.packageName}/package.json`)),
|
|
4709
4760
|
() => (0, import_node_url.fileURLToPath)(new URL("../package.json", __sootsim_import_meta_url))
|
|
4710
4761
|
];
|
|
4711
4762
|
for (const resolve2 of candidates) {
|
package/dist-lib/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.790 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
|
|
2
2
|
let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
|
|
3
3
|
"use strict";
|
|
4
4
|
var __create = Object.create;
|
package/package.json
CHANGED
package/src/host/bridge-host.ts
CHANGED
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
isFetchProxyRequestUrl,
|
|
56
56
|
} from './fetch-proxy-handler.ts'
|
|
57
57
|
import { startFetchProxyTransport } from './fetch-proxy-transport.ts'
|
|
58
|
+
import { isCliLeaseOwnerGone } from './lease-owner'
|
|
58
59
|
import { openUrl as openUrlInBrowser, type OpenUrlOptions } from './open-url.ts'
|
|
59
60
|
import { PlaneHost } from './plane-host.ts'
|
|
60
61
|
import {
|
|
@@ -181,21 +182,6 @@ interface BridgeCliLease {
|
|
|
181
182
|
ownerPgid?: number
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
// true when the process group still has members. ESRCH = the group is gone;
|
|
185
|
-
// EPERM = alive but owned by another user, which still counts as alive. any
|
|
186
|
-
// other failure (or a bogus id) resolves alive, so a lease is only ever freed
|
|
187
|
-
// on positive proof its owner session is gone — never kill(-1) (everyone).
|
|
188
|
-
function isProcessGroupAlive(pgid: number): boolean {
|
|
189
|
-
if (!Number.isInteger(pgid) || pgid <= 1) return true
|
|
190
|
-
try {
|
|
191
|
-
process.kill(-pgid, 0)
|
|
192
|
-
return true
|
|
193
|
-
} catch (error) {
|
|
194
|
-
const code = error && typeof error === 'object' ? Reflect.get(error, 'code') : null
|
|
195
|
-
return code !== 'ESRCH'
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
185
|
// interactive commands change app state and must respect the lease.
|
|
200
186
|
// observational/lifecycle commands (evaluate/tree/query/resolve/screenshot/capture/focus/call/close)
|
|
201
187
|
// pass through without taking or checking a lease so cleanup never gets stuck
|
|
@@ -2307,15 +2293,10 @@ export class SootSimBridgeHost {
|
|
|
2307
2293
|
sim.cliLease = undefined
|
|
2308
2294
|
return null
|
|
2309
2295
|
}
|
|
2310
|
-
// a cli lease whose
|
|
2311
|
-
//
|
|
2312
|
-
//
|
|
2313
|
-
|
|
2314
|
-
if (
|
|
2315
|
-
lease.kind === 'cli' &&
|
|
2316
|
-
lease.ownerPgid !== undefined &&
|
|
2317
|
-
!isProcessGroupAlive(lease.ownerPgid)
|
|
2318
|
-
) {
|
|
2296
|
+
// a cli lease whose owner is gone is free: the session that held it can
|
|
2297
|
+
// never renew, so holding the sim until the TTL burns out only blocks
|
|
2298
|
+
// live callers behind a dead owner. user-active leases keep TTL-only expiry.
|
|
2299
|
+
if (isCliLeaseOwnerGone(lease)) {
|
|
2319
2300
|
sim.cliLease = undefined
|
|
2320
2301
|
return null
|
|
2321
2302
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
import { isCliLeaseOwnerGone } from './lease-owner'
|
|
3
|
+
|
|
4
|
+
const alive = () => true
|
|
5
|
+
const gone = () => false
|
|
6
|
+
|
|
7
|
+
describe('isCliLeaseOwnerGone', () => {
|
|
8
|
+
test('a gppid owner that exited frees the lease while its group lives on', () => {
|
|
9
|
+
const lease = { kind: 'cli' as const, cliIdentityKey: 'gppid-8513', ownerPgid: 8513 }
|
|
10
|
+
expect(isCliLeaseOwnerGone(lease, alive, gone)).toBe(true)
|
|
11
|
+
expect(isCliLeaseOwnerGone(lease, alive, alive)).toBe(false)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('an empty owner group frees the lease whatever the identity', () => {
|
|
15
|
+
const lease = {
|
|
16
|
+
kind: 'cli' as const,
|
|
17
|
+
cliIdentityKey: 'CODEX_THREAD_ID:abc',
|
|
18
|
+
ownerPgid: 42,
|
|
19
|
+
}
|
|
20
|
+
expect(isCliLeaseOwnerGone(lease, gone, alive)).toBe(true)
|
|
21
|
+
expect(isCliLeaseOwnerGone(lease, alive, gone)).toBe(false)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('a user-active lease keeps ttl-only expiry', () => {
|
|
25
|
+
const lease = {
|
|
26
|
+
kind: 'user-active' as const,
|
|
27
|
+
cliIdentityKey: 'gppid-1',
|
|
28
|
+
ownerPgid: 2,
|
|
29
|
+
}
|
|
30
|
+
expect(isCliLeaseOwnerGone(lease, gone, gone)).toBe(false)
|
|
31
|
+
})
|
|
32
|
+
})
|