bitfab 0.61.2 → 0.61.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.
Files changed (41) 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-INA6W7OB.js → chunk-54EGXUZ3.js} +32 -3
  6. package/dist/chunk-54EGXUZ3.js.map +1 -0
  7. package/dist/{chunk-BMJNDIVA.js → chunk-K4XCWQBC.js} +1 -1
  8. package/dist/chunk-K4XCWQBC.js.map +1 -0
  9. package/dist/{chunk-A4UVO6BQ.js → chunk-PSAEQ4OW.js} +480 -15
  10. package/dist/chunk-PSAEQ4OW.js.map +1 -0
  11. package/dist/{chunk-ONZFMRRF.js → chunk-VWRCLZCA.js} +30 -3
  12. package/dist/chunk-VWRCLZCA.js.map +1 -0
  13. package/dist/{chunk-MTK6PZHA.js → chunk-WPYBJGTG.js} +21 -3
  14. package/dist/chunk-WPYBJGTG.js.map +1 -0
  15. package/dist/{chunk-LUOCT4HG.js → chunk-XGRQMQ2R.js} +38 -7
  16. package/dist/chunk-XGRQMQ2R.js.map +1 -0
  17. package/dist/{http-2R6MSRVA.js → http-C2TCBBQV.js} +2 -2
  18. package/dist/{http-KM6QWKAP.js → http-ONLJPP6W.js} +2 -2
  19. package/dist/index.cjs +568 -15
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +131 -3
  22. package/dist/index.d.ts +131 -3
  23. package/dist/index.js +4 -4
  24. package/dist/node.cjs +568 -15
  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-6UUBJBLK.js → replay-RM24QKEA.js} +3 -3
  30. package/dist/replayCli.js +2 -2
  31. package/dist/seedCli.js +2 -2
  32. package/package.json +1 -1
  33. package/dist/chunk-A4UVO6BQ.js.map +0 -1
  34. package/dist/chunk-BMJNDIVA.js.map +0 -1
  35. package/dist/chunk-INA6W7OB.js.map +0 -1
  36. package/dist/chunk-LUOCT4HG.js.map +0 -1
  37. package/dist/chunk-MTK6PZHA.js.map +0 -1
  38. package/dist/chunk-ONZFMRRF.js.map +0 -1
  39. /package/dist/{http-2R6MSRVA.js.map → http-C2TCBBQV.js.map} +0 -0
  40. /package/dist/{http-KM6QWKAP.js.map → http-ONLJPP6W.js.map} +0 -0
  41. /package/dist/{replay-6UUBJBLK.js.map → replay-RM24QKEA.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,7 @@ 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>;
606
701
  resumeReplay(experimentId: string, traceFunctionKey: string, codeChangeFiles?: CodeChangeFile[] | null, force?: boolean): Promise<ResumeReplayResponse>;
607
702
  /**
608
703
  * Fetch an external span by ID.
@@ -638,6 +733,8 @@ declare class HttpClient {
638
733
  * Blocking call.
639
734
  */
640
735
  completeReplay(experimentId: string): Promise<CompleteReplayResponse>;
736
+ interruptReplay(experimentId: string): Promise<boolean>;
737
+ heartbeatReplay(experimentId: string): Promise<void>;
641
738
  getReseedSource(traceId: string): Promise<ReseedSourceResponse>;
642
739
  reseedTrace(traceId: string, runTraceId: string): Promise<ReseedTraceResponse>;
643
740
  /**
@@ -707,6 +804,7 @@ interface StartReplayResponse {
707
804
  experimentUrl: string;
708
805
  attempts?: number;
709
806
  items: Array<{
807
+ selectiveReplayPlan?: SelectiveReplayPlan;
710
808
  /** Bitfab trace ID of the original (historical) trace being replayed. */
711
809
  originalTraceId?: string;
712
810
  /** External span ID the recorded inputs were read from (the original root span). */
@@ -1855,6 +1953,14 @@ declare class OrganizationMembersClient {
1855
1953
  list(): Promise<OrganizationMember[]>;
1856
1954
  }
1857
1955
 
1956
+ type ReplayInterruptSignal = "SIGINT" | "SIGTERM";
1957
+ interface ReplayInterrupt {
1958
+ experimentId: string;
1959
+ experimentUrl: string;
1960
+ signal: ReplayInterruptSignal;
1961
+ markedInterrupted: boolean;
1962
+ }
1963
+
1858
1964
  /**
1859
1965
  * Replay historical traces through a function and create an experiment.
1860
1966
  *
@@ -1897,6 +2003,15 @@ interface DbBranchOptions {
1897
2003
  warmupSql?: string;
1898
2004
  }
1899
2005
  interface ReplayOptions {
2006
+ /**
2007
+ * Experimental selective replay. Explicit required nodes
2008
+ * always execute; eligible output-only nodes reuse JSON recordings only
2009
+ * when runtime inputs match. Requires a compatible server, mock: "marked",
2010
+ * and no mock overrides or resume. Does not infer changes from codeChangeFiles.
2011
+ * The server reads active/inherited assertions and protects their scoped
2012
+ * execution evidence. Coverage in item.selectiveReplay is not a verdict.
2013
+ */
2014
+ experimentalSelectiveReplay?: SelectiveReplayOptions;
1900
2015
  /**
1901
2016
  * Maximum number of traces to replay (1-5,000, default 5). Ignored when
1902
2017
  * `traceIds` is passed (with a warning), or when `datasetId` / `datasetIds`
@@ -2069,6 +2184,7 @@ interface ReplayOptions {
2069
2184
  * callback never crashes the run.
2070
2185
  */
2071
2186
  onExperimentStart?: (experiment: ReplayExperiment) => void;
2187
+ onInterrupt?: (interrupt: ReplayInterrupt) => void;
2072
2188
  resume?: string;
2073
2189
  force?: boolean;
2074
2190
  }
