ONEWEB6.0Docs

Part 2 — Core Concepts

5 min readDocumentation
Audiencebuilders and developers.
Sources this page was written from

kernel-schemas/, kernel-poc/README.md, kernel-poc/src/ (kernel.js, store-pg.js, graph.js, tools.js), CLAUDE.md invariants.

2.1 The IR (intermediate representation)#

Every kind of thing you design has a JSON Schema in kernel-schemas/ and is wrapped in a common envelope (artifact-envelope.schema.json). The schemas are authoritative.

Kind Schema Designed in
Entity entity.schema.json Data model
Form form.schema.json Forms
Page, Component library, Design system page, componentlibrary, designsystem Page designer, Design system
Process process.schema.json Process designer
Decision decision.schema.json Decision designer
Glossary glossary.schema.json Glossary designer
Flow, Connection, Policy flow, connection, policy Integration designer
Content, Dashboard content, dashboard Content / dashboard editors
Contract contract.schema.json Contract between apps (version-pinned, drift detectable)
App, Bundle, Group app, bundle, group Project page, Deployment Center
Workspace, Security workspace, security People & access, Environments
Work Portal config workportalconfig.schema.json Process/Work Portal settings

Two renderers, one spec. A designer draws the spec; a generator turns it into running code. When they disagree, parity tests catch it; when they agree and are both wrong, nothing does — which is why both are changed together.

flowchart TB S["Artifact spec (IR)<br/>JSON Schema in kernel-schemas"] S --> D["Designer<br/>draws the spec"] S --> G["Generator<br/>turns it into running code"] D --> P["Parity tests<br/>catch disagreement"] G --> P
Two renderers, one spec

2.2 The Kernel#

The Kernel is an event store. A change is an event appended to an artifact's history; the current spec is a fold over its events (foldEvents, one function for both backends).

flowchart LR A["Tool call"] -->|"appends"| B[("Event history<br/>of one artifact")] B -->|"foldEvents"| C["Current spec"] B --> D["Undo, redo,<br/>audit"]
Events and the current spec
  • Backends. Postgres (kernel-pg.js, store-pg.js; the real one, :5437) and a JSONL file backend (kernel.js, store.js) for offline work. They must agree; parity tests run the same sequences through both.
  • Compositions. A group of tool calls applied as one step. Undo/redo operate on compositions.
  • Tombstones. Deletions are recorded, not erased.
  • Lifecycle. Draft → publish → promote (live) → archive/restore. Stored as columns, not events.
stateDiagram-v2 [*] --> draft draft --> published : artifact_publish published --> live : artifact_promote_live live --> published : artifact_publish after an edit draft --> archived : artifact_archive published --> archived : artifact_archive live --> archived : artifact_archive archived --> draft : artifact_restore
Artifact lifecycle
  • Upsert guard. Re-running a seed never silently replaces an edit: a three-way compare of the last imported spec, the stored spec and the incoming one (upsert-guard.js). Edited-and-changed is refused (EDITED_SINCE_IMPORT).
  • Facade. http-server.js serves the tools over HTTP on 127.0.0.1 (default :4500; the dev launch config uses :4600). It authenticates, authorizes per workspace, and validates arguments. mcp-server.js serves the same tools over stdio, and POST /mcp over HTTP with a bearer token.

2.3 The artifact graph#

Artifacts reference each other (page → entity, process node → form, flow → connection, decision → glossary term). graph.js and kernel_impact answer "what depends on this?" so a change or a delete can show what it would break. References are recognised only where the schema declares one (refSites), never in free text.

flowchart LR P["Page"] -->|"references"| E["Entity"] N["Process node"] -->|"references"| F["Form"] L["Flow"] -->|"references"| C["Connection"] D["Decision"] -->|"references"| G["Glossary"] Q["kernel_impact"] -.->|"answers: what depends on this?"| E
What depends on what

2.4 The typed tool layer#

All changes, from the Workbench, from scripts, and from Veda, go through typed tools — one module per artifact kind under kernel-poc/src/tools/ (the exact count is derived by test-tool-schemas.js, not written down here). Properties that matter:

flowchart LR A["Call arrives<br/>(HTTP, MCP or stdio)"] --> B["Authenticate"] B --> C["Validate arguments<br/>tool-args.js"] C --> D["Authorize<br/>verb in the workspace"] D --> E["Handler"] E --> F[("Event store")]
How a tool call is checked

The Authorize step checks workspace bindings only when KERNEL_ENFORCE_BINDINGS is true (default false).

  • Each tool has a declared inputSchema; every call is validated by tool-args.js before authorization and before the handler runs.
  • Read-only tools are listed by name (READ_ONLY_TOOLS); everything else needs an established identity and the right verb in the target's workspace.
  • A tool refuses rather than guesses (a rename is never inferred from a diff; a destructive migration is not emitted).

2.5 Design principles#

These principles are load-bearing: each exists because breaking it once produced a bug that looked like something else.

Principle What it means in practice
Fail closed A row policy that cannot be enforced returns 503, not every row. A migration that cannot complete does not record its version.
Refuse rather than guess Unknown variant → no class; blocked migration → not emitted even with --allow-destructive.
One parser per language Expressions: compile-expr.js. FEEL: compile-feel.js. A second parser would be a second dialect.
Every SQL value is a bind parameter; every identifier is quoted Applies to generators and row policies alike.
Generated output is never edited Regenerate. Hand-written config lives beside it (e.g. .env.local).
Parity is proved by execution The in-app and Hub runtimes are compared by sending the same input to both.
The design system is the dictionary Generators emit markup from component contracts; the HTML importer reads it back through the same contracts.
Secrets are never in artifacts Connections hold names; values live in the vault (Part 6).