@bitfab/sdk 0.42.0 → 0.43.1
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-UGFTBSGS.js → chunk-5LY4XOUY.js} +6 -3
- package/dist/{chunk-UGFTBSGS.js.map → chunk-5LY4XOUY.js.map} +1 -1
- package/dist/{chunk-QJ6IFPGU.js → chunk-RBKGO5ZC.js} +6 -3
- package/dist/{chunk-QJ6IFPGU.js.map → chunk-RBKGO5ZC.js.map} +1 -1
- package/dist/{chunk-BG3A5HNC.js → chunk-TNGKCPBP.js} +10 -4
- package/dist/chunk-TNGKCPBP.js.map +1 -0
- package/dist/{chunk-BC5OYWAM.js → chunk-V4MRFSWK.js} +173 -67
- package/dist/chunk-V4MRFSWK.js.map +1 -0
- package/dist/{http-NZHGC5YF.js → http-FKD4GT55.js} +2 -2
- package/dist/{http-F5L466DI.js → http-TPVUGXYJ.js} +2 -2
- package/dist/index.cjs +184 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -64
- package/dist/index.d.ts +37 -64
- 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-PICGOZVG.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-FKD4GT55.js.map} +0 -0
- /package/dist/{http-NZHGC5YF.js.map → http-TPVUGXYJ.js.map} +0 -0
- /package/dist/{replay-PLACY77M.js.map → replay-PICGOZVG.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;
|
|
@@ -1430,12 +1434,6 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
1430
1434
|
*/
|
|
1431
1435
|
|
|
1432
1436
|
type MockStrategy = "none" | "all" | "marked";
|
|
1433
|
-
/**
|
|
1434
|
-
* How a source trace came to exist. A `seeded` trace was written from a case
|
|
1435
|
-
* with {@link Bitfab.seedTrace} rather than executed, so it has no recorded
|
|
1436
|
-
* child spans to mock from and no database state to restore, and its recorded
|
|
1437
|
-
* output is the value the case expected rather than a previous run's result.
|
|
1438
|
-
*/
|
|
1439
1437
|
type TraceIngestionType = "captured" | "seeded";
|
|
1440
1438
|
/**
|
|
1441
1439
|
* How the DB-snapshot branch each replay item runs against is sized and warmed.
|
|
@@ -1746,6 +1744,7 @@ interface AdaptContext {
|
|
|
1746
1744
|
sourceTraceId: string;
|
|
1747
1745
|
/** @deprecated alias for {@link AdaptContext.originalSpanId}. */
|
|
1748
1746
|
sourceSpanId: string;
|
|
1747
|
+
metadata: Record<string, unknown>;
|
|
1749
1748
|
}
|
|
1750
1749
|
/**
|
|
1751
1750
|
* The shape an adapter module must export as `adaptInputs`.
|
|
@@ -1782,11 +1781,6 @@ interface ReplayItem<T> {
|
|
|
1782
1781
|
input: unknown[];
|
|
1783
1782
|
/** The result returned by the function during replay, or undefined on error. */
|
|
1784
1783
|
result: T | undefined;
|
|
1785
|
-
/**
|
|
1786
|
-
* The original output from the historical trace. For a `seeded` source this
|
|
1787
|
-
* is the value the case expected, not a previous run's result, so a
|
|
1788
|
-
* difference means the code missed the expectation rather than drifted.
|
|
1789
|
-
*/
|
|
1790
1784
|
originalOutput: unknown;
|
|
1791
1785
|
/**
|
|
1792
1786
|
* How the source trace came to exist. Absent on servers that predate the
|
|
@@ -2101,6 +2095,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2101
2095
|
private sendSpan;
|
|
2102
2096
|
}
|
|
2103
2097
|
|
|
2098
|
+
type CaptureSurface = "opt-in" | "opt-out";
|
|
2104
2099
|
/**
|
|
2105
2100
|
* Options for wrapBAML.
|
|
2106
2101
|
*/
|
|
@@ -2236,6 +2231,22 @@ declare function getCurrentReplayBranch(): ReplayBranch | null;
|
|
|
2236
2231
|
* Returns a no-op object if called outside of a span context (methods do nothing).
|
|
2237
2232
|
*/
|
|
2238
2233
|
declare function getCurrentTrace(): CurrentTrace;
|
|
2234
|
+
interface SeedCaseOptions {
|
|
2235
|
+
input: unknown[];
|
|
2236
|
+
expected?: unknown;
|
|
2237
|
+
fn?: (...args: any[]) => unknown;
|
|
2238
|
+
metadata?: Record<string, unknown>;
|
|
2239
|
+
sessionId?: string;
|
|
2240
|
+
name?: string;
|
|
2241
|
+
spanName?: string;
|
|
2242
|
+
spanType?: SpanType;
|
|
2243
|
+
}
|
|
2244
|
+
interface SeedRunOptions<TArgs extends unknown[]> {
|
|
2245
|
+
args?: TArgs;
|
|
2246
|
+
metadata?: Record<string, unknown>;
|
|
2247
|
+
sessionId?: string;
|
|
2248
|
+
name?: string;
|
|
2249
|
+
}
|
|
2239
2250
|
interface BitfabConfig {
|
|
2240
2251
|
/**
|
|
2241
2252
|
* The API key for Bitfab API authentication. Resolved lazily, the first
|
|
@@ -2256,7 +2267,7 @@ interface BitfabConfig {
|
|
|
2256
2267
|
timeout?: number;
|
|
2257
2268
|
/** Environment variables for LLM provider API keys (only OPENAI_API_KEY is supported) */
|
|
2258
2269
|
envVars?: AllowedEnvVars;
|
|
2259
|
-
|
|
2270
|
+
captureEnabled?: boolean;
|
|
2260
2271
|
enabled?: boolean;
|
|
2261
2272
|
/**
|
|
2262
2273
|
* Fail loud instead of degrading quietly. When true, the first traced call
|
|
@@ -2417,8 +2428,7 @@ declare class Bitfab {
|
|
|
2417
2428
|
private readonly serviceUrl;
|
|
2418
2429
|
private readonly timeout;
|
|
2419
2430
|
private readonly envVars;
|
|
2420
|
-
|
|
2421
|
-
private readonly explicitlyEnabled;
|
|
2431
|
+
private readonly captureConfigured;
|
|
2422
2432
|
private readonly strict;
|
|
2423
2433
|
private readonly httpClient;
|
|
2424
2434
|
/** Dataset operations for the authenticated organization. */
|
|
@@ -2533,12 +2543,9 @@ declare class Bitfab {
|
|
|
2533
2543
|
* early resolve that found nothing never poisons a later one.
|
|
2534
2544
|
*/
|
|
2535
2545
|
private resolveApiKey;
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
* touching the key.
|
|
2540
|
-
*/
|
|
2541
|
-
private isTracingEnabled;
|
|
2546
|
+
private isCaptureEnabled;
|
|
2547
|
+
private shouldRecord;
|
|
2548
|
+
get captureEnabled(): boolean;
|
|
2542
2549
|
/**
|
|
2543
2550
|
* Fetch the function with its current version and BAML prompt from the server.
|
|
2544
2551
|
*
|
|
@@ -2892,46 +2899,10 @@ declare class Bitfab {
|
|
|
2892
2899
|
registerMockOverride(traceFunctionKey: string, override: MockOverride | MockOverrideResolver): void;
|
|
2893
2900
|
/** Remove all overrides registered via {@link registerMockOverride}. */
|
|
2894
2901
|
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;
|
|
2902
|
+
seedTrace(traceFunctionKey: string, options: SeedCaseOptions): string;
|
|
2903
|
+
seedTrace<TArgs extends unknown[], TReturn>(traceFunctionKey: string, fn: (...args: TArgs) => TReturn, options?: SeedRunOptions<TArgs>): Promise<string>;
|
|
2904
|
+
private seedTraceFromCase;
|
|
2905
|
+
private seedTraceByRunning;
|
|
2935
2906
|
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
2936
2907
|
}
|
|
2937
2908
|
/**
|
|
@@ -3107,7 +3078,7 @@ declare class BitfabFunction {
|
|
|
3107
3078
|
/**
|
|
3108
3079
|
* SDK version from package.json (injected at build time)
|
|
3109
3080
|
*/
|
|
3110
|
-
declare const __version__ = "0.
|
|
3081
|
+
declare const __version__ = "0.43.1";
|
|
3111
3082
|
|
|
3112
3083
|
/**
|
|
3113
3084
|
* Constants for the Bitfab SDK.
|
|
@@ -3233,6 +3204,8 @@ interface SeedResult {
|
|
|
3233
3204
|
* Passing the registered function to `seedTrace` also means a case that cannot
|
|
3234
3205
|
* supply its required arguments is rejected here rather than at replay.
|
|
3235
3206
|
*/
|
|
3236
|
-
declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, cases: readonly SeedCase[]
|
|
3207
|
+
declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, cases: readonly SeedCase[], options?: {
|
|
3208
|
+
run?: boolean;
|
|
3209
|
+
}): Promise<SeedResult>;
|
|
3237
3210
|
|
|
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 };
|
|
3211
|
+
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;
|
|
@@ -1430,12 +1434,6 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
1430
1434
|
*/
|
|
1431
1435
|
|
|
1432
1436
|
type MockStrategy = "none" | "all" | "marked";
|
|
1433
|
-
/**
|
|
1434
|
-
* How a source trace came to exist. A `seeded` trace was written from a case
|
|
1435
|
-
* with {@link Bitfab.seedTrace} rather than executed, so it has no recorded
|
|
1436
|
-
* child spans to mock from and no database state to restore, and its recorded
|
|
1437
|
-
* output is the value the case expected rather than a previous run's result.
|
|
1438
|
-
*/
|
|
1439
1437
|
type TraceIngestionType = "captured" | "seeded";
|
|
1440
1438
|
/**
|
|
1441
1439
|
* How the DB-snapshot branch each replay item runs against is sized and warmed.
|
|
@@ -1746,6 +1744,7 @@ interface AdaptContext {
|
|
|
1746
1744
|
sourceTraceId: string;
|
|
1747
1745
|
/** @deprecated alias for {@link AdaptContext.originalSpanId}. */
|
|
1748
1746
|
sourceSpanId: string;
|
|
1747
|
+
metadata: Record<string, unknown>;
|
|
1749
1748
|
}
|
|
1750
1749
|
/**
|
|
1751
1750
|
* The shape an adapter module must export as `adaptInputs`.
|
|
@@ -1782,11 +1781,6 @@ interface ReplayItem<T> {
|
|
|
1782
1781
|
input: unknown[];
|
|
1783
1782
|
/** The result returned by the function during replay, or undefined on error. */
|
|
1784
1783
|
result: T | undefined;
|
|
1785
|
-
/**
|
|
1786
|
-
* The original output from the historical trace. For a `seeded` source this
|
|
1787
|
-
* is the value the case expected, not a previous run's result, so a
|
|
1788
|
-
* difference means the code missed the expectation rather than drifted.
|
|
1789
|
-
*/
|
|
1790
1784
|
originalOutput: unknown;
|
|
1791
1785
|
/**
|
|
1792
1786
|
* How the source trace came to exist. Absent on servers that predate the
|
|
@@ -2101,6 +2095,7 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2101
2095
|
private sendSpan;
|
|
2102
2096
|
}
|
|
2103
2097
|
|
|
2098
|
+
type CaptureSurface = "opt-in" | "opt-out";
|
|
2104
2099
|
/**
|
|
2105
2100
|
* Options for wrapBAML.
|
|
2106
2101
|
*/
|
|
@@ -2236,6 +2231,22 @@ declare function getCurrentReplayBranch(): ReplayBranch | null;
|
|
|
2236
2231
|
* Returns a no-op object if called outside of a span context (methods do nothing).
|
|
2237
2232
|
*/
|
|
2238
2233
|
declare function getCurrentTrace(): CurrentTrace;
|
|
2234
|
+
interface SeedCaseOptions {
|
|
2235
|
+
input: unknown[];
|
|
2236
|
+
expected?: unknown;
|
|
2237
|
+
fn?: (...args: any[]) => unknown;
|
|
2238
|
+
metadata?: Record<string, unknown>;
|
|
2239
|
+
sessionId?: string;
|
|
2240
|
+
name?: string;
|
|
2241
|
+
spanName?: string;
|
|
2242
|
+
spanType?: SpanType;
|
|
2243
|
+
}
|
|
2244
|
+
interface SeedRunOptions<TArgs extends unknown[]> {
|
|
2245
|
+
args?: TArgs;
|
|
2246
|
+
metadata?: Record<string, unknown>;
|
|
2247
|
+
sessionId?: string;
|
|
2248
|
+
name?: string;
|
|
2249
|
+
}
|
|
2239
2250
|
interface BitfabConfig {
|
|
2240
2251
|
/**
|
|
2241
2252
|
* The API key for Bitfab API authentication. Resolved lazily, the first
|
|
@@ -2256,7 +2267,7 @@ interface BitfabConfig {
|
|
|
2256
2267
|
timeout?: number;
|
|
2257
2268
|
/** Environment variables for LLM provider API keys (only OPENAI_API_KEY is supported) */
|
|
2258
2269
|
envVars?: AllowedEnvVars;
|
|
2259
|
-
|
|
2270
|
+
captureEnabled?: boolean;
|
|
2260
2271
|
enabled?: boolean;
|
|
2261
2272
|
/**
|
|
2262
2273
|
* Fail loud instead of degrading quietly. When true, the first traced call
|
|
@@ -2417,8 +2428,7 @@ declare class Bitfab {
|
|
|
2417
2428
|
private readonly serviceUrl;
|
|
2418
2429
|
private readonly timeout;
|
|
2419
2430
|
private readonly envVars;
|
|
2420
|
-
|
|
2421
|
-
private readonly explicitlyEnabled;
|
|
2431
|
+
private readonly captureConfigured;
|
|
2422
2432
|
private readonly strict;
|
|
2423
2433
|
private readonly httpClient;
|
|
2424
2434
|
/** Dataset operations for the authenticated organization. */
|
|
@@ -2533,12 +2543,9 @@ declare class Bitfab {
|
|
|
2533
2543
|
* early resolve that found nothing never poisons a later one.
|
|
2534
2544
|
*/
|
|
2535
2545
|
private resolveApiKey;
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
* touching the key.
|
|
2540
|
-
*/
|
|
2541
|
-
private isTracingEnabled;
|
|
2546
|
+
private isCaptureEnabled;
|
|
2547
|
+
private shouldRecord;
|
|
2548
|
+
get captureEnabled(): boolean;
|
|
2542
2549
|
/**
|
|
2543
2550
|
* Fetch the function with its current version and BAML prompt from the server.
|
|
2544
2551
|
*
|
|
@@ -2892,46 +2899,10 @@ declare class Bitfab {
|
|
|
2892
2899
|
registerMockOverride(traceFunctionKey: string, override: MockOverride | MockOverrideResolver): void;
|
|
2893
2900
|
/** Remove all overrides registered via {@link registerMockOverride}. */
|
|
2894
2901
|
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;
|
|
2902
|
+
seedTrace(traceFunctionKey: string, options: SeedCaseOptions): string;
|
|
2903
|
+
seedTrace<TArgs extends unknown[], TReturn>(traceFunctionKey: string, fn: (...args: TArgs) => TReturn, options?: SeedRunOptions<TArgs>): Promise<string>;
|
|
2904
|
+
private seedTraceFromCase;
|
|
2905
|
+
private seedTraceByRunning;
|
|
2935
2906
|
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
2936
2907
|
}
|
|
2937
2908
|
/**
|
|
@@ -3107,7 +3078,7 @@ declare class BitfabFunction {
|
|
|
3107
3078
|
/**
|
|
3108
3079
|
* SDK version from package.json (injected at build time)
|
|
3109
3080
|
*/
|
|
3110
|
-
declare const __version__ = "0.
|
|
3081
|
+
declare const __version__ = "0.43.1";
|
|
3111
3082
|
|
|
3112
3083
|
/**
|
|
3113
3084
|
* Constants for the Bitfab SDK.
|
|
@@ -3233,6 +3204,8 @@ interface SeedResult {
|
|
|
3233
3204
|
* Passing the registered function to `seedTrace` also means a case that cannot
|
|
3234
3205
|
* supply its required arguments is rejected here rather than at replay.
|
|
3235
3206
|
*/
|
|
3236
|
-
declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, cases: readonly SeedCase[]
|
|
3207
|
+
declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, cases: readonly SeedCase[], options?: {
|
|
3208
|
+
run?: boolean;
|
|
3209
|
+
}): Promise<SeedResult>;
|
|
3237
3210
|
|
|
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 };
|
|
3211
|
+
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-V4MRFSWK.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-TNGKCPBP.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-5LY4XOUY.js";
|
|
35
35
|
import "./chunk-H6LZRFMN.js";
|
|
36
36
|
export {
|
|
37
37
|
BITFAB_PROGRESS_PREFIX,
|