@bitfab/sdk 0.13.6 → 0.13.8
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-6757PVPS.js → chunk-4ANYHNQJ.js} +14 -32
- package/dist/chunk-4ANYHNQJ.js.map +1 -0
- package/dist/{chunk-TMSVIA5J.js → chunk-VFGUZWAV.js} +8 -6
- package/dist/chunk-VFGUZWAV.js.map +1 -0
- package/dist/index.cjs +20 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -25
- package/dist/index.d.ts +5 -25
- package/dist/index.js +2 -2
- package/dist/node.cjs +20 -36
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-UBXCO6QU.js → replay-F7K2JQCZ.js} +4 -4
- package/dist/{replay-UBXCO6QU.js.map → replay-F7K2JQCZ.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-6757PVPS.js.map +0 -1
- package/dist/chunk-TMSVIA5J.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. */
|
|
@@ -1010,7 +990,7 @@ declare class BitfabFunction {
|
|
|
1010
990
|
/**
|
|
1011
991
|
* SDK version from package.json (injected at build time)
|
|
1012
992
|
*/
|
|
1013
|
-
declare const __version__ = "0.13.
|
|
993
|
+
declare const __version__ = "0.13.8";
|
|
1014
994
|
|
|
1015
995
|
/**
|
|
1016
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. */
|
|
@@ -1010,7 +990,7 @@ declare class BitfabFunction {
|
|
|
1010
990
|
/**
|
|
1011
991
|
* SDK version from package.json (injected at build time)
|
|
1012
992
|
*/
|
|
1013
|
-
declare const __version__ = "0.13.
|
|
993
|
+
declare const __version__ = "0.13.8";
|
|
1014
994
|
|
|
1015
995
|
/**
|
|
1016
996
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
SUPPORTED_PROVIDERS,
|
|
9
9
|
getCurrentSpan,
|
|
10
10
|
getCurrentTrace
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4ANYHNQJ.js";
|
|
12
12
|
import {
|
|
13
13
|
BitfabError,
|
|
14
14
|
DEFAULT_SERVICE_URL,
|
|
15
15
|
__version__,
|
|
16
16
|
flushTraces
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VFGUZWAV.js";
|
|
18
18
|
export {
|
|
19
19
|
Bitfab,
|
|
20
20
|
BitfabClaudeAgentHandler,
|
package/dist/node.cjs
CHANGED
|
@@ -81,7 +81,7 @@ var __version__;
|
|
|
81
81
|
var init_version_generated = __esm({
|
|
82
82
|
"src/version.generated.ts"() {
|
|
83
83
|
"use strict";
|
|
84
|
-
__version__ = "0.13.
|
|
84
|
+
__version__ = "0.13.8";
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
|
|
@@ -188,7 +188,9 @@ var init_http = __esm({
|
|
|
188
188
|
)
|
|
189
189
|
),
|
|
190
190
|
rawSpan: {},
|
|
191
|
-
errors: [
|
|
191
|
+
errors: [
|
|
192
|
+
{ source: "sdk", step: "json_serialize", error: serializationError }
|
|
193
|
+
]
|
|
192
194
|
});
|
|
193
195
|
}
|
|
194
196
|
try {
|
|
@@ -430,11 +432,11 @@ var init_http = __esm({
|
|
|
430
432
|
{ timeout: 9e4 }
|
|
431
433
|
);
|
|
432
434
|
}
|
|
433
|
-
/** Release a previously-resolved DB branch
|
|
434
|
-
async releaseDbBranchLease(
|
|
435
|
+
/** Release a previously-resolved DB branch by deleting its Neon branch. Idempotent server-side. */
|
|
436
|
+
async releaseDbBranchLease(neonBranchId) {
|
|
435
437
|
await this.request(
|
|
436
438
|
"/api/sdk/replay/releaseDbBranchLease",
|
|
437
|
-
{
|
|
439
|
+
{ neonBranchId },
|
|
438
440
|
{ timeout: 3e4 }
|
|
439
441
|
);
|
|
440
442
|
}
|
|
@@ -615,11 +617,11 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
|
|
|
615
617
|
} finally {
|
|
616
618
|
if (lease) {
|
|
617
619
|
try {
|
|
618
|
-
await httpClient.releaseDbBranchLease(lease.
|
|
620
|
+
await httpClient.releaseDbBranchLease(lease.neonBranchId);
|
|
619
621
|
} catch (e) {
|
|
620
622
|
try {
|
|
621
623
|
console.warn(
|
|
622
|
-
`Bitfab: failed to release DB branch
|
|
624
|
+
`Bitfab: failed to release DB branch ${lease.neonBranchId} (TTL janitor will catch it): ${e instanceof Error ? e.message : String(e)}`
|
|
623
625
|
);
|
|
624
626
|
} catch {
|
|
625
627
|
}
|
|
@@ -1512,16 +1514,7 @@ init_constants();
|
|
|
1512
1514
|
|
|
1513
1515
|
// src/dbSnapshot.ts
|
|
1514
1516
|
init_errors();
|
|
1515
|
-
var SUPPORTED_PROVIDERS = [
|
|
1516
|
-
"neon",
|
|
1517
|
-
"ardent",
|
|
1518
|
-
"dolt",
|
|
1519
|
-
"gfs",
|
|
1520
|
-
"mongodb-atlas",
|
|
1521
|
-
"dynamodb",
|
|
1522
|
-
"snowflake",
|
|
1523
|
-
"bigquery"
|
|
1524
|
-
];
|
|
1517
|
+
var SUPPORTED_PROVIDERS = ["neon"];
|
|
1525
1518
|
function validateDbSnapshotConfig(config) {
|
|
1526
1519
|
if (!SUPPORTED_PROVIDERS.includes(config.provider)) {
|
|
1527
1520
|
throw new BitfabError(
|
|
@@ -2048,14 +2041,6 @@ var ReplayEnvironment = class {
|
|
|
2048
2041
|
get traceId() {
|
|
2049
2042
|
return this.require().traceId;
|
|
2050
2043
|
}
|
|
2051
|
-
/**
|
|
2052
|
-
* How the resolver pinned this branch.
|
|
2053
|
-
* - "timestamp": snapshot at SDK wall clock; bounded by replication lag.
|
|
2054
|
-
* - "lsn": customer LSN mapped to a replica snapshot (future).
|
|
2055
|
-
*/
|
|
2056
|
-
get precision() {
|
|
2057
|
-
return this.require().precision;
|
|
2058
|
-
}
|
|
2059
2044
|
/** True when read inside a replay item that has a resolved branch. */
|
|
2060
2045
|
get active() {
|
|
2061
2046
|
return this.read() !== null;
|
|
@@ -2079,8 +2064,7 @@ var ReplayEnvironment = class {
|
|
|
2079
2064
|
expiresAt: lease.expiresAt,
|
|
2080
2065
|
providerConsoleUrl: lease.providerConsoleUrl,
|
|
2081
2066
|
readOnly: lease.readOnly,
|
|
2082
|
-
traceId
|
|
2083
|
-
precision: lease.precision
|
|
2067
|
+
traceId
|
|
2084
2068
|
};
|
|
2085
2069
|
}
|
|
2086
2070
|
require() {
|
|
@@ -2200,6 +2184,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2200
2184
|
const jsonResult = span.toJSON();
|
|
2201
2185
|
if (typeof jsonResult !== "object" || jsonResult === null) {
|
|
2202
2186
|
errors.push({
|
|
2187
|
+
source: "sdk",
|
|
2203
2188
|
step: "span.toJSON()",
|
|
2204
2189
|
error: `Returned unexpected type: ${typeof jsonResult}`
|
|
2205
2190
|
});
|
|
@@ -2209,6 +2194,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2209
2194
|
}
|
|
2210
2195
|
} catch (error) {
|
|
2211
2196
|
errors.push({
|
|
2197
|
+
source: "sdk",
|
|
2212
2198
|
step: "span.toJSON()",
|
|
2213
2199
|
error: error instanceof Error ? error.message : String(error)
|
|
2214
2200
|
});
|
|
@@ -2228,6 +2214,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2228
2214
|
spanData.input = span.spanData?._input || [];
|
|
2229
2215
|
} catch (error) {
|
|
2230
2216
|
errors.push({
|
|
2217
|
+
source: "sdk",
|
|
2231
2218
|
step: "access_input",
|
|
2232
2219
|
error: error instanceof Error ? error.message : String(error)
|
|
2233
2220
|
});
|
|
@@ -2236,6 +2223,7 @@ var BitfabOpenAITracingProcessor = class {
|
|
|
2236
2223
|
spanData.response = span.spanData?._response || null;
|
|
2237
2224
|
} catch (error) {
|
|
2238
2225
|
errors.push({
|
|
2226
|
+
source: "sdk",
|
|
2239
2227
|
step: "access_response",
|
|
2240
2228
|
error: error instanceof Error ? error.message : String(error)
|
|
2241
2229
|
});
|
|
@@ -2932,7 +2920,6 @@ var Bitfab = class {
|
|
|
2932
2920
|
try {
|
|
2933
2921
|
const endedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2934
2922
|
const replayCtx = getReplayContext();
|
|
2935
|
-
const dbSnapshotRefForSpan = isRootSpan ? activeTraceStates.get(traceId)?.dbSnapshotRef : void 0;
|
|
2936
2923
|
const spanPromise = self.sendWrapperSpan({
|
|
2937
2924
|
...baseSpanParams,
|
|
2938
2925
|
...params,
|
|
@@ -2942,9 +2929,6 @@ var Bitfab = class {
|
|
|
2942
2929
|
...replayCtx?.testRunId && { testRunId: replayCtx.testRunId },
|
|
2943
2930
|
...replayCtx?.inputSourceSpanId && {
|
|
2944
2931
|
inputSourceSpanId: replayCtx.inputSourceSpanId
|
|
2945
|
-
},
|
|
2946
|
-
...dbSnapshotRefForSpan && {
|
|
2947
|
-
dbSnapshotRef: dbSnapshotRefForSpan
|
|
2948
2932
|
}
|
|
2949
2933
|
});
|
|
2950
2934
|
if (isRootSpan) {
|
|
@@ -3168,14 +3152,14 @@ var Bitfab = class {
|
|
|
3168
3152
|
...params.functionName !== void 0 && {
|
|
3169
3153
|
function_name: params.functionName
|
|
3170
3154
|
},
|
|
3171
|
-
...params.error !== void 0 && {
|
|
3155
|
+
...params.error !== void 0 && {
|
|
3156
|
+
error: params.error,
|
|
3157
|
+
error_source: "code"
|
|
3158
|
+
},
|
|
3172
3159
|
...params.contexts && params.contexts.length > 0 && {
|
|
3173
3160
|
contexts: params.contexts
|
|
3174
3161
|
},
|
|
3175
|
-
...params.prompt !== void 0 && { prompt: params.prompt }
|
|
3176
|
-
...params.dbSnapshotRef && {
|
|
3177
|
-
db_snapshot_ref: params.dbSnapshotRef
|
|
3178
|
-
}
|
|
3162
|
+
...params.prompt !== void 0 && { prompt: params.prompt }
|
|
3179
3163
|
}
|
|
3180
3164
|
};
|
|
3181
3165
|
if (params.parentSpanId) {
|