@sentry/junior 0.196.0 → 0.197.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 (64) hide show
  1. package/dist/{agent-hooks-IQLRR4RC.js → agent-hooks-CM4EKXL4.js} +11 -11
  2. package/dist/api.js +24 -24
  3. package/dist/app.js +38 -76
  4. package/dist/{catalog-runtime-EM7V2F4I.js → catalog-runtime-V7WGCXUD.js} +4 -4
  5. package/dist/chat/services/automated-turn-limit.d.ts +13 -34
  6. package/dist/chat/slack/automated-turn-limit-notice.d.ts +2 -24
  7. package/dist/{chunk-G6YRPYDC.js → chunk-2K26W3FP.js} +1 -1
  8. package/dist/{chunk-QAINJHI4.js → chunk-4USCVHQZ.js} +5 -5
  9. package/dist/{chunk-NE2UQMC7.js → chunk-4UUKQB6I.js} +6 -6
  10. package/dist/{chunk-XNXKRWWI.js → chunk-5GWV7SXF.js} +3 -10
  11. package/dist/{chunk-VSOO3Y6M.js → chunk-5MMQLB2B.js} +1 -1
  12. package/dist/{chunk-PIZJBSGZ.js → chunk-6ZQ3CE6X.js} +1 -1
  13. package/dist/{chunk-CTS72G4B.js → chunk-7ENMKNEK.js} +1 -1
  14. package/dist/{chunk-VRHZXY5X.js → chunk-BGSAFVJO.js} +1 -1
  15. package/dist/{chunk-PI6VXVBK.js → chunk-BQ7UXCUO.js} +1 -1
  16. package/dist/{chunk-5XSEOJPC.js → chunk-BR5GNDPS.js} +2 -2
  17. package/dist/{chunk-KZX7LORG.js → chunk-C2SOA3KN.js} +3 -3
  18. package/dist/{chunk-CNI74T7U.js → chunk-DBTI74IT.js} +5 -5
  19. package/dist/{chunk-BXIVMNLR.js → chunk-DHWYAHAM.js} +1 -1
  20. package/dist/{chunk-LSPUMNZK.js → chunk-DLXA2ZXJ.js} +2 -2
  21. package/dist/{chunk-ES7KCEND.js → chunk-EZKISZ3Q.js} +1 -1
  22. package/dist/{chunk-VXAQTJSR.js → chunk-FCONFDZ4.js} +1 -1
  23. package/dist/{chunk-EEUFKVCD.js → chunk-H6QL3FWC.js} +21 -21
  24. package/dist/{chunk-RAWYH7TW.js → chunk-HDSDOBWN.js} +1 -1
  25. package/dist/{chunk-S74KAE77.js → chunk-IGSAXSM7.js} +4 -4
  26. package/dist/{chunk-LCAM2P7H.js → chunk-ITP4OR7R.js} +4 -4
  27. package/dist/{chunk-RFNMWONZ.js → chunk-LIK4T6CF.js} +6 -6
  28. package/dist/{chunk-6LQNW2CJ.js → chunk-LMTHFU5D.js} +6 -6
  29. package/dist/{chunk-LGXI6PWX.js → chunk-MJCJ62RZ.js} +4 -4
  30. package/dist/{chunk-EFNUCRB5.js → chunk-NANQFFGO.js} +8 -8
  31. package/dist/{chunk-OVWAO5KY.js → chunk-O2H7JUEQ.js} +51 -174
  32. package/dist/{chunk-KJGH3KWA.js → chunk-O5RG7SKU.js} +3 -3
  33. package/dist/{chunk-EQBHN4JK.js → chunk-PF3PEX4Q.js} +1 -1
  34. package/dist/{chunk-I7GEGEHZ.js → chunk-PM5WSDAD.js} +1 -1
  35. package/dist/{chunk-J357NJQ5.js → chunk-S3DRTWPX.js} +5 -5
  36. package/dist/{chunk-VKLQ2M7V.js → chunk-SBCWV4E4.js} +9 -9
  37. package/dist/{chunk-7TUDDW3Y.js → chunk-T5MK3RUT.js} +3 -3
  38. package/dist/{chunk-N2MSPOGG.js → chunk-V2IX5Q5L.js} +8 -8
  39. package/dist/{chunk-GZ336GZ5.js → chunk-VAUPAX3O.js} +4 -4
  40. package/dist/{chunk-VVU7GHIZ.js → chunk-WOJG25QZ.js} +8 -8
  41. package/dist/{chunk-P3LE2CSJ.js → chunk-XALIC5SY.js} +2 -2
  42. package/dist/{chunk-DFWJJOW3.js → chunk-YC5CFKME.js} +1 -1
  43. package/dist/{chunk-SR5FS2JP.js → chunk-YLBJBBYX.js} +3 -3
  44. package/dist/{chunk-B5WJBVHY.js → chunk-YZQLXALE.js} +2 -2
  45. package/dist/cli/chat.js +33 -33
  46. package/dist/cli/check.js +5 -5
  47. package/dist/cli/plugins.js +12 -12
  48. package/dist/cli/snapshot-create.js +9 -9
  49. package/dist/cli/upgrade.js +6 -6
  50. package/dist/{db-YTM7ZXPK.js → db-6BD722UD.js} +6 -6
  51. package/dist/instrumentation.js +3 -3
  52. package/dist/nitro.js +6 -6
  53. package/dist/{oauth-callback-server-OXW4KQLQ.js → oauth-callback-server-P6AIT27Q.js} +29 -29
  54. package/dist/{runner-RJY5RNJO.js → runner-OKPDZOJC.js} +21 -21
  55. package/dist/{skills-WZV6NLFY.js → skills-CQFX3V2I.js} +5 -5
  56. package/dist/spawn-GA5MADGU.js +42 -0
  57. package/dist/task-runner-7IIYO44C.js +36 -0
  58. package/dist/{validation-XS5ZHV3W.js → validation-STB4W433.js} +5 -5
  59. package/dist/version.js +1 -1
  60. package/dist/{work-LJMSDEY3.js → work-B7N5TEYI.js} +21 -21
  61. package/dist/{worker-NMFZ7A2N.js → worker-W6PBEHCA.js} +10 -10
  62. package/package.json +4 -4
  63. package/dist/spawn-J7SQJLYF.js +0 -42
  64. package/dist/task-runner-SMUQ5464.js +0 -36
