@morsehq-dev/sdk 0.4.0-rc.1
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/LICENSE +21 -0
- package/README.md +294 -0
- package/dist/anthropic/index.cjs +39 -0
- package/dist/anthropic/index.cjs.map +1 -0
- package/dist/anthropic/index.d.cts +213 -0
- package/dist/anthropic/index.d.ts +213 -0
- package/dist/anthropic/index.js +6 -0
- package/dist/anthropic/index.js.map +1 -0
- package/dist/anthropic-agent-sdk/index.cjs +744 -0
- package/dist/anthropic-agent-sdk/index.cjs.map +1 -0
- package/dist/anthropic-agent-sdk/index.d.cts +371 -0
- package/dist/anthropic-agent-sdk/index.d.ts +371 -0
- package/dist/anthropic-agent-sdk/index.js +735 -0
- package/dist/anthropic-agent-sdk/index.js.map +1 -0
- package/dist/browser/anthropic/index.cjs +39 -0
- package/dist/browser/anthropic/index.cjs.map +1 -0
- package/dist/browser/anthropic/index.js +6 -0
- package/dist/browser/anthropic/index.js.map +1 -0
- package/dist/browser/anthropic-agent-sdk/index.cjs +744 -0
- package/dist/browser/anthropic-agent-sdk/index.cjs.map +1 -0
- package/dist/browser/anthropic-agent-sdk/index.js +735 -0
- package/dist/browser/anthropic-agent-sdk/index.js.map +1 -0
- package/dist/browser/chunk-3643DC7K.cjs +365 -0
- package/dist/browser/chunk-3643DC7K.cjs.map +1 -0
- package/dist/browser/chunk-4FALQMOZ.js +232 -0
- package/dist/browser/chunk-4FALQMOZ.js.map +1 -0
- package/dist/browser/chunk-5J2QBK75.js +884 -0
- package/dist/browser/chunk-5J2QBK75.js.map +1 -0
- package/dist/browser/chunk-7MSXWGAH.js +53 -0
- package/dist/browser/chunk-7MSXWGAH.js.map +1 -0
- package/dist/browser/chunk-A24L5N5N.js +596 -0
- package/dist/browser/chunk-A24L5N5N.js.map +1 -0
- package/dist/browser/chunk-B7DEUDP6.cjs +177 -0
- package/dist/browser/chunk-B7DEUDP6.cjs.map +1 -0
- package/dist/browser/chunk-F6CJACNH.cjs +604 -0
- package/dist/browser/chunk-F6CJACNH.cjs.map +1 -0
- package/dist/browser/chunk-JBOYFQSB.js +412 -0
- package/dist/browser/chunk-JBOYFQSB.js.map +1 -0
- package/dist/browser/chunk-KRBADE6R.cjs +183 -0
- package/dist/browser/chunk-KRBADE6R.cjs.map +1 -0
- package/dist/browser/chunk-MCJYZH6W.cjs +415 -0
- package/dist/browser/chunk-MCJYZH6W.cjs.map +1 -0
- package/dist/browser/chunk-NQG2IAQS.js +178 -0
- package/dist/browser/chunk-NQG2IAQS.js.map +1 -0
- package/dist/browser/chunk-O4HG3OSK.cjs +929 -0
- package/dist/browser/chunk-O4HG3OSK.cjs.map +1 -0
- package/dist/browser/chunk-QWRQJO57.js +363 -0
- package/dist/browser/chunk-QWRQJO57.js.map +1 -0
- package/dist/browser/chunk-SWQOPFE4.cjs +234 -0
- package/dist/browser/chunk-SWQOPFE4.cjs.map +1 -0
- package/dist/browser/chunk-TYDG747E.js +171 -0
- package/dist/browser/chunk-TYDG747E.js.map +1 -0
- package/dist/browser/chunk-TZRSDDFP.cjs +56 -0
- package/dist/browser/chunk-TZRSDDFP.cjs.map +1 -0
- package/dist/browser/index.cjs +587 -0
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.js +522 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/integrations/pino.cjs +89 -0
- package/dist/browser/integrations/pino.cjs.map +1 -0
- package/dist/browser/integrations/pino.js +86 -0
- package/dist/browser/integrations/pino.js.map +1 -0
- package/dist/browser/langchain/index.cjs +535 -0
- package/dist/browser/langchain/index.cjs.map +1 -0
- package/dist/browser/langchain/index.js +528 -0
- package/dist/browser/langchain/index.js.map +1 -0
- package/dist/browser/langgraph/index.cjs +377 -0
- package/dist/browser/langgraph/index.cjs.map +1 -0
- package/dist/browser/langgraph/index.js +371 -0
- package/dist/browser/langgraph/index.js.map +1 -0
- package/dist/browser/openai/index.cjs +125 -0
- package/dist/browser/openai/index.cjs.map +1 -0
- package/dist/browser/openai/index.js +122 -0
- package/dist/browser/openai/index.js.map +1 -0
- package/dist/browser/openai-agents/index.cjs +689 -0
- package/dist/browser/openai-agents/index.cjs.map +1 -0
- package/dist/browser/openai-agents/index.js +678 -0
- package/dist/browser/openai-agents/index.js.map +1 -0
- package/dist/browser/vercel-ai/index.cjs +233 -0
- package/dist/browser/vercel-ai/index.cjs.map +1 -0
- package/dist/browser/vercel-ai/index.js +231 -0
- package/dist/browser/vercel-ai/index.js.map +1 -0
- package/dist/chunk-4R4SHGOK.js +363 -0
- package/dist/chunk-4R4SHGOK.js.map +1 -0
- package/dist/chunk-7EO7MQBA.cjs +183 -0
- package/dist/chunk-7EO7MQBA.cjs.map +1 -0
- package/dist/chunk-7YCENA54.cjs +604 -0
- package/dist/chunk-7YCENA54.cjs.map +1 -0
- package/dist/chunk-CKFOGDUF.js +596 -0
- package/dist/chunk-CKFOGDUF.js.map +1 -0
- package/dist/chunk-FJUNILZT.cjs +1324 -0
- package/dist/chunk-FJUNILZT.cjs.map +1 -0
- package/dist/chunk-HDAFUKQ3.js +171 -0
- package/dist/chunk-HDAFUKQ3.js.map +1 -0
- package/dist/chunk-KBWPNIH4.cjs +234 -0
- package/dist/chunk-KBWPNIH4.cjs.map +1 -0
- package/dist/chunk-KJEO52QS.cjs +365 -0
- package/dist/chunk-KJEO52QS.cjs.map +1 -0
- package/dist/chunk-KZBCOZIQ.cjs +177 -0
- package/dist/chunk-KZBCOZIQ.cjs.map +1 -0
- package/dist/chunk-ME5JALGT.js +53 -0
- package/dist/chunk-ME5JALGT.js.map +1 -0
- package/dist/chunk-PVHDEPRE.cjs +56 -0
- package/dist/chunk-PVHDEPRE.cjs.map +1 -0
- package/dist/chunk-RTL23YOQ.js +178 -0
- package/dist/chunk-RTL23YOQ.js.map +1 -0
- package/dist/chunk-TQWI4UYO.js +1277 -0
- package/dist/chunk-TQWI4UYO.js.map +1 -0
- package/dist/chunk-VXDBDPDR.cjs +415 -0
- package/dist/chunk-VXDBDPDR.cjs.map +1 -0
- package/dist/chunk-XTKMUJWI.js +232 -0
- package/dist/chunk-XTKMUJWI.js.map +1 -0
- package/dist/chunk-ZKUGOWER.js +412 -0
- package/dist/chunk-ZKUGOWER.js.map +1 -0
- package/dist/index.cjs +843 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +464 -0
- package/dist/index.d.ts +464 -0
- package/dist/index.js +778 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/pino.cjs +89 -0
- package/dist/integrations/pino.cjs.map +1 -0
- package/dist/integrations/pino.d.cts +65 -0
- package/dist/integrations/pino.d.ts +65 -0
- package/dist/integrations/pino.js +86 -0
- package/dist/integrations/pino.js.map +1 -0
- package/dist/langchain/index.cjs +535 -0
- package/dist/langchain/index.cjs.map +1 -0
- package/dist/langchain/index.d.cts +265 -0
- package/dist/langchain/index.d.ts +265 -0
- package/dist/langchain/index.js +528 -0
- package/dist/langchain/index.js.map +1 -0
- package/dist/langgraph/index.cjs +377 -0
- package/dist/langgraph/index.cjs.map +1 -0
- package/dist/langgraph/index.d.cts +324 -0
- package/dist/langgraph/index.d.ts +324 -0
- package/dist/langgraph/index.js +371 -0
- package/dist/langgraph/index.js.map +1 -0
- package/dist/openai/index.cjs +125 -0
- package/dist/openai/index.cjs.map +1 -0
- package/dist/openai/index.d.cts +136 -0
- package/dist/openai/index.d.ts +136 -0
- package/dist/openai/index.js +122 -0
- package/dist/openai/index.js.map +1 -0
- package/dist/openai-agents/index.cjs +689 -0
- package/dist/openai-agents/index.cjs.map +1 -0
- package/dist/openai-agents/index.d.cts +502 -0
- package/dist/openai-agents/index.d.ts +502 -0
- package/dist/openai-agents/index.js +678 -0
- package/dist/openai-agents/index.js.map +1 -0
- package/dist/spans-DZtMuBvc.d.cts +73 -0
- package/dist/spans-DZtMuBvc.d.ts +73 -0
- package/dist/tracing-BYAqjT5Q.d.cts +114 -0
- package/dist/tracing-rz9cWQ8d.d.ts +114 -0
- package/dist/vercel-ai/index.cjs +233 -0
- package/dist/vercel-ai/index.cjs.map +1 -0
- package/dist/vercel-ai/index.d.cts +93 -0
- package/dist/vercel-ai/index.d.ts +93 -0
- package/dist/vercel-ai/index.js +231 -0
- package/dist/vercel-ai/index.js.map +1 -0
- package/package.json +182 -0
|
@@ -0,0 +1,689 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMCJYZH6W_cjs = require('../chunk-MCJYZH6W.cjs');
|
|
4
|
+
var chunkB7DEUDP6_cjs = require('../chunk-B7DEUDP6.cjs');
|
|
5
|
+
var chunkSWQOPFE4_cjs = require('../chunk-SWQOPFE4.cjs');
|
|
6
|
+
var chunkKRBADE6R_cjs = require('../chunk-KRBADE6R.cjs');
|
|
7
|
+
var chunk3643DC7K_cjs = require('../chunk-3643DC7K.cjs');
|
|
8
|
+
var chunkO4HG3OSK_cjs = require('../chunk-O4HG3OSK.cjs');
|
|
9
|
+
|
|
10
|
+
// src/openai-agents/runner-wrapper.ts
|
|
11
|
+
chunkO4HG3OSK_cjs.init_tracing();
|
|
12
|
+
var WRAPPED_RUNNER = /* @__PURE__ */ Symbol.for("morse.openai-agents.wrapped");
|
|
13
|
+
var INSTALL_SENTINEL = /* @__PURE__ */ Symbol.for("morse.openai-agents.installed");
|
|
14
|
+
var ORIGINALS_SENTINEL = /* @__PURE__ */ Symbol.for("morse.openai-agents.originals");
|
|
15
|
+
function wrapRunner(runner, options = {}) {
|
|
16
|
+
if (!runner || typeof runner !== "object") return runner;
|
|
17
|
+
if (runner[WRAPPED_RUNNER]) return runner;
|
|
18
|
+
const originalRun = runner.run?.bind(runner);
|
|
19
|
+
if (typeof originalRun !== "function") return runner;
|
|
20
|
+
const patchedRun = buildPatchedRun(
|
|
21
|
+
originalRun,
|
|
22
|
+
options
|
|
23
|
+
);
|
|
24
|
+
const wrapper = new Proxy(runner, {
|
|
25
|
+
get(target, prop, receiver) {
|
|
26
|
+
if (prop === WRAPPED_RUNNER) return true;
|
|
27
|
+
if (prop === "run") return patchedRun;
|
|
28
|
+
const value = Reflect.get(target, prop, receiver);
|
|
29
|
+
if (typeof value === "function") {
|
|
30
|
+
return value.bind(target);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return wrapper;
|
|
36
|
+
}
|
|
37
|
+
var instrumentOpenAIAgents = chunkKRBADE6R_cjs.absorbErrorsAsync(
|
|
38
|
+
async (runnerOrOptions = void 0, maybeOptions = {}) => {
|
|
39
|
+
if (runnerOrOptions && isRunner(runnerOrOptions)) {
|
|
40
|
+
const opts2 = maybeOptions ?? {};
|
|
41
|
+
return wrapRunner(runnerOrOptions, opts2);
|
|
42
|
+
}
|
|
43
|
+
const opts = runnerOrOptions ?? {};
|
|
44
|
+
const mod = await loadOpenAIAgentsModule(opts.openaiAgentsModule);
|
|
45
|
+
if (!mod) return false;
|
|
46
|
+
const installed = mod[INSTALL_SENTINEL] === true;
|
|
47
|
+
if (installed) return true;
|
|
48
|
+
const carrier = findRunnerPrototypeCarrier(mod);
|
|
49
|
+
if (!carrier) return false;
|
|
50
|
+
const originalRun = carrier.prototype.run;
|
|
51
|
+
if (typeof originalRun !== "function") return false;
|
|
52
|
+
const patchedRun = buildPatchedRun(function(agent, input, callOptions) {
|
|
53
|
+
return originalRun.call(
|
|
54
|
+
this,
|
|
55
|
+
agent,
|
|
56
|
+
input,
|
|
57
|
+
callOptions
|
|
58
|
+
);
|
|
59
|
+
}, opts);
|
|
60
|
+
carrier.prototype.run = patchedRun;
|
|
61
|
+
mod[ORIGINALS_SENTINEL] = {
|
|
62
|
+
protoRun: originalRun,
|
|
63
|
+
protoCarrier: carrier
|
|
64
|
+
};
|
|
65
|
+
mod[INSTALL_SENTINEL] = true;
|
|
66
|
+
return true;
|
|
67
|
+
},
|
|
68
|
+
{ fingerprint: "morse.adapters.openai-agents.install" }
|
|
69
|
+
);
|
|
70
|
+
var uninstallOpenAIAgents = chunkKRBADE6R_cjs.absorbErrorsSync(
|
|
71
|
+
(openaiAgentsModule) => {
|
|
72
|
+
if (!openaiAgentsModule || typeof openaiAgentsModule !== "object") return;
|
|
73
|
+
const mod = openaiAgentsModule;
|
|
74
|
+
if (!mod[INSTALL_SENTINEL]) return;
|
|
75
|
+
const originals = mod[ORIGINALS_SENTINEL];
|
|
76
|
+
if (originals?.protoCarrier && originals.protoRun !== void 0) {
|
|
77
|
+
originals.protoCarrier.prototype.run = originals.protoRun;
|
|
78
|
+
}
|
|
79
|
+
mod[ORIGINALS_SENTINEL] = void 0;
|
|
80
|
+
mod[INSTALL_SENTINEL] = false;
|
|
81
|
+
},
|
|
82
|
+
{ fingerprint: "morse.adapters.openai-agents.uninstall" }
|
|
83
|
+
);
|
|
84
|
+
function isOpenAIAgentsWrapped(runner) {
|
|
85
|
+
if (!runner || typeof runner !== "object") return false;
|
|
86
|
+
return runner[WRAPPED_RUNNER] === true;
|
|
87
|
+
}
|
|
88
|
+
function isRunner(x) {
|
|
89
|
+
if (!x || typeof x !== "object") return false;
|
|
90
|
+
const r = x.run;
|
|
91
|
+
return typeof r === "function";
|
|
92
|
+
}
|
|
93
|
+
async function loadOpenAIAgentsModule(explicit) {
|
|
94
|
+
if (explicit && typeof explicit === "object") return explicit;
|
|
95
|
+
try {
|
|
96
|
+
return await Function("m", "return import(m)")("@openai/agents");
|
|
97
|
+
} catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function findRunnerPrototypeCarrier(mod) {
|
|
102
|
+
if (!mod || typeof mod !== "object") return null;
|
|
103
|
+
const m = mod;
|
|
104
|
+
const candidates = [m.Runner, m.default?.Runner];
|
|
105
|
+
for (const c of candidates) {
|
|
106
|
+
if (c && typeof c === "function" && c.prototype && typeof c.prototype.run === "function") {
|
|
107
|
+
return c;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
function stringifyModel(m) {
|
|
113
|
+
if (typeof m === "string" && m.length > 0) return m;
|
|
114
|
+
if (m && typeof m === "object" && typeof m.id === "string" && m.id.length > 0) return m.id;
|
|
115
|
+
return void 0;
|
|
116
|
+
}
|
|
117
|
+
function buildPatchedRun(original, options) {
|
|
118
|
+
return function patchedRun(agent, input, callOptions) {
|
|
119
|
+
const boundOriginal = (a, i, o) => original.call(this, a, i, o);
|
|
120
|
+
const agentName = (agent && typeof agent === "object" && typeof agent.name === "string" && agent.name.length > 0 ? agent.name : void 0) ?? options.defaultAgentName ?? "openai-agent";
|
|
121
|
+
const model = stringifyModel(agent?.model);
|
|
122
|
+
const runWithSpan = async () => {
|
|
123
|
+
const handle = chunkB7DEUDP6_cjs.emitAgentSpan({
|
|
124
|
+
adapter: "openai-agents",
|
|
125
|
+
agentName,
|
|
126
|
+
model
|
|
127
|
+
});
|
|
128
|
+
try {
|
|
129
|
+
const result = await boundOriginal(agent, input, callOptions);
|
|
130
|
+
try {
|
|
131
|
+
options.onRunResult?.(result, model);
|
|
132
|
+
} catch {
|
|
133
|
+
}
|
|
134
|
+
handle?.end();
|
|
135
|
+
return result;
|
|
136
|
+
} catch (err) {
|
|
137
|
+
handle?.end(err);
|
|
138
|
+
throw err;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
if (chunkO4HG3OSK_cjs.getActiveTraceState() !== null) {
|
|
142
|
+
return runWithSpan();
|
|
143
|
+
}
|
|
144
|
+
return (async () => {
|
|
145
|
+
let captured;
|
|
146
|
+
let caughtErr;
|
|
147
|
+
const runResult = await chunkO4HG3OSK_cjs.runAsync({ agentName }, async (runHandle) => {
|
|
148
|
+
try {
|
|
149
|
+
captured = await runWithSpan();
|
|
150
|
+
runHandle.setOutcome(true);
|
|
151
|
+
return captured;
|
|
152
|
+
} catch (err) {
|
|
153
|
+
caughtErr = err;
|
|
154
|
+
throw err;
|
|
155
|
+
}
|
|
156
|
+
}).catch((err) => {
|
|
157
|
+
if (caughtErr === void 0) caughtErr = err;
|
|
158
|
+
return void 0;
|
|
159
|
+
});
|
|
160
|
+
if (caughtErr !== void 0) throw caughtErr;
|
|
161
|
+
return captured ?? runResult;
|
|
162
|
+
})();
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// src/openai-agents/llm-and-tool.ts
|
|
167
|
+
var ADAPTER = "openai-agents";
|
|
168
|
+
function installLlmAndToolInstrumentation(runner, options) {
|
|
169
|
+
if (typeof runner?.on !== "function") {
|
|
170
|
+
return () => {
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
const opts = options ?? {};
|
|
174
|
+
const llmStack = [];
|
|
175
|
+
const toolStack = [];
|
|
176
|
+
const onLlmStart = chunkKRBADE6R_cjs.absorbErrorsSync(
|
|
177
|
+
(event) => {
|
|
178
|
+
const contextSegments = chunk3643DC7K_cjs.decomposeOpenAiMessages(event.llm?.messages, event.llm?.tools);
|
|
179
|
+
const handle = chunkB7DEUDP6_cjs.emitLlmSpan({
|
|
180
|
+
adapter: ADAPTER,
|
|
181
|
+
model: typeof event.llm?.model === "string" && event.llm.model.length > 0 ? event.llm.model : "unknown",
|
|
182
|
+
provider: typeof event.llm?.provider === "string" ? event.llm.provider : void 0,
|
|
183
|
+
contextSegments: contextSegments.length > 0 ? contextSegments : void 0
|
|
184
|
+
});
|
|
185
|
+
if (handle !== null) llmStack.push(handle);
|
|
186
|
+
},
|
|
187
|
+
{ fingerprint: "morse.openai-agents.llm_call_start" }
|
|
188
|
+
);
|
|
189
|
+
const onLlmEnd = chunkKRBADE6R_cjs.absorbErrorsSync(
|
|
190
|
+
(event) => {
|
|
191
|
+
const handle = llmStack.shift();
|
|
192
|
+
if (handle === void 0) return;
|
|
193
|
+
const usage = event.llm?.usage;
|
|
194
|
+
if (usage !== void 0 && usage !== null) {
|
|
195
|
+
if (typeof usage.input_tokens === "number" && Number.isFinite(usage.input_tokens)) {
|
|
196
|
+
handle.span.input_tokens = usage.input_tokens;
|
|
197
|
+
}
|
|
198
|
+
if (typeof usage.output_tokens === "number" && Number.isFinite(usage.output_tokens)) {
|
|
199
|
+
handle.span.output_tokens = usage.output_tokens;
|
|
200
|
+
}
|
|
201
|
+
if (typeof usage.total_tokens === "number" && Number.isFinite(usage.total_tokens)) {
|
|
202
|
+
handle.span.total_tokens = usage.total_tokens;
|
|
203
|
+
} else if (handle.span.input_tokens !== void 0 && handle.span.output_tokens !== void 0) {
|
|
204
|
+
handle.span.total_tokens = handle.span.input_tokens + handle.span.output_tokens;
|
|
205
|
+
}
|
|
206
|
+
const cachedTokens = typeof usage.cached_tokens === "number" && Number.isFinite(usage.cached_tokens) ? usage.cached_tokens : 0;
|
|
207
|
+
if (handle.span.cost_usd === void 0 && handle.span.model && (handle.span.input_tokens !== void 0 || handle.span.output_tokens !== void 0)) {
|
|
208
|
+
const cost = chunkSWQOPFE4_cjs.calculateCost({
|
|
209
|
+
inputTokens: handle.span.input_tokens ?? 0,
|
|
210
|
+
outputTokens: handle.span.output_tokens ?? 0,
|
|
211
|
+
model: handle.span.model,
|
|
212
|
+
cachedInputTokens: cachedTokens
|
|
213
|
+
});
|
|
214
|
+
if (cost !== void 0) handle.span.cost_usd = cost;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
handle.end();
|
|
218
|
+
},
|
|
219
|
+
{ fingerprint: "morse.openai-agents.llm_call_end" }
|
|
220
|
+
);
|
|
221
|
+
const onToolStart = chunkKRBADE6R_cjs.absorbErrorsSync(
|
|
222
|
+
(event) => {
|
|
223
|
+
const toolName = typeof event.tool?.name === "string" && event.tool.name.length > 0 ? event.tool.name : "unknown";
|
|
224
|
+
const inputSummary = chunkMCJYZH6W_cjs.summarizeToolInput(
|
|
225
|
+
event.tool?.input,
|
|
226
|
+
opts.toolInputMaxBytes !== void 0 ? { maxBytes: opts.toolInputMaxBytes } : void 0
|
|
227
|
+
);
|
|
228
|
+
const handle = chunkB7DEUDP6_cjs.emitToolSpan({
|
|
229
|
+
adapter: ADAPTER,
|
|
230
|
+
toolName,
|
|
231
|
+
inputSummary
|
|
232
|
+
});
|
|
233
|
+
if (handle !== null) toolStack.push(handle);
|
|
234
|
+
},
|
|
235
|
+
{ fingerprint: "morse.openai-agents.tool_call_start" }
|
|
236
|
+
);
|
|
237
|
+
const onToolEnd = chunkKRBADE6R_cjs.absorbErrorsSync(
|
|
238
|
+
(event) => {
|
|
239
|
+
const handle = toolStack.shift();
|
|
240
|
+
if (handle === void 0) return;
|
|
241
|
+
const outputSummary = chunkMCJYZH6W_cjs.summarizeToolOutput(
|
|
242
|
+
event.tool?.output,
|
|
243
|
+
opts.toolOutputMaxBytes !== void 0 ? { maxBytes: opts.toolOutputMaxBytes } : void 0
|
|
244
|
+
);
|
|
245
|
+
const success = typeof event.tool?.success === "boolean" ? event.tool.success : true;
|
|
246
|
+
const metadata = handle.span.metadata ?? {};
|
|
247
|
+
const tool = metadata.tool !== void 0 && metadata.tool !== null ? metadata.tool : {};
|
|
248
|
+
tool.output_summary = outputSummary;
|
|
249
|
+
tool.success = success;
|
|
250
|
+
if (typeof event.tool?.duration_ms === "number" && Number.isFinite(event.tool.duration_ms)) {
|
|
251
|
+
tool.duration_ms = event.tool.duration_ms;
|
|
252
|
+
}
|
|
253
|
+
metadata.tool = tool;
|
|
254
|
+
metadata.tool_output_summary = outputSummary;
|
|
255
|
+
handle.span.metadata = metadata;
|
|
256
|
+
if (success === false) {
|
|
257
|
+
handle.end(new Error("tool call reported failure"));
|
|
258
|
+
} else {
|
|
259
|
+
handle.end();
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{ fingerprint: "morse.openai-agents.tool_call_end" }
|
|
263
|
+
);
|
|
264
|
+
runner.on("llm_call_start", onLlmStart);
|
|
265
|
+
runner.on("llm_call_end", onLlmEnd);
|
|
266
|
+
runner.on("tool_call_start", onToolStart);
|
|
267
|
+
runner.on("tool_call_end", onToolEnd);
|
|
268
|
+
let unsubscribed = false;
|
|
269
|
+
return () => {
|
|
270
|
+
if (unsubscribed) return;
|
|
271
|
+
unsubscribed = true;
|
|
272
|
+
if (typeof runner.off === "function") {
|
|
273
|
+
runner.off("llm_call_start", onLlmStart);
|
|
274
|
+
runner.off("llm_call_end", onLlmEnd);
|
|
275
|
+
runner.off("tool_call_start", onToolStart);
|
|
276
|
+
runner.off("tool_call_end", onToolEnd);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// src/openai-agents/handoff.ts
|
|
282
|
+
var _handleHandoffEvent = (event) => {
|
|
283
|
+
if (event === null || typeof event !== "object") return;
|
|
284
|
+
const handoff = event.handoff;
|
|
285
|
+
if (!handoff || typeof handoff !== "object") return;
|
|
286
|
+
const from = handoff.from_agent;
|
|
287
|
+
const to = handoff.to_agent;
|
|
288
|
+
if (typeof from !== "string" || from.length === 0) return;
|
|
289
|
+
if (typeof to !== "string" || to.length === 0) return;
|
|
290
|
+
const reason = typeof handoff.reason === "string" && handoff.reason.length > 0 ? handoff.reason : void 0;
|
|
291
|
+
const attributes = {
|
|
292
|
+
handoff_from: from
|
|
293
|
+
};
|
|
294
|
+
if (reason !== void 0) attributes.handoff_reason = reason;
|
|
295
|
+
const handle = chunkB7DEUDP6_cjs.emitSubagentSpan({
|
|
296
|
+
adapter: "openai-agents",
|
|
297
|
+
parentAgentName: from,
|
|
298
|
+
subagentName: to,
|
|
299
|
+
taskDescription: reason,
|
|
300
|
+
attributes
|
|
301
|
+
});
|
|
302
|
+
handle?.end();
|
|
303
|
+
};
|
|
304
|
+
var handleHandoffEvent = chunkKRBADE6R_cjs.absorbErrorsSync(_handleHandoffEvent, {
|
|
305
|
+
fingerprint: "morse.adapters.openai-agents.handoff.listener"
|
|
306
|
+
});
|
|
307
|
+
function installHandoffInstrumentation(runner) {
|
|
308
|
+
if (runner === null || typeof runner !== "object") return () => {
|
|
309
|
+
};
|
|
310
|
+
if (typeof runner.on !== "function") return () => {
|
|
311
|
+
};
|
|
312
|
+
try {
|
|
313
|
+
runner.on("handoff", handleHandoffEvent);
|
|
314
|
+
} catch {
|
|
315
|
+
return () => {
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
let active = true;
|
|
319
|
+
return () => {
|
|
320
|
+
if (!active) return;
|
|
321
|
+
active = false;
|
|
322
|
+
try {
|
|
323
|
+
runner.off?.("handoff", handleHandoffEvent);
|
|
324
|
+
} catch {
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/openai-agents/guardrail.ts
|
|
330
|
+
var _handleGuardrailEvent = (payload) => {
|
|
331
|
+
const guardrail = payload?.guardrail;
|
|
332
|
+
if (guardrail === void 0 || guardrail === null || typeof guardrail !== "object") {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const name = typeof guardrail.name === "string" && guardrail.name.length > 0 ? guardrail.name : void 0;
|
|
336
|
+
const passed = guardrail.passed === true;
|
|
337
|
+
const reason = typeof guardrail.reason === "string" && guardrail.reason.length > 0 ? guardrail.reason : void 0;
|
|
338
|
+
const guardrailMeta = { passed };
|
|
339
|
+
if (name !== void 0) guardrailMeta.name = name;
|
|
340
|
+
if (reason !== void 0) guardrailMeta.reason = reason;
|
|
341
|
+
const handle = chunkB7DEUDP6_cjs.emitToolSpan({
|
|
342
|
+
adapter: "openai-agents",
|
|
343
|
+
toolName: `guardrail.${name ?? "anon"}`,
|
|
344
|
+
success: passed
|
|
345
|
+
});
|
|
346
|
+
if (handle === null || handle === void 0) return;
|
|
347
|
+
handle.span.metadata = {
|
|
348
|
+
...handle.span.metadata ?? {},
|
|
349
|
+
tool_kind: "guardrail",
|
|
350
|
+
guardrail: guardrailMeta
|
|
351
|
+
};
|
|
352
|
+
if (passed) {
|
|
353
|
+
handle.end();
|
|
354
|
+
} else {
|
|
355
|
+
handle.end(new Error(`guardrail failed: ${reason ?? "no reason"}`));
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
var handleGuardrailEvent = chunkKRBADE6R_cjs.absorbErrorsSync(
|
|
359
|
+
_handleGuardrailEvent,
|
|
360
|
+
{ fingerprint: "morse.openai-agents.guardrail.handle" }
|
|
361
|
+
);
|
|
362
|
+
function installGuardrailInstrumentation(runner) {
|
|
363
|
+
if (runner === null || typeof runner !== "object" || typeof runner.on !== "function") {
|
|
364
|
+
return () => {
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
const listener = (payload) => {
|
|
368
|
+
handleGuardrailEvent(payload);
|
|
369
|
+
};
|
|
370
|
+
try {
|
|
371
|
+
runner.on("guardrail_check", listener);
|
|
372
|
+
} catch {
|
|
373
|
+
return () => {
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
return () => {
|
|
377
|
+
try {
|
|
378
|
+
if (typeof runner.off === "function") {
|
|
379
|
+
runner.off("guardrail_check", listener);
|
|
380
|
+
}
|
|
381
|
+
} catch {
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// src/openai-agents/trace-processor.ts
|
|
387
|
+
var ADAPTER2 = "openai-agents";
|
|
388
|
+
function safe(fn) {
|
|
389
|
+
try {
|
|
390
|
+
return fn();
|
|
391
|
+
} catch {
|
|
392
|
+
return void 0;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
var MorseTraceProcessor = class {
|
|
396
|
+
options;
|
|
397
|
+
openSpans = /* @__PURE__ */ new Map();
|
|
398
|
+
/**
|
|
399
|
+
* MHQ-787: `'response'`-type spans (the SDK's default Responses-API path)
|
|
400
|
+
* carry a `response_id` but no `model`/`usage` of their own — that data
|
|
401
|
+
* only becomes available on `Runner.run()`'s resolved result
|
|
402
|
+
* (`result.rawResponses`), which arrives AFTER `onSpanEnd` already fired.
|
|
403
|
+
* Keep already-closed response spans around, keyed by `response_id`, so
|
|
404
|
+
* `enrichFromRunResult()` can patch them in place once the real usage
|
|
405
|
+
* data is available. Spans stay mutable (their span-tree object isn't
|
|
406
|
+
* exported until the outer trace closes), so a late patch still lands.
|
|
407
|
+
*/
|
|
408
|
+
closedResponseSpans = /* @__PURE__ */ new Map();
|
|
409
|
+
constructor(options = {}) {
|
|
410
|
+
this.options = options;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* MHQ-787: called by `wrapRunnerWithFullInstrumentation` after each
|
|
414
|
+
* `Runner.run()` resolves. Matches `rawResponses[].responseId` back to
|
|
415
|
+
* the `'response'`-type span it belongs to and fills in the model/usage/
|
|
416
|
+
* cost fields `onSpanEnd` couldn't populate at the time. `fallbackModel`
|
|
417
|
+
* is the model configured on the `Agent` (known at call time in
|
|
418
|
+
* `runner-wrapper.ts`) — used only when the span still has no model.
|
|
419
|
+
* Never throws; a translation failure must not surface to the caller.
|
|
420
|
+
*/
|
|
421
|
+
enrichFromRunResult(rawResponses, fallbackModel) {
|
|
422
|
+
safe(() => {
|
|
423
|
+
for (const raw of rawResponses) {
|
|
424
|
+
if (typeof raw.responseId !== "string") continue;
|
|
425
|
+
const handle = this.closedResponseSpans.get(raw.responseId);
|
|
426
|
+
if (!handle) continue;
|
|
427
|
+
this.closedResponseSpans.delete(raw.responseId);
|
|
428
|
+
if ((!handle.span.model || handle.span.model === "unknown") && fallbackModel) {
|
|
429
|
+
handle.span.model = fallbackModel;
|
|
430
|
+
}
|
|
431
|
+
const u = raw.usage;
|
|
432
|
+
if (u) {
|
|
433
|
+
if (typeof u.inputTokens === "number") handle.span.input_tokens = u.inputTokens;
|
|
434
|
+
if (typeof u.outputTokens === "number") handle.span.output_tokens = u.outputTokens;
|
|
435
|
+
if (typeof u.totalTokens === "number") {
|
|
436
|
+
handle.span.total_tokens = u.totalTokens;
|
|
437
|
+
} else if (handle.span.input_tokens !== void 0 && handle.span.output_tokens !== void 0) {
|
|
438
|
+
handle.span.total_tokens = handle.span.input_tokens + handle.span.output_tokens;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (handle.span.cost_usd === void 0 && handle.span.model && handle.span.model !== "unknown" && (handle.span.input_tokens !== void 0 || handle.span.output_tokens !== void 0)) {
|
|
442
|
+
const cost = chunkSWQOPFE4_cjs.calculateCost({
|
|
443
|
+
inputTokens: handle.span.input_tokens ?? 0,
|
|
444
|
+
outputTokens: handle.span.output_tokens ?? 0,
|
|
445
|
+
model: handle.span.model
|
|
446
|
+
});
|
|
447
|
+
if (cost !== void 0) handle.span.cost_usd = cost;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
/* -- TraceProcessor surface ---------------------------------------- */
|
|
453
|
+
onTraceStart(_trace) {
|
|
454
|
+
}
|
|
455
|
+
onTraceEnd(_trace) {
|
|
456
|
+
}
|
|
457
|
+
onSpanStart(span) {
|
|
458
|
+
safe(() => {
|
|
459
|
+
const handle = this.openSpanFor(span);
|
|
460
|
+
if (handle && span.spanId) {
|
|
461
|
+
this.openSpans.set(span.spanId, handle);
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
onSpanEnd(span) {
|
|
466
|
+
safe(() => {
|
|
467
|
+
if (!span.spanId) return;
|
|
468
|
+
const handle = this.openSpans.get(span.spanId);
|
|
469
|
+
if (!handle) return;
|
|
470
|
+
this.openSpans.delete(span.spanId);
|
|
471
|
+
this.populateSpanFromData(handle, span);
|
|
472
|
+
const d = span.spanData;
|
|
473
|
+
if (d?.type === "response" && typeof d.response_id === "string" && d.response_id.length > 0) {
|
|
474
|
+
this.closedResponseSpans.set(d.response_id, handle);
|
|
475
|
+
}
|
|
476
|
+
if (d?.type === "guardrail" && d.passed === false) {
|
|
477
|
+
safeEnd(handle, new Error(`guardrail failed: ${d.reason ?? "no reason"}`));
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (span.error) {
|
|
481
|
+
safeEnd(handle, new Error(String(span.error)));
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
safeEnd(handle);
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
async shutdown() {
|
|
488
|
+
for (const [, handle] of this.openSpans) {
|
|
489
|
+
safeEnd(handle, new Error("morse: processor shutdown before span ended"));
|
|
490
|
+
}
|
|
491
|
+
this.openSpans.clear();
|
|
492
|
+
this.closedResponseSpans.clear();
|
|
493
|
+
}
|
|
494
|
+
async forceFlush() {
|
|
495
|
+
}
|
|
496
|
+
/* -- Internals ------------------------------------------------------ */
|
|
497
|
+
openSpanFor(span) {
|
|
498
|
+
const d = span.spanData ?? {};
|
|
499
|
+
const type = typeof d.type === "string" ? d.type : "";
|
|
500
|
+
const name = typeof d.name === "string" && d.name.length > 0 ? d.name : void 0;
|
|
501
|
+
switch (type) {
|
|
502
|
+
case "agent":
|
|
503
|
+
return chunkB7DEUDP6_cjs.emitAgentSpan({
|
|
504
|
+
adapter: ADAPTER2,
|
|
505
|
+
agentName: name ?? "openai-agent"
|
|
506
|
+
});
|
|
507
|
+
case "generation":
|
|
508
|
+
case "response": {
|
|
509
|
+
const model = typeof d.model === "string" && d.model.length > 0 ? d.model : "unknown";
|
|
510
|
+
return chunkB7DEUDP6_cjs.emitLlmSpan({ adapter: ADAPTER2, model });
|
|
511
|
+
}
|
|
512
|
+
case "function": {
|
|
513
|
+
const inputOpts = this.options.toolInputMaxBytes ? { maxBytes: this.options.toolInputMaxBytes } : void 0;
|
|
514
|
+
return chunkB7DEUDP6_cjs.emitToolSpan({
|
|
515
|
+
adapter: ADAPTER2,
|
|
516
|
+
toolName: name ?? "function",
|
|
517
|
+
inputSummary: d.input !== void 0 ? chunkMCJYZH6W_cjs.summarizeToolInput(d.input, inputOpts) : void 0
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
case "handoff":
|
|
521
|
+
return chunkB7DEUDP6_cjs.emitSubagentSpan({
|
|
522
|
+
adapter: ADAPTER2,
|
|
523
|
+
parentAgentName: typeof d.from_agent === "string" ? d.from_agent : "unknown",
|
|
524
|
+
subagentName: typeof d.to_agent === "string" ? d.to_agent : name ?? "unknown",
|
|
525
|
+
taskDescription: typeof d.reason === "string" ? d.reason : void 0
|
|
526
|
+
});
|
|
527
|
+
case "guardrail": {
|
|
528
|
+
const handle = chunkB7DEUDP6_cjs.emitToolSpan({
|
|
529
|
+
adapter: ADAPTER2,
|
|
530
|
+
toolName: `guardrail.${name ?? "anon"}`
|
|
531
|
+
});
|
|
532
|
+
if (handle) {
|
|
533
|
+
handle.span.metadata = {
|
|
534
|
+
...handle.span.metadata ?? {},
|
|
535
|
+
tool_kind: "guardrail",
|
|
536
|
+
guardrail: {
|
|
537
|
+
name: name ?? "anon",
|
|
538
|
+
passed: d.passed,
|
|
539
|
+
...typeof d.reason === "string" ? { reason: d.reason } : {}
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
return handle;
|
|
544
|
+
}
|
|
545
|
+
case "mcp_list_tools":
|
|
546
|
+
return chunkB7DEUDP6_cjs.emitToolSpan({
|
|
547
|
+
adapter: ADAPTER2,
|
|
548
|
+
toolName: `mcp.list_tools.${name ?? "anon"}`
|
|
549
|
+
});
|
|
550
|
+
case "custom":
|
|
551
|
+
return chunkB7DEUDP6_cjs.emitToolSpan({
|
|
552
|
+
adapter: ADAPTER2,
|
|
553
|
+
toolName: `custom.${name ?? "anon"}`
|
|
554
|
+
});
|
|
555
|
+
default:
|
|
556
|
+
return chunkB7DEUDP6_cjs.emitToolSpan({
|
|
557
|
+
adapter: ADAPTER2,
|
|
558
|
+
toolName: `${type || "unknown"}.${name ?? "anon"}`
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
populateSpanFromData(handle, span) {
|
|
563
|
+
const d = span.spanData;
|
|
564
|
+
if (!d) return;
|
|
565
|
+
if (typeof d.model === "string" && d.model.length > 0) {
|
|
566
|
+
handle.span.model = d.model;
|
|
567
|
+
}
|
|
568
|
+
const u = d.usage;
|
|
569
|
+
if (u) {
|
|
570
|
+
const input = u.input_tokens ?? u.prompt_tokens;
|
|
571
|
+
const output = u.output_tokens ?? u.completion_tokens;
|
|
572
|
+
const total = u.total_tokens;
|
|
573
|
+
if (typeof input === "number") handle.span.input_tokens = input;
|
|
574
|
+
if (typeof output === "number") handle.span.output_tokens = output;
|
|
575
|
+
if (typeof total === "number") {
|
|
576
|
+
handle.span.total_tokens = total;
|
|
577
|
+
} else if (typeof input === "number" && typeof output === "number") {
|
|
578
|
+
handle.span.total_tokens = input + output;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (d.output !== void 0) {
|
|
582
|
+
const outputOpts = this.options.toolOutputMaxBytes ? { maxBytes: this.options.toolOutputMaxBytes } : void 0;
|
|
583
|
+
handle.span.metadata = {
|
|
584
|
+
...handle.span.metadata ?? {},
|
|
585
|
+
tool_output_summary: chunkMCJYZH6W_cjs.summarizeToolOutput(d.output, outputOpts)
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
async function installMorseTraceProcessor(options) {
|
|
591
|
+
const processor = new MorseTraceProcessor(options);
|
|
592
|
+
let mod = null;
|
|
593
|
+
try {
|
|
594
|
+
const dynamicImport = Function("m", "return import(m)");
|
|
595
|
+
mod = await dynamicImport("@openai/agents");
|
|
596
|
+
} catch {
|
|
597
|
+
return { installed: false, processor: null };
|
|
598
|
+
}
|
|
599
|
+
try {
|
|
600
|
+
if (typeof mod?.addTraceProcessor === "function") {
|
|
601
|
+
mod.addTraceProcessor(processor);
|
|
602
|
+
return { installed: true, processor };
|
|
603
|
+
}
|
|
604
|
+
} catch {
|
|
605
|
+
}
|
|
606
|
+
return { installed: false, processor: null };
|
|
607
|
+
}
|
|
608
|
+
function safeEnd(handle, err) {
|
|
609
|
+
try {
|
|
610
|
+
if (err !== void 0) {
|
|
611
|
+
handle.end(err);
|
|
612
|
+
} else {
|
|
613
|
+
handle.end();
|
|
614
|
+
}
|
|
615
|
+
} catch {
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// src/openai-agents/index.ts
|
|
620
|
+
function wrapRunnerWithFullInstrumentation(runner, options = {}) {
|
|
621
|
+
let installedProcessor = null;
|
|
622
|
+
const wrapped = wrapRunner(runner, {
|
|
623
|
+
defaultAgentName: options.defaultAgentName,
|
|
624
|
+
// MHQ-787: the SDK's own tracing spans for the Responses-API path
|
|
625
|
+
// carry no model/usage — only the resolved RunResult does. Patch
|
|
626
|
+
// already-closed LLM spans once we have it.
|
|
627
|
+
onRunResult: (result, model) => {
|
|
628
|
+
const rawResponses = result.rawResponses;
|
|
629
|
+
if (installedProcessor && Array.isArray(rawResponses)) {
|
|
630
|
+
installedProcessor.enrichFromRunResult(
|
|
631
|
+
rawResponses,
|
|
632
|
+
model
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
const llmAndToolOpts = {};
|
|
638
|
+
if (options.toolInputMaxBytes !== void 0) {
|
|
639
|
+
llmAndToolOpts.toolInputMaxBytes = options.toolInputMaxBytes;
|
|
640
|
+
}
|
|
641
|
+
if (options.toolOutputMaxBytes !== void 0) {
|
|
642
|
+
llmAndToolOpts.toolOutputMaxBytes = options.toolOutputMaxBytes;
|
|
643
|
+
}
|
|
644
|
+
const offLlmTool = installLlmAndToolInstrumentation(wrapped, llmAndToolOpts);
|
|
645
|
+
const offHandoff = installHandoffInstrumentation(wrapped);
|
|
646
|
+
const offGuardrail = installGuardrailInstrumentation(wrapped);
|
|
647
|
+
void installMorseTraceProcessor(llmAndToolOpts).then((result) => {
|
|
648
|
+
if (result.installed) {
|
|
649
|
+
installedProcessor = result.processor;
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
let disposed = false;
|
|
653
|
+
const dispose = () => {
|
|
654
|
+
if (disposed) return;
|
|
655
|
+
disposed = true;
|
|
656
|
+
try {
|
|
657
|
+
offLlmTool();
|
|
658
|
+
} catch {
|
|
659
|
+
}
|
|
660
|
+
try {
|
|
661
|
+
offHandoff();
|
|
662
|
+
} catch {
|
|
663
|
+
}
|
|
664
|
+
try {
|
|
665
|
+
offGuardrail();
|
|
666
|
+
} catch {
|
|
667
|
+
}
|
|
668
|
+
if (installedProcessor) {
|
|
669
|
+
try {
|
|
670
|
+
void installedProcessor.shutdown();
|
|
671
|
+
} catch {
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
return { runner: wrapped, dispose };
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
exports.MorseTraceProcessor = MorseTraceProcessor;
|
|
679
|
+
exports.installGuardrailInstrumentation = installGuardrailInstrumentation;
|
|
680
|
+
exports.installHandoffInstrumentation = installHandoffInstrumentation;
|
|
681
|
+
exports.installLlmAndToolInstrumentation = installLlmAndToolInstrumentation;
|
|
682
|
+
exports.installMorseTraceProcessor = installMorseTraceProcessor;
|
|
683
|
+
exports.instrumentOpenAIAgents = instrumentOpenAIAgents;
|
|
684
|
+
exports.isOpenAIAgentsWrapped = isOpenAIAgentsWrapped;
|
|
685
|
+
exports.uninstallOpenAIAgents = uninstallOpenAIAgents;
|
|
686
|
+
exports.wrapRunner = wrapRunner;
|
|
687
|
+
exports.wrapRunnerWithFullInstrumentation = wrapRunnerWithFullInstrumentation;
|
|
688
|
+
//# sourceMappingURL=index.cjs.map
|
|
689
|
+
//# sourceMappingURL=index.cjs.map
|