@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
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
// define_function.ts — runtime factories for BAML callables, the Node analog
|
|
2
|
+
// of `define_function` in sdks/python/src/baml_bridge/__init__.py.
|
|
3
|
+
//
|
|
4
|
+
// Generated SDK code emits, per BAML function:
|
|
5
|
+
// export const f = defineFunction("user.ns.f", "sync", ["a"]) as (a: A) => R;
|
|
6
|
+
// export const f_async = defineFunction("user.ns.f", "async", ["a"]) as (a: A) => Promise<R>;
|
|
7
|
+
// and per instance method (inside the class body):
|
|
8
|
+
// m = defineInstanceFunction("user.ns.C.m", "sync", ["self"]).bind(this) as () => R;
|
|
9
|
+
//
|
|
10
|
+
// The factory captures (fqn, mode, requiredNames, optionalNames) by closure;
|
|
11
|
+
// the returned callable zips positional args against requiredNames into kwargs,
|
|
12
|
+
// encodes it, calls the runtime, and decodes the result.
|
|
13
|
+
import { getRuntime, newFunctionCall as nativeNewFunctionCall, } from '../native.js';
|
|
14
|
+
import { encodeCallArgs, decodeCallResult } from './proto.js';
|
|
15
|
+
import { lowerTypeToWireTy } from './wire_ty.js';
|
|
16
|
+
/** Sentinel for "argument not supplied" so optional kwargs can be skipped. */
|
|
17
|
+
export const UNSET = Symbol('baml.UNSET');
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the caller's `$types` option onto the callee's own generic params, in
|
|
20
|
+
* declaration order. Mirrors Python's `_resolve_types_kwarg`: `$types` is an
|
|
21
|
+
* object keyed by param name and is required iff the callee declares its own
|
|
22
|
+
* generic params; it must bind exactly those params (no missing, no extras).
|
|
23
|
+
*/
|
|
24
|
+
function resolveTypesOption(typesOpt, typeParams) {
|
|
25
|
+
if (typeParams.length === 0) {
|
|
26
|
+
if (typesOpt !== undefined && typesOpt !== null) {
|
|
27
|
+
throw new TypeError('$types is not accepted here: this function/method declares no generic type ' +
|
|
28
|
+
'parameters of its own');
|
|
29
|
+
}
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
const example = `{ ${JSON.stringify(typeParams[0])}: 'int' }`;
|
|
33
|
+
if (typesOpt === undefined || typesOpt === null) {
|
|
34
|
+
throw new TypeError(`$types is required for this generic call: bind every type parameter in ` +
|
|
35
|
+
`${JSON.stringify(typeParams)} with an object, e.g. $types: ${example}`);
|
|
36
|
+
}
|
|
37
|
+
if (typeof typesOpt !== 'object' || Array.isArray(typesOpt)) {
|
|
38
|
+
throw new TypeError(`$types must be an object mapping type-parameter names to types (e.g. ` +
|
|
39
|
+
`$types: ${example}); got ${typeof typesOpt}`);
|
|
40
|
+
}
|
|
41
|
+
const obj = typesOpt;
|
|
42
|
+
const missing = typeParams.filter((n) => !(n in obj));
|
|
43
|
+
if (missing.length) {
|
|
44
|
+
throw new TypeError(`$types is missing binding(s) for ${JSON.stringify(missing)}: every type parameter ` +
|
|
45
|
+
`in ${JSON.stringify(typeParams)} must be bound.`);
|
|
46
|
+
}
|
|
47
|
+
const extra = Object.keys(obj).filter((k) => !typeParams.includes(k));
|
|
48
|
+
if (extra.length) {
|
|
49
|
+
throw new TypeError(`$types has unknown type parameter(s) ${JSON.stringify(extra)}; expected exactly ` +
|
|
50
|
+
`${JSON.stringify(typeParams)}.`);
|
|
51
|
+
}
|
|
52
|
+
return typeParams.map((n) => obj[n]);
|
|
53
|
+
}
|
|
54
|
+
/** The `$types` field of a generic receiver instance (its class TypeVar
|
|
55
|
+
* bindings), or `undefined` when the receiver carries none. The TS analog of
|
|
56
|
+
* Python's `pydantic_instance_type_args(self)`. */
|
|
57
|
+
function receiverTypes(self) {
|
|
58
|
+
if (self != null && typeof self === 'object') {
|
|
59
|
+
const t = self.$types;
|
|
60
|
+
if (t != null && typeof t === 'object') {
|
|
61
|
+
return t;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build the named, order-preserving wire `type_args` for a generic call. Mirrors
|
|
68
|
+
* Python's `_build_type_args`: enclosing class params (recovered from the `self`
|
|
69
|
+
* receiver's `$types`) come first, then the callee's own params (`$types`
|
|
70
|
+
* option) — De Bruijn order. Class params are seeded only when the receiver
|
|
71
|
+
* actually carries them, so a non-generic receiver keeps the engine's
|
|
72
|
+
* recover-from-receiver behavior. Returns `[]` when the call binds nothing.
|
|
73
|
+
*/
|
|
74
|
+
function buildTypeArgs(self, typesOpt, typeParams, classTypeParams) {
|
|
75
|
+
const wire = [];
|
|
76
|
+
const classTypes = classTypeParams.length ? receiverTypes(self) : undefined;
|
|
77
|
+
if (classTypes) {
|
|
78
|
+
for (const name of classTypeParams) {
|
|
79
|
+
wire.push([name, lowerTypeToWireTy(classTypes[name])]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const resolved = resolveTypesOption(typesOpt, typeParams);
|
|
83
|
+
if (typeParams.length > 0) {
|
|
84
|
+
if (classTypeParams.length && !classTypes) {
|
|
85
|
+
// The method's own params sit after the class prefix in De Bruijn
|
|
86
|
+
// order; without recovered class args we can't position them.
|
|
87
|
+
throw new TypeError('$types on a generic method requires a generic receiver carrying its class type ' +
|
|
88
|
+
'args (a `$types` field on the instance)');
|
|
89
|
+
}
|
|
90
|
+
typeParams.forEach((name, i) => {
|
|
91
|
+
wire.push([name, lowerTypeToWireTy(resolved[i])]);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return wire;
|
|
95
|
+
}
|
|
96
|
+
function newFunctionCall() {
|
|
97
|
+
return BigInt(nativeNewFunctionCall());
|
|
98
|
+
}
|
|
99
|
+
function attachCallContext(ctx, callId) {
|
|
100
|
+
ctx?._attachCallId(callId.toString());
|
|
101
|
+
return {
|
|
102
|
+
detach() {
|
|
103
|
+
ctx?._detachCallId(callId.toString());
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function buildArgs(args, requiredParamNames, optionalParamNames) {
|
|
108
|
+
const positionalLimit = requiredParamNames.length;
|
|
109
|
+
if (args.length > positionalLimit + 1) {
|
|
110
|
+
throw new TypeError(`got ${args.length} positional arguments but only ${positionalLimit} positional ` +
|
|
111
|
+
`parameter names (${JSON.stringify(requiredParamNames)})`);
|
|
112
|
+
}
|
|
113
|
+
const built = {};
|
|
114
|
+
for (let i = 0; i < args.length && i < positionalLimit; i++) {
|
|
115
|
+
if (args[i] === UNSET)
|
|
116
|
+
continue;
|
|
117
|
+
built[requiredParamNames[i]] = args[i];
|
|
118
|
+
}
|
|
119
|
+
let ctx;
|
|
120
|
+
let types;
|
|
121
|
+
if (args.length > positionalLimit) {
|
|
122
|
+
const opts = args[positionalLimit];
|
|
123
|
+
if (opts === undefined || opts === UNSET) {
|
|
124
|
+
return { kwargs: built };
|
|
125
|
+
}
|
|
126
|
+
if (opts === null || Array.isArray(opts) || typeof opts !== 'object') {
|
|
127
|
+
throw new TypeError('optional arguments must be passed as an object');
|
|
128
|
+
}
|
|
129
|
+
const optionNames = new Set(optionalParamNames);
|
|
130
|
+
for (const [key, value] of Object.entries(opts)) {
|
|
131
|
+
if (key === '$ctx') {
|
|
132
|
+
if (value !== undefined && value !== UNSET) {
|
|
133
|
+
ctx = value;
|
|
134
|
+
}
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (key === '$types') {
|
|
138
|
+
// Generic-call TypeVar bindings — captured here and lowered to
|
|
139
|
+
// wire `type_args` by the factory, never sent as a kwarg value.
|
|
140
|
+
if (value !== undefined && value !== UNSET) {
|
|
141
|
+
types = value;
|
|
142
|
+
}
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (!optionNames.has(key)) {
|
|
146
|
+
throw new TypeError(`unknown optional argument ${JSON.stringify(key)}`);
|
|
147
|
+
}
|
|
148
|
+
if (value === undefined || value === UNSET)
|
|
149
|
+
continue;
|
|
150
|
+
built[key] = value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return { kwargs: built, ctx, types };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Factory for a free function or static method binding. Returns a callable
|
|
157
|
+
* that maps positional args to kwargs, encodes, calls the runtime, and decodes.
|
|
158
|
+
* `sync` returns the decoded value; `async` returns a `Promise` of it.
|
|
159
|
+
*/
|
|
160
|
+
export function defineFunction(bamlFqn, mode, requiredParamNames, optionalParamNames, generics) {
|
|
161
|
+
const requiredNames = [...requiredParamNames];
|
|
162
|
+
const optionNames = [...(optionalParamNames ?? [])];
|
|
163
|
+
// A free function / static method binds only its OWN generic params (a
|
|
164
|
+
// generic receiver is never in play here), so `classTypeParams` is unused.
|
|
165
|
+
const typeParams = generics?.typeParams ?? [];
|
|
166
|
+
const isGeneric = typeParams.length > 0;
|
|
167
|
+
// Eagerly reject `$types` on a non-generic call, matching the generic path's
|
|
168
|
+
// strict binding contract (mirrors Python's `is_generic` gate).
|
|
169
|
+
const typeArgsFor = (built) => isGeneric ? buildTypeArgs(undefined, built.types, typeParams, []) : [];
|
|
170
|
+
if (mode === 'sync') {
|
|
171
|
+
return (...args) => {
|
|
172
|
+
const built = buildArgs(args, requiredNames, optionNames);
|
|
173
|
+
const typeArgs = typeArgsFor(built);
|
|
174
|
+
const rt = getRuntime();
|
|
175
|
+
const callId = newFunctionCall();
|
|
176
|
+
const argsProto = encodeCallArgs(built.kwargs, { syncMode: true, callId, typeArgs });
|
|
177
|
+
const callCtxBinding = attachCallContext(built.ctx, callId);
|
|
178
|
+
let resultBytes;
|
|
179
|
+
try {
|
|
180
|
+
resultBytes = rt.callFunctionSync(bamlFqn, argsProto, null, null);
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
callCtxBinding.detach();
|
|
184
|
+
}
|
|
185
|
+
return decodeCallResult(resultBytes);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
if (mode === 'async') {
|
|
189
|
+
return async (...args) => {
|
|
190
|
+
const built = buildArgs(args, requiredNames, optionNames);
|
|
191
|
+
const typeArgs = typeArgsFor(built);
|
|
192
|
+
const rt = getRuntime();
|
|
193
|
+
const callId = newFunctionCall();
|
|
194
|
+
const argsProto = encodeCallArgs(built.kwargs, { callId, typeArgs });
|
|
195
|
+
const callCtxBinding = attachCallContext(built.ctx, callId);
|
|
196
|
+
let resultBytes;
|
|
197
|
+
try {
|
|
198
|
+
resultBytes = await rt.callFunction(bamlFqn, argsProto, null, null);
|
|
199
|
+
}
|
|
200
|
+
finally {
|
|
201
|
+
callCtxBinding.detach();
|
|
202
|
+
}
|
|
203
|
+
return decodeCallResult(resultBytes);
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
throw new Error(`mode must be 'sync' or 'async', got ${JSON.stringify(mode)}`);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Receiver-binding factory for instance methods. `paramNames[0]` is always
|
|
210
|
+
* `"self"`. Codegen emits the binding as a class-field initializer
|
|
211
|
+
* `m = defineInstanceFunction(...).bind(this) as () => R;`, so `.bind(self)`
|
|
212
|
+
* captures the instance at construction time; the synthetic `self` param never
|
|
213
|
+
* appears in the surface type.
|
|
214
|
+
*/
|
|
215
|
+
export function defineInstanceFunction(bamlFqn, mode, requiredParamNames, optionalParamNames, generics) {
|
|
216
|
+
const requiredNames = [...requiredParamNames];
|
|
217
|
+
const optionNames = [...(optionalParamNames ?? [])];
|
|
218
|
+
const selfName = requiredNames[0] ?? 'self';
|
|
219
|
+
const rest = requiredNames.slice(1);
|
|
220
|
+
// An instance method binds its own `<...>` params (caller's `$types`) AND
|
|
221
|
+
// the enclosing class's params, recovered from the `self` receiver's
|
|
222
|
+
// `$types` field. Mirrors Python's `class_type_params` for instance methods.
|
|
223
|
+
const typeParams = generics?.typeParams ?? [];
|
|
224
|
+
const classTypeParams = generics?.classTypeParams ?? [];
|
|
225
|
+
const isGeneric = typeParams.length > 0 || classTypeParams.length > 0;
|
|
226
|
+
const makeArgs = (self, args) => {
|
|
227
|
+
const built = buildArgs(args, rest, optionNames);
|
|
228
|
+
built.kwargs[selfName] = self;
|
|
229
|
+
return built;
|
|
230
|
+
};
|
|
231
|
+
return {
|
|
232
|
+
bind(self) {
|
|
233
|
+
const typeArgsFor = (built) => isGeneric ? buildTypeArgs(self, built.types, typeParams, classTypeParams) : [];
|
|
234
|
+
if (mode === 'sync') {
|
|
235
|
+
return (...args) => {
|
|
236
|
+
const built = makeArgs(self, args);
|
|
237
|
+
const typeArgs = typeArgsFor(built);
|
|
238
|
+
const rt = getRuntime();
|
|
239
|
+
const callId = newFunctionCall();
|
|
240
|
+
const argsProto = encodeCallArgs(built.kwargs, { syncMode: true, callId, typeArgs });
|
|
241
|
+
const callCtxBinding = attachCallContext(built.ctx, callId);
|
|
242
|
+
let resultBytes;
|
|
243
|
+
try {
|
|
244
|
+
resultBytes = rt.callFunctionSync(bamlFqn, argsProto, null, null);
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
callCtxBinding.detach();
|
|
248
|
+
}
|
|
249
|
+
return decodeCallResult(resultBytes);
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
if (mode === 'async') {
|
|
253
|
+
return async (...args) => {
|
|
254
|
+
const built = makeArgs(self, args);
|
|
255
|
+
const typeArgs = typeArgsFor(built);
|
|
256
|
+
const rt = getRuntime();
|
|
257
|
+
const callId = newFunctionCall();
|
|
258
|
+
const argsProto = encodeCallArgs(built.kwargs, { callId, typeArgs });
|
|
259
|
+
const callCtxBinding = attachCallContext(built.ctx, callId);
|
|
260
|
+
let resultBytes;
|
|
261
|
+
try {
|
|
262
|
+
resultBytes = await rt.callFunction(bamlFqn, argsProto, null, null);
|
|
263
|
+
}
|
|
264
|
+
finally {
|
|
265
|
+
callCtxBinding.detach();
|
|
266
|
+
}
|
|
267
|
+
return decodeCallResult(resultBytes);
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
throw new Error(`mode must be 'sync' or 'async', got ${JSON.stringify(mode)}`);
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=define_function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define_function.js","sourceRoot":"","sources":["../../typescript_src/shared/define_function.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,+CAA+C;AAC/C,gFAAgF;AAChF,gGAAgG;AAChG,mDAAmD;AACnD,uFAAuF;AACvF,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,yDAAyD;AAEzD,OAAO,EAEH,UAAU,EACV,eAAe,IAAI,qBAAqB,GAC3C,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAiB,MAAM,cAAc,CAAC;AAIhE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,KAAK,GAAkB,MAAM,CAAC,YAAY,CAAC,CAAC;AAwBzD;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,QAAiB,EAAE,UAA6B;IACxE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC9C,MAAM,IAAI,SAAS,CACf,6EAA6E;gBAC7E,uBAAuB,CAC1B,CAAC;QACN,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;IAC9D,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC9C,MAAM,IAAI,SAAS,CACf,yEAAyE;YACzE,GAAG,IAAI,CAAC,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I,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured detail carried by a thrown `BamlError` / `BamlPanic`, mirroring
|
|
3
|
+
* `bridge_python`'s `BamlError(value, baml_trace=..., class_name=...)`.
|
|
4
|
+
*
|
|
5
|
+
* - `value`: the fully decoded thrown BAML value (a generated class instance
|
|
6
|
+
* when the FQN is mapped, else a plain object / primitive).
|
|
7
|
+
* - `bamlTrace`: the pre-rendered `File "...", line N, in fn` frame strings
|
|
8
|
+
* from the BAML stack.
|
|
9
|
+
* - `className`: the thrown value's BAML FQN when known (e.g.
|
|
10
|
+
* `baml.json.JsonParseError`).
|
|
11
|
+
*/
|
|
12
|
+
export interface BamlErrorDetail {
|
|
13
|
+
value?: unknown;
|
|
14
|
+
bamlTrace?: string[];
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class BamlError extends Error {
|
|
18
|
+
/** The decoded thrown BAML value, or `undefined` for SDK-internal errors. */
|
|
19
|
+
readonly value: unknown;
|
|
20
|
+
/** Pre-rendered BAML stack frames; empty for SDK-internal errors. */
|
|
21
|
+
readonly bamlTrace: string[];
|
|
22
|
+
/** The thrown value's BAML FQN, when known. */
|
|
23
|
+
readonly className: string | undefined;
|
|
24
|
+
constructor(message: string, detail?: BamlErrorDetail);
|
|
25
|
+
}
|
|
26
|
+
export declare class BamlInvalidArgumentError extends BamlError {
|
|
27
|
+
constructor(message: string);
|
|
28
|
+
}
|
|
29
|
+
export declare class BamlClientError extends BamlError {
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
export declare class BamlCancelledError extends BamlError {
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
35
|
+
export declare class BamlAbortError extends Error {
|
|
36
|
+
readonly reason: unknown;
|
|
37
|
+
constructor(message: string, options?: {
|
|
38
|
+
reason?: unknown;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Raised for SDK-setup failures and BAML-runtime panics — the Node analog of
|
|
43
|
+
* `bridge_python`'s `BamlPanic`. The in-call panic path (`decodeCallResult`'s
|
|
44
|
+
* `panic` arm) and the `getRuntime` not-initialized path both surface this,
|
|
45
|
+
* except clean process-exit panics, which exit after flushing telemetry.
|
|
46
|
+
*/
|
|
47
|
+
export declare class BamlPanic extends BamlError {
|
|
48
|
+
constructor(message: string, detail?: BamlErrorDetail);
|
|
49
|
+
}
|
|
50
|
+
export declare function wrapNativeError(err: unknown): BamlError;
|
|
51
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,SAAU,SAAQ,KAAK;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe;CAOxD;AAED,qBAAa,wBAAyB,SAAQ,SAAS;gBACvC,OAAO,EAAE,MAAM;CAI9B;AAED,qBAAa,eAAgB,SAAQ,SAAS;gBAC9B,OAAO,EAAE,MAAM;CAI9B;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACjC,OAAO,EAAE,MAAM;CAI9B;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,CAGvD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// errors.ts — mirrors bridge_python/python_src/baml_py/errors.py
|
|
2
|
+
export class BamlError extends Error {
|
|
3
|
+
/** The decoded thrown BAML value, or `undefined` for SDK-internal errors. */
|
|
4
|
+
value;
|
|
5
|
+
/** Pre-rendered BAML stack frames; empty for SDK-internal errors. */
|
|
6
|
+
bamlTrace;
|
|
7
|
+
/** The thrown value's BAML FQN, when known. */
|
|
8
|
+
className;
|
|
9
|
+
constructor(message, detail) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = 'BamlError';
|
|
12
|
+
this.value = detail?.value;
|
|
13
|
+
this.bamlTrace = detail?.bamlTrace ? [...detail.bamlTrace] : [];
|
|
14
|
+
this.className = detail?.className;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class BamlInvalidArgumentError extends BamlError {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'BamlInvalidArgumentError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class BamlClientError extends BamlError {
|
|
24
|
+
constructor(message) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = 'BamlClientError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class BamlCancelledError extends BamlError {
|
|
30
|
+
constructor(message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = 'BamlCancelledError';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export class BamlAbortError extends Error {
|
|
36
|
+
reason;
|
|
37
|
+
constructor(message, options) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = 'AbortError';
|
|
40
|
+
this.reason = options?.reason;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Raised for SDK-setup failures and BAML-runtime panics — the Node analog of
|
|
45
|
+
* `bridge_python`'s `BamlPanic`. The in-call panic path (`decodeCallResult`'s
|
|
46
|
+
* `panic` arm) and the `getRuntime` not-initialized path both surface this,
|
|
47
|
+
* except clean process-exit panics, which exit after flushing telemetry.
|
|
48
|
+
*/
|
|
49
|
+
export class BamlPanic extends BamlError {
|
|
50
|
+
constructor(message, detail) {
|
|
51
|
+
super(message, detail);
|
|
52
|
+
this.name = 'BamlPanic';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function wrapNativeError(err) {
|
|
56
|
+
if (!(err instanceof Error))
|
|
57
|
+
return new BamlError(String(err));
|
|
58
|
+
return new BamlError(err.message);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +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;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type HandleKey } from '../native.js';
|
|
2
|
+
/**
|
|
3
|
+
* Register an arbitrary host JS value and return its native `HandleKey` for
|
|
4
|
+
* the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a
|
|
5
|
+
* `baml.errors.HostCallable` Instance (or any future opaque-value carrier).
|
|
6
|
+
* Mints a fresh key via the Rust side's shared counter (guaranteed non-zero —
|
|
7
|
+
* Rust `next_key` skips `0`); stores the value keyed by the same key
|
|
8
|
+
* (recomposed as a `bigint` for `Map`-key equality).
|
|
9
|
+
*
|
|
10
|
+
* Returns the native `HandleKey` directly so it can flow into the
|
|
11
|
+
* protobufjs encoder without an intermediate `bigint→Long` conversion
|
|
12
|
+
* (protobufjs reads `uint64` fields from a `{low, high}` shape, which
|
|
13
|
+
* the native `HandleKey` already provides; a bare `bigint` does not
|
|
14
|
+
* encode correctly through the `IInboundValue.handle.key` field).
|
|
15
|
+
*/
|
|
16
|
+
export declare function registerHostOpaque(value: unknown): HandleKey;
|
|
17
|
+
/**
|
|
18
|
+
* Look up a host-registered JS value by key. Returns `undefined` when:
|
|
19
|
+
* - the key is the reserved sentinel `0n` (no real value was registered);
|
|
20
|
+
* - the engine has already released the entry (last `HostValueArc` clone
|
|
21
|
+
* dropped → Rust `host_release_callback` fired → `_releaseHostValue`
|
|
22
|
+
* removed the entry);
|
|
23
|
+
* - the key was minted by a different Node process (cross-runtime handle).
|
|
24
|
+
*
|
|
25
|
+
* Callers should fall back to a metadata-built exception in those cases.
|
|
26
|
+
*
|
|
27
|
+
* GC/decode race: a release notification and a rehydrating decode can be
|
|
28
|
+
* scheduled on the libuv loop concurrently in principle, but in practice
|
|
29
|
+
* the same `HostValueArc` cannot drop *while* the engine is actively
|
|
30
|
+
* emitting an outbound proto referencing its key — the outbound encode
|
|
31
|
+
* holds a strong handle through proto serialization, and the release tsfn
|
|
32
|
+
* isn't fired until that strong handle drops. By the time the TS decoder
|
|
33
|
+
* runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if
|
|
34
|
+
* a *prior* outbound completed and the engine has since dropped its last
|
|
35
|
+
* Arc; in that case the user has already observed the original throw at
|
|
36
|
+
* least once, so a second lookup-miss → metadata-fallback is acceptable.
|
|
37
|
+
*/
|
|
38
|
+
export declare function lookupHostValue(key: bigint): unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Convenience for the outbound decoder: if `handle` is a `BamlHandle`
|
|
41
|
+
* tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in
|
|
42
|
+
* the registry and return it. Returns `undefined` for any other handle
|
|
43
|
+
* type, a non-`BamlHandle` argument, or a key that doesn't resolve.
|
|
44
|
+
*
|
|
45
|
+
* Used by `decodeCallResult`'s `error` arm to rehydrate the original JS
|
|
46
|
+
* exception when a BAML-thrown `baml.errors.HostCallable` propagates back
|
|
47
|
+
* to the same Node process that originated it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function tryRehydrateHostValueByKey(handle: unknown): unknown;
|
|
50
|
+
//# sourceMappingURL=host_value_registry.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// host_value_registry.ts — mirrors bridge_python's `register_host_opaque`
|
|
2
|
+
// + `lookup_host_value` pair.
|
|
3
|
+
//
|
|
4
|
+
// An arbitrary host JS value round-trips back to the *same* Node process as
|
|
5
|
+
// the *same* object (identity preserved), not flattened into a metadata-only
|
|
6
|
+
// wrapper. A native JS exception raised inside a user callable is the primary
|
|
7
|
+
// consumer: it round-trips as the *same* `Error` object (`raised === caught`
|
|
8
|
+
// identity), not a metadata-only `BamlError(HostCallable(...))` wrapper. The
|
|
9
|
+
// plumbing:
|
|
10
|
+
//
|
|
11
|
+
// 1. The TS bridge catches the JS error inside `sendHostCallableError`
|
|
12
|
+
// (proto.ts) and calls `registerHostOpaque(err)` here.
|
|
13
|
+
// 2. `registerHostOpaque` mints a globally-unique key via
|
|
14
|
+
// `native.mintHostValueKey` (drawing from the shared callable+opaque
|
|
15
|
+
// counter on the Rust side so the engine sees one keyspace), stores
|
|
16
|
+
// the JS value in the local `Map<bigint, unknown>`, returns the key.
|
|
17
|
+
// 3. The bridge emits an `InboundValue.Class(name="baml.errors.HostCallable",
|
|
18
|
+
// fields=[..., _handle: Handle(HOST_VALUE_OPAQUE, key)])`. The engine
|
|
19
|
+
// interns an `Arc<HostValueArc>` per the same key.
|
|
20
|
+
// 4. When BAML propagates the throw back out to the host, the outbound
|
|
21
|
+
// encoder re-emits the `_handle: Handle(HOST_VALUE_OPAQUE, key)`. The
|
|
22
|
+
// TS decoder (proto.ts) inspects a decoded `HostCallable` instance,
|
|
23
|
+
// reads `_handle.key`, calls `lookupHostValue(key)` here, and re-throws
|
|
24
|
+
// the original JS error.
|
|
25
|
+
// 5. When the engine drops its last `Arc<HostValueArc>(key)`, the Rust
|
|
26
|
+
// `host_release_callback` fires the TS-installed release callback
|
|
27
|
+
// (`native.registerHostValueReleaseCallback`), which calls `_releaseHostValue`
|
|
28
|
+
// here to remove the map entry.
|
|
29
|
+
//
|
|
30
|
+
// Foreign runtimes (a different Node process, the Python bridge, etc.) see
|
|
31
|
+
// a `_handle` whose key doesn't resolve in their local registry; the
|
|
32
|
+
// decoder falls back to the metadata-bearing `BamlError(HostCallable(...))`
|
|
33
|
+
// wrapper. The reserved `0` is used as a sentinel by code paths that
|
|
34
|
+
// cannot register a real JS value (engine-internal synthetic faults like
|
|
35
|
+
// "no JS callable for this key"); `_releaseHostValue(0n)` is a benign
|
|
36
|
+
// no-op since `mintHostValueKey` never returns `0`.
|
|
37
|
+
import { mintHostValueKey, registerHostValueReleaseCallback, BamlHandle } from '../native.js';
|
|
38
|
+
import { baml_bridge } from './proto/baml_cffi.js';
|
|
39
|
+
const BamlHandleType = baml_bridge.cffi.v1.BamlHandleType;
|
|
40
|
+
const hostValueMap = new Map();
|
|
41
|
+
/**
|
|
42
|
+
* Convert a `HandleKey` (`{ low, high }`) to a `bigint` for use as a `Map` key.
|
|
43
|
+
* Native `HandleKey` instances split a `u64` across two `i32` low/high halves
|
|
44
|
+
* (signed, two's-complement). Recompose by treating each half as a 32-bit
|
|
45
|
+
* unsigned value via `>>> 0`, then shift+or as `bigint`.
|
|
46
|
+
*
|
|
47
|
+
* The `>>> 0` coercion matters whenever either half's MSB is set: without it,
|
|
48
|
+
* a negative `i32` would widen to a negative `bigint` and corrupt the
|
|
49
|
+
* recomposed `u64`. Examples:
|
|
50
|
+
*
|
|
51
|
+
* - `{ low: 1, high: 0 }` → `0x1n` (small key, no MSB set)
|
|
52
|
+
* - `{ low: -1, high: -1 }` → `0xFFFFFFFFFFFFFFFFn` (u64::MAX; both halves'
|
|
53
|
+
* MSB set — `>>> 0` reinterprets `-1` as `0xFFFFFFFF` before widening)
|
|
54
|
+
* - `{ low: 0, high: 1 }` → `0x1_00000000n` (2^32)
|
|
55
|
+
*/
|
|
56
|
+
function handleKeyToBigint(key) {
|
|
57
|
+
const low = BigInt(key.low >>> 0);
|
|
58
|
+
const high = BigInt(key.high >>> 0);
|
|
59
|
+
return (high << 32n) | low;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Register an arbitrary host JS value and return its native `HandleKey` for
|
|
63
|
+
* the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a
|
|
64
|
+
* `baml.errors.HostCallable` Instance (or any future opaque-value carrier).
|
|
65
|
+
* Mints a fresh key via the Rust side's shared counter (guaranteed non-zero —
|
|
66
|
+
* Rust `next_key` skips `0`); stores the value keyed by the same key
|
|
67
|
+
* (recomposed as a `bigint` for `Map`-key equality).
|
|
68
|
+
*
|
|
69
|
+
* Returns the native `HandleKey` directly so it can flow into the
|
|
70
|
+
* protobufjs encoder without an intermediate `bigint→Long` conversion
|
|
71
|
+
* (protobufjs reads `uint64` fields from a `{low, high}` shape, which
|
|
72
|
+
* the native `HandleKey` already provides; a bare `bigint` does not
|
|
73
|
+
* encode correctly through the `IInboundValue.handle.key` field).
|
|
74
|
+
*/
|
|
75
|
+
export function registerHostOpaque(value) {
|
|
76
|
+
const key = mintHostValueKey();
|
|
77
|
+
hostValueMap.set(handleKeyToBigint(key), value);
|
|
78
|
+
return key;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Look up a host-registered JS value by key. Returns `undefined` when:
|
|
82
|
+
* - the key is the reserved sentinel `0n` (no real value was registered);
|
|
83
|
+
* - the engine has already released the entry (last `HostValueArc` clone
|
|
84
|
+
* dropped → Rust `host_release_callback` fired → `_releaseHostValue`
|
|
85
|
+
* removed the entry);
|
|
86
|
+
* - the key was minted by a different Node process (cross-runtime handle).
|
|
87
|
+
*
|
|
88
|
+
* Callers should fall back to a metadata-built exception in those cases.
|
|
89
|
+
*
|
|
90
|
+
* GC/decode race: a release notification and a rehydrating decode can be
|
|
91
|
+
* scheduled on the libuv loop concurrently in principle, but in practice
|
|
92
|
+
* the same `HostValueArc` cannot drop *while* the engine is actively
|
|
93
|
+
* emitting an outbound proto referencing its key — the outbound encode
|
|
94
|
+
* holds a strong handle through proto serialization, and the release tsfn
|
|
95
|
+
* isn't fired until that strong handle drops. By the time the TS decoder
|
|
96
|
+
* runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if
|
|
97
|
+
* a *prior* outbound completed and the engine has since dropped its last
|
|
98
|
+
* Arc; in that case the user has already observed the original throw at
|
|
99
|
+
* least once, so a second lookup-miss → metadata-fallback is acceptable.
|
|
100
|
+
*/
|
|
101
|
+
export function lookupHostValue(key) {
|
|
102
|
+
return hostValueMap.get(key);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Convenience for the outbound decoder: if `handle` is a `BamlHandle`
|
|
106
|
+
* tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in
|
|
107
|
+
* the registry and return it. Returns `undefined` for any other handle
|
|
108
|
+
* type, a non-`BamlHandle` argument, or a key that doesn't resolve.
|
|
109
|
+
*
|
|
110
|
+
* Used by `decodeCallResult`'s `error` arm to rehydrate the original JS
|
|
111
|
+
* exception when a BAML-thrown `baml.errors.HostCallable` propagates back
|
|
112
|
+
* to the same Node process that originated it.
|
|
113
|
+
*/
|
|
114
|
+
export function tryRehydrateHostValueByKey(handle) {
|
|
115
|
+
if (!(handle instanceof BamlHandle))
|
|
116
|
+
return undefined;
|
|
117
|
+
if (handle.handleType !== BamlHandleType.HOST_VALUE_OPAQUE)
|
|
118
|
+
return undefined;
|
|
119
|
+
return lookupHostValue(handleKeyToBigint(handle.key));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Internal: remove the map entry for `key`. Wired at module init as the
|
|
123
|
+
* Rust-side release callback. Idempotent and absent-key-safe so the same
|
|
124
|
+
* callback can be invoked for *every* `HostValueArc` release (including
|
|
125
|
+
* callable keys, which never have a TS-side host-value entry).
|
|
126
|
+
*/
|
|
127
|
+
function _releaseHostValue(key) {
|
|
128
|
+
hostValueMap.delete(handleKeyToBigint(key));
|
|
129
|
+
}
|
|
130
|
+
// Install the Rust-side release callback exactly once at module load. The
|
|
131
|
+
// napi function is itself first-call-wins on the Rust side, so reloads
|
|
132
|
+
// (e.g. test harnesses) are harmless.
|
|
133
|
+
registerHostValueReleaseCallback(_releaseHostValue);
|
|
134
|
+
//# sourceMappingURL=host_value_registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host_value_registry.js","sourceRoot":"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