braintrust 3.24.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +6 -0
- package/dev/dist/index.d.mts +135 -2
- package/dev/dist/index.d.ts +135 -2
- package/dev/dist/index.js +4426 -2040
- package/dev/dist/index.mjs +3594 -1208
- package/dist/apply-auto-instrumentation.js +445 -403
- package/dist/apply-auto-instrumentation.mjs +249 -207
- package/dist/auto-instrumentations/bundler/esbuild.cjs +1449 -799
- package/dist/auto-instrumentations/bundler/esbuild.d.mts +4 -4
- package/dist/auto-instrumentations/bundler/esbuild.d.ts +4 -4
- package/dist/auto-instrumentations/bundler/esbuild.mjs +5 -8
- package/dist/auto-instrumentations/bundler/next.cjs +1448 -818
- package/dist/auto-instrumentations/bundler/next.mjs +6 -29
- package/dist/auto-instrumentations/bundler/rollup.cjs +1449 -799
- package/dist/auto-instrumentations/bundler/rollup.d.mts +4 -4
- package/dist/auto-instrumentations/bundler/rollup.d.ts +4 -4
- package/dist/auto-instrumentations/bundler/rollup.mjs +5 -8
- package/dist/auto-instrumentations/bundler/vite.cjs +1449 -799
- package/dist/auto-instrumentations/bundler/vite.d.mts +4 -4
- package/dist/auto-instrumentations/bundler/vite.d.ts +4 -4
- package/dist/auto-instrumentations/bundler/vite.mjs +5 -8
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +1602 -728
- package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +20 -12
- package/dist/auto-instrumentations/bundler/webpack.cjs +1449 -799
- package/dist/auto-instrumentations/bundler/webpack.d.mts +4 -4
- package/dist/auto-instrumentations/bundler/webpack.d.ts +4 -4
- package/dist/auto-instrumentations/bundler/webpack.mjs +5 -4
- package/dist/auto-instrumentations/{chunk-GSZHTAQW.mjs → chunk-6E22MYSW.mjs} +194 -93
- package/dist/auto-instrumentations/{chunk-VT6DDNKM.mjs → chunk-AKKPLXTP.mjs} +631 -194
- package/dist/auto-instrumentations/chunk-NRE4QUQR.mjs +509 -0
- package/dist/auto-instrumentations/{chunk-BURMPO7L.mjs → chunk-V5LEODRX.mjs} +2 -6
- package/dist/auto-instrumentations/{chunk-M6DLIJ2Z.mjs → chunk-XYN63IG5.mjs} +124 -194
- package/dist/auto-instrumentations/{chunk-F43DNLPD.mjs → chunk-XZHHE4Y3.mjs} +646 -510
- package/dist/auto-instrumentations/hook.mjs +894 -657
- package/dist/auto-instrumentations/index.cjs +1125 -490
- package/dist/auto-instrumentations/index.d.mts +6 -2
- package/dist/auto-instrumentations/index.d.ts +6 -2
- package/dist/auto-instrumentations/index.mjs +6 -1
- package/dist/auto-instrumentations/loader/cjs-patch.cjs +492 -195
- package/dist/auto-instrumentations/loader/cjs-patch.d.mts +2 -2
- package/dist/auto-instrumentations/loader/cjs-patch.d.ts +2 -2
- package/dist/auto-instrumentations/loader/cjs-patch.mjs +3 -2
- package/dist/auto-instrumentations/loader/esm-hook.mjs +1 -1
- package/dist/auto-instrumentations/plugin-B-aZh7EP.d.ts +30 -0
- package/dist/auto-instrumentations/plugin-Bnj4E_6B.d.mts +30 -0
- package/dist/auto-instrumentations/{types-RNPaKi9o.d.mts → types-C1fVeiCp.d.mts} +1 -1
- package/dist/auto-instrumentations/{types-RNPaKi9o.d.ts → types-C1fVeiCp.d.ts} +1 -1
- package/dist/browser.d.mts +824 -197
- package/dist/browser.d.ts +824 -197
- package/dist/browser.js +3897 -1228
- package/dist/browser.mjs +3897 -1228
- package/dist/chunk-PN7EWK66.mjs +1784 -0
- package/dist/{chunk-SU6EHKJV.js → chunk-VRZZQPAA.js} +3289 -1577
- package/dist/chunk-VYNNEKSA.js +1784 -0
- package/dist/{chunk-XE5FS7QY.mjs → chunk-XIZOM2HO.mjs} +2470 -758
- package/dist/cli.js +3596 -1211
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +3897 -1231
- package/dist/edge-light.mjs +3897 -1231
- package/dist/index.d.mts +824 -197
- package/dist/index.d.ts +824 -197
- package/dist/index.js +750 -445
- package/dist/index.mjs +334 -29
- package/dist/instrumentation/index.d.mts +135 -6
- package/dist/instrumentation/index.d.ts +135 -6
- package/dist/instrumentation/index.js +3696 -1257
- package/dist/instrumentation/index.mjs +3696 -1257
- package/dist/vitest-evals-reporter.js +16 -16
- package/dist/vitest-evals-reporter.mjs +2 -2
- package/dist/workerd.d.mts +1 -1
- package/dist/workerd.d.ts +1 -1
- package/dist/workerd.js +3897 -1231
- package/dist/workerd.mjs +3897 -1231
- package/licenses/node-diagnostics-channel/LICENSE +19 -0
- package/package.json +34 -35
- package/dist/auto-instrumentations/plugin-D0KHwSJv.d.mts +0 -44
- package/dist/auto-instrumentations/plugin-G6fgxk1b.d.ts +0 -44
- package/dist/chunk-7AUY2XWX.js +0 -1090
- package/dist/chunk-7F6GCRHH.mjs +0 -1090
|
@@ -51,52 +51,583 @@ var import_source_map = require("source-map");
|
|
|
51
51
|
// src/auto-instrumentations/orchestrion-js/transforms.ts
|
|
52
52
|
var import_esquery = __toESM(require("esquery"));
|
|
53
53
|
var import_meriyah = require("meriyah");
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
|
|
55
|
+
// src/global-instrumentation-hooks.ts
|
|
56
|
+
var GLOBAL_INSTRUMENTATION_HOOKS_KEY = "__braintrust_instrumentation_hooks";
|
|
57
|
+
var GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION = 1;
|
|
58
|
+
var GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND = "braintrust.global-instrumentation-hooks.registry";
|
|
59
|
+
var GLOBAL_INSTRUMENTATION_HOOK_BRAND = "braintrust.global-instrumentation-hooks.hook";
|
|
60
|
+
var registryBrand = Symbol.for(GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND);
|
|
61
|
+
var hookBrand = Symbol.for(GLOBAL_INSTRUMENTATION_HOOK_BRAND);
|
|
62
|
+
var errorReporter;
|
|
63
|
+
function reportError(error) {
|
|
64
|
+
try {
|
|
65
|
+
errorReporter?.(error);
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
58
68
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
function setContextValue(context, key, value) {
|
|
70
|
+
try {
|
|
71
|
+
context[key] = value;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
reportError(error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function wrapStoreRun(store, message, next, transform) {
|
|
77
|
+
return () => {
|
|
78
|
+
let context;
|
|
79
|
+
try {
|
|
80
|
+
context = transform ? transform(message) : message;
|
|
81
|
+
} catch (error) {
|
|
82
|
+
reportError(error);
|
|
83
|
+
return next();
|
|
84
|
+
}
|
|
85
|
+
let called = false;
|
|
86
|
+
let result;
|
|
87
|
+
let providerError;
|
|
88
|
+
let providerThrew = false;
|
|
89
|
+
const runNext = () => {
|
|
90
|
+
if (called) {
|
|
91
|
+
reportError(
|
|
92
|
+
new Error(
|
|
93
|
+
"Instrumentation store invoked its callback more than once"
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
if (providerThrew) {
|
|
97
|
+
throw providerError;
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
called = true;
|
|
102
|
+
try {
|
|
103
|
+
result = next();
|
|
104
|
+
return result;
|
|
105
|
+
} catch (error) {
|
|
106
|
+
providerThrew = true;
|
|
107
|
+
providerError = error;
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
try {
|
|
112
|
+
store.run(context, runNext);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (!providerThrew || error !== providerError) {
|
|
115
|
+
reportError(error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (!called) {
|
|
119
|
+
reportError(
|
|
120
|
+
new Error("Instrumentation store did not invoke its callback")
|
|
121
|
+
);
|
|
122
|
+
return runNext();
|
|
123
|
+
}
|
|
124
|
+
if (providerThrew) {
|
|
125
|
+
throw providerError;
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
var HookChannel = class {
|
|
131
|
+
constructor(name) {
|
|
132
|
+
this.name = name;
|
|
133
|
+
}
|
|
134
|
+
name;
|
|
135
|
+
subscribers = [];
|
|
136
|
+
stores = /* @__PURE__ */ new Map();
|
|
137
|
+
get hasSubscribers() {
|
|
138
|
+
return this.subscribers.length > 0 || this.stores.size > 0;
|
|
139
|
+
}
|
|
140
|
+
subscribe(subscription) {
|
|
141
|
+
if (typeof subscription !== "function") {
|
|
142
|
+
throw new TypeError("subscription must be a function");
|
|
143
|
+
}
|
|
144
|
+
this.subscribers = [...this.subscribers, subscription];
|
|
145
|
+
}
|
|
146
|
+
unsubscribe(subscription) {
|
|
147
|
+
const index = this.subscribers.indexOf(subscription);
|
|
148
|
+
if (index === -1) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
this.subscribers = [
|
|
152
|
+
...this.subscribers.slice(0, index),
|
|
153
|
+
...this.subscribers.slice(index + 1)
|
|
154
|
+
];
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
bindStore(store, transform) {
|
|
158
|
+
if (!store || typeof store.run !== "function") {
|
|
159
|
+
throw new TypeError("store must have a run method");
|
|
160
|
+
}
|
|
161
|
+
this.stores.set(
|
|
162
|
+
store,
|
|
163
|
+
transform
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
unbindStore(store) {
|
|
167
|
+
return this.stores.delete(store);
|
|
168
|
+
}
|
|
169
|
+
publish(message) {
|
|
170
|
+
const subscribers = this.subscribers;
|
|
171
|
+
for (const subscriber of subscribers) {
|
|
172
|
+
try {
|
|
173
|
+
subscriber(message, this.name);
|
|
174
|
+
} catch (error) {
|
|
175
|
+
reportError(error);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
runStores(message, fn, thisArg, ...args) {
|
|
180
|
+
let run = () => {
|
|
181
|
+
this.publish(message);
|
|
182
|
+
return Reflect.apply(fn, thisArg, args);
|
|
183
|
+
};
|
|
184
|
+
for (const [store, transform] of this.stores.entries()) {
|
|
185
|
+
run = wrapStoreRun(store, message, run, transform);
|
|
186
|
+
}
|
|
187
|
+
return run();
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
var traceEvents = [
|
|
191
|
+
"start",
|
|
192
|
+
"end",
|
|
193
|
+
"asyncStart",
|
|
194
|
+
"asyncEnd",
|
|
195
|
+
"error"
|
|
196
|
+
];
|
|
197
|
+
var TracingHook = class {
|
|
198
|
+
start;
|
|
199
|
+
end;
|
|
200
|
+
asyncStart;
|
|
201
|
+
asyncEnd;
|
|
202
|
+
error;
|
|
203
|
+
constructor(nameOrChannels) {
|
|
204
|
+
Object.defineProperty(this, hookBrand, {
|
|
205
|
+
configurable: false,
|
|
206
|
+
enumerable: false,
|
|
207
|
+
value: GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION,
|
|
208
|
+
writable: false
|
|
209
|
+
});
|
|
210
|
+
if (typeof nameOrChannels === "string") {
|
|
211
|
+
this.start = new HookChannel(`tracing:${nameOrChannels}:start`);
|
|
212
|
+
this.end = new HookChannel(`tracing:${nameOrChannels}:end`);
|
|
213
|
+
this.asyncStart = new HookChannel(`tracing:${nameOrChannels}:asyncStart`);
|
|
214
|
+
this.asyncEnd = new HookChannel(`tracing:${nameOrChannels}:asyncEnd`);
|
|
215
|
+
this.error = new HookChannel(`tracing:${nameOrChannels}:error`);
|
|
62
216
|
return;
|
|
63
217
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
218
|
+
this.start = nameOrChannels.start ?? new HookChannel("tracing:start");
|
|
219
|
+
this.end = nameOrChannels.end ?? new HookChannel("tracing:end");
|
|
220
|
+
this.asyncStart = nameOrChannels.asyncStart ?? new HookChannel("tracing:asyncStart");
|
|
221
|
+
this.asyncEnd = nameOrChannels.asyncEnd ?? new HookChannel("tracing:asyncEnd");
|
|
222
|
+
this.error = nameOrChannels.error ?? new HookChannel("tracing:error");
|
|
223
|
+
}
|
|
224
|
+
get hasSubscribers() {
|
|
225
|
+
return this.start.hasSubscribers || this.end.hasSubscribers || this.asyncStart.hasSubscribers || this.asyncEnd.hasSubscribers || this.error.hasSubscribers;
|
|
226
|
+
}
|
|
227
|
+
subscribe(handlers) {
|
|
228
|
+
for (const eventName of traceEvents) {
|
|
229
|
+
const handler = handlers[eventName];
|
|
230
|
+
if (handler) {
|
|
231
|
+
this[eventName].subscribe(handler);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
unsubscribe(handlers) {
|
|
236
|
+
let done = true;
|
|
237
|
+
for (const eventName of traceEvents) {
|
|
238
|
+
const handler = handlers[eventName];
|
|
239
|
+
if (handler && !this[eventName].unsubscribe(handler)) {
|
|
240
|
+
done = false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return done;
|
|
244
|
+
}
|
|
245
|
+
traceSync(fn, message = {}, thisArg, ...args) {
|
|
246
|
+
if (!this.hasSubscribers) {
|
|
247
|
+
return Reflect.apply(fn, thisArg, args);
|
|
248
|
+
}
|
|
249
|
+
const context = message;
|
|
250
|
+
return this.start.runStores(message, () => {
|
|
251
|
+
try {
|
|
252
|
+
const result = Reflect.apply(fn, thisArg, args);
|
|
253
|
+
setContextValue(context, "result", result);
|
|
254
|
+
return result;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
setContextValue(context, "error", error);
|
|
257
|
+
this.error.publish(message);
|
|
258
|
+
throw error;
|
|
259
|
+
} finally {
|
|
260
|
+
this.end.publish(message);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
tracePromise(fn, message = {}, thisArg, ...args) {
|
|
265
|
+
if (!this.hasSubscribers) {
|
|
266
|
+
return Reflect.apply(fn, thisArg, args);
|
|
267
|
+
}
|
|
268
|
+
const context = message;
|
|
269
|
+
return this.start.runStores(message, () => {
|
|
270
|
+
let result;
|
|
271
|
+
try {
|
|
272
|
+
result = Reflect.apply(fn, thisArg, args);
|
|
273
|
+
} catch (error) {
|
|
274
|
+
setContextValue(context, "error", error);
|
|
275
|
+
this.error.publish(message);
|
|
276
|
+
this.end.publish(message);
|
|
277
|
+
throw error;
|
|
278
|
+
}
|
|
279
|
+
this.end.publish(message);
|
|
280
|
+
if (!result || typeof result !== "object" && typeof result !== "function") {
|
|
281
|
+
setContextValue(context, "result", result);
|
|
282
|
+
this.asyncStart.publish(message);
|
|
283
|
+
this.asyncEnd.publish(message);
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
let terminalPublished = false;
|
|
287
|
+
const finishUnobservedResult = (error) => {
|
|
288
|
+
reportError(error);
|
|
289
|
+
if (!terminalPublished) {
|
|
290
|
+
terminalPublished = true;
|
|
291
|
+
setContextValue(context, "result", result);
|
|
292
|
+
this.asyncStart.publish(message);
|
|
293
|
+
this.asyncEnd.publish(message);
|
|
294
|
+
}
|
|
295
|
+
return result;
|
|
296
|
+
};
|
|
297
|
+
let then;
|
|
298
|
+
try {
|
|
299
|
+
then = result.then;
|
|
300
|
+
} catch (error) {
|
|
301
|
+
return finishUnobservedResult(error);
|
|
302
|
+
}
|
|
303
|
+
if (typeof then !== "function") {
|
|
304
|
+
setContextValue(context, "result", result);
|
|
305
|
+
this.asyncStart.publish(message);
|
|
306
|
+
this.asyncEnd.publish(message);
|
|
307
|
+
return result;
|
|
308
|
+
}
|
|
309
|
+
const resolve = (resolved) => {
|
|
310
|
+
if (!terminalPublished) {
|
|
311
|
+
terminalPublished = true;
|
|
312
|
+
setContextValue(context, "result", resolved);
|
|
313
|
+
this.asyncStart.publish(message);
|
|
314
|
+
this.asyncEnd.publish(message);
|
|
315
|
+
}
|
|
316
|
+
return resolved;
|
|
317
|
+
};
|
|
318
|
+
let rejectionThrown = false;
|
|
319
|
+
let rejectionError;
|
|
320
|
+
const reject = (error) => {
|
|
321
|
+
if (!terminalPublished) {
|
|
322
|
+
terminalPublished = true;
|
|
323
|
+
setContextValue(context, "error", error);
|
|
324
|
+
this.error.publish(message);
|
|
325
|
+
this.asyncStart.publish(message);
|
|
326
|
+
this.asyncEnd.publish(message);
|
|
327
|
+
}
|
|
328
|
+
rejectionThrown = true;
|
|
329
|
+
rejectionError = error;
|
|
330
|
+
throw error;
|
|
331
|
+
};
|
|
332
|
+
let isPlainPromise;
|
|
333
|
+
try {
|
|
334
|
+
isPlainPromise = result instanceof Promise && result.constructor === Promise;
|
|
335
|
+
} catch (error) {
|
|
336
|
+
return finishUnobservedResult(error);
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
if (isPlainPromise) {
|
|
340
|
+
return Reflect.apply(then, result, [resolve, reject]);
|
|
341
|
+
}
|
|
342
|
+
Reflect.apply(then, result, [
|
|
343
|
+
resolve,
|
|
344
|
+
(error) => {
|
|
345
|
+
try {
|
|
346
|
+
reject(error);
|
|
347
|
+
} catch {
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
]);
|
|
351
|
+
} catch (error) {
|
|
352
|
+
if (rejectionThrown && error === rejectionError) {
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
return finishUnobservedResult(error);
|
|
356
|
+
}
|
|
357
|
+
return result;
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
traceCallback(fn, position = -1, message = {}, thisArg, ...args) {
|
|
361
|
+
if (!this.hasSubscribers) {
|
|
362
|
+
return Reflect.apply(fn, thisArg, args);
|
|
363
|
+
}
|
|
364
|
+
const context = message;
|
|
365
|
+
const callArgs = args.length > 0 ? args : context.arguments ?? args;
|
|
366
|
+
const callback = Array.prototype.at.call(callArgs, position);
|
|
367
|
+
if (typeof callback !== "function") {
|
|
368
|
+
return Reflect.apply(fn, thisArg, args);
|
|
369
|
+
}
|
|
370
|
+
const { asyncStart, asyncEnd, error: errorChannel } = this;
|
|
371
|
+
function wrappedCallback(error, result) {
|
|
372
|
+
if (error) {
|
|
373
|
+
setContextValue(context, "error", error);
|
|
374
|
+
errorChannel.publish(message);
|
|
375
|
+
} else {
|
|
376
|
+
setContextValue(context, "result", result);
|
|
377
|
+
}
|
|
378
|
+
return asyncStart.runStores(message, () => {
|
|
379
|
+
try {
|
|
380
|
+
return Reflect.apply(callback, this, arguments);
|
|
381
|
+
} finally {
|
|
382
|
+
asyncEnd.publish(message);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
Array.prototype.splice.call(callArgs, position, 1, wrappedCallback);
|
|
387
|
+
return this.start.runStores(message, () => {
|
|
388
|
+
try {
|
|
389
|
+
return Reflect.apply(fn, thisArg, args);
|
|
390
|
+
} catch (error) {
|
|
391
|
+
setContextValue(context, "error", error);
|
|
392
|
+
this.error.publish(message);
|
|
393
|
+
throw error;
|
|
394
|
+
} finally {
|
|
395
|
+
this.end.publish(message);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
var inertChannel = Object.freeze({
|
|
401
|
+
name: "braintrust:inert",
|
|
402
|
+
hasSubscribers: false,
|
|
403
|
+
subscribe() {
|
|
404
|
+
},
|
|
405
|
+
unsubscribe() {
|
|
406
|
+
return false;
|
|
407
|
+
},
|
|
408
|
+
bindStore() {
|
|
409
|
+
},
|
|
410
|
+
unbindStore() {
|
|
411
|
+
return false;
|
|
412
|
+
},
|
|
413
|
+
publish() {
|
|
414
|
+
},
|
|
415
|
+
runStores(_message, fn, thisArg, ...args) {
|
|
416
|
+
return Reflect.apply(fn, thisArg, args);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
var inertTracingHook = new TracingHook({
|
|
420
|
+
start: inertChannel,
|
|
421
|
+
end: inertChannel,
|
|
422
|
+
asyncStart: inertChannel,
|
|
423
|
+
asyncEnd: inertChannel,
|
|
424
|
+
error: inertChannel
|
|
425
|
+
});
|
|
426
|
+
function isHookChannel(value) {
|
|
427
|
+
if (typeof value !== "object" && typeof value !== "function" || value === null) {
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
try {
|
|
431
|
+
const channel2 = value;
|
|
432
|
+
return typeof channel2.hasSubscribers === "boolean" && typeof channel2.subscribe === "function" && typeof channel2.unsubscribe === "function" && typeof channel2.bindStore === "function" && typeof channel2.unbindStore === "function" && typeof channel2.publish === "function" && typeof channel2.runStores === "function";
|
|
433
|
+
} catch {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
function hasTracingHookShape(value) {
|
|
438
|
+
if (typeof value !== "object" && typeof value !== "function" || value === null) {
|
|
439
|
+
return false;
|
|
440
|
+
}
|
|
441
|
+
try {
|
|
442
|
+
const hook = value;
|
|
443
|
+
return typeof hook.hasSubscribers === "boolean" && typeof hook.subscribe === "function" && typeof hook.unsubscribe === "function" && typeof hook.traceSync === "function" && typeof hook.tracePromise === "function" && typeof hook.traceCallback === "function" && isHookChannel(hook.start) && isHookChannel(hook.end) && isHookChannel(hook.asyncStart) && isHookChannel(hook.asyncEnd) && isHookChannel(hook.error);
|
|
444
|
+
} catch {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function isCompatibleTracingHook(value) {
|
|
449
|
+
try {
|
|
450
|
+
return value[hookBrand] === GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION && hasTracingHookShape(value);
|
|
451
|
+
} catch {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function isCompatibleHookRegistry(value) {
|
|
456
|
+
try {
|
|
457
|
+
return value instanceof Map && value[registryBrand] === GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION;
|
|
458
|
+
} catch {
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function getHookRegistry() {
|
|
463
|
+
let descriptor;
|
|
464
|
+
try {
|
|
465
|
+
descriptor = Object.getOwnPropertyDescriptor(
|
|
466
|
+
globalThis,
|
|
467
|
+
GLOBAL_INSTRUMENTATION_HOOKS_KEY
|
|
67
468
|
);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
469
|
+
} catch (error) {
|
|
470
|
+
reportError(error);
|
|
471
|
+
return void 0;
|
|
472
|
+
}
|
|
473
|
+
if (descriptor && "value" in descriptor && isCompatibleHookRegistry(descriptor.value) && (descriptor.configurable || descriptor.enumerable === false)) {
|
|
474
|
+
if (descriptor.configurable || descriptor.writable) {
|
|
475
|
+
try {
|
|
476
|
+
Object.defineProperty(globalThis, GLOBAL_INSTRUMENTATION_HOOKS_KEY, {
|
|
477
|
+
configurable: false,
|
|
478
|
+
enumerable: false,
|
|
479
|
+
value: descriptor.value,
|
|
480
|
+
writable: false
|
|
481
|
+
});
|
|
482
|
+
} catch (error) {
|
|
483
|
+
reportError(error);
|
|
484
|
+
return void 0;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
return descriptor.value;
|
|
488
|
+
}
|
|
489
|
+
if (descriptor && !descriptor.configurable) {
|
|
490
|
+
reportError(new Error("Incompatible global instrumentation hook registry"));
|
|
491
|
+
return void 0;
|
|
492
|
+
}
|
|
493
|
+
const registry = /* @__PURE__ */ new Map();
|
|
494
|
+
try {
|
|
495
|
+
Object.defineProperty(registry, registryBrand, {
|
|
496
|
+
configurable: false,
|
|
497
|
+
enumerable: false,
|
|
498
|
+
value: GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION,
|
|
499
|
+
writable: false
|
|
500
|
+
});
|
|
501
|
+
} catch (error) {
|
|
502
|
+
reportError(error);
|
|
503
|
+
return void 0;
|
|
504
|
+
}
|
|
505
|
+
try {
|
|
506
|
+
Object.defineProperty(globalThis, GLOBAL_INSTRUMENTATION_HOOKS_KEY, {
|
|
507
|
+
configurable: false,
|
|
508
|
+
enumerable: false,
|
|
509
|
+
value: registry,
|
|
510
|
+
writable: false
|
|
511
|
+
});
|
|
512
|
+
return registry;
|
|
513
|
+
} catch (error) {
|
|
514
|
+
reportError(error);
|
|
515
|
+
return void 0;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
function newGlobalTracingChannel(nameOrChannels) {
|
|
519
|
+
if (typeof nameOrChannels !== "string") {
|
|
520
|
+
return new TracingHook(nameOrChannels);
|
|
521
|
+
}
|
|
522
|
+
const registry = getHookRegistry();
|
|
523
|
+
if (!registry) {
|
|
524
|
+
return inertTracingHook;
|
|
525
|
+
}
|
|
526
|
+
let existing;
|
|
527
|
+
try {
|
|
528
|
+
existing = Map.prototype.get.call(registry, nameOrChannels);
|
|
529
|
+
} catch (error) {
|
|
530
|
+
reportError(error);
|
|
531
|
+
return inertTracingHook;
|
|
532
|
+
}
|
|
533
|
+
if (isCompatibleTracingHook(existing)) {
|
|
534
|
+
return existing;
|
|
535
|
+
}
|
|
536
|
+
if (existing !== void 0) {
|
|
537
|
+
reportError(
|
|
538
|
+
new Error(`Invalid global instrumentation hook: ${nameOrChannels}`)
|
|
81
539
|
);
|
|
82
|
-
|
|
83
|
-
|
|
540
|
+
try {
|
|
541
|
+
Map.prototype.delete.call(registry, nameOrChannels);
|
|
542
|
+
} catch (error) {
|
|
543
|
+
reportError(error);
|
|
544
|
+
return inertTracingHook;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
const hook = new TracingHook(nameOrChannels);
|
|
548
|
+
try {
|
|
549
|
+
Map.prototype.set.call(registry, nameOrChannels, hook);
|
|
550
|
+
} catch (error) {
|
|
551
|
+
reportError(error);
|
|
552
|
+
return inertTracingHook;
|
|
553
|
+
}
|
|
554
|
+
return hook;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// src/auto-instrumentations/orchestrion-js/transforms.ts
|
|
558
|
+
var CHANNEL_REGEX = /[^\w]/g;
|
|
559
|
+
var SHARED_HOOK_LOOKUP = "tr_ch_bt$get_hook";
|
|
560
|
+
function formatChannelVariable(channelName) {
|
|
561
|
+
return `tr_ch_bt$${channelName.replace(CHANNEL_REGEX, "_")}`;
|
|
562
|
+
}
|
|
563
|
+
function formatChannelGetter(channelName) {
|
|
564
|
+
return `tr_ch_bt$get_${channelName.replace(CHANNEL_REGEX, "_")}`;
|
|
565
|
+
}
|
|
566
|
+
var transforms = {
|
|
567
|
+
tracingHookDeclaration(state, node) {
|
|
84
568
|
const {
|
|
85
569
|
channelName,
|
|
86
|
-
module: { name }
|
|
570
|
+
module: { name },
|
|
571
|
+
operator
|
|
87
572
|
} = state;
|
|
88
573
|
const channelVariable = formatChannelVariable(channelName);
|
|
574
|
+
const channelGetter = formatChannelGetter(channelName);
|
|
575
|
+
const hasSharedHookLookup = node.body.some(
|
|
576
|
+
(child) => child.declarations?.[0]?.id?.name === SHARED_HOOK_LOOKUP
|
|
577
|
+
);
|
|
89
578
|
if (node.body.some(
|
|
90
|
-
(child) => child.declarations?.[0]?.id?.name ===
|
|
579
|
+
(child) => child.declarations?.[0]?.id?.name === channelGetter
|
|
91
580
|
)) {
|
|
92
581
|
return;
|
|
93
582
|
}
|
|
94
|
-
|
|
95
|
-
|
|
583
|
+
const sharedHookLookup = hasSharedHookLookup ? "" : `
|
|
584
|
+
const ${SHARED_HOOK_LOOKUP} = (__bt$hookName, __bt$operator) => {
|
|
585
|
+
try {
|
|
586
|
+
const __bt$hooks = globalThis[${JSON.stringify(
|
|
587
|
+
GLOBAL_INSTRUMENTATION_HOOKS_KEY
|
|
588
|
+
)}];
|
|
589
|
+
if (
|
|
590
|
+
!(__bt$hooks instanceof Map) ||
|
|
591
|
+
__bt$hooks[Symbol.for(${JSON.stringify(
|
|
592
|
+
GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND
|
|
593
|
+
)})] !== ${GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION}
|
|
594
|
+
) return undefined;
|
|
595
|
+
const __bt$hook = Map.prototype.get.call(
|
|
596
|
+
__bt$hooks,
|
|
597
|
+
__bt$hookName
|
|
598
|
+
);
|
|
599
|
+
if (
|
|
600
|
+
(__bt$hook === null ||
|
|
601
|
+
(typeof __bt$hook !== "object" &&
|
|
602
|
+
typeof __bt$hook !== "function")) ||
|
|
603
|
+
__bt$hook[Symbol.for(${JSON.stringify(
|
|
604
|
+
GLOBAL_INSTRUMENTATION_HOOK_BRAND
|
|
605
|
+
)})] !== ${GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION} ||
|
|
606
|
+
typeof __bt$hook.hasSubscribers !== "boolean" ||
|
|
607
|
+
typeof __bt$hook[__bt$operator] !== "function"
|
|
608
|
+
) return undefined;
|
|
609
|
+
return __bt$hook;
|
|
610
|
+
} catch {
|
|
611
|
+
return undefined;
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
`;
|
|
96
615
|
const code = `
|
|
97
|
-
|
|
616
|
+
${sharedHookLookup}
|
|
617
|
+
let ${channelVariable};
|
|
618
|
+
const ${channelGetter} = () =>
|
|
619
|
+
${channelVariable} ??= ${SHARED_HOOK_LOOKUP}(
|
|
620
|
+
${JSON.stringify(`orchestrion:${name}:${channelName}`)},
|
|
621
|
+
${JSON.stringify(operator)}
|
|
622
|
+
);
|
|
98
623
|
`;
|
|
99
|
-
node.body.
|
|
624
|
+
const sharedHookLookupIndex = node.body.findIndex(
|
|
625
|
+
(child) => child.declarations?.[0]?.id?.name === SHARED_HOOK_LOOKUP
|
|
626
|
+
);
|
|
627
|
+
const index = sharedHookLookupIndex === -1 ? node.body.findIndex(
|
|
628
|
+
(child) => child.directive === "use strict"
|
|
629
|
+
) : sharedHookLookupIndex;
|
|
630
|
+
node.body.splice(index + 1, 0, ...(0, import_meriyah.parse)(code).body);
|
|
100
631
|
},
|
|
101
632
|
traceCallback: traceAny,
|
|
102
633
|
tracePromise: traceAny,
|
|
@@ -111,25 +642,21 @@ function traceAny(state, node, _parent, ancestry) {
|
|
|
111
642
|
}
|
|
112
643
|
}
|
|
113
644
|
function traceFunction(state, node, program) {
|
|
114
|
-
transforms.
|
|
645
|
+
transforms.tracingHookDeclaration(state, program, null, []);
|
|
115
646
|
const { functionQuery } = state;
|
|
116
647
|
const methodName = "methodName" in functionQuery ? functionQuery.methodName : void 0;
|
|
117
648
|
const privateMethodName = "privateMethodName" in functionQuery ? functionQuery.privateMethodName : void 0;
|
|
118
649
|
const functionName = "functionName" in functionQuery ? functionQuery.functionName : void 0;
|
|
119
650
|
const isConstructor = methodName === "constructor" || !methodName && !privateMethodName && !functionName;
|
|
120
651
|
const type = isConstructor ? "ArrowFunctionExpression" : "FunctionExpression";
|
|
121
|
-
node.body = wrap(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
generator: node.generator
|
|
130
|
-
},
|
|
131
|
-
program
|
|
132
|
-
);
|
|
652
|
+
node.body = wrap(state, {
|
|
653
|
+
type,
|
|
654
|
+
params: node.params,
|
|
655
|
+
body: node.body,
|
|
656
|
+
async: node.async,
|
|
657
|
+
expression: false,
|
|
658
|
+
generator: node.generator
|
|
659
|
+
});
|
|
133
660
|
node.generator = false;
|
|
134
661
|
node.async = false;
|
|
135
662
|
wrapSuper(node);
|
|
@@ -141,11 +668,11 @@ function traceInstanceMethod(state, node, program) {
|
|
|
141
668
|
return;
|
|
142
669
|
}
|
|
143
670
|
const classBody = node.body;
|
|
144
|
-
if (classBody.body.some(({ key }) => key
|
|
671
|
+
if (classBody.body.some(({ key }) => key?.name === methodName)) {
|
|
145
672
|
return;
|
|
146
673
|
}
|
|
147
674
|
let ctor = classBody.body.find(({ kind }) => kind === "constructor");
|
|
148
|
-
transforms.
|
|
675
|
+
transforms.tracingHookDeclaration(state, program, null, []);
|
|
149
676
|
if (!ctor) {
|
|
150
677
|
ctor = (0, import_meriyah.parse)(
|
|
151
678
|
node.superClass ? "class A extends Object { constructor (...args) { super(...args) } }" : "class A { constructor () {} }"
|
|
@@ -153,47 +680,46 @@ function traceInstanceMethod(state, node, program) {
|
|
|
153
680
|
classBody.body.unshift(ctor);
|
|
154
681
|
}
|
|
155
682
|
const ctorBody = (0, import_meriyah.parse)(`
|
|
156
|
-
const
|
|
683
|
+
const __bt$${methodName} = this["${methodName}"]
|
|
157
684
|
this["${methodName}"] = function () {}
|
|
158
685
|
`).body;
|
|
159
686
|
const fn = ctorBody[1].expression.right;
|
|
160
687
|
fn.async = operator === "tracePromise";
|
|
161
|
-
fn.body = wrap(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
);
|
|
688
|
+
fn.body = wrap(state, {
|
|
689
|
+
type: "Identifier",
|
|
690
|
+
name: `__bt$${methodName}`
|
|
691
|
+
});
|
|
166
692
|
wrapSuper(fn);
|
|
167
693
|
ctor.value.body.body.push(...ctorBody);
|
|
168
694
|
}
|
|
169
|
-
function wrap(state, node
|
|
695
|
+
function wrap(state, node) {
|
|
170
696
|
const { operator, moduleVersion } = state;
|
|
171
697
|
const wrapper = operator === "traceCallback" ? wrapCallback(state) : operator === "tracePromise" ? wrapPromise(state) : wrapSync(state);
|
|
172
698
|
const block = wrapper.body[0].body;
|
|
173
699
|
const common = (0, import_meriyah.parse)(
|
|
174
700
|
node.type === "ArrowFunctionExpression" ? `
|
|
175
|
-
const
|
|
701
|
+
const __bt$ctx = {
|
|
176
702
|
arguments,
|
|
177
703
|
moduleVersion: ${JSON.stringify(moduleVersion)}
|
|
178
704
|
};
|
|
179
|
-
const
|
|
180
|
-
const
|
|
181
|
-
return
|
|
705
|
+
const __bt$traced = () => {
|
|
706
|
+
const __bt$wrapped = () => {};
|
|
707
|
+
return __bt$wrapped(...arguments);
|
|
182
708
|
};
|
|
183
709
|
` : `
|
|
184
|
-
const
|
|
710
|
+
const __bt$ctx = {
|
|
185
711
|
arguments,
|
|
186
712
|
self: this,
|
|
187
713
|
moduleVersion: ${JSON.stringify(moduleVersion)}
|
|
188
714
|
};
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
return
|
|
715
|
+
const __bt$traced = () => {
|
|
716
|
+
const __bt$wrapped = () => {};
|
|
717
|
+
return __bt$wrapped.apply(this, arguments);
|
|
192
718
|
};
|
|
193
719
|
`
|
|
194
720
|
).body;
|
|
195
721
|
block.body.unshift(...common);
|
|
196
|
-
import_esquery.default.query(block, "[id.name=
|
|
722
|
+
import_esquery.default.query(block, "[id.name=__bt$wrapped]")[0].init = node;
|
|
197
723
|
return block;
|
|
198
724
|
}
|
|
199
725
|
function wrapSuper(node) {
|
|
@@ -205,11 +731,11 @@ function wrapSuper(node) {
|
|
|
205
731
|
const { name } = node2.property;
|
|
206
732
|
let child;
|
|
207
733
|
if (parent.callee) {
|
|
208
|
-
const { expression } = (0, import_meriyah.parse)(`
|
|
734
|
+
const { expression } = (0, import_meriyah.parse)(`__bt$super['${name}'].call(this)`).body[0];
|
|
209
735
|
parent.callee = child = expression.callee;
|
|
210
736
|
parent.arguments.unshift(...expression.arguments);
|
|
211
737
|
} else {
|
|
212
|
-
parent.expression = child = (0, import_meriyah.parse)(`
|
|
738
|
+
parent.expression = child = (0, import_meriyah.parse)(`__bt$super['${name}']`).body[0];
|
|
213
739
|
}
|
|
214
740
|
child.computed = parent.callee.computed;
|
|
215
741
|
child.optional = parent.callee.optional;
|
|
@@ -220,14 +746,14 @@ function wrapSuper(node) {
|
|
|
220
746
|
const member = (0, import_meriyah.parse)(`
|
|
221
747
|
class Wrapper {
|
|
222
748
|
wrapper () {
|
|
223
|
-
|
|
749
|
+
__bt$super['${name}'] = super['${name}']
|
|
224
750
|
}
|
|
225
751
|
}
|
|
226
752
|
`).body[0].body.body[0].value.body.body[0];
|
|
227
753
|
node.body.body.unshift(member);
|
|
228
754
|
}
|
|
229
755
|
if (members.size > 0) {
|
|
230
|
-
node.body.body.unshift((0, import_meriyah.parse)("const
|
|
756
|
+
node.body.body.unshift((0, import_meriyah.parse)("const __bt$super = {}").body[0]);
|
|
231
757
|
}
|
|
232
758
|
}
|
|
233
759
|
function wrapCallback(state) {
|
|
@@ -235,136 +761,41 @@ function wrapCallback(state) {
|
|
|
235
761
|
channelName,
|
|
236
762
|
functionQuery: { callbackIndex = -1 }
|
|
237
763
|
} = state;
|
|
238
|
-
const
|
|
764
|
+
const channelGetter = formatChannelGetter(channelName);
|
|
239
765
|
return (0, import_meriyah.parse)(`
|
|
240
766
|
function wrapper () {
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
} else {
|
|
250
|
-
__apm$ctx.result = res;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
${channelVariable}.asyncStart.runStores(__apm$ctx, () => {
|
|
254
|
-
try {
|
|
255
|
-
if (__apm$cb) {
|
|
256
|
-
return __apm$cb.apply(this, arguments);
|
|
257
|
-
}
|
|
258
|
-
} finally {
|
|
259
|
-
${channelVariable}.asyncEnd.publish(__apm$ctx);
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if (typeof __apm$cb !== 'function') {
|
|
265
|
-
return __apm$traced();
|
|
266
|
-
}
|
|
267
|
-
Array.prototype.splice.call(arguments, ${callbackIndex}, 1, __apm$wrappedCb);
|
|
268
|
-
|
|
269
|
-
return ${channelVariable}.start.runStores(__apm$ctx, () => {
|
|
270
|
-
try {
|
|
271
|
-
return __apm$traced();
|
|
272
|
-
} catch (err) {
|
|
273
|
-
__apm$ctx.error = err;
|
|
274
|
-
${channelVariable}.error.publish(__apm$ctx);
|
|
275
|
-
throw err;
|
|
276
|
-
} finally {
|
|
277
|
-
__apm$ctx.self ??= this;
|
|
278
|
-
${channelVariable}.end.publish(__apm$ctx);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
767
|
+
const __bt$hook = ${channelGetter}();
|
|
768
|
+
if (!__bt$hook?.hasSubscribers) return __bt$traced();
|
|
769
|
+
__bt$ctx.self ??= this;
|
|
770
|
+
return __bt$hook.traceCallback(
|
|
771
|
+
__bt$traced,
|
|
772
|
+
${callbackIndex},
|
|
773
|
+
__bt$ctx
|
|
774
|
+
);
|
|
281
775
|
}
|
|
282
776
|
`);
|
|
283
777
|
}
|
|
284
778
|
function wrapPromise(state) {
|
|
285
779
|
const { channelName } = state;
|
|
286
|
-
const
|
|
780
|
+
const channelGetter = formatChannelGetter(channelName);
|
|
287
781
|
return (0, import_meriyah.parse)(`
|
|
288
782
|
function wrapper () {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
let promise = __apm$traced();
|
|
294
|
-
if (typeof promise?.then !== 'function') {
|
|
295
|
-
__apm$ctx.result = promise;
|
|
296
|
-
return promise;
|
|
297
|
-
}
|
|
298
|
-
// Mirror Node.js core diagnostics_channel behaviour: for native Promise
|
|
299
|
-
// instances, chain normally (safe since there is no subclass API to
|
|
300
|
-
// preserve). For Promise subclasses and other thenables, side-chain the
|
|
301
|
-
// callbacks for event publishing and return the original so that any
|
|
302
|
-
// subclass-specific methods (e.g. APIPromise.withResponse()) remain
|
|
303
|
-
// accessible to the caller.
|
|
304
|
-
if (promise instanceof Promise && promise.constructor === Promise) {
|
|
305
|
-
return promise.then(
|
|
306
|
-
result => {
|
|
307
|
-
__apm$ctx.result = result;
|
|
308
|
-
${channelVariable}.asyncStart.publish(__apm$ctx);
|
|
309
|
-
${channelVariable}.asyncEnd.publish(__apm$ctx);
|
|
310
|
-
return result;
|
|
311
|
-
},
|
|
312
|
-
err => {
|
|
313
|
-
__apm$ctx.error = err;
|
|
314
|
-
${channelVariable}.error.publish(__apm$ctx);
|
|
315
|
-
${channelVariable}.asyncStart.publish(__apm$ctx);
|
|
316
|
-
${channelVariable}.asyncEnd.publish(__apm$ctx);
|
|
317
|
-
throw err;
|
|
318
|
-
}
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
promise.then(
|
|
322
|
-
result => {
|
|
323
|
-
__apm$ctx.result = result;
|
|
324
|
-
${channelVariable}.asyncStart.publish(__apm$ctx);
|
|
325
|
-
${channelVariable}.asyncEnd.publish(__apm$ctx);
|
|
326
|
-
},
|
|
327
|
-
err => {
|
|
328
|
-
__apm$ctx.error = err;
|
|
329
|
-
${channelVariable}.error.publish(__apm$ctx);
|
|
330
|
-
${channelVariable}.asyncStart.publish(__apm$ctx);
|
|
331
|
-
${channelVariable}.asyncEnd.publish(__apm$ctx);
|
|
332
|
-
}
|
|
333
|
-
);
|
|
334
|
-
return promise;
|
|
335
|
-
} catch (err) {
|
|
336
|
-
__apm$ctx.error = err;
|
|
337
|
-
${channelVariable}.error.publish(__apm$ctx);
|
|
338
|
-
throw err;
|
|
339
|
-
} finally {
|
|
340
|
-
__apm$ctx.self ??= this;
|
|
341
|
-
${channelVariable}.end.publish(__apm$ctx);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
783
|
+
const __bt$hook = ${channelGetter}();
|
|
784
|
+
if (!__bt$hook?.hasSubscribers) return __bt$traced();
|
|
785
|
+
__bt$ctx.self ??= this;
|
|
786
|
+
return __bt$hook.tracePromise(__bt$traced, __bt$ctx);
|
|
344
787
|
}
|
|
345
788
|
`);
|
|
346
789
|
}
|
|
347
790
|
function wrapSync(state) {
|
|
348
791
|
const { channelName } = state;
|
|
349
|
-
const
|
|
792
|
+
const channelGetter = formatChannelGetter(channelName);
|
|
350
793
|
return (0, import_meriyah.parse)(`
|
|
351
794
|
function wrapper () {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const result = __apm$traced();
|
|
357
|
-
__apm$ctx.result = result;
|
|
358
|
-
return result;
|
|
359
|
-
} catch (err) {
|
|
360
|
-
__apm$ctx.error = err;
|
|
361
|
-
${channelVariable}.error.publish(__apm$ctx);
|
|
362
|
-
throw err;
|
|
363
|
-
} finally {
|
|
364
|
-
__apm$ctx.self ??= this;
|
|
365
|
-
${channelVariable}.end.publish(__apm$ctx);
|
|
366
|
-
}
|
|
367
|
-
});
|
|
795
|
+
const __bt$hook = ${channelGetter}();
|
|
796
|
+
if (!__bt$hook?.hasSubscribers) return __bt$traced();
|
|
797
|
+
__bt$ctx.self ??= this;
|
|
798
|
+
return __bt$hook.traceSync(__bt$traced, __bt$ctx);
|
|
368
799
|
}
|
|
369
800
|
`);
|
|
370
801
|
}
|
|
@@ -375,16 +806,14 @@ var Transformer = class {
|
|
|
375
806
|
version;
|
|
376
807
|
filePath;
|
|
377
808
|
configs = [];
|
|
378
|
-
|
|
379
|
-
constructor(moduleName, version, filePath, configs, dcModule) {
|
|
809
|
+
constructor(moduleName, version, filePath, configs) {
|
|
380
810
|
this.moduleName = moduleName;
|
|
381
811
|
this.version = version;
|
|
382
812
|
this.filePath = filePath;
|
|
383
813
|
this.configs = configs;
|
|
384
|
-
this.dcModule = dcModule;
|
|
385
814
|
}
|
|
386
815
|
/**
|
|
387
|
-
* Instruments `code` by injecting
|
|
816
|
+
* Instruments `code` by injecting global tracing hooks around the
|
|
388
817
|
* target functions defined by this transformer's configs.
|
|
389
818
|
*/
|
|
390
819
|
transform(code, moduleType) {
|
|
@@ -422,8 +851,6 @@ var Transformer = class {
|
|
|
422
851
|
const query = astQuery || this.fromFunctionQuery(resolvedFunctionQuery);
|
|
423
852
|
const state = {
|
|
424
853
|
...config,
|
|
425
|
-
dcModule: this.dcModule,
|
|
426
|
-
moduleType,
|
|
427
854
|
moduleVersion: this.version,
|
|
428
855
|
functionQuery: resolvedFunctionQuery,
|
|
429
856
|
operator: this.getOperator(resolvedFunctionQuery.kind)
|
|
@@ -573,11 +1000,9 @@ var Transformer = class {
|
|
|
573
1000
|
// src/auto-instrumentations/orchestrion-js/matcher.ts
|
|
574
1001
|
var InstrumentationMatcher = class {
|
|
575
1002
|
configs = [];
|
|
576
|
-
dcModule;
|
|
577
1003
|
transformers = {};
|
|
578
|
-
constructor(configs
|
|
1004
|
+
constructor(configs) {
|
|
579
1005
|
this.configs = configs;
|
|
580
|
-
this.dcModule = dcModule || "diagnostics_channel";
|
|
581
1006
|
}
|
|
582
1007
|
/**
|
|
583
1008
|
* Returns a Transformer for the given module/file/version, or undefined if no
|
|
@@ -599,8 +1024,7 @@ var InstrumentationMatcher = class {
|
|
|
599
1024
|
moduleName,
|
|
600
1025
|
version,
|
|
601
1026
|
filePath,
|
|
602
|
-
configs
|
|
603
|
-
this.dcModule
|
|
1027
|
+
configs
|
|
604
1028
|
);
|
|
605
1029
|
return this.transformers[id];
|
|
606
1030
|
}
|
|
@@ -610,8 +1034,8 @@ var InstrumentationMatcher = class {
|
|
|
610
1034
|
};
|
|
611
1035
|
|
|
612
1036
|
// src/auto-instrumentations/orchestrion-js/index.ts
|
|
613
|
-
function create(configs
|
|
614
|
-
return new InstrumentationMatcher(configs
|
|
1037
|
+
function create(configs) {
|
|
1038
|
+
return new InstrumentationMatcher(configs);
|
|
615
1039
|
}
|
|
616
1040
|
|
|
617
1041
|
// src/auto-instrumentations/bundler/plugin.ts
|
|
@@ -637,6 +1061,9 @@ var envIntegrationAliases = {
|
|
|
637
1061
|
strandsagentsdk: "strandsAgentSDK",
|
|
638
1062
|
"strands-agent-sdk": "strandsAgentSDK",
|
|
639
1063
|
"@strands-agents/sdk": "strandsAgentSDK",
|
|
1064
|
+
agents: "cloudflareAgents",
|
|
1065
|
+
"cloudflare-agents": "cloudflareAgents",
|
|
1066
|
+
cloudflareagents: "cloudflareAgents",
|
|
640
1067
|
anthropic: "anthropic",
|
|
641
1068
|
aisdk: "aisdk",
|
|
642
1069
|
"ai-sdk": "aisdk",
|
|
@@ -644,6 +1071,9 @@ var envIntegrationAliases = {
|
|
|
644
1071
|
vercel: "vercel",
|
|
645
1072
|
claudeagentsdk: "claudeAgentSDK",
|
|
646
1073
|
"claude-agent-sdk": "claudeAgentSDK",
|
|
1074
|
+
cloudflareaichat: "cloudflareAIChat",
|
|
1075
|
+
"cloudflare-ai-chat": "cloudflareAIChat",
|
|
1076
|
+
"@cloudflare/ai-chat": "cloudflareAIChat",
|
|
647
1077
|
cursor: "cursor",
|
|
648
1078
|
"cursor-sdk": "cursorSDK",
|
|
649
1079
|
cursorsdk: "cursorSDK",
|
|
@@ -658,6 +1088,8 @@ var envIntegrationAliases = {
|
|
|
658
1088
|
"google-genai": "googleGenAI",
|
|
659
1089
|
googlegenai: "googleGenAI",
|
|
660
1090
|
huggingface: "huggingface",
|
|
1091
|
+
"@huggingface/transformers": "huggingface",
|
|
1092
|
+
transformers: "huggingface",
|
|
661
1093
|
openrouter: "openrouter",
|
|
662
1094
|
openrouteragent: "openrouterAgent",
|
|
663
1095
|
"openrouter-agent": "openrouterAgent",
|
|
@@ -714,73 +1146,6 @@ var DefaultAsyncLocalStorage = class {
|
|
|
714
1146
|
return void 0;
|
|
715
1147
|
}
|
|
716
1148
|
};
|
|
717
|
-
var DefaultChannel = class {
|
|
718
|
-
constructor(name) {
|
|
719
|
-
this.name = name;
|
|
720
|
-
}
|
|
721
|
-
name;
|
|
722
|
-
hasSubscribers = false;
|
|
723
|
-
subscribe(_subscription) {
|
|
724
|
-
}
|
|
725
|
-
unsubscribe(_subscription) {
|
|
726
|
-
return false;
|
|
727
|
-
}
|
|
728
|
-
bindStore(_store, _transform) {
|
|
729
|
-
}
|
|
730
|
-
unbindStore(_store) {
|
|
731
|
-
return false;
|
|
732
|
-
}
|
|
733
|
-
publish(_message) {
|
|
734
|
-
}
|
|
735
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
736
|
-
runStores(_message, fn, thisArg, ...args) {
|
|
737
|
-
return fn.apply(thisArg, args);
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
var DefaultTracingChannel = class {
|
|
741
|
-
start;
|
|
742
|
-
end;
|
|
743
|
-
asyncStart;
|
|
744
|
-
asyncEnd;
|
|
745
|
-
error;
|
|
746
|
-
constructor(nameOrChannels) {
|
|
747
|
-
if (typeof nameOrChannels === "string") {
|
|
748
|
-
this.start = new DefaultChannel(`tracing:${nameOrChannels}:start`);
|
|
749
|
-
this.end = new DefaultChannel(`tracing:${nameOrChannels}:end`);
|
|
750
|
-
this.asyncStart = new DefaultChannel(
|
|
751
|
-
`tracing:${nameOrChannels}:asyncStart`
|
|
752
|
-
);
|
|
753
|
-
this.asyncEnd = new DefaultChannel(`tracing:${nameOrChannels}:asyncEnd`);
|
|
754
|
-
this.error = new DefaultChannel(`tracing:${nameOrChannels}:error`);
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
this.start = nameOrChannels.start ?? new DefaultChannel("tracing:start");
|
|
758
|
-
this.end = nameOrChannels.end ?? new DefaultChannel("tracing:end");
|
|
759
|
-
this.asyncStart = nameOrChannels.asyncStart ?? new DefaultChannel("tracing:asyncStart");
|
|
760
|
-
this.asyncEnd = nameOrChannels.asyncEnd ?? new DefaultChannel("tracing:asyncEnd");
|
|
761
|
-
this.error = nameOrChannels.error ?? new DefaultChannel("tracing:error");
|
|
762
|
-
}
|
|
763
|
-
get hasSubscribers() {
|
|
764
|
-
return this.start.hasSubscribers || this.end.hasSubscribers || this.asyncStart.hasSubscribers || this.asyncEnd.hasSubscribers || this.error.hasSubscribers;
|
|
765
|
-
}
|
|
766
|
-
subscribe(_handlers) {
|
|
767
|
-
}
|
|
768
|
-
unsubscribe(_handlers) {
|
|
769
|
-
return false;
|
|
770
|
-
}
|
|
771
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
772
|
-
traceSync(fn, _message, thisArg, ...args) {
|
|
773
|
-
return fn.apply(thisArg, args);
|
|
774
|
-
}
|
|
775
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
776
|
-
tracePromise(fn, _message, thisArg, ...args) {
|
|
777
|
-
return fn.apply(thisArg, args);
|
|
778
|
-
}
|
|
779
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
780
|
-
traceCallback(fn, _position, _message, thisArg, ...args) {
|
|
781
|
-
return fn.apply(thisArg, args);
|
|
782
|
-
}
|
|
783
|
-
};
|
|
784
1149
|
var iso = {
|
|
785
1150
|
buildType: "unknown",
|
|
786
1151
|
// Will be set by configureBrowser() or configureNode()
|
|
@@ -791,7 +1156,7 @@ var iso = {
|
|
|
791
1156
|
getCallerLocation: () => void 0,
|
|
792
1157
|
newAsyncLocalStorage: () => new DefaultAsyncLocalStorage(),
|
|
793
1158
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
794
|
-
newTracingChannel: (nameOrChannels) =>
|
|
1159
|
+
newTracingChannel: (nameOrChannels) => newGlobalTracingChannel(nameOrChannels),
|
|
795
1160
|
processOn: (_0, _1) => {
|
|
796
1161
|
},
|
|
797
1162
|
basename: (filepath) => filepath.split(/[\\/]/).pop() || filepath,
|
|
@@ -804,7 +1169,8 @@ var isomorph_default = iso;
|
|
|
804
1169
|
function channel(spec) {
|
|
805
1170
|
return spec;
|
|
806
1171
|
}
|
|
807
|
-
function defineChannels(pkg, channels) {
|
|
1172
|
+
function defineChannels(pkg, channels, options) {
|
|
1173
|
+
const { instrumentationName } = options;
|
|
808
1174
|
return Object.fromEntries(
|
|
809
1175
|
Object.entries(channels).map(([key, spec]) => {
|
|
810
1176
|
const fullChannelName = `orchestrion:${pkg}:${spec.channelName}`;
|
|
@@ -817,6 +1183,7 @@ function defineChannels(pkg, channels) {
|
|
|
817
1183
|
key,
|
|
818
1184
|
{
|
|
819
1185
|
...asyncSpec,
|
|
1186
|
+
instrumentationName,
|
|
820
1187
|
tracingChannel: tracingChannel2,
|
|
821
1188
|
tracePromise: (fn, context) => tracingChannel2().tracePromise(
|
|
822
1189
|
fn,
|
|
@@ -834,6 +1201,7 @@ function defineChannels(pkg, channels) {
|
|
|
834
1201
|
key,
|
|
835
1202
|
{
|
|
836
1203
|
...syncSpec,
|
|
1204
|
+
instrumentationName,
|
|
837
1205
|
tracingChannel,
|
|
838
1206
|
traceSync: (fn, context) => tracingChannel().traceSync(
|
|
839
1207
|
fn,
|
|
@@ -846,93 +1214,135 @@ function defineChannels(pkg, channels) {
|
|
|
846
1214
|
);
|
|
847
1215
|
}
|
|
848
1216
|
|
|
1217
|
+
// src/span-origin.ts
|
|
1218
|
+
var INSTRUMENTATION_NAMES = {
|
|
1219
|
+
AI_SDK: "ai-sdk",
|
|
1220
|
+
ANTHROPIC: "anthropic",
|
|
1221
|
+
BEDROCK_RUNTIME: "bedrock-runtime",
|
|
1222
|
+
BRAINTRUST_JS_LOGGER: "braintrust-js-logger",
|
|
1223
|
+
CLAUDE_AGENT_SDK: "claude-agent-sdk",
|
|
1224
|
+
CLOUDFLARE_AI_CHAT: "cloudflare-ai-chat",
|
|
1225
|
+
CLOUDFLARE_AGENTS: "cloudflare-agents",
|
|
1226
|
+
COHERE: "cohere",
|
|
1227
|
+
CURSOR_SDK: "cursor-sdk",
|
|
1228
|
+
EVE: "eve",
|
|
1229
|
+
FLUE: "flue",
|
|
1230
|
+
GENKIT: "genkit",
|
|
1231
|
+
GITHUB_COPILOT: "github-copilot",
|
|
1232
|
+
GOOGLE_ADK: "google-adk",
|
|
1233
|
+
GOOGLE_GENAI: "google-genai",
|
|
1234
|
+
GROQ: "groq",
|
|
1235
|
+
HUGGINGFACE: "huggingface",
|
|
1236
|
+
LANGCHAIN: "langchain",
|
|
1237
|
+
LANGSMITH: "langsmith",
|
|
1238
|
+
MASTRA: "mastra",
|
|
1239
|
+
MISTRAL: "mistral",
|
|
1240
|
+
OPENAI: "openai",
|
|
1241
|
+
OPENAI_AGENTS: "openai-agents",
|
|
1242
|
+
OPENAI_CODEX: "openai-codex",
|
|
1243
|
+
OPENROUTER: "openrouter",
|
|
1244
|
+
OPENROUTER_AGENT: "openrouter-agent",
|
|
1245
|
+
PI_CODING_AGENT: "pi-coding-agent",
|
|
1246
|
+
STRANDS_AGENT_SDK: "strands-agent-sdk"
|
|
1247
|
+
};
|
|
1248
|
+
|
|
849
1249
|
// src/instrumentation/plugins/ai-sdk-channels.ts
|
|
850
|
-
var aiSDKChannels = defineChannels(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
1250
|
+
var aiSDKChannels = defineChannels(
|
|
1251
|
+
"ai",
|
|
1252
|
+
{
|
|
1253
|
+
generateText: channel({
|
|
1254
|
+
channelName: "generateText",
|
|
1255
|
+
kind: "async"
|
|
1256
|
+
}),
|
|
1257
|
+
streamText: channel({
|
|
1258
|
+
channelName: "streamText",
|
|
1259
|
+
kind: "async"
|
|
1260
|
+
}),
|
|
1261
|
+
streamTextSync: channel({
|
|
1262
|
+
channelName: "streamText.sync",
|
|
1263
|
+
kind: "sync-stream"
|
|
1264
|
+
}),
|
|
1265
|
+
generateObject: channel({
|
|
1266
|
+
channelName: "generateObject",
|
|
1267
|
+
kind: "async"
|
|
1268
|
+
}),
|
|
1269
|
+
streamObject: channel({
|
|
1270
|
+
channelName: "streamObject",
|
|
1271
|
+
kind: "async"
|
|
1272
|
+
}),
|
|
1273
|
+
streamObjectSync: channel({
|
|
1274
|
+
channelName: "streamObject.sync",
|
|
1275
|
+
kind: "sync-stream"
|
|
1276
|
+
}),
|
|
1277
|
+
embed: channel({
|
|
877
1278
|
channelName: "embed",
|
|
878
1279
|
kind: "async"
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1280
|
+
}),
|
|
1281
|
+
embedMany: channel({
|
|
1282
|
+
channelName: "embedMany",
|
|
1283
|
+
kind: "async"
|
|
1284
|
+
}),
|
|
1285
|
+
rerank: channel({
|
|
1286
|
+
channelName: "rerank",
|
|
1287
|
+
kind: "async"
|
|
1288
|
+
}),
|
|
1289
|
+
agentGenerate: channel({
|
|
1290
|
+
channelName: "Agent.generate",
|
|
1291
|
+
kind: "async"
|
|
1292
|
+
}),
|
|
1293
|
+
agentStream: channel({
|
|
1294
|
+
channelName: "Agent.stream",
|
|
1295
|
+
kind: "async"
|
|
1296
|
+
}),
|
|
1297
|
+
agentStreamSync: channel({
|
|
1298
|
+
channelName: "Agent.stream.sync",
|
|
1299
|
+
kind: "sync-stream"
|
|
1300
|
+
}),
|
|
1301
|
+
toolLoopAgentGenerate: channel({
|
|
1302
|
+
channelName: "ToolLoopAgent.generate",
|
|
1303
|
+
kind: "async"
|
|
1304
|
+
}),
|
|
1305
|
+
toolLoopAgentStream: channel({
|
|
1306
|
+
channelName: "ToolLoopAgent.stream",
|
|
1307
|
+
kind: "async"
|
|
1308
|
+
}),
|
|
1309
|
+
workflowAgentStream: channel({
|
|
1310
|
+
channelName: "WorkflowAgent.stream",
|
|
1311
|
+
kind: "async"
|
|
1312
|
+
}),
|
|
1313
|
+
v7CreateTelemetryDispatcher: channel({
|
|
1314
|
+
channelName: "createTelemetryDispatcher",
|
|
1315
|
+
kind: "sync-stream"
|
|
1316
|
+
})
|
|
1317
|
+
},
|
|
1318
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.AI_SDK }
|
|
1319
|
+
);
|
|
1320
|
+
var harnessAgentChannels = defineChannels(
|
|
1321
|
+
"@ai-sdk/harness",
|
|
1322
|
+
{
|
|
1323
|
+
createSession: channel({
|
|
1324
|
+
channelName: "HarnessAgent.createSession",
|
|
1325
|
+
kind: "async"
|
|
1326
|
+
}),
|
|
1327
|
+
generate: channel({
|
|
1328
|
+
channelName: "HarnessAgent.generate",
|
|
1329
|
+
kind: "async"
|
|
1330
|
+
}),
|
|
1331
|
+
stream: channel({
|
|
1332
|
+
channelName: "HarnessAgent.stream",
|
|
1333
|
+
kind: "async"
|
|
1334
|
+
}),
|
|
1335
|
+
continueGenerate: channel({
|
|
1336
|
+
channelName: "HarnessAgent.continueGenerate",
|
|
1337
|
+
kind: "async"
|
|
1338
|
+
}),
|
|
1339
|
+
continueStream: channel({
|
|
1340
|
+
channelName: "HarnessAgent.continueStream",
|
|
1341
|
+
kind: "async"
|
|
1342
|
+
})
|
|
1343
|
+
},
|
|
1344
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.AI_SDK }
|
|
1345
|
+
);
|
|
936
1346
|
|
|
937
1347
|
// src/auto-instrumentations/configs/ai-sdk.ts
|
|
938
1348
|
var aiSDKConfigs = [
|
|
@@ -940,6 +1350,7 @@ var aiSDKConfigs = [
|
|
|
940
1350
|
// `./agent` entrypoint. The compiled class expression is anonymous, so match
|
|
941
1351
|
// the first async method with each public name instead of a class name.
|
|
942
1352
|
...[
|
|
1353
|
+
["createSession", harnessAgentChannels.createSession.channelName],
|
|
943
1354
|
["generate", harnessAgentChannels.generate.channelName],
|
|
944
1355
|
["stream", harnessAgentChannels.stream.channelName],
|
|
945
1356
|
["continueGenerate", harnessAgentChannels.continueGenerate.channelName],
|
|
@@ -1328,20 +1739,24 @@ var aiSDKConfigs = [
|
|
|
1328
1739
|
];
|
|
1329
1740
|
|
|
1330
1741
|
// src/instrumentation/plugins/anthropic-channels.ts
|
|
1331
|
-
var anthropicChannels = defineChannels(
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1742
|
+
var anthropicChannels = defineChannels(
|
|
1743
|
+
"@anthropic-ai/sdk",
|
|
1744
|
+
{
|
|
1745
|
+
messagesCreate: channel({
|
|
1746
|
+
channelName: "messages.create",
|
|
1747
|
+
kind: "async"
|
|
1748
|
+
}),
|
|
1749
|
+
betaMessagesCreate: channel({
|
|
1750
|
+
channelName: "beta.messages.create",
|
|
1751
|
+
kind: "async"
|
|
1752
|
+
}),
|
|
1753
|
+
betaMessagesToolRunner: channel({
|
|
1754
|
+
channelName: "beta.messages.toolRunner",
|
|
1755
|
+
kind: "sync-stream"
|
|
1756
|
+
})
|
|
1757
|
+
},
|
|
1758
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.ANTHROPIC }
|
|
1759
|
+
);
|
|
1345
1760
|
|
|
1346
1761
|
// src/auto-instrumentations/configs/anthropic.ts
|
|
1347
1762
|
var anthropicConfigs = [
|
|
@@ -1464,15 +1879,27 @@ var clientSendChannel = channel({
|
|
|
1464
1879
|
channelName: "client.send",
|
|
1465
1880
|
kind: "async"
|
|
1466
1881
|
});
|
|
1467
|
-
var bedrockRuntimeChannels = defineChannels(
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1882
|
+
var bedrockRuntimeChannels = defineChannels(
|
|
1883
|
+
"aws-bedrock-runtime",
|
|
1884
|
+
{
|
|
1885
|
+
clientSend: clientSendChannel
|
|
1886
|
+
},
|
|
1887
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.BEDROCK_RUNTIME }
|
|
1888
|
+
);
|
|
1889
|
+
var smithyCoreChannels = defineChannels(
|
|
1890
|
+
"@smithy/core",
|
|
1891
|
+
{
|
|
1892
|
+
clientSend: clientSendChannel
|
|
1893
|
+
},
|
|
1894
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.BEDROCK_RUNTIME }
|
|
1895
|
+
);
|
|
1896
|
+
var smithyClientChannels = defineChannels(
|
|
1897
|
+
"@smithy/smithy-client",
|
|
1898
|
+
{
|
|
1899
|
+
clientSend: clientSendChannel
|
|
1900
|
+
},
|
|
1901
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.BEDROCK_RUNTIME }
|
|
1902
|
+
);
|
|
1476
1903
|
|
|
1477
1904
|
// src/auto-instrumentations/configs/bedrock-runtime.ts
|
|
1478
1905
|
var bedrockRuntimeConfigs = [
|
|
@@ -1538,7 +1965,8 @@ var claudeAgentSDKChannels = defineChannels(
|
|
|
1538
1965
|
channelName: "query",
|
|
1539
1966
|
kind: "sync-stream"
|
|
1540
1967
|
})
|
|
1541
|
-
}
|
|
1968
|
+
},
|
|
1969
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CLAUDE_AGENT_SDK }
|
|
1542
1970
|
);
|
|
1543
1971
|
|
|
1544
1972
|
// src/auto-instrumentations/configs/claude-agent-sdk.ts
|
|
@@ -1572,25 +2000,97 @@ var claudeAgentSDKConfigs = [
|
|
|
1572
2000
|
}
|
|
1573
2001
|
];
|
|
1574
2002
|
|
|
2003
|
+
// src/instrumentation/plugins/cloudflare-ai-chat-channels.ts
|
|
2004
|
+
var cloudflareAIChatChannels = defineChannels(
|
|
2005
|
+
"@cloudflare/ai-chat",
|
|
2006
|
+
{
|
|
2007
|
+
runExclusiveChatTurn: channel({
|
|
2008
|
+
channelName: "AIChatAgent._runExclusiveChatTurn",
|
|
2009
|
+
kind: "async"
|
|
2010
|
+
}),
|
|
2011
|
+
onChatResponse: channel({
|
|
2012
|
+
channelName: "AIChatAgent.onChatResponse",
|
|
2013
|
+
kind: "sync-stream"
|
|
2014
|
+
})
|
|
2015
|
+
},
|
|
2016
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_AI_CHAT }
|
|
2017
|
+
);
|
|
2018
|
+
|
|
2019
|
+
// src/auto-instrumentations/configs/cloudflare-ai-chat.ts
|
|
2020
|
+
var cloudflareAIChatVersionRange = ">=0.9.0 <0.10.0";
|
|
2021
|
+
var cloudflareAIChatConfigs = [
|
|
2022
|
+
{
|
|
2023
|
+
// AIChatAgent subclasses replace onChatMessage, so there is no stable
|
|
2024
|
+
// public implementation for the transformer to target. This runner is
|
|
2025
|
+
// the narrowest shared boundary around every chat turn; keep the version
|
|
2026
|
+
// range tight because it is an internal method.
|
|
2027
|
+
channelName: cloudflareAIChatChannels.runExclusiveChatTurn.channelName,
|
|
2028
|
+
module: {
|
|
2029
|
+
name: "@cloudflare/ai-chat",
|
|
2030
|
+
versionRange: cloudflareAIChatVersionRange,
|
|
2031
|
+
filePath: "dist/index.js"
|
|
2032
|
+
},
|
|
2033
|
+
functionQuery: {
|
|
2034
|
+
className: "AIChatAgent",
|
|
2035
|
+
methodName: "_runExclusiveChatTurn",
|
|
2036
|
+
kind: "Async"
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
];
|
|
2040
|
+
|
|
2041
|
+
// src/instrumentation/plugins/cloudflare-agents-channels.ts
|
|
2042
|
+
var cloudflareAgentsChannels = defineChannels(
|
|
2043
|
+
"agents",
|
|
2044
|
+
{
|
|
2045
|
+
runAgentTool: channel({
|
|
2046
|
+
channelName: "Agent.runAgentTool",
|
|
2047
|
+
kind: "async"
|
|
2048
|
+
})
|
|
2049
|
+
},
|
|
2050
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_AGENTS }
|
|
2051
|
+
);
|
|
2052
|
+
|
|
2053
|
+
// src/auto-instrumentations/configs/cloudflare-agents.ts
|
|
2054
|
+
var cloudflareAgentsVersionRange = ">=0.17.0 <0.18.0";
|
|
2055
|
+
var cloudflareAgentsConfigs = [
|
|
2056
|
+
{
|
|
2057
|
+
channelName: cloudflareAgentsChannels.runAgentTool.channelName,
|
|
2058
|
+
module: {
|
|
2059
|
+
name: "agents",
|
|
2060
|
+
versionRange: cloudflareAgentsVersionRange,
|
|
2061
|
+
filePath: "dist/index.js"
|
|
2062
|
+
},
|
|
2063
|
+
functionQuery: {
|
|
2064
|
+
className: "Agent",
|
|
2065
|
+
methodName: "runAgentTool",
|
|
2066
|
+
kind: "Async"
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
];
|
|
2070
|
+
|
|
1575
2071
|
// src/instrumentation/plugins/cohere-channels.ts
|
|
1576
|
-
var cohereChannels = defineChannels(
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
2072
|
+
var cohereChannels = defineChannels(
|
|
2073
|
+
"cohere-ai",
|
|
2074
|
+
{
|
|
2075
|
+
chat: channel({
|
|
2076
|
+
channelName: "chat",
|
|
2077
|
+
kind: "async"
|
|
2078
|
+
}),
|
|
2079
|
+
chatStream: channel({
|
|
2080
|
+
channelName: "chatStream",
|
|
2081
|
+
kind: "async"
|
|
2082
|
+
}),
|
|
2083
|
+
embed: channel({
|
|
2084
|
+
channelName: "embed",
|
|
2085
|
+
kind: "async"
|
|
2086
|
+
}),
|
|
2087
|
+
rerank: channel({
|
|
2088
|
+
channelName: "rerank",
|
|
2089
|
+
kind: "async"
|
|
2090
|
+
})
|
|
2091
|
+
},
|
|
2092
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.COHERE }
|
|
2093
|
+
);
|
|
1594
2094
|
|
|
1595
2095
|
// src/auto-instrumentations/configs/cohere.ts
|
|
1596
2096
|
var cohereConfigs = [
|
|
@@ -1857,24 +2357,28 @@ var cohereConfigs = [
|
|
|
1857
2357
|
];
|
|
1858
2358
|
|
|
1859
2359
|
// src/instrumentation/plugins/cursor-sdk-channels.ts
|
|
1860
|
-
var cursorSDKChannels = defineChannels(
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
2360
|
+
var cursorSDKChannels = defineChannels(
|
|
2361
|
+
"@cursor/sdk",
|
|
2362
|
+
{
|
|
2363
|
+
create: channel({
|
|
2364
|
+
channelName: "Agent.create",
|
|
2365
|
+
kind: "async"
|
|
2366
|
+
}),
|
|
2367
|
+
resume: channel({
|
|
2368
|
+
channelName: "Agent.resume",
|
|
2369
|
+
kind: "async"
|
|
2370
|
+
}),
|
|
2371
|
+
prompt: channel({
|
|
2372
|
+
channelName: "Agent.prompt",
|
|
2373
|
+
kind: "async"
|
|
2374
|
+
}),
|
|
2375
|
+
send: channel({
|
|
2376
|
+
channelName: "agent.send",
|
|
2377
|
+
kind: "async"
|
|
2378
|
+
})
|
|
2379
|
+
},
|
|
2380
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CURSOR_SDK }
|
|
2381
|
+
);
|
|
1878
2382
|
|
|
1879
2383
|
// src/auto-instrumentations/configs/cursor-sdk.ts
|
|
1880
2384
|
var cursorSDKVersionRange = ">=1.0.7 <2.0.0";
|
|
@@ -1922,12 +2426,16 @@ var cursorSDKConfigs = cursorSDKEntrypoints.flatMap((filePath) => [
|
|
|
1922
2426
|
]);
|
|
1923
2427
|
|
|
1924
2428
|
// src/instrumentation/plugins/flue-channels.ts
|
|
1925
|
-
var flueChannels = defineChannels(
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
2429
|
+
var flueChannels = defineChannels(
|
|
2430
|
+
"@flue/runtime",
|
|
2431
|
+
{
|
|
2432
|
+
createContext: channel({
|
|
2433
|
+
channelName: "createFlueContext",
|
|
2434
|
+
kind: "sync-stream"
|
|
2435
|
+
})
|
|
2436
|
+
},
|
|
2437
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.FLUE }
|
|
2438
|
+
);
|
|
1931
2439
|
|
|
1932
2440
|
// src/auto-instrumentations/configs/flue.ts
|
|
1933
2441
|
var flueVersionRange = ">=0.8.0 <1.0.0";
|
|
@@ -1947,38 +2455,46 @@ var flueConfigs = [
|
|
|
1947
2455
|
];
|
|
1948
2456
|
|
|
1949
2457
|
// src/instrumentation/plugins/genkit-channels.ts
|
|
1950
|
-
var genkitChannels = defineChannels(
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
2458
|
+
var genkitChannels = defineChannels(
|
|
2459
|
+
"@genkit-ai/ai",
|
|
2460
|
+
{
|
|
2461
|
+
generate: channel({
|
|
2462
|
+
channelName: "generate",
|
|
2463
|
+
kind: "async"
|
|
2464
|
+
}),
|
|
2465
|
+
generateStream: channel({
|
|
2466
|
+
channelName: "generateStream",
|
|
2467
|
+
kind: "sync-stream"
|
|
2468
|
+
}),
|
|
2469
|
+
embed: channel({
|
|
2470
|
+
channelName: "embed",
|
|
2471
|
+
kind: "async"
|
|
2472
|
+
}),
|
|
2473
|
+
embedMany: channel({
|
|
2474
|
+
channelName: "embedMany",
|
|
2475
|
+
kind: "async"
|
|
2476
|
+
}),
|
|
2477
|
+
actionRun: channel({
|
|
2478
|
+
channelName: "action.run",
|
|
2479
|
+
kind: "async"
|
|
2480
|
+
}),
|
|
2481
|
+
actionStream: channel({
|
|
2482
|
+
channelName: "action.stream",
|
|
2483
|
+
kind: "sync-stream"
|
|
2484
|
+
})
|
|
2485
|
+
},
|
|
2486
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.GENKIT }
|
|
2487
|
+
);
|
|
2488
|
+
var genkitCoreChannels = defineChannels(
|
|
2489
|
+
"@genkit-ai/core",
|
|
2490
|
+
{
|
|
2491
|
+
actionSpan: channel({
|
|
2492
|
+
channelName: "action.span",
|
|
2493
|
+
kind: "async"
|
|
2494
|
+
})
|
|
2495
|
+
},
|
|
2496
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.GENKIT }
|
|
2497
|
+
);
|
|
1982
2498
|
|
|
1983
2499
|
// src/auto-instrumentations/configs/genkit.ts
|
|
1984
2500
|
var genkitVersionRange = ">=1.0.0 <2.0.0";
|
|
@@ -2140,20 +2656,24 @@ var genkitConfigs = [
|
|
|
2140
2656
|
];
|
|
2141
2657
|
|
|
2142
2658
|
// src/instrumentation/plugins/github-copilot-channels.ts
|
|
2143
|
-
var gitHubCopilotChannels = defineChannels(
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2659
|
+
var gitHubCopilotChannels = defineChannels(
|
|
2660
|
+
"@github/copilot-sdk",
|
|
2661
|
+
{
|
|
2662
|
+
createSession: channel({
|
|
2663
|
+
channelName: "client.createSession",
|
|
2664
|
+
kind: "async"
|
|
2665
|
+
}),
|
|
2666
|
+
resumeSession: channel({
|
|
2667
|
+
channelName: "client.resumeSession",
|
|
2668
|
+
kind: "async"
|
|
2669
|
+
}),
|
|
2670
|
+
sendAndWait: channel({
|
|
2671
|
+
channelName: "session.sendAndWait",
|
|
2672
|
+
kind: "async"
|
|
2673
|
+
})
|
|
2674
|
+
},
|
|
2675
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.GITHUB_COPILOT }
|
|
2676
|
+
);
|
|
2157
2677
|
|
|
2158
2678
|
// src/auto-instrumentations/configs/github-copilot.ts
|
|
2159
2679
|
var gitHubCopilotConfigs = [
|
|
@@ -2244,20 +2764,24 @@ var gitHubCopilotConfigs = [
|
|
|
2244
2764
|
];
|
|
2245
2765
|
|
|
2246
2766
|
// src/instrumentation/plugins/google-adk-channels.ts
|
|
2247
|
-
var googleADKChannels = defineChannels(
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2767
|
+
var googleADKChannels = defineChannels(
|
|
2768
|
+
"@google/adk",
|
|
2769
|
+
{
|
|
2770
|
+
runnerRunAsync: channel({
|
|
2771
|
+
channelName: "runner.runAsync",
|
|
2772
|
+
kind: "sync-stream"
|
|
2773
|
+
}),
|
|
2774
|
+
agentRunAsync: channel({
|
|
2775
|
+
channelName: "agent.runAsync",
|
|
2776
|
+
kind: "sync-stream"
|
|
2777
|
+
}),
|
|
2778
|
+
toolRunAsync: channel({
|
|
2779
|
+
channelName: "tool.runAsync",
|
|
2780
|
+
kind: "async"
|
|
2781
|
+
})
|
|
2782
|
+
},
|
|
2783
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.GOOGLE_ADK }
|
|
2784
|
+
);
|
|
2261
2785
|
|
|
2262
2786
|
// src/auto-instrumentations/configs/google-adk.ts
|
|
2263
2787
|
var googleADKVersionRange = ">=0.1.0";
|
|
@@ -2488,24 +3012,28 @@ var googleADKConfigs = [
|
|
|
2488
3012
|
];
|
|
2489
3013
|
|
|
2490
3014
|
// src/instrumentation/plugins/google-genai-channels.ts
|
|
2491
|
-
var googleGenAIChannels = defineChannels(
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
3015
|
+
var googleGenAIChannels = defineChannels(
|
|
3016
|
+
"@google/genai",
|
|
3017
|
+
{
|
|
3018
|
+
generateContent: channel({
|
|
3019
|
+
channelName: "models.generateContent",
|
|
3020
|
+
kind: "async"
|
|
3021
|
+
}),
|
|
3022
|
+
generateContentStream: channel({
|
|
3023
|
+
channelName: "models.generateContentStream",
|
|
3024
|
+
kind: "async"
|
|
3025
|
+
}),
|
|
3026
|
+
embedContent: channel({
|
|
3027
|
+
channelName: "models.embedContent",
|
|
3028
|
+
kind: "async"
|
|
3029
|
+
}),
|
|
3030
|
+
interactionsCreate: channel({
|
|
3031
|
+
channelName: "interactions.create",
|
|
3032
|
+
kind: "async"
|
|
3033
|
+
})
|
|
3034
|
+
},
|
|
3035
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.GOOGLE_GENAI }
|
|
3036
|
+
);
|
|
2509
3037
|
|
|
2510
3038
|
// src/auto-instrumentations/configs/google-genai.ts
|
|
2511
3039
|
var googleGenAIConfigs = [
|
|
@@ -2585,18 +3113,20 @@ var googleGenAIConfigs = [
|
|
|
2585
3113
|
];
|
|
2586
3114
|
|
|
2587
3115
|
// src/instrumentation/plugins/groq-channels.ts
|
|
2588
|
-
var groqChannels = defineChannels(
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
3116
|
+
var groqChannels = defineChannels(
|
|
3117
|
+
"groq-sdk",
|
|
3118
|
+
{
|
|
3119
|
+
chatCompletionsCreate: channel({
|
|
3120
|
+
channelName: "chat.completions.create",
|
|
3121
|
+
kind: "async"
|
|
3122
|
+
}),
|
|
3123
|
+
embeddingsCreate: channel({
|
|
2595
3124
|
channelName: "embeddings.create",
|
|
2596
3125
|
kind: "async"
|
|
2597
|
-
}
|
|
2598
|
-
|
|
2599
|
-
}
|
|
3126
|
+
})
|
|
3127
|
+
},
|
|
3128
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.GROQ }
|
|
3129
|
+
);
|
|
2600
3130
|
|
|
2601
3131
|
// src/auto-instrumentations/configs/groq.ts
|
|
2602
3132
|
var groqConfigs = [
|
|
@@ -2629,28 +3159,32 @@ var groqConfigs = [
|
|
|
2629
3159
|
];
|
|
2630
3160
|
|
|
2631
3161
|
// src/instrumentation/plugins/huggingface-channels.ts
|
|
2632
|
-
var huggingFaceChannels = defineChannels(
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
3162
|
+
var huggingFaceChannels = defineChannels(
|
|
3163
|
+
"@huggingface/inference",
|
|
3164
|
+
{
|
|
3165
|
+
chatCompletion: channel({
|
|
3166
|
+
channelName: "chatCompletion",
|
|
3167
|
+
kind: "async"
|
|
3168
|
+
}),
|
|
3169
|
+
chatCompletionStream: channel({
|
|
3170
|
+
channelName: "chatCompletionStream",
|
|
3171
|
+
kind: "sync-stream"
|
|
3172
|
+
}),
|
|
3173
|
+
textGeneration: channel({
|
|
3174
|
+
channelName: "textGeneration",
|
|
3175
|
+
kind: "async"
|
|
3176
|
+
}),
|
|
3177
|
+
textGenerationStream: channel({
|
|
3178
|
+
channelName: "textGenerationStream",
|
|
3179
|
+
kind: "sync-stream"
|
|
3180
|
+
}),
|
|
3181
|
+
featureExtraction: channel({
|
|
3182
|
+
channelName: "featureExtraction",
|
|
3183
|
+
kind: "async"
|
|
3184
|
+
})
|
|
3185
|
+
},
|
|
3186
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.HUGGINGFACE }
|
|
3187
|
+
);
|
|
2654
3188
|
|
|
2655
3189
|
// src/auto-instrumentations/configs/huggingface.ts
|
|
2656
3190
|
var huggingFaceConfigs = [
|
|
@@ -2896,17 +3430,98 @@ var huggingFaceConfigs = [
|
|
|
2896
3430
|
}
|
|
2897
3431
|
];
|
|
2898
3432
|
|
|
3433
|
+
// src/instrumentation/plugins/huggingface-transformers-channels.ts
|
|
3434
|
+
var huggingFaceTransformersChannels = defineChannels(
|
|
3435
|
+
"@huggingface/transformers",
|
|
3436
|
+
{
|
|
3437
|
+
pipeline: channel({
|
|
3438
|
+
channelName: "pipeline",
|
|
3439
|
+
kind: "async"
|
|
3440
|
+
}),
|
|
3441
|
+
pipelineCall: channel({
|
|
3442
|
+
channelName: "pipeline.call",
|
|
3443
|
+
kind: "async"
|
|
3444
|
+
})
|
|
3445
|
+
},
|
|
3446
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.HUGGINGFACE }
|
|
3447
|
+
);
|
|
3448
|
+
|
|
3449
|
+
// src/auto-instrumentations/configs/huggingface-transformers.ts
|
|
3450
|
+
var moduleFiles = [
|
|
3451
|
+
{
|
|
3452
|
+
filePath: "dist/transformers.mjs",
|
|
3453
|
+
versionRange: ">=3.0.0 <3.4.0"
|
|
3454
|
+
},
|
|
3455
|
+
{
|
|
3456
|
+
filePath: "dist/transformers.cjs",
|
|
3457
|
+
versionRange: ">=3.0.0 <3.4.0"
|
|
3458
|
+
},
|
|
3459
|
+
{
|
|
3460
|
+
filePath: "dist/transformers.js",
|
|
3461
|
+
versionRange: ">=3.0.0 <3.4.0"
|
|
3462
|
+
},
|
|
3463
|
+
{
|
|
3464
|
+
filePath: "dist/transformers.node.mjs",
|
|
3465
|
+
versionRange: ">=3.4.0 <5.0.0"
|
|
3466
|
+
},
|
|
3467
|
+
{
|
|
3468
|
+
filePath: "dist/transformers.node.cjs",
|
|
3469
|
+
versionRange: ">=3.4.0 <5.0.0"
|
|
3470
|
+
},
|
|
3471
|
+
{
|
|
3472
|
+
filePath: "dist/transformers.web.js",
|
|
3473
|
+
versionRange: ">=3.4.0 <5.0.0"
|
|
3474
|
+
}
|
|
3475
|
+
];
|
|
3476
|
+
var pipelineClasses = [
|
|
3477
|
+
"TextGenerationPipeline",
|
|
3478
|
+
"Text2TextGenerationPipeline",
|
|
3479
|
+
"FeatureExtractionPipeline",
|
|
3480
|
+
"QuestionAnsweringPipeline"
|
|
3481
|
+
];
|
|
3482
|
+
var huggingFaceTransformersConfigs = moduleFiles.flatMap(({ filePath, versionRange: versionRange2 }) => [
|
|
3483
|
+
{
|
|
3484
|
+
channelName: huggingFaceTransformersChannels.pipeline.channelName,
|
|
3485
|
+
module: {
|
|
3486
|
+
name: "@huggingface/transformers",
|
|
3487
|
+
versionRange: versionRange2,
|
|
3488
|
+
filePath
|
|
3489
|
+
},
|
|
3490
|
+
functionQuery: {
|
|
3491
|
+
functionName: "pipeline",
|
|
3492
|
+
kind: "Async"
|
|
3493
|
+
}
|
|
3494
|
+
},
|
|
3495
|
+
...pipelineClasses.map((className) => ({
|
|
3496
|
+
channelName: huggingFaceTransformersChannels.pipelineCall.channelName,
|
|
3497
|
+
module: {
|
|
3498
|
+
name: "@huggingface/transformers",
|
|
3499
|
+
versionRange: versionRange2,
|
|
3500
|
+
filePath
|
|
3501
|
+
},
|
|
3502
|
+
functionQuery: {
|
|
3503
|
+
className,
|
|
3504
|
+
methodName: "_call",
|
|
3505
|
+
kind: "Async"
|
|
3506
|
+
}
|
|
3507
|
+
}))
|
|
3508
|
+
]);
|
|
3509
|
+
|
|
2899
3510
|
// src/instrumentation/plugins/langchain-channels.ts
|
|
2900
|
-
var langChainChannels = defineChannels(
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
3511
|
+
var langChainChannels = defineChannels(
|
|
3512
|
+
"@langchain/core",
|
|
3513
|
+
{
|
|
3514
|
+
configure: channel({
|
|
3515
|
+
channelName: "CallbackManager.configure",
|
|
3516
|
+
kind: "sync-stream"
|
|
3517
|
+
}),
|
|
3518
|
+
configureSync: channel({
|
|
3519
|
+
channelName: "CallbackManager._configureSync",
|
|
3520
|
+
kind: "sync-stream"
|
|
3521
|
+
})
|
|
3522
|
+
},
|
|
3523
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.LANGCHAIN }
|
|
3524
|
+
);
|
|
2910
3525
|
|
|
2911
3526
|
// src/auto-instrumentations/configs/langchain.ts
|
|
2912
3527
|
var langChainCoreVersionRange = ">=0.3.42";
|
|
@@ -2941,20 +3556,24 @@ var langchainConfigs = [
|
|
|
2941
3556
|
];
|
|
2942
3557
|
|
|
2943
3558
|
// src/instrumentation/plugins/langsmith-channels.ts
|
|
2944
|
-
var langSmithChannels = defineChannels(
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
3559
|
+
var langSmithChannels = defineChannels(
|
|
3560
|
+
"langsmith",
|
|
3561
|
+
{
|
|
3562
|
+
createRun: channel({
|
|
3563
|
+
channelName: "Client.createRun",
|
|
3564
|
+
kind: "async"
|
|
3565
|
+
}),
|
|
3566
|
+
updateRun: channel({
|
|
3567
|
+
channelName: "Client.updateRun",
|
|
3568
|
+
kind: "async"
|
|
3569
|
+
}),
|
|
3570
|
+
batchIngestRuns: channel({
|
|
3571
|
+
channelName: "Client.batchIngestRuns",
|
|
3572
|
+
kind: "async"
|
|
3573
|
+
})
|
|
3574
|
+
},
|
|
3575
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.LANGSMITH }
|
|
3576
|
+
);
|
|
2958
3577
|
|
|
2959
3578
|
// src/auto-instrumentations/configs/langsmith.ts
|
|
2960
3579
|
var versionRange = ">=0.3.30 <1.0.0";
|
|
@@ -2991,52 +3610,56 @@ var langSmithConfigs = [
|
|
|
2991
3610
|
];
|
|
2992
3611
|
|
|
2993
3612
|
// src/instrumentation/plugins/mistral-channels.ts
|
|
2994
|
-
var mistralChannels = defineChannels(
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3613
|
+
var mistralChannels = defineChannels(
|
|
3614
|
+
"@mistralai/mistralai",
|
|
3615
|
+
{
|
|
3616
|
+
chatComplete: channel({
|
|
3617
|
+
channelName: "chat.complete",
|
|
3618
|
+
kind: "async"
|
|
3619
|
+
}),
|
|
3620
|
+
chatStream: channel({
|
|
3621
|
+
channelName: "chat.stream",
|
|
3622
|
+
kind: "async"
|
|
3623
|
+
}),
|
|
3624
|
+
embeddingsCreate: channel({
|
|
3625
|
+
channelName: "embeddings.create",
|
|
3626
|
+
kind: "async"
|
|
3627
|
+
}),
|
|
3628
|
+
classifiersModerate: channel({
|
|
3629
|
+
channelName: "classifiers.moderate",
|
|
3630
|
+
kind: "async"
|
|
3631
|
+
}),
|
|
3632
|
+
classifiersModerateChat: channel({
|
|
3633
|
+
channelName: "classifiers.moderateChat",
|
|
3634
|
+
kind: "async"
|
|
3635
|
+
}),
|
|
3636
|
+
classifiersClassify: channel({
|
|
3637
|
+
channelName: "classifiers.classify",
|
|
3638
|
+
kind: "async"
|
|
3639
|
+
}),
|
|
3640
|
+
classifiersClassifyChat: channel({
|
|
3641
|
+
channelName: "classifiers.classifyChat",
|
|
3642
|
+
kind: "async"
|
|
3643
|
+
}),
|
|
3644
|
+
fimComplete: channel({
|
|
3645
|
+
channelName: "fim.complete",
|
|
3646
|
+
kind: "async"
|
|
3647
|
+
}),
|
|
3648
|
+
fimStream: channel({
|
|
3649
|
+
channelName: "fim.stream",
|
|
3650
|
+
kind: "async"
|
|
3651
|
+
}),
|
|
3652
|
+
agentsComplete: channel({
|
|
3653
|
+
channelName: "agents.complete",
|
|
3654
|
+
kind: "async"
|
|
3655
|
+
}),
|
|
3656
|
+
agentsStream: channel({
|
|
3657
|
+
channelName: "agents.stream",
|
|
3658
|
+
kind: "async"
|
|
3659
|
+
})
|
|
3660
|
+
},
|
|
3661
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.MISTRAL }
|
|
3662
|
+
);
|
|
3040
3663
|
|
|
3041
3664
|
// src/auto-instrumentations/configs/mistral.ts
|
|
3042
3665
|
var mistralConfigs = [
|
|
@@ -3329,24 +3952,28 @@ var mistralConfigs = [
|
|
|
3329
3952
|
];
|
|
3330
3953
|
|
|
3331
3954
|
// src/instrumentation/plugins/openai-agents-channels.ts
|
|
3332
|
-
var openAIAgentsCoreChannels = defineChannels(
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3955
|
+
var openAIAgentsCoreChannels = defineChannels(
|
|
3956
|
+
"@openai/agents-core",
|
|
3957
|
+
{
|
|
3958
|
+
onTraceStart: channel({
|
|
3959
|
+
channelName: "tracing.processor.onTraceStart",
|
|
3960
|
+
kind: "async"
|
|
3961
|
+
}),
|
|
3962
|
+
onTraceEnd: channel({
|
|
3963
|
+
channelName: "tracing.processor.onTraceEnd",
|
|
3964
|
+
kind: "async"
|
|
3965
|
+
}),
|
|
3966
|
+
onSpanStart: channel({
|
|
3967
|
+
channelName: "tracing.processor.onSpanStart",
|
|
3968
|
+
kind: "async"
|
|
3969
|
+
}),
|
|
3970
|
+
onSpanEnd: channel({
|
|
3971
|
+
channelName: "tracing.processor.onSpanEnd",
|
|
3972
|
+
kind: "async"
|
|
3973
|
+
})
|
|
3974
|
+
},
|
|
3975
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.OPENAI_AGENTS }
|
|
3976
|
+
);
|
|
3350
3977
|
|
|
3351
3978
|
// src/auto-instrumentations/configs/openai-agents.ts
|
|
3352
3979
|
var lifecycleMethods = [
|
|
@@ -3374,44 +4001,48 @@ var openAIAgentsCoreConfigs = lifecycleMethods.flatMap(
|
|
|
3374
4001
|
);
|
|
3375
4002
|
|
|
3376
4003
|
// src/instrumentation/plugins/openai-channels.ts
|
|
3377
|
-
var openAIChannels = defineChannels(
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
4004
|
+
var openAIChannels = defineChannels(
|
|
4005
|
+
"openai",
|
|
4006
|
+
{
|
|
4007
|
+
chatCompletionsCreate: channel({
|
|
4008
|
+
channelName: "chat.completions.create",
|
|
4009
|
+
kind: "async"
|
|
4010
|
+
}),
|
|
4011
|
+
embeddingsCreate: channel({
|
|
4012
|
+
channelName: "embeddings.create",
|
|
4013
|
+
kind: "async"
|
|
4014
|
+
}),
|
|
4015
|
+
betaChatCompletionsParse: channel({
|
|
4016
|
+
channelName: "beta.chat.completions.parse",
|
|
4017
|
+
kind: "async"
|
|
4018
|
+
}),
|
|
4019
|
+
betaChatCompletionsStream: channel({
|
|
4020
|
+
channelName: "beta.chat.completions.stream",
|
|
4021
|
+
kind: "sync-stream"
|
|
4022
|
+
}),
|
|
4023
|
+
moderationsCreate: channel({
|
|
4024
|
+
channelName: "moderations.create",
|
|
4025
|
+
kind: "async"
|
|
4026
|
+
}),
|
|
4027
|
+
responsesCreate: channel({
|
|
4028
|
+
channelName: "responses.create",
|
|
4029
|
+
kind: "async"
|
|
4030
|
+
}),
|
|
4031
|
+
responsesStream: channel({
|
|
4032
|
+
channelName: "responses.stream",
|
|
4033
|
+
kind: "sync-stream"
|
|
4034
|
+
}),
|
|
4035
|
+
responsesParse: channel({
|
|
4036
|
+
channelName: "responses.parse",
|
|
4037
|
+
kind: "async"
|
|
4038
|
+
}),
|
|
4039
|
+
responsesCompact: channel({
|
|
4040
|
+
channelName: "responses.compact",
|
|
4041
|
+
kind: "async"
|
|
4042
|
+
})
|
|
4043
|
+
},
|
|
4044
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.OPENAI }
|
|
4045
|
+
);
|
|
3415
4046
|
|
|
3416
4047
|
// src/auto-instrumentations/configs/openai.ts
|
|
3417
4048
|
var openaiConfigs = [
|
|
@@ -3593,16 +4224,20 @@ var openaiConfigs = [
|
|
|
3593
4224
|
];
|
|
3594
4225
|
|
|
3595
4226
|
// src/instrumentation/plugins/openai-codex-channels.ts
|
|
3596
|
-
var openAICodexChannels = defineChannels(
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
4227
|
+
var openAICodexChannels = defineChannels(
|
|
4228
|
+
"@openai/codex-sdk",
|
|
4229
|
+
{
|
|
4230
|
+
run: channel({
|
|
4231
|
+
channelName: "Thread.run",
|
|
4232
|
+
kind: "async"
|
|
4233
|
+
}),
|
|
4234
|
+
runStreamed: channel({
|
|
4235
|
+
channelName: "Thread.runStreamed",
|
|
4236
|
+
kind: "async"
|
|
4237
|
+
})
|
|
4238
|
+
},
|
|
4239
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.OPENAI_CODEX }
|
|
4240
|
+
);
|
|
3606
4241
|
|
|
3607
4242
|
// src/auto-instrumentations/configs/openai-codex.ts
|
|
3608
4243
|
var openAICodexVersionRange = ">=0.128.0 <1.0.0";
|
|
@@ -3636,38 +4271,40 @@ var openAICodexConfigs = [
|
|
|
3636
4271
|
];
|
|
3637
4272
|
|
|
3638
4273
|
// src/instrumentation/plugins/openrouter-channels.ts
|
|
3639
|
-
var openRouterChannels = defineChannels(
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
4274
|
+
var openRouterChannels = defineChannels(
|
|
4275
|
+
"@openrouter/sdk",
|
|
4276
|
+
{
|
|
4277
|
+
chatSend: channel({
|
|
4278
|
+
channelName: "chat.send",
|
|
4279
|
+
kind: "async"
|
|
4280
|
+
}),
|
|
4281
|
+
embeddingsGenerate: channel({
|
|
4282
|
+
channelName: "embeddings.generate",
|
|
4283
|
+
kind: "async"
|
|
4284
|
+
}),
|
|
4285
|
+
rerankRerank: channel({
|
|
3650
4286
|
channelName: "rerank.rerank",
|
|
3651
4287
|
kind: "async"
|
|
3652
|
-
}
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
}
|
|
3670
|
-
}
|
|
4288
|
+
}),
|
|
4289
|
+
betaResponsesSend: channel({
|
|
4290
|
+
channelName: "beta.responses.send",
|
|
4291
|
+
kind: "async"
|
|
4292
|
+
}),
|
|
4293
|
+
callModel: channel({
|
|
4294
|
+
channelName: "callModel",
|
|
4295
|
+
kind: "sync-stream"
|
|
4296
|
+
}),
|
|
4297
|
+
callModelTurn: channel({
|
|
4298
|
+
channelName: "callModel.turn",
|
|
4299
|
+
kind: "async"
|
|
4300
|
+
}),
|
|
4301
|
+
toolExecute: channel({
|
|
4302
|
+
channelName: "tool.execute",
|
|
4303
|
+
kind: "async"
|
|
4304
|
+
})
|
|
4305
|
+
},
|
|
4306
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.OPENROUTER }
|
|
4307
|
+
);
|
|
3671
4308
|
|
|
3672
4309
|
// src/auto-instrumentations/configs/openrouter.ts
|
|
3673
4310
|
var openRouterConfigs = [
|
|
@@ -3675,7 +4312,7 @@ var openRouterConfigs = [
|
|
|
3675
4312
|
channelName: openRouterChannels.chatSend.channelName,
|
|
3676
4313
|
module: {
|
|
3677
4314
|
name: "@openrouter/sdk",
|
|
3678
|
-
versionRange: ">=0.9.11 <
|
|
4315
|
+
versionRange: ">=0.9.11 <2.0.0",
|
|
3679
4316
|
filePath: "esm/sdk/chat.js"
|
|
3680
4317
|
},
|
|
3681
4318
|
functionQuery: {
|
|
@@ -3688,7 +4325,7 @@ var openRouterConfigs = [
|
|
|
3688
4325
|
channelName: openRouterChannels.embeddingsGenerate.channelName,
|
|
3689
4326
|
module: {
|
|
3690
4327
|
name: "@openrouter/sdk",
|
|
3691
|
-
versionRange: ">=0.9.11 <
|
|
4328
|
+
versionRange: ">=0.9.11 <2.0.0",
|
|
3692
4329
|
filePath: "esm/sdk/embeddings.js"
|
|
3693
4330
|
},
|
|
3694
4331
|
functionQuery: {
|
|
@@ -3701,7 +4338,7 @@ var openRouterConfigs = [
|
|
|
3701
4338
|
channelName: openRouterChannels.rerankRerank.channelName,
|
|
3702
4339
|
module: {
|
|
3703
4340
|
name: "@openrouter/sdk",
|
|
3704
|
-
versionRange: ">=0.12.0 <
|
|
4341
|
+
versionRange: ">=0.12.0 <2.0.0",
|
|
3705
4342
|
filePath: "esm/sdk/rerank.js"
|
|
3706
4343
|
},
|
|
3707
4344
|
functionQuery: {
|
|
@@ -3714,7 +4351,7 @@ var openRouterConfigs = [
|
|
|
3714
4351
|
channelName: openRouterChannels.betaResponsesSend.channelName,
|
|
3715
4352
|
module: {
|
|
3716
4353
|
name: "@openrouter/sdk",
|
|
3717
|
-
versionRange: ">=0.9.11 <
|
|
4354
|
+
versionRange: ">=0.9.11 <2.0.0",
|
|
3718
4355
|
filePath: "esm/sdk/responses.js"
|
|
3719
4356
|
},
|
|
3720
4357
|
functionQuery: {
|
|
@@ -3727,7 +4364,7 @@ var openRouterConfigs = [
|
|
|
3727
4364
|
channelName: openRouterChannels.callModel.channelName,
|
|
3728
4365
|
module: {
|
|
3729
4366
|
name: "@openrouter/sdk",
|
|
3730
|
-
versionRange: ">=0.9.11 <
|
|
4367
|
+
versionRange: ">=0.9.11 <2.0.0",
|
|
3731
4368
|
filePath: "esm/sdk/sdk.js"
|
|
3732
4369
|
},
|
|
3733
4370
|
functionQuery: {
|
|
@@ -3739,20 +4376,24 @@ var openRouterConfigs = [
|
|
|
3739
4376
|
];
|
|
3740
4377
|
|
|
3741
4378
|
// src/instrumentation/plugins/openrouter-agent-channels.ts
|
|
3742
|
-
var openRouterAgentChannels = defineChannels(
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
4379
|
+
var openRouterAgentChannels = defineChannels(
|
|
4380
|
+
"@openrouter/agent",
|
|
4381
|
+
{
|
|
4382
|
+
callModel: channel({
|
|
4383
|
+
channelName: "callModel",
|
|
4384
|
+
kind: "sync-stream"
|
|
4385
|
+
}),
|
|
4386
|
+
callModelTurn: channel({
|
|
4387
|
+
channelName: "callModel.turn",
|
|
4388
|
+
kind: "async"
|
|
4389
|
+
}),
|
|
4390
|
+
toolExecute: channel({
|
|
4391
|
+
channelName: "tool.execute",
|
|
4392
|
+
kind: "async"
|
|
4393
|
+
})
|
|
4394
|
+
},
|
|
4395
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.OPENROUTER_AGENT }
|
|
4396
|
+
);
|
|
3756
4397
|
|
|
3757
4398
|
// src/auto-instrumentations/configs/openrouter-agent.ts
|
|
3758
4399
|
var openRouterAgentConfigs = [
|
|
@@ -3778,11 +4419,12 @@ var piCodingAgentChannels = defineChannels(
|
|
|
3778
4419
|
channelName: "AgentSession.prompt",
|
|
3779
4420
|
kind: "async"
|
|
3780
4421
|
})
|
|
3781
|
-
}
|
|
4422
|
+
},
|
|
4423
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.PI_CODING_AGENT }
|
|
3782
4424
|
);
|
|
3783
4425
|
|
|
3784
4426
|
// src/auto-instrumentations/configs/pi-coding-agent.ts
|
|
3785
|
-
var piCodingAgentVersionRange = ">=0.79.0 <0.
|
|
4427
|
+
var piCodingAgentVersionRange = ">=0.79.0 <0.82.0";
|
|
3786
4428
|
var piCodingAgentConfigs = [
|
|
3787
4429
|
{
|
|
3788
4430
|
channelName: piCodingAgentChannels.prompt.channelName,
|
|
@@ -3800,20 +4442,24 @@ var piCodingAgentConfigs = [
|
|
|
3800
4442
|
];
|
|
3801
4443
|
|
|
3802
4444
|
// src/instrumentation/plugins/strands-agent-sdk-channels.ts
|
|
3803
|
-
var strandsAgentSDKChannels = defineChannels(
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
4445
|
+
var strandsAgentSDKChannels = defineChannels(
|
|
4446
|
+
"@strands-agents/sdk",
|
|
4447
|
+
{
|
|
4448
|
+
agentStream: channel({
|
|
4449
|
+
channelName: "Agent.stream",
|
|
4450
|
+
kind: "sync-stream"
|
|
4451
|
+
}),
|
|
4452
|
+
graphStream: channel({
|
|
4453
|
+
channelName: "Graph.stream",
|
|
4454
|
+
kind: "sync-stream"
|
|
4455
|
+
}),
|
|
4456
|
+
swarmStream: channel({
|
|
4457
|
+
channelName: "Swarm.stream",
|
|
4458
|
+
kind: "sync-stream"
|
|
4459
|
+
})
|
|
4460
|
+
},
|
|
4461
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.STRANDS_AGENT_SDK }
|
|
4462
|
+
);
|
|
3817
4463
|
|
|
3818
4464
|
// src/auto-instrumentations/configs/strands-agent-sdk.ts
|
|
3819
4465
|
var strandsAgentSDKVersionRange = ">=1.0.0 <2.0.0";
|
|
@@ -3879,6 +4525,14 @@ var defaultInstrumentationConfigGroups = [
|
|
|
3879
4525
|
integrations: ["claudeAgentSDK"],
|
|
3880
4526
|
configs: claudeAgentSDKConfigs
|
|
3881
4527
|
},
|
|
4528
|
+
{
|
|
4529
|
+
integrations: ["cloudflareAIChat"],
|
|
4530
|
+
configs: cloudflareAIChatConfigs
|
|
4531
|
+
},
|
|
4532
|
+
{
|
|
4533
|
+
integrations: ["cloudflareAgents"],
|
|
4534
|
+
configs: cloudflareAgentsConfigs
|
|
4535
|
+
},
|
|
3882
4536
|
{ integrations: ["cursor", "cursorSDK"], configs: cursorSDKConfigs },
|
|
3883
4537
|
{
|
|
3884
4538
|
integrations: ["openAIAgents"],
|
|
@@ -3888,7 +4542,10 @@ var defaultInstrumentationConfigGroups = [
|
|
|
3888
4542
|
integrations: ["google", "googleGenAI"],
|
|
3889
4543
|
configs: googleGenAIConfigs
|
|
3890
4544
|
},
|
|
3891
|
-
{
|
|
4545
|
+
{
|
|
4546
|
+
integrations: ["huggingface"],
|
|
4547
|
+
configs: [...huggingFaceConfigs, ...huggingFaceTransformersConfigs]
|
|
4548
|
+
},
|
|
3892
4549
|
{
|
|
3893
4550
|
integrations: ["langchain", "langgraph"],
|
|
3894
4551
|
configs: langchainConfigs
|
|
@@ -4142,6 +4799,9 @@ function applySpecialCasePatch(input) {
|
|
|
4142
4799
|
if (input.packageName === "openai" && input.modulePath.includes("api-promise")) {
|
|
4143
4800
|
return input.source + OPENAI_API_PROMISE_PATCH;
|
|
4144
4801
|
}
|
|
4802
|
+
if (input.browser) {
|
|
4803
|
+
return null;
|
|
4804
|
+
}
|
|
4145
4805
|
const mastraTarget = classifyMastraTarget(
|
|
4146
4806
|
input.packageName,
|
|
4147
4807
|
input.modulePath
|
|
@@ -4164,78 +4824,72 @@ function getModuleVersion(basedir) {
|
|
|
4164
4824
|
}
|
|
4165
4825
|
return void 0;
|
|
4166
4826
|
}
|
|
4167
|
-
var unplugin = (0, import_unplugin.createUnplugin)(
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
`No 'package.json' version found for module ${moduleName} at ${moduleDetails.basedir}. Skipping transformation.`
|
|
4209
|
-
);
|
|
4210
|
-
return null;
|
|
4211
|
-
}
|
|
4212
|
-
const transformer = instrumentationMatcher.getTransformer(
|
|
4213
|
-
moduleName,
|
|
4214
|
-
moduleVersion,
|
|
4215
|
-
normalizedModulePath
|
|
4827
|
+
var unplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
|
|
4828
|
+
const browser = options.browser ?? options.useDiagnosticChannelCompatShim ?? false;
|
|
4829
|
+
const allInstrumentations = getDefaultInstrumentationConfigs({
|
|
4830
|
+
additionalInstrumentations: options.instrumentations
|
|
4831
|
+
});
|
|
4832
|
+
const instrumentationMatcher = create(allInstrumentations);
|
|
4833
|
+
return {
|
|
4834
|
+
name: "code-transformer",
|
|
4835
|
+
enforce: "pre",
|
|
4836
|
+
transform(code, id) {
|
|
4837
|
+
if (!id) {
|
|
4838
|
+
return null;
|
|
4839
|
+
}
|
|
4840
|
+
const cleanId = id.replace(/[?#].*$/, "");
|
|
4841
|
+
const filePath = cleanId.startsWith("file:") ? (0, import_url.fileURLToPath)(cleanId) : cleanId;
|
|
4842
|
+
const ext = (0, import_path.extname)(filePath);
|
|
4843
|
+
let isModule = ext === ".mjs" || ext === ".ts" || ext === ".tsx";
|
|
4844
|
+
if (ext === ".js") {
|
|
4845
|
+
isModule = code.includes("export ") || code.includes("import ");
|
|
4846
|
+
}
|
|
4847
|
+
const normalizedForPlatform = filePath.split("/").join(import_path.sep);
|
|
4848
|
+
const moduleDetails = (0, import_module_details_from_path.default)(normalizedForPlatform);
|
|
4849
|
+
if (!moduleDetails) {
|
|
4850
|
+
return null;
|
|
4851
|
+
}
|
|
4852
|
+
const moduleName = moduleDetails.name;
|
|
4853
|
+
const normalizedModulePath = moduleDetails.path.replace(/\\/g, "/");
|
|
4854
|
+
const moduleVersion = getModuleVersion(moduleDetails.basedir);
|
|
4855
|
+
const patched = applySpecialCasePatch({
|
|
4856
|
+
packageName: moduleName,
|
|
4857
|
+
modulePath: normalizedModulePath,
|
|
4858
|
+
source: code,
|
|
4859
|
+
format: isModule ? "esm" : "cjs",
|
|
4860
|
+
browser
|
|
4861
|
+
});
|
|
4862
|
+
if (patched !== null) {
|
|
4863
|
+
return { code: patched, map: null };
|
|
4864
|
+
}
|
|
4865
|
+
if (!moduleVersion) {
|
|
4866
|
+
console.warn(
|
|
4867
|
+
`No 'package.json' version found for module ${moduleName} at ${moduleDetails.basedir}. Skipping transformation.`
|
|
4216
4868
|
);
|
|
4217
|
-
|
|
4218
|
-
return null;
|
|
4219
|
-
}
|
|
4220
|
-
try {
|
|
4221
|
-
const moduleType = isModule ? "esm" : "cjs";
|
|
4222
|
-
const result = transformer.transform(code, moduleType);
|
|
4223
|
-
const transformedCode = result.code.replace(
|
|
4224
|
-
/const \{tracingChannel: ([A-Za-z_$][\w$]*)\} = ([A-Za-z_$][\w$]*);/g,
|
|
4225
|
-
"const $1 = $2.tracingChannel;"
|
|
4226
|
-
);
|
|
4227
|
-
return {
|
|
4228
|
-
code: transformedCode,
|
|
4229
|
-
map: result.map
|
|
4230
|
-
};
|
|
4231
|
-
} catch (error) {
|
|
4232
|
-
console.warn(`Code transformation failed for ${id}: ${error}`);
|
|
4233
|
-
return null;
|
|
4234
|
-
}
|
|
4869
|
+
return null;
|
|
4235
4870
|
}
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4871
|
+
const transformer = instrumentationMatcher.getTransformer(
|
|
4872
|
+
moduleName,
|
|
4873
|
+
moduleVersion,
|
|
4874
|
+
normalizedModulePath
|
|
4875
|
+
);
|
|
4876
|
+
if (!transformer) {
|
|
4877
|
+
return null;
|
|
4878
|
+
}
|
|
4879
|
+
try {
|
|
4880
|
+
const moduleType = isModule ? "esm" : "cjs";
|
|
4881
|
+
const result = transformer.transform(code, moduleType);
|
|
4882
|
+
return {
|
|
4883
|
+
code: result.code,
|
|
4884
|
+
map: result.map
|
|
4885
|
+
};
|
|
4886
|
+
} catch (error) {
|
|
4887
|
+
console.warn(`Code transformation failed for ${id}: ${error}`);
|
|
4888
|
+
return null;
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
};
|
|
4892
|
+
});
|
|
4239
4893
|
|
|
4240
4894
|
// src/auto-instrumentations/bundler/webpack.ts
|
|
4241
4895
|
var webpackPlugin = unplugin.webpack;
|
|
@@ -4312,33 +4966,9 @@ function wrapWebpackConfig(userWebpack) {
|
|
|
4312
4966
|
}
|
|
4313
4967
|
function wrapTurbopackConfig(turbopackConfig) {
|
|
4314
4968
|
const config = { ...turbopackConfig ?? {} };
|
|
4315
|
-
const resolveAlias = config.resolveAlias && typeof config.resolveAlias === "object" && !Array.isArray(config.resolveAlias) ? config.resolveAlias : {};
|
|
4316
4969
|
const rules = config.rules && typeof config.rules === "object" && !Array.isArray(config.rules) ? config.rules : {};
|
|
4317
|
-
let dcBrowserPath;
|
|
4318
|
-
try {
|
|
4319
|
-
dcBrowserPath = (0, import_node_module.createRequire)(
|
|
4320
|
-
requireFromProject.resolve("braintrust/package.json")
|
|
4321
|
-
).resolve("dc-browser");
|
|
4322
|
-
} catch {
|
|
4323
|
-
try {
|
|
4324
|
-
dcBrowserPath = requireFromProject.resolve("dc-browser");
|
|
4325
|
-
} catch {
|
|
4326
|
-
dcBrowserPath = void 0;
|
|
4327
|
-
}
|
|
4328
|
-
}
|
|
4329
|
-
if (dcBrowserPath && (0, import_node_path.isAbsolute)(dcBrowserPath)) {
|
|
4330
|
-
const relativeDcBrowserPath = (0, import_node_path.relative)(
|
|
4331
|
-
process.cwd(),
|
|
4332
|
-
dcBrowserPath
|
|
4333
|
-
).replace(/\\/g, "/");
|
|
4334
|
-
dcBrowserPath = relativeDcBrowserPath.startsWith(".") ? relativeDcBrowserPath : `./${relativeDcBrowserPath}`;
|
|
4335
|
-
}
|
|
4336
4970
|
return {
|
|
4337
4971
|
...config,
|
|
4338
|
-
// Turbopack resolves modules emitted by our loader from the app graph. The
|
|
4339
|
-
// browser diagnostics-channel shim is Braintrust's dependency, so alias it
|
|
4340
|
-
// to the copy installed with Braintrust while still letting user aliases win.
|
|
4341
|
-
resolveAlias: dcBrowserPath && resolveAlias["dc-browser"] === void 0 ? { ...resolveAlias, "dc-browser": dcBrowserPath } : config.resolveAlias,
|
|
4342
4972
|
rules: addBraintrustTurbopackRule(rules)
|
|
4343
4973
|
};
|
|
4344
4974
|
}
|