C4 Components + Domain
Diagram source
{
"shapes": [
{
"shapes": [],
"id": "title-322wot~e1791791358926",
"category": "Always available",
"type": "markdown",
"props": {
"markdown": "# L4 — Code (C4 style): DrawMode app server\n\nThe code told the C4 way: each box says **what it is for** before **what it is**; members and file links wait on hover. Rows follow a keystroke: entry & start-up → the session (composition root) → widgets and controllers → the canvas and its live sync → persistence on the right; the domain sits underneath, the AI stack beside it. Boundaries are themes, tinted by layer. Links are plain UML: dashed arrow = depends on (**«create»** where it instantiates), filled diamond = owns, hollow triangle = inherits (solid) or implements (dashed); contracts are ball-and-socket interfaces. Domain objects are UML classes because their fields are the point. Icons: **ƒ** = a module of functions; other icons are mnemonics.\n\n**Deliberate simplifications, truth on hover:** five packages appear as themes, not boxes (the package is named on each component); the mind-map, shape-family, admin, auth-registry, import/export and layout modules are left out; the store is one interface with two implementations; the browser holds one component. The exhaustive versions are one card away.",
"fill": "#ffffff",
"outline": "none",
"magnification": 1
},
"smZ": null,
"smTab": null,
"fileLink": "docs/architecture.md",
"fileLinkDesc": "The architecture this page condenses.",
"smGroup": null,
"deleted": false,
"x": -761,
"y": 595,
"w": 536,
"h": 412
},
{
"shapes": [],
"id": "md-39id27~e1794206092304",
"category": "Always available",
"type": "markdown",
"props": {
"markdown": "# Explanation\n\nThe prompt:\n\n> Create me a C4 component diagram of the main components of the system, focusing on the interfaces / seams for persistence and team collaboration. Add the core diagram domain model underneath as a UML class diagrams.",
"fill": "#ffffff",
"outline": "#d0d7de",
"magnification": 1
},
"smZ": null,
"smTab": null,
"fileLink": null,
"fileLinkDesc": null,
"smGroup": null,
"deleted": false,
"x": 1670,
"y": 509,
"w": 488,
"h": 230
},
{
"shapes": [
{
"shapes": [],
"id": "fw_nicegui-97yl76~e1791791358875",
"category": "C4",
"type": "component",
"props": {
"name": "NiceGUI · FastAPI",
"type": "Framework · one client per tab",
"subtitle": "Renders the Quasar chrome per tab, owns the Socket.IO socket the WS RPC rides, hosts the ASGI routes",
"description": "NiceGUI 3 over FastAPI/uvicorn. The app never talks to a raw websocket: sm_rpc is one Socket.IO event on NiceGUI's server.",
"icon": "ms:",
"stroke": "#444444",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/main.py:666",
"fileLinkDesc": "ui.run() at the end of the boot sequence.\nanchor: def create_app() -> None:",
"smGroup": null,
"deleted": false,
"x": -502,
"y": 305,
"w": 190,
"h": 194
}
],
"id": "b_fw-axcve~e1791791358874",
"category": "C4",
"type": "boundary",
"props": {
"name": "Frameworks we hook",
"type": "external · nicegui, fastapi, socket.io",
"stroke": "#444444",
"fill": "#f3f3f3",
"namePos": "bl"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/vendor.py",
"fileLinkDesc": "Pinned vendored assets; the Python frameworks are pinned in pyproject.toml.",
"smGroup": null,
"deleted": false,
"x": -766,
"y": 234,
"w": 520,
"h": 320
},
{
"shapes": [
{
"shapes": [],
"id": "fn_main-1fyoo4~e1791791358877",
"category": "C4",
"type": "component",
"props": {
"name": "main.py",
"type": "Functions · entry point",
"subtitle": "Boots the process: the ONE store (files | SQL), its facades, the team provider, the MCP door, the auth wall, ui.run()",
"description": "Resolves the storage secret fail-closed, builds the store with make_store, configure()s every facade on it, picks the team provider (in-memory | Redis), installs the door and the canvas runtime, then runs NiceGUI.",
"icon": "ƒ",
"stroke": "#4f6d8f",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/main.py:666",
"fileLinkDesc": "The boot sequence, top to bottom.\nanchor: def create_app() -> None:",
"smGroup": null,
"deleted": false,
"x": -502,
"y": -107,
"w": 190,
"h": 194
},
{
"shapes": [],
"id": "comp_auth-do1ay2~e1791791358878",
"category": "C4",
"type": "component",
"props": {
"name": "Auth wall",
"type": "Functions · auth_service, zitadel_auth",
"subtitle": "Local login or Zitadel SSO, then the approval gate: pending / approved / blocked",
"description": "Every page route passes the wall; the user registry is a sync cache over the store, refreshed by delta.",
"icon": "ms:",
"stroke": "#4f6d8f",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/zitadel_auth.py:239",
"fileLinkDesc": "Identity → account + the approval gate.\nanchor: def resolve_login(identity: dict, wave_cap: int | None = None) -> str:",
"smGroup": null,
"deleted": false,
"x": -743,
"y": -107,
"w": 190,
"h": 178
},
{
"id": "5b5dc1cc-05e2-4084-ae91-0bdbc761b12f",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/main.py:702",
"fileLinkDesc": "Every facade is configured on the one store.\nanchor: ai_usage.configure(store) # the AI usage ledger rides the SAME store — shared across a fleet",
"smGroup": null,
"deleted": false,
"source": "fn_main-1fyoo4~e1791791358877",
"target": "comp_auth-do1ay2~e1791791358878",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": "Installs the auth wall and configures every facade on the one store.",
"animation": null
}
],
"id": "b_entry-b4jupr~e1791791358876",
"category": "C4",
"type": "boundary",
"props": {
"name": "HTTP entry & start-up",
"type": "drawmode · main.py, auth",
"stroke": "#4f6d8f",
"fill": "#eef2f7",
"namePos": "bl"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/main.py:666",
"fileLinkDesc": "The composition point: everything below is wired here, in order.\nanchor: def create_app() -> None:",
"smGroup": null,
"deleted": false,
"x": -762,
"y": -157,
"w": 500,
"h": 290
},
{
"shapes": [
{
"shapes": [],
"id": "iface_hooks-8cl4gd~e1791791358881",
"category": "Class diagram",
"type": "interface",
"props": {
"name": "Shell hooks",
"operations": [
"make_canvas_widget(d, model, view) → widget",
"diagram codec: to / from the store",
"seed_canonical(d) · on_canvas_change"
],
"attributes": [],
"hideAttrs": true,
"hideOps": false,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"arc": true,
"color": 2,
"description": "What WorkspaceShell requires of the product that subclasses it: the five abstract hooks. UI implements them; demomode implements them differently."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/workspace_shell.py:86",
"fileLinkDesc": "The ABC and its abstract hooks.\nanchor: class WorkspaceShell(ABC):",
"smGroup": null,
"deleted": false,
"x": -743,
"y": -472,
"w": null,
"h": null
},
{
"shapes": [],
"id": "comp_ui-co2694~e1791791358880",
"category": "C4",
"type": "component",
"props": {
"name": "UI",
"type": "Class · ui.py",
"subtitle": "Assembles the page for one tab: header, diagrams tree, panes, presence, chat; fans project pushes to every local UI",
"description": "Subclasses WorkspaceShell and implements its five required hooks (canvas factory, diagram codec, seed_canonical…). _on_canvas_change is where a persisted canvas lands before DiagramController.save.",
"icon": "ms:",
"stroke": "#a8562f",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/ui.py:1057",
"fileLinkDesc": "The session class.\nanchor: class UI(WorkspaceShell):",
"smGroup": null,
"deleted": false,
"x": -546,
"y": -530,
"w": 200,
"h": 194
},
{
"id": "3673b8bc-7f0d-4536-91f5-0d1fd0a3a14f",
"category": "Class diagram",
"type": "realization",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/ui.py:1057",
"fileLinkDesc": "Implements the five required hooks.\nanchor: class UI(WorkspaceShell):",
"smGroup": null,
"deleted": false,
"source": "comp_ui-co2694~e1791791358880",
"target": "iface_hooks-8cl4gd~e1791791358881",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
}
],
"id": "b_root-4hlv9o~e1791791358879",
"category": "C4",
"type": "boundary",
"props": {
"name": "Composition root",
"type": "one UI per browser tab",
"stroke": "#a8562f",
"fill": "#f9efe9",
"namePos": "bl"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/ui.py:1057",
"fileLinkDesc": "The product session: a WorkspaceShell with drawmode's hooks filled in.\nanchor: class UI(WorkspaceShell):",
"smGroup": null,
"deleted": false,
"x": -766,
"y": -586,
"w": 500,
"h": 296
},
{
"shapes": [
{
"shapes": [],
"id": "w_shell-5m6jaa~e1791791358883",
"category": "C4",
"type": "component",
"props": {
"name": "WorkspaceShell",
"type": "Class · workspace_shell.py · widgetcore",
"subtitle": "ABC of a session: constructs the three controllers and five chrome widgets; the product fills the hooks",
"description": "Seed-if-absent wiring of the ctx slots the pane host reads, so a rich ctx (drawmode's UI) keeps its own methods.",
"icon": "ms:",
"stroke": "#1f7f7a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/workspace_shell.py:86",
"fileLinkDesc": "The base class both products subclass.\nanchor: class WorkspaceShell(ABC):",
"smGroup": null,
"deleted": false,
"x": -177,
"y": -545,
"w": 217,
"h": 178
},
{
"shapes": [],
"id": "w_pane-aj45bs~e1791791358884",
"category": "C4",
"type": "component",
"props": {
"name": "PaneHostController",
"type": "Class · pane_host.py · widgetcore",
"subtitle": "Tiled editor groups, tabs and sashes; mounts a canvas per open diagram and wires its on_change",
"description": "Builds each canvas through the product's make_canvas_widget hook and hands the server a widget whose on_change is ctx._on_canvas_change.",
"icon": "ms:",
"stroke": "#1f7f7a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/pane_host.py:124",
"fileLinkDesc": "The split-pane host.\nanchor: class PaneHostController:",
"smGroup": null,
"deleted": false,
"x": 97,
"y": -545,
"w": 190,
"h": 178
},
{
"shapes": [],
"id": "w_pctl-8eear9~e1791791358885",
"category": "C4",
"type": "component",
"props": {
"name": "ProjectController · WorkspaceState",
"type": "Classes · controllers/ · widgetcore",
"subtitle": "Projects, membership, workspaces and per-user views — UI-free by an import-linter contract",
"description": "Everything durable it touches goes through the store: save_project, save_user, save_workspace.",
"icon": "ƒ",
"stroke": "#1f7f7a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/controllers/workspace.py:101",
"fileLinkDesc": "Project rules + state.\nanchor: class ProjectController:",
"smGroup": null,
"deleted": false,
"x": 343,
"y": -545,
"w": 190,
"h": 197
},
{
"shapes": [],
"id": "w_dctl-7safvj~e1791791358886",
"category": "C4",
"type": "component",
"props": {
"name": "DiagramController",
"type": "Class · controllers/diagrams.py · widgetcore",
"subtitle": "THE persist path: guards, stamp, touched_ms, last_editor → store.save_diagram",
"description": "Turns the getModel dict into the domain Diagram through the codec hook, then writes it under the project OWNER.",
"icon": "gl:database",
"stroke": "#1f7f7a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/controllers/diagrams.py:172",
"fileLinkDesc": "Persist one diagram.\nanchor: async def save(self, d: dict, project) -> None:",
"smGroup": null,
"deleted": false,
"x": 611,
"y": -545,
"w": 190,
"h": 178
},
{
"shapes": [],
"id": "w_header-dscyrm~e1791791358887",
"category": "C4",
"type": "component",
"props": {
"name": "WidgetHeader · GitMenu",
"type": "Classes · widget_header.py · drawmode",
"subtitle": "Composes the six header widgets; GitMenu holds every desktop-only Git action in one class",
"description": "Move a project to a repo, link one, enable merging, baseline diagrams — gated at one line.",
"icon": "ms:",
"stroke": "#1f7f7a",
"fill": "#c8e6c9"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/widget_header.py:133",
"fileLinkDesc": "The header composition.\nanchor: class WidgetHeader:",
"smGroup": null,
"deleted": false,
"x": 206,
"y": -316,
"w": 207,
"h": 197
},
{
"shapes": [],
"id": "w_presence-1xgflr~e1791791358888",
"category": "C4",
"type": "component",
"props": {
"name": "WidgetPresence · WidgetTeamChat",
"type": "Classes · widgetcore",
"subtitle": "Avatars, cursors and the project chat — all fed by the team provider",
"description": "Presence TTL-touched on each heartbeat; chat messages persisted and relayed like deltas.",
"icon": "ms:",
"stroke": "#1f7f7a",
"fill": "#c8e6c9"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/widget_presence.py",
"fileLinkDesc": "The avatar strip.",
"smGroup": null,
"deleted": false,
"x": 672,
"y": -316,
"w": 190,
"h": 181
},
{
"shapes": [],
"id": "w_diagrams-15nvts~e1791791358889",
"category": "C4",
"type": "component",
"props": {
"name": "WidgetDiagrams",
"type": "Class · widget_diagrams.py · widgetcore",
"subtitle": "The diagrams tree: open, rename, nest, tag, reorder; a double-click opens a tab",
"description": "Reads DiagramMeta only — a project switch never loads shapes.",
"icon": "ms:",
"stroke": "#1f7f7a",
"fill": "#c8e6c9"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/widget_diagrams.py",
"fileLinkDesc": "The diagram list / tree.",
"smGroup": null,
"deleted": false,
"x": -177,
"y": -316,
"w": 217,
"h": 181
},
{
"id": "f912ee4d-f4d4-4a28-ae59-6b5d1a5d83ba",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "sets up",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/pane_host.py:124",
"fileLinkDesc": "The split-pane host.\nanchor: class PaneHostController:",
"smGroup": null,
"deleted": false,
"source": "w_shell-5m6jaa~e1791791358883",
"target": "w_pane-aj45bs~e1791791358884",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": "set_up_pane(): the shell constructs the pane host and hands it the session ctx; the pane host then mounts a canvas per open diagram.",
"animation": null
}
],
"id": "b_widgets-9cod2m~e1791791358882",
"category": "C4",
"type": "boundary",
"props": {
"name": "Widgets & controllers",
"type": "widgetcore · plus drawmode's header",
"stroke": "#1f7f7a",
"fill": "#e8f4f3",
"namePos": "bl"
},
"smZ": null,
"smTab": null,
"fileLink": "docs/widgetcore.md",
"fileLinkDesc": "The chrome widget library: pieces a product composes, never a shell of its own.",
"smGroup": null,
"deleted": false,
"x": -207,
"y": -586,
"w": 1100,
"h": 513
},
{
"shapes": [
{
"shapes": [],
"id": "iface_rpc-emrsvz~e1791791358893",
"category": "Class diagram",
"type": "interface",
"props": {
"name": "WsApi RPC (sm_rpc)",
"operations": [
"apply_delta · reconcile · get_canonical",
"push: invoke(cid, method, …)"
],
"attributes": [],
"hideAttrs": true,
"hideOps": false,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"arc": true,
"color": 11,
"description": "The browser ↔ server contract: one Socket.IO event, pydantic In/Out per method, pushes to the client's own room."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ws_api/dispatcher.py:143",
"fileLinkDesc": "One Socket.IO event, typed methods, self-documenting.\nanchor: class WsApi:",
"smGroup": null,
"deleted": false,
"x": 173,
"y": 345,
"w": null,
"h": null
},
{
"shapes": [],
"id": "iface_team-4qmm3t~e1791791358896",
"category": "Class diagram",
"type": "interface",
"props": {
"name": "ITeamUpdates",
"operations": [
"apply_delta(diagram, delta, user) → seq",
"snapshot · replace_model · seed",
"presence · cursors · chat"
],
"attributes": [],
"hideAttrs": true,
"hideOps": false,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"arc": true,
"color": 10,
"description": "The collaboration protocol the server edits the canonical through; every implementor inherits it explicitly and marks methods @override."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/iteam_updates.py:74",
"fileLinkDesc": "The collaboration protocol.\nanchor: class ITeamUpdates(Protocol):",
"smGroup": null,
"deleted": false,
"x": 453,
"y": 65,
"w": null,
"h": null
},
{
"shapes": [],
"id": "c_widget-7k8oog~e1791791358891",
"category": "C4",
"type": "component",
"props": {
"name": "Canvas widget",
"type": "Functions · widget_domain.py · drawcore",
"subtitle": "build_canvas_widget: mounts one canvas; assembles and fingerprints the engine JS the browser loads once",
"description": "The engine is a pure function of the image — served immutable at /canvas-engine-{hash}.js.",
"icon": "ms:",
"stroke": "#3a6ea5",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/widget_domain.py:1169",
"fileLinkDesc": "Mount one canvas.\nanchor: def build_canvas_widget(cid, *, category, model, view, diagram_id, username, session_id, project_id,",
"smGroup": null,
"deleted": false,
"x": -127,
"y": 35,
"w": 231,
"h": 194
},
{
"shapes": [],
"id": "c_engine-4xqfaw~e1791791358892",
"category": "C4",
"type": "component",
"props": {
"name": "Canvas engine",
"type": "JavaScript · js_domain/ · runs in the browser",
"subtitle": "JointJS paper + bridge (getModel/applyModel), autosave (400 ms), history, deltasync — sends only what changed",
"description": "Every local edit becomes ONE undo step and one delta; a teammate's delta is absorbed into the undo baseline so the next diff holds only my changes.",
"icon": "ms:",
"stroke": "#3a6ea5",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/js_domain/deltasync.js:42",
"fileLinkDesc": "Ships only the keys I touched as a delta.\nanchor: function sendDelta(keys, isRetry) {",
"smGroup": null,
"deleted": false,
"x": -127,
"y": 285,
"w": 231,
"h": 194
},
{
"shapes": [],
"id": "c_wsapi-9ki4fg~e1791791358894",
"category": "C4",
"type": "component",
"props": {
"name": "WS RPC",
"type": "Functions · ws_api/ · drawcore",
"subtitle": "apply_delta: snapshot → provider → register → debounced persist → relay → publish; invoke() is the one server → canvas call",
"description": "authorize() gates every method by canvas role; the docs render themselves in /admin.",
"icon": "gl:api",
"stroke": "#3a6ea5",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ws_api/methods.py:512",
"fileLinkDesc": "The live sync path.\nanchor: async def apply_delta(p: ApplyDeltaIn, ctx) -> ApplyDeltaOut:",
"smGroup": null,
"deleted": false,
"x": 223,
"y": 35,
"w": 190,
"h": 210
},
{
"shapes": [],
"id": "c_bcast-38ai2r~e1791791358895",
"category": "C4",
"type": "component",
"props": {
"name": "Team broadcast",
"type": "Functions · ws_api/team_broadcast.py · drawcore",
"subtitle": "Per-project Redis pub/sub relay: local participants first, then PUBLISH for the other instances",
"description": "Each node re-targets its own canvases; the origin drops its own echo.",
"icon": "gl:queue",
"stroke": "#3a6ea5",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ws_api/team_broadcast.py:151",
"fileLinkDesc": "Local first, then Redis.\nanchor: async def fan_out(project_id: str, payload) -> None:",
"smGroup": null,
"deleted": false,
"x": 427,
"y": 312,
"w": 257,
"h": 180
},
{
"shapes": [],
"id": "c_team-dtafeo~e1791791358897",
"category": "C4",
"type": "component",
"props": {
"name": "Team provider",
"type": "Classes · team/ · drawcore",
"subtitle": "InMemoryTeamUpdates | RedisTeamUpdates, wrapped resilient: the live canonical + seq per diagram under a lock",
"description": "A canonical evicted from Redis is restored read-through from a live canvas, never mistaken for an empty diagram.",
"icon": "gl:cache",
"stroke": "#3a6ea5",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/team/redis_team_updates.py:97",
"fileLinkDesc": "The Redis provider.\nanchor: class RedisTeamUpdates(ITeamUpdates):",
"smGroup": null,
"deleted": false,
"x": 663,
"y": 35,
"w": 190,
"h": 194
},
{
"id": "21937ddb-30c1-464a-bf84-f55417d6a905",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "WsApi.call(…)",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/server.py:256",
"fileLinkDesc": "The browser RPC client.\nanchor: window.WsApi = (function(){",
"smGroup": null,
"deleted": false,
"source": "c_engine-4xqfaw~e1791791358892",
"target": "iface_rpc-emrsvz~e1791791358893",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": "apply_delta(cid, delta, base_seq) on every debounced edit; reconcile when a teammate is present and I am idle; get_canonical to heal a seq gap.",
"animation": null
},
{
"id": "238f4934-0489-47c3-a3b3-2c36162313b2",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "apply_delta",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ws_api/methods.py:512",
"fileLinkDesc": "The live path.\nanchor: async def apply_delta(p: ApplyDeltaIn, ctx) -> ApplyDeltaOut:",
"smGroup": null,
"deleted": false,
"source": "c_wsapi-9ki4fg~e1791791358894",
"target": "iface_team-4qmm3t~e1791791358896",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": "snapshot before, apply_delta under the lock, replace_model for a whole-model write; the provider hands back the new seq.",
"animation": null
},
{
"id": "75a4fcb7-cbfa-4294-be39-992f474a36a7",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "publish_delta",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ws_api/team_broadcast.py:177",
"fileLinkDesc": "Cross-instance relay.\nanchor: async def publish_delta(project_id: str, diagram_id: str, delta: dict, seq: int) -> None:",
"smGroup": null,
"deleted": false,
"source": "c_wsapi-9ki4fg~e1791791358894",
"target": "c_bcast-38ai2r~e1791791358895",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "7a8d34b6-b893-4df6-8487-73f0c9f2dd9f",
"category": "Class diagram",
"type": "realization",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/team/in_memory_team_updates.py:23",
"fileLinkDesc": "Explicit inheritance + @override; the Redis provider likewise.\nanchor: class InMemoryTeamUpdates(ITeamUpdates):",
"smGroup": null,
"deleted": false,
"source": "c_team-dtafeo~e1791791358897",
"target": "iface_team-4qmm3t~e1791791358896",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "882fd4dd-c50c-428f-a167-42f9d8a74d0f",
"category": "Class diagram",
"type": "realization",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ws_api/dispatcher.py:220",
"fileLinkDesc": "Attaches sm_rpc to NiceGUI's Socket.IO server.\nanchor: def wire(self):",
"smGroup": null,
"deleted": false,
"source": "c_wsapi-9ki4fg~e1791791358894",
"target": "iface_rpc-emrsvz~e1791791358893",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "f1fcfff6-cde1-4e47-957f-8665dd32fc91",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "serves the engine by hash;\nboots each canvas",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/widget_domain.py:523",
"fileLinkDesc": "Concatenates core + family JS.\nanchor: def _assemble_engine() -> str:",
"smGroup": null,
"deleted": false,
"source": "c_widget-7k8oog~e1791791358891",
"target": "c_engine-4xqfaw~e1791791358892",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
}
],
"id": "b_canvas-42xm44~e1791791358890",
"category": "C4",
"type": "boundary",
"props": {
"name": "Canvas & live sync",
"type": "drawcore · widget_domain, js_domain, ws_api, team",
"stroke": "#3a6ea5",
"fill": "#eaf1f8",
"namePos": "bl"
},
"smZ": null,
"smTab": null,
"fileLink": "docs/diagram-delta-architecture.md",
"fileLinkDesc": "The authoritative description of the live edit path.",
"smGroup": null,
"deleted": false,
"x": -207,
"y": -15,
"w": 1119,
"h": 553
},
{
"shapes": [
{
"shapes": [],
"id": "iface_persist-30dd1t~e1791791358899",
"category": "Class diagram",
"type": "interface",
"props": {
"name": "IPersistence",
"operations": [
"save_diagram · load_diagrams",
"projects · users · settings"
],
"attributes": [],
"hideAttrs": true,
"hideOps": false,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"arc": true,
"color": 13,
"description": "The store protocol; IAiPersistence extends it for the AI stack. make_store composes core + AI mixins into ONE class."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ipersistence.py:28",
"fileLinkDesc": "The store protocol.\nanchor: class IPersistence(Protocol):",
"smGroup": null,
"deleted": false,
"x": 1131,
"y": -530,
"w": null,
"h": null
},
{
"shapes": [],
"id": "p_file-m6ate~e1791791358900",
"category": "C4",
"type": "component",
"props": {
"name": "FilePersistenceStore",
"type": "Class · file_persistence_store.py",
"subtitle": "One JSON file per object under data/; a project in a Git repo saves as baseline + delta-log entries",
"description": "Single-instance by definition; the desktop's store.",
"icon": "ms:",
"stroke": "#7a5a2a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/persistence/file_persistence_store.py:214",
"fileLinkDesc": "The file backend.\nanchor: class FilePersistenceStore(IPersistence):",
"smGroup": null,
"deleted": false,
"x": 955,
"y": -427,
"w": 190,
"h": 180
},
{
"shapes": [],
"id": "p_sql-2bi2c0~e1791791358901",
"category": "C4",
"type": "component",
"props": {
"name": "SqlAlchemyPersistenceStore",
"type": "Class · sqlalchemy_store.py",
"subtitle": "SQLite or Postgres: blob tables + projections, atomic ON CONFLICT upserts so N instances never clobber each other",
"description": "Postgres is the scaling target; a blob stays the source of truth, projections are rebuilt in the same transaction.",
"icon": "gl:database",
"stroke": "#7a5a2a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/persistence/sqlalchemy_store.py:371",
"fileLinkDesc": "The SQL backend.\nanchor: class SqlAlchemyPersistenceStore(IPersistence):",
"smGroup": null,
"deleted": false,
"x": 1273,
"y": -427,
"w": 232,
"h": 194
},
{
"shapes": [],
"id": "p_dlog-bjeqhz~e1791791358902",
"category": "C4",
"type": "component",
"props": {
"name": "Diagram log",
"type": "Functions · diagram_log.py",
"subtitle": "Baseline .json + append-only _deltas_.jsonl; diff · apply · replay · fold — so Git branches merge by union",
"description": "One entry per save, one line each; the CLI folds a log back into its baseline.",
"icon": "ms:",
"stroke": "#7a5a2a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/diagram_log.py:589",
"fileLinkDesc": "Replays a log onto its baseline.\nanchor: def replay(baseline: dict, entries: Iterable[dict]):",
"smGroup": null,
"deleted": false,
"x": 955,
"y": -157,
"w": 190,
"h": 194
},
{
"shapes": [],
"id": "p_serde-f2nn30~e1791791358903",
"category": "C4",
"type": "component",
"props": {
"name": "JSON codec",
"type": "Functions · serde.py, model_migrations.py",
"subtitle": "Dataclasses ↔ JSON with schema_version stamps; a document from a NEWER build decodes read-only",
"description": "Refusing the write is the whole point of stamping.",
"icon": "ƒ",
"stroke": "#7a5a2a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/persistence/serde.py",
"fileLinkDesc": "Encode / decode the domain dataclasses.",
"smGroup": null,
"deleted": false,
"x": 1207,
"y": -159,
"w": 225,
"h": 182
},
{
"id": "2b862704-64ce-4e57-bb43-ecc5034a28b4",
"category": "Class diagram",
"type": "realization",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/persistence/file_persistence_store.py:214",
"fileLinkDesc": "Inherits the protocol explicitly.\nanchor: class FilePersistenceStore(IPersistence):",
"smGroup": null,
"deleted": false,
"source": "p_file-m6ate~e1791791358900",
"target": "iface_persist-30dd1t~e1791791358899",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "33937689-182a-465e-839b-f2a4750c9da0",
"category": "Class diagram",
"type": "realization",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/persistence/sqlalchemy_store.py:371",
"fileLinkDesc": "Inherits the protocol explicitly.\nanchor: class SqlAlchemyPersistenceStore(IPersistence):",
"smGroup": null,
"deleted": false,
"source": "p_sql-2bi2c0~e1791791358901",
"target": "iface_persist-30dd1t~e1791791358899",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "e9587244-6ac4-40d4-89e2-7934130a0679",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "serialises through",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/persistence/serde.py",
"fileLinkDesc": "The codec.",
"smGroup": null,
"deleted": false,
"source": "p_file-m6ate~e1791791358900",
"target": "p_serde-f2nn30~e1791791358903",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "f50654d2-52ae-4a95-bbe8-12b5b016f148",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "serialises through",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/persistence/model_migrations.py",
"fileLinkDesc": "schema_version per document kind.",
"smGroup": null,
"deleted": false,
"source": "p_sql-2bi2c0~e1791791358901",
"target": "p_serde-f2nn30~e1791791358903",
"vertices": [
[
67,
132
]
],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": true,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "f78116b8-7d28-4395-b450-cad5d27fefbb",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "a located project:\none entry per save",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/persistence/file_persistence_store.py:1157",
"fileLinkDesc": "Save into a repository.\nanchor: def _save_located(self, pdir: Path, target: Path, diagram: Diagram, username: str, *, merging: bool) -> None:",
"smGroup": null,
"deleted": false,
"source": "p_file-m6ate~e1791791358900",
"target": "p_dlog-bjeqhz~e1791791358902",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
}
],
"id": "b_persist-66iaby~e1791791358898",
"category": "C4",
"type": "boundary",
"props": {
"name": "Persistence",
"type": "drawcore.persistence · port + adapters + codecs",
"stroke": "#7a5a2a",
"fill": "#f6f0e8",
"namePos": "bl"
},
"smZ": null,
"smTab": null,
"fileLink": "docs/persistence-guidelines.md",
"fileLinkDesc": "Durable or shared state goes behind IPersistence, never a bare file.",
"smGroup": null,
"deleted": false,
"x": 935,
"y": -583,
"w": 604,
"h": 666
},
{
"shapes": [
{
"shapes": [],
"id": "iface_mcp-9rdtg3~e1791791358909",
"category": "Class diagram",
"type": "interface",
"props": {
"name": "MCP",
"operations": [
"tools: read / edit / write / render diagrams",
"resources: guides · schemas"
],
"attributes": [],
"hideAttrs": true,
"hideOps": false,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"arc": true,
"color": 14,
"description": "What a coding agent (Claude Code, …) sees: the tools and resources of the door, briefed in 2048 characters."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/ai_guidance/mcp.md",
"fileLinkDesc": "The briefing an MCP host hands the agent.",
"smGroup": null,
"deleted": false,
"x": 1275,
"y": 698,
"w": null,
"h": null
},
{
"shapes": [],
"id": "a_chat-8dv83e~e1791791358905",
"category": "C4",
"type": "component",
"props": {
"name": "WidgetChat",
"type": "Class · widget_chat.py · aicore",
"subtitle": "The assistant window: transcript, attachments, model picker; the FAB is a separate launcher",
"description": "Docked by the UI; persists conversations; reads the canvas thumbnail for vision.",
"icon": "ms:",
"stroke": "#6b4fa0",
"fill": "#c8e6c9"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/widget_chat.py:503",
"fileLinkDesc": "The chat window widget.\nanchor: class WidgetChat:",
"smGroup": null,
"deleted": false,
"x": 1307,
"y": 158,
"w": 190,
"h": 180
},
{
"shapes": [],
"id": "a_agent-74kh0t~e1791791358906",
"category": "C4",
"type": "component",
"props": {
"name": "ChatAgent",
"type": "Class · agent.py · aicore",
"subtitle": "llama-index FunctionAgent over Claude / DeepSeek / OpenAI; prompt = the ai_guidance .md files + the diagram as a delta",
"description": "Records usage per turn; the caps gate runs before the model is called.",
"icon": "ƒ",
"stroke": "#6b4fa0",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/agent.py:1026",
"fileLinkDesc": "The assistant agent.\nanchor: class ChatAgent:",
"smGroup": null,
"deleted": false,
"x": 966,
"y": 158,
"w": 190,
"h": 210
},
{
"shapes": [],
"id": "a_tools-cidiso~e1791791358907",
"category": "C4",
"type": "component",
"props": {
"name": "Diagram tools",
"type": "Functions · diagram_tools.py · aicore",
"subtitle": "The edit grammar both AIs share: add/update/move/delete node, links, write_diagram, layout — ids minted, refs resolved",
"description": "An edit lands on the mounted canvas as ONE undoable step (apply_model_to_diagram) or, headless, through server_replace_model + save.",
"icon": "gl:api",
"stroke": "#6b4fa0",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/diagram_tools.py:635",
"fileLinkDesc": "The tool set over a DiagramModel.\nanchor: def build_diagram_tools(model: DiagramModel, username: str = \"\") -> list:",
"smGroup": null,
"deleted": false,
"x": 967,
"y": 468,
"w": 190,
"h": 210
},
{
"shapes": [],
"id": "a_mcp-fq2b3b~e1791791358908",
"category": "C4",
"type": "component",
"props": {
"name": "MCP door",
"type": "Functions · mcp_server.py · aicore",
"subtitle": "Streamable-HTTP MCPServer at /mcp: keys, scope, fleet routing, write-back; files its work in the modification register",
"description": "Which project = the connection; a browser-bound call hops to the replica holding the tab.",
"icon": "gl:api",
"stroke": "#6b4fa0",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/mcp_server.py:1082",
"fileLinkDesc": "Every tool and resource.\nanchor: def build_server():",
"smGroup": null,
"deleted": false,
"x": 1307,
"y": 468,
"w": 190,
"h": 210
},
{
"id": "4b8228dc-f481-46b7-8ae7-6fd4c15b8a26",
"category": "Class diagram",
"type": "realization",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/mcp_server.py:3313",
"fileLinkDesc": "Mounts the door.\nanchor: def install(app, *, store, secret: str = \"\") -> bool:",
"smGroup": null,
"deleted": false,
"source": "a_mcp-fq2b3b~e1791791358908",
"target": "iface_mcp-9rdtg3~e1791791358909",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "555b3309-99bd-4b80-ac4f-4eb1109ee577",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "diagram tools",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/diagram_tools.py:95",
"fileLinkDesc": "The generic model the tools edit.\nanchor: class DiagramModel:",
"smGroup": null,
"deleted": false,
"source": "a_agent-74kh0t~e1791791358906",
"target": "a_tools-cidiso~e1791791358907",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "bc8c3c97-e83a-4b49-ac4c-6ffba6967d7e",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "the same closures",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/diagram_tools.py:635",
"fileLinkDesc": "Shared by both AIs.\nanchor: def build_diagram_tools(model: DiagramModel, username: str = \"\") -> list:",
"smGroup": null,
"deleted": false,
"source": "a_mcp-fq2b3b~e1791791358908",
"target": "a_tools-cidiso~e1791791358907",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "e5b5dd79-71e9-40c1-9222-dfe87835a93c",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "runs a turn;\nstreams the reply",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/widget_chat.py:503",
"fileLinkDesc": "The window.\nanchor: class WidgetChat:",
"smGroup": null,
"deleted": false,
"source": "a_chat-8dv83e~e1791791358905",
"target": "a_agent-74kh0t~e1791791358906",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
}
],
"id": "b_ai-ak4l1l~e1791791358904",
"category": "C4",
"type": "boundary",
"props": {
"name": "AI assistant & MCP door",
"type": "aicore · two AIs, one edit grammar",
"stroke": "#6b4fa0",
"fill": "#efeaf7",
"namePos": "bl"
},
"smZ": null,
"smTab": null,
"fileLink": "docs/mcp-server.md",
"fileLinkDesc": "Coding agents as live collaborators over the in-app tool seams.",
"smGroup": null,
"deleted": false,
"x": 937,
"y": 108,
"w": 604,
"h": 740
},
{
"shapes": [
{
"shapes": [],
"id": "Project-1mr3kz~e1791791358912",
"category": "Class diagram",
"type": "class",
"props": {
"name": "Project",
"attributes": [
"+id · name · owner",
"+diagram_ids: List[str]",
"+members: List[TeamMember]",
"+org_shares: List[OrgShare]",
"+deleted: bool"
],
"operations": [],
"color": 3,
"abstract": false,
"stereotype": "dataclass",
"iface": false,
"hideAttrs": false,
"hideOps": true,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"width": 0,
"description": "A directory of diagrams under one storage owner, shared by role or through organisations."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:555",
"fileLinkDesc": "A directory of diagrams under one storage owner, shared by role or through organisations.\nanchor: class Project:",
"smGroup": null,
"deleted": false,
"x": -176,
"y": 616,
"w": null,
"h": null
},
{
"shapes": [],
"id": "Diagram-g4aw4d~e1791791358913",
"category": "Class diagram",
"type": "class",
"props": {
"name": "Diagram",
"attributes": [
"+id · name · category · tags",
"+stamp: EditStamp",
"+touched_ms · last_editor",
"+ai_guidance · variables"
],
"operations": [],
"color": 3,
"abstract": false,
"stereotype": "dataclass",
"iface": false,
"hideAttrs": false,
"hideOps": true,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"width": 0,
"description": "Identity + metadata plus one tree of shapes; built only on persistence — the live canonical is a getModel dict."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:227",
"fileLinkDesc": "Identity + metadata plus one tree of shapes; built only on persistence — the live canonical is a getModel dict.\nanchor: class Diagram(Container):",
"smGroup": null,
"deleted": false,
"x": 147,
"y": 684,
"w": null,
"h": null
},
{
"shapes": [],
"id": "Shape-3k1csz~e1791791358914",
"category": "Class diagram",
"type": "class",
"props": {
"name": "Shape",
"attributes": [
"+id: str",
"+category · type",
"+props: dict",
"+smZ · smTab",
"+fileLink · fileLinkDesc",
"+deleted: bool (tombstone)"
],
"operations": [],
"color": 3,
"abstract": false,
"stereotype": "dataclass",
"iface": false,
"hideAttrs": false,
"hideOps": true,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"width": 0,
"description": "Base of everything on a diagram: a typed shape whose props the shape registry defines."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:26",
"fileLinkDesc": "Base of everything on a diagram: a typed shape whose props the shape registry defines.\nanchor: class Shape:",
"smGroup": null,
"deleted": false,
"x": 590,
"y": 733,
"w": null,
"h": null
},
{
"shapes": [],
"id": "Link-528ped~e1791791358915",
"category": "Class diagram",
"type": "class",
"props": {
"name": "Link",
"attributes": [
"+source: str «id»",
"+target: str «id»",
"+vertices · vrel",
"+subtitle · description",
"+straight · bezier · noAvoid",
"+labMove · labOff"
],
"operations": [],
"color": 3,
"abstract": false,
"stereotype": "dataclass",
"iface": false,
"hideAttrs": false,
"hideOps": true,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"width": 0,
"description": "A connector; source and target are shape ids, never names or geometry."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:51",
"fileLinkDesc": "A connector; source and target are shape ids, never names or geometry.\nanchor: class Link(Shape):",
"smGroup": null,
"deleted": false,
"x": 703,
"y": 974,
"w": null,
"h": null
},
{
"shapes": [],
"id": "Node-8upyih~e1791791358916",
"category": "Class diagram",
"type": "class",
"props": {
"name": "Node",
"attributes": [
"+x · y · w · h"
],
"operations": [],
"color": 3,
"abstract": false,
"stereotype": "dataclass",
"iface": false,
"hideAttrs": false,
"hideOps": true,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"width": 0,
"description": "A placed shape that is also a container: whatever nests inside it lives in its shapes list."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:184",
"fileLinkDesc": "A placed shape that is also a container: whatever nests inside it lives in its shapes list.\nanchor: class Node(Shape, Container):",
"smGroup": null,
"deleted": false,
"x": 427,
"y": 974,
"w": null,
"h": null
},
{
"shapes": [],
"id": "EditStamp-n6895~e1791791358917",
"category": "Class diagram",
"type": "class",
"props": {
"name": "EditStamp",
"attributes": [
"+epoch: float",
"+user: str",
"+nonce: int"
],
"operations": [],
"color": 3,
"abstract": false,
"stereotype": "dataclass",
"iface": false,
"hideAttrs": false,
"hideOps": true,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"width": 0,
"description": "Identifies one edit so concurrent saves can be ordered."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:198",
"fileLinkDesc": "Identifies one edit so concurrent saves can be ordered.\nanchor: class EditStamp:",
"smGroup": null,
"deleted": false,
"x": 174,
"y": 939,
"w": null,
"h": null
},
{
"shapes": [],
"id": "DiagramMeta-9o23wz~e1791791358918",
"category": "Class diagram",
"type": "class",
"props": {
"name": "DiagramMeta",
"attributes": [
"+id · name · category · tags",
"+order · deleted · open",
"+touched_ms · last_editor"
],
"operations": [],
"color": 3,
"abstract": false,
"stereotype": "dataclass",
"iface": false,
"hideAttrs": false,
"hideOps": true,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"width": 0,
"description": "The projection a project switch reads: everything about a diagram WITHOUT its shapes."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:283",
"fileLinkDesc": "The projection a project switch reads: everything about a diagram WITHOUT its shapes.\nanchor: class DiagramMeta:",
"smGroup": null,
"deleted": false,
"x": -173,
"y": 782,
"w": null,
"h": null
},
{
"shapes": [],
"id": "Container-69ey6e~e1791791358919",
"category": "Class diagram",
"type": "class",
"props": {
"name": "Container",
"attributes": [
"+shapes: List[Shape]"
],
"operations": [
"+all_shapes(): Iterator[Shape]",
"+all_nodes(): Iterator[Node]",
"+all_links(): Iterator[Link]",
"+node(ref): Optional[Node]",
"+remove_links(predicate): int",
"+remove_node(nid): bool",
"+subtree_ids(nid): set"
],
"color": 3,
"abstract": false,
"stereotype": "dataclass",
"iface": false,
"hideAttrs": false,
"hideOps": true,
"hideArgs": false,
"hideReturn": false,
"sort": false,
"width": 0,
"description": "Anything that holds shapes: the Diagram root and every Node. Owns ONE flat shapes list and the recursive traversal and mutation over it. NOT a Shape — a diagram is a container but not an element on a canvas."
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:77",
"fileLinkDesc": "Anything that holds shapes — the Diagram root and every Node — owning one flat shapes list and the traversal over it.\nanchor: class Container:",
"smGroup": null,
"deleted": false,
"x": 379,
"y": 616,
"w": null,
"h": null
},
{
"shapes": [],
"id": "d_registry-awzr7m~e1791791358911",
"category": "C4",
"type": "component",
"props": {
"name": "Shape registry",
"type": "Functions · shape_registry.py · drawcore",
"subtitle": "to_diagram / from_diagram: getModel dict ↔ domain tree; categories contribute their types, core dispatches",
"description": "Every canonical door runs sanitize_model, so a served model is interpretable by ids alone.",
"icon": "ƒ",
"stroke": "#9a7b0a",
"fill": "#ffffff"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/shape_registry.py:952",
"fileLinkDesc": "getModel dict → domain tree.\nanchor: def to_diagram(hetero: dict) -> Diagram:",
"smGroup": null,
"deleted": false,
"x": -176,
"y": 916,
"w": 216,
"h": 212
},
{
"id": "0154b790-7fb3-4cfa-9aba-9a4427fb59f6",
"category": "Class diagram",
"type": "inheritance",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py",
"fileLinkDesc": "Node combines Shape with Container so it can own nested shapes.",
"smGroup": null,
"deleted": false,
"source": "Node-8upyih~e1791791358916",
"target": "Container-69ey6e~e1791791358919",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "1dbbd8b4-471f-46f1-8e22-5a68c01e4dcd",
"category": "Class diagram",
"type": "composition",
"props": {
"name": "",
"qualifier": "",
"sourceRole": "",
"targetRole": "shapes",
"sourceMult": "1",
"targetMult": "0..*",
"directed": false,
"assocClass": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:83",
"fileLinkDesc": "The ONE shapes list, declared on Container — Diagram and Node both get it by inheritance.\nanchor: shapes: List[Shape] = field(default_factory=list)",
"smGroup": null,
"deleted": false,
"source": "Container-69ey6e~e1791791358919",
"target": "Shape-3k1csz~e1791791358914",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "41875b9a-ba1b-46e2-bc96-abd7badd0e92",
"category": "Class diagram",
"type": "association",
"props": {
"name": "diagram_ids «by id»",
"qualifier": "",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "0..*",
"directed": true,
"assocClass": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:568",
"fileLinkDesc": "The project's diagrams, in menu order.\nanchor: diagram_ids: List[str] = field(default_factory=list)",
"smGroup": null,
"deleted": false,
"source": "Project-1mr3kz~e1791791358912",
"target": "Diagram-g4aw4d~e1791791358913",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "4abd45ca-c67e-44ef-8901-79e5faa77ca2",
"category": "Class diagram",
"type": "inheritance",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:51",
"fileLinkDesc": "A link is a shape.\nanchor: class Link(Shape):",
"smGroup": null,
"deleted": false,
"source": "Link-528ped~e1791791358915",
"target": "Shape-3k1csz~e1791791358914",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "8682e774-528c-4160-8d00-d0e158e72eac",
"category": "Class diagram",
"type": "inheritance",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py",
"fileLinkDesc": "Diagram is a container of shapes.",
"smGroup": null,
"deleted": false,
"source": "Diagram-g4aw4d~e1791791358913",
"target": "Container-69ey6e~e1791791358919",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "89238a0a-b784-42c0-8cca-900fd99ad1f0",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "to_diagram builds\nthe tree",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": "create"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/shape_registry.py:952",
"fileLinkDesc": "getModel dict → domain tree.\nanchor: def to_diagram(hetero: dict) -> Diagram:",
"smGroup": null,
"deleted": false,
"source": "d_registry-awzr7m~e1791791358911",
"target": "Diagram-g4aw4d~e1791791358913",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "b93ef8f0-d0ea-49cc-aab6-b7564f39977e",
"category": "Class diagram",
"type": "composition",
"props": {
"name": "",
"qualifier": "",
"sourceRole": "",
"targetRole": "stamp",
"sourceMult": "1",
"targetMult": "1",
"directed": false,
"assocClass": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:227",
"fileLinkDesc": "The canonical edit this stored diagram represents.\nanchor: class Diagram(Container):",
"smGroup": null,
"deleted": false,
"source": "Diagram-g4aw4d~e1791791358913",
"target": "EditStamp-n6895~e1791791358917",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "c0b7cdc2-f471-4052-ab88-f475f7889d96",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": "projection of"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:283",
"fileLinkDesc": "Rebuilt from the blob on every save_diagram.\nanchor: class DiagramMeta:",
"smGroup": null,
"deleted": false,
"source": "DiagramMeta-9o23wz~e1791791358918",
"target": "Diagram-g4aw4d~e1791791358913",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "e8435944-99e1-4670-8a39-d8d67c1e3fff",
"category": "Class diagram",
"type": "association",
"props": {
"name": "source, target «by id»",
"qualifier": "",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "2",
"directed": true,
"assocClass": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:51",
"fileLinkDesc": "A link references its ends by shape id only.\nanchor: class Link(Shape):",
"smGroup": null,
"deleted": false,
"source": "Link-528ped~e1791791358915",
"target": "Node-8upyih~e1791791358916",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "fc45b8c8-2b89-4c7c-b16c-8f0b48041300",
"category": "Class diagram",
"type": "inheritance",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/domain_objects.py:184",
"fileLinkDesc": "A node is a shape and a container.\nanchor: class Node(Shape, Container):",
"smGroup": null,
"deleted": false,
"source": "Node-8upyih~e1791791358916",
"target": "Shape-3k1csz~e1791791358914",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
}
],
"id": "b_domain-gfsir~e1791791358910",
"category": "C4",
"type": "boundary",
"props": {
"name": "Domain",
"type": "drawcore · domain_objects.py, shape_registry.py",
"stroke": "#9a7b0a",
"fill": "#ffffff",
"namePos": "bl"
},
"smZ": null,
"smTab": null,
"fileLink": "docs/diagram-delta-architecture.md",
"fileLinkDesc": "Invariant: a diagram is a tree of shapes and every reference is an id.",
"smGroup": null,
"deleted": false,
"x": -207,
"y": 595,
"w": 1111,
"h": 579
},
{
"shapes": [],
"id": "legend-3by1j3~e1791791358927",
"category": "Always available",
"type": "legend",
"props": {
"show": "legend",
"title": "LEGEND",
"dtitle": "DOMAIN",
"rows": [
{
"k": "shape",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><rect x=\"8\" y=\"2.5\" width=\"13\" height=\"13\" rx=\"1\"/><rect x=\"3.5\" y=\"5\" width=\"8\" height=\"3.2\" fill=\"#ffffff\"/><rect x=\"3.5\" y=\"10\" width=\"8\" height=\"3.2\" fill=\"#ffffff\"/></svg>",
"n": "Component"
},
{
"k": "shape",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><circle cx=\"12\" cy=\"6.5\" r=\"4\"/><path d=\"M12 10.5 V16\" fill=\"none\"/></svg>",
"n": "Interface"
},
{
"k": "shape",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"-2 -2 48 34\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"1\" y=\"1\" width=\"42\" height=\"28\" rx=\"4\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1.6\" stroke-dasharray=\"5 3.5\"/></svg>",
"n": "Boundary"
},
{
"k": "link",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><path d=\"M2 9 H16\" fill=\"none\" stroke-dasharray=\"3 2\"/><path d=\"M16 5.5 L21 9 L16 12.5\" fill=\"none\"/></svg>",
"n": "Dependency"
},
{
"k": "link",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><path d=\"M12 9 H22\" fill=\"none\"/><path d=\"M2 9 L7.5 5.6 L13 9 L7.5 12.4 Z\" fill=\"#64748b\"/></svg>",
"n": "Composition"
},
{
"k": "link",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><path d=\"M2 9 H14\" fill=\"none\"/><path d=\"M14 4.8 L21.5 9 L14 13.2 Z\" fill=\"#fff\"/></svg>",
"n": "Inheritance"
},
{
"k": "link",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><path d=\"M2 9 H14\" fill=\"none\" stroke-dasharray=\"3 2\"/><path d=\"M14 4.8 L21.5 9 L14 13.2 Z\" fill=\"#fff\"/></svg>",
"n": "Realization"
},
{
"k": "shape",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><rect x=\"3\" y=\"2.5\" width=\"18\" height=\"13\" rx=\"1.5\"/><path d=\"M3 7.5 H21\" fill=\"none\"/><path d=\"M7 5 H17\" fill=\"none\" stroke-width=\"1.4\"/><path d=\"M6 11 H16 M6 13.5 H13\" fill=\"none\"/></svg>",
"n": "Class"
}
],
"domains": [
{
"k": "fill",
"c": "#c8e6c9",
"n": "Widget classes"
},
{
"k": "fill",
"c": "#d8c35c",
"n": "Domain dataclasses"
},
{
"k": "fill",
"c": "#7782b4",
"n": "WsApi RPC API framework"
},
{
"k": "fill",
"c": "#303030",
"n": "MCP · what a coding agent sees"
},
{
"k": "line",
"c": "#444444",
"n": "Framework classes (external)"
}
]
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/shapes/c4.py",
"fileLinkDesc": "The C4 shape family this diagram is drawn with.",
"smGroup": null,
"deleted": false,
"x": 1010,
"y": 880,
"w": null,
"h": null
},
{
"shapes": [],
"id": "legend-9jivic~e1791791374467",
"category": "Always available",
"type": "legend",
"props": {
"show": "domain",
"title": "LEGEND",
"dtitle": "DOMAIN",
"rows": [
{
"k": "shape",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><rect x=\"8\" y=\"2.5\" width=\"13\" height=\"13\" rx=\"1\"/><rect x=\"3.5\" y=\"5\" width=\"8\" height=\"3.2\" fill=\"#ffffff\"/><rect x=\"3.5\" y=\"10\" width=\"8\" height=\"3.2\" fill=\"#ffffff\"/></svg>",
"n": "Component"
},
{
"k": "shape",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><circle cx=\"12\" cy=\"6.5\" r=\"4\"/><path d=\"M12 10.5 V16\" fill=\"none\"/></svg>",
"n": "Interface"
},
{
"k": "shape",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"-2 -2 48 34\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"1\" y=\"1\" width=\"42\" height=\"28\" rx=\"4\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1.6\" stroke-dasharray=\"5 3.5\"/></svg>",
"n": "Boundary"
},
{
"k": "link",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><path d=\"M2 9 H16\" fill=\"none\" stroke-dasharray=\"3 2\"/><path d=\"M16 5.5 L21 9 L16 12.5\" fill=\"none\"/></svg>",
"n": "Dependency"
},
{
"k": "link",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><path d=\"M12 9 H22\" fill=\"none\"/><path d=\"M2 9 L7.5 5.6 L13 9 L7.5 12.4 Z\" fill=\"#64748b\"/></svg>",
"n": "Composition"
},
{
"k": "link",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><path d=\"M2 9 H14\" fill=\"none\"/><path d=\"M14 4.8 L21.5 9 L14 13.2 Z\" fill=\"#fff\"/></svg>",
"n": "Inheritance"
},
{
"k": "link",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><path d=\"M2 9 H14\" fill=\"none\" stroke-dasharray=\"3 2\"/><path d=\"M14 4.8 L21.5 9 L14 13.2 Z\" fill=\"#fff\"/></svg>",
"n": "Realization"
},
{
"k": "shape",
"r": "<svg width=\"24\" height=\"18\" viewBox=\"0 0 24 18\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"#eef2f7\" stroke=\"#64748b\" stroke-width=\"1\" stroke-linejoin=\"round\" stroke-linecap=\"round\"><rect x=\"3\" y=\"2.5\" width=\"18\" height=\"13\" rx=\"1.5\"/><path d=\"M3 7.5 H21\" fill=\"none\"/><path d=\"M7 5 H17\" fill=\"none\" stroke-width=\"1.4\"/><path d=\"M6 11 H16 M6 13.5 H13\" fill=\"none\"/></svg>",
"n": "Class"
}
],
"domains": [
{
"k": "fill",
"c": "#c8e6c9",
"n": "Widget classes"
},
{
"k": "fill",
"c": "#d8c35c",
"n": "Domain dataclasses"
},
{
"k": "fill",
"c": "#7782b4",
"n": "WsApi RPC API framework"
},
{
"k": "fill",
"c": "#303030",
"n": "MCP · what a coding agent sees"
},
{
"k": "line",
"c": "#444444",
"n": "Framework classes (external)"
}
]
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/shapes/c4.py",
"fileLinkDesc": "The C4 shape family this diagram is drawn with.",
"smGroup": null,
"deleted": false,
"x": 1246,
"y": 880,
"w": null,
"h": null
},
{
"id": "01ec2e66-36a8-4e1b-9d61-bfe0ef1a2baa",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "on_change after a 0.8 s quiet window\n→ UI._on_canvas_change → save()",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ws_api/methods.py:404",
"fileLinkDesc": "Alias now, disk later.\nanchor: def _persist_canonical(diagram_id: str, model: dict, saver, *, debounce: bool = False) -> None:",
"smGroup": null,
"deleted": false,
"source": "c_wsapi-9ki4fg~e1791791358894",
"target": "w_dctl-7safvj~e1791791358886",
"vertices": [
[
280,
-350
]
],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": true,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "2001904f-b2a4-44fa-9d48-5aceaa400b82",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "lands an edit as\none undoable step",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/aicore/src/modebit/aicore/mcp_server.py:780",
"fileLinkDesc": "Which route lands an edit.\nanchor: async def _write_back(p: Project, meta: DiagramMeta, before: dict, hetero: dict) -> str:",
"smGroup": null,
"deleted": false,
"source": "a_tools-cidiso~e1791791358907",
"target": "c_wsapi-9ki4fg~e1791791358894",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "4293c2ef-8ec5-4b4c-abc4-0594d4efd44b",
"category": "Class diagram",
"type": "composition",
"props": {
"name": "drives",
"qualifier": "",
"sourceRole": "",
"targetRole": "",
"sourceMult": "1",
"targetMult": "",
"directed": false,
"assocClass": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/widget_header.py:133",
"fileLinkDesc": "The header IS the app-specific composition.\nanchor: class WidgetHeader:",
"smGroup": null,
"deleted": false,
"source": "comp_ui-co2694~e1791791358880",
"target": "b_widgets-9cod2m~e1791791358882",
"vertices": [
[
160,
34
]
],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": true,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": "The shell constructs the controllers and chrome widgets; the UI places them in its own layout and owns their lifetime — one set per tab.",
"animation": null
},
{
"id": "431d31a0-5d2e-4225-bfaa-c6483a2425de",
"category": "Class diagram",
"type": "inheritance",
"props": {
"name": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/ui.py:1057",
"fileLinkDesc": "UI is a WorkspaceShell.\nanchor: class UI(WorkspaceShell):",
"smGroup": null,
"deleted": false,
"source": "comp_ui-co2694~e1791791358880",
"target": "w_shell-5m6jaa~e1791791358883",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "9c4e95ee-66c5-4a24-9b8e-03deb6f32b78",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "builds a fresh UI for\nevery browser tab",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": "create"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/main.py:413",
"fileLinkDesc": "A UI per page render.\nanchor: async def main(p: str = ''):",
"smGroup": null,
"deleted": false,
"source": "fn_main-1fyoo4~e1791791358877",
"target": "comp_ui-co2694~e1791791358880",
"vertices": [
[
-33,
-133
]
],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": true,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": "main.py also picks the store (make_store: files | SQL) and the team provider (make_provider: in-memory | Redis) at start-up, and installs the MCP door at /mcp.",
"animation": null
},
{
"id": "a645e1e9-0b8f-4c52-a9df-9ac26630a355",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "save_diagram(owner, project, d)",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawcore/src/modebit/drawcore/ipersistence.py:70",
"fileLinkDesc": "The write.\nanchor: async def save_diagram(self, username: str, project: Project, diagram: Diagram) -> None: ...",
"smGroup": null,
"deleted": false,
"source": "w_dctl-7safvj~e1791791358886",
"target": "iface_persist-30dd1t~e1791791358899",
"vertices": [
[
231,
-48
]
],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": true,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "e5398fb0-86b4-461c-a410-497eeac189df",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "build_canvas_widget()\nper open diagram",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": "create"
},
"smZ": null,
"smTab": null,
"fileLink": "packages/widgetcore/src/modebit/widgetcore/pane_host.py:318",
"fileLinkDesc": "Wires the widget's on_change to the ctx.\nanchor: on_change=lambda model, _d=d, _p=home_p: self._ctx._on_canvas_change(_d, model, _p),",
"smGroup": null,
"deleted": false,
"source": "w_pane-aj45bs~e1791791358884",
"target": "c_widget-7k8oog~e1791791358891",
"vertices": [
[
-59,
307
]
],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": true,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
},
{
"id": "ec7d9955-c0b6-424d-8a4f-67618a9d3777",
"category": "Class diagram",
"type": "dependency",
"props": {
"name": "ui.run(); page routes;\nthe Socket.IO server",
"sourceRole": "",
"targetRole": "",
"sourceMult": "",
"targetMult": "",
"stereotype": ""
},
"smZ": null,
"smTab": null,
"fileLink": "packages/drawmode/src/modebit/drawmode/main.py:413",
"fileLinkDesc": "The main page route.\nanchor: async def main(p: str = ''):",
"smGroup": null,
"deleted": false,
"source": "fn_main-1fyoo4~e1791791358877",
"target": "fw_nicegui-97yl76~e1791791358875",
"vertices": [],
"straight": false,
"bezier": false,
"noAvoid": null,
"vrel": false,
"labMove": false,
"labOff": {},
"subtitle": null,
"description": null,
"animation": null
}
],
"id": "db0d87450",
"name": "C4 Components + Domain",
"category": "domain",
"description": "",
"tags": [],
"order": null,
"publish_ignore": false,
"ai_guidance": "",
"deleted": false,
"open": false,
"view": {},
"stamp": {
"epoch": 0.0,
"user": "",
"nonce": 0
},
"touched_ms": 0.0,
"last_editor": "",
"schema_version": 1,
"variables": [],
"projection": ""
}{
"elements": [
{
"id": "title-322wot~e1791791358926",
"category": "Notes",
"kind": "markdown",
"text": "# L4 — Code (C4 style): DrawMode app server\n\nThe code told the C4 way: each box says **what it is for** before **what it is**; members and file links wait on hover. Rows follow a keystroke: entry & start-up → the session (composition root) → widgets and controllers → the canvas and its live sync → persistence on the right; the domain sits underneath, the AI stack beside it. Boundaries are themes, tinted by layer. Links are plain UML: dashed arrow = depends on (**«create»** where it instantiates), filled diamond = owns, hollow triangle = inherits (solid) or implements (dashed); contracts are ball-and-socket interfaces. Domain objects are UML classes because their fields are the point. Icons: **ƒ** = a module of functions; other icons are mnemonics.\n\n**Deliberate simplifications, truth on hover:** five packages appear as themes, not boxes (the package is named on each component); the mind-map, shape-family, admin, auth-registry, import/export and layout modules are left out; the store is one interface with two implementations; the browser holds one component. The exhaustive versions are one card away."
},
{
"id": "md-39id27~e1794206092304",
"category": "Notes",
"kind": "markdown",
"text": "# Explanation\n\nThe prompt:\n\n> Create me a C4 component diagram of the main components of the system, focusing on the interfaces / seams for persistence and team collaboration. Add the core diagram domain model underneath as a UML class diagrams."
},
{
"id": "b_fw-axcve~e1791791358874",
"category": "C4",
"kind": "boundary",
"name": "Frameworks we hook",
"technology": "external · nicegui, fastapi, socket.io",
"elements": [
{
"id": "fw_nicegui-97yl76~e1791791358875",
"category": "C4",
"kind": "component",
"name": "NiceGUI · FastAPI",
"technology": "Framework · one client per tab",
"subtitle": "Renders the Quasar chrome per tab, owns the Socket.IO socket the WS RPC rides, hosts the ASGI routes",
"description": "NiceGUI 3 over FastAPI/uvicorn. The app never talks to a raw websocket: sm_rpc is one Socket.IO event on NiceGUI's server."
}
]
},
{
"id": "b_entry-b4jupr~e1791791358876",
"category": "C4",
"kind": "boundary",
"name": "HTTP entry & start-up",
"technology": "drawmode · main.py, auth",
"elements": [
{
"id": "fn_main-1fyoo4~e1791791358877",
"category": "C4",
"kind": "component",
"name": "main.py",
"technology": "Functions · entry point",
"subtitle": "Boots the process: the ONE store (files | SQL), its facades, the team provider, the MCP door, the auth wall, ui.run()",
"description": "Resolves the storage secret fail-closed, builds the store with make_store, configure()s every facade on it, picks the team provider (in-memory | Redis), installs the door and the canvas runtime, then runs NiceGUI."
},
{
"id": "comp_auth-do1ay2~e1791791358878",
"category": "C4",
"kind": "component",
"name": "Auth wall",
"technology": "Functions · auth_service, zitadel_auth",
"subtitle": "Local login or Zitadel SSO, then the approval gate: pending / approved / blocked",
"description": "Every page route passes the wall; the user registry is a sync cache over the store, refreshed by delta."
}
]
},
{
"id": "b_root-4hlv9o~e1791791358879",
"category": "C4",
"kind": "boundary",
"name": "Composition root",
"technology": "one UI per browser tab",
"elements": [
{
"id": "iface_hooks-8cl4gd~e1791791358881",
"category": "Class",
"kind": "interface",
"name": "Shell hooks",
"description": "What WorkspaceShell requires of the product that subclasses it: the five abstract hooks. UI implements them; demomode implements them differently.",
"operations": [
{
"name": "make_canvas_widget",
"parameters": [
{
"name": "d"
},
{
"name": "model"
},
{
"name": "view"
}
]
},
{
"name": "diagram codec",
"returnType": "to / from the store"
},
{
"name": "seed_canonical",
"parameters": [
{
"name": "d"
}
]
}
]
},
{
"id": "comp_ui-co2694~e1791791358880",
"category": "C4",
"kind": "component",
"name": "UI",
"technology": "Class · ui.py",
"subtitle": "Assembles the page for one tab: header, diagrams tree, panes, presence, chat; fans project pushes to every local UI",
"description": "Subclasses WorkspaceShell and implements its five required hooks (canvas factory, diagram codec, seed_canonical…). _on_canvas_change is where a persisted canvas lands before DiagramController.save."
}
]
},
{
"id": "b_widgets-9cod2m~e1791791358882",
"category": "C4",
"kind": "boundary",
"name": "Widgets & controllers",
"technology": "widgetcore · plus drawmode's header",
"elements": [
{
"id": "w_shell-5m6jaa~e1791791358883",
"category": "C4",
"kind": "component",
"name": "WorkspaceShell",
"technology": "Class · workspace_shell.py · widgetcore",
"subtitle": "ABC of a session: constructs the three controllers and five chrome widgets; the product fills the hooks",
"description": "Seed-if-absent wiring of the ctx slots the pane host reads, so a rich ctx (drawmode's UI) keeps its own methods."
},
{
"id": "w_pane-aj45bs~e1791791358884",
"category": "C4",
"kind": "component",
"name": "PaneHostController",
"technology": "Class · pane_host.py · widgetcore",
"subtitle": "Tiled editor groups, tabs and sashes; mounts a canvas per open diagram and wires its on_change",
"description": "Builds each canvas through the product's make_canvas_widget hook and hands the server a widget whose on_change is ctx._on_canvas_change."
},
{
"id": "w_pctl-8eear9~e1791791358885",
"category": "C4",
"kind": "component",
"name": "ProjectController · WorkspaceState",
"technology": "Classes · controllers/ · widgetcore",
"subtitle": "Projects, membership, workspaces and per-user views — UI-free by an import-linter contract",
"description": "Everything durable it touches goes through the store: save_project, save_user, save_workspace."
},
{
"id": "w_dctl-7safvj~e1791791358886",
"category": "C4",
"kind": "component",
"name": "DiagramController",
"technology": "Class · controllers/diagrams.py · widgetcore",
"subtitle": "THE persist path: guards, stamp, touched_ms, last_editor → store.save_diagram",
"description": "Turns the getModel dict into the domain Diagram through the codec hook, then writes it under the project OWNER."
},
{
"id": "w_header-dscyrm~e1791791358887",
"category": "C4",
"kind": "component",
"name": "WidgetHeader · GitMenu",
"technology": "Classes · widget_header.py · drawmode",
"subtitle": "Composes the six header widgets; GitMenu holds every desktop-only Git action in one class",
"description": "Move a project to a repo, link one, enable merging, baseline diagrams — gated at one line."
},
{
"id": "w_presence-1xgflr~e1791791358888",
"category": "C4",
"kind": "component",
"name": "WidgetPresence · WidgetTeamChat",
"technology": "Classes · widgetcore",
"subtitle": "Avatars, cursors and the project chat — all fed by the team provider",
"description": "Presence TTL-touched on each heartbeat; chat messages persisted and relayed like deltas."
},
{
"id": "w_diagrams-15nvts~e1791791358889",
"category": "C4",
"kind": "component",
"name": "WidgetDiagrams",
"technology": "Class · widget_diagrams.py · widgetcore",
"subtitle": "The diagrams tree: open, rename, nest, tag, reorder; a double-click opens a tab",
"description": "Reads DiagramMeta only — a project switch never loads shapes."
}
]
},
{
"id": "b_canvas-42xm44~e1791791358890",
"category": "C4",
"kind": "boundary",
"name": "Canvas & live sync",
"technology": "drawcore · widget_domain, js_domain, ws_api, team",
"elements": [
{
"id": "iface_rpc-emrsvz~e1791791358893",
"category": "Class",
"kind": "interface",
"name": "WsApi RPC (sm_rpc)",
"description": "The browser ↔ server contract: one Socket.IO event, pydantic In/Out per method, pushes to the client's own room.",
"operations": [
{
"name": "apply_delta · reconcile · get_canonical"
},
{
"name": "push: invoke",
"parameters": [
{
"name": "cid"
},
{
"name": "method"
},
{
"name": "…"
}
]
}
]
},
{
"id": "iface_team-4qmm3t~e1791791358896",
"category": "Class",
"kind": "interface",
"name": "ITeamUpdates",
"description": "The collaboration protocol the server edits the canonical through; every implementor inherits it explicitly and marks methods @override.",
"operations": [
{
"name": "apply_delta",
"parameters": [
{
"name": "diagram"
},
{
"name": "delta"
},
{
"name": "user"
}
]
},
{
"name": "snapshot · replace_model · seed"
},
{
"name": "presence · cursors · chat"
}
]
},
{
"id": "c_widget-7k8oog~e1791791358891",
"category": "C4",
"kind": "component",
"name": "Canvas widget",
"technology": "Functions · widget_domain.py · drawcore",
"subtitle": "build_canvas_widget: mounts one canvas; assembles and fingerprints the engine JS the browser loads once",
"description": "The engine is a pure function of the image — served immutable at /canvas-engine-{hash}.js."
},
{
"id": "c_engine-4xqfaw~e1791791358892",
"category": "C4",
"kind": "component",
"name": "Canvas engine",
"technology": "JavaScript · js_domain/ · runs in the browser",
"subtitle": "JointJS paper + bridge (getModel/applyModel), autosave (400 ms), history, deltasync — sends only what changed",
"description": "Every local edit becomes ONE undo step and one delta; a teammate's delta is absorbed into the undo baseline so the next diff holds only my changes."
},
{
"id": "c_wsapi-9ki4fg~e1791791358894",
"category": "C4",
"kind": "component",
"name": "WS RPC",
"technology": "Functions · ws_api/ · drawcore",
"subtitle": "apply_delta: snapshot → provider → register → debounced persist → relay → publish; invoke() is the one server → canvas call",
"description": "authorize() gates every method by canvas role; the docs render themselves in /admin."
},
{
"id": "c_bcast-38ai2r~e1791791358895",
"category": "C4",
"kind": "component",
"name": "Team broadcast",
"technology": "Functions · ws_api/team_broadcast.py · drawcore",
"subtitle": "Per-project Redis pub/sub relay: local participants first, then PUBLISH for the other instances",
"description": "Each node re-targets its own canvases; the origin drops its own echo."
},
{
"id": "c_team-dtafeo~e1791791358897",
"category": "C4",
"kind": "component",
"name": "Team provider",
"technology": "Classes · team/ · drawcore",
"subtitle": "InMemoryTeamUpdates | RedisTeamUpdates, wrapped resilient: the live canonical + seq per diagram under a lock",
"description": "A canonical evicted from Redis is restored read-through from a live canvas, never mistaken for an empty diagram."
}
]
},
{
"id": "b_persist-66iaby~e1791791358898",
"category": "C4",
"kind": "boundary",
"name": "Persistence",
"technology": "drawcore.persistence · port + adapters + codecs",
"elements": [
{
"id": "iface_persist-30dd1t~e1791791358899",
"category": "Class",
"kind": "interface",
"name": "IPersistence",
"description": "The store protocol; IAiPersistence extends it for the AI stack. make_store composes core + AI mixins into ONE class.",
"operations": [
{
"name": "save_diagram · load_diagrams"
},
{
"name": "projects · users · settings"
}
]
},
{
"id": "p_file-m6ate~e1791791358900",
"category": "C4",
"kind": "component",
"name": "FilePersistenceStore",
"technology": "Class · file_persistence_store.py",
"subtitle": "One JSON file per object under data/; a project in a Git repo saves as baseline + delta-log entries",
"description": "Single-instance by definition; the desktop's store."
},
{
"id": "p_sql-2bi2c0~e1791791358901",
"category": "C4",
"kind": "component",
"name": "SqlAlchemyPersistenceStore",
"technology": "Class · sqlalchemy_store.py",
"subtitle": "SQLite or Postgres: blob tables + projections, atomic ON CONFLICT upserts so N instances never clobber each other",
"description": "Postgres is the scaling target; a blob stays the source of truth, projections are rebuilt in the same transaction."
},
{
"id": "p_dlog-bjeqhz~e1791791358902",
"category": "C4",
"kind": "component",
"name": "Diagram log",
"technology": "Functions · diagram_log.py",
"subtitle": "Baseline .json + append-only _deltas_.jsonl; diff · apply · replay · fold — so Git branches merge by union",
"description": "One entry per save, one line each; the CLI folds a log back into its baseline."
},
{
"id": "p_serde-f2nn30~e1791791358903",
"category": "C4",
"kind": "component",
"name": "JSON codec",
"technology": "Functions · serde.py, model_migrations.py",
"subtitle": "Dataclasses ↔ JSON with schema_version stamps; a document from a NEWER build decodes read-only",
"description": "Refusing the write is the whole point of stamping."
}
]
},
{
"id": "b_ai-ak4l1l~e1791791358904",
"category": "C4",
"kind": "boundary",
"name": "AI assistant & MCP door",
"technology": "aicore · two AIs, one edit grammar",
"elements": [
{
"id": "iface_mcp-9rdtg3~e1791791358909",
"category": "Class",
"kind": "interface",
"name": "MCP",
"description": "What a coding agent (Claude Code, …) sees: the tools and resources of the door, briefed in 2048 characters.",
"operations": [
{
"name": "tools",
"returnType": "read / edit / write / render diagrams"
},
{
"name": "resources",
"returnType": "guides · schemas"
}
]
},
{
"id": "a_chat-8dv83e~e1791791358905",
"category": "C4",
"kind": "component",
"name": "WidgetChat",
"technology": "Class · widget_chat.py · aicore",
"subtitle": "The assistant window: transcript, attachments, model picker; the FAB is a separate launcher",
"description": "Docked by the UI; persists conversations; reads the canvas thumbnail for vision."
},
{
"id": "a_agent-74kh0t~e1791791358906",
"category": "C4",
"kind": "component",
"name": "ChatAgent",
"technology": "Class · agent.py · aicore",
"subtitle": "llama-index FunctionAgent over Claude / DeepSeek / OpenAI; prompt = the ai_guidance .md files + the diagram as a delta",
"description": "Records usage per turn; the caps gate runs before the model is called."
},
{
"id": "a_tools-cidiso~e1791791358907",
"category": "C4",
"kind": "component",
"name": "Diagram tools",
"technology": "Functions · diagram_tools.py · aicore",
"subtitle": "The edit grammar both AIs share: add/update/move/delete node, links, write_diagram, layout — ids minted, refs resolved",
"description": "An edit lands on the mounted canvas as ONE undoable step (apply_model_to_diagram) or, headless, through server_replace_model + save."
},
{
"id": "a_mcp-fq2b3b~e1791791358908",
"category": "C4",
"kind": "component",
"name": "MCP door",
"technology": "Functions · mcp_server.py · aicore",
"subtitle": "Streamable-HTTP MCPServer at /mcp: keys, scope, fleet routing, write-back; files its work in the modification register",
"description": "Which project = the connection; a browser-bound call hops to the replica holding the tab."
}
]
},
{
"id": "b_domain-gfsir~e1791791358910",
"category": "C4",
"kind": "boundary",
"name": "Domain",
"technology": "drawcore · domain_objects.py, shape_registry.py",
"elements": [
{
"id": "Project-1mr3kz~e1791791358912",
"category": "Class",
"kind": "class",
"name": "Project",
"stereotype": "dataclass",
"description": "A directory of diagrams under one storage owner, shared by role or through organisations.",
"attributes": [
{
"name": "id · name · owner",
"visibility": "public"
},
{
"name": "diagram_ids",
"type": "List[str]",
"visibility": "public"
},
{
"name": "members",
"type": "List[TeamMember]",
"visibility": "public"
},
{
"name": "org_shares",
"type": "List[OrgShare]",
"visibility": "public"
},
{
"name": "deleted",
"type": "bool",
"visibility": "public"
}
]
},
{
"id": "Diagram-g4aw4d~e1791791358913",
"category": "Class",
"kind": "class",
"name": "Diagram",
"stereotype": "dataclass",
"description": "Identity + metadata plus one tree of shapes; built only on persistence — the live canonical is a getModel dict.",
"attributes": [
{
"name": "id · name · category · tags",
"visibility": "public"
},
{
"name": "stamp",
"type": "EditStamp",
"visibility": "public"
},
{
"name": "touched_ms · last_editor",
"visibility": "public"
},
{
"name": "ai_guidance · variables",
"visibility": "public"
}
]
},
{
"id": "Shape-3k1csz~e1791791358914",
"category": "Class",
"kind": "class",
"name": "Shape",
"stereotype": "dataclass",
"description": "Base of everything on a diagram: a typed shape whose props the shape registry defines.",
"attributes": [
{
"name": "id",
"type": "str",
"visibility": "public"
},
{
"name": "category · type",
"visibility": "public"
},
{
"name": "props",
"type": "dict",
"visibility": "public"
},
{
"name": "smZ · smTab",
"visibility": "public"
},
{
"name": "fileLink · fileLinkDesc",
"visibility": "public"
},
{
"name": "deleted",
"type": "bool (tombstone)",
"visibility": "public"
}
]
},
{
"id": "Link-528ped~e1791791358915",
"category": "Class",
"kind": "class",
"name": "Link",
"stereotype": "dataclass",
"description": "A connector; source and target are shape ids, never names or geometry.",
"attributes": [
{
"name": "source",
"type": "str «id»",
"visibility": "public"
},
{
"name": "target",
"type": "str «id»",
"visibility": "public"
},
{
"name": "vertices · vrel",
"visibility": "public"
},
{
"name": "subtitle · description",
"visibility": "public"
},
{
"name": "straight · bezier · noAvoid",
"visibility": "public"
},
{
"name": "labMove · labOff",
"visibility": "public"
}
]
},
{
"id": "Node-8upyih~e1791791358916",
"category": "Class",
"kind": "class",
"name": "Node",
"stereotype": "dataclass",
"description": "A placed shape that is also a container: whatever nests inside it lives in its shapes list.",
"attributes": [
{
"name": "x · y · w · h",
"visibility": "public"
}
]
},
{
"id": "EditStamp-n6895~e1791791358917",
"category": "Class",
"kind": "class",
"name": "EditStamp",
"stereotype": "dataclass",
"description": "Identifies one edit so concurrent saves can be ordered.",
"attributes": [
{
"name": "epoch",
"type": "float",
"visibility": "public"
},
{
"name": "user",
"type": "str",
"visibility": "public"
},
{
"name": "nonce",
"type": "int",
"visibility": "public"
}
]
},
{
"id": "DiagramMeta-9o23wz~e1791791358918",
"category": "Class",
"kind": "class",
"name": "DiagramMeta",
"stereotype": "dataclass",
"description": "The projection a project switch reads: everything about a diagram WITHOUT its shapes.",
"attributes": [
{
"name": "id · name · category · tags",
"visibility": "public"
},
{
"name": "order · deleted · open",
"visibility": "public"
},
{
"name": "touched_ms · last_editor",
"visibility": "public"
}
]
},
{
"id": "Container-69ey6e~e1791791358919",
"category": "Class",
"kind": "class",
"name": "Container",
"stereotype": "dataclass",
"description": "Anything that holds shapes: the Diagram root and every Node. Owns ONE flat shapes list and the recursive traversal and mutation over it. NOT a Shape — a diagram is a container but not an element on a canvas.",
"attributes": [
{
"name": "shapes",
"type": "List[Shape]",
"visibility": "public"
}
],
"operations": [
{
"name": "all_shapes",
"returnType": "Iterator[Shape]",
"visibility": "public"
},
{
"name": "all_nodes",
"returnType": "Iterator[Node]",
"visibility": "public"
},
{
"name": "all_links",
"returnType": "Iterator[Link]",
"visibility": "public"
},
{
"name": "node",
"parameters": [
{
"name": "ref"
}
],
"returnType": "Optional[Node]",
"visibility": "public"
},
{
"name": "remove_links",
"parameters": [
{
"name": "predicate"
}
],
"returnType": "int",
"visibility": "public"
},
{
"name": "remove_node",
"parameters": [
{
"name": "nid"
}
],
"returnType": "bool",
"visibility": "public"
},
{
"name": "subtree_ids",
"parameters": [
{
"name": "nid"
}
],
"returnType": "set",
"visibility": "public"
}
]
},
{
"id": "d_registry-awzr7m~e1791791358911",
"category": "C4",
"kind": "component",
"name": "Shape registry",
"technology": "Functions · shape_registry.py · drawcore",
"subtitle": "to_diagram / from_diagram: getModel dict ↔ domain tree; categories contribute their types, core dispatches",
"description": "Every canonical door runs sanitize_model, so a served model is interpretable by ids alone."
}
]
},
{
"id": "legend-3by1j3~e1791791358927",
"category": "Notes",
"kind": "domain-key",
"title": "DOMAIN",
"entries": [
{
"name": "Widget classes",
"members": [
"a_chat-8dv83e~e1791791358905",
"w_diagrams-15nvts~e1791791358889",
"w_header-dscyrm~e1791791358887",
"w_presence-1xgflr~e1791791358888"
]
},
{
"name": "Domain dataclasses",
"members": [
"Container-69ey6e~e1791791358919",
"Diagram-g4aw4d~e1791791358913",
"DiagramMeta-9o23wz~e1791791358918",
"EditStamp-n6895~e1791791358917",
"Link-528ped~e1791791358915",
"Node-8upyih~e1791791358916",
"Project-1mr3kz~e1791791358912",
"Shape-3k1csz~e1791791358914"
]
},
{
"name": "WsApi RPC API framework",
"members": [
"iface_rpc-emrsvz~e1791791358893"
]
},
{
"name": "MCP · what a coding agent sees",
"members": [
"iface_mcp-9rdtg3~e1791791358909"
]
},
{
"name": "Framework classes (external)",
"members": [
"b_fw-axcve~e1791791358874",
"fw_nicegui-97yl76~e1791791358875"
]
}
]
},
{
"id": "legend-9jivic~e1791791374467",
"category": "Notes",
"kind": "domain-key",
"title": "DOMAIN",
"entries": [
{
"name": "Widget classes",
"members": [
"a_chat-8dv83e~e1791791358905",
"w_diagrams-15nvts~e1791791358889",
"w_header-dscyrm~e1791791358887",
"w_presence-1xgflr~e1791791358888"
]
},
{
"name": "Domain dataclasses",
"members": [
"Container-69ey6e~e1791791358919",
"Diagram-g4aw4d~e1791791358913",
"DiagramMeta-9o23wz~e1791791358918",
"EditStamp-n6895~e1791791358917",
"Link-528ped~e1791791358915",
"Node-8upyih~e1791791358916",
"Project-1mr3kz~e1791791358912",
"Shape-3k1csz~e1791791358914"
]
},
{
"name": "WsApi RPC API framework",
"members": [
"iface_rpc-emrsvz~e1791791358893"
]
},
{
"name": "MCP · what a coding agent sees",
"members": [
"iface_mcp-9rdtg3~e1791791358909"
]
},
{
"name": "Framework classes (external)",
"members": [
"b_fw-axcve~e1791791358874",
"fw_nicegui-97yl76~e1791791358875"
]
}
]
}
],
"links": [
{
"id": "5b5dc1cc-05e2-4084-ae91-0bdbc761b12f",
"category": "Class",
"kind": "dependency",
"source": "fn_main-1fyoo4~e1791791358877",
"target": "comp_auth-do1ay2~e1791791358878",
"description": "Installs the auth wall and configures every facade on the one store."
},
{
"id": "3673b8bc-7f0d-4536-91f5-0d1fd0a3a14f",
"category": "Class",
"kind": "realization",
"source": "comp_ui-co2694~e1791791358880",
"target": "iface_hooks-8cl4gd~e1791791358881"
},
{
"id": "f912ee4d-f4d4-4a28-ae59-6b5d1a5d83ba",
"category": "Class",
"kind": "dependency",
"source": "w_shell-5m6jaa~e1791791358883",
"target": "w_pane-aj45bs~e1791791358884",
"name": "sets up",
"description": "set_up_pane(): the shell constructs the pane host and hands it the session ctx; the pane host then mounts a canvas per open diagram."
},
{
"id": "21937ddb-30c1-464a-bf84-f55417d6a905",
"category": "Class",
"kind": "dependency",
"source": "c_engine-4xqfaw~e1791791358892",
"target": "iface_rpc-emrsvz~e1791791358893",
"name": "WsApi.call(…)",
"description": "apply_delta(cid, delta, base_seq) on every debounced edit; reconcile when a teammate is present and I am idle; get_canonical to heal a seq gap."
},
{
"id": "238f4934-0489-47c3-a3b3-2c36162313b2",
"category": "Class",
"kind": "dependency",
"source": "c_wsapi-9ki4fg~e1791791358894",
"target": "iface_team-4qmm3t~e1791791358896",
"name": "apply_delta",
"description": "snapshot before, apply_delta under the lock, replace_model for a whole-model write; the provider hands back the new seq."
},
{
"id": "75a4fcb7-cbfa-4294-be39-992f474a36a7",
"category": "Class",
"kind": "dependency",
"source": "c_wsapi-9ki4fg~e1791791358894",
"target": "c_bcast-38ai2r~e1791791358895",
"name": "publish_delta"
},
{
"id": "7a8d34b6-b893-4df6-8487-73f0c9f2dd9f",
"category": "Class",
"kind": "realization",
"source": "c_team-dtafeo~e1791791358897",
"target": "iface_team-4qmm3t~e1791791358896"
},
{
"id": "882fd4dd-c50c-428f-a167-42f9d8a74d0f",
"category": "Class",
"kind": "realization",
"source": "c_wsapi-9ki4fg~e1791791358894",
"target": "iface_rpc-emrsvz~e1791791358893"
},
{
"id": "f1fcfff6-cde1-4e47-957f-8665dd32fc91",
"category": "Class",
"kind": "dependency",
"source": "c_widget-7k8oog~e1791791358891",
"target": "c_engine-4xqfaw~e1791791358892",
"name": "serves the engine by hash;\nboots each canvas"
},
{
"id": "2b862704-64ce-4e57-bb43-ecc5034a28b4",
"category": "Class",
"kind": "realization",
"source": "p_file-m6ate~e1791791358900",
"target": "iface_persist-30dd1t~e1791791358899"
},
{
"id": "33937689-182a-465e-839b-f2a4750c9da0",
"category": "Class",
"kind": "realization",
"source": "p_sql-2bi2c0~e1791791358901",
"target": "iface_persist-30dd1t~e1791791358899"
},
{
"id": "e9587244-6ac4-40d4-89e2-7934130a0679",
"category": "Class",
"kind": "dependency",
"source": "p_file-m6ate~e1791791358900",
"target": "p_serde-f2nn30~e1791791358903",
"name": "serialises through"
},
{
"id": "f50654d2-52ae-4a95-bbe8-12b5b016f148",
"category": "Class",
"kind": "dependency",
"source": "p_sql-2bi2c0~e1791791358901",
"target": "p_serde-f2nn30~e1791791358903",
"name": "serialises through"
},
{
"id": "f78116b8-7d28-4395-b450-cad5d27fefbb",
"category": "Class",
"kind": "dependency",
"source": "p_file-m6ate~e1791791358900",
"target": "p_dlog-bjeqhz~e1791791358902",
"name": "a located project:\none entry per save"
},
{
"id": "4b8228dc-f481-46b7-8ae7-6fd4c15b8a26",
"category": "Class",
"kind": "realization",
"source": "a_mcp-fq2b3b~e1791791358908",
"target": "iface_mcp-9rdtg3~e1791791358909"
},
{
"id": "555b3309-99bd-4b80-ac4f-4eb1109ee577",
"category": "Class",
"kind": "dependency",
"source": "a_agent-74kh0t~e1791791358906",
"target": "a_tools-cidiso~e1791791358907",
"name": "diagram tools"
},
{
"id": "bc8c3c97-e83a-4b49-ac4c-6ffba6967d7e",
"category": "Class",
"kind": "dependency",
"source": "a_mcp-fq2b3b~e1791791358908",
"target": "a_tools-cidiso~e1791791358907",
"name": "the same closures"
},
{
"id": "e5b5dd79-71e9-40c1-9222-dfe87835a93c",
"category": "Class",
"kind": "dependency",
"source": "a_chat-8dv83e~e1791791358905",
"target": "a_agent-74kh0t~e1791791358906",
"name": "runs a turn;\nstreams the reply"
},
{
"id": "0154b790-7fb3-4cfa-9aba-9a4427fb59f6",
"category": "Class",
"kind": "inheritance",
"source": "Node-8upyih~e1791791358916",
"target": "Container-69ey6e~e1791791358919"
},
{
"id": "1dbbd8b4-471f-46f1-8e22-5a68c01e4dcd",
"category": "Class",
"kind": "composition",
"source": "Container-69ey6e~e1791791358919",
"target": "Shape-3k1csz~e1791791358914",
"targetRole": "shapes",
"sourceMult": "1",
"targetMult": "0..*"
},
{
"id": "41875b9a-ba1b-46e2-bc96-abd7badd0e92",
"category": "Class",
"kind": "association",
"source": "Project-1mr3kz~e1791791358912",
"target": "Diagram-g4aw4d~e1791791358913",
"name": "diagram_ids «by id»",
"targetMult": "0..*",
"directed": true
},
{
"id": "4abd45ca-c67e-44ef-8901-79e5faa77ca2",
"category": "Class",
"kind": "inheritance",
"source": "Link-528ped~e1791791358915",
"target": "Shape-3k1csz~e1791791358914"
},
{
"id": "8682e774-528c-4160-8d00-d0e158e72eac",
"category": "Class",
"kind": "inheritance",
"source": "Diagram-g4aw4d~e1791791358913",
"target": "Container-69ey6e~e1791791358919"
},
{
"id": "89238a0a-b784-42c0-8cca-900fd99ad1f0",
"category": "Class",
"kind": "dependency",
"source": "d_registry-awzr7m~e1791791358911",
"target": "Diagram-g4aw4d~e1791791358913",
"name": "to_diagram builds\nthe tree",
"stereotype": "create"
},
{
"id": "b93ef8f0-d0ea-49cc-aab6-b7564f39977e",
"category": "Class",
"kind": "composition",
"source": "Diagram-g4aw4d~e1791791358913",
"target": "EditStamp-n6895~e1791791358917",
"targetRole": "stamp",
"sourceMult": "1",
"targetMult": "1"
},
{
"id": "c0b7cdc2-f471-4052-ab88-f475f7889d96",
"category": "Class",
"kind": "dependency",
"source": "DiagramMeta-9o23wz~e1791791358918",
"target": "Diagram-g4aw4d~e1791791358913",
"stereotype": "projection of"
},
{
"id": "e8435944-99e1-4670-8a39-d8d67c1e3fff",
"category": "Class",
"kind": "association",
"source": "Link-528ped~e1791791358915",
"target": "Node-8upyih~e1791791358916",
"name": "source, target «by id»",
"targetMult": "2",
"directed": true
},
{
"id": "fc45b8c8-2b89-4c7c-b16c-8f0b48041300",
"category": "Class",
"kind": "inheritance",
"source": "Node-8upyih~e1791791358916",
"target": "Shape-3k1csz~e1791791358914"
},
{
"id": "01ec2e66-36a8-4e1b-9d61-bfe0ef1a2baa",
"category": "Class",
"kind": "dependency",
"source": "c_wsapi-9ki4fg~e1791791358894",
"target": "w_dctl-7safvj~e1791791358886",
"name": "on_change after a 0.8 s quiet window\n→ UI._on_canvas_change → save()"
},
{
"id": "2001904f-b2a4-44fa-9d48-5aceaa400b82",
"category": "Class",
"kind": "dependency",
"source": "a_tools-cidiso~e1791791358907",
"target": "c_wsapi-9ki4fg~e1791791358894",
"name": "lands an edit as\none undoable step"
},
{
"id": "4293c2ef-8ec5-4b4c-abc4-0594d4efd44b",
"category": "Class",
"kind": "composition",
"source": "comp_ui-co2694~e1791791358880",
"target": "b_widgets-9cod2m~e1791791358882",
"name": "drives",
"sourceMult": "1",
"description": "The shell constructs the controllers and chrome widgets; the UI places them in its own layout and owns their lifetime — one set per tab."
},
{
"id": "431d31a0-5d2e-4225-bfaa-c6483a2425de",
"category": "Class",
"kind": "inheritance",
"source": "comp_ui-co2694~e1791791358880",
"target": "w_shell-5m6jaa~e1791791358883"
},
{
"id": "9c4e95ee-66c5-4a24-9b8e-03deb6f32b78",
"category": "Class",
"kind": "dependency",
"source": "fn_main-1fyoo4~e1791791358877",
"target": "comp_ui-co2694~e1791791358880",
"name": "builds a fresh UI for\nevery browser tab",
"stereotype": "create",
"description": "main.py also picks the store (make_store: files | SQL) and the team provider (make_provider: in-memory | Redis) at start-up, and installs the MCP door at /mcp."
},
{
"id": "a645e1e9-0b8f-4c52-a9df-9ac26630a355",
"category": "Class",
"kind": "dependency",
"source": "w_dctl-7safvj~e1791791358886",
"target": "iface_persist-30dd1t~e1791791358899",
"name": "save_diagram(owner, project, d)"
},
{
"id": "e5398fb0-86b4-461c-a410-497eeac189df",
"category": "Class",
"kind": "dependency",
"source": "w_pane-aj45bs~e1791791358884",
"target": "c_widget-7k8oog~e1791791358891",
"name": "build_canvas_widget()\nper open diagram",
"stereotype": "create"
},
{
"id": "ec7d9955-c0b6-424d-8a4f-67618a9d3777",
"category": "Class",
"kind": "dependency",
"source": "fn_main-1fyoo4~e1791791358877",
"target": "fw_nicegui-97yl76~e1791791358875",
"name": "ui.run(); page routes;\nthe Socket.IO server"
}
]
}Figure code: drawmode:p7bc9c303/db0d87450
Explanation
The prompt:
Create me a C4 component diagram of the main components of the system, focusing on the interfaces / seams for persistence and team collaboration. Add the core diagram domain model underneath as a UML class diagrams.