From 19ef5726440decbbf9be5c44b8ccdb4e8d3d1e56 Mon Sep 17 00:00:00 2001 From: AAA <35992542+TNTcraftHIM@users.noreply.github.com> Date: Wed, 25 Nov 2026 12:18:22 +0800 Subject: [PATCH] docs(adr): propose one vocabulary for extension The owner wants bots, API clients, plugins, new activities and providers to be the same kind of thing underneath, with built-in features on the same points, and the scaffolding designed now. ADR-0020 proposes it from the primary documents of the harness the owner named and of seven older designs, and from three designers who worked from the requirements alone: one vocabulary of points, contributions, scopes, kinds and static compositions; four places where code runs, with authority that never comes from being an extension; a kind with a fallback as the only thing that crosses machines; and a proof on one built-in feature before any point is promised. --- .agents/handoff/to-codex.md | 36 ++++ docs/adr/0020-one-vocabulary-for-extension.md | 159 ++++++++++++++++++ docs/todo.md | 6 + 3 files changed, 201 insertions(+) create mode 100644 docs/adr/0020-one-vocabulary-for-extension.md diff --git a/.agents/handoff/to-codex.md b/.agents/handoff/to-codex.md index fe3a6ddbf..f8b921586 100644 --- a/.agents/handoff/to-codex.md +++ b/.agents/handoff/to-codex.md @@ -139,6 +139,42 @@ promise. changed meaning, host and relay, in the naming standard. ADR-0008 and 0011 need your statement of what applies to 3.0; I could not tell. +## ADR-0020: one vocabulary for extension + +The owner wants bots, API clients, plugins, new activities and providers to +be the same kind of thing underneath, with built-ins on the same points, and +the scaffolding designed now, after the harness whose every part is a plugin. +That reverses two things you and I had agreed: the standard's refusal of a +generic plugin framework, and the deferral of the activity envelope in +ADR-0017. [ADR-0020](../../docs/adr/0020-one-vocabulary-for-extension.md) is +proposed. Three designers worked from the requirements and from the primary +documents of that harness and of seven older designs; the one asked to find +where a plugin boundary costs more than it gives reached the same shape. + +What I expect you to test, and where the proposal already agrees with you: + +- **No loader and no solver.** Compositions are static lists resolved at + build, and a missing need is a build error. Nothing is loaded at run time. +- **The writer runs the compiled core only** and never reads a payload's + meaning. A kind is ordered and stored under one of three classes: history, + state with a revision to match, and signal. +- **A point with one role is not declared.** It needs a definition, a + provider and a consumer in the tree. Reachability and forwarding get no + published interface; storage gets an internal one because three + implementations exist. +- **Proof before promise, with a stop.** Watch-together moves first. A second + activity must then land without a kernel change, and the session hub must + shrink by more than the framework adds. If a built-in needs a side door, + the part interface is dropped and only scopes and kinds stay. +- **Scopes are the ADR-0015 owners.** Not a layer above them. + +What changes for the contract, if you take it: the record envelope (kind, +major version, class, opaque payload, fallback), unknown kinds stored and +unknown classes refused, capability names in the handshake, a program marker +with who added it in the membership record, and one reserved field. Please +give its nine decisions an outcome, and say what the envelope would cost in +the present wire. + ## ADR-0019: the life of a message The owner wants sending, editing, deleting and searching decided for 3.0, and diff --git a/docs/adr/0020-one-vocabulary-for-extension.md b/docs/adr/0020-one-vocabulary-for-extension.md new file mode 100644 index 000000000..613076d12 --- /dev/null +++ b/docs/adr/0020-one-vocabulary-for-extension.md @@ -0,0 +1,159 @@ +# ADR-0020: One Vocabulary For Extension + +- Status: proposed +- Date: 2026-11-25 + +## Context + +The [canon](../canon.md#how-it-is-built) asks for a small core that is open to +extension. The owner's direction goes further: a bot, an API client, a plugin, +a new activity and a provider are the same kind of thing underneath, the +built-in features should attach through the points the community would use, +and the scaffolding should be designed now. + +The model is an agent harness built wholly from plugins on a small kernel: a +plugin declares what it needs and provides, every registration can be undone, +a seam has a definition, a provider and a consumer, and the product itself is +composed from plugins only. One thing does not carry over. That harness serves +one trusted person on one machine. In a room, other people are affected by +code they never approved, stored history cannot be undone, and each +participant may run different extensions, so the shared rules have to stay +fixed. + +Today a new activity touches about eleven files outside the interface, a +headless text participant already joins like a person, and the standards +refuse a generic plugin framework. Three designers worked from the +requirements and this evidence without reading the repository, one of them +asked to find where a plugin boundary costs more than it gives. They agree on +what follows. + +## Decision + +1. **One vocabulary, four places.** A *point* is a typed place of attachment + declared by its owner. A *contribution* is data attached to a point, with + code loaded when needed. A *scope* is a lifetime that undoes everything + registered in it. A *kind* names shared room data. A *composition* is a + named list of parts. Authority never comes from being an extension: it + comes from admission, or from operating a machine. + + | Place | What runs there | What it can never do | + | --- | --- | --- | + | The room's writer | The compiled core only | Run community code, or let one record alter or block another | + | A person's client | Parts compiled into the build | Start capture, the microphone or control except through that person's act | + | A participant process | A bot or API client | More than a person can do on the wire, or be present without a marker | + | The operator's machine | Providers | Decide admission or order | + +2. **A kind is the only thing that crosses machines.** It is namespaced and + carries a major version, an opaque payload and a short fallback text. The + writer orders and stores it under one of three classes: *history*, + appended; *state*, the latest value per key with a revision that a write + must match; and *signal*, relayed and not stored. The writer checks the + sender, the class rule, size and rate, and never the meaning. Built-in + kinds are declared in the same registry. They may have validators compiled + into the core, and that privilege is stated openly. +3. **Without the extension, a person sees the fallback.** Records stay with + the room, are exported as they are, and are never migrated by the core. + Removing an extension stops rendering and nothing else. +4. **The client is a tree of scopes**: application, channel, room, activity, + capture. Every registration returns the means to undo it, and a scope that + ends undoes them in reverse. This is the split of the session hub that + [ADR-0015](./0015-browser-session-lifetime-owners.md) decided, not a layer + above it. Events notify; nothing intercepts. The consent to capture, the + indicators of who sees and hears, the join flow, the pools and the planner + belong to the kernel and are not points. +5. **Compositions are static.** The full place and plain screen sharing are + two lists of the same parts, resolved when the client is built. A missing + need is a build error that names it. There is no loader, dependency solver + or reload at run time. +6. **A program is a participant.** The writer records at admission that it is + a program and who added it, and the kernel draws that marker. It has a + person's actions and limits. Nothing reads a room without appearing in it. +7. **Providers stay on the operator's side, compiled in.** Storage has an + internal interface, because three implementations exist. Reachability and + forwarding get a published interface when a second independent implementer + appears. +8. **Internal, proposed, stable.** A point starts internal and free to change. + It becomes a promise when two independent consumers use it, one of them + outside the tree, a conformance test exists, and its absence has a defined + result. After that it only grows, and a break is a new name. The first + release publishes the wire and storage contract and nothing of the client's + part interface. +9. **Proof before promise.** Watch-together moves onto the framework first. + Then a second activity must land without a change to the kernel, a hundred + joins and leaves must return every connection, listener and timer to its + baseline, a build without the part must show the fallback without error, + the plain-sharing build must contain no conversation code, and the session + hub must shrink by more than the framework adds. If a built-in needs a side + door, or the code has grown after two features, the scopes and kinds stay + and the part interface is dropped. + +## Settled Before The First Release + +These go into [ADR-0017](./0017-contracts-fixed-before-release.md)'s contract, +which deferred the activity envelope until a consumer needed it. + +- The envelope on every room record: kind, major version, class, opaque + payload and fallback text. +- A record of an unknown kind in a known class is ordered and stored. An + unknown field is kept. An unknown class is refused with a stated reason. +- The handshake carries a version and an open set of capability names in both + directions, and the writer states its limits. +- The membership record says whether a participant is a program and who added + it. +- Refusals carry reasons from an open set, and an unknown reason is a plain + failure. +- Stored records keep their payload as committed, under a format version. +- One reserved field for rules that a kind might later bring to the writer. + +## Later, Under Conditions + +- **Community interface code** runs in a sandboxed frame with no network, + served by the person's own channel and pinned by its hash. It waits for the + first activity that someone outside the tree wants to write. +- **Community rules at the writer**, as a pure function that accepts or + refuses a record, wait for two real activities that the three classes and a + referee participant cannot express, and for a measured bound on what it + costs a Browser that hosts a room. + +## Not Built + +Community code in the writer or in a client's own realm. Hooks that intercept +or rewrite another person's record. Permissions or roles for extensions. +A registry run by the project, or code loaded from an address. Undoing a +shared effect: a retraction is another ordered record. A point with a +definition and no second provider or consumer. + +## Where The Designs Differed + +| Topic | Positions | Taken here | +| --- | --- | --- | +| Provider interfaces | Three published seams (two); storage only, internal (one) | Storage only, until a second implementer exists | +| Classes of shared state | Three (two); two, without signals (one) | Three, since signaling already exists | +| Rules of a community activity | A referee participant (two); the same reducer in every client (one) | Left to the first real activity | + +## Consequences + +- The sentence in the engineering standard that refuses a generic plugin + framework gives way to this record for the points it defines. +- The activity envelope moves from deferred to settled before release. +- Each owner taken out of the session hub is written as a scope. + +## References + +- [Reference harness](https://github.com/deepseek-ai/deepseek-harness) and its + [framework primer](https://deepseek-harness.github.io/deepseek-harness/en/reference/cordis-primer): + services, typed events, reversible effects, seams and profiles. Its plugin + code is not sandboxed. +- [Extension host](https://code.visualstudio.com/api/advanced-topics/extension-host) + and [proposed API](https://code.visualstudio.com/api/advanced-topics/using-proposed-api): + extensions outside the page, and proposed apart from stable. +- [Extension points](https://backstage.io/docs/backend-system/architecture/extension-points): + declared by their owner, additions only, a new name to break. +- [Extensible events](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/1767-extensible-events.md): + a text fallback for a type a client does not know. +- [How plugins run](https://developers.figma.com/docs/plugins/how-plugins-run/): + a sandbox with a narrow interface. +- [The future of developing add-ons](https://blog.mozilla.org/addons/2015/08/21/the-future-of-developing-firefox-add-ons/): + what complete access to internals cost. +- [Extending Caddy](https://caddyserver.com/docs/extending-caddy): modules + compiled in, with provision, validation and cleanup. diff --git a/docs/todo.md b/docs/todo.md index 192c47214..68af94c83 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -242,6 +242,12 @@ the feedback period; they do not delay that delivery. earlier version kept, delete as today, one revision per message, and search at the writer. Five points of the stored format are settled before it is first published. +- [ ] **One vocabulary for extension.** Decide + [ADR-0020](./adr/0020-one-vocabulary-for-extension.md): points, + contributions, scopes, kinds and static compositions; a kind with a fallback + as the only thing that crosses machines; a program as a participant. Its + envelope joins the contract settled before release, and watch-together is + the first feature moved onto it as proof. - [ ] **Separate the canon from derived design in the documents.** Where a record states a founding idea beside defaults, numbers or mechanisms, link the [canon](./canon.md) and keep the derived design. Start with