bitfab 0.28.1 → 0.28.3
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-FTXZWRTG.js → chunk-B262VQWF.js} +3 -3
- package/dist/chunk-B262VQWF.js.map +1 -0
- package/dist/{chunk-3YNAPGPA.js → chunk-KYDQQPIS.js} +18 -18
- package/dist/chunk-KYDQQPIS.js.map +1 -0
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +2 -2
- package/dist/node.cjs +17 -17
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/{replay-HBOBYYR3.js → replay-4NJCYW4H.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-3YNAPGPA.js.map +0 -1
- package/dist/chunk-FTXZWRTG.js.map +0 -1
- /package/dist/{replay-HBOBYYR3.js.map → replay-4NJCYW4H.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -137,7 +137,7 @@ interface ActiveSpanContext$2 {
|
|
|
137
137
|
* Bitfab spans with proper parent-child hierarchy.
|
|
138
138
|
*
|
|
139
139
|
* The TypeScript Claude Agent SDK exposes a single `query()` entry point (there
|
|
140
|
-
* is no `ClaudeSDKClient` class
|
|
140
|
+
* is no `ClaudeSDKClient` class - that exists only in the Python SDK). Wrap the
|
|
141
141
|
* `query()` async iterator with `wrapQuery`; tool and subagent spans come from
|
|
142
142
|
* the hooks injected by `instrumentOptions`.
|
|
143
143
|
*
|
|
@@ -221,7 +221,7 @@ declare class BitfabClaudeAgentHandler {
|
|
|
221
221
|
* SDK's `wrapResponse` (which wraps `ClaudeSDKClient.receiveResponse()`);
|
|
222
222
|
* in TypeScript, prefer `wrapQuery` around `query()`.
|
|
223
223
|
*
|
|
224
|
-
* Pass `{ input }` (the prompt) to record a replayable root span
|
|
224
|
+
* Pass `{ input }` (the prompt) to record a replayable root span - see
|
|
225
225
|
* `wrapQuery`.
|
|
226
226
|
*/
|
|
227
227
|
wrapResponse(stream: AsyncIterable<unknown>, opts?: {
|
|
@@ -233,8 +233,8 @@ declare class BitfabClaudeAgentHandler {
|
|
|
233
233
|
* Tool and subagent spans are captured separately via the hooks injected
|
|
234
234
|
* by `instrumentOptions` into the `options` passed to `query()`.
|
|
235
235
|
*
|
|
236
|
-
* Pass `{ input }`
|
|
237
|
-
*
|
|
236
|
+
* Pass `{ input }` - the prompt (or the serializable args that produced it)
|
|
237
|
+
* - to make a handler-only run replayable: the handler records a root `agent`
|
|
238
238
|
* span with that input, so `replay(key, fn)` can re-feed it. Omit it only
|
|
239
239
|
* when an enclosing `withSpan` already supplies the replayable root.
|
|
240
240
|
*
|
|
@@ -445,7 +445,7 @@ declare class BitfabLangGraphCallbackHandler {
|
|
|
445
445
|
*
|
|
446
446
|
* 1. A process-wide `TracingProcessor` (see `getOpenAiTracingProcessor` /
|
|
447
447
|
* `BitfabOpenAITracingProcessor`) registered once with `addTraceProcessor`.
|
|
448
|
-
* It captures everything *inside* a run
|
|
448
|
+
* It captures everything *inside* a run - LLM calls, tool calls, handoffs -
|
|
449
449
|
* as Bitfab spans.
|
|
450
450
|
* 2. This handler's `wrapRun`, which owns the *root*. The processor never sees
|
|
451
451
|
* the caller's input (the SDK's trace events don't carry it), so a
|
|
@@ -516,7 +516,7 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
516
516
|
* argument, so `replay(key, fn)` re-feeds it), and the run's `finalOutput`
|
|
517
517
|
* is recorded as the root output. For streaming runs (`{ stream: true }`),
|
|
518
518
|
* the result is handed back immediately and the final output is recorded
|
|
519
|
-
* once the stream completes
|
|
519
|
+
* once the stream completes - first-byte latency is untouched.
|
|
520
520
|
*
|
|
521
521
|
* The process-wide tracing processor (`getOpenAiTracingProcessor`) must still
|
|
522
522
|
* be registered: it captures the LLM/tool/handoff spans that nest beneath
|
|
@@ -542,7 +542,7 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
542
542
|
* even when the SDK runs items in parallel.
|
|
543
543
|
*
|
|
544
544
|
* Internally, the resolved per-item state is a `DbBranchLease` (see
|
|
545
|
-
* replayContext.ts)
|
|
545
|
+
* replayContext.ts) - that's the SDK ↔ server protocol term. We expose
|
|
546
546
|
* its useful fields directly here so customer code never sees the word.
|
|
547
547
|
*/
|
|
548
548
|
interface ReplayEnvironmentSnapshot {
|
|
@@ -576,7 +576,7 @@ declare class ReplayEnvironment {
|
|
|
576
576
|
snapshot(): ReplayEnvironmentSnapshot | null;
|
|
577
577
|
/**
|
|
578
578
|
* Record on the replay context that customer code obtained the branch
|
|
579
|
-
* URL. Only `databaseUrl` and `snapshot()` count
|
|
579
|
+
* URL. Only `databaseUrl` and `snapshot()` count - `active`, `readOnly`
|
|
580
580
|
* and friends inspect the lease without exposing the connection string,
|
|
581
581
|
* so they don't prove the replayed code could have connected to the
|
|
582
582
|
* branch.
|
|
@@ -968,7 +968,7 @@ interface CurrentSpan {
|
|
|
968
968
|
* A detached handle to a previously-created trace, looked up by its
|
|
969
969
|
* caller-supplied id (the same id passed when the trace was started).
|
|
970
970
|
*
|
|
971
|
-
* Unlike `getCurrentTrace()`, this handle is not tied to AsyncLocalStorage
|
|
971
|
+
* Unlike `getCurrentTrace()`, this handle is not tied to AsyncLocalStorage -
|
|
972
972
|
* each method sends to the server immediately. Useful for adding context
|
|
973
973
|
* to a trace from a different process, request, or thread (e.g. a forked
|
|
974
974
|
* agent that wants to annotate the original conversation's trace).
|
|
@@ -1102,7 +1102,7 @@ interface SpanOptions {
|
|
|
1102
1102
|
* ignored outside replay and under the "all"/"none" strategies.
|
|
1103
1103
|
*
|
|
1104
1104
|
* Use this for child spans that are expensive (paid LLM/API calls),
|
|
1105
|
-
* slow, or non-deterministic
|
|
1105
|
+
* slow, or non-deterministic - the root function still runs real code,
|
|
1106
1106
|
* only the marked descendants return their recorded output.
|
|
1107
1107
|
*/
|
|
1108
1108
|
mockOnReplay?: boolean;
|
|
@@ -1324,7 +1324,7 @@ declare class Bitfab {
|
|
|
1324
1324
|
* Wrap a BAML client method to automatically capture prompt and LLM metadata.
|
|
1325
1325
|
*
|
|
1326
1326
|
* Creates a BAML Collector, calls the method through a tracked client,
|
|
1327
|
-
* then extracts rendered messages and token usage
|
|
1327
|
+
* then extracts rendered messages and token usage - calling setPrompt()
|
|
1328
1328
|
* and addContext() on the current span automatically.
|
|
1329
1329
|
*
|
|
1330
1330
|
* The BAML client can be provided in the constructor or passed explicitly:
|
|
@@ -1385,7 +1385,7 @@ declare class Bitfab {
|
|
|
1385
1385
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
1386
1386
|
* caller-supplied id (the same id passed at trace creation).
|
|
1387
1387
|
*
|
|
1388
|
-
* The returned handle is not tied to AsyncLocalStorage
|
|
1388
|
+
* The returned handle is not tied to AsyncLocalStorage - each method sends
|
|
1389
1389
|
* to the server immediately. Useful for adding context to a trace from a
|
|
1390
1390
|
* different process or thread than the one that created it.
|
|
1391
1391
|
*
|
|
@@ -1443,7 +1443,7 @@ declare class Bitfab {
|
|
|
1443
1443
|
* plain callable: plain callables are wrapped internally so each replayed
|
|
1444
1444
|
* invocation records a trace tied to the test run. The plain-callable form
|
|
1445
1445
|
* is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
|
|
1446
|
-
* SDK) replay
|
|
1446
|
+
* SDK) replay - those record traces under a key with no `withSpan`-wrapped
|
|
1447
1447
|
* root in the app.
|
|
1448
1448
|
*
|
|
1449
1449
|
* @param traceFunctionKey - The trace function key to replay
|
|
@@ -1571,7 +1571,7 @@ declare class BitfabFunction {
|
|
|
1571
1571
|
*/
|
|
1572
1572
|
getLangGraphCallbackHandler(): BitfabLangGraphCallbackHandler;
|
|
1573
1573
|
/**
|
|
1574
|
-
* Alias of {@link getLangGraphCallbackHandler}
|
|
1574
|
+
* Alias of {@link getLangGraphCallbackHandler} - LangChain and LangGraph
|
|
1575
1575
|
* share one callback system, so the same bound handler serves both.
|
|
1576
1576
|
*
|
|
1577
1577
|
* @returns A LangChain callback handler for this client and key
|
|
@@ -1584,7 +1584,7 @@ declare class BitfabFunction {
|
|
|
1584
1584
|
* Unlike the other methods on this handle, `wrapBAML` does NOT use the bound
|
|
1585
1585
|
* key: it opens no span of its own. It enriches the *current* span (via
|
|
1586
1586
|
* `getCurrentSpan().setPrompt()` / `addContext()`), so call it inside a
|
|
1587
|
-
* function wrapped by this handle's `withSpan`
|
|
1587
|
+
* function wrapped by this handle's `withSpan` - the bound key keys that
|
|
1588
1588
|
* wrapper, and the BAML prompt/metadata attach to it.
|
|
1589
1589
|
*
|
|
1590
1590
|
* @param methodOrClient - Either a BAML method (uses constructor bamlClient) or the BAML client instance
|
|
@@ -1603,7 +1603,7 @@ declare class BitfabFunction {
|
|
|
1603
1603
|
/**
|
|
1604
1604
|
* SDK version from package.json (injected at build time)
|
|
1605
1605
|
*/
|
|
1606
|
-
declare const __version__ = "0.28.
|
|
1606
|
+
declare const __version__ = "0.28.3";
|
|
1607
1607
|
|
|
1608
1608
|
/**
|
|
1609
1609
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ interface ActiveSpanContext$2 {
|
|
|
137
137
|
* Bitfab spans with proper parent-child hierarchy.
|
|
138
138
|
*
|
|
139
139
|
* The TypeScript Claude Agent SDK exposes a single `query()` entry point (there
|
|
140
|
-
* is no `ClaudeSDKClient` class
|
|
140
|
+
* is no `ClaudeSDKClient` class - that exists only in the Python SDK). Wrap the
|
|
141
141
|
* `query()` async iterator with `wrapQuery`; tool and subagent spans come from
|
|
142
142
|
* the hooks injected by `instrumentOptions`.
|
|
143
143
|
*
|
|
@@ -221,7 +221,7 @@ declare class BitfabClaudeAgentHandler {
|
|
|
221
221
|
* SDK's `wrapResponse` (which wraps `ClaudeSDKClient.receiveResponse()`);
|
|
222
222
|
* in TypeScript, prefer `wrapQuery` around `query()`.
|
|
223
223
|
*
|
|
224
|
-
* Pass `{ input }` (the prompt) to record a replayable root span
|
|
224
|
+
* Pass `{ input }` (the prompt) to record a replayable root span - see
|
|
225
225
|
* `wrapQuery`.
|
|
226
226
|
*/
|
|
227
227
|
wrapResponse(stream: AsyncIterable<unknown>, opts?: {
|
|
@@ -233,8 +233,8 @@ declare class BitfabClaudeAgentHandler {
|
|
|
233
233
|
* Tool and subagent spans are captured separately via the hooks injected
|
|
234
234
|
* by `instrumentOptions` into the `options` passed to `query()`.
|
|
235
235
|
*
|
|
236
|
-
* Pass `{ input }`
|
|
237
|
-
*
|
|
236
|
+
* Pass `{ input }` - the prompt (or the serializable args that produced it)
|
|
237
|
+
* - to make a handler-only run replayable: the handler records a root `agent`
|
|
238
238
|
* span with that input, so `replay(key, fn)` can re-feed it. Omit it only
|
|
239
239
|
* when an enclosing `withSpan` already supplies the replayable root.
|
|
240
240
|
*
|
|
@@ -445,7 +445,7 @@ declare class BitfabLangGraphCallbackHandler {
|
|
|
445
445
|
*
|
|
446
446
|
* 1. A process-wide `TracingProcessor` (see `getOpenAiTracingProcessor` /
|
|
447
447
|
* `BitfabOpenAITracingProcessor`) registered once with `addTraceProcessor`.
|
|
448
|
-
* It captures everything *inside* a run
|
|
448
|
+
* It captures everything *inside* a run - LLM calls, tool calls, handoffs -
|
|
449
449
|
* as Bitfab spans.
|
|
450
450
|
* 2. This handler's `wrapRun`, which owns the *root*. The processor never sees
|
|
451
451
|
* the caller's input (the SDK's trace events don't carry it), so a
|
|
@@ -516,7 +516,7 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
516
516
|
* argument, so `replay(key, fn)` re-feeds it), and the run's `finalOutput`
|
|
517
517
|
* is recorded as the root output. For streaming runs (`{ stream: true }`),
|
|
518
518
|
* the result is handed back immediately and the final output is recorded
|
|
519
|
-
* once the stream completes
|
|
519
|
+
* once the stream completes - first-byte latency is untouched.
|
|
520
520
|
*
|
|
521
521
|
* The process-wide tracing processor (`getOpenAiTracingProcessor`) must still
|
|
522
522
|
* be registered: it captures the LLM/tool/handoff spans that nest beneath
|
|
@@ -542,7 +542,7 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
542
542
|
* even when the SDK runs items in parallel.
|
|
543
543
|
*
|
|
544
544
|
* Internally, the resolved per-item state is a `DbBranchLease` (see
|
|
545
|
-
* replayContext.ts)
|
|
545
|
+
* replayContext.ts) - that's the SDK ↔ server protocol term. We expose
|
|
546
546
|
* its useful fields directly here so customer code never sees the word.
|
|
547
547
|
*/
|
|
548
548
|
interface ReplayEnvironmentSnapshot {
|
|
@@ -576,7 +576,7 @@ declare class ReplayEnvironment {
|
|
|
576
576
|
snapshot(): ReplayEnvironmentSnapshot | null;
|
|
577
577
|
/**
|
|
578
578
|
* Record on the replay context that customer code obtained the branch
|
|
579
|
-
* URL. Only `databaseUrl` and `snapshot()` count
|
|
579
|
+
* URL. Only `databaseUrl` and `snapshot()` count - `active`, `readOnly`
|
|
580
580
|
* and friends inspect the lease without exposing the connection string,
|
|
581
581
|
* so they don't prove the replayed code could have connected to the
|
|
582
582
|
* branch.
|
|
@@ -968,7 +968,7 @@ interface CurrentSpan {
|
|
|
968
968
|
* A detached handle to a previously-created trace, looked up by its
|
|
969
969
|
* caller-supplied id (the same id passed when the trace was started).
|
|
970
970
|
*
|
|
971
|
-
* Unlike `getCurrentTrace()`, this handle is not tied to AsyncLocalStorage
|
|
971
|
+
* Unlike `getCurrentTrace()`, this handle is not tied to AsyncLocalStorage -
|
|
972
972
|
* each method sends to the server immediately. Useful for adding context
|
|
973
973
|
* to a trace from a different process, request, or thread (e.g. a forked
|
|
974
974
|
* agent that wants to annotate the original conversation's trace).
|
|
@@ -1102,7 +1102,7 @@ interface SpanOptions {
|
|
|
1102
1102
|
* ignored outside replay and under the "all"/"none" strategies.
|
|
1103
1103
|
*
|
|
1104
1104
|
* Use this for child spans that are expensive (paid LLM/API calls),
|
|
1105
|
-
* slow, or non-deterministic
|
|
1105
|
+
* slow, or non-deterministic - the root function still runs real code,
|
|
1106
1106
|
* only the marked descendants return their recorded output.
|
|
1107
1107
|
*/
|
|
1108
1108
|
mockOnReplay?: boolean;
|
|
@@ -1324,7 +1324,7 @@ declare class Bitfab {
|
|
|
1324
1324
|
* Wrap a BAML client method to automatically capture prompt and LLM metadata.
|
|
1325
1325
|
*
|
|
1326
1326
|
* Creates a BAML Collector, calls the method through a tracked client,
|
|
1327
|
-
* then extracts rendered messages and token usage
|
|
1327
|
+
* then extracts rendered messages and token usage - calling setPrompt()
|
|
1328
1328
|
* and addContext() on the current span automatically.
|
|
1329
1329
|
*
|
|
1330
1330
|
* The BAML client can be provided in the constructor or passed explicitly:
|
|
@@ -1385,7 +1385,7 @@ declare class Bitfab {
|
|
|
1385
1385
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
1386
1386
|
* caller-supplied id (the same id passed at trace creation).
|
|
1387
1387
|
*
|
|
1388
|
-
* The returned handle is not tied to AsyncLocalStorage
|
|
1388
|
+
* The returned handle is not tied to AsyncLocalStorage - each method sends
|
|
1389
1389
|
* to the server immediately. Useful for adding context to a trace from a
|
|
1390
1390
|
* different process or thread than the one that created it.
|
|
1391
1391
|
*
|
|
@@ -1443,7 +1443,7 @@ declare class Bitfab {
|
|
|
1443
1443
|
* plain callable: plain callables are wrapped internally so each replayed
|
|
1444
1444
|
* invocation records a trace tied to the test run. The plain-callable form
|
|
1445
1445
|
* is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
|
|
1446
|
-
* SDK) replay
|
|
1446
|
+
* SDK) replay - those record traces under a key with no `withSpan`-wrapped
|
|
1447
1447
|
* root in the app.
|
|
1448
1448
|
*
|
|
1449
1449
|
* @param traceFunctionKey - The trace function key to replay
|
|
@@ -1571,7 +1571,7 @@ declare class BitfabFunction {
|
|
|
1571
1571
|
*/
|
|
1572
1572
|
getLangGraphCallbackHandler(): BitfabLangGraphCallbackHandler;
|
|
1573
1573
|
/**
|
|
1574
|
-
* Alias of {@link getLangGraphCallbackHandler}
|
|
1574
|
+
* Alias of {@link getLangGraphCallbackHandler} - LangChain and LangGraph
|
|
1575
1575
|
* share one callback system, so the same bound handler serves both.
|
|
1576
1576
|
*
|
|
1577
1577
|
* @returns A LangChain callback handler for this client and key
|
|
@@ -1584,7 +1584,7 @@ declare class BitfabFunction {
|
|
|
1584
1584
|
* Unlike the other methods on this handle, `wrapBAML` does NOT use the bound
|
|
1585
1585
|
* key: it opens no span of its own. It enriches the *current* span (via
|
|
1586
1586
|
* `getCurrentSpan().setPrompt()` / `addContext()`), so call it inside a
|
|
1587
|
-
* function wrapped by this handle's `withSpan`
|
|
1587
|
+
* function wrapped by this handle's `withSpan` - the bound key keys that
|
|
1588
1588
|
* wrapper, and the BAML prompt/metadata attach to it.
|
|
1589
1589
|
*
|
|
1590
1590
|
* @param methodOrClient - Either a BAML method (uses constructor bamlClient) or the BAML client instance
|
|
@@ -1603,7 +1603,7 @@ declare class BitfabFunction {
|
|
|
1603
1603
|
/**
|
|
1604
1604
|
* SDK version from package.json (injected at build time)
|
|
1605
1605
|
*/
|
|
1606
|
-
declare const __version__ = "0.28.
|
|
1606
|
+
declare const __version__ = "0.28.3";
|
|
1607
1607
|
|
|
1608
1608
|
/**
|
|
1609
1609
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
flushTraces,
|
|
24
24
|
getCurrentSpan,
|
|
25
25
|
getCurrentTrace
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-KYDQQPIS.js";
|
|
27
27
|
import {
|
|
28
28
|
BITFAB_PROGRESS_PREFIX,
|
|
29
29
|
BitfabError,
|
|
30
30
|
reportReplayProgress
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-B262VQWF.js";
|
|
32
32
|
export {
|
|
33
33
|
BITFAB_PROGRESS_PREFIX,
|
|
34
34
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -49,7 +49,7 @@ function registerAsyncLocalStorageClass(cls) {
|
|
|
49
49
|
function assertAsyncStorageRegistered() {
|
|
50
50
|
if (!AsyncLocalStorageClass) {
|
|
51
51
|
console.warn(
|
|
52
|
-
"Bitfab: AsyncLocalStorage not available
|
|
52
|
+
"Bitfab: AsyncLocalStorage not available - nested span context will not propagate."
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -367,7 +367,7 @@ function buildMockTree(rootNode) {
|
|
|
367
367
|
function walk(node) {
|
|
368
368
|
const key = node.traceFunctionKey;
|
|
369
369
|
if (key) {
|
|
370
|
-
const name = node.spanName;
|
|
370
|
+
const name = node.spanName || key;
|
|
371
371
|
const counterKey = `${key}:${name}`;
|
|
372
372
|
const index = counters.get(counterKey) ?? 0;
|
|
373
373
|
counters.set(counterKey, index + 1);
|
|
@@ -667,7 +667,7 @@ registerAsyncLocalStorageClass(
|
|
|
667
667
|
);
|
|
668
668
|
|
|
669
669
|
// src/version.generated.ts
|
|
670
|
-
var __version__ = "0.28.
|
|
670
|
+
var __version__ = "0.28.3";
|
|
671
671
|
|
|
672
672
|
// src/constants.ts
|
|
673
673
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -980,7 +980,7 @@ var HttpClient = class {
|
|
|
980
980
|
}
|
|
981
981
|
/**
|
|
982
982
|
* Start a replay session by fetching historical traces.
|
|
983
|
-
* Blocking call
|
|
983
|
+
* Blocking call - creates a test run and returns lightweight item references.
|
|
984
984
|
*/
|
|
985
985
|
async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId) {
|
|
986
986
|
const payload = { traceFunctionKey };
|
|
@@ -1098,7 +1098,7 @@ var HttpClient = class {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
/**
|
|
1100
1100
|
* Ask the server to materialize a per-trace DB branch lease from a
|
|
1101
|
-
* captured `dbSnapshotRef`. Blocking
|
|
1101
|
+
* captured `dbSnapshotRef`. Blocking - the resolver creates a Neon
|
|
1102
1102
|
* snapshot + preview branch and polls operations to readiness, which
|
|
1103
1103
|
* can take seconds.
|
|
1104
1104
|
*/
|
|
@@ -1238,7 +1238,7 @@ var BitfabClaudeAgentHandler = class {
|
|
|
1238
1238
|
// Synthetic root span (handler-only replay). When an `input` is supplied to
|
|
1239
1239
|
// wrapQuery/wrapResponse, the handler emits a root `agent` span carrying that
|
|
1240
1240
|
// input, so a handler-instrumented run is replayable WITHOUT an enclosing
|
|
1241
|
-
// withSpan
|
|
1241
|
+
// withSpan - matching the LangGraph handler, which records the graph input as
|
|
1242
1242
|
// its root. The prompt is not present anywhere in the message stream, so it
|
|
1243
1243
|
// must be handed in explicitly.
|
|
1244
1244
|
this.hasRootInput = false;
|
|
@@ -1512,7 +1512,7 @@ var BitfabClaudeAgentHandler = class {
|
|
|
1512
1512
|
* SDK's `wrapResponse` (which wraps `ClaudeSDKClient.receiveResponse()`);
|
|
1513
1513
|
* in TypeScript, prefer `wrapQuery` around `query()`.
|
|
1514
1514
|
*
|
|
1515
|
-
* Pass `{ input }` (the prompt) to record a replayable root span
|
|
1515
|
+
* Pass `{ input }` (the prompt) to record a replayable root span - see
|
|
1516
1516
|
* `wrapQuery`.
|
|
1517
1517
|
*/
|
|
1518
1518
|
async *wrapResponse(stream, opts) {
|
|
@@ -1525,8 +1525,8 @@ var BitfabClaudeAgentHandler = class {
|
|
|
1525
1525
|
* Tool and subagent spans are captured separately via the hooks injected
|
|
1526
1526
|
* by `instrumentOptions` into the `options` passed to `query()`.
|
|
1527
1527
|
*
|
|
1528
|
-
* Pass `{ input }`
|
|
1529
|
-
*
|
|
1528
|
+
* Pass `{ input }` - the prompt (or the serializable args that produced it)
|
|
1529
|
+
* - to make a handler-only run replayable: the handler records a root `agent`
|
|
1530
1530
|
* span with that input, so `replay(key, fn)` can re-feed it. Omit it only
|
|
1531
1531
|
* when an enclosing `withSpan` already supplies the replayable root.
|
|
1532
1532
|
*
|
|
@@ -2638,7 +2638,7 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
2638
2638
|
* argument, so `replay(key, fn)` re-feeds it), and the run's `finalOutput`
|
|
2639
2639
|
* is recorded as the root output. For streaming runs (`{ stream: true }`),
|
|
2640
2640
|
* the result is handed back immediately and the final output is recorded
|
|
2641
|
-
* once the stream completes
|
|
2641
|
+
* once the stream completes - first-byte latency is untouched.
|
|
2642
2642
|
*
|
|
2643
2643
|
* The process-wide tracing processor (`getOpenAiTracingProcessor`) must still
|
|
2644
2644
|
* be registered: it captures the LLM/tool/handoff spans that nest beneath
|
|
@@ -2731,7 +2731,7 @@ var ReplayEnvironment = class {
|
|
|
2731
2731
|
}
|
|
2732
2732
|
/**
|
|
2733
2733
|
* Record on the replay context that customer code obtained the branch
|
|
2734
|
-
* URL. Only `databaseUrl` and `snapshot()` count
|
|
2734
|
+
* URL. Only `databaseUrl` and `snapshot()` count - `active`, `readOnly`
|
|
2735
2735
|
* and friends inspect the lease without exposing the connection string,
|
|
2736
2736
|
* so they don't prove the replayed code could have connected to the
|
|
2737
2737
|
* branch.
|
|
@@ -3456,7 +3456,7 @@ var Bitfab = class {
|
|
|
3456
3456
|
if (this.explicitlyEnabled && !this.apiKeyWarned) {
|
|
3457
3457
|
this.apiKeyWarned = true;
|
|
3458
3458
|
console.warn(
|
|
3459
|
-
"Bitfab: apiKey is empty
|
|
3459
|
+
"Bitfab: apiKey is empty - tracing is disabled. Provide a valid API key to enable tracing."
|
|
3460
3460
|
);
|
|
3461
3461
|
}
|
|
3462
3462
|
return void 0;
|
|
@@ -3720,7 +3720,7 @@ var Bitfab = class {
|
|
|
3720
3720
|
* Wrap a BAML client method to automatically capture prompt and LLM metadata.
|
|
3721
3721
|
*
|
|
3722
3722
|
* Creates a BAML Collector, calls the method through a tracked client,
|
|
3723
|
-
* then extracts rendered messages and token usage
|
|
3723
|
+
* then extracts rendered messages and token usage - calling setPrompt()
|
|
3724
3724
|
* and addContext() on the current span automatically.
|
|
3725
3725
|
*
|
|
3726
3726
|
* The BAML client can be provided in the constructor or passed explicitly:
|
|
@@ -4107,7 +4107,7 @@ var Bitfab = class {
|
|
|
4107
4107
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
4108
4108
|
* caller-supplied id (the same id passed at trace creation).
|
|
4109
4109
|
*
|
|
4110
|
-
* The returned handle is not tied to AsyncLocalStorage
|
|
4110
|
+
* The returned handle is not tied to AsyncLocalStorage - each method sends
|
|
4111
4111
|
* to the server immediately. Useful for adding context to a trace from a
|
|
4112
4112
|
* different process or thread than the one that created it.
|
|
4113
4113
|
*
|
|
@@ -4288,7 +4288,7 @@ var Bitfab = class {
|
|
|
4288
4288
|
* plain callable: plain callables are wrapped internally so each replayed
|
|
4289
4289
|
* invocation records a trace tied to the test run. The plain-callable form
|
|
4290
4290
|
* is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
|
|
4291
|
-
* SDK) replay
|
|
4291
|
+
* SDK) replay - those record traces under a key with no `withSpan`-wrapped
|
|
4292
4292
|
* root in the app.
|
|
4293
4293
|
*
|
|
4294
4294
|
* @param traceFunctionKey - The trace function key to replay
|
|
@@ -4440,7 +4440,7 @@ var BitfabFunction = class {
|
|
|
4440
4440
|
return this.client.getLangGraphCallbackHandler(this.traceFunctionKey);
|
|
4441
4441
|
}
|
|
4442
4442
|
/**
|
|
4443
|
-
* Alias of {@link getLangGraphCallbackHandler}
|
|
4443
|
+
* Alias of {@link getLangGraphCallbackHandler} - LangChain and LangGraph
|
|
4444
4444
|
* share one callback system, so the same bound handler serves both.
|
|
4445
4445
|
*
|
|
4446
4446
|
* @returns A LangChain callback handler for this client and key
|
|
@@ -4455,7 +4455,7 @@ var BitfabFunction = class {
|
|
|
4455
4455
|
* Unlike the other methods on this handle, `wrapBAML` does NOT use the bound
|
|
4456
4456
|
* key: it opens no span of its own. It enriches the *current* span (via
|
|
4457
4457
|
* `getCurrentSpan().setPrompt()` / `addContext()`), so call it inside a
|
|
4458
|
-
* function wrapped by this handle's `withSpan`
|
|
4458
|
+
* function wrapped by this handle's `withSpan` - the bound key keys that
|
|
4459
4459
|
* wrapper, and the BAML prompt/metadata attach to it.
|
|
4460
4460
|
*
|
|
4461
4461
|
* @param methodOrClient - Either a BAML method (uses constructor bamlClient) or the BAML client instance
|