@cloudbase/agent-adapter-langgraph 1.0.1-alpha.7 → 1.0.1-alpha.9
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 +26 -0
- package/README.md +85 -74
- package/dist/chunk-NSSMTXJJ.mjs +8 -0
- package/dist/chunk-NSSMTXJJ.mjs.map +1 -0
- package/dist/index.d.mts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +2877 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +321 -47
- package/dist/index.mjs.map +1 -1
- package/dist/langchain-NZNM23PL.mjs +2322 -0
- package/dist/langchain-NZNM23PL.mjs.map +1 -0
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
8
12
|
var __export = (target, all) => {
|
|
9
13
|
for (var name in all)
|
|
10
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,17 +19,2557 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
19
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
20
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
21
|
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
|
+
|
|
35
|
+
// ../../observability/dist/chunk-NFEGQTCC.mjs
|
|
36
|
+
var __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __esm2, __export2, __copyProps2, __toCommonJS2;
|
|
37
|
+
var init_chunk_NFEGQTCC = __esm({
|
|
38
|
+
"../../observability/dist/chunk-NFEGQTCC.mjs"() {
|
|
39
|
+
"use strict";
|
|
40
|
+
__defProp2 = Object.defineProperty;
|
|
41
|
+
__getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
42
|
+
__getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
43
|
+
__hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
44
|
+
__esm2 = (fn, res) => function __init() {
|
|
45
|
+
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
46
|
+
};
|
|
47
|
+
__export2 = (target, all) => {
|
|
48
|
+
for (var name in all)
|
|
49
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
50
|
+
};
|
|
51
|
+
__copyProps2 = (to, from, except, desc) => {
|
|
52
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
53
|
+
for (let key of __getOwnPropNames2(from))
|
|
54
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
55
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
56
|
+
}
|
|
57
|
+
return to;
|
|
58
|
+
};
|
|
59
|
+
__toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// ../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/trace/SemanticConventions.js
|
|
64
|
+
var SemanticAttributePrefixes, LLMAttributePostfixes, RetrievalAttributePostfixes, RerankerAttributePostfixes, EmbeddingAttributePostfixes, ToolAttributePostfixes, MessageAttributePostfixes, MessageContentsAttributePostfixes, ImageAttributesPostfixes, ToolCallAttributePostfixes, DocumentAttributePostfixes, TagAttributePostfixes, SessionAttributePostfixes, UserAttributePostfixes, AudioAttributesPostfixes, PromptAttributePostfixes, AgentPostfixes, GraphPostfixes, INPUT_VALUE, INPUT_MIME_TYPE, OUTPUT_VALUE, OUTPUT_MIME_TYPE, LLM_INPUT_MESSAGES, LLM_PROMPTS, LLM_INVOCATION_PARAMETERS, LLM_OUTPUT_MESSAGES, LLM_MODEL_NAME, LLM_PROVIDER, LLM_SYSTEM, LLM_TOKEN_COUNT_COMPLETION, LLM_TOKEN_COUNT_COMPLETION_DETAILS_REASONING, LLM_TOKEN_COUNT_COMPLETION_DETAILS_AUDIO, LLM_TOKEN_COUNT_PROMPT, LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_WRITE, LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_READ, LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_INPUT, LLM_TOKEN_COUNT_PROMPT_DETAILS_AUDIO, LLM_TOKEN_COUNT_TOTAL, LLM_TOKEN_COUNT_PROMPT_DETAILS, LLM_TOKEN_COUNT_COMPLETION_DETAILS, LLM_COST, LLM_COST_PROMPT, LLM_COST_COMPLETION, LLM_COST_TOTAL, LLM_COST_INPUT, LLM_COST_OUTPUT, LLM_COST_COMPLETION_DETAILS_REASONING, LLM_COST_COMPLETION_DETAILS_AUDIO, LLM_COST_PROMPT_DETAILS_CACHE_WRITE, LLM_COST_PROMPT_DETAILS_CACHE_READ, LLM_COST_PROMPT_DETAILS_CACHE_INPUT, LLM_COST_PROMPT_DETAILS_AUDIO, MESSAGE_ROLE, MESSAGE_NAME, MESSAGE_TOOL_CALLS, MESSAGE_TOOL_CALL_ID, TOOL_CALL_FUNCTION_NAME, TOOL_CALL_FUNCTION_ARGUMENTS_JSON, TOOL_CALL_ID, MESSAGE_FUNCTION_CALL_NAME, MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON, MESSAGE_CONTENT, MESSAGE_CONTENTS, MESSAGE_CONTENT_TYPE, MESSAGE_CONTENT_TEXT, MESSAGE_CONTENT_IMAGE, IMAGE_URL, DOCUMENT_ID, DOCUMENT_CONTENT, DOCUMENT_SCORE, DOCUMENT_METADATA, EMBEDDING_TEXT, EMBEDDING_MODEL_NAME, EMBEDDING_VECTOR, EMBEDDING_EMBEDDINGS, RETRIEVAL_DOCUMENTS, PROMPT_TEMPLATE_PREFIX, PROMPT_TEMPLATE_VARIABLES, PROMPT_TEMPLATE_TEMPLATE, LLM_FUNCTION_CALL, LLM_TOOLS, TOOL_NAME, TOOL_DESCRIPTION, TOOL_PARAMETERS, TOOL_JSON_SCHEMA, SESSION_ID, USER_ID, RERANKER_INPUT_DOCUMENTS, RERANKER_OUTPUT_DOCUMENTS, RERANKER_QUERY, RERANKER_MODEL_NAME, RERANKER_TOP_K, METADATA, PROMPT_TEMPLATE_VERSION, TAG_TAGS, AUDIO_URL, AUDIO_MIME_TYPE, AUDIO_TRANSCRIPT, PROMPT_VENDOR, PROMPT_ID, PROMPT_URL, AGENT_NAME, GRAPH_NODE_ID, GRAPH_NODE_NAME, GRAPH_NODE_PARENT_ID, SemanticConventions, OpenInferenceSpanKind, MimeType, LLMSystem, LLMProvider;
|
|
65
|
+
var init_SemanticConventions = __esm({
|
|
66
|
+
"../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/trace/SemanticConventions.js"() {
|
|
67
|
+
"use strict";
|
|
68
|
+
SemanticAttributePrefixes = {
|
|
69
|
+
input: "input",
|
|
70
|
+
output: "output",
|
|
71
|
+
llm: "llm",
|
|
72
|
+
retrieval: "retrieval",
|
|
73
|
+
reranker: "reranker",
|
|
74
|
+
messages: "messages",
|
|
75
|
+
message: "message",
|
|
76
|
+
document: "document",
|
|
77
|
+
embedding: "embedding",
|
|
78
|
+
tool: "tool",
|
|
79
|
+
tool_call: "tool_call",
|
|
80
|
+
metadata: "metadata",
|
|
81
|
+
tag: "tag",
|
|
82
|
+
session: "session",
|
|
83
|
+
user: "user",
|
|
84
|
+
openinference: "openinference",
|
|
85
|
+
message_content: "message_content",
|
|
86
|
+
image: "image",
|
|
87
|
+
audio: "audio",
|
|
88
|
+
prompt: "prompt",
|
|
89
|
+
agent: "agent",
|
|
90
|
+
graph: "graph"
|
|
91
|
+
};
|
|
92
|
+
LLMAttributePostfixes = {
|
|
93
|
+
provider: "provider",
|
|
94
|
+
system: "system",
|
|
95
|
+
model_name: "model_name",
|
|
96
|
+
token_count: "token_count",
|
|
97
|
+
input_messages: "input_messages",
|
|
98
|
+
output_messages: "output_messages",
|
|
99
|
+
invocation_parameters: "invocation_parameters",
|
|
100
|
+
prompts: "prompts",
|
|
101
|
+
prompt_template: "prompt_template",
|
|
102
|
+
function_call: "function_call",
|
|
103
|
+
tools: "tools",
|
|
104
|
+
cost: "cost"
|
|
105
|
+
};
|
|
106
|
+
RetrievalAttributePostfixes = {
|
|
107
|
+
documents: "documents"
|
|
108
|
+
};
|
|
109
|
+
RerankerAttributePostfixes = {
|
|
110
|
+
input_documents: "input_documents",
|
|
111
|
+
output_documents: "output_documents",
|
|
112
|
+
query: "query",
|
|
113
|
+
model_name: "model_name",
|
|
114
|
+
top_k: "top_k"
|
|
115
|
+
};
|
|
116
|
+
EmbeddingAttributePostfixes = {
|
|
117
|
+
embeddings: "embeddings",
|
|
118
|
+
text: "text",
|
|
119
|
+
model_name: "model_name",
|
|
120
|
+
vector: "vector"
|
|
121
|
+
};
|
|
122
|
+
ToolAttributePostfixes = {
|
|
123
|
+
name: "name",
|
|
124
|
+
description: "description",
|
|
125
|
+
parameters: "parameters",
|
|
126
|
+
json_schema: "json_schema"
|
|
127
|
+
};
|
|
128
|
+
MessageAttributePostfixes = {
|
|
129
|
+
role: "role",
|
|
130
|
+
content: "content",
|
|
131
|
+
contents: "contents",
|
|
132
|
+
name: "name",
|
|
133
|
+
function_call_name: "function_call_name",
|
|
134
|
+
function_call_arguments_json: "function_call_arguments_json",
|
|
135
|
+
tool_calls: "tool_calls",
|
|
136
|
+
tool_call_id: "tool_call_id"
|
|
137
|
+
};
|
|
138
|
+
MessageContentsAttributePostfixes = {
|
|
139
|
+
type: "type",
|
|
140
|
+
text: "text",
|
|
141
|
+
image: "image"
|
|
142
|
+
};
|
|
143
|
+
ImageAttributesPostfixes = {
|
|
144
|
+
url: "url"
|
|
145
|
+
};
|
|
146
|
+
ToolCallAttributePostfixes = {
|
|
147
|
+
function_name: "function.name",
|
|
148
|
+
function_arguments_json: "function.arguments",
|
|
149
|
+
id: "id"
|
|
150
|
+
};
|
|
151
|
+
DocumentAttributePostfixes = {
|
|
152
|
+
id: "id",
|
|
153
|
+
content: "content",
|
|
154
|
+
score: "score",
|
|
155
|
+
metadata: "metadata"
|
|
156
|
+
};
|
|
157
|
+
TagAttributePostfixes = {
|
|
158
|
+
tags: "tags"
|
|
159
|
+
};
|
|
160
|
+
SessionAttributePostfixes = {
|
|
161
|
+
id: "id"
|
|
162
|
+
};
|
|
163
|
+
UserAttributePostfixes = {
|
|
164
|
+
id: "id"
|
|
165
|
+
};
|
|
166
|
+
AudioAttributesPostfixes = {
|
|
167
|
+
url: "url",
|
|
168
|
+
mime_type: "mime_type",
|
|
169
|
+
transcript: "transcript"
|
|
170
|
+
};
|
|
171
|
+
PromptAttributePostfixes = {
|
|
172
|
+
vendor: "vendor",
|
|
173
|
+
id: "id",
|
|
174
|
+
url: "url"
|
|
175
|
+
};
|
|
176
|
+
AgentPostfixes = {
|
|
177
|
+
name: "name"
|
|
178
|
+
};
|
|
179
|
+
GraphPostfixes = {
|
|
180
|
+
node_id: "node.id",
|
|
181
|
+
node_name: "node.name",
|
|
182
|
+
node_parent_id: "node.parent_id"
|
|
183
|
+
};
|
|
184
|
+
INPUT_VALUE = `${SemanticAttributePrefixes.input}.value`;
|
|
185
|
+
INPUT_MIME_TYPE = `${SemanticAttributePrefixes.input}.mime_type`;
|
|
186
|
+
OUTPUT_VALUE = `${SemanticAttributePrefixes.output}.value`;
|
|
187
|
+
OUTPUT_MIME_TYPE = `${SemanticAttributePrefixes.output}.mime_type`;
|
|
188
|
+
LLM_INPUT_MESSAGES = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.input_messages}`;
|
|
189
|
+
LLM_PROMPTS = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.prompts}`;
|
|
190
|
+
LLM_INVOCATION_PARAMETERS = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.invocation_parameters}`;
|
|
191
|
+
LLM_OUTPUT_MESSAGES = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.output_messages}`;
|
|
192
|
+
LLM_MODEL_NAME = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.model_name}`;
|
|
193
|
+
LLM_PROVIDER = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.provider}`;
|
|
194
|
+
LLM_SYSTEM = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.system}`;
|
|
195
|
+
LLM_TOKEN_COUNT_COMPLETION = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.completion`;
|
|
196
|
+
LLM_TOKEN_COUNT_COMPLETION_DETAILS_REASONING = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.completion_details.reasoning`;
|
|
197
|
+
LLM_TOKEN_COUNT_COMPLETION_DETAILS_AUDIO = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.completion_details.audio`;
|
|
198
|
+
LLM_TOKEN_COUNT_PROMPT = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.prompt`;
|
|
199
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_WRITE = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.prompt_details.cache_write`;
|
|
200
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_READ = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.prompt_details.cache_read`;
|
|
201
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_INPUT = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.prompt_details.cache_input`;
|
|
202
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS_AUDIO = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.prompt_details.audio`;
|
|
203
|
+
LLM_TOKEN_COUNT_TOTAL = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.total`;
|
|
204
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.prompt_details`;
|
|
205
|
+
LLM_TOKEN_COUNT_COMPLETION_DETAILS = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.token_count}.completion_details`;
|
|
206
|
+
LLM_COST = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}`;
|
|
207
|
+
LLM_COST_PROMPT = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.prompt`;
|
|
208
|
+
LLM_COST_COMPLETION = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.completion`;
|
|
209
|
+
LLM_COST_TOTAL = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.total`;
|
|
210
|
+
LLM_COST_INPUT = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.prompt_details.input`;
|
|
211
|
+
LLM_COST_OUTPUT = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.completion_details.output`;
|
|
212
|
+
LLM_COST_COMPLETION_DETAILS_REASONING = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.completion_details.reasoning`;
|
|
213
|
+
LLM_COST_COMPLETION_DETAILS_AUDIO = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.completion_details.audio`;
|
|
214
|
+
LLM_COST_PROMPT_DETAILS_CACHE_WRITE = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.prompt_details.cache_write`;
|
|
215
|
+
LLM_COST_PROMPT_DETAILS_CACHE_READ = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.prompt_details.cache_read`;
|
|
216
|
+
LLM_COST_PROMPT_DETAILS_CACHE_INPUT = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.prompt_details.cache_input`;
|
|
217
|
+
LLM_COST_PROMPT_DETAILS_AUDIO = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.cost}.prompt_details.audio`;
|
|
218
|
+
MESSAGE_ROLE = `${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.role}`;
|
|
219
|
+
MESSAGE_NAME = `${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.name}`;
|
|
220
|
+
MESSAGE_TOOL_CALLS = `${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.tool_calls}`;
|
|
221
|
+
MESSAGE_TOOL_CALL_ID = `${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.tool_call_id}`;
|
|
222
|
+
TOOL_CALL_FUNCTION_NAME = `${SemanticAttributePrefixes.tool_call}.${ToolCallAttributePostfixes.function_name}`;
|
|
223
|
+
TOOL_CALL_FUNCTION_ARGUMENTS_JSON = `${SemanticAttributePrefixes.tool_call}.${ToolCallAttributePostfixes.function_arguments_json}`;
|
|
224
|
+
TOOL_CALL_ID = `${SemanticAttributePrefixes.tool_call}.${ToolCallAttributePostfixes.id}`;
|
|
225
|
+
MESSAGE_FUNCTION_CALL_NAME = `${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.function_call_name}`;
|
|
226
|
+
MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON = `${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.function_call_arguments_json}`;
|
|
227
|
+
MESSAGE_CONTENT = `${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.content}`;
|
|
228
|
+
MESSAGE_CONTENTS = `${SemanticAttributePrefixes.message}.${MessageAttributePostfixes.contents}`;
|
|
229
|
+
MESSAGE_CONTENT_TYPE = `${SemanticAttributePrefixes.message_content}.${MessageContentsAttributePostfixes.type}`;
|
|
230
|
+
MESSAGE_CONTENT_TEXT = `${SemanticAttributePrefixes.message_content}.${MessageContentsAttributePostfixes.text}`;
|
|
231
|
+
MESSAGE_CONTENT_IMAGE = `${SemanticAttributePrefixes.message_content}.${MessageContentsAttributePostfixes.image}`;
|
|
232
|
+
IMAGE_URL = `${SemanticAttributePrefixes.image}.${ImageAttributesPostfixes.url}`;
|
|
233
|
+
DOCUMENT_ID = `${SemanticAttributePrefixes.document}.${DocumentAttributePostfixes.id}`;
|
|
234
|
+
DOCUMENT_CONTENT = `${SemanticAttributePrefixes.document}.${DocumentAttributePostfixes.content}`;
|
|
235
|
+
DOCUMENT_SCORE = `${SemanticAttributePrefixes.document}.${DocumentAttributePostfixes.score}`;
|
|
236
|
+
DOCUMENT_METADATA = `${SemanticAttributePrefixes.document}.${DocumentAttributePostfixes.metadata}`;
|
|
237
|
+
EMBEDDING_TEXT = `${SemanticAttributePrefixes.embedding}.${EmbeddingAttributePostfixes.text}`;
|
|
238
|
+
EMBEDDING_MODEL_NAME = `${SemanticAttributePrefixes.embedding}.${EmbeddingAttributePostfixes.model_name}`;
|
|
239
|
+
EMBEDDING_VECTOR = `${SemanticAttributePrefixes.embedding}.${EmbeddingAttributePostfixes.vector}`;
|
|
240
|
+
EMBEDDING_EMBEDDINGS = `${SemanticAttributePrefixes.embedding}.${EmbeddingAttributePostfixes.embeddings}`;
|
|
241
|
+
RETRIEVAL_DOCUMENTS = `${SemanticAttributePrefixes.retrieval}.${RetrievalAttributePostfixes.documents}`;
|
|
242
|
+
PROMPT_TEMPLATE_PREFIX = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.prompt_template}`;
|
|
243
|
+
PROMPT_TEMPLATE_VARIABLES = `${PROMPT_TEMPLATE_PREFIX}.variables`;
|
|
244
|
+
PROMPT_TEMPLATE_TEMPLATE = `${PROMPT_TEMPLATE_PREFIX}.template`;
|
|
245
|
+
LLM_FUNCTION_CALL = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.function_call}`;
|
|
246
|
+
LLM_TOOLS = `${SemanticAttributePrefixes.llm}.${LLMAttributePostfixes.tools}`;
|
|
247
|
+
TOOL_NAME = `${SemanticAttributePrefixes.tool}.${ToolAttributePostfixes.name}`;
|
|
248
|
+
TOOL_DESCRIPTION = `${SemanticAttributePrefixes.tool}.${ToolAttributePostfixes.description}`;
|
|
249
|
+
TOOL_PARAMETERS = `${SemanticAttributePrefixes.tool}.${ToolAttributePostfixes.parameters}`;
|
|
250
|
+
TOOL_JSON_SCHEMA = `${SemanticAttributePrefixes.tool}.${ToolAttributePostfixes.json_schema}`;
|
|
251
|
+
SESSION_ID = `${SemanticAttributePrefixes.session}.${SessionAttributePostfixes.id}`;
|
|
252
|
+
USER_ID = `${SemanticAttributePrefixes.user}.${UserAttributePostfixes.id}`;
|
|
253
|
+
RERANKER_INPUT_DOCUMENTS = `${SemanticAttributePrefixes.reranker}.${RerankerAttributePostfixes.input_documents}`;
|
|
254
|
+
RERANKER_OUTPUT_DOCUMENTS = `${SemanticAttributePrefixes.reranker}.${RerankerAttributePostfixes.output_documents}`;
|
|
255
|
+
RERANKER_QUERY = `${SemanticAttributePrefixes.reranker}.${RerankerAttributePostfixes.query}`;
|
|
256
|
+
RERANKER_MODEL_NAME = `${SemanticAttributePrefixes.reranker}.${RerankerAttributePostfixes.model_name}`;
|
|
257
|
+
RERANKER_TOP_K = `${SemanticAttributePrefixes.reranker}.${RerankerAttributePostfixes.top_k}`;
|
|
258
|
+
METADATA = "metadata";
|
|
259
|
+
PROMPT_TEMPLATE_VERSION = `${PROMPT_TEMPLATE_PREFIX}.version`;
|
|
260
|
+
TAG_TAGS = `${SemanticAttributePrefixes.tag}.${TagAttributePostfixes.tags}`;
|
|
261
|
+
AUDIO_URL = `${SemanticAttributePrefixes.audio}.${AudioAttributesPostfixes.url}`;
|
|
262
|
+
AUDIO_MIME_TYPE = `${SemanticAttributePrefixes.audio}.${AudioAttributesPostfixes.mime_type}`;
|
|
263
|
+
AUDIO_TRANSCRIPT = `${SemanticAttributePrefixes.audio}.${AudioAttributesPostfixes.transcript}`;
|
|
264
|
+
PROMPT_VENDOR = `${SemanticAttributePrefixes.prompt}.${PromptAttributePostfixes.vendor}`;
|
|
265
|
+
PROMPT_ID = `${SemanticAttributePrefixes.prompt}.${PromptAttributePostfixes.id}`;
|
|
266
|
+
PROMPT_URL = `${SemanticAttributePrefixes.prompt}.${PromptAttributePostfixes.url}`;
|
|
267
|
+
AGENT_NAME = `${SemanticAttributePrefixes.agent}.${AgentPostfixes.name}`;
|
|
268
|
+
GRAPH_NODE_ID = `${SemanticAttributePrefixes.graph}.${GraphPostfixes.node_id}`;
|
|
269
|
+
GRAPH_NODE_NAME = `${SemanticAttributePrefixes.graph}.${GraphPostfixes.node_name}`;
|
|
270
|
+
GRAPH_NODE_PARENT_ID = `${SemanticAttributePrefixes.graph}.${GraphPostfixes.node_parent_id}`;
|
|
271
|
+
SemanticConventions = {
|
|
272
|
+
IMAGE_URL,
|
|
273
|
+
INPUT_VALUE,
|
|
274
|
+
INPUT_MIME_TYPE,
|
|
275
|
+
OUTPUT_VALUE,
|
|
276
|
+
OUTPUT_MIME_TYPE,
|
|
277
|
+
LLM_INPUT_MESSAGES,
|
|
278
|
+
LLM_OUTPUT_MESSAGES,
|
|
279
|
+
LLM_MODEL_NAME,
|
|
280
|
+
LLM_PROMPTS,
|
|
281
|
+
LLM_INVOCATION_PARAMETERS,
|
|
282
|
+
LLM_TOKEN_COUNT_COMPLETION,
|
|
283
|
+
LLM_TOKEN_COUNT_COMPLETION_DETAILS,
|
|
284
|
+
LLM_TOKEN_COUNT_COMPLETION_DETAILS_REASONING,
|
|
285
|
+
LLM_TOKEN_COUNT_COMPLETION_DETAILS_AUDIO,
|
|
286
|
+
LLM_TOKEN_COUNT_PROMPT,
|
|
287
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS,
|
|
288
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_WRITE,
|
|
289
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_READ,
|
|
290
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS_CACHE_INPUT,
|
|
291
|
+
LLM_TOKEN_COUNT_PROMPT_DETAILS_AUDIO,
|
|
292
|
+
LLM_TOKEN_COUNT_TOTAL,
|
|
293
|
+
LLM_SYSTEM,
|
|
294
|
+
LLM_PROVIDER,
|
|
295
|
+
LLM_TOOLS,
|
|
296
|
+
LLM_COST,
|
|
297
|
+
LLM_COST_PROMPT,
|
|
298
|
+
LLM_COST_COMPLETION,
|
|
299
|
+
LLM_COST_TOTAL,
|
|
300
|
+
LLM_COST_INPUT,
|
|
301
|
+
LLM_COST_OUTPUT,
|
|
302
|
+
LLM_COST_COMPLETION_DETAILS_REASONING,
|
|
303
|
+
LLM_COST_COMPLETION_DETAILS_AUDIO,
|
|
304
|
+
LLM_COST_PROMPT_DETAILS_CACHE_WRITE,
|
|
305
|
+
LLM_COST_PROMPT_DETAILS_CACHE_READ,
|
|
306
|
+
LLM_COST_PROMPT_DETAILS_CACHE_INPUT,
|
|
307
|
+
LLM_COST_PROMPT_DETAILS_AUDIO,
|
|
308
|
+
MESSAGE_ROLE,
|
|
309
|
+
MESSAGE_NAME,
|
|
310
|
+
MESSAGE_TOOL_CALLS,
|
|
311
|
+
MESSAGE_TOOL_CALL_ID,
|
|
312
|
+
TOOL_CALL_ID,
|
|
313
|
+
TOOL_CALL_FUNCTION_NAME,
|
|
314
|
+
TOOL_CALL_FUNCTION_ARGUMENTS_JSON,
|
|
315
|
+
MESSAGE_FUNCTION_CALL_NAME,
|
|
316
|
+
MESSAGE_FUNCTION_CALL_ARGUMENTS_JSON,
|
|
317
|
+
MESSAGE_CONTENT,
|
|
318
|
+
MESSAGE_CONTENTS,
|
|
319
|
+
MESSAGE_CONTENT_IMAGE,
|
|
320
|
+
MESSAGE_CONTENT_TEXT,
|
|
321
|
+
MESSAGE_CONTENT_TYPE,
|
|
322
|
+
DOCUMENT_ID,
|
|
323
|
+
DOCUMENT_CONTENT,
|
|
324
|
+
DOCUMENT_SCORE,
|
|
325
|
+
DOCUMENT_METADATA,
|
|
326
|
+
EMBEDDING_EMBEDDINGS,
|
|
327
|
+
EMBEDDING_TEXT,
|
|
328
|
+
EMBEDDING_MODEL_NAME,
|
|
329
|
+
EMBEDDING_VECTOR,
|
|
330
|
+
TOOL_DESCRIPTION,
|
|
331
|
+
TOOL_NAME,
|
|
332
|
+
TOOL_PARAMETERS,
|
|
333
|
+
TOOL_JSON_SCHEMA,
|
|
334
|
+
PROMPT_TEMPLATE_VARIABLES,
|
|
335
|
+
PROMPT_TEMPLATE_TEMPLATE,
|
|
336
|
+
PROMPT_TEMPLATE_VERSION,
|
|
337
|
+
RERANKER_INPUT_DOCUMENTS,
|
|
338
|
+
RERANKER_OUTPUT_DOCUMENTS,
|
|
339
|
+
RERANKER_QUERY,
|
|
340
|
+
RERANKER_MODEL_NAME,
|
|
341
|
+
RERANKER_TOP_K,
|
|
342
|
+
LLM_FUNCTION_CALL,
|
|
343
|
+
RETRIEVAL_DOCUMENTS,
|
|
344
|
+
SESSION_ID,
|
|
345
|
+
USER_ID,
|
|
346
|
+
METADATA,
|
|
347
|
+
TAG_TAGS,
|
|
348
|
+
OPENINFERENCE_SPAN_KIND: `${SemanticAttributePrefixes.openinference}.span.kind`,
|
|
349
|
+
PROMPT_VENDOR,
|
|
350
|
+
PROMPT_ID,
|
|
351
|
+
PROMPT_URL,
|
|
352
|
+
AGENT_NAME,
|
|
353
|
+
GRAPH_NODE_ID,
|
|
354
|
+
GRAPH_NODE_NAME,
|
|
355
|
+
GRAPH_NODE_PARENT_ID
|
|
356
|
+
};
|
|
357
|
+
(function(OpenInferenceSpanKind2) {
|
|
358
|
+
OpenInferenceSpanKind2["LLM"] = "LLM";
|
|
359
|
+
OpenInferenceSpanKind2["CHAIN"] = "CHAIN";
|
|
360
|
+
OpenInferenceSpanKind2["TOOL"] = "TOOL";
|
|
361
|
+
OpenInferenceSpanKind2["RETRIEVER"] = "RETRIEVER";
|
|
362
|
+
OpenInferenceSpanKind2["RERANKER"] = "RERANKER";
|
|
363
|
+
OpenInferenceSpanKind2["EMBEDDING"] = "EMBEDDING";
|
|
364
|
+
OpenInferenceSpanKind2["AGENT"] = "AGENT";
|
|
365
|
+
OpenInferenceSpanKind2["GUARDRAIL"] = "GUARDRAIL";
|
|
366
|
+
OpenInferenceSpanKind2["EVALUATOR"] = "EVALUATOR";
|
|
367
|
+
})(OpenInferenceSpanKind || (OpenInferenceSpanKind = {}));
|
|
368
|
+
(function(MimeType2) {
|
|
369
|
+
MimeType2["TEXT"] = "text/plain";
|
|
370
|
+
MimeType2["JSON"] = "application/json";
|
|
371
|
+
MimeType2["AUDIO_WAV"] = "audio/wav";
|
|
372
|
+
})(MimeType || (MimeType = {}));
|
|
373
|
+
(function(LLMSystem2) {
|
|
374
|
+
LLMSystem2["OPENAI"] = "openai";
|
|
375
|
+
LLMSystem2["ANTHROPIC"] = "anthropic";
|
|
376
|
+
LLMSystem2["MISTRALAI"] = "mistralai";
|
|
377
|
+
LLMSystem2["COHERE"] = "cohere";
|
|
378
|
+
LLMSystem2["VERTEXAI"] = "vertexai";
|
|
379
|
+
LLMSystem2["AI21"] = "ai21";
|
|
380
|
+
LLMSystem2["META"] = "meta";
|
|
381
|
+
LLMSystem2["AMAZON"] = "amazon";
|
|
382
|
+
})(LLMSystem || (LLMSystem = {}));
|
|
383
|
+
(function(LLMProvider2) {
|
|
384
|
+
LLMProvider2["OPENAI"] = "openai";
|
|
385
|
+
LLMProvider2["ANTHROPIC"] = "anthropic";
|
|
386
|
+
LLMProvider2["MISTRALAI"] = "mistralai";
|
|
387
|
+
LLMProvider2["COHERE"] = "cohere";
|
|
388
|
+
LLMProvider2["GOOGLE"] = "google";
|
|
389
|
+
LLMProvider2["AWS"] = "aws";
|
|
390
|
+
LLMProvider2["AZURE"] = "azure";
|
|
391
|
+
LLMProvider2["XAI"] = "xai";
|
|
392
|
+
LLMProvider2["DEEPSEEK"] = "deepseek";
|
|
393
|
+
})(LLMProvider || (LLMProvider = {}));
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
// ../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/trace/index.js
|
|
398
|
+
var init_trace = __esm({
|
|
399
|
+
"../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/trace/index.js"() {
|
|
400
|
+
"use strict";
|
|
401
|
+
init_SemanticConventions();
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
// ../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/resource/SemanticResourceAttributes.js
|
|
406
|
+
var init_SemanticResourceAttributes = __esm({
|
|
407
|
+
"../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/resource/SemanticResourceAttributes.js"() {
|
|
408
|
+
"use strict";
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// ../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/resource/index.js
|
|
413
|
+
var init_resource = __esm({
|
|
414
|
+
"../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/resource/index.js"() {
|
|
415
|
+
"use strict";
|
|
416
|
+
init_SemanticResourceAttributes();
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
// ../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/index.js
|
|
421
|
+
var init_esm = __esm({
|
|
422
|
+
"../../../node_modules/.pnpm/@arizeai+openinference-semantic-conventions@2.1.7/node_modules/@arizeai/openinference-semantic-conventions/dist/esm/index.js"() {
|
|
423
|
+
"use strict";
|
|
424
|
+
init_trace();
|
|
425
|
+
init_resource();
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
|
|
430
|
+
var _globalThis;
|
|
431
|
+
var init_globalThis = __esm({
|
|
432
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js"() {
|
|
433
|
+
"use strict";
|
|
434
|
+
_globalThis = typeof globalThis === "object" ? globalThis : global;
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/node/index.js
|
|
439
|
+
var init_node = __esm({
|
|
440
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/node/index.js"() {
|
|
441
|
+
"use strict";
|
|
442
|
+
init_globalThis();
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/index.js
|
|
447
|
+
var init_platform = __esm({
|
|
448
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/index.js"() {
|
|
449
|
+
"use strict";
|
|
450
|
+
init_node();
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/version.js
|
|
455
|
+
var VERSION;
|
|
456
|
+
var init_version = __esm({
|
|
457
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/version.js"() {
|
|
458
|
+
"use strict";
|
|
459
|
+
VERSION = "1.9.0";
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
464
|
+
function _makeCompatibilityCheck(ownVersion) {
|
|
465
|
+
var acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);
|
|
466
|
+
var rejectedVersions = /* @__PURE__ */ new Set();
|
|
467
|
+
var myVersionMatch = ownVersion.match(re);
|
|
468
|
+
if (!myVersionMatch) {
|
|
469
|
+
return function() {
|
|
470
|
+
return false;
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
var ownVersionParsed = {
|
|
474
|
+
major: +myVersionMatch[1],
|
|
475
|
+
minor: +myVersionMatch[2],
|
|
476
|
+
patch: +myVersionMatch[3],
|
|
477
|
+
prerelease: myVersionMatch[4]
|
|
478
|
+
};
|
|
479
|
+
if (ownVersionParsed.prerelease != null) {
|
|
480
|
+
return function isExactmatch(globalVersion) {
|
|
481
|
+
return globalVersion === ownVersion;
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
function _reject(v) {
|
|
485
|
+
rejectedVersions.add(v);
|
|
486
|
+
return false;
|
|
487
|
+
}
|
|
488
|
+
function _accept(v) {
|
|
489
|
+
acceptedVersions.add(v);
|
|
490
|
+
return true;
|
|
491
|
+
}
|
|
492
|
+
return function isCompatible2(globalVersion) {
|
|
493
|
+
if (acceptedVersions.has(globalVersion)) {
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
if (rejectedVersions.has(globalVersion)) {
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
var globalVersionMatch = globalVersion.match(re);
|
|
500
|
+
if (!globalVersionMatch) {
|
|
501
|
+
return _reject(globalVersion);
|
|
502
|
+
}
|
|
503
|
+
var globalVersionParsed = {
|
|
504
|
+
major: +globalVersionMatch[1],
|
|
505
|
+
minor: +globalVersionMatch[2],
|
|
506
|
+
patch: +globalVersionMatch[3],
|
|
507
|
+
prerelease: globalVersionMatch[4]
|
|
508
|
+
};
|
|
509
|
+
if (globalVersionParsed.prerelease != null) {
|
|
510
|
+
return _reject(globalVersion);
|
|
511
|
+
}
|
|
512
|
+
if (ownVersionParsed.major !== globalVersionParsed.major) {
|
|
513
|
+
return _reject(globalVersion);
|
|
514
|
+
}
|
|
515
|
+
if (ownVersionParsed.major === 0) {
|
|
516
|
+
if (ownVersionParsed.minor === globalVersionParsed.minor && ownVersionParsed.patch <= globalVersionParsed.patch) {
|
|
517
|
+
return _accept(globalVersion);
|
|
518
|
+
}
|
|
519
|
+
return _reject(globalVersion);
|
|
520
|
+
}
|
|
521
|
+
if (ownVersionParsed.minor <= globalVersionParsed.minor) {
|
|
522
|
+
return _accept(globalVersion);
|
|
523
|
+
}
|
|
524
|
+
return _reject(globalVersion);
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
var re, isCompatible;
|
|
528
|
+
var init_semver = __esm({
|
|
529
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/internal/semver.js"() {
|
|
530
|
+
"use strict";
|
|
531
|
+
init_version();
|
|
532
|
+
re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
533
|
+
isCompatible = _makeCompatibilityCheck(VERSION);
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
538
|
+
function registerGlobal(type, instance, diag, allowOverride) {
|
|
539
|
+
var _a;
|
|
540
|
+
if (allowOverride === void 0) {
|
|
541
|
+
allowOverride = false;
|
|
542
|
+
}
|
|
543
|
+
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
|
|
544
|
+
version: VERSION
|
|
545
|
+
};
|
|
546
|
+
if (!allowOverride && api[type]) {
|
|
547
|
+
var err = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + type);
|
|
548
|
+
diag.error(err.stack || err.message);
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
if (api.version !== VERSION) {
|
|
552
|
+
var err = new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type + " does not match previously registered API v" + VERSION);
|
|
553
|
+
diag.error(err.stack || err.message);
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
556
|
+
api[type] = instance;
|
|
557
|
+
diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + VERSION + ".");
|
|
558
|
+
return true;
|
|
559
|
+
}
|
|
560
|
+
function getGlobal(type) {
|
|
561
|
+
var _a, _b;
|
|
562
|
+
var globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
|
|
563
|
+
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
|
|
567
|
+
}
|
|
568
|
+
function unregisterGlobal(type, diag) {
|
|
569
|
+
diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION + ".");
|
|
570
|
+
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
571
|
+
if (api) {
|
|
572
|
+
delete api[type];
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
var major, GLOBAL_OPENTELEMETRY_API_KEY, _global;
|
|
576
|
+
var init_global_utils = __esm({
|
|
577
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js"() {
|
|
578
|
+
"use strict";
|
|
579
|
+
init_platform();
|
|
580
|
+
init_version();
|
|
581
|
+
init_semver();
|
|
582
|
+
major = VERSION.split(".")[0];
|
|
583
|
+
GLOBAL_OPENTELEMETRY_API_KEY = /* @__PURE__ */ Symbol.for("opentelemetry.js.api." + major);
|
|
584
|
+
_global = _globalThis;
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
|
|
589
|
+
function logProxy(funcName, namespace, args) {
|
|
590
|
+
var logger = getGlobal("diag");
|
|
591
|
+
if (!logger) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
args.unshift(namespace);
|
|
595
|
+
return logger[funcName].apply(logger, __spreadArray([], __read(args), false));
|
|
596
|
+
}
|
|
597
|
+
var __read, __spreadArray, DiagComponentLogger;
|
|
598
|
+
var init_ComponentLogger = __esm({
|
|
599
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js"() {
|
|
600
|
+
"use strict";
|
|
601
|
+
init_global_utils();
|
|
602
|
+
__read = function(o, n) {
|
|
603
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
604
|
+
if (!m) return o;
|
|
605
|
+
var i = m.call(o), r, ar = [], e;
|
|
606
|
+
try {
|
|
607
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
608
|
+
} catch (error) {
|
|
609
|
+
e = { error };
|
|
610
|
+
} finally {
|
|
611
|
+
try {
|
|
612
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
613
|
+
} finally {
|
|
614
|
+
if (e) throw e.error;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return ar;
|
|
618
|
+
};
|
|
619
|
+
__spreadArray = function(to, from, pack) {
|
|
620
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
621
|
+
if (ar || !(i in from)) {
|
|
622
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
623
|
+
ar[i] = from[i];
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
627
|
+
};
|
|
628
|
+
DiagComponentLogger = /** @class */
|
|
629
|
+
(function() {
|
|
630
|
+
function DiagComponentLogger2(props) {
|
|
631
|
+
this._namespace = props.namespace || "DiagComponentLogger";
|
|
632
|
+
}
|
|
633
|
+
DiagComponentLogger2.prototype.debug = function() {
|
|
634
|
+
var args = [];
|
|
635
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
636
|
+
args[_i] = arguments[_i];
|
|
637
|
+
}
|
|
638
|
+
return logProxy("debug", this._namespace, args);
|
|
639
|
+
};
|
|
640
|
+
DiagComponentLogger2.prototype.error = function() {
|
|
641
|
+
var args = [];
|
|
642
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
643
|
+
args[_i] = arguments[_i];
|
|
644
|
+
}
|
|
645
|
+
return logProxy("error", this._namespace, args);
|
|
646
|
+
};
|
|
647
|
+
DiagComponentLogger2.prototype.info = function() {
|
|
648
|
+
var args = [];
|
|
649
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
650
|
+
args[_i] = arguments[_i];
|
|
651
|
+
}
|
|
652
|
+
return logProxy("info", this._namespace, args);
|
|
653
|
+
};
|
|
654
|
+
DiagComponentLogger2.prototype.warn = function() {
|
|
655
|
+
var args = [];
|
|
656
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
657
|
+
args[_i] = arguments[_i];
|
|
658
|
+
}
|
|
659
|
+
return logProxy("warn", this._namespace, args);
|
|
660
|
+
};
|
|
661
|
+
DiagComponentLogger2.prototype.verbose = function() {
|
|
662
|
+
var args = [];
|
|
663
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
664
|
+
args[_i] = arguments[_i];
|
|
665
|
+
}
|
|
666
|
+
return logProxy("verbose", this._namespace, args);
|
|
667
|
+
};
|
|
668
|
+
return DiagComponentLogger2;
|
|
669
|
+
})();
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/types.js
|
|
674
|
+
var DiagLogLevel;
|
|
675
|
+
var init_types = __esm({
|
|
676
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/types.js"() {
|
|
677
|
+
"use strict";
|
|
678
|
+
(function(DiagLogLevel2) {
|
|
679
|
+
DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
|
|
680
|
+
DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
|
|
681
|
+
DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
|
|
682
|
+
DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
|
|
683
|
+
DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
|
|
684
|
+
DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
|
|
685
|
+
DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
|
|
686
|
+
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
691
|
+
function createLogLevelDiagLogger(maxLevel, logger) {
|
|
692
|
+
if (maxLevel < DiagLogLevel.NONE) {
|
|
693
|
+
maxLevel = DiagLogLevel.NONE;
|
|
694
|
+
} else if (maxLevel > DiagLogLevel.ALL) {
|
|
695
|
+
maxLevel = DiagLogLevel.ALL;
|
|
696
|
+
}
|
|
697
|
+
logger = logger || {};
|
|
698
|
+
function _filterFunc(funcName, theLevel) {
|
|
699
|
+
var theFunc = logger[funcName];
|
|
700
|
+
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
701
|
+
return theFunc.bind(logger);
|
|
702
|
+
}
|
|
703
|
+
return function() {
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
return {
|
|
707
|
+
error: _filterFunc("error", DiagLogLevel.ERROR),
|
|
708
|
+
warn: _filterFunc("warn", DiagLogLevel.WARN),
|
|
709
|
+
info: _filterFunc("info", DiagLogLevel.INFO),
|
|
710
|
+
debug: _filterFunc("debug", DiagLogLevel.DEBUG),
|
|
711
|
+
verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
var init_logLevelLogger = __esm({
|
|
715
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"() {
|
|
716
|
+
"use strict";
|
|
717
|
+
init_types();
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
|
|
721
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/diag.js
|
|
722
|
+
var __read2, __spreadArray2, API_NAME, DiagAPI;
|
|
723
|
+
var init_diag = __esm({
|
|
724
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/diag.js"() {
|
|
725
|
+
"use strict";
|
|
726
|
+
init_ComponentLogger();
|
|
727
|
+
init_logLevelLogger();
|
|
728
|
+
init_types();
|
|
729
|
+
init_global_utils();
|
|
730
|
+
__read2 = function(o, n) {
|
|
731
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
732
|
+
if (!m) return o;
|
|
733
|
+
var i = m.call(o), r, ar = [], e;
|
|
734
|
+
try {
|
|
735
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
736
|
+
} catch (error) {
|
|
737
|
+
e = { error };
|
|
738
|
+
} finally {
|
|
739
|
+
try {
|
|
740
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
741
|
+
} finally {
|
|
742
|
+
if (e) throw e.error;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return ar;
|
|
746
|
+
};
|
|
747
|
+
__spreadArray2 = function(to, from, pack) {
|
|
748
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
749
|
+
if (ar || !(i in from)) {
|
|
750
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
751
|
+
ar[i] = from[i];
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
755
|
+
};
|
|
756
|
+
API_NAME = "diag";
|
|
757
|
+
DiagAPI = /** @class */
|
|
758
|
+
(function() {
|
|
759
|
+
function DiagAPI2() {
|
|
760
|
+
function _logProxy(funcName) {
|
|
761
|
+
return function() {
|
|
762
|
+
var args = [];
|
|
763
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
764
|
+
args[_i] = arguments[_i];
|
|
765
|
+
}
|
|
766
|
+
var logger = getGlobal("diag");
|
|
767
|
+
if (!logger)
|
|
768
|
+
return;
|
|
769
|
+
return logger[funcName].apply(logger, __spreadArray2([], __read2(args), false));
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
var self = this;
|
|
773
|
+
var setLogger = function(logger, optionsOrLogLevel) {
|
|
774
|
+
var _a, _b, _c;
|
|
775
|
+
if (optionsOrLogLevel === void 0) {
|
|
776
|
+
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
777
|
+
}
|
|
778
|
+
if (logger === self) {
|
|
779
|
+
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
780
|
+
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
781
|
+
return false;
|
|
782
|
+
}
|
|
783
|
+
if (typeof optionsOrLogLevel === "number") {
|
|
784
|
+
optionsOrLogLevel = {
|
|
785
|
+
logLevel: optionsOrLogLevel
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
var oldLogger = getGlobal("diag");
|
|
789
|
+
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
|
|
790
|
+
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
791
|
+
var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
792
|
+
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
793
|
+
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
794
|
+
}
|
|
795
|
+
return registerGlobal("diag", newLogger, self, true);
|
|
796
|
+
};
|
|
797
|
+
self.setLogger = setLogger;
|
|
798
|
+
self.disable = function() {
|
|
799
|
+
unregisterGlobal(API_NAME, self);
|
|
800
|
+
};
|
|
801
|
+
self.createComponentLogger = function(options) {
|
|
802
|
+
return new DiagComponentLogger(options);
|
|
803
|
+
};
|
|
804
|
+
self.verbose = _logProxy("verbose");
|
|
805
|
+
self.debug = _logProxy("debug");
|
|
806
|
+
self.info = _logProxy("info");
|
|
807
|
+
self.warn = _logProxy("warn");
|
|
808
|
+
self.error = _logProxy("error");
|
|
809
|
+
}
|
|
810
|
+
DiagAPI2.instance = function() {
|
|
811
|
+
if (!this._instance) {
|
|
812
|
+
this._instance = new DiagAPI2();
|
|
813
|
+
}
|
|
814
|
+
return this._instance;
|
|
815
|
+
};
|
|
816
|
+
return DiagAPI2;
|
|
817
|
+
})();
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context/context.js
|
|
822
|
+
function createContextKey(description) {
|
|
823
|
+
return Symbol.for(description);
|
|
824
|
+
}
|
|
825
|
+
var BaseContext, ROOT_CONTEXT;
|
|
826
|
+
var init_context = __esm({
|
|
827
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context/context.js"() {
|
|
828
|
+
"use strict";
|
|
829
|
+
BaseContext = /** @class */
|
|
830
|
+
/* @__PURE__ */ (function() {
|
|
831
|
+
function BaseContext2(parentContext) {
|
|
832
|
+
var self = this;
|
|
833
|
+
self._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
|
|
834
|
+
self.getValue = function(key) {
|
|
835
|
+
return self._currentContext.get(key);
|
|
836
|
+
};
|
|
837
|
+
self.setValue = function(key, value) {
|
|
838
|
+
var context2 = new BaseContext2(self._currentContext);
|
|
839
|
+
context2._currentContext.set(key, value);
|
|
840
|
+
return context2;
|
|
841
|
+
};
|
|
842
|
+
self.deleteValue = function(key) {
|
|
843
|
+
var context2 = new BaseContext2(self._currentContext);
|
|
844
|
+
context2._currentContext.delete(key);
|
|
845
|
+
return context2;
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
return BaseContext2;
|
|
849
|
+
})();
|
|
850
|
+
ROOT_CONTEXT = new BaseContext();
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
|
|
854
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
|
|
855
|
+
var __read3, __spreadArray3, NoopContextManager;
|
|
856
|
+
var init_NoopContextManager = __esm({
|
|
857
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js"() {
|
|
858
|
+
"use strict";
|
|
859
|
+
init_context();
|
|
860
|
+
__read3 = function(o, n) {
|
|
861
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
862
|
+
if (!m) return o;
|
|
863
|
+
var i = m.call(o), r, ar = [], e;
|
|
864
|
+
try {
|
|
865
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
866
|
+
} catch (error) {
|
|
867
|
+
e = { error };
|
|
868
|
+
} finally {
|
|
869
|
+
try {
|
|
870
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
871
|
+
} finally {
|
|
872
|
+
if (e) throw e.error;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return ar;
|
|
876
|
+
};
|
|
877
|
+
__spreadArray3 = function(to, from, pack) {
|
|
878
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
879
|
+
if (ar || !(i in from)) {
|
|
880
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
881
|
+
ar[i] = from[i];
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
885
|
+
};
|
|
886
|
+
NoopContextManager = /** @class */
|
|
887
|
+
(function() {
|
|
888
|
+
function NoopContextManager2() {
|
|
889
|
+
}
|
|
890
|
+
NoopContextManager2.prototype.active = function() {
|
|
891
|
+
return ROOT_CONTEXT;
|
|
892
|
+
};
|
|
893
|
+
NoopContextManager2.prototype.with = function(_context, fn, thisArg) {
|
|
894
|
+
var args = [];
|
|
895
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
896
|
+
args[_i - 3] = arguments[_i];
|
|
897
|
+
}
|
|
898
|
+
return fn.call.apply(fn, __spreadArray3([thisArg], __read3(args), false));
|
|
899
|
+
};
|
|
900
|
+
NoopContextManager2.prototype.bind = function(_context, target) {
|
|
901
|
+
return target;
|
|
902
|
+
};
|
|
903
|
+
NoopContextManager2.prototype.enable = function() {
|
|
904
|
+
return this;
|
|
905
|
+
};
|
|
906
|
+
NoopContextManager2.prototype.disable = function() {
|
|
907
|
+
return this;
|
|
908
|
+
};
|
|
909
|
+
return NoopContextManager2;
|
|
910
|
+
})();
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
915
|
+
var __read4, __spreadArray4, API_NAME2, NOOP_CONTEXT_MANAGER, ContextAPI;
|
|
916
|
+
var init_context2 = __esm({
|
|
917
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/context.js"() {
|
|
918
|
+
"use strict";
|
|
919
|
+
init_NoopContextManager();
|
|
920
|
+
init_global_utils();
|
|
921
|
+
init_diag();
|
|
922
|
+
__read4 = function(o, n) {
|
|
923
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
924
|
+
if (!m) return o;
|
|
925
|
+
var i = m.call(o), r, ar = [], e;
|
|
926
|
+
try {
|
|
927
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
928
|
+
} catch (error) {
|
|
929
|
+
e = { error };
|
|
930
|
+
} finally {
|
|
931
|
+
try {
|
|
932
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
933
|
+
} finally {
|
|
934
|
+
if (e) throw e.error;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return ar;
|
|
938
|
+
};
|
|
939
|
+
__spreadArray4 = function(to, from, pack) {
|
|
940
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
941
|
+
if (ar || !(i in from)) {
|
|
942
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
943
|
+
ar[i] = from[i];
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
947
|
+
};
|
|
948
|
+
API_NAME2 = "context";
|
|
949
|
+
NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
950
|
+
ContextAPI = /** @class */
|
|
951
|
+
(function() {
|
|
952
|
+
function ContextAPI2() {
|
|
953
|
+
}
|
|
954
|
+
ContextAPI2.getInstance = function() {
|
|
955
|
+
if (!this._instance) {
|
|
956
|
+
this._instance = new ContextAPI2();
|
|
957
|
+
}
|
|
958
|
+
return this._instance;
|
|
959
|
+
};
|
|
960
|
+
ContextAPI2.prototype.setGlobalContextManager = function(contextManager) {
|
|
961
|
+
return registerGlobal(API_NAME2, contextManager, DiagAPI.instance());
|
|
962
|
+
};
|
|
963
|
+
ContextAPI2.prototype.active = function() {
|
|
964
|
+
return this._getContextManager().active();
|
|
965
|
+
};
|
|
966
|
+
ContextAPI2.prototype.with = function(context2, fn, thisArg) {
|
|
967
|
+
var _a;
|
|
968
|
+
var args = [];
|
|
969
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
970
|
+
args[_i - 3] = arguments[_i];
|
|
971
|
+
}
|
|
972
|
+
return (_a = this._getContextManager()).with.apply(_a, __spreadArray4([context2, fn, thisArg], __read4(args), false));
|
|
973
|
+
};
|
|
974
|
+
ContextAPI2.prototype.bind = function(context2, target) {
|
|
975
|
+
return this._getContextManager().bind(context2, target);
|
|
976
|
+
};
|
|
977
|
+
ContextAPI2.prototype._getContextManager = function() {
|
|
978
|
+
return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
|
|
979
|
+
};
|
|
980
|
+
ContextAPI2.prototype.disable = function() {
|
|
981
|
+
this._getContextManager().disable();
|
|
982
|
+
unregisterGlobal(API_NAME2, DiagAPI.instance());
|
|
983
|
+
};
|
|
984
|
+
return ContextAPI2;
|
|
985
|
+
})();
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
|
|
990
|
+
var TraceFlags;
|
|
991
|
+
var init_trace_flags = __esm({
|
|
992
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js"() {
|
|
993
|
+
"use strict";
|
|
994
|
+
(function(TraceFlags2) {
|
|
995
|
+
TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
|
|
996
|
+
TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
|
|
997
|
+
})(TraceFlags || (TraceFlags = {}));
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
|
|
1002
|
+
var INVALID_SPANID, INVALID_TRACEID, INVALID_SPAN_CONTEXT;
|
|
1003
|
+
var init_invalid_span_constants = __esm({
|
|
1004
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js"() {
|
|
1005
|
+
"use strict";
|
|
1006
|
+
init_trace_flags();
|
|
1007
|
+
INVALID_SPANID = "0000000000000000";
|
|
1008
|
+
INVALID_TRACEID = "00000000000000000000000000000000";
|
|
1009
|
+
INVALID_SPAN_CONTEXT = {
|
|
1010
|
+
traceId: INVALID_TRACEID,
|
|
1011
|
+
spanId: INVALID_SPANID,
|
|
1012
|
+
traceFlags: TraceFlags.NONE
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
|
|
1018
|
+
var NonRecordingSpan;
|
|
1019
|
+
var init_NonRecordingSpan = __esm({
|
|
1020
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js"() {
|
|
1021
|
+
"use strict";
|
|
1022
|
+
init_invalid_span_constants();
|
|
1023
|
+
NonRecordingSpan = /** @class */
|
|
1024
|
+
(function() {
|
|
1025
|
+
function NonRecordingSpan2(_spanContext) {
|
|
1026
|
+
if (_spanContext === void 0) {
|
|
1027
|
+
_spanContext = INVALID_SPAN_CONTEXT;
|
|
1028
|
+
}
|
|
1029
|
+
this._spanContext = _spanContext;
|
|
1030
|
+
}
|
|
1031
|
+
NonRecordingSpan2.prototype.spanContext = function() {
|
|
1032
|
+
return this._spanContext;
|
|
1033
|
+
};
|
|
1034
|
+
NonRecordingSpan2.prototype.setAttribute = function(_key, _value) {
|
|
1035
|
+
return this;
|
|
1036
|
+
};
|
|
1037
|
+
NonRecordingSpan2.prototype.setAttributes = function(_attributes) {
|
|
1038
|
+
return this;
|
|
1039
|
+
};
|
|
1040
|
+
NonRecordingSpan2.prototype.addEvent = function(_name, _attributes) {
|
|
1041
|
+
return this;
|
|
1042
|
+
};
|
|
1043
|
+
NonRecordingSpan2.prototype.addLink = function(_link) {
|
|
1044
|
+
return this;
|
|
1045
|
+
};
|
|
1046
|
+
NonRecordingSpan2.prototype.addLinks = function(_links) {
|
|
1047
|
+
return this;
|
|
1048
|
+
};
|
|
1049
|
+
NonRecordingSpan2.prototype.setStatus = function(_status) {
|
|
1050
|
+
return this;
|
|
1051
|
+
};
|
|
1052
|
+
NonRecordingSpan2.prototype.updateName = function(_name) {
|
|
1053
|
+
return this;
|
|
1054
|
+
};
|
|
1055
|
+
NonRecordingSpan2.prototype.end = function(_endTime) {
|
|
1056
|
+
};
|
|
1057
|
+
NonRecordingSpan2.prototype.isRecording = function() {
|
|
1058
|
+
return false;
|
|
1059
|
+
};
|
|
1060
|
+
NonRecordingSpan2.prototype.recordException = function(_exception, _time) {
|
|
1061
|
+
};
|
|
1062
|
+
return NonRecordingSpan2;
|
|
1063
|
+
})();
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
|
|
1067
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
|
|
1068
|
+
function getSpan(context2) {
|
|
1069
|
+
return context2.getValue(SPAN_KEY) || void 0;
|
|
1070
|
+
}
|
|
1071
|
+
function getActiveSpan() {
|
|
1072
|
+
return getSpan(ContextAPI.getInstance().active());
|
|
1073
|
+
}
|
|
1074
|
+
function setSpan(context2, span) {
|
|
1075
|
+
return context2.setValue(SPAN_KEY, span);
|
|
1076
|
+
}
|
|
1077
|
+
function deleteSpan(context2) {
|
|
1078
|
+
return context2.deleteValue(SPAN_KEY);
|
|
1079
|
+
}
|
|
1080
|
+
function setSpanContext(context2, spanContext) {
|
|
1081
|
+
return setSpan(context2, new NonRecordingSpan(spanContext));
|
|
1082
|
+
}
|
|
1083
|
+
function getSpanContext(context2) {
|
|
1084
|
+
var _a;
|
|
1085
|
+
return (_a = getSpan(context2)) === null || _a === void 0 ? void 0 : _a.spanContext();
|
|
1086
|
+
}
|
|
1087
|
+
var SPAN_KEY;
|
|
1088
|
+
var init_context_utils = __esm({
|
|
1089
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js"() {
|
|
1090
|
+
"use strict";
|
|
1091
|
+
init_context();
|
|
1092
|
+
init_NonRecordingSpan();
|
|
1093
|
+
init_context2();
|
|
1094
|
+
SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
|
|
1098
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
1099
|
+
function isValidTraceId(traceId) {
|
|
1100
|
+
return VALID_TRACEID_REGEX.test(traceId) && traceId !== INVALID_TRACEID;
|
|
1101
|
+
}
|
|
1102
|
+
function isValidSpanId(spanId) {
|
|
1103
|
+
return VALID_SPANID_REGEX.test(spanId) && spanId !== INVALID_SPANID;
|
|
1104
|
+
}
|
|
1105
|
+
function isSpanContextValid(spanContext) {
|
|
1106
|
+
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
1107
|
+
}
|
|
1108
|
+
function wrapSpanContext(spanContext) {
|
|
1109
|
+
return new NonRecordingSpan(spanContext);
|
|
1110
|
+
}
|
|
1111
|
+
var VALID_TRACEID_REGEX, VALID_SPANID_REGEX;
|
|
1112
|
+
var init_spancontext_utils = __esm({
|
|
1113
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js"() {
|
|
1114
|
+
"use strict";
|
|
1115
|
+
init_invalid_span_constants();
|
|
1116
|
+
init_NonRecordingSpan();
|
|
1117
|
+
VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;
|
|
1118
|
+
VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
|
|
1123
|
+
function isSpanContext(spanContext) {
|
|
1124
|
+
return typeof spanContext === "object" && typeof spanContext["spanId"] === "string" && typeof spanContext["traceId"] === "string" && typeof spanContext["traceFlags"] === "number";
|
|
1125
|
+
}
|
|
1126
|
+
var contextApi, NoopTracer;
|
|
1127
|
+
var init_NoopTracer = __esm({
|
|
1128
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js"() {
|
|
1129
|
+
"use strict";
|
|
1130
|
+
init_context2();
|
|
1131
|
+
init_context_utils();
|
|
1132
|
+
init_NonRecordingSpan();
|
|
1133
|
+
init_spancontext_utils();
|
|
1134
|
+
contextApi = ContextAPI.getInstance();
|
|
1135
|
+
NoopTracer = /** @class */
|
|
1136
|
+
(function() {
|
|
1137
|
+
function NoopTracer2() {
|
|
1138
|
+
}
|
|
1139
|
+
NoopTracer2.prototype.startSpan = function(name, options, context2) {
|
|
1140
|
+
if (context2 === void 0) {
|
|
1141
|
+
context2 = contextApi.active();
|
|
1142
|
+
}
|
|
1143
|
+
var root = Boolean(options === null || options === void 0 ? void 0 : options.root);
|
|
1144
|
+
if (root) {
|
|
1145
|
+
return new NonRecordingSpan();
|
|
1146
|
+
}
|
|
1147
|
+
var parentFromContext = context2 && getSpanContext(context2);
|
|
1148
|
+
if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
|
|
1149
|
+
return new NonRecordingSpan(parentFromContext);
|
|
1150
|
+
} else {
|
|
1151
|
+
return new NonRecordingSpan();
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
NoopTracer2.prototype.startActiveSpan = function(name, arg2, arg3, arg4) {
|
|
1155
|
+
var opts;
|
|
1156
|
+
var ctx;
|
|
1157
|
+
var fn;
|
|
1158
|
+
if (arguments.length < 2) {
|
|
1159
|
+
return;
|
|
1160
|
+
} else if (arguments.length === 2) {
|
|
1161
|
+
fn = arg2;
|
|
1162
|
+
} else if (arguments.length === 3) {
|
|
1163
|
+
opts = arg2;
|
|
1164
|
+
fn = arg3;
|
|
1165
|
+
} else {
|
|
1166
|
+
opts = arg2;
|
|
1167
|
+
ctx = arg3;
|
|
1168
|
+
fn = arg4;
|
|
1169
|
+
}
|
|
1170
|
+
var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
1171
|
+
var span = this.startSpan(name, opts, parentContext);
|
|
1172
|
+
var contextWithSpanSet = setSpan(parentContext, span);
|
|
1173
|
+
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
1174
|
+
};
|
|
1175
|
+
return NoopTracer2;
|
|
1176
|
+
})();
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
|
|
1181
|
+
var NOOP_TRACER, ProxyTracer;
|
|
1182
|
+
var init_ProxyTracer = __esm({
|
|
1183
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js"() {
|
|
1184
|
+
"use strict";
|
|
1185
|
+
init_NoopTracer();
|
|
1186
|
+
NOOP_TRACER = new NoopTracer();
|
|
1187
|
+
ProxyTracer = /** @class */
|
|
1188
|
+
(function() {
|
|
1189
|
+
function ProxyTracer2(_provider, name, version, options) {
|
|
1190
|
+
this._provider = _provider;
|
|
1191
|
+
this.name = name;
|
|
1192
|
+
this.version = version;
|
|
1193
|
+
this.options = options;
|
|
1194
|
+
}
|
|
1195
|
+
ProxyTracer2.prototype.startSpan = function(name, options, context2) {
|
|
1196
|
+
return this._getTracer().startSpan(name, options, context2);
|
|
1197
|
+
};
|
|
1198
|
+
ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
|
|
1199
|
+
var tracer = this._getTracer();
|
|
1200
|
+
return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
|
|
1201
|
+
};
|
|
1202
|
+
ProxyTracer2.prototype._getTracer = function() {
|
|
1203
|
+
if (this._delegate) {
|
|
1204
|
+
return this._delegate;
|
|
1205
|
+
}
|
|
1206
|
+
var tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
1207
|
+
if (!tracer) {
|
|
1208
|
+
return NOOP_TRACER;
|
|
1209
|
+
}
|
|
1210
|
+
this._delegate = tracer;
|
|
1211
|
+
return this._delegate;
|
|
1212
|
+
};
|
|
1213
|
+
return ProxyTracer2;
|
|
1214
|
+
})();
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
|
|
1219
|
+
var NoopTracerProvider;
|
|
1220
|
+
var init_NoopTracerProvider = __esm({
|
|
1221
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js"() {
|
|
1222
|
+
"use strict";
|
|
1223
|
+
init_NoopTracer();
|
|
1224
|
+
NoopTracerProvider = /** @class */
|
|
1225
|
+
(function() {
|
|
1226
|
+
function NoopTracerProvider2() {
|
|
1227
|
+
}
|
|
1228
|
+
NoopTracerProvider2.prototype.getTracer = function(_name, _version, _options) {
|
|
1229
|
+
return new NoopTracer();
|
|
1230
|
+
};
|
|
1231
|
+
return NoopTracerProvider2;
|
|
1232
|
+
})();
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
|
|
1237
|
+
var NOOP_TRACER_PROVIDER, ProxyTracerProvider;
|
|
1238
|
+
var init_ProxyTracerProvider = __esm({
|
|
1239
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js"() {
|
|
1240
|
+
"use strict";
|
|
1241
|
+
init_ProxyTracer();
|
|
1242
|
+
init_NoopTracerProvider();
|
|
1243
|
+
NOOP_TRACER_PROVIDER = new NoopTracerProvider();
|
|
1244
|
+
ProxyTracerProvider = /** @class */
|
|
1245
|
+
(function() {
|
|
1246
|
+
function ProxyTracerProvider2() {
|
|
1247
|
+
}
|
|
1248
|
+
ProxyTracerProvider2.prototype.getTracer = function(name, version, options) {
|
|
1249
|
+
var _a;
|
|
1250
|
+
return (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options);
|
|
1251
|
+
};
|
|
1252
|
+
ProxyTracerProvider2.prototype.getDelegate = function() {
|
|
1253
|
+
var _a;
|
|
1254
|
+
return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;
|
|
1255
|
+
};
|
|
1256
|
+
ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
|
|
1257
|
+
this._delegate = delegate;
|
|
1258
|
+
};
|
|
1259
|
+
ProxyTracerProvider2.prototype.getDelegateTracer = function(name, version, options) {
|
|
1260
|
+
var _a;
|
|
1261
|
+
return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
|
|
1262
|
+
};
|
|
1263
|
+
return ProxyTracerProvider2;
|
|
1264
|
+
})();
|
|
1265
|
+
}
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/status.js
|
|
1269
|
+
var SpanStatusCode;
|
|
1270
|
+
var init_status = __esm({
|
|
1271
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/status.js"() {
|
|
1272
|
+
"use strict";
|
|
1273
|
+
(function(SpanStatusCode2) {
|
|
1274
|
+
SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
|
|
1275
|
+
SpanStatusCode2[SpanStatusCode2["OK"] = 1] = "OK";
|
|
1276
|
+
SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
|
|
1277
|
+
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
|
|
1281
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context-api.js
|
|
1282
|
+
var context;
|
|
1283
|
+
var init_context_api = __esm({
|
|
1284
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/context-api.js"() {
|
|
1285
|
+
"use strict";
|
|
1286
|
+
init_context2();
|
|
1287
|
+
context = ContextAPI.getInstance();
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
|
|
1291
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
1292
|
+
var API_NAME3, TraceAPI;
|
|
1293
|
+
var init_trace2 = __esm({
|
|
1294
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/trace.js"() {
|
|
1295
|
+
"use strict";
|
|
1296
|
+
init_global_utils();
|
|
1297
|
+
init_ProxyTracerProvider();
|
|
1298
|
+
init_spancontext_utils();
|
|
1299
|
+
init_context_utils();
|
|
1300
|
+
init_diag();
|
|
1301
|
+
API_NAME3 = "trace";
|
|
1302
|
+
TraceAPI = /** @class */
|
|
1303
|
+
(function() {
|
|
1304
|
+
function TraceAPI2() {
|
|
1305
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
1306
|
+
this.wrapSpanContext = wrapSpanContext;
|
|
1307
|
+
this.isSpanContextValid = isSpanContextValid;
|
|
1308
|
+
this.deleteSpan = deleteSpan;
|
|
1309
|
+
this.getSpan = getSpan;
|
|
1310
|
+
this.getActiveSpan = getActiveSpan;
|
|
1311
|
+
this.getSpanContext = getSpanContext;
|
|
1312
|
+
this.setSpan = setSpan;
|
|
1313
|
+
this.setSpanContext = setSpanContext;
|
|
1314
|
+
}
|
|
1315
|
+
TraceAPI2.getInstance = function() {
|
|
1316
|
+
if (!this._instance) {
|
|
1317
|
+
this._instance = new TraceAPI2();
|
|
1318
|
+
}
|
|
1319
|
+
return this._instance;
|
|
1320
|
+
};
|
|
1321
|
+
TraceAPI2.prototype.setGlobalTracerProvider = function(provider) {
|
|
1322
|
+
var success = registerGlobal(API_NAME3, this._proxyTracerProvider, DiagAPI.instance());
|
|
1323
|
+
if (success) {
|
|
1324
|
+
this._proxyTracerProvider.setDelegate(provider);
|
|
1325
|
+
}
|
|
1326
|
+
return success;
|
|
1327
|
+
};
|
|
1328
|
+
TraceAPI2.prototype.getTracerProvider = function() {
|
|
1329
|
+
return getGlobal(API_NAME3) || this._proxyTracerProvider;
|
|
1330
|
+
};
|
|
1331
|
+
TraceAPI2.prototype.getTracer = function(name, version) {
|
|
1332
|
+
return this.getTracerProvider().getTracer(name, version);
|
|
1333
|
+
};
|
|
1334
|
+
TraceAPI2.prototype.disable = function() {
|
|
1335
|
+
unregisterGlobal(API_NAME3, DiagAPI.instance());
|
|
1336
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
1337
|
+
};
|
|
1338
|
+
return TraceAPI2;
|
|
1339
|
+
})();
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
|
|
1343
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
1344
|
+
var trace;
|
|
1345
|
+
var init_trace_api = __esm({
|
|
1346
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace-api.js"() {
|
|
1347
|
+
"use strict";
|
|
1348
|
+
init_trace2();
|
|
1349
|
+
trace = TraceAPI.getInstance();
|
|
1350
|
+
}
|
|
1351
|
+
});
|
|
1352
|
+
|
|
1353
|
+
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/index.js
|
|
1354
|
+
var init_esm2 = __esm({
|
|
1355
|
+
"../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/index.js"() {
|
|
1356
|
+
"use strict";
|
|
1357
|
+
init_status();
|
|
1358
|
+
init_context_api();
|
|
1359
|
+
init_trace_api();
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
|
|
1363
|
+
// ../../observability/dist/chunk-ZGEMAYS4.mjs
|
|
1364
|
+
function createTraceAttributes({
|
|
1365
|
+
name,
|
|
1366
|
+
userId,
|
|
1367
|
+
sessionId,
|
|
1368
|
+
version,
|
|
1369
|
+
release,
|
|
1370
|
+
input,
|
|
1371
|
+
output,
|
|
1372
|
+
metadata,
|
|
1373
|
+
tags,
|
|
1374
|
+
environment,
|
|
1375
|
+
public: isPublic
|
|
1376
|
+
} = {}) {
|
|
1377
|
+
const attributes = {
|
|
1378
|
+
[OtelSpanAttributes.TRACE_NAME]: name,
|
|
1379
|
+
// Use OpenInference standard attributes for user and session
|
|
1380
|
+
[OtelSpanAttributes.USER_ID]: userId,
|
|
1381
|
+
[OtelSpanAttributes.SESSION_ID]: sessionId,
|
|
1382
|
+
[OtelSpanAttributes.VERSION]: version,
|
|
1383
|
+
[OtelSpanAttributes.RELEASE]: release,
|
|
1384
|
+
[OtelSpanAttributes.TRACE_INPUT]: _serialize(input),
|
|
1385
|
+
[OtelSpanAttributes.TRACE_OUTPUT]: _serialize(output),
|
|
1386
|
+
[OtelSpanAttributes.TRACE_TAGS]: tags,
|
|
1387
|
+
[OtelSpanAttributes.ENVIRONMENT]: environment,
|
|
1388
|
+
[OtelSpanAttributes.TRACE_PUBLIC]: isPublic,
|
|
1389
|
+
..._flattenAndSerializeMetadata(metadata, OtelSpanAttributes.TRACE_METADATA)
|
|
1390
|
+
};
|
|
1391
|
+
return Object.fromEntries(
|
|
1392
|
+
Object.entries(attributes).filter(([_, v]) => v != null)
|
|
1393
|
+
);
|
|
1394
|
+
}
|
|
1395
|
+
function createObservationAttributes(type, attributes) {
|
|
1396
|
+
const {
|
|
1397
|
+
metadata,
|
|
1398
|
+
input,
|
|
1399
|
+
output,
|
|
1400
|
+
level,
|
|
1401
|
+
statusMessage,
|
|
1402
|
+
version,
|
|
1403
|
+
completionStartTime,
|
|
1404
|
+
model,
|
|
1405
|
+
modelParameters,
|
|
1406
|
+
usageDetails
|
|
1407
|
+
} = attributes;
|
|
1408
|
+
const otelAttributes = {
|
|
1409
|
+
[SemanticConventions.OPENINFERENCE_SPAN_KIND]: type.toUpperCase(),
|
|
1410
|
+
[OtelSpanAttributes.OBSERVATION_TYPE]: type,
|
|
1411
|
+
[OtelSpanAttributes.OBSERVATION_LEVEL]: level,
|
|
1412
|
+
[OtelSpanAttributes.OBSERVATION_STATUS_MESSAGE]: statusMessage,
|
|
1413
|
+
[OtelSpanAttributes.VERSION]: version,
|
|
1414
|
+
// Use OpenInference input.value convention
|
|
1415
|
+
[SemanticConventions.INPUT_VALUE]: _serialize(input),
|
|
1416
|
+
// Also set legacy agkit.observation.input for compatibility
|
|
1417
|
+
[OtelSpanAttributes.OBSERVATION_INPUT]: _serialize(input),
|
|
1418
|
+
// Use OpenInference output.value convention
|
|
1419
|
+
[SemanticConventions.OUTPUT_VALUE]: _serialize(output),
|
|
1420
|
+
// Also set legacy agkit.observation.output for compatibility
|
|
1421
|
+
[OtelSpanAttributes.OBSERVATION_OUTPUT]: _serialize(output)
|
|
1422
|
+
};
|
|
1423
|
+
if (type === "llm") {
|
|
1424
|
+
if (model) {
|
|
1425
|
+
otelAttributes[SemanticConventions.LLM_MODEL_NAME] = model;
|
|
1426
|
+
}
|
|
1427
|
+
if (modelParameters) {
|
|
1428
|
+
otelAttributes[SemanticConventions.LLM_INVOCATION_PARAMETERS] = _serialize(modelParameters);
|
|
1429
|
+
otelAttributes[OtelSpanAttributes.LLM_MODEL_PARAMETERS] = _serialize(modelParameters);
|
|
1430
|
+
}
|
|
1431
|
+
if (usageDetails) {
|
|
1432
|
+
if (typeof usageDetails === "object") {
|
|
1433
|
+
const usage = usageDetails;
|
|
1434
|
+
if (usage.promptTokens !== void 0) {
|
|
1435
|
+
otelAttributes[SemanticConventions.LLM_TOKEN_COUNT_PROMPT] = usage.promptTokens;
|
|
1436
|
+
}
|
|
1437
|
+
if (usage.completionTokens !== void 0) {
|
|
1438
|
+
otelAttributes[SemanticConventions.LLM_TOKEN_COUNT_COMPLETION] = usage.completionTokens;
|
|
1439
|
+
}
|
|
1440
|
+
if (usage.totalTokens !== void 0) {
|
|
1441
|
+
otelAttributes[SemanticConventions.LLM_TOKEN_COUNT_TOTAL] = usage.totalTokens;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
otelAttributes[OtelSpanAttributes.LLM_USAGE_DETAILS] = _serialize(usageDetails);
|
|
1445
|
+
}
|
|
1446
|
+
if (completionStartTime) {
|
|
1447
|
+
otelAttributes[OtelSpanAttributes.LLM_COMPLETION_START_TIME] = _serialize(completionStartTime);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
if (type === "embedding") {
|
|
1451
|
+
if (model) {
|
|
1452
|
+
otelAttributes[SemanticConventions.EMBEDDING_MODEL_NAME] = model;
|
|
1453
|
+
}
|
|
1454
|
+
if (modelParameters) {
|
|
1455
|
+
otelAttributes[SemanticConventions.LLM_INVOCATION_PARAMETERS] = _serialize(modelParameters);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
const metadataAttrs = _flattenAndSerializeMetadata(
|
|
1459
|
+
metadata,
|
|
1460
|
+
SemanticConventions.METADATA
|
|
1461
|
+
);
|
|
1462
|
+
Object.assign(otelAttributes, metadataAttrs);
|
|
1463
|
+
const obsetvabilityMetadataAttrs = _flattenAndSerializeMetadata(
|
|
1464
|
+
metadata,
|
|
1465
|
+
OtelSpanAttributes.OBSERVATION_METADATA
|
|
1466
|
+
);
|
|
1467
|
+
Object.assign(otelAttributes, obsetvabilityMetadataAttrs);
|
|
1468
|
+
return Object.fromEntries(
|
|
1469
|
+
Object.entries(otelAttributes).filter(([_, v]) => v != null)
|
|
1470
|
+
);
|
|
1471
|
+
}
|
|
1472
|
+
function _serialize(obj) {
|
|
1473
|
+
try {
|
|
1474
|
+
if (typeof obj === "string") return obj;
|
|
1475
|
+
if (obj instanceof Date) return obj.toISOString();
|
|
1476
|
+
return obj != null ? JSON.stringify(obj) : void 0;
|
|
1477
|
+
} catch {
|
|
1478
|
+
return "<failed to serialize>";
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
function _flattenAndSerializeMetadata(metadata, prefix) {
|
|
1482
|
+
const metadataAttributes = {};
|
|
1483
|
+
if (metadata === void 0 || metadata === null) {
|
|
1484
|
+
return metadataAttributes;
|
|
1485
|
+
}
|
|
1486
|
+
if (typeof metadata !== "object" || Array.isArray(metadata)) {
|
|
1487
|
+
const serialized = _serialize(metadata);
|
|
1488
|
+
if (serialized) {
|
|
1489
|
+
metadataAttributes[prefix] = serialized;
|
|
1490
|
+
}
|
|
1491
|
+
} else {
|
|
1492
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
1493
|
+
const serialized = typeof value === "string" ? value : _serialize(value);
|
|
1494
|
+
if (serialized) {
|
|
1495
|
+
metadataAttributes[`${prefix}.${key}`] = serialized;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
return metadataAttributes;
|
|
1500
|
+
}
|
|
1501
|
+
function createState() {
|
|
1502
|
+
return {
|
|
1503
|
+
isolatedTracerProvider: null
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
function getObservabilityGlobalState() {
|
|
1507
|
+
const initialState = createState();
|
|
1508
|
+
try {
|
|
1509
|
+
const g = globalThis;
|
|
1510
|
+
if (typeof g !== "object" || g === null) {
|
|
1511
|
+
console.warn(
|
|
1512
|
+
"[Observability] globalThis is not available, using fallback state"
|
|
1513
|
+
);
|
|
1514
|
+
return initialState;
|
|
1515
|
+
}
|
|
1516
|
+
if (!g[OBSERVABILITY_GLOBAL_SYMBOL]) {
|
|
1517
|
+
Object.defineProperty(g, OBSERVABILITY_GLOBAL_SYMBOL, {
|
|
1518
|
+
value: initialState,
|
|
1519
|
+
writable: false,
|
|
1520
|
+
configurable: false,
|
|
1521
|
+
enumerable: false
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1524
|
+
return g[OBSERVABILITY_GLOBAL_SYMBOL];
|
|
1525
|
+
} catch (err) {
|
|
1526
|
+
console.error(
|
|
1527
|
+
`[Observability] Failed to access global state: ${err instanceof Error ? err.message : String(err)}`
|
|
1528
|
+
);
|
|
1529
|
+
return initialState;
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
function setTracerProvider(provider) {
|
|
1533
|
+
getObservabilityGlobalState().isolatedTracerProvider = provider;
|
|
1534
|
+
}
|
|
1535
|
+
function getTracerProvider() {
|
|
1536
|
+
const { isolatedTracerProvider } = getObservabilityGlobalState();
|
|
1537
|
+
if (isolatedTracerProvider) return isolatedTracerProvider;
|
|
1538
|
+
return trace.getTracerProvider();
|
|
1539
|
+
}
|
|
1540
|
+
function getTracer() {
|
|
1541
|
+
return getTracerProvider().getTracer(
|
|
1542
|
+
OBSERVABILITY_SDK_NAME,
|
|
1543
|
+
OBSERVABILITY_SDK_VERSION
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1546
|
+
function createOtelSpan(params) {
|
|
1547
|
+
return getTracer().startSpan(
|
|
1548
|
+
params.name,
|
|
1549
|
+
{ startTime: params.startTime },
|
|
1550
|
+
createParentContext(params.parentSpanContext)
|
|
1551
|
+
);
|
|
1552
|
+
}
|
|
1553
|
+
function createParentContext(parentSpanContext) {
|
|
1554
|
+
if (!parentSpanContext) return;
|
|
1555
|
+
return trace.setSpanContext(context.active(), parentSpanContext);
|
|
1556
|
+
}
|
|
1557
|
+
function startObservation(name, attributes, options) {
|
|
1558
|
+
const { asType = "span", ...observationOptions } = options || {};
|
|
1559
|
+
const otelSpan = createOtelSpan({
|
|
1560
|
+
name,
|
|
1561
|
+
...observationOptions
|
|
1562
|
+
});
|
|
1563
|
+
switch (asType) {
|
|
1564
|
+
case "llm":
|
|
1565
|
+
return new ObservationLLM({
|
|
1566
|
+
otelSpan,
|
|
1567
|
+
attributes
|
|
1568
|
+
});
|
|
1569
|
+
case "embedding":
|
|
1570
|
+
return new ObservationEmbedding({
|
|
1571
|
+
otelSpan,
|
|
1572
|
+
attributes
|
|
1573
|
+
});
|
|
1574
|
+
case "agent":
|
|
1575
|
+
return new ObservationAgent({
|
|
1576
|
+
otelSpan,
|
|
1577
|
+
attributes
|
|
1578
|
+
});
|
|
1579
|
+
case "tool":
|
|
1580
|
+
return new ObservationTool({
|
|
1581
|
+
otelSpan,
|
|
1582
|
+
attributes
|
|
1583
|
+
});
|
|
1584
|
+
case "chain":
|
|
1585
|
+
return new ObservationChain({
|
|
1586
|
+
otelSpan,
|
|
1587
|
+
attributes
|
|
1588
|
+
});
|
|
1589
|
+
case "retriever":
|
|
1590
|
+
return new ObservationRetriever({
|
|
1591
|
+
otelSpan,
|
|
1592
|
+
attributes
|
|
1593
|
+
});
|
|
1594
|
+
case "reranker":
|
|
1595
|
+
return new ObservationReranker({
|
|
1596
|
+
otelSpan,
|
|
1597
|
+
attributes
|
|
1598
|
+
});
|
|
1599
|
+
case "evaluator":
|
|
1600
|
+
return new ObservationEvaluator({
|
|
1601
|
+
otelSpan,
|
|
1602
|
+
attributes
|
|
1603
|
+
});
|
|
1604
|
+
case "guardrail":
|
|
1605
|
+
return new ObservationGuardrail({
|
|
1606
|
+
otelSpan,
|
|
1607
|
+
attributes
|
|
1608
|
+
});
|
|
1609
|
+
case "span":
|
|
1610
|
+
default:
|
|
1611
|
+
return new ObservationSpan({
|
|
1612
|
+
otelSpan,
|
|
1613
|
+
attributes
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
function updateActiveTrace(attributes) {
|
|
1618
|
+
const span = trace.getActiveSpan();
|
|
1619
|
+
if (!span) {
|
|
1620
|
+
console.warn(
|
|
1621
|
+
"[Observability] No active OTEL span in context. Skipping trace update."
|
|
1622
|
+
);
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
span.setAttributes(createTraceAttributes(attributes));
|
|
1626
|
+
}
|
|
1627
|
+
function getActiveTraceId() {
|
|
1628
|
+
return trace.getActiveSpan()?.spanContext().traceId;
|
|
1629
|
+
}
|
|
1630
|
+
function getActiveSpanId() {
|
|
1631
|
+
return trace.getActiveSpan()?.spanContext().spanId;
|
|
1632
|
+
}
|
|
1633
|
+
function wrapPromise(promise, span, endOnExit) {
|
|
1634
|
+
return promise.then(
|
|
1635
|
+
(value) => {
|
|
1636
|
+
if (endOnExit !== false) {
|
|
1637
|
+
span.end();
|
|
1638
|
+
}
|
|
1639
|
+
return value;
|
|
1640
|
+
},
|
|
1641
|
+
(err) => {
|
|
1642
|
+
span.setStatus({
|
|
1643
|
+
code: SpanStatusCode.ERROR,
|
|
1644
|
+
message: err instanceof Error ? err.message : "Unknown error"
|
|
1645
|
+
});
|
|
1646
|
+
if (endOnExit !== false) {
|
|
1647
|
+
span.end();
|
|
1648
|
+
}
|
|
1649
|
+
throw err;
|
|
1650
|
+
}
|
|
1651
|
+
);
|
|
1652
|
+
}
|
|
1653
|
+
function startActiveObservation(name, fn, options) {
|
|
1654
|
+
const { asType = "span", endOnExit, ...observationOptions } = options || {};
|
|
1655
|
+
return getTracer().startActiveSpan(
|
|
1656
|
+
name,
|
|
1657
|
+
{ startTime: observationOptions?.startTime },
|
|
1658
|
+
createParentContext(observationOptions?.parentSpanContext) ?? context.active(),
|
|
1659
|
+
(span) => {
|
|
1660
|
+
try {
|
|
1661
|
+
let observation;
|
|
1662
|
+
switch (asType) {
|
|
1663
|
+
case "llm":
|
|
1664
|
+
observation = new ObservationLLM({ otelSpan: span });
|
|
1665
|
+
break;
|
|
1666
|
+
case "embedding":
|
|
1667
|
+
observation = new ObservationEmbedding({ otelSpan: span });
|
|
1668
|
+
break;
|
|
1669
|
+
case "agent":
|
|
1670
|
+
observation = new ObservationAgent({ otelSpan: span });
|
|
1671
|
+
break;
|
|
1672
|
+
case "tool":
|
|
1673
|
+
observation = new ObservationTool({ otelSpan: span });
|
|
1674
|
+
break;
|
|
1675
|
+
case "chain":
|
|
1676
|
+
observation = new ObservationChain({ otelSpan: span });
|
|
1677
|
+
break;
|
|
1678
|
+
case "retriever":
|
|
1679
|
+
observation = new ObservationRetriever({ otelSpan: span });
|
|
1680
|
+
break;
|
|
1681
|
+
case "reranker":
|
|
1682
|
+
observation = new ObservationReranker({ otelSpan: span });
|
|
1683
|
+
break;
|
|
1684
|
+
case "evaluator":
|
|
1685
|
+
observation = new ObservationEvaluator({ otelSpan: span });
|
|
1686
|
+
break;
|
|
1687
|
+
case "guardrail":
|
|
1688
|
+
observation = new ObservationGuardrail({ otelSpan: span });
|
|
1689
|
+
break;
|
|
1690
|
+
case "span":
|
|
1691
|
+
default:
|
|
1692
|
+
observation = new ObservationSpan({ otelSpan: span });
|
|
1693
|
+
}
|
|
1694
|
+
const result = fn(observation);
|
|
1695
|
+
if (result instanceof Promise) {
|
|
1696
|
+
return wrapPromise(
|
|
1697
|
+
result,
|
|
1698
|
+
span,
|
|
1699
|
+
endOnExit
|
|
1700
|
+
);
|
|
1701
|
+
} else {
|
|
1702
|
+
if (endOnExit !== false) {
|
|
1703
|
+
span.end();
|
|
1704
|
+
}
|
|
1705
|
+
return result;
|
|
1706
|
+
}
|
|
1707
|
+
} catch (err) {
|
|
1708
|
+
span.setStatus({
|
|
1709
|
+
code: SpanStatusCode.ERROR,
|
|
1710
|
+
message: err instanceof Error ? err.message : "Unknown error"
|
|
1711
|
+
});
|
|
1712
|
+
if (endOnExit !== false) {
|
|
1713
|
+
span.end();
|
|
1714
|
+
}
|
|
1715
|
+
throw err;
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
);
|
|
1719
|
+
}
|
|
1720
|
+
function updateActiveObservation(attributes) {
|
|
1721
|
+
const span = trace.getActiveSpan();
|
|
1722
|
+
if (!span) {
|
|
1723
|
+
console.warn(
|
|
1724
|
+
"[Observability] No active OTEL span in context. Skipping observation update."
|
|
1725
|
+
);
|
|
1726
|
+
return;
|
|
1727
|
+
}
|
|
1728
|
+
span.setAttributes(createObservationAttributes("span", attributes));
|
|
1729
|
+
}
|
|
1730
|
+
function _captureArguments(args) {
|
|
1731
|
+
if (args.length === 0) return {};
|
|
1732
|
+
if (args.length === 1) return { arg: args[0] };
|
|
1733
|
+
return { args };
|
|
1734
|
+
}
|
|
1735
|
+
function observe(fn, options = {}) {
|
|
1736
|
+
const {
|
|
1737
|
+
asType = "span",
|
|
1738
|
+
captureInput = true,
|
|
1739
|
+
captureOutput = true,
|
|
1740
|
+
...observationOptions
|
|
1741
|
+
} = options;
|
|
1742
|
+
const wrappedFunction = function(...args) {
|
|
1743
|
+
const name = fn.name || "anonymous-function";
|
|
1744
|
+
const inputData = captureInput ? _captureArguments(args) : void 0;
|
|
1745
|
+
const observation = startObservation(
|
|
1746
|
+
name,
|
|
1747
|
+
inputData ? { input: inputData } : {},
|
|
1748
|
+
{
|
|
1749
|
+
...observationOptions,
|
|
1750
|
+
asType
|
|
1751
|
+
}
|
|
1752
|
+
);
|
|
1753
|
+
const activeContext = trace.setSpan(context.active(), observation.otelSpan);
|
|
1754
|
+
const result = context.with(activeContext, () => fn.apply(this, args));
|
|
1755
|
+
if (result instanceof Promise) {
|
|
1756
|
+
return result.then(
|
|
1757
|
+
(value) => {
|
|
1758
|
+
if (captureOutput) {
|
|
1759
|
+
observation.update({ output: value });
|
|
1760
|
+
}
|
|
1761
|
+
observation.end();
|
|
1762
|
+
return value;
|
|
1763
|
+
},
|
|
1764
|
+
(err) => {
|
|
1765
|
+
observation.update({
|
|
1766
|
+
level: "ERROR",
|
|
1767
|
+
statusMessage: err instanceof Error ? err.message : "Unknown error"
|
|
1768
|
+
});
|
|
1769
|
+
observation.end();
|
|
1770
|
+
throw err;
|
|
1771
|
+
}
|
|
1772
|
+
);
|
|
1773
|
+
}
|
|
1774
|
+
if (captureOutput) {
|
|
1775
|
+
observation.update({ output: result });
|
|
1776
|
+
}
|
|
1777
|
+
observation.end();
|
|
1778
|
+
return result;
|
|
1779
|
+
};
|
|
1780
|
+
Object.defineProperty(wrappedFunction, "name", { value: fn.name });
|
|
1781
|
+
Object.defineProperty(wrappedFunction, "length", { value: fn.length });
|
|
1782
|
+
return wrappedFunction;
|
|
1783
|
+
}
|
|
1784
|
+
var OtelSpanAttributes, init_constants, init_attributes, OBSERVABILITY_GLOBAL_SYMBOL, OBSERVABILITY_SDK_NAME, OBSERVABILITY_SDK_VERSION, init_tracerProvider, BaseObservation, ObservationSpan, ObservationLLM, ObservationEmbedding, ObservationAgent, ObservationTool, ObservationChain, ObservationRetriever, ObservationReranker, ObservationEvaluator, ObservationGuardrail, init_spanWrapper, src_exports, init_src;
|
|
1785
|
+
var init_chunk_ZGEMAYS4 = __esm({
|
|
1786
|
+
"../../observability/dist/chunk-ZGEMAYS4.mjs"() {
|
|
1787
|
+
"use strict";
|
|
1788
|
+
init_chunk_NFEGQTCC();
|
|
1789
|
+
init_esm();
|
|
1790
|
+
init_esm();
|
|
1791
|
+
init_esm2();
|
|
1792
|
+
init_esm2();
|
|
1793
|
+
init_constants = __esm2({
|
|
1794
|
+
"src/core/constants.ts"() {
|
|
1795
|
+
"use strict";
|
|
1796
|
+
OtelSpanAttributes = {
|
|
1797
|
+
// OpenInference - re-export all standard conventions
|
|
1798
|
+
...SemanticConventions,
|
|
1799
|
+
// AG-Kit Trace attributes (non-standard)
|
|
1800
|
+
TRACE_NAME: "trace.name",
|
|
1801
|
+
TRACE_TAGS: "trace.tags",
|
|
1802
|
+
TRACE_PUBLIC: "trace.public",
|
|
1803
|
+
TRACE_METADATA: "trace.metadata",
|
|
1804
|
+
TRACE_INPUT: "trace.input",
|
|
1805
|
+
TRACE_OUTPUT: "trace.output",
|
|
1806
|
+
// AG-Kit Observation attributes (non-standard)
|
|
1807
|
+
OBSERVATION_TYPE: "observation.type",
|
|
1808
|
+
OBSERVATION_LEVEL: "observation.level",
|
|
1809
|
+
OBSERVATION_STATUS_MESSAGE: "observation.status_message",
|
|
1810
|
+
OBSERVATION_INPUT: "observation.input",
|
|
1811
|
+
OBSERVATION_OUTPUT: "observation.output",
|
|
1812
|
+
OBSERVATION_METADATA: "observation.metadata",
|
|
1813
|
+
// AG-Kit LLM-specific (non-standard)
|
|
1814
|
+
LLM_COMPLETION_START_TIME: "llm.completion_start_time",
|
|
1815
|
+
LLM_MODEL_PARAMETERS: "llm.model_parameters",
|
|
1816
|
+
LLM_USAGE_DETAILS: "llm.usage_details",
|
|
1817
|
+
LLM_COST_DETAILS: "llm.cost_details",
|
|
1818
|
+
// AG-Kit Retriever-specific (non-standard)
|
|
1819
|
+
RETRIEVER_NAME: "retriever.name",
|
|
1820
|
+
RETRIEVER_QUERY: "retriever.query",
|
|
1821
|
+
RETRIEVER_INDEX_ID: "retriever.index_id",
|
|
1822
|
+
RETRIEVER_TOP_K: "retriever.top_k",
|
|
1823
|
+
// AG-Kit General (non-standard)
|
|
1824
|
+
ENVIRONMENT: "environment",
|
|
1825
|
+
RELEASE: "release",
|
|
1826
|
+
VERSION: "version"
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
init_attributes = __esm2({
|
|
1831
|
+
"src/core/attributes.ts"() {
|
|
1832
|
+
"use strict";
|
|
1833
|
+
init_constants();
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
init_tracerProvider = __esm2({
|
|
1837
|
+
"src/core/tracerProvider.ts"() {
|
|
1838
|
+
"use strict";
|
|
1839
|
+
OBSERVABILITY_GLOBAL_SYMBOL = /* @__PURE__ */ Symbol.for("observability");
|
|
1840
|
+
OBSERVABILITY_SDK_NAME = "ag-kit-observability";
|
|
1841
|
+
OBSERVABILITY_SDK_VERSION = "0.1.0";
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
init_spanWrapper = __esm2({
|
|
1845
|
+
"src/core/spanWrapper.ts"() {
|
|
1846
|
+
"use strict";
|
|
1847
|
+
init_attributes();
|
|
1848
|
+
init_tracerProvider();
|
|
1849
|
+
BaseObservation = class {
|
|
1850
|
+
constructor(params) {
|
|
1851
|
+
/** The underlying OpenTelemetry span */
|
|
1852
|
+
__publicField(this, "otelSpan");
|
|
1853
|
+
/** The observation type */
|
|
1854
|
+
__publicField(this, "type");
|
|
1855
|
+
/** The span ID from the OpenTelemetry span context */
|
|
1856
|
+
__publicField(this, "id");
|
|
1857
|
+
/** The trace ID from the OpenTelemetry span context */
|
|
1858
|
+
__publicField(this, "traceId");
|
|
1859
|
+
this.otelSpan = params.otelSpan;
|
|
1860
|
+
this.id = params.otelSpan.spanContext().spanId;
|
|
1861
|
+
this.traceId = params.otelSpan.spanContext().traceId;
|
|
1862
|
+
this.type = params.type;
|
|
1863
|
+
if (params.attributes) {
|
|
1864
|
+
this.otelSpan.setAttributes(
|
|
1865
|
+
createObservationAttributes(params.type, params.attributes)
|
|
1866
|
+
);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
/** Gets the AG-Kit OpenTelemetry tracer instance */
|
|
1870
|
+
get tracer() {
|
|
1871
|
+
return getTracer();
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Ends the observation, marking it as complete.
|
|
1875
|
+
*
|
|
1876
|
+
* @param endTime - Optional end time, defaults to current time
|
|
1877
|
+
*/
|
|
1878
|
+
end(endTime) {
|
|
1879
|
+
this.otelSpan.end(endTime);
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Updates the OTEL span attributes.
|
|
1883
|
+
*
|
|
1884
|
+
* @param attributes - Attributes to update
|
|
1885
|
+
* @internal
|
|
1886
|
+
*/
|
|
1887
|
+
updateOtelSpanAttributes(attributes) {
|
|
1888
|
+
this.otelSpan.setAttributes(
|
|
1889
|
+
createObservationAttributes(this.type, attributes)
|
|
1890
|
+
);
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Updates the parent trace with new attributes.
|
|
1894
|
+
*
|
|
1895
|
+
* @param attributes - Trace attributes to set
|
|
1896
|
+
* @returns This observation for method chaining
|
|
1897
|
+
*/
|
|
1898
|
+
updateTrace(attributes) {
|
|
1899
|
+
this.otelSpan.setAttributes(createTraceAttributes(attributes));
|
|
1900
|
+
return this;
|
|
1901
|
+
}
|
|
1902
|
+
startObservation(name, attributes, options) {
|
|
1903
|
+
const { startObservation: startObs } = (init_src(), __toCommonJS2(src_exports));
|
|
1904
|
+
const { asType = "span" } = options || {};
|
|
1905
|
+
return startObs(name, attributes, {
|
|
1906
|
+
asType,
|
|
1907
|
+
parentSpanContext: this.otelSpan.spanContext()
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1911
|
+
ObservationSpan = class extends BaseObservation {
|
|
1912
|
+
constructor(params) {
|
|
1913
|
+
super({ ...params, type: "span" });
|
|
1914
|
+
}
|
|
1915
|
+
update(attributes) {
|
|
1916
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1917
|
+
return this;
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1920
|
+
ObservationLLM = class extends BaseObservation {
|
|
1921
|
+
constructor(params) {
|
|
1922
|
+
super({ ...params, type: "llm" });
|
|
1923
|
+
}
|
|
1924
|
+
update(attributes) {
|
|
1925
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1926
|
+
return this;
|
|
1927
|
+
}
|
|
1928
|
+
};
|
|
1929
|
+
ObservationEmbedding = class extends BaseObservation {
|
|
1930
|
+
constructor(params) {
|
|
1931
|
+
super({ ...params, type: "embedding" });
|
|
1932
|
+
}
|
|
1933
|
+
update(attributes) {
|
|
1934
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1935
|
+
return this;
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
ObservationAgent = class extends BaseObservation {
|
|
1939
|
+
constructor(params) {
|
|
1940
|
+
super({ ...params, type: "agent" });
|
|
1941
|
+
}
|
|
1942
|
+
update(attributes) {
|
|
1943
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1944
|
+
return this;
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
ObservationTool = class extends BaseObservation {
|
|
1948
|
+
constructor(params) {
|
|
1949
|
+
super({ ...params, type: "tool" });
|
|
1950
|
+
}
|
|
1951
|
+
update(attributes) {
|
|
1952
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1953
|
+
return this;
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
ObservationChain = class extends BaseObservation {
|
|
1957
|
+
constructor(params) {
|
|
1958
|
+
super({ ...params, type: "chain" });
|
|
1959
|
+
}
|
|
1960
|
+
update(attributes) {
|
|
1961
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1962
|
+
return this;
|
|
1963
|
+
}
|
|
1964
|
+
};
|
|
1965
|
+
ObservationRetriever = class extends BaseObservation {
|
|
1966
|
+
constructor(params) {
|
|
1967
|
+
super({ ...params, type: "retriever" });
|
|
1968
|
+
}
|
|
1969
|
+
update(attributes) {
|
|
1970
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1971
|
+
return this;
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
1974
|
+
ObservationReranker = class extends BaseObservation {
|
|
1975
|
+
constructor(params) {
|
|
1976
|
+
super({ ...params, type: "reranker" });
|
|
1977
|
+
}
|
|
1978
|
+
update(attributes) {
|
|
1979
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1980
|
+
return this;
|
|
1981
|
+
}
|
|
1982
|
+
};
|
|
1983
|
+
ObservationEvaluator = class extends BaseObservation {
|
|
1984
|
+
constructor(params) {
|
|
1985
|
+
super({ ...params, type: "evaluator" });
|
|
1986
|
+
}
|
|
1987
|
+
update(attributes) {
|
|
1988
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1989
|
+
return this;
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
ObservationGuardrail = class extends BaseObservation {
|
|
1993
|
+
constructor(params) {
|
|
1994
|
+
super({ ...params, type: "guardrail" });
|
|
1995
|
+
}
|
|
1996
|
+
update(attributes) {
|
|
1997
|
+
super.updateOtelSpanAttributes(attributes);
|
|
1998
|
+
return this;
|
|
1999
|
+
}
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
});
|
|
2003
|
+
src_exports = {};
|
|
2004
|
+
__export2(src_exports, {
|
|
2005
|
+
ObservationAgent: () => ObservationAgent,
|
|
2006
|
+
ObservationChain: () => ObservationChain,
|
|
2007
|
+
ObservationEmbedding: () => ObservationEmbedding,
|
|
2008
|
+
ObservationEvaluator: () => ObservationEvaluator,
|
|
2009
|
+
ObservationGuardrail: () => ObservationGuardrail,
|
|
2010
|
+
ObservationLLM: () => ObservationLLM,
|
|
2011
|
+
ObservationReranker: () => ObservationReranker,
|
|
2012
|
+
ObservationRetriever: () => ObservationRetriever,
|
|
2013
|
+
ObservationSpan: () => ObservationSpan,
|
|
2014
|
+
ObservationTool: () => ObservationTool,
|
|
2015
|
+
createObservationAttributes: () => createObservationAttributes,
|
|
2016
|
+
createTraceAttributes: () => createTraceAttributes,
|
|
2017
|
+
getActiveSpanId: () => getActiveSpanId,
|
|
2018
|
+
getActiveTraceId: () => getActiveTraceId,
|
|
2019
|
+
getTracer: () => getTracer,
|
|
2020
|
+
getTracerProvider: () => getTracerProvider,
|
|
2021
|
+
observe: () => observe,
|
|
2022
|
+
setTracerProvider: () => setTracerProvider,
|
|
2023
|
+
startActiveObservation: () => startActiveObservation,
|
|
2024
|
+
startObservation: () => startObservation,
|
|
2025
|
+
updateActiveObservation: () => updateActiveObservation,
|
|
2026
|
+
updateActiveTrace: () => updateActiveTrace
|
|
2027
|
+
});
|
|
2028
|
+
init_src = __esm2({
|
|
2029
|
+
"src/index.ts"() {
|
|
2030
|
+
init_attributes();
|
|
2031
|
+
init_spanWrapper();
|
|
2032
|
+
init_tracerProvider();
|
|
2033
|
+
init_attributes();
|
|
2034
|
+
init_tracerProvider();
|
|
2035
|
+
}
|
|
2036
|
+
});
|
|
2037
|
+
}
|
|
2038
|
+
});
|
|
2039
|
+
|
|
2040
|
+
// ../../observability/dist/langchain.mjs
|
|
2041
|
+
var langchain_exports = {};
|
|
2042
|
+
__export(langchain_exports, {
|
|
2043
|
+
CallbackHandler: () => CallbackHandler
|
|
2044
|
+
});
|
|
2045
|
+
var import_base, import_messages, CallbackHandler;
|
|
2046
|
+
var init_langchain = __esm({
|
|
2047
|
+
"../../observability/dist/langchain.mjs"() {
|
|
2048
|
+
"use strict";
|
|
2049
|
+
init_chunk_ZGEMAYS4();
|
|
2050
|
+
init_chunk_NFEGQTCC();
|
|
2051
|
+
import_base = require("@langchain/core/callbacks/base");
|
|
2052
|
+
import_messages = require("@langchain/core/messages");
|
|
2053
|
+
init_src();
|
|
2054
|
+
CallbackHandler = class extends import_base.BaseCallbackHandler {
|
|
2055
|
+
constructor(params) {
|
|
2056
|
+
super();
|
|
2057
|
+
__publicField(this, "name", "ObservabilityCallbackHandler");
|
|
2058
|
+
__publicField(this, "userId");
|
|
2059
|
+
__publicField(this, "version");
|
|
2060
|
+
__publicField(this, "sessionId");
|
|
2061
|
+
__publicField(this, "tags");
|
|
2062
|
+
__publicField(this, "traceMetadata");
|
|
2063
|
+
__publicField(this, "completionStartTimes", {});
|
|
2064
|
+
__publicField(this, "promptToParentRunMap");
|
|
2065
|
+
__publicField(this, "runMap", /* @__PURE__ */ new Map());
|
|
2066
|
+
__publicField(this, "last_trace_id", null);
|
|
2067
|
+
// External parent context from AG-UI.Server span
|
|
2068
|
+
__publicField(this, "externalParentSpanContext");
|
|
2069
|
+
// Adapter name for ROOT span prefix
|
|
2070
|
+
__publicField(this, "adapterName");
|
|
2071
|
+
this.sessionId = params?.sessionId;
|
|
2072
|
+
this.userId = params?.userId;
|
|
2073
|
+
this.tags = params?.tags ?? [];
|
|
2074
|
+
this.traceMetadata = params?.traceMetadata;
|
|
2075
|
+
this.version = params?.version;
|
|
2076
|
+
this.adapterName = params?.adapterName;
|
|
2077
|
+
this.promptToParentRunMap = /* @__PURE__ */ new Map();
|
|
2078
|
+
}
|
|
2079
|
+
get logger() {
|
|
2080
|
+
return console;
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Set external parent SpanContext from AG-UI.Server span.
|
|
2084
|
+
* This allows the CallbackHandler to link LangChain/LangGraph spans
|
|
2085
|
+
* to the server-level span, creating a unified trace hierarchy.
|
|
2086
|
+
*
|
|
2087
|
+
* @param spanContext - SpanContext from the AG-UI.Server span
|
|
2088
|
+
* @public
|
|
2089
|
+
*/
|
|
2090
|
+
setExternalParentContext(spanContext) {
|
|
2091
|
+
this.externalParentSpanContext = spanContext;
|
|
2092
|
+
}
|
|
2093
|
+
async handleLLMNewToken(token, _idx, runId, _parentRunId, _tags, _fields) {
|
|
2094
|
+
if (runId && !(runId in this.completionStartTimes)) {
|
|
2095
|
+
this.logger.debug(`LLM first streaming token: ${runId}`);
|
|
2096
|
+
this.completionStartTimes[runId] = /* @__PURE__ */ new Date();
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
async handleChainStart(chain, inputs, runId, parentRunId, tags, metadata, runType, name) {
|
|
2100
|
+
try {
|
|
2101
|
+
this.logger.debug(`Chain start with Id: ${runId}`);
|
|
2102
|
+
const runName = name ?? chain.id.at(-1)?.toString() ?? "Langchain Run";
|
|
2103
|
+
this.registerPromptInfo(parentRunId, metadata);
|
|
2104
|
+
let finalInput = inputs;
|
|
2105
|
+
if (typeof inputs === "object" && "input" in inputs && Array.isArray(inputs["input"]) && inputs["input"].every((m) => m instanceof import_messages.BaseMessage)) {
|
|
2106
|
+
finalInput = inputs["input"].map(
|
|
2107
|
+
(m) => this.extractChatMessageContent(m)
|
|
2108
|
+
);
|
|
2109
|
+
} else if (typeof inputs === "object" && "messages" in inputs && Array.isArray(inputs["messages"]) && inputs["messages"].every((m) => m instanceof import_messages.BaseMessage)) {
|
|
2110
|
+
finalInput = inputs["messages"].map(
|
|
2111
|
+
(m) => this.extractChatMessageContent(m)
|
|
2112
|
+
);
|
|
2113
|
+
} else if (typeof inputs === "object" && "content" in inputs && typeof inputs["content"] === "string") {
|
|
2114
|
+
finalInput = inputs["content"];
|
|
2115
|
+
}
|
|
2116
|
+
const observation = this.startAndRegisterObservation({
|
|
2117
|
+
runName,
|
|
2118
|
+
parentRunId,
|
|
2119
|
+
runId,
|
|
2120
|
+
tags,
|
|
2121
|
+
metadata,
|
|
2122
|
+
attributes: {
|
|
2123
|
+
input: finalInput
|
|
2124
|
+
},
|
|
2125
|
+
asType: "span"
|
|
2126
|
+
});
|
|
2127
|
+
const traceTags = [.../* @__PURE__ */ new Set([...tags ?? [], ...this.tags])];
|
|
2128
|
+
if (!parentRunId) {
|
|
2129
|
+
observation.updateTrace({
|
|
2130
|
+
tags: traceTags,
|
|
2131
|
+
userId: metadata && "userId" in metadata && typeof metadata["userId"] === "string" ? metadata["userId"] : this.userId,
|
|
2132
|
+
sessionId: metadata && "sessionId" in metadata && typeof metadata["sessionId"] === "string" ? metadata["sessionId"] : this.sessionId,
|
|
2133
|
+
metadata: this.traceMetadata,
|
|
2134
|
+
version: this.version
|
|
2135
|
+
});
|
|
2136
|
+
}
|
|
2137
|
+
} catch (e) {
|
|
2138
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
async handleAgentAction(action, runId, parentRunId) {
|
|
2142
|
+
try {
|
|
2143
|
+
this.logger.debug(`Agent action ${action.tool} with ID: ${runId}`);
|
|
2144
|
+
this.startAndRegisterObservation({
|
|
2145
|
+
runId,
|
|
2146
|
+
parentRunId,
|
|
2147
|
+
runName: action.tool,
|
|
2148
|
+
attributes: {
|
|
2149
|
+
input: action
|
|
2150
|
+
},
|
|
2151
|
+
asType: "tool"
|
|
2152
|
+
});
|
|
2153
|
+
} catch (e) {
|
|
2154
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
async handleAgentEnd(action, runId, _parentRunId) {
|
|
2158
|
+
try {
|
|
2159
|
+
this.logger.debug(`Agent finish with ID: ${runId}`);
|
|
2160
|
+
this.handleObservationEnd({
|
|
2161
|
+
runId,
|
|
2162
|
+
attributes: { output: action }
|
|
2163
|
+
});
|
|
2164
|
+
} catch (e) {
|
|
2165
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
async handleChainError(err, runId, _parentRunId) {
|
|
2169
|
+
try {
|
|
2170
|
+
this.logger.debug(`Chain error: ${err} with ID: ${runId}`);
|
|
2171
|
+
this.handleObservationEnd({
|
|
2172
|
+
runId,
|
|
2173
|
+
attributes: {
|
|
2174
|
+
level: "ERROR",
|
|
2175
|
+
statusMessage: err.toString()
|
|
2176
|
+
}
|
|
2177
|
+
});
|
|
2178
|
+
} catch (e) {
|
|
2179
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
async handleGenerationStart(llm, messages, runId, parentRunId, extraParams, tags, metadata, name) {
|
|
2183
|
+
this.logger.debug(
|
|
2184
|
+
`Generation start with ID: ${runId} and parentRunId ${parentRunId}`
|
|
2185
|
+
);
|
|
2186
|
+
const runName = name ?? llm.id.at(-1)?.toString() ?? "Langchain Generation";
|
|
2187
|
+
const modelParameters = {};
|
|
2188
|
+
const invocationParams = extraParams?.["invocation_params"];
|
|
2189
|
+
for (const [key, value] of Object.entries({
|
|
2190
|
+
temperature: invocationParams?.temperature,
|
|
2191
|
+
max_tokens: invocationParams?.max_tokens,
|
|
2192
|
+
top_p: invocationParams?.top_p,
|
|
2193
|
+
frequency_penalty: invocationParams?.frequency_penalty,
|
|
2194
|
+
presence_penalty: invocationParams?.presence_penalty,
|
|
2195
|
+
request_timeout: invocationParams?.request_timeout
|
|
2196
|
+
})) {
|
|
2197
|
+
if (value !== void 0 && value !== null) {
|
|
2198
|
+
modelParameters[key] = value;
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
let extractedModelName;
|
|
2202
|
+
if (extraParams) {
|
|
2203
|
+
const invocationParamsModelName = extraParams.invocation_params.model;
|
|
2204
|
+
const metadataModelName = metadata && "ls_model_name" in metadata ? metadata["ls_model_name"] : void 0;
|
|
2205
|
+
extractedModelName = invocationParamsModelName ?? metadataModelName;
|
|
2206
|
+
}
|
|
2207
|
+
const registeredPrompt = this.promptToParentRunMap.get(
|
|
2208
|
+
parentRunId ?? "root"
|
|
2209
|
+
);
|
|
2210
|
+
if (registeredPrompt && parentRunId) {
|
|
2211
|
+
this.deregisterPromptInfo(parentRunId);
|
|
2212
|
+
}
|
|
2213
|
+
this.startAndRegisterObservation({
|
|
2214
|
+
runId,
|
|
2215
|
+
parentRunId,
|
|
2216
|
+
metadata,
|
|
2217
|
+
tags,
|
|
2218
|
+
runName,
|
|
2219
|
+
attributes: {
|
|
2220
|
+
input: messages,
|
|
2221
|
+
model: extractedModelName,
|
|
2222
|
+
modelParameters
|
|
2223
|
+
},
|
|
2224
|
+
asType: "llm"
|
|
2225
|
+
});
|
|
2226
|
+
}
|
|
2227
|
+
async handleChatModelStart(llm, messages, runId, parentRunId, extraParams, tags, metadata, name) {
|
|
2228
|
+
try {
|
|
2229
|
+
this.logger.debug(`Chat model start with ID: ${runId}`);
|
|
2230
|
+
const prompts = messages.flatMap(
|
|
2231
|
+
(message) => message.map((m) => this.extractChatMessageContent(m))
|
|
2232
|
+
);
|
|
2233
|
+
this.handleGenerationStart(
|
|
2234
|
+
llm,
|
|
2235
|
+
prompts,
|
|
2236
|
+
runId,
|
|
2237
|
+
parentRunId,
|
|
2238
|
+
extraParams,
|
|
2239
|
+
tags,
|
|
2240
|
+
metadata,
|
|
2241
|
+
name
|
|
2242
|
+
);
|
|
2243
|
+
} catch (e) {
|
|
2244
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
async handleChainEnd(outputs, runId, _parentRunId) {
|
|
2248
|
+
try {
|
|
2249
|
+
this.logger.debug(`Chain end with ID: ${runId}`);
|
|
2250
|
+
let finalOutput = outputs;
|
|
2251
|
+
if (typeof outputs === "object" && "output" in outputs && typeof outputs["output"] === "string") {
|
|
2252
|
+
finalOutput = outputs["output"];
|
|
2253
|
+
} else if (typeof outputs === "object" && "messages" in outputs && Array.isArray(outputs["messages"]) && outputs["messages"].every((m) => m instanceof import_messages.BaseMessage)) {
|
|
2254
|
+
finalOutput = {
|
|
2255
|
+
messages: outputs.messages.map(
|
|
2256
|
+
(message) => this.extractChatMessageContent(message)
|
|
2257
|
+
)
|
|
2258
|
+
};
|
|
2259
|
+
}
|
|
2260
|
+
this.handleObservationEnd({
|
|
2261
|
+
runId,
|
|
2262
|
+
attributes: {
|
|
2263
|
+
output: finalOutput
|
|
2264
|
+
}
|
|
2265
|
+
});
|
|
2266
|
+
this.deregisterPromptInfo(runId);
|
|
2267
|
+
} catch (e) {
|
|
2268
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
async handleLLMStart(llm, prompts, runId, parentRunId, extraParams, tags, metadata, name) {
|
|
2272
|
+
try {
|
|
2273
|
+
this.logger.debug(`LLM start with ID: ${runId}`);
|
|
2274
|
+
this.handleGenerationStart(
|
|
2275
|
+
llm,
|
|
2276
|
+
prompts,
|
|
2277
|
+
runId,
|
|
2278
|
+
parentRunId,
|
|
2279
|
+
extraParams,
|
|
2280
|
+
tags,
|
|
2281
|
+
metadata,
|
|
2282
|
+
name
|
|
2283
|
+
);
|
|
2284
|
+
} catch (e) {
|
|
2285
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
async handleToolStart(tool, input, runId, parentRunId, tags, metadata, name) {
|
|
2289
|
+
try {
|
|
2290
|
+
this.logger.debug(`Tool start with ID: ${runId}`);
|
|
2291
|
+
this.startAndRegisterObservation({
|
|
2292
|
+
runId,
|
|
2293
|
+
parentRunId,
|
|
2294
|
+
runName: name ?? tool.id.at(-1)?.toString() ?? "Tool execution",
|
|
2295
|
+
attributes: {
|
|
2296
|
+
input
|
|
2297
|
+
},
|
|
2298
|
+
metadata,
|
|
2299
|
+
tags,
|
|
2300
|
+
asType: "tool"
|
|
2301
|
+
});
|
|
2302
|
+
} catch (e) {
|
|
2303
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
async handleRetrieverStart(retriever, query, runId, parentRunId, tags, metadata, name) {
|
|
2307
|
+
try {
|
|
2308
|
+
this.logger.debug(`Retriever start with ID: ${runId}`);
|
|
2309
|
+
this.startAndRegisterObservation({
|
|
2310
|
+
runId,
|
|
2311
|
+
parentRunId,
|
|
2312
|
+
runName: name ?? retriever.id.at(-1)?.toString() ?? "Retriever",
|
|
2313
|
+
attributes: {
|
|
2314
|
+
input: query
|
|
2315
|
+
},
|
|
2316
|
+
tags,
|
|
2317
|
+
metadata,
|
|
2318
|
+
asType: "span"
|
|
2319
|
+
});
|
|
2320
|
+
} catch (e) {
|
|
2321
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
async handleRetrieverEnd(documents, runId, _parentRunId) {
|
|
2325
|
+
try {
|
|
2326
|
+
this.logger.debug(`Retriever end with ID: ${runId}`);
|
|
2327
|
+
this.handleObservationEnd({
|
|
2328
|
+
runId,
|
|
2329
|
+
attributes: {
|
|
2330
|
+
output: documents
|
|
2331
|
+
}
|
|
2332
|
+
});
|
|
2333
|
+
} catch (e) {
|
|
2334
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
async handleRetrieverError(err, runId, _parentRunId) {
|
|
2338
|
+
try {
|
|
2339
|
+
this.logger.debug(`Retriever error: ${err} with ID: ${runId}`);
|
|
2340
|
+
this.handleObservationEnd({
|
|
2341
|
+
runId,
|
|
2342
|
+
attributes: {
|
|
2343
|
+
level: "ERROR",
|
|
2344
|
+
statusMessage: err.toString()
|
|
2345
|
+
}
|
|
2346
|
+
});
|
|
2347
|
+
} catch (e) {
|
|
2348
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
async handleToolEnd(output, runId, _parentRunId) {
|
|
2352
|
+
try {
|
|
2353
|
+
this.logger.debug(`Tool end with ID: ${runId}`);
|
|
2354
|
+
this.handleObservationEnd({
|
|
2355
|
+
runId,
|
|
2356
|
+
attributes: { output }
|
|
2357
|
+
});
|
|
2358
|
+
} catch (e) {
|
|
2359
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
async handleToolError(err, runId, _parentRunId) {
|
|
2363
|
+
try {
|
|
2364
|
+
this.logger.debug(`Tool error ${err} with ID: ${runId}`);
|
|
2365
|
+
this.handleObservationEnd({
|
|
2366
|
+
runId,
|
|
2367
|
+
attributes: {
|
|
2368
|
+
level: "ERROR",
|
|
2369
|
+
statusMessage: err.toString()
|
|
2370
|
+
}
|
|
2371
|
+
});
|
|
2372
|
+
} catch (e) {
|
|
2373
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
async handleLLMEnd(output, runId, _parentRunId) {
|
|
2377
|
+
try {
|
|
2378
|
+
this.logger.debug(`LLM end with ID: ${runId}`);
|
|
2379
|
+
const lastResponse = output.generations[output.generations.length - 1][output.generations[output.generations.length - 1].length - 1];
|
|
2380
|
+
const llmUsage = this.extractUsageMetadata(lastResponse) ?? output.llmOutput?.["tokenUsage"];
|
|
2381
|
+
const modelName = this.extractModelNameFromMetadata(lastResponse);
|
|
2382
|
+
const usageDetails = {
|
|
2383
|
+
input: llmUsage?.input_tokens ?? ("promptTokens" in llmUsage ? llmUsage?.promptTokens : void 0),
|
|
2384
|
+
output: llmUsage?.output_tokens ?? ("completionTokens" in llmUsage ? llmUsage?.completionTokens : void 0),
|
|
2385
|
+
total: llmUsage?.total_tokens ?? ("totalTokens" in llmUsage ? llmUsage?.totalTokens : void 0)
|
|
2386
|
+
};
|
|
2387
|
+
if (llmUsage && "input_token_details" in llmUsage) {
|
|
2388
|
+
for (const [key, val] of Object.entries(
|
|
2389
|
+
llmUsage["input_token_details"] ?? {}
|
|
2390
|
+
)) {
|
|
2391
|
+
usageDetails[`input_${key}`] = val;
|
|
2392
|
+
if ("input" in usageDetails && typeof val === "number") {
|
|
2393
|
+
usageDetails["input"] = Math.max(0, usageDetails["input"] - val);
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
if (llmUsage && "output_token_details" in llmUsage) {
|
|
2398
|
+
for (const [key, val] of Object.entries(
|
|
2399
|
+
llmUsage["output_token_details"] ?? {}
|
|
2400
|
+
)) {
|
|
2401
|
+
usageDetails[`output_${key}`] = val;
|
|
2402
|
+
if ("output" in usageDetails && typeof val === "number") {
|
|
2403
|
+
usageDetails["output"] = Math.max(0, usageDetails["output"] - val);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
const extractedOutput = "message" in lastResponse ? this.extractChatMessageContent(
|
|
2408
|
+
lastResponse["message"]
|
|
2409
|
+
) : lastResponse.text;
|
|
2410
|
+
this.handleObservationEnd({
|
|
2411
|
+
runId,
|
|
2412
|
+
attributes: {
|
|
2413
|
+
model: modelName,
|
|
2414
|
+
output: extractedOutput,
|
|
2415
|
+
completionStartTime: runId in this.completionStartTimes ? this.completionStartTimes[runId] : void 0,
|
|
2416
|
+
usageDetails
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
if (runId in this.completionStartTimes) {
|
|
2420
|
+
delete this.completionStartTimes[runId];
|
|
2421
|
+
}
|
|
2422
|
+
} catch (e) {
|
|
2423
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
async handleLLMError(err, runId, _parentRunId) {
|
|
2427
|
+
try {
|
|
2428
|
+
this.logger.debug(`LLM error ${err} with ID: ${runId}`);
|
|
2429
|
+
this.handleObservationEnd({
|
|
2430
|
+
runId,
|
|
2431
|
+
attributes: {
|
|
2432
|
+
level: "ERROR",
|
|
2433
|
+
statusMessage: err.toString()
|
|
2434
|
+
}
|
|
2435
|
+
});
|
|
2436
|
+
} catch (e) {
|
|
2437
|
+
this.logger.debug(e instanceof Error ? e.message : String(e));
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
registerPromptInfo(parentRunId, metadata) {
|
|
2441
|
+
if (metadata && "promptInfo" in metadata && parentRunId) {
|
|
2442
|
+
this.promptToParentRunMap.set(
|
|
2443
|
+
parentRunId,
|
|
2444
|
+
metadata.promptInfo
|
|
2445
|
+
);
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
deregisterPromptInfo(runId) {
|
|
2449
|
+
this.promptToParentRunMap.delete(runId);
|
|
2450
|
+
}
|
|
2451
|
+
startAndRegisterObservation(params) {
|
|
2452
|
+
const { runName, runId, parentRunId, attributes, metadata, tags, asType } = params;
|
|
2453
|
+
let parentSpanContext;
|
|
2454
|
+
if (parentRunId) {
|
|
2455
|
+
parentSpanContext = this.runMap.get(parentRunId)?.otelSpan.spanContext();
|
|
2456
|
+
} else if (this.externalParentSpanContext) {
|
|
2457
|
+
parentSpanContext = this.externalParentSpanContext;
|
|
2458
|
+
}
|
|
2459
|
+
let finalRunName = runName;
|
|
2460
|
+
if (!parentRunId && this.adapterName) {
|
|
2461
|
+
finalRunName = `Adapter.${this.adapterName}`;
|
|
2462
|
+
}
|
|
2463
|
+
const observation = startObservation(
|
|
2464
|
+
finalRunName,
|
|
2465
|
+
{
|
|
2466
|
+
version: this.version,
|
|
2467
|
+
metadata: this.joinTagsAndMetaData(tags, metadata),
|
|
2468
|
+
...attributes
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
asType: asType ?? "span",
|
|
2472
|
+
parentSpanContext
|
|
2473
|
+
}
|
|
2474
|
+
);
|
|
2475
|
+
this.runMap.set(runId, observation);
|
|
2476
|
+
return observation;
|
|
2477
|
+
}
|
|
2478
|
+
handleObservationEnd(params) {
|
|
2479
|
+
const { runId, attributes = {} } = params;
|
|
2480
|
+
const observation = this.runMap.get(runId);
|
|
2481
|
+
if (!observation) {
|
|
2482
|
+
this.logger.warn("Observation not found in runMap. Skipping operation.");
|
|
2483
|
+
return;
|
|
2484
|
+
}
|
|
2485
|
+
observation.update(attributes).end();
|
|
2486
|
+
this.last_trace_id = observation.traceId;
|
|
2487
|
+
this.runMap.delete(runId);
|
|
2488
|
+
}
|
|
2489
|
+
joinTagsAndMetaData(tags, metadata1, metadata2) {
|
|
2490
|
+
const finalDict = {};
|
|
2491
|
+
if (tags && tags.length > 0) {
|
|
2492
|
+
finalDict.tags = tags;
|
|
2493
|
+
}
|
|
2494
|
+
if (metadata1) {
|
|
2495
|
+
Object.assign(finalDict, metadata1);
|
|
2496
|
+
}
|
|
2497
|
+
if (metadata2) {
|
|
2498
|
+
Object.assign(finalDict, metadata2);
|
|
2499
|
+
}
|
|
2500
|
+
return this.stripObservabilityKeysFromMetadata(finalDict);
|
|
2501
|
+
}
|
|
2502
|
+
stripObservabilityKeysFromMetadata(metadata) {
|
|
2503
|
+
if (!metadata) {
|
|
2504
|
+
return;
|
|
2505
|
+
}
|
|
2506
|
+
const reservedKeys = ["promptInfo", "userId", "sessionId"];
|
|
2507
|
+
return Object.fromEntries(
|
|
2508
|
+
Object.entries(metadata).filter(([key, _]) => !reservedKeys.includes(key))
|
|
2509
|
+
);
|
|
2510
|
+
}
|
|
2511
|
+
extractUsageMetadata(generation) {
|
|
2512
|
+
try {
|
|
2513
|
+
const usageMetadata = "message" in generation && (import_messages.AIMessage.isInstance(generation["message"]) || import_messages.AIMessageChunk.isInstance(generation["message"])) ? generation["message"].usage_metadata : void 0;
|
|
2514
|
+
return usageMetadata;
|
|
2515
|
+
} catch (err) {
|
|
2516
|
+
this.logger.debug(`Error extracting usage metadata: ${err}`);
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
extractModelNameFromMetadata(generation) {
|
|
2521
|
+
try {
|
|
2522
|
+
return "message" in generation && (import_messages.AIMessage.isInstance(generation["message"]) || import_messages.AIMessageChunk.isInstance(generation["message"])) ? generation["message"].response_metadata.model_name : void 0;
|
|
2523
|
+
} catch {
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
extractChatMessageContent(message) {
|
|
2527
|
+
let response = void 0;
|
|
2528
|
+
if (message.getType() === "human") {
|
|
2529
|
+
response = { content: message.content, role: "user" };
|
|
2530
|
+
} else if (message.getType() === "generic") {
|
|
2531
|
+
response = {
|
|
2532
|
+
content: message.content,
|
|
2533
|
+
role: "human"
|
|
2534
|
+
};
|
|
2535
|
+
} else if (message.getType() === "ai") {
|
|
2536
|
+
response = { content: message.content, role: "assistant" };
|
|
2537
|
+
if ("tool_calls" in message && Array.isArray(message.tool_calls) && (message.tool_calls?.length ?? 0) > 0) {
|
|
2538
|
+
response["tool_calls"] = message["tool_calls"];
|
|
2539
|
+
}
|
|
2540
|
+
if ("additional_kwargs" in message && "tool_calls" in message["additional_kwargs"]) {
|
|
2541
|
+
response["tool_calls"] = message["additional_kwargs"]["tool_calls"];
|
|
2542
|
+
}
|
|
2543
|
+
} else if (message.getType() === "system") {
|
|
2544
|
+
response = { content: message.content, role: "system" };
|
|
2545
|
+
} else if (message.getType() === "function") {
|
|
2546
|
+
response = {
|
|
2547
|
+
content: message.content,
|
|
2548
|
+
additional_kwargs: message.additional_kwargs,
|
|
2549
|
+
role: message.name
|
|
2550
|
+
};
|
|
2551
|
+
} else if (message.getType() === "tool") {
|
|
2552
|
+
response = {
|
|
2553
|
+
content: message.content,
|
|
2554
|
+
additional_kwargs: message.additional_kwargs,
|
|
2555
|
+
role: message.name
|
|
2556
|
+
};
|
|
2557
|
+
} else if (!message.name) {
|
|
2558
|
+
response = { content: message.content };
|
|
2559
|
+
} else {
|
|
2560
|
+
response = {
|
|
2561
|
+
role: message.name,
|
|
2562
|
+
content: message.content
|
|
2563
|
+
};
|
|
2564
|
+
}
|
|
2565
|
+
if ((message.additional_kwargs.function_call || message.additional_kwargs.tool_calls) && response["tool_calls"] === void 0) {
|
|
2566
|
+
return { ...response, additional_kwargs: message.additional_kwargs };
|
|
2567
|
+
}
|
|
2568
|
+
return response;
|
|
2569
|
+
}
|
|
2570
|
+
};
|
|
2571
|
+
}
|
|
2572
|
+
});
|
|
29
2573
|
|
|
30
2574
|
// src/index.ts
|
|
31
2575
|
var index_exports = {};
|
|
@@ -34,7 +2578,9 @@ __export(index_exports, {
|
|
|
34
2578
|
ClientStateAnnotation: () => ClientStateAnnotation,
|
|
35
2579
|
LanggraphAgent: () => LanggraphAgent,
|
|
36
2580
|
TDAISaver: () => TDAISaver,
|
|
37
|
-
TDAIStore: () => TDAIStore
|
|
2581
|
+
TDAIStore: () => TDAIStore,
|
|
2582
|
+
createConsoleLogger: () => import_agent_shared2.createConsoleLogger,
|
|
2583
|
+
noopLogger: () => import_agent_shared2.noopLogger
|
|
38
2584
|
});
|
|
39
2585
|
module.exports = __toCommonJS(index_exports);
|
|
40
2586
|
|
|
@@ -91,6 +2637,9 @@ function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
|
91
2637
|
}
|
|
92
2638
|
|
|
93
2639
|
// src/agent.ts
|
|
2640
|
+
var import_agent_shared = require("@cloudbase/agent-shared");
|
|
2641
|
+
var LangChainCallbackHandler;
|
|
2642
|
+
var observabilityLoadAttempted = false;
|
|
94
2643
|
var ClientPropertiesAnnotation = import_langgraph.Annotation.Root({
|
|
95
2644
|
tools: import_langgraph.Annotation
|
|
96
2645
|
});
|
|
@@ -102,6 +2651,9 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
102
2651
|
constructor(agentConfig) {
|
|
103
2652
|
super(agentConfig);
|
|
104
2653
|
this.compiledWorkflow = agentConfig.compiledWorkflow;
|
|
2654
|
+
this.adapterName = agentConfig.adapterName || "LangGraph";
|
|
2655
|
+
const baseLogger = agentConfig.logger ?? import_agent_shared.noopLogger;
|
|
2656
|
+
this.logger = baseLogger.child?.({ component: "langgraph-agent" }) ?? baseLogger;
|
|
105
2657
|
}
|
|
106
2658
|
run(input) {
|
|
107
2659
|
return new import_rxjs.Observable((subscriber) => {
|
|
@@ -110,15 +2662,85 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
110
2662
|
}
|
|
111
2663
|
async _run(subscriber, input) {
|
|
112
2664
|
const { messages, runId, threadId } = input;
|
|
113
|
-
|
|
2665
|
+
const logger = this.logger.child?.({ runId, threadId }) ?? this.logger;
|
|
2666
|
+
logger.info?.("Run started");
|
|
2667
|
+
if (!observabilityLoadAttempted && !this.observabilityCallback) {
|
|
2668
|
+
observabilityLoadAttempted = true;
|
|
2669
|
+
try {
|
|
2670
|
+
logger.debug?.("Attempting to load observability...");
|
|
2671
|
+
const obsModule = await Promise.resolve().then(() => (init_langchain(), langchain_exports));
|
|
2672
|
+
LangChainCallbackHandler = obsModule.CallbackHandler;
|
|
2673
|
+
if (LangChainCallbackHandler) {
|
|
2674
|
+
this.observabilityCallback = new LangChainCallbackHandler({
|
|
2675
|
+
adapterName: this.adapterName
|
|
2676
|
+
});
|
|
2677
|
+
logger.debug?.("\u2713 Observability callback created");
|
|
2678
|
+
}
|
|
2679
|
+
} catch (e) {
|
|
2680
|
+
logger.debug?.(
|
|
2681
|
+
"\u2717 Observability not available:",
|
|
2682
|
+
e instanceof Error ? e.message : String(e)
|
|
2683
|
+
);
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
if (this.observabilityCallback && input.forwardedProps?.__agui_server_context) {
|
|
2687
|
+
try {
|
|
2688
|
+
const serverContextData = input.forwardedProps.__agui_server_context;
|
|
2689
|
+
const serverSpanContext = {
|
|
2690
|
+
traceId: serverContextData.traceId,
|
|
2691
|
+
spanId: serverContextData.spanId,
|
|
2692
|
+
traceFlags: serverContextData.traceFlags,
|
|
2693
|
+
isRemote: false
|
|
2694
|
+
};
|
|
2695
|
+
this.observabilityCallback.setExternalParentContext(serverSpanContext);
|
|
2696
|
+
logger.debug?.("\u2713 Server context restored:", {
|
|
2697
|
+
traceId: serverSpanContext.traceId,
|
|
2698
|
+
spanId: serverSpanContext.spanId
|
|
2699
|
+
});
|
|
2700
|
+
} catch (e) {
|
|
2701
|
+
logger.debug?.("Failed to restore server context:", e);
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
const runStartedEvent = {
|
|
114
2705
|
type: import_client.EventType.RUN_STARTED,
|
|
115
2706
|
threadId,
|
|
116
2707
|
runId
|
|
117
|
-
}
|
|
118
|
-
|
|
2708
|
+
};
|
|
2709
|
+
logger.trace?.({ aguiEvent: runStartedEvent }, "Emitting AGUI event");
|
|
2710
|
+
subscriber.next(runStartedEvent);
|
|
2711
|
+
const isResume = !!input.forwardedProps?.resume;
|
|
2712
|
+
const lastUserMessage = messages.filter((m) => m.role === "user").pop();
|
|
2713
|
+
logger.debug?.(
|
|
2714
|
+
{
|
|
2715
|
+
isResume,
|
|
2716
|
+
messageCount: messages.length,
|
|
2717
|
+
toolCount: input.tools?.length ?? 0,
|
|
2718
|
+
tools: input.tools?.map((t) => t.name),
|
|
2719
|
+
lastUserMessage: typeof lastUserMessage?.content === "string" ? lastUserMessage.content.slice(0, 200) : void 0
|
|
2720
|
+
},
|
|
2721
|
+
"Preparing stream input"
|
|
2722
|
+
);
|
|
2723
|
+
logger.trace?.({ messages, tools: input.tools }, "Full input messages");
|
|
2724
|
+
const langChainMessages = isResume ? void 0 : aguiMessagesToLangChain(messages);
|
|
2725
|
+
if (langChainMessages) {
|
|
2726
|
+
logger.trace?.(
|
|
2727
|
+
{
|
|
2728
|
+
langChainMessages,
|
|
2729
|
+
messageCount: langChainMessages.length,
|
|
2730
|
+
messageTypes: langChainMessages.map((m) => ({
|
|
2731
|
+
type: m.type,
|
|
2732
|
+
id: m.id,
|
|
2733
|
+
hasToolCalls: "tool_calls" in m && Array.isArray(m.tool_calls) && m.tool_calls.length > 0,
|
|
2734
|
+
toolCallId: "tool_call_id" in m ? m.tool_call_id : void 0
|
|
2735
|
+
}))
|
|
2736
|
+
},
|
|
2737
|
+
"Converted LangGraph messages"
|
|
2738
|
+
);
|
|
2739
|
+
}
|
|
2740
|
+
const streamEventInput = isResume ? new import_langgraph.Command({
|
|
119
2741
|
resume: JSON.stringify(input.forwardedProps?.resume?.payload)
|
|
120
2742
|
}) : {
|
|
121
|
-
messages:
|
|
2743
|
+
messages: langChainMessages,
|
|
122
2744
|
client: {
|
|
123
2745
|
tools: convertActionsToDynamicStructuredTools(
|
|
124
2746
|
input.tools.map((x) => ({
|
|
@@ -130,11 +2752,13 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
130
2752
|
};
|
|
131
2753
|
const stream = this.compiledWorkflow.streamEvents(streamEventInput, {
|
|
132
2754
|
version: "v2",
|
|
2755
|
+
...this.observabilityCallback ? { callbacks: [this.observabilityCallback] } : {},
|
|
133
2756
|
runId,
|
|
134
2757
|
configurable: {
|
|
135
2758
|
thread_id: threadId
|
|
136
2759
|
}
|
|
137
2760
|
});
|
|
2761
|
+
logger.debug?.("Stream created, starting event processing");
|
|
138
2762
|
const chatModelRuns = [];
|
|
139
2763
|
const handledToolCallIds = /* @__PURE__ */ new Set();
|
|
140
2764
|
for (const msg of messages) {
|
|
@@ -142,14 +2766,32 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
142
2766
|
handledToolCallIds.add(msg.toolCallId);
|
|
143
2767
|
}
|
|
144
2768
|
}
|
|
2769
|
+
if (handledToolCallIds.size > 0) {
|
|
2770
|
+
logger.debug?.(
|
|
2771
|
+
{ count: handledToolCallIds.size },
|
|
2772
|
+
"Pre-populated handled tool call IDs from input messages"
|
|
2773
|
+
);
|
|
2774
|
+
}
|
|
145
2775
|
let interrupt;
|
|
146
2776
|
let currentToolCall = null;
|
|
2777
|
+
let eventCount = 0;
|
|
2778
|
+
let toolCallCount = 0;
|
|
2779
|
+
let textChunkCount = 0;
|
|
147
2780
|
try {
|
|
148
2781
|
for await (const event of stream) {
|
|
2782
|
+
eventCount++;
|
|
2783
|
+
logger.trace?.(
|
|
2784
|
+
{ eventType: event.event, eventCount, langGraphEvent: event },
|
|
2785
|
+
"Processing stream event"
|
|
2786
|
+
);
|
|
149
2787
|
if (event.event.startsWith("ChannelWrite<")) {
|
|
150
2788
|
continue;
|
|
151
2789
|
}
|
|
152
2790
|
if (event.event === "on_chat_model_start") {
|
|
2791
|
+
logger.debug?.(
|
|
2792
|
+
{ chatModelRunId: event.run_id },
|
|
2793
|
+
"Chat model started"
|
|
2794
|
+
);
|
|
153
2795
|
chatModelRuns.push({ runId: event.run_id });
|
|
154
2796
|
continue;
|
|
155
2797
|
}
|
|
@@ -158,8 +2800,13 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
158
2800
|
(run) => run.runId === event.run_id
|
|
159
2801
|
);
|
|
160
2802
|
if (!chatModelRun) {
|
|
2803
|
+
logger.warn?.(
|
|
2804
|
+
{ chatModelRunId: event.run_id },
|
|
2805
|
+
"Received message from unknown chat model run"
|
|
2806
|
+
);
|
|
161
2807
|
subscriber.next({
|
|
162
2808
|
type: import_client.EventType.RUN_ERROR,
|
|
2809
|
+
code: "INTERNAL_ERROR",
|
|
163
2810
|
message: `Received a message from an unknown chat model run. Run Id: ${event.run_id}`
|
|
164
2811
|
});
|
|
165
2812
|
continue;
|
|
@@ -167,14 +2814,29 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
167
2814
|
const chunkId = event.data.chunk.id;
|
|
168
2815
|
if (!chatModelRun.messageId) {
|
|
169
2816
|
chatModelRun.messageId = chunkId;
|
|
170
|
-
|
|
2817
|
+
const textStartEvent = {
|
|
171
2818
|
messageId: chunkId,
|
|
172
2819
|
type: import_client.EventType.TEXT_MESSAGE_START,
|
|
173
2820
|
role: "assistant"
|
|
174
|
-
}
|
|
2821
|
+
};
|
|
2822
|
+
logger.debug?.({ messageId: chunkId }, "Text message started");
|
|
2823
|
+
logger.trace?.(
|
|
2824
|
+
{ aguiEvent: textStartEvent },
|
|
2825
|
+
"Emitting AGUI event"
|
|
2826
|
+
);
|
|
2827
|
+
subscriber.next(textStartEvent);
|
|
175
2828
|
} else if (chatModelRun.messageId !== chunkId) {
|
|
2829
|
+
logger.warn?.(
|
|
2830
|
+
{
|
|
2831
|
+
expectedMessageId: chatModelRun.messageId,
|
|
2832
|
+
receivedMessageId: chunkId,
|
|
2833
|
+
chatModelRunId: event.run_id
|
|
2834
|
+
},
|
|
2835
|
+
"Received message with unexpected ID"
|
|
2836
|
+
);
|
|
176
2837
|
subscriber.next({
|
|
177
2838
|
type: import_client.EventType.RUN_ERROR,
|
|
2839
|
+
code: "INTERNAL_ERROR",
|
|
178
2840
|
message: `Received a message of unknown message id from current run. Run Id: ${event.run_id} Message Id from current run: ${chatModelRun.messageId} Message Id from received message: ${chunkId}`
|
|
179
2841
|
});
|
|
180
2842
|
continue;
|
|
@@ -187,29 +2849,68 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
187
2849
|
})).forEach((toolCall) => {
|
|
188
2850
|
if (currentToolCall) {
|
|
189
2851
|
if (toolCall.id && currentToolCall.id !== toolCall.id) {
|
|
190
|
-
|
|
2852
|
+
const toolEndEvent = {
|
|
191
2853
|
toolCallId: currentToolCall.id,
|
|
192
2854
|
type: import_client.EventType.TOOL_CALL_END
|
|
193
|
-
}
|
|
2855
|
+
};
|
|
2856
|
+
logger.debug?.(
|
|
2857
|
+
{
|
|
2858
|
+
toolCallId: currentToolCall.id,
|
|
2859
|
+
toolCallName: currentToolCall.name
|
|
2860
|
+
},
|
|
2861
|
+
"Tool call ended"
|
|
2862
|
+
);
|
|
2863
|
+
logger.trace?.(
|
|
2864
|
+
{ aguiEvent: toolEndEvent },
|
|
2865
|
+
"Emitting AGUI event"
|
|
2866
|
+
);
|
|
2867
|
+
subscriber.next(toolEndEvent);
|
|
194
2868
|
if (toolCall.name && toolCall.id) {
|
|
195
2869
|
currentToolCall = toolCall;
|
|
196
|
-
|
|
2870
|
+
toolCallCount++;
|
|
2871
|
+
const toolStartEvent = {
|
|
197
2872
|
toolCallId: currentToolCall.id,
|
|
198
2873
|
toolCallName: currentToolCall.name,
|
|
199
2874
|
parentMessageId,
|
|
200
2875
|
type: import_client.EventType.TOOL_CALL_START
|
|
201
|
-
}
|
|
2876
|
+
};
|
|
2877
|
+
logger.debug?.(
|
|
2878
|
+
{
|
|
2879
|
+
toolCallId: toolCall.id,
|
|
2880
|
+
toolCallName: toolCall.name
|
|
2881
|
+
},
|
|
2882
|
+
"Tool call started"
|
|
2883
|
+
);
|
|
2884
|
+
logger.trace?.(
|
|
2885
|
+
{ aguiEvent: toolStartEvent },
|
|
2886
|
+
"Emitting AGUI event"
|
|
2887
|
+
);
|
|
2888
|
+
subscriber.next(toolStartEvent);
|
|
202
2889
|
if (currentToolCall.args) {
|
|
203
|
-
|
|
2890
|
+
const toolArgsEvent = {
|
|
204
2891
|
toolCallId: currentToolCall.id,
|
|
205
2892
|
delta: currentToolCall.args,
|
|
206
2893
|
type: import_client.EventType.TOOL_CALL_ARGS
|
|
207
|
-
}
|
|
2894
|
+
};
|
|
2895
|
+
logger.trace?.(
|
|
2896
|
+
{ aguiEvent: toolArgsEvent },
|
|
2897
|
+
"Emitting AGUI event"
|
|
2898
|
+
);
|
|
2899
|
+
subscriber.next(toolArgsEvent);
|
|
208
2900
|
if (isValidJson(currentToolCall.args)) {
|
|
209
|
-
|
|
2901
|
+
const toolEndEvent2 = {
|
|
210
2902
|
toolCallId: currentToolCall.id,
|
|
211
2903
|
type: import_client.EventType.TOOL_CALL_END
|
|
212
|
-
}
|
|
2904
|
+
};
|
|
2905
|
+
logger.debug?.(
|
|
2906
|
+
{ toolCallId: currentToolCall.id },
|
|
2907
|
+
"Tool call ended (args complete)"
|
|
2908
|
+
);
|
|
2909
|
+
logger.trace?.(
|
|
2910
|
+
{ aguiEvent: toolEndEvent2 },
|
|
2911
|
+
"Emitting AGUI event"
|
|
2912
|
+
);
|
|
2913
|
+
subscriber.next(toolEndEvent2);
|
|
213
2914
|
currentToolCall = null;
|
|
214
2915
|
}
|
|
215
2916
|
}
|
|
@@ -217,16 +2918,30 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
217
2918
|
} else {
|
|
218
2919
|
if (toolCall.args) {
|
|
219
2920
|
currentToolCall.args += toolCall.args;
|
|
220
|
-
|
|
2921
|
+
const toolArgsEvent = {
|
|
221
2922
|
toolCallId: currentToolCall.id,
|
|
222
2923
|
delta: toolCall.args,
|
|
223
2924
|
type: import_client.EventType.TOOL_CALL_ARGS
|
|
224
|
-
}
|
|
2925
|
+
};
|
|
2926
|
+
logger.trace?.(
|
|
2927
|
+
{ aguiEvent: toolArgsEvent },
|
|
2928
|
+
"Emitting AGUI event"
|
|
2929
|
+
);
|
|
2930
|
+
subscriber.next(toolArgsEvent);
|
|
225
2931
|
if (isValidJson(currentToolCall.args)) {
|
|
226
|
-
|
|
2932
|
+
const toolEndEvent = {
|
|
227
2933
|
toolCallId: currentToolCall.id,
|
|
228
2934
|
type: import_client.EventType.TOOL_CALL_END
|
|
229
|
-
}
|
|
2935
|
+
};
|
|
2936
|
+
logger.debug?.(
|
|
2937
|
+
{ toolCallId: currentToolCall.id },
|
|
2938
|
+
"Tool call ended (args complete)"
|
|
2939
|
+
);
|
|
2940
|
+
logger.trace?.(
|
|
2941
|
+
{ aguiEvent: toolEndEvent },
|
|
2942
|
+
"Emitting AGUI event"
|
|
2943
|
+
);
|
|
2944
|
+
subscriber.next(toolEndEvent);
|
|
230
2945
|
currentToolCall = null;
|
|
231
2946
|
}
|
|
232
2947
|
}
|
|
@@ -234,23 +2949,47 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
234
2949
|
} else {
|
|
235
2950
|
if (toolCall.name && toolCall.id) {
|
|
236
2951
|
currentToolCall = toolCall;
|
|
237
|
-
|
|
2952
|
+
toolCallCount++;
|
|
2953
|
+
const toolStartEvent = {
|
|
238
2954
|
toolCallId: toolCall.id,
|
|
239
2955
|
toolCallName: toolCall.name,
|
|
240
2956
|
parentMessageId,
|
|
241
2957
|
type: import_client.EventType.TOOL_CALL_START
|
|
242
|
-
}
|
|
2958
|
+
};
|
|
2959
|
+
logger.debug?.(
|
|
2960
|
+
{ toolCallId: toolCall.id, toolCallName: toolCall.name },
|
|
2961
|
+
"Tool call started"
|
|
2962
|
+
);
|
|
2963
|
+
logger.trace?.(
|
|
2964
|
+
{ aguiEvent: toolStartEvent },
|
|
2965
|
+
"Emitting AGUI event"
|
|
2966
|
+
);
|
|
2967
|
+
subscriber.next(toolStartEvent);
|
|
243
2968
|
if (toolCall.args) {
|
|
244
|
-
|
|
2969
|
+
const toolArgsEvent = {
|
|
245
2970
|
toolCallId: toolCall.id,
|
|
246
2971
|
delta: toolCall.args,
|
|
247
2972
|
type: import_client.EventType.TOOL_CALL_ARGS
|
|
248
|
-
}
|
|
2973
|
+
};
|
|
2974
|
+
logger.trace?.(
|
|
2975
|
+
{ aguiEvent: toolArgsEvent },
|
|
2976
|
+
"Emitting AGUI event"
|
|
2977
|
+
);
|
|
2978
|
+
subscriber.next(toolArgsEvent);
|
|
249
2979
|
if (isValidJson(toolCall.args)) {
|
|
250
|
-
|
|
2980
|
+
const toolEndEvent = {
|
|
251
2981
|
toolCallId: toolCall.id,
|
|
252
2982
|
type: import_client.EventType.TOOL_CALL_END
|
|
253
|
-
}
|
|
2983
|
+
};
|
|
2984
|
+
logger.debug?.(
|
|
2985
|
+
{ toolCallId: toolCall.id },
|
|
2986
|
+
"Tool call ended (args complete)"
|
|
2987
|
+
);
|
|
2988
|
+
logger.trace?.(
|
|
2989
|
+
{ aguiEvent: toolEndEvent },
|
|
2990
|
+
"Emitting AGUI event"
|
|
2991
|
+
);
|
|
2992
|
+
subscriber.next(toolEndEvent);
|
|
254
2993
|
currentToolCall = null;
|
|
255
2994
|
}
|
|
256
2995
|
}
|
|
@@ -260,11 +2999,17 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
260
2999
|
}
|
|
261
3000
|
const delta = event.data.chunk.content;
|
|
262
3001
|
if (typeof delta === "string" && delta) {
|
|
263
|
-
|
|
3002
|
+
textChunkCount++;
|
|
3003
|
+
const textContentEvent = {
|
|
264
3004
|
messageId: chatModelRun.messageId,
|
|
265
3005
|
type: import_client.EventType.TEXT_MESSAGE_CONTENT,
|
|
266
3006
|
delta
|
|
267
|
-
}
|
|
3007
|
+
};
|
|
3008
|
+
logger.trace?.(
|
|
3009
|
+
{ aguiEvent: textContentEvent },
|
|
3010
|
+
"Emitting AGUI event"
|
|
3011
|
+
);
|
|
3012
|
+
subscriber.next(textContentEvent);
|
|
268
3013
|
}
|
|
269
3014
|
continue;
|
|
270
3015
|
}
|
|
@@ -273,16 +3018,27 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
273
3018
|
(run) => run.runId === event.run_id
|
|
274
3019
|
);
|
|
275
3020
|
if (!chatModelRun) {
|
|
3021
|
+
logger.warn?.(
|
|
3022
|
+
{ chatModelRunId: event.run_id },
|
|
3023
|
+
"Received on_chat_model_end from unknown run"
|
|
3024
|
+
);
|
|
276
3025
|
subscriber.next({
|
|
277
3026
|
type: import_client.EventType.RUN_ERROR,
|
|
3027
|
+
code: "INTERNAL_ERROR",
|
|
278
3028
|
message: `Received a on_chat_model_end event from an unknown chat model run. Run Id: ${event.run_id}`
|
|
279
3029
|
});
|
|
280
3030
|
continue;
|
|
281
3031
|
}
|
|
282
|
-
|
|
3032
|
+
const textEndEvent = {
|
|
283
3033
|
type: import_client.EventType.TEXT_MESSAGE_END,
|
|
284
3034
|
messageId: chatModelRun.messageId
|
|
285
|
-
}
|
|
3035
|
+
};
|
|
3036
|
+
logger.debug?.(
|
|
3037
|
+
{ messageId: chatModelRun.messageId },
|
|
3038
|
+
"Text message ended"
|
|
3039
|
+
);
|
|
3040
|
+
logger.trace?.({ aguiEvent: textEndEvent }, "Emitting AGUI event");
|
|
3041
|
+
subscriber.next(textEndEvent);
|
|
286
3042
|
continue;
|
|
287
3043
|
}
|
|
288
3044
|
if (event.event === "on_tool_end") {
|
|
@@ -295,57 +3051,115 @@ var LanggraphAgent = class extends import_client.AbstractAgent {
|
|
|
295
3051
|
toolMessage.lc_kwargs.id = toolMessage.id;
|
|
296
3052
|
}
|
|
297
3053
|
}
|
|
298
|
-
|
|
3054
|
+
const toolResultEvent = {
|
|
299
3055
|
toolCallId: toolMessage.tool_call_id,
|
|
300
3056
|
type: import_client.EventType.TOOL_CALL_RESULT,
|
|
301
3057
|
content: typeof toolMessage.content === "string" ? toolMessage.content : JSON.stringify(toolMessage.content),
|
|
302
3058
|
messageId: toolMessage.id
|
|
303
|
-
}
|
|
3059
|
+
};
|
|
3060
|
+
logger.debug?.(
|
|
3061
|
+
{
|
|
3062
|
+
toolCallId: toolMessage.tool_call_id,
|
|
3063
|
+
messageId: toolMessage.id
|
|
3064
|
+
},
|
|
3065
|
+
"Tool call result received"
|
|
3066
|
+
);
|
|
3067
|
+
logger.trace?.(
|
|
3068
|
+
{ aguiEvent: toolResultEvent },
|
|
3069
|
+
"Emitting AGUI event"
|
|
3070
|
+
);
|
|
3071
|
+
subscriber.next(toolResultEvent);
|
|
304
3072
|
handledToolCallIds.add(toolMessage.tool_call_id);
|
|
3073
|
+
} else {
|
|
3074
|
+
logger.trace?.(
|
|
3075
|
+
{ toolCallId: toolMessage.tool_call_id },
|
|
3076
|
+
"Skipping duplicate tool call result"
|
|
3077
|
+
);
|
|
305
3078
|
}
|
|
306
3079
|
}
|
|
307
3080
|
continue;
|
|
308
3081
|
}
|
|
309
|
-
if (event.event === "on_chain_stream"
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
3082
|
+
if (event.event === "on_chain_stream") {
|
|
3083
|
+
const chunk = event.data.chunk;
|
|
3084
|
+
if (chunk?.messages && Array.isArray(chunk.messages)) {
|
|
3085
|
+
logger.trace?.(
|
|
3086
|
+
{
|
|
3087
|
+
nodeName: event.name,
|
|
3088
|
+
stateMessages: chunk.messages.map((m) => ({
|
|
3089
|
+
type: m.type,
|
|
3090
|
+
id: m.id,
|
|
3091
|
+
contentPreview: typeof m.content === "string" ? m.content.slice(0, 100) : "[non-string content]",
|
|
3092
|
+
hasToolCalls: "tool_calls" in m && Array.isArray(m.tool_calls) && m.tool_calls.length > 0,
|
|
3093
|
+
toolCallId: "tool_call_id" in m ? m.tool_call_id : void 0
|
|
3094
|
+
})),
|
|
3095
|
+
messageCount: chunk.messages.length
|
|
3096
|
+
},
|
|
3097
|
+
"State update with messages"
|
|
3098
|
+
);
|
|
3099
|
+
}
|
|
3100
|
+
if (chunk?.__interrupt__ && Array.isArray(chunk.__interrupt__) && chunk.__interrupt__.length > 0) {
|
|
3101
|
+
const rawInterrupt = chunk.__interrupt__[0];
|
|
3102
|
+
logger.debug?.(
|
|
3103
|
+
{ interruptId: rawInterrupt.id },
|
|
3104
|
+
"Interrupt received"
|
|
3105
|
+
);
|
|
3106
|
+
interrupt = {
|
|
3107
|
+
id: rawInterrupt.id,
|
|
3108
|
+
// TODO: replace with actual reason
|
|
3109
|
+
reason: "agent requested interrupt",
|
|
3110
|
+
payload: rawInterrupt.value
|
|
3111
|
+
};
|
|
3112
|
+
}
|
|
317
3113
|
}
|
|
318
3114
|
}
|
|
3115
|
+
const stats = { eventCount, toolCallCount, textChunkCount };
|
|
319
3116
|
if (interrupt) {
|
|
320
|
-
|
|
3117
|
+
const runFinishedEvent = {
|
|
321
3118
|
type: import_client.EventType.RUN_FINISHED,
|
|
322
3119
|
threadId,
|
|
323
3120
|
runId,
|
|
324
3121
|
outcome: "interrupt",
|
|
325
3122
|
interrupt
|
|
326
|
-
}
|
|
3123
|
+
};
|
|
3124
|
+
logger.info?.(
|
|
3125
|
+
{ outcome: "interrupt", interruptId: interrupt.id, ...stats },
|
|
3126
|
+
"Run finished with interrupt"
|
|
3127
|
+
);
|
|
3128
|
+
logger.trace?.({ aguiEvent: runFinishedEvent }, "Emitting AGUI event");
|
|
3129
|
+
subscriber.next(runFinishedEvent);
|
|
327
3130
|
} else {
|
|
328
|
-
|
|
3131
|
+
const runFinishedEvent = {
|
|
329
3132
|
type: import_client.EventType.RUN_FINISHED,
|
|
330
3133
|
threadId,
|
|
331
3134
|
runId
|
|
332
|
-
}
|
|
3135
|
+
};
|
|
3136
|
+
logger.info?.({ outcome: "complete", ...stats }, "Run finished");
|
|
3137
|
+
logger.trace?.({ aguiEvent: runFinishedEvent }, "Emitting AGUI event");
|
|
3138
|
+
subscriber.next(runFinishedEvent);
|
|
333
3139
|
}
|
|
334
3140
|
} catch (error) {
|
|
335
|
-
|
|
3141
|
+
logger.error?.(
|
|
3142
|
+
{ err: error, eventCount, toolCallCount, textChunkCount },
|
|
3143
|
+
"Error during stream processing"
|
|
3144
|
+
);
|
|
3145
|
+
const errorCode = (0, import_agent_shared.isErrorWithCode)(error) ? error.code : "INTERNAL_ERROR";
|
|
3146
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
336
3147
|
subscriber.next({
|
|
337
3148
|
type: import_client.EventType.RUN_ERROR,
|
|
338
|
-
|
|
3149
|
+
code: errorCode,
|
|
3150
|
+
message: errorMessage
|
|
339
3151
|
});
|
|
340
3152
|
}
|
|
341
3153
|
subscriber.complete();
|
|
342
3154
|
}
|
|
343
3155
|
clone() {
|
|
344
3156
|
const workflow = this.compiledWorkflow;
|
|
3157
|
+
const logger = this.logger;
|
|
345
3158
|
this.compiledWorkflow = void 0;
|
|
346
3159
|
const cloned = super.clone();
|
|
347
3160
|
this.compiledWorkflow = workflow;
|
|
348
3161
|
cloned.compiledWorkflow = workflow;
|
|
3162
|
+
cloned.logger = logger;
|
|
349
3163
|
return cloned;
|
|
350
3164
|
}
|
|
351
3165
|
};
|
|
@@ -397,8 +3211,7 @@ function aguiMessagesToLangChain(messages) {
|
|
|
397
3211
|
id: message.id
|
|
398
3212
|
};
|
|
399
3213
|
default:
|
|
400
|
-
|
|
401
|
-
throw new Error("message role is not supported.");
|
|
3214
|
+
throw new Error(`Message role ${message.role} is not supported.`);
|
|
402
3215
|
}
|
|
403
3216
|
});
|
|
404
3217
|
}
|
|
@@ -1086,12 +3899,17 @@ var TDAIStore = class extends import_langgraph3.BaseStore {
|
|
|
1086
3899
|
}
|
|
1087
3900
|
}
|
|
1088
3901
|
};
|
|
3902
|
+
|
|
3903
|
+
// src/index.ts
|
|
3904
|
+
var import_agent_shared2 = require("@cloudbase/agent-shared");
|
|
1089
3905
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1090
3906
|
0 && (module.exports = {
|
|
1091
3907
|
ClientPropertiesAnnotation,
|
|
1092
3908
|
ClientStateAnnotation,
|
|
1093
3909
|
LanggraphAgent,
|
|
1094
3910
|
TDAISaver,
|
|
1095
|
-
TDAIStore
|
|
3911
|
+
TDAIStore,
|
|
3912
|
+
createConsoleLogger,
|
|
3913
|
+
noopLogger
|
|
1096
3914
|
});
|
|
1097
3915
|
//# sourceMappingURL=index.js.map
|