@vscode/chat-lib 0.4.1-12 → 0.4.1-14

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 (112) 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 +5 -3
  4. package/dist/src/_internal/extension/byok/node/openAIEndpoint.js.map +1 -1
  5. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts +8 -0
  6. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts.map +1 -1
  7. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js +40 -1
  8. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js.map +1 -1
  9. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts +3 -1
  10. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
  11. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +182 -26
  12. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
  13. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.d.ts +2 -1
  14. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.d.ts.map +1 -1
  15. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.js +5 -3
  16. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.js.map +1 -1
  17. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts +2 -0
  18. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -1
  19. package/dist/src/_internal/extension/xtab/node/xtabProvider.js +14 -0
  20. package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -1
  21. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts +2 -1
  22. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts.map +1 -1
  23. package/dist/src/_internal/platform/chat/common/commonTypes.js +61 -17
  24. package/dist/src/_internal/platform/chat/common/commonTypes.js.map +1 -1
  25. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +7 -2
  26. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
  27. package/dist/src/_internal/platform/configuration/common/configurationService.js +8 -2
  28. package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
  29. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts.map +1 -1
  30. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js +16 -4
  31. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js.map +1 -1
  32. package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts +2 -1
  33. package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts.map +1 -1
  34. package/dist/src/_internal/platform/endpoint/common/endpointProvider.js +1 -0
  35. package/dist/src/_internal/platform/endpoint/common/endpointProvider.js.map +1 -1
  36. package/dist/src/_internal/platform/endpoint/node/autoChatEndpoint.d.ts +2 -1
  37. package/dist/src/_internal/platform/endpoint/node/autoChatEndpoint.d.ts.map +1 -1
  38. package/dist/src/_internal/platform/endpoint/node/autoChatEndpoint.js +5 -3
  39. package/dist/src/_internal/platform/endpoint/node/autoChatEndpoint.js.map +1 -1
  40. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts +5 -2
  41. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts.map +1 -1
  42. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js +17 -7
  43. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js.map +1 -1
  44. package/dist/src/_internal/platform/endpoint/node/copilotChatEndpoint.d.ts +2 -1
  45. package/dist/src/_internal/platform/endpoint/node/copilotChatEndpoint.d.ts.map +1 -1
  46. package/dist/src/_internal/platform/endpoint/node/copilotChatEndpoint.js +5 -3
  47. package/dist/src/_internal/platform/endpoint/node/copilotChatEndpoint.js.map +1 -1
  48. package/dist/src/_internal/platform/github/common/githubAPI.d.ts +1 -0
  49. package/dist/src/_internal/platform/github/common/githubAPI.d.ts.map +1 -1
  50. package/dist/src/_internal/platform/github/common/githubAPI.js +2 -0
  51. package/dist/src/_internal/platform/github/common/githubAPI.js.map +1 -1
  52. package/dist/src/_internal/platform/github/common/githubService.d.ts +10 -0
  53. package/dist/src/_internal/platform/github/common/githubService.d.ts.map +1 -1
  54. package/dist/src/_internal/platform/github/common/githubService.js +38 -0
  55. package/dist/src/_internal/platform/github/common/githubService.js.map +1 -1
  56. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.d.ts +2 -1
  57. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.d.ts.map +1 -1
  58. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.js +3 -0
  59. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.js.map +1 -1
  60. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts +1 -1
  61. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts.map +1 -1
  62. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js +1 -1
  63. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js.map +1 -1
  64. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts +17 -0
  65. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts.map +1 -1
  66. package/dist/src/_internal/platform/networking/common/fetcherService.js +27 -1
  67. package/dist/src/_internal/platform/networking/common/fetcherService.js.map +1 -1
  68. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.d.ts +6 -3
  69. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.d.ts.map +1 -1
  70. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.js +51 -23
  71. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.js.map +1 -1
  72. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.d.ts +5 -0
  73. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.d.ts.map +1 -1
  74. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.js +39 -1
  75. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.js.map +1 -1
  76. package/dist/src/_internal/platform/otel/common/genAiAttributes.d.ts +85 -0
  77. package/dist/src/_internal/platform/otel/common/genAiAttributes.d.ts.map +1 -0
  78. package/dist/src/_internal/platform/otel/common/genAiAttributes.js +105 -0
  79. package/dist/src/_internal/platform/otel/common/genAiAttributes.js.map +1 -0
  80. package/dist/src/_internal/platform/otel/common/genAiEvents.d.ts +28 -0
  81. package/dist/src/_internal/platform/otel/common/genAiEvents.d.ts.map +1 -0
  82. package/dist/src/_internal/platform/otel/common/genAiEvents.js +91 -0
  83. package/dist/src/_internal/platform/otel/common/genAiEvents.js.map +1 -0
  84. package/dist/src/_internal/platform/otel/common/genAiMetrics.d.ts +30 -0
  85. package/dist/src/_internal/platform/otel/common/genAiMetrics.d.ts.map +1 -0
  86. package/dist/src/_internal/platform/otel/common/genAiMetrics.js +68 -0
  87. package/dist/src/_internal/platform/otel/common/genAiMetrics.js.map +1 -0
  88. package/dist/src/_internal/platform/otel/common/index.d.ts +8 -0
  89. package/dist/src/_internal/platform/otel/common/index.d.ts.map +1 -0
  90. package/dist/src/_internal/platform/otel/common/index.js +35 -0
  91. package/dist/src/_internal/platform/otel/common/index.js.map +1 -0
  92. package/dist/src/_internal/platform/otel/common/messageFormatters.d.ts +85 -0
  93. package/dist/src/_internal/platform/otel/common/messageFormatters.d.ts.map +1 -0
  94. package/dist/src/_internal/platform/otel/common/messageFormatters.js +122 -0
  95. package/dist/src/_internal/platform/otel/common/messageFormatters.js.map +1 -0
  96. package/dist/src/_internal/platform/otel/common/noopOtelService.d.ts +23 -0
  97. package/dist/src/_internal/platform/otel/common/noopOtelService.d.ts.map +1 -0
  98. package/dist/src/_internal/platform/otel/common/noopOtelService.js +46 -0
  99. package/dist/src/_internal/platform/otel/common/noopOtelService.js.map +1 -0
  100. package/dist/src/_internal/platform/otel/common/otelConfig.d.ts +35 -0
  101. package/dist/src/_internal/platform/otel/common/otelConfig.d.ts.map +1 -0
  102. package/dist/src/_internal/platform/otel/common/otelConfig.js +140 -0
  103. package/dist/src/_internal/platform/otel/common/otelConfig.js.map +1 -0
  104. package/dist/src/_internal/platform/otel/common/otelService.d.ts +100 -0
  105. package/dist/src/_internal/platform/otel/common/otelService.d.ts.map +1 -0
  106. package/dist/src/_internal/platform/otel/common/otelService.js +10 -0
  107. package/dist/src/_internal/platform/otel/common/otelService.js.map +1 -0
  108. package/dist/src/main.d.ts.map +1 -1
  109. package/dist/src/main.js +7 -0
  110. package/dist/src/main.js.map +1 -1
  111. package/dist/src/package.json +109 -26
  112. package/package.json +2 -2
