@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.
- package/dist/{chunk-XTX66R4I.js → chunk-HSLKCBA3.js} +2 -2
- package/dist/{chunk-XTX66R4I.js.map → chunk-HSLKCBA3.js.map} +1 -1
- package/dist/{chunk-RZF5XSM6.js → chunk-OS62EZ6Y.js} +59 -6
- package/dist/chunk-OS62EZ6Y.js.map +1 -0
- package/dist/{chunk-AYEJRU7Z.js → chunk-RIMNDJP3.js} +2 -2
- package/dist/{chunk-AYEJRU7Z.js.map → chunk-RIMNDJP3.js.map} +1 -1
- package/dist/{chunk-SMWYCJH6.js → chunk-WVGPOCCT.js} +2 -2
- package/dist/{http-GHKRM3L7.js → http-LVSVWTKO.js} +2 -2
- package/dist/{http-CL4DNNRP.js → http-RKVEWOUX.js} +2 -2
- package/dist/index.cjs +56 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -34
- package/dist/index.d.ts +117 -34
- package/dist/index.js +7 -3
- package/dist/node.cjs +56 -1
- 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 +7 -3
- package/dist/node.js.map +1 -1
- package/dist/{replay-IPATGCIY.js → replay-Q2YYL5HB.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-RZF5XSM6.js.map +0 -1
- /package/dist/{chunk-SMWYCJH6.js.map → chunk-WVGPOCCT.js.map} +0 -0
- /package/dist/{http-CL4DNNRP.js.map → http-LVSVWTKO.js.map} +0 -0
- /package/dist/{http-GHKRM3L7.js.map → http-RKVEWOUX.js.map} +0 -0
- /package/dist/{replay-IPATGCIY.js.map → replay-Q2YYL5HB.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BAML execution utilities for the Bitfab TypeScript SDK.
|
|
3
|
-
* This module provides functions to execute BAML prompts dynamically on the client side.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Provider definition from the server.
|
|
7
|
-
*/
|
|
8
|
-
interface ProviderDefinition {
|
|
9
|
-
provider: string;
|
|
10
|
-
apiKeyEnv: string;
|
|
11
|
-
models: Array<{
|
|
12
|
-
model: string;
|
|
13
|
-
description: string;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Result of a BAML function execution with raw collector data.
|
|
18
|
-
*/
|
|
19
|
-
interface BamlExecutionResult {
|
|
20
|
-
/** The parsed result of the function */
|
|
21
|
-
result: unknown;
|
|
22
|
-
/** Raw collector data for the server to parse */
|
|
23
|
-
rawCollector: Record<string, unknown> | null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Type for allowed environment variables.
|
|
27
|
-
* Only OPENAI_API_KEY is currently supported.
|
|
28
|
-
*/
|
|
29
|
-
type AllowedEnvVars = {
|
|
30
|
-
OPENAI_API_KEY?: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
1
|
/**
|
|
34
2
|
* Per-trace database snapshot ref capture.
|
|
35
3
|
*
|
|
@@ -803,6 +771,86 @@ interface SpanTreeResponse {
|
|
|
803
771
|
root: SpanTreeNode;
|
|
804
772
|
}
|
|
805
773
|
|
|
774
|
+
type TraceTargetOccurrence = "first" | "last" | number;
|
|
775
|
+
type TraceTarget = {
|
|
776
|
+
kind: "output";
|
|
777
|
+
} | {
|
|
778
|
+
kind: "span";
|
|
779
|
+
name: string;
|
|
780
|
+
occurrence?: TraceTargetOccurrence;
|
|
781
|
+
};
|
|
782
|
+
type TraceAssertionSource = "human" | "agent";
|
|
783
|
+
type TraceAssertion = {
|
|
784
|
+
id: string;
|
|
785
|
+
traceId: string;
|
|
786
|
+
assertion: string;
|
|
787
|
+
passCriteria: string | null;
|
|
788
|
+
failCriteria: string | null;
|
|
789
|
+
targetOnEvaluatedTrace: TraceTarget | null;
|
|
790
|
+
source: TraceAssertionSource;
|
|
791
|
+
createdAt: string;
|
|
792
|
+
updatedAt: string;
|
|
793
|
+
};
|
|
794
|
+
type SaveAssertion = {
|
|
795
|
+
id?: string;
|
|
796
|
+
assertion: string;
|
|
797
|
+
passCriteria?: string | null;
|
|
798
|
+
failCriteria?: string | null;
|
|
799
|
+
targetOnEvaluatedTrace?: TraceTarget | null;
|
|
800
|
+
};
|
|
801
|
+
type TraceAssertionsResult = {
|
|
802
|
+
assertions: TraceAssertion[];
|
|
803
|
+
inheritedFrom: string | null;
|
|
804
|
+
};
|
|
805
|
+
type SaveAssertionsParams = {
|
|
806
|
+
traceId: string;
|
|
807
|
+
assertions: SaveAssertion[];
|
|
808
|
+
source?: TraceAssertionSource;
|
|
809
|
+
};
|
|
810
|
+
type ArchiveAssertionsParams = {
|
|
811
|
+
traceId: string;
|
|
812
|
+
assertionIds: string[];
|
|
813
|
+
};
|
|
814
|
+
declare class TracesClient {
|
|
815
|
+
private readonly httpClient;
|
|
816
|
+
constructor(httpClient: HttpClient);
|
|
817
|
+
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
818
|
+
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
819
|
+
archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* BAML execution utilities for the Bitfab TypeScript SDK.
|
|
824
|
+
* This module provides functions to execute BAML prompts dynamically on the client side.
|
|
825
|
+
*/
|
|
826
|
+
/**
|
|
827
|
+
* Provider definition from the server.
|
|
828
|
+
*/
|
|
829
|
+
interface ProviderDefinition {
|
|
830
|
+
provider: string;
|
|
831
|
+
apiKeyEnv: string;
|
|
832
|
+
models: Array<{
|
|
833
|
+
model: string;
|
|
834
|
+
description: string;
|
|
835
|
+
}>;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Result of a BAML function execution with raw collector data.
|
|
839
|
+
*/
|
|
840
|
+
interface BamlExecutionResult {
|
|
841
|
+
/** The parsed result of the function */
|
|
842
|
+
result: unknown;
|
|
843
|
+
/** Raw collector data for the server to parse */
|
|
844
|
+
rawCollector: Record<string, unknown> | null;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Type for allowed environment variables.
|
|
848
|
+
* Only OPENAI_API_KEY is currently supported.
|
|
849
|
+
*/
|
|
850
|
+
type AllowedEnvVars = {
|
|
851
|
+
OPENAI_API_KEY?: string;
|
|
852
|
+
};
|
|
853
|
+
|
|
806
854
|
/**
|
|
807
855
|
* Claude Agent SDK handler for Bitfab tracing.
|
|
808
856
|
*
|
|
@@ -1209,6 +1257,39 @@ declare class DatasetsClient {
|
|
|
1209
1257
|
getGraderRerun(datasetId: string, runId?: string): Promise<GraderRerun | null>;
|
|
1210
1258
|
}
|
|
1211
1259
|
|
|
1260
|
+
type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
|
|
1261
|
+
type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
|
|
1262
|
+
type LabelTarget = {
|
|
1263
|
+
traceId: string;
|
|
1264
|
+
originalTraceId?: never;
|
|
1265
|
+
attempt?: never;
|
|
1266
|
+
} | {
|
|
1267
|
+
originalTraceId: string;
|
|
1268
|
+
attempt?: number;
|
|
1269
|
+
traceId?: never;
|
|
1270
|
+
};
|
|
1271
|
+
type LabelVerdict = {
|
|
1272
|
+
label: boolean;
|
|
1273
|
+
annotation: string;
|
|
1274
|
+
confidence?: LabelConfidence;
|
|
1275
|
+
} | {
|
|
1276
|
+
skip: true;
|
|
1277
|
+
} | {
|
|
1278
|
+
archive: true;
|
|
1279
|
+
};
|
|
1280
|
+
type LabelUpdate = LabelTarget & LabelVerdict;
|
|
1281
|
+
type LabelOutcome = {
|
|
1282
|
+
key: string;
|
|
1283
|
+
traceId: string;
|
|
1284
|
+
action: LabelAction;
|
|
1285
|
+
};
|
|
1286
|
+
declare class LabelsClient {
|
|
1287
|
+
private readonly httpClient;
|
|
1288
|
+
constructor(httpClient: HttpClient);
|
|
1289
|
+
save(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
|
|
1290
|
+
saveAll(updates: LabelUpdate[], testRunId?: string): Promise<LabelOutcome[]>;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1212
1293
|
/**
|
|
1213
1294
|
* LangGraph/LangChain callback handler for Bitfab tracing.
|
|
1214
1295
|
*
|
|
@@ -2469,6 +2550,8 @@ declare class Bitfab {
|
|
|
2469
2550
|
private readonly httpClient;
|
|
2470
2551
|
/** Dataset operations for the authenticated organization. */
|
|
2471
2552
|
readonly datasets: DatasetsClient;
|
|
2553
|
+
readonly traces: TracesClient;
|
|
2554
|
+
readonly labels: LabelsClient;
|
|
2472
2555
|
private readonly bamlClient;
|
|
2473
2556
|
private readonly dbSnapshot;
|
|
2474
2557
|
private readonly autoTracePolicyRefreshes;
|
|
@@ -3114,7 +3197,7 @@ declare class BitfabFunction {
|
|
|
3114
3197
|
/**
|
|
3115
3198
|
* SDK version from package.json (injected at build time)
|
|
3116
3199
|
*/
|
|
3117
|
-
declare const __version__ = "0.
|
|
3200
|
+
declare const __version__ = "0.46.0";
|
|
3118
3201
|
|
|
3119
3202
|
/**
|
|
3120
3203
|
* Constants for the Bitfab SDK.
|
|
@@ -3244,4 +3327,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3244
3327
|
run?: boolean;
|
|
3245
3328
|
}): Promise<SeedResult>;
|
|
3246
3329
|
|
|
3247
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3330
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* BAML execution utilities for the Bitfab TypeScript SDK.
|
|
3
|
-
* This module provides functions to execute BAML prompts dynamically on the client side.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Provider definition from the server.
|
|
7
|
-
*/
|
|
8
|
-
interface ProviderDefinition {
|
|
9
|
-
provider: string;
|
|
10
|
-
apiKeyEnv: string;
|
|
11
|
-
models: Array<{
|
|
12
|
-
model: string;
|
|
13
|
-
description: string;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Result of a BAML function execution with raw collector data.
|
|
18
|
-
*/
|
|
19
|
-
interface BamlExecutionResult {
|
|
20
|
-
/** The parsed result of the function */
|
|
21
|
-
result: unknown;
|
|
22
|
-
/** Raw collector data for the server to parse */
|
|
23
|
-
rawCollector: Record<string, unknown> | null;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Type for allowed environment variables.
|
|
27
|
-
* Only OPENAI_API_KEY is currently supported.
|
|
28
|
-
*/
|
|
29
|
-
type AllowedEnvVars = {
|
|
30
|
-
OPENAI_API_KEY?: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
1
|
/**
|
|
34
2
|
* Per-trace database snapshot ref capture.
|
|
35
3
|
*
|
|
@@ -803,6 +771,86 @@ interface SpanTreeResponse {
|
|
|
803
771
|
root: SpanTreeNode;
|
|
804
772
|
}
|
|
805
773
|
|
|
774
|
+
type TraceTargetOccurrence = "first" | "last" | number;
|
|
775
|
+
type TraceTarget = {
|
|
776
|
+
kind: "output";
|
|
777
|
+
} | {
|
|
778
|
+
kind: "span";
|
|
779
|
+
name: string;
|
|
780
|
+
occurrence?: TraceTargetOccurrence;
|
|
781
|
+
};
|
|
782
|
+
type TraceAssertionSource = "human" | "agent";
|
|
783
|
+
type TraceAssertion = {
|
|
784
|
+
id: string;
|
|
785
|
+
traceId: string;
|
|
786
|
+
assertion: string;
|
|
787
|
+
passCriteria: string | null;
|
|
788
|
+
failCriteria: string | null;
|
|
789
|
+
targetOnEvaluatedTrace: TraceTarget | null;
|
|
790
|
+
source: TraceAssertionSource;
|
|
791
|
+
createdAt: string;
|
|
792
|
+
updatedAt: string;
|
|
793
|
+
};
|
|
794
|
+
type SaveAssertion = {
|
|
795
|
+
id?: string;
|
|
796
|
+
assertion: string;
|
|
797
|
+
passCriteria?: string | null;
|
|
798
|
+
failCriteria?: string | null;
|
|
799
|
+
targetOnEvaluatedTrace?: TraceTarget | null;
|
|
800
|
+
};
|
|
801
|
+
type TraceAssertionsResult = {
|
|
802
|
+
assertions: TraceAssertion[];
|
|
803
|
+
inheritedFrom: string | null;
|
|
804
|
+
};
|
|
805
|
+
type SaveAssertionsParams = {
|
|
806
|
+
traceId: string;
|
|
807
|
+
assertions: SaveAssertion[];
|
|
808
|
+
source?: TraceAssertionSource;
|
|
809
|
+
};
|
|
810
|
+
type ArchiveAssertionsParams = {
|
|
811
|
+
traceId: string;
|
|
812
|
+
assertionIds: string[];
|
|
813
|
+
};
|
|
814
|
+
declare class TracesClient {
|
|
815
|
+
private readonly httpClient;
|
|
816
|
+
constructor(httpClient: HttpClient);
|
|
817
|
+
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
818
|
+
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
819
|
+
archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* BAML execution utilities for the Bitfab TypeScript SDK.
|
|
824
|
+
* This module provides functions to execute BAML prompts dynamically on the client side.
|
|
825
|
+
*/
|
|
826
|
+
/**
|
|
827
|
+
* Provider definition from the server.
|
|
828
|
+
*/
|
|
829
|
+
interface ProviderDefinition {
|
|
830
|
+
provider: string;
|
|
831
|
+
apiKeyEnv: string;
|
|
832
|
+
models: Array<{
|
|
833
|
+
model: string;
|
|
834
|
+
description: string;
|
|
835
|
+
}>;
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Result of a BAML function execution with raw collector data.
|
|
839
|
+
*/
|
|
840
|
+
interface BamlExecutionResult {
|
|
841
|
+
/** The parsed result of the function */
|
|
842
|
+
result: unknown;
|
|
843
|
+
/** Raw collector data for the server to parse */
|
|
844
|
+
rawCollector: Record<string, unknown> | null;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Type for allowed environment variables.
|
|
848
|
+
* Only OPENAI_API_KEY is currently supported.
|
|
849
|
+
*/
|
|
850
|
+
type AllowedEnvVars = {
|
|
851
|
+
OPENAI_API_KEY?: string;
|
|
852
|
+
};
|
|
853
|
+
|
|
806
854
|
/**
|
|
807
855
|
* Claude Agent SDK handler for Bitfab tracing.
|
|
808
856
|
*
|
|
@@ -1209,6 +1257,39 @@ declare class DatasetsClient {
|
|
|
1209
1257
|
getGraderRerun(datasetId: string, runId?: string): Promise<GraderRerun | null>;
|
|
1210
1258
|
}
|
|
1211
1259
|
|
|
1260
|
+
type LabelConfidence = "VeryLow" | "Low" | "Medium" | "High" | "VeryHigh";
|
|
1261
|
+
type LabelAction = "set" | "archived" | "no-active-label" | "skipped";
|
|
1262
|
+
type LabelTarget = {
|
|
1263
|
+
traceId: string;
|
|
1264
|
+
originalTraceId?: never;
|
|
1265
|
+
attempt?: never;
|
|
1266
|
+
} | {
|
|
1267
|
+
originalTraceId: string;
|
|
1268
|
+
attempt?: number;
|
|
1269
|
+
traceId?: never;
|
|
1270
|
+
};
|
|
1271
|
+
type LabelVerdict = {
|
|
1272
|
+
label: boolean;
|
|
1273
|
+
annotation: string;
|
|
1274
|
+
confidence?: LabelConfidence;
|
|
1275
|
+
} | {
|
|
1276
|
+
skip: true;
|
|
1277
|
+
} | {
|
|
1278
|
+
archive: true;
|
|
1279
|
+
};
|
|
1280
|
+
type LabelUpdate = LabelTarget & LabelVerdict;
|
|
1281
|
+
type LabelOutcome = {
|
|
1282
|
+
key: string;
|
|
1283
|
+
traceId: string;
|
|
1284
|
+
action: LabelAction;
|
|
1285
|
+
};
|
|
1286
|
+
declare class LabelsClient {
|
|
1287
|
+
private readonly httpClient;
|
|
1288
|
+
constructor(httpClient: HttpClient);
|
|
1289
|
+
save(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
|
|
1290
|
+
saveAll(updates: LabelUpdate[], testRunId?: string): Promise<LabelOutcome[]>;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1212
1293
|
/**
|
|
1213
1294
|
* LangGraph/LangChain callback handler for Bitfab tracing.
|
|
1214
1295
|
*
|
|
@@ -2469,6 +2550,8 @@ declare class Bitfab {
|
|
|
2469
2550
|
private readonly httpClient;
|
|
2470
2551
|
/** Dataset operations for the authenticated organization. */
|
|
2471
2552
|
readonly datasets: DatasetsClient;
|
|
2553
|
+
readonly traces: TracesClient;
|
|
2554
|
+
readonly labels: LabelsClient;
|
|
2472
2555
|
private readonly bamlClient;
|
|
2473
2556
|
private readonly dbSnapshot;
|
|
2474
2557
|
private readonly autoTracePolicyRefreshes;
|
|
@@ -3114,7 +3197,7 @@ declare class BitfabFunction {
|
|
|
3114
3197
|
/**
|
|
3115
3198
|
* SDK version from package.json (injected at build time)
|
|
3116
3199
|
*/
|
|
3117
|
-
declare const __version__ = "0.
|
|
3200
|
+
declare const __version__ = "0.46.0";
|
|
3118
3201
|
|
|
3119
3202
|
/**
|
|
3120
3203
|
* Constants for the Bitfab SDK.
|
|
@@ -3244,4 +3327,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3244
3327
|
run?: boolean;
|
|
3245
3328
|
}): Promise<SeedResult>;
|
|
3246
3329
|
|
|
3247
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3330
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, HttpClient, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceIngestionType, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
package/dist/index.js
CHANGED
|
@@ -8,14 +8,16 @@ import {
|
|
|
8
8
|
BitfabOpenAITracingProcessor,
|
|
9
9
|
BitfabVercelAiHandler,
|
|
10
10
|
DatasetsClient,
|
|
11
|
+
LabelsClient,
|
|
11
12
|
SUPPORTED_PROVIDERS,
|
|
13
|
+
TracesClient,
|
|
12
14
|
defineReplayRegistry,
|
|
13
15
|
finalizers,
|
|
14
16
|
getCurrentReplayBranch,
|
|
15
17
|
getCurrentSpan,
|
|
16
18
|
getCurrentTrace,
|
|
17
19
|
seedFromRegistry
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OS62EZ6Y.js";
|
|
19
21
|
import "./chunk-ZUD7OFYB.js";
|
|
20
22
|
import {
|
|
21
23
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -24,7 +26,7 @@ import {
|
|
|
24
26
|
ReplayError,
|
|
25
27
|
reportReplayProgress,
|
|
26
28
|
serializeReplayResult
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-WVGPOCCT.js";
|
|
28
30
|
import {
|
|
29
31
|
BitfabError,
|
|
30
32
|
DEFAULT_SERVICE_URL,
|
|
@@ -32,7 +34,7 @@ import {
|
|
|
32
34
|
MixedTracingError,
|
|
33
35
|
__version__,
|
|
34
36
|
flushTraces
|
|
35
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-HSLKCBA3.js";
|
|
36
38
|
import "./chunk-H6LZRFMN.js";
|
|
37
39
|
export {
|
|
38
40
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -50,10 +52,12 @@ export {
|
|
|
50
52
|
DatasetsClient,
|
|
51
53
|
DbBranchReplayError,
|
|
52
54
|
HttpClient,
|
|
55
|
+
LabelsClient,
|
|
53
56
|
MixedTracingError,
|
|
54
57
|
NO_MOCK_OVERRIDE,
|
|
55
58
|
ReplayError,
|
|
56
59
|
SUPPORTED_PROVIDERS,
|
|
60
|
+
TracesClient,
|
|
57
61
|
__version__,
|
|
58
62
|
defineReplayRegistry,
|
|
59
63
|
finalizers,
|
package/dist/node.cjs
CHANGED
|
@@ -88,7 +88,7 @@ var __version__, __packageName__;
|
|
|
88
88
|
var init_version_generated = __esm({
|
|
89
89
|
"src/version.generated.ts"() {
|
|
90
90
|
"use strict";
|
|
91
|
-
__version__ = "0.
|
|
91
|
+
__version__ = "0.46.0";
|
|
92
92
|
__packageName__ = "@bitfab/sdk";
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -3276,10 +3276,12 @@ __export(node_exports, {
|
|
|
3276
3276
|
DatasetsClient: () => DatasetsClient,
|
|
3277
3277
|
DbBranchReplayError: () => DbBranchReplayError,
|
|
3278
3278
|
HttpClient: () => HttpClient,
|
|
3279
|
+
LabelsClient: () => LabelsClient,
|
|
3279
3280
|
MixedTracingError: () => MixedTracingError,
|
|
3280
3281
|
NO_MOCK_OVERRIDE: () => NO_MOCK_OVERRIDE,
|
|
3281
3282
|
ReplayError: () => ReplayError,
|
|
3282
3283
|
SUPPORTED_PROVIDERS: () => SUPPORTED_PROVIDERS,
|
|
3284
|
+
TracesClient: () => TracesClient,
|
|
3283
3285
|
__version__: () => __version__,
|
|
3284
3286
|
defineReplayRegistry: () => defineReplayRegistry,
|
|
3285
3287
|
finalizers: () => finalizers,
|
|
@@ -3300,6 +3302,33 @@ registerAsyncLocalStorageClass(
|
|
|
3300
3302
|
import_node_async_hooks.AsyncLocalStorage
|
|
3301
3303
|
);
|
|
3302
3304
|
|
|
3305
|
+
// src/assertions.ts
|
|
3306
|
+
function expectationsPath(traceId, suffix = "") {
|
|
3307
|
+
return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
|
|
3308
|
+
}
|
|
3309
|
+
var TracesClient = class {
|
|
3310
|
+
constructor(httpClient) {
|
|
3311
|
+
this.httpClient = httpClient;
|
|
3312
|
+
}
|
|
3313
|
+
async getAssertions(traceId) {
|
|
3314
|
+
return this.httpClient.get(expectationsPath(traceId));
|
|
3315
|
+
}
|
|
3316
|
+
async saveAssertions(params) {
|
|
3317
|
+
const response = await this.httpClient.request(expectationsPath(params.traceId), {
|
|
3318
|
+
assertions: params.assertions,
|
|
3319
|
+
source: params.source ?? "agent"
|
|
3320
|
+
});
|
|
3321
|
+
return response.assertions;
|
|
3322
|
+
}
|
|
3323
|
+
async archiveAssertions(params) {
|
|
3324
|
+
const response = await this.httpClient.request(
|
|
3325
|
+
expectationsPath(params.traceId, "/archive"),
|
|
3326
|
+
{ assertionIds: params.assertionIds }
|
|
3327
|
+
);
|
|
3328
|
+
return response.archived;
|
|
3329
|
+
}
|
|
3330
|
+
};
|
|
3331
|
+
|
|
3303
3332
|
// src/claudeAgentSdk.ts
|
|
3304
3333
|
init_constants();
|
|
3305
3334
|
init_http();
|
|
@@ -4550,6 +4579,28 @@ function buildSnapshotRef(config, sdkWallClockBeforeFn) {
|
|
|
4550
4579
|
init_errors();
|
|
4551
4580
|
init_http();
|
|
4552
4581
|
|
|
4582
|
+
// src/labels.ts
|
|
4583
|
+
var LABELS_PATH = "/api/sdk/traces/labels";
|
|
4584
|
+
var LabelsClient = class {
|
|
4585
|
+
constructor(httpClient) {
|
|
4586
|
+
this.httpClient = httpClient;
|
|
4587
|
+
}
|
|
4588
|
+
async save(update, testRunId) {
|
|
4589
|
+
const [outcome] = await this.saveAll([update], testRunId);
|
|
4590
|
+
return outcome;
|
|
4591
|
+
}
|
|
4592
|
+
async saveAll(updates, testRunId) {
|
|
4593
|
+
const response = await this.httpClient.request(
|
|
4594
|
+
LABELS_PATH,
|
|
4595
|
+
{
|
|
4596
|
+
labels: updates,
|
|
4597
|
+
...testRunId === void 0 ? {} : { testRunId }
|
|
4598
|
+
}
|
|
4599
|
+
);
|
|
4600
|
+
return response.labels;
|
|
4601
|
+
}
|
|
4602
|
+
};
|
|
4603
|
+
|
|
4553
4604
|
// src/langgraph.ts
|
|
4554
4605
|
init_constants();
|
|
4555
4606
|
init_http();
|
|
@@ -6323,6 +6374,8 @@ var Bitfab = class {
|
|
|
6323
6374
|
timeout: this.timeout
|
|
6324
6375
|
});
|
|
6325
6376
|
this.datasets = new DatasetsClient(this.httpClient);
|
|
6377
|
+
this.traces = new TracesClient(this.httpClient);
|
|
6378
|
+
this.labels = new LabelsClient(this.httpClient);
|
|
6326
6379
|
}
|
|
6327
6380
|
/**
|
|
6328
6381
|
* Decorate a class method as an automatically expanded trace root.
|
|
@@ -8228,10 +8281,12 @@ assertAsyncStorageRegistered();
|
|
|
8228
8281
|
DatasetsClient,
|
|
8229
8282
|
DbBranchReplayError,
|
|
8230
8283
|
HttpClient,
|
|
8284
|
+
LabelsClient,
|
|
8231
8285
|
MixedTracingError,
|
|
8232
8286
|
NO_MOCK_OVERRIDE,
|
|
8233
8287
|
ReplayError,
|
|
8234
8288
|
SUPPORTED_PROVIDERS,
|
|
8289
|
+
TracesClient,
|
|
8235
8290
|
__version__,
|
|
8236
8291
|
defineReplayRegistry,
|
|
8237
8292
|
finalizers,
|