@syntropika/tembra-sdk 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -17
- package/dist/authoring/types.d.ts +64 -3
- package/dist/authoring/wit.d.ts +6 -0
- package/dist/bridge/commands.d.ts +1190 -0
- package/dist/bridge/identifiers.d.ts +2 -0
- package/dist/bridge/kernel.d.ts +18 -107
- package/dist/bridge/protocol.d.ts +3 -138
- package/dist/browser.d.ts +14 -1
- package/dist/browser.js +141 -3298
- package/dist/chunks/browser-b8jamxw2.js +3399 -0
- package/dist/chunks/execution-nsqc6nrt.js +1419 -0
- package/dist/chunks/index-01zk0xqx.js +160 -0
- package/dist/chunks/index-3fjdfdfd.js +152 -0
- package/dist/chunks/index-aaymjn7v.js +787 -0
- package/dist/chunks/index-c1w7z9hx.js +356 -0
- package/dist/chunks/index-h8t0n42q.js +738 -0
- package/dist/chunks/index-hfds9mzp.js +308 -0
- package/dist/chunks/index-kr4x67wt.js +177 -0
- package/dist/chunks/index-kr6bnh34.js +117 -0
- package/dist/chunks/index-kyt9dj0a.js +1421 -0
- package/dist/chunks/index-n1wxzc9w.js +830 -0
- package/dist/chunks/index-pvac426d.js +74 -0
- package/dist/chunks/index-smyds5ce.js +3234 -0
- package/dist/chunks/index-sse8aapb.js +121 -0
- package/dist/chunks/index-v6heph77.js +643 -0
- package/dist/chunks/index-xrdvnv37.js +3448 -0
- package/dist/chunks/index-za4mg94e.js +26 -0
- package/dist/chunks/index-zkqmnjj8.js +167 -0
- package/dist/coordinator.js +9 -500
- package/dist/error.d.ts +2 -0
- package/dist/errors.d.ts +3 -0
- package/dist/guest.d.ts +173 -0
- package/dist/guest.js +26 -0
- package/dist/host.d.ts +36 -30
- package/dist/host.js +37 -3276
- package/dist/http/bytes.d.ts +8 -0
- package/dist/http/events.d.ts +7 -0
- package/dist/http.d.ts +45 -0
- package/dist/http.js +291 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +49 -862
- package/dist/infrastructure/rpc/client.d.ts +2 -1
- package/dist/infrastructure/rpc/resources.d.ts +28 -0
- package/dist/interpreter/abi.d.ts +54 -0
- package/dist/interpreter/acquire.d.ts +18 -0
- package/dist/interpreter/browser-network.d.ts +52 -0
- package/dist/interpreter/browser-port.d.ts +55 -0
- package/dist/interpreter/browser.d.ts +79 -0
- package/dist/interpreter/cli.d.ts +5 -0
- package/dist/interpreter/codec.d.ts +42 -0
- package/dist/interpreter/component/execution.d.ts +42 -0
- package/dist/interpreter/component/host.d.ts +69 -0
- package/dist/interpreter/component/instance.d.ts +40 -0
- package/dist/interpreter/component/kernel.d.ts +120 -0
- package/dist/interpreter/component/names.d.ts +5 -0
- package/dist/interpreter/component/port.d.ts +85 -0
- package/dist/interpreter/component/prepared.d.ts +97 -0
- package/dist/interpreter/component/resources.d.ts +45 -0
- package/dist/interpreter/component/revision.d.ts +87 -0
- package/dist/interpreter/component/scope.d.ts +116 -0
- package/dist/interpreter/component/streams.d.ts +28 -0
- package/dist/interpreter/component/values.d.ts +79 -0
- package/dist/interpreter/component/wasi-filesystem.d.ts +21 -0
- package/dist/interpreter/component/wasi-host.d.ts +64 -0
- package/dist/interpreter/component/wasi-http.d.ts +33 -0
- package/dist/interpreter/component/wasi-sockets.d.ts +183 -0
- package/dist/interpreter/component/wasi.d.ts +41 -0
- package/dist/interpreter/core.d.ts +64 -0
- package/dist/interpreter/fetch-http-provider.d.ts +17 -0
- package/dist/interpreter/filesystem/contract.d.ts +85 -0
- package/dist/interpreter/filesystem/memory.d.ts +3 -0
- package/dist/interpreter/filesystem/opfs.d.ts +3 -0
- package/dist/interpreter/filesystem/scope.d.ts +35 -0
- package/dist/interpreter/filesystem.d.ts +8 -0
- package/dist/interpreter/gate.d.ts +6 -0
- package/dist/interpreter/host-protocol.d.ts +100 -0
- package/dist/interpreter/http-ingress-fetch.d.ts +7 -0
- package/dist/interpreter/http-ingress.d.ts +96 -0
- package/dist/interpreter/http-provider.d.ts +85 -0
- package/dist/interpreter/io.d.ts +20 -0
- package/dist/interpreter/mobile.d.ts +149 -0
- package/dist/interpreter/native-ingress.d.ts +95 -0
- package/dist/interpreter/node-port.d.ts +25 -0
- package/dist/interpreter/node.d.ts +36 -0
- package/dist/interpreter/revision.d.ts +64 -0
- package/dist/interpreter/scope.d.ts +89 -0
- package/dist/interpreter/socket-addresses.d.ts +50 -0
- package/dist/interpreter/socket-provider.d.ts +110 -0
- package/dist/interpreter/standard-cli.d.ts +34 -0
- package/dist/interpreter/standard-codec.d.ts +96 -0
- package/dist/interpreter/standard-filesystem.d.ts +47 -0
- package/dist/interpreter/standard-host.d.ts +71 -0
- package/dist/interpreter/standard-http-values.d.ts +159 -0
- package/dist/interpreter/standard-http.d.ts +9 -0
- package/dist/interpreter/standard-ingress.d.ts +63 -0
- package/dist/interpreter/standard-sockets.d.ts +177 -0
- package/dist/interpreter/standard-streams.d.ts +218 -0
- package/dist/interpreter/standard-system.d.ts +35 -0
- package/dist/interpreter/standard-utf8.d.ts +4 -0
- package/dist/interpreter/standard.d.ts +18 -0
- package/dist/interpreter/types.d.ts +152 -0
- package/dist/interpreter/wit-shape.d.ts +92 -0
- package/dist/manager.js +5 -332
- package/dist/msgpack.js +9 -615
- package/dist/node.d.ts +8 -1
- package/dist/node.js +248 -3287
- package/dist/rpc.js +196 -699
- package/dist/runtime/adapters.d.ts +120 -0
- package/dist/runtime/adapters.js +38 -0
- package/dist/runtime/calls.d.ts +9 -3
- package/dist/runtime/lifecycle.d.ts +3 -1
- package/dist/runtime/orbs.d.ts +5 -4
- package/dist/runtime/references.d.ts +27 -1
- package/dist/runtime/reload.d.ts +5 -3
- package/dist/runtime/scopes.d.ts +1 -1
- package/dist/runtime/signals.d.ts +4 -0
- package/dist/runtime/wit-client.d.ts +38 -0
- package/dist/telemetry.js +4 -25
- package/dist/tooling/build.d.ts +2 -2
- package/dist/tooling/client-resources.d.ts +23 -0
- package/dist/tooling/client.d.ts +10 -0
- package/dist/tooling/component-glue.d.ts +17 -0
- package/dist/tooling/component.d.ts +11 -0
- package/dist/tooling/index.d.ts +3 -1
- package/dist/tooling/index.js +1155 -102
- package/dist/tooling/resolver.d.ts +4 -4
- package/dist/tooling/typecheck.d.ts +2 -1
- package/dist/tooling/types.d.ts +27 -12
- package/dist/tooling/wit.d.ts +9 -0
- package/dist/wasi/wasi-clocks-types.d.ts +2 -0
- package/dist/wasi/wasi-http-client.d.ts +5 -0
- package/dist/wasi/wasi-http-types.d.ts +285 -0
- package/dist/wasi/wasi-sockets-ip-name-lookup.d.ts +23 -0
- package/dist/wasi/wasi-sockets-types.d.ts +146 -0
- package/package.json +62 -35
- package/src/authoring/declaration.ts +1 -1
- package/src/authoring/types.ts +53 -3
- package/src/authoring/wit.ts +15 -0
- package/src/bridge/commands.ts +1105 -0
- package/src/bridge/identifiers.ts +2 -0
- package/src/bridge/kernel.ts +56 -98
- package/src/bridge/protocol.ts +3 -142
- package/src/browser.ts +90 -6
- package/src/context-key.ts +4 -7
- package/src/error.ts +1 -1
- package/src/errors.ts +7 -0
- package/src/guest.ts +327 -0
- package/src/host.ts +128 -23
- package/src/http/bytes.ts +87 -0
- package/src/http/events.ts +34 -0
- package/src/http.ts +272 -0
- package/src/index.ts +3 -0
- package/src/infrastructure/rpc/client.ts +136 -17
- package/src/infrastructure/rpc/resources.ts +123 -0
- package/src/interpreter/abi.ts +69 -0
- package/src/interpreter/acquire.ts +58 -0
- package/src/interpreter/browser-network.ts +170 -0
- package/src/interpreter/browser-port.ts +425 -0
- package/src/interpreter/browser.ts +340 -0
- package/src/interpreter/cli.ts +30 -0
- package/src/interpreter/codec.ts +298 -0
- package/src/interpreter/component/execution.ts +264 -0
- package/src/interpreter/component/host.ts +409 -0
- package/src/interpreter/component/instance.ts +138 -0
- package/src/interpreter/component/kernel.ts +611 -0
- package/src/interpreter/component/names.ts +13 -0
- package/src/interpreter/component/port.ts +598 -0
- package/src/interpreter/component/prepared.ts +194 -0
- package/src/interpreter/component/resources.ts +345 -0
- package/src/interpreter/component/revision.ts +702 -0
- package/src/interpreter/component/scope.ts +447 -0
- package/src/interpreter/component/streams.ts +180 -0
- package/src/interpreter/component/values.ts +254 -0
- package/src/interpreter/component/wasi-filesystem.ts +472 -0
- package/src/interpreter/component/wasi-host.ts +197 -0
- package/src/interpreter/component/wasi-http.ts +939 -0
- package/src/interpreter/component/wasi-sockets.ts +958 -0
- package/src/interpreter/component/wasi.ts +238 -0
- package/src/interpreter/core.ts +386 -0
- package/src/interpreter/fetch-http-provider.ts +98 -0
- package/src/interpreter/filesystem/contract.ts +138 -0
- package/src/interpreter/filesystem/memory.ts +180 -0
- package/src/interpreter/filesystem/opfs.ts +294 -0
- package/src/interpreter/filesystem/scope.ts +390 -0
- package/src/interpreter/filesystem.ts +20 -0
- package/src/interpreter/gate.ts +55 -0
- package/src/interpreter/host-protocol.ts +242 -0
- package/src/interpreter/http-ingress-fetch.ts +133 -0
- package/src/interpreter/http-ingress.ts +203 -0
- package/src/interpreter/http-provider.ts +105 -0
- package/src/interpreter/io.ts +66 -0
- package/src/interpreter/mobile.ts +385 -0
- package/src/interpreter/native-ingress.ts +550 -0
- package/src/interpreter/node-port.ts +218 -0
- package/src/interpreter/node.ts +114 -0
- package/src/interpreter/revision.ts +450 -0
- package/src/interpreter/scope.ts +453 -0
- package/src/interpreter/socket-addresses.ts +246 -0
- package/src/interpreter/socket-provider.ts +126 -0
- package/src/interpreter/standard-cli.ts +184 -0
- package/src/interpreter/standard-codec.ts +403 -0
- package/src/interpreter/standard-filesystem.ts +545 -0
- package/src/interpreter/standard-host.ts +840 -0
- package/src/interpreter/standard-http-values.ts +624 -0
- package/src/interpreter/standard-http.ts +622 -0
- package/src/interpreter/standard-ingress.ts +344 -0
- package/src/interpreter/standard-sockets.ts +847 -0
- package/src/interpreter/standard-streams.ts +710 -0
- package/src/interpreter/standard-system.ts +182 -0
- package/src/interpreter/standard-utf8.ts +72 -0
- package/src/interpreter/standard.ts +283 -0
- package/src/interpreter/types.ts +163 -0
- package/src/interpreter/wit-shape.ts +175 -0
- package/src/node.ts +43 -14
- package/src/runtime/activities.ts +6 -6
- package/src/runtime/adapters.ts +314 -0
- package/src/runtime/calls.ts +218 -56
- package/src/runtime/context.ts +7 -7
- package/src/runtime/lifecycle.ts +36 -17
- package/src/runtime/orbs.ts +81 -39
- package/src/runtime/programs.ts +16 -8
- package/src/runtime/references.ts +128 -11
- package/src/runtime/reload.ts +71 -30
- package/src/runtime/resources.ts +2 -2
- package/src/runtime/scopes.ts +17 -17
- package/src/runtime/session.ts +3 -1
- package/src/runtime/signals.ts +31 -0
- package/src/runtime/wit-client.ts +228 -0
- package/src/tooling/build.ts +152 -54
- package/src/tooling/client-resources.ts +74 -0
- package/src/tooling/client.ts +531 -0
- package/src/tooling/component-glue.ts +288 -0
- package/src/tooling/component.ts +225 -0
- package/src/tooling/index.ts +3 -7
- package/src/tooling/resolver.ts +42 -25
- package/src/tooling/typecheck.ts +59 -4
- package/src/tooling/types.ts +27 -12
- package/src/tooling/wit.ts +188 -0
- package/dist/embedded.d.ts +0 -1
- package/dist/embedded.js +0 -1
- package/src/embedded.ts +0 -293
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syntropika/tembra-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,87 +12,114 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#tembra-adapters": {
|
|
17
|
+
"source": "./src/runtime/adapters.ts",
|
|
18
|
+
"bun": "./src/runtime/adapters.ts",
|
|
19
|
+
"types": "./dist/runtime/adapters.d.ts",
|
|
20
|
+
"browser": "./src/runtime/adapters.ts",
|
|
21
|
+
"default": "./dist/runtime/adapters.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
15
24
|
"exports": {
|
|
16
25
|
".": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
"tembra-wasm": {
|
|
27
|
+
"source": "./src/guest.ts",
|
|
28
|
+
"bun": "./src/guest.ts",
|
|
29
|
+
"types": "./dist/guest.d.ts",
|
|
30
|
+
"browser": "./dist/guest.js",
|
|
31
|
+
"default": "./dist/guest.js"
|
|
32
|
+
},
|
|
20
33
|
"source": "./src/index.ts",
|
|
34
|
+
"bun": "./src/index.ts",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"browser": "./dist/index.js",
|
|
37
|
+
"react-native": "./dist/index.js",
|
|
21
38
|
"import": "./dist/index.js"
|
|
22
39
|
},
|
|
23
40
|
"./node": {
|
|
24
|
-
"types": "./src/node.ts",
|
|
25
|
-
"bun": "./src/node.ts",
|
|
26
|
-
"browser": "./src/node.ts",
|
|
27
41
|
"source": "./src/node.ts",
|
|
42
|
+
"bun": "./src/node.ts",
|
|
43
|
+
"types": "./dist/node.d.ts",
|
|
44
|
+
"browser": "./dist/node.js",
|
|
28
45
|
"import": "./dist/node.js"
|
|
29
46
|
},
|
|
30
47
|
"./browser": {
|
|
31
|
-
"types": "./src/browser.ts",
|
|
32
|
-
"bun": "./src/browser.ts",
|
|
33
|
-
"browser": "./src/browser.ts",
|
|
34
48
|
"source": "./src/browser.ts",
|
|
49
|
+
"bun": "./src/browser.ts",
|
|
50
|
+
"types": "./dist/browser.d.ts",
|
|
51
|
+
"browser": "./dist/browser.js",
|
|
35
52
|
"import": "./dist/browser.js"
|
|
36
53
|
},
|
|
37
54
|
"./runtime": {
|
|
38
|
-
"types": "./src/host.ts",
|
|
39
|
-
"bun": "./src/host.ts",
|
|
40
|
-
"browser": "./src/host.ts",
|
|
41
55
|
"source": "./src/host.ts",
|
|
56
|
+
"bun": "./src/host.ts",
|
|
57
|
+
"types": "./dist/host.d.ts",
|
|
58
|
+
"browser": "./dist/host.js",
|
|
59
|
+
"react-native": "./dist/host.js",
|
|
42
60
|
"import": "./dist/host.js"
|
|
43
61
|
},
|
|
44
62
|
"./tooling": {
|
|
45
|
-
"types": "./src/tooling/index.ts",
|
|
46
|
-
"bun": "./src/tooling/index.ts",
|
|
47
|
-
"browser": "./src/tooling/index.ts",
|
|
48
63
|
"source": "./src/tooling/index.ts",
|
|
64
|
+
"bun": "./src/tooling/index.ts",
|
|
65
|
+
"types": "./dist/tooling/index.d.ts",
|
|
66
|
+
"browser": "./dist/tooling/index.js",
|
|
49
67
|
"import": "./dist/tooling/index.js"
|
|
50
68
|
},
|
|
51
69
|
"./msgpack": {
|
|
52
|
-
"types": "./src/msgpack.ts",
|
|
53
|
-
"bun": "./src/msgpack.ts",
|
|
54
|
-
"browser": "./src/msgpack.ts",
|
|
55
70
|
"source": "./src/msgpack.ts",
|
|
71
|
+
"bun": "./src/msgpack.ts",
|
|
72
|
+
"types": "./dist/msgpack.d.ts",
|
|
73
|
+
"browser": "./dist/msgpack.js",
|
|
56
74
|
"import": "./dist/msgpack.js"
|
|
57
75
|
},
|
|
58
76
|
"./coordinator": {
|
|
59
|
-
"types": "./src/coordinator.ts",
|
|
60
|
-
"bun": "./src/coordinator.ts",
|
|
61
|
-
"browser": "./src/coordinator.ts",
|
|
62
77
|
"source": "./src/coordinator.ts",
|
|
78
|
+
"bun": "./src/coordinator.ts",
|
|
79
|
+
"types": "./dist/coordinator.d.ts",
|
|
80
|
+
"browser": "./dist/coordinator.js",
|
|
63
81
|
"import": "./dist/coordinator.js"
|
|
64
82
|
},
|
|
65
83
|
"./manager": {
|
|
66
|
-
"types": "./src/manager.ts",
|
|
67
|
-
"bun": "./src/manager.ts",
|
|
68
|
-
"browser": "./src/manager.ts",
|
|
69
84
|
"source": "./src/manager.ts",
|
|
85
|
+
"bun": "./src/manager.ts",
|
|
86
|
+
"types": "./dist/manager.d.ts",
|
|
87
|
+
"browser": "./dist/manager.js",
|
|
70
88
|
"import": "./dist/manager.js"
|
|
71
89
|
},
|
|
72
90
|
"./rpc": {
|
|
73
|
-
"types": "./src/rpc.ts",
|
|
74
|
-
"bun": "./src/rpc.ts",
|
|
75
|
-
"browser": "./src/rpc.ts",
|
|
76
91
|
"source": "./src/rpc.ts",
|
|
92
|
+
"bun": "./src/rpc.ts",
|
|
93
|
+
"types": "./dist/rpc.d.ts",
|
|
94
|
+
"browser": "./dist/rpc.js",
|
|
77
95
|
"import": "./dist/rpc.js"
|
|
78
96
|
},
|
|
79
97
|
"./telemetry": {
|
|
80
|
-
"types": "./src/telemetry.ts",
|
|
81
|
-
"bun": "./src/telemetry.ts",
|
|
82
|
-
"browser": "./src/telemetry.ts",
|
|
83
98
|
"source": "./src/telemetry.ts",
|
|
99
|
+
"bun": "./src/telemetry.ts",
|
|
100
|
+
"types": "./dist/telemetry.d.ts",
|
|
101
|
+
"browser": "./dist/telemetry.js",
|
|
84
102
|
"import": "./dist/telemetry.js"
|
|
85
103
|
},
|
|
86
|
-
"./
|
|
104
|
+
"./http": {
|
|
105
|
+
"source": "./src/http.ts",
|
|
106
|
+
"bun": "./src/http.ts",
|
|
107
|
+
"types": "./dist/http.d.ts",
|
|
108
|
+
"browser": "./dist/http.js",
|
|
109
|
+
"import": "./dist/http.js"
|
|
110
|
+
}
|
|
87
111
|
},
|
|
88
112
|
"publishConfig": {
|
|
89
113
|
"access": "public"
|
|
90
114
|
},
|
|
91
115
|
"dependencies": {
|
|
92
|
-
"@
|
|
93
|
-
"@syntropika/tembra-engine-
|
|
116
|
+
"@bytecodealliance/jco-transpile": "0.23.0",
|
|
117
|
+
"@syntropika/tembra-engine-node": "0.3.0",
|
|
118
|
+
"@syntropika/tembra-engine-wasm": "0.3.0",
|
|
94
119
|
"enhanced-resolve": "5.26.0",
|
|
95
|
-
"
|
|
120
|
+
"eventsource-parser": "4.1.3",
|
|
121
|
+
"typescript": "5.9.3",
|
|
122
|
+
"ufo": "1.6.4"
|
|
96
123
|
},
|
|
97
124
|
"optionalDependencies": {
|
|
98
125
|
"@msgpack/msgpack": "3.1.3"
|
|
@@ -180,7 +180,7 @@ export class Declaration {
|
|
|
180
180
|
this.check();
|
|
181
181
|
if (!this.session.kernel.features.hooks) refuse(Errors.Invalid.HooksDisabled);
|
|
182
182
|
if (!this.environment.orb.definition.hooks?.[name]) refuse(Errors.Invalid.Hook, name);
|
|
183
|
-
const operation = this.session.kernel.command
|
|
183
|
+
const operation = this.session.kernel.command(KernelOp.Allocate);
|
|
184
184
|
return {
|
|
185
185
|
/** Require an issued context before entering the declared hook. */
|
|
186
186
|
run: (context, input) => this.session.orbs.runHook(this.environment, name, context, input),
|
package/src/authoring/types.ts
CHANGED
|
@@ -26,6 +26,7 @@ export interface Requirement {
|
|
|
26
26
|
methods?: readonly string[];
|
|
27
27
|
services?: Readonly<Record<string, readonly string[]>>;
|
|
28
28
|
hooks?: readonly string[];
|
|
29
|
+
hookSignatures?: Readonly<Record<string, string>>;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export interface HookDefinition {
|
|
@@ -56,6 +57,46 @@ export interface OrbDefinition {
|
|
|
56
57
|
contributes?: Readonly<Record<string, Readonly<Record<string, Contribution>>>>;
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
export interface OrbProvider {
|
|
61
|
+
orb: string;
|
|
62
|
+
apiVersion: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Per-Orb access to providers registered by the host. An import alone grants nothing. */
|
|
66
|
+
export interface Grants {
|
|
67
|
+
filesystem?: readonly { provider: string; mount: string; writable: boolean }[];
|
|
68
|
+
network?: readonly {
|
|
69
|
+
provider: string;
|
|
70
|
+
connect?: readonly string[];
|
|
71
|
+
listen?: readonly string[];
|
|
72
|
+
bind?: readonly string[];
|
|
73
|
+
datagrams?: readonly string[];
|
|
74
|
+
resolve?: boolean;
|
|
75
|
+
}[];
|
|
76
|
+
http?: readonly { provider: string; origins: readonly string[] }[];
|
|
77
|
+
system?: readonly ("clocks" | "random" | "cli")[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface LoadOptions {
|
|
81
|
+
requires?: Readonly<Record<string, OrbProvider>>;
|
|
82
|
+
grants?: Grants;
|
|
83
|
+
cli?: CliOptions;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Host-selected standard CLI data. Files refer to the native host, never the Orb filesystem. */
|
|
87
|
+
export interface CliOptions {
|
|
88
|
+
arguments?: readonly string[];
|
|
89
|
+
environment?: readonly (readonly [string, string])[];
|
|
90
|
+
initialCwd?: string;
|
|
91
|
+
stdin?: "empty" | { readonly bytes: Uint8Array } | { readonly file: string };
|
|
92
|
+
stdout?: "discard" | { readonly file: string };
|
|
93
|
+
stderr?: "discard" | { readonly file: string };
|
|
94
|
+
}
|
|
95
|
+
export interface OrbArtifact extends LoadOptions {
|
|
96
|
+
artifact: Uint8Array;
|
|
97
|
+
}
|
|
98
|
+
export type OrbInput = OrbDefinition | OrbArtifact;
|
|
99
|
+
|
|
59
100
|
export interface ResourceOptions<T> {
|
|
60
101
|
version?: number;
|
|
61
102
|
exclusive?: boolean;
|
|
@@ -193,7 +234,10 @@ export interface NativeAdapter {
|
|
|
193
234
|
/** Check whether Rust owns a managed hook participant. */
|
|
194
235
|
hasContribution?(operation: number): boolean;
|
|
195
236
|
|
|
196
|
-
/**
|
|
237
|
+
/**
|
|
238
|
+
* Execute a native hook participant while retaining its physical lifetime. `input` is in the
|
|
239
|
+
* JavaScript domain form, as for `invoke`.
|
|
240
|
+
*/
|
|
197
241
|
contribute?(operation: number, context: Context, input: unknown): Promise<unknown>;
|
|
198
242
|
|
|
199
243
|
/** Check whether Rust owns this orb implementation. */
|
|
@@ -208,7 +252,13 @@ export interface NativeAdapter {
|
|
|
208
252
|
principal: string,
|
|
209
253
|
): Promise<void>;
|
|
210
254
|
|
|
211
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* Execute an admitted call in Rust. `arguments_` are in the JavaScript domain form on every
|
|
257
|
+
* route (an application call, a WIT import of an isolated Orb, a hook): WIT `u64`/`s64` values
|
|
258
|
+
* are `bigint`, never the executor wire's decimal strings, and the result follows the same form.
|
|
259
|
+
* An adapter bridging to the Rust kernel converts to and from its exact numeric JSON values
|
|
260
|
+
* with the WIT signature; no adapter implementation ships with the SDK.
|
|
261
|
+
*/
|
|
212
262
|
invoke(
|
|
213
263
|
invocation: Invocation,
|
|
214
264
|
arguments_: readonly unknown[],
|
|
@@ -238,7 +288,7 @@ export interface HostOptions {
|
|
|
238
288
|
principal?: string;
|
|
239
289
|
kernel: KernelPort;
|
|
240
290
|
serialization?: Codec;
|
|
241
|
-
load?: (location: string | URL) => Promise<
|
|
291
|
+
load?: (location: string | URL, options?: LoadOptions) => Promise<OrbInput>;
|
|
242
292
|
|
|
243
293
|
/** Receives adapter and observer failures; throwing from this callback cannot interrupt dispatch. */
|
|
244
294
|
onError?: (error: Error) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Context } from "../runtime/context.ts";
|
|
2
|
+
import type { Completion } from "./types.ts";
|
|
3
|
+
|
|
4
|
+
/** Check managed method implementations against the official generated WIT namespace. */
|
|
5
|
+
export type WitMethods<Interface, Environment> = {
|
|
6
|
+
[
|
|
7
|
+
Method in keyof Interface as Interface[Method] extends (...args: any[]) => any ? Method : never
|
|
8
|
+
]: Interface[Method] extends (...args: infer Arguments) => infer Result
|
|
9
|
+
? (
|
|
10
|
+
environment: Environment,
|
|
11
|
+
context: Context,
|
|
12
|
+
...args: Arguments
|
|
13
|
+
) => Completion<Awaited<Result>>
|
|
14
|
+
: never;
|
|
15
|
+
};
|