bitfab 0.61.3 → 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 (32) hide show
  1. package/dist/{chunk-6IMUONDN.js → chunk-54EGXUZ3.js} +27 -2
  2. package/dist/chunk-54EGXUZ3.js.map +1 -0
  3. package/dist/{chunk-IZUZ5NBB.js → chunk-PSAEQ4OW.js} +176 -10
  4. package/dist/chunk-PSAEQ4OW.js.map +1 -0
  5. package/dist/{chunk-HVEZHLVQ.js → chunk-VWRCLZCA.js} +26 -2
  6. package/dist/{chunk-HVEZHLVQ.js.map → chunk-VWRCLZCA.js.map} +1 -1
  7. package/dist/{chunk-WOHIAKZF.js → chunk-WPYBJGTG.js} +21 -3
  8. package/dist/chunk-WPYBJGTG.js.map +1 -0
  9. package/dist/{chunk-PAUXHTNF.js → chunk-XGRQMQ2R.js} +6 -6
  10. package/dist/{chunk-PAUXHTNF.js.map → chunk-XGRQMQ2R.js.map} +1 -1
  11. package/dist/{http-BYICBOWP.js → http-C2TCBBQV.js} +2 -2
  12. package/dist/{http-3IYU5Z54.js → http-ONLJPP6W.js} +2 -2
  13. package/dist/index.cjs +214 -9
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +13 -2
  16. package/dist/index.d.ts +13 -2
  17. package/dist/index.js +3 -3
  18. package/dist/node.cjs +214 -9
  19. package/dist/node.cjs.map +1 -1
  20. package/dist/node.d.cts +1 -1
  21. package/dist/node.d.ts +1 -1
  22. package/dist/node.js +3 -3
  23. package/dist/{replay-SXHX5BBU.js → replay-RM24QKEA.js} +3 -3
  24. package/dist/replayCli.js +2 -2
  25. package/dist/seedCli.js +2 -2
  26. package/package.json +1 -1
  27. package/dist/chunk-6IMUONDN.js.map +0 -1
  28. package/dist/chunk-IZUZ5NBB.js.map +0 -1
  29. package/dist/chunk-WOHIAKZF.js.map +0 -1
  30. /package/dist/{http-3IYU5Z54.js.map → http-C2TCBBQV.js.map} +0 -0
  31. /package/dist/{http-BYICBOWP.js.map → http-ONLJPP6W.js.map} +0 -0
  32. /package/dist/{replay-SXHX5BBU.js.map → replay-RM24QKEA.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -733,6 +733,8 @@ declare class HttpClient {
733
733
  * Blocking call.
734
734
  */
735
735
  completeReplay(experimentId: string): Promise<CompleteReplayResponse>;
736
+ interruptReplay(experimentId: string): Promise<boolean>;
737
+ heartbeatReplay(experimentId: string): Promise<void>;
736
738
  getReseedSource(traceId: string): Promise<ReseedSourceResponse>;
737
739
  reseedTrace(traceId: string, runTraceId: string): Promise<ReseedTraceResponse>;
738
740
  /**
@@ -1951,6 +1953,14 @@ declare class OrganizationMembersClient {
1951
1953
  list(): Promise<OrganizationMember[]>;
1952
1954
  }
1953
1955
 
1956
+ type ReplayInterruptSignal = "SIGINT" | "SIGTERM";
1957
+ interface ReplayInterrupt {
1958
+ experimentId: string;
1959
+ experimentUrl: string;
1960
+ signal: ReplayInterruptSignal;
1961
+ markedInterrupted: boolean;
1962
+ }
1963
+
1954
1964
  /**
1955
1965
  * Replay historical traces through a function and create an experiment.
1956
1966
  *
@@ -2174,6 +2184,7 @@ interface ReplayOptions {
2174
2184
  * callback never crashes the run.
2175
2185
  */
2176
2186
  onExperimentStart?: (experiment: ReplayExperiment) => void;
2187
+ onInterrupt?: (interrupt: ReplayInterrupt) => void;
2177
2188
  resume?: string;
2178
2189
  force?: boolean;
2179
2190
  }
@@ -3862,7 +3873,7 @@ interface CommitRef {
3862
3873
  /**
3863
3874
  * SDK version from package.json (injected at build time)
3864
3875
  */
3865
- declare const __version__ = "0.61.3";
3876
+ declare const __version__ = "0.61.4";
3866
3877
 
3867
3878
  /**
3868
3879
  * Constants for the Bitfab SDK.
@@ -4001,4 +4012,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
4001
4012
  run?: boolean;
4002
4013
  }): Promise<SeedResult>;
4003
4014
 
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 };
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
@@ -733,6 +733,8 @@ declare class HttpClient {
733
733
  * Blocking call.
734
734
  */
735
735
  completeReplay(experimentId: string): Promise<CompleteReplayResponse>;
736
+ interruptReplay(experimentId: string): Promise<boolean>;
737
+ heartbeatReplay(experimentId: string): Promise<void>;
736
738
  getReseedSource(traceId: string): Promise<ReseedSourceResponse>;
737
739
  reseedTrace(traceId: string, runTraceId: string): Promise<ReseedTraceResponse>;
738
740
  /**
@@ -1951,6 +1953,14 @@ declare class OrganizationMembersClient {
1951
1953
  list(): Promise<OrganizationMember[]>;
1952
1954
  }
1953
1955
 
1956
+ type ReplayInterruptSignal = "SIGINT" | "SIGTERM";
1957
+ interface ReplayInterrupt {
1958
+ experimentId: string;
1959
+ experimentUrl: string;
1960
+ signal: ReplayInterruptSignal;
1961
+ markedInterrupted: boolean;
1962
+ }
1963
+
1954
1964
  /**
1955
1965
  * Replay historical traces through a function and create an experiment.
1956
1966
  *
@@ -2174,6 +2184,7 @@ interface ReplayOptions {
2174
2184
  * callback never crashes the run.
2175
2185
  */
2176
2186
  onExperimentStart?: (experiment: ReplayExperiment) => void;
2187
+ onInterrupt?: (interrupt: ReplayInterrupt) => void;
2177
2188
  resume?: string;
2178
2189
  force?: boolean;
2179
2190
  }
@@ -3862,7 +3873,7 @@ interface CommitRef {
3862
3873
  /**
3863
3874
  * SDK version from package.json (injected at build time)
3864
3875
  */
3865
- declare const __version__ = "0.61.3";
3876
+ declare const __version__ = "0.61.4";
3866
3877
 
3867
3878
  /**
3868
3879
  * Constants for the Bitfab SDK.
@@ -4001,4 +4012,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
4001
4012
  run?: boolean;
4002
4013
  }): Promise<SeedResult>;
4003
4014
 
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 };
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,7 +35,7 @@ import {
35
35
  getCurrentTrace,
36
36
  reseedFromRegistry,
37
37
  seedFromRegistry
38
- } from "./chunk-PAUXHTNF.js";
38
+ } from "./chunk-XGRQMQ2R.js";
39
39
  import "./chunk-K4XCWQBC.js";
40
40
  import {
41
41
  BITFAB_PROGRESS_PREFIX,
@@ -44,7 +44,7 @@ import {
44
44
  ReplayError,
45
45
  reportReplayProgress,
46
46
  serializeReplayResult
47
- } from "./chunk-IZUZ5NBB.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-6IMUONDN.js";
55
+ } from "./chunk-54EGXUZ3.js";
56
56
  import "./chunk-BAOIRE5T.js";
57
57
  export {
58
58
  AssertionCategoriesClient,
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.61.3";
100
+ __version__ = "0.61.4";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -2293,7 +2293,7 @@ function warnDroppedExternalTrace(error) {
2293
2293
  function experimentIdWireFields(experimentId) {
2294
2294
  return { experimentId, testRunId: experimentId };
2295
2295
  }
2296
- var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS, REPLAY_COMPLETE_REQUEST_TIMEOUT_MS, OTLP_TRACES_ENDPOINT, RETRYABLE_STATUSES, EXIT_FLUSH_TIMEOUT_MS, DEFAULT_LIFECYCLE_TIMEOUT_MS2, pendingTracePromises, liveHttpClients, carrierSeq, HttpClient;
2296
+ var REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS, REPLAY_COMPLETE_REQUEST_TIMEOUT_MS, REPLAY_INTERRUPT_REQUEST_TIMEOUT_MS, REPLAY_HEARTBEAT_REQUEST_TIMEOUT_MS, OTLP_TRACES_ENDPOINT, RETRYABLE_STATUSES, EXIT_FLUSH_TIMEOUT_MS, DEFAULT_LIFECYCLE_TIMEOUT_MS2, pendingTracePromises, liveHttpClients, carrierSeq, HttpClient;
2297
2297
  var init_http = __esm({
2298
2298
  "src/http.ts"() {
2299
2299
  "use strict";
@@ -2312,6 +2312,8 @@ var init_http = __esm({
2312
2312
  init_warnOnce();
2313
2313
  REPLAY_DB_BRANCH_REQUEST_TIMEOUT_MS = 3e5;
2314
2314
  REPLAY_COMPLETE_REQUEST_TIMEOUT_MS = 12e4;
2315
+ REPLAY_INTERRUPT_REQUEST_TIMEOUT_MS = 5e3;
2316
+ REPLAY_HEARTBEAT_REQUEST_TIMEOUT_MS = 5e3;
2315
2317
  OTLP_TRACES_ENDPOINT = "/api/sdk/otel/v1/traces";
2316
2318
  RETRYABLE_STATUSES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
2317
2319
  EXIT_FLUSH_TIMEOUT_MS = 5e3;
@@ -3124,6 +3126,28 @@ var init_http = __esm({
3124
3126
  { timeout: REPLAY_COMPLETE_REQUEST_TIMEOUT_MS }
3125
3127
  );
3126
3128
  }
3129
+ async interruptReplay(experimentId) {
3130
+ try {
3131
+ await this.request(
3132
+ "/api/sdk/replay/interrupt",
3133
+ experimentIdWireFields(experimentId),
3134
+ { timeout: REPLAY_INTERRUPT_REQUEST_TIMEOUT_MS }
3135
+ );
3136
+ return true;
3137
+ } catch {
3138
+ return false;
3139
+ }
3140
+ }
3141
+ async heartbeatReplay(experimentId) {
3142
+ try {
3143
+ await this.request(
3144
+ "/api/sdk/replay/heartbeat",
3145
+ experimentIdWireFields(experimentId),
3146
+ { timeout: REPLAY_HEARTBEAT_REQUEST_TIMEOUT_MS }
3147
+ );
3148
+ } catch {
3149
+ }
3150
+ }
3127
3151
  async getReseedSource(traceId) {
3128
3152
  return this.get(
3129
3153
  `/api/sdk/traces/${encodeURIComponent(traceId)}/reseedSource`
@@ -3627,6 +3651,114 @@ var init_integrationFixture = __esm({
3627
3651
  }
3628
3652
  });
3629
3653
 
3654
+ // src/replayHeartbeat.ts
3655
+ function startReplayHeartbeat(send) {
3656
+ let stopped = false;
3657
+ let inFlight;
3658
+ const timer = setInterval(() => {
3659
+ if (stopped || inFlight !== void 0) {
3660
+ return;
3661
+ }
3662
+ inFlight = send().catch(() => void 0).finally(() => {
3663
+ inFlight = void 0;
3664
+ });
3665
+ }, REPLAY_HEARTBEAT_INTERVAL_MS);
3666
+ unrefTimer(timer);
3667
+ return {
3668
+ stop: async () => {
3669
+ stopped = true;
3670
+ clearInterval(timer);
3671
+ await inFlight;
3672
+ }
3673
+ };
3674
+ }
3675
+ var REPLAY_HEARTBEAT_INTERVAL_MS;
3676
+ var init_replayHeartbeat = __esm({
3677
+ "src/replayHeartbeat.ts"() {
3678
+ "use strict";
3679
+ init_unrefTimer();
3680
+ REPLAY_HEARTBEAT_INTERVAL_MS = 6e4;
3681
+ }
3682
+ });
3683
+
3684
+ // src/replayInterrupt.ts
3685
+ function signalCapableProcess() {
3686
+ if (typeof process === "undefined" || typeof process.on !== "function") {
3687
+ return void 0;
3688
+ }
3689
+ return process;
3690
+ }
3691
+ function describeReplayInterrupt(experimentId, markedInterrupted) {
3692
+ if (markedInterrupted) {
3693
+ return `[replay] Experiment ${experimentId} interrupted.`;
3694
+ }
3695
+ return `[replay] Experiment ${experimentId} stopped, but Bitfab could not mark it interrupted. It will be marked interrupted within 15 minutes. A resume in the next two minutes may be refused as still running.`;
3696
+ }
3697
+ function reportInterrupted(experimentId, markedInterrupted) {
3698
+ try {
3699
+ console.error(describeReplayInterrupt(experimentId, markedInterrupted));
3700
+ } catch {
3701
+ }
3702
+ }
3703
+ function installReplayInterruptHandlers(target) {
3704
+ const host = signalCapableProcess();
3705
+ if (host === void 0) {
3706
+ return { remove: () => {
3707
+ }, interrupted: () => false };
3708
+ }
3709
+ const handlers = /* @__PURE__ */ new Map();
3710
+ const removeHandlers = () => {
3711
+ for (const [signal, handler] of handlers) {
3712
+ host.removeListener(signal, handler);
3713
+ }
3714
+ handlers.clear();
3715
+ };
3716
+ let interrupting = false;
3717
+ const handleSignal = async (signal) => {
3718
+ const hostHandlesSignal = host.listenerCount(signal) > 1;
3719
+ const markedInterrupted = await target.interrupt();
3720
+ removeHandlers();
3721
+ if (target.onInterrupt !== void 0) {
3722
+ try {
3723
+ target.onInterrupt({
3724
+ experimentId: target.experimentId,
3725
+ experimentUrl: target.experimentUrl,
3726
+ signal,
3727
+ markedInterrupted
3728
+ });
3729
+ } catch {
3730
+ }
3731
+ return;
3732
+ }
3733
+ reportInterrupted(target.experimentId, markedInterrupted);
3734
+ if (!hostHandlesSignal) {
3735
+ host.kill(host.pid, signal);
3736
+ }
3737
+ };
3738
+ for (const signal of REPLAY_INTERRUPT_SIGNALS) {
3739
+ const handler = () => {
3740
+ if (interrupting) {
3741
+ return;
3742
+ }
3743
+ interrupting = true;
3744
+ void handleSignal(signal);
3745
+ };
3746
+ handlers.set(signal, handler);
3747
+ host.on(signal, handler);
3748
+ }
3749
+ return { remove: removeHandlers, interrupted: () => interrupting };
3750
+ }
3751
+ var REPLAY_INTERRUPT_SIGNALS;
3752
+ var init_replayInterrupt = __esm({
3753
+ "src/replayInterrupt.ts"() {
3754
+ "use strict";
3755
+ REPLAY_INTERRUPT_SIGNALS = [
3756
+ "SIGINT",
3757
+ "SIGTERM"
3758
+ ];
3759
+ }
3760
+ });
3761
+
3630
3762
  // src/selectiveReplay.ts
3631
3763
  function replayNodeKey(node) {
3632
3764
  return JSON.stringify([node.traceFunctionKey, node.spanName]);
@@ -4536,7 +4668,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4536
4668
  const includeDbBranchLease = dbBranchEnabled(options?.dbBranch) && options?.dryRun !== true;
4537
4669
  let session;
4538
4670
  if (options?.resume === void 0) {
4539
- const started2 = await httpClient.startReplay(
4671
+ const started = await httpClient.startReplay(
4540
4672
  traceFunctionKey,
4541
4673
  // limit is meaningless with explicit traceIds (the ID list determines
4542
4674
  // the count), so it's omitted from the request entirely.
@@ -4559,7 +4691,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4559
4691
  options?.judgeAssertions,
4560
4692
  options?.experimentalSelectiveReplay
4561
4693
  );
4562
- if (started2.items.length === 0) {
4694
+ if (started.items.length === 0) {
4563
4695
  try {
4564
4696
  console.warn(
4565
4697
  `Bitfab: no traces matched "${traceFunctionKey}", so this replay ran nothing. Capture a trace, or seed one with seedTrace, before replaying.`
@@ -4568,10 +4700,10 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4568
4700
  }
4569
4701
  }
4570
4702
  session = {
4571
- experimentId: started2.experimentId,
4572
- experimentUrl: started2.experimentUrl,
4703
+ experimentId: started.experimentId,
4704
+ experimentUrl: started.experimentUrl,
4573
4705
  attempts: requestedAttempts,
4574
- work: expandReplayWork(started2.items, requestedAttempts),
4706
+ work: expandReplayWork(started.items, requestedAttempts),
4575
4707
  finished: [],
4576
4708
  includeDbBranchLease,
4577
4709
  dbBranchSettings: resolveDbBranchSettings(options?.dbBranch)
@@ -4586,9 +4718,68 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4586
4718
  options.dbBranch
4587
4719
  );
4588
4720
  }
4589
- const { experimentId, experimentUrl, attempts } = session;
4721
+ const { experimentId } = session;
4722
+ const fullExperimentUrl = `${serviceUrl}${session.experimentUrl}`;
4723
+ const heartbeat = startReplayHeartbeat(
4724
+ () => httpClient.heartbeatReplay(experimentId)
4725
+ );
4726
+ const interruptReplay = async () => {
4727
+ await heartbeat.stop();
4728
+ return httpClient.interruptReplay(experimentId);
4729
+ };
4730
+ const interruptHandlers = installReplayInterruptHandlers({
4731
+ experimentId,
4732
+ experimentUrl: fullExperimentUrl,
4733
+ interrupt: interruptReplay,
4734
+ onInterrupt: options?.onInterrupt
4735
+ });
4736
+ let completeReturned = false;
4737
+ const markCompleteReturned = () => {
4738
+ completeReturned = true;
4739
+ void heartbeat.stop();
4740
+ };
4741
+ try {
4742
+ return await runReplaySession(
4743
+ httpClient,
4744
+ fn,
4745
+ session,
4746
+ fullExperimentUrl,
4747
+ maxConcurrency,
4748
+ interruptHandlers.remove,
4749
+ markCompleteReturned,
4750
+ interruptHandlers.interrupted,
4751
+ options,
4752
+ registeredOverrides
4753
+ );
4754
+ } catch (error) {
4755
+ if (!completeReturned && !interruptHandlers.interrupted()) {
4756
+ await interruptReplay();
4757
+ }
4758
+ throw error;
4759
+ } finally {
4760
+ interruptHandlers.remove();
4761
+ await heartbeat.stop();
4762
+ }
4763
+ }
4764
+ function throwIfInterrupted(interrupted, items, experimentId, experimentUrl) {
4765
+ if (!interrupted()) {
4766
+ return;
4767
+ }
4768
+ const cause = new BitfabError(
4769
+ `Experiment ${experimentId} was interrupted, so it was not completed or graded. Resume it by passing { resume: "${experimentId}" } to replay, or with bitfab-replay --resume ${experimentId}.`,
4770
+ experimentUrl
4771
+ );
4772
+ throw new ReplayError(
4773
+ cause.message,
4774
+ items,
4775
+ experimentId,
4776
+ experimentUrl,
4777
+ cause
4778
+ );
4779
+ }
4780
+ async function runReplaySession(httpClient, fn, session, fullExperimentUrl, maxConcurrency, stopInterruptingOnSignal, markCompleteReturned, interrupted, options, registeredOverrides) {
4781
+ const { experimentId, attempts } = session;
4590
4782
  const mockStrategy = options?.mock ?? "marked";
4591
- const fullExperimentUrl = `${serviceUrl}${experimentUrl}`;
4592
4783
  try {
4593
4784
  options?.onExperimentStart?.({
4594
4785
  experimentId,
@@ -4738,7 +4929,15 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4738
4929
  );
4739
4930
  const resultItems = [...carriedOverItems, ...ranItems];
4740
4931
  if (options?.dryRun === true) {
4932
+ throwIfInterrupted(
4933
+ interrupted,
4934
+ resultItems,
4935
+ experimentId,
4936
+ fullExperimentUrl
4937
+ );
4938
+ stopInterruptingOnSignal();
4741
4939
  await httpClient.completeReplay(experimentId).catch(() => void 0);
4940
+ markCompleteReturned();
4742
4941
  const dryResult = {
4743
4942
  items: resultItems,
4744
4943
  experimentId,
@@ -4763,12 +4962,15 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4763
4962
  ranItems[index].traceId = readBack;
4764
4963
  }
4765
4964
  }
4965
+ throwIfInterrupted(interrupted, resultItems, experimentId, fullExperimentUrl);
4966
+ stopInterruptingOnSignal();
4766
4967
  const completeResult = await preserveReplayFailure(
4767
4968
  () => httpClient.completeReplay(experimentId),
4768
4969
  resultItems,
4769
4970
  experimentId,
4770
4971
  fullExperimentUrl
4771
4972
  );
4973
+ markCompleteReturned();
4772
4974
  const serverTraceIds = completeResult.traceIds;
4773
4975
  const replayTokens = completeResult.tokens;
4774
4976
  if (serverTraceIds !== void 0) {
@@ -4872,6 +5074,8 @@ var init_replay = __esm({
4872
5074
  init_mockOverride();
4873
5075
  init_randomUuid();
4874
5076
  init_replayContext();
5077
+ init_replayHeartbeat();
5078
+ init_replayInterrupt();
4875
5079
  init_selectiveReplayRuntime();
4876
5080
  init_serialize();
4877
5081
  REPLAY_PERSISTENCE_TIMEOUT_MS = 3e4;
@@ -11655,6 +11859,7 @@ init_replay();
11655
11859
  // src/replayRegistry.ts
11656
11860
  init_errors();
11657
11861
  init_replay();
11862
+ init_replayInterrupt();
11658
11863
  function defineReplayRegistry(registry) {
11659
11864
  return registry;
11660
11865
  }