@bitfab/sdk 0.54.12 → 0.54.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/autoTrace.cjs +0 -19
- package/dist/autoTrace.cjs.map +1 -1
- package/dist/autoTrace.d.cts +1 -3
- package/dist/autoTrace.d.ts +1 -3
- package/dist/autoTrace.js +1 -5
- package/dist/{chunk-I5NJU64I.js → chunk-DXBYY5RS.js} +22 -16
- package/dist/chunk-DXBYY5RS.js.map +1 -0
- package/dist/{chunk-GZI455WP.js → chunk-KMSJJOT6.js} +21 -15
- package/dist/chunk-KMSJJOT6.js.map +1 -0
- package/dist/{chunk-EGWJYCNT.js → chunk-RCHSYWKI.js} +2 -19
- package/dist/chunk-RCHSYWKI.js.map +1 -0
- package/dist/{chunk-Q3X54UPA.js → chunk-RMJAAI6S.js} +37 -7
- package/dist/chunk-RMJAAI6S.js.map +1 -0
- package/dist/{chunk-XTUINMAL.js → chunk-ROQKK6YZ.js} +9 -3
- package/dist/chunk-ROQKK6YZ.js.map +1 -0
- package/dist/{chunk-JEFU6FTD.js → chunk-V2TWHXTK.js} +33 -60
- package/dist/chunk-V2TWHXTK.js.map +1 -0
- package/dist/{http-X4YOOM54.js → http-PNENM32G.js} +2 -2
- package/dist/{http-FJVBYZES.js → http-X5LJ4GM6.js} +2 -2
- package/dist/index.cjs +54 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -14
- package/dist/index.d.ts +16 -14
- package/dist/index.js +4 -4
- package/dist/node.cjs +54 -83
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +4 -4
- package/dist/{replay-IA5VRWHD.js → replay-BRLNXOAL.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-EGWJYCNT.js.map +0 -1
- package/dist/chunk-GZI455WP.js.map +0 -1
- package/dist/chunk-I5NJU64I.js.map +0 -1
- package/dist/chunk-JEFU6FTD.js.map +0 -1
- package/dist/chunk-Q3X54UPA.js.map +0 -1
- package/dist/chunk-XTUINMAL.js.map +0 -1
- /package/dist/{http-FJVBYZES.js.map → http-PNENM32G.js.map} +0 -0
- /package/dist/{http-X4YOOM54.js.map → http-X5LJ4GM6.js.map} +0 -0
- /package/dist/{replay-IA5VRWHD.js.map → replay-BRLNXOAL.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -442,7 +442,7 @@ declare class HttpClient {
|
|
|
442
442
|
private closing;
|
|
443
443
|
externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
|
|
444
444
|
externalTraceTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
|
|
445
|
-
releaseHeldExternalSpans: ((timeoutMs: number) => Promise<void>) | undefined;
|
|
445
|
+
releaseHeldExternalSpans: ((timeoutMs: number) => Promise<boolean> | Promise<void>) | undefined;
|
|
446
446
|
stopSimulationPlan: (() => void) | undefined;
|
|
447
447
|
constructor(config: HttpClientConfig);
|
|
448
448
|
/**
|
|
@@ -557,7 +557,6 @@ declare class HttpClient {
|
|
|
557
557
|
* Blocks until complete - needed for function execution.
|
|
558
558
|
*/
|
|
559
559
|
lookupFunction<T>(name: string): Promise<T>;
|
|
560
|
-
getAutoTracePolicy<T>(traceFunctionKey: string, protocol: string): Promise<T>;
|
|
561
560
|
getSimulationPlan(): Promise<SimulationPlanResponse>;
|
|
562
561
|
getTraceSpan(traceId: string, lookup: SpanLookup): Promise<CapturedSpan | null>;
|
|
563
562
|
/**
|
|
@@ -1379,6 +1378,10 @@ declare class LabelsClient {
|
|
|
1379
1378
|
constructor(httpClient: HttpClient);
|
|
1380
1379
|
save(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
|
|
1381
1380
|
saveAll(updates: LabelUpdate[], testRunId?: string): Promise<LabelOutcome[]>;
|
|
1381
|
+
/** Withhold a verdict for a trace or replay attempt whose check did not run. */
|
|
1382
|
+
skip(target: LabelTarget, testRunId?: string): Promise<LabelOutcome>;
|
|
1383
|
+
/** Clear a previous verdict for a trace, replay attempt, or assertion. */
|
|
1384
|
+
archive(target: LabelTarget, testRunId?: string): Promise<LabelOutcome>;
|
|
1382
1385
|
saveHuman(update: HumanLabelUpdate): Promise<HumanLabelOutcome>;
|
|
1383
1386
|
saveHumanAll(updates: HumanLabelUpdate[]): Promise<HumanLabelOutcome[]>;
|
|
1384
1387
|
get(traceId: string): Promise<TraceLabels | null>;
|
|
@@ -1719,7 +1722,7 @@ interface ReplayOptions {
|
|
|
1719
1722
|
traceIds?: string[];
|
|
1720
1723
|
/** Optional display name for the resulting experiment/test run. */
|
|
1721
1724
|
name?: string;
|
|
1722
|
-
/**
|
|
1725
|
+
/** Positive integer limiting parallel items. Set to 1 for sequential. Default 10. */
|
|
1723
1726
|
maxConcurrency?: number;
|
|
1724
1727
|
/**
|
|
1725
1728
|
* Description of the code change being tested in this replay. Stored on
|
|
@@ -1940,6 +1943,7 @@ interface ReplayProgressItem {
|
|
|
1940
1943
|
originalDurationMs?: number | null;
|
|
1941
1944
|
originalTokens?: TokenUsage | null;
|
|
1942
1945
|
originalModel?: string | null;
|
|
1946
|
+
ingestionType?: TraceIngestionType;
|
|
1943
1947
|
/** Always null here: the replayed run's usage is only known at completion. */
|
|
1944
1948
|
tokens?: TokenUsage | null;
|
|
1945
1949
|
/** @deprecated renamed to `originalModel`. */
|
|
@@ -2904,7 +2908,6 @@ declare class Bitfab {
|
|
|
2904
2908
|
readonly graders: GradersClient;
|
|
2905
2909
|
private readonly bamlClient;
|
|
2906
2910
|
private readonly dbSnapshot;
|
|
2907
|
-
private readonly autoTracePolicyRefreshes;
|
|
2908
2911
|
private readonly simulationPlan;
|
|
2909
2912
|
/**
|
|
2910
2913
|
* Mock overrides registered via {@link Bitfab.registerMockOverride}, applied
|
|
@@ -2923,12 +2926,12 @@ declare class Bitfab {
|
|
|
2923
2926
|
*
|
|
2924
2927
|
* Build instrumentation turns repository functions called beneath this
|
|
2925
2928
|
* method into nested spans that capture inputs, outputs, and errors by
|
|
2926
|
-
* default.
|
|
2927
|
-
*
|
|
2929
|
+
* default. Source exclusions and sim-plan capture-off decisions are explicit
|
|
2930
|
+
* opt-outs from that default.
|
|
2928
2931
|
* Without a compatible build transform, this still records the decorated
|
|
2929
2932
|
* method as a normal rich root span but cannot discover child calls.
|
|
2930
2933
|
*
|
|
2931
|
-
* @param traceFunctionKey - Groups traces and their capture
|
|
2934
|
+
* @param traceFunctionKey - Groups traces and their capture controls.
|
|
2932
2935
|
* @param options - Root presentation, subtree bounds, and exclusions.
|
|
2933
2936
|
* @experimental Automatic child-call instrumentation is experimental.
|
|
2934
2937
|
*/
|
|
@@ -2939,11 +2942,11 @@ declare class Bitfab {
|
|
|
2939
2942
|
* This is the function-oriented equivalent of {@link Bitfab.trace}. Build
|
|
2940
2943
|
* instrumentation turns repository functions called beneath the wrapped
|
|
2941
2944
|
* function into nested spans that capture inputs, outputs, and errors by
|
|
2942
|
-
* default.
|
|
2943
|
-
*
|
|
2944
|
-
* normal rich root span and runs the function unchanged.
|
|
2945
|
+
* default. Source exclusions and sim-plan capture-off decisions are explicit
|
|
2946
|
+
* opt-outs from that default. Without a compatible transform, this still
|
|
2947
|
+
* records one normal rich root span and runs the function unchanged.
|
|
2945
2948
|
*
|
|
2946
|
-
* @param traceFunctionKey - Groups traces and their capture
|
|
2949
|
+
* @param traceFunctionKey - Groups traces and their capture controls.
|
|
2947
2950
|
* @param optionsOrFn - Options or the workflow entrypoint to wrap.
|
|
2948
2951
|
* @param maybeFn - Workflow entrypoint when options are provided.
|
|
2949
2952
|
* @experimental Automatic child-call instrumentation is experimental.
|
|
@@ -2982,7 +2985,6 @@ declare class Bitfab {
|
|
|
2982
2985
|
private createAutoTraceNode;
|
|
2983
2986
|
private createAutoTraceRoot;
|
|
2984
2987
|
private applySimulationPlan;
|
|
2985
|
-
private refreshAutoTraceCapturePolicy;
|
|
2986
2988
|
/**
|
|
2987
2989
|
* Flush and permanently close this client's tracing resources: its pending
|
|
2988
2990
|
* requests and the single span-transport worker shared by its decorators and
|
|
@@ -3604,7 +3606,7 @@ interface CommitRef {
|
|
|
3604
3606
|
/**
|
|
3605
3607
|
* SDK version from package.json (injected at build time)
|
|
3606
3608
|
*/
|
|
3607
|
-
declare const __version__ = "0.54.
|
|
3609
|
+
declare const __version__ = "0.54.14";
|
|
3608
3610
|
|
|
3609
3611
|
/**
|
|
3610
3612
|
* Constants for the Bitfab SDK.
|
|
@@ -3743,4 +3745,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3743
3745
|
run?: boolean;
|
|
3744
3746
|
}): Promise<SeedResult>;
|
|
3745
3747
|
|
|
3746
|
-
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 AssertionVerdict, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, 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 };
|
|
3748
|
+
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 AssertionVerdict, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, 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 ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -442,7 +442,7 @@ declare class HttpClient {
|
|
|
442
442
|
private closing;
|
|
443
443
|
externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
|
|
444
444
|
externalTraceTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
|
|
445
|
-
releaseHeldExternalSpans: ((timeoutMs: number) => Promise<void>) | undefined;
|
|
445
|
+
releaseHeldExternalSpans: ((timeoutMs: number) => Promise<boolean> | Promise<void>) | undefined;
|
|
446
446
|
stopSimulationPlan: (() => void) | undefined;
|
|
447
447
|
constructor(config: HttpClientConfig);
|
|
448
448
|
/**
|
|
@@ -557,7 +557,6 @@ declare class HttpClient {
|
|
|
557
557
|
* Blocks until complete - needed for function execution.
|
|
558
558
|
*/
|
|
559
559
|
lookupFunction<T>(name: string): Promise<T>;
|
|
560
|
-
getAutoTracePolicy<T>(traceFunctionKey: string, protocol: string): Promise<T>;
|
|
561
560
|
getSimulationPlan(): Promise<SimulationPlanResponse>;
|
|
562
561
|
getTraceSpan(traceId: string, lookup: SpanLookup): Promise<CapturedSpan | null>;
|
|
563
562
|
/**
|
|
@@ -1379,6 +1378,10 @@ declare class LabelsClient {
|
|
|
1379
1378
|
constructor(httpClient: HttpClient);
|
|
1380
1379
|
save(update: LabelUpdate, testRunId?: string): Promise<LabelOutcome>;
|
|
1381
1380
|
saveAll(updates: LabelUpdate[], testRunId?: string): Promise<LabelOutcome[]>;
|
|
1381
|
+
/** Withhold a verdict for a trace or replay attempt whose check did not run. */
|
|
1382
|
+
skip(target: LabelTarget, testRunId?: string): Promise<LabelOutcome>;
|
|
1383
|
+
/** Clear a previous verdict for a trace, replay attempt, or assertion. */
|
|
1384
|
+
archive(target: LabelTarget, testRunId?: string): Promise<LabelOutcome>;
|
|
1382
1385
|
saveHuman(update: HumanLabelUpdate): Promise<HumanLabelOutcome>;
|
|
1383
1386
|
saveHumanAll(updates: HumanLabelUpdate[]): Promise<HumanLabelOutcome[]>;
|
|
1384
1387
|
get(traceId: string): Promise<TraceLabels | null>;
|
|
@@ -1719,7 +1722,7 @@ interface ReplayOptions {
|
|
|
1719
1722
|
traceIds?: string[];
|
|
1720
1723
|
/** Optional display name for the resulting experiment/test run. */
|
|
1721
1724
|
name?: string;
|
|
1722
|
-
/**
|
|
1725
|
+
/** Positive integer limiting parallel items. Set to 1 for sequential. Default 10. */
|
|
1723
1726
|
maxConcurrency?: number;
|
|
1724
1727
|
/**
|
|
1725
1728
|
* Description of the code change being tested in this replay. Stored on
|
|
@@ -1940,6 +1943,7 @@ interface ReplayProgressItem {
|
|
|
1940
1943
|
originalDurationMs?: number | null;
|
|
1941
1944
|
originalTokens?: TokenUsage | null;
|
|
1942
1945
|
originalModel?: string | null;
|
|
1946
|
+
ingestionType?: TraceIngestionType;
|
|
1943
1947
|
/** Always null here: the replayed run's usage is only known at completion. */
|
|
1944
1948
|
tokens?: TokenUsage | null;
|
|
1945
1949
|
/** @deprecated renamed to `originalModel`. */
|
|
@@ -2904,7 +2908,6 @@ declare class Bitfab {
|
|
|
2904
2908
|
readonly graders: GradersClient;
|
|
2905
2909
|
private readonly bamlClient;
|
|
2906
2910
|
private readonly dbSnapshot;
|
|
2907
|
-
private readonly autoTracePolicyRefreshes;
|
|
2908
2911
|
private readonly simulationPlan;
|
|
2909
2912
|
/**
|
|
2910
2913
|
* Mock overrides registered via {@link Bitfab.registerMockOverride}, applied
|
|
@@ -2923,12 +2926,12 @@ declare class Bitfab {
|
|
|
2923
2926
|
*
|
|
2924
2927
|
* Build instrumentation turns repository functions called beneath this
|
|
2925
2928
|
* method into nested spans that capture inputs, outputs, and errors by
|
|
2926
|
-
* default.
|
|
2927
|
-
*
|
|
2929
|
+
* default. Source exclusions and sim-plan capture-off decisions are explicit
|
|
2930
|
+
* opt-outs from that default.
|
|
2928
2931
|
* Without a compatible build transform, this still records the decorated
|
|
2929
2932
|
* method as a normal rich root span but cannot discover child calls.
|
|
2930
2933
|
*
|
|
2931
|
-
* @param traceFunctionKey - Groups traces and their capture
|
|
2934
|
+
* @param traceFunctionKey - Groups traces and their capture controls.
|
|
2932
2935
|
* @param options - Root presentation, subtree bounds, and exclusions.
|
|
2933
2936
|
* @experimental Automatic child-call instrumentation is experimental.
|
|
2934
2937
|
*/
|
|
@@ -2939,11 +2942,11 @@ declare class Bitfab {
|
|
|
2939
2942
|
* This is the function-oriented equivalent of {@link Bitfab.trace}. Build
|
|
2940
2943
|
* instrumentation turns repository functions called beneath the wrapped
|
|
2941
2944
|
* function into nested spans that capture inputs, outputs, and errors by
|
|
2942
|
-
* default.
|
|
2943
|
-
*
|
|
2944
|
-
* normal rich root span and runs the function unchanged.
|
|
2945
|
+
* default. Source exclusions and sim-plan capture-off decisions are explicit
|
|
2946
|
+
* opt-outs from that default. Without a compatible transform, this still
|
|
2947
|
+
* records one normal rich root span and runs the function unchanged.
|
|
2945
2948
|
*
|
|
2946
|
-
* @param traceFunctionKey - Groups traces and their capture
|
|
2949
|
+
* @param traceFunctionKey - Groups traces and their capture controls.
|
|
2947
2950
|
* @param optionsOrFn - Options or the workflow entrypoint to wrap.
|
|
2948
2951
|
* @param maybeFn - Workflow entrypoint when options are provided.
|
|
2949
2952
|
* @experimental Automatic child-call instrumentation is experimental.
|
|
@@ -2982,7 +2985,6 @@ declare class Bitfab {
|
|
|
2982
2985
|
private createAutoTraceNode;
|
|
2983
2986
|
private createAutoTraceRoot;
|
|
2984
2987
|
private applySimulationPlan;
|
|
2985
|
-
private refreshAutoTraceCapturePolicy;
|
|
2986
2988
|
/**
|
|
2987
2989
|
* Flush and permanently close this client's tracing resources: its pending
|
|
2988
2990
|
* requests and the single span-transport worker shared by its decorators and
|
|
@@ -3604,7 +3606,7 @@ interface CommitRef {
|
|
|
3604
3606
|
/**
|
|
3605
3607
|
* SDK version from package.json (injected at build time)
|
|
3606
3608
|
*/
|
|
3607
|
-
declare const __version__ = "0.54.
|
|
3609
|
+
declare const __version__ = "0.54.14";
|
|
3608
3610
|
|
|
3609
3611
|
/**
|
|
3610
3612
|
* Constants for the Bitfab SDK.
|
|
@@ -3743,4 +3745,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3743
3745
|
run?: boolean;
|
|
3744
3746
|
}): Promise<SeedResult>;
|
|
3745
3747
|
|
|
3746
|
-
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 AssertionVerdict, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type Justification, type JustificationSpan, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, 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 };
|
|
3748
|
+
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 AssertionVerdict, 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 GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, 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 ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, 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 };
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
getCurrentTrace,
|
|
22
22
|
reseedFromRegistry,
|
|
23
23
|
seedFromRegistry
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-V2TWHXTK.js";
|
|
25
|
+
import "./chunk-RCHSYWKI.js";
|
|
26
26
|
import {
|
|
27
27
|
BITFAB_PROGRESS_PREFIX,
|
|
28
28
|
DbBranchReplayError,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
ReplayError,
|
|
31
31
|
reportReplayProgress,
|
|
32
32
|
serializeReplayResult
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ROQKK6YZ.js";
|
|
34
34
|
import {
|
|
35
35
|
BitfabError,
|
|
36
36
|
DEFAULT_SERVICE_URL,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
MixedTracingError,
|
|
39
39
|
__version__,
|
|
40
40
|
flushTraces
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-DXBYY5RS.js";
|
|
42
42
|
import "./chunk-VCRFFCLY.js";
|
|
43
43
|
export {
|
|
44
44
|
AssertionCategoriesClient,
|
package/dist/node.cjs
CHANGED
|
@@ -88,7 +88,7 @@ var __version__, __packageName__;
|
|
|
88
88
|
var init_version_generated = __esm({
|
|
89
89
|
"src/version.generated.ts"() {
|
|
90
90
|
"use strict";
|
|
91
|
-
__version__ = "0.54.
|
|
91
|
+
__version__ = "0.54.14";
|
|
92
92
|
__packageName__ = "@bitfab/sdk";
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -1263,6 +1263,7 @@ var init_simulationPlan = __esm({
|
|
|
1263
1263
|
}
|
|
1264
1264
|
this.warnNeverLoaded();
|
|
1265
1265
|
this.warnDropped();
|
|
1266
|
+
return this.held.length === 0;
|
|
1266
1267
|
}
|
|
1267
1268
|
waitForFirstLoad(timeoutMs) {
|
|
1268
1269
|
const firstLoad = this.firstLoad();
|
|
@@ -2085,9 +2086,14 @@ __export(http_exports, {
|
|
|
2085
2086
|
});
|
|
2086
2087
|
async function releaseHeldExternalSpans(timeoutMs) {
|
|
2087
2088
|
const deadline = Date.now() + Math.max(timeoutMs, 0);
|
|
2089
|
+
let released = true;
|
|
2088
2090
|
for (const client of [...liveHttpClients]) {
|
|
2089
|
-
await client.releaseHeldExternalSpans?.(
|
|
2091
|
+
const result = await client.releaseHeldExternalSpans?.(
|
|
2092
|
+
Math.max(0, deadline - Date.now())
|
|
2093
|
+
);
|
|
2094
|
+
released = result !== false && released;
|
|
2090
2095
|
}
|
|
2096
|
+
return released;
|
|
2091
2097
|
}
|
|
2092
2098
|
function stopSimulationPlans() {
|
|
2093
2099
|
for (const client of [...liveHttpClients]) {
|
|
@@ -2104,14 +2110,15 @@ function awaitOnExit(promise) {
|
|
|
2104
2110
|
}
|
|
2105
2111
|
async function flushTraces(timeoutMs = 5e3) {
|
|
2106
2112
|
const deadline = Date.now() + Math.max(timeoutMs, 0);
|
|
2107
|
-
await releaseHeldExternalSpans(planWaitSliceMs(timeoutMs));
|
|
2113
|
+
const released = await releaseHeldExternalSpans(planWaitSliceMs(timeoutMs));
|
|
2108
2114
|
const requestsFlushed = await awaitPendingRequests(
|
|
2109
2115
|
Math.max(0, deadline - Date.now())
|
|
2110
2116
|
);
|
|
2117
|
+
const releasedAfterDeferred = await releaseHeldExternalSpans(0);
|
|
2111
2118
|
const transportsFlushed = await flushTraceTransports(
|
|
2112
2119
|
Math.max(0, deadline - Date.now())
|
|
2113
2120
|
);
|
|
2114
|
-
return requestsFlushed && transportsFlushed;
|
|
2121
|
+
return released && releasedAfterDeferred && requestsFlushed && transportsFlushed;
|
|
2115
2122
|
}
|
|
2116
2123
|
async function awaitPendingRequests(timeoutMs = DEFAULT_LIFECYCLE_TIMEOUT_MS2) {
|
|
2117
2124
|
await replayContextReady.catch(() => {
|
|
@@ -2521,13 +2528,17 @@ var init_http = __esm({
|
|
|
2521
2528
|
*/
|
|
2522
2529
|
async settleDeferredWork(timeoutMs = DEFAULT_LIFECYCLE_TIMEOUT_MS2) {
|
|
2523
2530
|
const deadline = Date.now() + Math.max(timeoutMs, 0);
|
|
2524
|
-
await this.releaseHeldExternalSpans?.(
|
|
2531
|
+
const released = await this.releaseHeldExternalSpans?.(
|
|
2532
|
+
planWaitSliceMs(timeoutMs)
|
|
2533
|
+
);
|
|
2525
2534
|
await replayContextReady.catch(() => {
|
|
2526
2535
|
});
|
|
2527
|
-
|
|
2536
|
+
const settled2 = await waitForPromises(
|
|
2528
2537
|
Array.from(this.deferredWork),
|
|
2529
2538
|
Math.max(0, deadline - Date.now())
|
|
2530
2539
|
);
|
|
2540
|
+
const releasedAfterDeferred = await this.releaseHeldExternalSpans?.(0);
|
|
2541
|
+
return released !== false && releasedAfterDeferred !== false && settled2;
|
|
2531
2542
|
}
|
|
2532
2543
|
/**
|
|
2533
2544
|
* Wait for spans queued by this client to be delivered, within one deadline.
|
|
@@ -2552,7 +2563,9 @@ var init_http = __esm({
|
|
|
2552
2563
|
}
|
|
2553
2564
|
const deadline = Date.now() + Math.max(timeoutMs, 0);
|
|
2554
2565
|
this.closing = (async () => {
|
|
2555
|
-
await this.releaseHeldExternalSpans?.(
|
|
2566
|
+
const released = await this.releaseHeldExternalSpans?.(
|
|
2567
|
+
planWaitSliceMs(timeoutMs)
|
|
2568
|
+
);
|
|
2556
2569
|
this.stopSimulationPlan?.();
|
|
2557
2570
|
this.externalSpanTransform = void 0;
|
|
2558
2571
|
this.externalTraceTransform = void 0;
|
|
@@ -2566,7 +2579,7 @@ var init_http = __esm({
|
|
|
2566
2579
|
const transport = this.traceTransport;
|
|
2567
2580
|
this.traceTransport = void 0;
|
|
2568
2581
|
const shutdownOk = await transport?.shutdown(Math.max(0, deadline - Date.now())) ?? true;
|
|
2569
|
-
return settled2 && shutdownOk;
|
|
2582
|
+
return released !== false && settled2 && shutdownOk;
|
|
2570
2583
|
})();
|
|
2571
2584
|
return this.closing;
|
|
2572
2585
|
}
|
|
@@ -2664,12 +2677,6 @@ var init_http = __esm({
|
|
|
2664
2677
|
async lookupFunction(name) {
|
|
2665
2678
|
return this.request("/api/sdk/functions/lookup", { name });
|
|
2666
2679
|
}
|
|
2667
|
-
async getAutoTracePolicy(traceFunctionKey, protocol) {
|
|
2668
|
-
return this.request("/api/sdk/auto-trace/policy", {
|
|
2669
|
-
traceFunctionKey,
|
|
2670
|
-
protocol
|
|
2671
|
-
});
|
|
2672
|
-
}
|
|
2673
2680
|
async getSimulationPlan() {
|
|
2674
2681
|
return this.get(
|
|
2675
2682
|
"/api/sdk/sim-plan",
|
|
@@ -4006,6 +4013,12 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
4006
4013
|
}
|
|
4007
4014
|
}
|
|
4008
4015
|
const attempts = resolveAttempts(options?.attempts);
|
|
4016
|
+
const maxConcurrency = options?.maxConcurrency ?? 10;
|
|
4017
|
+
if (!Number.isInteger(maxConcurrency) || maxConcurrency < 1) {
|
|
4018
|
+
throw new BitfabError(
|
|
4019
|
+
`maxConcurrency must be a positive integer (got ${maxConcurrency}).`
|
|
4020
|
+
);
|
|
4021
|
+
}
|
|
4009
4022
|
await replayContextReady;
|
|
4010
4023
|
let codeChangeDescription = options?.codeChangeDescription;
|
|
4011
4024
|
let codeChangeFiles = options?.codeChangeFiles;
|
|
@@ -4052,7 +4065,6 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
4052
4065
|
}
|
|
4053
4066
|
}
|
|
4054
4067
|
const mockStrategy = options?.mock ?? "marked";
|
|
4055
|
-
const maxConcurrency = options?.maxConcurrency ?? 10;
|
|
4056
4068
|
const fullTestRunUrl = `${serviceUrl}${testRunUrl}`;
|
|
4057
4069
|
const resolvedOverrides = [
|
|
4058
4070
|
...normalizeMockOverrides(options?.mockOverride),
|
|
@@ -4149,6 +4161,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
4149
4161
|
originalDurationMs: item.originalDurationMs,
|
|
4150
4162
|
originalTokens: item.originalTokens,
|
|
4151
4163
|
originalModel: item.originalModel,
|
|
4164
|
+
ingestionType: item.ingestionType,
|
|
4152
4165
|
tokens: item.tokens,
|
|
4153
4166
|
model: item.model,
|
|
4154
4167
|
dbSnapshotRef: item.dbSnapshotRef,
|
|
@@ -5200,21 +5213,6 @@ function currentAutoTraceScope() {
|
|
|
5200
5213
|
initializeAutoTraceStorage();
|
|
5201
5214
|
return autoTraceState.storage?.getStore() ?? autoTraceState.browserScope;
|
|
5202
5215
|
}
|
|
5203
|
-
function __setBitfabAutoTraceCapturePolicy(client, traceFunctionKey, functionIds) {
|
|
5204
|
-
const policies = autoTraceState.capturePolicies.get(client) ?? /* @__PURE__ */ new Map();
|
|
5205
|
-
if (functionIds === void 0) {
|
|
5206
|
-
policies.delete(traceFunctionKey);
|
|
5207
|
-
if (policies.size === 0) {
|
|
5208
|
-
autoTraceState.capturePolicies.delete(client);
|
|
5209
|
-
}
|
|
5210
|
-
return;
|
|
5211
|
-
}
|
|
5212
|
-
policies.set(traceFunctionKey, new Set(functionIds));
|
|
5213
|
-
autoTraceState.capturePolicies.set(client, policies);
|
|
5214
|
-
}
|
|
5215
|
-
function getAutoTraceCapturePolicy(client, traceFunctionKey) {
|
|
5216
|
-
return autoTraceState.capturePolicies.get(client)?.get(traceFunctionKey);
|
|
5217
|
-
}
|
|
5218
5216
|
|
|
5219
5217
|
// src/optionalPeer.ts
|
|
5220
5218
|
function importOptionalPeer(specifierParts) {
|
|
@@ -6004,6 +6002,14 @@ var LabelsClient = class {
|
|
|
6004
6002
|
);
|
|
6005
6003
|
return response.labels;
|
|
6006
6004
|
}
|
|
6005
|
+
/** Withhold a verdict for a trace or replay attempt whose check did not run. */
|
|
6006
|
+
async skip(target, testRunId) {
|
|
6007
|
+
return this.save({ ...target, skip: true }, testRunId);
|
|
6008
|
+
}
|
|
6009
|
+
/** Clear a previous verdict for a trace, replay attempt, or assertion. */
|
|
6010
|
+
async archive(target, testRunId) {
|
|
6011
|
+
return this.save({ ...target, archive: true }, testRunId);
|
|
6012
|
+
}
|
|
6007
6013
|
async saveHuman(update) {
|
|
6008
6014
|
const [outcome] = await this.saveHumanAll([update]);
|
|
6009
6015
|
return outcome;
|
|
@@ -6922,6 +6928,15 @@ var BitfabLangGraphIntegration = class {
|
|
|
6922
6928
|
// src/client.ts
|
|
6923
6929
|
init_mockOverride();
|
|
6924
6930
|
|
|
6931
|
+
// src/streamFinalizationError.ts
|
|
6932
|
+
var StreamFinalizationError = class extends Error {
|
|
6933
|
+
constructor(message, output) {
|
|
6934
|
+
super(message);
|
|
6935
|
+
this.output = output;
|
|
6936
|
+
this.name = "StreamFinalizationError";
|
|
6937
|
+
}
|
|
6938
|
+
};
|
|
6939
|
+
|
|
6925
6940
|
// src/openaiAgentSdk.ts
|
|
6926
6941
|
var BitfabOpenAIAgentHandler = class {
|
|
6927
6942
|
constructor(config) {
|
|
@@ -6961,7 +6976,11 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
6961
6976
|
if (isStreaming && res?.completed) {
|
|
6962
6977
|
try {
|
|
6963
6978
|
await res.completed;
|
|
6964
|
-
} catch {
|
|
6979
|
+
} catch (error) {
|
|
6980
|
+
throw new StreamFinalizationError(
|
|
6981
|
+
error instanceof Error ? error.message : String(error),
|
|
6982
|
+
res.finalOutput
|
|
6983
|
+
);
|
|
6965
6984
|
}
|
|
6966
6985
|
}
|
|
6967
6986
|
return res?.finalOutput;
|
|
@@ -7063,7 +7082,6 @@ function openAiAgentsParentSpanId(bitfabTraceId, enclosingSpanIds) {
|
|
|
7063
7082
|
}
|
|
7064
7083
|
|
|
7065
7084
|
// src/client.ts
|
|
7066
|
-
init_policyRefresh();
|
|
7067
7085
|
init_randomUuid();
|
|
7068
7086
|
init_replay();
|
|
7069
7087
|
|
|
@@ -7720,17 +7738,6 @@ function runWithSeedContext(ctx, fn) {
|
|
|
7720
7738
|
init_serialize();
|
|
7721
7739
|
init_simulationPlan();
|
|
7722
7740
|
init_spanOrigin();
|
|
7723
|
-
|
|
7724
|
-
// src/streamFinalizationError.ts
|
|
7725
|
-
var StreamFinalizationError = class extends Error {
|
|
7726
|
-
constructor(message, output) {
|
|
7727
|
-
super(message);
|
|
7728
|
-
this.output = output;
|
|
7729
|
-
this.name = "StreamFinalizationError";
|
|
7730
|
-
}
|
|
7731
|
-
};
|
|
7732
|
-
|
|
7733
|
-
// src/client.ts
|
|
7734
7741
|
init_traceMetadata();
|
|
7735
7742
|
|
|
7736
7743
|
// src/traces.ts
|
|
@@ -8647,8 +8654,6 @@ function readBooleanEnv(name) {
|
|
|
8647
8654
|
var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
|
|
8648
8655
|
var DEFAULT_AUTO_TRACE_MAX_SPANS = 500;
|
|
8649
8656
|
var AUTO_TRACE_PROTOCOL = "ts-auto-v1";
|
|
8650
|
-
var AUTO_TRACE_POLICY_REFRESH_MS = 6e4;
|
|
8651
|
-
var AUTO_TRACE_POLICY_RETRY_MS = 1e4;
|
|
8652
8657
|
function spanOwnerName(receiver) {
|
|
8653
8658
|
if (typeof receiver === "function") {
|
|
8654
8659
|
return receiver.name !== "" ? receiver.name : void 0;
|
|
@@ -8681,7 +8686,6 @@ var Bitfab = class {
|
|
|
8681
8686
|
constructor(config) {
|
|
8682
8687
|
/** Gate the empty-key warning to fire at most once. */
|
|
8683
8688
|
this.apiKeyWarned = false;
|
|
8684
|
-
this.autoTracePolicyRefreshes = /* @__PURE__ */ new Map();
|
|
8685
8689
|
/**
|
|
8686
8690
|
* Mock overrides registered via {@link Bitfab.registerMockOverride}, applied
|
|
8687
8691
|
* to every `replay` on this client (after any per-call `mockOverride`). In
|
|
@@ -8730,12 +8734,12 @@ var Bitfab = class {
|
|
|
8730
8734
|
*
|
|
8731
8735
|
* Build instrumentation turns repository functions called beneath this
|
|
8732
8736
|
* method into nested spans that capture inputs, outputs, and errors by
|
|
8733
|
-
* default.
|
|
8734
|
-
*
|
|
8737
|
+
* default. Source exclusions and sim-plan capture-off decisions are explicit
|
|
8738
|
+
* opt-outs from that default.
|
|
8735
8739
|
* Without a compatible build transform, this still records the decorated
|
|
8736
8740
|
* method as a normal rich root span but cannot discover child calls.
|
|
8737
8741
|
*
|
|
8738
|
-
* @param traceFunctionKey - Groups traces and their capture
|
|
8742
|
+
* @param traceFunctionKey - Groups traces and their capture controls.
|
|
8739
8743
|
* @param options - Root presentation, subtree bounds, and exclusions.
|
|
8740
8744
|
* @experimental Automatic child-call instrumentation is experimental.
|
|
8741
8745
|
*/
|
|
@@ -8893,11 +8897,6 @@ var Bitfab = class {
|
|
|
8893
8897
|
traceFunctionKey,
|
|
8894
8898
|
spanOptions,
|
|
8895
8899
|
function(...args) {
|
|
8896
|
-
const capturePolicy = getAutoTraceCapturePolicy(
|
|
8897
|
-
self,
|
|
8898
|
-
traceFunctionKey
|
|
8899
|
-
);
|
|
8900
|
-
self.refreshAutoTraceCapturePolicy(traceFunctionKey);
|
|
8901
8900
|
self.simulationPlan.refresh();
|
|
8902
8901
|
let spansUsed = 0;
|
|
8903
8902
|
let truncated = false;
|
|
@@ -8977,7 +8976,7 @@ var Bitfab = class {
|
|
|
8977
8976
|
surface: "opt-out",
|
|
8978
8977
|
instrumentation: "trace",
|
|
8979
8978
|
functionId: definition.id,
|
|
8980
|
-
captureContent:
|
|
8979
|
+
captureContent: true,
|
|
8981
8980
|
autoTraceDefinition: definition,
|
|
8982
8981
|
...nodeConfiguration?.testRunId !== void 0 && {
|
|
8983
8982
|
testRunId: nodeConfiguration.testRunId
|
|
@@ -9076,34 +9075,6 @@ var Bitfab = class {
|
|
|
9076
9075
|
applySimulationPlan(payload, submit) {
|
|
9077
9076
|
this.simulationPlan.send(payload, rootTraceFunctionKeyOf(payload), submit);
|
|
9078
9077
|
}
|
|
9079
|
-
refreshAutoTraceCapturePolicy(traceFunctionKey) {
|
|
9080
|
-
const state2 = this.autoTracePolicyRefreshes.get(traceFunctionKey) ?? new PolicyRefresh();
|
|
9081
|
-
this.autoTracePolicyRefreshes.set(traceFunctionKey, state2);
|
|
9082
|
-
state2.run(
|
|
9083
|
-
() => this.httpClient.getAutoTracePolicy(
|
|
9084
|
-
traceFunctionKey,
|
|
9085
|
-
AUTO_TRACE_PROTOCOL
|
|
9086
|
-
),
|
|
9087
|
-
(policy) => {
|
|
9088
|
-
if (policy.protocol !== AUTO_TRACE_PROTOCOL) {
|
|
9089
|
-
state2.hold(AUTO_TRACE_POLICY_RETRY_MS);
|
|
9090
|
-
return;
|
|
9091
|
-
}
|
|
9092
|
-
const functionIds = Array.isArray(policy.functionIds) ? policy.functionIds.filter(
|
|
9093
|
-
(id) => typeof id === "string" && id.startsWith(`${AUTO_TRACE_PROTOCOL}:`)
|
|
9094
|
-
).slice(0, DEFAULT_AUTO_TRACE_MAX_SPANS) : [];
|
|
9095
|
-
__setBitfabAutoTraceCapturePolicy(
|
|
9096
|
-
this,
|
|
9097
|
-
traceFunctionKey,
|
|
9098
|
-
policy.revision === null ? void 0 : functionIds
|
|
9099
|
-
);
|
|
9100
|
-
state2.hold(AUTO_TRACE_POLICY_REFRESH_MS);
|
|
9101
|
-
},
|
|
9102
|
-
() => {
|
|
9103
|
-
state2.hold(AUTO_TRACE_POLICY_RETRY_MS);
|
|
9104
|
-
}
|
|
9105
|
-
);
|
|
9106
|
-
}
|
|
9107
9078
|
/**
|
|
9108
9079
|
* Flush and permanently close this client's tracing resources: its pending
|
|
9109
9080
|
* requests and the single span-transport worker shared by its decorators and
|