@@ -13,12 +13,16 @@ class ChatWebSocketTelemetrySender {
13
13
  "comment": "Report a successful WebSocket connection.",
14
14
  "conversationId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the conversation" },
15
15
  "turnId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the turn" },
16
+ "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
17
+ "gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
16
18
  "connectDurationMs": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to establish the WebSocket connection in milliseconds", "isMeasurement": true }
17
19
  }
18
20
  */
19
21
  telemetryService.sendTelemetryEvent('websocket.connected', { github: true, microsoft: true }, {
20
22
  conversationId: properties.conversationId,
21
23
  turnId: properties.turnId,
24
+ requestId: properties.requestId,
25
+ gitHubRequestId: properties.gitHubRequestId,
22
26
  }, {
23
27
  connectDurationMs: properties.connectDurationMs,
24
28
  });
@@ -30,6 +34,8 @@ class ChatWebSocketTelemetrySender {
30
34
  "comment": "Report a failed WebSocket connection attempt.",
31
35
  "conversationId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the conversation" },
32
36
  "turnId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the turn" },
37
+ "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
38
+ "gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
33
39
  "error": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Error message for the failed connection" },
34
40
  "connectDurationMs": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time until the connection error in milliseconds", "isMeasurement": true }
35
41
  }
@@ -37,6 +43,8 @@ class ChatWebSocketTelemetrySender {
37
43
  telemetryService.sendTelemetryErrorEvent('websocket.connectError', { github: true, microsoft: true }, {
38
44
  conversationId: properties.conversationId,
39
45
  turnId: properties.turnId,
46
+ requestId: properties.requestId,
47
+ gitHubRequestId: properties.gitHubRequestId,
40
48
  error: properties.error,
41
49
  }, {
42
50
  connectDurationMs: properties.connectDurationMs,
@@ -49,6 +57,8 @@ class ChatWebSocketTelemetrySender {
49
57
  "comment": "Report a WebSocket connection close event.",
50
58
  "conversationId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the conversation" },
51
59
  "turnId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the turn" },
60
+ "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
61
+ "gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
52
62
  "closeReason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Human-readable description of the close code" },
53
63
  "closeEventReason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Close event reason string from server" },
