feat(klient): contract-driven facade with http/ipc/memory transports - #1768
Conversation
- add zod-validated contract sections (global/session/agent) under src/contract and a facade exposing global.*, session(id).*, agent(id).* - select transport once at creation via subpath entries (@moonshot-ai/klient/http|ipc|memory); drop legacy channel/client/ httpChannel/wsChannel/wsKlient/proxy implementations - absorb packages/server-e2e into packages/klient test/e2e suites (dual-backend, legacy v1, v2 wire) and remove the server-e2e workspace - expose model registry and catalog services on kap-server v2 RPC surface
🦋 Changeset detectedLatest commit: fc55640 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8761b00a3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| update: (patch) => call(scope, 'sessionMetadata', 'update', [patch]) as Promise<void>, | ||
| setArchived: (archived) => | ||
| call(scope, 'sessionMetadata', 'setArchived', [archived]) as Promise<void>, | ||
| status: () => call(scope, 'sessionActivity', 'status', []) as Promise<SessionStatus>, |
There was a problem hiding this comment.
Add the missing sessionActivity service before exposing status
This new facade method routes session.status() to a sessionActivity v2 service, but that service does not exist in agent-core-v2 and is not exposed by packages/kap-server/src/transport/channelRegistry.ts (repo-wide rg "ISessionActivity|sessionActivity" only finds the new klient references and tests). As a result, HTTP callers get an unknown service: sessionActivity response for every klient.session(id).status() call, and the memory transport also imports a non-existent @moonshot-ai/agent-core-v2/session/sessionActivity/sessionActivity module. Either add/register the service or remove/remap this facade method.
Useful? React with 👍 / 👎.
The engine retired its sessionActivity service in MoonshotAI#1751 (session busy is now derived from agent activity views), but the facade still called the deleted wire channel and imported the deleted engine module, breaking typecheck and every klient suite at import time. - drop the sessionActivity contract/registry entries and mirror the agentActivityView service instead (agent scope) - compose session status() client-side from the pending interaction lists and each agent's agentActivityView, keeping the retired service's precedence and typing SessionStatus locally in the facade - replace the deleted-channel call in the v2 smoke suite with a sessionInteractionService probe - fix the legacy image-file suite to wait with the harness's waitForSessionBusy
…oonshotAI#1768) * feat(klient): contract-driven facade with http/ipc/memory transports - add zod-validated contract sections (global/session/agent) under src/contract and a facade exposing global.*, session(id).*, agent(id).* - select transport once at creation via subpath entries (@moonshot-ai/klient/http|ipc|memory); drop legacy channel/client/ httpChannel/wsChannel/wsKlient/proxy implementations - absorb packages/server-e2e into packages/klient test/e2e suites (dual-backend, legacy v1, v2 wire) and remove the server-e2e workspace - expose model registry and catalog services on kap-server v2 RPC surface * fix(klient): derive session status from agentActivityView The engine retired its sessionActivity service in MoonshotAI#1751 (session busy is now derived from agent activity views), but the facade still called the deleted wire channel and imported the deleted engine module, breaking typecheck and every klient suite at import time. - drop the sessionActivity contract/registry entries and mirror the agentActivityView service instead (agent scope) - compose session status() client-side from the pending interaction lists and each agent's agentActivityView, keeping the retired service's precedence and typing SessionStatus locally in the facade - replace the deleted-channel call in the v2 smoke suite with a sessionInteractionService probe - fix the legacy image-file suite to wait with the harness's waitForSessionBusy
MoonshotAI#1775) The klient facade PR landed with its release notes planned for a later feature release; removing the two pending changesets so the next release does not pick up version bumps and changelog entries for it.
Related Issue
None — the problem is explained below.
Problem
@moonshot-ai/klientaccumulated several overlapping client implementations (channel,client,httpChannel,wsChannel,wsKlient,proxy) with no shared contract: each transport re-implemented method routing in its own way, payloads were not validated at the boundary, and there was no single façade over the kap-server surface. Meanwhile the e2e suites lived in a separatepackages/server-e2eworkspace that had to be kept in sync with the klient by hand.What changed
1. Contract-driven klient facade
global/session/agent) underpackages/klient/src/contract, and a facade exposingglobal.*,session(id).*,agent(id).*with zod validation on every call.@moonshot-ai/klient/http|ipc|memory); all three return the sameKlientshape.channel/client/httpChannel/wsChannel/wsKlient/proxyimplementations.2. Absorbed
server-e2einto the klient test suitespackages/server-e2escenarios intopackages/klient/test/e2e: dual-backend session/agent suites (in-memory + in-process server),/api/v2wire tests, and the legacy/api/v1live suites, plus the docker e2e runner.packages/server-e2eworkspace (and itsflake.nixentries) so e2e coverage evolves next to the client it tests.3. Exposed model registry / catalog on kap-server v2
src/transport/channelRegistry.ts) so klient consumers can query available models through the contract.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.