@sentry/junior 0.60.0 → 0.60.1

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 (2) hide show
  1. package/dist/reporting.js +21 -1
  2. package/package.json +3 -3
package/dist/reporting.js CHANGED
@@ -291,6 +291,25 @@ function redactTranscriptMessage(message) {
291
291
  parts: message.parts.map(redactTranscriptPart)
292
292
  };
293
293
  }
294
+ function isConversationMessageRole(role) {
295
+ const normalized = role.toLowerCase();
296
+ return normalized === "user" || normalized === "assistant";
297
+ }
298
+ function hasTextPart(message) {
299
+ return message.parts.some((part) => {
300
+ if (part.type !== "text") return false;
301
+ if (part.redacted) return true;
302
+ return typeof part.text === "string" && part.text.trim().length > 0;
303
+ });
304
+ }
305
+ function isConversationMessage(message) {
306
+ if (!isConversationMessageRole(message.role)) return false;
307
+ if (message.role.toLowerCase() === "assistant") return hasTextPart(message);
308
+ return message.parts.length > 0;
309
+ }
310
+ function countConversationMessages(transcript) {
311
+ return transcript.filter(isConversationMessage).length;
312
+ }
294
313
  function turnScopedMessages(messages) {
295
314
  for (let index = messages.length - 1; index >= 0; index -= 1) {
296
315
  const record = messages[index];
@@ -337,6 +356,7 @@ async function readConversation(conversationId) {
337
356
  const normalizedTranscript = scopedMessages.map(
338
357
  normalizeTranscriptMessage
339
358
  );
359
+ const transcriptMessageCount = countConversationMessages(normalizedTranscript);
340
360
  const transcript = canExposeTranscript ? normalizedTranscript : [];
341
361
  const transcriptMetadata = canExposeTranscript ? void 0 : normalizedTranscript.map(redactTranscriptMessage);
342
362
  const traceId = summary.traceId ?? sessionRecord?.traceId ?? (canExposeTranscript ? traceIdFromTranscript(transcript) : void 0);
@@ -346,7 +366,7 @@ async function readConversation(conversationId) {
346
366
  ...traceId ? { traceId } : {},
347
367
  ...sentryTraceUrl ? { sentryTraceUrl } : {},
348
368
  transcriptAvailable: Boolean(sessionRecord) && canExposeTranscript,
349
- ...sessionRecord && scopedMessages.length > 0 ? { transcriptMessageCount: scopedMessages.length } : {},
369
+ ...sessionRecord && transcriptMessageCount > 0 ? { transcriptMessageCount } : {},
350
370
  ...!canExposeTranscript ? {
351
371
  transcriptMetadata,
352
372
  transcriptRedacted: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.60.0",
3
+ "version": "0.60.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -64,7 +64,7 @@
64
64
  "node-html-markdown": "^2.0.0",
65
65
  "yaml": "^2.9.0",
66
66
  "zod": "^4.4.3",
67
- "@sentry/junior-plugin-api": "0.60.0"
67
+ "@sentry/junior-plugin-api": "0.60.1"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/node": "^25.9.1",
@@ -76,7 +76,7 @@
76
76
  "typescript": "^6.0.3",
77
77
  "vercel": "^54.4.0",
78
78
  "vitest": "^4.1.7",
79
- "@sentry/junior-scheduler": "0.60.0"
79
+ "@sentry/junior-scheduler": "0.60.1"
80
80
  },
81
81
  "scripts": {
82
82
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",