@sentry/junior 0.84.1 → 0.86.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 (51) hide show
  1. package/dist/{agent-hooks-TFPY6V3T.js → agent-hooks-NWOUB3UR.js} +7 -7
  2. package/dist/app.js +916 -363
  3. package/dist/chat/conversation-privacy.d.ts +12 -2
  4. package/dist/chat/conversations/sql/migrations.d.ts +1 -1
  5. package/dist/chat/conversations/sql/store.d.ts +9 -1
  6. package/dist/chat/conversations/store.d.ts +13 -0
  7. package/dist/chat/current-instruction.d.ts +6 -0
  8. package/dist/chat/ingress/message-changed.d.ts +2 -0
  9. package/dist/chat/respond-helpers.d.ts +1 -2
  10. package/dist/chat/respond.d.ts +7 -1
  11. package/dist/chat/runtime/reply-executor.d.ts +2 -10
  12. package/dist/chat/runtime/slack-runtime.d.ts +5 -4
  13. package/dist/chat/runtime/turn.d.ts +7 -0
  14. package/dist/chat/services/persist-retry.d.ts +2 -0
  15. package/dist/chat/services/turn-session-record.d.ts +31 -2
  16. package/dist/chat/slack/client.d.ts +33 -2
  17. package/dist/chat/slack/conversation-context.d.ts +15 -0
  18. package/dist/chat/state/turn-session.d.ts +9 -0
  19. package/dist/chat/task-execution/queue.d.ts +1 -1
  20. package/dist/chat/task-execution/slack-work.d.ts +10 -2
  21. package/dist/chat/task-execution/state.d.ts +44 -4
  22. package/dist/chat/task-execution/store.d.ts +21 -4
  23. package/dist/chat/task-execution/worker.d.ts +11 -4
  24. package/dist/chat/tools/slack/channel-access.d.ts +29 -0
  25. package/dist/chat/tools/slack/thread-read.d.ts +4 -1
  26. package/dist/{chunk-AL6ZFV7U.js → chunk-2NFV5FMB.js} +4 -4
  27. package/dist/{chunk-JK7376UT.js → chunk-37B2R2QJ.js} +17 -17
  28. package/dist/{chunk-QWKB6NJV.js → chunk-6I6HBOQM.js} +80 -15
  29. package/dist/{chunk-SBYMRDH7.js → chunk-6O5UI3RG.js} +1 -1
  30. package/dist/{chunk-CWMMGUWM.js → chunk-BRSQQRG6.js} +1 -1
  31. package/dist/{chunk-FPN7NYTE.js → chunk-ENPSU7L7.js} +165 -27
  32. package/dist/{chunk-T2YRJZ5A.js → chunk-FPHA6GCQ.js} +905 -711
  33. package/dist/{chunk-MJ4E2PK7.js → chunk-GB5DFM4D.js} +1 -1
  34. package/dist/{chunk-BAPRSWNW.js → chunk-GGD6WK6V.js} +124 -25
  35. package/dist/{chunk-SVFA43LT.js → chunk-JRXCSSSU.js} +19 -4
  36. package/dist/{chunk-DR75T7J3.js → chunk-L7OHKDOX.js} +9 -5
  37. package/dist/{chunk-LSG6PQF4.js → chunk-RIB3M6YA.js} +2 -2
  38. package/dist/{chunk-ALL7GG6U.js → chunk-ZU2ALUVQ.js} +45 -6
  39. package/dist/cli/chat.js +4 -4
  40. package/dist/cli/plugins.js +7 -7
  41. package/dist/cli/snapshot-warmup.js +4 -4
  42. package/dist/cli/upgrade.js +10 -7
  43. package/dist/{db-ELRCNB4A.js → db-SZVUU7RB.js} +4 -4
  44. package/dist/handlers/github-webhook/issue-comment.d.ts +3 -0
  45. package/dist/handlers/github-webhook/pull-request-review-comment.d.ts +3 -0
  46. package/dist/instrumentation.js +1 -1
  47. package/dist/nitro.js +4 -4
  48. package/dist/reporting/conversations.d.ts +2 -1
  49. package/dist/reporting.js +110 -34
  50. package/dist/{runner-2XU6QQND.js → runner-HEBRPNN2.js} +27 -13
  51. package/package.json +5 -5
