bitfab 0.13.5 → 0.13.7
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-BVFST7Q3.js → chunk-EGRWBJYR.js} +9 -6
- package/dist/chunk-EGRWBJYR.js.map +1 -0
- package/dist/{chunk-4IHJJRMU.js → chunk-LUZVIGER.js} +6 -31
- package/dist/chunk-LUZVIGER.js.map +1 -0
- package/dist/index.cjs +15 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -25
- package/dist/index.d.ts +7 -25
- package/dist/index.js +2 -2
- package/dist/node.cjs +15 -36
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-CLQKO7U7.js → replay-VXZJBR34.js} +6 -5
- package/dist/replay-VXZJBR34.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-4IHJJRMU.js.map +0 -1
- package/dist/chunk-BVFST7Q3.js.map +0 -1
- package/dist/replay-CLQKO7U7.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -151,14 +151,8 @@ declare class BitfabClaudeAgentHandler {
|
|
|
151
151
|
* `DbSnapshotRef` that pins the DB state at trace open by wall-clock
|
|
152
152
|
* timestamp. The Bitfab service uses that timestamp at replay time to
|
|
153
153
|
* materialize an ephemeral branch from `customer-main`.
|
|
154
|
-
*
|
|
155
|
-
* v0 is timestamp-only. LSN-based pinning is intentionally not exposed
|
|
156
|
-
* yet — the customer-LSN to replica-LSN mapping isn't built, so the
|
|
157
|
-
* mapping primitive would have no resolver to consume it. The
|
|
158
|
-
* `DbSnapshotRef.ref` field is reserved for that future use.
|
|
159
154
|
*/
|
|
160
|
-
|
|
161
|
-
declare const SUPPORTED_PROVIDERS: readonly ["neon", "ardent", "dolt", "gfs", "mongodb-atlas", "dynamodb", "snowflake", "bigquery"];
|
|
155
|
+
declare const SUPPORTED_PROVIDERS: readonly ["neon"];
|
|
162
156
|
type DbSnapshotProvider = (typeof SUPPORTED_PROVIDERS)[number];
|
|
163
157
|
interface DbSnapshotConfig {
|
|
164
158
|
/** Discriminator for the server-side resolver. */
|
|
@@ -168,18 +162,11 @@ interface DbSnapshotRef {
|
|
|
168
162
|
provider: DbSnapshotProvider;
|
|
169
163
|
/**
|
|
170
164
|
* The wall-clock ISO timestamp the SDK observed immediately before
|
|
171
|
-
* invoking the wrapped function.
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* before user code began executing — distinct from server-side or
|
|
175
|
-
* DB-side timestamps recorded elsewhere on the trace.
|
|
165
|
+
* invoking the wrapped function. The name encodes its provenance:
|
|
166
|
+
* SDK-observed, wall clock (not monotonic), captured before user code
|
|
167
|
+
* began executing.
|
|
176
168
|
*/
|
|
177
169
|
sdkWallClockBeforeFn: string;
|
|
178
|
-
/**
|
|
179
|
-
* Reserved for future provider-specific opaque payload (e.g. customer
|
|
180
|
-
* LSN once a source-to-replica mapping exists). Unused in v0.
|
|
181
|
-
*/
|
|
182
|
-
ref?: Record<string, unknown>;
|
|
183
170
|
}
|
|
184
171
|
|
|
185
172
|
/**
|
|
@@ -317,7 +304,6 @@ interface ReplayEnvironmentSnapshot {
|
|
|
317
304
|
providerConsoleUrl?: string;
|
|
318
305
|
readOnly?: boolean;
|
|
319
306
|
traceId: string;
|
|
320
|
-
precision: "timestamp" | "lsn";
|
|
321
307
|
}
|
|
322
308
|
declare class ReplayEnvironment {
|
|
323
309
|
/**
|
|
@@ -337,12 +323,6 @@ declare class ReplayEnvironment {
|
|
|
337
323
|
get readOnly(): boolean | undefined;
|
|
338
324
|
/** The historical trace ID that produced the input for this replay item. */
|
|
339
325
|
get traceId(): string;
|
|
340
|
-
/**
|
|
341
|
-
* How the resolver pinned this branch.
|
|
342
|
-
* - "timestamp": snapshot at SDK wall clock; bounded by replication lag.
|
|
343
|
-
* - "lsn": customer LSN mapped to a replica snapshot (future).
|
|
344
|
-
*/
|
|
345
|
-
get precision(): "timestamp" | "lsn";
|
|
346
326
|
/** True when read inside a replay item that has a resolved branch. */
|
|
347
327
|
get active(): boolean;
|
|
348
328
|
/** Non-throwing variant for callers that handle the inactive case. */
|
|
@@ -394,6 +374,8 @@ interface ReplayOptions {
|
|
|
394
374
|
* environment to pick up the per-trace branch URL.
|
|
395
375
|
*/
|
|
396
376
|
environment?: ReplayEnvironment;
|
|
377
|
+
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
378
|
+
experimentGroupId?: string;
|
|
397
379
|
}
|
|
398
380
|
interface ReplayItem<T> {
|
|
399
381
|
/** Trace ID of the new trace created during replay. */
|
|
@@ -1008,7 +990,7 @@ declare class BitfabFunction {
|
|
|
1008
990
|
/**
|
|
1009
991
|
* SDK version from package.json (injected at build time)
|
|
1010
992
|
*/
|
|
1011
|
-
declare const __version__ = "0.13.
|
|
993
|
+
declare const __version__ = "0.13.7";
|
|
1012
994
|
|
|
1013
995
|
/**
|
|
1014
996
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -151,14 +151,8 @@ declare class BitfabClaudeAgentHandler {
|
|
|
151
151
|
* `DbSnapshotRef` that pins the DB state at trace open by wall-clock
|
|
152
152
|
* timestamp. The Bitfab service uses that timestamp at replay time to
|
|
153
153
|
* materialize an ephemeral branch from `customer-main`.
|
|
154
|
-
*
|
|
155
|
-
* v0 is timestamp-only. LSN-based pinning is intentionally not exposed
|
|
156
|
-
* yet — the customer-LSN to replica-LSN mapping isn't built, so the
|
|
157
|
-
* mapping primitive would have no resolver to consume it. The
|
|
158
|
-
* `DbSnapshotRef.ref` field is reserved for that future use.
|
|
159
154
|
*/
|
|
160
|
-
|
|
161
|
-
declare const SUPPORTED_PROVIDERS: readonly ["neon", "ardent", "dolt", "gfs", "mongodb-atlas", "dynamodb", "snowflake", "bigquery"];
|
|
155
|
+
declare const SUPPORTED_PROVIDERS: readonly ["neon"];
|
|
162
156
|
type DbSnapshotProvider = (typeof SUPPORTED_PROVIDERS)[number];
|
|
163
157
|
interface DbSnapshotConfig {
|
|
164
158
|
/** Discriminator for the server-side resolver. */
|
|
@@ -168,18 +162,11 @@ interface DbSnapshotRef {
|
|
|
168
162
|
provider: DbSnapshotProvider;
|
|
169
163
|
/**
|
|
170
164
|
* The wall-clock ISO timestamp the SDK observed immediately before
|
|
171
|
-
* invoking the wrapped function.
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* before user code began executing — distinct from server-side or
|
|
175
|
-
* DB-side timestamps recorded elsewhere on the trace.
|
|
165
|
+
* invoking the wrapped function. The name encodes its provenance:
|
|
166
|
+
* SDK-observed, wall clock (not monotonic), captured before user code
|
|
167
|
+
* began executing.
|
|
176
168
|
*/
|
|
177
169
|
sdkWallClockBeforeFn: string;
|
|
178
|
-
/**
|
|
179
|
-
* Reserved for future provider-specific opaque payload (e.g. customer
|
|
180
|
-
* LSN once a source-to-replica mapping exists). Unused in v0.
|
|
181
|
-
*/
|
|
182
|
-
ref?: Record<string, unknown>;
|
|
183
170
|
}
|
|
184
171
|
|
|
185
172
|
/**
|
|
@@ -317,7 +304,6 @@ interface ReplayEnvironmentSnapshot {
|
|
|
317
304
|
providerConsoleUrl?: string;
|
|
318
305
|
readOnly?: boolean;
|
|
319
306
|
traceId: string;
|
|
320
|
-
precision: "timestamp" | "lsn";
|
|
321
307
|
}
|
|
322
308
|
declare class ReplayEnvironment {
|
|
323
309
|
/**
|
|
@@ -337,12 +323,6 @@ declare class ReplayEnvironment {
|
|
|
337
323
|
get readOnly(): boolean | undefined;
|
|
338
324
|
/** The historical trace ID that produced the input for this replay item. */
|
|
339
325
|
get traceId(): string;
|
|
340
|
-
/**
|
|
341
|
-
* How the resolver pinned this branch.
|
|
342
|
-
* - "timestamp": snapshot at SDK wall clock; bounded by replication lag.
|
|
343
|
-
* - "lsn": customer LSN mapped to a replica snapshot (future).
|
|
344
|
-
*/
|
|
345
|
-
get precision(): "timestamp" | "lsn";
|
|
346
326
|
/** True when read inside a replay item that has a resolved branch. */
|
|
347
327
|
get active(): boolean;
|
|
348
328
|
/** Non-throwing variant for callers that handle the inactive case. */
|
|
@@ -394,6 +374,8 @@ interface ReplayOptions {
|
|
|
394
374
|
* environment to pick up the per-trace branch URL.
|
|
395
375
|
*/
|
|
396
376
|
environment?: ReplayEnvironment;
|
|
377
|
+
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
378
|
+
experimentGroupId?: string;
|
|
397
379
|
}
|
|
398
380
|
interface ReplayItem<T> {
|
|
399
381
|
/** Trace ID of the new trace created during replay. */
|
|
@@ -1008,7 +990,7 @@ declare class BitfabFunction {
|
|
|
1008
990
|
/**
|
|
1009
991
|
* SDK version from package.json (injected at build time)
|
|
1010
992
|
*/
|
|
1011
|
-
declare const __version__ = "0.13.
|
|
993
|
+
declare const __version__ = "0.13.7";
|
|
1012
994
|
|
|
1013
995
|
/**
|
|
1014
996
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -17,13 +17,13 @@ import {
|
|
|
17
17
|
SUPPORTED_PROVIDERS,
|
|
18
18
|
getCurrentSpan,
|
|
19
19
|
getCurrentTrace
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LUZVIGER.js";
|
|
21
21
|
import {
|
|
22
22
|
BitfabError,
|
|
23
23
|
DEFAULT_SERVICE_URL,
|
|
24
24
|
__version__,
|
|
25
25
|
flushTraces
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EGRWBJYR.js";
|
|
27
27
|
export {
|
|
28
28
|
Bitfab,
|
|
29
29
|
BitfabClaudeAgentHandler,
|
package/dist/node.cjs
CHANGED
|
@@ -90,7 +90,7 @@ var __version__;
|
|
|
90
90
|
var init_version_generated = __esm({
|
|
91
91
|
"src/version.generated.ts"() {
|
|
92
92
|
"use strict";
|
|
93
|
-
__version__ = "0.13.
|
|
93
|
+
__version__ = "0.13.7";
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
|
|
@@ -321,7 +321,7 @@ var init_http = __esm({
|
|
|
321
321
|
* Start a replay session by fetching historical traces.
|
|
322
322
|
* Blocking call — creates a test run and returns lightweight item references.
|
|
323
323
|
*/
|
|
324
|
-
async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease) {
|
|
324
|
+
async startReplay(traceFunctionKey, limit, traceIds, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId) {
|
|
325
325
|
const payload = { traceFunctionKey, limit };
|
|
326
326
|
if (traceIds) {
|
|
327
327
|
payload.traceIds = traceIds;
|
|
@@ -335,6 +335,9 @@ var init_http = __esm({
|
|
|
335
335
|
if (includeDbBranchLease) {
|
|
336
336
|
payload.includeDbBranchLease = true;
|
|
337
337
|
}
|
|
338
|
+
if (experimentGroupId !== void 0) {
|
|
339
|
+
payload.experimentGroupId = experimentGroupId;
|
|
340
|
+
}
|
|
338
341
|
const timeout = includeDbBranchLease ? 18e4 : 3e4;
|
|
339
342
|
return this.request("/api/sdk/replay/start", payload, {
|
|
340
343
|
timeout
|
|
@@ -436,11 +439,11 @@ var init_http = __esm({
|
|
|
436
439
|
{ timeout: 9e4 }
|
|
437
440
|
);
|
|
438
441
|
}
|
|
439
|
-
/** Release a previously-resolved DB branch
|
|
440
|
-
async releaseDbBranchLease(
|
|
442
|
+
/** Release a previously-resolved DB branch by deleting its Neon branch. Idempotent server-side. */
|
|
443
|
+
async releaseDbBranchLease(neonBranchId) {
|
|
441
444
|
await this.request(
|
|
442
445
|
"/api/sdk/replay/releaseDbBranchLease",
|
|
443
|
-
{
|
|
446
|
+
{ neonBranchId },
|
|
444
447
|
{ timeout: 3e4 }
|
|
445
448
|
);
|
|
446
449
|
}
|
|
@@ -621,11 +624,11 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
621
624
|
} finally {
|
|
622
625
|
if (lease) {
|
|
623
626
|
try {
|
|
624
|
-
await httpClient.releaseDbBranchLease(lease.
|
|
627
|
+
await httpClient.releaseDbBranchLease(lease.neonBranchId);
|
|
625
628
|
} catch (e) {
|
|
626
629
|
try {
|
|
627
630
|
console.warn(
|
|
628
|
-
`Bitfab: failed to release DB branch
|
|
631
|
+
`Bitfab: failed to release DB branch ${lease.neonBranchId} (TTL janitor will catch it): ${e instanceof Error ? e.message : String(e)}`
|
|
629
632
|
);
|
|
630
633
|
} catch {
|
|
631
634
|
}
|
|
@@ -672,8 +675,9 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
|
|
|
672
675
|
options?.traceIds,
|
|
673
676
|
options?.codeChangeDescription,
|
|
674
677
|
options?.codeChangeFiles,
|
|
675
|
-
options?.environment !== void 0
|
|
678
|
+
options?.environment !== void 0,
|
|
676
679
|
// includeDbBranchLease
|
|
680
|
+
options?.experimentGroupId
|
|
677
681
|
);
|
|
678
682
|
const mockStrategy = options?.mock ?? "none";
|
|
679
683
|
const maxConcurrency = options?.maxConcurrency ?? 10;
|
|
@@ -1517,16 +1521,7 @@ init_constants();
|
|
|
1517
1521
|
|
|
1518
1522
|
// src/dbSnapshot.ts
|
|
1519
1523
|
init_errors();
|
|
1520
|
-
var SUPPORTED_PROVIDERS = [
|
|
1521
|
-
"neon",
|
|
1522
|
-
"ardent",
|
|
1523
|
-
"dolt",
|
|
1524
|
-
"gfs",
|
|
1525
|
-
"mongodb-atlas",
|
|
1526
|
-
"dynamodb",
|
|
1527
|
-
"snowflake",
|
|
1528
|
-
"bigquery"
|
|
1529
|
-
];
|
|
1524
|
+
var SUPPORTED_PROVIDERS = ["neon"];
|
|
1530
1525
|
function validateDbSnapshotConfig(config) {
|
|
1531
1526
|
if (!SUPPORTED_PROVIDERS.includes(config.provider)) {
|
|
1532
1527
|
throw new BitfabError(
|
|
@@ -2053,14 +2048,6 @@ var ReplayEnvironment = class {
|
|
|
2053
2048
|
get traceId() {
|
|
2054
2049
|
return this.require().traceId;
|
|
2055
2050
|
}
|
|
2056
|
-
/**
|
|
2057
|
-
* How the resolver pinned this branch.
|
|
2058
|
-
* - "timestamp": snapshot at SDK wall clock; bounded by replication lag.
|
|
2059
|
-
* - "lsn": customer LSN mapped to a replica snapshot (future).
|
|
2060
|
-
*/
|
|
2061
|
-
get precision() {
|
|
2062
|
-
return this.require().precision;
|
|
2063
|
-
}
|
|
2064
2051
|
/** True when read inside a replay item that has a resolved branch. */
|
|
2065
2052
|
get active() {
|
|
2066
2053
|
return this.read() !== null;
|
|
@@ -2084,8 +2071,7 @@ var ReplayEnvironment = class {
|
|
|
2084
2071
|
expiresAt: lease.expiresAt,
|
|
2085
2072
|
providerConsoleUrl: lease.providerConsoleUrl,
|
|
2086
2073
|
readOnly: lease.readOnly,
|
|
2087
|
-
traceId
|
|
2088
|
-
precision: lease.precision
|
|
2074
|
+
traceId
|
|
2089
2075
|
};
|
|
2090
2076
|
}
|
|
2091
2077
|
require() {
|
|
@@ -2937,7 +2923,6 @@ var Bitfab = class {
|
|
|
2937
2923
|
try {
|
|
2938
2924
|
const endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2939
2925
|
const replayCtx = getReplayContext();
|
|
2940
|
-
const dbSnapshotRefForSpan = isRootSpan ? activeTraceStates.get(traceId)?.dbSnapshotRef : void 0;
|
|
2941
2926
|
const spanPromise = self.sendWrapperSpan({
|
|
2942
2927
|
...baseSpanParams,
|
|
2943
2928
|
...params,
|
|
@@ -2947,9 +2932,6 @@ var Bitfab = class {
|
|
|
2947
2932
|
...replayCtx?.testRunId && { testRunId: replayCtx.testRunId },
|
|
2948
2933
|
...replayCtx?.inputSourceSpanId && {
|
|
2949
2934
|
inputSourceSpanId: replayCtx.inputSourceSpanId
|
|
2950
|
-
},
|
|
2951
|
-
...dbSnapshotRefForSpan && {
|
|
2952
|
-
dbSnapshotRef: dbSnapshotRefForSpan
|
|
2953
2935
|
}
|
|
2954
2936
|
});
|
|
2955
2937
|
if (isRootSpan) {
|
|
@@ -3177,10 +3159,7 @@ var Bitfab = class {
|
|
|
3177
3159
|
...params.contexts && params.contexts.length > 0 && {
|
|
3178
3160
|
contexts: params.contexts
|
|
3179
3161
|
},
|
|
3180
|
-
...params.prompt !== void 0 && { prompt: params.prompt }
|
|
3181
|
-
...params.dbSnapshotRef && {
|
|
3182
|
-
db_snapshot_ref: params.dbSnapshotRef
|
|
3183
|
-
}
|
|
3162
|
+
...params.prompt !== void 0 && { prompt: params.prompt }
|
|
3184
3163
|
}
|
|
3185
3164
|
};
|
|
3186
3165
|
if (params.parentSpanId) {
|