@outerlayer/cli 0.36.0-next.20261103003101 → 0.36.0-next.20261103032948

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.
Files changed (124) hide show
  1. package/README.md +6 -1
  2. package/dist/{agent-setup-7WC4BHY4.js → agent-setup-PCMTLHTT.js} +7 -7
  3. package/dist/{agent-subcommand-LABZ7CVN.js → agent-subcommand-DZWYGCPN.js} +1 -1
  4. package/dist/{bridge-WVWJBVTG.js → bridge-RY2CLUYP.js} +2 -2
  5. package/dist/{build-TB4QKVBG.js → build-CV6IUJWD.js} +7 -7
  6. package/dist/{build-disk-27ZTD2EH.js → build-disk-ITPCE4ME.js} +5 -5
  7. package/dist/build-info.json +1 -1
  8. package/dist/{builder-DN2S6EVU.js → builder-TP6RBPGB.js} +4 -4
  9. package/dist/{caller-ZDANV7YK.js → caller-6X73FHOM.js} +7 -7
  10. package/dist/{check-ACHEHGYH.js → check-HJ3CKWDZ.js} +38 -38
  11. package/dist/{chunk-AXOO6FNA.js → chunk-3IEVIKMC.js} +3 -3
  12. package/dist/{chunk-JAFSDXK7.js → chunk-4EJH2EE4.js} +26 -26
  13. package/dist/{chunk-NTOHZMPN.js → chunk-55RNQFPE.js} +2 -2
  14. package/dist/{chunk-HLJQONDG.js → chunk-5OQTDTWB.js} +3 -3
  15. package/dist/{chunk-JYFZC776.js → chunk-5SDUOS4G.js} +2 -2
  16. package/dist/{chunk-GQHT6N47.js → chunk-757WX4YX.js} +3 -3
  17. package/dist/{chunk-HYRWQYVE.js → chunk-A4QJ2E4D.js} +5 -5
  18. package/dist/{chunk-W4WWPN52.js → chunk-ARAH3W3L.js} +3 -3
  19. package/dist/{chunk-GANI63IL.js → chunk-AT6RLTDF.js} +1 -1
  20. package/dist/{chunk-VQ4KQGLY.js → chunk-AXGTLADG.js} +2 -2
  21. package/dist/{chunk-UHVYFXW6.js → chunk-B3XUAKJI.js} +1 -1
  22. package/dist/{chunk-KJN74LA5.js → chunk-CGVYMX4N.js} +7 -7
  23. package/dist/{chunk-P63MQNDV.js → chunk-CIG5RZ7Z.js} +170 -5
  24. package/dist/{chunk-6ILOTKYR.js → chunk-CSWT3PDT.js} +3 -3
  25. package/dist/{chunk-QPIWCDVK.js → chunk-CULBCABP.js} +2 -2
  26. package/dist/{chunk-DUENAYRI.js → chunk-D4MQRI56.js} +9 -9
  27. package/dist/{chunk-EQ5M2WWA.js → chunk-DBXWEZ3L.js} +2 -2
  28. package/dist/{chunk-33OQSCE2.js → chunk-DQJCVLYE.js} +1 -1
  29. package/dist/{chunk-GEYJLP6L.js → chunk-ECUP2QQH.js} +149 -152
  30. package/dist/{chunk-EA67BJCF.js → chunk-EE3FR5JP.js} +1 -1
  31. package/dist/{chunk-GIAODP2B.js → chunk-EKCOXTS2.js} +1 -1
  32. package/dist/{chunk-BGTQHUGU.js → chunk-FQ6ZKZCH.js} +1 -1
  33. package/dist/{chunk-EYUJCGF2.js → chunk-GK7QN7K6.js} +3 -3
  34. package/dist/{chunk-EFSJGRWD.js → chunk-GVRD3MBC.js} +3 -3
  35. package/dist/{chunk-AU3QZKC4.js → chunk-J4M35XQA.js} +5 -5
  36. package/dist/{chunk-CDDWYP73.js → chunk-JXAUDSTQ.js} +1 -1
  37. package/dist/{chunk-MDJ6ILXG.js → chunk-LEQWPWZA.js} +1 -1
  38. package/dist/{chunk-LFUEODDW.js → chunk-LPKNESZ5.js} +5 -5
  39. package/dist/{chunk-LLCRQWH5.js → chunk-LWKV36FC.js} +1 -1
  40. package/dist/{chunk-UNWCM4FR.js → chunk-MHIXBZDZ.js} +1 -1
  41. package/dist/{chunk-JZDTDGRO.js → chunk-MHRZVSXP.js} +1 -1
  42. package/dist/{chunk-GXCU5HTU.js → chunk-MMCVDHDX.js} +2 -2
  43. package/dist/{chunk-YTERTIGW.js → chunk-NKT32ZHB.js} +2 -2
  44. package/dist/{chunk-3JVLRIX3.js → chunk-NNTORDVS.js} +1 -1
  45. package/dist/{chunk-R3JSLSMG.js → chunk-OR2TAE22.js} +2 -2
  46. package/dist/{chunk-VJKHQSSS.js → chunk-PEKITBZX.js} +1 -1
  47. package/dist/{chunk-Y5LWTGOV.js → chunk-RT7R4COY.js} +6 -6
  48. package/dist/{chunk-Q7BECZIF.js → chunk-RWQ5XKRH.js} +5 -5
  49. package/dist/{chunk-DNUA6244.js → chunk-SLWDYHO5.js} +2 -2
  50. package/dist/{chunk-PVUBF24F.js → chunk-SSYFNK4W.js} +2 -1
  51. package/dist/{chunk-NJKCJVJL.js → chunk-TE3Q6LVL.js} +1 -1
  52. package/dist/{chunk-DRGGJH2V.js → chunk-TQDYP45H.js} +2 -2
  53. package/dist/{chunk-EDZ2OZYI.js → chunk-U3SXAKQZ.js} +3 -3
  54. package/dist/{chunk-DPTBQIF6.js → chunk-UYPE2MYB.js} +3 -3
  55. package/dist/{chunk-UJISSEJG.js → chunk-VI233QH2.js} +1 -1
  56. package/dist/{chunk-PUPUOQ6Y.js → chunk-W2ZZ6KQP.js} +2 -2
  57. package/dist/{chunk-3L6XOE4K.js → chunk-WEHUIYTR.js} +1 -1
  58. package/dist/{chunk-PN4LWT5F.js → chunk-WNQGSAUE.js} +1 -1
  59. package/dist/{chunk-XL6DG5LC.js → chunk-YEETN7NH.js} +5 -5
  60. package/dist/{chunk-SSVG2IOD.js → chunk-ZEILNR5Q.js} +1 -1
  61. package/dist/{chunk-UCUZJ5W5.js → chunk-ZIRMH464.js} +3 -3
  62. package/dist/{claude-launcher-5UGFLCYJ.js → claude-launcher-5I7TNYQJ.js} +1 -1
  63. package/dist/{cli-NYRTR2QR.js → cli-4F4XTBBF.js} +113 -113
  64. package/dist/{command-W7OFZRJL.js → command-ABIQ63NE.js} +32 -32
  65. package/dist/{config-ODIFTWTQ.js → config-4W4MXVZR.js} +6 -6
  66. package/dist/{connect-cmd-BMA6JWN5.js → connect-cmd-I7TUU2BM.js} +5 -5
  67. package/dist/{container-start-GQRXAXXQ.js → container-start-5EFWPLEB.js} +30 -30
  68. package/dist/{context-show-cmd-FN6RY7JN.js → context-show-cmd-6U42IUEX.js} +6 -6
  69. package/dist/{control-plane-launch-7FWJACHT.js → control-plane-launch-SLIYO4BZ.js} +5 -5
  70. package/dist/{demo-record-cmd-LRQMMMPB.js → demo-record-cmd-HBFGZHVK.js} +2 -2
  71. package/dist/{demo-voice-cmd-ORYSHARJ.js → demo-voice-cmd-ZINZNDWR.js} +11 -11
  72. package/dist/{docker-POAJWLZ5.js → docker-5L7BRY2J.js} +4 -4
  73. package/dist/{doctor-4W5RSKJN.js → doctor-ZTOJ53SA.js} +32 -32
  74. package/dist/{emit-artifact-cmd-KMGO53PL.js → emit-artifact-cmd-DNA5R6C2.js} +10 -10
  75. package/dist/{emit-criteria-cmd-2KDA4LPJ.js → emit-criteria-cmd-UGLCECVP.js} +7 -7
  76. package/dist/{emit-demo-cmd-26URBRX2.js → emit-demo-cmd-GBNYC5GU.js} +11 -11
  77. package/dist/{emit-finding-cmd-GM4G3ZGU.js → emit-finding-cmd-66OOJS5Q.js} +7 -7
  78. package/dist/{emit-result-cmd-SXS6AJP3.js → emit-result-cmd-3BAYNI6R.js} +9 -9
  79. package/dist/{emit-step-cmd-TDO3NFV3.js → emit-step-cmd-S2ZISEQS.js} +7 -7
  80. package/dist/{exec-client-DBSWP3AQ.js → exec-client-PISQ53KG.js} +3 -3
  81. package/dist/{find-unit-4EP7BW2F.js → find-unit-QQP7HH3R.js} +8 -8
  82. package/dist/{findings-cmd-ED52QLP2.js → findings-cmd-BPYW5IMS.js} +7 -7
  83. package/dist/{fleet-readiness-X7YICYMA.js → fleet-readiness-XNWEAVW7.js} +5 -5
  84. package/dist/{governing-source-R7F6GZLO.js → governing-source-GS73BIQ3.js} +9 -9
  85. package/dist/{guest-init-4YXOOA6P.js → guest-init-7OVIIKLM.js} +4 -4
  86. package/dist/{hook-fast-Q6HOUK64.js → hook-fast-IXIYJKAN.js} +1 -1
  87. package/dist/{host-checks-OAFGSUUM.js → host-checks-XVHIR3EK.js} +28 -28
  88. package/dist/{pending-WSR6KRTI.js → host-key-3FKGWSHL.js} +3 -3
  89. package/dist/{image-tag-BHAEZYXN.js → image-tag-U4YQCHRG.js} +3 -3
  90. package/dist/index.js +4 -4
  91. package/dist/{init-DTG7SJUJ.js → init-V6ESW3K6.js} +28 -28
  92. package/dist/{init-GPW5WSRP.js → init-WGLH27Q3.js} +28 -28
  93. package/dist/{init-cmd-BLCYQVCC.js → init-cmd-N7MZ3LA3.js} +10 -10
  94. package/dist/{init-update-F3JZ2GEW.js → init-update-5RY6XB27.js} +8 -8
  95. package/dist/{install-cmd-4PDNS3MC.js → install-cmd-6GXTY4UW.js} +5 -5
  96. package/dist/{logs-HHNF6ABR.js → logs-U7QU7KPL.js} +2 -2
  97. package/dist/{loop-XYZGEYNX.js → loop-XM24ZVOO.js} +37 -37
  98. package/dist/{machine-ZBF7MTPU.js → machine-X2Z5RLVD.js} +28 -28
  99. package/dist/{mcp-serve-cmd-RKM4BLX3.js → mcp-serve-cmd-LRNO35OS.js} +4 -4
  100. package/dist/{paths-WQUQWBL6.js → paths-TH2PHIEY.js} +2 -2
  101. package/dist/{host-key-2OWJL2HZ.js → pending-EZKNEM2I.js} +3 -3
  102. package/dist/{pidfile-P6WZBOR4.js → pidfile-CI7F3737.js} +3 -3
  103. package/dist/{record-WMING5ZQ.js → record-OFRT5V22.js} +3 -3
  104. package/dist/{runner-env-NXNGYKU4.js → runner-env-PO3FMLIW.js} +8 -8
  105. package/dist/{runner-identity-ZCXCKYYO.js → runner-identity-QS26JIKL.js} +4 -4
  106. package/dist/{runner-key-BFWKR3LC.js → runner-key-OKTRAUHO.js} +28 -28
  107. package/dist/{session-sender-JIWCOKW4.js → session-sender-UB6GJWZS.js} +10 -10
  108. package/dist/{spec-cmd-TQ6VCLCS.js → spec-cmd-B3Y2JF4M.js} +8 -8
  109. package/dist/{state-ZOM5PUYK.js → state-BV5BZMTE.js} +3 -3
  110. package/dist/{status-27ZZEKIO.js → status-MPPZT5KS.js} +28 -28
  111. package/dist/{sync-cmd-TKGTFHFZ.js → sync-cmd-YUWBZNQD.js} +9 -9
  112. package/dist/{update-steps-NMSIEZBR.js → update-steps-UNOE66M4.js} +29 -29
  113. package/dist/{watch-GMLQW3S7.js → watch-GOWRN3BK.js} +9 -9
  114. package/dist/{work-claim-cmd-I6VVJZHK.js → work-claim-cmd-CHCADUYP.js} +13 -13
  115. package/dist/{work-cmd-UOLSKQ5A.js → work-cmd-WUJXUXHP.js} +7 -7
  116. package/dist/{work-comment-cmd-FMAHDTN4.js → work-comment-cmd-E3GBVCQX.js} +9 -9
  117. package/dist/{work-demo-cmd-BIONKBZM.js → work-demo-cmd-YOLKT6ZD.js} +7 -7
  118. package/dist/{work-logs-cmd-IXHGQ443.js → work-logs-cmd-SHWLRI4D.js} +7 -7
  119. package/dist/{work-open-pr-cmd-E7KGEH42.js → work-open-pr-cmd-LHMYF4CX.js} +8 -8
  120. package/dist/{work-pr-cmd-GWYKEMBY.js → work-pr-cmd-PAYHF664.js} +7 -7
  121. package/dist/{work-proofs-cmd-RD5PPXAF.js → work-proofs-cmd-VRZ5EOTH.js} +8 -8
  122. package/dist/{work-proofs-record-QRTL7KIP.js → work-proofs-record-ECHOY77G.js} +14 -14
  123. package/dist/{work-stop-cmd-DJWAZRM3.js → work-stop-cmd-Z6RMU44Y.js} +7 -7
  124. package/package.json +1 -1
