@sentry/junior 0.192.0 → 0.194.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 (97) hide show
  1. package/dist/{agent-hooks-3JY76L5X.js → agent-hooks-IDX764FD.js} +11 -11
  2. package/dist/api/conversations/aggregate.d.ts +2 -0
  3. package/dist/api/conversations/list.d.ts +1 -1
  4. package/dist/api/conversations/projection.d.ts +1 -1
  5. package/dist/api/locations/detail.d.ts +1 -1
  6. package/dist/api/schema/conversation.d.ts +3 -3
  7. package/dist/api/schema/location.d.ts +1 -1
  8. package/dist/api/schema/person.d.ts +1 -1
  9. package/dist/api/schema/task.d.ts +71 -8
  10. package/dist/api/schema.d.ts +2 -2
  11. package/dist/api/schema.js +3 -1
  12. package/dist/api.js +106 -187
  13. package/dist/app.js +55 -83
  14. package/dist/{catalog-runtime-5JVLWXRY.js → catalog-runtime-MICXEBLK.js} +4 -4
  15. package/dist/chat/agent/prompt.d.ts +1 -1
  16. package/dist/chat/agent/resume.d.ts +2 -0
  17. package/dist/chat/agent-dispatch/types.d.ts +2 -1
  18. package/dist/chat/agent-dispatch/validation.d.ts +1 -1
  19. package/dist/chat/agent-invocations/types.d.ts +24 -28
  20. package/dist/chat/config.d.ts +1 -0
  21. package/dist/chat/conversations/history.d.ts +4 -2
  22. package/dist/chat/event-tasks/tool-support.d.ts +10 -1
  23. package/dist/chat/plugins/agent-hooks.d.ts +2 -2
  24. package/dist/chat/prompt.d.ts +4 -5
  25. package/dist/chat/services/turn-limit.d.ts +11 -1
  26. package/dist/chat/services/turn-session-routing.d.ts +4 -3
  27. package/dist/chat/slack/{source-link.d.ts → location-url.d.ts} +1 -1
  28. package/dist/chat/slack/tool-support/context.d.ts +3 -6
  29. package/dist/chat/source.d.ts +4 -6
  30. package/dist/chat/task-execution/checkpoint.d.ts +2 -0
  31. package/dist/chat/task-execution/turn-cursor.d.ts +3 -0
  32. package/dist/chat/tasks/execution-stats.d.ts +13 -1
  33. package/dist/chat/tools/delete-event-task.d.ts +1 -1
  34. package/dist/chat/tools/types.d.ts +10 -9
  35. package/dist/chat/tools/update-event-task.d.ts +1 -1
  36. package/dist/chat/usage.d.ts +4 -0
  37. package/dist/{chunk-YRWGJ5OO.js → chunk-2NL3Y47F.js} +5 -5
  38. package/dist/{chunk-BGLMT6KP.js → chunk-53IEEFFP.js} +3 -3
  39. package/dist/{chunk-PXUBRZBU.js → chunk-6H2MKVV5.js} +1 -1
  40. package/dist/{chunk-47JFLZSF.js → chunk-73JEAQRT.js} +4 -4
  41. package/dist/{chunk-6LX6KV5C.js → chunk-7ANA7PBB.js} +3 -3
  42. package/dist/{chunk-AKR6W7VV.js → chunk-ADEACKAH.js} +82 -69
  43. package/dist/{chunk-YE6DVM43.js → chunk-AWZS5SVX.js} +8 -8
  44. package/dist/{chunk-BUTAWPUV.js → chunk-CCTYK5RH.js} +37 -31
  45. package/dist/{chunk-RWBZZMW6.js → chunk-CFGBKPWQ.js} +3 -3
  46. package/dist/{chunk-G4E5WIRL.js → chunk-E53C73ML.js} +4 -4
  47. package/dist/{chunk-3UJSII43.js → chunk-ELCYG6UU.js} +3 -3
  48. package/dist/{chunk-SSR6YBWW.js → chunk-ENWIHU54.js} +11 -7
  49. package/dist/{chunk-4CCQZHD3.js → chunk-F2KSURTJ.js} +11 -11
  50. package/dist/{chunk-7XO7PTZE.js → chunk-G35QGPO2.js} +1 -1
  51. package/dist/{chunk-4B4DQGOM.js → chunk-G4RARFNT.js} +101 -66
  52. package/dist/{chunk-Z4DNJI5F.js → chunk-GY5SEFVL.js} +5 -5
  53. package/dist/{chunk-KR5F3QSP.js → chunk-H4DCWLTR.js} +8 -8
  54. package/dist/{chunk-ARSUYYQG.js → chunk-IME5OW4Y.js} +1 -1
  55. package/dist/{chunk-3O2NXVGB.js → chunk-INTBMGNX.js} +23 -25
  56. package/dist/{chunk-4WIA45WD.js → chunk-IOGDKPVU.js} +1 -1
  57. package/dist/{chunk-EYNUOZCN.js → chunk-JOI3DHML.js} +1 -1
  58. package/dist/{chunk-5V4BAUCH.js → chunk-KNIAWMBU.js} +1 -1
  59. package/dist/{chunk-ITTEDZGY.js → chunk-NPO24LAN.js} +32 -25
  60. package/dist/{chunk-SZ2O3CGS.js → chunk-NWWDFHXP.js} +1 -1
  61. package/dist/{chunk-VF3EDS7P.js → chunk-OEQOAONV.js} +60 -29
  62. package/dist/{chunk-PYVGXGKC.js → chunk-P2P6MUQ4.js} +2 -2
  63. package/dist/{chunk-PXP2M32M.js → chunk-QMEF4Z7R.js} +6 -7
  64. package/dist/{chunk-OBN7UEQJ.js → chunk-RFE7DCZK.js} +24 -2
  65. package/dist/{chunk-6FCKJDKS.js → chunk-S7GX44BU.js} +1 -1
  66. package/dist/{chunk-4Z7B5WVV.js → chunk-U76RWMFR.js} +4 -2
  67. package/dist/{chunk-LRTEMMCZ.js → chunk-V4HXV5MY.js} +1 -1
  68. package/dist/{chunk-MB2CTEPD.js → chunk-VOB2DKO6.js} +174 -34
  69. package/dist/{chunk-EIYOABL4.js → chunk-WMJS5DDV.js} +12 -8
  70. package/dist/{chunk-FGYWKKTJ.js → chunk-WWXJUURQ.js} +1 -1
  71. package/dist/{chunk-3ADPXQBL.js → chunk-X76JVHQ4.js} +1 -1
  72. package/dist/{chunk-IBO4YFFZ.js → chunk-XLWZRHX5.js} +1 -1
  73. package/dist/{chunk-H5Q2T5VC.js → chunk-XND3J6AT.js} +1 -1
  74. package/dist/{chunk-4AFSQJD6.js → chunk-XRDSML3K.js} +3 -4
  75. package/dist/{chunk-EYIMZY5O.js → chunk-YSLIB7ER.js} +18 -3
  76. package/dist/cli/chat.js +33 -33
  77. package/dist/cli/check.js +5 -5
  78. package/dist/cli/plugins.js +12 -12
  79. package/dist/cli/snapshot-create.js +9 -9
  80. package/dist/cli/upgrade.js +6 -6
  81. package/dist/db/schema/agent-invocations.d.ts +16 -0
  82. package/dist/db/schema.d.ts +16 -0
  83. package/dist/{db-LRM6AP66.js → db-3IEVINAY.js} +6 -6
  84. package/dist/instrumentation.js +3 -3
  85. package/dist/nitro.js +6 -6
  86. package/dist/{oauth-callback-server-BKCDVYVH.js → oauth-callback-server-N7L2BB4L.js} +29 -29
  87. package/dist/{runner-RUXGS3E6.js → runner-PTTZV3WU.js} +21 -21
  88. package/dist/{skills-DXP2RCJF.js → skills-POMWS2RR.js} +5 -5
  89. package/dist/spawn-R75MXXKE.js +42 -0
  90. package/dist/task-runner-OQLRHADB.js +36 -0
  91. package/dist/{validation-F4KYLIF2.js → validation-U6LOMXR7.js} +5 -5
  92. package/dist/version.js +1 -1
  93. package/dist/{work-UUNMNSML.js → work-FHA3BS4L.js} +21 -21
  94. package/dist/{worker-PMIJ5NLD.js → worker-GR4UNVVP.js} +10 -10
  95. package/package.json +5 -5
  96. package/dist/spawn-HH7GH7XT.js +0 -42
  97. package/dist/task-runner-H5I7R3LJ.js +0 -36
