@bitfab/sdk 0.54.5 → 0.54.7
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-YH6YO2WS.js → chunk-27WMHYUI.js} +2 -2
- package/dist/{chunk-PIF5HH3Z.js → chunk-JF56DBPP.js} +11 -2
- package/dist/{chunk-PIF5HH3Z.js.map → chunk-JF56DBPP.js.map} +1 -1
- package/dist/{chunk-4G3ZJBXQ.js → chunk-O3XSV52U.js} +3 -3
- package/dist/{chunk-3STIE5QL.js → chunk-OIIMVPTH.js} +11 -2
- package/dist/{chunk-3STIE5QL.js.map → chunk-OIIMVPTH.js.map} +1 -1
- package/dist/{chunk-7DSNNK5I.js → chunk-X6AIRJJX.js} +53 -26
- package/dist/chunk-X6AIRJJX.js.map +1 -0
- package/dist/{http-36EP65LE.js → http-I5VDJLSJ.js} +2 -2
- package/dist/{http-JQ4RXRWH.js → http-RGNLMMZQ.js} +2 -2
- package/dist/index.cjs +57 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -13
- package/dist/index.d.ts +22 -13
- package/dist/index.js +3 -3
- package/dist/node.cjs +57 -21
- 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 +3 -3
- package/dist/{replay-HNSQHX52.js → replay-KILXEBEG.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7DSNNK5I.js.map +0 -1
- /package/dist/{chunk-YH6YO2WS.js.map → chunk-27WMHYUI.js.map} +0 -0
- /package/dist/{chunk-4G3ZJBXQ.js.map → chunk-O3XSV52U.js.map} +0 -0
- /package/dist/{http-36EP65LE.js.map → http-I5VDJLSJ.js.map} +0 -0
- /package/dist/{http-JQ4RXRWH.js.map → http-RGNLMMZQ.js.map} +0 -0
- /package/dist/{replay-HNSQHX52.js.map → replay-KILXEBEG.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -426,6 +426,8 @@ declare class HttpClient {
|
|
|
426
426
|
* the function form if one was supplied. Never read at construction.
|
|
427
427
|
*/
|
|
428
428
|
private resolveApiKey;
|
|
429
|
+
/** @internal Whether this client currently has credentials for trace delivery. */
|
|
430
|
+
hasApiKey(): boolean;
|
|
429
431
|
/**
|
|
430
432
|
* This client's span transport, built on first use.
|
|
431
433
|
*
|
|
@@ -917,6 +919,7 @@ declare class BitfabClaudeAgentHandler {
|
|
|
917
919
|
private readonly ownsHttpClient;
|
|
918
920
|
private readonly traceFunctionKey;
|
|
919
921
|
private readonly getActiveSpanContext;
|
|
922
|
+
private readonly shouldRecord;
|
|
920
923
|
private runToSpan;
|
|
921
924
|
private traceId;
|
|
922
925
|
private rootSpanId;
|
|
@@ -941,6 +944,7 @@ declare class BitfabClaudeAgentHandler {
|
|
|
941
944
|
serviceUrl?: string;
|
|
942
945
|
timeout?: number;
|
|
943
946
|
getActiveSpanContext?: () => ActiveSpanContext$2 | null;
|
|
947
|
+
shouldRecord?: () => boolean;
|
|
944
948
|
/**
|
|
945
949
|
* The owning `Bitfab` client's HTTP client. Supplied by
|
|
946
950
|
* `getClaudeAgentHandler()` so this handler shares that client's single
|
|
@@ -1412,6 +1416,7 @@ declare class BitfabLangGraphCallbackHandler {
|
|
|
1412
1416
|
private readonly ownsHttpClient;
|
|
1413
1417
|
private readonly traceFunctionKey;
|
|
1414
1418
|
private readonly getActiveSpanContext;
|
|
1419
|
+
private readonly shouldRecord;
|
|
1415
1420
|
private readonly captureTools;
|
|
1416
1421
|
private runToSpan;
|
|
1417
1422
|
private invocations;
|
|
@@ -1421,6 +1426,7 @@ declare class BitfabLangGraphCallbackHandler {
|
|
|
1421
1426
|
serviceUrl?: string;
|
|
1422
1427
|
timeout?: number;
|
|
1423
1428
|
getActiveSpanContext?: () => ActiveSpanContext$1 | null;
|
|
1429
|
+
shouldRecord?: () => boolean;
|
|
1424
1430
|
/** Whether callback tool events should emit spans. Defaults to true. */
|
|
1425
1431
|
captureTools?: boolean;
|
|
1426
1432
|
/**
|
|
@@ -2178,14 +2184,20 @@ type TraceTarget = {
|
|
|
2178
2184
|
occurrence?: TraceTargetOccurrence;
|
|
2179
2185
|
};
|
|
2180
2186
|
type TraceAssertionSource = "human" | "agent";
|
|
2181
|
-
type
|
|
2182
|
-
|
|
2187
|
+
type TraceSearchFilters = {
|
|
2188
|
+
callerMetadata?: Record<string, string>;
|
|
2189
|
+
name?: string;
|
|
2190
|
+
nameContains?: string;
|
|
2191
|
+
};
|
|
2192
|
+
type TraceSearchParams = TraceSearchFilters & ({
|
|
2183
2193
|
callerMetadata: Record<string, string>;
|
|
2184
|
-
|
|
2194
|
+
} | {
|
|
2195
|
+
name: string;
|
|
2196
|
+
} | {
|
|
2197
|
+
nameContains: string;
|
|
2198
|
+
}) & {
|
|
2185
2199
|
traceFunctionKey?: string;
|
|
2186
|
-
/** Opaque cursor returned by the previous page. */
|
|
2187
2200
|
cursor?: string | null;
|
|
2188
|
-
/** Page size (default 50, maximum 500). */
|
|
2189
2201
|
limit?: number;
|
|
2190
2202
|
};
|
|
2191
2203
|
type TraceSearchResult = {
|
|
@@ -2247,12 +2259,6 @@ type ArchiveAssertionsParams = {
|
|
|
2247
2259
|
declare class TracesClient {
|
|
2248
2260
|
private readonly httpClient;
|
|
2249
2261
|
constructor(httpClient: HttpClient);
|
|
2250
|
-
/**
|
|
2251
|
-
* Search traces by exact caller metadata.
|
|
2252
|
-
*
|
|
2253
|
-
* Keys and values are matched case-insensitively. Up to 10 supplied pairs
|
|
2254
|
-
* must match. Use `nextCursor` from the result to fetch another page.
|
|
2255
|
-
*/
|
|
2256
2262
|
search(params: TraceSearchParams): Promise<TraceSearchResult>;
|
|
2257
2263
|
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
2258
2264
|
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
@@ -2322,6 +2328,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2322
2328
|
private readonly ownsHttpClient;
|
|
2323
2329
|
private activeTraces;
|
|
2324
2330
|
private readonly getActiveSpanContext;
|
|
2331
|
+
private readonly shouldRecord;
|
|
2325
2332
|
private activeSpanMappings;
|
|
2326
2333
|
private canonicalTraceIds;
|
|
2327
2334
|
private getCanonicalTraceId;
|
|
@@ -2335,6 +2342,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2335
2342
|
serviceUrl?: string;
|
|
2336
2343
|
timeout?: number;
|
|
2337
2344
|
getActiveSpanContext?: () => ActiveSpanContext | null;
|
|
2345
|
+
shouldRecord?: () => boolean;
|
|
2338
2346
|
/**
|
|
2339
2347
|
* The owning `Bitfab` client's HTTP client. Supplied by
|
|
2340
2348
|
* `getOpenAiTracingProcessor()` so this processor shares that client's
|
|
@@ -2878,6 +2886,7 @@ declare class Bitfab {
|
|
|
2878
2886
|
private resolveApiKey;
|
|
2879
2887
|
private isCaptureEnabled;
|
|
2880
2888
|
private shouldRecord;
|
|
2889
|
+
private prepareFrameworkIntegration;
|
|
2881
2890
|
get captureEnabled(): boolean;
|
|
2882
2891
|
/**
|
|
2883
2892
|
* Fetch the function with its current version and BAML prompt from the server.
|
|
@@ -3420,7 +3429,7 @@ interface CommitRef {
|
|
|
3420
3429
|
/**
|
|
3421
3430
|
* SDK version from package.json (injected at build time)
|
|
3422
3431
|
*/
|
|
3423
|
-
declare const __version__ = "0.54.
|
|
3432
|
+
declare const __version__ = "0.54.7";
|
|
3424
3433
|
|
|
3425
3434
|
/**
|
|
3426
3435
|
* Constants for the Bitfab SDK.
|
|
@@ -3559,4 +3568,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3559
3568
|
run?: boolean;
|
|
3560
3569
|
}): Promise<SeedResult>;
|
|
3561
3570
|
|
|
3562
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionVerdict, 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 CommitRef, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
|
3571
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionVerdict, 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 CommitRef, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -426,6 +426,8 @@ declare class HttpClient {
|
|
|
426
426
|
* the function form if one was supplied. Never read at construction.
|
|
427
427
|
*/
|
|
428
428
|
private resolveApiKey;
|
|
429
|
+
/** @internal Whether this client currently has credentials for trace delivery. */
|
|
430
|
+
hasApiKey(): boolean;
|
|
429
431
|
/**
|
|
430
432
|
* This client's span transport, built on first use.
|
|
431
433
|
*
|
|
@@ -917,6 +919,7 @@ declare class BitfabClaudeAgentHandler {
|
|
|
917
919
|
private readonly ownsHttpClient;
|
|
918
920
|
private readonly traceFunctionKey;
|
|
919
921
|
private readonly getActiveSpanContext;
|
|
922
|
+
private readonly shouldRecord;
|
|
920
923
|
private runToSpan;
|
|
921
924
|
private traceId;
|
|
922
925
|
private rootSpanId;
|
|
@@ -941,6 +944,7 @@ declare class BitfabClaudeAgentHandler {
|
|
|
941
944
|
serviceUrl?: string;
|
|
942
945
|
timeout?: number;
|
|
943
946
|
getActiveSpanContext?: () => ActiveSpanContext$2 | null;
|
|
947
|
+
shouldRecord?: () => boolean;
|
|
944
948
|
/**
|
|
945
949
|
* The owning `Bitfab` client's HTTP client. Supplied by
|
|
946
950
|
* `getClaudeAgentHandler()` so this handler shares that client's single
|
|
@@ -1412,6 +1416,7 @@ declare class BitfabLangGraphCallbackHandler {
|
|
|
1412
1416
|
private readonly ownsHttpClient;
|
|
1413
1417
|
private readonly traceFunctionKey;
|
|
1414
1418
|
private readonly getActiveSpanContext;
|
|
1419
|
+
private readonly shouldRecord;
|
|
1415
1420
|
private readonly captureTools;
|
|
1416
1421
|
private runToSpan;
|
|
1417
1422
|
private invocations;
|
|
@@ -1421,6 +1426,7 @@ declare class BitfabLangGraphCallbackHandler {
|
|
|
1421
1426
|
serviceUrl?: string;
|
|
1422
1427
|
timeout?: number;
|
|
1423
1428
|
getActiveSpanContext?: () => ActiveSpanContext$1 | null;
|
|
1429
|
+
shouldRecord?: () => boolean;
|
|
1424
1430
|
/** Whether callback tool events should emit spans. Defaults to true. */
|
|
1425
1431
|
captureTools?: boolean;
|
|
1426
1432
|
/**
|
|
@@ -2178,14 +2184,20 @@ type TraceTarget = {
|
|
|
2178
2184
|
occurrence?: TraceTargetOccurrence;
|
|
2179
2185
|
};
|
|
2180
2186
|
type TraceAssertionSource = "human" | "agent";
|
|
2181
|
-
type
|
|
2182
|
-
|
|
2187
|
+
type TraceSearchFilters = {
|
|
2188
|
+
callerMetadata?: Record<string, string>;
|
|
2189
|
+
name?: string;
|
|
2190
|
+
nameContains?: string;
|
|
2191
|
+
};
|
|
2192
|
+
type TraceSearchParams = TraceSearchFilters & ({
|
|
2183
2193
|
callerMetadata: Record<string, string>;
|
|
2184
|
-
|
|
2194
|
+
} | {
|
|
2195
|
+
name: string;
|
|
2196
|
+
} | {
|
|
2197
|
+
nameContains: string;
|
|
2198
|
+
}) & {
|
|
2185
2199
|
traceFunctionKey?: string;
|
|
2186
|
-
/** Opaque cursor returned by the previous page. */
|
|
2187
2200
|
cursor?: string | null;
|
|
2188
|
-
/** Page size (default 50, maximum 500). */
|
|
2189
2201
|
limit?: number;
|
|
2190
2202
|
};
|
|
2191
2203
|
type TraceSearchResult = {
|
|
@@ -2247,12 +2259,6 @@ type ArchiveAssertionsParams = {
|
|
|
2247
2259
|
declare class TracesClient {
|
|
2248
2260
|
private readonly httpClient;
|
|
2249
2261
|
constructor(httpClient: HttpClient);
|
|
2250
|
-
/**
|
|
2251
|
-
* Search traces by exact caller metadata.
|
|
2252
|
-
*
|
|
2253
|
-
* Keys and values are matched case-insensitively. Up to 10 supplied pairs
|
|
2254
|
-
* must match. Use `nextCursor` from the result to fetch another page.
|
|
2255
|
-
*/
|
|
2256
2262
|
search(params: TraceSearchParams): Promise<TraceSearchResult>;
|
|
2257
2263
|
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
2258
2264
|
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
@@ -2322,6 +2328,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2322
2328
|
private readonly ownsHttpClient;
|
|
2323
2329
|
private activeTraces;
|
|
2324
2330
|
private readonly getActiveSpanContext;
|
|
2331
|
+
private readonly shouldRecord;
|
|
2325
2332
|
private activeSpanMappings;
|
|
2326
2333
|
private canonicalTraceIds;
|
|
2327
2334
|
private getCanonicalTraceId;
|
|
@@ -2335,6 +2342,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2335
2342
|
serviceUrl?: string;
|
|
2336
2343
|
timeout?: number;
|
|
2337
2344
|
getActiveSpanContext?: () => ActiveSpanContext | null;
|
|
2345
|
+
shouldRecord?: () => boolean;
|
|
2338
2346
|
/**
|
|
2339
2347
|
* The owning `Bitfab` client's HTTP client. Supplied by
|
|
2340
2348
|
* `getOpenAiTracingProcessor()` so this processor shares that client's
|
|
@@ -2878,6 +2886,7 @@ declare class Bitfab {
|
|
|
2878
2886
|
private resolveApiKey;
|
|
2879
2887
|
private isCaptureEnabled;
|
|
2880
2888
|
private shouldRecord;
|
|
2889
|
+
private prepareFrameworkIntegration;
|
|
2881
2890
|
get captureEnabled(): boolean;
|
|
2882
2891
|
/**
|
|
2883
2892
|
* Fetch the function with its current version and BAML prompt from the server.
|
|
@@ -3420,7 +3429,7 @@ interface CommitRef {
|
|
|
3420
3429
|
/**
|
|
3421
3430
|
* SDK version from package.json (injected at build time)
|
|
3422
3431
|
*/
|
|
3423
|
-
declare const __version__ = "0.54.
|
|
3432
|
+
declare const __version__ = "0.54.7";
|
|
3424
3433
|
|
|
3425
3434
|
/**
|
|
3426
3435
|
* Constants for the Bitfab SDK.
|
|
@@ -3559,4 +3568,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3559
3568
|
run?: boolean;
|
|
3560
3569
|
}): Promise<SeedResult>;
|
|
3561
3570
|
|
|
3562
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionVerdict, 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 CommitRef, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
|
3571
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionVerdict, 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 CommitRef, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, 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, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, 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 TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, 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, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
getCurrentTrace,
|
|
21
21
|
reseedFromRegistry,
|
|
22
22
|
seedFromRegistry
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-X6AIRJJX.js";
|
|
24
24
|
import "./chunk-EGWJYCNT.js";
|
|
25
25
|
import {
|
|
26
26
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
ReplayError,
|
|
30
30
|
reportReplayProgress,
|
|
31
31
|
serializeReplayResult
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-27WMHYUI.js";
|
|
33
33
|
import {
|
|
34
34
|
BitfabError,
|
|
35
35
|
DEFAULT_SERVICE_URL,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
MixedTracingError,
|
|
38
38
|
__version__,
|
|
39
39
|
flushTraces
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-JF56DBPP.js";
|
|
41
41
|
import "./chunk-VCRFFCLY.js";
|
|
42
42
|
export {
|
|
43
43
|
AssertionCategoriesClient,
|
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.54.
|
|
91
|
+
__version__ = "0.54.7";
|
|
92
92
|
__packageName__ = "@bitfab/sdk";
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -2320,6 +2320,15 @@ var init_http = __esm({
|
|
|
2320
2320
|
resolveApiKey() {
|
|
2321
2321
|
return typeof this.apiKey === "function" ? this.apiKey() : this.apiKey;
|
|
2322
2322
|
}
|
|
2323
|
+
/** @internal Whether this client currently has credentials for trace delivery. */
|
|
2324
|
+
hasApiKey() {
|
|
2325
|
+
try {
|
|
2326
|
+
const apiKey = this.resolveApiKey();
|
|
2327
|
+
return apiKey !== void 0 && apiKey.trim() !== "";
|
|
2328
|
+
} catch {
|
|
2329
|
+
return false;
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2323
2332
|
/**
|
|
2324
2333
|
* This client's span transport, built on first use.
|
|
2325
2334
|
*
|
|
@@ -4504,6 +4513,7 @@ var BitfabClaudeAgentHandler = class {
|
|
|
4504
4513
|
});
|
|
4505
4514
|
this.traceFunctionKey = config.traceFunctionKey;
|
|
4506
4515
|
this.getActiveSpanContext = config.getActiveSpanContext ?? null;
|
|
4516
|
+
this.shouldRecord = config.shouldRecord ?? (() => this.httpClient.hasApiKey());
|
|
4507
4517
|
this.preToolUseHook = this.preToolUseHook.bind(this);
|
|
4508
4518
|
this.postToolUseHook = this.postToolUseHook.bind(this);
|
|
4509
4519
|
this.postToolUseFailureHook = this.postToolUseFailureHook.bind(this);
|
|
@@ -4608,6 +4618,9 @@ var BitfabClaudeAgentHandler = class {
|
|
|
4608
4618
|
this.httpClient.traceCompletion.end(spanInfo.traceId, spanInfo.spanId);
|
|
4609
4619
|
}
|
|
4610
4620
|
sendSpan(spanInfo) {
|
|
4621
|
+
if (!this.shouldRecord()) {
|
|
4622
|
+
return;
|
|
4623
|
+
}
|
|
4611
4624
|
const spanData = {
|
|
4612
4625
|
name: spanInfo.name,
|
|
4613
4626
|
type: spanInfo.type
|
|
@@ -4651,6 +4664,9 @@ var BitfabClaudeAgentHandler = class {
|
|
|
4651
4664
|
}
|
|
4652
4665
|
}
|
|
4653
4666
|
sendTraceCompletion(endedAt, metadata) {
|
|
4667
|
+
if (!this.shouldRecord()) {
|
|
4668
|
+
return;
|
|
4669
|
+
}
|
|
4654
4670
|
if (this.traceId === null) {
|
|
4655
4671
|
return;
|
|
4656
4672
|
}
|
|
@@ -6192,6 +6208,7 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
6192
6208
|
});
|
|
6193
6209
|
this.traceFunctionKey = config.traceFunctionKey;
|
|
6194
6210
|
this.getActiveSpanContext = config.getActiveSpanContext ?? null;
|
|
6211
|
+
this.shouldRecord = config.shouldRecord ?? (() => this.httpClient.hasApiKey());
|
|
6195
6212
|
this.captureTools = config.captureTools ?? true;
|
|
6196
6213
|
}
|
|
6197
6214
|
/**
|
|
@@ -6300,6 +6317,9 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
6300
6317
|
this.httpClient.traceCompletion.end(spanInfo.traceId, spanInfo.spanId);
|
|
6301
6318
|
}
|
|
6302
6319
|
sendSpan(spanInfo) {
|
|
6320
|
+
if (!this.shouldRecord()) {
|
|
6321
|
+
return;
|
|
6322
|
+
}
|
|
6303
6323
|
const spanData = {
|
|
6304
6324
|
name: spanInfo.name,
|
|
6305
6325
|
type: spanInfo.type
|
|
@@ -6343,6 +6363,9 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
6343
6363
|
}
|
|
6344
6364
|
}
|
|
6345
6365
|
sendTraceCompletion(rootSpan, activeContext) {
|
|
6366
|
+
if (!this.shouldRecord()) {
|
|
6367
|
+
return;
|
|
6368
|
+
}
|
|
6346
6369
|
const completed = activeContext === null;
|
|
6347
6370
|
const traceData = {
|
|
6348
6371
|
id: rootSpan.traceId,
|
|
@@ -6363,6 +6386,9 @@ var BitfabLangGraphCallbackHandler = class {
|
|
|
6363
6386
|
}
|
|
6364
6387
|
}
|
|
6365
6388
|
sendTraceStart(rootSpan) {
|
|
6389
|
+
if (!this.shouldRecord()) {
|
|
6390
|
+
return;
|
|
6391
|
+
}
|
|
6366
6392
|
const traceData = {
|
|
6367
6393
|
id: rootSpan.traceId,
|
|
6368
6394
|
type: "sdk-function",
|
|
@@ -7014,12 +7040,6 @@ var TracesClient = class {
|
|
|
7014
7040
|
constructor(httpClient) {
|
|
7015
7041
|
this.httpClient = httpClient;
|
|
7016
7042
|
}
|
|
7017
|
-
/**
|
|
7018
|
-
* Search traces by exact caller metadata.
|
|
7019
|
-
*
|
|
7020
|
-
* Keys and values are matched case-insensitively. Up to 10 supplied pairs
|
|
7021
|
-
* must match. Use `nextCursor` from the result to fetch another page.
|
|
7022
|
-
*/
|
|
7023
7043
|
async search(params) {
|
|
7024
7044
|
return this.httpClient.request(SEARCH_PATH, params);
|
|
7025
7045
|
}
|
|
@@ -7077,6 +7097,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
7077
7097
|
timeout: config.timeout ?? 1e4
|
|
7078
7098
|
});
|
|
7079
7099
|
this.getActiveSpanContext = config.getActiveSpanContext ?? null;
|
|
7100
|
+
this.shouldRecord = config.shouldRecord ?? (() => this.httpClient.hasApiKey());
|
|
7080
7101
|
}
|
|
7081
7102
|
getCanonicalTraceId(sourceTraceId) {
|
|
7082
7103
|
const existing = this.canonicalTraceIds[sourceTraceId];
|
|
@@ -7197,6 +7218,9 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
7197
7218
|
* the OpenAI trace into an outer withSpan trace.
|
|
7198
7219
|
*/
|
|
7199
7220
|
sendTrace(trace, options = {}) {
|
|
7221
|
+
if (!this.shouldRecord()) {
|
|
7222
|
+
return;
|
|
7223
|
+
}
|
|
7200
7224
|
try {
|
|
7201
7225
|
const traceData = trace.toJSON();
|
|
7202
7226
|
if (options.sourceTraceId) {
|
|
@@ -7311,6 +7335,9 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
7311
7335
|
* and parent_id are rewritten to link the span into the withSpan tree.
|
|
7312
7336
|
*/
|
|
7313
7337
|
sendSpan(span) {
|
|
7338
|
+
if (!this.shouldRecord()) {
|
|
7339
|
+
return;
|
|
7340
|
+
}
|
|
7314
7341
|
const errors = [];
|
|
7315
7342
|
const [serializedSpan, exportErrors] = this.exportSpan(span);
|
|
7316
7343
|
errors.push(...exportErrors);
|
|
@@ -8408,6 +8435,11 @@ var Bitfab = class {
|
|
|
8408
8435
|
}
|
|
8409
8436
|
return this.resolveApiKey() !== void 0;
|
|
8410
8437
|
}
|
|
8438
|
+
prepareFrameworkIntegration() {
|
|
8439
|
+
if (this.captureConfigured && this.strict) {
|
|
8440
|
+
this.resolveApiKey();
|
|
8441
|
+
}
|
|
8442
|
+
}
|
|
8411
8443
|
get captureEnabled() {
|
|
8412
8444
|
return this.isCaptureEnabled();
|
|
8413
8445
|
}
|
|
@@ -8465,14 +8497,16 @@ var Bitfab = class {
|
|
|
8465
8497
|
resultStr = String(executionResult.result);
|
|
8466
8498
|
}
|
|
8467
8499
|
}
|
|
8468
|
-
this.
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8500
|
+
if (this.shouldRecord()) {
|
|
8501
|
+
this.httpClient.sendInternalTrace(functionVersion.id, {
|
|
8502
|
+
result: resultStr,
|
|
8503
|
+
source: "typescript-sdk",
|
|
8504
|
+
...Object.keys(inputs).length > 0 && { inputs },
|
|
8505
|
+
...executionResult.rawCollector != null && {
|
|
8506
|
+
rawCollector: executionResult.rawCollector
|
|
8507
|
+
}
|
|
8508
|
+
});
|
|
8509
|
+
}
|
|
8476
8510
|
return executionResult.result;
|
|
8477
8511
|
} catch (error) {
|
|
8478
8512
|
if (error instanceof BitfabError) {
|
|
@@ -8502,11 +8536,10 @@ var Bitfab = class {
|
|
|
8502
8536
|
* @returns A BitfabOpenAITracingProcessor instance configured for this client
|
|
8503
8537
|
*/
|
|
8504
8538
|
getOpenAiTracingProcessor() {
|
|
8539
|
+
this.prepareFrameworkIntegration();
|
|
8505
8540
|
return new BitfabOpenAITracingProcessor({
|
|
8506
|
-
// Resolved at getter-call time (framework handlers are set up after env
|
|
8507
|
-
// loads); the withSpan path stays lazy via the constructor HttpClient thunk.
|
|
8508
|
-
apiKey: this.resolveApiKey(),
|
|
8509
8541
|
serviceUrl: this.serviceUrl,
|
|
8542
|
+
shouldRecord: () => this.shouldRecord(),
|
|
8510
8543
|
getActiveSpanContext: () => {
|
|
8511
8544
|
const stack = getSpanStack();
|
|
8512
8545
|
return stack[stack.length - 1] ?? null;
|
|
@@ -8564,10 +8597,11 @@ var Bitfab = class {
|
|
|
8564
8597
|
* @returns A BitfabLangGraphCallbackHandler configured for this client
|
|
8565
8598
|
*/
|
|
8566
8599
|
getLangGraphCallbackHandler(traceFunctionKey) {
|
|
8600
|
+
this.prepareFrameworkIntegration();
|
|
8567
8601
|
return new BitfabLangGraphCallbackHandler({
|
|
8568
|
-
apiKey: this.resolveApiKey(),
|
|
8569
8602
|
traceFunctionKey,
|
|
8570
8603
|
serviceUrl: this.serviceUrl,
|
|
8604
|
+
shouldRecord: () => this.shouldRecord(),
|
|
8571
8605
|
getActiveSpanContext: () => {
|
|
8572
8606
|
const stack = getSpanStack();
|
|
8573
8607
|
return stack[stack.length - 1] ?? null;
|
|
@@ -8606,10 +8640,11 @@ var Bitfab = class {
|
|
|
8606
8640
|
* @experimental This API may change before it is stable.
|
|
8607
8641
|
*/
|
|
8608
8642
|
getLangGraphIntegration(traceFunctionKey, options) {
|
|
8643
|
+
this.prepareFrameworkIntegration();
|
|
8609
8644
|
const callbackHandler = new BitfabLangGraphCallbackHandler({
|
|
8610
|
-
apiKey: this.resolveApiKey(),
|
|
8611
8645
|
traceFunctionKey,
|
|
8612
8646
|
serviceUrl: this.serviceUrl,
|
|
8647
|
+
shouldRecord: () => this.shouldRecord(),
|
|
8613
8648
|
getActiveSpanContext: () => {
|
|
8614
8649
|
const stack = getSpanStack();
|
|
8615
8650
|
return stack[stack.length - 1] ?? null;
|
|
@@ -8648,10 +8683,11 @@ var Bitfab = class {
|
|
|
8648
8683
|
* @returns A BitfabClaudeAgentHandler configured for this client
|
|
8649
8684
|
*/
|
|
8650
8685
|
getClaudeAgentHandler(traceFunctionKey) {
|
|
8686
|
+
this.prepareFrameworkIntegration();
|
|
8651
8687
|
return new BitfabClaudeAgentHandler({
|
|
8652
|
-
apiKey: this.resolveApiKey(),
|
|
8653
8688
|
traceFunctionKey,
|
|
8654
8689
|
serviceUrl: this.serviceUrl,
|
|
8690
|
+
shouldRecord: () => this.shouldRecord(),
|
|
8655
8691
|
getActiveSpanContext: () => {
|
|
8656
8692
|
const stack = getSpanStack();
|
|
8657
8693
|
return stack[stack.length - 1] ?? null;
|