bitfab 0.54.3 → 0.54.5
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-DL4KHJON.js → chunk-3O5MS4XJ.js} +2 -2
- package/dist/{chunk-ZO4NEEUA.js → chunk-GVK7AES5.js} +113 -6
- package/dist/chunk-GVK7AES5.js.map +1 -0
- package/dist/{chunk-PELZFWPC.js → chunk-NATC7L2W.js} +124 -54
- package/dist/chunk-NATC7L2W.js.map +1 -0
- package/dist/{chunk-NI6B2BP4.js → chunk-RA3J6A6K.js} +113 -6
- package/dist/chunk-RA3J6A6K.js.map +1 -0
- package/dist/{chunk-4H7E2S27.js → chunk-VAHFHCBT.js} +3 -3
- package/dist/{http-6WMGO7GB.js → http-K2H4547F.js} +2 -2
- package/dist/{http-A5BXPX5R.js → http-RW2JO6TU.js} +2 -2
- package/dist/index.cjs +236 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +114 -73
- package/dist/index.d.ts +114 -73
- package/dist/index.js +3 -3
- package/dist/node.cjs +236 -52
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/{replay-FOVT4PNE.js → replay-MHYULXCH.js} +3 -3
- package/dist/replayCli.js +2 -2
- package/dist/seedCli.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-NI6B2BP4.js.map +0 -1
- package/dist/chunk-PELZFWPC.js.map +0 -1
- package/dist/chunk-ZO4NEEUA.js.map +0 -1
- /package/dist/{chunk-DL4KHJON.js.map → chunk-3O5MS4XJ.js.map} +0 -0
- /package/dist/{chunk-4H7E2S27.js.map → chunk-VAHFHCBT.js.map} +0 -0
- /package/dist/{http-6WMGO7GB.js.map → http-K2H4547F.js.map} +0 -0
- /package/dist/{http-A5BXPX5R.js.map → http-RW2JO6TU.js.map} +0 -0
- /package/dist/{replay-FOVT4PNE.js.map → replay-MHYULXCH.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
declare class TraceCompletion {
|
|
2
|
+
private readonly traces;
|
|
3
|
+
private readonly closed;
|
|
4
|
+
private state;
|
|
5
|
+
start(traceId: string, spanId: string): void;
|
|
6
|
+
open(traceId: string): void;
|
|
7
|
+
hold(traceId: string, key: string): void;
|
|
8
|
+
record(traceId: string, spanId: string): void;
|
|
9
|
+
end(traceId: string, spanId: string): void;
|
|
10
|
+
abort(traceId: string, spanId: string): void;
|
|
11
|
+
close(traceId: string, complete: (count: number) => void, dropped?: boolean): void;
|
|
12
|
+
private drain;
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
/**
|
|
2
16
|
* Per-trace database snapshot ref capture.
|
|
3
17
|
*
|
|
@@ -327,14 +341,6 @@ interface SimulationPlanResponse {
|
|
|
327
341
|
}
|
|
328
342
|
type SimulationPlanSubmit = (payload: Record<string, unknown>) => void;
|
|
329
343
|
|
|
330
|
-
/**
|
|
331
|
-
* HTTP client utilities for Bitfab API requests.
|
|
332
|
-
*
|
|
333
|
-
* This module provides:
|
|
334
|
-
* - HttpClient class for making API requests
|
|
335
|
-
* - awaitOnExit helper so deferred span work still gates process exit
|
|
336
|
-
*/
|
|
337
|
-
|
|
338
344
|
/**
|
|
339
345
|
* Wait for pending fire-and-forget requests AND every live span transport to
|
|
340
346
|
* deliver, within one total deadline. Useful in tests and scripts to ensure all
|
|
@@ -407,6 +413,7 @@ declare class HttpClient {
|
|
|
407
413
|
private traceTransport;
|
|
408
414
|
private readonly traceDeliveries;
|
|
409
415
|
private readonly deferredWork;
|
|
416
|
+
readonly traceCompletion: TraceCompletion;
|
|
410
417
|
private closed;
|
|
411
418
|
private closing;
|
|
412
419
|
externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
|
|
@@ -547,6 +554,7 @@ declare class HttpClient {
|
|
|
547
554
|
* server-authoritative barrier in `replay.ts`, not by awaiting this call.
|
|
548
555
|
*/
|
|
549
556
|
sendExternalTrace(rawPayload: Record<string, unknown>): void;
|
|
557
|
+
private sendCountedExternalTrace;
|
|
550
558
|
submitExternalTrace(payload: Record<string, unknown>): void;
|
|
551
559
|
/**
|
|
552
560
|
* Partial update of an existing trace identified by its Bitfab trace ID.
|
|
@@ -828,68 +836,6 @@ declare class AssertionCategoriesClient {
|
|
|
828
836
|
delete(id: string): Promise<AssertionCategory>;
|
|
829
837
|
}
|
|
830
838
|
|
|
831
|
-
type TraceTargetOccurrence = "first" | "last" | number;
|
|
832
|
-
type TraceTarget = {
|
|
833
|
-
kind: "output";
|
|
834
|
-
} | {
|
|
835
|
-
kind: "span";
|
|
836
|
-
name: string;
|
|
837
|
-
occurrence?: TraceTargetOccurrence;
|
|
838
|
-
};
|
|
839
|
-
type TraceAssertionSource = "human" | "agent";
|
|
840
|
-
type TraceAssertion = {
|
|
841
|
-
id: string;
|
|
842
|
-
traceId: string;
|
|
843
|
-
assertion: string;
|
|
844
|
-
humanNote: string | null;
|
|
845
|
-
category_assertion_id: string | null;
|
|
846
|
-
category: AssertionCategorySummary | null;
|
|
847
|
-
passCriteria: string | null;
|
|
848
|
-
failCriteria: string | null;
|
|
849
|
-
targetOnEvaluatedTrace: TraceTarget | null;
|
|
850
|
-
source: TraceAssertionSource;
|
|
851
|
-
createdAt: string;
|
|
852
|
-
updatedAt: string;
|
|
853
|
-
};
|
|
854
|
-
type SaveAssertion = {
|
|
855
|
-
/** Omit to preserve the category, or pass null to clear it. */
|
|
856
|
-
category_assertion_id?: string | null;
|
|
857
|
-
id?: string;
|
|
858
|
-
assertion: string;
|
|
859
|
-
passCriteria?: string | null;
|
|
860
|
-
failCriteria?: string | null;
|
|
861
|
-
targetOnEvaluatedTrace?: TraceTarget | null;
|
|
862
|
-
};
|
|
863
|
-
type TraceAssertionsResult = {
|
|
864
|
-
assertions: TraceAssertion[];
|
|
865
|
-
inheritedFrom: string | null;
|
|
866
|
-
};
|
|
867
|
-
type TraceAssertionsUpdate = {
|
|
868
|
-
traceId: string;
|
|
869
|
-
assertions: SaveAssertion[];
|
|
870
|
-
};
|
|
871
|
-
type SaveAssertionsParams = {
|
|
872
|
-
traceId: string;
|
|
873
|
-
assertions: SaveAssertion[];
|
|
874
|
-
source?: TraceAssertionSource;
|
|
875
|
-
};
|
|
876
|
-
type SaveAssertionsAllParams = {
|
|
877
|
-
updates: TraceAssertionsUpdate[];
|
|
878
|
-
source?: TraceAssertionSource;
|
|
879
|
-
};
|
|
880
|
-
type ArchiveAssertionsParams = {
|
|
881
|
-
traceId: string;
|
|
882
|
-
assertionIds: string[];
|
|
883
|
-
};
|
|
884
|
-
declare class TracesClient {
|
|
885
|
-
private readonly httpClient;
|
|
886
|
-
constructor(httpClient: HttpClient);
|
|
887
|
-
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
888
|
-
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
889
|
-
saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
|
|
890
|
-
archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
839
|
/**
|
|
894
840
|
* BAML execution utilities for the Bitfab TypeScript SDK.
|
|
895
841
|
* This module provides functions to execute BAML prompts dynamically on the client side.
|
|
@@ -2223,6 +2169,97 @@ declare class ReplayBranch implements Omit<DbBranchLease, "databaseUrl"> {
|
|
|
2223
2169
|
get databaseUrl(): string;
|
|
2224
2170
|
}
|
|
2225
2171
|
|
|
2172
|
+
type TraceTargetOccurrence = "first" | "last" | number;
|
|
2173
|
+
type TraceTarget = {
|
|
2174
|
+
kind: "output";
|
|
2175
|
+
} | {
|
|
2176
|
+
kind: "span";
|
|
2177
|
+
name: string;
|
|
2178
|
+
occurrence?: TraceTargetOccurrence;
|
|
2179
|
+
};
|
|
2180
|
+
type TraceAssertionSource = "human" | "agent";
|
|
2181
|
+
type TraceSearchParams = {
|
|
2182
|
+
/** Exact, case-insensitive key/value matches. Multiple entries are ANDed. */
|
|
2183
|
+
callerMetadata: Record<string, string>;
|
|
2184
|
+
/** Optionally restrict results to one traced function. */
|
|
2185
|
+
traceFunctionKey?: string;
|
|
2186
|
+
/** Opaque cursor returned by the previous page. */
|
|
2187
|
+
cursor?: string | null;
|
|
2188
|
+
/** Page size (default 50, maximum 500). */
|
|
2189
|
+
limit?: number;
|
|
2190
|
+
};
|
|
2191
|
+
type TraceSearchResult = {
|
|
2192
|
+
traces: Array<{
|
|
2193
|
+
id: string;
|
|
2194
|
+
traceFunctionKey: string | null;
|
|
2195
|
+
name: string | null;
|
|
2196
|
+
status: "pending" | "completed" | "failed" | "dropped";
|
|
2197
|
+
createdAt: string;
|
|
2198
|
+
callerMetadata: Record<string, string>;
|
|
2199
|
+
}>;
|
|
2200
|
+
nextCursor: string | null;
|
|
2201
|
+
hasMore: boolean;
|
|
2202
|
+
};
|
|
2203
|
+
type TraceAssertion = {
|
|
2204
|
+
id: string;
|
|
2205
|
+
traceId: string;
|
|
2206
|
+
assertion: string;
|
|
2207
|
+
humanNote: string | null;
|
|
2208
|
+
category_assertion_id: string | null;
|
|
2209
|
+
category: AssertionCategorySummary | null;
|
|
2210
|
+
passCriteria: string | null;
|
|
2211
|
+
failCriteria: string | null;
|
|
2212
|
+
targetOnEvaluatedTrace: TraceTarget | null;
|
|
2213
|
+
source: TraceAssertionSource;
|
|
2214
|
+
createdAt: string;
|
|
2215
|
+
updatedAt: string;
|
|
2216
|
+
};
|
|
2217
|
+
type SaveAssertion = {
|
|
2218
|
+
/** Omit to preserve the category, or pass null to clear it. */
|
|
2219
|
+
category_assertion_id?: string | null;
|
|
2220
|
+
id?: string;
|
|
2221
|
+
assertion: string;
|
|
2222
|
+
passCriteria?: string | null;
|
|
2223
|
+
failCriteria?: string | null;
|
|
2224
|
+
targetOnEvaluatedTrace?: TraceTarget | null;
|
|
2225
|
+
};
|
|
2226
|
+
type TraceAssertionsResult = {
|
|
2227
|
+
assertions: TraceAssertion[];
|
|
2228
|
+
inheritedFrom: string | null;
|
|
2229
|
+
};
|
|
2230
|
+
type TraceAssertionsUpdate = {
|
|
2231
|
+
traceId: string;
|
|
2232
|
+
assertions: SaveAssertion[];
|
|
2233
|
+
};
|
|
2234
|
+
type SaveAssertionsParams = {
|
|
2235
|
+
traceId: string;
|
|
2236
|
+
assertions: SaveAssertion[];
|
|
2237
|
+
source?: TraceAssertionSource;
|
|
2238
|
+
};
|
|
2239
|
+
type SaveAssertionsAllParams = {
|
|
2240
|
+
updates: TraceAssertionsUpdate[];
|
|
2241
|
+
source?: TraceAssertionSource;
|
|
2242
|
+
};
|
|
2243
|
+
type ArchiveAssertionsParams = {
|
|
2244
|
+
traceId: string;
|
|
2245
|
+
assertionIds: string[];
|
|
2246
|
+
};
|
|
2247
|
+
declare class TracesClient {
|
|
2248
|
+
private readonly httpClient;
|
|
2249
|
+
constructor(httpClient: HttpClient);
|
|
2250
|
+
/**
|
|
2251
|
+
* Search traces by exact caller metadata.
|
|
2252
|
+
*
|
|
2253
|
+
* Keys and values are matched case-insensitively. Up to 10 supplied pairs
|
|
2254
|
+
* must match. Use `nextCursor` from the result to fetch another page.
|
|
2255
|
+
*/
|
|
2256
|
+
search(params: TraceSearchParams): Promise<TraceSearchResult>;
|
|
2257
|
+
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
2258
|
+
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
2259
|
+
saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
|
|
2260
|
+
archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2226
2263
|
/**
|
|
2227
2264
|
* Tracing utilities for external trace submission to Bitfab.
|
|
2228
2265
|
*
|
|
@@ -2235,6 +2272,7 @@ interface Trace {
|
|
|
2235
2272
|
toJSON(): unknown;
|
|
2236
2273
|
}
|
|
2237
2274
|
interface Span<_T = any> {
|
|
2275
|
+
spanId?: string;
|
|
2238
2276
|
traceId?: string;
|
|
2239
2277
|
toJSON(): unknown;
|
|
2240
2278
|
spanData?: {
|
|
@@ -2323,11 +2361,14 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2323
2361
|
* since the parent withSpan handles completion.
|
|
2324
2362
|
*/
|
|
2325
2363
|
onTraceEnd(trace: Trace): Promise<void>;
|
|
2364
|
+
private readonly startedSpans;
|
|
2365
|
+
private readonly endedTraces;
|
|
2366
|
+
private cleanupTrace;
|
|
2326
2367
|
/**
|
|
2327
2368
|
* Called when a span is started. Span payloads are authoritative completed
|
|
2328
2369
|
* snapshots, so start notifications do not cross the transport boundary.
|
|
2329
2370
|
*/
|
|
2330
|
-
onSpanStart(
|
|
2371
|
+
onSpanStart(span: Span<any>): Promise<void>;
|
|
2331
2372
|
/**
|
|
2332
2373
|
* Called when a span is ended.
|
|
2333
2374
|
*
|
|
@@ -3379,7 +3420,7 @@ interface CommitRef {
|
|
|
3379
3420
|
/**
|
|
3380
3421
|
* SDK version from package.json (injected at build time)
|
|
3381
3422
|
*/
|
|
3382
|
-
declare const __version__ = "0.54.
|
|
3423
|
+
declare const __version__ = "0.54.5";
|
|
3383
3424
|
|
|
3384
3425
|
/**
|
|
3385
3426
|
* Constants for the Bitfab SDK.
|
|
@@ -3518,4 +3559,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3518
3559
|
run?: boolean;
|
|
3519
3560
|
}): Promise<SeedResult>;
|
|
3520
3561
|
|
|
3521
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
|
3562
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchParams, type TraceSearchResult, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
declare class TraceCompletion {
|
|
2
|
+
private readonly traces;
|
|
3
|
+
private readonly closed;
|
|
4
|
+
private state;
|
|
5
|
+
start(traceId: string, spanId: string): void;
|
|
6
|
+
open(traceId: string): void;
|
|
7
|
+
hold(traceId: string, key: string): void;
|
|
8
|
+
record(traceId: string, spanId: string): void;
|
|
9
|
+
end(traceId: string, spanId: string): void;
|
|
10
|
+
abort(traceId: string, spanId: string): void;
|
|
11
|
+
close(traceId: string, complete: (count: number) => void, dropped?: boolean): void;
|
|
12
|
+
private drain;
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
/**
|
|
2
16
|
* Per-trace database snapshot ref capture.
|
|
3
17
|
*
|
|
@@ -327,14 +341,6 @@ interface SimulationPlanResponse {
|
|
|
327
341
|
}
|
|
328
342
|
type SimulationPlanSubmit = (payload: Record<string, unknown>) => void;
|
|
329
343
|
|
|
330
|
-
/**
|
|
331
|
-
* HTTP client utilities for Bitfab API requests.
|
|
332
|
-
*
|
|
333
|
-
* This module provides:
|
|
334
|
-
* - HttpClient class for making API requests
|
|
335
|
-
* - awaitOnExit helper so deferred span work still gates process exit
|
|
336
|
-
*/
|
|
337
|
-
|
|
338
344
|
/**
|
|
339
345
|
* Wait for pending fire-and-forget requests AND every live span transport to
|
|
340
346
|
* deliver, within one total deadline. Useful in tests and scripts to ensure all
|
|
@@ -407,6 +413,7 @@ declare class HttpClient {
|
|
|
407
413
|
private traceTransport;
|
|
408
414
|
private readonly traceDeliveries;
|
|
409
415
|
private readonly deferredWork;
|
|
416
|
+
readonly traceCompletion: TraceCompletion;
|
|
410
417
|
private closed;
|
|
411
418
|
private closing;
|
|
412
419
|
externalSpanTransform: ((payload: Record<string, unknown>, submit: SimulationPlanSubmit) => void) | undefined;
|
|
@@ -547,6 +554,7 @@ declare class HttpClient {
|
|
|
547
554
|
* server-authoritative barrier in `replay.ts`, not by awaiting this call.
|
|
548
555
|
*/
|
|
549
556
|
sendExternalTrace(rawPayload: Record<string, unknown>): void;
|
|
557
|
+
private sendCountedExternalTrace;
|
|
550
558
|
submitExternalTrace(payload: Record<string, unknown>): void;
|
|
551
559
|
/**
|
|
552
560
|
* Partial update of an existing trace identified by its Bitfab trace ID.
|
|
@@ -828,68 +836,6 @@ declare class AssertionCategoriesClient {
|
|
|
828
836
|
delete(id: string): Promise<AssertionCategory>;
|
|
829
837
|
}
|
|
830
838
|
|
|
831
|
-
type TraceTargetOccurrence = "first" | "last" | number;
|
|
832
|
-
type TraceTarget = {
|
|
833
|
-
kind: "output";
|
|
834
|
-
} | {
|
|
835
|
-
kind: "span";
|
|
836
|
-
name: string;
|
|
837
|
-
occurrence?: TraceTargetOccurrence;
|
|
838
|
-
};
|
|
839
|
-
type TraceAssertionSource = "human" | "agent";
|
|
840
|
-
type TraceAssertion = {
|
|
841
|
-
id: string;
|
|
842
|
-
traceId: string;
|
|
843
|
-
assertion: string;
|
|
844
|
-
humanNote: string | null;
|
|
845
|
-
category_assertion_id: string | null;
|
|
846
|
-
category: AssertionCategorySummary | null;
|
|
847
|
-
passCriteria: string | null;
|
|
848
|
-
failCriteria: string | null;
|
|
849
|
-
targetOnEvaluatedTrace: TraceTarget | null;
|
|
850
|
-
source: TraceAssertionSource;
|
|
851
|
-
createdAt: string;
|
|
852
|
-
updatedAt: string;
|
|
853
|
-
};
|
|
854
|
-
type SaveAssertion = {
|
|
855
|
-
/** Omit to preserve the category, or pass null to clear it. */
|
|
856
|
-
category_assertion_id?: string | null;
|
|
857
|
-
id?: string;
|
|
858
|
-
assertion: string;
|
|
859
|
-
passCriteria?: string | null;
|
|
860
|
-
failCriteria?: string | null;
|
|
861
|
-
targetOnEvaluatedTrace?: TraceTarget | null;
|
|
862
|
-
};
|
|
863
|
-
type TraceAssertionsResult = {
|
|
864
|
-
assertions: TraceAssertion[];
|
|
865
|
-
inheritedFrom: string | null;
|
|
866
|
-
};
|
|
867
|
-
type TraceAssertionsUpdate = {
|
|
868
|
-
traceId: string;
|
|
869
|
-
assertions: SaveAssertion[];
|
|
870
|
-
};
|
|
871
|
-
type SaveAssertionsParams = {
|
|
872
|
-
traceId: string;
|
|
873
|
-
assertions: SaveAssertion[];
|
|
874
|
-
source?: TraceAssertionSource;
|
|
875
|
-
};
|
|
876
|
-
type SaveAssertionsAllParams = {
|
|
877
|
-
updates: TraceAssertionsUpdate[];
|
|
878
|
-
source?: TraceAssertionSource;
|
|
879
|
-
};
|
|
880
|
-
type ArchiveAssertionsParams = {
|
|
881
|
-
traceId: string;
|
|
882
|
-
assertionIds: string[];
|
|
883
|
-
};
|
|
884
|
-
declare class TracesClient {
|
|
885
|
-
private readonly httpClient;
|
|
886
|
-
constructor(httpClient: HttpClient);
|
|
887
|
-
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
888
|
-
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
889
|
-
saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
|
|
890
|
-
archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
839
|
/**
|
|
894
840
|
* BAML execution utilities for the Bitfab TypeScript SDK.
|
|
895
841
|
* This module provides functions to execute BAML prompts dynamically on the client side.
|
|
@@ -2223,6 +2169,97 @@ declare class ReplayBranch implements Omit<DbBranchLease, "databaseUrl"> {
|
|
|
2223
2169
|
get databaseUrl(): string;
|
|
2224
2170
|
}
|
|
2225
2171
|
|
|
2172
|
+
type TraceTargetOccurrence = "first" | "last" | number;
|
|
2173
|
+
type TraceTarget = {
|
|
2174
|
+
kind: "output";
|
|
2175
|
+
} | {
|
|
2176
|
+
kind: "span";
|
|
2177
|
+
name: string;
|
|
2178
|
+
occurrence?: TraceTargetOccurrence;
|
|
2179
|
+
};
|
|
2180
|
+
type TraceAssertionSource = "human" | "agent";
|
|
2181
|
+
type TraceSearchParams = {
|
|
2182
|
+
/** Exact, case-insensitive key/value matches. Multiple entries are ANDed. */
|
|
2183
|
+
callerMetadata: Record<string, string>;
|
|
2184
|
+
/** Optionally restrict results to one traced function. */
|
|
2185
|
+
traceFunctionKey?: string;
|
|
2186
|
+
/** Opaque cursor returned by the previous page. */
|
|
2187
|
+
cursor?: string | null;
|
|
2188
|
+
/** Page size (default 50, maximum 500). */
|
|
2189
|
+
limit?: number;
|
|
2190
|
+
};
|
|
2191
|
+
type TraceSearchResult = {
|
|
2192
|
+
traces: Array<{
|
|
2193
|
+
id: string;
|
|
2194
|
+
traceFunctionKey: string | null;
|
|
2195
|
+
name: string | null;
|
|
2196
|
+
status: "pending" | "completed" | "failed" | "dropped";
|
|
2197
|
+
createdAt: string;
|
|
2198
|
+
callerMetadata: Record<string, string>;
|
|
2199
|
+
}>;
|
|
2200
|
+
nextCursor: string | null;
|
|
2201
|
+
hasMore: boolean;
|
|
2202
|
+
};
|
|
2203
|
+
type TraceAssertion = {
|
|
2204
|
+
id: string;
|
|
2205
|
+
traceId: string;
|
|
2206
|
+
assertion: string;
|
|
2207
|
+
humanNote: string | null;
|
|
2208
|
+
category_assertion_id: string | null;
|
|
2209
|
+
category: AssertionCategorySummary | null;
|
|
2210
|
+
passCriteria: string | null;
|
|
2211
|
+
failCriteria: string | null;
|
|
2212
|
+
targetOnEvaluatedTrace: TraceTarget | null;
|
|
2213
|
+
source: TraceAssertionSource;
|
|
2214
|
+
createdAt: string;
|
|
2215
|
+
updatedAt: string;
|
|
2216
|
+
};
|
|
2217
|
+
type SaveAssertion = {
|
|
2218
|
+
/** Omit to preserve the category, or pass null to clear it. */
|
|
2219
|
+
category_assertion_id?: string | null;
|
|
2220
|
+
id?: string;
|
|
2221
|
+
assertion: string;
|
|
2222
|
+
passCriteria?: string | null;
|
|
2223
|
+
failCriteria?: string | null;
|
|
2224
|
+
targetOnEvaluatedTrace?: TraceTarget | null;
|
|
2225
|
+
};
|
|
2226
|
+
type TraceAssertionsResult = {
|
|
2227
|
+
assertions: TraceAssertion[];
|
|
2228
|
+
inheritedFrom: string | null;
|
|
2229
|
+
};
|
|
2230
|
+
type TraceAssertionsUpdate = {
|
|
2231
|
+
traceId: string;
|
|
2232
|
+
assertions: SaveAssertion[];
|
|
2233
|
+
};
|
|
2234
|
+
type SaveAssertionsParams = {
|
|
2235
|
+
traceId: string;
|
|
2236
|
+
assertions: SaveAssertion[];
|
|
2237
|
+
source?: TraceAssertionSource;
|
|
2238
|
+
};
|
|
2239
|
+
type SaveAssertionsAllParams = {
|
|
2240
|
+
updates: TraceAssertionsUpdate[];
|
|
2241
|
+
source?: TraceAssertionSource;
|
|
2242
|
+
};
|
|
2243
|
+
type ArchiveAssertionsParams = {
|
|
2244
|
+
traceId: string;
|
|
2245
|
+
assertionIds: string[];
|
|
2246
|
+
};
|
|
2247
|
+
declare class TracesClient {
|
|
2248
|
+
private readonly httpClient;
|
|
2249
|
+
constructor(httpClient: HttpClient);
|
|
2250
|
+
/**
|
|
2251
|
+
* Search traces by exact caller metadata.
|
|
2252
|
+
*
|
|
2253
|
+
* Keys and values are matched case-insensitively. Up to 10 supplied pairs
|
|
2254
|
+
* must match. Use `nextCursor` from the result to fetch another page.
|
|
2255
|
+
*/
|
|
2256
|
+
search(params: TraceSearchParams): Promise<TraceSearchResult>;
|
|
2257
|
+
getAssertions(traceId: string): Promise<TraceAssertionsResult>;
|
|
2258
|
+
saveAssertions(params: SaveAssertionsParams): Promise<TraceAssertion[]>;
|
|
2259
|
+
saveAssertionsAll(params: SaveAssertionsAllParams): Promise<TraceAssertion[]>;
|
|
2260
|
+
archiveAssertions(params: ArchiveAssertionsParams): Promise<string[]>;
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2226
2263
|
/**
|
|
2227
2264
|
* Tracing utilities for external trace submission to Bitfab.
|
|
2228
2265
|
*
|
|
@@ -2235,6 +2272,7 @@ interface Trace {
|
|
|
2235
2272
|
toJSON(): unknown;
|
|
2236
2273
|
}
|
|
2237
2274
|
interface Span<_T = any> {
|
|
2275
|
+
spanId?: string;
|
|
2238
2276
|
traceId?: string;
|
|
2239
2277
|
toJSON(): unknown;
|
|
2240
2278
|
spanData?: {
|
|
@@ -2323,11 +2361,14 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
|
|
|
2323
2361
|
* since the parent withSpan handles completion.
|
|
2324
2362
|
*/
|
|
2325
2363
|
onTraceEnd(trace: Trace): Promise<void>;
|
|
2364
|
+
private readonly startedSpans;
|
|
2365
|
+
private readonly endedTraces;
|
|
2366
|
+
private cleanupTrace;
|
|
2326
2367
|
/**
|
|
2327
2368
|
* Called when a span is started. Span payloads are authoritative completed
|
|
2328
2369
|
* snapshots, so start notifications do not cross the transport boundary.
|
|
2329
2370
|
*/
|
|
2330
|
-
onSpanStart(
|
|
2371
|
+
onSpanStart(span: Span<any>): Promise<void>;
|
|
2331
2372
|
/**
|
|
2332
2373
|
* Called when a span is ended.
|
|
2333
2374
|
*
|
|
@@ -3379,7 +3420,7 @@ interface CommitRef {
|
|
|
3379
3420
|
/**
|
|
3380
3421
|
* SDK version from package.json (injected at build time)
|
|
3381
3422
|
*/
|
|
3382
|
-
declare const __version__ = "0.54.
|
|
3423
|
+
declare const __version__ = "0.54.5";
|
|
3383
3424
|
|
|
3384
3425
|
/**
|
|
3385
3426
|
* Constants for the Bitfab SDK.
|
|
@@ -3518,4 +3559,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
|
|
|
3518
3559
|
run?: boolean;
|
|
3519
3560
|
}): Promise<SeedResult>;
|
|
3520
3561
|
|
|
3521
|
-
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
|
3562
|
+
export { type ActiveSpanContext, type AdaptContext, type AdaptInputsFn, type AddDatasetGradersResult, type AddDatasetTracesResult, type AllowedEnvVars, type ArchiveAssertionsParams, AssertionCategoriesClient, type AssertionCategory, type AssertionCategorySummary, type AssertionVerdict, BITFAB_PROGRESS_PREFIX, type BamlExecutionResult, Bitfab, BitfabClaudeAgentHandler, type BitfabConfig, BitfabError, BitfabFunction, BitfabLangGraphCallbackHandler as BitfabLangChainCallbackHandler, BitfabLangGraphCallbackHandler, BitfabLangGraphIntegration, type BitfabLanguageModelMiddleware, BitfabOpenAIAgentHandler, BitfabOpenAITracingProcessor, BitfabVercelAiHandler, type CaptureSurface, type CaptureWhen, type CapturedSpan, type CodeChangeFile, type CommitRef, type CurrentSpan, type CurrentTrace, DEFAULT_SERVICE_URL, type Dataset, type DatasetGraderRef, type DatasetTraceIds, DatasetsClient, type DbBranchOptions, DbBranchReplayError, type DbBranchTimings, type DbSnapshotConfig, type DbSnapshotProvider, type DbSnapshotRef, type DetachedTrace, type GetGraderLabelsParams, type GraderLabel, type GraderLabelSource, type GraderRerun, type GraderRerunProgress, type GraderRerunResult, type GraderRerunStatus, GradersClient, HttpClient, type HumanLabelOutcome, type HumanLabelUpdate, type LabelAction, type LabelConfidence, type LabelOutcome, type LabelSource, type LabelStatus, type LabelUpdate, LabelsClient, type LangGraphIntegrationOptions, type ListDatasetsParams, MixedTracingError, type MockOverride, type MockOverrideCtx, type MockOverrideInput, type MockOverrideResolver, type MockStrategy, type MockValue, NO_MOCK_OVERRIDE, type NodeMatcher, type NodeMethodDecorator, type NodeOptions, type ProviderDefinition, type RemoveDatasetGradersResult, type RemoveDatasetTracesResult, ReplayBranch, ReplayError, type ReplayItem, type ReplayItemFinishProgress, type ReplayItemStartProgress, type ReplayOptions, type ReplayOptionsFactory, type ReplayProgress, type ReplayProgressItem, type ReplayRegistration, type ReplayRegistry, type ReplayRegistryContext, type ReplayRegistryOptions, type ReplayResult, type RerunGradersOptions, type RerunGradersResult, type ReseedOptions, type ReseedRegistryResult, type ReseedResult, SUPPORTED_PROVIDERS, type SaveAssertion, type SaveAssertionCategoryParams, type SaveAssertionsAllParams, type SaveAssertionsParams, type SaveDatasetParams, type SaveDatasetResult, type SeedCase, type SeedCaseOptions, type SeedResult, type SeedRunOptions, type SpanLookup, type SpanMethodDecorator, type SpanMethodDecoratorContext, type SpanNodeMeta, type SpanOccurrence, type SpanOptions, type SpanType, type TokenUsage, type TraceAssertion, type TraceAssertionSource, type TraceAssertionsResult, type TraceAssertionsUpdate, type TraceIngestionType, type TraceLabels, type TraceOutline, type TraceOutlineSpan, type TraceOutlineSpanError, type TraceResponse, type TraceSearchParams, type TraceSearchResult, type TraceTarget, type TraceTargetOccurrence, TracesClient, type TracingProcessor, type VercelCallParams, type VercelGenerateResult, type VercelStreamResult, type WrapBAMLOptions, type WrappedBamlFn, __version__, defineReplayRegistry, finalizers, flushTraces, getCurrentReplayBranch, getCurrentSpan, getCurrentTrace, reportReplayProgress, reseedFromRegistry, seedFromRegistry, serializeReplayResult };
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
getCurrentTrace,
|
|
30
30
|
reseedFromRegistry,
|
|
31
31
|
seedFromRegistry
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-NATC7L2W.js";
|
|
33
33
|
import "./chunk-EGWJYCNT.js";
|
|
34
34
|
import {
|
|
35
35
|
BITFAB_PROGRESS_PREFIX,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
ReplayError,
|
|
39
39
|
reportReplayProgress,
|
|
40
40
|
serializeReplayResult
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-3O5MS4XJ.js";
|
|
42
42
|
import {
|
|
43
43
|
BitfabError,
|
|
44
44
|
DEFAULT_SERVICE_URL,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
MixedTracingError,
|
|
47
47
|
__version__,
|
|
48
48
|
flushTraces
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-GVK7AES5.js";
|
|
50
50
|
import "./chunk-VCRFFCLY.js";
|
|
51
51
|
export {
|
|
52
52
|
AssertionCategoriesClient,
|