@morsehq-dev/sdk 0.5.0-rc.2 → 0.5.0-rc.4
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/README.md +34 -0
- package/dist/anthropic/index.cjs +11 -11
- package/dist/anthropic/index.js +4 -4
- package/dist/anthropic-agent-sdk/index.cjs +37 -37
- package/dist/anthropic-agent-sdk/index.js +6 -6
- package/dist/browser/anthropic/index.cjs +11 -11
- package/dist/browser/anthropic/index.js +4 -4
- package/dist/browser/anthropic-agent-sdk/index.cjs +37 -37
- package/dist/browser/anthropic-agent-sdk/index.js +6 -6
- package/dist/browser/{chunk-63ZI6PGP.cjs → chunk-255AHH2W.cjs} +15 -15
- package/dist/browser/{chunk-63ZI6PGP.cjs.map → chunk-255AHH2W.cjs.map} +1 -1
- package/dist/browser/{chunk-T4NHSVXH.cjs → chunk-36QTJJT7.cjs} +12 -12
- package/dist/browser/{chunk-T4NHSVXH.cjs.map → chunk-36QTJJT7.cjs.map} +1 -1
- package/dist/browser/{chunk-A5EYWAOT.cjs → chunk-3H2OJLC2.cjs} +13 -6
- package/dist/browser/chunk-3H2OJLC2.cjs.map +1 -0
- package/dist/browser/{chunk-YMEU6XQQ.cjs → chunk-3STFITZF.cjs} +6 -6
- package/dist/browser/{chunk-YMEU6XQQ.cjs.map → chunk-3STFITZF.cjs.map} +1 -1
- package/dist/{chunk-Y2QHMV6H.cjs → browser/chunk-6J6F5LJI.cjs} +7 -7
- package/dist/browser/{chunk-N3PXJCOE.cjs.map → chunk-6J6F5LJI.cjs.map} +1 -1
- package/dist/{chunk-ZWOSPXS4.js → browser/chunk-E2OVLWAF.js} +3 -3
- package/dist/browser/{chunk-AM6LMQCT.js.map → chunk-E2OVLWAF.js.map} +1 -1
- package/dist/browser/{chunk-L6FWDEGJ.js → chunk-JR6JN7IZ.js} +4 -4
- package/dist/browser/{chunk-L6FWDEGJ.js.map → chunk-JR6JN7IZ.js.map} +1 -1
- package/dist/browser/{chunk-NH54DAJP.js → chunk-KXVSMY6L.js} +3 -3
- package/dist/browser/{chunk-NH54DAJP.js.map → chunk-KXVSMY6L.js.map} +1 -1
- package/dist/browser/{chunk-3MTJGZGX.js → chunk-PIWO5L5N.js} +5 -5
- package/dist/browser/{chunk-3MTJGZGX.js.map → chunk-PIWO5L5N.js.map} +1 -1
- package/dist/browser/{chunk-SOJYLXCR.cjs → chunk-VOZBYSWK.cjs} +5 -5
- package/dist/browser/{chunk-SOJYLXCR.cjs.map → chunk-VOZBYSWK.cjs.map} +1 -1
- package/dist/browser/{chunk-FDE32B3R.js → chunk-VZA2EPY3.js} +4 -4
- package/dist/browser/{chunk-FDE32B3R.js.map → chunk-VZA2EPY3.js.map} +1 -1
- package/dist/browser/{chunk-NRYB5GJT.js → chunk-WIWUEI5Z.js} +3 -3
- package/dist/browser/{chunk-NRYB5GJT.js.map → chunk-WIWUEI5Z.js.map} +1 -1
- package/dist/browser/{chunk-OOGAYEJF.js → chunk-XD4VWCAC.js} +12 -7
- package/dist/browser/chunk-XD4VWCAC.js.map +1 -0
- package/dist/browser/{chunk-YR2FCEWM.cjs → chunk-YD7TO4PD.cjs} +18 -18
- package/dist/browser/{chunk-YR2FCEWM.cjs.map → chunk-YD7TO4PD.cjs.map} +1 -1
- package/dist/browser/index.cjs +91 -89
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +10 -8
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/integrations/pino.cjs +4 -4
- package/dist/browser/integrations/pino.js +3 -3
- package/dist/browser/langchain/index.cjs +17 -17
- package/dist/browser/langchain/index.js +2 -2
- package/dist/browser/langgraph/index.cjs +27 -27
- package/dist/browser/langgraph/index.js +5 -5
- package/dist/browser/openai/index.cjs +11 -11
- package/dist/browser/openai/index.js +2 -2
- package/dist/browser/openai-agents/index.cjs +38 -36
- package/dist/browser/openai-agents/index.cjs.map +1 -1
- package/dist/browser/openai-agents/index.js +8 -6
- package/dist/browser/openai-agents/index.js.map +1 -1
- package/dist/browser/vercel-ai/index.cjs +14 -14
- package/dist/browser/vercel-ai/index.js +3 -3
- package/dist/{chunk-YJYF4NSA.js → chunk-2O2FFJLK.js} +5 -5
- package/dist/{chunk-YJYF4NSA.js.map → chunk-2O2FFJLK.js.map} +1 -1
- package/dist/{browser/chunk-N3PXJCOE.cjs → chunk-7ZNGY236.cjs} +7 -7
- package/dist/{chunk-Y2QHMV6H.cjs.map → chunk-7ZNGY236.cjs.map} +1 -1
- package/dist/{chunk-FCAPLB7A.js → chunk-BNMTY7PE.js} +4 -4
- package/dist/{chunk-FCAPLB7A.js.map → chunk-BNMTY7PE.js.map} +1 -1
- package/dist/{chunk-3IGQWLWE.js → chunk-ELBY4SJ7.js} +12 -7
- package/dist/chunk-ELBY4SJ7.js.map +1 -0
- package/dist/{chunk-XCOZIFHC.cjs → chunk-HA5RY4N5.cjs} +13 -6
- package/dist/chunk-HA5RY4N5.cjs.map +1 -0
- package/dist/{chunk-VHF4GWJ4.cjs → chunk-HZKXILBF.cjs} +5 -5
- package/dist/{chunk-VHF4GWJ4.cjs.map → chunk-HZKXILBF.cjs.map} +1 -1
- package/dist/{browser/chunk-AM6LMQCT.js → chunk-JFFZBCTP.js} +3 -3
- package/dist/{chunk-ZWOSPXS4.js.map → chunk-JFFZBCTP.js.map} +1 -1
- package/dist/{chunk-SHK2XEPB.js → chunk-MBOISGKD.js} +4 -4
- package/dist/{chunk-SHK2XEPB.js.map → chunk-MBOISGKD.js.map} +1 -1
- package/dist/{chunk-S4WUABAU.js → chunk-Q6NQQ2LO.js} +3 -3
- package/dist/{chunk-S4WUABAU.js.map → chunk-Q6NQQ2LO.js.map} +1 -1
- package/dist/{chunk-6DZNK4VX.cjs → chunk-RDFDPK2X.cjs} +6 -6
- package/dist/{chunk-6DZNK4VX.cjs.map → chunk-RDFDPK2X.cjs.map} +1 -1
- package/dist/{chunk-ZIER4DGK.cjs → chunk-ULWGK6F5.cjs} +12 -12
- package/dist/{chunk-ZIER4DGK.cjs.map → chunk-ULWGK6F5.cjs.map} +1 -1
- package/dist/{chunk-SNGYSP7Z.cjs → chunk-VM3QM22Z.cjs} +18 -18
- package/dist/{chunk-SNGYSP7Z.cjs.map → chunk-VM3QM22Z.cjs.map} +1 -1
- package/dist/{chunk-Z2IYSTRT.cjs → chunk-WLNADB4J.cjs} +15 -15
- package/dist/{chunk-Z2IYSTRT.cjs.map → chunk-WLNADB4J.cjs.map} +1 -1
- package/dist/{chunk-XJUH6PR5.js → chunk-YPP5DDPO.js} +3 -3
- package/dist/{chunk-XJUH6PR5.js.map → chunk-YPP5DDPO.js.map} +1 -1
- package/dist/index.cjs +98 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/integrations/pino.cjs +4 -4
- package/dist/integrations/pino.js +3 -3
- package/dist/langchain/index.cjs +17 -17
- package/dist/langchain/index.js +2 -2
- package/dist/langgraph/index.cjs +27 -27
- package/dist/langgraph/index.js +5 -5
- package/dist/openai/index.cjs +11 -11
- package/dist/openai/index.js +2 -2
- package/dist/openai-agents/index.cjs +38 -36
- package/dist/openai-agents/index.cjs.map +1 -1
- package/dist/openai-agents/index.d.cts +4 -0
- package/dist/openai-agents/index.d.ts +4 -0
- package/dist/openai-agents/index.js +8 -6
- package/dist/openai-agents/index.js.map +1 -1
- package/dist/vercel-ai/index.cjs +14 -14
- package/dist/vercel-ai/index.js +3 -3
- package/package.json +14 -13
- package/dist/browser/chunk-A5EYWAOT.cjs.map +0 -1
- package/dist/browser/chunk-OOGAYEJF.js.map +0 -1
- package/dist/chunk-3IGQWLWE.js.map +0 -1
- package/dist/chunk-XCOZIFHC.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -83,6 +83,40 @@ installed without being wrapped.
|
|
|
83
83
|
Each adapter is a separate subpath export so you only pull in what you
|
|
84
84
|
use.
|
|
85
85
|
|
|
86
|
+
### Supported versions
|
|
87
|
+
|
|
88
|
+
We verify two versions of each agent SDK — the declared floor and the
|
|
89
|
+
current latest. Versions between them are expected to work but are not
|
|
90
|
+
verified; below the floor is unsupported. Policy:
|
|
91
|
+
`engineering/SDK_VERSION_SUPPORT.md`.
|
|
92
|
+
|
|
93
|
+
Both ends are real checks, not lockfile trivia. `pnpm contract`
|
|
94
|
+
(`tests/contract/`) loads the actual installed package on every PR and
|
|
95
|
+
asserts the structural thing each adapter depends on — the export we patch,
|
|
96
|
+
the class we subclass, the function we replace. The nightly `latest-contract`
|
|
97
|
+
lanes in `.github/workflows/canary.yml` run the same assertions against
|
|
98
|
+
whatever upstream published most recently, so a breaking release surfaces the
|
|
99
|
+
night it ships rather than in a customer's process.
|
|
100
|
+
|
|
101
|
+
| Peer | Declared | Floor (verified per PR) | Latest (verified nightly) |
|
|
102
|
+
| -------------------------------- | ---------- | ----------------------- | ------------------------- |
|
|
103
|
+
| `ai` (Vercel AI SDK) | `>=7.0.0` | 7.0.55 | 7.0.55 |
|
|
104
|
+
| `openai` | `>=6.0.0` | 6.49.0 | — |
|
|
105
|
+
| `@anthropic-ai/sdk` | `>=0.90.0` | 0.96.0 | — |
|
|
106
|
+
| `@anthropic-ai/claude-agent-sdk` | `>=0.3.0` | 0.3.223 | 0.3.223 |
|
|
107
|
+
| `@openai/agents` | `>=0.2.0` | 0.2.1 | blocked — see below |
|
|
108
|
+
| `@langchain/core` | `>=1.0.0` | 1.2.5 | 1.2.5 |
|
|
109
|
+
| `@langchain/langgraph` | `>=1.0.0` | 1.4.9 | 1.4.9 |
|
|
110
|
+
|
|
111
|
+
Floor and latest coincide today because the pins were just raised to the
|
|
112
|
+
newest verified versions; they diverge again as soon as upstream ships.
|
|
113
|
+
|
|
114
|
+
`@openai/agents` is held at the `0.2.x` line deliberately: 0.5.0 and later
|
|
115
|
+
require peer `zod ^4`, and this monorepo is on zod 3 (MHQ-935).
|
|
116
|
+
|
|
117
|
+
`openai` and `@anthropic-ai/sdk` have no nightly `latest` lane yet — their
|
|
118
|
+
floors are verified per PR, but nothing watches upstream for them (MHQ-930).
|
|
119
|
+
|
|
86
120
|
### `@morsehq-dev/sdk/anthropic` — Anthropic Messages API
|
|
87
121
|
|
|
88
122
|
```ts
|
package/dist/anthropic/index.cjs
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkVM3QM22Z_cjs = require('../chunk-VM3QM22Z.cjs');
|
|
4
|
+
require('../chunk-HZKXILBF.cjs');
|
|
5
|
+
require('../chunk-RDFDPK2X.cjs');
|
|
6
6
|
require('../chunk-KBWPNIH4.cjs');
|
|
7
7
|
require('../chunk-HICEJ4LV.cjs');
|
|
8
|
-
require('../chunk-
|
|
8
|
+
require('../chunk-HA5RY4N5.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkVM3QM22Z_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "_resetAnthropicInstallStateForTesting", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkVM3QM22Z_cjs._resetAnthropicInstallStateForTesting; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkVM3QM22Z_cjs.extractAnthropicSegments; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkVM3QM22Z_cjs.instrumentAnthropic; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkVM3QM22Z_cjs.isAnthropicWrapped; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkVM3QM22Z_cjs.uninstallAnthropic; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkVM3QM22Z_cjs.wrapAnthropic; }
|
|
39
39
|
});
|
|
40
40
|
//# sourceMappingURL=index.cjs.map
|
|
41
41
|
//# sourceMappingURL=index.cjs.map
|
package/dist/anthropic/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { MAX_SEGMENT_CONTENT_BYTES, _resetAnthropicInstallStateForTesting, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { MAX_SEGMENT_CONTENT_BYTES, _resetAnthropicInstallStateForTesting, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from '../chunk-2O2FFJLK.js';
|
|
2
|
+
import '../chunk-YPP5DDPO.js';
|
|
3
|
+
import '../chunk-Q6NQQ2LO.js';
|
|
4
4
|
import '../chunk-XTKMUJWI.js';
|
|
5
5
|
import '../chunk-4JPZV2VZ.js';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-ELBY4SJ7.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var chunkVM3QM22Z_cjs = require('../chunk-VM3QM22Z.cjs');
|
|
4
|
+
require('../chunk-HZKXILBF.cjs');
|
|
5
|
+
var chunk7ZNGY236_cjs = require('../chunk-7ZNGY236.cjs');
|
|
6
|
+
var chunkWLNADB4J_cjs = require('../chunk-WLNADB4J.cjs');
|
|
7
|
+
var chunkRDFDPK2X_cjs = require('../chunk-RDFDPK2X.cjs');
|
|
8
8
|
var chunkKBWPNIH4_cjs = require('../chunk-KBWPNIH4.cjs');
|
|
9
9
|
require('../chunk-HICEJ4LV.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkHA5RY4N5_cjs = require('../chunk-HA5RY4N5.cjs');
|
|
11
11
|
|
|
12
12
|
// src/anthropic-agent-sdk/client-wrapper.ts
|
|
13
|
-
|
|
13
|
+
chunkHA5RY4N5_cjs.init_tracing();
|
|
14
14
|
var WRAPPED_CLIENT = /* @__PURE__ */ Symbol.for("morse.anthropic-agent-sdk.wrapped");
|
|
15
15
|
var INSTALL_SENTINEL = /* @__PURE__ */ Symbol.for("morse.anthropic-agent-sdk.installed");
|
|
16
16
|
var ORIGINALS_SENTINEL = /* @__PURE__ */ Symbol.for("morse.anthropic-agent-sdk.originals");
|
|
@@ -36,7 +36,7 @@ function wrapClaudeAgentSDK(client, options = {}) {
|
|
|
36
36
|
});
|
|
37
37
|
return wrapper;
|
|
38
38
|
}
|
|
39
|
-
var instrumentClaudeAgentSDK =
|
|
39
|
+
var instrumentClaudeAgentSDK = chunkRDFDPK2X_cjs.absorbErrorsAsync(
|
|
40
40
|
async (clientOrOptions = void 0, maybeOptions = {}) => {
|
|
41
41
|
if (clientOrOptions && isClient(clientOrOptions)) {
|
|
42
42
|
const opts2 = maybeOptions ?? {};
|
|
@@ -64,7 +64,7 @@ var instrumentClaudeAgentSDK = chunk6DZNK4VX_cjs.absorbErrorsAsync(
|
|
|
64
64
|
},
|
|
65
65
|
{ fingerprint: "morse.adapters.anthropic-agent-sdk.install" }
|
|
66
66
|
);
|
|
67
|
-
var uninstallClaudeAgentSDK =
|
|
67
|
+
var uninstallClaudeAgentSDK = chunkRDFDPK2X_cjs.absorbErrorsSync(
|
|
68
68
|
(claudeAgentSdkModule) => {
|
|
69
69
|
if (!claudeAgentSdkModule || typeof claudeAgentSdkModule !== "object") return;
|
|
70
70
|
const mod = claudeAgentSdkModule;
|
|
@@ -116,7 +116,7 @@ function buildPatchedQuery(original, options) {
|
|
|
116
116
|
const boundOriginal = (p, o) => original.call(this, p, o);
|
|
117
117
|
const model = (callOptions && typeof callOptions.model === "string" ? callOptions.model : void 0) ?? defaultModel;
|
|
118
118
|
async function* iterateInTrace() {
|
|
119
|
-
const handle =
|
|
119
|
+
const handle = chunkWLNADB4J_cjs.emitAgentSpan({
|
|
120
120
|
adapter: "anthropic-agent-sdk",
|
|
121
121
|
agentName: defaultAgentName,
|
|
122
122
|
model
|
|
@@ -139,7 +139,7 @@ function buildPatchedQuery(original, options) {
|
|
|
139
139
|
}
|
|
140
140
|
handle?.end();
|
|
141
141
|
}
|
|
142
|
-
if (
|
|
142
|
+
if (chunkHA5RY4N5_cjs.getActiveTraceState() !== null) {
|
|
143
143
|
return iterateInTrace();
|
|
144
144
|
}
|
|
145
145
|
return (async function* outerTrace() {
|
|
@@ -155,7 +155,7 @@ function buildPatchedQuery(original, options) {
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
-
const runPromise =
|
|
158
|
+
const runPromise = chunkHA5RY4N5_cjs.runAsync({ agentName: defaultAgentName }, async (runHandle) => {
|
|
159
159
|
try {
|
|
160
160
|
for await (const event of iterateInTrace()) {
|
|
161
161
|
queue.push({ kind: "value", value: event });
|
|
@@ -191,10 +191,10 @@ function buildPatchedQuery(original, options) {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
// src/_agent-sdk-common/context-propagation.ts
|
|
194
|
-
|
|
195
|
-
var captureParentForFanOut =
|
|
194
|
+
chunkHA5RY4N5_cjs.init_tracing();
|
|
195
|
+
var captureParentForFanOut = chunkRDFDPK2X_cjs.absorbErrorsSync(
|
|
196
196
|
() => {
|
|
197
|
-
const state =
|
|
197
|
+
const state = chunkHA5RY4N5_cjs.getActiveTraceState();
|
|
198
198
|
if (state === null) return null;
|
|
199
199
|
const top = state.spanStack[state.spanStack.length - 1];
|
|
200
200
|
if (!top) return null;
|
|
@@ -205,13 +205,13 @@ var captureParentForFanOut = chunk6DZNK4VX_cjs.absorbErrorsSync(
|
|
|
205
205
|
},
|
|
206
206
|
{ fingerprint: "agent-sdk-common.captureParentForFanOut" }
|
|
207
207
|
);
|
|
208
|
-
var emitWithPinnedParent =
|
|
208
|
+
var emitWithPinnedParent = chunkRDFDPK2X_cjs.absorbErrorsSync(
|
|
209
209
|
(opts) => {
|
|
210
|
-
const state =
|
|
210
|
+
const state = chunkHA5RY4N5_cjs.getActiveTraceState();
|
|
211
211
|
if (state === null) return null;
|
|
212
212
|
const snap = opts.snapshot;
|
|
213
213
|
if (!snap || snap.traceId !== state.traceId) return null;
|
|
214
|
-
const handle =
|
|
214
|
+
const handle = chunkHA5RY4N5_cjs.startSpan({
|
|
215
215
|
name: opts.name,
|
|
216
216
|
type: opts.type,
|
|
217
217
|
metadata: opts.metadata
|
|
@@ -233,13 +233,13 @@ function findSpanById(state, spanId) {
|
|
|
233
233
|
}
|
|
234
234
|
return void 0;
|
|
235
235
|
}
|
|
236
|
-
var emitAsToolSibling =
|
|
236
|
+
var emitAsToolSibling = chunkRDFDPK2X_cjs.absorbErrorsSync(
|
|
237
237
|
(opts) => {
|
|
238
|
-
const state =
|
|
238
|
+
const state = chunkHA5RY4N5_cjs.getActiveTraceState();
|
|
239
239
|
if (state === null) return null;
|
|
240
240
|
const tool = findSpanById(state, opts.toolSpanId);
|
|
241
241
|
if (!tool) return null;
|
|
242
|
-
const handle =
|
|
242
|
+
const handle = chunkHA5RY4N5_cjs.startSpan({
|
|
243
243
|
name: opts.name,
|
|
244
244
|
type: opts.type,
|
|
245
245
|
metadata: opts.metadata
|
|
@@ -250,9 +250,9 @@ var emitAsToolSibling = chunk6DZNK4VX_cjs.absorbErrorsSync(
|
|
|
250
250
|
},
|
|
251
251
|
{ fingerprint: "agent-sdk-common.emitAsToolSibling" }
|
|
252
252
|
);
|
|
253
|
-
|
|
253
|
+
chunkRDFDPK2X_cjs.absorbErrorsSync(
|
|
254
254
|
() => {
|
|
255
|
-
const state =
|
|
255
|
+
const state = chunkHA5RY4N5_cjs.getActiveTraceState();
|
|
256
256
|
if (state === null) return null;
|
|
257
257
|
return {
|
|
258
258
|
traceId: state.traceId,
|
|
@@ -297,7 +297,7 @@ var _handleHookEvent = (payload, options) => {
|
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
const fallback =
|
|
300
|
+
const fallback = chunkWLNADB4J_cjs.emitHookSpan({
|
|
301
301
|
adapter: "anthropic-agent-sdk",
|
|
302
302
|
hookName: name,
|
|
303
303
|
hookKind: kind,
|
|
@@ -307,7 +307,7 @@ var _handleHookEvent = (payload, options) => {
|
|
|
307
307
|
fallback.end();
|
|
308
308
|
}
|
|
309
309
|
};
|
|
310
|
-
var handleHookEvent =
|
|
310
|
+
var handleHookEvent = chunkRDFDPK2X_cjs.absorbErrorsSync(_handleHookEvent, {
|
|
311
311
|
fingerprint: "morse.anthropic-agent-sdk.hook-instrumentation.handle"
|
|
312
312
|
});
|
|
313
313
|
function installHookInstrumentation(client, options) {
|
|
@@ -335,7 +335,7 @@ function installHookInstrumentation(client, options) {
|
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
// src/anthropic-agent-sdk/llm-instrumentation.ts
|
|
338
|
-
|
|
338
|
+
chunkHA5RY4N5_cjs.init_diagnostics();
|
|
339
339
|
function readInputTokens(usage) {
|
|
340
340
|
if (usage === void 0 || usage === null || typeof usage !== "object") return void 0;
|
|
341
341
|
const base = typeof usage.input_tokens === "number" && Number.isFinite(usage.input_tokens) ? usage.input_tokens : 0;
|
|
@@ -402,7 +402,7 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
402
402
|
const reportedModel = typeof event.message?.model === "string" && event.message.model.length > 0 ? event.message.model : void 0;
|
|
403
403
|
const model = reportedModel ?? fallbackModel;
|
|
404
404
|
if (!model) return;
|
|
405
|
-
const handle =
|
|
405
|
+
const handle = chunkWLNADB4J_cjs.emitLlmSpan({ adapter: "anthropic-agent-sdk", model });
|
|
406
406
|
if (!handle) return;
|
|
407
407
|
const usage = event.message?.usage;
|
|
408
408
|
const inputTokens = readInputTokens(usage);
|
|
@@ -419,7 +419,7 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
419
419
|
applyCost(handle, model, inputTokens, outputTokens, cacheWriteTokens, cachedInputTokens);
|
|
420
420
|
if (requestParams !== void 0) {
|
|
421
421
|
try {
|
|
422
|
-
const segments =
|
|
422
|
+
const segments = chunkVM3QM22Z_cjs.extractAnthropicSegments(
|
|
423
423
|
requestParams,
|
|
424
424
|
event.message
|
|
425
425
|
);
|
|
@@ -442,7 +442,7 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
442
442
|
if (model === void 0 || model.length === 0) {
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
445
|
-
openSpan =
|
|
445
|
+
openSpan = chunkWLNADB4J_cjs.emitLlmSpan({
|
|
446
446
|
adapter: "anthropic-agent-sdk",
|
|
447
447
|
model
|
|
448
448
|
});
|
|
@@ -484,7 +484,7 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
484
484
|
}
|
|
485
485
|
if (requestParams !== void 0) {
|
|
486
486
|
try {
|
|
487
|
-
const segments =
|
|
487
|
+
const segments = chunkVM3QM22Z_cjs.extractAnthropicSegments(
|
|
488
488
|
requestParams,
|
|
489
489
|
event.message
|
|
490
490
|
);
|
|
@@ -512,13 +512,13 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
512
512
|
}
|
|
513
513
|
function reportSwallowed(err, fingerprint) {
|
|
514
514
|
try {
|
|
515
|
-
|
|
515
|
+
chunkHA5RY4N5_cjs.report(err, { fingerprint });
|
|
516
516
|
} catch {
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
// src/anthropic-agent-sdk/tool-and-subagent.ts
|
|
521
|
-
|
|
521
|
+
chunkHA5RY4N5_cjs.init_diagnostics();
|
|
522
522
|
var ADAPTER = "anthropic-agent-sdk";
|
|
523
523
|
var TASK_TOOL_NAME = "Task";
|
|
524
524
|
function safeCloseFailed(handle, message) {
|
|
@@ -564,7 +564,7 @@ async function* instrumentTools(events, options) {
|
|
|
564
564
|
tool_use_id: toolUseId
|
|
565
565
|
};
|
|
566
566
|
if (taskPrompt !== void 0) {
|
|
567
|
-
metadata.task_description =
|
|
567
|
+
metadata.task_description = chunk7ZNGY236_cjs.summarizeToolInput(taskPrompt, inputOpts);
|
|
568
568
|
}
|
|
569
569
|
let handle2 = null;
|
|
570
570
|
try {
|
|
@@ -586,10 +586,10 @@ async function* instrumentTools(events, options) {
|
|
|
586
586
|
}
|
|
587
587
|
let handle = null;
|
|
588
588
|
try {
|
|
589
|
-
handle =
|
|
589
|
+
handle = chunkWLNADB4J_cjs.emitToolSpan({
|
|
590
590
|
adapter: ADAPTER,
|
|
591
591
|
toolName: name,
|
|
592
|
-
inputSummary:
|
|
592
|
+
inputSummary: chunk7ZNGY236_cjs.summarizeToolInput(event.input, inputOpts),
|
|
593
593
|
attributes: { tool_use_id: toolUseId }
|
|
594
594
|
});
|
|
595
595
|
} catch {
|
|
@@ -606,7 +606,7 @@ async function* instrumentTools(events, options) {
|
|
|
606
606
|
open.delete(toolUseId);
|
|
607
607
|
const isError = event.is_error === true;
|
|
608
608
|
try {
|
|
609
|
-
const outputSummary =
|
|
609
|
+
const outputSummary = chunk7ZNGY236_cjs.summarizeToolOutput(event.content, outputOpts);
|
|
610
610
|
entry.handle.span.metadata = {
|
|
611
611
|
...entry.handle.span.metadata ?? {},
|
|
612
612
|
tool_output_summary: outputSummary
|
|
@@ -678,7 +678,7 @@ async function* instrumentTools(events, options) {
|
|
|
678
678
|
}
|
|
679
679
|
function reportSwallowed2(err, fingerprint) {
|
|
680
680
|
try {
|
|
681
|
-
|
|
681
|
+
chunkHA5RY4N5_cjs.report(err, { fingerprint });
|
|
682
682
|
} catch {
|
|
683
683
|
}
|
|
684
684
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { extractAnthropicSegments } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import { summarizeToolInput, summarizeToolOutput } from '../chunk-
|
|
4
|
-
import { emitAgentSpan, emitHookSpan, emitLlmSpan, emitToolSpan } from '../chunk-
|
|
5
|
-
import { absorbErrorsAsync, absorbErrorsSync } from '../chunk-
|
|
1
|
+
import { extractAnthropicSegments } from '../chunk-2O2FFJLK.js';
|
|
2
|
+
import '../chunk-YPP5DDPO.js';
|
|
3
|
+
import { summarizeToolInput, summarizeToolOutput } from '../chunk-JFFZBCTP.js';
|
|
4
|
+
import { emitAgentSpan, emitHookSpan, emitLlmSpan, emitToolSpan } from '../chunk-BNMTY7PE.js';
|
|
5
|
+
import { absorbErrorsAsync, absorbErrorsSync } from '../chunk-Q6NQQ2LO.js';
|
|
6
6
|
import { calculateCost } from '../chunk-XTKMUJWI.js';
|
|
7
7
|
import '../chunk-4JPZV2VZ.js';
|
|
8
|
-
import { init_tracing, getActiveTraceState, runAsync, startSpan, init_diagnostics, report } from '../chunk-
|
|
8
|
+
import { init_tracing, getActiveTraceState, runAsync, startSpan, init_diagnostics, report } from '../chunk-ELBY4SJ7.js';
|
|
9
9
|
|
|
10
10
|
// src/anthropic-agent-sdk/client-wrapper.ts
|
|
11
11
|
init_tracing();
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkYD7TO4PD_cjs = require('../chunk-YD7TO4PD.cjs');
|
|
4
|
+
require('../chunk-VOZBYSWK.cjs');
|
|
5
|
+
require('../chunk-3STFITZF.cjs');
|
|
6
6
|
require('../chunk-SWQOPFE4.cjs');
|
|
7
7
|
require('../chunk-RBNCTHK3.cjs');
|
|
8
|
-
require('../chunk-
|
|
8
|
+
require('../chunk-3H2OJLC2.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkYD7TO4PD_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "_resetAnthropicInstallStateForTesting", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkYD7TO4PD_cjs._resetAnthropicInstallStateForTesting; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkYD7TO4PD_cjs.extractAnthropicSegments; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkYD7TO4PD_cjs.instrumentAnthropic; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkYD7TO4PD_cjs.isAnthropicWrapped; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkYD7TO4PD_cjs.uninstallAnthropic; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkYD7TO4PD_cjs.wrapAnthropic; }
|
|
39
39
|
});
|
|
40
40
|
//# sourceMappingURL=index.cjs.map
|
|
41
41
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { MAX_SEGMENT_CONTENT_BYTES, _resetAnthropicInstallStateForTesting, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { MAX_SEGMENT_CONTENT_BYTES, _resetAnthropicInstallStateForTesting, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from '../chunk-PIWO5L5N.js';
|
|
2
|
+
import '../chunk-KXVSMY6L.js';
|
|
3
|
+
import '../chunk-WIWUEI5Z.js';
|
|
4
4
|
import '../chunk-4FALQMOZ.js';
|
|
5
5
|
import '../chunk-MLDVXMQD.js';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-XD4VWCAC.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|