54
64
  "closeEventWasClean": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Whether the connection closed cleanly" },
@@ -63,6 +73,8 @@ class ChatWebSocketTelemetrySender {
63
73
  telemetryService.sendTelemetryEvent('websocket.close', { github: true, microsoft: true }, {
64
74
  conversationId: properties.conversationId,
65
75
  turnId: properties.turnId,
76
+ requestId: properties.requestId,
77
+ gitHubRequestId: properties.gitHubRequestId,
66
78
  closeReason: properties.closeReason,
67
79
  closeEventReason: properties.closeEventReason,
68
80
  closeEventWasClean: properties.closeEventWasClean,
@@ -82,6 +94,8 @@ class ChatWebSocketTelemetrySender {
82
94
  "comment": "Report a runtime error on an established WebSocket connection.",
83
95
  "conversationId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the conversation" },
84
96
  "turnId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the turn" },
97
+ "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
98
+ "gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
85
99
  "error": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Error message" },
86
100
  "totalSentMessageCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of messages sent over this connection", "isMeasurement": true },
87
101
  "totalReceivedMessageCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of messages received over this connection", "isMeasurement": true },
@@ -93,6 +107,8 @@ class ChatWebSocketTelemetrySender {
93
107
  telemetryService.sendTelemetryErrorEvent('websocket.error', { github: true, microsoft: true }, {
94
108
  conversationId: properties.conversationId,
95
109
  turnId: properties.turnId,
110
+ requestId: properties.requestId,
111
+ gitHubRequestId: properties.gitHubRequestId,
96
112
  error: properties.error,
97
113
  }, {
98
114
  totalSentMessageCount: properties.totalSentMessageCount,
@@ -109,6 +125,8 @@ class ChatWebSocketTelemetrySender {
109
125
  "comment": "Report when a WebSocket connection is closed during setup before fully opening.",
110
126
  "conversationId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the conversation" },
111
127
  "turnId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the turn" },
128
+ "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
129
+ "gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
112
130
  "closeReason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Human-readable description of the close code" },
113
131
  "closeEventReason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Close event reason string from server" },
114
132
  "closeEventWasClean": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Whether the connection closed cleanly" },
@@ -119,6 +137,8 @@ class ChatWebSocketTelemetrySender {
119
137
  telemetryService.sendTelemetryErrorEvent('websocket.closeDuringSetup', { github: true, microsoft: true }, {
120
138
  conversationId: properties.conversationId,
121
139
  turnId: properties.turnId,
140
+ requestId: properties.requestId,
141
+ gitHubRequestId: properties.gitHubRequestId,
122
142
  closeReason: properties.closeReason,
123
143
  closeEventReason: properties.closeEventReason,
124
144
  closeEventWasClean: properties.closeEventWasClean,
@@ -134,6 +154,8 @@ class ChatWebSocketTelemetrySender {
134
154
  "comment": "Report when a request is sent over the WebSocket connection.",
135
155
  "conversationId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the conversation" },
136
156
  "turnId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the turn" },
157
+ "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
158
+ "gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
137
159
  "totalSentMessageCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of messages sent over this connection", "isMeasurement": true },
138
160
  "totalReceivedMessageCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of messages received over this connection", "isMeasurement": true },
139
161
  "sentMessageCharacters": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Character count of this sent message payload", "isMeasurement": true },
@@ -145,6 +167,8 @@ class ChatWebSocketTelemetrySender {
145
167
  telemetryService.sendTelemetryEvent('websocket.requestSent', { github: true, microsoft: true }, {
146
168
  conversationId: properties.conversationId,
147
169
  turnId: properties.turnId,
170
+ requestId: properties.requestId,
171
+ gitHubRequestId: properties.gitHubRequestId,
148
172
  }, {
149
173
  totalSentMessageCount: properties.totalSentMessageCount,
150
174
  totalReceivedMessageCount: properties.totalReceivedMessageCount,
@@ -161,6 +185,8 @@ class ChatWebSocketTelemetrySender {
161
185
  "comment": "Report when a received websocket message fails JSON parsing.",
162
186
  "conversationId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the conversation" },
163
187
  "turnId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the turn" },
188
+ "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
189
+ "gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
164
190
  "error": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Parse error message" },
165
191
  "totalSentMessageCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of messages sent over this connection", "isMeasurement": true },
166
192
  "totalReceivedMessageCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of messages received over this connection", "isMeasurement": true },
