bitfab 0.54.12 → 0.54.14

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 (42) hide show
  1. package/dist/autoTrace.cjs +0 -19
  2. package/dist/autoTrace.cjs.map +1 -1
  3. package/dist/autoTrace.d.cts +1 -3
  4. package/dist/autoTrace.d.ts +1 -3
  5. package/dist/autoTrace.js +1 -5
  6. package/dist/{chunk-RDSNJFWY.js → chunk-3FL22BEM.js} +37 -7
  7. package/dist/chunk-3FL22BEM.js.map +1 -0
  8. package/dist/{chunk-VTFBDA3O.js → chunk-N7ZNDZLR.js} +21 -15
  9. package/dist/chunk-N7ZNDZLR.js.map +1 -0
  10. package/dist/{chunk-WKXLCFLT.js → chunk-NIGVK5V7.js} +22 -16
  11. package/dist/chunk-NIGVK5V7.js.map +1 -0
  12. package/dist/{chunk-EGWJYCNT.js → chunk-RCHSYWKI.js} +2 -19
  13. package/dist/chunk-RCHSYWKI.js.map +1 -0
  14. package/dist/{chunk-YY5BB2YS.js → chunk-SV5FYJQ4.js} +33 -60
  15. package/dist/chunk-SV5FYJQ4.js.map +1 -0
  16. package/dist/{chunk-ZR4HGK6G.js → chunk-X6JOFMNV.js} +9 -3
  17. package/dist/chunk-X6JOFMNV.js.map +1 -0
  18. package/dist/{http-NWSSB5FA.js → http-HM2SNB6L.js} +2 -2
  19. package/dist/{http-RJH6VYAM.js → http-ZXMIZQV5.js} +2 -2
  20. package/dist/index.cjs +54 -83
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +16 -14
  23. package/dist/index.d.ts +16 -14
  24. package/dist/index.js +4 -4
  25. package/dist/node.cjs +54 -83
  26. package/dist/node.cjs.map +1 -1
  27. package/dist/node.d.cts +1 -1
  28. package/dist/node.d.ts +1 -1
  29. package/dist/node.js +4 -4
  30. package/dist/{replay-WB5NQNQS.js → replay-XCXNPWMC.js} +3 -3
  31. package/dist/replayCli.js +2 -2
  32. package/dist/seedCli.js +2 -2
  33. package/package.json +1 -1
  34. package/dist/chunk-EGWJYCNT.js.map +0 -1
  35. package/dist/chunk-RDSNJFWY.js.map +0 -1
  36. package/dist/chunk-VTFBDA3O.js.map +0 -1
  37. package/dist/chunk-WKXLCFLT.js.map +0 -1
  38. package/dist/chunk-YY5BB2YS.js.map +0 -1
  39. package/dist/chunk-ZR4HGK6G.js.map +0 -1
  40. /package/dist/{http-NWSSB5FA.js.map → http-HM2SNB6L.js.map} +0 -0
  41. /package/dist/{http-RJH6VYAM.js.map → http-ZXMIZQV5.js.map} +0 -0
  42. /package/dist/{replay-WB5NQNQS.js.map → replay-XCXNPWMC.js.map} +0 -0
@@ -1,14 +1,12 @@
1
1
  import {
2
2
  __bitfabAutoTraceActive,
3
- __setBitfabAutoTraceCapturePolicy,
4
3
  clearAutoTraceNodeConfiguration,
5
4
  currentAutoTraceEntries,
6
- getAutoTraceCapturePolicy,
7
5
  invokeThroughAutoTraceEntries,
8
6
  runWithAutoTraceEntry,
9
7
  runWithAutoTraceNodeConfiguration,
10
8
  runWithAutoTraceRootContext
11
- } from "./chunk-EGWJYCNT.js";
9
+ } from "./chunk-RCHSYWKI.js";
12
10
  import {
13
11
  NO_MOCK_OVERRIDE,
14
12
  createIntegrationFixtureContext,
@@ -19,13 +17,12 @@ import {
19
17
  serializeValue,
20
18
  toJsonSafe,
21
19
  toJsonSafeReport
22
- } from "./chunk-ZR4HGK6G.js";
20
+ } from "./chunk-X6JOFMNV.js";
23
21
  import {
24
22
  BitfabError,
25
23
  DEFAULT_SERVICE_URL,
26
24
  HttpClient,
27
25
  MixedTracingError,
28
- PolicyRefresh,
29
26
  ROOT_TRACE_FUNCTION_KEY_FIELD,
30
27
  SimulationPlan,
31
28
  callerTraceMetadata,
@@ -36,7 +33,7 @@ import {
36
33
  recordCallerTraceMetadata,
37
34
  retireTraceMetadata,
38
35
  warnOnce
39
- } from "./chunk-WKXLCFLT.js";
36
+ } from "./chunk-NIGVK5V7.js";
40
37
  import {
41
38
  __privateAdd,
42
39
  __privateGet,
@@ -1470,6 +1467,14 @@ var LabelsClient = class {
1470
1467
  );
1471
1468
  return response.labels;
1472
1469
  }
