Appearance
Chat package
@open-matrix/chat is a hybrid package: the same source tree builds two outputs (dist/browser/ and dist/runtime/), and a runner can mount either side independently.
Source tree
projects/matrix-3/packages/chat/
├── src/
│ ├── ChatApp.ts ← page actor (135 KB, central orchestrator)
│ ├── index.ts ← runtime barrel export
│ ├── browser/
│ │ ├── bootstrap.ts ← bootstrapChatBrowser entrypoint
│ │ ├── register-elements.ts ← customElements.define for all browser tags
│ │ ├── index.html ← static index served by gateway
│ │ └── app-shell.css
│ ├── components/ ← chat-* custom elements
│ │ ├── ChatHeader.ts
│ │ ├── ChatInput.ts
│ │ ├── ChatMessageList.ts
│ │ ├── ChatSidebar.ts
│ │ ├── ChatStatusBar.ts
│ │ ├── ConnectionStatus.ts
│ │ └── SessionPanel.ts
│ ├── elements/ ← mx-* renderers, chat-actor base
│ │ ├── chat-actor-element.ts
│ │ ├── mx-activity-trace.ts
│ │ ├── mx-chat-message.ts
│ │ ├── mx-code-viewer.ts
│ │ ├── mx-component-browser.ts
│ │ ├── mx-data-table.ts
│ │ └── mx-markdown-viewer.ts
│ ├── services/ ← runtime-side singletons
│ │ ├── ChatSecurityRealmService.ts
│ │ ├── ChatTopicClaimService.ts
│ │ └── DaemonLlmProxy.ts ← legacy federation route
│ ├── app/services/ ← browser-side proxies + impl
│ │ ├── ChatTheme.ts
│ │ ├── ChatComponentLibraryProxy.ts
│ │ ├── ChatConversationProxy.ts
│ │ ├── ChatExportService.ts
│ │ ├── ChatIdentityProxy.ts
│ │ ├── ChatMcpProxy.ts
│ │ ├── ChatPreferencesProxy.ts
│ │ ├── ChatSessionStateProxy.ts
│ │ ├── adapters/ ← Remote* adapters that talk to bus actors
│ │ └── impl/ ← Local* in-memory implementations
│ ├── contracts/ ← interfaces consumed by services
│ │ ├── IChatComponentLibraryService.ts
│ │ ├── IChatConversationService.ts
│ │ ├── IChatIdentityService.ts
│ │ ├── IChatMcpStatusService.ts
│ │ ├── IChatPreferencesService.ts
│ │ └── IChatSessionStateService.ts
│ ├── runtime/ ← runtime-mode resolution + bootstrap
│ │ ├── apply-chat-profile.ts
│ │ ├── bind-chat-services.ts
│ │ ├── create-chat-runtime.ts
│ │ ├── create-host-managed-chat.ts
│ │ ├── create-standalone-connected-chat.ts
│ │ ├── create-standalone-local-chat.ts
│ │ ├── create-daemon-hosted-chat.ts
│ │ ├── index.ts
│ │ ├── resolve-chat-config.ts
│ │ └── __tests__/
│ ├── shims/ ← Node-shim for browser bundle (crypto, fs, etc.)
│ ├── types/
│ └── utils/
├── config/
│ ├── config.defaults.json
│ ├── config.schema.json
│ └── profiles/ ← per-mode overrides
├── matrix.json
├── matrix.service.json
├── package.json
├── build.mjs ← orchestrates browser + runtime builds
├── vite.config.ts ← browser build
└── vite.runtime.config.ts ← runtime buildExports
package.json:
json
"exports": {
".": { "import": "./dist/runtime/index.js" },
"./browser": { "import": "./dist/browser/register-elements.js" },
"./bootstrap": { "import": "./dist/browser/bootstrap.js" },
"./dist-path": { "import": "./dist-path.js" }
}@open-matrix/chat(default) → runtime barrel.@open-matrix/chat/browser→customElements.definefor every Chat tag.@open-matrix/chat/bootstrap→bootstrapChatBrowser()(used by host shells that bootstrap Chat themselves).@open-matrix/chat/dist-path→ resolves the absolute path todist/. Used by Host Service when serving static assets.
Build outputs
build.mjs runs both Vite builds:
bash
npx vite build # browser → dist/browser/
npx vite build -c vite.runtime.config.ts # runtime → dist/runtime/Browser output: dist/browser/:
index.htmlregister-elements.js(entry)bootstrap.jsassets/<chunked code>.js
Runtime output: dist/runtime/:
index.js— the headless service exports.- Source maps.
Headless services declared in matrix.json
chat (root MatrixChatApp, surface: browser)
chat.security-realm (ChatSecurityRealmService, surface: headless, autoStart: true)
chat.topic-claims (ChatTopicClaimService, surface: headless, autoStart: true)
chat.conversation (ChatConversationProxy, surface: headless, autoStart: true)
chat.component-library (ChatComponentLibraryProxy, surface: headless, autoStart: true)
chat.identity (ChatIdentityProxy, surface: headless, autoStart: true)
chat.preferences (ChatPreferencesProxy, surface: headless, autoStart: true)
chat.session-state (ChatSessionStateProxy, surface: headless, autoStart: true)
chat.mcp (ChatMcpProxy, surface: headless, autoStart: false)
chat.export (ChatExportService, surface: headless, autoStart: true)When the runtime side is started by mx-cli (or Host Service), all autoStart: true actors are mounted under the chat namespace.
Standalone vs hosted modes
The runtime entrypoints (create-standalone-local-chat.ts, create-standalone-connected-chat.ts, create-host-managed-chat.ts) call into bindChatServices with mode-specific service implementations. See runtime integration.
See also
Source:
projects/matrix-3/packages/chat/package.json,chat/matrix.json,chat/src/tree,build.mjs.