package/dist/app.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  processConversationWork
3
- } from "./chunk-47JFLZSF.js";
3
+ } from "./chunk-73JEAQRT.js";
4
4
  import {
5
5
  bindSpawnAgent
6
- } from "./chunk-4AFSQJD6.js";
6
+ } from "./chunk-XRDSML3K.js";
7
7
  import {
8
8
  createAgentInvocationWorker,
9
9
  enqueueAgentInvocation,
10
10
  listPendingAgentInvocationMailboxAppends,
11
11
  resolveAgentInvocationId
12
- } from "./chunk-4CCQZHD3.js";
12
+ } from "./chunk-F2KSURTJ.js";
13
13
  import {
14
14
  GET as GET2,
15
15
  GET2 as GET3,
@@ -37,12 +37,12 @@ import {
37
37
  startProcessingReaction,
38
38
  stripLeadingBotMention,
39
39
  wakePausedTurn
40
- } from "./chunk-3O2NXVGB.js";
40
+ } from "./chunk-INTBMGNX.js";
41
41
  import "./chunk-FA6POGLH.js";
42
42
  import {
43
43
  AgentRunError,
44
44
  executeTurn
45
- } from "./chunk-BGLMT6KP.js";
45
+ } from "./chunk-53IEEFFP.js";
46
46
  import {
47
47
  buildDeliveredTurnStatePatch,
48
48
  completeAuthPauseTurn,
@@ -53,7 +53,7 @@ import {
53
53
  getTurnUserSlackMessageTs,
54
54
  persistAuthPauseTurnState,
55
55
  requireTurnFailureEventId
56
- } from "./chunk-YRWGJ5OO.js";
56
+ } from "./chunk-2NL3Y47F.js";
57
57
  import {
58
58
  claimDispatchMailboxAppend,
59
59
  confirmDispatchMailboxAppend,
@@ -73,11 +73,11 @@ import {
73
73
  processPluginTask,
74
74
  resolveTurnSessionRouting,
75
75
  scheduleSessionCompletedPluginTasks
76
- } from "./chunk-ITTEDZGY.js";
76
+ } from "./chunk-NPO24LAN.js";
77
77
  import {
78
78
  ConversationTurnLifecycleService,
79
79
  getTurnLifecycle
80
- } from "./chunk-PXUBRZBU.js";
80
+ } from "./chunk-6H2MKVV5.js";
81
81
  import {
82
82
  coerceThreadConversationState,
83
83
  getLocationConfigurationService,
@@ -86,7 +86,7 @@ import {
86
86
  persistThreadRuntimeState,
87
87
  persistThreadState,
88
88
  persistThreadStateById
89
- } from "./chunk-Z4DNJI5F.js";
89
+ } from "./chunk-GY5SEFVL.js";
90
90
  import {
91
91
  GET,
92
92
  appendAndEnqueueWebMessage,
@@ -101,24 +101,24 @@ import {
101
101
  resolveSlackChannelTypeFromMessage,
102
102
  resolveSlackConversationContext,
103
103
  webActorFromEmail
104
- } from "./chunk-KR5F3QSP.js";
104
+ } from "./chunk-H4DCWLTR.js";
105
105
  import {
106
106
  createWebAuthorization,
107
107
  deleteWebAuthorization
108
- } from "./chunk-H5Q2T5VC.js";
108
+ } from "./chunk-XND3J6AT.js";
109
109
  import {
110
110
  recordTaskExecution
111
- } from "./chunk-MB2CTEPD.js";
111
+ } from "./chunk-VOB2DKO6.js";
112
112
  import "./chunk-RC745GGZ.js";
