@microsoft/opentelemetry 0.1.0-alpha.2 → 0.1.0-alpha.3

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.
Files changed (260) hide show
  1. package/dist/commonjs/a365/configuration/A365Configuration.d.ts +42 -0
  2. package/dist/commonjs/a365/configuration/A365Configuration.d.ts.map +1 -0
  3. package/dist/commonjs/a365/configuration/A365Configuration.js +162 -0
  4. package/dist/commonjs/a365/configuration/A365Configuration.js.map +1 -0
  5. package/dist/commonjs/a365/configuration/A365ConfigurationOptions.d.ts +53 -0
  6. package/dist/commonjs/a365/configuration/A365ConfigurationOptions.d.ts.map +1 -0
  7. package/dist/commonjs/a365/configuration/A365ConfigurationOptions.js +5 -0
  8. package/dist/commonjs/a365/configuration/A365ConfigurationOptions.js.map +1 -0
  9. package/dist/commonjs/a365/configuration/index.d.ts +3 -0
  10. package/dist/commonjs/a365/configuration/index.d.ts.map +1 -0
  11. package/dist/commonjs/a365/configuration/index.js +9 -0
  12. package/dist/commonjs/a365/configuration/index.js.map +1 -0
  13. package/dist/commonjs/a365/constants.d.ts +76 -0
  14. package/dist/commonjs/a365/constants.d.ts.map +1 -0
  15. package/dist/commonjs/a365/constants.js +99 -0
  16. package/dist/commonjs/a365/constants.js.map +1 -0
  17. package/dist/commonjs/a365/context/tokenContext.d.ts +25 -0
  18. package/dist/commonjs/a365/context/tokenContext.d.ts.map +1 -0
  19. package/dist/commonjs/a365/context/tokenContext.js +67 -0
  20. package/dist/commonjs/a365/context/tokenContext.js.map +1 -0
  21. package/dist/commonjs/a365/context.d.ts +31 -0
  22. package/dist/commonjs/a365/context.d.ts.map +1 -0
  23. package/dist/commonjs/a365/context.js +109 -0
  24. package/dist/commonjs/a365/context.js.map +1 -0
  25. package/dist/commonjs/a365/contracts.d.ts +250 -0
  26. package/dist/commonjs/a365/contracts.d.ts.map +1 -0
  27. package/dist/commonjs/a365/contracts.js +52 -0
  28. package/dist/commonjs/a365/contracts.js.map +1 -0
  29. package/dist/commonjs/a365/exporter/Agent365Exporter.d.ts +25 -0
  30. package/dist/commonjs/a365/exporter/Agent365Exporter.d.ts.map +1 -0
  31. package/dist/commonjs/a365/exporter/Agent365Exporter.js +220 -0
  32. package/dist/commonjs/a365/exporter/Agent365Exporter.js.map +1 -0
  33. package/dist/commonjs/a365/exporter/Agent365ExporterOptions.d.ts +43 -0
  34. package/dist/commonjs/a365/exporter/Agent365ExporterOptions.d.ts.map +1 -0
  35. package/dist/commonjs/a365/exporter/Agent365ExporterOptions.js +30 -0
  36. package/dist/commonjs/a365/exporter/Agent365ExporterOptions.js.map +1 -0
  37. package/dist/commonjs/a365/exporter/ExporterEventNames.d.ts +9 -0
  38. package/dist/commonjs/a365/exporter/ExporterEventNames.d.ts.map +1 -0
  39. package/dist/commonjs/a365/exporter/ExporterEventNames.js +15 -0
  40. package/dist/commonjs/a365/exporter/ExporterEventNames.js.map +1 -0
  41. package/dist/commonjs/a365/exporter/index.d.ts +6 -0
  42. package/dist/commonjs/a365/exporter/index.d.ts.map +1 -0
  43. package/dist/commonjs/a365/exporter/index.js +15 -0
  44. package/dist/commonjs/a365/exporter/index.js.map +1 -0
  45. package/dist/commonjs/a365/exporter/utils.d.ts +41 -0
  46. package/dist/commonjs/a365/exporter/utils.d.ts.map +1 -0
  47. package/dist/commonjs/a365/exporter/utils.js +410 -0
  48. package/dist/commonjs/a365/exporter/utils.js.map +1 -0
  49. package/dist/commonjs/a365/index.d.ts +16 -0
  50. package/dist/commonjs/a365/index.d.ts.map +1 -0
  51. package/dist/commonjs/a365/index.js +54 -0
  52. package/dist/commonjs/a365/index.js.map +1 -0
  53. package/dist/commonjs/a365/message-utils.d.ts +42 -0
  54. package/dist/commonjs/a365/message-utils.d.ts.map +1 -0
  55. package/dist/commonjs/a365/message-utils.js +116 -0
  56. package/dist/commonjs/a365/message-utils.js.map +1 -0
  57. package/dist/commonjs/a365/middleware/BaggageBuilder.d.ts +112 -0
  58. package/dist/commonjs/a365/middleware/BaggageBuilder.d.ts.map +1 -0
  59. package/dist/commonjs/a365/middleware/BaggageBuilder.js +249 -0
  60. package/dist/commonjs/a365/middleware/BaggageBuilder.js.map +1 -0
  61. package/dist/commonjs/a365/middleware/index.d.ts +2 -0
  62. package/dist/commonjs/a365/middleware/index.d.ts.map +1 -0
  63. package/dist/commonjs/a365/middleware/index.js +9 -0
  64. package/dist/commonjs/a365/middleware/index.js.map +1 -0
  65. package/dist/commonjs/a365/processors/A365SpanProcessor.d.ts +32 -0
  66. package/dist/commonjs/a365/processors/A365SpanProcessor.d.ts.map +1 -0
  67. package/dist/commonjs/a365/processors/A365SpanProcessor.js +104 -0
  68. package/dist/commonjs/a365/processors/A365SpanProcessor.js.map +1 -0
  69. package/dist/commonjs/a365/processors/PerRequestSpanProcessor.d.ts +44 -0
  70. package/dist/commonjs/a365/processors/PerRequestSpanProcessor.d.ts.map +1 -0
  71. package/dist/commonjs/a365/processors/PerRequestSpanProcessor.js +260 -0
  72. package/dist/commonjs/a365/processors/PerRequestSpanProcessor.js.map +1 -0
  73. package/dist/commonjs/a365/processors/index.d.ts +5 -0
  74. package/dist/commonjs/a365/processors/index.d.ts.map +1 -0
  75. package/dist/commonjs/a365/processors/index.js +13 -0
  76. package/dist/commonjs/a365/processors/index.js.map +1 -0
  77. package/dist/commonjs/a365/processors/util.d.ts +10 -0
  78. package/dist/commonjs/a365/processors/util.d.ts.map +1 -0
  79. package/dist/commonjs/a365/processors/util.js +56 -0
  80. package/dist/commonjs/a365/processors/util.js.map +1 -0
  81. package/dist/commonjs/a365/scopes/ExecuteToolScope.d.ts +24 -0
  82. package/dist/commonjs/a365/scopes/ExecuteToolScope.d.ts.map +1 -0
  83. package/dist/commonjs/a365/scopes/ExecuteToolScope.js +60 -0
  84. package/dist/commonjs/a365/scopes/ExecuteToolScope.js.map +1 -0
  85. package/dist/commonjs/a365/scopes/InferenceScope.d.ts +29 -0
  86. package/dist/commonjs/a365/scopes/InferenceScope.d.ts.map +1 -0
  87. package/dist/commonjs/a365/scopes/InferenceScope.js +75 -0
  88. package/dist/commonjs/a365/scopes/InferenceScope.js.map +1 -0
  89. package/dist/commonjs/a365/scopes/InvokeAgentScope.d.ts +25 -0
  90. package/dist/commonjs/a365/scopes/InvokeAgentScope.d.ts.map +1 -0
  91. package/dist/commonjs/a365/scopes/InvokeAgentScope.js +84 -0
  92. package/dist/commonjs/a365/scopes/InvokeAgentScope.js.map +1 -0
  93. package/dist/commonjs/a365/scopes/OpenTelemetryScope.d.ts +59 -0
  94. package/dist/commonjs/a365/scopes/OpenTelemetryScope.d.ts.map +1 -0
  95. package/dist/commonjs/a365/scopes/OpenTelemetryScope.js +199 -0
  96. package/dist/commonjs/a365/scopes/OpenTelemetryScope.js.map +1 -0
  97. package/dist/commonjs/a365/scopes/OutputScope.d.ts +26 -0
  98. package/dist/commonjs/a365/scopes/OutputScope.d.ts.map +1 -0
  99. package/dist/commonjs/a365/scopes/OutputScope.js +73 -0
  100. package/dist/commonjs/a365/scopes/OutputScope.js.map +1 -0
  101. package/dist/commonjs/a365/scopes/index.d.ts +6 -0
  102. package/dist/commonjs/a365/scopes/index.d.ts.map +1 -0
  103. package/dist/commonjs/a365/scopes/index.js +16 -0
  104. package/dist/commonjs/a365/scopes/index.js.map +1 -0
  105. package/dist/commonjs/a365/utils/utils.d.ts +6 -0
  106. package/dist/commonjs/a365/utils/utils.d.ts.map +1 -0
  107. package/dist/commonjs/a365/utils/utils.js +14 -0
  108. package/dist/commonjs/a365/utils/utils.js.map +1 -0
  109. package/dist/commonjs/azureMonitor/metrics/quickpulse/types.d.ts +1 -1
  110. package/dist/commonjs/azureMonitor/traces/handler.d.ts.map +1 -1
  111. package/dist/commonjs/azureMonitor/traces/handler.js +8 -2
  112. package/dist/commonjs/azureMonitor/traces/handler.js.map +1 -1
  113. package/dist/commonjs/distro/distro.d.ts +1 -1
  114. package/dist/commonjs/distro/distro.d.ts.map +1 -1
  115. package/dist/commonjs/distro/distro.js +44 -92
  116. package/dist/commonjs/distro/distro.js.map +1 -1
  117. package/dist/commonjs/distro/types.d.ts +2 -1
  118. package/dist/commonjs/distro/types.d.ts.map +1 -1
  119. package/dist/commonjs/index.d.ts +5 -0
  120. package/dist/commonjs/index.d.ts.map +1 -1
  121. package/dist/commonjs/index.js +33 -1
  122. package/dist/commonjs/index.js.map +1 -1
  123. package/dist/commonjs/package.json +1 -0
  124. package/dist/commonjs/shared/jsonConfig.d.ts +2 -1
  125. package/dist/commonjs/shared/jsonConfig.d.ts.map +1 -1
  126. package/dist/commonjs/shared/module.js +15 -11
  127. package/dist/commonjs/shared/module.js.map +1 -1
  128. package/dist/commonjs/types.d.ts +4 -30
  129. package/dist/commonjs/types.d.ts.map +1 -1
  130. package/dist/commonjs/types.js +1 -1
  131. package/dist/commonjs/types.js.map +1 -1
  132. package/dist/esm/a365/configuration/A365Configuration.d.ts +42 -0
  133. package/dist/esm/a365/configuration/A365Configuration.d.ts.map +1 -0
  134. package/dist/esm/a365/configuration/A365Configuration.js +158 -0
  135. package/dist/esm/a365/configuration/A365Configuration.js.map +1 -0
  136. package/dist/esm/a365/configuration/A365ConfigurationOptions.d.ts +53 -0
  137. package/dist/esm/a365/configuration/A365ConfigurationOptions.d.ts.map +1 -0
  138. package/dist/esm/a365/configuration/A365ConfigurationOptions.js +4 -0
  139. package/dist/esm/a365/configuration/A365ConfigurationOptions.js.map +1 -0
  140. package/dist/esm/a365/configuration/index.d.ts +3 -0
  141. package/dist/esm/a365/configuration/index.d.ts.map +1 -0
  142. package/dist/esm/a365/configuration/index.js +4 -0
  143. package/dist/esm/a365/configuration/index.js.map +1 -0
  144. package/dist/esm/a365/constants.d.ts +76 -0
  145. package/dist/esm/a365/constants.d.ts.map +1 -0
  146. package/dist/esm/a365/constants.js +95 -0
  147. package/dist/esm/a365/constants.js.map +1 -0
  148. package/dist/esm/a365/context/tokenContext.d.ts +25 -0
  149. package/dist/esm/a365/context/tokenContext.d.ts.map +1 -0
  150. package/dist/esm/a365/context/tokenContext.js +62 -0
  151. package/dist/esm/a365/context/tokenContext.js.map +1 -0
  152. package/dist/esm/a365/context.d.ts +31 -0
  153. package/dist/esm/a365/context.d.ts.map +1 -0
  154. package/dist/esm/a365/context.js +101 -0
  155. package/dist/esm/a365/context.js.map +1 -0
  156. package/dist/esm/a365/contracts.d.ts +250 -0
  157. package/dist/esm/a365/contracts.d.ts.map +1 -0
  158. package/dist/esm/a365/contracts.js +49 -0
  159. package/dist/esm/a365/contracts.js.map +1 -0
  160. package/dist/esm/a365/exporter/Agent365Exporter.d.ts +25 -0
  161. package/dist/esm/a365/exporter/Agent365Exporter.d.ts.map +1 -0
  162. package/dist/esm/a365/exporter/Agent365Exporter.js +216 -0
  163. package/dist/esm/a365/exporter/Agent365Exporter.js.map +1 -0
  164. package/dist/esm/a365/exporter/Agent365ExporterOptions.d.ts +43 -0
  165. package/dist/esm/a365/exporter/Agent365ExporterOptions.d.ts.map +1 -0
  166. package/dist/esm/a365/exporter/Agent365ExporterOptions.js +26 -0
  167. package/dist/esm/a365/exporter/Agent365ExporterOptions.js.map +1 -0
  168. package/dist/esm/a365/exporter/ExporterEventNames.d.ts +9 -0
  169. package/dist/esm/a365/exporter/ExporterEventNames.d.ts.map +1 -0
  170. package/dist/esm/a365/exporter/ExporterEventNames.js +12 -0
  171. package/dist/esm/a365/exporter/ExporterEventNames.js.map +1 -0
  172. package/dist/esm/a365/exporter/index.d.ts +6 -0
  173. package/dist/esm/a365/exporter/index.d.ts.map +1 -0
  174. package/dist/esm/a365/exporter/index.js +7 -0
  175. package/dist/esm/a365/exporter/index.js.map +1 -0
  176. package/dist/esm/a365/exporter/utils.d.ts +41 -0
  177. package/dist/esm/a365/exporter/utils.d.ts.map +1 -0
  178. package/dist/esm/a365/exporter/utils.js +398 -0
  179. package/dist/esm/a365/exporter/utils.js.map +1 -0
  180. package/dist/esm/a365/index.d.ts +16 -0
  181. package/dist/esm/a365/index.d.ts.map +1 -0
  182. package/dist/esm/a365/index.js +20 -0
  183. package/dist/esm/a365/index.js.map +1 -0
  184. package/dist/esm/a365/message-utils.d.ts +42 -0
  185. package/dist/esm/a365/message-utils.d.ts.map +1 -0
  186. package/dist/esm/a365/message-utils.js +107 -0
  187. package/dist/esm/a365/message-utils.js.map +1 -0
  188. package/dist/esm/a365/middleware/BaggageBuilder.d.ts +112 -0
  189. package/dist/esm/a365/middleware/BaggageBuilder.d.ts.map +1 -0
  190. package/dist/esm/a365/middleware/BaggageBuilder.js +244 -0
  191. package/dist/esm/a365/middleware/BaggageBuilder.js.map +1 -0
  192. package/dist/esm/a365/middleware/index.d.ts +2 -0
  193. package/dist/esm/a365/middleware/index.d.ts.map +1 -0
  194. package/dist/esm/a365/middleware/index.js +4 -0
  195. package/dist/esm/a365/middleware/index.js.map +1 -0
  196. package/dist/esm/a365/processors/A365SpanProcessor.d.ts +32 -0
  197. package/dist/esm/a365/processors/A365SpanProcessor.d.ts.map +1 -0
  198. package/dist/esm/a365/processors/A365SpanProcessor.js +100 -0
  199. package/dist/esm/a365/processors/A365SpanProcessor.js.map +1 -0
  200. package/dist/esm/a365/processors/PerRequestSpanProcessor.d.ts +44 -0
  201. package/dist/esm/a365/processors/PerRequestSpanProcessor.d.ts.map +1 -0
  202. package/dist/esm/a365/processors/PerRequestSpanProcessor.js +256 -0
  203. package/dist/esm/a365/processors/PerRequestSpanProcessor.js.map +1 -0
  204. package/dist/esm/a365/processors/index.d.ts +5 -0
  205. package/dist/esm/a365/processors/index.d.ts.map +1 -0
  206. package/dist/esm/a365/processors/index.js +6 -0
  207. package/dist/esm/a365/processors/index.js.map +1 -0
  208. package/dist/esm/a365/processors/util.d.ts +10 -0
  209. package/dist/esm/a365/processors/util.d.ts.map +1 -0
  210. package/dist/esm/a365/processors/util.js +53 -0
  211. package/dist/esm/a365/processors/util.js.map +1 -0
  212. package/dist/esm/a365/scopes/ExecuteToolScope.d.ts +24 -0
  213. package/dist/esm/a365/scopes/ExecuteToolScope.d.ts.map +1 -0
  214. package/dist/esm/a365/scopes/ExecuteToolScope.js +56 -0
  215. package/dist/esm/a365/scopes/ExecuteToolScope.js.map +1 -0
  216. package/dist/esm/a365/scopes/InferenceScope.d.ts +29 -0
  217. package/dist/esm/a365/scopes/InferenceScope.d.ts.map +1 -0
  218. package/dist/esm/a365/scopes/InferenceScope.js +71 -0
  219. package/dist/esm/a365/scopes/InferenceScope.js.map +1 -0
  220. package/dist/esm/a365/scopes/InvokeAgentScope.d.ts +25 -0
  221. package/dist/esm/a365/scopes/InvokeAgentScope.d.ts.map +1 -0
  222. package/dist/esm/a365/scopes/InvokeAgentScope.js +80 -0
  223. package/dist/esm/a365/scopes/InvokeAgentScope.js.map +1 -0
  224. package/dist/esm/a365/scopes/OpenTelemetryScope.d.ts +59 -0
  225. package/dist/esm/a365/scopes/OpenTelemetryScope.d.ts.map +1 -0
  226. package/dist/esm/a365/scopes/OpenTelemetryScope.js +195 -0
  227. package/dist/esm/a365/scopes/OpenTelemetryScope.js.map +1 -0
  228. package/dist/esm/a365/scopes/OutputScope.d.ts +26 -0
  229. package/dist/esm/a365/scopes/OutputScope.d.ts.map +1 -0
  230. package/dist/esm/a365/scopes/OutputScope.js +69 -0
  231. package/dist/esm/a365/scopes/OutputScope.js.map +1 -0
  232. package/dist/esm/a365/scopes/index.d.ts +6 -0
  233. package/dist/esm/a365/scopes/index.d.ts.map +1 -0
  234. package/dist/esm/a365/scopes/index.js +8 -0
  235. package/dist/esm/a365/scopes/index.js.map +1 -0
  236. package/dist/esm/a365/utils/utils.d.ts +6 -0
  237. package/dist/esm/a365/utils/utils.d.ts.map +1 -0
  238. package/dist/esm/a365/utils/utils.js +11 -0
  239. package/dist/esm/a365/utils/utils.js.map +1 -0
  240. package/dist/esm/azureMonitor/metrics/quickpulse/types.d.ts +1 -1
  241. package/dist/esm/azureMonitor/traces/handler.d.ts.map +1 -1
  242. package/dist/esm/azureMonitor/traces/handler.js +5 -1
  243. package/dist/esm/azureMonitor/traces/handler.js.map +1 -1
  244. package/dist/esm/distro/distro.d.ts +1 -1
  245. package/dist/esm/distro/distro.d.ts.map +1 -1
  246. package/dist/esm/distro/distro.js +44 -92
  247. package/dist/esm/distro/distro.js.map +1 -1
  248. package/dist/esm/distro/types.d.ts +2 -1
  249. package/dist/esm/distro/types.d.ts.map +1 -1
  250. package/dist/esm/index.d.ts +5 -0
  251. package/dist/esm/index.d.ts.map +1 -1
  252. package/dist/esm/index.js +4 -0
  253. package/dist/esm/index.js.map +1 -1
  254. package/dist/esm/shared/jsonConfig.d.ts +2 -1
  255. package/dist/esm/shared/jsonConfig.d.ts.map +1 -1
  256. package/dist/esm/types.d.ts +4 -30
  257. package/dist/esm/types.d.ts.map +1 -1
  258. package/dist/esm/types.js +1 -1
  259. package/dist/esm/types.js.map +1 -1
  260. package/package.json +3 -4
