@boundaryml/baml-bridge-web 0.0.0 → 0.15.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 +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +50 -14
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +327 -70
- package/dist/native.js.map +1 -1
- package/dist/platform.d.ts +4 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +5 -0
- package/dist/platform.js.map +1 -0
- package/dist/shared/call_context.d.ts +7 -0
- package/dist/shared/call_context.d.ts.map +1 -0
- package/dist/shared/call_context.js +11 -0
- package/dist/shared/call_context.js.map +1 -0
- package/dist/shared/define_function.d.ts.map +1 -1
- package/dist/shared/define_function.js +13 -24
- package/dist/shared/define_function.js.map +1 -1
- package/dist/shared/errors.d.ts +4 -4
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +16 -10
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/host_value_registry.d.ts +5 -3
- package/dist/shared/host_value_registry.d.ts.map +1 -1
- package/dist/shared/host_value_registry.js +10 -6
- package/dist/shared/host_value_registry.js.map +1 -1
- package/dist/shared/platform.d.ts +4 -0
- package/dist/shared/platform.d.ts.map +1 -0
- package/dist/shared/platform.js +5 -0
- package/dist/shared/platform.js.map +1 -0
- package/dist/shared/proto/baml_cffi.d.ts +35 -8
- package/dist/shared/proto/baml_cffi.js +138 -25
- package/dist/shared/proto.d.ts +9 -5
- package/dist/shared/proto.d.ts.map +1 -1
- package/dist/shared/proto.js +197 -104
- package/dist/shared/proto.js.map +1 -1
- package/dist/shared/stream.d.ts +3 -2
- package/dist/shared/stream.d.ts.map +1 -1
- package/dist/shared/stream.js +22 -15
- package/dist/shared/stream.js.map +1 -1
- package/dist/wasm/bridge_web_core.d.ts +99 -68
- package/dist/wasm/bridge_web_core.js +519 -492
- package/dist/wasm/bridge_web_core_bg.wasm +0 -0
- package/dist/wasm/bridge_web_core_bg.wasm.d.ts +41 -27
- package/dist/wasm/package.json +1 -1
- package/dist/workerd/index.d.ts +3 -3
- package/dist/workerd/index.d.ts.map +1 -1
- package/dist/workerd/index.js +21 -14
- package/dist/workerd/index.js.map +1 -1
- package/dist/workerd/native.d.ts +50 -14
- package/dist/workerd/native.d.ts.map +1 -1
- package/dist/workerd/native.js +327 -70
- package/dist/workerd/shared/call_context.d.ts +7 -0
- package/dist/workerd/shared/call_context.d.ts.map +1 -0
- package/dist/workerd/shared/call_context.js +11 -0
- package/dist/workerd/shared/call_context.js.map +1 -0
- package/dist/workerd/shared/define_function.d.ts.map +1 -1
- package/dist/workerd/shared/define_function.js +13 -24
- package/dist/workerd/shared/define_function.js.map +1 -1
- package/dist/workerd/shared/errors.d.ts +4 -4
- package/dist/workerd/shared/errors.d.ts.map +1 -1
- package/dist/workerd/shared/errors.js +16 -10
- package/dist/workerd/shared/errors.js.map +1 -1
- package/dist/workerd/shared/host_value_registry.d.ts +5 -3
- package/dist/workerd/shared/host_value_registry.d.ts.map +1 -1
- package/dist/workerd/shared/host_value_registry.js +10 -6
- package/dist/workerd/shared/host_value_registry.js.map +1 -1
- package/dist/workerd/shared/platform.d.ts +4 -0
- package/dist/workerd/shared/platform.d.ts.map +1 -0
- package/dist/workerd/shared/platform.js +5 -0
- package/dist/workerd/shared/platform.js.map +1 -0
- package/dist/workerd/shared/proto/baml_cffi.d.ts +35 -8
- package/dist/workerd/shared/proto/baml_cffi.js +140 -25
- package/dist/workerd/shared/proto.d.ts +9 -5
- package/dist/workerd/shared/proto.d.ts.map +1 -1
- package/dist/workerd/shared/proto.js +197 -104
- package/dist/workerd/shared/proto.js.map +1 -1
- package/dist/workerd/shared/stream.d.ts +3 -2
- package/dist/workerd/shared/stream.d.ts.map +1 -1
- package/dist/workerd/shared/stream.js +22 -15
- package/dist/workerd/shared/stream.js.map +1 -1
- package/dist/workerd-wasm/bridge_web_core.d.ts +62 -45
- package/dist/workerd-wasm/bridge_web_core.js +3 -5
- package/dist/workerd-wasm/bridge_web_core_bg.js +519 -493
- package/dist/workerd-wasm/bridge_web_core_bg.wasm +0 -0
- package/dist/workerd-wasm/bridge_web_core_bg.wasm.d.ts +41 -27
- package/dist/workerd-wasm/package.json +1 -1
- package/package.json +22 -5
|
@@ -24,13 +24,13 @@ export declare class BamlError extends Error {
|
|
|
24
24
|
constructor(message: string, detail?: BamlErrorDetail);
|
|
25
25
|
}
|
|
26
26
|
export declare class BamlInvalidArgumentError extends BamlError {
|
|
27
|
-
constructor(message: string);
|
|
27
|
+
constructor(message: string, detail?: BamlErrorDetail);
|
|
28
28
|
}
|
|
29
29
|
export declare class BamlClientError extends BamlError {
|
|
30
|
-
constructor(message: string);
|
|
30
|
+
constructor(message: string, detail?: BamlErrorDetail);
|
|
31
31
|
}
|
|
32
32
|
export declare class BamlCancelledError extends BamlError {
|
|
33
|
-
constructor(message: string);
|
|
33
|
+
constructor(message: string, detail?: BamlErrorDetail);
|
|
34
34
|
}
|
|
35
35
|
export declare class BamlAbortError extends Error {
|
|
36
36
|
readonly reason: unknown;
|
|
@@ -42,7 +42,7 @@ export declare class BamlAbortError extends Error {
|
|
|
42
42
|
* Raised for SDK-setup failures and BAML-runtime panics — the Node analog of
|
|
43
43
|
* `bridge_python`'s `BamlPanic`. The in-call panic path (`decodeCallResult`'s
|
|
44
44
|
* `panic` arm) and the `getRuntime` not-initialized path both surface this,
|
|
45
|
-
* except clean
|
|
45
|
+
* except clean runtime-exit panics, which exit after flushing telemetry.
|
|
46
46
|
*/
|
|
47
47
|
export declare class BamlPanic extends BamlError {
|
|
48
48
|
constructor(message: string, detail?: BamlErrorDetail);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC5B,KA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ACjC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe;CAIxD;AAED,qBAAa,cAAe,SAAQ,KAAK;IACrC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE;CAK9D;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,SAAS;gBACxB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe;CAIxD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAQvD"}
|
|
@@ -15,20 +15,20 @@ export class BamlError extends Error {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
export class BamlInvalidArgumentError extends BamlError {
|
|
18
|
-
constructor(message) {
|
|
19
|
-
super(message);
|
|
18
|
+
constructor(message, detail) {
|
|
19
|
+
super(message, detail);
|
|
20
20
|
this.name = 'BamlInvalidArgumentError';
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
export class BamlClientError extends BamlError {
|
|
24
|
-
constructor(message) {
|
|
25
|
-
super(message);
|
|
24
|
+
constructor(message, detail) {
|
|
25
|
+
super(message, detail);
|
|
26
26
|
this.name = 'BamlClientError';
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
export class BamlCancelledError extends BamlError {
|
|
30
|
-
constructor(message) {
|
|
31
|
-
super(message);
|
|
30
|
+
constructor(message, detail) {
|
|
31
|
+
super(message, detail);
|
|
32
32
|
this.name = 'BamlCancelledError';
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -44,7 +44,7 @@ export class BamlAbortError extends Error {
|
|
|
44
44
|
* Raised for SDK-setup failures and BAML-runtime panics — the Node analog of
|
|
45
45
|
* `bridge_python`'s `BamlPanic`. The in-call panic path (`decodeCallResult`'s
|
|
46
46
|
* `panic` arm) and the `getRuntime` not-initialized path both surface this,
|
|
47
|
-
* except clean
|
|
47
|
+
* except clean runtime-exit panics, which exit after flushing telemetry.
|
|
48
48
|
*/
|
|
49
49
|
export class BamlPanic extends BamlError {
|
|
50
50
|
constructor(message, detail) {
|
|
@@ -53,8 +53,14 @@ export class BamlPanic extends BamlError {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
export function wrapNativeError(err) {
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
58
|
-
|
|
56
|
+
if (err instanceof BamlError)
|
|
57
|
+
return err;
|
|
58
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
59
|
+
const code = err !== null && typeof err === 'object' && 'code' in err
|
|
60
|
+
? err.code
|
|
61
|
+
: undefined;
|
|
62
|
+
if (code === 'invalid_argument')
|
|
63
|
+
return new BamlInvalidArgumentError(message);
|
|
64
|
+
return new BamlClientError(message);
|
|
59
65
|
}
|
|
60
66
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../typescript_src/shared/errors.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAmBjE,MAAM,OAAO,SAAU,SAAQ,KAAK;IAChC,6EAA6E;IACpE,KAAK,CAAU;IACxB,qEAAqE;IAC5D,SAAS,CAAW;IAC7B,+CAA+C;IACtC,SAAS,CAAqB;IAEvC,YAAY,OAAe,EAAE,MAAwB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,MAAM,EAAE,KAAK,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,SAAS,CAAC;IACvC,CAAC;CACJ;AAED,MAAM,OAAO,wBAAyB,SAAQ,SAA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,YAAY,OAAe,EAAE,OAA8B;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAClC,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IACpC,YAAY,OAAe,EAAE,MAAwB;QACjD,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC5B,CAAC;CACJ;AAED,MAAM,UAAU,eAAe,CAAC,GAAY;IACxC,IAAI,GAAG,YAAY,SAAS;QAAE,OAAO,GAAG,CAAC;IACzC,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,MAAM,IAAI,GAAG,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG;QACjE,CAAC,CAAE,GAA0B,CAAC,IAAI;QAClC,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,IAAI,KAAK,kBAAkB;QAAE,OAAO,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAC9E,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -14,18 +14,20 @@ import { type HandleKey } from '../native.js';
|
|
|
14
14
|
* encode correctly through the `IInboundValue.handle.key` field).
|
|
15
15
|
*/
|
|
16
16
|
export declare function registerHostOpaque(value: unknown): HandleKey;
|
|
17
|
+
/** Roll back an opaque registration that was never transferred to Rust. */
|
|
18
|
+
export declare function releaseHostOpaque(key: HandleKey): void;
|
|
17
19
|
/**
|
|
18
20
|
* Look up a host-registered JS value by key. Returns `undefined` when:
|
|
19
21
|
* - the key is the reserved sentinel `0n` (no real value was registered);
|
|
20
22
|
* - the engine has already released the entry (last `HostValueArc` clone
|
|
21
23
|
* dropped → Rust `host_release_callback` fired → `_releaseHostValue`
|
|
22
24
|
* removed the entry);
|
|
23
|
-
* - the key was minted by a different
|
|
25
|
+
* - the key was minted by a different JavaScript realm (cross-runtime handle).
|
|
24
26
|
*
|
|
25
27
|
* Callers should fall back to a metadata-built exception in those cases.
|
|
26
28
|
*
|
|
27
29
|
* GC/decode race: a release notification and a rehydrating decode can be
|
|
28
|
-
* scheduled on the
|
|
30
|
+
* scheduled on the host event loop loop concurrently in principle, but in practice
|
|
29
31
|
* the same `HostValueArc` cannot drop *while* the engine is actively
|
|
30
32
|
* emitting an outbound proto referencing its key — the outbound encode
|
|
31
33
|
* holds a strong handle through proto serialization, and the release tsfn
|
|
@@ -44,7 +46,7 @@ export declare function lookupHostValue(key: bigint): unknown;
|
|
|
44
46
|
*
|
|
45
47
|
* Used by `decodeCallResult`'s `error` arm to rehydrate the original JS
|
|
46
48
|
* exception when a BAML-thrown `baml.errors.HostCallable` propagates back
|
|
47
|
-
* to the same
|
|
49
|
+
* to the same JavaScript realm that originated it.
|
|
48
50
|
*/
|
|
49
51
|
export declare function tryRehydrateHostValueByKey(handle: unknown): unknown;
|
|
50
52
|
//# sourceMappingURL=host_value_registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host_value_registry.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/host_value_registry.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAkE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AA4B9G;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAI5D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAInE"}
|
|
1
|
+
{"version":3,"file":"host_value_registry.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/host_value_registry.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAkE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AA4B9G;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAI5D;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAEtD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAInE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// host_value_registry.ts — mirrors bridge_python's `register_host_opaque`
|
|
2
2
|
// + `lookup_host_value` pair.
|
|
3
3
|
//
|
|
4
|
-
// An arbitrary host JS value round-trips back to the *same*
|
|
4
|
+
// An arbitrary host JS value round-trips back to the *same* JavaScript realm as
|
|
5
5
|
// the *same* object (identity preserved), not flattened into a metadata-only
|
|
6
6
|
// wrapper. A native JS exception raised inside a user callable is the primary
|
|
7
7
|
// consumer: it round-trips as the *same* `Error` object (`raised === caught`
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
// (`native.registerHostValueReleaseCallback`), which calls `_releaseHostValue`
|
|
28
28
|
// here to remove the map entry.
|
|
29
29
|
//
|
|
30
|
-
// Foreign runtimes (a different
|
|
30
|
+
// Foreign runtimes (a different JavaScript realm, the Python bridge, etc.) see
|
|
31
31
|
// a `_handle` whose key doesn't resolve in their local registry; the
|
|
32
32
|
// decoder falls back to the metadata-bearing `BamlError(HostCallable(...))`
|
|
33
33
|
// wrapper. The reserved `0` is used as a sentinel by code paths that
|
|
@@ -77,18 +77,22 @@ export function registerHostOpaque(value) {
|
|
|
77
77
|
hostValueMap.set(handleKeyToBigint(key), value);
|
|
78
78
|
return key;
|
|
79
79
|
}
|
|
80
|
+
/** Roll back an opaque registration that was never transferred to Rust. */
|
|
81
|
+
export function releaseHostOpaque(key) {
|
|
82
|
+
hostValueMap.delete(handleKeyToBigint(key));
|
|
83
|
+
}
|
|
80
84
|
/**
|
|
81
85
|
* Look up a host-registered JS value by key. Returns `undefined` when:
|
|
82
86
|
* - the key is the reserved sentinel `0n` (no real value was registered);
|
|
83
87
|
* - the engine has already released the entry (last `HostValueArc` clone
|
|
84
88
|
* dropped → Rust `host_release_callback` fired → `_releaseHostValue`
|
|
85
89
|
* removed the entry);
|
|
86
|
-
* - the key was minted by a different
|
|
90
|
+
* - the key was minted by a different JavaScript realm (cross-runtime handle).
|
|
87
91
|
*
|
|
88
92
|
* Callers should fall back to a metadata-built exception in those cases.
|
|
89
93
|
*
|
|
90
94
|
* GC/decode race: a release notification and a rehydrating decode can be
|
|
91
|
-
* scheduled on the
|
|
95
|
+
* scheduled on the host event loop loop concurrently in principle, but in practice
|
|
92
96
|
* the same `HostValueArc` cannot drop *while* the engine is actively
|
|
93
97
|
* emitting an outbound proto referencing its key — the outbound encode
|
|
94
98
|
* holds a strong handle through proto serialization, and the release tsfn
|
|
@@ -109,7 +113,7 @@ export function lookupHostValue(key) {
|
|
|
109
113
|
*
|
|
110
114
|
* Used by `decodeCallResult`'s `error` arm to rehydrate the original JS
|
|
111
115
|
* exception when a BAML-thrown `baml.errors.HostCallable` propagates back
|
|
112
|
-
* to the same
|
|
116
|
+
* to the same JavaScript realm that originated it.
|
|
113
117
|
*/
|
|
114
118
|
export function tryRehydrateHostValueByKey(handle) {
|
|
115
119
|
if (!(handle instanceof BamlHandle))
|
|
@@ -128,7 +132,7 @@ function _releaseHostValue(key) {
|
|
|
128
132
|
hostValueMap.delete(handleKeyToBigint(key));
|
|
129
133
|
}
|
|
130
134
|
// Install the Rust-side release callback exactly once at module load. The
|
|
131
|
-
//
|
|
135
|
+
// native function is itself first-call-wins on the Rust side, so reloads
|
|
132
136
|
// (e.g. test harnesses) are harmless.
|
|
133
137
|
registerHostValueReleaseCallback(_releaseHostValue);
|
|
134
138
|
//# sourceMappingURL=host_value_registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host_value_registry.js","sourceRoot":"","sources":["../../typescript_src/shared/host_value_registry.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8BAA8B;AAC9B,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"host_value_registry.js","sourceRoot":"","sources":["../../typescript_src/shared/host_value_registry.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8BAA8B;AAC9B,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;AAC7E,YAAY;AACZ,EAAE;AACF,yEAAyE;AACzE,4DAA4D;AAC5D,4DAA4D;AAC5D,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAC1E,gFAAgF;AAChF,2EAA2E;AAC3E,wDAAwD;AACxD,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,6EAA6E;AAC7E,8BAA8B;AAC9B,yEAAyE;AACzE,uEAAuE;AACvE,oFAAoF;AACpF,qCAAqC;AACrC,EAAE;AACF,+EAA+E;AAC/E,qEAAqE;AACrE,4EAA4E;AAC5E,qEAAqE;AACrE,yEAAyE;AACzE,sEAAsE;AACtE,oDAAoD;AAEpD,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,cAAc,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC;AAE1D,MAAM,YAAY,GAAG,IAAI,GAAG,EAAmB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,SAAS,iBA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iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/platform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAE7C,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,GAAG,KAAK,CAE9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../typescript_src/shared/platform.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAE7C,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,aAAwB;IACrE,MAAM,aAAa,CAAC;AACtB,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE IS AUTO-GENERATED — DO NOT EDIT BY HAND.
|
|
3
3
|
*
|
|
4
|
-
* Source: baml_language/
|
|
4
|
+
* Source: baml_language/sdks/typescript/bridge_typescript/typescript_src/
|
|
5
5
|
* Proto: baml_language/crates/bridge_ctypes/types/baml_bridge/cffi/v1/*.proto
|
|
6
|
-
* Build: cd baml_language/
|
|
6
|
+
* Build: cd baml_language/sdks/typescript/bridge_typescript && pnpm build:debug
|
|
7
7
|
*/
|
|
8
8
|
import * as $protobuf from "protobufjs";
|
|
9
9
|
import Long from "long";
|
|
@@ -19,6 +19,9 @@ export namespace baml_bridge {
|
|
|
19
19
|
/** Properties of an InboundValue. */
|
|
20
20
|
interface IInboundValue {
|
|
21
21
|
|
|
22
|
+
/** InboundValue valueType */
|
|
23
|
+
valueType?: (baml_bridge.cffi.v1.IBamlTy|null);
|
|
24
|
+
|
|
22
25
|
/** InboundValue stringValue */
|
|
23
26
|
stringValue?: (string|null);
|
|
24
27
|
|
|
@@ -65,6 +68,9 @@ export namespace baml_bridge {
|
|
|
65
68
|
*/
|
|
66
69
|
constructor(properties?: baml_bridge.cffi.v1.IInboundValue);
|
|
67
70
|
|
|
71
|
+
/** InboundValue valueType. */
|
|
72
|
+
public valueType?: (baml_bridge.cffi.v1.IBamlTy|null);
|
|
73
|
+
|
|
68
74
|
/** InboundValue stringValue. */
|
|
69
75
|
public stringValue?: (string|null);
|
|
70
76
|
|
|
@@ -505,9 +511,6 @@ export namespace baml_bridge {
|
|
|
505
511
|
|
|
506
512
|
/** InboundClassValue fields */
|
|
507
513
|
fields?: (baml_bridge.cffi.v1.IInboundMapEntry[]|null);
|
|
508
|
-
|
|
509
|
-
/** InboundClassValue classTy */
|
|
510
|
-
classTy?: (baml_bridge.cffi.v1.IBamlTyClass|null);
|
|
511
514
|
}
|
|
512
515
|
|
|
513
516
|
/** Represents an InboundClassValue. */
|
|
@@ -522,9 +525,6 @@ export namespace baml_bridge {
|
|
|
522
525
|
/** InboundClassValue fields. */
|
|
523
526
|
public fields: baml_bridge.cffi.v1.IInboundMapEntry[];
|
|
524
527
|
|
|
525
|
-
/** InboundClassValue classTy. */
|
|
526
|
-
public classTy?: (baml_bridge.cffi.v1.IBamlTyClass|null);
|
|
527
|
-
|
|
528
528
|
/**
|
|
529
529
|
* Creates a new InboundClassValue instance using the specified properties.
|
|
530
530
|
* @param [properties] Properties to set
|
|
@@ -820,6 +820,12 @@ export namespace baml_bridge {
|
|
|
820
820
|
|
|
821
821
|
/** CallFunctionArgs typeArgs */
|
|
822
822
|
typeArgs?: (baml_bridge.cffi.v1.IBamlTyArg[]|null);
|
|
823
|
+
|
|
824
|
+
/** CallFunctionArgs functionName */
|
|
825
|
+
functionName?: (string|null);
|
|
826
|
+
|
|
827
|
+
/** CallFunctionArgs functionHandle */
|
|
828
|
+
functionHandle?: (number|Long|null);
|
|
823
829
|
}
|
|
824
830
|
|
|
825
831
|
/** Represents a CallFunctionArgs. */
|
|
@@ -840,6 +846,15 @@ export namespace baml_bridge {
|
|
|
840
846
|
/** CallFunctionArgs typeArgs. */
|
|
841
847
|
public typeArgs: baml_bridge.cffi.v1.IBamlTyArg[];
|
|
842
848
|
|
|
849
|
+
/** CallFunctionArgs functionName. */
|
|
850
|
+
public functionName?: (string|null);
|
|
851
|
+
|
|
852
|
+
/** CallFunctionArgs functionHandle. */
|
|
853
|
+
public functionHandle?: (number|Long|null);
|
|
854
|
+
|
|
855
|
+
/** CallFunctionArgs callTarget. */
|
|
856
|
+
public callTarget?: ("functionName"|"functionHandle");
|
|
857
|
+
|
|
843
858
|
/**
|
|
844
859
|
* Creates a new CallFunctionArgs instance using the specified properties.
|
|
845
860
|
* @param [properties] Properties to set
|
|
@@ -3609,6 +3624,9 @@ export namespace baml_bridge {
|
|
|
3609
3624
|
|
|
3610
3625
|
/** BamlTyTypeVar name */
|
|
3611
3626
|
name?: (string|null);
|
|
3627
|
+
|
|
3628
|
+
/** BamlTyTypeVar index */
|
|
3629
|
+
index?: (number|null);
|
|
3612
3630
|
}
|
|
3613
3631
|
|
|
3614
3632
|
/** Represents a BamlTyTypeVar. */
|
|
@@ -3623,6 +3641,9 @@ export namespace baml_bridge {
|
|
|
3623
3641
|
/** BamlTyTypeVar name. */
|
|
3624
3642
|
public name: string;
|
|
3625
3643
|
|
|
3644
|
+
/** BamlTyTypeVar index. */
|
|
3645
|
+
public index: number;
|
|
3646
|
+
|
|
3626
3647
|
/**
|
|
3627
3648
|
* Creates a new BamlTyTypeVar instance using the specified properties.
|
|
3628
3649
|
* @param [properties] Properties to set
|
|
@@ -5180,6 +5201,9 @@ export namespace baml_bridge {
|
|
|
5180
5201
|
|
|
5181
5202
|
/** BamlValueUnionVariant value */
|
|
5182
5203
|
value?: (baml_bridge.cffi.v1.IBamlOutboundValue|null);
|
|
5204
|
+
|
|
5205
|
+
/** BamlValueUnionVariant selectedOptionIndex */
|
|
5206
|
+
selectedOptionIndex?: (number|null);
|
|
5183
5207
|
}
|
|
5184
5208
|
|
|
5185
5209
|
/** Represents a BamlValueUnionVariant. */
|
|
@@ -5209,6 +5233,9 @@ export namespace baml_bridge {
|
|
|
5209
5233
|
/** BamlValueUnionVariant value. */
|
|
5210
5234
|
public value?: (baml_bridge.cffi.v1.IBamlOutboundValue|null);
|
|
5211
5235
|
|
|
5236
|
+
/** BamlValueUnionVariant selectedOptionIndex. */
|
|
5237
|
+
public selectedOptionIndex?: (number|null);
|
|
5238
|
+
|
|
5212
5239
|
/**
|
|
5213
5240
|
* Creates a new BamlValueUnionVariant instance using the specified properties.
|
|
5214
5241
|
* @param [properties] Properties to set
|