braintrust 3.28.0 → 3.30.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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dev/dist/index.d.mts +356 -7
  3. package/dev/dist/index.d.ts +356 -7
  4. package/dev/dist/index.js +2679 -1828
  5. package/dev/dist/index.mjs +1862 -1011
  6. package/dist/apply-auto-instrumentation.js +298 -265
  7. package/dist/apply-auto-instrumentation.mjs +85 -52
  8. package/dist/auto-instrumentations/bundler/esbuild.cjs +56 -6
  9. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  10. package/dist/auto-instrumentations/bundler/next.cjs +56 -6
  11. package/dist/auto-instrumentations/bundler/next.mjs +3 -3
  12. package/dist/auto-instrumentations/bundler/rollup.cjs +56 -6
  13. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  14. package/dist/auto-instrumentations/bundler/vite.cjs +56 -6
  15. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  16. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +56 -6
  17. package/dist/auto-instrumentations/bundler/webpack.cjs +56 -6
  18. package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
  19. package/dist/auto-instrumentations/{chunk-26PKVUKB.mjs → chunk-LW4HDHXT.mjs} +12 -4
  20. package/dist/auto-instrumentations/{chunk-HD35AM3M.mjs → chunk-OXINGIEZ.mjs} +1 -1
  21. package/dist/auto-instrumentations/{chunk-NP7V4XB2.mjs → chunk-U64OYU4Q.mjs} +45 -3
  22. package/dist/auto-instrumentations/hook.mjs +967 -136
  23. package/dist/auto-instrumentations/index.cjs +45 -3
  24. package/dist/auto-instrumentations/index.mjs +1 -1
  25. package/dist/browser.d.mts +893 -24
  26. package/dist/browser.d.ts +893 -24
  27. package/dist/browser.js +2795 -1136
  28. package/dist/browser.mjs +2795 -1136
  29. package/dist/{chunk-BBE7SNRV.js → chunk-2XDW3UCG.js} +155 -23
  30. package/dist/{chunk-UPFNQCGB.mjs → chunk-BU6SM54N.mjs} +1830 -1045
  31. package/dist/{chunk-ZHUHZWFY.mjs → chunk-N3JKQ3D3.mjs} +152 -20
  32. package/dist/{chunk-OBBWQW6K.js → chunk-TWCDSYJN.js} +2890 -2105
  33. package/dist/cli.js +5976 -1348
  34. package/dist/edge-light.d.mts +1 -1
  35. package/dist/edge-light.d.ts +1 -1
  36. package/dist/edge-light.js +2795 -1136
  37. package/dist/edge-light.mjs +2795 -1136
  38. package/dist/index.d.mts +893 -24
  39. package/dist/index.d.ts +893 -24
  40. package/dist/index.js +1448 -699
  41. package/dist/index.mjs +848 -99
  42. package/dist/instrumentation/index.d.mts +563 -9
  43. package/dist/instrumentation/index.d.ts +563 -9
  44. package/dist/instrumentation/index.js +2794 -989
  45. package/dist/instrumentation/index.mjs +2794 -989
  46. package/dist/vitest-evals-reporter.js +16 -16
  47. package/dist/vitest-evals-reporter.mjs +2 -2
  48. package/dist/workerd.d.mts +1 -1
  49. package/dist/workerd.d.ts +1 -1
  50. package/dist/workerd.js +2795 -1136
  51. package/dist/workerd.mjs +2795 -1136
  52. package/package.json +1 -1
  53. package/util/dist/index.d.mts +42 -0
  54. package/util/dist/index.d.ts +42 -0
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15;
2
2
 
3
3
 
4
4
 
@@ -143,8 +143,8 @@
143
143
 
144
144
 
145
145
 
146
+ var _chunkTWCDSYJNjs = require('./chunk-TWCDSYJN.js');
146
147
 
147
- var _chunkOBBWQW6Kjs = require('./chunk-OBBWQW6K.js');
148
148
 
149
149
 
150
150
 
@@ -177,157 +177,160 @@ var _chunkOBBWQW6Kjs = require('./chunk-OBBWQW6K.js');
177
177
 
178
178
 
179
179
 
180
- var _chunkBBE7SNRVjs = require('./chunk-BBE7SNRV.js');
180
+ var _chunk2XDW3UCGjs = require('./chunk-2XDW3UCG.js');
181
181
 
182
182
  // src/exports.ts
183
183
  var exports_exports = {};
