@boundaryml/baml-bridge-web 0.0.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/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/native.d.ts +79 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +148 -0
- package/dist/native.js.map +1 -0
- package/dist/shared/define_function.d.ts +31 -0
- package/dist/shared/define_function.d.ts.map +1 -0
- package/dist/shared/define_function.js +274 -0
- package/dist/shared/define_function.js.map +1 -0
- package/dist/shared/errors.d.ts +51 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +60 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/host_value_registry.d.ts +50 -0
- package/dist/shared/host_value_registry.d.ts.map +1 -0
- package/dist/shared/host_value_registry.js +134 -0
- package/dist/shared/host_value_registry.js.map +1 -0
- package/dist/shared/proto/baml_cffi.d.ts +6282 -0
- package/dist/shared/proto/baml_cffi.js +12482 -0
- package/dist/shared/proto.d.ts +55 -0
- package/dist/shared/proto.d.ts.map +1 -0
- package/dist/shared/proto.js +956 -0
- package/dist/shared/proto.js.map +1 -0
- package/dist/shared/stream.d.ts +16 -0
- package/dist/shared/stream.d.ts.map +1 -0
- package/dist/shared/stream.js +61 -0
- package/dist/shared/stream.js.map +1 -0
- package/dist/shared/typemap.d.ts +30 -0
- package/dist/shared/typemap.d.ts.map +1 -0
- package/dist/shared/typemap.js +103 -0
- package/dist/shared/typemap.js.map +1 -0
- package/dist/shared/wire_ty.d.ts +51 -0
- package/dist/shared/wire_ty.d.ts.map +1 -0
- package/dist/shared/wire_ty.js +140 -0
- package/dist/shared/wire_ty.js.map +1 -0
- package/dist/wasm/bridge_web_core.d.ts +174 -0
- package/dist/wasm/bridge_web_core.js +1277 -0
- package/dist/wasm/bridge_web_core_bg.wasm +0 -0
- package/dist/wasm/bridge_web_core_bg.wasm.d.ts +41 -0
- package/dist/wasm/package.json +19 -0
- package/dist/workerd/index.d.ts +30 -0
- package/dist/workerd/index.d.ts.map +1 -0
- package/dist/workerd/index.js +57 -0
- package/dist/workerd/index.js.map +1 -0
- package/dist/workerd/native.d.ts +79 -0
- package/dist/workerd/native.d.ts.map +1 -0
- package/dist/workerd/native.js +147 -0
- package/dist/workerd/shared/define_function.d.ts +31 -0
- package/dist/workerd/shared/define_function.d.ts.map +1 -0
- package/dist/workerd/shared/define_function.js +274 -0
- package/dist/workerd/shared/define_function.js.map +1 -0
- package/dist/workerd/shared/errors.d.ts +51 -0
- package/dist/workerd/shared/errors.d.ts.map +1 -0
- package/dist/workerd/shared/errors.js +60 -0
- package/dist/workerd/shared/errors.js.map +1 -0
- package/dist/workerd/shared/host_value_registry.d.ts +50 -0
- package/dist/workerd/shared/host_value_registry.d.ts.map +1 -0
- package/dist/workerd/shared/host_value_registry.js +134 -0
- package/dist/workerd/shared/host_value_registry.js.map +1 -0
- package/dist/workerd/shared/proto/baml_cffi.d.ts +6282 -0
- package/dist/workerd/shared/proto/baml_cffi.js +12482 -0
- package/dist/workerd/shared/proto.d.ts +55 -0
- package/dist/workerd/shared/proto.d.ts.map +1 -0
- package/dist/workerd/shared/proto.js +956 -0
- package/dist/workerd/shared/proto.js.map +1 -0
- package/dist/workerd/shared/stream.d.ts +16 -0
- package/dist/workerd/shared/stream.d.ts.map +1 -0
- package/dist/workerd/shared/stream.js +61 -0
- package/dist/workerd/shared/stream.js.map +1 -0
- package/dist/workerd/shared/typemap.d.ts +30 -0
- package/dist/workerd/shared/typemap.d.ts.map +1 -0
- package/dist/workerd/shared/typemap.js +103 -0
- package/dist/workerd/shared/typemap.js.map +1 -0
- package/dist/workerd/shared/wire_ty.d.ts +51 -0
- package/dist/workerd/shared/wire_ty.d.ts.map +1 -0
- package/dist/workerd/shared/wire_ty.js +140 -0
- package/dist/workerd/shared/wire_ty.js.map +1 -0
- package/dist/workerd-wasm/bridge_web_core.d.ts +108 -0
- package/dist/workerd-wasm/bridge_web_core.js +14 -0
- package/dist/workerd-wasm/bridge_web_core_bg.js +1178 -0
- package/dist/workerd-wasm/bridge_web_core_bg.wasm +0 -0
- package/dist/workerd-wasm/bridge_web_core_bg.wasm.d.ts +41 -0
- package/dist/workerd-wasm/package.json +21 -0
- package/package.json +31 -0
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const callFunction: (a: number, b: number, c: number, d: number) => number;
|
|
5
|
+
export const callFunctionSync: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
6
|
+
export const cancelFunctionCall: (a: bigint) => number;
|
|
7
|
+
export const completeWebHostCall: (a: number, b: number, c: number, d: number) => void;
|
|
8
|
+
export const mintWebHostValueKey: () => bigint;
|
|
9
|
+
export const newFunctionCall: () => bigint;
|
|
10
|
+
export const registerWebHostCallable: (a: number) => bigint;
|
|
11
|
+
export const registerWebHostValueReleaseCallback: (a: number) => void;
|
|
12
|
+
export const releaseWebHostCallable: (a: bigint) => void;
|
|
13
|
+
export const stageRuntimeBytecode: (a: number, b: number, c: number, d: number) => void;
|
|
14
|
+
export const completeHostCall: (a: number, b: number, c: number, d: number) => void;
|
|
15
|
+
export const registerHostCallable: (a: number) => bigint;
|
|
16
|
+
export const registerHostValueReleaseCallback: (a: number) => void;
|
|
17
|
+
export const releaseHostCallable: (a: bigint) => void;
|
|
18
|
+
export const mintHostValueKey: () => bigint;
|
|
19
|
+
export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
20
|
+
export const __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
21
|
+
export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
22
|
+
export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
23
|
+
export const intounderlyingbytesource_cancel: (a: number) => void;
|
|
24
|
+
export const intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
25
|
+
export const intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
26
|
+
export const intounderlyingbytesource_type: (a: number) => number;
|
|
27
|
+
export const intounderlyingsink_abort: (a: number, b: number) => number;
|
|
28
|
+
export const intounderlyingsink_close: (a: number) => number;
|
|
29
|
+
export const intounderlyingsink_write: (a: number, b: number) => number;
|
|
30
|
+
export const intounderlyingsource_cancel: (a: number) => void;
|
|
31
|
+
export const intounderlyingsource_pull: (a: number, b: number) => number;
|
|
32
|
+
export const __wasm_bindgen_func_elem_37361: (a: number, b: number, c: number, d: number) => void;
|
|
33
|
+
export const __wasm_bindgen_func_elem_37369: (a: number, b: number, c: number, d: number) => void;
|
|
34
|
+
export const __wasm_bindgen_func_elem_1351: (a: number, b: number, c: number) => void;
|
|
35
|
+
export const __wasm_bindgen_func_elem_1130: (a: number, b: number) => void;
|
|
36
|
+
export const __wbindgen_export: (a: number) => void;
|
|
37
|
+
export const __wbindgen_export2: (a: number, b: number) => number;
|
|
38
|
+
export const __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
|
|
39
|
+
export const __wbindgen_export4: (a: number, b: number) => void;
|
|
40
|
+
export const __wbindgen_export5: (a: number, b: number, c: number) => void;
|
|
41
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bridge_web",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"Vaibhav Gupta <vbv@boundaryml.com>"
|
|
6
|
+
],
|
|
7
|
+
"version": "0.0.0-beta",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"files": [
|
|
10
|
+
"bridge_web_core_bg.wasm",
|
|
11
|
+
"bridge_web_core.js",
|
|
12
|
+
"bridge_web_core.d.ts"
|
|
13
|
+
],
|
|
14
|
+
"main": "bridge_web_core.js",
|
|
15
|
+
"types": "bridge_web_core.d.ts",
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"./snippets/*"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BamlCallContext, BamlRuntime, Collector, HostSpanManager } from "./native.js";
|
|
2
|
+
export { BamlAudio, BamlCallContext, BamlHandle, BamlImage, BamlPdf, BamlRuntime, BamlVideo, Collector, FunctionLog, HostSpanManager, LLMCall, Timing, Usage, flushEvents, getRuntime, getVersion, newFunctionCall } from "./native.js";
|
|
3
|
+
export { BamlStream } from "./shared/stream.js";
|
|
4
|
+
export { BamlTypeMap, getTypeMap, setTypeMap } from "./shared/typemap.js";
|
|
5
|
+
export { defineFunction, defineInstanceFunction, UNSET } from "./shared/define_function.js";
|
|
6
|
+
export type { GenericParams } from "./shared/define_function.js";
|
|
7
|
+
export { Never, lowerTypeToWireTy } from "./shared/wire_ty.js";
|
|
8
|
+
export type { BamlClassCtor, BamlPrimitiveToken, BamlType } from "./shared/wire_ty.js";
|
|
9
|
+
export { BamlAbortError, BamlCancelledError, BamlClientError, BamlError, BamlInvalidArgumentError, BamlPanic } from "./shared/errors.js";
|
|
10
|
+
export { decodeCallResult, encodeCallArgs } from "./shared/proto.js";
|
|
11
|
+
export declare function initializeRuntimeFromBytecode(bytecode: Uint8Array): void;
|
|
12
|
+
export declare function initializeRuntime(srcDir: string, files: Record<string, string>): void;
|
|
13
|
+
export declare class FunctionResult {
|
|
14
|
+
private readonly value;
|
|
15
|
+
constructor(value: unknown);
|
|
16
|
+
result(): unknown;
|
|
17
|
+
toString(): string;
|
|
18
|
+
}
|
|
19
|
+
export declare function callFunctionSync(rt: BamlRuntime, functionName: string, kwargs: Record<string, unknown>, ctx?: HostSpanManager, collectors?: Collector[], callCtx?: BamlCallContext): FunctionResult;
|
|
20
|
+
export declare function callFunction(rt: BamlRuntime, functionName: string, kwargs: Record<string, unknown>, ctx?: HostSpanManager, collectors?: Collector[], callCtx?: BamlCallContext): Promise<FunctionResult>;
|
|
21
|
+
export declare class CtxManager {
|
|
22
|
+
private readonly context;
|
|
23
|
+
get(): HostSpanManager;
|
|
24
|
+
allowReset(): boolean;
|
|
25
|
+
reset(): void;
|
|
26
|
+
cloneContext(): HostSpanManager;
|
|
27
|
+
upsertTags(tags: Record<string, string>): void;
|
|
28
|
+
}
|
|
29
|
+
export declare function cancelFunctionCall(callId: bigint): boolean;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../typescript_src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAwG,MAAM,aAAa,CAAC;AAG7L,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxO,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC5F,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzI,OA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HostSpanManager, cancelFunctionCall as nativeCancelFunctionCall, newFunctionCall as nativeNewFunctionCall } from "./native.js";
|
|
2
|
+
import { decodeCallResult, encodeCallArgs } from "./shared/proto.js";
|
|
3
|
+
export { BamlAudio, BamlCallContext, BamlHandle, BamlImage, BamlPdf, BamlRuntime, BamlVideo, Collector, FunctionLog, HostSpanManager, LLMCall, Timing, Usage, flushEvents, getRuntime, getVersion, newFunctionCall } from "./native.js";
|
|
4
|
+
export { BamlStream } from "./shared/stream.js";
|
|
5
|
+
export { BamlTypeMap, getTypeMap, setTypeMap } from "./shared/typemap.js";
|
|
6
|
+
export { defineFunction, defineInstanceFunction, UNSET } from "./shared/define_function.js";
|
|
7
|
+
export { Never, lowerTypeToWireTy } from "./shared/wire_ty.js";
|
|
8
|
+
export { BamlAbortError, BamlCancelledError, BamlClientError, BamlError, BamlInvalidArgumentError, BamlPanic } from "./shared/errors.js";
|
|
9
|
+
export { decodeCallResult, encodeCallArgs } from "./shared/proto.js";
|
|
10
|
+
export function initializeRuntimeFromBytecode(bytecode) {
|
|
11
|
+
BamlRuntime.initializeRuntimeFromBytecode(bytecode);
|
|
12
|
+
}
|
|
13
|
+
export function initializeRuntime(srcDir, files) {
|
|
14
|
+
BamlRuntime.initializeRuntime(srcDir, files);
|
|
15
|
+
}
|
|
16
|
+
export class FunctionResult {
|
|
17
|
+
value;
|
|
18
|
+
constructor(value) {
|
|
19
|
+
this.value = value;
|
|
20
|
+
}
|
|
21
|
+
result() { return this.value; }
|
|
22
|
+
toString() { return `FunctionResult(${JSON.stringify(this.value)})`; }
|
|
23
|
+
}
|
|
24
|
+
export function callFunctionSync(rt, functionName, kwargs, ctx, collectors, callCtx) {
|
|
25
|
+
const callId = nativeNewFunctionCall();
|
|
26
|
+
const args = encodeCallArgs(kwargs, { syncMode: true, callId });
|
|
27
|
+
callCtx?._attachCallId(callId.toString());
|
|
28
|
+
try {
|
|
29
|
+
return new FunctionResult(decodeCallResult(rt.callFunctionSync(functionName, args, ctx ?? null, collectors ?? null)));
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
callCtx?._detachCallId(callId.toString());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function callFunction(rt, functionName, kwargs, ctx, collectors, callCtx) {
|
|
36
|
+
const callId = nativeNewFunctionCall();
|
|
37
|
+
const args = encodeCallArgs(kwargs, { callId });
|
|
38
|
+
callCtx?._attachCallId(callId.toString());
|
|
39
|
+
try {
|
|
40
|
+
return new FunctionResult(decodeCallResult(await rt.callFunction(functionName, args, ctx ?? null, collectors ?? null)));
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
callCtx?._detachCallId(callId.toString());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export class CtxManager {
|
|
47
|
+
context = new HostSpanManager();
|
|
48
|
+
get() { return this.context; }
|
|
49
|
+
allowReset() { return true; }
|
|
50
|
+
reset() { }
|
|
51
|
+
cloneContext() { return this.context.deepClone(); }
|
|
52
|
+
upsertTags(tags) { this.context.upsertTags(tags); }
|
|
53
|
+
}
|
|
54
|
+
export function cancelFunctionCall(callId) {
|
|
55
|
+
return nativeCancelFunctionCall(callId);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../typescript_src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,WAAW,EAAa,eAAe,EAAE,kBAAkB,IAAI,wBAAwB,EAAc,eAAe,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC7L,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE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,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACpE,UAAU,CAAC,IAA4B,IAAU,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAClF;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface HandleKey {
|
|
2
|
+
low: number;
|
|
3
|
+
high: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class BamlHandle {
|
|
6
|
+
readonly key: HandleKey;
|
|
7
|
+
readonly handleType: number;
|
|
8
|
+
constructor(key: HandleKey, handleType: number);
|
|
9
|
+
clone(): BamlHandle;
|
|
10
|
+
_cloneKeyForWire(): HandleKey;
|
|
11
|
+
}
|
|
12
|
+
declare class BamlMedia {
|
|
13
|
+
private readonly handle;
|
|
14
|
+
protected constructor(handle: BamlHandle);
|
|
15
|
+
static fromUrl(_url: string, _mimeType?: string | null): BamlMedia;
|
|
16
|
+
static fromFile(_file: string, _mimeType?: string | null): BamlMedia;
|
|
17
|
+
static fromBase64(_base64: string, _mimeType?: string | null): BamlMedia;
|
|
18
|
+
static _fromHandle(handle: BamlHandle): BamlMedia;
|
|
19
|
+
_toHandle(): BamlHandle;
|
|
20
|
+
url(): string | null;
|
|
21
|
+
file(): string | null;
|
|
22
|
+
base64(): string;
|
|
23
|
+
mimeType(): string | null;
|
|
24
|
+
}
|
|
25
|
+
export declare class BamlImage extends BamlMedia {
|
|
26
|
+
}
|
|
27
|
+
export declare class BamlAudio extends BamlMedia {
|
|
28
|
+
}
|
|
29
|
+
export declare class BamlVideo extends BamlMedia {
|
|
30
|
+
}
|
|
31
|
+
export declare class BamlPdf extends BamlMedia {
|
|
32
|
+
}
|
|
33
|
+
export declare class BamlCallContext {
|
|
34
|
+
private callIds;
|
|
35
|
+
private isAborted;
|
|
36
|
+
abort(): void;
|
|
37
|
+
get aborted(): boolean;
|
|
38
|
+
_attachCallId(callId: string): void;
|
|
39
|
+
_detachCallId(callId: string): void;
|
|
40
|
+
}
|
|
41
|
+
export declare class HostSpanManager {
|
|
42
|
+
enter(_name: string, _args: unknown): void;
|
|
43
|
+
exitOk(): void;
|
|
44
|
+
exitError(_message: string): void;
|
|
45
|
+
upsertTags(_tags: Record<string, string>): void;
|
|
46
|
+
deepClone(): HostSpanManager;
|
|
47
|
+
contextDepth(): number;
|
|
48
|
+
}
|
|
49
|
+
export declare class Timing {
|
|
50
|
+
}
|
|
51
|
+
export declare class Usage {
|
|
52
|
+
}
|
|
53
|
+
export declare class LlmCall {
|
|
54
|
+
}
|
|
55
|
+
export { LlmCall as LLMCall };
|
|
56
|
+
export declare class FunctionLog {
|
|
57
|
+
}
|
|
58
|
+
export declare class Collector {
|
|
59
|
+
constructor(_name?: string | null);
|
|
60
|
+
}
|
|
61
|
+
export declare class BamlRuntime {
|
|
62
|
+
static initializeRuntimeFromBytecode(bytecode: Uint8Array): BamlRuntime;
|
|
63
|
+
static initializeRuntime(_rootPath: string, _files: Record<string, string>): BamlRuntime;
|
|
64
|
+
callFunctionSync(functionName: string, encodedArgs: Uint8Array, _ctx?: HostSpanManager | null, _collectors?: Collector[] | null): Uint8Array;
|
|
65
|
+
callFunction(functionName: string, encodedArgs: Uint8Array, _ctx?: HostSpanManager | null, _collectors?: Collector[] | null): Promise<Uint8Array>;
|
|
66
|
+
}
|
|
67
|
+
export declare function getRuntime(): BamlRuntime;
|
|
68
|
+
export declare function newFunctionCall(): bigint;
|
|
69
|
+
export declare function cancelFunctionCall(callId: bigint | string): boolean;
|
|
70
|
+
export declare function flushEvents(): void;
|
|
71
|
+
export declare function getVersion(): string;
|
|
72
|
+
export declare function mintHostValueKey(): HandleKey;
|
|
73
|
+
export declare function registerHostValueReleaseCallback(callback: (key: HandleKey) => void): void;
|
|
74
|
+
export declare function registerHostCallable(callback: (callId: number, args: Uint8Array) => void): HandleKey;
|
|
75
|
+
export declare function releaseHostCallable(key: HandleKey): void;
|
|
76
|
+
export declare function completeHostCall(callId: number, isError: number, content: Uint8Array): void;
|
|
77
|
+
export declare function _seedFunctionRefHandle(_globalIndex: number): [HandleKey, number];
|
|
78
|
+
export declare function _seedGenericMediaHandle(): [HandleKey, number];
|
|
79
|
+
//# sourceMappingURL=native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../typescript_src/native.ts"],"names":[],"mappings":"AAuDA,MAAM,WAAW,SAAS;IAAG,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;CAAE;AAMzD,qBAAa,UAAU;aACO,GAAG,EAAE,SAAS;aAAkB,UAAU,EAAE,MAAM;gBAAlD,GAAG,EAAE,SAAS,EAAkB,UAAU,EAAE,MAAM;IAC9E,KAAK,IAAI,UAAU;IACnB,gBAAgB,IAAI,SAAS;CAC9B;AAED,cAAM,SAAS;IACS,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA7C,SAAS,aAA8B,MAAM,EAAE,UAAU;IACzD,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAClE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IACpE,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IACxE,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS;IACjD,SAAS,IAAI,UAAU;IACvB,GAAG,IAAI,MAAM,GAAG,IAAI;IACpB,IAAI,IAAI,MAAM,GAAG,IAAI;IACrB,MAAM,IAAI,MAAM;IAChB,QAAQ,IAAI,MAAM,GAAG,IAAI;CAC1B;AAED,qBAAa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AAC,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,UAAU;IAG5I,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;CAGlJ;AAKD,wBAAgB,UAAU,IAAI,WAAW,CAGxC;AACD,wBAAgB,eAAe,IAAI,MAAM,CAAkC;AAC3E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAmD;AACvH,wBAAgB,WAAW,IAAI,IAAI,CAAG;AACtC,wBAAgB,UAAU,IAAI,MAAM,CAAwB;AAC5D,wBAAgB,gBAAgB,IAAI,SAAS,CAAiD;AAC9F,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI,CAGzF;AACD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,GAAG,SAAS,CAA6D;AAClK,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAIxD;AACD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CAAmD;AAC/I,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAmE;AACpJ,wBAAgB,uBAAuB,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAmE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { callFunction as callWasmFunction, callFunctionSync as callWasmFunctionSync, cancelFunctionCall as cancelWasmFunctionCall, completeWebHostCall, mintWebHostValueKey, newFunctionCall as newWasmFunctionCall, registerWebHostCallable, registerWebHostValueReleaseCallback, releaseWebHostCallable, stageRuntimeBytecode, } from "../workerd-wasm/bridge_web_core.js";
|
|
2
|
+
|
|
3
|
+
async function browserFetch(_callId, method, url, headersJson, body) {
|
|
4
|
+
const headers = JSON.parse(headersJson);
|
|
5
|
+
const response = await fetch(url, {
|
|
6
|
+
method,
|
|
7
|
+
headers,
|
|
8
|
+
body: body.length === 0 || method === "GET" || method === "HEAD" ? undefined : body,
|
|
9
|
+
});
|
|
10
|
+
const responseHeaders = {};
|
|
11
|
+
response.headers.forEach((value, key) => { responseHeaders[key] = value; });
|
|
12
|
+
return {
|
|
13
|
+
status: response.status,
|
|
14
|
+
headersJson: JSON.stringify(responseHeaders),
|
|
15
|
+
url: response.url,
|
|
16
|
+
bodyPromise: response.text(),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const unsupportedProcess = async () => {
|
|
20
|
+
throw new Error("process execution is not available in a browser");
|
|
21
|
+
};
|
|
22
|
+
const browserCallbacks = {
|
|
23
|
+
fetch: browserFetch,
|
|
24
|
+
env: (key) => globalThis.BAML_ENV?.[key],
|
|
25
|
+
input: async (_requestId, promptText) => globalThis.prompt?.(promptText ?? "") ?? "",
|
|
26
|
+
exec: unsupportedProcess,
|
|
27
|
+
shell: unsupportedProcess,
|
|
28
|
+
lsp_send_notification: () => { },
|
|
29
|
+
lsp_send_response: () => { },
|
|
30
|
+
lsp_make_request: () => { },
|
|
31
|
+
playground_send_notification: () => { },
|
|
32
|
+
host_dispatch: (key) => { throw new Error(`unknown browser host callable ${key}`); },
|
|
33
|
+
};
|
|
34
|
+
function keyFromBigint(value) {
|
|
35
|
+
return { low: Number(BigInt.asIntN(32, value)), high: Number(BigInt.asIntN(32, value >> 32n)) };
|
|
36
|
+
}
|
|
37
|
+
export class BamlHandle {
|
|
38
|
+
key;
|
|
39
|
+
handleType;
|
|
40
|
+
constructor(key, handleType) {
|
|
41
|
+
this.key = key;
|
|
42
|
+
this.handleType = handleType;
|
|
43
|
+
}
|
|
44
|
+
clone() { return new BamlHandle(this.key, this.handleType); }
|
|
45
|
+
_cloneKeyForWire() { return this.key; }
|
|
46
|
+
}
|
|
47
|
+
class BamlMedia {
|
|
48
|
+
handle;
|
|
49
|
+
constructor(handle) {
|
|
50
|
+
this.handle = handle;
|
|
51
|
+
}
|
|
52
|
+
static fromUrl(_url, _mimeType) { throw new Error("browser media construction is not implemented yet"); }
|
|
53
|
+
static fromFile(_file, _mimeType) { throw new Error("browser media construction is not implemented yet"); }
|
|
54
|
+
static fromBase64(_base64, _mimeType) { throw new Error("browser media construction is not implemented yet"); }
|
|
55
|
+
static _fromHandle(handle) { return new this(handle); }
|
|
56
|
+
_toHandle() { return this.handle.clone(); }
|
|
57
|
+
url() { return null; }
|
|
58
|
+
file() { return null; }
|
|
59
|
+
base64() { throw new Error("browser media access is not implemented yet"); }
|
|
60
|
+
mimeType() { return null; }
|
|
61
|
+
}
|
|
62
|
+
export class BamlImage extends BamlMedia {
|
|
63
|
+
}
|
|
64
|
+
export class BamlAudio extends BamlMedia {
|
|
65
|
+
}
|
|
66
|
+
export class BamlVideo extends BamlMedia {
|
|
67
|
+
}
|
|
68
|
+
export class BamlPdf extends BamlMedia {
|
|
69
|
+
}
|
|
70
|
+
export class BamlCallContext {
|
|
71
|
+
callIds = new Set();
|
|
72
|
+
isAborted = false;
|
|
73
|
+
abort() {
|
|
74
|
+
this.isAborted = true;
|
|
75
|
+
for (const callId of this.callIds)
|
|
76
|
+
cancelWasmFunctionCall(callId);
|
|
77
|
+
}
|
|
78
|
+
get aborted() { return this.isAborted; }
|
|
79
|
+
_attachCallId(callId) {
|
|
80
|
+
const id = BigInt(callId);
|
|
81
|
+
this.callIds.add(id);
|
|
82
|
+
if (this.isAborted)
|
|
83
|
+
cancelWasmFunctionCall(id);
|
|
84
|
+
}
|
|
85
|
+
_detachCallId(callId) { this.callIds.delete(BigInt(callId)); }
|
|
86
|
+
}
|
|
87
|
+
export class HostSpanManager {
|
|
88
|
+
enter(_name, _args) { }
|
|
89
|
+
exitOk() { }
|
|
90
|
+
exitError(_message) { }
|
|
91
|
+
upsertTags(_tags) { }
|
|
92
|
+
deepClone() { return new HostSpanManager(); }
|
|
93
|
+
contextDepth() { return 0; }
|
|
94
|
+
}
|
|
95
|
+
export class Timing {
|
|
96
|
+
}
|
|
97
|
+
export class Usage {
|
|
98
|
+
}
|
|
99
|
+
export class LlmCall {
|
|
100
|
+
}
|
|
101
|
+
export { LlmCall as LLMCall };
|
|
102
|
+
export class FunctionLog {
|
|
103
|
+
}
|
|
104
|
+
export class Collector {
|
|
105
|
+
constructor(_name) { }
|
|
106
|
+
}
|
|
107
|
+
export class BamlRuntime {
|
|
108
|
+
static initializeRuntimeFromBytecode(bytecode) {
|
|
109
|
+
stageRuntimeBytecode(bytecode, browserCallbacks);
|
|
110
|
+
runtime = new BamlRuntime();
|
|
111
|
+
return runtime;
|
|
112
|
+
}
|
|
113
|
+
static initializeRuntime(_rootPath, _files) {
|
|
114
|
+
throw new Error("browser source initialization is not implemented; use bytecode");
|
|
115
|
+
}
|
|
116
|
+
callFunctionSync(functionName, encodedArgs, _ctx, _collectors) {
|
|
117
|
+
return callWasmFunctionSync(functionName, encodedArgs);
|
|
118
|
+
}
|
|
119
|
+
callFunction(functionName, encodedArgs, _ctx, _collectors) {
|
|
120
|
+
return callWasmFunction(functionName, encodedArgs);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
let runtime;
|
|
124
|
+
let hostRelease;
|
|
125
|
+
export function getRuntime() {
|
|
126
|
+
if (!runtime)
|
|
127
|
+
throw new Error("BAML runtime has not been initialized");
|
|
128
|
+
return runtime;
|
|
129
|
+
}
|
|
130
|
+
export function newFunctionCall() { return newWasmFunctionCall(); }
|
|
131
|
+
export function cancelFunctionCall(callId) { return cancelWasmFunctionCall(BigInt(callId)); }
|
|
132
|
+
export function flushEvents() { }
|
|
133
|
+
export function getVersion() { return "0.0.0-web"; }
|
|
134
|
+
export function mintHostValueKey() { return keyFromBigint(mintWebHostValueKey()); }
|
|
135
|
+
export function registerHostValueReleaseCallback(callback) {
|
|
136
|
+
hostRelease = callback;
|
|
137
|
+
registerWebHostValueReleaseCallback((key) => hostRelease?.(keyFromBigint(key)));
|
|
138
|
+
}
|
|
139
|
+
export function registerHostCallable(callback) { return keyFromBigint(registerWebHostCallable(callback)); }
|
|
140
|
+
export function releaseHostCallable(key) {
|
|
141
|
+
const value = BigInt.asUintN(64, BigInt(key.high) << 32n | BigInt.asUintN(32, BigInt(key.low)));
|
|
142
|
+
releaseWebHostCallable(value);
|
|
143
|
+
hostRelease?.(key);
|
|
144
|
+
}
|
|
145
|
+
export function completeHostCall(callId, isError, content) { completeWebHostCall(callId, isError, content); }
|
|
146
|
+
export function _seedFunctionRefHandle(_globalIndex) { throw new Error("test handle seeding is not implemented yet"); }
|
|
147
|
+
export function _seedGenericMediaHandle() { throw new Error("test handle seeding is not implemented yet"); }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type Mode = 'sync' | 'async';
|
|
2
|
+
/** Sentinel for "argument not supplied" so optional kwargs can be skipped. */
|
|
3
|
+
export declare const UNSET: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Generic-binding contract for a callable. `typeParams` are the callee's OWN
|
|
6
|
+
* `<...>` param names (bound by the caller's `$types` option); `classTypeParams`
|
|
7
|
+
* are the enclosing generic class's params (bound from the `self` receiver's
|
|
8
|
+
* `$types` field). Mirrors `define_function`'s `type_params` /
|
|
9
|
+
* `class_type_params` kwargs in the Python SDK. Omitted/empty ⇒ non-generic.
|
|
10
|
+
*/
|
|
11
|
+
export interface GenericParams {
|
|
12
|
+
typeParams?: readonly string[];
|
|
13
|
+
classTypeParams?: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Factory for a free function or static method binding. Returns a callable
|
|
17
|
+
* that maps positional args to kwargs, encodes, calls the runtime, and decodes.
|
|
18
|
+
* `sync` returns the decoded value; `async` returns a `Promise` of it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function defineFunction(bamlFqn: string, mode: Mode, requiredParamNames: readonly string[], optionalParamNames?: readonly string[] | undefined, generics?: GenericParams | undefined): (...args: unknown[]) => unknown;
|
|
21
|
+
/**
|
|
22
|
+
* Receiver-binding factory for instance methods. `paramNames[0]` is always
|
|
23
|
+
* `"self"`. Codegen emits the binding as a class-field initializer
|
|
24
|
+
* `m = defineInstanceFunction(...).bind(this) as () => R;`, so `.bind(self)`
|
|
25
|
+
* captures the instance at construction time; the synthetic `self` param never
|
|
26
|
+
* appears in the surface type.
|
|
27
|
+
*/
|
|
28
|
+
export declare function defineInstanceFunction(bamlFqn: string, mode: Mode, requiredParamNames: readonly string[], optionalParamNames?: readonly string[] | undefined, generics?: GenericParams | undefined): {
|
|
29
|
+
bind(self: unknown): (...args: unknown[]) => unknown;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=define_function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define_function.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/define_function.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpC,8EAA8E;AAC9E,eAAO,MAAM,KAAK,EAAE,OAAO,MAA6B,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAoLD;;;;GAIG;AACH,wBAAgB,cAAc,CAC1B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,IAAI,EACV,kBAAkB,EAAE,SAAS,MAAM,EAAE,EACrC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAClD,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,GACrC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CA8CjC;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,IAAI,EACV,kBAAkB,EAAE,SAAS,MAAM,EAAE,EACrC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAClD,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,GACrC;IAAE,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAA;CAAE,CA2D1D"}
|