bitfab 0.36.4 → 0.36.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/{chunk-6AXY24UL.js → chunk-FLP6CNRE.js} +2 -2
- package/dist/{chunk-6AXY24UL.js.map → chunk-FLP6CNRE.js.map} +1 -1
- package/dist/{chunk-5NT3VGCB.js → chunk-IYHBVIPJ.js} +60 -5
- package/dist/{chunk-5NT3VGCB.js.map → chunk-IYHBVIPJ.js.map} +1 -1
- package/dist/index.cjs +58 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -2
- package/dist/index.d.ts +67 -2
- package/dist/index.js +2 -2
- package/dist/node.cjs +58 -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-EBDSNUIO.js → replay-JGMOJEW2.js} +2 -2
- package/package.json +2 -2
- /package/dist/{replay-EBDSNUIO.js.map → replay-JGMOJEW2.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1878,6 +1878,27 @@ interface SpanOptions {
|
|
|
1878
1878
|
*/
|
|
1879
1879
|
finalize?: (result: any) => unknown | Promise<unknown>;
|
|
1880
1880
|
}
|
|
1881
|
+
/**
|
|
1882
|
+
* The standard method context passed to a decorator.
|
|
1883
|
+
*
|
|
1884
|
+
* Defined structurally instead of referencing TypeScript's built-in
|
|
1885
|
+
* `ClassMethodDecoratorContext`, which was added in TypeScript 5.0. This keeps
|
|
1886
|
+
* the SDK's non-decorator APIs consumable by projects on older compilers.
|
|
1887
|
+
*/
|
|
1888
|
+
interface SpanMethodDecoratorContext<TThis, TValue> {
|
|
1889
|
+
readonly kind: "method";
|
|
1890
|
+
readonly name: string | symbol;
|
|
1891
|
+
readonly static: boolean;
|
|
1892
|
+
readonly private: boolean;
|
|
1893
|
+
readonly access: {
|
|
1894
|
+
has(object: TThis): boolean;
|
|
1895
|
+
get(object: TThis): TValue;
|
|
1896
|
+
};
|
|
1897
|
+
addInitializer(initializer: (this: TThis) => void): void;
|
|
1898
|
+
readonly metadata?: Record<PropertyKey, unknown>;
|
|
1899
|
+
}
|
|
1900
|
+
/** A standard ECMAScript method decorator produced by {@link Bitfab.span}. */
|
|
1901
|
+
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;
|
|
1881
1902
|
|
|
1882
1903
|
/**
|
|
1883
1904
|
* Client for making provider-based API calls via BAML.
|
|
@@ -2148,6 +2169,31 @@ declare class Bitfab {
|
|
|
2148
2169
|
* @returns A wrapped function with the same signature that creates spans for inputs and outputs
|
|
2149
2170
|
*/
|
|
2150
2171
|
withSpan<TArgs extends unknown[], TReturn>(traceFunctionKey: string, optionsOrFn: SpanOptions | ((...args: TArgs) => TReturn), maybeFn?: (...args: TArgs) => TReturn): (...args: TArgs) => TReturn;
|
|
2172
|
+
/**
|
|
2173
|
+
* Create a standard ECMAScript method decorator that records each invocation
|
|
2174
|
+
* as a span.
|
|
2175
|
+
*
|
|
2176
|
+
* It supports instance, static, and private methods; use
|
|
2177
|
+
* {@link Bitfab.withSpan} for standalone functions, class fields, and
|
|
2178
|
+
* accessors.
|
|
2179
|
+
*
|
|
2180
|
+
* @example
|
|
2181
|
+
* ```typescript
|
|
2182
|
+
* const bitfab = new Bitfab({ apiKey: process.env.BITFAB_API_KEY });
|
|
2183
|
+
*
|
|
2184
|
+
* class OrderService {
|
|
2185
|
+
* @bitfab.span("order-processing", { type: "agent" })
|
|
2186
|
+
* async process(orderId: string) {
|
|
2187
|
+
* return { orderId };
|
|
2188
|
+
* }
|
|
2189
|
+
* }
|
|
2190
|
+
* ```
|
|
2191
|
+
*
|
|
2192
|
+
* @param traceFunctionKey - A string identifier for grouping spans
|
|
2193
|
+
* @param options - Span configuration applied to the decorated method
|
|
2194
|
+
* @returns A standard ECMAScript method decorator
|
|
2195
|
+
*/
|
|
2196
|
+
span(traceFunctionKey: string, options?: SpanOptions): SpanMethodDecorator;
|
|
2151
2197
|
/**
|
|
2152
2198
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
2153
2199
|
* canonical Bitfab trace ID.
|
|
@@ -2292,6 +2338,25 @@ declare class BitfabFunction {
|
|
|
2292
2338
|
* @returns A wrapped function with the same signature that creates spans
|
|
2293
2339
|
*/
|
|
2294
2340
|
withSpan<TArgs extends unknown[], TReturn>(optionsOrFn: SpanOptions | ((...args: TArgs) => TReturn), maybeFn?: (...args: TArgs) => TReturn): (...args: TArgs) => TReturn;
|
|
2341
|
+
/**
|
|
2342
|
+
* Create a standard ECMAScript method decorator bound to this function key.
|
|
2343
|
+
*
|
|
2344
|
+
* @example
|
|
2345
|
+
* ```typescript
|
|
2346
|
+
* const orders = client.getFunction("order-processing");
|
|
2347
|
+
*
|
|
2348
|
+
* class OrderService {
|
|
2349
|
+
* @orders.span({ type: "agent" })
|
|
2350
|
+
* async process(orderId: string) {
|
|
2351
|
+
* return { orderId };
|
|
2352
|
+
* }
|
|
2353
|
+
* }
|
|
2354
|
+
* ```
|
|
2355
|
+
*
|
|
2356
|
+
* @param options - Span configuration applied to the decorated method
|
|
2357
|
+
* @returns A standard ECMAScript method decorator
|
|
2358
|
+
*/
|
|
2359
|
+
span(options?: SpanOptions): SpanMethodDecorator;
|
|
2295
2360
|
/**
|
|
2296
2361
|
* Get a Vercel AI SDK language-model middleware bound to this function's key.
|
|
2297
2362
|
*
|
|
@@ -2399,7 +2464,7 @@ declare class BitfabFunction {
|
|
|
2399
2464
|
/**
|
|
2400
2465
|
* SDK version from package.json (injected at build time)
|
|
2401
2466
|
*/
|
|
2402
|
-
declare const __version__ = "0.36.
|
|
2467
|
+
declare const __version__ = "0.36.5";
|
|
2403
2468
|
|
|
2404
2469
|
/**
|
|
2405
2470
|
* Constants for the Bitfab SDK.
|
|
@@ -2467,4 +2532,4 @@ declare const finalizers: {
|
|
|
2467
2532
|
readableStream: typeof readableStream;
|
|
2468
2533
|
};
|
|
2469
2534
|
|
|
2470
|
-
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 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 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, serializeReplayResult };
|
|
2535
|
+
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 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 ReplayOptions, type ReplayProgress, 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__, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1878,6 +1878,27 @@ interface SpanOptions {
|
|
|
1878
1878
|
*/
|
|
1879
1879
|
finalize?: (result: any) => unknown | Promise<unknown>;
|
|
1880
1880
|
}
|
|
1881
|
+
/**
|
|
1882
|
+
* The standard method context passed to a decorator.
|
|
1883
|
+
*
|
|
1884
|
+
* Defined structurally instead of referencing TypeScript's built-in
|
|
1885
|
+
* `ClassMethodDecoratorContext`, which was added in TypeScript 5.0. This keeps
|
|
1886
|
+
* the SDK's non-decorator APIs consumable by projects on older compilers.
|
|
1887
|
+
*/
|
|
1888
|
+
interface SpanMethodDecoratorContext<TThis, TValue> {
|
|
1889
|
+
readonly kind: "method";
|
|
1890
|
+
readonly name: string | symbol;
|
|
1891
|
+
readonly static: boolean;
|
|
1892
|
+
readonly private: boolean;
|
|
1893
|
+
readonly access: {
|
|
1894
|
+
has(object: TThis): boolean;
|
|
1895
|
+
get(object: TThis): TValue;
|
|
1896
|
+
};
|
|
1897
|
+
addInitializer(initializer: (this: TThis) => void): void;
|
|
1898
|
+
readonly metadata?: Record<PropertyKey, unknown>;
|
|
1899
|
+
}
|
|
1900
|
+
/** A standard ECMAScript method decorator produced by {@link Bitfab.span}. */
|
|
1901
|
+
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;
|
|
1881
1902
|
|
|
1882
1903
|
/**
|
|
1883
1904
|
* Client for making provider-based API calls via BAML.
|
|
@@ -2148,6 +2169,31 @@ declare class Bitfab {
|
|
|
2148
2169
|
* @returns A wrapped function with the same signature that creates spans for inputs and outputs
|
|
2149
2170
|
*/
|
|
2150
2171
|
withSpan<TArgs extends unknown[], TReturn>(traceFunctionKey: string, optionsOrFn: SpanOptions | ((...args: TArgs) => TReturn), maybeFn?: (...args: TArgs) => TReturn): (...args: TArgs) => TReturn;
|
|
2172
|
+
/**
|
|
2173
|
+
* Create a standard ECMAScript method decorator that records each invocation
|
|
2174
|
+
* as a span.
|
|
2175
|
+
*
|
|
2176
|
+
* It supports instance, static, and private methods; use
|
|
2177
|
+
* {@link Bitfab.withSpan} for standalone functions, class fields, and
|
|
2178
|
+
* accessors.
|
|
2179
|
+
*
|
|
2180
|
+
* @example
|
|
2181
|
+
* ```typescript
|
|
2182
|
+
* const bitfab = new Bitfab({ apiKey: process.env.BITFAB_API_KEY });
|
|
2183
|
+
*
|
|
2184
|
+
* class OrderService {
|
|
2185
|
+
* @bitfab.span("order-processing", { type: "agent" })
|
|
2186
|
+
* async process(orderId: string) {
|
|
2187
|
+
* return { orderId };
|
|
2188
|
+
* }
|
|
2189
|
+
* }
|
|
2190
|
+
* ```
|
|
2191
|
+
*
|
|
2192
|
+
* @param traceFunctionKey - A string identifier for grouping spans
|
|
2193
|
+
* @param options - Span configuration applied to the decorated method
|
|
2194
|
+
* @returns A standard ECMAScript method decorator
|
|
2195
|
+
*/
|
|
2196
|
+
span(traceFunctionKey: string, options?: SpanOptions): SpanMethodDecorator;
|
|
2151
2197
|
/**
|
|
2152
2198
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
2153
2199
|
* canonical Bitfab trace ID.
|
|
@@ -2292,6 +2338,25 @@ declare class BitfabFunction {
|
|
|
2292
2338
|
* @returns A wrapped function with the same signature that creates spans
|
|
2293
2339
|
*/
|
|
2294
2340
|
withSpan<TArgs extends unknown[], TReturn>(optionsOrFn: SpanOptions | ((...args: TArgs) => TReturn), maybeFn?: (...args: TArgs) => TReturn): (...args: TArgs) => TReturn;
|
|
2341
|
+
/**
|
|
2342
|
+
* Create a standard ECMAScript method decorator bound to this function key.
|
|
2343
|
+
*
|
|
2344
|
+
* @example
|
|
2345
|
+
* ```typescript
|
|
2346
|
+
* const orders = client.getFunction("order-processing");
|
|
2347
|
+
*
|
|
2348
|
+
* class OrderService {
|
|
2349
|
+
* @orders.span({ type: "agent" })
|
|
2350
|
+
* async process(orderId: string) {
|
|
2351
|
+
* return { orderId };
|
|
2352
|
+
* }
|
|
2353
|
+
* }
|
|
2354
|
+
* ```
|
|
2355
|
+
*
|
|
2356
|
+
* @param options - Span configuration applied to the decorated method
|
|
2357
|
+
* @returns A standard ECMAScript method decorator
|
|
2358
|
+
*/
|
|
2359
|
+
span(options?: SpanOptions): SpanMethodDecorator;
|
|
2295
2360
|
/**
|
|
2296
2361
|
* Get a Vercel AI SDK language-model middleware bound to this function's key.
|
|
2297
2362
|
*
|
|
@@ -2399,7 +2464,7 @@ declare class BitfabFunction {
|
|
|
2399
2464
|
/**
|
|
2400
2465
|
* SDK version from package.json (injected at build time)
|
|
2401
2466
|
*/
|
|
2402
|
-
declare const __version__ = "0.36.
|
|
2467
|
+
declare const __version__ = "0.36.5";
|
|
2403
2468
|
|
|
2404
2469
|
/**
|
|
2405
2470
|
* Constants for the Bitfab SDK.
|
|
@@ -2467,4 +2532,4 @@ declare const finalizers: {
|
|
|
2467
2532
|
readableStream: typeof readableStream;
|
|
2468
2533
|
};
|
|
2469
2534
|
|
|
2470
|
-
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 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 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, serializeReplayResult };
|
|
2535
|
+
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 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 ReplayOptions, type ReplayProgress, 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__, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, serializeReplayResult };
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
getCurrentReplayBranch,
|
|
21
21
|
getCurrentSpan,
|
|
22
22
|
getCurrentTrace
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-IYHBVIPJ.js";
|
|
24
24
|
import {
|
|
25
25
|
BITFAB_PROGRESS_PREFIX,
|
|
26
26
|
BitfabError,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
flushTraces,
|
|
33
33
|
reportReplayProgress,
|
|
34
34
|
serializeReplayResult
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-FLP6CNRE.js";
|
|
36
36
|
export {
|
|
37
37
|
BITFAB_PROGRESS_PREFIX,
|
|
38
38
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -97,7 +97,7 @@ var __version__;
|
|
|
97
97
|
var init_version_generated = __esm({
|
|
98
98
|
"src/version.generated.ts"() {
|
|
99
99
|
"use strict";
|
|
100
|
-
__version__ = "0.36.
|
|
100
|
+
__version__ = "0.36.5";
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
|
|
@@ -5791,7 +5791,7 @@ var Bitfab = class {
|
|
|
5791
5791
|
}
|
|
5792
5792
|
};
|
|
5793
5793
|
executeWithContext = () => {
|
|
5794
|
-
const result = fn(
|
|
5794
|
+
const result = fn.apply(this, args);
|
|
5795
5795
|
if (result instanceof Promise) {
|
|
5796
5796
|
return result.then((resolvedResult) => {
|
|
5797
5797
|
recordSpan(resolvedResult);
|
|
@@ -5821,7 +5821,7 @@ var Bitfab = class {
|
|
|
5821
5821
|
`withSpan-setup:${traceFunctionKey}`,
|
|
5822
5822
|
`tracing setup failed for "${traceFunctionKey}"; running it untraced. The function still runs and returns normally; no span is recorded.`
|
|
5823
5823
|
);
|
|
5824
|
-
return fn(
|
|
5824
|
+
return fn.apply(this, args);
|
|
5825
5825
|
}
|
|
5826
5826
|
return runWithSpanStack(newStack, executeWithContext);
|
|
5827
5827
|
};
|
|
@@ -5830,6 +5830,40 @@ var Bitfab = class {
|
|
|
5830
5830
|
});
|
|
5831
5831
|
return wrappedFn;
|
|
5832
5832
|
}
|
|
5833
|
+
/**
|
|
5834
|
+
* Create a standard ECMAScript method decorator that records each invocation
|
|
5835
|
+
* as a span.
|
|
5836
|
+
*
|
|
5837
|
+
* It supports instance, static, and private methods; use
|
|
5838
|
+
* {@link Bitfab.withSpan} for standalone functions, class fields, and
|
|
5839
|
+
* accessors.
|
|
5840
|
+
*
|
|
5841
|
+
* @example
|
|
5842
|
+
* ```typescript
|
|
5843
|
+
* const bitfab = new Bitfab({ apiKey: process.env.BITFAB_API_KEY });
|
|
5844
|
+
*
|
|
5845
|
+
* class OrderService {
|
|
5846
|
+
* @bitfab.span("order-processing", { type: "agent" })
|
|
5847
|
+
* async process(orderId: string) {
|
|
5848
|
+
* return { orderId };
|
|
5849
|
+
* }
|
|
5850
|
+
* }
|
|
5851
|
+
* ```
|
|
5852
|
+
*
|
|
5853
|
+
* @param traceFunctionKey - A string identifier for grouping spans
|
|
5854
|
+
* @param options - Span configuration applied to the decorated method
|
|
5855
|
+
* @returns A standard ECMAScript method decorator
|
|
5856
|
+
*/
|
|
5857
|
+
span(traceFunctionKey, options = {}) {
|
|
5858
|
+
return (originalMethod, context) => {
|
|
5859
|
+
if (context.kind !== "method") {
|
|
5860
|
+
throw new BitfabError(
|
|
5861
|
+
`Bitfab span decorators can only decorate methods; ${String(context.name)} is a ${context.kind}`
|
|
5862
|
+
);
|
|
5863
|
+
}
|
|
5864
|
+
return this.withSpan(traceFunctionKey, options, originalMethod);
|
|
5865
|
+
};
|
|
5866
|
+
}
|
|
5833
5867
|
/**
|
|
5834
5868
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
5835
5869
|
* canonical Bitfab trace ID.
|
|
@@ -6106,6 +6140,27 @@ var BitfabFunction = class {
|
|
|
6106
6140
|
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
6107
6141
|
return this.client.withSpan(this.traceFunctionKey, options, fn);
|
|
6108
6142
|
}
|
|
6143
|
+
/**
|
|
6144
|
+
* Create a standard ECMAScript method decorator bound to this function key.
|
|
6145
|
+
*
|
|
6146
|
+
* @example
|
|
6147
|
+
* ```typescript
|
|
6148
|
+
* const orders = client.getFunction("order-processing");
|
|
6149
|
+
*
|
|
6150
|
+
* class OrderService {
|
|
6151
|
+
* @orders.span({ type: "agent" })
|
|
6152
|
+
* async process(orderId: string) {
|
|
6153
|
+
* return { orderId };
|
|
6154
|
+
* }
|
|
6155
|
+
* }
|
|
6156
|
+
* ```
|
|
6157
|
+
*
|
|
6158
|
+
* @param options - Span configuration applied to the decorated method
|
|
6159
|
+
* @returns A standard ECMAScript method decorator
|
|
6160
|
+
*/
|
|
6161
|
+
span(options = {}) {
|
|
6162
|
+
return this.client.span(this.traceFunctionKey, options);
|
|
6163
|
+
}
|
|
6109
6164
|
/**
|
|
6110
6165
|
* Get a Vercel AI SDK language-model middleware bound to this function's key.
|
|
6111
6166
|
*
|