@ashlr/hub 3.4.0 → 3.5.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 (213) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/README.md +3 -0
  3. package/dist/build-identity.json +2 -2
  4. package/dist/cli/index.js +11 -0
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/cli/local-runtime.js +40 -9
  7. package/dist/cli/local-runtime.js.map +1 -1
  8. package/dist/core/local-eval/classify.d.ts +57 -0
  9. package/dist/core/local-eval/classify.js +121 -0
  10. package/dist/core/local-eval/classify.js.map +1 -0
  11. package/dist/core/local-eval/configuration.d.ts +37 -0
  12. package/dist/core/local-eval/configuration.js +171 -0
  13. package/dist/core/local-eval/configuration.js.map +1 -0
  14. package/dist/core/local-eval/index.d.ts +15 -0
  15. package/dist/core/local-eval/index.js +16 -0
  16. package/dist/core/local-eval/index.js.map +1 -0
  17. package/dist/core/local-eval/main.d.ts +31 -0
  18. package/dist/core/local-eval/main.js +174 -0
  19. package/dist/core/local-eval/main.js.map +1 -0
  20. package/dist/core/local-eval/report.d.ts +25 -0
  21. package/dist/core/local-eval/report.js +157 -0
  22. package/dist/core/local-eval/report.js.map +1 -0
  23. package/dist/core/local-eval/runner.d.ts +55 -0
  24. package/dist/core/local-eval/runner.js +290 -0
  25. package/dist/core/local-eval/runner.js.map +1 -0
  26. package/dist/core/local-eval/tasks.d.ts +22 -0
  27. package/dist/core/local-eval/tasks.js +303 -0
  28. package/dist/core/local-eval/tasks.js.map +1 -0
  29. package/dist/core/local-eval/trace.d.ts +67 -0
  30. package/dist/core/local-eval/trace.js +309 -0
  31. package/dist/core/local-eval/trace.js.map +1 -0
  32. package/dist/core/local-eval/types.d.ts +262 -0
  33. package/dist/core/local-eval/types.js +23 -0
  34. package/dist/core/local-eval/types.js.map +1 -0
  35. package/dist/core/local-runtime/llama/anthropic-proxy-host.d.ts +68 -0
  36. package/dist/core/local-runtime/llama/anthropic-proxy-host.js +120 -0
  37. package/dist/core/local-runtime/llama/anthropic-proxy-host.js.map +1 -0
  38. package/dist/core/local-runtime/llama/anthropic-proxy-process.d.ts +15 -0
  39. package/dist/core/local-runtime/llama/anthropic-proxy-process.js +21 -0
  40. package/dist/core/local-runtime/llama/anthropic-proxy-process.js.map +1 -0
  41. package/dist/core/local-runtime/llama/anthropic-proxy.d.ts +2 -1
  42. package/dist/core/local-runtime/llama/anthropic-proxy.js +14 -6
  43. package/dist/core/local-runtime/llama/anthropic-proxy.js.map +1 -1
  44. package/dist/core/local-runtime/llama/anthropic-shim.d.ts +33 -0
  45. package/dist/core/local-runtime/llama/anthropic-shim.js +59 -0
  46. package/dist/core/local-runtime/llama/anthropic-shim.js.map +1 -1
  47. package/dist/core/local-runtime/llama/config.d.ts +101 -6
  48. package/dist/core/local-runtime/llama/config.js +174 -6
  49. package/dist/core/local-runtime/llama/config.js.map +1 -1
  50. package/dist/core/local-runtime/llama/index.d.ts +15 -0
  51. package/dist/core/local-runtime/llama/index.js +13 -0
  52. package/dist/core/local-runtime/llama/index.js.map +1 -1
  53. package/dist/core/local-runtime/llama/paths.d.ts +17 -0
  54. package/dist/core/local-runtime/llama/paths.js +25 -0
  55. package/dist/core/local-runtime/llama/paths.js.map +1 -1
  56. package/dist/core/local-runtime/llama/proxy-invocation.d.ts +101 -0
  57. package/dist/core/local-runtime/llama/proxy-invocation.js +134 -0
  58. package/dist/core/local-runtime/llama/proxy-invocation.js.map +1 -0
  59. package/dist/core/local-runtime/llama/proxy-launchd.d.ts +83 -0
  60. package/dist/core/local-runtime/llama/proxy-launchd.js +216 -0
  61. package/dist/core/local-runtime/llama/proxy-launchd.js.map +1 -0
  62. package/dist/core/local-runtime/llama/shapes.d.ts +2 -1
  63. package/dist/core/local-runtime/llama/shapes.js +2 -1
  64. package/dist/core/local-runtime/llama/shapes.js.map +1 -1
  65. package/dist/core/verse/adapters/claude.js +16 -0
  66. package/dist/core/verse/adapters/claude.js.map +1 -1
  67. package/dist/core/verse/adapters/codex.js +60 -2
  68. package/dist/core/verse/adapters/codex.js.map +1 -1
  69. package/dist/core/verse/adapters/grok.js +13 -0
  70. package/dist/core/verse/adapters/grok.js.map +1 -1
  71. package/dist/core/verse/control-api.d.ts +8 -9
  72. package/dist/core/verse/control-api.js +14 -114
  73. package/dist/core/verse/control-api.js.map +1 -1
  74. package/dist/core/verse/github-api.d.ts +50 -0
  75. package/dist/core/verse/github-api.js +211 -0
  76. package/dist/core/verse/github-api.js.map +1 -0
  77. package/dist/core/verse/github-proposal.d.ts +64 -0
  78. package/dist/core/verse/github-proposal.js +186 -0
  79. package/dist/core/verse/github-proposal.js.map +1 -0
  80. package/dist/core/verse/github-repo.d.ts +104 -0
  81. package/dist/core/verse/github-repo.js +476 -0
  82. package/dist/core/verse/github-repo.js.map +1 -0
  83. package/dist/core/verse/github-types.d.ts +174 -0
  84. package/dist/core/verse/github-types.js +31 -0
  85. package/dist/core/verse/github-types.js.map +1 -0
  86. package/dist/core/verse/mcp-cli-health.d.ts +149 -0
  87. package/dist/core/verse/mcp-cli-health.js +227 -0
  88. package/dist/core/verse/mcp-cli-health.js.map +1 -0
  89. package/dist/core/verse/mcp-control-api.d.ts +68 -0
  90. package/dist/core/verse/mcp-control-api.js +322 -0
  91. package/dist/core/verse/mcp-control-api.js.map +1 -0
  92. package/dist/core/verse/mcp-mutation.d.ts +187 -0
  93. package/dist/core/verse/mcp-mutation.js +471 -0
  94. package/dist/core/verse/mcp-mutation.js.map +1 -0
  95. package/dist/core/verse/mcp-scope.d.ts +114 -0
  96. package/dist/core/verse/mcp-scope.js +149 -0
  97. package/dist/core/verse/mcp-scope.js.map +1 -0
  98. package/dist/core/verse/mcp-seat-view.d.ts +197 -0
  99. package/dist/core/verse/mcp-seat-view.js +322 -0
  100. package/dist/core/verse/mcp-seat-view.js.map +1 -0
  101. package/dist/core/verse/path-guard.d.ts +115 -0
  102. package/dist/core/verse/path-guard.js +171 -0
  103. package/dist/core/verse/path-guard.js.map +1 -0
  104. package/dist/core/verse/seats.js +30 -2
  105. package/dist/core/verse/seats.js.map +1 -1
  106. package/dist/core/verse/session-engine.js +60 -1
  107. package/dist/core/verse/session-engine.js.map +1 -1
  108. package/dist/core/verse/session-store.js +20 -0
  109. package/dist/core/verse/session-store.js.map +1 -1
  110. package/dist/core/verse/types.d.ts +225 -1
  111. package/dist/core/verse/types.js +26 -0
  112. package/dist/core/verse/types.js.map +1 -1
  113. package/dist/core/verse/verse-api.d.ts +16 -1
  114. package/dist/core/verse/verse-api.js +338 -16
  115. package/dist/core/verse/verse-api.js.map +1 -1
  116. package/dist/core/verse/workspaces.d.ts +130 -0
  117. package/dist/core/verse/workspaces.js +501 -0
  118. package/dist/core/verse/workspaces.js.map +1 -0
  119. package/dist/core/web/api.js +23 -0
  120. package/dist/core/web/api.js.map +1 -1
  121. package/dist/core/web/public/next/assets/{App-LuILXjWG.js → App-CsbPYQqy.js} +2 -2
  122. package/dist/core/web/public/next/assets/{App-LuILXjWG.js.map → App-CsbPYQqy.js.map} +1 -1
  123. package/dist/core/web/public/next/assets/{ApprovalsSection-B_Xor8JH.js → ApprovalsSection-CBZquyLK.js} +2 -2
  124. package/dist/core/web/public/next/assets/{ApprovalsSection-B_Xor8JH.js.map → ApprovalsSection-CBZquyLK.js.map} +1 -1
  125. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js +2 -0
  126. package/dist/core/web/public/next/assets/{AutonomySection-BEwITtPJ.js.map → AutonomySection-CQVpEdCE.js.map} +1 -1
  127. package/dist/core/web/public/next/assets/AutonomySection-DTN6m6QE.css +1 -0
  128. package/dist/core/web/public/next/assets/ChatSection-DiRvNX3Q.css +1 -0
  129. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js +77 -0
  130. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js.map +1 -0
  131. package/dist/core/web/public/next/assets/{ConfirmDialog-BqkZdPs_.js → ConfirmDialog-deO0C0iY.js} +2 -2
  132. package/dist/core/web/public/next/assets/{ConfirmDialog-BqkZdPs_.js.map → ConfirmDialog-deO0C0iY.js.map} +1 -1
  133. package/dist/core/web/public/next/assets/{Dialog-CPmedg4S.js → Dialog-CNd7q89m.js} +2 -2
  134. package/dist/core/web/public/next/assets/{Dialog-CPmedg4S.js.map → Dialog-CNd7q89m.js.map} +1 -1
  135. package/dist/core/web/public/next/assets/{DiffViewer-DmPJbeM_.js → DiffViewer-DTO0KRuG.js} +2 -2
  136. package/dist/core/web/public/next/assets/{DiffViewer-DmPJbeM_.js.map → DiffViewer-DTO0KRuG.js.map} +1 -1
  137. package/dist/core/web/public/next/assets/{Epistemic-M3SxLHjq.js → Epistemic-53PikaUI.js} +2 -2
  138. package/dist/core/web/public/next/assets/{Epistemic-M3SxLHjq.js.map → Epistemic-53PikaUI.js.map} +1 -1
  139. package/dist/core/web/public/next/assets/{Meter-D_X7c9U3.js → Meter-DRWZQgr1.js} +2 -2
  140. package/dist/core/web/public/next/assets/{Meter-D_X7c9U3.js.map → Meter-DRWZQgr1.js.map} +1 -1
  141. package/dist/core/web/public/next/assets/{MutationTokenDialog-Ba5ZHu-8.js → MutationTokenDialog-DYF8n_RD.js} +2 -2
  142. package/dist/core/web/public/next/assets/{MutationTokenDialog-Ba5ZHu-8.js.map → MutationTokenDialog-DYF8n_RD.js.map} +1 -1
  143. package/dist/core/web/public/next/assets/{RefreshIndicator-vHGpmyzb.js → RefreshIndicator-DXJQXKyA.js} +2 -2
  144. package/dist/core/web/public/next/assets/{RefreshIndicator-vHGpmyzb.js.map → RefreshIndicator-DXJQXKyA.js.map} +1 -1
  145. package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-B5g6JEVk.js → ResourcePoolConsoleApp-hDSEFdLU.js} +2 -2
  146. package/dist/core/web/public/next/assets/{ResourcePoolConsoleApp-B5g6JEVk.js.map → ResourcePoolConsoleApp-hDSEFdLU.js.map} +1 -1
  147. package/dist/core/web/public/next/assets/{RouteErrorBoundary-CroxuKoi.js → RouteErrorBoundary-CZd7ln8v.js} +2 -2
  148. package/dist/core/web/public/next/assets/{RouteErrorBoundary-CroxuKoi.js.map → RouteErrorBoundary-CZd7ln8v.js.map} +1 -1
  149. package/dist/core/web/public/next/assets/{SettingsSection-p-7FCGfn.js → SettingsSection-C9Qs9JWW.js} +2 -2
  150. package/dist/core/web/public/next/assets/{SettingsSection-p-7FCGfn.js.map → SettingsSection-C9Qs9JWW.js.map} +1 -1
  151. package/dist/core/web/public/next/assets/{Skeleton-4qq4HuJO.js → Skeleton-YkcOpgFb.js} +2 -2
  152. package/dist/core/web/public/next/assets/{Skeleton-4qq4HuJO.js.map → Skeleton-YkcOpgFb.js.map} +1 -1
  153. package/dist/core/web/public/next/assets/{StatusBadge-BbEdqEGn.js → StatusBadge-DJw0LSPg.js} +2 -2
  154. package/dist/core/web/public/next/assets/{StatusBadge-BbEdqEGn.js.map → StatusBadge-DJw0LSPg.js.map} +1 -1
  155. package/dist/core/web/public/next/assets/{TableView-nyYs7Sv1.js → TableView-Bj-w1O6o.js} +2 -2
  156. package/dist/core/web/public/next/assets/{TableView-nyYs7Sv1.js.map → TableView-Bj-w1O6o.js.map} +1 -1
  157. package/dist/core/web/public/next/assets/{UniverseConsoleApp-DjTpQUrA.js → UniverseConsoleApp-Bs2fxaen.js} +2 -2
  158. package/dist/core/web/public/next/assets/{UniverseConsoleApp-DjTpQUrA.js.map → UniverseConsoleApp-Bs2fxaen.js.map} +1 -1
  159. package/dist/core/web/public/next/assets/{UniverseView-BtApwayT.js → UniverseView-B6b2hw-8.js} +2 -2
  160. package/dist/core/web/public/next/assets/{UniverseView-BtApwayT.js.map → UniverseView-B6b2hw-8.js.map} +1 -1
  161. package/dist/core/web/public/next/assets/{UsageSection-Db99N6ao.js → UsageSection-C__ziNkV.js} +2 -2
  162. package/dist/core/web/public/next/assets/{UsageSection-Db99N6ao.js.map → UsageSection-C__ziNkV.js.map} +1 -1
  163. package/dist/core/web/public/next/assets/{VerseConsoleApp-COa3J2dO.js → VerseConsoleApp-Cu5aG6J6.js} +3 -3
  164. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js.map +1 -0
  165. package/dist/core/web/public/next/assets/{global-CNVapoV1.js → global-BHjd6fVZ.js} +2 -2
  166. package/dist/core/web/public/next/assets/{global-CNVapoV1.js.map → global-BHjd6fVZ.js.map} +1 -1
  167. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js +2 -0
  168. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js.map +1 -0
  169. package/dist/core/web/public/next/assets/{index-BkUlX2Se.js → index-CpgkRaTi.js} +3 -3
  170. package/dist/core/web/public/next/assets/{index-BkUlX2Se.js.map → index-CpgkRaTi.js.map} +1 -1
  171. package/dist/core/web/public/next/assets/{queries-C9XS4SYq.js → queries-856qUN3Y.js} +2 -2
  172. package/dist/core/web/public/next/assets/{queries-C9XS4SYq.js.map → queries-856qUN3Y.js.map} +1 -1
  173. package/dist/core/web/public/next/assets/{use-guarded-action-Bql1nA-z.js → use-guarded-action-DwaESKVy.js} +2 -2
  174. package/dist/core/web/public/next/assets/{use-guarded-action-Bql1nA-z.js.map → use-guarded-action-DwaESKVy.js.map} +1 -1
  175. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js +2 -0
  176. package/dist/core/web/public/next/assets/{verse-model-IrNQKtER.js.map → verse-model-Dllo8rRt.js.map} +1 -1
  177. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js +2 -0
  178. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js.map +1 -0
  179. package/dist/core/web/public/next/index.html +1 -1
  180. package/dist/release-dependency-inventory.json +1 -1
  181. package/docs/README.md +4 -0
  182. package/package.json +1 -1
  183. package/dist/cli/activation.d.ts +0 -41
  184. package/dist/cli/activation.js +0 -485
  185. package/dist/cli/activation.js.map +0 -1
  186. package/dist/core/fleet/generated-repair-resolution.d.ts +0 -36
  187. package/dist/core/fleet/generated-repair-resolution.js +0 -245
  188. package/dist/core/fleet/generated-repair-resolution.js.map +0 -1
  189. package/dist/core/local-runtime/llama/port.d.ts +0 -17
  190. package/dist/core/local-runtime/llama/port.js +0 -47
  191. package/dist/core/local-runtime/llama/port.js.map +0 -1
  192. package/dist/core/local-runtime/llama/proxy-host.d.ts +0 -54
  193. package/dist/core/local-runtime/llama/proxy-host.js +0 -159
  194. package/dist/core/local-runtime/llama/proxy-host.js.map +0 -1
  195. package/dist/core/local-runtime/llama/proxy-process.d.ts +0 -148
  196. package/dist/core/local-runtime/llama/proxy-process.js +0 -250
  197. package/dist/core/local-runtime/llama/proxy-process.js.map +0 -1
  198. package/dist/core/local-runtime/llama/proxy-record.d.ts +0 -40
  199. package/dist/core/local-runtime/llama/proxy-record.js +0 -133
  200. package/dist/core/local-runtime/llama/proxy-record.js.map +0 -1
  201. package/dist/core/local-runtime/llama/proxy-supervisor.d.ts +0 -118
  202. package/dist/core/local-runtime/llama/proxy-supervisor.js +0 -511
  203. package/dist/core/local-runtime/llama/proxy-supervisor.js.map +0 -1
  204. package/dist/core/web/public/next/assets/AutonomySection-BB8RD-tv.css +0 -1
  205. package/dist/core/web/public/next/assets/AutonomySection-BEwITtPJ.js +0 -2
  206. package/dist/core/web/public/next/assets/ChatSection-DrxqhBPK.css +0 -1
  207. package/dist/core/web/public/next/assets/ChatSection-bRAzlMth.js +0 -77
  208. package/dist/core/web/public/next/assets/ChatSection-bRAzlMth.js.map +0 -1
  209. package/dist/core/web/public/next/assets/VerseConsoleApp-COa3J2dO.js.map +0 -1
  210. package/dist/core/web/public/next/assets/index-YNTgDG2b.js +0 -2
  211. package/dist/core/web/public/next/assets/index-YNTgDG2b.js.map +0 -1
  212. package/dist/core/web/public/next/assets/verse-model-IrNQKtER.js +0 -2
  213. package/node_modules/which/CHANGELOG.md +0 -166
