@vscode/chat-lib 0.4.1-9 → 0.5.1-0

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 (178) hide show
  1. package/dist/src/_internal/extension/byok/node/openAIEndpoint.d.ts +2 -1
  2. package/dist/src/_internal/extension/byok/node/openAIEndpoint.d.ts.map +1 -1
  3. package/dist/src/_internal/extension/byok/node/openAIEndpoint.js +6 -7
  4. package/dist/src/_internal/extension/byok/node/openAIEndpoint.js.map +1 -1
  5. package/dist/src/_internal/extension/common/constants.d.ts +0 -1
  6. package/dist/src/_internal/extension/common/constants.d.ts.map +1 -1
  7. package/dist/src/_internal/extension/common/constants.js.map +1 -1
  8. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.d.ts.map +1 -1
  9. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.js +6 -1
  10. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.js.map +1 -1
  11. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/model.d.ts +4 -0
  12. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/model.d.ts.map +1 -1
  13. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/model.js +4 -0
  14. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/model.js.map +1 -1
  15. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/snippy/connectionState.d.ts.map +1 -1
  16. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/snippy/connectionState.js +1 -0
  17. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/snippy/connectionState.js.map +1 -1
  18. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/snippy/network.d.ts.map +1 -1
  19. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/snippy/network.js +1 -0
  20. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/snippy/network.js.map +1 -1
  21. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts +9 -0
  22. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts.map +1 -1
  23. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js +71 -11
  24. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js.map +1 -1
  25. package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.d.ts.map +1 -1
  26. package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.js +6 -3
  27. package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.js.map +1 -1
  28. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts +17 -1
  29. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
  30. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +373 -57
  31. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
  32. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.d.ts +6 -3
  33. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.d.ts.map +1 -1
  34. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js +9 -3
  35. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js.map +1 -1
  36. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.d.ts +2 -1
  37. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.d.ts.map +1 -1
  38. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.js +6 -3
  39. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.js.map +1 -1
  40. package/dist/src/_internal/extension/xtab/node/xtabNextCursorPredictor.d.ts.map +1 -1
  41. package/dist/src/_internal/extension/xtab/node/xtabNextCursorPredictor.js +1 -0
  42. package/dist/src/_internal/extension/xtab/node/xtabNextCursorPredictor.js.map +1 -1
  43. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts +2 -0
  44. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -1
  45. package/dist/src/_internal/extension/xtab/node/xtabProvider.js +24 -3
  46. package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -1
  47. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.d.ts.map +1 -1
  48. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js +3 -0
  49. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js.map +1 -1
  50. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts +2 -1
  51. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts.map +1 -1
  52. package/dist/src/_internal/platform/chat/common/commonTypes.js +61 -17
  53. package/dist/src/_internal/platform/chat/common/commonTypes.js.map +1 -1
  54. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +18 -36
  55. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
  56. package/dist/src/_internal/platform/configuration/common/configurationService.js +37 -51
  57. package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
  58. package/dist/src/_internal/platform/endpoint/common/capiClient.d.ts.map +1 -1
  59. package/dist/src/_internal/platform/endpoint/common/capiClient.js +1 -0
  60. package/dist/src/_internal/platform/endpoint/common/capiClient.js.map +1 -1
  61. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts +2 -1
  62. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts.map +1 -1
  63. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js +26 -7
  64. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js.map +1 -1
  65. package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts +3 -1
  66. package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts.map +1 -1
  67. package/dist/src/_internal/platform/endpoint/common/endpointProvider.js +1 -0
  68. package/dist/src/_internal/platform/endpoint/common/endpointProvider.js.map +1 -1
  69. package/dist/src/_internal/platform/endpoint/node/autoChatEndpoint.d.ts +2 -1
  70. package/dist/src/_internal/platform/endpoint/node/autoChatEndpoint.d.ts.map +1 -1
  71. package/dist/src/_internal/platform/endpoint/node/autoChatEndpoint.js +6 -3
  72. package/dist/src/_internal/platform/endpoint/node/autoChatEndpoint.js.map +1 -1
  73. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts +6 -2
  74. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts.map +1 -1
  75. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js +34 -12
  76. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js.map +1 -1
  77. package/dist/src/_internal/platform/endpoint/node/copilotChatEndpoint.d.ts +2 -1
  78. package/dist/src/_internal/platform/endpoint/node/copilotChatEndpoint.d.ts.map +1 -1
  79. package/dist/src/_internal/platform/endpoint/node/copilotChatEndpoint.js +5 -3
  80. package/dist/src/_internal/platform/endpoint/node/copilotChatEndpoint.js.map +1 -1
  81. package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts +1 -1
  82. package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts.map +1 -1
  83. package/dist/src/_internal/platform/endpoint/node/messagesApi.js +61 -7
  84. package/dist/src/_internal/platform/endpoint/node/messagesApi.js.map +1 -1
  85. package/dist/src/_internal/platform/endpoint/node/proxyXtabEndpoint.d.ts.map +1 -1
  86. package/dist/src/_internal/platform/endpoint/node/proxyXtabEndpoint.js +1 -0
  87. package/dist/src/_internal/platform/endpoint/node/proxyXtabEndpoint.js.map +1 -1
  88. package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts +1 -0
  89. package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts.map +1 -1
  90. package/dist/src/_internal/platform/endpoint/node/responsesApi.js +14 -10
  91. package/dist/src/_internal/platform/endpoint/node/responsesApi.js.map +1 -1
  92. package/dist/src/_internal/platform/git/common/gitService.d.ts +9 -1
  93. package/dist/src/_internal/platform/git/common/gitService.d.ts.map +1 -1
  94. package/dist/src/_internal/platform/git/common/gitService.js +17 -5
  95. package/dist/src/_internal/platform/git/common/gitService.js.map +1 -1
  96. package/dist/src/_internal/platform/github/common/githubAPI.d.ts +12 -2
  97. package/dist/src/_internal/platform/github/common/githubAPI.d.ts.map +1 -1
  98. package/dist/src/_internal/platform/github/common/githubAPI.js +23 -12
  99. package/dist/src/_internal/platform/github/common/githubAPI.js.map +1 -1
  100. package/dist/src/_internal/platform/github/common/githubService.d.ts +11 -1
  101. package/dist/src/_internal/platform/github/common/githubService.d.ts.map +1 -1
  102. package/dist/src/_internal/platform/github/common/githubService.js +52 -14
  103. package/dist/src/_internal/platform/github/common/githubService.js.map +1 -1
  104. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.d.ts +5 -2
  105. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.d.ts.map +1 -1
  106. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.js +4 -1
  107. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.js.map +1 -1
  108. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts +1 -1
  109. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts.map +1 -1
  110. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js +1 -1
  111. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js.map +1 -1
  112. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.d.ts +3 -0
  113. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.d.ts.map +1 -1
  114. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.js +5 -0
  115. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.js.map +1 -1
  116. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts.map +1 -1
  117. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js +1 -0
  118. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js.map +1 -1
  119. package/dist/src/_internal/platform/networking/common/anthropic.d.ts +10 -11
  120. package/dist/src/_internal/platform/networking/common/anthropic.d.ts.map +1 -1
  121. package/dist/src/_internal/platform/networking/common/anthropic.js +28 -23
  122. package/dist/src/_internal/platform/networking/common/anthropic.js.map +1 -1
  123. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts +29 -0
  124. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts.map +1 -1
  125. package/dist/src/_internal/platform/networking/common/fetcherService.js +29 -1
  126. package/dist/src/_internal/platform/networking/common/fetcherService.js.map +1 -1
  127. package/dist/src/_internal/platform/networking/common/networking.d.ts +7 -0
  128. package/dist/src/_internal/platform/networking/common/networking.d.ts.map +1 -1
  129. package/dist/src/_internal/platform/networking/common/networking.js +5 -5
  130. package/dist/src/_internal/platform/networking/common/networking.js.map +1 -1
  131. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.d.ts +83 -0
  132. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.d.ts.map +1 -0
  133. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.js +496 -0
  134. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.js.map +1 -0
  135. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.d.ts +89 -0
  136. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.d.ts.map +1 -0
  137. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.js +269 -0
  138. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.js.map +1 -0
  139. package/dist/src/_internal/platform/otel/common/genAiAttributes.d.ts +104 -0
  140. package/dist/src/_internal/platform/otel/common/genAiAttributes.d.ts.map +1 -0
  141. package/dist/src/_internal/platform/otel/common/genAiAttributes.js +124 -0
  142. package/dist/src/_internal/platform/otel/common/genAiAttributes.js.map +1 -0
  143. package/dist/src/_internal/platform/otel/common/genAiEvents.d.ts +28 -0
  144. package/dist/src/_internal/platform/otel/common/genAiEvents.d.ts.map +1 -0
  145. package/dist/src/_internal/platform/otel/common/genAiEvents.js +91 -0
  146. package/dist/src/_internal/platform/otel/common/genAiEvents.js.map +1 -0
  147. package/dist/src/_internal/platform/otel/common/genAiMetrics.d.ts +30 -0
  148. package/dist/src/_internal/platform/otel/common/genAiMetrics.d.ts.map +1 -0
  149. package/dist/src/_internal/platform/otel/common/genAiMetrics.js +68 -0
  150. package/dist/src/_internal/platform/otel/common/genAiMetrics.js.map +1 -0
  151. package/dist/src/_internal/platform/otel/common/index.d.ts +8 -0
  152. package/dist/src/_internal/platform/otel/common/index.d.ts.map +1 -0
  153. package/dist/src/_internal/platform/otel/common/index.js +35 -0
  154. package/dist/src/_internal/platform/otel/common/index.js.map +1 -0
  155. package/dist/src/_internal/platform/otel/common/messageFormatters.d.ts +85 -0
  156. package/dist/src/_internal/platform/otel/common/messageFormatters.d.ts.map +1 -0
  157. package/dist/src/_internal/platform/otel/common/messageFormatters.js +122 -0
  158. package/dist/src/_internal/platform/otel/common/messageFormatters.js.map +1 -0
  159. package/dist/src/_internal/platform/otel/common/noopOtelService.d.ts +26 -0
  160. package/dist/src/_internal/platform/otel/common/noopOtelService.d.ts.map +1 -0
  161. package/dist/src/_internal/platform/otel/common/noopOtelService.js +51 -0
  162. package/dist/src/_internal/platform/otel/common/noopOtelService.js.map +1 -0
  163. package/dist/src/_internal/platform/otel/common/otelConfig.d.ts +35 -0
  164. package/dist/src/_internal/platform/otel/common/otelConfig.d.ts.map +1 -0
  165. package/dist/src/_internal/platform/otel/common/otelConfig.js +140 -0
  166. package/dist/src/_internal/platform/otel/common/otelConfig.js.map +1 -0
  167. package/dist/src/_internal/platform/otel/common/otelService.d.ts +160 -0
  168. package/dist/src/_internal/platform/otel/common/otelService.d.ts.map +1 -0
  169. package/dist/src/_internal/platform/otel/common/otelService.js +10 -0
  170. package/dist/src/_internal/platform/otel/common/otelService.js.map +1 -0
  171. package/dist/src/_internal/platform/proxyModels/node/proxyModelsService.d.ts.map +1 -1
  172. package/dist/src/_internal/platform/proxyModels/node/proxyModelsService.js +1 -0
  173. package/dist/src/_internal/platform/proxyModels/node/proxyModelsService.js.map +1 -1
  174. package/dist/src/main.d.ts.map +1 -1
  175. package/dist/src/main.js +10 -0
  176. package/dist/src/main.js.map +1 -1
  177. package/dist/src/package.json +267 -91
  178. package/package.json +4 -3
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.emitInferenceDetailsEvent = emitInferenceDetailsEvent;
8
+ exports.emitSessionStartEvent = emitSessionStartEvent;
9
+ exports.emitToolCallEvent = emitToolCallEvent;
10
+ exports.emitAgentTurnEvent = emitAgentTurnEvent;
11
+ const genAiAttributes_1 = require("./genAiAttributes");
12
+ const messageFormatters_1 = require("./messageFormatters");
13
+ /**
14
+ * Emit OTel GenAI standard events via the IOTelService abstraction.
15
+ */
16
+ function emitInferenceDetailsEvent(otel, request, response, error) {
17
+ const attributes = {
18
+ 'event.name': 'gen_ai.client.inference.operation.details',
19
+ [genAiAttributes_1.GenAiAttr.OPERATION_NAME]: genAiAttributes_1.GenAiOperationName.CHAT,
20
+ [genAiAttributes_1.GenAiAttr.REQUEST_MODEL]: request.model,
21
+ };
22
+ if (response) {
23
+ if (response.model) {
24
+ attributes[genAiAttributes_1.GenAiAttr.RESPONSE_MODEL] = response.model;
25
+ }
26
+ if (response.id) {
27
+ attributes[genAiAttributes_1.GenAiAttr.RESPONSE_ID] = response.id;
28
+ }
29
+ if (response.finishReasons) {
30
+ attributes[genAiAttributes_1.GenAiAttr.RESPONSE_FINISH_REASONS] = response.finishReasons;
31
+ }
32
+ if (response.inputTokens !== undefined) {
33
+ attributes[genAiAttributes_1.GenAiAttr.USAGE_INPUT_TOKENS] = response.inputTokens;
34
+ }
35
+ if (response.outputTokens !== undefined) {
36
+ attributes[genAiAttributes_1.GenAiAttr.USAGE_OUTPUT_TOKENS] = response.outputTokens;
37
+ }
38
+ }
39
+ if (request.temperature !== undefined) {
40
+ attributes[genAiAttributes_1.GenAiAttr.REQUEST_TEMPERATURE] = request.temperature;
41
+ }
42
+ if (request.maxTokens !== undefined) {
43
+ attributes[genAiAttributes_1.GenAiAttr.REQUEST_MAX_TOKENS] = request.maxTokens;
44
+ }
45
+ if (error) {
46
+ attributes[genAiAttributes_1.StdAttr.ERROR_TYPE] = error.type;
47
+ }
48
+ // Full content capture with truncation to prevent OTLP batch failures
49
+ if (otel.config.captureContent) {
50
+ if (request.messages !== undefined) {
51
+ attributes[genAiAttributes_1.GenAiAttr.INPUT_MESSAGES] = (0, messageFormatters_1.truncateForOTel)(JSON.stringify(request.messages));
52
+ }
53
+ if (request.systemMessage !== undefined) {
54
+ attributes[genAiAttributes_1.GenAiAttr.SYSTEM_INSTRUCTIONS] = (0, messageFormatters_1.truncateForOTel)(JSON.stringify(request.systemMessage));
55
+ }
56
+ if (request.tools !== undefined) {
57
+ attributes[genAiAttributes_1.GenAiAttr.TOOL_DEFINITIONS] = (0, messageFormatters_1.truncateForOTel)(JSON.stringify(request.tools));
58
+ }
59
+ }
60
+ otel.emitLogRecord(`GenAI inference: ${request.model}`, attributes);
61
+ }
62
+ /**
63
+ * Emit extension-specific events.
64
+ */
65
+ function emitSessionStartEvent(otel, sessionId, model, participant) {
66
+ otel.emitLogRecord('copilot_chat.session.start', {
67
+ 'event.name': 'copilot_chat.session.start',
68
+ 'session.id': sessionId,
69
+ [genAiAttributes_1.GenAiAttr.REQUEST_MODEL]: model,
70
+ [genAiAttributes_1.GenAiAttr.AGENT_NAME]: participant,
71
+ });
72
+ }
73
+ function emitToolCallEvent(otel, toolName, durationMs, success, error) {
74
+ otel.emitLogRecord(`copilot_chat.tool.call: ${toolName}`, {
75
+ 'event.name': 'copilot_chat.tool.call',
76
+ [genAiAttributes_1.GenAiAttr.TOOL_NAME]: toolName,
77
+ 'duration_ms': durationMs,
78
+ 'success': success,
79
+ ...(error ? { [genAiAttributes_1.StdAttr.ERROR_TYPE]: error } : {}),
80
+ });
81
+ }
82
+ function emitAgentTurnEvent(otel, turnIndex, inputTokens, outputTokens, toolCallCount) {
83
+ otel.emitLogRecord(`copilot_chat.agent.turn: ${turnIndex}`, {
84
+ 'event.name': 'copilot_chat.agent.turn',
85
+ 'turn.index': turnIndex,
86
+ [genAiAttributes_1.GenAiAttr.USAGE_INPUT_TOKENS]: inputTokens,
87
+ [genAiAttributes_1.GenAiAttr.USAGE_OUTPUT_TOKENS]: outputTokens,
88
+ 'tool_call_count': toolCallCount,
89
+ });
90
+ }
91
+ //# sourceMappingURL=genAiEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genAiEvents.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/genAiEvents.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAShG,8DAsDC;AAKD,sDAYC;AAED,8CAcC;AAED,gDAcC;AA9GD,uDAA2E;AAC3E,2DAAsD;AAGtD;;GAEG;AACH,SAAgB,yBAAyB,CACxC,IAAkB,EAClB,OAOC,EACD,QAMa,EACb,KAAyC;IAEzC,MAAM,UAAU,GAA4B;QAC3C,YAAY,EAAE,2CAA2C;QACzD,CAAC,2BAAS,CAAC,cAAc,CAAC,EAAE,oCAAkB,CAAC,IAAI;QACnD,CAAC,2BAAS,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC,KAAK;KACxC,CAAC;IAEF,IAAI,QAAQ,EAAE,CAAC;QACd,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YAAC,UAAU,CAAC,2BAAS,CAAC,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;QAAC,CAAC;QAC9E,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;YAAC,UAAU,CAAC,2BAAS,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;QAAC,CAAC;QACrE,IAAI,QAAQ,CAAC,aA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Y,EAAE,yBAAyB;QACvC,YAAY,EAAE,SAAS;QACvB,CAAC,2BAAS,CAAC,kBAAkB,CAAC,EAAE,WAAW;QAC3C,CAAC,2BAAS,CAAC,mBAAmB,CAAC,EAAE,YAAY;QAC7C,iBAAiB,EAAE,aAAa;KAChC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { IOTelService } from './otelService';
2
+ /**
3
+ * Pre-configured OTel GenAI metric instruments.
4
+ * All methods are static to avoid per-call allocations (aligned with gemini-cli pattern).
5
+ */
6
+ export declare class GenAiMetrics {
7
+ static recordOperationDuration(otel: IOTelService, durationSec: number, attrs: {
8
+ operationName: string;
9
+ providerName: string;
10
+ requestModel: string;
11
+ responseModel?: string;
12
+ serverAddress?: string;
13
+ serverPort?: number;
14
+ errorType?: string;
15
+ }): void;
16
+ static recordTokenUsage(otel: IOTelService, tokenCount: number, tokenType: 'input' | 'output', attrs: {
17
+ operationName: string;
18
+ providerName: string;
19
+ requestModel: string;
20
+ responseModel?: string;
21
+ serverAddress?: string;
22
+ }): void;
23
+ static recordToolCallCount(otel: IOTelService, toolName: string, success: boolean): void;
24
+ static recordToolCallDuration(otel: IOTelService, toolName: string, durationMs: number): void;
25
+ static recordAgentDuration(otel: IOTelService, agentName: string, durationSec: number): void;
26
+ static recordAgentTurnCount(otel: IOTelService, agentName: string, turnCount: number): void;
27
+ static recordTimeToFirstToken(otel: IOTelService, model: string, ttftSec: number): void;
28
+ static incrementSessionCount(otel: IOTelService): void;
29
+ }
30
+ //# sourceMappingURL=genAiMetrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genAiMetrics.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/genAiMetrics.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;;GAGG;AACH,qBAAa,YAAY;IAIxB,MAAM,CAAC,uBAAuB,CAC7B,IAAI,EAAE,YAAY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D"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.GenAiMetrics = void 0;
8
+ const genAiAttributes_1 = require("./genAiAttributes");
9
+ /**
10
+ * Pre-configured OTel GenAI metric instruments.
11
+ * All methods are static to avoid per-call allocations (aligned with gemini-cli pattern).
12
+ */
13
+ class GenAiMetrics {
14
+ // ── GenAI Convention Metrics ──
15
+ static recordOperationDuration(otel, durationSec, attrs) {
16
+ otel.recordMetric('gen_ai.client.operation.duration', durationSec, {
17
+ [genAiAttributes_1.GenAiAttr.OPERATION_NAME]: attrs.operationName,
18
+ [genAiAttributes_1.GenAiAttr.PROVIDER_NAME]: attrs.providerName,
19
+ [genAiAttributes_1.GenAiAttr.REQUEST_MODEL]: attrs.requestModel,
20
+ ...(attrs.responseModel ? { [genAiAttributes_1.GenAiAttr.RESPONSE_MODEL]: attrs.responseModel } : {}),
21
+ ...(attrs.serverAddress ? { [genAiAttributes_1.StdAttr.SERVER_ADDRESS]: attrs.serverAddress } : {}),
22
+ ...(attrs.serverPort ? { [genAiAttributes_1.StdAttr.SERVER_PORT]: attrs.serverPort } : {}),
23
+ ...(attrs.errorType ? { [genAiAttributes_1.StdAttr.ERROR_TYPE]: attrs.errorType } : {}),
24
+ });
25
+ }
26
+ static recordTokenUsage(otel, tokenCount, tokenType, attrs) {
27
+ otel.recordMetric('gen_ai.client.token.usage', tokenCount, {
28
+ [genAiAttributes_1.GenAiAttr.OPERATION_NAME]: attrs.operationName,
29
+ [genAiAttributes_1.GenAiAttr.PROVIDER_NAME]: attrs.providerName,
30
+ [genAiAttributes_1.GenAiAttr.TOKEN_TYPE]: tokenType,
31
+ [genAiAttributes_1.GenAiAttr.REQUEST_MODEL]: attrs.requestModel,
32
+ ...(attrs.responseModel ? { [genAiAttributes_1.GenAiAttr.RESPONSE_MODEL]: attrs.responseModel } : {}),
33
+ ...(attrs.serverAddress ? { [genAiAttributes_1.StdAttr.SERVER_ADDRESS]: attrs.serverAddress } : {}),
34
+ });
35
+ }
36
+ // ── Extension-Specific Metrics ──
37
+ static recordToolCallCount(otel, toolName, success) {
38
+ otel.incrementCounter('copilot_chat.tool.call.count', 1, {
39
+ [genAiAttributes_1.GenAiAttr.TOOL_NAME]: toolName,
40
+ success,
41
+ });
42
+ }
43
+ static recordToolCallDuration(otel, toolName, durationMs) {
44
+ otel.recordMetric('copilot_chat.tool.call.duration', durationMs, {
45
+ [genAiAttributes_1.GenAiAttr.TOOL_NAME]: toolName,
46
+ });
47
+ }
48
+ static recordAgentDuration(otel, agentName, durationSec) {
49
+ otel.recordMetric('copilot_chat.agent.invocation.duration', durationSec, {
50
+ [genAiAttributes_1.GenAiAttr.AGENT_NAME]: agentName,
51
+ });
52
+ }
53
+ static recordAgentTurnCount(otel, agentName, turnCount) {
54
+ otel.recordMetric('copilot_chat.agent.turn.count', turnCount, {
55
+ [genAiAttributes_1.GenAiAttr.AGENT_NAME]: agentName,
56
+ });
57
+ }
58
+ static recordTimeToFirstToken(otel, model, ttftSec) {
59
+ otel.recordMetric('copilot_chat.time_to_first_token', ttftSec, {
60
+ [genAiAttributes_1.GenAiAttr.REQUEST_MODEL]: model,
61
+ });
62
+ }
63
+ static incrementSessionCount(otel) {
64
+ otel.incrementCounter('copilot_chat.session.count');
65
+ }
66
+ }
67
+ exports.GenAiMetrics = GenAiMetrics;
68
+ //# sourceMappingURL=genAiMetrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genAiMetrics.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/genAiMetrics.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,uDAAuD;AAGvD;;;GAGG;AACH,MAAa,YAAY;IAExB,iCAAiC;IAEjC,MAAM,CAAC,uBAAuB,C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ED,MAAM,CAAC,sBAAsB,CAAC,IAAkB,EAAE,KAAa,EAAE,OAAe;QAC/E,IAAI,CAAC,YAAY,CAAC,kCAAkC,EAAE,OAAO,EAAE;YAC9D,CAAC,2BAAS,CAAC,aAAa,CAAC,EAAE,KAAK;SAChC,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,qBAAqB,CAAC,IAAkB;QAC9C,IAAI,CAAC,gBAAgB,CAAC,4BAA4B,CAAC,CAAC;IACrD,CAAC;CACD;AAtFD,oCAsFC"}
@@ -0,0 +1,8 @@
1
+ export { CopilotChatAttr, GenAiAttr, GenAiOperationName, GenAiProviderName, GenAiTokenType, GenAiToolType, StdAttr } from './genAiAttributes';
2
+ export { emitAgentTurnEvent, emitInferenceDetailsEvent, emitSessionStartEvent, emitToolCallEvent } from './genAiEvents';
3
+ export { GenAiMetrics } from './genAiMetrics';
4
+ export { toInputMessages, toOutputMessages, toSystemInstructions, toToolDefinitions, truncateForOTel } from './messageFormatters';
5
+ export { NoopOTelService } from './noopOtelService';
6
+ export { resolveOTelConfig, type OTelConfig, type OTelConfigInput } from './otelConfig';
7
+ export { IOTelService, SpanKind, SpanStatusCode, type ICompletedSpanData, type ISpanEventData, type ISpanEventRecord, type ISpanHandle, type OTelModelOptions, type SpanOptions, type TraceContext } from './otelService';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC9I,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACxH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAClI,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.IOTelService = exports.resolveOTelConfig = exports.NoopOTelService = exports.truncateForOTel = exports.toToolDefinitions = exports.toSystemInstructions = exports.toOutputMessages = exports.toInputMessages = exports.GenAiMetrics = exports.emitToolCallEvent = exports.emitSessionStartEvent = exports.emitInferenceDetailsEvent = exports.emitAgentTurnEvent = exports.StdAttr = exports.GenAiToolType = exports.GenAiTokenType = exports.GenAiProviderName = exports.GenAiOperationName = exports.GenAiAttr = exports.CopilotChatAttr = void 0;
8
+ var genAiAttributes_1 = require("./genAiAttributes");
9
+ Object.defineProperty(exports, "CopilotChatAttr", { enumerable: true, get: function () { return genAiAttributes_1.CopilotChatAttr; } });
10
+ Object.defineProperty(exports, "GenAiAttr", { enumerable: true, get: function () { return genAiAttributes_1.GenAiAttr; } });
11
+ Object.defineProperty(exports, "GenAiOperationName", { enumerable: true, get: function () { return genAiAttributes_1.GenAiOperationName; } });
12
+ Object.defineProperty(exports, "GenAiProviderName", { enumerable: true, get: function () { return genAiAttributes_1.GenAiProviderName; } });
13
+ Object.defineProperty(exports, "GenAiTokenType", { enumerable: true, get: function () { return genAiAttributes_1.GenAiTokenType; } });
14
+ Object.defineProperty(exports, "GenAiToolType", { enumerable: true, get: function () { return genAiAttributes_1.GenAiToolType; } });
15
+ Object.defineProperty(exports, "StdAttr", { enumerable: true, get: function () { return genAiAttributes_1.StdAttr; } });
16
+ var genAiEvents_1 = require("./genAiEvents");
17
+ Object.defineProperty(exports, "emitAgentTurnEvent", { enumerable: true, get: function () { return genAiEvents_1.emitAgentTurnEvent; } });
18
+ Object.defineProperty(exports, "emitInferenceDetailsEvent", { enumerable: true, get: function () { return genAiEvents_1.emitInferenceDetailsEvent; } });
19
+ Object.defineProperty(exports, "emitSessionStartEvent", { enumerable: true, get: function () { return genAiEvents_1.emitSessionStartEvent; } });
20
+ Object.defineProperty(exports, "emitToolCallEvent", { enumerable: true, get: function () { return genAiEvents_1.emitToolCallEvent; } });
21
+ var genAiMetrics_1 = require("./genAiMetrics");
22
+ Object.defineProperty(exports, "GenAiMetrics", { enumerable: true, get: function () { return genAiMetrics_1.GenAiMetrics; } });
23
+ var messageFormatters_1 = require("./messageFormatters");
24
+ Object.defineProperty(exports, "toInputMessages", { enumerable: true, get: function () { return messageFormatters_1.toInputMessages; } });
25
+ Object.defineProperty(exports, "toOutputMessages", { enumerable: true, get: function () { return messageFormatters_1.toOutputMessages; } });
26
+ Object.defineProperty(exports, "toSystemInstructions", { enumerable: true, get: function () { return messageFormatters_1.toSystemInstructions; } });
27
+ Object.defineProperty(exports, "toToolDefinitions", { enumerable: true, get: function () { return messageFormatters_1.toToolDefinitions; } });
28
+ Object.defineProperty(exports, "truncateForOTel", { enumerable: true, get: function () { return messageFormatters_1.truncateForOTel; } });
29
+ var noopOtelService_1 = require("./noopOtelService");
30
+ Object.defineProperty(exports, "NoopOTelService", { enumerable: true, get: function () { return noopOtelService_1.NoopOTelService; } });
31
+ var otelConfig_1 = require("./otelConfig");
32
+ Object.defineProperty(exports, "resolveOTelConfig", { enumerable: true, get: function () { return otelConfig_1.resolveOTelConfig; } });
33
+ var otelService_1 = require("./otelService");
34
+ Object.defineProperty(exports, "IOTelService", { enumerable: true, get: function () { return otelService_1.IOTelService; } });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/index.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,qDAA8I;AAArI,kHAAA,eAAe,OAAA;AAAE,4GAAA,SAAS,OAAA;AAAE,qHAAA,kBAAkB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAAE,iHAAA,cAAc,OAAA;AAAE,gHAAA,aAAa,OAAA;AAAE,0GAAA,OAAO,OAAA;AAClH,6CAAwH;AAA/G,iHAAA,kBAAkB,OAAA;AAAE,wHAAA,yBAAyB,OAAA;AAAE,oHAAA,qBAAqB,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAChG,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,yDAAkI;AAAzH,oHAAA,eAAe,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AAAE,yHAAA,oBAAoB,OAAA;AAAE,sHAAA,iBAAiB,OAAA;AAAE,oHAAA,eAAe,OAAA;AACpG,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,2CAAwF;AAA/E,+GAAA,iBAAiB,OAAA;AAC1B,6CAA0N;AAAjN,2GAAA,YAAY,OAAA"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Truncate a string to fit within OTel attribute size limits.
3
+ * Returns the original string if within bounds, otherwise truncates with a suffix.
4
+ */
5
+ export declare function truncateForOTel(value: string, maxLength?: number): string;
6
+ export interface OTelChatMessage {
7
+ role: string | undefined;
8
+ parts: OTelMessagePart[];
9
+ }
10
+ export interface OTelOutputMessage extends OTelChatMessage {
11
+ finish_reason?: string;
12
+ }
13
+ export type OTelMessagePart = {
14
+ type: 'text';
15
+ content: string;
16
+ } | {
17
+ type: 'tool_call';
18
+ id: string;
19
+ name: string;
20
+ arguments: unknown;
21
+ } | {
22
+ type: 'tool_call_response';
23
+ id: string;
24
+ content: unknown;
25
+ } | {
26
+ type: 'reasoning';
27
+ content: string;
28
+ };
29
+ export type OTelSystemInstruction = Array<{
30
+ type: 'text';
31
+ content: string;
32
+ }>;
33
+ export interface OTelToolDefinition {
34
+ type: 'function';
35
+ name: string;
36
+ description?: string;
37
+ parameters?: unknown;
38
+ }
39
+ /**
40
+ * Convert an array of internal messages to OTel input message format.
41
+ */
42
+ export declare function toInputMessages(messages: ReadonlyArray<{
43
+ role?: string;
44
+ content?: string;
45
+ tool_calls?: ReadonlyArray<{
46
+ id: string;
47
+ function: {
48
+ name: string;
49
+ arguments: string;
50
+ };
51
+ }>;
52
+ }>): OTelChatMessage[];
53
+ /**
54
+ * Convert model response choices to OTel output message format.
55
+ */
56
+ export declare function toOutputMessages(choices: ReadonlyArray<{
57
+ message?: {
58
+ role?: string;
59
+ content?: string;
60
+ tool_calls?: ReadonlyArray<{
61
+ id: string;
62
+ function: {
63
+ name: string;
64
+ arguments: string;
65
+ };
66
+ }>;
67
+ };
68
+ finish_reason?: string;
69
+ }>): OTelOutputMessage[];
70
+ /**
71
+ * Convert system message to OTel system instruction format.
72
+ */
73
+ export declare function toSystemInstructions(systemMessage: string | undefined): OTelSystemInstruction | undefined;
74
+ /**
75
+ * Convert tool definitions to OTel tool definition format.
76
+ */
77
+ export declare function toToolDefinitions(tools: ReadonlyArray<{
78
+ type?: string;
79
+ function?: {
80
+ name: string;
81
+ description?: string;
82
+ parameters?: unknown;
83
+ };
84
+ }> | undefined): OTelToolDefinition[] | undefined;
85
+ //# sourceMappingURL=messageFormatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageFormatters.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/messageFormatters.ts"],"names":[],"mappings":"AAkBA;;;GAGG;AACH,wBAA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AE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,GAAG,eAAe,EAAE,CAuB1M;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,CAAC;IACvD,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,aAAa,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;IACzI,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC,GAAG,iBAAiB,EAAE,CA4BvB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,qBAAqB,GAAG,SAAS,CAKzG;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,CAAC;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACxE,CAAC,GAAG,SAAS,GAAG,kBAAkB,EAAE,GAAG,SAAS,CAYhD"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.truncateForOTel = truncateForOTel;
8
+ exports.toInputMessages = toInputMessages;
9
+ exports.toOutputMessages = toOutputMessages;
10
+ exports.toSystemInstructions = toSystemInstructions;
11
+ exports.toToolDefinitions = toToolDefinitions;
12
+ /**
13
+ * Converts internal message types to OTel GenAI JSON schema format.
14
+ * @see https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-input-messages.json
15
+ * @see https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-output-messages.json
16
+ */
17
+ /**
18
+ * Maximum size (in characters) for a single OTel span/log attribute value.
19
+ * Aligned with common backend limits (Jaeger 64KB, Tempo 100KB).
20
+ * Matches gemini-cli's approach of capping content to prevent OTLP batch failures.
21
+ */
22
+ const MAX_OTEL_ATTRIBUTE_LENGTH = 64_000;
23
+ /**
24
+ * Truncate a string to fit within OTel attribute size limits.
25
+ * Returns the original string if within bounds, otherwise truncates with a suffix.
26
+ */
27
+ function truncateForOTel(value, maxLength = MAX_OTEL_ATTRIBUTE_LENGTH) {
28
+ if (value.length <= maxLength) {
29
+ return value;
30
+ }
31
+ const suffix = `...[truncated, original ${value.length} chars]`;
32
+ return value.substring(0, maxLength - suffix.length) + suffix;
33
+ }
34
+ /**
35
+ * Convert an array of internal messages to OTel input message format.
36
+ */
37
+ function toInputMessages(messages) {
38
+ return messages.map(msg => {
39
+ const parts = [];
40
+ if (msg.content) {
41
+ parts.push({ type: 'text', content: msg.content });
42
+ }
43
+ if (msg.tool_calls) {
44
+ for (const tc of msg.tool_calls) {
45
+ let args;
46
+ try {
47
+ args = JSON.parse(tc.function.arguments);
48
+ }
49
+ catch {
50
+ args = tc.function.arguments;
51
+ }
52
+ parts.push({
53
+ type: 'tool_call',
54
+ id: tc.id,
55
+ name: tc.function.name,
56
+ arguments: args,
57
+ });
58
+ }
59
+ }
60
+ return { role: msg.role, parts };
61
+ });
62
+ }
63
+ /**
64
+ * Convert model response choices to OTel output message format.
65
+ */
66
+ function toOutputMessages(choices) {
67
+ return choices.map(choice => {
68
+ const parts = [];
69
+ const msg = choice.message;
70
+ if (msg?.content) {
71
+ parts.push({ type: 'text', content: msg.content });
72
+ }
73
+ if (msg?.tool_calls) {
74
+ for (const tc of msg.tool_calls) {
75
+ let args;
76
+ try {
77
+ args = JSON.parse(tc.function.arguments);
78
+ }
79
+ catch {
80
+ args = tc.function.arguments;
81
+ }
82
+ parts.push({
83
+ type: 'tool_call',
84
+ id: tc.id,
85
+ name: tc.function.name,
86
+ arguments: args,
87
+ });
88
+ }
89
+ }
90
+ return {
91
+ role: msg?.role ?? 'assistant',
92
+ parts,
93
+ finish_reason: choice.finish_reason,
94
+ };
95
+ });
96
+ }
97
+ /**
98
+ * Convert system message to OTel system instruction format.
99
+ */
100
+ function toSystemInstructions(systemMessage) {
101
+ if (!systemMessage) {
102
+ return undefined;
103
+ }
104
+ return [{ type: 'text', content: systemMessage }];
105
+ }
106
+ /**
107
+ * Convert tool definitions to OTel tool definition format.
108
+ */
109
+ function toToolDefinitions(tools) {
110
+ if (!tools || tools.length === 0) {
111
+ return undefined;
112
+ }
113
+ return tools
114
+ .filter((t) => !!t.function)
115
+ .map(t => ({
116
+ type: 'function',
117
+ name: t.function.name,
118
+ description: t.function.description,
119
+ parameters: t.function.parameters,
120
+ }));
121
+ }
122
+ //# sourceMappingURL=messageFormatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageFormatters.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/messageFormatters.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAmBhG,0CAMC;AA6BD,0CAuBC;AAKD,4CA+BC;AAKD,oDAKC;AAKD,8CAeC;AA7ID;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEzC;;;GAGG;AACH,SAAgB,eAAe,CAAC,KAAa,EAAE,YAAoB,yBAAyB;IAC3F,IAAI,KAAK,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,2BAA2B,KAAK,CAAC,MAAM,SAAS,CAAC;IAChE,OAAO,KAAK,CAA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AO,KAAK;SACV,MAAM,CAAC,CAAC,CAAC,EAAmE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;SAC5F,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACV,IAAI,EAAE,UAAmB;QACzB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI;QACrB,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW;QACnC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU;KACjC,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Event } from '../../../util/vs/base/common/event';
2
+ import type { OTelConfig } from './otelConfig';
3
+ import type { ICompletedSpanData, IOTelService, ISpanEventData, ISpanHandle, SpanOptions, TraceContext } from './otelService';
4
+ /**
5
+ * No-op implementation of IOTelService.
6
+ * All methods are zero-cost when OTel is disabled.
7
+ */
8
+ export declare class NoopOTelService implements IOTelService {
9
+ readonly _serviceBrand: undefined;
10
+ readonly config: OTelConfig;
11
+ constructor(config: OTelConfig);
12
+ startSpan(_name: string, _options?: SpanOptions): ISpanHandle;
13
+ startActiveSpan<T>(_name: string, _options: SpanOptions, fn: (span: ISpanHandle) => Promise<T>): Promise<T>;
14
+ getActiveTraceContext(): TraceContext | undefined;
15
+ storeTraceContext(_key: string, _context: TraceContext): void;
16
+ getStoredTraceContext(_key: string): TraceContext | undefined;
17
+ runWithTraceContext<T>(_traceContext: TraceContext, fn: () => Promise<T>): Promise<T>;
18
+ recordMetric(_name: string, _value: number, _attributes?: Record<string, string | number | boolean>): void;
19
+ incrementCounter(_name: string, _value?: number, _attributes?: Record<string, string | number | boolean>): void;
20
+ emitLogRecord(_body: string, _attributes?: Record<string, unknown>): void;
21
+ flush(): Promise<void>;
22
+ shutdown(): Promise<void>;
23
+ readonly onDidCompleteSpan: Event<ICompletedSpanData>;
24
+ readonly onDidEmitSpanEvent: Event<ISpanEventData>;
25
+ }
26
+ //# sourceMappingURL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AAI;IAE1G,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI;IAE/G,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAEnE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAE/B,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAc;IACnE,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,cAAc,CAAC,CAAc;CAChE"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.NoopOTelService = void 0;
8
+ const event_1 = require("../../../util/vs/base/common/event");
9
+ const noopSpan = {
10
+ setAttribute() { },
11
+ setAttributes() { },
12
+ setStatus() { },
13
+ recordException() { },
14
+ addEvent() { },
15
+ getSpanContext() { return undefined; },
16
+ end() { },
17
+ };
18
+ /**
19
+ * No-op implementation of IOTelService.
20
+ * All methods are zero-cost when OTel is disabled.
21
+ */
22
+ class NoopOTelService {
23
+ constructor(config) {
24
+ this.onDidCompleteSpan = event_1.Event.None;
25
+ this.onDidEmitSpanEvent = event_1.Event.None;
26
+ this.config = config;
27
+ }
28
+ startSpan(_name, _options) {
29
+ return noopSpan;
30
+ }
31
+ startActiveSpan(_name, _options, fn) {
32
+ return fn(noopSpan);
33
+ }
34
+ getActiveTraceContext() {
35
+ return undefined;
36
+ }
37
+ storeTraceContext(_key, _context) { }
38
+ getStoredTraceContext(_key) {
39
+ return undefined;
40
+ }
41
+ runWithTraceContext(_traceContext, fn) {
42
+ return fn();
43
+ }
44
+ recordMetric(_name, _value, _attributes) { }
45
+ incrementCounter(_name, _value, _attributes) { }
46
+ emitLogRecord(_body, _attributes) { }
47
+ async flush() { }
48
+ async shutdown() { }
49
+ }
50
+ exports.NoopOTelService = NoopOTelService;
51
+ //# sourceMappingURL=noopOtelService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noopOtelService.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/noopOtelService.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,8DAA2D;AAI3D,MAAM,QAAQ,GAAgB;IAC7B,YAAY,KAAK,CAAC;IAClB,aAAa,KAAK,CAAC;IACnB,SAAS,KAAK,CAAC;IACf,eAAe,KAAK,CAAC;IACrB,QAAQ,KAAK,CAAC;IACd,cAAc,KAAK,OAAO,SAAS,CAAC,CAAC,CAAC;IACtC,GAAG,KAAK,CAAC;CACT,CAAC;AAEF;;;GAGG;AACH,MAAa,eAAe;IAI3B,YAAY,MAAkB;QAoCrB,sBAAiB,GAA8B,aAAK,CAAC,IAAI,CAAC;QAC1D,uBAAkB,GAA0B,aAAK,CAAC,IAAI,CAAC;QApC/D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,SAAS,CAAC,KAAa,EAAE,QAAsB;QAC9C,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,eAAe,CAAI,KAAa,EAAE,QAAqB,EAAE,EAAqC;QAC7F,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC;IAED,qBAAqB;QACpB,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,iBAAiB,CAAC,IAAY,EAAE,QAAsB,IAAU,CAAC;IAEjE,qBAAqB,CAAC,IAAY;QACjC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,mBAAmB,CAAI,aAA2B,EAAE,EAAoB;QACvE,OAAO,EAAE,EAAE,CAAC;IACb,CAAC;IAED,YAAY,CAAC,KAAa,EAAE,MAAc,EAAE,WAAuD,IAAU,CAAC;IAE9G,gBAAgB,CAAC,KAAa,EAAE,MAAe,EAAE,WAAuD,IAAU,CAAC;IAEnH,aAAa,CAAC,KAAa,EAAE,WAAqC,IAAU,CAAC;IAE7E,KAAK,CAAC,KAAK,KAAoB,CAAC;IAEhC,KAAK,CAAC,QAAQ,KAAoB,CAAC;CAInC;AA1CD,0CA0CC"}
@@ -0,0 +1,35 @@
1
+ export type OTelExporterType = 'otlp-grpc' | 'otlp-http' | 'console' | 'file';
2
+ export interface OTelConfig {
3
+ readonly enabled: boolean;
4
+ readonly exporterType: OTelExporterType;
5
+ readonly otlpEndpoint: string;
6
+ readonly otlpProtocol: 'grpc' | 'http';
7
+ readonly captureContent: boolean;
8
+ readonly fileExporterPath?: string;
9
+ readonly logLevel: 'trace' | 'debug' | 'info' | 'warn' | 'error';
10
+ readonly httpInstrumentation: boolean;
11
+ readonly serviceName: string;
12
+ readonly serviceVersion: string;
13
+ readonly sessionId: string;
14
+ readonly resourceAttributes: Record<string, string>;
15
+ }
16
+ export interface OTelConfigInput {
17
+ env: Record<string, string | undefined>;
18
+ settingEnabled?: boolean;
19
+ settingExporterType?: OTelExporterType;
20
+ settingOtlpEndpoint?: string;
21
+ settingCaptureContent?: boolean;
22
+ settingOutfile?: string;
23
+ extensionVersion: string;
24
+ sessionId: string;
25
+ vscodeTelemetryLevel?: string;
26
+ }
27
+ /**
28
+ * Resolve OTel configuration with layered precedence:
29
+ * 1. COPILOT_OTEL_* env vars (highest)
30
+ * 2. OTEL_EXPORTER_OTLP_* standard env vars
31
+ * 3. VS Code settings
32
+ * 4. Defaults (lowest)
33
+ */
34
+ export declare function resolveOTelConfig(input: OTelConfigInput): OTelConfig;
35
+ //# sourceMappingURL=otelConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otelConfig.d.ts","sourceRoot":"","s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