@ashlr/hub 3.4.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -1
- package/README.md +3 -0
- package/dist/build-identity.json +2 -2
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/local-runtime.js +40 -9
- package/dist/cli/local-runtime.js.map +1 -1
- package/dist/core/fleet/external-skill-audit.js +1 -1
- package/dist/core/fleet/external-skill-audit.js.map +1 -1
- package/dist/core/local-eval/classify.d.ts +57 -0
- package/dist/core/local-eval/classify.js +121 -0
- package/dist/core/local-eval/classify.js.map +1 -0
- package/dist/core/local-eval/configuration.d.ts +37 -0
- package/dist/core/local-eval/configuration.js +171 -0
- package/dist/core/local-eval/configuration.js.map +1 -0
- package/dist/core/local-eval/index.d.ts +15 -0
- package/dist/core/local-eval/index.js +16 -0
- package/dist/core/local-eval/index.js.map +1 -0
- package/dist/core/local-eval/main.d.ts +31 -0
- package/dist/core/local-eval/main.js +174 -0
- package/dist/core/local-eval/main.js.map +1 -0
- package/dist/core/local-eval/report.d.ts +25 -0
- package/dist/core/local-eval/report.js +157 -0
- package/dist/core/local-eval/report.js.map +1 -0
- package/dist/core/local-eval/runner.d.ts +55 -0
- package/dist/core/local-eval/runner.js +290 -0
- package/dist/core/local-eval/runner.js.map +1 -0
- package/dist/core/local-eval/tasks.d.ts +22 -0
- package/dist/core/local-eval/tasks.js +303 -0
- package/dist/core/local-eval/tasks.js.map +1 -0
- package/dist/core/local-eval/trace.d.ts +67 -0
- package/dist/core/local-eval/trace.js +309 -0
- package/dist/core/local-eval/trace.js.map +1 -0
- package/dist/core/local-eval/types.d.ts +262 -0
- package/dist/core/local-eval/types.js +23 -0
- package/dist/core/local-eval/types.js.map +1 -0
- package/dist/core/local-runtime/llama/anthropic-proxy-host.d.ts +68 -0
- package/dist/core/local-runtime/llama/anthropic-proxy-host.js +120 -0
- package/dist/core/local-runtime/llama/anthropic-proxy-host.js.map +1 -0
- package/dist/core/local-runtime/llama/anthropic-proxy-process.d.ts +15 -0
- package/dist/core/local-runtime/llama/anthropic-proxy-process.js +21 -0
- package/dist/core/local-runtime/llama/anthropic-proxy-process.js.map +1 -0
- package/dist/core/local-runtime/llama/anthropic-proxy.d.ts +2 -1
- package/dist/core/local-runtime/llama/anthropic-proxy.js +14 -6
- package/dist/core/local-runtime/llama/anthropic-proxy.js.map +1 -1
- package/dist/core/local-runtime/llama/anthropic-shim.d.ts +33 -0
- package/dist/core/local-runtime/llama/anthropic-shim.js +59 -0
- package/dist/core/local-runtime/llama/anthropic-shim.js.map +1 -1
- package/dist/core/local-runtime/llama/config.d.ts +123 -6
- package/dist/core/local-runtime/llama/config.js +196 -6
- package/dist/core/local-runtime/llama/config.js.map +1 -1
- package/dist/core/local-runtime/llama/index.d.ts +15 -0
- package/dist/core/local-runtime/llama/index.js +13 -0
- package/dist/core/local-runtime/llama/index.js.map +1 -1
- package/dist/core/local-runtime/llama/paths.d.ts +17 -0
- package/dist/core/local-runtime/llama/paths.js +25 -0
- package/dist/core/local-runtime/llama/paths.js.map +1 -1
- package/dist/core/local-runtime/llama/proxy-invocation.d.ts +101 -0
- package/dist/core/local-runtime/llama/proxy-invocation.js +134 -0
- package/dist/core/local-runtime/llama/proxy-invocation.js.map +1 -0
- package/dist/core/local-runtime/llama/proxy-launchd.d.ts +83 -0
- package/dist/core/local-runtime/llama/proxy-launchd.js +216 -0
- package/dist/core/local-runtime/llama/proxy-launchd.js.map +1 -0
- package/dist/core/local-runtime/llama/shapes.d.ts +2 -1
- package/dist/core/local-runtime/llama/shapes.js +2 -1
- package/dist/core/local-runtime/llama/shapes.js.map +1 -1
- package/dist/core/verse/adapters/claude.js +16 -0
- package/dist/core/verse/adapters/claude.js.map +1 -1
- package/dist/core/verse/adapters/codex.js +60 -2
- package/dist/core/verse/adapters/codex.js.map +1 -1
- package/dist/core/verse/adapters/grok.js +13 -0
- package/dist/core/verse/adapters/grok.js.map +1 -1
- package/dist/core/verse/control-api.d.ts +8 -9
- package/dist/core/verse/control-api.js +14 -114
- package/dist/core/verse/control-api.js.map +1 -1
- package/dist/core/verse/github-api.d.ts +50 -0
- package/dist/core/verse/github-api.js +211 -0
- package/dist/core/verse/github-api.js.map +1 -0
- package/dist/core/verse/github-proposal.d.ts +64 -0
- package/dist/core/verse/github-proposal.js +186 -0
- package/dist/core/verse/github-proposal.js.map +1 -0
- package/dist/core/verse/github-repo.d.ts +104 -0
- package/dist/core/verse/github-repo.js +476 -0
- package/dist/core/verse/github-repo.js.map +1 -0
- package/dist/core/verse/github-types.d.ts +174 -0
- package/dist/core/verse/github-types.js +31 -0
- package/dist/core/verse/github-types.js.map +1 -0
- package/dist/core/verse/mcp-cli-health.d.ts +149 -0
- package/dist/core/verse/mcp-cli-health.js +227 -0
- package/dist/core/verse/mcp-cli-health.js.map +1 -0
- package/dist/core/verse/mcp-control-api.d.ts +68 -0
- package/dist/core/verse/mcp-control-api.js +322 -0
- package/dist/core/verse/mcp-control-api.js.map +1 -0
- package/dist/core/verse/mcp-mutation.d.ts +187 -0
- package/dist/core/verse/mcp-mutation.js +471 -0
- package/dist/core/verse/mcp-mutation.js.map +1 -0
- package/dist/core/verse/mcp-scope.d.ts +114 -0
- package/dist/core/verse/mcp-scope.js +149 -0
- package/dist/core/verse/mcp-scope.js.map +1 -0
- package/dist/core/verse/mcp-seat-view.d.ts +197 -0
- package/dist/core/verse/mcp-seat-view.js +322 -0
- package/dist/core/verse/mcp-seat-view.js.map +1 -0
- package/dist/core/verse/path-guard.d.ts +115 -0
- package/dist/core/verse/path-guard.js +171 -0
- package/dist/core/verse/path-guard.js.map +1 -0
- package/dist/core/verse/seats.js +30 -2
- package/dist/core/verse/seats.js.map +1 -1
- package/dist/core/verse/session-engine.js +60 -1
- package/dist/core/verse/session-engine.js.map +1 -1
- package/dist/core/verse/session-store.js +20 -0
- package/dist/core/verse/session-store.js.map +1 -1
- package/dist/core/verse/types.d.ts +225 -1
- package/dist/core/verse/types.js +26 -0
- package/dist/core/verse/types.js.map +1 -1
- package/dist/core/verse/verse-api.d.ts +16 -1
- package/dist/core/verse/verse-api.js +338 -16
- package/dist/core/verse/verse-api.js.map +1 -1
- package/dist/core/verse/workspaces.d.ts +130 -0
- package/dist/core/verse/workspaces.js +501 -0
- package/dist/core/verse/workspaces.js.map +1 -0
- package/dist/core/web/api.js +23 -0
- package/dist/core/web/api.js.map +1 -1
- package/dist/core/web/public/next/assets/App-BbVoUCIi.js +7 -0
- package/dist/core/web/public/next/assets/App-BbVoUCIi.js.map +1 -0
- package/dist/core/web/public/next/assets/App-Cgi6j1Gk.css +1 -0
- package/dist/core/web/public/next/assets/ApprovalsSection-BW9iVjUa.js +2 -0
- package/dist/core/web/public/next/assets/ApprovalsSection-BW9iVjUa.js.map +1 -0
- package/dist/core/web/public/next/assets/ApprovalsSection-Su-NUTis.css +1 -0
- package/dist/core/web/public/next/assets/AutonomySection-CRqHUhED.js +2 -0
- package/dist/core/web/public/next/assets/AutonomySection-CRqHUhED.js.map +1 -0
- package/dist/core/web/public/next/assets/AutonomySection-Cpk_oEhc.css +1 -0
- package/dist/core/web/public/next/assets/ChatSection-5irrh6Jw.js +80 -0
- package/dist/core/web/public/next/assets/ChatSection-5irrh6Jw.js.map +1 -0
- package/dist/core/web/public/next/assets/ChatSection-LQiAn6Eu.css +1 -0
- package/dist/core/web/public/next/assets/ConfirmDialog-CXevY3Au.js +2 -0
- package/dist/core/web/public/next/assets/ConfirmDialog-CXevY3Au.js.map +1 -0
- package/dist/core/web/public/next/assets/{ConfirmDialog-cYuivhCX.css → ConfirmDialog-Dx15x0Ho.css} +1 -1
- package/dist/core/web/public/next/assets/Dialog-Bn0CgEGz.js +2 -0
- package/dist/core/web/public/next/assets/Dialog-Bn0CgEGz.js.map +1 -0
- package/dist/core/web/public/next/assets/Dialog-tQ8kFulD.css +1 -0
- package/dist/core/web/public/next/assets/DiffViewer-C8HHTnVE.css +1 -0
- package/dist/core/web/public/next/assets/DiffViewer-QKyisN2L.js +7 -0
- package/dist/core/web/public/next/assets/DiffViewer-QKyisN2L.js.map +1 -0
- package/dist/core/web/public/next/assets/{MutationTokenDialog-jWLLCxWn.css → MutationTokenDialog-CrfJ0PdD.css} +1 -1
- package/dist/core/web/public/next/assets/MutationTokenDialog-DbSHPy3w.js +2 -0
- package/dist/core/web/public/next/assets/MutationTokenDialog-DbSHPy3w.js.map +1 -0
- package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-C-PCgCzo.js +7 -0
- package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-C-PCgCzo.js.map +1 -0
- package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-CM_8pJs6.css +1 -0
- package/dist/core/web/public/next/assets/RouteErrorBoundary-Dw8ZjmkS.js +2 -0
- package/dist/core/web/public/next/assets/RouteErrorBoundary-Dw8ZjmkS.js.map +1 -0
- package/dist/core/web/public/next/assets/RouteErrorBoundary-ekyMXAK8.css +1 -0
- package/dist/core/web/public/next/assets/SettingsSection-BII7TTSD.css +1 -0
- package/dist/core/web/public/next/assets/SettingsSection-CWxtTNlD.js +2 -0
- package/dist/core/web/public/next/assets/SettingsSection-CWxtTNlD.js.map +1 -0
- package/dist/core/web/public/next/assets/UniverseConsoleApp-Bk5HipM0.js +2 -0
- package/dist/core/web/public/next/assets/UniverseConsoleApp-Bk5HipM0.js.map +1 -0
- package/dist/core/web/public/next/assets/UniverseConsoleApp-Dh7A-hLD.css +1 -0
- package/dist/core/web/public/next/assets/UniverseView-Bqa8DH57.css +1 -0
- package/dist/core/web/public/next/assets/UniverseView-D8k9q0ce.js +9 -0
- package/dist/core/web/public/next/assets/UniverseView-D8k9q0ce.js.map +1 -0
- package/dist/core/web/public/next/assets/UsageSection-B2E06ZH1.js +2 -0
- package/dist/core/web/public/next/assets/UsageSection-B2E06ZH1.js.map +1 -0
- package/dist/core/web/public/next/assets/UsageSection-DwgNOYvi.css +1 -0
- package/dist/core/web/public/next/assets/VerseConsoleApp-CRfZUV-T.js +3 -0
- package/dist/core/web/public/next/assets/VerseConsoleApp-CRfZUV-T.js.map +1 -0
- package/dist/core/web/public/next/assets/VerseConsoleApp-D2E3mU9a.css +1 -0
- package/dist/core/web/public/next/assets/charts-CsrtT4rk.css +1 -0
- package/dist/core/web/public/next/assets/charts-DSUpczxG.js +2 -0
- package/dist/core/web/public/next/assets/charts-DSUpczxG.js.map +1 -0
- package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js +2 -0
- package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js.map +1 -0
- package/dist/core/web/public/next/assets/format-BNYWGJat.js +2 -0
- package/dist/core/web/public/next/assets/format-BNYWGJat.js.map +1 -0
- package/dist/core/web/public/next/assets/global-C4jfYHrj.js +2 -0
- package/dist/core/web/public/next/assets/global-C4jfYHrj.js.map +1 -0
- package/dist/core/web/public/next/assets/global-D463gG1X.css +1 -0
- package/dist/core/web/public/next/assets/icons-BxOX8-XB.js +2 -0
- package/dist/core/web/public/next/assets/icons-BxOX8-XB.js.map +1 -0
- package/dist/core/web/public/next/assets/index-BMRIET7F.js +11 -0
- package/dist/core/web/public/next/assets/index-BMRIET7F.js.map +1 -0
- package/dist/core/web/public/next/assets/queries-AxnVa02h.js +2 -0
- package/dist/core/web/public/next/assets/queries-AxnVa02h.js.map +1 -0
- package/dist/core/web/public/next/assets/use-guarded-action-BO6c94Wp.js +2 -0
- package/dist/core/web/public/next/assets/use-guarded-action-BO6c94Wp.js.map +1 -0
- package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js +2 -0
- package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js.map +1 -0
- package/dist/core/web/public/next/assets/workspace-model-cE4LkKpE.js +2 -0
- package/dist/core/web/public/next/assets/workspace-model-cE4LkKpE.js.map +1 -0
- package/dist/core/web/public/next/index.html +1 -1
- package/dist/release-dependency-inventory.json +1 -1
- package/docs/README.md +4 -0
- package/node_modules/marked/README.md +8 -0
- package/node_modules/marked/bin/main.js +12 -11
- package/node_modules/marked/lib/marked.d.ts +88 -25
- package/node_modules/marked/lib/marked.esm.js +50 -44
- package/node_modules/marked/lib/marked.esm.js.map +3 -3
- package/node_modules/marked/lib/marked.umd.js +50 -44
- package/node_modules/marked/lib/marked.umd.js.map +3 -3
- package/node_modules/marked/man/marked.1 +1 -1
- package/node_modules/marked/package.json +21 -21
- package/package.json +13 -8
- package/dist/cli/activation.d.ts +0 -41
- package/dist/cli/activation.js +0 -485
- package/dist/cli/activation.js.map +0 -1
- package/dist/core/fleet/generated-repair-resolution.d.ts +0 -36
- package/dist/core/fleet/generated-repair-resolution.js +0 -245
- package/dist/core/fleet/generated-repair-resolution.js.map +0 -1
- package/dist/core/local-runtime/llama/port.d.ts +0 -17
- package/dist/core/local-runtime/llama/port.js +0 -47
- package/dist/core/local-runtime/llama/port.js.map +0 -1
- package/dist/core/local-runtime/llama/proxy-host.d.ts +0 -54
- package/dist/core/local-runtime/llama/proxy-host.js +0 -159
- package/dist/core/local-runtime/llama/proxy-host.js.map +0 -1
- package/dist/core/local-runtime/llama/proxy-process.d.ts +0 -148
- package/dist/core/local-runtime/llama/proxy-process.js +0 -250
- package/dist/core/local-runtime/llama/proxy-process.js.map +0 -1
- package/dist/core/local-runtime/llama/proxy-record.d.ts +0 -40
- package/dist/core/local-runtime/llama/proxy-record.js +0 -133
- package/dist/core/local-runtime/llama/proxy-record.js.map +0 -1
- package/dist/core/local-runtime/llama/proxy-supervisor.d.ts +0 -118
- package/dist/core/local-runtime/llama/proxy-supervisor.js +0 -511
- package/dist/core/local-runtime/llama/proxy-supervisor.js.map +0 -1
- package/dist/core/web/public/next/assets/App-BCKqSppK.css +0 -1
- package/dist/core/web/public/next/assets/App-LuILXjWG.js +0 -16
- package/dist/core/web/public/next/assets/App-LuILXjWG.js.map +0 -1
- package/dist/core/web/public/next/assets/ApprovalsSection-B_Xor8JH.js +0 -2
- package/dist/core/web/public/next/assets/ApprovalsSection-B_Xor8JH.js.map +0 -1
- package/dist/core/web/public/next/assets/ApprovalsSection-CRP59wSb.css +0 -1
- package/dist/core/web/public/next/assets/AutonomySection-BB8RD-tv.css +0 -1
- package/dist/core/web/public/next/assets/AutonomySection-BEwITtPJ.js +0 -2
- package/dist/core/web/public/next/assets/AutonomySection-BEwITtPJ.js.map +0 -1
- package/dist/core/web/public/next/assets/ChatSection-DrxqhBPK.css +0 -1
- package/dist/core/web/public/next/assets/ChatSection-bRAzlMth.js +0 -77
- package/dist/core/web/public/next/assets/ChatSection-bRAzlMth.js.map +0 -1
- package/dist/core/web/public/next/assets/ConfirmDialog-BqkZdPs_.js +0 -2
- package/dist/core/web/public/next/assets/ConfirmDialog-BqkZdPs_.js.map +0 -1
- package/dist/core/web/public/next/assets/Dialog-CPmedg4S.js +0 -2
- package/dist/core/web/public/next/assets/Dialog-CPmedg4S.js.map +0 -1
- package/dist/core/web/public/next/assets/Dialog-DxN7RgB5.css +0 -1
- package/dist/core/web/public/next/assets/DiffViewer-DmPJbeM_.js +0 -7
- package/dist/core/web/public/next/assets/DiffViewer-DmPJbeM_.js.map +0 -1
- package/dist/core/web/public/next/assets/DiffViewer-hN7X6wGT.css +0 -1
- package/dist/core/web/public/next/assets/Epistemic-DiyMyeaN.css +0 -1
- package/dist/core/web/public/next/assets/Epistemic-M3SxLHjq.js +0 -2
- package/dist/core/web/public/next/assets/Epistemic-M3SxLHjq.js.map +0 -1
- package/dist/core/web/public/next/assets/Meter-CGBsbXUX.css +0 -1
- package/dist/core/web/public/next/assets/Meter-D_X7c9U3.js +0 -2
- package/dist/core/web/public/next/assets/Meter-D_X7c9U3.js.map +0 -1
- package/dist/core/web/public/next/assets/MutationTokenDialog-Ba5ZHu-8.js +0 -2
- package/dist/core/web/public/next/assets/MutationTokenDialog-Ba5ZHu-8.js.map +0 -1
- package/dist/core/web/public/next/assets/RefreshIndicator-O7jUBOmX.css +0 -1
- package/dist/core/web/public/next/assets/RefreshIndicator-vHGpmyzb.js +0 -2
- package/dist/core/web/public/next/assets/RefreshIndicator-vHGpmyzb.js.map +0 -1
- package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-B5g6JEVk.js +0 -7
- package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-B5g6JEVk.js.map +0 -1
- package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-DLl4DbGG.css +0 -1
- package/dist/core/web/public/next/assets/RouteErrorBoundary-BIpdnxp-.css +0 -1
- package/dist/core/web/public/next/assets/RouteErrorBoundary-CroxuKoi.js +0 -2
- package/dist/core/web/public/next/assets/RouteErrorBoundary-CroxuKoi.js.map +0 -1
- package/dist/core/web/public/next/assets/SettingsSection-DGJMdUh2.css +0 -1
- package/dist/core/web/public/next/assets/SettingsSection-p-7FCGfn.js +0 -2
- package/dist/core/web/public/next/assets/SettingsSection-p-7FCGfn.js.map +0 -1
- package/dist/core/web/public/next/assets/Skeleton-4qq4HuJO.js +0 -2
- package/dist/core/web/public/next/assets/Skeleton-4qq4HuJO.js.map +0 -1
- package/dist/core/web/public/next/assets/Skeleton-D2JaTXyv.css +0 -1
- package/dist/core/web/public/next/assets/StatusBadge-BbEdqEGn.js +0 -2
- package/dist/core/web/public/next/assets/StatusBadge-BbEdqEGn.js.map +0 -1
- package/dist/core/web/public/next/assets/StatusBadge-TpDqZf6K.css +0 -1
- package/dist/core/web/public/next/assets/TableView-R6Yeztp1.css +0 -1
- package/dist/core/web/public/next/assets/TableView-nyYs7Sv1.js +0 -2
- package/dist/core/web/public/next/assets/TableView-nyYs7Sv1.js.map +0 -1
- package/dist/core/web/public/next/assets/UniverseConsoleApp-CiZZxRPV.css +0 -1
- package/dist/core/web/public/next/assets/UniverseConsoleApp-DjTpQUrA.js +0 -2
- package/dist/core/web/public/next/assets/UniverseConsoleApp-DjTpQUrA.js.map +0 -1
- package/dist/core/web/public/next/assets/UniverseView-BtApwayT.js +0 -9
- package/dist/core/web/public/next/assets/UniverseView-BtApwayT.js.map +0 -1
- package/dist/core/web/public/next/assets/UniverseView-gBxl6yum.css +0 -1
- package/dist/core/web/public/next/assets/UsageSection-Db99N6ao.js +0 -2
- package/dist/core/web/public/next/assets/UsageSection-Db99N6ao.js.map +0 -1
- package/dist/core/web/public/next/assets/UsageSection-UUYDidOg.css +0 -1
- package/dist/core/web/public/next/assets/VerseConsoleApp-COa3J2dO.js +0 -3
- package/dist/core/web/public/next/assets/VerseConsoleApp-COa3J2dO.js.map +0 -1
- package/dist/core/web/public/next/assets/VerseConsoleApp-mOAXvWa6.css +0 -1
- package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js +0 -2
- package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js.map +0 -1
- package/dist/core/web/public/next/assets/format-fggwu_Rs.js +0 -2
- package/dist/core/web/public/next/assets/format-fggwu_Rs.js.map +0 -1
- package/dist/core/web/public/next/assets/global-BeRYd1Bu.css +0 -1
- package/dist/core/web/public/next/assets/global-CNVapoV1.js +0 -2
- package/dist/core/web/public/next/assets/global-CNVapoV1.js.map +0 -1
- package/dist/core/web/public/next/assets/index-BkUlX2Se.js +0 -51
- package/dist/core/web/public/next/assets/index-BkUlX2Se.js.map +0 -1
- package/dist/core/web/public/next/assets/index-YNTgDG2b.js +0 -2
- package/dist/core/web/public/next/assets/index-YNTgDG2b.js.map +0 -1
- package/dist/core/web/public/next/assets/queries-C9XS4SYq.js +0 -2
- package/dist/core/web/public/next/assets/queries-C9XS4SYq.js.map +0 -1
- package/dist/core/web/public/next/assets/use-guarded-action-Bqa2v0a-.css +0 -1
- package/dist/core/web/public/next/assets/use-guarded-action-Bql1nA-z.js +0 -2
- package/dist/core/web/public/next/assets/use-guarded-action-Bql1nA-z.js.map +0 -1
- package/dist/core/web/public/next/assets/verse-model-IrNQKtER.js +0 -2
- package/dist/core/web/public/next/assets/verse-model-IrNQKtER.js.map +0 -1
- package/node_modules/which/CHANGELOG.md +0 -166
- /package/node_modules/marked/{LICENSE.md → LICENSE} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Anthropic proxy as a PROCESS, rather than as a listener inside someone
|
|
3
|
+
* else's process.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this file exists
|
|
6
|
+
*
|
|
7
|
+
* `anthropic-proxy.ts` documents its own scope honestly: "the listener lives
|
|
8
|
+
* in THIS process". That is the right design for what it is, and it is also
|
|
9
|
+
* the reason the feature was shipped-but-absent. The two hosts that could keep
|
|
10
|
+
* it alive both fail in practice:
|
|
11
|
+
*
|
|
12
|
+
* - `ashlr local-runtime start` is a one-shot CLI. It brings the proxy up
|
|
13
|
+
* and then exits, taking it with it.
|
|
14
|
+
* - the launch agent runs `/bin/sh <shim>` which `exec`s llama-server
|
|
15
|
+
* directly and never re-enters the hub, so a launchd-managed runtime — the
|
|
16
|
+
* only kind that is actually always-on — has no proxy at all.
|
|
17
|
+
*
|
|
18
|
+
* So the Anthropic lane's endpoint was a port nothing listened on, and the
|
|
19
|
+
* gap was filled by a hand-started scratch script outside the repository.
|
|
20
|
+
* This module is that script's committed, supervised replacement: the SAME
|
|
21
|
+
* `startAnthropicProxy` the tests already cover, hosted by a process whose
|
|
22
|
+
* only job is to host it.
|
|
23
|
+
*
|
|
24
|
+
* ## It re-uses, it does not re-implement
|
|
25
|
+
*
|
|
26
|
+
* Every byte of request handling comes from `anthropic-proxy.ts`. Nothing is
|
|
27
|
+
* normalised here. If this file ever grows request logic, the lane has two
|
|
28
|
+
* implementations again and the scratch-script problem has simply moved.
|
|
29
|
+
*/
|
|
30
|
+
import type { AnthropicProxyHandle } from './anthropic-proxy.js';
|
|
31
|
+
/**
|
|
32
|
+
* Start the listener and resolve once it is bound.
|
|
33
|
+
*
|
|
34
|
+
* ## There is no argument parsing here, on purpose
|
|
35
|
+
*
|
|
36
|
+
* The parent passes host, proxy port and upstream port through the
|
|
37
|
+
* ENVIRONMENT (see `anthropicProxyHostEnvironment`), because the three
|
|
38
|
+
* shipping runtimes disagree about argv offsets and `node --eval` rejects a
|
|
39
|
+
* trailing operand tail outright. `config.ts` already reads exactly those
|
|
40
|
+
* three variables with the precedence wanted here, so resolving through
|
|
41
|
+
* `resolveLlamaRuntimeConfig` gives the correct answer in every runtime AND
|
|
42
|
+
* keeps this process from becoming a second opinion about where the proxy
|
|
43
|
+
* belongs.
|
|
44
|
+
*
|
|
45
|
+
* Exported separately from {@link runAnthropicProxyHost} so a test can await
|
|
46
|
+
* the handle, assert on the bound port and close it, without the signal
|
|
47
|
+
* handlers and keep-alive timer a real process needs.
|
|
48
|
+
*/
|
|
49
|
+
export declare function startAnthropicProxyHost(): Promise<AnthropicProxyHandle>;
|
|
50
|
+
/**
|
|
51
|
+
* Run as a process: bind, announce, and stay up until signalled.
|
|
52
|
+
*
|
|
53
|
+
* ## The keep-alive timer is load-bearing, and was measured
|
|
54
|
+
*
|
|
55
|
+
* `startAnthropicProxy` calls `server.unref()` on purpose — without it
|
|
56
|
+
* `ashlr local-runtime start` never returns to the shell, which that file
|
|
57
|
+
* documents. The consequence for a STANDALONE host is that the listening
|
|
58
|
+
* socket no longer holds the process open, so the event loop empties and the
|
|
59
|
+
* process exits immediately after binding. Observed directly: a host script
|
|
60
|
+
* that awaited the handle and did nothing else bound the port and exited
|
|
61
|
+
* before a request could be sent.
|
|
62
|
+
*
|
|
63
|
+
* A ref'd timer is therefore what makes this a server rather than a very short
|
|
64
|
+
* program. Unref'ing the listener and re-anchoring the process here is also
|
|
65
|
+
* the honest split: the listener's lifetime is the PROCESS's lifetime, and
|
|
66
|
+
* this process exists for nothing else.
|
|
67
|
+
*/
|
|
68
|
+
export declare function runAnthropicProxyHost(): Promise<void>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Anthropic proxy as a PROCESS, rather than as a listener inside someone
|
|
3
|
+
* else's process.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this file exists
|
|
6
|
+
*
|
|
7
|
+
* `anthropic-proxy.ts` documents its own scope honestly: "the listener lives
|
|
8
|
+
* in THIS process". That is the right design for what it is, and it is also
|
|
9
|
+
* the reason the feature was shipped-but-absent. The two hosts that could keep
|
|
10
|
+
* it alive both fail in practice:
|
|
11
|
+
*
|
|
12
|
+
* - `ashlr local-runtime start` is a one-shot CLI. It brings the proxy up
|
|
13
|
+
* and then exits, taking it with it.
|
|
14
|
+
* - the launch agent runs `/bin/sh <shim>` which `exec`s llama-server
|
|
15
|
+
* directly and never re-enters the hub, so a launchd-managed runtime — the
|
|
16
|
+
* only kind that is actually always-on — has no proxy at all.
|
|
17
|
+
*
|
|
18
|
+
* So the Anthropic lane's endpoint was a port nothing listened on, and the
|
|
19
|
+
* gap was filled by a hand-started scratch script outside the repository.
|
|
20
|
+
* This module is that script's committed, supervised replacement: the SAME
|
|
21
|
+
* `startAnthropicProxy` the tests already cover, hosted by a process whose
|
|
22
|
+
* only job is to host it.
|
|
23
|
+
*
|
|
24
|
+
* ## It re-uses, it does not re-implement
|
|
25
|
+
*
|
|
26
|
+
* Every byte of request handling comes from `anthropic-proxy.ts`. Nothing is
|
|
27
|
+
* normalised here. If this file ever grows request logic, the lane has two
|
|
28
|
+
* implementations again and the scratch-script problem has simply moved.
|
|
29
|
+
*/
|
|
30
|
+
import { originFor, resolveLlamaRuntimeConfig } from './config.js';
|
|
31
|
+
import { startAnthropicProxy } from './anthropic-proxy.js';
|
|
32
|
+
import { loadConfigReadOnly } from '../../config.js';
|
|
33
|
+
/**
|
|
34
|
+
* Start the listener and resolve once it is bound.
|
|
35
|
+
*
|
|
36
|
+
* ## There is no argument parsing here, on purpose
|
|
37
|
+
*
|
|
38
|
+
* The parent passes host, proxy port and upstream port through the
|
|
39
|
+
* ENVIRONMENT (see `anthropicProxyHostEnvironment`), because the three
|
|
40
|
+
* shipping runtimes disagree about argv offsets and `node --eval` rejects a
|
|
41
|
+
* trailing operand tail outright. `config.ts` already reads exactly those
|
|
42
|
+
* three variables with the precedence wanted here, so resolving through
|
|
43
|
+
* `resolveLlamaRuntimeConfig` gives the correct answer in every runtime AND
|
|
44
|
+
* keeps this process from becoming a second opinion about where the proxy
|
|
45
|
+
* belongs.
|
|
46
|
+
*
|
|
47
|
+
* Exported separately from {@link runAnthropicProxyHost} so a test can await
|
|
48
|
+
* the handle, assert on the bound port and close it, without the signal
|
|
49
|
+
* handlers and keep-alive timer a real process needs.
|
|
50
|
+
*/
|
|
51
|
+
export async function startAnthropicProxyHost() {
|
|
52
|
+
// READ-ONLY deliberately. `loadConfig()` seeds directories and repairs
|
|
53
|
+
// state; this process starts at every login and must never be the thing
|
|
54
|
+
// that rewrites the operator's config.json as a side effect of booting.
|
|
55
|
+
let cfg;
|
|
56
|
+
try {
|
|
57
|
+
cfg = loadConfigReadOnly();
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// A host that cannot read config still has defaults, and a lane that
|
|
61
|
+
// refuses to start because config.json is mid-write is worse than one
|
|
62
|
+
// that starts on the documented defaults.
|
|
63
|
+
cfg = undefined;
|
|
64
|
+
}
|
|
65
|
+
const runtime = resolveLlamaRuntimeConfig(cfg);
|
|
66
|
+
return startAnthropicProxy({
|
|
67
|
+
cfg,
|
|
68
|
+
host: runtime.host,
|
|
69
|
+
port: runtime.anthropicPort,
|
|
70
|
+
upstreamOrigin: originFor(runtime.host, runtime.port),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Run as a process: bind, announce, and stay up until signalled.
|
|
75
|
+
*
|
|
76
|
+
* ## The keep-alive timer is load-bearing, and was measured
|
|
77
|
+
*
|
|
78
|
+
* `startAnthropicProxy` calls `server.unref()` on purpose — without it
|
|
79
|
+
* `ashlr local-runtime start` never returns to the shell, which that file
|
|
80
|
+
* documents. The consequence for a STANDALONE host is that the listening
|
|
81
|
+
* socket no longer holds the process open, so the event loop empties and the
|
|
82
|
+
* process exits immediately after binding. Observed directly: a host script
|
|
83
|
+
* that awaited the handle and did nothing else bound the port and exited
|
|
84
|
+
* before a request could be sent.
|
|
85
|
+
*
|
|
86
|
+
* A ref'd timer is therefore what makes this a server rather than a very short
|
|
87
|
+
* program. Unref'ing the listener and re-anchoring the process here is also
|
|
88
|
+
* the honest split: the listener's lifetime is the PROCESS's lifetime, and
|
|
89
|
+
* this process exists for nothing else.
|
|
90
|
+
*/
|
|
91
|
+
export async function runAnthropicProxyHost() {
|
|
92
|
+
const handle = await startAnthropicProxyHost();
|
|
93
|
+
// stdout is the launch agent's log. One line, so `local-runtime logs` shows
|
|
94
|
+
// where the lane actually landed rather than where it was asked to land.
|
|
95
|
+
process.stdout.write(`[ashlr anthropic-proxy] listening on ${handle.origin} -> ${handle.upstreamOrigin}\n`);
|
|
96
|
+
if (handle.hostDowngradedFrom !== null) {
|
|
97
|
+
process.stderr.write(`[ashlr anthropic-proxy] refused non-loopback bind '${handle.hostDowngradedFrom}';` +
|
|
98
|
+
` bound ${handle.host} instead (this listener has no authentication)\n`);
|
|
99
|
+
}
|
|
100
|
+
const keepAlive = setInterval(() => { }, 1 << 30);
|
|
101
|
+
let shuttingDown = false;
|
|
102
|
+
const shutdown = (signal) => {
|
|
103
|
+
if (shuttingDown)
|
|
104
|
+
return;
|
|
105
|
+
shuttingDown = true;
|
|
106
|
+
process.stdout.write(`[ashlr anthropic-proxy] ${signal}; closing\n`);
|
|
107
|
+
// Bounded: `close()` cuts keep-alive and SSE connections rather than
|
|
108
|
+
// waiting for them to go idle, which an streaming client never does.
|
|
109
|
+
void handle.close().finally(() => {
|
|
110
|
+
clearInterval(keepAlive);
|
|
111
|
+
// Exit 0 on a signal. launchd's KeepAlive is unconditional, so the exit
|
|
112
|
+
// code does not decide whether it comes back — but a non-zero code for
|
|
113
|
+
// an orderly stop would make every `logs` read look like a crash.
|
|
114
|
+
process.exit(0);
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
118
|
+
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=anthropic-proxy-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic-proxy-host.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/anthropic-proxy-host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,uEAAuE;IACvE,wEAAwE;IACxE,wEAAwE;IACxE,IAAI,GAAG,CAAC;IACR,IAAI,CAAC;QACH,GAAG,GAAG,kBAAkB,EAAE,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,qEAAqE;QACrE,sEAAsE;QACtE,0CAA0C;QAC1C,GAAG,GAAG,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,OAAO,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAE/C,OAAO,mBAAmB,CAAC;QACzB,GAAG;QACH,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI,EAAE,OAAO,CAAC,aAAa;QAC3B,cAAc,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC;KACtD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,MAAM,MAAM,GAAG,MAAM,uBAAuB,EAAE,CAAC;IAE/C,4EAA4E;IAC5E,yEAAyE;IACzE,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,wCAAwC,MAAM,CAAC,MAAM,OAAO,MAAM,CAAC,cAAc,IAAI,CACtF,CAAC;IACF,IAAI,MAAM,CAAC,kBAAkB,KAAK,IAAI,EAAE,CAAC;QACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,sDAAsD,MAAM,CAAC,kBAAkB,IAAI;YACjF,UAAU,MAAM,CAAC,IAAI,kDAAkD,CAC1E,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAEjD,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,MAAM,QAAQ,GAAG,CAAC,MAAsB,EAAQ,EAAE;QAChD,IAAI,YAAY;YAAE,OAAO;QACzB,YAAY,GAAG,IAAI,CAAC;QACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,MAAM,aAAa,CAAC,CAAC;QACrE,qEAAqE;QACrE,qEAAqE;QACrE,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;YAC/B,aAAa,CAAC,SAAS,CAAC,CAAC;YACzB,wEAAwE;YACxE,uEAAuE;YACvE,kEAAkE;YAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for the Anthropic proxy host child process.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately three lines of behaviour and no logic. It is the module
|
|
5
|
+
* `proxy-invocation.ts` spawns by path (dev and dist) or reaches by re-entry
|
|
6
|
+
* flag (Bun binary), and it SELF-EXECUTES on import — the same split the
|
|
7
|
+
* account probes use, where `*-account-probe.ts` holds the logic and
|
|
8
|
+
* `*-account-probe-process.ts` is the entry.
|
|
9
|
+
*
|
|
10
|
+
* The split exists so the host is testable. A module that starts a listener at
|
|
11
|
+
* import time cannot be unit-tested; `anthropic-proxy-host.ts` exports the
|
|
12
|
+
* parsing and the bind so a test can drive them on an ephemeral port, and this
|
|
13
|
+
* file is the only thing that turns them into a running process.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for the Anthropic proxy host child process.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately three lines of behaviour and no logic. It is the module
|
|
5
|
+
* `proxy-invocation.ts` spawns by path (dev and dist) or reaches by re-entry
|
|
6
|
+
* flag (Bun binary), and it SELF-EXECUTES on import — the same split the
|
|
7
|
+
* account probes use, where `*-account-probe.ts` holds the logic and
|
|
8
|
+
* `*-account-probe-process.ts` is the entry.
|
|
9
|
+
*
|
|
10
|
+
* The split exists so the host is testable. A module that starts a listener at
|
|
11
|
+
* import time cannot be unit-tested; `anthropic-proxy-host.ts` exports the
|
|
12
|
+
* parsing and the bind so a test can drive them on an ephemeral port, and this
|
|
13
|
+
* file is the only thing that turns them into a running process.
|
|
14
|
+
*/
|
|
15
|
+
import { runAnthropicProxyHost } from './anthropic-proxy-host.js';
|
|
16
|
+
// No argv is read. Host, proxy port and upstream port arrive through the
|
|
17
|
+
// environment, which is the only channel whose shape is identical in all three
|
|
18
|
+
// runtimes — see `anthropicProxyHostEnvironment` for the measurement that
|
|
19
|
+
// ruled out an operand tail.
|
|
20
|
+
await runAnthropicProxyHost();
|
|
21
|
+
//# sourceMappingURL=anthropic-proxy-process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic-proxy-process.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/anthropic-proxy-process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,yEAAyE;AACzE,+EAA+E;AAC/E,0EAA0E;AAC1E,6BAA6B;AAC7B,MAAM,qBAAqB,EAAE,CAAC"}
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
* `models.llamaServer.allowNonLoopback: true`. A refused host is
|
|
46
46
|
* downgraded and REPORTED on the handle, never silently honoured.
|
|
47
47
|
*/
|
|
48
|
+
import type { LocalAgentRequestDefaults } from './config.js';
|
|
48
49
|
import type { AshlrConfig } from '../../types.js';
|
|
49
50
|
/** The one path whose POST bodies are normalised. Everything else is a pipe. */
|
|
50
51
|
export declare const ANTHROPIC_MESSAGES_PATH = "/v1/messages";
|
|
@@ -110,7 +111,7 @@ export declare function isMessagesPost(method: string | undefined, url: string |
|
|
|
110
111
|
* function is the only place in the request path that runs arbitrary parsing,
|
|
111
112
|
* so it is the only place that could take the lane down.
|
|
112
113
|
*/
|
|
113
|
-
export declare function normaliseMessagesBody(raw: Buffer): Buffer;
|
|
114
|
+
export declare function normaliseMessagesBody(raw: Buffer, defaults?: LocalAgentRequestDefaults): Buffer;
|
|
114
115
|
/**
|
|
115
116
|
* Start the proxy.
|
|
116
117
|
*
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
* downgraded and REPORTED on the handle, never silently honoured.
|
|
47
47
|
*/
|
|
48
48
|
import { createServer, request as httpRequest } from 'node:http';
|
|
49
|
-
import { DEFAULT_LLAMA_HOST, DEFAULT_LLAMA_PORT, allowsNonLoopback, gateBindHost, originFor, resolveLlamaRuntimeConfig, } from './config.js';
|
|
50
|
-
import { normaliseAnthropicRequest } from './anthropic-shim.js';
|
|
49
|
+
import { DEFAULT_LLAMA_HOST, DEFAULT_LLAMA_PORT, NO_LOCAL_AGENT_DEFAULTS, allowsNonLoopback, gateBindHost, originFor, resolveLlamaRuntimeConfig, resolveLocalAgentDefaults, } from './config.js';
|
|
50
|
+
import { applyLocalAgentDefaults, normaliseAnthropicRequest } from './anthropic-shim.js';
|
|
51
51
|
/** The one path whose POST bodies are normalised. Everything else is a pipe. */
|
|
52
52
|
export const ANTHROPIC_MESSAGES_PATH = '/v1/messages';
|
|
53
53
|
/**
|
|
@@ -120,7 +120,7 @@ export function isMessagesPost(method, url) {
|
|
|
120
120
|
* function is the only place in the request path that runs arbitrary parsing,
|
|
121
121
|
* so it is the only place that could take the lane down.
|
|
122
122
|
*/
|
|
123
|
-
export function normaliseMessagesBody(raw) {
|
|
123
|
+
export function normaliseMessagesBody(raw, defaults = NO_LOCAL_AGENT_DEFAULTS) {
|
|
124
124
|
let parsed;
|
|
125
125
|
try {
|
|
126
126
|
parsed = JSON.parse(raw.toString('utf8'));
|
|
@@ -132,12 +132,16 @@ export function normaliseMessagesBody(raw) {
|
|
|
132
132
|
return raw;
|
|
133
133
|
try {
|
|
134
134
|
const normalised = normaliseAnthropicRequest(parsed);
|
|
135
|
+
// Defaults are applied AFTER the system-turn fold, and both are
|
|
136
|
+
// identity-preserving when they add nothing, so an unconfigured runtime
|
|
137
|
+
// still forwards the client's original bytes untouched.
|
|
138
|
+
const withDefaults = applyLocalAgentDefaults(normalised, defaults);
|
|
135
139
|
// The shim returns the same object reference when there was nothing to
|
|
136
140
|
// move. Re-serialising then would rewrite key order and whitespace for no
|
|
137
141
|
// reason, so identity is the signal to forward the original bytes.
|
|
138
|
-
if (
|
|
142
|
+
if (withDefaults === parsed)
|
|
139
143
|
return raw;
|
|
140
|
-
return Buffer.from(JSON.stringify(
|
|
144
|
+
return Buffer.from(JSON.stringify(withDefaults), 'utf8');
|
|
141
145
|
}
|
|
142
146
|
catch {
|
|
143
147
|
return raw;
|
|
@@ -176,6 +180,10 @@ export async function startAnthropicProxy(options = {}) {
|
|
|
176
180
|
* shutdown has to be able to cut the upstream side too — the same reason
|
|
177
181
|
* web/server.ts drains its own SSE registry before closing.
|
|
178
182
|
*/
|
|
183
|
+
// Resolved ONCE at start, not per request: these come from the operator's
|
|
184
|
+
// config file, and re-reading it on every turn would make the lane's
|
|
185
|
+
// behaviour depend on a file that can change mid-conversation.
|
|
186
|
+
const agentDefaults = resolveLocalAgentDefaults(options.cfg);
|
|
179
187
|
const inFlight = new Set();
|
|
180
188
|
let closing = null;
|
|
181
189
|
/** Answer a request we could not forward. Never writes twice. */
|
|
@@ -291,7 +299,7 @@ export async function startAnthropicProxy(options = {}) {
|
|
|
291
299
|
passthrough.end();
|
|
292
300
|
return;
|
|
293
301
|
}
|
|
294
|
-
const body = normaliseMessagesBody(Buffer.concat(chunks));
|
|
302
|
+
const body = normaliseMessagesBody(Buffer.concat(chunks), agentDefaults);
|
|
295
303
|
// Re-frame from what we are ACTUALLY sending. The shim can change the
|
|
296
304
|
// body's length in either direction, and a stale content-length is a
|
|
297
305
|
// truncated prompt or a hung request rather than a visible error.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-proxy.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/anthropic-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAQjE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGhE,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,IAAI;IACJ,SAAS;IACT,mBAAmB;IACnB,SAAS;CACV,CAAC,CAAC;AA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OAAO,CAAC;QAC7B,OAAO,GAAG,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IACrE,CAAC;YAAS,CAAC;QACT,IAAI,QAAQ,KAAK,OAAO;YAAE,QAAQ,GAAG,IAAI,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,GAAG,IAAI,CAAC;IACf,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAClC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;IAC3E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"anthropic-proxy.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/anthropic-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,YAAY,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAQjE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGzF,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,CAAC;AAEtD;;;;;;;;;G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 @@
|
|
|
46
46
|
* SessionStart hook into the operator's own task message made one measured run
|
|
47
47
|
* answer `DONE` without doing the work.
|
|
48
48
|
*/
|
|
49
|
+
import type { LocalAgentRequestDefaults } from './config.js';
|
|
49
50
|
export interface AnthropicTextBlock {
|
|
50
51
|
readonly type: 'text';
|
|
51
52
|
readonly text: string;
|
|
@@ -68,4 +69,36 @@ export declare function anthropicContentText(content: unknown): string;
|
|
|
68
69
|
* already satisfies the template is forwarded byte-for-byte.
|
|
69
70
|
*/
|
|
70
71
|
export declare function normaliseAnthropicRequest<T extends AnthropicRequestLike>(body: T): T;
|
|
72
|
+
/**
|
|
73
|
+
* Apply the operator's per-request defaults to an Anthropic body, WITHOUT
|
|
74
|
+
* overriding anything the client already set.
|
|
75
|
+
*
|
|
76
|
+
* WHERE THE REASONING EFFORT GOES, and why it is not the obvious spelling.
|
|
77
|
+
*
|
|
78
|
+
* `reasoning_effort` is a top-level field on llama-server's OpenAI-compatible
|
|
79
|
+
* endpoint. On `/v1/messages` — the endpoint this lane actually carries — it
|
|
80
|
+
* is silently ignored. That was measured rather than assumed, using the
|
|
81
|
+
* template's own fatal value as the probe: `high` is not in the template's
|
|
82
|
+
* accepted set, so a request that REACHES the template answers 500, and one
|
|
83
|
+
* that does not answers 200.
|
|
84
|
+
*
|
|
85
|
+
* POST /v1/chat/completions {reasoning_effort: 'high'} -> 500 (reaches template)
|
|
86
|
+
* POST /v1/messages {reasoning_effort: 'high'} -> 200 (DROPPED)
|
|
87
|
+
* POST /v1/messages {chat_template_kwargs:{reasoning_effort:'high'}} -> 500 (reaches template)
|
|
88
|
+
* POST /v1/messages {output_config:{effort:'high'}} -> 200 (DROPPED)
|
|
89
|
+
*
|
|
90
|
+
* So the carrier on this lane is `chat_template_kwargs`, and the top-level
|
|
91
|
+
* spelling would have been a no-op that looked exactly like a working
|
|
92
|
+
* setting. The last line is why Claude Code cannot ask for this itself: the
|
|
93
|
+
* CLI sends `output_config.effort` on every request and llama-server drops
|
|
94
|
+
* it, which is also why sending it never triggers the `high` exception.
|
|
95
|
+
*
|
|
96
|
+
* Sampling rides at the top level because `temperature`, `top_p` and `top_k`
|
|
97
|
+
* ARE part of the Anthropic request schema and survive the crossing.
|
|
98
|
+
*
|
|
99
|
+
* Returns the SAME OBJECT REFERENCE when it adds nothing, because
|
|
100
|
+
* `normaliseMessagesBody` uses identity to decide whether to forward the
|
|
101
|
+
* client's original bytes untouched.
|
|
102
|
+
*/
|
|
103
|
+
export declare function applyLocalAgentDefaults<T extends AnthropicRequestLike>(body: T, defaults: LocalAgentRequestDefaults): T;
|
|
71
104
|
export {};
|
|
@@ -152,4 +152,63 @@ export function normaliseAnthropicRequest(body) {
|
|
|
152
152
|
system.push({ type: 'text', text });
|
|
153
153
|
return { ...body, system, messages: kept };
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Apply the operator's per-request defaults to an Anthropic body, WITHOUT
|
|
157
|
+
* overriding anything the client already set.
|
|
158
|
+
*
|
|
159
|
+
* WHERE THE REASONING EFFORT GOES, and why it is not the obvious spelling.
|
|
160
|
+
*
|
|
161
|
+
* `reasoning_effort` is a top-level field on llama-server's OpenAI-compatible
|
|
162
|
+
* endpoint. On `/v1/messages` — the endpoint this lane actually carries — it
|
|
163
|
+
* is silently ignored. That was measured rather than assumed, using the
|
|
164
|
+
* template's own fatal value as the probe: `high` is not in the template's
|
|
165
|
+
* accepted set, so a request that REACHES the template answers 500, and one
|
|
166
|
+
* that does not answers 200.
|
|
167
|
+
*
|
|
168
|
+
* POST /v1/chat/completions {reasoning_effort: 'high'} -> 500 (reaches template)
|
|
169
|
+
* POST /v1/messages {reasoning_effort: 'high'} -> 200 (DROPPED)
|
|
170
|
+
* POST /v1/messages {chat_template_kwargs:{reasoning_effort:'high'}} -> 500 (reaches template)
|
|
171
|
+
* POST /v1/messages {output_config:{effort:'high'}} -> 200 (DROPPED)
|
|
172
|
+
*
|
|
173
|
+
* So the carrier on this lane is `chat_template_kwargs`, and the top-level
|
|
174
|
+
* spelling would have been a no-op that looked exactly like a working
|
|
175
|
+
* setting. The last line is why Claude Code cannot ask for this itself: the
|
|
176
|
+
* CLI sends `output_config.effort` on every request and llama-server drops
|
|
177
|
+
* it, which is also why sending it never triggers the `high` exception.
|
|
178
|
+
*
|
|
179
|
+
* Sampling rides at the top level because `temperature`, `top_p` and `top_k`
|
|
180
|
+
* ARE part of the Anthropic request schema and survive the crossing.
|
|
181
|
+
*
|
|
182
|
+
* Returns the SAME OBJECT REFERENCE when it adds nothing, because
|
|
183
|
+
* `normaliseMessagesBody` uses identity to decide whether to forward the
|
|
184
|
+
* client's original bytes untouched.
|
|
185
|
+
*/
|
|
186
|
+
export function applyLocalAgentDefaults(body, defaults) {
|
|
187
|
+
if (!body || typeof body !== 'object')
|
|
188
|
+
return body;
|
|
189
|
+
const patch = {};
|
|
190
|
+
// Sampling: top-level, and only when the client left it out entirely.
|
|
191
|
+
if (defaults.temperature !== null && body['temperature'] === undefined) {
|
|
192
|
+
patch['temperature'] = defaults.temperature;
|
|
193
|
+
}
|
|
194
|
+
if (defaults.topP !== null && body['top_p'] === undefined)
|
|
195
|
+
patch['top_p'] = defaults.topP;
|
|
196
|
+
if (defaults.topK !== null && body['top_k'] === undefined)
|
|
197
|
+
patch['top_k'] = defaults.topK;
|
|
198
|
+
// Reasoning effort: through chat_template_kwargs, merged rather than
|
|
199
|
+
// replaced so an operator's other template kwargs survive, and never
|
|
200
|
+
// overriding an effort the client already chose.
|
|
201
|
+
if (defaults.reasoningEffort !== null) {
|
|
202
|
+
const existing = body['chat_template_kwargs'];
|
|
203
|
+
const kwargs = typeof existing === 'object' && existing !== null && !Array.isArray(existing)
|
|
204
|
+
? existing
|
|
205
|
+
: undefined;
|
|
206
|
+
if (kwargs?.['reasoning_effort'] === undefined) {
|
|
207
|
+
patch['chat_template_kwargs'] = { ...(kwargs ?? {}), reasoning_effort: defaults.reasoningEffort };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (Object.keys(patch).length === 0)
|
|
211
|
+
return body;
|
|
212
|
+
return { ...body, ...patch };
|
|
213
|
+
}
|
|
155
214
|
//# sourceMappingURL=anthropic-shim.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-shim.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/anthropic-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;
|
|
1
|
+
{"version":3,"file":"anthropic-shim.js","sourceRoot":"","sources":["../../../../src/core/local-runtime/llama/anthropic-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAoBH,+EAA+E;AAC/E,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC;IACvC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,IAAI,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QAC1E,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvC,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI,CAAC;YAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAe;IAC3C,IAA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I,MAAM,EAAE,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,CAAC;YAC/C,KAAK,CAAC,sBAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC;QACpG,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -32,12 +32,27 @@ export declare const DEFAULT_LLAMA_SLOTS = 4;
|
|
|
32
32
|
* did not fit in its context before a single turn began, which is a failure
|
|
33
33
|
* with no useful error attached.
|
|
34
34
|
*
|
|
35
|
-
* 262,144 is Qwen3.8 27B's native trained context
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
35
|
+
* 262,144 is Qwen3.8 27B's native trained context.
|
|
36
|
+
*
|
|
37
|
+
* CORRECTION. This comment previously claimed raising `-c` from 131,072 to
|
|
38
|
+
* 262,144 cost no extra memory, citing 46.2 GB falling to 43.4 GB. That
|
|
39
|
+
* comparison was invalid: the 46.2 GB reading came from a process that had been
|
|
40
|
+
* serving for hours with a populated cache, the 43.4 GB from one measured
|
|
41
|
+
* seconds after startup with an empty one. Warm against cold, no control.
|
|
42
|
+
*
|
|
43
|
+
* The arithmetic contradicts it. From the model card — 4 KV heads, 256 head
|
|
44
|
+
* dim, fp16 K and V, and 16 of 64 layers carrying a full KV cache — the cache
|
|
45
|
+
* costs 64 KiB per token: 8 GiB at 131,072 and 16 GiB at 262,144. The same
|
|
46
|
+
* process later measured 47.0 GB resident, consistent with the cache filling.
|
|
47
|
+
*
|
|
48
|
+
* So the honest statement is: this costs up to ~8 GiB more than 131,072 once
|
|
49
|
+
* the cache is populated, which a 128 GB machine carries comfortably. The 48
|
|
50
|
+
* linear-attention layers do make it far cheaper than a full-attention model of
|
|
51
|
+
* this size would be, but "free" was wrong.
|
|
52
|
+
*
|
|
53
|
+
* Verified separately and still true: a real agent turn at this setting made
|
|
54
|
+
* the correct edit with the prefix cache reusing (23,301 cold, then 56 and 306
|
|
55
|
+
* tokens).
|
|
41
56
|
*
|
|
42
57
|
* Operators on less memory override it with `--ctx` or
|
|
43
58
|
* `models.llamaServer.contextSize`.
|
|
@@ -55,6 +70,108 @@ export declare const DEFAULT_LLAMA_CONTEXT = 262144;
|
|
|
55
70
|
export declare const DEFAULT_ANTHROPIC_PROXY_PORT = 8081;
|
|
56
71
|
/** The historical base URL, pinned by test/m144.llama-server.test.ts. */
|
|
57
72
|
export declare const LEGACY_DEFAULT_BASE_URL = "http://localhost:8080/v1";
|
|
73
|
+
/**
|
|
74
|
+
* The reasoning efforts Qwen3.8's chat template will actually accept.
|
|
75
|
+
*
|
|
76
|
+
* MEASURED against the live template, with a deliberately bogus value as a
|
|
77
|
+
* control (both behave identically, which is how we know the check is real):
|
|
78
|
+
*
|
|
79
|
+
* reasoning_effort=xhigh -> 200, and it is the template's OWN default
|
|
80
|
+
* reasoning_effort=medium -> 200
|
|
81
|
+
* reasoning_effort=low -> 200
|
|
82
|
+
* reasoning_effort=high -> 500 raise_exception('Unexpected reasoning effort high')
|
|
83
|
+
* reasoning_effort=bogus -> 500 (the control)
|
|
84
|
+
*
|
|
85
|
+
* `high` is the trap: it is the spelling every other vendor uses, it is what
|
|
86
|
+
* Claude Code itself puts in `output_config.effort`, and it is fatal here —
|
|
87
|
+
* a template exception fires BEFORE inference, so the turn dies with no
|
|
88
|
+
* partial output. Hence a closed list rather than a string passthrough.
|
|
89
|
+
*/
|
|
90
|
+
export declare const LOCAL_AGENT_REASONING_EFFORTS: readonly ["low", "medium", "xhigh"];
|
|
91
|
+
export type LocalAgentReasoningEffort = (typeof LOCAL_AGENT_REASONING_EFFORTS)[number];
|
|
92
|
+
/**
|
|
93
|
+
* Per-request defaults the Anthropic lane applies when the CLIENT DID NOT.
|
|
94
|
+
*
|
|
95
|
+
* `null` everywhere means "send what the client sent", which is today's
|
|
96
|
+
* behaviour exactly. Nothing here is defaulted to a non-null value on
|
|
97
|
+
* purpose — see the note on {@link resolveLocalAgentDefaults}.
|
|
98
|
+
*/
|
|
99
|
+
export interface LocalAgentRequestDefaults {
|
|
100
|
+
readonly reasoningEffort: LocalAgentReasoningEffort | null;
|
|
101
|
+
readonly temperature: number | null;
|
|
102
|
+
readonly topP: number | null;
|
|
103
|
+
readonly topK: number | null;
|
|
104
|
+
}
|
|
105
|
+
/** Every field null — "change nothing", the shipping default. */
|
|
106
|
+
export declare const NO_LOCAL_AGENT_DEFAULTS: LocalAgentRequestDefaults;
|
|
107
|
+
/**
|
|
108
|
+
* Resolve the local agent lane's per-request defaults.
|
|
109
|
+
*
|
|
110
|
+
* WHY THESE ARE ALL OFF BY DEFAULT — the measurements, so the next person
|
|
111
|
+
* does not have to re-derive them.
|
|
112
|
+
*
|
|
113
|
+
* REASONING EFFORT is the largest lever measured on this runtime, and it is
|
|
114
|
+
* currently unreachable. The template defaults to `xhigh`; Claude Code's own
|
|
115
|
+
* `output_config.effort` is dropped on the floor by llama-server (verified:
|
|
116
|
+
* sending it changes nothing), so no caller can ask for less. Holding
|
|
117
|
+
* sampling at greedy and varying only the effort, on identical tool-calling
|
|
118
|
+
* prompts, the DECODE TOKEN COUNT for the same correct answer was:
|
|
119
|
+
*
|
|
120
|
+
* task xhigh medium low thinking-off
|
|
121
|
+
* verbatim_sha 536 218 141 64
|
|
122
|
+
* verbatim_oddpath 78 59 59 48
|
|
123
|
+
*
|
|
124
|
+
* Decode, not prompt processing, is what a warm agent turn spends its time
|
|
125
|
+
* on: a measured hard-tool-call turn was 69.7s wall of which 65s was decode
|
|
126
|
+
* and ~1s was prompt (473 tokens against a warm prefix cache). So `low` is
|
|
127
|
+
* worth roughly 3.8x on the decode-bound part of a turn.
|
|
128
|
+
*
|
|
129
|
+
* It is still NOT the default here — and the multi-step battery that the
|
|
130
|
+
* paragraph above asked for has since been run, which CHANGES WHICH VALUE an
|
|
131
|
+
* operator should pick while leaving the default alone.
|
|
132
|
+
*
|
|
133
|
+
* 5 agentic tasks x 3 efforts x 3 trials, plus a long-horizon `api-migration`
|
|
134
|
+
* arm run separately at a 1500s budget:
|
|
135
|
+
*
|
|
136
|
+
* arm pass mean decode total wall
|
|
137
|
+
* xhigh 15/15 1582 4208s
|
|
138
|
+
* medium 15/15 766 (2.07x fewer) 2545s
|
|
139
|
+
* low 15/15 1061 (1.49x fewer) 2657s
|
|
140
|
+
*
|
|
141
|
+
* THE LADDER IS NOT MONOTONIC. `medium` beats `low` on decode AND wall-clock,
|
|
142
|
+
* on 5 of 6 tasks, and the mechanism is visible in the turn counts: `low`
|
|
143
|
+
* under-thinks per turn and pays it back in extra tool-calling round trips
|
|
144
|
+
* (`refuse-unsafe-delete` 3.0 -> 4.0 turns, `edge-case-parser` 5.0 -> 6.3, and
|
|
145
|
+
* one `api-migration` trial at 10 turns/806s against medium's worst of
|
|
146
|
+
* 8/413s). So the single-call result above — which ranked `low` best — does
|
|
147
|
+
* not survive multi-step work. Prefer `medium`.
|
|
148
|
+
*
|
|
149
|
+
* Quality remains a NON-RESULT, which is why the shipped default still does
|
|
150
|
+
* not move: every arm went 15/15, so there are no failures to compare. That
|
|
151
|
+
* BOUNDS the difference rather than measuring it — Wilson is [0.80, 1.00] per
|
|
152
|
+
* arm, so a regression under roughly 20 points would have been invisible, and
|
|
153
|
+
* separating 100% from 95% would need 100+ trials per arm. The mechanism is
|
|
154
|
+
* here, the numbers are here, and the operator chooses:
|
|
155
|
+
*
|
|
156
|
+
* "models": { "llamaServer": { "agentDefaults": { "reasoningEffort": "medium" } } }
|
|
157
|
+
*
|
|
158
|
+
* Reports for every trial are in `baselines/` alongside this lane's others.
|
|
159
|
+
*
|
|
160
|
+
* SAMPLING is off for a different reason: it was measured and REJECTED. The
|
|
161
|
+
* hypothesis was that llama-server's chat-tuned defaults (temperature 1.0,
|
|
162
|
+
* top_k 20, top_p 0.95, min_p 0.05 — taken from the GGUF's own metadata)
|
|
163
|
+
* corrupt tool calls. Across the batteries run against the live runtime the
|
|
164
|
+
* shipping default did not drop a single call that greedy decoding kept. The
|
|
165
|
+
* knob exists for an operator with a different model; it is not a fix,
|
|
166
|
+
* because no defect was found to fix.
|
|
167
|
+
*
|
|
168
|
+
* `min_p` is deliberately absent even though the server honours it: it is not
|
|
169
|
+
* part of the Anthropic request schema, and this lane's carrier is
|
|
170
|
+
* `/v1/messages`. Offering a field that would be dropped in transit is worse
|
|
171
|
+
* than not offering it — see the reasoning-effort note in anthropic-shim.ts
|
|
172
|
+
* for the measurement that made that failure mode concrete.
|
|
173
|
+
*/
|
|
174
|
+
export declare function resolveLocalAgentDefaults(cfg?: AshlrConfig): LocalAgentRequestDefaults;
|
|
58
175
|
/** Is this host name one that only reaches this machine? */
|
|
59
176
|
export declare function isLoopbackHost(host: string): boolean;
|
|
60
177
|
/** A bind host after the loopback gate, plus what was refused (or null). */
|