@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/dist/guest.d.ts
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/** The guest observes cancellation without receiving an EventTarget or host context identity. */
|
|
2
|
+
export interface Signal {
|
|
3
|
+
readonly aborted: boolean;
|
|
4
|
+
throwIfAborted(): void;
|
|
5
|
+
}
|
|
6
|
+
export interface Context {
|
|
7
|
+
readonly principal: string;
|
|
8
|
+
check(): void;
|
|
9
|
+
cancel(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Acquire a selected WIT Orb import by key for this context's root and principal. The host
|
|
12
|
+
* applies the installed requirement and waits for readiness; the claim ends with the root, and
|
|
13
|
+
* the reference is refused in every other root.
|
|
14
|
+
*/
|
|
15
|
+
get<Interface>(binding: string, key: string | readonly string[]): Promise<WitReference<Interface>>;
|
|
16
|
+
}
|
|
17
|
+
export interface Readable<T> {
|
|
18
|
+
readonly value: Readonly<T>;
|
|
19
|
+
select<R>(compute: (value: Readonly<T>) => R): Readable<R>;
|
|
20
|
+
}
|
|
21
|
+
export interface State<T> extends Readable<T> {
|
|
22
|
+
update(context: Context, change: (current: Readonly<T>) => T): Readonly<T>;
|
|
23
|
+
}
|
|
24
|
+
export interface Resource<T> {
|
|
25
|
+
readonly value: T;
|
|
26
|
+
readonly version: number;
|
|
27
|
+
}
|
|
28
|
+
export type WitReference<Interface> = {
|
|
29
|
+
readonly ready: Promise<void>;
|
|
30
|
+
readonly status: string;
|
|
31
|
+
readonly state: Readable<unknown>;
|
|
32
|
+
release(): void;
|
|
33
|
+
} & {
|
|
34
|
+
[Method in keyof Interface as Interface[Method] extends (...args: never[]) => unknown ? Method : never]: Interface[Method] extends (...args: infer Arguments) => infer Result ? (...args: [...Arguments, context?: Context]) => Promise<Awaited<Result>> : never;
|
|
35
|
+
};
|
|
36
|
+
export interface Declaration {
|
|
37
|
+
readonly key: readonly string[];
|
|
38
|
+
readonly principal: string;
|
|
39
|
+
readonly orb: unknown;
|
|
40
|
+
state<T>(initial: T, options?: {
|
|
41
|
+
version?: number;
|
|
42
|
+
validate?(value: Readonly<T>): boolean | void;
|
|
43
|
+
}): State<T>;
|
|
44
|
+
get<Interface>(binding: string, key?: string | readonly string[]): WitReference<Interface>;
|
|
45
|
+
hook<Input = unknown, Output = Input>(name: string): {
|
|
46
|
+
run(context: Context, input: Input): Promise<Output>;
|
|
47
|
+
};
|
|
48
|
+
resource<T>(name: string, options: {
|
|
49
|
+
version?: number;
|
|
50
|
+
deps?: readonly Resource<unknown>[];
|
|
51
|
+
open(signal: Signal): T | PromiseLike<T>;
|
|
52
|
+
close?(value: T, context: Context): unknown;
|
|
53
|
+
}): Resource<T>;
|
|
54
|
+
}
|
|
55
|
+
export type WitMethods<Interface, Environment> = {
|
|
56
|
+
[Method in keyof Interface as Interface[Method] extends (...args: never[]) => unknown ? Method : never]: Interface[Method] extends (...args: infer Arguments) => infer Result ? (environment: Environment, context: Context, ...args: Arguments) => Awaited<Result> | PromiseLike<Awaited<Result>> : never;
|
|
57
|
+
};
|
|
58
|
+
interface Service {
|
|
59
|
+
create?(self: Declaration): unknown;
|
|
60
|
+
methods: Record<string, (...args: never[]) => unknown>;
|
|
61
|
+
lifetime?: "referenced" | "host";
|
|
62
|
+
linger?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface HookComposition {
|
|
65
|
+
readonly composition: "series" | "waterfall" | "bail";
|
|
66
|
+
}
|
|
67
|
+
/** Observe each contribution in the kernel's plan order. */
|
|
68
|
+
export declare function series(): HookComposition;
|
|
69
|
+
/** Pass each contribution's result to the next participant. */
|
|
70
|
+
export declare function waterfall(): HookComposition;
|
|
71
|
+
/** Return the first defined contribution result. */
|
|
72
|
+
export declare function bail(): HookComposition;
|
|
73
|
+
/**
|
|
74
|
+
* A source contribution receives the Orb root environment returned by `orb.create`, then the
|
|
75
|
+
* issued context and the hook input, like a service method. Annotate the environment with its
|
|
76
|
+
* actual type, for example `ReturnType<typeof create>`.
|
|
77
|
+
*/
|
|
78
|
+
export type Contribution = ((environment: never, context: Context, input: never) => unknown) | {
|
|
79
|
+
handle(environment: never, context: Context, input: never): unknown;
|
|
80
|
+
priority?: number;
|
|
81
|
+
};
|
|
82
|
+
/** Retain literal identity and callbacks; the outer host validates them against WIT before admission. */
|
|
83
|
+
export declare function orb<const Definition extends {
|
|
84
|
+
name: string;
|
|
85
|
+
apiVersion: number;
|
|
86
|
+
create?(self: Declaration): unknown;
|
|
87
|
+
services?: Record<string, Service>;
|
|
88
|
+
hooks?: Readonly<Record<string, HookComposition>>;
|
|
89
|
+
contributes?: Readonly<Record<string, Contribution>>;
|
|
90
|
+
}>(definition: Definition): Readonly<Definition>;
|
|
91
|
+
declare global {
|
|
92
|
+
interface Console {
|
|
93
|
+
log(...values: unknown[]): void;
|
|
94
|
+
debug(...values: unknown[]): void;
|
|
95
|
+
info(...values: unknown[]): void;
|
|
96
|
+
warn(...values: unknown[]): void;
|
|
97
|
+
error(...values: unknown[]): void;
|
|
98
|
+
}
|
|
99
|
+
var console: Console;
|
|
100
|
+
const tembra: {
|
|
101
|
+
wait(milliseconds: number): Promise<void>;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Iterate a standard WIT `stream<u8>` as `Uint8Array` chunks.
|
|
106
|
+
*
|
|
107
|
+
* jco declares `stream<u8>` as `AsyncIterable<number>`, and the interpreter's streams honor that
|
|
108
|
+
* contract, but awaiting one element per byte spends the callback's instruction budget on every
|
|
109
|
+
* byte. Streams issued by the interpreter already transfer bounded raw chunks (at most 64 KiB);
|
|
110
|
+
* this returns those chunks unchanged. Any other `AsyncIterable<number>` is batched.
|
|
111
|
+
*/
|
|
112
|
+
export declare function readChunks(stream: AsyncIterable<number>): AsyncGenerator<Uint8Array, void, undefined>;
|
|
113
|
+
/**
|
|
114
|
+
* Pass `Uint8Array` chunks as a standard WIT `stream<u8>` argument.
|
|
115
|
+
*
|
|
116
|
+
* The result is the `AsyncIterable<number>` jco declares, so it type-checks wherever a
|
|
117
|
+
* `stream<u8>` is expected. The interpreter recognizes it and transfers each chunk in raw
|
|
118
|
+
* pieces of at most 64 KiB with backpressure instead of iterating bytes; any other consumer
|
|
119
|
+
* sees the bytes one by one. Chunks are read lazily; do not mutate one until the next is
|
|
120
|
+
* requested. The source's `return()` runs if the consumer stops early.
|
|
121
|
+
*/
|
|
122
|
+
export declare function writeChunks(chunks: Iterable<Uint8Array> | AsyncIterable<Uint8Array>): AsyncIterable<number>;
|
|
123
|
+
/** jco's `result<_, error-code>` payload of a filesystem stream future. */
|
|
124
|
+
export type WasiResult = {
|
|
125
|
+
tag: "ok";
|
|
126
|
+
val?: unknown;
|
|
127
|
+
} | {
|
|
128
|
+
tag: "err";
|
|
129
|
+
val: unknown;
|
|
130
|
+
};
|
|
131
|
+
/** The part of a standard `wasi:filesystem` descriptor the read helpers use. */
|
|
132
|
+
export interface ReadableFile {
|
|
133
|
+
readViaStream(offset: bigint): readonly [AsyncIterable<number>, PromiseLike<WasiResult>];
|
|
134
|
+
}
|
|
135
|
+
/** The part of a standard `wasi:filesystem` descriptor the write helpers use. */
|
|
136
|
+
export interface WritableFile {
|
|
137
|
+
writeViaStream(data: AsyncIterable<number>, offset: bigint): PromiseLike<WasiResult>;
|
|
138
|
+
appendViaStream(data: AsyncIterable<number>): PromiseLike<WasiResult>;
|
|
139
|
+
}
|
|
140
|
+
/** A filesystem helper failed with a WASI `error-code`; `code` is its tag. */
|
|
141
|
+
export declare class FilesystemCallError extends Error {
|
|
142
|
+
readonly payload: unknown;
|
|
143
|
+
readonly code: string;
|
|
144
|
+
constructor(payload: unknown);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Read a file from `offset` (default `0n`) to its end through `read-via-stream`. More than
|
|
148
|
+
* `maxBytes` (default 16 MiB) is refused with a `RangeError` instead of growing without bound.
|
|
149
|
+
*/
|
|
150
|
+
export declare function readBytes(file: ReadableFile, options?: {
|
|
151
|
+
offset?: bigint;
|
|
152
|
+
maxBytes?: number;
|
|
153
|
+
}): Promise<Uint8Array>;
|
|
154
|
+
/** `readBytes`, then strict UTF-8 decoding; invalid UTF-8 is a `RangeError`. */
|
|
155
|
+
export declare function readText(file: ReadableFile, options?: {
|
|
156
|
+
offset?: bigint;
|
|
157
|
+
maxBytes?: number;
|
|
158
|
+
}): Promise<string>;
|
|
159
|
+
/**
|
|
160
|
+
* Write `bytes` at `offset` (default `0n`), or at the end of file with `append`, through
|
|
161
|
+
* `write-via-stream`/`append-via-stream`. It never truncates: open the file with the
|
|
162
|
+
* `truncate` flag to replace its contents.
|
|
163
|
+
*/
|
|
164
|
+
export declare function writeBytes(file: WritableFile, bytes: Uint8Array, options?: {
|
|
165
|
+
offset?: bigint;
|
|
166
|
+
append?: boolean;
|
|
167
|
+
}): Promise<void>;
|
|
168
|
+
/** Encode `text` as UTF-8 and `writeBytes` it. */
|
|
169
|
+
export declare function writeText(file: WritableFile, text: string, options?: {
|
|
170
|
+
offset?: bigint;
|
|
171
|
+
append?: boolean;
|
|
172
|
+
}): Promise<void>;
|
|
173
|
+
export {};
|
package/dist/guest.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
series2,
|
|
3
|
+
waterfall2,
|
|
4
|
+
bail2,
|
|
5
|
+
orb2,
|
|
6
|
+
readChunks2,
|
|
7
|
+
writeChunks2,
|
|
8
|
+
FilesystemCallError2,
|
|
9
|
+
readBytes2,
|
|
10
|
+
readText2,
|
|
11
|
+
writeBytes2,
|
|
12
|
+
writeText2
|
|
13
|
+
} from "./chunks/index-kr6bnh34.js";
|
|
14
|
+
export {
|
|
15
|
+
FilesystemCallError2 as FilesystemCallError,
|
|
16
|
+
bail2 as bail,
|
|
17
|
+
orb2 as orb,
|
|
18
|
+
readBytes2 as readBytes,
|
|
19
|
+
readChunks2 as readChunks,
|
|
20
|
+
readText2 as readText,
|
|
21
|
+
series2 as series,
|
|
22
|
+
waterfall2 as waterfall,
|
|
23
|
+
writeBytes2 as writeBytes,
|
|
24
|
+
writeChunks2 as writeChunks,
|
|
25
|
+
writeText2 as writeText
|
|
26
|
+
};
|
package/dist/host.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { orb } from "./authoring/orb.ts";
|
|
2
|
-
import type { AcquisitionOptions, Completion,
|
|
2
|
+
import type { AcquisitionOptions, Completion, OrbInput, HostOptions, LoadOptions, ReloadOptions, ResourceOptions, DynamicReference, ServiceDefinition, ServiceReference } from "./authoring/types.ts";
|
|
3
3
|
import { Context } from "./runtime/context.ts";
|
|
4
4
|
import { Session } from "./runtime/session.ts";
|
|
5
|
+
import { type HandleHttpOptions, type HttpHandlerResponse, type IncomingHttpRequest } from "./interpreter/http-ingress.ts";
|
|
5
6
|
/** The application facade. Platform entrypoints provide its metadata kernel and module loader. */
|
|
6
7
|
export declare class Host {
|
|
7
8
|
readonly session: Session;
|
|
@@ -10,15 +11,15 @@ export declare class Host {
|
|
|
10
11
|
/** Read the configured host name. */
|
|
11
12
|
get name(): string;
|
|
12
13
|
/** Read the capabilities compiled into the Rust kernel. */
|
|
13
|
-
get features(): import("./
|
|
14
|
+
get features(): import("./bridge/commands.ts").Features;
|
|
14
15
|
/** Install new orbs and activate their required scopes. */
|
|
15
|
-
install(definition:
|
|
16
|
+
install(definition: OrbInput | readonly OrbInput[]): Promise<void>;
|
|
16
17
|
/** Load an orb with the host's module loader, then install it. */
|
|
17
|
-
load(location: string | URL): Promise<void>;
|
|
18
|
+
load(location: string | URL, options?: LoadOptions): Promise<void>;
|
|
18
19
|
/** Prepare and commit a replacement using the kernel's lifecycle order. */
|
|
19
|
-
reload(definitions: readonly
|
|
20
|
+
reload(definitions: readonly OrbInput[], options?: ReloadOptions): Promise<import("./index.ts").ReloadReport>;
|
|
20
21
|
/** Build a replacement candidate without adopting it. */
|
|
21
|
-
prepare(definitions: readonly
|
|
22
|
+
prepare(definitions: readonly OrbInput[], options?: ReloadOptions): Promise<import("./index.ts").PreparedReload>;
|
|
22
23
|
/** Remove named orbs through the replacement lifecycle. */
|
|
23
24
|
remove(names: readonly string[], options?: ReloadOptions): Promise<import("./index.ts").ReloadReport>;
|
|
24
25
|
/** Acquire a reference before its asynchronous activation completes. */
|
|
@@ -31,6 +32,24 @@ export declare class Host {
|
|
|
31
32
|
root<T>(operation: (context: Context) => Completion<T>, options?: {
|
|
32
33
|
principal?: string;
|
|
33
34
|
}): Promise<T>;
|
|
35
|
+
/**
|
|
36
|
+
* Serve one incoming HTTP request with the named Orb's `wasi:http/handler` export. The
|
|
37
|
+
* application owns listening, routing and authentication; this only runs the handler.
|
|
38
|
+
*
|
|
39
|
+
* The promise resolves with the response head as soon as the handler returned it; the body is
|
|
40
|
+
* produced while it is read. The call runs in its own root, which stays open, with its
|
|
41
|
+
* authority, until the delivery ended and all physical work settled: reading the body and
|
|
42
|
+
* trailers to the end, calling `return()` on the body iterator (a client disconnect), or
|
|
43
|
+
* cancelling through `options.signal`. A failure before the head (the handler's
|
|
44
|
+
* `error-code` as `HttpHandlerError`, a trap, a refusal) is reported after that settlement.
|
|
45
|
+
* One request is one callback of the Orb's revision, and the revision timeout covers the
|
|
46
|
+
* whole exchange, body included; a timeout retires the revision.
|
|
47
|
+
*
|
|
48
|
+
* The raw form is lossless. A WHATWG `Request` is answered with a WHATWG `Response`, and a
|
|
49
|
+
* response that form cannot represent is refused.
|
|
50
|
+
*/
|
|
51
|
+
handleHttp(orb: string, request: IncomingHttpRequest, options?: HandleHttpOptions): Promise<HttpHandlerResponse>;
|
|
52
|
+
handleHttp(orb: string, request: Request, options?: HandleHttpOptions): Promise<Response>;
|
|
34
53
|
/** Declare a resource owned by this host. */
|
|
35
54
|
resource<T>(name: string, options: ResourceOptions<T>): import("./index.ts").Resource<T>;
|
|
36
55
|
/** Read current kernel counts and pending JS work. */
|
|
@@ -54,38 +73,22 @@ export declare class Host {
|
|
|
54
73
|
codeVersion: number;
|
|
55
74
|
name: string;
|
|
56
75
|
apiVersion: number;
|
|
57
|
-
services:
|
|
58
|
-
name: string;
|
|
59
|
-
methods: string[];
|
|
60
|
-
lifetime: import("./host.ts").Lifetime;
|
|
61
|
-
linger: number;
|
|
62
|
-
}[];
|
|
76
|
+
services: import("./bridge/commands.ts").ServiceInfo[];
|
|
63
77
|
hooks: string[];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
services: Record<string, string[]>;
|
|
68
|
-
hooks: string[];
|
|
69
|
-
}[];
|
|
78
|
+
hookSignatures: Record<string, string>;
|
|
79
|
+
requires: import("./bridge/commands.ts").RequirementInfo[];
|
|
80
|
+
isolated: boolean;
|
|
70
81
|
}>;
|
|
71
82
|
id: number;
|
|
72
83
|
owner: number;
|
|
73
84
|
codeVersion: number;
|
|
74
85
|
name: string;
|
|
75
86
|
apiVersion: number;
|
|
76
|
-
services:
|
|
77
|
-
name: string;
|
|
78
|
-
methods: string[];
|
|
79
|
-
lifetime: import("./host.ts").Lifetime;
|
|
80
|
-
linger: number;
|
|
81
|
-
}[];
|
|
87
|
+
services: import("./bridge/commands.ts").ServiceInfo[];
|
|
82
88
|
hooks: string[];
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
services: Record<string, string[]>;
|
|
87
|
-
hooks: string[];
|
|
88
|
-
}[];
|
|
89
|
+
hookSignatures: Record<string, string>;
|
|
90
|
+
requires: import("./bridge/commands.ts").RequirementInfo[];
|
|
91
|
+
isolated: boolean;
|
|
89
92
|
}>[];
|
|
90
93
|
/** Wait for physical work and cleanup before releasing the kernel. */
|
|
91
94
|
close(): Promise<void>;
|
|
@@ -95,4 +98,7 @@ export declare function createHost(options: HostOptions): Host;
|
|
|
95
98
|
export { orb };
|
|
96
99
|
export { Code, HookCapability, Lifetime, Reason, ReloadStatus, Status, } from "./bridge/identifiers.ts";
|
|
97
100
|
export { Errors, type ErrorDescriptor } from "./errors.ts";
|
|
101
|
+
export { HttpHandlerError, type HandleHttpOptions, type HttpHandlerResponse, type IncomingHttpRequest, } from "./interpreter/http-ingress.ts";
|
|
102
|
+
export type { HttpField } from "./interpreter/http-provider.ts";
|
|
98
103
|
export type { KernelPort } from "./bridge/kernel.ts";
|
|
104
|
+
export { createMobileHost, type MobileBackend, type MobileArtifact, type MobilePort, type MobileExecutionOptions, type MobileField, type MobileIngressCarrier, type MobileIngressEvent, type MobileRequestChunk, type MobileRequestHead, } from "./interpreter/mobile.ts";
|