braintrust 3.23.1 → 3.25.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 +11 -0
- package/dev/dist/index.d.ts +11 -0
- package/dev/dist/index.js +2881 -1518
- package/dev/dist/index.mjs +2298 -935
- package/dist/apply-auto-instrumentation.js +218 -195
- package/dist/apply-auto-instrumentation.mjs +30 -7
- package/dist/auto-instrumentations/bundler/esbuild.cjs +618 -444
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +618 -444
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +618 -444
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +618 -444
- package/dist/auto-instrumentations/bundler/vite.d.mts +1 -1
- package/dist/auto-instrumentations/bundler/vite.d.ts +1 -1
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +618 -444
- package/dist/auto-instrumentations/bundler/webpack.cjs +618 -444
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-KIMLYPRW.mjs → chunk-7P6563SW.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-YXLNSAMJ.mjs → chunk-CZ24KNHT.mjs} +591 -424
- package/dist/auto-instrumentations/{chunk-EXY7QCJD.mjs → chunk-JPVCUKTY.mjs} +30 -21
- package/dist/auto-instrumentations/hook.mjs +778 -457
- package/dist/auto-instrumentations/index.cjs +590 -424
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/browser.d.mts +138 -9
- package/dist/browser.d.ts +138 -9
- package/dist/browser.js +2700 -1011
- package/dist/browser.mjs +2700 -1011
- package/dist/{chunk-RBXD2KYN.mjs → chunk-2SANLSWX.mjs} +1577 -513
- package/dist/{chunk-36IPYKMG.mjs → chunk-ABR2QWDP.mjs} +704 -438
- package/dist/{chunk-B6ZQIAK3.js → chunk-GSIDVFE6.js} +2361 -1297
- package/dist/{chunk-CDIKAHDZ.js → chunk-P25IOOU4.js} +706 -440
- package/dist/cli.js +2307 -940
- package/dist/edge-light.js +2700 -1011
- package/dist/edge-light.mjs +2700 -1011
- package/dist/index.d.mts +138 -9
- package/dist/index.d.ts +138 -9
- package/dist/index.js +955 -551
- package/dist/index.mjs +493 -89
- package/dist/instrumentation/index.d.mts +135 -9
- package/dist/instrumentation/index.d.ts +135 -9
- package/dist/instrumentation/index.js +2554 -1009
- package/dist/instrumentation/index.mjs +2554 -1009
- package/dist/vitest-evals-reporter.js +17 -16
- package/dist/vitest-evals-reporter.mjs +3 -2
- package/dist/workerd.js +2700 -1011
- package/dist/workerd.mjs +2700 -1011
- package/package.json +4 -4
- package/util/dist/index.js +4 -0
- package/util/dist/index.mjs +4 -0
package/dist/index.js
CHANGED
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
|
|
142
|
-
var
|
|
142
|
+
var _chunkGSIDVFE6js = require('./chunk-GSIDVFE6.js');
|
|
143
143
|
|
|
144
144
|
|
|
145
145
|
|
|
@@ -163,151 +163,154 @@ var _chunkB6ZQIAK3js = require('./chunk-B6ZQIAK3.js');
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
var _chunkP25IOOU4js = require('./chunk-P25IOOU4.js');
|
|
167
170
|
|
|
168
171
|
// src/exports.ts
|
|
169
172
|
var exports_exports = {};
|
|
170
|
-
|
|
171
|
-
Attachment: () =>
|
|
172
|
-
AttachmentReference: () =>
|
|
173
|
-
BAGGAGE_HEADER: () =>
|
|
174
|
-
BRAINTRUST_CURRENT_SPAN_STORE: () =>
|
|
175
|
-
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () =>
|
|
176
|
-
BRAINTRUST_PARENT_KEY: () =>
|
|
177
|
-
BaseAttachment: () =>
|
|
173
|
+
_chunkP25IOOU4js.__export.call(void 0, exports_exports, {
|
|
174
|
+
Attachment: () => _chunkGSIDVFE6js.Attachment,
|
|
175
|
+
AttachmentReference: () => _chunkGSIDVFE6js.AttachmentReference,
|
|
176
|
+
BAGGAGE_HEADER: () => _chunkGSIDVFE6js.BAGGAGE_HEADER,
|
|
177
|
+
BRAINTRUST_CURRENT_SPAN_STORE: () => _chunkGSIDVFE6js.BRAINTRUST_CURRENT_SPAN_STORE,
|
|
178
|
+
BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () => _chunkGSIDVFE6js.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME,
|
|
179
|
+
BRAINTRUST_PARENT_KEY: () => _chunkGSIDVFE6js.BRAINTRUST_PARENT_KEY,
|
|
180
|
+
BaseAttachment: () => _chunkGSIDVFE6js.BaseAttachment,
|
|
178
181
|
BaseExperiment: () => BaseExperiment,
|
|
179
|
-
BraintrustLangChainCallbackHandler: () =>
|
|
182
|
+
BraintrustLangChainCallbackHandler: () => _chunkGSIDVFE6js.BraintrustLangChainCallbackHandler,
|
|
180
183
|
BraintrustMiddleware: () => BraintrustMiddleware,
|
|
181
|
-
BraintrustObservabilityExporter: () =>
|
|
182
|
-
BraintrustState: () =>
|
|
183
|
-
BraintrustStream: () =>
|
|
184
|
+
BraintrustObservabilityExporter: () => _chunkGSIDVFE6js.BraintrustObservabilityExporter,
|
|
185
|
+
BraintrustState: () => _chunkGSIDVFE6js.BraintrustState,
|
|
186
|
+
BraintrustStream: () => _chunkGSIDVFE6js.BraintrustStream,
|
|
184
187
|
CachedSpanFetcher: () => CachedSpanFetcher,
|
|
185
188
|
CodeFunction: () => CodeFunction,
|
|
186
189
|
CodePrompt: () => CodePrompt,
|
|
187
|
-
ContextManager: () =>
|
|
188
|
-
DEFAULT_FETCH_BATCH_SIZE: () =>
|
|
189
|
-
DEFAULT_MAX_REQUEST_SIZE: () =>
|
|
190
|
-
Dataset: () =>
|
|
190
|
+
ContextManager: () => _chunkGSIDVFE6js.ContextManager,
|
|
191
|
+
DEFAULT_FETCH_BATCH_SIZE: () => _chunkGSIDVFE6js.DEFAULT_FETCH_BATCH_SIZE,
|
|
192
|
+
DEFAULT_MAX_REQUEST_SIZE: () => _chunkGSIDVFE6js.DEFAULT_MAX_REQUEST_SIZE,
|
|
193
|
+
Dataset: () => _chunkGSIDVFE6js.Dataset,
|
|
191
194
|
DatasetPipeline: () => DatasetPipeline,
|
|
192
|
-
ERR_PERMALINK: () =>
|
|
195
|
+
ERR_PERMALINK: () => _chunkGSIDVFE6js.ERR_PERMALINK,
|
|
193
196
|
Eval: () => Eval,
|
|
194
197
|
EvalResultWithSummary: () => EvalResultWithSummary,
|
|
195
|
-
Experiment: () =>
|
|
196
|
-
ExternalAttachment: () =>
|
|
197
|
-
FailedHTTPResponse: () =>
|
|
198
|
-
IDGenerator: () =>
|
|
199
|
-
JSONAttachment: () =>
|
|
200
|
-
LEGACY_CACHED_HEADER: () =>
|
|
201
|
-
LOGS3_OVERFLOW_REFERENCE_TYPE: () =>
|
|
202
|
-
LazyValue: () =>
|
|
198
|
+
Experiment: () => _chunkGSIDVFE6js.Experiment,
|
|
199
|
+
ExternalAttachment: () => _chunkGSIDVFE6js.ExternalAttachment,
|
|
200
|
+
FailedHTTPResponse: () => _chunkGSIDVFE6js.FailedHTTPResponse,
|
|
201
|
+
IDGenerator: () => _chunkGSIDVFE6js.IDGenerator,
|
|
202
|
+
JSONAttachment: () => _chunkGSIDVFE6js.JSONAttachment,
|
|
203
|
+
LEGACY_CACHED_HEADER: () => _chunkGSIDVFE6js.LEGACY_CACHED_HEADER,
|
|
204
|
+
LOGS3_OVERFLOW_REFERENCE_TYPE: () => _chunkGSIDVFE6js.LOGS3_OVERFLOW_REFERENCE_TYPE,
|
|
205
|
+
LazyValue: () => _chunkGSIDVFE6js.LazyValue,
|
|
203
206
|
LocalTrace: () => LocalTrace,
|
|
204
|
-
Logger: () =>
|
|
205
|
-
LoginInvalidOrgError: () =>
|
|
206
|
-
NOOP_SPAN: () =>
|
|
207
|
-
NOOP_SPAN_PERMALINK: () =>
|
|
208
|
-
NoopSpan: () =>
|
|
209
|
-
OTELIDGenerator: () =>
|
|
210
|
-
ObjectFetcher: () =>
|
|
207
|
+
Logger: () => _chunkGSIDVFE6js.Logger,
|
|
208
|
+
LoginInvalidOrgError: () => _chunkGSIDVFE6js.LoginInvalidOrgError,
|
|
209
|
+
NOOP_SPAN: () => _chunkGSIDVFE6js.NOOP_SPAN,
|
|
210
|
+
NOOP_SPAN_PERMALINK: () => _chunkGSIDVFE6js.NOOP_SPAN_PERMALINK,
|
|
211
|
+
NoopSpan: () => _chunkGSIDVFE6js.NoopSpan,
|
|
212
|
+
OTELIDGenerator: () => _chunkGSIDVFE6js.OTELIDGenerator,
|
|
213
|
+
ObjectFetcher: () => _chunkGSIDVFE6js.ObjectFetcher,
|
|
211
214
|
Project: () => Project2,
|
|
212
215
|
ProjectNameIdMap: () => ProjectNameIdMap,
|
|
213
|
-
Prompt: () =>
|
|
216
|
+
Prompt: () => _chunkGSIDVFE6js.Prompt,
|
|
214
217
|
PromptBuilder: () => PromptBuilder,
|
|
215
|
-
ReadonlyAttachment: () =>
|
|
216
|
-
ReadonlyExperiment: () =>
|
|
218
|
+
ReadonlyAttachment: () => _chunkGSIDVFE6js.ReadonlyAttachment,
|
|
219
|
+
ReadonlyExperiment: () => _chunkGSIDVFE6js.ReadonlyExperiment,
|
|
217
220
|
Reporter: () => Reporter,
|
|
218
221
|
ScorerBuilder: () => ScorerBuilder,
|
|
219
222
|
SpanFetcher: () => SpanFetcher,
|
|
220
|
-
SpanImpl: () =>
|
|
221
|
-
TRACEPARENT_HEADER: () =>
|
|
222
|
-
TRACESTATE_HEADER: () =>
|
|
223
|
-
TestBackgroundLogger: () =>
|
|
223
|
+
SpanImpl: () => _chunkGSIDVFE6js.SpanImpl,
|
|
224
|
+
TRACEPARENT_HEADER: () => _chunkGSIDVFE6js.TRACEPARENT_HEADER,
|
|
225
|
+
TRACESTATE_HEADER: () => _chunkGSIDVFE6js.TRACESTATE_HEADER,
|
|
226
|
+
TestBackgroundLogger: () => _chunkGSIDVFE6js.TestBackgroundLogger,
|
|
224
227
|
ToolBuilder: () => ToolBuilder,
|
|
225
|
-
UUIDGenerator: () =>
|
|
226
|
-
X_CACHED_HEADER: () =>
|
|
227
|
-
_exportsForTestingOnly: () =>
|
|
228
|
-
_internalGetGlobalState: () =>
|
|
229
|
-
_internalIso: () =>
|
|
230
|
-
_internalSetInitialState: () =>
|
|
231
|
-
addAzureBlobHeaders: () =>
|
|
228
|
+
UUIDGenerator: () => _chunkGSIDVFE6js.UUIDGenerator,
|
|
229
|
+
X_CACHED_HEADER: () => _chunkGSIDVFE6js.X_CACHED_HEADER,
|
|
230
|
+
_exportsForTestingOnly: () => _chunkGSIDVFE6js._exportsForTestingOnly,
|
|
231
|
+
_internalGetGlobalState: () => _chunkGSIDVFE6js._internalGetGlobalState,
|
|
232
|
+
_internalIso: () => _chunkP25IOOU4js.isomorph_default,
|
|
233
|
+
_internalSetInitialState: () => _chunkGSIDVFE6js._internalSetInitialState,
|
|
234
|
+
addAzureBlobHeaders: () => _chunkGSIDVFE6js.addAzureBlobHeaders,
|
|
232
235
|
agentAssertionScorer: () => agentAssertionScorer,
|
|
233
|
-
braintrustAISDKTelemetry: () =>
|
|
236
|
+
braintrustAISDKTelemetry: () => _chunkGSIDVFE6js.braintrustAISDKTelemetry,
|
|
234
237
|
braintrustEveHook: () => braintrustEveHook,
|
|
235
238
|
braintrustEveInstrumentation: () => braintrustEveInstrumentation,
|
|
236
|
-
braintrustFlueInstrumentation: () =>
|
|
237
|
-
braintrustFlueObserver: () =>
|
|
238
|
-
braintrustStreamChunkSchema: () =>
|
|
239
|
+
braintrustFlueInstrumentation: () => _chunkGSIDVFE6js.braintrustFlueInstrumentation,
|
|
240
|
+
braintrustFlueObserver: () => _chunkGSIDVFE6js.braintrustFlueObserver,
|
|
241
|
+
braintrustStreamChunkSchema: () => _chunkGSIDVFE6js.braintrustStreamChunkSchema,
|
|
239
242
|
buildLocalSummary: () => buildLocalSummary,
|
|
240
|
-
configureInstrumentation: () =>
|
|
241
|
-
constructLogs3OverflowRequest: () =>
|
|
242
|
-
createFinalValuePassThroughStream: () =>
|
|
243
|
-
currentExperiment: () =>
|
|
244
|
-
currentLogger: () =>
|
|
245
|
-
currentSpan: () =>
|
|
246
|
-
deepCopyEvent: () =>
|
|
243
|
+
configureInstrumentation: () => _chunkGSIDVFE6js.configureInstrumentation,
|
|
244
|
+
constructLogs3OverflowRequest: () => _chunkGSIDVFE6js.constructLogs3OverflowRequest,
|
|
245
|
+
createFinalValuePassThroughStream: () => _chunkGSIDVFE6js.createFinalValuePassThroughStream,
|
|
246
|
+
currentExperiment: () => _chunkGSIDVFE6js.currentExperiment,
|
|
247
|
+
currentLogger: () => _chunkGSIDVFE6js.currentLogger,
|
|
248
|
+
currentSpan: () => _chunkGSIDVFE6js.currentSpan,
|
|
249
|
+
deepCopyEvent: () => _chunkGSIDVFE6js.deepCopyEvent,
|
|
247
250
|
defaultErrorScoreHandler: () => defaultErrorScoreHandler,
|
|
248
|
-
deserializePlainStringAsJSON: () =>
|
|
249
|
-
devNullWritableStream: () =>
|
|
251
|
+
deserializePlainStringAsJSON: () => _chunkGSIDVFE6js.deserializePlainStringAsJSON,
|
|
252
|
+
devNullWritableStream: () => _chunkGSIDVFE6js.devNullWritableStream,
|
|
250
253
|
evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
|
|
251
254
|
evaluatorDefinitionsSchema: () => evaluatorDefinitionsSchema,
|
|
252
|
-
extractTraceContextFromHeaders: () =>
|
|
253
|
-
flush: () =>
|
|
254
|
-
getContextManager: () =>
|
|
255
|
-
getIdGenerator: () =>
|
|
256
|
-
getPromptVersions: () =>
|
|
257
|
-
getSpanParentObject: () =>
|
|
258
|
-
getTemplateRenderer: () =>
|
|
255
|
+
extractTraceContextFromHeaders: () => _chunkGSIDVFE6js.extractTraceContextFromHeaders,
|
|
256
|
+
flush: () => _chunkGSIDVFE6js.flush,
|
|
257
|
+
getContextManager: () => _chunkGSIDVFE6js.getContextManager,
|
|
258
|
+
getIdGenerator: () => _chunkGSIDVFE6js.getIdGenerator,
|
|
259
|
+
getPromptVersions: () => _chunkGSIDVFE6js.getPromptVersions,
|
|
260
|
+
getSpanParentObject: () => _chunkGSIDVFE6js.getSpanParentObject,
|
|
261
|
+
getTemplateRenderer: () => _chunkGSIDVFE6js.getTemplateRenderer,
|
|
259
262
|
graph: () => graph_framework_exports,
|
|
260
|
-
init: () =>
|
|
261
|
-
initDataset: () =>
|
|
262
|
-
initExperiment: () =>
|
|
263
|
+
init: () => _chunkGSIDVFE6js.init,
|
|
264
|
+
initDataset: () => _chunkGSIDVFE6js.initDataset,
|
|
265
|
+
initExperiment: () => _chunkGSIDVFE6js.initExperiment,
|
|
263
266
|
initFunction: () => initFunction,
|
|
264
|
-
initLogger: () =>
|
|
267
|
+
initLogger: () => _chunkGSIDVFE6js.initLogger,
|
|
265
268
|
initNodeTestSuite: () => initNodeTestSuite,
|
|
266
|
-
injectTraceContext: () =>
|
|
269
|
+
injectTraceContext: () => _chunkGSIDVFE6js.injectTraceContext,
|
|
267
270
|
invoke: () => invoke,
|
|
268
|
-
isTemplateFormat: () =>
|
|
269
|
-
loadParameters: () =>
|
|
270
|
-
loadPrompt: () =>
|
|
271
|
-
log: () =>
|
|
272
|
-
logError: () =>
|
|
273
|
-
login: () =>
|
|
274
|
-
loginToState: () =>
|
|
275
|
-
logs3OverflowUploadSchema: () =>
|
|
276
|
-
newId: () =>
|
|
277
|
-
parseCachedHeader: () =>
|
|
278
|
-
parseTemplateFormat: () =>
|
|
279
|
-
permalink: () =>
|
|
280
|
-
pickLogs3OverflowObjectIds: () =>
|
|
271
|
+
isTemplateFormat: () => _chunkGSIDVFE6js.isTemplateFormat,
|
|
272
|
+
loadParameters: () => _chunkGSIDVFE6js.loadParameters,
|
|
273
|
+
loadPrompt: () => _chunkGSIDVFE6js.loadPrompt,
|
|
274
|
+
log: () => _chunkGSIDVFE6js.log,
|
|
275
|
+
logError: () => _chunkGSIDVFE6js.logError,
|
|
276
|
+
login: () => _chunkGSIDVFE6js.login,
|
|
277
|
+
loginToState: () => _chunkGSIDVFE6js.loginToState,
|
|
278
|
+
logs3OverflowUploadSchema: () => _chunkGSIDVFE6js.logs3OverflowUploadSchema,
|
|
279
|
+
newId: () => _chunkGSIDVFE6js.newId,
|
|
280
|
+
parseCachedHeader: () => _chunkGSIDVFE6js.parseCachedHeader,
|
|
281
|
+
parseTemplateFormat: () => _chunkGSIDVFE6js.parseTemplateFormat,
|
|
282
|
+
permalink: () => _chunkGSIDVFE6js.permalink,
|
|
283
|
+
pickLogs3OverflowObjectIds: () => _chunkGSIDVFE6js.pickLogs3OverflowObjectIds,
|
|
281
284
|
projects: () => projects,
|
|
282
285
|
promptContentsSchema: () => promptContentsSchema,
|
|
283
286
|
promptDefinitionSchema: () => promptDefinitionSchema,
|
|
284
287
|
promptDefinitionToPromptData: () => promptDefinitionToPromptData,
|
|
285
288
|
promptDefinitionWithToolsSchema: () => promptDefinitionWithToolsSchema,
|
|
286
|
-
registerOtelFlush: () =>
|
|
289
|
+
registerOtelFlush: () => _chunkGSIDVFE6js.registerOtelFlush,
|
|
287
290
|
registerSandbox: () => registerSandbox,
|
|
288
|
-
registerTemplatePlugin: () =>
|
|
289
|
-
renderMessage: () =>
|
|
290
|
-
renderPromptParams: () =>
|
|
291
|
-
renderTemplateContent: () =>
|
|
291
|
+
registerTemplatePlugin: () => _chunkGSIDVFE6js.registerTemplatePlugin,
|
|
292
|
+
renderMessage: () => _chunkGSIDVFE6js.renderMessage,
|
|
293
|
+
renderPromptParams: () => _chunkGSIDVFE6js.renderPromptParams,
|
|
294
|
+
renderTemplateContent: () => _chunkGSIDVFE6js.renderTemplateContent,
|
|
292
295
|
reportFailures: () => reportFailures,
|
|
293
296
|
runEvaluator: () => runEvaluator,
|
|
294
|
-
setFetch: () =>
|
|
295
|
-
setMaskingFunction: () =>
|
|
296
|
-
spanComponentsToObjectId: () =>
|
|
297
|
-
startSpan: () =>
|
|
298
|
-
summarize: () =>
|
|
299
|
-
templateRegistry: () =>
|
|
300
|
-
toolFunctionDefinitionSchema: () =>
|
|
301
|
-
traceable: () =>
|
|
302
|
-
traced: () =>
|
|
303
|
-
updateSpan: () =>
|
|
304
|
-
uploadLogs3OverflowPayload: () =>
|
|
305
|
-
utf8ByteLength: () =>
|
|
306
|
-
withCurrent: () =>
|
|
307
|
-
withDataset: () =>
|
|
308
|
-
withExperiment: () =>
|
|
309
|
-
withLogger: () =>
|
|
310
|
-
withParent: () =>
|
|
297
|
+
setFetch: () => _chunkGSIDVFE6js.setFetch,
|
|
298
|
+
setMaskingFunction: () => _chunkGSIDVFE6js.setMaskingFunction,
|
|
299
|
+
spanComponentsToObjectId: () => _chunkGSIDVFE6js.spanComponentsToObjectId,
|
|
300
|
+
startSpan: () => _chunkGSIDVFE6js.startSpan,
|
|
301
|
+
summarize: () => _chunkGSIDVFE6js.summarize,
|
|
302
|
+
templateRegistry: () => _chunkGSIDVFE6js.templateRegistry,
|
|
303
|
+
toolFunctionDefinitionSchema: () => _chunkGSIDVFE6js.ToolFunctionDefinition,
|
|
304
|
+
traceable: () => _chunkGSIDVFE6js.traceable,
|
|
305
|
+
traced: () => _chunkGSIDVFE6js.traced,
|
|
306
|
+
updateSpan: () => _chunkGSIDVFE6js.updateSpan,
|
|
307
|
+
uploadLogs3OverflowPayload: () => _chunkGSIDVFE6js.uploadLogs3OverflowPayload,
|
|
308
|
+
utf8ByteLength: () => _chunkGSIDVFE6js.utf8ByteLength,
|
|
309
|
+
withCurrent: () => _chunkGSIDVFE6js.withCurrent,
|
|
310
|
+
withDataset: () => _chunkGSIDVFE6js.withDataset,
|
|
311
|
+
withExperiment: () => _chunkGSIDVFE6js.withExperiment,
|
|
312
|
+
withLogger: () => _chunkGSIDVFE6js.withLogger,
|
|
313
|
+
withParent: () => _chunkGSIDVFE6js.withParent,
|
|
311
314
|
wrapAISDK: () => wrapAISDK,
|
|
312
315
|
wrapAISDKModel: () => wrapAISDKModel,
|
|
313
316
|
wrapAgentClass: () => wrapAgentClass,
|
|
@@ -325,7 +328,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
325
328
|
wrapLangSmithClient: () => wrapLangSmithClient,
|
|
326
329
|
wrapLangSmithRunTrees: () => wrapLangSmithRunTrees,
|
|
327
330
|
wrapLangSmithTraceable: () => wrapLangSmithTraceable,
|
|
328
|
-
wrapMastraAgent: () =>
|
|
331
|
+
wrapMastraAgent: () => _chunkGSIDVFE6js.wrapMastraAgent,
|
|
329
332
|
wrapMistral: () => wrapMistral,
|
|
330
333
|
wrapOpenAI: () => wrapOpenAI,
|
|
331
334
|
wrapOpenAICodexSDK: () => wrapOpenAICodexSDK,
|
|
@@ -334,7 +337,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
334
337
|
wrapOpenRouterAgent: () => wrapOpenRouterAgent,
|
|
335
338
|
wrapPiCodingAgentSDK: () => wrapPiCodingAgentSDK,
|
|
336
339
|
wrapStrandsAgentSDK: () => wrapStrandsAgentSDK,
|
|
337
|
-
wrapTraced: () =>
|
|
340
|
+
wrapTraced: () => _chunkGSIDVFE6js.wrapTraced,
|
|
338
341
|
wrapVitest: () => wrapVitest
|
|
339
342
|
});
|
|
340
343
|
|
|
@@ -342,7 +345,7 @@ _chunkCDIKAHDZjs.__export.call(void 0, exports_exports, {
|
|
|
342
345
|
var _v3 = require('zod/v3');
|
|
343
346
|
var SANDBOX_GROUP_NAME_METADATA_KEY = "_bt_sandbox_group_name";
|
|
344
347
|
async function registerSandbox(options) {
|
|
345
|
-
const state = _nullishCoalesce(options.state, () => (
|
|
348
|
+
const state = _nullishCoalesce(options.state, () => ( _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, )));
|
|
346
349
|
await state.login({
|
|
347
350
|
apiKey: options.apiKey,
|
|
348
351
|
appUrl: options.appUrl,
|
|
@@ -383,7 +386,7 @@ async function registerSandbox(options) {
|
|
|
383
386
|
evaluatorDefinitions
|
|
384
387
|
)) {
|
|
385
388
|
const functionName = evalName;
|
|
386
|
-
const functionSlug =
|
|
389
|
+
const functionSlug = _chunkGSIDVFE6js.slugify.call(void 0, evalName, { lower: true, strict: true });
|
|
387
390
|
const functionDef = {
|
|
388
391
|
project_id: projectId,
|
|
389
392
|
org_name: state.orgName,
|
|
@@ -454,7 +457,7 @@ async function invoke(args) {
|
|
|
454
457
|
projectId,
|
|
455
458
|
...functionIdArgs
|
|
456
459
|
} = args;
|
|
457
|
-
const state = _nullishCoalesce(stateArg, () => (
|
|
460
|
+
const state = _nullishCoalesce(stateArg, () => ( _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, )));
|
|
458
461
|
await state.login({
|
|
459
462
|
orgName,
|
|
460
463
|
apiKey,
|
|
@@ -462,8 +465,8 @@ async function invoke(args) {
|
|
|
462
465
|
forceLogin,
|
|
463
466
|
fetch
|
|
464
467
|
});
|
|
465
|
-
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await
|
|
466
|
-
const functionId =
|
|
468
|
+
const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await _chunkGSIDVFE6js.getSpanParentObject.call(void 0, ).export();
|
|
469
|
+
const functionId = _chunkGSIDVFE6js.FunctionId.safeParse({
|
|
467
470
|
function_id: functionIdArgs.function_id,
|
|
468
471
|
project_name: functionIdArgs.projectName,
|
|
469
472
|
slug: functionIdArgs.slug,
|
|
@@ -506,7 +509,7 @@ async function invoke(args) {
|
|
|
506
509
|
if (!resp.body) {
|
|
507
510
|
throw new Error("Received empty stream body");
|
|
508
511
|
}
|
|
509
|
-
return new (0,
|
|
512
|
+
return new (0, _chunkGSIDVFE6js.BraintrustStream)(resp.body);
|
|
510
513
|
} else {
|
|
511
514
|
const data = await resp.json();
|
|
512
515
|
return schema ? schema.parse(data) : data;
|
|
@@ -518,7 +521,7 @@ function initFunction({
|
|
|
518
521
|
version,
|
|
519
522
|
state
|
|
520
523
|
}) {
|
|
521
|
-
const s = _nullishCoalesce(state, () => (
|
|
524
|
+
const s = _nullishCoalesce(state, () => ( _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, )));
|
|
522
525
|
_optionalChain([s, 'optionalAccess', _2 => _2.spanCache, 'optionalAccess', _3 => _3.disable, 'call', _4 => _4()]);
|
|
523
526
|
const f = async (input) => {
|
|
524
527
|
return await invoke({
|
|
@@ -596,22 +599,22 @@ function responsesProxy(openai) {
|
|
|
596
599
|
if (name === "create" && typeof target.create === "function") {
|
|
597
600
|
return wrapResponsesAsync(
|
|
598
601
|
target.create.bind(target),
|
|
599
|
-
|
|
602
|
+
_chunkP25IOOU4js.openAIChannels.responsesCreate
|
|
600
603
|
);
|
|
601
604
|
} else if (name === "stream" && typeof target.stream === "function") {
|
|
602
605
|
return wrapResponsesSyncStream(
|
|
603
606
|
target.stream.bind(target),
|
|
604
|
-
|
|
607
|
+
_chunkP25IOOU4js.openAIChannels.responsesStream
|
|
605
608
|
);
|
|
606
609
|
} else if (name === "parse" && typeof target.parse === "function") {
|
|
607
610
|
return wrapResponsesAsync(
|
|
608
611
|
target.parse.bind(target),
|
|
609
|
-
|
|
612
|
+
_chunkP25IOOU4js.openAIChannels.responsesParse
|
|
610
613
|
);
|
|
611
614
|
} else if (name === "compact" && typeof target.compact === "function") {
|
|
612
615
|
return wrapResponsesAsync(
|
|
613
616
|
target.compact.bind(target),
|
|
614
|
-
|
|
617
|
+
_chunkP25IOOU4js.openAIChannels.responsesCompact
|
|
615
618
|
);
|
|
616
619
|
}
|
|
617
620
|
return Reflect.get(target, name, receiver);
|
|
@@ -755,7 +758,7 @@ function wrapBetaChatCompletionParse(completion) {
|
|
|
755
758
|
const { span_info, params } = splitSpanInfo(
|
|
756
759
|
allParams
|
|
757
760
|
);
|
|
758
|
-
return
|
|
761
|
+
return _chunkP25IOOU4js.openAIChannels.betaChatCompletionsParse.tracePromise(
|
|
759
762
|
async () => await completion(params),
|
|
760
763
|
{ arguments: [params], span_info }
|
|
761
764
|
);
|
|
@@ -766,7 +769,7 @@ function wrapBetaChatCompletionStream(completion) {
|
|
|
766
769
|
const { span_info, params } = splitSpanInfo(
|
|
767
770
|
allParams
|
|
768
771
|
);
|
|
769
|
-
return
|
|
772
|
+
return _chunkP25IOOU4js.openAIChannels.betaChatCompletionsStream.traceSync(
|
|
770
773
|
() => completion(params),
|
|
771
774
|
{ arguments: [params], span_info }
|
|
772
775
|
);
|
|
@@ -782,7 +785,7 @@ function wrapChatCompletion(completion) {
|
|
|
782
785
|
if (!executionPromise) {
|
|
783
786
|
executionPromise = (async () => {
|
|
784
787
|
const traceContext = createChannelContext(
|
|
785
|
-
|
|
788
|
+
_chunkP25IOOU4js.openAIChannels.chatCompletionsCreate,
|
|
786
789
|
params,
|
|
787
790
|
span_info
|
|
788
791
|
);
|
|
@@ -792,7 +795,7 @@ function wrapChatCompletion(completion) {
|
|
|
792
795
|
options
|
|
793
796
|
);
|
|
794
797
|
const { data: data2, response: response2 } = await tracePromiseWithResponse(
|
|
795
|
-
|
|
798
|
+
_chunkP25IOOU4js.openAIChannels.chatCompletionsCreate,
|
|
796
799
|
traceContext,
|
|
797
800
|
completionPromise
|
|
798
801
|
);
|
|
@@ -803,7 +806,7 @@ function wrapChatCompletion(completion) {
|
|
|
803
806
|
options
|
|
804
807
|
);
|
|
805
808
|
const { data, response } = await tracePromiseWithResponse(
|
|
806
|
-
|
|
809
|
+
_chunkP25IOOU4js.openAIChannels.chatCompletionsCreate,
|
|
807
810
|
traceContext,
|
|
808
811
|
completionResponse
|
|
809
812
|
);
|
|
@@ -846,8 +849,8 @@ function wrapApiCreateWithChannel(create, channel) {
|
|
|
846
849
|
return createLazyAPIPromise(ensureExecuted);
|
|
847
850
|
};
|
|
848
851
|
}
|
|
849
|
-
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create,
|
|
850
|
-
var wrapModerations = (create) => wrapApiCreateWithChannel(create,
|
|
852
|
+
var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunkP25IOOU4js.openAIChannels.embeddingsCreate);
|
|
853
|
+
var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunkP25IOOU4js.openAIChannels.moderationsCreate);
|
|
851
854
|
|
|
852
855
|
// src/wrappers/ai-sdk/ai-sdk.ts
|
|
853
856
|
function isModuleNamespace(obj) {
|
|
@@ -905,6 +908,26 @@ function wrapAISDK(aiSDK, options = {}) {
|
|
|
905
908
|
}
|
|
906
909
|
});
|
|
907
910
|
}
|
|
911
|
+
function isHarnessAgentInstance(instance) {
|
|
912
|
+
try {
|
|
913
|
+
const visited = /* @__PURE__ */ new Set();
|
|
914
|
+
let prototype = Object.getPrototypeOf(instance);
|
|
915
|
+
while (prototype !== null && !visited.has(prototype)) {
|
|
916
|
+
visited.add(prototype);
|
|
917
|
+
const constructor = _optionalChain([Object, 'access', _14 => _14.getOwnPropertyDescriptor, 'call', _15 => _15(
|
|
918
|
+
prototype,
|
|
919
|
+
"constructor"
|
|
920
|
+
), 'optionalAccess', _16 => _16.value]);
|
|
921
|
+
const constructorName = typeof constructor === "function" ? _optionalChain([Object, 'access', _17 => _17.getOwnPropertyDescriptor, 'call', _18 => _18(constructor, "name"), 'optionalAccess', _19 => _19.value]) : void 0;
|
|
922
|
+
if (constructorName === "HarnessAgent") {
|
|
923
|
+
return true;
|
|
924
|
+
}
|
|
925
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
926
|
+
}
|
|
927
|
+
} catch (e3) {
|
|
928
|
+
}
|
|
929
|
+
return false;
|
|
930
|
+
}
|
|
908
931
|
var wrapAgentClass = (AgentClass, options = {}) => {
|
|
909
932
|
const typedAgentClass = AgentClass;
|
|
910
933
|
return new Proxy(typedAgentClass, {
|
|
@@ -914,9 +937,52 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
914
937
|
args,
|
|
915
938
|
newTarget
|
|
916
939
|
);
|
|
940
|
+
const harnessAgent = isHarnessAgentInstance(instance) ? instance : null;
|
|
917
941
|
return new Proxy(instance, {
|
|
918
942
|
get(instanceTarget, prop, instanceReceiver) {
|
|
919
943
|
const original = Reflect.get(instanceTarget, prop, instanceTarget);
|
|
944
|
+
if (harnessAgent && typeof original === "function") {
|
|
945
|
+
switch (prop) {
|
|
946
|
+
case "createSession":
|
|
947
|
+
return wrapHarnessAgentCreateSession(
|
|
948
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
949
|
+
original,
|
|
950
|
+
harnessAgent
|
|
951
|
+
);
|
|
952
|
+
case "generate":
|
|
953
|
+
return wrapHarnessAgentGenerate(
|
|
954
|
+
original,
|
|
955
|
+
harnessAgent,
|
|
956
|
+
_chunkP25IOOU4js.harnessAgentChannels.generate,
|
|
957
|
+
"HarnessAgent.generate",
|
|
958
|
+
options
|
|
959
|
+
);
|
|
960
|
+
case "stream":
|
|
961
|
+
return wrapHarnessAgentStream(
|
|
962
|
+
original,
|
|
963
|
+
harnessAgent,
|
|
964
|
+
_chunkP25IOOU4js.harnessAgentChannels.stream,
|
|
965
|
+
"HarnessAgent.stream",
|
|
966
|
+
options
|
|
967
|
+
);
|
|
968
|
+
case "continueGenerate":
|
|
969
|
+
return wrapHarnessAgentGenerate(
|
|
970
|
+
original,
|
|
971
|
+
harnessAgent,
|
|
972
|
+
_chunkP25IOOU4js.harnessAgentChannels.continueGenerate,
|
|
973
|
+
"HarnessAgent.continueGenerate",
|
|
974
|
+
options
|
|
975
|
+
);
|
|
976
|
+
case "continueStream":
|
|
977
|
+
return wrapHarnessAgentStream(
|
|
978
|
+
original,
|
|
979
|
+
harnessAgent,
|
|
980
|
+
_chunkP25IOOU4js.harnessAgentChannels.continueStream,
|
|
981
|
+
"HarnessAgent.continueStream",
|
|
982
|
+
options
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
920
986
|
if (prop === "generate" && typeof original === "function" && instanceTarget.constructor.name !== "WorkflowAgent") {
|
|
921
987
|
return wrapAgentGenerate(original, instanceTarget, options);
|
|
922
988
|
}
|
|
@@ -932,6 +998,39 @@ var wrapAgentClass = (AgentClass, options = {}) => {
|
|
|
932
998
|
}
|
|
933
999
|
});
|
|
934
1000
|
};
|
|
1001
|
+
var wrapHarnessAgentCreateSession = (createSession, instance) => {
|
|
1002
|
+
const wrapper = function(params) {
|
|
1003
|
+
return _chunkP25IOOU4js.harnessAgentChannels.createSession.tracePromise(
|
|
1004
|
+
() => params === void 0 ? createSession.call(instance) : createSession.call(instance, params),
|
|
1005
|
+
createAISDKChannelContext(_nullishCoalesce(params, () => ( {})), { self: instance })
|
|
1006
|
+
);
|
|
1007
|
+
};
|
|
1008
|
+
Object.defineProperty(wrapper, "name", {
|
|
1009
|
+
value: "HarnessAgent.createSession",
|
|
1010
|
+
writable: false
|
|
1011
|
+
});
|
|
1012
|
+
return wrapper;
|
|
1013
|
+
};
|
|
1014
|
+
var wrapHarnessAgentGenerate = (generate, instance, channel, name, options) => makeGenerateTextWrapper(
|
|
1015
|
+
channel,
|
|
1016
|
+
name,
|
|
1017
|
+
generate.bind(instance),
|
|
1018
|
+
{
|
|
1019
|
+
self: instance,
|
|
1020
|
+
spanType: "task" /* TASK */
|
|
1021
|
+
},
|
|
1022
|
+
options
|
|
1023
|
+
);
|
|
1024
|
+
var wrapHarnessAgentStream = (stream, instance, channel, name, options) => makeStreamWrapper(
|
|
1025
|
+
channel,
|
|
1026
|
+
name,
|
|
1027
|
+
stream.bind(instance),
|
|
1028
|
+
{
|
|
1029
|
+
self: instance,
|
|
1030
|
+
spanType: "task" /* TASK */
|
|
1031
|
+
},
|
|
1032
|
+
options
|
|
1033
|
+
);
|
|
935
1034
|
var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
936
1035
|
const defaultName = `${instance.constructor.name}.generate`;
|
|
937
1036
|
return async (params) => makeGenerateTextWrapper(
|
|
@@ -947,15 +1046,15 @@ var wrapAgentGenerate = (generate, instance, options = {}) => {
|
|
|
947
1046
|
};
|
|
948
1047
|
function generateChannelForAgent(agentName) {
|
|
949
1048
|
if (agentName === "ToolLoopAgent") {
|
|
950
|
-
return
|
|
1049
|
+
return _chunkP25IOOU4js.aiSDKChannels.toolLoopAgentGenerate;
|
|
951
1050
|
}
|
|
952
|
-
return
|
|
1051
|
+
return _chunkP25IOOU4js.aiSDKChannels.agentGenerate;
|
|
953
1052
|
}
|
|
954
1053
|
var wrapAgentStream = (stream, instance, options = {}) => {
|
|
955
1054
|
const defaultName = `${instance.constructor.name}.stream`;
|
|
956
1055
|
return (params) => {
|
|
957
1056
|
const workflowAgent = instance.constructor.name === "WorkflowAgent";
|
|
958
|
-
if (workflowAgent &&
|
|
1057
|
+
if (workflowAgent && _chunkGSIDVFE6js.currentWorkflowAgentWrapperSpan.call(void 0, )) {
|
|
959
1058
|
const { span_info: _spanInfo, ...cleanParams } = params;
|
|
960
1059
|
return stream.call(instance, { ...instance.settings, ...cleanParams });
|
|
961
1060
|
}
|
|
@@ -974,12 +1073,12 @@ var wrapAgentStream = (stream, instance, options = {}) => {
|
|
|
974
1073
|
};
|
|
975
1074
|
function streamChannelForAgent(agentName) {
|
|
976
1075
|
if (agentName === "ToolLoopAgent") {
|
|
977
|
-
return
|
|
1076
|
+
return _chunkP25IOOU4js.aiSDKChannels.toolLoopAgentStream;
|
|
978
1077
|
}
|
|
979
1078
|
if (agentName === "WorkflowAgent") {
|
|
980
|
-
return
|
|
1079
|
+
return _chunkP25IOOU4js.aiSDKChannels.workflowAgentStream;
|
|
981
1080
|
}
|
|
982
|
-
return
|
|
1081
|
+
return _chunkP25IOOU4js.aiSDKChannels.agentStream;
|
|
983
1082
|
}
|
|
984
1083
|
var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {}, options = {}) => {
|
|
985
1084
|
const wrapper = async function(allParams) {
|
|
@@ -1003,7 +1102,7 @@ var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {},
|
|
|
1003
1102
|
};
|
|
1004
1103
|
var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
1005
1104
|
return makeGenerateTextWrapper(
|
|
1006
|
-
|
|
1105
|
+
_chunkP25IOOU4js.aiSDKChannels.generateText,
|
|
1007
1106
|
"generateText",
|
|
1008
1107
|
generateText,
|
|
1009
1108
|
{ aiSDK },
|
|
@@ -1012,7 +1111,7 @@ var wrapGenerateText = (generateText, options = {}, aiSDK) => {
|
|
|
1012
1111
|
};
|
|
1013
1112
|
var wrapGenerateObject = (generateObject, options = {}, aiSDK) => {
|
|
1014
1113
|
return makeGenerateTextWrapper(
|
|
1015
|
-
|
|
1114
|
+
_chunkP25IOOU4js.aiSDKChannels.generateObject,
|
|
1016
1115
|
"generateObject",
|
|
1017
1116
|
generateObject,
|
|
1018
1117
|
{ aiSDK },
|
|
@@ -1041,7 +1140,7 @@ var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {})
|
|
|
1041
1140
|
};
|
|
1042
1141
|
var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
1043
1142
|
return makeEmbedWrapper(
|
|
1044
|
-
|
|
1143
|
+
_chunkP25IOOU4js.aiSDKChannels.embed,
|
|
1045
1144
|
"embed",
|
|
1046
1145
|
embed,
|
|
1047
1146
|
{ aiSDK },
|
|
@@ -1050,7 +1149,7 @@ var wrapEmbed = (embed, options = {}, aiSDK) => {
|
|
|
1050
1149
|
};
|
|
1051
1150
|
var wrapEmbedMany = (embedMany, options = {}, aiSDK) => {
|
|
1052
1151
|
return makeEmbedWrapper(
|
|
1053
|
-
|
|
1152
|
+
_chunkP25IOOU4js.aiSDKChannels.embedMany,
|
|
1054
1153
|
"embedMany",
|
|
1055
1154
|
embedMany,
|
|
1056
1155
|
{ aiSDK },
|
|
@@ -1061,7 +1160,7 @@ var makeRerankWrapper = (rerank, contextOptions = {}, options = {}) => {
|
|
|
1061
1160
|
const wrapper = async function(allParams) {
|
|
1062
1161
|
const { span_info, ...params } = allParams;
|
|
1063
1162
|
const tracedParams = { ...params };
|
|
1064
|
-
return
|
|
1163
|
+
return _chunkP25IOOU4js.aiSDKChannels.rerank.tracePromise(
|
|
1065
1164
|
() => rerank(tracedParams),
|
|
1066
1165
|
createAISDKChannelContext(tracedParams, {
|
|
1067
1166
|
aiSDK: contextOptions.aiSDK,
|
|
@@ -1100,7 +1199,7 @@ var makeStreamWrapper = (channel, name, streamText, contextOptions = {}, options
|
|
|
1100
1199
|
};
|
|
1101
1200
|
var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
1102
1201
|
return makeStreamWrapper(
|
|
1103
|
-
|
|
1202
|
+
_chunkP25IOOU4js.aiSDKChannels.streamText,
|
|
1104
1203
|
"streamText",
|
|
1105
1204
|
streamText,
|
|
1106
1205
|
{ aiSDK },
|
|
@@ -1109,7 +1208,7 @@ var wrapStreamText = (streamText, options = {}, aiSDK) => {
|
|
|
1109
1208
|
};
|
|
1110
1209
|
var wrapStreamObject = (streamObject, options = {}, aiSDK) => {
|
|
1111
1210
|
return makeStreamWrapper(
|
|
1112
|
-
|
|
1211
|
+
_chunkP25IOOU4js.aiSDKChannels.streamObject,
|
|
1113
1212
|
"streamObject",
|
|
1114
1213
|
streamObject,
|
|
1115
1214
|
{ aiSDK },
|
|
@@ -1122,11 +1221,11 @@ function mergeSpanInfo(spanInfo, defaults) {
|
|
|
1122
1221
|
}
|
|
1123
1222
|
return {
|
|
1124
1223
|
...spanInfo,
|
|
1125
|
-
..._optionalChain([spanInfo, 'optionalAccess',
|
|
1126
|
-
...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess',
|
|
1224
|
+
..._optionalChain([spanInfo, 'optionalAccess', _20 => _20.name]) ? {} : defaults.name ? { name: defaults.name } : {},
|
|
1225
|
+
...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess', _21 => _21.spanAttributes]) ? {
|
|
1127
1226
|
spanAttributes: {
|
|
1128
1227
|
...defaults.spanType !== void 0 ? { type: defaults.spanType } : {},
|
|
1129
|
-
..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess',
|
|
1228
|
+
..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess', _22 => _22.spanAttributes]), () => ( {}))
|
|
1130
1229
|
}
|
|
1131
1230
|
} : {}
|
|
1132
1231
|
};
|
|
@@ -1144,7 +1243,7 @@ function createAISDKChannelContext(params, context = {}) {
|
|
|
1144
1243
|
// src/wrappers/ai-sdk/deprecated/wrapAISDKModel.ts
|
|
1145
1244
|
function wrapAISDKModel(model) {
|
|
1146
1245
|
const m = model;
|
|
1147
|
-
if (_optionalChain([m, 'optionalAccess',
|
|
1246
|
+
if (_optionalChain([m, 'optionalAccess', _23 => _23.specificationVersion]) === "v1" && typeof _optionalChain([m, 'optionalAccess', _24 => _24.provider]) === "string" && typeof _optionalChain([m, 'optionalAccess', _25 => _25.modelId]) === "string") {
|
|
1148
1247
|
return new BraintrustLanguageModelWrapper(m);
|
|
1149
1248
|
} else {
|
|
1150
1249
|
console.warn("Unsupported AI SDK model. Not wrapping.");
|
|
@@ -1159,6 +1258,7 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1159
1258
|
}
|
|
1160
1259
|
}
|
|
1161
1260
|
|
|
1261
|
+
|
|
1162
1262
|
get specificationVersion() {
|
|
1163
1263
|
return this.model.specificationVersion;
|
|
1164
1264
|
}
|
|
@@ -1180,14 +1280,19 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1180
1280
|
// For the first cut, do not support custom span_info arguments. We can
|
|
1181
1281
|
// propagate those via async local storage
|
|
1182
1282
|
async doGenerate(options) {
|
|
1183
|
-
const span =
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1283
|
+
const span = _chunkGSIDVFE6js.startSpan.call(void 0,
|
|
1284
|
+
_chunkP25IOOU4js.withSpanInstrumentationName.call(void 0,
|
|
1285
|
+
{
|
|
1286
|
+
name: "Chat Completion",
|
|
1287
|
+
spanAttributes: {
|
|
1288
|
+
type: "llm"
|
|
1289
|
+
}
|
|
1290
|
+
},
|
|
1291
|
+
_chunkP25IOOU4js.INSTRUMENTATION_NAMES.AI_SDK
|
|
1292
|
+
)
|
|
1293
|
+
);
|
|
1189
1294
|
const { prompt, mode, ...rest } = options;
|
|
1190
|
-
const startTime =
|
|
1295
|
+
const startTime = _chunkGSIDVFE6js.getCurrentUnixTimestamp.call(void 0, );
|
|
1191
1296
|
try {
|
|
1192
1297
|
const ret = await this.model.doGenerate(options);
|
|
1193
1298
|
span.log({
|
|
@@ -1199,12 +1304,12 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1199
1304
|
},
|
|
1200
1305
|
output: postProcessOutput(ret.text, ret.toolCalls, ret.finishReason),
|
|
1201
1306
|
metrics: {
|
|
1202
|
-
time_to_first_token:
|
|
1203
|
-
tokens: !
|
|
1204
|
-
prompt_tokens: _optionalChain([ret, 'access',
|
|
1205
|
-
completion_tokens: _optionalChain([ret, 'access',
|
|
1206
|
-
cached:
|
|
1207
|
-
_nullishCoalesce(_optionalChain([ret, 'access',
|
|
1307
|
+
time_to_first_token: _chunkGSIDVFE6js.getCurrentUnixTimestamp.call(void 0, ) - startTime,
|
|
1308
|
+
tokens: !_chunkGSIDVFE6js.isEmpty.call(void 0, ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
|
|
1309
|
+
prompt_tokens: _optionalChain([ret, 'access', _26 => _26.usage, 'optionalAccess', _27 => _27.promptTokens]),
|
|
1310
|
+
completion_tokens: _optionalChain([ret, 'access', _28 => _28.usage, 'optionalAccess', _29 => _29.completionTokens]),
|
|
1311
|
+
cached: _chunkGSIDVFE6js.parseCachedHeader.call(void 0,
|
|
1312
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _30 => _30.rawResponse, 'optionalAccess', _31 => _31.headers, 'optionalAccess', _32 => _32[_chunkGSIDVFE6js.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _33 => _33.rawResponse, 'optionalAccess', _34 => _34.headers, 'optionalAccess', _35 => _35[_chunkGSIDVFE6js.LEGACY_CACHED_HEADER]])))
|
|
1208
1313
|
)
|
|
1209
1314
|
}
|
|
1210
1315
|
});
|
|
@@ -1215,13 +1320,18 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1215
1320
|
}
|
|
1216
1321
|
async doStream(options) {
|
|
1217
1322
|
const { prompt, mode, ...rest } = options;
|
|
1218
|
-
const startTime =
|
|
1219
|
-
const span =
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1323
|
+
const startTime = _chunkGSIDVFE6js.getCurrentUnixTimestamp.call(void 0, );
|
|
1324
|
+
const span = _chunkGSIDVFE6js.startSpan.call(void 0,
|
|
1325
|
+
_chunkP25IOOU4js.withSpanInstrumentationName.call(void 0,
|
|
1326
|
+
{
|
|
1327
|
+
name: "Chat Completion",
|
|
1328
|
+
spanAttributes: {
|
|
1329
|
+
type: "llm"
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1332
|
+
_chunkP25IOOU4js.INSTRUMENTATION_NAMES.AI_SDK
|
|
1333
|
+
)
|
|
1334
|
+
);
|
|
1225
1335
|
span.log({
|
|
1226
1336
|
input: postProcessPrompt(prompt),
|
|
1227
1337
|
metadata: {
|
|
@@ -1250,7 +1360,7 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1250
1360
|
new TransformStream({
|
|
1251
1361
|
transform(chunk, controller) {
|
|
1252
1362
|
if (time_to_first_token === void 0) {
|
|
1253
|
-
time_to_first_token =
|
|
1363
|
+
time_to_first_token = _chunkGSIDVFE6js.getCurrentUnixTimestamp.call(void 0, ) - startTime;
|
|
1254
1364
|
span.log({ metrics: { time_to_first_token } });
|
|
1255
1365
|
}
|
|
1256
1366
|
switch (chunk.type) {
|
|
@@ -1295,11 +1405,11 @@ var BraintrustLanguageModelWrapper = class {
|
|
|
1295
1405
|
),
|
|
1296
1406
|
metrics: {
|
|
1297
1407
|
time_to_first_token,
|
|
1298
|
-
tokens: !
|
|
1299
|
-
prompt_tokens: _optionalChain([usage, 'optionalAccess',
|
|
1300
|
-
completion_tokens: _optionalChain([usage, 'optionalAccess',
|
|
1301
|
-
cached:
|
|
1302
|
-
_nullishCoalesce(_optionalChain([ret, 'access',
|
|
1408
|
+
tokens: !_chunkGSIDVFE6js.isEmpty.call(void 0, usage) ? usage.promptTokens + usage.completionTokens : void 0,
|
|
1409
|
+
prompt_tokens: _optionalChain([usage, 'optionalAccess', _36 => _36.promptTokens]),
|
|
1410
|
+
completion_tokens: _optionalChain([usage, 'optionalAccess', _37 => _37.completionTokens]),
|
|
1411
|
+
cached: _chunkGSIDVFE6js.parseCachedHeader.call(void 0,
|
|
1412
|
+
_nullishCoalesce(_optionalChain([ret, 'access', _38 => _38.rawResponse, 'optionalAccess', _39 => _39.headers, 'optionalAccess', _40 => _40[_chunkGSIDVFE6js.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _41 => _41.rawResponse, 'optionalAccess', _42 => _42.headers, 'optionalAccess', _43 => _43[_chunkGSIDVFE6js.LEGACY_CACHED_HEADER]])))
|
|
1303
1413
|
)
|
|
1304
1414
|
}
|
|
1305
1415
|
});
|
|
@@ -1343,7 +1453,7 @@ function postProcessPrompt(prompt) {
|
|
|
1343
1453
|
return [
|
|
1344
1454
|
{
|
|
1345
1455
|
role: "assistant",
|
|
1346
|
-
content: _optionalChain([textPart, 'optionalAccess',
|
|
1456
|
+
content: _optionalChain([textPart, 'optionalAccess', _44 => _44.text]),
|
|
1347
1457
|
...toolCallParts.length > 0 ? {
|
|
1348
1458
|
tool_calls: toolCallParts.map((part) => ({
|
|
1349
1459
|
id: part.toolCallId,
|
|
@@ -1416,23 +1526,23 @@ function postProcessOutput(text, toolCalls2, finishReason) {
|
|
|
1416
1526
|
|
|
1417
1527
|
// src/wrappers/ai-sdk/deprecated/BraintrustMiddleware.ts
|
|
1418
1528
|
function detectProviderFromResult(result) {
|
|
1419
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
1529
|
+
if (!_optionalChain([result, 'optionalAccess', _45 => _45.providerMetadata])) {
|
|
1420
1530
|
return void 0;
|
|
1421
1531
|
}
|
|
1422
1532
|
const keys = Object.keys(result.providerMetadata);
|
|
1423
|
-
return _optionalChain([keys, 'optionalAccess',
|
|
1533
|
+
return _optionalChain([keys, 'optionalAccess', _46 => _46.at, 'call', _47 => _47(0)]);
|
|
1424
1534
|
}
|
|
1425
1535
|
function extractModelFromResult(result) {
|
|
1426
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
1536
|
+
if (_optionalChain([result, 'optionalAccess', _48 => _48.response, 'optionalAccess', _49 => _49.modelId])) {
|
|
1427
1537
|
return result.response.modelId;
|
|
1428
1538
|
}
|
|
1429
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
1539
|
+
if (_optionalChain([result, 'optionalAccess', _50 => _50.request, 'optionalAccess', _51 => _51.body, 'optionalAccess', _52 => _52.model])) {
|
|
1430
1540
|
return result.request.body.model;
|
|
1431
1541
|
}
|
|
1432
1542
|
return void 0;
|
|
1433
1543
|
}
|
|
1434
1544
|
function extractModelFromWrapGenerateCallback(model) {
|
|
1435
|
-
return _optionalChain([model, 'optionalAccess',
|
|
1545
|
+
return _optionalChain([model, 'optionalAccess', _53 => _53.modelId]);
|
|
1436
1546
|
}
|
|
1437
1547
|
function camelToSnake(str) {
|
|
1438
1548
|
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
@@ -1477,19 +1587,19 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
|
|
|
1477
1587
|
metrics.prompt_cached_tokens = cachedInputTokens;
|
|
1478
1588
|
}
|
|
1479
1589
|
if (provider === "anthropic") {
|
|
1480
|
-
const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess',
|
|
1590
|
+
const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess', _54 => _54.anthropic]);
|
|
1481
1591
|
if (anthropicMetadata) {
|
|
1482
1592
|
const cacheReadTokens = getNumberProperty(anthropicMetadata.usage, "cache_read_input_tokens") || 0;
|
|
1483
1593
|
const cacheCreationTokens = getNumberProperty(
|
|
1484
1594
|
anthropicMetadata.usage,
|
|
1485
1595
|
"cache_creation_input_tokens"
|
|
1486
1596
|
) || 0;
|
|
1487
|
-
const cacheTokens =
|
|
1597
|
+
const cacheTokens = _chunkGSIDVFE6js.extractAnthropicCacheTokens.call(void 0,
|
|
1488
1598
|
cacheReadTokens,
|
|
1489
1599
|
cacheCreationTokens
|
|
1490
1600
|
);
|
|
1491
1601
|
Object.assign(metrics, cacheTokens);
|
|
1492
|
-
Object.assign(metrics,
|
|
1602
|
+
Object.assign(metrics, _chunkGSIDVFE6js.finalizeAnthropicTokens.call(void 0, metrics));
|
|
1493
1603
|
}
|
|
1494
1604
|
}
|
|
1495
1605
|
return metrics;
|
|
@@ -1503,7 +1613,7 @@ function buildAssistantOutputWithToolCalls(result, toolCalls2) {
|
|
|
1503
1613
|
{
|
|
1504
1614
|
index: 0,
|
|
1505
1615
|
logprobs: null,
|
|
1506
|
-
finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess',
|
|
1616
|
+
finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess', _55 => _55.finishReason])), () => ( (toolCalls2.length ? "tool_calls" : void 0))),
|
|
1507
1617
|
message: {
|
|
1508
1618
|
role: "assistant",
|
|
1509
1619
|
tool_calls: toolCalls2.length > 0 ? toolCalls2 : void 0
|
|
@@ -1516,7 +1626,7 @@ function extractToolCallsFromSteps(steps) {
|
|
|
1516
1626
|
if (!Array.isArray(steps)) return toolCalls2;
|
|
1517
1627
|
let idx = 0;
|
|
1518
1628
|
for (const step of steps) {
|
|
1519
|
-
const blocks = _optionalChain([step, 'optionalAccess',
|
|
1629
|
+
const blocks = _optionalChain([step, 'optionalAccess', _56 => _56.content]);
|
|
1520
1630
|
if (!Array.isArray(blocks)) continue;
|
|
1521
1631
|
for (const block of blocks) {
|
|
1522
1632
|
if (block && typeof block === "object" && block.type === "tool-call") {
|
|
@@ -1539,7 +1649,7 @@ function extractToolCallsFromBlocks(blocks) {
|
|
|
1539
1649
|
return extractToolCallsFromSteps([{ content: blocks }]);
|
|
1540
1650
|
}
|
|
1541
1651
|
function extractInput(params) {
|
|
1542
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
1652
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _57 => _57.prompt]), () => ( _optionalChain([params, 'optionalAccess', _58 => _58.messages]))), () => ( _optionalChain([params, 'optionalAccess', _59 => _59.system])));
|
|
1543
1653
|
}
|
|
1544
1654
|
var V2_EXCLUDE_KEYS = /* @__PURE__ */ new Set([
|
|
1545
1655
|
"prompt",
|
|
@@ -1561,22 +1671,24 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1561
1671
|
model: modelFromWrapGenerate
|
|
1562
1672
|
}) => {
|
|
1563
1673
|
const rawInput = extractInput(params);
|
|
1564
|
-
const processedInput =
|
|
1674
|
+
const processedInput = _chunkGSIDVFE6js.processInputAttachments.call(void 0, rawInput);
|
|
1565
1675
|
const spanArgs = {
|
|
1566
|
-
name: _optionalChain([config, 'access',
|
|
1676
|
+
name: _optionalChain([config, 'access', _60 => _60.spanInfo, 'optionalAccess', _61 => _61.name]) || "ai-sdk.doGenerate",
|
|
1567
1677
|
spanAttributes: {
|
|
1568
1678
|
type: "llm" /* LLM */,
|
|
1569
|
-
..._optionalChain([config, 'access',
|
|
1679
|
+
..._optionalChain([config, 'access', _62 => _62.spanInfo, 'optionalAccess', _63 => _63.spanAttributes]) || {}
|
|
1570
1680
|
},
|
|
1571
1681
|
event: {
|
|
1572
1682
|
input: processedInput,
|
|
1573
1683
|
metadata: {
|
|
1574
1684
|
...extractModelParameters(params, V2_EXCLUDE_KEYS),
|
|
1575
|
-
..._optionalChain([config, 'access',
|
|
1685
|
+
..._optionalChain([config, 'access', _64 => _64.spanInfo, 'optionalAccess', _65 => _65.metadata]) || {}
|
|
1576
1686
|
}
|
|
1577
1687
|
}
|
|
1578
1688
|
};
|
|
1579
|
-
const span =
|
|
1689
|
+
const span = _chunkGSIDVFE6js.startSpan.call(void 0,
|
|
1690
|
+
_chunkP25IOOU4js.withSpanInstrumentationName.call(void 0, spanArgs, _chunkP25IOOU4js.INSTRUMENTATION_NAMES.AI_SDK)
|
|
1691
|
+
);
|
|
1580
1692
|
try {
|
|
1581
1693
|
const result = await doGenerate();
|
|
1582
1694
|
const metadata = {};
|
|
@@ -1598,12 +1710,12 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1598
1710
|
metadata.model = modelId;
|
|
1599
1711
|
}
|
|
1600
1712
|
}
|
|
1601
|
-
let toolCalls2 = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess',
|
|
1713
|
+
let toolCalls2 = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess', _66 => _66.steps]));
|
|
1602
1714
|
if (!toolCalls2 || toolCalls2.length === 0) {
|
|
1603
|
-
toolCalls2 = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess',
|
|
1715
|
+
toolCalls2 = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess', _67 => _67.content]));
|
|
1604
1716
|
}
|
|
1605
1717
|
span.log({
|
|
1606
|
-
output: toolCalls2.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls2) : _optionalChain([result, 'optionalAccess',
|
|
1718
|
+
output: toolCalls2.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls2) : _optionalChain([result, 'optionalAccess', _68 => _68.content]),
|
|
1607
1719
|
metadata,
|
|
1608
1720
|
metrics: normalizeUsageMetrics(
|
|
1609
1721
|
result.usage,
|
|
@@ -1623,22 +1735,24 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1623
1735
|
},
|
|
1624
1736
|
wrapStream: async ({ doStream, params }) => {
|
|
1625
1737
|
const rawInput = extractInput(params);
|
|
1626
|
-
const processedInput =
|
|
1738
|
+
const processedInput = _chunkGSIDVFE6js.processInputAttachments.call(void 0, rawInput);
|
|
1627
1739
|
const spanArgs = {
|
|
1628
|
-
name: _optionalChain([config, 'access',
|
|
1740
|
+
name: _optionalChain([config, 'access', _69 => _69.spanInfo, 'optionalAccess', _70 => _70.name]) || "ai-sdk.doStream",
|
|
1629
1741
|
spanAttributes: {
|
|
1630
1742
|
type: "llm" /* LLM */,
|
|
1631
|
-
..._optionalChain([config, 'access',
|
|
1743
|
+
..._optionalChain([config, 'access', _71 => _71.spanInfo, 'optionalAccess', _72 => _72.spanAttributes]) || {}
|
|
1632
1744
|
},
|
|
1633
1745
|
event: {
|
|
1634
1746
|
input: processedInput,
|
|
1635
1747
|
metadata: {
|
|
1636
1748
|
...extractModelParameters(params, V2_EXCLUDE_KEYS),
|
|
1637
|
-
..._optionalChain([config, 'access',
|
|
1749
|
+
..._optionalChain([config, 'access', _73 => _73.spanInfo, 'optionalAccess', _74 => _74.metadata]) || {}
|
|
1638
1750
|
}
|
|
1639
1751
|
}
|
|
1640
1752
|
};
|
|
1641
|
-
const span =
|
|
1753
|
+
const span = _chunkGSIDVFE6js.startSpan.call(void 0,
|
|
1754
|
+
_chunkP25IOOU4js.withSpanInstrumentationName.call(void 0, spanArgs, _chunkP25IOOU4js.INSTRUMENTATION_NAMES.AI_SDK)
|
|
1755
|
+
);
|
|
1642
1756
|
try {
|
|
1643
1757
|
const { stream, ...rest } = await doStream();
|
|
1644
1758
|
const textChunks = [];
|
|
@@ -1740,6 +1854,7 @@ function BraintrustMiddleware(config = {}) {
|
|
|
1740
1854
|
var EVE_TRACE_STATE_KEY = "braintrust.eve.tracing";
|
|
1741
1855
|
var MAX_EVE_CACHE_ENTRIES = 1e4;
|
|
1742
1856
|
var MAX_STORED_LLM_INPUTS = 100;
|
|
1857
|
+
var MAX_STORED_REASONING_BLOCKS = 100;
|
|
1743
1858
|
var MAX_STORED_SPAN_REFERENCES = 1e4;
|
|
1744
1859
|
var MAX_STORED_STEP_STARTS = 1e4;
|
|
1745
1860
|
function braintrustEveHook(options) {
|
|
@@ -1761,7 +1876,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1761
1876
|
try {
|
|
1762
1877
|
captureEveModelInput(state, input);
|
|
1763
1878
|
} catch (error) {
|
|
1764
|
-
|
|
1879
|
+
_chunkGSIDVFE6js.debugLogger.warn("Error in Eve LLM input capture:", error);
|
|
1765
1880
|
}
|
|
1766
1881
|
}
|
|
1767
1882
|
},
|
|
@@ -1771,7 +1886,7 @@ function braintrustEveInstrumentation(options) {
|
|
|
1771
1886
|
};
|
|
1772
1887
|
}
|
|
1773
1888
|
function isEveHandleMessageStreamEvent(event) {
|
|
1774
|
-
return
|
|
1889
|
+
return _chunkGSIDVFE6js.isObject.call(void 0, event) && typeof event["type"] === "string";
|
|
1775
1890
|
}
|
|
1776
1891
|
var ResumedEveSpan = class {
|
|
1777
1892
|
constructor(reference) {
|
|
@@ -1779,6 +1894,7 @@ var ResumedEveSpan = class {
|
|
|
1779
1894
|
this.endTime = reference.endTime;
|
|
1780
1895
|
}
|
|
1781
1896
|
|
|
1897
|
+
|
|
1782
1898
|
get rootSpanId() {
|
|
1783
1899
|
return this.reference.rootSpanId;
|
|
1784
1900
|
}
|
|
@@ -1787,11 +1903,11 @@ var ResumedEveSpan = class {
|
|
|
1787
1903
|
}
|
|
1788
1904
|
log(event) {
|
|
1789
1905
|
const metrics = {
|
|
1790
|
-
..._optionalChain([this, 'access',
|
|
1906
|
+
..._optionalChain([this, 'access', _75 => _75.reference, 'access', _76 => _76.startEvent, 'optionalAccess', _77 => _77.metrics]),
|
|
1791
1907
|
...this.endTime === void 0 ? {} : { end: this.endTime },
|
|
1792
1908
|
...event.metrics
|
|
1793
1909
|
};
|
|
1794
|
-
|
|
1910
|
+
_chunkGSIDVFE6js.updateSpan.call(void 0, {
|
|
1795
1911
|
exported: this.reference.exported,
|
|
1796
1912
|
...this.reference.startEvent,
|
|
1797
1913
|
...event,
|
|
@@ -1800,7 +1916,7 @@ var ResumedEveSpan = class {
|
|
|
1800
1916
|
}
|
|
1801
1917
|
end(args) {
|
|
1802
1918
|
if (this.endTime === void 0) {
|
|
1803
|
-
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess',
|
|
1919
|
+
this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _78 => _78.endTime]), () => ( _chunkGSIDVFE6js.getCurrentUnixTimestamp.call(void 0, )));
|
|
1804
1920
|
this.log({ metrics: { end: this.endTime } });
|
|
1805
1921
|
}
|
|
1806
1922
|
return this.endTime;
|
|
@@ -1810,39 +1926,45 @@ var EveBridge = (_class = class {
|
|
|
1810
1926
|
constructor(state) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);
|
|
1811
1927
|
this.state = state;
|
|
1812
1928
|
}
|
|
1929
|
+
|
|
1813
1930
|
__init() {this.eventQueuesBySession = /* @__PURE__ */ new Map()}
|
|
1814
|
-
__init2() {this.completedToolKeys = new (0,
|
|
1931
|
+
__init2() {this.completedToolKeys = new (0, _chunkGSIDVFE6js.LRUCache)({
|
|
1815
1932
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1816
1933
|
})}
|
|
1817
|
-
__init3() {this.toolsByCallKey = new (0,
|
|
1934
|
+
__init3() {this.toolsByCallKey = new (0, _chunkGSIDVFE6js.LRUCache)({
|
|
1818
1935
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1819
1936
|
})}
|
|
1820
|
-
__init4() {this.turnsByKey = new (0,
|
|
1937
|
+
__init4() {this.turnsByKey = new (0, _chunkGSIDVFE6js.LRUCache)({
|
|
1821
1938
|
max: MAX_EVE_CACHE_ENTRIES
|
|
1822
1939
|
})}
|
|
1823
1940
|
async startEveSpan(args) {
|
|
1824
|
-
const rowId = _optionalChain([args, 'optionalAccess',
|
|
1941
|
+
const rowId = _optionalChain([args, 'optionalAccess', _79 => _79.event, 'optionalAccess', _80 => _80.id]);
|
|
1825
1942
|
const reference = typeof rowId === "string" && readEveTraceState(this.state).spanReferences.find(
|
|
1826
1943
|
(candidate) => candidate.rowId === rowId
|
|
1827
1944
|
);
|
|
1828
1945
|
if (reference) {
|
|
1829
1946
|
return new ResumedEveSpan(reference);
|
|
1830
1947
|
}
|
|
1831
|
-
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess',
|
|
1832
|
-
const parentSpanIds = _optionalChain([args, 'optionalAccess',
|
|
1948
|
+
const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _81 => _81.startTime]), () => ( _chunkGSIDVFE6js.getCurrentUnixTimestamp.call(void 0, )));
|
|
1949
|
+
const parentSpanIds = _optionalChain([args, 'optionalAccess', _82 => _82.parentSpanIds]);
|
|
1833
1950
|
const startEvent = {
|
|
1834
1951
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1835
1952
|
metrics: { start: startTime },
|
|
1836
1953
|
span_attributes: {
|
|
1837
|
-
..._optionalChain([args, 'optionalAccess',
|
|
1838
|
-
..._optionalChain([args, 'optionalAccess',
|
|
1839
|
-
..._optionalChain([args, 'optionalAccess',
|
|
1954
|
+
..._optionalChain([args, 'optionalAccess', _83 => _83.name]) ? { name: args.name } : {},
|
|
1955
|
+
..._optionalChain([args, 'optionalAccess', _84 => _84.type]) ? { type: args.type } : {},
|
|
1956
|
+
..._optionalChain([args, 'optionalAccess', _85 => _85.spanAttributes])
|
|
1840
1957
|
},
|
|
1841
1958
|
span_parents: parentSpanIds ? "spanId" in parentSpanIds ? [parentSpanIds.spanId] : parentSpanIds.parentSpanIds : []
|
|
1842
1959
|
};
|
|
1843
|
-
const span =
|
|
1844
|
-
|
|
1845
|
-
() =>
|
|
1960
|
+
const span = _chunkGSIDVFE6js.withCurrent.call(void 0,
|
|
1961
|
+
_chunkGSIDVFE6js.NOOP_SPAN,
|
|
1962
|
+
() => _chunkGSIDVFE6js._internalStartSpanWithInitialMerge.call(void 0,
|
|
1963
|
+
_chunkP25IOOU4js.withSpanInstrumentationName.call(void 0,
|
|
1964
|
+
{ ...args, startTime },
|
|
1965
|
+
_chunkP25IOOU4js.INSTRUMENTATION_NAMES.EVE
|
|
1966
|
+
)
|
|
1967
|
+
)
|
|
1846
1968
|
);
|
|
1847
1969
|
if (typeof rowId !== "string") {
|
|
1848
1970
|
return span;
|
|
@@ -1868,7 +1990,7 @@ var EveBridge = (_class = class {
|
|
|
1868
1990
|
};
|
|
1869
1991
|
});
|
|
1870
1992
|
} catch (error) {
|
|
1871
|
-
|
|
1993
|
+
_chunkGSIDVFE6js.debugLogger.warn("Error exporting Eve span for resumption:", error);
|
|
1872
1994
|
}
|
|
1873
1995
|
return span;
|
|
1874
1996
|
}
|
|
@@ -1888,7 +2010,7 @@ var EveBridge = (_class = class {
|
|
|
1888
2010
|
const previous = state.stepStarts.filter(
|
|
1889
2011
|
(entry) => entry.turnId === event.data.turnId && entry.stepIndex === event.data.stepIndex
|
|
1890
2012
|
).at(-1);
|
|
1891
|
-
if (_optionalChain([previous, 'optionalAccess',
|
|
2013
|
+
if (_optionalChain([previous, 'optionalAccess', _86 => _86.open])) {
|
|
1892
2014
|
ordinal = previous.ordinal;
|
|
1893
2015
|
return state;
|
|
1894
2016
|
}
|
|
@@ -1916,12 +2038,12 @@ var EveBridge = (_class = class {
|
|
|
1916
2038
|
let index = -1;
|
|
1917
2039
|
for (let i = state.stepStarts.length - 1; i >= 0; i--) {
|
|
1918
2040
|
const entry = state.stepStarts[i];
|
|
1919
|
-
if (_optionalChain([entry, 'optionalAccess',
|
|
2041
|
+
if (_optionalChain([entry, 'optionalAccess', _87 => _87.turnId]) === turnId && entry.stepIndex === stepIndex) {
|
|
1920
2042
|
index = i;
|
|
1921
2043
|
break;
|
|
1922
2044
|
}
|
|
1923
2045
|
}
|
|
1924
|
-
if (index < 0 || !_optionalChain([state, 'access',
|
|
2046
|
+
if (index < 0 || !_optionalChain([state, 'access', _88 => _88.stepStarts, 'access', _89 => _89[index], 'optionalAccess', _90 => _90.open])) {
|
|
1925
2047
|
return state;
|
|
1926
2048
|
}
|
|
1927
2049
|
return {
|
|
@@ -1955,7 +2077,7 @@ var EveBridge = (_class = class {
|
|
|
1955
2077
|
}
|
|
1956
2078
|
}
|
|
1957
2079
|
} catch (error) {
|
|
1958
|
-
|
|
2080
|
+
_chunkGSIDVFE6js.debugLogger.warn("Error in Eve hook instrumentation:", error);
|
|
1959
2081
|
}
|
|
1960
2082
|
};
|
|
1961
2083
|
const sessionId = event.type === "session.failed" ? event.data.sessionId || sessionIdFromContext(ctx) : sessionIdFromContext(ctx);
|
|
@@ -1988,6 +2110,9 @@ var EveBridge = (_class = class {
|
|
|
1988
2110
|
case "step.started":
|
|
1989
2111
|
await this.handleStepStarted(event, ctx, hookMetadata);
|
|
1990
2112
|
return true;
|
|
2113
|
+
case "reasoning.completed":
|
|
2114
|
+
this.handleReasoningCompleted(event, ctx);
|
|
2115
|
+
return true;
|
|
1991
2116
|
case "message.completed":
|
|
1992
2117
|
this.handleMessageCompleted(event, ctx);
|
|
1993
2118
|
return true;
|
|
@@ -2079,6 +2204,7 @@ var EveBridge = (_class = class {
|
|
|
2079
2204
|
key,
|
|
2080
2205
|
metadata,
|
|
2081
2206
|
metrics: {},
|
|
2207
|
+
sessionId,
|
|
2082
2208
|
span,
|
|
2083
2209
|
stepsByIndex: /* @__PURE__ */ new Map(),
|
|
2084
2210
|
turnId: event.data.turnId
|
|
@@ -2109,6 +2235,12 @@ var EveBridge = (_class = class {
|
|
|
2109
2235
|
const endTime = eventTime(event);
|
|
2110
2236
|
existing.span.end(endTime === void 0 ? void 0 : { endTime });
|
|
2111
2237
|
this.markStepEnded(event.data.turnId, event.data.stepIndex);
|
|
2238
|
+
clearStoredEveReasoning(
|
|
2239
|
+
this.state,
|
|
2240
|
+
sessionId,
|
|
2241
|
+
event.data.turnId,
|
|
2242
|
+
event.data.stepIndex
|
|
2243
|
+
);
|
|
2112
2244
|
}
|
|
2113
2245
|
const stepOrdinal = this.stepOrdinal(event);
|
|
2114
2246
|
const metadata = { ...turn.metadata };
|
|
@@ -2118,6 +2250,13 @@ var EveBridge = (_class = class {
|
|
|
2118
2250
|
event.data.turnId,
|
|
2119
2251
|
event.data.stepIndex
|
|
2120
2252
|
);
|
|
2253
|
+
const reasoning = readStoredEveReasoning(
|
|
2254
|
+
this.state,
|
|
2255
|
+
sessionId,
|
|
2256
|
+
event.data.turnId,
|
|
2257
|
+
event.data.stepIndex
|
|
2258
|
+
);
|
|
2259
|
+
const output = mergeEveReasoning(void 0, reasoning);
|
|
2121
2260
|
const { rowId: eventId, spanId } = await generateEveIds(
|
|
2122
2261
|
"step",
|
|
2123
2262
|
sessionId,
|
|
@@ -2135,32 +2274,52 @@ var EveBridge = (_class = class {
|
|
|
2135
2274
|
spanId,
|
|
2136
2275
|
startTime: eventTime(event)
|
|
2137
2276
|
});
|
|
2138
|
-
span.log({
|
|
2277
|
+
span.log({
|
|
2278
|
+
...input !== void 0 ? { input } : {},
|
|
2279
|
+
metadata
|
|
2280
|
+
});
|
|
2139
2281
|
turn.stepsByIndex.set(event.data.stepIndex, {
|
|
2140
2282
|
...input !== void 0 ? { input } : {},
|
|
2141
2283
|
metadata,
|
|
2142
2284
|
metrics: {},
|
|
2285
|
+
...output !== void 0 ? { output } : {},
|
|
2286
|
+
reasoning,
|
|
2143
2287
|
span
|
|
2144
2288
|
});
|
|
2145
2289
|
}
|
|
2290
|
+
handleReasoningCompleted(event, ctx) {
|
|
2291
|
+
const sessionId = sessionIdFromContext(ctx);
|
|
2292
|
+
if (!sessionId) {
|
|
2293
|
+
return;
|
|
2294
|
+
}
|
|
2295
|
+
const reasoning = storeEveReasoning(this.state, sessionId, event);
|
|
2296
|
+
const step = this.stepForEvent(event, ctx);
|
|
2297
|
+
if (step) {
|
|
2298
|
+
step.reasoning = reasoning;
|
|
2299
|
+
step.output = mergeEveReasoning(step.output, reasoning);
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2146
2302
|
handleMessageCompleted(event, ctx) {
|
|
2147
2303
|
const step = this.stepForEvent(event, ctx);
|
|
2148
2304
|
if (!step) {
|
|
2149
2305
|
return;
|
|
2150
2306
|
}
|
|
2151
|
-
const existingMessage =
|
|
2152
|
-
const existingToolCalls =
|
|
2153
|
-
step.output =
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2307
|
+
const existingMessage = eveOutputMessage(step.output);
|
|
2308
|
+
const existingToolCalls = _chunkGSIDVFE6js.isObject.call(void 0, existingMessage) ? existingMessage.tool_calls : void 0;
|
|
2309
|
+
step.output = mergeEveReasoning(
|
|
2310
|
+
[
|
|
2311
|
+
{
|
|
2312
|
+
finish_reason: normalizedFinishReason(event.data.finishReason),
|
|
2313
|
+
index: 0,
|
|
2314
|
+
message: {
|
|
2315
|
+
content: event.data.message,
|
|
2316
|
+
role: "assistant",
|
|
2317
|
+
...Array.isArray(existingToolCalls) ? { tool_calls: existingToolCalls } : {}
|
|
2318
|
+
}
|
|
2161
2319
|
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2320
|
+
],
|
|
2321
|
+
step.reasoning
|
|
2322
|
+
);
|
|
2164
2323
|
const turn = this.turnForEvent(event, ctx);
|
|
2165
2324
|
if (turn && event.data.finishReason !== "tool-calls") {
|
|
2166
2325
|
turn.output = event.data.message;
|
|
@@ -2169,16 +2328,19 @@ var EveBridge = (_class = class {
|
|
|
2169
2328
|
handleResultCompleted(event, ctx) {
|
|
2170
2329
|
const step = this.stepForEvent(event, ctx);
|
|
2171
2330
|
if (step) {
|
|
2172
|
-
step.output =
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2331
|
+
step.output = mergeEveReasoning(
|
|
2332
|
+
[
|
|
2333
|
+
{
|
|
2334
|
+
finish_reason: "stop",
|
|
2335
|
+
index: 0,
|
|
2336
|
+
message: {
|
|
2337
|
+
content: event.data.result,
|
|
2338
|
+
role: "assistant"
|
|
2339
|
+
}
|
|
2179
2340
|
}
|
|
2180
|
-
|
|
2181
|
-
|
|
2341
|
+
],
|
|
2342
|
+
step.reasoning
|
|
2343
|
+
);
|
|
2182
2344
|
}
|
|
2183
2345
|
const turn = this.turnForEvent(event, ctx);
|
|
2184
2346
|
if (turn) {
|
|
@@ -2207,11 +2369,11 @@ var EveBridge = (_class = class {
|
|
|
2207
2369
|
return;
|
|
2208
2370
|
}
|
|
2209
2371
|
const toolCallsById = /* @__PURE__ */ new Map();
|
|
2210
|
-
if (Array.isArray(step.output) &&
|
|
2372
|
+
if (Array.isArray(step.output) && _chunkGSIDVFE6js.isObject.call(void 0, step.output[0])) {
|
|
2211
2373
|
const message = step.output[0]["message"];
|
|
2212
|
-
if (
|
|
2374
|
+
if (_chunkGSIDVFE6js.isObject.call(void 0, message) && Array.isArray(message["tool_calls"])) {
|
|
2213
2375
|
for (const toolCall of message["tool_calls"]) {
|
|
2214
|
-
if (
|
|
2376
|
+
if (_chunkGSIDVFE6js.isObject.call(void 0, toolCall) && typeof toolCall["id"] === "string") {
|
|
2215
2377
|
toolCallsById.set(toolCall["id"], toolCall);
|
|
2216
2378
|
}
|
|
2217
2379
|
}
|
|
@@ -2228,18 +2390,20 @@ var EveBridge = (_class = class {
|
|
|
2228
2390
|
type: "function"
|
|
2229
2391
|
});
|
|
2230
2392
|
}
|
|
2231
|
-
step.output =
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2393
|
+
step.output = mergeEveReasoning(
|
|
2394
|
+
[
|
|
2395
|
+
{
|
|
2396
|
+
finish_reason: "tool_calls",
|
|
2397
|
+
index: 0,
|
|
2398
|
+
message: {
|
|
2399
|
+
content: null,
|
|
2400
|
+
role: "assistant",
|
|
2401
|
+
tool_calls: [...toolCallsById.values()]
|
|
2402
|
+
}
|
|
2239
2403
|
}
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2404
|
+
],
|
|
2405
|
+
step.reasoning
|
|
2406
|
+
);
|
|
2243
2407
|
}
|
|
2244
2408
|
async handleActionResult(event, ctx, hookMetadata) {
|
|
2245
2409
|
if (isToolResult(event.data.result)) {
|
|
@@ -2282,7 +2446,7 @@ var EveBridge = (_class = class {
|
|
|
2282
2446
|
this.completedToolKeys.set(key, true);
|
|
2283
2447
|
}
|
|
2284
2448
|
async handleSubagentCalled(event, ctx, hookMetadata) {
|
|
2285
|
-
if (_optionalChain([event, 'access',
|
|
2449
|
+
if (_optionalChain([event, 'access', _91 => _91.data, 'access', _92 => _92.remote, 'optionalAccess', _93 => _93.url])) {
|
|
2286
2450
|
return;
|
|
2287
2451
|
}
|
|
2288
2452
|
const turn = await this.ensureTurn(event, ctx, hookMetadata);
|
|
@@ -2402,11 +2566,11 @@ var EveBridge = (_class = class {
|
|
|
2402
2566
|
return;
|
|
2403
2567
|
}
|
|
2404
2568
|
const usage = event.data.usage;
|
|
2405
|
-
const inputTokens = typeof _optionalChain([usage, 'optionalAccess',
|
|
2406
|
-
const outputTokens = typeof _optionalChain([usage, 'optionalAccess',
|
|
2407
|
-
const cacheReadTokens = typeof _optionalChain([usage, 'optionalAccess',
|
|
2408
|
-
const cacheWriteTokens = typeof _optionalChain([usage, 'optionalAccess',
|
|
2409
|
-
const costUsd = typeof _optionalChain([usage, 'optionalAccess',
|
|
2569
|
+
const inputTokens = typeof _optionalChain([usage, 'optionalAccess', _94 => _94.inputTokens]) === "number" && Number.isFinite(usage.inputTokens) && usage.inputTokens >= 0 ? usage.inputTokens : void 0;
|
|
2570
|
+
const outputTokens = typeof _optionalChain([usage, 'optionalAccess', _95 => _95.outputTokens]) === "number" && Number.isFinite(usage.outputTokens) && usage.outputTokens >= 0 ? usage.outputTokens : void 0;
|
|
2571
|
+
const cacheReadTokens = typeof _optionalChain([usage, 'optionalAccess', _96 => _96.cacheReadTokens]) === "number" && Number.isFinite(usage.cacheReadTokens) && usage.cacheReadTokens >= 0 ? usage.cacheReadTokens : void 0;
|
|
2572
|
+
const cacheWriteTokens = typeof _optionalChain([usage, 'optionalAccess', _97 => _97.cacheWriteTokens]) === "number" && Number.isFinite(usage.cacheWriteTokens) && usage.cacheWriteTokens >= 0 ? usage.cacheWriteTokens : void 0;
|
|
2573
|
+
const costUsd = typeof _optionalChain([usage, 'optionalAccess', _98 => _98.costUsd]) === "number" && Number.isFinite(usage.costUsd) && usage.costUsd >= 0 ? usage.costUsd : void 0;
|
|
2410
2574
|
const total = inputTokens !== void 0 && outputTokens !== void 0 ? inputTokens + outputTokens : void 0;
|
|
2411
2575
|
const metrics = {
|
|
2412
2576
|
...inputTokens !== void 0 ? { prompt_tokens: inputTokens } : {},
|
|
@@ -2417,7 +2581,8 @@ var EveBridge = (_class = class {
|
|
|
2417
2581
|
...costUsd !== void 0 ? { estimated_cost: costUsd } : {}
|
|
2418
2582
|
};
|
|
2419
2583
|
step.metrics = { ...step.metrics, ...metrics };
|
|
2420
|
-
|
|
2584
|
+
const sessionId = sessionIdFromContext(ctx);
|
|
2585
|
+
if (Array.isArray(step.output) && _chunkGSIDVFE6js.isObject.call(void 0, step.output[0])) {
|
|
2421
2586
|
const finishReason = step.output[0].finish_reason;
|
|
2422
2587
|
if (typeof finishReason !== "string") {
|
|
2423
2588
|
step.output[0].finish_reason = normalizedFinishReason(
|
|
@@ -2441,6 +2606,14 @@ var EveBridge = (_class = class {
|
|
|
2441
2606
|
turn.stepsByIndex.delete(event.data.stepIndex);
|
|
2442
2607
|
}
|
|
2443
2608
|
this.markStepEnded(event.data.turnId, event.data.stepIndex);
|
|
2609
|
+
if (sessionId) {
|
|
2610
|
+
clearStoredEveReasoning(
|
|
2611
|
+
this.state,
|
|
2612
|
+
sessionId,
|
|
2613
|
+
event.data.turnId,
|
|
2614
|
+
event.data.stepIndex
|
|
2615
|
+
);
|
|
2616
|
+
}
|
|
2444
2617
|
}
|
|
2445
2618
|
handleStepFailed(event, ctx) {
|
|
2446
2619
|
const step = this.stepForEvent(event, ctx);
|
|
@@ -2456,8 +2629,17 @@ var EveBridge = (_class = class {
|
|
|
2456
2629
|
step.span.end(endTime === void 0 ? void 0 : { endTime });
|
|
2457
2630
|
}
|
|
2458
2631
|
const turn = this.turnForEvent(event, ctx);
|
|
2459
|
-
_optionalChain([turn, 'optionalAccess',
|
|
2632
|
+
_optionalChain([turn, 'optionalAccess', _99 => _99.stepsByIndex, 'access', _100 => _100.delete, 'call', _101 => _101(event.data.stepIndex)]);
|
|
2460
2633
|
this.markStepEnded(event.data.turnId, event.data.stepIndex);
|
|
2634
|
+
const sessionId = sessionIdFromContext(ctx);
|
|
2635
|
+
if (sessionId) {
|
|
2636
|
+
clearStoredEveReasoning(
|
|
2637
|
+
this.state,
|
|
2638
|
+
sessionId,
|
|
2639
|
+
event.data.turnId,
|
|
2640
|
+
event.data.stepIndex
|
|
2641
|
+
);
|
|
2642
|
+
}
|
|
2461
2643
|
}
|
|
2462
2644
|
handleTurnCompleted(event, ctx) {
|
|
2463
2645
|
const turn = this.turnForEvent(event, ctx);
|
|
@@ -2555,6 +2737,7 @@ var EveBridge = (_class = class {
|
|
|
2555
2737
|
key,
|
|
2556
2738
|
metadata,
|
|
2557
2739
|
metrics: {},
|
|
2740
|
+
sessionId,
|
|
2558
2741
|
span,
|
|
2559
2742
|
stepsByIndex: /* @__PURE__ */ new Map(),
|
|
2560
2743
|
turnId: event.data.turnId
|
|
@@ -2737,10 +2920,10 @@ var EveBridge = (_class = class {
|
|
|
2737
2920
|
return state;
|
|
2738
2921
|
}
|
|
2739
2922
|
async startTurnSpan(sessionId, event, ctx, metadata) {
|
|
2740
|
-
const session =
|
|
2741
|
-
const parent =
|
|
2742
|
-
const parentTurn =
|
|
2743
|
-
const parentLineage =
|
|
2923
|
+
const session = _chunkGSIDVFE6js.isObject.call(void 0, ctx) ? ctx["session"] : void 0;
|
|
2924
|
+
const parent = _chunkGSIDVFE6js.isObject.call(void 0, session) ? session["parent"] : void 0;
|
|
2925
|
+
const parentTurn = _chunkGSIDVFE6js.isObject.call(void 0, parent) ? parent["turn"] : void 0;
|
|
2926
|
+
const parentLineage = _chunkGSIDVFE6js.isObject.call(void 0, parent) && typeof parent["callId"] === "string" && typeof parent["sessionId"] === "string" && _chunkGSIDVFE6js.isObject.call(void 0, parentTurn) && typeof parentTurn["id"] === "string" ? {
|
|
2744
2927
|
callId: parent["callId"],
|
|
2745
2928
|
sessionId: parent["sessionId"],
|
|
2746
2929
|
turnId: parentTurn["id"]
|
|
@@ -2749,8 +2932,8 @@ var EveBridge = (_class = class {
|
|
|
2749
2932
|
generateEveIds("turn", sessionId, event.data.turnId),
|
|
2750
2933
|
deterministicEveId(
|
|
2751
2934
|
"eve:root",
|
|
2752
|
-
_nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess',
|
|
2753
|
-
_nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess',
|
|
2935
|
+
_nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess', _102 => _102.sessionId]), () => ( sessionId)),
|
|
2936
|
+
_nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess', _103 => _103.turnId]), () => ( event.data.turnId))
|
|
2754
2937
|
),
|
|
2755
2938
|
parentLineage ? deterministicEveId(
|
|
2756
2939
|
"eve:subagent",
|
|
@@ -2775,7 +2958,7 @@ var EveBridge = (_class = class {
|
|
|
2775
2958
|
return sessionId ? this.turnsByKey.get(turnKey(sessionId, event.data.turnId)) : void 0;
|
|
2776
2959
|
}
|
|
2777
2960
|
stepForEvent(event, ctx) {
|
|
2778
|
-
return _optionalChain([this, 'access',
|
|
2961
|
+
return _optionalChain([this, 'access', _104 => _104.turnForEvent, 'call', _105 => _105(event, ctx), 'optionalAccess', _106 => _106.stepsByIndex, 'access', _107 => _107.get, 'call', _108 => _108(
|
|
2779
2962
|
event.data.stepIndex
|
|
2780
2963
|
)]);
|
|
2781
2964
|
}
|
|
@@ -2817,6 +3000,9 @@ var EveBridge = (_class = class {
|
|
|
2817
3000
|
const normalized = normalizeEveTraceState(current);
|
|
2818
3001
|
return {
|
|
2819
3002
|
...normalized,
|
|
3003
|
+
reasoningBlocks: normalized.reasoningBlocks.filter(
|
|
3004
|
+
(entry) => !entry.key.startsWith(`${turn.sessionId}\0${turn.turnId}\0`)
|
|
3005
|
+
),
|
|
2820
3006
|
stepStarts: normalized.stepStarts.filter(
|
|
2821
3007
|
(entry) => entry.turnId !== turn.turnId
|
|
2822
3008
|
)
|
|
@@ -2844,10 +3030,10 @@ var EveBridge = (_class = class {
|
|
|
2844
3030
|
}
|
|
2845
3031
|
async flushInstrumentation() {
|
|
2846
3032
|
try {
|
|
2847
|
-
await
|
|
3033
|
+
await _chunkGSIDVFE6js.flush.call(void 0, );
|
|
2848
3034
|
return true;
|
|
2849
3035
|
} catch (error) {
|
|
2850
|
-
|
|
3036
|
+
_chunkGSIDVFE6js.debugLogger.warn("Error in Eve flush instrumentation:", error);
|
|
2851
3037
|
return false;
|
|
2852
3038
|
}
|
|
2853
3039
|
}
|
|
@@ -2856,17 +3042,18 @@ function emptyEveTraceState() {
|
|
|
2856
3042
|
return {
|
|
2857
3043
|
llmInputs: [],
|
|
2858
3044
|
metadata: {},
|
|
3045
|
+
reasoningBlocks: [],
|
|
2859
3046
|
spanReferences: [],
|
|
2860
3047
|
stepStarts: []
|
|
2861
3048
|
};
|
|
2862
3049
|
}
|
|
2863
3050
|
function normalizeEveTraceState(state) {
|
|
2864
|
-
if (!
|
|
3051
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, state)) {
|
|
2865
3052
|
return emptyEveTraceState();
|
|
2866
3053
|
}
|
|
2867
|
-
const metadata =
|
|
3054
|
+
const metadata = _chunkGSIDVFE6js.isObject.call(void 0, state["metadata"]) ? state["metadata"] : {};
|
|
2868
3055
|
const spanReferences = Array.isArray(state["spanReferences"]) ? state["spanReferences"].flatMap((entry) => {
|
|
2869
|
-
if (!
|
|
3056
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, entry)) {
|
|
2870
3057
|
return [];
|
|
2871
3058
|
}
|
|
2872
3059
|
const exported = entry["exported"];
|
|
@@ -2875,11 +3062,11 @@ function normalizeEveTraceState(state) {
|
|
|
2875
3062
|
const rowId = entry["rowId"];
|
|
2876
3063
|
const spanId = entry["spanId"];
|
|
2877
3064
|
const startEvent = entry["startEvent"];
|
|
2878
|
-
const startEventCreated =
|
|
2879
|
-
const startEventMetrics =
|
|
2880
|
-
const startEventSpanAttributes =
|
|
2881
|
-
const startEventSpanParents =
|
|
2882
|
-
const normalizedStartEvent = typeof startEventCreated === "string" &&
|
|
3065
|
+
const startEventCreated = _chunkGSIDVFE6js.isObject.call(void 0, startEvent) ? startEvent["created"] : void 0;
|
|
3066
|
+
const startEventMetrics = _chunkGSIDVFE6js.isObject.call(void 0, startEvent) ? startEvent["metrics"] : void 0;
|
|
3067
|
+
const startEventSpanAttributes = _chunkGSIDVFE6js.isObject.call(void 0, startEvent) ? startEvent["span_attributes"] : void 0;
|
|
3068
|
+
const startEventSpanParents = _chunkGSIDVFE6js.isObject.call(void 0, startEvent) ? startEvent["span_parents"] : void 0;
|
|
3069
|
+
const normalizedStartEvent = typeof startEventCreated === "string" && _chunkGSIDVFE6js.isObject.call(void 0, startEventMetrics) && typeof startEventMetrics["start"] === "number" && Number.isFinite(startEventMetrics["start"]) && _chunkGSIDVFE6js.isObject.call(void 0, startEventSpanAttributes) && Array.isArray(startEventSpanParents) && startEventSpanParents.every(
|
|
2883
3070
|
(parent) => typeof parent === "string"
|
|
2884
3071
|
) ? {
|
|
2885
3072
|
created: startEventCreated,
|
|
@@ -2899,15 +3086,30 @@ function normalizeEveTraceState(state) {
|
|
|
2899
3086
|
] : [];
|
|
2900
3087
|
}).slice(-MAX_STORED_SPAN_REFERENCES) : [];
|
|
2901
3088
|
const llmInputs = Array.isArray(state["llmInputs"]) ? state["llmInputs"].flatMap((entry) => {
|
|
2902
|
-
if (!
|
|
3089
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, entry)) {
|
|
2903
3090
|
return [];
|
|
2904
3091
|
}
|
|
2905
3092
|
const key = entry["key"];
|
|
2906
3093
|
const input = entry["input"];
|
|
2907
3094
|
return typeof key === "string" && isCapturedModelInput(input) ? [{ input, key }] : [];
|
|
2908
3095
|
}).slice(-MAX_STORED_LLM_INPUTS) : [];
|
|
3096
|
+
const reasoningBlocks = Array.isArray(state["reasoningBlocks"]) ? state["reasoningBlocks"].flatMap((entry) => {
|
|
3097
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, entry)) {
|
|
3098
|
+
return [];
|
|
3099
|
+
}
|
|
3100
|
+
const content = entry["content"];
|
|
3101
|
+
const eventAt = entry["eventAt"];
|
|
3102
|
+
const key = entry["key"];
|
|
3103
|
+
return typeof content === "string" && (eventAt === void 0 || typeof eventAt === "string") && typeof key === "string" ? [
|
|
3104
|
+
{
|
|
3105
|
+
content,
|
|
3106
|
+
...typeof eventAt === "string" ? { eventAt } : {},
|
|
3107
|
+
key
|
|
3108
|
+
}
|
|
3109
|
+
] : [];
|
|
3110
|
+
}).slice(-MAX_STORED_REASONING_BLOCKS) : [];
|
|
2909
3111
|
const stepStarts = Array.isArray(state["stepStarts"]) ? state["stepStarts"].flatMap((entry) => {
|
|
2910
|
-
if (!
|
|
3112
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, entry)) {
|
|
2911
3113
|
return [];
|
|
2912
3114
|
}
|
|
2913
3115
|
const ordinal = entry["ordinal"];
|
|
@@ -2916,32 +3118,100 @@ function normalizeEveTraceState(state) {
|
|
|
2916
3118
|
const turnId = entry["turnId"];
|
|
2917
3119
|
return typeof ordinal === "number" && Number.isInteger(ordinal) && ordinal >= 0 && typeof open === "boolean" && typeof stepIndex === "number" && Number.isInteger(stepIndex) && typeof turnId === "string" ? [{ open, ordinal, stepIndex, turnId }] : [];
|
|
2918
3120
|
}).slice(-MAX_STORED_STEP_STARTS) : [];
|
|
2919
|
-
return {
|
|
3121
|
+
return {
|
|
3122
|
+
llmInputs,
|
|
3123
|
+
metadata: { ...metadata },
|
|
3124
|
+
reasoningBlocks,
|
|
3125
|
+
spanReferences,
|
|
3126
|
+
stepStarts
|
|
3127
|
+
};
|
|
2920
3128
|
}
|
|
2921
3129
|
function readEveTraceState(state) {
|
|
2922
3130
|
try {
|
|
2923
3131
|
return normalizeEveTraceState(state.get());
|
|
2924
|
-
} catch (
|
|
3132
|
+
} catch (e4) {
|
|
2925
3133
|
return emptyEveTraceState();
|
|
2926
3134
|
}
|
|
2927
3135
|
}
|
|
2928
|
-
function
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
3136
|
+
function storeEveReasoning(state, sessionId, event) {
|
|
3137
|
+
const eventAt = _optionalChain([event, 'access', _109 => _109.meta, 'optionalAccess', _110 => _110.at]);
|
|
3138
|
+
const key = llmInputKey(sessionId, event.data.turnId, event.data.stepIndex);
|
|
3139
|
+
let stored = [];
|
|
3140
|
+
state.update((current) => {
|
|
3141
|
+
const normalized = normalizeEveTraceState(current);
|
|
3142
|
+
const alreadyStored = normalized.reasoningBlocks.some(
|
|
3143
|
+
(entry) => entry.content === event.data.reasoning && entry.eventAt === eventAt && entry.key === key
|
|
3144
|
+
);
|
|
3145
|
+
const reasoningBlocks = alreadyStored ? normalized.reasoningBlocks : [
|
|
3146
|
+
...normalized.reasoningBlocks,
|
|
3147
|
+
{
|
|
3148
|
+
content: event.data.reasoning,
|
|
3149
|
+
...eventAt ? { eventAt } : {},
|
|
3150
|
+
key
|
|
3151
|
+
}
|
|
3152
|
+
].slice(-MAX_STORED_REASONING_BLOCKS);
|
|
3153
|
+
stored = reasoningBlocks.flatMap(
|
|
3154
|
+
(entry) => entry.key === key ? [
|
|
3155
|
+
{
|
|
3156
|
+
content: entry.content,
|
|
3157
|
+
...entry.eventAt ? { eventAt: entry.eventAt } : {}
|
|
3158
|
+
}
|
|
3159
|
+
] : []
|
|
3160
|
+
);
|
|
3161
|
+
return alreadyStored ? normalized : { ...normalized, reasoningBlocks };
|
|
3162
|
+
});
|
|
3163
|
+
return stored;
|
|
3164
|
+
}
|
|
3165
|
+
function readStoredEveReasoning(state, sessionId, turnId, stepIndex) {
|
|
3166
|
+
const key = llmInputKey(sessionId, turnId, stepIndex);
|
|
3167
|
+
return readEveTraceState(state).reasoningBlocks.flatMap(
|
|
3168
|
+
(entry) => entry.key === key ? [
|
|
3169
|
+
{
|
|
3170
|
+
content: entry.content,
|
|
3171
|
+
...entry.eventAt ? { eventAt: entry.eventAt } : {}
|
|
3172
|
+
}
|
|
3173
|
+
] : []
|
|
3174
|
+
);
|
|
3175
|
+
}
|
|
3176
|
+
function clearStoredEveReasoning(state, sessionId, turnId, stepIndex) {
|
|
3177
|
+
const key = llmInputKey(sessionId, turnId, stepIndex);
|
|
3178
|
+
state.update((current) => {
|
|
3179
|
+
const normalized = normalizeEveTraceState(current);
|
|
3180
|
+
return {
|
|
3181
|
+
...normalized,
|
|
3182
|
+
reasoningBlocks: normalized.reasoningBlocks.filter(
|
|
3183
|
+
(entry) => entry.key !== key
|
|
3184
|
+
)
|
|
3185
|
+
};
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
function eveOutputMessage(output) {
|
|
3189
|
+
return Array.isArray(output) && _chunkGSIDVFE6js.isObject.call(void 0, output[0]) ? output[0]["message"] : void 0;
|
|
3190
|
+
}
|
|
3191
|
+
function mergeEveReasoning(output, reasoning) {
|
|
3192
|
+
if (reasoning.length === 0) {
|
|
3193
|
+
return output;
|
|
2943
3194
|
}
|
|
2944
|
-
const
|
|
3195
|
+
const choice = Array.isArray(output) && _chunkGSIDVFE6js.isObject.call(void 0, output[0]) ? output[0] : {};
|
|
3196
|
+
const message = _chunkGSIDVFE6js.isObject.call(void 0, choice["message"]) ? choice["message"] : {};
|
|
3197
|
+
return [
|
|
3198
|
+
{
|
|
3199
|
+
...choice,
|
|
3200
|
+
index: typeof choice["index"] === "number" ? choice["index"] : 0,
|
|
3201
|
+
message: {
|
|
3202
|
+
...message,
|
|
3203
|
+
content: "content" in message ? message["content"] : null,
|
|
3204
|
+
reasoning: reasoning.map((block) => ({ content: block.content })),
|
|
3205
|
+
role: typeof message["role"] === "string" ? message["role"] : "assistant"
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
];
|
|
3209
|
+
}
|
|
3210
|
+
function captureEveModelInput(state, input) {
|
|
3211
|
+
const sessionId = input.session.id;
|
|
3212
|
+
const turnId = input.turn.id;
|
|
3213
|
+
const stepIndex = input.step.index;
|
|
3214
|
+
const captured = capturedModelInput(input.modelInput);
|
|
2945
3215
|
if (!captured) {
|
|
2946
3216
|
return;
|
|
2947
3217
|
}
|
|
@@ -2967,7 +3237,7 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
|
|
|
2967
3237
|
if (index < 0) {
|
|
2968
3238
|
return normalized;
|
|
2969
3239
|
}
|
|
2970
|
-
input = _optionalChain([normalized, 'access',
|
|
3240
|
+
input = _optionalChain([normalized, 'access', _111 => _111.llmInputs, 'access', _112 => _112[index], 'optionalAccess', _113 => _113.input]);
|
|
2971
3241
|
return {
|
|
2972
3242
|
...normalized,
|
|
2973
3243
|
llmInputs: normalized.llmInputs.filter(
|
|
@@ -2977,41 +3247,152 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
|
|
|
2977
3247
|
});
|
|
2978
3248
|
return input;
|
|
2979
3249
|
} catch (error) {
|
|
2980
|
-
|
|
3250
|
+
_chunkGSIDVFE6js.debugLogger.warn("Error in Eve LLM input consumption:", error);
|
|
2981
3251
|
return void 0;
|
|
2982
3252
|
}
|
|
2983
3253
|
}
|
|
2984
3254
|
function capturedModelInput(modelInput) {
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
if (
|
|
2990
|
-
|
|
2991
|
-
}
|
|
2992
|
-
|
|
2993
|
-
const value = [
|
|
2994
|
-
...instructions !== void 0 ? [{ content: instructions, role: "system" }] : [],
|
|
2995
|
-
...messages
|
|
2996
|
-
];
|
|
3255
|
+
const { instructions, messages } = modelInput;
|
|
3256
|
+
const value = [];
|
|
3257
|
+
if (typeof instructions === "string") {
|
|
3258
|
+
value.push({ content: instructions, role: "system" });
|
|
3259
|
+
} else if (instructions) {
|
|
3260
|
+
value.push(...instructions.map(capturedEveModelMessage));
|
|
3261
|
+
}
|
|
3262
|
+
value.push(...messages.map(capturedEveModelMessage));
|
|
2997
3263
|
try {
|
|
2998
3264
|
const cloned = JSON.parse(JSON.stringify(value));
|
|
2999
3265
|
if (!Array.isArray(cloned)) {
|
|
3000
3266
|
return void 0;
|
|
3001
3267
|
}
|
|
3002
3268
|
return cloned;
|
|
3003
|
-
} catch (
|
|
3269
|
+
} catch (e5) {
|
|
3004
3270
|
return void 0;
|
|
3005
3271
|
}
|
|
3006
3272
|
}
|
|
3273
|
+
function capturedEveModelMessage(message) {
|
|
3274
|
+
const { content, role } = message;
|
|
3275
|
+
if (typeof content === "string") {
|
|
3276
|
+
return { content, role };
|
|
3277
|
+
}
|
|
3278
|
+
return { content: content.map(capturedEveModelContentPart), role };
|
|
3279
|
+
}
|
|
3280
|
+
function capturedEveModelContentPart(part) {
|
|
3281
|
+
switch (part.type) {
|
|
3282
|
+
case "text":
|
|
3283
|
+
case "reasoning":
|
|
3284
|
+
return { text: part.text, type: part.type };
|
|
3285
|
+
case "image":
|
|
3286
|
+
return {
|
|
3287
|
+
image: part.image,
|
|
3288
|
+
...part.mediaType !== void 0 ? { mediaType: part.mediaType } : {},
|
|
3289
|
+
type: "image"
|
|
3290
|
+
};
|
|
3291
|
+
case "file":
|
|
3292
|
+
case "reasoning-file":
|
|
3293
|
+
return {
|
|
3294
|
+
data: part.data,
|
|
3295
|
+
...part.type === "file" && part.filename !== void 0 ? { filename: part.filename } : {},
|
|
3296
|
+
mediaType: part.mediaType,
|
|
3297
|
+
type: part.type
|
|
3298
|
+
};
|
|
3299
|
+
case "custom":
|
|
3300
|
+
return {
|
|
3301
|
+
..."kind" in part ? { kind: part.kind } : {},
|
|
3302
|
+
type: "custom"
|
|
3303
|
+
};
|
|
3304
|
+
case "tool-call":
|
|
3305
|
+
return {
|
|
3306
|
+
input: part.input,
|
|
3307
|
+
...part.providerExecuted !== void 0 ? { providerExecuted: part.providerExecuted } : {},
|
|
3308
|
+
toolCallId: part.toolCallId,
|
|
3309
|
+
toolName: part.toolName,
|
|
3310
|
+
type: "tool-call"
|
|
3311
|
+
};
|
|
3312
|
+
case "tool-result": {
|
|
3313
|
+
const output = part.output;
|
|
3314
|
+
let capturedOutput;
|
|
3315
|
+
switch (output.type) {
|
|
3316
|
+
case "text":
|
|
3317
|
+
case "error-text":
|
|
3318
|
+
capturedOutput = { type: output.type, value: output.value };
|
|
3319
|
+
break;
|
|
3320
|
+
case "json":
|
|
3321
|
+
case "error-json":
|
|
3322
|
+
capturedOutput = { type: output.type, value: output.value };
|
|
3323
|
+
break;
|
|
3324
|
+
case "execution-denied":
|
|
3325
|
+
capturedOutput = {
|
|
3326
|
+
...output.reason !== void 0 ? { reason: output.reason } : {},
|
|
3327
|
+
type: "execution-denied"
|
|
3328
|
+
};
|
|
3329
|
+
break;
|
|
3330
|
+
case "content":
|
|
3331
|
+
capturedOutput = {
|
|
3332
|
+
type: "content",
|
|
3333
|
+
value: output.value.map(capturedEveModelContentPart)
|
|
3334
|
+
};
|
|
3335
|
+
break;
|
|
3336
|
+
}
|
|
3337
|
+
return {
|
|
3338
|
+
output: capturedOutput,
|
|
3339
|
+
toolCallId: part.toolCallId,
|
|
3340
|
+
toolName: part.toolName,
|
|
3341
|
+
type: "tool-result"
|
|
3342
|
+
};
|
|
3343
|
+
}
|
|
3344
|
+
case "tool-approval-request":
|
|
3345
|
+
return {
|
|
3346
|
+
approvalId: part.approvalId,
|
|
3347
|
+
...part.isAutomatic !== void 0 ? { isAutomatic: part.isAutomatic } : {},
|
|
3348
|
+
...part.signature !== void 0 ? { signature: part.signature } : {},
|
|
3349
|
+
toolCallId: part.toolCallId,
|
|
3350
|
+
type: "tool-approval-request"
|
|
3351
|
+
};
|
|
3352
|
+
case "tool-approval-response":
|
|
3353
|
+
return {
|
|
3354
|
+
approvalId: part.approvalId,
|
|
3355
|
+
approved: part.approved,
|
|
3356
|
+
...part.providerExecuted !== void 0 ? { providerExecuted: part.providerExecuted } : {},
|
|
3357
|
+
...part.reason !== void 0 ? { reason: part.reason } : {},
|
|
3358
|
+
type: "tool-approval-response"
|
|
3359
|
+
};
|
|
3360
|
+
case "file-data":
|
|
3361
|
+
case "image-data":
|
|
3362
|
+
return {
|
|
3363
|
+
data: part.data,
|
|
3364
|
+
...part.type === "file-data" && part.filename !== void 0 ? { filename: part.filename } : {},
|
|
3365
|
+
mediaType: part.mediaType,
|
|
3366
|
+
type: part.type
|
|
3367
|
+
};
|
|
3368
|
+
case "file-url":
|
|
3369
|
+
case "image-url":
|
|
3370
|
+
return {
|
|
3371
|
+
...part.type === "file-url" && part.mediaType !== void 0 ? { mediaType: part.mediaType } : {},
|
|
3372
|
+
type: part.type,
|
|
3373
|
+
url: part.url
|
|
3374
|
+
};
|
|
3375
|
+
case "file-id":
|
|
3376
|
+
case "image-file-id":
|
|
3377
|
+
return { fileId: part.fileId, type: part.type };
|
|
3378
|
+
case "file-reference":
|
|
3379
|
+
case "image-file-reference":
|
|
3380
|
+
return {
|
|
3381
|
+
providerReference: part.providerReference,
|
|
3382
|
+
type: part.type
|
|
3383
|
+
};
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3007
3386
|
function isCapturedModelInput(input) {
|
|
3008
|
-
return Array.isArray(input)
|
|
3387
|
+
return Array.isArray(input) && input.every(
|
|
3388
|
+
(message) => _chunkGSIDVFE6js.isObject.call(void 0, message) && (message["role"] === "system" || message["role"] === "user" || message["role"] === "assistant" || message["role"] === "tool") && (typeof message["content"] === "string" || Array.isArray(message["content"]) && message["content"].every(_chunkGSIDVFE6js.isObject))
|
|
3389
|
+
);
|
|
3009
3390
|
}
|
|
3010
3391
|
function llmInputKey(sessionId, turnId, stepIndex) {
|
|
3011
3392
|
return `${sessionId}\0${turnId}\0${stepIndex}`;
|
|
3012
3393
|
}
|
|
3013
3394
|
function modelMetadataFromRuntime(runtime) {
|
|
3014
|
-
if (!
|
|
3395
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, runtime)) {
|
|
3015
3396
|
return {};
|
|
3016
3397
|
}
|
|
3017
3398
|
const modelId = runtime["modelId"];
|
|
@@ -3034,11 +3415,11 @@ function modelMetadataFromModelId(modelId) {
|
|
|
3034
3415
|
};
|
|
3035
3416
|
}
|
|
3036
3417
|
function sessionIdFromContext(ctx) {
|
|
3037
|
-
if (!
|
|
3418
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, ctx)) {
|
|
3038
3419
|
return void 0;
|
|
3039
3420
|
}
|
|
3040
3421
|
const session = ctx["session"];
|
|
3041
|
-
if (!
|
|
3422
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, session)) {
|
|
3042
3423
|
return void 0;
|
|
3043
3424
|
}
|
|
3044
3425
|
const id = session["id"];
|
|
@@ -3049,19 +3430,19 @@ function toolMetadataFromTurn(turn) {
|
|
|
3049
3430
|
return metadata;
|
|
3050
3431
|
}
|
|
3051
3432
|
function isToolCallAction(action) {
|
|
3052
|
-
return
|
|
3433
|
+
return _chunkGSIDVFE6js.isObject.call(void 0, action) && action["kind"] === "tool-call" && typeof action["callId"] === "string" && typeof action["toolName"] === "string" && _chunkGSIDVFE6js.isObject.call(void 0, action["input"]);
|
|
3053
3434
|
}
|
|
3054
3435
|
function isLocalSubagentCallAction(action) {
|
|
3055
|
-
return
|
|
3436
|
+
return _chunkGSIDVFE6js.isObject.call(void 0, action) && action["kind"] === "subagent-call" && typeof action["callId"] === "string" && _chunkGSIDVFE6js.isObject.call(void 0, action["input"]);
|
|
3056
3437
|
}
|
|
3057
3438
|
function isTraceableActionRequest(action) {
|
|
3058
3439
|
return isToolCallAction(action) || isLocalSubagentCallAction(action);
|
|
3059
3440
|
}
|
|
3060
3441
|
function isToolResult(result) {
|
|
3061
|
-
return
|
|
3442
|
+
return _chunkGSIDVFE6js.isObject.call(void 0, result) && result["kind"] === "tool-result" && typeof result["callId"] === "string" && typeof result["toolName"] === "string";
|
|
3062
3443
|
}
|
|
3063
3444
|
function isSubagentResult(result) {
|
|
3064
|
-
return
|
|
3445
|
+
return _chunkGSIDVFE6js.isObject.call(void 0, result) && result["kind"] === "subagent-result" && typeof result["callId"] === "string" && typeof result["subagentName"] === "string";
|
|
3065
3446
|
}
|
|
3066
3447
|
function normalizedFinishReason(finishReason) {
|
|
3067
3448
|
switch (finishReason) {
|
|
@@ -3091,7 +3472,7 @@ function actionResultError(error, output) {
|
|
|
3091
3472
|
return result;
|
|
3092
3473
|
}
|
|
3093
3474
|
function eventTime(event) {
|
|
3094
|
-
if (!_optionalChain([event, 'access',
|
|
3475
|
+
if (!_optionalChain([event, 'access', _114 => _114.meta, 'optionalAccess', _115 => _115.at])) {
|
|
3095
3476
|
return void 0;
|
|
3096
3477
|
}
|
|
3097
3478
|
const timestamp = Date.parse(event.meta.at);
|
|
@@ -3161,7 +3542,7 @@ function messagesProxy(messages) {
|
|
|
3161
3542
|
return new Proxy(messages, {
|
|
3162
3543
|
get(target, prop, receiver) {
|
|
3163
3544
|
if (prop === "create") {
|
|
3164
|
-
return createProxy(target.create,
|
|
3545
|
+
return createProxy(target.create, _chunkP25IOOU4js.anthropicChannels.messagesCreate);
|
|
3165
3546
|
}
|
|
3166
3547
|
return Reflect.get(target, prop, receiver);
|
|
3167
3548
|
}
|
|
@@ -3171,7 +3552,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
3171
3552
|
return new Proxy(messages, {
|
|
3172
3553
|
get(target, prop, receiver) {
|
|
3173
3554
|
if (prop === "create") {
|
|
3174
|
-
return createProxy(target.create,
|
|
3555
|
+
return createProxy(target.create, _chunkP25IOOU4js.anthropicChannels.betaMessagesCreate);
|
|
3175
3556
|
}
|
|
3176
3557
|
if (prop === "toolRunner") {
|
|
3177
3558
|
if (typeof target.toolRunner !== "function") {
|
|
@@ -3180,7 +3561,7 @@ function betaMessagesProxy(messages, anthropic) {
|
|
|
3180
3561
|
return toolRunnerProxy(
|
|
3181
3562
|
target.toolRunner,
|
|
3182
3563
|
anthropic,
|
|
3183
|
-
|
|
3564
|
+
_chunkP25IOOU4js.anthropicChannels.betaMessagesToolRunner
|
|
3184
3565
|
);
|
|
3185
3566
|
}
|
|
3186
3567
|
return Reflect.get(target, prop, receiver);
|
|
@@ -3237,11 +3618,11 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
|
|
|
3237
3618
|
...params,
|
|
3238
3619
|
options: {
|
|
3239
3620
|
..._nullishCoalesce(params.options, () => ( {})),
|
|
3240
|
-
[
|
|
3621
|
+
[_chunkGSIDVFE6js.CLAUDE_AGENT_SDK_SKIP_LOCAL_TOOL_HOOKS_OPTION]: true
|
|
3241
3622
|
}
|
|
3242
3623
|
};
|
|
3243
3624
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
3244
|
-
return
|
|
3625
|
+
return _chunkP25IOOU4js.claudeAgentSDKChannels.query.traceSync(
|
|
3245
3626
|
() => Reflect.apply(target, invocationTarget, [wrappedParams]),
|
|
3246
3627
|
// The channel carries no extra context fields, but the generated
|
|
3247
3628
|
// StartOf<> type for Record<string, never> is overly strict here.
|
|
@@ -3269,7 +3650,7 @@ function wrapClaudeAgentTool(toolFn, localToolMetadataByTool, defaultThis) {
|
|
|
3269
3650
|
}
|
|
3270
3651
|
const localToolMetadata = { toolName };
|
|
3271
3652
|
const originalHandler = wrappedArgs[handlerIndex];
|
|
3272
|
-
wrappedArgs[handlerIndex] =
|
|
3653
|
+
wrappedArgs[handlerIndex] = _chunkGSIDVFE6js.wrapLocalClaudeToolHandler.call(void 0,
|
|
3273
3654
|
originalHandler,
|
|
3274
3655
|
() => localToolMetadata
|
|
3275
3656
|
);
|
|
@@ -3287,8 +3668,8 @@ function wrapCreateSdkMcpServer(createSdkMcpServerFn, localToolMetadataByTool, d
|
|
|
3287
3668
|
apply(target, thisArg, argArray) {
|
|
3288
3669
|
const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
3289
3670
|
const config = argArray[0];
|
|
3290
|
-
const serverName = _optionalChain([config, 'optionalAccess',
|
|
3291
|
-
if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess',
|
|
3671
|
+
const serverName = _optionalChain([config, 'optionalAccess', _116 => _116.name]);
|
|
3672
|
+
if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess', _117 => _117.tools]))) {
|
|
3292
3673
|
for (const tool of config.tools) {
|
|
3293
3674
|
if (!tool || typeof tool !== "object") {
|
|
3294
3675
|
continue;
|
|
@@ -3382,7 +3763,7 @@ function isModuleNamespace2(obj) {
|
|
|
3382
3763
|
if (!obj || typeof obj !== "object") {
|
|
3383
3764
|
return false;
|
|
3384
3765
|
}
|
|
3385
|
-
if (_optionalChain([obj, 'access',
|
|
3766
|
+
if (_optionalChain([obj, 'access', _118 => _118.constructor, 'optionalAccess', _119 => _119.name]) === "Module") {
|
|
3386
3767
|
return true;
|
|
3387
3768
|
}
|
|
3388
3769
|
const keys = Object.keys(obj);
|
|
@@ -3452,7 +3833,7 @@ function wrapCodexThread(thread) {
|
|
|
3452
3833
|
if (prop === "run" && typeof value === "function") {
|
|
3453
3834
|
return function(input, turnOptions) {
|
|
3454
3835
|
const args = [input, turnOptions];
|
|
3455
|
-
return
|
|
3836
|
+
return _chunkP25IOOU4js.openAICodexChannels.run.tracePromise(
|
|
3456
3837
|
() => Reflect.apply(value, target, args),
|
|
3457
3838
|
{
|
|
3458
3839
|
arguments: args,
|
|
@@ -3465,7 +3846,7 @@ function wrapCodexThread(thread) {
|
|
|
3465
3846
|
if (prop === "runStreamed" && typeof value === "function") {
|
|
3466
3847
|
return function(input, turnOptions) {
|
|
3467
3848
|
const args = [input, turnOptions];
|
|
3468
|
-
return
|
|
3849
|
+
return _chunkP25IOOU4js.openAICodexChannels.runStreamed.tracePromise(
|
|
3469
3850
|
() => Reflect.apply(value, target, args),
|
|
3470
3851
|
{
|
|
3471
3852
|
arguments: args,
|
|
@@ -3512,7 +3893,7 @@ function isModuleNamespace3(obj) {
|
|
|
3512
3893
|
if (!obj || typeof obj !== "object") {
|
|
3513
3894
|
return false;
|
|
3514
3895
|
}
|
|
3515
|
-
if (_optionalChain([obj, 'access',
|
|
3896
|
+
if (_optionalChain([obj, 'access', _120 => _120.constructor, 'optionalAccess', _121 => _121.name]) === "Module") {
|
|
3516
3897
|
return true;
|
|
3517
3898
|
}
|
|
3518
3899
|
const keys = Object.keys(obj);
|
|
@@ -3533,7 +3914,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3533
3914
|
if (prop === "create" && typeof value === "function") {
|
|
3534
3915
|
const wrapped = async function(options) {
|
|
3535
3916
|
const args = [options];
|
|
3536
|
-
return
|
|
3917
|
+
return _chunkP25IOOU4js.cursorSDKChannels.create.tracePromise(
|
|
3537
3918
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
3538
3919
|
{ arguments: args }
|
|
3539
3920
|
);
|
|
@@ -3544,7 +3925,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3544
3925
|
if (prop === "resume" && typeof value === "function") {
|
|
3545
3926
|
const wrapped = async function(agentId, options) {
|
|
3546
3927
|
const args = [agentId, options];
|
|
3547
|
-
return
|
|
3928
|
+
return _chunkP25IOOU4js.cursorSDKChannels.resume.tracePromise(
|
|
3548
3929
|
async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
|
|
3549
3930
|
{ arguments: args }
|
|
3550
3931
|
);
|
|
@@ -3555,7 +3936,7 @@ function wrapCursorAgentClass(Agent) {
|
|
|
3555
3936
|
if (prop === "prompt" && typeof value === "function") {
|
|
3556
3937
|
const wrapped = async function(message, options) {
|
|
3557
3938
|
const args = [message, options];
|
|
3558
|
-
return
|
|
3939
|
+
return _chunkP25IOOU4js.cursorSDKChannels.prompt.tracePromise(
|
|
3559
3940
|
() => Reflect.apply(value, target, args),
|
|
3560
3941
|
{ arguments: args }
|
|
3561
3942
|
);
|
|
@@ -3588,7 +3969,7 @@ function wrapCursorAgent(agent) {
|
|
|
3588
3969
|
if (prop === "send" && typeof value === "function") {
|
|
3589
3970
|
return function(message, options) {
|
|
3590
3971
|
const args = [message, options];
|
|
3591
|
-
return
|
|
3972
|
+
return _chunkP25IOOU4js.cursorSDKChannels.send.tracePromise(
|
|
3592
3973
|
() => Reflect.apply(value, target, args),
|
|
3593
3974
|
{
|
|
3594
3975
|
agent: target,
|
|
@@ -3638,7 +4019,7 @@ function patchAgentSessionClass(AgentSession) {
|
|
|
3638
4019
|
...descriptor,
|
|
3639
4020
|
value: function wrappedPiCodingAgentPrompt(text, options) {
|
|
3640
4021
|
const args = [text, options];
|
|
3641
|
-
return
|
|
4022
|
+
return _chunkP25IOOU4js.piCodingAgentChannels.prompt.tracePromise(
|
|
3642
4023
|
() => Reflect.apply(originalPrompt, this, args),
|
|
3643
4024
|
{
|
|
3644
4025
|
arguments: args,
|
|
@@ -3696,7 +4077,7 @@ function isModuleNamespace4(obj) {
|
|
|
3696
4077
|
if (!obj || typeof obj !== "object") {
|
|
3697
4078
|
return false;
|
|
3698
4079
|
}
|
|
3699
|
-
if (_optionalChain([obj, 'access',
|
|
4080
|
+
if (_optionalChain([obj, 'access', _122 => _122.constructor, 'optionalAccess', _123 => _123.name]) === "Module") {
|
|
3700
4081
|
return true;
|
|
3701
4082
|
}
|
|
3702
4083
|
const keys = Object.keys(obj);
|
|
@@ -3758,7 +4139,7 @@ function wrapAgentInstance(agent) {
|
|
|
3758
4139
|
if (prop === "stream" && typeof value === "function") {
|
|
3759
4140
|
return function(args, options) {
|
|
3760
4141
|
const callArgs = [args, options];
|
|
3761
|
-
return
|
|
4142
|
+
return _chunkP25IOOU4js.strandsAgentSDKChannels.agentStream.traceSync(
|
|
3762
4143
|
() => Reflect.apply(value, target, callArgs),
|
|
3763
4144
|
{
|
|
3764
4145
|
agent: proxy,
|
|
@@ -3794,7 +4175,7 @@ function wrapMultiAgentInstance(orchestrator, kind) {
|
|
|
3794
4175
|
if (prop === "stream" && typeof value === "function") {
|
|
3795
4176
|
return function(input, options) {
|
|
3796
4177
|
const callArgs = [input, options];
|
|
3797
|
-
const channel = kind === "graph" ?
|
|
4178
|
+
const channel = kind === "graph" ? _chunkP25IOOU4js.strandsAgentSDKChannels.graphStream : _chunkP25IOOU4js.strandsAgentSDKChannels.swarmStream;
|
|
3798
4179
|
return channel.traceSync(
|
|
3799
4180
|
() => Reflect.apply(value, target, callArgs),
|
|
3800
4181
|
{
|
|
@@ -3869,7 +4250,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
3869
4250
|
}
|
|
3870
4251
|
if (prop === "interactions") {
|
|
3871
4252
|
const interactions = Reflect.get(target, prop, receiver);
|
|
3872
|
-
if (!
|
|
4253
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, interactions) || typeof interactions.create !== "function") {
|
|
3873
4254
|
return interactions;
|
|
3874
4255
|
}
|
|
3875
4256
|
if (interactions !== originalInteractions) {
|
|
@@ -3883,7 +4264,7 @@ function wrapGoogleGenAIInstance(instance) {
|
|
|
3883
4264
|
});
|
|
3884
4265
|
}
|
|
3885
4266
|
function patchGoogleGenAIChats(instance, wrappedModels) {
|
|
3886
|
-
if (!
|
|
4267
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, instance.chats) || !("modelsModule" in instance.chats)) {
|
|
3887
4268
|
return;
|
|
3888
4269
|
}
|
|
3889
4270
|
Reflect.set(instance.chats, "modelsModule", wrappedModels);
|
|
@@ -3916,7 +4297,7 @@ function wrapInteractions(interactions) {
|
|
|
3916
4297
|
}
|
|
3917
4298
|
function wrapGenerateContent(original) {
|
|
3918
4299
|
return function(params) {
|
|
3919
|
-
return
|
|
4300
|
+
return _chunkP25IOOU4js.googleGenAIChannels.generateContent.tracePromise(
|
|
3920
4301
|
() => original(params),
|
|
3921
4302
|
{ arguments: [params] }
|
|
3922
4303
|
);
|
|
@@ -3924,7 +4305,7 @@ function wrapGenerateContent(original) {
|
|
|
3924
4305
|
}
|
|
3925
4306
|
function wrapGenerateContentStream(original) {
|
|
3926
4307
|
return function(params) {
|
|
3927
|
-
return
|
|
4308
|
+
return _chunkP25IOOU4js.googleGenAIChannels.generateContentStream.tracePromise(
|
|
3928
4309
|
() => original(params),
|
|
3929
4310
|
{ arguments: [params] }
|
|
3930
4311
|
);
|
|
@@ -3932,7 +4313,7 @@ function wrapGenerateContentStream(original) {
|
|
|
3932
4313
|
}
|
|
3933
4314
|
function wrapEmbedContent(original) {
|
|
3934
4315
|
return function(params) {
|
|
3935
|
-
return
|
|
4316
|
+
return _chunkP25IOOU4js.googleGenAIChannels.embedContent.tracePromise(
|
|
3936
4317
|
() => original(params),
|
|
3937
4318
|
{ arguments: [params] }
|
|
3938
4319
|
);
|
|
@@ -3944,7 +4325,7 @@ function wrapInteractionCreate(original) {
|
|
|
3944
4325
|
return options === void 0 ? original(params) : original(params, options);
|
|
3945
4326
|
}
|
|
3946
4327
|
const traceContext = options === void 0 ? { arguments: [params] } : { arguments: [params, options] };
|
|
3947
|
-
return
|
|
4328
|
+
return _chunkP25IOOU4js.googleGenAIChannels.interactionsCreate.tracePromise(
|
|
3948
4329
|
() => options === void 0 ? original(params) : original(params, options),
|
|
3949
4330
|
traceContext
|
|
3950
4331
|
);
|
|
@@ -4005,7 +4386,7 @@ function wrapRunnerInstance(runner) {
|
|
|
4005
4386
|
function wrapRunnerRunAsync(runner) {
|
|
4006
4387
|
const original = runner.runAsync.bind(runner);
|
|
4007
4388
|
return function(params) {
|
|
4008
|
-
return
|
|
4389
|
+
return _chunkP25IOOU4js.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
|
|
4009
4390
|
arguments: [params],
|
|
4010
4391
|
self: runner
|
|
4011
4392
|
});
|
|
@@ -4032,7 +4413,7 @@ function wrapAgentInstance2(agent) {
|
|
|
4032
4413
|
function wrapAgentRunAsync(agent) {
|
|
4033
4414
|
const original = agent.runAsync.bind(agent);
|
|
4034
4415
|
return function(parentContext) {
|
|
4035
|
-
return
|
|
4416
|
+
return _chunkP25IOOU4js.googleADKChannels.agentRunAsync.traceSync(
|
|
4036
4417
|
() => original(parentContext),
|
|
4037
4418
|
{ arguments: [parentContext], self: agent }
|
|
4038
4419
|
);
|
|
@@ -4059,7 +4440,7 @@ function wrapToolInstance(tool) {
|
|
|
4059
4440
|
function wrapToolRunAsync(tool) {
|
|
4060
4441
|
const original = tool.runAsync.bind(tool);
|
|
4061
4442
|
return function(req) {
|
|
4062
|
-
return
|
|
4443
|
+
return _chunkP25IOOU4js.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
|
|
4063
4444
|
arguments: [req],
|
|
4064
4445
|
self: tool
|
|
4065
4446
|
});
|
|
@@ -4171,7 +4552,7 @@ function patchGenkitRegistryLookup(registry) {
|
|
|
4171
4552
|
Object.defineProperty(registry, PATCHED_GENKIT_REGISTRY, {
|
|
4172
4553
|
value: true
|
|
4173
4554
|
});
|
|
4174
|
-
} catch (
|
|
4555
|
+
} catch (e6) {
|
|
4175
4556
|
}
|
|
4176
4557
|
}
|
|
4177
4558
|
function patchGenkitRegistryConstructor(registry) {
|
|
@@ -4202,31 +4583,31 @@ function patchGenkitRegistryConstructor(registry) {
|
|
|
4202
4583
|
Object.defineProperty(constructor, PATCHED_GENKIT_REGISTRY_CONSTRUCTOR, {
|
|
4203
4584
|
value: true
|
|
4204
4585
|
});
|
|
4205
|
-
} catch (
|
|
4586
|
+
} catch (e7) {
|
|
4206
4587
|
}
|
|
4207
4588
|
}
|
|
4208
4589
|
function wrapGenerate(generate) {
|
|
4209
|
-
return (input) =>
|
|
4590
|
+
return (input) => _chunkP25IOOU4js.genkitChannels.generate.tracePromise(() => generate(input), {
|
|
4210
4591
|
arguments: [input]
|
|
4211
4592
|
});
|
|
4212
4593
|
}
|
|
4213
4594
|
function wrapGenerateStream(generateStream) {
|
|
4214
|
-
return (input) =>
|
|
4595
|
+
return (input) => _chunkP25IOOU4js.genkitChannels.generateStream.traceSync(() => generateStream(input), {
|
|
4215
4596
|
arguments: [input]
|
|
4216
4597
|
});
|
|
4217
4598
|
}
|
|
4218
4599
|
function wrapEmbed2(embed) {
|
|
4219
|
-
return (params) =>
|
|
4600
|
+
return (params) => _chunkP25IOOU4js.genkitChannels.embed.tracePromise(() => embed(params), {
|
|
4220
4601
|
arguments: [params]
|
|
4221
4602
|
});
|
|
4222
4603
|
}
|
|
4223
4604
|
function wrapEmbedMany2(embedMany) {
|
|
4224
|
-
return (params) =>
|
|
4605
|
+
return (params) => _chunkP25IOOU4js.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
|
|
4225
4606
|
arguments: [params]
|
|
4226
4607
|
});
|
|
4227
4608
|
}
|
|
4228
4609
|
function wrapRun(run) {
|
|
4229
|
-
return (name, inputOrFn, maybeFn) =>
|
|
4610
|
+
return (name, inputOrFn, maybeFn) => _chunkP25IOOU4js.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
|
|
4230
4611
|
arguments: [name, inputOrFn, maybeFn]
|
|
4231
4612
|
});
|
|
4232
4613
|
}
|
|
@@ -4265,13 +4646,13 @@ function isGenkitAction(value) {
|
|
|
4265
4646
|
return typeof value === "function" && "__action" in value;
|
|
4266
4647
|
}
|
|
4267
4648
|
function traceActionRun(action, run) {
|
|
4268
|
-
return (input, options) =>
|
|
4649
|
+
return (input, options) => _chunkP25IOOU4js.genkitChannels.actionRun.tracePromise(() => run(input, options), {
|
|
4269
4650
|
arguments: [input, options],
|
|
4270
4651
|
self: action
|
|
4271
4652
|
});
|
|
4272
4653
|
}
|
|
4273
4654
|
function traceActionStream(action, stream) {
|
|
4274
|
-
return (input, options) =>
|
|
4655
|
+
return (input, options) => _chunkP25IOOU4js.genkitChannels.actionStream.traceSync(() => stream(input, options), {
|
|
4275
4656
|
arguments: [input, options],
|
|
4276
4657
|
self: action
|
|
4277
4658
|
});
|
|
@@ -4317,10 +4698,10 @@ function isHuggingFaceConstructorKey(value) {
|
|
|
4317
4698
|
return HUGGINGFACE_CONSTRUCTOR_KEY_SET.has(value);
|
|
4318
4699
|
}
|
|
4319
4700
|
function hasFunction2(value, methodName) {
|
|
4320
|
-
return
|
|
4701
|
+
return _chunkGSIDVFE6js.isObject.call(void 0, value) && methodName in value && typeof value[methodName] === "function";
|
|
4321
4702
|
}
|
|
4322
4703
|
function isSupportedHuggingFaceModule(value) {
|
|
4323
|
-
if (!
|
|
4704
|
+
if (!_chunkGSIDVFE6js.isObject.call(void 0, value)) {
|
|
4324
4705
|
return false;
|
|
4325
4706
|
}
|
|
4326
4707
|
return HUGGINGFACE_CONSTRUCTOR_KEYS.some(
|
|
@@ -4428,14 +4809,14 @@ function wrapChatCompletion2(original, endpointUrl) {
|
|
|
4428
4809
|
const context = {
|
|
4429
4810
|
arguments: [traceParams]
|
|
4430
4811
|
};
|
|
4431
|
-
return
|
|
4812
|
+
return _chunkP25IOOU4js.huggingFaceChannels.chatCompletion.tracePromise(
|
|
4432
4813
|
() => original(params, options),
|
|
4433
4814
|
context
|
|
4434
4815
|
);
|
|
4435
4816
|
};
|
|
4436
4817
|
}
|
|
4437
4818
|
function wrapChatCompletionStream(original, endpointUrl) {
|
|
4438
|
-
return (params, options) =>
|
|
4819
|
+
return (params, options) => _chunkP25IOOU4js.huggingFaceChannels.chatCompletionStream.traceSync(
|
|
4439
4820
|
() => original(params, options),
|
|
4440
4821
|
{
|
|
4441
4822
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -4448,14 +4829,14 @@ function wrapTextGeneration(original, endpointUrl) {
|
|
|
4448
4829
|
const context = {
|
|
4449
4830
|
arguments: [traceParams]
|
|
4450
4831
|
};
|
|
4451
|
-
return
|
|
4832
|
+
return _chunkP25IOOU4js.huggingFaceChannels.textGeneration.tracePromise(
|
|
4452
4833
|
() => original(params, options),
|
|
4453
4834
|
context
|
|
4454
4835
|
);
|
|
4455
4836
|
};
|
|
4456
4837
|
}
|
|
4457
4838
|
function wrapTextGenerationStream(original, endpointUrl) {
|
|
4458
|
-
return (params, options) =>
|
|
4839
|
+
return (params, options) => _chunkP25IOOU4js.huggingFaceChannels.textGenerationStream.traceSync(
|
|
4459
4840
|
() => original(params, options),
|
|
4460
4841
|
{
|
|
4461
4842
|
arguments: [withEndpointUrl(params, endpointUrl)]
|
|
@@ -4468,7 +4849,7 @@ function wrapFeatureExtraction(original, endpointUrl) {
|
|
|
4468
4849
|
const context = {
|
|
4469
4850
|
arguments: [traceParams]
|
|
4470
4851
|
};
|
|
4471
|
-
return
|
|
4852
|
+
return _chunkP25IOOU4js.huggingFaceChannels.featureExtraction.tracePromise(
|
|
4472
4853
|
() => original(params, options),
|
|
4473
4854
|
context
|
|
4474
4855
|
);
|
|
@@ -4515,7 +4896,7 @@ function wrapCallModel(callModelFn, defaultThis) {
|
|
|
4515
4896
|
const request = cloneCallModelRequest(argArray[0]);
|
|
4516
4897
|
const options = argArray[1];
|
|
4517
4898
|
const invocationTarget = thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
|
|
4518
|
-
return
|
|
4899
|
+
return _chunkP25IOOU4js.openRouterAgentChannels.callModel.traceSync(
|
|
4519
4900
|
() => Reflect.apply(target, invocationTarget, [request, options]),
|
|
4520
4901
|
{
|
|
4521
4902
|
arguments: [request]
|
|
@@ -4611,24 +4992,24 @@ function rerankProxy(rerank) {
|
|
|
4611
4992
|
});
|
|
4612
4993
|
}
|
|
4613
4994
|
function wrapChatSend(send) {
|
|
4614
|
-
return (request, options) =>
|
|
4995
|
+
return (request, options) => _chunkP25IOOU4js.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
|
|
4615
4996
|
arguments: [request]
|
|
4616
4997
|
});
|
|
4617
4998
|
}
|
|
4618
4999
|
function wrapEmbeddingsGenerate(generate) {
|
|
4619
|
-
return (request, options) =>
|
|
5000
|
+
return (request, options) => _chunkP25IOOU4js.openRouterChannels.embeddingsGenerate.tracePromise(
|
|
4620
5001
|
() => generate(request, options),
|
|
4621
5002
|
{ arguments: [request] }
|
|
4622
5003
|
);
|
|
4623
5004
|
}
|
|
4624
5005
|
function wrapResponsesSend(send) {
|
|
4625
|
-
return (request, options) =>
|
|
5006
|
+
return (request, options) => _chunkP25IOOU4js.openRouterChannels.betaResponsesSend.tracePromise(
|
|
4626
5007
|
() => send(request, options),
|
|
4627
5008
|
{ arguments: [request] }
|
|
4628
5009
|
);
|
|
4629
5010
|
}
|
|
4630
5011
|
function wrapRerank2(rerank) {
|
|
4631
|
-
return (request, options) =>
|
|
5012
|
+
return (request, options) => _chunkP25IOOU4js.openRouterChannels.rerankRerank.tracePromise(
|
|
4632
5013
|
() => rerank(request, options),
|
|
4633
5014
|
{ arguments: [request] }
|
|
4634
5015
|
);
|
|
@@ -4636,7 +5017,7 @@ function wrapRerank2(rerank) {
|
|
|
4636
5017
|
function wrapCallModel2(callModel) {
|
|
4637
5018
|
return (request, options) => {
|
|
4638
5019
|
const tracedRequest = { ...request };
|
|
4639
|
-
return
|
|
5020
|
+
return _chunkP25IOOU4js.openRouterChannels.callModel.traceSync(
|
|
4640
5021
|
() => callModel(tracedRequest, options),
|
|
4641
5022
|
{
|
|
4642
5023
|
arguments: [tracedRequest]
|
|
@@ -4769,7 +5150,7 @@ function classifiersProxy(classifiers) {
|
|
|
4769
5150
|
});
|
|
4770
5151
|
}
|
|
4771
5152
|
function wrapChatComplete(complete) {
|
|
4772
|
-
return (request, options) =>
|
|
5153
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.chatComplete.tracePromise(
|
|
4773
5154
|
() => complete(request, options),
|
|
4774
5155
|
{
|
|
4775
5156
|
arguments: [request]
|
|
@@ -4777,52 +5158,52 @@ function wrapChatComplete(complete) {
|
|
|
4777
5158
|
);
|
|
4778
5159
|
}
|
|
4779
5160
|
function wrapChatStream(stream) {
|
|
4780
|
-
return (request, options) =>
|
|
5161
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
|
|
4781
5162
|
arguments: [request]
|
|
4782
5163
|
});
|
|
4783
5164
|
}
|
|
4784
5165
|
function wrapEmbeddingsCreate(create) {
|
|
4785
|
-
return (request, options) =>
|
|
5166
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.embeddingsCreate.tracePromise(
|
|
4786
5167
|
() => create(request, options),
|
|
4787
5168
|
{ arguments: [request] }
|
|
4788
5169
|
);
|
|
4789
5170
|
}
|
|
4790
5171
|
function wrapClassifiersModerate(moderate) {
|
|
4791
|
-
return (request, options) =>
|
|
5172
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.classifiersModerate.tracePromise(
|
|
4792
5173
|
() => moderate(request, options),
|
|
4793
5174
|
{ arguments: [request] }
|
|
4794
5175
|
);
|
|
4795
5176
|
}
|
|
4796
5177
|
function wrapClassifiersModerateChat(moderateChat) {
|
|
4797
|
-
return (request, options) =>
|
|
5178
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.classifiersModerateChat.tracePromise(
|
|
4798
5179
|
() => moderateChat(request, options),
|
|
4799
5180
|
{ arguments: [request] }
|
|
4800
5181
|
);
|
|
4801
5182
|
}
|
|
4802
5183
|
function wrapClassifiersClassify(classify) {
|
|
4803
|
-
return (request, options) =>
|
|
5184
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.classifiersClassify.tracePromise(
|
|
4804
5185
|
() => classify(request, options),
|
|
4805
5186
|
{ arguments: [request] }
|
|
4806
5187
|
);
|
|
4807
5188
|
}
|
|
4808
5189
|
function wrapClassifiersClassifyChat(classifyChat) {
|
|
4809
|
-
return (request, options) =>
|
|
5190
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.classifiersClassifyChat.tracePromise(
|
|
4810
5191
|
() => classifyChat(request, options),
|
|
4811
5192
|
{ arguments: [request] }
|
|
4812
5193
|
);
|
|
4813
5194
|
}
|
|
4814
5195
|
function wrapFimComplete(complete) {
|
|
4815
|
-
return (request, options) =>
|
|
5196
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
|
|
4816
5197
|
arguments: [request]
|
|
4817
5198
|
});
|
|
4818
5199
|
}
|
|
4819
5200
|
function wrapFimStream(stream) {
|
|
4820
|
-
return (request, options) =>
|
|
5201
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
|
|
4821
5202
|
arguments: [request]
|
|
4822
5203
|
});
|
|
4823
5204
|
}
|
|
4824
5205
|
function wrapAgentsComplete(complete) {
|
|
4825
|
-
return (request, options) =>
|
|
5206
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.agentsComplete.tracePromise(
|
|
4826
5207
|
() => complete(request, options),
|
|
4827
5208
|
{
|
|
4828
5209
|
arguments: [request]
|
|
@@ -4830,7 +5211,7 @@ function wrapAgentsComplete(complete) {
|
|
|
4830
5211
|
);
|
|
4831
5212
|
}
|
|
4832
5213
|
function wrapAgentsStream(stream) {
|
|
4833
|
-
return (request, options) =>
|
|
5214
|
+
return (request, options) => _chunkP25IOOU4js.mistralChannels.agentsStream.tracePromise(() => stream(request, options), {
|
|
4834
5215
|
arguments: [request]
|
|
4835
5216
|
});
|
|
4836
5217
|
}
|
|
@@ -4883,22 +5264,22 @@ function cohereProxy(cohere) {
|
|
|
4883
5264
|
return proxy;
|
|
4884
5265
|
}
|
|
4885
5266
|
function wrapChat(chat) {
|
|
4886
|
-
return (request, options) =>
|
|
5267
|
+
return (request, options) => _chunkP25IOOU4js.cohereChannels.chat.tracePromise(() => chat(request, options), {
|
|
4887
5268
|
arguments: [request]
|
|
4888
5269
|
});
|
|
4889
5270
|
}
|
|
4890
5271
|
function wrapChatStream2(chatStream) {
|
|
4891
|
-
return (request, options) =>
|
|
5272
|
+
return (request, options) => _chunkP25IOOU4js.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
|
|
4892
5273
|
arguments: [request]
|
|
4893
5274
|
});
|
|
4894
5275
|
}
|
|
4895
5276
|
function wrapEmbed3(embed) {
|
|
4896
|
-
return (request, options) =>
|
|
5277
|
+
return (request, options) => _chunkP25IOOU4js.cohereChannels.embed.tracePromise(() => embed(request, options), {
|
|
4897
5278
|
arguments: [request]
|
|
4898
5279
|
});
|
|
4899
5280
|
}
|
|
4900
5281
|
function wrapRerank3(rerank) {
|
|
4901
|
-
return (request, options) =>
|
|
5282
|
+
return (request, options) => _chunkP25IOOU4js.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
|
|
4902
5283
|
arguments: [request]
|
|
4903
5284
|
});
|
|
4904
5285
|
}
|
|
@@ -4928,7 +5309,7 @@ function isSupportedGroqClient(value) {
|
|
|
4928
5309
|
}
|
|
4929
5310
|
function groqProxy(groq) {
|
|
4930
5311
|
const privateMethodWorkaroundCache = /* @__PURE__ */ new WeakMap();
|
|
4931
|
-
const completionProxy = _optionalChain([groq, 'access',
|
|
5312
|
+
const completionProxy = _optionalChain([groq, 'access', _124 => _124.chat, 'optionalAccess', _125 => _125.completions]) ? new Proxy(groq.chat.completions, {
|
|
4932
5313
|
get(target, prop, receiver) {
|
|
4933
5314
|
if (prop === "create") {
|
|
4934
5315
|
return wrapChatCompletionsCreate(target.create.bind(target));
|
|
@@ -4980,13 +5361,13 @@ function groqProxy(groq) {
|
|
|
4980
5361
|
return topLevelProxy;
|
|
4981
5362
|
}
|
|
4982
5363
|
function wrapChatCompletionsCreate(create) {
|
|
4983
|
-
return (request, options) =>
|
|
5364
|
+
return (request, options) => _chunkP25IOOU4js.groqChannels.chatCompletionsCreate.tracePromise(
|
|
4984
5365
|
() => create(request, options),
|
|
4985
5366
|
{ arguments: [request] }
|
|
4986
5367
|
);
|
|
4987
5368
|
}
|
|
4988
5369
|
function wrapEmbeddingsCreate2(create) {
|
|
4989
|
-
return (request, options) =>
|
|
5370
|
+
return (request, options) => _chunkP25IOOU4js.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
|
|
4990
5371
|
arguments: [request]
|
|
4991
5372
|
});
|
|
4992
5373
|
}
|
|
@@ -5060,16 +5441,16 @@ function bedrockRuntimeProxy(client) {
|
|
|
5060
5441
|
}
|
|
5061
5442
|
function wrapSend(send) {
|
|
5062
5443
|
return (command, optionsOrCb, cb) => {
|
|
5063
|
-
if (
|
|
5444
|
+
if (_chunkGSIDVFE6js.getBedrockRuntimeOperation.call(void 0, command) === void 0 || typeof optionsOrCb === "function" || typeof cb === "function") {
|
|
5064
5445
|
return send(command, optionsOrCb, cb);
|
|
5065
5446
|
}
|
|
5066
|
-
return
|
|
5067
|
-
() =>
|
|
5447
|
+
return _chunkP25IOOU4js.bedrockRuntimeChannels.clientSend.tracePromise(
|
|
5448
|
+
() => _chunkGSIDVFE6js.runWithAutoInstrumentationSuppressed.call(void 0,
|
|
5068
5449
|
() => send(command, optionsOrCb)
|
|
5069
5450
|
),
|
|
5070
5451
|
{
|
|
5071
5452
|
arguments: [command, optionsOrCb],
|
|
5072
|
-
span_info:
|
|
5453
|
+
span_info: _chunkGSIDVFE6js.buildBedrockRuntimeSpanInfo.call(void 0, command)
|
|
5073
5454
|
}
|
|
5074
5455
|
);
|
|
5075
5456
|
};
|
|
@@ -5118,13 +5499,13 @@ function copilotClientProxy(client) {
|
|
|
5118
5499
|
return proxy;
|
|
5119
5500
|
}
|
|
5120
5501
|
function wrappedCreateSession(client) {
|
|
5121
|
-
return (config) =>
|
|
5502
|
+
return (config) => _chunkP25IOOU4js.gitHubCopilotChannels.createSession.tracePromise(
|
|
5122
5503
|
() => client.createSession(config),
|
|
5123
5504
|
{ arguments: [config] }
|
|
5124
5505
|
);
|
|
5125
5506
|
}
|
|
5126
5507
|
function wrappedResumeSession(client) {
|
|
5127
|
-
return (sessionId, config) =>
|
|
5508
|
+
return (sessionId, config) => _chunkP25IOOU4js.gitHubCopilotChannels.resumeSession.tracePromise(
|
|
5128
5509
|
() => client.resumeSession(sessionId, config),
|
|
5129
5510
|
{ arguments: [sessionId, config] }
|
|
5130
5511
|
);
|
|
@@ -5229,7 +5610,7 @@ function isModuleNamespace5(value) {
|
|
|
5229
5610
|
if (!value || typeof value !== "object") {
|
|
5230
5611
|
return false;
|
|
5231
5612
|
}
|
|
5232
|
-
if (_optionalChain([value, 'access',
|
|
5613
|
+
if (_optionalChain([value, 'access', _126 => _126.constructor, 'optionalAccess', _127 => _127.name]) === "Module") {
|
|
5233
5614
|
return true;
|
|
5234
5615
|
}
|
|
5235
5616
|
const firstKey = Object.keys(value)[0];
|
|
@@ -5253,7 +5634,7 @@ function wrapTraceable(traceable2) {
|
|
|
5253
5634
|
apply(target, thisArg, argArray) {
|
|
5254
5635
|
const [fn, rawConfig] = argArray;
|
|
5255
5636
|
const config = rawConfig && typeof rawConfig === "object" ? rawConfig : void 0;
|
|
5256
|
-
const originalOnEnd = _optionalChain([config, 'optionalAccess',
|
|
5637
|
+
const originalOnEnd = _optionalChain([config, 'optionalAccess', _128 => _128.on_end]);
|
|
5257
5638
|
const wrappedConfig = {
|
|
5258
5639
|
...config,
|
|
5259
5640
|
on_end(runTree) {
|
|
@@ -5302,13 +5683,13 @@ function wrapRunTreeInstance(runTree) {
|
|
|
5302
5683
|
wrapped = (...args) => wrapRunTreeInstance(Reflect.apply(value, target, args));
|
|
5303
5684
|
} else if (prop === "postRun") {
|
|
5304
5685
|
const method = value;
|
|
5305
|
-
wrapped = (...args) =>
|
|
5686
|
+
wrapped = (...args) => _chunkP25IOOU4js.langSmithChannels.createRun.tracePromise(
|
|
5306
5687
|
() => Reflect.apply(method, target, args),
|
|
5307
5688
|
{ arguments: [target] }
|
|
5308
5689
|
);
|
|
5309
5690
|
} else if (prop === "patchRun") {
|
|
5310
5691
|
const method = value;
|
|
5311
|
-
wrapped = (...args) =>
|
|
5692
|
+
wrapped = (...args) => _chunkP25IOOU4js.langSmithChannels.updateRun.tracePromise(
|
|
5312
5693
|
() => Reflect.apply(method, target, args),
|
|
5313
5694
|
{
|
|
5314
5695
|
arguments: [
|
|
@@ -5357,19 +5738,19 @@ function wrapClientInstance(client) {
|
|
|
5357
5738
|
let wrapped;
|
|
5358
5739
|
if (prop === "createRun") {
|
|
5359
5740
|
const method = value;
|
|
5360
|
-
wrapped = (...args) =>
|
|
5741
|
+
wrapped = (...args) => _chunkP25IOOU4js.langSmithChannels.createRun.tracePromise(
|
|
5361
5742
|
() => Reflect.apply(method, target, args),
|
|
5362
5743
|
{ arguments: args }
|
|
5363
5744
|
);
|
|
5364
5745
|
} else if (prop === "updateRun") {
|
|
5365
5746
|
const method = value;
|
|
5366
|
-
wrapped = (...args) =>
|
|
5747
|
+
wrapped = (...args) => _chunkP25IOOU4js.langSmithChannels.updateRun.tracePromise(
|
|
5367
5748
|
() => Reflect.apply(method, target, args),
|
|
5368
5749
|
{ arguments: args }
|
|
5369
5750
|
);
|
|
5370
5751
|
} else if (prop === "batchIngestRuns") {
|
|
5371
5752
|
const method = value;
|
|
5372
|
-
wrapped = (...args) =>
|
|
5753
|
+
wrapped = (...args) => _chunkP25IOOU4js.langSmithChannels.batchIngestRuns.tracePromise(
|
|
5373
5754
|
() => Reflect.apply(method, target, args),
|
|
5374
5755
|
{ arguments: args }
|
|
5375
5756
|
);
|
|
@@ -5385,13 +5766,13 @@ function publishRunUpdate(runTree) {
|
|
|
5385
5766
|
return;
|
|
5386
5767
|
}
|
|
5387
5768
|
try {
|
|
5388
|
-
void
|
|
5769
|
+
void _chunkP25IOOU4js.langSmithChannels.updateRun.tracePromise(() => Promise.resolve(void 0), {
|
|
5389
5770
|
arguments: [runTree.id, runTree]
|
|
5390
5771
|
}).catch((error) => {
|
|
5391
|
-
|
|
5772
|
+
_chunkGSIDVFE6js.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
5392
5773
|
});
|
|
5393
5774
|
} catch (error) {
|
|
5394
|
-
|
|
5775
|
+
_chunkGSIDVFE6js.debugLogger.error("LangSmith traceable instrumentation failed:", error);
|
|
5395
5776
|
}
|
|
5396
5777
|
}
|
|
5397
5778
|
|
|
@@ -5403,7 +5784,7 @@ var VitestContextManager = class {
|
|
|
5403
5784
|
*/
|
|
5404
5785
|
|
|
5405
5786
|
constructor() {
|
|
5406
|
-
this.contextStorage =
|
|
5787
|
+
this.contextStorage = _chunkP25IOOU4js.isomorph_default.newAsyncLocalStorage();
|
|
5407
5788
|
}
|
|
5408
5789
|
getCurrentContext() {
|
|
5409
5790
|
return this.contextStorage.getStore();
|
|
@@ -5444,7 +5825,7 @@ var FlushCoordinator = (_class2 = class {constructor() { _class2.prototype.__ini
|
|
|
5444
5825
|
if (this.activeFlushes.has(experimentId)) {
|
|
5445
5826
|
return this.activeFlushes.get(experimentId);
|
|
5446
5827
|
}
|
|
5447
|
-
const flushPromise =
|
|
5828
|
+
const flushPromise = _chunkGSIDVFE6js.summarizeAndFlush.call(void 0, context.experiment, {
|
|
5448
5829
|
displaySummary: config.displaySummary
|
|
5449
5830
|
});
|
|
5450
5831
|
this.activeFlushes.set(experimentId, flushPromise);
|
|
@@ -5542,7 +5923,7 @@ async function runTracedEval(args) {
|
|
|
5542
5923
|
}
|
|
5543
5924
|
if (testError) {
|
|
5544
5925
|
span.log({ scores: { pass: 0 } });
|
|
5545
|
-
|
|
5926
|
+
_chunkGSIDVFE6js.logError.call(void 0, span, testError);
|
|
5546
5927
|
throw testError;
|
|
5547
5928
|
}
|
|
5548
5929
|
span.log({
|
|
@@ -5575,7 +5956,7 @@ function wrapTest(originalTest, config) {
|
|
|
5575
5956
|
const wrapped = function(name, configOrFn, maybeFn) {
|
|
5576
5957
|
const isEnhanced = typeof configOrFn !== "function";
|
|
5577
5958
|
const testConfig = isEnhanced ? configOrFn : void 0;
|
|
5578
|
-
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess',
|
|
5959
|
+
if (isEnhanced && _optionalChain([testConfig, 'optionalAccess', _129 => _129.data]) && Array.isArray(testConfig.data)) {
|
|
5579
5960
|
const dataRecords = testConfig.data;
|
|
5580
5961
|
const testFn2 = maybeFn;
|
|
5581
5962
|
if (!testFn2) {
|
|
@@ -5613,7 +5994,7 @@ function wrapTest(originalTest, config) {
|
|
|
5613
5994
|
const registrationContext = getExperimentContext();
|
|
5614
5995
|
const testImplementation = async (vitestContext) => {
|
|
5615
5996
|
const experimentContext = _nullishCoalesce(getExperimentContext(), () => ( registrationContext));
|
|
5616
|
-
const experiment = _optionalChain([experimentContext, 'optionalAccess',
|
|
5997
|
+
const experiment = _optionalChain([experimentContext, 'optionalAccess', _130 => _130.experiment]);
|
|
5617
5998
|
if (config.onProgress) {
|
|
5618
5999
|
config.onProgress({ type: "test_start", testName: name });
|
|
5619
6000
|
}
|
|
@@ -5645,11 +6026,11 @@ function wrapTest(originalTest, config) {
|
|
|
5645
6026
|
const result = await runTracedEval({
|
|
5646
6027
|
experiment,
|
|
5647
6028
|
spanName: name,
|
|
5648
|
-
input: _optionalChain([testConfig, 'optionalAccess',
|
|
5649
|
-
expected: _optionalChain([testConfig, 'optionalAccess',
|
|
5650
|
-
metadata: _optionalChain([testConfig, 'optionalAccess',
|
|
5651
|
-
tags: _optionalChain([testConfig, 'optionalAccess',
|
|
5652
|
-
scorers: _optionalChain([testConfig, 'optionalAccess',
|
|
6029
|
+
input: _optionalChain([testConfig, 'optionalAccess', _131 => _131.input]),
|
|
6030
|
+
expected: _optionalChain([testConfig, 'optionalAccess', _132 => _132.expected]),
|
|
6031
|
+
metadata: _optionalChain([testConfig, 'optionalAccess', _133 => _133.metadata]),
|
|
6032
|
+
tags: _optionalChain([testConfig, 'optionalAccess', _134 => _134.tags]),
|
|
6033
|
+
scorers: _optionalChain([testConfig, 'optionalAccess', _135 => _135.scorers]),
|
|
5653
6034
|
fn: async () => {
|
|
5654
6035
|
if (testConfig && maybeFn) {
|
|
5655
6036
|
const params = {
|
|
@@ -5716,10 +6097,10 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
5716
6097
|
const getOrCreateContext = () => {
|
|
5717
6098
|
if (!context) {
|
|
5718
6099
|
const experimentName = `${suiteName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
5719
|
-
const experiment = config.projectId ?
|
|
6100
|
+
const experiment = config.projectId ? _chunkGSIDVFE6js.initExperiment.call(void 0, {
|
|
5720
6101
|
projectId: config.projectId,
|
|
5721
6102
|
experiment: experimentName
|
|
5722
|
-
}) :
|
|
6103
|
+
}) : _chunkGSIDVFE6js.initExperiment.call(void 0, config.projectName || suiteName, {
|
|
5723
6104
|
experiment: experimentName
|
|
5724
6105
|
});
|
|
5725
6106
|
context = contextManager.createChildContext(void 0, experiment);
|
|
@@ -5764,8 +6145,8 @@ function wrapDescribe(originalDescribe, config, afterAll) {
|
|
|
5764
6145
|
config.onProgress({
|
|
5765
6146
|
type: "suite_complete",
|
|
5766
6147
|
suiteName,
|
|
5767
|
-
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
5768
|
-
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess',
|
|
6148
|
+
passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _136 => _136.passed]), () => ( 0)),
|
|
6149
|
+
failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _137 => _137.failed]), () => ( 0))
|
|
5769
6150
|
});
|
|
5770
6151
|
}
|
|
5771
6152
|
});
|
|
@@ -5827,7 +6208,7 @@ function wrapExpect(originalExpect) {
|
|
|
5827
6208
|
return originalExpect(value);
|
|
5828
6209
|
}
|
|
5829
6210
|
const assertion = originalExpect(value, message);
|
|
5830
|
-
const span =
|
|
6211
|
+
const span = _chunkGSIDVFE6js.currentSpan.call(void 0, );
|
|
5831
6212
|
if (!span) {
|
|
5832
6213
|
return assertion;
|
|
5833
6214
|
}
|
|
@@ -5839,16 +6220,16 @@ function wrapExpect(originalExpect) {
|
|
|
5839
6220
|
|
|
5840
6221
|
// src/wrappers/shared/logging.ts
|
|
5841
6222
|
function logOutputs(outputs) {
|
|
5842
|
-
|
|
6223
|
+
_chunkGSIDVFE6js.currentSpan.call(void 0, ).log({ output: outputs });
|
|
5843
6224
|
}
|
|
5844
6225
|
function logFeedback(feedback) {
|
|
5845
|
-
|
|
6226
|
+
_chunkGSIDVFE6js.currentSpan.call(void 0, ).log({
|
|
5846
6227
|
scores: { [feedback.name]: feedback.score },
|
|
5847
6228
|
metadata: feedback.metadata
|
|
5848
6229
|
});
|
|
5849
6230
|
}
|
|
5850
6231
|
function getCurrentSpan() {
|
|
5851
|
-
return
|
|
6232
|
+
return _chunkGSIDVFE6js.currentSpan.call(void 0, );
|
|
5852
6233
|
}
|
|
5853
6234
|
|
|
5854
6235
|
// src/wrappers/vitest/index.ts
|
|
@@ -5896,8 +6277,8 @@ function wrapVitest(vitestMethods, config = {}) {
|
|
|
5896
6277
|
);
|
|
5897
6278
|
return;
|
|
5898
6279
|
}
|
|
5899
|
-
await
|
|
5900
|
-
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6280
|
+
await _chunkGSIDVFE6js.summarizeAndFlush.call(void 0, ctx.experiment, {
|
|
6281
|
+
displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _138 => _138.displaySummary]), () => ( config.displaySummary))
|
|
5901
6282
|
});
|
|
5902
6283
|
}
|
|
5903
6284
|
};
|
|
@@ -5911,7 +6292,7 @@ function initNodeTestSuite(config) {
|
|
|
5911
6292
|
return experiment;
|
|
5912
6293
|
}
|
|
5913
6294
|
const experimentName = config.experimentName || `${config.projectName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
5914
|
-
experiment =
|
|
6295
|
+
experiment = _chunkGSIDVFE6js.initExperiment.call(void 0, config.projectName, {
|
|
5915
6296
|
experiment: experimentName
|
|
5916
6297
|
});
|
|
5917
6298
|
return experiment;
|
|
@@ -5960,7 +6341,7 @@ function initNodeTestSuite(config) {
|
|
|
5960
6341
|
if (!experiment) {
|
|
5961
6342
|
return;
|
|
5962
6343
|
}
|
|
5963
|
-
await
|
|
6344
|
+
await _chunkGSIDVFE6js.summarizeAndFlush.call(void 0, experiment, {
|
|
5964
6345
|
displaySummary: config.displaySummary
|
|
5965
6346
|
});
|
|
5966
6347
|
experiment = void 0;
|
|
@@ -5977,7 +6358,7 @@ function initNodeTestSuite(config) {
|
|
|
5977
6358
|
|
|
5978
6359
|
// src/graph-framework.ts
|
|
5979
6360
|
var graph_framework_exports = {};
|
|
5980
|
-
|
|
6361
|
+
_chunkP25IOOU4js.__export.call(void 0, graph_framework_exports, {
|
|
5981
6362
|
AggregatorNode: () => AggregatorNode,
|
|
5982
6363
|
GateNode: () => GateNode,
|
|
5983
6364
|
GraphBuilder: () => GraphBuilder,
|
|
@@ -6051,7 +6432,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6051
6432
|
};
|
|
6052
6433
|
}
|
|
6053
6434
|
resolveNode(node) {
|
|
6054
|
-
if (node instanceof
|
|
6435
|
+
if (node instanceof _chunkGSIDVFE6js.Prompt) {
|
|
6055
6436
|
const cached = this.nodeLikeNodes.get(node);
|
|
6056
6437
|
if (cached) {
|
|
6057
6438
|
return [cached, []];
|
|
@@ -6101,7 +6482,7 @@ var GraphBuilder = (_class3 = class {
|
|
|
6101
6482
|
// }
|
|
6102
6483
|
// Helper to generate node IDs
|
|
6103
6484
|
generateId(name) {
|
|
6104
|
-
const uuid =
|
|
6485
|
+
const uuid = _chunkGSIDVFE6js.newId.call(void 0, );
|
|
6105
6486
|
if (name) {
|
|
6106
6487
|
return `${name}-${uuid.slice(0, 8)}`;
|
|
6107
6488
|
} else {
|
|
@@ -6142,6 +6523,8 @@ var BaseNode = (_class4 = class {
|
|
|
6142
6523
|
this.graph = graph;
|
|
6143
6524
|
this.id = id;
|
|
6144
6525
|
}
|
|
6526
|
+
|
|
6527
|
+
|
|
6145
6528
|
__init9() {this.__type = "node"}
|
|
6146
6529
|
__init10() {this.dependencies = []}
|
|
6147
6530
|
addDependency(dependency) {
|
|
@@ -6175,6 +6558,7 @@ var PromptNode = class extends BaseNode {
|
|
|
6175
6558
|
super(graph, id);
|
|
6176
6559
|
this.prompt = prompt;
|
|
6177
6560
|
}
|
|
6561
|
+
|
|
6178
6562
|
async build(context) {
|
|
6179
6563
|
return {
|
|
6180
6564
|
type: "function",
|
|
@@ -6187,6 +6571,7 @@ var GateNode = class extends BaseNode {
|
|
|
6187
6571
|
super(graph, id);
|
|
6188
6572
|
this.condition = condition;
|
|
6189
6573
|
}
|
|
6574
|
+
|
|
6190
6575
|
async build(context) {
|
|
6191
6576
|
return {
|
|
6192
6577
|
type: "gate",
|
|
@@ -6211,6 +6596,7 @@ var PromptTemplateNode = class extends BaseNode {
|
|
|
6211
6596
|
super(graph, id);
|
|
6212
6597
|
this.prompt = prompt;
|
|
6213
6598
|
}
|
|
6599
|
+
|
|
6214
6600
|
async build(context) {
|
|
6215
6601
|
return {
|
|
6216
6602
|
type: "prompt_template",
|
|
@@ -6223,6 +6609,7 @@ var LiteralNode = class extends BaseNode {
|
|
|
6223
6609
|
super(graph, id);
|
|
6224
6610
|
this.value = value;
|
|
6225
6611
|
}
|
|
6612
|
+
|
|
6226
6613
|
async build(context) {
|
|
6227
6614
|
return {
|
|
6228
6615
|
type: "literal",
|
|
@@ -7295,7 +7682,7 @@ function waterfall(tasks, callback) {
|
|
|
7295
7682
|
var waterfall$1 = awaitify(waterfall);
|
|
7296
7683
|
|
|
7297
7684
|
// src/trace.ts
|
|
7298
|
-
var SpanFetcher = class _SpanFetcher extends
|
|
7685
|
+
var SpanFetcher = class _SpanFetcher extends _chunkGSIDVFE6js.ObjectFetcher {
|
|
7299
7686
|
constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter, includeScorers = false, brainstoreRealtime = true) {
|
|
7300
7687
|
const filterExpr = _SpanFetcher.buildFilter(
|
|
7301
7688
|
rootSpanId,
|
|
@@ -7316,6 +7703,10 @@ var SpanFetcher = class _SpanFetcher extends _chunkB6ZQIAK3js.ObjectFetcher {
|
|
|
7316
7703
|
this._state = _state;
|
|
7317
7704
|
this.spanTypeFilter = spanTypeFilter;
|
|
7318
7705
|
}
|
|
7706
|
+
|
|
7707
|
+
|
|
7708
|
+
|
|
7709
|
+
|
|
7319
7710
|
static buildFilter(rootSpanId, spanTypeFilter, includeScorers = false) {
|
|
7320
7711
|
const children = [
|
|
7321
7712
|
// Base filter: root_span_id = 'value'
|
|
@@ -7428,7 +7819,7 @@ var CachedSpanFetcher = (_class5 = class {
|
|
|
7428
7819
|
async fetchSpans(spanType) {
|
|
7429
7820
|
const spans = await this.fetchFn(spanType, false);
|
|
7430
7821
|
for (const span of spans) {
|
|
7431
|
-
const type = _nullishCoalesce(_optionalChain([span, 'access',
|
|
7822
|
+
const type = _nullishCoalesce(_optionalChain([span, 'access', _139 => _139.span_attributes, 'optionalAccess', _140 => _140.type]), () => ( ""));
|
|
7432
7823
|
const existing = _nullishCoalesce(this.spanCache.get(type), () => ( []));
|
|
7433
7824
|
existing.push(span);
|
|
7434
7825
|
this.spanCache.set(type, existing);
|
|
@@ -7511,11 +7902,11 @@ var LocalTrace = (_class6 = class {
|
|
|
7511
7902
|
const cachedSpans = this.state.spanCache.getByRootSpanId(this.rootSpanId);
|
|
7512
7903
|
if (cachedSpans && cachedSpans.length > 0) {
|
|
7513
7904
|
let spans = includeScorers ? cachedSpans : cachedSpans.filter(
|
|
7514
|
-
(span) => _optionalChain([span, 'access',
|
|
7905
|
+
(span) => _optionalChain([span, 'access', _141 => _141.span_attributes, 'optionalAccess', _142 => _142.purpose]) !== "scorer"
|
|
7515
7906
|
);
|
|
7516
7907
|
if (spanType && spanType.length > 0) {
|
|
7517
7908
|
spans = spans.filter(
|
|
7518
|
-
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access',
|
|
7909
|
+
(span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access', _143 => _143.span_attributes, 'optionalAccess', _144 => _144.type]), () => ( "")))
|
|
7519
7910
|
);
|
|
7520
7911
|
}
|
|
7521
7912
|
return spans.map((span) => ({
|
|
@@ -7540,7 +7931,7 @@ var LocalTrace = (_class6 = class {
|
|
|
7540
7931
|
* Calls the API with the project_default preprocessor (which falls back to "thread").
|
|
7541
7932
|
*/
|
|
7542
7933
|
async getThread(options) {
|
|
7543
|
-
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7934
|
+
const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _145 => _145.preprocessor]), () => ( "project_default"));
|
|
7544
7935
|
if (!this.threadCache.has(cacheKey)) {
|
|
7545
7936
|
const promise = this.fetchThread(options);
|
|
7546
7937
|
this.threadCache.set(cacheKey, promise);
|
|
@@ -7551,7 +7942,7 @@ var LocalTrace = (_class6 = class {
|
|
|
7551
7942
|
await this.ensureSpansReady();
|
|
7552
7943
|
await this.state.login({});
|
|
7553
7944
|
const result = await invoke({
|
|
7554
|
-
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7945
|
+
globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _146 => _146.preprocessor]), () => ( "project_default")),
|
|
7555
7946
|
functionType: "preprocessor",
|
|
7556
7947
|
input: {
|
|
7557
7948
|
trace_ref: {
|
|
@@ -7608,20 +7999,20 @@ var promptContentsSchema = _v3.z.union([
|
|
|
7608
7999
|
prompt: _v3.z.string()
|
|
7609
8000
|
}),
|
|
7610
8001
|
_v3.z.object({
|
|
7611
|
-
messages: _v3.z.array(
|
|
8002
|
+
messages: _v3.z.array(_chunkGSIDVFE6js.ChatCompletionMessageParam)
|
|
7612
8003
|
})
|
|
7613
8004
|
]);
|
|
7614
8005
|
var promptDefinitionSchema = promptContentsSchema.and(
|
|
7615
8006
|
_v3.z.object({
|
|
7616
8007
|
model: _v3.z.string(),
|
|
7617
|
-
params:
|
|
8008
|
+
params: _chunkGSIDVFE6js.ModelParams.optional(),
|
|
7618
8009
|
templateFormat: _v3.z.enum(["mustache", "nunjucks", "none"]).optional(),
|
|
7619
8010
|
environments: _v3.z.array(_v3.z.string()).optional()
|
|
7620
8011
|
})
|
|
7621
8012
|
);
|
|
7622
8013
|
var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
|
|
7623
8014
|
_v3.z.object({
|
|
7624
|
-
tools: _v3.z.array(
|
|
8015
|
+
tools: _v3.z.array(_chunkGSIDVFE6js.ToolFunctionDefinition).optional()
|
|
7625
8016
|
})
|
|
7626
8017
|
);
|
|
7627
8018
|
function promptDefinitionToPromptData(promptDefinition, rawTools) {
|
|
@@ -7669,7 +8060,7 @@ async function validateParameters(parameters, parameterSchema) {
|
|
|
7669
8060
|
if (resolvedSchema === void 0 || resolvedSchema === null) {
|
|
7670
8061
|
return parameters;
|
|
7671
8062
|
}
|
|
7672
|
-
if (
|
|
8063
|
+
if (_chunkGSIDVFE6js.RemoteEvalParameters.isParameters(resolvedSchema)) {
|
|
7673
8064
|
const mergedParameters = parameters && Object.keys(parameters).length > 0 ? {
|
|
7674
8065
|
...resolvedSchema.data,
|
|
7675
8066
|
...parameters
|
|
@@ -7691,14 +8082,14 @@ function validateParametersWithZod(parameters, parameterSchema) {
|
|
|
7691
8082
|
const value = parameters[name];
|
|
7692
8083
|
try {
|
|
7693
8084
|
if ("type" in schema && schema.type === "prompt") {
|
|
7694
|
-
const promptData = value ?
|
|
8085
|
+
const promptData = value ? _chunkGSIDVFE6js.PromptData.parse(value) : schema.default ? promptDefinitionToPromptData(
|
|
7695
8086
|
schema.default,
|
|
7696
8087
|
schema.default.tools
|
|
7697
8088
|
) : void 0;
|
|
7698
8089
|
if (!promptData) {
|
|
7699
8090
|
throw new Error(`Parameter '${name}' is required`);
|
|
7700
8091
|
}
|
|
7701
|
-
return [name,
|
|
8092
|
+
return [name, _chunkGSIDVFE6js.Prompt.fromPromptData(name, promptData)];
|
|
7702
8093
|
} else if ("type" in schema && schema.type === "model") {
|
|
7703
8094
|
const model = _nullishCoalesce(value, () => ( schema.default));
|
|
7704
8095
|
if (model === void 0) {
|
|
@@ -7727,10 +8118,10 @@ function validateParametersWithJsonSchema(parameters, schema) {
|
|
|
7727
8118
|
const ajv = new (0, _ajv2.default)({ coerceTypes: true, useDefaults: true, strict: false });
|
|
7728
8119
|
const validate = ajv.compile(schema);
|
|
7729
8120
|
if (!validate(parameters)) {
|
|
7730
|
-
const errorMessages = _optionalChain([validate, 'access',
|
|
8121
|
+
const errorMessages = _optionalChain([validate, 'access', _147 => _147.errors, 'optionalAccess', _148 => _148.map, 'call', _149 => _149((err) => {
|
|
7731
8122
|
const path = err.instancePath || "root";
|
|
7732
8123
|
return `${path}: ${err.message}`;
|
|
7733
|
-
}), 'access',
|
|
8124
|
+
}), 'access', _150 => _150.join, 'call', _151 => _151(", ")]);
|
|
7734
8125
|
throw Error(`Invalid parameters: ${errorMessages}`);
|
|
7735
8126
|
}
|
|
7736
8127
|
return rehydrateRemoteParameters(parameters, schema);
|
|
@@ -7749,7 +8140,7 @@ function rehydrateRemoteParameters(parameters, schema) {
|
|
|
7749
8140
|
if (Reflect.get(propertySchema, "x-bt-type") === "prompt") {
|
|
7750
8141
|
return [
|
|
7751
8142
|
name,
|
|
7752
|
-
|
|
8143
|
+
_chunkGSIDVFE6js.Prompt.fromPromptData(name, _chunkGSIDVFE6js.PromptData.parse(value))
|
|
7753
8144
|
];
|
|
7754
8145
|
}
|
|
7755
8146
|
return [name, value];
|
|
@@ -7766,6 +8157,8 @@ var EvalResultWithSummary = class {
|
|
|
7766
8157
|
this.summary = summary;
|
|
7767
8158
|
this.results = results;
|
|
7768
8159
|
}
|
|
8160
|
+
|
|
8161
|
+
|
|
7769
8162
|
/**
|
|
7770
8163
|
* @deprecated Use `summary` instead.
|
|
7771
8164
|
*/
|
|
@@ -7785,7 +8178,7 @@ var EvalResultWithSummary = class {
|
|
|
7785
8178
|
async function getPersistedBaseExperimentId(experiment) {
|
|
7786
8179
|
try {
|
|
7787
8180
|
return await experiment._getBaseExperimentId();
|
|
7788
|
-
} catch (
|
|
8181
|
+
} catch (e8) {
|
|
7789
8182
|
return void 0;
|
|
7790
8183
|
}
|
|
7791
8184
|
}
|
|
@@ -7797,7 +8190,7 @@ function makeEvalName(projectName, experimentName) {
|
|
|
7797
8190
|
return out;
|
|
7798
8191
|
}
|
|
7799
8192
|
function initExperiment2(state, options = {}) {
|
|
7800
|
-
return
|
|
8193
|
+
return _chunkGSIDVFE6js.init.call(void 0, {
|
|
7801
8194
|
state,
|
|
7802
8195
|
...options,
|
|
7803
8196
|
setCurrent: false
|
|
@@ -7808,7 +8201,7 @@ async function getExperimentParametersRef(parameters) {
|
|
|
7808
8201
|
return void 0;
|
|
7809
8202
|
}
|
|
7810
8203
|
const resolvedParameters = parameters instanceof Promise ? await parameters : parameters;
|
|
7811
|
-
if (!
|
|
8204
|
+
if (!_chunkGSIDVFE6js.RemoteEvalParameters.isParameters(resolvedParameters)) {
|
|
7812
8205
|
return void 0;
|
|
7813
8206
|
}
|
|
7814
8207
|
if (resolvedParameters.id === void 0) {
|
|
@@ -7844,10 +8237,10 @@ globalThis._evals = {
|
|
|
7844
8237
|
reporters: {}
|
|
7845
8238
|
};
|
|
7846
8239
|
function _initializeSpanContext() {
|
|
7847
|
-
globalThis._spanContext = { currentSpan:
|
|
8240
|
+
globalThis._spanContext = { currentSpan: _chunkGSIDVFE6js.currentSpan, withCurrent: _chunkGSIDVFE6js.withCurrent, startSpan: _chunkGSIDVFE6js.startSpan, NOOP_SPAN: _chunkGSIDVFE6js.NOOP_SPAN };
|
|
7848
8241
|
}
|
|
7849
8242
|
async function Eval(name, evaluator, reporterOrOpts) {
|
|
7850
|
-
const options =
|
|
8243
|
+
const options = _chunkGSIDVFE6js.isEmpty.call(void 0, reporterOrOpts) ? {} : typeof reporterOrOpts === "string" ? { reporter: reporterOrOpts } : "name" in reporterOrOpts ? { reporter: reporterOrOpts } : reporterOrOpts;
|
|
7851
8244
|
let evalName = makeEvalName(name, evaluator.experimentName);
|
|
7852
8245
|
if (globalThis._evals.evaluators[evalName]) {
|
|
7853
8246
|
evalName = `${evalName}_${Object.keys(_evals).length}`;
|
|
@@ -7898,7 +8291,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7898
8291
|
baseExperimentId: evaluator.baseExperimentId,
|
|
7899
8292
|
gitMetadataSettings: evaluator.gitMetadataSettings,
|
|
7900
8293
|
repoInfo: evaluator.repoInfo,
|
|
7901
|
-
dataset:
|
|
8294
|
+
dataset: _chunkGSIDVFE6js.Dataset.isDataset(data) ? data : void 0,
|
|
7902
8295
|
parameters
|
|
7903
8296
|
});
|
|
7904
8297
|
if (experiment && typeof process !== "undefined" && globalThis.BRAINTRUST_CONTEXT_MANAGER !== void 0) {
|
|
@@ -7918,7 +8311,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7918
8311
|
const enableCache = _nullishCoalesce(options.enableCache, () => ( true));
|
|
7919
8312
|
let ret;
|
|
7920
8313
|
if (options.parent) {
|
|
7921
|
-
ret = await
|
|
8314
|
+
ret = await _chunkGSIDVFE6js.withParent.call(void 0,
|
|
7922
8315
|
options.parent,
|
|
7923
8316
|
() => runEvaluator(
|
|
7924
8317
|
null,
|
|
@@ -7954,7 +8347,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
|
|
|
7954
8347
|
if (experiment) {
|
|
7955
8348
|
await experiment.flush().catch(console.error);
|
|
7956
8349
|
} else if (options.parent) {
|
|
7957
|
-
await
|
|
8350
|
+
await _chunkGSIDVFE6js.flush.call(void 0, { state: evaluator.state }).catch(console.error);
|
|
7958
8351
|
}
|
|
7959
8352
|
}
|
|
7960
8353
|
} finally {
|
|
@@ -8000,13 +8393,13 @@ function classifierName(classifier, classifier_idx) {
|
|
|
8000
8393
|
}
|
|
8001
8394
|
function buildSpanMetadata(results) {
|
|
8002
8395
|
return results.length === 1 ? results[0].metadata : results.reduce(
|
|
8003
|
-
(prev, s) =>
|
|
8396
|
+
(prev, s) => _chunkGSIDVFE6js.mergeDicts.call(void 0, prev, { [s.name]: s.metadata }),
|
|
8004
8397
|
{}
|
|
8005
8398
|
);
|
|
8006
8399
|
}
|
|
8007
8400
|
function buildSpanScores(results) {
|
|
8008
8401
|
const scoresRecord = results.reduce(
|
|
8009
|
-
(prev, s) =>
|
|
8402
|
+
(prev, s) => _chunkGSIDVFE6js.mergeDicts.call(void 0, prev, { [s.name]: s.score }),
|
|
8010
8403
|
{}
|
|
8011
8404
|
);
|
|
8012
8405
|
return { resultMetadata: buildSpanMetadata(results), scoresRecord };
|
|
@@ -8036,7 +8429,7 @@ function collectScoringResults(runResults, names, onResult) {
|
|
|
8036
8429
|
return failing;
|
|
8037
8430
|
}
|
|
8038
8431
|
function validateClassificationResult(value, scorerName2) {
|
|
8039
|
-
if (!(typeof value === "object" && value !== null && !
|
|
8432
|
+
if (!(typeof value === "object" && value !== null && !_chunkGSIDVFE6js.isEmpty.call(void 0, value))) {
|
|
8040
8433
|
throw new Error(
|
|
8041
8434
|
`When returning structured classifier results, each classification must be a non-empty object. Got: ${JSON.stringify(value)}`
|
|
8042
8435
|
);
|
|
@@ -8065,7 +8458,7 @@ function logScoringFailures(kind, failures, metadata, rootSpan, state) {
|
|
|
8065
8458
|
);
|
|
8066
8459
|
metadata[`${kind}_errors`] = errorMap;
|
|
8067
8460
|
rootSpan.log({ metadata: { [`${kind}_errors`]: errorMap } });
|
|
8068
|
-
|
|
8461
|
+
_chunkGSIDVFE6js.debugLogger.forState(state).warn(
|
|
8069
8462
|
`Found exceptions for the following ${kind}s: ${Object.keys(errorMap).join(", ")}`,
|
|
8070
8463
|
failures.map((f) => f.error)
|
|
8071
8464
|
);
|
|
@@ -8099,7 +8492,7 @@ var defaultErrorScoreHandler = ({
|
|
|
8099
8492
|
};
|
|
8100
8493
|
async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
|
|
8101
8494
|
if (enableCache) {
|
|
8102
|
-
_optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
8495
|
+
_optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _152 => _152.spanCache, 'optionalAccess', _153 => _153.start, 'call', _154 => _154()]);
|
|
8103
8496
|
}
|
|
8104
8497
|
try {
|
|
8105
8498
|
if (typeof evaluator.data === "string") {
|
|
@@ -8120,7 +8513,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8120
8513
|
);
|
|
8121
8514
|
}
|
|
8122
8515
|
let name = dataResult.name;
|
|
8123
|
-
if (
|
|
8516
|
+
if (_chunkGSIDVFE6js.isEmpty.call(void 0, name)) {
|
|
8124
8517
|
const baseExperiment = await experiment.fetchBaseExperiment();
|
|
8125
8518
|
if (!baseExperiment) {
|
|
8126
8519
|
throw new Error("BaseExperiment() failed to fetch base experiment");
|
|
@@ -8154,7 +8547,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8154
8547
|
const experimentIdPromise = experiment ? (async () => {
|
|
8155
8548
|
try {
|
|
8156
8549
|
return await experiment.id;
|
|
8157
|
-
} catch (
|
|
8550
|
+
} catch (e9) {
|
|
8158
8551
|
return void 0;
|
|
8159
8552
|
}
|
|
8160
8553
|
})() : void 0;
|
|
@@ -8170,7 +8563,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8170
8563
|
if (cancelled) {
|
|
8171
8564
|
return;
|
|
8172
8565
|
}
|
|
8173
|
-
const eventDataset = experiment ? experiment.dataset :
|
|
8566
|
+
const eventDataset = experiment ? experiment.dataset : _chunkGSIDVFE6js.Dataset.isDataset(evaluator.data) ? evaluator.data : void 0;
|
|
8174
8567
|
const inlineDatasetOrigin = eventDataset && datum.id && datum._xact_id ? {
|
|
8175
8568
|
object_type: "dataset",
|
|
8176
8569
|
object_id: await eventDataset.id,
|
|
@@ -8178,8 +8571,8 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8178
8571
|
created: datum.created,
|
|
8179
8572
|
_xact_id: datum._xact_id
|
|
8180
8573
|
} : void 0;
|
|
8181
|
-
const parsedDatumOrigin =
|
|
8182
|
-
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess',
|
|
8574
|
+
const parsedDatumOrigin = _chunkGSIDVFE6js.ObjectReference.safeParse(datum.origin);
|
|
8575
|
+
const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess', _155 => _155.success]) ? parsedDatumOrigin.data : void 0)));
|
|
8183
8576
|
const baseEvent = {
|
|
8184
8577
|
name: "eval",
|
|
8185
8578
|
spanAttributes: {
|
|
@@ -8194,26 +8587,26 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8194
8587
|
}
|
|
8195
8588
|
};
|
|
8196
8589
|
const callback = async (rootSpan) => {
|
|
8197
|
-
const state = _nullishCoalesce(evaluator.state, () => (
|
|
8590
|
+
const state = _nullishCoalesce(evaluator.state, () => ( _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, )));
|
|
8198
8591
|
const ensureSpansFlushed = async () => {
|
|
8199
8592
|
if (experiment) {
|
|
8200
|
-
await
|
|
8593
|
+
await _chunkGSIDVFE6js.flush.call(void 0, { state: experiment.loggingState });
|
|
8201
8594
|
} else if (state) {
|
|
8202
|
-
await
|
|
8595
|
+
await _chunkGSIDVFE6js.flush.call(void 0, { state });
|
|
8203
8596
|
} else {
|
|
8204
|
-
await
|
|
8597
|
+
await _chunkGSIDVFE6js.flush.call(void 0, );
|
|
8205
8598
|
}
|
|
8206
8599
|
if (state) {
|
|
8207
8600
|
await state.flushOtel();
|
|
8208
8601
|
}
|
|
8209
8602
|
};
|
|
8210
8603
|
const parentStr = state.currentParent.getStore();
|
|
8211
|
-
const parentComponents = typeof parentStr === "string" ?
|
|
8604
|
+
const parentComponents = typeof parentStr === "string" ? _chunkGSIDVFE6js.SpanComponentsV4.fromStr(parentStr) : null;
|
|
8212
8605
|
const trace = state ? new LocalTrace({
|
|
8213
|
-
objectType: parentComponents ?
|
|
8606
|
+
objectType: parentComponents ? _chunkGSIDVFE6js.spanObjectTypeV3ToTypedString.call(void 0,
|
|
8214
8607
|
parentComponents.data.object_type
|
|
8215
8608
|
) : "experiment",
|
|
8216
|
-
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async
|
|
8609
|
+
objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _156 => _156.data, 'access', async _157 => _157.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
|
|
8217
8610
|
rootSpanId: rootSpan.rootSpanId,
|
|
8218
8611
|
ensureSpansFlushed,
|
|
8219
8612
|
state
|
|
@@ -8243,10 +8636,10 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8243
8636
|
span,
|
|
8244
8637
|
parameters: _nullishCoalesce(parameters, () => ( {})),
|
|
8245
8638
|
reportProgress: (event) => {
|
|
8246
|
-
_optionalChain([stream, 'optionalCall',
|
|
8639
|
+
_optionalChain([stream, 'optionalCall', _158 => _158({
|
|
8247
8640
|
...event,
|
|
8248
8641
|
id: rootSpan.id,
|
|
8249
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
8642
|
+
origin: _optionalChain([baseEvent, 'access', _159 => _159.event, 'optionalAccess', _160 => _160.origin]),
|
|
8250
8643
|
name: evaluator.evalName,
|
|
8251
8644
|
object_type: "task"
|
|
8252
8645
|
})]);
|
|
@@ -8285,7 +8678,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8285
8678
|
trace
|
|
8286
8679
|
};
|
|
8287
8680
|
const { trace: _trace, ...scoringArgsForLogging } = scoringArgs;
|
|
8288
|
-
const propagatedEvent =
|
|
8681
|
+
const propagatedEvent = _chunkGSIDVFE6js.makeScorerPropagatedEvent.call(void 0,
|
|
8289
8682
|
await rootSpan.export()
|
|
8290
8683
|
);
|
|
8291
8684
|
const getOtherFields = (s) => {
|
|
@@ -8308,14 +8701,14 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8308
8701
|
if (scoreValue === null) return null;
|
|
8309
8702
|
if (Array.isArray(scoreValue)) {
|
|
8310
8703
|
for (const s of scoreValue) {
|
|
8311
|
-
if (!(typeof s === "object" && !
|
|
8704
|
+
if (!(typeof s === "object" && !_chunkGSIDVFE6js.isEmpty.call(void 0, s))) {
|
|
8312
8705
|
throw new Error(
|
|
8313
8706
|
`When returning an array of scores, each score must be a non-empty object. Got: ${JSON.stringify(s)}`
|
|
8314
8707
|
);
|
|
8315
8708
|
}
|
|
8316
8709
|
}
|
|
8317
8710
|
}
|
|
8318
|
-
const results = Array.isArray(scoreValue) ? scoreValue : typeof scoreValue === "object" && !
|
|
8711
|
+
const results = Array.isArray(scoreValue) ? scoreValue : typeof scoreValue === "object" && !_chunkGSIDVFE6js.isEmpty.call(void 0, scoreValue) ? [scoreValue] : [
|
|
8319
8712
|
{
|
|
8320
8713
|
name: scorerNames[score_idx],
|
|
8321
8714
|
score: scoreValue
|
|
@@ -8323,7 +8716,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8323
8716
|
];
|
|
8324
8717
|
const { resultMetadata, scoresRecord } = buildSpanScores(results);
|
|
8325
8718
|
const resultOutput = results.length === 1 ? getOtherFields(results[0]) : results.reduce(
|
|
8326
|
-
(prev, s) =>
|
|
8719
|
+
(prev, s) => _chunkGSIDVFE6js.mergeDicts.call(void 0, prev, {
|
|
8327
8720
|
[s.name]: getOtherFields(s)
|
|
8328
8721
|
}),
|
|
8329
8722
|
{}
|
|
@@ -8358,7 +8751,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8358
8751
|
)
|
|
8359
8752
|
);
|
|
8360
8753
|
const resultOutput = rawResults.length === 1 ? toClassificationItem(rawResults[0]) : rawResults.reduce(
|
|
8361
|
-
(prev, r) =>
|
|
8754
|
+
(prev, r) => _chunkGSIDVFE6js.mergeDicts.call(void 0, prev, {
|
|
8362
8755
|
[r.name]: toClassificationItem(r)
|
|
8363
8756
|
}),
|
|
8364
8757
|
{}
|
|
@@ -8410,7 +8803,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8410
8803
|
evaluator.state
|
|
8411
8804
|
);
|
|
8412
8805
|
} catch (e) {
|
|
8413
|
-
|
|
8806
|
+
_chunkGSIDVFE6js.logError.call(void 0, rootSpan, e);
|
|
8414
8807
|
error = e;
|
|
8415
8808
|
} finally {
|
|
8416
8809
|
progressReporter.increment(evaluator.evalName);
|
|
@@ -8434,7 +8827,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8434
8827
|
tags: tags.length ? tags : void 0,
|
|
8435
8828
|
metadata,
|
|
8436
8829
|
error,
|
|
8437
|
-
origin: _optionalChain([baseEvent, 'access',
|
|
8830
|
+
origin: _optionalChain([baseEvent, 'access', _161 => _161.event, 'optionalAccess', _162 => _162.origin])
|
|
8438
8831
|
};
|
|
8439
8832
|
collectedResults.push({
|
|
8440
8833
|
...baseResult,
|
|
@@ -8444,7 +8837,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8444
8837
|
}
|
|
8445
8838
|
};
|
|
8446
8839
|
if (!experiment) {
|
|
8447
|
-
return await
|
|
8840
|
+
return await _chunkGSIDVFE6js.traced.call(void 0, callback, {
|
|
8448
8841
|
...baseEvent,
|
|
8449
8842
|
state: evaluator.state
|
|
8450
8843
|
});
|
|
@@ -8474,7 +8867,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8474
8867
|
break;
|
|
8475
8868
|
}
|
|
8476
8869
|
scheduledTrials++;
|
|
8477
|
-
_optionalChain([progressReporter, 'access',
|
|
8870
|
+
_optionalChain([progressReporter, 'access', _163 => _163.setTotal, 'optionalCall', _164 => _164(evaluator.evalName, scheduledTrials)]);
|
|
8478
8871
|
q.pushAsync({ datum, trialIndex }).catch((e) => {
|
|
8479
8872
|
if (queueErrors.length < 5) {
|
|
8480
8873
|
queueErrors.push(e);
|
|
@@ -8483,36 +8876,40 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8483
8876
|
}
|
|
8484
8877
|
}
|
|
8485
8878
|
})();
|
|
8879
|
+
let timeoutId;
|
|
8880
|
+
let abortHandler;
|
|
8881
|
+
const cleanupCancellation = () => {
|
|
8882
|
+
if (timeoutId !== void 0) {
|
|
8883
|
+
clearTimeout(timeoutId);
|
|
8884
|
+
timeoutId = void 0;
|
|
8885
|
+
}
|
|
8886
|
+
if (abortHandler && evaluator.signal) {
|
|
8887
|
+
evaluator.signal.removeEventListener("abort", abortHandler);
|
|
8888
|
+
abortHandler = void 0;
|
|
8889
|
+
}
|
|
8890
|
+
};
|
|
8486
8891
|
const cancel = async () => {
|
|
8487
8892
|
await new Promise((_, reject2) => {
|
|
8488
8893
|
if (cancelled) {
|
|
8489
|
-
reject2(new (0,
|
|
8894
|
+
reject2(new (0, _chunkGSIDVFE6js.InternalAbortError)("Evaluator already cancelled"));
|
|
8490
8895
|
return;
|
|
8491
8896
|
}
|
|
8492
|
-
let timeoutId;
|
|
8493
|
-
let abortHandler;
|
|
8494
8897
|
const rejectOnce = (error) => {
|
|
8495
8898
|
if (cancelled) {
|
|
8496
8899
|
return;
|
|
8497
8900
|
}
|
|
8498
8901
|
cancelled = true;
|
|
8499
|
-
|
|
8500
|
-
clearTimeout(timeoutId);
|
|
8501
|
-
timeoutId = void 0;
|
|
8502
|
-
}
|
|
8503
|
-
if (abortHandler && evaluator.signal) {
|
|
8504
|
-
evaluator.signal.removeEventListener("abort", abortHandler);
|
|
8505
|
-
}
|
|
8902
|
+
cleanupCancellation();
|
|
8506
8903
|
reject2(error);
|
|
8507
8904
|
};
|
|
8508
8905
|
if (evaluator.timeout) {
|
|
8509
8906
|
timeoutId = setTimeout(() => {
|
|
8510
|
-
rejectOnce(new (0,
|
|
8907
|
+
rejectOnce(new (0, _chunkGSIDVFE6js.InternalAbortError)("Evaluator timed out"));
|
|
8511
8908
|
}, evaluator.timeout);
|
|
8512
8909
|
}
|
|
8513
8910
|
if (evaluator.signal) {
|
|
8514
8911
|
abortHandler = () => {
|
|
8515
|
-
rejectOnce(new (0,
|
|
8912
|
+
rejectOnce(new (0, _chunkGSIDVFE6js.InternalAbortError)("Evaluator aborted"));
|
|
8516
8913
|
};
|
|
8517
8914
|
evaluator.signal.addEventListener("abort", abortHandler);
|
|
8518
8915
|
}
|
|
@@ -8535,13 +8932,14 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8535
8932
|
}
|
|
8536
8933
|
} catch (e) {
|
|
8537
8934
|
q.kill();
|
|
8538
|
-
if (e instanceof
|
|
8539
|
-
if (
|
|
8540
|
-
|
|
8935
|
+
if (e instanceof _chunkGSIDVFE6js.InternalAbortError) {
|
|
8936
|
+
if (_chunkP25IOOU4js.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
|
|
8937
|
+
_chunkGSIDVFE6js.debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
|
|
8541
8938
|
}
|
|
8542
8939
|
}
|
|
8543
8940
|
throw e;
|
|
8544
8941
|
} finally {
|
|
8942
|
+
cleanupCancellation();
|
|
8545
8943
|
if (!collectResults) {
|
|
8546
8944
|
collectedResults.length = 0;
|
|
8547
8945
|
}
|
|
@@ -8561,9 +8959,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
|
|
|
8561
8959
|
);
|
|
8562
8960
|
} finally {
|
|
8563
8961
|
if (enableCache) {
|
|
8564
|
-
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => (
|
|
8565
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
8566
|
-
_optionalChain([spanCache, 'optionalAccess',
|
|
8962
|
+
const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _165 => _165.spanCache]);
|
|
8963
|
+
_optionalChain([spanCache, 'optionalAccess', _166 => _166.dispose, 'call', _167 => _167()]);
|
|
8964
|
+
_optionalChain([spanCache, 'optionalAccess', _168 => _168.stop, 'call', _169 => _169()]);
|
|
8567
8965
|
}
|
|
8568
8966
|
}
|
|
8569
8967
|
}
|
|
@@ -8656,25 +9054,25 @@ var defaultReporter = {
|
|
|
8656
9054
|
reportFailures(evaluator, failingResults, { verbose, jsonl });
|
|
8657
9055
|
}
|
|
8658
9056
|
if (jsonl) {
|
|
8659
|
-
|
|
9057
|
+
_chunkP25IOOU4js.isomorph_default.writeln(JSON.stringify(summary));
|
|
8660
9058
|
} else {
|
|
8661
|
-
|
|
8662
|
-
|
|
9059
|
+
_chunkP25IOOU4js.isomorph_default.writeln("Experiment summary");
|
|
9060
|
+
_chunkP25IOOU4js.isomorph_default.writeln("==================");
|
|
8663
9061
|
if (summary.comparisonExperimentName) {
|
|
8664
|
-
|
|
9062
|
+
_chunkP25IOOU4js.isomorph_default.writeln(
|
|
8665
9063
|
`${summary.comparisonExperimentName} (baseline) <- ${summary.experimentName} (comparison)`
|
|
8666
9064
|
);
|
|
8667
|
-
|
|
9065
|
+
_chunkP25IOOU4js.isomorph_default.writeln("");
|
|
8668
9066
|
}
|
|
8669
9067
|
const hasScores = Object.keys(summary.scores).length > 0;
|
|
8670
9068
|
const hasMetrics = Object.keys(_nullishCoalesce(summary.metrics, () => ( {}))).length > 0;
|
|
8671
9069
|
const hasComparison = !!summary.comparisonExperimentName;
|
|
8672
9070
|
if (hasScores || hasMetrics) {
|
|
8673
9071
|
if (hasComparison) {
|
|
8674
|
-
|
|
9072
|
+
_chunkP25IOOU4js.isomorph_default.writeln(
|
|
8675
9073
|
"Name Value Change Improvements Regressions"
|
|
8676
9074
|
);
|
|
8677
|
-
|
|
9075
|
+
_chunkP25IOOU4js.isomorph_default.writeln(
|
|
8678
9076
|
"----------------------------------------------------------------"
|
|
8679
9077
|
);
|
|
8680
9078
|
}
|
|
@@ -8683,18 +9081,18 @@ var defaultReporter = {
|
|
|
8683
9081
|
const scoreValue = `${scorePercent}%`;
|
|
8684
9082
|
if (hasComparison) {
|
|
8685
9083
|
let diffString = "-";
|
|
8686
|
-
if (!
|
|
9084
|
+
if (!_chunkGSIDVFE6js.isEmpty.call(void 0, score.diff)) {
|
|
8687
9085
|
const diffPercent = (score.diff * 100).toFixed(2);
|
|
8688
9086
|
const diffSign = score.diff > 0 ? "+" : "";
|
|
8689
9087
|
diffString = `${diffSign}${diffPercent}%`;
|
|
8690
9088
|
}
|
|
8691
9089
|
const improvements = score.improvements > 0 ? score.improvements.toString() : "-";
|
|
8692
9090
|
const regressions = score.regressions > 0 ? score.regressions.toString() : "-";
|
|
8693
|
-
|
|
9091
|
+
_chunkP25IOOU4js.isomorph_default.writeln(
|
|
8694
9092
|
`${score.name.padEnd(18)} ${scoreValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
8695
9093
|
);
|
|
8696
9094
|
} else {
|
|
8697
|
-
|
|
9095
|
+
_chunkP25IOOU4js.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
|
|
8698
9096
|
}
|
|
8699
9097
|
}
|
|
8700
9098
|
for (const metric of Object.values(_nullishCoalesce(summary.metrics, () => ( {})))) {
|
|
@@ -8703,30 +9101,30 @@ var defaultReporter = {
|
|
|
8703
9101
|
const metricValue = metric.unit === "$" ? `${metric.unit}${formattedValue}` : `${formattedValue}${metric.unit}`;
|
|
8704
9102
|
if (hasComparison) {
|
|
8705
9103
|
let diffString = "-";
|
|
8706
|
-
if (!
|
|
9104
|
+
if (!_chunkGSIDVFE6js.isEmpty.call(void 0, metric.diff)) {
|
|
8707
9105
|
const diffPercent = (metric.diff * 100).toFixed(2);
|
|
8708
9106
|
const diffSign = metric.diff > 0 ? "+" : "";
|
|
8709
9107
|
diffString = `${diffSign}${diffPercent}%`;
|
|
8710
9108
|
}
|
|
8711
9109
|
const improvements = metric.improvements > 0 ? metric.improvements.toString() : "-";
|
|
8712
9110
|
const regressions = metric.regressions > 0 ? metric.regressions.toString() : "-";
|
|
8713
|
-
|
|
9111
|
+
_chunkP25IOOU4js.isomorph_default.writeln(
|
|
8714
9112
|
`${metric.name.padEnd(18)} ${metricValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
|
|
8715
9113
|
);
|
|
8716
9114
|
} else {
|
|
8717
|
-
|
|
9115
|
+
_chunkP25IOOU4js.isomorph_default.writeln(
|
|
8718
9116
|
`${metric.name.padEnd(20)} ${metricValue.padStart(15)}`
|
|
8719
9117
|
);
|
|
8720
9118
|
}
|
|
8721
9119
|
}
|
|
8722
9120
|
}
|
|
8723
9121
|
if (summary.experimentUrl) {
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
9122
|
+
_chunkP25IOOU4js.isomorph_default.writeln("");
|
|
9123
|
+
_chunkP25IOOU4js.isomorph_default.writeln(`View results for ${summary.experimentName}`);
|
|
9124
|
+
_chunkP25IOOU4js.isomorph_default.writeln(`See results at ${summary.experimentUrl}`);
|
|
8727
9125
|
}
|
|
8728
9126
|
}
|
|
8729
|
-
|
|
9127
|
+
_chunkP25IOOU4js.isomorph_default.writeln("");
|
|
8730
9128
|
return failingResults.length === 0;
|
|
8731
9129
|
},
|
|
8732
9130
|
async reportRun(evalReports) {
|
|
@@ -8746,7 +9144,7 @@ function agentAssertionScorer(callback, options = {}) {
|
|
|
8746
9144
|
});
|
|
8747
9145
|
const resources = {};
|
|
8748
9146
|
if (assertions.some((assertion) => assertion.requiresTrace)) {
|
|
8749
|
-
resources.spans = await _optionalChain([args, 'access',
|
|
9147
|
+
resources.spans = await _optionalChain([args, 'access', _170 => _170.trace, 'optionalAccess', _171 => _171.getSpans, 'call', _172 => _172({ spanType: ["tool"] })]);
|
|
8750
9148
|
}
|
|
8751
9149
|
const results = await Promise.all(
|
|
8752
9150
|
assertions.map(async (assertion) => {
|
|
@@ -8904,7 +9302,7 @@ async function validateSchema(schema, value) {
|
|
|
8904
9302
|
}
|
|
8905
9303
|
}
|
|
8906
9304
|
function toolCalls(spans) {
|
|
8907
|
-
return spans.filter((span) => _optionalChain([span, 'access',
|
|
9305
|
+
return spans.filter((span) => _optionalChain([span, 'access', _173 => _173.span_attributes, 'optionalAccess', _174 => _174.type]) === "tool");
|
|
8908
9306
|
}
|
|
8909
9307
|
function matchingToolCalls(spans, toolName, options) {
|
|
8910
9308
|
return toolCalls(spans).filter((span) => {
|
|
@@ -8922,17 +9320,17 @@ function matchingToolCalls(spans, toolName, options) {
|
|
|
8922
9320
|
});
|
|
8923
9321
|
}
|
|
8924
9322
|
function getToolName(span) {
|
|
8925
|
-
const spanName = [_optionalChain([span, 'access',
|
|
8926
|
-
if (_optionalChain([spanName, 'optionalAccess',
|
|
9323
|
+
const spanName = [_optionalChain([span, 'access', _175 => _175.span_attributes, 'optionalAccess', _176 => _176.name]), span.name].map(normalizeToolName).find((value) => value !== void 0);
|
|
9324
|
+
if (_optionalChain([spanName, 'optionalAccess', _177 => _177.includes, 'call', _178 => _178("/")])) {
|
|
8927
9325
|
return spanName;
|
|
8928
9326
|
}
|
|
8929
9327
|
const metadataName = [
|
|
8930
|
-
_optionalChain([span, 'access',
|
|
8931
|
-
_optionalChain([span, 'access',
|
|
9328
|
+
_optionalChain([span, 'access', _179 => _179.metadata, 'optionalAccess', _180 => _180.tool_name]),
|
|
9329
|
+
_optionalChain([span, 'access', _181 => _181.metadata, 'optionalAccess', _182 => _182["gen_ai.tool.name"]])
|
|
8932
9330
|
].map(normalizeToolName).find((value) => value !== void 0);
|
|
8933
9331
|
const mcpServer = [
|
|
8934
|
-
_optionalChain([span, 'access',
|
|
8935
|
-
_optionalChain([span, 'access',
|
|
9332
|
+
_optionalChain([span, 'access', _183 => _183.metadata, 'optionalAccess', _184 => _184["mcp.server"]]),
|
|
9333
|
+
_optionalChain([span, 'access', _185 => _185.metadata, 'optionalAccess', _186 => _186["openai_codex.mcp.server"]])
|
|
8936
9334
|
].find((value) => typeof value === "string" && value !== "");
|
|
8937
9335
|
if (metadataName && mcpServer) {
|
|
8938
9336
|
return `${mcpServer}/${metadataName}`;
|
|
@@ -9002,7 +9400,7 @@ function formatValue(value) {
|
|
|
9002
9400
|
return serialized;
|
|
9003
9401
|
}
|
|
9004
9402
|
return formatValueWithUndefined(value, /* @__PURE__ */ new Set());
|
|
9005
|
-
} catch (
|
|
9403
|
+
} catch (e10) {
|
|
9006
9404
|
return String(value);
|
|
9007
9405
|
}
|
|
9008
9406
|
}
|
|
@@ -9161,7 +9559,7 @@ var Project2 = (_class7 = class {
|
|
|
9161
9559
|
console.warn("publish() is a no-op when running `braintrust push`.");
|
|
9162
9560
|
return;
|
|
9163
9561
|
}
|
|
9164
|
-
await
|
|
9562
|
+
await _chunkGSIDVFE6js.login.call(void 0, );
|
|
9165
9563
|
const projectMap = new ProjectNameIdMap();
|
|
9166
9564
|
const functionDefinitions = [];
|
|
9167
9565
|
if (this._publishableCodeFunctions.length > 0) {
|
|
@@ -9175,7 +9573,7 @@ var Project2 = (_class7 = class {
|
|
|
9175
9573
|
functionDefinitions.push(functionDefinition);
|
|
9176
9574
|
}
|
|
9177
9575
|
}
|
|
9178
|
-
await
|
|
9576
|
+
await _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, ).apiConn().post_json("insert-functions", {
|
|
9179
9577
|
functions: functionDefinitions
|
|
9180
9578
|
});
|
|
9181
9579
|
}
|
|
@@ -9184,6 +9582,7 @@ var ToolBuilder = (_class8 = class {
|
|
|
9184
9582
|
constructor(project) {;_class8.prototype.__init19.call(this);
|
|
9185
9583
|
this.project = project;
|
|
9186
9584
|
}
|
|
9585
|
+
|
|
9187
9586
|
__init19() {this.taskCounter = 0}
|
|
9188
9587
|
// This type definition is just a catch all so that the implementation can be
|
|
9189
9588
|
// less specific than the two more specific declarations above.
|
|
@@ -9193,12 +9592,12 @@ var ToolBuilder = (_class8 = class {
|
|
|
9193
9592
|
const { handler, name, slug, parameters, returns, ...rest } = opts;
|
|
9194
9593
|
let resolvedName = _nullishCoalesce(name, () => ( handler.name));
|
|
9195
9594
|
if (resolvedName.trim().length === 0) {
|
|
9196
|
-
resolvedName = `Tool ${
|
|
9595
|
+
resolvedName = `Tool ${_chunkP25IOOU4js.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9197
9596
|
}
|
|
9198
9597
|
const tool = new CodeFunction(this.project, {
|
|
9199
9598
|
handler,
|
|
9200
9599
|
name: resolvedName,
|
|
9201
|
-
slug: _nullishCoalesce(slug, () => (
|
|
9600
|
+
slug: _nullishCoalesce(slug, () => ( _chunkGSIDVFE6js.slugify.call(void 0, resolvedName, { lower: true, strict: true }))),
|
|
9202
9601
|
type: "tool",
|
|
9203
9602
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions
|
|
9204
9603
|
parameters,
|
|
@@ -9214,6 +9613,7 @@ var ScorerBuilder = (_class9 = class {
|
|
|
9214
9613
|
constructor(project) {;_class9.prototype.__init20.call(this);
|
|
9215
9614
|
this.project = project;
|
|
9216
9615
|
}
|
|
9616
|
+
|
|
9217
9617
|
__init20() {this.taskCounter = 0}
|
|
9218
9618
|
create(opts) {
|
|
9219
9619
|
this.taskCounter++;
|
|
@@ -9222,9 +9622,9 @@ var ScorerBuilder = (_class9 = class {
|
|
|
9222
9622
|
resolvedName = opts.handler.name;
|
|
9223
9623
|
}
|
|
9224
9624
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9225
|
-
resolvedName = `Scorer ${
|
|
9625
|
+
resolvedName = `Scorer ${_chunkP25IOOU4js.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9226
9626
|
}
|
|
9227
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9627
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkGSIDVFE6js.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9228
9628
|
if ("handler" in opts) {
|
|
9229
9629
|
const scorer = new CodeFunction(this.project, {
|
|
9230
9630
|
...opts,
|
|
@@ -9273,14 +9673,15 @@ var ClassifierBuilder = (_class10 = class {
|
|
|
9273
9673
|
constructor(project) {;_class10.prototype.__init21.call(this);
|
|
9274
9674
|
this.project = project;
|
|
9275
9675
|
}
|
|
9676
|
+
|
|
9276
9677
|
__init21() {this.taskCounter = 0}
|
|
9277
9678
|
create(opts) {
|
|
9278
9679
|
this.taskCounter++;
|
|
9279
9680
|
let resolvedName = _nullishCoalesce(opts.name, () => ( opts.handler.name));
|
|
9280
9681
|
if (!resolvedName || resolvedName.trim().length === 0) {
|
|
9281
|
-
resolvedName = `Classifier ${
|
|
9682
|
+
resolvedName = `Classifier ${_chunkP25IOOU4js.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
|
|
9282
9683
|
}
|
|
9283
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9684
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkGSIDVFE6js.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
|
|
9284
9685
|
const classifier = new CodeFunction(this.project, {
|
|
9285
9686
|
...opts,
|
|
9286
9687
|
name: resolvedName,
|
|
@@ -9318,6 +9719,7 @@ var CodeFunction = class {
|
|
|
9318
9719
|
|
|
9319
9720
|
|
|
9320
9721
|
|
|
9722
|
+
|
|
9321
9723
|
key() {
|
|
9322
9724
|
return JSON.stringify([
|
|
9323
9725
|
_nullishCoalesce(this.project.id, () => ( "")),
|
|
@@ -9395,6 +9797,7 @@ var PromptBuilder = class {
|
|
|
9395
9797
|
constructor(project) {
|
|
9396
9798
|
this.project = project;
|
|
9397
9799
|
}
|
|
9800
|
+
|
|
9398
9801
|
create(opts) {
|
|
9399
9802
|
const toolFunctions = [];
|
|
9400
9803
|
const rawTools = [];
|
|
@@ -9407,18 +9810,18 @@ var PromptBuilder = class {
|
|
|
9407
9810
|
rawTools.push(tool);
|
|
9408
9811
|
}
|
|
9409
9812
|
}
|
|
9410
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9813
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkGSIDVFE6js.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
9411
9814
|
const promptData = promptDefinitionToPromptData(opts, rawTools);
|
|
9412
9815
|
const promptRow = {
|
|
9413
9816
|
id: opts.id,
|
|
9414
|
-
_xact_id: opts.version ?
|
|
9817
|
+
_xact_id: opts.version ? _chunkGSIDVFE6js.loadPrettyXact.call(void 0, opts.version) : void 0,
|
|
9415
9818
|
name: opts.name,
|
|
9416
9819
|
slug,
|
|
9417
9820
|
prompt_data: promptData,
|
|
9418
9821
|
tags: opts.tags,
|
|
9419
9822
|
...this.project.id !== void 0 ? { project_id: this.project.id } : {}
|
|
9420
9823
|
};
|
|
9421
|
-
const prompt = new (0,
|
|
9824
|
+
const prompt = new (0, _chunkGSIDVFE6js.Prompt)(
|
|
9422
9825
|
promptRow,
|
|
9423
9826
|
{},
|
|
9424
9827
|
// It doesn't make sense to specify defaults here.
|
|
@@ -9471,8 +9874,9 @@ var ParametersBuilder = class {
|
|
|
9471
9874
|
constructor(project) {
|
|
9472
9875
|
this.project = project;
|
|
9473
9876
|
}
|
|
9877
|
+
|
|
9474
9878
|
create(opts) {
|
|
9475
|
-
const slug = _nullishCoalesce(opts.slug, () => (
|
|
9879
|
+
const slug = _nullishCoalesce(opts.slug, () => ( _chunkGSIDVFE6js.slugify.call(void 0, opts.name, { lower: true, strict: true })));
|
|
9476
9880
|
const codeParameters = new CodeParameters(this.project, {
|
|
9477
9881
|
name: opts.name,
|
|
9478
9882
|
slug,
|
|
@@ -9511,7 +9915,7 @@ function serializeEvalParameterstoParametersSchema(parameters) {
|
|
|
9511
9915
|
required.push(name);
|
|
9512
9916
|
}
|
|
9513
9917
|
} else {
|
|
9514
|
-
const schemaObj =
|
|
9918
|
+
const schemaObj = _chunkGSIDVFE6js.zodToJsonSchema.call(void 0, value);
|
|
9515
9919
|
properties[name] = schemaObj;
|
|
9516
9920
|
if (!("default" in schemaObj)) {
|
|
9517
9921
|
required.push(name);
|
|
@@ -9540,11 +9944,11 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9540
9944
|
__init23() {this.idToName = {}}
|
|
9541
9945
|
async getId(projectName) {
|
|
9542
9946
|
if (!(projectName in this.nameToId)) {
|
|
9543
|
-
const response = await
|
|
9947
|
+
const response = await _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/register", {
|
|
9544
9948
|
project_name: projectName
|
|
9545
9949
|
});
|
|
9546
9950
|
const result = _v3.z.object({
|
|
9547
|
-
project:
|
|
9951
|
+
project: _chunkGSIDVFE6js.Project
|
|
9548
9952
|
}).parse(response);
|
|
9549
9953
|
const projectId = result.project.id;
|
|
9550
9954
|
this.nameToId[projectName] = projectId;
|
|
@@ -9554,10 +9958,10 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9554
9958
|
}
|
|
9555
9959
|
async getName(projectId) {
|
|
9556
9960
|
if (!(projectId in this.idToName)) {
|
|
9557
|
-
const response = await
|
|
9961
|
+
const response = await _chunkGSIDVFE6js._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/get", {
|
|
9558
9962
|
id: projectId
|
|
9559
9963
|
});
|
|
9560
|
-
const result = _v3.z.array(
|
|
9964
|
+
const result = _v3.z.array(_chunkGSIDVFE6js.Project).nonempty().parse(response);
|
|
9561
9965
|
const projectName = result[0].name;
|
|
9562
9966
|
this.idToName[projectId] = projectName;
|
|
9563
9967
|
this.nameToId[projectName] = projectId;
|
|
@@ -9577,16 +9981,16 @@ var ProjectNameIdMap = (_class11 = class {constructor() { _class11.prototype.__i
|
|
|
9577
9981
|
var evalBodySchema = _v3.z.object({
|
|
9578
9982
|
name: _v3.z.string(),
|
|
9579
9983
|
parameters: _v3.z.record(_v3.z.string(), _v3.z.unknown()).nullish(),
|
|
9580
|
-
data:
|
|
9984
|
+
data: _chunkGSIDVFE6js.RunEval.shape.data,
|
|
9581
9985
|
scores: _v3.z.array(
|
|
9582
9986
|
_v3.z.object({
|
|
9583
|
-
function_id:
|
|
9987
|
+
function_id: _chunkGSIDVFE6js.FunctionId,
|
|
9584
9988
|
name: _v3.z.string()
|
|
9585
9989
|
})
|
|
9586
9990
|
).nullish(),
|
|
9587
9991
|
experiment_name: _v3.z.string().nullish(),
|
|
9588
9992
|
project_id: _v3.z.string().nullish(),
|
|
9589
|
-
parent:
|
|
9993
|
+
parent: _chunkGSIDVFE6js.InvokeParent.optional(),
|
|
9590
9994
|
stream: _v3.z.boolean().optional()
|
|
9591
9995
|
});
|
|
9592
9996
|
var staticParametersSchema = _v3.z.record(
|
|
@@ -9594,7 +9998,7 @@ var staticParametersSchema = _v3.z.record(
|
|
|
9594
9998
|
_v3.z.union([
|
|
9595
9999
|
_v3.z.object({
|
|
9596
10000
|
type: _v3.z.literal("prompt"),
|
|
9597
|
-
default:
|
|
10001
|
+
default: _chunkGSIDVFE6js.PromptData.optional(),
|
|
9598
10002
|
description: _v3.z.string().optional()
|
|
9599
10003
|
}),
|
|
9600
10004
|
_v3.z.object({
|
|
@@ -9650,7 +10054,7 @@ var evaluatorDefinitionsSchema = _v3.z.record(
|
|
|
9650
10054
|
);
|
|
9651
10055
|
|
|
9652
10056
|
// src/node/index.ts
|
|
9653
|
-
|
|
10057
|
+
_chunkGSIDVFE6js.configureNode.call(void 0, );
|
|
9654
10058
|
|
|
9655
10059
|
|
|
9656
10060
|
|
|
@@ -9821,4 +10225,4 @@ _chunkB6ZQIAK3js.configureNode.call(void 0, );
|
|
|
9821
10225
|
|
|
9822
10226
|
|
|
9823
10227
|
|
|
9824
|
-
exports.Attachment =
|
|
10228
|
+
exports.Attachment = _chunkGSIDVFE6js.Attachment; exports.AttachmentReference = _chunkGSIDVFE6js.AttachmentReference; exports.BAGGAGE_HEADER = _chunkGSIDVFE6js.BAGGAGE_HEADER; exports.BRAINTRUST_CURRENT_SPAN_STORE = _chunkGSIDVFE6js.BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = _chunkGSIDVFE6js.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BRAINTRUST_PARENT_KEY = _chunkGSIDVFE6js.BRAINTRUST_PARENT_KEY; exports.BaseAttachment = _chunkGSIDVFE6js.BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BraintrustLangChainCallbackHandler = _chunkGSIDVFE6js.BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = _chunkGSIDVFE6js.BraintrustObservabilityExporter; exports.BraintrustState = _chunkGSIDVFE6js.BraintrustState; exports.BraintrustStream = _chunkGSIDVFE6js.BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = _chunkGSIDVFE6js.ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = _chunkGSIDVFE6js.DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = _chunkGSIDVFE6js.DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = _chunkGSIDVFE6js.Dataset; exports.DatasetPipeline = DatasetPipeline; exports.ERR_PERMALINK = _chunkGSIDVFE6js.ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = _chunkGSIDVFE6js.Experiment; exports.ExternalAttachment = _chunkGSIDVFE6js.ExternalAttachment; exports.FailedHTTPResponse = _chunkGSIDVFE6js.FailedHTTPResponse; exports.IDGenerator = _chunkGSIDVFE6js.IDGenerator; exports.JSONAttachment = _chunkGSIDVFE6js.JSONAttachment; exports.LEGACY_CACHED_HEADER = _chunkGSIDVFE6js.LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = _chunkGSIDVFE6js.LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = _chunkGSIDVFE6js.LazyValue; exports.LocalTrace = LocalTrace; exports.Logger = _chunkGSIDVFE6js.Logger; exports.LoginInvalidOrgError = _chunkGSIDVFE6js.LoginInvalidOrgError; exports.NOOP_SPAN = _chunkGSIDVFE6js.NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = _chunkGSIDVFE6js.NOOP_SPAN_PERMALINK; exports.NoopSpan = _chunkGSIDVFE6js.NoopSpan; exports.OTELIDGenerator = _chunkGSIDVFE6js.OTELIDGenerator; exports.ObjectFetcher = _chunkGSIDVFE6js.ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = _chunkGSIDVFE6js.Prompt; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = _chunkGSIDVFE6js.ReadonlyAttachment; exports.ReadonlyExperiment = _chunkGSIDVFE6js.ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = _chunkGSIDVFE6js.SpanImpl; exports.TRACEPARENT_HEADER = _chunkGSIDVFE6js.TRACEPARENT_HEADER; exports.TRACESTATE_HEADER = _chunkGSIDVFE6js.TRACESTATE_HEADER; exports.TestBackgroundLogger = _chunkGSIDVFE6js.TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = _chunkGSIDVFE6js.UUIDGenerator; exports.X_CACHED_HEADER = _chunkGSIDVFE6js.X_CACHED_HEADER; exports._exportsForTestingOnly = _chunkGSIDVFE6js._exportsForTestingOnly; exports._internalGetGlobalState = _chunkGSIDVFE6js._internalGetGlobalState; exports._internalIso = _chunkP25IOOU4js.isomorph_default; exports._internalSetInitialState = _chunkGSIDVFE6js._internalSetInitialState; exports.addAzureBlobHeaders = _chunkGSIDVFE6js.addAzureBlobHeaders; exports.agentAssertionScorer = agentAssertionScorer; exports.braintrustAISDKTelemetry = _chunkGSIDVFE6js.braintrustAISDKTelemetry; exports.braintrustEveHook = braintrustEveHook; exports.braintrustEveInstrumentation = braintrustEveInstrumentation; exports.braintrustFlueInstrumentation = _chunkGSIDVFE6js.braintrustFlueInstrumentation; exports.braintrustFlueObserver = _chunkGSIDVFE6js.braintrustFlueObserver; exports.braintrustStreamChunkSchema = _chunkGSIDVFE6js.braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.configureInstrumentation = _chunkGSIDVFE6js.configureInstrumentation; exports.constructLogs3OverflowRequest = _chunkGSIDVFE6js.constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = _chunkGSIDVFE6js.createFinalValuePassThroughStream; exports.currentExperiment = _chunkGSIDVFE6js.currentExperiment; exports.currentLogger = _chunkGSIDVFE6js.currentLogger; exports.currentSpan = _chunkGSIDVFE6js.currentSpan; exports.deepCopyEvent = _chunkGSIDVFE6js.deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.deserializePlainStringAsJSON = _chunkGSIDVFE6js.deserializePlainStringAsJSON; exports.devNullWritableStream = _chunkGSIDVFE6js.devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.extractTraceContextFromHeaders = _chunkGSIDVFE6js.extractTraceContextFromHeaders; exports.flush = _chunkGSIDVFE6js.flush; exports.getContextManager = _chunkGSIDVFE6js.getContextManager; exports.getIdGenerator = _chunkGSIDVFE6js.getIdGenerator; exports.getPromptVersions = _chunkGSIDVFE6js.getPromptVersions; exports.getSpanParentObject = _chunkGSIDVFE6js.getSpanParentObject; exports.getTemplateRenderer = _chunkGSIDVFE6js.getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = _chunkGSIDVFE6js.init; exports.initDataset = _chunkGSIDVFE6js.initDataset; exports.initExperiment = _chunkGSIDVFE6js.initExperiment; exports.initFunction = initFunction; exports.initLogger = _chunkGSIDVFE6js.initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.injectTraceContext = _chunkGSIDVFE6js.injectTraceContext; exports.invoke = invoke; exports.isTemplateFormat = _chunkGSIDVFE6js.isTemplateFormat; exports.loadParameters = _chunkGSIDVFE6js.loadParameters; exports.loadPrompt = _chunkGSIDVFE6js.loadPrompt; exports.log = _chunkGSIDVFE6js.log; exports.logError = _chunkGSIDVFE6js.logError; exports.login = _chunkGSIDVFE6js.login; exports.loginToState = _chunkGSIDVFE6js.loginToState; exports.logs3OverflowUploadSchema = _chunkGSIDVFE6js.logs3OverflowUploadSchema; exports.newId = _chunkGSIDVFE6js.newId; exports.parseCachedHeader = _chunkGSIDVFE6js.parseCachedHeader; exports.parseTemplateFormat = _chunkGSIDVFE6js.parseTemplateFormat; exports.permalink = _chunkGSIDVFE6js.permalink; exports.pickLogs3OverflowObjectIds = _chunkGSIDVFE6js.pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = _chunkGSIDVFE6js.registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = _chunkGSIDVFE6js.registerTemplatePlugin; exports.renderMessage = _chunkGSIDVFE6js.renderMessage; exports.renderPromptParams = _chunkGSIDVFE6js.renderPromptParams; exports.renderTemplateContent = _chunkGSIDVFE6js.renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = _chunkGSIDVFE6js.setFetch; exports.setMaskingFunction = _chunkGSIDVFE6js.setMaskingFunction; exports.spanComponentsToObjectId = _chunkGSIDVFE6js.spanComponentsToObjectId; exports.startSpan = _chunkGSIDVFE6js.startSpan; exports.summarize = _chunkGSIDVFE6js.summarize; exports.templateRegistry = _chunkGSIDVFE6js.templateRegistry; exports.toolFunctionDefinitionSchema = _chunkGSIDVFE6js.ToolFunctionDefinition; exports.traceable = _chunkGSIDVFE6js.traceable; exports.traced = _chunkGSIDVFE6js.traced; exports.updateSpan = _chunkGSIDVFE6js.updateSpan; exports.uploadLogs3OverflowPayload = _chunkGSIDVFE6js.uploadLogs3OverflowPayload; exports.utf8ByteLength = _chunkGSIDVFE6js.utf8ByteLength; exports.withCurrent = _chunkGSIDVFE6js.withCurrent; exports.withDataset = _chunkGSIDVFE6js.withDataset; exports.withExperiment = _chunkGSIDVFE6js.withExperiment; exports.withLogger = _chunkGSIDVFE6js.withLogger; exports.withParent = _chunkGSIDVFE6js.withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapBedrockRuntime = wrapBedrockRuntime; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCohere = wrapCohere; exports.wrapCopilotClient = wrapCopilotClient; exports.wrapCursorSDK = wrapCursorSDK; exports.wrapGenkit = wrapGenkit; exports.wrapGoogleADK = wrapGoogleADK; exports.wrapGoogleGenAI = wrapGoogleGenAI; exports.wrapGroq = wrapGroq; exports.wrapHuggingFace = wrapHuggingFace; exports.wrapLangSmithClient = wrapLangSmithClient; exports.wrapLangSmithRunTrees = wrapLangSmithRunTrees; exports.wrapLangSmithTraceable = wrapLangSmithTraceable; exports.wrapMastraAgent = _chunkGSIDVFE6js.wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapPiCodingAgentSDK = wrapPiCodingAgentSDK; exports.wrapStrandsAgentSDK = wrapStrandsAgentSDK; exports.wrapTraced = _chunkGSIDVFE6js.wrapTraced; exports.wrapVitest = wrapVitest;
|