bitfab 0.54.9 → 0.54.10

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.
Files changed (35) hide show
  1. package/dist/{chunk-UKKR2PF4.js → chunk-A3OBQOLV.js} +609 -8
  2. package/dist/chunk-A3OBQOLV.js.map +1 -0
  3. package/dist/{chunk-7HXFT6JR.js → chunk-B2O33DBH.js} +6 -4
  4. package/dist/chunk-B2O33DBH.js.map +1 -0
  5. package/dist/{chunk-5EW5MV2Z.js → chunk-OGZLJINL.js} +3 -3
  6. package/dist/chunk-OGZLJINL.js.map +1 -0
  7. package/dist/{chunk-VT5IUVBY.js → chunk-PRXW4B5X.js} +85 -40
  8. package/dist/chunk-PRXW4B5X.js.map +1 -0
  9. package/dist/{chunk-TOCJX6OP.js → chunk-XLWQOUOP.js} +4 -3
  10. package/dist/chunk-XLWQOUOP.js.map +1 -0
  11. package/dist/{http-WQ6YWRTW.js → http-AVWWAMFV.js} +2 -2
  12. package/dist/{http-HYJYQTX2.js → http-DH3O3L5X.js} +2 -2
  13. package/dist/index.cjs +669 -8
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +130 -2
  16. package/dist/index.d.ts +130 -2
  17. package/dist/index.js +5 -3
  18. package/dist/node.cjs +669 -8
  19. package/dist/node.cjs.map +1 -1
  20. package/dist/node.d.cts +1 -1
  21. package/dist/node.d.ts +1 -1
  22. package/dist/node.js +5 -3
  23. package/dist/node.js.map +1 -1
  24. package/dist/{replay-MISWCCCG.js → replay-BCWIDCKH.js} +3 -3
  25. package/dist/replayCli.js +2 -2
  26. package/dist/seedCli.js +2 -2
  27. package/package.json +1 -1
  28. package/dist/chunk-5EW5MV2Z.js.map +0 -1
  29. package/dist/chunk-7HXFT6JR.js.map +0 -1
  30. package/dist/chunk-TOCJX6OP.js.map +0 -1
  31. package/dist/chunk-UKKR2PF4.js.map +0 -1
  32. package/dist/chunk-VT5IUVBY.js.map +0 -1
  33. /package/dist/{http-HYJYQTX2.js.map → http-AVWWAMFV.js.map} +0 -0
  34. /package/dist/{http-WQ6YWRTW.js.map → http-DH3O3L5X.js.map} +0 -0
  35. /package/dist/{replay-MISWCCCG.js.map → replay-BCWIDCKH.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -330,6 +330,8 @@ interface ReplayContext {
330
330
  * signal that outputs must be fetched rather than read inline.
331
331
  */
332
332
  fetchSpanOutput?: (externalSpanId: string) => Promise<unknown>;
333
+ /** Internal framework state captured on the historical root span. */
334
+ integrationFixtures?: Map<string, unknown>;
333
335
  dbBranchLease?: DbBranchLease;
334
336
  /**
335
337
  * Server-measured provisioning timings for this item's branch, echoed back
@@ -2204,6 +2206,88 @@ declare class ReplayBranch implements Omit<DbBranchLease, "databaseUrl"> {
2204
2206
  get databaseUrl(): string;
2205
2207
  }
2206
2208
 
2209
+ declare const RIVET_GROUP_EFFECT_METHODS: {
2210
+ readonly db: readonly ["execute", "nativeMetrics", "close"];
2211
+ readonly kv: readonly ["get", "put", "delete", "batchPut", "batchGet", "batchDelete", "deleteRange", "listPrefix", "listRange", "list"];
2212
+ readonly schedule: readonly ["after", "at", "cancel", "get", "list"];
2213
+ readonly cron: readonly ["set", "every", "get", "list", "delete", "history"];
2214
+ readonly queue: readonly ["send", "next", "nextBatch", "waitForNames", "waitForAvailable", "complete", "enqueueAndWait", "tryNext", "tryNextBatch"];
2215
+ readonly run: readonly ["setWakeAt"];
2216
+ };
2217
+ declare const RIVET_TOP_LEVEL_EFFECTS: readonly ["broadcast", "saveState", "sleep", "destroy"];
2218
+ type RivetGroup = keyof typeof RIVET_GROUP_EFFECT_METHODS;
2219
+ type RivetGroupEffectType = {
2220
+ [TGroup in RivetGroup]: `${TGroup}.${(typeof RIVET_GROUP_EFFECT_METHODS)[TGroup][number]}`;
2221
+ }[RivetGroup];
2222
+ /** Finite Rivet context operations supported as replay effects. */
2223
+ type RivetEffectType = RivetGroupEffectType | (typeof RIVET_TOP_LEVEL_EFFECTS)[number] | "db.transaction.execute" | "queue.message.complete";
2224
+ /** Configuration for {@link BitfabRivetIntegration}. */
2225
+ interface RivetIntegrationOptions {
2226
+ /**
2227
+ * Context operations whose recorded outputs replay should serve instead of
2228
+ * executing against a live actor. Nothing is marked by default.
2229
+ */
2230
+ mockOnReplay?: readonly RivetEffectType[];
2231
+ }
2232
+ /** Minimal structural context type used when callers do not supply Rivet's type. */
2233
+ interface RivetContextLike {
2234
+ state: unknown;
2235
+ readonly db: {
2236
+ execute(...args: unknown[]): Promise<unknown>;
2237
+ };
2238
+ broadcast(name: string, ...args: unknown[]): void;
2239
+ readonly actorId?: string;
2240
+ readonly name?: string;
2241
+ readonly key?: readonly string[];
2242
+ readonly region?: string;
2243
+ }
2244
+ interface RivetIntegrationRuntime {
2245
+ wrapEffect<TArgs extends unknown[], TReturn>(effect: RivetEffectType, mockOnReplay: boolean, fn: (...args: TArgs) => TReturn, replayOutput?: () => unknown): (...args: TArgs) => TReturn;
2246
+ recordRootFixture(context: Record<string, unknown>, recordedRoots: Set<string>): void;
2247
+ }
2248
+ /**
2249
+ * Binds a live Rivet actor context to an existing traced function and exposes
2250
+ * replay-aware proxies for supported context operations.
2251
+ *
2252
+ * The integration never creates a trace root. Use it with the same
2253
+ * `BitfabFunction` handle whose `withTrace()` wrapper is the production and
2254
+ * replay root.
2255
+ */
2256
+ declare class BitfabRivetIntegration<TContext extends object = RivetContextLike> {
2257
+ private readonly traceFunctionKey;
2258
+ private readonly runtime;
2259
+ private readonly markedEffects;
2260
+ private readonly replayProxies;
2261
+ /** @internal Constructed by `Bitfab.getRivetIntegration()`. */
2262
+ constructor(traceFunctionKey: string, runtime: RivetIntegrationRuntime, options?: RivetIntegrationOptions);
2263
+ /**
2264
+ * Run a callback with a live Rivet context bound to the current async chain.
2265
+ * This binds context only; it creates no trace or span.
2266
+ */
2267
+ withContext<TReturn>(context: TContext, fn: () => TReturn): TReturn;
2268
+ /**
2269
+ * Adapt a traced function into a Rivet handler whose first argument is the
2270
+ * live actor context. The context is not added to the traced root's inputs.
2271
+ */
2272
+ bind<This, TArgs extends unknown[], TReturn>(fn: (this: This, ...args: TArgs) => TReturn): (this: This, context: TContext, ...args: TArgs) => TReturn;
2273
+ /**
2274
+ * Return the current Rivet context proxy. In production it delegates to the
2275
+ * bound live context. During replay it hydrates recorded actor state and
2276
+ * intercepts supported effects without requiring a live Rivet actor.
2277
+ */
2278
+ getContext(): TContext;
2279
+ private createContextProxy;
2280
+ private createDbProxy;
2281
+ private createGroupProxy;
2282
+ private createMethodProxy;
2283
+ private createEffect;
2284
+ private createTransaction;
2285
+ private decorateQueueMessages;
2286
+ private decorateQueueMessage;
2287
+ private queueCallIsCompletable;
2288
+ private createQueueIterator;
2289
+ }
2290
+
2207
2291
  type TraceTargetOccurrence = "first" | "last" | number;
2208
2292
  type TraceTarget = {
2209
2293
  kind: "output";
@@ -3038,6 +3122,16 @@ declare class Bitfab {
3038
3122
  * @experimental This API may change before it is stable.
3039
3123
  */
3040
3124
  getLangGraphIntegration(traceFunctionKey: string, options?: LangGraphIntegrationOptions): BitfabLangGraphIntegration;
3125
+ /**
3126
+ * Get the first-class Rivet actor-context integration for an existing trace
3127
+ * root. The integration binds context and records effect spans; it never
3128
+ * creates another root.
3129
+ *
3130
+ * @param traceFunctionKey - Key used by the enclosing `withTrace()` root
3131
+ * @param options - Explicit per-context-path replay mocking policy
3132
+ * @experimental This API may change before it is stable.
3133
+ */
3134
+ getRivetIntegration<TContext extends object = RivetContextLike>(traceFunctionKey: string, options?: RivetIntegrationOptions): BitfabRivetIntegration<TContext>;
3041
3135
  /**
3042
3136
  * Get a Claude Agent SDK handler for tracing.
3043
3137
  *
@@ -3353,6 +3447,31 @@ declare class BitfabFunction {
3353
3447
  * @returns A standard ECMAScript method decorator
3354
3448
  */
3355
3449
  span(options?: SpanOptions): SpanMethodDecorator;
3450
+ /**
3451
+ * Wrap a function as an automatically expanded trace root bound to this
3452
+ * function's key.
3453
+ *
3454
+ * Equivalent to `client.withTrace(key, options, fn)` but reuses the key
3455
+ * bound on this handle.
3456
+ *
3457
+ * @param optionsOrFn - Trace options or the workflow entrypoint to wrap
3458
+ * @param maybeFn - Workflow entrypoint when options are provided
3459
+ * @returns A wrapped function with the same signature
3460
+ * @experimental Automatic child-call instrumentation is experimental.
3461
+ */
3462
+ withTrace<This, TArgs extends unknown[], TReturn>(fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
3463
+ withTrace<This, TArgs extends unknown[], TReturn>(options: TraceOptions, fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
3464
+ /**
3465
+ * Create a trace method decorator bound to this function's key.
3466
+ *
3467
+ * Equivalent to `client.trace(key, options)` but reuses the key bound on
3468
+ * this handle.
3469
+ *
3470
+ * @param options - Trace configuration applied to the decorated method
3471
+ * @returns A method decorator configured for this key
3472
+ * @experimental Automatic child-call instrumentation is experimental.
3473
+ */
3474
+ trace(options?: TraceOptions): TraceMethodDecorator;
3356
3475
  /**
3357
3476
  * Get a Vercel AI SDK language-model middleware bound to this function's key.
3358
3477
  *
@@ -3440,6 +3559,15 @@ declare class BitfabFunction {
3440
3559
  * @experimental This API may change before it is stable.
3441
3560
  */
3442
3561
  getLangGraphIntegration(options?: LangGraphIntegrationOptions): BitfabLangGraphIntegration;
3562
+ /**
3563
+ * Get the first-class Rivet actor-context integration bound to this key.
3564
+ * Use its `bind()` or `withContext()` outside this handle's `withTrace()`
3565
+ * root, then call `getContext()` inside the root.
3566
+ *
3567
+ * @param options - Explicit per-context-path replay mocking policy
3568
+ * @experimental This API may change before it is stable.
3569
+ */
3570
+ getRivetIntegration<TContext extends object = RivetContextLike>(options?: RivetIntegrationOptions): BitfabRivetIntegration<TContext>;
3443
3571
  /**
3444
3572
  * Wrap a BAML client method to automatically capture prompt and LLM metadata.
3445
3573
  * Delegates to the parent client's wrapBAML method.
@@ -3474,7 +3602,7 @@ interface CommitRef {
3474
3602
  /**
3475
3603
  * SDK version from package.json (injected at build time)
3476
3604
  */
3477
- declare const __version__ = "0.54.9";
3605
+ declare const __version__ = "0.54.10";
3478
3606
 
3479
3607
  /**
3480
3608
  * Constants for the Bitfab SDK.
@@ -3613,4 +3741,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3613
3741
  run?: boolean;
3614
3742
  }): Promise<SeedResult>;
3615
3743
 
3616
- 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, 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, 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 };
3744
+ 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 };
package/dist/index.d.ts CHANGED
@@ -330,6 +330,8 @@ interface ReplayContext {
330
330
  * signal that outputs must be fetched rather than read inline.
331
331
  */
332
332
  fetchSpanOutput?: (externalSpanId: string) => Promise<unknown>;
333
+ /** Internal framework state captured on the historical root span. */
334
+ integrationFixtures?: Map<string, unknown>;
333
335
  dbBranchLease?: DbBranchLease;
334
336
  /**
335
337
  * Server-measured provisioning timings for this item's branch, echoed back
@@ -2204,6 +2206,88 @@ declare class ReplayBranch implements Omit<DbBranchLease, "databaseUrl"> {
2204
2206
  get databaseUrl(): string;
2205
2207
  }
2206
2208
 
2209
+ declare const RIVET_GROUP_EFFECT_METHODS: {
2210
+ readonly db: readonly ["execute", "nativeMetrics", "close"];
2211
+ readonly kv: readonly ["get", "put", "delete", "batchPut", "batchGet", "batchDelete", "deleteRange", "listPrefix", "listRange", "list"];
2212
+ readonly schedule: readonly ["after", "at", "cancel", "get", "list"];
2213
+ readonly cron: readonly ["set", "every", "get", "list", "delete", "history"];
2214
+ readonly queue: readonly ["send", "next", "nextBatch", "waitForNames", "waitForAvailable", "complete", "enqueueAndWait", "tryNext", "tryNextBatch"];
2215
+ readonly run: readonly ["setWakeAt"];
2216
+ };
2217
+ declare const RIVET_TOP_LEVEL_EFFECTS: readonly ["broadcast", "saveState", "sleep", "destroy"];
2218
+ type RivetGroup = keyof typeof RIVET_GROUP_EFFECT_METHODS;
2219
+ type RivetGroupEffectType = {
2220
+ [TGroup in RivetGroup]: `${TGroup}.${(typeof RIVET_GROUP_EFFECT_METHODS)[TGroup][number]}`;
2221
+ }[RivetGroup];
2222
+ /** Finite Rivet context operations supported as replay effects. */
2223
+ type RivetEffectType = RivetGroupEffectType | (typeof RIVET_TOP_LEVEL_EFFECTS)[number] | "db.transaction.execute" | "queue.message.complete";
2224
+ /** Configuration for {@link BitfabRivetIntegration}. */
2225
+ interface RivetIntegrationOptions {
2226
+ /**
2227
+ * Context operations whose recorded outputs replay should serve instead of
2228
+ * executing against a live actor. Nothing is marked by default.
2229
+ */
2230
+ mockOnReplay?: readonly RivetEffectType[];
2231
+ }
2232
+ /** Minimal structural context type used when callers do not supply Rivet's type. */
2233
+ interface RivetContextLike {
2234
+ state: unknown;
2235
+ readonly db: {
2236
+ execute(...args: unknown[]): Promise<unknown>;
2237
+ };
2238
+ broadcast(name: string, ...args: unknown[]): void;
2239
+ readonly actorId?: string;
2240
+ readonly name?: string;
2241
+ readonly key?: readonly string[];
2242
+ readonly region?: string;
2243
+ }
2244
+ interface RivetIntegrationRuntime {
2245
+ wrapEffect<TArgs extends unknown[], TReturn>(effect: RivetEffectType, mockOnReplay: boolean, fn: (...args: TArgs) => TReturn, replayOutput?: () => unknown): (...args: TArgs) => TReturn;
2246
+ recordRootFixture(context: Record<string, unknown>, recordedRoots: Set<string>): void;
2247
+ }
2248
+ /**
2249
+ * Binds a live Rivet actor context to an existing traced function and exposes
2250
+ * replay-aware proxies for supported context operations.
2251
+ *
2252
+ * The integration never creates a trace root. Use it with the same
2253
+ * `BitfabFunction` handle whose `withTrace()` wrapper is the production and
2254
+ * replay root.
2255
+ */
2256
+ declare class BitfabRivetIntegration<TContext extends object = RivetContextLike> {
2257
+ private readonly traceFunctionKey;
2258
+ private readonly runtime;
2259
+ private readonly markedEffects;
2260
+ private readonly replayProxies;
2261
+ /** @internal Constructed by `Bitfab.getRivetIntegration()`. */
2262
+ constructor(traceFunctionKey: string, runtime: RivetIntegrationRuntime, options?: RivetIntegrationOptions);
2263
+ /**
2264
+ * Run a callback with a live Rivet context bound to the current async chain.
2265
+ * This binds context only; it creates no trace or span.
2266
+ */
2267
+ withContext<TReturn>(context: TContext, fn: () => TReturn): TReturn;
2268
+ /**
2269
+ * Adapt a traced function into a Rivet handler whose first argument is the
2270
+ * live actor context. The context is not added to the traced root's inputs.
2271
+ */
2272
+ bind<This, TArgs extends unknown[], TReturn>(fn: (this: This, ...args: TArgs) => TReturn): (this: This, context: TContext, ...args: TArgs) => TReturn;
2273
+ /**
2274
+ * Return the current Rivet context proxy. In production it delegates to the
2275
+ * bound live context. During replay it hydrates recorded actor state and
2276
+ * intercepts supported effects without requiring a live Rivet actor.
2277
+ */
2278
+ getContext(): TContext;
2279
+ private createContextProxy;
2280
+ private createDbProxy;
2281
+ private createGroupProxy;
2282
+ private createMethodProxy;
2283
+ private createEffect;
2284
+ private createTransaction;
2285
+ private decorateQueueMessages;
2286
+ private decorateQueueMessage;
2287
+ private queueCallIsCompletable;
2288
+ private createQueueIterator;
2289
+ }
2290
+
2207
2291
  type TraceTargetOccurrence = "first" | "last" | number;
2208
2292
  type TraceTarget = {
2209
2293
  kind: "output";
@@ -3038,6 +3122,16 @@ declare class Bitfab {
3038
3122
  * @experimental This API may change before it is stable.
3039
3123
  */
3040
3124
  getLangGraphIntegration(traceFunctionKey: string, options?: LangGraphIntegrationOptions): BitfabLangGraphIntegration;
3125
+ /**
3126
+ * Get the first-class Rivet actor-context integration for an existing trace
3127
+ * root. The integration binds context and records effect spans; it never
3128
+ * creates another root.
3129
+ *
3130
+ * @param traceFunctionKey - Key used by the enclosing `withTrace()` root
3131
+ * @param options - Explicit per-context-path replay mocking policy
3132
+ * @experimental This API may change before it is stable.
3133
+ */
3134
+ getRivetIntegration<TContext extends object = RivetContextLike>(traceFunctionKey: string, options?: RivetIntegrationOptions): BitfabRivetIntegration<TContext>;
3041
3135
  /**
3042
3136
  * Get a Claude Agent SDK handler for tracing.
3043
3137
  *
@@ -3353,6 +3447,31 @@ declare class BitfabFunction {
3353
3447
  * @returns A standard ECMAScript method decorator
3354
3448
  */
3355
3449
  span(options?: SpanOptions): SpanMethodDecorator;
3450
+ /**
3451
+ * Wrap a function as an automatically expanded trace root bound to this
3452
+ * function's key.
3453
+ *
3454
+ * Equivalent to `client.withTrace(key, options, fn)` but reuses the key
3455
+ * bound on this handle.
3456
+ *
3457
+ * @param optionsOrFn - Trace options or the workflow entrypoint to wrap
3458
+ * @param maybeFn - Workflow entrypoint when options are provided
3459
+ * @returns A wrapped function with the same signature
3460
+ * @experimental Automatic child-call instrumentation is experimental.
3461
+ */
3462
+ withTrace<This, TArgs extends unknown[], TReturn>(fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
3463
+ withTrace<This, TArgs extends unknown[], TReturn>(options: TraceOptions, fn: (this: This, ...args: TArgs) => TReturn): (this: This, ...args: TArgs) => TReturn;
3464
+ /**
3465
+ * Create a trace method decorator bound to this function's key.
3466
+ *
3467
+ * Equivalent to `client.trace(key, options)` but reuses the key bound on
3468
+ * this handle.
3469
+ *
3470
+ * @param options - Trace configuration applied to the decorated method
3471
+ * @returns A method decorator configured for this key
3472
+ * @experimental Automatic child-call instrumentation is experimental.
3473
+ */
3474
+ trace(options?: TraceOptions): TraceMethodDecorator;
3356
3475
  /**
3357
3476
  * Get a Vercel AI SDK language-model middleware bound to this function's key.
3358
3477
  *
@@ -3440,6 +3559,15 @@ declare class BitfabFunction {
3440
3559
  * @experimental This API may change before it is stable.
3441
3560
  */
3442
3561
  getLangGraphIntegration(options?: LangGraphIntegrationOptions): BitfabLangGraphIntegration;
3562
+ /**
3563
+ * Get the first-class Rivet actor-context integration bound to this key.
3564
+ * Use its `bind()` or `withContext()` outside this handle's `withTrace()`
3565
+ * root, then call `getContext()` inside the root.
3566
+ *
3567
+ * @param options - Explicit per-context-path replay mocking policy
3568
+ * @experimental This API may change before it is stable.
3569
+ */
3570
+ getRivetIntegration<TContext extends object = RivetContextLike>(options?: RivetIntegrationOptions): BitfabRivetIntegration<TContext>;
3443
3571
  /**
3444
3572
  * Wrap a BAML client method to automatically capture prompt and LLM metadata.
3445
3573
  * Delegates to the parent client's wrapBAML method.
@@ -3474,7 +3602,7 @@ interface CommitRef {
3474
3602
  /**
3475
3603
  * SDK version from package.json (injected at build time)
3476
3604
  */
3477
- declare const __version__ = "0.54.9";
3605
+ declare const __version__ = "0.54.10";
3478
3606
 
3479
3607
  /**
3480
3608
  * Constants for the Bitfab SDK.
@@ -3613,4 +3741,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
3613
3741
  run?: boolean;
3614
3742
  }): Promise<SeedResult>;
3615
3743
 
3616
- 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, 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, 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 };
3744
+ 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 };
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  BitfabLangGraphIntegration,
17
17
  BitfabOpenAIAgentHandler,
18
18
  BitfabOpenAITracingProcessor,
19
+ BitfabRivetIntegration,
19
20
  BitfabVercelAiHandler,
20
21
  DatasetsClient,
21
22
  GradersClient,
@@ -29,7 +30,7 @@ import {
29
30
  getCurrentTrace,
30
31
  reseedFromRegistry,
31
32
  seedFromRegistry
32
- } from "./chunk-UKKR2PF4.js";
33
+ } from "./chunk-A3OBQOLV.js";
33
34
  import "./chunk-EGWJYCNT.js";
34
35
  import {
35
36
  BITFAB_PROGRESS_PREFIX,
@@ -38,7 +39,7 @@ import {
38
39
  ReplayError,
39
40
  reportReplayProgress,
40
41
  serializeReplayResult
41
- } from "./chunk-VT5IUVBY.js";
42
+ } from "./chunk-PRXW4B5X.js";
42
43
  import {
43
44
  BitfabError,
44
45
  DEFAULT_SERVICE_URL,
@@ -46,7 +47,7 @@ import {
46
47
  MixedTracingError,
47
48
  __version__,
48
49
  flushTraces
49
- } from "./chunk-7HXFT6JR.js";
50
+ } from "./chunk-B2O33DBH.js";
50
51
  import "./chunk-VCRFFCLY.js";
51
52
  export {
52
53
  AssertionCategoriesClient,
@@ -60,6 +61,7 @@ export {
60
61
  BitfabLangGraphIntegration,
61
62
  BitfabOpenAIAgentHandler,
62
63
  BitfabOpenAITracingProcessor,
64
+ BitfabRivetIntegration,
63
65
  BitfabVercelAiHandler,
64
66
  DEFAULT_SERVICE_URL,
65
67
  DatasetsClient,