@@ -3,39 +3,39 @@ import {
3
3
  } from "./chunk-RC745GGZ.js";
4
4
  import {
5
5
  parseSlackThreadId
6
- } from "./chunk-VXAQTJSR.js";
6
+ } from "./chunk-FCONFDZ4.js";
7
7
  import {
8
8
  appendAndEnqueueExclusiveInboundMessage,
9
9
  appendAndEnqueueInboundMessage
10
- } from "./chunk-S74KAE77.js";
10
+ } from "./chunk-IGSAXSM7.js";
11
11
  import {
12
12
  buildDeterministicTurnId
13
13
  } from "./chunk-DA2KGZZI.js";
14
14
  import {
15
15
  normalizeSlackConversationId
16
- } from "./chunk-NE2UQMC7.js";
16
+ } from "./chunk-4UUKQB6I.js";
17
17
  import {
18
18
  getConversationStore,
19
19
  getDb
20
- } from "./chunk-XNXKRWWI.js";
20
+ } from "./chunk-5GWV7SXF.js";
21
21
  import {
22
22
  juniorConversationParticipants,
23
23
  juniorConversations,
24
24
  juniorIdentities,
25
25
  juniorUsers
26
- } from "./chunk-PIZJBSGZ.js";
26
+ } from "./chunk-6ZQ3CE6X.js";
27
27
  import {
28
28
  juniorDestinations
29
29
  } from "./chunk-VFUK3X5B.js";
30
30
  import {
31
31
  getSlackBotToken
32
- } from "./chunk-5XSEOJPC.js";
32
+ } from "./chunk-BR5GNDPS.js";
33
33
  import {
34
34
  canExposeConversationPayload
35
- } from "./chunk-ES7KCEND.js";
35
+ } from "./chunk-EZKISZ3Q.js";
36
36
  import {
37
37
  logWarn
38
- } from "./chunk-CTS72G4B.js";
38
+ } from "./chunk-7ENMKNEK.js";
39
39
 
40
40
  // src/handlers/health.ts
