Skip to content

feat(addons): unified distribution Phase 1 — kind taxonomy + managed addon binaries - #729

Merged
yvgude merged 4 commits into
mainfrom
feat/unified-distribution-p1
Jul 6, 2026
Merged

feat(addons): unified distribution Phase 1 — kind taxonomy + managed addon binaries#729
yvgude merged 4 commits into
mainfrom
feat/unified-distribution-p1

Conversation

@yvgude

@yvgude yvgude commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 1 of the unified-distribution epic #724 (closes #725). Design doc ships in this PR: docs/specs/unified-distribution-v1.md.

  • kind package taxonomyPackageManifest gains kind: context | skills | addon | grammar. Default context is omitted when serializing (byte-compat: every existing .ctxpkg unchanged); non-context kinds require schema v2, enforced in validate(). Spec §3.4 + JSON schema updated.
  • Unified artifact installer — new core/addons/artifact_install.rs: the single download → SHA-256 verify → harden → atomic-rename path. grammar_install (feat: grammar tiering — long-tail tree-sitter grammars as signed runtime addons #690) now delegates here with byte-identical behavior and unchanged policy gates; GrammarAsset is an alias of the shared ArtifactAsset.
  • Managed addon binaries[artifacts.<target-triple>] in lean-ctx-addon.toml: addon add fetches the platform binary into <data_dir>/addons/bin/<name>/<version>/ (never PATH), auto-pins the hash as spawn-time binhash, rewrites the gateway command to the absolute managed path, records an ArtifactReceipt. addons.policy = locked blocks the fetch before any network I/O. Resolution order: artifacts[install] bootstrap → PATH.
  • addon update <name> — side-by-side version dirs, health-gated flip, prune after success; a failed update leaves the working install wired. addon remove deletes managed binaries.
  • Doctor — verifies every artifact receipt: binary exists + hash matches + not revoked.

Acceptance criteria (from #725)

  • Addon with artifacts: zero PATH interaction (managed dir + absolute-path spawn)
  • Tampered managed binary ⇒ refetch attempted, never silently accepted (spawn stays binhash-gated)
  • locked policy ⇒ no network fetch (unit test)
  • Grammar behavior byte-identical after the module move (same messages, same gates, tests unchanged)
  • Existing packs round-trip byte-identically (default_kind_is_omitted_from_serialization)
  • Determinism guarantees untouched (fix(ctx_expand): fall back to reference_store for ref_-prefixed IDs #498) — no timestamps/counters in any new output

Test plan

Made with Cursor

yvgude and others added 2 commits July 6, 2026 13:00
…addon binaries (#725)

Part of the unified-distribution epic (#724, design:
docs/specs/unified-distribution-v1.md): everything an agent installs
converges on one package model, one registry, one trust chain.

Package taxonomy (byte-compatible):
- PackageManifest gains `kind` (context | skills | addon | grammar);
  default `context` is omitted on serialize, so every existing .ctxpkg
  stays byte-identical. Non-context kinds require schema v2 (validated).
  Spec §3.4 + JSON schema updated.

Managed addon binaries (zero PATH interaction):
- New core/addons/artifact_install.rs — the single download → SHA-256
  verify → harden → atomic-rename path, extracted from grammar_install
  (#690), which now delegates here (byte-identical behavior, same
  policy gates). GrammarAsset is an alias of the shared ArtifactAsset;
  current_target_triple() moved here from grammar_loader.
- AddonManifest gains [artifacts.<target-triple>]: `addon add` fetches
  the platform binary into <data_dir>/addons/bin/<name>/<version>/
  (never PATH), auto-pins its hash as the spawn-time binhash, rewrites
  the gateway command to the absolute managed path, and records an
  ArtifactReceipt. addons.policy=locked blocks the fetch pre-network.
  Resolution order: artifacts → [install] bootstrap → PATH.
- New `addon update <name>`: side-by-side version dirs, health-gated
  flip, prune after success — a failed update leaves the working
  install wired. `addon remove` deletes managed binaries.
- doctor: verifies every artifact receipt (exists + hash + not revoked).

7320 lib tests pass, clippy clean, fmt applied.

Co-authored-by: Cursor <cursoragent@cursor.com>
yvgude and others added 2 commits July 6, 2026 13:41
…3.9.2 block

Co-authored-by: Cursor <cursoragent@cursor.com>
@yvgude
yvgude merged commit ba7102d into main Jul 6, 2026
26 checks passed
@yvgude
yvgude deleted the feat/unified-distribution-p1 branch July 6, 2026 12:16
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unified Distribution Phase 1: kind field + unified artifact installer (managed addon binaries)

1 participant