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.
package/dist/index.d.cts CHANGED
@@ -440,7 +440,8 @@ declare class HttpClient {
440
440
  readonly traceCompletion: TraceCompletion;
441
441
  private closed;
442
442
  private closing;
443
- externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
443
+ externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit, drop: () => void) => void) | undefined;
444
+ frameworkSpanStart: ((traceId: string, spanId: string, parentSpanId: string | null) => void) | undefined;
444
445
  externalTraceTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
445
446
  releaseHeldExternalSpans: ((timeoutMs: number) => Promise<boolean> | Promise<void>) | undefined;
446
447
  stopSimulationPlan: (() => void) | undefined;
@@ -570,6 +571,7 @@ declare class HttpClient {
570
571
  * the OTLP carrier has no path to carry it.
571
572
  */
572
573
  sendInternalTrace(functionId: string, payload: Record<string, unknown>): void;
574
+ reserveFrameworkSpan(traceId: string, spanId: string, parentSpanId: string | null | undefined): void;
573
575
  sendExternalSpan(payload: Record<string, unknown>): void;
574
576
  submitExternalSpan(payload: Record<string, unknown>): void;
575
577
  /**
@@ -2427,6 +2429,7 @@ interface Trace {
2427
2429
  interface Span<_T = any> {
2428
2430
  spanId?: string;
2429
2431
  traceId?: string;
2432
+ parentId?: string | null;
2430
2433
  toJSON(): unknown;
2431
2434
  spanData?: {
2432
2435
  type?: string;
@@ -3622,7 +3625,7 @@ interface CommitRef {
3622
3625
  /**
3623
3626
  * SDK version from package.json (injected at build time)
3624
3627
  */
3625
- declare const __version__ = "0.57.6";
3628
+ declare const __version__ = "0.57.7";
3626
3629
 
3627
3630
  /**
3628
3631
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -440,7 +440,8 @@ declare class HttpClient {
440
440
  readonly traceCompletion: TraceCompletion;
441
441
  private closed;
442
442
  private closing;
443
- externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
443
+ externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit, drop: () => void) => void) | undefined;
444
+ frameworkSpanStart: ((traceId: string, spanId: string, parentSpanId: string | null) => void) | undefined;
444
445
  externalTraceTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
445
446
  releaseHeldExternalSpans: ((timeoutMs: number) => Promise<boolean> | Promise<void>) | undefined;
446
447
  stopSimulationPlan: (() => void) | undefined;
@@ -570,6 +571,7 @@ declare class HttpClient {
570
571
  * the OTLP carrier has no path to carry it.
571
572
  */
572
573
  sendInternalTrace(functionId: string, payload: Record<string, unknown>): void;
574
+ reserveFrameworkSpan(traceId: string, spanId: string, parentSpanId: string | null | undefined): void;
573
575
  sendExternalSpan(payload: Record<string, unknown>): void;
574
576
  submitExternalSpan(payload: Record<string, unknown>): void;
575
577
  /**
@@ -2427,6 +2429,7 @@ interface Trace {
2427
2429
  interface Span<_T = any> {
2428
2430
  spanId?: string;
2429
2431
  traceId?: string;
2432
+ parentId?: string | null;
2430
2433
  toJSON(): unknown;
2431
2434
  spanData?: {
2432
2435
  type?: string;
@@ -3622,7 +3625,7 @@ interface CommitRef {
3622
3625
  /**
3623
3626
  * SDK version from package.json (injected at build time)
3624
3627
  */
3625
- declare const __version__ = "0.57.6";
3628
+ declare const __version__ = "0.57.7";
3626
3629
 
3627
3630
  /**
3628
3631
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ import {
30
30
  getCurrentTrace,
31
31
  reseedFromRegistry,
32
32
  seedFromRegistry
33
- } from "./chunk-ICL6RSND.js";
33
+ } from "./chunk-W3HLGZBO.js";
34
34
  import "./chunk-RCHSYWKI.js";
35
35
  import {
36
36
  BITFAB_PROGRESS_PREFIX,
@@ -39,7 +39,7 @@ import {
39
39
  ReplayError,
40
40
  reportReplayProgress,
41
41
  serializeReplayResult
42
- } from "./chunk-GT4IDECP.js";
42
+ } from "./chunk-VPU6U4WM.js";
43
43
  import {
44
44
  BitfabError,
45
45
  DEFAULT_SERVICE_URL,
@@ -47,7 +47,7 @@ import {
47
47
  MixedTracingError,
48
48
  __version__,
49
49
  flushTraces
50
- } from "./chunk-UTBA3ASY.js";
50
+ } from "./chunk-P4R3NY2U.js";
51
51
  import "./chunk-VCRFFCLY.js";
52
52
  export {
53
53
  AssertionCategoriesClient,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__, __packageName__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.57.6";
100
+ __version__ = "0.57.7";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -1071,7 +1071,13 @@ var init_simulationPlan = __esm({
1071
1071
  DISABLE_SIMULATION_PLAN_ENV = "BITFAB_DISABLE_SIM_PLAN";
1072
1072
  ROOT_TRACE_FUNCTION_KEY_FIELD = "rootTraceFunctionKey";
1073
1073
  CONTENT_OFF_KEY = "content_off_by_simulation_plan";
1074
- CONTENT_KEYS = ["input", "input_meta", "output", "output_meta"];
1074
+ CONTENT_KEYS = [
1075
+ "input",
1076
+ "input_meta",
1077
+ "output",
1078
+ "output_meta",
1079
+ "prompt"
1080
+ ];
1075
1081
  SimulationPlan = class {
1076
1082
  constructor(source, enabled = true) {
1077
1083
  this.source = source;
@@ -1190,13 +1196,13 @@ var init_simulationPlan = __esm({
1190
1196
  }
1191
1197
  return this.loaded;
1192
1198
  }
1193
- send(payload, traceFunctionKey, submit) {
1199
+ send(payload, traceFunctionKey, submit, drop) {
1194
1200
  this.refresh();
1195
1201
  if (this.disabled() || traceFunctionKey === void 0 || spanNameOf(payload) === void 0 || recordedByFramework(payload)) {
1196
1202
  submit(payload);
1197
1203
  return;
1198
1204
  }
1199
- const entry = { payload, traceFunctionKey, submit };
1205
+ const entry = { payload, traceFunctionKey, submit, drop };
1200
1206
  if (this.holdingForFirstRead()) {
1201
1207
  this.hold(entry);
1202
1208
  return;
@@ -1250,6 +1256,7 @@ var init_simulationPlan = __esm({
1250
1256
  try {
1251
1257
  entry.submit(this.payloadToSend(entry));
1252
1258
  } catch (error) {
1259
+ entry.drop?.();
1253
1260
  warnOnce(
1254
1261
  "sim-plan-held-span-dropped",
1255
1262
  `a span held for the sim plan was dropped when released: ${error instanceof Error ? error.message : String(error)}`
@@ -2580,23 +2587,21 @@ var init_http = __esm({
2580
2587
  }
2581
2588
  const deadline = Date.now() + Math.max(timeoutMs, 0);
2582
2589
  this.closing = (async () => {
2583
- const released = await this.releaseHeldExternalSpans?.(
2584
- planWaitSliceMs(timeoutMs)
2590
+ liveHttpClients.delete(this);
2591
+ const settled2 = await this.settleDeferredWork(
2592
+ Math.max(0, deadline - Date.now())
2585
2593
  );
2586
2594
  this.stopSimulationPlan?.();
2595
+ this.closed = true;
2587
2596
  this.externalSpanTransform = void 0;
2588
2597
  this.externalTraceTransform = void 0;
2598
+ this.frameworkSpanStart = void 0;
2589
2599
  this.releaseHeldExternalSpans = void 0;
2590
2600
  this.stopSimulationPlan = void 0;
2591
- liveHttpClients.delete(this);
2592
- const settled2 = await this.settleDeferredWork(
2593
- Math.max(0, deadline - Date.now())
2594
- );
2595
- this.closed = true;
2596
2601
  const transport = this.traceTransport;
2597
2602
  this.traceTransport = void 0;
2598
2603
  const shutdownOk = await transport?.shutdown(Math.max(0, deadline - Date.now())) ?? true;
2599
- return released !== false && settled2 && shutdownOk;
2604
+ return settled2 && shutdownOk;
2600
2605
  })();
2601
2606
  return this.closing;
2602
2607
  }
@@ -2697,8 +2702,7 @@ var init_http = __esm({
2697
2702
  async getSimulationPlan() {
2698
2703
  return this.get(
2699
2704
  "/api/sdk/sim-plan",
2700
- SIMULATION_PLAN_READ_TIMEOUT_MS,
2701
- { Connection: "close" }
2705
+ SIMULATION_PLAN_READ_TIMEOUT_MS
2702
2706
  );
2703
2707
  }
2704
2708
  async getTraceSpan(traceId, lookup) {
@@ -2774,19 +2778,35 @@ var init_http = __esm({
2774
2778
  carrierMeta("internal_trace", body, void 0)
2775
2779
  );
2776
2780
  }
2781
+ reserveFrameworkSpan(traceId, spanId, parentSpanId) {
2782
+ try {
2783
+ this.frameworkSpanStart?.(traceId, spanId, parentSpanId ?? null);
2784
+ } catch (error) {
2785
+ warnOnce(
2786
+ "framework-span-reservation-failed",
2787
+ `a framework span could not be counted toward its trace's span limit: ${describeError(error)}`
2788
+ );
2789
+ }
2790
+ }
2777
2791
  sendExternalSpan(payload) {
2778
2792
  const ref2 = carrierRef(payload);
2779
2793
  if (ref2?.spanId !== void 0) {
2780
2794
  this.traceCompletion.record(ref2.traceId, ref2.spanId);
2781
2795
  }
2796
+ const drop = () => {
2797
+ if (ref2?.spanId !== void 0) {
2798
+ this.traceCompletion.abort(ref2.traceId, ref2.spanId);
2799
+ }
2800
+ };
2782
2801
  const gate = this.externalSpanTransform;
2783
2802
  if (gate === void 0) {
2784
2803
  this.submitExternalSpan(payload);
2785
2804
  return;
2786
2805
  }
2787
2806
  try {
2788
- gate(payload, (ready) => this.submitExternalSpan(ready));
2807
+ gate(payload, (ready) => this.submitExternalSpan(ready), drop);
2789
2808
  } catch (error) {
2809
+ drop();
2790
2810
  warnDroppedExternalSpan(error);
2791
2811
  }
2792
2812
  }
@@ -4679,6 +4699,11 @@ var BitfabClaudeAgentHandler = class {
4679
4699
  }
4680
4700
  this.runToSpan.set(spanId, spanInfo);
4681
4701
  this.httpClient.traceCompletion.start(spanInfo.traceId, spanInfo.spanId);
4702
+ this.httpClient.reserveFrameworkSpan(
4703
+ spanInfo.traceId,
4704
+ spanInfo.spanId,
4705
+ spanInfo.parentId
4706
+ );
4682
4707
  return spanInfo;
4683
4708
  }
4684
4709
  completeSpan(spanId, output, error, extraContexts) {
@@ -4958,6 +4983,11 @@ var BitfabClaudeAgentHandler = class {
4958
4983
  this.conversationHistory.push(...this.pendingMessages);
4959
4984
  this.pendingMessages = [];
4960
4985
  this.currentLlmSpanId = randomUuid();
4986
+ this.httpClient.reserveFrameworkSpan(
4987
+ this.ensureTrace(),
4988
+ this.currentLlmSpanId,
4989
+ this.getParentId()
4990
+ );
4961
4991
  this.currentLlmMessageId = messageId ?? null;
4962
4992
  this.currentLlmContent = [];
4963
4993
  this.currentLlmModel = inner.model ?? null;
@@ -6368,6 +6398,11 @@ var BitfabLangGraphCallbackHandler = class {
6368
6398
  this.runToSpan.set(runId, spanInfo);
6369
6399
  if (spanInfo.hidden !== true) {
6370
6400
  this.httpClient.traceCompletion.start(spanInfo.traceId, spanInfo.spanId);
6401
+ this.httpClient.reserveFrameworkSpan(
6402
+ spanInfo.traceId,
6403
+ spanInfo.spanId,
6404
+ spanInfo.parentId
6405
+ );
6371
6406
  }
6372
6407
  if (isRootInvocation) {
6373
6408
  this.sendTraceStart(spanInfo);
@@ -7913,8 +7948,14 @@ var BitfabOpenAITracingProcessor = class {
7913
7948
  async onSpanStart(span) {
7914
7949
  if (span.spanId !== void 0 && span.traceId !== null && span.traceId !== void 0) {
7915
7950
  this.startedSpans.set(span.spanId, span.traceId);
7916
- const traceId = this.activeSpanMappings[span.traceId]?.traceId ?? span.traceId;
7951
+ const mapping = this.activeSpanMappings[span.traceId];
7952
+ const traceId = mapping?.traceId ?? span.traceId;
7917
7953
  this.httpClient.traceCompletion.start(traceId, span.spanId);
7954
+ this.httpClient.reserveFrameworkSpan(
7955
+ traceId,
7956
+ span.spanId,
7957
+ span.parentId ?? mapping?.spanId
7958
+ );
7918
7959
  }
7919
7960
  }
7920
7961
  /**
@@ -8301,22 +8342,68 @@ var BitfabVercelAiHandler = class {
8301
8342
 
8302
8343
  // src/client.ts
8303
8344
  init_warnOnce();
8345
+ var TRUNCATION_LIMIT_ORDER = [
8346
+ "max_depth",
8347
+ "max_spans",
8348
+ "max_captured_subtree_spans"
8349
+ ];
8304
8350
  var activeTraceStates = /* @__PURE__ */ new Map();
8305
- function fitsTraceSpanBudget(payload) {
8306
- if (!recordedByFramework(payload)) {
8307
- return true;
8351
+ var REFUSED_FRAMEWORK_SPAN_TRACES_RETAINED = 1024;
8352
+ var refusedFrameworkSpans = /* @__PURE__ */ new Map();
8353
+ function frameworkSpanRefused(traceId, spanId) {
8354
+ return refusedFrameworkSpans.get(traceId)?.has(spanId) === true;
8355
+ }
8356
+ function refuseFrameworkSpan(traceId, spanId) {
8357
+ const refused = refusedFrameworkSpans.get(traceId);
8358
+ if (refused !== void 0) {
8359
+ refused.add(spanId);
8360
+ return;
8308
8361
  }
8309
- const traceId = traceIdOf(payload);
8310
- const spanBudget = traceId === void 0 ? void 0 : activeTraceStates.get(traceId)?.spanBudget;
8311
- if (spanBudget === void 0) {
8312
- return true;
8362
+ refusedFrameworkSpans.set(traceId, /* @__PURE__ */ new Set([spanId]));
8363
+ while (refusedFrameworkSpans.size > REFUSED_FRAMEWORK_SPAN_TRACES_RETAINED) {
8364
+ const oldest = refusedFrameworkSpans.keys().next();
8365
+ if (oldest.done) {
8366
+ return;
8367
+ }
8368
+ refusedFrameworkSpans.delete(oldest.value);
8313
8369
  }
8314
- if (spanBudget.spansUsed >= spanBudget.maxSpans) {
8315
- spanBudget.truncate();
8370
+ }
8371
+ function reserveFrameworkSpan(traceId, spanId, parentSpanId) {
8372
+ const spanBudget = activeTraceStates.get(traceId)?.spanBudget;
8373
+ const parentRefused = parentSpanId !== null && frameworkSpanRefused(traceId, parentSpanId);
8374
+ if (!parentRefused && (spanBudget === void 0 || spanBudget.spansUsed < spanBudget.maxSpans)) {
8375
+ if (spanBudget !== void 0) {
8376
+ spanBudget.spansUsed += 1;
8377
+ }
8378
+ return;
8379
+ }
8380
+ refuseFrameworkSpan(traceId, spanId);
8381
+ spanBudget?.truncate("max_spans");
8382
+ }
8383
+ function isRefusedFrameworkSpan(payload) {
8384
+ if (!recordedByFramework(payload)) {
8316
8385
  return false;
8317
8386
  }
8318
- spanBudget.spansUsed += 1;
8319
- return true;
8387
+ const rawSpan = payload.rawSpan;
8388
+ const spanId = rawSpan?.id;
8389
+ if (typeof spanId !== "string") {
8390
+ return false;
8391
+ }
8392
+ const traceIds = [payload.sourceTraceId, traceIdOf(payload)];
8393
+ return traceIds.some(
8394
+ (traceId) => typeof traceId === "string" && frameworkSpanRefused(traceId, spanId)
8395
+ );
8396
+ }
8397
+ function truncationMetadata(truncation) {
8398
+ if (truncation === void 0 || truncation.limits.size === 0) {
8399
+ return void 0;
8400
+ }
8401
+ return {
8402
+ "bitfab.truncated_by": TRUNCATION_LIMIT_ORDER.filter(
8403
+ (limit) => truncation.limits.has(limit)
8404
+ ).join(","),
8405
+ "bitfab.dropped_spans": truncation.droppedSpans
8406
+ };
8320
8407
  }
8321
8408
  function rootTraceFunctionKeyOfTrace(traceId, fallback) {
8322
8409
  return activeTraceStates.get(traceId)?.traceFunctionKey ?? fallback;
@@ -8698,7 +8785,6 @@ function readBooleanEnv(name) {
8698
8785
  var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
8699
8786
  var DEFAULT_AUTO_TRACE_MAX_SPANS = 2048;
8700
8787
  var DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS = 512;
8701
- var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
8702
8788
  function spanOwnerName(receiver) {
8703
8789
  if (typeof receiver === "function") {
8704
8790
  return receiver.name !== "" ? receiver.name : void 0;
@@ -8764,7 +8850,8 @@ var Bitfab = class {
8764
8850
  this.httpClient,
8765
8851
  config.simulationPlan ?? true
8766
8852
  );
8767
- this.httpClient.externalSpanTransform = (payload, submit) => this.applySimulationPlan(payload, submit);
8853
+ this.httpClient.externalSpanTransform = (payload, submit, drop) => this.applySimulationPlan(payload, submit, drop);
8854
+ this.httpClient.frameworkSpanStart = reserveFrameworkSpan;
8768
8855
  this.httpClient.externalTraceTransform = (payload, submit) => this.simulationPlan.sendTrace(payload, submit);
8769
8856
  this.httpClient.releaseHeldExternalSpans = (timeoutMs) => this.simulationPlan.release(timeoutMs);
8770
8857
  this.httpClient.stopSimulationPlan = () => this.simulationPlan.stop();
@@ -8960,35 +9047,31 @@ var Bitfab = class {
8960
9047
  function(...args) {
8961
9048
  self.simulationPlan.refresh();
8962
9049
  let capturedSubtreeCount = 0;
8963
- let truncated = false;
8964
- const warnTruncated = () => {
8965
- if (!truncated) {
8966
- truncated = true;
8967
- getCurrentTrace().setMetadata({
8968
- bitfabAutoTrace: {
8969
- protocol: AUTO_TRACE_PROTOCOL,
8970
- truncated: true,
8971
- maxDepth,
8972
- maxSpans,
8973
- maxCapturedSubtreeSpans
8974
- }
8975
- });
8976
- }
9050
+ const rootSpanStack = getSpanStack();
9051
+ const rootSpan = rootSpanStack[rootSpanStack.length - 1];
9052
+ const rootTraceState = rootSpan === void 0 ? void 0 : activeTraceStates.get(rootSpan.traceId);
9053
+ const truncation = rootTraceState?.truncation ?? {
9054
+ limits: /* @__PURE__ */ new Set(),
9055
+ droppedSpans: 0
9056
+ };
9057
+ const truncate = (limit) => {
9058
+ truncation.limits.add(limit);
9059
+ truncation.droppedSpans += 1;
8977
9060
  warnOnce(
8978
9061
  `auto-trace-truncated:${traceFunctionKey}`,
8979
9062
  `"${traceFunctionKey}" hit an automatic subtree capture limit (maxDepth=${maxDepth}, maxCapturedSubtreeSpans=${maxCapturedSubtreeSpans}, maxSpans=${maxSpans}); its trace is incomplete. Raise the limits, declare the calls you need with node(), or narrow the subtree with exclude.`
8980
9063
  );
8981
9064
  };
8982
- const rootSpanStack = getSpanStack();
8983
9065
  const spanBudget = {
8984
9066
  spansUsed: 1,
8985
9067
  maxSpans,
8986
- truncate: () => runWithSpanStack(rootSpanStack, warnTruncated)
9068
+ truncate
8987
9069
  };
8988
- const rootSpan = rootSpanStack[rootSpanStack.length - 1];
8989
- const rootTraceState = rootSpan === void 0 ? void 0 : activeTraceStates.get(rootSpan.traceId);
8990
- if (rootTraceState !== void 0 && rootTraceState.spanBudget === void 0) {
8991
- rootTraceState.spanBudget = spanBudget;
9070
+ if (rootTraceState !== void 0) {
9071
+ rootTraceState.truncation = truncation;
9072
+ if (rootTraceState.spanBudget === void 0) {
9073
+ rootTraceState.spanBudget = spanBudget;
9074
+ }
8992
9075
  }
8993
9076
  const spanStackOf = (entry) => entry.spanStack;
8994
9077
  const openChild = (entry, childOptions, inputs, isAsync, invokeFn) => {
@@ -9028,15 +9111,16 @@ var Bitfab = class {
9028
9111
  rootTraceFunctionKeyOfEntry(entry),
9029
9112
  spanName
9030
9113
  );
9031
- if (entry.depth < maxDepth && spanBudget.spansUsed < maxSpans && (!countsTowardCapturedSubtree || capturedSubtreeCount < maxCapturedSubtreeSpans)) {
9032
- spanBudget.spansUsed += 1;
9033
- if (countsTowardCapturedSubtree) {
9034
- capturedSubtreeCount += 1;
9035
- }
9036
- return true;
9114
+ const refusedBy = entry.depth >= maxDepth ? "max_depth" : spanBudget.spansUsed >= maxSpans ? "max_spans" : countsTowardCapturedSubtree && capturedSubtreeCount >= maxCapturedSubtreeSpans ? "max_captured_subtree_spans" : void 0;
9115
+ if (refusedBy !== void 0) {
9116
+ truncate(refusedBy);
9117
+ return false;
9037
9118
  }
9038
- runWithSpanStack(spanStackOf(entry), warnTruncated);
9039
- return false;
9119
+ spanBudget.spansUsed += 1;
9120
+ if (countsTowardCapturedSubtree) {
9121
+ capturedSubtreeCount += 1;
9122
+ }
9123
+ return true;
9040
9124
  };
9041
9125
  const autoTraceContext = {
9042
9126
  traceFunctionKey,
@@ -9163,11 +9247,17 @@ var Bitfab = class {
9163
9247
  Object.defineProperty(autoTraceRoot, "_bitfabWrappedFn", { value: fn });
9164
9248
  return autoTraceRoot;
9165
9249
  }
9166
- applySimulationPlan(payload, submit) {
9167
- if (!fitsTraceSpanBudget(payload)) {
9250
+ applySimulationPlan(payload, submit, drop) {
9251
+ if (isRefusedFrameworkSpan(payload)) {
9252
+ drop();
9168
9253
  return;
9169
9254
  }
9170
- this.simulationPlan.send(payload, rootTraceFunctionKeyOf(payload), submit);
9255
+ this.simulationPlan.send(
9256
+ payload,
9257
+ rootTraceFunctionKeyOf(payload),
9258
+ submit,
9259
+ drop
9260
+ );
9171
9261
  }
9172
9262
  /**
9173
9263
  * Flush and permanently close this client's tracing resources: its pending
@@ -9836,6 +9926,9 @@ var Bitfab = class {
9836
9926
  registeredTraceId = traceId;
9837
9927
  }
9838
9928
  self.httpClient.traceCompletion.start(traceId, spanId);
9929
+ if (isFrameworkInstrumentation(options.instrumentation)) {
9930
+ reserveFrameworkSpan(traceId, spanId, parentSpanId);
9931
+ }
9839
9932
  startedSpan = { traceId, spanId };
9840
9933
  const functionName = fn.name !== "" ? fn.name : void 0;
9841
9934
  const rootTraceFunctionKey = rootTraceFunctionKeyOfTrace(
@@ -9880,6 +9973,10 @@ var Bitfab = class {
9880
9973
  }
9881
9974
  if (isRootSpan) {
9882
9975
  const traceState = activeTraceStates.get(traceId);
9976
+ const truncated = truncationMetadata(traceState?.truncation);
9977
+ if (truncated !== void 0) {
9978
+ recordCallerTraceMetadata(traceId, truncated);
9979
+ }
9883
9980
  self.sendTraceCompletion({
9884
9981
  traceFunctionKey,
9885
9982
  traceId,
@@ -10432,7 +10529,7 @@ var Bitfab = class {
10432
10529
  ...params.captureContent && params.contexts && params.contexts.length > 0 && {
10433
10530
  contexts: params.contexts
10434
10531
  },
10435
- ...params.captureContent && params.prompt !== void 0 && { prompt: params.prompt },
10532
+ ...buildsContent && params.prompt !== void 0 && { prompt: params.prompt },
10436
10533
  ...contentOff && { [CONTENT_OFF_KEY]: true }
10437
10534
  }
10438
10535
  };