Skip to content

Commit 5014cca

Browse files
committed
docs(adr): ADR-0025 v2 says what M1 shipped — the local install loop, the trusted-key store, the native-addon refusal, manifest-deps retired
Slices 1-3 of the M1 local T0 install loop landed, and the record still described the code before them. Corrected in place, history kept: - Status line: M1 moves from "not yet built" to what landed; the cloud fetch stays M2, tier dispatch beyond node stays M3. - 3.2: the packaging comment names bundled as the one strategy. - 3.3: os plugin build refuses a native addon; PluginPackagingSchema refuses manifest-deps by name; the build-side half is gone. - 3.4 step 2: install and every boot verify the signature against the environment's trusted keys; plugin-loader refuses an unverified one. - 3.5: step 5 runs no package manager; steps 4-7 exist for a local artifact; the M1 bullet is a landed line, its cloud-sample acceptance run still open. - 3.6: the boot-time loader dispatches on the tier (node imported, sandbox / worker / undeclared refused by name). - 5: the native-addon risk no longer names a manifest-deps mitigation. - 7: the dated note the B-prime ruling ordered — the trusted-key store landed in M1 in its minimal form; rotation and platform / cloud sources stay M3. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4d1j1VPnYjVUvuUMHjc
1 parent f5dd057 commit 5014cca

1 file changed

Lines changed: 46 additions & 34 deletions

File tree

‎docs/adr/0025-plugin-package-distribution.md‎

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ADR-0025: Plugin Package Distribution (Code + Dependencies)
22

