@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
@@ -7,7 +7,7 @@ import {
7
7
  PluginCredentialFailureError,
8
8
  agentNameSchema,
9
9
  createPluginAuthOrchestration
10
- } from "./chunk-PXP2M32M.js";
10
+ } from "./chunk-QMEF4Z7R.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-YE6DVM43.js";
41
+ } from "./chunk-AWZS5SVX.js";
42
42
  import {
43
43
  RetryableDeliveryError,
44
44
  actorFromRun,
@@ -52,7 +52,7 @@ import {
52
52
  surfaceFromRun,
53
53
  toolInvocationDestination,
54
54
  uploadFilesToConversation
55
- } from "./chunk-SSR6YBWW.js";
55
+ } from "./chunk-ENWIHU54.js";
56
56
  import {
57
57
  CooperativeTurnYieldError,
58
58
  NO_REPLY_MARKER,
@@ -65,7 +65,7 @@ import {
65
65
  isNoReplyMarker,
66
66
  isTurnInputCommitLostError,
67
67
  sanitizeAssistantText
68
- } from "./chunk-7XO7PTZE.js";
68
+ } from "./chunk-G35QGPO2.js";
69
69
  import {
70
70
  AGENTS_REMOVAL_NOTICE,
71
71
  AGENTS_REPLACEMENT_NOTICE,
@@ -74,6 +74,7 @@ import {
74
74
  RIPGREP_EXCLUDED_GLOBS,
75
75
  TURN_CONTEXT_TAG,
76
76
  TurnSliceLimitExceededError,
77
+ assertTurnToolCallLimit,
77
78
  buildAgentsInstructionsMessage,
78
79
  collectFiles,
79
80
  continuableMessages,
@@ -93,6 +94,7 @@ import {
93
94
  isMissingPathError,
94
95
  isToolResultError,
95
96
  isToolResultMessage,
97
+ isTurnExecutionLimitExceededError,
96
98
  listRepositoryDirectories,
97
99
  loadConnectedMcpProviders,
98
100
  loadConversationProjection,
@@ -119,7 +121,7 @@ import {
119
121
  stripRuntimeTurnContext,
120
122
  trimTrailingAssistantMessages,
121
123
  truncateText
122
- } from "./chunk-VF3EDS7P.js";
124
+ } from "./chunk-OEQOAONV.js";
123
125
  import {
124
126
  SCHEDULED_TASK_SYSTEM_ACTOR,
125
127
  WORKSPACE_SNAPSHOT_FAILED_EVENT,
@@ -160,13 +162,13 @@ import {
160
162
  workspaceSnapshotFinishedEvent,
161
163
  workspaceSnapshotWatch,
162
164
  writableEventTask
163
- } from "./chunk-EIYOABL4.js";
165
+ } from "./chunk-WMJS5DDV.js";
164
166
  import {
165
167
  parseSlackThreadId
166
- } from "./chunk-4WIA45WD.js";
168
+ } from "./chunk-IOGDKPVU.js";
167
169
  import {
168
170
  appendAndEnqueueInboundMessage
169
- } from "./chunk-G4E5WIRL.js";
171
+ } from "./chunk-E53C73ML.js";
170
172
  import {
171
173
  SHORT_TITLE_MAX_LENGTH,
172
174
  ToolInputError,
@@ -174,7 +176,7 @@ import {
174
176
  generateShortTitle,
175
177
  hasAgentTurnUsage,
176
178
  resolveTaskTitle
177
- } from "./chunk-OBN7UEQJ.js";
179
+ } from "./chunk-RFE7DCZK.js";
178
180
  import {
179
181
  bindSandboxFileSystem,
180
182
  createSandboxSession,
@@ -185,7 +187,7 @@ import {
185
187
  resolve,
186
188
  setSnapshotSpanAttributes,
187
189
  stopSession
188
- } from "./chunk-3UJSII43.js";
190
+ } from "./chunk-ELCYG6UU.js";
189
191
  import {
190
192
  privateTraceResultAttributes
191
193
  } from "./chunk-UIE3R5XU.js";
@@ -195,7 +197,7 @@ import {
195
197
  } from "./chunk-X6GDDWQH.js";
196
198
  import {
197
199
  getTurnRequestDeadline
198
- } from "./chunk-SZ2O3CGS.js";
200
+ } from "./chunk-NWWDFHXP.js";
199
201
  import {
200
202
  getVercelConversationWorkQueue
201
203
  } from "./chunk-DKIJ2RP5.js";
