@sentry/junior 0.144.0 → 0.145.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 (88) hide show
  1. package/dist/{agent-hooks-GCUTGKY3.js → agent-hooks-L7D2BDVV.js} +10 -10
  2. package/dist/api/conversations/detail.d.ts +1 -0
  3. package/dist/api/schema/conversation.d.ts +2 -0
  4. package/dist/api/schema.js +1 -1
  5. package/dist/api.js +40 -22
  6. package/dist/app.js +335 -409
  7. package/dist/{catalog-runtime-DWVYKDC6.js → catalog-runtime-QLAC4Q3W.js} +5 -5
  8. package/dist/chat/agent/request.d.ts +1 -1
  9. package/dist/chat/agent/resume.d.ts +6 -15
  10. package/dist/chat/agent/tools.d.ts +1 -1
  11. package/dist/chat/agent-dispatch/types.d.ts +1 -1
  12. package/dist/chat/app/conversation-work.d.ts +24 -0
  13. package/dist/chat/conversations/projection.d.ts +11 -3
  14. package/dist/chat/conversations/store.d.ts +1 -1
  15. package/dist/chat/runtime/agent-run-outcome.d.ts +1 -1
  16. package/dist/chat/runtime/reply-executor.d.ts +5 -5
  17. package/dist/chat/runtime/slack-resume.d.ts +12 -4
  18. package/dist/chat/state/locks.d.ts +28 -0
  19. package/dist/chat/task-execution/checkpoint.d.ts +86 -0
  20. package/dist/chat/task-execution/paused-turn.d.ts +29 -0
  21. package/dist/chat/task-execution/queue-signing.d.ts +1 -0
  22. package/dist/chat/task-execution/queue.d.ts +7 -1
  23. package/dist/chat/task-execution/slack-work.d.ts +1 -1
  24. package/dist/chat/task-execution/state.d.ts +4 -4
  25. package/dist/chat/task-execution/store.d.ts +2 -2
  26. package/dist/chat/task-execution/turn-cursor-keys.d.ts +6 -0
  27. package/dist/chat/{state/turn-session.d.ts → task-execution/turn-cursor.d.ts} +52 -42
  28. package/dist/chat/task-execution/turn-wake.d.ts +29 -0
  29. package/dist/chat/tools/types.d.ts +1 -1
  30. package/dist/{chunk-HNO2E5WB.js → chunk-27TEJTZO.js} +1 -1
  31. package/dist/{chunk-RIFJUJSI.js → chunk-2LWPFSB4.js} +1 -1
  32. package/dist/{chunk-SBZP2J5Q.js → chunk-2UH3JI64.js} +10 -9
  33. package/dist/{chunk-QUZJDAQQ.js → chunk-2XET6PKP.js} +93 -89
  34. package/dist/{chunk-SUK7NC5A.js → chunk-5PNPQYTO.js} +2 -2
  35. package/dist/{chunk-SSDTQDYQ.js → chunk-64SBYW2O.js} +132 -127
  36. package/dist/{chunk-DVO5VKYQ.js → chunk-B46ZMVOV.js} +5 -5
  37. package/dist/{chunk-A67GZN73.js → chunk-CD2XFGYQ.js} +1 -1
  38. package/dist/{chunk-WTX2RFJG.js → chunk-DS3J6WGY.js} +1 -1
  39. package/dist/{chunk-PKH6762I.js → chunk-DXEQAIUV.js} +1 -1
  40. package/dist/{chunk-WSOLZJJS.js → chunk-EIX2LQ6L.js} +3 -3
  41. package/dist/{chunk-KQBXT5B7.js → chunk-FUBRJA5F.js} +6 -6
  42. package/dist/{chunk-I44JB7HQ.js → chunk-GDV5LXRA.js} +1 -1
  43. package/dist/{chunk-7KAW7UF4.js → chunk-GUWLDMGF.js} +4 -4
  44. package/dist/{chunk-PELZ2ZSY.js → chunk-HISR3DTV.js} +33 -61
  45. package/dist/{chunk-HD6BHR25.js → chunk-HLOUZC5C.js} +32 -34
  46. package/dist/{chunk-BBCWYXHB.js → chunk-I47UGQPJ.js} +7 -7
  47. package/dist/{chunk-IUFM5JWV.js → chunk-JAL3CH4G.js} +3 -0
  48. package/dist/{chunk-E7HCWOHG.js → chunk-JLMVCNXL.js} +2 -1
  49. package/dist/{chunk-STFCL3K4.js → chunk-JTGS3ZZE.js} +1 -1
  50. package/dist/{chunk-GKA74DRA.js → chunk-LVVSIMBB.js} +1 -1
  51. package/dist/{chunk-SHEEZSLY.js → chunk-PJ4NMVQB.js} +2 -2
  52. package/dist/{chunk-W7JFV5SB.js → chunk-QJBDABQA.js} +14 -17
  53. package/dist/{chunk-UDQMY6RS.js → chunk-QUG4JSZK.js} +43 -1
  54. package/dist/{chunk-4X5KM7Z6.js → chunk-RUSS62EN.js} +14 -14
  55. package/dist/{chunk-ZF3N3JD6.js → chunk-SIN3MXH6.js} +1 -1
  56. package/dist/{chunk-QE3TICD4.js → chunk-TZRXYWRE.js} +2 -2
  57. package/dist/{chunk-CNTWB2SM.js → chunk-VTDMB7XX.js} +1 -1
  58. package/dist/{chunk-LDWNYCZ6.js → chunk-WF5HVH3M.js} +1 -1
  59. package/dist/{chunk-KCBZSJRU.js → chunk-WR76IVA5.js} +5 -2
  60. package/dist/{chunk-3GU4PWA3.js → chunk-XFKIRN3Q.js} +29 -29
  61. package/dist/{chunk-ZZCTGAIT.js → chunk-YD54Q45G.js} +4 -4
  62. package/dist/{chunk-BEGGFVFR.js → chunk-ZIAMN2UW.js} +407 -523
  63. package/dist/{chunk-44RJWAND.js → chunk-ZIMRGFYL.js} +6 -6
  64. package/dist/{chunk-54JMYQYS.js → chunk-ZYAJMESY.js} +2 -2
  65. package/dist/cli/chat.js +32 -32
  66. package/dist/cli/check.js +6 -6
  67. package/dist/cli/plugins.js +13 -13
  68. package/dist/cli/snapshot-create.js +9 -9
  69. package/dist/cli/upgrade.js +7 -7
  70. package/dist/{db-EFLHTBU6.js → db-62PW6LM3.js} +7 -7
  71. package/dist/instrumentation.js +4 -4
  72. package/dist/nitro.js +4 -4
  73. package/dist/{oauth-callback-server-RO3IQKWM.js → oauth-callback-server-6NZNHJAM.js} +25 -25
  74. package/dist/{runner-LOWW7JKA.js → runner-GCRPG3GQ.js} +19 -18
  75. package/dist/{skills-ZLMUG7AE.js → skills-2S3MDFIQ.js} +6 -6
  76. package/dist/spawn-7WK37BTD.js +39 -0
  77. package/dist/{validation-MAKEZNTS.js → validation-HAOLCJ5A.js} +6 -6
  78. package/dist/version.js +1 -1
  79. package/dist/{work-5OAGC3I4.js → work-R4XYKMUW.js} +17 -16
  80. package/dist/worker-U2UCVR7M.js +24 -0
  81. package/package.json +4 -4
  82. package/dist/chat/agent/session.d.ts +0 -19
  83. package/dist/chat/runtime/agent-continue-runner.d.ts +0 -37
  84. package/dist/chat/services/agent-continue.d.ts +0 -29
  85. package/dist/chat/services/turn-session-record.d.ts +0 -164
  86. package/dist/chat/state/turn-session-keys.d.ts +0 -6
  87. package/dist/spawn-R3LUV6RF.js +0 -38
  88. package/dist/worker-KTGGRTTP.js +0 -24