@@ -34,12 +34,27 @@ export const DEFAULT_LLAMA_SLOTS = 4;
34
34
  * did not fit in its context before a single turn began, which is a failure
35
35
  * with no useful error attached.
36
36
  *
37
- * 262,144 is Qwen3.8 27B's native trained context, not a guess. Measured on a
38
- * 128 GB machine: raising `-c` from 131,072 to 262,144 moved resident memory
39
- * from 46.2 GB to 43.4 GB — no increase at all, because Qwen3.8 runs linear
40
- * attention on 48 of its 64 layers and only 16 carry a full KV cache. Verified
41
- * with a real agent turn afterwards: correct edit, prefix cache still reusing
42
- * (23,301 cold, then 56 and 306 tokens).
37
+ * 262,144 is Qwen3.8 27B's native trained context.
38
+ *
39
+ * CORRECTION. This comment previously claimed raising `-c` from 131,072 to
40
+ * 262,144 cost no extra memory, citing 46.2 GB falling to 43.4 GB. That
41
+ * comparison was invalid: the 46.2 GB reading came from a process that had been
42
+ * serving for hours with a populated cache, the 43.4 GB from one measured
43
+ * seconds after startup with an empty one. Warm against cold, no control.
44
+ *
45
+ * The arithmetic contradicts it. From the model card — 4 KV heads, 256 head
46
+ * dim, fp16 K and V, and 16 of 64 layers carrying a full KV cache — the cache
47
+ * costs 64 KiB per token: 8 GiB at 131,072 and 16 GiB at 262,144. The same
48
+ * process later measured 47.0 GB resident, consistent with the cache filling.
49
+ *
50
+ * So the honest statement is: this costs up to ~8 GiB more than 131,072 once
51
+ * the cache is populated, which a 128 GB machine carries comfortably. The 48
52
+ * linear-attention layers do make it far cheaper than a full-attention model of
53
+ * this size would be, but "free" was wrong.
54
+ *
55
+ * Verified separately and still true: a real agent turn at this setting made
56
+ * the correct edit with the prefix cache reusing (23,301 cold, then 56 and 306
57
+ * tokens).
43
58
  *
