@sentry/junior 0.50.0 → 0.51.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.
package/dist/app.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  findSkillByName,
4
4
  loadSkillsByName,
5
5
  parseSkillInvocation
6
- } from "./chunk-AYM42AN3.js";
6
+ } from "./chunk-ZNFNY53B.js";
7
7
  import {
8
8
  GEN_AI_PROVIDER_NAME,
9
9
  MISSING_GATEWAY_CREDENTIALS_ERROR,
@@ -31,7 +31,7 @@ import {
31
31
  runNonInteractiveCommand,
32
32
  sandboxSkillDir,
33
33
  sandboxSkillFile
34
- } from "./chunk-AQ4RO2WA.js";
34
+ } from "./chunk-KCOKQLBF.js";
35
35
  import {
36
36
  CredentialUnavailableError,
37
37
  buildOAuthTokenRequest,
@@ -42,6 +42,7 @@ import {
42
42
  extractGenAiUsageAttributes,
43
43
  extractGenAiUsageSummary,
44
44
  getActiveTraceId,
45
+ getLogContextAttributes,
45
46
  getPluginCapabilityProviders,
46
47
  getPluginCatalogSignature,
47
48
  getPluginDefinition,
@@ -69,7 +70,7 @@ import {
69
70
  toOptionalString,
70
71
  withContext,
71
72
  withSpan
72
- } from "./chunk-UKR24HLJ.js";
73
+ } from "./chunk-Q3FDONU7.js";
73
74
  import {
74
75
  sentry_exports
75
76
  } from "./chunk-Z3YD6NHK.js";
@@ -6215,13 +6216,22 @@ function createSlackChannelListMessagesTool(context) {
6215
6216
  }
6216
6217
  throw error;
6217
6218
  }
6218
- return {
6219
+ const summary = {
6219
6220
  ok: true,
6220
6221
  channel_id: targetChannelId,
6221
6222
  count: result.messages.length,
6222
6223
  next_cursor: result.nextCursor,
6223
6224
  messages: result.messages
6224
6225
  };
6226
+ return {
6227
+ content: [{ type: "text", text: JSON.stringify(summary) }],
6228
+ details: {
6229
+ ok: true,
6230
+ channel_id: targetChannelId,
6231
+ count: result.messages.length,
6232
+ ...result.nextCursor ? { next_cursor: result.nextCursor } : {}
6233
+ }
6234
+ };
6225
6235
  }
6226
6236
  });
6227
6237
  }
@@ -9044,6 +9054,87 @@ function resolveChannelCapabilities(channelId) {
9044
9054
  };
9045
9055
  }
9046
9056
 
9057
+ // src/chat/pi/traced-stream.ts
9058
+ import {
9059
+ streamSimple
9060
+ } from "@mariozechner/pi-ai";
9061
+ function buildChatStartAttributes(model, context) {
9062
+ const attributes = {
9063
+ "gen_ai.operation.name": "chat",
9064
+ "gen_ai.provider.name": GEN_AI_PROVIDER_NAME,
9065
+ "gen_ai.request.model": model.id
9066
+ };
9067
+ const inputMessages = serializeGenAiAttribute(context.messages);
9068
+ if (inputMessages) {
9069
+ attributes["gen_ai.input.messages"] = inputMessages;
9070
+ }
9071
+ if (context.systemPrompt) {
9072
+ const systemInstructions = serializeGenAiAttribute([
9073
+ { type: "text", content: context.systemPrompt }
9074
+ ]);
9075
+ if (systemInstructions) {
9076
+ attributes["gen_ai.system_instructions"] = systemInstructions;
9077
+ }
9078
+ }
9079
+ return attributes;
9080
+ }
9081
+ function buildChatEndAttributes(message) {
9082
+ const attributes = {};
9083
+ const outputMessages = serializeGenAiAttribute([message]);
9084
+ if (outputMessages) {
9085
+ attributes["gen_ai.output.messages"] = outputMessages;
9086
+ }
9087
+ Object.assign(attributes, extractGenAiUsageAttributes(message));
9088
+ if (message.stopReason) {
9089
+ attributes["gen_ai.response.finish_reasons"] = [message.stopReason];
9090
+ }
9091
+ if (message.model) {
9092
+ attributes["gen_ai.response.model"] = message.model;
9093
+ }
9094
+ return attributes;
9095
+ }
9096
+ function createTracedStreamFn(base = streamSimple) {
9097
+ return async (model, context, options) => {
9098
+ const span = sentry_exports.startInactiveSpan({
9099
+ name: `chat ${model.id}`,
9100
+ op: "gen_ai.chat",
9101
+ attributes: {
9102
+ ...getLogContextAttributes(),
9103
+ ...buildChatStartAttributes(model, context)
9104
+ }
9105
+ });
9106
+ try {
9107
+ const stream = await sentry_exports.withActiveSpan(
9108
+ span,
9109
+ () => Promise.resolve(base(model, context, options))
9110
+ );
9111
+ stream.result().then(
9112
+ (finalMessage) => {
9113
+ try {
9114
+ for (const [key, value] of Object.entries(
9115
+ buildChatEndAttributes(finalMessage)
9116
+ )) {
9117
+ span.setAttribute(key, value);
9118
+ }
9119
+ } finally {
9120
+ span.end();
9121
+ }
9122
+ },
9123
+ () => {
9124
+ span.setStatus({ code: 2, message: "LLM stream failed" });
9125
+ span.end();
9126
+ }
9127
+ ).catch(() => {
9128
+ });
9129
+ return stream;
9130
+ } catch (error) {
9131
+ span.setStatus({ code: 2, message: "LLM call failed" });
9132
+ span.end();
9133
+ throw error;
9134
+ }
9135
+ };
9136
+ }
9137
+
9047
9138
  // src/chat/sandbox/sandbox.ts
