Skip to content

feat(kap-server): register global WS targets#2058

Open
wbxl2000 wants to merge 2 commits into
mainfrom
feat/ws-global-target-transport
Open

feat(kap-server): register global WS targets#2058
wbxl2000 wants to merge 2 commits into
mainfrom
feat/ws-global-target-transport

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

No separate issue. This extracts the connection-level global event transport from #2032 so it can be reviewed independently.

Problem

Global events currently reach a WebSocket connection only through its per-session subscriptions. A client that needs lightweight cross-session status updates would otherwise have to subscribe to complete event streams for every session.

What changed

  • Register a connection as a global event target after a successful client_hello and any requested cursor replay.
  • Fan global events out to the union of connection-level targets and session subscribers, exactly once per connection.
  • Unregister targets on socket close and guard handshake subscription races.
  • Add broadcaster and connection tests for isolation, deduplication, ordering, and close races.

This PR intentionally does not activate producers for every session, replay current work facts, add interaction notification events, or change forked transcript behavior. Those remain in #2032.

Verification

  • pnpm --filter @moonshot-ai/kap-server exec vitest run test/sessionEventBroadcaster.test.ts test/wsConnectionV1.test.ts
  • pnpm --filter @moonshot-ai/kap-server run typecheck
  • pnpm --filter @moonshot-ai/kap-server run build
  • pnpm changeset status

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • No user-facing documentation update is required for this transport-only foundation.

@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7065acb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@7065acb
npx https://pkg.pr.new/@moonshot-ai/kimi-code@7065acb

commit: 7065acb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant