@morsehq-dev/sdk 0.5.0-rc.6 → 0.5.1-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/README.md +11 -10
- package/dist/anthropic/index.cjs +11 -11
- package/dist/anthropic/index.js +4 -4
- package/dist/anthropic-agent-sdk/index.cjs +40 -40
- 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 +40 -40
- package/dist/browser/anthropic-agent-sdk/index.js +6 -6
- package/dist/browser/{chunk-PHE4P3DN.js → chunk-5IMBYZUB.js} +3 -3
- package/dist/browser/{chunk-PHE4P3DN.js.map → chunk-5IMBYZUB.js.map} +1 -1
- package/dist/browser/{chunk-MIHCAKQ2.js → chunk-7G266PKE.js} +32 -9
- package/dist/browser/chunk-7G266PKE.js.map +1 -0
- package/dist/browser/{chunk-FDWPKINR.js → chunk-AX6NEG6X.js} +4 -4
- package/dist/browser/{chunk-FDWPKINR.js.map → chunk-AX6NEG6X.js.map} +1 -1
- package/dist/browser/{chunk-ZAISDHUV.cjs → chunk-E6WORBIU.cjs} +5 -5
- package/dist/browser/{chunk-ZAISDHUV.cjs.map → chunk-E6WORBIU.cjs.map} +1 -1
- package/dist/{chunk-B3WEUUUK.cjs → browser/chunk-FYIQARMI.cjs} +7 -7
- package/dist/browser/{chunk-NK6D2G5O.cjs.map → chunk-FYIQARMI.cjs.map} +1 -1
- package/dist/browser/{chunk-WG45SF7N.cjs → chunk-HJTUPXNE.cjs} +31 -8
- package/dist/browser/chunk-HJTUPXNE.cjs.map +1 -0
- package/dist/browser/{chunk-TGN4FEKB.cjs → chunk-HNOHWDK3.cjs} +12 -12
- package/dist/browser/{chunk-TGN4FEKB.cjs.map → chunk-HNOHWDK3.cjs.map} +1 -1
- package/dist/{chunk-LEDIWC2M.js → browser/chunk-PIZVCAW7.js} +4 -4
- package/dist/browser/{chunk-TIZ5QRK2.js.map → chunk-PIZVCAW7.js.map} +1 -1
- package/dist/browser/{chunk-2LZCQD3J.js → chunk-RDNSY73W.js} +3 -3
- package/dist/browser/{chunk-2LZCQD3J.js.map → chunk-RDNSY73W.js.map} +1 -1
- package/dist/browser/{chunk-IXCAR4UA.js → chunk-TIMAH323.js} +3 -3
- package/dist/browser/{chunk-IXCAR4UA.js.map → chunk-TIMAH323.js.map} +1 -1
- package/dist/browser/{chunk-JNF26SQM.js → chunk-VSHCKROM.js} +5 -5
- package/dist/browser/{chunk-JNF26SQM.js.map → chunk-VSHCKROM.js.map} +1 -1
- package/dist/browser/{chunk-PNUCUOUA.cjs → chunk-YXCWAU36.cjs} +15 -15
- package/dist/browser/{chunk-PNUCUOUA.cjs.map → chunk-YXCWAU36.cjs.map} +1 -1
- package/dist/browser/{chunk-6YPVIGD2.cjs → chunk-Z26QGUMP.cjs} +6 -6
- package/dist/browser/{chunk-6YPVIGD2.cjs.map → chunk-Z26QGUMP.cjs.map} +1 -1
- package/dist/browser/{chunk-DQ4JWHYH.cjs → chunk-ZOOYJTDT.cjs} +18 -18
- package/dist/browser/{chunk-DQ4JWHYH.cjs.map → chunk-ZOOYJTDT.cjs.map} +1 -1
- package/dist/browser/index.cjs +189 -124
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +111 -46
- 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 +34 -34
- package/dist/browser/openai-agents/index.js +4 -4
- package/dist/browser/vercel-ai/index.cjs +14 -14
- package/dist/browser/vercel-ai/index.js +3 -3
- package/dist/{browser/chunk-NK6D2G5O.cjs → chunk-2UFTRWUS.cjs} +7 -7
- package/dist/{chunk-B3WEUUUK.cjs.map → chunk-2UFTRWUS.cjs.map} +1 -1
- package/dist/{chunk-DK3RX7RS.js → chunk-4WUG3RMJ.js} +4 -4
- package/dist/{chunk-DK3RX7RS.js.map → chunk-4WUG3RMJ.js.map} +1 -1
- package/dist/{chunk-QTATKDEI.js → chunk-5MJS5ECA.js} +3 -3
- package/dist/{chunk-QTATKDEI.js.map → chunk-5MJS5ECA.js.map} +1 -1
- package/dist/{chunk-Z2AYPTB2.js → chunk-62FWHZXN.js} +5 -5
- package/dist/{chunk-Z2AYPTB2.js.map → chunk-62FWHZXN.js.map} +1 -1
- package/dist/{browser/chunk-TIZ5QRK2.js → chunk-FHQGPQFR.js} +4 -4
- package/dist/{chunk-LEDIWC2M.js.map → chunk-FHQGPQFR.js.map} +1 -1
- package/dist/{chunk-AT3YR5SP.cjs → chunk-GATTHW3X.cjs} +5 -5
- package/dist/{chunk-AT3YR5SP.cjs.map → chunk-GATTHW3X.cjs.map} +1 -1
- package/dist/{chunk-T5UFHQLZ.js → chunk-GQVNZPRF.js} +3 -3
- package/dist/{chunk-T5UFHQLZ.js.map → chunk-GQVNZPRF.js.map} +1 -1
- package/dist/{chunk-4QY5O46P.cjs → chunk-HCN6Z56N.cjs} +18 -18
- package/dist/{chunk-4QY5O46P.cjs.map → chunk-HCN6Z56N.cjs.map} +1 -1
- package/dist/{chunk-K4FHTOBB.cjs → chunk-KALB7HJ5.cjs} +12 -12
- package/dist/{chunk-K4FHTOBB.cjs.map → chunk-KALB7HJ5.cjs.map} +1 -1
- package/dist/{chunk-TEWSIQ6E.cjs → chunk-QLJAATBR.cjs} +6 -6
- package/dist/{chunk-TEWSIQ6E.cjs.map → chunk-QLJAATBR.cjs.map} +1 -1
- package/dist/{chunk-ZFZTJXIO.cjs → chunk-XBI4AMCW.cjs} +15 -15
- package/dist/{chunk-ZFZTJXIO.cjs.map → chunk-XBI4AMCW.cjs.map} +1 -1
- package/dist/{chunk-5YJXFU5U.js → chunk-YGKEP2GY.js} +32 -9
- package/dist/chunk-YGKEP2GY.js.map +1 -0
- package/dist/{chunk-2GWOF5JM.js → chunk-ZMRXUZ5L.js} +3 -3
- package/dist/{chunk-2GWOF5JM.js.map → chunk-ZMRXUZ5L.js.map} +1 -1
- package/dist/{chunk-UV5FUVNK.cjs → chunk-ZTBAMSCC.cjs} +31 -8
- package/dist/chunk-ZTBAMSCC.cjs.map +1 -0
- package/dist/index.cjs +196 -131
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +112 -47
- 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 +34 -34
- package/dist/openai-agents/index.js +4 -4
- package/dist/vercel-ai/index.cjs +14 -14
- package/dist/vercel-ai/index.js +3 -3
- package/package.json +1 -1
- package/dist/browser/chunk-MIHCAKQ2.js.map +0 -1
- package/dist/browser/chunk-WG45SF7N.cjs.map +0 -1
- package/dist/chunk-5YJXFU5U.js.map +0 -1
- package/dist/chunk-UV5FUVNK.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -308,16 +308,17 @@ init({
|
|
|
308
308
|
ingest layer always re-runs the mandatory pattern set before writing
|
|
309
309
|
anything to durable storage.
|
|
310
310
|
|
|
311
|
-
| Key
|
|
312
|
-
|
|
|
313
|
-
| `api_key_prefixed`
|
|
314
|
-
| `jwt`
|
|
315
|
-
| `credit_card`
|
|
316
|
-
| `email`
|
|
317
|
-
| `phone_us`
|
|
318
|
-
| `phone_e164`
|
|
319
|
-
| `ssn_us`
|
|
320
|
-
| `ip_address`
|
|
311
|
+
| Key | Match | Replacement |
|
|
312
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------ |
|
|
313
|
+
| `api_key_prefixed` | `sk-…`, `sk_(live\|test)_…`, `mhq_…`, `ghp_…`, `xox[bopsa]-…`, `AKIA…`, etc. | `[REDACTED:api_key]` |
|
|
314
|
+
| `jwt` | `eyJ…<dot>eyJ…<dot>…` (≥16 chars per segment) | `[REDACTED:jwt]` |
|
|
315
|
+
| `credit_card` | 13–19 digit groups passing Luhn | `[REDACTED:credit_card]` |
|
|
316
|
+
| `email` | RFC-5322-ish `local@domain.tld` | `[REDACTED:email]` |
|
|
317
|
+
| `phone_us` | US phone formats | `[REDACTED:phone]` |
|
|
318
|
+
| `phone_e164` | International E.164 | `[REDACTED:phone]` |
|
|
319
|
+
| `ssn_us` | `999-99-9999` (with standard exclusions) | `[REDACTED:ssn]` |
|
|
320
|
+
| `ip_address` | IPv4 + IPv6 — **default OFF** (often legitimate metadata) | `[REDACTED:ip]` |
|
|
321
|
+
| `secret_assignment` | `password=` / `client_secret:` / `authorization: Bearer …` / `PGPASSWORD=`. Excludes token _counts_ (`input_tokens=`, `max_tokens=`) | `[REDACTED:secret]` |
|
|
321
322
|
|
|
322
323
|
## Docs
|
|
323
324
|
|
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 chunkHCN6Z56N_cjs = require('../chunk-HCN6Z56N.cjs');
|
|
4
|
+
require('../chunk-GATTHW3X.cjs');
|
|
5
|
+
require('../chunk-QLJAATBR.cjs');
|
|
6
6
|
require('../chunk-KBWPNIH4.cjs');
|
|
7
7
|
require('../chunk-HICEJ4LV.cjs');
|
|
8
|
-
require('../chunk-
|
|
8
|
+
require('../chunk-ZTBAMSCC.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 chunkHCN6Z56N_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 chunkHCN6Z56N_cjs._resetAnthropicInstallStateForTesting; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkHCN6Z56N_cjs.extractAnthropicSegments; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkHCN6Z56N_cjs.instrumentAnthropic; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkHCN6Z56N_cjs.isAnthropicWrapped; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkHCN6Z56N_cjs.uninstallAnthropic; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkHCN6Z56N_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-62FWHZXN.js';
|
|
2
|
+
import '../chunk-ZMRXUZ5L.js';
|
|
3
|
+
import '../chunk-5MJS5ECA.js';
|
|
4
4
|
import '../chunk-XTKMUJWI.js';
|
|
5
5
|
import '../chunk-4JPZV2VZ.js';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-YGKEP2GY.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 chunkHCN6Z56N_cjs = require('../chunk-HCN6Z56N.cjs');
|
|
4
|
+
require('../chunk-GATTHW3X.cjs');
|
|
5
|
+
var chunk2UFTRWUS_cjs = require('../chunk-2UFTRWUS.cjs');
|
|
6
|
+
var chunkXBI4AMCW_cjs = require('../chunk-XBI4AMCW.cjs');
|
|
7
|
+
var chunkQLJAATBR_cjs = require('../chunk-QLJAATBR.cjs');
|
|
8
8
|
var chunkKBWPNIH4_cjs = require('../chunk-KBWPNIH4.cjs');
|
|
9
9
|
require('../chunk-HICEJ4LV.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkZTBAMSCC_cjs = require('../chunk-ZTBAMSCC.cjs');
|
|
11
11
|
|
|
12
12
|
// src/anthropic-agent-sdk/client-wrapper.ts
|
|
13
|
-
|
|
13
|
+
chunkZTBAMSCC_cjs.init_tracing();
|
|
14
14
|
var WRAPPED_CLIENT = /* @__PURE__ */ Symbol.for("morse.anthropic-agent-sdk.wrapped");
|
|
15
15
|
function wrapClaudeAgentSDK(client, options = {}) {
|
|
16
16
|
if (!client || typeof client !== "object") return client;
|
|
@@ -34,7 +34,7 @@ function wrapClaudeAgentSDK(client, options = {}) {
|
|
|
34
34
|
});
|
|
35
35
|
return wrapper;
|
|
36
36
|
}
|
|
37
|
-
var instrumentClaudeAgentSDK =
|
|
37
|
+
var instrumentClaudeAgentSDK = chunkQLJAATBR_cjs.absorbErrorsAsync(
|
|
38
38
|
async (client = void 0, maybeOptions = {}) => {
|
|
39
39
|
if (client && isClient(client)) return wrapClaudeAgentSDK(client, maybeOptions);
|
|
40
40
|
return false;
|
|
@@ -57,7 +57,7 @@ function buildPatchedQuery(original, options) {
|
|
|
57
57
|
const boundOriginal = (p, o) => original.call(this, p, o);
|
|
58
58
|
const model = (callOptions && typeof callOptions.model === "string" ? callOptions.model : void 0) ?? defaultModel;
|
|
59
59
|
async function* iterateInTrace2() {
|
|
60
|
-
const handle =
|
|
60
|
+
const handle = chunkXBI4AMCW_cjs.emitAgentSpan({
|
|
61
61
|
adapter: "anthropic-agent-sdk",
|
|
62
62
|
agentName: defaultAgentName,
|
|
63
63
|
model
|
|
@@ -80,7 +80,7 @@ function buildPatchedQuery(original, options) {
|
|
|
80
80
|
}
|
|
81
81
|
handle?.end();
|
|
82
82
|
}
|
|
83
|
-
if (
|
|
83
|
+
if (chunkZTBAMSCC_cjs.getActiveTraceState() !== null) {
|
|
84
84
|
return iterateInTrace2();
|
|
85
85
|
}
|
|
86
86
|
return (async function* outerTrace() {
|
|
@@ -96,7 +96,7 @@ function buildPatchedQuery(original, options) {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
|
-
const runPromise =
|
|
99
|
+
const runPromise = chunkZTBAMSCC_cjs.runAsync({ agentName: defaultAgentName }, async (runHandle) => {
|
|
100
100
|
try {
|
|
101
101
|
for await (const event of iterateInTrace2()) {
|
|
102
102
|
queue.push({ kind: "value", value: event });
|
|
@@ -132,10 +132,10 @@ function buildPatchedQuery(original, options) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
// src/_agent-sdk-common/context-propagation.ts
|
|
135
|
-
|
|
136
|
-
var captureParentForFanOut =
|
|
135
|
+
chunkZTBAMSCC_cjs.init_tracing();
|
|
136
|
+
var captureParentForFanOut = chunkQLJAATBR_cjs.absorbErrorsSync(
|
|
137
137
|
() => {
|
|
138
|
-
const state =
|
|
138
|
+
const state = chunkZTBAMSCC_cjs.getActiveTraceState();
|
|
139
139
|
if (state === null) return null;
|
|
140
140
|
const top = state.spanStack[state.spanStack.length - 1];
|
|
141
141
|
if (!top) return null;
|
|
@@ -146,13 +146,13 @@ var captureParentForFanOut = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
|
146
146
|
},
|
|
147
147
|
{ fingerprint: "agent-sdk-common.captureParentForFanOut" }
|
|
148
148
|
);
|
|
149
|
-
var emitWithPinnedParent =
|
|
149
|
+
var emitWithPinnedParent = chunkQLJAATBR_cjs.absorbErrorsSync(
|
|
150
150
|
(opts) => {
|
|
151
|
-
const state =
|
|
151
|
+
const state = chunkZTBAMSCC_cjs.getActiveTraceState();
|
|
152
152
|
if (state === null) return null;
|
|
153
153
|
const snap = opts.snapshot;
|
|
154
154
|
if (!snap || snap.traceId !== state.traceId) return null;
|
|
155
|
-
const handle =
|
|
155
|
+
const handle = chunkZTBAMSCC_cjs.startSpan({
|
|
156
156
|
name: opts.name,
|
|
157
157
|
type: opts.type,
|
|
158
158
|
metadata: opts.metadata
|
|
@@ -174,13 +174,13 @@ function findSpanById(state, spanId) {
|
|
|
174
174
|
}
|
|
175
175
|
return void 0;
|
|
176
176
|
}
|
|
177
|
-
var emitAsToolSibling =
|
|
177
|
+
var emitAsToolSibling = chunkQLJAATBR_cjs.absorbErrorsSync(
|
|
178
178
|
(opts) => {
|
|
179
|
-
const state =
|
|
179
|
+
const state = chunkZTBAMSCC_cjs.getActiveTraceState();
|
|
180
180
|
if (state === null) return null;
|
|
181
181
|
const tool = findSpanById(state, opts.toolSpanId);
|
|
182
182
|
if (!tool) return null;
|
|
183
|
-
const handle =
|
|
183
|
+
const handle = chunkZTBAMSCC_cjs.startSpan({
|
|
184
184
|
name: opts.name,
|
|
185
185
|
type: opts.type,
|
|
186
186
|
metadata: opts.metadata
|
|
@@ -191,9 +191,9 @@ var emitAsToolSibling = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
|
191
191
|
},
|
|
192
192
|
{ fingerprint: "agent-sdk-common.emitAsToolSibling" }
|
|
193
193
|
);
|
|
194
|
-
|
|
194
|
+
chunkQLJAATBR_cjs.absorbErrorsSync(
|
|
195
195
|
() => {
|
|
196
|
-
const state =
|
|
196
|
+
const state = chunkZTBAMSCC_cjs.getActiveTraceState();
|
|
197
197
|
if (state === null) return null;
|
|
198
198
|
return {
|
|
199
199
|
traceId: state.traceId,
|
|
@@ -238,7 +238,7 @@ var _handleHookEvent = (payload, options) => {
|
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
const fallback =
|
|
241
|
+
const fallback = chunkXBI4AMCW_cjs.emitHookSpan({
|
|
242
242
|
adapter: "anthropic-agent-sdk",
|
|
243
243
|
hookName: name,
|
|
244
244
|
hookKind: kind,
|
|
@@ -248,7 +248,7 @@ var _handleHookEvent = (payload, options) => {
|
|
|
248
248
|
fallback.end();
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
var handleHookEvent =
|
|
251
|
+
var handleHookEvent = chunkQLJAATBR_cjs.absorbErrorsSync(_handleHookEvent, {
|
|
252
252
|
fingerprint: "morse.anthropic-agent-sdk.hook-instrumentation.handle"
|
|
253
253
|
});
|
|
254
254
|
function installHookInstrumentation(client, options) {
|
|
@@ -276,7 +276,7 @@ function installHookInstrumentation(client, options) {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
// src/anthropic-agent-sdk/llm-instrumentation.ts
|
|
279
|
-
|
|
279
|
+
chunkZTBAMSCC_cjs.init_diagnostics();
|
|
280
280
|
function readInputTokens(usage) {
|
|
281
281
|
if (usage === void 0 || usage === null || typeof usage !== "object") return void 0;
|
|
282
282
|
const base = typeof usage.input_tokens === "number" && Number.isFinite(usage.input_tokens) ? usage.input_tokens : 0;
|
|
@@ -343,7 +343,7 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
343
343
|
const reportedModel = typeof event.message?.model === "string" && event.message.model.length > 0 ? event.message.model : void 0;
|
|
344
344
|
const model = reportedModel ?? fallbackModel;
|
|
345
345
|
if (!model) return;
|
|
346
|
-
const handle =
|
|
346
|
+
const handle = chunkXBI4AMCW_cjs.emitLlmSpan({ adapter: "anthropic-agent-sdk", model });
|
|
347
347
|
if (!handle) return;
|
|
348
348
|
const usage = event.message?.usage;
|
|
349
349
|
const inputTokens = readInputTokens(usage);
|
|
@@ -360,7 +360,7 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
360
360
|
applyCost(handle, model, inputTokens, outputTokens, cacheWriteTokens, cachedInputTokens);
|
|
361
361
|
if (requestParams !== void 0) {
|
|
362
362
|
try {
|
|
363
|
-
const segments =
|
|
363
|
+
const segments = chunkHCN6Z56N_cjs.extractAnthropicSegments(
|
|
364
364
|
requestParams,
|
|
365
365
|
event.message
|
|
366
366
|
);
|
|
@@ -383,7 +383,7 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
383
383
|
if (model === void 0 || model.length === 0) {
|
|
384
384
|
return;
|
|
385
385
|
}
|
|
386
|
-
openSpan =
|
|
386
|
+
openSpan = chunkXBI4AMCW_cjs.emitLlmSpan({
|
|
387
387
|
adapter: "anthropic-agent-sdk",
|
|
388
388
|
model
|
|
389
389
|
});
|
|
@@ -425,7 +425,7 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
425
425
|
}
|
|
426
426
|
if (requestParams !== void 0) {
|
|
427
427
|
try {
|
|
428
|
-
const segments =
|
|
428
|
+
const segments = chunkHCN6Z56N_cjs.extractAnthropicSegments(
|
|
429
429
|
requestParams,
|
|
430
430
|
event.message
|
|
431
431
|
);
|
|
@@ -453,13 +453,13 @@ async function* instrumentLlmCalls(events, options) {
|
|
|
453
453
|
}
|
|
454
454
|
function reportSwallowed(err, fingerprint) {
|
|
455
455
|
try {
|
|
456
|
-
|
|
456
|
+
chunkZTBAMSCC_cjs.report(err, { fingerprint });
|
|
457
457
|
} catch {
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
// src/anthropic-agent-sdk/tool-and-subagent.ts
|
|
462
|
-
|
|
462
|
+
chunkZTBAMSCC_cjs.init_diagnostics();
|
|
463
463
|
var ADAPTER = "anthropic-agent-sdk";
|
|
464
464
|
var TASK_TOOL_NAME = "Task";
|
|
465
465
|
function safeCloseFailed(handle, message) {
|
|
@@ -505,7 +505,7 @@ async function* instrumentTools(events, options) {
|
|
|
505
505
|
tool_use_id: toolUseId
|
|
506
506
|
};
|
|
507
507
|
if (taskPrompt !== void 0) {
|
|
508
|
-
metadata.task_description =
|
|
508
|
+
metadata.task_description = chunk2UFTRWUS_cjs.summarizeToolInput(taskPrompt, inputOpts);
|
|
509
509
|
}
|
|
510
510
|
let handle2 = null;
|
|
511
511
|
try {
|
|
@@ -527,10 +527,10 @@ async function* instrumentTools(events, options) {
|
|
|
527
527
|
}
|
|
528
528
|
let handle = null;
|
|
529
529
|
try {
|
|
530
|
-
handle =
|
|
530
|
+
handle = chunkXBI4AMCW_cjs.emitToolSpan({
|
|
531
531
|
adapter: ADAPTER,
|
|
532
532
|
toolName: name,
|
|
533
|
-
inputSummary:
|
|
533
|
+
inputSummary: chunk2UFTRWUS_cjs.summarizeToolInput(event.input, inputOpts),
|
|
534
534
|
attributes: { tool_use_id: toolUseId }
|
|
535
535
|
});
|
|
536
536
|
} catch {
|
|
@@ -547,7 +547,7 @@ async function* instrumentTools(events, options) {
|
|
|
547
547
|
open.delete(toolUseId);
|
|
548
548
|
const isError = event.is_error === true;
|
|
549
549
|
try {
|
|
550
|
-
const outputSummary =
|
|
550
|
+
const outputSummary = chunk2UFTRWUS_cjs.summarizeToolOutput(event.content, outputOpts);
|
|
551
551
|
entry.handle.span.metadata = {
|
|
552
552
|
...entry.handle.span.metadata ?? {},
|
|
553
553
|
tool_output_summary: outputSummary
|
|
@@ -619,15 +619,15 @@ async function* instrumentTools(events, options) {
|
|
|
619
619
|
}
|
|
620
620
|
function reportSwallowed2(err, fingerprint) {
|
|
621
621
|
try {
|
|
622
|
-
|
|
622
|
+
chunkZTBAMSCC_cjs.report(err, { fingerprint });
|
|
623
623
|
} catch {
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
|
|
627
627
|
// src/anthropic-agent-sdk/trace-bridge.ts
|
|
628
|
-
|
|
628
|
+
chunkZTBAMSCC_cjs.init_tracing();
|
|
629
629
|
function iterateInTrace(agentName, makeGenerator) {
|
|
630
|
-
if (
|
|
630
|
+
if (chunkZTBAMSCC_cjs.getActiveTraceState() !== null) {
|
|
631
631
|
return makeGenerator();
|
|
632
632
|
}
|
|
633
633
|
return (async function* outerTrace() {
|
|
@@ -643,7 +643,7 @@ function iterateInTrace(agentName, makeGenerator) {
|
|
|
643
643
|
};
|
|
644
644
|
}
|
|
645
645
|
});
|
|
646
|
-
const runPromise =
|
|
646
|
+
const runPromise = chunkZTBAMSCC_cjs.runAsync({ agentName }, async (runHandle) => {
|
|
647
647
|
try {
|
|
648
648
|
for await (const event of makeGenerator()) {
|
|
649
649
|
queue.push({ kind: "value", value: event });
|
|
@@ -692,7 +692,7 @@ function wrapClaudeAgentQuery(query, options = {}) {
|
|
|
692
692
|
async function* withAgentSpan() {
|
|
693
693
|
if (!opened) {
|
|
694
694
|
opened = true;
|
|
695
|
-
handle =
|
|
695
|
+
handle = chunkXBI4AMCW_cjs.emitAgentSpan({
|
|
696
696
|
adapter: "anthropic-agent-sdk",
|
|
697
697
|
agentName: options.defaultAgentName ?? "claude-agent-sdk",
|
|
698
698
|
model
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { extractAnthropicSegments } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import { summarizeToolInput, summarizeToolOutput } from '../chunk-
|
|
4
|
-
import { emitHookSpan, emitAgentSpan, emitLlmSpan, emitToolSpan } from '../chunk-
|
|
5
|
-
import { absorbErrorsAsync, absorbErrorsSync } from '../chunk-
|
|
1
|
+
import { extractAnthropicSegments } from '../chunk-62FWHZXN.js';
|
|
2
|
+
import '../chunk-ZMRXUZ5L.js';
|
|
3
|
+
import { summarizeToolInput, summarizeToolOutput } from '../chunk-GQVNZPRF.js';
|
|
4
|
+
import { emitHookSpan, emitAgentSpan, emitLlmSpan, emitToolSpan } from '../chunk-FHQGPQFR.js';
|
|
5
|
+
import { absorbErrorsAsync, absorbErrorsSync } from '../chunk-5MJS5ECA.js';
|
|
6
6
|
import { calculateCost } from '../chunk-XTKMUJWI.js';
|
|
7
7
|
import '../chunk-4JPZV2VZ.js';
|
|
8
|
-
import { init_tracing, getActiveTraceState, startSpan, init_diagnostics, runAsync, report } from '../chunk-
|
|
8
|
+
import { init_tracing, getActiveTraceState, startSpan, init_diagnostics, runAsync, report } from '../chunk-YGKEP2GY.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 chunkZOOYJTDT_cjs = require('../chunk-ZOOYJTDT.cjs');
|
|
4
|
+
require('../chunk-E6WORBIU.cjs');
|
|
5
|
+
require('../chunk-Z26QGUMP.cjs');
|
|
6
6
|
require('../chunk-SWQOPFE4.cjs');
|
|
7
7
|
require('../chunk-RBNCTHK3.cjs');
|
|
8
|
-
require('../chunk-
|
|
8
|
+
require('../chunk-HJTUPXNE.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 chunkZOOYJTDT_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 chunkZOOYJTDT_cjs._resetAnthropicInstallStateForTesting; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkZOOYJTDT_cjs.extractAnthropicSegments; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkZOOYJTDT_cjs.instrumentAnthropic; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkZOOYJTDT_cjs.isAnthropicWrapped; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkZOOYJTDT_cjs.uninstallAnthropic; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkZOOYJTDT_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-VSHCKROM.js';
|
|
2
|
+
import '../chunk-5IMBYZUB.js';
|
|
3
|
+
import '../chunk-RDNSY73W.js';
|
|
4
4
|
import '../chunk-4FALQMOZ.js';
|
|
5
5
|
import '../chunk-MLDVXMQD.js';
|
|
6
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-7G266PKE.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|