@@ -2136,6 +2252,7 @@ interface ReplayItemFinishProgress {
2136
2252
  }
2137
2253
  /** See {@link ReplayItemFinishProgress.item}. Mirrors {@link ReplayItem}. */
2138
2254
  interface ReplayProgressItem {
2255
+ selectiveReplay?: SelectiveReplayReport;
2139
2256
  /** Trace ID of the new replay trace (null during the run; the server id arrives at completion). */
2140
2257
  traceId?: string | null;
2141
2258
  /** Bitfab trace ID of the original (historical) trace being replayed. */
@@ -2245,6 +2362,8 @@ interface AdaptContext {
2245
2362
  */
2246
2363
  type AdaptInputsFn = (inputs: unknown[], ctx: AdaptContext) => unknown[];
2247
2364
  interface ReplayItem<T> {
2365
+ /** Decisions and changed-code coverage for experimental selective replay. */
2366
+ selectiveReplay?: SelectiveReplayReport;
2248
2367
  /**
2249
2368
  * Server trace ID of the new replay trace this item produced. Written in by
2250
2369
  * `replay()` from the complete-replay response once the server has minted the
@@ -2934,6 +3053,15 @@ interface SpanOptions {
2934
3053
  * real child.
2935
3054
  */
2936
3055
  mockOnReplay?: boolean;
3056
+ /**
3057
+ * Experimental selective-replay eligibility, recorded with this span.
3058
+ * Attests that the whole subtree is output-only with JSON value semantics:
3059
+ * no hidden mutable reads, required effects, input mutations, or reliance
3060
+ * on object identity. Include implementation/dependency changes in replay's
3061
+ * mustRun. Both capture-time and current declarations must allow reuse.
3062
+ * Does not affect ordinary replay or replace mockOnReplay safety protection.
3063
+ */
3064
+ replayReusable?: boolean;
2937
3065
  /** Optional experiment ID included on the span and on the trace it starts. */
2938
3066
  experimentId?: string;
2939
3067
  /**
@@ -3745,7 +3873,7 @@ interface CommitRef {
3745
3873
  /**
3746
3874
  * SDK version from package.json (injected at build time)
3747
3875
  */
3748
- declare const __version__ = "0.61.2";
3876
+ declare const __version__ = "0.61.4";
3749
3877
 
3750
3878
  /**
3751
3879
  * Constants for the Bitfab SDK.
@@ -3884,4 +4012,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3884
4012
  run?: boolean;
3885
4013
  }): Promise<SeedResult>;
3886
4014
 
3887
- 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 };
4015
+ 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 ReplayInterrupt, type ReplayInterruptSignal, 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,7 @@ 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>;
606
701
  resumeReplay(experimentId: string, traceFunctionKey: string, codeChangeFiles?: CodeChangeFile[] | null, force?: boolean): Promise<ResumeReplayResponse>;
607
702
  /**
608
703
  * Fetch an external span by ID.
@@ -638,6 +733,8 @@ declare class HttpClient {
638
733
  * Blocking call.
639
734
  */
640
735
  completeReplay(experimentId: string): Promise<CompleteReplayResponse>;
736
+ interruptReplay(experimentId: string): Promise<boolean>;
737
+ heartbeatReplay(experimentId: string): Promise<void>;
641
738
  getReseedSource(traceId: string): Promise<ReseedSourceResponse>;
642
739
  reseedTrace(traceId: string, runTraceId: string): Promise<ReseedTraceResponse>;
643
740
  /**
@@ -707,6 +804,7 @@ interface StartReplayResponse {
707
804
  experimentUrl: string;
708
805
  attempts?: number;
709
806
  items: Array<{
807
+ selectiveReplayPlan?: SelectiveReplayPlan;
710
808
  /** Bitfab trace ID of the original (historical) trace being replayed. */
711
809
  originalTraceId?: string;
712
810
  /** External span ID the recorded inputs were read from (the original root span). */
@@ -1855,6 +1953,14 @@ declare class OrganizationMembersClient {
1855
1953
  list(): Promise<OrganizationMember[]>;
1856
1954
  }
1857
1955
 
1956
+ type ReplayInterruptSignal = "SIGINT" | "SIGTERM";
1957
+ interface ReplayInterrupt {
1958
+ experimentId: string;
1959
+ experimentUrl: string;
1960
+ signal: ReplayInterruptSignal;
1961
+ markedInterrupted: boolean;
1962
+ }
1963
+
1858
1964
  /**
1859
1965
  * Replay historical traces through a function and create an experiment.
1860
1966
  *
@@ -1897,6 +2003,15 @@ interface DbBranchOptions {
1897
2003
  warmupSql?: string;
1898
2004
  }
1899
2005
  interface ReplayOptions {
2006
+ /**
2007
+ * Experimental selective replay. Explicit required nodes
2008
+ * always execute; eligible output-only nodes reuse JSON recordings only
2009
+ * when runtime inputs match. Requires a compatible server, mock: "marked",
2010
+ * and no mock overrides or resume. Does not infer changes from codeChangeFiles.
2011
+ * The server reads active/inherited assertions and protects their scoped
2012
+ * execution evidence. Coverage in item.selectiveReplay is not a verdict.
2013
+ */
2014
+ experimentalSelectiveReplay?: SelectiveReplayOptions;
1900
2015
  /**
1901
2016
  * Maximum number of traces to replay (1-5,000, default 5). Ignored when
1902
2017
  * `traceIds` is passed (with a warning), or when `datasetId` / `datasetIds`
@@ -2069,6 +2184,7 @@ interface ReplayOptions {
2069
2184
  * callback never crashes the run.
2070
2185
  */
2071
2186
  onExperimentStart?: (experiment: ReplayExperiment) => void;
2187
+ onInterrupt?: (interrupt: ReplayInterrupt) => void;
2072
2188
  resume?: string;
2073
2189
  force?: boolean;
2074
2190
  }
@@ -2136,6 +2252,7 @@ interface ReplayItemFinishProgress {
2136
2252
  }
2137
2253
  /** See {@link ReplayItemFinishProgress.item}. Mirrors {@link ReplayItem}. */
2138
2254
  interface ReplayProgressItem {
2255
+ selectiveReplay?: SelectiveReplayReport;
2139
2256
  /** Trace ID of the new replay trace (null during the run; the server id arrives at completion). */
2140
2257
  traceId?: string | null;
2141
2258
  /** Bitfab trace ID of the original (historical) trace being replayed. */
@@ -2245,6 +2362,8 @@ interface AdaptContext {
2245
2362
  */
2246
2363
  type AdaptInputsFn = (inputs: unknown[], ctx: AdaptContext) => unknown[];
2247
2364
  interface ReplayItem<T> {
2365
+ /** Decisions and changed-code coverage for experimental selective replay. */
2366
+ selectiveReplay?: SelectiveReplayReport;
2248
2367
  /**
2249
2368
  * Server trace ID of the new replay trace this item produced. Written in by
2250
2369
  * `replay()` from the complete-replay response once the server has minted the
@@ -2934,6 +3053,15 @@ interface SpanOptions {
2934
3053
  * real child.
2935
3054
  */
2936
3055
  mockOnReplay?: boolean;
3056
+ /**
3057
+ * Experimental selective-replay eligibility, recorded with this span.
3058
+ * Attests that the whole subtree is output-only with JSON value semantics:
3059
+ * no hidden mutable reads, required effects, input mutations, or reliance
3060
+ * on object identity. Include implementation/dependency changes in replay's
3061
+ * mustRun. Both capture-time and current declarations must allow reuse.
3062
+ * Does not affect ordinary replay or replace mockOnReplay safety protection.
3063
+ */
3064
+ replayReusable?: boolean;
2937
3065
  /** Optional experiment ID included on the span and on the trace it starts. */
2938
3066
  experimentId?: string;
2939
3067
  /**
@@ -3745,7 +3873,7 @@ interface CommitRef {
3745
3873
  /**
3746
3874
  * SDK version from package.json (injected at build time)
3747
3875
  */
3748
- declare const __version__ = "0.61.2";
3876
+ declare const __version__ = "0.61.4";
3749
3877
 
3750
3878
  /**
3751
3879
  * Constants for the Bitfab SDK.
@@ -3884,4 +4012,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3884
4012
  run?: boolean;
3885
4013
  }): Promise<SeedResult>;
3886
4014
 
3887
- 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 };
4015
+ 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 ReplayInterrupt, type ReplayInterruptSignal, 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-LUOCT4HG.js";
39
- import "./chunk-BMJNDIVA.js";
38
+ } from "./chunk-XGRQMQ2R.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-A4UVO6BQ.js";
47
+ } from "./chunk-PSAEQ4OW.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-INA6W7OB.js";
55
+ } from "./chunk-54EGXUZ3.js";
56
56
  import "./chunk-BAOIRE5T.js";
57
57
  export {
58
58
  AssertionCategoriesClient,