@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
@@ -2430,6 +2430,7 @@ var baml_bridge = $root.baml_bridge = (() => {
2430
2430
  this[keys[i]] = properties[keys[i]];
2431
2431
  }
2432
2432
  }
2433
+ InboundValue.prototype.valueType = null;
2433
2434
  InboundValue.prototype.stringValue = null;
2434
2435
  InboundValue.prototype.intValue = null;
2435
2436
  InboundValue.prototype.floatValue = null;
@@ -2457,6 +2458,11 @@ var baml_bridge = $root.baml_bridge = (() => {
2457
2458
  q = 0;
2458
2459
  if (q > $util.recursionLimit)
2459
2460
  throw Error("max depth exceeded");
2461
+ if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType"))
2462
+ $root.baml_bridge.cffi.v1.BamlTy.encode(message.valueType, writer.uint32(
2463
+ /* id 1, wireType 2 =*/
2464
+ 10
2465
+ ).fork(), q + 1).ldelim();
2460
2466
  if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue"))
2461
2467
  writer.uint32(
2462
2468
  /* id 2, wireType 2 =*/
@@ -2535,6 +2541,10 @@ var baml_bridge = $root.baml_bridge = (() => {
2535
2541
  if (tag === error)
2536
2542
  break;
2537
2543
  switch (tag >>> 3) {
2544
+ case 1: {
2545
+ message.valueType = $root.baml_bridge.cffi.v1.BamlTy.decode(reader, reader.uint32(), void 0, long + 1);
2546
+ break;
2547
+ }
2538
2548
  case 2: {
2539
2549
  message.stringValue = reader.string();
2540
2550
  break;
@@ -2603,6 +2613,11 @@ var baml_bridge = $root.baml_bridge = (() => {
2603
2613
  if (long > $util.recursionLimit)
2604
2614
  return "maximum nesting depth exceeded";
2605
2615
  let properties = {};
2616
+ if (message.valueType != null && message.hasOwnProperty("valueType")) {
2617
+ let error = $root.baml_bridge.cffi.v1.BamlTy.verify(message.valueType, long + 1);
2618
+ if (error)
2619
+ return "valueType." + error;
2620
+ }
2606
2621
  if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
2607
2622
  properties.value = 1;
2608
2623
  if (!$util.isString(message.stringValue))
@@ -2715,6 +2730,11 @@ var baml_bridge = $root.baml_bridge = (() => {
2715
2730
  if (long > $util.recursionLimit)
2716
2731
  throw Error("maximum nesting depth exceeded");
2717
2732
  let message = new $root.baml_bridge.cffi.v1.InboundValue();
2733
+ if (object.valueType != null) {
2734
+ if (!$util.isObject(object.valueType))
2735
+ throw TypeError(".baml_bridge.cffi.v1.InboundValue.valueType: object expected");
2736
+ message.valueType = $root.baml_bridge.cffi.v1.BamlTy.fromObject(object.valueType, long + 1);
2737
+ }
2718
2738
  if (object.stringValue != null)
2719
2739
  message.stringValue = String(object.stringValue);
2720
2740
  if (object.intValue != null) {
@@ -2779,6 +2799,10 @@ var baml_bridge = $root.baml_bridge = (() => {
2779
2799
  if (q > $util.recursionLimit)
2780
2800
  throw Error("max depth exceeded");
2781
2801
  let object = {};
2802
+ if (options.defaults)
2803
+ object.valueType = null;
2804
+ if (message.valueType != null && message.hasOwnProperty("valueType"))
2805
+ object.valueType = $root.baml_bridge.cffi.v1.BamlTy.toObject(message.valueType, options, q + 1);
2782
2806
  if (message.stringValue != null && message.hasOwnProperty("stringValue")) {
2783
2807
  object.stringValue = message.stringValue;
2784
2808
  if (options.oneofs)
@@ -3360,7 +3384,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3360
3384
  }
3361
3385
  }
3362
3386
  InboundClassValue.prototype.fields = $util.emptyArray;
3363
- InboundClassValue.prototype.classTy = null;
3364
3387
  InboundClassValue.create = function create(properties) {
3365
3388
  return new InboundClassValue(properties);
3366
3389
  };
@@ -3377,11 +3400,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3377
3400
  /* id 2, wireType 2 =*/
3378
3401
  18
3379
3402
  ).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
3403
  return writer;
3386
3404
  };
3387
3405
  InboundClassValue.encodeDelimited = function encodeDelimited(message, writer) {
@@ -3406,10 +3424,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3406
3424
  message.fields.push($root.baml_bridge.cffi.v1.InboundMapEntry.decode(reader, reader.uint32(), void 0, long + 1));
3407
3425
  break;
3408
3426
  }
3409
- case 3: {
3410
- message.classTy = $root.baml_bridge.cffi.v1.BamlTyClass.decode(reader, reader.uint32(), void 0, long + 1);
3411
- break;
3412
- }
3413
3427
  default:
3414
3428
  reader.skipType(tag & 7, long);
3415
3429
  break;
@@ -3438,11 +3452,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3438
3452
  return "fields." + error;
3439
3453
  }
3440
3454
  }
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
3455
  return null;
3447
3456
  };
3448
3457
  InboundClassValue.fromObject = function fromObject(object, long) {
@@ -3465,11 +3474,6 @@ var baml_bridge = $root.baml_bridge = (() => {
3465
3474
  message.fields[i] = $root.baml_bridge.cffi.v1.InboundMapEntry.fromObject(object.fields[i], long + 1);
3466
3475
  }
3467
3476
  }
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
3477
  return message;
3474
3478
  };
3475
3479
  InboundClassValue.toObject = function toObject(message, options, q) {
@@ -3482,15 +3486,11 @@ var baml_bridge = $root.baml_bridge = (() => {
3482
3486
  let object = {};
3483
3487
  if (options.arrays || options.defaults)
3484
3488
  object.fields = [];
3485
- if (options.defaults)
3486
- object.classTy = null;
3487
3489
  if (message.fields && message.fields.length) {
3488
3490
  object.fields = [];
3489
3491
  for (let j = 0; j < message.fields.length; ++j)
3490
3492
  object.fields[j] = $root.baml_bridge.cffi.v1.InboundMapEntry.toObject(message.fields[j], options, q + 1);
3491
3493
  }
3492
- if (message.classTy != null && message.hasOwnProperty("classTy"))
3493
- object.classTy = $root.baml_bridge.cffi.v1.BamlTyClass.toObject(message.classTy, options, q + 1);
3494
3494
  return object;
3495
3495
  };
3496
3496
  InboundClassValue.prototype.toJSON = function toJSON() {
@@ -3781,6 +3781,13 @@ var baml_bridge = $root.baml_bridge = (() => {
3781
3781
  CallFunctionArgs.prototype.kwargs = $util.emptyArray;
3782
3782
  CallFunctionArgs.prototype.callId = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
3783
3783
  CallFunctionArgs.prototype.typeArgs = $util.emptyArray;
3784
+ CallFunctionArgs.prototype.functionName = null;
3785
+ CallFunctionArgs.prototype.functionHandle = null;
3786
+ let $oneOfFields;
3787
+ Object.defineProperty(CallFunctionArgs.prototype, "callTarget", {
3788
+ get: $util.oneOfGetter($oneOfFields = ["functionName", "functionHandle"]),
3789
+ set: $util.oneOfSetter($oneOfFields)
3790
+ });
3784
3791
  CallFunctionArgs.create = function create(properties) {
3785
3792
  return new CallFunctionArgs(properties);
3786
3793
  };
@@ -3808,6 +3815,16 @@ var baml_bridge = $root.baml_bridge = (() => {
3808
3815
  /* id 3, wireType 2 =*/
3809
3816
  26
3810
3817
  ).fork(), q + 1).ldelim();
3818
+ if (message.functionName != null && Object.hasOwnProperty.call(message, "functionName"))
3819
+ writer.uint32(
3820
+ /* id 4, wireType 2 =*/
3821
+ 34
3822
+ ).string(message.functionName);
3823
+ if (message.functionHandle != null && Object.hasOwnProperty.call(message, "functionHandle"))
3824
+ writer.uint32(
3825
+ /* id 5, wireType 0 =*/
3826
+ 40
3827
+ ).uint64(message.functionHandle);
3811
3828
  return writer;
3812
3829
  };
3813
3830
  CallFunctionArgs.encodeDelimited = function encodeDelimited(message, writer) {
@@ -3842,6 +3859,14 @@ var baml_bridge = $root.baml_bridge = (() => {
3842
3859
  message.typeArgs.push($root.baml_bridge.cffi.v1.BamlTyArg.decode(reader, reader.uint32(), void 0, long + 1));
3843
3860
  break;
3844
3861
  }
3862
+ case 4: {
3863
+ message.functionName = reader.string();
3864
+ break;
3865
+ }
3866
+ case 5: {
3867
+ message.functionHandle = reader.uint64();
3868
+ break;
3869
+ }
3845
3870
  default:
3846
3871
  reader.skipType(tag & 7, long);
3847
3872
  break;
@@ -3861,6 +3886,7 @@ var baml_bridge = $root.baml_bridge = (() => {
3861
3886
  long = 0;
3862
3887
  if (long > $util.recursionLimit)
3863
3888
  return "maximum nesting depth exceeded";
3889
+ let properties = {};
3864
3890
  if (message.kwargs != null && message.hasOwnProperty("kwargs")) {
3865
3891
  if (!Array.isArray(message.kwargs))
3866
3892
  return "kwargs: array expected";
@@ -3883,6 +3909,18 @@ var baml_bridge = $root.baml_bridge = (() => {
3883
3909
  return "typeArgs." + error;
3884
3910
  }
3885
3911
  }
3912
+ if (message.functionName != null && message.hasOwnProperty("functionName")) {
3913
+ properties.callTarget = 1;
3914
+ if (!$util.isString(message.functionName))
3915
+ return "functionName: string expected";
3916
+ }
3917
+ if (message.functionHandle != null && message.hasOwnProperty("functionHandle")) {
3918
+ if (properties.callTarget === 1)
3919
+ return "callTarget: multiple values";
3920
+ properties.callTarget = 1;
3921
+ if (!$util.isInteger(message.functionHandle) && !(message.functionHandle && $util.isInteger(message.functionHandle.low) && $util.isInteger(message.functionHandle.high)))
3922
+ return "functionHandle: integer|Long expected";
3923
+ }
3886
3924
  return null;
3887
3925
  };
3888
3926
  CallFunctionArgs.fromObject = function fromObject(object, long) {
@@ -3925,6 +3963,18 @@ var baml_bridge = $root.baml_bridge = (() => {
3925
3963
  message.typeArgs[i] = $root.baml_bridge.cffi.v1.BamlTyArg.fromObject(object.typeArgs[i], long + 1);
3926
3964
  }
3927
3965
  }
3966
+ if (object.functionName != null)
3967
+ message.functionName = String(object.functionName);
3968
+ if (object.functionHandle != null) {
3969
+ if ($util.Long)
3970
+ message.functionHandle = $util.Long.fromValue(object.functionHandle, true);
3971
+ else if (typeof object.functionHandle === "string")
3972
+ message.functionHandle = parseInt(object.functionHandle, 10);
3973
+ else if (typeof object.functionHandle === "number")
3974
+ message.functionHandle = object.functionHandle;
3975
+ else if (typeof object.functionHandle === "object")
3976
+ message.functionHandle = new $util.LongBits(object.functionHandle.low >>> 0, object.functionHandle.high >>> 0).toNumber(true);
3977
+ }
3928
3978
  return message;
3929
3979
  };
3930
3980
  CallFunctionArgs.toObject = function toObject(message, options, q) {
@@ -3962,6 +4012,21 @@ var baml_bridge = $root.baml_bridge = (() => {
3962
4012
  for (let j = 0; j < message.typeArgs.length; ++j)
3963
4013
  object.typeArgs[j] = $root.baml_bridge.cffi.v1.BamlTyArg.toObject(message.typeArgs[j], options, q + 1);
3964
4014
  }
4015
+ if (message.functionName != null && message.hasOwnProperty("functionName")) {
4016
+ object.functionName = message.functionName;
4017
+ if (options.oneofs)
4018
+ object.callTarget = "functionName";
4019
+ }
4020
+ if (message.functionHandle != null && message.hasOwnProperty("functionHandle")) {
4021
+ if (typeof BigInt !== "undefined" && options.longs === BigInt)
4022
+ object.functionHandle = typeof message.functionHandle === "number" ? BigInt(message.functionHandle) : $util.Long.fromBits(message.functionHandle.low >>> 0, message.functionHandle.high >>> 0, true).toBigInt();
4023
+ else if (typeof message.functionHandle === "number")
4024
+ object.functionHandle = options.longs === String ? String(message.functionHandle) : message.functionHandle;
4025
+ else
4026
+ 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;
4027
+ if (options.oneofs)
4028
+ object.callTarget = "functionHandle";
4029
+ }
3965
4030
  return object;
3966
4031
  };
3967
4032
  CallFunctionArgs.prototype.toJSON = function toJSON() {
@@ -8085,6 +8150,7 @@ var baml_bridge = $root.baml_bridge = (() => {
8085
8150
  }
8086
8151
  }
8087
8152
  BamlTyTypeVar.prototype.name = "";
8153
+ BamlTyTypeVar.prototype.index = 0;
8088
8154
  BamlTyTypeVar.create = function create(properties) {
8089
8155
  return new BamlTyTypeVar(properties);
8090
8156
  };
@@ -8100,6 +8166,11 @@ var baml_bridge = $root.baml_bridge = (() => {
8100
8166
  /* id 1, wireType 2 =*/
8101
8167
  10
8102
8168
  ).string(message.name);
8169
+ if (message.index != null && Object.hasOwnProperty.call(message, "index"))
8170
+ writer.uint32(
8171
+ /* id 2, wireType 0 =*/
8172
+ 16
8173
+ ).uint32(message.index);
8103
8174
  return writer;
8104
8175
  };
8105
8176
  BamlTyTypeVar.encodeDelimited = function encodeDelimited(message, writer) {
@@ -8122,6 +8193,10 @@ var baml_bridge = $root.baml_bridge = (() => {
8122
8193
  message.name = reader.string();
8123
8194
  break;
8124
8195
  }
8196
+ case 2: {
8197
+ message.index = reader.uint32();
8198
+ break;
8199
+ }
8125
8200
  default:
8126
8201
  reader.skipType(tag & 7, long);
8127
8202
  break;
@@ -8145,6 +8220,10 @@ var baml_bridge = $root.baml_bridge = (() => {
8145
8220
  if (!$util.isString(message.name))
8146
8221
  return "name: string expected";
8147
8222
  }
8223
+ if (message.index != null && message.hasOwnProperty("index")) {
8224
+ if (!$util.isInteger(message.index))
8225
+ return "index: integer expected";
8226
+ }
8148
8227
  return null;
8149
8228
  };
8150
8229
  BamlTyTypeVar.fromObject = function fromObject(object, long) {
@@ -8159,6 +8238,8 @@ var baml_bridge = $root.baml_bridge = (() => {
8159
8238
  let message = new $root.baml_bridge.cffi.v1.BamlTyTypeVar();
8160
8239
  if (object.name != null)
8161
8240
  message.name = String(object.name);
8241
+ if (object.index != null)
8242
+ message.index = object.index >>> 0;
8162
8243
  return message;
8163
8244
  };
8164
8245
  BamlTyTypeVar.toObject = function toObject(message, options, q) {
@@ -8169,10 +8250,14 @@ var baml_bridge = $root.baml_bridge = (() => {
8169
8250
  if (q > $util.recursionLimit)
8170
8251
  throw Error("max depth exceeded");
8171
8252
  let object = {};
8172
- if (options.defaults)
8253
+ if (options.defaults) {
8173
8254
  object.name = "";
8255
+ object.index = 0;
8256
+ }
8174
8257
  if (message.name != null && message.hasOwnProperty("name"))
8175
8258
  object.name = message.name;
8259
+ if (message.index != null && message.hasOwnProperty("index"))
8260
+ object.index = message.index;
8176
8261
  return object;
8177
8262
  };
8178
8263
  BamlTyTypeVar.prototype.toJSON = function toJSON() {
@@ -10702,6 +10787,12 @@ var baml_bridge = $root.baml_bridge = (() => {
10702
10787
  BamlValueUnionVariant.prototype.selfType = null;
10703
10788
  BamlValueUnionVariant.prototype.valueOptionName = "";
10704
10789
  BamlValueUnionVariant.prototype.value = null;
10790
+ BamlValueUnionVariant.prototype.selectedOptionIndex = null;
10791
+ let $oneOfFields;
10792
+ Object.defineProperty(BamlValueUnionVariant.prototype, "_selectedOptionIndex", {
10793
+ get: $util.oneOfGetter($oneOfFields = ["selectedOptionIndex"]),
10794
+ set: $util.oneOfSetter($oneOfFields)
10795
+ });
10705
10796
  BamlValueUnionVariant.create = function create(properties) {
10706
10797
  return new BamlValueUnionVariant(properties);
10707
10798
  };
@@ -10742,6 +10833,11 @@ var baml_bridge = $root.baml_bridge = (() => {
10742
10833
  /* id 6, wireType 2 =*/
10743
10834
  50
10744
10835
  ).fork(), q + 1).ldelim();
10836
+ if (message.selectedOptionIndex != null && Object.hasOwnProperty.call(message, "selectedOptionIndex"))
10837
+ writer.uint32(
10838
+ /* id 8, wireType 0 =*/
10839
+ 64
10840
+ ).uint32(message.selectedOptionIndex);
10745
10841
  return writer;
10746
10842
  };
10747
10843
  BamlValueUnionVariant.encodeDelimited = function encodeDelimited(message, writer) {
@@ -10784,6 +10880,10 @@ var baml_bridge = $root.baml_bridge = (() => {
10784
10880
  message.value = $root.baml_bridge.cffi.v1.BamlOutboundValue.decode(reader, reader.uint32(), void 0, long + 1);
10785
10881
  break;
10786
10882
  }
10883
+ case 8: {
10884
+ message.selectedOptionIndex = reader.uint32();
10885
+ break;
10886
+ }
10787
10887
  default:
10788
10888
  reader.skipType(tag & 7, long);
10789
10889
  break;
@@ -10803,6 +10903,7 @@ var baml_bridge = $root.baml_bridge = (() => {
10803
10903
  long = 0;
10804
10904
  if (long > $util.recursionLimit)
10805
10905
  return "maximum nesting depth exceeded";
10906
+ let properties = {};
10806
10907
  if (message.name != null && message.hasOwnProperty("name")) {
10807
10908
  if (!$util.isString(message.name))
10808
10909
  return "name: string expected";
@@ -10829,6 +10930,11 @@ var baml_bridge = $root.baml_bridge = (() => {
10829
10930
  if (error)
10830
10931
  return "value." + error;
10831
10932
  }
10933
+ if (message.selectedOptionIndex != null && message.hasOwnProperty("selectedOptionIndex")) {
10934
+ properties._selectedOptionIndex = 1;
10935
+ if (!$util.isInteger(message.selectedOptionIndex))
10936
+ return "selectedOptionIndex: integer expected";
10937
+ }
10832
10938
  return null;
10833
10939
  };
10834
10940
  BamlValueUnionVariant.fromObject = function fromObject(object, long) {
@@ -10859,6 +10965,8 @@ var baml_bridge = $root.baml_bridge = (() => {
10859
10965
  throw TypeError(".baml_bridge.cffi.v1.BamlValueUnionVariant.value: object expected");
10860
10966
  message.value = $root.baml_bridge.cffi.v1.BamlOutboundValue.fromObject(object.value, long + 1);
10861
10967
  }
10968
+ if (object.selectedOptionIndex != null)
10969
+ message.selectedOptionIndex = object.selectedOptionIndex >>> 0;
10862
10970
  return message;
10863
10971
  };
10864
10972
  BamlValueUnionVariant.toObject = function toObject(message, options, q) {
@@ -10889,6 +10997,11 @@ var baml_bridge = $root.baml_bridge = (() => {
10889
10997
  object.valueOptionName = message.valueOptionName;
10890
10998
  if (message.value != null && message.hasOwnProperty("value"))
10891
10999
  object.value = $root.baml_bridge.cffi.v1.BamlOutboundValue.toObject(message.value, options, q + 1);
11000
+ if (message.selectedOptionIndex != null && message.hasOwnProperty("selectedOptionIndex")) {
11001
+ object.selectedOptionIndex = message.selectedOptionIndex;
11002
+ if (options.oneofs)
11003
+ object._selectedOptionIndex = "selectedOptionIndex";
11004
+ }
10892
11005
  return object;
10893
11006
  };
10894
11007
  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"}