1470
+ /** Withhold a verdict for a trace or replay attempt whose check did not run. */
1471
+ async skip(target, testRunId) {
1472
+ return this.save({ ...target, skip: true }, testRunId);
1473
+ }
1474
+ /** Clear a previous verdict for a trace, replay attempt, or assertion. */
1475
+ async archive(target, testRunId) {
1476
+ return this.save({ ...target, archive: true }, testRunId);
1477
+ }
1473
1478
  async saveHuman(update) {
1474
1479
  const [outcome] = await this.saveHumanAll([update]);
1475
1480
  return outcome;
@@ -2378,6 +2383,15 @@ var BitfabLangGraphIntegration = class {
2378
2383
  }
2379
2384
  };
2380
2385
 
2386
+ // src/streamFinalizationError.ts
2387
+ var StreamFinalizationError = class extends Error {
2388
+ constructor(message, output) {
2389
+ super(message);
2390
+ this.output = output;
2391
+ this.name = "StreamFinalizationError";
2392
+ }
2393
+ };
2394
+
2381
2395
  // src/openaiAgentSdk.ts
2382
2396
  var BitfabOpenAIAgentHandler = class {
2383
2397
  constructor(config) {
@@ -2417,7 +2431,11 @@ var BitfabOpenAIAgentHandler = class {
2417
2431
  if (isStreaming && res?.completed) {
2418
2432
  try {
2419
2433
  await res.completed;
2420
- } catch {
2434
+ } catch (error) {
2435
+ throw new StreamFinalizationError(
2436
+ error instanceof Error ? error.message : String(error),
2437
+ res.finalOutput
2438
+ );
2421
2439
  }
2422
2440
  }
2423
2441
  return res?.finalOutput;
@@ -3157,15 +3175,6 @@ function runWithSeedContext(ctx, fn) {
3157
3175
  return fn();
3158
3176
  }
3159
3177
 
3160
- // src/streamFinalizationError.ts
3161
- var StreamFinalizationError = class extends Error {
3162
- constructor(message, output) {
3163
- super(message);
3164
- this.output = output;
3165
- this.name = "StreamFinalizationError";
3166
- }
3167
- };
3168
-
3169
3178
  // src/traces.ts
3170
3179
  var ASSERTIONS_PATH = "/api/sdk/traces/assertions";
3171
3180
  var SEARCH_PATH = "/api/sdk/traces/search";
@@ -4075,8 +4084,6 @@ function readBooleanEnv(name) {
4075
4084
  var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
4076
4085
  var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
4077
4086
  var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
4078
- var AUTO_TRACE_POLICY_REFRESH_MS = 6e4;
4079
- var AUTO_TRACE_POLICY_RETRY_MS = 1e4;
4080
4087
  function spanOwnerName(receiver) {
4081
4088
  if (typeof receiver === "function") {
4082
4089
  return receiver.name !== "" ? receiver.name : void 0;
@@ -4109,7 +4116,6 @@ var Bitfab = class {
4109
4116
  constructor(config) {
4110
4117
  /** Gate the empty-key warning to fire at most once. */
4111
4118
  this.apiKeyWarned = false;
4112
- this.autoTracePolicyRefreshes = /* @__PURE__ */ new Map();
4113
4119
  /**
4114
4120
  * Mock overrides registered via {@link Bitfab.registerMockOverride}, applied
4115
4121
  * to every `replay` on this client (after any per-call `mockOverride`). In
@@ -4158,12 +4164,12 @@ var Bitfab = class {
4158
4164
  *
4159
4165
  * Build instrumentation turns repository functions called beneath this
4160
4166
  * method into nested spans that capture inputs, outputs, and errors by
4161
- * default. A confirmed capture policy can narrow rich capture to selected
4162
- * function IDs.
4167
+ * default. Source exclusions and sim-plan capture-off decisions are explicit
4168
+ * opt-outs from that default.
4163
4169
  * Without a compatible build transform, this still records the decorated
4164
4170
  * method as a normal rich root span but cannot discover child calls.
4165
4171
  *
4166
- * @param traceFunctionKey - Groups traces and their capture policy.
4172
+ * @param traceFunctionKey - Groups traces and their capture controls.
4167
4173
  * @param options - Root presentation, subtree bounds, and exclusions.
4168
4174
  * @experimental Automatic child-call instrumentation is experimental.
4169
4175
  */
@@ -4321,11 +4327,6 @@ var Bitfab = class {
4321
4327
  traceFunctionKey,
4322
4328
  spanOptions,
4323
4329
  function(...args) {
4324
- const capturePolicy = getAutoTraceCapturePolicy(
4325
- self,
4326
- traceFunctionKey
4327
- );
4328
- self.refreshAutoTraceCapturePolicy(traceFunctionKey);
4329
4330
  self.simulationPlan.refresh();
4330
4331
  let spansUsed = 0;
4331
4332
  let truncated = false;
@@ -4405,7 +4406,7 @@ var Bitfab = class {
4405
4406
  surface: "opt-out",
4406
4407
  instrumentation: "trace",
4407
4408
  functionId: definition.id,
4408
- captureContent: nodeConfiguration !== void 0 || capturePolicy === void 0 || capturePolicy.has(definition.id),
4409
+ captureContent: true,
4409
4410
  autoTraceDefinition: definition,
4410
4411
  ...nodeConfiguration?.testRunId !== void 0 && {
4411
4412
  testRunId: nodeConfiguration.testRunId
@@ -4504,34 +4505,6 @@ var Bitfab = class {
4504
4505
  applySimulationPlan(payload, submit) {
4505
4506
  this.simulationPlan.send(payload, rootTraceFunctionKeyOf(payload), submit);
4506
4507
  }
4507
- refreshAutoTraceCapturePolicy(traceFunctionKey) {
4508
- const state2 = this.autoTracePolicyRefreshes.get(traceFunctionKey) ?? new PolicyRefresh();
4509
- this.autoTracePolicyRefreshes.set(traceFunctionKey, state2);
4510
- state2.run(
4511
- () => this.httpClient.getAutoTracePolicy(
4512
- traceFunctionKey,
4513
- AUTO_TRACE_PROTOCOL
4514
- ),
4515
- (policy) => {
4516
- if (policy.protocol !== AUTO_TRACE_PROTOCOL) {
4517
- state2.hold(AUTO_TRACE_POLICY_RETRY_MS);
4518
- return;
4519
- }
4520
- const functionIds = Array.isArray(policy.functionIds) ? policy.functionIds.filter(
4521
- (id) => typeof id === "string" && id.startsWith(`${AUTO_TRACE_PROTOCOL}:`)
4522
- ).slice(0, DEFAULT_AUTO_TRACE_MAX_SPANS) : [];
4523
- __setBitfabAutoTraceCapturePolicy(
4524
- this,
4525
- traceFunctionKey,
4526
- policy.revision === null ? void 0 : functionIds
4527
- );
4528
- state2.hold(AUTO_TRACE_POLICY_REFRESH_MS);
4529
- },
4530
- () => {
4531
- state2.hold(AUTO_TRACE_POLICY_RETRY_MS);
4532
- }
4533
- );
4534
- }
4535
4508
  /**
4536
4509
  * Flush and permanently close this client's tracing resources: its pending
4537
4510
  * requests and the single span-transport worker shared by its decorators and
@@ -5938,7 +5911,7 @@ var Bitfab = class {
5938
5911
  await runWithSeedContext({ traceId }, async () => target(...args));
5939
5912
  } finally {
5940
5913
  try {
5941
- const { flushTraces: flushTraces2 } = await import("./http-NWSSB5FA.js");
5914
+ const { flushTraces: flushTraces2 } = await import("./http-HM2SNB6L.js");
5942
5915
  await flushTraces2(3e4);
5943
5916
  } finally {
5944
5917
  unrecorded = activeTraceStates.delete(traceId);
@@ -5997,7 +5970,7 @@ var Bitfab = class {
5997
5970
  `Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
5998
5971
  );
5999
5972
  }
6000
- const { replay: doReplay } = await import("./replay-WB5NQNQS.js");
5973
+ const { replay: doReplay } = await import("./replay-XCXNPWMC.js");
6001
5974
  return doReplay(
6002
5975
  this.httpClient,
6003
5976
  this.serviceUrl,
@@ -6317,7 +6290,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
6317
6290
  sessionId: seedCase.sessionId
6318
6291
  })
6319
6292
  );
6320
- const { flushTraces: flushTraces2 } = await import("./http-NWSSB5FA.js");
6293
+ const { flushTraces: flushTraces2 } = await import("./http-HM2SNB6L.js");
6321
6294
  await flushTraces2(3e4);
6322
6295
  return { pipeline, traceFunctionKey, traceIds };
6323
6296
  }
@@ -6356,4 +6329,4 @@ export {
6356
6329
  reseedFromRegistry,
6357
6330
  seedFromRegistry
6358
6331
  };
6359
- //# sourceMappingURL=chunk-YY5BB2YS.js.map
6332
+ //# sourceMappingURL=chunk-SV5FYJQ4.js.map