@@ -7,7 +7,7 @@ import {
7
7
  PluginCredentialFailureError,
8
8
  agentNameSchema,
9
9
  createPluginAuthOrchestration
10
- } from "./chunk-DVO5VKYQ.js";
10
+ } from "./chunk-B46ZMVOV.js";
11
11
  import {
12
12
  authorizationId
13
13
  } from "./chunk-DIB4GX3G.js";
@@ -28,7 +28,7 @@ import {
28
28
  patchMcpAuthSession,
29
29
  selectPluginGrant,
30
30
  toMcpProviderError
31
- } from "./chunk-BBCWYXHB.js";
31
+ } from "./chunk-I47UGQPJ.js";
32
32
  import {
33
33
  RetryableDeliveryError,
34
34
  actorFromRouting,
@@ -44,12 +44,12 @@ import {
44
44
  getSlackMessagePermalink,
45
45
  resolveBaseUrl,
46
46
  uploadFilesToConversation
47
- } from "./chunk-KQBXT5B7.js";
47
+ } from "./chunk-FUBRJA5F.js";
48
48
  import {
49
49
  estimateTextTokens,
50
50
  getAgentContextCompactionTriggerTokens,
51
51
  getAgentContextInputLimitTokens
52
- } from "./chunk-CNTWB2SM.js";
52
+ } from "./chunk-VTDMB7XX.js";
53
53
  import {
54
54
  AGENTS_REMOVAL_NOTICE,
55
55
  AGENTS_REPLACEMENT_NOTICE,
@@ -66,6 +66,7 @@ import {
66
66
  canReusePendingAuthLink,
67
67
  collectFiles,
68
68
  containsNoReplyMarker,
69
+ continuableMessages,
69
70
  decideReply,
70
71
  extractAssistantText,
71
72
  findSingleRepositoryDirectory,
@@ -86,17 +87,13 @@ import {
86
87
  isTurnInputCommitLostError,
87
88
  loadConnectedMcpProviders,
88
89
  loadConversationProjection,
90
+ loadTurnCheckpoint,
89
91
  loadTurnRoute,
90
- loadTurnSessionRecord,
91
92
  mergeArtifactsState,
92
93
  missingPathSearchResult,
93
94
  normalizeToLf,
94
95
  normalizeToolNameFromResult,
95
96
  openConversationProjection,
96
- persistAuthPauseSessionRecord,
97
- persistContinuationSessionRecord,
98
- persistRunningSessionRecord,
99
- persistYieldSessionRecord,
100
97
  piMessageFromHistoryItem,
101
98
  positiveInteger,
102
99
  recordAgentsInstructionsUpdated,
@@ -110,10 +107,11 @@ import {
110
107
  resolveWorkspacePath,
111
108
  retainRuntimeTurnContext,
112
109
  sanitizeAssistantText,
110
+ saveTurnCheckpoint,
113
111
  stripRuntimeTurnContext,
114
112
  trimTrailingAssistantMessages,
115
113
  truncateText
116
- } from "./chunk-BEGGFVFR.js";
114
+ } from "./chunk-ZIAMN2UW.js";
117
115
  import {
118
116
  JUNIOR_THREAD_STATE_TTL_MS
119
117
  } from "./chunk-3Y47VMHV.js";
@@ -145,7 +143,7 @@ import {
145
143
  runNonInteractiveCommand,
146
144
  throwSandboxOperationError,
147
145
  wrapSandboxSetupError
148
- } from "./chunk-7KAW7UF4.js";
146
+ } from "./chunk-GUWLDMGF.js";
149
147
  import {
150
148
  SCHEDULED_TASK_SYSTEM_ACTOR,
151
149
  compactEventTask,
@@ -177,15 +175,15 @@ import {
177
175
  saveEventTask,
178
176
  scheduledTaskAttributes,
179
177
  writableEventTask
180
- } from "./chunk-ZZCTGAIT.js";
178
+ } from "./chunk-YD54Q45G.js";
181
179
  import {
182
180
  parseSlackThreadId
183
- } from "./chunk-PKH6762I.js";
181
+ } from "./chunk-DXEQAIUV.js";
184
182
  import {
185
183
  SHORT_TITLE_MAX_LENGTH,
186
184
  generateShortTitle,
187
185
  resolveTaskTitle
188
- } from "./chunk-54JMYQYS.js";
186
+ } from "./chunk-ZYAJMESY.js";
189
187
  import {
190
188
  ToolInputError,
191
189
  addAgentTurnUsage,
@@ -203,7 +201,7 @@ import {
203
201
  getSlackToolContext,
204
202
  readActorIdentity,
205
203
  resolveChannelCapabilities
206
- } from "./chunk-44RJWAND.js";
204
+ } from "./chunk-ZIMRGFYL.js";
207
205
  import {
208
206
  SlackActionError,
209
207
  downloadPrivateSlackFile,
@@ -212,7 +210,7 @@ import {
212
210
  isConversationScopedChannel,
213
211
  normalizeSlackConversationId,
214
212
  withSlackRetries
215
- } from "./chunk-QE3TICD4.js";
213
+ } from "./chunk-TZRXYWRE.js";
216
214
  import {
217
215
  KNOWN_CONVERSATION_EVENT_TYPES,
218
216
  contextProvenance,
@@ -223,7 +221,7 @@ import {
223
221
  instructionActors,
224
222
  instructionProvenanceFor,
225
223
  sameActorIdentity
226
- } from "./chunk-SBZP2J5Q.js";
224
+ } from "./chunk-2UH3JI64.js";
227
225
  import {
228
226
  SANDBOX_DATA_ROOT,
229
227
  SANDBOX_SKILLS_ROOT,
@@ -235,7 +233,7 @@ import {
235
233
  } from "./chunk-EM225ITJ.js";
236
234
  import {
237
235
  getStateAdapter
238
- } from "./chunk-UDQMY6RS.js";
236
+ } from "./chunk-QUG4JSZK.js";
239
237
  import {
240
238
  ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX,
241
239
  COMPACTION_SUMMARY_PREFIX,
@@ -269,7 +267,7 @@ import {
269
267
  resolveGatewayCredential,
270
268
  resolveGatewayModel,
271
269
  unwrapCurrentInstruction
272
- } from "./chunk-3GU4PWA3.js";
270
+ } from "./chunk-XFKIRN3Q.js";
273
271
  import {
274
272
  canExposeConversationPayload,
275
273
  resolveConversationPrivacy,
@@ -279,16 +277,16 @@ import {
279
277
  toGenAiMessagesTraceAttributes,
280
278
  toGenAiPayloadMetadata,
281
279
  toGenAiPayloadTraceAttributes
282
- } from "./chunk-STFCL3K4.js";
280
+ } from "./chunk-JTGS3ZZE.js";
283
281
  import {
284
282
  discoverSkills,
285
283
  findSkillByName,
286
284
  loadSkillsByName,
287
285
  parseSkillInvocation
288
- } from "./chunk-SUK7NC5A.js";
286
+ } from "./chunk-5PNPQYTO.js";
289
287
  import {
290
288
  pluginCatalogRuntime
291
- } from "./chunk-ZF3N3JD6.js";
289
+ } from "./chunk-SIN3MXH6.js";
292
290
  import {
293
291
  CredentialUnavailableError,
294
292
  OAuthProviderError,
@@ -296,7 +294,7 @@ import {
296
294
  getOAuthProviderErrorAttributes,
297
295
  resolveAuthTokenPlaceholder,
298
296
  resolvePluginCommandEnv
299
- } from "./chunk-A67GZN73.js";
297
+ } from "./chunk-CD2XFGYQ.js";
300
298
  import {
301
299
  credentialUserSubjectId
302
300
  } from "./chunk-RUIXF3YQ.js";
