braintrust 3.26.0 → 3.28.0
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/dev/dist/index.d.mts +519 -186
- package/dev/dist/index.d.ts +519 -186
- package/dev/dist/index.js +3727 -1526
- package/dev/dist/index.mjs +2815 -614
- package/dist/apply-auto-instrumentation.js +372 -261
- package/dist/apply-auto-instrumentation.mjs +171 -60
- package/dist/auto-instrumentations/bundler/esbuild.cjs +458 -61
- package/dist/auto-instrumentations/bundler/esbuild.mjs +5 -4
- package/dist/auto-instrumentations/bundler/next.cjs +460 -63
- package/dist/auto-instrumentations/bundler/next.mjs +6 -5
- package/dist/auto-instrumentations/bundler/rollup.cjs +458 -61
- package/dist/auto-instrumentations/bundler/rollup.mjs +5 -4
- package/dist/auto-instrumentations/bundler/vite.cjs +487 -62
- package/dist/auto-instrumentations/bundler/vite.mjs +34 -5
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +444 -61
- package/dist/auto-instrumentations/bundler/webpack.cjs +458 -61
- package/dist/auto-instrumentations/bundler/webpack.mjs +6 -5
- package/dist/auto-instrumentations/{chunk-6E22MYSW.mjs → chunk-26PKVUKB.mjs} +109 -5
- package/dist/auto-instrumentations/{chunk-AKKPLXTP.mjs → chunk-2AMDGD65.mjs} +160 -57
- package/dist/auto-instrumentations/{chunk-V5LEODRX.mjs → chunk-HD35AM3M.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-XYN63IG5.mjs → chunk-I55G56ZL.mjs} +21 -58
- package/dist/auto-instrumentations/{chunk-NRE4QUQR.mjs → chunk-JPUFNW7X.mjs} +140 -0
- package/dist/auto-instrumentations/{chunk-XZHHE4Y3.mjs → chunk-NP7V4XB2.mjs} +157 -3
- package/dist/auto-instrumentations/hook.mjs +396 -32
- package/dist/auto-instrumentations/index.cjs +298 -2
- package/dist/auto-instrumentations/index.d.mts +5 -1
- package/dist/auto-instrumentations/index.d.ts +5 -1
- package/dist/auto-instrumentations/index.mjs +6 -2
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +105 -57
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +2 -2
- package/dist/auto-instrumentations/loader/esm-hook.mjs +1 -1
- package/dist/browser.d.mts +683 -56
- package/dist/browser.d.ts +683 -56
- package/dist/browser.js +4242 -655
- package/dist/browser.mjs +4242 -655
- package/dist/{chunk-VYNNEKSA.js → chunk-BBE7SNRV.js} +248 -10
- package/dist/{chunk-VRZZQPAA.js → chunk-OBBWQW6K.js} +3351 -1392
- package/dist/{chunk-XIZOM2HO.mjs → chunk-UPFNQCGB.mjs} +2419 -460
- package/dist/{chunk-PN7EWK66.mjs → chunk-ZHUHZWFY.mjs} +241 -3
- package/dist/cli.js +2867 -668
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +4242 -655
- package/dist/edge-light.mjs +4242 -655
- package/dist/index.d.mts +1267 -640
- package/dist/index.d.ts +1267 -640
- package/dist/index.js +2107 -630
- package/dist/index.mjs +1649 -172
- package/dist/instrumentation/index.d.mts +198 -6
- package/dist/instrumentation/index.d.ts +198 -6
- package/dist/instrumentation/index.js +2661 -581
- package/dist/instrumentation/index.mjs +2661 -581
- package/dist/vitest-evals-reporter.js +45 -43
- package/dist/vitest-evals-reporter.mjs +5 -3
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +4242 -655
- package/dist/workerd.mjs +4242 -655
- package/package.json +2 -3
- package/util/dist/index.d.mts +1545 -100
- package/util/dist/index.d.ts +1545 -100
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
installMastraExporterFactory,
|
|
8
8
|
newGlobalTracingChannel,
|
|
9
9
|
setGlobalHookErrorReporter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2AMDGD65.mjs";
|
|
11
11
|
|
|
12
12
|
// src/auto-instrumentations/hook.mts
|
|
13
13
|
import { register } from "module";
|
|
@@ -42,6 +42,7 @@ var envIntegrationAliases = {
|
|
|
42
42
|
cloudflareaichat: "cloudflareAIChat",
|
|
43
43
|
"cloudflare-ai-chat": "cloudflareAIChat",
|
|
44
44
|
"@cloudflare/ai-chat": "cloudflareAIChat",
|
|
45
|
+
cloudflarethink: "cloudflareThink",
|
|
45
46
|
cursor: "cursor",
|
|
46
47
|
"cursor-sdk": "cursorSDK",
|
|
47
48
|
cursorsdk: "cursorSDK",
|
|
@@ -62,6 +63,7 @@ var envIntegrationAliases = {
|
|
|
62
63
|
openrouteragent: "openrouterAgent",
|
|
63
64
|
"openrouter-agent": "openrouterAgent",
|
|
64
65
|
mistral: "mistral",
|
|
66
|
+
ollama: "ollama",
|
|
65
67
|
googleadk: "googleADK",
|
|
66
68
|
"google-adk": "googleADK",
|
|
67
69
|
cohere: "cohere",
|
|
@@ -82,7 +84,10 @@ var envIntegrationAliases = {
|
|
|
82
84
|
"langchain-js": "langchain",
|
|
83
85
|
"@langchain": "langchain",
|
|
84
86
|
langgraph: "langgraph",
|
|
85
|
-
langsmith: "langsmith"
|
|
87
|
+
langsmith: "langsmith",
|
|
88
|
+
voyage: "voyageai",
|
|
89
|
+
"voyage-ai": "voyageai",
|
|
90
|
+
voyageai: "voyageai"
|
|
86
91
|
};
|
|
87
92
|
function readDisabledInstrumentationEnvConfig(disabledList) {
|
|
88
93
|
const integrations = {};
|
|
@@ -1773,7 +1778,8 @@ var AclObjectType = z6.union([
|
|
|
1773
1778
|
"org_member",
|
|
1774
1779
|
"project_log",
|
|
1775
1780
|
"org_project",
|
|
1776
|
-
"org_audit_logs"
|
|
1781
|
+
"org_audit_logs",
|
|
1782
|
+
"project_group"
|
|
1777
1783
|
]),
|
|
1778
1784
|
z6.null()
|
|
1779
1785
|
]);
|
|
@@ -1902,7 +1908,8 @@ var AsyncScoringState = z6.union([
|
|
|
1902
1908
|
token: z6.string(),
|
|
1903
1909
|
function_ids: z6.array(z6.unknown()),
|
|
1904
1910
|
skip_logging: z6.union([z6.boolean(), z6.null()]).optional(),
|
|
1905
|
-
triggered_functions: z6.union([z6.record(TriggeredFunctionState), z6.null()]).optional()
|
|
1911
|
+
triggered_functions: z6.union([z6.record(TriggeredFunctionState), z6.null()]).optional(),
|
|
1912
|
+
last_triggered_xact_id: z6.union([z6.string(), z6.number(), z6.null()]).optional()
|
|
1906
1913
|
}),
|
|
1907
1914
|
z6.object({ status: z6.literal("disabled") }),
|
|
1908
1915
|
z6.null(),
|
|
@@ -1971,7 +1978,7 @@ var FunctionTypeEnum = z6.enum([
|
|
|
1971
1978
|
"parameters",
|
|
1972
1979
|
"sandbox"
|
|
1973
1980
|
]);
|
|
1974
|
-
var
|
|
1981
|
+
var FacetPreprocessorId = z6.union([
|
|
1975
1982
|
z6.object({
|
|
1976
1983
|
type: z6.literal("function"),
|
|
1977
1984
|
id: z6.string(),
|
|
@@ -1982,10 +1989,23 @@ var NullableSavedFunctionId = z6.union([
|
|
|
1982
1989
|
name: z6.string(),
|
|
1983
1990
|
function_type: FunctionTypeEnum.optional().default("scorer")
|
|
1984
1991
|
}),
|
|
1992
|
+
z6.object({ type: z6.literal("inline"), code: z6.string().min(1) }),
|
|
1985
1993
|
z6.null()
|
|
1986
1994
|
]);
|
|
1995
|
+
var SavedFunctionId = z6.union([
|
|
1996
|
+
z6.object({
|
|
1997
|
+
type: z6.literal("function"),
|
|
1998
|
+
id: z6.string(),
|
|
1999
|
+
version: z6.string().optional()
|
|
2000
|
+
}),
|
|
2001
|
+
z6.object({
|
|
2002
|
+
type: z6.literal("global"),
|
|
2003
|
+
name: z6.string(),
|
|
2004
|
+
function_type: FunctionTypeEnum.optional().default("scorer")
|
|
2005
|
+
})
|
|
2006
|
+
]);
|
|
1987
2007
|
var TopicMapGenerationSettings = z6.object({
|
|
1988
|
-
algorithm: z6.enum(["hdbscan", "kmeans"]),
|
|
2008
|
+
algorithm: z6.enum(["hdbscan", "kmeans", "community"]),
|
|
1989
2009
|
dimension_reduction: z6.enum(["umap", "pca", "none"]),
|
|
1990
2010
|
sample_size: z6.number().int().gt(0).optional(),
|
|
1991
2011
|
n_clusters: z6.number().int().gt(0).optional(),
|
|
@@ -1997,6 +2017,7 @@ var TopicMapGenerationSettings = z6.object({
|
|
|
1997
2017
|
var TopicMapData = z6.object({
|
|
1998
2018
|
type: z6.literal("topic_map"),
|
|
1999
2019
|
source_facet: z6.string(),
|
|
2020
|
+
source_facet_function: SavedFunctionId.and(z6.unknown()).optional(),
|
|
2000
2021
|
embedding_model: z6.string(),
|
|
2001
2022
|
bundle_key: z6.string().optional(),
|
|
2002
2023
|
report_key: z6.string().optional(),
|
|
@@ -2010,7 +2031,7 @@ var TopicMapData = z6.object({
|
|
|
2010
2031
|
});
|
|
2011
2032
|
var BatchedFacetData = z6.object({
|
|
2012
2033
|
type: z6.literal("batched_facet"),
|
|
2013
|
-
preprocessor:
|
|
2034
|
+
preprocessor: FacetPreprocessorId.optional(),
|
|
2014
2035
|
facets: z6.array(
|
|
2015
2036
|
z6.object({
|
|
2016
2037
|
name: z6.string(),
|
|
@@ -2271,18 +2292,6 @@ var ObjectReferenceNullish = z6.union([
|
|
|
2271
2292
|
}),
|
|
2272
2293
|
z6.null()
|
|
2273
2294
|
]);
|
|
2274
|
-
var SavedFunctionId = z6.union([
|
|
2275
|
-
z6.object({
|
|
2276
|
-
type: z6.literal("function"),
|
|
2277
|
-
id: z6.string(),
|
|
2278
|
-
version: z6.string().optional()
|
|
2279
|
-
}),
|
|
2280
|
-
z6.object({
|
|
2281
|
-
type: z6.literal("global"),
|
|
2282
|
-
name: z6.string(),
|
|
2283
|
-
function_type: FunctionTypeEnum.optional().default("scorer")
|
|
2284
|
-
})
|
|
2285
|
-
]);
|
|
2286
2295
|
var DatasetEvent = z6.object({
|
|
2287
2296
|
id: z6.string(),
|
|
2288
2297
|
_xact_id: z6.string(),
|
|
@@ -2504,7 +2513,7 @@ var ExtendedSavedFunctionId = z6.union([
|
|
|
2504
2513
|
]);
|
|
2505
2514
|
var FacetData = z6.object({
|
|
2506
2515
|
type: z6.literal("facet"),
|
|
2507
|
-
preprocessor:
|
|
2516
|
+
preprocessor: FacetPreprocessorId.optional(),
|
|
2508
2517
|
prompt: z6.string(),
|
|
2509
2518
|
model: z6.string().optional(),
|
|
2510
2519
|
embedding_model: z6.string().optional(),
|
|
@@ -3009,6 +3018,19 @@ var MessageRole = z6.enum([
|
|
|
3009
3018
|
"model",
|
|
3010
3019
|
"developer"
|
|
3011
3020
|
]);
|
|
3021
|
+
var NullableSavedFunctionId = z6.union([
|
|
3022
|
+
z6.object({
|
|
3023
|
+
type: z6.literal("function"),
|
|
3024
|
+
id: z6.string(),
|
|
3025
|
+
version: z6.string().optional()
|
|
3026
|
+
}),
|
|
3027
|
+
z6.object({
|
|
3028
|
+
type: z6.literal("global"),
|
|
3029
|
+
name: z6.string(),
|
|
3030
|
+
function_type: FunctionTypeEnum.optional().default("scorer")
|
|
3031
|
+
}),
|
|
3032
|
+
z6.null()
|
|
3033
|
+
]);
|
|
3012
3034
|
var ObjectReference = z6.object({
|
|
3013
3035
|
object_type: z6.enum([
|
|
3014
3036
|
"project_logs",
|
|
@@ -3030,6 +3052,7 @@ var TraceScope = z6.object({
|
|
|
3030
3052
|
});
|
|
3031
3053
|
var OnlineScoreConfig = z6.union([
|
|
3032
3054
|
z6.object({
|
|
3055
|
+
status: AutomationStatus.optional(),
|
|
3033
3056
|
sampling_rate: z6.number().gte(0).lte(1),
|
|
3034
3057
|
scorers: z6.array(SavedFunctionId),
|
|
3035
3058
|
btql_filter: z6.union([z6.string(), z6.null()]).optional(),
|
|
@@ -3110,6 +3133,72 @@ var Project = z6.object({
|
|
|
3110
3133
|
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
3111
3134
|
settings: ProjectSettings.optional()
|
|
3112
3135
|
});
|
|
3136
|
+
var WindowedAutomationConfig = z6.object({
|
|
3137
|
+
event_type: z6.literal("windowed"),
|
|
3138
|
+
product_origin: z6.union([z6.literal("patterns"), z6.null()]).optional(),
|
|
3139
|
+
status: AutomationStatus.optional(),
|
|
3140
|
+
threshold: z6.object({
|
|
3141
|
+
calculation: z6.object({
|
|
3142
|
+
type: z6.literal("btql"),
|
|
3143
|
+
btql_query: z6.string().min(1),
|
|
3144
|
+
output: z6.object({
|
|
3145
|
+
type: z6.literal("scalar"),
|
|
3146
|
+
value_column: z6.string().min(1)
|
|
3147
|
+
})
|
|
3148
|
+
}),
|
|
3149
|
+
policy: z6.object({
|
|
3150
|
+
condition: z6.object({
|
|
3151
|
+
type: z6.literal("threshold"),
|
|
3152
|
+
operator: z6.enum(["lt", "lte", "gt", "gte", "eq", "neq"]),
|
|
3153
|
+
threshold: z6.number()
|
|
3154
|
+
}),
|
|
3155
|
+
pending_seconds: z6.number().int().gte(0).lte(2592e3),
|
|
3156
|
+
no_data_behavior: z6.enum(["keep_last", "resolve", "alert"]),
|
|
3157
|
+
renotify_interval_seconds: z6.union([z6.number(), z6.null()]).optional(),
|
|
3158
|
+
notify_on_recovery: z6.boolean().optional().default(true)
|
|
3159
|
+
})
|
|
3160
|
+
}).optional(),
|
|
3161
|
+
window: z6.object({
|
|
3162
|
+
window_seconds: z6.number().int().gte(1).lte(2592e3),
|
|
3163
|
+
schedule: z6.union([
|
|
3164
|
+
z6.object({
|
|
3165
|
+
type: z6.literal("interval"),
|
|
3166
|
+
evaluation_interval_seconds: z6.number().int().gte(1).lte(2592e3)
|
|
3167
|
+
}),
|
|
3168
|
+
z6.object({
|
|
3169
|
+
type: z6.literal("cron"),
|
|
3170
|
+
cron_expression: z6.string().min(1),
|
|
3171
|
+
timezone: z6.union([z6.string(), z6.null()]).optional()
|
|
3172
|
+
})
|
|
3173
|
+
]),
|
|
3174
|
+
evaluation_delay_seconds: z6.number().int().gte(0).lte(2592e3)
|
|
3175
|
+
}),
|
|
3176
|
+
loop: z6.object({
|
|
3177
|
+
prompt: z6.string().min(1).max(1e4),
|
|
3178
|
+
include_trigger_input: z6.boolean().optional().default(false),
|
|
3179
|
+
agent_slug: z6.string().min(1),
|
|
3180
|
+
auto_approve_tools: z6.array(z6.string().min(1)).optional().default([]),
|
|
3181
|
+
harness: z6.enum(["native", "codex", "claude-code"]).optional(),
|
|
3182
|
+
model: z6.string().min(1).optional(),
|
|
3183
|
+
reasoning_effort: z6.enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"]).optional()
|
|
3184
|
+
}).optional(),
|
|
3185
|
+
actions: z6.array(
|
|
3186
|
+
z6.union([
|
|
3187
|
+
z6.object({
|
|
3188
|
+
type: z6.literal("webhook"),
|
|
3189
|
+
url: z6.string(),
|
|
3190
|
+
formatting_prompt: z6.string().min(1).max(1e4).optional()
|
|
3191
|
+
}),
|
|
3192
|
+
z6.object({
|
|
3193
|
+
type: z6.literal("slack"),
|
|
3194
|
+
workspace_id: z6.string(),
|
|
3195
|
+
channel: z6.string(),
|
|
3196
|
+
message_template: z6.string().optional(),
|
|
3197
|
+
formatting_prompt: z6.string().min(1).max(1e4).optional()
|
|
3198
|
+
})
|
|
3199
|
+
])
|
|
3200
|
+
).max(20).optional().default([])
|
|
3201
|
+
});
|
|
3113
3202
|
var TopicAutomationFacetModel = z6.union([
|
|
3114
3203
|
z6.enum(["brain-facet-latest", "brain-facet-1", "brain-facet-2"]),
|
|
3115
3204
|
z6.null()
|
|
@@ -3151,7 +3240,8 @@ var TopicDigestAutomationConfig = z6.object({
|
|
|
3151
3240
|
type: z6.literal("slack"),
|
|
3152
3241
|
workspace_id: z6.string(),
|
|
3153
3242
|
channel: z6.string(),
|
|
3154
|
-
message_template: z6.string().optional()
|
|
3243
|
+
message_template: z6.string().optional(),
|
|
3244
|
+
formatting_prompt: z6.string().min(1).max(1e4).optional()
|
|
3155
3245
|
}),
|
|
3156
3246
|
topic_map_function_ids: z6.array(z6.string()).max(10).optional()
|
|
3157
3247
|
});
|
|
@@ -3165,15 +3255,21 @@ var ProjectAutomation = z6.object({
|
|
|
3165
3255
|
config: z6.union([
|
|
3166
3256
|
z6.object({
|
|
3167
3257
|
event_type: z6.literal("logs"),
|
|
3258
|
+
status: AutomationStatus.optional(),
|
|
3168
3259
|
btql_filter: z6.string(),
|
|
3169
3260
|
interval_seconds: z6.number().gte(1).lte(2592e3),
|
|
3170
3261
|
action: z6.union([
|
|
3171
|
-
z6.object({
|
|
3262
|
+
z6.object({
|
|
3263
|
+
type: z6.literal("webhook"),
|
|
3264
|
+
url: z6.string(),
|
|
3265
|
+
formatting_prompt: z6.string().min(1).max(1e4).optional()
|
|
3266
|
+
}),
|
|
3172
3267
|
z6.object({
|
|
3173
3268
|
type: z6.literal("slack"),
|
|
3174
3269
|
workspace_id: z6.string(),
|
|
3175
3270
|
channel: z6.string(),
|
|
3176
|
-
message_template: z6.string().optional()
|
|
3271
|
+
message_template: z6.string().optional(),
|
|
3272
|
+
formatting_prompt: z6.string().min(1).max(1e4).optional()
|
|
3177
3273
|
})
|
|
3178
3274
|
])
|
|
3179
3275
|
}),
|
|
@@ -3224,21 +3320,38 @@ var ProjectAutomation = z6.object({
|
|
|
3224
3320
|
}),
|
|
3225
3321
|
z6.object({
|
|
3226
3322
|
event_type: z6.literal("environment_update"),
|
|
3323
|
+
status: AutomationStatus.optional(),
|
|
3227
3324
|
environment_filter: z6.array(z6.string()).optional(),
|
|
3228
3325
|
action: z6.union([
|
|
3229
|
-
z6.object({
|
|
3326
|
+
z6.object({
|
|
3327
|
+
type: z6.literal("webhook"),
|
|
3328
|
+
url: z6.string(),
|
|
3329
|
+
formatting_prompt: z6.string().min(1).max(1e4).optional()
|
|
3330
|
+
}),
|
|
3230
3331
|
z6.object({
|
|
3231
3332
|
type: z6.literal("slack"),
|
|
3232
3333
|
workspace_id: z6.string(),
|
|
3233
3334
|
channel: z6.string(),
|
|
3234
|
-
message_template: z6.string().optional()
|
|
3335
|
+
message_template: z6.string().optional(),
|
|
3336
|
+
formatting_prompt: z6.string().min(1).max(1e4).optional()
|
|
3235
3337
|
})
|
|
3236
3338
|
])
|
|
3237
3339
|
}),
|
|
3340
|
+
WindowedAutomationConfig,
|
|
3238
3341
|
TopicAutomationConfig,
|
|
3239
3342
|
TopicDigestAutomationConfig
|
|
3240
3343
|
])
|
|
3241
3344
|
});
|
|
3345
|
+
var ProjectGroup = z6.object({
|
|
3346
|
+
id: z6.string().uuid(),
|
|
3347
|
+
org_id: z6.string().uuid(),
|
|
3348
|
+
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
3349
|
+
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
3350
|
+
name: z6.string(),
|
|
3351
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
3352
|
+
deleted_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
3353
|
+
member_projects: z6.array(z6.string().uuid()).max(1e4)
|
|
3354
|
+
});
|
|
3242
3355
|
var ProjectLogsEvent = z6.object({
|
|
3243
3356
|
id: z6.string(),
|
|
3244
3357
|
_xact_id: z6.string(),
|
|
@@ -3456,7 +3569,8 @@ var RunEval = z6.object({
|
|
|
3456
3569
|
dataset_environment: z6.union([z6.string(), z6.null()]).optional(),
|
|
3457
3570
|
_internal_btql: z6.union([z6.object({}).partial().passthrough(), z6.null()]).optional()
|
|
3458
3571
|
}),
|
|
3459
|
-
z6.object({ data: z6.array(z6.unknown()) })
|
|
3572
|
+
z6.object({ data: z6.array(z6.unknown()) }),
|
|
3573
|
+
z6.object({ experiment_name: z6.string() })
|
|
3460
3574
|
]),
|
|
3461
3575
|
name: z6.string().optional(),
|
|
3462
3576
|
parameters: z6.object({}).partial().passthrough().optional(),
|
|
@@ -3661,7 +3775,9 @@ var View = z6.object({
|
|
|
3661
3775
|
"for_review_datasets"
|
|
3662
3776
|
]),
|
|
3663
3777
|
name: z6.string(),
|
|
3778
|
+
description: z6.union([z6.string(), z6.null()]).optional(),
|
|
3664
3779
|
created: z6.union([z6.string(), z6.null()]).optional(),
|
|
3780
|
+
updated_at: z6.union([z6.string(), z6.null()]).optional(),
|
|
3665
3781
|
view_data: ViewData.optional(),
|
|
3666
3782
|
options: ViewOptions.optional(),
|
|
3667
3783
|
user_id: z6.union([z6.string(), z6.null()]).optional(),
|
|
@@ -4738,6 +4854,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
4738
4854
|
CLAUDE_AGENT_SDK: "claude-agent-sdk",
|
|
4739
4855
|
CLOUDFLARE_AI_CHAT: "cloudflare-ai-chat",
|
|
4740
4856
|
CLOUDFLARE_AGENTS: "cloudflare-agents",
|
|
4857
|
+
CLOUDFLARE_THINK: "cloudflare-think",
|
|
4741
4858
|
COHERE: "cohere",
|
|
4742
4859
|
CURSOR_SDK: "cursor-sdk",
|
|
4743
4860
|
EVE: "eve",
|
|
@@ -4752,18 +4869,20 @@ var INSTRUMENTATION_NAMES = {
|
|
|
4752
4869
|
LANGSMITH: "langsmith",
|
|
4753
4870
|
MASTRA: "mastra",
|
|
4754
4871
|
MISTRAL: "mistral",
|
|
4872
|
+
OLLAMA: "ollama",
|
|
4755
4873
|
OPENAI: "openai",
|
|
4756
4874
|
OPENAI_AGENTS: "openai-agents",
|
|
4757
4875
|
OPENAI_CODEX: "openai-codex",
|
|
4758
4876
|
OPENROUTER: "openrouter",
|
|
4759
4877
|
OPENROUTER_AGENT: "openrouter-agent",
|
|
4760
4878
|
PI_CODING_AGENT: "pi-coding-agent",
|
|
4761
|
-
STRANDS_AGENT_SDK: "strands-agent-sdk"
|
|
4879
|
+
STRANDS_AGENT_SDK: "strands-agent-sdk",
|
|
4880
|
+
VOYAGEAI: "voyageai"
|
|
4762
4881
|
};
|
|
4763
4882
|
var INTERNAL_SPAN_INSTRUMENTATION_NAME = /* @__PURE__ */ Symbol.for(
|
|
4764
4883
|
"braintrust.spanInstrumentationName"
|
|
4765
4884
|
);
|
|
4766
|
-
var SDK_VERSION = true ? "3.
|
|
4885
|
+
var SDK_VERSION = true ? "3.28.0" : "0.0.0";
|
|
4767
4886
|
function withSpanInstrumentationName(args, instrumentationName) {
|
|
4768
4887
|
return {
|
|
4769
4888
|
...args,
|
|
@@ -4958,6 +5077,9 @@ function applyMaskingToField(maskingFunction, data, fieldName) {
|
|
|
4958
5077
|
var INITIAL_SPAN_WRITE_AS_MERGE = /* @__PURE__ */ Symbol(
|
|
4959
5078
|
"braintrust.initial-span-write-as-merge"
|
|
4960
5079
|
);
|
|
5080
|
+
var RESUME_SPAN_WITHOUT_INITIAL_WRITE = /* @__PURE__ */ Symbol(
|
|
5081
|
+
"braintrust.resume-span-without-initial-write"
|
|
5082
|
+
);
|
|
4961
5083
|
var INTERNAL_SPAN_CONTEXT = /* @__PURE__ */ Symbol("braintrust.internal-span-context");
|
|
4962
5084
|
var BRAINTRUST_CURRENT_SPAN_STORE = /* @__PURE__ */ Symbol.for(
|
|
4963
5085
|
"braintrust.currentSpanStore"
|
|
@@ -7730,7 +7852,7 @@ var ObjectFetcher = class {
|
|
|
7730
7852
|
const objectId = await this.id;
|
|
7731
7853
|
const batchLimit = batchSize ?? DEFAULT_FETCH_BATCH_SIZE;
|
|
7732
7854
|
const internalLimit = getInternalBtqlLimit(this._internal_btql);
|
|
7733
|
-
|
|
7855
|
+
let remainingLimit = internalLimit;
|
|
7734
7856
|
const internalBtqlWithoutReservedQueryKeys = Object.fromEntries(
|
|
7735
7857
|
Object.entries(this._internal_btql ?? {}).filter(
|
|
7736
7858
|
([key]) => key !== "cursor" && key !== "limit" && key !== "select" && key !== "from"
|
|
@@ -7739,6 +7861,10 @@ var ObjectFetcher = class {
|
|
|
7739
7861
|
let cursor = void 0;
|
|
7740
7862
|
let iterations = 0;
|
|
7741
7863
|
while (true) {
|
|
7864
|
+
if (remainingLimit !== void 0 && remainingLimit <= 0) {
|
|
7865
|
+
return;
|
|
7866
|
+
}
|
|
7867
|
+
const limit = remainingLimit === void 0 ? batchLimit : Math.min(batchLimit, remainingLimit);
|
|
7742
7868
|
const resp = await state2.apiConn().post(
|
|
7743
7869
|
`btql`,
|
|
7744
7870
|
{
|
|
@@ -7778,7 +7904,14 @@ var ObjectFetcher = class {
|
|
|
7778
7904
|
const respJson = await resp.json();
|
|
7779
7905
|
const mutate = this.mutateRecord;
|
|
7780
7906
|
for (const record of respJson.data ?? []) {
|
|
7781
|
-
|
|
7907
|
+
if (remainingLimit !== void 0 && remainingLimit <= 0) {
|
|
7908
|
+
return;
|
|
7909
|
+
}
|
|
7910
|
+
const mutatedRecord = mutate ? mutate(record) : record;
|
|
7911
|
+
if (remainingLimit !== void 0) {
|
|
7912
|
+
remainingLimit--;
|
|
7913
|
+
}
|
|
7914
|
+
yield mutatedRecord;
|
|
7782
7915
|
}
|
|
7783
7916
|
if (!respJson.cursor) {
|
|
7784
7917
|
break;
|
|
@@ -8255,7 +8388,9 @@ var SpanImpl = class _SpanImpl {
|
|
|
8255
8388
|
this._rootSpanId = resolvedIds.rootSpanId;
|
|
8256
8389
|
this._spanParents = resolvedIds.spanParents;
|
|
8257
8390
|
this.isMerge = args[INITIAL_SPAN_WRITE_AS_MERGE] === true;
|
|
8258
|
-
|
|
8391
|
+
if (!args[RESUME_SPAN_WITHOUT_INITIAL_WRITE]) {
|
|
8392
|
+
this.logInternal({ event, internalData });
|
|
8393
|
+
}
|
|
8259
8394
|
this.isMerge = true;
|
|
8260
8395
|
}
|
|
8261
8396
|
getParentInfo() {
|
|
@@ -9182,11 +9317,21 @@ function defineChannels(pkg, channels, options) {
|
|
|
9182
9317
|
const tracingChannel2 = () => isomorph_default.newTracingChannel(
|
|
9183
9318
|
fullChannelName
|
|
9184
9319
|
);
|
|
9320
|
+
const intercept2 = (interceptor) => {
|
|
9321
|
+
const hook = tracingChannel2();
|
|
9322
|
+
return typeof hook.intercept === "function" ? hook.intercept(interceptor) : () => {
|
|
9323
|
+
};
|
|
9324
|
+
};
|
|
9185
9325
|
return [
|
|
9186
9326
|
key,
|
|
9187
9327
|
{
|
|
9188
9328
|
...asyncSpec,
|
|
9189
9329
|
instrumentationName,
|
|
9330
|
+
intercept: intercept2,
|
|
9331
|
+
invoke: (target, thisArg, args, additional) => {
|
|
9332
|
+
const hook = tracingChannel2();
|
|
9333
|
+
return typeof hook.invoke === "function" ? hook.invoke(target, thisArg, args, additional) : Reflect.apply(target, thisArg, args);
|
|
9334
|
+
},
|
|
9190
9335
|
tracingChannel: tracingChannel2,
|
|
9191
9336
|
tracePromise: (fn, context) => tracingChannel2().tracePromise(
|
|
9192
9337
|
fn,
|
|
@@ -9200,11 +9345,21 @@ function defineChannels(pkg, channels, options) {
|
|
|
9200
9345
|
const tracingChannel = () => isomorph_default.newTracingChannel(
|
|
9201
9346
|
fullChannelName
|
|
9202
9347
|
);
|
|
9348
|
+
const intercept = (interceptor) => {
|
|
9349
|
+
const hook = tracingChannel();
|
|
9350
|
+
return typeof hook.intercept === "function" ? hook.intercept(interceptor) : () => {
|
|
9351
|
+
};
|
|
9352
|
+
};
|
|
9203
9353
|
return [
|
|
9204
9354
|
key,
|
|
9205
9355
|
{
|
|
9206
9356
|
...syncSpec,
|
|
9207
9357
|
instrumentationName,
|
|
9358
|
+
intercept,
|
|
9359
|
+
invoke: (target, thisArg, args, additional) => {
|
|
9360
|
+
const hook = tracingChannel();
|
|
9361
|
+
return typeof hook.invoke === "function" ? hook.invoke(target, thisArg, args, additional) : Reflect.apply(target, thisArg, args);
|
|
9362
|
+
},
|
|
9208
9363
|
tracingChannel,
|
|
9209
9364
|
traceSync: (fn, context) => tracingChannel().traceSync(
|
|
9210
9365
|
fn,
|
|
@@ -9724,6 +9879,14 @@ var anthropicChannels = defineChannels(
|
|
|
9724
9879
|
betaMessagesToolRunner: channel({
|
|
9725
9880
|
channelName: "beta.messages.toolRunner",
|
|
9726
9881
|
kind: "sync-stream"
|
|
9882
|
+
}),
|
|
9883
|
+
betaSessionsEventsStream: channel({
|
|
9884
|
+
channelName: "beta.sessions.events.stream",
|
|
9885
|
+
kind: "async"
|
|
9886
|
+
}),
|
|
9887
|
+
betaSessionsThreadsEventsStream: channel({
|
|
9888
|
+
channelName: "beta.sessions.threads.events.stream",
|
|
9889
|
+
kind: "async"
|
|
9727
9890
|
})
|
|
9728
9891
|
},
|
|
9729
9892
|
{ instrumentationName: INSTRUMENTATION_NAMES.ANTHROPIC }
|
|
@@ -9842,7 +10005,40 @@ var anthropicConfigs = [
|
|
|
9842
10005
|
methodName: "toolRunner",
|
|
9843
10006
|
kind: "Sync"
|
|
9844
10007
|
}
|
|
9845
|
-
}
|
|
10008
|
+
},
|
|
10009
|
+
// Managed Agents Sessions event streams are discovered automatically, but
|
|
10010
|
+
// remain passive until the user calls collectAnthropicSession() on the
|
|
10011
|
+
// returned stream.
|
|
10012
|
+
...["mjs", "js"].map(
|
|
10013
|
+
(extension) => ({
|
|
10014
|
+
channelName: anthropicChannels.betaSessionsEventsStream.channelName,
|
|
10015
|
+
module: {
|
|
10016
|
+
name: "@anthropic-ai/sdk",
|
|
10017
|
+
versionRange: ">=0.86.0",
|
|
10018
|
+
filePath: `resources/beta/sessions/events.${extension}`
|
|
10019
|
+
},
|
|
10020
|
+
functionQuery: {
|
|
10021
|
+
className: "Events",
|
|
10022
|
+
methodName: "stream",
|
|
10023
|
+
kind: "Async"
|
|
10024
|
+
}
|
|
10025
|
+
})
|
|
10026
|
+
),
|
|
10027
|
+
...["mjs", "js"].map(
|
|
10028
|
+
(extension) => ({
|
|
10029
|
+
channelName: anthropicChannels.betaSessionsThreadsEventsStream.channelName,
|
|
10030
|
+
module: {
|
|
10031
|
+
name: "@anthropic-ai/sdk",
|
|
10032
|
+
versionRange: ">=0.86.0",
|
|
10033
|
+
filePath: `resources/beta/sessions/threads/events.${extension}`
|
|
10034
|
+
},
|
|
10035
|
+
functionQuery: {
|
|
10036
|
+
className: "Events",
|
|
10037
|
+
methodName: "stream",
|
|
10038
|
+
kind: "Async"
|
|
10039
|
+
}
|
|
10040
|
+
})
|
|
10041
|
+
)
|
|
9846
10042
|
];
|
|
9847
10043
|
|
|
9848
10044
|
// src/instrumentation/plugins/bedrock-runtime-channels.ts
|
|
@@ -10039,6 +10235,36 @@ var cloudflareAgentsConfigs = [
|
|
|
10039
10235
|
}
|
|
10040
10236
|
];
|
|
10041
10237
|
|
|
10238
|
+
// src/instrumentation/plugins/cloudflare-think-channels.ts
|
|
10239
|
+
var cloudflareThinkChannels = defineChannels(
|
|
10240
|
+
"@cloudflare/think",
|
|
10241
|
+
{
|
|
10242
|
+
runInferenceLoop: channel({
|
|
10243
|
+
channelName: "Think.runInferenceLoop",
|
|
10244
|
+
kind: "async"
|
|
10245
|
+
})
|
|
10246
|
+
},
|
|
10247
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_THINK }
|
|
10248
|
+
);
|
|
10249
|
+
|
|
10250
|
+
// src/auto-instrumentations/configs/cloudflare-think.ts
|
|
10251
|
+
var cloudflareThinkVersionRange = ">=0.13.0 <0.14.0";
|
|
10252
|
+
var cloudflareThinkConfigs = [
|
|
10253
|
+
{
|
|
10254
|
+
channelName: cloudflareThinkChannels.runInferenceLoop.channelName,
|
|
10255
|
+
module: {
|
|
10256
|
+
name: "@cloudflare/think",
|
|
10257
|
+
versionRange: cloudflareThinkVersionRange,
|
|
10258
|
+
filePath: "dist/think.js"
|
|
10259
|
+
},
|
|
10260
|
+
functionQuery: {
|
|
10261
|
+
className: "Think",
|
|
10262
|
+
methodName: "_runInferenceLoop",
|
|
10263
|
+
kind: "Async"
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10266
|
+
];
|
|
10267
|
+
|
|
10042
10268
|
// src/instrumentation/plugins/cohere-channels.ts
|
|
10043
10269
|
var cohereChannels = defineChannels(
|
|
10044
10270
|
"cohere-ai",
|
|
@@ -11922,6 +12148,51 @@ var mistralConfigs = [
|
|
|
11922
12148
|
}
|
|
11923
12149
|
];
|
|
11924
12150
|
|
|
12151
|
+
// src/instrumentation/plugins/ollama-channels.ts
|
|
12152
|
+
var ollamaChannels = defineChannels(
|
|
12153
|
+
"ollama",
|
|
12154
|
+
{
|
|
12155
|
+
chat: channel({
|
|
12156
|
+
channelName: "chat",
|
|
12157
|
+
kind: "async"
|
|
12158
|
+
}),
|
|
12159
|
+
generate: channel({
|
|
12160
|
+
channelName: "generate",
|
|
12161
|
+
kind: "async"
|
|
12162
|
+
}),
|
|
12163
|
+
embed: channel({
|
|
12164
|
+
channelName: "embed",
|
|
12165
|
+
kind: "async"
|
|
12166
|
+
})
|
|
12167
|
+
},
|
|
12168
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.OLLAMA }
|
|
12169
|
+
);
|
|
12170
|
+
|
|
12171
|
+
// src/auto-instrumentations/configs/ollama.ts
|
|
12172
|
+
var methods = [
|
|
12173
|
+
["chat", ollamaChannels.chat.channelName],
|
|
12174
|
+
["generate", ollamaChannels.generate.channelName],
|
|
12175
|
+
["embed", ollamaChannels.embed.channelName]
|
|
12176
|
+
];
|
|
12177
|
+
var implementationFiles = ["dist/browser.mjs", "dist/browser.cjs"];
|
|
12178
|
+
var ollamaConfigs = [
|
|
12179
|
+
...implementationFiles.flatMap(
|
|
12180
|
+
(filePath) => methods.map(([methodName, channelName]) => ({
|
|
12181
|
+
channelName,
|
|
12182
|
+
module: {
|
|
12183
|
+
name: "ollama",
|
|
12184
|
+
versionRange: ">=0.6.0 <0.7.0",
|
|
12185
|
+
filePath
|
|
12186
|
+
},
|
|
12187
|
+
functionQuery: {
|
|
12188
|
+
className: "Ollama",
|
|
12189
|
+
methodName,
|
|
12190
|
+
kind: "Async"
|
|
12191
|
+
}
|
|
12192
|
+
}))
|
|
12193
|
+
)
|
|
12194
|
+
];
|
|
12195
|
+
|
|
11925
12196
|
// src/instrumentation/plugins/openai-agents-channels.ts
|
|
11926
12197
|
var openAIAgentsCoreChannels = defineChannels(
|
|
11927
12198
|
"@openai/agents-core",
|
|
@@ -12331,6 +12602,19 @@ var openRouterConfigs = [
|
|
|
12331
12602
|
kind: "Async"
|
|
12332
12603
|
}
|
|
12333
12604
|
},
|
|
12605
|
+
{
|
|
12606
|
+
channelName: openRouterChannels.betaResponsesSend.channelName,
|
|
12607
|
+
module: {
|
|
12608
|
+
name: "@openrouter/sdk",
|
|
12609
|
+
versionRange: ">=1.1.2 <2.0.0",
|
|
12610
|
+
filePath: "esm/sdk/betaresponses.js"
|
|
12611
|
+
},
|
|
12612
|
+
functionQuery: {
|
|
12613
|
+
className: "BetaResponses",
|
|
12614
|
+
methodName: "send",
|
|
12615
|
+
kind: "Async"
|
|
12616
|
+
}
|
|
12617
|
+
},
|
|
12334
12618
|
{
|
|
12335
12619
|
channelName: openRouterChannels.callModel.channelName,
|
|
12336
12620
|
module: {
|
|
@@ -12476,6 +12760,77 @@ var strandsAgentSDKConfigs = [
|
|
|
12476
12760
|
}
|
|
12477
12761
|
];
|
|
12478
12762
|
|
|
12763
|
+
// src/instrumentation/plugins/voyageai-channels.ts
|
|
12764
|
+
var voyageAIChannels = defineChannels(
|
|
12765
|
+
"voyageai",
|
|
12766
|
+
{
|
|
12767
|
+
embed: channel({
|
|
12768
|
+
channelName: "embed",
|
|
12769
|
+
kind: "async"
|
|
12770
|
+
}),
|
|
12771
|
+
multimodalEmbed: channel({
|
|
12772
|
+
channelName: "multimodalEmbed",
|
|
12773
|
+
kind: "async"
|
|
12774
|
+
}),
|
|
12775
|
+
rerank: channel({
|
|
12776
|
+
channelName: "rerank",
|
|
12777
|
+
kind: "async"
|
|
12778
|
+
}),
|
|
12779
|
+
contextualizedEmbed: channel({
|
|
12780
|
+
channelName: "contextualizedEmbed",
|
|
12781
|
+
kind: "async"
|
|
12782
|
+
})
|
|
12783
|
+
},
|
|
12784
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.VOYAGEAI }
|
|
12785
|
+
);
|
|
12786
|
+
|
|
12787
|
+
// src/auto-instrumentations/configs/voyageai.ts
|
|
12788
|
+
var GENERATED_CLIENT_MODULES = [
|
|
12789
|
+
"dist/cjs/Client.js",
|
|
12790
|
+
"dist/esm/Client.mjs"
|
|
12791
|
+
];
|
|
12792
|
+
var generatedClientOperations = [
|
|
12793
|
+
{
|
|
12794
|
+
channelName: voyageAIChannels.embed.channelName,
|
|
12795
|
+
methodName: "embed",
|
|
12796
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
12797
|
+
},
|
|
12798
|
+
{
|
|
12799
|
+
channelName: voyageAIChannels.multimodalEmbed.channelName,
|
|
12800
|
+
methodName: "multimodalEmbed",
|
|
12801
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
12802
|
+
},
|
|
12803
|
+
{
|
|
12804
|
+
channelName: voyageAIChannels.rerank.channelName,
|
|
12805
|
+
methodName: "rerank",
|
|
12806
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
12807
|
+
},
|
|
12808
|
+
{
|
|
12809
|
+
channelName: voyageAIChannels.contextualizedEmbed.channelName,
|
|
12810
|
+
methodName: "contextualizedEmbed",
|
|
12811
|
+
versionRange: ">=0.2.0 <1.0.0"
|
|
12812
|
+
}
|
|
12813
|
+
];
|
|
12814
|
+
var voyageAIConfigs = [
|
|
12815
|
+
...GENERATED_CLIENT_MODULES.flatMap(
|
|
12816
|
+
(filePath) => generatedClientOperations.map(
|
|
12817
|
+
({ channelName, methodName, versionRange: versionRange2 }) => ({
|
|
12818
|
+
channelName,
|
|
12819
|
+
module: {
|
|
12820
|
+
name: "voyageai",
|
|
12821
|
+
versionRange: versionRange2,
|
|
12822
|
+
filePath
|
|
12823
|
+
},
|
|
12824
|
+
functionQuery: {
|
|
12825
|
+
className: "VoyageAIClient",
|
|
12826
|
+
methodName,
|
|
12827
|
+
kind: "Async"
|
|
12828
|
+
}
|
|
12829
|
+
})
|
|
12830
|
+
)
|
|
12831
|
+
)
|
|
12832
|
+
];
|
|
12833
|
+
|
|
12479
12834
|
// src/auto-instrumentations/configs/all.ts
|
|
12480
12835
|
var defaultInstrumentationConfigGroups = [
|
|
12481
12836
|
{ integrations: ["openai"], configs: openaiConfigs },
|
|
@@ -12504,6 +12859,10 @@ var defaultInstrumentationConfigGroups = [
|
|
|
12504
12859
|
integrations: ["cloudflareAgents"],
|
|
12505
12860
|
configs: cloudflareAgentsConfigs
|
|
12506
12861
|
},
|
|
12862
|
+
{
|
|
12863
|
+
integrations: ["cloudflareThink"],
|
|
12864
|
+
configs: cloudflareThinkConfigs
|
|
12865
|
+
},
|
|
12507
12866
|
{ integrations: ["cursor", "cursorSDK"], configs: cursorSDKConfigs },
|
|
12508
12867
|
{
|
|
12509
12868
|
integrations: ["openAIAgents"],
|
|
@@ -12528,6 +12887,7 @@ var defaultInstrumentationConfigGroups = [
|
|
|
12528
12887
|
configs: openRouterAgentConfigs
|
|
12529
12888
|
},
|
|
12530
12889
|
{ integrations: ["mistral"], configs: mistralConfigs },
|
|
12890
|
+
{ integrations: ["ollama"], configs: ollamaConfigs },
|
|
12531
12891
|
{ integrations: ["googleADK"], configs: googleADKConfigs },
|
|
12532
12892
|
{ integrations: ["cohere"], configs: cohereConfigs },
|
|
12533
12893
|
{ integrations: ["groq"], configs: groqConfigs },
|
|
@@ -12550,6 +12910,10 @@ var defaultInstrumentationConfigGroups = [
|
|
|
12550
12910
|
{
|
|
12551
12911
|
integrations: ["flue"],
|
|
12552
12912
|
configs: flueConfigs
|
|
12913
|
+
},
|
|
12914
|
+
{
|
|
12915
|
+
integrations: ["voyageai"],
|
|
12916
|
+
configs: voyageAIConfigs
|
|
12553
12917
|
}
|
|
12554
12918
|
// Note: `@mastra/core` is not listed here because its instrumentation
|
|
12555
12919
|
// doesn't go through the AST `code-transformer` matcher — Mastra's
|