bitfab 0.61.1 → 0.61.3

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.
Files changed (42) hide show
  1. package/dist/autoTrace.cjs.map +1 -1
  2. package/dist/autoTrace.d.cts +1 -0
  3. package/dist/autoTrace.d.ts +1 -0
  4. package/dist/autoTrace.js +1 -1
  5. package/dist/{chunk-HKUHPLAM.js → chunk-6IMUONDN.js} +47 -3
  6. package/dist/chunk-6IMUONDN.js.map +1 -0
  7. package/dist/{chunk-I5J2FDKH.js → chunk-HVEZHLVQ.js} +46 -3
  8. package/dist/chunk-HVEZHLVQ.js.map +1 -0
  9. package/dist/{chunk-VKGLQL7V.js → chunk-IZUZ5NBB.js} +473 -51
  10. package/dist/chunk-IZUZ5NBB.js.map +1 -0
  11. package/dist/{chunk-BMJNDIVA.js → chunk-K4XCWQBC.js} +1 -1
  12. package/dist/chunk-K4XCWQBC.js.map +1 -0
  13. package/dist/{chunk-ENHRFXCR.js → chunk-PAUXHTNF.js} +38 -7
  14. package/dist/chunk-PAUXHTNF.js.map +1 -0
  15. package/dist/{chunk-S4WE6U2Y.js → chunk-WOHIAKZF.js} +122 -52
  16. package/dist/chunk-WOHIAKZF.js.map +1 -0
  17. package/dist/{http-5DA23DKC.js → http-3IYU5Z54.js} +2 -2
  18. package/dist/{http-NY6M2AK3.js → http-BYICBOWP.js} +2 -2
  19. package/dist/index.cjs +563 -52
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +146 -3
  22. package/dist/index.d.ts +146 -3
  23. package/dist/index.js +4 -4
  24. package/dist/node.cjs +563 -52
  25. package/dist/node.cjs.map +1 -1
  26. package/dist/node.d.cts +1 -1
  27. package/dist/node.d.ts +1 -1
  28. package/dist/node.js +4 -4
  29. package/dist/{replay-KVENJRCX.js → replay-SXHX5BBU.js} +3 -3
  30. package/dist/replayCli.js +4 -3
  31. package/dist/replayCli.js.map +1 -1
  32. package/dist/seedCli.js +2 -2
  33. package/package.json +1 -1
  34. package/dist/chunk-BMJNDIVA.js.map +0 -1
  35. package/dist/chunk-ENHRFXCR.js.map +0 -1
  36. package/dist/chunk-HKUHPLAM.js.map +0 -1
  37. package/dist/chunk-I5J2FDKH.js.map +0 -1
  38. package/dist/chunk-S4WE6U2Y.js.map +0 -1
  39. package/dist/chunk-VKGLQL7V.js.map +0 -1
  40. /package/dist/{http-5DA23DKC.js.map → http-3IYU5Z54.js.map} +0 -0
  41. /package/dist/{http-NY6M2AK3.js.map → http-BYICBOWP.js.map} +0 -0
  42. /package/dist/{replay-KVENJRCX.js.map → replay-SXHX5BBU.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -22,6 +22,64 @@ type ApprovalFields = {
22
22
  approvedAt: string | null;
23
23
  };
24
24
 
25
+ /** A node is identified by its workflow key and span name, never its display label. */
26
+ interface ReplayNodeIdentity {
27
+ traceFunctionKey: string;
28
+ spanName: string;
29
+ }
30
+ /** Experimental, explicit policy for the TypeScript selective replay prototype. */
31
+ interface SelectiveReplayOptions {
32
+ /** Subtrees that must execute: changed code and unchanged code with required effects. */
33
+ mustRun: ReplayNodeIdentity[];
34
+ }
35
+ interface SelectiveReplayNode extends ReplayNodeIdentity {
36
+ id: string;
37
+ parentId: string | null;
38
+ mustRun: boolean;
39
+ reusable: boolean;
40
+ reason: "root" | "must-run" | "ancestor" | "assertion" | "unresolved-must-run" | "eligible" | "not-reusable" | "missing-recording";
41
+ recording?: {
42
+ input: unknown[];
43
+ kwargs?: Record<string, unknown>;
44
+ output: unknown;
45
+ };
46
+ }
47
+ interface SelectiveReplayAssertion {
48
+ id: string;
49
+ target: null | {
50
+ kind: "output";
51
+ } | {
52
+ kind: "span";
53
+ name: string;
54
+ occurrence?: "first" | "last" | number;
55
+ };
56
+ }
57
+ interface SelectiveReplayPlan {
58
+ version: 4;
59
+ rootId: string;
60
+ options: SelectiveReplayOptions;
61
+ unresolvedMustRun: ReplayNodeIdentity[];
62
+ nodes: SelectiveReplayNode[];
63
+ assertions: SelectiveReplayAssertion[];
64
+ }
65
+ interface SelectiveReplayDecision extends ReplayNodeIdentity {
66
+ originalSpanId: string | null;
67
+ action: "run" | "mock" | "blocked";
68
+ reason: string;
69
+ }
70
+ /** Per-item execution evidence. A node not reached is not claimed as tested. */
71
+ interface SelectiveReplayReport {
72
+ decisions: SelectiveReplayDecision[];
73
+ mustRunNotReached: ReplayNodeIdentity[];
74
+ unresolvedMustRun: ReplayNodeIdentity[];
75
+ /** Assertion IDs loaded for planning; these are not verdicts. */
76
+ assertionIds: string[];
77
+ /** Assertion IDs whose span target was absent/out of range in the recording. */
78
+ unresolvedAssertions: string[];
79
+ /** Assertion IDs whose requested span occurrence was not reached in this replay. */
80
+ assertionTargetsNotReached: string[];
81
+ }
82
+
25
83
  declare class TraceCompletion {
26
84
  private readonly traces;
27
85
  private readonly closed;
@@ -193,6 +251,42 @@ interface MockOverride {
193
251
  /** Accepted shape for one mock override declaration. */
194
252
  type MockOverrideInput = MockOverride | MockOverrideResolver;
195
253
 
254
+ declare class SelectiveReplayRuntime {
255
+ private readonly plan;
256
+ private readonly options;
257
+ private readonly nodes;
258
+ private readonly children;
259
+ private readonly runtimeParents;
260
+ private readonly consumed;
261
+ private readonly required;
262
+ private readonly requiredScopes;
263
+ private readonly recordings;
264
+ private readonly reached;
265
+ private readonly decisions;
266
+ private readonly assertionNames;
267
+ private readonly assertionScopes;
268
+ private readonly observedNames;
269
+ private readonly unresolvedAssertions;
270
+ private readonly fullTraceForAssertions;
271
+ private failure?;
272
+ constructor(plan: SelectiveReplayPlan, options: SelectiveReplayOptions);
273
+ enter(params: ReplayNodeIdentity & {
274
+ spanId: string;
275
+ parentSpanId: string | null;
276
+ inputs: unknown[];
277
+ safetyMock: boolean;
278
+ canReuseOutput: boolean;
279
+ reuseAllowed: boolean;
280
+ }): {
281
+ mock: false;
282
+ } | {
283
+ mock: true;
284
+ output: unknown;
285
+ };
286
+ assertNoSafetyConflict(): void;
287
+ report(): SelectiveReplayReport;
288
+ }
289
+
196
290
  /**
197
291
  * Replay context propagation via AsyncLocalStorage.
198
292
  *
@@ -300,6 +394,7 @@ interface MockTree {
300
394
  }
301
395
  interface ReplayContext {
302
396
  experimentId: string;
397
+ selectiveReplay?: SelectiveReplayRuntime;
303
398
  traceId?: string;
304
399
  inputSourceSpanId?: string;
305
400
  /**
@@ -602,7 +697,8 @@ declare class HttpClient {
602
697
  * Start a replay session by fetching historical traces.
603
698
  * Blocking call - creates an experiment and returns lightweight item references.
604
699
  */
605
- startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean, judgeAssertions?: boolean): Promise<StartReplayResponse>;
700
+ startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean, judgeAssertions?: boolean, experimentalSelectiveReplay?: SelectiveReplayOptions): Promise<StartReplayResponse>;
701
+ resumeReplay(experimentId: string, traceFunctionKey: string, codeChangeFiles?: CodeChangeFile[] | null, force?: boolean): Promise<ResumeReplayResponse>;
606
702
  /**
607
703
  * Fetch an external span by ID.
608
704
  * Blocking GET request.
@@ -706,6 +802,7 @@ interface StartReplayResponse {
706
802
  experimentUrl: string;
707
803
  attempts?: number;
708
804
  items: Array<{
805
+ selectiveReplayPlan?: SelectiveReplayPlan;
709
806
  /** Bitfab trace ID of the original (historical) trace being replayed. */
710
807
  originalTraceId?: string;
711
808
  /** External span ID the recorded inputs were read from (the original root span). */
@@ -748,6 +845,28 @@ interface StartReplayResponse {
748
845
  originalMetadata?: Record<string, unknown>;
749
846
  }>;
750
847
  }
