braintrust 0.0.186 → 0.0.188
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/browser.d.mts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +16 -4
- package/dist/browser.mjs +16 -4
- package/dist/cli.js +17 -6
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -4
- package/dist/index.mjs +16 -4
- package/package.json +3 -3
package/dist/browser.d.mts
CHANGED
|
@@ -1056,7 +1056,7 @@ declare const traceable: typeof wrapTraced;
|
|
|
1056
1056
|
*
|
|
1057
1057
|
* See {@link traced} for full details.
|
|
1058
1058
|
*/
|
|
1059
|
-
declare function startSpan<IsAsyncFlush extends boolean =
|
|
1059
|
+
declare function startSpan<IsAsyncFlush extends boolean = true>(args?: StartSpanArgs & AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): Span;
|
|
1060
1060
|
/**
|
|
1061
1061
|
* Flush any pending rows to the server.
|
|
1062
1062
|
*/
|
package/dist/browser.d.ts
CHANGED
|
@@ -1056,7 +1056,7 @@ declare const traceable: typeof wrapTraced;
|
|
|
1056
1056
|
*
|
|
1057
1057
|
* See {@link traced} for full details.
|
|
1058
1058
|
*/
|
|
1059
|
-
declare function startSpan<IsAsyncFlush extends boolean =
|
|
1059
|
+
declare function startSpan<IsAsyncFlush extends boolean = true>(args?: StartSpanArgs & AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): Span;
|
|
1060
1060
|
/**
|
|
1061
1061
|
* Flush any pending rows to the server.
|
|
1062
1062
|
*/
|
package/dist/browser.js
CHANGED
|
@@ -2346,7 +2346,7 @@ function initLogger(options = {}) {
|
|
|
2346
2346
|
const {
|
|
2347
2347
|
projectName,
|
|
2348
2348
|
projectId,
|
|
2349
|
-
asyncFlush,
|
|
2349
|
+
asyncFlush: asyncFlushArg,
|
|
2350
2350
|
appUrl,
|
|
2351
2351
|
apiKey,
|
|
2352
2352
|
orgName,
|
|
@@ -2354,6 +2354,7 @@ function initLogger(options = {}) {
|
|
|
2354
2354
|
fetch: fetch2,
|
|
2355
2355
|
state: stateArg
|
|
2356
2356
|
} = options || {};
|
|
2357
|
+
const asyncFlush = asyncFlushArg === void 0 ? true : asyncFlushArg;
|
|
2357
2358
|
const computeMetadataArgs = {
|
|
2358
2359
|
project_name: projectName,
|
|
2359
2360
|
project_id: projectId
|
|
@@ -2501,6 +2502,17 @@ async function loginToState(options = {}) {
|
|
|
2501
2502
|
);
|
|
2502
2503
|
const info = await resp.json();
|
|
2503
2504
|
_check_org_info(state, info.org_info, orgName);
|
|
2505
|
+
if (!state.apiUrl) {
|
|
2506
|
+
if (orgName) {
|
|
2507
|
+
throw new Error(
|
|
2508
|
+
`Unable to log into organization '${orgName}'. Are you sure this credential is scoped to the organization?`
|
|
2509
|
+
);
|
|
2510
|
+
} else {
|
|
2511
|
+
throw new Error(
|
|
2512
|
+
"Unable to log into any organization with the provided credential."
|
|
2513
|
+
);
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2504
2516
|
conn = state.apiConn();
|
|
2505
2517
|
conn.set_token(apiKey);
|
|
2506
2518
|
} else {
|
|
@@ -2598,7 +2610,7 @@ function traced(callback, args) {
|
|
|
2598
2610
|
},
|
|
2599
2611
|
() => span.end()
|
|
2600
2612
|
);
|
|
2601
|
-
if (args?.asyncFlush) {
|
|
2613
|
+
if (args?.asyncFlush === void 0 || args?.asyncFlush) {
|
|
2602
2614
|
return ret;
|
|
2603
2615
|
} else {
|
|
2604
2616
|
return (async () => {
|
|
@@ -2687,7 +2699,7 @@ function startSpanAndIsLogger(args) {
|
|
|
2687
2699
|
span,
|
|
2688
2700
|
isSyncFlushLogger: components.data.object_type === import_core.SpanObjectTypeV3.PROJECT_LOGS && // Since there's no parent logger here, we're free to choose the async flush
|
|
2689
2701
|
// behavior, and therefore propagate along whatever we get from the arguments
|
|
2690
|
-
|
|
2702
|
+
args?.asyncFlush === false
|
|
2691
2703
|
};
|
|
2692
2704
|
} else {
|
|
2693
2705
|
const parentObject = getSpanParentObject({
|
|
@@ -2696,7 +2708,7 @@ function startSpanAndIsLogger(args) {
|
|
|
2696
2708
|
const span = parentObject.startSpan(args);
|
|
2697
2709
|
return {
|
|
2698
2710
|
span,
|
|
2699
|
-
isSyncFlushLogger: parentObject.kind === "logger" &&
|
|
2711
|
+
isSyncFlushLogger: parentObject.kind === "logger" && parentObject.asyncFlush === false
|
|
2700
2712
|
};
|
|
2701
2713
|
}
|
|
2702
2714
|
}
|
package/dist/browser.mjs
CHANGED
|
@@ -2295,7 +2295,7 @@ function initLogger(options = {}) {
|
|
|
2295
2295
|
const {
|
|
2296
2296
|
projectName,
|
|
2297
2297
|
projectId,
|
|
2298
|
-
asyncFlush,
|
|
2298
|
+
asyncFlush: asyncFlushArg,
|
|
2299
2299
|
appUrl,
|
|
2300
2300
|
apiKey,
|
|
2301
2301
|
orgName,
|
|
@@ -2303,6 +2303,7 @@ function initLogger(options = {}) {
|
|
|
2303
2303
|
fetch: fetch2,
|
|
2304
2304
|
state: stateArg
|
|
2305
2305
|
} = options || {};
|
|
2306
|
+
const asyncFlush = asyncFlushArg === void 0 ? true : asyncFlushArg;
|
|
2306
2307
|
const computeMetadataArgs = {
|
|
2307
2308
|
project_name: projectName,
|
|
2308
2309
|
project_id: projectId
|
|
@@ -2450,6 +2451,17 @@ async function loginToState(options = {}) {
|
|
|
2450
2451
|
);
|
|
2451
2452
|
const info = await resp.json();
|
|
2452
2453
|
_check_org_info(state, info.org_info, orgName);
|
|
2454
|
+
if (!state.apiUrl) {
|
|
2455
|
+
if (orgName) {
|
|
2456
|
+
throw new Error(
|
|
2457
|
+
`Unable to log into organization '${orgName}'. Are you sure this credential is scoped to the organization?`
|
|
2458
|
+
);
|
|
2459
|
+
} else {
|
|
2460
|
+
throw new Error(
|
|
2461
|
+
"Unable to log into any organization with the provided credential."
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2453
2465
|
conn = state.apiConn();
|
|
2454
2466
|
conn.set_token(apiKey);
|
|
2455
2467
|
} else {
|
|
@@ -2547,7 +2559,7 @@ function traced(callback, args) {
|
|
|
2547
2559
|
},
|
|
2548
2560
|
() => span.end()
|
|
2549
2561
|
);
|
|
2550
|
-
if (args?.asyncFlush) {
|
|
2562
|
+
if (args?.asyncFlush === void 0 || args?.asyncFlush) {
|
|
2551
2563
|
return ret;
|
|
2552
2564
|
} else {
|
|
2553
2565
|
return (async () => {
|
|
@@ -2636,7 +2648,7 @@ function startSpanAndIsLogger(args) {
|
|
|
2636
2648
|
span,
|
|
2637
2649
|
isSyncFlushLogger: components.data.object_type === SpanObjectTypeV3.PROJECT_LOGS && // Since there's no parent logger here, we're free to choose the async flush
|
|
2638
2650
|
// behavior, and therefore propagate along whatever we get from the arguments
|
|
2639
|
-
|
|
2651
|
+
args?.asyncFlush === false
|
|
2640
2652
|
};
|
|
2641
2653
|
} else {
|
|
2642
2654
|
const parentObject = getSpanParentObject({
|
|
@@ -2645,7 +2657,7 @@ function startSpanAndIsLogger(args) {
|
|
|
2645
2657
|
const span = parentObject.startSpan(args);
|
|
2646
2658
|
return {
|
|
2647
2659
|
span,
|
|
2648
|
-
isSyncFlushLogger: parentObject.kind === "logger" &&
|
|
2660
|
+
isSyncFlushLogger: parentObject.kind === "logger" && parentObject.asyncFlush === false
|
|
2649
2661
|
};
|
|
2650
2662
|
}
|
|
2651
2663
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1236,7 +1236,7 @@ var require_package = __commonJS({
|
|
|
1236
1236
|
"package.json"(exports2, module2) {
|
|
1237
1237
|
module2.exports = {
|
|
1238
1238
|
name: "braintrust",
|
|
1239
|
-
version: "0.0.
|
|
1239
|
+
version: "0.0.188",
|
|
1240
1240
|
description: "SDK for integrating Braintrust",
|
|
1241
1241
|
repository: {
|
|
1242
1242
|
type: "git",
|
|
@@ -1311,7 +1311,7 @@ var require_package = __commonJS({
|
|
|
1311
1311
|
},
|
|
1312
1312
|
dependencies: {
|
|
1313
1313
|
"@ai-sdk/provider": "^1.0.1",
|
|
1314
|
-
"@braintrust/core": "0.0.
|
|
1314
|
+
"@braintrust/core": "0.0.81",
|
|
1315
1315
|
"@next/env": "^14.2.3",
|
|
1316
1316
|
"@vercel/functions": "^1.0.2",
|
|
1317
1317
|
ai: "^3.2.16",
|
|
@@ -1319,7 +1319,7 @@ var require_package = __commonJS({
|
|
|
1319
1319
|
chalk: "^4.1.2",
|
|
1320
1320
|
"cli-progress": "^3.12.0",
|
|
1321
1321
|
dotenv: "^16.4.5",
|
|
1322
|
-
esbuild: "^0.
|
|
1322
|
+
esbuild: "^0.25.0",
|
|
1323
1323
|
"eventsource-parser": "^1.1.2",
|
|
1324
1324
|
"graceful-fs": "^4.2.11",
|
|
1325
1325
|
minimatch: "^9.0.3",
|
|
@@ -3531,6 +3531,17 @@ async function loginToState(options = {}) {
|
|
|
3531
3531
|
);
|
|
3532
3532
|
const info = await resp.json();
|
|
3533
3533
|
_check_org_info(state, info.org_info, orgName);
|
|
3534
|
+
if (!state.apiUrl) {
|
|
3535
|
+
if (orgName) {
|
|
3536
|
+
throw new Error(
|
|
3537
|
+
`Unable to log into organization '${orgName}'. Are you sure this credential is scoped to the organization?`
|
|
3538
|
+
);
|
|
3539
|
+
} else {
|
|
3540
|
+
throw new Error(
|
|
3541
|
+
"Unable to log into any organization with the provided credential."
|
|
3542
|
+
);
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3534
3545
|
conn = state.apiConn();
|
|
3535
3546
|
conn.set_token(apiKey);
|
|
3536
3547
|
} else {
|
|
@@ -3608,7 +3619,7 @@ function traced(callback, args) {
|
|
|
3608
3619
|
},
|
|
3609
3620
|
() => span.end()
|
|
3610
3621
|
);
|
|
3611
|
-
if (args?.asyncFlush) {
|
|
3622
|
+
if (args?.asyncFlush === void 0 || args?.asyncFlush) {
|
|
3612
3623
|
return ret;
|
|
3613
3624
|
} else {
|
|
3614
3625
|
return (async () => {
|
|
@@ -3648,7 +3659,7 @@ function startSpanAndIsLogger(args) {
|
|
|
3648
3659
|
span,
|
|
3649
3660
|
isSyncFlushLogger: components.data.object_type === import_core.SpanObjectTypeV3.PROJECT_LOGS && // Since there's no parent logger here, we're free to choose the async flush
|
|
3650
3661
|
// behavior, and therefore propagate along whatever we get from the arguments
|
|
3651
|
-
|
|
3662
|
+
args?.asyncFlush === false
|
|
3652
3663
|
};
|
|
3653
3664
|
} else {
|
|
3654
3665
|
const parentObject = getSpanParentObject({
|
|
@@ -3657,7 +3668,7 @@ function startSpanAndIsLogger(args) {
|
|
|
3657
3668
|
const span = parentObject.startSpan(args);
|
|
3658
3669
|
return {
|
|
3659
3670
|
span,
|
|
3660
|
-
isSyncFlushLogger: parentObject.kind === "logger" &&
|
|
3671
|
+
isSyncFlushLogger: parentObject.kind === "logger" && parentObject.asyncFlush === false
|
|
3661
3672
|
};
|
|
3662
3673
|
}
|
|
3663
3674
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1058,7 +1058,7 @@ declare const traceable: typeof wrapTraced;
|
|
|
1058
1058
|
*
|
|
1059
1059
|
* See {@link traced} for full details.
|
|
1060
1060
|
*/
|
|
1061
|
-
declare function startSpan<IsAsyncFlush extends boolean =
|
|
1061
|
+
declare function startSpan<IsAsyncFlush extends boolean = true>(args?: StartSpanArgs & AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): Span;
|
|
1062
1062
|
/**
|
|
1063
1063
|
* Flush any pending rows to the server.
|
|
1064
1064
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1058,7 +1058,7 @@ declare const traceable: typeof wrapTraced;
|
|
|
1058
1058
|
*
|
|
1059
1059
|
* See {@link traced} for full details.
|
|
1060
1060
|
*/
|
|
1061
|
-
declare function startSpan<IsAsyncFlush extends boolean =
|
|
1061
|
+
declare function startSpan<IsAsyncFlush extends boolean = true>(args?: StartSpanArgs & AsyncFlushArg<IsAsyncFlush> & OptionalStateArg): Span;
|
|
1062
1062
|
/**
|
|
1063
1063
|
* Flush any pending rows to the server.
|
|
1064
1064
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2583,7 +2583,7 @@ function initLogger(options = {}) {
|
|
|
2583
2583
|
const {
|
|
2584
2584
|
projectName,
|
|
2585
2585
|
projectId,
|
|
2586
|
-
asyncFlush,
|
|
2586
|
+
asyncFlush: asyncFlushArg,
|
|
2587
2587
|
appUrl,
|
|
2588
2588
|
apiKey,
|
|
2589
2589
|
orgName,
|
|
@@ -2591,6 +2591,7 @@ function initLogger(options = {}) {
|
|
|
2591
2591
|
fetch: fetch2,
|
|
2592
2592
|
state: stateArg
|
|
2593
2593
|
} = options || {};
|
|
2594
|
+
const asyncFlush = asyncFlushArg === void 0 ? true : asyncFlushArg;
|
|
2594
2595
|
const computeMetadataArgs = {
|
|
2595
2596
|
project_name: projectName,
|
|
2596
2597
|
project_id: projectId
|
|
@@ -2738,6 +2739,17 @@ async function loginToState(options = {}) {
|
|
|
2738
2739
|
);
|
|
2739
2740
|
const info = await resp.json();
|
|
2740
2741
|
_check_org_info(state, info.org_info, orgName);
|
|
2742
|
+
if (!state.apiUrl) {
|
|
2743
|
+
if (orgName) {
|
|
2744
|
+
throw new Error(
|
|
2745
|
+
`Unable to log into organization '${orgName}'. Are you sure this credential is scoped to the organization?`
|
|
2746
|
+
);
|
|
2747
|
+
} else {
|
|
2748
|
+
throw new Error(
|
|
2749
|
+
"Unable to log into any organization with the provided credential."
|
|
2750
|
+
);
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2741
2753
|
conn = state.apiConn();
|
|
2742
2754
|
conn.set_token(apiKey);
|
|
2743
2755
|
} else {
|
|
@@ -2835,7 +2847,7 @@ function traced(callback, args) {
|
|
|
2835
2847
|
},
|
|
2836
2848
|
() => span.end()
|
|
2837
2849
|
);
|
|
2838
|
-
if (args?.asyncFlush) {
|
|
2850
|
+
if (args?.asyncFlush === void 0 || args?.asyncFlush) {
|
|
2839
2851
|
return ret;
|
|
2840
2852
|
} else {
|
|
2841
2853
|
return (async () => {
|
|
@@ -2924,7 +2936,7 @@ function startSpanAndIsLogger(args) {
|
|
|
2924
2936
|
span,
|
|
2925
2937
|
isSyncFlushLogger: components.data.object_type === import_core.SpanObjectTypeV3.PROJECT_LOGS && // Since there's no parent logger here, we're free to choose the async flush
|
|
2926
2938
|
// behavior, and therefore propagate along whatever we get from the arguments
|
|
2927
|
-
|
|
2939
|
+
args?.asyncFlush === false
|
|
2928
2940
|
};
|
|
2929
2941
|
} else {
|
|
2930
2942
|
const parentObject = getSpanParentObject({
|
|
@@ -2933,7 +2945,7 @@ function startSpanAndIsLogger(args) {
|
|
|
2933
2945
|
const span = parentObject.startSpan(args);
|
|
2934
2946
|
return {
|
|
2935
2947
|
span,
|
|
2936
|
-
isSyncFlushLogger: parentObject.kind === "logger" &&
|
|
2948
|
+
isSyncFlushLogger: parentObject.kind === "logger" && parentObject.asyncFlush === false
|
|
2937
2949
|
};
|
|
2938
2950
|
}
|
|
2939
2951
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2515,7 +2515,7 @@ function initLogger(options = {}) {
|
|
|
2515
2515
|
const {
|
|
2516
2516
|
projectName,
|
|
2517
2517
|
projectId,
|
|
2518
|
-
asyncFlush,
|
|
2518
|
+
asyncFlush: asyncFlushArg,
|
|
2519
2519
|
appUrl,
|
|
2520
2520
|
apiKey,
|
|
2521
2521
|
orgName,
|
|
@@ -2523,6 +2523,7 @@ function initLogger(options = {}) {
|
|
|
2523
2523
|
fetch: fetch2,
|
|
2524
2524
|
state: stateArg
|
|
2525
2525
|
} = options || {};
|
|
2526
|
+
const asyncFlush = asyncFlushArg === void 0 ? true : asyncFlushArg;
|
|
2526
2527
|
const computeMetadataArgs = {
|
|
2527
2528
|
project_name: projectName,
|
|
2528
2529
|
project_id: projectId
|
|
@@ -2670,6 +2671,17 @@ async function loginToState(options = {}) {
|
|
|
2670
2671
|
);
|
|
2671
2672
|
const info = await resp.json();
|
|
2672
2673
|
_check_org_info(state, info.org_info, orgName);
|
|
2674
|
+
if (!state.apiUrl) {
|
|
2675
|
+
if (orgName) {
|
|
2676
|
+
throw new Error(
|
|
2677
|
+
`Unable to log into organization '${orgName}'. Are you sure this credential is scoped to the organization?`
|
|
2678
|
+
);
|
|
2679
|
+
} else {
|
|
2680
|
+
throw new Error(
|
|
2681
|
+
"Unable to log into any organization with the provided credential."
|
|
2682
|
+
);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2673
2685
|
conn = state.apiConn();
|
|
2674
2686
|
conn.set_token(apiKey);
|
|
2675
2687
|
} else {
|
|
@@ -2767,7 +2779,7 @@ function traced(callback, args) {
|
|
|
2767
2779
|
},
|
|
2768
2780
|
() => span.end()
|
|
2769
2781
|
);
|
|
2770
|
-
if (args?.asyncFlush) {
|
|
2782
|
+
if (args?.asyncFlush === void 0 || args?.asyncFlush) {
|
|
2771
2783
|
return ret;
|
|
2772
2784
|
} else {
|
|
2773
2785
|
return (async () => {
|
|
@@ -2856,7 +2868,7 @@ function startSpanAndIsLogger(args) {
|
|
|
2856
2868
|
span,
|
|
2857
2869
|
isSyncFlushLogger: components.data.object_type === SpanObjectTypeV3.PROJECT_LOGS && // Since there's no parent logger here, we're free to choose the async flush
|
|
2858
2870
|
// behavior, and therefore propagate along whatever we get from the arguments
|
|
2859
|
-
|
|
2871
|
+
args?.asyncFlush === false
|
|
2860
2872
|
};
|
|
2861
2873
|
} else {
|
|
2862
2874
|
const parentObject = getSpanParentObject({
|
|
@@ -2865,7 +2877,7 @@ function startSpanAndIsLogger(args) {
|
|
|
2865
2877
|
const span = parentObject.startSpan(args);
|
|
2866
2878
|
return {
|
|
2867
2879
|
span,
|
|
2868
|
-
isSyncFlushLogger: parentObject.kind === "logger" &&
|
|
2880
|
+
isSyncFlushLogger: parentObject.kind === "logger" && parentObject.asyncFlush === false
|
|
2869
2881
|
};
|
|
2870
2882
|
}
|
|
2871
2883
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "braintrust",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.188",
|
|
4
4
|
"description": "SDK for integrating Braintrust",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@ai-sdk/provider": "^1.0.1",
|
|
78
|
-
"@braintrust/core": "0.0.
|
|
78
|
+
"@braintrust/core": "0.0.81",
|
|
79
79
|
"@next/env": "^14.2.3",
|
|
80
80
|
"@vercel/functions": "^1.0.2",
|
|
81
81
|
"ai": "^3.2.16",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"chalk": "^4.1.2",
|
|
84
84
|
"cli-progress": "^3.12.0",
|
|
85
85
|
"dotenv": "^16.4.5",
|
|
86
|
-
"esbuild": "^0.
|
|
86
|
+
"esbuild": "^0.25.0",
|
|
87
87
|
"eventsource-parser": "^1.1.2",
|
|
88
88
|
"graceful-fs": "^4.2.11",
|
|
89
89
|
"minimatch": "^9.0.3",
|