@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,31 @@
1
+ import type { Context } from "@opentelemetry/api";
2
+ import type { ParentSpanRef } from "./contracts.js";
3
+ /** Type guard to distinguish a ParentSpanRef from an OTel Context. */
4
+ export declare function isParentSpanRef(value: unknown): value is ParentSpanRef;
5
+ /**
6
+ * Creates a new Context with an explicit parent span reference.
7
+ * This allows child spans to be correctly parented even when async context is broken.
8
+ */
9
+ export declare function createContextWithParentSpanRef(base: Context, parent: ParentSpanRef): Context;
10
+ /**
11
+ * Runs a callback within a context that has an explicit parent span reference.
12
+ */
13
+ export declare function runWithParentSpanRef<T>(parent: ParentSpanRef, callback: () => T): T;
14
+ /** Carrier type for HTTP headers. */
15
+ export type HeadersCarrier = Record<string, string | string[] | undefined>;
16
+ /**
17
+ * Injects the current trace context (`traceparent`/`tracestate` headers) into
18
+ * the provided headers object using the globally registered W3C propagator.
19
+ */
20
+ export declare function injectContextToHeaders(headers: Record<string, string>, ctx?: Context): Record<string, string>;
21
+ /**
22
+ * Extracts trace context from incoming HTTP headers using the globally
23
+ * registered W3C propagator.
24
+ */
25
+ export declare function extractContextFromHeaders(headers: HeadersCarrier, baseCtx?: Context): Context;
26
+ /**
27
+ * Extracts trace context from incoming HTTP headers and runs the callback
28
+ * within that context.
29
+ */
30
+ export declare function runWithExtractedTraceContext<T>(headers: HeadersCarrier, callback: () => T): T;
31
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/a365/context.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAmBpD,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAmBtE;AAMD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CA0B5F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAGnF;AAMD,qCAAqC;AACrC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,GAAG,CAAC,EAAE,OAAO,GACZ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGxB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAE7F;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAE7F"}
@@ -0,0 +1,101 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * Context propagation utilities for A365 observability.
5
+ *
6
+ * Provides:
7
+ * - `ParentSpanRef` for explicit parent-child linking across async boundaries
8
+ * - `createContextWithParentSpanRef` / `runWithParentSpanRef` helpers
9
+ * - `isParentSpanRef` type guard
10
+ * - W3C traceparent inject/extract helpers
11
+ *
12
+ * Adapted from microsoft/Agent365-nodejs agents-a365-observability/src/tracing/context/
13
+ */
14
+ import { context, trace, propagation } from "@opentelemetry/api";
15
+ import { TraceFlags } from "@opentelemetry/api";
16
+ import { Logger } from "../shared/logging/index.js";
17
+ // ---------------------------------------------------------------------------
18
+ // Validation helpers
19
+ // ---------------------------------------------------------------------------
20
+ function isValidTraceId(traceId) {
21
+ return /^[0-9a-f]{32}$/i.test(traceId) && traceId !== "00000000000000000000000000000000";
22
+ }
23
+ function isValidSpanId(spanId) {
24
+ return /^[0-9a-f]{16}$/i.test(spanId) && spanId !== "0000000000000000";
25
+ }
26
+ // ---------------------------------------------------------------------------
27
+ // Type guard
28
+ // ---------------------------------------------------------------------------
29
+ /** Type guard to distinguish a ParentSpanRef from an OTel Context. */
30
+ export function isParentSpanRef(value) {
31
+ if (typeof value !== "object" || value === null)
32
+ return false;
33
+ const maybeCtx = value;
34
+ if (typeof maybeCtx.getValue === "function" &&
35
+ typeof maybeCtx.setValue === "function" &&
36
+ typeof maybeCtx.deleteValue === "function") {
37
+ return false;
38
+ }
39
+ const maybeRef = value;
40
+ return ("traceId" in maybeRef &&
41
+ typeof maybeRef.traceId === "string" &&
42
+ "spanId" in maybeRef &&
43
+ typeof maybeRef.spanId === "string");
44
+ }
45
+ // ---------------------------------------------------------------------------
46
+ // Parent span context
47
+ // ---------------------------------------------------------------------------
48
+ /**
49
+ * Creates a new Context with an explicit parent span reference.
50
+ * This allows child spans to be correctly parented even when async context is broken.
51
+ */
52
+ export function createContextWithParentSpanRef(base, parent) {
53
+ const logger = Logger.getInstance();
54
+ if (!isValidTraceId(parent.traceId) || !isValidSpanId(parent.spanId)) {
55
+ logger.warn(`[A365] Invalid parent span reference; returning base context. traceId=${parent.traceId}, spanId=${parent.spanId}`);
56
+ return base;
57
+ }
58
+ const activeCtx = trace.getSpan(base)?.spanContext();
59
+ const traceFlags = parent.traceFlags ??
60
+ (activeCtx?.traceId === parent.traceId ? activeCtx.traceFlags : undefined) ??
61
+ TraceFlags.SAMPLED;
62
+ const parentSpanContext = {
63
+ traceId: parent.traceId,
64
+ spanId: parent.spanId,
65
+ traceFlags,
66
+ traceState: parent.traceState,
67
+ isRemote: parent.isRemote ?? true,
68
+ };
69
+ const parentSpan = trace.wrapSpanContext(parentSpanContext);
70
+ return trace.setSpan(base, parentSpan);
71
+ }
72
+ /**
73
+ * Runs a callback within a context that has an explicit parent span reference.
74
+ */
75
+ export function runWithParentSpanRef(parent, callback) {
76
+ const contextWithParent = createContextWithParentSpanRef(context.active(), parent);
77
+ return context.with(contextWithParent, callback);
78
+ }
79
+ /**
80
+ * Injects the current trace context (`traceparent`/`tracestate` headers) into
81
+ * the provided headers object using the globally registered W3C propagator.
82
+ */
83
+ export function injectContextToHeaders(headers, ctx) {
84
+ propagation.inject(ctx ?? context.active(), headers);
85
+ return headers;
86
+ }
87
+ /**
88
+ * Extracts trace context from incoming HTTP headers using the globally
89
+ * registered W3C propagator.
90
+ */
91
+ export function extractContextFromHeaders(headers, baseCtx) {
92
+ return propagation.extract(baseCtx ?? context.active(), headers);
93
+ }
94
+ /**
95
+ * Extracts trace context from incoming HTTP headers and runs the callback
96
+ * within that context.
97
+ */
98
+ export function runWithExtractedTraceContext(headers, callback) {
99
+ return context.with(extractContextFromHeaders(headers), callback);
100
+ }
101
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/a365/context.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;A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AO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAuB,EAAE,OAAiB;IAClF,OAAO,WAAW,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAI,OAAuB,EAAE,QAAiB;IACxF,OAAO,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,250 @@
1
+ /**
2
+ * A365 observability contracts — types for scopes, messages, and telemetry details.
3
+ *
4
+ * Adapted from microsoft/Agent365-nodejs agents-a365-observability/src/tracing/contracts.ts
5
+ * following OTel gen-ai semantic conventions.
6
+ */
7
+ import type { SpanKind, TimeInput, Link, Context, TraceState } from "@opentelemetry/api";
8
+ export declare const A365_MESSAGE_SCHEMA_VERSION: "0.1.0";
9
+ /** Role of a message participant per OTEL gen-ai semantic conventions. */
10
+ export declare enum MessageRole {
11
+ SYSTEM = "system",
12
+ USER = "user",
13
+ ASSISTANT = "assistant",
14
+ TOOL = "tool"
15
+ }
16
+ /** Reason a model stopped generating per OTEL gen-ai semantic conventions. */
17
+ export declare enum FinishReason {
18
+ STOP = "stop",
19
+ LENGTH = "length",
20
+ CONTENT_FILTER = "content_filter",
21
+ TOOL_CALL = "tool_call",
22
+ ERROR = "error"
23
+ }
24
+ /** Media modality for blob, file, and URI parts. */
25
+ export declare enum Modality {
26
+ IMAGE = "image",
27
+ VIDEO = "video",
28
+ AUDIO = "audio"
29
+ }
30
+ /** Represents different roles that can invoke an agent. */
31
+ export declare enum InvocationRole {
32
+ Human = "Human",
33
+ Agent = "Agent",
34
+ Event = "Event",
35
+ Unknown = "Unknown"
36
+ }
37
+ /** Represents different operation types for model inference. */
38
+ export declare enum InferenceOperationType {
39
+ CHAT = "Chat",
40
+ TEXT_COMPLETION = "TextCompletion",
41
+ GENERATE_CONTENT = "GenerateContent"
42
+ }
43
+ /** Plain text content. */
44
+ export interface TextPart {
45
+ type: "text";
46
+ content: string;
47
+ }
48
+ /** A tool call requested by the model. */
49
+ export interface ToolCallRequestPart {
50
+ type: "tool_call";
51
+ name: string;
52
+ id?: string;
53
+ arguments?: Record<string, unknown> | unknown[];
54
+ }
55
+ /** Result of a tool call. */
56
+ export interface ToolCallResponsePart {
57
+ type: "tool_call_response";
58
+ id?: string;
59
+ response?: unknown;
60
+ }
61
+ /** Model reasoning / chain-of-thought content. */
62
+ export interface ReasoningPart {
63
+ type: "reasoning";
64
+ content: string;
65
+ }
66
+ /** Inline binary data (base64-encoded). */
67
+ export interface BlobPart {
68
+ type: "blob";
69
+ modality: Modality | string;
70
+ mime_type?: string;
71
+ content: string;
72
+ }
73
+ /** Reference to a pre-uploaded file. */
74
+ export interface FilePart {
75
+ type: "file";
76
+ modality: Modality | string;
77
+ mime_type?: string;
78
+ file_id: string;
79
+ }
80
+ /** External URI reference. */
81
+ export interface UriPart {
82
+ type: "uri";
83
+ modality: Modality | string;
84
+ mime_type?: string;
85
+ uri: string;
86
+ }
87
+ /** Extensible server tool call details. */
88
+ export interface GenericServerToolCall {
89
+ type: string;
90
+ [key: string]: unknown;
91
+ }
92
+ /** Extensible server tool call response. */
93
+ export interface GenericServerToolCallResponse {
94
+ type: string;
95
+ [key: string]: unknown;
96
+ }
97
+ /** Server-side tool invocation. */
98
+ export interface ServerToolCallPart {
99
+ type: "server_tool_call";
100
+ name: string;
101
+ id?: string;
102
+ server_tool_call: GenericServerToolCall;
103
+ }
104
+ /** Server-side tool response. */
105
+ export interface ServerToolCallResponsePart {
106
+ type: "server_tool_call_response";
107
+ id?: string;
108
+ server_tool_call_response: GenericServerToolCallResponse;
109
+ }
110
+ /** Extensible part for custom / future types. */
111
+ export interface GenericPart {
112
+ type: string;
113
+ [key: string]: unknown;
114
+ }
115
+ /** Union of all message part types per OTEL gen-ai semantic conventions. */
116
+ export type MessagePart = TextPart | ToolCallRequestPart | ToolCallResponsePart | ReasoningPart | BlobPart | FilePart | UriPart | ServerToolCallPart | ServerToolCallResponsePart | GenericPart;
117
+ /** An input message sent to a model (OTEL gen-ai semantic conventions). */
118
+ export interface ChatMessage {
119
+ role: MessageRole | string;
120
+ parts: MessagePart[];
121
+ name?: string;
122
+ }
123
+ /** Versioned wrapper for input messages. */
124
+ export interface InputMessages {
125
+ version: typeof A365_MESSAGE_SCHEMA_VERSION;
126
+ messages: ChatMessage[];
127
+ }
128
+ /** An output message produced by a model (OTEL gen-ai semantic conventions). */
129
+ export interface OutputMessage extends ChatMessage {
130
+ finish_reason?: FinishReason | string;
131
+ }
132
+ /** Versioned wrapper for output messages. */
133
+ export interface OutputMessages {
134
+ version: typeof A365_MESSAGE_SCHEMA_VERSION;
135
+ messages: OutputMessage[];
136
+ }
137
+ /** Accepted input for `recordInputMessages`. */
138
+ export type InputMessagesParam = string | string[] | InputMessages;
139
+ /** Accepted input for `recordOutputMessages`. */
140
+ export type OutputMessagesParam = string | string[] | OutputMessages;
141
+ /** Accepted input for `OutputResponse.messages`. */
142
+ export type ResponseMessagesParam = OutputMessagesParam | Record<string, unknown>;
143
+ /** Represents a channel for an invocation. */
144
+ export interface Channel {
145
+ id?: string;
146
+ name?: string;
147
+ iconUri?: string;
148
+ role?: InvocationRole;
149
+ description?: string;
150
+ }
151
+ /** Represents a request with telemetry context. */
152
+ export interface Request {
153
+ content?: InputMessagesParam;
154
+ sessionId?: string;
155
+ channel?: Channel;
156
+ conversationId?: string;
157
+ }
158
+ /** Details about an AI agent. */
159
+ export interface AgentDetails {
160
+ agentId: string;
161
+ agentName?: string;
162
+ agentDescription?: string;
163
+ iconUri?: string;
164
+ platformId?: string;
165
+ agentAUID?: string;
166
+ agentEmail?: string;
167
+ agentBlueprintId?: string;
168
+ tenantId?: string;
169
+ providerName?: string;
170
+ agentVersion?: string;
171
+ }
172
+ /** Details about the human user caller. */
173
+ export interface UserDetails {
174
+ userId?: string;
175
+ userEmail?: string;
176
+ userName?: string;
177
+ tenantId?: string;
178
+ callerClientIp?: string;
179
+ }
180
+ /**
181
+ * Caller details for scope creation.
182
+ * Supports human callers, agent callers, or both (A2A with a human in the chain).
183
+ */
184
+ export interface CallerDetails {
185
+ userDetails?: UserDetails;
186
+ callerAgentDetails?: AgentDetails;
187
+ }
188
+ /** Represents an endpoint for agent invocation. */
189
+ export interface ServiceEndpoint {
190
+ host: string;
191
+ port?: number;
192
+ protocol?: string;
193
+ }
194
+ /** Details for invoking agent scope. */
195
+ export interface InvokeAgentScopeDetails {
196
+ endpoint?: ServiceEndpoint;
197
+ }
198
+ /** Details of a tool call made by an agent. */
199
+ export interface ToolCallDetails {
200
+ toolName: string;
201
+ arguments?: Record<string, unknown> | string;
202
+ toolCallId?: string;
203
+ description?: string;
204
+ toolType?: string;
205
+ endpoint?: ServiceEndpoint;
206
+ }
207
+ /** Details for an inference call. */
208
+ export interface InferenceDetails {
209
+ operationName: InferenceOperationType;
210
+ model: string;
211
+ providerName?: string;
212
+ inputTokens?: number;
213
+ outputTokens?: number;
214
+ finishReasons?: string[];
215
+ thoughtProcess?: string;
216
+ endpoint?: ServiceEndpoint;
217
+ }
218
+ /** Details for recording the response from an inference call. */
219
+ export interface InferenceResponse {
220
+ content: string;
221
+ responseId?: string;
222
+ finishReason?: string;
223
+ inputTokens?: number;
224
+ outputTokens?: number;
225
+ }
226
+ /** Represents a response containing output messages from an agent. */
227
+ export interface OutputResponse {
228
+ messages: ResponseMessagesParam;
229
+ }
230
+ /** Parent context — either an OTel Context or a manual ParentSpanRef. */
231
+ export type ParentContext = Context | ParentSpanRef;
232
+ /** Manual parent span reference for cross-async-boundary tracing. */
233
+ export interface ParentSpanRef {
234
+ traceId: string;
235
+ spanId: string;
236
+ traceFlags?: number;
237
+ traceState?: TraceState;
238
+ isRemote?: boolean;
239
+ }
240
+ /**
241
+ * Span configuration details for scope creation.
242
+ */
243
+ export interface SpanDetails {
244
+ parentContext?: ParentContext;
245
+ startTime?: TimeInput;
246
+ endTime?: TimeInput;
247
+ spanKind?: SpanKind;
248
+ spanLinks?: Link[];
249
+ }
250
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/a365/contracts.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMzF,eAAO,MAAM,2BAA2B,EAAG,OAAgB,CAAC;AAM5D,0EAA0E;AAC1E,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,IAAI,SAAS;CACd;AAED,8EAA8E;AAC9E,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,cAAc,mBAAmB;IACjC,SAAS,cAAc;IACvB,KAAK,UAAU;CAChB;AAED,oDAAoD;AACpD,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED,2DAA2D;AAC3D,oBAAY,cAAc;IACxB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,gEAAgE;AAChE,oBAAY,sBAAsB;IAChC,IAAI,SAAS;IACb,eAAe,mBAAmB;IAClC,gBAAgB,oBAAoB;CACrC;AAMD,0BAA0B;AAC1B,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,0CAA0C;AAC1C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAA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AAa,GAAG,OAAO,GAAG,aAAa,CAAC;AAEpD,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC;CACpB"}
@@ -0,0 +1,49 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ // ---------------------------------------------------------------------------
4
+ // Message schema version
5
+ // ---------------------------------------------------------------------------
6
+ export const A365_MESSAGE_SCHEMA_VERSION = "0.1.0";
7
+ // ---------------------------------------------------------------------------
8
+ // Enums
9
+ // ---------------------------------------------------------------------------
10
+ /** Role of a message participant per OTEL gen-ai semantic conventions. */
11
+ export var MessageRole;
12
+ (function (MessageRole) {
13
+ MessageRole["SYSTEM"] = "system";
14
+ MessageRole["USER"] = "user";
15
+ MessageRole["ASSISTANT"] = "assistant";
16
+ MessageRole["TOOL"] = "tool";
17
+ })(MessageRole || (MessageRole = {}));
18
+ /** Reason a model stopped generating per OTEL gen-ai semantic conventions. */
19
+ export var FinishReason;
20
+ (function (FinishReason) {
21
+ FinishReason["STOP"] = "stop";
22
+ FinishReason["LENGTH"] = "length";
23
+ FinishReason["CONTENT_FILTER"] = "content_filter";
24
+ FinishReason["TOOL_CALL"] = "tool_call";
25
+ FinishReason["ERROR"] = "error";
26
+ })(FinishReason || (FinishReason = {}));
27
+ /** Media modality for blob, file, and URI parts. */
28
+ export var Modality;
29
+ (function (Modality) {
30
+ Modality["IMAGE"] = "image";
31
+ Modality["VIDEO"] = "video";
32
+ Modality["AUDIO"] = "audio";
33
+ })(Modality || (Modality = {}));
34
+ /** Represents different roles that can invoke an agent. */
35
+ export var InvocationRole;
36
+ (function (InvocationRole) {
37
+ InvocationRole["Human"] = "Human";
38
+ InvocationRole["Agent"] = "Agent";
39
+ InvocationRole["Event"] = "Event";
40
+ InvocationRole["Unknown"] = "Unknown";
41
+ })(InvocationRole || (InvocationRole = {}));
42
+ /** Represents different operation types for model inference. */
43
+ export var InferenceOperationType;
44
+ (function (InferenceOperationType) {
45
+ InferenceOperationType["CHAT"] = "Chat";
46
+ InferenceOperationType["TEXT_COMPLETION"] = "TextCompletion";
47
+ InferenceOperationType["GENERATE_CONTENT"] = "GenerateContent";
48
+ })(InferenceOperationType || (InferenceOperationType = {}));
49
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/a365/contracts.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAWlC,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAgB,CAAC;AAE5D,8EAA8E;AAC9E,QAAQ;AACR,8EAA8E;AAE9E,0EAA0E;AAC1E,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,sCAAuB,CAAA;IACvB,4BAAa,CAAA;AACf,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAED,8EAA8E;AAC9E,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,iCAAiB,CAAA;IACjB,iDAAiC,CAAA;IACjC,uCAAuB,CAAA;IACvB,+BAAe,CAAA;AACjB,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB;AAED,oDAAoD;AACpD,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,2BAAe,CAAA;IACf,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAJW,QAAQ,KAAR,QAAQ,QAInB;AAED,2DAA2D;AAC3D,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,iCAAe,CAAA;IACf,iCAAe,CAAA;IACf,qCAAmB,CAAA;AACrB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED,gEAAgE;AAChE,MAAM,CAAN,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IAChC,uCAAa,CAAA;IACb,4DAAkC,CAAA;IAClC,8DAAoC,CAAA;AACtC,CAAC,EAJW,sBAAsB,KAAtB,sBAAsB,QAIjC"}
@@ -0,0 +1,25 @@
1
+ import type { ExportResult } from "@opentelemetry/core";
2
+ import type { ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base";
3
+ import type { Agent365ExporterOptions } from "./Agent365ExporterOptions.js";
4
+ /**
5
+ * Agent365 span exporter.
6
+ *
7
+ * Implements `SpanExporter` from `@opentelemetry/sdk-trace-base`.
8
+ * Partitions spans by (tenantId, agentId), builds OTLP-like JSON payloads,
9
+ * and POSTs them to the Agent365 observability service with Bearer auth.
10
+ */
11
+ export declare class Agent365Exporter implements SpanExporter {
12
+ private closed;
13
+ private readonly options;
14
+ private readonly logger;
15
+ constructor(options?: Agent365ExporterOptions);
16
+ export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): Promise<void>;
17
+ private exportGroup;
18
+ private resolveToken;
19
+ private postWithRetries;
20
+ private buildExportRequest;
21
+ private mapSpan;
22
+ shutdown(): Promise<void>;
23
+ forceFlush(): Promise<void>;
24
+ }
25
+ //# sourceMappingURL=Agent365Exporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Agent365Exporter.d.ts","sourceRoot":"","sources":["../../../../src/a365/exporter/Agent365Exporter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEhF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AA+D5E;;;;;;GAMG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;gBAEnC,OAAO,CAAC,EAAE,uBAAuB;IAIvC,MAAM,CACV,KAAK,EAAE,YAAY,EAAE,EACrB,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAC7C,OAAO,CAAC,IAAI,CAAC;YAoCF,WAAW;YAmCX,YAAY;YAMZ,eAAe;IA0D7B,OAAO,CAAC,kBAAkB;IAwC1B,OAAO,CAAC,OAAO;IAwDT,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGlC"}