@bitfab/sdk 0.44.0 → 0.45.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.
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-6JTVCM2L.js";
9
+ } from "./chunk-TCOD5O2B.js";
10
10
  import "./chunk-H6LZRFMN.js";
11
11
  export {
12
12
  BitfabError,
@@ -17,4 +17,4 @@ export {
17
17
  parseRetryAfterMs,
18
18
  serializePayloadBody
19
19
  };
20
- //# sourceMappingURL=http-QWUWDTFN.js.map
20
+ //# sourceMappingURL=http-E7RYN3BX.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-AX6EZPGH.js";
9
+ } from "./chunk-SILI6DDS.js";
10
10
  export {
11
11
  BitfabError,
12
12
  HttpClient,
@@ -16,4 +16,4 @@ export {
16
16
  parseRetryAfterMs,
17
17
  serializePayloadBody
18
18
  };
19
- //# sourceMappingURL=http-Q4TSO32V.js.map
19
+ //# sourceMappingURL=http-QGTV3X7R.js.map
package/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.44.0";
45
+ __version__ = "0.45.0";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -2719,7 +2719,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2719
2719
  tokens: null,
2720
2720
  model: serverItem.originalModel ?? serverItem.model ?? null,
2721
2721
  dbSnapshotRef: dbSnapshotRef ?? null,
2722
- dbBranchTimings: dbBranchTimings ?? null
2722
+ dbBranchTimings: dbBranchTimings ?? null,
2723
+ traceOutline: null,
2724
+ originalTraceOutline: null
2723
2725
  };
2724
2726
  }
2725
2727
  try {
@@ -2803,7 +2805,9 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
2803
2805
  tokens: null,
2804
2806
  model: originalModel,
2805
2807
  dbSnapshotRef: dbSnapshotRef ?? null,
2806
- dbBranchTimings: dbBranchTimings ?? null
2808
+ dbBranchTimings: dbBranchTimings ?? null,
2809
+ traceOutline: null,
2810
+ originalTraceOutline: null
2807
2811
  };
2808
2812
  }
2809
2813
  async function waitForReplayPersistence(httpClient, testRunId, replayedTraceIds) {
@@ -3058,7 +3062,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
3058
3062
  tokens: item.tokens,
3059
3063
  model: item.model,
3060
3064
  dbSnapshotRef: item.dbSnapshotRef,
3061
- dbBranchTimings: item.dbBranchTimings
3065
+ dbBranchTimings: item.dbBranchTimings,
3066
+ traceOutline: item.traceOutline,
3067
+ originalTraceOutline: item.originalTraceOutline
3062
3068
  }
3063
3069
  });
3064
3070
  } catch {
@@ -3138,7 +3144,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
3138
3144
  }
3139
3145
  if (mapped !== void 0) {
3140
3146
  item.tokens = replayTokens?.[mapped] ?? null;
3147
+ item.traceOutline = completeResult.traceOutlines?.[mapped] ?? null;
3141
3148
  }
3149
+ item.originalTraceOutline = completeResult.originalTraceOutlines?.[item.originalTraceId] ?? null;
3142
3150
  }
3143
3151
  if (completedCount > 0 && missing.length === completedCount) {
3144
3152
  const serverCount = completeResult.traceCount !== void 0 ? ` The server persisted ${completeResult.traceCount} trace(s) for this run.` : "";
@@ -3261,10 +3269,12 @@ __export(index_exports, {
3261
3269
  DatasetsClient: () => DatasetsClient,
3262
3270
  DbBranchReplayError: () => DbBranchReplayError,
3263
3271
  HttpClient: () => HttpClient,
3272
+ LabelsClient: () => LabelsClient,
3264
3273
  MixedTracingError: () => MixedTracingError,
3265
3274
  NO_MOCK_OVERRIDE: () => NO_MOCK_OVERRIDE,
3266
3275
  ReplayError: () => ReplayError,
3267
3276
  SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
3277
+ TracesClient: () => TracesClient,
3268
3278
  __version__: () => __version__,
3269
3279
  defineReplayRegistry: () => defineReplayRegistry,
3270
3280
  finalizers: () => finalizers,
@@ -3278,6 +3288,33 @@ __export(index_exports, {
3278
3288
  });
3279
3289
  module.exports = __toCommonJS(index_exports);
3280
3290
 
3291
+ // src/assertions.ts
3292
+ function expectationsPath(traceId, suffix = "") {
3293
+ return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
3294
+ }
3295
+ var TracesClient = class {
3296
+ constructor(httpClient) {
3297
+ this.httpClient = httpClient;
3298
+ }
3299
+ async getAssertions(traceId) {
3300
+ return this.httpClient.get(expectationsPath(traceId));
3301
+ }
3302
+ async saveAssertions(params) {
3303
+ const response = await this.httpClient.request(expectationsPath(params.traceId), {
3304
+ assertions: params.assertions,
3305
+ source: params.source ?? "agent"
3306
+ });
3307
+ return response.assertions;
3308
+ }
3309
+ async archiveAssertions(params) {
3310
+ const response = await this.httpClient.request(
3311
+ expectationsPath(params.traceId, "/archive"),
3312
+ { assertionIds: params.assertionIds }
3313
+ );
3314
+ return response.archived;
3315
+ }
3316
+ };
3317
+
3281
3318
  // src/claudeAgentSdk.ts
3282
3319
  init_constants();
3283
3320
  init_http();
@@ -4528,6 +4565,28 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
4528
4565
  init_errors();
4529
4566
  init_http();
4530
4567
 
4568
+ // src/labels.ts
4569
+ var LABELS_PATH = "/api/sdk/traces/labels";
4570
+ var LabelsClient = class {
4571
+ constructor(httpClient) {
4572
+ this.httpClient = httpClient;
4573
+ }
4574
+ async save(params) {
4575
+ const response = await this.httpClient.request(
4576
+ LABELS_PATH,
4577
+ {
4578
+ labels: params.labels,
4579
+ ...params.testRunId === void 0 ? {} : { testRunId: params.testRunId }
4580
+ }
4581
+ );
4582
+ return response.labels;
4583
+ }
4584
+ async saveOne(update, testRunId) {
4585
+ const [outcome] = await this.save({ labels: [update], testRunId });
4586
+ return outcome;
4587
+ }
4588
+ };
4589
+
4531
4590
  // src/langgraph.ts
4532
4591
  init_constants();
4533
4592
  init_http();
@@ -6301,6 +6360,8 @@ var Bitfab = class {
6301
6360
  timeout: this.timeout
6302
6361
  });
6303
6362
  this.datasets = new DatasetsClient(this.httpClient);
6363
+ this.traces = new TracesClient(this.httpClient);
6364
+ this.labels = new LabelsClient(this.httpClient);
6304
6365
  }
6305
6366
  /**
6306
6367
  * Decorate a class method as an automatically expanded trace root.
@@ -8202,10 +8263,12 @@ function resolveTraceFunctionKey(registration) {
8202
8263
  DatasetsClient,
8203
8264
  DbBranchReplayError,
8204
8265
  HttpClient,
8266
+ LabelsClient,
8205
8267
  MixedTracingError,
8206
8268
  NO_MOCK_OVERRIDE,
8207
8269
  ReplayError,
8208
8270
  SUPPORTED_PROVIDERS,
8271
+ TracesClient,
8209
8272
  __version__,
8210
8273
  defineReplayRegistry,
8211
8274
  finalizers,