@bitfab/sdk 0.64.19 → 0.64.20
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/{chunk-LMQMTWKS.js → chunk-6235TDLD.js} +4 -4
- package/dist/chunk-6235TDLD.js.map +1 -0
- package/dist/{chunk-XA5VTEAE.js → chunk-7R5DLRXP.js} +2 -2
- package/dist/{chunk-UIKFZWVQ.js → chunk-JXZHAIXA.js} +17 -3
- package/dist/{chunk-UIKFZWVQ.js.map → chunk-JXZHAIXA.js.map} +1 -1
- package/dist/{chunk-THOWQGGK.js → chunk-KC6CJUMD.js} +62 -22
- package/dist/chunk-KC6CJUMD.js.map +1 -0
- package/dist/{chunk-BWPW6I3Z.js → chunk-SR2WNZCW.js} +2 -2
- package/dist/{chunk-2S6LDAYM.js → chunk-U2NAI4RU.js} +17 -3
- package/dist/{chunk-2S6LDAYM.js.map → chunk-U2NAI4RU.js.map} +1 -1
- package/dist/{http-MAYDYAUH.js → http-GX4NROD3.js} +4 -2
- package/dist/{http-A64VT2NH.js → http-OEYRIJZM.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-SZTY5TYU.js} +3 -3
- package/dist/{replay-XO46T56C.js → replay-UKR5WFON.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-XA5VTEAE.js.map → chunk-7R5DLRXP.js.map} +0 -0
- /package/dist/{chunk-BWPW6I3Z.js.map → chunk-SR2WNZCW.js.map} +0 -0
- /package/dist/{http-A64VT2NH.js.map → http-GX4NROD3.js.map} +0 -0
- /package/dist/{http-MAYDYAUH.js.map → http-OEYRIJZM.js.map} +0 -0
- /package/dist/{replay-RWZSRTHU.js.map → replay-SZTY5TYU.js.map} +0 -0
- /package/dist/{replay-XO46T56C.js.map → replay-UKR5WFON.js.map} +0 -0
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BitfabError,
|
|
3
3
|
HttpClient,
|
|
4
|
+
SPAN_TYPES,
|
|
4
5
|
awaitOnExit,
|
|
5
6
|
awaitPendingRequests,
|
|
6
7
|
experimentIdWireFields,
|
|
7
8
|
flushTraces,
|
|
8
9
|
parseRetryAfterMs,
|
|
9
10
|
serializePayloadBody
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JXZHAIXA.js";
|
|
11
12
|
import "./chunk-MT36GJMW.js";
|
|
12
13
|
export {
|
|
13
14
|
BitfabError,
|
|
14
15
|
HttpClient,
|
|
16
|
+
SPAN_TYPES,
|
|
15
17
|
awaitOnExit,
|
|
16
18
|
awaitPendingRequests,
|
|
17
19
|
experimentIdWireFields,
|
|
@@ -19,4 +21,4 @@ export {
|
|
|
19
21
|
parseRetryAfterMs,
|
|
20
22
|
serializePayloadBody
|
|
21
23
|
};
|
|
22
|
-
//# sourceMappingURL=http-
|
|
24
|
+
//# sourceMappingURL=http-GX4NROD3.js.map
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BitfabError,
|
|
3
3
|
HttpClient,
|
|
4
|
+
SPAN_TYPES,
|
|
4
5
|
awaitOnExit,
|
|
5
6
|
awaitPendingRequests,
|
|
6
7
|
experimentIdWireFields,
|
|
7
8
|
flushTraces,
|
|
8
9
|
parseRetryAfterMs,
|
|
9
10
|
serializePayloadBody
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-U2NAI4RU.js";
|
|
11
12
|
export {
|
|
12
13
|
BitfabError,
|
|
13
14
|
HttpClient,
|
|
15
|
+
SPAN_TYPES,
|
|
14
16
|
awaitOnExit,
|
|
15
17
|
awaitPendingRequests,
|
|
16
18
|
experimentIdWireFields,
|
|
@@ -18,4 +20,4 @@ export {
|
|
|
18
20
|
parseRetryAfterMs,
|
|
19
21
|
serializePayloadBody
|
|
20
22
|
};
|
|
21
|
-
//# sourceMappingURL=http-
|
|
23
|
+
//# sourceMappingURL=http-OEYRIJZM.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.64.
|
|
45
|
+
__version__ = "0.64.20";
|
|
46
46
|
__packageName__ = "@bitfab/sdk";
|
|
47
47
|
}
|
|
48
48
|
});
|
|
@@ -2114,6 +2114,7 @@ var http_exports = {};
|
|
|
2114
2114
|
__export(http_exports, {
|
|
2115
2115
|
BitfabError: () => BitfabError,
|
|
2116
2116
|
HttpClient: () => HttpClient,
|
|
2117
|
+
SPAN_TYPES: () => SPAN_TYPES,
|
|
2117
2118
|
awaitOnExit: () => awaitOnExit,
|
|
2118
2119
|
awaitPendingRequests: () => awaitPendingRequests,
|
|
2119
2120
|
experimentIdWireFields: () => experimentIdWireFields,
|
|
@@ -2288,7 +2289,7 @@ function warnDroppedExternalTrace(error) {
|
|
|
2288
2289
|
function experimentIdWireFields(experimentId) {
|
|
2289
2290
|
return { experimentId, testRunId: experimentId };
|
|
2290
2291
|
}
|
|
2291
|
-
var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS, REPLAY_COMPLETE_REQUEST_TIMEOUT_MS, REPLAY_INTERRUPT_REQUEST_TIMEOUT_MS, REPLAY_HEARTBEAT_REQUEST_TIMEOUT_MS, OTLP_TRACES_ENDPOINT, RETRYABLE_STATUSES, EXIT_FLUSH_TIMEOUT_MS, DEFAULT_LIFECYCLE_TIMEOUT_MS2, pendingTracePromises, liveHttpClients, carrierSeq, HttpClient;
|
|
2292
|
+
var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS, REPLAY_COMPLETE_REQUEST_TIMEOUT_MS, REPLAY_INTERRUPT_REQUEST_TIMEOUT_MS, REPLAY_HEARTBEAT_REQUEST_TIMEOUT_MS, OTLP_TRACES_ENDPOINT, RETRYABLE_STATUSES, EXIT_FLUSH_TIMEOUT_MS, DEFAULT_LIFECYCLE_TIMEOUT_MS2, pendingTracePromises, liveHttpClients, SPAN_TYPES, carrierSeq, HttpClient;
|
|
2292
2293
|
var init_http = __esm({
|
|
2293
2294
|
"src/http.ts"() {
|
|
2294
2295
|
"use strict";
|
|
@@ -2346,6 +2347,14 @@ var init_http = __esm({
|
|
|
2346
2347
|
});
|
|
2347
2348
|
});
|
|
2348
2349
|
}
|
|
2350
|
+
SPAN_TYPES = [
|
|
2351
|
+
"llm",
|
|
2352
|
+
"agent",
|
|
2353
|
+
"function",
|
|
2354
|
+
"guardrail",
|
|
2355
|
+
"handoff",
|
|
2356
|
+
"custom"
|
|
2357
|
+
];
|
|
2349
2358
|
carrierSeq = 0;
|
|
2350
2359
|
HttpClient = class {
|
|
2351
2360
|
constructor(config) {
|
|
@@ -2730,7 +2739,12 @@ var init_http = __esm({
|
|
|
2730
2739
|
if (lookup.id !== void 0) {
|
|
2731
2740
|
searchParams.set("id", lookup.id);
|
|
2732
2741
|
} else {
|
|
2733
|
-
|
|
2742
|
+
if (lookup.name !== void 0) {
|
|
2743
|
+
searchParams.set("name", lookup.name);
|
|
2744
|
+
}
|
|
2745
|
+
if (lookup.type !== void 0) {
|
|
2746
|
+
searchParams.set("type", lookup.type);
|
|
2747
|
+
}
|
|
2734
2748
|
searchParams.set("occurrence", String(lookup.occurrence ?? "last"));
|
|
2735
2749
|
}
|
|
2736
2750
|
const endpoint = `/api/sdk/traces/${encodeURIComponent(traceId)}/span?${searchParams.toString()}`;
|
|
@@ -5357,6 +5371,7 @@ __export(index_exports, {
|
|
|
5357
5371
|
OrganizationMembersClient: () => OrganizationMembersClient,
|
|
5358
5372
|
ReplayError: () => ReplayError,
|
|
5359
5373
|
SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
|
|
5374
|
+
SpansClient: () => SpansClient,
|
|
5360
5375
|
TracesClient: () => TracesClient,
|
|
5361
5376
|
__version__: () => __version__,
|
|
5362
5377
|
defineReplayRegistry: () => defineReplayRegistry,
|
|
@@ -6509,6 +6524,20 @@ async function runFunctionWithBaml(bamlSource, inputs, providers, envVars) {
|
|
|
6509
6524
|
};
|
|
6510
6525
|
}
|
|
6511
6526
|
|
|
6527
|
+
// src/bitfabIds.ts
|
|
6528
|
+
init_errors();
|
|
6529
|
+
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;
|
|
6530
|
+
function validateTraceId(traceId) {
|
|
6531
|
+
if (typeof traceId !== "string" || !UUID_PATTERN.test(traceId)) {
|
|
6532
|
+
throw new BitfabError("traceId must be a valid Bitfab trace ID");
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
function validateSpanId(id) {
|
|
6536
|
+
if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
|
|
6537
|
+
throw new BitfabError("id must be a valid Bitfab span ID");
|
|
6538
|
+
}
|
|
6539
|
+
}
|
|
6540
|
+
|
|
6512
6541
|
// src/client.ts
|
|
6513
6542
|
init_captureSuppression();
|
|
6514
6543
|
|
|
@@ -8881,6 +8910,35 @@ function runWithSeedContext(ctx, fn) {
|
|
|
8881
8910
|
init_serialize();
|
|
8882
8911
|
init_simulationPlan();
|
|
8883
8912
|
init_spanOrigin();
|
|
8913
|
+
|
|
8914
|
+
// src/spans.ts
|
|
8915
|
+
var LIST_PATH = "/api/sdk/spans/list";
|
|
8916
|
+
function withoutUndefined(params) {
|
|
8917
|
+
return Object.fromEntries(
|
|
8918
|
+
Object.entries(params).filter(([, value]) => value !== void 0)
|
|
8919
|
+
);
|
|
8920
|
+
}
|
|
8921
|
+
var SpansClient = class {
|
|
8922
|
+
constructor(httpClient) {
|
|
8923
|
+
this.httpClient = httpClient;
|
|
8924
|
+
}
|
|
8925
|
+
/**
|
|
8926
|
+
* List one trace's spans in the order they ran, one page at a time. No
|
|
8927
|
+
* filter is required: omit `spanType` and `spanName` to page through every
|
|
8928
|
+
* span. Each span carries one extra key per requested `fields` entry. Pass
|
|
8929
|
+
* the returned `nextCursor` back as `cursor` for the next page. Throws a
|
|
8930
|
+
* `BitfabError` with status 404 when the trace is not in your organization.
|
|
8931
|
+
*/
|
|
8932
|
+
async list(traceId, params = {}) {
|
|
8933
|
+
validateTraceId(traceId);
|
|
8934
|
+
return this.httpClient.request(
|
|
8935
|
+
LIST_PATH,
|
|
8936
|
+
withoutUndefined({ traceId, ...params })
|
|
8937
|
+
);
|
|
8938
|
+
}
|
|
8939
|
+
};
|
|
8940
|
+
|
|
8941
|
+
// src/client.ts
|
|
8884
8942
|
init_traceMetadata();
|
|
8885
8943
|
|
|
8886
8944
|
// src/traces.ts
|
|
@@ -9761,16 +9819,8 @@ function extractContextFromCollector(collector) {
|
|
|
9761
9819
|
return null;
|
|
9762
9820
|
}
|
|
9763
9821
|
}
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
if (typeof traceId !== "string" || !UUID_PATTERN.test(traceId)) {
|
|
9767
|
-
throw new BitfabError("traceId must be a valid Bitfab trace ID");
|
|
9768
|
-
}
|
|
9769
|
-
}
|
|
9770
|
-
function validateSpanId(id) {
|
|
9771
|
-
if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
|
|
9772
|
-
throw new BitfabError("id must be a valid Bitfab span ID");
|
|
9773
|
-
}
|
|
9822
|
+
function isSpanType(value) {
|
|
9823
|
+
return SPAN_TYPES.some((spanType) => spanType === value);
|
|
9774
9824
|
}
|
|
9775
9825
|
var noOpSpan = {
|
|
9776
9826
|
id: "",
|
|
@@ -10004,6 +10054,7 @@ var Bitfab = class {
|
|
|
10004
10054
|
this.assertionCategories = new AssertionCategoriesClient(this.httpClient);
|
|
10005
10055
|
this.organizationMembers = new OrganizationMembersClient(this.httpClient);
|
|
10006
10056
|
this.traces = new TracesClient(this.httpClient);
|
|
10057
|
+
this.spans = new SpansClient(this.httpClient);
|
|
10007
10058
|
this.labels = new LabelsClient(this.httpClient);
|
|
10008
10059
|
this.graders = new GradersClient(this.httpClient);
|
|
10009
10060
|
this.experiments = new ExperimentsClient(this.httpClient);
|
|
@@ -11482,22 +11533,27 @@ var Bitfab = class {
|
|
|
11482
11533
|
}
|
|
11483
11534
|
/**
|
|
11484
11535
|
* Fetch one persisted span from a trace without loading the full trace.
|
|
11485
|
-
*
|
|
11486
|
-
*
|
|
11536
|
+
* Look up by `id` alone, or by `name` and/or `type` (both must match when
|
|
11537
|
+
* both are given). Name and type lookups return the last matching span by
|
|
11538
|
+
* default. Pass `occurrence` as `"first"` or a zero-based index to select a
|
|
11539
|
+
* different match. Returns `null` when no span matches.
|
|
11487
11540
|
*/
|
|
11488
11541
|
async getTraceSpan(traceId, lookup) {
|
|
11489
11542
|
validateTraceId(traceId);
|
|
11490
11543
|
const hasId = lookup.id !== void 0;
|
|
11491
|
-
const
|
|
11492
|
-
if (hasId ===
|
|
11493
|
-
throw new BitfabError("Provide
|
|
11544
|
+
const hasNameOrType = lookup.name !== void 0 || lookup.type !== void 0;
|
|
11545
|
+
if (hasId === hasNameOrType) {
|
|
11546
|
+
throw new BitfabError("Provide id, or name and/or type");
|
|
11494
11547
|
}
|
|
11495
11548
|
if (hasId) {
|
|
11496
11549
|
validateSpanId(lookup.id);
|
|
11497
11550
|
} else {
|
|
11498
|
-
if (lookup.name.length === 0) {
|
|
11551
|
+
if (lookup.name !== void 0 && lookup.name.length === 0) {
|
|
11499
11552
|
throw new BitfabError("name must be a non-empty string");
|
|
11500
11553
|
}
|
|
11554
|
+
if (lookup.type !== void 0 && !isSpanType(lookup.type)) {
|
|
11555
|
+
throw new BitfabError(`type must be one of ${SPAN_TYPES.join(", ")}`);
|
|
11556
|
+
}
|
|
11501
11557
|
const occurrence = lookup.occurrence ?? "last";
|
|
11502
11558
|
if (occurrence !== "first" && occurrence !== "last" && (!Number.isInteger(occurrence) || occurrence < 0)) {
|
|
11503
11559
|
throw new BitfabError(
|
|
@@ -12328,6 +12384,7 @@ function resolveTraceFunctionKey(registration) {
|
|
|
12328
12384
|
OrganizationMembersClient,
|
|
12329
12385
|
ReplayError,
|
|
12330
12386
|
SUPPORTED_PROVIDERS,
|
|
12387
|
+
SpansClient,
|
|
12331
12388
|
TracesClient,
|
|
12332
12389
|
__version__,
|
|
12333
12390
|
defineReplayRegistry,
|