@@ -325,7 +323,7 @@ import {
325
323
  summarizeMessageText,
326
324
  withLogContext,
327
325
  withSpan
328
- } from "./chunk-RIFJUJSI.js";
326
+ } from "./chunk-2LWPFSB4.js";
329
327
  import {
330
328
  startInactiveSpan,
331
329
  withActiveSpan
@@ -1404,21 +1402,6 @@ function actionConfirmationRetryMessages(messages) {
1404
1402
  return retryMessages;
1405
1403
  }
1406
1404
 
1407
- // src/chat/agent/session.ts
1408
- async function restoreSessionRecord(args) {
1409
- const sessionRecordState = await loadTurnSessionRecord({
1410
- conversationId: args.conversationId,
1411
- sessionId: args.turnId
1412
- });
1413
- const { resumedFromSessionRecord, currentSliceId, existingSessionRecord } = sessionRecordState;
1414
- return {
1415
- currentSliceId,
1416
- existingSessionRecord,
1417
- resumedFromSessionRecord,
1418
- sessionRecordState
1419
- };
1420
- }
1421
-
1422
1405
  // src/chat/mcp/tool-name.ts
1423
1406
  function parseMcpProviderFromToolName(toolName) {
1424
1407
  if (!toolName.startsWith("mcp__")) return void 0;
@@ -15599,6 +15582,18 @@ function extractSliceUsage(messages, beforeMessageCount) {
15599
15582
  );
15600
15583
  return hasAgentTurnUsage(usage) ? usage : void 0;
15601
15584
  }
15585
+ function boundaryKey(messages) {
15586
+ return messages.map((message) => {
15587
+ const record2 = message;
15588
+ const content = typeof record2.content === "string" ? record2.content : JSON.stringify(record2.content ?? null);
15589
+ return [
15590
+ String(record2.role ?? ""),
15591
+ String(record2.timestamp ?? ""),
15592
+ String(record2.toolCallId ?? ""),
15593
+ content
15594
+ ].join("");
15595
+ }).join("");
15596
+ }
15602
15597
  function createResumeState(args) {
15603
15598
  let beforeMessageCount = 0;
15604
15599
  let inputCommitted = false;
@@ -15607,19 +15602,29 @@ function createResumeState(args) {
15607
15602
  let resumeMessages = [];
15608
15603
  let turnContexts = [];
15609
15604
  let turnStartMessageIndex;
15610
- const currentSliceId = args.sessionRecordState.currentSliceId;
15611
- const currentDurationMs = () => Date.now() - args.startedAtMs;
15612
- const sessionRecordBase = () => ({
15613
- channelName: args.channelName,
15605
+ let advancedPastResume = !args.checkpoint.resumed;
15606
+ let resumedBoundaryKey = "";
15607
+ if (args.checkpoint.resumed && args.checkpoint.record.piMessages.length) {
15608
+ const prior = args.checkpoint.record;
15609
+ latestSafeBoundaryMessages = [...prior.piMessages];
15610
+ resumeMessages = [...prior.piMessages];
15611
+ resumedBoundaryKey = boundaryKey(
15612
+ continuableMessages(prior.piMessages, prior.piMessages)
15613
+ );
15614
+ }
15615
+ const currentSliceId = args.checkpoint.sliceId;
15616
+ const durationMs = () => Date.now() - args.startedAtMs;
15617
+ const writeBase = () => ({
15614
15618
  conversationId: args.conversationId,
15619
+ turnId: args.turnId,
15620
+ modelId: args.getModelId(),
15621
+ channelName: args.channelName,
15615
15622
  destination: args.destination,
15616
- ...args.destinationVisibility ? { destinationVisibility: args.destinationVisibility } : {},
15617
- ...args.dispatchId ? { dispatchId: args.dispatchId } : {},
15623
+ destinationVisibility: args.destinationVisibility,
15624
+ dispatchId: args.dispatchId,
15618
15625
  source: args.runSource,
15619
- sessionId: args.turnId,
15620
15626
  loadedSkillNames: args.getLoadedSkillNames(),
15621
- modelId: args.getModelId(),
15622
- ...args.getReasoningLevel() ? { reasoningLevel: args.getReasoningLevel() } : {},
15627
+ reasoningLevel: args.getReasoningLevel(),
15623
15628
  actor: args.actor,
15624
15629
  surface: args.surface
15625
15630
  });
@@ -15642,7 +15647,7 @@ function createResumeState(args) {
15642
15647
  setTurnContexts(contexts) {
15643
15648
  turnContexts = contexts;
15644
15649
  },
15645
- /** Adopt an already committed epoch replacement as every resume baseline. */
15650
+ /** Use an already committed boundary as the resume baseline. */
15646
15651
  adoptCommittedBoundary(messages) {
15647
15652
  latestSafeBoundaryMessages = [...messages];
15648
15653
  resumeMessages = [...messages];
@@ -15664,18 +15669,23 @@ function createResumeState(args) {
15664
15669
  inputCommitted = true;
15665
15670
  },
15666
15671
  async persistSafeBoundary(messages, trailingMessageProvenance) {
15667
- const persisted = await persistRunningSessionRecord({
15668
- ...sessionRecordBase(),
15672
+ const saved = await saveTurnCheckpoint({
15673
+ mode: "running",
15674
+ ...writeBase(),
15669
15675
  sliceId: currentSliceId,
15670
15676
  messages,
15671
- ...trailingMessageProvenance ? { trailingMessageProvenance } : {},
15672
- ...turnContexts.length > 0 ? { turnContexts } : {},
15673
- ...turnStartMessageIndex !== void 0 ? { turnStartMessageIndex } : {}
15677
+ trailingMessageProvenance,
15678
+ turnContexts: turnContexts.length > 0 ? turnContexts : void 0,
15679
+ turnStartMessageIndex
15674
15680
  });
15675
- if (!persisted) {
15681
+ if (!saved) {
15676
15682
  return false;
15677
15683
  }
15678
15684
  latestSafeBoundaryMessages = [...messages];
15685
+ const persistedKey = boundaryKey(continuableMessages(messages, messages));
15686
+ if (resumedBoundaryKey.length === 0 || persistedKey !== resumedBoundaryKey) {
15687
+ advancedPastResume = true;
15688
+ }
15679
15689
  return true;
15680
15690
  },
15681
15691
  async requireDurableInputCheckpoint(messages, trailingMessageProvenance) {
@@ -15690,34 +15700,34 @@ function createResumeState(args) {
15690
15700
  }
15691
15701
  return persisted;
15692
15702
  },
15693
- /** Prepare a cooperative yield at the current durable boundary. */
15694
15703
  prepareYieldIfDue(currentMessages) {
15695
15704
  if (!args.durability.shouldYield?.()) {
15696
15705
  return void 0;
15697
15706
  }
15698
- const nextResumeMessages = this.getResumeSnapshot(currentMessages);
15699
- if (!isContinuablePiBoundary(nextResumeMessages)) {
15707
+ const next = this.getResumeSnapshot(currentMessages);
15708
+ if (!isContinuablePiBoundary(next)) {
15700
15709
  return void 0;
15701
15710
  }
15702
- resumeMessages = nextResumeMessages;
15711
+ resumeMessages = next;
15703
15712
  return new CooperativeTurnYieldError(
15704
- `Agent turn yielded at a safe boundary after ${currentDurationMs()}ms`
15713
+ `Agent turn yielded at a safe boundary after ${durationMs()}ms`
15705
15714
  );
15706
15715
  },
15707
- /** Persist an auth pause; only a durable pause may return `awaiting_auth`. */
15708
15716
  async parkForAuth(pause, currentUsage) {
15709
15717
  const usage = currentUsage ?? (resumeMessages.length > 0 ? extractSliceUsage(resumeMessages, beforeMessageCount) : void 0);
15710
15718
  try {
15711
15719
  await args.recordActiveMcpProviders();
15712
- const sessionRecord = await persistAuthPauseSessionRecord({
15713
- ...sessionRecordBase(),
15714
- currentSliceId,
15715
- currentDurationMs: currentDurationMs(),
15716
- currentUsage: usage,
15720
+ const record2 = await saveTurnCheckpoint({
15721
+ mode: "paused",
15722
+ reason: "auth",
15723
+ ...writeBase(),
15724
+ sliceId: currentSliceId,
15725
+ durationMs: durationMs(),
15726
+ usage,
15717
15727
  messages: resumeMessages,
15718
15728
  errorMessage: pause.message
15719
15729
  });
15720
- if (!sessionRecord) {
15730
+ if (!record2) {
15721
15731
  throw new AuthPausePersistenceError(args.conversationId, args.turnId);
15722
15732
  }
15723
15733
  return {
@@ -15727,7 +15737,7 @@ function createResumeState(args) {
15727
15737
  ...usage ? { usage } : {}
15728
15738
  };
15729
15739
  } catch (error) {
15730
- if (error instanceof AuthPausePersistenceError) {
15740
+ if (error instanceof AuthPausePersistenceError || error instanceof TurnSliceLimitExceededError) {
15731
15741
  throw error;
15732
15742
  }
15733
15743
  throw new AuthPausePersistenceError(
@@ -15737,62 +15747,61 @@ function createResumeState(args) {
15737
15747
  );
15738
15748
  }
15739
15749
  },
15740
- /** Persist a yield, retry, or timeout as a suspended run. */
15741
15750
  async translateSuspension(ending) {
15742
15751
  const { error } = ending;
15743
- if (error instanceof CooperativeTurnYieldError) {
15744
- const usage = ending.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
15745
- await args.recordActiveMcpProviders();
15746
- const sessionRecord = await persistYieldSessionRecord({
15747
- ...sessionRecordBase(),
15748
- currentSliceId,
15749
- currentDurationMs: currentDurationMs(),
15750
- currentUsage: usage,
15751
- messages: resumeMessages,
15752
- errorMessage: error.message
15752
+ const reason = error instanceof CooperativeTurnYieldError ? "yield" : error instanceof RetryableDeliveryError ? "retry" : timedOut ? "timeout" : void 0;
15753
+ if (!reason) {
15754
+ return void 0;
15755
+ }
15756
+ if (reason === "retry") {
15757
+ resumeMessages = [...latestSafeBoundaryMessages];
15758
+ }
15759
+ const parkMessages = reason === "yield" ? [...resumeMessages] : continuableMessages(resumeMessages, latestSafeBoundaryMessages);
15760
+ const parkKey = boundaryKey(parkMessages);
15761
+ if (!advancedPastResume && resumedBoundaryKey.length > 0 && parkKey === resumedBoundaryKey) {
15762
+ logWarn("agent.turn.no_progress_fail", {
15763
+ "app.ai.resume_conversation_id": args.conversationId,
15764
+ "app.ai.resume_session_id": args.turnId,
15765
+ "app.ai.resume_slice_id": currentSliceId,
15766
+ "app.ai.resume_reason": reason
15753
15767
  });
15754
- if (!sessionRecord) {
15755
- throw new Error(
15756
- `Failed to persist cooperative yield continuation for conversation=${args.conversationId} turn=${args.turnId}`
15757
- );
15758
- }
15768
+ await saveTurnCheckpoint({
15769
+ mode: "failed",
15770
+ ...writeBase(),
15771
+ sliceId: currentSliceId,
15772
+ durationMs: durationMs(),
15773
+ messages: parkMessages,
15774
+ errorMessage: "Turn made no progress: continue parked at the same boundary"
15775
+ });
15776
+ throw new Error(
15777
+ `Turn made no progress for conversation=${args.conversationId} turn=${args.turnId}`
15778
+ );
15779
+ }
15780
+ const usage = ending.currentUsage ?? extractSliceUsage(parkMessages, beforeMessageCount);
15781
+ await args.recordActiveMcpProviders();
15782
+ const record2 = await saveTurnCheckpoint({
15783
+ mode: "paused",
15784
+ reason,
15785
+ ...writeBase(),
15786
+ sliceId: currentSliceId,
15787
+ durationMs: durationMs(),
15788
+ usage,
15789
+ messages: parkMessages,
15790
+ errorMessage: error instanceof Error ? error.message : String(error)
15791
+ });
15792
+ if (!record2) {
15793
+ throw new Error(
15794
+ `Failed to persist continuation for conversation=${args.conversationId} turn=${args.turnId}`
15795
+ );
15796
+ }
15797
+ if (record2.state === "paused") {
15759
15798
  return {
15760
15799
  status: "suspended",
15761
- resumeVersion: sessionRecord.version,
15800
+ resumeVersion: record2.version,
15762
15801
  ...usage ? { usage } : {}
15763
15802
  };
15764
15803
  }
15765
- const resumeReason = error instanceof RetryableDeliveryError ? "retry" : timedOut ? "timeout" : void 0;
15766
- if (resumeReason) {
15767
- if (resumeReason === "retry") {
15768
- resumeMessages = [...latestSafeBoundaryMessages];
15769
- }
15770
- const usage = ending.currentUsage ?? extractSliceUsage(resumeMessages, beforeMessageCount);
15771
- await args.recordActiveMcpProviders();
15772
- const sessionRecord = await persistContinuationSessionRecord({
15773
- ...sessionRecordBase(),
15774
- currentSliceId,
15775
- currentDurationMs: currentDurationMs(),
15776
- currentUsage: usage,
15777
- messages: resumeMessages,
15778
- errorMessage: error instanceof Error ? error.message : String(error),
15779
- resumeReason
15780
- });
15781
- if (!sessionRecord) {
15782
- throw new Error(
15783
- `Failed to persist continuation for conversation=${args.conversationId} turn=${args.turnId}`
15784
- );
15785
- }
15786
- if (sessionRecord.state === "awaiting_resume") {
15787
- return {
15788
- status: "suspended",
15789
- resumeVersion: sessionRecord.version,
15790
- ...usage ? { usage } : {}
15791
- };
15792
- }
15793
- throw new TurnSliceLimitExceededError(botConfig.maxSlicesPerTurn);
15794
- }
15795
- return void 0;
15804
+ throw new TurnSliceLimitExceededError(botConfig.maxSlicesPerTurn);
15796
15805
  }
15797
15806
  };
15798
15807
  }
@@ -16487,15 +16496,10 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16487
16496
  loadedSkillNamesForResume = activeSkills.map((skill) => skill.name);
16488
16497
  };
16489
16498
  const skillSandbox = new SkillSandbox(availableSkills, activeSkills);
16490
- const {
16491
- sessionRecordState,
16492
- resumedFromSessionRecord,
16493
- currentSliceId,
16494
- existingSessionRecord
16495
- } = await restoreSessionRecord({
16496
- conversationId,
16497
- turnId
16498
- });
16499
+ const checkpoint = await loadTurnCheckpoint({ conversationId, turnId });
16500
+ const resumedFromSessionRecord = checkpoint.resumed;
16501
+ const currentSliceId = checkpoint.sliceId;
16502
+ const existingSessionRecord = checkpoint.record;
16499
16503
  const committedInstructionProvenance = [
16500
16504
  ...existingSessionRecord?.piMessageProvenance ?? [],
16501
16505
  ...(existingSessionRecord?.actors ?? []).map(instructionProvenanceFor),
@@ -16533,7 +16537,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
16533
16537
  runSource,
16534
16538
  conversationId,
16535
16539
  turnId,
16536
- sessionRecordState,
16540
+ checkpoint,
16537
16541
  startedAtMs: replyStartedAtMs,
16538
16542
  surface
16539
16543
  });
@@ -17134,6 +17138,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
17134
17138
  runResume.setTurnStartMessageIndex(
17135
17139
  existingSessionRecord.turnStartMessageIndex
17136
17140
  );
17141
+ runResume.adoptCommittedBoundary([...agent.state.messages]);
17137
17142
  } else if (promptHistoryMessages.length > 0) {
17138
17143
  agent.state.messages = [...promptHistoryMessages];
17139
17144
  }
@@ -17458,7 +17463,7 @@ async function executeAgentRunInPrivacyContext(request, conversationPrivacy, run
17458
17463
  throw error.originalError;
17459
17464
  }
17460
17465
  const runError = error instanceof AssistantMessageDeliveryError ? error.originalError : error;
17461
- if (runError instanceof AuthPausePersistenceError) {
17466
+ if (runError instanceof AuthPausePersistenceError || runError instanceof TurnSliceLimitExceededError) {
17462
17467
  throw runError;
17463
17468
  }
17464
17469
  if (resume && runError instanceof AuthorizationPauseError) {
@@ -4,24 +4,24 @@ import {
4
4
  import {
5
5
  formatProviderLabel,
6
6
  startOAuthFlow
7
- } from "./chunk-KQBXT5B7.js";
7
+ } from "./chunk-FUBRJA5F.js";
8
8
  import {
9
9
  abandonReplacedPendingAuth,
10
10
  canReusePendingAuthLink,
11
11
  recordAuthorizationRequested
12
- } from "./chunk-BEGGFVFR.js";
12
+ } from "./chunk-ZIAMN2UW.js";
13
13
  import {
14
14
  parseSandboxEgressAuthRequiredSignal
15
15
  } from "./chunk-HUO3UTAQ.js";
16
16
  import {
17
17
  AGENT_INVOCATION_MAILBOX_STATUSES
18
- } from "./chunk-HNO2E5WB.js";
18
+ } from "./chunk-27TEJTZO.js";
19
19
  import {
20
20
  TURN_REASONING_LEVELS
21
- } from "./chunk-3GU4PWA3.js";
21
+ } from "./chunk-XFKIRN3Q.js";
22
22
  import {
23
23
  pluginCatalogRuntime
24
- } from "./chunk-ZF3N3JD6.js";
24
+ } from "./chunk-SIN3MXH6.js";
25
25
  import {
26
26
  credentialContextSchema
27
27
  } from "./chunk-RUIXF3YQ.js";
@@ -5,7 +5,7 @@ import {
5
5
  logInfo,
6
6
  logWarn,
7
7
  setSpanAttributes
8
- } from "./chunk-RIFJUJSI.js";
8
+ } from "./chunk-2LWPFSB4.js";
9
9
  import {
10
10
  discoverInstalledPluginPackageContent,
11
11
  normalizePluginPackageNames
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  JUNIOR_VERSION
3
- } from "./chunk-I44JB7HQ.js";
3
+ } from "./chunk-GDV5LXRA.js";
4
4
 
5
5
  // src/deployment.ts
6
6
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-F3B2YJ76.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-RIFJUJSI.js";
8
+ } from "./chunk-2LWPFSB4.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getDb
3
- } from "./chunk-SBZP2J5Q.js";
3
+ } from "./chunk-2UH3JI64.js";
4
4
  import {
5
5
  juniorConversations,
6
6
  juniorTaskExecutions
7
- } from "./chunk-HNO2E5WB.js";
7
+ } from "./chunk-27TEJTZO.js";
8
8
  import {
9
9
  logWarn
10
- } from "./chunk-RIFJUJSI.js";
10
+ } from "./chunk-2LWPFSB4.js";
11
11
 
12
12
  // src/chat/tasks/execution-stats.ts
13
13
  import {
@@ -4,19 +4,19 @@ import {
4
4
  isDmChannel,
5
5
  normalizeSlackConversationId,
6
6
  withSlackRetries
7
- } from "./chunk-QE3TICD4.js";
7
+ } from "./chunk-TZRXYWRE.js";
8
8
  import {
9
9
  parseDestination
10
- } from "./chunk-SBZP2J5Q.js";
10
+ } from "./chunk-2UH3JI64.js";
11
11
  import {
12
12
  getStateAdapter
13
- } from "./chunk-UDQMY6RS.js";
13
+ } from "./chunk-QUG4JSZK.js";
14
14
  import {
15
15
  normalizeSlackEmojiName
16
- } from "./chunk-3GU4PWA3.js";
16
+ } from "./chunk-XFKIRN3Q.js";
17
17
  import {
18
18
  pluginCatalogRuntime
19
- } from "./chunk-ZF3N3JD6.js";
19
+ } from "./chunk-SIN3MXH6.js";
20
20
  import {
21
21
  parseSlackMessageTs,
22
22
  parseSlackUserId
@@ -25,7 +25,7 @@ import {
25
25
  isRecord,
26
26
  logInfo,
27
27
  logWarn
28
- } from "./chunk-RIFJUJSI.js";
28
+ } from "./chunk-2LWPFSB4.js";
29
29
 
30
30
  // src/chat/slack/outbound.ts
31
31
  var MAX_SLACK_MESSAGE_TEXT_CHARS = 4e4;
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.144.0",
4
+ version: "0.145.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"
@@ -4,18 +4,18 @@ import {
4
4
  } from "./chunk-EM225ITJ.js";
5
5
  import {
6
6
  getStateAdapter
7
- } from "./chunk-UDQMY6RS.js";
7
+ } from "./chunk-QUG4JSZK.js";
8
8
  import {
9
9
  toOptionalTrimmed
10
- } from "./chunk-3GU4PWA3.js";
10
+ } from "./chunk-XFKIRN3Q.js";
11
11
  import {
12
12
  pluginCatalogRuntime
13
- } from "./chunk-ZF3N3JD6.js";
13
+ } from "./chunk-SIN3MXH6.js";
14
14
  import {
15
15
  setSpanAttributes,
16
16
  setSpanStatus,
17
17
  withSpan
18
- } from "./chunk-RIFJUJSI.js";
18
+ } from "./chunk-2LWPFSB4.js";
19
19
 
20
20
  // src/chat/sandbox/resources.ts
21
21
  var configuredResources;