chore(api/events): drop daemon-side alias bridges to canonical event types#32608
Merged
Merged
Conversation
…types Following review feedback on #32548, daemon/message-types/*.ts was adding `export type FooLocalName = FooEvent` aliases over every event that migrated to assistant/src/api/events/. These bridges shadow the canonical name and create a second name for the same thing — exactly the kind of drift the canonical directory exists to prevent. What changed - conversations.ts: drop CompactionCircuitOpen/CompactionCircuitClosed aliases; reference canonical *Event names directly in _ConversationsServerMessages. Fix stale doc cross-reference. - home.ts: drop HomeFeedUpdated alias; _HomeServerMessages references HomeFeedUpdatedEvent directly. - messages.ts: drop four message-queue aliases (MessageQueued/ MessageDequeued/MessageRequestComplete/MessageQueuedDeleted), drop InteractionResolved alias, drop InteractionResolutionState re-export, simplify import (no more CanonicalInteractionResolutionState rename), inline canonical names in _MessagesServerMessages. - runtime/pending-interactions.ts: re-point both import type and export type of InteractionResolutionState to the canonical source. - api/README.md: codify the rule under the daemon-adoption step so future batches don't reintroduce the pattern. No behavior change — only type-level renaming. Per-domain aggregator unions keep their existing shape and continue to feed message-protocol.ts. Lint verified by running eslint from the main checkout with the worktree's file contents swapped in (worktree's symlinked node_modules breaks eslint's path resolution, hence --no-verify).
dvargasfuertes
approved these changes
May 29, 2026
faeb335 to
f78b93b
Compare
dvargasfuertes
approved these changes
May 29, 2026
vellum-apollo-bot Bot
pushed a commit
that referenced
this pull request
May 30, 2026
…s to canonical Zod schemas Batch 6 of the canonical-events migration. Moves four conversation/identity metadata signals out of the hand-rolled web parser and into strict Zod schemas under assistant/src/api/events/. Daemon code now references the canonical *Event types directly — no alias bridges (per #32608). Events migrated: - identity_changed — name/role/personality/emoji/home (all string) - avatar_updated — avatarPath (string) - conversation_list_invalidated — reason enum (created/renamed/deleted/reordered/seen_changed) - conversation_title_updated — conversationId, title Canonical schemas (new): - assistant/src/api/events/identity-changed.ts - assistant/src/api/events/avatar-updated.ts - assistant/src/api/events/conversation-list-invalidated.ts (also exports the ConversationListInvalidatedReason enum + schema) - assistant/src/api/events/conversation-title-updated.ts Wired into assistant/src/api/index.ts: imports, re-exports, and AssistantEventSchema discriminated union (20 → 24 members). Daemon adoption (no alias bridges): - daemon/message-types/workspace.ts: dropped IdentityChanged interface; union references IdentityChangedEvent directly. - daemon/message-types/settings.ts: dropped AvatarUpdated interface; union references AvatarUpdatedEvent directly. - daemon/message-types/conversations.ts: dropped ConversationListInvalidated + ConversationTitleUpdated interfaces + the local ConversationListInvalidatedReason enum. - runtime/sync/resource-sync-events.ts: re-pointed its ConversationListInvalidatedReason import to the canonical source. Tightenings vs. web's defensive parser: - identity_changed / avatar_updated: web previously read only `type` (the daemon emits richer payloads). Canonical now mirrors the daemon emit; handlers continue to treat these as cache-invalidation-only signals. - conversation_list_invalidated.reason is now a strict enum (was a defensive string falling back to "created"). - All four events drop the unused defensive `conversationId?` field that the legacy web interfaces carried. Web cut-over: - apps/web/src/types/event-types.ts: dropped the 4 interface defs + the ConversationListInvalidatedReason type alias + 4 union members (now covered by APIAssistantEvent automatically). - apps/web/src/domains/chat/utils/stream-handlers/metadata-handlers.ts: re-pointed imports to @vellumai/assistant-api. - apps/web/src/domains/chat/api/event-parser.ts: deleted the 4 legacy case blocks (−30 LOC); dropped the now-unused ConversationListInvalidatedReason import. - Test fixtures padded to satisfy strict canonical shapes. Tests: - 11 new parser tests under apps/web/src/domains/chat/api/event-parser.test.ts (matching Batch-5 inline-literal pattern). Full file: 136/136 ✅ - metadata-handlers tests: 49/49 ✅ - daemon sync-publisher / proactive-artifact: 30/30 ✅ - web tsc: clean - cross-domain audit: no allowlist changes Refs #32548 #32608
vellum-apollo-bot Bot
pushed a commit
that referenced
this pull request
May 30, 2026
…s to canonical Zod schemas Batch 6 of the canonical-events migration. Moves four conversation/identity metadata signals out of the hand-rolled web parser and into strict Zod schemas under assistant/src/api/events/. Daemon code now references the canonical *Event types directly — no alias bridges (per #32608). Events migrated: - identity_changed — name/role/personality/emoji/home (all string) - avatar_updated — avatarPath (string) - conversation_list_invalidated — reason enum (created/renamed/deleted/reordered/seen_changed) - conversation_title_updated — conversationId, title Canonical schemas (new): - assistant/src/api/events/identity-changed.ts - assistant/src/api/events/avatar-updated.ts - assistant/src/api/events/conversation-list-invalidated.ts (also exports the ConversationListInvalidatedReason enum + schema) - assistant/src/api/events/conversation-title-updated.ts Wired into assistant/src/api/index.ts: imports, re-exports, and AssistantEventSchema discriminated union (20 → 24 members). Daemon adoption (no alias bridges): - daemon/message-types/workspace.ts: dropped IdentityChanged interface; union references IdentityChangedEvent directly. - daemon/message-types/settings.ts: dropped AvatarUpdated interface; union references AvatarUpdatedEvent directly. - daemon/message-types/conversations.ts: dropped ConversationListInvalidated + ConversationTitleUpdated interfaces + the local ConversationListInvalidatedReason enum. - runtime/sync/resource-sync-events.ts: re-pointed its ConversationListInvalidatedReason import to the canonical source. Tightenings vs. web's defensive parser: - identity_changed / avatar_updated: web previously read only `type` (the daemon emits richer payloads). Canonical now mirrors the daemon emit; handlers continue to treat these as cache-invalidation-only signals. - conversation_list_invalidated.reason is now a strict enum (was a defensive string falling back to "created"). - All four events drop the unused defensive `conversationId?` field that the legacy web interfaces carried. Web cut-over: - apps/web/src/types/event-types.ts: dropped the 4 interface defs + the ConversationListInvalidatedReason type alias + 4 union members (now covered by APIAssistantEvent automatically). - apps/web/src/domains/chat/utils/stream-handlers/metadata-handlers.ts: re-pointed imports to @vellumai/assistant-api. - apps/web/src/domains/chat/api/event-parser.ts: deleted the 4 legacy case blocks (−30 LOC); dropped the now-unused ConversationListInvalidatedReason import. - Test fixtures padded to satisfy strict canonical shapes. Tests: - 11 new parser tests under apps/web/src/domains/chat/api/event-parser.test.ts (matching Batch-5 inline-literal pattern). Full file: 136/136 ✅ - metadata-handlers tests: 49/49 ✅ - daemon sync-publisher / proactive-artifact: 30/30 ✅ - web tsc: clean - cross-domain audit: no allowlist changes Refs #32548 #32608
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.
Follow-up to the review feedback on #32548.
What
daemon/message-types/*.tswas addingexport type FooLocalName = FooEventaliases over every event that migrated toassistant/src/api/events/. These bridges shadow the canonical name and create a second name for the same thing — exactly the kind of drift the canonical directory exists to prevent.This PR removes them, codifies the rule, and re-points the one downstream consumer that depended on a re-exported type.
Why
Vargas's review thread on #32548 flagged this in four places (
conversations.ts:514,home.ts:13,home.ts:17,messages.ts:378). The aliases pre-date the canonical migration and were carried forward by inertia. Going forward each migrated event has exactly one name — the canonical*Event— referenced directly by the aggregator union and imported by daemon consumers from../../api/events/<name>.js.Changes
assistant/src/daemon/message-types/conversations.ts— dropCompactionCircuitOpen/CompactionCircuitClosedaliases;_ConversationsServerMessagesreferences the canonical*Eventnames directly. Doc cross-reference fixed.assistant/src/daemon/message-types/home.ts— dropHomeFeedUpdatedalias;_HomeServerMessages(still consumed bymessage-protocol.ts:201) referencesHomeFeedUpdatedEventdirectly.assistant/src/daemon/message-types/messages.ts— drop the four message-queue aliases (MessageQueued/MessageDequeued/MessageRequestComplete/MessageQueuedDeleted), drop theInteractionResolvedalias, drop theInteractionResolutionStatere-export, simplify the import (no moreCanonicalInteractionResolutionStaterename), and inline canonical names in_MessagesServerMessages.assistant/src/runtime/pending-interactions.ts— re-point both theimport typeand theexport typeofInteractionResolutionStateto the canonical source (../api/events/interaction-resolved.js).assistant/src/api/README.md— codify the rule under the daemon-adoption step (### 2. Adopt the canonical type in daemon code) so future batches don't reintroduce the pattern.No behavior change — purely type-level renaming. Per-domain aggregator unions keep their existing shape and continue to feed
message-protocol.ts.Local gate
apps/web: tsc clean,event-parser.test.ts127/127, cross-domain audit clean.assistant: targeted tests (circuit-breaker-pipeline.test.ts+pending-interactions-resolved-event.test.ts) 21/21.ResolveMessagepath-resolution bug).Threads addressed
Closes the four review comments on #32548:
conversations.ts:514— "delete these re-exports" ✅home.ts:13— "delete this re-export" ✅home.ts:17— "do we use this union? delete if not" → yes, it's the input to_AllServerMessagesinmessage-protocol.ts:201; kept and inlined the canonical name as the member.messages.ts:378— "delete tese re-exports" ✅