@@ -242,19 +244,19 @@ import {
242
244
  updateWorkspace,
243
245
  withSlackRetries,
244
246
  workspaceRepoCheckoutPath
245
- } from "./chunk-BUTAWPUV.js";
247
+ } from "./chunk-CCTYK5RH.js";
246
248
  import {
247
249
  getConversationEventStore,
248
250
  getConversationMessageSearchStore,
249
251
  getConversationStore,
250
252
  getDb,
251
253
  getSqlExecutor
252
- } from "./chunk-AKR6W7VV.js";
254
+ } from "./chunk-ADEACKAH.js";
253
255
  import {
254
256
  juniorArtifacts,
255
257
  juniorIdentities,
256
258
  juniorSchedulerRuns
257
- } from "./chunk-IBO4YFFZ.js";
259
+ } from "./chunk-XLWZRHX5.js";
258
260
  import {
259
261
  SANDBOX_DATA_ROOT,
260
262
  SANDBOX_REPOS_ROOT,
@@ -285,12 +287,12 @@ import {
285
287
  throwSandboxOperationError,
286
288
  workspaceSnapshotNotReadyUserMessage,
287
289
  wrapSandboxSetupError
288
- } from "./chunk-6LX6KV5C.js";
290
+ } from "./chunk-7ANA7PBB.js";
289
291
  import {
290
292
  fenceLock,
291
293
  getStateAdapter,
292
294
  withLock
293
- } from "./chunk-LRTEMMCZ.js";
295
+ } from "./chunk-V4HXV5MY.js";
294
296
  import {
295
297
  KNOWN_CONVERSATION_EVENT_TYPES,
296
298
  contextProvenance,
@@ -323,7 +325,7 @@ import {
323
325
  resolveGatewayCredential,
324
326
  resolveGatewayModel,
325
327
  unwrapCurrentInstruction
326
- } from "./chunk-4Z7B5WVV.js";
328
+ } from "./chunk-U76RWMFR.js";
327
329
  import {
328
330
  ModelProfileNotConfiguredError,
329
331
  TURN_REASONING_LEVELS,
@@ -340,16 +342,16 @@ import {
340
342
  toGenAiMessagesTraceAttributes,
341
343
  toGenAiPayloadMetadata,
342
344
  toGenAiPayloadTraceAttributes
343
- } from "./chunk-EYNUOZCN.js";
345
+ } from "./chunk-JOI3DHML.js";
344
346
  import {
345
347
  discoverSkills,
346
348
  findSkillByName,
347
349
  loadSkillsByName,
348
350
  parseSkillInvocation
349
- } from "./chunk-PYVGXGKC.js";
351
+ } from "./chunk-P2P6MUQ4.js";
350
352
  import {
351
353
  pluginCatalogRuntime
352
- } from "./chunk-FGYWKKTJ.js";
354
+ } from "./chunk-WWXJUURQ.js";
353
355
  import {
354
356
  CredentialUnavailableError,
355
357
  OAuthProviderError,
@@ -357,7 +359,7 @@ import {
357
359
  getOAuthProviderErrorAttributes,
358
360
  resolveAuthTokenPlaceholder,
359
361
  resolvePluginCommandEnv
360
- } from "./chunk-6FCKJDKS.js";
362
+ } from "./chunk-S7GX44BU.js";
361
363
  import {
362
364
  credentialContextForActor,
363
365
  credentialUserSubjectId
@@ -393,7 +395,7 @@ import {
393
395
  summarizeMessageText,
394
396
  withLogContext,
395
397
  withSpan
396
- } from "./chunk-3ADPXQBL.js";
398
+ } from "./chunk-X76JVHQ4.js";
397
399
  import {
398
400
  startInactiveSpan,
399
401
  withActiveSpan
@@ -1724,7 +1726,7 @@ var TOOL_POLICY_RULES = [
1724
1726
  "- When a tool result includes a subscription, those events are already watched; do not call watchResourceEvents for them. When a tool result includes a subscribable resource with suggestedEvents, use watchResourceEvents only for those remaining events that serve the current intent. If suggestedEvents is empty or omitted, do not invent a watch. Do not create scheduled polling tasks for events a watch can deliver. Write a concise intent summary, and tell the user when the temporary watch expires. Stop only the requested watch by id unless the user explicitly asks to stop every watch in the thread.",
1725
1727
  "- Use createEventTask only when the user explicitly asks for an event task or durable whenever-this-happens-do-X automation. Ordinary watch, notify, and tell-me-when requests use watchResourceEvents. When an event task's resource and events are known, create it without redundant confirmation.",
1726
1728
  "- Event tasks make the task creator's connected credentials available by default when the requested work needs user-bound authorization. Do not ask for separate confirmation merely to use credentials needed for the requested work. On creation, omit credentialMode for the creator default and set system only when the creator explicitly requires it. For later changes, creator always means the task's original createdBy actor, never the current requester. If the requester is not that creator, do not attempt to enable creator credential use or suggest that confirmation could authorize it.",
1727
- "- Event tasks are managed for the current Slack channel or DM, not one thread. When listing them, use createdBy to explain creator-only credential changes and warn when triggerAvailable is false; an unavailable task remains stored but cannot receive events until its plugin event is enabled again.",
1729
+ "- Event tasks list for the current destination, not one thread. Public tasks can also be updated or deleted by task id from another destination in the same workspace. When listing them, use createdBy to explain creator-only credential changes and warn when triggerAvailable is false; an unavailable task remains stored but cannot receive events until its plugin event is enabled again.",
1728
1730
  "- Scheduled tasks make the task creator's connected credentials available by default when the requested work needs user-bound authorization. Do not ask for separate confirmation merely to use credentials needed for the requested work. On creation, omit credential_mode for the creator default and set system only when the creator explicitly requires it. For later changes, creator always means the task's original created_by actor, never the current requester. If the requester is not that creator, do not attempt to enable creator credential use or suggest that confirmation could authorize it.",
1729
1731
  "- For code changes, debugging or root-cause analysis, broad refactors, and software architecture decisions, use `handoff` before substantive analysis only when it offers a profile that better matches the task. Do not switch merely because the task involves code.",
1730
1732
  "- Run `jr-rpc config get|set|unset|list` for provider defaults and `jr-rpc plugins list` for installed plugin introspection as standalone bash commands; do not chain them with `cd`, `&&`, pipes, or provider commands.",
@@ -1862,6 +1864,11 @@ function formatSourceLines(source) {
1862
1864
  `- source.identifier: ${escapeXml(source.identifier)}`,
1863
1865
  `- source.event_type: ${escapeXml(source.eventType)}`
1864
1866
  ];
1867
+ case "scheduled_task":
1868
+ case "event_task":
1869
+ case "plugin_dispatch":
1870
+ case "agent_invocation":
1871
+ return [`- source.kind: ${source.kind}`];
1865
1872
  }
1866
1873
  }
