bitfab 0.57.6 → 0.57.7

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.
@@ -187,7 +187,7 @@ function encodeRequestBody(body) {
187
187
  }
188
188
 
189
189
  // src/version.generated.ts
190
- var __version__ = "0.57.6";
190
+ var __version__ = "0.57.7";
191
191
  var __packageName__ = "bitfab";
192
192
 
193
193
  // src/constants.ts
@@ -788,7 +788,13 @@ var SIMULATION_PLAN_MAX_HELD = 1e3;
788
788
  var DISABLE_SIMULATION_PLAN_ENV = "BITFAB_DISABLE_SIM_PLAN";
789
789
  var ROOT_TRACE_FUNCTION_KEY_FIELD = "rootTraceFunctionKey";
790
790
  var CONTENT_OFF_KEY = "content_off_by_simulation_plan";
791
- var CONTENT_KEYS = ["input", "input_meta", "output", "output_meta"];
791
+ var CONTENT_KEYS = [
792
+ "input",
793
+ "input_meta",
794
+ "output",
795
+ "output_meta",
796
+ "prompt"
797
+ ];
792
798
  function planWaitSliceMs(timeoutMs) {
793
799
  return Math.min(SIMULATION_PLAN_READ_TIMEOUT_MS, Math.max(timeoutMs, 0) / 2);
794
800
  }
@@ -982,13 +988,13 @@ var SimulationPlan = class {
982
988
  }
983
989
  return this.loaded;
984
990
  }
985
- send(payload, traceFunctionKey, submit) {
991
+ send(payload, traceFunctionKey, submit, drop) {
986
992
  this.refresh();
987
993
  if (this.disabled() || traceFunctionKey === void 0 || spanNameOf(payload) === void 0 || recordedByFramework(payload)) {
988
994
  submit(payload);
989
995
  return;
990
996
  }
991
- const entry = { payload, traceFunctionKey, submit };
997
+ const entry = { payload, traceFunctionKey, submit, drop };
992
998
  if (this.holdingForFirstRead()) {
993
999
  this.hold(entry);
994
1000
  return;
@@ -1042,6 +1048,7 @@ var SimulationPlan = class {
1042
1048
  try {
1043
1049
  entry.submit(this.payloadToSend(entry));
1044
1050
  } catch (error) {
1051
+ entry.drop?.();
1045
1052
  warnOnce(
1046
1053
  "sim-plan-held-span-dropped",
1047
1054
  `a span held for the sim plan was dropped when released: ${error instanceof Error ? error.message : String(error)}`
@@ -2312,23 +2319,21 @@ var HttpClient = class {
2312
2319
  }
2313
2320
  const deadline = Date.now() + Math.max(timeoutMs, 0);
2314
2321
  this.closing = (async () => {
2315
- const released = await this.releaseHeldExternalSpans?.(
2316
- planWaitSliceMs(timeoutMs)
2322
+ liveHttpClients.delete(this);
2323
+ const settled = await this.settleDeferredWork(
2324
+ Math.max(0, deadline - Date.now())
2317
2325
  );
2318
2326
  this.stopSimulationPlan?.();
2327
+ this.closed = true;
2319
2328
  this.externalSpanTransform = void 0;
2320
2329
  this.externalTraceTransform = void 0;
2330
+ this.frameworkSpanStart = void 0;
2321
2331
  this.releaseHeldExternalSpans = void 0;
2322
2332
  this.stopSimulationPlan = void 0;
2323
- liveHttpClients.delete(this);
2324
- const settled = await this.settleDeferredWork(
2325
- Math.max(0, deadline - Date.now())
2326
- );
2327
- this.closed = true;
2328
2333
  const transport = this.traceTransport;
2329
2334
  this.traceTransport = void 0;
2330
2335
  const shutdownOk = await transport?.shutdown(Math.max(0, deadline - Date.now())) ?? true;
2331
- return released !== false && settled && shutdownOk;
2336
+ return settled && shutdownOk;
2332
2337
  })();
2333
2338
  return this.closing;
2334
2339
  }
@@ -2429,8 +2434,7 @@ var HttpClient = class {
2429
2434
  async getSimulationPlan() {
2430
2435
  return this.get(
2431
2436
  "/api/sdk/sim-plan",
2432
- SIMULATION_PLAN_READ_TIMEOUT_MS,
2433
- { Connection: "close" }
2437
+ SIMULATION_PLAN_READ_TIMEOUT_MS
2434
2438
  );
2435
2439
  }
2436
2440
  async getTraceSpan(traceId, lookup) {
@@ -2506,19 +2510,35 @@ var HttpClient = class {
2506
2510
  carrierMeta("internal_trace", body, void 0)
2507
2511
  );
2508
2512
  }
2513
+ reserveFrameworkSpan(traceId, spanId, parentSpanId) {
2514
+ try {
2515
+ this.frameworkSpanStart?.(traceId, spanId, parentSpanId ?? null);
2516
+ } catch (error) {
2517
+ warnOnce(
2518
+ "framework-span-reservation-failed",
2519
+ `a framework span could not be counted toward its trace's span limit: ${describeError(error)}`
2520
+ );
2521
+ }
2522
+ }
2509
2523
  sendExternalSpan(payload) {
2510
2524
  const ref = carrierRef(payload);
2511
2525
  if (ref?.spanId !== void 0) {
2512
2526
  this.traceCompletion.record(ref.traceId, ref.spanId);
2513
2527
  }
2528
+ const drop = () => {
2529
+ if (ref?.spanId !== void 0) {
2530
+ this.traceCompletion.abort(ref.traceId, ref.spanId);
2531
+ }
2532
+ };
2514
2533
  const gate = this.externalSpanTransform;
2515
2534
  if (gate === void 0) {
2516
2535
  this.submitExternalSpan(payload);
2517
2536
  return;
2518
2537
  }
2519
2538
  try {
2520
- gate(payload, (ready) => this.submitExternalSpan(ready));
2539
+ gate(payload, (ready) => this.submitExternalSpan(ready), drop);
2521
2540
  } catch (error) {
2541
+ drop();
2522
2542
  warnDroppedExternalSpan(error);
2523
2543
  }
2524
2544
  }
@@ -2837,4 +2857,4 @@ export {
2837
2857
  parseRetryAfterMs,
2838
2858
  HttpClient
2839
2859
  };
2840
- //# sourceMappingURL=chunk-UTBA3ASY.js.map
2860
+ //# sourceMappingURL=chunk-P4R3NY2U.js.map