41
41
  function readHealthReport() {
@@ -7,7 +7,7 @@ import {
7
7
  PluginCredentialFailureError,
8
8
  agentNameSchema,
9
9
  createPluginAuthOrchestration
10
- } from "./chunk-CNI74T7U.js";
10
+ } from "./chunk-DBTI74IT.js";
11
11
  import {
12
12
  parseSandboxEgressAuthRequiredSignal,
13
13
  parseSandboxEgressPermissionDeniedSignal,
@@ -38,7 +38,7 @@ import {
38
38
  searchSlackUsers,
39
39
  selectPluginGrant,
40
40
  toMcpProviderError
41
- } from "./chunk-N2MSPOGG.js";
41
+ } from "./chunk-V2IX5Q5L.js";
42
42
  import {
43
43
  RetryableDeliveryError,
44
44
  actorFromRun,
@@ -53,7 +53,7 @@ import {
53
53
  surfaceFromRun,
54
54
  toolInvocationDestination,
55
55
  uploadFilesToConversation
56
- } from "./chunk-RFNMWONZ.js";
56
+ } from "./chunk-LIK4T6CF.js";
57
57
  import {
58
58
  CooperativeTurnYieldError,
59
59
  NO_REPLY_MARKER,
@@ -65,7 +65,7 @@ import {
65
65
  isNoReplyMarker,
66
66
  isTurnInputCommitLostError,
67
67
  sanitizeAssistantText
68
- } from "./chunk-DFWJJOW3.js";
68
+ } from "./chunk-YC5CFKME.js";
69
69
  import {
70
70
  AGENTS_REMOVAL_NOTICE,
71
71
  AGENTS_REPLACEMENT_NOTICE,
@@ -121,7 +121,7 @@ import {
121
121
  stripRuntimeTurnContext,
122
122
  trimTrailingAssistantMessages,
123
123
  truncateText
124
- } from "./chunk-6LQNW2CJ.js";
124
+ } from "./chunk-LMTHFU5D.js";
125
125
  import {
126
126
  SCHEDULED_TASK_SYSTEM_ACTOR,
127
127
  WORKSPACE_SNAPSHOT_FAILED_EVENT,
@@ -162,13 +162,13 @@ import {
162
162
  workspaceSnapshotFinishedEvent,
163
163
  workspaceSnapshotWatch,
164
164
  writableEventTask
165
- } from "./chunk-GZ336GZ5.js";
165
+ } from "./chunk-VAUPAX3O.js";
166
166
  import {
167
167
  parseSlackThreadId
168
- } from "./chunk-VXAQTJSR.js";
168
+ } from "./chunk-FCONFDZ4.js";
169
169
  import {
170
170
  appendAndEnqueueInboundMessage
171
- } from "./chunk-S74KAE77.js";
171
+ } from "./chunk-IGSAXSM7.js";
172
172
  import {
173
173
  SHORT_TITLE_MAX_LENGTH,
174
174
  ToolInputError,
@@ -176,7 +176,7 @@ import {
176
176
  generateShortTitle,
177
177
  hasAgentTurnUsage,
178
178
  resolveTaskTitle
179
- } from "./chunk-B5WJBVHY.js";
179
+ } from "./chunk-YZQLXALE.js";
180
180
  import {
181
181
  bindSandboxFileSystem,
182
182
  createSandboxSession,
@@ -187,7 +187,7 @@ import {
187
187
  resolve,
188
188
  setSnapshotSpanAttributes,
189
189
  stopSession
190
- } from "./chunk-KZX7LORG.js";
190
+ } from "./chunk-C2SOA3KN.js";
191
191
  import {
192
192
  privateTraceResultAttributes
193
193
  } from "./chunk-UIE3R5XU.js";
@@ -197,7 +197,7 @@ import {
197
197
  } from "./chunk-X6GDDWQH.js";
198
198
  import {
199
199
  getTurnRequestDeadline
200
- } from "./chunk-VRHZXY5X.js";
200
+ } from "./chunk-BGSAFVJO.js";
201
201
  import {
202
202
  getVercelConversationWorkQueue
203
203
  } from "./chunk-DKIJ2RP5.js";
@@ -244,23 +244,22 @@ import {
244
244
  updateWorkspace,
245
245
  withSlackRetries,
246
246
  workspaceRepoCheckoutPath
247
- } from "./chunk-NE2UQMC7.js";
247
+ } from "./chunk-4UUKQB6I.js";
248
248
  import {
249
249
  JUNIOR_THREAD_STATE_TTL_MS
250
250
  } from "./chunk-3Y47VMHV.js";
