@outerlayer/cli 0.36.0-next.20261101131017 → 0.36.0-next.20261102124202
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-setup-AOB76EDJ.js +37 -0
- package/dist/{artifact-link-cmd-W7LRR76D.js → artifact-link-cmd-ZCMQIT5Y.js} +2 -2
- package/dist/bridge-DFG2GTXQ.js +13 -0
- package/dist/build-THAD3B4Q.js +21 -0
- package/dist/build-disk-HO2VPIBJ.js +18 -0
- package/dist/build-info.json +1 -1
- package/dist/builder-AXJNIF4S.js +17 -0
- package/dist/caller-GOY2X6QT.js +20 -0
- package/dist/{check-G4TVQKN3.js → check-SF2OVZXB.js} +73 -71
- package/dist/{chunk-KB5B6ZT5.js → chunk-3FSKTGM6.js} +20 -20
- package/dist/{chunk-CONA2WNE.js → chunk-4CTVN3C5.js} +18 -11
- package/dist/{chunk-2QW2PLWT.js → chunk-4TNUQLXH.js} +8 -8
- package/dist/{chunk-LGV5N5DG.js → chunk-564Q2STF.js} +1 -1
- package/dist/{chunk-2ANBJ7DB.js → chunk-5FIOUQGC.js} +8 -8
- package/dist/{chunk-4W7CPTKY.js → chunk-5FND4PIU.js} +3 -3
- package/dist/{chunk-SQ6HDN7A.js → chunk-5GHJFETA.js} +1 -1
- package/dist/{chunk-4DJZSNVT.js → chunk-6JJITHBI.js} +1 -1
- package/dist/{chunk-6CYNPWZT.js → chunk-6LO62EQ5.js} +151 -108
- package/dist/{chunk-RIHB3HA2.js → chunk-772ILTCK.js} +3 -3
- package/dist/{chunk-CIUD3436.js → chunk-A5Y2HBVU.js} +1 -1
- package/dist/{chunk-F3ZMVUAS.js → chunk-AYLYAOHH.js} +5 -5
- package/dist/{chunk-DZDTSDHQ.js → chunk-C3JWWPLC.js} +10 -11
- package/dist/{chunk-JFMSFHER.js → chunk-CKPQOQFC.js} +644 -74
- package/dist/{chunk-ALEUIS35.js → chunk-CVGQ3BNF.js} +1 -1
- package/dist/{chunk-GDMAN42R.js → chunk-EBIYRRJW.js} +5 -5
- package/dist/{chunk-UIKUH2UQ.js → chunk-ESSJPSJ2.js} +2 -2
- package/dist/{chunk-A67A5SWG.js → chunk-EUDG754F.js} +2 -2
- package/dist/{chunk-55PYF6S2.js → chunk-FIO6PIZ6.js} +3 -3
- package/dist/{chunk-WT7J2627.js → chunk-GD6KIHOS.js} +1 -1
- package/dist/{chunk-SRENPED2.js → chunk-GDZTL6BI.js} +42 -33
- package/dist/{chunk-AF6DQJ5W.js → chunk-GSXGA6KF.js} +1 -1
- package/dist/{chunk-T3AJOPUR.js → chunk-GZ75FRLB.js} +4 -5
- package/dist/chunk-H2FFONRY.js +136 -0
- package/dist/{chunk-IM2DECLP.js → chunk-HIN4BMRW.js} +3 -3
- package/dist/{chunk-OLENS2DD.js → chunk-I626B72C.js} +29 -26
- package/dist/{chunk-YCUUZGFF.js → chunk-I6FRCBMU.js} +26 -21
- package/dist/{chunk-PN6TNCQI.js → chunk-J7TCTARR.js} +11 -12
- package/dist/chunk-J7Y3PCO2.js +653 -0
- package/dist/{chunk-YQHEJ5SV.js → chunk-JVCQZDQ6.js} +3 -3
- package/dist/{chunk-5DYL6FJA.js → chunk-JXXHLQQR.js} +3 -3
- package/dist/{chunk-VI6Z4EJZ.js → chunk-K3X3L5YW.js} +4 -4
- package/dist/{chunk-MKSZHT6S.js → chunk-KN4VIK53.js} +1 -1
- package/dist/{chunk-3LCXSD26.js → chunk-L2BA2HXM.js} +1 -1
- package/dist/chunk-L3JXQDVH.js +78 -0
- package/dist/{chunk-3ONYQMGD.js → chunk-LCOQN6NR.js} +3 -3
- package/dist/{chunk-6KHQGLNT.js → chunk-LSXHTBAM.js} +5 -5
- package/dist/{chunk-RGH5GYU2.js → chunk-LVXR37OG.js} +47 -38
- package/dist/{chunk-HGGR7Y3V.js → chunk-LYFLUNWK.js} +12 -12
- package/dist/{chunk-GANAOCHR.js → chunk-M2NIHHQI.js} +24 -374
- package/dist/chunk-NC3QAHOS.js +26 -0
- package/dist/{chunk-UFRRRF64.js → chunk-NTMRMBLM.js} +10 -5
- package/dist/{chunk-RGU6LHPI.js → chunk-NWBB2SQ4.js} +38 -35
- package/dist/{chunk-A7D5BMII.js → chunk-OYKAOHX5.js} +5 -5
- package/dist/{chunk-46YRS7QS.js → chunk-OZOATEK3.js} +4 -4
- package/dist/{chunk-3PQTOKML.js → chunk-P6PHY33P.js} +1 -1
- package/dist/{chunk-GQ7VVBUA.js → chunk-PKO5IDW4.js} +7 -7
- package/dist/{chunk-7J7HRYZ3.js → chunk-PQDFW422.js} +1 -1
- package/dist/{chunk-EZRAR5YG.js → chunk-PT34C6SU.js} +1 -1
- package/dist/{chunk-K66FIV2S.js → chunk-PTPF36Q7.js} +3 -3
- package/dist/{chunk-7Y5VW4JG.js → chunk-Q42K6XZ6.js} +1 -1
- package/dist/{chunk-VIJWXQMT.js → chunk-QJDX6VJS.js} +7 -7
- package/dist/{chunk-W46566FP.js → chunk-RK4JQRVT.js} +9 -9
- package/dist/{chunk-U553JKMO.js → chunk-RPZIHELI.js} +5 -5
- package/dist/{chunk-CIEX2ZKQ.js → chunk-RSRZDF3K.js} +6 -6
- package/dist/{chunk-46OBCATR.js → chunk-T5Z22NA6.js} +1 -1
- package/dist/{chunk-5H57X7YC.js → chunk-TPMLB3VZ.js} +1 -1
- package/dist/chunk-TWYHSMHM.js +67 -0
- package/dist/{chunk-6GA5BJTH.js → chunk-TYCZVJTB.js} +54 -31
- package/dist/{chunk-4SFHEARD.js → chunk-VRQM4A64.js} +6 -3
- package/dist/{chunk-LRCGXRQI.js → chunk-WDQPBAFV.js} +44 -19
- package/dist/{chunk-UZGQT6OF.js → chunk-WLMAGMTU.js} +5 -3
- package/dist/{chunk-KCUX5I5W.js → chunk-WNYH42PF.js} +6 -6
- package/dist/{chunk-C4YULCXX.js → chunk-WQB3XOEP.js} +28 -31
- package/dist/{chunk-VUG4IZ7H.js → chunk-WUKLQWGY.js} +1 -1
- package/dist/{chunk-MDFOS4OM.js → chunk-XABJMU5A.js} +4 -4
- package/dist/{chunk-MMXPNEEQ.js → chunk-XAOIHYPS.js} +29 -24
- package/dist/{chunk-WAZJPDR2.js → chunk-XE3DIJJT.js} +1 -1
- package/dist/{chunk-3SQZ5LIK.js → chunk-XHFSBSIA.js} +4 -4
- package/dist/{chunk-GDIVOYDA.js → chunk-XLOM2BNL.js} +3 -4
- package/dist/{claude-launcher-YV3TDXBU.js → claude-launcher-LXZPTDNC.js} +23 -18
- package/dist/{cli-EMQEIYSR.js → cli-QFUT3UQS.js} +145 -146
- package/dist/{cli-update-notice-T3CXRWNB.js → cli-update-notice-AWYJ4A7R.js} +2 -2
- package/dist/{command-GKVKI74I.js → command-45RZT4CK.js} +59 -60
- package/dist/{config-4HXUXX3M.js → config-WYQPXLOP.js} +13 -11
- package/dist/connect-cmd-LUCQ7FSV.js +26 -0
- package/dist/{container-start-OMF3ZUIB.js → container-start-T776VI3M.js} +59 -58
- package/dist/{context-cleanup-TPHCVVFV.js → context-cleanup-QE2MIO2Q.js} +5 -3
- package/dist/{context-show-cmd-MKQAAR7R.js → context-show-cmd-7QEHUOEL.js} +17 -17
- package/dist/{control-plane-launch-UWFQWMWB.js → control-plane-launch-THUH6YU5.js} +19 -19
- package/dist/{demo-record-cmd-Y57UWBCX.js → demo-record-cmd-SBERRQNW.js} +8 -5
- package/dist/{demo-voice-cmd-H4PCO2PT.js → demo-voice-cmd-VM3FITZU.js} +22 -24
- package/dist/{dist-Y3WSK7OZ.js → dist-6KGTCWKR.js} +2 -2
- package/dist/docker-MQNLK4OO.js +17 -0
- package/dist/{doctor-FEBZ3DZB.js → doctor-NQOSPJGS.js} +75 -72
- package/dist/emit-artifact-cmd-6E365VBQ.js +41 -0
- package/dist/emit-cmd-ZPFCPVSR.js +16 -0
- package/dist/emit-criteria-cmd-HWQOYZZ4.js +32 -0
- package/dist/{emit-demo-cmd-VKGN74NW.js → emit-demo-cmd-PMQGNNVX.js} +22 -24
- package/dist/{emit-finding-cmd-DNFJEYQS.js → emit-finding-cmd-MYWQN5WW.js} +17 -18
- package/dist/{emit-result-cmd-OR5WTW4P.js → emit-result-cmd-GXK3KMAP.js} +20 -21
- package/dist/{emit-step-cmd-AAEBYW3L.js → emit-step-cmd-ZV2XTUVT.js} +17 -18
- package/dist/exec-client-P7RFRUCK.js +14 -0
- package/dist/find-unit-63SXQ7IM.js +21 -0
- package/dist/{findings-cmd-LTM62M3K.js → findings-cmd-OGMBVVSM.js} +17 -18
- package/dist/fleet-readiness-4RBKLXBQ.js +27 -0
- package/dist/governing-source-XJMXFSAR.js +38 -0
- package/dist/guest-init-XZHRPIMG.js +16 -0
- package/dist/{hook-fast-3HPWMSFB.js → hook-fast-ZOWGWCPO.js} +5 -5
- package/dist/host-checks-WHW24PJR.js +76 -0
- package/dist/host-key-MWLXB5U5.js +14 -0
- package/dist/{image-tag-WBD57QBN.js → image-tag-E4JK2APF.js} +9 -4
- package/dist/index.js +4 -4
- package/dist/init-EZIAHBMH.js +76 -0
- package/dist/{init-O5H4TWA7.js → init-LO6U7YTW.js} +56 -55
- package/dist/{init-cmd-HWAXEEOD.js → init-cmd-2JANO5EN.js} +27 -28
- package/dist/{init-update-3W2TOJQV.js → init-update-D6PRTGNE.js} +55 -48
- package/dist/install-cmd-SJMBNQEH.js +17 -0
- package/dist/layout-AQHIMJMO.js +11 -0
- package/dist/{login-browser-ODTJEGDN.js → login-browser-QH4KYG3F.js} +2 -2
- package/dist/{logs-FEITSC2V.js → logs-NE55HOET.js} +8 -3
- package/dist/loop-2E34CGCX.js +87 -0
- package/dist/machine-6ALGG4IO.js +76 -0
- package/dist/{machine-skills-VRUJVBQV.js → machine-skills-KK2HXYMR.js} +3 -4
- package/dist/{mcp-install-cmd-23ZY4IBK.js → mcp-install-cmd-2QAS3AQZ.js} +5 -1
- package/dist/{mcp-serve-cmd-ZINYSLY6.js → mcp-serve-cmd-U6USKHYR.js} +9 -7
- package/dist/{paths-XEYE7OZ2.js → paths-O7LCWY33.js} +8 -3
- package/dist/pending-YU2GE2UV.js +14 -0
- package/dist/pidfile-5GDCQ5HA.js +15 -0
- package/dist/record-NETSDAO6.js +14 -0
- package/dist/{relay-IEYNSKAZ.js → relay-VZ733BVJ.js} +6 -1
- package/dist/{relay-protocol-5LSWUJCW.js → relay-protocol-24GEUGCO.js} +6 -1
- package/dist/runner-env-KHCONH2R.js +21 -0
- package/dist/runner-identity-PSCZBILD.js +17 -0
- package/dist/{runner-key-HUOW7X7B.js → runner-key-VM2LYVRK.js} +48 -50
- package/dist/{session-sender-32UAV25N.js → session-sender-P2RHDM6U.js} +21 -22
- package/dist/{spec-cmd-TPRHZ3EV.js → spec-cmd-LGKP6MT7.js} +18 -19
- package/dist/{starter-pack-7QNUT74O.js → starter-pack-SMK6UPRL.js} +6 -7
- package/dist/state-RJR4PMMX.js +14 -0
- package/dist/{status-HDJ2V5UD.js → status-HEHCNIDS.js} +48 -50
- package/dist/{sync-cmd-AHXCXMVP.js → sync-cmd-HKN45HXL.js} +20 -21
- package/dist/update-steps-7E4RD47J.js +77 -0
- package/dist/{watch-4EDI4CTS.js → watch-RGZCUCR3.js} +20 -21
- package/dist/{work-claim-cmd-GFRZBX2V.js → work-claim-cmd-6DSPGCZE.js} +24 -26
- package/dist/{work-cmd-FLKJQWGQ.js → work-cmd-GPLYLWY7.js} +17 -18
- package/dist/work-comment-cmd-V5WM7LAW.js +35 -0
- package/dist/{work-demo-cmd-FDPDTXG6.js → work-demo-cmd-SWWI6AGD.js} +17 -18
- package/dist/{work-logs-cmd-PSB44DT5.js → work-logs-cmd-CTFBOPCI.js} +17 -18
- package/dist/{work-open-pr-cmd-QJW5PNT2.js → work-open-pr-cmd-HX2U3YBR.js} +18 -19
- package/dist/{work-pr-cmd-HMGBUHGL.js → work-pr-cmd-EI2R4FQG.js} +17 -18
- package/dist/{work-proofs-cmd-3GPGH4RL.js → work-proofs-cmd-QXNPHLYC.js} +19 -20
- package/dist/{work-proofs-record-AC4GYMQA.js → work-proofs-record-72OKWEES.js} +26 -28
- package/dist/{work-stop-cmd-YO7SBPNF.js → work-stop-cmd-7M7ZYUN2.js} +17 -18
- package/package.json +2 -1
- package/dist/agent-setup-UYTS2PHZ.js +0 -33
- package/dist/bridge-XM4QLKIX.js +0 -8
- package/dist/build-IENNKWWC.js +0 -18
- package/dist/build-disk-M33Q6L22.js +0 -15
- package/dist/builder-YNMSYR75.js +0 -14
- package/dist/caller-2GU5V52U.js +0 -18
- package/dist/chunk-3DMCCCVM.js +0 -74
- package/dist/chunk-7O7LJWQO.js +0 -144
- package/dist/chunk-FGF52V4V.js +0 -137
- package/dist/chunk-HCVLP7XA.js +0 -53
- package/dist/chunk-MESOOLF4.js +0 -45
- package/dist/chunk-OHQMGLJP.js +0 -113
- package/dist/chunk-OUPQTA7N.js +0 -145
- package/dist/connect-cmd-GLB2X7YA.js +0 -27
- package/dist/docker-AFJABU7U.js +0 -14
- package/dist/emit-artifact-cmd-DGFH4MUK.js +0 -42
- package/dist/emit-cmd-HNXRGC5Z.js +0 -17
- package/dist/emit-criteria-cmd-B23VYUF6.js +0 -33
- package/dist/exec-client-FGGPQSYQ.js +0 -9
- package/dist/find-unit-4XKMNIE7.js +0 -19
- package/dist/fleet-readiness-FAKMWCJV.js +0 -28
- package/dist/governing-source-75MBT2IE.js +0 -39
- package/dist/guest-init-WPUS45IN.js +0 -11
- package/dist/host-checks-PUI32LIA.js +0 -78
- package/dist/host-key-O4DFMOSV.js +0 -9
- package/dist/init-Y672J4BW.js +0 -78
- package/dist/install-cmd-JKPXIOEY.js +0 -12
- package/dist/layout-TLUOMM6F.js +0 -11
- package/dist/loop-QJGPNIT4.js +0 -89
- package/dist/machine-YKQSW22W.js +0 -78
- package/dist/pending-D2NNV54J.js +0 -9
- package/dist/pidfile-FLFVRKVW.js +0 -10
- package/dist/record-JMZOXD4R.js +0 -9
- package/dist/runner-env-FK3SUT3Q.js +0 -19
- package/dist/runner-identity-WYAGV6UQ.js +0 -14
- package/dist/state-UWIM42JH.js +0 -9
- package/dist/update-steps-F37GQWLJ.js +0 -79
- package/dist/work-comment-cmd-3HUIIEQD.js +0 -36
- package/dist/{chunk-OLM2TIOW.js → chunk-NFZMENCY.js} +1 -1
|
@@ -1,371 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { TARGET_TUNNEL, TARGET_LEASE, destinationTarget } from './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { join, dirname } from 'path';
|
|
3
|
+
import { builtInNames, TARGET_TUNNEL, TARGET_LEASE, destinationTarget, builtInDestinations, strippedVariables, builtInEnvironment, managedAgentCredential, agentCredential, destinationPort } from './chunk-J7Y3PCO2.js';
|
|
4
|
+
import { PROVIDERS, defaultAgents } from './chunk-CKPQOQFC.js';
|
|
5
|
+
import { existsSync, unlinkSync, chmodSync } from 'fs';
|
|
7
6
|
import { request as request$1, createServer } from 'http';
|
|
8
7
|
import { request } from 'https';
|
|
9
8
|
import { createServer as createServer$1 } from 'net';
|
|
9
|
+
import { join } from 'path';
|
|
10
10
|
|
|
11
11
|
createRequire(import.meta.url);
|
|
12
|
-
var FD_STORE_ENV = "OUTERLAYER_FD_STORE";
|
|
13
|
-
var MIN_SYSTEMD = 254;
|
|
14
|
-
var LISTEN_FDS_START = 3;
|
|
15
|
-
var FD_SLOTS_PER_BUILD = 64;
|
|
16
|
-
function fdName(buildId, socket) {
|
|
17
|
-
return `ol-${buildId}-${socket}`;
|
|
18
|
-
}
|
|
19
|
-
function listenFdOf(server) {
|
|
20
|
-
const handle = server._handle;
|
|
21
|
-
return typeof handle?.fd === "number" && handle.fd >= 0 ? handle.fd : void 0;
|
|
22
|
-
}
|
|
23
|
-
function parseListenFds(env, pid) {
|
|
24
|
-
const found = /* @__PURE__ */ new Map();
|
|
25
|
-
if (env.LISTEN_PID !== String(pid)) return found;
|
|
26
|
-
const count = Number(env.LISTEN_FDS);
|
|
27
|
-
if (!Number.isInteger(count) || count <= 0) return found;
|
|
28
|
-
const names = (env.LISTEN_FDNAMES ?? "").split(":");
|
|
29
|
-
for (let index = 0; index < count; index++) {
|
|
30
|
-
const name = names[index];
|
|
31
|
-
if (name !== void 0 && name !== "" && name !== "stored") found.set(name, LISTEN_FDS_START + index);
|
|
32
|
-
}
|
|
33
|
-
return found;
|
|
34
|
-
}
|
|
35
|
-
function listenOnFd(server, fd) {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
server.once("error", reject);
|
|
38
|
-
server.listen({ fd }, () => {
|
|
39
|
-
server.off("error", reject);
|
|
40
|
-
resolve();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function run(spawnFn, command, args, fd) {
|
|
45
|
-
return new Promise((resolve) => {
|
|
46
|
-
let stdout = "";
|
|
47
|
-
let stderr = "";
|
|
48
|
-
let child;
|
|
49
|
-
try {
|
|
50
|
-
child = spawnFn(command, args, { stdio: ["ignore", "pipe", "pipe", ...fd === void 0 ? [] : [fd]] });
|
|
51
|
-
} catch (err) {
|
|
52
|
-
resolve({ status: null, stdout, stderr: err instanceof Error ? err.message : String(err) });
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
child.stdout?.on("data", (chunk) => stdout += chunk.toString("utf8"));
|
|
56
|
-
child.stderr?.on("data", (chunk) => stderr += chunk.toString("utf8"));
|
|
57
|
-
child.on("error", (err) => resolve({ status: null, stdout, stderr: err.message }));
|
|
58
|
-
child.on("close", (status) => resolve({ status, stdout, stderr }));
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function systemdVersion(ran) {
|
|
62
|
-
const match = /^systemd (\d+)/.exec(ran.stdout);
|
|
63
|
-
return ran.status === 0 && match !== null ? Number(match[1]) : void 0;
|
|
64
|
-
}
|
|
65
|
-
function realFdStorePort(options = {}) {
|
|
66
|
-
const env = options.env ?? process.env;
|
|
67
|
-
const pid = options.pid ?? process.pid;
|
|
68
|
-
const command = options.command ?? "systemd-notify";
|
|
69
|
-
const spawnFn = options.spawn ?? spawn;
|
|
70
|
-
let inherited;
|
|
71
|
-
let held2;
|
|
72
|
-
let version;
|
|
73
|
-
const inheritedNames = () => inherited ??= parseListenFds(env, pid);
|
|
74
|
-
const heldNames = () => held2 ??= new Set(inheritedNames().keys());
|
|
75
|
-
return {
|
|
76
|
-
async status() {
|
|
77
|
-
if (env.NOTIFY_SOCKET === void 0 || env.NOTIFY_SOCKET === "") return { ok: false, reason: "NOTIFY_SOCKET is not set, so this runner was not started by a service that accepts descriptors" };
|
|
78
|
-
const size = Number(env[FD_STORE_ENV]);
|
|
79
|
-
if (!Number.isInteger(size) || size <= 0) return { ok: false, reason: `${FD_STORE_ENV} is not set, so the service's unit keeps no descriptor store` };
|
|
80
|
-
version ??= run(spawnFn, command, ["--version"]).then(systemdVersion);
|
|
81
|
-
const found = await version;
|
|
82
|
-
if (found === void 0) return { ok: false, reason: `${command} could not be run, so no descriptor can be stored` };
|
|
83
|
-
if (found < MIN_SYSTEMD) return { ok: false, reason: `systemd ${found} cannot store a descriptor sent from a child process: it needs systemd ${MIN_SYSTEMD} or later` };
|
|
84
|
-
return { ok: true };
|
|
85
|
-
},
|
|
86
|
-
async push(name, server) {
|
|
87
|
-
const fd = listenFdOf(server);
|
|
88
|
-
if (fd === void 0) throw new Error(`${name} has no descriptor to store`);
|
|
89
|
-
const size = Number(env[FD_STORE_ENV]);
|
|
90
|
-
const names = heldNames();
|
|
91
|
-
if (Number.isInteger(size) && names.size >= size) {
|
|
92
|
-
throw new Error(`the descriptor store is full: it holds ${names.size} descriptors, the size the service's unit sets (FileDescriptorStoreMax=${size})`);
|
|
93
|
-
}
|
|
94
|
-
const ran = await run(spawnFn, command, [`--fd=${LISTEN_FDS_START}`, `--fdname=${name}`, "FDSTORE=1"], fd);
|
|
95
|
-
if (ran.status !== 0) throw new Error(`storing ${name} failed${ran.status === null ? "" : ` (exit ${ran.status})`}: ${ran.stderr.trim().split("\n")[0] ?? ""}`);
|
|
96
|
-
names.add(name);
|
|
97
|
-
},
|
|
98
|
-
async remove(name) {
|
|
99
|
-
const ran = await run(spawnFn, command, ["FDSTOREREMOVE=1", `FDNAME=${name}`]);
|
|
100
|
-
if (ran.status !== 0) throw new Error(`removing ${name} from the store failed${ran.status === null ? "" : ` (exit ${ran.status})`}: ${ran.stderr.trim().split("\n")[0] ?? ""}`);
|
|
101
|
-
heldNames().delete(name);
|
|
102
|
-
},
|
|
103
|
-
inherited() {
|
|
104
|
-
return inheritedNames();
|
|
105
|
-
},
|
|
106
|
-
listenOn: listenOnFd
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// src/runner/service/slice.ts
|
|
111
|
-
var BUILD_SLICE_MEMORY_ENV = "OUTERLAYER_BUILD_SLICE_MEMORY";
|
|
112
|
-
|
|
113
|
-
// src/runner/service/inspect.ts
|
|
114
|
-
var CREDENTIAL_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"];
|
|
115
|
-
function property(shown, name) {
|
|
116
|
-
return new RegExp(`^${name}=(.*)$`, "m").exec(shown)?.[1]?.trim();
|
|
117
|
-
}
|
|
118
|
-
function holdsGroup(status, gid) {
|
|
119
|
-
const primary = /^Gid:\s+(\d+)/m.exec(status)?.[1];
|
|
120
|
-
const supplementary = /^Groups:[ \t]*(.*)$/m.exec(status)?.[1]?.trim().split(/\s+/).filter((g) => g !== "") ?? [];
|
|
121
|
-
return [primary, ...supplementary].some((g) => g !== void 0 && Number(g) === gid);
|
|
122
|
-
}
|
|
123
|
-
function parseRunnerEnv(text) {
|
|
124
|
-
const env = {};
|
|
125
|
-
for (const line of text.split("\n")) {
|
|
126
|
-
const match = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/.exec(line);
|
|
127
|
-
if (match === null) continue;
|
|
128
|
-
env[match[1]] = match[2].trim().replace(/^(["'])(.*)\1$/, "$2");
|
|
129
|
-
}
|
|
130
|
-
return env;
|
|
131
|
-
}
|
|
132
|
-
function credentialNames(env) {
|
|
133
|
-
const set = parseRunnerEnv(env ?? "");
|
|
134
|
-
return CREDENTIAL_VARIABLES.filter((name) => (set[name] ?? "").trim() !== "");
|
|
135
|
-
}
|
|
136
|
-
function startedWithStore(environ) {
|
|
137
|
-
const vars = new Map(environ.split("\0").map((entry) => [entry.slice(0, entry.indexOf("=")), entry.slice(entry.indexOf("=") + 1)]));
|
|
138
|
-
return (vars.get("NOTIFY_SOCKET") ?? "") !== "" && Number(vars.get(FD_STORE_ENV)) > 0;
|
|
139
|
-
}
|
|
140
|
-
function inspectService(unit, configDir, probes) {
|
|
141
|
-
const shown = probes.show(unit);
|
|
142
|
-
if (shown === void 0 || property(shown, "LoadState") !== "loaded") return void 0;
|
|
143
|
-
const pid = Number(property(shown, "MainPID") ?? "0");
|
|
144
|
-
const mainPid = Number.isInteger(pid) && pid > 0 ? pid : void 0;
|
|
145
|
-
const delegate = property(shown, "Delegate");
|
|
146
|
-
const storeMax = Number(property(shown, "FileDescriptorStoreMax"));
|
|
147
|
-
const status = mainPid === void 0 ? void 0 : probes.readFile(`/proc/${mainPid}/status`);
|
|
148
|
-
const environ = mainPid === void 0 ? void 0 : probes.readFile(`/proc/${mainPid}/environ`);
|
|
149
|
-
const systemd = Number(/^systemd (\d+)/.exec(probes.systemctlVersion?.() ?? "")?.[1]);
|
|
150
|
-
const kvm = probes.kvmGid();
|
|
151
|
-
const sliceMemory = Number(new RegExp(`(?:^|\\s)${BUILD_SLICE_MEMORY_ENV}=(\\d+)(?:\\s|$)`).exec(property(shown, "Environment") ?? "")?.[1]);
|
|
152
|
-
return {
|
|
153
|
-
unit,
|
|
154
|
-
...Number.isSafeInteger(sliceMemory) && sliceMemory > 0 ? { buildSliceMemory: sliceMemory } : {},
|
|
155
|
-
mainPid,
|
|
156
|
-
delegate: delegate === void 0 ? void 0 : delegate !== "no",
|
|
157
|
-
...Number.isInteger(storeMax) && property(shown, "FileDescriptorStoreMax") !== void 0 ? { fdStoreMax: storeMax } : {},
|
|
158
|
-
hasKvmGroup: status === void 0 || kvm === void 0 ? void 0 : holdsGroup(status, kvm),
|
|
159
|
-
...environ === void 0 ? {} : { startedWithStore: startedWithStore(environ) },
|
|
160
|
-
...systemd > 0 ? { systemdVersion: systemd } : {},
|
|
161
|
-
// `claude.env` first, where the service loads the credential from; `runner.env` holds one that was never moved.
|
|
162
|
-
credentialVariables: [.../* @__PURE__ */ new Set([...credentialNames(probes.readFile(join(configDir, "claude.env"))), ...credentialNames(probes.readFile(join(configDir, "runner.env")))])]
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function realInspectProbes() {
|
|
166
|
-
return {
|
|
167
|
-
show: (unit) => {
|
|
168
|
-
const result = spawnSync("systemctl", ["show", "--property=LoadState,MainPID,Delegate,FileDescriptorStoreMax,Environment", unit], { encoding: "utf8", timeout: 1e4 });
|
|
169
|
-
return result.status === 0 ? result.stdout : void 0;
|
|
170
|
-
},
|
|
171
|
-
readFile: (path) => {
|
|
172
|
-
try {
|
|
173
|
-
return readFileSync(path, "utf8");
|
|
174
|
-
} catch {
|
|
175
|
-
return void 0;
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
systemctlVersion: () => {
|
|
179
|
-
const result = spawnSync("systemctl", ["--version"], { encoding: "utf8", timeout: 1e4 });
|
|
180
|
-
return result.status === 0 ? result.stdout : void 0;
|
|
181
|
-
},
|
|
182
|
-
kvmGid: () => {
|
|
183
|
-
try {
|
|
184
|
-
return statSync("/dev/kvm").gid;
|
|
185
|
-
} catch {
|
|
186
|
-
return void 0;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
var CLAUDE_CREDENTIAL_ID = "claude";
|
|
192
|
-
var CLAUDE_ENV_FILE = "claude.env";
|
|
193
|
-
function claudeEnvPath(configPath) {
|
|
194
|
-
return join(dirname(configPath), CLAUDE_ENV_FILE);
|
|
195
|
-
}
|
|
196
|
-
var CLAUDE_CREDENTIAL_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN"];
|
|
197
|
-
var FORWARDED_CLAUDE_CREDENTIAL_VARIABLES = ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"];
|
|
198
|
-
var FORWARDED = FORWARDED_CLAUDE_CREDENTIAL_VARIABLES;
|
|
199
|
-
function firstOf(values, source) {
|
|
200
|
-
for (const variable of FORWARDED) {
|
|
201
|
-
const value = values[variable];
|
|
202
|
-
if (value !== void 0 && value !== "") return { variable, value, source };
|
|
203
|
-
}
|
|
204
|
-
return void 0;
|
|
205
|
-
}
|
|
206
|
-
function readClaudeCredential(env) {
|
|
207
|
-
const fromEnvironment = firstOf(env, "environment");
|
|
208
|
-
if (fromEnvironment !== void 0) return fromEnvironment;
|
|
209
|
-
const directory = env.CREDENTIALS_DIRECTORY;
|
|
210
|
-
if (directory === void 0 || directory === "") return void 0;
|
|
211
|
-
const path = join(directory, CLAUDE_CREDENTIAL_ID);
|
|
212
|
-
try {
|
|
213
|
-
const text = readFileSync(path, "utf8");
|
|
214
|
-
const found = firstOf(parseRunnerEnv(text), "credentials-directory");
|
|
215
|
-
if (found === void 0 && text.trim() !== "") complain(path, "it sets neither CLAUDE_CODE_OAUTH_TOKEN nor ANTHROPIC_API_KEY, each as NAME=value");
|
|
216
|
-
return found;
|
|
217
|
-
} catch (err) {
|
|
218
|
-
if (err.code !== "ENOENT") complain(path, `it could not be read (${err instanceof Error ? err.message : String(err)})`);
|
|
219
|
-
return void 0;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
function claudeCredentialVariablesSet(env, options = {}) {
|
|
223
|
-
const found = /* @__PURE__ */ new Set();
|
|
224
|
-
const add = (values) => {
|
|
225
|
-
for (const variable of FORWARDED) if ((values[variable] ?? "") !== "") found.add(variable);
|
|
226
|
-
};
|
|
227
|
-
add(env);
|
|
228
|
-
const directory = env.CREDENTIALS_DIRECTORY;
|
|
229
|
-
if (directory) {
|
|
230
|
-
try {
|
|
231
|
-
add(parseRunnerEnv(readFileSync(join(directory, CLAUDE_CREDENTIAL_ID), "utf8")));
|
|
232
|
-
} catch {
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
if (options.ignoreHeld !== true && held !== void 0) found.add(held.variable);
|
|
236
|
-
return found;
|
|
237
|
-
}
|
|
238
|
-
var complained = /* @__PURE__ */ new Set();
|
|
239
|
-
function complain(path, reason) {
|
|
240
|
-
if (complained.has(path)) return;
|
|
241
|
-
complained.add(path);
|
|
242
|
-
process.stderr.write(`the Claude credential file ${path} holds no usable credential: ${reason}
|
|
243
|
-
`);
|
|
244
|
-
}
|
|
245
|
-
var held;
|
|
246
|
-
var removedValues = /* @__PURE__ */ new Set();
|
|
247
|
-
function holdClaudeCredential(env = process.env) {
|
|
248
|
-
held ??= readClaudeCredential(env);
|
|
249
|
-
for (const name of CLAUDE_CREDENTIAL_VARIABLES) {
|
|
250
|
-
const value = env[name];
|
|
251
|
-
if (value !== void 0 && value !== "") removedValues.add(value);
|
|
252
|
-
delete env[name];
|
|
253
|
-
}
|
|
254
|
-
return held;
|
|
255
|
-
}
|
|
256
|
-
function takeClaudeCredential(env, hooks) {
|
|
257
|
-
return /^builtin:(container|process|vm)$/.test(hooks.provision) ? holdClaudeCredential(env) : void 0;
|
|
258
|
-
}
|
|
259
|
-
function removedClaudeCredentialValues() {
|
|
260
|
-
return [...removedValues];
|
|
261
|
-
}
|
|
262
|
-
function heldClaudeCredential() {
|
|
263
|
-
return held;
|
|
264
|
-
}
|
|
265
|
-
function currentClaudeCredential(env) {
|
|
266
|
-
return held ?? readClaudeCredential(env);
|
|
267
|
-
}
|
|
268
|
-
var SETS = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=/;
|
|
269
|
-
function credentialLineIn(text) {
|
|
270
|
-
const set = parseRunnerEnv(text);
|
|
271
|
-
const lines = text.split("\n");
|
|
272
|
-
for (const variable of FORWARDED) {
|
|
273
|
-
if ((set[variable] ?? "") === "") continue;
|
|
274
|
-
const line = lines.find((candidate) => (parseRunnerEnv(candidate)[variable] ?? "") !== "");
|
|
275
|
-
return line.replace(/^\s*(?:export\s+)?/, "").trimEnd();
|
|
276
|
-
}
|
|
277
|
-
return void 0;
|
|
278
|
-
}
|
|
279
|
-
function withoutCredentialLines(text) {
|
|
280
|
-
const lines = text.split("\n");
|
|
281
|
-
const kept = lines.filter((line) => !CLAUDE_CREDENTIAL_VARIABLES.includes(SETS.exec(line)?.[1] ?? ""));
|
|
282
|
-
if (kept.length === lines.length) return void 0;
|
|
283
|
-
while (kept[kept.length - 1] === "") kept.pop();
|
|
284
|
-
return kept.length === 0 ? "" : `${kept.join("\n")}
|
|
285
|
-
`;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// src/runner/builtin-destinations.ts
|
|
289
|
-
var GATEWAY_DESTINATION = "gateway";
|
|
290
|
-
var CLAUDE_DESTINATION = "claude";
|
|
291
|
-
var BUILT_IN_NAMES = [GATEWAY_DESTINATION, CLAUDE_DESTINATION];
|
|
292
|
-
var GATEWAY_PORT = 3126;
|
|
293
|
-
var CLAUDE_PORT = 3127;
|
|
294
|
-
var GATEWAY_SOCKET = "gateway.sock";
|
|
295
|
-
var CLAUDE_SOCKET = "claude.sock";
|
|
296
|
-
var CLAUDE_UPSTREAM = "https://api.anthropic.com/";
|
|
297
|
-
var AGENT_CREDENTIAL_MISSING = "agent_credential_missing";
|
|
298
|
-
var OAUTH_PLACEHOLDER = "sk-ant-oat01-placeholder-not-a-real-token";
|
|
299
|
-
var API_KEY_PLACEHOLDER = "sk-ant-api03-placeholder-not-a-real-key";
|
|
300
|
-
var ITEM_KEY_PLACEHOLDER = "olitem_placeholder-not-a-real-key";
|
|
301
|
-
var ITEM_KEY_VARIABLE = "OUTERLAYER_ITEM_KEY";
|
|
302
|
-
function claudeCredential(hostEnv, options = {}) {
|
|
303
|
-
const credential = options.ignoreHeld === true ? readClaudeCredential(hostEnv) : currentClaudeCredential(hostEnv);
|
|
304
|
-
if (credential === void 0) return void 0;
|
|
305
|
-
return { variable: credential.variable, placeholder: credential.variable === "CLAUDE_CODE_OAUTH_TOKEN" ? OAUTH_PLACEHOLDER : API_KEY_PLACEHOLDER };
|
|
306
|
-
}
|
|
307
|
-
function managedClaudeCredential() {
|
|
308
|
-
return { variable: "ANTHROPIC_API_KEY", placeholder: API_KEY_PLACEHOLDER };
|
|
309
|
-
}
|
|
310
|
-
function gatewayUpstream(gatewayUrl) {
|
|
311
|
-
return `${new URL(gatewayUrl).origin}/`;
|
|
312
|
-
}
|
|
313
|
-
function forwardedEnvironment(hostEnv) {
|
|
314
|
-
const env = {};
|
|
315
|
-
for (const name of ["CLAUDE_CODE_OAUTH_TOKEN", "ANTHROPIC_API_KEY"]) {
|
|
316
|
-
Object.defineProperty(env, name, {
|
|
317
|
-
enumerable: true,
|
|
318
|
-
get: () => {
|
|
319
|
-
const current = currentClaudeCredential(hostEnv);
|
|
320
|
-
return current !== void 0 && current.variable === name ? current.value : hostEnv[name];
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
return env;
|
|
325
|
-
}
|
|
326
|
-
function builtInDestinations(input) {
|
|
327
|
-
const managedKey = input.claudeApiKey !== void 0 && input.claudeApiKey !== "";
|
|
328
|
-
const credential = managedKey ? void 0 : claudeCredential(input.hostEnv);
|
|
329
|
-
const apiKeyMode = managedKey || credential?.variable === "ANTHROPIC_API_KEY";
|
|
330
|
-
return [
|
|
331
|
-
{
|
|
332
|
-
destination: {
|
|
333
|
-
name: GATEWAY_DESTINATION,
|
|
334
|
-
upstream: gatewayUpstream(input.gatewayUrl),
|
|
335
|
-
header: { name: "Authorization", value: `Bearer \${${ITEM_KEY_VARIABLE}}`, variables: [ITEM_KEY_VARIABLE] },
|
|
336
|
-
env: {}
|
|
337
|
-
},
|
|
338
|
-
hostEnv: input.itemKey === void 0 ? {} : { [ITEM_KEY_VARIABLE]: input.itemKey },
|
|
339
|
-
drop: [],
|
|
340
|
-
socket: GATEWAY_SOCKET
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
destination: {
|
|
344
|
-
name: CLAUDE_DESTINATION,
|
|
345
|
-
upstream: input.claudeUpstream ?? CLAUDE_UPSTREAM,
|
|
346
|
-
header: apiKeyMode ? { name: "x-api-key", value: "${ANTHROPIC_API_KEY}", variables: ["ANTHROPIC_API_KEY"] } : { name: "Authorization", value: "Bearer ${CLAUDE_CODE_OAUTH_TOKEN}", variables: ["CLAUDE_CODE_OAUTH_TOKEN"] },
|
|
347
|
-
env: {}
|
|
348
|
-
},
|
|
349
|
-
hostEnv: managedKey ? { ANTHROPIC_API_KEY: input.claudeApiKey } : forwardedEnvironment(input.hostEnv),
|
|
350
|
-
// A build's own key in either header would sit beside the runner's, and the upstream takes one of them.
|
|
351
|
-
drop: ["x-api-key", "authorization"],
|
|
352
|
-
socket: CLAUDE_SOCKET
|
|
353
|
-
}
|
|
354
|
-
];
|
|
355
|
-
}
|
|
356
|
-
function builtInEnvironment(localFor, credential) {
|
|
357
|
-
return {
|
|
358
|
-
OUTERLAYER_URL: localFor(GATEWAY_DESTINATION),
|
|
359
|
-
OUTERLAYER_API_KEY: ITEM_KEY_PLACEHOLDER,
|
|
360
|
-
ANTHROPIC_BASE_URL: localFor(CLAUDE_DESTINATION),
|
|
361
|
-
...credential === void 0 ? {} : { [credential.variable]: credential.placeholder },
|
|
362
|
-
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1"
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// src/runner/destinations.ts
|
|
367
12
|
var MAX_RELEASED_DESTINATIONS = 20;
|
|
368
|
-
|
|
13
|
+
function maxDestinations(agents = defaultAgents(), providers = PROVIDERS) {
|
|
14
|
+
return MAX_RELEASED_DESTINATIONS - builtInNames(agents, providers).length;
|
|
15
|
+
}
|
|
369
16
|
var DESTINATION_BASE_PORT = 3129;
|
|
370
17
|
var DESTINATION_NAME = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
371
18
|
var VARIABLE_NAME = /^[A-Za-z_][A-Za-z0-9_]{0,254}$/;
|
|
@@ -377,12 +24,14 @@ var UPSTREAM_IDLE_MS = 6e5;
|
|
|
377
24
|
function headerVariables(destinations) {
|
|
378
25
|
return [...new Set((destinations ?? []).flatMap((d) => d.header.variables))];
|
|
379
26
|
}
|
|
380
|
-
function resolveDestinations(given, variables, isReserved, fail) {
|
|
27
|
+
function resolveDestinations(given, variables, isReserved, fail, agents = defaultAgents(), providers = PROVIDERS) {
|
|
381
28
|
if (!Array.isArray(given)) fail("runner.build.destinations", "must be a list of destinations");
|
|
382
|
-
|
|
29
|
+
const builtIns = builtInNames(agents, providers);
|
|
30
|
+
const most = maxDestinations(agents, providers);
|
|
31
|
+
if (given.length > most) {
|
|
383
32
|
fail(
|
|
384
33
|
"runner.build.destinations",
|
|
385
|
-
`lists ${given.length} destinations; a release records at most ${MAX_RELEASED_DESTINATIONS}, and ${
|
|
34
|
+
`lists ${given.length} destinations; a release records at most ${MAX_RELEASED_DESTINATIONS}, and ${builtIns.length} of those are the built-in ${builtIns.join(" and ")} destinations, so a host lists at most ${most}`
|
|
386
35
|
);
|
|
387
36
|
}
|
|
388
37
|
const resolved = [];
|
|
@@ -401,7 +50,7 @@ function resolveDestinations(given, variables, isReserved, fail) {
|
|
|
401
50
|
if (typeof name !== "string" || !DESTINATION_NAME.test(name)) {
|
|
402
51
|
fail(`${at}.name`, "must be 1 to 63 lower-case letters, digits or hyphens, starting with a letter or digit");
|
|
403
52
|
}
|
|
404
|
-
if (
|
|
53
|
+
if (builtIns.includes(name)) fail(`${at}.name`, `is ${name}, a destination the runner serves itself`);
|
|
405
54
|
if (names.has(name)) fail(`${at}.name`, `repeats the destination ${name}`);
|
|
406
55
|
names.add(name);
|
|
407
56
|
const upstream = parseUpstream(record.upstream, `${at}.upstream`, fail);
|
|
@@ -655,7 +304,7 @@ async function startBuildServices(input) {
|
|
|
655
304
|
targets.set(destinationTarget(index), (stream) => server.acceptStream(stream));
|
|
656
305
|
if (server.port !== void 0) destinationPorts.push(server.port);
|
|
657
306
|
}
|
|
658
|
-
const builtIns = input.builtIns === void 0 ? [] : builtInDestinations({
|
|
307
|
+
const builtIns = input.builtIns === void 0 ? [] : builtInDestinations({ ...input.builtIns, hostEnv: input.hostEnv }, input.builtIns.agents, input.builtIns.providers);
|
|
659
308
|
for (const builtIn of builtIns) {
|
|
660
309
|
const server = await startDestination({
|
|
661
310
|
destination: builtIn.destination,
|
|
@@ -863,8 +512,8 @@ function runnerLiterals(repository, repositories = [], unpinnedRuntimes, missing
|
|
|
863
512
|
...missingSetupScripts === void 0 || missingSetupScripts.length === 0 ? {} : { OUTERLAYER_MISSING_SETUP_SCRIPTS: JSON.stringify(missingSetupScripts) }
|
|
864
513
|
};
|
|
865
514
|
}
|
|
866
|
-
function containerBuiltInAddress(name) {
|
|
867
|
-
return `http://127.0.0.1:${name
|
|
515
|
+
function containerBuiltInAddress(name, agents) {
|
|
516
|
+
return `http://127.0.0.1:${destinationPort(name, agents)}`;
|
|
868
517
|
}
|
|
869
518
|
function reservedNames() {
|
|
870
519
|
return /* @__PURE__ */ new Set([
|
|
@@ -881,8 +530,8 @@ function isReservedVariable(name) {
|
|
|
881
530
|
function isRefusedInConfig(name) {
|
|
882
531
|
return isReservedVariable(name) && !githubVariables().has(name);
|
|
883
532
|
}
|
|
884
|
-
function isMiseVariableAllowed(name) {
|
|
885
|
-
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name) && !isReservedVariable(name) && !
|
|
533
|
+
function isMiseVariableAllowed(name, agents) {
|
|
534
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name) && !isReservedVariable(name) && !strippedVariables(agents).includes(name);
|
|
886
535
|
}
|
|
887
536
|
function withMiseVariables(env, variables) {
|
|
888
537
|
if (variables === void 0) return env;
|
|
@@ -906,6 +555,7 @@ function buildEnvironment(input) {
|
|
|
906
555
|
if (!isReservedVariable(name) && !(name in authored)) recipe[name] = value;
|
|
907
556
|
}
|
|
908
557
|
const builtIns = input.builtIns === true;
|
|
558
|
+
const credentialVariables = strippedVariables(input.agents);
|
|
909
559
|
const passed = {
|
|
910
560
|
...builtIns ? {} : { OUTERLAYER_URL: input.config.url },
|
|
911
561
|
...builtIns || input.itemKey === void 0 ? {} : { OUTERLAYER_API_KEY: input.itemKey },
|
|
@@ -918,7 +568,7 @@ function buildEnvironment(input) {
|
|
|
918
568
|
if (input.factoryVariables !== void 0) {
|
|
919
569
|
for (const { name, value } of input.factoryVariables) {
|
|
920
570
|
if (isReservedVariable(name) || name in authored) continue;
|
|
921
|
-
if (builtIns &&
|
|
571
|
+
if (builtIns && credentialVariables.includes(name)) continue;
|
|
922
572
|
passed[name] = value;
|
|
923
573
|
variables.push(name);
|
|
924
574
|
}
|
|
@@ -931,13 +581,13 @@ function buildEnvironment(input) {
|
|
|
931
581
|
}
|
|
932
582
|
const value = input.hostEnv[name];
|
|
933
583
|
if (value === void 0 || isReservedVariable(name) || name in authored) continue;
|
|
934
|
-
if (builtIns &&
|
|
584
|
+
if (builtIns && credentialVariables.includes(name)) continue;
|
|
935
585
|
passed[name] = value;
|
|
936
586
|
variables.push(name);
|
|
937
587
|
}
|
|
938
588
|
}
|
|
939
589
|
const destinations = destinationEnvironment(input.config.build?.destinations, containerLocalAddress);
|
|
940
|
-
const builtInLiterals = builtIns ? builtInEnvironment(containerBuiltInAddress, input.config.managed === true ?
|
|
590
|
+
const builtInLiterals = builtIns ? builtInEnvironment((name) => containerBuiltInAddress(name, input.agents), input.config.managed === true ? managedAgentCredential(input.agents) : agentCredential(input.hostEnv, {}, input.agents), input.agents) : {};
|
|
941
591
|
const hooksPath = input.identity?.hooksPath;
|
|
942
592
|
const hooks = {};
|
|
943
593
|
if (hooksPath !== void 0) {
|
|
@@ -978,7 +628,7 @@ function checkEnvironment(input) {
|
|
|
978
628
|
builtIns: false,
|
|
979
629
|
factoryVariables: input.factoryVariables
|
|
980
630
|
});
|
|
981
|
-
const withheld = /* @__PURE__ */ new Set(["OUTERLAYER_URL", "OUTERLAYER_API_KEY", ...
|
|
631
|
+
const withheld = /* @__PURE__ */ new Set(["OUTERLAYER_URL", "OUTERLAYER_API_KEY", ...strippedVariables()]);
|
|
982
632
|
const literals = { OUTERLAYER_EVAL_INPUT: EVAL_INPUT_DIR, OUTERLAYER_CHECK_ITEMS: CHECK_ITEMS_FILE };
|
|
983
633
|
for (const [name, value] of Object.entries(env.literals)) if (!withheld.has(name)) literals[name] = value;
|
|
984
634
|
const passed = {};
|
|
@@ -1026,4 +676,4 @@ function routesOf(counts) {
|
|
|
1026
676
|
return routes.length === 0 ? {} : { routes };
|
|
1027
677
|
}
|
|
1028
678
|
|
|
1029
|
-
export {
|
|
679
|
+
export { BUILD_HOME, CHECKOUT_DIR, CHECK_ITEMS_FILE, DESTINATION_BASE_PORT, EVAL_INPUT_DIR, JOB_MOUNT, PROXY_WARNING_FLAG, RELAY_PORT, SCRUB_ENV_VARIABLE, authorEnvironment, buildEnvironment, checkEnvironment, checkoutPath, commitIdentityRecord, containerLocalAddress, destinationEnvironment, headerVariables, isMiseVariableAllowed, isRefusedInConfig, isReservedVariable, lifecycleWorkdir, parseClaimIdentity, parseClaimedRepositories, parseIsolation, parseUnreachable, primaryOf, proxyEnvironment, repositoriesOf, repositoryPath, resolveDestinations, sharedUserEnvironment, startBuildServices, tokenHeader, withGitConfig, withHooksPath, withMiseVariables, withProxyWarningHidden, withTokenHeader, withTunnelRecord };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
|
|
4
|
+
createRequire(import.meta.url);
|
|
5
|
+
|
|
6
|
+
// src/control-plane-paths.ts
|
|
7
|
+
var CONTROL_PLANE_DIR_VARIABLE = "OUTERLAYER_CONTROL_PLANE_DIR";
|
|
8
|
+
var GOVERNANCE_VARIABLE = "OUTERLAYER_GOVERNANCE";
|
|
9
|
+
var SUPPORTED_CONTROL_PLANE_LAYOUT = 2;
|
|
10
|
+
var MINIMUM_CLAUDE_VERSION = "2.1.284";
|
|
11
|
+
function versionParts(text) {
|
|
12
|
+
const found = /(\d+)\.(\d+)\.(\d+)/.exec(text);
|
|
13
|
+
return found === null ? void 0 : [Number(found[1]), Number(found[2]), Number(found[3])];
|
|
14
|
+
}
|
|
15
|
+
function versionAtLeast(text, minimum = MINIMUM_CLAUDE_VERSION) {
|
|
16
|
+
const have = versionParts(text);
|
|
17
|
+
const need = versionParts(minimum);
|
|
18
|
+
if (have === void 0 || need === void 0) return false;
|
|
19
|
+
const difference = have.map((part, i) => part - need[i]).find((delta) => delta !== 0);
|
|
20
|
+
return (difference ?? 0) >= 0;
|
|
21
|
+
}
|
|
22
|
+
var SHIM_SCRIPT = `#!/bin/sh
|
|
23
|
+
exec outerlayer claude "$@"
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
export { CONTROL_PLANE_DIR_VARIABLE, GOVERNANCE_VARIABLE, MINIMUM_CLAUDE_VERSION, SHIM_SCRIPT, SUPPORTED_CONTROL_PLANE_LAYOUT, versionAtLeast };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-
|
|
4
|
-
import { parseSize } from './chunk-
|
|
5
|
-
import {
|
|
3
|
+
import { DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-ESSJPSJ2.js';
|
|
4
|
+
import { parseSize } from './chunk-C3JWWPLC.js';
|
|
5
|
+
import { isRefusedInConfig, resolveDestinations, isReservedVariable } from './chunk-M2NIHHQI.js';
|
|
6
|
+
import { builderDiskPinned } from './chunk-J7Y3PCO2.js';
|
|
6
7
|
import { homeFromEnv } from './chunk-352DHUTP.js';
|
|
7
|
-
import { isRefusedInConfig, resolveDestinations, isReservedVariable } from './chunk-GANAOCHR.js';
|
|
8
8
|
import { existsSync, statSync, accessSync, constants, readFileSync } from 'fs';
|
|
9
9
|
import { hostname } from 'os';
|
|
10
10
|
import { join } from 'path';
|
|
@@ -112,6 +112,11 @@ function isBuiltinVm(hook) {
|
|
|
112
112
|
function builtinKind(hook) {
|
|
113
113
|
return isBuiltinContainer(hook) ? "container" : isBuiltinProcess(hook) ? "process" : isBuiltinVm(hook) ? "vm" : "own";
|
|
114
114
|
}
|
|
115
|
+
function runnerDeliversComments(config) {
|
|
116
|
+
if (config.deliverComments === false) return false;
|
|
117
|
+
const kind = builtinKind(config.hooks.provision);
|
|
118
|
+
return kind === "container" || kind === "vm";
|
|
119
|
+
}
|
|
115
120
|
var RUNNER_QUEUES = ["implement", "amend"];
|
|
116
121
|
var RunnerConfigError = class extends Error {
|
|
117
122
|
};
|
|
@@ -588,4 +593,4 @@ function egressLimitsOf(config) {
|
|
|
588
593
|
return resolveEgress(config.build?.egress, config.managed === true);
|
|
589
594
|
}
|
|
590
595
|
|
|
591
|
-
export { DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SAVED_STATE_MAX_BYTES, DEFAULT_SETUP_MINUTES, DEFAULT_UPDATE_MAX_WAIT_HOURS, EGRESS_SWITCHABLE_KEYS, MAX_ALLOW_HOSTS, RunnerConfigError, allowHostProblem, builtinKind, checkHooks, defaultRunnerConfigPath, egressSummary, emptyEgressCounts, hasRunnerBlock, hostAllowed, imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, keepsHostBuilder, keyRunnerFactory, loadRunnerConfig, optionalEgress, resolveBuild, resolveHousekeeping, runnerCredentialProblem, runnerVmOf, systemClock };
|
|
596
|
+
export { DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SAVED_STATE_MAX_BYTES, DEFAULT_SETUP_MINUTES, DEFAULT_UPDATE_MAX_WAIT_HOURS, EGRESS_SWITCHABLE_KEYS, MAX_ALLOW_HOSTS, RunnerConfigError, allowHostProblem, builtinKind, checkHooks, defaultRunnerConfigPath, egressSummary, emptyEgressCounts, hasRunnerBlock, hostAllowed, imageBuildOf, isBuiltinContainer, isBuiltinProcess, isBuiltinVm, keepsHostBuilder, keyRunnerFactory, loadRunnerConfig, optionalEgress, resolveBuild, resolveHousekeeping, runnerCredentialProblem, runnerDeliversComments, runnerVmOf, systemClock };
|