44
59
  * Operators on less memory override it with `--ctx` or
45
60
  * `models.llamaServer.contextSize`.
@@ -57,6 +72,97 @@ export const DEFAULT_LLAMA_CONTEXT = 262_144;
57
72
  export const DEFAULT_ANTHROPIC_PROXY_PORT = 8081;
58
73
  /** The historical base URL, pinned by test/m144.llama-server.test.ts. */
59
74
  export const LEGACY_DEFAULT_BASE_URL = `http://localhost:${DEFAULT_LLAMA_PORT}/v1`;
75
+ /**
76
+ * The reasoning efforts Qwen3.8's chat template will actually accept.
77
+ *
78
+ * MEASURED against the live template, with a deliberately bogus value as a
79
+ * control (both behave identically, which is how we know the check is real):
80
+ *
81
+ * reasoning_effort=xhigh -> 200, and it is the template's OWN default
82
+ * reasoning_effort=medium -> 200
83
+ * reasoning_effort=low -> 200
84
+ * reasoning_effort=high -> 500 raise_exception('Unexpected reasoning effort high')
85
+ * reasoning_effort=bogus -> 500 (the control)
86
+ *
87
+ * `high` is the trap: it is the spelling every other vendor uses, it is what
88
+ * Claude Code itself puts in `output_config.effort`, and it is fatal here —
89
+ * a template exception fires BEFORE inference, so the turn dies with no
90
+ * partial output. Hence a closed list rather than a string passthrough.
91
+ */
92
+ export const LOCAL_AGENT_REASONING_EFFORTS = ['low', 'medium', 'xhigh'];
93
+ /** Every field null — "change nothing", the shipping default. */
94
+ export const NO_LOCAL_AGENT_DEFAULTS = {
95
+ reasoningEffort: null, temperature: null, topP: null, topK: null,
96
+ };
97
+ /** A finite number in range, or undefined. Never throws on junk. */
98
+ function num(value, min, max) {
99
+ const parsed = typeof value === 'number' ? value : Number.parseFloat(String(value ?? ''));
100
+ if (!Number.isFinite(parsed) || parsed < min || parsed > max)
101
+ return undefined;
102
+ return parsed;
103
+ }
104
+ /**
105
+ * Resolve the local agent lane's per-request defaults.
106
+ *
107
+ * WHY THESE ARE ALL OFF BY DEFAULT — the measurements, so the next person
108
+ * does not have to re-derive them.
109
+ *
110
+ * REASONING EFFORT is the largest lever measured on this runtime, and it is
111
+ * currently unreachable. The template defaults to `xhigh`; Claude Code's own
112
+ * `output_config.effort` is dropped on the floor by llama-server (verified:
113
+ * sending it changes nothing), so no caller can ask for less. Holding
114
+ * sampling at greedy and varying only the effort, on identical tool-calling
115
+ * prompts, the DECODE TOKEN COUNT for the same correct answer was:
116
+ *
117
+ * task xhigh medium low thinking-off
118
+ * verbatim_sha 536 218 141 64
119
+ * verbatim_oddpath 78 59 59 48
120
+ *
121
+ * Decode, not prompt processing, is what a warm agent turn spends its time
122
+ * on: a measured hard-tool-call turn was 69.7s wall of which 65s was decode
123
+ * and ~1s was prompt (473 tokens against a warm prefix cache). So `low` is
124
+ * worth roughly 3.8x on the decode-bound part of a turn.
125
+ *
126
+ * It is still NOT the default here. Every task in that battery is a SINGLE
127
+ * tool call, and single-call accuracy is not evidence about multi-step
128
+ * debugging — which is the work the local lane actually has to do. Shipping a
129
+ * global reduction in a reasoning model's thinking on single-call evidence is
130
+ * the kind of over-claim this module's history is made of. The mechanism is
131
+ * here, the numbers are here, and the operator chooses:
132
+ *
133
+ * "models": { "llamaServer": { "agentDefaults": { "reasoningEffort": "low" } } }
134
+ *
135
+ * SAMPLING is off for a different reason: it was measured and REJECTED. The
136
+ * hypothesis was that llama-server's chat-tuned defaults (temperature 1.0,
137
+ * top_k 20, top_p 0.95, min_p 0.05 — taken from the GGUF's own metadata)
138
+ * corrupt tool calls. Across the batteries run against the live runtime the
139
+ * shipping default did not drop a single call that greedy decoding kept. The
140
+ * knob exists for an operator with a different model; it is not a fix,
141
+ * because no defect was found to fix.
142
+ *
143
+ * `min_p` is deliberately absent even though the server honours it: it is not
144
+ * part of the Anthropic request schema, and this lane's carrier is
145
+ * `/v1/messages`. Offering a field that would be dropped in transit is worse
146
+ * than not offering it — see the reasoning-effort note in anthropic-shim.ts
147
+ * for the measurement that made that failure mode concrete.
148
+ */
149
+ export function resolveLocalAgentDefaults(cfg) {
150
+ const raw = readSection(cfg).agentDefaults;
151
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
152
+ return NO_LOCAL_AGENT_DEFAULTS;
153
+ const section = raw;
154
+ const effortRaw = str(section['reasoningEffort']);
155
+ const reasoningEffort = effortRaw !== undefined
156
+ && LOCAL_AGENT_REASONING_EFFORTS.includes(effortRaw)
157
+ ? effortRaw
158
+ : null;
159
+ return {
160
+ reasoningEffort,
161
+ temperature: num(section['temperature'], 0, 2) ?? null,
162
+ topP: num(section['topP'], 0, 1) ?? null,
163
+ topK: int(section['topK'], 1, 1_000) ?? null,
164
+ };
165
+ }
60
166
  function readSection(cfg) {
61
167
  const models = cfg?.['models'];
62
168
  if (typeof models !== 'object' || models === null)
@@ -210,6 +316,68 @@ export function buildLlamaServerArgs(runtime, modelPath) {
210
316
  // growing transcript every turn.
211
317
  '--cont-batching',
212
318
  '--cache-prompt',
319
+ // MEASURED, not assumed: without this flag `GET /metrics` answers
320
+ //
321
+ // 501 {"error":{"code":501,"message":"This server does not support
322
+ // metrics endpoint. Start it with `--metrics`", ...}}
323
+ //
324
+ // — llama-server's own instruction. `/props` and `/slots` answer fine, so
325
+ // a runbook that says "read /metrics" looks correct until someone
326
+ // actually does it, which is the worst kind of gap. It is the only
327
+ // endpoint that reports CUMULATIVE prompt/decode token counts and
328
+ // per-request timing histograms; `/slots` is a point-in-time view and
329
+ // cannot answer "how much of this session went into reprocessed prompt",
330
+ // which is exactly the question the prefix-cache bug turned on.
331
+ //
332
+ // The endpoint is read-only counters and inherits the same loopback gate
333
+ // as everything else here. NOTE the deliberate asymmetry with `--props`,
334
+ // which is NOT passed: that one enables POST /props, i.e. mutating global
335
+ // sampling on a live launchd-managed server from anything that can reach
336
+ // the port. Observability yes, remote mutation no.
337
+ '--metrics',
338
+ // CORS. llama-server's default is `--cors-origins *`, and it announces the
339
+ // consequence itself at startup: "CORS is set to allow all origins ('*')
340
+ // and no API key is set / this can be a security risk (cross-origin
341
+ // attacks)". That warning is correct and it is not theoretical. MEASURED
342
+ // against the live loopback server with its shipping defaults:
343
+ //
344
+ // GET /props, no Origin (control) -> Access-Control-Allow-Origin: (empty)
345
+ // GET /props, Origin: https://evil.example
346
+ // -> Access-Control-Allow-Origin: https://evil.example
347
+ // OPTIONS /v1/messages, same Origin -> Allow-Origin: https://evil.example
348
+ // Allow-Credentials: true
349
+ // Allow-Methods: GET, POST, DELETE, OPTIONS
350
+ // Allow-Headers: *
351
+ //
352
+ // The origin is ECHOED, so any page the operator visits in any browser can
353
+ // read the response: run inference on this machine, and read `/slots`,
354
+ // which carries the prompts of whatever the local lane is currently
355
+ // processing. Binding to loopback does not help — the browser is already
356
+ // on loopback. It mattered less when this was hand-started for an hour at
357
+ // a time; it is a KeepAlive launchd job now, up from login and restarted
358
+ // on crash.
359
+ //
360
+ // `localhost` is llama-server's own special value: reflect the Origin only
361
+ // when it is localhost. It closes the internet-origin hole completely.
362
+ //
363
+ // WHY THIS CANNOT BREAK THE LANE, measured rather than assumed: CORS is a
364
+ // browser mechanism and applies only to requests carrying an `Origin`
365
+ // header. A capture server put in llama-server's place recorded every
366
+ // request a real `claude` turn makes through this proxy — `HEAD
367
+ // /api/hello` and two `POST /v1/messages?beta=true` — and NONE of them
368
+ // carried an Origin. Nothing in the hub's own web UI fetches this port
369
+ // from a browser either; it renders status the hub server probed
370
+ // server-side. So no client of this runtime engages CORS at all.
371
+ //
372
+ // NOT `--api-key`, deliberately, and this was measured too. The same
373
+ // capture shows the lane sends `authorization: Bearer ollama` — the
374
+ // literal value of ANTHROPIC_AUTH_TOKEN that verse/adapters/claude.ts
375
+ // sets. llama-server's `--api-key` checks exactly that header, so turning
376
+ // it on would 401 every turn unless the proxy rewrote the header on the
377
+ // way through. That is a real change to the request path, not a flag, and
378
+ // it is not worth shipping untested alongside this one.
379
+ '--cors-origins',
380
+ 'localhost',
213
381
  ...runtime.extraArgs,
214
382
  ];
215
383
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,uEAAuE;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE9C;;;;;;GAMG;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  export { argvBindsPort, argvMatchesRecord, findLlamaServersOnPort, modelPathFromArgv, processAlive, shouldReclaim, } from './process.js';
45
45
  export { clearOwnershipRecord, parseOwnershipRecord, readOwnershipRecord, writeOwnershipRecord, } from './record.js';
46
46
  export { LAUNCH_AGENT_LABEL, launchAgentPlistPath, launchAgentShimPath, localRuntimeDir, logsDir, ollamaModelsRoot, ownershipRecordPath, stderrLogPath, stdoutLogPath, } from './paths.js';
47
+ /**
48
+ * The Anthropic proxy as a supervised PROCESS.
49
+ *
50
+ * `ensureAnthropicProxy` (above) hosts the listener inside the calling
51
+ * process, which is right for an attended `start` and useless for a lane that
52
+ * has to be up at 3am. These are the pieces that give it a launchd job of its
53
+ * own: the invocation resolver (which reads the MODULE's location, never
54
+ * `process.argv[1]` — see proxy-invocation.ts for the defect that rule exists
55
+ * to prevent) and the agent install/uninstall.
56
+ */
57
+ export { ANTHROPIC_PROXY_HOST_FLAG, anthropicProxyHostArgv, anthropicProxyHostEnvironment, anthropicProxyHostInvocation, } from './proxy-invocation.js';
58
+ export type { AnthropicProxyHostOptions } from './proxy-invocation.js';
59
+ export { anthropicProxyAgentInstalled, anthropicProxyAgentLoaded, anthropicProxyLogPaths, buildAnthropicProxyPlist, buildAnthropicProxyShim, installAnthropicProxyAgent, uninstallAnthropicProxyAgent, } from './proxy-launchd.js';
60
+ export type { AnthropicProxyAgentSpec } from './proxy-launchd.js';
61
+ export { ANTHROPIC_PROXY_LAUNCH_AGENT_LABEL, anthropicProxyPlistPath, anthropicProxyShimPath, } from './paths.js';
@@ -36,4 +36,17 @@ export { blobBasenameForDigest, parseOllamaModelRef, resolveOllamaModelBlob, res
36
36
  export { argvBindsPort, argvMatchesRecord, findLlamaServersOnPort, modelPathFromArgv, processAlive, shouldReclaim, } from './process.js';
37
37
  export { clearOwnershipRecord, parseOwnershipRecord, readOwnershipRecord, writeOwnershipRecord, } from './record.js';
38
38
  export { LAUNCH_AGENT_LABEL, launchAgentPlistPath, launchAgentShimPath, localRuntimeDir, logsDir, ollamaModelsRoot, ownershipRecordPath, stderrLogPath, stdoutLogPath, } from './paths.js';
39
+ /**
40
+ * The Anthropic proxy as a supervised PROCESS.
41
+ *
42
+ * `ensureAnthropicProxy` (above) hosts the listener inside the calling
43
+ * process, which is right for an attended `start` and useless for a lane that
44
+ * has to be up at 3am. These are the pieces that give it a launchd job of its
45
+ * own: the invocation resolver (which reads the MODULE's location, never
46
+ * `process.argv[1]` — see proxy-invocation.ts for the defect that rule exists
47
+ * to prevent) and the agent install/uninstall.
48
+ */
49
+ export { ANTHROPIC_PROXY_HOST_FLAG, anthropicProxyHostArgv, anthropicProxyHostEnvironment, anthropicProxyHostInvocation, } from './proxy-invocation.js';
50
+ export { anthropicProxyAgentInstalled, anthropicProxyAgentLoaded, anthropicProxyLogPaths, buildAnthropicProxyPlist, buildAnthropicProxyShim, installAnthropicProxyAgent, uninstallAnthropicProxyAgent, } from './proxy-launchd.js';
51
+ export { ANTHROPIC_PROXY_LAUNCH_AGENT_LABEL, anthropicProxyPlistPath, anthropicProxyShimPath, } from './paths.js';
39
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAcH,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,SAAS,EACT,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,8BAA8B,EAC9B,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAGrB;;;;;GAKG;AACH,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGtF,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,OAAO,EACP,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAcH,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,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aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;GASG;AACH,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
@@ -28,8 +28,25 @@ export declare function logsDir(): string;
28
28
  export declare function stdoutLogPath(): string;
29
29
  /** Absolute stderr log path for the supervised runtime. */
30
30
  export declare function stderrLogPath(): string;
31
+ /**
32
+ * `~/.ashlr/local-runtime/anthropic-proxy-launch.sh` — the proxy job's shim.
33
+ *
34
+ * A SECOND shim rather than more flags on the llama-server one, because the
35
+ * two jobs have genuinely independent lifetimes: llama-server is a foreign
36
+ * binary that must keep running while the proxy is restarted for a config
37
+ * change, and a single job cannot supervise two processes.
38
+ */
39
+ export declare function anthropicProxyShimPath(): string;
40
+ /** Absolute stdout log path for the supervised Anthropic proxy. */
41
+ export declare function anthropicProxyStdoutLogPath(): string;
42
+ /** Absolute stderr log path for the supervised Anthropic proxy. */
43
+ export declare function anthropicProxyStderrLogPath(): string;
31
44
  /** launchd job label. Reverse-DNS, matching the hub's other agents. */
32
45
  export declare const LAUNCH_AGENT_LABEL = "ai.ashlr.local-runtime";
46
+ /** launchd job label for the Anthropic normalising proxy. */
47
+ export declare const ANTHROPIC_PROXY_LAUNCH_AGENT_LABEL = "ai.ashlr.anthropic-proxy";
48
+ /** `~/Library/LaunchAgents/ai.ashlr.anthropic-proxy.plist`. */
49
+ export declare function anthropicProxyPlistPath(): string;
33
50
  /**
34
51
  * `~/Library/LaunchAgents/ai.ashlr.local-runtime.plist`.
35
52
  *
@@ -44,8 +44,33 @@ export function stdoutLogPath() {
44
44
  export function stderrLogPath() {
45
45
  return join(logsDir(), 'local-runtime.err.log');
46
46
  }
47
+ /**
48
+ * `~/.ashlr/local-runtime/anthropic-proxy-launch.sh` — the proxy job's shim.
49
+ *
50
+ * A SECOND shim rather than more flags on the llama-server one, because the
51
+ * two jobs have genuinely independent lifetimes: llama-server is a foreign
52
+ * binary that must keep running while the proxy is restarted for a config
53
+ * change, and a single job cannot supervise two processes.
54
+ */
55
+ export function anthropicProxyShimPath() {
56
+ return join(localRuntimeDir(), 'anthropic-proxy-launch.sh');
57
+ }
58
+ /** Absolute stdout log path for the supervised Anthropic proxy. */
59
+ export function anthropicProxyStdoutLogPath() {
60
+ return join(logsDir(), 'anthropic-proxy.out.log');
61
+ }
62
+ /** Absolute stderr log path for the supervised Anthropic proxy. */
63
+ export function anthropicProxyStderrLogPath() {
64
+ return join(logsDir(), 'anthropic-proxy.err.log');
65
+ }
47
66
  /** launchd job label. Reverse-DNS, matching the hub's other agents. */
48
67
  export const LAUNCH_AGENT_LABEL = 'ai.ashlr.local-runtime';
68
+ /** launchd job label for the Anthropic normalising proxy. */
69
+ export const ANTHROPIC_PROXY_LAUNCH_AGENT_LABEL = 'ai.ashlr.anthropic-proxy';
70
+ /** `~/Library/LaunchAgents/ai.ashlr.anthropic-proxy.plist`. */
71
+ export function anthropicProxyPlistPath() {
72
+ return join(homedir(), 'Library', 'LaunchAgents', `${ANTHROPIC_PROXY_LAUNCH_AGENT_LABEL}.plist`);
73
+ }
49
74
  /**
50
75
  * `~/Library/LaunchAgents/ai.ashlr.local-runtime.plist`.
51
76
  *
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,iCAAiC;AACjC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AC,CAAC;AACpD,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,2BAA2B;IACzC,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,yBAAyB,CAAC,CAAC;AACpD,CAAC;AAED,uEAAuE;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AAE3D,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kCAAkC,GAAG,0BAA0B,CAAC;AAE7E,+DAA+D;AAC/D,MAAM,UAAU,uBAAuB;IACrC,OAAO,IAAI,CACT,OAAO,EAAE,EACT,SAAS,EACT,cAAc,EACd,GAAG,kCAAkC,QAAQ,CAC9C,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,kBAAkB,QAAQ,CAAC,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC;IACtD,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * How to spawn the Anthropic proxy host, from ANY caller.
3
+ *
4
+ * ## The defect this module exists to not repeat
5
+ *
6
+ * `verse-detached-proxy-wip` (commit c7853f0a) built the child argv from
7
+ * `process.argv[1]`, i.e. "re-run whatever script this process was started
8
+ * from, with proxy flags appended". That is correct exactly once — when the
9
+ * running process is the `ashlr` CLI — and wrong for every other caller. The
10
+ * Verse web server, which is the long-lived host this feature exists to serve,
11
+ * has its OWN argv[1]; the spawn therefore re-ran the Verse server with
12
+ * `--anthropic-port N` appended, which it ignored before exiting, and the
13
+ * parent reported `the Anthropic proxy host exited while starting`.
14
+ *
15
+ * The rule that follows, and the reason this file is separate from the
16
+ * supervisor: **the child is resolved from THIS MODULE'S OWN LOCATION, never
17
+ * from how the parent process happened to be launched.** `import.meta.url` is
18
+ * a property of the code; `argv[1]` is a property of the invocation. Only the
19
+ * first is stable across callers.
20
+ *
21
+ * ## Three shipping runtimes, three invocations
22
+ *
23
+ * Deliberately the same shape as {@link import('../../resources/probe-helper-invocation.js').probeHelperArgv},
24
+ * which solved this for the account probes, and it reuses that module's
25
+ * predicates rather than re-deriving the `/$bunfs/` sentinel:
26
+ *
27
+ * dev / tsx → `node --eval` with tsx registered, importing the sibling .ts
28
+ * npm dist → `node <sibling .js on disk>`
29
+ * Bun binary → this same binary re-entered on a fixed flag
30
+ *
31
+ * The Bun case exists because `bun build --compile` collapses every bundled
32
+ * module's `import.meta.url` onto `file:///$bunfs/root/<binary>`, a virtual
33
+ * root with no on-disk files — so the sibling-path spelling the other two
34
+ * runtimes use resolves to a path that cannot be spawned. That is the same
35
+ * defect this repo has shipped three times (the Codex probe, the Grok probe,
36
+ * and cutoff capture), which is why it is handled here on day one.
37
+ */
38
+ /**
39
+ * Internal re-entry flag for the compiled-binary case.
40
+ *
41
+ * Absent from command parsing, help output and completions, so it is
42
+ * unreachable from normal CLI use. Unlike the probe-helper flags it DOES take
43
+ * operands (`--port`, `--host`, `--upstream`), following the precedent of
44
+ * `--_cutoff-checkpoint-worker`. Every operand is re-validated by the host
45
+ * itself — the port through an integer range check, the bind host through
46
+ * `gateBindHost`, which no argument can talk out of loopback — so influence
47
+ * over this argv cannot widen the listener's exposure.
48
+ */
49
+ export declare const ANTHROPIC_PROXY_HOST_FLAG = "--_anthropic-proxy-host";
50
+ /**
51
+ * Build the argv that runs the Anthropic proxy host for the current runtime.
52
+ *
53
+ * `moduleUrl` defaults to this module's own URL and is a parameter only so the
54
+ * three branches can be unit-tested without stubbing `import.meta`, which is
55
+ * not stubbable. Callers should not pass it.
56
+ *
57
+ * The returned `command` is always `process.execPath`, which is the one path
58
+ * that is real on disk in all three runtimes.
59
+ */
60
+ export declare function anthropicProxyHostArgv(moduleUrl?: string): string[];
61
+ /** What the parent wants the child to serve. */
62
+ export interface AnthropicProxyHostOptions {
63
+ /** Bind host for the proxy. Still gated to loopback by the child. */
64
+ host?: string;
65
+ /** Port for the proxy itself. */
66
+ port?: number;
67
+ /** llama-server's port, i.e. what the proxy forwards to. */
68
+ upstreamPort?: number;
69
+ }
70
+ /**
71
+ * Configuration is passed to the child through the ENVIRONMENT, not argv.
72
+ *
73
+ * ## Measured, because the obvious spelling does not work
74
+ *
75
+ * The three runtimes disagree about argv in ways that silently corrupt an
76
+ * operand tail:
77
+ *
78
+ * `node <file> --port N` → operands begin at argv[2]
79
+ * `node --eval "…" -- --port N` → operands begin at argv[1]; without the
80
+ * `--`, node rejects the run outright
81
+ * with `node: bad option: --port`
82
+ * `<binary> --_flag --port N` → the CLI strips its own flag first
83
+ *
84
+ * Three different offsets and one hard failure, so any single `slice()` is
85
+ * wrong in at least one shipping runtime — and wrong in the quiet way, where
86
+ * the child starts on defaults and serves the wrong port.
87
+ *
88
+ * The environment has none of that: it is a flat map, identical in all three,
89
+ * and `config.ts` ALREADY defines these three variables with exactly the
90
+ * precedence wanted here (environment beats config beats default). So the
91
+ * child needs no argument plumbing at all — it calls
92
+ * `resolveLlamaRuntimeConfig` like everything else and gets the right answer,
93
+ * which keeps the single-source-of-truth rule that module is built around.
94
+ */
95
+ export declare function anthropicProxyHostEnvironment(options?: AnthropicProxyHostOptions, base?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
96
+ /** The complete spawn description for the Anthropic proxy host. */
97
+ export declare function anthropicProxyHostInvocation(options?: AnthropicProxyHostOptions, moduleUrl?: string): {
98
+ command: string;
99
+ args: string[];
100
+ env: NodeJS.ProcessEnv;
101
+ };
@@ -0,0 +1,134 @@
1
+ /**
2
+ * How to spawn the Anthropic proxy host, from ANY caller.
3
+ *
4
+ * ## The defect this module exists to not repeat
5
+ *
6
+ * `verse-detached-proxy-wip` (commit c7853f0a) built the child argv from
7
+ * `process.argv[1]`, i.e. "re-run whatever script this process was started
8
+ * from, with proxy flags appended". That is correct exactly once — when the
9
+ * running process is the `ashlr` CLI — and wrong for every other caller. The
10
+ * Verse web server, which is the long-lived host this feature exists to serve,
11
+ * has its OWN argv[1]; the spawn therefore re-ran the Verse server with
12
+ * `--anthropic-port N` appended, which it ignored before exiting, and the
13
+ * parent reported `the Anthropic proxy host exited while starting`.
14
+ *
15
+ * The rule that follows, and the reason this file is separate from the
16
+ * supervisor: **the child is resolved from THIS MODULE'S OWN LOCATION, never
17
+ * from how the parent process happened to be launched.** `import.meta.url` is
18
+ * a property of the code; `argv[1]` is a property of the invocation. Only the
19
+ * first is stable across callers.
20
+ *
21
+ * ## Three shipping runtimes, three invocations
22
+ *
23
+ * Deliberately the same shape as {@link import('../../resources/probe-helper-invocation.js').probeHelperArgv},
24
+ * which solved this for the account probes, and it reuses that module's
25
+ * predicates rather than re-deriving the `/$bunfs/` sentinel:
26
+ *
27
+ * dev / tsx → `node --eval` with tsx registered, importing the sibling .ts
28
+ * npm dist → `node <sibling .js on disk>`
29
+ * Bun binary → this same binary re-entered on a fixed flag
30
+ *
31
+ * The Bun case exists because `bun build --compile` collapses every bundled
32
+ * module's `import.meta.url` onto `file:///$bunfs/root/<binary>`, a virtual
33
+ * root with no on-disk files — so the sibling-path spelling the other two
34
+ * runtimes use resolves to a path that cannot be spawned. That is the same
35
+ * defect this repo has shipped three times (the Codex probe, the Grok probe,
36
+ * and cutoff capture), which is why it is handled here on day one.
37
+ */
38
+ import { createRequire } from 'node:module';
39
+ import { fileURLToPath, pathToFileURL } from 'node:url';
40
+ import { bundledIntoSingleFileBinary, insideSingleFileBinaryRoot, } from '../../resources/probe-helper-invocation.js';
41
+ /**
42
+ * Internal re-entry flag for the compiled-binary case.
43
+ *
44
+ * Absent from command parsing, help output and completions, so it is
45
+ * unreachable from normal CLI use. Unlike the probe-helper flags it DOES take
46
+ * operands (`--port`, `--host`, `--upstream`), following the precedent of
47
+ * `--_cutoff-checkpoint-worker`. Every operand is re-validated by the host
48
+ * itself — the port through an integer range check, the bind host through
49
+ * `gateBindHost`, which no argument can talk out of loopback — so influence
50
+ * over this argv cannot widen the listener's exposure.
51
+ */
52
+ export const ANTHROPIC_PROXY_HOST_FLAG = '--_anthropic-proxy-host';
53
+ /** The sibling module that actually runs the listener. */
54
+ const HOST_MODULE_BASENAME = 'anthropic-proxy-process';
55
+ /**
56
+ * Build the argv that runs the Anthropic proxy host for the current runtime.
57
+ *
58
+ * `moduleUrl` defaults to this module's own URL and is a parameter only so the
59
+ * three branches can be unit-tested without stubbing `import.meta`, which is
60
+ * not stubbable. Callers should not pass it.
61
+ *
62
+ * The returned `command` is always `process.execPath`, which is the one path
63
+ * that is real on disk in all three runtimes.
64
+ */
65
+ export function anthropicProxyHostArgv(moduleUrl = import.meta.url) {
66
+ // Running from TypeScript source: the sibling is a .ts file, which bare
67
+ // `node` cannot execute. Register tsx in the child exactly as the account
68
+ // probes do, then import the sibling by URL.
69
+ if (moduleUrl.endsWith('.ts')) {
70
+ const loader = pathToFileURL(createRequire(moduleUrl).resolve('tsx/esm/api')).href;
71
+ const source = new URL(`./${HOST_MODULE_BASENAME}.ts`, moduleUrl).href;
72
+ return [
73
+ process.execPath,
74
+ '--input-type=module',
75
+ '--eval',
76
+ `import { register } from ${JSON.stringify(loader)}; register(); await import(${JSON.stringify(source)});`,
77
+ ];
78
+ }
79
+ // Inside a single-file bundle no sibling file exists on disk. `execPath` is
80
+ // the real binary and re-entering it on the fixed flag is the only spelling
81
+ // that resolves. Checked BEFORE the on-disk branch, because that branch
82
+ // would otherwise hand back a `/$bunfs/...` path that cannot be spawned.
83
+ if (bundledIntoSingleFileBinary(moduleUrl) || insideSingleFileBinaryRoot(moduleUrl)) {
84
+ return [process.execPath, ANTHROPIC_PROXY_HOST_FLAG];
85
+ }
86
+ // Ordinary compiled output: the sibling .js sits next to this file.
87
+ return [process.execPath, fileURLToPath(new URL(`./${HOST_MODULE_BASENAME}.js`, moduleUrl))];
88
+ }
89
+ /**
90
+ * Configuration is passed to the child through the ENVIRONMENT, not argv.
91
+ *
92
+ * ## Measured, because the obvious spelling does not work
93
+ *
94
+ * The three runtimes disagree about argv in ways that silently corrupt an
95
+ * operand tail:
96
+ *
97
+ * `node <file> --port N` → operands begin at argv[2]
98
+ * `node --eval "…" -- --port N` → operands begin at argv[1]; without the
99
+ * `--`, node rejects the run outright
100
+ * with `node: bad option: --port`
101
+ * `<binary> --_flag --port N` → the CLI strips its own flag first
102
+ *
103
+ * Three different offsets and one hard failure, so any single `slice()` is
104
+ * wrong in at least one shipping runtime — and wrong in the quiet way, where
105
+ * the child starts on defaults and serves the wrong port.
106
+ *
107
+ * The environment has none of that: it is a flat map, identical in all three,
108
+ * and `config.ts` ALREADY defines these three variables with exactly the
109
+ * precedence wanted here (environment beats config beats default). So the
110
+ * child needs no argument plumbing at all — it calls
111
+ * `resolveLlamaRuntimeConfig` like everything else and gets the right answer,
112
+ * which keeps the single-source-of-truth rule that module is built around.
113
+ */
114
+ export function anthropicProxyHostEnvironment(options = {}, base = process.env) {
115
+ const env = { ...base };
116
+ if (options.host !== undefined)
117
+ env['ASHLR_LOCAL_RUNTIME_HOST'] = options.host;
118
+ if (options.port !== undefined)
119
+ env['ASHLR_LOCAL_RUNTIME_ANTHROPIC_PORT'] = String(options.port);
120
+ if (options.upstreamPort !== undefined) {
121
+ env['ASHLR_LOCAL_RUNTIME_PORT'] = String(options.upstreamPort);
122
+ }
123
+ return env;
124
+ }
125
+ /** The complete spawn description for the Anthropic proxy host. */
126
+ export function anthropicProxyHostInvocation(options = {}, moduleUrl = import.meta.url) {
127
+ const [command, ...args] = anthropicProxyHostArgv(moduleUrl);
128
+ return {
129
+ command: command,
130
+ args,
131
+ env: anthropicProxyHostEnvironment(options),
132
+ };
133
+ }
134
+ //# sourceMappingURL=proxy-invocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy-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