feat(service-matcher): rank via languageModelService instead of llm-bridge#955
Draft
grypez wants to merge 2 commits into
Draft
feat(service-matcher): rank via languageModelService instead of llm-bridge#955grypez wants to merge 2 commits into
grypez wants to merge 2 commits into
Conversation
…ridge The matcher vat now calls the languageModelService kernel service directly, replacing the external @ocap/llm-bridge process and its Unix-socket IOChannel protocol. Ranking is stateless: each findServices call sends the full current registry in one chat-completion request, so registrations never involve the LLM and there is no model-side context to drift out of sync with the registry. - kernel-cli: the daemon registers languageModelService at startup from llm.json in the OCAP home (open-v1 provider; API key indirected via apiKeyEnv/apiKeyFile) - kernel-language-model-service: promoted to published @metamask/kernel-language-model-service so the published CLI can depend on it - service-matcher: stateless ranker module, model vat parameter, languageModelService in the cluster config; start-matcher.sh provisions llm.json instead of spawning a bridge - llm-bridge: deleted
Contributor
Coverage Report
File Coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the matcher's
@ocap/llm-bridgesidecar with thelanguageModelServicekernel service from@metamask/kernel-language-model-service, deleting the bridge package entirely.The bridge existed to get LLM access into the matcher vat, but the kernel already had a lockdown-safe LLM service package (klms) that does the same job without a sidecar process, a Unix socket, or a line-oriented wire protocol. This PR closes the one gap that kept klms from being usable here — the daemon had no way to register it — and rebuilds the matcher's ranking on top of it.
Daemon:
llm.jsonconfig hook (@metamask/kernel-cli)llm.jsonfrom the OCAP home; when present, it registers alanguageModelServicekernel service backed by any Open/v1-compatible endpoint.apiKeyEnvorapiKeyFile— the struct rejects an inline key so tokens never live in the config file.Matcher: stateless ranking (
@ocap/service-matcher)findServicesnow sends the full current registry digest plus the query in a single chat-completion request, instead of maintaining an incremental conversation in the bridge.modelparameter via cluster config (e.g.openclaworopenclaw/<agentId>for an openclaw gateway).klms promoted to published scope
@ocap/kernel-language-model-service→@metamask/kernel-language-model-service, since the published@metamask/kernel-clinow depends on it (yarn constraints forbid published→private deps). Licenses, README install section, and publishConfig added.Deleted
packages/llm-bridge/and all its plumbing instart-matcher.sh(build/spawn/pid/log/socket management).Testing
llm-config.test.ts(config parsing, key resolution from env/file, service construction),ranker.test.ts(prompt formatting, reply parsing incl. markdown-fence tolerance), and a rewrittenmatcher-vat/index.test.ts(model param validation, registration-never-calls-LLM, registers-while-LLM-down, empty-registry short-circuit, prompt contents, hallucination skip/throw, error propagation).build,lint,yarn constraints, and changelog validation pass; test suites pass for service-matcher, kernel-cli, kernel-language-model-service, kernel-agents, kernel-test, and kernel-test-local.Caveat (why draft)
Ranking quality of the new stateless single-shot prompt should be validated against a live OpenClaw gateway (the
VALIDATION.mdwalkthrough) before merge — the old bridge used an incremental conversation, and parity has only been verified at the unit-test level.🤖 Generated with Claude Code