package/dist/reporting.js CHANGED
@@ -6,31 +6,33 @@ import {
6
6
  getConversationDetails,
7
7
  getConversationDetailsForIds,
8
8
  resolveSlackConversationContextFromThreadId
9
- } from "./chunk-SVFA43LT.js";
9
+ } from "./chunk-JRXCSSSU.js";
10
10
  import {
11
11
  buildSystemPrompt,
12
12
  getAgentTurnSessionRecord,
13
13
  listAgentTurnSessionSummariesForConversation,
14
14
  loadActivityEntries
15
- } from "./chunk-JK7376UT.js";
15
+ } from "./chunk-37B2R2QJ.js";
16
16
  import {
17
17
  getPluginOperationalReports
18
- } from "./chunk-AL6ZFV7U.js";
19
- import "./chunk-CWMMGUWM.js";
18
+ } from "./chunk-2NFV5FMB.js";
19
+ import "./chunk-BRSQQRG6.js";
20
20
  import {
21
21
  getConversationStore
22
- } from "./chunk-QWKB6NJV.js";
22
+ } from "./chunk-6I6HBOQM.js";
23
23
  import "./chunk-G3E7SCME.js";
24
24
  import {
25
25
  getStateAdapter
26
- } from "./chunk-MJ4E2PK7.js";
27
- import "./chunk-BAPRSWNW.js";
28
- import "./chunk-ALL7GG6U.js";
26
+ } from "./chunk-GB5DFM4D.js";
27
+ import "./chunk-GGD6WK6V.js";
28
+ import {
29
+ unwrapCurrentInstruction
30
+ } from "./chunk-ZU2ALUVQ.js";
29
31
  import {
30
32
  canExposeConversationPayload,
31
33
  parseSlackThreadId,
32
34
  resolveConversationPrivacy
33
- } from "./chunk-DR75T7J3.js";
35
+ } from "./chunk-L7OHKDOX.js";
34
36
  import {
35
37
  discoverSkills
36
38
  } from "./chunk-64ACM6AP.js";
@@ -65,6 +67,12 @@ var REQUESTER_PROFILE_SAMPLE_LIMIT = 5e3;
65
67
  var REQUESTER_PROFILE_RECENT_LIMIT = 25;
66
68
  var REQUESTER_PROFILE_ACTIVITY_DAYS = 366;
67
69
  var RECENT_CONVERSATION_STATS_WINDOW_MS = 7 * 24 * 60 * 60 * 1e3;
70
+ function privateConversationLabel(slackConversation) {
71
+ if (!slackConversation) {
72
+ return PRIVATE_CONVERSATION_LABEL;
73
+ }
74
+ return slackConversation.visibility === "private" ? formatSlackConversationRedactedLabel(slackConversation) ?? PRIVATE_CONVERSATION_LABEL : PRIVATE_CONVERSATION_LABEL;
75
+ }
68
76
  function conversationStore(options = {}) {
69
77
  return options.conversationStore ?? getConversationStore();
70
78
  }
@@ -120,17 +128,18 @@ function usageReport(usage) {
120
128
  };
121
129
  return Object.keys(report).length > 0 ? report : void 0;
122
130
  }