@@ -8,8 +8,126 @@ import { request as request$1, createServer } from 'http';
8
8
  import { request } from 'https';
9
9
  import { createServer as createServer$1 } from 'net';
10
10
  import { join } from 'path';
11
+ import { lookup } from 'dns';
11
12
 
12
13
  createRequire(import.meta.url);
14
+
15
+ // src/runner/container/ranges.ts
16
+ var V4 = [
17
+ ["unspecified", "0.0.0.0/8"],
18
+ ["loopback", "127.0.0.0/8"],
19
+ ["private", "10.0.0.0/8"],
20
+ ["private", "172.16.0.0/12"],
21
+ ["private", "192.168.0.0/16"],
22
+ ["protocol-assignments", "192.0.0.0/24"],
23
+ ["benchmarking", "198.18.0.0/15"],
24
+ ["azure-wireserver", "168.63.129.16/32"],
25
+ ["link-local", "169.254.0.0/16"],
26
+ ["shared-address", "100.64.0.0/10"],
27
+ ["multicast", "224.0.0.0/4"],
28
+ ["reserved", "240.0.0.0/4"]
29
+ ];
30
+ var V6 = [
31
+ ["unspecified", "::/128"],
32
+ ["loopback", "::1/128"],
33
+ ["ipv4-mapped", "::ffff:0:0/96"],
34
+ ["nat64", "64:ff9b::/96"],
35
+ // The location of an embedded IPv4 address depends on the translator's prefix length, so the whole prefix is refused.
36
+ ["nat64-local", "64:ff9b:1::/48"],
37
+ ["ipv4-compatible", "::/96"],
38
+ ["link-local", "fe80::/10"],
39
+ ["unique-local", "fc00::/7"],
40
+ ["multicast", "ff00::/8"]
41
+ ];
42
+ var UNPARSEABLE = { name: "unparseable", cidr: "-" };
43
+ function parseV4(text) {
44
+ const parts = text.split(".");
45
+ if (parts.length !== 4) return void 0;
46
+ let value = 0;
47
+ for (const part of parts) {
48
+ if (!/^\d{1,3}$/.test(part)) return void 0;
49
+ const octet = Number(part);
50
+ if (octet > 255) return void 0;
51
+ value = value * 256 + octet;
52
+ }
53
+ return value;
54
+ }
55
+ function parseV6(input) {
56
+ const zone = input.indexOf("%");
57
+ let text = zone === -1 ? input : input.slice(0, zone);
58
+ const lastColon = text.lastIndexOf(":");
59
+ const tail = text.slice(lastColon + 1);
60
+ if (tail.includes(".")) {
61
+ const v4 = parseV4(tail);
62
+ if (v4 === void 0) return void 0;
63
+ text = `${text.slice(0, lastColon + 1)}${(v4 >>> 16).toString(16)}:${(v4 & 65535).toString(16)}`;
64
+ }
65
+ const halves = text.split("::");
66
+ if (halves.length > 2) return void 0;
67
+ const groups = (part) => {
68
+ if (part === "") return [];
69
+ const found = part.split(":");
70
+ return found.every((g) => /^[0-9a-fA-F]{1,4}$/.test(g)) ? found : void 0;
71
+ };
72
+ const head = groups(halves[0]);
73
+ const rest = groups(halves[1] ?? "");
74
+ if (head === void 0 || rest === void 0) return void 0;
75
+ let words;
76
+ if (halves.length === 2) {
77
+ const missing = 8 - head.length - rest.length;
78
+ if (missing < 1) return void 0;
79
+ words = [...head, ...Array(missing).fill("0"), ...rest];
80
+ } else {
81
+ if (head.length !== 8) return void 0;
82
+ words = head;
83
+ }
84
+ return words.reduce((acc, word) => acc << BigInt(16) | BigInt(parseInt(word, 16)), BigInt(0));
85
+ }
86
+ function build4() {
87
+ return V4.map(([name, cidr]) => {
88
+ const [address, length] = cidr.split("/");
89
+ return { name, cidr, base: parseV4(address), bits: Number(length) };
90
+ });
91
+ }
92
+ function build6() {
93
+ return V6.map(([name, cidr]) => {
94
+ const [address, length] = cidr.split("/");
95
+ return { name, cidr, base: parseV6(address), bits: Number(length) };
96
+ });
97
+ }
98
+ var RANGES_4 = build4();
99
+ var RANGES_6 = build6();
100
+ [...RANGES_4, ...RANGES_6].map(({ name, cidr }) => ({ name, cidr }));
101
+ function carried6to4(address) {
102
+ const v6 = parseV6(address);
103
+ if (v6 === void 0 || v6 >> BigInt(112) !== BigInt(8194)) return void 0;
104
+ const v4 = Number(v6 >> BigInt(80) & BigInt(4294967295));
105
+ return [v4 >>> 24, v4 >>> 16 & 255, v4 >>> 8 & 255, v4 & 255].join(".");
106
+ }
107
+ function classifyAddress(address) {
108
+ const v4 = parseV4(address);
109
+ if (v4 !== void 0) {
110
+ for (const range of RANGES_4) {
111
+ const shift = 32 - range.bits;
112
+ if (Math.floor(v4 / 2 ** shift) === Math.floor(range.base / 2 ** shift)) return { name: range.name, cidr: range.cidr };
113
+ }
114
+ return void 0;
115
+ }
116
+ const v6 = parseV6(address);
117
+ if (v6 === void 0) return UNPARSEABLE;
118
+ const carries = carried6to4(address);
119
+ if (carries !== void 0) {
120
+ const inner = classifyAddress(carries);
121
+ return inner === void 0 ? void 0 : { ...inner, carries };
122
+ }
123
+ for (const range of RANGES_6) {
124
+ const shift = BigInt(128 - range.bits);
125
+ if (v6 >> shift === range.base >> shift) return { name: range.name, cidr: range.cidr };
126
+ }
127
+ return void 0;
128
+ }
129
+
130
+ // src/runner/destinations.ts
13
131
  var MAX_RELEASED_DESTINATIONS = 20;