3-
**Status**: Accepted — 2026-10-28 (ruled on objectstack#26553, ADR batch 4; proposed 2026-05, revised 2026-06-01, audited 2026-07-16 and 2026-09-12). Narrowed to what landed: Phase 1 (the `.osplugin` artifact, the compiled-manifest schema, `os plugin build` / `sign` / `publish`, cloud review and counter-signing) and install-time permission consent for package installs (console disclosure, `sys_package_installation.granted_permissions`, re-consent on a widening upgrade, the artifact → enforcer binding at load). Not yet built, carried by the M0–M3 programme on objectstack#27108: the code-plugin half of the install flow (§3.5 steps 4–7: `os plugin install`, download / verify / materialize / load — M1 local T0, M2 cloud fetch), runtime enforcement of the granted set (registered only today, §3.7 — M2), tier dispatch (T1 sandbox — M3), publish-side scans and secret-refs (M3). This revision (v2, 2026-10-28) corrects §3.3, §3.4, §3.8 and §3.10 to the code and records the maintainer's decisions Q1–Q8.
3+
**Status**: Accepted — 2026-10-28 (ruled on objectstack#26553, ADR batch 4; proposed 2026-05, revised 2026-06-01, audited 2026-07-16 and 2026-09-12). Narrowed to what landed: Phase 1 (the `.osplugin` artifact, the compiled-manifest schema, `os plugin build` / `sign` / `publish`, cloud review and counter-signing), install-time permission consent for package installs (console disclosure, `sys_package_installation.granted_permissions`, re-consent on a widening upgrade, the artifact → enforcer binding at load), and M1, the local T0 install loop (2026-10-29, §3.5: `os plugin install ./x.osplugin` against the environment's trusted keys, the boot-time loader with the tier dispatch point, disable / enable / uninstall; its cloud-sample acceptance run is still open). Not yet built, carried by the M0–M3 programme on objectstack#27108: the cloud fetch of a code plugin (§3.5 — M2), runtime enforcement of the granted set (registered only today, §3.7 — M2), tier dispatch beyond `node` (T1 sandbox — M3), publish-side scans and secret-refs (M3). This revision (v2, 2026-10-28) corrects §3.3, §3.4, §3.8 and §3.10 to the code and records the maintainer's decisions Q1–Q8; amended 2026-10-30 to what M1 shipped (§3.3, §3.4, §3.5, §3.6, §7).
44
**Deciders**: ObjectStack Protocol Architects
55
**Builds on**: [ADR-0003](./0003-package-as-first-class-citizen.md) (package + versioned releases), [ADR-0004](./0004-cloud-multi-kernel.md) (cloud multi-kernel), [ADR-0010](./0010-metadata-protection-model.md) (L1/L2/L3 protection), [ADR-0016](./0016-studio-package-authoring-and-publish.md) (package authoring & publish, local export/import)
66
**Consumers**: `@objectstack/core` (kernel, plugin-loader, security), `@objectstack/runtime` (sandbox, marketplace install), `@objectstack/cli`, `@objectstack/spec/system` (ObjectStackManifest), `@objectstack/spec/cloud`, `../objectui` (Studio)
@@ -156,7 +156,7 @@ Extends the existing `ObjectStackManifest` with three new blocks
156156
"type": "plugin",
157157
"engines": { "platform": ">=4.0 <5", "protocol": ">=1.0" },
158158
"runtime": "node", // node | sandbox | worker (see §3.6)
159-
"packaging": "bundled", // bundled | manifest-deps (see §3.3)
159+
"packaging": "bundled", // bundled, the one strategy (see §3.3)
160160
"permissions": { // explicitly requested capabilities
161161
"services": ["object", "http"],
162162
"hooks": ["record.beforeInsert"],
@@ -182,13 +182,15 @@ checks the existing `PluginPermissionEnforcer` already implements
182182
the manifest against `ManifestSchema` and writing per-file `integrity` into the
183183
compiled manifest. Install = unpack + verify; **no npm/toolchain at install
184184
time**. This is the closest analog to the JSON flow and keeps the security
185-
surface minimal. Native (`.node`) addons are disallowed by rule; the build does
186-
not yet refuse them mechanically (M1 adds the refusal).
185+
surface minimal. Native (`.node`) addons are disallowed by rule, and since M1
186+
`os plugin build` refuses one before writing anything (a `.node` module or a
187+
native package the bundle reaches, or a `.node` file under `assets/`).
187188
- **manifest-deps — RETIRED (v2, maintainer decision Q6, 2026-10-28; ADR-0049
188189
enforce-or-remove).** The strategy existed on the build side only (it shipped
189190
`package.json` + `pnpm-lock.yaml` and nothing ever installed them); it had zero
190-
consumers and no install path. `PluginPackagingSchema` keeps `bundled` as its
191-
only live value; the build-side half is removed in M1. Plugins that need native
191+
consumers and no install path. `PluginPackagingSchema` accepts `bundled` only
192+
and refuses `manifest-deps` by name with its migration prescription; the
193+
build-side half was removed in M1 (#27679). Plugins that need native
192194
addons or very large dependencies are a fresh decision for M3, with this
193195
retirement as the starting evidence.
194196

@@ -214,9 +216,9 @@ os plugin build → os plugin sign → os plugin publish
214216
`<id>-<version>.osplugin` (ustar + gzip) with a placeholder `SIGNATURE` entry.
215217
2. **sign** — Ed25519 over the raw artifact bytes, written as
216218
`ed25519:<keyId>:<base64url>` to a `.sig` sidecar (`sign.ts`); the publisher
217-
key stays with the publisher. Verification (`verifyPluginArtifact`) exists in
218-
core and has **no production caller until M1** (the loader checks only that a
219-
signature is well-formed, `plugin-loader.ts`).
219+
key stays with the publisher. Since M1 the host verifies it against the
220+
environment's trusted keys (§7) at `os plugin install` and again at every boot
221+
(`verifyPluginArtifact`); `plugin-loader.ts` refuses a signature no host verified.
220222
3. **publish** — extends `os package publish` and **reuses the package registry**
221223
(the `/cloud/plugins` endpoints of the original text were never built):
222224
- `POST /cloud/packages` → ensure the `sys_package` row (reverse-domain `id`,
@@ -264,8 +266,8 @@ resolve → compat check → permission consent → download+verify → material
264266
trusted publisher + marketplace keys; verify each file against `integrity`.
265267
Reject on any mismatch.
266268
5. **Materialize.** Unpack to a per-environment, per-plugin dir
267-
`<OS_HOME>/plugins/<env>/<id>/<version>/`. For manifest-deps, run
268-
`pnpm install --frozen-lockfile --ignore-scripts` here.
269+
`<OS_HOME>/plugins/<env>/<id>/<version>/`. *v2:* nothing is installed there;
270+
`bundled` is the one strategy (§3.3), so install runs no package manager.
269271
6. **Register.** Write the installation record — `sys_package_installation`
270272
(`env_id`, `version_id`, `granted_permissions`, `status`; v2 §3.8, the
271273
`sys_plugin_installation` of the original text was never created). Persist to a local store so installs survive
@@ -290,21 +292,23 @@ explicit `--trust-unsigned` dev override).
290292
code-bearing package, `sys_package_installation.granted_permissions`, and a
291293
409 `PERMISSION_RECONSENT_REQUIRED` on a widening upgrade. The granted set
292294
always equals the declared set — there is no partial grant.
293-
- **Steps 4–7 do not exist** for code plugins: there is no `os plugin install`,
294-
nothing reads a `.osplugin` back except `publish`, no `<OS_HOME>/plugins/…`
295-
path, no `--trust-unsigned`, and an environment artifact carries
296-
`sys_package_version.manifest_json` — metadata only, never the blob.
297-
- **M1 — local T0 loop, first-party / self-signed only** (`os plugin install
298-
./x.osplugin`): verify the whole-artifact Ed25519 signature against the host's
299-
trusted keys (`verifyPluginArtifact` gets its first production caller) and
300-
re-verify every file against `integrity` at unpack; materialize to
301-
`<OS_HOME>/plugins/<env>/<id>/<version>/`; write the installation record
302-
(§3.8); `--trust-unsigned` as the explicit dev override. The loader scans
303-
installed plugins **at boot** (hot reload was retired with #12587),
304-
dynamic-imports `dist/index.mjs`, reuses `plugin-loader.ts` dependency
305-
ordering, and carries a tier dispatch point that M1 wires for `node` only.
306-
Disable / uninstall reuse the package disable-state store. Acceptance: the
307-
cloud `plugins/connector-stripe` sample installs, loads and disables cleanly.
295+
- **Steps 4–7 exist for a local artifact only** (M1, below). For a code plugin
296+
in the cloud they do not: nothing serves the `.osplugin` back (§3.4), and an
297+
environment artifact carries `sys_package_version.manifest_json` — metadata
298+
only, never the blob.
299+
- ✅ **M1 — local T0 loop, first-party / self-signed only — landed 2026-10-29**
300+
(objectstack#27123: #27335, #27374, #27679). `os plugin install ./x.osplugin`
301+
verifies the `.sig` over the raw bytes against the environment's trusted keys
302+
(§7) before inflating anything, re-verifies every file against `integrity`,
303+
materializes to `<OS_HOME>/plugins/<env>/<id>/<version>/` and records the
304+
install in a local store (the stand-in for the §3.8 row); `--trust-unsigned`
305+
admits only an unsigned artifact, loudly. At **boot** (hot reload was retired
306+
with #12587) `os serve` re-verifies each install (artifact sha, signature,
307+
byte-equal tree), dispatches on the tier (§3.6) and hands what passed to
308+
`kernel.use`, which orders dependencies. `os plugin disable` / `enable` use the
309+
package disable-state store; `uninstall` takes effect at the next boot. Still
310+
open: the acceptance run on the cloud `plugins/connector-stripe` sample
311+
(objectstack#27570).
308312
⛔ **M1 is first-party / self-signed only and is listed on no marketplace
309313
surface**: T0 is author code in the host process (§3.6).
310314
- **M2 — cloud fetch**: the artifact download route serves the `.osplugin` with
@@ -333,13 +337,16 @@ enforces this at publish time (an unverified publisher cannot ship `runtime:
333337

334338
*v2 — as built and as phased (maintainer decision Q3):* `PluginRuntimeSchema`
335339
holds the three values, the cloud refuses `node` from an unverified publisher at
336-
publish, and **nothing dispatches on the tier at load** — every plugin that
337-
loads today loads in-process. The QuickJS runner serves hook / action script
340+
publish, and since M1 the boot-time loader dispatches on an installed plugin's
341+
tier (`dispatchPluginRuntime`): `node` is imported in process, `sandbox` /
342+
`worker` and an undeclared tier are refused by name — every plugin that loads
343+
today loads in-process. The QuickJS runner serves hook / action script
338344
bodies (§3.10 L1) and is never reached from a plugin's declared tier;
339345
`PluginSandboxRuntime` has no production construction site; T2 has no code.
340-
M1 wires the dispatch point for T0 only; **M3** routes `runtime: 'sandbox'` to
341-
QuickJS and decides the T2 RPC surface (§7). Until M3, the publish-time refusal
342-
is the only tier gate, which is why M1 stays first-party / self-signed.
346+
M1 wired the dispatch point for T0 only; **M3** routes `runtime: 'sandbox'` to
347+
QuickJS and decides the T2 RPC surface (§7). Until M3 nothing loads isolated
348+
(those tiers are refused, not confined), which is why M1 stays first-party /
349+
self-signed.
343350

344351
### 3.7 Security model (reuses existing components)
345352

@@ -592,8 +599,8 @@ its download / scan half is M2 / M3; Phase 4 (sandbox tier) = M3; Phase 5
592599
JSON-only flow never needed.
593600
- Permission consent + tiering add UX and lifecycle surface (re-consent on
594601
permission widening, tier enforcement).
595-
- Bundled packaging excludes native addons by default (mitigated by the opt-in
596-
manifest-deps strategy in Phase 5).
602+
- Bundled packaging excludes native addons, and `os plugin build` refuses them;
603+
with manifest-deps retired (Q6), a plugin that needs one waits for M3 (§3.3).
597604

598605
### Neutral
599606

@@ -628,7 +635,12 @@ its download / scan half is M2 / M3; Phase 4 (sandbox tier) = M3; Phase 5
628635
on the next boot.
629636
- **Key management & rotation** — deferred to **M3** (publisher keys stay with the
630637
publisher; the host's trusted root set and its rotation / revocation are
631-
designed with the T1 tier).
638+
designed with the T1 tier). *Note (2026-10-30, ruling `6467932167` on
639+
objectstack#27123, letter B′):* the host's trusted-key **store** landed in M1
640+
in its minimal form — `sys_trusted_key` (public keys only, `source: 'local'`),
641+
`os plugin keygen` and `os plugin trust add | list | revoke`; install and boot
642+
refuse an unknown or revoked key id by name. Rotation policy and the
643+
`platform` / `cloud` sources stay M3.
632644
- **T2 RPC surface** — deferred to **M3** (T2 stays reserved; the minimal
633645
host-service RPC contract is designed when the sandbox tier lands).
634646
- **Cross-plugin dependency conflicts** — deferred to **M3** (M1 and M2 install

0 commit comments

Comments
 (0)