🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@limrun/api

Package Overview
Dependencies
Maintainers
4
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@limrun/api - npm Package Compare versions

Comparing version
0.34.0
to
0.35.0
+35
rbe-session.d.mts
import type { RbeStatus, XcodeClient } from "./resources/xcode-instances-helpers.mjs";
/**
* Client-side helpers for driving an instance's RBE stack: waiting for it to
* come up and riding out the transient gateway errors that occur right after
* instance creation. Shared by the CLI and pure-SDK consumers (e.g. CI
* actions).
*/
export type Sleep = (ms: number) => Promise<void>;
export declare const defaultSleep: Sleep;
export declare function isTransientError(err: unknown): boolean;
/**
* Retries `fn` on transient gateway errors (or on whatever `retryOn` matches
* when given). Non-matching errors propagate immediately. After exhausting
* `attempts`, throws the last error.
*/
export declare function retryTransient<T>(fn: () => Promise<T>, opts?: {
sleep?: Sleep;
log?: (msg: string) => void;
attempts?: number;
retryOn?: (err: unknown) => boolean;
}): Promise<T>;
/** RbeStatus once the stack is running: frontendPort and xcodeVersion are set. */
export type RunningRbeStatus = RbeStatus & Required<Pick<RbeStatus, 'frontendPort' | 'xcodeVersion'>>;
/**
* Polls `getRbe` until the stack is `running` (with a usable frontend port and
* Xcode version), starting from the `initial` status returned by `startRbe`.
* Each poll is wrapped in retryTransient so a transient blip mid-startup does
* not abort. Throws when the stack ends in `failed`, stays `starting` past
* `maxAttempts`, or reports `running` without the fields the caller needs.
*/
export declare function waitForRbeRunning(client: Pick<XcodeClient, 'getRbe'>, initial: RbeStatus, opts?: {
sleep?: Sleep;
maxAttempts?: number;
}): Promise<RunningRbeStatus>;
//# sourceMappingURL=rbe-session.d.mts.map
{"version":3,"file":"rbe-session.d.mts","sourceRoot":"","sources":["src/rbe-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,gDAA4C;AAElF;;;;;GAKG;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAClD,eAAO,MAAM,YAAY,EAAE,KAAiE,CAAC;AAc7F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGtD;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,IAAI,GAAE;IACJ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;CAChC,GACL,OAAO,CAAC,CAAC,CAAC,CAqBZ;AAED,kFAAkF;AAClF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC;AAEtG;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EACnC,OAAO,EAAE,SAAS,EAClB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,OAAO,CAAC,gBAAgB,CAAC,CAY3B"}
import type { RbeStatus, XcodeClient } from "./resources/xcode-instances-helpers.js";
/**
* Client-side helpers for driving an instance's RBE stack: waiting for it to
* come up and riding out the transient gateway errors that occur right after
* instance creation. Shared by the CLI and pure-SDK consumers (e.g. CI
* actions).
*/
export type Sleep = (ms: number) => Promise<void>;
export declare const defaultSleep: Sleep;
export declare function isTransientError(err: unknown): boolean;
/**
* Retries `fn` on transient gateway errors (or on whatever `retryOn` matches
* when given). Non-matching errors propagate immediately. After exhausting
* `attempts`, throws the last error.
*/
export declare function retryTransient<T>(fn: () => Promise<T>, opts?: {
sleep?: Sleep;
log?: (msg: string) => void;
attempts?: number;
retryOn?: (err: unknown) => boolean;
}): Promise<T>;
/** RbeStatus once the stack is running: frontendPort and xcodeVersion are set. */
export type RunningRbeStatus = RbeStatus & Required<Pick<RbeStatus, 'frontendPort' | 'xcodeVersion'>>;
/**
* Polls `getRbe` until the stack is `running` (with a usable frontend port and
* Xcode version), starting from the `initial` status returned by `startRbe`.
* Each poll is wrapped in retryTransient so a transient blip mid-startup does
* not abort. Throws when the stack ends in `failed`, stays `starting` past
* `maxAttempts`, or reports `running` without the fields the caller needs.
*/
export declare function waitForRbeRunning(client: Pick<XcodeClient, 'getRbe'>, initial: RbeStatus, opts?: {
sleep?: Sleep;
maxAttempts?: number;
}): Promise<RunningRbeStatus>;
//# sourceMappingURL=rbe-session.d.ts.map
{"version":3,"file":"rbe-session.d.ts","sourceRoot":"","sources":["src/rbe-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,+CAA4C;AAElF;;;;;GAKG;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAClD,eAAO,MAAM,YAAY,EAAE,KAAiE,CAAC;AAc7F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGtD;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,IAAI,GAAE;IACJ,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;CAChC,GACL,OAAO,CAAC,CAAC,CAAC,CAqBZ;AAED,kFAAkF;AAClF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC;AAEtG;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EACnC,OAAO,EAAE,SAAS,EAClB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,OAAO,CAAC,gBAAgB,CAAC,CAY3B"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultSleep = void 0;
exports.isTransientError = isTransientError;
exports.retryTransient = retryTransient;
exports.waitForRbeRunning = waitForRbeRunning;
const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
exports.defaultSleep = defaultSleep;
/**
* Matches the transient gateway / dropped-connection errors that occur right
* after an instance is created, when its proxy path is not fully serving yet.
*
* The HTTP part anchors on the exact `failed: <code>` shape `directInstanceHttpError`
* produces (`${operation} failed: ${status}...`), so a bare 502/503/504 buried in
* a response body or an instance id does NOT count as transient. Fetch-thrown
* network errors carry their own names and are matched directly. A 404 never
* reaches here; `readRbeResponse` maps it to RbeUnsupportedError first.
*/
const TRANSIENT = /failed: (?:502|503|504)\b|\bEOF\b|ECONNRESET|ECONNREFUSED|socket hang up|fetch failed/i;
function isTransientError(err) {
const message = err instanceof Error ? err.message : String(err);
return TRANSIENT.test(message);
}
/**
* Retries `fn` on transient gateway errors (or on whatever `retryOn` matches
* when given). Non-matching errors propagate immediately. After exhausting
* `attempts`, throws the last error.
*/
async function retryTransient(fn, opts = {}) {
const sleep = opts.sleep ?? exports.defaultSleep;
const attempts = opts.attempts ?? 5;
const retryOn = opts.retryOn ?? isTransientError;
let lastErr;
for (let attempt = 1; attempt <= attempts; attempt++) {
try {
return await fn();
}
catch (err) {
if (!retryOn(err)) {
throw err;
}
lastErr = err;
if (attempt < attempts) {
const message = err instanceof Error ? err.message : String(err);
opts.log?.(`Retrying after error (${message.trim()})...`);
await sleep(2000 * attempt);
}
}
}
throw lastErr;
}
/**
* Polls `getRbe` until the stack is `running` (with a usable frontend port and
* Xcode version), starting from the `initial` status returned by `startRbe`.
* Each poll is wrapped in retryTransient so a transient blip mid-startup does
* not abort. Throws when the stack ends in `failed`, stays `starting` past
* `maxAttempts`, or reports `running` without the fields the caller needs.
*/
async function waitForRbeRunning(client, initial, opts = {}) {
const sleep = opts.sleep ?? exports.defaultSleep;
const maxAttempts = opts.maxAttempts ?? 15;
let status = initial;
for (let attempt = 0; status.state === 'starting' && attempt < maxAttempts; attempt++) {
await sleep(2000);
status = await retryTransient(() => client.getRbe(), { sleep });
}
if (status.state !== 'running' || !status.frontendPort || !status.xcodeVersion) {
throw new Error(`Remote-execution stack failed to start: ${status.error ?? `state is ${status.state}`}`);
}
return status;
}
//# sourceMappingURL=rbe-session.js.map
{"version":3,"file":"rbe-session.js","sourceRoot":"","sources":["src/rbe-session.ts"],"names":[],"mappings":";;;AAwBA,4CAGC;AAOD,wCA6BC;AAYD,8CAgBC;AAjFM,MAAM,YAAY,GAAU,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAAhF,QAAA,YAAY,gBAAoE;AAE7F;;;;;;;;;GASG;AACH,MAAM,SAAS,GAAG,wFAAwF,CAAC;AAE3G,SAAgB,gBAAgB,CAAC,GAAY;IAC3C,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;;;GAIG;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,CAAC,EAAE,MAAM,CAAC,KAAK,KAAK,UAAU,IAAI,OAAO,GAAG,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;QACtF,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAClB,MAAM,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAC/E,MAAM,IAAI,KAAK,CAAC,2CAA2C,MAAM,CAAC,KAAK,IAAI,YAAY,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC3G,CAAC;IACD,OAAO,MAA0B,CAAC;AACpC,CAAC"}
export const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/**
* Matches the transient gateway / dropped-connection errors that occur right
* after an instance is created, when its proxy path is not fully serving yet.
*
* The HTTP part anchors on the exact `failed: <code>` shape `directInstanceHttpError`
* produces (`${operation} failed: ${status}...`), so a bare 502/503/504 buried in
* a response body or an instance id does NOT count as transient. Fetch-thrown
* network errors carry their own names and are matched directly. A 404 never
* reaches here; `readRbeResponse` maps it to RbeUnsupportedError first.
*/
const TRANSIENT = /failed: (?:502|503|504)\b|\bEOF\b|ECONNRESET|ECONNREFUSED|socket hang up|fetch failed/i;
export function isTransientError(err) {
const message = err instanceof Error ? err.message : String(err);
return TRANSIENT.test(message);
}
/**
* Retries `fn` on transient gateway errors (or on whatever `retryOn` matches
* when given). Non-matching errors propagate immediately. After exhausting
* `attempts`, throws the last error.
*/
export async function retryTransient(fn, opts = {}) {
const sleep = opts.sleep ?? defaultSleep;
const attempts = opts.attempts ?? 5;
const retryOn = opts.retryOn ?? isTransientError;
let lastErr;
for (let attempt = 1; attempt <= attempts; attempt++) {
try {
return await fn();
}
catch (err) {
if (!retryOn(err)) {
throw err;
}
lastErr = err;
if (attempt < attempts) {
const message = err instanceof Error ? err.message : String(err);
opts.log?.(`Retrying after error (${message.trim()})...`);
await sleep(2000 * attempt);
}
}
}
throw lastErr;
}
/**
* Polls `getRbe` until the stack is `running` (with a usable frontend port and
* Xcode version), starting from the `initial` status returned by `startRbe`.
* Each poll is wrapped in retryTransient so a transient blip mid-startup does
* not abort. Throws when the stack ends in `failed`, stays `starting` past
* `maxAttempts`, or reports `running` without the fields the caller needs.
*/
export async function waitForRbeRunning(client, initial, opts = {}) {
const sleep = opts.sleep ?? defaultSleep;
const maxAttempts = opts.maxAttempts ?? 15;
let status = initial;
for (let attempt = 0; status.state === 'starting' && attempt < maxAttempts; attempt++) {
await sleep(2000);
status = await retryTransient(() => client.getRbe(), { sleep });
}
if (status.state !== 'running' || !status.frontendPort || !status.xcodeVersion) {
throw new Error(`Remote-execution stack failed to start: ${status.error ?? `state is ${status.state}`}`);
}
return status;
}
//# sourceMappingURL=rbe-session.mjs.map
{"version":3,"file":"rbe-session.mjs","sourceRoot":"","sources":["src/rbe-session.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,YAAY,GAAU,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAE7F;;;;;;;;;GASG;AACH,MAAM,SAAS,GAAG,wFAAwF,CAAC;AAE3G,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,EAAoB,EACpB,OAKI,EAAE;IAEN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OAAO,GAAG,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC;QACtF,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAClB,MAAM,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAC/E,MAAM,IAAI,KAAK,CAAC,2CAA2C,MAAM,CAAC,KAAK,IAAI,YAAY,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC3G,CAAC;IACD,OAAO,MAA0B,CAAC;AACpC,CAAC"}
/**
* Generates the .limrun/ workspace companion for Limrun remote execution: a Bazel
* package pinning the remote fleet's Xcode version and an rc fragment with the
* remote-execution flags under the `limrun` config. The caller learns the
* fleet's version key from the instance's RBE status, so the generated config
* always matches the fleet without any user action; regenerating the files
* after a fleet Xcode upgrade refreshes the pin.
*/
export declare const LIMRUN_DIR = ".limrun";
export declare const TRY_IMPORT_LINE = "try-import %workspace%/.limrun/bazelrc";
/**
* Finds the Bazel workspace root by walking up from `startDir` to the first
* ancestor containing a MODULE.bazel / WORKSPACE / WORKSPACE.bazel, mirroring
* how Bazel itself locates the workspace when run from a subdirectory. Returns
* null when no workspace is found up to the filesystem root. The generated
* `.limrun/` and the `try-import` must live at this root, since `%workspace%`
* in bazelrc resolves here regardless of the directory the build is run from.
*/
export declare function findBazelWorkspaceRoot(startDir: string): string | null;
/**
* Best-effort guess of a single buildable app target to show in the printed
* build command, so it reads `//App` instead of a `//your:target` placeholder.
* Scans the workspace's BUILD files (buildifier-formatted) for apple
* `*_application` rules (no bazel invocation) and returns the label in short
* form (`//pkg` when the target name matches the package's last segment).
* Returns null when there are zero or multiple candidates (ambiguous → caller
* keeps the placeholder).
*/
export declare function inferBuildTarget(workspaceRoot: string): string | null;
/**
* Reads the workspace's pinned Bazel major version from `.bazelversion`, or
* null when the file is absent or its first line has no leading integer.
*
* Used to decide whether the generated BUILD must `load` the Xcode rules from
* apple_support: in Bazel 9 they are no longer native globals and must be
* loaded, while in Bazel 8 they ARE native globals and the apple_support rule
* impls `fail()` on the unmigrated Bazel, so loading them there breaks
* analysis. The generator runs in the workspace on the client, so the file is
* the authoritative signal for the Bazel that bazelisk will launch.
*/
export declare function detectBazelMajorVersion(workspaceDir: string): number | null;
/**
* Whether to treat the workspace as Bazel 9+ for RBE config: true when the
* detected major version is >= 9, OR unknown (no `.bazelversion` means bazelisk
* runs the latest release, which is 9+). This single predicate decides both
* emitting the apple_support Xcode-rule loads and surfacing the SHA256 digest
* hint, so the two stay in lockstep.
*/
export declare function isBazel9OrLater(bazelMajor: number | null): boolean;
/**
* Renders the generated Bazel package pinning the Xcode version to the fleet's.
*
* remoteVersionKey is the fleet's `xcodebuild -version` in major.minor.patch.build
* form (e.g. 26.4.0.17E192).
*
* Uses Bazel's remote/local `xcode_config` split with BOTH sets pointing at the
* SAME fleet pin (rather than a single `default=/versions=` bucket, which
* resolves with availability UNKNOWN and leaves Apple/Swift actions eligible for
* local execution). With local == remote, `--xcode_version` resolves as
* "mutually available" (BOTH), which declares up front that this build uses only
* the fleet's Xcode AND keeps apple_support from emitting its remote-only
* "...specified, but it is not available locally..." DEBUG notice (that notice
* fires only when the pinned version is in `remote_versions` but not
* `local_versions`).
*
* We intentionally do NOT name the client's own local Xcode: under
* `--config=limrun` every action runs remotely (`--spawn_strategy=remote` +
* `--noremote_local_fallback`), so a local DEVELOPER_DIR is never resolved.
* Declaring a distinct local version would only reintroduce that DEBUG notice on
* a client whose Xcode differs from the fleet's. (The fleet pin is used, not
* Bazel's `@local_config_xcode//:host_available_xcodes`: that repo is not
* visible from the main module under bzlmod and is never generated off-darwin.)
*
* When `emitLoads` is true (Bazel 9+), the Xcode rules are loaded from
* apple_support; on Bazel 8 they are native globals and MUST NOT be loaded
* (the apple_support rule impls fail on the unmigrated Bazel).
*/
export declare function renderXcodeConfigBuild(remoteVersionKey: string, emitLoads: boolean): string;
/**
* Renders the rc fragment with the remote-execution flags under
* --config=limrun.
*
* - `--remote_cache=` (empty) clears any workspace-level `--remote_cache`. The
* limrun executor carries its own CAS, so a separate cache backend (e.g. a
* repo pointing `--remote_cache` at BuildBuddy/EngFlow) splits inputs and
* outputs across two stores the executor cannot reconcile, surfacing as "Lost
* inputs no longer available remotely". Emptying it under --config=limrun
* routes caching back to the executor's CAS while leaving the repo's non-limrun
* builds (where that cache is valid) untouched.
* - The `--bes_*` flags stream the Build Event Protocol to the daemon's BES
* service, co-hosted on the same RBE frontend as the executor (hence the same
* `127.0.0.1:${port}`), powering the live + persisted console.
* `--bes_upload_mode=nowait_for_upload_complete` keeps the current build from
* blocking at exit on the BES upload (the wait moves to the start of the next
* invocation, bounded by `--bes_timeout`), while streams stay complete/acked
* for the persisted record. An older daemon without the BES service registered
* answers PublishBuildEvent with a non-fatal warning, so the flags are safe
* ahead of the image rollout.
* - `--xcode_version` pins the fleet's version: without it, a mac client
* lacking that exact version has no mutual version and silently falls back
* to its LOCAL default, shipping the wrong version to the remote worker via
* XCODE_VERSION_OVERRIDE (the worker then rejects it).
* - `--strategy=SwiftCompile=remote` / `--strategy=Genrule=remote` override
* mnemonic-specific strategies a workspace may pin (rules_swift defaults
* SwiftCompile to a local persistent `worker`; repos often pin Genrule to
* `standalone`). Those run locally and break RBE: a local Swift worker can't
* run on a Linux client at all, and on a mac it would demand the fleet's
* Xcode locally. --spawn_strategy=remote does not override per-mnemonic
* pins, so these explicit overrides are required.
* - `--ios_multi_cpus=sim_arm64` pins the app to the **arm64 iOS simulator**.
* Limrun's Mac fleet (workers and the attached simulators) is Apple Silicon,
* so the build product must be arm64. Without this, the simulator cpu follows
* the CLIENT's Bazel default (`sim_arm64` on an Apple Silicon Mac, but
* `x86_64` on an Intel Mac or a Linux client), and an x86_64 app installed on
* the arm64 fleet simulator fails to launch with "needs to be updated by the
* developer to work on this version of iOS". The pin makes the artifact match
* the fleet regardless of where bazel runs (the whole point of RBE).
* - PATH includes /usr/sbin:/sbin so genrules that probe `sysctl` (e.g.
* `hw.logicalcpu` for `make -j`) resolve it on the worker.
* - `--remote_download_outputs=minimal` keeps the built .ipa in the instance's
* CAS instead of downloading it; the daemon auto-installs it server-side from
* there (driven by the BES stream), so the bytes never round-trip. The printed
* `lim xcode rbe` output tells users to add `--remote_download_outputs=toplevel`
* on the command line when they want the .ipa materialized locally (a
* command-line flag overrides this rc setting).
* - `--extra_execution_platforms` is emitted ONLY for non-mac clients: a Linux
* host has no auto-detected darwin execution platform, so the Apple/Swift
* toolchain (exec_compatible_with macos) needs one registered to route
* actions to the mac RBE pool. On a mac it is HARMFUL: it makes bazel run
* exec-config actions on the local host instead of the remote worker, which
* then demand a local Xcode.
* - `--modify_execution_info=.*=-no-remote,.*=-no-remote-exec` strips the
* `no-remote`/`no-remote-exec` execution-info tags rules_apple sets on
* bundling/linking/signing actions (in-code on device builds, and via its
* recommended `+no-remote` bazelrc that real iOS repos carry). Under
* --config=limrun every action runs remotely, so any such tag leaves the
* action with no usable strategy ("cannot be executed with any of the
* available strategies: [remote]") and the build fails. That is the exact
* breakage a Linux client (no local Xcode) hits. This is the execution-info
* analog of the --strategy=...=remote overrides above; stripping globally is
* safe because removing a tag an action never had is a no-op.
* - A `user.limrun.bazelrc` at the workspace root is try-imported last as a user
* override hook, so callers can extend or override the generated config
* without editing this file or passing flags on the command line.
*/
export declare function renderLimrunBazelrc(port: number, versionKey: string, isMacClient: boolean): string;
/**
* Idempotently ensures the workspace .bazelrc try-imports the generated
* fragment. Creates .bazelrc when missing. Returns true when the file changed.
*/
export declare function ensureTryImport(workspaceDir: string): boolean;
export type RbeWorkspaceFiles = {
buildFile: string;
bazelrcFragment: string;
bazelrcUpdated: boolean;
};
/**
* Writes .limrun/{BUILD,bazelrc,.gitignore} into the workspace and wires the
* try-import. The .gitignore containing "*" makes the directory self-ignoring
* so nothing else in the user's repo needs to change.
*/
export declare function writeRbeWorkspaceFiles(workspaceDir: string, xcodeVersionKey: string, port: number, isMacClient?: boolean, bazelMajor?: number | null): RbeWorkspaceFiles;
//# sourceMappingURL=rbe-workspace.d.mts.map
{"version":3,"file":"rbe-workspace.d.mts","sourceRoot":"","sources":["src/rbe-workspace.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AAEH,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,eAAe,2CAA2C,CAAC;AAKxE;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYtE;AAMD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAqBrE;AAqCD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS3E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAElE;AA6CD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAmC3F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CA4BlG;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAiB7D;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,EACZ,WAAW,GAAE,OAAuC,EACpD,UAAU,GAAE,MAAM,GAAG,IAA4C,GAChE,iBAAiB,CAcnB"}
/**
* Generates the .limrun/ workspace companion for Limrun remote execution: a Bazel
* package pinning the remote fleet's Xcode version and an rc fragment with the
* remote-execution flags under the `limrun` config. The caller learns the
* fleet's version key from the instance's RBE status, so the generated config
* always matches the fleet without any user action; regenerating the files
* after a fleet Xcode upgrade refreshes the pin.
*/
export declare const LIMRUN_DIR = ".limrun";
export declare const TRY_IMPORT_LINE = "try-import %workspace%/.limrun/bazelrc";
/**
* Finds the Bazel workspace root by walking up from `startDir` to the first
* ancestor containing a MODULE.bazel / WORKSPACE / WORKSPACE.bazel, mirroring
* how Bazel itself locates the workspace when run from a subdirectory. Returns
* null when no workspace is found up to the filesystem root. The generated
* `.limrun/` and the `try-import` must live at this root, since `%workspace%`
* in bazelrc resolves here regardless of the directory the build is run from.
*/
export declare function findBazelWorkspaceRoot(startDir: string): string | null;
/**
* Best-effort guess of a single buildable app target to show in the printed
* build command, so it reads `//App` instead of a `//your:target` placeholder.
* Scans the workspace's BUILD files (buildifier-formatted) for apple
* `*_application` rules (no bazel invocation) and returns the label in short
* form (`//pkg` when the target name matches the package's last segment).
* Returns null when there are zero or multiple candidates (ambiguous → caller
* keeps the placeholder).
*/
export declare function inferBuildTarget(workspaceRoot: string): string | null;
/**
* Reads the workspace's pinned Bazel major version from `.bazelversion`, or
* null when the file is absent or its first line has no leading integer.
*
* Used to decide whether the generated BUILD must `load` the Xcode rules from
* apple_support: in Bazel 9 they are no longer native globals and must be
* loaded, while in Bazel 8 they ARE native globals and the apple_support rule
* impls `fail()` on the unmigrated Bazel, so loading them there breaks
* analysis. The generator runs in the workspace on the client, so the file is
* the authoritative signal for the Bazel that bazelisk will launch.
*/
export declare function detectBazelMajorVersion(workspaceDir: string): number | null;
/**
* Whether to treat the workspace as Bazel 9+ for RBE config: true when the
* detected major version is >= 9, OR unknown (no `.bazelversion` means bazelisk
* runs the latest release, which is 9+). This single predicate decides both
* emitting the apple_support Xcode-rule loads and surfacing the SHA256 digest
* hint, so the two stay in lockstep.
*/
export declare function isBazel9OrLater(bazelMajor: number | null): boolean;
/**
* Renders the generated Bazel package pinning the Xcode version to the fleet's.
*
* remoteVersionKey is the fleet's `xcodebuild -version` in major.minor.patch.build
* form (e.g. 26.4.0.17E192).
*
* Uses Bazel's remote/local `xcode_config` split with BOTH sets pointing at the
* SAME fleet pin (rather than a single `default=/versions=` bucket, which
* resolves with availability UNKNOWN and leaves Apple/Swift actions eligible for
* local execution). With local == remote, `--xcode_version` resolves as
* "mutually available" (BOTH), which declares up front that this build uses only
* the fleet's Xcode AND keeps apple_support from emitting its remote-only
* "...specified, but it is not available locally..." DEBUG notice (that notice
* fires only when the pinned version is in `remote_versions` but not
* `local_versions`).
*
* We intentionally do NOT name the client's own local Xcode: under
* `--config=limrun` every action runs remotely (`--spawn_strategy=remote` +
* `--noremote_local_fallback`), so a local DEVELOPER_DIR is never resolved.
* Declaring a distinct local version would only reintroduce that DEBUG notice on
* a client whose Xcode differs from the fleet's. (The fleet pin is used, not
* Bazel's `@local_config_xcode//:host_available_xcodes`: that repo is not
* visible from the main module under bzlmod and is never generated off-darwin.)
*
* When `emitLoads` is true (Bazel 9+), the Xcode rules are loaded from
* apple_support; on Bazel 8 they are native globals and MUST NOT be loaded
* (the apple_support rule impls fail on the unmigrated Bazel).
*/
export declare function renderXcodeConfigBuild(remoteVersionKey: string, emitLoads: boolean): string;
/**
* Renders the rc fragment with the remote-execution flags under
* --config=limrun.
*
* - `--remote_cache=` (empty) clears any workspace-level `--remote_cache`. The
* limrun executor carries its own CAS, so a separate cache backend (e.g. a
* repo pointing `--remote_cache` at BuildBuddy/EngFlow) splits inputs and
* outputs across two stores the executor cannot reconcile, surfacing as "Lost
* inputs no longer available remotely". Emptying it under --config=limrun
* routes caching back to the executor's CAS while leaving the repo's non-limrun
* builds (where that cache is valid) untouched.
* - The `--bes_*` flags stream the Build Event Protocol to the daemon's BES
* service, co-hosted on the same RBE frontend as the executor (hence the same
* `127.0.0.1:${port}`), powering the live + persisted console.
* `--bes_upload_mode=nowait_for_upload_complete` keeps the current build from
* blocking at exit on the BES upload (the wait moves to the start of the next
* invocation, bounded by `--bes_timeout`), while streams stay complete/acked
* for the persisted record. An older daemon without the BES service registered
* answers PublishBuildEvent with a non-fatal warning, so the flags are safe
* ahead of the image rollout.
* - `--xcode_version` pins the fleet's version: without it, a mac client
* lacking that exact version has no mutual version and silently falls back
* to its LOCAL default, shipping the wrong version to the remote worker via
* XCODE_VERSION_OVERRIDE (the worker then rejects it).
* - `--strategy=SwiftCompile=remote` / `--strategy=Genrule=remote` override
* mnemonic-specific strategies a workspace may pin (rules_swift defaults
* SwiftCompile to a local persistent `worker`; repos often pin Genrule to
* `standalone`). Those run locally and break RBE: a local Swift worker can't
* run on a Linux client at all, and on a mac it would demand the fleet's
* Xcode locally. --spawn_strategy=remote does not override per-mnemonic
* pins, so these explicit overrides are required.
* - `--ios_multi_cpus=sim_arm64` pins the app to the **arm64 iOS simulator**.
* Limrun's Mac fleet (workers and the attached simulators) is Apple Silicon,
* so the build product must be arm64. Without this, the simulator cpu follows
* the CLIENT's Bazel default (`sim_arm64` on an Apple Silicon Mac, but
* `x86_64` on an Intel Mac or a Linux client), and an x86_64 app installed on
* the arm64 fleet simulator fails to launch with "needs to be updated by the
* developer to work on this version of iOS". The pin makes the artifact match
* the fleet regardless of where bazel runs (the whole point of RBE).
* - PATH includes /usr/sbin:/sbin so genrules that probe `sysctl` (e.g.
* `hw.logicalcpu` for `make -j`) resolve it on the worker.
* - `--remote_download_outputs=minimal` keeps the built .ipa in the instance's
* CAS instead of downloading it; the daemon auto-installs it server-side from
* there (driven by the BES stream), so the bytes never round-trip. The printed
* `lim xcode rbe` output tells users to add `--remote_download_outputs=toplevel`
* on the command line when they want the .ipa materialized locally (a
* command-line flag overrides this rc setting).
* - `--extra_execution_platforms` is emitted ONLY for non-mac clients: a Linux
* host has no auto-detected darwin execution platform, so the Apple/Swift
* toolchain (exec_compatible_with macos) needs one registered to route
* actions to the mac RBE pool. On a mac it is HARMFUL: it makes bazel run
* exec-config actions on the local host instead of the remote worker, which
* then demand a local Xcode.
* - `--modify_execution_info=.*=-no-remote,.*=-no-remote-exec` strips the
* `no-remote`/`no-remote-exec` execution-info tags rules_apple sets on
* bundling/linking/signing actions (in-code on device builds, and via its
* recommended `+no-remote` bazelrc that real iOS repos carry). Under
* --config=limrun every action runs remotely, so any such tag leaves the
* action with no usable strategy ("cannot be executed with any of the
* available strategies: [remote]") and the build fails. That is the exact
* breakage a Linux client (no local Xcode) hits. This is the execution-info
* analog of the --strategy=...=remote overrides above; stripping globally is
* safe because removing a tag an action never had is a no-op.
* - A `user.limrun.bazelrc` at the workspace root is try-imported last as a user
* override hook, so callers can extend or override the generated config
* without editing this file or passing flags on the command line.
*/
export declare function renderLimrunBazelrc(port: number, versionKey: string, isMacClient: boolean): string;
/**
* Idempotently ensures the workspace .bazelrc try-imports the generated
* fragment. Creates .bazelrc when missing. Returns true when the file changed.
*/
export declare function ensureTryImport(workspaceDir: string): boolean;
export type RbeWorkspaceFiles = {
buildFile: string;
bazelrcFragment: string;
bazelrcUpdated: boolean;
};
/**
* Writes .limrun/{BUILD,bazelrc,.gitignore} into the workspace and wires the
* try-import. The .gitignore containing "*" makes the directory self-ignoring
* so nothing else in the user's repo needs to change.
*/
export declare function writeRbeWorkspaceFiles(workspaceDir: string, xcodeVersionKey: string, port: number, isMacClient?: boolean, bazelMajor?: number | null): RbeWorkspaceFiles;
//# sourceMappingURL=rbe-workspace.d.ts.map
{"version":3,"file":"rbe-workspace.d.ts","sourceRoot":"","sources":["src/rbe-workspace.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;A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ports, "__esModule", { value: true });
exports.TRY_IMPORT_LINE = exports.LIMRUN_DIR = void 0;
exports.findBazelWorkspaceRoot = findBazelWorkspaceRoot;
exports.inferBuildTarget = inferBuildTarget;
exports.detectBazelMajorVersion = detectBazelMajorVersion;
exports.isBazel9OrLater = isBazel9OrLater;
exports.renderXcodeConfigBuild = renderXcodeConfigBuild;
exports.renderLimrunBazelrc = renderLimrunBazelrc;
exports.ensureTryImport = ensureTryImport;
exports.writeRbeWorkspaceFiles = writeRbeWorkspaceFiles;
const tslib_1 = require("./internal/tslib.js");
// Mirrored between src/rbe-workspace.ts (canonical) and packages/cli/src/lib/rbe-workspace.ts
// until the CLI imports it from a published @limrun/api; tests/rbe-copy-sync.test.ts keeps the
// two copies byte-identical. Apply any edit to both.
const fs_1 = tslib_1.__importDefault(require("fs"));
const path_1 = tslib_1.__importDefault(require("path"));
/**
* Generates the .limrun/ workspace companion for Limrun remote execution: a Bazel
* package pinning the remote fleet's Xcode version and an rc fragment with the
* remote-execution flags under the `limrun` config. The caller learns the
* fleet's version key from the instance's RBE status, so the generated config
* always matches the fleet without any user action; regenerating the files
* after a fleet Xcode upgrade refreshes the pin.
*/
exports.LIMRUN_DIR = '.limrun';
exports.TRY_IMPORT_LINE = 'try-import %workspace%/.limrun/bazelrc';
const TRY_IMPORT_COMMENT = '# Added by Limrun remote-execution setup: loads the generated config.';
const WORKSPACE_MARKERS = ['MODULE.bazel', 'WORKSPACE', 'WORKSPACE.bazel'];
/**
* Finds the Bazel workspace root by walking up from `startDir` to the first
* ancestor containing a MODULE.bazel / WORKSPACE / WORKSPACE.bazel, mirroring
* how Bazel itself locates the workspace when run from a subdirectory. Returns
* null when no workspace is found up to the filesystem root. The generated
* `.limrun/` and the `try-import` must live at this root, since `%workspace%`
* in bazelrc resolves here regardless of the directory the build is run from.
*/
function findBazelWorkspaceRoot(startDir) {
let dir = path_1.default.resolve(startDir);
for (;;) {
if (WORKSPACE_MARKERS.some((m) => fs_1.default.existsSync(path_1.default.join(dir, m)))) {
return dir;
}
const parent = path_1.default.dirname(dir);
if (parent === dir) {
return null;
}
dir = parent;
}
}
const APP_RULE_RE = /\b(?:ios|macos|tvos|watchos)_application\s*\(/;
const TARGET_NAME_RE = /^\s*name\s*=\s*"([^"]+)"/;
const TARGET_SCAN_SKIP_DIRS = new Set(['.git', 'node_modules', '.limrun']);
/**
* Best-effort guess of a single buildable app target to show in the printed
* build command, so it reads `//App` instead of a `//your:target` placeholder.
* Scans the workspace's BUILD files (buildifier-formatted) for apple
* `*_application` rules (no bazel invocation) and returns the label in short
* form (`//pkg` when the target name matches the package's last segment).
* Returns null when there are zero or multiple candidates (ambiguous → caller
* keeps the placeholder).
*/
function inferBuildTarget(workspaceRoot) {
const found = [];
const walk = (dir) => {
if (found.length > 1)
return; // already ambiguous; stop early
let entries;
try {
entries = fs_1.default.readdirSync(dir, { withFileTypes: true });
}
catch {
return;
}
for (const entry of entries) {
if (entry.isDirectory()) {
if (TARGET_SCAN_SKIP_DIRS.has(entry.name) || entry.name.startsWith('bazel-'))
continue;
walk(path_1.default.join(dir, entry.name));
}
else if (entry.name === 'BUILD' || entry.name === 'BUILD.bazel') {
collectAppTargets(path_1.default.join(dir, entry.name), workspaceRoot, found);
}
}
};
walk(workspaceRoot);
return found.length === 1 ? found[0] : null;
}
/** Appends `//pkg[:name]` labels of apple application rules in one BUILD file. */
function collectAppTargets(buildFile, workspaceRoot, out) {
let content;
try {
content = fs_1.default.readFileSync(buildFile, 'utf8');
}
catch {
return;
}
const pkg = path_1.default.relative(workspaceRoot, path_1.default.dirname(buildFile)).split(path_1.default.sep).join('/');
let inAppRule = false;
for (const line of content.split('\n')) {
// Skip comment lines so a commented-out `# ios_application(` can't start a
// phantom rule (and a commented `# name = ...` can't be captured), which
// would otherwise leave inAppRule set and mislabel a later rule's name.
if (line.trimStart().startsWith('#'))
continue;
if (!inAppRule) {
if (APP_RULE_RE.test(line))
inAppRule = true;
continue;
}
const match = line.match(TARGET_NAME_RE);
if (match) {
const name = match[1];
const last = pkg.split('/').pop();
out.push(pkg === '' || pkg === '.' ? `//:${name}`
: last === name ? `//${pkg}`
: `//${pkg}:${name}`);
inAppRule = false;
}
else if (/^\)/.test(line)) {
inAppRule = false; // rule closed before a name line we could read
}
}
}
/**
* Reads the workspace's pinned Bazel major version from `.bazelversion`, or
* null when the file is absent or its first line has no leading integer.
*
* Used to decide whether the generated BUILD must `load` the Xcode rules from
* apple_support: in Bazel 9 they are no longer native globals and must be
* loaded, while in Bazel 8 they ARE native globals and the apple_support rule
* impls `fail()` on the unmigrated Bazel, so loading them there breaks
* analysis. The generator runs in the workspace on the client, so the file is
* the authoritative signal for the Bazel that bazelisk will launch.
*/
function detectBazelMajorVersion(workspaceDir) {
try {
const raw = fs_1.default.readFileSync(path_1.default.join(workspaceDir, '.bazelversion'), 'utf8');
const firstLine = (raw.split('\n', 1)[0] ?? '').trim();
const match = firstLine.match(/^(\d+)/);
return match ? Number(match[1]) : null;
}
catch {
return null;
}
}
/**
* Whether to treat the workspace as Bazel 9+ for RBE config: true when the
* detected major version is >= 9, OR unknown (no `.bazelversion` means bazelisk
* runs the latest release, which is 9+). This single predicate decides both
* emitting the apple_support Xcode-rule loads and surfacing the SHA256 digest
* hint, so the two stay in lockstep.
*/
function isBazel9OrLater(bazelMajor) {
return bazelMajor === null || bazelMajor >= 9;
}
/** Major.minor short alias (e.g. "26.4") used for the SDK default and --xcode_version. */
function shortVersion(versionKey) {
const parts = versionKey.split('.');
if (parts.length < 3) {
throw new Error(`unexpected Xcode version key from the instance: ${versionKey}`);
}
return `${parts[0]}.${parts[1]}`;
}
/** Renders one xcode_version rule from a major.minor.patch.build version key. */
function renderXcodeVersionRule(name, versionKey) {
// shortVersion validates the key shape (major.minor.patch[.build]) and yields
// the major.minor used for both the SDK defaults and the short alias.
const sdk = shortVersion(versionKey);
const parts = versionKey.split('.');
const fullAlias = `${parts[0]}.${parts[1]}.${parts[2]}`;
return `xcode_version(
name = "${name}",
aliases = [
"${sdk}",
"${fullAlias}",
],
default_ios_sdk_version = "${sdk}",
default_macos_sdk_version = "${sdk}",
default_tvos_sdk_version = "${sdk}",
default_watchos_sdk_version = "${sdk}",
version = "${versionKey}",
)`;
}
/**
* Renders an `available_xcodes` set with a single member that is also its
* mandatory default. Both sets the BUILD file emits (remote, local) are
* single-version sets of this shape, pointing at the same fleet pin.
*/
function renderAvailableXcodes(name, target) {
return `available_xcodes(
name = "${name}",
default = "${target}",
versions = ["${target}"],
)`;
}
/**
* Renders the generated Bazel package pinning the Xcode version to the fleet's.
*
* remoteVersionKey is the fleet's `xcodebuild -version` in major.minor.patch.build
* form (e.g. 26.4.0.17E192).
*
* Uses Bazel's remote/local `xcode_config` split with BOTH sets pointing at the
* SAME fleet pin (rather than a single `default=/versions=` bucket, which
* resolves with availability UNKNOWN and leaves Apple/Swift actions eligible for
* local execution). With local == remote, `--xcode_version` resolves as
* "mutually available" (BOTH), which declares up front that this build uses only
* the fleet's Xcode AND keeps apple_support from emitting its remote-only
* "...specified, but it is not available locally..." DEBUG notice (that notice
* fires only when the pinned version is in `remote_versions` but not
* `local_versions`).
*
* We intentionally do NOT name the client's own local Xcode: under
* `--config=limrun` every action runs remotely (`--spawn_strategy=remote` +
* `--noremote_local_fallback`), so a local DEVELOPER_DIR is never resolved.
* Declaring a distinct local version would only reintroduce that DEBUG notice on
* a client whose Xcode differs from the fleet's. (The fleet pin is used, not
* Bazel's `@local_config_xcode//:host_available_xcodes`: that repo is not
* visible from the main module under bzlmod and is never generated off-darwin.)
*
* When `emitLoads` is true (Bazel 9+), the Xcode rules are loaded from
* apple_support; on Bazel 8 they are native globals and MUST NOT be loaded
* (the apple_support rule impls fail on the unmigrated Bazel).
*/
function renderXcodeConfigBuild(remoteVersionKey, emitLoads) {
// Bazel 9 migrated xcode_version/available_xcodes/xcode_config out of native
// globals into apple_support; they must be loaded there. The repo_name
// @build_bazel_apple_support is the apple_support module convention.
const loads = emitLoads ?
`load("@build_bazel_apple_support//xcode:xcode_version.bzl", "xcode_version")
load("@build_bazel_apple_support//xcode:available_xcodes.bzl", "available_xcodes")
load("@build_bazel_apple_support//xcode:xcode_config.bzl", "xcode_config")
`
: '';
const remoteRule = renderXcodeVersionRule('remote_xcode', remoteVersionKey);
return `# Generated by lim xcode rbe. Do not edit; rerun the command to refresh.
#
# Pins the Xcode version Bazel uses to the limrun fleet's Xcode, independent of
# any Xcode installed on this machine. Both the remote and local sets point at
# the SAME pin so --xcode_version resolves as mutually available (no
# apple_support remote-only DEBUG notice); under --config=limrun all actions run
# remotely, so a local DEVELOPER_DIR is never resolved. Selected via
# .limrun/bazelrc (--config=limrun).
${loads}${remoteRule}
# Both sets point at the single fleet pin.
${renderAvailableXcodes('remote_xcodes', ':remote_xcode')}
${renderAvailableXcodes('local_xcodes', ':remote_xcode')}
xcode_config(
name = "remote_xcode_config",
remote_versions = ":remote_xcodes",
local_versions = ":local_xcodes",
)
`;
}
/**
* Renders the rc fragment with the remote-execution flags under
* --config=limrun.
*
* - `--remote_cache=` (empty) clears any workspace-level `--remote_cache`. The
* limrun executor carries its own CAS, so a separate cache backend (e.g. a
* repo pointing `--remote_cache` at BuildBuddy/EngFlow) splits inputs and
* outputs across two stores the executor cannot reconcile, surfacing as "Lost
* inputs no longer available remotely". Emptying it under --config=limrun
* routes caching back to the executor's CAS while leaving the repo's non-limrun
* builds (where that cache is valid) untouched.
* - The `--bes_*` flags stream the Build Event Protocol to the daemon's BES
* service, co-hosted on the same RBE frontend as the executor (hence the same
* `127.0.0.1:${port}`), powering the live + persisted console.
* `--bes_upload_mode=nowait_for_upload_complete` keeps the current build from
* blocking at exit on the BES upload (the wait moves to the start of the next
* invocation, bounded by `--bes_timeout`), while streams stay complete/acked
* for the persisted record. An older daemon without the BES service registered
* answers PublishBuildEvent with a non-fatal warning, so the flags are safe
* ahead of the image rollout.
* - `--xcode_version` pins the fleet's version: without it, a mac client
* lacking that exact version has no mutual version and silently falls back
* to its LOCAL default, shipping the wrong version to the remote worker via
* XCODE_VERSION_OVERRIDE (the worker then rejects it).
* - `--strategy=SwiftCompile=remote` / `--strategy=Genrule=remote` override
* mnemonic-specific strategies a workspace may pin (rules_swift defaults
* SwiftCompile to a local persistent `worker`; repos often pin Genrule to
* `standalone`). Those run locally and break RBE: a local Swift worker can't
* run on a Linux client at all, and on a mac it would demand the fleet's
* Xcode locally. --spawn_strategy=remote does not override per-mnemonic
* pins, so these explicit overrides are required.
* - `--ios_multi_cpus=sim_arm64` pins the app to the **arm64 iOS simulator**.
* Limrun's Mac fleet (workers and the attached simulators) is Apple Silicon,
* so the build product must be arm64. Without this, the simulator cpu follows
* the CLIENT's Bazel default (`sim_arm64` on an Apple Silicon Mac, but
* `x86_64` on an Intel Mac or a Linux client), and an x86_64 app installed on
* the arm64 fleet simulator fails to launch with "needs to be updated by the
* developer to work on this version of iOS". The pin makes the artifact match
* the fleet regardless of where bazel runs (the whole point of RBE).
* - PATH includes /usr/sbin:/sbin so genrules that probe `sysctl` (e.g.
* `hw.logicalcpu` for `make -j`) resolve it on the worker.
* - `--remote_download_outputs=minimal` keeps the built .ipa in the instance's
* CAS instead of downloading it; the daemon auto-installs it server-side from
* there (driven by the BES stream), so the bytes never round-trip. The printed
* `lim xcode rbe` output tells users to add `--remote_download_outputs=toplevel`
* on the command line when they want the .ipa materialized locally (a
* command-line flag overrides this rc setting).
* - `--extra_execution_platforms` is emitted ONLY for non-mac clients: a Linux
* host has no auto-detected darwin execution platform, so the Apple/Swift
* toolchain (exec_compatible_with macos) needs one registered to route
* actions to the mac RBE pool. On a mac it is HARMFUL: it makes bazel run
* exec-config actions on the local host instead of the remote worker, which
* then demand a local Xcode.
* - `--modify_execution_info=.*=-no-remote,.*=-no-remote-exec` strips the
* `no-remote`/`no-remote-exec` execution-info tags rules_apple sets on
* bundling/linking/signing actions (in-code on device builds, and via its
* recommended `+no-remote` bazelrc that real iOS repos carry). Under
* --config=limrun every action runs remotely, so any such tag leaves the
* action with no usable strategy ("cannot be executed with any of the
* available strategies: [remote]") and the build fails. That is the exact
* breakage a Linux client (no local Xcode) hits. This is the execution-info
* analog of the --strategy=...=remote overrides above; stripping globally is
* safe because removing a tag an action never had is a no-op.
* - A `user.limrun.bazelrc` at the workspace root is try-imported last as a user
* override hook, so callers can extend or override the generated config
* without editing this file or passing flags on the command line.
*/
function renderLimrunBazelrc(port, versionKey, isMacClient) {
const execPlatform = isMacClient ? '' : ('build:limrun --extra_execution_platforms=@build_bazel_apple_support//platforms:darwin_arm64\n');
return `# Generated by lim xcode rbe. Do not edit; rerun the command to refresh.
build:limrun --remote_executor=grpc://127.0.0.1:${port}
build:limrun --bes_backend=grpc://127.0.0.1:${port}
build:limrun --bes_upload_mode=nowait_for_upload_complete
build:limrun --bes_timeout=60s
build:limrun --remote_cache=
build:limrun --remote_default_exec_properties=OSFamily=Darwin
build:limrun --spawn_strategy=remote
build:limrun --noremote_local_fallback
build:limrun --strategy=SwiftCompile=remote
build:limrun --strategy=Genrule=remote
build:limrun --modify_execution_info=.*=-no-remote,.*=-no-remote-exec
build:limrun --xcode_version_config=//.limrun:remote_xcode_config
build:limrun --xcode_version=${shortVersion(versionKey)}
build:limrun --ios_multi_cpus=sim_arm64
build:limrun --remote_download_outputs=minimal
${execPlatform}build:limrun --action_env=PATH=/usr/bin:/bin:/usr/sbin:/sbin
# A user.limrun.bazelrc at the workspace root is try-imported last, so it can
# extend or override anything above without editing this generated file or
# passing flags on the command line. A missing file is silently skipped.
try-import %workspace%/user.limrun.bazelrc
`;
}
/**
* Idempotently ensures the workspace .bazelrc try-imports the generated
* fragment. Creates .bazelrc when missing. Returns true when the file changed.
*/
function ensureTryImport(workspaceDir) {
const bazelrcPath = path_1.default.join(workspaceDir, '.bazelrc');
let current = '';
if (fs_1.default.existsSync(bazelrcPath)) {
current = fs_1.default.readFileSync(bazelrcPath, 'utf8');
// Match the try-import on a line basis (exact, uncommented) rather than a
// raw substring, so a commented-out occurrence (e.g. `# try-import ...`)
// doesn't make us skip wiring the active import.
const alreadyWired = current.split('\n').some((line) => line.trim() === exports.TRY_IMPORT_LINE);
if (alreadyWired) {
return false;
}
}
const block = `${TRY_IMPORT_COMMENT}\n${exports.TRY_IMPORT_LINE}\n`;
const next = current === '' ? block : `${current.replace(/\n*$/, '\n\n')}${block}`;
fs_1.default.writeFileSync(bazelrcPath, next);
return true;
}
/**
* Writes .limrun/{BUILD,bazelrc,.gitignore} into the workspace and wires the
* try-import. The .gitignore containing "*" makes the directory self-ignoring
* so nothing else in the user's repo needs to change.
*/
function writeRbeWorkspaceFiles(workspaceDir, xcodeVersionKey, port, isMacClient = process.platform === 'darwin', bazelMajor = detectBazelMajorVersion(workspaceDir)) {
const dir = path_1.default.join(workspaceDir, exports.LIMRUN_DIR);
fs_1.default.mkdirSync(dir, { recursive: true });
const buildFile = path_1.default.join(dir, 'BUILD');
const bazelrcFragment = path_1.default.join(dir, 'bazelrc');
// Load the Xcode rules from apple_support on Bazel 9+, where they are no
// longer native globals. On a known Bazel 8 workspace they ARE native (and
// loading would fail), so omit the loads.
const emitLoads = isBazel9OrLater(bazelMajor);
fs_1.default.writeFileSync(buildFile, renderXcodeConfigBuild(xcodeVersionKey, emitLoads));
fs_1.default.writeFileSync(bazelrcFragment, renderLimrunBazelrc(port, xcodeVersionKey, isMacClient));
fs_1.default.writeFileSync(path_1.default.join(dir, '.gitignore'), '*\n');
const bazelrcUpdated = ensureTryImport(workspaceDir);
return { buildFile, bazelrcFragment, bazelrcUpdated };
}
//# sourceMappingURL=rbe-workspace.js.map
{"version":3,"file":"rbe-workspace.js","sourceRoot":"","sources":["src/rbe-workspace.ts"],"names":[],"mappings":";;;AA6BA,wDAYC;AAeD,4CAqBC;AAgDD,0DASC;AASD,0CAEC;AAyED,wDAmCC;AAqED,kDA4BC;AAMD,0CAiBC;AAaD,wDAoBC;;AAtZD,8FAA8F;AAC9F,+FAA+F;AAC/F,qDAAqD;AACrD,oDAAoB;AACpB,wDAAwB;AAExB;;;;;;;GAOG;AAEU,QAAA,UAAU,GAAG,SAAS,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,CAAC,UAAU,CAAC,CAAC;IAC9C,YAAE,CAAC,aAAa,CAAC,SAAS,EAAE,sBAAsB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC;IAChF,YAAE,CAAC,aAAa,CAAC,eAAe,EAAE,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;IAC3F,YAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IACrD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AACxD,CAAC"}
// Mirrored between src/rbe-workspace.ts (canonical) and packages/cli/src/lib/rbe-workspace.ts
// until the CLI imports it from a published @limrun/api; tests/rbe-copy-sync.test.ts keeps the
// two copies byte-identical. Apply any edit to both.
import fs from 'fs';
import path from 'path';
/**
* Generates the .limrun/ workspace companion for Limrun remote execution: a Bazel
* package pinning the remote fleet's Xcode version and an rc fragment with the
* remote-execution flags under the `limrun` config. The caller learns the
* fleet's version key from the instance's RBE status, so the generated config
* always matches the fleet without any user action; regenerating the files
* after a fleet Xcode upgrade refreshes the pin.
*/
export const LIMRUN_DIR = '.limrun';
export const TRY_IMPORT_LINE = 'try-import %workspace%/.limrun/bazelrc';
const TRY_IMPORT_COMMENT = '# Added by Limrun remote-execution setup: loads the generated config.';
const WORKSPACE_MARKERS = ['MODULE.bazel', 'WORKSPACE', 'WORKSPACE.bazel'];
/**
* Finds the Bazel workspace root by walking up from `startDir` to the first
* ancestor containing a MODULE.bazel / WORKSPACE / WORKSPACE.bazel, mirroring
* how Bazel itself locates the workspace when run from a subdirectory. Returns
* null when no workspace is found up to the filesystem root. The generated
* `.limrun/` and the `try-import` must live at this root, since `%workspace%`
* in bazelrc resolves here regardless of the directory the build is run from.
*/
export function findBazelWorkspaceRoot(startDir) {
let dir = path.resolve(startDir);
for (;;) {
if (WORKSPACE_MARKERS.some((m) => fs.existsSync(path.join(dir, m)))) {
return dir;
}
const parent = path.dirname(dir);
if (parent === dir) {
return null;
}
dir = parent;
}
}
const APP_RULE_RE = /\b(?:ios|macos|tvos|watchos)_application\s*\(/;
const TARGET_NAME_RE = /^\s*name\s*=\s*"([^"]+)"/;
const TARGET_SCAN_SKIP_DIRS = new Set(['.git', 'node_modules', '.limrun']);
/**
* Best-effort guess of a single buildable app target to show in the printed
* build command, so it reads `//App` instead of a `//your:target` placeholder.
* Scans the workspace's BUILD files (buildifier-formatted) for apple
* `*_application` rules (no bazel invocation) and returns the label in short
* form (`//pkg` when the target name matches the package's last segment).
* Returns null when there are zero or multiple candidates (ambiguous → caller
* keeps the placeholder).
*/
export function inferBuildTarget(workspaceRoot) {
const found = [];
const walk = (dir) => {
if (found.length > 1)
return; // already ambiguous; stop early
let entries;
try {
entries = fs.readdirSync(dir, { withFileTypes: true });
}
catch {
return;
}
for (const entry of entries) {
if (entry.isDirectory()) {
if (TARGET_SCAN_SKIP_DIRS.has(entry.name) || entry.name.startsWith('bazel-'))
continue;
walk(path.join(dir, entry.name));
}
else if (entry.name === 'BUILD' || entry.name === 'BUILD.bazel') {
collectAppTargets(path.join(dir, entry.name), workspaceRoot, found);
}
}
};
walk(workspaceRoot);
return found.length === 1 ? found[0] : null;
}
/** Appends `//pkg[:name]` labels of apple application rules in one BUILD file. */
function collectAppTargets(buildFile, workspaceRoot, out) {
let content;
try {
content = fs.readFileSync(buildFile, 'utf8');
}
catch {
return;
}
const pkg = path.relative(workspaceRoot, path.dirname(buildFile)).split(path.sep).join('/');
let inAppRule = false;
for (const line of content.split('\n')) {
// Skip comment lines so a commented-out `# ios_application(` can't start a
// phantom rule (and a commented `# name = ...` can't be captured), which
// would otherwise leave inAppRule set and mislabel a later rule's name.
if (line.trimStart().startsWith('#'))
continue;
if (!inAppRule) {
if (APP_RULE_RE.test(line))
inAppRule = true;
continue;
}
const match = line.match(TARGET_NAME_RE);
if (match) {
const name = match[1];
const last = pkg.split('/').pop();
out.push(pkg === '' || pkg === '.' ? `//:${name}`
: last === name ? `//${pkg}`
: `//${pkg}:${name}`);
inAppRule = false;
}
else if (/^\)/.test(line)) {
inAppRule = false; // rule closed before a name line we could read
}
}
}
/**
* Reads the workspace's pinned Bazel major version from `.bazelversion`, or
* null when the file is absent or its first line has no leading integer.
*
* Used to decide whether the generated BUILD must `load` the Xcode rules from
* apple_support: in Bazel 9 they are no longer native globals and must be
* loaded, while in Bazel 8 they ARE native globals and the apple_support rule
* impls `fail()` on the unmigrated Bazel, so loading them there breaks
* analysis. The generator runs in the workspace on the client, so the file is
* the authoritative signal for the Bazel that bazelisk will launch.
*/
export function detectBazelMajorVersion(workspaceDir) {
try {
const raw = fs.readFileSync(path.join(workspaceDir, '.bazelversion'), 'utf8');
const firstLine = (raw.split('\n', 1)[0] ?? '').trim();
const match = firstLine.match(/^(\d+)/);
return match ? Number(match[1]) : null;
}
catch {
return null;
}
}
/**
* Whether to treat the workspace as Bazel 9+ for RBE config: true when the
* detected major version is >= 9, OR unknown (no `.bazelversion` means bazelisk
* runs the latest release, which is 9+). This single predicate decides both
* emitting the apple_support Xcode-rule loads and surfacing the SHA256 digest
* hint, so the two stay in lockstep.
*/
export function isBazel9OrLater(bazelMajor) {
return bazelMajor === null || bazelMajor >= 9;
}
/** Major.minor short alias (e.g. "26.4") used for the SDK default and --xcode_version. */
function shortVersion(versionKey) {
const parts = versionKey.split('.');
if (parts.length < 3) {
throw new Error(`unexpected Xcode version key from the instance: ${versionKey}`);
}
return `${parts[0]}.${parts[1]}`;
}
/** Renders one xcode_version rule from a major.minor.patch.build version key. */
function renderXcodeVersionRule(name, versionKey) {
// shortVersion validates the key shape (major.minor.patch[.build]) and yields
// the major.minor used for both the SDK defaults and the short alias.
const sdk = shortVersion(versionKey);
const parts = versionKey.split('.');
const fullAlias = `${parts[0]}.${parts[1]}.${parts[2]}`;
return `xcode_version(
name = "${name}",
aliases = [
"${sdk}",
"${fullAlias}",
],
default_ios_sdk_version = "${sdk}",
default_macos_sdk_version = "${sdk}",
default_tvos_sdk_version = "${sdk}",
default_watchos_sdk_version = "${sdk}",
version = "${versionKey}",
)`;
}
/**
* Renders an `available_xcodes` set with a single member that is also its
* mandatory default. Both sets the BUILD file emits (remote, local) are
* single-version sets of this shape, pointing at the same fleet pin.
*/
function renderAvailableXcodes(name, target) {
return `available_xcodes(
name = "${name}",
default = "${target}",
versions = ["${target}"],
)`;
}
/**
* Renders the generated Bazel package pinning the Xcode version to the fleet's.
*
* remoteVersionKey is the fleet's `xcodebuild -version` in major.minor.patch.build
* form (e.g. 26.4.0.17E192).
*
* Uses Bazel's remote/local `xcode_config` split with BOTH sets pointing at the
* SAME fleet pin (rather than a single `default=/versions=` bucket, which
* resolves with availability UNKNOWN and leaves Apple/Swift actions eligible for
* local execution). With local == remote, `--xcode_version` resolves as
* "mutually available" (BOTH), which declares up front that this build uses only
* the fleet's Xcode AND keeps apple_support from emitting its remote-only
* "...specified, but it is not available locally..." DEBUG notice (that notice
* fires only when the pinned version is in `remote_versions` but not
* `local_versions`).
*
* We intentionally do NOT name the client's own local Xcode: under
* `--config=limrun` every action runs remotely (`--spawn_strategy=remote` +
* `--noremote_local_fallback`), so a local DEVELOPER_DIR is never resolved.
* Declaring a distinct local version would only reintroduce that DEBUG notice on
* a client whose Xcode differs from the fleet's. (The fleet pin is used, not
* Bazel's `@local_config_xcode//:host_available_xcodes`: that repo is not
* visible from the main module under bzlmod and is never generated off-darwin.)
*
* When `emitLoads` is true (Bazel 9+), the Xcode rules are loaded from
* apple_support; on Bazel 8 they are native globals and MUST NOT be loaded
* (the apple_support rule impls fail on the unmigrated Bazel).
*/
export function renderXcodeConfigBuild(remoteVersionKey, emitLoads) {
// Bazel 9 migrated xcode_version/available_xcodes/xcode_config out of native
// globals into apple_support; they must be loaded there. The repo_name
// @build_bazel_apple_support is the apple_support module convention.
const loads = emitLoads ?
`load("@build_bazel_apple_support//xcode:xcode_version.bzl", "xcode_version")
load("@build_bazel_apple_support//xcode:available_xcodes.bzl", "available_xcodes")
load("@build_bazel_apple_support//xcode:xcode_config.bzl", "xcode_config")
`
: '';
const remoteRule = renderXcodeVersionRule('remote_xcode', remoteVersionKey);
return `# Generated by lim xcode rbe. Do not edit; rerun the command to refresh.
#
# Pins the Xcode version Bazel uses to the limrun fleet's Xcode, independent of
# any Xcode installed on this machine. Both the remote and local sets point at
# the SAME pin so --xcode_version resolves as mutually available (no
# apple_support remote-only DEBUG notice); under --config=limrun all actions run
# remotely, so a local DEVELOPER_DIR is never resolved. Selected via
# .limrun/bazelrc (--config=limrun).
${loads}${remoteRule}
# Both sets point at the single fleet pin.
${renderAvailableXcodes('remote_xcodes', ':remote_xcode')}
${renderAvailableXcodes('local_xcodes', ':remote_xcode')}
xcode_config(
name = "remote_xcode_config",
remote_versions = ":remote_xcodes",
local_versions = ":local_xcodes",
)
`;
}
/**
* Renders the rc fragment with the remote-execution flags under
* --config=limrun.
*
* - `--remote_cache=` (empty) clears any workspace-level `--remote_cache`. The
* limrun executor carries its own CAS, so a separate cache backend (e.g. a
* repo pointing `--remote_cache` at BuildBuddy/EngFlow) splits inputs and
* outputs across two stores the executor cannot reconcile, surfacing as "Lost
* inputs no longer available remotely". Emptying it under --config=limrun
* routes caching back to the executor's CAS while leaving the repo's non-limrun
* builds (where that cache is valid) untouched.
* - The `--bes_*` flags stream the Build Event Protocol to the daemon's BES
* service, co-hosted on the same RBE frontend as the executor (hence the same
* `127.0.0.1:${port}`), powering the live + persisted console.
* `--bes_upload_mode=nowait_for_upload_complete` keeps the current build from
* blocking at exit on the BES upload (the wait moves to the start of the next
* invocation, bounded by `--bes_timeout`), while streams stay complete/acked
* for the persisted record. An older daemon without the BES service registered
* answers PublishBuildEvent with a non-fatal warning, so the flags are safe
* ahead of the image rollout.
* - `--xcode_version` pins the fleet's version: without it, a mac client
* lacking that exact version has no mutual version and silently falls back
* to its LOCAL default, shipping the wrong version to the remote worker via
* XCODE_VERSION_OVERRIDE (the worker then rejects it).
* - `--strategy=SwiftCompile=remote` / `--strategy=Genrule=remote` override
* mnemonic-specific strategies a workspace may pin (rules_swift defaults
* SwiftCompile to a local persistent `worker`; repos often pin Genrule to
* `standalone`). Those run locally and break RBE: a local Swift worker can't
* run on a Linux client at all, and on a mac it would demand the fleet's
* Xcode locally. --spawn_strategy=remote does not override per-mnemonic
* pins, so these explicit overrides are required.
* - `--ios_multi_cpus=sim_arm64` pins the app to the **arm64 iOS simulator**.
* Limrun's Mac fleet (workers and the attached simulators) is Apple Silicon,
* so the build product must be arm64. Without this, the simulator cpu follows
* the CLIENT's Bazel default (`sim_arm64` on an Apple Silicon Mac, but
* `x86_64` on an Intel Mac or a Linux client), and an x86_64 app installed on
* the arm64 fleet simulator fails to launch with "needs to be updated by the
* developer to work on this version of iOS". The pin makes the artifact match
* the fleet regardless of where bazel runs (the whole point of RBE).
* - PATH includes /usr/sbin:/sbin so genrules that probe `sysctl` (e.g.
* `hw.logicalcpu` for `make -j`) resolve it on the worker.
* - `--remote_download_outputs=minimal` keeps the built .ipa in the instance's
* CAS instead of downloading it; the daemon auto-installs it server-side from
* there (driven by the BES stream), so the bytes never round-trip. The printed
* `lim xcode rbe` output tells users to add `--remote_download_outputs=toplevel`
* on the command line when they want the .ipa materialized locally (a
* command-line flag overrides this rc setting).
* - `--extra_execution_platforms` is emitted ONLY for non-mac clients: a Linux
* host has no auto-detected darwin execution platform, so the Apple/Swift
* toolchain (exec_compatible_with macos) needs one registered to route
* actions to the mac RBE pool. On a mac it is HARMFUL: it makes bazel run
* exec-config actions on the local host instead of the remote worker, which
* then demand a local Xcode.
* - `--modify_execution_info=.*=-no-remote,.*=-no-remote-exec` strips the
* `no-remote`/`no-remote-exec` execution-info tags rules_apple sets on
* bundling/linking/signing actions (in-code on device builds, and via its
* recommended `+no-remote` bazelrc that real iOS repos carry). Under
* --config=limrun every action runs remotely, so any such tag leaves the
* action with no usable strategy ("cannot be executed with any of the
* available strategies: [remote]") and the build fails. That is the exact
* breakage a Linux client (no local Xcode) hits. This is the execution-info
* analog of the --strategy=...=remote overrides above; stripping globally is
* safe because removing a tag an action never had is a no-op.
* - A `user.limrun.bazelrc` at the workspace root is try-imported last as a user
* override hook, so callers can extend or override the generated config
* without editing this file or passing flags on the command line.
*/
export function renderLimrunBazelrc(port, versionKey, isMacClient) {
const execPlatform = isMacClient ? '' : ('build:limrun --extra_execution_platforms=@build_bazel_apple_support//platforms:darwin_arm64\n');
return `# Generated by lim xcode rbe. Do not edit; rerun the command to refresh.
build:limrun --remote_executor=grpc://127.0.0.1:${port}
build:limrun --bes_backend=grpc://127.0.0.1:${port}
build:limrun --bes_upload_mode=nowait_for_upload_complete
build:limrun --bes_timeout=60s
build:limrun --remote_cache=
build:limrun --remote_default_exec_properties=OSFamily=Darwin
build:limrun --spawn_strategy=remote
build:limrun --noremote_local_fallback
build:limrun --strategy=SwiftCompile=remote
build:limrun --strategy=Genrule=remote
build:limrun --modify_execution_info=.*=-no-remote,.*=-no-remote-exec
build:limrun --xcode_version_config=//.limrun:remote_xcode_config
build:limrun --xcode_version=${shortVersion(versionKey)}
build:limrun --ios_multi_cpus=sim_arm64
build:limrun --remote_download_outputs=minimal
${execPlatform}build:limrun --action_env=PATH=/usr/bin:/bin:/usr/sbin:/sbin
# A user.limrun.bazelrc at the workspace root is try-imported last, so it can
# extend or override anything above without editing this generated file or
# passing flags on the command line. A missing file is silently skipped.
try-import %workspace%/user.limrun.bazelrc
`;
}
/**
* Idempotently ensures the workspace .bazelrc try-imports the generated
* fragment. Creates .bazelrc when missing. Returns true when the file changed.
*/
export function ensureTryImport(workspaceDir) {
const bazelrcPath = path.join(workspaceDir, '.bazelrc');
let current = '';
if (fs.existsSync(bazelrcPath)) {
current = fs.readFileSync(bazelrcPath, 'utf8');
// Match the try-import on a line basis (exact, uncommented) rather than a
// raw substring, so a commented-out occurrence (e.g. `# try-import ...`)
// doesn't make us skip wiring the active import.
const alreadyWired = current.split('\n').some((line) => line.trim() === TRY_IMPORT_LINE);
if (alreadyWired) {
return false;
}
}
const block = `${TRY_IMPORT_COMMENT}\n${TRY_IMPORT_LINE}\n`;
const next = current === '' ? block : `${current.replace(/\n*$/, '\n\n')}${block}`;
fs.writeFileSync(bazelrcPath, next);
return true;
}
/**
* Writes .limrun/{BUILD,bazelrc,.gitignore} into the workspace and wires the
* try-import. The .gitignore containing "*" makes the directory self-ignoring
* so nothing else in the user's repo needs to change.
*/
export function writeRbeWorkspaceFiles(workspaceDir, xcodeVersionKey, port, isMacClient = process.platform === 'darwin', bazelMajor = detectBazelMajorVersion(workspaceDir)) {
const dir = path.join(workspaceDir, LIMRUN_DIR);
fs.mkdirSync(dir, { recursive: true });
const buildFile = path.join(dir, 'BUILD');
const bazelrcFragment = path.join(dir, 'bazelrc');
// Load the Xcode rules from apple_support on Bazel 9+, where they are no
// longer native globals. On a known Bazel 8 workspace they ARE native (and
// loading would fail), so omit the loads.
const emitLoads = isBazel9OrLater(bazelMajor);
fs.writeFileSync(buildFile, renderXcodeConfigBuild(xcodeVersionKey, emitLoads));
fs.writeFileSync(bazelrcFragment, renderLimrunBazelrc(port, xcodeVersionKey, isMacClient));
fs.writeFileSync(path.join(dir, '.gitignore'), '*\n');
const bazelrcUpdated = ensureTryImport(workspaceDir);
return { buildFile, bazelrcFragment, bazelrcUpdated };
}
//# sourceMappingURL=rbe-workspace.mjs.map
{"version":3,"file":"rbe-workspace.mjs","sourceRoot":"","sources":["src/rbe-workspace.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,+FAA+F;AAC/F,qDAAqD;AACrD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC;AACpC,MAAM,CAAC,MAAM,eAAe,GAAG,wCAAwC,CAAC;AACxE,MAAM,kBAAkB,GAAG,uEAAuE,CAAC;AAEnG,MAAM,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AAE,sBAAsB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC;IAChF,EAAE,CAAC,aAAa,CAAC,eAAe,EAAE,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;IAC3F,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IACrD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AACxD,CAAC"}
import type { RbeStatus, XcodeClient } from './resources/xcode-instances-helpers';
/**
* Client-side helpers for driving an instance's RBE stack: waiting for it to
* come up and riding out the transient gateway errors that occur right after
* instance creation. Shared by the CLI and pure-SDK consumers (e.g. CI
* actions).
*/
export type Sleep = (ms: number) => Promise<void>;
export const defaultSleep: Sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/**
* Matches the transient gateway / dropped-connection errors that occur right
* after an instance is created, when its proxy path is not fully serving yet.
*
* The HTTP part anchors on the exact `failed: <code>` shape `directInstanceHttpError`
* produces (`${operation} failed: ${status}...`), so a bare 502/503/504 buried in
* a response body or an instance id does NOT count as transient. Fetch-thrown
* network errors carry their own names and are matched directly. A 404 never
* reaches here; `readRbeResponse` maps it to RbeUnsupportedError first.
*/
const TRANSIENT = /failed: (?:502|503|504)\b|\bEOF\b|ECONNRESET|ECONNREFUSED|socket hang up|fetch failed/i;
export function isTransientError(err: unknown): boolean {
const message = err instanceof Error ? err.message : String(err);
return TRANSIENT.test(message);
}
/**
* Retries `fn` on transient gateway errors (or on whatever `retryOn` matches
* when given). Non-matching errors propagate immediately. After exhausting
* `attempts`, throws the last error.
*/
export async function retryTransient<T>(
fn: () => Promise<T>,
opts: {
sleep?: Sleep;
log?: (msg: string) => void;
attempts?: number;
retryOn?: (err: unknown) => boolean;
} = {},
): Promise<T> {
const sleep = opts.sleep ?? defaultSleep;
const attempts = opts.attempts ?? 5;
const retryOn = opts.retryOn ?? isTransientError;
let lastErr: unknown;
for (let attempt = 1; attempt <= attempts; attempt++) {
try {
return await fn();
} catch (err) {
if (!retryOn(err)) {
throw err;
}
lastErr = err;
if (attempt < attempts) {
const message = err instanceof Error ? err.message : String(err);
opts.log?.(`Retrying after error (${message.trim()})...`);
await sleep(2000 * attempt);
}
}
}
throw lastErr;
}
/** RbeStatus once the stack is running: frontendPort and xcodeVersion are set. */
export type RunningRbeStatus = RbeStatus & Required<Pick<RbeStatus, 'frontendPort' | 'xcodeVersion'>>;
/**
* Polls `getRbe` until the stack is `running` (with a usable frontend port and
* Xcode version), starting from the `initial` status returned by `startRbe`.
* Each poll is wrapped in retryTransient so a transient blip mid-startup does
* not abort. Throws when the stack ends in `failed`, stays `starting` past
* `maxAttempts`, or reports `running` without the fields the caller needs.
*/
export async function waitForRbeRunning(
client: Pick<XcodeClient, 'getRbe'>,
initial: RbeStatus,
opts: { sleep?: Sleep; maxAttempts?: number } = {},
): Promise<RunningRbeStatus> {
const sleep = opts.sleep ?? defaultSleep;
const maxAttempts = opts.maxAttempts ?? 15;
let status = initial;
for (let attempt = 0; status.state === 'starting' && attempt < maxAttempts; attempt++) {
await sleep(2000);
status = await retryTransient(() => client.getRbe(), { sleep });
}
if (status.state !== 'running' || !status.frontendPort || !status.xcodeVersion) {
throw new Error(`Remote-execution stack failed to start: ${status.error ?? `state is ${status.state}`}`);
}
return status as RunningRbeStatus;
}
// Mirrored between src/rbe-workspace.ts (canonical) and packages/cli/src/lib/rbe-workspace.ts
// until the CLI imports it from a published @limrun/api; tests/rbe-copy-sync.test.ts keeps the
// two copies byte-identical. Apply any edit to both.
import fs from 'fs';
import path from 'path';
/**
* Generates the .limrun/ workspace companion for Limrun remote execution: a Bazel
* package pinning the remote fleet's Xcode version and an rc fragment with the
* remote-execution flags under the `limrun` config. The caller learns the
* fleet's version key from the instance's RBE status, so the generated config
* always matches the fleet without any user action; regenerating the files
* after a fleet Xcode upgrade refreshes the pin.
*/
export const LIMRUN_DIR = '.limrun';
export const TRY_IMPORT_LINE = 'try-import %workspace%/.limrun/bazelrc';
const TRY_IMPORT_COMMENT = '# Added by Limrun remote-execution setup: loads the generated config.';
const WORKSPACE_MARKERS = ['MODULE.bazel', 'WORKSPACE', 'WORKSPACE.bazel'];
/**
* Finds the Bazel workspace root by walking up from `startDir` to the first
* ancestor containing a MODULE.bazel / WORKSPACE / WORKSPACE.bazel, mirroring
* how Bazel itself locates the workspace when run from a subdirectory. Returns
* null when no workspace is found up to the filesystem root. The generated
* `.limrun/` and the `try-import` must live at this root, since `%workspace%`
* in bazelrc resolves here regardless of the directory the build is run from.
*/
export function findBazelWorkspaceRoot(startDir: string): string | null {
let dir = path.resolve(startDir);
for (;;) {
if (WORKSPACE_MARKERS.some((m) => fs.existsSync(path.join(dir, m)))) {
return dir;
}
const parent = path.dirname(dir);
if (parent === dir) {
return null;
}
dir = parent;
}
}
const APP_RULE_RE = /\b(?:ios|macos|tvos|watchos)_application\s*\(/;
const TARGET_NAME_RE = /^\s*name\s*=\s*"([^"]+)"/;
const TARGET_SCAN_SKIP_DIRS = new Set(['.git', 'node_modules', '.limrun']);
/**
* Best-effort guess of a single buildable app target to show in the printed
* build command, so it reads `//App` instead of a `//your:target` placeholder.
* Scans the workspace's BUILD files (buildifier-formatted) for apple
* `*_application` rules (no bazel invocation) and returns the label in short
* form (`//pkg` when the target name matches the package's last segment).
* Returns null when there are zero or multiple candidates (ambiguous → caller
* keeps the placeholder).
*/
export function inferBuildTarget(workspaceRoot: string): string | null {
const found: string[] = [];
const walk = (dir: string): void => {
if (found.length > 1) return; // already ambiguous; stop early
let entries: fs.Dirent[];
try {
entries = fs.readdirSync(dir, { withFileTypes: true });
} catch {
return;
}
for (const entry of entries) {
if (entry.isDirectory()) {
if (TARGET_SCAN_SKIP_DIRS.has(entry.name) || entry.name.startsWith('bazel-')) continue;
walk(path.join(dir, entry.name));
} else if (entry.name === 'BUILD' || entry.name === 'BUILD.bazel') {
collectAppTargets(path.join(dir, entry.name), workspaceRoot, found);
}
}
};
walk(workspaceRoot);
return found.length === 1 ? found[0]! : null;
}
/** Appends `//pkg[:name]` labels of apple application rules in one BUILD file. */
function collectAppTargets(buildFile: string, workspaceRoot: string, out: string[]): void {
let content: string;
try {
content = fs.readFileSync(buildFile, 'utf8');
} catch {
return;
}
const pkg = path.relative(workspaceRoot, path.dirname(buildFile)).split(path.sep).join('/');
let inAppRule = false;
for (const line of content.split('\n')) {
// Skip comment lines so a commented-out `# ios_application(` can't start a
// phantom rule (and a commented `# name = ...` can't be captured), which
// would otherwise leave inAppRule set and mislabel a later rule's name.
if (line.trimStart().startsWith('#')) continue;
if (!inAppRule) {
if (APP_RULE_RE.test(line)) inAppRule = true;
continue;
}
const match = line.match(TARGET_NAME_RE);
if (match) {
const name = match[1]!;
const last = pkg.split('/').pop();
out.push(
pkg === '' || pkg === '.' ? `//:${name}`
: last === name ? `//${pkg}`
: `//${pkg}:${name}`,
);
inAppRule = false;
} else if (/^\)/.test(line)) {
inAppRule = false; // rule closed before a name line we could read
}
}
}
/**
* Reads the workspace's pinned Bazel major version from `.bazelversion`, or
* null when the file is absent or its first line has no leading integer.
*
* Used to decide whether the generated BUILD must `load` the Xcode rules from
* apple_support: in Bazel 9 they are no longer native globals and must be
* loaded, while in Bazel 8 they ARE native globals and the apple_support rule
* impls `fail()` on the unmigrated Bazel, so loading them there breaks
* analysis. The generator runs in the workspace on the client, so the file is
* the authoritative signal for the Bazel that bazelisk will launch.
*/
export function detectBazelMajorVersion(workspaceDir: string): number | null {
try {
const raw = fs.readFileSync(path.join(workspaceDir, '.bazelversion'), 'utf8');
const firstLine = (raw.split('\n', 1)[0] ?? '').trim();
const match = firstLine.match(/^(\d+)/);
return match ? Number(match[1]) : null;
} catch {
return null;
}
}
/**
* Whether to treat the workspace as Bazel 9+ for RBE config: true when the
* detected major version is >= 9, OR unknown (no `.bazelversion` means bazelisk
* runs the latest release, which is 9+). This single predicate decides both
* emitting the apple_support Xcode-rule loads and surfacing the SHA256 digest
* hint, so the two stay in lockstep.
*/
export function isBazel9OrLater(bazelMajor: number | null): boolean {
return bazelMajor === null || bazelMajor >= 9;
}
/** Major.minor short alias (e.g. "26.4") used for the SDK default and --xcode_version. */
function shortVersion(versionKey: string): string {
const parts = versionKey.split('.');
if (parts.length < 3) {
throw new Error(`unexpected Xcode version key from the instance: ${versionKey}`);
}
return `${parts[0]}.${parts[1]}`;
}
/** Renders one xcode_version rule from a major.minor.patch.build version key. */
function renderXcodeVersionRule(name: string, versionKey: string): string {
// shortVersion validates the key shape (major.minor.patch[.build]) and yields
// the major.minor used for both the SDK defaults and the short alias.
const sdk = shortVersion(versionKey);
const parts = versionKey.split('.');
const fullAlias = `${parts[0]}.${parts[1]}.${parts[2]}`;
return `xcode_version(
name = "${name}",
aliases = [
"${sdk}",
"${fullAlias}",
],
default_ios_sdk_version = "${sdk}",
default_macos_sdk_version = "${sdk}",
default_tvos_sdk_version = "${sdk}",
default_watchos_sdk_version = "${sdk}",
version = "${versionKey}",
)`;
}
/**
* Renders an `available_xcodes` set with a single member that is also its
* mandatory default. Both sets the BUILD file emits (remote, local) are
* single-version sets of this shape, pointing at the same fleet pin.
*/
function renderAvailableXcodes(name: string, target: string): string {
return `available_xcodes(
name = "${name}",
default = "${target}",
versions = ["${target}"],
)`;
}
/**
* Renders the generated Bazel package pinning the Xcode version to the fleet's.
*
* remoteVersionKey is the fleet's `xcodebuild -version` in major.minor.patch.build
* form (e.g. 26.4.0.17E192).
*
* Uses Bazel's remote/local `xcode_config` split with BOTH sets pointing at the
* SAME fleet pin (rather than a single `default=/versions=` bucket, which
* resolves with availability UNKNOWN and leaves Apple/Swift actions eligible for
* local execution). With local == remote, `--xcode_version` resolves as
* "mutually available" (BOTH), which declares up front that this build uses only
* the fleet's Xcode AND keeps apple_support from emitting its remote-only
* "...specified, but it is not available locally..." DEBUG notice (that notice
* fires only when the pinned version is in `remote_versions` but not
* `local_versions`).
*
* We intentionally do NOT name the client's own local Xcode: under
* `--config=limrun` every action runs remotely (`--spawn_strategy=remote` +
* `--noremote_local_fallback`), so a local DEVELOPER_DIR is never resolved.
* Declaring a distinct local version would only reintroduce that DEBUG notice on
* a client whose Xcode differs from the fleet's. (The fleet pin is used, not
* Bazel's `@local_config_xcode//:host_available_xcodes`: that repo is not
* visible from the main module under bzlmod and is never generated off-darwin.)
*
* When `emitLoads` is true (Bazel 9+), the Xcode rules are loaded from
* apple_support; on Bazel 8 they are native globals and MUST NOT be loaded
* (the apple_support rule impls fail on the unmigrated Bazel).
*/
export function renderXcodeConfigBuild(remoteVersionKey: string, emitLoads: boolean): string {
// Bazel 9 migrated xcode_version/available_xcodes/xcode_config out of native
// globals into apple_support; they must be loaded there. The repo_name
// @build_bazel_apple_support is the apple_support module convention.
const loads =
emitLoads ?
`load("@build_bazel_apple_support//xcode:xcode_version.bzl", "xcode_version")
load("@build_bazel_apple_support//xcode:available_xcodes.bzl", "available_xcodes")
load("@build_bazel_apple_support//xcode:xcode_config.bzl", "xcode_config")
`
: '';
const remoteRule = renderXcodeVersionRule('remote_xcode', remoteVersionKey);
return `# Generated by lim xcode rbe. Do not edit; rerun the command to refresh.
#
# Pins the Xcode version Bazel uses to the limrun fleet's Xcode, independent of
# any Xcode installed on this machine. Both the remote and local sets point at
# the SAME pin so --xcode_version resolves as mutually available (no
# apple_support remote-only DEBUG notice); under --config=limrun all actions run
# remotely, so a local DEVELOPER_DIR is never resolved. Selected via
# .limrun/bazelrc (--config=limrun).
${loads}${remoteRule}
# Both sets point at the single fleet pin.
${renderAvailableXcodes('remote_xcodes', ':remote_xcode')}
${renderAvailableXcodes('local_xcodes', ':remote_xcode')}
xcode_config(
name = "remote_xcode_config",
remote_versions = ":remote_xcodes",
local_versions = ":local_xcodes",
)
`;
}
/**
* Renders the rc fragment with the remote-execution flags under
* --config=limrun.
*
* - `--remote_cache=` (empty) clears any workspace-level `--remote_cache`. The
* limrun executor carries its own CAS, so a separate cache backend (e.g. a
* repo pointing `--remote_cache` at BuildBuddy/EngFlow) splits inputs and
* outputs across two stores the executor cannot reconcile, surfacing as "Lost
* inputs no longer available remotely". Emptying it under --config=limrun
* routes caching back to the executor's CAS while leaving the repo's non-limrun
* builds (where that cache is valid) untouched.
* - The `--bes_*` flags stream the Build Event Protocol to the daemon's BES
* service, co-hosted on the same RBE frontend as the executor (hence the same
* `127.0.0.1:${port}`), powering the live + persisted console.
* `--bes_upload_mode=nowait_for_upload_complete` keeps the current build from
* blocking at exit on the BES upload (the wait moves to the start of the next
* invocation, bounded by `--bes_timeout`), while streams stay complete/acked
* for the persisted record. An older daemon without the BES service registered
* answers PublishBuildEvent with a non-fatal warning, so the flags are safe
* ahead of the image rollout.
* - `--xcode_version` pins the fleet's version: without it, a mac client
* lacking that exact version has no mutual version and silently falls back
* to its LOCAL default, shipping the wrong version to the remote worker via
* XCODE_VERSION_OVERRIDE (the worker then rejects it).
* - `--strategy=SwiftCompile=remote` / `--strategy=Genrule=remote` override
* mnemonic-specific strategies a workspace may pin (rules_swift defaults
* SwiftCompile to a local persistent `worker`; repos often pin Genrule to
* `standalone`). Those run locally and break RBE: a local Swift worker can't
* run on a Linux client at all, and on a mac it would demand the fleet's
* Xcode locally. --spawn_strategy=remote does not override per-mnemonic
* pins, so these explicit overrides are required.
* - `--ios_multi_cpus=sim_arm64` pins the app to the **arm64 iOS simulator**.
* Limrun's Mac fleet (workers and the attached simulators) is Apple Silicon,
* so the build product must be arm64. Without this, the simulator cpu follows
* the CLIENT's Bazel default (`sim_arm64` on an Apple Silicon Mac, but
* `x86_64` on an Intel Mac or a Linux client), and an x86_64 app installed on
* the arm64 fleet simulator fails to launch with "needs to be updated by the
* developer to work on this version of iOS". The pin makes the artifact match
* the fleet regardless of where bazel runs (the whole point of RBE).
* - PATH includes /usr/sbin:/sbin so genrules that probe `sysctl` (e.g.
* `hw.logicalcpu` for `make -j`) resolve it on the worker.
* - `--remote_download_outputs=minimal` keeps the built .ipa in the instance's
* CAS instead of downloading it; the daemon auto-installs it server-side from
* there (driven by the BES stream), so the bytes never round-trip. The printed
* `lim xcode rbe` output tells users to add `--remote_download_outputs=toplevel`
* on the command line when they want the .ipa materialized locally (a
* command-line flag overrides this rc setting).
* - `--extra_execution_platforms` is emitted ONLY for non-mac clients: a Linux
* host has no auto-detected darwin execution platform, so the Apple/Swift
* toolchain (exec_compatible_with macos) needs one registered to route
* actions to the mac RBE pool. On a mac it is HARMFUL: it makes bazel run
* exec-config actions on the local host instead of the remote worker, which
* then demand a local Xcode.
* - `--modify_execution_info=.*=-no-remote,.*=-no-remote-exec` strips the
* `no-remote`/`no-remote-exec` execution-info tags rules_apple sets on
* bundling/linking/signing actions (in-code on device builds, and via its
* recommended `+no-remote` bazelrc that real iOS repos carry). Under
* --config=limrun every action runs remotely, so any such tag leaves the
* action with no usable strategy ("cannot be executed with any of the
* available strategies: [remote]") and the build fails. That is the exact
* breakage a Linux client (no local Xcode) hits. This is the execution-info
* analog of the --strategy=...=remote overrides above; stripping globally is
* safe because removing a tag an action never had is a no-op.
* - A `user.limrun.bazelrc` at the workspace root is try-imported last as a user
* override hook, so callers can extend or override the generated config
* without editing this file or passing flags on the command line.
*/
export function renderLimrunBazelrc(port: number, versionKey: string, isMacClient: boolean): string {
const execPlatform =
isMacClient ? '' : (
'build:limrun --extra_execution_platforms=@build_bazel_apple_support//platforms:darwin_arm64\n'
);
return `# Generated by lim xcode rbe. Do not edit; rerun the command to refresh.
build:limrun --remote_executor=grpc://127.0.0.1:${port}
build:limrun --bes_backend=grpc://127.0.0.1:${port}
build:limrun --bes_upload_mode=nowait_for_upload_complete
build:limrun --bes_timeout=60s
build:limrun --remote_cache=
build:limrun --remote_default_exec_properties=OSFamily=Darwin
build:limrun --spawn_strategy=remote
build:limrun --noremote_local_fallback
build:limrun --strategy=SwiftCompile=remote
build:limrun --strategy=Genrule=remote
build:limrun --modify_execution_info=.*=-no-remote,.*=-no-remote-exec
build:limrun --xcode_version_config=//.limrun:remote_xcode_config
build:limrun --xcode_version=${shortVersion(versionKey)}
build:limrun --ios_multi_cpus=sim_arm64
build:limrun --remote_download_outputs=minimal
${execPlatform}build:limrun --action_env=PATH=/usr/bin:/bin:/usr/sbin:/sbin
# A user.limrun.bazelrc at the workspace root is try-imported last, so it can
# extend or override anything above without editing this generated file or
# passing flags on the command line. A missing file is silently skipped.
try-import %workspace%/user.limrun.bazelrc
`;
}
/**
* Idempotently ensures the workspace .bazelrc try-imports the generated
* fragment. Creates .bazelrc when missing. Returns true when the file changed.
*/
export function ensureTryImport(workspaceDir: string): boolean {
const bazelrcPath = path.join(workspaceDir, '.bazelrc');
let current = '';
if (fs.existsSync(bazelrcPath)) {
current = fs.readFileSync(bazelrcPath, 'utf8');
// Match the try-import on a line basis (exact, uncommented) rather than a
// raw substring, so a commented-out occurrence (e.g. `# try-import ...`)
// doesn't make us skip wiring the active import.
const alreadyWired = current.split('\n').some((line) => line.trim() === TRY_IMPORT_LINE);
if (alreadyWired) {
return false;
}
}
const block = `${TRY_IMPORT_COMMENT}\n${TRY_IMPORT_LINE}\n`;
const next = current === '' ? block : `${current.replace(/\n*$/, '\n\n')}${block}`;
fs.writeFileSync(bazelrcPath, next);
return true;
}
export type RbeWorkspaceFiles = {
buildFile: string;
bazelrcFragment: string;
bazelrcUpdated: boolean;
};
/**
* Writes .limrun/{BUILD,bazelrc,.gitignore} into the workspace and wires the
* try-import. The .gitignore containing "*" makes the directory self-ignoring
* so nothing else in the user's repo needs to change.
*/
export function writeRbeWorkspaceFiles(
workspaceDir: string,
xcodeVersionKey: string,
port: number,
isMacClient: boolean = process.platform === 'darwin',
bazelMajor: number | null = detectBazelMajorVersion(workspaceDir),
): RbeWorkspaceFiles {
const dir = path.join(workspaceDir, LIMRUN_DIR);
fs.mkdirSync(dir, { recursive: true });
const buildFile = path.join(dir, 'BUILD');
const bazelrcFragment = path.join(dir, 'bazelrc');
// Load the Xcode rules from apple_support on Bazel 9+, where they are no
// longer native globals. On a known Bazel 8 workspace they ARE native (and
// loading would fail), so omit the loads.
const emitLoads = isBazel9OrLater(bazelMajor);
fs.writeFileSync(buildFile, renderXcodeConfigBuild(xcodeVersionKey, emitLoads));
fs.writeFileSync(bazelrcFragment, renderLimrunBazelrc(port, xcodeVersionKey, isMacClient));
fs.writeFileSync(path.join(dir, '.gitignore'), '*\n');
const bazelrcUpdated = ensureTryImport(workspaceDir);
return { buildFile, bazelrcFragment, bazelrcUpdated };
}
+13
-0
# Changelog
## 0.35.0 (2026-07-03)
Full Changelog: [v0.34.0...v0.35.0](https://github.com/limrun-inc/typescript-sdk/compare/v0.34.0...v0.35.0)
### Features
* **xcode:** RBE workspace/session helpers in the SDK and uploadLatestRbeBuild ([fdfb7b0](https://github.com/limrun-inc/typescript-sdk/commit/fdfb7b03010a38e129691aba97789a77887fdf2d))
### Refactors
* **xcode:** apply cleanup review to the RBE upload surface ([ae34cb9](https://github.com/limrun-inc/typescript-sdk/commit/ae34cb9d40bc9f689a0cf231f1e474bafefcfbe6))
## 0.34.0 (2026-07-01)

@@ -4,0 +17,0 @@

+3
-1

@@ -11,4 +11,6 @@ export { Limrun as default } from "./client.mjs";

export { exec, type ExecRequest, type ExecOptions, type ExecResult, type ExecChildProcess, } from "./exec-client.mjs";
export { type XcodeCreateClientParams, type XcodeClient, type RbeStatus, type RbeStartOptions, type RbeTunnelOptions, type RbeInstallResult, type Tunnel, RbeUnsupportedError, deriveRbeTunnelUrl, DEFAULT_RBE_TUNNEL_PORT, type XcodeProjectConfig, type XcodeBuildOptions, type ReactNativeBuildConfig, type SimulatorAttachResult, type SimulatorStatus, type SimulatorBuildStatus, type SimulatorAttachment, type SimulatorDeviceInfo, type SimulatorInstallState, } from "./resources/xcode-instances-helpers.mjs";
export { type XcodeCreateClientParams, type XcodeClient, type RbeStatus, type RbeStartOptions, type RbeTunnelOptions, type RbeInstallResult, type RbeUploadOptions, type RbeUploadResult, type Tunnel, RbeUnsupportedError, deriveRbeTunnelUrl, DEFAULT_RBE_TUNNEL_PORT, type XcodeProjectConfig, type XcodeBuildOptions, type ReactNativeBuildConfig, type SimulatorAttachResult, type SimulatorStatus, type SimulatorBuildStatus, type SimulatorAttachment, type SimulatorDeviceInfo, type SimulatorInstallState, } from "./resources/xcode-instances-helpers.mjs";
export { LIMRUN_DIR, TRY_IMPORT_LINE, findBazelWorkspaceRoot, inferBuildTarget, detectBazelMajorVersion, isBazel9OrLater, renderXcodeConfigBuild, renderLimrunBazelrc, ensureTryImport, writeRbeWorkspaceFiles, type RbeWorkspaceFiles, } from "./rbe-workspace.mjs";
export { isTransientError, retryTransient, waitForRbeRunning, defaultSleep, type Sleep, type RunningRbeStatus, } from "./rbe-session.mjs";
export { LimrunError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
//# sourceMappingURL=index.d.mts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,qBAAiB;AAE7C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE,2BAAuB;AACzD,OAAO,EAAE,UAAU,EAAE,+BAA2B;AAChD,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,qBAAiB;AACtD,OAAO,EAAE,WAAW,EAAE,8BAA0B;AAChD,sCAAkC;AAClC,OAAO,KAAK,GAAG,yBAAqB;AACpC,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,yBAAqB;AAC1F,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,6BAAyB;AAC3G,OAAO,EACL,IAAI,EACJ,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,gBAAgB,GACtB,0BAAsB;AAC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WAAW,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,gDAA4C;AAC7C,OAAO,EACL,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,KAAK,iBAAiB,GACvB,4BAAwB;AACzB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,KAAK,KAAK,EACV,KAAK,gBAAgB,GACtB,0BAAsB;AACvB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,yBAAqB"}

@@ -11,4 +11,6 @@ export { Limrun as default } from "./client.js";

export { exec, type ExecRequest, type ExecOptions, type ExecResult, type ExecChildProcess, } from "./exec-client.js";
export { type XcodeCreateClientParams, type XcodeClient, type RbeStatus, type RbeStartOptions, type RbeTunnelOptions, type RbeInstallResult, type Tunnel, RbeUnsupportedError, deriveRbeTunnelUrl, DEFAULT_RBE_TUNNEL_PORT, type XcodeProjectConfig, type XcodeBuildOptions, type ReactNativeBuildConfig, type SimulatorAttachResult, type SimulatorStatus, type SimulatorBuildStatus, type SimulatorAttachment, type SimulatorDeviceInfo, type SimulatorInstallState, } from "./resources/xcode-instances-helpers.js";
export { type XcodeCreateClientParams, type XcodeClient, type RbeStatus, type RbeStartOptions, type RbeTunnelOptions, type RbeInstallResult, type RbeUploadOptions, type RbeUploadResult, type Tunnel, RbeUnsupportedError, deriveRbeTunnelUrl, DEFAULT_RBE_TUNNEL_PORT, type XcodeProjectConfig, type XcodeBuildOptions, type ReactNativeBuildConfig, type SimulatorAttachResult, type SimulatorStatus, type SimulatorBuildStatus, type SimulatorAttachment, type SimulatorDeviceInfo, type SimulatorInstallState, } from "./resources/xcode-instances-helpers.js";
export { LIMRUN_DIR, TRY_IMPORT_LINE, findBazelWorkspaceRoot, inferBuildTarget, detectBazelMajorVersion, isBazel9OrLater, renderXcodeConfigBuild, renderLimrunBazelrc, ensureTryImport, writeRbeWorkspaceFiles, type RbeWorkspaceFiles, } from "./rbe-workspace.js";
export { isTransientError, retryTransient, waitForRbeRunning, defaultSleep, type Sleep, type RunningRbeStatus, } from "./rbe-session.js";
export { LimrunError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
//# sourceMappingURL=index.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,oBAAiB;AAE7C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE,0BAAuB;AACzD,OAAO,EAAE,UAAU,EAAE,8BAA2B;AAChD,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,oBAAiB;AACtD,OAAO,EAAE,WAAW,EAAE,6BAA0B;AAChD,qCAAkC;AAClC,OAAO,KAAK,GAAG,wBAAqB;AACpC,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,wBAAqB;AAC1F,OAAO,EAAE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E,4BAAyB;AAC3G,OAAO,EACL,IAAI,EACJ,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,gBAAgB,GACtB,yBAAsB;AACvB,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,+CAA4C;AAC7C,OAAO,EACL,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,KAAK,iBAAiB,GACvB,2BAAwB;AACzB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,KAAK,KAAK,EACV,KAAK,gBAAgB,GACtB,yBAAsB;AACvB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,wBAAqB"}

@@ -7,3 +7,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.LimrunError = exports.DEFAULT_RBE_TUNNEL_PORT = exports.deriveRbeTunnelUrl = exports.RbeUnsupportedError = exports.exec = exports.validateBuildSettings = exports.parseBuildSettingEntries = exports.buildSettingKeyPattern = exports.startHttpProxy = exports.Ios = exports.PagePromise = exports.Limrun = exports.APIPromise = exports.toFile = exports.default = void 0;
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.LimrunError = exports.defaultSleep = exports.waitForRbeRunning = exports.retryTransient = exports.isTransientError = exports.writeRbeWorkspaceFiles = exports.ensureTryImport = exports.renderLimrunBazelrc = exports.renderXcodeConfigBuild = exports.isBazel9OrLater = exports.detectBazelMajorVersion = exports.inferBuildTarget = exports.findBazelWorkspaceRoot = exports.TRY_IMPORT_LINE = exports.LIMRUN_DIR = exports.DEFAULT_RBE_TUNNEL_PORT = exports.deriveRbeTunnelUrl = exports.RbeUnsupportedError = exports.exec = exports.validateBuildSettings = exports.parseBuildSettingEntries = exports.buildSettingKeyPattern = exports.startHttpProxy = exports.Ios = exports.PagePromise = exports.Limrun = exports.APIPromise = exports.toFile = exports.default = void 0;
const tslib_1 = require("./internal/tslib.js");

@@ -34,2 +34,18 @@ var client_1 = require("./client.js");

Object.defineProperty(exports, "DEFAULT_RBE_TUNNEL_PORT", { enumerable: true, get: function () { return xcode_instances_helpers_1.DEFAULT_RBE_TUNNEL_PORT; } });
var rbe_workspace_1 = require("./rbe-workspace.js");
Object.defineProperty(exports, "LIMRUN_DIR", { enumerable: true, get: function () { return rbe_workspace_1.LIMRUN_DIR; } });
Object.defineProperty(exports, "TRY_IMPORT_LINE", { enumerable: true, get: function () { return rbe_workspace_1.TRY_IMPORT_LINE; } });
Object.defineProperty(exports, "findBazelWorkspaceRoot", { enumerable: true, get: function () { return rbe_workspace_1.findBazelWorkspaceRoot; } });
Object.defineProperty(exports, "inferBuildTarget", { enumerable: true, get: function () { return rbe_workspace_1.inferBuildTarget; } });
Object.defineProperty(exports, "detectBazelMajorVersion", { enumerable: true, get: function () { return rbe_workspace_1.detectBazelMajorVersion; } });
Object.defineProperty(exports, "isBazel9OrLater", { enumerable: true, get: function () { return rbe_workspace_1.isBazel9OrLater; } });
Object.defineProperty(exports, "renderXcodeConfigBuild", { enumerable: true, get: function () { return rbe_workspace_1.renderXcodeConfigBuild; } });
Object.defineProperty(exports, "renderLimrunBazelrc", { enumerable: true, get: function () { return rbe_workspace_1.renderLimrunBazelrc; } });
Object.defineProperty(exports, "ensureTryImport", { enumerable: true, get: function () { return rbe_workspace_1.ensureTryImport; } });
Object.defineProperty(exports, "writeRbeWorkspaceFiles", { enumerable: true, get: function () { return rbe_workspace_1.writeRbeWorkspaceFiles; } });
var rbe_session_1 = require("./rbe-session.js");
Object.defineProperty(exports, "isTransientError", { enumerable: true, get: function () { return rbe_session_1.isTransientError; } });
Object.defineProperty(exports, "retryTransient", { enumerable: true, get: function () { return rbe_session_1.retryTransient; } });
Object.defineProperty(exports, "waitForRbeRunning", { enumerable: true, get: function () { return rbe_session_1.waitForRbeRunning; } });
Object.defineProperty(exports, "defaultSleep", { enumerable: true, get: function () { return rbe_session_1.defaultSleep; } });
var error_1 = require("./core/error.js");

@@ -36,0 +52,0 @@ Object.defineProperty(exports, "LimrunError", { enumerable: true, get: function () { return error_1.LimrunError; } });

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,sCAA6C;AAApC,iGAAA,MAAM,OAAW;AAE1B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAsD;AAA7C,gGAAA,MAAM,OAAA;AACf,mDAAgD;AAAvC,yGAAA,WAAW,OAAA;AACpB,+D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uBAAuB,OAAA;AAWzB,oDAYyB;AAXvB,2GAAA,UAAU,OAAA;AACV,gHAAA,eAAe,OAAA;AACf,uHAAA,sBAAsB,OAAA;AACtB,iHAAA,gBAAgB,OAAA;AAChB,wHAAA,uBAAuB,OAAA;AACvB,gHAAA,eAAe,OAAA;AACf,uHAAA,sBAAsB,OAAA;AACtB,oHAAA,mBAAmB,OAAA;AACnB,gHAAA,eAAe,OAAA;AACf,uHAAA,sBAAsB,OAAA;AAGxB,gDAOuB;AANrB,+GAAA,gBAAgB,OAAA;AAChB,6GAAA,cAAc,OAAA;AACd,gHAAA,iBAAiB,OAAA;AACjB,2GAAA,YAAY,OAAA;AAId,yCAcsB;AAbpB,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA"}

@@ -13,3 +13,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { RbeUnsupportedError, deriveRbeTunnelUrl, DEFAULT_RBE_TUNNEL_PORT, } from "./resources/xcode-instances-helpers.mjs";
export { LIMRUN_DIR, TRY_IMPORT_LINE, findBazelWorkspaceRoot, inferBuildTarget, detectBazelMajorVersion, isBazel9OrLater, renderXcodeConfigBuild, renderLimrunBazelrc, ensureTryImport, writeRbeWorkspaceFiles, } from "./rbe-workspace.mjs";
export { isTransientError, retryTransient, waitForRbeRunning, defaultSleep, } from "./rbe-session.mjs";
export { LimrunError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
//# sourceMappingURL=index.mjs.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,qBAAiB;AAE7C,OAAO,EAAmB,MAAM,EAAE,2BAAuB;AACzD,OAAO,EAAE,UAAU,EAAE,+BAA2B;AAChD,OAAO,EAAE,MAAM,EAAsB,qBAAiB;AACtD,OAAO,EAAE,WAAW,EAAE,8BAA0B;AAChD,sCAAkC;AAClC,OAAO,KAAK,GAAG,yBAAqB;AACpC,OAAO,EAAE,cAAc,EAA8C,yBAAqB;AAC1F,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,6BAAyB;AAC3G,OAAO,EACL,IAAI,GAKL,0BAAsB;AACvB,OAAO,EAQL,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GAUxB,gDAA4C;AAC7C,OAAO,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,yBAAqB"}
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,qBAAiB;AAE7C,OAAO,EAAmB,MAAM,EAAE,2BAAuB;AACzD,OAAO,EAAE,UAAU,EAAE,+BAA2B;AAChD,OAAO,EAAE,MAAM,EAAsB,qBAAiB;AACtD,OAAO,EAAE,WAAW,EAAE,8BAA0B;AAChD,sCAAkC;AAClC,OAAO,KAAK,GAAG,yBAAqB;AACpC,OAAO,EAAE,cAAc,EAA8C,yBAAqB;AAC1F,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,6BAAyB;AAC3G,OAAO,EACL,IAAI,GAKL,0BAAsB;AACvB,OAAO,EAUL,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GAUxB,gDAA4C;AAC7C,OAAO,EACL,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,GAEvB,4BAAwB;AACzB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,YAAY,GAGb,0BAAsB;AACvB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,yBAAqB"}

@@ -0,2 +1,11 @@

/** Error thrown for non-2xx direct-instance responses, carrying the HTTP
* status and raw body so callers can match on them structurally instead of
* parsing the message. */
export type DirectInstanceHttpError = Error & {
status: number;
body: string;
};
export declare function directInstanceHttpError(operation: string, status: number, text: string, headers: Headers): Error;
/** Narrow an unknown error to a direct-instance HTTP error with the given status. */
export declare function isDirectInstanceHttpError(err: unknown, status: number): err is DirectInstanceHttpError;
//# sourceMappingURL=direct-instance-errors.d.mts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"direct-instance-errors.d.mts","sourceRoot":"","sources":["../src/internal/direct-instance-errors.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GACf,KAAK,CAMP"}
{"version":3,"file":"direct-instance-errors.d.mts","sourceRoot":"","sources":["../src/internal/direct-instance-errors.ts"],"names":[],"mappings":"AAEA;;2BAE2B;AAC3B,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GACf,KAAK,CAMP;AAED,qFAAqF;AACrF,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,uBAAuB,CAEtG"}

@@ -0,2 +1,11 @@

/** Error thrown for non-2xx direct-instance responses, carrying the HTTP
* status and raw body so callers can match on them structurally instead of
* parsing the message. */
export type DirectInstanceHttpError = Error & {
status: number;
body: string;
};
export declare function directInstanceHttpError(operation: string, status: number, text: string, headers: Headers): Error;
/** Narrow an unknown error to a direct-instance HTTP error with the given status. */
export declare function isDirectInstanceHttpError(err: unknown, status: number): err is DirectInstanceHttpError;
//# sourceMappingURL=direct-instance-errors.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"direct-instance-errors.d.ts","sourceRoot":"","sources":["../src/internal/direct-instance-errors.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GACf,KAAK,CAMP"}
{"version":3,"file":"direct-instance-errors.d.ts","sourceRoot":"","sources":["../src/internal/direct-instance-errors.ts"],"names":[],"mappings":"AAEA;;2BAE2B;AAC3B,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GACf,KAAK,CAMP;AAED,qFAAqF;AACrF,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,uBAAuB,CAEtG"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.directInstanceHttpError = directInstanceHttpError;
exports.isDirectInstanceHttpError = isDirectInstanceHttpError;
const error_1 = require("../core/error.js");

@@ -10,4 +11,8 @@ function directInstanceHttpError(operation, status, text, headers) {

}
return new Error(message);
return Object.assign(new Error(message), { status, body: text });
}
/** Narrow an unknown error to a direct-instance HTTP error with the given status. */
function isDirectInstanceHttpError(err, status) {
return err instanceof Error && err.status === status;
}
//# sourceMappingURL=direct-instance-errors.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"direct-instance-errors.js","sourceRoot":"","sources":["../src/internal/direct-instance-errors.ts"],"names":[],"mappings":";;AAEA,0DAWC;AAbD,4CAA8C;AAE9C,SAAgB,uBAAuB,CACrC,SAAiB,EACjB,MAAc,EACd,IAAY,EACZ,OAAgB;IAEhB,MAAM,OAAO,GAAG,GAAG,SAAS,YAAY,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC1E,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,IAAI,qBAAa,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC"}
{"version":3,"file":"direct-instance-errors.js","sourceRoot":"","sources":["../src/internal/direct-instance-errors.ts"],"names":[],"mappings":";;AAOA,0DAWC;AAGD,8DAEC;AAvBD,4CAA8C;AAO9C,SAAgB,uBAAuB,CACrC,SAAiB,EACjB,MAAc,EACd,IAAY,EACZ,OAAgB;IAEhB,MAAM,OAAO,GAAG,GAAG,SAAS,YAAY,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC1E,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,IAAI,qBAAa,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,qFAAqF;AACrF,SAAgB,yBAAyB,CAAC,GAAY,EAAE,MAAc;IACpE,OAAO,GAAG,YAAY,KAAK,IAAK,GAAwC,CAAC,MAAM,KAAK,MAAM,CAAC;AAC7F,CAAC"}

@@ -7,4 +7,8 @@ import { NotFoundError } from "../core/error.mjs";

}
return new Error(message);
return Object.assign(new Error(message), { status, body: text });
}
/** Narrow an unknown error to a direct-instance HTTP error with the given status. */
export function isDirectInstanceHttpError(err, status) {
return err instanceof Error && err.status === status;
}
//# sourceMappingURL=direct-instance-errors.mjs.map

@@ -1,1 +0,1 @@

{"version":3,"file":"direct-instance-errors.mjs","sourceRoot":"","sources":["../src/internal/direct-instance-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,0BAAsB;AAE9C,MAAM,UAAU,uBAAuB,CACrC,SAAiB,EACjB,MAAc,EACd,IAAY,EACZ,OAAgB;IAEhB,MAAM,OAAO,GAAG,GAAG,SAAS,YAAY,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC1E,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC"}
{"version":3,"file":"direct-instance-errors.mjs","sourceRoot":"","sources":["../src/internal/direct-instance-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,0BAAsB;AAO9C,MAAM,UAAU,uBAAuB,CACrC,SAAiB,EACjB,MAAc,EACd,IAAY,EACZ,OAAgB;IAEhB,MAAM,OAAO,GAAG,GAAG,SAAS,YAAY,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC1E,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,yBAAyB,CAAC,GAAY,EAAE,MAAc;IACpE,OAAO,GAAG,YAAY,KAAK,IAAK,GAAwC,CAAC,MAAM,KAAK,MAAM,CAAC;AAC7F,CAAC"}

@@ -5,4 +5,13 @@ import type { Agent as HttpAgent } from 'http';

private envHttpProxyAgent;
private longRequestDispatcher;
private websocketAgents;
fetch: Fetch;
/**
* fetch for requests that legitimately receive no response bytes for many
* minutes (the server answers only after completing long work). Plain fetch
* would abort them at undici's default 300s headersTimeout.
* EnvHttpProxyAgent covers the no-proxy case too: it routes non-proxied
* origins through an internal Agent built with these same options.
*/
fetchLongRequest: Fetch;
getWebSocketAgent(url: string): HttpAgent | undefined;

@@ -9,0 +18,0 @@ private getEnvHttpProxyAgent;

@@ -1,1 +0,1 @@

{"version":3,"file":"proxy-transport.d.mts","sourceRoot":"","sources":["../src/internal/proxy-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAM/C,OAAO,KAAK,EAAE,KAAK,EAAE,4BAAwB;AAE7C,cAAM,kBAAkB;IACtB,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,eAAe,CAAgC;IAEvD,KAAK,EAAE,KAAK,CASV;IAEF,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAoBrD,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,0BAA0B;CASnC;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
{"version":3,"file":"proxy-transport.d.mts","sourceRoot":"","sources":["../src/internal/proxy-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAM/C,OAAO,KAAK,EAAE,KAAK,EAAE,4BAAwB;AAQ7C,cAAM,kBAAkB;IACtB,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,qBAAqB,CAAgC;IAC7D,OAAO,CAAC,eAAe,CAAgC;IAEvD,KAAK,EAAE,KAAK,CASV;IAEF;;;;;;OAMG;IACH,gBAAgB,EAAE,KAAK,CAMrB;IAEF,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAoBrD,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,0BAA0B;CASnC;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}

@@ -5,4 +5,13 @@ import type { Agent as HttpAgent } from 'http';

private envHttpProxyAgent;
private longRequestDispatcher;
private websocketAgents;
fetch: Fetch;
/**
* fetch for requests that legitimately receive no response bytes for many
* minutes (the server answers only after completing long work). Plain fetch
* would abort them at undici's default 300s headersTimeout.
* EnvHttpProxyAgent covers the no-proxy case too: it routes non-proxied
* origins through an internal Agent built with these same options.
*/
fetchLongRequest: Fetch;
getWebSocketAgent(url: string): HttpAgent | undefined;

@@ -9,0 +18,0 @@ private getEnvHttpProxyAgent;

@@ -1,1 +0,1 @@

{"version":3,"file":"proxy-transport.d.ts","sourceRoot":"","sources":["../src/internal/proxy-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAM/C,OAAO,KAAK,EAAE,KAAK,EAAE,2BAAwB;AAE7C,cAAM,kBAAkB;IACtB,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,eAAe,CAAgC;IAEvD,KAAK,EAAE,KAAK,CASV;IAEF,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAoBrD,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,0BAA0B;CASnC;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
{"version":3,"file":"proxy-transport.d.ts","sourceRoot":"","sources":["../src/internal/proxy-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAM/C,OAAO,KAAK,EAAE,KAAK,EAAE,2BAAwB;AAQ7C,cAAM,kBAAkB;IACtB,OAAO,CAAC,iBAAiB,CAAgC;IACzD,OAAO,CAAC,qBAAqB,CAAgC;IAC7D,OAAO,CAAC,eAAe,CAAgC;IAEvD,KAAK,EAAE,KAAK,CASV;IAEF;;;;;;OAMG;IACH,gBAAgB,EAAE,KAAK,CAMrB;IAEF,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAoBrD,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,0BAA0B;CASnC;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}

@@ -7,2 +7,7 @@ "use strict";

const undici_1 = require("undici");
// For requests whose server responds only after finishing long work (no bytes
// until then). Matches the ingress proxy-read-timeout so the client is never
// the first to give up. undici's defaults are 300s, which would abort e.g. an
// instance-side artifact upload that takes longer.
const longRequestTimeouts = { headersTimeout: 3600000, bodyTimeout: 3600000 };
class NodeProxyTransport {

@@ -20,2 +25,16 @@ constructor() {

};
/**
* fetch for requests that legitimately receive no response bytes for many
* minutes (the server answers only after completing long work). Plain fetch
* would abort them at undici's default 300s headersTimeout.
* EnvHttpProxyAgent covers the no-proxy case too: it routes non-proxied
* origins through an internal Agent built with these same options.
*/
this.fetchLongRequest = async (input, init) => {
this.longRequestDispatcher ?? (this.longRequestDispatcher = new undici_1.EnvHttpProxyAgent(longRequestTimeouts));
return fetch(input, {
...(init ?? {}),
dispatcher: this.longRequestDispatcher,
});
};
}

@@ -22,0 +41,0 @@ getWebSocketAgent(url) {

@@ -1,1 +0,1 @@

{"version":3,"file":"proxy-transport.js","sourceRoot":"","sources":["../src/internal/proxy-transport.ts"],"names":[],"mappings":";;;AAEA,yDAAoD;AACpD,mDAAgD;AAChD,mCAA2C;AAI3C,MAAM,kBAAkB;IAAxB;QAEU,oBAAe,GAAG,IAAI,GAAG,EAAqB,CAAC;QAEvD,UAAK,GAAU,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,OAAO,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC5B,CAAC;YAED,OAAQ,KAAa,CAAC,KAAK,EAAE;gBAC3B,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;gBACf,UAAU,EAAE,IAAI,CAAC,oBAAoB,EAAE;aACxC,CAAC,CAAC;QACL,CAAC,CAAC;IA6CJ,CAAC;IA3CC,iBAAiB,CAAC,GAAW;QAC3B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC;QACnB,CAAC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,QAAQ,KAAK,KAAK,EAAE,CAAC;YACjC,SAAS,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC/B,CAAC;aAAM,IAAI,SAAS,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACzC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAChC,CAAC;QACD,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;CACF;AAEY,QAAA,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
import { HttpsProxyAgent } from 'https-proxy-agent';
import { getProxyForUrl } from 'proxy-from-env';
import { EnvHttpProxyAgent } from 'undici';
// For requests whose server responds only after finishing long work (no bytes
// until then). Matches the ingress proxy-read-timeout so the client is never
// the first to give up. undici's defaults are 300s, which would abort e.g. an
// instance-side artifact upload that takes longer.
const longRequestTimeouts = { headersTimeout: 3600000, bodyTimeout: 3600000 };
class NodeProxyTransport {

@@ -16,2 +21,16 @@ constructor() {

};
/**
* fetch for requests that legitimately receive no response bytes for many
* minutes (the server answers only after completing long work). Plain fetch
* would abort them at undici's default 300s headersTimeout.
* EnvHttpProxyAgent covers the no-proxy case too: it routes non-proxied
* origins through an internal Agent built with these same options.
*/
this.fetchLongRequest = async (input, init) => {
this.longRequestDispatcher ?? (this.longRequestDispatcher = new EnvHttpProxyAgent(longRequestTimeouts));
return fetch(input, {
...(init ?? {}),
dispatcher: this.longRequestDispatcher,
});
};
}

@@ -18,0 +37,0 @@ getWebSocketAgent(url) {

@@ -1,1 +0,1 @@

{"version":3,"file":"proxy-transport.mjs","sourceRoot":"","sources":["../src/internal/proxy-transport.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAI3C,MAAM,kBAAkB;IAAxB;QAEU,oBAAe,GAAG,IAAI,GAAG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I,CAAC,iBAAiB,KAAtB,IAAI,CAAC,iBAAiB,GAAK,IAAI,iBAAiB,EAAE,EAAC;QACnD,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAEO,WAAW;QACjB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;YAC9D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACxB,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;IAChG,CAAC;IAEO,0BAA0B,CAAC,GAAW;QAC5C,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,SAAS,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YACjC,SAAS,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC/B,CAAC;aAAM,IAAI,SAAS,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACzC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAChC,CAAC;QACD,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
{
"name": "@limrun/api",
"version": "0.34.0",
"version": "0.35.0",
"description": "The official TypeScript library for the Limrun API",

@@ -221,2 +221,22 @@ "author": "Limrun <contact@limrun.com>",

},
"./rbe-session": {
"import": "./rbe-session.mjs",
"require": "./rbe-session.js"
},
"./rbe-session.js": {
"default": "./rbe-session.js"
},
"./rbe-session.mjs": {
"default": "./rbe-session.mjs"
},
"./rbe-workspace": {
"import": "./rbe-workspace.mjs",
"require": "./rbe-workspace.js"
},
"./rbe-workspace.js": {
"default": "./rbe-workspace.js"
},
"./rbe-workspace.mjs": {
"default": "./rbe-workspace.mjs"
},
"./resource": {

@@ -223,0 +243,0 @@ "import": "./resource.mjs",

@@ -164,2 +164,22 @@ import { XcodeInstances as GeneratedXcodeInstances, type XcodeInstance } from "./xcode-instances.mjs";

};
export type RbeUploadOptions = {
/** Upload as a named asset: the SDK mints the presigned upload URL via assets.getOrCreate. */
assetName: string;
/** Optional asset TTL as a Go duration (e.g. "24h", "30m"; "1d" is invalid), forwarded to assets.getOrCreate. */
ttl?: string;
signedUploadUrl?: never;
} | {
/** Upload to a caller-minted presigned Limrun asset storage URL. */
signedUploadUrl: string;
assetName?: never;
ttl?: never;
};
export type RbeUploadResult = {
/** The .app bundle name of the uploaded build; it is the root directory of the uploaded tar.gz. */
appName: string;
/** CFBundleIdentifier of the uploaded app, when known. */
bundleId?: string;
/** Presigned download URL of the asset; present when uploading by assetName. */
signedDownloadUrl?: string;
};
export type XcodeClient = {

@@ -210,2 +230,11 @@ /**

/**
* Upload the latest successful RBE build's app as an asset: the daemon
* packages the build's .app as a tar.gz (the same artifact format
* xcodebuild uploads produce) and pushes it to asset storage. Call after
* `bazel build --config=limrun` succeeds. The build is recorded on the
* instance asynchronously moments after bazel reports success, so the
* brief no-build window right after bazel exits is retried automatically.
*/
uploadLatestRbeBuild: (opts: RbeUploadOptions) => Promise<RbeUploadResult>;
/**
* Create a new iOS simulator instance and attach it to this xcode instance.

@@ -212,0 +241,0 @@ * Deletes the simulator if attach fails so it is never leaked. Returns the new

@@ -1,1 +0,1 @@

{"version":3,"file":"xcode-instances-helpers.d.mts","sourceRoot":"","sources":["../src/resources/xcode-instances-helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,KAAK,aAAa,EAAE,8BAA0B;AAClG,OAAO,EAAE,KAAK,WAAW,EAAE,4BAAwB;AACnD,OAAO,EAAQ,KAAK,gBAAgB,EAAoB,2BAAuB;AAC/E,OAAO,EAEL,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E,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,GAChD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAkD3D;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAezD;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;gBACtC,SAAS,EAAE,MAAM;CAQ9B;AA8CD,qBAAa,cAAe,SAAQ,uBAAuB;IACnD,YAAY,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;CA+R1E"}

@@ -164,2 +164,22 @@ import { XcodeInstances as GeneratedXcodeInstances, type XcodeInstance } from "./xcode-instances.js";

};
export type RbeUploadOptions = {
/** Upload as a named asset: the SDK mints the presigned upload URL via assets.getOrCreate. */
assetName: string;
/** Optional asset TTL as a Go duration (e.g. "24h", "30m"; "1d" is invalid), forwarded to assets.getOrCreate. */
ttl?: string;
signedUploadUrl?: never;
} | {
/** Upload to a caller-minted presigned Limrun asset storage URL. */
signedUploadUrl: string;
assetName?: never;
ttl?: never;
};
export type RbeUploadResult = {
/** The .app bundle name of the uploaded build; it is the root directory of the uploaded tar.gz. */
appName: string;
/** CFBundleIdentifier of the uploaded app, when known. */
bundleId?: string;
/** Presigned download URL of the asset; present when uploading by assetName. */
signedDownloadUrl?: string;
};
export type XcodeClient = {

@@ -210,2 +230,11 @@ /**

/**
* Upload the latest successful RBE build's app as an asset: the daemon
* packages the build's .app as a tar.gz (the same artifact format
* xcodebuild uploads produce) and pushes it to asset storage. Call after
* `bazel build --config=limrun` succeeds. The build is recorded on the
* instance asynchronously moments after bazel reports success, so the
* brief no-build window right after bazel exits is retried automatically.
*/
uploadLatestRbeBuild: (opts: RbeUploadOptions) => Promise<RbeUploadResult>;
/**
* Create a new iOS simulator instance and attach it to this xcode instance.

@@ -212,0 +241,0 @@ * Deletes the simulator if attach fails so it is never leaked. Returns the new

@@ -1,1 +0,1 @@

{"version":3,"file":"xcode-instances-helpers.d.ts","sourceRoot":"","sources":["../src/resources/xcode-instances-helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAE,KAAK,aAAa,EAAE,6BAA0B;AAClG,OAAO,EAAE,KAAK,WAAW,EAAE,2BAAwB;AACnD,OAAO,EAAQ,KAAK,gBAAgB,EAAoB,0BAAuB;AAC/E,OAAO,EAEL,KAAK,uBAAuB,EAE7B,0BAAuB;AAIxB,OAAO,EAAE,WAAW,EAAE,yBAAsB;AAE5C,OAAO,EAAkB,KAAK,MAAM,EAAE,qBAAkB;AAExD,YAAY,EAAE,MAAM,EAAE,qBAAkB;AAExC,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpE,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3C;;OAEG;IACH,eAAe,CAAC,EAAE,uBAAuB,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAA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EjC,0BAA0B;IAC1B,OAAO,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IAElC;;;;OAIG;IACH,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7D;;;;;;;OAOG;IACH,oBAAoB,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAE3E;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;IAErF,iFAAiF;IACjF,eAAe,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,GAChD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC;AAkD3D;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAezD;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;gBACtC,SAAS,EAAE,MAAM;CAQ9B;AA8CD,qBAAa,cAAe,SAAQ,uBAAuB;IACnD,YAAY,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;CA+R1E"}

@@ -18,2 +18,3 @@ "use strict";

const tunnel_1 = require("../tunnel.js");
const rbe_session_1 = require("../rbe-session.js");
/** Default local TCP port the RBE tunnel listens on. */

@@ -125,2 +126,14 @@ exports.DEFAULT_RBE_TUNNEL_PORT = 8980;

}
/**
* Mints presigned upload/download URLs for a named asset via assets.getOrCreate,
* wrapping failures with the asset name (and the original error as cause).
* Shared by the xcodebuild `--upload` path and `uploadLatestRbeBuild`.
*/
function mintAssetUploadUrls(assets, name, ttl) {
return assets.getOrCreate({ name, ...(ttl && { ttl }) }).catch((err) => {
const message = `Failed to create upload URL for asset '${name}': ${err instanceof Error ? err.message : err}`;
// @ts-ignore - not all envs have native support for cause yet
throw new Error(message, { cause: err });
});
}
class XcodeInstances extends xcode_instances_1.XcodeInstances {

@@ -273,12 +286,6 @@ async createClient(params) {

if (options?.upload && 'assetName' in options.upload) {
const uploadName = options.upload.assetName;
const requestPromise = client.assets
.getOrCreate({ name: uploadName })
.then((asset) => {
const requestPromise = mintAssetUploadUrls(client.assets, options.upload.assetName).then((asset) => {
request.signedUploadUrl = asset.signedUploadUrl;
request.additionalMetadata = { signedDownloadUrl: asset.signedDownloadUrl };
return request;
})
.catch((err) => {
throw new Error(`Failed to create upload URL for artifact '${uploadName}': ${err instanceof Error ? err.message : err}`);
});

@@ -339,2 +346,46 @@ return (0, exec_client_1.exec)(requestPromise, { apiUrl, token, log });

},
async uploadLatestRbeBuild(opts) {
let signedUploadUrl;
let signedDownloadUrl;
if (opts.assetName !== undefined) {
if (!opts.assetName) {
throw new Error('assetName must not be empty');
}
const asset = await mintAssetUploadUrls(client.assets, opts.assetName, opts.ttl);
signedUploadUrl = asset.signedUploadUrl;
signedDownloadUrl = asset.signedDownloadUrl;
}
else {
signedUploadUrl = opts.signedUploadUrl;
}
const post = async () => {
// The daemon uploads to asset storage before responding, so this
// request can go minutes without response bytes.
const res = await proxy_transport_1.nodeProxyTransport.fetchLongRequest(`${apiUrl}/rbe/upload`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ signedUploadUrl }),
});
if (res.status === 404) {
// A vanished instance and a limbuild that predates the endpoint
// 404 indistinguishably (identical bodies), and neither is the
// RbeUnsupportedError case (the daemon may well support /rbe),
// hence a plain two-cause error.
await res.text().catch(() => undefined);
throw new Error('POST /rbe/upload returned 404: the instance may no longer exist, or its limbuild ' +
'predates RBE upload support. Recreate the instance and retry.');
}
return readJsonResponse(res, 'POST /rbe/upload');
};
// Build recording is asynchronous on the daemon (it lands moments
// after bazel reports success), so the no-build 400 fired right at
// build end is as transient as a gateway blip; retry both classes.
const retryOn = (err) => (0, rbe_session_1.isTransientError)(err) ||
((0, direct_instance_errors_1.isDirectInstanceHttpError)(err, 400) && /no successful RBE app build/i.test(err.body));
const result = await (0, rbe_session_1.retryTransient)(post, { retryOn });
return { ...result, ...(signedDownloadUrl && { signedDownloadUrl }) };
},
};

@@ -341,0 +392,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"xcode-instances-helpers.js","sourceRoot":"","sources":["../src/resources/xcode-instances-helpers.ts"],"names":[],"mappings":";;;AAwTA,gDAeC;;AAvUD,oDAAoB;AACpB,wDAAwB;AACxB,4DAA4B;AAE5B,0DAAkG;AAElG,mDAA+E;AAC/E,mDAIwB;AACxB,iEAAuD;AACvD,oEAAiE;AACjE,kFAA6E;AAC7E,4CAA4C;AAC5C,yDAA0D;AAC1D,yCAAwD;AAgJxD,wDAAwD;AAC3C,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAkG5C,SAAS,YAAY,CAAC,QAAkB;IACtC,MAAM,SAAS,GAAG,CAAC,KAAe,EAAE,EAAE;QACpC,MAAM,MAAM,GAAe,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC,CAAC;IACF,OAAO,CAAC,KAA0C,EAAE,GAAW,EAAE,EAAE;QACjE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YAAE,OAAO;QAC9B,MAAM,MAAM,GAAG,iBAAiB,CAAC;QACjC,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,MAAM,EAA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Aa,EAAE,UAAU,KAAK,EAAE;qBACjC;iBACF,CAAC,CAAC;gBACH,OAAO,eAAe,CAAY,GAAG,EAAE,UAAU,CAAC,CAAC;YACrD,CAAC;YAED,KAAK,CAAC,OAAO;gBACX,MAAM,GAAG,GAAG,MAAM,oCAAkB,CAAC,KAAK,CAAC,GAAG,MAAM,MAAM,EAAE;oBAC1D,MAAM,EAAE,QAAQ;oBAChB,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,KAAK,EAAE;qBACjC;iBACF,CAAC,CAAC;gBACH,OAAO,eAAe,CAAY,GAAG,EAAE,aAAa,CAAC,CAAC;YACxD,CAAC;YAED,KAAK,CAAC,cAAc,CAAC,IAAuB;gBAC1C,OAAO,IAAA,uBAAc,EACnB,kBAAkB,CAAC,MAAM,CAAC,EAC1B,KAAK,EACL,IAAI,EAAE,IAAI,IAAI,WAAW,EACzB,IAAI,EAAE,IAAI,IAAI,+BAAuB,EACrC;oBACE,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM;iBACtD,CACF,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AAvPD,wCAuPC"}
{"version":3,"file":"xcode-instances-helpers.js","sourceRoot":"","sources":["../src/resources/xcode-instances-helpers.ts"],"names":[],"mappings":";;;AA2VA,gDAeC;;AA1WD,oDAAoB;AACpB,wDAAwB;AACxB,4DAA4B;AAE5B,0DAAkG;AAElG,mDAA+E;AAC/E,mDAIwB;AACxB,iEAAuD;AACvD,oEAAiE;AACjE,kFAAwG;AACxG,4CAA4C;AAC5C,yDAA0D;AAC1D,yCAAwD;AACxD,mDAAkE;AAgJlE,wDAAwD;AAC3C,QAAA,uBAAuB,GAAG,IAAI,CAAC;AAoI5C,SAAS,YAAY,CAAC,QAAkB;IACtC,MAAM,SAAS,GAAG,CAAC,KAAe,EAAE,EAAE;QACpC,MAAM,MAAM,GAAe,CAAC,MAAM,E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C,MAAM,IAAI,KAAK,CACb,mFAAmF;4BACjF,+DAA+D,CAClE,CAAC;oBACJ,CAAC;oBACD,OAAO,gBAAgB,CAAyC,GAAG,EAAE,kBAAkB,CAAC,CAAC;gBAC3F,CAAC,CAAC;gBAEF,kEAAkE;gBAClE,mEAAmE;gBACnE,mEAAmE;gBACnE,MAAM,OAAO,GAAG,CAAC,GAAY,EAAE,EAAE,CAC/B,IAAA,8BAAgB,EAAC,GAAG,CAAC;oBACrB,CAAC,IAAA,kDAAyB,EAAC,GAAG,EAAE,GAAG,CAAC,IAAI,8BAA8B,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;gBACzF,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAc,EAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;gBACvD,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,iBAAiB,IAAI,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;YACxE,CAAC;SACF,CAAC;IACJ,CAAC;CACF;AAhSD,wCAgSC"}

@@ -9,6 +9,7 @@ import os from 'os';

import { nodeProxyTransport } from "../internal/proxy-transport.mjs";
import { directInstanceHttpError } from "../internal/direct-instance-errors.mjs";
import { directInstanceHttpError, isDirectInstanceHttpError } from "../internal/direct-instance-errors.mjs";
import { LimrunError } from "../core/error.mjs";
import { validateBuildSettings } from "../build-settings.mjs";
import { startTcpTunnel } from "../tunnel.mjs";
import { isTransientError, retryTransient } from "../rbe-session.mjs";
/** Default local TCP port the RBE tunnel listens on. */

@@ -119,2 +120,14 @@ export const DEFAULT_RBE_TUNNEL_PORT = 8980;

}
/**
* Mints presigned upload/download URLs for a named asset via assets.getOrCreate,
* wrapping failures with the asset name (and the original error as cause).
* Shared by the xcodebuild `--upload` path and `uploadLatestRbeBuild`.
*/
function mintAssetUploadUrls(assets, name, ttl) {
return assets.getOrCreate({ name, ...(ttl && { ttl }) }).catch((err) => {
const message = `Failed to create upload URL for asset '${name}': ${err instanceof Error ? err.message : err}`;
// @ts-ignore - not all envs have native support for cause yet
throw new Error(message, { cause: err });
});
}
export class XcodeInstances extends GeneratedXcodeInstances {

@@ -267,12 +280,6 @@ async createClient(params) {

if (options?.upload && 'assetName' in options.upload) {
const uploadName = options.upload.assetName;
const requestPromise = client.assets
.getOrCreate({ name: uploadName })
.then((asset) => {
const requestPromise = mintAssetUploadUrls(client.assets, options.upload.assetName).then((asset) => {
request.signedUploadUrl = asset.signedUploadUrl;
request.additionalMetadata = { signedDownloadUrl: asset.signedDownloadUrl };
return request;
})
.catch((err) => {
throw new Error(`Failed to create upload URL for artifact '${uploadName}': ${err instanceof Error ? err.message : err}`);
});

@@ -333,2 +340,46 @@ return exec(requestPromise, { apiUrl, token, log });

},
async uploadLatestRbeBuild(opts) {
let signedUploadUrl;
let signedDownloadUrl;
if (opts.assetName !== undefined) {
if (!opts.assetName) {
throw new Error('assetName must not be empty');
}
const asset = await mintAssetUploadUrls(client.assets, opts.assetName, opts.ttl);
signedUploadUrl = asset.signedUploadUrl;
signedDownloadUrl = asset.signedDownloadUrl;
}
else {
signedUploadUrl = opts.signedUploadUrl;
}
const post = async () => {
// The daemon uploads to asset storage before responding, so this
// request can go minutes without response bytes.
const res = await nodeProxyTransport.fetchLongRequest(`${apiUrl}/rbe/upload`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ signedUploadUrl }),
});
if (res.status === 404) {
// A vanished instance and a limbuild that predates the endpoint
// 404 indistinguishably (identical bodies), and neither is the
// RbeUnsupportedError case (the daemon may well support /rbe),
// hence a plain two-cause error.
await res.text().catch(() => undefined);
throw new Error('POST /rbe/upload returned 404: the instance may no longer exist, or its limbuild ' +
'predates RBE upload support. Recreate the instance and retry.');
}
return readJsonResponse(res, 'POST /rbe/upload');
};
// Build recording is asynchronous on the daemon (it lands moments
// after bazel reports success), so the no-build 400 fired right at
// build end is as transient as a gateway blip; retry both classes.
const retryOn = (err) => isTransientError(err) ||
(isDirectInstanceHttpError(err, 400) && /no successful RBE app build/i.test(err.body));
const result = await retryTransient(post, { retryOn });
return { ...result, ...(signedDownloadUrl && { signedDownloadUrl }) };
},
};

@@ -335,0 +386,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"xcode-instances-helpers.mjs","sourceRoot":"","sources":["../src/resources/xcode-instances-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAsB,8BAA0B;AAElG,OAAO,EAAE,IAAI,EAA2C,2BAAuB;AAC/E,OAAO,EACL,UAAU,IAAI,cAAc,GAG7B,2BAAuB;AACxB,OAAO,EAAE,cAAc,EAAE,kCAA8B;AACvD,OAAO,EAAE,kBAAkB,EAAE,wCAAoC;AACjE,OAAO,EAAE,uBAAuB,EAAE,+CAA2C;AAC7E,OAAO,EAAE,WAAW,EAAE,0BAAsB;AAC5C,OAAO,EAAE,qBAAqB,EAAE,8BAA0B;AAC1D,OAAO,EAAE,cAAc,EAAe,sBAAkB;AAgJxD,wDAAwD;AACxD,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAkG5C,SAAS,YAAY,CAAC,QAAkB;IACtC,MAAM,SAAS,GAAG,CAAC,KAAe,EAAE,EAAE;QACpC,MAAM,MAAM,GAAe,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC,CAAC;IACF,OAAO,CAAC,KAA0C,EAAE,GAAW,EAAE,EAAE;QACjE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YAAE,OAAO;QAC9B,MA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AC1D,MAAM,EAAE,KAAK;oBACb,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,KAAK,EAAE;qBACjC;iBACF,CAAC,CAAC;gBACH,OAAO,eAAe,CAAY,GAAG,EAAE,UAAU,CAAC,CAAC;YACrD,CAAC;YAED,KAAK,CAAC,OAAO;gBACX,MAAM,GAAG,GAAG,MAAM,kBAAkB,CAAC,KAAK,CAAC,GAAG,MAAM,MAAM,EAAE;oBAC1D,MAAM,EAAE,QAAQ;oBAChB,OAAO,EAAE;wBACP,aAAa,EAAE,UAAU,KAAK,EAAE;qBACjC;iBACF,CAAC,CAAC;gBACH,OAAO,eAAe,CAAY,GAAG,EAAE,aAAa,CAAC,CAAC;YACxD,CAAC;YAED,KAAK,CAAC,cAAc,CAAC,IAAuB;gBAC1C,OAAO,cAAc,CACnB,kBAAkB,CAAC,MAAM,CAAC,EAC1B,KAAK,EACL,IAAI,EAAE,IAAI,IAAI,WAAW,EACzB,IAAI,EAAE,IAAI,IAAI,uBAAuB,EACrC;oBACE,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM;iBACtD,CACF,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
{"version":3,"file":"xcode-instances-helpers.mjs","sourceRoot":"","sources":["../src/resources/xcode-instances-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,cAAc,IAAI,uBAAuB,EAAsB,8BAA0B;AAElG,OAAO,EAAE,IAAI,EAA2C,2BAAuB;AAC/E,OAAO,EACL,UAAU,IAAI,cAAc,GAG7B,2BAAuB;AACxB,OAAO,EAAE,cAAc,EAAE,kCAA8B;AACvD,OAAO,EAAE,kBAAkB,EAAE,wCAAoC;AACjE,OAAO,EAAE,uBA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B;4BAClC,aAAa,EAAE,UAAU,KAAK,EAAE;yBACjC;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;qBAC1C,CAAC,CAAC;oBACH,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;wBACvB,gEAAgE;wBAChE,+DAA+D;wBAC/D,+DAA+D;wBAC/D,iCAAiC;wBACjC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;wBACxC,MAAM,IAAI,KAAK,CACb,mFAAmF;4BACjF,+DAA+D,CAClE,CAAC;oBACJ,CAAC;oBACD,OAAO,gBAAgB,CAAyC,GAAG,EAAE,kBAAkB,CAAC,CAAC;gBAC3F,CAAC,CAAC;gBAEF,kEAAkE;gBAClE,mEAAmE;gBACnE,mEAAmE;gBACnE,MAAM,OAAO,GAAG,CAAC,GAAY,EAAE,EAAE,CAC/B,gBAAgB,CAAC,GAAG,CAAC;oBACrB,CAAC,yBAAyB,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,8BAA8B,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;gBACzF,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;gBACvD,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,CAAC,iBAAiB,IAAI,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;YACxE,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}

@@ -27,2 +27,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

type RbeInstallResult,
type RbeUploadOptions,
type RbeUploadResult,
type Tunnel,

@@ -43,2 +45,23 @@ RbeUnsupportedError,

export {
LIMRUN_DIR,
TRY_IMPORT_LINE,
findBazelWorkspaceRoot,
inferBuildTarget,
detectBazelMajorVersion,
isBazel9OrLater,
renderXcodeConfigBuild,
renderLimrunBazelrc,
ensureTryImport,
writeRbeWorkspaceFiles,
type RbeWorkspaceFiles,
} from './rbe-workspace';
export {
isTransientError,
retryTransient,
waitForRbeRunning,
defaultSleep,
type Sleep,
type RunningRbeStatus,
} from './rbe-session';
export {
LimrunError,

@@ -45,0 +68,0 @@ APIError,

import { NotFoundError } from '../core/error';
/** Error thrown for non-2xx direct-instance responses, carrying the HTTP
* status and raw body so callers can match on them structurally instead of
* parsing the message. */
export type DirectInstanceHttpError = Error & { status: number; body: string };
export function directInstanceHttpError(

@@ -13,3 +18,8 @@ operation: string,

}
return new Error(message);
return Object.assign(new Error(message), { status, body: text });
}
/** Narrow an unknown error to a direct-instance HTTP error with the given status. */
export function isDirectInstanceHttpError(err: unknown, status: number): err is DirectInstanceHttpError {
return err instanceof Error && (err as Partial<DirectInstanceHttpError>).status === status;
}

@@ -9,4 +9,11 @@ import type { Agent as HttpAgent } from 'http';

// For requests whose server responds only after finishing long work (no bytes
// until then). Matches the ingress proxy-read-timeout so the client is never
// the first to give up. undici's defaults are 300s, which would abort e.g. an
// instance-side artifact upload that takes longer.
const longRequestTimeouts = { headersTimeout: 3_600_000, bodyTimeout: 3_600_000 };
class NodeProxyTransport {
private envHttpProxyAgent: EnvHttpProxyAgent | undefined;
private longRequestDispatcher: EnvHttpProxyAgent | undefined;
private websocketAgents = new Map<string, HttpAgent>();

@@ -25,2 +32,17 @@

/**
* fetch for requests that legitimately receive no response bytes for many
* minutes (the server answers only after completing long work). Plain fetch
* would abort them at undici's default 300s headersTimeout.
* EnvHttpProxyAgent covers the no-proxy case too: it routes non-proxied
* origins through an internal Agent built with these same options.
*/
fetchLongRequest: Fetch = async (input, init) => {
this.longRequestDispatcher ??= new EnvHttpProxyAgent(longRequestTimeouts);
return (fetch as any)(input, {
...(init ?? {}),
dispatcher: this.longRequestDispatcher,
});
};
getWebSocketAgent(url: string): HttpAgent | undefined {

@@ -27,0 +49,0 @@ if (!this.hasProxyEnv()) {

@@ -15,6 +15,7 @@ import os from 'os';

import { nodeProxyTransport } from '../internal/proxy-transport';
import { directInstanceHttpError } from '../internal/direct-instance-errors';
import { directInstanceHttpError, isDirectInstanceHttpError } from '../internal/direct-instance-errors';
import { LimrunError } from '../core/error';
import { validateBuildSettings } from '../build-settings';
import { startTcpTunnel, type Tunnel } from '../tunnel';
import { isTransientError, retryTransient } from '../rbe-session';

@@ -196,2 +197,26 @@ export type { Tunnel } from '../tunnel';

export type RbeUploadOptions =
| {
/** Upload as a named asset: the SDK mints the presigned upload URL via assets.getOrCreate. */
assetName: string;
/** Optional asset TTL as a Go duration (e.g. "24h", "30m"; "1d" is invalid), forwarded to assets.getOrCreate. */
ttl?: string;
signedUploadUrl?: never;
}
| {
/** Upload to a caller-minted presigned Limrun asset storage URL. */
signedUploadUrl: string;
assetName?: never;
ttl?: never;
};
export type RbeUploadResult = {
/** The .app bundle name of the uploaded build; it is the root directory of the uploaded tar.gz. */
appName: string;
/** CFBundleIdentifier of the uploaded app, when known. */
bundleId?: string;
/** Presigned download URL of the asset; present when uploading by assetName. */
signedDownloadUrl?: string;
};
export type XcodeClient = {

@@ -249,2 +274,12 @@ /**

/**
* Upload the latest successful RBE build's app as an asset: the daemon
* packages the build's .app as a tar.gz (the same artifact format
* xcodebuild uploads produce) and pushes it to asset storage. Call after
* `bazel build --config=limrun` succeeds. The build is recorded on the
* instance asynchronously moments after bazel reports success, so the
* brief no-build window right after bazel exits is retried automatically.
*/
uploadLatestRbeBuild: (opts: RbeUploadOptions) => Promise<RbeUploadResult>;
/**
* Create a new iOS simulator instance and attach it to this xcode instance.

@@ -374,2 +409,23 @@ * Deletes the simulator if attach fails so it is never leaked. Returns the new

/**
* Mints presigned upload/download URLs for a named asset via assets.getOrCreate,
* wrapping failures with the asset name (and the original error as cause).
* Shared by the xcodebuild `--upload` path and `uploadLatestRbeBuild`.
*/
function mintAssetUploadUrls(
assets: { getOrCreate: (body: { name: string; ttl?: string }) => Promise<AssetUploadUrls> },
name: string,
ttl?: string,
): Promise<AssetUploadUrls> {
return assets.getOrCreate({ name, ...(ttl && { ttl }) }).catch((err) => {
const message = `Failed to create upload URL for asset '${name}': ${
err instanceof Error ? err.message : err
}`;
// @ts-ignore - not all envs have native support for cause yet
throw new Error(message, { cause: err });
});
}
type AssetUploadUrls = { signedUploadUrl: string; signedDownloadUrl: string };
export class XcodeInstances extends GeneratedXcodeInstances {

@@ -537,17 +593,9 @@ async createClient(params: XcodeCreateClientParams): Promise<XcodeClient> {

if (options?.upload && 'assetName' in options.upload) {
const uploadName = options.upload.assetName;
const requestPromise = client.assets
.getOrCreate({ name: uploadName })
.then((asset) => {
const requestPromise = mintAssetUploadUrls(client.assets, options.upload.assetName).then(
(asset) => {
request.signedUploadUrl = asset.signedUploadUrl;
request.additionalMetadata = { signedDownloadUrl: asset.signedDownloadUrl };
return request;
})
.catch((err) => {
throw new Error(
`Failed to create upload URL for artifact '${uploadName}': ${
err instanceof Error ? err.message : err
}`,
);
});
},
);
return exec(requestPromise, { apiUrl, token, log });

@@ -621,4 +669,53 @@ }

},
async uploadLatestRbeBuild(opts: RbeUploadOptions): Promise<RbeUploadResult> {
let signedUploadUrl: string;
let signedDownloadUrl: string | undefined;
if (opts.assetName !== undefined) {
if (!opts.assetName) {
throw new Error('assetName must not be empty');
}
const asset = await mintAssetUploadUrls(client.assets, opts.assetName, opts.ttl);
signedUploadUrl = asset.signedUploadUrl;
signedDownloadUrl = asset.signedDownloadUrl;
} else {
signedUploadUrl = opts.signedUploadUrl;
}
const post = async (): Promise<{ appName: string; bundleId?: string }> => {
// The daemon uploads to asset storage before responding, so this
// request can go minutes without response bytes.
const res = await nodeProxyTransport.fetchLongRequest(`${apiUrl}/rbe/upload`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ signedUploadUrl }),
});
if (res.status === 404) {
// A vanished instance and a limbuild that predates the endpoint
// 404 indistinguishably (identical bodies), and neither is the
// RbeUnsupportedError case (the daemon may well support /rbe),
// hence a plain two-cause error.
await res.text().catch(() => undefined);
throw new Error(
'POST /rbe/upload returned 404: the instance may no longer exist, or its limbuild ' +
'predates RBE upload support. Recreate the instance and retry.',
);
}
return readJsonResponse<{ appName: string; bundleId?: string }>(res, 'POST /rbe/upload');
};
// Build recording is asynchronous on the daemon (it lands moments
// after bazel reports success), so the no-build 400 fired right at
// build end is as transient as a gateway blip; retry both classes.
const retryOn = (err: unknown) =>
isTransientError(err) ||
(isDirectInstanceHttpError(err, 400) && /no successful RBE app build/i.test(err.body));
const result = await retryTransient(post, { retryOn });
return { ...result, ...(signedDownloadUrl && { signedDownloadUrl }) };
},
};
}
}

@@ -1,1 +0,1 @@

export const VERSION = '0.34.0'; // x-release-please-version
export const VERSION = '0.35.0'; // x-release-please-version

@@ -1,2 +0,2 @@

export declare const VERSION = "0.34.0";
export declare const VERSION = "0.35.0";
//# sourceMappingURL=version.d.mts.map

@@ -1,2 +0,2 @@

export declare const VERSION = "0.34.0";
export declare const VERSION = "0.35.0";
//# sourceMappingURL=version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
exports.VERSION = '0.34.0'; // x-release-please-version
exports.VERSION = '0.35.0'; // x-release-please-version
//# sourceMappingURL=version.js.map

@@ -1,2 +0,2 @@

export const VERSION = '0.34.0'; // x-release-please-version
export const VERSION = '0.35.0'; // x-release-please-version
//# sourceMappingURL=version.mjs.map