@@ -173,6 +199,8 @@ class ChatWebSocketTelemetrySender {
173
199
  telemetryService.sendTelemetryErrorEvent('websocket.messageParseError', { github: true, microsoft: true }, {
174
200
  conversationId: properties.conversationId,
175
201
  turnId: properties.turnId,
202
+ requestId: properties.requestId,
203
+ gitHubRequestId: properties.gitHubRequestId,
176
204
  error: properties.error,
177
205
  }, {
178
206
  totalSentMessageCount: properties.totalSentMessageCount,
@@ -190,6 +218,8 @@ class ChatWebSocketTelemetrySender {
190
218
  "comment": "Report terminal outcome for a websocket request.",
191
219
  "conversationId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the conversation" },
192
220
  "turnId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the turn" },
221
+ "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
222
+ "gitHubRequestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "GitHub request id if available" },
193
223
  "requestOutcome": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Terminal outcome of the websocket request" },
194
224
  "totalSentMessageCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of messages sent over this connection", "isMeasurement": true },
195
225
  "totalReceivedMessageCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of messages received over this connection", "isMeasurement": true },
@@ -201,13 +231,21 @@ class ChatWebSocketTelemetrySender {
201
231
  "requestReceivedCharacters": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of characters received during this request", "isMeasurement": true },
202
232
  "connectionDurationMs": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "How long the connection has been open when the request ended in milliseconds", "isMeasurement": true },
203
233
  "requestDurationMs": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "How long the request took before terminal outcome in milliseconds", "isMeasurement": true },
204
- "closeCode": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "WebSocket close code when outcome is connection_closed", "isMeasurement": true }
234
+ "closeCode": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "WebSocket close code when outcome is connection_closed", "isMeasurement": true },
235
+ "closeReason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "WebSocket close reason when outcome is connection_closed" },
236
+ "serverErrorMessage": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Error message from server error event when outcome is server_error" },
237
+ "serverErrorCode": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Error code from server error event when outcome is server_error" }
205
238
  }
206
239
  */
