@bitfab/sdk 0.44.1 → 0.46.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.
@@ -14,7 +14,7 @@ import {
14
14
  serializeValue,
15
15
  toJsonSafe,
16
16
  toJsonSafeReport
17
- } from "./chunk-SMWYCJH6.js";
17
+ } from "./chunk-WVGPOCCT.js";
18
18
  import {
19
19
  BitfabError,
20
20
  DEFAULT_SERVICE_URL,
@@ -22,7 +22,7 @@ import {
22
22
  MixedTracingError,
23
23
  getReplayContext,
24
24
  warnOnce
25
- } from "./chunk-XTX66R4I.js";
25
+ } from "./chunk-HSLKCBA3.js";
26
26
  import {
27
27
  __privateAdd,
28
28
  __privateGet,
@@ -32,6 +32,33 @@ import {
32
32
  isAsyncStorageInitDone
33
33
  } from "./chunk-H6LZRFMN.js";
34
34
 
35
+ // src/assertions.ts
36
+ function expectationsPath(traceId, suffix = "") {
37
+ return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
38
+ }
39
+ var TracesClient = class {
40
+ constructor(httpClient) {
41
+ this.httpClient = httpClient;
42
+ }
43
+ async getAssertions(traceId) {
44
+ return this.httpClient.get(expectationsPath(traceId));
45
+ }
46
+ async saveAssertions(params) {
47
+ const response = await this.httpClient.request(expectationsPath(params.traceId), {
48
+ assertions: params.assertions,
49
+ source: params.source ?? "agent"
50
+ });
51
+ return response.assertions;
52
+ }
53
+ async archiveAssertions(params) {
54
+ const response = await this.httpClient.request(
55
+ expectationsPath(params.traceId, "/archive"),
56
+ { assertionIds: params.assertionIds }
57
+ );
58
+ return response.archived;
59
+ }
60
+ };
61
+
35
62
  // src/processorPayload.ts
36
63
  var SERIALIZATION_DEGRADED_STEP = "serialization_degraded";
37
64
  function degradedError(dropped) {
@@ -1133,6 +1160,28 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
1133
1160
  };
1134
1161
  }
1135
1162
 
1163
+ // src/labels.ts
1164
+ var LABELS_PATH = "/api/sdk/traces/labels";
1165
+ var LabelsClient = class {
1166
+ constructor(httpClient) {
1167
+ this.httpClient = httpClient;
1168
+ }
1169
+ async save(update, testRunId) {
1170
+ const [outcome] = await this.saveAll([update], testRunId);
1171
+ return outcome;
1172
+ }
1173
+ async saveAll(updates, testRunId) {
1174
+ const response = await this.httpClient.request(
1175
+ LABELS_PATH,
1176
+ {
1177
+ labels: updates,
1178
+ ...testRunId === void 0 ? {} : { testRunId }
1179
+ }
1180
+ );
1181
+ return response.labels;
1182
+ }
1183
+ };
1184
+
1136
1185
  // src/langgraph.ts
1137
1186
  var LANGSMITH_HIDDEN_TAG = "langsmith:hidden";
1138
1187
  var CHAIN_RUN_TYPES = /* @__PURE__ */ new Set(["chain", "parser", "prompt"]);
@@ -2883,6 +2932,8 @@ var Bitfab = class {
2883
2932
  timeout: this.timeout
2884
2933
  });
2885
2934
  this.datasets = new DatasetsClient(this.httpClient);
2935
+ this.traces = new TracesClient(this.httpClient);
2936
+ this.labels = new LabelsClient(this.httpClient);
2886
2937
  }
2887
2938
  /**
2888
2939
  * Decorate a class method as an automatically expanded trace root.
@@ -4449,7 +4500,7 @@ var Bitfab = class {
4449
4500
  await runWithSeedContext({ traceId }, async () => target(...args));
4450
4501
  } finally {
4451
4502
  try {
4452
- const { flushTraces: flushTraces2 } = await import("./http-GHKRM3L7.js");
4503
+ const { flushTraces: flushTraces2 } = await import("./http-LVSVWTKO.js");
4453
4504
  await flushTraces2(3e4);
4454
4505
  } finally {
4455
4506
  unrecorded = activeTraceStates.delete(traceId);
@@ -4477,7 +4528,7 @@ var Bitfab = class {
4477
4528
  `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.`
4478
4529
  );
4479
4530
  }
4480
- const { replay: doReplay } = await import("./replay-IPATGCIY.js");
4531
+ const { replay: doReplay } = await import("./replay-Q2YYL5HB.js");
4481
4532
  return doReplay(
4482
4533
  this.httpClient,
4483
4534
  this.serviceUrl,
@@ -4743,7 +4794,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
4743
4794
  sessionId: seedCase.sessionId
4744
4795
  })
4745
4796
  );
4746
- const { flushTraces: flushTraces2 } = await import("./http-GHKRM3L7.js");
4797
+ const { flushTraces: flushTraces2 } = await import("./http-LVSVWTKO.js");
4747
4798
  await flushTraces2(3e4);
4748
4799
  return { pipeline, traceFunctionKey, traceIds };
4749
4800
  }
@@ -4759,9 +4810,11 @@ function resolveTraceFunctionKey(registration) {
4759
4810
  }
4760
4811
 
4761
4812
  export {
4813
+ TracesClient,
4762
4814
  BitfabClaudeAgentHandler,
4763
4815
  DatasetsClient,
4764
4816
  SUPPORTED_PROVIDERS,
4817
+ LabelsClient,
4765
4818
  BitfabLangGraphCallbackHandler,
4766
4819
  BitfabLangGraphIntegration,
4767
4820
  BitfabOpenAIAgentHandler,
@@ -4776,4 +4829,4 @@ export {
4776
4829
  defineReplayRegistry,
4777
4830
  seedFromRegistry
4778
4831
  };
4779
- //# sourceMappingURL=chunk-RZF5XSM6.js.map
4832
+ //# sourceMappingURL=chunk-OS62EZ6Y.js.map