@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.
Files changed (89) hide show
  1. package/dist/index.d.ts +3 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +16 -14
  4. package/dist/index.js.map +1 -1
  5. package/dist/native.d.ts +50 -14
  6. package/dist/native.d.ts.map +1 -1
  7. package/dist/native.js +327 -70
  8. package/dist/native.js.map +1 -1
  9. package/dist/platform.d.ts +4 -0
  10. package/dist/platform.d.ts.map +1 -0
  11. package/dist/platform.js +5 -0
  12. package/dist/platform.js.map +1 -0
  13. package/dist/shared/call_context.d.ts +7 -0
  14. package/dist/shared/call_context.d.ts.map +1 -0
  15. package/dist/shared/call_context.js +11 -0
  16. package/dist/shared/call_context.js.map +1 -0
  17. package/dist/shared/define_function.d.ts.map +1 -1
  18. package/dist/shared/define_function.js +13 -24
  19. package/dist/shared/define_function.js.map +1 -1
  20. package/dist/shared/errors.d.ts +4 -4
  21. package/dist/shared/errors.d.ts.map +1 -1
  22. package/dist/shared/errors.js +16 -10
  23. package/dist/shared/errors.js.map +1 -1
  24. package/dist/shared/host_value_registry.d.ts +5 -3
  25. package/dist/shared/host_value_registry.d.ts.map +1 -1
  26. package/dist/shared/host_value_registry.js +10 -6
  27. package/dist/shared/host_value_registry.js.map +1 -1
  28. package/dist/shared/platform.d.ts +4 -0
  29. package/dist/shared/platform.d.ts.map +1 -0
  30. package/dist/shared/platform.js +5 -0
  31. package/dist/shared/platform.js.map +1 -0
  32. package/dist/shared/proto/baml_cffi.d.ts +35 -8
  33. package/dist/shared/proto/baml_cffi.js +138 -25
  34. package/dist/shared/proto.d.ts +9 -5
  35. package/dist/shared/proto.d.ts.map +1 -1
  36. package/dist/shared/proto.js +197 -104
  37. package/dist/shared/proto.js.map +1 -1
  38. package/dist/shared/stream.d.ts +3 -2
  39. package/dist/shared/stream.d.ts.map +1 -1
  40. package/dist/shared/stream.js +22 -15
  41. package/dist/shared/stream.js.map +1 -1
  42. package/dist/wasm/bridge_web_core.d.ts +99 -68
  43. package/dist/wasm/bridge_web_core.js +519 -492
  44. package/dist/wasm/bridge_web_core_bg.wasm +0 -0
  45. package/dist/wasm/bridge_web_core_bg.wasm.d.ts +41 -27
  46. package/dist/wasm/package.json +1 -1
  47. package/dist/workerd/index.d.ts +3 -3
  48. package/dist/workerd/index.d.ts.map +1 -1
  49. package/dist/workerd/index.js +21 -14
  50. package/dist/workerd/index.js.map +1 -1
  51. package/dist/workerd/native.d.ts +50 -14
  52. package/dist/workerd/native.d.ts.map +1 -1
  53. package/dist/workerd/native.js +327 -70
  54. package/dist/workerd/shared/call_context.d.ts +7 -0
  55. package/dist/workerd/shared/call_context.d.ts.map +1 -0
  56. package/dist/workerd/shared/call_context.js +11 -0
  57. package/dist/workerd/shared/call_context.js.map +1 -0
  58. package/dist/workerd/shared/define_function.d.ts.map +1 -1
  59. package/dist/workerd/shared/define_function.js +13 -24
  60. package/dist/workerd/shared/define_function.js.map +1 -1
  61. package/dist/workerd/shared/errors.d.ts +4 -4
  62. package/dist/workerd/shared/errors.d.ts.map +1 -1
  63. package/dist/workerd/shared/errors.js +16 -10
  64. package/dist/workerd/shared/errors.js.map +1 -1
  65. package/dist/workerd/shared/host_value_registry.d.ts +5 -3
  66. package/dist/workerd/shared/host_value_registry.d.ts.map +1 -1
  67. package/dist/workerd/shared/host_value_registry.js +10 -6
  68. package/dist/workerd/shared/host_value_registry.js.map +1 -1
  69. package/dist/workerd/shared/platform.d.ts +4 -0
  70. package/dist/workerd/shared/platform.d.ts.map +1 -0
  71. package/dist/workerd/shared/platform.js +5 -0
  72. package/dist/workerd/shared/platform.js.map +1 -0
  73. package/dist/workerd/shared/proto/baml_cffi.d.ts +35 -8
  74. package/dist/workerd/shared/proto/baml_cffi.js +140 -25
  75. package/dist/workerd/shared/proto.d.ts +9 -5
  76. package/dist/workerd/shared/proto.d.ts.map +1 -1
  77. package/dist/workerd/shared/proto.js +197 -104
  78. package/dist/workerd/shared/proto.js.map +1 -1
  79. package/dist/workerd/shared/stream.d.ts +3 -2
  80. package/dist/workerd/shared/stream.d.ts.map +1 -1
  81. package/dist/workerd/shared/stream.js +22 -15
  82. package/dist/workerd/shared/stream.js.map +1 -1
  83. package/dist/workerd-wasm/bridge_web_core.d.ts +62 -45
  84. package/dist/workerd-wasm/bridge_web_core.js +3 -5
  85. package/dist/workerd-wasm/bridge_web_core_bg.js +519 -493
  86. package/dist/workerd-wasm/bridge_web_core_bg.wasm +0 -0
  87. package/dist/workerd-wasm/bridge_web_core_bg.wasm.d.ts +41 -27
  88. package/dist/workerd-wasm/package.json +1 -1
  89. package/package.json +22 -5
