fix(web): harden typed SPA chat lifecycle

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
This commit is contained in:
shaggy (mosaic-dev box)
2026-08-10 00:24:20 -05:00
co-authored by Claude Haiku 4.5
parent b2e005f2b4
commit caebf9ef70
20 changed files with 1778 additions and 125 deletions
+9 -21
View File
@@ -1,17 +1,7 @@
// Centralizes the type-only import of the shared `/chat` Socket.IO contract from
// @mosaicstack/types' source.
//
// `apps/web` does not declare `@mosaicstack/types` as a package dependency (P3 scope
// forbids editing package manifests/lockfiles), so these are type-only imports
// resolved directly against the package source. `import type` is erased at compile
// time, so no runtime dependency is introduced — this only reuses the exact payload
// shapes instead of redeclaring them.
//
// This deliberately imports the narrow `chat/events` and `commands/index` entry
// points rather than the package's full `src/index` barrel: the barrel also re-exports
// class-validator/class-transformer decorated DTOs (chat.dto.ts, reflection.dto.ts,
// connector-lease.dto.ts) that require compiler options apps/web's tsconfig does not
// set, which breaks `tsc --noEmit` here even though only types are imported.
// the public `@mosaicstack/types` package. `import type` is erased at compile
// time, so this introduces no runtime dependency — it only reuses the exact
// payload shapes instead of redeclaring them.
import type { Socket } from 'socket.io-client';
import type {
AbortPayload,
@@ -21,6 +11,9 @@ import type {
AgentThinkingPayload,
ChatMessagePayload,
ClientToServerEvents,
CommandDef,
CommandManifest,
CommandManifestPayload,
ErrorPayload,
MessageAckPayload,
RoutingDecisionInfo,
@@ -28,19 +21,14 @@ import type {
SessionInfoPayload,
SessionUsagePayload,
SetThinkingPayload,
ToolEndPayload,
ToolStartPayload,
} from '../../../../packages/types/src/chat/events';
import type {
CommandDef,
CommandManifest,
CommandManifestPayload,
SkillCommandDef,
SlashCommandApprovalResultPayload,
SlashCommandPayload,
SlashCommandResultPayload,
SystemReloadPayload,
} from '../../../../packages/types/src/commands/index';
ToolEndPayload,
ToolStartPayload,
} from '@mosaicstack/types';
export type {
AbortPayload,