@bitfab/sdk 0.64.19 → 0.64.21
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/cloudReplay.py +202 -3
- package/dist/{chunk-BWPW6I3Z.js → chunk-2NO2LENJ.js} +2 -2
- package/dist/{chunk-LMQMTWKS.js → chunk-EPUDNPB4.js} +4 -4
- package/dist/chunk-EPUDNPB4.js.map +1 -0
- package/dist/{chunk-THOWQGGK.js → chunk-GOUY4654.js} +62 -22
- package/dist/chunk-GOUY4654.js.map +1 -0
- package/dist/{chunk-2S6LDAYM.js → chunk-K2JJOHUJ.js} +17 -3
- package/dist/{chunk-2S6LDAYM.js.map → chunk-K2JJOHUJ.js.map} +1 -1
- package/dist/{chunk-XA5VTEAE.js → chunk-KB22OETK.js} +2 -2
- package/dist/{chunk-UIKFZWVQ.js → chunk-XNETXRNK.js} +17 -3
- package/dist/{chunk-UIKFZWVQ.js.map → chunk-XNETXRNK.js.map} +1 -1
- package/dist/{http-A64VT2NH.js → http-OS6BKRZL.js} +4 -2
- package/dist/{http-MAYDYAUH.js → http-R5ZXASMI.js} +4 -2
- package/dist/index.cjs +76 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -14
- package/dist/index.d.ts +73 -14
- package/dist/index.js +5 -3
- package/dist/node.cjs +76 -19
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +5 -3
- package/dist/node.js.map +1 -1
- package/dist/{replay-RWZSRTHU.js → replay-PTPAO3KN.js} +3 -3
- package/dist/{replay-XO46T56C.js → replay-T4S4WIN5.js} +3 -3
- package/dist/replayCli.js +3 -3
- package/dist/seedCli.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-LMQMTWKS.js.map +0 -1
- package/dist/chunk-THOWQGGK.js.map +0 -1
- /package/dist/{chunk-BWPW6I3Z.js.map → chunk-2NO2LENJ.js.map} +0 -0
- /package/dist/{chunk-XA5VTEAE.js.map → chunk-KB22OETK.js.map} +0 -0
- /package/dist/{http-A64VT2NH.js.map → http-OS6BKRZL.js.map} +0 -0
- /package/dist/{http-MAYDYAUH.js.map → http-R5ZXASMI.js.map} +0 -0
- /package/dist/{replay-RWZSRTHU.js.map → replay-PTPAO3KN.js.map} +0 -0
- /package/dist/{replay-XO46T56C.js.map → replay-T4S4WIN5.js.map} +0 -0
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
serializeValue,
|
|
18
18
|
toJsonSafe,
|
|
19
19
|
toJsonSafeReport
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2NO2LENJ.js";
|
|
21
21
|
import {
|
|
22
22
|
BitfabError,
|
|
23
23
|
CONTENT_OFF_KEY,
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
HttpClient,
|
|
27
27
|
MixedTracingError,
|
|
28
28
|
ROOT_TRACE_FUNCTION_KEY_FIELD,
|
|
29
|
+
SPAN_TYPES,
|
|
29
30
|
SimulationPlan,
|
|
30
31
|
callerTraceMetadata,
|
|
31
32
|
experimentIdWireFields,
|
|
@@ -36,7 +37,7 @@ import {
|
|
|
36
37
|
readEnv,
|
|
37
38
|
recordCallerTraceMetadata,
|
|
38
39
|
retireTraceMetadata
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-XNETXRNK.js";
|
|
40
41
|
import {
|
|
41
42
|
__privateAdd,
|
|
42
43
|
__privateGet,
|
|
@@ -1005,6 +1006,19 @@ async function runFunctionWithBaml(bamlSource, inputs, providers, envVars) {
|
|
|
1005
1006
|
};
|
|
1006
1007
|
}
|
|
1007
1008
|
|
|
1009
|
+
// src/bitfabIds.ts
|
|
1010
|
+
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
1011
|
+
function validateTraceId(traceId) {
|
|
1012
|
+
if (typeof traceId !== "string" || !UUID_PATTERN.test(traceId)) {
|
|
1013
|
+
throw new BitfabError("traceId must be a valid Bitfab trace ID");
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
function validateSpanId(id) {
|
|
1017
|
+
if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
|
|
1018
|
+
throw new BitfabError("id must be a valid Bitfab span ID");
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1008
1022
|
// src/captureSurface.ts
|
|
1009
1023
|
var DEFAULT_SURFACE = "opt-in";
|
|
1010
1024
|
var SURFACE_API = {
|
|
@@ -3330,6 +3344,33 @@ function runWithSeedContext(ctx, fn) {
|
|
|
3330
3344
|
return fn();
|
|
3331
3345
|
}
|
|
3332
3346
|
|
|
3347
|
+
// src/spans.ts
|
|
3348
|
+
var LIST_PATH = "/api/sdk/spans/list";
|
|
3349
|
+
function withoutUndefined(params) {
|
|
3350
|
+
return Object.fromEntries(
|
|
3351
|
+
Object.entries(params).filter(([, value]) => value !== void 0)
|
|
3352
|
+
);
|
|
3353
|
+
}
|
|
3354
|
+
var SpansClient = class {
|
|
3355
|
+
constructor(httpClient) {
|
|
3356
|
+
this.httpClient = httpClient;
|
|
3357
|
+
}
|
|
3358
|
+
/**
|
|
3359
|
+
* List one trace's spans in the order they ran, one page at a time. No
|
|
3360
|
+
* filter is required: omit `spanType` and `spanName` to page through every
|
|
3361
|
+
* span. Each span carries one extra key per requested `fields` entry. Pass
|
|
3362
|
+
* the returned `nextCursor` back as `cursor` for the next page. Throws a
|
|
3363
|
+
* `BitfabError` with status 404 when the trace is not in your organization.
|
|
3364
|
+
*/
|
|
3365
|
+
async list(traceId, params = {}) {
|
|
3366
|
+
validateTraceId(traceId);
|
|
3367
|
+
return this.httpClient.request(
|
|
3368
|
+
LIST_PATH,
|
|
3369
|
+
withoutUndefined({ traceId, ...params })
|
|
3370
|
+
);
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
|
|
3333
3374
|
// src/traces.ts
|
|
3334
3375
|
var ASSERTIONS_PATH = "/api/sdk/traces/assertions";
|
|
3335
3376
|
var SEARCH_PATH = "/api/sdk/traces/search";
|
|
@@ -4203,16 +4244,8 @@ function extractContextFromCollector(collector) {
|
|
|
4203
4244
|
return null;
|
|
4204
4245
|
}
|
|
4205
4246
|
}
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
if (typeof traceId !== "string" || !UUID_PATTERN.test(traceId)) {
|
|
4209
|
-
throw new BitfabError("traceId must be a valid Bitfab trace ID");
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
function validateSpanId(id) {
|
|
4213
|
-
if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
|
|
4214
|
-
throw new BitfabError("id must be a valid Bitfab span ID");
|
|
4215
|
-
}
|
|
4247
|
+
function isSpanType(value) {
|
|
4248
|
+
return SPAN_TYPES.some((spanType) => spanType === value);
|
|
4216
4249
|
}
|
|
4217
4250
|
var noOpSpan = {
|
|
4218
4251
|
id: "",
|
|
@@ -4446,6 +4479,7 @@ var Bitfab = class {
|
|
|
4446
4479
|
this.assertionCategories = new AssertionCategoriesClient(this.httpClient);
|
|
4447
4480
|
this.organizationMembers = new OrganizationMembersClient(this.httpClient);
|
|
4448
4481
|
this.traces = new TracesClient(this.httpClient);
|
|
4482
|
+
this.spans = new SpansClient(this.httpClient);
|
|
4449
4483
|
this.labels = new LabelsClient(this.httpClient);
|
|
4450
4484
|
this.graders = new GradersClient(this.httpClient);
|
|
4451
4485
|
this.experiments = new ExperimentsClient(this.httpClient);
|
|
@@ -5924,22 +5958,27 @@ var Bitfab = class {
|
|
|
5924
5958
|
}
|
|
5925
5959
|
/**
|
|
5926
5960
|
* Fetch one persisted span from a trace without loading the full trace.
|
|
5927
|
-
*
|
|
5928
|
-
*
|
|
5961
|
+
* Look up by `id` alone, or by `name` and/or `type` (both must match when
|
|
5962
|
+
* both are given). Name and type lookups return the last matching span by
|
|
5963
|
+
* default. Pass `occurrence` as `"first"` or a zero-based index to select a
|
|
5964
|
+
* different match. Returns `null` when no span matches.
|
|
5929
5965
|
*/
|
|
5930
5966
|
async getTraceSpan(traceId, lookup) {
|
|
5931
5967
|
validateTraceId(traceId);
|
|
5932
5968
|
const hasId = lookup.id !== void 0;
|
|
5933
|
-
const
|
|
5934
|
-
if (hasId ===
|
|
5935
|
-
throw new BitfabError("Provide
|
|
5969
|
+
const hasNameOrType = lookup.name !== void 0 || lookup.type !== void 0;
|
|
5970
|
+
if (hasId === hasNameOrType) {
|
|
5971
|
+
throw new BitfabError("Provide id, or name and/or type");
|
|
5936
5972
|
}
|
|
5937
5973
|
if (hasId) {
|
|
5938
5974
|
validateSpanId(lookup.id);
|
|
5939
5975
|
} else {
|
|
5940
|
-
if (lookup.name.length === 0) {
|
|
5976
|
+
if (lookup.name !== void 0 && lookup.name.length === 0) {
|
|
5941
5977
|
throw new BitfabError("name must be a non-empty string");
|
|
5942
5978
|
}
|
|
5979
|
+
if (lookup.type !== void 0 && !isSpanType(lookup.type)) {
|
|
5980
|
+
throw new BitfabError(`type must be one of ${SPAN_TYPES.join(", ")}`);
|
|
5981
|
+
}
|
|
5943
5982
|
const occurrence = lookup.occurrence ?? "last";
|
|
5944
5983
|
if (occurrence !== "first" && occurrence !== "last" && (!Number.isInteger(occurrence) || occurrence < 0)) {
|
|
5945
5984
|
throw new BitfabError(
|
|
@@ -6307,7 +6346,7 @@ var Bitfab = class {
|
|
|
6307
6346
|
await runWithSeedContext({ traceId }, async () => target(...args));
|
|
6308
6347
|
} finally {
|
|
6309
6348
|
try {
|
|
6310
|
-
const { flushTraces: flushTraces2 } = await import("./http-
|
|
6349
|
+
const { flushTraces: flushTraces2 } = await import("./http-R5ZXASMI.js");
|
|
6311
6350
|
await flushTraces2(3e4);
|
|
6312
6351
|
} finally {
|
|
6313
6352
|
unrecorded = activeTraceStates.delete(traceId);
|
|
@@ -6366,7 +6405,7 @@ var Bitfab = class {
|
|
|
6366
6405
|
`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.`
|
|
6367
6406
|
);
|
|
6368
6407
|
}
|
|
6369
|
-
const { replay: doReplay } = await import("./replay-
|
|
6408
|
+
const { replay: doReplay } = await import("./replay-PTPAO3KN.js");
|
|
6370
6409
|
return doReplay(
|
|
6371
6410
|
this.httpClient,
|
|
6372
6411
|
this.serviceUrl,
|
|
@@ -6712,7 +6751,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
|
6712
6751
|
sessionId: seedCase.sessionId
|
|
6713
6752
|
})
|
|
6714
6753
|
);
|
|
6715
|
-
const { flushTraces: flushTraces2 } = await import("./http-
|
|
6754
|
+
const { flushTraces: flushTraces2 } = await import("./http-R5ZXASMI.js");
|
|
6716
6755
|
await flushTraces2(3e4);
|
|
6717
6756
|
return { pipeline, traceFunctionKey, traceIds };
|
|
6718
6757
|
}
|
|
@@ -6742,6 +6781,7 @@ export {
|
|
|
6742
6781
|
BitfabOpenAIAgentHandler,
|
|
6743
6782
|
OrganizationMembersClient,
|
|
6744
6783
|
BitfabRivetIntegration,
|
|
6784
|
+
SpansClient,
|
|
6745
6785
|
AssertionGenerationError,
|
|
6746
6786
|
AssertionGenerationTimeoutError,
|
|
6747
6787
|
TracesClient,
|
|
@@ -6757,4 +6797,4 @@ export {
|
|
|
6757
6797
|
reseedFromRegistry,
|
|
6758
6798
|
seedFromRegistry
|
|
6759
6799
|
};
|
|
6760
|
-
//# sourceMappingURL=chunk-
|
|
6800
|
+
//# sourceMappingURL=chunk-GOUY4654.js.map
|