113
113
  import {
114
114
  createVercelPluginTaskCallback,
115
115
  queueCallback,
116
116
  registerVercelPluginTaskDevConsumer
117
- } from "./chunk-RWBZZMW6.js";
117
+ } from "./chunk-CFGBKPWQ.js";
118
118
  import {
119
119
  validatePluginEgressCredentialHooks,
120
120
  validatePluginRegistrations
121
- } from "./chunk-5V4BAUCH.js";
121
+ } from "./chunk-KNIAWMBU.js";
122
122
  import {
123
123
  defineJuniorPlugins,
124
124
  pluginCatalogConfigFromEnv,
@@ -158,11 +158,11 @@ import {
158
158
  shouldEmitDevAgentTrace,
159
159
  shouldPropagateSandboxEgressTrace,
160
160
  unpublishedArtifactHeaders
161
- } from "./chunk-4B4DQGOM.js";
161
+ } from "./chunk-G4RARFNT.js";
162
162
  import {
163
163
  AuthorizationFlowDisabledError,
164
164
  PluginCredentialFailureError
165
- } from "./chunk-PXP2M32M.js";
165
+ } from "./chunk-QMEF4Z7R.js";
166
166
  import "./chunk-6Y5B5PEX.js";
167
167
  import "./chunk-DIB4GX3G.js";
168
168
  import {
@@ -170,14 +170,14 @@ import {
170
170
  deleteMcpAuthSessionsForUserProvider,
171
171
  deleteMcpServerSessionId,
172
172
  deleteMcpStoredOAuthCredentials
173
- } from "./chunk-YE6DVM43.js";
173
+ } from "./chunk-AWZS5SVX.js";
174
174
  import {
175
175
  RetryableDeliveryError,
176
176
  createAgentRunner,
177
177
  formatProviderLabel,
178
178
  postSlackMessage,
179
179
  startOAuthFlow
180
- } from "./chunk-SSR6YBWW.js";
180
+ } from "./chunk-ENWIHU54.js";
181
181
  import {
182
182
  ConversationTurnBoundaryError,
183
183
  CooperativeTurnYieldError,
@@ -193,11 +193,12 @@ import {
193
193
  markTurnCompleted,
194
194
  markTurnFailed,
195
195
  startActiveTurn
196
- } from "./chunk-7XO7PTZE.js";
196
+ } from "./chunk-G35QGPO2.js";
197
197
  import {
198
198
  abandonTurnRecord,
199
199
  appendThreadContextMessages,
200
200
  buildConversationContext,
201
+ buildTurnErrorResponse,
201
202
  commitAcceptedReply,
202
203
  commitMessages,
203
204
  completeTurnRecord,
@@ -229,7 +230,7 @@ import {
229
230
  trimTrailingAssistantMessages,
230
231
  turnHasReply,
231
232
  upsertConversationMessage
232
- } from "./chunk-VF3EDS7P.js";
233
+ } from "./chunk-OEQOAONV.js";
233
234
  import {
234
235
  getExperimentalFeatures,
235
236
  isExperimentalFeatureEnabled,
@@ -249,10 +250,10 @@ import {
249
250
  scheduledRunId,
250
251
  scheduledRunSchema,
251
252
  withScheduledTaskLock
252
- } from "./chunk-EIYOABL4.js";
253
+ } from "./chunk-WMJS5DDV.js";
253
254
  import {
254
255
  parseSlackThreadId
255
- } from "./chunk-4WIA45WD.js";
256
+ } from "./chunk-IOGDKPVU.js";
256
257
  import {
257
258
  CONVERSATION_WORK_STALE_ENQUEUE_MS,
258
259
  appendAndEnqueueInboundMessage,
@@ -267,16 +268,16 @@ import {
267
268
  removeActiveConversation,
268
269
  requestConversationWork,
269
270
  stopConversationWork
270
- } from "./chunk-G4E5WIRL.js";
271
+ } from "./chunk-E53C73ML.js";
271
272
  import {
272
273
  buildDeterministicAssistantMessageId,
273
274
  buildDeterministicTurnId
274
275
  } from "./chunk-DA2KGZZI.js";