848
+ type StartReplayItem = StartReplayResponse["items"][number];
849
+ interface ResumeReplayWorkPair {
850
+ itemIndex: number;
851
+ attempt: number;
852
+ }
853
+ interface ResumeReplayFinishedItem {
854
+ originalTraceId: string;
855
+ attempt: number;
856
+ traceId: string;
857
+ hasError: boolean;
858
+ }
859
+ interface ResumeReplayResponse {
860
+ experimentId: string;
861
+ experimentUrl: string;
862
+ attempts: number;
863
+ items: StartReplayItem[];
864
+ work: ResumeReplayWorkPair[];
865
+ finished: ResumeReplayFinishedItem[];
866
+ skippedOriginalTraceIds: string[];
867
+ includeDbBranchLease: boolean;
868
+ dbBranchSettings: DbBranchSettings | null;
869
+ }
751
870
  interface ExternalSpanResponse {
752
871
  id: string;
753
872
  externalTraceId: string;
@@ -1874,6 +1993,15 @@ interface DbBranchOptions {
1874
1993
  warmupSql?: string;
1875
1994
  }
1876
1995
  interface ReplayOptions {
1996
+ /**
1997
+ * Experimental selective replay. Explicit required nodes
1998
+ * always execute; eligible output-only nodes reuse JSON recordings only
1999
+ * when runtime inputs match. Requires a compatible server, mock: "marked",
2000
+ * and no mock overrides or resume. Does not infer changes from codeChangeFiles.
2001
+ * The server reads active/inherited assertions and protects their scoped
2002
+ * execution evidence. Coverage in item.selectiveReplay is not a verdict.
2003
+ */
2004
+ experimentalSelectiveReplay?: SelectiveReplayOptions;
1877
2005
  /**
1878
2006
  * Maximum number of traces to replay (1-5,000, default 5). Ignored when
1879
2007
  * `traceIds` is passed (with a warning), or when `datasetId` / `datasetIds`
@@ -2046,6 +2174,8 @@ interface ReplayOptions {
2046
2174
  * callback never crashes the run.
2047
2175
  */
2048
2176
  onExperimentStart?: (experiment: ReplayExperiment) => void;
2177
+ resume?: string;
2178
+ force?: boolean;
2049
2179
  }
2050
2180
  /** The experiment a replay records into, passed to {@link ReplayOptions.onExperimentStart}. */
2051
2181
  interface ReplayExperiment {
@@ -2111,6 +2241,7 @@ interface ReplayItemFinishProgress {
2111
2241
  }
2112
2242
  /** See {@link ReplayItemFinishProgress.item}. Mirrors {@link ReplayItem}. */
2113
2243
  interface ReplayProgressItem {
2244
+ selectiveReplay?: SelectiveReplayReport;
2114
2245
  /** Trace ID of the new replay trace (null during the run; the server id arrives at completion). */
2115
2246
  traceId?: string | null;
2116
2247
  /** Bitfab trace ID of the original (historical) trace being replayed. */
@@ -2220,6 +2351,8 @@ interface AdaptContext {
2220
2351
  */
2221
2352
  type AdaptInputsFn = (inputs: unknown[], ctx: AdaptContext) => unknown[];
2222
2353
  interface ReplayItem<T> {
2354
+ /** Decisions and changed-code coverage for experimental selective replay. */
2355
+ selectiveReplay?: SelectiveReplayReport;
2223
2356
  /**
2224
2357
  * Server trace ID of the new replay trace this item produced. Written in by
2225
2358
  * `replay()` from the complete-replay response once the server has minted the
@@ -2304,6 +2437,7 @@ interface ReplayItem<T> {
2304
2437
  dbBranchTimings: DbBranchTimings | null;
2305
2438
  traceOutline: TraceOutline | null;
2306
2439
  originalTraceOutline: TraceOutline | null;
2440
+ carriedOver?: boolean;
2307
2441
  }
2308
2442
 
2309
2443
  interface ReplayResult<T> {
@@ -2908,6 +3042,15 @@ interface SpanOptions {
2908
3042
  * real child.
2909
3043
  */
2910
3044
  mockOnReplay?: boolean;
3045
+ /**
3046
+ * Experimental selective-replay eligibility, recorded with this span.
3047
+ * Attests that the whole subtree is output-only with JSON value semantics:
3048
+ * no hidden mutable reads, required effects, input mutations, or reliance
3049
+ * on object identity. Include implementation/dependency changes in replay's
3050
+ * mustRun. Both capture-time and current declarations must allow reuse.
3051
+ * Does not affect ordinary replay or replace mockOnReplay safety protection.
3052
+ */
3053
+ replayReusable?: boolean;
2911
3054
  /** Optional experiment ID included on the span and on the trace it starts. */
2912
3055
  experimentId?: string;
2913
3056
  /**
@@ -3719,7 +3862,7 @@ interface CommitRef {
3719
3862
  /**
3720
3863
  * SDK version from package.json (injected at build time)
3721
3864
  */
3722
- declare const __version__ = "0.61.1";
3865
+ declare const __version__ = "0.61.3";
3723
3866
 
3724
3867
  /**
3725
3868
  * Constants for the Bitfab SDK.
@@ -3858,4 +4001,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3858
4001
  run?: boolean;
3859
4002
  }): Promise<SeedResult>;
3860
4003
 
3861
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, type AssertionLabelEvidence, type AssertionVerdict, type Assignee, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 OrganizationMember, OrganizationMembersClient, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayExperiment, 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, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
4004
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, type AssertionLabelEvidence, type AssertionVerdict, type Assignee, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 OrganizationMember, OrganizationMembersClient, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayExperiment, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayNodeIdentity, 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, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SelectiveReplayDecision, type SelectiveReplayOptions, type SelectiveReplayReport, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,64 @@ type ApprovalFields = {
22
22
  approvedAt: string | null;
23
23
  };
24
24
 
25
+ /** A node is identified by its workflow key and span name, never its display label. */
26
+ interface ReplayNodeIdentity {
27
+ traceFunctionKey: string;
28
+ spanName: string;
29
+ }
30
+ /** Experimental, explicit policy for the TypeScript selective replay prototype. */
31
+ interface SelectiveReplayOptions {
32
+ /** Subtrees that must execute: changed code and unchanged code with required effects. */
33
+ mustRun: ReplayNodeIdentity[];
34
+ }
35
+ interface SelectiveReplayNode extends ReplayNodeIdentity {
36
+ id: string;
37
+ parentId: string | null;
38
+ mustRun: boolean;
39
+ reusable: boolean;
40
+ reason: "root" | "must-run" | "ancestor" | "assertion" | "unresolved-must-run" | "eligible" | "not-reusable" | "missing-recording";
41
+ recording?: {
42
+ input: unknown[];
43
+ kwargs?: Record<string, unknown>;
44
+ output: unknown;
45
+ };
46
+ }
47
+ interface SelectiveReplayAssertion {
48
+ id: string;
49
+ target: null | {
50
+ kind: "output";
51
+ } | {
52
+ kind: "span";
53
+ name: string;
54
+ occurrence?: "first" | "last" | number;
55
+ };
56
+ }
57
+ interface SelectiveReplayPlan {
58
+ version: 4;
59
+ rootId: string;
60
+ options: SelectiveReplayOptions;
61
+ unresolvedMustRun: ReplayNodeIdentity[];
62
+ nodes: SelectiveReplayNode[];
63
+ assertions: SelectiveReplayAssertion[];
64
+ }
65
+ interface SelectiveReplayDecision extends ReplayNodeIdentity {
66
+ originalSpanId: string | null;
67
+ action: "run" | "mock" | "blocked";
68
+ reason: string;
69
+ }
70
+ /** Per-item execution evidence. A node not reached is not claimed as tested. */
71
+ interface SelectiveReplayReport {
72
+ decisions: SelectiveReplayDecision[];
73
+ mustRunNotReached: ReplayNodeIdentity[];
74
+ unresolvedMustRun: ReplayNodeIdentity[];
75
+ /** Assertion IDs loaded for planning; these are not verdicts. */
76
+ assertionIds: string[];
77
+ /** Assertion IDs whose span target was absent/out of range in the recording. */
78
+ unresolvedAssertions: string[];
79
+ /** Assertion IDs whose requested span occurrence was not reached in this replay. */
80
+ assertionTargetsNotReached: string[];
81
+ }
82
+
25
83
  declare class TraceCompletion {
26
84
  private readonly traces;
27
85
  private readonly closed;
@@ -193,6 +251,42 @@ interface MockOverride {
193
251
  /** Accepted shape for one mock override declaration. */
194
252
  type MockOverrideInput = MockOverride | MockOverrideResolver;
195
253
 
254
+ declare class SelectiveReplayRuntime {
255
+ private readonly plan;
256
+ private readonly options;
257
+ private readonly nodes;
258
+ private readonly children;
259
+ private readonly runtimeParents;
260
+ private readonly consumed;
261
+ private readonly required;
262
+ private readonly requiredScopes;
263
+ private readonly recordings;
264
+ private readonly reached;
265
+ private readonly decisions;
266
+ private readonly assertionNames;
267
+ private readonly assertionScopes;
268
+ private readonly observedNames;
269
+ private readonly unresolvedAssertions;
270
+ private readonly fullTraceForAssertions;
271
+ private failure?;
272
+ constructor(plan: SelectiveReplayPlan, options: SelectiveReplayOptions);
273
+ enter(params: ReplayNodeIdentity & {
274
+ spanId: string;
275
+ parentSpanId: string | null;
276
+ inputs: unknown[];
277
+ safetyMock: boolean;
278
+ canReuseOutput: boolean;
279
+ reuseAllowed: boolean;
280
+ }): {
281
+ mock: false;
282
+ } | {
283
+ mock: true;
284
+ output: unknown;
285
+ };
286
+ assertNoSafetyConflict(): void;
287
+ report(): SelectiveReplayReport;
288
+ }
289
+
196
290
  /**
197
291
  * Replay context propagation via AsyncLocalStorage.
198
292
  *
@@ -300,6 +394,7 @@ interface MockTree {
300
394
  }
301
395
  interface ReplayContext {
302
396
  experimentId: string;
397
+ selectiveReplay?: SelectiveReplayRuntime;
303
398
  traceId?: string;
304
399
  inputSourceSpanId?: string;
305
400
  /**
@@ -602,7 +697,8 @@ declare class HttpClient {
602
697
  * Start a replay session by fetching historical traces.
603
698
  * Blocking call - creates an experiment and returns lightweight item references.
604
699
  */
605
- startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean, judgeAssertions?: boolean): Promise<StartReplayResponse>;
700
+ startReplay(traceFunctionKey: string, limit: number | undefined, traceIds?: string[], name?: string, codeChangeDescription?: string | null, codeChangeFiles?: CodeChangeFile[] | null, includeDbBranchLease?: boolean, experimentGroupId?: string, datasetIds?: string[], graderIds?: string[], dbBranchSettings?: DbBranchSettings, attempts?: number, includeOriginalMetadata?: boolean, onlyWithAssertions?: boolean, judgeAssertions?: boolean, experimentalSelectiveReplay?: SelectiveReplayOptions): Promise<StartReplayResponse>;
701
+ resumeReplay(experimentId: string, traceFunctionKey: string, codeChangeFiles?: CodeChangeFile[] | null, force?: boolean): Promise<ResumeReplayResponse>;
606
702
  /**
607
703
  * Fetch an external span by ID.
608
704
  * Blocking GET request.
@@ -706,6 +802,7 @@ interface StartReplayResponse {
706
802
  experimentUrl: string;
707
803
  attempts?: number;
708
804
  items: Array<{
805
+ selectiveReplayPlan?: SelectiveReplayPlan;
709
806
  /** Bitfab trace ID of the original (historical) trace being replayed. */
710
807
  originalTraceId?: string;
711
808
  /** External span ID the recorded inputs were read from (the original root span). */
@@ -748,6 +845,28 @@ interface StartReplayResponse {
748
845
  originalMetadata?: Record<string, unknown>;
749
846
  }>;
750
847
  }
848
+ type StartReplayItem = StartReplayResponse["items"][number];
849
+ interface ResumeReplayWorkPair {
850
+ itemIndex: number;
851
+ attempt: number;
852
+ }
853
+ interface ResumeReplayFinishedItem {
854
+ originalTraceId: string;
855
+ attempt: number;
856
+ traceId: string;
857
+ hasError: boolean;
858
+ }
859
+ interface ResumeReplayResponse {
860
+ experimentId: string;
861
+ experimentUrl: string;
862
+ attempts: number;
863
+ items: StartReplayItem[];
864
+ work: ResumeReplayWorkPair[];
865
+ finished: ResumeReplayFinishedItem[];
866
+ skippedOriginalTraceIds: string[];
867
+ includeDbBranchLease: boolean;
868
+ dbBranchSettings: DbBranchSettings | null;
869
+ }
751
870
  interface ExternalSpanResponse {
752
871
  id: string;
753
872
  externalTraceId: string;
@@ -1874,6 +1993,15 @@ interface DbBranchOptions {
1874
1993
  warmupSql?: string;
1875
1994
  }
1876
1995
  interface ReplayOptions {
1996
+ /**
1997
+ * Experimental selective replay. Explicit required nodes
1998
+ * always execute; eligible output-only nodes reuse JSON recordings only
1999
+ * when runtime inputs match. Requires a compatible server, mock: "marked",
2000
+ * and no mock overrides or resume. Does not infer changes from codeChangeFiles.
2001
+ * The server reads active/inherited assertions and protects their scoped
2002
+ * execution evidence. Coverage in item.selectiveReplay is not a verdict.
2003
+ */
2004
+ experimentalSelectiveReplay?: SelectiveReplayOptions;
1877
2005
  /**
1878
2006
  * Maximum number of traces to replay (1-5,000, default 5). Ignored when
1879
2007
  * `traceIds` is passed (with a warning), or when `datasetId` / `datasetIds`
@@ -2046,6 +2174,8 @@ interface ReplayOptions {
2046
2174
  * callback never crashes the run.
2047
2175
  */
2048
2176
  onExperimentStart?: (experiment: ReplayExperiment) => void;
2177
+ resume?: string;
2178
+ force?: boolean;
2049
2179
  }
2050
2180
  /** The experiment a replay records into, passed to {@link ReplayOptions.onExperimentStart}. */
2051
2181
  interface ReplayExperiment {
@@ -2111,6 +2241,7 @@ interface ReplayItemFinishProgress {
2111
2241
  }
2112
2242
  /** See {@link ReplayItemFinishProgress.item}. Mirrors {@link ReplayItem}. */
2113
2243
  interface ReplayProgressItem {
2244
+ selectiveReplay?: SelectiveReplayReport;
2114
2245
  /** Trace ID of the new replay trace (null during the run; the server id arrives at completion). */
2115
2246
  traceId?: string | null;
2116
2247
  /** Bitfab trace ID of the original (historical) trace being replayed. */
@@ -2220,6 +2351,8 @@ interface AdaptContext {
2220
2351
  */
2221
2352
  type AdaptInputsFn = (inputs: unknown[], ctx: AdaptContext) => unknown[];
2222
2353
  interface ReplayItem<T> {
2354
+ /** Decisions and changed-code coverage for experimental selective replay. */
2355
+ selectiveReplay?: SelectiveReplayReport;
2223
2356
  /**
2224
2357
  * Server trace ID of the new replay trace this item produced. Written in by
2225
2358
  * `replay()` from the complete-replay response once the server has minted the
@@ -2304,6 +2437,7 @@ interface ReplayItem<T> {
2304
2437
  dbBranchTimings: DbBranchTimings | null;
2305
2438
  traceOutline: TraceOutline | null;
2306
2439
  originalTraceOutline: TraceOutline | null;
2440
+ carriedOver?: boolean;
2307
2441
  }
2308
2442
 
2309
2443
  interface ReplayResult<T> {
@@ -2908,6 +3042,15 @@ interface SpanOptions {
2908
3042
  * real child.
2909
3043
  */
2910
3044
  mockOnReplay?: boolean;
3045
+ /**
3046
+ * Experimental selective-replay eligibility, recorded with this span.
3047
+ * Attests that the whole subtree is output-only with JSON value semantics:
3048
+ * no hidden mutable reads, required effects, input mutations, or reliance
3049
+ * on object identity. Include implementation/dependency changes in replay's
3050
+ * mustRun. Both capture-time and current declarations must allow reuse.
3051
+ * Does not affect ordinary replay or replace mockOnReplay safety protection.
3052
+ */
3053
+ replayReusable?: boolean;
2911
3054
  /** Optional experiment ID included on the span and on the trace it starts. */
2912
3055
  experimentId?: string;
2913
3056
  /**
@@ -3719,7 +3862,7 @@ interface CommitRef {
3719
3862
  /**
3720
3863
  * SDK version from package.json (injected at build time)
3721
3864
  */
3722
- declare const __version__ = "0.61.1";
3865
+ declare const __version__ = "0.61.3";
3723
3866
 
3724
3867
  /**
3725
3868
  * Constants for the Bitfab SDK.
@@ -3858,4 +4001,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3858
4001
  run?: boolean;
3859
4002
  }): Promise<SeedResult>;
3860
4003
 
3861
- export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, type AssertionLabelEvidence, type AssertionVerdict, type Assignee, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 OrganizationMember, OrganizationMembersClient, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayExperiment, 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, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
4004
+ export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ApprovalFields, type ApprovalState, type Approver, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionEvidenceParameter, type AssertionGeneration, AssertionGenerationError, type AssertionGenerationStatus, AssertionGenerationTimeoutError, type AssertionLabelEvidence, type AssertionVerdict, type Assignee, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabRivetIntegration, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GenerateAssertionsOptions, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, GraderRerunError, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GraderRerunTimeoutError, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelTarget, 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 OrganizationMember, OrganizationMembersClient, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayExperiment, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayNodeIdentity, 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, type RivetContextLike, type RivetEffectType, type RivetIntegrationOptions, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SelectiveReplayDecision, type SelectiveReplayOptions, type SelectiveReplayReport, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchFilters, type TraceSearchParams, type TraceSearchResult, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
package/dist/index.js CHANGED
@@ -35,8 +35,8 @@ import {
35
35
  getCurrentTrace,
36
36
  reseedFromRegistry,
37
37
  seedFromRegistry
38
- } from "./chunk-ENHRFXCR.js";
39
- import "./chunk-BMJNDIVA.js";
38
+ } from "./chunk-PAUXHTNF.js";
39
+ import "./chunk-K4XCWQBC.js";
40
40
  import {
41
41
  BITFAB_PROGRESS_PREFIX,
42
42
  DbBranchReplayError,
@@ -44,7 +44,7 @@ import {
44
44
  ReplayError,
45
45
  reportReplayProgress,
46
46
  serializeReplayResult
47
- } from "./chunk-VKGLQL7V.js";
47
+ } from "./chunk-IZUZ5NBB.js";
48
48
  import {
49
49
  BitfabError,
50
50
  DEFAULT_SERVICE_URL,
@@ -52,7 +52,7 @@ import {
52
52
  MixedTracingError,
53
53
  __version__,
54
54
  flushTraces
55
- } from "./chunk-HKUHPLAM.js";
55
+ } from "./chunk-6IMUONDN.js";
56
56
  import "./chunk-BAOIRE5T.js";
57
57
  export {
58
58
  AssertionCategoriesClient,