123
- function sessionReportFromSummary(summary, nowMs = Date.now(), details) {
131
+ function sessionReportFromSummary(summary, nowMs = Date.now(), details, visibility) {
124
132
  const slackThread = parseSlackThreadId(summary.conversationId);
125
133
  const privacy = resolveConversationPrivacy({
126
- conversationId: summary.conversationId
134
+ conversationId: summary.conversationId,
135
+ visibility
127
136
  });
128
137
  const effectiveChannelName = details?.channelName ?? summary.channelName;
129
138
  const slackConversation = resolveSlackConversationContextFromThreadId({
130
139
  threadId: summary.conversationId,
131
140
  channelName: effectiveChannelName
132
141
  });
133
- const privateLabel = privacy !== "public" ? slackConversation ? formatSlackConversationRedactedLabel(slackConversation) : PRIVATE_CONVERSATION_LABEL : void 0;
142
+ const privateLabel = privacy !== "public" ? privateConversationLabel(slackConversation) : void 0;
134
143
  const channelName = privateLabel ?? effectiveChannelName;
135
144
  const effectiveSurface = details?.originSurface ?? surfaceFromSummary(summary);
136
145
  const displayTitle = privateLabel ?? details?.displayTitle ?? slackStatsLocationLabel({
@@ -155,6 +164,7 @@ function sessionReportFromSummary(summary, nowMs = Date.now(), details) {
155
164
  ...requesterIdentity ? { requesterIdentity } : {},
156
165
  ...slackThread ? { channel: slackThread.channelId } : {},
157
166
  ...channelName ? { channelName } : {},
167
+ ...privateLabel ? { channelNameRedacted: true } : {},
158
168
  ...summary.traceId ? { traceId: summary.traceId } : {},
159
169
  ...sentryTraceUrl ? { sentryTraceUrl } : {}
160
170
  };
@@ -183,8 +193,9 @@ function titleFromConversation(args) {
183
193
  channelName: effectiveChannelName
184
194
  });
185
195
  const privateLabel = resolveConversationPrivacy({
186
- conversationId: args.conversation.conversationId
187
- }) !== "public" ? slackConversation ? formatSlackConversationRedactedLabel(slackConversation) : PRIVATE_CONVERSATION_LABEL : void 0;
196
+ conversationId: args.conversation.conversationId,
197
+ visibility: args.conversation.visibility
198
+ }) !== "public" ? privateConversationLabel(slackConversation) : void 0;
188
199
  return privateLabel ?? args.details?.displayTitle ?? args.conversation.title ?? slackStatsLocationLabel({
189
200
  channel: slackThread?.channelId,
190
201
  channelName: effectiveChannelName
@@ -201,12 +212,24 @@ function channelNameFromConversation(conversation, details) {
201
212
  channelName: effectiveChannelName
202
213
  });
203
214
  if (resolveConversationPrivacy({
204
- conversationId: conversation.conversationId
215
+ conversationId: conversation.conversationId,
216
+ visibility: conversation.visibility
205
217
  }) !== "public") {
206
- return formatSlackConversationRedactedLabel(slackConversation) ?? (slackConversation ? void 0 : PRIVATE_CONVERSATION_LABEL);
218
+ return privateConversationLabel(slackConversation);
207
219
  }
208
220
  return effectiveChannelName;
209
221
  }
222
+ function channelNameRedactedFromConversation(conversation, details) {
223
+ const effectiveChannelName = details?.channelName ?? conversation.channelName;
224
+ const slackThread = parseSlackThreadId(conversation.conversationId);
225
+ if (!effectiveChannelName && !slackThread) {
226
+ return false;
227
+ }
228
+ return resolveConversationPrivacy({
229
+ conversationId: conversation.conversationId,
230
+ visibility: conversation.visibility
231
+ }) !== "public";
232
+ }
210
233
  function applyConversationIndexMetadata(args) {
211
234
  const surface = args.details?.originSurface ?? (args.conversation.source ? surfaceFromSource(
212
235
  args.conversation.source,
@@ -214,6 +237,10 @@ function applyConversationIndexMetadata(args) {
214
237
  ) : args.report.surface);
215
238
  const slackThread = parseSlackThreadId(args.conversation.conversationId);
216
239
  const effectiveChannelName = channelNameFromConversation(args.conversation, args.details) ?? args.report.channelName;
240
+ const channelNameRedacted = channelNameRedactedFromConversation(
241
+ args.conversation,
242
+ args.details
243
+ );
217
244
  const requesterIdentity = requesterIdentityReport(args.details?.originRequester) ?? args.report.requesterIdentity ?? requesterIdentityReport(args.conversation.requester);
218
245
  const status = statusFromConversation(
219
246
  args.conversation,
@@ -224,8 +251,9 @@ function applyConversationIndexMetadata(args) {
224
251
  reportTime(args.report.lastSeenAt) ?? 0,
225
252
  args.conversation.lastActivityAtMs
226
253
  );
254
+ const { channelNameRedacted: _oldChannelNameRedacted, ...report } = args.report;
227
255
  return {
228
- ...args.report,
256
+ ...report,
229
257
  displayTitle: titleFromConversation({
230
258
  conversation: args.conversation,
231
259
  details: args.details,
@@ -236,7 +264,8 @@ function applyConversationIndexMetadata(args) {
236
264
  surface,
237
265
  ...requesterIdentity ? { requesterIdentity } : {},
238
266
  ...slackThread ? { channel: slackThread.channelId } : {},
239
- ...effectiveChannelName ? { channelName: effectiveChannelName } : {}
267
+ ...effectiveChannelName ? { channelName: effectiveChannelName } : {},
268
+ ...channelNameRedacted ? { channelNameRedacted: true } : {}
240
269
  };
241
270
  }
242
271
  function sessionReportFromConversation(conversation, nowMs, details) {
@@ -246,6 +275,10 @@ function sessionReportFromConversation(conversation, nowMs, details) {
246
275
  );
247
276
  const slackThread = parseSlackThreadId(conversation.conversationId);
248
277
  const channelName = channelNameFromConversation(conversation, details);
278
+ const channelNameRedacted = channelNameRedactedFromConversation(
279
+ conversation,
280
+ details
281
+ );
249
282
  return {
250
283
  conversationId: conversation.conversationId,
251
284
  cumulativeDurationMs: 0,
@@ -260,7 +293,8 @@ function sessionReportFromConversation(conversation, nowMs, details) {
260
293
  surface,
261
294
  ...requesterIdentity ? { requesterIdentity } : {},
262
295
  ...slackThread ? { channel: slackThread.channelId } : {},
263
- ...channelName ? { channelName } : {}
296
+ ...channelName ? { channelName } : {},
297
+ ...channelNameRedacted ? { channelNameRedacted: true } : {}
264
298
  };
265
299
  }
266
300
  function reportTime(value) {
@@ -332,6 +366,9 @@ function requesterLabel(requester) {
332
366
  function slackStatsLocationLabel(input) {
333
367
  const channelId = input.channel;
334
368
  if (!channelId) return void 0;
369
+ if (input.channelNameRedacted && input.channelName) {
370
+ return input.channelName;
371
+ }
335
372
  const name = input.channelName?.replace(/^#/, "");
336
373
  if (channelId.startsWith("D")) {
337
374
  return "Direct Message";
@@ -351,14 +388,14 @@ function surfaceFallbackLabel(surface) {
351
388
  if (surface === "internal") return "Internal";
352
389
  return "Conversation";
353
390
  }
354
- function displayTitleFromDetails(conversationId, details) {
391
+ function displayTitleFromDetails(conversationId, details, visibility) {
355
392
  if (!details) return void 0;
356
393
  const slackThread = parseSlackThreadId(conversationId);
357
394
  const slackConversation = resolveSlackConversationContextFromThreadId({
358
395
  threadId: conversationId,
359
396
  channelName: details.channelName
360
397
  });
361
- const privateLabel = resolveConversationPrivacy({ conversationId }) !== "public" ? formatSlackConversationRedactedLabel(slackConversation) ?? PRIVATE_CONVERSATION_LABEL : void 0;
398
+ const privateLabel = resolveConversationPrivacy({ conversationId, visibility }) !== "public" ? privateConversationLabel(slackConversation) : void 0;
362
399
  return privateLabel ?? details.displayTitle ?? slackStatsLocationLabel({
363
400
  channel: slackThread?.channelId,
364
401
  channelName: details.channelName
@@ -767,9 +804,10 @@ async function readRequesterProfileReport(email, options = {}) {
767
804
  windowStart: start.toISOString()
768
805
  };
769
806
  }
770
- function canExposeConversationTranscript(summary) {
807
+ function canExposeConversationTranscript(summary, visibility) {
771
808
  return canExposeConversationPayload({
772
- conversationId: summary.conversationId
809
+ conversationId: summary.conversationId,
810
+ visibility
773
811
  });
774
812
  }
775
813
  function textPart(text) {
@@ -783,9 +821,10 @@ function recordField(value, names) {
783
821
  }
784
822
  return void 0;
785
823
  }
786
- function normalizeTranscriptPart(part) {
824
+ function normalizeTranscriptPart(part, options = {}) {
825
+ const displayText = (text) => options.unwrapCurrentTask ? unwrapCurrentInstruction(text) ?? text : text;
787
826
  if (typeof part === "string") {
788
- return textPart(part);
827
+ return textPart(displayText(part));
789
828
  }
790
829
  if (!isRecord(part)) {
791
830
  return { type: "unknown", output: part };
@@ -794,7 +833,7 @@ function normalizeTranscriptPart(part) {
794
833
  if (rawType === "text") {
795
834
  const text = recordField(part, ["text", "content"]);
796
835
  return textPart(
797
- typeof text === "string" ? text : JSON.stringify(text) ?? ""
836
+ typeof text === "string" ? displayText(text) : JSON.stringify(text) ?? ""
798
837
  );
799
838
  }
800
839
  if (rawType === "toolCall") {
@@ -851,7 +890,15 @@ function normalizeTranscriptMessage(message) {
851
890
  return {
852
891
  role,
853
892
  ...typeof record.timestamp === "number" ? { timestamp: record.timestamp } : {},
854
- parts: role === "toolResult" ? [normalizeToolResultMessage(record)] : Array.isArray(content) ? content.map(normalizeTranscriptPart) : [normalizeTranscriptPart(content)]
893
+ parts: role === "toolResult" ? [normalizeToolResultMessage(record)] : Array.isArray(content) ? content.map(
894
+ (part) => normalizeTranscriptPart(part, {
895
+ unwrapCurrentTask: role === "user"
896
+ })
897
+ ) : [
898
+ normalizeTranscriptPart(content, {
899
+ unwrapCurrentTask: role === "user"
900
+ })
901
+ ]
855
902
  };
856
903
  }
857
904
  function transcriptRole(role) {
@@ -1161,7 +1208,12 @@ async function reportsFromConversations(args) {
1161
1208
  conversation,
1162
1209
  details,
1163
1210
  nowMs: args.nowMs,
1164
- report: sessionReportFromSummary(summary, args.nowMs, details)
1211
+ report: sessionReportFromSummary(
1212
+ summary,
1213
+ args.nowMs,
1214
+ details,
1215
+ conversation.visibility
1216
+ )
1165
1217
  })
1166
1218
  ) : [sessionReportFromConversation(conversation, args.nowMs, details)];
1167
1219
  reports.set(conversation.conversationId, conversationReports);
@@ -1241,6 +1293,10 @@ async function listRecentConversationSummaries(options = {}) {
1241
1293
  conversation.conversationId
1242
1294
  );
1243
1295
  const channelName = channelNameFromConversation(conversation, details);
1296
+ const channelNameRedacted = channelNameRedactedFromConversation(
1297
+ conversation,
1298
+ details
1299
+ );
1244
1300
  const report = newestRun(
1245
1301
  reportsByConversation.get(conversation.conversationId) ?? [
1246
1302
  sessionReportFromConversation(conversation, nowMs, details)
@@ -1255,6 +1311,7 @@ async function listRecentConversationSummaries(options = {}) {
1255
1311
  ).toISOString(),
1256
1312
  status: report.status,
1257
1313
  ...channelName ? { channelName } : {},
1314
+ ...channelNameRedacted ? { channelNameRedacted: true } : {},
1258
1315
  ...conversation.source ? { source: conversation.source } : {}
1259
1316
  };
1260
1317
  });
@@ -1283,7 +1340,10 @@ async function readConversationReport(conversationId, options = {}) {
1283
1340
  sessionRecord.piMessages,
1284
1341
  sessionRecord.turnStartMessageIndex
1285
1342
  ) : { messages: [], startsAtRunBoundary: false };
1286
- const canExposeTranscript = canExposeConversationTranscript(summary);
1343
+ const canExposeTranscript = canExposeConversationTranscript(
1344
+ summary,
1345
+ conversation?.visibility
1346
+ );
1287
1347
  const normalizedTranscript = scopedMessages.messages.map(
1288
1348
  normalizeTranscriptMessage
1289
1349
  );
@@ -1301,7 +1361,12 @@ async function readConversationReport(conversationId, options = {}) {
1301
1361
  const traceId = summary.traceId ?? sessionRecord?.traceId ?? (canExposeTranscript ? traceIdFromTranscript(transcript) : void 0);
1302
1362
  const sentryTraceUrl = traceId ? buildSentryTraceUrl(traceId) : void 0;
1303
1363
  const report = {
1304
- ...sessionReportFromSummary(summary, nowMs, details),
1364
+ ...sessionReportFromSummary(
1365
+ summary,
1366
+ nowMs,
1367
+ details,
1368
+ conversation?.visibility
1369
+ ),
1305
1370
  ...traceId ? { traceId } : {},
1306
1371
  ...sentryTraceUrl ? { sentryTraceUrl } : {},
1307
1372
  activity,
@@ -1334,7 +1399,11 @@ async function readConversationReport(conversationId, options = {}) {
1334
1399
  }
1335
1400
  ];
1336
1401
  const firstRun = effectiveRuns[0];
1337
- const displayTitle = firstRun?.displayTitle ?? displayTitleFromDetails(conversationId, details) ?? surfaceFallbackLabel(firstRun?.surface ?? "slack");
1402
+ const displayTitle = firstRun?.displayTitle ?? displayTitleFromDetails(
1403
+ conversationId,
1404
+ details,
1405
+ conversation?.visibility
1406
+ ) ?? surfaceFallbackLabel(firstRun?.surface ?? "slack");
1338
1407
  const sentryConversationUrl = buildSentryConversationUrl(conversationId);
1339
1408
  return {
1340
1409
  conversationId,
@@ -1344,8 +1413,12 @@ async function readConversationReport(conversationId, options = {}) {
1344
1413
  runs: effectiveRuns
1345
1414
  };
1346
1415
  }
1347
- async function readConversationSubagentTranscriptReport(conversationId, runId, subagentId) {
1348
- const summaries = await listAgentTurnSessionSummariesForConversation(conversationId);
1416
+ async function readConversationSubagentTranscriptReport(conversationId, runId, subagentId, options = {}) {
1417
+ const store = conversationStore(options);
1418
+ const [summaries, conversation] = await Promise.all([
1419
+ listAgentTurnSessionSummariesForConversation(conversationId),
1420
+ store.get({ conversationId })
1421
+ ]);
1349
1422
  const summary = summaries.find((candidate) => candidate.sessionId === runId);
1350
1423
  if (!summary) {
1351
1424
  return {
@@ -1381,7 +1454,10 @@ async function readConversationSubagentTranscriptReport(conversationId, runId, s
1381
1454
  unavailableReason: "not_found"
1382
1455
  };
1383
1456
  }
1384
- const canExposeTranscript = canExposeConversationTranscript(summary);
1457
+ const canExposeTranscript = canExposeConversationTranscript(
1458
+ summary,
1459
+ conversation?.visibility
1460
+ );
1385
1461
  const activity = subagentActivity(start, { canExposeTranscript, end });
1386
1462
  const conversationFields = subagentConversationFields(start.transcriptRef);
1387
1463
  if (!canExposeTranscript) {
@@ -2,6 +2,8 @@ import {
2
2
  buildConversationContext,
3
3
  buildDeliveredTurnStatePatch,
4
4
  coerceThreadArtifactsState,
5
+ completeDeliveredTurn,
6
+ finalizeFailedTurnReply,
5
7
  generateAssistantReply,
6
8
  getPersistedSandboxState,
7
9
  getPersistedThreadState,
@@ -14,27 +16,27 @@ import {
14
16
  startActiveTurn,
15
17
  updateConversationStats,
16
18
  upsertConversationMessage
17
- } from "./chunk-T2YRJZ5A.js";
19
+ } from "./chunk-FPHA6GCQ.js";
18
20
  import {
19
21
  coerceThreadConversationState
20
22
  } from "./chunk-66NX7MNW.js";
21
- import "./chunk-LSG6PQF4.js";
23
+ import "./chunk-RIB3M6YA.js";
22
24
  import "./chunk-KNFROR7R.js";
23
25
  import {
24
26
  commitMessages,
25
27
  loadProjection
26
- } from "./chunk-JK7376UT.js";
27
- import "./chunk-AL6ZFV7U.js";
28
- import "./chunk-CWMMGUWM.js";
29
- import "./chunk-QWKB6NJV.js";
28
+ } from "./chunk-37B2R2QJ.js";
29
+ import "./chunk-2NFV5FMB.js";
30
+ import "./chunk-BRSQQRG6.js";
31
+ import "./chunk-6I6HBOQM.js";
30
32
  import "./chunk-G3E7SCME.js";
31
- import "./chunk-MJ4E2PK7.js";
32
- import "./chunk-BAPRSWNW.js";
33
+ import "./chunk-GB5DFM4D.js";
34
+ import "./chunk-GGD6WK6V.js";
33
35
  import {
34
36
  stripRuntimeTurnContext,
35
37
  trimTrailingAssistantMessages
36
- } from "./chunk-ALL7GG6U.js";
37
- import "./chunk-DR75T7J3.js";
38
+ } from "./chunk-ZU2ALUVQ.js";
39
+ import "./chunk-L7OHKDOX.js";
38
40
  import "./chunk-64ACM6AP.js";
39
41
  import "./chunk-BQ3ITJA6.js";
40
42
  import "./chunk-IXTBFABZ.js";
@@ -219,6 +221,11 @@ async function runLocalAgentTurn(input, deps) {
219
221
  await deps.onToolResult?.(result);
220
222
  }
221
223
  });
224
+ reply = finalizeFailedTurnReply({
225
+ reply,
226
+ logException,
227
+ context: { conversationId: input.conversationId }
228
+ });
222
229
  completedState = buildDeliveredTurnStatePatch({
223
230
  artifacts,
224
231
  conversation,
@@ -260,11 +267,18 @@ async function runLocalAgentTurn(input, deps) {
260
267
  sandboxId: reply.sandboxId ?? sandboxId,
261
268
  sandboxDependencyProfileHash: reply.sandboxDependencyProfileHash ?? sandboxDependencyProfileHash
262
269
  });
263
- if (reply.piMessages) {
264
- await commitMessages({
270
+ if (reply.piMessages?.length) {
271
+ await completeDeliveredTurn({
265
272
  conversationId: input.conversationId,
273
+ sessionId: turnId,
274
+ sliceId: 1,
266
275
  messages: reply.piMessages,
267
- ttlMs: THREAD_STATE_TTL_MS
276
+ durationMs: reply.diagnostics.durationMs,
277
+ usage: reply.diagnostics.usage,
278
+ destination,
279
+ source,
280
+ surface: "internal",
281
+ logContext: { modelId: reply.diagnostics.modelId }
268
282
  });
269
283
  }
270
284
  if (reply.diagnostics.outcome === "success") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.84.1",
3
+ "version": "0.86.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -70,7 +70,7 @@
70
70
  "pg": "^8.16.3",
71
71
  "yaml": "^2.9.0",
72
72
  "zod": "^4.4.3",
73
- "@sentry/junior-plugin-api": "0.84.1"
73
+ "@sentry/junior-plugin-api": "0.86.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@emnapi/core": "^1.10.0",
@@ -86,10 +86,10 @@
86
86
  "typescript": "^6.0.3",
87
87
  "vercel": "^54.4.0",
88
88
  "vitest": "^4.1.7",
89
- "@sentry/junior-github": "0.84.1",
89
+ "@sentry/junior-github": "0.86.0",
90
+ "@sentry/junior-memory": "0.86.0",
90
91
  "@sentry/junior-testing": "0.0.0",
91
- "@sentry/junior-memory": "0.84.1",
92
- "@sentry/junior-scheduler": "0.84.1"
92
+ "@sentry/junior-scheduler": "0.86.0"
93
93
  },
94
94
  "scripts": {
95
95
  "build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",