251
251
  import {
252
- destinationKey,
253
252
  getConversationEventStore,
254
253
  getConversationMessageSearchStore,
255
254
  getConversationStore,
256
255
  getDb,
257
256
  getSqlExecutor
258
- } from "./chunk-XNXKRWWI.js";
257
+ } from "./chunk-5GWV7SXF.js";
259
258
  import {
260
259
  juniorArtifacts,
261
260
  juniorIdentities,
262
261
  juniorSchedulerRuns
263
- } from "./chunk-PIZJBSGZ.js";
262
+ } from "./chunk-6ZQ3CE6X.js";
264
263
  import {
265
264
  SANDBOX_DATA_ROOT,
266
265
  SANDBOX_REPOS_ROOT,
@@ -291,12 +290,12 @@ import {
291
290
  throwSandboxOperationError,
292
291
  workspaceSnapshotNotReadyUserMessage,
293
292
  wrapSandboxSetupError
294
- } from "./chunk-SR5FS2JP.js";
293
+ } from "./chunk-YLBJBBYX.js";
295
294
  import {
296
295
  fenceLock,
297
296
  getStateAdapter,
298
297
  withLock
299
- } from "./chunk-EQBHN4JK.js";
298
+ } from "./chunk-PF3PEX4Q.js";
300
299
  import {
301
300
  KNOWN_CONVERSATION_EVENT_TYPES,
302
301
  contextProvenance,
@@ -329,7 +328,7 @@ import {
329
328
  resolveGatewayCredential,
330
329
  resolveGatewayModel,
331
330
  unwrapCurrentInstruction
332
- } from "./chunk-5XSEOJPC.js";
331
+ } from "./chunk-BR5GNDPS.js";
333
332
  import {
334
333
  ModelProfileNotConfiguredError,
335
334
  TURN_REASONING_LEVELS,
@@ -348,16 +347,16 @@ import {
348
347
  toGenAiMessagesTraceAttributes,
349
348
  toGenAiPayloadMetadata,
350
349
  toGenAiPayloadTraceAttributes
351
- } from "./chunk-ES7KCEND.js";
350
+ } from "./chunk-EZKISZ3Q.js";
352
351
  import {
353
352
  discoverSkills,
354
353
  findSkillByName,
355
354
  loadSkillsByName,
356
355
  parseSkillInvocation
357
- } from "./chunk-LSPUMNZK.js";
356
+ } from "./chunk-DLXA2ZXJ.js";
358
357
  import {
359
358
  pluginCatalogRuntime
360
- } from "./chunk-G6YRPYDC.js";
359
+ } from "./chunk-2K26W3FP.js";
361
360
  import {
362
361
  CredentialUnavailableError,
363
362
  OAuthProviderError,
@@ -365,7 +364,7 @@ import {
365
364
  getOAuthProviderErrorAttributes,
366
365
  resolveAuthTokenPlaceholder,
367
366
  resolvePluginCommandEnv
368
- } from "./chunk-BXIVMNLR.js";
367
+ } from "./chunk-DHWYAHAM.js";
369
368
  import {
370
369
  credentialContextForActor,
371
370
  credentialUserSubjectId
@@ -401,7 +400,7 @@ import {
401
400
  summarizeMessageText,
402
401
  withLogContext,
403
402
  withSpan
404
- } from "./chunk-CTS72G4B.js";
403
+ } from "./chunk-7ENMKNEK.js";
405
404
  import {
406
405
  startInactiveSpan,
407
406
  withActiveSpan
@@ -3118,11 +3117,8 @@ function sleep2(ms) {
3118
3117
  timer.unref?.();
3119
3118
  });
3120
3119
  }
