@syntropika/tembra-sdk 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/README.md +47 -2
- package/dist/authoring/declaration.d.ts +48 -0
- package/dist/authoring/hooks.d.ts +11 -0
- package/dist/authoring/orb.d.ts +3 -0
- package/dist/authoring/service-identities.d.ts +7 -0
- package/dist/authoring/services.d.ts +8 -0
- package/dist/authoring/types.d.ts +181 -0
- package/dist/bridge/identifiers.d.ts +207 -0
- package/dist/bridge/kernel.d.ts +117 -0
- package/dist/bridge/protocol.d.ts +181 -0
- package/dist/browser.d.ts +21 -0
- package/dist/browser.js +3335 -0
- package/dist/codec.d.ts +1 -0
- package/dist/codecs/json.d.ts +13 -0
- package/dist/codecs/msgpack.d.ts +3 -0
- package/dist/context-key.d.ts +35 -0
- package/dist/coordinator.d.ts +1 -0
- package/dist/coordinator.js +543 -0
- package/dist/embedded.d.ts +1 -0
- package/dist/embedded.js +1 -0
- package/dist/error.d.ts +13 -0
- package/dist/errors.d.ts +122 -0
- package/dist/hooks.d.ts +1 -0
- package/dist/host.d.ts +98 -0
- package/dist/host.js +3278 -0
- package/dist/identifiers.d.ts +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +864 -0
- package/dist/infrastructure/coordinator.d.ts +13 -0
- package/dist/infrastructure/manager.d.ts +23 -0
- package/dist/infrastructure/rpc/channel.d.ts +55 -0
- package/dist/infrastructure/rpc/client.d.ts +20 -0
- package/dist/infrastructure/rpc/server.d.ts +10 -0
- package/dist/infrastructure/rpc/state.d.ts +16 -0
- package/dist/kernel.d.ts +1 -0
- package/dist/manager.d.ts +1 -0
- package/dist/manager.js +390 -0
- package/dist/msgpack.d.ts +1 -0
- package/dist/msgpack.js +635 -0
- package/dist/node.d.ts +14 -0
- package/dist/node.js +3336 -0
- package/dist/orb.d.ts +1 -0
- package/dist/protocol.d.ts +1 -0
- package/dist/rpc.d.ts +3 -0
- package/dist/rpc.js +1091 -0
- package/dist/runtime/activities.d.ts +30 -0
- package/dist/runtime/calls.d.ts +22 -0
- package/dist/runtime/context.d.ts +38 -0
- package/dist/runtime/declaration.d.ts +1 -0
- package/dist/runtime/lifecycle.d.ts +28 -0
- package/dist/runtime/orbs.d.ts +39 -0
- package/dist/runtime/programs.d.ts +31 -0
- package/dist/runtime/records.d.ts +107 -0
- package/dist/runtime/references.d.ts +38 -0
- package/dist/runtime/reload.d.ts +17 -0
- package/dist/runtime/resources.d.ts +24 -0
- package/dist/runtime/scopes.d.ts +35 -0
- package/dist/runtime/session.d.ts +69 -0
- package/dist/state/binding.d.ts +28 -0
- package/dist/state/selection.d.ts +21 -0
- package/dist/state/types.d.ts +35 -0
- package/dist/state.d.ts +2 -0
- package/dist/telemetry.d.ts +23 -0
- package/dist/telemetry.js +27 -0
- package/dist/tooling/build.d.ts +3 -0
- package/dist/tooling/index.d.ts +2 -0
- package/dist/tooling/index.js +181 -0
- package/dist/tooling/resolver.d.ts +5 -0
- package/dist/tooling/typecheck.d.ts +2 -0
- package/dist/tooling/types.d.ts +29 -0
- package/dist/types.d.ts +1 -0
- package/dist/values.d.ts +23 -0
- package/package.json +103 -4
- package/src/authoring/declaration.ts +237 -0
- package/src/authoring/hooks.ts +101 -0
- package/src/authoring/orb.ts +88 -0
- package/src/authoring/service-identities.ts +20 -0
- package/src/authoring/services.ts +46 -0
- package/src/authoring/types.ts +256 -0
- package/src/bridge/identifiers.ts +212 -0
- package/src/bridge/kernel.ts +117 -0
- package/src/bridge/protocol.ts +193 -0
- package/src/browser.ts +59 -0
- package/src/codec.ts +1 -0
- package/src/codecs/json.ts +147 -0
- package/src/codecs/msgpack.ts +26 -0
- package/src/context-key.ts +94 -0
- package/src/coordinator.ts +1 -0
- package/src/embedded.ts +293 -0
- package/src/error.ts +50 -0
- package/src/errors.ts +237 -0
- package/src/hooks.ts +1 -0
- package/src/host.ts +173 -0
- package/src/identifiers.ts +1 -0
- package/src/index.ts +22 -0
- package/src/infrastructure/coordinator.ts +76 -0
- package/src/infrastructure/manager.ts +77 -0
- package/src/infrastructure/rpc/channel.ts +107 -0
- package/src/infrastructure/rpc/client.ts +216 -0
- package/src/infrastructure/rpc/server.ts +201 -0
- package/src/infrastructure/rpc/state.ts +70 -0
- package/src/kernel.ts +1 -0
- package/src/manager.ts +1 -0
- package/src/msgpack.ts +1 -0
- package/src/node.ts +53 -0
- package/src/orb.ts +1 -0
- package/src/protocol.ts +1 -0
- package/src/rpc.ts +3 -0
- package/src/runtime/activities.ts +197 -0
- package/src/runtime/calls.ts +165 -0
- package/src/runtime/context.ts +128 -0
- package/src/runtime/declaration.ts +1 -0
- package/src/runtime/lifecycle.ts +227 -0
- package/src/runtime/orbs.ts +292 -0
- package/src/runtime/programs.ts +274 -0
- package/src/runtime/records.ts +127 -0
- package/src/runtime/references.ts +406 -0
- package/src/runtime/reload.ts +161 -0
- package/src/runtime/resources.ts +157 -0
- package/src/runtime/scopes.ts +210 -0
- package/src/runtime/session.ts +181 -0
- package/src/state/binding.ts +157 -0
- package/src/state/selection.ts +122 -0
- package/src/state/types.ts +47 -0
- package/src/state.ts +2 -0
- package/src/telemetry.ts +45 -0
- package/src/tooling/build.ts +83 -0
- package/src/tooling/index.ts +8 -0
- package/src/tooling/resolver.ts +95 -0
- package/src/tooling/typecheck.ts +32 -0
- package/src/tooling/types.ts +32 -0
- package/src/types.ts +1 -0
- package/src/values.ts +85 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/** Named public options and built-in failures. Values remain stable on the wire. */
|
|
2
|
+
type ValueOf<T> = T[keyof T];
|
|
3
|
+
export declare const Code: Readonly<{
|
|
4
|
+
readonly Invalid: "invalid";
|
|
5
|
+
readonly Unavailable: "unavailable";
|
|
6
|
+
readonly Released: "released";
|
|
7
|
+
readonly Gone: "gone";
|
|
8
|
+
readonly Expired: "expired";
|
|
9
|
+
readonly Cancelled: "cancelled";
|
|
10
|
+
readonly Forbidden: "forbidden";
|
|
11
|
+
readonly Conflict: "conflict";
|
|
12
|
+
readonly Unsupported: "unsupported";
|
|
13
|
+
readonly Closed: "closed";
|
|
14
|
+
readonly Exhausted: "exhausted";
|
|
15
|
+
}>;
|
|
16
|
+
export type Code = ValueOf<typeof Code>;
|
|
17
|
+
export declare const Reason: Readonly<{
|
|
18
|
+
readonly ActivationBusy: "activation_busy";
|
|
19
|
+
readonly Address: "address";
|
|
20
|
+
readonly AlreadyCommitted: "already_committed";
|
|
21
|
+
readonly AmbiguousScope: "ambiguous_scope";
|
|
22
|
+
readonly ApiVersion: "api_version";
|
|
23
|
+
readonly Arguments: "arguments";
|
|
24
|
+
readonly AsyncFactory: "async_factory";
|
|
25
|
+
readonly AsyncState: "async_state";
|
|
26
|
+
readonly Bigint: "bigint";
|
|
27
|
+
readonly ByteResult: "byte_result";
|
|
28
|
+
readonly Call: "call";
|
|
29
|
+
readonly Callback: "callback";
|
|
30
|
+
readonly CleanupBusy: "cleanup_busy";
|
|
31
|
+
readonly Clock: "clock";
|
|
32
|
+
readonly Codec: "codec";
|
|
33
|
+
readonly Connection: "connection";
|
|
34
|
+
readonly Context: "context";
|
|
35
|
+
readonly Contribution: "contribution";
|
|
36
|
+
readonly CoordinationLimits: "coordination_limits";
|
|
37
|
+
readonly Deadline: "deadline";
|
|
38
|
+
readonly Dependency: "dependency";
|
|
39
|
+
readonly DependencyCycle: "dependency_cycle";
|
|
40
|
+
readonly DependencyService: "dependency_service";
|
|
41
|
+
readonly Disposing: "disposing";
|
|
42
|
+
readonly Driver: "driver";
|
|
43
|
+
readonly Duplicate: "duplicate";
|
|
44
|
+
readonly DuplicateContribution: "duplicate_contribution";
|
|
45
|
+
readonly DuplicateListener: "duplicate_listener";
|
|
46
|
+
readonly DuplicateResource: "duplicate_resource";
|
|
47
|
+
readonly DuplicateService: "duplicate_service";
|
|
48
|
+
readonly EffectResults: "effect_results";
|
|
49
|
+
readonly EffectsRunning: "effects_running";
|
|
50
|
+
readonly EngineEffect: "engine_effect";
|
|
51
|
+
readonly EventSource: "event_source";
|
|
52
|
+
readonly ExclusiveDependent: "exclusive_dependent";
|
|
53
|
+
readonly Executor: "executor";
|
|
54
|
+
readonly Orb: "orb";
|
|
55
|
+
readonly OrbGone: "orb_gone";
|
|
56
|
+
readonly OrbInstalled: "orb_installed";
|
|
57
|
+
readonly OrbScope: "orb_scope";
|
|
58
|
+
readonly Factory: "factory";
|
|
59
|
+
readonly FactoryExpired: "factory_expired";
|
|
60
|
+
readonly FrameSize: "frame_size";
|
|
61
|
+
readonly GateBusy: "gate_busy";
|
|
62
|
+
readonly GateOrb: "gate_orb";
|
|
63
|
+
readonly GateObject: "gate_object";
|
|
64
|
+
readonly Hook: "hook";
|
|
65
|
+
readonly HookDependency: "hook_dependency";
|
|
66
|
+
readonly Hooks: "hooks";
|
|
67
|
+
readonly HooksDisabled: "hooks_disabled";
|
|
68
|
+
readonly Host: "host";
|
|
69
|
+
readonly HostAddress: "host_address";
|
|
70
|
+
readonly HostResource: "host_resource";
|
|
71
|
+
readonly HostResourceReload: "host_resource_reload";
|
|
72
|
+
readonly Identities: "identities";
|
|
73
|
+
readonly Implementation: "implementation";
|
|
74
|
+
readonly Invocation: "invocation";
|
|
75
|
+
readonly Javascript: "javascript";
|
|
76
|
+
readonly JsonAccessor: "json_accessor";
|
|
77
|
+
readonly JsonCycle: "json_cycle";
|
|
78
|
+
readonly JsonNumber: "json_number";
|
|
79
|
+
readonly JsonSymbol: "json_symbol";
|
|
80
|
+
readonly JsonTag: "json_tag";
|
|
81
|
+
readonly JsonType: "json_type";
|
|
82
|
+
readonly JsonValue: "json_value";
|
|
83
|
+
readonly Lifetime: "lifetime";
|
|
84
|
+
readonly Linger: "linger";
|
|
85
|
+
readonly ListenerCallback: "listener_callback";
|
|
86
|
+
readonly LiveConsumer: "live_consumer";
|
|
87
|
+
readonly LiveReference: "live_reference";
|
|
88
|
+
readonly LocalValue: "local_value";
|
|
89
|
+
readonly Memory: "memory";
|
|
90
|
+
readonly Metadata: "metadata";
|
|
91
|
+
readonly MetadataSize: "metadata_size";
|
|
92
|
+
readonly Method: "method";
|
|
93
|
+
readonly MigrationGate: "migration_gate";
|
|
94
|
+
readonly MigrationRequired: "migration_required";
|
|
95
|
+
readonly MigrationValue: "migration_value";
|
|
96
|
+
readonly MissingHook: "missing_hook";
|
|
97
|
+
readonly MissingMethod: "missing_method";
|
|
98
|
+
readonly NativeEffect: "native_effect";
|
|
99
|
+
readonly NativeMethod: "native_method";
|
|
100
|
+
readonly NativeObject: "native_object";
|
|
101
|
+
readonly NativeService: "native_service";
|
|
102
|
+
readonly Next: "next";
|
|
103
|
+
readonly NextUsed: "next_used";
|
|
104
|
+
readonly NotReady: "not_ready";
|
|
105
|
+
readonly Object: "object";
|
|
106
|
+
readonly ObjectState: "object_state";
|
|
107
|
+
readonly ObservationSource: "observation_source";
|
|
108
|
+
readonly ObservationAdmitted: "observation_admitted";
|
|
109
|
+
readonly Opaque: "opaque";
|
|
110
|
+
readonly Operation: "operation";
|
|
111
|
+
readonly OperationOwner: "operation_owner";
|
|
112
|
+
readonly Owner: "owner";
|
|
113
|
+
readonly Payload: "payload";
|
|
114
|
+
readonly PendingRequests: "pending_requests";
|
|
115
|
+
readonly PrepareDeadline: "prepare_deadline";
|
|
116
|
+
readonly Priority: "priority";
|
|
117
|
+
readonly Program: "program";
|
|
118
|
+
readonly ProgramPhase: "program_phase";
|
|
119
|
+
readonly ProgramRunning: "program_running";
|
|
120
|
+
readonly Reference: "reference";
|
|
121
|
+
readonly ReloadAborted: "reload_aborted";
|
|
122
|
+
readonly ReloadDeadline: "reload_deadline";
|
|
123
|
+
readonly ReloadPreparing: "reload_preparing";
|
|
124
|
+
readonly ReloadRunning: "reload_running";
|
|
125
|
+
readonly ReloadTicket: "reload_ticket";
|
|
126
|
+
readonly RemoteOpaque: "remote_opaque";
|
|
127
|
+
readonly RemoteReferences: "remote_references";
|
|
128
|
+
readonly Request: "request";
|
|
129
|
+
readonly RequestIds: "request_ids";
|
|
130
|
+
readonly Requires: "requires";
|
|
131
|
+
readonly Resource: "resource";
|
|
132
|
+
readonly ResourceDependencies: "resource_dependencies";
|
|
133
|
+
readonly ResourceDependency: "resource_dependency";
|
|
134
|
+
readonly ResourceHost: "resource_host";
|
|
135
|
+
readonly ResourceInFactory: "resource_in_factory";
|
|
136
|
+
readonly ResourceState: "resource_state";
|
|
137
|
+
readonly ResourceVersion: "resource_version";
|
|
138
|
+
readonly Result: "result";
|
|
139
|
+
readonly RetainedVersions: "retained_versions";
|
|
140
|
+
readonly RevisionExhausted: "revision_exhausted";
|
|
141
|
+
readonly Root: "root";
|
|
142
|
+
readonly Route: "route";
|
|
143
|
+
readonly RpcFrame: "rpc_frame";
|
|
144
|
+
readonly RpcOperation: "rpc_operation";
|
|
145
|
+
readonly RpcRequest: "rpc_request";
|
|
146
|
+
readonly RustType: "rust_type";
|
|
147
|
+
readonly Scope: "scope";
|
|
148
|
+
readonly ScopeClosed: "scope_closed";
|
|
149
|
+
readonly ScopeOrb: "scope_orb";
|
|
150
|
+
readonly ScopeOwner: "scope_owner";
|
|
151
|
+
readonly ScopeResource: "scope_resource";
|
|
152
|
+
readonly Serialization: "serialization";
|
|
153
|
+
readonly Service: "service";
|
|
154
|
+
readonly ServiceGone: "service_gone";
|
|
155
|
+
readonly State: "state";
|
|
156
|
+
readonly StateCycle: "state_cycle";
|
|
157
|
+
readonly StateInitialized: "state_initialized";
|
|
158
|
+
readonly StateOwner: "state_owner";
|
|
159
|
+
readonly StateRevision: "state_revision";
|
|
160
|
+
readonly StateValidation: "state_validation";
|
|
161
|
+
readonly StateValue: "state_value";
|
|
162
|
+
readonly StateVersion: "state_version";
|
|
163
|
+
readonly Subscription: "subscription";
|
|
164
|
+
readonly SubscriptionBusy: "subscription_busy";
|
|
165
|
+
readonly SubscriptionIdle: "subscription_idle";
|
|
166
|
+
readonly SubscriptionQueue: "subscription_queue";
|
|
167
|
+
readonly SubscriptionSize: "subscription_size";
|
|
168
|
+
readonly SubscriptionsDisabled: "subscriptions_disabled";
|
|
169
|
+
readonly Superseded: "superseded";
|
|
170
|
+
readonly Task: "task";
|
|
171
|
+
readonly Telemetry: "telemetry";
|
|
172
|
+
readonly UndeclaredDependency: "undeclared_dependency";
|
|
173
|
+
readonly UndeclaredService: "undeclared_service";
|
|
174
|
+
readonly UnknownService: "unknown_service";
|
|
175
|
+
readonly UpgradeConflict: "upgrade_conflict";
|
|
176
|
+
readonly Utf8: "utf8";
|
|
177
|
+
readonly Value: "value";
|
|
178
|
+
readonly ValueGone: "value_gone";
|
|
179
|
+
readonly ValuesExhausted: "values_exhausted";
|
|
180
|
+
readonly Views: "views";
|
|
181
|
+
}>;
|
|
182
|
+
export type Reason = ValueOf<typeof Reason>;
|
|
183
|
+
export declare const Lifetime: Readonly<{
|
|
184
|
+
readonly Referenced: "referenced";
|
|
185
|
+
readonly Host: "host";
|
|
186
|
+
}>;
|
|
187
|
+
export type Lifetime = ValueOf<typeof Lifetime>;
|
|
188
|
+
export declare const Status: Readonly<{
|
|
189
|
+
readonly Loading: "loading";
|
|
190
|
+
readonly Live: "live";
|
|
191
|
+
readonly Released: "released";
|
|
192
|
+
readonly Gone: "gone";
|
|
193
|
+
}>;
|
|
194
|
+
export type Status = ValueOf<typeof Status>;
|
|
195
|
+
export declare const ReloadStatus: Readonly<{
|
|
196
|
+
readonly Prepared: "prepared";
|
|
197
|
+
readonly Committed: "committed";
|
|
198
|
+
readonly Aborted: "aborted";
|
|
199
|
+
}>;
|
|
200
|
+
export type ReloadStatus = ValueOf<typeof ReloadStatus>;
|
|
201
|
+
export declare const HookCapability: Readonly<{
|
|
202
|
+
readonly Observe: "observe";
|
|
203
|
+
readonly Transform: "transform";
|
|
204
|
+
readonly Decide: "decide";
|
|
205
|
+
}>;
|
|
206
|
+
export type HookCapability = ValueOf<typeof HookCapability>;
|
|
207
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Code, Lifetime } from "./identifiers.ts";
|
|
2
|
+
import { ActionType, EffectType, KernelOp, OwnerKind } from "./protocol.ts";
|
|
3
|
+
/** Implemented by Node-API, browser WASM, and embedded V8's native binding. */
|
|
4
|
+
export interface KernelPort {
|
|
5
|
+
/** Exchange one JSON metadata request with the Rust kernel. */
|
|
6
|
+
request(metadata: string): string;
|
|
7
|
+
/** Release the platform binding after host shutdown. */
|
|
8
|
+
free?(): void;
|
|
9
|
+
}
|
|
10
|
+
export interface KernelFeatures {
|
|
11
|
+
hooks: boolean;
|
|
12
|
+
subscriptions: boolean;
|
|
13
|
+
views: boolean;
|
|
14
|
+
telemetry: boolean;
|
|
15
|
+
}
|
|
16
|
+
export type Owner = {
|
|
17
|
+
kind: typeof OwnerKind.Host;
|
|
18
|
+
} | {
|
|
19
|
+
kind: typeof OwnerKind.Orb | typeof OwnerKind.Object;
|
|
20
|
+
id: number;
|
|
21
|
+
};
|
|
22
|
+
export interface KernelOrb {
|
|
23
|
+
id: number;
|
|
24
|
+
owner: number;
|
|
25
|
+
codeVersion: number;
|
|
26
|
+
name: string;
|
|
27
|
+
apiVersion: number;
|
|
28
|
+
services: {
|
|
29
|
+
name: string;
|
|
30
|
+
methods: string[];
|
|
31
|
+
lifetime: Lifetime;
|
|
32
|
+
linger: number;
|
|
33
|
+
}[];
|
|
34
|
+
hooks: string[];
|
|
35
|
+
requires: {
|
|
36
|
+
orb: string;
|
|
37
|
+
apiVersion: number;
|
|
38
|
+
services: Record<string, string[]>;
|
|
39
|
+
hooks: string[];
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
export interface Acquisition {
|
|
43
|
+
reference: number;
|
|
44
|
+
object: number;
|
|
45
|
+
orb: number;
|
|
46
|
+
codeVersion: number;
|
|
47
|
+
activate: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface Invocation {
|
|
50
|
+
id: number;
|
|
51
|
+
root: number;
|
|
52
|
+
object: number;
|
|
53
|
+
orb: number;
|
|
54
|
+
codeVersion: number;
|
|
55
|
+
method: string;
|
|
56
|
+
}
|
|
57
|
+
export interface HookObservation {
|
|
58
|
+
invocation: Invocation;
|
|
59
|
+
plan: number[];
|
|
60
|
+
}
|
|
61
|
+
export interface Snapshot {
|
|
62
|
+
value: number;
|
|
63
|
+
revision: string;
|
|
64
|
+
version: number;
|
|
65
|
+
}
|
|
66
|
+
export interface Reload {
|
|
67
|
+
id: number;
|
|
68
|
+
codeVersion: number;
|
|
69
|
+
orbs: KernelOrb[];
|
|
70
|
+
objects: number[];
|
|
71
|
+
providers: Record<string, number>;
|
|
72
|
+
}
|
|
73
|
+
export interface Effect {
|
|
74
|
+
type: EffectType;
|
|
75
|
+
scope?: number;
|
|
76
|
+
previous?: number | null;
|
|
77
|
+
resource?: number;
|
|
78
|
+
value?: number | null;
|
|
79
|
+
version?: number;
|
|
80
|
+
keepListeners?: boolean;
|
|
81
|
+
replacements?: {
|
|
82
|
+
previous: number | null;
|
|
83
|
+
next: number | null;
|
|
84
|
+
}[];
|
|
85
|
+
}
|
|
86
|
+
export interface Action {
|
|
87
|
+
type: ActionType;
|
|
88
|
+
id: number;
|
|
89
|
+
revision?: string;
|
|
90
|
+
effects?: Effect[];
|
|
91
|
+
payload?: number;
|
|
92
|
+
operation?: number;
|
|
93
|
+
error?: {
|
|
94
|
+
code: Code;
|
|
95
|
+
reason: string;
|
|
96
|
+
message: string;
|
|
97
|
+
} | null;
|
|
98
|
+
}
|
|
99
|
+
export interface Diagnostics {
|
|
100
|
+
objects: number;
|
|
101
|
+
references: number;
|
|
102
|
+
roots: number;
|
|
103
|
+
calls: number;
|
|
104
|
+
resources: number;
|
|
105
|
+
tasks: number;
|
|
106
|
+
orbs: number;
|
|
107
|
+
closing: boolean;
|
|
108
|
+
codeVersion: number;
|
|
109
|
+
}
|
|
110
|
+
export declare class Kernel {
|
|
111
|
+
readonly port: KernelPort;
|
|
112
|
+
readonly features: KernelFeatures;
|
|
113
|
+
/** Read the capabilities of the supplied kernel binding. */
|
|
114
|
+
constructor(port: KernelPort);
|
|
115
|
+
/** Decode a kernel result or raise its structured error. */
|
|
116
|
+
command<T = null>(op: KernelOp, fields?: Record<string, unknown>): T;
|
|
117
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/** Closed adapter vocabulary. Strings are retained only as the wire representation. */
|
|
2
|
+
type ValueOf<T> = T[keyof T];
|
|
3
|
+
export declare const KernelOp: Readonly<{
|
|
4
|
+
readonly ContextDerive: "context-derive";
|
|
5
|
+
readonly ContextValue: "context-value";
|
|
6
|
+
readonly ContextStats: "context-stats";
|
|
7
|
+
readonly Allocate: "allocate";
|
|
8
|
+
readonly ScopeRegister: "scope-register";
|
|
9
|
+
readonly ScopeExists: "scope-exists";
|
|
10
|
+
readonly ScopesForOwner: "scopes-for-owner";
|
|
11
|
+
readonly ScopesForOrb: "scopes-for-orb";
|
|
12
|
+
readonly ScopeAddResource: "scope-add-resource";
|
|
13
|
+
readonly ScopeActivate: "scope-activate";
|
|
14
|
+
readonly ScopesCleanup: "scopes-cleanup";
|
|
15
|
+
readonly ScopesReloadRegistered: "scopes-reload-registered";
|
|
16
|
+
readonly ScopesReload: "scopes-reload";
|
|
17
|
+
readonly ProgramRun: "program-run";
|
|
18
|
+
readonly ProgramNext: "program-next";
|
|
19
|
+
readonly ProgramCompleteStep: "program-complete-step";
|
|
20
|
+
readonly ProgramCommit: "program-commit";
|
|
21
|
+
readonly ProgramAbort: "program-abort";
|
|
22
|
+
readonly ProgramForget: "program-forget";
|
|
23
|
+
readonly Features: "features";
|
|
24
|
+
readonly Prepare: "prepare";
|
|
25
|
+
readonly Gate: "gate";
|
|
26
|
+
readonly GateOrbs: "gate-orbs";
|
|
27
|
+
readonly Commit: "commit";
|
|
28
|
+
readonly Abort: "abort";
|
|
29
|
+
readonly Orbs: "orbs";
|
|
30
|
+
readonly Orb: "orb";
|
|
31
|
+
readonly OrbNamed: "orb-named";
|
|
32
|
+
readonly NextDeadline: "next-deadline";
|
|
33
|
+
readonly Address: "address";
|
|
34
|
+
readonly Acquire: "acquire";
|
|
35
|
+
readonly Ready: "ready";
|
|
36
|
+
readonly Dependency: "dependency";
|
|
37
|
+
readonly Undepend: "undepend";
|
|
38
|
+
readonly Fail: "fail";
|
|
39
|
+
readonly Status: "status";
|
|
40
|
+
readonly Release: "release";
|
|
41
|
+
readonly Forget: "forget";
|
|
42
|
+
readonly Root: "root";
|
|
43
|
+
readonly CleanupRoot: "cleanup-root";
|
|
44
|
+
readonly RootPrincipal: "root-principal";
|
|
45
|
+
readonly CheckContext: "check-context";
|
|
46
|
+
readonly CheckRoot: "check-root";
|
|
47
|
+
readonly EndRoot: "end-root";
|
|
48
|
+
readonly CancelRoot: "cancel-root";
|
|
49
|
+
readonly BeginCall: "begin-call";
|
|
50
|
+
readonly BeginOperation: "begin-operation";
|
|
51
|
+
readonly BeginHookObservation: "begin-hook-observation";
|
|
52
|
+
readonly FinishCall: "finish-call";
|
|
53
|
+
readonly Invocation: "invocation";
|
|
54
|
+
readonly StateInit: "state-init";
|
|
55
|
+
readonly Snapshot: "snapshot";
|
|
56
|
+
readonly StateAdopt: "state-adopt";
|
|
57
|
+
readonly Task: "task";
|
|
58
|
+
readonly TaskRoot: "task-root";
|
|
59
|
+
readonly StopTask: "stop-task";
|
|
60
|
+
readonly FinishTask: "finish-task";
|
|
61
|
+
readonly Resource: "resource";
|
|
62
|
+
readonly ResourceOpened: "resource-opened";
|
|
63
|
+
readonly ResourceValue: "resource-value";
|
|
64
|
+
readonly CloseResource: "close-resource";
|
|
65
|
+
readonly ResourceClosed: "resource-closed";
|
|
66
|
+
readonly Disposed: "disposed";
|
|
67
|
+
readonly Tick: "tick";
|
|
68
|
+
readonly NextWake: "next-wake";
|
|
69
|
+
readonly NextIdle: "next-idle";
|
|
70
|
+
readonly Close: "close";
|
|
71
|
+
readonly FinishClose: "finish-close";
|
|
72
|
+
readonly Diagnostics: "diagnostics";
|
|
73
|
+
readonly Drain: "drain";
|
|
74
|
+
readonly Restrict: "restrict";
|
|
75
|
+
readonly Contribute: "contribute";
|
|
76
|
+
readonly ContributionOrdinal: "contribution-ordinal";
|
|
77
|
+
readonly HookPlan: "hook-plan";
|
|
78
|
+
readonly Listen: "listen";
|
|
79
|
+
readonly Subscribe: "subscribe";
|
|
80
|
+
readonly Enqueue: "enqueue";
|
|
81
|
+
readonly NextDelivery: "next-delivery";
|
|
82
|
+
readonly FinishDelivery: "finish-delivery";
|
|
83
|
+
readonly Unsubscribe: "unsubscribe";
|
|
84
|
+
}>;
|
|
85
|
+
export type KernelOp = ValueOf<typeof KernelOp>;
|
|
86
|
+
export declare const ActionType: Readonly<{
|
|
87
|
+
readonly Execute: "execute";
|
|
88
|
+
readonly CancelEffects: "cancel-effects";
|
|
89
|
+
readonly ProgramPrepared: "program-prepared";
|
|
90
|
+
readonly ProgramComplete: "program-complete";
|
|
91
|
+
readonly Dispose: "dispose";
|
|
92
|
+
readonly CloseResource: "close-resource";
|
|
93
|
+
readonly DropValue: "drop-value";
|
|
94
|
+
readonly CancelRoot: "cancel-root";
|
|
95
|
+
readonly CancelTask: "cancel-task";
|
|
96
|
+
readonly RetireOrb: "retire-orb";
|
|
97
|
+
readonly State: "state";
|
|
98
|
+
readonly SubscriptionFailed: "subscription-failed";
|
|
99
|
+
readonly DetachSubscription: "detach-subscription";
|
|
100
|
+
readonly Deliver: "deliver";
|
|
101
|
+
}>;
|
|
102
|
+
export type ActionType = ValueOf<typeof ActionType>;
|
|
103
|
+
export declare const EffectType: Readonly<{
|
|
104
|
+
readonly Stop: "stop";
|
|
105
|
+
readonly Open: "open";
|
|
106
|
+
readonly Close: "close";
|
|
107
|
+
readonly Restore: "restore";
|
|
108
|
+
readonly Prepare: "prepare";
|
|
109
|
+
readonly Validate: "validate";
|
|
110
|
+
readonly Initialize: "initialize";
|
|
111
|
+
readonly Migrate: "migrate";
|
|
112
|
+
readonly Adopt: "adopt";
|
|
113
|
+
readonly Start: "start";
|
|
114
|
+
readonly Drop: "drop";
|
|
115
|
+
}>;
|
|
116
|
+
export type EffectType = ValueOf<typeof EffectType>;
|
|
117
|
+
export declare const StepType: Readonly<{
|
|
118
|
+
readonly Execute: "execute";
|
|
119
|
+
readonly Wait: "wait";
|
|
120
|
+
readonly Prepared: "prepared";
|
|
121
|
+
readonly Complete: "complete";
|
|
122
|
+
readonly Failed: "failed";
|
|
123
|
+
}>;
|
|
124
|
+
export type StepType = ValueOf<typeof StepType>;
|
|
125
|
+
export declare const NativeOp: Readonly<{
|
|
126
|
+
readonly Activate: "activate";
|
|
127
|
+
readonly Dispose: "dispose";
|
|
128
|
+
readonly CancelEffect: "cancel-effect";
|
|
129
|
+
readonly Effect: "effect";
|
|
130
|
+
readonly Invoke: "invoke";
|
|
131
|
+
readonly Contribute: "contribute";
|
|
132
|
+
}>;
|
|
133
|
+
export type NativeOp = ValueOf<typeof NativeOp>;
|
|
134
|
+
export declare const RpcOp: Readonly<{
|
|
135
|
+
readonly Describe: "describe";
|
|
136
|
+
readonly Get: "get";
|
|
137
|
+
readonly Release: "release";
|
|
138
|
+
readonly Call: "call";
|
|
139
|
+
readonly Cancel: "cancel";
|
|
140
|
+
}>;
|
|
141
|
+
export type RpcOp = ValueOf<typeof RpcOp>;
|
|
142
|
+
export declare const RpcEvent: Readonly<{
|
|
143
|
+
readonly State: "state";
|
|
144
|
+
}>;
|
|
145
|
+
export type RpcEvent = ValueOf<typeof RpcEvent>;
|
|
146
|
+
export declare const OwnerKind: Readonly<{
|
|
147
|
+
readonly Host: "host";
|
|
148
|
+
readonly Orb: "orb";
|
|
149
|
+
readonly Object: "object";
|
|
150
|
+
}>;
|
|
151
|
+
export type OwnerKind = ValueOf<typeof OwnerKind>;
|
|
152
|
+
export declare const EnvironmentPhase: Readonly<{
|
|
153
|
+
readonly Declaring: "declaring";
|
|
154
|
+
readonly Prepared: "prepared";
|
|
155
|
+
readonly Live: "live";
|
|
156
|
+
readonly Closed: "closed";
|
|
157
|
+
}>;
|
|
158
|
+
export type EnvironmentPhase = ValueOf<typeof EnvironmentPhase>;
|
|
159
|
+
export declare const CoordinationDecision: Readonly<{
|
|
160
|
+
readonly Preparing: "preparing";
|
|
161
|
+
readonly Commit: "commit";
|
|
162
|
+
readonly Abort: "abort";
|
|
163
|
+
}>;
|
|
164
|
+
export type CoordinationDecision = ValueOf<typeof CoordinationDecision>;
|
|
165
|
+
export declare const Outcome: Readonly<{
|
|
166
|
+
readonly Ok: "ok";
|
|
167
|
+
readonly Error: "error";
|
|
168
|
+
}>;
|
|
169
|
+
export type Outcome = ValueOf<typeof Outcome>;
|
|
170
|
+
export declare const CodecTag: Readonly<{
|
|
171
|
+
readonly Bigint: "bigint";
|
|
172
|
+
readonly Bytes: "bytes";
|
|
173
|
+
readonly Object: "object";
|
|
174
|
+
}>;
|
|
175
|
+
export type CodecTag = ValueOf<typeof CodecTag>;
|
|
176
|
+
export declare const CodecId: Readonly<{
|
|
177
|
+
readonly Json: "tembra-json/1";
|
|
178
|
+
readonly MessagePack: "tembra-msgpack/1";
|
|
179
|
+
}>;
|
|
180
|
+
export type CodecId = ValueOf<typeof CodecId>;
|
|
181
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { orb } from "./authoring/orb.ts";
|
|
2
|
+
import type { HostOptions } from "./authoring/types.ts";
|
|
3
|
+
import type { KernelPort } from "./bridge/kernel.ts";
|
|
4
|
+
import { Host } from "./host.ts";
|
|
5
|
+
export interface WasmModule {
|
|
6
|
+
WasmKernel: new () => KernelPort;
|
|
7
|
+
default?: (input?: unknown) => Promise<unknown>;
|
|
8
|
+
}
|
|
9
|
+
export type BrowserHostOptions = Omit<HostOptions, "kernel"> & {
|
|
10
|
+
kernel?: KernelPort;
|
|
11
|
+
wasm?: WasmModule | (() => Promise<WasmModule>);
|
|
12
|
+
wasmInput?: unknown;
|
|
13
|
+
baseURL?: string | URL;
|
|
14
|
+
};
|
|
15
|
+
/** Runs orbs in the browser or Worker's existing JS realm; WASM owns only kernel metadata. */
|
|
16
|
+
export declare function createHost(options?: BrowserHostOptions): Promise<Host>;
|
|
17
|
+
export { orb };
|
|
18
|
+
export type { Host };
|
|
19
|
+
export { Code, HookCapability, Lifetime, Reason, ReloadStatus, Status, } from "./bridge/identifiers.ts";
|
|
20
|
+
export { Errors, type ErrorDescriptor } from "./errors.ts";
|
|
21
|
+
export { ContextKey, ContextKind, opaqueFrom, type OpaqueContextValue } from "./context-key.ts";
|