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