3121
- function scopeKey(scope) {
3122
- if (scope.kind === "conversation") {
3123
- return `${AUTOMATED_TURN_LIMIT_PREFIX}:conversation:${scope.conversationId}`;
3124
- }
3125
- return `${AUTOMATED_TURN_LIMIT_PREFIX}:destination:${destinationKey(scope.destination)}`;
3120
+ function conversationKey(conversationId) {
3121
+ return `${AUTOMATED_TURN_LIMIT_PREFIX}:conversation:${conversationId}`;
3126
3122
  }
3127
3123
  function lockKey(key) {
3128
3124
  return `${key}:lock`;
@@ -3131,7 +3127,7 @@ function parseState(value) {
3131
3127
  const parsed = automatedTurnLimitStateSchema.safeParse(value);
3132
3128
  return parsed.success ? parsed.data : void 0;
3133
3129
  }
3134
- async function acquireScopeLock(state, key, waitDeadlineMs = Date.now() + AUTOMATED_TURN_LIMIT_LOCK_WAIT_MS) {
3130
+ async function acquireConversationLock(state, key, waitDeadlineMs = Date.now() + AUTOMATED_TURN_LIMIT_LOCK_WAIT_MS) {
3135
3131
  while (true) {
3136
3132
  const lock = await state.acquireLock(
3137
3133
  lockKey(key),
@@ -3146,8 +3142,8 @@ async function acquireScopeLock(state, key, waitDeadlineMs = Date.now() + AUTOMA
3146
3142
  await sleep2(AUTOMATED_TURN_LIMIT_LOCK_RETRY_MS);
3147
3143
  }
3148
3144
  }
3149
- async function withScopeLock(state, key, callback) {
3150
- const lock = await acquireScopeLock(state, key);
3145
+ async function withConversationLock(state, key, callback) {
3146
+ const lock = await acquireConversationLock(state, key);
3151
3147
  try {
3152
3148
  return await callback();
3153
3149
  } finally {
@@ -3161,36 +3157,14 @@ function emptyState(nowMs) {
3161
3157
  updatedAtMs: nowMs
3162
3158
  };
3163
3159
  }
3164
- function resumeInForScope(scope) {
3165
- return scope.kind === "conversation" ? "thread" : "channel";
3166
- }
3167
3160
  function isAutomatedTurnSource(source) {
3168
3161
  if (!source) {
3169
3162
  return false;
3170
3163
  }
3171
3164
  return source.kind === "resource_event" || source.kind === "event_task" || source.kind === "scheduled_task" || source.kind === "plugin_dispatch" || source.kind === "agent_invocation";
3172
3165
  }
3173
- function automatedTurnLimitScopeForSource(args) {
3174
- if (!isAutomatedTurnSource(args.source)) {
3175
- return void 0;
3176
- }
3177
- if (args.source?.kind === "resource_event") {
3178
- return {
3179
- kind: "conversation",
3180
- conversationId: args.conversationId
3181
- };
3182
- }
3183
- if (args.destination) {
3184
- return { kind: "destination", destination: args.destination };
3185
- }
3186
- return {
3187
- kind: "conversation",
3188
- conversationId: args.conversationId
3189
- };
3190
- }
3191
3166
  function buildAutomatedTurnLimitResponse(args) {
3192
- const place = args.resumeIn === "channel" ? "channel" : "thread";
3193
- return `I stopped automatic updates after ${args.maxTurns} replies without a new message from you. Send a message or @mention me in this ${place} to continue.`;
3167
+ return `I stopped automatic updates after ${args.maxTurns} replies without a new message from you. Send a message or @mention me in this thread to continue.`;
3194
3168
  }
3195
3169
  async function admitAutomatedTurn(args) {
3196
3170
  if (args.maxTurns < 1) {
@@ -3199,8 +3173,8 @@ async function admitAutomatedTurn(args) {
3199
3173
  const state = args.state ?? getStateAdapter();
3200
3174
  await state.connect();
3201
3175
  const nowMs = args.nowMs ?? Date.now();
3202
- const key = scopeKey(args.scope);
3203
- return await withScopeLock(state, key, async () => {
3176
+ const key = conversationKey(args.conversationId);
3177
+ return await withConversationLock(state, key, async () => {
3204
3178
  const current = parseState(await state.get(key)) ?? emptyState(nowMs);
3205
3179
  if (current.paused || current.consecutiveAutomatedTurns >= args.maxTurns) {
3206
3180
  const shouldPostNotice = current.noticePostedAtMs === void 0;
@@ -3235,9 +3209,8 @@ async function countAutomatedTurn(args) {
3235
3209
  const state = args.state ?? getStateAdapter();
3236
3210
  await state.connect();
3237
3211
  const nowMs = args.nowMs ?? Date.now();
3238
- const key = scopeKey(args.scope);
3239
- const resumeIn = resumeInForScope(args.scope);
3240
- return await withScopeLock(state, key, async () => {
3212
+ const key = conversationKey(args.conversationId);
3213
+ return await withConversationLock(state, key, async () => {
3241
3214
  const current = parseState(await state.get(key)) ?? emptyState(nowMs);
3242
3215
  const consecutiveAutomatedTurns = current.consecutiveAutomatedTurns + 1;
3243
3216
  const paused = consecutiveAutomatedTurns >= args.maxTurns;
@@ -3246,16 +3219,15 @@ async function countAutomatedTurn(args) {
3246
3219
  consecutiveAutomatedTurns,
3247
3220
  paused,
3248
3221
  updatedAtMs: nowMs,
3249
- // Claim the notice slot before the destination post. Mark success after
3250
- // the post lands; clear the claim if the post fails or is skipped.
3222
+ // Claim the notice slot before posting. Mark success after the post
3223
+ // lands; clear the claim if the post fails or is skipped.
3251
3224
  ...shouldPostNotice ? { noticePostedAtMs: nowMs } : current.noticePostedAtMs !== void 0 ? { noticePostedAtMs: current.noticePostedAtMs } : void 0
3252
3225
  };
3253
3226
  await state.set(key, next, JUNIOR_THREAD_STATE_TTL_MS);
3254
3227
  return {
3255
3228
  consecutiveAutomatedTurns,
3256
3229
  paused,
3257
- shouldPostNotice,
3258
- resumeIn
3230
+ shouldPostNotice
3259
3231
  };
3260
3232
  });
3261
3233
  }
@@ -3263,8 +3235,8 @@ async function clearAutomatedTurnLimitNoticeClaim(args) {
3263
3235
  const state = args.state ?? getStateAdapter();
3264
3236
  await state.connect();
3265
3237
  const nowMs = args.nowMs ?? Date.now();
3266
- const key = scopeKey(args.scope);
3267
- await withScopeLock(state, key, async () => {
3238
+ const key = conversationKey(args.conversationId);
3239
+ await withConversationLock(state, key, async () => {
3268
3240
  const current = parseState(await state.get(key));
3269
3241
  if (!current || current.noticePostedAtMs === void 0) {
3270
3242
  return;
@@ -3283,41 +3255,26 @@ async function clearAutomatedTurnLimitNoticeClaim(args) {
3283
3255
  async function resetAutomatedTurnLimit(args) {
3284
3256
  const state = args.state ?? getStateAdapter();
3285
3257
  await state.connect();
3286
- const key = scopeKey(args.scope);
3287
- await withScopeLock(state, key, async () => {
3258
+ const key = conversationKey(args.conversationId);
3259
+ await withConversationLock(state, key, async () => {
3288
3260
  await state.delete(key);
3289
3261
  });
3290
3262
  }
3291
3263
  async function recordFinishedTurnForAutomatedLimit(args) {
3292
3264
  const nowMs = args.nowMs ?? Date.now();
3293
- const automatedScope = automatedTurnLimitScopeForSource({
3294
- conversationId: args.conversationId,
3295
- destination: args.destination,
3296
- source: args.source
3297
- });
3298
- if (automatedScope) {
3265
+ if (isAutomatedTurnSource(args.source)) {
3299
3266
  return await countAutomatedTurn({
3267
+ conversationId: args.conversationId,
3300
3268
  maxTurns: args.maxTurns,
3301
3269
  nowMs,
3302
- scope: automatedScope,
3303
3270
  state: args.state
3304
3271
  });
3305
3272
  }
3306
3273
  await resetAutomatedTurnLimit({
3274
+ conversationId: args.conversationId,
3307
3275
  nowMs,
3308
- scope: {
3309
- kind: "conversation",
3310
- conversationId: args.conversationId
3311
- },
3312
3276
  state: args.state
3313
3277
  });
3314
- if (args.destination) {
3315
- await resetAutomatedTurnLimit({
3316
- nowMs,
3317
- scope: { kind: "destination", destination: args.destination },
3318
- state: args.state
3319
- });
3320
- }
3321
3278
  return void 0;
3322
3279
  }
3323
3280
 
@@ -3330,10 +3287,6 @@ async function releaseFailedNoticeClaim(args) {
3330
3287
  }
3331
3288
  }
3332
3289
  async function postAutomatedTurnLimitNoticeForConversation(args) {
3333
- const scope = args.scope ?? {
3334
- kind: "conversation",
3335
- conversationId: args.conversationId
3336
- };
3337
3290
  try {
3338
3291
  const conversation = await getConversationStore().get({
3339
3292
  conversationId: args.conversationId
@@ -3345,18 +3298,17 @@ async function postAutomatedTurnLimitNoticeForConversation(args) {
3345
3298
  "app.automated_turn_limit.reason": location ? "unsupported_location" : "missing_location"
3346
3299
  });
3347
3300
  await releaseFailedNoticeClaim({
3348
- nowMs: args.nowMs,
3349
- scope
3301
+ conversationId: args.conversationId,
3302
+ nowMs: args.nowMs
3350
3303
  });
3351
3304
  return false;
3352
3305
  }
3353
3306
  await postSlackMessage({
3354
3307
  channelId: location.channelId,
3355
3308
  text: buildAutomatedTurnLimitResponse({
3356
- maxTurns: args.maxTurns,
3357
- resumeIn: args.resumeIn ?? "thread"
3309
+ maxTurns: args.maxTurns
3358
3310
  }),
3359
- ...location.threadTs ? { threadTs: location.threadTs } : void 0
3311
+ ...args.threadTs ? { threadTs: args.threadTs } : location.threadTs ? { threadTs: location.threadTs } : void 0
3360
3312
  });
3361
3313
  return true;
3362
3314
  } catch (error) {
@@ -3364,45 +3316,8 @@ async function postAutomatedTurnLimitNoticeForConversation(args) {
3364
3316
  conversationId: args.conversationId
3365
3317
  });
3366
3318
  await releaseFailedNoticeClaim({
3367
- nowMs: args.nowMs,
3368
- scope
3369
- });
3370
- return false;
3371
- }
3372
- }
3373
- async function postAutomatedTurnLimitNoticeForDestination(args) {
3374
- const scope = args.scope ?? {
3375
- kind: "destination",
3376
- destination: args.destination
3377
- };
3378
- if (args.destination.platform !== "slack") {
3379
- logWarn("automated_turn_limit.notice_skipped", {
3380
- "app.automated_turn_limit.reason": "unsupported_destination"
3381
- });
3382
- await releaseFailedNoticeClaim({
3383
- nowMs: args.nowMs,
3384
- scope
3385
- });
3386
- return false;
3387
- }
3388
- try {
3389
- await postSlackMessage({
3390
- channelId: args.destination.channelId,
3391
- text: buildAutomatedTurnLimitResponse({
3392
- maxTurns: args.maxTurns,
3393
- resumeIn: args.resumeIn ?? "channel"
3394
- }),
3395
- ...args.threadTs ? { threadTs: args.threadTs } : void 0
3396
- });
3397
- return true;
3398
- } catch (error) {
3399
- logException(error, "automated_turn_limit.notice_failed", {
3400
- "app.slack.channel_id": args.destination.channelId,
3401
- "app.slack.team_id": args.destination.teamId
3402
- });
3403
- await releaseFailedNoticeClaim({
3404
- nowMs: args.nowMs,
3405
- scope
3319
+ conversationId: args.conversationId,
3320
+ nowMs: args.nowMs
3406
3321
  });
3407
3322
  return false;
3408
3323
  }
@@ -3411,39 +3326,11 @@ async function maybePostAutomatedTurnLimitNotice(args) {
3411
3326
  if (!args.update?.shouldPostNotice) {
3412
3327
  return;
3413
3328
  }
3414
- if (args.update.resumeIn === "thread") {
3415
- await postAutomatedTurnLimitNoticeForConversation({
3416
- conversationId: args.conversationId,
3417
- maxTurns: args.maxTurns,
3418
- nowMs: args.nowMs,
3419
- resumeIn: "thread",
3420
- scope: {
3421
- kind: "conversation",
3422
- conversationId: args.conversationId
3423
- }
3424
- });
3425
- return;
3426
- }
3427
- if (args.destination) {
3428
- await postAutomatedTurnLimitNoticeForDestination({
3429
- destination: args.destination,
3430
- maxTurns: args.maxTurns,
3431
- nowMs: args.nowMs,
3432
- resumeIn: "channel",
3433
- scope: { kind: "destination", destination: args.destination },
3434
- threadTs: args.threadTs
3435
- });
3436
- return;
3437
- }
3438
3329
  await postAutomatedTurnLimitNoticeForConversation({
3439
3330
  conversationId: args.conversationId,
3440
3331
  maxTurns: args.maxTurns,
3441
3332
  nowMs: args.nowMs,
3442
- resumeIn: args.update.resumeIn,
3443
- scope: {
3444
- kind: "conversation",
3445
- conversationId: args.conversationId
3446
- }
3333
+ threadTs: args.threadTs
3447
3334
  });
3448
3335
  }
3449
3336
 
@@ -3588,12 +3475,9 @@ function createResourceEventInboundMessage(input) {
3588
3475
  async function enqueueResourceEventNotification(args) {
3589
3476
  const maxTurns = botConfig.maxConsecutiveAutomatedTurns;
3590
3477
  const decision = await admitAutomatedTurn({
3478
+ conversationId: args.subscription.conversationId,
3591
3479
  maxTurns,
3592
3480
  nowMs: args.event.occurredAtMs,
3593
- scope: {
3594
- kind: "conversation",
3595
- conversationId: args.subscription.conversationId
3596
- },
3597
3481
  state: args.state
3598
3482
  });
3599
3483
  if (decision.status === "paused") {
@@ -3608,12 +3492,7 @@ async function enqueueResourceEventNotification(args) {
3608
3492
  await postAutomatedTurnLimitNoticeForConversation({
3609
3493
  conversationId: args.subscription.conversationId,
3610
3494
  maxTurns,
3611
- nowMs: args.event.occurredAtMs,
3612
- resumeIn: "thread",
3613
- scope: {
3614
- kind: "conversation",
3615
- conversationId: args.subscription.conversationId
3616
- }
3495
+ nowMs: args.event.occurredAtMs
3617
3496
  });
3618
3497
  }
3619
3498
  return { status: "duplicate" };
@@ -20374,9 +20253,7 @@ export {
20374
20253
  normalizeSandboxEgressTracePropagationDomains,
20375
20254
  shouldPropagateSandboxEgressTrace,
20376
20255
  resolveSandboxEgressProviderForHost,
20377
- admitAutomatedTurn,
20378
20256
  recordFinishedTurnForAutomatedLimit,
20379
- postAutomatedTurnLimitNoticeForDestination,
20380
20257
  maybePostAutomatedTurnLimitNotice,
20381
20258
  renderTaskInput,
20382
20259
  RESOURCE_EVENT_MESSAGE_AUTHOR,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ConversationTurnLifecycleService
3
- } from "./chunk-VSOO3Y6M.js";
3
+ } from "./chunk-5MMQLB2B.js";
4
4
  import {
5
5
  runAgentWithTimeout
6
- } from "./chunk-RFNMWONZ.js";
6
+ } from "./chunk-LIK4T6CF.js";
7
7
  import {
8
8
  getConversationEventStore
9
- } from "./chunk-XNXKRWWI.js";
9
+ } from "./chunk-5GWV7SXF.js";
10
10
 
11
11
  // src/chat/runtime/turn-execution.ts
12
12
  var AgentRunError = class extends Error {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChatConfig
3
- } from "./chunk-5XSEOJPC.js";
3
+ } from "./chunk-BR5GNDPS.js";
4
4
 
5
5
  // src/chat/state/adapter.ts
6
6
  import { createMemoryState } from "@chat-adapter/state-memory";
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.196.0",
4
+ version: "0.197.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"
@@ -2,16 +2,16 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-QAINJHI4.js";
5
+ } from "./chunk-4USCVHQZ.js";
6
6
  import {
7
7
  clearPendingAuth,
8
8
  markTurnClosed,
9
9
  markTurnCompleted
10
- } from "./chunk-DFWJJOW3.js";
10
+ } from "./chunk-YC5CFKME.js";
11
11
  import {
12
12
  hydrateConversationMessages,
13
13
  markConversationMessage
14
- } from "./chunk-6LQNW2CJ.js";
14
+ } from "./chunk-LMTHFU5D.js";
15
15
  import {
16
16
  buildDeterministicTurnId
17
17
  } from "./chunk-DA2KGZZI.js";
@@ -20,13 +20,13 @@ import {
20
20
  findProviderError,
21
21
  getProviderErrorAttributes,
22
22
  getProviderErrorUserMessage
23
- } from "./chunk-5XSEOJPC.js";
23
+ } from "./chunk-BR5GNDPS.js";
24
24
  import {
25
25
  parseSlackMessageTs
26
26
  } from "./chunk-N7TMSOZH.js";
27
27
  import {
28
28
  buildTurnFailureResponse
29
- } from "./chunk-CTS72G4B.js";
29
+ } from "./chunk-7ENMKNEK.js";
30
30
 
31
31
  // src/chat/runtime/delivered-turn-state.ts
32
32
  function buildDeliveredTurnStatePatch(args) {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AgentRunError,
3
3
  executeTurn
4
- } from "./chunk-KJGH3KWA.js";
4
+ } from "./chunk-O5RG7SKU.js";
5
5
  import {
6
6
  ConversationTurnLifecycleService
7
- } from "./chunk-VSOO3Y6M.js";
7
+ } from "./chunk-5MMQLB2B.js";
8
8
  import {
9
9
  getPersistedSandboxState,
10
10
  getPersistedThreadState,
11
11
  persistThreadStateById
12
- } from "./chunk-QAINJHI4.js";
12
+ } from "./chunk-4USCVHQZ.js";
13
13
  import {
14
14
  AgentInvocationBusyError,
15
15
  AgentInvocationLimitError,
@@ -18,32 +18,32 @@ import {
18
18
  agentBindingSchema,
19
19
  agentInvocationSchema,
20
20
  createAgentInvocationSchema
21
- } from "./chunk-CNI74T7U.js";
21
+ } from "./chunk-DBTI74IT.js";
22
22
  import {
23
23
  TurnInputCommitLostError,
24
24
  getAssistantReplyText,
25
25
  getConversationTurnBoundaryError,
26
26
  isTurnInputCommitLostError
27
- } from "./chunk-DFWJJOW3.js";
27
+ } from "./chunk-YC5CFKME.js";
28
28
  import {
29
29
  failTurnRecord,
30
30
  getTerminalAssistantMessages,
31
31
  getTurnRecord,
32
32
  openConversationProjection,
33
33
  saveTurnCheckpoint
34
- } from "./chunk-6LQNW2CJ.js";
34
+ } from "./chunk-LMTHFU5D.js";
35
35
  import {
36
36
  appendAndEnqueueInboundMessage
37
- } from "./chunk-S74KAE77.js";
37
+ } from "./chunk-IGSAXSM7.js";
38
38
  import {
39
39
  getConversationEventStore,
40
40
  getConversationStore,
41
41
  getSqlExecutor
42
- } from "./chunk-XNXKRWWI.js";
42
+ } from "./chunk-5GWV7SXF.js";
43
43
  import {
44
44
  juniorAgentBindings,
45
45
  juniorAgentInvocations
46
- } from "./chunk-PIZJBSGZ.js";
46
+ } from "./chunk-6ZQ3CE6X.js";
47
47
 
48
48
  // src/chat/agent-invocations/work.ts
49
49
  import { z } from "zod";