bitfab 0.52.2 → 0.52.4
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-XL5M3ETX.js → chunk-34B7PVAM.js} +79 -28
- package/dist/chunk-34B7PVAM.js.map +1 -0
- package/dist/{chunk-RU7KJE2D.js → chunk-AUROMI67.js} +61 -11
- package/dist/chunk-AUROMI67.js.map +1 -0
- package/dist/chunk-HKTODDFP.js +747 -0
- package/dist/chunk-HKTODDFP.js.map +1 -0
- package/dist/{chunk-ESIEHZHQ.js → chunk-IG3CPSRQ.js} +48 -21
- package/dist/chunk-IG3CPSRQ.js.map +1 -0
- package/dist/{chunk-SIMPLMRG.js → chunk-U2D7ACC4.js} +3 -2
- package/dist/chunk-U2D7ACC4.js.map +1 -0
- package/dist/{http-2NFFBFYV.js → http-F3AXLOJT.js} +2 -2
- package/dist/{http-RULNEWBV.js → http-RFNQ7LSU.js} +2 -2
- package/dist/index.cjs +134 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.js +5 -3
- package/dist/node.cjs +134 -31
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +5 -3
- package/dist/node.js.map +1 -1
- package/dist/{replay-6SQSBWLX.js → replay-ZOTYMBMD.js} +5 -3
- package/dist/replayCli.js +18 -687
- package/dist/replayCli.js.map +1 -1
- package/dist/seedCli.js +30 -0
- package/dist/seedCli.js.map +1 -0
- package/package.json +3 -2
- package/dist/chunk-ESIEHZHQ.js.map +0 -1
- package/dist/chunk-RU7KJE2D.js.map +0 -1
- package/dist/chunk-SIMPLMRG.js.map +0 -1
- package/dist/chunk-XL5M3ETX.js.map +0 -1
- /package/dist/{http-2NFFBFYV.js.map → http-F3AXLOJT.js.map} +0 -0
- /package/dist/{http-RULNEWBV.js.map → http-RFNQ7LSU.js.map} +0 -0
- /package/dist/{replay-6SQSBWLX.js.map → replay-ZOTYMBMD.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -591,6 +591,8 @@ declare class HttpClient {
|
|
|
591
591
|
* Blocking call.
|
|
592
592
|
*/
|
|
593
593
|
completeReplay(testRunId: string): Promise<CompleteReplayResponse>;
|
|
594
|
+
getReseedSource(traceId: string): Promise<ReseedSourceResponse>;
|
|
595
|
+
reseedTrace(traceId: string, runTraceId: string): Promise<ReseedTraceResponse>;
|
|
594
596
|
/**
|
|
595
597
|
* Ask the server to materialize a per-trace DB branch lease from a
|
|
596
598
|
* captured `dbSnapshotRef`. Blocking - the resolver creates a Neon
|
|
@@ -749,6 +751,21 @@ interface CompleteReplayResponse {
|
|
|
749
751
|
*/
|
|
750
752
|
traceCount?: number;
|
|
751
753
|
}
|
|
754
|
+
interface ReseedSourceResponse {
|
|
755
|
+
traceId: string;
|
|
756
|
+
traceFunctionKey: string;
|
|
757
|
+
ingestionType: string;
|
|
758
|
+
name: string | null;
|
|
759
|
+
sessionId: string | null;
|
|
760
|
+
metadata: Record<string, unknown>;
|
|
761
|
+
input: unknown;
|
|
762
|
+
inputMeta: unknown;
|
|
763
|
+
inputSerialized: unknown;
|
|
764
|
+
}
|
|
765
|
+
interface ReseedTraceResponse {
|
|
766
|
+
traceId: string;
|
|
767
|
+
previousRunTraceId: string;
|
|
768
|
+
}
|
|
752
769
|
interface SpanTreeNode {
|
|
753
770
|
/** Upstream platform span id. Stable structural identity; NOT the row id. */
|
|
754
771
|
sourceSpanId: string;
|
|
@@ -2459,6 +2476,13 @@ interface SeedRunOptions<TArgs extends unknown[]> {
|
|
|
2459
2476
|
sessionId?: string;
|
|
2460
2477
|
name?: string;
|
|
2461
2478
|
}
|
|
2479
|
+
interface ReseedOptions {
|
|
2480
|
+
traceId: string;
|
|
2481
|
+
}
|
|
2482
|
+
interface ReseedResult {
|
|
2483
|
+
traceId: string;
|
|
2484
|
+
previousRunTraceId: string;
|
|
2485
|
+
}
|
|
2462
2486
|
interface BitfabConfig {
|
|
2463
2487
|
/**
|
|
2464
2488
|
* The API key for Bitfab API authentication. Resolved lazily, the first
|
|
@@ -3118,6 +3142,7 @@ declare class Bitfab {
|
|
|
3118
3142
|
seedTrace<TArgs extends unknown[], TReturn>(traceFunctionKey: string, fn: (...args: TArgs) => TReturn, options?: SeedRunOptions<TArgs>): Promise<string>;
|
|
3119
3143
|
private seedTraceFromCase;
|
|
3120
3144
|
private seedTraceByRunning;
|
|
3145
|
+
reseedTrace(traceFunctionKey: string, fn: (...args: any[]) => unknown, options: ReseedOptions): Promise<ReseedResult>;
|
|
3121
3146
|
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
3122
3147
|
}
|
|
3123
3148
|
/**
|
|
@@ -3293,7 +3318,7 @@ declare class BitfabFunction {
|
|
|
3293
3318
|
/**
|
|
3294
3319
|
* SDK version from package.json (injected at build time)
|
|
3295
3320
|
*/
|
|
3296
|
-
declare const __version__ = "0.52.
|
|
3321
|
+
declare const __version__ = "0.52.4";
|
|
3297
3322
|
|
|
3298
3323
|
/**
|
|
3299
3324
|
* Constants for the Bitfab SDK.
|
|
@@ -3410,6 +3435,15 @@ interface SeedResult {
|
|
|
3410
3435
|
traceFunctionKey: string;
|
|
3411
3436
|
traceIds: string[];
|
|
3412
3437
|
}
|
|
3438
|
+
interface ReseedRegistryResult {
|
|
3439
|
+
pipeline: string;
|
|
3440
|
+
traceFunctionKey: string;
|
|
3441
|
+
reseeded: {
|
|
3442
|
+
traceId: string;
|
|
3443
|
+
previousRunTraceId: string;
|
|
3444
|
+
}[];
|
|
3445
|
+
}
|
|
3446
|
+
declare function reseedFromRegistry(registry: ReplayRegistry, pipeline: string, traceIds: readonly string[]): Promise<ReseedRegistryResult>;
|
|
3413
3447
|
/**
|
|
3414
3448
|
* Seed cases through an already-registered pipeline.
|
|
3415
3449
|
*
|
|
@@ -3423,4 +3457,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3423
3457
|
run?: boolean;
|
|
3424
3458
|
}): Promise<SeedResult>;
|
|
3425
3459
|
|
|
3426
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, 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 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, SUPPORTED_PROVIDERS, type SaveAssertion, 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 TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3460
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, 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 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 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 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
|
@@ -591,6 +591,8 @@ declare class HttpClient {
|
|
|
591
591
|
* Blocking call.
|
|
592
592
|
*/
|
|
593
593
|
completeReplay(testRunId: string): Promise<CompleteReplayResponse>;
|
|
594
|
+
getReseedSource(traceId: string): Promise<ReseedSourceResponse>;
|
|
595
|
+
reseedTrace(traceId: string, runTraceId: string): Promise<ReseedTraceResponse>;
|
|
594
596
|
/**
|
|
595
597
|
* Ask the server to materialize a per-trace DB branch lease from a
|
|
596
598
|
* captured `dbSnapshotRef`. Blocking - the resolver creates a Neon
|
|
@@ -749,6 +751,21 @@ interface CompleteReplayResponse {
|
|
|
749
751
|
*/
|
|
750
752
|
traceCount?: number;
|
|
751
753
|
}
|
|
754
|
+
interface ReseedSourceResponse {
|
|
755
|
+
traceId: string;
|
|
756
|
+
traceFunctionKey: string;
|
|
757
|
+
ingestionType: string;
|
|
758
|
+
name: string | null;
|
|
759
|
+
sessionId: string | null;
|
|
760
|
+
metadata: Record<string, unknown>;
|
|
761
|
+
input: unknown;
|
|
762
|
+
inputMeta: unknown;
|
|
763
|
+
inputSerialized: unknown;
|
|
764
|
+
}
|
|
765
|
+
interface ReseedTraceResponse {
|
|
766
|
+
traceId: string;
|
|
767
|
+
previousRunTraceId: string;
|
|
768
|
+
}
|
|
752
769
|
interface SpanTreeNode {
|
|
753
770
|
/** Upstream platform span id. Stable structural identity; NOT the row id. */
|
|
754
771
|
sourceSpanId: string;
|
|
@@ -2459,6 +2476,13 @@ interface SeedRunOptions<TArgs extends unknown[]> {
|
|
|
2459
2476
|
sessionId?: string;
|
|
2460
2477
|
name?: string;
|
|
2461
2478
|
}
|
|
2479
|
+
interface ReseedOptions {
|
|
2480
|
+
traceId: string;
|
|
2481
|
+
}
|
|
2482
|
+
interface ReseedResult {
|
|
2483
|
+
traceId: string;
|
|
2484
|
+
previousRunTraceId: string;
|
|
2485
|
+
}
|
|
2462
2486
|
interface BitfabConfig {
|
|
2463
2487
|
/**
|
|
2464
2488
|
* The API key for Bitfab API authentication. Resolved lazily, the first
|
|
@@ -3118,6 +3142,7 @@ declare class Bitfab {
|
|
|
3118
3142
|
seedTrace<TArgs extends unknown[], TReturn>(traceFunctionKey: string, fn: (...args: TArgs) => TReturn, options?: SeedRunOptions<TArgs>): Promise<string>;
|
|
3119
3143
|
private seedTraceFromCase;
|
|
3120
3144
|
private seedTraceByRunning;
|
|
3145
|
+
reseedTrace(traceFunctionKey: string, fn: (...args: any[]) => unknown, options: ReseedOptions): Promise<ReseedResult>;
|
|
3121
3146
|
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
3122
3147
|
}
|
|
3123
3148
|
/**
|
|
@@ -3293,7 +3318,7 @@ declare class BitfabFunction {
|
|
|
3293
3318
|
/**
|
|
3294
3319
|
* SDK version from package.json (injected at build time)
|
|
3295
3320
|
*/
|
|
3296
|
-
declare const __version__ = "0.52.
|
|
3321
|
+
declare const __version__ = "0.52.4";
|
|
3297
3322
|
|
|
3298
3323
|
/**
|
|
3299
3324
|
* Constants for the Bitfab SDK.
|
|
@@ -3410,6 +3435,15 @@ interface SeedResult {
|
|
|
3410
3435
|
traceFunctionKey: string;
|
|
3411
3436
|
traceIds: string[];
|
|
3412
3437
|
}
|
|
3438
|
+
interface ReseedRegistryResult {
|
|
3439
|
+
pipeline: string;
|
|
3440
|
+
traceFunctionKey: string;
|
|
3441
|
+
reseeded: {
|
|
3442
|
+
traceId: string;
|
|
3443
|
+
previousRunTraceId: string;
|
|
3444
|
+
}[];
|
|
3445
|
+
}
|
|
3446
|
+
declare function reseedFromRegistry(registry: ReplayRegistry, pipeline: string, traceIds: readonly string[]): Promise<ReseedRegistryResult>;
|
|
3413
3447
|
/**
|
|
3414
3448
|
* Seed cases through an already-registered pipeline.
|
|
3415
3449
|
*
|
|
@@ -3423,4 +3457,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3423
3457
|
run?: boolean;
|
|
3424
3458
|
}): Promise<SeedResult>;
|
|
3425
3459
|
|
|
3426
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, 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 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, SUPPORTED_PROVIDERS, type SaveAssertion, 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 TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, seedFromRegistry, serializeReplayResult };
|
|
3460
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, 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 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 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 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
|
@@ -26,8 +26,9 @@ import {
|
|
|
26
26
|
getCurrentReplayBranch,
|
|
27
27
|
getCurrentSpan,
|
|
28
28
|
getCurrentTrace,
|
|
29
|
+
reseedFromRegistry,
|
|
29
30
|
seedFromRegistry
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-AUROMI67.js";
|
|
31
32
|
import "./chunk-ZUD7OFYB.js";
|
|
32
33
|
import {
|
|
33
34
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -36,7 +37,7 @@ import {
|
|
|
36
37
|
ReplayError,
|
|
37
38
|
reportReplayProgress,
|
|
38
39
|
serializeReplayResult
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-U2D7ACC4.js";
|
|
40
41
|
import {
|
|
41
42
|
BitfabError,
|
|
42
43
|
DEFAULT_SERVICE_URL,
|
|
@@ -44,7 +45,7 @@ import {
|
|
|
44
45
|
MixedTracingError,
|
|
45
46
|
__version__,
|
|
46
47
|
flushTraces
|
|
47
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-34B7PVAM.js";
|
|
48
49
|
import "./chunk-H6LZRFMN.js";
|
|
49
50
|
export {
|
|
50
51
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -77,6 +78,7 @@ export {
|
|
|
77
78
|
getCurrentSpan,
|
|
78
79
|
getCurrentTrace,
|
|
79
80
|
reportReplayProgress,
|
|
81
|
+
reseedFromRegistry,
|
|
80
82
|
seedFromRegistry,
|
|
81
83
|
serializeReplayResult
|
|
82
84
|
};
|
package/dist/node.cjs
CHANGED
|
@@ -97,7 +97,7 @@ var __version__, __packageName__;
|
|
|
97
97
|
var init_version_generated = __esm({
|
|
98
98
|
"src/version.generated.ts"() {
|
|
99
99
|
"use strict";
|
|
100
|
-
__version__ = "0.52.
|
|
100
|
+
__version__ = "0.52.4";
|
|
101
101
|
__packageName__ = "bitfab";
|
|
102
102
|
}
|
|
103
103
|
});
|
|
@@ -401,15 +401,18 @@ var init_payloadBudget = __esm({
|
|
|
401
401
|
});
|
|
402
402
|
|
|
403
403
|
// src/warnOnce.ts
|
|
404
|
+
function warn(message) {
|
|
405
|
+
try {
|
|
406
|
+
console.warn(`[bitfab] ${message}`);
|
|
407
|
+
} catch {
|
|
408
|
+
}
|
|
409
|
+
}
|
|
404
410
|
function warnOnce(key, message) {
|
|
405
411
|
if (warned.has(key)) {
|
|
406
412
|
return;
|
|
407
413
|
}
|
|
408
414
|
warned.add(key);
|
|
409
|
-
|
|
410
|
-
console.warn(`[bitfab] ${message}`);
|
|
411
|
-
} catch {
|
|
412
|
-
}
|
|
415
|
+
warn(message);
|
|
413
416
|
}
|
|
414
417
|
var warned;
|
|
415
418
|
var init_warnOnce = __esm({
|
|
@@ -551,6 +554,9 @@ var init_serializePayload = __esm({
|
|
|
551
554
|
});
|
|
552
555
|
|
|
553
556
|
// src/traceMetadata.ts
|
|
557
|
+
function findRecord(traceId) {
|
|
558
|
+
return activeRecords.get(traceId) ?? completedRecords.get(traceId);
|
|
559
|
+
}
|
|
554
560
|
function recordCallerTraceMetadata(traceId, metadata) {
|
|
555
561
|
if (typeof traceId !== "string" || traceId === "") {
|
|
556
562
|
return;
|
|
@@ -561,15 +567,52 @@ function recordCallerTraceMetadata(traceId, metadata) {
|
|
|
561
567
|
if (Object.keys(metadata).length === 0) {
|
|
562
568
|
return;
|
|
563
569
|
}
|
|
564
|
-
|
|
570
|
+
const existing = findRecord(traceId);
|
|
571
|
+
if (existing) {
|
|
572
|
+
Object.assign(existing.caller, metadata);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
activeRecords.set(traceId, {
|
|
576
|
+
caller: { ...metadata },
|
|
577
|
+
derived: {},
|
|
578
|
+
warnedKeys: /* @__PURE__ */ new Set()
|
|
579
|
+
});
|
|
565
580
|
}
|
|
566
581
|
function callerTraceMetadata(traceId) {
|
|
567
|
-
const
|
|
568
|
-
|
|
582
|
+
const record = findRecord(traceId);
|
|
583
|
+
if (!record || Object.keys(record.caller).length === 0) {
|
|
584
|
+
return void 0;
|
|
585
|
+
}
|
|
586
|
+
return { ...record.caller };
|
|
569
587
|
}
|
|
570
|
-
function
|
|
571
|
-
|
|
572
|
-
|
|
588
|
+
function retireTraceMetadata(traceId) {
|
|
589
|
+
const record = activeRecords.get(traceId);
|
|
590
|
+
if (!record) {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
activeRecords.delete(traceId);
|
|
594
|
+
completedRecords.set(traceId, record);
|
|
595
|
+
while (completedRecords.size > RETAINED_COMPLETED_TRACES) {
|
|
596
|
+
const oldest = completedRecords.keys().next();
|
|
597
|
+
if (oldest.done) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
completedRecords.delete(oldest.value);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
function warnAboutShadowedKeys(traceId, record) {
|
|
604
|
+
const shadowed = Object.keys(record.derived).filter(
|
|
605
|
+
(key) => key in record.caller && record.caller[key] !== record.derived[key] && !record.warnedKeys.has(key)
|
|
606
|
+
).sort();
|
|
607
|
+
if (shadowed.length === 0) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
for (const key of shadowed) {
|
|
611
|
+
record.warnedKeys.add(key);
|
|
612
|
+
}
|
|
613
|
+
warn(
|
|
614
|
+
`trace metadata key(s) ${shadowed.join(", ")} on trace ${traceId} were set both by the caller and by an integration's own trace export; the caller's value is the one kept on the trace.`
|
|
615
|
+
);
|
|
573
616
|
}
|
|
574
617
|
function mergeCallerMetadataIntoTracePayload(payload) {
|
|
575
618
|
const externalTrace = payload.externalTrace;
|
|
@@ -581,35 +624,31 @@ function mergeCallerMetadataIntoTracePayload(payload) {
|
|
|
581
624
|
if (typeof traceId !== "string" || traceId === "") {
|
|
582
625
|
return payload;
|
|
583
626
|
}
|
|
584
|
-
const
|
|
585
|
-
if (!caller) {
|
|
627
|
+
const record = findRecord(traceId);
|
|
628
|
+
if (!record || Object.keys(record.caller).length === 0) {
|
|
586
629
|
return payload;
|
|
587
630
|
}
|
|
588
|
-
const derived = derivedMetadata.get(traceId) ?? {};
|
|
589
631
|
const exported = external.metadata;
|
|
590
632
|
if (typeof exported === "object" && exported !== null) {
|
|
591
|
-
Object.assign(derived, exported);
|
|
592
|
-
}
|
|
593
|
-
derivedMetadata.set(traceId, derived);
|
|
594
|
-
const shadowed = Object.keys(derived).filter((key) => key in caller && caller[key] !== derived[key]).sort();
|
|
595
|
-
if (shadowed.length > 0) {
|
|
596
|
-
warnOnce(
|
|
597
|
-
`trace-metadata-shadowed:${shadowed.join(",")}`,
|
|
598
|
-
`trace metadata key(s) ${shadowed.join(", ")} were set both by the caller and by an integration's own trace export; the caller's value is the one kept on the trace.`
|
|
599
|
-
);
|
|
633
|
+
Object.assign(record.derived, exported);
|
|
600
634
|
}
|
|
635
|
+
warnAboutShadowedKeys(traceId, record);
|
|
601
636
|
return {
|
|
602
637
|
...payload,
|
|
603
|
-
externalTrace: {
|
|
638
|
+
externalTrace: {
|
|
639
|
+
...external,
|
|
640
|
+
metadata: { ...record.derived, ...record.caller }
|
|
641
|
+
}
|
|
604
642
|
};
|
|
605
643
|
}
|
|
606
|
-
var
|
|
644
|
+
var RETAINED_COMPLETED_TRACES, activeRecords, completedRecords;
|
|
607
645
|
var init_traceMetadata = __esm({
|
|
608
646
|
"src/traceMetadata.ts"() {
|
|
609
647
|
"use strict";
|
|
610
648
|
init_warnOnce();
|
|
611
|
-
|
|
612
|
-
|
|
649
|
+
RETAINED_COMPLETED_TRACES = 128;
|
|
650
|
+
activeRecords = /* @__PURE__ */ new Map();
|
|
651
|
+
completedRecords = /* @__PURE__ */ new Map();
|
|
613
652
|
}
|
|
614
653
|
});
|
|
615
654
|
|
|
@@ -2092,6 +2131,18 @@ var init_http = __esm({
|
|
|
2092
2131
|
{ timeout: REPLAY_COMPLETE_REQUEST_TIMEOUT_MS }
|
|
2093
2132
|
);
|
|
2094
2133
|
}
|
|
2134
|
+
async getReseedSource(traceId) {
|
|
2135
|
+
return this.get(
|
|
2136
|
+
`/api/sdk/traces/${encodeURIComponent(traceId)}/reseedSource`
|
|
2137
|
+
);
|
|
2138
|
+
}
|
|
2139
|
+
async reseedTrace(traceId, runTraceId) {
|
|
2140
|
+
return this.request(
|
|
2141
|
+
`/api/sdk/traces/${encodeURIComponent(traceId)}/reseed`,
|
|
2142
|
+
{ runTraceId },
|
|
2143
|
+
{ timeout: 3e4 }
|
|
2144
|
+
);
|
|
2145
|
+
}
|
|
2095
2146
|
/**
|
|
2096
2147
|
* Ask the server to materialize a per-trace DB branch lease from a
|
|
2097
2148
|
* captured `dbSnapshotRef`. Blocking - the resolver creates a Neon
|
|
@@ -2536,6 +2587,7 @@ __export(replay_exports, {
|
|
|
2536
2587
|
BITFAB_PROGRESS_PREFIX: () => BITFAB_PROGRESS_PREFIX,
|
|
2537
2588
|
DbBranchReplayError: () => DbBranchReplayError,
|
|
2538
2589
|
ReplayError: () => ReplayError,
|
|
2590
|
+
deserializeInputs: () => deserializeInputs,
|
|
2539
2591
|
replay: () => replay,
|
|
2540
2592
|
reportReplayProgress: () => reportReplayProgress,
|
|
2541
2593
|
serializeReplayResult: () => serializeReplayResult,
|
|
@@ -3386,6 +3438,7 @@ __export(node_exports, {
|
|
|
3386
3438
|
getCurrentSpan: () => getCurrentSpan,
|
|
3387
3439
|
getCurrentTrace: () => getCurrentTrace,
|
|
3388
3440
|
reportReplayProgress: () => reportReplayProgress,
|
|
3441
|
+
reseedFromRegistry: () => reseedFromRegistry,
|
|
3389
3442
|
seedFromRegistry: () => seedFromRegistry,
|
|
3390
3443
|
serializeReplayResult: () => serializeReplayResult
|
|
3391
3444
|
});
|
|
@@ -5702,6 +5755,7 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
5702
5755
|
|
|
5703
5756
|
// src/client.ts
|
|
5704
5757
|
init_randomUuid();
|
|
5758
|
+
init_replay();
|
|
5705
5759
|
|
|
5706
5760
|
// src/replayBranch.ts
|
|
5707
5761
|
var _url, _context;
|
|
@@ -7481,7 +7535,7 @@ var Bitfab = class {
|
|
|
7481
7535
|
}
|
|
7482
7536
|
});
|
|
7483
7537
|
activeTraceStates.delete(traceId);
|
|
7484
|
-
|
|
7538
|
+
retireTraceMetadata(traceId);
|
|
7485
7539
|
}
|
|
7486
7540
|
} catch {
|
|
7487
7541
|
}
|
|
@@ -7674,7 +7728,7 @@ var Bitfab = class {
|
|
|
7674
7728
|
} catch (setupError) {
|
|
7675
7729
|
if (registeredTraceId) {
|
|
7676
7730
|
activeTraceStates.delete(registeredTraceId);
|
|
7677
|
-
|
|
7731
|
+
retireTraceMetadata(registeredTraceId);
|
|
7678
7732
|
}
|
|
7679
7733
|
if (setupError instanceof MixedTracingError) {
|
|
7680
7734
|
throw setupError;
|
|
@@ -8073,7 +8127,7 @@ var Bitfab = class {
|
|
|
8073
8127
|
});
|
|
8074
8128
|
} finally {
|
|
8075
8129
|
activeTraceStates.delete(traceId);
|
|
8076
|
-
|
|
8130
|
+
retireTraceMetadata(traceId);
|
|
8077
8131
|
}
|
|
8078
8132
|
return traceId;
|
|
8079
8133
|
}
|
|
@@ -8119,7 +8173,7 @@ var Bitfab = class {
|
|
|
8119
8173
|
await flushTraces2(3e4);
|
|
8120
8174
|
} finally {
|
|
8121
8175
|
unrecorded = activeTraceStates.delete(traceId);
|
|
8122
|
-
|
|
8176
|
+
retireTraceMetadata(traceId);
|
|
8123
8177
|
}
|
|
8124
8178
|
}
|
|
8125
8179
|
if (unrecorded) {
|
|
@@ -8129,6 +8183,36 @@ var Bitfab = class {
|
|
|
8129
8183
|
}
|
|
8130
8184
|
return traceId;
|
|
8131
8185
|
}
|
|
8186
|
+
async reseedTrace(traceFunctionKey, fn, options) {
|
|
8187
|
+
const source = await this.httpClient.getReseedSource(options.traceId);
|
|
8188
|
+
if (source.traceFunctionKey !== traceFunctionKey) {
|
|
8189
|
+
throw new BitfabError(
|
|
8190
|
+
`Trace ${options.traceId} belongs to '${source.traceFunctionKey}', not '${traceFunctionKey}'.`
|
|
8191
|
+
);
|
|
8192
|
+
}
|
|
8193
|
+
const args = deserializeInputs({
|
|
8194
|
+
input: source.input,
|
|
8195
|
+
input_meta: source.inputMeta
|
|
8196
|
+
});
|
|
8197
|
+
const runTraceId = await this.seedTraceByRunning(
|
|
8198
|
+
traceFunctionKey,
|
|
8199
|
+
fn,
|
|
8200
|
+
{
|
|
8201
|
+
args,
|
|
8202
|
+
metadata: source.metadata,
|
|
8203
|
+
...source.sessionId === null ? {} : { sessionId: source.sessionId },
|
|
8204
|
+
...source.name === null ? {} : { name: source.name }
|
|
8205
|
+
}
|
|
8206
|
+
);
|
|
8207
|
+
const adopted = await this.httpClient.reseedTrace(
|
|
8208
|
+
options.traceId,
|
|
8209
|
+
runTraceId
|
|
8210
|
+
);
|
|
8211
|
+
return {
|
|
8212
|
+
traceId: adopted.traceId,
|
|
8213
|
+
previousRunTraceId: adopted.previousRunTraceId
|
|
8214
|
+
};
|
|
8215
|
+
}
|
|
8132
8216
|
async replay(traceFunctionKey, fn, options) {
|
|
8133
8217
|
const wrappedKey = fn._bitfabTraceFunctionKey;
|
|
8134
8218
|
let replayFn = fn;
|
|
@@ -8390,6 +8474,24 @@ init_replay();
|
|
|
8390
8474
|
function defineReplayRegistry(registry) {
|
|
8391
8475
|
return registry;
|
|
8392
8476
|
}
|
|
8477
|
+
async function reseedFromRegistry(registry, pipeline, traceIds) {
|
|
8478
|
+
const registration = registry[pipeline];
|
|
8479
|
+
if (registration === void 0) {
|
|
8480
|
+
throw new BitfabError(
|
|
8481
|
+
`Unknown pipeline '${pipeline}'. Registered: ${Object.keys(registry).join(", ")}`
|
|
8482
|
+
);
|
|
8483
|
+
}
|
|
8484
|
+
const traceFunctionKey = resolveTraceFunctionKey(registration);
|
|
8485
|
+
const reseeded = [];
|
|
8486
|
+
for (const traceId of traceIds) {
|
|
8487
|
+
reseeded.push(
|
|
8488
|
+
await registration.client.reseedTrace(traceFunctionKey, registration.fn, {
|
|
8489
|
+
traceId
|
|
8490
|
+
})
|
|
8491
|
+
);
|
|
8492
|
+
}
|
|
8493
|
+
return { pipeline, traceFunctionKey, reseeded };
|
|
8494
|
+
}
|
|
8393
8495
|
async function seedFromRegistry(registry, pipeline, cases, options = {}) {
|
|
8394
8496
|
const registration = registry[pipeline];
|
|
8395
8497
|
if (registration === void 0) {
|
|
@@ -8470,6 +8572,7 @@ assertAsyncStorageRegistered();
|
|
|
8470
8572
|
getCurrentSpan,
|
|
8471
8573
|
getCurrentTrace,
|
|
8472
8574
|
reportReplayProgress,
|
|
8575
|
+
reseedFromRegistry,
|
|
8473
8576
|
seedFromRegistry,
|
|
8474
8577
|
serializeReplayResult
|
|
8475
8578
|
});
|