275
- import "./chunk-OBN7UEQJ.js";
276
+ import "./chunk-RFE7DCZK.js";
276
277
  import {
277
278
  getSandboxResourceConfig,
278
279
  setSandboxResourceConfig
279
- } from "./chunk-3UJSII43.js";
280
+ } from "./chunk-ELCYG6UU.js";
280
281
  import "./chunk-PDO5BLNM.js";
281
282
  import "./chunk-UIE3R5XU.js";
282
283
  import {
@@ -285,7 +286,7 @@ import {
285
286
  } from "./chunk-X6GDDWQH.js";
286
287
  import {
287
288
  getTurnRequestDeadline
288
- } from "./chunk-SZ2O3CGS.js";
289
+ } from "./chunk-NWWDFHXP.js";
289
290
  import {
290
291
  getVercelConversationWorkQueue,
291
292
  resolveConversationWorkQueueTopic,
@@ -321,7 +322,7 @@ import {
321
322
  verifyEventTaskCredentialSubject,
322
323
  verifyScheduledTaskCredentialSubject,
323
324
  verifySlackDirectCredentialSubject
324
- } from "./chunk-BUTAWPUV.js";
325
+ } from "./chunk-CCTYK5RH.js";
325
326
  import "./chunk-3Y47VMHV.js";
326
327
  import {
327
328
  createSlackDestination,
@@ -333,7 +334,7 @@ import {
333
334
  requireSlackDestination,
334
335
  withConversationEventLock,
335
336
  withConversationMutationLock
336
- } from "./chunk-AKR6W7VV.js";
337
+ } from "./chunk-ADEACKAH.js";
337
338
  import {
338
339
  juniorAgentBindings,
339
340
  juniorAgentInvocations,
@@ -341,13 +342,13 @@ import {
341
342
  juniorConversations,
342
343
  juniorSchedulerRuns,
343
344
  juniorSchedulerTasks
344
- } from "./chunk-IBO4YFFZ.js";
345
- import "./chunk-6LX6KV5C.js";
345
+ } from "./chunk-XLWZRHX5.js";
346
+ import "./chunk-7ANA7PBB.js";
346
347
  import {
347
348
  acquireActiveLock,
348
349
  getStateAdapter,
349
350
  withActiveLock
350
- } from "./chunk-LRTEMMCZ.js";
351
+ } from "./chunk-V4HXV5MY.js";
351
352
  import {
352
353
  instructionProvenanceFor
353
354
  } from "./chunk-GFBR4S3Q.js";
@@ -369,17 +370,17 @@ import {
369
370
  isProviderRetryError,
370
371
  setProfiles,
371
372
  setSlackReactionConfig
372
- } from "./chunk-4Z7B5WVV.js";
373
+ } from "./chunk-U76RWMFR.js";
373
374
  import {
374
375
  defaultModelId,
375
376
  modelIdForProfile
376
377
  } from "./chunk-D4YV5TDV.js";
377
- import "./chunk-EYNUOZCN.js";
378
- import "./chunk-PYVGXGKC.js";
378
+ import "./chunk-JOI3DHML.js";
379
+ import "./chunk-P2P6MUQ4.js";
379
380
  import {
380
381
  pluginCatalogRuntime
381
- } from "./chunk-FGYWKKTJ.js";
382
- import "./chunk-6FCKJDKS.js";
382
+ } from "./chunk-WWXJUURQ.js";
383
+ import "./chunk-S7GX44BU.js";
383
384
  import {
384
385
  credentialContextForActor
385
386
  } from "./chunk-CEMMLV5L.js";
@@ -415,13 +416,13 @@ import {
415
416
  withContext,
416
417
  withLogContext,
417
418
  withSpan
418
- } from "./chunk-3ADPXQBL.js";
419
+ } from "./chunk-X76JVHQ4.js";
419
420
  import {
420
421
  continueTrace
421
422
  } from "./chunk-PEQXYSSE.js";
422
423
  import {
423
424
  JUNIOR_VERSION
424
- } from "./chunk-ARSUYYQG.js";
425
+ } from "./chunk-IME5OW4Y.js";
425
426
 
426
427
  // src/app.ts
427
428
  import { createRequire } from "module";
@@ -551,11 +552,6 @@ async function recoverConversationWork(args) {
551
552
  return result;
552
553
  }
553
554
 
554
- // src/chat/scheduled-tasks/heartbeat.ts
555
- import {
556
- createSlackSource
557
- } from "@sentry/junior-plugin-api";
558
-
559
555
  // src/chat/agent-dispatch/work.ts
560
556
  import { z } from "zod";
