@bitfab/sdk 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
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
getCurrentReplayBranch,
|
|
15
15
|
getCurrentSpan,
|
|
16
16
|
getCurrentTrace
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-OMW6EFXC.js";
|
|
18
18
|
import {
|
|
19
19
|
BITFAB_PROGRESS_PREFIX,
|
|
20
20
|
BitfabError,
|
|
21
21
|
reportReplayProgress
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-HWQB73HK.js";
|
|
23
23
|
export {
|
|
24
24
|
BITFAB_PROGRESS_PREFIX,
|
|
25
25
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -797,11 +797,13 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
797
797
|
await replayContextReady;
|
|
798
798
|
let codeChangeDescription = options?.codeChangeDescription;
|
|
799
799
|
let codeChangeFiles = options?.codeChangeFiles;
|
|
800
|
-
if (
|
|
800
|
+
if (codeChangeFiles === void 0) {
|
|
801
801
|
const captured = await resolveAutoCodeChange(options?.name);
|
|
802
802
|
if (captured) {
|
|
803
|
-
codeChangeDescription = captured.description;
|
|
804
803
|
codeChangeFiles = captured.files;
|
|
804
|
+
if (codeChangeDescription === void 0) {
|
|
805
|
+
codeChangeDescription = captured.description;
|
|
806
|
+
}
|
|
805
807
|
}
|
|
806
808
|
}
|
|
807
809
|
const {
|
|
@@ -1017,7 +1019,7 @@ registerAsyncLocalStorageClass(
|
|
|
1017
1019
|
);
|
|
1018
1020
|
|
|
1019
1021
|
// src/version.generated.ts
|
|
1020
|
-
var __version__ = "0.33.
|
|
1022
|
+
var __version__ = "0.33.4";
|
|
1021
1023
|
|
|
1022
1024
|
// src/constants.ts
|
|
1023
1025
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -4316,6 +4318,38 @@ var Bitfab = class {
|
|
|
4316
4318
|
() => wrappedFn.apply(this, args)
|
|
4317
4319
|
);
|
|
4318
4320
|
}
|
|
4321
|
+
const captureWhen = options.captureWhen === void 0 ? "always" : options.captureWhen;
|
|
4322
|
+
const resolvedCaptureWhen = captureWhen === "always" || captureWhen === "nested" ? captureWhen : "always";
|
|
4323
|
+
if (resolvedCaptureWhen !== captureWhen) {
|
|
4324
|
+
let invalidValue;
|
|
4325
|
+
try {
|
|
4326
|
+
invalidValue = String(captureWhen);
|
|
4327
|
+
} catch {
|
|
4328
|
+
invalidValue = "<unprintable>";
|
|
4329
|
+
}
|
|
4330
|
+
warnOnce(
|
|
4331
|
+
`invalid-capture-when:${traceFunctionKey}`,
|
|
4332
|
+
`unknown captureWhen value "${invalidValue}"; defaulting to "always". Valid values: "always", "nested".`
|
|
4333
|
+
);
|
|
4334
|
+
}
|
|
4335
|
+
if (resolvedCaptureWhen === "nested") {
|
|
4336
|
+
let hasParent = false;
|
|
4337
|
+
try {
|
|
4338
|
+
hasParent = getSpanStack().length > 0;
|
|
4339
|
+
} catch (setupError) {
|
|
4340
|
+
if (getReplayContext()) {
|
|
4341
|
+
throw setupError;
|
|
4342
|
+
}
|
|
4343
|
+
warnOnce(
|
|
4344
|
+
`withSpan-setup:${traceFunctionKey}`,
|
|
4345
|
+
`tracing setup failed for "${traceFunctionKey}"; running it untraced. The function still runs and returns normally; no span is recorded.`
|
|
4346
|
+
);
|
|
4347
|
+
return fn.apply(this, args);
|
|
4348
|
+
}
|
|
4349
|
+
if (!hasParent) {
|
|
4350
|
+
return fn.apply(this, args);
|
|
4351
|
+
}
|
|
4352
|
+
}
|
|
4319
4353
|
let newStack;
|
|
4320
4354
|
let executeWithContext;
|
|
4321
4355
|
let registeredTraceId;
|