@bitfab/sdk 0.23.3 → 0.24.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-EQI6ZJC3.js → chunk-26MUT4IP.js} +57 -2
- package/dist/chunk-26MUT4IP.js.map +1 -0
- package/dist/{chunk-CG6LVLBK.js → chunk-J4D6PRM4.js} +303 -203
- package/dist/chunk-J4D6PRM4.js.map +1 -0
- package/dist/index.cjs +382 -203
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -8
- package/dist/index.d.ts +18 -8
- package/dist/index.js +2 -2
- package/dist/node.cjs +382 -203
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +0 -1
- package/dist/node.d.ts +0 -1
- package/dist/node.js +2 -2
- package/dist/{replay-V6RPJYXZ.js → replay-NMQA7XY6.js} +12 -4
- package/dist/replay-NMQA7XY6.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-CG6LVLBK.js.map +0 -1
- package/dist/chunk-EQI6ZJC3.js.map +0 -1
- package/dist/replay-V6RPJYXZ.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Agent, AgentInputItem, RunState, NonStreamRunOptions, RunResult, StreamRunOptions, StreamedRunResult } from '@openai/agents';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* BAML execution utilities for the Bitfab TypeScript SDK.
|
|
5
3
|
* This module provides functions to execute BAML prompts dynamically on the client side.
|
|
@@ -457,14 +455,21 @@ declare class BitfabLangGraphCallbackHandler {
|
|
|
457
455
|
* Use both together: register the processor once at startup, then call
|
|
458
456
|
* `handler.wrapRun(agent, input)` instead of `run(agent, input)`.
|
|
459
457
|
*/
|
|
460
|
-
|
|
458
|
+
type AgentLike = any;
|
|
459
|
+
type RunInput = string | unknown[] | Record<string, unknown>;
|
|
460
|
+
type RunOptions = {
|
|
461
|
+
stream?: boolean;
|
|
462
|
+
} & Record<string, unknown>;
|
|
463
|
+
type RunResultLike = {
|
|
464
|
+
finalOutput?: unknown;
|
|
465
|
+
completed?: Promise<void>;
|
|
466
|
+
};
|
|
461
467
|
type RootSpanOptions = {
|
|
462
468
|
type: "agent";
|
|
463
469
|
finalize: (result: unknown) => unknown | Promise<unknown>;
|
|
464
470
|
};
|
|
465
471
|
type WithSpanFn = <TArgs extends unknown[], TReturn>(traceFunctionKey: string, options: RootSpanOptions, fn: (...args: TArgs) => TReturn) => (...args: TArgs) => TReturn;
|
|
466
472
|
type GetActiveSpanContextFn = () => unknown | null;
|
|
467
|
-
type RunInput<TContext, TAgent extends Agent<any, any>> = string | AgentInputItem[] | RunState<TContext, TAgent>;
|
|
468
473
|
/**
|
|
469
474
|
* OpenAI Agents SDK handler that records a replayable root span around a run.
|
|
470
475
|
*
|
|
@@ -506,8 +511,7 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
506
511
|
* be registered: it captures the LLM/tool/handoff spans that nest beneath
|
|
507
512
|
* this root.
|
|
508
513
|
*/
|
|
509
|
-
wrapRun
|
|
510
|
-
wrapRun<TAgent extends Agent<any, any>, TContext = undefined>(agent: TAgent, input: RunInput<TContext, TAgent>, options: StreamRunOptions<TContext>): Promise<StreamedRunResult<TContext, TAgent>>;
|
|
514
|
+
wrapRun(agent: AgentLike, input: RunInput, options?: RunOptions): Promise<RunResultLike>;
|
|
511
515
|
}
|
|
512
516
|
|
|
513
517
|
/**
|
|
@@ -680,7 +684,13 @@ interface ReplayItem<T> {
|
|
|
680
684
|
error: string | null;
|
|
681
685
|
/** Original trace duration in milliseconds, or null if timestamps are missing. */
|
|
682
686
|
durationMs: number | null;
|
|
683
|
-
/**
|
|
687
|
+
/**
|
|
688
|
+
* Token usage from the REPLAYED run (this item's new execution), aggregated
|
|
689
|
+
* server-side from the spans it produced, or null if the run captured no
|
|
690
|
+
* token data. This is the "new" side of a token delta: compare it against
|
|
691
|
+
* the original trace's recorded usage to see how the code change moved cost.
|
|
692
|
+
* Matches what Studio's experiments view shows.
|
|
693
|
+
*/
|
|
684
694
|
tokens: TokenUsage | null;
|
|
685
695
|
/** Model name from the original trace, or null if not captured. */
|
|
686
696
|
model: string | null;
|
|
@@ -1370,7 +1380,7 @@ declare class BitfabFunction {
|
|
|
1370
1380
|
/**
|
|
1371
1381
|
* SDK version from package.json (injected at build time)
|
|
1372
1382
|
*/
|
|
1373
|
-
declare const __version__ = "0.
|
|
1383
|
+
declare const __version__ = "0.24.1";
|
|
1374
1384
|
|
|
1375
1385
|
/**
|
|
1376
1386
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Agent, AgentInputItem, RunState, NonStreamRunOptions, RunResult, StreamRunOptions, StreamedRunResult } from '@openai/agents';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* BAML execution utilities for the Bitfab TypeScript SDK.
|
|
5
3
|
* This module provides functions to execute BAML prompts dynamically on the client side.
|
|
@@ -457,14 +455,21 @@ declare class BitfabLangGraphCallbackHandler {
|
|
|
457
455
|
* Use both together: register the processor once at startup, then call
|
|
458
456
|
* `handler.wrapRun(agent, input)` instead of `run(agent, input)`.
|
|
459
457
|
*/
|
|
460
|
-
|
|
458
|
+
type AgentLike = any;
|
|
459
|
+
type RunInput = string | unknown[] | Record<string, unknown>;
|
|
460
|
+
type RunOptions = {
|
|
461
|
+
stream?: boolean;
|
|
462
|
+
} & Record<string, unknown>;
|
|
463
|
+
type RunResultLike = {
|
|
464
|
+
finalOutput?: unknown;
|
|
465
|
+
completed?: Promise<void>;
|
|
466
|
+
};
|
|
461
467
|
type RootSpanOptions = {
|
|
462
468
|
type: "agent";
|
|
463
469
|
finalize: (result: unknown) => unknown | Promise<unknown>;
|
|
464
470
|
};
|
|
465
471
|
type WithSpanFn = <TArgs extends unknown[], TReturn>(traceFunctionKey: string, options: RootSpanOptions, fn: (...args: TArgs) => TReturn) => (...args: TArgs) => TReturn;
|
|
466
472
|
type GetActiveSpanContextFn = () => unknown | null;
|
|
467
|
-
type RunInput<TContext, TAgent extends Agent<any, any>> = string | AgentInputItem[] | RunState<TContext, TAgent>;
|
|
468
473
|
/**
|
|
469
474
|
* OpenAI Agents SDK handler that records a replayable root span around a run.
|
|
470
475
|
*
|
|
@@ -506,8 +511,7 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
506
511
|
* be registered: it captures the LLM/tool/handoff spans that nest beneath
|
|
507
512
|
* this root.
|
|
508
513
|
*/
|
|
509
|
-
wrapRun
|
|
510
|
-
wrapRun<TAgent extends Agent<any, any>, TContext = undefined>(agent: TAgent, input: RunInput<TContext, TAgent>, options: StreamRunOptions<TContext>): Promise<StreamedRunResult<TContext, TAgent>>;
|
|
514
|
+
wrapRun(agent: AgentLike, input: RunInput, options?: RunOptions): Promise<RunResultLike>;
|
|
511
515
|
}
|
|
512
516
|
|
|
513
517
|
/**
|
|
@@ -680,7 +684,13 @@ interface ReplayItem<T> {
|
|
|
680
684
|
error: string | null;
|
|
681
685
|
/** Original trace duration in milliseconds, or null if timestamps are missing. */
|
|
682
686
|
durationMs: number | null;
|
|
683
|
-
/**
|
|
687
|
+
/**
|
|
688
|
+
* Token usage from the REPLAYED run (this item's new execution), aggregated
|
|
689
|
+
* server-side from the spans it produced, or null if the run captured no
|
|
690
|
+
* token data. This is the "new" side of a token delta: compare it against
|
|
691
|
+
* the original trace's recorded usage to see how the code change moved cost.
|
|
692
|
+
* Matches what Studio's experiments view shows.
|
|
693
|
+
*/
|
|
684
694
|
tokens: TokenUsage | null;
|
|
685
695
|
/** Model name from the original trace, or null if not captured. */
|
|
686
696
|
model: string | null;
|
|
@@ -1370,7 +1380,7 @@ declare class BitfabFunction {
|
|
|
1370
1380
|
/**
|
|
1371
1381
|
* SDK version from package.json (injected at build time)
|
|
1372
1382
|
*/
|
|
1373
|
-
declare const __version__ = "0.
|
|
1383
|
+
declare const __version__ = "0.24.1";
|
|
1374
1384
|
|
|
1375
1385
|
/**
|
|
1376
1386
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
flushTraces,
|
|
15
15
|
getCurrentSpan,
|
|
16
16
|
getCurrentTrace
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-J4D6PRM4.js";
|
|
18
18
|
import {
|
|
19
19
|
BitfabError
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-26MUT4IP.js";
|
|
21
21
|
export {
|
|
22
22
|
Bitfab,
|
|
23
23
|
BitfabClaudeAgentHandler,
|