File tree Expand file tree Collapse file tree 4 files changed +68
-0
lines changed
Expand file tree Collapse file tree 4 files changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
2020 makeChromeStorageAdapter ,
2121} from './controllers/index.ts' ;
2222import type { CapletManifest , LaunchResult } from './controllers/index.ts' ;
23+ import { manifests } from './manifests.ts' ;
2324
2425defineGlobals ( ) ;
2526
@@ -154,6 +155,9 @@ async function main(): Promise<void> {
154155 getKernel : {
155156 value : getKernel ,
156157 } ,
158+ manifests : {
159+ value : manifests ,
160+ } ,
157161 caplet : {
158162 value : harden ( {
159163 install : async ( manifest : CapletManifest , bundle ?: unknown ) =>
Original file line number Diff line number Diff line change @@ -40,6 +40,18 @@ declare global {
4040 */
4141 getKernel : ( ) => Promise < KernelFacade > ;
4242
43+ /**
44+ * Pre-defined caplet manifests for convenience.
45+ *
46+ * @example
47+ * ```typescript
48+ * await omnium.caplet.install(omnium.manifests.echo);
49+ * ```
50+ */
51+ manifests : {
52+ echo : CapletManifest ;
53+ } ;
54+
4355 /**
4456 * Caplet management API.
4557 */
@@ -98,6 +110,19 @@ declare global {
98110 getByService : (
99111 serviceName : string ,
100112 ) => Promise < InstalledCaplet | undefined > ;
113+
114+ /**
115+ * Get the root object presence for a caplet.
116+ *
117+ * @param capletId - The caplet ID.
118+ * @returns A promise for the caplet's root object (as a CapTP presence).
119+ * @example
120+ * ```typescript
121+ * const root = await omnium.caplet.getCapletRoot('com.example.echo');
122+ * const result = await E(root).echo('Hello!');
123+ * ```
124+ */
125+ getCapletRoot : ( capletId : string ) => Promise < unknown > ;
101126 } ;
102127 } ;
103128}
Original file line number Diff line number Diff line change 1+ import type { CapletManifest } from './controllers/caplet/types.ts' ;
2+
3+ /**
4+ * Get the extension URL for a bundle file.
5+ *
6+ * @param bundleName - Name of the bundle file (e.g., 'echo-caplet.bundle')
7+ * @returns chrome-extension:// URL string
8+ */
9+ function getBundleUrl ( bundleName : string ) : string {
10+ return chrome . runtime . getURL ( bundleName ) ;
11+ }
12+
13+ /**
14+ * Manifest for the echo-caplet.
15+ *
16+ * This Caplet provides a simple "echo" service that returns
17+ * the input message with an "Echo: " prefix.
18+ *
19+ * Usage:
20+ * - Provides: "echo" service
21+ * - Requests: No services (standalone)
22+ */
23+ export const echoCapletManifest : CapletManifest = harden ( {
24+ id : 'com.example.echo' ,
25+ name : 'Echo Service' ,
26+ version : '1.0.0' ,
27+ bundleSpec : getBundleUrl ( 'echo-caplet.bundle' ) ,
28+ requestedServices : [ ] ,
29+ providedServices : [ 'echo' ] ,
30+ } ) ;
31+
32+ /**
33+ * All available caplet manifests for use in the console.
34+ */
35+ export const manifests = harden ( {
36+ echo : echoCapletManifest ,
37+ } ) ;
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ const staticCopyTargets: readonly (string | Target)[] = [
3838 'packages/omnium-gatherum/src/manifest.json' ,
3939 // Trusted prelude-related
4040 'packages/kernel-shims/dist/endoify.js' ,
41+ // Caplet bundles
42+ 'packages/omnium-gatherum/src/vats/echo-caplet.bundle' ,
4143] ;
4244
4345const endoifyImportStatement = `import './endoify.js';` ;
You can’t perform that action at this time.
0 commit comments