refactor(kap-server): drop the @moonshot-ai/protocol dependency - #1755
Merged
Conversation
Re-source every schema/type the server imported from @moonshot-ai/protocol, and remove the package dependency: - Contracts the engine owns come from agent-core-v2 leaf paths (sessionFs, git, hostFolderBrowser, auth/oauthWire, authLegacy, terminal, file, modelCatalog, contextMemory wireMessage, sessionLegacy sessionWire). - Shapes only the v1 transport needs move into a local kap-server/src/wire tree: envelope, numeric ErrorCode table, request-id, pagination, session/workspace/goal/approval/question/ task/tool/skill models, all rest-* endpoint schemas, the ws-control catalog, asyncapi, the event zod catalog, and display. - The v1 WS event stream is recomposed locally: transport/ws/v1/events.ts builds the Event union from the engine's DomainEvent plus the v1-only synthesized frames, AgentPhase moves into the legacyStatus projection, and isVolatileEventType is owned by the broadcaster module. - Tests re-point to the same local/engine sources; the server-align and errors skill docs now describe the new schema ownership. /openapi.json and /asyncapi.json are byte-identical before and after; the only test failures are the pre-existing boot/lock/workspaceFs environment flakes also present on main.
🦋 Changeset detectedLatest commit: 2895095 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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: |
Rename kap-server/src/wire to src/protocol: the v1 wire schemas keep their established name in their new home instead of introducing a second term that collides with the engine's wire journal domain. Apply the same vocabulary in the engine: sessionWire, oauthWire, and wireMessage become sessionProtocol, oauthProtocol, and protocolMessage (matching the existing toProtocolMessage naming). Keep the agent-core-dev skill doc edits minimal: only the lines whose schema/error-code home changed are updated.
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.
Related Issue
No linked issue — this is the second half of the decoupling landed in #1745.
Problem
After #1745 removed
@moonshot-ai/protocolfrom the engine, the v2 server was the last link in the engine → server → UI chain still built on the v1-era shared schema package. The schemas the server speaks fall into two kinds: contracts the engine's own services already own (fs, oauth, terminal, session/messages DTOs…), and shapes only the v1 transport needs (envelope, numeric error codes, REST endpoint schemas, the WS/asyncapi catalog). Both should live with their owners instead of in a shared package.What changed
agent-core-v2leaf paths (sessionFs, git, hostFolderBrowser, auth, authLegacy, terminal, file, modelCatalog, contextMemory, sessionLegacy).kap-server/src/protocoltree that keeps the established vocabulary: envelope, the numeric ErrorCode table, request-id, pagination, the session/workspace/goal/approval/question/task/tool/skill models, allrest-*endpoint schemas, and the ws-control / asyncapi / event-zod / display catalog (ported field-for-field; v1 quirks preserved deliberately).transport/ws/v1/events.tsbuilds theEventunion from the engine'sDomainEventplus the v1-only synthesized frames;AgentPhasemoves into the legacyStatus projection; volatile classification is owned by the broadcaster module.@moonshot-ai/protocolis removed from kap-server's dependencies. The protocol package itself, agent-core (v1), and server-e2e are untouched — server-e2e keeps validating responses against the original protocol schemas, acting as a drift oracle.Verification:
/openapi.jsonand/asyncapi.jsoncaptured before and after are byte-identical; kap-server typecheck and test suite match main's baseline (only the pre-existing boot/lock/workspaceFs environment flakes).Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.