@bitfab/sdk 0.38.3 → 0.38.5
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 +48 -1
- package/dist/autoTrace.cjs.map +1 -1
- package/dist/autoTrace.d.cts +13 -2
- package/dist/autoTrace.d.ts +13 -2
- package/dist/autoTrace.js +3 -1
- package/dist/{chunk-GFBQ2AMO.js → chunk-J47KPS77.js} +48 -2
- package/dist/chunk-J47KPS77.js.map +1 -0
- package/dist/{chunk-WX6AEFCP.js → chunk-VVI573UU.js} +8 -3
- package/dist/{chunk-WX6AEFCP.js.map → chunk-VVI573UU.js.map} +1 -1
- package/dist/{chunk-RJPHMJWO.js → chunk-Z3GIZGS5.js} +280 -82
- package/dist/chunk-Z3GIZGS5.js.map +1 -0
- package/dist/index.cjs +329 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -7
- package/dist/index.d.ts +75 -7
- package/dist/index.js +5 -3
- package/dist/node.cjs +329 -80
- 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 +5 -3
- package/dist/node.js.map +1 -1
- package/dist/{replay-FAO7D7CG.js → replay-Z6DON4SP.js} +2 -2
- package/dist/replayCli.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-GFBQ2AMO.js.map +0 -1
- package/dist/chunk-RJPHMJWO.js.map +0 -1
- /package/dist/{replay-FAO7D7CG.js.map → replay-Z6DON4SP.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -147,10 +147,23 @@ interface MockOverrideCtx {
|
|
|
147
147
|
*/
|
|
148
148
|
getOriginalOutput: () => Promise<unknown>;
|
|
149
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Return this from a mock override resolver to decline the override for the
|
|
152
|
+
* current span. Resolution continues with the next override, then the replay's
|
|
153
|
+
* base mock strategy.
|
|
154
|
+
*/
|
|
155
|
+
declare const NO_MOCK_OVERRIDE: unique symbol;
|
|
150
156
|
/** Selects which spans an override applies to. Runs on structural metadata. */
|
|
151
157
|
type NodeMatcher = (node: SpanNodeMeta) => boolean;
|
|
152
158
|
/** The function form of {@link MockValue}, receiving the override context. */
|
|
153
159
|
type MockValueFn = (ctx: MockOverrideCtx) => unknown | Promise<unknown>;
|
|
160
|
+
/**
|
|
161
|
+
* A client-wide, keyed, or per-replay resolver. A global resolver can route on
|
|
162
|
+
* `ctx.node.traceFunctionKey`; a keyed resolver is only invoked for spans with
|
|
163
|
+
* its registered key. Return {@link NO_MOCK_OVERRIDE} for spans the resolver
|
|
164
|
+
* does not want to override.
|
|
165
|
+
*/
|
|
166
|
+
type MockOverrideResolver = (ctx: MockOverrideCtx) => unknown | Promise<unknown>;
|
|
154
167
|
/**
|
|
155
168
|
* The value injected for a matched span: either a flat value used as-is, or a
|
|
156
169
|
* function of the {@link MockOverrideCtx} that returns one (or a Promise of
|
|
@@ -168,6 +181,8 @@ interface MockOverride {
|
|
|
168
181
|
match: NodeMatcher;
|
|
169
182
|
value: MockValue;
|
|
170
183
|
}
|
|
184
|
+
/** Accepted shape for one mock override declaration. */
|
|
185
|
+
type MockOverrideInput = MockOverride | MockOverrideResolver;
|
|
171
186
|
|
|
172
187
|
/**
|
|
173
188
|
* Replay context propagation via AsyncLocalStorage.
|
|
@@ -1268,12 +1283,12 @@ interface ReplayOptions {
|
|
|
1268
1283
|
/**
|
|
1269
1284
|
* Selective mock overrides: inject custom values into specific spans during
|
|
1270
1285
|
* replay, so downstream real code runs against the substituted output. Each
|
|
1271
|
-
*
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1286
|
+
* Pass `{ match, value }` pairs, or one resolver invoked for every child span.
|
|
1287
|
+
* A resolver can route on `ctx.node.traceFunctionKey` and return
|
|
1288
|
+
* `NO_MOCK_OVERRIDE` to continue to the next override and base strategy.
|
|
1289
|
+
* Per-call overrides take precedence over registrations on the client.
|
|
1275
1290
|
*/
|
|
1276
|
-
mockOverride?:
|
|
1291
|
+
mockOverride?: MockOverrideInput | MockOverrideInput[];
|
|
1277
1292
|
/**
|
|
1278
1293
|
* Run each item against a database branch restored to the state its source
|
|
1279
1294
|
* trace saw. Pass `true` to branch with the mirror project's own sizing, or a
|
|
@@ -2059,6 +2074,8 @@ interface SpanOptions {
|
|
|
2059
2074
|
* real child.
|
|
2060
2075
|
*/
|
|
2061
2076
|
mockOnReplay?: boolean;
|
|
2077
|
+
/** Optional test run ID included on the span and on the trace it starts. */
|
|
2078
|
+
testRunId?: string;
|
|
2062
2079
|
/**
|
|
2063
2080
|
* Record a serializable view of a non-serializable result (e.g. a live
|
|
2064
2081
|
* stream object) as the span output.
|
|
@@ -2100,6 +2117,15 @@ interface SpanMethodDecoratorContext<TThis, TValue> {
|
|
|
2100
2117
|
}
|
|
2101
2118
|
/** A standard ECMAScript method decorator produced by {@link Bitfab.span}. */
|
|
2102
2119
|
type SpanMethodDecorator = <TThis, TArgs extends unknown[], TReturn>(originalMethod: (this: TThis, ...args: TArgs) => TReturn, context: SpanMethodDecoratorContext<TThis, (this: TThis, ...args: TArgs) => TReturn>) => (this: TThis, ...args: TArgs) => TReturn;
|
|
2120
|
+
/** Trace-owned configuration for a function discovered beneath `trace()`. */
|
|
2121
|
+
interface NodeOptions extends Omit<SpanOptions, "captureWhen"> {
|
|
2122
|
+
/** Whether the enclosing trace captures this call. Defaults to true. */
|
|
2123
|
+
capture?: boolean;
|
|
2124
|
+
}
|
|
2125
|
+
type StandardNodeMethodDecorator = SpanMethodDecorator;
|
|
2126
|
+
type LegacyNodeMethodDecorator = <TThis, TArgs extends unknown[], TReturn>(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(this: TThis, ...args: TArgs) => TReturn>) => void;
|
|
2127
|
+
/** A method decorator produced by {@link Bitfab.node}. */
|
|
2128
|
+
type NodeMethodDecorator = StandardNodeMethodDecorator & LegacyNodeMethodDecorator;
|
|
2103
2129
|
/** Options for experimental automatic subtree tracing. */
|
|
2104
2130
|
interface TraceOptions {
|
|
2105
2131
|
/** Root span name. Defaults to the decorated or wrapped function name. */
|
|
@@ -2182,6 +2208,36 @@ declare class Bitfab {
|
|
|
2182
2208
|
*/
|
|
2183
2209
|
withTrace<This, TArgs extends unknown[], TReturn>(traceFunctionKey: string, fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
|
|
2184
2210
|
withTrace<This, TArgs extends unknown[], TReturn>(traceFunctionKey: string, options: TraceOptions, fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
|
|
2211
|
+
/**
|
|
2212
|
+
* Configure a transformed class method when it is discovered beneath a
|
|
2213
|
+
* {@link Bitfab.trace} root.
|
|
2214
|
+
*
|
|
2215
|
+
* The decorator creates no span or trace by itself. Beneath an active trace,
|
|
2216
|
+
* it can rename or retype the discovered call, capture its contents, mark it
|
|
2217
|
+
* for recorded-output replay, finalize its output, or omit it while leaving
|
|
2218
|
+
* captured descendants attached to the nearest captured parent.
|
|
2219
|
+
*
|
|
2220
|
+
* @param options - Trace-owned call configuration.
|
|
2221
|
+
* @experimental Automatic child-call instrumentation is experimental.
|
|
2222
|
+
*/
|
|
2223
|
+
node(options?: NodeOptions): NodeMethodDecorator;
|
|
2224
|
+
/**
|
|
2225
|
+
* Configure a transformed standalone function when it is discovered beneath
|
|
2226
|
+
* a {@link Bitfab.trace} or {@link Bitfab.withTrace} root.
|
|
2227
|
+
*
|
|
2228
|
+
* This is the function-oriented equivalent of {@link Bitfab.node}. Without
|
|
2229
|
+
* an active automatic trace, the returned function runs normally and never
|
|
2230
|
+
* creates a span or trace. The function must be named so configuration can
|
|
2231
|
+
* be bound to its transformed definition without leaking to a descendant.
|
|
2232
|
+
*
|
|
2233
|
+
* @param optionsOrFn - Node options or the function to configure.
|
|
2234
|
+
* @param maybeFn - Function to configure when options are provided.
|
|
2235
|
+
* @experimental Automatic child-call instrumentation is experimental.
|
|
2236
|
+
*/
|
|
2237
|
+
withNode<This, TArgs extends unknown[], TReturn>(fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
|
|
2238
|
+
withNode<This, TArgs extends unknown[], TReturn>(options: NodeOptions, fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
|
|
2239
|
+
private resolveNodeConfiguration;
|
|
2240
|
+
private createAutoTraceNode;
|
|
2185
2241
|
private createAutoTraceRoot;
|
|
2186
2242
|
private refreshAutoTraceCapturePolicy;
|
|
2187
2243
|
/**
|
|
@@ -2543,10 +2599,22 @@ declare class Bitfab {
|
|
|
2543
2599
|
* (node) => node.traceFunctionKey === "classify-intent",
|
|
2544
2600
|
* ({ inputs }) => ({ label: "refund" }),
|
|
2545
2601
|
* )
|
|
2602
|
+
* // Keyed form: the resolver only sees spans for this trace function key.
|
|
2603
|
+
* bitfab.registerMockOverride("classify-intent", ({ inputs }) => ({
|
|
2604
|
+
* label: String(inputs[0]),
|
|
2605
|
+
* }))
|
|
2606
|
+
* // Or one resolver for every child span:
|
|
2607
|
+
* bitfab.registerMockOverride(({ node }) =>
|
|
2608
|
+
* node.traceFunctionKey === "classify-intent"
|
|
2609
|
+
* ? { label: "refund" }
|
|
2610
|
+
* : NO_MOCK_OVERRIDE,
|
|
2611
|
+
* )
|
|
2546
2612
|
* ```
|
|
2547
2613
|
*/
|
|
2548
2614
|
registerMockOverride(override: MockOverride): void;
|
|
2615
|
+
registerMockOverride(resolver: MockOverrideResolver): void;
|
|
2549
2616
|
registerMockOverride(match: NodeMatcher, value: MockValue): void;
|
|
2617
|
+
registerMockOverride(traceFunctionKey: string, override: MockOverride | MockOverrideResolver): void;
|
|
2550
2618
|
/** Remove all overrides registered via {@link registerMockOverride}. */
|
|
2551
2619
|
clearMockOverrides(): void;
|
|
2552
2620
|
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
@@ -2718,7 +2786,7 @@ declare class BitfabFunction {
|
|
|
2718
2786
|
/**
|
|
2719
2787
|
* SDK version from package.json (injected at build time)
|
|
2720
2788
|
*/
|
|
2721
|
-
declare const __version__ = "0.38.
|
|
2789
|
+
declare const __version__ = "0.38.5";
|
|
2722
2790
|
|
|
2723
2791
|
/**
|
|
2724
2792
|
* Constants for the Bitfab SDK.
|
|
@@ -2821,4 +2889,4 @@ type ReplayRegistry = Record<string, ReplayRegistration>;
|
|
|
2821
2889
|
*/
|
|
2822
2890
|
declare function defineReplayRegistry<TRegistry extends ReplayRegistry>(registry: TRegistry): TRegistry;
|
|
2823
2891
|
|
|
2824
|
-
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, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, HttpClient, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, 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, SUPPORTED_PROVIDERS, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, 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__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
|
|
2892
|
+
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, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, HttpClient, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, 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, SUPPORTED_PROVIDERS, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, 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__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -147,10 +147,23 @@ interface MockOverrideCtx {
|
|
|
147
147
|
*/
|
|
148
148
|
getOriginalOutput: () => Promise<unknown>;
|
|
149
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Return this from a mock override resolver to decline the override for the
|
|
152
|
+
* current span. Resolution continues with the next override, then the replay's
|
|
153
|
+
* base mock strategy.
|
|
154
|
+
*/
|
|
155
|
+
declare const NO_MOCK_OVERRIDE: unique symbol;
|
|
150
156
|
/** Selects which spans an override applies to. Runs on structural metadata. */
|
|
151
157
|
type NodeMatcher = (node: SpanNodeMeta) => boolean;
|
|
152
158
|
/** The function form of {@link MockValue}, receiving the override context. */
|
|
153
159
|
type MockValueFn = (ctx: MockOverrideCtx) => unknown | Promise<unknown>;
|
|
160
|
+
/**
|
|
161
|
+
* A client-wide, keyed, or per-replay resolver. A global resolver can route on
|
|
162
|
+
* `ctx.node.traceFunctionKey`; a keyed resolver is only invoked for spans with
|
|
163
|
+
* its registered key. Return {@link NO_MOCK_OVERRIDE} for spans the resolver
|
|
164
|
+
* does not want to override.
|
|
165
|
+
*/
|
|
166
|
+
type MockOverrideResolver = (ctx: MockOverrideCtx) => unknown | Promise<unknown>;
|
|
154
167
|
/**
|
|
155
168
|
* The value injected for a matched span: either a flat value used as-is, or a
|
|
156
169
|
* function of the {@link MockOverrideCtx} that returns one (or a Promise of
|
|
@@ -168,6 +181,8 @@ interface MockOverride {
|
|
|
168
181
|
match: NodeMatcher;
|
|
169
182
|
value: MockValue;
|
|
170
183
|
}
|
|
184
|
+
/** Accepted shape for one mock override declaration. */
|
|
185
|
+
type MockOverrideInput = MockOverride | MockOverrideResolver;
|
|
171
186
|
|
|
172
187
|
/**
|
|
173
188
|
* Replay context propagation via AsyncLocalStorage.
|
|
@@ -1268,12 +1283,12 @@ interface ReplayOptions {
|
|
|
1268
1283
|
/**
|
|
1269
1284
|
* Selective mock overrides: inject custom values into specific spans during
|
|
1270
1285
|
* replay, so downstream real code runs against the substituted output. Each
|
|
1271
|
-
*
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1286
|
+
* Pass `{ match, value }` pairs, or one resolver invoked for every child span.
|
|
1287
|
+
* A resolver can route on `ctx.node.traceFunctionKey` and return
|
|
1288
|
+
* `NO_MOCK_OVERRIDE` to continue to the next override and base strategy.
|
|
1289
|
+
* Per-call overrides take precedence over registrations on the client.
|
|
1275
1290
|
*/
|
|
1276
|
-
mockOverride?:
|
|
1291
|
+
mockOverride?: MockOverrideInput | MockOverrideInput[];
|
|
1277
1292
|
/**
|
|
1278
1293
|
* Run each item against a database branch restored to the state its source
|
|
1279
1294
|
* trace saw. Pass `true` to branch with the mirror project's own sizing, or a
|
|
@@ -2059,6 +2074,8 @@ interface SpanOptions {
|
|
|
2059
2074
|
* real child.
|
|
2060
2075
|
*/
|
|
2061
2076
|
mockOnReplay?: boolean;
|
|
2077
|
+
/** Optional test run ID included on the span and on the trace it starts. */
|
|
2078
|
+
testRunId?: string;
|
|
2062
2079
|
/**
|
|
2063
2080
|
* Record a serializable view of a non-serializable result (e.g. a live
|
|
2064
2081
|
* stream object) as the span output.
|
|
@@ -2100,6 +2117,15 @@ interface SpanMethodDecoratorContext<TThis, TValue> {
|
|
|
2100
2117
|
}
|
|
2101
2118
|
/** A standard ECMAScript method decorator produced by {@link Bitfab.span}. */
|
|
2102
2119
|
type SpanMethodDecorator = <TThis, TArgs extends unknown[], TReturn>(originalMethod: (this: TThis, ...args: TArgs) => TReturn, context: SpanMethodDecoratorContext<TThis, (this: TThis, ...args: TArgs) => TReturn>) => (this: TThis, ...args: TArgs) => TReturn;
|
|
2120
|
+
/** Trace-owned configuration for a function discovered beneath `trace()`. */
|
|
2121
|
+
interface NodeOptions extends Omit<SpanOptions, "captureWhen"> {
|
|
2122
|
+
/** Whether the enclosing trace captures this call. Defaults to true. */
|
|
2123
|
+
capture?: boolean;
|
|
2124
|
+
}
|
|
2125
|
+
type StandardNodeMethodDecorator = SpanMethodDecorator;
|
|
2126
|
+
type LegacyNodeMethodDecorator = <TThis, TArgs extends unknown[], TReturn>(target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(this: TThis, ...args: TArgs) => TReturn>) => void;
|
|
2127
|
+
/** A method decorator produced by {@link Bitfab.node}. */
|
|
2128
|
+
type NodeMethodDecorator = StandardNodeMethodDecorator & LegacyNodeMethodDecorator;
|
|
2103
2129
|
/** Options for experimental automatic subtree tracing. */
|
|
2104
2130
|
interface TraceOptions {
|
|
2105
2131
|
/** Root span name. Defaults to the decorated or wrapped function name. */
|
|
@@ -2182,6 +2208,36 @@ declare class Bitfab {
|
|
|
2182
2208
|
*/
|
|
2183
2209
|
withTrace<This, TArgs extends unknown[], TReturn>(traceFunctionKey: string, fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
|
|
2184
2210
|
withTrace<This, TArgs extends unknown[], TReturn>(traceFunctionKey: string, options: TraceOptions, fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
|
|
2211
|
+
/**
|
|
2212
|
+
* Configure a transformed class method when it is discovered beneath a
|
|
2213
|
+
* {@link Bitfab.trace} root.
|
|
2214
|
+
*
|
|
2215
|
+
* The decorator creates no span or trace by itself. Beneath an active trace,
|
|
2216
|
+
* it can rename or retype the discovered call, capture its contents, mark it
|
|
2217
|
+
* for recorded-output replay, finalize its output, or omit it while leaving
|
|
2218
|
+
* captured descendants attached to the nearest captured parent.
|
|
2219
|
+
*
|
|
2220
|
+
* @param options - Trace-owned call configuration.
|
|
2221
|
+
* @experimental Automatic child-call instrumentation is experimental.
|
|
2222
|
+
*/
|
|
2223
|
+
node(options?: NodeOptions): NodeMethodDecorator;
|
|
2224
|
+
/**
|
|
2225
|
+
* Configure a transformed standalone function when it is discovered beneath
|
|
2226
|
+
* a {@link Bitfab.trace} or {@link Bitfab.withTrace} root.
|
|
2227
|
+
*
|
|
2228
|
+
* This is the function-oriented equivalent of {@link Bitfab.node}. Without
|
|
2229
|
+
* an active automatic trace, the returned function runs normally and never
|
|
2230
|
+
* creates a span or trace. The function must be named so configuration can
|
|
2231
|
+
* be bound to its transformed definition without leaking to a descendant.
|
|
2232
|
+
*
|
|
2233
|
+
* @param optionsOrFn - Node options or the function to configure.
|
|
2234
|
+
* @param maybeFn - Function to configure when options are provided.
|
|
2235
|
+
* @experimental Automatic child-call instrumentation is experimental.
|
|
2236
|
+
*/
|
|
2237
|
+
withNode<This, TArgs extends unknown[], TReturn>(fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
|
|
2238
|
+
withNode<This, TArgs extends unknown[], TReturn>(options: NodeOptions, fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
|
|
2239
|
+
private resolveNodeConfiguration;
|
|
2240
|
+
private createAutoTraceNode;
|
|
2185
2241
|
private createAutoTraceRoot;
|
|
2186
2242
|
private refreshAutoTraceCapturePolicy;
|
|
2187
2243
|
/**
|
|
@@ -2543,10 +2599,22 @@ declare class Bitfab {
|
|
|
2543
2599
|
* (node) => node.traceFunctionKey === "classify-intent",
|
|
2544
2600
|
* ({ inputs }) => ({ label: "refund" }),
|
|
2545
2601
|
* )
|
|
2602
|
+
* // Keyed form: the resolver only sees spans for this trace function key.
|
|
2603
|
+
* bitfab.registerMockOverride("classify-intent", ({ inputs }) => ({
|
|
2604
|
+
* label: String(inputs[0]),
|
|
2605
|
+
* }))
|
|
2606
|
+
* // Or one resolver for every child span:
|
|
2607
|
+
* bitfab.registerMockOverride(({ node }) =>
|
|
2608
|
+
* node.traceFunctionKey === "classify-intent"
|
|
2609
|
+
* ? { label: "refund" }
|
|
2610
|
+
* : NO_MOCK_OVERRIDE,
|
|
2611
|
+
* )
|
|
2546
2612
|
* ```
|
|
2547
2613
|
*/
|
|
2548
2614
|
registerMockOverride(override: MockOverride): void;
|
|
2615
|
+
registerMockOverride(resolver: MockOverrideResolver): void;
|
|
2549
2616
|
registerMockOverride(match: NodeMatcher, value: MockValue): void;
|
|
2617
|
+
registerMockOverride(traceFunctionKey: string, override: MockOverride | MockOverrideResolver): void;
|
|
2550
2618
|
/** Remove all overrides registered via {@link registerMockOverride}. */
|
|
2551
2619
|
clearMockOverrides(): void;
|
|
2552
2620
|
replay<TReturn>(traceFunctionKey: string, fn: (...args: any[]) => TReturn | Promise<TReturn>, options?: ReplayOptions): Promise<ReplayResult<TReturn>>;
|
|
@@ -2718,7 +2786,7 @@ declare class BitfabFunction {
|
|
|
2718
2786
|
/**
|
|
2719
2787
|
* SDK version from package.json (injected at build time)
|
|
2720
2788
|
*/
|
|
2721
|
-
declare const __version__ = "0.38.
|
|
2789
|
+
declare const __version__ = "0.38.5";
|
|
2722
2790
|
|
|
2723
2791
|
/**
|
|
2724
2792
|
* Constants for the Bitfab SDK.
|
|
@@ -2821,4 +2889,4 @@ type ReplayRegistry = Record<string, ReplayRegistration>;
|
|
|
2821
2889
|
*/
|
|
2822
2890
|
declare function defineReplayRegistry<TRegistry extends ReplayRegistry>(registry: TRegistry): TRegistry;
|
|
2823
2891
|
|
|
2824
|
-
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, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, HttpClient, type MockOverride, type MockOverrideCtx, type MockStrategy, type MockValue, type NodeMatcher, type ProviderDefinition, 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, SUPPORTED_PROVIDERS, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, 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__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
|
|
2892
|
+
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, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, HttpClient, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, 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, SUPPORTED_PROVIDERS, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, 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__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
|
package/dist/index.js
CHANGED
|
@@ -12,20 +12,21 @@ import {
|
|
|
12
12
|
getCurrentReplayBranch,
|
|
13
13
|
getCurrentSpan,
|
|
14
14
|
getCurrentTrace
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-Z3GIZGS5.js";
|
|
16
|
+
import "./chunk-J47KPS77.js";
|
|
17
17
|
import {
|
|
18
18
|
BITFAB_PROGRESS_PREFIX,
|
|
19
19
|
BitfabError,
|
|
20
20
|
DEFAULT_SERVICE_URL,
|
|
21
21
|
DbBranchReplayError,
|
|
22
22
|
HttpClient,
|
|
23
|
+
NO_MOCK_OVERRIDE,
|
|
23
24
|
ReplayError,
|
|
24
25
|
__version__,
|
|
25
26
|
flushTraces,
|
|
26
27
|
reportReplayProgress,
|
|
27
28
|
serializeReplayResult
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-VVI573UU.js";
|
|
29
30
|
import "./chunk-H6LZRFMN.js";
|
|
30
31
|
export {
|
|
31
32
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -41,6 +42,7 @@ export {
|
|
|
41
42
|
DEFAULT_SERVICE_URL,
|
|
42
43
|
DbBranchReplayError,
|
|
43
44
|
HttpClient,
|
|
45
|
+
NO_MOCK_OVERRIDE,
|
|
44
46
|
ReplayError,
|
|
45
47
|
SUPPORTED_PROVIDERS,
|
|
46
48
|
__version__,
|