9048
9139
  import fs4 from "fs/promises";
9049
9140
 
@@ -13081,7 +13172,8 @@ async function generateAssistantReply(messageText, context = {}) {
13081
13172
  config: botConfig.advisor,
13082
13173
  conversationId: sessionConversationId,
13083
13174
  logContext: spanContext,
13084
- getTools: () => advisorTools
13175
+ getTools: () => advisorTools,
13176
+ streamFn: createTracedStreamFn()
13085
13177
  }
13086
13178
  }
13087
13179
  );
@@ -13174,6 +13266,7 @@ async function generateAssistantReply(messageText, context = {}) {
13174
13266
  );
13175
13267
  agent = new Agent2({
13176
13268
  getApiKey: () => getPiGatewayApiKeyOverride(),
13269
+ streamFn: createTracedStreamFn(),
13177
13270
  initialState: {
13178
13271
  systemPrompt: baseInstructions,
13179
13272
  model: resolveGatewayModel(botConfig.modelId),
@@ -7,7 +7,7 @@ import {
7
7
  serializeGenAiAttribute,
8
8
  setSpanAttributes,
9
9
  withSpan
10
- } from "./chunk-UKR24HLJ.js";
10
+ } from "./chunk-Q3FDONU7.js";
11
11
 
12
12
  // src/chat/state/adapter.ts
13
13
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -3183,6 +3183,7 @@ export {
3183
3183
  toOptionalNumber,
3184
3184
  isRecord,
3185
3185
  createChatSdkLogger,
3186
+ getLogContextAttributes,
3186
3187
  logInfo,
3187
3188
  logWarn,
3188
3189
  logError,
@@ -2,7 +2,7 @@ import {
2
2
  getPluginForSkillPath,
3
3
  getPluginSkillRoots,
4
4
  logWarn
5
- } from "./chunk-UKR24HLJ.js";
5
+ } from "./chunk-Q3FDONU7.js";
6
6
  import {
7
7
  skillRoots
8
8
  } from "./chunk-XPXD3FCE.js";
package/dist/cli/check.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseSkillFile
3
- } from "../chunk-AYM42AN3.js";
3
+ } from "../chunk-ZNFNY53B.js";
4
4
  import {
5
5
  parsePluginManifest
6
- } from "../chunk-UKR24HLJ.js";
6
+ } from "../chunk-Q3FDONU7.js";
7
7
  import "../chunk-Z3YD6NHK.js";
8
8
  import "../chunk-XPXD3FCE.js";
9
9
  import "../chunk-2KG3PWR4.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  disconnectStateAdapter,
3
3
  resolveRuntimeDependencySnapshot
4
- } from "../chunk-AQ4RO2WA.js";
4
+ } from "../chunk-KCOKQLBF.js";
5
5
  import {
6
6
  getPluginProviders,
7
7
  getPluginRuntimeDependencies,
8
8
  getPluginRuntimePostinstall
9
- } from "../chunk-UKR24HLJ.js";
9
+ } from "../chunk-Q3FDONU7.js";
10
10
  import "../chunk-Z3YD6NHK.js";
11
11
  import "../chunk-XPXD3FCE.js";
12
12
  import "../chunk-2KG3PWR4.js";
@@ -27,6 +27,7 @@ function initSentry() {
27
27
  sendDefaultPii: true,
28
28
  enabled: Boolean(dsn),
29
29
  enableLogs,
30
+ streamGenAiSpans: true,
30
31
  integrations: [
31
32
  sentry_exports.vercelAIIntegration({
32
33
  recordInputs: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -46,7 +46,7 @@
46
46
  "@sentry/node": ">=10.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@sentry/node": "10.50.0-alpha.0",
49
+ "@sentry/node": "10.53.1",
50
50
  "@types/node": "^25.6.0",
51
51
  "dependency-cruiser": "^17.4.0",
52
52
  "msw": "^2.14.3",