@brizz/sdk 0.1.60 → 0.2.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/CHANGELOG.md +430 -0
- package/LICENSE +194 -20
- package/README.md +36 -1
- package/dist/{chunk-B5IY6O4N.js → chunk-6OYS2GR3.js} +1 -1
- package/dist/{chunk-WC573FCI.cjs → chunk-C5OT6GAQ.cjs} +10 -2
- package/dist/{chunk-Y4HNUX3Q.js → chunk-CZDPIJTO.js} +8 -0
- package/dist/{chunk-MPSJSXD3.js → chunk-GITAPIVL.js} +10 -10
- package/dist/{chunk-NF52RMLW.cjs → chunk-IWSFMCHH.cjs} +5 -1
- package/dist/{chunk-GISL4K6Z.js → chunk-JMX23OHO.js} +4 -0
- package/dist/{chunk-MW6L2BZN.js → chunk-KJSZPKSN.js} +5 -5
- package/dist/{chunk-RD4XCYKT.cjs → chunk-P5OONZTF.cjs} +3 -3
- package/dist/{chunk-WCUBTLL5.cjs → chunk-QXHGMS5A.cjs} +13 -13
- package/dist/{chunk-Y7UFS5CA.cjs → chunk-UF4GMVEY.cjs} +145 -145
- package/dist/eve.cjs +2 -3
- package/dist/eve.js +1 -2
- package/dist/google-genai-6S5E7GZ4.cjs +10 -0
- package/dist/{google-genai-3ERJNC7Q.js → google-genai-H6TMOKRX.js} +2 -3
- package/dist/google-genai.cjs +3 -4
- package/dist/google-genai.js +2 -3
- package/dist/index.cjs +592 -301
- package/dist/index.js +373 -82
- package/dist/{mcp-2AURUXLD.cjs → mcp-6LNVYVJQ.cjs} +39 -40
- package/dist/{mcp-IB3UO2FY.js → mcp-YTBE75NP.js} +5 -6
- package/dist/session.cjs +5 -6
- package/dist/session.js +4 -5
- package/dist/types/cjs/index.d.ts +1 -1
- package/dist/types/cjs/internal/instrumentation/auto-init.d.ts +0 -7
- package/dist/types/cjs/internal/instrumentation/registry.d.ts +2 -0
- package/dist/types/cjs/internal/instrumentation/vercel-ai/index.d.ts +28 -0
- package/dist/types/cjs/internal/instrumentation/vercel-ai/model-call-end.d.ts +1 -0
- package/dist/types/cjs/internal/log/emit.d.ts +2 -2
- package/dist/types/cjs/internal/log/logging.d.ts +2 -2
- package/dist/types/cjs/internal/sdk.d.ts +1 -0
- package/dist/types/cjs/internal/semantic-conventions.d.ts +2 -0
- package/dist/types/cjs/internal/trace/session.d.ts +1 -2
- package/dist/types/cjs/session.d.ts +1 -1
- package/dist/types/esm/index.d.ts +1 -1
- package/dist/types/esm/internal/instrumentation/auto-init.d.ts +0 -7
- package/dist/types/esm/internal/instrumentation/registry.d.ts +2 -0
- package/dist/types/esm/internal/instrumentation/vercel-ai/index.d.ts +28 -0
- package/dist/types/esm/internal/instrumentation/vercel-ai/model-call-end.d.ts +1 -0
- package/dist/types/esm/internal/log/emit.d.ts +2 -2
- package/dist/types/esm/internal/log/logging.d.ts +2 -2
- package/dist/types/esm/internal/sdk.d.ts +1 -0
- package/dist/types/esm/internal/semantic-conventions.d.ts +2 -0
- package/dist/types/esm/internal/trace/session.d.ts +1 -2
- package/dist/types/esm/session.d.ts +1 -1
- package/package.json +31 -27
- package/dist/chunk-3RG5ZIWI.js +0 -10
- package/dist/chunk-6QXPHZEO.cjs +0 -130
- package/dist/chunk-GABRGNAU.js +0 -130
- package/dist/chunk-OBGZSXTJ.cjs +0 -10
- package/dist/google-genai-GVCKSJMR.cjs +0 -11
- package/dist/interrupt-36U5562Z.cjs +0 -12
- package/dist/interrupt-6BSXUK3O.js +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brizz/sdk",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenTelemetry-based observability SDK for AI applications",
|
|
6
6
|
"keywords": [
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
],
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"homepage": "https://www.brizz.ai",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/brizzai/brizz-js.git",
|
|
26
|
+
"directory": "typescript"
|
|
27
|
+
},
|
|
23
28
|
"author": {
|
|
24
29
|
"name": "Brizz",
|
|
25
30
|
"email": "contact@brizz.ai",
|
|
@@ -31,7 +36,8 @@
|
|
|
31
36
|
"files": [
|
|
32
37
|
"dist",
|
|
33
38
|
"LICENSE",
|
|
34
|
-
"README.md"
|
|
39
|
+
"README.md",
|
|
40
|
+
"CHANGELOG.md"
|
|
35
41
|
],
|
|
36
42
|
"scripts": {
|
|
37
43
|
"build": "pnpm run clean && tsup && tsc -p tsconfig.dts.json && node scripts/emit-cjs-dts.mjs",
|
|
@@ -52,7 +58,7 @@
|
|
|
52
58
|
"quality": "pnpm run lint && pnpm run format && pnpm run type-check && pnpm run test",
|
|
53
59
|
"pack": "pnpm run build && pnpm pack",
|
|
54
60
|
"changeset": "changeset",
|
|
55
|
-
"changeset:version": "changeset version && pnpm install --lockfile-only",
|
|
61
|
+
"changeset:version": "changeset version && pnpm install --lockfile-only && node ../../dashboard/scripts/generate-sdk-changelogs.mjs",
|
|
56
62
|
"changeset:publish": "pnpm build && changeset publish",
|
|
57
63
|
"changeset:status": "changeset status --verbose",
|
|
58
64
|
"prerelease:enter": "changeset pre enter",
|
|
@@ -108,39 +114,38 @@
|
|
|
108
114
|
"./package.json": "./package.json"
|
|
109
115
|
},
|
|
110
116
|
"engines": {
|
|
111
|
-
"node": ">=
|
|
117
|
+
"node": ">=22.15.0"
|
|
112
118
|
},
|
|
113
119
|
"publishConfig": {
|
|
114
120
|
"access": "public",
|
|
115
121
|
"registry": "https://registry.npmjs.org/"
|
|
116
122
|
},
|
|
117
123
|
"devDependencies": {
|
|
118
|
-
"@ai-sdk/anthropic": "^4.0.
|
|
119
|
-
"@ai-sdk/openai": "^4.0.
|
|
120
|
-
"@ai-sdk/otel": "^1.0.
|
|
124
|
+
"@ai-sdk/anthropic": "^4.0.102",
|
|
125
|
+
"@ai-sdk/openai": "^4.0.114",
|
|
126
|
+
"@ai-sdk/otel": "^1.0.169",
|
|
121
127
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
122
128
|
"@arizeai/openinference-instrumentation-mcp": "^0.2.37",
|
|
123
129
|
"@babel/core": "^8.1.0",
|
|
124
130
|
"@babel/preset-env": "^8.0.7",
|
|
125
131
|
"@babel/preset-typescript": "^8.0.7",
|
|
126
|
-
"@changesets/changelog-github": "^1.0.1",
|
|
127
132
|
"@changesets/cli": "^3.0.3",
|
|
128
133
|
"@google/genai": "^2.32.0",
|
|
129
|
-
"@langchain/core": "^1.3.
|
|
130
|
-
"@langchain/langgraph": "^1.7.
|
|
134
|
+
"@langchain/core": "^1.3.7",
|
|
135
|
+
"@langchain/langgraph": "^1.7.3",
|
|
131
136
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
132
137
|
"@traceloop/instrumentation-google-generativeai": "^0.27.0",
|
|
133
138
|
"@traceloop/instrumentation-vertexai": "^0.27.0",
|
|
134
139
|
"@types/jest": "^30.0.0",
|
|
135
140
|
"@types/node": "^26.6.6",
|
|
136
141
|
"@typesafe-ai/sdk": "^0.7.0",
|
|
137
|
-
"ai": "^7.0.
|
|
142
|
+
"ai": "^7.0.169",
|
|
138
143
|
"babel-jest": "^30.5.2",
|
|
139
144
|
"babel-plugin-transform-import-meta": "^3.1.0",
|
|
140
145
|
"jest": "^30.5.2",
|
|
141
146
|
"jest-environment-jsdom": "^30.5.2",
|
|
142
|
-
"openai": "^7.
|
|
143
|
-
"oxlint": "^1.
|
|
147
|
+
"openai": "^7.55.0",
|
|
148
|
+
"oxlint": "^1.93.0",
|
|
144
149
|
"prettier": "^3.9.10",
|
|
145
150
|
"tsup": "^9.0.0",
|
|
146
151
|
"typescript": "^7.0.2",
|
|
@@ -194,19 +199,18 @@
|
|
|
194
199
|
"dependencies": {
|
|
195
200
|
"@arizeai/openinference-instrumentation-langchain": "^4.1.5",
|
|
196
201
|
"@arizeai/openinference-instrumentation-openai": "^2.3.1",
|
|
197
|
-
"@opentelemetry/api": "
|
|
198
|
-
"@opentelemetry/
|
|
199
|
-
"@opentelemetry/
|
|
200
|
-
"@opentelemetry/
|
|
201
|
-
"@opentelemetry/exporter-
|
|
202
|
-
"@opentelemetry/exporter-
|
|
203
|
-
"@opentelemetry/exporter-trace-otlp-
|
|
204
|
-
"@opentelemetry/
|
|
205
|
-
"@opentelemetry/
|
|
206
|
-
"@opentelemetry/
|
|
207
|
-
"@opentelemetry/sdk-
|
|
208
|
-
"@opentelemetry/sdk-
|
|
209
|
-
"@opentelemetry/sdk-trace": "^2.12.0",
|
|
202
|
+
"@opentelemetry/api": "^1.10.0",
|
|
203
|
+
"@opentelemetry/context-async-hooks": "^3.1.1",
|
|
204
|
+
"@opentelemetry/core": "^3.1.1",
|
|
205
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.301.1",
|
|
206
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.301.1",
|
|
207
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.301.1",
|
|
208
|
+
"@opentelemetry/exporter-trace-otlp-proto": "^0.301.1",
|
|
209
|
+
"@opentelemetry/instrumentation": "^0.301.1",
|
|
210
|
+
"@opentelemetry/resources": "^3.1.1",
|
|
211
|
+
"@opentelemetry/sdk-logs": "^3.1.1",
|
|
212
|
+
"@opentelemetry/sdk-metrics": "^3.1.1",
|
|
213
|
+
"@opentelemetry/sdk-trace": "^3.1.1",
|
|
210
214
|
"@opentelemetry/semantic-conventions": "^1.45.0",
|
|
211
215
|
"@traceloop/ai-semantic-conventions": "^0.27.0",
|
|
212
216
|
"@traceloop/instrumentation-anthropic": "^0.27.0",
|
|
@@ -225,7 +229,7 @@
|
|
|
225
229
|
"pnpm": {
|
|
226
230
|
"overrides": {
|
|
227
231
|
"@babel/core": "^8.1.0",
|
|
228
|
-
"@opentelemetry/core": "^2.12.0"
|
|
232
|
+
"@opentelemetry/core@<2.12.0": "^2.12.0"
|
|
229
233
|
},
|
|
230
234
|
"updateConfig": {
|
|
231
235
|
"ignoreDependencies": [
|
package/dist/chunk-3RG5ZIWI.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
__require
|
|
10
|
-
};
|
package/dist/chunk-6QXPHZEO.cjs
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
var _chunkNF52RMLWcjs = require('./chunk-NF52RMLW.cjs');
|
|
4
|
-
|
|
5
|
-
// src/internal/instrumentation/vercel-ai/interrupt.ts
|
|
6
|
-
var _api = require('@opentelemetry/api');
|
|
7
|
-
var INNER_OPERATION_IDS = /* @__PURE__ */ new Set([
|
|
8
|
-
"ai.generateText.doGenerate",
|
|
9
|
-
"ai.streamText.doStream"
|
|
10
|
-
]);
|
|
11
|
-
function isInnerLLMSpan(span) {
|
|
12
|
-
if (INNER_OPERATION_IDS.has(span.name)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
const opId = span.attributes["ai.operationId"];
|
|
16
|
-
return typeof opId === "string" && INNER_OPERATION_IDS.has(opId);
|
|
17
|
-
}
|
|
18
|
-
var MAX_PENDING_ENTRIES = 1024;
|
|
19
|
-
var pendingByParentSpanId = /* @__PURE__ */ new Map();
|
|
20
|
-
var needsApprovalToolNames = /* @__PURE__ */ new Set();
|
|
21
|
-
var versionState = { sawActiveSpan: false };
|
|
22
|
-
function setPending(parentSpanId, value) {
|
|
23
|
-
pendingByParentSpanId.set(parentSpanId, value);
|
|
24
|
-
while (pendingByParentSpanId.size > MAX_PENDING_ENTRIES) {
|
|
25
|
-
const oldest = pendingByParentSpanId.keys().next().value;
|
|
26
|
-
if (oldest === void 0) {
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
pendingByParentSpanId.delete(oldest);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function extractInterruptTools(tools) {
|
|
33
|
-
if (!tools || typeof tools !== "object") {
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
return Object.entries(tools).filter(
|
|
37
|
-
([, t]) => !!t && typeof t === "object" && t.needsApproval
|
|
38
|
-
).map(([name]) => name);
|
|
39
|
-
}
|
|
40
|
-
function parsePromptToolNames(raw) {
|
|
41
|
-
if (!Array.isArray(raw)) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
const names = [];
|
|
45
|
-
for (const element of raw) {
|
|
46
|
-
if (typeof element !== "string") {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
const parsed = JSON.parse(element);
|
|
51
|
-
if (parsed && typeof parsed.name === "string") {
|
|
52
|
-
names.push(parsed.name);
|
|
53
|
-
}
|
|
54
|
-
} catch (e) {
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return names.length > 0 ? names : null;
|
|
58
|
-
}
|
|
59
|
-
function createInterruptIntegration() {
|
|
60
|
-
const onStart = (event) => {
|
|
61
|
-
for (const name of extractInterruptTools(event.tools)) {
|
|
62
|
-
needsApprovalToolNames.add(name);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const onStepStart = (event) => {
|
|
66
|
-
const span = _api.trace.getActiveSpan();
|
|
67
|
-
if (span) {
|
|
68
|
-
versionState.sawActiveSpan = true;
|
|
69
|
-
}
|
|
70
|
-
const names = extractInterruptTools(event.tools);
|
|
71
|
-
if (names.length === 0) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
for (const name of names) {
|
|
75
|
-
needsApprovalToolNames.add(name);
|
|
76
|
-
}
|
|
77
|
-
if (!span) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const value = JSON.stringify(names);
|
|
81
|
-
span.setAttribute(_chunkNF52RMLWcjs.INTERRUPT_TOOLS, value);
|
|
82
|
-
setPending(span.spanContext().spanId, value);
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
onStart,
|
|
86
|
-
onStepStart
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
var InterruptPropagator = class {
|
|
90
|
-
onStart(span, _parentContext) {
|
|
91
|
-
if (!isInnerLLMSpan(span)) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const parentSpanId = _optionalChain([span, 'access', _ => _.parentSpanContext, 'optionalAccess', _2 => _2.spanId]);
|
|
95
|
-
const stashed = parentSpanId && pendingByParentSpanId.get(parentSpanId);
|
|
96
|
-
if (stashed) {
|
|
97
|
-
span.setAttribute(_chunkNF52RMLWcjs.INTERRUPT_TOOLS, stashed);
|
|
98
|
-
pendingByParentSpanId.delete(parentSpanId);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (versionState.sawActiveSpan || needsApprovalToolNames.size === 0) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const scoped = parsePromptToolNames(span.attributes["ai.prompt.tools"]);
|
|
105
|
-
const names = scoped === null ? [...needsApprovalToolNames] : scoped.filter((n) => needsApprovalToolNames.has(n));
|
|
106
|
-
if (names.length > 0) {
|
|
107
|
-
span.setAttribute(_chunkNF52RMLWcjs.INTERRUPT_TOOLS, JSON.stringify(names));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
onEnd() {
|
|
111
|
-
}
|
|
112
|
-
async shutdown() {
|
|
113
|
-
}
|
|
114
|
-
async forceFlush() {
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
function _resetInterruptState() {
|
|
118
|
-
if (process.env["NODE_ENV"] !== "test") {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
pendingByParentSpanId.clear();
|
|
122
|
-
needsApprovalToolNames.clear();
|
|
123
|
-
versionState.sawActiveSpan = false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
exports.createInterruptIntegration = createInterruptIntegration; exports.InterruptPropagator = InterruptPropagator; exports._resetInterruptState = _resetInterruptState;
|
package/dist/chunk-GABRGNAU.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
INTERRUPT_TOOLS
|
|
3
|
-
} from "./chunk-GISL4K6Z.js";
|
|
4
|
-
|
|
5
|
-
// src/internal/instrumentation/vercel-ai/interrupt.ts
|
|
6
|
-
import { trace } from "@opentelemetry/api";
|
|
7
|
-
var INNER_OPERATION_IDS = /* @__PURE__ */ new Set([
|
|
8
|
-
"ai.generateText.doGenerate",
|
|
9
|
-
"ai.streamText.doStream"
|
|
10
|
-
]);
|
|
11
|
-
function isInnerLLMSpan(span) {
|
|
12
|
-
if (INNER_OPERATION_IDS.has(span.name)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
const opId = span.attributes["ai.operationId"];
|
|
16
|
-
return typeof opId === "string" && INNER_OPERATION_IDS.has(opId);
|
|
17
|
-
}
|
|
18
|
-
var MAX_PENDING_ENTRIES = 1024;
|
|
19
|
-
var pendingByParentSpanId = /* @__PURE__ */ new Map();
|
|
20
|
-
var needsApprovalToolNames = /* @__PURE__ */ new Set();
|
|
21
|
-
var versionState = { sawActiveSpan: false };
|
|
22
|
-
function setPending(parentSpanId, value) {
|
|
23
|
-
pendingByParentSpanId.set(parentSpanId, value);
|
|
24
|
-
while (pendingByParentSpanId.size > MAX_PENDING_ENTRIES) {
|
|
25
|
-
const oldest = pendingByParentSpanId.keys().next().value;
|
|
26
|
-
if (oldest === void 0) {
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
pendingByParentSpanId.delete(oldest);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function extractInterruptTools(tools) {
|
|
33
|
-
if (!tools || typeof tools !== "object") {
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
return Object.entries(tools).filter(
|
|
37
|
-
([, t]) => !!t && typeof t === "object" && t.needsApproval
|
|
38
|
-
).map(([name]) => name);
|
|
39
|
-
}
|
|
40
|
-
function parsePromptToolNames(raw) {
|
|
41
|
-
if (!Array.isArray(raw)) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
const names = [];
|
|
45
|
-
for (const element of raw) {
|
|
46
|
-
if (typeof element !== "string") {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
const parsed = JSON.parse(element);
|
|
51
|
-
if (parsed && typeof parsed.name === "string") {
|
|
52
|
-
names.push(parsed.name);
|
|
53
|
-
}
|
|
54
|
-
} catch {
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return names.length > 0 ? names : null;
|
|
58
|
-
}
|
|
59
|
-
function createInterruptIntegration() {
|
|
60
|
-
const onStart = (event) => {
|
|
61
|
-
for (const name of extractInterruptTools(event.tools)) {
|
|
62
|
-
needsApprovalToolNames.add(name);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const onStepStart = (event) => {
|
|
66
|
-
const span = trace.getActiveSpan();
|
|
67
|
-
if (span) {
|
|
68
|
-
versionState.sawActiveSpan = true;
|
|
69
|
-
}
|
|
70
|
-
const names = extractInterruptTools(event.tools);
|
|
71
|
-
if (names.length === 0) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
for (const name of names) {
|
|
75
|
-
needsApprovalToolNames.add(name);
|
|
76
|
-
}
|
|
77
|
-
if (!span) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const value = JSON.stringify(names);
|
|
81
|
-
span.setAttribute(INTERRUPT_TOOLS, value);
|
|
82
|
-
setPending(span.spanContext().spanId, value);
|
|
83
|
-
};
|
|
84
|
-
return {
|
|
85
|
-
onStart,
|
|
86
|
-
onStepStart
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
var InterruptPropagator = class {
|
|
90
|
-
onStart(span, _parentContext) {
|
|
91
|
-
if (!isInnerLLMSpan(span)) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const parentSpanId = span.parentSpanContext?.spanId;
|
|
95
|
-
const stashed = parentSpanId && pendingByParentSpanId.get(parentSpanId);
|
|
96
|
-
if (stashed) {
|
|
97
|
-
span.setAttribute(INTERRUPT_TOOLS, stashed);
|
|
98
|
-
pendingByParentSpanId.delete(parentSpanId);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (versionState.sawActiveSpan || needsApprovalToolNames.size === 0) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const scoped = parsePromptToolNames(span.attributes["ai.prompt.tools"]);
|
|
105
|
-
const names = scoped === null ? [...needsApprovalToolNames] : scoped.filter((n) => needsApprovalToolNames.has(n));
|
|
106
|
-
if (names.length > 0) {
|
|
107
|
-
span.setAttribute(INTERRUPT_TOOLS, JSON.stringify(names));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
onEnd() {
|
|
111
|
-
}
|
|
112
|
-
async shutdown() {
|
|
113
|
-
}
|
|
114
|
-
async forceFlush() {
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
function _resetInterruptState() {
|
|
118
|
-
if (process.env["NODE_ENV"] !== "test") {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
pendingByParentSpanId.clear();
|
|
122
|
-
needsApprovalToolNames.clear();
|
|
123
|
-
versionState.sawActiveSpan = false;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export {
|
|
127
|
-
createInterruptIntegration,
|
|
128
|
-
InterruptPropagator,
|
|
129
|
-
_resetInterruptState
|
|
130
|
-
};
|
package/dist/chunk-OBGZSXTJ.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.__require = __require;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkRD4XCYKTcjs = require('./chunk-RD4XCYKT.cjs');
|
|
5
|
-
require('./chunk-DC2MFO65.cjs');
|
|
6
|
-
require('./chunk-WC573FCI.cjs');
|
|
7
|
-
require('./chunk-OBGZSXTJ.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.GoogleGenAIInstrumentation = _chunkRD4XCYKTcjs.GoogleGenAIInstrumentation; exports.instrumentGoogleGenAI = _chunkRD4XCYKTcjs.instrumentGoogleGenAI;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunk6QXPHZEOcjs = require('./chunk-6QXPHZEO.cjs');
|
|
6
|
-
require('./chunk-NF52RMLW.cjs');
|
|
7
|
-
require('./chunk-OBGZSXTJ.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.InterruptPropagator = _chunk6QXPHZEOcjs.InterruptPropagator; exports._resetInterruptState = _chunk6QXPHZEOcjs._resetInterruptState; exports.createInterruptIntegration = _chunk6QXPHZEOcjs.createInterruptIntegration;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InterruptPropagator,
|
|
3
|
-
_resetInterruptState,
|
|
4
|
-
createInterruptIntegration
|
|
5
|
-
} from "./chunk-GABRGNAU.js";
|
|
6
|
-
import "./chunk-GISL4K6Z.js";
|
|
7
|
-
import "./chunk-3RG5ZIWI.js";
|
|
8
|
-
export {
|
|
9
|
-
InterruptPropagator,
|
|
10
|
-
_resetInterruptState,
|
|
11
|
-
createInterruptIntegration
|
|
12
|
-
};
|