Skip to content

feat(server): opt-in location interest for event subscriptions#37486

Open
armancharan wants to merge 4 commits into
anomalyco:v2from
armancharan:fix/event-subscription-scope
Open

feat(server): opt-in location interest for event subscriptions#37486
armancharan wants to merge 4 commits into
anomalyco:v2from
armancharan:fix/event-subscription-scope

Conversation

@armancharan

@armancharan armancharan commented Jul 17, 2026

Copy link
Copy Markdown

Issue for this PR

Related to #36443

#36443

Parent: #36441

✧ raised · ○ in review · ● approved · ✓ merged

#36441 epic: scope streams + bound payloads

Merge in order:
v2
└ ○ #37486 location interest ← this PR
   └ ○ #37487 session interest + fan-out bench
      └ ○ #37585 stream ownership / diagnostics
         └ ○ #37586 reconnect herd

Siblings under the epic (not git parents of the stack tip):
└ ○ #37559 session blobs + payloadHash
└ ○ #37570 ensure-on-first-failure → feeds #37586

First slice of the subscription-scope stack. Session narrowing continues in #37487.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds opt-in location interest on GET /api/event. Unscoped clients keep the global public feed. Scoped clients only receive matching location events (plus installation lifecycle / global.disposed). The feed still encodes each accepted public event once, then offers the shared frame to matching subscriber queues.

TUI connects with the resolved primary directory. Scope changes reconnect with a new query rather than overlapping streams. Architecture doc updated to match.

How did you verify your code works?

  • bun test test/event-feed.test.ts in packages/server
  • bun test test/promise.test.ts test/effect.test.ts in packages/client
  • typecheck for protocol, server, client, tui, cli

Screenshots / recordings

n/a

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread packages/server/src/handlers/event.ts
Comment thread packages/tui/src/app.tsx
armancharan and others added 3 commits July 17, 2026 22:33
Co-authored-by: Cursor <cursoragent@cursor.com>
No test supplies a workspace; avoid an unnecessary brand cast.

Co-authored-by: Cursor <cursoragent@cursor.com>
Collect matching subscribers first so encode/offer share one pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
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