207
240
  telemetryService.sendTelemetryEvent('websocket.requestOutcome', { github: true, microsoft: true }, {
208
241
  conversationId: properties.conversationId,
209
242
  turnId: properties.turnId,
243
+ requestId: properties.requestId,
244
+ gitHubRequestId: properties.gitHubRequestId,
210
245
  requestOutcome: properties.requestOutcome,
246
+ closeReason: properties.closeReason,
247
+ serverErrorMessage: properties.serverErrorMessage,
248
+ serverErrorCode: properties.serverErrorCode,
211
249
  }, {
212
250
  totalSentMessageCount: properties.totalSentMessageCount,
213
251
  totalReceivedMessageCount: properties.totalReceivedMessageCount,
@@ -1 +1 @@
1
- {"version":3,"file":"chatWebSocketTelemetry.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/node/chatWebSocketTelemetry.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAmFhG,MAAa,4BAA4B;IAEjC,MAAM,CAAC,sBAAsB,CACnC,gBAAmC,EACnC,UAAsD;QAEtD;;;;;;;;UAQE;QACF,gBAAgB,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;YAC7F,cAAc,EAAE,UAAU,CAAC,cAAc;YACzC,MAAM,EAAE,UAAU,CAAC,MAAM;SACzB,EAAE;YACF,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAC/C,CAAC,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,yBAAyB,CACtC,gBAAmC,EACnC,UAAyD;QAEzD;;;;;;;;;UASE;QACF,gBAAgB,CAAC,uBAAuB,CAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;Y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AAyB;YAC/D,oBAAoB,EAAE,UAAU,CAAC,oBAAoB;YACrD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;YAC/C,SAAS,EAAE,UAAU,CAAC,SAAS;SAC/B,CAAC,CAAC;IACJ,CAAC;CACD;AAzPD,oEAyPC"}
1
+ {"version":3,"file":"chatWebSocketTelemetry.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/node/chatWebSocketTelemetry.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAwFhG,MAAa,4BAA4B;IAEjC,MAAM,CAAC,sBAAsB,CACnC,gBAAmC,EACnC,UAAsD;QAEtD;;;;;;;;;;UAUE;QACF,gBAAgB,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;YAC7F,cAAc,EAAE,UAAU,CAAC,cAAc;YACzC,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,eAAe,EAAE,UAAU,CAAC,eAAe;SAC3C,EAAE;YACF,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAC/C,CAAC,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,yBAAyB,CACtC,gBAAmC,EACnC,UAAyD;QAEzD;;;;;;;;;;;UAWE;QACF,gBAAgB,CAAC,uBAAuB,CAAC,wBAAwB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;YACrG,cAAc,EAAE,UAAU,CAAC,cAAc;YACzC,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,eAAe,EAAE,UAAU,CAAC,eAAe;YAC3C,KAAK,EAAE,UAAU,CAAC,KAAK;SACvB,EAAE;YACF,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;SAC/C,CAAC,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,kBAAkB,CA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,EAAE,UAAU,CAAC,eAAe;SAC3C,EAAE;YACF,qBAAqB,EAAE,UAAU,CAAC,qBAAqB;YACvD,yBAAyB,EAAE,UAAU,CAAC,yBAAyB;YAC/D,mBAAmB,EAAE,UAAU,CAAC,mBAAmB;YACnD,uBAAuB,EAAE,UAAU,CAAC,uBAAuB;YAC3D,uBAAuB,EAAE,UAAU,CAAC,uBAAuB;YAC3D,2BAA2B,EAAE,UAAU,CAAC,2BAA2B;YACnE,qBAAqB,EAAE,UAAU,CAAC,qBAAqB;YACvD,yBAAyB,EAAE,UAAU,CAAC,yBAAyB;YAC/D,oBAAoB,EAAE,UAAU,CAAC,oBAAoB;YACrD,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;YAC/C,SAAS,EAAE,UAAU,CAAC,SAAS;SAC/B,CAAC,CAAC;IACJ,CAAC;CACD;AA/RD,oEA+RC"}
@@ -0,0 +1,85 @@
1
+ export declare const GenAiOperationName: {
2
+ readonly CHAT: "chat";
3
+ readonly INVOKE_AGENT: "invoke_agent";
4
+ readonly EXECUTE_TOOL: "execute_tool";
5
+ readonly EMBEDDINGS: "embeddings";
6
+ };
7
+ export declare const GenAiProviderName: {
8
+ readonly GITHUB: "github";
9
+ readonly OPENAI: "openai";
10
+ readonly ANTHROPIC: "anthropic";
11
+ readonly AZURE_AI_OPENAI: "azure.ai.openai";
12
+ };
13
+ export declare const GenAiTokenType: {
14
+ readonly INPUT: "input";
15
+ readonly OUTPUT: "output";
16
+ };
17
+ export declare const GenAiToolType: {
18
+ readonly FUNCTION: "function";
19
+ readonly EXTENSION: "extension";
20
+ };
21
+ /**
22
+ * OTel GenAI semantic convention attribute keys.
23
+ * @see https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-spans.md
24
+ */
25
+ export declare const GenAiAttr: {
26
+ readonly OPERATION_NAME: "gen_ai.operation.name";
27
+ readonly PROVIDER_NAME: "gen_ai.provider.name";
28
+ readonly REQUEST_MODEL: "gen_ai.request.model";
29
+ readonly REQUEST_TEMPERATURE: "gen_ai.request.temperature";
30
+ readonly REQUEST_MAX_TOKENS: "gen_ai.request.max_tokens";
31
+ readonly REQUEST_TOP_P: "gen_ai.request.top_p";
32
+ readonly REQUEST_FREQUENCY_PENALTY: "gen_ai.request.frequency_penalty";
33
+ readonly REQUEST_PRESENCE_PENALTY: "gen_ai.request.presence_penalty";
34
+ readonly REQUEST_SEED: "gen_ai.request.seed";
35
+ readonly REQUEST_STOP_SEQUENCES: "gen_ai.request.stop_sequences";
36
+ readonly RESPONSE_MODEL: "gen_ai.response.model";
37
+ readonly RESPONSE_ID: "gen_ai.response.id";
38
+ readonly RESPONSE_FINISH_REASONS: "gen_ai.response.finish_reasons";
39
+ readonly USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens";
40
+ readonly USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens";
41
+ readonly USAGE_CACHE_READ_INPUT_TOKENS: "gen_ai.usage.cache_read.input_tokens";
42
+ readonly USAGE_CACHE_CREATION_INPUT_TOKENS: "gen_ai.usage.cache_creation.input_tokens";
43
+ readonly CONVERSATION_ID: "gen_ai.conversation.id";
44
+ readonly OUTPUT_TYPE: "gen_ai.output.type";
45
+ readonly TOKEN_TYPE: "gen_ai.token.type";
46
+ readonly AGENT_NAME: "gen_ai.agent.name";
47
+ readonly AGENT_ID: "gen_ai.agent.id";
48
+ readonly AGENT_VERSION: "gen_ai.agent.version";
49
+ readonly AGENT_DESCRIPTION: "gen_ai.agent.description";
50
+ readonly TOOL_NAME: "gen_ai.tool.name";
51
+ readonly TOOL_TYPE: "gen_ai.tool.type";
52
+ readonly TOOL_CALL_ID: "gen_ai.tool.call.id";
53
+ readonly TOOL_DESCRIPTION: "gen_ai.tool.description";
54
+ readonly TOOL_CALL_ARGUMENTS: "gen_ai.tool.call.arguments";
55
+ readonly TOOL_CALL_RESULT: "gen_ai.tool.call.result";
56
+ readonly INPUT_MESSAGES: "gen_ai.input.messages";
57
+ readonly OUTPUT_MESSAGES: "gen_ai.output.messages";
58
+ readonly SYSTEM_INSTRUCTIONS: "gen_ai.system_instructions";
59
+ readonly TOOL_DEFINITIONS: "gen_ai.tool.definitions";
60
+ };
61
+ /**
62
+ * Extension-specific attribute keys (custom namespace).
63
+ */
64
+ export declare const CopilotChatAttr: {
65
+ readonly LOCATION: "copilot_chat.location";
66
+ readonly INTENT: "copilot_chat.intent";
67
+ readonly TURN_INDEX: "copilot_chat.turn.index";
68
+ readonly TURN_COUNT: "copilot_chat.turn_count";
69
+ readonly TOOL_CALL_ROUND: "copilot_chat.tool_call_round";
70
+ readonly API_TYPE: "copilot_chat.api_type";
71
+ readonly FETCHER: "copilot_chat.fetcher";
72
+ readonly DEBUG_NAME: "copilot_chat.debug_name";
73
+ readonly ENDPOINT_TYPE: "copilot_chat.endpoint_type";
74
+ readonly MAX_PROMPT_TOKENS: "copilot_chat.request.max_prompt_tokens";
75
+ readonly TIME_TO_FIRST_TOKEN: "copilot_chat.time_to_first_token";
76
+ };
77
+ /**
78
+ * Standard OTel attributes used alongside GenAI attributes.
79
+ */
80
+ export declare const StdAttr: {
81
+ readonly ERROR_TYPE: "error.type";
82
+ readonly SERVER_ADDRESS: "server.address";
83
+ readonly SERVER_PORT: "server.port";
84
+ };
85
+ //# sourceMappingURL=genAiAttributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genAiAttributes.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/genAiAttributes.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB;;;;;CAKrB,CAAC;AAGX,eAAO,MAAM,iBAAiB;;;;;CAKpB,CAAC;AAGX,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAGX,eAAO,MAAM,aAAa;;;CAGhB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;CAYlB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;CAIV,CAAC"}
@@ -0,0 +1,105 @@
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.StdAttr = exports.CopilotChatAttr = exports.GenAiAttr = exports.GenAiToolType = exports.GenAiTokenType = exports.GenAiProviderName = exports.GenAiOperationName = void 0;
8
+ // gen_ai.operation.name values
9
+ exports.GenAiOperationName = {
10
+ CHAT: 'chat',
11
+ INVOKE_AGENT: 'invoke_agent',
12
+ EXECUTE_TOOL: 'execute_tool',
13
+ EMBEDDINGS: 'embeddings',
14
+ };
15
+ // gen_ai.provider.name values
16
+ exports.GenAiProviderName = {
17
+ GITHUB: 'github',
18
+ OPENAI: 'openai',
19
+ ANTHROPIC: 'anthropic',
20
+ AZURE_AI_OPENAI: 'azure.ai.openai',
21
+ };
22
+ // gen_ai.token.type values
23
+ exports.GenAiTokenType = {
24
+ INPUT: 'input',
25
+ OUTPUT: 'output',
26
+ };
27
+ // gen_ai.tool.type values
28
+ exports.GenAiToolType = {
29
+ FUNCTION: 'function',
30
+ EXTENSION: 'extension',
31
+ };
32
+ /**
33
+ * OTel GenAI semantic convention attribute keys.
34
+ * @see https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-spans.md
35
+ */
36
+ exports.GenAiAttr = {
37
+ // Core
38
+ OPERATION_NAME: 'gen_ai.operation.name',
39
+ PROVIDER_NAME: 'gen_ai.provider.name',
40
+ // Request
41
+ REQUEST_MODEL: 'gen_ai.request.model',
42
+ REQUEST_TEMPERATURE: 'gen_ai.request.temperature',
43
+ REQUEST_MAX_TOKENS: 'gen_ai.request.max_tokens',
44
+ REQUEST_TOP_P: 'gen_ai.request.top_p',
45
+ REQUEST_FREQUENCY_PENALTY: 'gen_ai.request.frequency_penalty',
46
+ REQUEST_PRESENCE_PENALTY: 'gen_ai.request.presence_penalty',
47
+ REQUEST_SEED: 'gen_ai.request.seed',
48
+ REQUEST_STOP_SEQUENCES: 'gen_ai.request.stop_sequences',
49
+ // Response
50
+ RESPONSE_MODEL: 'gen_ai.response.model',
51
+ RESPONSE_ID: 'gen_ai.response.id',
52
+ RESPONSE_FINISH_REASONS: 'gen_ai.response.finish_reasons',
53
+ // Usage
54
+ USAGE_INPUT_TOKENS: 'gen_ai.usage.input_tokens',
55
+ USAGE_OUTPUT_TOKENS: 'gen_ai.usage.output_tokens',
56
+ USAGE_CACHE_READ_INPUT_TOKENS: 'gen_ai.usage.cache_read.input_tokens',
57
+ USAGE_CACHE_CREATION_INPUT_TOKENS: 'gen_ai.usage.cache_creation.input_tokens',
58
+ // Conversation
59
+ CONVERSATION_ID: 'gen_ai.conversation.id',
60
+ OUTPUT_TYPE: 'gen_ai.output.type',
61
+ // Token type (for metrics)
62
+ TOKEN_TYPE: 'gen_ai.token.type',
63
+ // Agent
64
+ AGENT_NAME: 'gen_ai.agent.name',
65
+ AGENT_ID: 'gen_ai.agent.id',
66
+ AGENT_VERSION: 'gen_ai.agent.version',
67
+ AGENT_DESCRIPTION: 'gen_ai.agent.description',
68
+ // Tool
69
+ TOOL_NAME: 'gen_ai.tool.name',
70
+ TOOL_TYPE: 'gen_ai.tool.type',
71
+ TOOL_CALL_ID: 'gen_ai.tool.call.id',
72
+ TOOL_DESCRIPTION: 'gen_ai.tool.description',
73
+ TOOL_CALL_ARGUMENTS: 'gen_ai.tool.call.arguments',
74
+ TOOL_CALL_RESULT: 'gen_ai.tool.call.result',
75
+ // Content (opt-in)
76
+ INPUT_MESSAGES: 'gen_ai.input.messages',
77
+ OUTPUT_MESSAGES: 'gen_ai.output.messages',
78
+ SYSTEM_INSTRUCTIONS: 'gen_ai.system_instructions',
79
+ TOOL_DEFINITIONS: 'gen_ai.tool.definitions',
80
+ };
81
+ /**
82
+ * Extension-specific attribute keys (custom namespace).
83
+ */
84
+ exports.CopilotChatAttr = {
85
+ LOCATION: 'copilot_chat.location',
86
+ INTENT: 'copilot_chat.intent',
87
+ TURN_INDEX: 'copilot_chat.turn.index',
88
+ TURN_COUNT: 'copilot_chat.turn_count',
89
+ TOOL_CALL_ROUND: 'copilot_chat.tool_call_round',
90
+ API_TYPE: 'copilot_chat.api_type',
91
+ FETCHER: 'copilot_chat.fetcher',
92
+ DEBUG_NAME: 'copilot_chat.debug_name',
93
+ ENDPOINT_TYPE: 'copilot_chat.endpoint_type',
94
+ MAX_PROMPT_TOKENS: 'copilot_chat.request.max_prompt_tokens',
95
+ TIME_TO_FIRST_TOKEN: 'copilot_chat.time_to_first_token',
96
+ };
97
+ /**
98
+ * Standard OTel attributes used alongside GenAI attributes.
99
+ */
100
+ exports.StdAttr = {
101
+ ERROR_TYPE: 'error.type',
102
+ SERVER_ADDRESS: 'server.address',
103
+ SERVER_PORT: 'server.port',
104
+ };
105
+ //# sourceMappingURL=genAiAttributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genAiAttributes.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/genAiAttributes.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,+BAA+B;AAClB,QAAA,kBAAkB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;CACf,CAAC;AAEX,8BAA8B;AACjB,QAAA,iBAAiB,GAAG;IAChC,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,eAAe,EAAE,iBAAiB;CACzB,CAAC;AAEX,2BAA2B;AACd,QAAA,cAAc,GAAG;IAC7B,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACP,CAAC;AAEX,0BAA0B;AACb,QAAA,aAAa,GAAG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AE,uBAAuB;IACjC,MAAM,EAAE,qBAAqB;IAC7B,UAAU,EAAE,yBAAyB;IACrC,UAAU,EAAE,yBAAyB;IACrC,eAAe,EAAE,8BAA8B;IAC/C,QAAQ,EAAE,uBAAuB;IACjC,OAAO,EAAE,sBAAsB;IAC/B,UAAU,EAAE,yBAAyB;IACrC,aAAa,EAAE,4BAA4B;IAC3C,iBAAiB,EAAE,wCAAwC;IAC3D,mBAAmB,EAAE,kCAAkC;CAC9C,CAAC;AAEX;;GAEG;AACU,QAAA,OAAO,GAAG;IACtB,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;CACjB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { IOTelService } from './otelService';
2
+ /**
3
+ * Emit OTel GenAI standard events via the IOTelService abstraction.
4
+ */
5
+ export declare function emitInferenceDetailsEvent(otel: IOTelService, request: {
6
+ model: string;
7
+ temperature?: number;
8
+ maxTokens?: number;
9
+ messages?: unknown;
10
+ systemMessage?: unknown;
11
+ tools?: unknown;
12
+ }, response: {
13
+ id?: string;
14
+ model?: string;
15
+ finishReasons?: string[];
16
+ inputTokens?: number;
17
+ outputTokens?: number;
18
+ } | undefined, error?: {
19
+ type: string;
20
+ message: string;
21
+ }): void;
22
+ /**
23
+ * Emit extension-specific events.
24
+ */
25
+ export declare function emitSessionStartEvent(otel: IOTelService, sessionId: string, model: string, participant: string): void;
26
+ export declare function emitToolCallEvent(otel: IOTelService, toolName: string, durationMs: number, success: boolean, error?: string): void;
27
+ export declare function emitAgentTurnEvent(otel: IOTelService, turnIndex: number, inputTokens: number, outputTokens: number, toolCallCount: number): void;
28
+ //# sourceMappingURL=genAiEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"genAiEvents.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/otel/common/genAiEvents.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;GAEG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE;IACR,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB,EACD,QAAQ,EAAE;IACT,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,EACb,KAAK,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACvC,IAAI,CAoCN;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GACjB,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,MAAM,GACZ,IAAI,CAQN;AAED,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACnB,IAAI,CAQN"}
@@ -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,aAAa,EAAE,CAAC;YAAC,UAAU,CAAC,2BAAS,CAAC,uBAAuB,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC;QAAC,CAAC;QACvG,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAAC,UAAU,CAAC,2BAAS,CAAC,kBAAkB,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC;QAAC,CAAC;QAC5G,IAAI,QAAQ,CAAC,YAAY,KAAK,SAAS,EAAE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,EAAE,EAAE,UAAU,CAAC,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB,CACpC,IAAkB,EAClB,SAAiB,EACjB,KAAa,EACb,WAAmB;IAEnB,IAAI,CAAC,aAAa,CAAC,4BAA4B,EAAE;QAChD,YAAY,EAAE,4BAA4B;QAC1C,YAAY,EAAE,SAAS;QACvB,CAAC,2BAAS,CAAC,aAAa,CAAC,EAAE,KAAK;QAChC,CAAC,2BAAS,CAAC,UAAU,CAAC,EAAE,WAAW;KACnC,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAChC,IAAkB,EAClB,QAAgB,EAChB,UAAkB,EAClB,OAAgB,EAChB,KAAc;IAEd,IAAI,CAAC,aAAa,CAAC,2BAA2B,QAAQ,EAAE,EAAE;QACzD,YAAY,EAAE,wBAAwB;QACtC,CAAC,2BAAS,CAAC,SAAS,CAAC,EAAE,QAAQ;QAC/B,aAAa,EAAE,UAAU;QACzB,SAAS,EAAE,OAAO;QAClB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,yBAAO,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjD,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CACjC,IAAkB,EAClB,SAAiB,EACjB,WAAmB,EACnB,YAAoB,EACpB,aAAqB;IAErB,IAAI,CAAC,aAAa,CAAC,4BAA4B,SAAS,EAAE,EAAE;QAC3D,YAAY,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,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;KACnB,GACC,IAAI;IAYP,MAAM,CAAC,gBAAgB,CACtB,IAAI,EAAE,YAAY,EAClB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,OAAO,GAAG,QAAQ,EAC7B,KAAK,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;KACvB,GACC,IAAI;IAaP,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAOxF,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAM7F,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAM5F,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAM3F,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAMvF,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;CAGtD"}
@@ -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