1867
1874
  function formatDestinationLines(destination) {
@@ -2005,8 +2012,7 @@ var STATIC_SYSTEM_PROMPTS = {
2005
2012
  local: buildStaticSystemPrompt("local"),
2006
2013
  slack: buildStaticSystemPrompt("slack")
2007
2014
  };
2008
- function buildSystemPrompt(params) {
2009
- const platform = params.source.kind === "slack" ? "slack" : "local";
2015
+ function buildSystemPrompt(platform) {
2010
2016
  return STATIC_SYSTEM_PROMPTS[platform];
2011
2017
  }
2012
2018
  function buildTurnContextPrompt(params) {
@@ -2300,11 +2306,12 @@ async function assemblePrompt(args) {
2300
2306
  userContentParts: requestContentParts
2301
2307
  }) : void 0;
2302
2308
  const needsBootstrapContextForPrompt = shouldPromptAgent && !replayedPrompt && !hasRuntimeTurnContext(promptHistoryMessages);
2303
- const systemPromptContributions = await getPluginSystemPromptContributions(source);
2309
+ const platform = args.run.delivery && args.run.location?.provider === "slack" ? "slack" : "local";
2310
+ const systemPromptContributions = await getPluginSystemPromptContributions(platform);
2304
2311
  const pluginSystemPrompt = buildPluginSystemPromptContributions(
2305
2312
  systemPromptContributions
2306
2313
  );
2307
- const baseInstructions = [buildSystemPrompt({ source }), pluginSystemPrompt].filter((section) => Boolean(section)).join("\n\n");
2314
+ const baseInstructions = [buildSystemPrompt(platform), pluginSystemPrompt].filter((section) => Boolean(section)).join("\n\n");
2308
2315
  const pluginUserPromptContributions = !shouldPromptAgent || replayedPrompt ? [] : await getPluginUserPromptContributions({
2309
2316
  context: args.toolRuntimeContext,
2310
2317
  turnId: args.turnId
@@ -8912,7 +8919,7 @@ function createEventTaskTool(context, catalog) {
8912
8919
  readOnlyHint: false
8913
8920
  },
8914
8921
  executionMode: "sequential",
8915
- description: "Create a durable event task that executes the supplied instruction for every matching resource event. Use for whenever-this-happens-do-X automation; ordinary watch, notify, or tell-me-when requests use watchResourceEvents instead. The task remains configured for this Slack channel or DM until deleted and may use the creator's connected credentials. Prefer a subscribable tool result when available.",
8922
+ description: "Create a durable event task that executes the supplied instruction for every matching resource event. Use for whenever-this-happens-do-X automation; ordinary watch, notify, or tell-me-when requests use watchResourceEvents instead. The task may use the creator's connected credentials. Prefer a subscribable tool result when available.",
8916
8923
  inputSchema: z22.object({
8917
8924
  task: z22.string().trim().min(1).max(4e3),
8918
8925
  title: z22.string().trim().min(1).max(SHORT_TITLE_MAX_LENGTH).nullable().describe(
@@ -9000,16 +9007,14 @@ function createDeleteEventTaskTool(context, catalog) {
9000
9007
  readOnlyHint: false
9001
9008
  },
9002
9009
  executionMode: "sequential",
9003
- description: "Delete an event task from this Slack channel or DM, including a task created from another thread in the same destination.",
9010
+ description: "Delete an event task.",
9004
9011
  inputSchema: z23.object({ taskId: z23.string().min(1) }).strict(),
9005
9012
  outputSchema: eventTaskToolResultSchema,
9006
9013
  async execute({ taskId }) {
9007
9014
  const current = await writableEventTask(context, taskId);
9008
9015
  const deleted = await deleteEventTask(getDb(), current.id);
9009
9016
  if (!deleted) {
9010
- throw new ToolInputError(
9011
- "Event task was not found in this Slack channel or DM."
9012
- );
9017
+ throw new ToolInputError("Event task was not found.");
9013
9018
  }
9014
9019
  return eventTaskSuccess(deleted, catalog);
9015
9020
  }
@@ -9027,7 +9032,7 @@ function createListEventTasksTool(context, catalog) {
9027
9032
  openWorldHint: false,
9028
9033
  readOnlyHint: true
9029
9034
  },
9030
- description: "List event tasks for this Slack channel or DM, including tasks created from other threads in the same destination. A false triggerAvailable value means the task remains stored but its plugin event is not currently enabled.",
9035
+ description: "List event tasks for the current destination. A false triggerAvailable value means the task remains stored but its plugin event is not currently enabled.",
9031
9036
  inputSchema: z24.object({}).strict(),
9032
9037
  outputSchema: eventTaskListToolResultSchema,
9033
9038
  async execute() {
@@ -9060,7 +9065,7 @@ function createUpdateEventTaskTool(context, catalog) {
9060
9065
  readOnlyHint: false
9061
9066
  },
9062
9067
  executionMode: "sequential",
9063
- description: "Update the instruction, registered trigger, or credential use for an event task in this Slack channel or DM. Event tasks created from other threads in the same destination are manageable here.",
9068
+ description: "Update the instruction, registered trigger, or credential use for an event task.",
9064
9069
  inputSchema: z25.object({
9065
9070
  taskId: z25.string().min(1),
9066
9071
  task: z25.string().trim().min(1).max(4e3).nullable().optional(),
@@ -9125,9 +9130,7 @@ function createUpdateEventTaskTool(context, catalog) {
9125
9130
  }
9126
9131
  const saved = await saveEventTask(getDb(), next);
9127
9132
  if (!saved) {
9128
- throw new ToolInputError(
9129
- "Event task was not found in this Slack channel or DM."
9130
- );
9133
+ throw new ToolInputError("Event task was not found.");
9131
9134
  }
9132
9135
  return eventTaskSuccess(saved, catalog);
9133
9136
  }
@@ -10700,7 +10703,7 @@ function createSlackChannelJoinTool(context) {
10700
10703
  const access = await checkSlackChannelReadAccess({
10701
10704
  currentChannelIds: [
10702
10705
  context.destinationChannelId,
10703
- context.sourceChannelId
10706
+ context.locationChannelId
10704
10707
  ],
10705
10708
  targetChannelId: target.channelId,
10706
10709
  teamId: context.teamId
@@ -10846,7 +10849,7 @@ function createSlackChannelListMessagesTool(context) {
10846
10849
  const access = await checkSlackChannelReadAccess({
10847
10850
  currentChannelIds: [
10848
10851
  context.destinationChannelId,
10849
- context.sourceChannelId
10852
+ context.locationChannelId
10850
10853
  ],
10851
10854
  targetChannelId,
10852
10855
  teamId: context.teamId
@@ -11482,11 +11485,11 @@ function createSlackMessageAddReactionTool(context, state) {
11482
11485
  }),
11483
11486
  outputSchema: juniorToolOutputSchema,
11484
11487
  execute: async ({ emoji }) => {
11485
- const targetChannelId = context.sourceChannelId;
11488
+ const targetChannelId = context.messageChannelId;
11486
11489
  const targetMessageTs = context.messageTs;
11487
- if (!targetMessageTs) {
11490
+ if (!targetChannelId || !targetMessageTs) {
11488
11491
  throw new ToolInputError(
11489
- "No active message timestamp is available for reactions."
11492
+ "No active Slack message is available for reactions."
11490
11493
  );
11491
11494
  }
11492
11495
  const normalizedEmoji = normalizeSlackEmojiName(emoji);
@@ -11572,22 +11575,14 @@ function createSendFilesTool(context, state, materializeFile, attachments) {
11572
11575
  outputSchema: sendFilesResultSchema,
11573
11576
  execute: async ({ files }, options) => {
11574
11577
  const filesToSend = normalizeFiles(files);
11575
- const activeChannelId = context.sourceChannelId;
11576
- if (!activeChannelId) {
11577
- throw new ToolInputError("No active Slack conversation is available.");
11578
- }
11578
+ const activeChannelId = context.locationChannelId;
11579
11579
  const threadTs = context.threadTs ?? context.messageTs;
11580
- if (!threadTs) {
11581
- throw new ToolInputError(
11582
- "No active Slack conversation timestamp is available."
11583
- );
11584
- }
11585
11580
  const materializedFiles = await Promise.all(
11586
11581
  filesToSend.map((file) => materializeFile(file))
11587
11582
  );
11588
11583
  const operationKey = createOperationKey("sendFiles", {
11589
11584
  channel_id: activeChannelId,
11590
- thread_ts: threadTs,
11585
+ thread_ts: threadTs ?? null,
11591
11586
  files: fileOperationInput(materializedFiles)
11592
11587
  });
11593
11588
  const cached = state.getOperationResult(operationKey);
@@ -11617,7 +11612,7 @@ function createSendFilesTool(context, state, materializeFile, attachments) {
11617
11612
  await uploadFilesToConversation({
11618
11613
  channelId: activeChannelId,
11619
11614
  files: uploads,
11620
- threadTs
11615
+ ...threadTs ? { threadTs } : void 0
11621
11616
  });
11622
11617
  const delivered = stored.map(
11623
11618
  (attachment, index) => {
@@ -12940,7 +12935,7 @@ function createSlackThreadReadTool(context) {
12940
12935
  const access = await checkSlackChannelReadAccess({
12941
12936
  currentChannelIds: [
12942
12937
  context.destinationChannelId,
12943
- context.sourceChannelId
12938
+ context.locationChannelId
12944
12939
  ],
12945
12940
  targetChannelId: channelId,
12946
12941
  teamId: context.teamId
@@ -13699,6 +13694,14 @@ async function resolveAccessScope(conversationStore, context, currentConversatio
13699
13694
  currentConversationId,
13700
13695
  current.parentConversationId
13701
13696
  ) : currentConversationId;
13697
+ if (context.location?.provider === "slack") {
13698
+ return {
13699
+ currentConversationId,
13700
+ currentRootConversationId,
13701
+ provider: "slack",
13702
+ providerTenantId: context.location.teamId
13703
+ };
13704
+ }
13702
13705
  if (context.source.kind === "slack") {
13703
13706
  return {
13704
13707
  currentConversationId,
@@ -14839,9 +14842,9 @@ function createToolState() {
14839
14842
  function createTools(availableSkills, hooks = {}, context, options = {}) {
14840
14843
  const state = createToolState();
14841
14844
  const slackContext = getSlackToolContext(context);
14842
- const slackSourceCapabilities = slackContext ? resolveChannelCapabilities(slackContext.sourceChannelId) : void 0;
14845
+ const slackLocationCapabilities = slackContext ? resolveChannelCapabilities(slackContext.locationChannelId) : void 0;
14843
14846
  const canSendFilesToActiveConversation = Boolean(
14844
- slackContext && slackSourceCapabilities?.canSendFiles
14847
+ slackContext && slackLocationCapabilities?.canSendFiles
14845
14848
  );
14846
14849
  const resourceEventCatalog = getResourceEventCatalog();
14847
14850
  const tools = {
@@ -14919,7 +14922,7 @@ function createTools(availableSkills, hooks = {}, context, options = {}) {
14919
14922
  tools.slackCanvasWrite = createSlackCanvasWriteTool(state);
14920
14923
  tools.slackThreadRead = createSlackThreadReadTool(slackContext);
14921
14924
  tools.slackChannelJoin = createSlackChannelJoinTool(slackContext);
14922
- if (slackContext.source.visibility === "public") {
14925
+ if (context.conversationPrivacy === "public") {
14923
14926
  tools.searchConversationMessages = createSlackConversationMessageSearchTool(
14924
14927
  {
14925
14928
  kind: "public_provider_tenant",
@@ -14948,8 +14951,8 @@ function createTools(availableSkills, hooks = {}, context, options = {}) {
14948
14951
  tools.slackListUpdateItem = createSlackListUpdateItemTool(state);
14949
14952
  const outputChannelId = slackContext.destinationChannelId;
14950
14953
  const outputCapabilities = outputChannelId ? resolveChannelCapabilities(outputChannelId) : void 0;
14951
- const rawChannelCapabilities = resolveChannelCapabilities(
14952
- slackContext.sourceChannelId
14954
+ const locationCapabilities = resolveChannelCapabilities(
14955
+ slackContext.locationChannelId
14953
14956
  );
14954
14957
  if (outputCapabilities?.canCreateCanvas) {
14955
14958
  tools.slackCanvasCreate = createSlackCanvasCreateTool(
@@ -14957,7 +14960,7 @@ function createTools(availableSkills, hooks = {}, context, options = {}) {
14957
14960
  state
14958
14961
  );
14959
14962
  }
14960
- if (rawChannelCapabilities.canSendFiles) {
14963
+ if (locationCapabilities.canSendFiles) {
14961
14964
  tools.sendFiles = createSendFilesTool(
14962
14965
  slackContext,
14963
14966
  state,
@@ -14970,7 +14973,7 @@ function createTools(availableSkills, hooks = {}, context, options = {}) {
14970
14973
  );
14971
14974
  }
14972
14975
  tools.slackChannelListMessages = createSlackChannelListMessagesTool(slackContext);
14973
- if (rawChannelCapabilities.canAddReactions) {
14976
+ if (context.source.kind === "slack" && locationCapabilities.canAddReactions) {
14974
14977
  tools.addReaction = createSlackMessageAddReactionTool(
14975
14978
  slackContext,
14976
14979
  state
@@ -17545,9 +17548,13 @@ function resolveToolRuntimeRoute(args) {
17545
17548
  source: args.run.source
17546
17549
  };
17547
17550
  case "resource_event":
17551
+ case "scheduled_task":
17552
+ case "event_task":
17553
+ case "plugin_dispatch":
17554
+ case "agent_invocation":
17548
17555
  return {
17549
17556
  destination,
17550
- actor: args.actor?.platform === "system" ? args.actor : void 0,
17557
+ actor: args.actor,
17551
17558
  source: args.run.source
17552
17559
  };
17553
17560
  }
@@ -17642,7 +17649,11 @@ async function wireAgentTools(args) {
17642
17649
  );
17643
17650
  const commonToolRuntimeContext = {
17644
17651
  conversationId: args.run.conversationId,
17645
- ...args.run.location ? { locationId: args.run.location.id } : void 0,
17652
+ ...args.run.location ? {
17653
+ location: args.run.location,
17654
+ locationId: args.run.location.id
17655
+ } : void 0,
17656
+ conversationPrivacy: args.conversationPrivacy,
17646
17657
  userText: args.userInput,
17647
17658
  configuration: args.configurationValues,
17648
17659
  egress: createPluginEgress({
@@ -17859,6 +17870,7 @@ function createResumeState(args) {
17859
17870
  let resumeMessages = [];
17860
17871
  let turnContexts = [];
17861
17872
  let turnStartMessageIndex;
17873
+ let cumulativeToolCallCount = args.checkpoint.record?.cumulativeToolCallCount ?? 0;
17862
17874
  let advancedPastResume = !args.checkpoint.resumed;
17863
17875
  let resumedBoundaryKey = "";
17864
17876
  if (args.checkpoint.resumed && args.checkpoint.record.piMessages.length) {
@@ -17875,6 +17887,7 @@ function createResumeState(args) {
17875
17887
  conversationId: args.conversationId,
17876
17888
  turnId: args.turnId,
17877
17889
  channelName: args.channelName,
17890
+ cumulativeToolCallCount,
17878
17891
  destination: args.destination,
17879
17892
  dispatchId: args.dispatchId,
17880
17893
  source: args.runSource,
@@ -17897,6 +17910,12 @@ function createResumeState(args) {
17897
17910
  setBeforeMessageCount(count) {
17898
17911
  beforeMessageCount = count;
17899
17912
  },
17913
+ /** Admit one tool call against the durable turn total, or throw the limit. */
17914
+ admitToolCall() {
17915
+ const next = cumulativeToolCallCount + 1;
17916
+ assertTurnToolCallLimit(next, botConfig.maxToolCallsPerTurn);
17917
+ cumulativeToolCallCount = next;
17918
+ },
17900
17919
  setTurnContexts(contexts) {
17901
17920
  turnContexts = contexts;
17902
17921
  },
@@ -17990,7 +18009,7 @@ function createResumeState(args) {
17990
18009
  ...usage ? { usage } : void 0
17991
18010
  };
17992
18011
  } catch (error) {
17993
- if (error instanceof AuthPausePersistenceError || error instanceof TurnSliceLimitExceededError) {
18012
+ if (error instanceof AuthPausePersistenceError || isTurnExecutionLimitExceededError(error)) {
17994
18013
  throw error;
17995
18014
  }
17996
18015
  throw new AuthPausePersistenceError(
@@ -18642,7 +18661,7 @@ async function executeAgentRun(run, streamFn) {
18642
18661
  const userActor = actor && "userId" in actor ? actor : void 0;
18643
18662
  const runLogContext = {
18644
18663
  conversationId: run.conversationId,
18645
- platform: run.source.kind,
18664
+ platform: run.source.kind === "slack" || run.source.kind === "web" || run.source.kind === "local" ? run.source.kind : void 0,
18646
18665
  messageConversationId: run.source.kind === "slack" ? run.conversationId : run.source.kind === "web" || run.source.kind === "local" ? run.source.conversationId : run.conversationId,
18647
18666
  destinationName: run.location?.channelId ?? (run.source.kind === "slack" ? run.source.channelId : run.source.kind === "web" || run.source.kind === "local" ? run.source.conversationId : run.conversationId),
18648
18667
  userId: userActor?.userId,
@@ -19372,6 +19391,17 @@ async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogC
19372
19391
  reason: `${exclusiveTool} must be the only tool call in its assistant message; reissue it alone`
19373
19392
  };
19374
19393
  }
19394
+ try {
19395
+ runResume.admitToolCall();
19396
+ } catch (error) {
19397
+ const limitError = error instanceof Error ? error : new Error(String(error));
19398
+ pendingPiHookError ??= limitError;
19399
+ return {
19400
+ block: true,
19401
+ reason: limitError.message,
19402
+ terminate: true
19403
+ };
19404
+ }
19375
19405
  return void 0;
19376
19406
  },
19377
19407
  afterToolCall: async ({ result: result2, toolCall }, signal2) => {
@@ -19565,6 +19595,11 @@ async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogC
19565
19595
  );
19566
19596
  throw pendingAuthPause;
19567
19597
  }
19598
+ if (pendingPiHookError) {
19599
+ const hookError = pendingPiHookError;
19600
+ pendingPiHookError = void 0;
19601
+ throw hookError;
19602
+ }
19568
19603
  throw error;
19569
19604
  } finally {
19570
19605
  if (timeoutId) {
@@ -19774,7 +19809,7 @@ async function executeAgentRunInPrivacyContext(run, conversationPrivacy, runLogC
19774
19809
  throw error.originalError;
19775
19810
  }
19776
19811
  const runError = error instanceof AssistantMessageDeliveryError ? error.originalError : error;
19777
- if (runError instanceof AuthPausePersistenceError || runError instanceof TurnSliceLimitExceededError) {
19812
+ if (runError instanceof AuthPausePersistenceError || isTurnExecutionLimitExceededError(runError)) {
19778
19813
  throw runError;
19779
19814
  }
19780
19815
  if (resume && runError instanceof AuthorizationPauseError) {
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  persistConversationMessages
3
- } from "./chunk-VF3EDS7P.js";
3
+ } from "./chunk-OEQOAONV.js";
4
4
  import {
5
5
  JUNIOR_THREAD_STATE_TTL_MS
6
6
  } from "./chunk-3Y47VMHV.js";
7
7
  import {
8
8
  getDb
9
- } from "./chunk-AKR6W7VV.js";
9
+ } from "./chunk-ADEACKAH.js";
10
10
  import {
11
11
  juniorLocationConfigurations
12
- } from "./chunk-IBO4YFFZ.js";
12
+ } from "./chunk-XLWZRHX5.js";
13
13
  import {
14
14
  getStateAdapter
15
- } from "./chunk-LRTEMMCZ.js";
15
+ } from "./chunk-V4HXV5MY.js";
16
16
  import {
17
17
  juniorDestinations
18
18
  } from "./chunk-VFUK3X5B.js";
@@ -20,7 +20,7 @@ import {
20
20
  isRecord,
21
21
  toOptionalNumber,
22
22
  toOptionalString
23
- } from "./chunk-3ADPXQBL.js";
23
+ } from "./chunk-X76JVHQ4.js";
24
24
 
25
25
  // src/chat/state/conversation.ts
26
26
  function defaultConversationState() {
@@ -3,39 +3,39 @@ import {
3
3
  } from "./chunk-RC745GGZ.js";
4
4
  import {
5
5
  parseSlackThreadId
6
- } from "./chunk-4WIA45WD.js";
6
+ } from "./chunk-IOGDKPVU.js";
7
7
  import {
8
8
  appendAndEnqueueExclusiveInboundMessage,
9
9
  appendAndEnqueueInboundMessage
10
- } from "./chunk-G4E5WIRL.js";
10
+ } from "./chunk-E53C73ML.js";
11
11
  import {
12
12
  buildDeterministicTurnId
13
13
  } from "./chunk-DA2KGZZI.js";
14
14
  import {
15
15
  normalizeSlackConversationId
16
- } from "./chunk-BUTAWPUV.js";
16
+ } from "./chunk-CCTYK5RH.js";
17
17
  import {
18
18
  getConversationStore,
19
19
  getDb
20
- } from "./chunk-AKR6W7VV.js";
20
+ } from "./chunk-ADEACKAH.js";
21
21
  import {
22
22
  juniorConversationParticipants,
23
23
  juniorConversations,
24
24
  juniorIdentities,
25
25
  juniorUsers
26
- } from "./chunk-IBO4YFFZ.js";
26
+ } from "./chunk-XLWZRHX5.js";
27
27
  import {
28
28
  juniorDestinations
29
29
  } from "./chunk-VFUK3X5B.js";
30
30
  import {
31
31
  getSlackBotToken
32
- } from "./chunk-4Z7B5WVV.js";
32
+ } from "./chunk-U76RWMFR.js";
33
33
  import {
34
34
  canExposeConversationPayload
35
- } from "./chunk-EYNUOZCN.js";
35
+ } from "./chunk-JOI3DHML.js";
36
36
  import {
37
37
  logWarn
38
- } from "./chunk-3ADPXQBL.js";
38
+ } from "./chunk-X76JVHQ4.js";
39
39
 
40
40
  // src/handlers/health.ts
41
41
  function readHealthReport() {
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@sentry/junior",
4
- version: "0.192.0",
4
+ version: "0.194.0",
5
5
  private: false,
6
6
  publishConfig: {
7
7
  access: "public"