Skip to content

Package boundaries

Director is a leaf consumer in the dependency graph. This page enumerates what it depends on and what is forbidden.

Allowed dependencies

package.json:

json
"dependencies": {
  "@open-matrix/core": "workspace:*",
  "@open-matrix/chat-component": "workspace:*"
}

That's it. Two workspace packages, both consumed at workspace-current versions.

  • @open-matrix/coreMatrixActorHtmlElement, MatrixDSLHost, RequestReply, MxSplit, browser bootstrap helpers, BrowserProfileTrace, HostedRuntimeRecovery, HostedRuntimeTarget.
  • @open-matrix/chat-component — only its surface subpath, dynamically imported by DirectorChatSurfaceHost.

Vite alias resolution

vite.config.ts:23-37 adds explicit aliases:

ts
{ find: /^@open-matrix\/core\/(.+)$/, replacement: <core-src>/$1 },
{ find: '@open-matrix/federation', replacement: <federation-src>/index.ts },
{ find: '@matrix/federation',      replacement: <federation-src>/index.ts },

Plus shims for Node-only modules so anything that drifts in from a transitive dependency doesn't blow up the browser bundle:

ts
crypto, child_process, fs, fs/promises, path

The shims are minimal stubs in src/shims/.

Forbidden imports

  • Cross-package source imports via ../../ — only declared dependencies. The Vite alias for @open-matrix/core resolves to source in dev for fast HMR; in build it resolves through the workspace package graph.
  • Direct imports from @open-matrix/chat-component's app surface — Director uses surface/register-surface.ts only. Anything else (MatrixChatApp, ChatInput, etc.) is the Chat app's UI and would create the duplicate-class identity problem solved by the lazy chunk.
  • Direct imports from @open-matrix/agents, @open-matrix/inference, @open-matrix/observability — those are runtime backends. Director talks to them via RequestReply only. Importing them would pull node-only code into the browser.
  • Imports from @open-matrix/host-service, host-control, system-auth, system-gateway-http — supervisor, control, auth, gateway are forever runtime-side.

Why two-way is forbidden

@open-matrix/director does not export anything for other packages to consume. There is no export in package.json (it ships only dist/ and matrix.json). If you find another package importing from @open-matrix/director, that's a violation. Director is end-of-graph.

Manifest declarations

director/matrix.json (the package manifest):

json
{
  "name": "@open-matrix/director",
  "version": "0.1.28",
  "runtime": { "language": "typescript", "entry": "dist/index.html" },
  "webapp": {
    "distDir": "dist",
    "entry": "index.html",
    "appName": "director",
    "shells": ["platform", "edge"]
  },
  "components": [],
  "permissions": { "fsPolicy": "none" }
}

components: [] — Director declares zero backend actor components. permissions.fsPolicy: "none" — it does not access the filesystem at runtime. shells: ["platform", "edge"] — discoverable from both shells.

See also

Source: projects/matrix-3/packages/director/package.json, vite.config.ts:22-38, matrix.json.