@bitfab/sdk 0.36.13 → 0.38.1
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-VOUV7ZTS.js → chunk-MGA7ROIK.js} +42 -9
- package/dist/chunk-MGA7ROIK.js.map +1 -0
- package/dist/{chunk-XAQJOZMJ.js → chunk-WD4AO3BK.js} +12 -5
- package/dist/chunk-WD4AO3BK.js.map +1 -0
- package/dist/index.cjs +51 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -43
- package/dist/index.d.ts +125 -43
- package/dist/index.js +2 -2
- package/dist/node.cjs +51 -11
- 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-WHZFV6OB.js → replay-WSFDZ2UV.js} +2 -2
- package/package.json +2 -1
- package/dist/chunk-VOUV7ZTS.js.map +0 -1
- package/dist/chunk-XAQJOZMJ.js.map +0 -1
- /package/dist/{replay-WHZFV6OB.js.map → replay-WSFDZ2UV.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -223,6 +223,39 @@ interface DbBranchLease {
|
|
|
223
223
|
*/
|
|
224
224
|
region?: string;
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* How long each phase of provisioning one replay branch took, measured
|
|
228
|
+
* server-side. A runner in another region sees these plus its own round trip.
|
|
229
|
+
*
|
|
230
|
+
* Durations, not instants: an instant is approximately `startedAt` plus the
|
|
231
|
+
* running sum, and per-phase wall-clock stamps would make clock skew between
|
|
232
|
+
* the server and your runner look like latency. Approximately, because
|
|
233
|
+
* `totalMs` is the resolve's true wall time and covers a little work no phase
|
|
234
|
+
* owns, so the phases account for it without summing to it exactly.
|
|
235
|
+
*
|
|
236
|
+
* `startedAt` and `totalMs` are always present. The phases are optional
|
|
237
|
+
* because a failed resolve reports only the ones it reached, and `totalMs` is
|
|
238
|
+
* then time-to-failure. On success every phase is present except `warmupMs`,
|
|
239
|
+
* which is absent when no warm-up SQL was supplied.
|
|
240
|
+
*/
|
|
241
|
+
interface DbBranchTimings {
|
|
242
|
+
/** When the resolve began, ISO. */
|
|
243
|
+
startedAt: string;
|
|
244
|
+
/** Resolving the project, plus its retention and region reads. */
|
|
245
|
+
projectResolveMs?: number;
|
|
246
|
+
/** Creating the branch, through its provider operations reaching terminal. */
|
|
247
|
+
branchCreateMs?: number;
|
|
248
|
+
/** Resolving the connection URI. 0 when the provider returns one inline. */
|
|
249
|
+
connectionUriMs?: number;
|
|
250
|
+
/** The compute accepting a connection. */
|
|
251
|
+
computeConnectMs?: number;
|
|
252
|
+
/** The branch answering a readiness query. */
|
|
253
|
+
baseProbeMs?: number;
|
|
254
|
+
/** Your warm-up SQL. Absent when you supplied none. */
|
|
255
|
+
warmupMs?: number;
|
|
256
|
+
/** The whole resolve, or time-to-failure when it threw. */
|
|
257
|
+
totalMs: number;
|
|
258
|
+
}
|
|
226
259
|
/**
|
|
227
260
|
* Wire shape of the caller's `ReplayOptions.dbBranch`, sent to
|
|
228
261
|
* `/api/sdk/replay/start` and applied per lease.
|
|
@@ -275,6 +308,14 @@ interface ReplayContext {
|
|
|
275
308
|
*/
|
|
276
309
|
fetchSpanOutput?: (externalSpanId: string) => Promise<unknown>;
|
|
277
310
|
dbBranchLease?: DbBranchLease;
|
|
311
|
+
/**
|
|
312
|
+
* Server-measured provisioning timings for this item's branch, echoed back
|
|
313
|
+
* on the trace completion so the trace records what it cost to set up. Kept
|
|
314
|
+
* off `ReplayBranch`: customer code reads that mid-replay to reach the
|
|
315
|
+
* branch, and provisioning latency is a property of the run, not of the
|
|
316
|
+
* connection.
|
|
317
|
+
*/
|
|
318
|
+
dbBranchTimings?: DbBranchTimings;
|
|
278
319
|
/**
|
|
279
320
|
* Set to true by `ReplayBranch` the first time customer code actually
|
|
280
321
|
* obtains `databaseUrl` for this item. Reported on the trace completion inside
|
|
@@ -570,6 +611,7 @@ declare class HttpClient {
|
|
|
570
611
|
code: string;
|
|
571
612
|
message: string;
|
|
572
613
|
} | null;
|
|
614
|
+
timings: DbBranchTimings | null;
|
|
573
615
|
}>;
|
|
574
616
|
/** Release a previously-resolved DB branch by deleting its Neon branch. Idempotent server-side. */
|
|
575
617
|
releaseDbBranchLease(neonBranchId: string): Promise<void>;
|
|
@@ -628,6 +670,13 @@ interface StartReplayResponse {
|
|
|
628
670
|
code: string;
|
|
629
671
|
message: string;
|
|
630
672
|
};
|
|
673
|
+
/**
|
|
674
|
+
* How long provisioning took, per phase. Sits beside the two fields above
|
|
675
|
+
* rather than inside either: it is reported on both outcomes, complete on
|
|
676
|
+
* success and partial up to the failing phase on error. Absent from
|
|
677
|
+
* servers that predate it.
|
|
678
|
+
*/
|
|
679
|
+
dbBranchTimings?: DbBranchTimings;
|
|
631
680
|
}>;
|
|
632
681
|
}
|
|
633
682
|
interface ExternalSpanResponse {
|
|
@@ -1343,42 +1392,52 @@ interface ReplayItemFinishProgress {
|
|
|
1343
1392
|
/** Of the completed items, how many have `item.error` set. */
|
|
1344
1393
|
errored: number;
|
|
1345
1394
|
/**
|
|
1346
|
-
* The single item that just finished to produce this event.
|
|
1347
|
-
*
|
|
1348
|
-
* `
|
|
1349
|
-
*
|
|
1350
|
-
*
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1395
|
+
* The single item that just finished to produce this event. Field-for-field
|
|
1396
|
+
* the same shape and meaning as {@link ReplayItem}, so a progress UI and a
|
|
1397
|
+
* final-result UI read one contract. `traceId` is null at this stage (the
|
|
1398
|
+
* server replay id arrives at completion), and `tokens` is null for the same
|
|
1399
|
+
* reason: the replayed run's usage is aggregated server-side by
|
|
1400
|
+
* completeReplay. `durationMs` is how long this item took to replay; the
|
|
1401
|
+
* `original*` fields describe the trace it replayed.
|
|
1353
1402
|
*/
|
|
1354
|
-
item:
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1403
|
+
item: ReplayProgressItem;
|
|
1404
|
+
}
|
|
1405
|
+
/** See {@link ReplayItemFinishProgress.item}. Mirrors {@link ReplayItem}. */
|
|
1406
|
+
interface ReplayProgressItem {
|
|
1407
|
+
/** Trace ID of the new replay trace (null during the run; the server id arrives at completion). */
|
|
1408
|
+
traceId?: string | null;
|
|
1409
|
+
/** Bitfab trace ID of the original (historical) trace being replayed. */
|
|
1410
|
+
originalTraceId: string | null;
|
|
1411
|
+
/** External span ID the recorded inputs were read from (the original root span). */
|
|
1412
|
+
originalSpanId?: string | null;
|
|
1413
|
+
/** @deprecated alias for `originalTraceId`. */
|
|
1414
|
+
sourceTraceId: string | null;
|
|
1415
|
+
/** @deprecated alias for `originalSpanId`. */
|
|
1416
|
+
sourceSpanId?: string | null;
|
|
1417
|
+
/** Deserialized inputs from the original trace. */
|
|
1418
|
+
input?: unknown[];
|
|
1419
|
+
/** The result returned by the replayed function, or undefined on error. */
|
|
1420
|
+
result?: unknown;
|
|
1421
|
+
/** The original output from the historical trace. */
|
|
1422
|
+
originalOutput?: unknown;
|
|
1423
|
+
/** Backward-compatible message for either error kind. */
|
|
1424
|
+
error: string | null;
|
|
1425
|
+
/** The actual value thrown by the replayed customer function. */
|
|
1426
|
+
traceError?: unknown | null;
|
|
1427
|
+
/** The actual value thrown while Bitfab prepared this replay item. */
|
|
1428
|
+
replayError?: unknown | null;
|
|
1429
|
+
/** How long the replayed function took on this run. */
|
|
1430
|
+
durationMs?: number | null;
|
|
1431
|
+
/** The original trace's duration, tokens, and model. */
|
|
1432
|
+
originalDurationMs?: number | null;
|
|
1433
|
+
originalTokens?: TokenUsage | null;
|
|
1434
|
+
originalModel?: string | null;
|
|
1435
|
+
/** Always null here: the replayed run's usage is only known at completion. */
|
|
1436
|
+
tokens?: TokenUsage | null;
|
|
1437
|
+
/** @deprecated renamed to `originalModel`. */
|
|
1438
|
+
model?: string | null;
|
|
1439
|
+
dbSnapshotRef?: DbSnapshotRef | null;
|
|
1440
|
+
dbBranchTimings?: DbBranchTimings | null;
|
|
1382
1441
|
}
|
|
1383
1442
|
/**
|
|
1384
1443
|
* @deprecated Use {@link ReplayItemFinishProgress}. This legacy shape also
|
|
@@ -1482,17 +1541,32 @@ interface ReplayItem<T> {
|
|
|
1482
1541
|
* such as database warmup, input hydration, or mock preparation.
|
|
1483
1542
|
*/
|
|
1484
1543
|
replayError: unknown | null;
|
|
1485
|
-
/**
|
|
1544
|
+
/**
|
|
1545
|
+
* How long the replayed function took on this run, in ms. Null if the item
|
|
1546
|
+
* failed before it ran. Compare against
|
|
1547
|
+
* {@link ReplayItem.originalDurationMs} for the before/after.
|
|
1548
|
+
*/
|
|
1486
1549
|
durationMs: number | null;
|
|
1550
|
+
/** The original trace's duration in ms, or null if its timestamps are missing. */
|
|
1551
|
+
originalDurationMs: number | null;
|
|
1552
|
+
/**
|
|
1553
|
+
* Token usage recorded on the original trace, or null if it captured none.
|
|
1554
|
+
* The "old" side of a token delta; {@link ReplayItem.tokens} is the new one.
|
|
1555
|
+
*/
|
|
1556
|
+
originalTokens: TokenUsage | null;
|
|
1557
|
+
/** Model name from the original trace, or null if not captured. */
|
|
1558
|
+
originalModel: string | null;
|
|
1487
1559
|
/**
|
|
1488
1560
|
* Token usage from the REPLAYED run (this item's new execution), aggregated
|
|
1489
1561
|
* server-side from the spans it produced, or null if the run captured no
|
|
1490
|
-
* token data.
|
|
1491
|
-
* the
|
|
1492
|
-
*
|
|
1562
|
+
* token data. Compare against {@link ReplayItem.originalTokens} to see how
|
|
1563
|
+
* the code change moved cost. Matches what Studio's experiments view shows.
|
|
1564
|
+
*
|
|
1565
|
+
* Unprefixed because the replay is this item's subject: anything describing
|
|
1566
|
+
* the trace being replayed carries `original`.
|
|
1493
1567
|
*/
|
|
1494
1568
|
tokens: TokenUsage | null;
|
|
1495
|
-
/**
|
|
1569
|
+
/** @deprecated renamed to {@link ReplayItem.originalModel}. */
|
|
1496
1570
|
model: string | null;
|
|
1497
1571
|
/**
|
|
1498
1572
|
* The DB snapshot ref the SDK captured at trace open. Useful for debugging
|
|
@@ -1501,6 +1575,14 @@ interface ReplayItem<T> {
|
|
|
1501
1575
|
* without `dbSnapshot` configured.
|
|
1502
1576
|
*/
|
|
1503
1577
|
dbSnapshotRef: DbSnapshotRef | null;
|
|
1578
|
+
/**
|
|
1579
|
+
* How long this item's DB branch took to provision, per phase, measured
|
|
1580
|
+
* server-side. Present whenever a branch was attempted, on both outcomes:
|
|
1581
|
+
* complete on success, partial up to the failing phase when the resolve
|
|
1582
|
+
* failed. Null when no branch was asked for, when the source trace carried
|
|
1583
|
+
* no snapshot ref, or against a server that predates timings.
|
|
1584
|
+
*/
|
|
1585
|
+
dbBranchTimings: DbBranchTimings | null;
|
|
1504
1586
|
}
|
|
1505
1587
|
|
|
1506
1588
|
interface ReplayResult<T> {
|
|
@@ -2574,14 +2656,14 @@ declare class BitfabFunction {
|
|
|
2574
2656
|
}
|
|
2575
2657
|
|
|
2576
2658
|
/**
|
|
2577
|
-
* Auto-generated
|
|
2659
|
+
* Auto-generated package metadata.
|
|
2578
2660
|
* This file is generated by scripts/generate-version.ts during build.
|
|
2579
2661
|
* DO NOT EDIT MANUALLY.
|
|
2580
2662
|
*/
|
|
2581
2663
|
/**
|
|
2582
2664
|
* SDK version from package.json (injected at build time)
|
|
2583
2665
|
*/
|
|
2584
|
-
declare const __version__ = "0.
|
|
2666
|
+
declare const __version__ = "0.38.1";
|
|
2585
2667
|
|
|
2586
2668
|
/**
|
|
2587
2669
|
* Constants for the Bitfab SDK.
|
|
@@ -2649,4 +2731,4 @@ declare const finalizers: {
|
|
|
2649
2731
|
readableStream: typeof readableStream;
|
|
2650
2732
|
};
|
|
2651
2733
|
|
|
2652
|
-
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 ReplayItemFinishProgress, type ReplayItemStartProgress, 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 };
|
|
2734
|
+
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 ReplayProgress, type ReplayProgressItem, 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
|
@@ -223,6 +223,39 @@ interface DbBranchLease {
|
|
|
223
223
|
*/
|
|
224
224
|
region?: string;
|
|
225
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* How long each phase of provisioning one replay branch took, measured
|
|
228
|
+
* server-side. A runner in another region sees these plus its own round trip.
|
|
229
|
+
*
|
|
230
|
+
* Durations, not instants: an instant is approximately `startedAt` plus the
|
|
231
|
+
* running sum, and per-phase wall-clock stamps would make clock skew between
|
|
232
|
+
* the server and your runner look like latency. Approximately, because
|
|
233
|
+
* `totalMs` is the resolve's true wall time and covers a little work no phase
|
|
234
|
+
* owns, so the phases account for it without summing to it exactly.
|
|
235
|
+
*
|
|
236
|
+
* `startedAt` and `totalMs` are always present. The phases are optional
|
|
237
|
+
* because a failed resolve reports only the ones it reached, and `totalMs` is
|
|
238
|
+
* then time-to-failure. On success every phase is present except `warmupMs`,
|
|
239
|
+
* which is absent when no warm-up SQL was supplied.
|
|
240
|
+
*/
|
|
241
|
+
interface DbBranchTimings {
|
|
242
|
+
/** When the resolve began, ISO. */
|
|
243
|
+
startedAt: string;
|
|
244
|
+
/** Resolving the project, plus its retention and region reads. */
|
|
245
|
+
projectResolveMs?: number;
|
|
246
|
+
/** Creating the branch, through its provider operations reaching terminal. */
|
|
247
|
+
branchCreateMs?: number;
|
|
248
|
+
/** Resolving the connection URI. 0 when the provider returns one inline. */
|
|
249
|
+
connectionUriMs?: number;
|
|
250
|
+
/** The compute accepting a connection. */
|
|
251
|
+
computeConnectMs?: number;
|
|
252
|
+
/** The branch answering a readiness query. */
|
|
253
|
+
baseProbeMs?: number;
|
|
254
|
+
/** Your warm-up SQL. Absent when you supplied none. */
|
|
255
|
+
warmupMs?: number;
|
|
256
|
+
/** The whole resolve, or time-to-failure when it threw. */
|
|
257
|
+
totalMs: number;
|
|
258
|
+
}
|
|
226
259
|
/**
|
|
227
260
|
* Wire shape of the caller's `ReplayOptions.dbBranch`, sent to
|
|
228
261
|
* `/api/sdk/replay/start` and applied per lease.
|
|
@@ -275,6 +308,14 @@ interface ReplayContext {
|
|
|
275
308
|
*/
|
|
276
309
|
fetchSpanOutput?: (externalSpanId: string) => Promise<unknown>;
|
|
277
310
|
dbBranchLease?: DbBranchLease;
|
|
311
|
+
/**
|
|
312
|
+
* Server-measured provisioning timings for this item's branch, echoed back
|
|
313
|
+
* on the trace completion so the trace records what it cost to set up. Kept
|
|
314
|
+
* off `ReplayBranch`: customer code reads that mid-replay to reach the
|
|
315
|
+
* branch, and provisioning latency is a property of the run, not of the
|
|
316
|
+
* connection.
|
|
317
|
+
*/
|
|
318
|
+
dbBranchTimings?: DbBranchTimings;
|
|
278
319
|
/**
|
|
279
320
|
* Set to true by `ReplayBranch` the first time customer code actually
|
|
280
321
|
* obtains `databaseUrl` for this item. Reported on the trace completion inside
|
|
@@ -570,6 +611,7 @@ declare class HttpClient {
|
|
|
570
611
|
code: string;
|
|
571
612
|
message: string;
|
|
572
613
|
} | null;
|
|
614
|
+
timings: DbBranchTimings | null;
|
|
573
615
|
}>;
|
|
574
616
|
/** Release a previously-resolved DB branch by deleting its Neon branch. Idempotent server-side. */
|
|
575
617
|
releaseDbBranchLease(neonBranchId: string): Promise<void>;
|
|
@@ -628,6 +670,13 @@ interface StartReplayResponse {
|
|
|
628
670
|
code: string;
|
|
629
671
|
message: string;
|
|
630
672
|
};
|
|
673
|
+
/**
|
|
674
|
+
* How long provisioning took, per phase. Sits beside the two fields above
|
|
675
|
+
* rather than inside either: it is reported on both outcomes, complete on
|
|
676
|
+
* success and partial up to the failing phase on error. Absent from
|
|
677
|
+
* servers that predate it.
|
|
678
|
+
*/
|
|
679
|
+
dbBranchTimings?: DbBranchTimings;
|
|
631
680
|
}>;
|
|
632
681
|
}
|
|
633
682
|
interface ExternalSpanResponse {
|
|
@@ -1343,42 +1392,52 @@ interface ReplayItemFinishProgress {
|
|
|
1343
1392
|
/** Of the completed items, how many have `item.error` set. */
|
|
1344
1393
|
errored: number;
|
|
1345
1394
|
/**
|
|
1346
|
-
* The single item that just finished to produce this event.
|
|
1347
|
-
*
|
|
1348
|
-
* `
|
|
1349
|
-
*
|
|
1350
|
-
*
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1395
|
+
* The single item that just finished to produce this event. Field-for-field
|
|
1396
|
+
* the same shape and meaning as {@link ReplayItem}, so a progress UI and a
|
|
1397
|
+
* final-result UI read one contract. `traceId` is null at this stage (the
|
|
1398
|
+
* server replay id arrives at completion), and `tokens` is null for the same
|
|
1399
|
+
* reason: the replayed run's usage is aggregated server-side by
|
|
1400
|
+
* completeReplay. `durationMs` is how long this item took to replay; the
|
|
1401
|
+
* `original*` fields describe the trace it replayed.
|
|
1353
1402
|
*/
|
|
1354
|
-
item:
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1403
|
+
item: ReplayProgressItem;
|
|
1404
|
+
}
|
|
1405
|
+
/** See {@link ReplayItemFinishProgress.item}. Mirrors {@link ReplayItem}. */
|
|
1406
|
+
interface ReplayProgressItem {
|
|
1407
|
+
/** Trace ID of the new replay trace (null during the run; the server id arrives at completion). */
|
|
1408
|
+
traceId?: string | null;
|
|
1409
|
+
/** Bitfab trace ID of the original (historical) trace being replayed. */
|
|
1410
|
+
originalTraceId: string | null;
|
|
1411
|
+
/** External span ID the recorded inputs were read from (the original root span). */
|
|
1412
|
+
originalSpanId?: string | null;
|
|
1413
|
+
/** @deprecated alias for `originalTraceId`. */
|
|
1414
|
+
sourceTraceId: string | null;
|
|
1415
|
+
/** @deprecated alias for `originalSpanId`. */
|
|
1416
|
+
sourceSpanId?: string | null;
|
|
1417
|
+
/** Deserialized inputs from the original trace. */
|
|
1418
|
+
input?: unknown[];
|
|
1419
|
+
/** The result returned by the replayed function, or undefined on error. */
|
|
1420
|
+
result?: unknown;
|
|
1421
|
+
/** The original output from the historical trace. */
|
|
1422
|
+
originalOutput?: unknown;
|
|
1423
|
+
/** Backward-compatible message for either error kind. */
|
|
1424
|
+
error: string | null;
|
|
1425
|
+
/** The actual value thrown by the replayed customer function. */
|
|
1426
|
+
traceError?: unknown | null;
|
|
1427
|
+
/** The actual value thrown while Bitfab prepared this replay item. */
|
|
1428
|
+
replayError?: unknown | null;
|
|
1429
|
+
/** How long the replayed function took on this run. */
|
|
1430
|
+
durationMs?: number | null;
|
|
1431
|
+
/** The original trace's duration, tokens, and model. */
|
|
1432
|
+
originalDurationMs?: number | null;
|
|
1433
|
+
originalTokens?: TokenUsage | null;
|
|
1434
|
+
originalModel?: string | null;
|
|
1435
|
+
/** Always null here: the replayed run's usage is only known at completion. */
|
|
1436
|
+
tokens?: TokenUsage | null;
|
|
1437
|
+
/** @deprecated renamed to `originalModel`. */
|
|
1438
|
+
model?: string | null;
|
|
1439
|
+
dbSnapshotRef?: DbSnapshotRef | null;
|
|
1440
|
+
dbBranchTimings?: DbBranchTimings | null;
|
|
1382
1441
|
}
|
|
1383
1442
|
/**
|
|
1384
1443
|
* @deprecated Use {@link ReplayItemFinishProgress}. This legacy shape also
|
|
@@ -1482,17 +1541,32 @@ interface ReplayItem<T> {
|
|
|
1482
1541
|
* such as database warmup, input hydration, or mock preparation.
|
|
1483
1542
|
*/
|
|
1484
1543
|
replayError: unknown | null;
|
|
1485
|
-
/**
|
|
1544
|
+
/**
|
|
1545
|
+
* How long the replayed function took on this run, in ms. Null if the item
|
|
1546
|
+
* failed before it ran. Compare against
|
|
1547
|
+
* {@link ReplayItem.originalDurationMs} for the before/after.
|
|
1548
|
+
*/
|
|
1486
1549
|
durationMs: number | null;
|
|
1550
|
+
/** The original trace's duration in ms, or null if its timestamps are missing. */
|
|
1551
|
+
originalDurationMs: number | null;
|
|
1552
|
+
/**
|
|
1553
|
+
* Token usage recorded on the original trace, or null if it captured none.
|
|
1554
|
+
* The "old" side of a token delta; {@link ReplayItem.tokens} is the new one.
|
|
1555
|
+
*/
|
|
1556
|
+
originalTokens: TokenUsage | null;
|
|
1557
|
+
/** Model name from the original trace, or null if not captured. */
|
|
1558
|
+
originalModel: string | null;
|
|
1487
1559
|
/**
|
|
1488
1560
|
* Token usage from the REPLAYED run (this item's new execution), aggregated
|
|
1489
1561
|
* server-side from the spans it produced, or null if the run captured no
|
|
1490
|
-
* token data.
|
|
1491
|
-
* the
|
|
1492
|
-
*
|
|
1562
|
+
* token data. Compare against {@link ReplayItem.originalTokens} to see how
|
|
1563
|
+
* the code change moved cost. Matches what Studio's experiments view shows.
|
|
1564
|
+
*
|
|
1565
|
+
* Unprefixed because the replay is this item's subject: anything describing
|
|
1566
|
+
* the trace being replayed carries `original`.
|
|
1493
1567
|
*/
|
|
1494
1568
|
tokens: TokenUsage | null;
|
|
1495
|
-
/**
|
|
1569
|
+
/** @deprecated renamed to {@link ReplayItem.originalModel}. */
|
|
1496
1570
|
model: string | null;
|
|
1497
1571
|
/**
|
|
1498
1572
|
* The DB snapshot ref the SDK captured at trace open. Useful for debugging
|
|
@@ -1501,6 +1575,14 @@ interface ReplayItem<T> {
|
|
|
1501
1575
|
* without `dbSnapshot` configured.
|
|
1502
1576
|
*/
|
|
1503
1577
|
dbSnapshotRef: DbSnapshotRef | null;
|
|
1578
|
+
/**
|
|
1579
|
+
* How long this item's DB branch took to provision, per phase, measured
|
|
1580
|
+
* server-side. Present whenever a branch was attempted, on both outcomes:
|
|
1581
|
+
* complete on success, partial up to the failing phase when the resolve
|
|
1582
|
+
* failed. Null when no branch was asked for, when the source trace carried
|
|
1583
|
+
* no snapshot ref, or against a server that predates timings.
|
|
1584
|
+
*/
|
|
1585
|
+
dbBranchTimings: DbBranchTimings | null;
|
|
1504
1586
|
}
|
|
1505
1587
|
|
|
1506
1588
|
interface ReplayResult<T> {
|
|
@@ -2574,14 +2656,14 @@ declare class BitfabFunction {
|
|
|
2574
2656
|
}
|
|
2575
2657
|
|
|
2576
2658
|
/**
|
|
2577
|
-
* Auto-generated
|
|
2659
|
+
* Auto-generated package metadata.
|
|
2578
2660
|
* This file is generated by scripts/generate-version.ts during build.
|
|
2579
2661
|
* DO NOT EDIT MANUALLY.
|
|
2580
2662
|
*/
|
|
2581
2663
|
/**
|
|
2582
2664
|
* SDK version from package.json (injected at build time)
|
|
2583
2665
|
*/
|
|
2584
|
-
declare const __version__ = "0.
|
|
2666
|
+
declare const __version__ = "0.38.1";
|
|
2585
2667
|
|
|
2586
2668
|
/**
|
|
2587
2669
|
* Constants for the Bitfab SDK.
|
|
@@ -2649,4 +2731,4 @@ declare const finalizers: {
|
|
|
2649
2731
|
readableStream: typeof readableStream;
|
|
2650
2732
|
};
|
|
2651
2733
|
|
|
2652
|
-
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 ReplayItemFinishProgress, type ReplayItemStartProgress, 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 };
|
|
2734
|
+
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 ReplayProgress, type ReplayProgressItem, 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
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getCurrentReplayBranch,
|
|
12
12
|
getCurrentSpan,
|
|
13
13
|
getCurrentTrace
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WD4AO3BK.js";
|
|
15
15
|
import {
|
|
16
16
|
BITFAB_PROGRESS_PREFIX,
|
|
17
17
|
BitfabError,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
flushTraces,
|
|
24
24
|
reportReplayProgress,
|
|
25
25
|
serializeReplayResult
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-MGA7ROIK.js";
|
|
27
27
|
export {
|
|
28
28
|
BITFAB_PROGRESS_PREFIX,
|
|
29
29
|
Bitfab,
|