@@ -2412,6 +2412,8 @@ var require_minimal2 = __commonJS({
2412
2412
 
2413
2413
  // typescript_src/shared/proto/baml_cffi.js
2414
2414
  var $protobuf = __toESM(require_minimal2(), 1);
2415
+ $protobuf.util.Buffer = null;
2416
+ $protobuf.configure();
2415
2417
  var $Reader = $protobuf.Reader;
2416
2418
  var $Writer = $protobuf.Writer;
2417
2419
  var $util = $protobuf.util;
@@ -2430,6 +2432,7 @@ var baml_bridge = $root.baml_bridge = (() => {
2430
2432
  this[keys[i]] = properties[keys[i]];
2431
2433
  }
2432
2434
  }
2435
+ InboundValue.prototype.valueType = null;
2433
2436
  InboundValue.prototype.stringValue = null;
2434
2437
  InboundValue.prototype.intValue = null;
2435
2438
  InboundValue.prototype.floatValue = null;
@@ -2457,6 +2460,11 @@ var baml_bridge = $root.baml_bridge = (() => {
2457
2460
  q = 0;
2458
2461
  if (q > $util.recursionLimit)
2459
2462
  throw Error("max depth exceeded");
2463
+ if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType"))
2464
+ $root.baml_bridge.cffi.v1.BamlTy.encode(message.valueType, writer.uint32(
2465
+ /* id 1, wireType 2 =*/
2466
+ 10
2467
+ ).fork(), q + 1).ldelim();
2460
2468
  if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue"))
2461
2469
  writer.uint32(
2462
2470
  /* id 2, wireType 2 =*/
@@ -2535,6 +2543,10 @@ var baml_bridge = $root.baml_bridge = (() => {
2535
2543
  if (tag === error)
2536
2544
  break;
2537
2545
  switch (tag >>> 3) {
2546
+ case 1: {
2547
+ message.valueType = $root.baml_bridge.cffi.v1.BamlTy.decode(reader, reader.uint32(), void 0, long + 1);
2548
+ break;
2549
+ }
2538
2550
  case 2: {
2539
2551
  message.stringValue = reader.string();
2540
2552
  break;
@@ -2603,6 +2615,11 @@ var baml_bridge = $root.baml_bridge = (() => {
2603
2615
  if (long > $util.recursionLimit)
2604
2616
  return "maximum nesting depth exceeded";
2605
2617
  let properties = {};
2618
+ if (message.valueType != null && message.hasOwnProperty("valueType")) {
2619
+ let error = $root.baml_bridge.cffi.v1.BamlTy.verify(message.valueType, long + 1);
2620
+ if (error)
2621
+ return "valueType." + error;
2622
+ }
2606
2623
  if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
2607
2624
  properties.value = 1;
2608
2625
  if (!$util.isString(message.stringValue))
@@ -2715,6 +2732,11 @@ var baml_bridge = $root.baml_bridge = (() => {
2715
2732
  if (long > $util.recursionLimit)
2716
2733
  throw Error("maximum nesting depth exceeded");
2717
2734
  let message = new $root.baml_bridge.cffi.v1.InboundValue();
2735
+ if (object.valueType != null) {
2736
+ if (!$util.isObject(object.valueType))
2737
+ throw TypeError(".baml_bridge.cffi.v1.InboundValue.valueType: object expected");
2738
+ message.valueType = $root.baml_bridge.cffi.v1.BamlTy.fromObject(object.valueType, long + 1);
2739
+ }
2718
2740
  if (object.stringValue != null)
2719
2741
  message.stringValue = String(object.stringValue);
2720
2742
  if (object.intValue != null) {
@@ -2779,6 +2801,10 @@ var baml_bridge = $root.baml_bridge = (() => {
2779
2801
  if (q > $util.recursionLimit)
2780
2802
  throw Error("max depth exceeded");
2781
2803
  let object = {};
2804
+ if (options.defaults)
2805
+ object.valueType = null;
2806
+ if (message.valueType != null && message.hasOwnProperty("valueType"))
2807
+ object.valueType = $root.baml_bridge.cffi.v1.BamlTy.toObject(message.valueType, options, q + 1);
2782
2808
  if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
2783
2809
  object.stringValue = message.stringValue;
2784
2810
  if (options.oneofs)
@@ -3360,7 +3386,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3360
3386
  }
3361
3387
  }
3362
3388
  InboundClassValue.prototype.fields = $util.emptyArray;
3363
- InboundClassValue.prototype.classTy = null;
3364
3389
  InboundClassValue.create = function create(properties) {
3365
3390
  return new InboundClassValue(properties);
3366
3391
  };
@@ -3377,11 +3402,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3377
3402
  /* id 2, wireType 2 =*/
3378
3403
  18
3379
3404
  ).fork(), q + 1).ldelim();
3380
- if (message.classTy != null && Object.hasOwnProperty.call(message, "classTy"))
3381
- $root.baml_bridge.cffi.v1.BamlTyClass.encode(message.classTy, writer.uint32(
3382
- /* id 3, wireType 2 =*/
3383
- 26
3384
- ).fork(), q + 1).ldelim();
3385
3405
  return writer;
3386
3406
  };
3387
3407
  InboundClassValue.encodeDelimited = function encodeDelimited(message, writer) {
@@ -3406,10 +3426,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3406
3426
  message.fields.push($root.baml_bridge.cffi.v1.InboundMapEntry.decode(reader, reader.uint32(), void 0, long + 1));
3407
3427
  break;
3408
3428
  }
3409
- case 3: {
3410
- message.classTy = $root.baml_bridge.cffi.v1.BamlTyClass.decode(reader, reader.uint32(), void 0, long + 1);
3411
- break;
3412
- }
3413
3429
  default:
3414
3430
  reader.skipType(tag & 7, long);
3415
3431
  break;
@@ -3438,11 +3454,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3438
3454
  return "fields." + error;
3439
3455
  }
3440
3456
  }
3441
- if (message.classTy != null && message.hasOwnProperty("classTy")) {
3442
- let error = $root.baml_bridge.cffi.v1.BamlTyClass.verify(message.classTy, long + 1);
3443
- if (error)
3444
- return "classTy." + error;
3445
- }
3446
3457
  return null;
3447
3458
  };
3448
3459
  InboundClassValue.fromObject = function fromObject(object, long) {
@@ -3465,11 +3476,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3465
3476
  message.fields[i] = $root.baml_bridge.cffi.v1.InboundMapEntry.fromObject(object.fields[i], long + 1);
3466
3477
  }
3467
3478
  }
3468
- if (object.classTy != null) {
3469
- if (!$util.isObject(object.classTy))
3470
- throw TypeError(".baml_bridge.cffi.v1.InboundClassValue.classTy: object expected");
3471
- message.classTy = $root.baml_bridge.cffi.v1.BamlTyClass.fromObject(object.classTy, long + 1);
3472
- }
3473
3479
  return message;
3474
3480
  };
3475
3481
  InboundClassValue.toObject = function toObject(message, options, q) {
@@ -3482,15 +3488,11 @@ var baml_bridge = $root.baml_bridge = (() => {
3482
3488
  let object = {};
3483
3489
  if (options.arrays || options.defaults)
3484
3490
  object.fields = [];
3485
- if (options.defaults)
3486
- object.classTy = null;
3487
3491
  if (message.fields && message.fields.length) {
3488
3492
  object.fields = [];
3489
3493
  for (let j = 0; j < message.fields.length; ++j)
3490
3494
  object.fields[j] = $root.baml_bridge.cffi.v1.InboundMapEntry.toObject(message.fields[j], options, q + 1);
3491
3495
  }
3492
- if (message.classTy != null && message.hasOwnProperty("classTy"))
3493
- object.classTy = $root.baml_bridge.cffi.v1.BamlTyClass.toObject(message.classTy, options, q + 1);
3494
3496
  return object;
3495
3497
  };
3496
3498
  InboundClassValue.prototype.toJSON = function toJSON() {
@@ -3781,6 +3783,13 @@ var baml_bridge = $root.baml_bridge = (() => {
3781
3783
  CallFunctionArgs.prototype.kwargs = $util.emptyArray;
3782
3784
  CallFunctionArgs.prototype.callId = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
3783
3785
  CallFunctionArgs.prototype.typeArgs = $util.emptyArray;
3786
+ CallFunctionArgs.prototype.functionName = null;
3787
+ CallFunctionArgs.prototype.functionHandle = null;
3788
+ let $oneOfFields;
3789
+ Object.defineProperty(CallFunctionArgs.prototype, "callTarget", {
3790
+ get: $util.oneOfGetter($oneOfFields = ["functionName", "functionHandle"]),
3791
+ set: $util.oneOfSetter($oneOfFields)
3792
+ });
3784
3793
  CallFunctionArgs.create = function create(properties) {
3785
3794
  return new CallFunctionArgs(properties);
3786
3795
  };
@@ -3808,6 +3817,16 @@ var baml_bridge = $root.baml_bridge = (() => {
3808
3817
  /* id 3, wireType 2 =*/
3809
3818
  26
3810
3819
  ).fork(), q + 1).ldelim();
3820
+ if (message.functionName != null && Object.hasOwnProperty.call(message, "functionName"))
3821
+ writer.uint32(
3822
+ /* id 4, wireType 2 =*/
3823
+ 34
3824
+ ).string(message.functionName);
3825
+ if (message.functionHandle != null && Object.hasOwnProperty.call(message, "functionHandle"))
3826
+ writer.uint32(
3827
+ /* id 5, wireType 0 =*/
3828
+ 40
3829
+ ).uint64(message.functionHandle);
3811
3830
  return writer;
3812
3831
  };
3813
3832
  CallFunctionArgs.encodeDelimited = function encodeDelimited(message, writer) {
@@ -3842,6 +3861,14 @@ var baml_bridge = $root.baml_bridge = (() => {
3842
3861
  message.typeArgs.push($root.baml_bridge.cffi.v1.BamlTyArg.decode(reader, reader.uint32(), void 0, long + 1));
3843
3862
  break;
3844
3863
  }
3864
+ case 4: {
3865
+ message.functionName = reader.string();
3866
+ break;
3867
+ }
3868
+ case 5: {
3869
+ message.functionHandle = reader.uint64();
3870
+ break;
3871
+ }
3845
3872
  default:
3846
3873
  reader.skipType(tag & 7, long);
3847
3874
  break;
@@ -3861,6 +3888,7 @@ var baml_bridge = $root.baml_bridge = (() => {
3861
3888
  long = 0;
3862
3889
  if (long > $util.recursionLimit)
3863
3890
  return "maximum nesting depth exceeded";
3891
+ let properties = {};
3864
3892
  if (message.kwargs != null && message.hasOwnProperty("kwargs")) {
3865
3893
  if (!Array.isArray(message.kwargs))
3866
3894
  return "kwargs: array expected";
@@ -3883,6 +3911,18 @@ var baml_bridge = $root.baml_bridge = (() => {
3883
3911
  return "typeArgs." + error;
3884
3912
  }
3885
3913
  }
3914
+ if (message.functionName != null && message.hasOwnProperty("functionName")) {
3915
+ properties.callTarget = 1;
3916
+ if (!$util.isString(message.functionName))
3917
+ return "functionName: string expected";
3918
+ }
3919
+ if (message.functionHandle != null && message.hasOwnProperty("functionHandle")) {
3920
+ if (properties.callTarget === 1)
3921
+ return "callTarget: multiple values";
3922
+ properties.callTarget = 1;
3923
+ if (!$util.isInteger(message.functionHandle) && !(message.functionHandle && $util.isInteger(message.functionHandle.low) && $util.isInteger(message.functionHandle.high)))
3924
+ return "functionHandle: integer|Long expected";
3925
+ }
3886
3926
  return null;
3887
3927
  };
3888
3928
  CallFunctionArgs.fromObject = function fromObject(object, long) {
@@ -3925,6 +3965,18 @@ var baml_bridge = $root.baml_bridge = (() => {
3925
3965
  message.typeArgs[i] = $root.baml_bridge.cffi.v1.BamlTyArg.fromObject(object.typeArgs[i], long + 1);
3926
3966
  }
3927
3967
  }
3968
+ if (object.functionName != null)
3969
+ message.functionName = String(object.functionName);
3970
+ if (object.functionHandle != null) {
3971
+ if ($util.Long)
3972
+ message.functionHandle = $util.Long.fromValue(object.functionHandle, true);
3973
+ else if (typeof object.functionHandle === "string")
3974
+ message.functionHandle = parseInt(object.functionHandle, 10);
3975
+ else if (typeof object.functionHandle === "number")
3976
+ message.functionHandle = object.functionHandle;
3977
+ else if (typeof object.functionHandle === "object")
3978
+ message.functionHandle = new $util.LongBits(object.functionHandle.low >>> 0, object.functionHandle.high >>> 0).toNumber(true);
3979
+ }
3928
3980
  return message;
3929
3981
  };
3930
3982
  CallFunctionArgs.toObject = function toObject(message, options, q) {
@@ -3962,6 +4014,21 @@ var baml_bridge = $root.baml_bridge = (() => {
3962
4014
  for (let j = 0; j < message.typeArgs.length; ++j)
3963
4015
  object.typeArgs[j] = $root.baml_bridge.cffi.v1.BamlTyArg.toObject(message.typeArgs[j], options, q + 1);
3964
4016
  }
4017
+ if (message.functionName != null && message.hasOwnProperty("functionName")) {
4018
+ object.functionName = message.functionName;
4019
+ if (options.oneofs)
4020
+ object.callTarget = "functionName";
4021
+ }
4022
+ if (message.functionHandle != null && message.hasOwnProperty("functionHandle")) {
4023
+ if (typeof BigInt !== "undefined" && options.longs === BigInt)
4024
+ object.functionHandle = typeof message.functionHandle === "number" ? BigInt(message.functionHandle) : $util.Long.fromBits(message.functionHandle.low >>> 0, message.functionHandle.high >>> 0, true).toBigInt();
4025
+ else if (typeof message.functionHandle === "number")
4026
+ object.functionHandle = options.longs === String ? String(message.functionHandle) : message.functionHandle;
4027
+ else
4028
+ object.functionHandle = options.longs === String ? $util.Long.prototype.toString.call(message.functionHandle) : options.longs === Number ? new $util.LongBits(message.functionHandle.low >>> 0, message.functionHandle.high >>> 0).toNumber(true) : message.functionHandle;
4029
+ if (options.oneofs)
4030
+ object.callTarget = "functionHandle";
4031
+ }
3965
4032
  return object;
3966
4033
  };
3967
4034
  CallFunctionArgs.prototype.toJSON = function toJSON() {
@@ -8085,6 +8152,7 @@ var baml_bridge = $root.baml_bridge = (() => {
8085
8152
  }
8086
8153
  }
8087
8154
  BamlTyTypeVar.prototype.name = "";
8155
+ BamlTyTypeVar.prototype.index = 0;
8088
8156
  BamlTyTypeVar.create = function create(properties) {
8089
8157
  return new BamlTyTypeVar(properties);
8090
8158
  };
@@ -8100,6 +8168,11 @@ var baml_bridge = $root.baml_bridge = (() => {
8100
8168
  /* id 1, wireType 2 =*/
8101
8169
  10
8102
8170
  ).string(message.name);
8171
+ if (message.index != null && Object.hasOwnProperty.call(message, "index"))
8172
+ writer.uint32(
8173
+ /* id 2, wireType 0 =*/
8174
+ 16
8175
+ ).uint32(message.index);
8103
8176
  return writer;
8104
8177
  };
8105
8178
  BamlTyTypeVar.encodeDelimited = function encodeDelimited(message, writer) {
@@ -8122,6 +8195,10 @@ var baml_bridge = $root.baml_bridge = (() => {
8122
8195
  message.name = reader.string();
8123
8196
  break;
8124
8197
  }
8198
+ case 2: {
8199
+ message.index = reader.uint32();
8200
+ break;
8201
+ }
8125
8202
  default:
8126
8203
  reader.skipType(tag & 7, long);
8127
8204
  break;
@@ -8145,6 +8222,10 @@ var baml_bridge = $root.baml_bridge = (() => {
8145
8222
  if (!$util.isString(message.name))
8146
8223
  return "name: string expected";
8147
8224
  }
8225
+ if (message.index != null && message.hasOwnProperty("index")) {
8226
+ if (!$util.isInteger(message.index))
8227
+ return "index: integer expected";
8228
+ }
8148
8229
  return null;
8149
8230
  };
8150
8231
  BamlTyTypeVar.fromObject = function fromObject(object, long) {
@@ -8159,6 +8240,8 @@ var baml_bridge = $root.baml_bridge = (() => {
8159
8240
  let message = new $root.baml_bridge.cffi.v1.BamlTyTypeVar();
8160
8241
  if (object.name != null)
8161
8242
  message.name = String(object.name);
8243
+ if (object.index != null)
8244
+ message.index = object.index >>> 0;
8162
8245
  return message;
8163
8246
  };
8164
8247
  BamlTyTypeVar.toObject = function toObject(message, options, q) {
@@ -8169,10 +8252,14 @@ var baml_bridge = $root.baml_bridge = (() => {
8169
8252
  if (q > $util.recursionLimit)
8170
8253
  throw Error("max depth exceeded");
8171
8254
  let object = {};
8172
- if (options.defaults)
8255
+ if (options.defaults) {
8173
8256
  object.name = "";
8257
+ object.index = 0;
8258
+ }
8174
8259
  if (message.name != null && message.hasOwnProperty("name"))
8175
8260
  object.name = message.name;
8261
+ if (message.index != null && message.hasOwnProperty("index"))
8262
+ object.index = message.index;
8176
8263
  return object;
8177
8264
  };
8178
8265
  BamlTyTypeVar.prototype.toJSON = function toJSON() {
@@ -10702,6 +10789,12 @@ var baml_bridge = $root.baml_bridge = (() => {
10702
10789
  BamlValueUnionVariant.prototype.selfType = null;
10703
10790
  BamlValueUnionVariant.prototype.valueOptionName = "";
10704
10791
  BamlValueUnionVariant.prototype.value = null;
10792
+ BamlValueUnionVariant.prototype.selectedOptionIndex = null;
10793
+ let $oneOfFields;
10794
+ Object.defineProperty(BamlValueUnionVariant.prototype, "_selectedOptionIndex", {
10795
+ get: $util.oneOfGetter($oneOfFields = ["selectedOptionIndex"]),
10796
+ set: $util.oneOfSetter($oneOfFields)
10797
+ });
10705
10798
  BamlValueUnionVariant.create = function create(properties) {
10706
10799
  return new BamlValueUnionVariant(properties);
10707
10800
  };
@@ -10742,6 +10835,11 @@ var baml_bridge = $root.baml_bridge = (() => {
10742
10835
  /* id 6, wireType 2 =*/
10743
10836
  50
10744
10837
  ).fork(), q + 1).ldelim();
10838
+ if (message.selectedOptionIndex != null && Object.hasOwnProperty.call(message, "selectedOptionIndex"))
10839
+ writer.uint32(
10840
+ /* id 8, wireType 0 =*/
10841
+ 64
10842
+ ).uint32(message.selectedOptionIndex);
10745
10843
  return writer;
10746
10844
  };
10747
10845
  BamlValueUnionVariant.encodeDelimited = function encodeDelimited(message, writer) {
@@ -10784,6 +10882,10 @@ var baml_bridge = $root.baml_bridge = (() => {
10784
10882
  message.value = $root.baml_bridge.cffi.v1.BamlOutboundValue.decode(reader, reader.uint32(), void 0, long + 1);
10785
10883
  break;
10786
10884
  }
10885
+ case 8: {
10886
+ message.selectedOptionIndex = reader.uint32();
10887
+ break;
10888
+ }
10787
10889
  default:
10788
10890
  reader.skipType(tag & 7, long);
10789
10891
  break;
@@ -10803,6 +10905,7 @@ var baml_bridge = $root.baml_bridge = (() => {
10803
10905
  long = 0;
10804
10906
  if (long > $util.recursionLimit)
10805
10907
  return "maximum nesting depth exceeded";
10908
+ let properties = {};
10806
10909
  if (message.name != null && message.hasOwnProperty("name")) {
10807
10910
  if (!$util.isString(message.name))
10808
10911
  return "name: string expected";
@@ -10829,6 +10932,11 @@ var baml_bridge = $root.baml_bridge = (() => {
10829
10932
  if (error)
10830
10933
  return "value." + error;
10831
10934
  }
10935
+ if (message.selectedOptionIndex != null && message.hasOwnProperty("selectedOptionIndex")) {
10936
+ properties._selectedOptionIndex = 1;
10937
+ if (!$util.isInteger(message.selectedOptionIndex))
10938
+ return "selectedOptionIndex: integer expected";
10939
+ }
10832
10940
  return null;
10833
10941
  };
10834
10942
  BamlValueUnionVariant.fromObject = function fromObject(object, long) {
@@ -10859,6 +10967,8 @@ var baml_bridge = $root.baml_bridge = (() => {
10859
10967
  throw TypeError(".baml_bridge.cffi.v1.BamlValueUnionVariant.value: object expected");
10860
10968
  message.value = $root.baml_bridge.cffi.v1.BamlOutboundValue.fromObject(object.value, long + 1);
10861
10969
  }
10970
+ if (object.selectedOptionIndex != null)
10971
+ message.selectedOptionIndex = object.selectedOptionIndex >>> 0;
10862
10972
  return message;
10863
10973
  };
10864
10974
  BamlValueUnionVariant.toObject = function toObject(message, options, q) {
@@ -10889,6 +10999,11 @@ var baml_bridge = $root.baml_bridge = (() => {
10889
10999
  object.valueOptionName = message.valueOptionName;
10890
11000
  if (message.value != null && message.hasOwnProperty("value"))
10891
11001
  object.value = $root.baml_bridge.cffi.v1.BamlOutboundValue.toObject(message.value, options, q + 1);
11002
+ if (message.selectedOptionIndex != null && message.hasOwnProperty("selectedOptionIndex")) {
11003
+ object.selectedOptionIndex = message.selectedOptionIndex;
11004
+ if (options.oneofs)
11005
+ object._selectedOptionIndex = "selectedOptionIndex";
11006
+ }
10892
11007
  return object;
10893
11008
  };
10894
11009
  BamlValueUnionVariant.prototype.toJSON = function toJSON() {
@@ -1,4 +1,5 @@
1
1
  import { baml_bridge } from './proto/baml_cffi.js';
2
+ import { HandleKey } from '../native.js';
2
3
  /**
3
4
  * Error thrown when a host callable (a JS `function`) is passed to the
4
5
  * *synchronous* call path. See {@link encodeCallArgs} for why this can't work.
@@ -9,6 +10,8 @@ export declare class HostCallableSyncError extends Error {
9
10
  export interface EncodeCallArgsOptions {
10
11
  callId: bigint;
11
12
  syncMode?: boolean;
13
+ functionName?: string;
14
+ functionHandle?: HandleKey;
12
15
  /**
13
16
  * Call-level TypeVar bindings for a generic function/method, as
14
17
  * `[typeVarName, wireTy]` pairs in De Bruijn order (enclosing class params
@@ -29,8 +32,8 @@ export interface EncodeCallArgsOptions {
29
32
  * host-value table and is normally released only when the engine GCs the
30
33
  * `HostClosure` it allocated and fires the C release callback (a GC-timed
31
34
  * release, drained by the engine after collection).
32
- * Because the Node tsfn is built with `weak::<false>` it keeps a strong libuv
33
- * ref, so a *leaked* registry entry can also keep the Node process from
35
+ * Because the host bridge is built with `weak::<false>` it keeps a strong host event loop
36
+ * ref, so a *leaked* registry entry can also keep the JavaScript realm from
34
37
  * exiting — which is exactly why the encode-error rollback below matters: if a
35
38
  * later kwarg fails, the engine never sees (and so never releases) the keys we
36
39
  * already registered, so we release them here.
@@ -41,15 +44,16 @@ export declare function encodeCallArgs(kwargs: Record<string, unknown>, options:
41
44
  * args path, where the engine sends a list-shaped `BamlOutboundValue` rather
42
45
  * than the call-result `BamlOutboundResult` envelope.
43
46
  */
44
- export declare function decodeOutboundValue(data: Uint8Array | Uint8Array): unknown;
47
+ export declare function decodeOutboundValue(data: Uint8Array): unknown;
45
48
  /**
46
49
  * Decode a `BamlOutboundResult` envelope (the engine's call-result wire shape
47
50
  * after 31c/31e). The `ok` arm returns the decoded value; the `error`/`panic`
48
51
  * arms **throw** a `BamlError`/`BamlPanic` carrying the fully decoded thrown
49
52
  * value (`.value`), the BAML trace (`.bamlTrace`), and the class FQN
50
53
  * (`.className`), with a readable formatted `.message`. An `is_exit_panic`
51
- * (clean `baml.sys.exit`) terminates the process via `process.exit(code)`
54
+ * (clean `baml.sys.exit`) terminates the runtime via `runtime.exit(code)`
52
55
  * rather than throwing.
53
56
  */
54
- export declare function decodeCallResult(data: Uint8Array | Uint8Array): unknown;
57
+ export declare function decodeCallResult(data: Uint8Array): unknown;
58
+ export declare function makeHostCallableDispatch(userFn: (...args: unknown[]) => unknown): (callId: number, argsBytes: Uint8Array) => void;
55
59
  //# sourceMappingURL=proto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proto.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/proto.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAiCnD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI9B;AAmBD,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3D;AA+LD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,GAAG,UAAU,CAuC1G;AAgOD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAG1E;AA4GD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAuDvE"}
1
+ {"version":3,"file":"proto.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/proto.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAEH,SAAS,EAUZ,MAAM,cAAc,CAAC;AAwBtB;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI9B;AA2BD,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3D;AAiMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,GAAG,UAAU,CAsC1G;AAoRD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAG7D;AAyHD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAiD1D;AAiBD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,IACpE,QAAQ,MAAM,EAAE,WAAW,UAAU,KAAG,IAAI,CAoDvD"}