bitfab 0.33.2 → 0.33.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GT2GSQM2.js → chunk-HWQB73HK.js} +5 -3
- package/dist/chunk-HWQB73HK.js.map +1 -0
- package/dist/{chunk-A3WLV5VS.js → chunk-OMW6EFXC.js} +36 -4
- package/dist/chunk-OMW6EFXC.js.map +1 -0
- package/dist/index.cjs +37 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +2 -2
- package/dist/node.cjs +37 -3
- 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 +2 -2
- package/dist/{replay-V4GLDFSU.js → replay-4Y23OZYE.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-A3WLV5VS.js.map +0 -1
- package/dist/chunk-GT2GSQM2.js.map +0 -1
- /package/dist/{replay-V4GLDFSU.js.map → replay-4Y23OZYE.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -794,15 +794,20 @@ interface ReplayOptions {
|
|
|
794
794
|
/**
|
|
795
795
|
* Description of the code change being tested in this replay. Stored on
|
|
796
796
|
* the resulting experiment so the change can be reviewed alongside results.
|
|
797
|
+
* Supplying a description without `codeChangeFiles` preserves this text
|
|
798
|
+
* while the SDK automatically captures the files.
|
|
799
|
+
* Pass `null` when the replay should have no description; use
|
|
800
|
+
* `codeChangeFiles: null` to suppress automatic file capture.
|
|
797
801
|
*/
|
|
798
|
-
codeChangeDescription?: string;
|
|
802
|
+
codeChangeDescription?: string | null;
|
|
799
803
|
/**
|
|
800
804
|
* Files edited as part of this code change. Each entry holds the file path
|
|
801
805
|
* and the full `before`/`after` contents. The agent reads each file before
|
|
802
806
|
* and after editing and passes the two strings. Use `""` for newly created
|
|
803
|
-
* files (`before`) or deleted files (`after`).
|
|
807
|
+
* files (`before`) or deleted files (`after`). Omit this field to capture
|
|
808
|
+
* automatically, or pass `null` to suppress file capture for this replay.
|
|
804
809
|
*/
|
|
805
|
-
codeChangeFiles?: CodeChangeFile[];
|
|
810
|
+
codeChangeFiles?: CodeChangeFile[] | null;
|
|
806
811
|
/**
|
|
807
812
|
* Mock strategy for child spans during replay.
|
|
808
813
|
* - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked (default)
|
|
@@ -1414,6 +1419,12 @@ interface BitfabConfig {
|
|
|
1414
1419
|
* - custom: Application-specific tracing (default)
|
|
1415
1420
|
*/
|
|
1416
1421
|
type SpanType = "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
|
|
1422
|
+
/**
|
|
1423
|
+
* Controls when a span is captured.
|
|
1424
|
+
* - always: Capture the span even when it becomes the root of a new trace.
|
|
1425
|
+
* - nested: Capture the span only when another Bitfab span is already active.
|
|
1426
|
+
*/
|
|
1427
|
+
type CaptureWhen = "always" | "nested";
|
|
1417
1428
|
/**
|
|
1418
1429
|
* Options for configuring span behavior.
|
|
1419
1430
|
*/
|
|
@@ -1427,6 +1438,14 @@ interface SpanOptions {
|
|
|
1427
1438
|
* The type of span. Defaults to "custom" if not specified.
|
|
1428
1439
|
*/
|
|
1429
1440
|
type?: SpanType;
|
|
1441
|
+
/**
|
|
1442
|
+
* Controls whether this span may start a new trace. Defaults to "always".
|
|
1443
|
+
*
|
|
1444
|
+
* Use "nested" for reusable helpers that should appear inside an existing
|
|
1445
|
+
* trace but should run untraced when called on their own.
|
|
1446
|
+
* Unknown values warn once and default to "always".
|
|
1447
|
+
*/
|
|
1448
|
+
captureWhen?: CaptureWhen;
|
|
1430
1449
|
/**
|
|
1431
1450
|
* When true, replay will reuse this span's historical output instead of
|
|
1432
1451
|
* executing the wrapped function. Read by the "marked" replay strategy;
|
|
@@ -1963,7 +1982,7 @@ declare class BitfabFunction {
|
|
|
1963
1982
|
/**
|
|
1964
1983
|
* SDK version from package.json (injected at build time)
|
|
1965
1984
|
*/
|
|
1966
|
-
declare const __version__ = "0.33.
|
|
1985
|
+
declare const __version__ = "0.33.4";
|
|
1967
1986
|
|
|
1968
1987
|
/**
|
|
1969
1988
|
* Constants for the Bitfab SDK.
|
|
@@ -2031,4 +2050,4 @@ declare const finalizers: {
|
|
|
2031
2050
|
readableStream: typeof readableStream;
|
|
2032
2051
|
};
|
|
2033
2052
|
|
|
2034
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbBranchOptions, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, ReplayBranch, type ReplayItem, type ReplayOptions, type ReplayProgress, type ReplayResult, SUPPORTED_PROVIDERS, type SpanLookup, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress };
|
|
2053
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbBranchOptions, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, ReplayBranch, type ReplayItem, type ReplayOptions, type ReplayProgress, type ReplayResult, SUPPORTED_PROVIDERS, type SpanLookup, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress };
|
package/dist/index.d.ts
CHANGED
|
@@ -794,15 +794,20 @@ interface ReplayOptions {
|
|
|
794
794
|
/**
|
|
795
795
|
* Description of the code change being tested in this replay. Stored on
|
|
796
796
|
* the resulting experiment so the change can be reviewed alongside results.
|
|
797
|
+
* Supplying a description without `codeChangeFiles` preserves this text
|
|
798
|
+
* while the SDK automatically captures the files.
|
|
799
|
+
* Pass `null` when the replay should have no description; use
|
|
800
|
+
* `codeChangeFiles: null` to suppress automatic file capture.
|
|
797
801
|
*/
|
|
798
|
-
codeChangeDescription?: string;
|
|
802
|
+
codeChangeDescription?: string | null;
|
|
799
803
|
/**
|
|
800
804
|
* Files edited as part of this code change. Each entry holds the file path
|
|
801
805
|
* and the full `before`/`after` contents. The agent reads each file before
|
|
802
806
|
* and after editing and passes the two strings. Use `""` for newly created
|
|
803
|
-
* files (`before`) or deleted files (`after`).
|
|
807
|
+
* files (`before`) or deleted files (`after`). Omit this field to capture
|
|
808
|
+
* automatically, or pass `null` to suppress file capture for this replay.
|
|
804
809
|
*/
|
|
805
|
-
codeChangeFiles?: CodeChangeFile[];
|
|
810
|
+
codeChangeFiles?: CodeChangeFile[] | null;
|
|
806
811
|
/**
|
|
807
812
|
* Mock strategy for child spans during replay.
|
|
808
813
|
* - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked (default)
|
|
@@ -1414,6 +1419,12 @@ interface BitfabConfig {
|
|
|
1414
1419
|
* - custom: Application-specific tracing (default)
|
|
1415
1420
|
*/
|
|
1416
1421
|
type SpanType = "llm" | "agent" | "function" | "guardrail" | "handoff" | "custom";
|
|
1422
|
+
/**
|
|
1423
|
+
* Controls when a span is captured.
|
|
1424
|
+
* - always: Capture the span even when it becomes the root of a new trace.
|
|
1425
|
+
* - nested: Capture the span only when another Bitfab span is already active.
|
|
1426
|
+
*/
|
|
1427
|
+
type CaptureWhen = "always" | "nested";
|
|
1417
1428
|
/**
|
|
1418
1429
|
* Options for configuring span behavior.
|
|
1419
1430
|
*/
|
|
@@ -1427,6 +1438,14 @@ interface SpanOptions {
|
|
|
1427
1438
|
* The type of span. Defaults to "custom" if not specified.
|
|
1428
1439
|
*/
|
|
1429
1440
|
type?: SpanType;
|
|
1441
|
+
/**
|
|
1442
|
+
* Controls whether this span may start a new trace. Defaults to "always".
|
|
1443
|
+
*
|
|
1444
|
+
* Use "nested" for reusable helpers that should appear inside an existing
|
|
1445
|
+
* trace but should run untraced when called on their own.
|
|
1446
|
+
* Unknown values warn once and default to "always".
|
|
1447
|
+
*/
|
|
1448
|
+
captureWhen?: CaptureWhen;
|
|
1430
1449
|
/**
|
|
1431
1450
|
* When true, replay will reuse this span's historical output instead of
|
|
1432
1451
|
* executing the wrapped function. Read by the "marked" replay strategy;
|
|
@@ -1963,7 +1982,7 @@ declare class BitfabFunction {
|
|
|
1963
1982
|
/**
|
|
1964
1983
|
* SDK version from package.json (injected at build time)
|
|
1965
1984
|
*/
|
|
1966
|
-
declare const __version__ = "0.33.
|
|
1985
|
+
declare const __version__ = "0.33.4";
|
|
1967
1986
|
|
|
1968
1987
|
/**
|
|
1969
1988
|
* Constants for the Bitfab SDK.
|
|
@@ -2031,4 +2050,4 @@ declare const finalizers: {
|
|
|
2031
2050
|
readableStream: typeof readableStream;
|
|
2032
2051
|
};
|
|
2033
2052
|
|
|
2034
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbBranchOptions, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, ReplayBranch, type ReplayItem, type ReplayOptions, type ReplayProgress, type ReplayResult, SUPPORTED_PROVIDERS, type SpanLookup, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress };
|
|
2053
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AllowedEnvVars, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type DbBranchOptions, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, ReplayBranch, type ReplayItem, type ReplayOptions, type ReplayProgress, type ReplayResult, SUPPORTED_PROVIDERS, type SpanLookup, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceResponse, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress };
|
package/dist/index.js
CHANGED
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
getCurrentReplayBranch,
|
|
24
24
|
getCurrentSpan,
|
|
25
25
|
getCurrentTrace
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OMW6EFXC.js";
|
|
27
27
|
import {
|
|
28
28
|
BITFAB_PROGRESS_PREFIX,
|
|
29
29
|
BitfabError,
|
|
30
30
|
reportReplayProgress
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-HWQB73HK.js";
|
|
32
32
|
export {
|
|
33
33
|
BITFAB_PROGRESS_PREFIX,
|
|
34
34
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -806,11 +806,13 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
806
806
|
await replayContextReady;
|
|
807
807
|
let codeChangeDescription = options?.codeChangeDescription;
|
|
808
808
|
let codeChangeFiles = options?.codeChangeFiles;
|
|
809
|
-
if (
|
|
809
|
+
if (codeChangeFiles === void 0) {
|
|
810
810
|
const captured = await resolveAutoCodeChange(options?.name);
|
|
811
811
|
if (captured) {
|
|
812
|
-
codeChangeDescription = captured.description;
|
|
813
812
|
codeChangeFiles = captured.files;
|
|
813
|
+
if (codeChangeDescription === void 0) {
|
|
814
|
+
codeChangeDescription = captured.description;
|
|
815
|
+
}
|
|
814
816
|
}
|
|
815
817
|
}
|
|
816
818
|
const {
|
|
@@ -1026,7 +1028,7 @@ registerAsyncLocalStorageClass(
|
|
|
1026
1028
|
);
|
|
1027
1029
|
|
|
1028
1030
|
// src/version.generated.ts
|
|
1029
|
-
var __version__ = "0.33.
|
|
1031
|
+
var __version__ = "0.33.4";
|
|
1030
1032
|
|
|
1031
1033
|
// src/constants.ts
|
|
1032
1034
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -4325,6 +4327,38 @@ var Bitfab = class {
|
|
|
4325
4327
|
() => wrappedFn.apply(this, args)
|
|
4326
4328
|
);
|
|
4327
4329
|
}
|
|
4330
|
+
const captureWhen = options.captureWhen === void 0 ? "always" : options.captureWhen;
|
|
4331
|
+
const resolvedCaptureWhen = captureWhen === "always" || captureWhen === "nested" ? captureWhen : "always";
|
|
4332
|
+
if (resolvedCaptureWhen !== captureWhen) {
|
|
4333
|
+
let invalidValue;
|
|
4334
|
+
try {
|
|
4335
|
+
invalidValue = String(captureWhen);
|
|
4336
|
+
} catch {
|
|
4337
|
+
invalidValue = "<unprintable>";
|
|
4338
|
+
}
|
|
4339
|
+
warnOnce(
|
|
4340
|
+
`invalid-capture-when:${traceFunctionKey}`,
|
|
4341
|
+
`unknown captureWhen value "${invalidValue}"; defaulting to "always". Valid values: "always", "nested".`
|
|
4342
|
+
);
|
|
4343
|
+
}
|
|
4344
|
+
if (resolvedCaptureWhen === "nested") {
|
|
4345
|
+
let hasParent = false;
|
|
4346
|
+
try {
|
|
4347
|
+
hasParent = getSpanStack().length > 0;
|
|
4348
|
+
} catch (setupError) {
|
|
4349
|
+
if (getReplayContext()) {
|
|
4350
|
+
throw setupError;
|
|
4351
|
+
}
|
|
4352
|
+
warnOnce(
|
|
4353
|
+
`withSpan-setup:${traceFunctionKey}`,
|
|
4354
|
+
`tracing setup failed for "${traceFunctionKey}"; running it untraced. The function still runs and returns normally; no span is recorded.`
|
|
4355
|
+
);
|
|
4356
|
+
return fn.apply(this, args);
|
|
4357
|
+
}
|
|
4358
|
+
if (!hasParent) {
|
|
4359
|
+
return fn.apply(this, args);
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4328
4362
|
let newStack;
|
|
4329
4363
|
let executeWithContext;
|
|
4330
4364
|
let registeredTraceId;
|