@ashlr/hub 3.5.0 → 3.7.0

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 (210) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +3 -0
  3. package/dist/build-identity.json +2 -2
  4. package/dist/cli/activation.d.ts +41 -0
  5. package/dist/cli/activation.js +485 -0
  6. package/dist/cli/activation.js.map +1 -0
  7. package/dist/core/daemon/cutoff-checkpoint-scheduler.js +7 -0
  8. package/dist/core/daemon/cutoff-checkpoint-scheduler.js.map +1 -1
  9. package/dist/core/daemon/loop.d.ts +19 -0
  10. package/dist/core/daemon/loop.js +235 -5
  11. package/dist/core/daemon/loop.js.map +1 -1
  12. package/dist/core/daemon/overnight-status.d.ts +152 -0
  13. package/dist/core/daemon/overnight-status.js +275 -0
  14. package/dist/core/daemon/overnight-status.js.map +1 -0
  15. package/dist/core/daemon/post-merge-halt.d.ts +212 -0
  16. package/dist/core/daemon/post-merge-halt.js +503 -0
  17. package/dist/core/daemon/post-merge-halt.js.map +1 -0
  18. package/dist/core/daemon/run-window.d.ts +218 -0
  19. package/dist/core/daemon/run-window.js +420 -0
  20. package/dist/core/daemon/run-window.js.map +1 -0
  21. package/dist/core/fleet/external-skill-audit.js +1 -1
  22. package/dist/core/fleet/external-skill-audit.js.map +1 -1
  23. package/dist/core/fleet/generated-repair-resolution.d.ts +36 -0
  24. package/dist/core/fleet/generated-repair-resolution.js +245 -0
  25. package/dist/core/fleet/generated-repair-resolution.js.map +1 -0
  26. package/dist/core/local-runtime/llama/config.d.ts +28 -6
  27. package/dist/core/local-runtime/llama/config.js +28 -6
  28. package/dist/core/local-runtime/llama/config.js.map +1 -1
  29. package/dist/core/local-runtime/llama/port.d.ts +17 -0
  30. package/dist/core/local-runtime/llama/port.js +47 -0
  31. package/dist/core/local-runtime/llama/port.js.map +1 -0
  32. package/dist/core/local-runtime/llama/proxy-host.d.ts +54 -0
  33. package/dist/core/local-runtime/llama/proxy-host.js +159 -0
  34. package/dist/core/local-runtime/llama/proxy-host.js.map +1 -0
  35. package/dist/core/local-runtime/llama/proxy-process.d.ts +148 -0
  36. package/dist/core/local-runtime/llama/proxy-process.js +250 -0
  37. package/dist/core/local-runtime/llama/proxy-process.js.map +1 -0
  38. package/dist/core/local-runtime/llama/proxy-record.d.ts +40 -0
  39. package/dist/core/local-runtime/llama/proxy-record.js +133 -0
  40. package/dist/core/local-runtime/llama/proxy-record.js.map +1 -0
  41. package/dist/core/local-runtime/llama/proxy-supervisor.d.ts +118 -0
  42. package/dist/core/local-runtime/llama/proxy-supervisor.js +511 -0
  43. package/dist/core/local-runtime/llama/proxy-supervisor.js.map +1 -0
  44. package/dist/core/web/public/next/assets/App-Cgi6j1Gk.css +1 -0
  45. package/dist/core/web/public/next/assets/App-vtaHB9mp.js +7 -0
  46. package/dist/core/web/public/next/assets/App-vtaHB9mp.js.map +1 -0
  47. package/dist/core/web/public/next/assets/ApprovalsSection-B-bFJ0I9.js +2 -0
  48. package/dist/core/web/public/next/assets/ApprovalsSection-B-bFJ0I9.js.map +1 -0
  49. package/dist/core/web/public/next/assets/ApprovalsSection-Su-NUTis.css +1 -0
  50. package/dist/core/web/public/next/assets/AutonomySection-CHjxJt2z.css +1 -0
  51. package/dist/core/web/public/next/assets/AutonomySection-DoqmsCjw.js +2 -0
  52. package/dist/core/web/public/next/assets/AutonomySection-DoqmsCjw.js.map +1 -0
  53. package/dist/core/web/public/next/assets/ChatSection-BfnLe5dT.css +1 -0
  54. package/dist/core/web/public/next/assets/ChatSection-vNPIJffd.js +80 -0
  55. package/dist/core/web/public/next/assets/ChatSection-vNPIJffd.js.map +1 -0
  56. package/dist/core/web/public/next/assets/ConfirmDialog-Dd2APQhB.js +2 -0
  57. package/dist/core/web/public/next/assets/ConfirmDialog-Dd2APQhB.js.map +1 -0
  58. package/dist/core/web/public/next/assets/{ConfirmDialog-cYuivhCX.css → ConfirmDialog-Dx15x0Ho.css} +1 -1
  59. package/dist/core/web/public/next/assets/Dialog-CPM9JxBc.js +2 -0
  60. package/dist/core/web/public/next/assets/Dialog-CPM9JxBc.js.map +1 -0
  61. package/dist/core/web/public/next/assets/Dialog-tQ8kFulD.css +1 -0
  62. package/dist/core/web/public/next/assets/DiffViewer-B84qVef9.js +7 -0
  63. package/dist/core/web/public/next/assets/DiffViewer-B84qVef9.js.map +1 -0
  64. package/dist/core/web/public/next/assets/DiffViewer-C8HHTnVE.css +1 -0
  65. package/dist/core/web/public/next/assets/McpSection-CEUpV_5X.js +2 -0
  66. package/dist/core/web/public/next/assets/McpSection-CEUpV_5X.js.map +1 -0
  67. package/dist/core/web/public/next/assets/McpSection-D88QlDpG.css +1 -0
  68. package/dist/core/web/public/next/assets/Meter--h3MmZS-.js +2 -0
  69. package/dist/core/web/public/next/assets/Meter--h3MmZS-.js.map +1 -0
  70. package/dist/core/web/public/next/assets/Meter-CLcr-4wS.css +1 -0
  71. package/dist/core/web/public/next/assets/{MutationTokenDialog-jWLLCxWn.css → MutationTokenDialog-CrfJ0PdD.css} +1 -1
  72. package/dist/core/web/public/next/assets/MutationTokenDialog-DA8t97XT.js +2 -0
  73. package/dist/core/web/public/next/assets/MutationTokenDialog-DA8t97XT.js.map +1 -0
  74. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-Bq7Vyud0.js +7 -0
  75. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-Bq7Vyud0.js.map +1 -0
  76. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-CM_8pJs6.css +1 -0
  77. package/dist/core/web/public/next/assets/RouteErrorBoundary-Badio_uO.js +2 -0
  78. package/dist/core/web/public/next/assets/RouteErrorBoundary-Badio_uO.js.map +1 -0
  79. package/dist/core/web/public/next/assets/RouteErrorBoundary-ekyMXAK8.css +1 -0
  80. package/dist/core/web/public/next/assets/SettingsSection-BII7TTSD.css +1 -0
  81. package/dist/core/web/public/next/assets/SettingsSection-BwrpQlpP.js +2 -0
  82. package/dist/core/web/public/next/assets/SettingsSection-BwrpQlpP.js.map +1 -0
  83. package/dist/core/web/public/next/assets/UniverseConsoleApp-Dh7A-hLD.css +1 -0
  84. package/dist/core/web/public/next/assets/UniverseConsoleApp-_FSohAdN.js +2 -0
  85. package/dist/core/web/public/next/assets/UniverseConsoleApp-_FSohAdN.js.map +1 -0
  86. package/dist/core/web/public/next/assets/UniverseView-Bqa8DH57.css +1 -0
  87. package/dist/core/web/public/next/assets/UniverseView-DqcXbed4.js +9 -0
  88. package/dist/core/web/public/next/assets/UniverseView-DqcXbed4.js.map +1 -0
  89. package/dist/core/web/public/next/assets/UsageSection-Bq6Daaby.js +2 -0
  90. package/dist/core/web/public/next/assets/UsageSection-Bq6Daaby.js.map +1 -0
  91. package/dist/core/web/public/next/assets/UsageSection-DwgNOYvi.css +1 -0
  92. package/dist/core/web/public/next/assets/VerseConsoleApp-CMkCizvL.css +1 -0
  93. package/dist/core/web/public/next/assets/VerseConsoleApp-CsIQv9id.js +3 -0
  94. package/dist/core/web/public/next/assets/VerseConsoleApp-CsIQv9id.js.map +1 -0
  95. package/dist/core/web/public/next/assets/charts-CTZJ-JrH.js +2 -0
  96. package/dist/core/web/public/next/assets/charts-CTZJ-JrH.js.map +1 -0
  97. package/dist/core/web/public/next/assets/charts-CsrtT4rk.css +1 -0
  98. package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js +2 -0
  99. package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js.map +1 -0
  100. package/dist/core/web/public/next/assets/format-BNYWGJat.js +2 -0
  101. package/dist/core/web/public/next/assets/format-BNYWGJat.js.map +1 -0
  102. package/dist/core/web/public/next/assets/global-D6bTxIRn.js +2 -0
  103. package/dist/core/web/public/next/assets/global-D6bTxIRn.js.map +1 -0
  104. package/dist/core/web/public/next/assets/global-z-JfD3ow.css +1 -0
  105. package/dist/core/web/public/next/assets/icons-D9vlf85u.js +2 -0
  106. package/dist/core/web/public/next/assets/icons-D9vlf85u.js.map +1 -0
  107. package/dist/core/web/public/next/assets/index-CZamKRUg.js +11 -0
  108. package/dist/core/web/public/next/assets/index-CZamKRUg.js.map +1 -0
  109. package/dist/core/web/public/next/assets/queries-B8eBnFox.js +2 -0
  110. package/dist/core/web/public/next/assets/queries-B8eBnFox.js.map +1 -0
  111. package/dist/core/web/public/next/assets/use-guarded-action-bzrVVAYq.js +2 -0
  112. package/dist/core/web/public/next/assets/use-guarded-action-bzrVVAYq.js.map +1 -0
  113. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js +2 -0
  114. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js.map +1 -0
  115. package/dist/core/web/public/next/assets/workspace-model-v0a1gl-C.js +2 -0
  116. package/dist/core/web/public/next/assets/workspace-model-v0a1gl-C.js.map +1 -0
  117. package/dist/core/web/public/next/index.html +1 -1
  118. package/dist/release-dependency-inventory.json +1 -1
  119. package/node_modules/marked/README.md +8 -0
  120. package/node_modules/marked/bin/main.js +12 -11
  121. package/node_modules/marked/lib/marked.d.ts +88 -25
  122. package/node_modules/marked/lib/marked.esm.js +50 -44
  123. package/node_modules/marked/lib/marked.esm.js.map +3 -3
  124. package/node_modules/marked/lib/marked.umd.js +50 -44
  125. package/node_modules/marked/lib/marked.umd.js.map +3 -3
  126. package/node_modules/marked/man/marked.1 +1 -1
  127. package/node_modules/marked/package.json +21 -21
  128. package/package.json +13 -8
  129. package/dist/core/web/public/next/assets/App-BCKqSppK.css +0 -1
  130. package/dist/core/web/public/next/assets/App-CsbPYQqy.js +0 -16
  131. package/dist/core/web/public/next/assets/App-CsbPYQqy.js.map +0 -1
  132. package/dist/core/web/public/next/assets/ApprovalsSection-CBZquyLK.js +0 -2
  133. package/dist/core/web/public/next/assets/ApprovalsSection-CBZquyLK.js.map +0 -1
  134. package/dist/core/web/public/next/assets/ApprovalsSection-CRP59wSb.css +0 -1
  135. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js +0 -2
  136. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js.map +0 -1
  137. package/dist/core/web/public/next/assets/AutonomySection-DTN6m6QE.css +0 -1
  138. package/dist/core/web/public/next/assets/ChatSection-DiRvNX3Q.css +0 -1
  139. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js +0 -77
  140. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js.map +0 -1
  141. package/dist/core/web/public/next/assets/ConfirmDialog-deO0C0iY.js +0 -2
  142. package/dist/core/web/public/next/assets/ConfirmDialog-deO0C0iY.js.map +0 -1
  143. package/dist/core/web/public/next/assets/Dialog-CNd7q89m.js +0 -2
  144. package/dist/core/web/public/next/assets/Dialog-CNd7q89m.js.map +0 -1
  145. package/dist/core/web/public/next/assets/Dialog-DxN7RgB5.css +0 -1
  146. package/dist/core/web/public/next/assets/DiffViewer-DTO0KRuG.js +0 -7
  147. package/dist/core/web/public/next/assets/DiffViewer-DTO0KRuG.js.map +0 -1
  148. package/dist/core/web/public/next/assets/DiffViewer-hN7X6wGT.css +0 -1
  149. package/dist/core/web/public/next/assets/Epistemic-53PikaUI.js +0 -2
  150. package/dist/core/web/public/next/assets/Epistemic-53PikaUI.js.map +0 -1
  151. package/dist/core/web/public/next/assets/Epistemic-DiyMyeaN.css +0 -1
  152. package/dist/core/web/public/next/assets/Meter-CGBsbXUX.css +0 -1
  153. package/dist/core/web/public/next/assets/Meter-DRWZQgr1.js +0 -2
  154. package/dist/core/web/public/next/assets/Meter-DRWZQgr1.js.map +0 -1
  155. package/dist/core/web/public/next/assets/MutationTokenDialog-DYF8n_RD.js +0 -2
  156. package/dist/core/web/public/next/assets/MutationTokenDialog-DYF8n_RD.js.map +0 -1
  157. package/dist/core/web/public/next/assets/RefreshIndicator-DXJQXKyA.js +0 -2
  158. package/dist/core/web/public/next/assets/RefreshIndicator-DXJQXKyA.js.map +0 -1
  159. package/dist/core/web/public/next/assets/RefreshIndicator-O7jUBOmX.css +0 -1
  160. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-DLl4DbGG.css +0 -1
  161. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-hDSEFdLU.js +0 -7
  162. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-hDSEFdLU.js.map +0 -1
  163. package/dist/core/web/public/next/assets/RouteErrorBoundary-BIpdnxp-.css +0 -1
  164. package/dist/core/web/public/next/assets/RouteErrorBoundary-CZd7ln8v.js +0 -2
  165. package/dist/core/web/public/next/assets/RouteErrorBoundary-CZd7ln8v.js.map +0 -1
  166. package/dist/core/web/public/next/assets/SettingsSection-C9Qs9JWW.js +0 -2
  167. package/dist/core/web/public/next/assets/SettingsSection-C9Qs9JWW.js.map +0 -1
  168. package/dist/core/web/public/next/assets/SettingsSection-DGJMdUh2.css +0 -1
  169. package/dist/core/web/public/next/assets/Skeleton-D2JaTXyv.css +0 -1
  170. package/dist/core/web/public/next/assets/Skeleton-YkcOpgFb.js +0 -2
  171. package/dist/core/web/public/next/assets/Skeleton-YkcOpgFb.js.map +0 -1
  172. package/dist/core/web/public/next/assets/StatusBadge-DJw0LSPg.js +0 -2
  173. package/dist/core/web/public/next/assets/StatusBadge-DJw0LSPg.js.map +0 -1
  174. package/dist/core/web/public/next/assets/StatusBadge-TpDqZf6K.css +0 -1
  175. package/dist/core/web/public/next/assets/TableView-Bj-w1O6o.js +0 -2
  176. package/dist/core/web/public/next/assets/TableView-Bj-w1O6o.js.map +0 -1
  177. package/dist/core/web/public/next/assets/TableView-R6Yeztp1.css +0 -1
  178. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bs2fxaen.js +0 -2
  179. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bs2fxaen.js.map +0 -1
  180. package/dist/core/web/public/next/assets/UniverseConsoleApp-CiZZxRPV.css +0 -1
  181. package/dist/core/web/public/next/assets/UniverseView-B6b2hw-8.js +0 -9
  182. package/dist/core/web/public/next/assets/UniverseView-B6b2hw-8.js.map +0 -1
  183. package/dist/core/web/public/next/assets/UniverseView-gBxl6yum.css +0 -1
  184. package/dist/core/web/public/next/assets/UsageSection-C__ziNkV.js +0 -2
  185. package/dist/core/web/public/next/assets/UsageSection-C__ziNkV.js.map +0 -1
  186. package/dist/core/web/public/next/assets/UsageSection-UUYDidOg.css +0 -1
  187. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js +0 -3
  188. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js.map +0 -1
  189. package/dist/core/web/public/next/assets/VerseConsoleApp-mOAXvWa6.css +0 -1
  190. package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js +0 -2
  191. package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js.map +0 -1
  192. package/dist/core/web/public/next/assets/format-fggwu_Rs.js +0 -2
  193. package/dist/core/web/public/next/assets/format-fggwu_Rs.js.map +0 -1
  194. package/dist/core/web/public/next/assets/global-BHjd6fVZ.js +0 -2
  195. package/dist/core/web/public/next/assets/global-BHjd6fVZ.js.map +0 -1
  196. package/dist/core/web/public/next/assets/global-BeRYd1Bu.css +0 -1
  197. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js +0 -2
  198. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js.map +0 -1
  199. package/dist/core/web/public/next/assets/index-CpgkRaTi.js +0 -51
  200. package/dist/core/web/public/next/assets/index-CpgkRaTi.js.map +0 -1
  201. package/dist/core/web/public/next/assets/queries-856qUN3Y.js +0 -2
  202. package/dist/core/web/public/next/assets/queries-856qUN3Y.js.map +0 -1
  203. package/dist/core/web/public/next/assets/use-guarded-action-Bqa2v0a-.css +0 -1
  204. package/dist/core/web/public/next/assets/use-guarded-action-DwaESKVy.js +0 -2
  205. package/dist/core/web/public/next/assets/use-guarded-action-DwaESKVy.js.map +0 -1
  206. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js +0 -2
  207. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js.map +0 -1
  208. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js +0 -2
  209. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js.map +0 -1
  210. /package/node_modules/marked/{LICENSE.md → LICENSE} +0 -0