184
- _chunkBBE7SNRVjs.__export.call(void 0, exports_exports, {
185
- Attachment: () => _chunkOBBWQW6Kjs.Attachment,
186
- AttachmentReference: () => _chunkOBBWQW6Kjs.AttachmentReference,
187
- BAGGAGE_HEADER: () => _chunkOBBWQW6Kjs.BAGGAGE_HEADER,
188
- BRAINTRUST_CURRENT_SPAN_STORE: () => _chunkOBBWQW6Kjs.BRAINTRUST_CURRENT_SPAN_STORE,
189
- BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () => _chunkOBBWQW6Kjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME,
190
- BRAINTRUST_PARENT_KEY: () => _chunkOBBWQW6Kjs.BRAINTRUST_PARENT_KEY,
191
- BaseAttachment: () => _chunkOBBWQW6Kjs.BaseAttachment,
184
+ _chunk2XDW3UCGjs.__export.call(void 0, exports_exports, {
185
+ Attachment: () => _chunkTWCDSYJNjs.Attachment,
186
+ AttachmentReference: () => _chunkTWCDSYJNjs.AttachmentReference,
187
+ BAGGAGE_HEADER: () => _chunkTWCDSYJNjs.BAGGAGE_HEADER,
188
+ BRAINTRUST_CURRENT_SPAN_STORE: () => _chunkTWCDSYJNjs.BRAINTRUST_CURRENT_SPAN_STORE,
189
+ BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME: () => _chunkTWCDSYJNjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME,
190
+ BRAINTRUST_PARENT_KEY: () => _chunkTWCDSYJNjs.BRAINTRUST_PARENT_KEY,
191
+ BaseAttachment: () => _chunkTWCDSYJNjs.BaseAttachment,
192
192
  BaseExperiment: () => BaseExperiment,
193
193
  BatchScorer: () => BatchScorer,
194
194
  BatchTask: () => BatchTask,
195
- BraintrustLangChainCallbackHandler: () => _chunkOBBWQW6Kjs.BraintrustLangChainCallbackHandler,
195
+ BraintrustLangChainCallbackHandler: () => _chunkTWCDSYJNjs.BraintrustLangChainCallbackHandler,
196
196
  BraintrustMiddleware: () => BraintrustMiddleware,
197
- BraintrustObservabilityExporter: () => _chunkOBBWQW6Kjs.BraintrustObservabilityExporter,
198
- BraintrustState: () => _chunkOBBWQW6Kjs.BraintrustState,
199
- BraintrustStream: () => _chunkOBBWQW6Kjs.BraintrustStream,
197
+ BraintrustObservabilityExporter: () => _chunkTWCDSYJNjs.BraintrustObservabilityExporter,
198
+ BraintrustState: () => _chunkTWCDSYJNjs.BraintrustState,
199
+ BraintrustStream: () => _chunkTWCDSYJNjs.BraintrustStream,
200
200
  CachedSpanFetcher: () => CachedSpanFetcher,
201
201
  CodeFunction: () => CodeFunction,
202
202
  CodePrompt: () => CodePrompt,
203
- ContextManager: () => _chunkOBBWQW6Kjs.ContextManager,
204
- DEFAULT_FETCH_BATCH_SIZE: () => _chunkOBBWQW6Kjs.DEFAULT_FETCH_BATCH_SIZE,
205
- DEFAULT_MAX_REQUEST_SIZE: () => _chunkOBBWQW6Kjs.DEFAULT_MAX_REQUEST_SIZE,
206
- Dataset: () => _chunkOBBWQW6Kjs.Dataset,
203
+ ContextManager: () => _chunkTWCDSYJNjs.ContextManager,
204
+ DEFAULT_FETCH_BATCH_SIZE: () => _chunkTWCDSYJNjs.DEFAULT_FETCH_BATCH_SIZE,
205
+ DEFAULT_MAX_REQUEST_SIZE: () => _chunkTWCDSYJNjs.DEFAULT_MAX_REQUEST_SIZE,
206
+ Dataset: () => _chunkTWCDSYJNjs.Dataset,
207
207
  DatasetPipeline: () => DatasetPipeline,
208
208
  DurableEvalMemoryStore: () => DurableEvalMemoryStore,
209
209
  DurableEvalRedisStore: () => DurableEvalRedisStore,
210
- ERR_PERMALINK: () => _chunkOBBWQW6Kjs.ERR_PERMALINK,
210
+ ERR_PERMALINK: () => _chunkTWCDSYJNjs.ERR_PERMALINK,
211
211
  Eval: () => Eval,
212
212
  EvalResultWithSummary: () => EvalResultWithSummary,
213
- Experiment: () => _chunkOBBWQW6Kjs.Experiment,
214
- ExternalAttachment: () => _chunkOBBWQW6Kjs.ExternalAttachment,
215
- FailedHTTPResponse: () => _chunkOBBWQW6Kjs.FailedHTTPResponse,
216
- IDGenerator: () => _chunkOBBWQW6Kjs.IDGenerator,
217
- JSONAttachment: () => _chunkOBBWQW6Kjs.JSONAttachment,
218
- LEGACY_CACHED_HEADER: () => _chunkOBBWQW6Kjs.LEGACY_CACHED_HEADER,
219
- LOGS3_OVERFLOW_REFERENCE_TYPE: () => _chunkOBBWQW6Kjs.LOGS3_OVERFLOW_REFERENCE_TYPE,
220
- LazyValue: () => _chunkOBBWQW6Kjs.LazyValue,
213
+ Experiment: () => _chunkTWCDSYJNjs.Experiment,
214
+ ExternalAttachment: () => _chunkTWCDSYJNjs.ExternalAttachment,
215
+ FailedHTTPResponse: () => _chunkTWCDSYJNjs.FailedHTTPResponse,
216
+ IDGenerator: () => _chunkTWCDSYJNjs.IDGenerator,
217
+ JSONAttachment: () => _chunkTWCDSYJNjs.JSONAttachment,
218
+ LEGACY_CACHED_HEADER: () => _chunkTWCDSYJNjs.LEGACY_CACHED_HEADER,
219
+ LOGS3_OVERFLOW_REFERENCE_TYPE: () => _chunkTWCDSYJNjs.LOGS3_OVERFLOW_REFERENCE_TYPE,
220
+ LazyValue: () => _chunkTWCDSYJNjs.LazyValue,
221
221
  LocalTrace: () => LocalTrace,
222
- Logger: () => _chunkOBBWQW6Kjs.Logger,
223
- LoginInvalidOrgError: () => _chunkOBBWQW6Kjs.LoginInvalidOrgError,
224
- NOOP_SPAN: () => _chunkOBBWQW6Kjs.NOOP_SPAN,
225
- NOOP_SPAN_PERMALINK: () => _chunkOBBWQW6Kjs.NOOP_SPAN_PERMALINK,
226
- NoopSpan: () => _chunkOBBWQW6Kjs.NoopSpan,
227
- OTELIDGenerator: () => _chunkOBBWQW6Kjs.OTELIDGenerator,
228
- ObjectFetcher: () => _chunkOBBWQW6Kjs.ObjectFetcher,
222
+ Logger: () => _chunkTWCDSYJNjs.Logger,
223
+ LoginInvalidOrgError: () => _chunkTWCDSYJNjs.LoginInvalidOrgError,
224
+ NOOP_SPAN: () => _chunkTWCDSYJNjs.NOOP_SPAN,
225
+ NOOP_SPAN_PERMALINK: () => _chunkTWCDSYJNjs.NOOP_SPAN_PERMALINK,
226
+ NoopSpan: () => _chunkTWCDSYJNjs.NoopSpan,
227
+ OTELIDGenerator: () => _chunkTWCDSYJNjs.OTELIDGenerator,
228
+ ObjectFetcher: () => _chunkTWCDSYJNjs.ObjectFetcher,
229
229
  Project: () => Project2,
230
230
  ProjectNameIdMap: () => ProjectNameIdMap,
231
- Prompt: () => _chunkOBBWQW6Kjs.Prompt,
231
+ Prompt: () => _chunkTWCDSYJNjs.Prompt,
232
232
  PromptBuilder: () => PromptBuilder,
233
- ReadonlyAttachment: () => _chunkOBBWQW6Kjs.ReadonlyAttachment,
234
- ReadonlyExperiment: () => _chunkOBBWQW6Kjs.ReadonlyExperiment,
233
+ ReadonlyAttachment: () => _chunkTWCDSYJNjs.ReadonlyAttachment,
234
+ ReadonlyExperiment: () => _chunkTWCDSYJNjs.ReadonlyExperiment,
235
235
  Reporter: () => Reporter,
236
236
  ScorerBuilder: () => ScorerBuilder,
237
237
  SpanFetcher: () => SpanFetcher,
238
- SpanImpl: () => _chunkOBBWQW6Kjs.SpanImpl,
239
- TRACEPARENT_HEADER: () => _chunkOBBWQW6Kjs.TRACEPARENT_HEADER,
240
- TRACESTATE_HEADER: () => _chunkOBBWQW6Kjs.TRACESTATE_HEADER,
241
- TestBackgroundLogger: () => _chunkOBBWQW6Kjs.TestBackgroundLogger,
238
+ SpanImpl: () => _chunkTWCDSYJNjs.SpanImpl,
239
+ TRACEPARENT_HEADER: () => _chunkTWCDSYJNjs.TRACEPARENT_HEADER,
240
+ TRACESTATE_HEADER: () => _chunkTWCDSYJNjs.TRACESTATE_HEADER,
241
+ TestBackgroundLogger: () => _chunkTWCDSYJNjs.TestBackgroundLogger,
242
242
  ToolBuilder: () => ToolBuilder,
243
- UUIDGenerator: () => _chunkOBBWQW6Kjs.UUIDGenerator,
244
- X_CACHED_HEADER: () => _chunkOBBWQW6Kjs.X_CACHED_HEADER,
245
- _exportsForTestingOnly: () => _chunkOBBWQW6Kjs._exportsForTestingOnly,
246
- _internalGetGlobalState: () => _chunkOBBWQW6Kjs._internalGetGlobalState,
247
- _internalIso: () => _chunkBBE7SNRVjs.isomorph_default,
248
- _internalSetInitialState: () => _chunkOBBWQW6Kjs._internalSetInitialState,
249
- addAzureBlobHeaders: () => _chunkOBBWQW6Kjs.addAzureBlobHeaders,
243
+ UUIDGenerator: () => _chunkTWCDSYJNjs.UUIDGenerator,
244
+ X_CACHED_HEADER: () => _chunkTWCDSYJNjs.X_CACHED_HEADER,
245
+ _exportsForTestingOnly: () => _chunkTWCDSYJNjs._exportsForTestingOnly,
246
+ _internalGetGlobalState: () => _chunkTWCDSYJNjs._internalGetGlobalState,
247
+ _internalIso: () => _chunk2XDW3UCGjs.isomorph_default,
248
+ _internalSetInitialState: () => _chunkTWCDSYJNjs._internalSetInitialState,
249
+ addAzureBlobHeaders: () => _chunkTWCDSYJNjs.addAzureBlobHeaders,
250
250
  agentAssertionScorer: () => agentAssertionScorer,
251
- braintrustAISDKTelemetry: () => _chunkOBBWQW6Kjs.braintrustAISDKTelemetry,
251
+ braintrustAISDKTelemetry: () => _chunkTWCDSYJNjs.braintrustAISDKTelemetry,
252
252
  braintrustEveHook: () => braintrustEveHook,
253
253
  braintrustEveInstrumentation: () => braintrustEveInstrumentation,
254
- braintrustFlueInstrumentation: () => _chunkOBBWQW6Kjs.braintrustFlueInstrumentation,
255
- braintrustFlueObserver: () => _chunkOBBWQW6Kjs.braintrustFlueObserver,
256
- braintrustStreamChunkSchema: () => _chunkOBBWQW6Kjs.braintrustStreamChunkSchema,
254
+ braintrustFlueInstrumentation: () => _chunkTWCDSYJNjs.braintrustFlueInstrumentation,
255
+ braintrustFlueObserver: () => _chunkTWCDSYJNjs.braintrustFlueObserver,
256
+ braintrustStreamChunkSchema: () => _chunkTWCDSYJNjs.braintrustStreamChunkSchema,
257
257
  buildLocalSummary: () => buildLocalSummary,
258
- collectAnthropicSession: () => _chunkOBBWQW6Kjs.collectAnthropicSession,
259
- configureInstrumentation: () => _chunkOBBWQW6Kjs.configureInstrumentation,
260
- constructLogs3OverflowRequest: () => _chunkOBBWQW6Kjs.constructLogs3OverflowRequest,
261
- createFinalValuePassThroughStream: () => _chunkOBBWQW6Kjs.createFinalValuePassThroughStream,
262
- currentExperiment: () => _chunkOBBWQW6Kjs.currentExperiment,
263
- currentLogger: () => _chunkOBBWQW6Kjs.currentLogger,
264
- currentSpan: () => _chunkOBBWQW6Kjs.currentSpan,
265
- deepCopyEvent: () => _chunkOBBWQW6Kjs.deepCopyEvent,
258
+ collectAnthropicSession: () => _chunkTWCDSYJNjs.collectAnthropicSession,
259
+ completeOpenAIBatchTrace: () => completeOpenAIBatchTrace,
260
+ configureInstrumentation: () => _chunkTWCDSYJNjs.configureInstrumentation,
261
+ constructLogs3OverflowRequest: () => _chunkTWCDSYJNjs.constructLogs3OverflowRequest,
262
+ createFinalValuePassThroughStream: () => _chunkTWCDSYJNjs.createFinalValuePassThroughStream,
263
+ currentExperiment: () => _chunkTWCDSYJNjs.currentExperiment,
264
+ currentLogger: () => _chunkTWCDSYJNjs.currentLogger,
265
+ currentSpan: () => _chunkTWCDSYJNjs.currentSpan,
266
+ deepCopyEvent: () => _chunkTWCDSYJNjs.deepCopyEvent,
266
267
  defaultErrorScoreHandler: () => defaultErrorScoreHandler,
267
268
  defineDurableEval: () => defineDurableEval,
268
- deserializePlainStringAsJSON: () => _chunkOBBWQW6Kjs.deserializePlainStringAsJSON,
269
- devNullWritableStream: () => _chunkOBBWQW6Kjs.devNullWritableStream,
269
+ deserializePlainStringAsJSON: () => _chunkTWCDSYJNjs.deserializePlainStringAsJSON,
270
+ devNullWritableStream: () => _chunkTWCDSYJNjs.devNullWritableStream,
270
271
  evaluatorDefinitionSchema: () => evaluatorDefinitionSchema,
271
272
  evaluatorDefinitionsSchema: () => evaluatorDefinitionsSchema,
272
- extractTraceContextFromHeaders: () => _chunkOBBWQW6Kjs.extractTraceContextFromHeaders,
273
- flush: () => _chunkOBBWQW6Kjs.flush,
274
- getContextManager: () => _chunkOBBWQW6Kjs.getContextManager,
275
- getIdGenerator: () => _chunkOBBWQW6Kjs.getIdGenerator,
276
- getPromptVersions: () => _chunkOBBWQW6Kjs.getPromptVersions,
277
- getSpanParentObject: () => _chunkOBBWQW6Kjs.getSpanParentObject,
278
- getTemplateRenderer: () => _chunkOBBWQW6Kjs.getTemplateRenderer,
273
+ extractTraceContextFromHeaders: () => _chunkTWCDSYJNjs.extractTraceContextFromHeaders,
274
+ flush: () => _chunkTWCDSYJNjs.flush,
275
+ getContextManager: () => _chunkTWCDSYJNjs.getContextManager,
276
+ getIdGenerator: () => _chunkTWCDSYJNjs.getIdGenerator,
277
+ getPromptVersions: () => _chunkTWCDSYJNjs.getPromptVersions,
278
+ getSpanParentObject: () => _chunkTWCDSYJNjs.getSpanParentObject,
279
+ getTemplateRenderer: () => _chunkTWCDSYJNjs.getTemplateRenderer,
279
280
  graph: () => graph_framework_exports,
280
- init: () => _chunkOBBWQW6Kjs.init,
281
- initDataset: () => _chunkOBBWQW6Kjs.initDataset,
282
- initExperiment: () => _chunkOBBWQW6Kjs.initExperiment,
281
+ init: () => _chunkTWCDSYJNjs.init,
282
+ initDataset: () => _chunkTWCDSYJNjs.initDataset,
283
+ initExperiment: () => _chunkTWCDSYJNjs.initExperiment,
283
284
  initFunction: () => initFunction,
284
- initLogger: () => _chunkOBBWQW6Kjs.initLogger,
285
+ initLogger: () => _chunkTWCDSYJNjs.initLogger,
285
286
  initNodeTestSuite: () => initNodeTestSuite,
286
- injectTraceContext: () => _chunkOBBWQW6Kjs.injectTraceContext,
287
+ injectTraceContext: () => _chunkTWCDSYJNjs.injectTraceContext,
287
288
  invoke: () => invoke,
288
- isTemplateFormat: () => _chunkOBBWQW6Kjs.isTemplateFormat,
289
- loadParameters: () => _chunkOBBWQW6Kjs.loadParameters,
290
- loadPrompt: () => _chunkOBBWQW6Kjs.loadPrompt,
291
- log: () => _chunkOBBWQW6Kjs.log,
292
- logError: () => _chunkOBBWQW6Kjs.logError,
293
- login: () => _chunkOBBWQW6Kjs.login,
294
- loginToState: () => _chunkOBBWQW6Kjs.loginToState,
295
- logs3OverflowUploadSchema: () => _chunkOBBWQW6Kjs.logs3OverflowUploadSchema,
296
- newId: () => _chunkOBBWQW6Kjs.newId,
297
- parseCachedHeader: () => _chunkOBBWQW6Kjs.parseCachedHeader,
298
- parseTemplateFormat: () => _chunkOBBWQW6Kjs.parseTemplateFormat,
299
- permalink: () => _chunkOBBWQW6Kjs.permalink,
300
- pickLogs3OverflowObjectIds: () => _chunkOBBWQW6Kjs.pickLogs3OverflowObjectIds,
289
+ isTemplateFormat: () => _chunkTWCDSYJNjs.isTemplateFormat,
290
+ loadParameters: () => _chunkTWCDSYJNjs.loadParameters,
291
+ loadPrompt: () => _chunkTWCDSYJNjs.loadPrompt,
292
+ log: () => _chunkTWCDSYJNjs.log,
293
+ logError: () => _chunkTWCDSYJNjs.logError,
294
+ login: () => _chunkTWCDSYJNjs.login,
295
+ loginToState: () => _chunkTWCDSYJNjs.loginToState,
296
+ logs3OverflowUploadSchema: () => _chunkTWCDSYJNjs.logs3OverflowUploadSchema,
297
+ newId: () => _chunkTWCDSYJNjs.newId,
298
+ openaiBatchesRetrieveTraced: () => openaiBatchesRetrieveTraced,
299
+ openaiFilesCreateTraced: () => openaiFilesCreateTraced,
300
+ parseCachedHeader: () => _chunkTWCDSYJNjs.parseCachedHeader,
301
+ parseTemplateFormat: () => _chunkTWCDSYJNjs.parseTemplateFormat,
302
+ permalink: () => _chunkTWCDSYJNjs.permalink,
303
+ pickLogs3OverflowObjectIds: () => _chunkTWCDSYJNjs.pickLogs3OverflowObjectIds,
301
304
  projects: () => projects,
302
305
  promptContentsSchema: () => promptContentsSchema,
303
306
  promptDefinitionSchema: () => promptDefinitionSchema,
304
307
  promptDefinitionToPromptData: () => promptDefinitionToPromptData,
305
308
  promptDefinitionWithToolsSchema: () => promptDefinitionWithToolsSchema,
306
- registerOtelFlush: () => _chunkOBBWQW6Kjs.registerOtelFlush,
309
+ registerOtelFlush: () => _chunkTWCDSYJNjs.registerOtelFlush,
307
310
  registerSandbox: () => registerSandbox,
308
- registerTemplatePlugin: () => _chunkOBBWQW6Kjs.registerTemplatePlugin,
309
- renderMessage: () => _chunkOBBWQW6Kjs.renderMessage,
310
- renderPromptParams: () => _chunkOBBWQW6Kjs.renderPromptParams,
311
- renderTemplateContent: () => _chunkOBBWQW6Kjs.renderTemplateContent,
311
+ registerTemplatePlugin: () => _chunkTWCDSYJNjs.registerTemplatePlugin,
312
+ renderMessage: () => _chunkTWCDSYJNjs.renderMessage,
313
+ renderPromptParams: () => _chunkTWCDSYJNjs.renderPromptParams,
314
+ renderTemplateContent: () => _chunkTWCDSYJNjs.renderTemplateContent,
312
315
  reportFailures: () => reportFailures,
313
316
  runEvaluator: () => runEvaluator,
314
- setFetch: () => _chunkOBBWQW6Kjs.setFetch,
315
- setMaskingFunction: () => _chunkOBBWQW6Kjs.setMaskingFunction,
316
- spanComponentsToObjectId: () => _chunkOBBWQW6Kjs.spanComponentsToObjectId,
317
- startSpan: () => _chunkOBBWQW6Kjs.startSpan,
318
- summarize: () => _chunkOBBWQW6Kjs.summarize,
319
- templateRegistry: () => _chunkOBBWQW6Kjs.templateRegistry,
320
- toolFunctionDefinitionSchema: () => _chunkOBBWQW6Kjs.ToolFunctionDefinition,
321
- traceable: () => _chunkOBBWQW6Kjs.traceable,
322
- traced: () => _chunkOBBWQW6Kjs.traced,
323
- updateSpan: () => _chunkOBBWQW6Kjs.updateSpan,
324
- uploadLogs3OverflowPayload: () => _chunkOBBWQW6Kjs.uploadLogs3OverflowPayload,
325
- utf8ByteLength: () => _chunkOBBWQW6Kjs.utf8ByteLength,
326
- withCurrent: () => _chunkOBBWQW6Kjs.withCurrent,
327
- withDataset: () => _chunkOBBWQW6Kjs.withDataset,
328
- withExperiment: () => _chunkOBBWQW6Kjs.withExperiment,
329
- withLogger: () => _chunkOBBWQW6Kjs.withLogger,
330
- withParent: () => _chunkOBBWQW6Kjs.withParent,
317
+ setFetch: () => _chunkTWCDSYJNjs.setFetch,
318
+ setMaskingFunction: () => _chunkTWCDSYJNjs.setMaskingFunction,
319
+ spanComponentsToObjectId: () => _chunkTWCDSYJNjs.spanComponentsToObjectId,
320
+ startSpan: () => _chunkTWCDSYJNjs.startSpan,
321
+ summarize: () => _chunkTWCDSYJNjs.summarize,
322
+ templateRegistry: () => _chunkTWCDSYJNjs.templateRegistry,
323
+ toolFunctionDefinitionSchema: () => _chunkTWCDSYJNjs.ToolFunctionDefinition,
324
+ traceable: () => _chunkTWCDSYJNjs.traceable,
325
+ traced: () => _chunkTWCDSYJNjs.traced,
326
+ updateSpan: () => _chunkTWCDSYJNjs.updateSpan,
327
+ uploadLogs3OverflowPayload: () => _chunkTWCDSYJNjs.uploadLogs3OverflowPayload,
328
+ utf8ByteLength: () => _chunkTWCDSYJNjs.utf8ByteLength,
329
+ withCurrent: () => _chunkTWCDSYJNjs.withCurrent,
330
+ withDataset: () => _chunkTWCDSYJNjs.withDataset,
331
+ withExperiment: () => _chunkTWCDSYJNjs.withExperiment,
332
+ withLogger: () => _chunkTWCDSYJNjs.withLogger,
333
+ withParent: () => _chunkTWCDSYJNjs.withParent,
331
334
  wrapAISDK: () => wrapAISDK,
332
335
  wrapAISDKModel: () => wrapAISDKModel,
333
336
  wrapAgentClass: () => wrapAgentClass,
@@ -349,7 +352,7 @@ _chunkBBE7SNRVjs.__export.call(void 0, exports_exports, {
349
352
  wrapLangSmithClient: () => wrapLangSmithClient,
350
353
  wrapLangSmithRunTrees: () => wrapLangSmithRunTrees,
351
354
  wrapLangSmithTraceable: () => wrapLangSmithTraceable,
352
- wrapMastraAgent: () => _chunkOBBWQW6Kjs.wrapMastraAgent,
355
+ wrapMastraAgent: () => _chunkTWCDSYJNjs.wrapMastraAgent,
353
356
  wrapMistral: () => wrapMistral,
354
357
  wrapOllama: () => wrapOllama,
355
358
  wrapOpenAI: () => wrapOpenAI,
@@ -359,7 +362,7 @@ _chunkBBE7SNRVjs.__export.call(void 0, exports_exports, {
359
362
  wrapOpenRouterAgent: () => wrapOpenRouterAgent,
360
363
  wrapPiCodingAgentSDK: () => wrapPiCodingAgentSDK,
361
364
  wrapStrandsAgentSDK: () => wrapStrandsAgentSDK,
362
- wrapTraced: () => _chunkOBBWQW6Kjs.wrapTraced,
365
+ wrapTraced: () => _chunkTWCDSYJNjs.wrapTraced,
363
366
  wrapVitest: () => wrapVitest,
364
367
  wrapVoyageAI: () => wrapVoyageAI
365
368
  });
@@ -368,7 +371,7 @@ _chunkBBE7SNRVjs.__export.call(void 0, exports_exports, {
368
371
  var _v3 = require('zod/v3');
369
372
  var SANDBOX_GROUP_NAME_METADATA_KEY = "_bt_sandbox_group_name";
370
373
  async function registerSandbox(options) {
371
- const state = _nullishCoalesce(options.state, () => ( _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, )));
374
+ const state = _nullishCoalesce(options.state, () => ( _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, )));
372
375
  await state.login({
373
376
  apiKey: options.apiKey,
374
377
  appUrl: options.appUrl,
@@ -409,7 +412,7 @@ async function registerSandbox(options) {
409
412
  evaluatorDefinitions
410
413
  )) {
411
414
  const functionName = evalName;
412
- const functionSlug = _chunkOBBWQW6Kjs.slugify.call(void 0, evalName, { lower: true, strict: true });
415
+ const functionSlug = _chunkTWCDSYJNjs.slugify.call(void 0, evalName, { lower: true, strict: true });
413
416
  const functionDef = {
414
417
  project_id: projectId,
415
418
  org_name: state.orgName,
@@ -458,6 +461,260 @@ async function registerSandbox(options) {
458
461
  };
459
462
  }
460
463
 
464
+ // src/wrappers/openai-promise-utils.ts
465
+ function splitSpanInfo(allParams) {
466
+ const { span_info, ...params } = allParams;
467
+ return {
468
+ params,
469
+ span_info
470
+ };
471
+ }
472
+ function createChannelContext(_channel, params, span_info) {
473
+ return {
474
+ arguments: (
475
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
476
+ [params]
477
+ ),
478
+ span_info
479
+ };
480
+ }
481
+ async function tracePromiseWithResponse(channel, traceContext, apiPromise) {
482
+ let enhancedResponse;
483
+ const tracePromise = (
484
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
485
+ channel.tracePromise
486
+ );
487
+ const data = await tracePromise(async () => {
488
+ enhancedResponse = await apiPromise.withResponse();
489
+ traceContext.response = enhancedResponse.response;
490
+ return enhancedResponse.data;
491
+ }, traceContext);
492
+ if (!enhancedResponse) {
493
+ throw new Error("Expected withResponse() to provide response");
494
+ }
495
+ return {
496
+ data,
497
+ response: enhancedResponse.response,
498
+ request_id: enhancedResponse.request_id
499
+ };
500
+ }
501
+ async function tracePromiseAsResponse(channel, traceContext, apiPromise) {
502
+ const tracePromise = (
503
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
504
+ channel.tracePromise
505
+ );
506
+ let response;
507
+ await tracePromise(async () => {
508
+ response = await apiPromise.asResponse();
509
+ traceContext.response = response;
510
+ return void 0;
511
+ }, traceContext);
512
+ if (!response) {
513
+ throw new Error("Expected asResponse() to provide response");
514
+ }
515
+ return response;
516
+ }
517
+ function createLazyAPIPromise(ensureExecuted, ensureResponse, getAPIPromise) {
518
+ let firstConsumption;
519
+ let enhancedResponsePromise;
520
+ let dataPromise;
521
+ let responsePromise;
522
+ const withResponse = () => {
523
+ firstConsumption ??= "data";
524
+ enhancedResponsePromise ??= firstConsumption === "data" ? ensureExecuted() : getAPIPromise().withResponse();
525
+ return enhancedResponsePromise;
526
+ };
527
+ const asResponse = () => {
528
+ firstConsumption ??= "response";
529
+ responsePromise ??= firstConsumption === "response" ? ensureResponse() : getAPIPromise().asResponse();
530
+ return responsePromise;
531
+ };
532
+ return new Proxy({}, {
533
+ get(target, prop, receiver) {
534
+ if (prop === "withResponse") {
535
+ return withResponse;
536
+ }
537
+ if (prop === "asResponse") {
538
+ return asResponse;
539
+ }
540
+ if (prop === "then" || prop === "catch" || prop === "finally" || prop in Promise.prototype) {
541
+ dataPromise ??= withResponse().then((result) => result.data);
542
+ const value = Reflect.get(dataPromise, prop, receiver);
543
+ return typeof value === "function" ? value.bind(dataPromise) : value;
544
+ }
545
+ return Reflect.get(target, prop, receiver);
546
+ }
547
+ });
548
+ }
549
+
550
+ // src/openai-batch.ts
551
+ function read(value, key) {
552
+ if (value === null || typeof value !== "object" && typeof value !== "function") {
553
+ return void 0;
554
+ }
555
+ try {
556
+ return Reflect.get(value, key);
557
+ } catch (e2) {
558
+ return void 0;
559
+ }
560
+ }
561
+ function isAsyncIterable(value) {
562
+ return typeof read(value, Symbol.asyncIterator) === "function";
563
+ }
564
+ function teeAsyncIterable(source) {
565
+ const iterator = source[Symbol.asyncIterator]();
566
+ const stream = new ReadableStream({
567
+ async pull(controller) {
568
+ try {
569
+ const result = await iterator.next();
570
+ if (result.done) {
571
+ controller.close();
572
+ return;
573
+ }
574
+ if (!(result.value instanceof Uint8Array)) {
575
+ throw new TypeError(
576
+ "OpenAI upload streams must yield Uint8Array chunks"
577
+ );
578
+ }
579
+ controller.enqueue(result.value);
580
+ } catch (error) {
581
+ controller.error(error);
582
+ }
583
+ },
584
+ async cancel(reason) {
585
+ await _optionalChain([iterator, 'access', _2 => _2.return, 'optionalCall', _3 => _3(reason)]);
586
+ }
587
+ });
588
+ const [uploadStream, trace] = stream.tee();
589
+ const upload = {
590
+ async *[Symbol.asyncIterator]() {
591
+ const reader = uploadStream.getReader();
592
+ try {
593
+ while (true) {
594
+ const result = await reader.read();
595
+ if (result.done) {
596
+ return;
597
+ }
598
+ yield result.value;
599
+ }
600
+ } finally {
601
+ reader.releaseLock();
602
+ }
603
+ }
604
+ };
605
+ const path = read(source, "path");
606
+ if (typeof path === "string") {
607
+ Object.defineProperty(upload, "path", { value: path });
608
+ }
609
+ return { upload, trace: new Response(trace) };
610
+ }
611
+ function teeUpload(upload) {
612
+ if (upload instanceof Blob) {
613
+ return { upload, trace: new Response(upload) };
614
+ }
615
+ if (upload instanceof Response) {
616
+ return { upload, trace: upload.clone() };
617
+ }
618
+ if (isAsyncIterable(upload)) {
619
+ return teeAsyncIterable(upload);
620
+ }
621
+ return void 0;
622
+ }
623
+ function openaiFilesCreateTraced(files) {
624
+ return (params, options) => {
625
+ const parent = _chunkTWCDSYJNjs.getSpanParentObject.call(void 0, );
626
+ const purpose = read(params, "purpose");
627
+ const file = read(params, "file");
628
+ if (purpose !== "batch") {
629
+ return files.create(params, options);
630
+ }
631
+ let branches;
632
+ try {
633
+ branches = teeUpload(file);
634
+ } catch (e3) {
635
+ return files.create(params, options);
636
+ }
637
+ if (!branches) {
638
+ return files.create(params, options);
639
+ }
640
+ const tracedParams = {
641
+ ...Object(params),
642
+ file: branches.upload
643
+ };
644
+ const apiPromise = files.create(tracedParams, options);
645
+ let enhancedResponse;
646
+ const tracedResponse = _chunk2XDW3UCGjs.openAIChannels.filesCreateTraced.invoke(
647
+ async () => {
648
+ enhancedResponse = await apiPromise.withResponse();
649
+ return enhancedResponse.data;
650
+ },
651
+ files,
652
+ [{ params, inputFileContent: branches.trace, parent }],
653
+ {}
654
+ ).then((data) => {
655
+ if (!enhancedResponse) {
656
+ throw new Error(
657
+ "Expected OpenAI withResponse() to provide a response"
658
+ );
659
+ }
660
+ return { ...enhancedResponse, data };
661
+ });
662
+ return createLazyAPIPromise(
663
+ () => tracedResponse,
664
+ () => tracedResponse.then(({ response }) => response),
665
+ () => apiPromise
666
+ );
667
+ };
668
+ }
669
+ function openaiBatchesRetrieveTraced(batches) {
670
+ return (batchId, options) => {
671
+ const apiPromise = batches.retrieve(batchId, options);
672
+ let enhancedResponse;
673
+ const tracedResponse = _chunk2XDW3UCGjs.openAIChannels.batchesRetrieveTraced.invoke(
674
+ async () => {
675
+ enhancedResponse = await apiPromise.withResponse();
676
+ return enhancedResponse.data;
677
+ },
678
+ batches,
679
+ [{ batchId }],
680
+ {}
681
+ ).then((data) => {
682
+ if (!enhancedResponse) {
683
+ throw new Error(
684
+ "Expected OpenAI withResponse() to provide a response"
685
+ );
686
+ }
687
+ return { ...enhancedResponse, data };
688
+ });
689
+ return createLazyAPIPromise(
690
+ () => tracedResponse,
691
+ () => tracedResponse.then(({ response }) => response),
692
+ () => apiPromise
693
+ );
694
+ };
695
+ }
696
+ async function completeOpenAIBatchTrace(args) {
697
+ const inputFileContent = Promise.resolve(args.inputFileContent);
698
+ const outputFileContent = args.outputFileContent === void 0 ? void 0 : Promise.resolve(args.outputFileContent);
699
+ const errorFileContent = args.errorFileContent === void 0 ? void 0 : Promise.resolve(args.errorFileContent);
700
+ void inputFileContent.catch(() => void 0);
701
+ void _optionalChain([outputFileContent, 'optionalAccess', _4 => _4.catch, 'call', _5 => _5(() => void 0)]);
702
+ void _optionalChain([errorFileContent, 'optionalAccess', _6 => _6.catch, 'call', _7 => _7(() => void 0)]);
703
+ await _chunk2XDW3UCGjs.openAIChannels.batchesCompleteTrace.invoke(
704
+ async () => void 0,
705
+ void 0,
706
+ [
707
+ {
708
+ ...args,
709
+ inputFileContent,
710
+ outputFileContent,
711
+ errorFileContent
712
+ }
713
+ ],
714
+ {}
715
+ );
716
+ }
717
+
461
718
  // src/functions/invoke.ts
462
719
  async function invoke(args) {
463
720
  const {
@@ -480,7 +737,7 @@ async function invoke(args) {
480
737
  projectId,
481
738
  ...functionIdArgs
482
739
  } = args;
483
- const state = _nullishCoalesce(stateArg, () => ( _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, )));
740
+ const state = _nullishCoalesce(stateArg, () => ( _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, )));
484
741
  await state.login({
485
742
  orgName,
486
743
  apiKey,
@@ -488,8 +745,8 @@ async function invoke(args) {
488
745
  forceLogin,
489
746
  fetch
490
747
  });
491
- const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await _chunkOBBWQW6Kjs.getSpanParentObject.call(void 0, ).export();
492
- const functionId = _chunkOBBWQW6Kjs.FunctionId.safeParse({
748
+ const parent = parentArg ? typeof parentArg === "string" ? parentArg : await parentArg.export() : await _chunkTWCDSYJNjs.getSpanParentObject.call(void 0, ).export();
749
+ const functionId = _chunkTWCDSYJNjs.FunctionId.safeParse({
493
750
  function_id: functionIdArgs.function_id,
494
751
  project_name: functionIdArgs.projectName,
495
752
  slug: functionIdArgs.slug,
@@ -532,7 +789,7 @@ async function invoke(args) {
532
789
  if (!resp.body) {
533
790
  throw new Error("Received empty stream body");
534
791
  }
535
- return new (0, _chunkOBBWQW6Kjs.BraintrustStream)(resp.body);
792
+ return new (0, _chunkTWCDSYJNjs.BraintrustStream)(resp.body);
536
793
  } else {
537
794
  const data = await resp.json();
538
795
  return schema ? schema.parse(data) : data;
@@ -544,8 +801,8 @@ function initFunction({
544
801
  version,
545
802
  state
546
803
  }) {
547
- const s = _nullishCoalesce(state, () => ( _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, )));
548
- _optionalChain([s, 'optionalAccess', _2 => _2.spanCache, 'optionalAccess', _3 => _3.disable, 'call', _4 => _4()]);
804
+ const s = _nullishCoalesce(state, () => ( _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, )));
805
+ _optionalChain([s, 'optionalAccess', _8 => _8.spanCache, 'optionalAccess', _9 => _9.disable, 'call', _10 => _10()]);
549
806
  const f = async (input) => {
550
807
  return await invoke({
551
808
  projectName,
@@ -560,58 +817,6 @@ function initFunction({
560
817
  return f;
561
818
  }
562
819
 
563
- // src/wrappers/openai-promise-utils.ts
564
- function splitSpanInfo(allParams) {
565
- const { span_info, ...params } = allParams;
566
- return {
567
- params,
568
- span_info
569
- };
570
- }
571
- function createChannelContext(_channel, params, span_info) {
572
- return {
573
- arguments: (
574
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
575
- [params]
576
- ),
577
- span_info
578
- };
579
- }
580
- async function tracePromiseWithResponse(channel, traceContext, apiPromise) {
581
- let enhancedResponse;
582
- const tracePromise = (
583
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
584
- channel.tracePromise
585
- );
586
- const data = await tracePromise(async () => {
587
- enhancedResponse = await apiPromise.withResponse();
588
- traceContext.response = enhancedResponse.response;
589
- return enhancedResponse.data;
590
- }, traceContext);
591
- if (!enhancedResponse) {
592
- throw new Error("Expected withResponse() to provide response");
593
- }
594
- return { data, response: enhancedResponse.response };
595
- }
596
- function createLazyAPIPromise(ensureExecuted) {
597
- let dataPromise = null;
598
- return new Proxy({}, {
599
- get(target, prop, receiver) {
600
- if (prop === "withResponse") {
601
- return () => ensureExecuted();
602
- }
603
- if (prop === "then" || prop === "catch" || prop === "finally" || prop in Promise.prototype) {
604
- if (!dataPromise) {
605
- dataPromise = ensureExecuted().then((result) => result.data);
606
- }
607
- const value = Reflect.get(dataPromise, prop, receiver);
608
- return typeof value === "function" ? value.bind(dataPromise) : value;
609
- }
610
- return Reflect.get(target, prop, receiver);
611
- }
612
- });
613
- }
614
-
615
820
  // src/wrappers/oai_responses.ts
616
821
  function responsesProxy(openai) {
617
822
  if (!openai.responses) {
@@ -622,22 +827,22 @@ function responsesProxy(openai) {
622
827
  if (name === "create" && typeof target.create === "function") {
623
828
  return wrapResponsesAsync(
624
829
  target.create.bind(target),
625
- _chunkBBE7SNRVjs.openAIChannels.responsesCreate
830
+ _chunk2XDW3UCGjs.openAIChannels.responsesCreate
626
831
  );
627
832
  } else if (name === "stream" && typeof target.stream === "function") {
628
833
  return wrapResponsesSyncStream(
629
834
  target.stream.bind(target),
630
- _chunkBBE7SNRVjs.openAIChannels.responsesStream
835
+ _chunk2XDW3UCGjs.openAIChannels.responsesStream
631
836
  );
632
837
  } else if (name === "parse" && typeof target.parse === "function") {
633
838
  return wrapResponsesAsync(
634
839
  target.parse.bind(target),
635
- _chunkBBE7SNRVjs.openAIChannels.responsesParse
840
+ _chunk2XDW3UCGjs.openAIChannels.responsesParse
636
841
  );
637
842
  } else if (name === "compact" && typeof target.compact === "function") {
638
843
  return wrapResponsesAsync(
639
844
  target.compact.bind(target),
640
- _chunkBBE7SNRVjs.openAIChannels.responsesCompact
845
+ _chunk2XDW3UCGjs.openAIChannels.responsesCompact
641
846
  );
642
847
  }
643
848
  return Reflect.get(target, name, receiver);
@@ -648,17 +853,33 @@ function wrapResponsesAsync(target, channel) {
648
853
  return (allParams, options) => {
649
854
  const { span_info, params } = splitSpanInfo(allParams);
650
855
  let executionPromise = null;
856
+ let apiPromise = null;
857
+ const getAPIPromise = () => {
858
+ apiPromise ??= target(params, options);
859
+ return apiPromise;
860
+ };
651
861
  const ensureExecuted = () => {
652
862
  if (!executionPromise) {
653
863
  executionPromise = (async () => {
654
864
  const traceContext = createChannelContext(channel, params, span_info);
655
- const apiPromise = target(params, options);
656
- return tracePromiseWithResponse(channel, traceContext, apiPromise);
865
+ return tracePromiseWithResponse(
866
+ channel,
867
+ traceContext,
868
+ getAPIPromise()
869
+ );
657
870
  })();
658
871
  }
659
872
  return executionPromise;
660
873
  };
661
- return createLazyAPIPromise(ensureExecuted);
874
+ return createLazyAPIPromise(
875
+ ensureExecuted,
876
+ () => tracePromiseAsResponse(
877
+ channel,
878
+ createChannelContext(channel, params, span_info),
879
+ getAPIPromise()
880
+ ),
881
+ getAPIPromise
882
+ );
662
883
  };
663
884
  }
664
885
  function wrapResponsesSyncStream(target, channel) {
@@ -710,9 +931,9 @@ function wrapOpenAIv4(openai) {
710
931
  const embeddingProxy = createEndpointProxy(typedOpenai.embeddings, wrapEmbeddings);
711
932
  const moderationProxy = createEndpointProxy(typedOpenai.moderations, wrapModerations);
712
933
  let betaProxy3;
713
- if (_optionalChain([typedOpenai, 'access', _5 => _5.beta, 'optionalAccess', _6 => _6.chat, 'optionalAccess', _7 => _7.completions, 'optionalAccess', _8 => _8.stream])) {
934
+ if (_optionalChain([typedOpenai, 'access', _11 => _11.beta, 'optionalAccess', _12 => _12.chat, 'optionalAccess', _13 => _13.completions, 'optionalAccess', _14 => _14.stream])) {
714
935
  const betaChatCompletionProxy = new Proxy(
715
- _optionalChain([typedOpenai, 'optionalAccess', _9 => _9.beta, 'optionalAccess', _10 => _10.chat, 'access', _11 => _11.completions]),
936
+ _optionalChain([typedOpenai, 'optionalAccess', _15 => _15.beta, 'optionalAccess', _16 => _16.chat, 'access', _17 => _17.completions]),
716
937
  {
717
938
  get(target, name, receiver) {
718
939
  const baseVal = Reflect.get(target, name, receiver);
@@ -781,7 +1002,7 @@ function wrapBetaChatCompletionParse(completion) {
781
1002
  const { span_info, params } = splitSpanInfo(
782
1003
  allParams
783
1004
  );
784
- return _chunkBBE7SNRVjs.openAIChannels.betaChatCompletionsParse.tracePromise(
1005
+ return _chunk2XDW3UCGjs.openAIChannels.betaChatCompletionsParse.tracePromise(
785
1006
  async () => await completion(params),
786
1007
  { arguments: [params], span_info }
787
1008
  );
@@ -792,7 +1013,7 @@ function wrapBetaChatCompletionStream(completion) {
792
1013
  const { span_info, params } = splitSpanInfo(
793
1014
  allParams
794
1015
  );
795
- return _chunkBBE7SNRVjs.openAIChannels.betaChatCompletionsStream.traceSync(
1016
+ return _chunk2XDW3UCGjs.openAIChannels.betaChatCompletionsStream.traceSync(
796
1017
  () => completion(params),
797
1018
  { arguments: [params], span_info }
798
1019
  );
@@ -804,41 +1025,58 @@ function wrapChatCompletion(completion) {
804
1025
  allParams
805
1026
  );
806
1027
  let executionPromise = null;
1028
+ let apiPromise = null;
1029
+ const getAPIPromise = () => {
1030
+ apiPromise ??= completion(params, options);
1031
+ return apiPromise;
1032
+ };
807
1033
  const ensureExecuted = () => {
808
1034
  if (!executionPromise) {
809
1035
  executionPromise = (async () => {
810
1036
  const traceContext = createChannelContext(
811
- _chunkBBE7SNRVjs.openAIChannels.chatCompletionsCreate,
1037
+ _chunk2XDW3UCGjs.openAIChannels.chatCompletionsCreate,
812
1038
  params,
813
1039
  span_info
814
1040
  );
815
1041
  if (params.stream) {
816
- const completionPromise = completion(
817
- params,
818
- options
1042
+ const completionPromise = (
1043
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1044
+ getAPIPromise()
819
1045
  );
820
- const { data: data2, response: response2 } = await tracePromiseWithResponse(
821
- _chunkBBE7SNRVjs.openAIChannels.chatCompletionsCreate,
1046
+ const { data: data2, response: response2, request_id: request_id2 } = await tracePromiseWithResponse(
1047
+ _chunk2XDW3UCGjs.openAIChannels.chatCompletionsCreate,
822
1048
  traceContext,
823
1049
  completionPromise
824
1050
  );
825
- return { data: data2, response: response2 };
1051
+ return { data: data2, response: response2, request_id: request_id2 };
826
1052
  }
827
- const completionResponse = completion(
828
- params,
829
- options
1053
+ const completionResponse = (
1054
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
1055
+ getAPIPromise()
830
1056
  );
831
- const { data, response } = await tracePromiseWithResponse(
832
- _chunkBBE7SNRVjs.openAIChannels.chatCompletionsCreate,
1057
+ const { data, response, request_id } = await tracePromiseWithResponse(
1058
+ _chunk2XDW3UCGjs.openAIChannels.chatCompletionsCreate,
833
1059
  traceContext,
834
1060
  completionResponse
835
1061
  );
836
- return { data, response };
1062
+ return { data, response, request_id };
837
1063
  })();
838
1064
  }
839
1065
  return executionPromise;
840
1066
  };
841
- return createLazyAPIPromise(ensureExecuted);
1067
+ return createLazyAPIPromise(
1068
+ ensureExecuted,
1069
+ () => tracePromiseAsResponse(
1070
+ _chunk2XDW3UCGjs.openAIChannels.chatCompletionsCreate,
1071
+ createChannelContext(
1072
+ _chunk2XDW3UCGjs.openAIChannels.chatCompletionsCreate,
1073
+ params,
1074
+ span_info
1075
+ ),
1076
+ getAPIPromise()
1077
+ ),
1078
+ getAPIPromise
1079
+ );
842
1080
  };
843
1081
  }
844
1082
  function createEndpointProxy(target, wrapperFn) {
@@ -856,6 +1094,11 @@ function wrapApiCreateWithChannel(create, channel) {
856
1094
  return (allParams, options) => {
857
1095
  const { span_info, params } = splitSpanInfo(allParams);
858
1096
  let executionPromise = null;
1097
+ let apiPromise = null;
1098
+ const getAPIPromise = () => {
1099
+ apiPromise ??= create(params, options);
1100
+ return apiPromise;
1101
+ };
859
1102
  const ensureExecuted = () => {
860
1103
  if (!executionPromise) {
861
1104
  executionPromise = (async () => {
@@ -863,24 +1106,32 @@ function wrapApiCreateWithChannel(create, channel) {
863
1106
  return tracePromiseWithResponse(
864
1107
  channel,
865
1108
  traceContext,
866
- create(params, options)
1109
+ getAPIPromise()
867
1110
  );
868
1111
  })();
869
1112
  }
870
1113
  return executionPromise;
871
1114
  };
872
- return createLazyAPIPromise(ensureExecuted);
1115
+ return createLazyAPIPromise(
1116
+ ensureExecuted,
1117
+ () => tracePromiseAsResponse(
1118
+ channel,
1119
+ createChannelContext(channel, params, span_info),
1120
+ getAPIPromise()
1121
+ ),
1122
+ getAPIPromise
1123
+ );
873
1124
  };
874
1125
  }
875
- var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunkBBE7SNRVjs.openAIChannels.embeddingsCreate);
876
- var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunkBBE7SNRVjs.openAIChannels.moderationsCreate);
1126
+ var wrapEmbeddings = (create) => wrapApiCreateWithChannel(create, _chunk2XDW3UCGjs.openAIChannels.embeddingsCreate);
1127
+ var wrapModerations = (create) => wrapApiCreateWithChannel(create, _chunk2XDW3UCGjs.openAIChannels.moderationsCreate);
877
1128
 
878
1129
  // src/wrappers/ai-sdk/ai-sdk.ts
879
1130
  function isModuleNamespace(obj) {
880
1131
  if (!obj || typeof obj !== "object") {
881
1132
  return false;
882
1133
  }
883
- if (_optionalChain([obj, 'access', _12 => _12.constructor, 'optionalAccess', _13 => _13.name]) === "Module") {
1134
+ if (_optionalChain([obj, 'access', _18 => _18.constructor, 'optionalAccess', _19 => _19.name]) === "Module") {
884
1135
  return true;
885
1136
  }
886
1137
  try {
@@ -889,7 +1140,7 @@ function isModuleNamespace(obj) {
889
1140
  const firstKey = keys[0];
890
1141
  const descriptor = Object.getOwnPropertyDescriptor(obj, firstKey);
891
1142
  return descriptor ? !descriptor.configurable && !descriptor.writable : false;
892
- } catch (e2) {
1143
+ } catch (e4) {
893
1144
  return false;
894
1145
  }
895
1146
  }
@@ -905,6 +1156,13 @@ function wrapAISDK(aiSDK, options = {}) {
905
1156
  switch (prop) {
906
1157
  case "generateText":
907
1158
  return wrapGenerateText(typedAISDK.generateText, options, typedAISDK);
1159
+ case "generateImage":
1160
+ case "experimental_generateImage":
1161
+ return typeof original === "function" ? wrapGenerateImage(
1162
+ original,
1163
+ options,
1164
+ typedAISDK
1165
+ ) : original;
908
1166
  case "streamText":
909
1167
  return wrapStreamText(typedAISDK.streamText, options, typedAISDK);
910
1168
  case "generateObject":
@@ -937,17 +1195,17 @@ function isHarnessAgentInstance(instance) {
937
1195
  let prototype = Object.getPrototypeOf(instance);
938
1196
  while (prototype !== null && !visited.has(prototype)) {
939
1197
  visited.add(prototype);
940
- const constructor = _optionalChain([Object, 'access', _14 => _14.getOwnPropertyDescriptor, 'call', _15 => _15(
1198
+ const constructor = _optionalChain([Object, 'access', _20 => _20.getOwnPropertyDescriptor, 'call', _21 => _21(
941
1199
  prototype,
942
1200
  "constructor"
943
- ), 'optionalAccess', _16 => _16.value]);
944
- const constructorName = typeof constructor === "function" ? _optionalChain([Object, 'access', _17 => _17.getOwnPropertyDescriptor, 'call', _18 => _18(constructor, "name"), 'optionalAccess', _19 => _19.value]) : void 0;
1201
+ ), 'optionalAccess', _22 => _22.value]);
1202
+ const constructorName = typeof constructor === "function" ? _optionalChain([Object, 'access', _23 => _23.getOwnPropertyDescriptor, 'call', _24 => _24(constructor, "name"), 'optionalAccess', _25 => _25.value]) : void 0;
945
1203
  if (constructorName === "HarnessAgent") {
946
1204
  return true;
947
1205
  }
948
1206
  prototype = Object.getPrototypeOf(prototype);
949
1207
  }
950
- } catch (e3) {
1208
+ } catch (e5) {
951
1209
  }
952
1210
  return false;
953
1211
  }
@@ -976,7 +1234,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
976
1234
  return wrapHarnessAgentGenerate(
977
1235
  original,
978
1236
  harnessAgent,
979
- _chunkBBE7SNRVjs.harnessAgentChannels.generate,
1237
+ _chunk2XDW3UCGjs.harnessAgentChannels.generate,
980
1238
  "HarnessAgent.generate",
981
1239
  options
982
1240
  );
@@ -984,7 +1242,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
984
1242
  return wrapHarnessAgentStream(
985
1243
  original,
986
1244
  harnessAgent,
987
- _chunkBBE7SNRVjs.harnessAgentChannels.stream,
1245
+ _chunk2XDW3UCGjs.harnessAgentChannels.stream,
988
1246
  "HarnessAgent.stream",
989
1247
  options
990
1248
  );
@@ -992,7 +1250,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
992
1250
  return wrapHarnessAgentGenerate(
993
1251
  original,
994
1252
  harnessAgent,
995
- _chunkBBE7SNRVjs.harnessAgentChannels.continueGenerate,
1253
+ _chunk2XDW3UCGjs.harnessAgentChannels.continueGenerate,
996
1254
  "HarnessAgent.continueGenerate",
997
1255
  options
998
1256
  );
@@ -1000,7 +1258,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
1000
1258
  return wrapHarnessAgentStream(
1001
1259
  original,
1002
1260
  harnessAgent,
1003
- _chunkBBE7SNRVjs.harnessAgentChannels.continueStream,
1261
+ _chunk2XDW3UCGjs.harnessAgentChannels.continueStream,
1004
1262
  "HarnessAgent.continueStream",
1005
1263
  options
1006
1264
  );
@@ -1023,7 +1281,7 @@ var wrapAgentClass = (AgentClass, options = {}) => {
1023
1281
  };
1024
1282
  var wrapHarnessAgentCreateSession = (createSession, instance) => {
1025
1283
  const wrapper = function(params) {
1026
- return _chunkBBE7SNRVjs.harnessAgentChannels.createSession.tracePromise(
1284
+ return _chunk2XDW3UCGjs.harnessAgentChannels.createSession.tracePromise(
1027
1285
  () => params === void 0 ? createSession.call(instance) : createSession.call(instance, params),
1028
1286
  createAISDKChannelContext(_nullishCoalesce(params, () => ( {})), { self: instance })
1029
1287
  );
@@ -1069,15 +1327,15 @@ var wrapAgentGenerate = (generate, instance, options = {}) => {
1069
1327
  };
1070
1328
  function generateChannelForAgent(agentName) {
1071
1329
  if (agentName === "ToolLoopAgent") {
1072
- return _chunkBBE7SNRVjs.aiSDKChannels.toolLoopAgentGenerate;
1330
+ return _chunk2XDW3UCGjs.aiSDKChannels.toolLoopAgentGenerate;
1073
1331
  }
1074
- return _chunkBBE7SNRVjs.aiSDKChannels.agentGenerate;
1332
+ return _chunk2XDW3UCGjs.aiSDKChannels.agentGenerate;
1075
1333
  }
1076
1334
  var wrapAgentStream = (stream, instance, options = {}) => {
1077
1335
  const defaultName = `${instance.constructor.name}.stream`;
1078
1336
  return (params) => {
1079
1337
  const workflowAgent = instance.constructor.name === "WorkflowAgent";
1080
- if (workflowAgent && _chunkOBBWQW6Kjs.currentWorkflowAgentWrapperSpan.call(void 0, )) {
1338
+ if (workflowAgent && _chunkTWCDSYJNjs.currentWorkflowAgentWrapperSpan.call(void 0, )) {
1081
1339
  const { span_info: _spanInfo, ...cleanParams } = params;
1082
1340
  return stream.call(instance, { ...instance.settings, ...cleanParams });
1083
1341
  }
@@ -1096,12 +1354,12 @@ var wrapAgentStream = (stream, instance, options = {}) => {
1096
1354
  };
1097
1355
  function streamChannelForAgent(agentName) {
1098
1356
  if (agentName === "ToolLoopAgent") {
1099
- return _chunkBBE7SNRVjs.aiSDKChannels.toolLoopAgentStream;
1357
+ return _chunk2XDW3UCGjs.aiSDKChannels.toolLoopAgentStream;
1100
1358
  }
1101
1359
  if (agentName === "WorkflowAgent") {
1102
- return _chunkBBE7SNRVjs.aiSDKChannels.workflowAgentStream;
1360
+ return _chunk2XDW3UCGjs.aiSDKChannels.workflowAgentStream;
1103
1361
  }
1104
- return _chunkBBE7SNRVjs.aiSDKChannels.agentStream;
1362
+ return _chunk2XDW3UCGjs.aiSDKChannels.agentStream;
1105
1363
  }
1106
1364
  var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {}, options = {}) => {
1107
1365
  const wrapper = async function(allParams) {
@@ -1125,7 +1383,7 @@ var makeGenerateTextWrapper = (channel, name, generateText, contextOptions = {},
1125
1383
  };
1126
1384
  var wrapGenerateText = (generateText, options = {}, aiSDK) => {
1127
1385
  return makeGenerateTextWrapper(
1128
- _chunkBBE7SNRVjs.aiSDKChannels.generateText,
1386
+ _chunk2XDW3UCGjs.aiSDKChannels.generateText,
1129
1387
  "generateText",
1130
1388
  generateText,
1131
1389
  { aiSDK },
@@ -1134,13 +1392,39 @@ var wrapGenerateText = (generateText, options = {}, aiSDK) => {
1134
1392
  };
1135
1393
  var wrapGenerateObject = (generateObject, options = {}, aiSDK) => {
1136
1394
  return makeGenerateTextWrapper(
1137
- _chunkBBE7SNRVjs.aiSDKChannels.generateObject,
1395
+ _chunk2XDW3UCGjs.aiSDKChannels.generateObject,
1138
1396
  "generateObject",
1139
1397
  generateObject,
1140
1398
  { aiSDK },
1141
1399
  options
1142
1400
  );
1143
1401
  };
1402
+ var wrapGenerateImage = (generateImage, options = {}, aiSDK) => {
1403
+ return makeGenerateImageWrapper(generateImage, { aiSDK }, options);
1404
+ };
1405
+ var makeGenerateImageWrapper = (generateImage, contextOptions = {}, options = {}) => {
1406
+ const wrapper = async function(allParams) {
1407
+ const { span_info, ...params } = allParams;
1408
+ const tracedParams = { ...params };
1409
+ return _chunk2XDW3UCGjs.aiSDKChannels.generateImage.tracePromise(
1410
+ () => generateImage(tracedParams),
1411
+ createAISDKChannelContext(tracedParams, {
1412
+ aiSDK: contextOptions.aiSDK,
1413
+ denyOutputPaths: options.denyOutputPaths,
1414
+ self: contextOptions.self,
1415
+ span_info: mergeSpanInfo(span_info, {
1416
+ name: "generateImage",
1417
+ spanType: contextOptions.spanType
1418
+ })
1419
+ })
1420
+ );
1421
+ };
1422
+ Object.defineProperty(wrapper, "name", {
1423
+ value: "generateImage",
1424
+ writable: false
1425
+ });
1426
+ return wrapper;
1427
+ };
1144
1428
  var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {}) => {
1145
1429
  const wrapper = async function(allParams) {
1146
1430
  const { span_info, ...params } = allParams;
@@ -1163,7 +1447,7 @@ var makeEmbedWrapper = (channel, name, embed, contextOptions = {}, options = {})
1163
1447
  };
1164
1448
  var wrapEmbed = (embed, options = {}, aiSDK) => {
1165
1449
  return makeEmbedWrapper(
1166
- _chunkBBE7SNRVjs.aiSDKChannels.embed,
1450
+ _chunk2XDW3UCGjs.aiSDKChannels.embed,
1167
1451
  "embed",
1168
1452
  embed,
1169
1453
  { aiSDK },
@@ -1172,7 +1456,7 @@ var wrapEmbed = (embed, options = {}, aiSDK) => {
1172
1456
  };
1173
1457
  var wrapEmbedMany = (embedMany, options = {}, aiSDK) => {
1174
1458
  return makeEmbedWrapper(
1175
- _chunkBBE7SNRVjs.aiSDKChannels.embedMany,
1459
+ _chunk2XDW3UCGjs.aiSDKChannels.embedMany,
1176
1460
  "embedMany",
1177
1461
  embedMany,
1178
1462
  { aiSDK },
@@ -1183,7 +1467,7 @@ var makeRerankWrapper = (rerank, contextOptions = {}, options = {}) => {
1183
1467
  const wrapper = async function(allParams) {
1184
1468
  const { span_info, ...params } = allParams;
1185
1469
  const tracedParams = { ...params };
1186
- return _chunkBBE7SNRVjs.aiSDKChannels.rerank.tracePromise(
1470
+ return _chunk2XDW3UCGjs.aiSDKChannels.rerank.tracePromise(
1187
1471
  () => rerank(tracedParams),
1188
1472
  createAISDKChannelContext(tracedParams, {
1189
1473
  aiSDK: contextOptions.aiSDK,
@@ -1222,7 +1506,7 @@ var makeStreamWrapper = (channel, name, streamText, contextOptions = {}, options
1222
1506
  };
1223
1507
  var wrapStreamText = (streamText, options = {}, aiSDK) => {
1224
1508
  return makeStreamWrapper(
1225
- _chunkBBE7SNRVjs.aiSDKChannels.streamText,
1509
+ _chunk2XDW3UCGjs.aiSDKChannels.streamText,
1226
1510
  "streamText",
1227
1511
  streamText,
1228
1512
  { aiSDK },
@@ -1231,7 +1515,7 @@ var wrapStreamText = (streamText, options = {}, aiSDK) => {
1231
1515
  };
1232
1516
  var wrapStreamObject = (streamObject, options = {}, aiSDK) => {
1233
1517
  return makeStreamWrapper(
1234
- _chunkBBE7SNRVjs.aiSDKChannels.streamObject,
1518
+ _chunk2XDW3UCGjs.aiSDKChannels.streamObject,
1235
1519
  "streamObject",
1236
1520
  streamObject,
1237
1521
  { aiSDK },
@@ -1244,11 +1528,11 @@ function mergeSpanInfo(spanInfo, defaults) {
1244
1528
  }
1245
1529
  return {
1246
1530
  ...spanInfo,
1247
- ..._optionalChain([spanInfo, 'optionalAccess', _20 => _20.name]) ? {} : defaults.name ? { name: defaults.name } : {},
1248
- ...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess', _21 => _21.spanAttributes]) ? {
1531
+ ..._optionalChain([spanInfo, 'optionalAccess', _26 => _26.name]) ? {} : defaults.name ? { name: defaults.name } : {},
1532
+ ...defaults.spanType !== void 0 || _optionalChain([spanInfo, 'optionalAccess', _27 => _27.spanAttributes]) ? {
1249
1533
  spanAttributes: {
1250
1534
  ...defaults.spanType !== void 0 ? { type: defaults.spanType } : {},
1251
- ..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess', _22 => _22.spanAttributes]), () => ( {}))
1535
+ ..._nullishCoalesce(_optionalChain([spanInfo, 'optionalAccess', _28 => _28.spanAttributes]), () => ( {}))
1252
1536
  }
1253
1537
  } : {}
1254
1538
  };
@@ -1266,7 +1550,7 @@ function createAISDKChannelContext(params, context = {}) {
1266
1550
  // src/wrappers/ai-sdk/deprecated/wrapAISDKModel.ts
1267
1551
  function wrapAISDKModel(model) {
1268
1552
  const m = model;
1269
- if (_optionalChain([m, 'optionalAccess', _23 => _23.specificationVersion]) === "v1" && typeof _optionalChain([m, 'optionalAccess', _24 => _24.provider]) === "string" && typeof _optionalChain([m, 'optionalAccess', _25 => _25.modelId]) === "string") {
1553
+ if (_optionalChain([m, 'optionalAccess', _29 => _29.specificationVersion]) === "v1" && typeof _optionalChain([m, 'optionalAccess', _30 => _30.provider]) === "string" && typeof _optionalChain([m, 'optionalAccess', _31 => _31.modelId]) === "string") {
1270
1554
  return new BraintrustLanguageModelWrapper(m);
1271
1555
  } else {
1272
1556
  console.warn("Unsupported AI SDK model. Not wrapping.");
@@ -1303,19 +1587,19 @@ var BraintrustLanguageModelWrapper = class {
1303
1587
  // For the first cut, do not support custom span_info arguments. We can
1304
1588
  // propagate those via async local storage
1305
1589
  async doGenerate(options) {
1306
- const span = _chunkOBBWQW6Kjs.startSpan.call(void 0,
1307
- _chunkBBE7SNRVjs.withSpanInstrumentationName.call(void 0,
1590
+ const span = _chunkTWCDSYJNjs.startSpan.call(void 0,
1591
+ _chunk2XDW3UCGjs.withSpanInstrumentationName.call(void 0,
1308
1592
  {
1309
1593
  name: "Chat Completion",
1310
1594
  spanAttributes: {
1311
1595
  type: "llm"
1312
1596
  }
1313
1597
  },
1314
- _chunkBBE7SNRVjs.INSTRUMENTATION_NAMES.AI_SDK
1598
+ _chunk2XDW3UCGjs.INSTRUMENTATION_NAMES.AI_SDK
1315
1599
  )
1316
1600
  );
1317
1601
  const { prompt, mode, ...rest } = options;
1318
- const startTime = _chunkOBBWQW6Kjs.getCurrentUnixTimestamp.call(void 0, );
1602
+ const startTime = _chunkTWCDSYJNjs.getCurrentUnixTimestamp.call(void 0, );
1319
1603
  try {
1320
1604
  const ret = await this.model.doGenerate(options);
1321
1605
  span.log({
@@ -1327,12 +1611,12 @@ var BraintrustLanguageModelWrapper = class {
1327
1611
  },
1328
1612
  output: postProcessOutput(ret.text, ret.toolCalls, ret.finishReason),
1329
1613
  metrics: {
1330
- time_to_first_token: _chunkOBBWQW6Kjs.getCurrentUnixTimestamp.call(void 0, ) - startTime,
1331
- tokens: !_chunkOBBWQW6Kjs.isEmpty.call(void 0, ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
1332
- prompt_tokens: _optionalChain([ret, 'access', _26 => _26.usage, 'optionalAccess', _27 => _27.promptTokens]),
1333
- completion_tokens: _optionalChain([ret, 'access', _28 => _28.usage, 'optionalAccess', _29 => _29.completionTokens]),
1334
- cached: _chunkOBBWQW6Kjs.parseCachedHeader.call(void 0,
1335
- _nullishCoalesce(_optionalChain([ret, 'access', _30 => _30.rawResponse, 'optionalAccess', _31 => _31.headers, 'optionalAccess', _32 => _32[_chunkOBBWQW6Kjs.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _33 => _33.rawResponse, 'optionalAccess', _34 => _34.headers, 'optionalAccess', _35 => _35[_chunkOBBWQW6Kjs.LEGACY_CACHED_HEADER]])))
1614
+ time_to_first_token: _chunkTWCDSYJNjs.getCurrentUnixTimestamp.call(void 0, ) - startTime,
1615
+ tokens: !_chunkTWCDSYJNjs.isEmpty.call(void 0, ret.usage) ? ret.usage.promptTokens + ret.usage.completionTokens : void 0,
1616
+ prompt_tokens: _optionalChain([ret, 'access', _32 => _32.usage, 'optionalAccess', _33 => _33.promptTokens]),
1617
+ completion_tokens: _optionalChain([ret, 'access', _34 => _34.usage, 'optionalAccess', _35 => _35.completionTokens]),
1618
+ cached: _chunkTWCDSYJNjs.parseCachedHeader.call(void 0,
1619
+ _nullishCoalesce(_optionalChain([ret, 'access', _36 => _36.rawResponse, 'optionalAccess', _37 => _37.headers, 'optionalAccess', _38 => _38[_chunkTWCDSYJNjs.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _39 => _39.rawResponse, 'optionalAccess', _40 => _40.headers, 'optionalAccess', _41 => _41[_chunkTWCDSYJNjs.LEGACY_CACHED_HEADER]])))
1336
1620
  )
1337
1621
  }
1338
1622
  });
@@ -1343,16 +1627,16 @@ var BraintrustLanguageModelWrapper = class {
1343
1627
  }
1344
1628
  async doStream(options) {
1345
1629
  const { prompt, mode, ...rest } = options;
1346
- const startTime = _chunkOBBWQW6Kjs.getCurrentUnixTimestamp.call(void 0, );
1347
- const span = _chunkOBBWQW6Kjs.startSpan.call(void 0,
1348
- _chunkBBE7SNRVjs.withSpanInstrumentationName.call(void 0,
1630
+ const startTime = _chunkTWCDSYJNjs.getCurrentUnixTimestamp.call(void 0, );
1631
+ const span = _chunkTWCDSYJNjs.startSpan.call(void 0,
1632
+ _chunk2XDW3UCGjs.withSpanInstrumentationName.call(void 0,
1349
1633
  {
1350
1634
  name: "Chat Completion",
1351
1635
  spanAttributes: {
1352
1636
  type: "llm"
1353
1637
  }
1354
1638
  },
1355
- _chunkBBE7SNRVjs.INSTRUMENTATION_NAMES.AI_SDK
1639
+ _chunk2XDW3UCGjs.INSTRUMENTATION_NAMES.AI_SDK
1356
1640
  )
1357
1641
  );
1358
1642
  span.log({
@@ -1383,7 +1667,7 @@ var BraintrustLanguageModelWrapper = class {
1383
1667
  new TransformStream({
1384
1668
  transform(chunk, controller) {
1385
1669
  if (time_to_first_token === void 0) {
1386
- time_to_first_token = _chunkOBBWQW6Kjs.getCurrentUnixTimestamp.call(void 0, ) - startTime;
1670
+ time_to_first_token = _chunkTWCDSYJNjs.getCurrentUnixTimestamp.call(void 0, ) - startTime;
1387
1671
  span.log({ metrics: { time_to_first_token } });
1388
1672
  }
1389
1673
  switch (chunk.type) {
@@ -1428,11 +1712,11 @@ var BraintrustLanguageModelWrapper = class {
1428
1712
  ),
1429
1713
  metrics: {
1430
1714
  time_to_first_token,
1431
- tokens: !_chunkOBBWQW6Kjs.isEmpty.call(void 0, usage) ? usage.promptTokens + usage.completionTokens : void 0,
1432
- prompt_tokens: _optionalChain([usage, 'optionalAccess', _36 => _36.promptTokens]),
1433
- completion_tokens: _optionalChain([usage, 'optionalAccess', _37 => _37.completionTokens]),
1434
- cached: _chunkOBBWQW6Kjs.parseCachedHeader.call(void 0,
1435
- _nullishCoalesce(_optionalChain([ret, 'access', _38 => _38.rawResponse, 'optionalAccess', _39 => _39.headers, 'optionalAccess', _40 => _40[_chunkOBBWQW6Kjs.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _41 => _41.rawResponse, 'optionalAccess', _42 => _42.headers, 'optionalAccess', _43 => _43[_chunkOBBWQW6Kjs.LEGACY_CACHED_HEADER]])))
1715
+ tokens: !_chunkTWCDSYJNjs.isEmpty.call(void 0, usage) ? usage.promptTokens + usage.completionTokens : void 0,
1716
+ prompt_tokens: _optionalChain([usage, 'optionalAccess', _42 => _42.promptTokens]),
1717
+ completion_tokens: _optionalChain([usage, 'optionalAccess', _43 => _43.completionTokens]),
1718
+ cached: _chunkTWCDSYJNjs.parseCachedHeader.call(void 0,
1719
+ _nullishCoalesce(_optionalChain([ret, 'access', _44 => _44.rawResponse, 'optionalAccess', _45 => _45.headers, 'optionalAccess', _46 => _46[_chunkTWCDSYJNjs.X_CACHED_HEADER]]), () => ( _optionalChain([ret, 'access', _47 => _47.rawResponse, 'optionalAccess', _48 => _48.headers, 'optionalAccess', _49 => _49[_chunkTWCDSYJNjs.LEGACY_CACHED_HEADER]])))
1436
1720
  )
1437
1721
  }
1438
1722
  });
@@ -1476,7 +1760,7 @@ function postProcessPrompt(prompt) {
1476
1760
  return [
1477
1761
  {
1478
1762
  role: "assistant",
1479
- content: _optionalChain([textPart, 'optionalAccess', _44 => _44.text]),
1763
+ content: _optionalChain([textPart, 'optionalAccess', _50 => _50.text]),
1480
1764
  ...toolCallParts.length > 0 ? {
1481
1765
  tool_calls: toolCallParts.map((part) => ({
1482
1766
  id: part.toolCallId,
@@ -1549,23 +1833,23 @@ function postProcessOutput(text, toolCalls2, finishReason) {
1549
1833
 
1550
1834
  // src/wrappers/ai-sdk/deprecated/BraintrustMiddleware.ts
1551
1835
  function detectProviderFromResult(result) {
1552
- if (!_optionalChain([result, 'optionalAccess', _45 => _45.providerMetadata])) {
1836
+ if (!_optionalChain([result, 'optionalAccess', _51 => _51.providerMetadata])) {
1553
1837
  return void 0;
1554
1838
  }
1555
1839
  const keys = Object.keys(result.providerMetadata);
1556
- return _optionalChain([keys, 'optionalAccess', _46 => _46.at, 'call', _47 => _47(0)]);
1840
+ return _optionalChain([keys, 'optionalAccess', _52 => _52.at, 'call', _53 => _53(0)]);
1557
1841
  }
1558
1842
  function extractModelFromResult(result) {
1559
- if (_optionalChain([result, 'optionalAccess', _48 => _48.response, 'optionalAccess', _49 => _49.modelId])) {
1843
+ if (_optionalChain([result, 'optionalAccess', _54 => _54.response, 'optionalAccess', _55 => _55.modelId])) {
1560
1844
  return result.response.modelId;
1561
1845
  }
1562
- if (_optionalChain([result, 'optionalAccess', _50 => _50.request, 'optionalAccess', _51 => _51.body, 'optionalAccess', _52 => _52.model])) {
1846
+ if (_optionalChain([result, 'optionalAccess', _56 => _56.request, 'optionalAccess', _57 => _57.body, 'optionalAccess', _58 => _58.model])) {
1563
1847
  return result.request.body.model;
1564
1848
  }
1565
1849
  return void 0;
1566
1850
  }
1567
1851
  function extractModelFromWrapGenerateCallback(model) {
1568
- return _optionalChain([model, 'optionalAccess', _53 => _53.modelId]);
1852
+ return _optionalChain([model, 'optionalAccess', _59 => _59.modelId]);
1569
1853
  }
1570
1854
  function camelToSnake(str) {
1571
1855
  return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
@@ -1610,19 +1894,19 @@ function normalizeUsageMetrics(usage, provider, providerMetadata) {
1610
1894
  metrics.prompt_cached_tokens = cachedInputTokens;
1611
1895
  }
1612
1896
  if (provider === "anthropic") {
1613
- const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess', _54 => _54.anthropic]);
1897
+ const anthropicMetadata = _optionalChain([providerMetadata, 'optionalAccess', _60 => _60.anthropic]);
1614
1898
  if (anthropicMetadata) {
1615
1899
  const cacheReadTokens = getNumberProperty(anthropicMetadata.usage, "cache_read_input_tokens") || 0;
1616
1900
  const cacheCreationTokens = getNumberProperty(
1617
1901
  anthropicMetadata.usage,
1618
1902
  "cache_creation_input_tokens"
1619
1903
  ) || 0;
1620
- const cacheTokens = _chunkOBBWQW6Kjs.extractAnthropicCacheTokens.call(void 0,
1904
+ const cacheTokens = _chunkTWCDSYJNjs.extractAnthropicCacheTokens.call(void 0,
1621
1905
  cacheReadTokens,
1622
1906
  cacheCreationTokens
1623
1907
  );
1624
1908
  Object.assign(metrics, cacheTokens);
1625
- return _chunkOBBWQW6Kjs.toNumericMetrics.call(void 0, _chunkOBBWQW6Kjs.finalizeAnthropicTokens.call(void 0, metrics));
1909
+ return _chunkTWCDSYJNjs.toNumericMetrics.call(void 0, _chunkTWCDSYJNjs.finalizeAnthropicTokens.call(void 0, metrics));
1626
1910
  }
1627
1911
  }
1628
1912
  return metrics;
@@ -1636,7 +1920,7 @@ function buildAssistantOutputWithToolCalls(result, toolCalls2) {
1636
1920
  {
1637
1921
  index: 0,
1638
1922
  logprobs: null,
1639
- finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess', _55 => _55.finishReason])), () => ( (toolCalls2.length ? "tool_calls" : void 0))),
1923
+ finish_reason: _nullishCoalesce(normalizeFinishReason(_optionalChain([result, 'optionalAccess', _61 => _61.finishReason])), () => ( (toolCalls2.length ? "tool_calls" : void 0))),
1640
1924
  message: {
1641
1925
  role: "assistant",
1642
1926
  tool_calls: toolCalls2.length > 0 ? toolCalls2 : void 0
@@ -1649,7 +1933,7 @@ function extractToolCallsFromSteps(steps) {
1649
1933
  if (!Array.isArray(steps)) return toolCalls2;
1650
1934
  let idx = 0;
1651
1935
  for (const step of steps) {
1652
- const blocks = _optionalChain([step, 'optionalAccess', _56 => _56.content]);
1936
+ const blocks = _optionalChain([step, 'optionalAccess', _62 => _62.content]);
1653
1937
  if (!Array.isArray(blocks)) continue;
1654
1938
  for (const block of blocks) {
1655
1939
  if (block && typeof block === "object" && block.type === "tool-call") {
@@ -1672,7 +1956,7 @@ function extractToolCallsFromBlocks(blocks) {
1672
1956
  return extractToolCallsFromSteps([{ content: blocks }]);
1673
1957
  }
1674
1958
  function extractInput(params) {
1675
- return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _57 => _57.prompt]), () => ( _optionalChain([params, 'optionalAccess', _58 => _58.messages]))), () => ( _optionalChain([params, 'optionalAccess', _59 => _59.system])));
1959
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _63 => _63.prompt]), () => ( _optionalChain([params, 'optionalAccess', _64 => _64.messages]))), () => ( _optionalChain([params, 'optionalAccess', _65 => _65.system])));
1676
1960
  }
1677
1961
  var V2_EXCLUDE_KEYS = /* @__PURE__ */ new Set([
1678
1962
  "prompt",
@@ -1694,23 +1978,23 @@ function BraintrustMiddleware(config = {}) {
1694
1978
  model: modelFromWrapGenerate
1695
1979
  }) => {
1696
1980
  const rawInput = extractInput(params);
1697
- const processedInput = _chunkOBBWQW6Kjs.processInputAttachments.call(void 0, rawInput);
1981
+ const processedInput = _chunkTWCDSYJNjs.processInputAttachments.call(void 0, rawInput);
1698
1982
  const spanArgs = {
1699
- name: _optionalChain([config, 'access', _60 => _60.spanInfo, 'optionalAccess', _61 => _61.name]) || "ai-sdk.doGenerate",
1983
+ name: _optionalChain([config, 'access', _66 => _66.spanInfo, 'optionalAccess', _67 => _67.name]) || "ai-sdk.doGenerate",
1700
1984
  spanAttributes: {
1701
1985
  type: "llm" /* LLM */,
1702
- ..._optionalChain([config, 'access', _62 => _62.spanInfo, 'optionalAccess', _63 => _63.spanAttributes]) || {}
1986
+ ..._optionalChain([config, 'access', _68 => _68.spanInfo, 'optionalAccess', _69 => _69.spanAttributes]) || {}
1703
1987
  },
1704
1988
  event: {
1705
1989
  input: processedInput,
1706
1990
  metadata: {
1707
1991
  ...extractModelParameters(params, V2_EXCLUDE_KEYS),
1708
- ..._optionalChain([config, 'access', _64 => _64.spanInfo, 'optionalAccess', _65 => _65.metadata]) || {}
1992
+ ..._optionalChain([config, 'access', _70 => _70.spanInfo, 'optionalAccess', _71 => _71.metadata]) || {}
1709
1993
  }
1710
1994
  }
1711
1995
  };
1712
- const span = _chunkOBBWQW6Kjs.startSpan.call(void 0,
1713
- _chunkBBE7SNRVjs.withSpanInstrumentationName.call(void 0, spanArgs, _chunkBBE7SNRVjs.INSTRUMENTATION_NAMES.AI_SDK)
1996
+ const span = _chunkTWCDSYJNjs.startSpan.call(void 0,
1997
+ _chunk2XDW3UCGjs.withSpanInstrumentationName.call(void 0, spanArgs, _chunk2XDW3UCGjs.INSTRUMENTATION_NAMES.AI_SDK)
1714
1998
  );
1715
1999
  try {
1716
2000
  const result = await doGenerate();
@@ -1733,12 +2017,12 @@ function BraintrustMiddleware(config = {}) {
1733
2017
  metadata.model = modelId;
1734
2018
  }
1735
2019
  }
1736
- let toolCalls2 = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess', _66 => _66.steps]));
2020
+ let toolCalls2 = extractToolCallsFromSteps(_optionalChain([result, 'optionalAccess', _72 => _72.steps]));
1737
2021
  if (!toolCalls2 || toolCalls2.length === 0) {
1738
- toolCalls2 = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess', _67 => _67.content]));
2022
+ toolCalls2 = extractToolCallsFromBlocks(_optionalChain([result, 'optionalAccess', _73 => _73.content]));
1739
2023
  }
1740
2024
  span.log({
1741
- output: toolCalls2.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls2) : _optionalChain([result, 'optionalAccess', _68 => _68.content]),
2025
+ output: toolCalls2.length > 0 ? buildAssistantOutputWithToolCalls(result, toolCalls2) : _optionalChain([result, 'optionalAccess', _74 => _74.content]),
1742
2026
  metadata,
1743
2027
  metrics: normalizeUsageMetrics(
1744
2028
  result.usage,
@@ -1758,23 +2042,23 @@ function BraintrustMiddleware(config = {}) {
1758
2042
  },
1759
2043
  wrapStream: async ({ doStream, params }) => {
1760
2044
  const rawInput = extractInput(params);
1761
- const processedInput = _chunkOBBWQW6Kjs.processInputAttachments.call(void 0, rawInput);
2045
+ const processedInput = _chunkTWCDSYJNjs.processInputAttachments.call(void 0, rawInput);
1762
2046
  const spanArgs = {
1763
- name: _optionalChain([config, 'access', _69 => _69.spanInfo, 'optionalAccess', _70 => _70.name]) || "ai-sdk.doStream",
2047
+ name: _optionalChain([config, 'access', _75 => _75.spanInfo, 'optionalAccess', _76 => _76.name]) || "ai-sdk.doStream",
1764
2048
  spanAttributes: {
1765
2049
  type: "llm" /* LLM */,
1766
- ..._optionalChain([config, 'access', _71 => _71.spanInfo, 'optionalAccess', _72 => _72.spanAttributes]) || {}
2050
+ ..._optionalChain([config, 'access', _77 => _77.spanInfo, 'optionalAccess', _78 => _78.spanAttributes]) || {}
1767
2051
  },
1768
2052
  event: {
1769
2053
  input: processedInput,
1770
2054
  metadata: {
1771
2055
  ...extractModelParameters(params, V2_EXCLUDE_KEYS),
1772
- ..._optionalChain([config, 'access', _73 => _73.spanInfo, 'optionalAccess', _74 => _74.metadata]) || {}
2056
+ ..._optionalChain([config, 'access', _79 => _79.spanInfo, 'optionalAccess', _80 => _80.metadata]) || {}
1773
2057
  }
1774
2058
  }
1775
2059
  };
1776
- const span = _chunkOBBWQW6Kjs.startSpan.call(void 0,
1777
- _chunkBBE7SNRVjs.withSpanInstrumentationName.call(void 0, spanArgs, _chunkBBE7SNRVjs.INSTRUMENTATION_NAMES.AI_SDK)
2060
+ const span = _chunkTWCDSYJNjs.startSpan.call(void 0,
2061
+ _chunk2XDW3UCGjs.withSpanInstrumentationName.call(void 0, spanArgs, _chunk2XDW3UCGjs.INSTRUMENTATION_NAMES.AI_SDK)
1778
2062
  );
1779
2063
  try {
1780
2064
  const { stream, ...rest } = await doStream();
@@ -1891,7 +2175,7 @@ function braintrustEveHook(options) {
1891
2175
  }
1892
2176
  };
1893
2177
  }
1894
- function braintrustEveInstrumentation(options) {
2178
+ function createLegacyEveInstrumentation(options) {
1895
2179
  const state = options.defineState(EVE_TRACE_STATE_KEY, emptyEveTraceState);
1896
2180
  return {
1897
2181
  events: {
@@ -1899,7 +2183,7 @@ function braintrustEveInstrumentation(options) {
1899
2183
  try {
1900
2184
  captureEveModelInput(state, input);
1901
2185
  } catch (error) {
1902
- _chunkOBBWQW6Kjs.debugLogger.warn("Error in Eve LLM input capture:", error);
2186
+ _chunk2XDW3UCGjs.debugLogger.warn("Error in Eve LLM input capture:", error);
1903
2187
  }
1904
2188
  }
1905
2189
  },
@@ -1909,7 +2193,7 @@ function braintrustEveInstrumentation(options) {
1909
2193
  };
1910
2194
  }
1911
2195
  function isEveHandleMessageStreamEvent(event) {
1912
- return _chunkOBBWQW6Kjs.isObject.call(void 0, event) && typeof event["type"] === "string";
2196
+ return _chunkTWCDSYJNjs.isObject.call(void 0, event) && typeof event["type"] === "string";
1913
2197
  }
1914
2198
  var ResumedEveSpan = class {
1915
2199
  constructor(reference) {
@@ -1926,11 +2210,11 @@ var ResumedEveSpan = class {
1926
2210
  }
1927
2211
  log(event) {
1928
2212
  const metrics = {
1929
- ..._optionalChain([this, 'access', _75 => _75.reference, 'access', _76 => _76.startEvent, 'optionalAccess', _77 => _77.metrics]),
2213
+ ..._optionalChain([this, 'access', _81 => _81.reference, 'access', _82 => _82.startEvent, 'optionalAccess', _83 => _83.metrics]),
1930
2214
  ...this.endTime === void 0 ? {} : { end: this.endTime },
1931
2215
  ...event.metrics
1932
2216
  };
1933
- _chunkOBBWQW6Kjs.updateSpan.call(void 0, {
2217
+ _chunkTWCDSYJNjs.updateSpan.call(void 0, {
1934
2218
  exported: this.reference.exported,
1935
2219
  ...this.reference.startEvent,
1936
2220
  ...event,
@@ -1939,7 +2223,7 @@ var ResumedEveSpan = class {
1939
2223
  }
1940
2224
  end(args) {
1941
2225
  if (this.endTime === void 0) {
1942
- this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _78 => _78.endTime]), () => ( _chunkOBBWQW6Kjs.getCurrentUnixTimestamp.call(void 0, )));
2226
+ this.endTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _84 => _84.endTime]), () => ( _chunkTWCDSYJNjs.getCurrentUnixTimestamp.call(void 0, )));
1943
2227
  this.log({ metrics: { end: this.endTime } });
1944
2228
  }
1945
2229
  return this.endTime;
@@ -1951,41 +2235,41 @@ var EveBridge = (_class = class {
1951
2235
  }
1952
2236
 
1953
2237
  __init() {this.eventQueuesBySession = /* @__PURE__ */ new Map()}
1954
- __init2() {this.completedToolKeys = new (0, _chunkOBBWQW6Kjs.LRUCache)({
2238
+ __init2() {this.completedToolKeys = new (0, _chunkTWCDSYJNjs.LRUCache)({
1955
2239
  max: MAX_EVE_CACHE_ENTRIES
1956
2240
  })}
1957
- __init3() {this.toolsByCallKey = new (0, _chunkOBBWQW6Kjs.LRUCache)({
2241
+ __init3() {this.toolsByCallKey = new (0, _chunkTWCDSYJNjs.LRUCache)({
1958
2242
  max: MAX_EVE_CACHE_ENTRIES
1959
2243
  })}
1960
- __init4() {this.turnsByKey = new (0, _chunkOBBWQW6Kjs.LRUCache)({
2244
+ __init4() {this.turnsByKey = new (0, _chunkTWCDSYJNjs.LRUCache)({
1961
2245
  max: MAX_EVE_CACHE_ENTRIES
1962
2246
  })}
1963
2247
  async startEveSpan(args) {
1964
- const rowId = _optionalChain([args, 'optionalAccess', _79 => _79.event, 'optionalAccess', _80 => _80.id]);
2248
+ const rowId = _optionalChain([args, 'optionalAccess', _85 => _85.event, 'optionalAccess', _86 => _86.id]);
1965
2249
  const reference = typeof rowId === "string" && readEveTraceState(this.state).spanReferences.find(
1966
2250
  (candidate) => candidate.rowId === rowId
1967
2251
  );
1968
2252
  if (reference) {
1969
2253
  return new ResumedEveSpan(reference);
1970
2254
  }
1971
- const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _81 => _81.startTime]), () => ( _chunkOBBWQW6Kjs.getCurrentUnixTimestamp.call(void 0, )));
1972
- const parentSpanIds = _optionalChain([args, 'optionalAccess', _82 => _82.parentSpanIds]);
2255
+ const startTime = _nullishCoalesce(_optionalChain([args, 'optionalAccess', _87 => _87.startTime]), () => ( _chunkTWCDSYJNjs.getCurrentUnixTimestamp.call(void 0, )));
2256
+ const parentSpanIds = _optionalChain([args, 'optionalAccess', _88 => _88.parentSpanIds]);
1973
2257
  const startEvent = {
1974
2258
  created: (/* @__PURE__ */ new Date()).toISOString(),
1975
2259
  metrics: { start: startTime },
1976
2260
  span_attributes: {
1977
- ..._optionalChain([args, 'optionalAccess', _83 => _83.name]) ? { name: args.name } : {},
1978
- ..._optionalChain([args, 'optionalAccess', _84 => _84.type]) ? { type: args.type } : {},
1979
- ..._optionalChain([args, 'optionalAccess', _85 => _85.spanAttributes])
2261
+ ..._optionalChain([args, 'optionalAccess', _89 => _89.name]) ? { name: args.name } : {},
2262
+ ..._optionalChain([args, 'optionalAccess', _90 => _90.type]) ? { type: args.type } : {},
2263
+ ..._optionalChain([args, 'optionalAccess', _91 => _91.spanAttributes])
1980
2264
  },
1981
2265
  span_parents: parentSpanIds ? "spanId" in parentSpanIds ? [parentSpanIds.spanId] : parentSpanIds.parentSpanIds : []
1982
2266
  };
1983
- const span = _chunkOBBWQW6Kjs.withCurrent.call(void 0,
1984
- _chunkOBBWQW6Kjs.NOOP_SPAN,
1985
- () => _chunkOBBWQW6Kjs._internalStartSpanWithInitialMerge.call(void 0,
1986
- _chunkBBE7SNRVjs.withSpanInstrumentationName.call(void 0,
2267
+ const span = _chunkTWCDSYJNjs.withCurrent.call(void 0,
2268
+ _chunkTWCDSYJNjs.NOOP_SPAN,
2269
+ () => _chunkTWCDSYJNjs._internalStartSpanWithInitialMerge.call(void 0,
2270
+ _chunk2XDW3UCGjs.withSpanInstrumentationName.call(void 0,
1987
2271
  { ...args, startTime },
1988
- _chunkBBE7SNRVjs.INSTRUMENTATION_NAMES.EVE
2272
+ _chunk2XDW3UCGjs.INSTRUMENTATION_NAMES.EVE
1989
2273
  )
1990
2274
  )
1991
2275
  );
@@ -2013,7 +2297,7 @@ var EveBridge = (_class = class {
2013
2297
  };
2014
2298
  });
2015
2299
  } catch (error) {
2016
- _chunkOBBWQW6Kjs.debugLogger.warn("Error exporting Eve span for resumption:", error);
2300
+ _chunk2XDW3UCGjs.debugLogger.warn("Error exporting Eve span for resumption:", error);
2017
2301
  }
2018
2302
  return span;
2019
2303
  }
@@ -2033,7 +2317,7 @@ var EveBridge = (_class = class {
2033
2317
  const previous = state.stepStarts.filter(
2034
2318
  (entry) => entry.turnId === event.data.turnId && entry.stepIndex === event.data.stepIndex
2035
2319
  ).at(-1);
2036
- if (_optionalChain([previous, 'optionalAccess', _86 => _86.open])) {
2320
+ if (_optionalChain([previous, 'optionalAccess', _92 => _92.open])) {
2037
2321
  ordinal = previous.ordinal;
2038
2322
  return state;
2039
2323
  }
@@ -2061,12 +2345,12 @@ var EveBridge = (_class = class {
2061
2345
  let index = -1;
2062
2346
  for (let i = state.stepStarts.length - 1; i >= 0; i--) {
2063
2347
  const entry = state.stepStarts[i];
2064
- if (_optionalChain([entry, 'optionalAccess', _87 => _87.turnId]) === turnId && entry.stepIndex === stepIndex) {
2348
+ if (_optionalChain([entry, 'optionalAccess', _93 => _93.turnId]) === turnId && entry.stepIndex === stepIndex) {
2065
2349
  index = i;
2066
2350
  break;
2067
2351
  }
2068
2352
  }
2069
- if (index < 0 || !_optionalChain([state, 'access', _88 => _88.stepStarts, 'access', _89 => _89[index], 'optionalAccess', _90 => _90.open])) {
2353
+ if (index < 0 || !_optionalChain([state, 'access', _94 => _94.stepStarts, 'access', _95 => _95[index], 'optionalAccess', _96 => _96.open])) {
2070
2354
  return state;
2071
2355
  }
2072
2356
  return {
@@ -2100,7 +2384,7 @@ var EveBridge = (_class = class {
2100
2384
  }
2101
2385
  }
2102
2386
  } catch (error) {
2103
- _chunkOBBWQW6Kjs.debugLogger.warn("Error in Eve hook instrumentation:", error);
2387
+ _chunk2XDW3UCGjs.debugLogger.warn("Error in Eve hook instrumentation:", error);
2104
2388
  }
2105
2389
  };
2106
2390
  const sessionId = event.type === "session.failed" ? event.data.sessionId || sessionIdFromContext(ctx) : sessionIdFromContext(ctx);
@@ -2328,7 +2612,7 @@ var EveBridge = (_class = class {
2328
2612
  return;
2329
2613
  }
2330
2614
  const existingMessage = eveOutputMessage(step.output);
2331
- const existingToolCalls = _chunkOBBWQW6Kjs.isObject.call(void 0, existingMessage) ? existingMessage.tool_calls : void 0;
2615
+ const existingToolCalls = _chunkTWCDSYJNjs.isObject.call(void 0, existingMessage) ? existingMessage.tool_calls : void 0;
2332
2616
  step.output = mergeEveReasoning(
2333
2617
  [
2334
2618
  {
@@ -2392,11 +2676,11 @@ var EveBridge = (_class = class {
2392
2676
  return;
2393
2677
  }
2394
2678
  const toolCallsById = /* @__PURE__ */ new Map();
2395
- if (Array.isArray(step.output) && _chunkOBBWQW6Kjs.isObject.call(void 0, step.output[0])) {
2679
+ if (Array.isArray(step.output) && _chunkTWCDSYJNjs.isObject.call(void 0, step.output[0])) {
2396
2680
  const message = step.output[0]["message"];
2397
- if (_chunkOBBWQW6Kjs.isObject.call(void 0, message) && Array.isArray(message["tool_calls"])) {
2681
+ if (_chunkTWCDSYJNjs.isObject.call(void 0, message) && Array.isArray(message["tool_calls"])) {
2398
2682
  for (const toolCall of message["tool_calls"]) {
2399
- if (_chunkOBBWQW6Kjs.isObject.call(void 0, toolCall) && typeof toolCall["id"] === "string") {
2683
+ if (_chunkTWCDSYJNjs.isObject.call(void 0, toolCall) && typeof toolCall["id"] === "string") {
2400
2684
  toolCallsById.set(toolCall["id"], toolCall);
2401
2685
  }
2402
2686
  }
@@ -2469,7 +2753,7 @@ var EveBridge = (_class = class {
2469
2753
  this.completedToolKeys.set(key, true);
2470
2754
  }
2471
2755
  async handleSubagentCalled(event, ctx, hookMetadata) {
2472
- if (_optionalChain([event, 'access', _91 => _91.data, 'access', _92 => _92.remote, 'optionalAccess', _93 => _93.url])) {
2756
+ if (_optionalChain([event, 'access', _97 => _97.data, 'access', _98 => _98.remote, 'optionalAccess', _99 => _99.url])) {
2473
2757
  return;
2474
2758
  }
2475
2759
  const turn = await this.ensureTurn(event, ctx, hookMetadata);
@@ -2589,11 +2873,11 @@ var EveBridge = (_class = class {
2589
2873
  return;
2590
2874
  }
2591
2875
  const usage = event.data.usage;
2592
- const inputTokens = typeof _optionalChain([usage, 'optionalAccess', _94 => _94.inputTokens]) === "number" && Number.isFinite(usage.inputTokens) && usage.inputTokens >= 0 ? usage.inputTokens : void 0;
2593
- const outputTokens = typeof _optionalChain([usage, 'optionalAccess', _95 => _95.outputTokens]) === "number" && Number.isFinite(usage.outputTokens) && usage.outputTokens >= 0 ? usage.outputTokens : void 0;
2594
- const cacheReadTokens = typeof _optionalChain([usage, 'optionalAccess', _96 => _96.cacheReadTokens]) === "number" && Number.isFinite(usage.cacheReadTokens) && usage.cacheReadTokens >= 0 ? usage.cacheReadTokens : void 0;
2595
- const cacheWriteTokens = typeof _optionalChain([usage, 'optionalAccess', _97 => _97.cacheWriteTokens]) === "number" && Number.isFinite(usage.cacheWriteTokens) && usage.cacheWriteTokens >= 0 ? usage.cacheWriteTokens : void 0;
2596
- const costUsd = typeof _optionalChain([usage, 'optionalAccess', _98 => _98.costUsd]) === "number" && Number.isFinite(usage.costUsd) && usage.costUsd >= 0 ? usage.costUsd : void 0;
2876
+ const inputTokens = typeof _optionalChain([usage, 'optionalAccess', _100 => _100.inputTokens]) === "number" && Number.isFinite(usage.inputTokens) && usage.inputTokens >= 0 ? usage.inputTokens : void 0;
2877
+ const outputTokens = typeof _optionalChain([usage, 'optionalAccess', _101 => _101.outputTokens]) === "number" && Number.isFinite(usage.outputTokens) && usage.outputTokens >= 0 ? usage.outputTokens : void 0;
2878
+ const cacheReadTokens = typeof _optionalChain([usage, 'optionalAccess', _102 => _102.cacheReadTokens]) === "number" && Number.isFinite(usage.cacheReadTokens) && usage.cacheReadTokens >= 0 ? usage.cacheReadTokens : void 0;
2879
+ const cacheWriteTokens = typeof _optionalChain([usage, 'optionalAccess', _103 => _103.cacheWriteTokens]) === "number" && Number.isFinite(usage.cacheWriteTokens) && usage.cacheWriteTokens >= 0 ? usage.cacheWriteTokens : void 0;
2880
+ const costUsd = typeof _optionalChain([usage, 'optionalAccess', _104 => _104.costUsd]) === "number" && Number.isFinite(usage.costUsd) && usage.costUsd >= 0 ? usage.costUsd : void 0;
2597
2881
  const total = inputTokens !== void 0 && outputTokens !== void 0 ? inputTokens + outputTokens : void 0;
2598
2882
  const metrics = {
2599
2883
  ...inputTokens !== void 0 ? { prompt_tokens: inputTokens } : {},
@@ -2605,7 +2889,7 @@ var EveBridge = (_class = class {
2605
2889
  };
2606
2890
  step.metrics = { ...step.metrics, ...metrics };
2607
2891
  const sessionId = sessionIdFromContext(ctx);
2608
- if (Array.isArray(step.output) && _chunkOBBWQW6Kjs.isObject.call(void 0, step.output[0])) {
2892
+ if (Array.isArray(step.output) && _chunkTWCDSYJNjs.isObject.call(void 0, step.output[0])) {
2609
2893
  const finishReason = step.output[0].finish_reason;
2610
2894
  if (typeof finishReason !== "string") {
2611
2895
  step.output[0].finish_reason = normalizedFinishReason(
@@ -2652,7 +2936,7 @@ var EveBridge = (_class = class {
2652
2936
  step.span.end(endTime === void 0 ? void 0 : { endTime });
2653
2937
  }
2654
2938
  const turn = this.turnForEvent(event, ctx);
2655
- _optionalChain([turn, 'optionalAccess', _99 => _99.stepsByIndex, 'access', _100 => _100.delete, 'call', _101 => _101(event.data.stepIndex)]);
2939
+ _optionalChain([turn, 'optionalAccess', _105 => _105.stepsByIndex, 'access', _106 => _106.delete, 'call', _107 => _107(event.data.stepIndex)]);
2656
2940
  this.markStepEnded(event.data.turnId, event.data.stepIndex);
2657
2941
  const sessionId = sessionIdFromContext(ctx);
2658
2942
  if (sessionId) {
@@ -2943,10 +3227,10 @@ var EveBridge = (_class = class {
2943
3227
  return state;
2944
3228
  }
2945
3229
  async startTurnSpan(sessionId, event, ctx, metadata) {
2946
- const session = _chunkOBBWQW6Kjs.isObject.call(void 0, ctx) ? ctx["session"] : void 0;
2947
- const parent = _chunkOBBWQW6Kjs.isObject.call(void 0, session) ? session["parent"] : void 0;
2948
- const parentTurn = _chunkOBBWQW6Kjs.isObject.call(void 0, parent) ? parent["turn"] : void 0;
2949
- const parentLineage = _chunkOBBWQW6Kjs.isObject.call(void 0, parent) && typeof parent["callId"] === "string" && typeof parent["sessionId"] === "string" && _chunkOBBWQW6Kjs.isObject.call(void 0, parentTurn) && typeof parentTurn["id"] === "string" ? {
3230
+ const session = _chunkTWCDSYJNjs.isObject.call(void 0, ctx) ? ctx["session"] : void 0;
3231
+ const parent = _chunkTWCDSYJNjs.isObject.call(void 0, session) ? session["parent"] : void 0;
3232
+ const parentTurn = _chunkTWCDSYJNjs.isObject.call(void 0, parent) ? parent["turn"] : void 0;
3233
+ const parentLineage = _chunkTWCDSYJNjs.isObject.call(void 0, parent) && typeof parent["callId"] === "string" && typeof parent["sessionId"] === "string" && _chunkTWCDSYJNjs.isObject.call(void 0, parentTurn) && typeof parentTurn["id"] === "string" ? {
2950
3234
  callId: parent["callId"],
2951
3235
  sessionId: parent["sessionId"],
2952
3236
  turnId: parentTurn["id"]
@@ -2955,8 +3239,8 @@ var EveBridge = (_class = class {
2955
3239
  generateEveIds("turn", sessionId, event.data.turnId),
2956
3240
  deterministicEveId(
2957
3241
  "eve:root",
2958
- _nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess', _102 => _102.sessionId]), () => ( sessionId)),
2959
- _nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess', _103 => _103.turnId]), () => ( event.data.turnId))
3242
+ _nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess', _108 => _108.sessionId]), () => ( sessionId)),
3243
+ _nullishCoalesce(_optionalChain([parentLineage, 'optionalAccess', _109 => _109.turnId]), () => ( event.data.turnId))
2960
3244
  ),
2961
3245
  parentLineage ? deterministicEveId(
2962
3246
  "eve:subagent",
@@ -2981,7 +3265,7 @@ var EveBridge = (_class = class {
2981
3265
  return sessionId ? this.turnsByKey.get(turnKey(sessionId, event.data.turnId)) : void 0;
2982
3266
  }
2983
3267
  stepForEvent(event, ctx) {
2984
- return _optionalChain([this, 'access', _104 => _104.turnForEvent, 'call', _105 => _105(event, ctx), 'optionalAccess', _106 => _106.stepsByIndex, 'access', _107 => _107.get, 'call', _108 => _108(
3268
+ return _optionalChain([this, 'access', _110 => _110.turnForEvent, 'call', _111 => _111(event, ctx), 'optionalAccess', _112 => _112.stepsByIndex, 'access', _113 => _113.get, 'call', _114 => _114(
2985
3269
  event.data.stepIndex
2986
3270
  )]);
2987
3271
  }
@@ -3053,10 +3337,10 @@ var EveBridge = (_class = class {
3053
3337
  }
3054
3338
  async flushInstrumentation() {
3055
3339
  try {
3056
- await _chunkOBBWQW6Kjs.flush.call(void 0, );
3340
+ await _chunkTWCDSYJNjs.flush.call(void 0, );
3057
3341
  return true;
3058
3342
  } catch (error) {
3059
- _chunkOBBWQW6Kjs.debugLogger.warn("Error in Eve flush instrumentation:", error);
3343
+ _chunk2XDW3UCGjs.debugLogger.warn("Error in Eve flush instrumentation:", error);
3060
3344
  return false;
3061
3345
  }
3062
3346
  }
@@ -3071,12 +3355,12 @@ function emptyEveTraceState() {
3071
3355
  };
3072
3356
  }
3073
3357
  function normalizeEveTraceState(state) {
3074
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, state)) {
3358
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, state)) {
3075
3359
  return emptyEveTraceState();
3076
3360
  }
3077
- const metadata = _chunkOBBWQW6Kjs.isObject.call(void 0, state["metadata"]) ? state["metadata"] : {};
3361
+ const metadata = _chunkTWCDSYJNjs.isObject.call(void 0, state["metadata"]) ? state["metadata"] : {};
3078
3362
  const spanReferences = Array.isArray(state["spanReferences"]) ? state["spanReferences"].flatMap((entry) => {
3079
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, entry)) {
3363
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, entry)) {
3080
3364
  return [];
3081
3365
  }
3082
3366
  const exported = entry["exported"];
@@ -3085,11 +3369,11 @@ function normalizeEveTraceState(state) {
3085
3369
  const rowId = entry["rowId"];
3086
3370
  const spanId = entry["spanId"];
3087
3371
  const startEvent = entry["startEvent"];
3088
- const startEventCreated = _chunkOBBWQW6Kjs.isObject.call(void 0, startEvent) ? startEvent["created"] : void 0;
3089
- const startEventMetrics = _chunkOBBWQW6Kjs.isObject.call(void 0, startEvent) ? startEvent["metrics"] : void 0;
3090
- const startEventSpanAttributes = _chunkOBBWQW6Kjs.isObject.call(void 0, startEvent) ? startEvent["span_attributes"] : void 0;
3091
- const startEventSpanParents = _chunkOBBWQW6Kjs.isObject.call(void 0, startEvent) ? startEvent["span_parents"] : void 0;
3092
- const normalizedStartEvent = typeof startEventCreated === "string" && _chunkOBBWQW6Kjs.isObject.call(void 0, startEventMetrics) && typeof startEventMetrics["start"] === "number" && Number.isFinite(startEventMetrics["start"]) && _chunkOBBWQW6Kjs.isObject.call(void 0, startEventSpanAttributes) && Array.isArray(startEventSpanParents) && startEventSpanParents.every(
3372
+ const startEventCreated = _chunkTWCDSYJNjs.isObject.call(void 0, startEvent) ? startEvent["created"] : void 0;
3373
+ const startEventMetrics = _chunkTWCDSYJNjs.isObject.call(void 0, startEvent) ? startEvent["metrics"] : void 0;
3374
+ const startEventSpanAttributes = _chunkTWCDSYJNjs.isObject.call(void 0, startEvent) ? startEvent["span_attributes"] : void 0;
3375
+ const startEventSpanParents = _chunkTWCDSYJNjs.isObject.call(void 0, startEvent) ? startEvent["span_parents"] : void 0;
3376
+ const normalizedStartEvent = typeof startEventCreated === "string" && _chunkTWCDSYJNjs.isObject.call(void 0, startEventMetrics) && typeof startEventMetrics["start"] === "number" && Number.isFinite(startEventMetrics["start"]) && _chunkTWCDSYJNjs.isObject.call(void 0, startEventSpanAttributes) && Array.isArray(startEventSpanParents) && startEventSpanParents.every(
3093
3377
  (parent) => typeof parent === "string"
3094
3378
  ) ? {
3095
3379
  created: startEventCreated,
@@ -3109,7 +3393,7 @@ function normalizeEveTraceState(state) {
3109
3393
  ] : [];
3110
3394
  }).slice(-MAX_STORED_SPAN_REFERENCES) : [];
3111
3395
  const llmInputs = Array.isArray(state["llmInputs"]) ? state["llmInputs"].flatMap((entry) => {
3112
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, entry)) {
3396
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, entry)) {
3113
3397
  return [];
3114
3398
  }
3115
3399
  const key = entry["key"];
@@ -3117,7 +3401,7 @@ function normalizeEveTraceState(state) {
3117
3401
  return typeof key === "string" && isCapturedModelInput(input) ? [{ input, key }] : [];
3118
3402
  }).slice(-MAX_STORED_LLM_INPUTS) : [];
3119
3403
  const reasoningBlocks = Array.isArray(state["reasoningBlocks"]) ? state["reasoningBlocks"].flatMap((entry) => {
3120
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, entry)) {
3404
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, entry)) {
3121
3405
  return [];
3122
3406
  }
3123
3407
  const content = entry["content"];
@@ -3132,7 +3416,7 @@ function normalizeEveTraceState(state) {
3132
3416
  ] : [];
3133
3417
  }).slice(-MAX_STORED_REASONING_BLOCKS) : [];
3134
3418
  const stepStarts = Array.isArray(state["stepStarts"]) ? state["stepStarts"].flatMap((entry) => {
3135
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, entry)) {
3419
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, entry)) {
3136
3420
  return [];
3137
3421
  }
3138
3422
  const ordinal = entry["ordinal"];
@@ -3152,12 +3436,12 @@ function normalizeEveTraceState(state) {
3152
3436
  function readEveTraceState(state) {
3153
3437
  try {
3154
3438
  return normalizeEveTraceState(state.get());
3155
- } catch (e4) {
3439
+ } catch (e6) {
3156
3440
  return emptyEveTraceState();
3157
3441
  }
3158
3442
  }
3159
3443
  function storeEveReasoning(state, sessionId, event) {
3160
- const eventAt = _optionalChain([event, 'access', _109 => _109.meta, 'optionalAccess', _110 => _110.at]);
3444
+ const eventAt = _optionalChain([event, 'access', _115 => _115.meta, 'optionalAccess', _116 => _116.at]);
3161
3445
  const key = llmInputKey(sessionId, event.data.turnId, event.data.stepIndex);
3162
3446
  let stored = [];
3163
3447
  state.update((current) => {
@@ -3209,14 +3493,14 @@ function clearStoredEveReasoning(state, sessionId, turnId, stepIndex) {
3209
3493
  });
3210
3494
  }
3211
3495
  function eveOutputMessage(output) {
3212
- return Array.isArray(output) && _chunkOBBWQW6Kjs.isObject.call(void 0, output[0]) ? output[0]["message"] : void 0;
3496
+ return Array.isArray(output) && _chunkTWCDSYJNjs.isObject.call(void 0, output[0]) ? output[0]["message"] : void 0;
3213
3497
  }
3214
3498
  function mergeEveReasoning(output, reasoning) {
3215
3499
  if (reasoning.length === 0) {
3216
3500
  return output;
3217
3501
  }
3218
- const choice = Array.isArray(output) && _chunkOBBWQW6Kjs.isObject.call(void 0, output[0]) ? output[0] : {};
3219
- const message = _chunkOBBWQW6Kjs.isObject.call(void 0, choice["message"]) ? choice["message"] : {};
3502
+ const choice = Array.isArray(output) && _chunkTWCDSYJNjs.isObject.call(void 0, output[0]) ? output[0] : {};
3503
+ const message = _chunkTWCDSYJNjs.isObject.call(void 0, choice["message"]) ? choice["message"] : {};
3220
3504
  return [
3221
3505
  {
3222
3506
  ...choice,
@@ -3260,7 +3544,7 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
3260
3544
  if (index < 0) {
3261
3545
  return normalized;
3262
3546
  }
3263
- input = _optionalChain([normalized, 'access', _111 => _111.llmInputs, 'access', _112 => _112[index], 'optionalAccess', _113 => _113.input]);
3547
+ input = _optionalChain([normalized, 'access', _117 => _117.llmInputs, 'access', _118 => _118[index], 'optionalAccess', _119 => _119.input]);
3264
3548
  return {
3265
3549
  ...normalized,
3266
3550
  llmInputs: normalized.llmInputs.filter(
@@ -3270,7 +3554,7 @@ function consumeCapturedEveModelInput(state, sessionId, turnId, stepIndex) {
3270
3554
  });
3271
3555
  return input;
3272
3556
  } catch (error) {
3273
- _chunkOBBWQW6Kjs.debugLogger.warn("Error in Eve LLM input consumption:", error);
3557
+ _chunk2XDW3UCGjs.debugLogger.warn("Error in Eve LLM input consumption:", error);
3274
3558
  return void 0;
3275
3559
  }
3276
3560
  }
@@ -3279,8 +3563,10 @@ function capturedModelInput(modelInput) {
3279
3563
  const value = [];
3280
3564
  if (typeof instructions === "string") {
3281
3565
  value.push({ content: instructions, role: "system" });
3282
- } else if (instructions) {
3566
+ } else if (Array.isArray(instructions)) {
3283
3567
  value.push(...instructions.map(capturedEveModelMessage));
3568
+ } else if (instructions) {
3569
+ value.push(capturedEveModelMessage(instructions));
3284
3570
  }
3285
3571
  value.push(...messages.map(capturedEveModelMessage));
3286
3572
  try {
@@ -3289,7 +3575,7 @@ function capturedModelInput(modelInput) {
3289
3575
  return void 0;
3290
3576
  }
3291
3577
  return cloned;
3292
- } catch (e5) {
3578
+ } catch (e7) {
3293
3579
  return void 0;
3294
3580
  }
3295
3581
  }
@@ -3408,14 +3694,14 @@ function capturedEveModelContentPart(part) {
3408
3694
  }
3409
3695
  function isCapturedModelInput(input) {
3410
3696
  return Array.isArray(input) && input.every(
3411
- (message) => _chunkOBBWQW6Kjs.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(_chunkOBBWQW6Kjs.isObject))
3697
+ (message) => _chunkTWCDSYJNjs.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(_chunkTWCDSYJNjs.isObject))
3412
3698
  );
3413
3699
  }
3414
3700
  function llmInputKey(sessionId, turnId, stepIndex) {
3415
3701
  return `${sessionId}\0${turnId}\0${stepIndex}`;
3416
3702
  }
3417
3703
  function modelMetadataFromRuntime(runtime) {
3418
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, runtime)) {
3704
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, runtime)) {
3419
3705
  return {};
3420
3706
  }
3421
3707
  const modelId = runtime["modelId"];
@@ -3438,11 +3724,11 @@ function modelMetadataFromModelId(modelId) {
3438
3724
  };
3439
3725
  }
3440
3726
  function sessionIdFromContext(ctx) {
3441
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, ctx)) {
3727
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, ctx)) {
3442
3728
  return void 0;
3443
3729
  }
3444
3730
  const session = ctx["session"];
3445
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, session)) {
3731
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, session)) {
3446
3732
  return void 0;
3447
3733
  }
3448
3734
  const id = session["id"];
@@ -3453,19 +3739,19 @@ function toolMetadataFromTurn(turn) {
3453
3739
  return metadata;
3454
3740
  }
3455
3741
  function isToolCallAction(action) {
3456
- return _chunkOBBWQW6Kjs.isObject.call(void 0, action) && action["kind"] === "tool-call" && typeof action["callId"] === "string" && typeof action["toolName"] === "string" && _chunkOBBWQW6Kjs.isObject.call(void 0, action["input"]);
3742
+ return _chunkTWCDSYJNjs.isObject.call(void 0, action) && action["kind"] === "tool-call" && typeof action["callId"] === "string" && typeof action["toolName"] === "string" && _chunkTWCDSYJNjs.isObject.call(void 0, action["input"]);
3457
3743
  }
3458
3744
  function isLocalSubagentCallAction(action) {
3459
- return _chunkOBBWQW6Kjs.isObject.call(void 0, action) && action["kind"] === "subagent-call" && typeof action["callId"] === "string" && _chunkOBBWQW6Kjs.isObject.call(void 0, action["input"]);
3745
+ return _chunkTWCDSYJNjs.isObject.call(void 0, action) && action["kind"] === "subagent-call" && typeof action["callId"] === "string" && _chunkTWCDSYJNjs.isObject.call(void 0, action["input"]);
3460
3746
  }
3461
3747
  function isTraceableActionRequest(action) {
3462
3748
  return isToolCallAction(action) || isLocalSubagentCallAction(action);
3463
3749
  }
3464
3750
  function isToolResult(result) {
3465
- return _chunkOBBWQW6Kjs.isObject.call(void 0, result) && result["kind"] === "tool-result" && typeof result["callId"] === "string" && typeof result["toolName"] === "string";
3751
+ return _chunkTWCDSYJNjs.isObject.call(void 0, result) && result["kind"] === "tool-result" && typeof result["callId"] === "string" && typeof result["toolName"] === "string";
3466
3752
  }
3467
3753
  function isSubagentResult(result) {
3468
- return _chunkOBBWQW6Kjs.isObject.call(void 0, result) && result["kind"] === "subagent-result" && typeof result["callId"] === "string" && typeof result["subagentName"] === "string";
3754
+ return _chunkTWCDSYJNjs.isObject.call(void 0, result) && result["kind"] === "subagent-result" && typeof result["callId"] === "string" && typeof result["subagentName"] === "string";
3469
3755
  }
3470
3756
  function normalizedFinishReason(finishReason) {
3471
3757
  switch (finishReason) {
@@ -3495,7 +3781,7 @@ function actionResultError(error, output) {
3495
3781
  return result;
3496
3782
  }
3497
3783
  function eventTime(event) {
3498
- if (!_optionalChain([event, 'access', _114 => _114.meta, 'optionalAccess', _115 => _115.at])) {
3784
+ if (!_optionalChain([event, 'access', _120 => _120.meta, 'optionalAccess', _121 => _121.at])) {
3499
3785
  return void 0;
3500
3786
  }
3501
3787
  const timestamp = Date.parse(event.meta.at);
@@ -3524,6 +3810,472 @@ async function deterministicEveId(...parts) {
3524
3810
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
3525
3811
  }
3526
3812
 
3813
+ // src/instrumentation/plugins/eve-provider.ts
3814
+ var MAX_EVE_PROVIDER_CACHE_ENTRIES = 1e4;
3815
+ function createEveInstrumentationProvider(options = {}) {
3816
+ const bridge = new EveProviderBridge(options.metadata);
3817
+ return {
3818
+ // Eve versions before tracePolicy use capture to decide whether provider
3819
+ // events include content. Newer versions prefer tracePolicy when both are
3820
+ // present, so keep the deprecated field for backwards compatibility.
3821
+ capture: "content",
3822
+ tracePolicy: () => ({
3823
+ emit: true,
3824
+ recordInputs: true,
3825
+ recordOutputs: true
3826
+ }),
3827
+ events: {
3828
+ "action.completed": (event, context) => bridge.handleActionTerminal(event, context),
3829
+ "action.failed": (event, context) => bridge.handleActionTerminal(event, context),
3830
+ "action.started": (event, context) => bridge.handleActionStarted(event, context),
3831
+ "model.call.completed": (event, context) => bridge.handleModelTerminal(event, context),
3832
+ "model.call.failed": (event, context) => bridge.handleModelTerminal(event, context),
3833
+ "model.call.started": (event, context) => bridge.handleModelStarted(event, context),
3834
+ "step.attempt.completed": (event) => bridge.handleStepAttemptTerminal(event),
3835
+ "step.attempt.failed": (event) => bridge.handleStepAttemptTerminal(event),
3836
+ "turn.cancelled": (event, context) => bridge.handleTurnTerminal(event, context),
3837
+ "turn.completed": (event, context) => bridge.handleTurnTerminal(event, context),
3838
+ "turn.failed": (event, context) => bridge.handleTurnTerminal(event, context),
3839
+ "turn.started": (event, context) => bridge.handleTurnStarted(event, context)
3840
+ },
3841
+ flush: _chunkTWCDSYJNjs.flush,
3842
+ setup: options.setup
3843
+ };
3844
+ }
3845
+ var EveProviderBridge = (_class2 = class {
3846
+ constructor(metadata) {;_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);
3847
+ this.metadata = metadata;
3848
+ }
3849
+
3850
+ __init5() {this.activeActions = /* @__PURE__ */ new Map()}
3851
+ __init6() {this.activeModels = /* @__PURE__ */ new Map()}
3852
+ __init7() {this.modelsByAttempt = /* @__PURE__ */ new Map()}
3853
+ __init8() {this.settledOperations = new (0, _chunkTWCDSYJNjs.LRUCache)({
3854
+ max: MAX_EVE_PROVIDER_CACHE_ENTRIES
3855
+ })}
3856
+ __init9() {this.turns = new (0, _chunkTWCDSYJNjs.LRUCache)({
3857
+ max: MAX_EVE_PROVIDER_CACHE_ENTRIES
3858
+ })}
3859
+ async handleTurnStarted(event, context) {
3860
+ await this.contain("turn start", async () => {
3861
+ if (this.settledOperations.has(event.idempotencyKey)) {
3862
+ context.state.set({ skip: true });
3863
+ return;
3864
+ }
3865
+ const { rowId, spanId } = await generateEveIds(
3866
+ "turn",
3867
+ event.idempotencyKey
3868
+ );
3869
+ const key = turnKey2(event.sessionId, event.turnId);
3870
+ const stored = storedSpan(context);
3871
+ if (stored && "exported" in stored && stored.rootSpanId) {
3872
+ this.turns.set(key, { rootSpanId: stored.rootSpanId, spanId });
3873
+ return;
3874
+ }
3875
+ let rootSpanId = spanId;
3876
+ let parentSpanId;
3877
+ if (event.parentLineage) {
3878
+ const parentTurnKey = turnKey2(
3879
+ event.parentLineage.sessionId,
3880
+ event.parentLineage.turnId
3881
+ );
3882
+ const parentTurn = this.turns.get(parentTurnKey);
3883
+ rootSpanId = await _asyncNullishCoalesce(await _asyncOptionalChain([parentTurn, 'optionalAccess', async _122 => _122.rootSpanId]), async () => ( // Eve propagates the root session through every nested subagent. Use
3884
+ // it instead of the immediate parent session when no ancestor ran
3885
+ // in-process.
3886
+ (await generateEveIds(
3887
+ "turn",
3888
+ turnIdempotencyKey(
3889
+ event.rootSessionId,
3890
+ event.parentLineage.turnId
3891
+ )
3892
+ )).spanId));
3893
+ parentSpanId = (await generateEveIds(
3894
+ "subagent",
3895
+ actionIdempotencyKey(
3896
+ event.parentLineage.sessionId,
3897
+ event.parentLineage.turnId,
3898
+ event.parentLineage.callId
3899
+ )
3900
+ )).spanId;
3901
+ }
3902
+ const metadata = this.spanMetadata(event.sessionId);
3903
+ const span = await this.startSpan(
3904
+ context,
3905
+ {
3906
+ event: { id: rowId, metadata },
3907
+ name: "eve.turn",
3908
+ parentSpanIds: parentSpanId ? { rootSpanId, spanId: parentSpanId } : { parentSpanIds: [], rootSpanId },
3909
+ spanAttributes: { type: "task" /* TASK */ },
3910
+ spanId
3911
+ },
3912
+ rootSpanId
3913
+ );
3914
+ _optionalChain([span, 'optionalAccess', _123 => _123.log, 'call', _124 => _124({ metadata })]);
3915
+ this.turns.set(key, {
3916
+ rootSpanId,
3917
+ spanId
3918
+ });
3919
+ });
3920
+ }
3921
+ async handleTurnTerminal(event, context) {
3922
+ await this.contain("turn terminal", async () => {
3923
+ if (this.settledOperations.has(event.idempotencyKey)) {
3924
+ context.state.set(void 0);
3925
+ return;
3926
+ }
3927
+ const error = event.type === "turn.failed" ? event.error : void 0;
3928
+ this.drainActionsForTurn(event.sessionId, event.turnId, error);
3929
+ const stored = storedSpan(context);
3930
+ if (stored && "exported" in stored) {
3931
+ _chunkTWCDSYJNjs.updateSpan.call(void 0, {
3932
+ exported: stored.exported,
3933
+ ...error !== void 0 ? { error } : {},
3934
+ metrics: { end: Date.now() / 1e3 }
3935
+ });
3936
+ }
3937
+ this.settledOperations.set(event.idempotencyKey, true);
3938
+ context.state.set(void 0);
3939
+ this.turns.delete(turnKey2(event.sessionId, event.turnId));
3940
+ });
3941
+ }
3942
+ async handleModelStarted(event, context) {
3943
+ await this.contain("model start", async () => {
3944
+ if (this.settledOperations.has(event.idempotencyKey)) {
3945
+ context.state.set({ skip: true });
3946
+ return;
3947
+ }
3948
+ const parent = await this.parentForScope(event.scope);
3949
+ const { rowId, spanId } = await generateEveIds(
3950
+ "step",
3951
+ event.idempotencyKey
3952
+ );
3953
+ const input = event.input ? capturedModelInput(event.input) : void 0;
3954
+ const metadata = {
3955
+ ...this.spanMetadata(event.scope.sessionId),
3956
+ model: event.model.modelId,
3957
+ provider: event.model.provider
3958
+ };
3959
+ const span = await this.startSpan(context, {
3960
+ event: {
3961
+ id: rowId,
3962
+ ...input !== void 0 ? { input } : {},
3963
+ metadata
3964
+ },
3965
+ name: "eve.step",
3966
+ parentSpanIds: parent,
3967
+ spanAttributes: { type: "llm" /* LLM */ },
3968
+ spanId
3969
+ });
3970
+ if (!span) return;
3971
+ span.log({ ...input !== void 0 ? { input } : {}, metadata });
3972
+ this.activeModels.set(event.idempotencyKey, {
3973
+ span,
3974
+ turnKey: turnKey2(event.scope.sessionId, event.scope.turnId)
3975
+ });
3976
+ const keys = _nullishCoalesce(this.modelsByAttempt.get(event.scope.attemptId), () => ( /* @__PURE__ */ new Set()));
3977
+ keys.add(event.idempotencyKey);
3978
+ this.modelsByAttempt.set(event.scope.attemptId, keys);
3979
+ });
3980
+ }
3981
+ async handleModelTerminal(event, context) {
3982
+ await this.contain("model terminal", async () => {
3983
+ if (this.settledOperations.has(event.idempotencyKey)) {
3984
+ context.state.set(void 0);
3985
+ return;
3986
+ }
3987
+ const active = this.activeModels.get(event.idempotencyKey);
3988
+ if (active) {
3989
+ const span = active.span;
3990
+ if (event.type === "model.call.failed") {
3991
+ if (event.error !== void 0) span.log({ error: event.error });
3992
+ } else {
3993
+ span.log({
3994
+ metrics: usageMetrics(event.usage),
3995
+ output: modelOutput(event)
3996
+ });
3997
+ }
3998
+ span.end();
3999
+ } else {
4000
+ const stored = storedSpan(context);
4001
+ if (stored && "exported" in stored) {
4002
+ _chunkTWCDSYJNjs.updateSpan.call(void 0, {
4003
+ exported: stored.exported,
4004
+ ...event.type === "model.call.failed" ? event.error !== void 0 ? { error: event.error } : {} : { output: modelOutput(event) },
4005
+ metrics: {
4006
+ ...event.type === "model.call.completed" ? usageMetrics(event.usage) : {},
4007
+ end: Date.now() / 1e3
4008
+ }
4009
+ });
4010
+ }
4011
+ }
4012
+ this.settledOperations.set(event.idempotencyKey, true);
4013
+ this.forgetModel(event.scope.attemptId, event.idempotencyKey);
4014
+ context.state.set(void 0);
4015
+ });
4016
+ }
4017
+ async handleActionStarted(event, context) {
4018
+ await this.contain("action start", async () => {
4019
+ if (event.kind === "load-skill" || this.settledOperations.has(event.idempotencyKey)) {
4020
+ context.state.set({ skip: true });
4021
+ return;
4022
+ }
4023
+ const parent = await this.parentForScope(event.scope);
4024
+ const { rowId, spanId } = await generateEveIds(
4025
+ event.kind === "subagent-call" ? "subagent" : "tool",
4026
+ event.idempotencyKey
4027
+ );
4028
+ const metadata = {
4029
+ ...this.spanMetadata(event.scope.sessionId),
4030
+ "eve.action_kind": event.kind
4031
+ };
4032
+ const span = await this.startSpan(context, {
4033
+ event: {
4034
+ id: rowId,
4035
+ ...event.input !== void 0 ? { input: event.input } : {},
4036
+ metadata
4037
+ },
4038
+ name: event.name,
4039
+ parentSpanIds: parent,
4040
+ spanAttributes: { type: "tool" /* TOOL */ },
4041
+ spanId
4042
+ });
4043
+ if (!span) return;
4044
+ span.log({
4045
+ ...event.input !== void 0 ? { input: event.input } : {},
4046
+ metadata
4047
+ });
4048
+ this.activeActions.set(event.idempotencyKey, {
4049
+ span,
4050
+ turnKey: turnKey2(event.scope.sessionId, event.scope.turnId)
4051
+ });
4052
+ });
4053
+ }
4054
+ async handleActionTerminal(event, context) {
4055
+ await this.contain("action terminal", async () => {
4056
+ if (this.settledOperations.has(event.idempotencyKey)) {
4057
+ context.state.set(void 0);
4058
+ return;
4059
+ }
4060
+ const stored = storedSpan(context);
4061
+ if (_optionalChain([stored, 'optionalAccess', _125 => _125.skip])) {
4062
+ context.state.set(void 0);
4063
+ return;
4064
+ }
4065
+ const active = this.activeActions.get(event.idempotencyKey);
4066
+ const end = _nullishCoalesce(finiteTimestamp(event.acceptedAtMs), () => ( Date.now()));
4067
+ if (active) {
4068
+ const span = active.span;
4069
+ if (event.type === "action.failed") {
4070
+ span.log({
4071
+ error: _nullishCoalesce(event.error, () => ( new Error(_nullishCoalesce(event.errorCode, () => ( `Eve action ${event.outcome}`)))))
4072
+ });
4073
+ } else if (event.output.type === "error") {
4074
+ span.log({
4075
+ error: _nullishCoalesce(event.output.error, () => ( new Error("Eve action returned an error")))
4076
+ });
4077
+ } else {
4078
+ span.log({ output: event.output.output });
4079
+ }
4080
+ span.end({ endTime: end / 1e3 });
4081
+ } else {
4082
+ const stored2 = storedSpan(context);
4083
+ if (stored2 && "exported" in stored2) {
4084
+ _chunkTWCDSYJNjs.updateSpan.call(void 0, {
4085
+ exported: stored2.exported,
4086
+ ...event.type === "action.failed" ? {
4087
+ error: _nullishCoalesce(event.error, () => ( new Error(_nullishCoalesce(event.errorCode, () => ( `Eve action ${event.outcome}`)))))
4088
+ } : event.output.type === "error" ? {
4089
+ error: _nullishCoalesce(event.output.error, () => ( new Error("Eve action returned an error")))
4090
+ } : { output: event.output.output },
4091
+ metrics: { end: end / 1e3 }
4092
+ });
4093
+ }
4094
+ }
4095
+ this.settledOperations.set(event.idempotencyKey, true);
4096
+ this.activeActions.delete(event.idempotencyKey);
4097
+ context.state.set(void 0);
4098
+ });
4099
+ }
4100
+ handleStepAttemptTerminal(event) {
4101
+ void this.contain("step attempt terminal", () => {
4102
+ const keys = this.modelsByAttempt.get(event.scope.attemptId);
4103
+ if (!keys) return;
4104
+ for (const key of keys) {
4105
+ const active = this.activeModels.get(key);
4106
+ if (!active) continue;
4107
+ if (event.type === "step.attempt.failed" && event.error !== void 0) {
4108
+ active.span.log({ error: event.error });
4109
+ }
4110
+ active.span.end();
4111
+ this.activeModels.delete(key);
4112
+ }
4113
+ this.modelsByAttempt.delete(event.scope.attemptId);
4114
+ });
4115
+ }
4116
+ async parentForScope(scope) {
4117
+ const key = turnKey2(scope.sessionId, scope.turnId);
4118
+ const known = this.turns.get(key);
4119
+ if (known) {
4120
+ return { rootSpanId: known.rootSpanId, spanId: known.spanId };
4121
+ }
4122
+ const [{ spanId }, { spanId: rootSpanId }] = await Promise.all([
4123
+ generateEveIds("turn", turnIdempotencyKey(scope.sessionId, scope.turnId)),
4124
+ generateEveIds(
4125
+ "turn",
4126
+ turnIdempotencyKey(
4127
+ _nullishCoalesce(scope.rootSessionId, () => ( scope.sessionId)),
4128
+ scope.turnId
4129
+ )
4130
+ )
4131
+ ]);
4132
+ return { rootSpanId, spanId };
4133
+ }
4134
+ async startSpan(context, args, rootSpanId) {
4135
+ const span = _chunkTWCDSYJNjs.withCurrent.call(void 0,
4136
+ _chunkTWCDSYJNjs.NOOP_SPAN,
4137
+ () => _chunkTWCDSYJNjs._internalStartSpanWithInitialMerge.call(void 0,
4138
+ _chunk2XDW3UCGjs.withSpanInstrumentationName.call(void 0, _nullishCoalesce(args, () => ( {})), _chunk2XDW3UCGjs.INSTRUMENTATION_NAMES.EVE)
4139
+ )
4140
+ );
4141
+ try {
4142
+ context.state.set({
4143
+ exported: await span.export(),
4144
+ ...rootSpanId ? { rootSpanId } : {}
4145
+ });
4146
+ } catch (error) {
4147
+ _chunk2XDW3UCGjs.debugLogger.warn("Error exporting Eve provider span:", error);
4148
+ }
4149
+ return span;
4150
+ }
4151
+ drainActionsForTurn(sessionId, turnId, error) {
4152
+ const key = turnKey2(sessionId, turnId);
4153
+ for (const [idempotencyKey, active] of this.activeActions) {
4154
+ if (active.turnKey !== key) continue;
4155
+ if (error !== void 0) active.span.log({ error });
4156
+ active.span.end();
4157
+ this.activeActions.delete(idempotencyKey);
4158
+ }
4159
+ }
4160
+ forgetModel(attemptId, idempotencyKey) {
4161
+ this.activeModels.delete(idempotencyKey);
4162
+ const keys = this.modelsByAttempt.get(attemptId);
4163
+ _optionalChain([keys, 'optionalAccess', _126 => _126.delete, 'call', _127 => _127(idempotencyKey)]);
4164
+ if (_optionalChain([keys, 'optionalAccess', _128 => _128.size]) === 0) this.modelsByAttempt.delete(attemptId);
4165
+ }
4166
+ spanMetadata(sessionId) {
4167
+ return {
4168
+ ..._nullishCoalesce(this.metadata, () => ( {})),
4169
+ "eve.session_id": sessionId
4170
+ };
4171
+ }
4172
+ async contain(operation, fn) {
4173
+ try {
4174
+ await fn();
4175
+ } catch (error) {
4176
+ _chunk2XDW3UCGjs.debugLogger.warn(`Error in Eve provider ${operation}:`, error);
4177
+ }
4178
+ }
4179
+ }, _class2);
4180
+ function storedSpan(context) {
4181
+ const value = context.state.get();
4182
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, value)) return void 0;
4183
+ if (value["skip"] === true) return { skip: true };
4184
+ return typeof value["exported"] === "string" ? {
4185
+ exported: value["exported"],
4186
+ ...typeof value["rootSpanId"] === "string" && value["rootSpanId"].length > 0 ? { rootSpanId: value["rootSpanId"] } : {}
4187
+ } : void 0;
4188
+ }
4189
+ function modelOutput(event) {
4190
+ const content = _nullishCoalesce(event.content, () => ( []));
4191
+ let text = "";
4192
+ const reasoning = [];
4193
+ const toolCalls2 = [];
4194
+ for (const part of content) {
4195
+ if (part.type === "text") {
4196
+ text += part.text;
4197
+ } else if (part.type === "reasoning" && part.text.trim().length > 0) {
4198
+ reasoning.push({ content: part.text });
4199
+ } else if (part.type === "tool-call") {
4200
+ toolCalls2.push({
4201
+ function: {
4202
+ arguments: safeJsonStringify(part.input),
4203
+ name: part.toolName
4204
+ },
4205
+ id: part.callId,
4206
+ type: "function"
4207
+ });
4208
+ }
4209
+ }
4210
+ return [
4211
+ {
4212
+ finish_reason: normalizeFinishReason2(event.finishReason),
4213
+ index: 0,
4214
+ message: {
4215
+ content: text || null,
4216
+ ...reasoning.length > 0 ? { reasoning } : {},
4217
+ role: "assistant",
4218
+ ...toolCalls2.length > 0 ? { tool_calls: toolCalls2 } : {}
4219
+ }
4220
+ }
4221
+ ];
4222
+ }
4223
+ function usageMetrics(usage) {
4224
+ const promptTokens = nonNegativeNumber(usage.inputTokens);
4225
+ const completionTokens = nonNegativeNumber(usage.outputTokens);
4226
+ const cachedTokens = nonNegativeNumber(
4227
+ _optionalChain([usage, 'access', _129 => _129.inputTokenDetails, 'optionalAccess', _130 => _130.cacheReadTokens])
4228
+ );
4229
+ const cacheCreationTokens = nonNegativeNumber(
4230
+ _optionalChain([usage, 'access', _131 => _131.inputTokenDetails, 'optionalAccess', _132 => _132.cacheWriteTokens])
4231
+ );
4232
+ return {
4233
+ ...promptTokens !== void 0 ? { prompt_tokens: promptTokens } : {},
4234
+ ...completionTokens !== void 0 ? { completion_tokens: completionTokens } : {},
4235
+ ...promptTokens !== void 0 && completionTokens !== void 0 ? { tokens: promptTokens + completionTokens } : {},
4236
+ ...cachedTokens !== void 0 ? { prompt_cached_tokens: cachedTokens } : {},
4237
+ ...cacheCreationTokens !== void 0 ? { prompt_cache_creation_tokens: cacheCreationTokens } : {}
4238
+ };
4239
+ }
4240
+ function nonNegativeNumber(value) {
4241
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
4242
+ }
4243
+ function finiteTimestamp(value) {
4244
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
4245
+ }
4246
+ function normalizeFinishReason2(value) {
4247
+ if (value === "content-filter") return "content_filter";
4248
+ if (value === "tool-calls") return "tool_calls";
4249
+ return value;
4250
+ }
4251
+ function safeJsonStringify(value) {
4252
+ try {
4253
+ return _nullishCoalesce(JSON.stringify(value), () => ( "null"));
4254
+ } catch (e8) {
4255
+ return "null";
4256
+ }
4257
+ }
4258
+ function turnKey2(sessionId, turnId) {
4259
+ return `${sessionId}:${turnId}`;
4260
+ }
4261
+ function turnIdempotencyKey(sessionId, turnId) {
4262
+ return `turn:${sessionId}:${turnId}`;
4263
+ }
4264
+ function actionIdempotencyKey(sessionId, turnId, callId) {
4265
+ return `action:${sessionId}:${turnId}:${callId}`;
4266
+ }
4267
+
4268
+ // src/instrumentation/plugins/eve-instrumentation.ts
4269
+ var EVE_INSTRUMENTATION_PROVIDER = /* @__PURE__ */ Symbol.for("eve.instrumentation.provider");
4270
+ function braintrustEveInstrumentation(options) {
4271
+ const definition = "defineState" in options ? createLegacyEveInstrumentation(options) : createEveInstrumentationProvider(options);
4272
+ const declaration = {
4273
+ ...definition,
4274
+ [EVE_INSTRUMENTATION_PROVIDER]: true
4275
+ };
4276
+ return declaration;
4277
+ }
4278
+
3527
4279
  // src/typed-instrumentation-helpers.ts
3528
4280
  var TypedApplyProxy = Proxy;
3529
4281
 
@@ -3583,7 +4335,7 @@ function betaSessionEventsProxy(events) {
3583
4335
  if (prop === "stream") {
3584
4336
  return new TypedApplyProxy(target.stream, {
3585
4337
  apply(stream, thisArg, argArray) {
3586
- return _chunkBBE7SNRVjs.anthropicChannels.betaSessionsEventsStream.tracePromise(
4338
+ return _chunk2XDW3UCGjs.anthropicChannels.betaSessionsEventsStream.tracePromise(
3587
4339
  () => Reflect.apply(stream, thisArg, argArray),
3588
4340
  { arguments: argArray }
3589
4341
  );
@@ -3610,7 +4362,7 @@ function betaSessionThreadEventsProxy(events) {
3610
4362
  if (prop === "stream") {
3611
4363
  return new TypedApplyProxy(target.stream, {
3612
4364
  apply(stream, thisArg, argArray) {
3613
- return _chunkBBE7SNRVjs.anthropicChannels.betaSessionsThreadsEventsStream.tracePromise(
4365
+ return _chunk2XDW3UCGjs.anthropicChannels.betaSessionsThreadsEventsStream.tracePromise(
3614
4366
  () => Reflect.apply(stream, thisArg, argArray),
3615
4367
  { arguments: argArray }
3616
4368
  );
@@ -3625,7 +4377,7 @@ function messagesProxy(messages) {
3625
4377
  return new Proxy(messages, {
3626
4378
  get(target, prop, receiver) {
3627
4379
  if (prop === "create") {
3628
- return createProxy(target.create, _chunkBBE7SNRVjs.anthropicChannels.messagesCreate);
4380
+ return createProxy(target.create, _chunk2XDW3UCGjs.anthropicChannels.messagesCreate);
3629
4381
  }
3630
4382
  return Reflect.get(target, prop, receiver);
3631
4383
  }
@@ -3635,7 +4387,7 @@ function betaMessagesProxy(messages, anthropic) {
3635
4387
  return new Proxy(messages, {
3636
4388
  get(target, prop, receiver) {
3637
4389
  if (prop === "create") {
3638
- return createProxy(target.create, _chunkBBE7SNRVjs.anthropicChannels.betaMessagesCreate);
4390
+ return createProxy(target.create, _chunk2XDW3UCGjs.anthropicChannels.betaMessagesCreate);
3639
4391
  }
3640
4392
  if (prop === "toolRunner") {
3641
4393
  if (typeof target.toolRunner !== "function") {
@@ -3644,7 +4396,7 @@ function betaMessagesProxy(messages, anthropic) {
3644
4396
  return toolRunnerProxy(
3645
4397
  target.toolRunner,
3646
4398
  anthropic,
3647
- _chunkBBE7SNRVjs.anthropicChannels.betaMessagesToolRunner
4399
+ _chunk2XDW3UCGjs.anthropicChannels.betaMessagesToolRunner
3648
4400
  );
3649
4401
  }
3650
4402
  return Reflect.get(target, prop, receiver);
@@ -3701,15 +4453,15 @@ function wrapClaudeAgentQuery(queryFn, defaultThis) {
3701
4453
  ...params,
3702
4454
  options: {
3703
4455
  ..._nullishCoalesce(params.options, () => ( {})),
3704
- [_chunkOBBWQW6Kjs.CLAUDE_AGENT_SDK_SKIP_LOCAL_TOOL_HOOKS_OPTION]: true
4456
+ [_chunkTWCDSYJNjs.CLAUDE_AGENT_SDK_SKIP_LOCAL_TOOL_HOOKS_OPTION]: true
3705
4457
  }
3706
4458
  };
3707
4459
  const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
3708
- return _chunkBBE7SNRVjs.claudeAgentSDKChannels.query.traceSync(
3709
- () => Reflect.apply(target, invocationTarget, [wrappedParams]),
3710
- // The channel carries no extra context fields, but the generated
3711
- // StartOf<> type for Record<string, never> is overly strict here.
3712
- { arguments: [wrappedParams] }
4460
+ return _chunk2XDW3UCGjs.claudeAgentSDKChannels.query.invoke(
4461
+ target,
4462
+ invocationTarget,
4463
+ [wrappedParams],
4464
+ {}
3713
4465
  );
3714
4466
  }
3715
4467
  });
@@ -3733,7 +4485,7 @@ function wrapClaudeAgentTool(toolFn, localToolMetadataByTool, defaultThis) {
3733
4485
  }
3734
4486
  const localToolMetadata = { toolName };
3735
4487
  const originalHandler = wrappedArgs[handlerIndex];
3736
- wrappedArgs[handlerIndex] = _chunkOBBWQW6Kjs.wrapLocalClaudeToolHandler.call(void 0,
4488
+ wrappedArgs[handlerIndex] = _chunkTWCDSYJNjs.wrapLocalClaudeToolHandler.call(void 0,
3737
4489
  originalHandler,
3738
4490
  () => localToolMetadata
3739
4491
  );
@@ -3751,8 +4503,8 @@ function wrapCreateSdkMcpServer(createSdkMcpServerFn, localToolMetadataByTool, d
3751
4503
  apply(target, thisArg, argArray) {
3752
4504
  const invocationTarget = thisArg === proxy || thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
3753
4505
  const config = argArray[0];
3754
- const serverName = _optionalChain([config, 'optionalAccess', _116 => _116.name]);
3755
- if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess', _117 => _117.tools]))) {
4506
+ const serverName = _optionalChain([config, 'optionalAccess', _133 => _133.name]);
4507
+ if (typeof serverName === "string" && Array.isArray(_optionalChain([config, 'optionalAccess', _134 => _134.tools]))) {
3756
4508
  for (const tool of config.tools) {
3757
4509
  if (!tool || typeof tool !== "object") {
3758
4510
  continue;
@@ -3840,7 +4592,7 @@ function patchThinkClass(Think) {
3840
4592
  ...descriptor,
3841
4593
  value: function wrappedCloudflareThinkRunInferenceLoop(input) {
3842
4594
  const args = [input];
3843
- return _chunkBBE7SNRVjs.cloudflareThinkChannels.runInferenceLoop.tracePromise(
4595
+ return _chunk2XDW3UCGjs.cloudflareThinkChannels.runInferenceLoop.tracePromise(
3844
4596
  () => Reflect.apply(original, this, args),
3845
4597
  {
3846
4598
  arguments: args,
@@ -3892,7 +4644,7 @@ function isModuleNamespace2(obj) {
3892
4644
  if (!obj || typeof obj !== "object") {
3893
4645
  return false;
3894
4646
  }
3895
- if (_optionalChain([obj, 'access', _118 => _118.constructor, 'optionalAccess', _119 => _119.name]) === "Module") {
4647
+ if (_optionalChain([obj, 'access', _135 => _135.constructor, 'optionalAccess', _136 => _136.name]) === "Module") {
3896
4648
  return true;
3897
4649
  }
3898
4650
  const keys = Object.keys(obj);
@@ -3962,7 +4714,7 @@ function wrapCodexThread(thread) {
3962
4714
  if (prop === "run" && typeof value === "function") {
3963
4715
  return function(input, turnOptions) {
3964
4716
  const args = [input, turnOptions];
3965
- return _chunkBBE7SNRVjs.openAICodexChannels.run.tracePromise(
4717
+ return _chunk2XDW3UCGjs.openAICodexChannels.run.tracePromise(
3966
4718
  () => Reflect.apply(value, target, args),
3967
4719
  {
3968
4720
  arguments: args,
@@ -3975,7 +4727,7 @@ function wrapCodexThread(thread) {
3975
4727
  if (prop === "runStreamed" && typeof value === "function") {
3976
4728
  return function(input, turnOptions) {
3977
4729
  const args = [input, turnOptions];
3978
- return _chunkBBE7SNRVjs.openAICodexChannels.runStreamed.tracePromise(
4730
+ return _chunk2XDW3UCGjs.openAICodexChannels.runStreamed.tracePromise(
3979
4731
  () => Reflect.apply(value, target, args),
3980
4732
  {
3981
4733
  arguments: args,
@@ -4022,7 +4774,7 @@ function isModuleNamespace3(obj) {
4022
4774
  if (!obj || typeof obj !== "object") {
4023
4775
  return false;
4024
4776
  }
4025
- if (_optionalChain([obj, 'access', _120 => _120.constructor, 'optionalAccess', _121 => _121.name]) === "Module") {
4777
+ if (_optionalChain([obj, 'access', _137 => _137.constructor, 'optionalAccess', _138 => _138.name]) === "Module") {
4026
4778
  return true;
4027
4779
  }
4028
4780
  const keys = Object.keys(obj);
@@ -4043,7 +4795,7 @@ function wrapCursorAgentClass(Agent) {
4043
4795
  if (prop === "create" && typeof value === "function") {
4044
4796
  const wrapped = async function(options) {
4045
4797
  const args = [options];
4046
- return _chunkBBE7SNRVjs.cursorSDKChannels.create.tracePromise(
4798
+ return _chunk2XDW3UCGjs.cursorSDKChannels.create.tracePromise(
4047
4799
  async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
4048
4800
  { arguments: args }
4049
4801
  );
@@ -4054,7 +4806,7 @@ function wrapCursorAgentClass(Agent) {
4054
4806
  if (prop === "resume" && typeof value === "function") {
4055
4807
  const wrapped = async function(agentId, options) {
4056
4808
  const args = [agentId, options];
4057
- return _chunkBBE7SNRVjs.cursorSDKChannels.resume.tracePromise(
4809
+ return _chunk2XDW3UCGjs.cursorSDKChannels.resume.tracePromise(
4058
4810
  async () => wrapCursorAgent(await Reflect.apply(value, target, args)),
4059
4811
  { arguments: args }
4060
4812
  );
@@ -4065,7 +4817,7 @@ function wrapCursorAgentClass(Agent) {
4065
4817
  if (prop === "prompt" && typeof value === "function") {
4066
4818
  const wrapped = async function(message, options) {
4067
4819
  const args = [message, options];
4068
- return _chunkBBE7SNRVjs.cursorSDKChannels.prompt.tracePromise(
4820
+ return _chunk2XDW3UCGjs.cursorSDKChannels.prompt.tracePromise(
4069
4821
  () => Reflect.apply(value, target, args),
4070
4822
  { arguments: args }
4071
4823
  );
@@ -4098,7 +4850,7 @@ function wrapCursorAgent(agent) {
4098
4850
  if (prop === "send" && typeof value === "function") {
4099
4851
  return function(message, options) {
4100
4852
  const args = [message, options];
4101
- return _chunkBBE7SNRVjs.cursorSDKChannels.send.tracePromise(
4853
+ return _chunk2XDW3UCGjs.cursorSDKChannels.send.tracePromise(
4102
4854
  () => Reflect.apply(value, target, args),
4103
4855
  {
4104
4856
  agent: target,
@@ -4148,7 +4900,7 @@ function patchAgentSessionClass(AgentSession) {
4148
4900
  ...descriptor,
4149
4901
  value: function wrappedPiCodingAgentPrompt(text, options) {
4150
4902
  const args = [text, options];
4151
- return _chunkBBE7SNRVjs.piCodingAgentChannels.prompt.invoke(originalPrompt, this, args, {
4903
+ return _chunk2XDW3UCGjs.piCodingAgentChannels.prompt.invoke(originalPrompt, this, args, {
4152
4904
  session: this
4153
4905
  });
4154
4906
  }
@@ -4194,7 +4946,7 @@ function wrapCloudflareAgent(Agent) {
4194
4946
  if (ownValue(options, "detached")) {
4195
4947
  return Reflect.apply(originalRunAgentTool, this, args);
4196
4948
  }
4197
- return _chunkBBE7SNRVjs.cloudflareAgentsChannels.runAgentTool.tracePromise(
4949
+ return _chunk2XDW3UCGjs.cloudflareAgentsChannels.runAgentTool.tracePromise(
4198
4950
  () => Reflect.apply(originalRunAgentTool, this, args),
4199
4951
  { arguments: args, self: this }
4200
4952
  );
@@ -4218,7 +4970,7 @@ function isObjectLike(value) {
4218
4970
  return typeof value === "object" && value !== null || typeof value === "function";
4219
4971
  }
4220
4972
  function warnUnsupportedAgent() {
4221
- _chunkOBBWQW6Kjs.debugLogger.warn("Unsupported Cloudflare Agents Agent class. Not wrapping.");
4973
+ _chunk2XDW3UCGjs.debugLogger.warn("Unsupported Cloudflare Agents Agent class. Not wrapping.");
4222
4974
  }
4223
4975
 
4224
4976
  // src/wrappers/strands-agent-sdk.ts
@@ -4262,7 +5014,7 @@ function isModuleNamespace4(obj) {
4262
5014
  if (!obj || typeof obj !== "object") {
4263
5015
  return false;
4264
5016
  }
4265
- if (_optionalChain([obj, 'access', _122 => _122.constructor, 'optionalAccess', _123 => _123.name]) === "Module") {
5017
+ if (_optionalChain([obj, 'access', _139 => _139.constructor, 'optionalAccess', _140 => _140.name]) === "Module") {
4266
5018
  return true;
4267
5019
  }
4268
5020
  const keys = Object.keys(obj);
@@ -4324,13 +5076,11 @@ function wrapAgentInstance(agent) {
4324
5076
  if (prop === "stream" && typeof value === "function") {
4325
5077
  return function(args, options) {
4326
5078
  const callArgs = [args, options];
4327
- return _chunkBBE7SNRVjs.strandsAgentSDKChannels.agentStream.traceSync(
4328
- () => Reflect.apply(value, target, callArgs),
4329
- {
4330
- agent: proxy,
4331
- arguments: callArgs,
4332
- self: proxy
4333
- }
5079
+ return _chunk2XDW3UCGjs.strandsAgentSDKChannels.agentStream.invoke(
5080
+ value,
5081
+ target,
5082
+ callArgs,
5083
+ { agent: proxy }
4334
5084
  );
4335
5085
  };
4336
5086
  }
@@ -4360,13 +5110,13 @@ function wrapMultiAgentInstance(orchestrator, kind) {
4360
5110
  if (prop === "stream" && typeof value === "function") {
4361
5111
  return function(input, options) {
4362
5112
  const callArgs = [input, options];
4363
- const channel = kind === "graph" ? _chunkBBE7SNRVjs.strandsAgentSDKChannels.graphStream : _chunkBBE7SNRVjs.strandsAgentSDKChannels.swarmStream;
4364
- return channel.traceSync(
4365
- () => Reflect.apply(value, target, callArgs),
5113
+ const channel = kind === "graph" ? _chunk2XDW3UCGjs.strandsAgentSDKChannels.graphStream : _chunk2XDW3UCGjs.strandsAgentSDKChannels.swarmStream;
5114
+ return channel.invoke(
5115
+ value,
5116
+ target,
5117
+ callArgs,
4366
5118
  {
4367
- arguments: callArgs,
4368
- orchestrator: proxy,
4369
- self: proxy
5119
+ orchestrator: proxy
4370
5120
  }
4371
5121
  );
4372
5122
  };
@@ -4400,11 +5150,11 @@ function wrapCloudflareAIChat(module) {
4400
5150
  try {
4401
5151
  AIChatAgent = Reflect.get(candidate, "AIChatAgent");
4402
5152
  } catch (error) {
4403
- _chunkOBBWQW6Kjs.debugLogger.debug("Failed to inspect @cloudflare/ai-chat module:", error);
5153
+ _chunk2XDW3UCGjs.debugLogger.debug("Failed to inspect @cloudflare/ai-chat module:", error);
4404
5154
  return module;
4405
5155
  }
4406
5156
  if (typeof AIChatAgent !== "function") {
4407
- _chunkOBBWQW6Kjs.debugLogger.warn(
5157
+ _chunk2XDW3UCGjs.debugLogger.warn(
4408
5158
  "Unsupported @cloudflare/ai-chat module. AIChatAgent was not found; not wrapping."
4409
5159
  );
4410
5160
  return module;
@@ -4438,7 +5188,7 @@ function wrapAIChatAgentClass(AgentClass) {
4438
5188
  args,
4439
5189
  newTarget
4440
5190
  );
4441
- return _chunkOBBWQW6Kjs.instrumentCloudflareAIChatAgent.call(void 0, instance);
5191
+ return _chunkTWCDSYJNjs.instrumentCloudflareAIChatAgent.call(void 0, instance);
4442
5192
  }
4443
5193
  });
4444
5194
  wrappedClasses.set(AgentClass, wrapped);
@@ -4459,7 +5209,7 @@ function isModuleNamespace5(value) {
4459
5209
  }
4460
5210
  const descriptor = Object.getOwnPropertyDescriptor(value, keys[0]);
4461
5211
  return descriptor ? !descriptor.configurable && !descriptor.writable : false;
4462
- } catch (e6) {
5212
+ } catch (e9) {
4463
5213
  return false;
4464
5214
  }
4465
5215
  }
@@ -4510,7 +5260,7 @@ function wrapGoogleGenAIInstance(instance) {
4510
5260
  }
4511
5261
  if (prop === "interactions") {
4512
5262
  const interactions = Reflect.get(target, prop, receiver);
4513
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, interactions) || typeof interactions.create !== "function") {
5263
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, interactions) || typeof interactions.create !== "function") {
4514
5264
  return interactions;
4515
5265
  }
4516
5266
  if (interactions !== originalInteractions) {
@@ -4524,7 +5274,7 @@ function wrapGoogleGenAIInstance(instance) {
4524
5274
  });
4525
5275
  }
4526
5276
  function patchGoogleGenAIChats(instance, wrappedModels) {
4527
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, instance.chats) || !("modelsModule" in instance.chats)) {
5277
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, instance.chats) || !("modelsModule" in instance.chats)) {
4528
5278
  return;
4529
5279
  }
4530
5280
  Reflect.set(instance.chats, "modelsModule", wrappedModels);
@@ -4557,7 +5307,7 @@ function wrapInteractions(interactions) {
4557
5307
  }
4558
5308
  function wrapGenerateContent(original) {
4559
5309
  return function(params) {
4560
- return _chunkBBE7SNRVjs.googleGenAIChannels.generateContent.tracePromise(
5310
+ return _chunk2XDW3UCGjs.googleGenAIChannels.generateContent.tracePromise(
4561
5311
  () => original(params),
4562
5312
  { arguments: [params] }
4563
5313
  );
@@ -4565,7 +5315,7 @@ function wrapGenerateContent(original) {
4565
5315
  }
4566
5316
  function wrapGenerateContentStream(original) {
4567
5317
  return function(params) {
4568
- return _chunkBBE7SNRVjs.googleGenAIChannels.generateContentStream.tracePromise(
5318
+ return _chunk2XDW3UCGjs.googleGenAIChannels.generateContentStream.tracePromise(
4569
5319
  () => original(params),
4570
5320
  { arguments: [params] }
4571
5321
  );
@@ -4573,7 +5323,7 @@ function wrapGenerateContentStream(original) {
4573
5323
  }
4574
5324
  function wrapEmbedContent(original) {
4575
5325
  return function(params) {
4576
- return _chunkBBE7SNRVjs.googleGenAIChannels.embedContent.tracePromise(
5326
+ return _chunk2XDW3UCGjs.googleGenAIChannels.embedContent.tracePromise(
4577
5327
  () => original(params),
4578
5328
  { arguments: [params] }
4579
5329
  );
@@ -4585,7 +5335,7 @@ function wrapInteractionCreate(original) {
4585
5335
  return options === void 0 ? original(params) : original(params, options);
4586
5336
  }
4587
5337
  const traceContext = options === void 0 ? { arguments: [params] } : { arguments: [params, options] };
4588
- return _chunkBBE7SNRVjs.googleGenAIChannels.interactionsCreate.tracePromise(
5338
+ return _chunk2XDW3UCGjs.googleGenAIChannels.interactionsCreate.tracePromise(
4589
5339
  () => options === void 0 ? original(params) : original(params, options),
4590
5340
  traceContext
4591
5341
  );
@@ -4646,7 +5396,7 @@ function wrapRunnerInstance(runner) {
4646
5396
  function wrapRunnerRunAsync(runner) {
4647
5397
  const original = runner.runAsync.bind(runner);
4648
5398
  return function(params) {
4649
- return _chunkBBE7SNRVjs.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
5399
+ return _chunk2XDW3UCGjs.googleADKChannels.runnerRunAsync.traceSync(() => original(params), {
4650
5400
  arguments: [params],
4651
5401
  self: runner
4652
5402
  });
@@ -4673,7 +5423,7 @@ function wrapAgentInstance2(agent) {
4673
5423
  function wrapAgentRunAsync(agent) {
4674
5424
  const original = agent.runAsync.bind(agent);
4675
5425
  return function(parentContext) {
4676
- return _chunkBBE7SNRVjs.googleADKChannels.agentRunAsync.traceSync(
5426
+ return _chunk2XDW3UCGjs.googleADKChannels.agentRunAsync.traceSync(
4677
5427
  () => original(parentContext),
4678
5428
  { arguments: [parentContext], self: agent }
4679
5429
  );
@@ -4700,7 +5450,7 @@ function wrapToolInstance(tool) {
4700
5450
  function wrapToolRunAsync(tool) {
4701
5451
  const original = tool.runAsync.bind(tool);
4702
5452
  return function(req) {
4703
- return _chunkBBE7SNRVjs.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
5453
+ return _chunk2XDW3UCGjs.googleADKChannels.toolRunAsync.tracePromise(() => original(req), {
4704
5454
  arguments: [req],
4705
5455
  self: tool
4706
5456
  });
@@ -4812,7 +5562,7 @@ function patchGenkitRegistryLookup(registry) {
4812
5562
  Object.defineProperty(registry, PATCHED_GENKIT_REGISTRY, {
4813
5563
  value: true
4814
5564
  });
4815
- } catch (e7) {
5565
+ } catch (e10) {
4816
5566
  }
4817
5567
  }
4818
5568
  function patchGenkitRegistryConstructor(registry) {
@@ -4843,31 +5593,31 @@ function patchGenkitRegistryConstructor(registry) {
4843
5593
  Object.defineProperty(constructor, PATCHED_GENKIT_REGISTRY_CONSTRUCTOR, {
4844
5594
  value: true
4845
5595
  });
4846
- } catch (e8) {
5596
+ } catch (e11) {
4847
5597
  }
4848
5598
  }
4849
5599
  function wrapGenerate(generate) {
4850
- return (input) => _chunkBBE7SNRVjs.genkitChannels.generate.tracePromise(() => generate(input), {
5600
+ return (input) => _chunk2XDW3UCGjs.genkitChannels.generate.tracePromise(() => generate(input), {
4851
5601
  arguments: [input]
4852
5602
  });
4853
5603
  }
4854
5604
  function wrapGenerateStream(generateStream) {
4855
- return (input) => _chunkBBE7SNRVjs.genkitChannels.generateStream.traceSync(() => generateStream(input), {
5605
+ return (input) => _chunk2XDW3UCGjs.genkitChannels.generateStream.traceSync(() => generateStream(input), {
4856
5606
  arguments: [input]
4857
5607
  });
4858
5608
  }
4859
5609
  function wrapEmbed2(embed) {
4860
- return (params) => _chunkBBE7SNRVjs.genkitChannels.embed.tracePromise(() => embed(params), {
5610
+ return (params) => _chunk2XDW3UCGjs.genkitChannels.embed.tracePromise(() => embed(params), {
4861
5611
  arguments: [params]
4862
5612
  });
4863
5613
  }
4864
5614
  function wrapEmbedMany2(embedMany) {
4865
- return (params) => _chunkBBE7SNRVjs.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
5615
+ return (params) => _chunk2XDW3UCGjs.genkitChannels.embedMany.tracePromise(() => embedMany(params), {
4866
5616
  arguments: [params]
4867
5617
  });
4868
5618
  }
4869
5619
  function wrapRun(run) {
4870
- return (name, inputOrFn, maybeFn) => _chunkBBE7SNRVjs.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
5620
+ return (name, inputOrFn, maybeFn) => _chunk2XDW3UCGjs.genkitChannels.actionRun.tracePromise(() => run(name, inputOrFn, maybeFn), {
4871
5621
  arguments: [name, inputOrFn, maybeFn]
4872
5622
  });
4873
5623
  }
@@ -4906,13 +5656,13 @@ function isGenkitAction(value) {
4906
5656
  return typeof value === "function" && "__action" in value;
4907
5657
  }
4908
5658
  function traceActionRun(action, run) {
4909
- return (input, options) => _chunkBBE7SNRVjs.genkitChannels.actionRun.tracePromise(() => run(input, options), {
5659
+ return (input, options) => _chunk2XDW3UCGjs.genkitChannels.actionRun.tracePromise(() => run(input, options), {
4910
5660
  arguments: [input, options],
4911
5661
  self: action
4912
5662
  });
4913
5663
  }
4914
5664
  function traceActionStream(action, stream) {
4915
- return (input, options) => _chunkBBE7SNRVjs.genkitChannels.actionStream.traceSync(() => stream(input, options), {
5665
+ return (input, options) => _chunk2XDW3UCGjs.genkitChannels.actionStream.traceSync(() => stream(input, options), {
4916
5666
  arguments: [input, options],
4917
5667
  self: action
4918
5668
  });
@@ -4958,10 +5708,10 @@ function isHuggingFaceConstructorKey(value) {
4958
5708
  return HUGGINGFACE_CONSTRUCTOR_KEY_SET.has(value);
4959
5709
  }
4960
5710
  function hasFunction2(value, methodName) {
4961
- return _chunkOBBWQW6Kjs.isObject.call(void 0, value) && methodName in value && typeof value[methodName] === "function";
5711
+ return _chunkTWCDSYJNjs.isObject.call(void 0, value) && methodName in value && typeof value[methodName] === "function";
4962
5712
  }
4963
5713
  function isSupportedHuggingFaceModule(value) {
4964
- if (!_chunkOBBWQW6Kjs.isObject.call(void 0, value)) {
5714
+ if (!_chunkTWCDSYJNjs.isObject.call(void 0, value)) {
4965
5715
  return false;
4966
5716
  }
4967
5717
  return HUGGINGFACE_CONSTRUCTOR_KEYS.some(
@@ -5069,14 +5819,14 @@ function wrapChatCompletion2(original, endpointUrl) {
5069
5819
  const context = {
5070
5820
  arguments: [traceParams]
5071
5821
  };
5072
- return _chunkBBE7SNRVjs.huggingFaceChannels.chatCompletion.tracePromise(
5822
+ return _chunk2XDW3UCGjs.huggingFaceChannels.chatCompletion.tracePromise(
5073
5823
  () => original(params, options),
5074
5824
  context
5075
5825
  );
5076
5826
  };
5077
5827
  }
5078
5828
  function wrapChatCompletionStream(original, endpointUrl) {
5079
- return (params, options) => _chunkBBE7SNRVjs.huggingFaceChannels.chatCompletionStream.traceSync(
5829
+ return (params, options) => _chunk2XDW3UCGjs.huggingFaceChannels.chatCompletionStream.traceSync(
5080
5830
  () => original(params, options),
5081
5831
  {
5082
5832
  arguments: [withEndpointUrl(params, endpointUrl)]
@@ -5089,14 +5839,14 @@ function wrapTextGeneration(original, endpointUrl) {
5089
5839
  const context = {
5090
5840
  arguments: [traceParams]
5091
5841
  };
5092
- return _chunkBBE7SNRVjs.huggingFaceChannels.textGeneration.tracePromise(
5842
+ return _chunk2XDW3UCGjs.huggingFaceChannels.textGeneration.tracePromise(
5093
5843
  () => original(params, options),
5094
5844
  context
5095
5845
  );
5096
5846
  };
5097
5847
  }
5098
5848
  function wrapTextGenerationStream(original, endpointUrl) {
5099
- return (params, options) => _chunkBBE7SNRVjs.huggingFaceChannels.textGenerationStream.traceSync(
5849
+ return (params, options) => _chunk2XDW3UCGjs.huggingFaceChannels.textGenerationStream.traceSync(
5100
5850
  () => original(params, options),
5101
5851
  {
5102
5852
  arguments: [withEndpointUrl(params, endpointUrl)]
@@ -5109,7 +5859,7 @@ function wrapFeatureExtraction(original, endpointUrl) {
5109
5859
  const context = {
5110
5860
  arguments: [traceParams]
5111
5861
  };
5112
- return _chunkBBE7SNRVjs.huggingFaceChannels.featureExtraction.tracePromise(
5862
+ return _chunk2XDW3UCGjs.huggingFaceChannels.featureExtraction.tracePromise(
5113
5863
  () => original(params, options),
5114
5864
  context
5115
5865
  );
@@ -5126,8 +5876,8 @@ var PIPELINE_CONSTRUCTOR_KEYS = /* @__PURE__ */ new Set([
5126
5876
  ]);
5127
5877
  var wrappedValues = /* @__PURE__ */ new WeakMap();
5128
5878
  function wrapHuggingFaceTransformers(transformers) {
5129
- const pipelineTask = _optionalChain([transformers, 'optionalAccess', _124 => _124.task]);
5130
- if (typeof transformers === "function" && _chunkBBE7SNRVjs.isSupportedHuggingFaceTransformersTask.call(void 0, pipelineTask)) {
5879
+ const pipelineTask = _optionalChain([transformers, 'optionalAccess', _141 => _141.task]);
5880
+ if (typeof transformers === "function" && _chunk2XDW3UCGjs.isSupportedHuggingFaceTransformersTask.call(void 0, pipelineTask)) {
5131
5881
  return wrapPipeline(transformers);
5132
5882
  }
5133
5883
  if (!isSupportedModule(transformers)) {
@@ -5179,8 +5929,8 @@ function wrapPipelineFactory(factory) {
5179
5929
  const context = {
5180
5930
  arguments: args
5181
5931
  };
5182
- return _chunkBBE7SNRVjs.huggingFaceTransformersChannels.pipeline.tracePromise(() => Reflect.apply(factory, this, args), context).then((pipeline) => {
5183
- if (_chunkBBE7SNRVjs.isSupportedHuggingFaceTransformersTask.call(void 0, _nullishCoalesce(pipeline.task, () => ( task)))) {
5932
+ return _chunk2XDW3UCGjs.huggingFaceTransformersChannels.pipeline.tracePromise(() => Reflect.apply(factory, this, args), context).then((pipeline) => {
5933
+ if (_chunk2XDW3UCGjs.isSupportedHuggingFaceTransformersTask.call(void 0, _nullishCoalesce(pipeline.task, () => ( task)))) {
5184
5934
  return wrapPipeline(pipeline);
5185
5935
  }
5186
5936
  return pipeline;
@@ -5198,7 +5948,7 @@ function wrapPipelineConstructor(constructor) {
5198
5948
  const proxy = new Proxy(constructor, {
5199
5949
  construct(target, args, newTarget) {
5200
5950
  const pipeline = Reflect.construct(target, args, newTarget);
5201
- if (_chunkBBE7SNRVjs.isSupportedHuggingFaceTransformersTask.call(void 0, pipeline.task)) {
5951
+ if (_chunk2XDW3UCGjs.isSupportedHuggingFaceTransformersTask.call(void 0, pipeline.task)) {
5202
5952
  return wrapPipeline(pipeline);
5203
5953
  }
5204
5954
  return pipeline;
@@ -5219,7 +5969,7 @@ function wrapPipeline(pipeline) {
5219
5969
  arguments: args,
5220
5970
  self: target
5221
5971
  };
5222
- return _chunkBBE7SNRVjs.huggingFaceTransformersChannels.pipelineCall.tracePromise(
5972
+ return _chunk2XDW3UCGjs.huggingFaceTransformersChannels.pipelineCall.tracePromise(
5223
5973
  () => Reflect.apply(target, thisArg, args),
5224
5974
  context
5225
5975
  );
@@ -5270,7 +6020,7 @@ function wrapCallModel(callModelFn, defaultThis) {
5270
6020
  const request = cloneCallModelRequest(argArray[0]);
5271
6021
  const options = argArray[1];
5272
6022
  const invocationTarget = thisArg === void 0 ? _nullishCoalesce(defaultThis, () => ( thisArg)) : thisArg;
5273
- return _chunkBBE7SNRVjs.openRouterAgentChannels.callModel.traceSync(
6023
+ return _chunk2XDW3UCGjs.openRouterAgentChannels.callModel.traceSync(
5274
6024
  () => Reflect.apply(target, invocationTarget, [request, options]),
5275
6025
  {
5276
6026
  arguments: [request]
@@ -5366,24 +6116,24 @@ function rerankProxy(rerank) {
5366
6116
  });
5367
6117
  }
5368
6118
  function wrapChatSend(send) {
5369
- return (request, options) => _chunkBBE7SNRVjs.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
6119
+ return (request, options) => _chunk2XDW3UCGjs.openRouterChannels.chatSend.tracePromise(() => send(request, options), {
5370
6120
  arguments: [request]
5371
6121
  });
5372
6122
  }
5373
6123
  function wrapEmbeddingsGenerate(generate) {
5374
- return (request, options) => _chunkBBE7SNRVjs.openRouterChannels.embeddingsGenerate.tracePromise(
6124
+ return (request, options) => _chunk2XDW3UCGjs.openRouterChannels.embeddingsGenerate.tracePromise(
5375
6125
  () => generate(request, options),
5376
6126
  { arguments: [request] }
5377
6127
  );
5378
6128
  }
5379
6129
  function wrapResponsesSend(send) {
5380
- return (request, options) => _chunkBBE7SNRVjs.openRouterChannels.betaResponsesSend.tracePromise(
6130
+ return (request, options) => _chunk2XDW3UCGjs.openRouterChannels.betaResponsesSend.tracePromise(
5381
6131
  () => send(request, options),
5382
6132
  { arguments: [request] }
5383
6133
  );
5384
6134
  }
5385
6135
  function wrapRerank2(rerank) {
5386
- return (request, options) => _chunkBBE7SNRVjs.openRouterChannels.rerankRerank.tracePromise(
6136
+ return (request, options) => _chunk2XDW3UCGjs.openRouterChannels.rerankRerank.tracePromise(
5387
6137
  () => rerank(request, options),
5388
6138
  { arguments: [request] }
5389
6139
  );
@@ -5391,7 +6141,7 @@ function wrapRerank2(rerank) {
5391
6141
  function wrapCallModel2(callModel) {
5392
6142
  return (request, options) => {
5393
6143
  const tracedRequest = { ...request };
5394
- return _chunkBBE7SNRVjs.openRouterChannels.callModel.traceSync(
6144
+ return _chunk2XDW3UCGjs.openRouterChannels.callModel.traceSync(
5395
6145
  () => callModel(tracedRequest, options),
5396
6146
  {
5397
6147
  arguments: [tracedRequest]
@@ -5524,7 +6274,7 @@ function classifiersProxy(classifiers) {
5524
6274
  });
5525
6275
  }
5526
6276
  function wrapChatComplete(complete) {
5527
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.chatComplete.tracePromise(
6277
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.chatComplete.tracePromise(
5528
6278
  () => complete(request, options),
5529
6279
  {
5530
6280
  arguments: [request]
@@ -5532,52 +6282,52 @@ function wrapChatComplete(complete) {
5532
6282
  );
5533
6283
  }
5534
6284
  function wrapChatStream(stream) {
5535
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
6285
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.chatStream.tracePromise(() => stream(request, options), {
5536
6286
  arguments: [request]
5537
6287
  });
5538
6288
  }
5539
6289
  function wrapEmbeddingsCreate(create) {
5540
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.embeddingsCreate.tracePromise(
6290
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.embeddingsCreate.tracePromise(
5541
6291
  () => create(request, options),
5542
6292
  { arguments: [request] }
5543
6293
  );
5544
6294
  }
5545
6295
  function wrapClassifiersModerate(moderate) {
5546
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.classifiersModerate.tracePromise(
6296
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.classifiersModerate.tracePromise(
5547
6297
  () => moderate(request, options),
5548
6298
  { arguments: [request] }
5549
6299
  );
5550
6300
  }
5551
6301
  function wrapClassifiersModerateChat(moderateChat) {
5552
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.classifiersModerateChat.tracePromise(
6302
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.classifiersModerateChat.tracePromise(
5553
6303
  () => moderateChat(request, options),
5554
6304
  { arguments: [request] }
5555
6305
  );
5556
6306
  }
5557
6307
  function wrapClassifiersClassify(classify) {
5558
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.classifiersClassify.tracePromise(
6308
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.classifiersClassify.tracePromise(
5559
6309
  () => classify(request, options),
5560
6310
  { arguments: [request] }
5561
6311
  );
5562
6312
  }
5563
6313
  function wrapClassifiersClassifyChat(classifyChat) {
5564
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.classifiersClassifyChat.tracePromise(
6314
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.classifiersClassifyChat.tracePromise(
5565
6315
  () => classifyChat(request, options),
5566
6316
  { arguments: [request] }
5567
6317
  );
5568
6318
  }
5569
6319
  function wrapFimComplete(complete) {
5570
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
6320
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.fimComplete.tracePromise(() => complete(request, options), {
5571
6321
  arguments: [request]
5572
6322
  });
5573
6323
  }
5574
6324
  function wrapFimStream(stream) {
5575
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
6325
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.fimStream.tracePromise(() => stream(request, options), {
5576
6326
  arguments: [request]
5577
6327
  });
5578
6328
  }
5579
6329
  function wrapAgentsComplete(complete) {
5580
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.agentsComplete.tracePromise(
6330
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.agentsComplete.tracePromise(
5581
6331
  () => complete(request, options),
5582
6332
  {
5583
6333
  arguments: [request]
@@ -5585,7 +6335,7 @@ function wrapAgentsComplete(complete) {
5585
6335
  );
5586
6336
  }
5587
6337
  function wrapAgentsStream(stream) {
5588
- return (request, options) => _chunkBBE7SNRVjs.mistralChannels.agentsStream.tracePromise(() => stream(request, options), {
6338
+ return (request, options) => _chunk2XDW3UCGjs.mistralChannels.agentsStream.tracePromise(() => stream(request, options), {
5589
6339
  arguments: [request]
5590
6340
  });
5591
6341
  }
@@ -5595,12 +6345,12 @@ function wrapOllama(ollama) {
5595
6345
  if (isSupportedOllamaClient(ollama)) {
5596
6346
  return ollamaProxy(ollama);
5597
6347
  }
5598
- _chunkOBBWQW6Kjs.debugLogger.warn("Unsupported Ollama library. Not wrapping.");
6348
+ _chunk2XDW3UCGjs.debugLogger.warn("Unsupported Ollama library. Not wrapping.");
5599
6349
  return ollama;
5600
6350
  }
5601
6351
  var ollamaProxyCache = /* @__PURE__ */ new WeakMap();
5602
6352
  function isSupportedOllamaClient(value) {
5603
- return _chunkOBBWQW6Kjs.isObject.call(void 0, value) && ["chat", "generate", "embed"].some(
6353
+ return _chunkTWCDSYJNjs.isObject.call(void 0, value) && ["chat", "generate", "embed"].some(
5604
6354
  (name) => typeof value[name] === "function"
5605
6355
  );
5606
6356
  }
@@ -5652,17 +6402,17 @@ function ollamaProxy(ollama) {
5652
6402
  return proxy;
5653
6403
  }
5654
6404
  function wrapChat(chat) {
5655
- return (request) => _chunkBBE7SNRVjs.ollamaChannels.chat.tracePromise(() => chat(request), {
6405
+ return (request) => _chunk2XDW3UCGjs.ollamaChannels.chat.tracePromise(() => chat(request), {
5656
6406
  arguments: [request]
5657
6407
  });
5658
6408
  }
5659
6409
  function wrapGenerate2(generate) {
5660
- return (request) => _chunkBBE7SNRVjs.ollamaChannels.generate.tracePromise(() => generate(request), {
6410
+ return (request) => _chunk2XDW3UCGjs.ollamaChannels.generate.tracePromise(() => generate(request), {
5661
6411
  arguments: [request]
5662
6412
  });
5663
6413
  }
5664
6414
  function wrapEmbed3(embed) {
5665
- return (request) => _chunkBBE7SNRVjs.ollamaChannels.embed.tracePromise(() => embed(request), {
6415
+ return (request) => _chunk2XDW3UCGjs.ollamaChannels.embed.tracePromise(() => embed(request), {
5666
6416
  arguments: [request]
5667
6417
  });
5668
6418
  }
@@ -5715,22 +6465,22 @@ function cohereProxy(cohere) {
5715
6465
  return proxy;
5716
6466
  }
5717
6467
  function wrapChat2(chat) {
5718
- return (request, options) => _chunkBBE7SNRVjs.cohereChannels.chat.tracePromise(() => chat(request, options), {
6468
+ return (request, options) => _chunk2XDW3UCGjs.cohereChannels.chat.tracePromise(() => chat(request, options), {
5719
6469
  arguments: [request]
5720
6470
  });
5721
6471
  }
5722
6472
  function wrapChatStream2(chatStream) {
5723
- return (request, options) => _chunkBBE7SNRVjs.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
6473
+ return (request, options) => _chunk2XDW3UCGjs.cohereChannels.chatStream.tracePromise(() => chatStream(request, options), {
5724
6474
  arguments: [request]
5725
6475
  });
5726
6476
  }
5727
6477
  function wrapEmbed4(embed) {
5728
- return (request, options) => _chunkBBE7SNRVjs.cohereChannels.embed.tracePromise(() => embed(request, options), {
6478
+ return (request, options) => _chunk2XDW3UCGjs.cohereChannels.embed.tracePromise(() => embed(request, options), {
5729
6479
  arguments: [request]
5730
6480
  });
5731
6481
  }
5732
6482
  function wrapRerank3(rerank) {
5733
- return (request, options) => _chunkBBE7SNRVjs.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
6483
+ return (request, options) => _chunk2XDW3UCGjs.cohereChannels.rerank.tracePromise(() => rerank(request, options), {
5734
6484
  arguments: [request]
5735
6485
  });
5736
6486
  }
@@ -5768,7 +6518,7 @@ function voyageAIProxy(client) {
5768
6518
  if (typeof target.embed !== "function") {
5769
6519
  return target.embed;
5770
6520
  }
5771
- return (request, options) => _chunkBBE7SNRVjs.voyageAIChannels.embed.invoke(
6521
+ return (request, options) => _chunk2XDW3UCGjs.voyageAIChannels.embed.invoke(
5772
6522
  target.embed,
5773
6523
  target,
5774
6524
  [request, options],
@@ -5778,7 +6528,7 @@ function voyageAIProxy(client) {
5778
6528
  if (typeof target.multimodalEmbed !== "function") {
5779
6529
  return target.multimodalEmbed;
5780
6530
  }
5781
- return (request, options) => _chunkBBE7SNRVjs.voyageAIChannels.multimodalEmbed.invoke(
6531
+ return (request, options) => _chunk2XDW3UCGjs.voyageAIChannels.multimodalEmbed.invoke(
5782
6532
  target.multimodalEmbed,
5783
6533
  target,
5784
6534
  [request, options],
@@ -5788,7 +6538,7 @@ function voyageAIProxy(client) {
5788
6538
  if (typeof target.rerank !== "function") {
5789
6539
  return target.rerank;
5790
6540
  }
5791
- return (request, options) => _chunkBBE7SNRVjs.voyageAIChannels.rerank.invoke(
6541
+ return (request, options) => _chunk2XDW3UCGjs.voyageAIChannels.rerank.invoke(
5792
6542
  target.rerank,
5793
6543
  target,
5794
6544
  [request, options],
@@ -5798,7 +6548,7 @@ function voyageAIProxy(client) {
5798
6548
  if (typeof target.contextualizedEmbed !== "function") {
5799
6549
  return target.contextualizedEmbed;
5800
6550
  }
5801
- return (request, options) => _chunkBBE7SNRVjs.voyageAIChannels.contextualizedEmbed.invoke(
6551
+ return (request, options) => _chunk2XDW3UCGjs.voyageAIChannels.contextualizedEmbed.invoke(
5802
6552
  target.contextualizedEmbed,
5803
6553
  target,
5804
6554
  [request, options],
@@ -5838,7 +6588,7 @@ function isSupportedGroqClient(value) {
5838
6588
  }
5839
6589
  function groqProxy(groq) {
5840
6590
  const privateMethodWorkaroundCache = /* @__PURE__ */ new WeakMap();
5841
- const completionProxy = _optionalChain([groq, 'access', _125 => _125.chat, 'optionalAccess', _126 => _126.completions]) ? new Proxy(groq.chat.completions, {
6591
+ const completionProxy = _optionalChain([groq, 'access', _142 => _142.chat, 'optionalAccess', _143 => _143.completions]) ? new Proxy(groq.chat.completions, {
5842
6592
  get(target, prop, receiver) {
5843
6593
  if (prop === "create") {
5844
6594
  return wrapChatCompletionsCreate(target.create.bind(target));
@@ -5890,13 +6640,13 @@ function groqProxy(groq) {
5890
6640
  return topLevelProxy;
5891
6641
  }
5892
6642
  function wrapChatCompletionsCreate(create) {
5893
- return (request, options) => _chunkBBE7SNRVjs.groqChannels.chatCompletionsCreate.tracePromise(
6643
+ return (request, options) => _chunk2XDW3UCGjs.groqChannels.chatCompletionsCreate.tracePromise(
5894
6644
  () => create(request, options),
5895
6645
  { arguments: [request] }
5896
6646
  );
5897
6647
  }
5898
6648
  function wrapEmbeddingsCreate2(create) {
5899
- return (request, options) => _chunkBBE7SNRVjs.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
6649
+ return (request, options) => _chunk2XDW3UCGjs.groqChannels.embeddingsCreate.tracePromise(() => create(request, options), {
5900
6650
  arguments: [request]
5901
6651
  });
5902
6652
  }
@@ -5970,16 +6720,16 @@ function bedrockRuntimeProxy(client) {
5970
6720
  }
5971
6721
  function wrapSend(send) {
5972
6722
  return (command, optionsOrCb, cb) => {
5973
- if (_chunkOBBWQW6Kjs.getBedrockRuntimeOperation.call(void 0, command) === void 0 || typeof optionsOrCb === "function" || typeof cb === "function") {
6723
+ if (_chunkTWCDSYJNjs.getBedrockRuntimeOperation.call(void 0, command) === void 0 || typeof optionsOrCb === "function" || typeof cb === "function") {
5974
6724
  return send(command, optionsOrCb, cb);
5975
6725
  }
5976
- return _chunkBBE7SNRVjs.bedrockRuntimeChannels.clientSend.tracePromise(
5977
- () => _chunkOBBWQW6Kjs.runWithAutoInstrumentationSuppressed.call(void 0,
6726
+ return _chunk2XDW3UCGjs.bedrockRuntimeChannels.clientSend.tracePromise(
6727
+ () => _chunkTWCDSYJNjs.runWithAutoInstrumentationSuppressed.call(void 0,
5978
6728
  () => send(command, optionsOrCb)
5979
6729
  ),
5980
6730
  {
5981
6731
  arguments: [command, optionsOrCb],
5982
- span_info: _chunkOBBWQW6Kjs.buildBedrockRuntimeSpanInfo.call(void 0, command)
6732
+ span_info: _chunkTWCDSYJNjs.buildBedrockRuntimeSpanInfo.call(void 0, command)
5983
6733
  }
5984
6734
  );
5985
6735
  };
@@ -6028,13 +6778,13 @@ function copilotClientProxy(client) {
6028
6778
  return proxy;
6029
6779
  }
6030
6780
  function wrappedCreateSession(client) {
6031
- return (config) => _chunkBBE7SNRVjs.gitHubCopilotChannels.createSession.tracePromise(
6781
+ return (config) => _chunk2XDW3UCGjs.gitHubCopilotChannels.createSession.tracePromise(
6032
6782
  () => client.createSession(config),
6033
6783
  { arguments: [config] }
6034
6784
  );
6035
6785
  }
6036
6786
  function wrappedResumeSession(client) {
6037
- return (sessionId, config) => _chunkBBE7SNRVjs.gitHubCopilotChannels.resumeSession.tracePromise(
6787
+ return (sessionId, config) => _chunk2XDW3UCGjs.gitHubCopilotChannels.resumeSession.tracePromise(
6038
6788
  () => client.resumeSession(sessionId, config),
6039
6789
  { arguments: [sessionId, config] }
6040
6790
  );
@@ -6139,7 +6889,7 @@ function isModuleNamespace6(value) {
6139
6889
  if (!value || typeof value !== "object") {
6140
6890
  return false;
6141
6891
  }
6142
- if (_optionalChain([value, 'access', _127 => _127.constructor, 'optionalAccess', _128 => _128.name]) === "Module") {
6892
+ if (_optionalChain([value, 'access', _144 => _144.constructor, 'optionalAccess', _145 => _145.name]) === "Module") {
6143
6893
  return true;
6144
6894
  }
6145
6895
  const firstKey = Object.keys(value)[0];
@@ -6163,7 +6913,7 @@ function wrapTraceable(traceable2) {
6163
6913
  apply(target, thisArg, argArray) {
6164
6914
  const [fn, rawConfig] = argArray;
6165
6915
  const config = rawConfig && typeof rawConfig === "object" ? rawConfig : void 0;
6166
- const originalOnEnd = _optionalChain([config, 'optionalAccess', _129 => _129.on_end]);
6916
+ const originalOnEnd = _optionalChain([config, 'optionalAccess', _146 => _146.on_end]);
6167
6917
  const wrappedConfig = {
6168
6918
  ...config,
6169
6919
  on_end(runTree) {
@@ -6212,13 +6962,13 @@ function wrapRunTreeInstance(runTree) {
6212
6962
  wrapped = (...args) => wrapRunTreeInstance(Reflect.apply(value, target, args));
6213
6963
  } else if (prop === "postRun") {
6214
6964
  const method = value;
6215
- wrapped = (...args) => _chunkBBE7SNRVjs.langSmithChannels.createRun.tracePromise(
6965
+ wrapped = (...args) => _chunk2XDW3UCGjs.langSmithChannels.createRun.tracePromise(
6216
6966
  () => Reflect.apply(method, target, args),
6217
6967
  { arguments: [target] }
6218
6968
  );
6219
6969
  } else if (prop === "patchRun") {
6220
6970
  const method = value;
6221
- wrapped = (...args) => _chunkBBE7SNRVjs.langSmithChannels.updateRun.tracePromise(
6971
+ wrapped = (...args) => _chunk2XDW3UCGjs.langSmithChannels.updateRun.tracePromise(
6222
6972
  () => Reflect.apply(method, target, args),
6223
6973
  {
6224
6974
  arguments: [
@@ -6267,19 +7017,19 @@ function wrapClientInstance(client) {
6267
7017
  let wrapped;
6268
7018
  if (prop === "createRun") {
6269
7019
  const method = value;
6270
- wrapped = (...args) => _chunkBBE7SNRVjs.langSmithChannels.createRun.tracePromise(
7020
+ wrapped = (...args) => _chunk2XDW3UCGjs.langSmithChannels.createRun.tracePromise(
6271
7021
  () => Reflect.apply(method, target, args),
6272
7022
  { arguments: args }
6273
7023
  );
6274
7024
  } else if (prop === "updateRun") {
6275
7025
  const method = value;
6276
- wrapped = (...args) => _chunkBBE7SNRVjs.langSmithChannels.updateRun.tracePromise(
7026
+ wrapped = (...args) => _chunk2XDW3UCGjs.langSmithChannels.updateRun.tracePromise(
6277
7027
  () => Reflect.apply(method, target, args),
6278
7028
  { arguments: args }
6279
7029
  );
6280
7030
  } else if (prop === "batchIngestRuns") {
6281
7031
  const method = value;
6282
- wrapped = (...args) => _chunkBBE7SNRVjs.langSmithChannels.batchIngestRuns.tracePromise(
7032
+ wrapped = (...args) => _chunk2XDW3UCGjs.langSmithChannels.batchIngestRuns.tracePromise(
6283
7033
  () => Reflect.apply(method, target, args),
6284
7034
  { arguments: args }
6285
7035
  );
@@ -6295,13 +7045,13 @@ function publishRunUpdate(runTree) {
6295
7045
  return;
6296
7046
  }
6297
7047
  try {
6298
- void _chunkBBE7SNRVjs.langSmithChannels.updateRun.tracePromise(() => Promise.resolve(void 0), {
7048
+ void _chunk2XDW3UCGjs.langSmithChannels.updateRun.tracePromise(() => Promise.resolve(void 0), {
6299
7049
  arguments: [runTree.id, runTree]
6300
7050
  }).catch((error) => {
6301
- _chunkOBBWQW6Kjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
7051
+ _chunk2XDW3UCGjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
6302
7052
  });
6303
7053
  } catch (error) {
6304
- _chunkOBBWQW6Kjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
7054
+ _chunk2XDW3UCGjs.debugLogger.error("LangSmith traceable instrumentation failed:", error);
6305
7055
  }
6306
7056
  }
6307
7057
 
@@ -6313,14 +7063,11 @@ var VitestContextManager = class {
6313
7063
  */
6314
7064
 
6315
7065
  constructor() {
6316
- this.contextStorage = _chunkBBE7SNRVjs.isomorph_default.newAsyncLocalStorage();
7066
+ this.contextStorage = _chunk2XDW3UCGjs.isomorph_default.newAsyncLocalStorage();
6317
7067
  }
6318
7068
  getCurrentContext() {
6319
7069
  return this.contextStorage.getStore();
6320
7070
  }
6321
- setContext(context) {
6322
- this.contextStorage.enterWith(context);
6323
- }
6324
7071
  runInContext(context, callback) {
6325
7072
  return this.contextStorage.run(context, callback);
6326
7073
  }
@@ -6346,15 +7093,15 @@ function getVitestContextManager() {
6346
7093
  }
6347
7094
 
6348
7095
  // src/wrappers/vitest/flush-manager.ts
6349
- var FlushCoordinator = (_class2 = class {constructor() { _class2.prototype.__init5.call(this); }
6350
- __init5() {this.activeFlushes = /* @__PURE__ */ new Map()}
7096
+ var FlushCoordinator = (_class3 = class {constructor() { _class3.prototype.__init10.call(this); }
7097
+ __init10() {this.activeFlushes = /* @__PURE__ */ new Map()}
6351
7098
  async coordinateFlush(context, config) {
6352
7099
  if (!context) return;
6353
7100
  const experimentId = await context.experiment.id;
6354
7101
  if (this.activeFlushes.has(experimentId)) {
6355
7102
  return this.activeFlushes.get(experimentId);
6356
7103
  }
6357
- const flushPromise = _chunkOBBWQW6Kjs.summarizeAndFlush.call(void 0, context.experiment, {
7104
+ const flushPromise = _chunkTWCDSYJNjs.summarizeAndFlush.call(void 0, context.experiment, {
6358
7105
  displaySummary: config.displaySummary
6359
7106
  });
6360
7107
  this.activeFlushes.set(experimentId, flushPromise);
@@ -6364,7 +7111,7 @@ var FlushCoordinator = (_class2 = class {constructor() { _class2.prototype.__ini
6364
7111
  this.activeFlushes.delete(experimentId);
6365
7112
  }
6366
7113
  }
6367
- }, _class2);
7114
+ }, _class3);
6368
7115
  var flushCoordinator = new FlushCoordinator();
6369
7116
  async function flushExperimentWithSync(context, config) {
6370
7117
  return flushCoordinator.coordinateFlush(context, config);
@@ -6452,7 +7199,7 @@ async function runTracedEval(args) {
6452
7199
  }
6453
7200
  if (testError) {
6454
7201
  span.log({ scores: { pass: 0 } });
6455
- _chunkOBBWQW6Kjs.logError.call(void 0, span, testError);
7202
+ _chunkTWCDSYJNjs.logError.call(void 0, span, testError);
6456
7203
  throw testError;
6457
7204
  }
6458
7205
  span.log({
@@ -6485,7 +7232,7 @@ function wrapTest(originalTest, config) {
6485
7232
  const wrapped = function(name, configOrFn, maybeFn) {
6486
7233
  const isEnhanced = typeof configOrFn !== "function";
6487
7234
  const testConfig = isEnhanced ? configOrFn : void 0;
6488
- if (isEnhanced && _optionalChain([testConfig, 'optionalAccess', _130 => _130.data]) && Array.isArray(testConfig.data)) {
7235
+ if (isEnhanced && _optionalChain([testConfig, 'optionalAccess', _147 => _147.data]) && Array.isArray(testConfig.data)) {
6489
7236
  const dataRecords = testConfig.data;
6490
7237
  const testFn2 = maybeFn;
6491
7238
  if (!testFn2) {
@@ -6523,7 +7270,7 @@ function wrapTest(originalTest, config) {
6523
7270
  const registrationContext = getExperimentContext();
6524
7271
  const testImplementation = async (vitestContext) => {
6525
7272
  const experimentContext = _nullishCoalesce(getExperimentContext(), () => ( registrationContext));
6526
- const experiment = _optionalChain([experimentContext, 'optionalAccess', _131 => _131.experiment]);
7273
+ const experiment = _optionalChain([experimentContext, 'optionalAccess', _148 => _148.experiment]);
6527
7274
  if (config.onProgress) {
6528
7275
  config.onProgress({ type: "test_start", testName: name });
6529
7276
  }
@@ -6555,11 +7302,11 @@ function wrapTest(originalTest, config) {
6555
7302
  const result = await runTracedEval({
6556
7303
  experiment,
6557
7304
  spanName: name,
6558
- input: _optionalChain([testConfig, 'optionalAccess', _132 => _132.input]),
6559
- expected: _optionalChain([testConfig, 'optionalAccess', _133 => _133.expected]),
6560
- metadata: _optionalChain([testConfig, 'optionalAccess', _134 => _134.metadata]),
6561
- tags: _optionalChain([testConfig, 'optionalAccess', _135 => _135.tags]),
6562
- scorers: _optionalChain([testConfig, 'optionalAccess', _136 => _136.scorers]),
7305
+ input: _optionalChain([testConfig, 'optionalAccess', _149 => _149.input]),
7306
+ expected: _optionalChain([testConfig, 'optionalAccess', _150 => _150.expected]),
7307
+ metadata: _optionalChain([testConfig, 'optionalAccess', _151 => _151.metadata]),
7308
+ tags: _optionalChain([testConfig, 'optionalAccess', _152 => _152.tags]),
7309
+ scorers: _optionalChain([testConfig, 'optionalAccess', _153 => _153.scorers]),
6563
7310
  fn: async () => {
6564
7311
  if (testConfig && maybeFn) {
6565
7312
  const params = {
@@ -6626,10 +7373,10 @@ function wrapDescribe(originalDescribe, config, afterAll) {
6626
7373
  const getOrCreateContext = () => {
6627
7374
  if (!context) {
6628
7375
  const experimentName = `${suiteName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
6629
- const experiment = config.projectId ? _chunkOBBWQW6Kjs.initExperiment.call(void 0, {
7376
+ const experiment = config.projectId ? _chunkTWCDSYJNjs.initExperiment.call(void 0, {
6630
7377
  projectId: config.projectId,
6631
7378
  experiment: experimentName
6632
- }) : _chunkOBBWQW6Kjs.initExperiment.call(void 0, config.projectName || suiteName, {
7379
+ }) : _chunkTWCDSYJNjs.initExperiment.call(void 0, config.projectName || suiteName, {
6633
7380
  experiment: experimentName
6634
7381
  });
6635
7382
  context = contextManager.createChildContext(void 0, experiment);
@@ -6665,8 +7412,7 @@ function wrapDescribe(originalDescribe, config, afterAll) {
6665
7412
  if (config.onProgress) {
6666
7413
  config.onProgress({ type: "suite_start", suiteName });
6667
7414
  }
6668
- contextManager.setContext(lazyContext);
6669
- factory();
7415
+ contextManager.runInContext(lazyContext, factory);
6670
7416
  if (afterAll) {
6671
7417
  afterAll(async () => {
6672
7418
  await flushExperimentWithSync(context, config);
@@ -6674,8 +7420,8 @@ function wrapDescribe(originalDescribe, config, afterAll) {
6674
7420
  config.onProgress({
6675
7421
  type: "suite_complete",
6676
7422
  suiteName,
6677
- passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _137 => _137.passed]), () => ( 0)),
6678
- failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _138 => _138.failed]), () => ( 0))
7423
+ passed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _154 => _154.passed]), () => ( 0)),
7424
+ failed: _nullishCoalesce(_optionalChain([context, 'optionalAccess', _155 => _155.failed]), () => ( 0))
6679
7425
  });
6680
7426
  }
6681
7427
  });
@@ -6737,7 +7483,7 @@ function wrapExpect(originalExpect) {
6737
7483
  return originalExpect(value);
6738
7484
  }
6739
7485
  const assertion = originalExpect(value, message);
6740
- const span = _chunkOBBWQW6Kjs.currentSpan.call(void 0, );
7486
+ const span = _chunkTWCDSYJNjs.currentSpan.call(void 0, );
6741
7487
  if (!span) {
6742
7488
  return assertion;
6743
7489
  }
@@ -6749,16 +7495,16 @@ function wrapExpect(originalExpect) {
6749
7495
 
6750
7496
  // src/wrappers/shared/logging.ts
6751
7497
  function logOutputs(outputs) {
6752
- _chunkOBBWQW6Kjs.currentSpan.call(void 0, ).log({ output: outputs });
7498
+ _chunkTWCDSYJNjs.currentSpan.call(void 0, ).log({ output: outputs });
6753
7499
  }
6754
7500
  function logFeedback(feedback) {
6755
- _chunkOBBWQW6Kjs.currentSpan.call(void 0, ).log({
7501
+ _chunkTWCDSYJNjs.currentSpan.call(void 0, ).log({
6756
7502
  scores: { [feedback.name]: feedback.score },
6757
7503
  metadata: feedback.metadata
6758
7504
  });
6759
7505
  }
6760
7506
  function getCurrentSpan() {
6761
- return _chunkOBBWQW6Kjs.currentSpan.call(void 0, );
7507
+ return _chunkTWCDSYJNjs.currentSpan.call(void 0, );
6762
7508
  }
6763
7509
 
6764
7510
  // src/wrappers/vitest/index.ts
@@ -6806,8 +7552,8 @@ function wrapVitest(vitestMethods, config = {}) {
6806
7552
  );
6807
7553
  return;
6808
7554
  }
6809
- await _chunkOBBWQW6Kjs.summarizeAndFlush.call(void 0, ctx.experiment, {
6810
- displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _139 => _139.displaySummary]), () => ( config.displaySummary))
7555
+ await _chunkTWCDSYJNjs.summarizeAndFlush.call(void 0, ctx.experiment, {
7556
+ displaySummary: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _156 => _156.displaySummary]), () => ( config.displaySummary))
6811
7557
  });
6812
7558
  }
6813
7559
  };
@@ -6821,7 +7567,7 @@ function initNodeTestSuite(config) {
6821
7567
  return experiment;
6822
7568
  }
6823
7569
  const experimentName = config.experimentName || `${config.projectName}-${(/* @__PURE__ */ new Date()).toISOString()}`;
6824
- experiment = _chunkOBBWQW6Kjs.initExperiment.call(void 0, config.projectName, {
7570
+ experiment = _chunkTWCDSYJNjs.initExperiment.call(void 0, config.projectName, {
6825
7571
  experiment: experimentName
6826
7572
  });
6827
7573
  return experiment;
@@ -6870,7 +7616,7 @@ function initNodeTestSuite(config) {
6870
7616
  if (!experiment) {
6871
7617
  return;
6872
7618
  }
6873
- await _chunkOBBWQW6Kjs.summarizeAndFlush.call(void 0, experiment, {
7619
+ await _chunkTWCDSYJNjs.summarizeAndFlush.call(void 0, experiment, {
6874
7620
  displaySummary: config.displaySummary
6875
7621
  });
6876
7622
  experiment = void 0;
@@ -6887,7 +7633,7 @@ function initNodeTestSuite(config) {
6887
7633
 
6888
7634
  // src/graph-framework.ts
6889
7635
  var graph_framework_exports = {};
6890
- _chunkBBE7SNRVjs.__export.call(void 0, graph_framework_exports, {
7636
+ _chunk2XDW3UCGjs.__export.call(void 0, graph_framework_exports, {
6891
7637
  AggregatorNode: () => AggregatorNode,
6892
7638
  GateNode: () => GateNode,
6893
7639
  GraphBuilder: () => GraphBuilder,
@@ -6901,15 +7647,15 @@ _chunkBBE7SNRVjs.__export.call(void 0, graph_framework_exports, {
6901
7647
  escapePath: () => escapePath,
6902
7648
  unescapePath: () => unescapePath
6903
7649
  });
6904
- var GraphBuilder = (_class3 = class {
6905
- __init6() {this.nodes = /* @__PURE__ */ new Map()}
6906
- __init7() {this.edges = {}}
6907
- __init8() {this.nodeLikeNodes = /* @__PURE__ */ new Map()}
7650
+ var GraphBuilder = (_class4 = class {
7651
+ __init11() {this.nodes = /* @__PURE__ */ new Map()}
7652
+ __init12() {this.edges = {}}
7653
+ __init13() {this.nodeLikeNodes = /* @__PURE__ */ new Map()}
6908
7654
  // Maps node-like objects, like prompts, to their nodes
6909
7655
  // Special nodes
6910
7656
 
6911
7657
 
6912
- constructor() {;_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);
7658
+ constructor() {;_class4.prototype.__init11.call(this);_class4.prototype.__init12.call(this);_class4.prototype.__init13.call(this);
6913
7659
  this.IN = this.createInputNode();
6914
7660
  this.OUT = this.createOutputNode();
6915
7661
  }
@@ -6961,7 +7707,7 @@ var GraphBuilder = (_class3 = class {
6961
7707
  };
6962
7708
  }
6963
7709
  resolveNode(node) {
6964
- if (node instanceof _chunkOBBWQW6Kjs.Prompt) {
7710
+ if (node instanceof _chunkTWCDSYJNjs.Prompt) {
6965
7711
  const cached = this.nodeLikeNodes.get(node);
6966
7712
  if (cached) {
6967
7713
  return [cached, []];
@@ -7011,7 +7757,7 @@ var GraphBuilder = (_class3 = class {
7011
7757
  // }
7012
7758
  // Helper to generate node IDs
7013
7759
  generateId(name) {
7014
- const uuid = _chunkOBBWQW6Kjs.newId.call(void 0, );
7760
+ const uuid = _chunkTWCDSYJNjs.newId.call(void 0, );
7015
7761
  if (name) {
7016
7762
  return `${name}-${uuid.slice(0, 8)}`;
7017
7763
  } else {
@@ -7039,7 +7785,7 @@ var GraphBuilder = (_class3 = class {
7039
7785
  this.nodes.set(id, promptNode);
7040
7786
  return promptNode;
7041
7787
  }
7042
- }, _class3);
7788
+ }, _class4);
7043
7789
  function isProxyVariable(node) {
7044
7790
  return typeof node === "object" && node !== null && "__type" in node && // @ts-ignore
7045
7791
  node.__type === "proxy-variable";
@@ -7047,19 +7793,19 @@ function isProxyVariable(node) {
7047
7793
  function proxyVariableToNode(proxy) {
7048
7794
  return [proxy.__node, proxy.__path];
7049
7795
  }
7050
- var BaseNode = (_class4 = class {
7051
- constructor(graph, id) {;_class4.prototype.__init9.call(this);_class4.prototype.__init10.call(this);
7796
+ var BaseNode = (_class5 = class {
7797
+ constructor(graph, id) {;_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);
7052
7798
  this.graph = graph;
7053
7799
  this.id = id;
7054
7800
  }
7055
7801
 
7056
7802
 
7057
- __init9() {this.__type = "node"}
7058
- __init10() {this.dependencies = []}
7803
+ __init14() {this.__type = "node"}
7804
+ __init15() {this.dependencies = []}
7059
7805
  addDependency(dependency) {
7060
7806
  this.dependencies.push(dependency);
7061
7807
  }
7062
- }, _class4);
7808
+ }, _class5);
7063
7809
  var InputNode = class extends BaseNode {
7064
7810
  constructor(graph, id) {
7065
7811
  super(graph, id);
@@ -7245,7 +7991,7 @@ function isAsync(fn) {
7245
7991
  function isAsyncGenerator(fn) {
7246
7992
  return fn[Symbol.toStringTag] === "AsyncGenerator";
7247
7993
  }
7248
- function isAsyncIterable(obj) {
7994
+ function isAsyncIterable2(obj) {
7249
7995
  return typeof obj[Symbol.asyncIterator] === "function";
7250
7996
  }
7251
7997
  function wrapAsync(asyncFn) {
@@ -7417,7 +8163,7 @@ var eachOfLimit$2 = (limit) => {
7417
8163
  if (isAsyncGenerator(obj)) {
7418
8164
  return asyncEachOfLimit(obj, limit, iteratee, callback);
7419
8165
  }
7420
- if (isAsyncIterable(obj)) {
8166
+ if (isAsyncIterable2(obj)) {
7421
8167
  return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback);
7422
8168
  }
7423
8169
  var nextElem = createIterator(obj);
@@ -8211,7 +8957,7 @@ function waterfall(tasks, callback) {
8211
8957
  var waterfall$1 = awaitify(waterfall);
8212
8958
 
8213
8959
  // src/trace.ts
8214
- var SpanFetcher = class _SpanFetcher extends _chunkOBBWQW6Kjs.ObjectFetcher {
8960
+ var SpanFetcher = class _SpanFetcher extends _chunkTWCDSYJNjs.ObjectFetcher {
8215
8961
  constructor(objectType, _objectId, rootSpanId, _state, spanTypeFilter, includeScorers = false, brainstoreRealtime = true) {
8216
8962
  const filterExpr = _SpanFetcher.buildFilter(
8217
8963
  rootSpanId,
@@ -8280,11 +9026,11 @@ var SpanFetcher = class _SpanFetcher extends _chunkOBBWQW6Kjs.ObjectFetcher {
8280
9026
  return this._state;
8281
9027
  }
8282
9028
  };
8283
- var CachedSpanFetcher = (_class5 = class {
8284
- __init11() {this.spanCache = /* @__PURE__ */ new Map()}
8285
- __init12() {this.allFetched = false}
9029
+ var CachedSpanFetcher = (_class6 = class {
9030
+ __init16() {this.spanCache = /* @__PURE__ */ new Map()}
9031
+ __init17() {this.allFetched = false}
8286
9032
 
8287
- constructor(objectTypeOrFetchFn, objectId, rootSpanId, getState, brainstoreRealtime = true) {;_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);
9033
+ constructor(objectTypeOrFetchFn, objectId, rootSpanId, getState, brainstoreRealtime = true) {;_class6.prototype.__init16.call(this);_class6.prototype.__init17.call(this);
8288
9034
  if (typeof objectTypeOrFetchFn === "function") {
8289
9035
  this.fetchFn = (spanType) => objectTypeOrFetchFn(spanType);
8290
9036
  } else {
@@ -8348,7 +9094,7 @@ var CachedSpanFetcher = (_class5 = class {
8348
9094
  async fetchSpans(spanType) {
8349
9095
  const spans = await this.fetchFn(spanType, false);
8350
9096
  for (const span of spans) {
8351
- const type = _nullishCoalesce(_optionalChain([span, 'access', _140 => _140.span_attributes, 'optionalAccess', _141 => _141.type]), () => ( ""));
9097
+ const type = _nullishCoalesce(_optionalChain([span, 'access', _157 => _157.span_attributes, 'optionalAccess', _158 => _158.type]), () => ( ""));
8352
9098
  const existing = _nullishCoalesce(this.spanCache.get(type), () => ( []));
8353
9099
  existing.push(span);
8354
9100
  this.spanCache.set(type, existing);
@@ -8365,24 +9111,24 @@ var CachedSpanFetcher = (_class5 = class {
8365
9111
  }
8366
9112
  return result;
8367
9113
  }
8368
- }, _class5);
8369
- var LocalTrace = (_class6 = class {
9114
+ }, _class6);
9115
+ var LocalTrace = (_class7 = class {
8370
9116
 
8371
9117
 
8372
9118
 
8373
9119
 
8374
9120
 
8375
- __init13() {this.spansFlushed = false}
8376
- __init14() {this.spansFlushPromise = null}
9121
+ __init18() {this.spansFlushed = false}
9122
+ __init19() {this.spansFlushPromise = null}
8377
9123
 
8378
- __init15() {this.threadCache = /* @__PURE__ */ new Map()}
9124
+ __init20() {this.threadCache = /* @__PURE__ */ new Map()}
8379
9125
  constructor({
8380
9126
  objectType,
8381
9127
  objectId,
8382
9128
  rootSpanId,
8383
9129
  ensureSpansFlushed,
8384
9130
  state
8385
- }) {;_class6.prototype.__init13.call(this);_class6.prototype.__init14.call(this);_class6.prototype.__init15.call(this);
9131
+ }) {;_class7.prototype.__init18.call(this);_class7.prototype.__init19.call(this);_class7.prototype.__init20.call(this);
8386
9132
  this.objectType = objectType;
8387
9133
  this.objectId = objectId;
8388
9134
  this.rootSpanId = rootSpanId;
@@ -8431,11 +9177,11 @@ var LocalTrace = (_class6 = class {
8431
9177
  const cachedSpans = this.state.spanCache.getByRootSpanId(this.rootSpanId);
8432
9178
  if (cachedSpans && cachedSpans.length > 0) {
8433
9179
  let spans = includeScorers ? cachedSpans : cachedSpans.filter(
8434
- (span) => _optionalChain([span, 'access', _142 => _142.span_attributes, 'optionalAccess', _143 => _143.purpose]) !== "scorer"
9180
+ (span) => _optionalChain([span, 'access', _159 => _159.span_attributes, 'optionalAccess', _160 => _160.purpose]) !== "scorer"
8435
9181
  );
8436
9182
  if (spanType && spanType.length > 0) {
8437
9183
  spans = spans.filter(
8438
- (span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access', _144 => _144.span_attributes, 'optionalAccess', _145 => _145.type]), () => ( "")))
9184
+ (span) => spanType.includes(_nullishCoalesce(_optionalChain([span, 'access', _161 => _161.span_attributes, 'optionalAccess', _162 => _162.type]), () => ( "")))
8439
9185
  );
8440
9186
  }
8441
9187
  return spans.map((span) => ({
@@ -8460,7 +9206,7 @@ var LocalTrace = (_class6 = class {
8460
9206
  * Calls the API with the project_default preprocessor (which falls back to "thread").
8461
9207
  */
8462
9208
  async getThread(options) {
8463
- const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _146 => _146.preprocessor]), () => ( "project_default"));
9209
+ const cacheKey = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _163 => _163.preprocessor]), () => ( "project_default"));
8464
9210
  if (!this.threadCache.has(cacheKey)) {
8465
9211
  const promise = this.fetchThread(options);
8466
9212
  this.threadCache.set(cacheKey, promise);
@@ -8471,7 +9217,7 @@ var LocalTrace = (_class6 = class {
8471
9217
  await this.ensureSpansReady();
8472
9218
  await this.state.login({});
8473
9219
  const result = await invoke({
8474
- globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _147 => _147.preprocessor]), () => ( "project_default")),
9220
+ globalFunction: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _164 => _164.preprocessor]), () => ( "project_default")),
8475
9221
  functionType: "preprocessor",
8476
9222
  input: {
8477
9223
  trace_ref: {
@@ -8502,7 +9248,7 @@ var LocalTrace = (_class6 = class {
8502
9248
  }
8503
9249
  await this.spansFlushPromise;
8504
9250
  }
8505
- }, _class6);
9251
+ }, _class7);
8506
9252
 
8507
9253
  // src/reporters/progress.ts
8508
9254
  var SimpleProgressReporter = class {
@@ -8528,20 +9274,20 @@ var promptContentsSchema = _v3.z.union([
8528
9274
  prompt: _v3.z.string()
8529
9275
  }),
8530
9276
  _v3.z.object({
8531
- messages: _v3.z.array(_chunkOBBWQW6Kjs.ChatCompletionMessageParam)
9277
+ messages: _v3.z.array(_chunkTWCDSYJNjs.ChatCompletionMessageParam)
8532
9278
  })
8533
9279
  ]);
8534
9280
  var promptDefinitionSchema = promptContentsSchema.and(
8535
9281
  _v3.z.object({
8536
9282
  model: _v3.z.string(),
8537
- params: _chunkOBBWQW6Kjs.ModelParams.optional(),
9283
+ params: _chunkTWCDSYJNjs.ModelParams.optional(),
8538
9284
  templateFormat: _v3.z.enum(["mustache", "nunjucks", "none"]).optional(),
8539
9285
  environments: _v3.z.array(_v3.z.string()).optional()
8540
9286
  })
8541
9287
  );
8542
9288
  var promptDefinitionWithToolsSchema = promptDefinitionSchema.and(
8543
9289
  _v3.z.object({
8544
- tools: _v3.z.array(_chunkOBBWQW6Kjs.ToolFunctionDefinition).optional()
9290
+ tools: _v3.z.array(_chunkTWCDSYJNjs.ToolFunctionDefinition).optional()
8545
9291
  })
8546
9292
  );
8547
9293
  function promptDefinitionToPromptData(promptDefinition, rawTools) {
@@ -8589,7 +9335,7 @@ async function validateParameters(parameters, parameterSchema) {
8589
9335
  if (resolvedSchema === void 0 || resolvedSchema === null) {
8590
9336
  return parameters;
8591
9337
  }
8592
- if (_chunkOBBWQW6Kjs.RemoteEvalParameters.isParameters(resolvedSchema)) {
9338
+ if (_chunkTWCDSYJNjs.RemoteEvalParameters.isParameters(resolvedSchema)) {
8593
9339
  const mergedParameters = parameters && Object.keys(parameters).length > 0 ? {
8594
9340
  ...resolvedSchema.data,
8595
9341
  ...parameters
@@ -8611,14 +9357,14 @@ function validateParametersWithZod(parameters, parameterSchema) {
8611
9357
  const value = parameters[name];
8612
9358
  try {
8613
9359
  if ("type" in schema && schema.type === "prompt") {
8614
- const promptData = value ? _chunkOBBWQW6Kjs.PromptData.parse(value) : schema.default ? promptDefinitionToPromptData(
9360
+ const promptData = value ? _chunkTWCDSYJNjs.PromptData.parse(value) : schema.default ? promptDefinitionToPromptData(
8615
9361
  schema.default,
8616
9362
  schema.default.tools
8617
9363
  ) : void 0;
8618
9364
  if (!promptData) {
8619
9365
  throw new Error(`Parameter '${name}' is required`);
8620
9366
  }
8621
- return [name, _chunkOBBWQW6Kjs.Prompt.fromPromptData(name, promptData)];
9367
+ return [name, _chunkTWCDSYJNjs.Prompt.fromPromptData(name, promptData)];
8622
9368
  } else if ("type" in schema && schema.type === "model") {
8623
9369
  const model = _nullishCoalesce(value, () => ( schema.default));
8624
9370
  if (model === void 0) {
@@ -8647,10 +9393,10 @@ function validateParametersWithJsonSchema(parameters, schema) {
8647
9393
  const ajv = new (0, _ajv2.default)({ coerceTypes: true, useDefaults: true, strict: false });
8648
9394
  const validate = ajv.compile(schema);
8649
9395
  if (!validate(parameters)) {
8650
- const errorMessages = _optionalChain([validate, 'access', _148 => _148.errors, 'optionalAccess', _149 => _149.map, 'call', _150 => _150((err) => {
9396
+ const errorMessages = _optionalChain([validate, 'access', _165 => _165.errors, 'optionalAccess', _166 => _166.map, 'call', _167 => _167((err) => {
8651
9397
  const path = err.instancePath || "root";
8652
9398
  return `${path}: ${err.message}`;
8653
- }), 'access', _151 => _151.join, 'call', _152 => _152(", ")]);
9399
+ }), 'access', _168 => _168.join, 'call', _169 => _169(", ")]);
8654
9400
  throw Error(`Invalid parameters: ${errorMessages}`);
8655
9401
  }
8656
9402
  return rehydrateRemoteParameters(parameters, schema);
@@ -8669,7 +9415,7 @@ function rehydrateRemoteParameters(parameters, schema) {
8669
9415
  if (Reflect.get(propertySchema, "x-bt-type") === "prompt") {
8670
9416
  return [
8671
9417
  name,
8672
- _chunkOBBWQW6Kjs.Prompt.fromPromptData(name, _chunkOBBWQW6Kjs.PromptData.parse(value))
9418
+ _chunkTWCDSYJNjs.Prompt.fromPromptData(name, _chunkTWCDSYJNjs.PromptData.parse(value))
8673
9419
  ];
8674
9420
  }
8675
9421
  return [name, value];
@@ -8707,7 +9453,7 @@ var EvalResultWithSummary = class {
8707
9453
  async function getPersistedBaseExperimentId(experiment) {
8708
9454
  try {
8709
9455
  return await experiment._getBaseExperimentId();
8710
- } catch (e9) {
9456
+ } catch (e12) {
8711
9457
  return void 0;
8712
9458
  }
8713
9459
  }
@@ -8719,7 +9465,7 @@ function makeEvalName(projectName, experimentName) {
8719
9465
  return out;
8720
9466
  }
8721
9467
  function initExperiment2(state, options = {}) {
8722
- return _chunkOBBWQW6Kjs.init.call(void 0, {
9468
+ return _chunkTWCDSYJNjs.init.call(void 0, {
8723
9469
  state,
8724
9470
  ...options,
8725
9471
  setCurrent: false
@@ -8730,7 +9476,7 @@ async function getExperimentParametersRef(parameters) {
8730
9476
  return void 0;
8731
9477
  }
8732
9478
  const resolvedParameters = parameters instanceof Promise ? await parameters : parameters;
8733
- if (!_chunkOBBWQW6Kjs.RemoteEvalParameters.isParameters(resolvedParameters)) {
9479
+ if (!_chunkTWCDSYJNjs.RemoteEvalParameters.isParameters(resolvedParameters)) {
8734
9480
  return void 0;
8735
9481
  }
8736
9482
  if (resolvedParameters.id === void 0) {
@@ -8757,7 +9503,7 @@ async function _internalInitEvaluatorExperiment(projectName, evaluator, data, op
8757
9503
  baseExperimentId: evaluator.baseExperimentId,
8758
9504
  gitMetadataSettings: evaluator.gitMetadataSettings,
8759
9505
  repoInfo: evaluator.repoInfo,
8760
- dataset: _chunkOBBWQW6Kjs.Dataset.isDataset(data) ? data : void 0,
9506
+ dataset: _chunkTWCDSYJNjs.Dataset.isDataset(data) ? data : void 0,
8761
9507
  parameters
8762
9508
  });
8763
9509
  }
@@ -8772,7 +9518,7 @@ function callEvaluatorData(data) {
8772
9518
  baseExperiment
8773
9519
  };
8774
9520
  }
8775
- function isAsyncIterable2(value) {
9521
+ function isAsyncIterable3(value) {
8776
9522
  return typeof value === "object" && value !== null && Symbol.asyncIterator in value && typeof value[Symbol.asyncIterator] === "function";
8777
9523
  }
8778
9524
  function isIterable(value) {
@@ -8793,7 +9539,7 @@ async function _internalResolveEvaluatorData(evaluator, experiment) {
8793
9539
  );
8794
9540
  }
8795
9541
  let name = dataResult.name;
8796
- if (_chunkOBBWQW6Kjs.isEmpty.call(void 0, name)) {
9542
+ if (_chunkTWCDSYJNjs.isEmpty.call(void 0, name)) {
8797
9543
  const baseExperiment = await experiment.fetchBaseExperiment();
8798
9544
  if (!baseExperiment) {
8799
9545
  throw new Error("BaseExperiment() failed to fetch base experiment");
@@ -8807,7 +9553,7 @@ async function _internalResolveEvaluatorData(evaluator, experiment) {
8807
9553
  }).asDataset();
8808
9554
  }
8809
9555
  const resolvedDataResult = dataResult instanceof Promise ? await dataResult : dataResult;
8810
- if (isAsyncIterable2(resolvedDataResult)) {
9556
+ if (isAsyncIterable3(resolvedDataResult)) {
8811
9557
  return resolvedDataResult;
8812
9558
  }
8813
9559
  if (Array.isArray(resolvedDataResult) || isIterable(resolvedDataResult)) {
@@ -8828,10 +9574,10 @@ globalThis._evals = {
8828
9574
  reporters: {}
8829
9575
  };
8830
9576
  function _initializeSpanContext() {
8831
- globalThis._spanContext = { currentSpan: _chunkOBBWQW6Kjs.currentSpan, withCurrent: _chunkOBBWQW6Kjs.withCurrent, startSpan: _chunkOBBWQW6Kjs.startSpan, NOOP_SPAN: _chunkOBBWQW6Kjs.NOOP_SPAN };
9577
+ globalThis._spanContext = { currentSpan: _chunkTWCDSYJNjs.currentSpan, withCurrent: _chunkTWCDSYJNjs.withCurrent, startSpan: _chunkTWCDSYJNjs.startSpan, NOOP_SPAN: _chunkTWCDSYJNjs.NOOP_SPAN };
8832
9578
  }
8833
9579
  async function Eval(name, evaluator, reporterOrOpts) {
8834
- const options = _chunkOBBWQW6Kjs.isEmpty.call(void 0, reporterOrOpts) ? {} : typeof reporterOrOpts === "string" ? { reporter: reporterOrOpts } : "name" in reporterOrOpts ? { reporter: reporterOrOpts } : reporterOrOpts;
9580
+ const options = _chunkTWCDSYJNjs.isEmpty.call(void 0, reporterOrOpts) ? {} : typeof reporterOrOpts === "string" ? { reporter: reporterOrOpts } : "name" in reporterOrOpts ? { reporter: reporterOrOpts } : reporterOrOpts;
8835
9581
  let evalName = makeEvalName(name, evaluator.experimentName);
8836
9582
  if (globalThis._evals.evaluators[evalName]) {
8837
9583
  evalName = `${evalName}_${Object.keys(_evals).length}`;
@@ -8890,7 +9636,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
8890
9636
  const enableCache = _nullishCoalesce(options.enableCache, () => ( true));
8891
9637
  let ret;
8892
9638
  if (options.parent) {
8893
- ret = await _chunkOBBWQW6Kjs.withParent.call(void 0,
9639
+ ret = await _chunkTWCDSYJNjs.withParent.call(void 0,
8894
9640
  options.parent,
8895
9641
  () => runEvaluator(
8896
9642
  null,
@@ -8926,7 +9672,7 @@ async function Eval(name, evaluator, reporterOrOpts) {
8926
9672
  if (experiment) {
8927
9673
  await experiment.flush().catch(console.error);
8928
9674
  } else if (options.parent) {
8929
- await _chunkOBBWQW6Kjs.flush.call(void 0, { state: evaluator.state }).catch(console.error);
9675
+ await _chunkTWCDSYJNjs.flush.call(void 0, { state: evaluator.state }).catch(console.error);
8930
9676
  }
8931
9677
  }
8932
9678
  } finally {
@@ -9009,7 +9755,7 @@ function _internalPrepareEvaluatorScore(scoreValue, name) {
9009
9755
  if (scoreValue === null) return { results: null };
9010
9756
  if (Array.isArray(scoreValue)) {
9011
9757
  for (const score of scoreValue) {
9012
- if (!(typeof score === "object" && !_chunkOBBWQW6Kjs.isEmpty.call(void 0, score))) {
9758
+ if (!(typeof score === "object" && !_chunkTWCDSYJNjs.isEmpty.call(void 0, score))) {
9013
9759
  throw new Error(
9014
9760
  `When returning an array of scores, each score must be a non-empty object. Got: ${JSON.stringify(score)}`
9015
9761
  );
@@ -9019,7 +9765,7 @@ function _internalPrepareEvaluatorScore(scoreValue, name) {
9019
9765
  let results;
9020
9766
  if (Array.isArray(scoreValue)) {
9021
9767
  results = scoreValue;
9022
- } else if (typeof scoreValue === "object" && !_chunkOBBWQW6Kjs.isEmpty.call(void 0, scoreValue)) {
9768
+ } else if (typeof scoreValue === "object" && !_chunkTWCDSYJNjs.isEmpty.call(void 0, scoreValue)) {
9023
9769
  results = [scoreValue];
9024
9770
  } else {
9025
9771
  results = [{ name, score: scoreValue }];
@@ -9063,7 +9809,7 @@ function collectScoringResults(runResults, names, onResult) {
9063
9809
  return failing;
9064
9810
  }
9065
9811
  function validateClassificationResult(value, scorerName2) {
9066
- if (!(typeof value === "object" && value !== null && !_chunkOBBWQW6Kjs.isEmpty.call(void 0, value))) {
9812
+ if (!(typeof value === "object" && value !== null && !_chunkTWCDSYJNjs.isEmpty.call(void 0, value))) {
9067
9813
  throw new Error(
9068
9814
  `When returning structured classifier results, each classification must be a non-empty object. Got: ${JSON.stringify(value)}`
9069
9815
  );
@@ -9113,7 +9859,7 @@ function logScoringFailures(kind, failures, metadata, rootSpan, state) {
9113
9859
  );
9114
9860
  metadata[`${kind}_errors`] = errorMap;
9115
9861
  rootSpan.log({ metadata: { [`${kind}_errors`]: errorMap } });
9116
- _chunkOBBWQW6Kjs.debugLogger.forState(state).warn(
9862
+ _chunk2XDW3UCGjs.debugLogger.forState(state).warn(
9117
9863
  `Found exceptions for the following ${kind}s: ${Object.keys(errorMap).join(", ")}`,
9118
9864
  failures.map((f) => f.error)
9119
9865
  );
@@ -9147,7 +9893,7 @@ var defaultErrorScoreHandler = ({
9147
9893
  };
9148
9894
  async function runEvaluatorInternal(experiment, evaluator, progressReporter, filters, stream, parameters, collectResults, enableCache) {
9149
9895
  if (enableCache) {
9150
- _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _153 => _153.spanCache, 'optionalAccess', _154 => _154.start, 'call', _155 => _155()]);
9896
+ _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _170 => _170.spanCache, 'optionalAccess', _171 => _171.start, 'call', _172 => _172()]);
9151
9897
  }
9152
9898
  try {
9153
9899
  parameters = await validateParameters(
@@ -9162,7 +9908,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9162
9908
  const experimentIdPromise = experiment ? (async () => {
9163
9909
  try {
9164
9910
  return await experiment.id;
9165
- } catch (e10) {
9911
+ } catch (e13) {
9166
9912
  return void 0;
9167
9913
  }
9168
9914
  })() : void 0;
@@ -9178,7 +9924,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9178
9924
  if (cancelled) {
9179
9925
  return;
9180
9926
  }
9181
- const eventDataset = experiment ? experiment.dataset : _chunkOBBWQW6Kjs.Dataset.isDataset(evaluator.data) ? evaluator.data : void 0;
9927
+ const eventDataset = experiment ? experiment.dataset : _chunkTWCDSYJNjs.Dataset.isDataset(evaluator.data) ? evaluator.data : void 0;
9182
9928
  const inlineDatasetOrigin = eventDataset && datum.id && datum._xact_id ? {
9183
9929
  object_type: "dataset",
9184
9930
  object_id: await eventDataset.id,
@@ -9186,8 +9932,8 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9186
9932
  created: datum.created,
9187
9933
  _xact_id: datum._xact_id
9188
9934
  } : void 0;
9189
- const parsedDatumOrigin = _chunkOBBWQW6Kjs.ObjectReference.safeParse(datum.origin);
9190
- const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess', _156 => _156.success]) ? parsedDatumOrigin.data : void 0)));
9935
+ const parsedDatumOrigin = _chunkTWCDSYJNjs.ObjectReference.safeParse(datum.origin);
9936
+ const origin = _nullishCoalesce(inlineDatasetOrigin, () => ( (_optionalChain([parsedDatumOrigin, 'optionalAccess', _173 => _173.success]) ? parsedDatumOrigin.data : void 0)));
9191
9937
  const baseEvent = {
9192
9938
  name: "eval",
9193
9939
  spanAttributes: {
@@ -9202,26 +9948,26 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9202
9948
  }
9203
9949
  };
9204
9950
  const callback = async (rootSpan) => {
9205
- const state = _nullishCoalesce(evaluator.state, () => ( _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, )));
9951
+ const state = _nullishCoalesce(evaluator.state, () => ( _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, )));
9206
9952
  const ensureSpansFlushed = async () => {
9207
9953
  if (experiment) {
9208
- await _chunkOBBWQW6Kjs.flush.call(void 0, { state: experiment.loggingState });
9954
+ await _chunkTWCDSYJNjs.flush.call(void 0, { state: experiment.loggingState });
9209
9955
  } else if (state) {
9210
- await _chunkOBBWQW6Kjs.flush.call(void 0, { state });
9956
+ await _chunkTWCDSYJNjs.flush.call(void 0, { state });
9211
9957
  } else {
9212
- await _chunkOBBWQW6Kjs.flush.call(void 0, );
9958
+ await _chunkTWCDSYJNjs.flush.call(void 0, );
9213
9959
  }
9214
9960
  if (state) {
9215
9961
  await state.flushOtel();
9216
9962
  }
9217
9963
  };
9218
9964
  const parentStr = state.currentParent.getStore();
9219
- const parentComponents = typeof parentStr === "string" ? _chunkOBBWQW6Kjs.SpanComponentsV4.fromStr(parentStr) : null;
9965
+ const parentComponents = typeof parentStr === "string" ? _chunkTWCDSYJNjs.SpanComponentsV4.fromStr(parentStr) : null;
9220
9966
  const trace = state ? new LocalTrace({
9221
- objectType: parentComponents ? _chunkOBBWQW6Kjs.spanObjectTypeV3ToTypedString.call(void 0,
9967
+ objectType: parentComponents ? _chunkTWCDSYJNjs.spanObjectTypeV3ToTypedString.call(void 0,
9222
9968
  parentComponents.data.object_type
9223
9969
  ) : "experiment",
9224
- objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _157 => _157.data, 'access', async _158 => _158.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
9970
+ objectId: await _asyncNullishCoalesce(await _asyncOptionalChain([parentComponents, 'optionalAccess', async _174 => _174.data, 'access', async _175 => _175.object_id]), async () => ( (experimentIdPromise ? await _asyncNullishCoalesce(await experimentIdPromise, async () => ( "")) : ""))),
9225
9971
  rootSpanId: rootSpan.rootSpanId,
9226
9972
  ensureSpansFlushed,
9227
9973
  state
@@ -9247,10 +9993,10 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9247
9993
  _nullishCoalesce(parameters, () => ( {})),
9248
9994
  span,
9249
9995
  (event) => {
9250
- _optionalChain([stream, 'optionalCall', _159 => _159({
9996
+ _optionalChain([stream, 'optionalCall', _176 => _176({
9251
9997
  ...event,
9252
9998
  id: rootSpan.id,
9253
- origin: _optionalChain([baseEvent, 'access', _160 => _160.event, 'optionalAccess', _161 => _161.origin]),
9999
+ origin: _optionalChain([baseEvent, 'access', _177 => _177.event, 'optionalAccess', _178 => _178.origin]),
9254
10000
  name: evaluator.evalName,
9255
10001
  object_type: "task"
9256
10002
  })]);
@@ -9283,7 +10029,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9283
10029
  trace
9284
10030
  };
9285
10031
  const { trace: _trace, ...scoringArgsForLogging } = scoringArgs;
9286
- const propagatedEvent = _chunkOBBWQW6Kjs.makeScorerPropagatedEvent.call(void 0,
10032
+ const propagatedEvent = _chunkTWCDSYJNjs.makeScorerPropagatedEvent.call(void 0,
9287
10033
  await rootSpan.export()
9288
10034
  );
9289
10035
  const [scoreResults, classificationResults] = await Promise.all([
@@ -9378,7 +10124,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9378
10124
  evaluator.state
9379
10125
  );
9380
10126
  } catch (e) {
9381
- _chunkOBBWQW6Kjs.logError.call(void 0, rootSpan, e);
10127
+ _chunkTWCDSYJNjs.logError.call(void 0, rootSpan, e);
9382
10128
  error = e;
9383
10129
  } finally {
9384
10130
  progressReporter.increment(evaluator.evalName);
@@ -9402,7 +10148,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9402
10148
  tags: tags.length ? tags : void 0,
9403
10149
  metadata,
9404
10150
  error,
9405
- origin: _optionalChain([baseEvent, 'access', _162 => _162.event, 'optionalAccess', _163 => _163.origin])
10151
+ origin: _optionalChain([baseEvent, 'access', _179 => _179.event, 'optionalAccess', _180 => _180.origin])
9406
10152
  };
9407
10153
  collectedResults.push({
9408
10154
  ...baseResult,
@@ -9412,7 +10158,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9412
10158
  }
9413
10159
  };
9414
10160
  if (!experiment) {
9415
- return await _chunkOBBWQW6Kjs.traced.call(void 0, callback, {
10161
+ return await _chunkTWCDSYJNjs.traced.call(void 0, callback, {
9416
10162
  ...baseEvent,
9417
10163
  state: evaluator.state
9418
10164
  });
@@ -9442,7 +10188,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9442
10188
  break;
9443
10189
  }
9444
10190
  scheduledTrials++;
9445
- _optionalChain([progressReporter, 'access', _164 => _164.setTotal, 'optionalCall', _165 => _165(evaluator.evalName, scheduledTrials)]);
10191
+ _optionalChain([progressReporter, 'access', _181 => _181.setTotal, 'optionalCall', _182 => _182(evaluator.evalName, scheduledTrials)]);
9446
10192
  q.pushAsync({ datum, trialIndex }).catch((e) => {
9447
10193
  if (queueErrors.length < 5) {
9448
10194
  queueErrors.push(e);
@@ -9466,7 +10212,7 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9466
10212
  const cancel = async () => {
9467
10213
  await new Promise((_, reject2) => {
9468
10214
  if (cancelled) {
9469
- reject2(new (0, _chunkOBBWQW6Kjs.InternalAbortError)("Evaluator already cancelled"));
10215
+ reject2(new (0, _chunkTWCDSYJNjs.InternalAbortError)("Evaluator already cancelled"));
9470
10216
  return;
9471
10217
  }
9472
10218
  const rejectOnce = (error) => {
@@ -9479,12 +10225,12 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9479
10225
  };
9480
10226
  if (evaluator.timeout) {
9481
10227
  timeoutId = setTimeout(() => {
9482
- rejectOnce(new (0, _chunkOBBWQW6Kjs.InternalAbortError)("Evaluator timed out"));
10228
+ rejectOnce(new (0, _chunkTWCDSYJNjs.InternalAbortError)("Evaluator timed out"));
9483
10229
  }, evaluator.timeout);
9484
10230
  }
9485
10231
  if (evaluator.signal) {
9486
10232
  abortHandler = () => {
9487
- rejectOnce(new (0, _chunkOBBWQW6Kjs.InternalAbortError)("Evaluator aborted"));
10233
+ rejectOnce(new (0, _chunkTWCDSYJNjs.InternalAbortError)("Evaluator aborted"));
9488
10234
  };
9489
10235
  evaluator.signal.addEventListener("abort", abortHandler);
9490
10236
  }
@@ -9507,9 +10253,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9507
10253
  }
9508
10254
  } catch (e) {
9509
10255
  q.kill();
9510
- if (e instanceof _chunkOBBWQW6Kjs.InternalAbortError) {
9511
- if (_chunkBBE7SNRVjs.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
9512
- _chunkOBBWQW6Kjs.debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
10256
+ if (e instanceof _chunkTWCDSYJNjs.InternalAbortError) {
10257
+ if (_chunk2XDW3UCGjs.isomorph_default.getEnv("BRAINTRUST_VERBOSE")) {
10258
+ _chunk2XDW3UCGjs.debugLogger.forState(evaluator.state).warn("Evaluator cancelled:", e.message);
9513
10259
  }
9514
10260
  }
9515
10261
  throw e;
@@ -9534,9 +10280,9 @@ async function runEvaluatorInternal(experiment, evaluator, progressReporter, fil
9534
10280
  );
9535
10281
  } finally {
9536
10282
  if (enableCache) {
9537
- const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _166 => _166.spanCache]);
9538
- _optionalChain([spanCache, 'optionalAccess', _167 => _167.dispose, 'call', _168 => _168()]);
9539
- _optionalChain([spanCache, 'optionalAccess', _169 => _169.stop, 'call', _170 => _170()]);
10283
+ const spanCache = _optionalChain([(_nullishCoalesce(evaluator.state, () => ( _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, )))), 'optionalAccess', _183 => _183.spanCache]);
10284
+ _optionalChain([spanCache, 'optionalAccess', _184 => _184.dispose, 'call', _185 => _185()]);
10285
+ _optionalChain([spanCache, 'optionalAccess', _186 => _186.stop, 'call', _187 => _187()]);
9540
10286
  }
9541
10287
  }
9542
10288
  }
@@ -9629,25 +10375,25 @@ var defaultReporter = {
9629
10375
  reportFailures(evaluator, failingResults, { verbose, jsonl });
9630
10376
  }
9631
10377
  if (jsonl) {
9632
- _chunkBBE7SNRVjs.isomorph_default.writeln(JSON.stringify(summary));
10378
+ _chunk2XDW3UCGjs.isomorph_default.writeln(JSON.stringify(summary));
9633
10379
  } else {
9634
- _chunkBBE7SNRVjs.isomorph_default.writeln("Experiment summary");
9635
- _chunkBBE7SNRVjs.isomorph_default.writeln("==================");
10380
+ _chunk2XDW3UCGjs.isomorph_default.writeln("Experiment summary");
10381
+ _chunk2XDW3UCGjs.isomorph_default.writeln("==================");
9636
10382
  if (summary.comparisonExperimentName) {
9637
- _chunkBBE7SNRVjs.isomorph_default.writeln(
10383
+ _chunk2XDW3UCGjs.isomorph_default.writeln(
9638
10384
  `${summary.comparisonExperimentName} (baseline) <- ${summary.experimentName} (comparison)`
9639
10385
  );
9640
- _chunkBBE7SNRVjs.isomorph_default.writeln("");
10386
+ _chunk2XDW3UCGjs.isomorph_default.writeln("");
9641
10387
  }
9642
10388
  const hasScores = Object.keys(summary.scores).length > 0;
9643
10389
  const hasMetrics = Object.keys(_nullishCoalesce(summary.metrics, () => ( {}))).length > 0;
9644
10390
  const hasComparison = !!summary.comparisonExperimentName;
9645
10391
  if (hasScores || hasMetrics) {
9646
10392
  if (hasComparison) {
9647
- _chunkBBE7SNRVjs.isomorph_default.writeln(
10393
+ _chunk2XDW3UCGjs.isomorph_default.writeln(
9648
10394
  "Name Value Change Improvements Regressions"
9649
10395
  );
9650
- _chunkBBE7SNRVjs.isomorph_default.writeln(
10396
+ _chunk2XDW3UCGjs.isomorph_default.writeln(
9651
10397
  "----------------------------------------------------------------"
9652
10398
  );
9653
10399
  }
@@ -9656,18 +10402,18 @@ var defaultReporter = {
9656
10402
  const scoreValue = `${scorePercent}%`;
9657
10403
  if (hasComparison) {
9658
10404
  let diffString = "-";
9659
- if (!_chunkOBBWQW6Kjs.isEmpty.call(void 0, score.diff)) {
10405
+ if (!_chunkTWCDSYJNjs.isEmpty.call(void 0, score.diff)) {
9660
10406
  const diffPercent = (score.diff * 100).toFixed(2);
9661
10407
  const diffSign = score.diff > 0 ? "+" : "";
9662
10408
  diffString = `${diffSign}${diffPercent}%`;
9663
10409
  }
9664
10410
  const improvements = score.improvements > 0 ? score.improvements.toString() : "-";
9665
10411
  const regressions = score.regressions > 0 ? score.regressions.toString() : "-";
9666
- _chunkBBE7SNRVjs.isomorph_default.writeln(
10412
+ _chunk2XDW3UCGjs.isomorph_default.writeln(
9667
10413
  `${score.name.padEnd(18)} ${scoreValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
9668
10414
  );
9669
10415
  } else {
9670
- _chunkBBE7SNRVjs.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
10416
+ _chunk2XDW3UCGjs.isomorph_default.writeln(`${score.name.padEnd(20)} ${scoreValue.padStart(15)}`);
9671
10417
  }
9672
10418
  }
9673
10419
  for (const metric of Object.values(_nullishCoalesce(summary.metrics, () => ( {})))) {
@@ -9676,30 +10422,30 @@ var defaultReporter = {
9676
10422
  const metricValue = metric.unit === "$" ? `${metric.unit}${formattedValue}` : `${formattedValue}${metric.unit}`;
9677
10423
  if (hasComparison) {
9678
10424
  let diffString = "-";
9679
- if (!_chunkOBBWQW6Kjs.isEmpty.call(void 0, metric.diff)) {
10425
+ if (!_chunkTWCDSYJNjs.isEmpty.call(void 0, metric.diff)) {
9680
10426
  const diffPercent = (metric.diff * 100).toFixed(2);
9681
10427
  const diffSign = metric.diff > 0 ? "+" : "";
9682
10428
  diffString = `${diffSign}${diffPercent}%`;
9683
10429
  }
9684
10430
  const improvements = metric.improvements > 0 ? metric.improvements.toString() : "-";
9685
10431
  const regressions = metric.regressions > 0 ? metric.regressions.toString() : "-";
9686
- _chunkBBE7SNRVjs.isomorph_default.writeln(
10432
+ _chunk2XDW3UCGjs.isomorph_default.writeln(
9687
10433
  `${metric.name.padEnd(18)} ${metricValue.padStart(10)} ${diffString.padStart(10)} ${improvements.padStart(12)} ${regressions.padStart(11)}`
9688
10434
  );
9689
10435
  } else {
9690
- _chunkBBE7SNRVjs.isomorph_default.writeln(
10436
+ _chunk2XDW3UCGjs.isomorph_default.writeln(
9691
10437
  `${metric.name.padEnd(20)} ${metricValue.padStart(15)}`
9692
10438
  );
9693
10439
  }
9694
10440
  }
9695
10441
  }
9696
10442
  if (summary.experimentUrl) {
9697
- _chunkBBE7SNRVjs.isomorph_default.writeln("");
9698
- _chunkBBE7SNRVjs.isomorph_default.writeln(`View results for ${summary.experimentName}`);
9699
- _chunkBBE7SNRVjs.isomorph_default.writeln(`See results at ${summary.experimentUrl}`);
10443
+ _chunk2XDW3UCGjs.isomorph_default.writeln("");
10444
+ _chunk2XDW3UCGjs.isomorph_default.writeln(`View results for ${summary.experimentName}`);
10445
+ _chunk2XDW3UCGjs.isomorph_default.writeln(`See results at ${summary.experimentUrl}`);
9700
10446
  }
9701
10447
  }
9702
- _chunkBBE7SNRVjs.isomorph_default.writeln("");
10448
+ _chunk2XDW3UCGjs.isomorph_default.writeln("");
9703
10449
  return failingResults.length === 0;
9704
10450
  },
9705
10451
  async reportRun(evalReports) {
@@ -9713,10 +10459,10 @@ var decoder = new TextDecoder();
9713
10459
  var BATCH_TASK_KIND = "braintrust.durable.batch-task";
9714
10460
  var BATCH_SCORER_KIND = "braintrust.durable.batch-scorer";
9715
10461
  var DEFAULT_BATCH_SIZE = 1e3;
9716
- var DurableEvalMemoryStore = (_class7 = class {constructor() { _class7.prototype.__init16.call(this); }
9717
- __init16() {this.values = /* @__PURE__ */ new Map()}
10462
+ var DurableEvalMemoryStore = (_class8 = class {constructor() { _class8.prototype.__init21.call(this); }
10463
+ __init21() {this.values = /* @__PURE__ */ new Map()}
9718
10464
  async read(key) {
9719
- return _optionalChain([this, 'access', _171 => _171.values, 'access', _172 => _172.get, 'call', _173 => _173(key), 'optionalAccess', _174 => _174.slice, 'call', _175 => _175()]);
10465
+ return _optionalChain([this, 'access', _188 => _188.values, 'access', _189 => _189.get, 'call', _190 => _190(key), 'optionalAccess', _191 => _191.slice, 'call', _192 => _192()]);
9720
10466
  }
9721
10467
  async write(key, value) {
9722
10468
  this.values.set(key, value.slice());
@@ -9727,7 +10473,7 @@ var DurableEvalMemoryStore = (_class7 = class {constructor() { _class7.prototype
9727
10473
  this.values.set(key, value.slice());
9728
10474
  return { value: value.slice(), created: true };
9729
10475
  }
9730
- }, _class7);
10476
+ }, _class8);
9731
10477
  var DurableEvalRedisStore = class {
9732
10478
 
9733
10479
 
@@ -9746,13 +10492,13 @@ var DurableEvalRedisStore = class {
9746
10492
  if (typeof value !== "string") {
9747
10493
  throw new Error("DurableEvalRedisStore expected GET to return a string");
9748
10494
  }
9749
- return _chunkOBBWQW6Kjs.base64ToUint8Array.call(void 0, value);
10495
+ return _chunkTWCDSYJNjs.base64ToUint8Array.call(void 0, value);
9750
10496
  }
9751
10497
  async write(key, value) {
9752
10498
  const client = this.client;
9753
10499
  const set = client.set;
9754
10500
  const redisKey = `${this.keyPrefix}${key}`;
9755
- const encoded = _chunkOBBWQW6Kjs.uint8ArrayToBase64.call(void 0, value);
10501
+ const encoded = _chunkTWCDSYJNjs.uint8ArrayToBase64.call(void 0, value);
9756
10502
  if (typeof client.defineCommand === "function") {
9757
10503
  await set.call(client, redisKey, encoded, "PX", this.ttlMs);
9758
10504
  } else if (typeof client.sendCommand === "function") {
@@ -9767,7 +10513,7 @@ var DurableEvalRedisStore = class {
9767
10513
  }
9768
10514
  async getOrSet(key, value) {
9769
10515
  const redisKey = `${this.keyPrefix}${key}`;
9770
- const encoded = _chunkOBBWQW6Kjs.uint8ArrayToBase64.call(void 0, value);
10516
+ const encoded = _chunkTWCDSYJNjs.uint8ArrayToBase64.call(void 0, value);
9771
10517
  const client = this.client;
9772
10518
  const set = client.set;
9773
10519
  let setOptions;
@@ -9789,25 +10535,25 @@ var DurableEvalRedisStore = class {
9789
10535
  "DurableEvalRedisStore expected atomic SET to return a string or null"
9790
10536
  );
9791
10537
  }
9792
- return { value: _chunkOBBWQW6Kjs.base64ToUint8Array.call(void 0, existing), created: false };
10538
+ return { value: _chunkTWCDSYJNjs.base64ToUint8Array.call(void 0, existing), created: false };
9793
10539
  }
9794
10540
  };
9795
- var BatchTask = (_class8 = class {
9796
- constructor(processor) {;_class8.prototype.__init17.call(this);
10541
+ var BatchTask = (_class9 = class {
10542
+ constructor(processor) {;_class9.prototype.__init22.call(this);
9797
10543
  this.processor = processor;
9798
10544
  }
9799
10545
 
9800
- __init17() {this.kind = BATCH_TASK_KIND}
9801
- }, _class8);
9802
- var BatchScorer = (_class9 = class {
9803
- constructor(processor) {;_class9.prototype.__init18.call(this);
10546
+ __init22() {this.kind = BATCH_TASK_KIND}
10547
+ }, _class9);
10548
+ var BatchScorer = (_class10 = class {
10549
+ constructor(processor) {;_class10.prototype.__init23.call(this);
9804
10550
  this.processor = processor;
9805
10551
  this.name = processor.name;
9806
10552
  }
9807
10553
 
9808
- __init18() {this.kind = BATCH_SCORER_KIND}
10554
+ __init23() {this.kind = BATCH_SCORER_KIND}
9809
10555
 
9810
- }, _class9);
10556
+ }, _class10);
9811
10557
  function defineDurableEval(projectName, evaluator) {
9812
10558
  const definition = {
9813
10559
  projectName,
@@ -9823,7 +10569,7 @@ function defineDurableEval(projectName, evaluator) {
9823
10569
  }
9824
10570
  async function startDurableEval(definition, options) {
9825
10571
  const store = definition.evaluator.store;
9826
- const runId = _chunkOBBWQW6Kjs.newId.call(void 0, );
10572
+ const runId = _chunkTWCDSYJNjs.newId.call(void 0, );
9827
10573
  const key = runKey(definition.projectName, definition.evalName, runId);
9828
10574
  const { data } = callEvaluatorData(definition.evaluator.data);
9829
10575
  const parameters = await validateParameters(
@@ -9871,7 +10617,7 @@ async function startDurableEval(definition, options) {
9871
10617
  cases: [],
9872
10618
  batches: []
9873
10619
  };
9874
- await _optionalChain([experiment, 'optionalAccess', _176 => _176.flush, 'call', _177 => _177()]);
10620
+ await _optionalChain([experiment, 'optionalAccess', _193 => _193.flush, 'call', _194 => _194()]);
9875
10621
  await writeRunRecord(store, key, state2);
9876
10622
  return currentStatus(definition, state2);
9877
10623
  }
@@ -10036,9 +10782,9 @@ function currentStatus(definition, state) {
10036
10782
  return { status: "waiting", runId: state.runId, pending };
10037
10783
  }
10038
10784
  async function startCaseRoot(definition, state, record, experiment) {
10039
- if (!experiment) return _chunkOBBWQW6Kjs.NOOP_SPAN;
10785
+ if (!experiment) return _chunkTWCDSYJNjs.NOOP_SPAN;
10040
10786
  const datum = record.datum;
10041
- return _chunkOBBWQW6Kjs._internalStartSpanWithInitialMerge.call(void 0, {
10787
+ return _chunkTWCDSYJNjs._internalStartSpanWithInitialMerge.call(void 0, {
10042
10788
  ...definition.evaluator.state ? { state: definition.evaluator.state } : {},
10043
10789
  parent: await experiment.export(),
10044
10790
  name: "eval",
@@ -10104,7 +10850,7 @@ async function logTaskResult(definition, state, record, experiment, task) {
10104
10850
  record.rootSpan = await root.export();
10105
10851
  record.taskLogged = true;
10106
10852
  } catch (error) {
10107
- _chunkOBBWQW6Kjs.logError.call(void 0, root, error);
10853
+ _chunkTWCDSYJNjs.logError.call(void 0, root, error);
10108
10854
  throw error;
10109
10855
  } finally {
10110
10856
  root.end();
@@ -10119,7 +10865,7 @@ async function logCompletedTasks(definition, state, store, key, experiment) {
10119
10865
  changed.push(record);
10120
10866
  }
10121
10867
  if (changed.length > 0) {
10122
- await _optionalChain([experiment, 'optionalAccess', _178 => _178.flush, 'call', _179 => _179()]);
10868
+ await _optionalChain([experiment, 'optionalAccess', _195 => _195.flush, 'call', _196 => _196()]);
10123
10869
  await writeCaseRecords(store, key, changed);
10124
10870
  }
10125
10871
  }
@@ -10137,7 +10883,7 @@ async function runTaskStage(definition, state, store, key, experiment) {
10137
10883
  changed.push(record);
10138
10884
  }
10139
10885
  if (changed.length > 0) {
10140
- await _optionalChain([experiment, 'optionalAccess', _180 => _180.flush, 'call', _181 => _181()]);
10886
+ await _optionalChain([experiment, 'optionalAccess', _197 => _197.flush, 'call', _198 => _198()]);
10141
10887
  await writeCaseRecords(store, key, changed);
10142
10888
  }
10143
10889
  }
@@ -10146,7 +10892,7 @@ async function runScoreStages(definition, state, store, key, experiment) {
10146
10892
  const changed = /* @__PURE__ */ new Map();
10147
10893
  const persistChangedCases = async () => {
10148
10894
  if (changed.size === 0) return;
10149
- await _optionalChain([experiment, 'optionalAccess', _182 => _182.flush, 'call', _183 => _183()]);
10895
+ await _optionalChain([experiment, 'optionalAccess', _199 => _199.flush, 'call', _200 => _200()]);
10150
10896
  await writeCaseRecords(store, key, [...changed.values()]);
10151
10897
  changed.clear();
10152
10898
  };
@@ -10214,11 +10960,11 @@ function scorerArgs(record) {
10214
10960
  };
10215
10961
  }
10216
10962
  function resumeCaseRoot(definition, record, experiment) {
10217
- if (!experiment) return _chunkOBBWQW6Kjs.NOOP_SPAN;
10963
+ if (!experiment) return _chunkTWCDSYJNjs.NOOP_SPAN;
10218
10964
  if (!record.rootSpan) {
10219
10965
  throw new Error(`Durable eval case ${record.caseId} has no root span`);
10220
10966
  }
10221
- return _chunkOBBWQW6Kjs._internalResumeSpan.call(void 0, {
10967
+ return _chunkTWCDSYJNjs._internalResumeSpan.call(void 0, {
10222
10968
  exported: record.rootSpan,
10223
10969
  state: definition.evaluator.state
10224
10970
  });
@@ -10250,14 +10996,14 @@ async function evaluateAndLogScore(definition, state, record, name, experiment,
10250
10996
  type: "score" /* SCORE */,
10251
10997
  purpose: "scorer"
10252
10998
  },
10253
- propagatedEvent: _chunkOBBWQW6Kjs.makeScorerPropagatedEvent.call(void 0, rootExport || void 0),
10999
+ propagatedEvent: _chunkTWCDSYJNjs.makeScorerPropagatedEvent.call(void 0, rootExport || void 0),
10254
11000
  event: { input: scorerArgs(record) }
10255
11001
  }
10256
11002
  );
10257
11003
  if (prepared.scores) root.log({ scores: prepared.scores });
10258
11004
  record.loggedScores[name] = true;
10259
11005
  } catch (error) {
10260
- _chunkOBBWQW6Kjs.logError.call(void 0, root, error);
11006
+ _chunkTWCDSYJNjs.logError.call(void 0, root, error);
10261
11007
  throw error;
10262
11008
  } finally {
10263
11009
  root.end();
@@ -10289,7 +11035,7 @@ async function evaluateAndLogClassification(definition, state, record, name, cla
10289
11035
  type: "classifier" /* CLASSIFIER */,
10290
11036
  purpose: "scorer"
10291
11037
  },
10292
- propagatedEvent: _chunkOBBWQW6Kjs.makeScorerPropagatedEvent.call(void 0, rootExport || void 0),
11038
+ propagatedEvent: _chunkTWCDSYJNjs.makeScorerPropagatedEvent.call(void 0, rootExport || void 0),
10293
11039
  event: { input: scorerArgs(record) }
10294
11040
  }
10295
11041
  );
@@ -10298,7 +11044,7 @@ async function evaluateAndLogClassification(definition, state, record, name, cla
10298
11044
  }
10299
11045
  record.loggedClassifications[name] = true;
10300
11046
  } catch (error) {
10301
- _chunkOBBWQW6Kjs.logError.call(void 0, root, error);
11047
+ _chunkTWCDSYJNjs.logError.call(void 0, root, error);
10302
11048
  throw error;
10303
11049
  } finally {
10304
11050
  root.end();
@@ -10411,9 +11157,9 @@ function processorForStage(definition, kind, scorerName2) {
10411
11157
  }
10412
11158
  return definition.evaluator.task.processor;
10413
11159
  }
10414
- const scorer = _optionalChain([resolveScorers, 'call', _184 => _184(_nullishCoalesce(definition.evaluator.scores, () => ( []))), 'access', _185 => _185.find, 'call', _186 => _186(
11160
+ const scorer = _optionalChain([resolveScorers, 'call', _201 => _201(_nullishCoalesce(definition.evaluator.scores, () => ( []))), 'access', _202 => _202.find, 'call', _203 => _203(
10415
11161
  ({ name }) => name === scorerName2
10416
- ), 'optionalAccess', _187 => _187.scorer]);
11162
+ ), 'optionalAccess', _204 => _204.scorer]);
10417
11163
  if (!isBatchScorer(scorer)) {
10418
11164
  throw new Error(`Definition no longer contains scorer ${scorerName2}`);
10419
11165
  }
@@ -10540,7 +11286,7 @@ async function finishExperiment(definition, state, experiment) {
10540
11286
  if (!comparisonExperimentId) {
10541
11287
  try {
10542
11288
  comparisonExperimentId = await experiment._getBaseExperimentId();
10543
- } catch (e11) {
11289
+ } catch (e14) {
10544
11290
  comparisonExperimentId = void 0;
10545
11291
  }
10546
11292
  }
@@ -10559,7 +11305,7 @@ function runKey(projectName, evalName, runId) {
10559
11305
  return `durable-eval/v1/runs/${contentVersion(encoder.encode(`${projectName}\0${evalName}\0${runId}`))}`;
10560
11306
  }
10561
11307
  function encodedKeyPart(value) {
10562
- return _chunkOBBWQW6Kjs.uint8ArrayToBase64.call(void 0, encoder.encode(value)).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
11308
+ return _chunkTWCDSYJNjs.uint8ArrayToBase64.call(void 0, encoder.encode(value)).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
10563
11309
  }
10564
11310
  function caseRecordKey(key, caseId, kind, ...names) {
10565
11311
  const suffix = names.map(encodedKeyPart).join("/");
@@ -10683,12 +11429,12 @@ async function readCaseRecord(definition, store, key, id) {
10683
11429
  }
10684
11430
  return {
10685
11431
  ...base,
10686
- metadata: _nullishCoalesce(_optionalChain([task, 'optionalAccess', _188 => _188.metadata]), () => ( base.metadata)),
11432
+ metadata: _nullishCoalesce(_optionalChain([task, 'optionalAccess', _205 => _205.metadata]), () => ( base.metadata)),
10687
11433
  tags: task ? task.tags : base.tags,
10688
11434
  taskComplete: task !== void 0,
10689
11435
  taskLogged: taskLog !== void 0,
10690
- output: _optionalChain([task, 'optionalAccess', _189 => _189.output]),
10691
- rootSpan: _optionalChain([taskLog, 'optionalAccess', _190 => _190.rootSpan]),
11436
+ output: _optionalChain([task, 'optionalAccess', _206 => _206.output]),
11437
+ rootSpan: _optionalChain([taskLog, 'optionalAccess', _207 => _207.rootSpan]),
10692
11438
  scores,
10693
11439
  loggedScores,
10694
11440
  classifications,
@@ -10804,7 +11550,7 @@ function deterministicId(value) {
10804
11550
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-5${hex.slice(13, 16)}-a${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
10805
11551
  }
10806
11552
  function contentVersion(value) {
10807
- if (_chunkBBE7SNRVjs.isomorph_default.hash) return _chunkBBE7SNRVjs.isomorph_default.hash(decoder.decode(value));
11553
+ if (_chunk2XDW3UCGjs.isomorph_default.hash) return _chunk2XDW3UCGjs.isomorph_default.hash(decoder.decode(value));
10808
11554
  let hash = 2166136261;
10809
11555
  for (const byte of value) {
10810
11556
  hash ^= byte;
@@ -10869,7 +11615,7 @@ function agentAssertionScorer(callback, options = {}) {
10869
11615
  });
10870
11616
  const resources = {};
10871
11617
  if (assertions.some((assertion) => assertion.requiresTrace)) {
10872
- resources.spans = await _optionalChain([args, 'access', _191 => _191.trace, 'optionalAccess', _192 => _192.getSpans, 'call', _193 => _193({ spanType: ["tool"] })]);
11618
+ resources.spans = await _optionalChain([args, 'access', _208 => _208.trace, 'optionalAccess', _209 => _209.getSpans, 'call', _210 => _210({ spanType: ["tool"] })]);
10873
11619
  }
10874
11620
  const results = await Promise.all(
10875
11621
  assertions.map(async (assertion) => {
@@ -11027,7 +11773,7 @@ async function validateSchema(schema, value) {
11027
11773
  }
11028
11774
  }
11029
11775
  function toolCalls(spans) {
11030
- return spans.filter((span) => _optionalChain([span, 'access', _194 => _194.span_attributes, 'optionalAccess', _195 => _195.type]) === "tool");
11776
+ return spans.filter((span) => _optionalChain([span, 'access', _211 => _211.span_attributes, 'optionalAccess', _212 => _212.type]) === "tool");
11031
11777
  }
11032
11778
  function matchingToolCalls(spans, toolName, options) {
11033
11779
  return toolCalls(spans).filter((span) => {
@@ -11045,17 +11791,17 @@ function matchingToolCalls(spans, toolName, options) {
11045
11791
  });
11046
11792
  }
11047
11793
  function getToolName(span) {
11048
- const spanName = [_optionalChain([span, 'access', _196 => _196.span_attributes, 'optionalAccess', _197 => _197.name]), span.name].map(normalizeToolName).find((value) => value !== void 0);
11049
- if (_optionalChain([spanName, 'optionalAccess', _198 => _198.includes, 'call', _199 => _199("/")])) {
11794
+ const spanName = [_optionalChain([span, 'access', _213 => _213.span_attributes, 'optionalAccess', _214 => _214.name]), span.name].map(normalizeToolName).find((value) => value !== void 0);
11795
+ if (_optionalChain([spanName, 'optionalAccess', _215 => _215.includes, 'call', _216 => _216("/")])) {
11050
11796
  return spanName;
11051
11797
  }
11052
11798
  const metadataName = [
11053
- _optionalChain([span, 'access', _200 => _200.metadata, 'optionalAccess', _201 => _201.tool_name]),
11054
- _optionalChain([span, 'access', _202 => _202.metadata, 'optionalAccess', _203 => _203["gen_ai.tool.name"]])
11799
+ _optionalChain([span, 'access', _217 => _217.metadata, 'optionalAccess', _218 => _218.tool_name]),
11800
+ _optionalChain([span, 'access', _219 => _219.metadata, 'optionalAccess', _220 => _220["gen_ai.tool.name"]])
11055
11801
  ].map(normalizeToolName).find((value) => value !== void 0);
11056
11802
  const mcpServer = [
11057
- _optionalChain([span, 'access', _204 => _204.metadata, 'optionalAccess', _205 => _205["mcp.server"]]),
11058
- _optionalChain([span, 'access', _206 => _206.metadata, 'optionalAccess', _207 => _207["openai_codex.mcp.server"]])
11803
+ _optionalChain([span, 'access', _221 => _221.metadata, 'optionalAccess', _222 => _222["mcp.server"]]),
11804
+ _optionalChain([span, 'access', _223 => _223.metadata, 'optionalAccess', _224 => _224["openai_codex.mcp.server"]])
11059
11805
  ].find((value) => typeof value === "string" && value !== "");
11060
11806
  if (metadataName && mcpServer) {
11061
11807
  return `${mcpServer}/${metadataName}`;
@@ -11125,7 +11871,7 @@ function formatValue(value) {
11125
11871
  return serialized;
11126
11872
  }
11127
11873
  return formatValueWithUndefined(value, /* @__PURE__ */ new Set());
11128
- } catch (e12) {
11874
+ } catch (e15) {
11129
11875
  return String(value);
11130
11876
  }
11131
11877
  }
@@ -11238,7 +11984,7 @@ var ProjectBuilder = class {
11238
11984
  }
11239
11985
  };
11240
11986
  var projects = new ProjectBuilder();
11241
- var Project2 = (_class10 = class {
11987
+ var Project2 = (_class11 = class {
11242
11988
 
11243
11989
 
11244
11990
 
@@ -11246,10 +11992,10 @@ var Project2 = (_class10 = class {
11246
11992
 
11247
11993
 
11248
11994
 
11249
- __init19() {this._publishableCodeFunctions = []}
11250
- __init20() {this._publishablePrompts = []}
11251
- __init21() {this._publishableParameters = []}
11252
- constructor(args) {;_class10.prototype.__init19.call(this);_class10.prototype.__init20.call(this);_class10.prototype.__init21.call(this);
11995
+ __init24() {this._publishableCodeFunctions = []}
11996
+ __init25() {this._publishablePrompts = []}
11997
+ __init26() {this._publishableParameters = []}
11998
+ constructor(args) {;_class11.prototype.__init24.call(this);_class11.prototype.__init25.call(this);_class11.prototype.__init26.call(this);
11253
11999
  _initializeSpanContext();
11254
12000
  this.name = "name" in args ? args.name : void 0;
11255
12001
  this.id = "id" in args ? args.id : void 0;
@@ -11284,7 +12030,7 @@ var Project2 = (_class10 = class {
11284
12030
  console.warn("publish() is a no-op when running `braintrust push`.");
11285
12031
  return;
11286
12032
  }
11287
- await _chunkOBBWQW6Kjs.login.call(void 0, );
12033
+ await _chunkTWCDSYJNjs.login.call(void 0, );
11288
12034
  const projectMap = new ProjectNameIdMap();
11289
12035
  const functionDefinitions = [];
11290
12036
  if (this._publishableCodeFunctions.length > 0) {
@@ -11298,17 +12044,17 @@ var Project2 = (_class10 = class {
11298
12044
  functionDefinitions.push(functionDefinition);
11299
12045
  }
11300
12046
  }
11301
- await _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, ).apiConn().post_json("insert-functions", {
12047
+ await _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, ).apiConn().post_json("insert-functions", {
11302
12048
  functions: functionDefinitions
11303
12049
  });
11304
12050
  }
11305
- }, _class10);
11306
- var ToolBuilder = (_class11 = class {
11307
- constructor(project) {;_class11.prototype.__init22.call(this);
12051
+ }, _class11);
12052
+ var ToolBuilder = (_class12 = class {
12053
+ constructor(project) {;_class12.prototype.__init27.call(this);
11308
12054
  this.project = project;
11309
12055
  }
11310
12056
 
11311
- __init22() {this.taskCounter = 0}
12057
+ __init27() {this.taskCounter = 0}
11312
12058
  // This type definition is just a catch all so that the implementation can be
11313
12059
  // less specific than the two more specific declarations above.
11314
12060
  create(opts) {
@@ -11317,12 +12063,12 @@ var ToolBuilder = (_class11 = class {
11317
12063
  const { handler, name, slug, parameters, returns, ...rest } = opts;
11318
12064
  let resolvedName = _nullishCoalesce(name, () => ( handler.name));
11319
12065
  if (resolvedName.trim().length === 0) {
11320
- resolvedName = `Tool ${_chunkBBE7SNRVjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
12066
+ resolvedName = `Tool ${_chunk2XDW3UCGjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
11321
12067
  }
11322
12068
  const tool = new CodeFunction(this.project, {
11323
12069
  handler,
11324
12070
  name: resolvedName,
11325
- slug: _nullishCoalesce(slug, () => ( _chunkOBBWQW6Kjs.slugify.call(void 0, resolvedName, { lower: true, strict: true }))),
12071
+ slug: _nullishCoalesce(slug, () => ( _chunkTWCDSYJNjs.slugify.call(void 0, resolvedName, { lower: true, strict: true }))),
11326
12072
  type: "tool",
11327
12073
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/consistent-type-assertions
11328
12074
  parameters,
@@ -11333,13 +12079,13 @@ var ToolBuilder = (_class11 = class {
11333
12079
  this.project.addCodeFunction(tool);
11334
12080
  return tool;
11335
12081
  }
11336
- }, _class11);
11337
- var ScorerBuilder = (_class12 = class {
11338
- constructor(project) {;_class12.prototype.__init23.call(this);
12082
+ }, _class12);
12083
+ var ScorerBuilder = (_class13 = class {
12084
+ constructor(project) {;_class13.prototype.__init28.call(this);
11339
12085
  this.project = project;
11340
12086
  }
11341
12087
 
11342
- __init23() {this.taskCounter = 0}
12088
+ __init28() {this.taskCounter = 0}
11343
12089
  create(opts) {
11344
12090
  this.taskCounter++;
11345
12091
  let resolvedName = opts.name;
@@ -11347,9 +12093,9 @@ var ScorerBuilder = (_class12 = class {
11347
12093
  resolvedName = opts.handler.name;
11348
12094
  }
11349
12095
  if (!resolvedName || resolvedName.trim().length === 0) {
11350
- resolvedName = `Scorer ${_chunkBBE7SNRVjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
12096
+ resolvedName = `Scorer ${_chunk2XDW3UCGjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
11351
12097
  }
11352
- const slug = _nullishCoalesce(opts.slug, () => ( _chunkOBBWQW6Kjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
12098
+ const slug = _nullishCoalesce(opts.slug, () => ( _chunkTWCDSYJNjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
11353
12099
  if ("handler" in opts) {
11354
12100
  const scorer = new CodeFunction(this.project, {
11355
12101
  ...opts,
@@ -11393,20 +12139,20 @@ var ScorerBuilder = (_class12 = class {
11393
12139
  this.project.addPrompt(codePrompt);
11394
12140
  }
11395
12141
  }
11396
- }, _class12);
11397
- var ClassifierBuilder = (_class13 = class {
11398
- constructor(project) {;_class13.prototype.__init24.call(this);
12142
+ }, _class13);
12143
+ var ClassifierBuilder = (_class14 = class {
12144
+ constructor(project) {;_class14.prototype.__init29.call(this);
11399
12145
  this.project = project;
11400
12146
  }
11401
12147
 
11402
- __init24() {this.taskCounter = 0}
12148
+ __init29() {this.taskCounter = 0}
11403
12149
  create(opts) {
11404
12150
  this.taskCounter++;
11405
12151
  let resolvedName = _nullishCoalesce(opts.name, () => ( opts.handler.name));
11406
12152
  if (!resolvedName || resolvedName.trim().length === 0) {
11407
- resolvedName = `Classifier ${_chunkBBE7SNRVjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
12153
+ resolvedName = `Classifier ${_chunk2XDW3UCGjs.isomorph_default.basename(currentFilename)} ${this.taskCounter}`;
11408
12154
  }
11409
- const slug = _nullishCoalesce(opts.slug, () => ( _chunkOBBWQW6Kjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
12155
+ const slug = _nullishCoalesce(opts.slug, () => ( _chunkTWCDSYJNjs.slugify.call(void 0, resolvedName, { lower: true, strict: true })));
11410
12156
  const classifier = new CodeFunction(this.project, {
11411
12157
  ...opts,
11412
12158
  name: resolvedName,
@@ -11416,7 +12162,7 @@ var ClassifierBuilder = (_class13 = class {
11416
12162
  this.project.addCodeFunction(classifier);
11417
12163
  return classifier;
11418
12164
  }
11419
- }, _class13);
12165
+ }, _class14);
11420
12166
  var CodeFunction = class {
11421
12167
  constructor(project, opts) {
11422
12168
  this.project = project;
@@ -11535,18 +12281,18 @@ var PromptBuilder = class {
11535
12281
  rawTools.push(tool);
11536
12282
  }
11537
12283
  }
11538
- const slug = _nullishCoalesce(opts.slug, () => ( _chunkOBBWQW6Kjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
12284
+ const slug = _nullishCoalesce(opts.slug, () => ( _chunkTWCDSYJNjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
11539
12285
  const promptData = promptDefinitionToPromptData(opts, rawTools);
11540
12286
  const promptRow = {
11541
12287
  id: opts.id,
11542
- _xact_id: opts.version ? _chunkOBBWQW6Kjs.loadPrettyXact.call(void 0, opts.version) : void 0,
12288
+ _xact_id: opts.version ? _chunkTWCDSYJNjs.loadPrettyXact.call(void 0, opts.version) : void 0,
11543
12289
  name: opts.name,
11544
12290
  slug,
11545
12291
  prompt_data: promptData,
11546
12292
  tags: opts.tags,
11547
12293
  ...this.project.id !== void 0 ? { project_id: this.project.id } : {}
11548
12294
  };
11549
- const prompt = new (0, _chunkOBBWQW6Kjs.Prompt)(
12295
+ const prompt = new (0, _chunkTWCDSYJNjs.Prompt)(
11550
12296
  promptRow,
11551
12297
  {},
11552
12298
  // It doesn't make sense to specify defaults here.
@@ -11601,7 +12347,7 @@ var ParametersBuilder = class {
11601
12347
  }
11602
12348
 
11603
12349
  create(opts) {
11604
- const slug = _nullishCoalesce(opts.slug, () => ( _chunkOBBWQW6Kjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
12350
+ const slug = _nullishCoalesce(opts.slug, () => ( _chunkTWCDSYJNjs.slugify.call(void 0, opts.name, { lower: true, strict: true })));
11605
12351
  const codeParameters = new CodeParameters(this.project, {
11606
12352
  name: opts.name,
11607
12353
  slug,
@@ -11640,7 +12386,7 @@ function serializeEvalParameterstoParametersSchema(parameters) {
11640
12386
  required.push(name);
11641
12387
  }
11642
12388
  } else {
11643
- const schemaObj = _chunkOBBWQW6Kjs.zodToJsonSchema.call(void 0, value);
12389
+ const schemaObj = _chunkTWCDSYJNjs.zodToJsonSchema.call(void 0, value);
11644
12390
  properties[name] = schemaObj;
11645
12391
  if (!("default" in schemaObj)) {
11646
12392
  required.push(name);
@@ -11664,16 +12410,16 @@ function getDefaultDataFromParametersSchema(schema) {
11664
12410
  })
11665
12411
  );
11666
12412
  }
11667
- var ProjectNameIdMap = (_class14 = class {constructor() { _class14.prototype.__init25.call(this);_class14.prototype.__init26.call(this); }
11668
- __init25() {this.nameToId = {}}
11669
- __init26() {this.idToName = {}}
12413
+ var ProjectNameIdMap = (_class15 = class {constructor() { _class15.prototype.__init30.call(this);_class15.prototype.__init31.call(this); }
12414
+ __init30() {this.nameToId = {}}
12415
+ __init31() {this.idToName = {}}
11670
12416
  async getId(projectName) {
11671
12417
  if (!(projectName in this.nameToId)) {
11672
- const response = await _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/register", {
12418
+ const response = await _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/register", {
11673
12419
  project_name: projectName
11674
12420
  });
11675
12421
  const result = _v3.z.object({
11676
- project: _chunkOBBWQW6Kjs.Project
12422
+ project: _chunkTWCDSYJNjs.Project
11677
12423
  }).parse(response);
11678
12424
  const projectId = result.project.id;
11679
12425
  this.nameToId[projectName] = projectId;
@@ -11683,10 +12429,10 @@ var ProjectNameIdMap = (_class14 = class {constructor() { _class14.prototype.__i
11683
12429
  }
11684
12430
  async getName(projectId) {
11685
12431
  if (!(projectId in this.idToName)) {
11686
- const response = await _chunkOBBWQW6Kjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/get", {
12432
+ const response = await _chunkTWCDSYJNjs._internalGetGlobalState.call(void 0, ).appConn().post_json("api/project/get", {
11687
12433
  id: projectId
11688
12434
  });
11689
- const result = _v3.z.array(_chunkOBBWQW6Kjs.Project).nonempty().parse(response);
12435
+ const result = _v3.z.array(_chunkTWCDSYJNjs.Project).nonempty().parse(response);
11690
12436
  const projectName = result[0].name;
11691
12437
  this.idToName[projectId] = projectName;
11692
12438
  this.nameToId[projectName] = projectId;
@@ -11699,23 +12445,23 @@ var ProjectNameIdMap = (_class14 = class {constructor() { _class14.prototype.__i
11699
12445
  }
11700
12446
  return this.getId(project.name);
11701
12447
  }
11702
- }, _class14);
12448
+ }, _class15);
11703
12449
 
11704
12450
  // dev/types.ts
11705
12451
 
11706
12452
  var evalBodySchema = _v3.z.object({
11707
12453
  name: _v3.z.string(),
11708
12454
  parameters: _v3.z.record(_v3.z.string(), _v3.z.unknown()).nullish(),
11709
- data: _chunkOBBWQW6Kjs.RunEval.shape.data,
12455
+ data: _chunkTWCDSYJNjs.RunEval.shape.data,
11710
12456
  scores: _v3.z.array(
11711
12457
  _v3.z.object({
11712
- function_id: _chunkOBBWQW6Kjs.FunctionId,
12458
+ function_id: _chunkTWCDSYJNjs.FunctionId,
11713
12459
  name: _v3.z.string()
11714
12460
  })
11715
12461
  ).nullish(),
11716
12462
  experiment_name: _v3.z.string().nullish(),
11717
12463
  project_id: _v3.z.string().nullish(),
11718
- parent: _chunkOBBWQW6Kjs.InvokeParent.optional(),
12464
+ parent: _chunkTWCDSYJNjs.InvokeParent.optional(),
11719
12465
  stream: _v3.z.boolean().optional()
11720
12466
  });
11721
12467
  var staticParametersSchema = _v3.z.record(
@@ -11723,7 +12469,7 @@ var staticParametersSchema = _v3.z.record(
11723
12469
  _v3.z.union([
11724
12470
  _v3.z.object({
11725
12471
  type: _v3.z.literal("prompt"),
11726
- default: _chunkOBBWQW6Kjs.PromptData.optional(),
12472
+ default: _chunkTWCDSYJNjs.PromptData.optional(),
11727
12473
  description: _v3.z.string().optional()
11728
12474
  }),
11729
12475
  _v3.z.object({
@@ -11779,7 +12525,10 @@ var evaluatorDefinitionsSchema = _v3.z.record(
11779
12525
  );
11780
12526
 
11781
12527
  // src/node/index.ts
11782
- _chunkOBBWQW6Kjs.configureNode.call(void 0, );
12528
+ _chunkTWCDSYJNjs.configureNode.call(void 0, );
12529
+
12530
+
12531
+
11783
12532
 
11784
12533
 
11785
12534
 
@@ -11962,4 +12711,4 @@ _chunkOBBWQW6Kjs.configureNode.call(void 0, );
11962
12711
 
11963
12712
 
11964
12713
 
11965
- exports.Attachment = _chunkOBBWQW6Kjs.Attachment; exports.AttachmentReference = _chunkOBBWQW6Kjs.AttachmentReference; exports.BAGGAGE_HEADER = _chunkOBBWQW6Kjs.BAGGAGE_HEADER; exports.BRAINTRUST_CURRENT_SPAN_STORE = _chunkOBBWQW6Kjs.BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = _chunkOBBWQW6Kjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BRAINTRUST_PARENT_KEY = _chunkOBBWQW6Kjs.BRAINTRUST_PARENT_KEY; exports.BaseAttachment = _chunkOBBWQW6Kjs.BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BatchScorer = BatchScorer; exports.BatchTask = BatchTask; exports.BraintrustLangChainCallbackHandler = _chunkOBBWQW6Kjs.BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = _chunkOBBWQW6Kjs.BraintrustObservabilityExporter; exports.BraintrustState = _chunkOBBWQW6Kjs.BraintrustState; exports.BraintrustStream = _chunkOBBWQW6Kjs.BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = _chunkOBBWQW6Kjs.ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = _chunkOBBWQW6Kjs.DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = _chunkOBBWQW6Kjs.DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = _chunkOBBWQW6Kjs.Dataset; exports.DatasetPipeline = DatasetPipeline; exports.DurableEvalMemoryStore = DurableEvalMemoryStore; exports.DurableEvalRedisStore = DurableEvalRedisStore; exports.ERR_PERMALINK = _chunkOBBWQW6Kjs.ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = _chunkOBBWQW6Kjs.Experiment; exports.ExternalAttachment = _chunkOBBWQW6Kjs.ExternalAttachment; exports.FailedHTTPResponse = _chunkOBBWQW6Kjs.FailedHTTPResponse; exports.IDGenerator = _chunkOBBWQW6Kjs.IDGenerator; exports.JSONAttachment = _chunkOBBWQW6Kjs.JSONAttachment; exports.LEGACY_CACHED_HEADER = _chunkOBBWQW6Kjs.LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = _chunkOBBWQW6Kjs.LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = _chunkOBBWQW6Kjs.LazyValue; exports.LocalTrace = LocalTrace; exports.Logger = _chunkOBBWQW6Kjs.Logger; exports.LoginInvalidOrgError = _chunkOBBWQW6Kjs.LoginInvalidOrgError; exports.NOOP_SPAN = _chunkOBBWQW6Kjs.NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = _chunkOBBWQW6Kjs.NOOP_SPAN_PERMALINK; exports.NoopSpan = _chunkOBBWQW6Kjs.NoopSpan; exports.OTELIDGenerator = _chunkOBBWQW6Kjs.OTELIDGenerator; exports.ObjectFetcher = _chunkOBBWQW6Kjs.ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = _chunkOBBWQW6Kjs.Prompt; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = _chunkOBBWQW6Kjs.ReadonlyAttachment; exports.ReadonlyExperiment = _chunkOBBWQW6Kjs.ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = _chunkOBBWQW6Kjs.SpanImpl; exports.TRACEPARENT_HEADER = _chunkOBBWQW6Kjs.TRACEPARENT_HEADER; exports.TRACESTATE_HEADER = _chunkOBBWQW6Kjs.TRACESTATE_HEADER; exports.TestBackgroundLogger = _chunkOBBWQW6Kjs.TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = _chunkOBBWQW6Kjs.UUIDGenerator; exports.X_CACHED_HEADER = _chunkOBBWQW6Kjs.X_CACHED_HEADER; exports._exportsForTestingOnly = _chunkOBBWQW6Kjs._exportsForTestingOnly; exports._internalGetGlobalState = _chunkOBBWQW6Kjs._internalGetGlobalState; exports._internalIso = _chunkBBE7SNRVjs.isomorph_default; exports._internalSetInitialState = _chunkOBBWQW6Kjs._internalSetInitialState; exports.addAzureBlobHeaders = _chunkOBBWQW6Kjs.addAzureBlobHeaders; exports.agentAssertionScorer = agentAssertionScorer; exports.braintrustAISDKTelemetry = _chunkOBBWQW6Kjs.braintrustAISDKTelemetry; exports.braintrustEveHook = braintrustEveHook; exports.braintrustEveInstrumentation = braintrustEveInstrumentation; exports.braintrustFlueInstrumentation = _chunkOBBWQW6Kjs.braintrustFlueInstrumentation; exports.braintrustFlueObserver = _chunkOBBWQW6Kjs.braintrustFlueObserver; exports.braintrustStreamChunkSchema = _chunkOBBWQW6Kjs.braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.collectAnthropicSession = _chunkOBBWQW6Kjs.collectAnthropicSession; exports.configureInstrumentation = _chunkOBBWQW6Kjs.configureInstrumentation; exports.constructLogs3OverflowRequest = _chunkOBBWQW6Kjs.constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = _chunkOBBWQW6Kjs.createFinalValuePassThroughStream; exports.currentExperiment = _chunkOBBWQW6Kjs.currentExperiment; exports.currentLogger = _chunkOBBWQW6Kjs.currentLogger; exports.currentSpan = _chunkOBBWQW6Kjs.currentSpan; exports.deepCopyEvent = _chunkOBBWQW6Kjs.deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.defineDurableEval = defineDurableEval; exports.deserializePlainStringAsJSON = _chunkOBBWQW6Kjs.deserializePlainStringAsJSON; exports.devNullWritableStream = _chunkOBBWQW6Kjs.devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.extractTraceContextFromHeaders = _chunkOBBWQW6Kjs.extractTraceContextFromHeaders; exports.flush = _chunkOBBWQW6Kjs.flush; exports.getContextManager = _chunkOBBWQW6Kjs.getContextManager; exports.getIdGenerator = _chunkOBBWQW6Kjs.getIdGenerator; exports.getPromptVersions = _chunkOBBWQW6Kjs.getPromptVersions; exports.getSpanParentObject = _chunkOBBWQW6Kjs.getSpanParentObject; exports.getTemplateRenderer = _chunkOBBWQW6Kjs.getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = _chunkOBBWQW6Kjs.init; exports.initDataset = _chunkOBBWQW6Kjs.initDataset; exports.initExperiment = _chunkOBBWQW6Kjs.initExperiment; exports.initFunction = initFunction; exports.initLogger = _chunkOBBWQW6Kjs.initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.injectTraceContext = _chunkOBBWQW6Kjs.injectTraceContext; exports.invoke = invoke; exports.isTemplateFormat = _chunkOBBWQW6Kjs.isTemplateFormat; exports.loadParameters = _chunkOBBWQW6Kjs.loadParameters; exports.loadPrompt = _chunkOBBWQW6Kjs.loadPrompt; exports.log = _chunkOBBWQW6Kjs.log; exports.logError = _chunkOBBWQW6Kjs.logError; exports.login = _chunkOBBWQW6Kjs.login; exports.loginToState = _chunkOBBWQW6Kjs.loginToState; exports.logs3OverflowUploadSchema = _chunkOBBWQW6Kjs.logs3OverflowUploadSchema; exports.newId = _chunkOBBWQW6Kjs.newId; exports.parseCachedHeader = _chunkOBBWQW6Kjs.parseCachedHeader; exports.parseTemplateFormat = _chunkOBBWQW6Kjs.parseTemplateFormat; exports.permalink = _chunkOBBWQW6Kjs.permalink; exports.pickLogs3OverflowObjectIds = _chunkOBBWQW6Kjs.pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = _chunkOBBWQW6Kjs.registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = _chunkOBBWQW6Kjs.registerTemplatePlugin; exports.renderMessage = _chunkOBBWQW6Kjs.renderMessage; exports.renderPromptParams = _chunkOBBWQW6Kjs.renderPromptParams; exports.renderTemplateContent = _chunkOBBWQW6Kjs.renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = _chunkOBBWQW6Kjs.setFetch; exports.setMaskingFunction = _chunkOBBWQW6Kjs.setMaskingFunction; exports.spanComponentsToObjectId = _chunkOBBWQW6Kjs.spanComponentsToObjectId; exports.startSpan = _chunkOBBWQW6Kjs.startSpan; exports.summarize = _chunkOBBWQW6Kjs.summarize; exports.templateRegistry = _chunkOBBWQW6Kjs.templateRegistry; exports.toolFunctionDefinitionSchema = _chunkOBBWQW6Kjs.ToolFunctionDefinition; exports.traceable = _chunkOBBWQW6Kjs.traceable; exports.traced = _chunkOBBWQW6Kjs.traced; exports.updateSpan = _chunkOBBWQW6Kjs.updateSpan; exports.uploadLogs3OverflowPayload = _chunkOBBWQW6Kjs.uploadLogs3OverflowPayload; exports.utf8ByteLength = _chunkOBBWQW6Kjs.utf8ByteLength; exports.withCurrent = _chunkOBBWQW6Kjs.withCurrent; exports.withDataset = _chunkOBBWQW6Kjs.withDataset; exports.withExperiment = _chunkOBBWQW6Kjs.withExperiment; exports.withLogger = _chunkOBBWQW6Kjs.withLogger; exports.withParent = _chunkOBBWQW6Kjs.withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapBedrockRuntime = wrapBedrockRuntime; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCloudflareAIChat = wrapCloudflareAIChat; exports.wrapCloudflareAgent = wrapCloudflareAgent; exports.wrapCloudflareThink = wrapCloudflareThink; 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.wrapHuggingFaceTransformers = wrapHuggingFaceTransformers; exports.wrapLangSmithClient = wrapLangSmithClient; exports.wrapLangSmithRunTrees = wrapLangSmithRunTrees; exports.wrapLangSmithTraceable = wrapLangSmithTraceable; exports.wrapMastraAgent = _chunkOBBWQW6Kjs.wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOllama = wrapOllama; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapPiCodingAgentSDK = wrapPiCodingAgentSDK; exports.wrapStrandsAgentSDK = wrapStrandsAgentSDK; exports.wrapTraced = _chunkOBBWQW6Kjs.wrapTraced; exports.wrapVitest = wrapVitest; exports.wrapVoyageAI = wrapVoyageAI;
12714
+ exports.Attachment = _chunkTWCDSYJNjs.Attachment; exports.AttachmentReference = _chunkTWCDSYJNjs.AttachmentReference; exports.BAGGAGE_HEADER = _chunkTWCDSYJNjs.BAGGAGE_HEADER; exports.BRAINTRUST_CURRENT_SPAN_STORE = _chunkTWCDSYJNjs.BRAINTRUST_CURRENT_SPAN_STORE; exports.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME = _chunkTWCDSYJNjs.BRAINTRUST_LANGCHAIN_CALLBACK_HANDLER_NAME; exports.BRAINTRUST_PARENT_KEY = _chunkTWCDSYJNjs.BRAINTRUST_PARENT_KEY; exports.BaseAttachment = _chunkTWCDSYJNjs.BaseAttachment; exports.BaseExperiment = BaseExperiment; exports.BatchScorer = BatchScorer; exports.BatchTask = BatchTask; exports.BraintrustLangChainCallbackHandler = _chunkTWCDSYJNjs.BraintrustLangChainCallbackHandler; exports.BraintrustMiddleware = BraintrustMiddleware; exports.BraintrustObservabilityExporter = _chunkTWCDSYJNjs.BraintrustObservabilityExporter; exports.BraintrustState = _chunkTWCDSYJNjs.BraintrustState; exports.BraintrustStream = _chunkTWCDSYJNjs.BraintrustStream; exports.CachedSpanFetcher = CachedSpanFetcher; exports.CodeFunction = CodeFunction; exports.CodePrompt = CodePrompt; exports.ContextManager = _chunkTWCDSYJNjs.ContextManager; exports.DEFAULT_FETCH_BATCH_SIZE = _chunkTWCDSYJNjs.DEFAULT_FETCH_BATCH_SIZE; exports.DEFAULT_MAX_REQUEST_SIZE = _chunkTWCDSYJNjs.DEFAULT_MAX_REQUEST_SIZE; exports.Dataset = _chunkTWCDSYJNjs.Dataset; exports.DatasetPipeline = DatasetPipeline; exports.DurableEvalMemoryStore = DurableEvalMemoryStore; exports.DurableEvalRedisStore = DurableEvalRedisStore; exports.ERR_PERMALINK = _chunkTWCDSYJNjs.ERR_PERMALINK; exports.Eval = Eval; exports.EvalResultWithSummary = EvalResultWithSummary; exports.Experiment = _chunkTWCDSYJNjs.Experiment; exports.ExternalAttachment = _chunkTWCDSYJNjs.ExternalAttachment; exports.FailedHTTPResponse = _chunkTWCDSYJNjs.FailedHTTPResponse; exports.IDGenerator = _chunkTWCDSYJNjs.IDGenerator; exports.JSONAttachment = _chunkTWCDSYJNjs.JSONAttachment; exports.LEGACY_CACHED_HEADER = _chunkTWCDSYJNjs.LEGACY_CACHED_HEADER; exports.LOGS3_OVERFLOW_REFERENCE_TYPE = _chunkTWCDSYJNjs.LOGS3_OVERFLOW_REFERENCE_TYPE; exports.LazyValue = _chunkTWCDSYJNjs.LazyValue; exports.LocalTrace = LocalTrace; exports.Logger = _chunkTWCDSYJNjs.Logger; exports.LoginInvalidOrgError = _chunkTWCDSYJNjs.LoginInvalidOrgError; exports.NOOP_SPAN = _chunkTWCDSYJNjs.NOOP_SPAN; exports.NOOP_SPAN_PERMALINK = _chunkTWCDSYJNjs.NOOP_SPAN_PERMALINK; exports.NoopSpan = _chunkTWCDSYJNjs.NoopSpan; exports.OTELIDGenerator = _chunkTWCDSYJNjs.OTELIDGenerator; exports.ObjectFetcher = _chunkTWCDSYJNjs.ObjectFetcher; exports.Project = Project2; exports.ProjectNameIdMap = ProjectNameIdMap; exports.Prompt = _chunkTWCDSYJNjs.Prompt; exports.PromptBuilder = PromptBuilder; exports.ReadonlyAttachment = _chunkTWCDSYJNjs.ReadonlyAttachment; exports.ReadonlyExperiment = _chunkTWCDSYJNjs.ReadonlyExperiment; exports.Reporter = Reporter; exports.ScorerBuilder = ScorerBuilder; exports.SpanFetcher = SpanFetcher; exports.SpanImpl = _chunkTWCDSYJNjs.SpanImpl; exports.TRACEPARENT_HEADER = _chunkTWCDSYJNjs.TRACEPARENT_HEADER; exports.TRACESTATE_HEADER = _chunkTWCDSYJNjs.TRACESTATE_HEADER; exports.TestBackgroundLogger = _chunkTWCDSYJNjs.TestBackgroundLogger; exports.ToolBuilder = ToolBuilder; exports.UUIDGenerator = _chunkTWCDSYJNjs.UUIDGenerator; exports.X_CACHED_HEADER = _chunkTWCDSYJNjs.X_CACHED_HEADER; exports._exportsForTestingOnly = _chunkTWCDSYJNjs._exportsForTestingOnly; exports._internalGetGlobalState = _chunkTWCDSYJNjs._internalGetGlobalState; exports._internalIso = _chunk2XDW3UCGjs.isomorph_default; exports._internalSetInitialState = _chunkTWCDSYJNjs._internalSetInitialState; exports.addAzureBlobHeaders = _chunkTWCDSYJNjs.addAzureBlobHeaders; exports.agentAssertionScorer = agentAssertionScorer; exports.braintrustAISDKTelemetry = _chunkTWCDSYJNjs.braintrustAISDKTelemetry; exports.braintrustEveHook = braintrustEveHook; exports.braintrustEveInstrumentation = braintrustEveInstrumentation; exports.braintrustFlueInstrumentation = _chunkTWCDSYJNjs.braintrustFlueInstrumentation; exports.braintrustFlueObserver = _chunkTWCDSYJNjs.braintrustFlueObserver; exports.braintrustStreamChunkSchema = _chunkTWCDSYJNjs.braintrustStreamChunkSchema; exports.buildLocalSummary = buildLocalSummary; exports.collectAnthropicSession = _chunkTWCDSYJNjs.collectAnthropicSession; exports.completeOpenAIBatchTrace = completeOpenAIBatchTrace; exports.configureInstrumentation = _chunkTWCDSYJNjs.configureInstrumentation; exports.constructLogs3OverflowRequest = _chunkTWCDSYJNjs.constructLogs3OverflowRequest; exports.createFinalValuePassThroughStream = _chunkTWCDSYJNjs.createFinalValuePassThroughStream; exports.currentExperiment = _chunkTWCDSYJNjs.currentExperiment; exports.currentLogger = _chunkTWCDSYJNjs.currentLogger; exports.currentSpan = _chunkTWCDSYJNjs.currentSpan; exports.deepCopyEvent = _chunkTWCDSYJNjs.deepCopyEvent; exports.default = exports_exports; exports.defaultErrorScoreHandler = defaultErrorScoreHandler; exports.defineDurableEval = defineDurableEval; exports.deserializePlainStringAsJSON = _chunkTWCDSYJNjs.deserializePlainStringAsJSON; exports.devNullWritableStream = _chunkTWCDSYJNjs.devNullWritableStream; exports.evaluatorDefinitionSchema = evaluatorDefinitionSchema; exports.evaluatorDefinitionsSchema = evaluatorDefinitionsSchema; exports.extractTraceContextFromHeaders = _chunkTWCDSYJNjs.extractTraceContextFromHeaders; exports.flush = _chunkTWCDSYJNjs.flush; exports.getContextManager = _chunkTWCDSYJNjs.getContextManager; exports.getIdGenerator = _chunkTWCDSYJNjs.getIdGenerator; exports.getPromptVersions = _chunkTWCDSYJNjs.getPromptVersions; exports.getSpanParentObject = _chunkTWCDSYJNjs.getSpanParentObject; exports.getTemplateRenderer = _chunkTWCDSYJNjs.getTemplateRenderer; exports.graph = graph_framework_exports; exports.init = _chunkTWCDSYJNjs.init; exports.initDataset = _chunkTWCDSYJNjs.initDataset; exports.initExperiment = _chunkTWCDSYJNjs.initExperiment; exports.initFunction = initFunction; exports.initLogger = _chunkTWCDSYJNjs.initLogger; exports.initNodeTestSuite = initNodeTestSuite; exports.injectTraceContext = _chunkTWCDSYJNjs.injectTraceContext; exports.invoke = invoke; exports.isTemplateFormat = _chunkTWCDSYJNjs.isTemplateFormat; exports.loadParameters = _chunkTWCDSYJNjs.loadParameters; exports.loadPrompt = _chunkTWCDSYJNjs.loadPrompt; exports.log = _chunkTWCDSYJNjs.log; exports.logError = _chunkTWCDSYJNjs.logError; exports.login = _chunkTWCDSYJNjs.login; exports.loginToState = _chunkTWCDSYJNjs.loginToState; exports.logs3OverflowUploadSchema = _chunkTWCDSYJNjs.logs3OverflowUploadSchema; exports.newId = _chunkTWCDSYJNjs.newId; exports.openaiBatchesRetrieveTraced = openaiBatchesRetrieveTraced; exports.openaiFilesCreateTraced = openaiFilesCreateTraced; exports.parseCachedHeader = _chunkTWCDSYJNjs.parseCachedHeader; exports.parseTemplateFormat = _chunkTWCDSYJNjs.parseTemplateFormat; exports.permalink = _chunkTWCDSYJNjs.permalink; exports.pickLogs3OverflowObjectIds = _chunkTWCDSYJNjs.pickLogs3OverflowObjectIds; exports.projects = projects; exports.promptContentsSchema = promptContentsSchema; exports.promptDefinitionSchema = promptDefinitionSchema; exports.promptDefinitionToPromptData = promptDefinitionToPromptData; exports.promptDefinitionWithToolsSchema = promptDefinitionWithToolsSchema; exports.registerOtelFlush = _chunkTWCDSYJNjs.registerOtelFlush; exports.registerSandbox = registerSandbox; exports.registerTemplatePlugin = _chunkTWCDSYJNjs.registerTemplatePlugin; exports.renderMessage = _chunkTWCDSYJNjs.renderMessage; exports.renderPromptParams = _chunkTWCDSYJNjs.renderPromptParams; exports.renderTemplateContent = _chunkTWCDSYJNjs.renderTemplateContent; exports.reportFailures = reportFailures; exports.runEvaluator = runEvaluator; exports.setFetch = _chunkTWCDSYJNjs.setFetch; exports.setMaskingFunction = _chunkTWCDSYJNjs.setMaskingFunction; exports.spanComponentsToObjectId = _chunkTWCDSYJNjs.spanComponentsToObjectId; exports.startSpan = _chunkTWCDSYJNjs.startSpan; exports.summarize = _chunkTWCDSYJNjs.summarize; exports.templateRegistry = _chunkTWCDSYJNjs.templateRegistry; exports.toolFunctionDefinitionSchema = _chunkTWCDSYJNjs.ToolFunctionDefinition; exports.traceable = _chunkTWCDSYJNjs.traceable; exports.traced = _chunkTWCDSYJNjs.traced; exports.updateSpan = _chunkTWCDSYJNjs.updateSpan; exports.uploadLogs3OverflowPayload = _chunkTWCDSYJNjs.uploadLogs3OverflowPayload; exports.utf8ByteLength = _chunkTWCDSYJNjs.utf8ByteLength; exports.withCurrent = _chunkTWCDSYJNjs.withCurrent; exports.withDataset = _chunkTWCDSYJNjs.withDataset; exports.withExperiment = _chunkTWCDSYJNjs.withExperiment; exports.withLogger = _chunkTWCDSYJNjs.withLogger; exports.withParent = _chunkTWCDSYJNjs.withParent; exports.wrapAISDK = wrapAISDK; exports.wrapAISDKModel = wrapAISDKModel; exports.wrapAgentClass = wrapAgentClass; exports.wrapAnthropic = wrapAnthropic; exports.wrapBedrockRuntime = wrapBedrockRuntime; exports.wrapClaudeAgentSDK = wrapClaudeAgentSDK; exports.wrapCloudflareAIChat = wrapCloudflareAIChat; exports.wrapCloudflareAgent = wrapCloudflareAgent; exports.wrapCloudflareThink = wrapCloudflareThink; 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.wrapHuggingFaceTransformers = wrapHuggingFaceTransformers; exports.wrapLangSmithClient = wrapLangSmithClient; exports.wrapLangSmithRunTrees = wrapLangSmithRunTrees; exports.wrapLangSmithTraceable = wrapLangSmithTraceable; exports.wrapMastraAgent = _chunkTWCDSYJNjs.wrapMastraAgent; exports.wrapMistral = wrapMistral; exports.wrapOllama = wrapOllama; exports.wrapOpenAI = wrapOpenAI; exports.wrapOpenAICodexSDK = wrapOpenAICodexSDK; exports.wrapOpenAIv4 = wrapOpenAIv4; exports.wrapOpenRouter = wrapOpenRouter; exports.wrapOpenRouterAgent = wrapOpenRouterAgent; exports.wrapPiCodingAgentSDK = wrapPiCodingAgentSDK; exports.wrapStrandsAgentSDK = wrapStrandsAgentSDK; exports.wrapTraced = _chunkTWCDSYJNjs.wrapTraced; exports.wrapVitest = wrapVitest; exports.wrapVoyageAI = wrapVoyageAI;