561
557
  var agentDispatchMailboxMetadataSchema = z.object({
@@ -935,23 +931,6 @@ function dispatchOptionsErrorMessage(issues) {
935
931
  if (hasIssueUnderPath(issues, ["destination", "channelId"])) {
936
932
  return "Dispatch destination channelId must be a Slack channel id";
937
933
  }
938
- if (issues.some(
939
- (issue) => issue.code === "unrecognized_keys" && issue.path[0] === "source"
940
- )) {
941
- return "Dispatch source must not include unknown fields";
942
- }
943
- if (hasIssueAtPath(issues, ["source"])) {
944
- return "Dispatch Source kind is required";
945
- }
946
- if (hasIssueUnderPath(issues, ["source", "teamId"])) {
947
- return "Dispatch source teamId must be a Slack team id";
948
- }
949
- if (hasIssueUnderPath(issues, ["source", "channelId"])) {
950
- return "Dispatch source channelId must be a Slack channel id";
951
- }
952
- if (hasIssueUnderPath(issues, ["source", "conversationId"])) {
953
- return "Dispatch source conversationId must be a local conversation id";
954
- }
955
934
  if (hasIssueUnderPath(issues, ["idempotencyKey"])) {
956
935
  const tooLong = issues.some(
957
936
  (issue) => issue.path[0] === "idempotencyKey" && issue.code === "too_big"
@@ -1030,7 +1009,7 @@ var MAX_DISPATCHES_PER_HEARTBEAT = 25;
1030
1009
  function bindDispatchCredentialSubject(options, plugin) {
1031
1010
  const { credentialSubject, ...baseOptions } = options;
1032
1011
  if (!credentialSubject) {
1033
- return baseOptions;
1012
+ return { ...baseOptions, source: { kind: "plugin_dispatch" } };
1034
1013
  }
1035
1014
  if ("binding" in credentialSubject) {
1036
1015
  throw new Error("Dispatch credentialSubject binding is runtime-owned");
@@ -1048,7 +1027,8 @@ function bindDispatchCredentialSubject(options, plugin) {
1048
1027
  }
1049
1028
  return {
1050
1029
  ...baseOptions,
1051
- credentialSubject: boundSubject
1030
+ credentialSubject: boundSubject,
1031
+ source: { kind: "plugin_dispatch" }
1052
1032
  };
1053
1033
  }
1054
1034
  async function dispatch(args) {
@@ -1119,7 +1099,8 @@ async function dispatchEventTask(args) {
1119
1099
  }
1120
1100
  const options = {
1121
1101
  ...unboundOptions,
1122
- ...boundSubject ? { credentialSubject: boundSubject } : void 0
1102
+ ...boundSubject ? { credentialSubject: boundSubject } : void 0,
1103
+ source: { kind: "event_task" }
1123
1104
  };
1124
1105
  return await dispatch({
1125
1106
  conversationWorkQueue: args.conversationWorkQueue,
@@ -1141,7 +1122,8 @@ async function dispatchScheduledTask(args) {
1141
1122
  }
1142
1123
  const options = {
1143
1124
  ...unboundOptions,
1144
- ...boundSubject ? { credentialSubject: boundSubject } : void 0
1125
+ ...boundSubject ? { credentialSubject: boundSubject } : void 0,
1126
+ source: { kind: "scheduled_task" }
1145
1127
  };
1146
1128
  return await dispatch({
1147
1129
  conversationWorkQueue: args.conversationWorkQueue,
@@ -1575,13 +1557,6 @@ function replyAttribution(task) {
1575
1557
  detail: `Every ${recurrence.interval} ${frequency.unit}s`
1576
1558
  };
1577
1559
  }
1578
- function dispatchSource(task) {
1579
- return createSlackSource({
1580
- teamId: task.destination.teamId,
1581
- channelId: task.destination.channelId,
1582
- visibility: task.conversationAccess.visibility
1583
- });
1584
- }
1585
1560
  function shouldSkipRun(task, run) {
1586
1561
  if (task.status === "deleted") {
1587
1562
  return `Scheduled task ${task.id} was deleted before the run started.`;
@@ -1835,8 +1810,7 @@ async function runScheduledTaskHeartbeat(args) {
1835
1810
  destinationVisibility: task.conversationAccess.visibility,
1836
1811
  input: buildDispatchInput(task),
1837
1812
  metadata,
1838
- replyAttribution: replyAttribution(task),
1839
- source: dispatchSource(task)
1813
+ replyAttribution: replyAttribution(task)
1840
1814
  }
1841
1815
  });
1842
1816
  } catch (error) {
@@ -5044,7 +5018,9 @@ function createSlackTurnRuntime(deps) {
5044
5018
  };
5045
5019
  const postFallbackErrorReplyWithLogging = async (args) => {
5046
5020
  try {
5047
- await args.thread.post(buildTurnFailureResponse(args.eventId));
5021
+ await args.thread.post(
5022
+ buildTurnErrorResponse(args.error, args.eventId)
5023
+ );
5048
5024
  } catch (postError) {
5049
5025
  logException(postError, args.postFailureEventName, {
5050
5026
  "app.slack.reply_stage": "error_fallback_post",
@@ -5346,6 +5322,7 @@ function createSlackTurnRuntime(deps) {
5346
5322
  await postFallbackErrorReplyWithLogging({
5347
5323
  thread,
5348
5324
  eventId,
5325
+ error: failureCause,
5349
5326
  postFailureEventName: "mention.handler.failure_reply_post.failed"
5350
5327
  });
5351
5328
  if (lifecycleError) throw lifecycleError;
@@ -5634,6 +5611,7 @@ function createSlackTurnRuntime(deps) {
5634
5611
  await postFallbackErrorReplyWithLogging({
5635
5612
  thread,
5636
5613
  eventId,
5614
+ error: failureCause,
5637
5615
  postFailureEventName: "subscribed_message.handler.failure_reply_post.failed"
5638
5616
  });
5639
5617
  if (lifecycleError) throw lifecycleError;
@@ -6191,7 +6169,7 @@ function createJuniorRuntimeServices(overrides = {}) {
6191
6169
  }
6192
6170
 
6193
6171
  // src/chat/providers/slack/turn.ts
6194
- import { createSlackSource as createSlackSource2 } from "@sentry/junior-plugin-api";
6172
+ import { createSlackSource } from "@sentry/junior-plugin-api";
6195
6173
 
6196
6174
  // src/chat/slack/message/identity.ts
6197
6175
  function getMessageTimestamp(message) {
@@ -6490,7 +6468,7 @@ function createSlackTurn(deps) {
6490
6468
  const threadTs = getThreadTs(threadId) ?? assistantThreadContext?.threadTs;
6491
6469
  const messageTs = getMessageTs(message);
6492
6470
  const teamId = destination.teamId;
6493
- const source = options.execution?.source ?? createSlackSource2({
6471
+ const source = options.execution?.source ?? createSlackSource({
6494
6472
  channelId: channelId ?? destination.channelId,
6495
6473
  messageTs,
6496
6474
  teamId,
@@ -9506,7 +9484,6 @@ async function publicArtifactGET(args) {
9506
9484
  // src/chat/event-tasks/ingest.ts
9507
9485
  import { createHash as createHash2 } from "crypto";
9508
9486
  import {
9509
- createSlackSource as createSlackSource3,
9510
9487
  RESOURCE_EVENT_SUMMARY_MAX_LENGTH,
9511
9488
  RESOURCE_EVENT_TEXT_MAX_LENGTH,
9512
9489
  resourceEventSchema
@@ -9569,12 +9546,7 @@ async function ingestEventTasks(input, options) {
9569
9546
  destinationVisibility: task.destinationVisibility,
9570
9547
  input: eventInput(task, event),
9571
9548
  metadata: { eventTaskId: task.id },
9572
- replyAttribution: replyAttribution2(task),
9573
- source: createSlackSource3({
9574
- teamId: task.destination.teamId,
9575
- channelId: task.destination.channelId,
9576
- visibility: task.destinationVisibility
9577
- })
9549
+ replyAttribution: replyAttribution2(task)
9578
9550
  }
9579
9551
  });
9580
9552
  if (dispatch2.status === "created") {
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-FGYWKKTJ.js";
4
- import "./chunk-6FCKJDKS.js";
3
+ } from "./chunk-WWXJUURQ.js";
4
+ import "./chunk-S7GX44BU.js";
5
5
  import "./chunk-CEMMLV5L.js";
6
6
  import "./chunk-N7TMSOZH.js";
7
7
  import "./chunk-DWPN6SCH.js";
8
8
  import "./chunk-TXKUKMVO.js";
9
- import "./chunk-3ADPXQBL.js";
9
+ import "./chunk-X76JVHQ4.js";
10
10
  import "./chunk-PEQXYSSE.js";
11
- import "./chunk-ARSUYYQG.js";
11
+ import "./chunk-IME5OW4Y.js";
12
12
  export {
13
13
  pluginCatalogRuntime
14
14
  };
@@ -73,7 +73,7 @@ export declare function assemblePrompt(args: {
73
73
  explicitSkill: Skill | null;
74
74
  priorPiMessages?: PiMessage[];
75
75
  resumedFromSessionRecord: boolean;
76
- run: Pick<AgentRun, "source" | "destination" | "dispatch" | "slackConversation">;
76
+ run: Pick<AgentRun, "source" | "destination" | "dispatch" | "slackConversation" | "location" | "delivery">;
77
77
  spanContext: LogContext;
78
78
  turnId: string;
79
79
  toolGuidance: Array<{
@@ -38,6 +38,8 @@ export declare function createResumeState(args: ResumeStateArgs): {
38
38
  readonly timedOut: boolean;
39
39
  setTurnStartMessageIndex(index: number | undefined): void;
40
40
  setBeforeMessageCount(count: number): void;
41
+ /** Admit one tool call against the durable turn total, or throw the limit. */
42
+ admitToolCall(): void;
41
43
  setTurnContexts(contexts: PluginTurnContext[]): void;
42
44
  /** Use an already committed boundary as the resume baseline. */
43
45
  adoptCommittedBoundary(messages: PiMessage[]): void;
@@ -1,4 +1,4 @@
1
- import type { DispatchOptions, DestinationVisibility, ReplyAttribution, Source, SlackDestination } from "@sentry/junior-plugin-api";
1
+ import type { DispatchOptions, DestinationVisibility, EventTaskSource, PluginDispatchSource, ReplyAttribution, ScheduledTaskSource, Source, SlackDestination } from "@sentry/junior-plugin-api";
2
2
  import type { CredentialContext, CredentialSubject, CredentialSystemActor } from "@/chat/credentials/context";
3
3
  import type { AgentDispatch } from "@/chat/agent/types";
4
4
  import type { AgentTurnSurface } from "@/chat/task-execution/checkpoint";
@@ -9,6 +9,7 @@ export type SlackDispatchOptions = Omit<DispatchOptions, "destination"> & {
9
9
  };
10
10
  export interface BoundDispatchOptions extends Omit<SlackDispatchOptions, "credentialSubject"> {
11
11
  credentialSubject?: CredentialSubject;
12
+ source: EventTaskSource | PluginDispatchSource | ScheduledTaskSource;
12
13
  }
13
14
  export interface DispatchRecord {
14
15
  actor: CredentialSystemActor;
@@ -2,4 +2,4 @@ import type { BoundDispatchOptions, SlackDispatchOptions } from "./types";
2
2
  /** Validate plugin-provided dispatch options before core persists them. */
3
3
  export declare function validateDispatchOptions(options: unknown): asserts options is SlackDispatchOptions;
4
4
  /** Verify runtime-owned access requirements for delegated dispatch credentials. */
5
- export declare function verifyDispatchCredentialSubjectAccess(options: BoundDispatchOptions, plugin: string): Promise<void>;
5
+ export declare function verifyDispatchCredentialSubjectAccess(options: Pick<BoundDispatchOptions, "credentialSubject" | "destination">, plugin: string): Promise<void>;
@@ -126,6 +126,14 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
126
126
  eventType: z.ZodString;
127
127
  identifier: z.ZodString;
128
128
  namespace: z.ZodString;
129
+ }, z.core.$strict>, z.ZodObject<{
130
+ kind: z.ZodLiteral<"scheduled_task">;
131
+ }, z.core.$strict>, z.ZodObject<{
132
+ kind: z.ZodLiteral<"event_task">;
133
+ }, z.core.$strict>, z.ZodObject<{
134
+ kind: z.ZodLiteral<"plugin_dispatch">;
135
+ }, z.core.$strict>, z.ZodObject<{
136
+ kind: z.ZodLiteral<"agent_invocation">;
129
137
  }, z.core.$strict>], "kind">, unknown>;
130
138
  updatedAtMs: z.ZodNumber;
131
139
  status: z.ZodEnum<{
@@ -253,6 +261,14 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
253
261
  eventType: z.ZodString;
254
262
  identifier: z.ZodString;
255
263
  namespace: z.ZodString;
264
+ }, z.core.$strict>, z.ZodObject<{
265
+ kind: z.ZodLiteral<"scheduled_task">;
266
+ }, z.core.$strict>, z.ZodObject<{
267
+ kind: z.ZodLiteral<"event_task">;
268
+ }, z.core.$strict>, z.ZodObject<{
269
+ kind: z.ZodLiteral<"plugin_dispatch">;
270
+ }, z.core.$strict>, z.ZodObject<{
271
+ kind: z.ZodLiteral<"agent_invocation">;
256
272
  }, z.core.$strict>], "kind">, unknown>;
257
273
  updatedAtMs: z.ZodNumber;
258
274
  result: z.ZodString;
@@ -378,6 +394,14 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
378
394
  eventType: z.ZodString;
379
395
  identifier: z.ZodString;
380
396
  namespace: z.ZodString;
397
+ }, z.core.$strict>, z.ZodObject<{
398
+ kind: z.ZodLiteral<"scheduled_task">;
399
+ }, z.core.$strict>, z.ZodObject<{
400
+ kind: z.ZodLiteral<"event_task">;
401
+ }, z.core.$strict>, z.ZodObject<{
402
+ kind: z.ZodLiteral<"plugin_dispatch">;
403
+ }, z.core.$strict>, z.ZodObject<{
404
+ kind: z.ZodLiteral<"agent_invocation">;
381
405
  }, z.core.$strict>], "kind">, unknown>;
382
406
  updatedAtMs: z.ZodNumber;
383
407
  errorMessage: z.ZodString;
@@ -474,34 +498,6 @@ export declare const createAgentInvocationSchema: z.ZodObject<{
474
498
  xhigh: "xhigh";
475
499
  none: "none";
476
500
  }>>;
477
- source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
478
- kind: z.ZodLiteral<"slack">;
479
- teamId: z.ZodString;
480
- channelId: z.ZodString;
481
- visibility: z.ZodEnum<{
482
- private: "private";
483
- public: "public";
484
- }>;
485
- messageTs: z.ZodOptional<z.ZodString>;
486
- threadTs: z.ZodOptional<z.ZodString>;
487
- }, z.core.$strict>, z.ZodObject<{
488
- kind: z.ZodLiteral<"local">;
489
- visibility: z.ZodLiteral<"private">;
490
- conversationId: z.ZodString;
491
- }, z.core.$strict>, z.ZodObject<{
492
- kind: z.ZodLiteral<"web">;
493
- visibility: z.ZodEnum<{
494
- private: "private";
495
- public: "public";
496
- }>;
497
- conversationId: z.ZodString;
498
- }, z.core.$strict>, z.ZodObject<{
499
- kind: z.ZodLiteral<"resource_event">;
500
- eventKey: z.ZodString;
501
- eventType: z.ZodString;
502
- identifier: z.ZodString;
503
- namespace: z.ZodString;
504
- }, z.core.$strict>], "kind">, unknown>;
505
501
  }, z.core.$strict>;
506
502
  export type AgentBinding = z.output<typeof agentBindingSchema>;
507
503
  export type AgentInvocation = z.output<typeof agentInvocationSchema>;
@@ -21,6 +21,7 @@ export interface BotConfig {
21
21
  reasoningLevel?: TurnReasoningLevel;
22
22
  visionModelId?: string;
23
23
  maxSlicesPerTurn: number;
24
+ maxToolCallsPerTurn: number;
24
25
  turnTimeoutMs: number;
25
26
  userName: string;
26
27
  webSearchModelId: string;
@@ -1124,12 +1124,12 @@ export interface ConversationEventPage {
1124
1124
  /** Persist and read the canonical per-conversation event log. */
1125
1125
  export interface ConversationEventStore {
1126
1126
  /**
1127
- * Append events atomically, optionally preserving conversation activity.
1127
+ * Append events atomically and return each event's sequence and history version.
1128
1128
  * Archive clears only for human user activity, not every non-preserve write.
1129
1129
  */
1130
1130
  append(conversationId: string, events: NewConversationEvent[], options?: {
1131
1131
  activity?: "preserve";
1132
- }): Promise<void>;
1132
+ }): Promise<Array<Pick<ConversationEvent, "seq" | "historyVersion">>>;
1133
1133
  /** Replace active model history with a compaction or handoff event. */
1134
1134
  replaceHistory(conversationId: string, replacement: HistoryReplacement): Promise<void>;
1135
1135
  /** One event selected by its retry-stable key across history versions. */
@@ -1138,6 +1138,8 @@ export interface ConversationEventStore {
1138
1138
  loadLatestStructuredEvent(conversationId: string, namespace: string, name: string): Promise<ConversationEvent | undefined>;
1139
1139
  /** Latest durable instruction across history versions. */
1140
1140
  loadLatestInstruction(conversationId: string): Promise<ConversationEvent | undefined>;
1141
+ /** Current model-history version, or zero when no event exists. */
1142
+ loadCurrentHistoryVersion(conversationId: string): Promise<number>;
1141
1143
  /** Events of the current history version in `seq` order. */
1142
1144
  loadCurrentHistory(conversationId: string): Promise<ConversationEvent[]>;
1143
1145
  /** Events in the history version containing `seq`, when it exists. */
@@ -106,7 +106,16 @@ export declare function eventTaskMatchesDestination(task: EventTask, destination
106
106
  channelId: string;
107
107
  teamId: string;
108
108
  }): boolean;
109
- /** Load one task only when it belongs to this Slack channel or DM. */
109
+ /**
110
+ * Return whether the active destination may update or delete this task.
111
+ * Same-destination tasks stay local. Public tasks may be managed by id from
112
+ * another destination in the same workspace.
113
+ */
114
+ export declare function eventTaskIsWritableFrom(task: EventTask, destination: {
115
+ channelId: string;
116
+ teamId: string;
117
+ }): boolean;
118
+ /** Load one task the active destination may update or delete. */
110
119
  export declare function writableEventTask(context: ToolRuntimeContext, id: string): Promise<EventTask>;
111
120
  export declare function eventTaskTriggerAvailable(task: EventTask, catalog: ResourceEventCatalog): boolean;
112
121
  /** Project an event task into the bounded tool-result shape. */
@@ -1,4 +1,4 @@
1
- import type { PluginRoute, PluginSandbox, PluginOperationalReport, PluginRouteApp, ResourceEvent, SlackConversationLink, PluginRegistration, User } from "@sentry/junior-plugin-api";
1
+ import type { PluginRoute, PluginSandbox, PluginOperationalReport, PluginRouteApp, Platform, ResourceEvent, SlackConversationLink, PluginRegistration, User } from "@sentry/junior-plugin-api";
2
2
  import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
3
3
  import type { AnyToolDefinition } from "@/chat/tools/definition";
4
4
  import type { ToolRuntimeContext } from "@/chat/tools/types";
@@ -50,7 +50,7 @@ export declare function getPlugins(): PluginRegistration[];
50
50
  /** Apply plugin Markdown rewrites before destination delivery formatting. */
51
51
  export declare function applyPluginFormatMarkdown(text: string): string;
52
52
  /** Collect stable plugin prompt contributions for the static system prompt. */
53
- export declare function getPluginSystemPromptContributions(source: ToolRuntimeContext["source"]): Promise<PluginPromptContributionContext[]>;
53
+ export declare function getPluginSystemPromptContributions(platform: Platform): Promise<PluginPromptContributionContext[]>;
54
54
  /** Collect request-scoped plugin prompt contributions. */
55
55
  export declare function getPluginUserPromptContributions(args: {
56
56
  context: Pick<ToolRuntimeContext, "conversationId" | "locationId" | "destination" | "actor" | "resolveActorIdentity" | "source" | "userText">;
@@ -2,7 +2,7 @@ import type { SlackConversationContext } from "@/chat/slack/conversation-context
2
2
  import type { SkillMetadata } from "@/chat/skills";
3
3
  import type { ActiveMcpCatalogSummary } from "@/chat/tool-support/skill/mcp-tool-summary";
4
4
  import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
5
- import type { Destination, Source, SystemActor } from "@sentry/junior-plugin-api";
5
+ import type { Destination, Platform, Source, SystemActor } from "@sentry/junior-plugin-api";
6
6
  export declare const JUNIOR_PERSONALITY: string;
7
7
  export declare const JUNIOR_WORLD: string | null;
8
8
  interface ToolPromptContext {
@@ -10,6 +10,7 @@ interface ToolPromptContext {
10
10
  promptGuidelines?: string[];
11
11
  promptSnippet?: string;
12
12
  }
13
+ type PromptPlatform = Platform;
13
14
  /** Render plugin system prompt additions under a core-owned wrapper. */
14
15
  export declare function buildPluginSystemPromptContributions(contributions: PluginPromptContributionContext[]): string | null;
15
16
  type TurnContextPromptInput = {
@@ -36,10 +37,8 @@ type TurnContextPromptInput = {
36
37
  };
37
38
  configuration?: Record<string, unknown>;
38
39
  };
39
- /** Return byte-stable platform instructions shared by every conversation and turn. */
40
- export declare function buildSystemPrompt(params: {
41
- source: Source;
42
- }): string;
40
+ /** Return the fixed instructions shared by every Conversation and Turn. */
41
+ export declare function buildSystemPrompt(platform: PromptPlatform): string;
43
42
  /** Build volatile runtime context that belongs in the user turn, not the system prompt. */
44
43
  export declare function buildTurnContextPrompt(params: TurnContextPromptInput): string | null;
45
44
  export {};