Skip to content

Conversation

@rekmarks
Copy link
Member

@rekmarks rekmarks commented Jan 14, 2026

Summary

  • Add Phase 1a: Single echo caplet with buildRootObject pattern
  • Add Phase 1b: Store and retrieve caplet root krefs
  • Add caplet manifest loading and installation
  • Return bootstrapRootKref from launchSubcluster
  • Add omnium.loadCaplet() for dynamic caplet loading
  • Fix vatPowers.logger in browser vats

Test plan

  • Caplet integration tests
  • Unit tests for error cases
  • Manual browser testing of caplet installation

Part 3 of 4 in PR stack for omnium-III
Depends on: #752

🤖 Generated with Claude Code


Note

Introduces initial caplet implementation and wires kernel launch results through to consumers.

  • Kernel: launchSubcluster now returns SubclusterLaunchResult with subclusterId, bootstrapRootKref, and optional bootstrapResult; facade maps to { subclusterId, rootKref }. RPC spec/tests updated.
  • CapTP: kernel facade extended with getVatRoot(krefString); kref marshalling scaffolding added (disabled) with tests.
  • Omnium: adds docs/caplet-contract.md, an echo-caplet vat (src/vats/echo-caplet.js) and manifest; build copies .bundle/manifests and adds build:vats. Background exposes omnium.loadCaplet() and caplet.getCapletRoot(); CapletController now stores rootKref from install and can return the root presence. New integration tests and fixtures.
  • Browser vats: pass vatPowers.logger to VatSupervisor.
  • Tests: kernel/browser/runtime and kernel-test updated to new launch result; coverage thresholds adjusted.

Written by Cursor Bugbot for commit 451a6dd. This will update automatically on new commits. Configure here.

@rekmarks rekmarks requested a review from a team as a code owner January 14, 2026 22:28
@rekmarks rekmarks marked this pull request as draft January 14, 2026 23:26
@rekmarks rekmarks force-pushed the rekm/caplet-implementation branch from 451a6dd to 605f8d9 Compare January 14, 2026 23:45
@rekmarks rekmarks force-pushed the rekm/controller-architecture branch 2 times, most recently from 6736065 to 89e5113 Compare January 15, 2026 00:00
@rekmarks rekmarks force-pushed the rekm/caplet-implementation branch from 605f8d9 to f08383c Compare January 15, 2026 00:01
@rekmarks rekmarks force-pushed the rekm/caplet-implementation branch from f08383c to 34a1f08 Compare January 15, 2026 06:25
@rekmarks rekmarks force-pushed the rekm/controller-architecture branch from 89e5113 to ee93a06 Compare January 15, 2026 06:31
rekmarks and others added 10 commits January 15, 2026 10:19
Implements Phase 1a of the caplet system, establishing the foundational
architecture for caplet vats with a working echo-caplet example. This
validates the caplet vat contract and installation lifecycle before
tackling service injection complexity.

Changes:
- Add comprehensive caplet vat contract documentation
- Create echo-caplet.js demonstrating buildRootObject pattern
- Add bundle build script using @endo/bundle-source
- Implement caplet integration tests (8 new tests, all passing)
- Create test fixtures for caplet manifests
- Refactor makeMockStorageAdapter to support shared storage
- Add plan in .claude/plans for follow-up work

Key achievements:
- Caplet vat contract fully documented with examples
- Echo-caplet bundles successfully (696KB)
- Install/uninstall lifecycle tested and working
- Service lookup by name validated
- State persistence across controller restarts verified
- 100% code coverage for CapletController maintained

Deferred to future work (Phase 1b):
- Kref capture mechanism
- Service parameter injection
- Consumer caplet implementation
- Two-caplet communication

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Implements Phase 1b functionality to store caplet root kernel references (krefs) and expose them via omnium.caplet.getCapletRoot().

This enables: omnium.caplet.install(manifest), omnium.caplet.getCapletRoot(capletId), and E(presence).method() for calling vat methods from background console.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add explicit type annotation for kernelP and use spread operator for optional rootKref field.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove KrefWrapper type from kernel-browser-runtime types
- Make rootKref a required string field in LaunchResult (not optional)
- Make rootKref required in InstalledCaplet and omnium LaunchResult
- Add assertions in kernel-facade for capData, subclusterId, and rootKref
- Remove isKrefWrapper function (inline check kept in makeKrefTables)
- Update tests to use simplified types and improved mocks

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add tests for validation errors in kernel-facade launchSubcluster:
- Throws when kernel returns no capData
- Throws when capData body has no subclusterId
- Throws when capData slots is empty (no root kref)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add omnium.manifests.echo so users can install caplets from the console:
  await omnium.caplet.install(omnium.manifests.echo)

Changes:
- Create src/manifests.ts with echo caplet manifest using chrome.runtime.getURL
- Add echo-caplet.bundle to vite static copy targets
- Expose manifests in background.ts via omnium.manifests
- Update global.d.ts with manifests type and missing getCapletRoot

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add omnium.loadCaplet(id) to dynamically fetch caplet manifest and bundle
- Fix vatPowers.logger missing in browser vats (iframe.ts)
- Fix SubclusterLaunchResult to return bootstrapRootKref directly
  instead of trying to extract it from bootstrap() return slots

The bootstrapRootKref is the kref of the vat root object, which is
already known when the vat launches. Previously we incorrectly tried
to get it from the slots of the bootstrap() method return value.

Next step: Wire up CapTP marshalling so E(root).echo() works with
the caplet root presence.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Use nullable() instead of optional() for bootstrapResult field, and
define a JSON-compatible LaunchSubclusterRpcResult type that uses null
instead of undefined for JSON serialization.

Also update tests to match the new behavior.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@rekmarks rekmarks force-pushed the rekm/caplet-implementation branch from 34a1f08 to 4caf528 Compare January 15, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants