feat(packages): consolidate package subsystem so AI-built app packages surface in Studio#1551
Merged
Merged
Conversation
Implement protocol.installPackage as the single canonical write primitive (registry + best-effort sys_packages), route the dispatcher's POST /packages and the AI's apply_blueprint app-home through it, and reconcile sys_packages back into the registry on boot — so an AI-created app.<name> package surfaces in Studio's package selector/detail and survives restart. - objectql: implement ObjectStackProtocolImplementation.installPackage - runtime: POST /api/v1/packages → protocol.installPackage (registry fallback) - service-package: boot-hydrate sys_packages → registry (no filesystem clobber) - service-ai: ensureAppPackage prefers protocol.installPackage, publish fallback Still the legacy package_id plane; sealed sys_package_version + cross-env promotion remain ADR-0027 follow-ups. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
When the AI builds an app it auto-creates an
app.<name>package (#1550) so the drafted artifacts have a home — but that package never appeared in Studio's package selector or detail. Root cause: the package subsystem was split across two stores that never met, with no reconciliation in either direction:SchemaRegistry(registry.ts) — written by boot-timeregisterApp()and HTTPPOST /api/v1/packages. This is the only store Studio reads (its selector hits the dispatcher's/api/v1/packages, whose list =registry.getAllPackages()and detail =registry.getPackage()).sys_packagestable (service-package) — where the AI writes (ensureAppPackage→packageService.publish). Nothing loaded it into the registry; the dispatcher never read it.So the AI's package landed in
sys_packages, Studio read the registry → invisible. Andprotocol.installPackagewas declared in the interface but never implemented.Change — one write primitive, one read source
@objectstack/objectql: implementObjectStackProtocolImplementation.installPackage— the canonical write primitive. Registers the package in the in-memory registry and best-effort persists tosys_packagesvia the optionalpackageservice. Non-fatal when nopackageservice is wired (registry write still succeeds).@objectstack/runtime: dispatcherPOST /api/v1/packagesroutes throughprotocol.installPackage(falls back to the bare registry write when the protocol is unavailable) — HTTP installs are durable too.@objectstack/service-package: on boot, reconcilesys_packagesrows back into the registry without clobbering filesystem-registered packages — persisted packages survive a restart and stay visible.@objectstack/service-ai:apply_blueprint'sensureAppPackageprefersprotocol.installPackage(falls back to the legacypackage-service publish), so an app package lands where Studio reads it.Verification
POST /api/v1/packages(→protocol.installPackage) returns 201,GET /api/v1/packages/<id>returns 200, and the package now appears inGET /api/v1/packages(list count 15 → 16) — the read path Studio's selector consumes.protocol.installPackagewrites registry + calls publish, skips/persists gracefully when the service is absent or rejects; dispatcher POST routes through the primitive and falls back; service-package boot-hydration hydrates a persisted row and does not overwrite an existing id;apply_blueprintprefersprotocol.installPackageand falls back to publish. Full suites: objectql 491, runtime 336, service-package 2, service-ai 471. ESM/CJS/DTS builds clean.Scope
Still the legacy
package_idplane — sealedsys_package_versionversioning and cross-environment promotion remain ADR-0027 follow-ups.🤖 Generated with Claude Code