@@ -0,0 +1,410 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.MAX_SPAN_SIZE_BYTES = void 0;
6
+ exports.partitionByIdentity = partitionByIdentity;
7
+ exports.parseIdentityKey = parseIdentityKey;
8
+ exports.hexTraceId = hexTraceId;
9
+ exports.hexSpanId = hexSpanId;
10
+ exports.asStr = asStr;
11
+ exports.kindName = kindName;
12
+ exports.statusName = statusName;
13
+ exports.resolveAgent365Endpoint = resolveAgent365Endpoint;
14
+ exports.truncateSpan = truncateSpan;
15
+ const api_1 = require("@opentelemetry/api");
16
+ const index_js_1 = require("../../shared/logging/index.js");
17
+ const ExporterEventNames_js_1 = require("./ExporterEventNames.js");
18
+ const semconv_js_1 = require("../../genai/semconv.js");
19
+ const contracts_js_1 = require("../contracts.js");
20
+ // Message attribute keys that receive special truncation handling
21
+ const MESSAGE_ATTR_KEYS = new Set([
22
+ semconv_js_1.ATTR_GEN_AI_INPUT_MESSAGES,
23
+ semconv_js_1.ATTR_GEN_AI_OUTPUT_MESSAGES,
24
+ ]);
25
+ const MESSAGE_ROLE_SYSTEM = "system";
26
+ /**
27
+ * Partition spans by (tenantId, agentId) identity pairs.
28
+ * Spans missing either attribute are skipped.
29
+ */
30
+ function partitionByIdentity(spans) {
31
+ const groups = new Map();
32
+ let skippedCount = 0;
33
+ for (const span of spans) {
34
+ const attrs = span.attributes || {};
35
+ const tenant = asStr(attrs[semconv_js_1.ATTR_MICROSOFT_TENANT_ID]);
36
+ const agent = asStr(attrs[semconv_js_1.ATTR_GEN_AI_AGENT_ID]);
37
+ if (!tenant || !agent) {
38
+ skippedCount++;
39
+ continue;
40
+ }
41
+ const key = `${tenant}:${agent}`;
42
+ let existing = groups.get(key);
43
+ if (!existing) {
44
+ existing = [];
45
+ groups.set(key, existing);
46
+ }
47
+ existing.push(span);
48
+ }
49
+ if (skippedCount > 0) {
50
+ index_js_1.Logger.getInstance().info(`[${ExporterEventNames_js_1.ExporterEventNames.EXPORT_PARTITION_SPAN_MISSING_IDENTITY}] ${skippedCount} spans skipped (missing tenant or agent ID)`);
51
+ }
52
+ return groups;
53
+ }
54
+ /** Parse identity key back to tenant and agent IDs. */
55
+ function parseIdentityKey(key) {
56
+ const idx = key.indexOf(":");
57
+ return { tenantId: key.slice(0, idx), agentId: key.slice(idx + 1) };
58
+ }
59
+ /** Convert trace ID to hex string (32 hex chars). */
60
+ function hexTraceId(value) {
61
+ if (typeof value === "number") {
62
+ return value.toString(16).padStart(32, "0");
63
+ }
64
+ return value.replace(/^0x/, "").padStart(32, "0");
65
+ }
66
+ /** Convert span ID to hex string (16 hex chars). */
67
+ function hexSpanId(value) {
68
+ if (typeof value === "number") {
69
+ return value.toString(16).padStart(16, "0");
70
+ }
71
+ return value.replace(/^0x/, "").padStart(16, "0");
72
+ }
73
+ /** Convert any value to a trimmed string, or undefined if empty/null. */
74
+ function asStr(v) {
75
+ if (v === null || v === undefined)
76
+ return undefined;
77
+ const s = String(v);
78
+ return s.trim() ? s : undefined;
79
+ }
80
+ /** Get span kind name. */
81
+ function kindName(kind) {
82
+ switch (kind) {
83
+ case api_1.SpanKind.INTERNAL:
84
+ return "INTERNAL";
85
+ case api_1.SpanKind.SERVER:
86
+ return "SERVER";
87
+ case api_1.SpanKind.CLIENT:
88
+ return "CLIENT";
89
+ case api_1.SpanKind.PRODUCER:
90
+ return "PRODUCER";
91
+ case api_1.SpanKind.CONSUMER:
92
+ return "CONSUMER";
93
+ default:
94
+ return "UNSPECIFIED";
95
+ }
96
+ }
97
+ /** Get status name. */
98
+ function statusName(code) {
99
+ switch (code) {
100
+ case api_1.SpanStatusCode.UNSET:
101
+ return "UNSET";
102
+ case api_1.SpanStatusCode.OK:
103
+ return "OK";
104
+ case api_1.SpanStatusCode.ERROR:
105
+ return "ERROR";
106
+ default:
107
+ return "UNSET";
108
+ }
109
+ }
110
+ /**
111
+ * Resolve the Agent365 service endpoint base URI for a given cluster category.
112
+ */
113
+ function resolveAgent365Endpoint(clusterCategory) {
114
+ switch (clusterCategory) {
115
+ case "prod":
116
+ return "https://agent365.svc.cloud.microsoft";
117
+ default:
118
+ throw new Error(`Unsupported Agent365 cluster category "${clusterCategory}". ` +
119
+ "Configure an explicit domain override or add a mapped endpoint for this cluster category.");
120
+ }
121
+ }
122
+ // ── Span truncation ─────────────────────────────────────────────────────────
123
+ /** Maximum allowed span size in bytes (250KB). */
124
+ exports.MAX_SPAN_SIZE_BYTES = 250 * 1024;
125
+ const BLOB_SENTINEL = "[blob truncated]";
126
+ const JSON_SENTINEL = "[truncated]";
127
+ const TRUNCATED_SUFFIX = "… [truncated]";
128
+ const TRUNCATED_SUFFIX_BYTES = Buffer.byteLength(TRUNCATED_SUFFIX, "utf8");
129
+ const OVERLIMIT_SENTINEL = "[overlimit]";
130
+ const MIN_SHRINKABLE_STRING_BYTES = 50;
131
+ function getSerializedSize(value) {
132
+ return Buffer.byteLength(JSON.stringify(value), "utf8");
133
+ }
134
+ /**
135
+ * Build a versioned message wrapper indicating original messages were dropped.
136
+ */
137
+ function serializeOverflowSentinel(totalMessages) {
138
+ return JSON.stringify({
139
+ version: contracts_js_1.A365_MESSAGE_SCHEMA_VERSION,
140
+ messages: [
141
+ {
142
+ role: MESSAGE_ROLE_SYSTEM,
143
+ parts: [
144
+ {
145
+ type: "text",
146
+ content: `[truncated: ${totalMessages} ${totalMessages === 1 ? "message" : "messages"} exceeded limit]`,
147
+ },
148
+ ],
149
+ },
150
+ ],
151
+ });
152
+ }
153
+ /**
154
+ * Trim a string by a target UTF-8 byte budget while preserving whole code points.
155
+ */
156
+ function trimString(value, bytesToShed) {
157
+ const currentBytes = Buffer.byteLength(value, "utf8");
158
+ const targetContentBytes = Math.max(0, currentBytes - Math.max(1, bytesToShed) - TRUNCATED_SUFFIX_BYTES);
159
+ if (targetContentBytes <= 0)
160
+ return TRUNCATED_SUFFIX;
161
+ let consumedBytes = 0;
162
+ let endIndex = 0;
163
+ for (const codePoint of value) {
164
+ const cpBytes = Buffer.byteLength(codePoint, "utf8");
165
+ if (consumedBytes + cpBytes > targetContentBytes)
166
+ break;
167
+ consumedBytes += cpBytes;
168
+ endIndex += codePoint.length;
169
+ }
170
+ return value.slice(0, endIndex) + TRUNCATED_SUFFIX;
171
+ }
172
+ function createBlobShrinkAction(part, sourceKey) {
173
+ if (part.type === "blob" && typeof part.content === "string" && part.content !== BLOB_SENTINEL) {
174
+ const contentSize = Buffer.byteLength(part.content, "utf8");
175
+ if (contentSize <= 0)
176
+ return undefined;
177
+ const action = {
178
+ contentBytes: contentSize,
179
+ sourceKey,
180
+ apply() {
181
+ part.content = BLOB_SENTINEL;
182
+ action.contentBytes = 0;
183
+ },
184
+ };
185
+ return action;
186
+ }
187
+ return undefined;
188
+ }
189
+ /**
190
+ * Collect all shrink candidates from message parts and direct string attributes.
191
+ */
192
+ function collectShrinkActions(attributes, parsedMessages) {
193
+ const actions = [];
194
+ for (const key of Object.keys(attributes)) {
195
+ let handledAsMessage = false;
196
+ if (MESSAGE_ATTR_KEYS.has(key)) {
197
+ if (!parsedMessages.has(key) && typeof attributes[key] === "string") {
198
+ try {
199
+ const parsed = JSON.parse(attributes[key]);
200
+ if (parsed && typeof parsed === "object" && Array.isArray(parsed.messages)) {
201
+ parsedMessages.set(key, parsed);
202
+ }
203
+ }
204
+ catch {
205
+ // Not valid JSON — will fall through to string trim
206
+ }
207
+ }
208
+ if (parsedMessages.has(key)) {
209
+ handledAsMessage = true;
210
+ const wrapper = parsedMessages.get(key);
211
+ for (const message of wrapper.messages) {
212
+ if (!Array.isArray(message.parts))
213
+ continue;
214
+ for (const part of message.parts) {
215
+ const partType = part.type;
216
+ // Blob → sentinel
217
+ const blobAction = createBlobShrinkAction(part, key);
218
+ if (blobAction) {
219
+ actions.push(blobAction);
220
+ }
221
+ // Tool/server JSON payload fields → sentinel
222
+ const jsonField = partType === "tool_call"
223
+ ? "arguments"
224
+ : partType === "tool_call_response"
225
+ ? "response"
226
+ : partType === "server_tool_call"
227
+ ? "server_tool_call"
228
+ : partType === "server_tool_call_response"
229
+ ? "server_tool_call_response"
230
+ : undefined;
231
+ if (jsonField && part[jsonField] !== undefined && part[jsonField] !== JSON_SENTINEL) {
232
+ let fieldSize;
233
+ try {
234
+ fieldSize = Buffer.byteLength(JSON.stringify(part[jsonField]), "utf8");
235
+ }
236
+ catch {
237
+ fieldSize = 0;
238
+ }
239
+ if (fieldSize > 0) {
240
+ const action = {
241
+ contentBytes: fieldSize,
242
+ sourceKey: key,
243
+ apply() {
244
+ part[jsonField] = JSON_SENTINEL;
245
+ action.contentBytes = 0;
246
+ },
247
+ };
248
+ actions.push(action);
249
+ }
250
+ continue;
251
+ }
252
+ // Text/reasoning → trim
253
+ if ((partType === "text" || partType === "reasoning") &&
254
+ typeof part.content === "string") {
255
+ const contentSize = Buffer.byteLength(part.content, "utf8");
256
+ if (contentSize > MIN_SHRINKABLE_STRING_BYTES) {
257
+ const action = {
258
+ contentBytes: contentSize,
259
+ sourceKey: key,
260
+ apply(bytesToShed) {
261
+ const cur = Buffer.byteLength(part.content, "utf8");
262
+ if (cur > TRUNCATED_SUFFIX_BYTES) {
263
+ part.content = trimString(part.content, bytesToShed);
264
+ action.contentBytes = Buffer.byteLength(part.content, "utf8");
265
+ }
266
+ },
267
+ };
268
+ actions.push(action);
269
+ }
270
+ }
271
+ }
272
+ }
273
+ }
274
+ }
275
+ // Non-message string attribute → trim
276
+ if (!handledAsMessage && typeof attributes[key] === "string") {
277
+ const value = attributes[key];
278
+ const valueSize = Buffer.byteLength(value, "utf8");
279
+ if (valueSize > MIN_SHRINKABLE_STRING_BYTES) {
280
+ const action = {
281
+ contentBytes: valueSize,
282
+ apply(bytesToShed) {
283
+ const cur = Buffer.byteLength(attributes[key], "utf8");
284
+ if (cur > TRUNCATED_SUFFIX_BYTES) {
285
+ attributes[key] = trimString(attributes[key], bytesToShed);
286
+ action.contentBytes = Buffer.byteLength(attributes[key], "utf8");
287
+ }
288
+ },
289
+ };
290
+ actions.push(action);
291
+ }
292
+ }
293
+ }
294
+ return actions;
295
+ }
296
+ function flushParsedMessages(attributes, parsedMessages) {
297
+ for (const [key, wrapper] of parsedMessages) {
298
+ try {
299
+ attributes[key] = JSON.stringify(wrapper);
300
+ }
301
+ catch {
302
+ // Leave the previous value intact
303
+ }
304
+ }
305
+ }
306
+ function flushParsedMessage(attributes, parsedMessages, key) {
307
+ const wrapper = parsedMessages.get(key);
308
+ if (wrapper) {
309
+ try {
310
+ attributes[key] = JSON.stringify(wrapper);
311
+ }
312
+ catch {
313
+ // Leave the previous value intact
314
+ }
315
+ }
316
+ }
317
+ function runShrinkPhase(span, attributes, parsedMessages, currentSize) {
318
+ let nextSize = currentSize;
319
+ const actions = collectShrinkActions(attributes, parsedMessages);
320
+ while (actions.length > 0 && nextSize > exports.MAX_SPAN_SIZE_BYTES) {
321
+ let maxIdx = 0;
322
+ for (let j = 1; j < actions.length; j++) {
323
+ if (actions[j].contentBytes > actions[maxIdx].contentBytes)
324
+ maxIdx = j;
325
+ }
326
+ const excess = nextSize - exports.MAX_SPAN_SIZE_BYTES;
327
+ const previousSize = nextSize;
328
+ const action = actions[maxIdx];
329
+ action.apply(excess);
330
+ if (action.sourceKey) {
331
+ flushParsedMessage(attributes, parsedMessages, action.sourceKey);
332
+ }
333
+ nextSize = getSerializedSize(span);
334
+ if (nextSize >= previousSize) {
335
+ actions.splice(maxIdx, 1);
336
+ }
337
+ else if (action.contentBytes <= MIN_SHRINKABLE_STRING_BYTES) {
338
+ actions.splice(maxIdx, 1);
339
+ }
340
+ }
341
+ flushParsedMessages(attributes, parsedMessages);
342
+ return nextSize;
343
+ }
344
+ /**
345
+ * Truncate span attributes if the serialized span exceeds MAX_SPAN_SIZE_BYTES.
346
+ *
347
+ * Phase 1: iteratively shrink fields (blobs, text, json, strings) by size priority.
348
+ * Phase 2 (fallback): replace remaining string attributes with overlimit sentinel.
349
+ */
350
+ function truncateSpan(spanDict) {
351
+ try {
352
+ let currentSize = getSerializedSize(spanDict);
353
+ if (currentSize <= exports.MAX_SPAN_SIZE_BYTES)
354
+ return spanDict;
355
+ index_js_1.Logger.getInstance().warn(`[Agent365Exporter] Span size (${currentSize} bytes) exceeds limit (${exports.MAX_SPAN_SIZE_BYTES} bytes). Shrinking.`);
356
+ const truncated = { ...spanDict };
357
+ if (truncated.attributes)
358
+ truncated.attributes = { ...truncated.attributes };
359
+ const attributes = truncated.attributes;
360
+ if (!attributes)
361
+ return truncated;
362
+ const parsedMessages = new Map();
363
+ // Phase 1: iteratively shrink fields by size priority
364
+ currentSize = runShrinkPhase(truncated, attributes, parsedMessages, currentSize);
365
+ if (currentSize > exports.MAX_SPAN_SIZE_BYTES) {
366
+ // Phase 2: replace all string attributes with sentinels, largest first
367
+ const stringKeys = Object.keys(attributes)
368
+ .filter((k) => typeof attributes[k] === "string" && attributes[k] !== OVERLIMIT_SENTINEL)
369
+ .sort((a, b) => Buffer.byteLength(attributes[b], "utf8") -
370
+ Buffer.byteLength(attributes[a], "utf8"));
371
+ for (const key of stringKeys) {
372
+ if (currentSize <= exports.MAX_SPAN_SIZE_BYTES)
373
+ break;
374
+ if (MESSAGE_ATTR_KEYS.has(key)) {
375
+ let messageCount = 0;
376
+ const cached = parsedMessages.get(key);
377
+ if (cached) {
378
+ messageCount = cached.messages.length;
379
+ }
380
+ else if (typeof attributes[key] === "string") {
381
+ try {
382
+ const parsed = JSON.parse(attributes[key]);
383
+ if (parsed && Array.isArray(parsed.messages)) {
384
+ messageCount = parsed.messages.length;
385
+ }
386
+ }
387
+ catch {
388
+ /* not valid JSON */
389
+ }
390
+ }
391
+ attributes[key] = serializeOverflowSentinel(messageCount);
392
+ parsedMessages.delete(key);
393
+ }
394
+ else {
395
+ attributes[key] = OVERLIMIT_SENTINEL;
396
+ }
397
+ currentSize = getSerializedSize(truncated);
398
+ }
399
+ }
400
+ if (currentSize > exports.MAX_SPAN_SIZE_BYTES) {
401
+ index_js_1.Logger.getInstance().warn(`[Agent365Exporter] Span still ${currentSize} bytes after truncation (limit: ${exports.MAX_SPAN_SIZE_BYTES}).`);
402
+ }
403
+ return truncated;
404
+ }
405
+ catch (e) {
406
+ index_js_1.Logger.getInstance().error(`[Agent365Exporter] Error during span truncation: ${e}`);
407
+ return spanDict;
408
+ }
409
+ }
410
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/a365/exporter/utils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AA2BlC,kDA8BC;AAGD,4CAGC;AAGD,gCAKC;AAGD,8BAKC;AAGD,sBAIC;AAGD,4BAeC;AAGD,gCAWC;AAKD,0DAUC;AAqSD,oCAqEC;AA5eD,4CAA8D;AAE9D,4DAAuD;AACvD,mEAA6D;AAC7D,uDAKgC;AAChC,kDAA8D;AAE9D,kEAAkE;AAClE,MAAM,iBAAiB,GAAgB,IAAI,GAAG,CAAC;IAC7C,uCAA0B;IAC1B,wCAA2B;CAC5B,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAErC;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,K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AW,GAAG,2BAAmB,EAAE,CAAC;YACtC,iBAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CACvB,iCAAiC,WAAW,mCAAmC,2BAAmB,IAAI,CACvG,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,iBAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,oDAAoD,CAAC,EAAE,CAAC,CAAC;QACpF,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ export { A365Configuration, A365_ENV_VARS } from "./configuration/index.js";
2
+ export type { A365Options, ClusterCategory, A365BaggageOptions, A365HostingOptions, } from "./configuration/index.js";
3
+ export { Agent365Exporter } from "./exporter/index.js";
4
+ export type { Agent365ExporterOptions, TokenResolver } from "./exporter/index.js";
5
+ export { ResolvedExporterOptions } from "./exporter/index.js";
6
+ export { OpenTelemetryScope, InvokeAgentScope, ExecuteToolScope, InferenceScope, OutputScope, } from "./scopes/index.js";
7
+ export { OpenTelemetryConstants } from "./constants.js";
8
+ export { MessageRole, FinishReason, Modality, InvocationRole, InferenceOperationType, A365_MESSAGE_SCHEMA_VERSION, } from "./contracts.js";
9
+ export type { ChatMessage, InputMessages, OutputMessage, OutputMessages, InputMessagesParam, OutputMessagesParam, ResponseMessagesParam, MessagePart, TextPart, ToolCallRequestPart, ToolCallResponsePart, ReasoningPart, AgentDetails, UserDetails, CallerDetails, Request, Channel, ServiceEndpoint, InvokeAgentScopeDetails, ToolCallDetails, InferenceDetails, InferenceResponse, OutputResponse, SpanDetails, ParentSpanRef, ParentContext, } from "./contracts.js";
10
+ export { isParentSpanRef, createContextWithParentSpanRef, runWithParentSpanRef, injectContextToHeaders, extractContextFromHeaders, runWithExtractedTraceContext, } from "./context.js";
11
+ export type { HeadersCarrier } from "./context.js";
12
+ export { BaggageBuilder, BaggageScope } from "./middleware/index.js";
13
+ export { A365SpanProcessor, PerRequestSpanProcessor, GENERIC_ATTRIBUTES, INVOKE_AGENT_ATTRIBUTES, } from "./processors/index.js";
14
+ export type { PerRequestSpanProcessorOptions } from "./processors/index.js";
15
+ export { runWithExportToken, updateExportToken, getExportToken } from "./context/tokenContext.js";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/a365/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC5E,YAAY,EACV,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,EACb,OAAO,EACP,OAAO,EACP,eAAe,EACf,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,aAAa,EACb,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,8BAA8B,EAC9B,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrE,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getExportToken = exports.updateExportToken = exports.runWithExportToken = exports.INVOKE_AGENT_ATTRIBUTES = exports.GENERIC_ATTRIBUTES = exports.PerRequestSpanProcessor = exports.A365SpanProcessor = exports.BaggageScope = exports.BaggageBuilder = exports.runWithExtractedTraceContext = exports.extractContextFromHeaders = exports.injectContextToHeaders = exports.runWithParentSpanRef = exports.createContextWithParentSpanRef = exports.isParentSpanRef = exports.A365_MESSAGE_SCHEMA_VERSION = exports.InferenceOperationType = exports.InvocationRole = exports.Modality = exports.FinishReason = exports.MessageRole = exports.OpenTelemetryConstants = exports.OutputScope = exports.InferenceScope = exports.ExecuteToolScope = exports.InvokeAgentScope = exports.OpenTelemetryScope = exports.ResolvedExporterOptions = exports.Agent365Exporter = exports.A365_ENV_VARS = exports.A365Configuration = void 0;
6
+ var index_js_1 = require("./configuration/index.js");
7
+ Object.defineProperty(exports, "A365Configuration", { enumerable: true, get: function () { return index_js_1.A365Configuration; } });
8
+ Object.defineProperty(exports, "A365_ENV_VARS", { enumerable: true, get: function () { return index_js_1.A365_ENV_VARS; } });
9
+ var index_js_2 = require("./exporter/index.js");
10
+ Object.defineProperty(exports, "Agent365Exporter", { enumerable: true, get: function () { return index_js_2.Agent365Exporter; } });
11
+ var index_js_3 = require("./exporter/index.js");
12
+ Object.defineProperty(exports, "ResolvedExporterOptions", { enumerable: true, get: function () { return index_js_3.ResolvedExporterOptions; } });
13
+ // ── Scopes (manual telemetry API) ───────────────────────────────────────────
14
+ var index_js_4 = require("./scopes/index.js");
15
+ Object.defineProperty(exports, "OpenTelemetryScope", { enumerable: true, get: function () { return index_js_4.OpenTelemetryScope; } });
16
+ Object.defineProperty(exports, "InvokeAgentScope", { enumerable: true, get: function () { return index_js_4.InvokeAgentScope; } });
17
+ Object.defineProperty(exports, "ExecuteToolScope", { enumerable: true, get: function () { return index_js_4.ExecuteToolScope; } });
18
+ Object.defineProperty(exports, "InferenceScope", { enumerable: true, get: function () { return index_js_4.InferenceScope; } });
19
+ Object.defineProperty(exports, "OutputScope", { enumerable: true, get: function () { return index_js_4.OutputScope; } });
20
+ // ── Constants ───────────────────────────────────────────────────────────────
21
+ var constants_js_1 = require("./constants.js");
22
+ Object.defineProperty(exports, "OpenTelemetryConstants", { enumerable: true, get: function () { return constants_js_1.OpenTelemetryConstants; } });
23
+ // ── Contracts (types & enums) ───────────────────────────────────────────────
24
+ var contracts_js_1 = require("./contracts.js");
25
+ Object.defineProperty(exports, "MessageRole", { enumerable: true, get: function () { return contracts_js_1.MessageRole; } });
26
+ Object.defineProperty(exports, "FinishReason", { enumerable: true, get: function () { return contracts_js_1.FinishReason; } });
27
+ Object.defineProperty(exports, "Modality", { enumerable: true, get: function () { return contracts_js_1.Modality; } });
28
+ Object.defineProperty(exports, "InvocationRole", { enumerable: true, get: function () { return contracts_js_1.InvocationRole; } });
29
+ Object.defineProperty(exports, "InferenceOperationType", { enumerable: true, get: function () { return contracts_js_1.InferenceOperationType; } });
30
+ Object.defineProperty(exports, "A365_MESSAGE_SCHEMA_VERSION", { enumerable: true, get: function () { return contracts_js_1.A365_MESSAGE_SCHEMA_VERSION; } });
31
+ // ── Context propagation ─────────────────────────────────────────────────────
32
+ var context_js_1 = require("./context.js");
33
+ Object.defineProperty(exports, "isParentSpanRef", { enumerable: true, get: function () { return context_js_1.isParentSpanRef; } });
34
+ Object.defineProperty(exports, "createContextWithParentSpanRef", { enumerable: true, get: function () { return context_js_1.createContextWithParentSpanRef; } });
35
+ Object.defineProperty(exports, "runWithParentSpanRef", { enumerable: true, get: function () { return context_js_1.runWithParentSpanRef; } });
36
+ Object.defineProperty(exports, "injectContextToHeaders", { enumerable: true, get: function () { return context_js_1.injectContextToHeaders; } });
37
+ Object.defineProperty(exports, "extractContextFromHeaders", { enumerable: true, get: function () { return context_js_1.extractContextFromHeaders; } });
38
+ Object.defineProperty(exports, "runWithExtractedTraceContext", { enumerable: true, get: function () { return context_js_1.runWithExtractedTraceContext; } });
39
+ // ── Middleware (BaggageBuilder) ──────────────────────────────────────────────
40
+ var index_js_5 = require("./middleware/index.js");
41
+ Object.defineProperty(exports, "BaggageBuilder", { enumerable: true, get: function () { return index_js_5.BaggageBuilder; } });
42
+ Object.defineProperty(exports, "BaggageScope", { enumerable: true, get: function () { return index_js_5.BaggageScope; } });
43
+ // ── Processors ──────────────────────────────────────────────────────────────
44
+ var index_js_6 = require("./processors/index.js");
45
+ Object.defineProperty(exports, "A365SpanProcessor", { enumerable: true, get: function () { return index_js_6.A365SpanProcessor; } });
46
+ Object.defineProperty(exports, "PerRequestSpanProcessor", { enumerable: true, get: function () { return index_js_6.PerRequestSpanProcessor; } });
47
+ Object.defineProperty(exports, "GENERIC_ATTRIBUTES", { enumerable: true, get: function () { return index_js_6.GENERIC_ATTRIBUTES; } });
48
+ Object.defineProperty(exports, "INVOKE_AGENT_ATTRIBUTES", { enumerable: true, get: function () { return index_js_6.INVOKE_AGENT_ATTRIBUTES; } });
49
+ // ── Token context ───────────────────────────────────────────────────────────
50
+ var tokenContext_js_1 = require("./context/tokenContext.js");
51
+ Object.defineProperty(exports, "runWithExportToken", { enumerable: true, get: function () { return tokenContext_js_1.runWithExportToken; } });
52
+ Object.defineProperty(exports, "updateExportToken", { enumerable: true, get: function () { return tokenContext_js_1.updateExportToken; } });
53
+ Object.defineProperty(exports, "getExportToken", { enumerable: true, get: function () { return tokenContext_js_1.getExportToken; } });
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/a365/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,qDAA4E;AAAnE,6GAAA,iBAAiB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAQzC,gDAAuD;AAA9C,4GAAA,gBAAgB,OAAA;AAEzB,gDAA8D;AAArD,mHAAA,uBAAuB,OAAA;AAEhC,+EAA+E;AAC/E,8CAM2B;AALzB,8GAAA,kBAAkB,OAAA;AAClB,4GAAA,gBAAgB,OAAA;AAChB,4GAAA,gBAAgB,OAAA;AAChB,0GAAA,cAAc,OAAA;AACd,uGAAA,WAAW,OAAA;AAGb,+EAA+E;AAC/E,+CAAwD;AAA/C,sHAAA,sBAAsB,OAAA;AAE/B,+EAA+E;AAC/E,+CAOwB;AANtB,2GAAA,WAAW,OAAA;AACX,4GAAA,YAAY,OAAA;AACZ,wGAAA,QAAQ,OAAA;AACR,8GAAA,cAAc,OAAA;AACd,sHAAA,sBAAsB,OAAA;AACtB,2HAAA,2BAA2B,OAAA;AA+B7B,+EAA+E;AAC/E,2CAOsB;AANpB,6GAAA,eAAe,OAAA;AACf,4HAAA,8BAA8B,OAAA;AAC9B,kHAAA,oBAAoB,OAAA;AACpB,oHAAA,sBAAsB,OAAA;AACtB,uHAAA,yBAAyB,OAAA;AACzB,0HAAA,4BAA4B,OAAA;AAI9B,gFAAgF;AAChF,kDAAqE;AAA5D,0GAAA,cAAc,OAAA;AAAE,wGAAA,YAAY,OAAA;AAErC,+EAA+E;AAC/E,kDAK+B;AAJ7B,6GAAA,iBAAiB,OAAA;AACjB,mHAAA,uBAAuB,OAAA;AACvB,8GAAA,kBAAkB,OAAA;AAClB,mHAAA,uBAAuB,OAAA;AAIzB,+EAA+E;AAC/E,6DAAkG;AAAzF,qHAAA,kBAAkB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAAE,iHAAA,cAAc,OAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Utilities for normalizing and serializing gen-ai messages.
3
+ *
4
+ * Adapted from microsoft/Agent365-nodejs agents-a365-observability/src/tracing/message-utils.ts
5
+ */
6
+ import type { ChatMessage, OutputMessage, InputMessages, OutputMessages, InputMessagesParam, OutputMessagesParam } from "./contracts.js";
7
+ /**
8
+ * Type guard that returns `true` when the input is a versioned wrapper
9
+ * object (`InputMessages` or `OutputMessages`).
10
+ */
11
+ export declare function isWrappedMessages(input: InputMessagesParam | OutputMessagesParam): input is InputMessages | OutputMessages;
12
+ /** Converts plain input strings into OTEL input messages. */
13
+ export declare function toInputMessages(messages: string[]): ChatMessage[];
14
+ /** Converts plain output strings into OTEL output messages. */
15
+ export declare function toOutputMessages(messages: string[]): OutputMessage[];
16
+ /**
17
+ * Normalizes an `InputMessagesParam` to a versioned `InputMessages` wrapper.
18
+ * - `string` / `string[]` → converted to `ChatMessage[]` and wrapped
19
+ * - `InputMessages` → returned as-is
20
+ */
21
+ export declare function normalizeInputMessages(param: InputMessagesParam): InputMessages;
22
+ /**
23
+ * Normalizes an `OutputMessagesParam` to a versioned `OutputMessages` wrapper.
24
+ * - `string` / `string[]` → converted to `OutputMessage[]` and wrapped
25
+ * - `OutputMessages` → returned as-is
26
+ */
27
+ export declare function normalizeOutputMessages(param: OutputMessagesParam): OutputMessages;
28
+ /**
29
+ * Serializes a versioned message wrapper to JSON.
30
+ *
31
+ * The try/catch ensures telemetry recording is non-throwing even when
32
+ * message parts contain non-JSON-serializable values.
33
+ */
34
+ export declare function serializeMessages(wrapper: InputMessages | OutputMessages): string;
35
+ /**
36
+ * Ensures the value is always a JSON-parseable string.
37
+ * - Objects are serialized via JSON.stringify.
38
+ * - Strings that are already valid JSON objects/arrays are passed through.
39
+ * - All other strings are wrapped: `{ [key]: value }`.
40
+ */
41
+ export declare function safeSerializeToJson(value: Record<string, unknown> | string, key: string): string;
42
+ //# sourceMappingURL=message-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-utils.d.ts","sourceRoot":"","sources":["../../../src/a365/message-utils.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAGxB;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,GAC9C,KAAK,IAAI,aAAa,GAAG,cAAc,CAQzC;AAED,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAKjE;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAKpE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,aAAa,CAM/E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAMlF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,GAAG,MAAM,CAmBjF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAkBhG"}