@@ -0,0 +1,511 @@
1
+ /**
2
+ * The proxy supervisor: start, adopt, stop and inspect the Anthropic lane.
3
+ *
4
+ * supervisor.ts, for the second process. The lifecycle is deliberately the same
5
+ * boring, idempotent shape, because an operator who has learned how
6
+ * `local-runtime start` treats llama-server should not have to learn a second
7
+ * set of rules for the listener in front of it:
8
+ *
9
+ * * `ensure` on a healthy proxy of ours is a no-op that says so;
10
+ * * a proxy already on the port that we can PROVE is ours is ADOPTED, never
11
+ * duplicated — the ordinary case, since every CLI invocation is a new
12
+ * process that spawned none of them;
13
+ * * a listener we cannot prove is ours is REFUSED, never killed;
14
+ * * `stop` with nothing running is a success, not an error;
15
+ * * a record that no longer describes a live process of ours is discarded
16
+ * rather than acted on, so a recycled pid can never become a kill.
17
+ *
18
+ * ONE DEPARTURE from llama-server's lifecycle, and it is deliberate: when we
19
+ * own the proxy but it is forwarding to a DIFFERENT llama-server than the one
20
+ * being started, it is restarted rather than reported. llama-server cannot be
21
+ * repointed cheaply — it holds 27 GB of mapped weights — so `start` there can
22
+ * only describe the drift. A proxy is a socket and a pipe; leaving one quietly
23
+ * forwarding to a runtime nobody is using is the two-endpoints failure this
24
+ * module family exists to make impossible, and here we can simply fix it.
25
+ *
26
+ * Nothing here consults `~/.ashlr/KILL`, creates it, or removes it.
27
+ */
28
+ import { spawn } from 'node:child_process';
29
+ import { request as httpRequest } from 'node:http';
30
+ import { connect } from 'node:net';
31
+ import { closeSync, mkdirSync, openSync } from 'node:fs';
32
+ import { homedir } from 'node:os';
33
+ import { allowsNonLoopback, gateBindHost, originFor, resolveLlamaRuntimeConfig, } from './config.js';
34
+ import { anthropicProxyStderrLogPath, anthropicProxyStdoutLogPath, logsDir } from './paths.js';
35
+ import { isPortFree } from './port.js';
36
+ import { processAlive, processArgv, sleep, terminateTree } from './process.js';
37
+ import { anthropicProxyHostInvocation, argvMatchesProxyRecord, currentHostInvocationContext, findAnthropicProxiesOnPort, } from './proxy-process.js';
38
+ import { clearAnthropicProxyRecord, readAnthropicProxyRecord, writeAnthropicProxyRecord, } from './proxy-record.js';
39
+ /**
40
+ * How long `ensure` waits for a freshly spawned host to answer.
41
+ *
42
+ * Unlike llama-server's five minutes this is short on purpose: the child binds
43
+ * a socket and opens a pipe. It loads no weights, so anything past a couple of
44
+ * seconds is a failure to launch, not a slow start, and a generous deadline
45
+ * would only delay the operator learning that.
46
+ */
47
+ export const DEFAULT_PROXY_START_TIMEOUT_MS = 10_000;
48
+ /** Poll interval while waiting for the host to answer. */
49
+ const PROXY_POLL_MS = 100;
50
+ /** How long a single liveness probe may take. Loopback; nothing to wait for. */
51
+ const PROBE_TIMEOUT_MS = 1_500;
52
+ /** How long `stop` waits for the port to be released after the kill. */
53
+ const PORT_RELEASE_TIMEOUT_MS = 5_000;
54
+ /**
55
+ * Resolve where the proxy belongs.
56
+ *
57
+ * The host comes from the PERSISTED config and is re-gated here; it is
58
+ * deliberately not an option on this interface. Ports are ordinary overrides —
59
+ * `--port` genuinely has to move both endpoints — but a bind host is the one
60
+ * value an argument must never be able to supply, because the thing behind this
61
+ * listener has no authentication at all.
62
+ */
63
+ function resolveTarget(options) {
64
+ const runtime = resolveLlamaRuntimeConfig(options.cfg);
65
+ const { host } = gateBindHost(runtime.host, allowsNonLoopback(options.cfg));
66
+ const port = options.port ?? runtime.anthropicPort;
67
+ const upstreamPort = options.upstreamPort ?? runtime.port;
68
+ const origin = originFor(host, port);
69
+ return {
70
+ host,
71
+ port,
72
+ upstreamPort,
73
+ upstreamOrigin: originFor(host, upstreamPort),
74
+ origin,
75
+ baseUrl: `${origin}/v1`,
76
+ };
77
+ }
78
+ /**
79
+ * Does this port accept a TCP connection?
80
+ *
81
+ * This — not an HTTP round trip — is what "the child we just spawned has bound
82
+ * its socket" actually means, and it is deliberately the weaker question.
83
+ *
84
+ * The proxy pipes every path but `/v1/messages` byte-for-byte to llama-server
85
+ * and answers NOTHING for itself; that invariant is load-bearing (see the
86
+ * anthropic-proxy.ts header) and is not worth breaking for a health endpoint.
87
+ * The consequence is that an HTTP probe through the proxy measures llama-server
88
+ * too: a wedged upstream that accepts connections and never replies would make
89
+ * a perfectly healthy proxy look dead, and `start` would then report failure
90
+ * for a lane that was working. Asking the narrower question keeps the two
91
+ * processes' health independent, which is the whole reason they are two
92
+ * processes.
93
+ *
94
+ * Paired with `processAlive(pid)` on a pid we spawned, onto a port `isPortFree`
95
+ * said was free moments earlier, this is a sound proof of ownership.
96
+ *
97
+ * Never throws; an unreachable port is `false`, not an exception.
98
+ */
99
+ export function anthropicProxyAccepts(host, port, timeoutMs = PROBE_TIMEOUT_MS) {
100
+ return new Promise((resolve) => {
101
+ let settled = false;
102
+ const finish = (alive) => {
103
+ if (settled)
104
+ return;
105
+ settled = true;
106
+ try {
107
+ socket.destroy();
108
+ }
109
+ catch {
110
+ // Already gone.
111
+ }
112
+ resolve(alive);
113
+ };
114
+ const socket = connect({ host, port });
115
+ socket.setTimeout(timeoutMs);
116
+ socket.once('connect', () => finish(true));
117
+ socket.once('error', () => finish(false));
118
+ socket.once('timeout', () => finish(false));
119
+ });
120
+ }
121
+ /**
122
+ * Is a proxy answering HTTP on this host/port, end to end?
123
+ *
124
+ * ANY HTTP response counts, including a 502. That is not laziness: a 502 from
125
+ * this listener means the proxy is up and llama-server is not, which is exactly
126
+ * the proxy being healthy at the only job it has. Requiring a 200 would make
127
+ * the Anthropic lane un-reportable whenever the runtime behind it was still
128
+ * loading.
129
+ *
130
+ * Used for REPORTING (`status`), not for lifecycle decisions — see
131
+ * {@link anthropicProxyAccepts} for why the two are separate questions.
132
+ *
133
+ * Never throws; an unreachable port is `false`, not an exception.
134
+ */
135
+ export function anthropicProxyResponds(host, port, timeoutMs = PROBE_TIMEOUT_MS) {
136
+ return new Promise((resolve) => {
137
+ let settled = false;
138
+ const finish = (alive) => {
139
+ if (settled)
140
+ return;
141
+ settled = true;
142
+ resolve(alive);
143
+ };
144
+ let req;
145
+ try {
146
+ req = httpRequest({ hostname: host, port, path: '/health', method: 'GET', timeout: timeoutMs }, (res) => {
147
+ // The status is irrelevant — that bytes came back at all is the fact.
148
+ res.resume();
149
+ finish(true);
150
+ });
151
+ }
152
+ catch {
153
+ finish(false);
154
+ return;
155
+ }
156
+ req.on('error', () => finish(false));
157
+ req.on('timeout', () => {
158
+ req.destroy();
159
+ finish(false);
160
+ });
161
+ req.end();
162
+ });
163
+ }
164
+ /** Does the record describe a live proxy host of ours on this port? */
165
+ function recordIsLive(record, port) {
166
+ if (record.port !== port || record.pid <= 1)
167
+ return false;
168
+ if (!processAlive(record.pid))
169
+ return false;
170
+ const argv = processArgv(record.pid);
171
+ return argv !== null && argvMatchesProxyRecord(argv, record);
172
+ }
173
+ /** Build the record for a host process we spawned or adopted. */
174
+ function recordFor(target, pid, execPath, owner) {
175
+ return {
176
+ schemaVersion: 1,
177
+ pid,
178
+ port: target.port,
179
+ host: target.host,
180
+ execPath,
181
+ upstreamPort: target.upstreamPort,
182
+ upstreamOrigin: target.upstreamOrigin,
183
+ startedAt: new Date().toISOString(),
184
+ owner,
185
+ };
186
+ }
187
+ /**
188
+ * Adopt a proxy host already on our port that we can prove is ours.
189
+ *
190
+ * "Prove" is the process table showing exactly ONE process whose argv is this
191
+ * CLI re-entering itself on this port. Ambiguity (two matches) is reported
192
+ * rather than guessed at, exactly as llama-server's adoption does — the cost of
193
+ * guessing wrong is terminating a stranger.
194
+ */
195
+ function adoptRunning(target) {
196
+ const candidates = findAnthropicProxiesOnPort(target.port);
197
+ if (candidates.length !== 1)
198
+ return null;
199
+ const found = candidates[0];
200
+ // The upstream is NOT recoverable from an adopted process's argv with any
201
+ // confidence beyond the port it was told to forward to, and that is exactly
202
+ // what argv carries — so it is read back from there rather than assumed to be
203
+ // the one we wanted. A mismatch is then visible to the caller instead of
204
+ // being overwritten by a record that says what we hoped.
205
+ const upstreamPort = upstreamPortFromArgv(found.argv) ?? target.upstreamPort;
206
+ return {
207
+ schemaVersion: 1,
208
+ pid: found.pid,
209
+ port: target.port,
210
+ host: target.host,
211
+ execPath: found.execPath,
212
+ upstreamPort,
213
+ upstreamOrigin: originFor(target.host, upstreamPort),
214
+ startedAt: new Date().toISOString(),
215
+ owner: 'adopted',
216
+ };
217
+ }
218
+ /** Recover `--upstream-port` from an argv line. Pure; null when absent. */
219
+ export function upstreamPortFromArgv(argv) {
220
+ const match = /(?:^|\s)--upstream-port(?:=|\s+)(\d{1,5})(?:\s|$)/.exec(argv);
221
+ if (match === null)
222
+ return null;
223
+ const port = Number.parseInt(match[1], 10);
224
+ return Number.isInteger(port) && port >= 1 && port <= 65_535 ? port : null;
225
+ }
226
+ /** Spawn the detached host. Returns its pid, or an error to report. */
227
+ function spawnHost(target, options) {
228
+ let outFd;
229
+ let errFd;
230
+ try {
231
+ mkdirSync(logsDir(), { recursive: true, mode: 0o700 });
232
+ outFd = openSync(anthropicProxyStdoutLogPath(), 'a', 0o600);
233
+ errFd = openSync(anthropicProxyStderrLogPath(), 'a', 0o600);
234
+ }
235
+ catch (err) {
236
+ return { error: `could not open the proxy logs: ${err instanceof Error ? err.message : String(err)}` };
237
+ }
238
+ const build = options.invocation ??
239
+ ((port, upstreamPort) => anthropicProxyHostInvocation(port, upstreamPort, currentHostInvocationContext(import.meta.url)));
240
+ const invocation = build(target.port, target.upstreamPort);
241
+ try {
242
+ const child = spawn(invocation.command, invocation.args, {
243
+ // Detached + unref, for the same reason llama-server is: the listener
244
+ // must outlive the CLI invocation that started it. That is the entire
245
+ // difference between a service and a process that dies with its terminal.
246
+ detached: true,
247
+ stdio: ['ignore', outFd, errFd],
248
+ cwd: homedir(),
249
+ });
250
+ child.unref();
251
+ if (child.pid === undefined)
252
+ return { error: 'the proxy host was spawned but reported no pid' };
253
+ return { pid: child.pid, execPath: invocation.command };
254
+ }
255
+ catch (err) {
256
+ return {
257
+ error: `could not spawn the proxy host: ${err instanceof Error ? err.message : String(err)}`,
258
+ };
259
+ }
260
+ finally {
261
+ try {
262
+ closeSync(outFd);
263
+ closeSync(errFd);
264
+ }
265
+ catch {
266
+ // The child holds its own duplicates; ours are merely tidied up.
267
+ }
268
+ }
269
+ }
270
+ function failed(detail, target) {
271
+ return { ok: false, action: 'failed', detail, record: null, baseUrl: target.baseUrl };
272
+ }
273
+ /**
274
+ * Bring up the detached proxy, or prove one is already up.
275
+ *
276
+ * Never throws and never fails loudly for an expected state: llama-server
277
+ * serving correctly is still a success even when the Anthropic lane in front of
278
+ * it could not bind, so the caller gets a value it can fold into its own
279
+ * sentence rather than an exception it can forget to catch.
280
+ */
281
+ export async function ensureDetachedAnthropicProxy(options = {}) {
282
+ const target = resolveTarget(options);
283
+ const existing = readAnthropicProxyRecord();
284
+ if (existing !== null && recordIsLive(existing, target.port)) {
285
+ if (existing.upstreamOrigin === target.upstreamOrigin) {
286
+ return {
287
+ ok: true,
288
+ action: 'already-running',
289
+ detail: `the Anthropic proxy is already serving on ${target.origin} ` +
290
+ `(pid ${existing.pid}) and forwarding to ${existing.upstreamOrigin}`,
291
+ record: existing,
292
+ baseUrl: target.baseUrl,
293
+ };
294
+ }
295
+ // Ours, but pointed at the wrong llama-server. See the module header: a
296
+ // proxy is cheap to replace and a mis-pointed one is a lane that accepts
297
+ // every request and answers none of them usefully.
298
+ await terminateTree(existing.pid);
299
+ clearAnthropicProxyRecord();
300
+ const respawned = await launch(target, options);
301
+ return respawned.ok && respawned.action === 'started'
302
+ ? {
303
+ ...respawned,
304
+ action: 'restarted',
305
+ detail: `repointed the Anthropic proxy on ${target.origin} from ` +
306
+ `${existing.upstreamOrigin} to ${target.upstreamOrigin}`,
307
+ }
308
+ : respawned;
309
+ }
310
+ // A record that does not describe a live process of ours is worthless, and a
311
+ // worthless record must never become a kill decision.
312
+ if (existing !== null)
313
+ clearAnthropicProxyRecord();
314
+ const portBusy = !(await isPortFree(target.host, target.port));
315
+ if (portBusy) {
316
+ const adopted = adoptRunning(target);
317
+ if (adopted !== null) {
318
+ writeAnthropicProxyRecord(adopted);
319
+ if (adopted.upstreamOrigin !== target.upstreamOrigin) {
320
+ // Adopted, then repointed: now that it is ours we can fix it, and the
321
+ // alternative is a managed proxy we know is wrong.
322
+ await terminateTree(adopted.pid);
323
+ clearAnthropicProxyRecord();
324
+ const respawned = await launch(target, options);
325
+ return respawned.ok && respawned.action === 'started'
326
+ ? {
327
+ ...respawned,
328
+ action: 'restarted',
329
+ detail: `adopted the Anthropic proxy on ${target.origin} and repointed it from ` +
330
+ `${adopted.upstreamOrigin} to ${target.upstreamOrigin}`,
331
+ }
332
+ : respawned;
333
+ }
334
+ return {
335
+ ok: true,
336
+ action: 'adopted',
337
+ detail: `adopted the Anthropic proxy already running on ${target.origin} ` +
338
+ `(pid ${adopted.pid}) — it is now managed`,
339
+ record: adopted,
340
+ baseUrl: target.baseUrl,
341
+ };
342
+ }
343
+ // REFUSED, not killed. Whatever is on this port, we cannot prove it is
344
+ // ours, and the convention across this module family is that an
345
+ // unidentifiable listener is the operator's to deal with.
346
+ const strangers = findAnthropicProxiesOnPort(target.port);
347
+ return {
348
+ ok: false,
349
+ action: 'refused',
350
+ detail: `${target.host}:${target.port} is occupied by something we do not own` +
351
+ (strangers.length > 1
352
+ ? ` (${strangers.length} proxy hosts claim it: pids ${strangers.map((s) => s.pid).join(', ')})`
353
+ : '') +
354
+ `, so the Anthropic proxy was not started. Free it, or choose another port with ` +
355
+ 'models.llamaServer.anthropicPort.',
356
+ record: null,
357
+ baseUrl: target.baseUrl,
358
+ };
359
+ }
360
+ return launch(target, options);
361
+ }
362
+ /** Spawn, record, and wait for the host to answer. */
363
+ async function launch(target, options) {
364
+ const spawned = spawnHost(target, options);
365
+ if ('error' in spawned)
366
+ return failed(spawned.error, target);
367
+ const record = recordFor(target, spawned.pid, spawned.execPath, 'cli');
368
+ // Recorded BEFORE the wait: a supervisor killed mid-wait must still leave
369
+ // behind something the next start can reclaim.
370
+ const recorded = writeAnthropicProxyRecord(record);
371
+ const deadline = Date.now() + (options.timeoutMs ?? DEFAULT_PROXY_START_TIMEOUT_MS);
372
+ while (Date.now() < deadline) {
373
+ if (!processAlive(spawned.pid)) {
374
+ clearAnthropicProxyRecord();
375
+ return failed(`the Anthropic proxy host exited while starting; see ${anthropicProxyStderrLogPath()}`, target);
376
+ }
377
+ if (await anthropicProxyAccepts(target.host, target.port)) {
378
+ return {
379
+ ok: true,
380
+ action: 'started',
381
+ detail: `the Anthropic proxy is serving on ${target.origin} (pid ${spawned.pid}) and ` +
382
+ `forwarding to ${target.upstreamOrigin}` +
383
+ (recorded ? '' : ' — WARNING: the ownership record could not be written'),
384
+ record,
385
+ baseUrl: target.baseUrl,
386
+ };
387
+ }
388
+ await sleep(PROXY_POLL_MS);
389
+ }
390
+ return failed(`the Anthropic proxy host did not answer on ${target.origin} within ` +
391
+ `${Math.round((options.timeoutMs ?? DEFAULT_PROXY_START_TIMEOUT_MS) / 1000)}s ` +
392
+ `(pid ${spawned.pid}); see ${anthropicProxyStderrLogPath()}`, target);
393
+ }
394
+ /**
395
+ * Stop the detached proxy and release the port.
396
+ *
397
+ * Idempotent: stopping what is not running is `not-running` and `ok: true`, not
398
+ * an error. A listener we cannot prove is ours is refused rather than killed,
399
+ * unless `force` is given — the same bargain `local-runtime stop --force`
400
+ * offers for llama-server.
401
+ */
402
+ export async function stopDetachedAnthropicProxy(options = {}) {
403
+ const target = resolveTarget(options);
404
+ const record = readAnthropicProxyRecord();
405
+ let killedPid = null;
406
+ if (record !== null && recordIsLive(record, target.port)) {
407
+ await terminateTree(record.pid);
408
+ killedPid = record.pid;
409
+ clearAnthropicProxyRecord();
410
+ }
411
+ else {
412
+ // A proxy host carrying our internal flag on our port IS one of ours even
413
+ // with no record: the flag is undocumented, absent from parsing, help and
414
+ // completions, and reachable only from this program spawning itself. A
415
+ // previous CLI run whose record was lost is the ordinary way to get here,
416
+ // and refusing would leave a port nothing in this tool could ever free.
417
+ const ours = findAnthropicProxiesOnPort(target.port).filter((found) => processAlive(found.pid));
418
+ if (ours.length > 0) {
419
+ for (const found of ours) {
420
+ await terminateTree(found.pid);
421
+ killedPid = found.pid;
422
+ }
423
+ clearAnthropicProxyRecord();
424
+ }
425
+ else if (record !== null) {
426
+ // The record describes a corpse; dropping it is safe.
427
+ clearAnthropicProxyRecord();
428
+ }
429
+ }
430
+ if (killedPid === null) {
431
+ // Nothing of ours was there. Is something ELSE holding the port?
432
+ const free = await isPortFree(target.host, target.port);
433
+ if (!free && options.force !== true) {
434
+ return {
435
+ ok: false,
436
+ action: 'refused',
437
+ detail: `${target.host}:${target.port} is held by a listener we do not own, so it was left ` +
438
+ 'alone. Re-run with --force to terminate it.',
439
+ record: null,
440
+ baseUrl: target.baseUrl,
441
+ };
442
+ }
443
+ return {
444
+ ok: true,
445
+ action: 'not-running',
446
+ detail: `no Anthropic proxy of ours was serving on ${target.origin}`,
447
+ record: null,
448
+ baseUrl: target.baseUrl,
449
+ };
450
+ }
451
+ // A dead process is not a released port: wait for the socket to actually go.
452
+ const deadline = Date.now() + PORT_RELEASE_TIMEOUT_MS;
453
+ let portFree = await isPortFree(target.host, target.port);
454
+ while (!portFree && Date.now() < deadline) {
455
+ await sleep(PROXY_POLL_MS);
456
+ portFree = await isPortFree(target.host, target.port);
457
+ }
458
+ return {
459
+ ok: portFree,
460
+ action: portFree ? 'stopped' : 'failed',
461
+ detail: portFree
462
+ ? `stopped the Anthropic proxy (pid ${killedPid}); ${target.host}:${target.port} is free`
463
+ : `terminated pid ${killedPid} but ${target.host}:${target.port} is not free yet`,
464
+ record: null,
465
+ baseUrl: target.baseUrl,
466
+ };
467
+ }
468
+ /** Read the proxy's state without changing anything. Never throws. */
469
+ export async function statusDetachedAnthropicProxy(options = {}) {
470
+ const target = resolveTarget(options);
471
+ const record = readAnthropicProxyRecord();
472
+ const live = record !== null && recordIsLive(record, target.port);
473
+ // The narrow question here too. `status` must answer about the PROXY, not
474
+ // about llama-server: this command family already has a surface that reports
475
+ // the runtime's health (`local-runtime status`), and a second one that
476
+ // silently conflates the two is how an operator ends up restarting the wrong
477
+ // process. It also means `status` cannot hang on a wedged upstream.
478
+ const responds = await anthropicProxyAccepts(target.host, target.port);
479
+ if (live && responds) {
480
+ return {
481
+ ok: true,
482
+ action: 'already-running',
483
+ detail: `the Anthropic proxy is serving on ${target.origin} (pid ${record.pid}, ` +
484
+ `${record.owner}) and forwarding to ` +
485
+ `${record.upstreamOrigin}`,
486
+ record,
487
+ baseUrl: target.baseUrl,
488
+ };
489
+ }
490
+ if (responds) {
491
+ const ours = findAnthropicProxiesOnPort(target.port);
492
+ return {
493
+ ok: true,
494
+ action: 'already-running',
495
+ detail: `something is answering on ${target.origin}` +
496
+ (ours.length === 1
497
+ ? ` — an unmanaged proxy host (pid ${ours[0].pid}); \`start\` will adopt it`
498
+ : ', but we do not own it'),
499
+ record: null,
500
+ baseUrl: target.baseUrl,
501
+ };
502
+ }
503
+ return {
504
+ ok: false,
505
+ action: 'not-running',
506
+ detail: `nothing is answering on ${target.origin}`,
507
+ record: null,
508
+ baseUrl: target.baseUrl,
509
+ };
510
+ }
511
+ //# sourceMappingURL=proxy-supervisor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy-supervisor.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/proxy-supervisor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EA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