braintrust 3.25.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 +130 -2
- package/dev/dist/index.d.ts +130 -2
- package/dev/dist/index.js +2455 -1116
- package/dev/dist/index.mjs +1599 -260
- package/dist/apply-auto-instrumentation.js +439 -398
- package/dist/apply-auto-instrumentation.mjs +242 -201
- package/dist/auto-instrumentations/bundler/esbuild.cjs +853 -337
- 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 +852 -356
- package/dist/auto-instrumentations/bundler/next.mjs +6 -29
- package/dist/auto-instrumentations/bundler/rollup.cjs +853 -337
- 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 +853 -337
- 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 +1006 -266
- package/dist/auto-instrumentations/bundler/webpack-loader.d.ts +20 -12
- package/dist/auto-instrumentations/bundler/webpack.cjs +853 -337
- 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-JPVCUKTY.mjs → chunk-6E22MYSW.mjs} +165 -73
- 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-7P6563SW.mjs → chunk-V5LEODRX.mjs} +2 -6
- package/dist/auto-instrumentations/{chunk-M6DLIJ2Z.mjs → chunk-XYN63IG5.mjs} +124 -194
- package/dist/auto-instrumentations/{chunk-CZ24KNHT.mjs → chunk-XZHHE4Y3.mjs} +77 -68
- package/dist/auto-instrumentations/hook.mjs +247 -182
- package/dist/auto-instrumentations/index.cjs +557 -48
- 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 +817 -197
- package/dist/browser.d.ts +817 -197
- package/dist/browser.js +1883 -265
- package/dist/browser.mjs +1883 -265
- package/dist/{chunk-ABR2QWDP.mjs → chunk-PN7EWK66.mjs} +581 -133
- package/dist/{chunk-GSIDVFE6.js → chunk-VRZZQPAA.js} +1670 -736
- package/dist/{chunk-P25IOOU4.js → chunk-VYNNEKSA.js} +586 -138
- package/dist/{chunk-2SANLSWX.mjs → chunk-XIZOM2HO.mjs} +1052 -118
- package/dist/cli.js +1601 -263
- package/dist/edge-light.d.mts +1 -1
- package/dist/edge-light.d.ts +1 -1
- package/dist/edge-light.js +1883 -268
- package/dist/edge-light.mjs +1883 -268
- package/dist/index.d.mts +817 -197
- package/dist/index.d.ts +817 -197
- package/dist/index.js +695 -435
- package/dist/index.mjs +264 -4
- package/dist/instrumentation/index.d.mts +130 -6
- package/dist/instrumentation/index.d.ts +130 -6
- package/dist/instrumentation/index.js +1510 -80
- package/dist/instrumentation/index.mjs +1510 -80
- 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 +1883 -268
- package/dist/workerd.mjs +1883 -268
- 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
|
@@ -4,170 +4,528 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
// src/global-instrumentation-hooks.ts
|
|
8
|
+
var GLOBAL_INSTRUMENTATION_HOOKS_KEY = "__braintrust_instrumentation_hooks";
|
|
9
|
+
var GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION = 1;
|
|
10
|
+
var GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND = "braintrust.global-instrumentation-hooks.registry";
|
|
11
|
+
var GLOBAL_INSTRUMENTATION_HOOK_BRAND = "braintrust.global-instrumentation-hooks.hook";
|
|
12
|
+
var registryBrand = Symbol.for(GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND);
|
|
13
|
+
var hookBrand = Symbol.for(GLOBAL_INSTRUMENTATION_HOOK_BRAND);
|
|
14
|
+
var errorReporter;
|
|
15
|
+
function setGlobalHookErrorReporter(reporter) {
|
|
16
|
+
const previousReporter = errorReporter;
|
|
17
|
+
errorReporter = reporter;
|
|
18
|
+
return () => {
|
|
19
|
+
if (errorReporter === reporter) {
|
|
20
|
+
errorReporter = previousReporter;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function reportError(error) {
|
|
25
|
+
try {
|
|
26
|
+
_optionalChain([errorReporter, 'optionalCall', _2 => _2(error)]);
|
|
27
|
+
} catch (e) {
|
|
13
28
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_optionalChain([this, 'access', _4 => _4.start, 'optionalAccess', _5 => _5.hasSubscribers]) || _optionalChain([this, 'access', _6 => _6.end, 'optionalAccess', _7 => _7.hasSubscribers]) || _optionalChain([this, 'access', _8 => _8.asyncStart, 'optionalAccess', _9 => _9.hasSubscribers]) || _optionalChain([this, 'access', _10 => _10.asyncEnd, 'optionalAccess', _11 => _11.hasSubscribers]) || _optionalChain([this, 'access', _12 => _12.error, 'optionalAccess', _13 => _13.hasSubscribers])
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
29
|
+
}
|
|
30
|
+
function setContextValue(context, key, value) {
|
|
31
|
+
try {
|
|
32
|
+
context[key] = value;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
reportError(error);
|
|
24
35
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
}
|
|
37
|
+
function wrapStoreRun(store, message, next, transform) {
|
|
38
|
+
return () => {
|
|
39
|
+
let context;
|
|
40
|
+
try {
|
|
41
|
+
context = transform ? transform(message) : message;
|
|
42
|
+
} catch (error) {
|
|
43
|
+
reportError(error);
|
|
44
|
+
return next();
|
|
45
|
+
}
|
|
46
|
+
let called = false;
|
|
47
|
+
let result;
|
|
48
|
+
let providerError;
|
|
49
|
+
let providerThrew = false;
|
|
50
|
+
const runNext = () => {
|
|
51
|
+
if (called) {
|
|
52
|
+
reportError(
|
|
53
|
+
new Error(
|
|
54
|
+
"Instrumentation store invoked its callback more than once"
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
if (providerThrew) {
|
|
58
|
+
throw providerError;
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
37
61
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
62
|
+
called = true;
|
|
63
|
+
try {
|
|
64
|
+
result = next();
|
|
65
|
+
return result;
|
|
66
|
+
} catch (error) {
|
|
67
|
+
providerThrew = true;
|
|
68
|
+
providerError = error;
|
|
69
|
+
throw error;
|
|
42
70
|
}
|
|
43
|
-
return start.runStores(context, () => {
|
|
44
|
-
try {
|
|
45
|
-
const result = Reflect.apply(fn, thisArg, args);
|
|
46
|
-
_optionalChain([end, 'optionalAccess', _24 => _24.publish, 'call', _25 => _25(context)]);
|
|
47
|
-
if (result && (typeof result === "object" || typeof result === "function") && typeof result.then === "function") {
|
|
48
|
-
if (result.constructor === Promise) {
|
|
49
|
-
return result.then(
|
|
50
|
-
(res) => {
|
|
51
|
-
publishResolved(res);
|
|
52
|
-
return res;
|
|
53
|
-
},
|
|
54
|
-
(err) => {
|
|
55
|
-
publishRejected(err);
|
|
56
|
-
return Promise.reject(err);
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
void result.then(
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
-
(resolved) => {
|
|
63
|
-
try {
|
|
64
|
-
publishResolved(resolved);
|
|
65
|
-
} catch (e) {
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
-
(err) => {
|
|
70
|
-
try {
|
|
71
|
-
publishRejected(err);
|
|
72
|
-
} catch (e2) {
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
context.result = result;
|
|
79
|
-
_optionalChain([asyncStart, 'optionalAccess', _26 => _26.publish, 'call', _27 => _27(context)]);
|
|
80
|
-
_optionalChain([asyncEnd, 'optionalAccess', _28 => _28.publish, 'call', _29 => _29(context)]);
|
|
81
|
-
return result;
|
|
82
|
-
} catch (err) {
|
|
83
|
-
context.error = err;
|
|
84
|
-
_optionalChain([error, 'optionalAccess', _30 => _30.publish, 'call', _31 => _31(context)]);
|
|
85
|
-
_optionalChain([end, 'optionalAccess', _32 => _32.publish, 'call', _33 => _33(context)]);
|
|
86
|
-
throw err;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
71
|
};
|
|
90
|
-
|
|
72
|
+
try {
|
|
73
|
+
store.run(context, runNext);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (!providerThrew || error !== providerError) {
|
|
76
|
+
reportError(error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!called) {
|
|
80
|
+
reportError(
|
|
81
|
+
new Error("Instrumentation store did not invoke its callback")
|
|
82
|
+
);
|
|
83
|
+
return runNext();
|
|
84
|
+
}
|
|
85
|
+
if (providerThrew) {
|
|
86
|
+
throw providerError;
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
};
|
|
91
90
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var DefaultAsyncLocalStorage = class {
|
|
95
|
-
constructor() {
|
|
96
|
-
}
|
|
97
|
-
enterWith(_) {
|
|
98
|
-
}
|
|
99
|
-
run(_, callback) {
|
|
100
|
-
return callback();
|
|
101
|
-
}
|
|
102
|
-
getStore() {
|
|
103
|
-
return void 0;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
var DefaultChannel = (_class = class {
|
|
107
|
-
constructor(name) {;_class.prototype.__init.call(this);
|
|
91
|
+
var HookChannel = (_class = class {
|
|
92
|
+
constructor(name) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);
|
|
108
93
|
this.name = name;
|
|
109
94
|
}
|
|
110
95
|
|
|
111
|
-
__init() {this.
|
|
112
|
-
|
|
96
|
+
__init() {this.subscribers = []}
|
|
97
|
+
__init2() {this.stores = /* @__PURE__ */ new Map()}
|
|
98
|
+
get hasSubscribers() {
|
|
99
|
+
return this.subscribers.length > 0 || this.stores.size > 0;
|
|
113
100
|
}
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
subscribe(subscription) {
|
|
102
|
+
if (typeof subscription !== "function") {
|
|
103
|
+
throw new TypeError("subscription must be a function");
|
|
104
|
+
}
|
|
105
|
+
this.subscribers = [...this.subscribers, subscription];
|
|
116
106
|
}
|
|
117
|
-
|
|
107
|
+
unsubscribe(subscription) {
|
|
108
|
+
const index = this.subscribers.indexOf(subscription);
|
|
109
|
+
if (index === -1) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
this.subscribers = [
|
|
113
|
+
...this.subscribers.slice(0, index),
|
|
114
|
+
...this.subscribers.slice(index + 1)
|
|
115
|
+
];
|
|
116
|
+
return true;
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
bindStore(store, transform) {
|
|
119
|
+
if (!store || typeof store.run !== "function") {
|
|
120
|
+
throw new TypeError("store must have a run method");
|
|
121
|
+
}
|
|
122
|
+
this.stores.set(
|
|
123
|
+
store,
|
|
124
|
+
transform
|
|
125
|
+
);
|
|
121
126
|
}
|
|
122
|
-
|
|
127
|
+
unbindStore(store) {
|
|
128
|
+
return this.stores.delete(store);
|
|
123
129
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
publish(message) {
|
|
131
|
+
const subscribers = this.subscribers;
|
|
132
|
+
for (const subscriber of subscribers) {
|
|
133
|
+
try {
|
|
134
|
+
subscriber(message, this.name);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
reportError(error);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
runStores(message, fn, thisArg, ...args) {
|
|
141
|
+
let run = () => {
|
|
142
|
+
this.publish(message);
|
|
143
|
+
return Reflect.apply(fn, thisArg, args);
|
|
144
|
+
};
|
|
145
|
+
for (const [store, transform] of this.stores.entries()) {
|
|
146
|
+
run = wrapStoreRun(store, message, run, transform);
|
|
147
|
+
}
|
|
148
|
+
return run();
|
|
127
149
|
}
|
|
128
150
|
}, _class);
|
|
129
|
-
var
|
|
151
|
+
var traceEvents = [
|
|
152
|
+
"start",
|
|
153
|
+
"end",
|
|
154
|
+
"asyncStart",
|
|
155
|
+
"asyncEnd",
|
|
156
|
+
"error"
|
|
157
|
+
];
|
|
158
|
+
var TracingHook = class {
|
|
130
159
|
|
|
131
160
|
|
|
132
161
|
|
|
133
162
|
|
|
134
163
|
|
|
135
164
|
constructor(nameOrChannels) {
|
|
165
|
+
Object.defineProperty(this, hookBrand, {
|
|
166
|
+
configurable: false,
|
|
167
|
+
enumerable: false,
|
|
168
|
+
value: GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION,
|
|
169
|
+
writable: false
|
|
170
|
+
});
|
|
136
171
|
if (typeof nameOrChannels === "string") {
|
|
137
|
-
this.start = new
|
|
138
|
-
this.end = new
|
|
139
|
-
this.asyncStart = new
|
|
140
|
-
|
|
141
|
-
);
|
|
142
|
-
this.asyncEnd = new DefaultChannel(`tracing:${nameOrChannels}:asyncEnd`);
|
|
143
|
-
this.error = new DefaultChannel(`tracing:${nameOrChannels}:error`);
|
|
172
|
+
this.start = new HookChannel(`tracing:${nameOrChannels}:start`);
|
|
173
|
+
this.end = new HookChannel(`tracing:${nameOrChannels}:end`);
|
|
174
|
+
this.asyncStart = new HookChannel(`tracing:${nameOrChannels}:asyncStart`);
|
|
175
|
+
this.asyncEnd = new HookChannel(`tracing:${nameOrChannels}:asyncEnd`);
|
|
176
|
+
this.error = new HookChannel(`tracing:${nameOrChannels}:error`);
|
|
144
177
|
return;
|
|
145
178
|
}
|
|
146
|
-
this.start = _nullishCoalesce(nameOrChannels.start, () => ( new
|
|
147
|
-
this.end = _nullishCoalesce(nameOrChannels.end, () => ( new
|
|
148
|
-
this.asyncStart = _nullishCoalesce(nameOrChannels.asyncStart, () => ( new
|
|
149
|
-
this.asyncEnd = _nullishCoalesce(nameOrChannels.asyncEnd, () => ( new
|
|
150
|
-
this.error = _nullishCoalesce(nameOrChannels.error, () => ( new
|
|
179
|
+
this.start = _nullishCoalesce(nameOrChannels.start, () => ( new HookChannel("tracing:start")));
|
|
180
|
+
this.end = _nullishCoalesce(nameOrChannels.end, () => ( new HookChannel("tracing:end")));
|
|
181
|
+
this.asyncStart = _nullishCoalesce(nameOrChannels.asyncStart, () => ( new HookChannel("tracing:asyncStart")));
|
|
182
|
+
this.asyncEnd = _nullishCoalesce(nameOrChannels.asyncEnd, () => ( new HookChannel("tracing:asyncEnd")));
|
|
183
|
+
this.error = _nullishCoalesce(nameOrChannels.error, () => ( new HookChannel("tracing:error")));
|
|
151
184
|
}
|
|
152
185
|
get hasSubscribers() {
|
|
153
186
|
return this.start.hasSubscribers || this.end.hasSubscribers || this.asyncStart.hasSubscribers || this.asyncEnd.hasSubscribers || this.error.hasSubscribers;
|
|
154
187
|
}
|
|
155
|
-
subscribe(
|
|
188
|
+
subscribe(handlers) {
|
|
189
|
+
for (const eventName of traceEvents) {
|
|
190
|
+
const handler = handlers[eventName];
|
|
191
|
+
if (handler) {
|
|
192
|
+
this[eventName].subscribe(handler);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
unsubscribe(handlers) {
|
|
197
|
+
let done = true;
|
|
198
|
+
for (const eventName of traceEvents) {
|
|
199
|
+
const handler = handlers[eventName];
|
|
200
|
+
if (handler && !this[eventName].unsubscribe(handler)) {
|
|
201
|
+
done = false;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return done;
|
|
205
|
+
}
|
|
206
|
+
traceSync(fn, message = {}, thisArg, ...args) {
|
|
207
|
+
if (!this.hasSubscribers) {
|
|
208
|
+
return Reflect.apply(fn, thisArg, args);
|
|
209
|
+
}
|
|
210
|
+
const context = message;
|
|
211
|
+
return this.start.runStores(message, () => {
|
|
212
|
+
try {
|
|
213
|
+
const result = Reflect.apply(fn, thisArg, args);
|
|
214
|
+
setContextValue(context, "result", result);
|
|
215
|
+
return result;
|
|
216
|
+
} catch (error) {
|
|
217
|
+
setContextValue(context, "error", error);
|
|
218
|
+
this.error.publish(message);
|
|
219
|
+
throw error;
|
|
220
|
+
} finally {
|
|
221
|
+
this.end.publish(message);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
tracePromise(fn, message = {}, thisArg, ...args) {
|
|
226
|
+
if (!this.hasSubscribers) {
|
|
227
|
+
return Reflect.apply(fn, thisArg, args);
|
|
228
|
+
}
|
|
229
|
+
const context = message;
|
|
230
|
+
return this.start.runStores(message, () => {
|
|
231
|
+
let result;
|
|
232
|
+
try {
|
|
233
|
+
result = Reflect.apply(fn, thisArg, args);
|
|
234
|
+
} catch (error) {
|
|
235
|
+
setContextValue(context, "error", error);
|
|
236
|
+
this.error.publish(message);
|
|
237
|
+
this.end.publish(message);
|
|
238
|
+
throw error;
|
|
239
|
+
}
|
|
240
|
+
this.end.publish(message);
|
|
241
|
+
if (!result || typeof result !== "object" && typeof result !== "function") {
|
|
242
|
+
setContextValue(context, "result", result);
|
|
243
|
+
this.asyncStart.publish(message);
|
|
244
|
+
this.asyncEnd.publish(message);
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
let terminalPublished = false;
|
|
248
|
+
const finishUnobservedResult = (error) => {
|
|
249
|
+
reportError(error);
|
|
250
|
+
if (!terminalPublished) {
|
|
251
|
+
terminalPublished = true;
|
|
252
|
+
setContextValue(context, "result", result);
|
|
253
|
+
this.asyncStart.publish(message);
|
|
254
|
+
this.asyncEnd.publish(message);
|
|
255
|
+
}
|
|
256
|
+
return result;
|
|
257
|
+
};
|
|
258
|
+
let then;
|
|
259
|
+
try {
|
|
260
|
+
then = result.then;
|
|
261
|
+
} catch (error) {
|
|
262
|
+
return finishUnobservedResult(error);
|
|
263
|
+
}
|
|
264
|
+
if (typeof then !== "function") {
|
|
265
|
+
setContextValue(context, "result", result);
|
|
266
|
+
this.asyncStart.publish(message);
|
|
267
|
+
this.asyncEnd.publish(message);
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
const resolve = (resolved) => {
|
|
271
|
+
if (!terminalPublished) {
|
|
272
|
+
terminalPublished = true;
|
|
273
|
+
setContextValue(context, "result", resolved);
|
|
274
|
+
this.asyncStart.publish(message);
|
|
275
|
+
this.asyncEnd.publish(message);
|
|
276
|
+
}
|
|
277
|
+
return resolved;
|
|
278
|
+
};
|
|
279
|
+
let rejectionThrown = false;
|
|
280
|
+
let rejectionError;
|
|
281
|
+
const reject = (error) => {
|
|
282
|
+
if (!terminalPublished) {
|
|
283
|
+
terminalPublished = true;
|
|
284
|
+
setContextValue(context, "error", error);
|
|
285
|
+
this.error.publish(message);
|
|
286
|
+
this.asyncStart.publish(message);
|
|
287
|
+
this.asyncEnd.publish(message);
|
|
288
|
+
}
|
|
289
|
+
rejectionThrown = true;
|
|
290
|
+
rejectionError = error;
|
|
291
|
+
throw error;
|
|
292
|
+
};
|
|
293
|
+
let isPlainPromise;
|
|
294
|
+
try {
|
|
295
|
+
isPlainPromise = result instanceof Promise && result.constructor === Promise;
|
|
296
|
+
} catch (error) {
|
|
297
|
+
return finishUnobservedResult(error);
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
if (isPlainPromise) {
|
|
301
|
+
return Reflect.apply(then, result, [resolve, reject]);
|
|
302
|
+
}
|
|
303
|
+
Reflect.apply(then, result, [
|
|
304
|
+
resolve,
|
|
305
|
+
(error) => {
|
|
306
|
+
try {
|
|
307
|
+
reject(error);
|
|
308
|
+
} catch (e2) {
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
]);
|
|
312
|
+
} catch (error) {
|
|
313
|
+
if (rejectionThrown && error === rejectionError) {
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
return finishUnobservedResult(error);
|
|
317
|
+
}
|
|
318
|
+
return result;
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
traceCallback(fn, position = -1, message = {}, thisArg, ...args) {
|
|
322
|
+
if (!this.hasSubscribers) {
|
|
323
|
+
return Reflect.apply(fn, thisArg, args);
|
|
324
|
+
}
|
|
325
|
+
const context = message;
|
|
326
|
+
const callArgs = args.length > 0 ? args : _nullishCoalesce(context.arguments, () => ( args));
|
|
327
|
+
const callback = Array.prototype.at.call(callArgs, position);
|
|
328
|
+
if (typeof callback !== "function") {
|
|
329
|
+
return Reflect.apply(fn, thisArg, args);
|
|
330
|
+
}
|
|
331
|
+
const { asyncStart, asyncEnd, error: errorChannel } = this;
|
|
332
|
+
function wrappedCallback(error, result) {
|
|
333
|
+
if (error) {
|
|
334
|
+
setContextValue(context, "error", error);
|
|
335
|
+
errorChannel.publish(message);
|
|
336
|
+
} else {
|
|
337
|
+
setContextValue(context, "result", result);
|
|
338
|
+
}
|
|
339
|
+
return asyncStart.runStores(message, () => {
|
|
340
|
+
try {
|
|
341
|
+
return Reflect.apply(callback, this, arguments);
|
|
342
|
+
} finally {
|
|
343
|
+
asyncEnd.publish(message);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
Array.prototype.splice.call(callArgs, position, 1, wrappedCallback);
|
|
348
|
+
return this.start.runStores(message, () => {
|
|
349
|
+
try {
|
|
350
|
+
return Reflect.apply(fn, thisArg, args);
|
|
351
|
+
} catch (error) {
|
|
352
|
+
setContextValue(context, "error", error);
|
|
353
|
+
this.error.publish(message);
|
|
354
|
+
throw error;
|
|
355
|
+
} finally {
|
|
356
|
+
this.end.publish(message);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
156
359
|
}
|
|
157
|
-
|
|
360
|
+
};
|
|
361
|
+
var inertChannel = Object.freeze({
|
|
362
|
+
name: "braintrust:inert",
|
|
363
|
+
hasSubscribers: false,
|
|
364
|
+
subscribe() {
|
|
365
|
+
},
|
|
366
|
+
unsubscribe() {
|
|
158
367
|
return false;
|
|
368
|
+
},
|
|
369
|
+
bindStore() {
|
|
370
|
+
},
|
|
371
|
+
unbindStore() {
|
|
372
|
+
return false;
|
|
373
|
+
},
|
|
374
|
+
publish() {
|
|
375
|
+
},
|
|
376
|
+
runStores(_message, fn, thisArg, ...args) {
|
|
377
|
+
return Reflect.apply(fn, thisArg, args);
|
|
159
378
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
379
|
+
});
|
|
380
|
+
var inertTracingHook = new TracingHook({
|
|
381
|
+
start: inertChannel,
|
|
382
|
+
end: inertChannel,
|
|
383
|
+
asyncStart: inertChannel,
|
|
384
|
+
asyncEnd: inertChannel,
|
|
385
|
+
error: inertChannel
|
|
386
|
+
});
|
|
387
|
+
function isHookChannel(value) {
|
|
388
|
+
if (typeof value !== "object" && typeof value !== "function" || value === null) {
|
|
389
|
+
return false;
|
|
163
390
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return
|
|
391
|
+
try {
|
|
392
|
+
const channel2 = value;
|
|
393
|
+
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";
|
|
394
|
+
} catch (e3) {
|
|
395
|
+
return false;
|
|
167
396
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
397
|
+
}
|
|
398
|
+
function hasTracingHookShape(value) {
|
|
399
|
+
if (typeof value !== "object" && typeof value !== "function" || value === null) {
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
try {
|
|
403
|
+
const hook = value;
|
|
404
|
+
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);
|
|
405
|
+
} catch (e4) {
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function isCompatibleTracingHook(value) {
|
|
410
|
+
try {
|
|
411
|
+
return value[hookBrand] === GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION && hasTracingHookShape(value);
|
|
412
|
+
} catch (e5) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function isCompatibleHookRegistry(value) {
|
|
417
|
+
try {
|
|
418
|
+
return value instanceof Map && value[registryBrand] === GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION;
|
|
419
|
+
} catch (e6) {
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function getHookRegistry() {
|
|
424
|
+
let descriptor;
|
|
425
|
+
try {
|
|
426
|
+
descriptor = Object.getOwnPropertyDescriptor(
|
|
427
|
+
globalThis,
|
|
428
|
+
GLOBAL_INSTRUMENTATION_HOOKS_KEY
|
|
429
|
+
);
|
|
430
|
+
} catch (error) {
|
|
431
|
+
reportError(error);
|
|
432
|
+
return void 0;
|
|
433
|
+
}
|
|
434
|
+
if (descriptor && "value" in descriptor && isCompatibleHookRegistry(descriptor.value) && (descriptor.configurable || descriptor.enumerable === false)) {
|
|
435
|
+
if (descriptor.configurable || descriptor.writable) {
|
|
436
|
+
try {
|
|
437
|
+
Object.defineProperty(globalThis, GLOBAL_INSTRUMENTATION_HOOKS_KEY, {
|
|
438
|
+
configurable: false,
|
|
439
|
+
enumerable: false,
|
|
440
|
+
value: descriptor.value,
|
|
441
|
+
writable: false
|
|
442
|
+
});
|
|
443
|
+
} catch (error) {
|
|
444
|
+
reportError(error);
|
|
445
|
+
return void 0;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return descriptor.value;
|
|
449
|
+
}
|
|
450
|
+
if (descriptor && !descriptor.configurable) {
|
|
451
|
+
reportError(new Error("Incompatible global instrumentation hook registry"));
|
|
452
|
+
return void 0;
|
|
453
|
+
}
|
|
454
|
+
const registry = /* @__PURE__ */ new Map();
|
|
455
|
+
try {
|
|
456
|
+
Object.defineProperty(registry, registryBrand, {
|
|
457
|
+
configurable: false,
|
|
458
|
+
enumerable: false,
|
|
459
|
+
value: GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION,
|
|
460
|
+
writable: false
|
|
461
|
+
});
|
|
462
|
+
} catch (error) {
|
|
463
|
+
reportError(error);
|
|
464
|
+
return void 0;
|
|
465
|
+
}
|
|
466
|
+
try {
|
|
467
|
+
Object.defineProperty(globalThis, GLOBAL_INSTRUMENTATION_HOOKS_KEY, {
|
|
468
|
+
configurable: false,
|
|
469
|
+
enumerable: false,
|
|
470
|
+
value: registry,
|
|
471
|
+
writable: false
|
|
472
|
+
});
|
|
473
|
+
return registry;
|
|
474
|
+
} catch (error) {
|
|
475
|
+
reportError(error);
|
|
476
|
+
return void 0;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function newGlobalTracingChannel(nameOrChannels) {
|
|
480
|
+
if (typeof nameOrChannels !== "string") {
|
|
481
|
+
return new TracingHook(nameOrChannels);
|
|
482
|
+
}
|
|
483
|
+
const registry = getHookRegistry();
|
|
484
|
+
if (!registry) {
|
|
485
|
+
return inertTracingHook;
|
|
486
|
+
}
|
|
487
|
+
let existing;
|
|
488
|
+
try {
|
|
489
|
+
existing = Map.prototype.get.call(registry, nameOrChannels);
|
|
490
|
+
} catch (error) {
|
|
491
|
+
reportError(error);
|
|
492
|
+
return inertTracingHook;
|
|
493
|
+
}
|
|
494
|
+
if (isCompatibleTracingHook(existing)) {
|
|
495
|
+
return existing;
|
|
496
|
+
}
|
|
497
|
+
if (existing !== void 0) {
|
|
498
|
+
reportError(
|
|
499
|
+
new Error(`Invalid global instrumentation hook: ${nameOrChannels}`)
|
|
500
|
+
);
|
|
501
|
+
try {
|
|
502
|
+
Map.prototype.delete.call(registry, nameOrChannels);
|
|
503
|
+
} catch (error) {
|
|
504
|
+
reportError(error);
|
|
505
|
+
return inertTracingHook;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const hook = new TracingHook(nameOrChannels);
|
|
509
|
+
try {
|
|
510
|
+
Map.prototype.set.call(registry, nameOrChannels, hook);
|
|
511
|
+
} catch (error) {
|
|
512
|
+
reportError(error);
|
|
513
|
+
return inertTracingHook;
|
|
514
|
+
}
|
|
515
|
+
return hook;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// src/isomorph.ts
|
|
519
|
+
var DefaultAsyncLocalStorage = class {
|
|
520
|
+
constructor() {
|
|
521
|
+
}
|
|
522
|
+
enterWith(_) {
|
|
523
|
+
}
|
|
524
|
+
run(_, callback) {
|
|
525
|
+
return callback();
|
|
526
|
+
}
|
|
527
|
+
getStore() {
|
|
528
|
+
return void 0;
|
|
171
529
|
}
|
|
172
530
|
};
|
|
173
531
|
var iso = {
|
|
@@ -180,7 +538,7 @@ var iso = {
|
|
|
180
538
|
getCallerLocation: () => void 0,
|
|
181
539
|
newAsyncLocalStorage: () => new DefaultAsyncLocalStorage(),
|
|
182
540
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
183
|
-
newTracingChannel: (nameOrChannels) =>
|
|
541
|
+
newTracingChannel: (nameOrChannels) => newGlobalTracingChannel(nameOrChannels),
|
|
184
542
|
processOn: (_0, _1) => {
|
|
185
543
|
},
|
|
186
544
|
basename: (filepath) => filepath.split(/[\\/]/).pop() || filepath,
|
|
@@ -196,6 +554,8 @@ var INSTRUMENTATION_NAMES = {
|
|
|
196
554
|
BEDROCK_RUNTIME: "bedrock-runtime",
|
|
197
555
|
BRAINTRUST_JS_LOGGER: "braintrust-js-logger",
|
|
198
556
|
CLAUDE_AGENT_SDK: "claude-agent-sdk",
|
|
557
|
+
CLOUDFLARE_AI_CHAT: "cloudflare-ai-chat",
|
|
558
|
+
CLOUDFLARE_AGENTS: "cloudflare-agents",
|
|
199
559
|
COHERE: "cohere",
|
|
200
560
|
CURSOR_SDK: "cursor-sdk",
|
|
201
561
|
EVE: "eve",
|
|
@@ -221,7 +581,7 @@ var INSTRUMENTATION_NAMES = {
|
|
|
221
581
|
var INTERNAL_SPAN_INSTRUMENTATION_NAME = /* @__PURE__ */ Symbol.for(
|
|
222
582
|
"braintrust.spanInstrumentationName"
|
|
223
583
|
);
|
|
224
|
-
var SDK_VERSION = true ? "3.
|
|
584
|
+
var SDK_VERSION = true ? "3.26.0" : "0.0.0";
|
|
225
585
|
function withSpanInstrumentationName(args, instrumentationName) {
|
|
226
586
|
return {
|
|
227
587
|
...args,
|
|
@@ -268,10 +628,10 @@ function detectSpanOriginEnvironment(explicit) {
|
|
|
268
628
|
return { type: "server", name: "ecs" };
|
|
269
629
|
}
|
|
270
630
|
const awsExecutionEnv = isomorph_default.getEnv("AWS_EXECUTION_ENV");
|
|
271
|
-
if (_optionalChain([awsExecutionEnv, 'optionalAccess',
|
|
631
|
+
if (_optionalChain([awsExecutionEnv, 'optionalAccess', _3 => _3.startsWith, 'call', _4 => _4("AWS_ECS_")])) {
|
|
272
632
|
return { type: "server", name: "ecs" };
|
|
273
633
|
}
|
|
274
|
-
if (_optionalChain([awsExecutionEnv, 'optionalAccess',
|
|
634
|
+
if (_optionalChain([awsExecutionEnv, 'optionalAccess', _5 => _5.startsWith, 'call', _6 => _6("AWS_Lambda_")])) {
|
|
275
635
|
return { type: "server", name: "aws_lambda" };
|
|
276
636
|
}
|
|
277
637
|
if (isomorph_default.getEnv("AWS_LAMBDA_FUNCTION_NAME")) {
|
|
@@ -310,7 +670,7 @@ function isSpanInstrumentationName(value) {
|
|
|
310
670
|
return Object.values(INSTRUMENTATION_NAMES).some((name) => name === value);
|
|
311
671
|
}
|
|
312
672
|
function firstPresent(entries) {
|
|
313
|
-
return _optionalChain([entries, 'access',
|
|
673
|
+
return _optionalChain([entries, 'access', _7 => _7.find, 'call', _8 => _8(([key]) => Boolean(isomorph_default.getEnv(key))), 'optionalAccess', _9 => _9[1]]);
|
|
314
674
|
}
|
|
315
675
|
function deploymentModeEnvironment(_key, value) {
|
|
316
676
|
if (!value) return void 0;
|
|
@@ -642,6 +1002,46 @@ var huggingFaceChannels = defineChannels(
|
|
|
642
1002
|
{ instrumentationName: INSTRUMENTATION_NAMES.HUGGINGFACE }
|
|
643
1003
|
);
|
|
644
1004
|
|
|
1005
|
+
// src/instrumentation/plugins/huggingface-transformers-channels.ts
|
|
1006
|
+
var SUPPORTED_TASKS = /* @__PURE__ */ new Set([
|
|
1007
|
+
"text-generation",
|
|
1008
|
+
"text2text-generation",
|
|
1009
|
+
"summarization",
|
|
1010
|
+
"feature-extraction",
|
|
1011
|
+
"question-answering"
|
|
1012
|
+
]);
|
|
1013
|
+
var pipelineInfo = /* @__PURE__ */ new WeakMap();
|
|
1014
|
+
function isSupportedHuggingFaceTransformersTask(task) {
|
|
1015
|
+
return typeof task === "string" && SUPPORTED_TASKS.has(task);
|
|
1016
|
+
}
|
|
1017
|
+
function registerHuggingFaceTransformersPipeline(pipeline, task, model) {
|
|
1018
|
+
if (typeof task !== "string") {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
const info = { task };
|
|
1022
|
+
if (typeof model === "string") {
|
|
1023
|
+
info.model = model;
|
|
1024
|
+
}
|
|
1025
|
+
pipelineInfo.set(pipeline, info);
|
|
1026
|
+
}
|
|
1027
|
+
function getHuggingFaceTransformersPipelineInfo(pipeline) {
|
|
1028
|
+
return pipeline ? pipelineInfo.get(pipeline) : void 0;
|
|
1029
|
+
}
|
|
1030
|
+
var huggingFaceTransformersChannels = defineChannels(
|
|
1031
|
+
"@huggingface/transformers",
|
|
1032
|
+
{
|
|
1033
|
+
pipeline: channel({
|
|
1034
|
+
channelName: "pipeline",
|
|
1035
|
+
kind: "async"
|
|
1036
|
+
}),
|
|
1037
|
+
pipelineCall: channel({
|
|
1038
|
+
channelName: "pipeline.call",
|
|
1039
|
+
kind: "async"
|
|
1040
|
+
})
|
|
1041
|
+
},
|
|
1042
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.HUGGINGFACE }
|
|
1043
|
+
);
|
|
1044
|
+
|
|
645
1045
|
// src/instrumentation/plugins/openrouter-agent-channels.ts
|
|
646
1046
|
var openRouterAgentChannels = defineChannels(
|
|
647
1047
|
"@openrouter/agent",
|
|
@@ -963,6 +1363,18 @@ var strandsAgentSDKChannels = defineChannels(
|
|
|
963
1363
|
{ instrumentationName: INSTRUMENTATION_NAMES.STRANDS_AGENT_SDK }
|
|
964
1364
|
);
|
|
965
1365
|
|
|
1366
|
+
// src/instrumentation/plugins/cloudflare-agents-channels.ts
|
|
1367
|
+
var cloudflareAgentsChannels = defineChannels(
|
|
1368
|
+
"agents",
|
|
1369
|
+
{
|
|
1370
|
+
runAgentTool: channel({
|
|
1371
|
+
channelName: "Agent.runAgentTool",
|
|
1372
|
+
kind: "async"
|
|
1373
|
+
})
|
|
1374
|
+
},
|
|
1375
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_AGENTS }
|
|
1376
|
+
);
|
|
1377
|
+
|
|
966
1378
|
// src/instrumentation/config.ts
|
|
967
1379
|
var envIntegrationAliases = {
|
|
968
1380
|
openai: "openai",
|
|
@@ -980,6 +1392,9 @@ var envIntegrationAliases = {
|
|
|
980
1392
|
strandsagentsdk: "strandsAgentSDK",
|
|
981
1393
|
"strands-agent-sdk": "strandsAgentSDK",
|
|
982
1394
|
"@strands-agents/sdk": "strandsAgentSDK",
|
|
1395
|
+
agents: "cloudflareAgents",
|
|
1396
|
+
"cloudflare-agents": "cloudflareAgents",
|
|
1397
|
+
cloudflareagents: "cloudflareAgents",
|
|
983
1398
|
anthropic: "anthropic",
|
|
984
1399
|
aisdk: "aisdk",
|
|
985
1400
|
"ai-sdk": "aisdk",
|
|
@@ -987,6 +1402,9 @@ var envIntegrationAliases = {
|
|
|
987
1402
|
vercel: "vercel",
|
|
988
1403
|
claudeagentsdk: "claudeAgentSDK",
|
|
989
1404
|
"claude-agent-sdk": "claudeAgentSDK",
|
|
1405
|
+
cloudflareaichat: "cloudflareAIChat",
|
|
1406
|
+
"cloudflare-ai-chat": "cloudflareAIChat",
|
|
1407
|
+
"@cloudflare/ai-chat": "cloudflareAIChat",
|
|
990
1408
|
cursor: "cursor",
|
|
991
1409
|
"cursor-sdk": "cursorSDK",
|
|
992
1410
|
cursorsdk: "cursorSDK",
|
|
@@ -1001,6 +1419,8 @@ var envIntegrationAliases = {
|
|
|
1001
1419
|
"google-genai": "googleGenAI",
|
|
1002
1420
|
googlegenai: "googleGenAI",
|
|
1003
1421
|
huggingface: "huggingface",
|
|
1422
|
+
"@huggingface/transformers": "huggingface",
|
|
1423
|
+
transformers: "huggingface",
|
|
1004
1424
|
openrouter: "openrouter",
|
|
1005
1425
|
openrouteragent: "openrouterAgent",
|
|
1006
1426
|
"openrouter-agent": "openrouterAgent",
|
|
@@ -1039,6 +1459,7 @@ function getDefaultInstrumentationIntegrations() {
|
|
|
1039
1459
|
googleADK: true,
|
|
1040
1460
|
huggingface: true,
|
|
1041
1461
|
claudeAgentSDK: true,
|
|
1462
|
+
cloudflareAIChat: true,
|
|
1042
1463
|
cursor: true,
|
|
1043
1464
|
cursorSDK: true,
|
|
1044
1465
|
flue: true,
|
|
@@ -1058,7 +1479,8 @@ function getDefaultInstrumentationIntegrations() {
|
|
|
1058
1479
|
langgraph: true,
|
|
1059
1480
|
langsmith: true,
|
|
1060
1481
|
piCodingAgent: true,
|
|
1061
|
-
strandsAgentSDK: true
|
|
1482
|
+
strandsAgentSDK: true,
|
|
1483
|
+
cloudflareAgents: true
|
|
1062
1484
|
};
|
|
1063
1485
|
}
|
|
1064
1486
|
function readDisabledInstrumentationEnvConfig(disabledList) {
|
|
@@ -1075,7 +1497,7 @@ function readDisabledInstrumentationEnvConfig(disabledList) {
|
|
|
1075
1497
|
return { integrations };
|
|
1076
1498
|
}
|
|
1077
1499
|
function isInstrumentationIntegrationDisabled(integrations, ...names) {
|
|
1078
|
-
return names.some((name) => _optionalChain([integrations, 'optionalAccess',
|
|
1500
|
+
return names.some((name) => _optionalChain([integrations, 'optionalAccess', _10 => _10[name]]) === false);
|
|
1079
1501
|
}
|
|
1080
1502
|
|
|
1081
1503
|
// src/auto-instrumentations/loader/mastra-observability-patch.ts
|
|
@@ -1291,6 +1713,32 @@ var langChainChannels = defineChannels(
|
|
|
1291
1713
|
{ instrumentationName: INSTRUMENTATION_NAMES.LANGCHAIN }
|
|
1292
1714
|
);
|
|
1293
1715
|
|
|
1716
|
+
// src/instrumentation/plugins/cloudflare-ai-chat-channels.ts
|
|
1717
|
+
var cloudflareAIChatChannels = defineChannels(
|
|
1718
|
+
"@cloudflare/ai-chat",
|
|
1719
|
+
{
|
|
1720
|
+
runExclusiveChatTurn: channel({
|
|
1721
|
+
channelName: "AIChatAgent._runExclusiveChatTurn",
|
|
1722
|
+
kind: "async"
|
|
1723
|
+
}),
|
|
1724
|
+
onChatResponse: channel({
|
|
1725
|
+
channelName: "AIChatAgent.onChatResponse",
|
|
1726
|
+
kind: "sync-stream"
|
|
1727
|
+
})
|
|
1728
|
+
},
|
|
1729
|
+
{ instrumentationName: INSTRUMENTATION_NAMES.CLOUDFLARE_AI_CHAT }
|
|
1730
|
+
);
|
|
1731
|
+
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
|
|
1735
|
+
|
|
1736
|
+
|
|
1737
|
+
|
|
1738
|
+
|
|
1739
|
+
|
|
1740
|
+
|
|
1741
|
+
|
|
1294
1742
|
|
|
1295
1743
|
|
|
1296
1744
|
|
|
@@ -1333,4 +1781,4 @@ var langChainChannels = defineChannels(
|
|
|
1333
1781
|
|
|
1334
1782
|
|
|
1335
1783
|
|
|
1336
|
-
exports.__export = __export; exports.
|
|
1784
|
+
exports.__export = __export; exports.GLOBAL_INSTRUMENTATION_HOOKS_KEY = GLOBAL_INSTRUMENTATION_HOOKS_KEY; exports.GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION = GLOBAL_INSTRUMENTATION_HOOKS_PROTOCOL_VERSION; exports.GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND = GLOBAL_INSTRUMENTATION_HOOKS_REGISTRY_BRAND; exports.GLOBAL_INSTRUMENTATION_HOOK_BRAND = GLOBAL_INSTRUMENTATION_HOOK_BRAND; exports.setGlobalHookErrorReporter = setGlobalHookErrorReporter; exports.isomorph_default = isomorph_default; exports.INSTRUMENTATION_NAMES = INSTRUMENTATION_NAMES; exports.withSpanInstrumentationName = withSpanInstrumentationName; exports.getSpanInstrumentationName = getSpanInstrumentationName; exports.detectSpanOriginEnvironment = detectSpanOriginEnvironment; exports.mergeSpanOriginContext = mergeSpanOriginContext; exports.openAIChannels = openAIChannels; exports.openAICodexChannels = openAICodexChannels; exports.anthropicChannels = anthropicChannels; exports.aiSDKChannels = aiSDKChannels; exports.harnessAgentChannels = harnessAgentChannels; exports.claudeAgentSDKChannels = claudeAgentSDKChannels; exports.cursorSDKChannels = cursorSDKChannels; exports.openAIAgentsCoreChannels = openAIAgentsCoreChannels; exports.googleGenAIChannels = googleGenAIChannels; exports.huggingFaceChannels = huggingFaceChannels; exports.isSupportedHuggingFaceTransformersTask = isSupportedHuggingFaceTransformersTask; exports.registerHuggingFaceTransformersPipeline = registerHuggingFaceTransformersPipeline; exports.getHuggingFaceTransformersPipelineInfo = getHuggingFaceTransformersPipelineInfo; exports.huggingFaceTransformersChannels = huggingFaceTransformersChannels; exports.openRouterAgentChannels = openRouterAgentChannels; exports.openRouterChannels = openRouterChannels; exports.mistralChannels = mistralChannels; exports.googleADKChannels = googleADKChannels; exports.cohereChannels = cohereChannels; exports.groqChannels = groqChannels; exports.bedrockRuntimeChannels = bedrockRuntimeChannels; exports.smithyCoreChannels = smithyCoreChannels; exports.smithyClientChannels = smithyClientChannels; exports.genkitChannels = genkitChannels; exports.genkitCoreChannels = genkitCoreChannels; exports.gitHubCopilotChannels = gitHubCopilotChannels; exports.flueChannels = flueChannels; exports.langChainChannels = langChainChannels; exports.langSmithChannels = langSmithChannels; exports.piCodingAgentChannels = piCodingAgentChannels; exports.strandsAgentSDKChannels = strandsAgentSDKChannels; exports.cloudflareAIChatChannels = cloudflareAIChatChannels; exports.cloudflareAgentsChannels = cloudflareAgentsChannels; exports.getDefaultInstrumentationIntegrations = getDefaultInstrumentationIntegrations; exports.readDisabledInstrumentationEnvConfig = readDisabledInstrumentationEnvConfig; exports.isInstrumentationIntegrationDisabled = isInstrumentationIntegrationDisabled; exports.installMastraExporterFactory = installMastraExporterFactory; exports.classifyMastraTarget = classifyMastraTarget; exports.patchMastraSource = patchMastraSource;
|