@syntropika/tembra-sdk 0.2.2 → 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 -3332
- 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 -3310
- 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 -3321
- 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 +7 -6
- 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 +213 -90
- 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 -301
package/README.md
CHANGED
|
@@ -7,9 +7,15 @@ Orbs own their behavior and validation. Tembra manages how they work together th
|
|
|
7
7
|
lifetime through a shared Rust engine. Applications can combine Rust and TypeScript across
|
|
8
8
|
servers, browsers, Web Workers and React Native.
|
|
9
9
|
|
|
10
|
+
An orb is either trusted application code (Rust, or TypeScript in the host runtime) or a built
|
|
11
|
+
`.wasm` artifact that runs isolated in WebAssembly. Both kinds install into the same host and use
|
|
12
|
+
the same lifecycle.
|
|
13
|
+
|
|
10
14
|
## What it provides
|
|
11
15
|
|
|
12
16
|
- **Composable orbs.** Declare the services an orb provides and the dependencies it consumes.
|
|
17
|
+
- **Isolated orbs.** Build TypeScript or a compiled component against a WIT contract, then grant
|
|
18
|
+
filesystem and network access per orb at installation.
|
|
13
19
|
- **Consistent state.** Validate changes before publishing them and observe the values that matter.
|
|
14
20
|
- **Controlled updates.** Replace implementations and migrate state while respecting active work.
|
|
15
21
|
- **Shared resources.** Tie resources and tasks to the host, orb or object that owns them.
|
|
@@ -17,26 +23,46 @@ servers, browsers, Web Workers and React Native.
|
|
|
17
23
|
|
|
18
24
|
## Repository
|
|
19
25
|
|
|
20
|
-
| Directory
|
|
21
|
-
|
|
|
22
|
-
| [crates/core/](crates/core/)
|
|
23
|
-
| [crates/tembra/](crates/tembra/)
|
|
24
|
-
| [crates/bridge/](crates/bridge/)
|
|
25
|
-
| [crates/
|
|
26
|
-
| [crates/
|
|
27
|
-
| [crates/
|
|
28
|
-
| [crates/
|
|
29
|
-
| [
|
|
30
|
-
| [
|
|
31
|
-
| [
|
|
32
|
-
| [packages/
|
|
33
|
-
| [packages/
|
|
34
|
-
| [packages/ts/
|
|
35
|
-
| [packages/
|
|
36
|
-
| [
|
|
26
|
+
| Directory | Contents |
|
|
27
|
+
| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| [crates/core/](crates/core/) | Shared Rust engine for ownership, state revisions and orb updates |
|
|
29
|
+
| [crates/tembra/](crates/tembra/) | Single Rust facade for native and isolated Wasm orbs |
|
|
30
|
+
| [crates/bridge/](crates/bridge/) | Communication between the engine and its platform integrations |
|
|
31
|
+
| [crates/contracts/](crates/contracts/) | WIT contracts, orb artifacts and installation grants |
|
|
32
|
+
| [crates/executor-wasm/](crates/executor-wasm/) | Runs orb artifacts in Wasmtime for Rust hosts |
|
|
33
|
+
| [crates/node-binding/](crates/node-binding/) | Connects Node.js to the Rust engine |
|
|
34
|
+
| [crates/mobile/](crates/mobile/) | Shared Rust kernel bindings for Swift and Kotlin |
|
|
35
|
+
| [crates/browser-wasm/](crates/browser-wasm/) | Makes the Rust engine available in browsers and Workers |
|
|
36
|
+
| [crates/orb-macro/](crates/orb-macro/) | Derives a compiled orb's WIT contract and bindings from a Rust module |
|
|
37
|
+
| [crates/cargo-tembra/](crates/cargo-tembra/) | `cargo tembra`: builds, inspects and packages Rust orbs |
|
|
38
|
+
| [packages/ts/sdk/](packages/ts/sdk/) | TypeScript SDK and orb tooling |
|
|
39
|
+
| [packages/ts/engine-node/](packages/ts/engine-node/) | Native engine packaging and builds |
|
|
40
|
+
| [packages/ts/engine-wasm/](packages/ts/engine-wasm/) | WASM engine packaging and builds |
|
|
41
|
+
| [packages/swift/](packages/swift/) | Swift bindings for iOS and macOS |
|
|
42
|
+
| [packages/kotlin/](packages/kotlin/) | Kotlin bindings for the JVM and Android |
|
|
43
|
+
| [packages/ts/react-native/](packages/ts/react-native/) | React Native TurboModule, native packaging and mobile builds |
|
|
44
|
+
| [packages/ts/test/](packages/ts/test/) | Browser integration tests |
|
|
45
|
+
| [examples/rust/](examples/rust/) | Native orbs, identity, execution and resource lifetime |
|
|
46
|
+
| [examples/wasm-orb/](examples/wasm-orb/) | A TypeScript orb and a compiled Rust orb built from one WIT file |
|
|
47
|
+
| [examples/rust-orb-service/](examples/rust-orb-service/) | A compiled Rust orb exporting one service, written from its code and built with `cargo tembra` |
|
|
48
|
+
| [examples/rust-orb-hook-contribution/](examples/rust-orb-hook-contribution/) | A compiled Rust orb contributing to a native orb's hook, counting in a root resource |
|
|
49
|
+
| [examples/rust-orb-hook-declaration/](examples/rust-orb-hook-declaration/) | A compiled Rust orb declaring a hook, and another compiled Rust orb contributing to it |
|
|
50
|
+
| [examples/rust-orb-state/](examples/rust-orb-state/) | A compiled Rust orb whose state the kernel keeps and validates, observed and reloaded by the host |
|
|
51
|
+
| [examples/rust-orb-context/](examples/rust-orb-context/) | A compiled Rust orb reading its call's principal, its object's address and logging through the kernel |
|
|
52
|
+
| [examples/rust-orb-service-lifetime/](examples/rust-orb-service-lifetime/) | A compiled Rust orb with pinned, lingering and passing services, told apart by what survives a release |
|
|
53
|
+
| [examples/rust-orb-service-resource/](examples/rust-orb-service-resource/) | A compiled Rust orb whose service objects each own a resource that depends on the root's, opened and closed per object |
|
|
54
|
+
| [examples/rust-orb-shared-interface/](examples/rust-orb-shared-interface/) | A compiled Rust orb implementing a WIT interface shared with a native orb; the host consults both |
|
|
55
|
+
| [examples/rust-orb-import/](examples/rust-orb-import/) | A compiled Rust orb importing another compiled Rust orb's interface and calling it; the installer binds the two |
|
|
56
|
+
| [examples/rust-orb-wit-resource/](examples/rust-orb-wit-resource/) | A compiled Rust orb handing out text builders as a WIT resource, and another compiled Rust orb importing and using them |
|
|
57
|
+
| [examples/rust-orb-native/](examples/rust-orb-native/) | Two Rust orb crates implementing one WIT interface, linked into one native host that installs both through `orb()` |
|
|
37
58
|
|
|
38
59
|
## Development
|
|
39
60
|
|
|
61
|
+
The [Wasm orb example](examples/wasm-orb/README.md) builds a TypeScript orb with an npm dependency
|
|
62
|
+
and a compiled Rust provider, then installs both artifacts in a Node host. The
|
|
63
|
+
[Rust orb example](examples/rust-orb-service/README.md) writes a compiled orb from a Rust module with
|
|
64
|
+
`#[orb]` and builds its artifact with `cargo tembra`.
|
|
65
|
+
|
|
40
66
|
See the [guide](docs/README.md) for concepts and Rust and TypeScript usage.
|
|
41
67
|
See [DEVELOP.md](DEVELOP.md) for setup, tools, builds, tests and technical details.
|
|
42
68
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for code structure and documentation conventions.
|
|
@@ -22,6 +22,7 @@ export interface Requirement {
|
|
|
22
22
|
methods?: readonly string[];
|
|
23
23
|
services?: Readonly<Record<string, readonly string[]>>;
|
|
24
24
|
hooks?: readonly string[];
|
|
25
|
+
hookSignatures?: Readonly<Record<string, string>>;
|
|
25
26
|
}
|
|
26
27
|
export interface HookDefinition {
|
|
27
28
|
capabilities?: readonly string[];
|
|
@@ -43,6 +44,57 @@ export interface OrbDefinition {
|
|
|
43
44
|
hooks?: Readonly<Record<string, HookDefinition>>;
|
|
44
45
|
contributes?: Readonly<Record<string, Readonly<Record<string, Contribution>>>>;
|
|
45
46
|
}
|
|
47
|
+
export interface OrbProvider {
|
|
48
|
+
orb: string;
|
|
49
|
+
apiVersion: number;
|
|
50
|
+
}
|
|
51
|
+
/** Per-Orb access to providers registered by the host. An import alone grants nothing. */
|
|
52
|
+
export interface Grants {
|
|
53
|
+
filesystem?: readonly {
|
|
54
|
+
provider: string;
|
|
55
|
+
mount: string;
|
|
56
|
+
writable: boolean;
|
|
57
|
+
}[];
|
|
58
|
+
network?: readonly {
|
|
59
|
+
provider: string;
|
|
60
|
+
connect?: readonly string[];
|
|
61
|
+
listen?: readonly string[];
|
|
62
|
+
bind?: readonly string[];
|
|
63
|
+
datagrams?: readonly string[];
|
|
64
|
+
resolve?: boolean;
|
|
65
|
+
}[];
|
|
66
|
+
http?: readonly {
|
|
67
|
+
provider: string;
|
|
68
|
+
origins: readonly string[];
|
|
69
|
+
}[];
|
|
70
|
+
system?: readonly ("clocks" | "random" | "cli")[];
|
|
71
|
+
}
|
|
72
|
+
export interface LoadOptions {
|
|
73
|
+
requires?: Readonly<Record<string, OrbProvider>>;
|
|
74
|
+
grants?: Grants;
|
|
75
|
+
cli?: CliOptions;
|
|
76
|
+
}
|
|
77
|
+
/** Host-selected standard CLI data. Files refer to the native host, never the Orb filesystem. */
|
|
78
|
+
export interface CliOptions {
|
|
79
|
+
arguments?: readonly string[];
|
|
80
|
+
environment?: readonly (readonly [string, string])[];
|
|
81
|
+
initialCwd?: string;
|
|
82
|
+
stdin?: "empty" | {
|
|
83
|
+
readonly bytes: Uint8Array;
|
|
84
|
+
} | {
|
|
85
|
+
readonly file: string;
|
|
86
|
+
};
|
|
87
|
+
stdout?: "discard" | {
|
|
88
|
+
readonly file: string;
|
|
89
|
+
};
|
|
90
|
+
stderr?: "discard" | {
|
|
91
|
+
readonly file: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export interface OrbArtifact extends LoadOptions {
|
|
95
|
+
artifact: Uint8Array;
|
|
96
|
+
}
|
|
97
|
+
export type OrbInput = OrbDefinition | OrbArtifact;
|
|
46
98
|
export interface ResourceOptions<T> {
|
|
47
99
|
version?: number;
|
|
48
100
|
exclusive?: boolean;
|
|
@@ -136,13 +188,22 @@ export interface NativeAdapter {
|
|
|
136
188
|
notify?(action: import("../bridge/kernel.ts").Action): boolean;
|
|
137
189
|
/** Check whether Rust owns a managed hook participant. */
|
|
138
190
|
hasContribution?(operation: number): boolean;
|
|
139
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Execute a native hook participant while retaining its physical lifetime. `input` is in the
|
|
193
|
+
* JavaScript domain form, as for `invoke`.
|
|
194
|
+
*/
|
|
140
195
|
contribute?(operation: number, context: Context, input: unknown): Promise<unknown>;
|
|
141
196
|
/** Check whether Rust owns this orb implementation. */
|
|
142
197
|
hasOrb(id: number): boolean;
|
|
143
198
|
/** Declare the native object's scopes before activation. */
|
|
144
199
|
activate(object: number, orb: number, service: string, key: readonly string[], principal: string): Promise<void>;
|
|
145
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* Execute an admitted call in Rust. `arguments_` are in the JavaScript domain form on every
|
|
202
|
+
* route (an application call, a WIT import of an isolated Orb, a hook): WIT `u64`/`s64` values
|
|
203
|
+
* are `bigint`, never the executor wire's decimal strings, and the result follows the same form.
|
|
204
|
+
* An adapter bridging to the Rust kernel converts to and from its exact numeric JSON values
|
|
205
|
+
* with the WIT signature; no adapter implementation ships with the SDK.
|
|
206
|
+
*/
|
|
146
207
|
invoke(invocation: Invocation, arguments_: readonly unknown[], context: Context): Promise<unknown>;
|
|
147
208
|
/** Release native object storage after scope cleanup. */
|
|
148
209
|
dispose(object: number): Promise<void>;
|
|
@@ -162,7 +223,7 @@ export interface HostOptions {
|
|
|
162
223
|
principal?: string;
|
|
163
224
|
kernel: KernelPort;
|
|
164
225
|
serialization?: Codec;
|
|
165
|
-
load?: (location: string | URL) => Promise<
|
|
226
|
+
load?: (location: string | URL, options?: LoadOptions) => Promise<OrbInput>;
|
|
166
227
|
/** Receives adapter and observer failures; throwing from this callback cannot interrupt dispatch. */
|
|
167
228
|
onError?: (error: Error) => void;
|
|
168
229
|
/** Monotonic milliseconds from any origin; each host measures time relative to its creation. */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Context } from "../runtime/context.ts";
|
|
2
|
+
import type { Completion } from "./types.ts";
|
|
3
|
+
/** Check managed method implementations against the official generated WIT namespace. */
|
|
4
|
+
export type WitMethods<Interface, Environment> = {
|
|
5
|
+
[Method in keyof Interface as Interface[Method] extends (...args: any[]) => any ? Method : never]: Interface[Method] extends (...args: infer Arguments) => infer Result ? (environment: Environment, context: Context, ...args: Arguments) => Completion<Awaited<Result>> : never;
|
|
6
|
+
};
|