@bitfab/sdk 0.42.0 → 0.43.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-BC5OYWAM.js → chunk-5BBJ5BQD.js} +173 -67
- package/dist/chunk-5BBJ5BQD.js.map +1 -0
- package/dist/{chunk-UGFTBSGS.js → chunk-6EM2S5H5.js} +6 -3
- package/dist/{chunk-UGFTBSGS.js.map → chunk-6EM2S5H5.js.map} +1 -1
- package/dist/{chunk-QJ6IFPGU.js → chunk-BBJSKBVJ.js} +6 -3
- package/dist/{chunk-QJ6IFPGU.js.map → chunk-BBJSKBVJ.js.map} +1 -1
- package/dist/{chunk-BG3A5HNC.js → chunk-BXBRVWWW.js} +10 -4
- package/dist/chunk-BXBRVWWW.js.map +1 -0
- package/dist/{http-F5L466DI.js → http-IO3Y7ROJ.js} +2 -2
- package/dist/{http-NZHGC5YF.js → http-R553H2H2.js} +2 -2
- package/dist/index.cjs +184 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -53
- package/dist/index.d.ts +37 -53
- package/dist/index.js +3 -3
- package/dist/node.cjs +184 -66
- 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-PLACY77M.js → replay-LM4GIDVD.js} +3 -3
- package/dist/replayCli.js +31 -10
- package/dist/replayCli.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BC5OYWAM.js.map +0 -1
- package/dist/chunk-BG3A5HNC.js.map +0 -1
- /package/dist/{http-F5L466DI.js.map → http-IO3Y7ROJ.js.map} +0 -0
- /package/dist/{http-NZHGC5YF.js.map → http-R553H2H2.js.map} +0 -0
- /package/dist/{replay-PLACY77M.js.map → replay-LM4GIDVD.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -585,7 +585,7 @@ declare class HttpClient {
|
|
|
585
585
|
* Start a replay session by fetching historical traces.
|
|
586
586
|
* Blocking call - creates a test run and returns lightweight item references.
|
|
587
587
|
*/
|
|
588
|
-
startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetId?: string, graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number): Promise<StartReplayResponse>;
|
|
588
|
+
startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetId?: string, graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean): Promise<StartReplayResponse>;
|
|
589
589
|
/**
|
|
590
590
|
* Fetch an external span by ID.
|
|
591
591
|
* Blocking GET request.
|
|
@@ -700,6 +700,7 @@ interface StartReplayResponse {
|
|
|
700
700
|
* servers that predate it.
|
|
701
701
|
*/
|
|
702
702
|
dbBranchTimings?: DbBranchTimings;
|
|
703
|
+
originalMetadata?: Record<string, unknown>;
|
|
703
704
|
}>;
|
|
704
705
|
}
|
|
705
706
|
interface ExternalSpanResponse {
|
|
@@ -962,6 +963,7 @@ declare class BitfabClaudeAgentHandler {
|
|
|
962
963
|
type LlmSpanOptions = {
|
|
963
964
|
type: "llm";
|
|
964
965
|
finalize: (result: unknown) => unknown | Promise<unknown>;
|
|
966
|
+
surface: "inherit";
|
|
965
967
|
};
|
|
966
968
|
type WithSpanFn$1 = <TArgs extends unknown[], TReturn>(traceFunctionKey: string, options: LlmSpanOptions, fn: (...args: TArgs) => TReturn) => (...args: TArgs) => TReturn;
|
|
967
969
|
/**
|
|
@@ -1267,6 +1269,7 @@ interface SpanClient {
|
|
|
1267
1269
|
captureWhen?: "always" | "nested";
|
|
1268
1270
|
mockOnReplay?: boolean;
|
|
1269
1271
|
finalize?: (result: unknown) => unknown | Promise<unknown>;
|
|
1272
|
+
surface?: "inherit";
|
|
1270
1273
|
}, fn: (...args: TArgs) => TReturn): (...args: TArgs) => TReturn;
|
|
1271
1274
|
}
|
|
1272
1275
|
interface LangGraphTool {
|
|
@@ -1373,6 +1376,7 @@ type RunResultLike = {
|
|
|
1373
1376
|
type RootSpanOptions = {
|
|
1374
1377
|
type: "agent";
|
|
1375
1378
|
finalize: (result: unknown) => unknown | Promise<unknown>;
|
|
1379
|
+
surface: "inherit";
|
|
1376
1380
|
};
|
|
1377
1381
|
type WithSpanFn = <TArgs extends unknown[], TReturn>(traceFunctionKey: string, options: RootSpanOptions, fn: (...args: TArgs) => TReturn) => (...args: TArgs) => TReturn;
|
|
1378
1382
|
type GetActiveSpanContextFn = () => unknown | null;
|
|
@@ -1746,6 +1750,7 @@ interface AdaptContext {
|
|
|
1746
1750
|
sourceTraceId: string;
|
|
1747
1751
|
/** @deprecated alias for {@link AdaptContext.originalSpanId}. */
|
|
1748
1752
|
sourceSpanId: string;
|
|
1753
|
+
metadata: Record<string, unknown>;
|
|
1749
1754
|
}
|
|
1750
1755
|
/**
|
|
1751
1756
|
* The shape an adapter module must export as `adaptInputs`.
|
|
@@ -2101,6 +2106,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2101
2106
|
private sendSpan;
|
|
2102
2107
|
}
|
|
2103
2108
|
|
|
2109
|
+
type CaptureSurface = "opt-in" | "opt-out";
|
|
2104
2110
|
/**
|
|
2105
2111
|
* Options for wrapBAML.
|
|
2106
2112
|
*/
|
|
@@ -2236,6 +2242,22 @@ declare function getCurrentReplayBranch(): ReplayBranch | null;
|
|
|
2236
2242
|
* Returns a no-op object if called outside of a span context (methods do nothing).
|
|
2237
2243
|
*/
|
|
2238
2244
|
declare function getCurrentTrace(): CurrentTrace;
|
|
2245
|
+
interface SeedCaseOptions {
|
|
2246
|
+
input: unknown[];
|
|
2247
|
+
expected?: unknown;
|
|
2248
|
+
fn?: (...args: any[]) => unknown;
|
|
2249
|
+
metadata?: Record<string, unknown>;
|
|
2250
|
+
sessionId?: string;
|
|
2251
|
+
name?: string;
|
|
2252
|
+
spanName?: string;
|
|
2253
|
+
spanType?: SpanType;
|
|
2254
|
+
}
|
|
2255
|
+
interface SeedRunOptions<TArgs extends unknown[]> {
|
|
2256
|
+
args?: TArgs;
|
|
2257
|
+
metadata?: Record<string, unknown>;
|
|
2258
|
+
sessionId?: string;
|
|
2259
|
+
name?: string;
|
|
2260
|
+
}
|
|
2239
2261
|
interface BitfabConfig {
|
|
2240
2262
|
/**
|
|
2241
2263
|
* The API key for Bitfab API authentication. Resolved lazily, the first
|
|
@@ -2256,7 +2278,7 @@ interface BitfabConfig {
|
|
|
2256
2278
|
timeout?: number;
|
|
2257
2279
|
/** Environment variables for LLM provider API keys (only OPENAI_API_KEY is supported) */
|
|
2258
2280
|
envVars?: AllowedEnvVars;
|
|
2259
|
-
|
|
2281
|
+
captureEnabled?: boolean;
|
|
2260
2282
|
enabled?: boolean;
|
|
2261
2283
|
/**
|
|
2262
2284
|
* Fail loud instead of degrading quietly. When true, the first traced call
|
|
@@ -2417,8 +2439,7 @@ declare class Bitfab {
|
|
|
2417
2439
|
private readonly serviceUrl;
|
|
2418
2440
|
private readonly timeout;
|
|
2419
2441
|
private readonly envVars;
|
|
2420
|
-
|
|
2421
|
-
private readonly explicitlyEnabled;
|
|
2442
|
+
private readonly captureConfigured;
|
|
2422
2443
|
private readonly strict;
|
|
2423
2444
|
private readonly httpClient;
|
|
2424
2445
|
/** Dataset operations for the authenticated organization. */
|
|
@@ -2533,12 +2554,9 @@ declare class Bitfab {
|
|
|
2533
2554
|
* early resolve that found nothing never poisons a later one.
|
|
2534
2555
|
*/
|
|
2535
2556
|
private resolveApiKey;
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
* touching the key.
|
|
2540
|
-
*/
|
|
2541
|
-
private isTracingEnabled;
|
|
2557
|
+
private isCaptureEnabled;
|
|
2558
|
+
private shouldRecord;
|
|
2559
|
+
get captureEnabled(): boolean;
|
|
2542
2560
|
/**
|
|
2543
2561
|
* Fetch the function with its current version and BAML prompt from the server.
|
|
2544
2562
|
*
|
|
@@ -2892,46 +2910,10 @@ declare class Bitfab {
|
|
|
2892
2910
|
registerMockOverride(traceFunctionKey: string, override: MockOverride | MockOverrideResolver): void;
|
|
2893
2911
|
/** Remove all overrides registered via {@link registerMockOverride}. */
|
|
2894
2912
|
clearMockOverrides(): void;
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
* spreadsheet, hand-written cases) into traces that {@link replay} can
|
|
2900
|
-
* select. The recorded root span carries `input` as its input and `expected`
|
|
2901
|
-
* as its output, so replay reports each item against the value you expected
|
|
2902
|
-
* rather than against a previous run.
|
|
2903
|
-
*
|
|
2904
|
-
* A seeded trace has no child spans and no database pin, so replay mocking
|
|
2905
|
-
* has nothing recorded to substitute and `dbBranch` refuses it. Pass
|
|
2906
|
-
* `mockOverride` at replay time for calls that must not run.
|
|
2907
|
-
*
|
|
2908
|
-
* @returns The trace ID, usable with `replay({ traceIds: [...] })`.
|
|
2909
|
-
*/
|
|
2910
|
-
seedTrace(traceFunctionKey: string, options: {
|
|
2911
|
-
/** Arguments spread into the function at replay, as `fn(...input)`. */
|
|
2912
|
-
input: unknown[];
|
|
2913
|
-
/**
|
|
2914
|
-
* The output this case should produce. Optional, but without it the
|
|
2915
|
-
* replay has nothing to be judged against.
|
|
2916
|
-
*/
|
|
2917
|
-
expected?: unknown;
|
|
2918
|
-
/**
|
|
2919
|
-
* The function these inputs will replay through. When given, the call is
|
|
2920
|
-
* checked against its arity here, so a case that cannot supply the
|
|
2921
|
-
* function's required arguments fails now instead of at replay. Omit it
|
|
2922
|
-
* when the seeding script cannot import the function.
|
|
2923
|
-
*/
|
|
2924
|
-
fn?: (...args: any[]) => unknown;
|
|
2925
|
-
/**
|
|
2926
|
-
* Recorded on the trace. Put the source row's id here so a seeded trace
|
|
2927
|
-
* can be traced back to the case it came from.
|
|
2928
|
-
*/
|
|
2929
|
-
metadata?: Record<string, unknown>;
|
|
2930
|
-
sessionId?: string;
|
|
2931
|
-
name?: string;
|
|
2932
|
-
spanName?: string;
|
|
2933
|
-
spanType?: SpanType;
|
|
2934
|
-
}): string;
|
|
2913
|
+
seedTrace(traceFunctionKey: string, options: SeedCaseOptions): string;
|
|
2914
|
+
seedTrace<TArgs extends unknown[], TReturn>(traceFunctionKey: string, fn: (...args: TArgs) => TReturn, options?: SeedRunOptions<TArgs>): Promise<string>;
|
|
2915
|
+
private seedTraceFromCase;
|
|
2916
|
+
private seedTraceByRunning;
|
|
2935
2917
|
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
2936
2918
|
}
|
|
2937
2919
|
/**
|
|
@@ -3107,7 +3089,7 @@ declare class BitfabFunction {
|
|
|
3107
3089
|
/**
|
|
3108
3090
|
* SDK version from package.json (injected at build time)
|
|
3109
3091
|
*/
|
|
3110
|
-
declare const __version__ = "0.
|
|
3092
|
+
declare const __version__ = "0.43.0";
|
|
3111
3093
|
|
|
3112
3094
|
/**
|
|
3113
3095
|
* Constants for the Bitfab SDK.
|
|
@@ -3233,6 +3215,8 @@ interface SeedResult {
|
|
|
3233
3215
|
* Passing the registered function to `seedTrace` also means a case that cannot
|
|
3234
3216
|
* supply its required arguments is rejected here rather than at replay.
|
|
3235
3217
|
*/
|
|
3236
|
-
declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, cases: readonly SeedCase[]
|
|
3218
|
+
declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, cases: readonly SeedCase[], options?: {
|
|
3219
|
+
run?: boolean;
|
|
3220
|
+
}): Promise<SeedResult>;
|
|
3237
3221
|
|
|
3238
|
-
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 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, 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 SeedResult, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceIngestionType, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3222
|
+
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, 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 TraceResponse, 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
|
@@ -585,7 +585,7 @@ declare class HttpClient {
|
|
|
585
585
|
* Start a replay session by fetching historical traces.
|
|
586
586
|
* Blocking call - creates a test run and returns lightweight item references.
|
|
587
587
|
*/
|
|
588
|
-
startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetId?: string, graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number): Promise<StartReplayResponse>;
|
|
588
|
+
startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetId?: string, graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean): Promise<StartReplayResponse>;
|
|
589
589
|
/**
|
|
590
590
|
* Fetch an external span by ID.
|
|
591
591
|
* Blocking GET request.
|
|
@@ -700,6 +700,7 @@ interface StartReplayResponse {
|
|
|
700
700
|
* servers that predate it.
|
|
701
701
|
*/
|
|
702
702
|
dbBranchTimings?: DbBranchTimings;
|
|
703
|
+
originalMetadata?: Record<string, unknown>;
|
|
703
704
|
}>;
|
|
704
705
|
}
|
|
705
706
|
interface ExternalSpanResponse {
|
|
@@ -962,6 +963,7 @@ declare class BitfabClaudeAgentHandler {
|
|
|
962
963
|
type LlmSpanOptions = {
|
|
963
964
|
type: "llm";
|
|
964
965
|
finalize: (result: unknown) => unknown | Promise<unknown>;
|
|
966
|
+
surface: "inherit";
|
|
965
967
|
};
|
|
966
968
|
type WithSpanFn$1 = <TArgs extends unknown[], TReturn>(traceFunctionKey: string, options: LlmSpanOptions, fn: (...args: TArgs) => TReturn) => (...args: TArgs) => TReturn;
|
|
967
969
|
/**
|
|
@@ -1267,6 +1269,7 @@ interface SpanClient {
|
|
|
1267
1269
|
captureWhen?: "always" | "nested";
|
|
1268
1270
|
mockOnReplay?: boolean;
|
|
1269
1271
|
finalize?: (result: unknown) => unknown | Promise<unknown>;
|
|
1272
|
+
surface?: "inherit";
|
|
1270
1273
|
}, fn: (...args: TArgs) => TReturn): (...args: TArgs) => TReturn;
|
|
1271
1274
|
}
|
|
1272
1275
|
interface LangGraphTool {
|
|
@@ -1373,6 +1376,7 @@ type RunResultLike = {
|
|
|
1373
1376
|
type RootSpanOptions = {
|
|
1374
1377
|
type: "agent";
|
|
1375
1378
|
finalize: (result: unknown) => unknown | Promise<unknown>;
|
|
1379
|
+
surface: "inherit";
|
|
1376
1380
|
};
|
|
1377
1381
|
type WithSpanFn = <TArgs extends unknown[], TReturn>(traceFunctionKey: string, options: RootSpanOptions, fn: (...args: TArgs) => TReturn) => (...args: TArgs) => TReturn;
|
|
1378
1382
|
type GetActiveSpanContextFn = () => unknown | null;
|
|
@@ -1746,6 +1750,7 @@ interface AdaptContext {
|
|
|
1746
1750
|
sourceTraceId: string;
|
|
1747
1751
|
/** @deprecated alias for {@link AdaptContext.originalSpanId}. */
|
|
1748
1752
|
sourceSpanId: string;
|
|
1753
|
+
metadata: Record<string, unknown>;
|
|
1749
1754
|
}
|
|
1750
1755
|
/**
|
|
1751
1756
|
* The shape an adapter module must export as `adaptInputs`.
|
|
@@ -2101,6 +2106,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2101
2106
|
private sendSpan;
|
|
2102
2107
|
}
|
|
2103
2108
|
|
|
2109
|
+
type CaptureSurface = "opt-in" | "opt-out";
|
|
2104
2110
|
/**
|
|
2105
2111
|
* Options for wrapBAML.
|
|
2106
2112
|
*/
|
|
@@ -2236,6 +2242,22 @@ declare function getCurrentReplayBranch(): ReplayBranch | null;
|
|
|
2236
2242
|
* Returns a no-op object if called outside of a span context (methods do nothing).
|
|
2237
2243
|
*/
|
|
2238
2244
|
declare function getCurrentTrace(): CurrentTrace;
|
|
2245
|
+
interface SeedCaseOptions {
|
|
2246
|
+
input: unknown[];
|
|
2247
|
+
expected?: unknown;
|
|
2248
|
+
fn?: (...args: any[]) => unknown;
|
|
2249
|
+
metadata?: Record<string, unknown>;
|
|
2250
|
+
sessionId?: string;
|
|
2251
|
+
name?: string;
|
|
2252
|
+
spanName?: string;
|
|
2253
|
+
spanType?: SpanType;
|
|
2254
|
+
}
|
|
2255
|
+
interface SeedRunOptions<TArgs extends unknown[]> {
|
|
2256
|
+
args?: TArgs;
|
|
2257
|
+
metadata?: Record<string, unknown>;
|
|
2258
|
+
sessionId?: string;
|
|
2259
|
+
name?: string;
|
|
2260
|
+
}
|
|
2239
2261
|
interface BitfabConfig {
|
|
2240
2262
|
/**
|
|
2241
2263
|
* The API key for Bitfab API authentication. Resolved lazily, the first
|
|
@@ -2256,7 +2278,7 @@ interface BitfabConfig {
|
|
|
2256
2278
|
timeout?: number;
|
|
2257
2279
|
/** Environment variables for LLM provider API keys (only OPENAI_API_KEY is supported) */
|
|
2258
2280
|
envVars?: AllowedEnvVars;
|
|
2259
|
-
|
|
2281
|
+
captureEnabled?: boolean;
|
|
2260
2282
|
enabled?: boolean;
|
|
2261
2283
|
/**
|
|
2262
2284
|
* Fail loud instead of degrading quietly. When true, the first traced call
|
|
@@ -2417,8 +2439,7 @@ declare class Bitfab {
|
|
|
2417
2439
|
private readonly serviceUrl;
|
|
2418
2440
|
private readonly timeout;
|
|
2419
2441
|
private readonly envVars;
|
|
2420
|
-
|
|
2421
|
-
private readonly explicitlyEnabled;
|
|
2442
|
+
private readonly captureConfigured;
|
|
2422
2443
|
private readonly strict;
|
|
2423
2444
|
private readonly httpClient;
|
|
2424
2445
|
/** Dataset operations for the authenticated organization. */
|
|
@@ -2533,12 +2554,9 @@ declare class Bitfab {
|
|
|
2533
2554
|
* early resolve that found nothing never poisons a later one.
|
|
2534
2555
|
*/
|
|
2535
2556
|
private resolveApiKey;
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
* touching the key.
|
|
2540
|
-
*/
|
|
2541
|
-
private isTracingEnabled;
|
|
2557
|
+
private isCaptureEnabled;
|
|
2558
|
+
private shouldRecord;
|
|
2559
|
+
get captureEnabled(): boolean;
|
|
2542
2560
|
/**
|
|
2543
2561
|
* Fetch the function with its current version and BAML prompt from the server.
|
|
2544
2562
|
*
|
|
@@ -2892,46 +2910,10 @@ declare class Bitfab {
|
|
|
2892
2910
|
registerMockOverride(traceFunctionKey: string, override: MockOverride | MockOverrideResolver): void;
|
|
2893
2911
|
/** Remove all overrides registered via {@link registerMockOverride}. */
|
|
2894
2912
|
clearMockOverrides(): void;
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
* spreadsheet, hand-written cases) into traces that {@link replay} can
|
|
2900
|
-
* select. The recorded root span carries `input` as its input and `expected`
|
|
2901
|
-
* as its output, so replay reports each item against the value you expected
|
|
2902
|
-
* rather than against a previous run.
|
|
2903
|
-
*
|
|
2904
|
-
* A seeded trace has no child spans and no database pin, so replay mocking
|
|
2905
|
-
* has nothing recorded to substitute and `dbBranch` refuses it. Pass
|
|
2906
|
-
* `mockOverride` at replay time for calls that must not run.
|
|
2907
|
-
*
|
|
2908
|
-
* @returns The trace ID, usable with `replay({ traceIds: [...] })`.
|
|
2909
|
-
*/
|
|
2910
|
-
seedTrace(traceFunctionKey: string, options: {
|
|
2911
|
-
/** Arguments spread into the function at replay, as `fn(...input)`. */
|
|
2912
|
-
input: unknown[];
|
|
2913
|
-
/**
|
|
2914
|
-
* The output this case should produce. Optional, but without it the
|
|
2915
|
-
* replay has nothing to be judged against.
|
|
2916
|
-
*/
|
|
2917
|
-
expected?: unknown;
|
|
2918
|
-
/**
|
|
2919
|
-
* The function these inputs will replay through. When given, the call is
|
|
2920
|
-
* checked against its arity here, so a case that cannot supply the
|
|
2921
|
-
* function's required arguments fails now instead of at replay. Omit it
|
|
2922
|
-
* when the seeding script cannot import the function.
|
|
2923
|
-
*/
|
|
2924
|
-
fn?: (...args: any[]) => unknown;
|
|
2925
|
-
/**
|
|
2926
|
-
* Recorded on the trace. Put the source row's id here so a seeded trace
|
|
2927
|
-
* can be traced back to the case it came from.
|
|
2928
|
-
*/
|
|
2929
|
-
metadata?: Record<string, unknown>;
|
|
2930
|
-
sessionId?: string;
|
|
2931
|
-
name?: string;
|
|
2932
|
-
spanName?: string;
|
|
2933
|
-
spanType?: SpanType;
|
|
2934
|
-
}): string;
|
|
2913
|
+
seedTrace(traceFunctionKey: string, options: SeedCaseOptions): string;
|
|
2914
|
+
seedTrace<TArgs extends unknown[], TReturn>(traceFunctionKey: string, fn: (...args: TArgs) => TReturn, options?: SeedRunOptions<TArgs>): Promise<string>;
|
|
2915
|
+
private seedTraceFromCase;
|
|
2916
|
+
private seedTraceByRunning;
|
|
2935
2917
|
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
2936
2918
|
}
|
|
2937
2919
|
/**
|
|
@@ -3107,7 +3089,7 @@ declare class BitfabFunction {
|
|
|
3107
3089
|
/**
|
|
3108
3090
|
* SDK version from package.json (injected at build time)
|
|
3109
3091
|
*/
|
|
3110
|
-
declare const __version__ = "0.
|
|
3092
|
+
declare const __version__ = "0.43.0";
|
|
3111
3093
|
|
|
3112
3094
|
/**
|
|
3113
3095
|
* Constants for the Bitfab SDK.
|
|
@@ -3233,6 +3215,8 @@ interface SeedResult {
|
|
|
3233
3215
|
* Passing the registered function to `seedTrace` also means a case that cannot
|
|
3234
3216
|
* supply its required arguments is rejected here rather than at replay.
|
|
3235
3217
|
*/
|
|
3236
|
-
declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, cases: readonly SeedCase[]
|
|
3218
|
+
declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, cases: readonly SeedCase[], options?: {
|
|
3219
|
+
run?: boolean;
|
|
3220
|
+
}): Promise<SeedResult>;
|
|
3237
3221
|
|
|
3238
|
-
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 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, 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 SeedResult, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceIngestionType, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3222
|
+
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, 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 TraceResponse, 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
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
getCurrentSpan,
|
|
16
16
|
getCurrentTrace,
|
|
17
17
|
seedFromRegistry
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5BBJ5BQD.js";
|
|
19
19
|
import "./chunk-ZUD7OFYB.js";
|
|
20
20
|
import {
|
|
21
21
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -24,14 +24,14 @@ import {
|
|
|
24
24
|
ReplayError,
|
|
25
25
|
reportReplayProgress,
|
|
26
26
|
serializeReplayResult
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-BXBRVWWW.js";
|
|
28
28
|
import {
|
|
29
29
|
BitfabError,
|
|
30
30
|
DEFAULT_SERVICE_URL,
|
|
31
31
|
HttpClient,
|
|
32
32
|
__version__,
|
|
33
33
|
flushTraces
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-6EM2S5H5.js";
|
|
35
35
|
import "./chunk-H6LZRFMN.js";
|
|
36
36
|
export {
|
|
37
37
|
BITFAB_PROGRESS_PREFIX,
|