14
132
  function maxDestinations(agents = defaultAgents(), providers = PROVIDERS) {
15
133
  return MAX_RELEASED_DESTINATIONS - builtInNames(agents, providers).length;
@@ -142,6 +260,15 @@ function expandHeader(header, env) {
142
260
  }
143
261
  return { value: header.value.replace(HEADER_VARIABLE, (_match, name) => env[name]) };
144
262
  }
263
+ var publicLookup = (hostname, options, callback) => {
264
+ lookup(hostname, { all: true, family: options.family ?? 0 }, (err, addresses) => {
265
+ if (err) return callback(err, "", 0);
266
+ const allowed = addresses.filter(({ address }) => classifyAddress(address) === void 0);
267
+ if (allowed.length === 0) return callback(Object.assign(new Error(`${hostname} resolves to a private address`), { code: "EACCES" }), "", 0);
268
+ if (options.all === true) return callback(null, allowed);
269
+ callback(null, allowed[0].address, allowed[0].family);
270
+ });
271
+ };
145
272
  async function startDestination(input) {
146
273
  const { destination, hostEnv } = input;
147
274
  const upstream = new URL(destination.upstream);
@@ -168,6 +295,16 @@ async function startDestination(input) {
168
295
  fail(400, "send an origin-form request path\n");
169
296
  return;
170
297
  }
298
+ if (input.guardUpstream === true) {
299
+ if (req.method === "TRACE") {
300
+ fail(405, "TRACE is not sent to this destination\n");
301
+ return;
302
+ }
303
+ if (target.split(/[/?#]/).some((segment) => /^(\.|%2e){2}$/i.test(segment))) {
304
+ fail(400, "send a request path without .. segments\n");
305
+ return;
306
+ }
307
+ }
171
308
  const expanded = expandHeader(destination.header, hostEnv);
172
309
  if ("missing" in expanded) {
173
310
  fail(502, `the destination ${destination.name} cannot be reached: ${expanded.missing} is not set in the runner's environment
@@ -190,7 +327,8 @@ async function startDestination(input) {
190
327
  method: req.method,
191
328
  path: `${prefix}${target}`,
192
329
  headers,
193
- ...input.ca === void 0 ? {} : { ca: input.ca }
330
+ ...input.ca === void 0 ? {} : { ca: input.ca },
331
+ ...input.guardUpstream === true && input.allowPrivateUpstream !== true ? { lookup: publicLookup } : {}
194
332
  },
195
333
  (answer) => {
196
334
  res.writeHead(answer.statusCode ?? 502, answer.headers);
@@ -212,8 +350,11 @@ async function startDestination(input) {
212
350
  input.onUsed?.(destination.name);
213
351
  forwarded.setTimeout(UPSTREAM_IDLE_MS, () => forwarded.destroy());
214
352
  res.on("close", () => forwarded.destroy());
215
- forwarded.on("error", () => fail(502, `the upstream of the destination ${destination.name} could not be reached
216
- `));
353
+ forwarded.on("error", (err) => {
354
+ input.onUpstreamError?.(destination.name, typeof err.code === "string" ? err.code : "unknown");
355
+ fail(502, `the upstream of the destination ${destination.name} could not be reached
356
+ `);
357
+ });
217
358
  req.pipe(forwarded);
218
359
  };
219
360
  const sockets = /* @__PURE__ */ new Set();
@@ -292,6 +433,7 @@ async function startBuildServices(input) {
292
433
  ...input.serve === "socket" || streamed ? {} : { port: input.ports?.destinations?.[index] ?? 0 },
293
434
  hostEnv: input.hostEnv,
294
435
  onUsed: (name) => tunnel.destinationUsed(name),
436
+ onUpstreamError: (name, code) => input.log?.(`route ${name} could not reach its upstream: ${code}`),
295
437
  onFinished: (name, ok) => tunnel.routeFinished(name, ok),
296
438
  ...input.destinationOptions
297
439
  });
@@ -303,6 +445,26 @@ async function startBuildServices(input) {
303
445
  targets.set(destinationTarget(index), (stream) => server.acceptStream(stream));
304
446
  if (server.port !== void 0) destinationPorts.push(server.port);
305
447
  }
448
+ for (const factory of input.factory ?? []) {
449
+ const server = await startDestination({
450
+ destination: factory.destination,
451
+ ...input.serve === "tcp" || streamed ? {} : { socketPath: destinationSocketPath(input.buildDir, factory.index) },
452
+ ...input.serve === "tcp" || streamed ? {} : listenOnFor(`dest-${factory.index}.sock`),
453
+ ...input.serve === "socket" || streamed ? {} : { port: 0 },
454
+ hostEnv: factory.hostEnv,
455
+ guardUpstream: true,
456
+ onUsed: (name) => tunnel.destinationUsed(name),
457
+ onUpstreamError: (name, code) => input.log?.(`route ${name} could not reach its upstream: ${code}`),
458
+ onFinished: (name, ok) => tunnel.routeFinished(name, ok),
459
+ ...input.destinationOptions
460
+ });
461
+ servers.push(server);
462
+ tunnel.routeServed(factory.destination.name);
463
+ input.log?.(`route ${factory.destination.name} served to the build`);
464
+ const listener = server.listener?.();
465
+ if (listener !== void 0) listeners[`dest-${factory.index}.sock`] = listener;
466
+ targets.set(destinationTarget(factory.index), (stream) => server.acceptStream(stream));
467
+ }
306
468
  const builtIns = input.builtIns === void 0 ? [] : builtInDestinations({ ...input.builtIns, hostEnv: input.hostEnv }, input.builtIns.agents, input.builtIns.providers);
307
469
  for (const builtIn of builtIns) {
308
470
  const server = await startDestination({
@@ -313,6 +475,7 @@ async function startBuildServices(input) {
313
475
  hostEnv: builtIn.hostEnv,
314
476
  drop: builtIn.drop,
315
477
  onUsed: (name) => tunnel.destinationUsed(name),
478
+ onUpstreamError: (name, code) => input.log?.(`route ${name} could not reach its upstream: ${code}`),
316
479
  onFinished: (name, ok) => tunnel.routeFinished(name, ok),
317
480
  ...input.destinationOptions
318
481
  });
@@ -599,6 +762,7 @@ function buildEnvironment(input) {
599
762
  literals: {
600
763
  ...recipe,
601
764
  ...destinations,
765
+ ...input.proxiedEnvironment,
602
766
  ...runnerLiterals(input.repository, repositoriesOf({ repositories: input.repositories, repository: input.repository, branch: input.branch }), input.unpinnedRuntimes, input.missingSetupScripts),
603
767
  ...builtInLiterals,
604
768
  ...authored,
@@ -620,7 +784,8 @@ function checkEnvironment(input) {
620
784
  hostEnv: input.hostEnv,
621
785
  containerEnv: input.containerEnv,
622
786
  builtIns: false,
623
- factoryVariables: input.factoryVariables
787
+ factoryVariables: input.factoryVariables,
788
+ proxiedEnvironment: input.proxiedEnvironment
624
789
  });
625
790
  const withheld = /* @__PURE__ */ new Set(["OUTERLAYER_URL", "OUTERLAYER_API_KEY", ...strippedVariables()]);
626
791
  const literals = { OUTERLAYER_EVAL_INPUT: EVAL_INPUT_DIR, OUTERLAYER_CHECK_ITEMS: CHECK_ITEMS_FILE };
@@ -670,4 +835,4 @@ function routesOf(counts) {
670
835
  return routes.length === 0 ? {} : { routes };
671
836
  }
672
837
 
673
- 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, withTokenHeader, withTunnelRecord };
838
+ 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, carried6to4, checkEnvironment, checkoutPath, classifyAddress, commitIdentityRecord, containerLocalAddress, destinationEnvironment, headerVariables, isMiseVariableAllowed, isRefusedInConfig, isReservedVariable, lifecycleWorkdir, maxDestinations, parseClaimIdentity, parseClaimedRepositories, parseIsolation, parseUnreachable, primaryOf, proxyEnvironment, repositoriesOf, repositoryPath, resolveDestinations, sharedUserEnvironment, startBuildServices, tokenHeader, withGitConfig, withHooksPath, withMiseVariables, withTokenHeader, withTunnelRecord };
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { resolveCredentials, postJson, getJson } from './chunk-LFUEODDW.js';
3
+ import { resolveCredentials, postJson, getJson } from './chunk-LPKNESZ5.js';
4
4
  import { detectActiveSession } from './chunk-66GYPUUN.js';
5
5
  import { sanitizeTerminal } from './chunk-F3T5QJ24.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
7
- import { defaultFetch } from './chunk-VJKHQSSS.js';
8
- import { logHookError } from './chunk-EA67BJCF.js';
7
+ import { defaultFetch } from './chunk-PEKITBZX.js';
8
+ import { logHookError } from './chunk-EE3FR5JP.js';
9
9
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
10
10
  import { homeFromEnv } from './chunk-352DHUTP.js';
11
11
  import { resolveRepoIdentity } from './chunk-FINJC6BS.js';
@@ -2,10 +2,10 @@
2
2
  import { createRequire } from 'node:module';
3
3
  import { launchRefusalForSession } from './chunk-WGC7UFRM.js';
4
4
  import { detectActiveSession } from './chunk-66GYPUUN.js';
5
- import { autoConnect } from './chunk-GXCU5HTU.js';
5
+ import { autoConnect } from './chunk-MMCVDHDX.js';
6
6
  import { acquireSpoolLockAt } from './chunk-F3T5QJ24.js';
7
7
  import { C } from './chunk-2AM6Z5BP.js';
8
- import { resolveGatewayCredentials, defaultFetch, unauthorizedMessage } from './chunk-VJKHQSSS.js';
8
+ import { resolveGatewayCredentials, defaultFetch, unauthorizedMessage } from './chunk-PEKITBZX.js';
9
9
  import { launchedItemForSession } from './chunk-4OD45RBP.js';
10
10
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
11
11
  import { homeFromEnv } from './chunk-352DHUTP.js';
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
3
  import { checkStarterFiles, contextIsGoverned } from './chunk-VNYAJEKO.js';
4
- import { fleetCheck, checkBuildSkill, checkMachineSkills, checkCommittedMaintainedSkills, checkMaintainedReferences, checkIgnoredSkillFolders } from './chunk-UNWCM4FR.js';
5
- import { resolveCredentials, getJson, WorkCommandError } from './chunk-LFUEODDW.js';
6
- import { isLinkedRepository } from './chunk-UHVYFXW6.js';
4
+ import { fleetCheck, checkBuildSkill, checkMachineSkills, checkCommittedMaintainedSkills, checkMaintainedReferences, checkIgnoredSkillFolders } from './chunk-MHIXBZDZ.js';
5
+ import { resolveCredentials, getJson, WorkCommandError } from './chunk-LPKNESZ5.js';
6
+ import { isLinkedRepository } from './chunk-B3XUAKJI.js';
7
7
  import { sanitizeTerminal } from './chunk-F3T5QJ24.js';
8
8
  import { C } from './chunk-2AM6Z5BP.js';
9
9
  import { checkFormerSkillNames } from './chunk-M6FMJXYO.js';
10
- import { resolveGatewayCredentials, defaultFetch } from './chunk-VJKHQSSS.js';
11
- import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-EA67BJCF.js';
10
+ import { resolveGatewayCredentials, defaultFetch } from './chunk-PEKITBZX.js';
11
+ import { sanitizeForContext, spoolDir, assessSyncHealth, readSyncStatus, SYNC_STALE_AFTER_MS, formatAgo, checkInstalledCliStaleness, workspaceRootOf, hookFiredMarkerPath, refreshCommand } from './chunk-EE3FR5JP.js';
12
12
  import { readStatuslineState, STATE_FRESH_MS } from './chunk-ORU76DHF.js';
13
13
  import { withInjectedPrograms } from './chunk-HWIV4MF6.js';
14
14
  import { CONTROL_PLANE_DIR_VARIABLE } from './chunk-UWYU46GF.js';
@@ -1050,8 +1050,8 @@ function doctorExitCode(checks) {
1050
1050
 
1051
1051
  // src/doctor-report.ts
1052
1052
  async function gatherDoctorChecks() {
1053
- const { DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK } = await import('./build-disk-27ZTD2EH.js');
1054
- const { defaultRunnerConfigPath, hasRunnerBlock, keyRunnerFactory, loadRunnerConfig, runnerVmOf } = await import('./config-ODIFTWTQ.js');
1053
+ const { DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK } = await import('./build-disk-ITPCE4ME.js');
1054
+ const { defaultRunnerConfigPath, hasRunnerBlock, keyRunnerFactory, loadRunnerConfig, runnerVmOf } = await import('./config-4W4MXVZR.js');
1055
1055
  const configPath = defaultRunnerConfigPath();
1056
1056
  const runnerHost = hasRunnerBlock(configPath);
1057
1057
  const hooks = (() => {
@@ -1079,7 +1079,7 @@ async function gatherDoctorChecks() {
1079
1079
  const { runnerVmCheck } = await import('./doctor-53F2PYY7.js');
1080
1080
  checks.push(runnerVmCheck(configPath, { lima: realLima(), home: homeFromEnv(), instance: runnerVm.instance }));
1081
1081
  } else if (hasRunnerBlock(configPath)) {
1082
- const { runnerHostChecks } = await import('./doctor-4W5RSKJN.js');
1082
+ const { runnerHostChecks } = await import('./doctor-ZTOJ53SA.js');
1083
1083
  const gateway = (() => {
1084
1084
  try {
1085
1085
  const loaded = loadRunnerConfig(configPath);
@@ -1107,7 +1107,7 @@ async function gatherDoctorChecks() {
1107
1107
  const service = await (async () => {
1108
1108
  const { existsSync: existsSync3 } = await import('fs');
1109
1109
  if (process.platform !== "linux" || !existsSync3("/run/systemd/system")) return void 0;
1110
- const { inspectRunnerService } = await import('./find-unit-4EP7BW2F.js');
1110
+ const { inspectRunnerService } = await import('./find-unit-QQP7HH3R.js');
1111
1111
  return inspectRunnerService(configPath);
1112
1112
  })();
1113
1113
  checks.push(...await runnerHostChecks({ configPath, hooks, gateway, repos, runner, service }));
@@ -2,8 +2,8 @@
2
2
  import { createRequire } from 'node:module';
3
3
  import { RemovedTargetError, removedTargetError } from './chunk-6V6ONATO.js';
4
4
  import { removeRetiredSkills } from './chunk-M6FMJXYO.js';
5
- import { defaultFetch, resolveGatewayCredentials } from './chunk-VJKHQSSS.js';
6
- import { withTokenHeader } from './chunk-P63MQNDV.js';
5
+ import { defaultFetch, resolveGatewayCredentials } from './chunk-PEKITBZX.js';
6
+ import { withTokenHeader } from './chunk-CIG5RZ7Z.js';
7
7
  import { appendContextProvenance } from './chunk-545P7JY7.js';
8
8
  import { cliInvocation } from './chunk-FZKNTIOJ.js';
9
9
  import { writeDegraded, writeSourceCache, SOURCE_CACHE_TTL_RETRY_MS, writeContextManifest, SOURCE_CACHE_TTL_SUCCESS_MS, readSourceCache, isSourceCacheFresh, clearDegraded } from './chunk-YQR6E6OV.js';
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { RELAY_PORT, BUILD_HOME } from './chunk-P63MQNDV.js';
3
+ import { RELAY_PORT, BUILD_HOME } from './chunk-CIG5RZ7Z.js';
4
4
  import { createServer, connect } from 'net';
5
5
 
6
6
  createRequire(import.meta.url);