@bitfab/sdk 0.28.2 → 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-3PCOUZZP.js → chunk-B262VQWF.js} +2 -2
- package/dist/chunk-B262VQWF.js.map +1 -0
- package/dist/{chunk-NZFPJRD3.js → chunk-KYDQQPIS.js} +18 -18
- package/dist/chunk-KYDQQPIS.js.map +1 -0
- package/dist/index.cjs +15 -15
- 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 +16 -16
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/{replay-PZKPWKMV.js → replay-4NJCYW4H.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-3PCOUZZP.js.map +0 -1
- package/dist/chunk-NZFPJRD3.js.map +0 -1
- /package/dist/{replay-PZKPWKMV.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
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
flushTraces,
|
|
15
15
|
getCurrentSpan,
|
|
16
16
|
getCurrentTrace
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KYDQQPIS.js";
|
|
18
18
|
import {
|
|
19
19
|
BITFAB_PROGRESS_PREFIX,
|
|
20
20
|
BitfabError,
|
|
21
21
|
reportReplayProgress
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-B262VQWF.js";
|
|
23
23
|
export {
|
|
24
24
|
BITFAB_PROGRESS_PREFIX,
|
|
25
25
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -40,7 +40,7 @@ function registerAsyncLocalStorageClass(cls) {
|
|
|
40
40
|
function assertAsyncStorageRegistered() {
|
|
41
41
|
if (!AsyncLocalStorageClass) {
|
|
42
42
|
console.warn(
|
|
43
|
-
"Bitfab: AsyncLocalStorage not available
|
|
43
|
+
"Bitfab: AsyncLocalStorage not available - nested span context will not propagate."
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -658,7 +658,7 @@ registerAsyncLocalStorageClass(
|
|
|
658
658
|
);
|
|
659
659
|
|
|
660
660
|
// src/version.generated.ts
|
|
661
|
-
var __version__ = "0.28.
|
|
661
|
+
var __version__ = "0.28.3";
|
|
662
662
|
|
|
663
663
|
// src/constants.ts
|
|
664
664
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -971,7 +971,7 @@ var HttpClient = class {
|
|
|
971
971
|
}
|
|
972
972
|
/**
|
|
973
973
|
* Start a replay session by fetching historical traces.
|
|
974
|
-
* Blocking call
|
|
974
|
+
* Blocking call - creates a test run and returns lightweight item references.
|
|
975
975
|
*/
|
|
976
976
|
async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetId) {
|
|
977
977
|
const payload = { traceFunctionKey };
|
|
@@ -1089,7 +1089,7 @@ var HttpClient = class {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
/**
|
|
1091
1091
|
* Ask the server to materialize a per-trace DB branch lease from a
|
|
1092
|
-
* captured `dbSnapshotRef`. Blocking
|
|
1092
|
+
* captured `dbSnapshotRef`. Blocking - the resolver creates a Neon
|
|
1093
1093
|
* snapshot + preview branch and polls operations to readiness, which
|
|
1094
1094
|
* can take seconds.
|
|
1095
1095
|
*/
|
|
@@ -1229,7 +1229,7 @@ var BitfabClaudeAgentHandler = class {
|
|
|
1229
1229
|
// Synthetic root span (handler-only replay). When an `input` is supplied to
|
|
1230
1230
|
// wrapQuery/wrapResponse, the handler emits a root `agent` span carrying that
|
|
1231
1231
|
// input, so a handler-instrumented run is replayable WITHOUT an enclosing
|
|
1232
|
-
// withSpan
|
|
1232
|
+
// withSpan - matching the LangGraph handler, which records the graph input as
|
|
1233
1233
|
// its root. The prompt is not present anywhere in the message stream, so it
|
|
1234
1234
|
// must be handed in explicitly.
|
|
1235
1235
|
this.hasRootInput = false;
|
|
@@ -1503,7 +1503,7 @@ var BitfabClaudeAgentHandler = class {
|
|
|
1503
1503
|
* SDK's `wrapResponse` (which wraps `ClaudeSDKClient.receiveResponse()`);
|
|
1504
1504
|
* in TypeScript, prefer `wrapQuery` around `query()`.
|
|
1505
1505
|
*
|
|
1506
|
-
* Pass `{ input }` (the prompt) to record a replayable root span
|
|
1506
|
+
* Pass `{ input }` (the prompt) to record a replayable root span - see
|
|
1507
1507
|
* `wrapQuery`.
|
|
1508
1508
|
*/
|
|
1509
1509
|
async *wrapResponse(stream, opts) {
|
|
@@ -1516,8 +1516,8 @@ var BitfabClaudeAgentHandler = class {
|
|
|
1516
1516
|
* Tool and subagent spans are captured separately via the hooks injected
|
|
1517
1517
|
* by `instrumentOptions` into the `options` passed to `query()`.
|
|
1518
1518
|
*
|
|
1519
|
-
* Pass `{ input }`
|
|
1520
|
-
*
|
|
1519
|
+
* Pass `{ input }` - the prompt (or the serializable args that produced it)
|
|
1520
|
+
* - to make a handler-only run replayable: the handler records a root `agent`
|
|
1521
1521
|
* span with that input, so `replay(key, fn)` can re-feed it. Omit it only
|
|
1522
1522
|
* when an enclosing `withSpan` already supplies the replayable root.
|
|
1523
1523
|
*
|
|
@@ -2629,7 +2629,7 @@ var BitfabOpenAIAgentHandler = class {
|
|
|
2629
2629
|
* argument, so `replay(key, fn)` re-feeds it), and the run's `finalOutput`
|
|
2630
2630
|
* is recorded as the root output. For streaming runs (`{ stream: true }`),
|
|
2631
2631
|
* the result is handed back immediately and the final output is recorded
|
|
2632
|
-
* once the stream completes
|
|
2632
|
+
* once the stream completes - first-byte latency is untouched.
|
|
2633
2633
|
*
|
|
2634
2634
|
* The process-wide tracing processor (`getOpenAiTracingProcessor`) must still
|
|
2635
2635
|
* be registered: it captures the LLM/tool/handoff spans that nest beneath
|
|
@@ -2722,7 +2722,7 @@ var ReplayEnvironment = class {
|
|
|
2722
2722
|
}
|
|
2723
2723
|
/**
|
|
2724
2724
|
* Record on the replay context that customer code obtained the branch
|
|
2725
|
-
* URL. Only `databaseUrl` and `snapshot()` count
|
|
2725
|
+
* URL. Only `databaseUrl` and `snapshot()` count - `active`, `readOnly`
|
|
2726
2726
|
* and friends inspect the lease without exposing the connection string,
|
|
2727
2727
|
* so they don't prove the replayed code could have connected to the
|
|
2728
2728
|
* branch.
|
|
@@ -3447,7 +3447,7 @@ var Bitfab = class {
|
|
|
3447
3447
|
if (this.explicitlyEnabled && !this.apiKeyWarned) {
|
|
3448
3448
|
this.apiKeyWarned = true;
|
|
3449
3449
|
console.warn(
|
|
3450
|
-
"Bitfab: apiKey is empty
|
|
3450
|
+
"Bitfab: apiKey is empty - tracing is disabled. Provide a valid API key to enable tracing."
|
|
3451
3451
|
);
|
|
3452
3452
|
}
|
|
3453
3453
|
return void 0;
|
|
@@ -3711,7 +3711,7 @@ var Bitfab = class {
|
|
|
3711
3711
|
* Wrap a BAML client method to automatically capture prompt and LLM metadata.
|
|
3712
3712
|
*
|
|
3713
3713
|
* Creates a BAML Collector, calls the method through a tracked client,
|
|
3714
|
-
* then extracts rendered messages and token usage
|
|
3714
|
+
* then extracts rendered messages and token usage - calling setPrompt()
|
|
3715
3715
|
* and addContext() on the current span automatically.
|
|
3716
3716
|
*
|
|
3717
3717
|
* The BAML client can be provided in the constructor or passed explicitly:
|
|
@@ -4098,7 +4098,7 @@ var Bitfab = class {
|
|
|
4098
4098
|
* Get a detached handle to a previously-created trace, looked up by the
|
|
4099
4099
|
* caller-supplied id (the same id passed at trace creation).
|
|
4100
4100
|
*
|
|
4101
|
-
* The returned handle is not tied to AsyncLocalStorage
|
|
4101
|
+
* The returned handle is not tied to AsyncLocalStorage - each method sends
|
|
4102
4102
|
* to the server immediately. Useful for adding context to a trace from a
|
|
4103
4103
|
* different process or thread than the one that created it.
|
|
4104
4104
|
*
|
|
@@ -4279,7 +4279,7 @@ var Bitfab = class {
|
|
|
4279
4279
|
* plain callable: plain callables are wrapped internally so each replayed
|
|
4280
4280
|
* invocation records a trace tied to the test run. The plain-callable form
|
|
4281
4281
|
* is how handler-instrumented workflows (LangGraph/LangChain, Claude Agent
|
|
4282
|
-
* SDK) replay
|
|
4282
|
+
* SDK) replay - those record traces under a key with no `withSpan`-wrapped
|
|
4283
4283
|
* root in the app.
|
|
4284
4284
|
*
|
|
4285
4285
|
* @param traceFunctionKey - The trace function key to replay
|
|
@@ -4431,7 +4431,7 @@ var BitfabFunction = class {
|
|
|
4431
4431
|
return this.client.getLangGraphCallbackHandler(this.traceFunctionKey);
|
|
4432
4432
|
}
|
|
4433
4433
|
/**
|
|
4434
|
-
* Alias of {@link getLangGraphCallbackHandler}
|
|
4434
|
+
* Alias of {@link getLangGraphCallbackHandler} - LangChain and LangGraph
|
|
4435
4435
|
* share one callback system, so the same bound handler serves both.
|
|
4436
4436
|
*
|
|
4437
4437
|
* @returns A LangChain callback handler for this client and key
|
|
@@ -4446,7 +4446,7 @@ var BitfabFunction = class {
|
|
|
4446
4446
|
* Unlike the other methods on this handle, `wrapBAML` does NOT use the bound
|
|
4447
4447
|
* key: it opens no span of its own. It enriches the *current* span (via
|
|
4448
4448
|
* `getCurrentSpan().setPrompt()` / `addContext()`), so call it inside a
|
|
4449
|
-
* function wrapped by this handle's `withSpan`
|
|
4449
|
+
* function wrapped by this handle's `withSpan` - the bound key keys that
|
|
4450
4450
|
* wrapper, and the BAML prompt/metadata attach to it.
|
|
4451
4451
|
*
|
|
4452
4452
|
* @param methodOrClient - Either a BAML method (uses constructor bamlClient) or the BAML client instance
|